icon-button.css 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. [data-component="icon-button"] {
  2. display: inline-flex;
  3. align-items: center;
  4. justify-content: center;
  5. border-radius: var(--radius-sm);
  6. text-decoration: none;
  7. user-select: none;
  8. aspect-ratio: 1;
  9. flex-shrink: 0;
  10. transition-property: background-color, color, opacity, box-shadow;
  11. transition-duration: var(--transition-duration);
  12. transition-timing-function: var(--transition-easing);
  13. &[data-variant="primary"] {
  14. background-color: var(--icon-strong-base);
  15. [data-slot="icon-svg"] {
  16. /* color: var(--icon-weak-base); */
  17. color: var(--icon-invert-base);
  18. /* &:hover:not(:disabled) { */
  19. /* color: var(--icon-weak-hover); */
  20. /* } */
  21. /* &:active:not(:disabled) { */
  22. /* color: var(--icon-strong-active); */
  23. /* } */
  24. }
  25. &:hover:not(:disabled) {
  26. background-color: var(--icon-strong-hover);
  27. }
  28. &:focus:not(:disabled) {
  29. background-color: var(--icon-strong-focus);
  30. }
  31. &:active:not(:disabled) {
  32. background-color: var(--icon-strong-active);
  33. }
  34. &:disabled {
  35. background-color: var(--icon-strong-disabled);
  36. [data-slot="icon-svg"] {
  37. color: var(--icon-invert-base);
  38. }
  39. }
  40. }
  41. &[data-variant="secondary"] {
  42. border: transparent;
  43. background-color: var(--button-secondary-base);
  44. color: var(--text-strong);
  45. box-shadow: var(--shadow-xs-border);
  46. &:hover:not(:disabled) {
  47. background-color: var(--button-secondary-hover);
  48. }
  49. &:focus:not(:disabled) {
  50. background-color: var(--button-secondary-base);
  51. }
  52. &:focus-visible:not(:active) {
  53. background-color: var(--button-secondary-base);
  54. box-shadow: var(--shadow-xs-border-focus);
  55. }
  56. &:focus-visible:active {
  57. box-shadow: none;
  58. }
  59. &:active:not(:disabled) {
  60. background-color: var(--button-secondary-base);
  61. }
  62. [data-slot="icon-svg"] {
  63. color: var(--icon-strong-base);
  64. }
  65. &:disabled {
  66. background-color: var(--icon-strong-disabled);
  67. color: var(--icon-invert-base);
  68. cursor: not-allowed;
  69. }
  70. }
  71. &[data-variant="ghost"] {
  72. background-color: transparent;
  73. /* color: var(--icon-base); */
  74. [data-slot="icon-svg"] {
  75. color: var(--icon-base);
  76. }
  77. &:hover:not(:disabled) {
  78. background-color: var(--surface-raised-base-hover);
  79. /* [data-slot="icon-svg"] { */
  80. /* color: var(--icon-hover); */
  81. /* } */
  82. }
  83. &:focus-visible:not(:disabled) {
  84. background-color: var(--surface-raised-base-hover);
  85. }
  86. &:active:not(:disabled) {
  87. background-color: var(--surface-raised-base-active);
  88. /* [data-slot="icon-svg"] { */
  89. /* color: var(--icon-active); */
  90. /* } */
  91. }
  92. &[data-selected]:not(:disabled) {
  93. background-color: var(--surface-raised-base-active);
  94. /* [data-slot="icon-svg"] { */
  95. /* color: var(--icon-selected); */
  96. /* } */
  97. }
  98. &:disabled {
  99. color: var(--icon-invert-base);
  100. cursor: not-allowed;
  101. }
  102. }
  103. &[data-size="normal"] {
  104. width: 24px;
  105. height: 24px;
  106. font-size: var(--font-size-small);
  107. line-height: var(--line-height-large);
  108. gap: calc(var(--spacing) * 0.5);
  109. }
  110. &[data-size="large"] {
  111. height: 32px;
  112. /* padding: 0 8px 0 6px; */
  113. gap: 8px;
  114. /* text-12-medium */
  115. font-family: var(--font-family-sans);
  116. font-size: var(--font-size-small);
  117. font-style: normal;
  118. font-weight: var(--font-weight-medium);
  119. line-height: var(--line-height-large); /* 166.667% */
  120. letter-spacing: var(--letter-spacing-normal);
  121. }
  122. &:focus {
  123. outline: none;
  124. }
  125. }