forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dialog.scss
104 lines (89 loc) · 3.75 KB
/
dialog.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
@use '@material/dialog' as mdc-dialog;
@use '@material/dialog/variables' as mdc-dialog-variables;
@use '@material/dialog/dialog-theme' as mdc-dialog-theme;
@use './mdc-dialog-structure-overrides';
@use '../core/mdc-helpers/mdc-helpers';
// Theme map with values for variables that will be overriden in the theme.
// MDC's theming system requires non-null values for the slots to be inserted
// and included as default values.
$_dialog-initial-theme: (
// Color
container-color: white,
container-elevation: 24,
container-shadow-color: black,
with-divider-divider-color: black,
subhead-color: black,
supporting-text-color: black,
// Typography
subhead-font: 'Arial',
subhead-line-height: 14px,
subhead-size: 14px,
subhead-weight: 500,
subhead-tracking: 1px,
supporting-text-font: 'Arial',
supporting-text-line-height: 14px,
supporting-text-size: 14px,
supporting-text-weight: 500,
supporting-text-tracking: 1px,
// Structure
container-shape: mdc-dialog-variables.$shape-radius,
);
// Dialog content max height. This has been copied from the standard dialog
// and is needed to make the dialog content scrollable.
$mat-dialog-content-max-height: 65vh !default;
// Dialog button horizontal margin. This has been extracted from MDC as they
// don't expose this value as variable.
$mat-dialog-button-horizontal-margin: 8px !default;
@include mdc-helpers.disable-mdc-fallback-declarations {
@include mdc-dialog.static-styles($query: mdc-helpers.$mdc-base-styles-query);
}
@include mdc-dialog-structure-overrides.private-dialog-structure-overrides(
$mat-dialog-content-max-height);
.mat-mdc-dialog-container {
// Apply the theming slots to the container using an initial set of
// values that will be overridden in the theme styles.
@include mdc-helpers.disable-mdc-fallback-declarations {
@include mdc-dialog-theme.theme-styles($_dialog-initial-theme);
}
// The dialog container is focusable. We remove the default outline shown in browsers.
outline: 0;
.mdc-dialog__container {
transition-duration: var(--mat-dialog-transition-duration, 0ms);
}
// Angular Material supports disabling all animations when NoopAnimationsModule is imported.
// TODO(devversion): Look into using MDC's Sass queries to separate the animation styles and
// conditionally add them. Consider the size cost and churn when deciding whether to switch.
&._mat-animation-noopable .mdc-dialog__container {
transition: none;
}
}
// MDC sets the display behavior for title and actions, but not for content. Since we support
// using the `mdc-dialog__content` as custom element, we need to set the element to `block`.
.mat-mdc-dialog-content {
display: block;
}
.mat-mdc-dialog-actions {
// For backwards compatibility, actions align at start by default. MDC usually
// aligns actions at the end of the container.
justify-content: start;
// .mat-mdc-dialog-actions-align-{center|end} are set by directive input "align"
// [align='center'] and [align='right'] are kept for backwards compability
&.mat-mdc-dialog-actions-align-center, &[align='center'] {
justify-content: center;
}
&.mat-mdc-dialog-actions-align-end, &[align='end'] {
justify-content: flex-end;
}
// MDC applies horizontal margin to buttons that have an explicit `mdc-dialog__button`
// class applied. We can't set this class for projected buttons that consumers of the
// dialog create. To workaround this, we select all Material Design buttons we know and
// add the necessary spacing similar to how MDC applies spacing.
.mat-button-base + .mat-button-base,
.mat-mdc-button-base + .mat-mdc-button-base {
margin-left: $mat-dialog-button-horizontal-margin;
[dir='rtl'] & {
margin-left: 0;
margin-right: $mat-dialog-button-horizontal-margin;
}
}
}