Skip to content

Commit 707920a

Browse files
committed
feat(dialog): align with 2018 material design spec
Aligns the dialog with the most-recent Material Design spec. BREAKING CHANGES: * The `matDialogAnimations.slideDialog` symbol has been renamed to `matDialogAnimations.dialogContainer`.
1 parent ac8339c commit 707920a

File tree

5 files changed

+36
-18
lines changed

5 files changed

+36
-18
lines changed

src/cdk/overlay/_overlay.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $cdk-z-index-overlay: 1000;
66
$cdk-z-index-overlay-backdrop: 1000;
77

88
// Background color for all of the backdrops
9-
$cdk-overlay-dark-backdrop-background: rgba(0, 0, 0, 0.288);
9+
$cdk-overlay-dark-backdrop-background: rgba(0, 0, 0, 0.32);
1010

1111
// Default backdrop animation is based on the Material Design swift-ease-out.
1212
$backdrop-animation-duration: 400ms !default;

src/demo-app/dialog/dialog-demo.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,12 @@
22
max-width: 405px;
33
margin: 20px 0;
44
}
5+
6+
button {
7+
margin-right: 8px;
8+
9+
[dir='rtl'] & {
10+
margin-left: 8px;
11+
margin-right: 0;
12+
}
13+
}

src/lib/dialog/dialog-animations.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,26 @@ import {
1414
AnimationTriggerMetadata,
1515
} from '@angular/animations';
1616

17+
const animationBody = [
18+
// Note: The `enter` animation transitions to `transform: none`, because for some reason
19+
// specifying the transform explicitly, causes IE both to blur the dialog content and
20+
// decimate the animation performance. Leaving it as `none` solves both issues.
21+
state('void', style({opacity: 0, transform: 'scale(0.7)'})),
22+
state('enter', style({transform: 'none'})),
23+
transition('* => enter', animate('150ms cubic-bezier(0, 0, 0.2, 1)',
24+
style({transform: 'none', opacity: 1}))),
25+
transition('enter => void, enter => exit',
26+
animate('75ms cubic-bezier(0.4, 0.0, 0.2, 1)', style({opacity: 0}))),
27+
];
28+
1729
/** Animations used by MatDialog. */
1830
export const matDialogAnimations: {
31+
readonly dialogContainer: AnimationTriggerMetadata;
1932
readonly slideDialog: AnimationTriggerMetadata;
2033
} = {
21-
/** Animation that slides the dialog in and out of view and fades the opacity. */
22-
slideDialog: trigger('slideDialog', [
23-
// Note: The `enter` animation doesn't transition to something like `translate3d(0, 0, 0)
24-
// scale(1)`, because for some reason specifying the transform explicitly, causes IE both
25-
// to blur the dialog content and decimate the animation performance. Leaving it as `none`
26-
// solves both issues.
27-
state('enter', style({ transform: 'none', opacity: 1 })),
28-
state('void', style({ transform: 'translate3d(0, 25%, 0) scale(0.9)', opacity: 0 })),
29-
state('exit', style({ transform: 'translate3d(0, 25%, 0)', opacity: 0 })),
30-
transition('* => *', animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)')),
31-
])
34+
/** Animation that is applied on the dialog container by defalt. */
35+
dialogContainer: trigger('dialogContainer', animationBody),
36+
37+
/** @deprecated @breaking-change 8.0.0 Use `matDialogAnimations.dialogContainer` instead. */
38+
slideDialog: trigger('slideDialog', animationBody)
3239
};

src/lib/dialog/dialog-container.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function throwMatDialogContentAlreadyAttachedError() {
5555
// Using OnPush for dialogs caused some G3 sync issues. Disabled until we can track them down.
5656
// tslint:disable-next-line:validate-decorators
5757
changeDetection: ChangeDetectionStrategy.Default,
58-
animations: [matDialogAnimations.slideDialog],
58+
animations: [matDialogAnimations.dialogContainer],
5959
host: {
6060
'class': 'mat-dialog-container',
6161
'tabindex': '-1',
@@ -65,9 +65,9 @@ export function throwMatDialogContentAlreadyAttachedError() {
6565
'[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledBy',
6666
'[attr.aria-label]': '_config.ariaLabel',
6767
'[attr.aria-describedby]': '_config.ariaDescribedBy || null',
68-
'[@slideDialog]': '_state',
69-
'(@slideDialog.start)': '_onAnimationStart($event)',
70-
'(@slideDialog.done)': '_onAnimationDone($event)',
68+
'[@dialogContainer]': '_state',
69+
'(@dialogContainer.start)': '_onAnimationStart($event)',
70+
'(@dialogContainer.done)': '_onAnimationDone($event)',
7171
},
7272
})
7373
export class MatDialogContainer extends BasePortalOutlet {

src/lib/dialog/dialog.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
$mat-dialog-padding: 24px !default;
7-
$mat-dialog-border-radius: 2px !default;
7+
$mat-dialog-border-radius: 4px !default;
88
$mat-dialog-max-height: 65vh !default;
99
$mat-dialog-button-margin: 8px !default;
1010

@@ -47,9 +47,11 @@ $mat-dialog-button-margin: 8px !default;
4747
}
4848

4949
.mat-dialog-actions {
50-
padding: $mat-dialog-padding / 2 0;
50+
padding: 8px 0;
5151
display: flex;
5252
flex-wrap: wrap;
53+
min-height: 52px;
54+
align-items: center;
5355

5456
// Pull the actions down to avoid their padding stacking with the dialog's padding.
5557
margin-bottom: -$mat-dialog-padding;

0 commit comments

Comments
 (0)