Skip to content

Commit dfba0ed

Browse files
authored
fix(material/dialog): Move unthemable tokens to theme mixin (#27606)
Though these tokens are not currently affected by the theme, in the future they will be affected by the design system used for theming (M2 or M3) BREAKING CHANGE: There are new styles emitted by `mat.dialog-theme` that are not emitted by any of: `mat.dialog-color`, `mat.dialog-typography`, `mat.dialog-density`. If you rely on the partial mixins only and don't call `mat.dialog-theme`, you can add `mat.dialog-base` to get the missing styles.
1 parent f6949e3 commit dfba0ed

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/material/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
@forward './datepicker/datepicker-theme' as datepicker-* show datepicker-theme, datepicker-color,
8989
datepicker-typography, datepicker-date-range-colors, datepicker-density;
9090
@forward './dialog/dialog-theme' as dialog-* show dialog-theme, dialog-color, dialog-typography,
91-
dialog-density;
91+
dialog-density, dialog-base;
9292
@forward './dialog/dialog-legacy-padding' as dialog-* show dialog-legacy-padding;
9393
@forward './divider/divider-theme' as divider-* show divider-theme, divider-color,
9494
divider-typography, divider-density;

src/material/dialog/_dialog-theme.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
@use '@material/dialog/dialog-theme' as mdc-dialog-theme;
2+
@use '../core/style/sass-utils';
23
@use '../core/tokens/m2/mdc/dialog' as tokens-mdc-dialog;
34
@use '../core/theming/theming';
45
@use '../core/typography/typography';
56

7+
8+
@mixin base($config-or-theme) {
9+
// Add default values for tokens not related to color, typography, or density.
10+
@include sass-utils.current-selector-or-root() {
11+
@include mdc-dialog-theme.theme(tokens-mdc-dialog.get-unthemable-tokens());
12+
}
13+
}
14+
615
@mixin color($config-or-theme) {
716
$config: theming.get-color-config($config-or-theme);
817

@@ -31,6 +40,7 @@
3140
$density: theming.get-density-config($theme);
3241
$typography: theming.get-typography-config($theme);
3342

43+
@include base($theme);
3444
@if $color != null {
3545
@include color($color);
3646
}

src/material/dialog/dialog.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ $mat-dialog-button-horizontal-margin: 8px !default;
2020
$mat-dialog-content-max-height);
2121

2222
.mat-mdc-dialog-container {
23-
// Add default values for MDC dialog tokens that aren't outputted by the theming API.
24-
@include mdc-dialog-theme.theme(tokens-mdc-dialog.get-unthemable-tokens());
25-
2623
// Apply the theming slots to the container using an initial set of
2724
// values that will be overridden in the theme styles.
2825
@include mdc-dialog-theme.theme-styles(tokens-mdc-dialog.get-token-slots());

0 commit comments

Comments
 (0)