Skip to content

Commit 7738c47

Browse files
committed
fix(material/button): Move unthemable icon button tokens to theme mixin
1 parent b13c6aa commit 7738c47

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/material/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
@forward './button/fab-theme' as fab-* show fab-color, fab-typography,
9191
fab-density, fab-theme;
9292
@forward './button/icon-button-theme' as icon-button-* show icon-button-color,
93-
icon-button-typography, icon-button-density, icon-button-theme;
93+
icon-button-typography, icon-button-density, icon-button-theme, icon-button-base;
9494
@forward './button-toggle/button-toggle-theme' as button-toggle-* show button-toggle-theme,
9595
button-toggle-color, button-toggle-typography, button-toggle-density;
9696
@forward './card/card-theme' as card-* show card-theme, card-color, card-typography, card-density;

src/material/button/_icon-button-theme.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@
33
@use '@material/density/functions' as mdc-density-functions;
44
@use '@material/icon-button/icon-button-theme' as mdc-icon-button-theme;
55
@use '@material/theme/theme-color' as mdc-theme-color;
6+
@use '../core/style/sass-utils';
67
@use '../core/tokens/m2/mdc/icon-button' as tokens-mdc-icon-button;
78

89
@use './button-theme-private';
910
@use '../core/theming/theming';
1011

1112
$_icon-size: 24px;
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-icon-button-theme.theme(tokens-mdc-icon-button.get-unthemable-tokens());
18+
}
19+
}
20+
1321
@mixin _ripple-color($color) {
1422
--mat-mdc-button-persistent-ripple-color: #{$color};
1523
--mat-mdc-button-ripple-color: #{rgba($color, 0.1)};
@@ -111,6 +119,7 @@ $_icon-size: 24px;
111119
$density: theming.get-density-config($theme);
112120
$typography: theming.get-typography-config($theme);
113121

122+
@include base($theme);
114123
@if $color != null {
115124
@include color($color);
116125
}

src/material/button/icon-button.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
.mat-mdc-icon-button {
1818
// Add the official slots for the MDC component.
1919
@include mdc-icon-button-theme.theme-styles($token-slots);
20-
21-
// Add default values for tokens that aren't outputted by the theming API.
22-
@include mdc-icon-button-theme.theme(m2-mdc-icon-button.get-unthemable-tokens());
2320
}
2421
}
2522

0 commit comments

Comments
 (0)