Keine Beschreibung

bootstrap-select.scss 9.5KB

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