select.css 4.8 KB

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