select.css 3.3 KB

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