bootstrap-select.less 8.8 KB

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