select.css 3.1 KB

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