| 1 |
@use '../../sass-utilities' as *; |
| 2 |
|
| 3 |
@include pf-root($expandable-section) { |
| 4 |
--#{$expandable-section}--Gap: var(--pf-t--global--spacer--sm); |
| 5 |
|
| 6 |
// Toggle icon |
| 7 |
--#{$expandable-section}__toggle-icon--MinWidth: 1em; |
| 8 |
--#{$expandable-section}__toggle-icon--Color: var(--pf-t--global--icon--color--regular); |
| 9 |
--#{$expandable-section}__toggle-icon--TransitionTimingFunction: var(--pf-t--global--motion--timing-function--default); |
| 10 |
--#{$expandable-section}__toggle-icon--TransitionDuration: var(--pf-t--global--motion--duration--icon--default); |
| 11 |
--#{$expandable-section}__toggle-icon--Transition: transform var(--#{$expandable-section}__toggle-icon--TransitionDuration) var(--#{$expandable-section}__toggle-icon--TransitionTimingFunction); // TODO remove in breaking change along with shorthand property |
| 12 |
--#{$expandable-section}__toggle-icon--Rotate: 0; |
| 13 |
--#{$expandable-section}__toggle-icon--m-expand-top--Rotate: 0; |
| 14 |
--#{$expandable-section}--m-expanded__toggle-icon--Rotate: -180deg; |
| 15 |
--#{$expandable-section}--m-expanded__toggle-icon--m-expand-top--Rotate: 180deg; |
| 16 |
--#{$expandable-section}__content--TransitionDuration--collapse--slide: 0s; |
| 17 |
--#{$expandable-section}__content--TransitionDuration--collapse--fade: var(--pf-t--global--motion--duration--fade--short); |
| 18 |
--#{$expandable-section}__content--TransitionDuration--expand--slide: 0s; |
| 19 |
--#{$expandable-section}__content--TransitionDuration--expand--fade: var(--pf-t--global--motion--duration--fade--default); |
| 20 |
--#{$expandable-section}__content--TransitionDuration--slide: var(--#{$expandable-section}__content--TransitionDuration--collapse--slide); |
| 21 |
--#{$expandable-section}__content--TransitionDuration--fade: var(--#{$expandable-section}__content--TransitionDuration--collapse--fade); |
| 22 |
--#{$expandable-section}__content--TransitionTimingFunction: var(--pf-t--global--motion--timing-function--default); |
| 23 |
--#{$expandable-section}__content--TransitionDelay--hide: var(--#{$expandable-section}__content--TransitionDuration--fade); |
| 24 |
--#{$expandable-section}__content--Opacity: 0; |
| 25 |
--#{$expandable-section}__content--TranslateY: 0; |
| 26 |
--#{$expandable-section}__content--PaddingInlineStart: 0; |
| 27 |
--#{$expandable-section}__content--MaxHeight: 0px; |
| 28 |
--#{$expandable-section}__content--Visibility: hidden; |
| 29 |
--#{$expandable-section}__content--Opacity: 0; |
| 30 |
--#{$expandable-section}--m-expand-top__content--TranslateY: 0; |
| 31 |
--#{$expandable-section}--m-expand-bottom__content--TranslateY: 0; |
| 32 |
--#{$expandable-section}--m-expanded__content--Opacity: 1; |
| 33 |
--#{$expandable-section}--m-expanded__content--TranslateY: 0; |
| 34 |
|
| 35 |
@media screen and (prefers-reduced-motion: no-preference) { |
| 36 |
--#{$expandable-section}__content--TransitionDuration--collapse--slide: var(--pf-t--global--motion--duration--fade--short); |
| 37 |
--#{$expandable-section}__content--TransitionDuration--expand--slide: var(--pf-t--global--motion--duration--fade--default); |
| 38 |
--#{$expandable-section}__content--TranslateY: -.5rem; |
| 39 |
--#{$expandable-section}--m-expand-top__content--TranslateY: .5rem; |
| 40 |
--#{$expandable-section}--m-expand-bottom__content--TranslateY: -.5rem; |
| 41 |
} |
| 42 |
|
| 43 |
// Content |
| 44 |
--#{$expandable-section}__content--MaxWidth: auto; |
| 45 |
|
| 46 |
// Limit Width |
| 47 |
--#{$expandable-section}--m-limit-width__content--MaxWidth: #{pf-size-prem(750px)}; |
| 48 |
|
| 49 |
// Large / Disclosure |
| 50 |
--#{$expandable-section}--m-display-lg--PaddingBlockStart: var(--pf-t--global--spacer--sm); |
| 51 |
--#{$expandable-section}--m-display-lg--PaddingBlockEnd: var(--pf-t--global--spacer--sm); |
| 52 |
--#{$expandable-section}--m-display-lg--PaddingInlineStart: var(--pf-t--global--spacer--md); |
| 53 |
--#{$expandable-section}--m-display-lg--PaddingInlineEnd: var(--pf-t--global--spacer--md); |
| 54 |
--#{$expandable-section}--m-display-lg--m-expanded--PaddingBlockEnd: var(--pf-t--global--spacer--md); |
| 55 |
--#{$expandable-section}--m-display-lg--BackgroundColor: var(--pf-t--global--background--color--secondary--default); |
| 56 |
--#{$expandable-section}--m-display-lg--BorderWidth: var(--pf-t--global--border--width--box--default); |
| 57 |
--#{$expandable-section}--m-display-lg--BorderColor: var(--pf-t--global--border--color--default); |
| 58 |
--#{$expandable-section}--m-display-lg--BorderRadius: var(--pf-t--global--border--radius--medium); |
| 59 |
--#{$expandable-section}--m-display-lg--TransitionDelay: var(--#{$expandable-section}__content--TransitionDuration--collapse--fade); |
| 60 |
|
| 61 |
// Indented |
| 62 |
--#{$expandable-section}--m-indented__content--PaddingInlineStart: calc(var(--pf-t--global--spacer--action--horizontal--plain--default) + var(--pf-t--global--spacer--gap--text-to-element--default) + var(--#{$expandable-section}__toggle-icon--MinWidth)); |
| 63 |
|
| 64 |
// Truncate |
| 65 |
--#{$expandable-section}--m-truncate__content--LineClamp: 3; |
| 66 |
--#{$expandable-section}--m-truncate--Gap: var(--pf-t--global--spacer--xs); |
| 67 |
} |
| 68 |
|
| 69 |
.#{$expandable-section} { |
| 70 |
display: flex; |
| 71 |
flex-direction: column; |
| 72 |
gap: 0; |
| 73 |
transition-delay: var(--#{$expandable-section}__content--TransitionDelay--hide); |
| 74 |
transition-duration: 0s; |
| 75 |
transition-property: gap, padding-block-end; |
| 76 |
|
| 77 |
&.pf-m-expanded { |
| 78 |
--#{$expandable-section}__toggle-icon--Rotate: var(--#{$expandable-section}--m-expanded__toggle-icon--Rotate); |
| 79 |
--#{$expandable-section}__toggle-icon--m-expand-top--Rotate: var(--#{$expandable-section}--m-expanded__toggle-icon--m-expand-top--Rotate); |
| 80 |
--#{$expandable-section}--m-display-lg--PaddingBlockEnd: var(--#{$expandable-section}--m-display-lg--m-expanded--PaddingBlockEnd); |
| 81 |
--#{$expandable-section}__content--TransitionDuration--slide: var(--#{$expandable-section}__content--TransitionDuration--expand--slide); |
| 82 |
--#{$expandable-section}__content--TransitionDuration--fade: var(--#{$expandable-section}__content--TransitionDuration--expand--fade); |
| 83 |
--#{$expandable-section}__content--Opacity: var(--#{$expandable-section}--m-expanded__content--Opacity); |
| 84 |
--#{$expandable-section}__content--TranslateY: var(--#{$expandable-section}--m-expanded__content--TranslateY); |
| 85 |
--#{$expandable-section}__content--Visibility: auto; |
| 86 |
--#{$expandable-section}__content--Overflow: visible; |
| 87 |
--#{$expandable-section}__content--MaxHeight: 99999px; |
| 88 |
--#{$expandable-section}__content--TransitionDelay--hide: 0s; |
| 89 |
|
| 90 |
gap: var(--pf-v6-c-expandable-section--Gap); |
| 91 |
} |
| 92 |
|
| 93 |
&.pf-m-expand-top { |
| 94 |
--#{$expandable-section}__toggle-icon--Rotate: var(--#{$expandable-section}__toggle-icon--m-expand-top--Rotate); |
| 95 |
} |
| 96 |
|
| 97 |
// The following selector is for ensuring we target only detached expandable section contents without introducing a breaking change |
| 98 |
// (since typically both toggle and content would both be in the expandable section wrapper) |
| 99 |
// In a breaking change we could update this to utilize the pf-m-detached class |
| 100 |
&:has(.#{$expandable-section}__content:only-child) { |
| 101 |
&:not(.pf-m-expand-top, .pf-m-expand-bottom) { |
| 102 |
--#{$expandable-section}__content--TranslateY: 0; |
| 103 |
--#{$expandable-section}__content--TransitionDuration--expand--fade: 0s; |
| 104 |
--#{$expandable-section}__content--TransitionDuration--collapse--fade: 0s; |
| 105 |
} |
| 106 |
|
| 107 |
&.pf-m-expand-top:not(.pf-m-expanded) { |
| 108 |
--#{$expandable-section}__content--TranslateY: var(--#{$expandable-section}--m-expand-top__content--TranslateY); |
| 109 |
} |
| 110 |
|
| 111 |
&.pf-m-expand-bottom:not(.pf-m-expanded) { |
| 112 |
--#{$expandable-section}__content--TranslateY: var(--#{$expandable-section}--m-expand-bottom__content--TranslateY); |
| 113 |
} |
| 114 |
} |
| 115 |
|
| 116 |
&.pf-m-limit-width { |
| 117 |
--#{$expandable-section}__content--MaxWidth: var(--#{$expandable-section}--m-limit-width__content--MaxWidth); |
| 118 |
} |
| 119 |
|
| 120 |
&.pf-m-display-lg { |
| 121 |
padding-block-start: var(--#{$expandable-section}--m-display-lg--PaddingBlockStart); |
| 122 |
padding-block-end: var(--#{$expandable-section}--m-display-lg--PaddingBlockEnd); |
| 123 |
padding-inline-start: var(--#{$expandable-section}--m-display-lg--PaddingInlineStart); |
| 124 |
padding-inline-end: var(--#{$expandable-section}--m-display-lg--PaddingInlineEnd); |
| 125 |
background-color: var(--#{$expandable-section}--m-display-lg--BackgroundColor); |
| 126 |
border: var(--#{$expandable-section}--m-display-lg--BorderWidth) solid var(--#{$expandable-section}--m-display-lg--BorderColor); |
| 127 |
border-radius: var(--#{$expandable-section}--m-display-lg--BorderRadius); |
| 128 |
} |
| 129 |
|
| 130 |
&.pf-m-indented { |
| 131 |
--#{$expandable-section}__content--PaddingInlineStart: var(--#{$expandable-section}--m-indented__content--PaddingInlineStart); |
| 132 |
} |
| 133 |
|
| 134 |
&.pf-m-truncate { |
| 135 |
--#{$expandable-section}--Gap: var(--#{$expandable-section}--m-truncate--Gap); |
| 136 |
--#{$expandable-section}__content--TransitionDelay--hide: 0s; |
| 137 |
|
| 138 |
&:not(.pf-m-expanded) .#{$expandable-section}__content { |
| 139 |
// stylelint-disable |
| 140 |
display: -webkit-box; |
| 141 |
overflow: hidden; |
| 142 |
-webkit-box-orient: vertical; |
| 143 |
-webkit-line-clamp: var(--#{$expandable-section}--m-truncate__content--LineClamp); |
| 144 |
// stylelint-enable |
| 145 |
} |
| 146 |
} |
| 147 |
} |
| 148 |
|
| 149 |
.#{$expandable-section}__toggle-icon { |
| 150 |
@include pf-v6-mirror-inline-on-rtl; |
| 151 |
|
| 152 |
display: inline-block; |
| 153 |
min-width: var(--#{$expandable-section}__toggle-icon--MinWidth); |
| 154 |
color: var(--#{$expandable-section}__toggle-icon--Color); |
| 155 |
transform: rotate(var(--#{$expandable-section}__toggle-icon--Rotate)); |
| 156 |
transition: var(--#{$expandable-section}__toggle-icon--Transition); // TODO remove shorthand in breaking change |
| 157 |
|
| 158 |
&.pf-m-expand-top { // TODO: Remove this block in breaking change in favor of using modifier on outer expandable section wrapper |
| 159 |
--#{$expandable-section}__toggle-icon--Rotate: var(--#{$expandable-section}__toggle-icon--m-expand-top--Rotate); |
| 160 |
} |
| 161 |
} |
| 162 |
|
| 163 |
.#{$expandable-section}__content { |
| 164 |
max-width: var(--#{$expandable-section}__content--MaxWidth); |
| 165 |
padding-block-end: var(--#{$expandable-section}__content--PaddingBlockEnd, 0); // TODO remove in breaking change |
| 166 |
padding-inline-start: var(--#{$expandable-section}__content--PaddingInlineStart); |
| 167 |
|
| 168 |
&:where([hidden]) { |
| 169 |
display: revert; |
| 170 |
} |
| 171 |
|
| 172 |
.#{$expandable-section}:where(:not(.pf-m-truncate)) > & { |
| 173 |
visibility: var(--#{$expandable-section}__content--Visibility, hidden); |
| 174 |
max-height: var(--#{$expandable-section}__content--MaxHeight, 0); |
| 175 |
overflow: var(--#{$expandable-section}__content--Overflow, hidden); |
| 176 |
opacity: var(--#{$expandable-section}__content--Opacity); |
| 177 |
translate: 0 var(--#{$expandable-section}__content--TranslateY); |
| 178 |
transition-delay: 0s, 0s, var(--#{$expandable-section}__content--TransitionDelay--hide, 0s), var(--#{$expandable-section}__content--TransitionDelay--hide, 0s); |
| 179 |
transition-timing-function: var(--#{$expandable-section}__content--TransitionTimingFunction); |
| 180 |
transition-duration: var(--#{$expandable-section}__content--TransitionDuration--fade), var(--#{$expandable-section}__content--TransitionDuration--slide), 0s, 0s; |
| 181 |
transition-property: opacity, translate, visibility, max-height; |
| 182 |
} |
| 183 |
} |