select.css 2.4 KB

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