icon-button.css 3.1 KB

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