select.css 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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 {
  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]):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. transition:
  128. background-color 0.2s ease-in-out,
  129. color 0.2s ease-in-out;
  130. outline: none;
  131. user-select: none;
  132. &[data-highlighted] {
  133. background: var(--surface-raised-base-hover);
  134. }
  135. &[data-disabled] {
  136. background-color: var(--surface-raised-base);
  137. pointer-events: none;
  138. }
  139. [data-slot="select-select-item-indicator"] {
  140. display: flex;
  141. align-items: center;
  142. justify-content: center;
  143. margin-left: auto;
  144. width: 16px;
  145. height: 16px;
  146. }
  147. &:focus {
  148. outline: none;
  149. }
  150. &:hover {
  151. background: var(--surface-raised-base-hover);
  152. }
  153. }
  154. }
  155. [data-component="select-content"][data-trigger-style="settings"] {
  156. min-width: 160px;
  157. border-radius: 8px;
  158. padding: 0;
  159. [data-slot="select-select-content-list"] {
  160. padding: 4px;
  161. }
  162. [data-slot="select-select-item"] {
  163. /* text-14-regular */
  164. font-family: var(--font-family-sans);
  165. font-size: var(--font-size-base);
  166. font-style: normal;
  167. font-weight: var(--font-weight-regular);
  168. line-height: var(--line-height-large);
  169. letter-spacing: var(--letter-spacing-normal);
  170. }
  171. }
  172. @keyframes select-open {
  173. from {
  174. opacity: 0;
  175. transform: scale(0.95);
  176. }
  177. to {
  178. opacity: 1;
  179. transform: scale(1);
  180. }
  181. }