collapsible.css 3.1 KB

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