_select.scss 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. @use 'sass:map';
  2. @use 'sass:math';
  3. $select-size: $text-input-height;
  4. $chevron-width: 1rem;
  5. $chevron-height: 1rem;
  6. $chevron-top-offset: math.div($select-size - $chevron-height, 2);
  7. $chevron-inline-end-offset: math.div($select-size - $chevron-width, 2);
  8. @mixin select-arrow() {
  9. background-image: url('#{$images-root}icons/arrow-down.svg');
  10. background-repeat: no-repeat;
  11. background-size: $chevron-width;
  12. background-position-x: calc(100% - $chevron-inline-end-offset);
  13. background-position-y: $chevron-top-offset;
  14. }
  15. select {
  16. @include input-base();
  17. @include select-arrow();
  18. @apply w-body-text-large;
  19. // Firefox workaround – Set a large line height (but smaller than min height) so the field’s text has enough top padding.
  20. line-height: 2.2;
  21. min-height: $select-size;
  22. padding: 0 theme('spacing.5');
  23. padding-inline-end: $select-size;
  24. // Prevent the element from overflowing the container.
  25. max-width: 100%;
  26. @media (forced-colors: active) {
  27. appearance: auto;
  28. }
  29. }
  30. select[multiple] {
  31. background-image: none;
  32. min-height: theme('spacing.40');
  33. padding: 0;
  34. option {
  35. padding: 0 theme('spacing.5');
  36. }
  37. }