Skip to content

Commit cf30724

Browse files
authored
fix(table): animate expandable (#7497)
1 parent a379e71 commit cf30724

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/patternfly/components/Table/table.scss

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,25 @@
118118
--#{$table}__action--PaddingInlineStart: var(--pf-t--global--spacer--sm);
119119
--#{$table}__action--PaddingInlineEnd: var(--pf-t--global--spacer--sm);
120120

121+
// * Table expandable row
122+
--#{$table}__expandable-row--TransitionDuration--expand--slide: 0s;
123+
--#{$table}__expandable-row--TransitionDuration--expand--fade: var(--pf-t--global--motion--duration--fade--default);
124+
--#{$table}__expandable-row--TransitionDuration--collapse--slide: 0s;
125+
--#{$table}__expandable-row--TransitionDuration--collapse--fade: var(--pf-t--global--motion--duration--fade--short);
126+
--#{$table}__expandable-row--TransitionDuration--slide: var(--#{$table}__expandable-row--TransitionDuration--collapse--slide);
127+
--#{$table}__expandable-row--TransitionDuration--fade: var(--#{$table}__expandable-row--TransitionDuration--collapse--fade);
128+
--#{$table}__expandable-row--TransitionTimingFunction: var(--pf-t--global--motion--timing-function--default);
129+
--#{$table}__expandable-row--Opacity: 0;
130+
--#{$table}__tbody--m-expanded__expandable-row--Opacity: 1;
131+
--#{$table}__expandable-row--TranslateY: 0;
132+
--#{$table}__tbody--m-expanded__expandable-row--TranslateY: 0;
133+
134+
@media screen and (prefers-reduced-motion: no-preference) {
135+
--#{$table}__expandable-row--TransitionDuration--expand--slide: var(--pf-t--global--motion--duration--fade--default);
136+
--#{$table}__expandable-row--TransitionDuration--collapse--slide: var(--pf-t--global--motion--duration--fade--short);
137+
--#{$table}__expandable-row--TranslateY: -.5rem;
138+
}
139+
121140
// * Table expandable row content
122141
--#{$table}__expandable-row-content--PaddingBlockStart: var(--pf-t--global--spacer--md);
123142
--#{$table}__expandable-row-content--PaddingBlockEnd: var(--pf-t--global--spacer--md);
@@ -953,6 +972,12 @@
953972
.#{$table}__expandable-row {
954973
position: relative;
955974
border-block-end: 0 solid transparent;
975+
opacity: var(--#{$table}__expandable-row--Opacity);
976+
transition-timing-function: var(--#{$table}__expandable-row--TransitionTimingFunction);
977+
transition-duration: var(--#{$table}__expandable-row--TransitionDuration--fade), var(--#{$table}__expandable-row--TransitionDuration--slide), var(--#{$table}__expandable-row--TransitionDuration--fade);
978+
transition-property: opacity, translate, display;
979+
transition-behavior: allow-discrete;
980+
translate: 0 var(--#{$table}__expandable-row--TranslateY);
956981

957982
@at-root :not(.#{$table}__control-row) ~ .#{$table}__expandable-row {
958983
> .#{$table}__th,
@@ -989,6 +1014,14 @@
9891014
&.pf-m-expanded {
9901015
border-block-end-color: var(--#{$table}__expandable-row--m-expanded--BorderBlockEndColor);
9911016
border-block-end-width: var(--#{$table}--border-width--base);
1017+
opacity: var(--#{$table}__tbody--m-expanded__expandable-row--Opacity);
1018+
transition-duration: var(--#{$table}__expandable-row--TransitionDuration--expand--fade), var(--#{$table}__expandable-row--TransitionDuration--expand--slide), var(--#{$table}__expandable-row--TransitionDuration--expand--fade);
1019+
translate: 0 var(--#{$table}__tbody--m-expanded__expandable-row--TranslateY);
1020+
1021+
@starting-style {
1022+
opacity: var(--#{$table}__expandable-row--Opacity);
1023+
translate: 0 var(--#{$table}__expandable-row--TranslateY);
1024+
}
9921025
}
9931026

9941027
&:not(.pf-m-expanded) {

0 commit comments

Comments
 (0)