bootstrap-select.scss 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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. }
  114. // Set the width of the live search (and any other form control within an inline form)
  115. // see https://github.com/silviomoreto/bootstrap-select/issues/685
  116. .form-inline & .form-control {
  117. width: 100%;
  118. }
  119. &.disabled,
  120. > .disabled {
  121. @include cursor-disabled();
  122. &:focus {
  123. outline: none !important;
  124. }
  125. }
  126. &.bs-container {
  127. position: absolute;
  128. height: 0 !important;
  129. padding: 0 !important;
  130. .dropdown-menu {
  131. z-index: $zindex-select-dropdown;
  132. }
  133. }
  134. // The selectpicker button
  135. .dropdown-toggle {
  136. .filter-option {
  137. display: inline-block;
  138. overflow: hidden;
  139. width: 100%;
  140. text-align: left;
  141. }
  142. .caret {
  143. position: absolute;
  144. top: 50%;
  145. right: 12px;
  146. margin-top: -2px;
  147. vertical-align: middle;
  148. }
  149. }
  150. &[class*="col-"] .dropdown-toggle {
  151. width: 100%;
  152. }
  153. // The selectpicker dropdown
  154. .dropdown-menu {
  155. min-width: 100%;
  156. @include box-sizing(border-box);
  157. &.inner {
  158. position: static;
  159. float: none;
  160. border: 0;
  161. padding: 0;
  162. margin: 0;
  163. border-radius: 0;
  164. box-shadow: none;
  165. }
  166. li {
  167. position: relative;
  168. &.active small {
  169. color: #fff;
  170. }
  171. &.disabled a {
  172. @include cursor-disabled();
  173. }
  174. a {
  175. cursor: pointer;
  176. -webkit-user-select: none;
  177. -moz-user-select: none;
  178. -ms-user-select: none;
  179. user-select: none;
  180. &.opt {
  181. position: relative;
  182. padding-left: 2.25em;
  183. }
  184. span.check-mark {
  185. display: none;
  186. }
  187. span.text {
  188. display: inline-block;
  189. }
  190. }
  191. small {
  192. padding-left: 0.5em;
  193. }
  194. }
  195. .notify {
  196. position: absolute;
  197. bottom: 5px;
  198. width: 96%;
  199. margin: 0 2%;
  200. min-height: 26px;
  201. padding: 3px 5px;
  202. background: rgb(245, 245, 245);
  203. border: 1px solid rgb(227, 227, 227);
  204. @include box-shadow(inset 0 1px 1px fade(rgb(0, 0, 0), 5));
  205. pointer-events: none;
  206. opacity: 0.9;
  207. @include box-sizing(border-box);
  208. }
  209. }
  210. .no-results {
  211. padding: 3px;
  212. background: #f5f5f5;
  213. margin: 0 5px;
  214. white-space: nowrap;
  215. }
  216. &.fit-width .dropdown-toggle {
  217. .filter-option {
  218. position: static;
  219. }
  220. .caret {
  221. position: static;
  222. top: auto;
  223. margin-top: -1px;
  224. }
  225. }
  226. &.show-tick .dropdown-menu li {
  227. &.selected a span.check-mark {
  228. position: absolute;
  229. display: inline-block;
  230. right: 15px;
  231. margin-top: 5px;
  232. }
  233. a span.text {
  234. margin-right: 34px;
  235. }
  236. }
  237. }
  238. .bootstrap-select.show-menu-arrow {
  239. &.open > .dropdown-toggle {
  240. z-index: ($zindex-select-dropdown + 1);
  241. }
  242. .dropdown-toggle {
  243. &:before {
  244. content: '';
  245. border-left: 7px solid transparent;
  246. border-right: 7px solid transparent;
  247. border-bottom: 7px solid $color-grey-arrow;
  248. position: absolute;
  249. bottom: -4px;
  250. left: 9px;
  251. display: none;
  252. }
  253. &:after {
  254. content: '';
  255. border-left: 6px solid transparent;
  256. border-right: 6px solid transparent;
  257. border-bottom: 6px solid white;
  258. position: absolute;
  259. bottom: -4px;
  260. left: 10px;
  261. display: none;
  262. }
  263. }
  264. &.dropup .dropdown-toggle {
  265. &:before {
  266. bottom: auto;
  267. top: -3px;
  268. border-top: 7px solid $color-grey-arrow;
  269. border-bottom: 0;
  270. }
  271. &:after {
  272. bottom: auto;
  273. top: -3px;
  274. border-top: 6px solid white;
  275. border-bottom: 0;
  276. }
  277. }
  278. &.pull-right .dropdown-toggle {
  279. &:before {
  280. right: 12px;
  281. left: auto;
  282. }
  283. &:after {
  284. right: 13px;
  285. left: auto;
  286. }
  287. }
  288. &.open > .dropdown-toggle {
  289. &:before,
  290. &:after {
  291. display: block;
  292. }
  293. }
  294. }
  295. .bs-searchbox,
  296. .bs-actionsbox,
  297. .bs-donebutton {
  298. padding: 4px 8px;
  299. }
  300. .bs-actionsbox {
  301. width: 100%;
  302. @include box-sizing(border-box);
  303. & .btn-group button {
  304. width: 50%;
  305. }
  306. }
  307. .bs-donebutton {
  308. float: left;
  309. width: 100%;
  310. @include box-sizing(border-box);
  311. & .btn-group button {
  312. width: 100%;
  313. }
  314. }
  315. .bs-searchbox {
  316. & + .bs-actionsbox {
  317. padding: 0 8px 4px;
  318. }
  319. & .form-control {
  320. margin-bottom: 0;
  321. width: 100%;
  322. float: none;
  323. }
  324. }