Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. /* Select2 */
  2. /* ******************************************************************************* */
  3. @import "../../scss/_bootstrap-extended/include";
  4. @import "select2/src/scss/core";
  5. $select-max-levels: 5 !default;
  6. .select2-container {
  7. --#{$prefix}select-height: 2.375rem;
  8. --#{$prefix}select-color: var(--#{$prefix}heading-color);
  9. --#{$prefix}select-border-width: #{$input-border-width};
  10. --#{$prefix}select-border-color: #{$input-border-color};
  11. --#{$prefix}select-active-border: 0 0 0 #{$input-border-width} #{$input-focus-border-color};
  12. --#{$prefix}select-active-border-color: #{$form-select-focus-border-color};
  13. --#{$prefix}select-active-box-shadow: #{$form-select-focus-box-shadow};
  14. --#{$prefix}select-disabled-color: #{$input-disabled-color};
  15. --#{$prefix}select-disabled-border-color: #{$input-disabled-border-color};
  16. --#{$prefix}select-disabled-bg: #{$input-disabled-bg};
  17. --#{$prefix}select-arrow: #{escape-svg($form-select-indicator)};
  18. --#{$prefix}select-disabled-arrow: #{escape-svg($form-select-disabled-indicator)};
  19. /* Dropdown */
  20. --#{$prefix}select-dropdown-border-width: #{$dropdown-border-width};
  21. --#{$prefix}select-dropdown-border-color: #{$dropdown-border-color};
  22. --#{$prefix}select-dropdown-bg: #{$dropdown-bg};
  23. --#{$prefix}select-dropdown-box-shadow: #{$dropdown-box-shadow};
  24. --#{$prefix}select-dropdown-link-hover-bg: #{$dropdown-link-hover-bg};
  25. --#{$prefix}select-dropdown-link-active-bg: #{$dropdown-link-active-bg};
  26. --#{$prefix}select-dropdown-link-active-color: #{$dropdown-link-active-color};
  27. /* Multiple */
  28. --#{$prefix}select-multiple-padding-x: .3125rem;
  29. --#{$prefix}select-multiple-padding-y: .3125rem;
  30. --#{$prefix}select-multiple-line-height: 1.5rem;
  31. --#{$prefix}select-multiple-choice-color: var(--#{$prefix}body-color);
  32. --#{$prefix}select-multiple-choice-bg: color-mix(in sRGB, var(--#{$prefix}base-color) 8%, var(--#{$prefix}paper-bg));
  33. --#{$prefix}select-multiple-disabled-choice-color: var(--#{$prefix}secondary-color);
  34. --#{$prefix}select-multiple-disabled-choice-bg: color-mix(in sRGB, var(--#{$prefix}base-color) 18%, var(--#{$prefix}paper-bg));
  35. /* using below style to assign default width to the select2 container */
  36. inline-size: 100% !important;
  37. .select2-selection--single {
  38. block-size: var(--#{$prefix}select-height);
  39. }
  40. &.select2-container--default {
  41. .select2-selection--single {
  42. .select2-selection__rendered {
  43. padding-inline-end: calc($form-select-indicator-padding - .4375rem);
  44. padding-inline-start: $form-select-padding-x;
  45. }
  46. }
  47. }
  48. }
  49. .select2-search__field {
  50. color: $input-color;
  51. }
  52. .select2-dropdown {
  53. border: var(--#{$prefix}select-dropdown-border-width) solid var(--#{$prefix}select-dropdown-border-color);
  54. background-color: var(--#{$prefix}select-dropdown-bg);
  55. box-shadow: var(--#{$prefix}select-dropdown-box-shadow);
  56. @include border-radius($dropdown-border-radius);
  57. }
  58. .select2-results__option {
  59. &[role="option"] {
  60. @include border-radius($border-radius);
  61. margin-block: .125rem;
  62. margin-inline: .5rem;
  63. padding-block: $dropdown-item-padding-y;
  64. padding-inline: calc($dropdown-item-padding-x - .25rem);
  65. }
  66. .select2-results__group {
  67. font-size: $font-size-sm;
  68. font-weight: $font-weight-medium;
  69. padding-block: .5rem;
  70. padding-inline: ($input-padding-x * .5);
  71. text-transform: uppercase;
  72. }
  73. }
  74. .select2-results__options {
  75. /* Select option levels loop for padding left/right */
  76. @for $i from 2 through $select-max-levels {
  77. $selector: "";
  78. @for $l from 1 through $i {
  79. $selector: "#{$selector} .select2-results__option";
  80. }
  81. .select2-results__options {
  82. .select2-results__group {
  83. margin-inline-start: ($dropdown-item-padding-x * ($i)) - ($input-padding-x * 3);
  84. }
  85. #{$selector} {
  86. margin-inline-start: ($dropdown-item-padding-x * ($i));
  87. }
  88. }
  89. }
  90. }
  91. .select2-container--default {
  92. /* Remove outlines */
  93. &,
  94. * {
  95. outline: 0;
  96. }
  97. .select2-selection {
  98. border: var(--#{$prefix}select-border-width) solid var(--#{$prefix}select-border-color);
  99. background-color: $input-bg;
  100. transition: $input-transition;
  101. @include border-radius($border-radius);
  102. &:hover {
  103. border-color: $input-hover-border-color;
  104. }
  105. }
  106. /* search field styles */
  107. .select2-search--dropdown .select2-search__field {
  108. border-color: var(--#{$prefix}select-border-color);
  109. @include border-radius($input-border-radius);
  110. background-color: var(--#{$prefix}select-dropdown-bg);
  111. inline-size: calc(100% - 1rem);
  112. margin-block: .25rem;
  113. margin-block-end: 0;
  114. margin-inline: .5rem;
  115. }
  116. .select2-results__message {
  117. margin-inline: .5rem;
  118. }
  119. /* Single Selection */
  120. .select2-selection--single {
  121. .select2-selection__clear {
  122. color: var(--#{$prefix}secondary-color);
  123. font-weight: $font-weight-medium;
  124. inset-inline-end: .625rem;
  125. }
  126. .select2-selection__placeholder {
  127. color: $input-placeholder-color;
  128. }
  129. .select2-selection__rendered {
  130. color: var(--#{$prefix}select-color);
  131. line-height: calc(var(--#{$prefix}select-height) - var(--#{$prefix}select-border-width) * 2);
  132. }
  133. .select2-selection__arrow {
  134. position: absolute;
  135. block-size: 100%;
  136. inline-size: $form-select-indicator-padding;
  137. inset-block-start: $input-border-width;
  138. inset-inline-end: .375rem !important;
  139. inset-inline-start: auto;
  140. b {
  141. border: none;
  142. margin: 0;
  143. background-image: var(--#{$prefix}select-arrow);
  144. background-position: center;
  145. background-repeat: no-repeat;
  146. background-size: 20px 19px;
  147. block-size: 100%;
  148. inline-size: 100%;
  149. inset-block-start: 0;
  150. inset-inline-start: 0;
  151. transform-origin: center;
  152. transition: transform .3s ease;
  153. }
  154. }
  155. .is-invalid ~ & {
  156. border-width: $input-focus-border-width;
  157. border-color: var(--#{$prefix}form-validation-border-color);
  158. box-shadow: var(--#{$prefix}form-validation-shadow);
  159. }
  160. }
  161. .select2-selection__rendered:has(> .select2-selection__placeholder) ~ .select2-selection__arrow b {
  162. background-image: var(--#{$prefix}select-disabled-arrow);
  163. }
  164. /* Multiple Selection */
  165. .select2-selection--multiple {
  166. min-block-size: var(--#{$prefix}select-height);
  167. .select2-selection__rendered {
  168. display: block;
  169. margin-block-start: calc(var(--#{$prefix}select-multiple-padding-y) * -1);
  170. margin-inline-end: calc(var(--#{$prefix}select-multiple-padding-x) * -1);
  171. padding-block: var(--#{$prefix}select-multiple-padding-y);
  172. padding-inline: var(--#{$prefix}select-multiple-padding-x);
  173. .select2-search--inline:first-child {
  174. .select2-search__field {
  175. padding-inline-start: calc($form-select-padding-x - var(--#{$prefix}select-multiple-padding-x));
  176. }
  177. }
  178. }
  179. .select2-selection__clear {
  180. font-weight: $font-weight-medium;
  181. margin-block-start: .25rem;
  182. }
  183. .select2-search--inline {
  184. line-height: var(--#{$prefix}select-multiple-line-height);
  185. }
  186. .select2-selection__choice {
  187. position: relative;
  188. border-color: var(--#{$prefix}select-multiple-choice-bg);
  189. @include border-radius($border-radius-sm);
  190. background-color: var(--#{$prefix}select-multiple-choice-bg);
  191. color: var(--#{$prefix}select-multiple-choice-color);
  192. font-size: $font-size-sm;
  193. line-height: var(--#{$prefix}select-multiple-line-height);
  194. padding-inline: .5rem 1rem;
  195. :dir(rtl) &,
  196. & {
  197. margin-block-start: var(--#{$prefix}select-multiple-padding-y);
  198. margin-inline: 0 var(--#{$prefix}select-multiple-padding-x);
  199. }
  200. }
  201. .select2-selection__choice__remove {
  202. position: absolute;
  203. color: inherit;
  204. font-weight: $font-weight-medium;
  205. inset-inline-end: .3rem;
  206. opacity: .5;
  207. :dir(rtl) &,
  208. & {
  209. margin-inline-end: 0;
  210. margin-inline-start: .25rem;
  211. }
  212. &:hover {
  213. color: inherit;
  214. opacity: .8;
  215. }
  216. }
  217. }
  218. .select2-results {
  219. > .select2-results__options {
  220. margin-block: .5rem;
  221. }
  222. }
  223. .select2-results__option {
  224. color: var(--#{$prefix}select-color);
  225. &--highlighted[aria-selected] {
  226. background-color: var(--#{$prefix}select-dropdown-link-hover-bg);
  227. color: var(--#{$prefix}select-color);
  228. }
  229. &[aria-selected="true"] {
  230. background-color: var(--#{$prefix}select-dropdown-link-active-bg);
  231. color: var(--#{$prefix}select-dropdown-link-active-color);
  232. }
  233. &[aria-disabled="true"] {
  234. background-color: var(--#{$prefix}select-disabled-bg);
  235. color: var(--#{$prefix}select-disabled-color);
  236. }
  237. .select2-results__option {
  238. padding-inline-start: calc($dropdown-item-padding-x - .25rem);
  239. }
  240. }
  241. &.select2-container--focus,
  242. &.select2-container--open {
  243. .select2-selection {
  244. border-width: $input-focus-border-width;
  245. border-color: var(--#{$prefix}select-active-border-color);
  246. box-shadow: var(--#{$prefix}select-active-box-shadow);
  247. }
  248. .select2-selection--single {
  249. .select2-selection__rendered {
  250. line-height: calc(var(--#{$prefix}select-height) - $input-focus-border-width * 2);
  251. padding-inline-end: calc($form-select-indicator-padding - .5rem);
  252. padding-inline-start: calc($form-select-padding-x - var(--#{$prefix}select-border-width));
  253. }
  254. .select2-selection__arrow {
  255. b {
  256. border: none;
  257. transform: rotate(180deg);
  258. }
  259. }
  260. }
  261. .select2-selection--multiple {
  262. .select2-selection__rendered {
  263. padding-block: calc(var(--#{$prefix}select-multiple-padding-y) - var(--#{$prefix}select-border-width));
  264. padding-inline-start: calc(var(--#{$prefix}select-multiple-padding-x) - var(--#{$prefix}select-border-width));
  265. }
  266. }
  267. }
  268. &.select2-container--disabled {
  269. pointer-events: none;
  270. .select2-selection--multiple,
  271. .select2-selection--single {
  272. border-color: var(--#{$prefix}select-disabled-border-color);
  273. background-color: var(--#{$prefix}select-disabled-bg);
  274. box-shadow: none;
  275. }
  276. .select2-selection--single {
  277. .select2-selection__rendered {
  278. color: var(--#{$prefix}select-disabled-color);
  279. }
  280. .select2-selection__arrow {
  281. b {
  282. background-image: var(--#{$prefix}select-disabled-arrow);
  283. }
  284. }
  285. }
  286. .select2-selection--multiple {
  287. .select2-selection__choice {
  288. border-color: var(--#{$prefix}select-multiple-disabled-choice-bg);
  289. background-color: var(--#{$prefix}select-multiple-disabled-choice-bg);
  290. color: var(--#{$prefix}select-multiple-disabled-choice-color);
  291. }
  292. }
  293. }
  294. }
  295. @each $state in map-keys($theme-colors) {
  296. .select2-#{$state} {
  297. .select2-container {
  298. --#{$prefix}select-multiple-choice-bg: color-mix(in sRGB, var(--#{$prefix}paper-bg) var(--#{$prefix}bg-label-tint-amount), var(--#{$prefix}#{$state}));
  299. --#{$prefix}select-multiple-choice-color: var(--#{$prefix}#{$state});
  300. }
  301. }
  302. }
  303. @if $enable-dark-mode {
  304. @include color-mode(dark) {
  305. .select2-container {
  306. --#{$prefix}select-arrow: #{escape-svg($form-select-indicator-dark)};
  307. --#{$prefix}select-disabled-arrow: #{escape-svg($form-select-disabled-indicator-dark)};
  308. --#{$prefix}select-border-color: #{$input-border-color-dark};
  309. }
  310. .select2-dark {
  311. .select2-container {
  312. --#{$prefix}select-multiple-choice-color: var(--#{$prefix}dark-contrast);
  313. }
  314. }
  315. }
  316. }