collapsible.css 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. [data-component="collapsible"] {
  2. width: 100%;
  3. display: flex;
  4. flex-direction: column;
  5. background-color: transparent;
  6. border: none;
  7. transition: background-color 0.15s ease;
  8. border-radius: var(--radius-md);
  9. overflow: visible;
  10. &.tool-collapsible {
  11. gap: 8px;
  12. }
  13. [data-slot="collapsible-trigger"] {
  14. width: 100%;
  15. display: flex;
  16. height: 32px;
  17. padding: 0;
  18. align-items: center;
  19. align-self: stretch;
  20. cursor: default;
  21. user-select: none;
  22. color: var(--text-base);
  23. [data-slot="collapsible-arrow"] {
  24. opacity: 0;
  25. transition: opacity 0.15s ease;
  26. }
  27. [data-slot="collapsible-arrow-icon"] {
  28. display: inline-flex;
  29. color: var(--icon-weaker);
  30. transform: rotate(-90deg);
  31. transition: transform 0.15s ease;
  32. }
  33. &:hover [data-slot="collapsible-arrow"] {
  34. opacity: 1;
  35. }
  36. /* text-12-medium */
  37. font-family: var(--font-family-sans);
  38. font-size: var(--font-size-small);
  39. font-style: normal;
  40. font-weight: var(--font-weight-medium);
  41. line-height: var(--line-height-large); /* 166.667% */
  42. letter-spacing: var(--letter-spacing-normal);
  43. /* &:hover { */
  44. /* background-color: var(--surface-base); */
  45. /* } */
  46. &:focus-visible {
  47. outline: none;
  48. background-color: var(--surface-raised-base-hover);
  49. }
  50. &[data-disabled] {
  51. cursor: not-allowed;
  52. }
  53. [data-slot="collapsible-arrow"] {
  54. flex-shrink: 0;
  55. width: 24px;
  56. height: 24px;
  57. display: flex;
  58. align-items: center;
  59. justify-content: center;
  60. }
  61. }
  62. [data-slot="collapsible-trigger"][aria-expanded="true"] {
  63. [data-slot="collapsible-arrow"] {
  64. opacity: 1;
  65. }
  66. [data-slot="collapsible-arrow-icon"] {
  67. transform: rotate(0deg);
  68. }
  69. }
  70. [data-slot="collapsible-content"] {
  71. overflow: hidden;
  72. /* animation: slideUp 250ms ease-out; */
  73. &[data-expanded] {
  74. overflow: visible;
  75. }
  76. /* &[data-expanded] { */
  77. /* animation: slideDown 250ms ease-out; */
  78. /* } */
  79. }
  80. &[data-variant="ghost"] {
  81. background-color: transparent;
  82. border: none;
  83. > [data-slot="collapsible-trigger"] {
  84. background-color: transparent;
  85. border: none;
  86. padding: 0;
  87. /* &:hover { */
  88. /* color: var(--text-strong); */
  89. /* } */
  90. &:focus-visible {
  91. outline: none;
  92. background-color: var(--surface-raised-base-hover);
  93. }
  94. &[data-disabled] {
  95. cursor: not-allowed;
  96. }
  97. }
  98. }
  99. &[data-variant="ghost"][data-scope="filetree"] {
  100. > [data-slot="collapsible-trigger"] {
  101. height: 24px;
  102. }
  103. }
  104. }
  105. @keyframes slideDown {
  106. from {
  107. height: 0;
  108. }
  109. to {
  110. height: var(--kb-collapsible-content-height);
  111. }
  112. }
  113. @keyframes slideUp {
  114. from {
  115. height: var(--kb-collapsible-content-height);
  116. }
  117. to {
  118. height: 0;
  119. }
  120. }