2
0

_panel.scss 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. @use '../tools' as *;
  2. @use '../settings' as *;
  3. $header-icon-size: theme('spacing.4');
  4. $header-button-size: theme('spacing.6');
  5. .w-panel {
  6. --header-gap: 0;
  7. margin-bottom: calc(
  8. theme('spacing.5') + theme('spacing.5') * var(--w-density-factor)
  9. );
  10. @include media-breakpoint-up(sm) {
  11. --header-gap: theme('spacing.4');
  12. }
  13. .content-locked &__content {
  14. cursor: not-allowed;
  15. user-select: none;
  16. > * {
  17. pointer-events: none;
  18. }
  19. }
  20. }
  21. .w-panel__header {
  22. display: flex;
  23. align-items: center;
  24. margin-bottom: theme('spacing.[0.5]');
  25. margin-inline-start: calc(-1 * #{$mobile-nice-padding});
  26. @include media-breakpoint-up(sm) {
  27. margin-inline-start: calc(
  28. -1 * ((2 * $header-button-size) + var(--header-gap))
  29. );
  30. }
  31. }
  32. .w-panel__heading {
  33. @apply w-h3;
  34. display: inline-block;
  35. margin: 0;
  36. margin-inline-start: var(--header-gap);
  37. padding-inline-end: theme('spacing.2');
  38. white-space: nowrap;
  39. text-overflow: ellipsis;
  40. cursor: pointer;
  41. label {
  42. cursor: pointer;
  43. }
  44. @include media-breakpoint-up(md) {
  45. padding-inline-end: theme('spacing.5');
  46. }
  47. }
  48. .w-panel__heading--label {
  49. @apply w-label-1;
  50. }
  51. .w-panel__anchor,
  52. .w-panel__toggle,
  53. .w-panel__controls .button.button--icon {
  54. @include show-focus-outline-inside();
  55. display: inline-grid;
  56. justify-content: center;
  57. align-content: center;
  58. color: theme('colors.icon-primary');
  59. border-radius: theme('borderRadius.full');
  60. margin: 0;
  61. padding: 0;
  62. width: $header-button-size;
  63. height: $header-button-size;
  64. @include more-contrast-interactive();
  65. &:focus-visible,
  66. &:hover {
  67. color: theme('colors.icon-primary-hover');
  68. background-color: theme('colors.white-10');
  69. @media (forced-colors: active) {
  70. border: 1px solid currentColor;
  71. }
  72. }
  73. &[disabled] {
  74. color: theme('colors.text-placeholder');
  75. cursor: not-allowed;
  76. // Counter hover styles.
  77. background-color: transparent;
  78. @media (forced-colors: active) {
  79. color: GrayText;
  80. }
  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. }
  139. .w-panel--dashboard {
  140. background-color: theme('colors.surface-dashboard-panel');
  141. border: 1px solid theme('colors.border-furniture');
  142. border-radius: 5px;
  143. margin-bottom: calc(
  144. theme('spacing.4') + theme('spacing.4') * var(--w-density-factor)
  145. );
  146. .w-panel__header {
  147. padding: theme('spacing.5');
  148. margin-inline-start: 0;
  149. @include media-breakpoint-up(sm) {
  150. margin-inline-start: calc(-1 * theme('spacing.5'));
  151. }
  152. }
  153. .w-panel__heading {
  154. margin-inline-start: theme('spacing.2');
  155. white-space: wrap;
  156. }
  157. }