bootstrap-select.less 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. @import "variables";
  2. // Mixins
  3. .cursor-disabled() {
  4. cursor: not-allowed;
  5. }
  6. // Rules
  7. select.bs-select-hidden,
  8. .bootstrap-select > select.bs-select-hidden,
  9. select.selectpicker {
  10. display: none !important;
  11. }
  12. .bootstrap-select {
  13. width: 220px \0; /*IE9 and below*/
  14. vertical-align: middle;
  15. // The selectpicker button
  16. > .dropdown-toggle {
  17. position: relative;
  18. width: 100%;
  19. // necessary for proper positioning of caret in Bootstrap 4 (pushes caret to the right)
  20. text-align: right;
  21. white-space: nowrap;
  22. // force caret to be vertically centered for Bootstrap 4 multi-line buttons
  23. display: inline-flex;
  24. align-items: center;
  25. justify-content: space-between;
  26. &:after {
  27. margin-top: -1px;
  28. }
  29. &.bs-placeholder {
  30. &,
  31. &:hover,
  32. &:focus,
  33. &:active {
  34. color: @input-color-placeholder;
  35. }
  36. &.btn-primary,
  37. &.btn-secondary,
  38. &.btn-success,
  39. &.btn-danger,
  40. &.btn-info,
  41. &.btn-dark {
  42. &,
  43. &:hover,
  44. &:focus,
  45. &:active {
  46. color: @input-alt-color-placeholder;
  47. }
  48. }
  49. }
  50. }
  51. > select {
  52. position: absolute !important;
  53. bottom: 0;
  54. left: 50%;
  55. display: block !important;
  56. width: 0.5px !important;
  57. height: 100% !important;
  58. padding: 0 !important;
  59. opacity: 0 !important;
  60. border: none;
  61. z-index: 0 !important;
  62. &.mobile-device {
  63. top: 0;
  64. left: 0;
  65. display: block !important;
  66. width: 100% !important;
  67. z-index: 2 !important;
  68. }
  69. }
  70. // Error display
  71. .has-error & .dropdown-toggle,
  72. .error & .dropdown-toggle,
  73. &.is-invalid .dropdown-toggle,
  74. .was-validated & .selectpicker:invalid + .dropdown-toggle {
  75. border-color: @color-red-error;
  76. }
  77. &.is-valid .dropdown-toggle,
  78. .was-validated & .selectpicker:valid + .dropdown-toggle {
  79. border-color: @color-green-success;
  80. }
  81. &.fit-width {
  82. width: auto !important;
  83. }
  84. &:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
  85. width: @width-default;
  86. }
  87. > select.mobile-device:focus + .dropdown-toggle,
  88. .dropdown-toggle:focus {
  89. outline: thin dotted #333333 !important;
  90. outline: 5px auto -webkit-focus-ring-color !important;
  91. outline-offset: -2px;
  92. }
  93. }
  94. // The selectpicker components
  95. .bootstrap-select {
  96. &.form-control {
  97. margin-bottom: 0;
  98. padding: 0;
  99. border: none;
  100. :not(.input-group) > &:not([class*="col-"]) {
  101. width: 100%;
  102. }
  103. &.input-group-btn {
  104. float: none;
  105. z-index: auto;
  106. }
  107. }
  108. .form-inline &,
  109. .form-inline &.form-control:not([class*="col-"]) {
  110. width: auto;
  111. }
  112. &:not(.input-group-btn),
  113. &[class*="col-"] {
  114. float: none;
  115. display: inline-block;
  116. margin-left: 0;
  117. }
  118. // Forces the pull to the right, if necessary
  119. &,
  120. &[class*="col-"],
  121. .row &[class*="col-"] {
  122. &.dropdown-menu-right {
  123. float: right;
  124. }
  125. }
  126. .form-inline &,
  127. .form-horizontal &,
  128. .form-group & {
  129. margin-bottom: 0;
  130. }
  131. .form-group-lg &.form-control,
  132. .form-group-sm &.form-control {
  133. padding: 0;
  134. .dropdown-toggle {
  135. height: 100%;
  136. font-size: inherit;
  137. line-height: inherit;
  138. border-radius: inherit;
  139. }
  140. }
  141. &.form-control-sm .dropdown-toggle,
  142. &.form-control-lg .dropdown-toggle {
  143. font-size: inherit;
  144. line-height: inherit;
  145. border-radius: inherit;
  146. }
  147. &.form-control-sm .dropdown-toggle {
  148. padding: @input-padding-y-sm @input-padding-x-sm;
  149. }
  150. &.form-control-lg .dropdown-toggle {
  151. padding: @input-padding-y-lg @input-padding-x-lg;
  152. }
  153. // Set the width of the live search (and any other form control within an inline form)
  154. // see https://github.com/silviomoreto/bootstrap-select/issues/685
  155. .form-inline & .form-control {
  156. width: 100%;
  157. }
  158. &.disabled,
  159. > .disabled {
  160. .cursor-disabled();
  161. &:focus {
  162. outline: none !important;
  163. }
  164. }
  165. &.bs-container {
  166. position: absolute;
  167. top: 0;
  168. left: 0;
  169. height: 0 !important;
  170. padding: 0 !important;
  171. .dropdown-menu {
  172. z-index: @zindex-select-dropdown;
  173. }
  174. }
  175. // The selectpicker button
  176. .dropdown-toggle {
  177. .filter-option {
  178. position: static;
  179. top: 0;
  180. left: 0;
  181. float: left;
  182. height: 100%;
  183. width: 100%;
  184. text-align: left;
  185. overflow: hidden;
  186. flex: 0 1 auto; // for IE10
  187. .bs3& {
  188. padding-right: inherit;
  189. }
  190. .input-group .bs3-has-addon& {
  191. position: absolute;
  192. padding-top: inherit;
  193. padding-bottom: inherit;
  194. padding-left: inherit;
  195. float: none;
  196. .filter-option-inner {
  197. padding-right: inherit;
  198. }
  199. }
  200. }
  201. .filter-option-inner-inner {
  202. overflow: hidden;
  203. }
  204. // used to expand the height of the button when inside an input group
  205. .filter-expand {
  206. width: 0 !important;
  207. float: left;
  208. opacity: 0 !important;
  209. overflow: hidden;
  210. }
  211. .caret {
  212. position: absolute;
  213. top: 50%;
  214. right: 12px;
  215. margin-top: -2px;
  216. vertical-align: middle;
  217. }
  218. }
  219. .input-group &.form-control .dropdown-toggle {
  220. border-radius: inherit;
  221. }
  222. &[class*="col-"] .dropdown-toggle {
  223. width: 100%;
  224. }
  225. // The selectpicker dropdown
  226. .dropdown-menu {
  227. min-width: 100%;
  228. box-sizing: border-box;
  229. > .inner:focus {
  230. outline: none !important;
  231. }
  232. &.inner {
  233. position: static;
  234. float: none;
  235. border: 0;
  236. padding: 0;
  237. margin: 0;
  238. border-radius: 0;
  239. box-shadow: none;
  240. }
  241. li {
  242. position: relative;
  243. &.active small {
  244. color: @input-alt-color-placeholder !important;
  245. }
  246. &.disabled a {
  247. .cursor-disabled();
  248. }
  249. a {
  250. cursor: pointer;
  251. user-select: none;
  252. &.opt {
  253. position: relative;
  254. padding-left: 2.25em;
  255. }
  256. span.check-mark {
  257. display: none;
  258. }
  259. span.text {
  260. display: inline-block;
  261. }
  262. }
  263. small {
  264. padding-left: 0.5em;
  265. }
  266. }
  267. .notify {
  268. position: absolute;
  269. bottom: 5px;
  270. width: 96%;
  271. margin: 0 2%;
  272. min-height: 26px;
  273. padding: 3px 5px;
  274. background: rgb(245, 245, 245);
  275. border: 1px solid rgb(227, 227, 227);
  276. box-shadow: inset 0 1px 1px fade(rgb(0, 0, 0), 5%);
  277. pointer-events: none;
  278. opacity: 0.9;
  279. box-sizing: border-box;
  280. }
  281. }
  282. .no-results {
  283. padding: 3px;
  284. background: #f5f5f5;
  285. margin: 0 5px;
  286. white-space: nowrap;
  287. }
  288. &.fit-width .dropdown-toggle {
  289. .filter-option {
  290. position: static;
  291. display: inline;
  292. padding: 0;
  293. width: auto;
  294. }
  295. .filter-option-inner,
  296. .filter-option-inner-inner {
  297. display: inline;
  298. }
  299. .bs-caret:before {
  300. content: '\00a0';
  301. }
  302. .caret {
  303. position: static;
  304. top: auto;
  305. margin-top: -1px;
  306. }
  307. }
  308. &.show-tick .dropdown-menu {
  309. .selected span.check-mark {
  310. position: absolute;
  311. display: inline-block;
  312. right: 15px;
  313. top: 5px;
  314. }
  315. li a span.text {
  316. margin-right: 34px;
  317. }
  318. }
  319. // default check mark for use without an icon font
  320. .bs-ok-default:after {
  321. content: '';
  322. display: block;
  323. width: 0.5em;
  324. height: 1em;
  325. border-style: solid;
  326. border-width: 0 0.26em 0.26em 0;
  327. transform: rotate(45deg);
  328. }
  329. }
  330. .bootstrap-select.show-menu-arrow {
  331. &.open > .dropdown-toggle,
  332. &.show > .dropdown-toggle {
  333. z-index: (@zindex-select-dropdown + 1);
  334. }
  335. .dropdown-toggle .filter-option {
  336. &:before {
  337. content: '';
  338. border-left: 7px solid transparent;
  339. border-right: 7px solid transparent;
  340. border-bottom: 7px solid @color-grey-arrow;
  341. position: absolute;
  342. bottom: -4px;
  343. left: 9px;
  344. display: none;
  345. }
  346. &:after {
  347. content: '';
  348. border-left: 6px solid transparent;
  349. border-right: 6px solid transparent;
  350. border-bottom: 6px solid white;
  351. position: absolute;
  352. bottom: -4px;
  353. left: 10px;
  354. display: none;
  355. }
  356. }
  357. &.dropup .dropdown-toggle .filter-option {
  358. &:before {
  359. bottom: auto;
  360. top: -4px;
  361. border-top: 7px solid @color-grey-arrow;
  362. border-bottom: 0;
  363. }
  364. &:after {
  365. bottom: auto;
  366. top: -4px;
  367. border-top: 6px solid white;
  368. border-bottom: 0;
  369. }
  370. }
  371. &.pull-right .dropdown-toggle .filter-option {
  372. &:before {
  373. right: 12px;
  374. left: auto;
  375. }
  376. &:after {
  377. right: 13px;
  378. left: auto;
  379. }
  380. }
  381. &.open > .dropdown-toggle .filter-option,
  382. &.show > .dropdown-toggle .filter-option {
  383. &:before,
  384. &:after {
  385. display: block;
  386. }
  387. }
  388. }
  389. .bs-searchbox,
  390. .bs-actionsbox,
  391. .bs-donebutton {
  392. padding: 4px 8px;
  393. }
  394. .bs-actionsbox {
  395. width: 100%;
  396. box-sizing: border-box;
  397. & .btn-group button {
  398. width: 50%;
  399. }
  400. }
  401. .bs-donebutton {
  402. float: left;
  403. width: 100%;
  404. box-sizing: border-box;
  405. & .btn-group button {
  406. width: 100%;
  407. }
  408. }
  409. .bs-searchbox {
  410. & + .bs-actionsbox {
  411. padding: 0 8px 4px;
  412. }
  413. & .form-control {
  414. margin-bottom: 0;
  415. width: 100%;
  416. float: none;
  417. }
  418. }