select.css 3.8 KB

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