2
0

_panel.scss 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. $header-icon-size: theme('spacing.4');
  2. $header-button-size-mobile: $mobile-nice-padding;
  3. $header-button-size: theme('spacing.6');
  4. .w-panel {
  5. --header-gap: 0;
  6. margin-bottom: theme('spacing.10');
  7. @include media-breakpoint-up(sm) {
  8. --header-gap: theme('spacing.4');
  9. }
  10. .content-locked &__content {
  11. cursor: not-allowed;
  12. user-select: none;
  13. > * {
  14. pointer-events: none;
  15. }
  16. }
  17. }
  18. .w-panel__header {
  19. display: flex;
  20. align-items: center;
  21. margin-bottom: theme('spacing.[0.5]');
  22. margin-inline-start: -1 * $mobile-nice-padding;
  23. @include media-breakpoint-up(sm) {
  24. margin-inline-start: calc(
  25. -1 * ((2 * $header-button-size) + var(--header-gap))
  26. );
  27. }
  28. }
  29. .w-panel__heading {
  30. @apply w-h3;
  31. display: inline-block;
  32. margin: 0;
  33. margin-inline-start: var(--header-gap);
  34. padding-inline-end: theme('spacing.2');
  35. white-space: nowrap;
  36. text-overflow: ellipsis;
  37. cursor: pointer;
  38. label {
  39. cursor: pointer;
  40. }
  41. @include media-breakpoint-up(md) {
  42. padding-inline-end: theme('spacing.5');
  43. }
  44. }
  45. .w-panel__heading--label {
  46. @apply w-label-1;
  47. }
  48. .w-panel__anchor,
  49. .w-panel__toggle,
  50. .w-panel__controls .button.button--icon {
  51. @include show-focus-outline-inside();
  52. display: inline-grid;
  53. justify-content: center;
  54. align-content: center;
  55. color: theme('colors.icon-primary');
  56. border-radius: theme('borderRadius.full');
  57. margin: 0;
  58. padding: 0;
  59. width: $header-button-size-mobile;
  60. height: $header-button-size-mobile;
  61. &:focus-visible,
  62. &:hover {
  63. color: theme('colors.icon-primary-hover');
  64. background-color: theme('colors.white-10');
  65. @media (forced-colors: active) {
  66. border: 1px solid currentColor;
  67. }
  68. }
  69. &[disabled] {
  70. color: theme('colors.text-placeholder');
  71. cursor: not-allowed;
  72. // Counter hover styles.
  73. background-color: transparent;
  74. @media (forced-colors: active) {
  75. color: GrayText;
  76. }
  77. }
  78. @include media-breakpoint-up(sm) {
  79. width: $header-button-size;
  80. height: $header-button-size;
  81. }
  82. }
  83. .w-panel__anchor {
  84. // Only hide anchors for devices that support hover interactions.
  85. @media (hover: hover) {
  86. .w-panel__header:not(:hover, :focus-within) & {
  87. opacity: 0;
  88. }
  89. }
  90. }
  91. // The suffix anchor is intended for small viewports only.
  92. .w-panel__anchor--suffix {
  93. @include media-breakpoint-up(sm) {
  94. display: none;
  95. }
  96. }
  97. // The prefix anchor can be used when there is enough space in the margin of the page.
  98. .w-panel__anchor--prefix {
  99. display: none;
  100. @include media-breakpoint-up(sm) {
  101. display: inline-grid;
  102. }
  103. }
  104. .w-panel__toggle {
  105. appearance: none;
  106. background: transparent;
  107. }
  108. .w-panel__icon {
  109. width: $header-icon-size;
  110. height: $header-icon-size;
  111. // Only rotate the default caret icon, not custom ones.
  112. [aria-expanded='false'] &.icon-placeholder {
  113. transform: rotate(-90deg);
  114. }
  115. &.icon-link {
  116. width: theme('spacing.[3.5]');
  117. height: theme('spacing.[3.5]');
  118. }
  119. }
  120. .w-panel__divider {
  121. flex: 1;
  122. }
  123. .w-panel__controls {
  124. // Prevent shrinking of the buttons when header text is long.
  125. flex-shrink: 0;
  126. // Add additional invisible padding for a more forgiving hover area.
  127. padding: theme('spacing.4');
  128. margin: calc(-1 * theme('spacing.4'));
  129. margin-inline-end: calc(-1 * theme('spacing.8'));
  130. margin-inline-start: 0;
  131. @include media-breakpoint-up(sm) {
  132. margin: calc(-1 * theme('spacing.4'));
  133. margin-inline-start: 0;
  134. }
  135. }
  136. .w-panel__wrapper {
  137. @include max-form-width();
  138. }