_panel.scss 3.9 KB

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