select.css 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. [data-component="select"] {
  2. [data-slot="select-select-trigger"] {
  3. padding: 6px 6px 6px 12px;
  4. box-shadow: none;
  5. border-radius: 6px;
  6. min-width: 160px;
  7. height: 32px;
  8. justify-content: flex-end;
  9. gap: 8px;
  10. background-color: transparent;
  11. [data-slot="select-select-trigger-value"] {
  12. overflow: hidden;
  13. text-overflow: ellipsis;
  14. white-space: nowrap;
  15. font-size: var(--font-size-base);
  16. }
  17. [data-slot="select-select-trigger-icon"] {
  18. width: 16px;
  19. height: 20px;
  20. display: flex;
  21. align-items: center;
  22. justify-content: center;
  23. flex-shrink: 0;
  24. color: var(--text-weak);
  25. background-color: var(--surface-raised-base);
  26. border-radius: 4px;
  27. transition: transform 0.1s ease-in-out;
  28. }
  29. &:hover {
  30. background-color: var(--input-base);
  31. box-shadow: var(--shadow-xs-border-base);
  32. }
  33. &[data-expanded] {
  34. background-color: var(--input-base);
  35. box-shadow: var(--shadow-xs-border-base);
  36. }
  37. &:not([data-expanded]):focus {
  38. &[data-variant="secondary"] {
  39. background-color: var(--button-secondary-base);
  40. }
  41. &[data-variant="ghost"] {
  42. background-color: transparent;
  43. }
  44. &[data-variant="primary"] {
  45. background-color: var(--icon-strong-base);
  46. }
  47. }
  48. }
  49. }
  50. [data-component="select-content"] {
  51. min-width: 160px;
  52. max-width: 23rem;
  53. overflow: hidden;
  54. border-radius: 8px;
  55. background-color: var(--surface-raised-stronger-non-alpha);
  56. padding: 0;
  57. box-shadow: var(--shadow-xs-border);
  58. z-index: 60;
  59. &[data-expanded] {
  60. animation: select-open 0.15s ease-out;
  61. }
  62. [data-slot="select-select-content-list"] {
  63. overflow-y: auto;
  64. max-height: 12rem;
  65. white-space: nowrap;
  66. overflow-x: hidden;
  67. display: flex;
  68. flex-direction: column;
  69. padding: 4px;
  70. &:focus {
  71. outline: none;
  72. }
  73. > *:not([role="presentation"]) + *:not([role="presentation"]) {
  74. margin-top: 2px;
  75. }
  76. }
  77. [data-slot="select-select-item"] {
  78. position: relative;
  79. display: flex;
  80. align-items: center;
  81. padding: 2px 8px;
  82. gap: 12px;
  83. border-radius: 4px;
  84. cursor: default;
  85. /* text-14-regular */
  86. font-family: var(--font-family-sans);
  87. font-size: var(--font-size-base);
  88. font-style: normal;
  89. font-weight: var(--font-weight-regular);
  90. line-height: var(--line-height-large);
  91. letter-spacing: var(--letter-spacing-normal);
  92. color: var(--text-strong);
  93. transition:
  94. background-color 0.2s ease-in-out,
  95. color 0.2s ease-in-out;
  96. outline: none;
  97. user-select: none;
  98. &[data-highlighted] {
  99. background: var(--surface-raised-base-hover);
  100. }
  101. &[data-disabled] {
  102. background-color: var(--surface-raised-base);
  103. pointer-events: none;
  104. }
  105. [data-slot="select-select-item-indicator"] {
  106. display: flex;
  107. align-items: center;
  108. justify-content: center;
  109. margin-left: auto;
  110. width: 16px;
  111. height: 16px;
  112. }
  113. &:focus {
  114. outline: none;
  115. }
  116. &:hover {
  117. background: var(--surface-raised-base-hover);
  118. }
  119. }
  120. }
  121. @keyframes select-open {
  122. from {
  123. opacity: 0;
  124. transform: scale(0.95);
  125. }
  126. to {
  127. opacity: 1;
  128. transform: scale(1);
  129. }
  130. }