select.less 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. //
  2. // Select
  3. // --------------------------------------------------
  4. // Select container
  5. .select {
  6. position: relative;
  7. display: inline-block;
  8. vertical-align: top;
  9. min-width: 220px;
  10. width: auto;
  11. .form-group & {
  12. width: 100%;
  13. > .select2-choice {
  14. width: 100%;
  15. }
  16. }
  17. &.form-control {
  18. border: none;
  19. padding: 0;
  20. height: auto;
  21. }
  22. }
  23. // Select wrapper
  24. .select2-choice {
  25. width: 100%;
  26. display: inline-block;
  27. position: relative;
  28. border: none;
  29. font-size: @select-font-size-base;
  30. font-weight: @select-font-weight;
  31. line-height: @select-line-height-base;
  32. border-radius: @border-radius-base;
  33. padding: 10px 39px 10px 15px;
  34. transition: border .25s linear, color .25s linear, background-color .25s linear;
  35. &:hover,
  36. &:focus {
  37. outline: none;
  38. }
  39. &:active {
  40. outline: none;
  41. box-shadow: none;
  42. }
  43. .select2-container-disabled & {
  44. .opacity(@select-disabled-opacity);
  45. }
  46. }
  47. // Select label
  48. .select2-chosen {
  49. overflow: hidden;
  50. text-align: left;
  51. }
  52. // Select arrow
  53. .select2-arrow {
  54. display: inline-block;
  55. border-width: 8px 6px;
  56. border-color: @select-arrow-color transparent;
  57. border-style: solid;
  58. border-bottom-style: none;
  59. position: absolute;
  60. right: 16px;
  61. top: 42%;
  62. transform: scale(1.001);
  63. b {
  64. display: none;
  65. }
  66. .btn-lg & {
  67. border-top-width: 8px;
  68. border-right-width: 6px;
  69. border-left-width: 6px;
  70. }
  71. }
  72. // Alternate color variants
  73. .select-default {
  74. .select-variant(@select-default-color, @select-default-bg, @select-default-hover-bg, @select-default-active-bg, @arrow-color: @inverse);
  75. }
  76. .select-primary {
  77. .select-variant(@select-default-color, @brand-secondary, @select-primary-hover-bg, @select-primary-active-bg, @arrow-color: @inverse);
  78. }
  79. .select-info {
  80. .select-variant(@select-default-color, @brand-info, @select-info-hover-bg, @select-info-active-bg, @arrow-color: @inverse);
  81. }
  82. .select-danger {
  83. .select-variant(@select-default-color, @brand-danger, @select-danger-hover-bg, @select-danger-active-bg, @arrow-color: @inverse);
  84. }
  85. .select-success {
  86. .select-variant(@select-default-color, @brand-success, @select-success-hover-bg, @select-success-active-bg, @arrow-color: @inverse);
  87. }
  88. .select-warning {
  89. .select-variant(@select-default-color, @brand-warning, @select-warning-hover-bg, @select-warning-active-bg, @arrow-color: @inverse);
  90. }
  91. .select-inverse {
  92. .select-variant(@select-default-color, @brand-primary, @select-inverse-hover-bg, @select-inverse-active-bg, @arrow-color: @inverse);
  93. }
  94. // Select sizes
  95. .select-hg {
  96. .select2-container& {
  97. > .select2-choice {
  98. .select-size(13px, 20px, @select-font-size-hg, @select-line-height-hg, @border-radius-large);
  99. .filter-option {
  100. left: 20px;
  101. right: 40px;
  102. top: 13px;
  103. }
  104. .select2-arrow {
  105. right: 20px;
  106. }
  107. > [class^="fui-"] {
  108. top: 2px;
  109. }
  110. }
  111. }
  112. }
  113. .select-lg {
  114. .select2-container& {
  115. > .select2-choice {
  116. .select-size(10px, 19px, @select-font-size-lg, @select-line-height-lg, @border-radius-large);
  117. .filter-option {
  118. left: 18px;
  119. right: 38px;
  120. }
  121. }
  122. }
  123. }
  124. .select-sm {
  125. .select2-container& {
  126. > .select2-choice {
  127. .select-size(9px, 13px, @select-font-size-sm, @select-line-height-sm, @border-radius-base);
  128. .filter-option {
  129. left: 13px;
  130. right: 33px;
  131. }
  132. .select2-arrow {
  133. right: 13px;
  134. }
  135. }
  136. }
  137. }
  138. // Multiselect
  139. //
  140. // ##
  141. // Multiselect container
  142. .multiselect {
  143. position: relative;
  144. display: inline-block;
  145. vertical-align: top;
  146. min-width: 220px;
  147. width: auto;
  148. background-color: @multiselect-container-bg;
  149. border-radius: @multiselect-container-border-radius;
  150. text-align: left;
  151. font-size: 0;
  152. width: auto;
  153. max-width: none;
  154. .form-group & {
  155. width: 100%;
  156. > .select2-choice {
  157. width: 100%;
  158. }
  159. }
  160. &.form-control {
  161. height: auto;
  162. padding: 6px 1px 1px 6px;
  163. border: 2px solid @multiselect-container-border-color;
  164. }
  165. }
  166. // Multiselect tags wrapper
  167. .select2-choices {
  168. margin: 0;
  169. padding: 0;
  170. position: relative;
  171. cursor: text;
  172. overflow: hidden;
  173. min-height: 26px;
  174. &:extend(.clearfix all);
  175. li {
  176. float: left;
  177. list-style: none;
  178. }
  179. }
  180. // Multiselect tag
  181. .select2-search-choice {
  182. border-radius: @multiselect-tag-border-radius;
  183. color: @multiselect-tag-color;
  184. font-size: floor((@component-font-size-base * 0.886)); // ~13px
  185. cursor: pointer;
  186. display: inline-block;
  187. position: relative;
  188. vertical-align: middle;
  189. overflow: hidden;
  190. margin: 0 5px 4px 0;
  191. line-height: 15px;
  192. height: 27px;
  193. padding: 6px 21px;
  194. transition: .25s linear;
  195. &:hover {
  196. padding-right: 28px;
  197. padding-left: 14px;
  198. color: @multiselect-tag-hover-color;
  199. .select2-search-choice-close {
  200. opacity: 1;
  201. filter: none;
  202. color: inherit;
  203. }
  204. }
  205. // Tag close icon
  206. .select2-search-choice-close {
  207. color: @multiselect-tag-icon-color;
  208. cursor: pointer;
  209. font-size: ceil((@component-font-size-base * 0.8)); // ~12px;
  210. position: absolute;
  211. right: 0;
  212. text-align: right;
  213. text-decoration: none;
  214. top: 0;
  215. width: 100%;
  216. bottom: 0;
  217. padding-right: 10px;
  218. z-index: 2;
  219. .opacity(0);
  220. transition: opacity .25s linear;
  221. &:after {
  222. content: "\e609";
  223. font-family: "Flat-UI-Icons";
  224. line-height: 27px;
  225. -webkit-font-smoothing: antialiased;
  226. -moz-osx-font-smoothing: grayscale;
  227. }
  228. }
  229. }
  230. // Multiselect search field
  231. .select2-search-field {
  232. input[type="text"] {
  233. color: @multiselect-input-color;
  234. font-size: ceil((@component-font-size-base * 0.933)); // 14px;
  235. border: none;
  236. box-shadow: none;
  237. outline: none;
  238. background-color: transparent;
  239. padding: 0;
  240. margin: 0;
  241. width: auto;
  242. max-width: inherit;
  243. min-width: 80px;
  244. vertical-align: top;
  245. height: 29px;
  246. }
  247. &:first-child input[type="text"] {
  248. height: 23px;
  249. margin: 3px 0 5px;
  250. }
  251. }
  252. // Multiselect variants
  253. .multiselect-default {
  254. .multiple-select-variant(@select-default-bg, @select-default-hover-bg, @select-default-bg);
  255. }
  256. .multiselect-primary {
  257. .multiple-select-variant(@brand-secondary, @select-primary-hover-bg, @brand-secondary);
  258. }
  259. .multiselect-info {
  260. .multiple-select-variant(@brand-info, @select-info-hover-bg, @brand-info);
  261. }
  262. .multiselect-danger {
  263. .multiple-select-variant(@brand-danger, @select-danger-hover-bg, @brand-danger);
  264. }
  265. .multiselect-success {
  266. .multiple-select-variant(@brand-success, @select-success-hover-bg, @brand-success);
  267. }
  268. .multiselect-warning {
  269. .multiple-select-variant(@brand-warning, @select-warning-hover-bg, @brand-warning);
  270. }
  271. .multiselect-inverse {
  272. .multiple-select-variant(@brand-primary, @select-inverse-hover-bg, @brand-primary);
  273. }
  274. // Select dropdown
  275. //
  276. // ##
  277. // Dropdown container
  278. .select2-drop {
  279. &:extend(.dropdown-menu);
  280. min-width: 220px;
  281. margin-top: 9px;
  282. visibility: visible;
  283. opacity: 1;
  284. filter: none;
  285. border-radius: @select-dropdown-border-radius;
  286. font-size: 14px;
  287. position: absolute;
  288. z-index: 9999;
  289. top: 100%;
  290. transition: none;
  291. &.select2-drop-above {
  292. margin-top: -9px;
  293. }
  294. &.select2-drop-auto-width {
  295. width: auto;
  296. }
  297. &.show-select-search .select2-search {
  298. display: block;
  299. + .select2-results {
  300. > li:first-child .select2-result-label {
  301. border-radius: 0;
  302. }
  303. }
  304. }
  305. // Result list
  306. .select2-results {
  307. padding: 0;
  308. margin: 0;
  309. list-style: none;
  310. > li:first-child > .select2-result-label {
  311. .border-top-radius(@select-dropdown-border-radius);
  312. }
  313. > li:last-child > .select2-result-label {
  314. .border-bottom-radius(@select-dropdown-border-radius);
  315. }
  316. }
  317. .select2-result-sub {
  318. padding: 0;
  319. margin: 0;
  320. list-style: none;
  321. > li:last-child > .select2-result-label {
  322. .border-bottom-radius(@select-dropdown-border-radius);
  323. }
  324. }
  325. // No results title
  326. .select2-no-results {
  327. padding: 8px 15px;
  328. }
  329. // Result list item
  330. .select2-result-label {
  331. line-height: 1.429; // ~20px
  332. padding: 8px 16px;
  333. user-select: none;
  334. transition: background-color .25s, color .25s;
  335. }
  336. // ## Styles for lists without optgroups
  337. .select2-result-selectable {
  338. .select2-result-label {
  339. color: @select-dropdown-item-color;
  340. cursor: pointer;
  341. &:focus,
  342. &:hover,
  343. &:active {
  344. background-color: @select-dropdown-item-hover-bg;
  345. color: @select-dropdown-item-hover-color;
  346. outline: none;
  347. }
  348. }
  349. }
  350. // Disabled item
  351. .select2-disabled {
  352. cursor: default;
  353. color: @select-dropdown-disabled-item-color;
  354. .opacity(@select-dropdown-disabled-item-opacity);
  355. &:focus,
  356. &:hover,
  357. &:active {
  358. background: none !important;
  359. }
  360. }
  361. // Highlighted item
  362. .select2-highlighted {
  363. > .select2-result-label {
  364. background: @select-dropdown-highlighted-item-bg;
  365. color: @select-dropdown-highlighted-item-color;
  366. }
  367. }
  368. // ## Styles for lists with optgroups
  369. .select2-result-with-children {
  370. // Optgroup title
  371. > .select2-result-label {
  372. font-size: floor((@component-font-size-base * 0.867)); // 13px
  373. text-transform: uppercase;
  374. color: @select-dropdown-optgroup-color;
  375. margin-top: 5px;
  376. }
  377. + .select2-result-with-children {
  378. > .select2-result-label {
  379. margin-top: 11px;
  380. }
  381. }
  382. }
  383. }
  384. // Dropdown wrapper
  385. .select2-results {
  386. max-height: 200px;
  387. position: relative;
  388. overflow-x: hidden;
  389. overflow-y: auto;
  390. -webkit-tap-highlight-color: rgba(0,0,0,0);
  391. }
  392. // Dropdown search field
  393. .select2-search {
  394. padding: 8px 6px;
  395. width: 100%;
  396. display: none;
  397. input[type="text"] {
  398. &:extend(.form-control all, .input-sm all);
  399. width: 100%;
  400. height: auto !important;
  401. }
  402. }
  403. // Dropdown inverse variant
  404. .select-inverse-dropdown {
  405. background-color: @brand-primary;
  406. color: fade(@inverse, 75%);
  407. // Result list
  408. .select2-results {
  409. .select2-result-label {
  410. color: @inverse;
  411. &:focus,
  412. &:hover,
  413. &:active {
  414. background: mix(@brand-primary, black, 85%);
  415. }
  416. }
  417. &.select2-disabled .select2-result-label:hover {
  418. color: @inverse;
  419. }
  420. }
  421. // Optgroup result list
  422. .select2-result-with-children {
  423. // Optgroup title
  424. > .select2-result-label {
  425. color: fade(@inverse, 60%);
  426. &:hover {
  427. color: @inverse;
  428. background: none !important;
  429. }
  430. }
  431. }
  432. }
  433. // Multiselect dropdown wrapper
  434. .select2-drop-multi {
  435. border-radius: @multiselect-dropdown-border-radius;
  436. .select2-results {
  437. padding: 2px 0;
  438. }
  439. .select2-result {
  440. padding: 2px 4px;
  441. }
  442. .select2-result-label {
  443. border-radius: @multiselect-dropdown-item-border-radius;
  444. }
  445. .select2-selected {
  446. display: none;
  447. }
  448. }
  449. // Helpers
  450. //
  451. // ##
  452. .select2-offscreen,
  453. .select2-offscreen:focus {
  454. clip: rect(0 0 0 0) !important;
  455. width: 1px !important;
  456. height: 1px !important;
  457. border: 0 !important;
  458. margin: 0 !important;
  459. padding: 0 !important;
  460. overflow: hidden !important;
  461. position: absolute !important;
  462. outline: 0 !important;
  463. left: 0 !important;
  464. top: 0 !important;
  465. }
  466. .select2-hidden-accessible {
  467. border: 0;
  468. clip: rect(0 0 0 0);
  469. height: 1px;
  470. margin: -1px;
  471. overflow: hidden;
  472. padding: 0;
  473. position: absolute;
  474. width: 1px;
  475. }
  476. .select2-offscreen,
  477. .select2-offscreen:focus {
  478. clip: rect(0 0 0 0) !important;
  479. width: 1px !important;
  480. height: 1px !important;
  481. border: 0 !important;
  482. margin: 0 !important;
  483. padding: 0 !important;
  484. overflow: hidden !important;
  485. position: absolute !important;
  486. outline: 0 !important;
  487. left: 0 !important;
  488. top: 0 !important;
  489. }
  490. .select2-display-none {
  491. display: none;
  492. }
  493. .select2-measure-scrollbar {
  494. position: absolute;
  495. top: -10000px;
  496. left: -10000px;
  497. width: 100px;
  498. height: 100px;
  499. overflow: scroll;
  500. }
  501. .select2-drop-mask {
  502. border: 0;
  503. margin: 0;
  504. padding: 0;
  505. position: fixed;
  506. left: 0;
  507. top: 0;
  508. min-height: 100%;
  509. min-width: 100%;
  510. height: auto;
  511. width: auto;
  512. z-index: 9998;
  513. /* styles required for IE to work */
  514. background-color: #fff;
  515. .opacity(0);
  516. }