button.css 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. [data-component="button"] {
  2. display: inline-flex;
  3. align-items: center;
  4. justify-content: center;
  5. border-style: solid;
  6. border-width: 1px;
  7. border-radius: var(--radius-md);
  8. text-decoration: none;
  9. user-select: none;
  10. cursor: default;
  11. outline: none;
  12. white-space: nowrap;
  13. &[data-variant="primary"] {
  14. background-color: var(--button-primary-base);
  15. border-color: var(--border-weak-base);
  16. color: var(--icon-invert-base);
  17. [data-slot="icon-svg"] {
  18. color: var(--icon-invert-base);
  19. }
  20. &:hover:not(:disabled) {
  21. background-color: var(--icon-strong-hover);
  22. }
  23. &:focus:not(:disabled) {
  24. background-color: var(--icon-strong-focus);
  25. }
  26. &:active:not(:disabled) {
  27. background-color: var(--icon-strong-active);
  28. }
  29. &:disabled {
  30. background-color: var(--icon-strong-disabled);
  31. [data-slot="icon-svg"] {
  32. color: var(--icon-invert-base);
  33. }
  34. }
  35. }
  36. &[data-variant="ghost"] {
  37. border-color: transparent;
  38. background-color: transparent;
  39. color: var(--text-strong);
  40. [data-slot="icon-svg"] {
  41. color: var(--icon-base);
  42. }
  43. &:hover:not(:disabled) {
  44. background-color: var(--surface-base-hover);
  45. }
  46. &:focus-visible:not(:disabled) {
  47. background-color: var(--surface-base-hover);
  48. }
  49. &:active:not(:disabled) {
  50. background-color: var(--surface-base-active);
  51. }
  52. &:disabled {
  53. color: var(--text-weak);
  54. cursor: not-allowed;
  55. [data-slot="icon-svg"] {
  56. color: var(--icon-disabled);
  57. }
  58. }
  59. &[data-selected="true"]:not(:disabled) {
  60. background-color: var(--surface-base-hover);
  61. }
  62. &[data-active="true"] {
  63. background-color: var(--surface-base-active);
  64. }
  65. }
  66. &[data-variant="secondary"] {
  67. border: transparent;
  68. background-color: var(--button-secondary-base);
  69. color: var(--text-strong);
  70. box-shadow: var(--shadow-xs-border-base);
  71. &:hover:not(:disabled) {
  72. background-color: var(--button-secondary-hover);
  73. }
  74. &:focus:not(:disabled) {
  75. background-color: var(--button-secondary-base);
  76. }
  77. &:focus-visible:not(:active) {
  78. background-color: var(--button-secondary-base);
  79. box-shadow: var(--shadow-xs-border-focus);
  80. }
  81. &:focus-visible:active {
  82. box-shadow: none;
  83. }
  84. &:active:not(:disabled) {
  85. background-color: var(--button-secondary-base);
  86. scale: 0.99;
  87. transition: all 150ms ease-out;
  88. }
  89. &:disabled {
  90. border-color: var(--border-disabled);
  91. background-color: var(--surface-disabled);
  92. color: var(--text-weak);
  93. cursor: not-allowed;
  94. }
  95. [data-slot="icon-svg"] {
  96. color: var(--icon-base);
  97. }
  98. }
  99. &[data-size="small"] {
  100. height: 24px;
  101. padding: 0 8px;
  102. &[data-icon] {
  103. padding: 0 12px 0 4px;
  104. }
  105. font-size: var(--font-size-small);
  106. line-height: var(--line-height-large);
  107. gap: 4px;
  108. /* text-12-medium */
  109. font-family: var(--font-family-sans);
  110. font-size: var(--font-size-small);
  111. font-style: normal;
  112. font-weight: var(--font-weight-medium);
  113. line-height: var(--line-height-large); /* 166.667% */
  114. letter-spacing: var(--letter-spacing-normal);
  115. }
  116. &[data-size="normal"] {
  117. height: 28px;
  118. line-height: 28px;
  119. padding: 0 6px;
  120. &[data-icon] {
  121. padding: 0 12px 0 4px;
  122. }
  123. font-size: var(--font-size-small);
  124. gap: 6px;
  125. /* text-12-medium */
  126. font-family: var(--font-family-sans);
  127. font-size: var(--font-size-small);
  128. font-style: normal;
  129. font-weight: var(--font-weight-medium);
  130. letter-spacing: var(--letter-spacing-normal);
  131. }
  132. &[data-size="large"] {
  133. height: 32px;
  134. padding: 6px 12px;
  135. &[data-icon] {
  136. padding: 0 12px 0 8px;
  137. }
  138. gap: 4px;
  139. /* text-14-medium */
  140. font-family: var(--font-family-sans);
  141. font-size: 14px;
  142. font-style: normal;
  143. font-weight: var(--font-weight-medium);
  144. line-height: var(--line-height-large); /* 142.857% */
  145. letter-spacing: var(--letter-spacing-normal);
  146. }
  147. &:focus {
  148. outline: none;
  149. }
  150. }
  151. [data-component="button"].titlebar-icon[data-variant="ghost"][aria-expanded="true"] {
  152. background-color: var(--surface-base-active);
  153. }
  154. [data-component="button"].titlebar-icon[data-variant="ghost"][aria-expanded="true"] [data-slot="icon-svg"] {
  155. color: var(--icon-strong-base);
  156. }
  157. [data-component="button"].titlebar-icon[data-variant="ghost"][aria-expanded="true"]:hover:not(:disabled) {
  158. background-color: var(--surface-base-active);
  159. }