select.css 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. [data-component="select"] {
  2. &:disabled {
  3. opacity: 0.5;
  4. cursor: not-allowed;
  5. }
  6. &:focus {
  7. outline: none;
  8. box-shadow: 0 0 0 2px var(--color-primary);
  9. }
  10. [data-slot="section"] {
  11. font-size: var(--text-xs);
  12. line-height: var(--text-xs--line-height);
  13. font-weight: var(--font-weight-light);
  14. text-transform: uppercase;
  15. color: var(--text-default-text-weak);
  16. opacity: 0.6;
  17. margin-top: calc(var(--spacing) * 3);
  18. margin-left: calc(var(--spacing) * 2);
  19. &:first-child {
  20. margin-top: 0;
  21. }
  22. }
  23. [data-slot="item"] {
  24. position: relative;
  25. display: flex;
  26. align-items: center;
  27. padding: calc(var(--spacing) * 2) calc(var(--spacing) * 2);
  28. border-radius: var(--radius-sm);
  29. font-size: var(--text-xs);
  30. line-height: var(--text-xs--line-height);
  31. color: var(--text-default-text);
  32. cursor: pointer;
  33. transition:
  34. background-color 0.2s ease-in-out,
  35. color 0.2s ease-in-out;
  36. outline: none;
  37. user-select: none;
  38. &[data-highlighted] {
  39. background-color: var(--surface-default-surface);
  40. }
  41. &[data-disabled] {
  42. pointer-events: none;
  43. opacity: 0.5;
  44. }
  45. [data-slot="item-indicator"] {
  46. margin-left: auto;
  47. }
  48. }
  49. [data-slot="trigger"] {
  50. [data-slot="value"] {
  51. overflow: hidden;
  52. text-overflow: ellipsis;
  53. white-space: nowrap;
  54. }
  55. [data-slot="icon"] {
  56. width: fit-content;
  57. height: fit-content;
  58. flex-shrink: 0;
  59. color: var(--text-default-text-weak);
  60. transition: transform 0.1s ease-in-out;
  61. }
  62. }
  63. }
  64. [data-component="select-content"] {
  65. min-width: 8rem;
  66. overflow: hidden;
  67. border-radius: var(--radius-md);
  68. border-width: 1px;
  69. border-style: solid;
  70. border-color: var(--border-default-border-weak);
  71. background-color: var(--surface-raised-surface-raised);
  72. padding: calc(var(--spacing) * 1);
  73. box-shadow: var(--shadow-md);
  74. z-index: 50;
  75. &[data-closed] {
  76. animation: select-close 0.15s ease-out;
  77. }
  78. &[data-expanded] {
  79. animation: select-open 0.15s ease-out;
  80. }
  81. [data-slot="list"] {
  82. overflow-y: auto;
  83. max-height: 12rem;
  84. white-space: nowrap;
  85. overflow-x: hidden;
  86. }
  87. }
  88. @keyframes select-open {
  89. from {
  90. opacity: 0;
  91. transform: scale(0.95);
  92. }
  93. to {
  94. opacity: 1;
  95. transform: scale(1);
  96. }
  97. }
  98. @keyframes select-close {
  99. from {
  100. opacity: 1;
  101. transform: scale(1);
  102. }
  103. to {
  104. opacity: 0;
  105. transform: scale(0.95);
  106. }
  107. }