bootstrap-select.scss 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. @import "variables";
  2. // Mixins
  3. @mixin cursor-disabled() {
  4. cursor: not-allowed;
  5. }
  6. @mixin box-sizing($fmt) {
  7. -webkit-box-sizing: $fmt;
  8. -moz-box-sizing: $fmt;
  9. box-sizing: $fmt;
  10. }
  11. @mixin box-shadow($fmt) {
  12. -webkit-box-shadow: $fmt;
  13. box-shadow: $fmt;
  14. }
  15. @function fade($color, $amnt) {
  16. @if $amnt > 1 {
  17. $amnt: $amnt / 100; // convert to percentage if int
  18. }
  19. @return rgba($color, $amnt);
  20. }
  21. // Rules
  22. select.bs-select-hidden,
  23. select.selectpicker {
  24. display: none !important;
  25. }
  26. .bootstrap-select {
  27. width: 220px \0; /*IE9 and below*/
  28. // The selectpicker button
  29. > .dropdown-toggle {
  30. width: 100%;
  31. padding-right: 25px;
  32. z-index: 1;
  33. &.bs-placeholder,
  34. &.bs-placeholder:hover,
  35. &.bs-placeholder:focus,
  36. &.bs-placeholder:active { color: $input-color-placeholder; }
  37. }
  38. > select {
  39. position: absolute !important;
  40. bottom: 0;
  41. left: 50%;
  42. display: block !important;
  43. width: 0.5px !important;
  44. height: 100% !important;
  45. padding: 0 !important;
  46. opacity: 0 !important;
  47. border: none;
  48. &.mobile-device {
  49. top: 0;
  50. left: 0;
  51. display: block !important;
  52. width: 100% !important;
  53. z-index: 2;
  54. }
  55. }
  56. // Error display
  57. .has-error & .dropdown-toggle,
  58. .error & .dropdown-toggle {
  59. border-color: $color-red-error;
  60. }
  61. &.fit-width {
  62. width: auto !important;
  63. }
  64. &:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
  65. width: $width-default;
  66. }
  67. .dropdown-toggle:focus {
  68. outline: thin dotted #333333 !important;
  69. outline: 5px auto -webkit-focus-ring-color !important;
  70. outline-offset: -2px;
  71. }
  72. }
  73. .bootstrap-select.form-control {
  74. margin-bottom: 0;
  75. padding: 0;
  76. border: none;
  77. &:not([class*="col-"]) {
  78. width: 100%;
  79. }
  80. &.input-group-btn {
  81. z-index: auto;
  82. &:not(:first-child):not(:last-child) {
  83. > .btn {
  84. border-radius: 0;
  85. }
  86. }
  87. }
  88. }
  89. // The selectpicker components
  90. .bootstrap-select.btn-group {
  91. &:not(.input-group-btn),
  92. &[class*="col-"] {
  93. float: none;
  94. display: inline-block;
  95. margin-left: 0;
  96. }
  97. // Forces the pull to the right, if necessary
  98. &,
  99. &[class*="col-"],
  100. .row &[class*="col-"] {
  101. &.dropdown-menu-right {
  102. float: right;
  103. }
  104. }
  105. .form-inline &,
  106. .form-horizontal &,
  107. .form-group & {
  108. margin-bottom: 0;
  109. }
  110. .form-group-lg &.form-control,
  111. .form-group-sm &.form-control {
  112. padding: 0;
  113. .dropdown-toggle {
  114. height: 100%;
  115. font-size: inherit;
  116. line-height: inherit;
  117. border-radius: inherit;
  118. }
  119. }
  120. // Set the width of the live search (and any other form control within an inline form)
  121. // see https://github.com/silviomoreto/bootstrap-select/issues/685
  122. .form-inline & .form-control {
  123. width: 100%;
  124. }
  125. &.disabled,
  126. > .disabled {
  127. @include cursor-disabled();
  128. &:focus {
  129. outline: none !important;
  130. }
  131. }
  132. &.bs-container {
  133. position: absolute;
  134. height: 0 !important;
  135. padding: 0 !important;
  136. .dropdown-menu {
  137. z-index: $zindex-select-dropdown;
  138. }
  139. }
  140. // The selectpicker button
  141. .dropdown-toggle {
  142. .filter-option {
  143. display: inline-block;
  144. overflow: hidden;
  145. width: 100%;
  146. text-align: left;
  147. }
  148. .caret {
  149. position: absolute;
  150. top: 50%;
  151. right: 12px;
  152. margin-top: -2px;
  153. vertical-align: middle;
  154. }
  155. }
  156. &[class*="col-"] .dropdown-toggle {
  157. width: 100%;
  158. }
  159. // The selectpicker dropdown
  160. .dropdown-menu {
  161. min-width: 100%;
  162. @include box-sizing(border-box);
  163. &.inner {
  164. position: static;
  165. float: none;
  166. border: 0;
  167. padding: 0;
  168. margin: 0;
  169. border-radius: 0;
  170. box-shadow: none;
  171. }
  172. li {
  173. position: relative;
  174. &.active small {
  175. color: #fff;
  176. }
  177. &.disabled a {
  178. @include cursor-disabled();
  179. }
  180. a {
  181. cursor: pointer;
  182. user-select: none;
  183. &.opt {
  184. position: relative;
  185. padding-left: 2.25em;
  186. }
  187. span.check-mark {
  188. display: none;
  189. }
  190. span.text {
  191. display: inline-block;
  192. }
  193. }
  194. small {
  195. padding-left: 0.5em;
  196. }
  197. }
  198. .notify {
  199. position: absolute;
  200. bottom: 5px;
  201. width: 96%;
  202. margin: 0 2%;
  203. min-height: 26px;
  204. padding: 3px 5px;
  205. background: rgb(245, 245, 245);
  206. border: 1px solid rgb(227, 227, 227);
  207. @include box-shadow(inset 0 1px 1px fade(rgb(0, 0, 0), 5));
  208. pointer-events: none;
  209. opacity: 0.9;
  210. @include box-sizing(border-box);
  211. }
  212. }
  213. .no-results {
  214. padding: 3px;
  215. background: #f5f5f5;
  216. margin: 0 5px;
  217. white-space: nowrap;
  218. }
  219. &.fit-width .dropdown-toggle {
  220. .filter-option {
  221. position: static;
  222. }
  223. .caret {
  224. position: static;
  225. top: auto;
  226. margin-top: -1px;
  227. }
  228. }
  229. &.show-tick .dropdown-menu li {
  230. &.selected a span.check-mark {
  231. position: absolute;
  232. display: inline-block;
  233. right: 15px;
  234. margin-top: 5px;
  235. }
  236. a span.text {
  237. margin-right: 34px;
  238. }
  239. }
  240. }
  241. .bootstrap-select.show-menu-arrow {
  242. &.open > .dropdown-toggle {
  243. z-index: ($zindex-select-dropdown + 1);
  244. }
  245. .dropdown-toggle {
  246. &:before {
  247. content: '';
  248. border-left: 7px solid transparent;
  249. border-right: 7px solid transparent;
  250. border-bottom: 7px solid $color-grey-arrow;
  251. position: absolute;
  252. bottom: -4px;
  253. left: 9px;
  254. display: none;
  255. }
  256. &:after {
  257. content: '';
  258. border-left: 6px solid transparent;
  259. border-right: 6px solid transparent;
  260. border-bottom: 6px solid white;
  261. position: absolute;
  262. bottom: -4px;
  263. left: 10px;
  264. display: none;
  265. }
  266. }
  267. &.dropup .dropdown-toggle {
  268. &:before {
  269. bottom: auto;
  270. top: -3px;
  271. border-top: 7px solid $color-grey-arrow;
  272. border-bottom: 0;
  273. }
  274. &:after {
  275. bottom: auto;
  276. top: -3px;
  277. border-top: 6px solid white;
  278. border-bottom: 0;
  279. }
  280. }
  281. &.pull-right .dropdown-toggle {
  282. &:before {
  283. right: 12px;
  284. left: auto;
  285. }
  286. &:after {
  287. right: 13px;
  288. left: auto;
  289. }
  290. }
  291. &.open > .dropdown-toggle {
  292. &:before,
  293. &:after {
  294. display: block;
  295. }
  296. }
  297. }
  298. .bs-searchbox,
  299. .bs-actionsbox,
  300. .bs-donebutton {
  301. padding: 4px 8px;
  302. }
  303. .bs-actionsbox {
  304. width: 100%;
  305. @include box-sizing(border-box);
  306. & .btn-group button {
  307. width: 50%;
  308. }
  309. }
  310. .bs-donebutton {
  311. float: left;
  312. width: 100%;
  313. @include box-sizing(border-box);
  314. & .btn-group button {
  315. width: 100%;
  316. }
  317. }
  318. .bs-searchbox {
  319. & + .bs-actionsbox {
  320. padding: 0 8px 4px;
  321. }
  322. & .form-control {
  323. margin-bottom: 0;
  324. width: 100%;
  325. float: none;
  326. }
  327. }