Skip to content

Commit d39e11d

Browse files
committed
main - cd5832d refactor(material/dialog): simplify structural styles (#29068)
1 parent 7019b8b commit d39e11d

17 files changed

+27
-97
lines changed

core/tokens/m2/mat/_dialog.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use '@material/elevation/elevation-theme' as mdc-elevation;
12
@use '../../token-utils';
23
@use '../../../style/sass-utils';
34

@@ -8,6 +9,7 @@ $prefix: (mat, dialog);
89
// but may be in a future version of the theming API.
910
@function get-unthemable-tokens() {
1011
@return (
12+
container-elevation-shadow: mdc-elevation.elevation-box-shadow(24),
1113
container-max-width: 80vw,
1214
container-small-max-width: 80vw,
1315
container-min-width: 0,

core/tokens/m2/mdc/_dialog.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ $prefix: (mdc, dialog);
1313
// our CSS.
1414
@function get-unthemable-tokens() {
1515
@return (
16-
// Height of the container's elevation.
17-
container-elevation: 24,
18-
// Color of the elevation shadow.
19-
container-shadow-color: #000,
2016
// Border radius of the container.
2117
container-shape: 4px,
2218
// =============================================================================================
2319
// = TOKENS NOT USED IN ANGULAR MATERIAL =
2420
// =============================================================================================
21+
container-elevation: null,
22+
container-shadow-color: null,
2523
with-divider-divider-height: null,
2624
with-divider-divider-color: null,
2725
with-icon-icon-size: null,

core/tokens/m3/mat/_dialog.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ $prefix: (mat, dialog);
1010
/// @return {Map} A set of custom tokens for the dialog
1111
@function get-tokens($systems, $exclude-hardcoded, $token-slots) {
1212
$tokens: (
13+
container-elevation-shadow: token-utils.hardcode(none, $exclude-hardcoded),
1314
container-max-width: token-utils.hardcode(560px, $exclude-hardcoded),
1415
container-small-max-width: token-utils.hardcode(calc(100vw - 32px), $exclude-hardcoded),
1516
container-min-width: token-utils.hardcode(280px, $exclude-hardcoded),

core/tokens/m3/mdc/_dialog.scss

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@use 'sass:map';
21
@use '../../token-utils';
32

43
// The prefix used to generate the fully qualified name for tokens in this file.
@@ -20,20 +19,5 @@ $prefix: (mdc, dialog);
2019
headline-weight: subhead-weight,
2120
));
2221

23-
@if map.get($tokens, container-elevation) != null {
24-
$tokens: map.merge($tokens, (
25-
// The spec has the dialog at an elevation of 3 which is consistent with the current
26-
// version of the tokens (0_161), however both the designs and MDC's implementation
27-
// have the elevation set to 0. Set it manually to 0 here since the value in the
28-
// exported tokens is likely outdated.
29-
container-elevation: 0,
30-
31-
// This color needs to be supplied for MDC to produce the shadow. Technically we don't
32-
// have to provide it since the elevation is set to 0 above, but we do it in case
33-
// the value changes in the future.
34-
container-shadow-color: #000,
35-
));
36-
}
37-
3822
@return token-utils.namespace-tokens($prefix, $tokens, $token-slots);
3923
}

dialog/_dialog-theme.scss

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@use 'sass:map';
2-
@use '@material/dialog/dialog-theme' as mdc-dialog-theme;
32
@use '../core/style/sass-utils';
43
@use '../core/tokens/m2/mdc/dialog' as tokens-mdc-dialog;
54
@use '../core/tokens/m2/mat/dialog' as tokens-mat-dialog;
@@ -16,7 +15,8 @@
1615
@else {
1716
// Add default values for tokens not related to color, typography, or density.
1817
@include sass-utils.current-selector-or-root() {
19-
@include mdc-dialog-theme.theme(tokens-mdc-dialog.get-unthemable-tokens());
18+
@include token-utils.create-token-values(
19+
tokens-mdc-dialog.$prefix, tokens-mdc-dialog.get-unthemable-tokens());
2020
@include token-utils.create-token-values(
2121
tokens-mat-dialog.$prefix, tokens-mat-dialog.get-unthemable-tokens());
2222
}
@@ -29,7 +29,8 @@
2929
}
3030
@else {
3131
@include sass-utils.current-selector-or-root() {
32-
@include mdc-dialog-theme.theme(tokens-mdc-dialog.get-color-tokens($theme));
32+
@include token-utils.create-token-values(
33+
tokens-mdc-dialog.$prefix, tokens-mdc-dialog.get-color-tokens($theme));
3334
@include token-utils.create-token-values(
3435
tokens-mat-dialog.$prefix, tokens-mat-dialog.get-color-tokens($theme));
3536
}
@@ -42,7 +43,8 @@
4243
}
4344
@else {
4445
@include sass-utils.current-selector-or-root() {
45-
@include mdc-dialog-theme.theme(tokens-mdc-dialog.get-typography-tokens($theme));
46+
@include token-utils.create-token-values(
47+
tokens-mdc-dialog.$prefix, tokens-mdc-dialog.get-typography-tokens($theme));
4648
@include token-utils.create-token-values(
4749
tokens-mat-dialog.$prefix, tokens-mat-dialog.get-typography-tokens($theme));
4850
}
@@ -88,7 +90,8 @@
8890
@include validation.selector-defined(
8991
'Calls to Angular Material theme mixins with an M3 theme must be wrapped in a selector');
9092
@if ($tokens != ()) {
91-
@include mdc-dialog-theme.theme(map.get($tokens, tokens-mdc-dialog.$prefix));
93+
@include token-utils.create-token-values(
94+
tokens-mdc-dialog.$prefix, map.get($tokens, tokens-mdc-dialog.$prefix));
9295
@include token-utils.create-token-values(
9396
tokens-mat-dialog.$prefix, map.get($tokens, tokens-mat-dialog.$prefix));
9497
}

dialog/_mdc-dialog-structure-overrides.scss

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)