option-item.scss 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. @use 'sass:map';
  2. @use 'mixins/mixins' as *;
  3. @use 'mixins/var' as *;
  4. @use 'common/var' as *;
  5. @include b(select-dropdown) {
  6. @include e(option-item) {
  7. font-size: getCssVar('select-font-size');
  8. // 20 as the padding of option item, 12 as the size of ✓ icon size
  9. padding: 0 #{20 + 12}px 0 20px;
  10. position: relative;
  11. white-space: nowrap;
  12. overflow: hidden;
  13. text-overflow: ellipsis;
  14. color: map.get($select-option, 'text-color');
  15. height: map.get($select-option, 'height');
  16. line-height: map.get($select-option, 'height');
  17. box-sizing: border-box;
  18. cursor: pointer;
  19. @include when(disabled) {
  20. color: map.get($select-option, 'disabled-color');
  21. cursor: not-allowed;
  22. &:hover {
  23. background-color: getCssVar('bg-color');
  24. }
  25. }
  26. @include when(selected) {
  27. background-color: map.get($select-option, 'hover-background');
  28. font-weight: 700;
  29. &:not(.is-multiple) {
  30. color: map.get($select-option, 'selected-text-color');
  31. }
  32. }
  33. &.hover {
  34. background-color: map.get($select-option, 'hover-background') !important;
  35. }
  36. &:hover {
  37. background-color: map.get($select-option, 'hover-background');
  38. }
  39. }
  40. @include when(multiple) {
  41. .#{$namespace}-select-dropdown__option-item {
  42. &.is-selected {
  43. color: map.get($select-option, 'selected-text-color');
  44. background-color: map.get($select-dropdown, 'bg-color');
  45. & .#{$namespace}-icon {
  46. position: absolute;
  47. right: 20px;
  48. top: 0;
  49. height: inherit;
  50. font-size: 12px;
  51. svg {
  52. height: inherit;
  53. vertical-align: middle;
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }