_select2.scss 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. // select-2 Theme
  2. .select2-container {
  3. width: 100% !important;
  4. margin: 0;
  5. display: inline-block;
  6. position: relative;
  7. vertical-align: middle;
  8. box-sizing: border-box;
  9. }
  10. .select2-container--classic,
  11. .select2-container--default {
  12. &:focus {
  13. outline: none;
  14. }
  15. .select2-selection__choice {
  16. font-size: 0.9rem;
  17. margin-top: 6px !important;
  18. }
  19. // single select
  20. .select2-selection--single {
  21. min-height: 2.714rem;
  22. padding: 5px;
  23. border: 1px solid $input-border-color;
  24. // Border color on focus
  25. &:focus {
  26. outline: 0;
  27. border-color: $primary !important;
  28. box-shadow: $input-focus-box-shadow !important;
  29. }
  30. // Select with icons scss
  31. .select2-selection__rendered {
  32. i,
  33. svg {
  34. font-size: 1.15rem;
  35. height: 1.15rem;
  36. width: 1.15rem;
  37. margin-right: 0.5rem;
  38. }
  39. }
  40. // dropdown arrow height
  41. .select2-selection__arrow {
  42. b {
  43. background-image: url(str-replace(str-replace($chevron-down, 'currentColor', $input-border-color), '#', '%23'));
  44. background-size: 18px 14px, 18px 14px;
  45. background-repeat: no-repeat;
  46. height: 1rem;
  47. padding-right: 1.5rem;
  48. margin-left: 0;
  49. margin-top: 0;
  50. left: -8px;
  51. border-style: none;
  52. }
  53. }
  54. }
  55. // when select container open - scss
  56. &.select2-container--open {
  57. box-shadow: $dropdown-box-shadow;
  58. .select2-selection--single {
  59. border-color: $primary !important;
  60. outline: 0;
  61. }
  62. }
  63. // select container - focus
  64. &.select2-container--focus {
  65. outline: 0;
  66. .select2-selection--multiple {
  67. border-color: $primary !important;
  68. outline: 0;
  69. }
  70. }
  71. // Select2 Search Dropdown
  72. .select2-dropdown {
  73. border-color: $input-border-color;
  74. }
  75. .select2-search--dropdown {
  76. padding: 0.5rem;
  77. .select2-search__field {
  78. outline: none !important;
  79. border-radius: $input-border-radius;
  80. border-color: $input-border-color;
  81. padding: $input-padding-y $input-padding-x;
  82. }
  83. }
  84. // multiple select scss
  85. .select2-selection--multiple {
  86. min-height: 38px !important;
  87. border: 1px solid $input-border-color;
  88. &:focus {
  89. outline: 0;
  90. border-color: $primary !important;
  91. box-shadow: $input-focus-box-shadow !important;
  92. }
  93. // selected items bg color for multiple selection
  94. .select2-selection__choice {
  95. background-color: $primary !important;
  96. border-color: $primary !important;
  97. color: $white;
  98. padding: 2px 5px;
  99. }
  100. // font -size for selected options
  101. .select2-selection__rendered {
  102. padding: 0 6px;
  103. li {
  104. // font-size: 0.9rem;
  105. .select2-search__field {
  106. margin-top: 7px;
  107. }
  108. }
  109. }
  110. .select2-selection__choice__remove {
  111. // color: $white !important;
  112. float: right;
  113. margin-left: 0.7rem;
  114. margin-right: 0.5rem;
  115. font-size: 0px;
  116. display: inline-block;
  117. position: relative;
  118. line-height: 1rem;
  119. &:before {
  120. content: '';
  121. background-image: url(str-replace(str-replace($remove, 'currentColor', $white), '#', '%23'));
  122. background-size: 0.85rem;
  123. height: 0.85rem;
  124. width: 0.85rem;
  125. position: absolute;
  126. top: 22%;
  127. left: -4px;
  128. }
  129. }
  130. // select dropdown menu with icons
  131. i,
  132. svg {
  133. position: relative;
  134. top: 1px;
  135. margin-right: 0.5rem;
  136. height: 1.15rem;
  137. width: 1.15rem;
  138. font-size: 1.15rem;
  139. padding-left: 1px;
  140. }
  141. }
  142. // Select2 group alignment
  143. .select2-results__group {
  144. padding: 6px 9px;
  145. font-weight: 600;
  146. }
  147. .select2-results__option {
  148. padding: 0.428rem 1rem;
  149. &[role='group'] {
  150. padding: 0;
  151. }
  152. &[aria-selected='true'] {
  153. background-color: $primary !important;
  154. color: white !important;
  155. }
  156. i,
  157. svg {
  158. height: 1.15rem;
  159. width: 1.15rem;
  160. font-size: 1.15rem;
  161. margin-right: 0.5rem;
  162. }
  163. }
  164. .select2-results__option--highlighted {
  165. background-color: rgba($primary, 0.12) !important;
  166. color: $primary !important;
  167. }
  168. //Loading Remote Data Image Size
  169. .select2-result-repository__avatar {
  170. img {
  171. width: 50px;
  172. }
  173. }
  174. // Optional sizing
  175. // ------------------------------
  176. // Large Single select
  177. .select-lg {
  178. min-height: $input-height !important;
  179. font-size: ($font-size-lg - 0.8);
  180. margin-bottom: 0 !important;
  181. padding: 0.3rem 0.7rem;
  182. &.select2-selection--single {
  183. .select2-selection__rendered {
  184. padding-top: $input-btn-padding-y-lg - 0.9;
  185. // padding-left: 0;
  186. }
  187. .select2-selection__arrow {
  188. top: $input-btn-padding-y-lg - 0.8 !important;
  189. }
  190. }
  191. // large Multiple select
  192. &.select2-selection--multiple {
  193. padding: 0 0.2rem;
  194. .select2-selection__rendered {
  195. padding-top: 0 !important;
  196. li {
  197. font-size: ($font-size-lg - 0.8);
  198. .select2-search__field {
  199. margin-top: 10px;
  200. }
  201. }
  202. .select2-selection__choice {
  203. padding: 5px;
  204. .select2-selection__choice__remove:before {
  205. top: 46%;
  206. }
  207. }
  208. }
  209. }
  210. }
  211. // Small Single select
  212. .select-sm {
  213. min-height: $input-height-sm !important;
  214. padding: 0 $input-padding-y-xs;
  215. font-size: $font-size-xs;
  216. margin-bottom: 0 !important;
  217. line-height: $line-height-xs;
  218. // Single
  219. &.select2-selection--single {
  220. .select2-selection__arrow {
  221. top: -0.3rem !important;
  222. }
  223. }
  224. // Small Multiple select
  225. &.select2-selection--multiple {
  226. line-height: $line-height-xs - 0.2;
  227. .select2-selection__rendered {
  228. padding: 3px;
  229. li {
  230. font-size: $font-size-xs;
  231. margin-top: 2px;
  232. .select2-search__field {
  233. margin-top: 4px;
  234. }
  235. }
  236. }
  237. .select2-selection__choice {
  238. padding: 0 $input-padding-y-xs;
  239. .select2-selection__choice__remove:before {
  240. top: 5%;
  241. }
  242. }
  243. .select2-search--inline .select2-search__field {
  244. margin-top: 0;
  245. }
  246. }
  247. }
  248. }
  249. // Dark Layout
  250. .dark-layout {
  251. .select2-container {
  252. .select2-selection,
  253. .select2-search__field,
  254. .select2-selection__placeholder {
  255. background: $theme-dark-input-bg;
  256. border-color: $theme-dark-border-color;
  257. color: $theme-dark-body-color;
  258. }
  259. .select2-selection__rendered {
  260. color: $theme-dark-body-color;
  261. }
  262. .select2-dropdown {
  263. background-color: $theme-dark-card-bg;
  264. border-color: $theme-dark-border-color;
  265. }
  266. .select2-selection--multiple {
  267. .select2-selection__choice {
  268. background: rgba($primary, 0.12) !important;
  269. color: $primary !important;
  270. border: none;
  271. .select2-selection__choice__remove {
  272. color: $primary !important;
  273. }
  274. }
  275. .select2-selection__choice__remove:before {
  276. background-image: url(str-replace(str-replace($remove, 'currentColor', $primary), '#', '%23'));
  277. }
  278. }
  279. .select2-results__option[aria-disabled='true'] {
  280. color: $theme-dark-text-muted-color;
  281. }
  282. .select2-selection__arrow {
  283. b {
  284. background-image: url(str-replace(
  285. str-replace($chevron-down, 'currentColor', $theme-dark-body-color),
  286. '#',
  287. '%23'
  288. ));
  289. }
  290. }
  291. }
  292. .select2-container--disabled {
  293. .select2-selection {
  294. opacity: 0.5;
  295. }
  296. }
  297. }