Skip to content

Commit 68096ec

Browse files
authored
fix(material/button): Move fab unthemable tokens to theme mixin (#27580)
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.fab-theme` that are not emitted by any of: `mat.fab-color`, `mat.fab-typography`, `mat.fab-density`. If you rely on the partial mixins only and don't call `mat.fab-theme`, you can add `mat.fab-base` to get the missing styles.
1 parent 408c0b4 commit 68096ec

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
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 './button/button-theme' as button-* show button-theme, button-color, button-typography,
8989
button-density;
9090
@forward './button/fab-theme' as fab-* show fab-color, fab-typography,
91-
fab-density, fab-theme;
91+
fab-density, fab-theme, fab-base;
9292
@forward './button/icon-button-theme' as icon-button-* show icon-button-color,
9393
icon-button-typography, icon-button-density, icon-button-theme;
9494
@forward './button-toggle/button-toggle-theme' as button-toggle-* show button-toggle-theme,

src/material/button/_fab-theme.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,22 @@
55

66
@use './button-theme-private';
77
@use '../core/mdc-helpers/mdc-helpers';
8+
@use '../core/style/sass-utils';
89
@use '../core/theming/theming';
910
@use '../core/tokens/m2/mdc/fab' as tokens-mdc-fab;
1011
@use '../core/tokens/m2/mdc/extended-fab' as tokens-mdc-extended-fab;
1112
@use '../core/typography/typography';
1213

14+
@mixin base($config-or-theme) {
15+
// Add default values for tokens not related to color, typography, or density.
16+
@include sass-utils.current-selector-or-root() {
17+
@include mdc-fab-theme.theme(tokens-mdc-fab.get-unthemable-tokens());
18+
@include mdc-extended-fab-theme.theme(
19+
tokens-mdc-extended-fab.get-unthemable-tokens()
20+
);
21+
}
22+
}
23+
1324
@mixin _fab-variant($config, $foreground, $background) {
1425
$color-config: map.merge(
1526
$config,
@@ -105,6 +116,7 @@
105116
$density: theming.get-density-config($theme);
106117
$typography: theming.get-typography-config($theme);
107118

119+
@include base($theme);
108120
@if $color != null {
109121
@include color($color);
110122
}

src/material/button/fab.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,11 @@
2222
.mat-mdc-fab, .mat-mdc-mini-fab {
2323
// Add the official slots for the MDC fab.
2424
@include mdc-fab-theme.theme-styles($mdc-fab-token-slots);
25-
26-
// Add default values for tokens that aren't outputted by the theming API.
27-
@include mdc-fab-theme.theme(m2-mdc-fab.get-unthemable-tokens());
2825
}
2926

3027
.mat-mdc-extended-fab {
3128
// Add the official slots for the MDC fab.
3229
@include mdc-extended-fab-theme.theme-styles($mdc-extended-fab-token-slots);
33-
34-
// Add default values for tokens that aren't outputted by the theming API.
35-
@include mdc-extended-fab-theme.theme(m2-mdc-extended-fab.get-unthemable-tokens());
3630
}
3731
}
3832

0 commit comments

Comments
 (0)