Skip to content

Commit 72f28d1

Browse files
committed
fixup! feat(material-experimental/mdc-autocomplete): add panel animation
1 parent 376d3cd commit 72f28d1

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/material-experimental/mdc-autocomplete/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ng_module(
2020
"//src/material-experimental/mdc-core",
2121
"//src/material/autocomplete",
2222
"@npm//@angular/common",
23+
"@npm//@material/menu-surface",
2324
],
2425
)
2526

src/material-experimental/mdc-autocomplete/animations.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,25 @@ import {
1515
transition,
1616
trigger
1717
} from '@angular/animations';
18+
import {numbers as menuSurfaceConstants} from '@material/menu-surface';
1819

1920
// Animation values come from
2021
// https://github.com/material-components/material-components-web/blob/master/packages/mdc-menu-surface/_mixins.scss
2122
// TODO(mmalerba): Ideally find a way to import the values from MDC's code.
2223
export const panelAnimation: AnimationTriggerMetadata = trigger('panelAnimation', [
23-
state('hidden', style({})),
24-
state('visible', style({})),
24+
state('void, hidden', style({
25+
opacity: 0,
26+
transform: 'scale(0.8)',
27+
})),
2528
transition(':enter, hidden => visible', [
26-
style({
27-
opacity: 0,
28-
transform: 'scale(0.8)',
29-
}),
3029
group([
3130
animate('0.03s linear', style({ opacity: 1 })),
32-
animate('0.12s cubic-bezier(0, 0, 0.2, 1)', style({ transform: 'scale(1)' })),
31+
animate(
32+
`${menuSurfaceConstants.TRANSITION_OPEN_DURATION}ms cubic-bezier(0, 0, 0.2, 1)`,
33+
style({ transform: 'scale(1)' })),
3334
]),
3435
]),
3536
transition(':leave, visible => hidden', [
36-
animate('0.075s linear', style({ opacity: 0 })),
37+
animate(`${menuSurfaceConstants.TRANSITION_CLOSE_DURATION}ms linear`, style({ opacity: 0 })),
3738
]),
3839
]);

0 commit comments

Comments
 (0)