_panel.scss 3.5 KB

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