|
1 | 1 | @use 'sass:map';
|
2 | 2 | @use 'sass:math';
|
3 |
| -@use '@material/density/functions' as mdc-density-functions; |
4 |
| -@use '@material/icon-button/icon-button-theme' as mdc-icon-button-theme; |
5 | 3 | @use '../core/tokens/m2/mdc/icon-button' as tokens-mdc-icon-button;
|
6 | 4 | @use '../core/tokens/m2/mat/icon-button' as tokens-mat-icon-button;
|
7 | 5 | @use '../core/style/sass-utils';
|
|
18 | 16 | @else {
|
19 | 17 | // Add default values for tokens not related to color, typography, or density.
|
20 | 18 | @include sass-utils.current-selector-or-root() {
|
21 |
| - @include mdc-icon-button-theme.theme(tokens-mdc-icon-button.get-unthemable-tokens()); |
| 19 | + @include token-utils.create-token-values(tokens-mdc-icon-button.$prefix, |
| 20 | + tokens-mdc-icon-button.get-unthemable-tokens()); |
22 | 21 | }
|
23 | 22 | }
|
24 | 23 | }
|
|
34 | 33 | tokens-mat-icon-button.get-color-tokens($theme)
|
35 | 34 | );
|
36 | 35 |
|
37 |
| - @include mdc-icon-button-theme.theme($mdc-tokens); |
| 36 | + @include token-utils.create-token-values(tokens-mdc-icon-button.$prefix, $mdc-tokens); |
38 | 37 | @include token-utils.create-token-values(tokens-mat-icon-button.$prefix, $mat-tokens);
|
39 | 38 | }
|
40 | 39 |
|
|
82 | 81 | @else {
|
83 | 82 | $icon-size: 24px;
|
84 | 83 | $density-scale: inspection.get-theme-density($theme);
|
85 |
| - // Manually apply the expected density theming, and include the padding |
86 |
| - // as it was applied before |
87 |
| - $calculated-size: mdc-density-functions.prop-value( |
88 |
| - $density-config: ( |
89 |
| - size: ( |
90 |
| - default: 48px, |
91 |
| - maximum: 48px, |
92 |
| - minimum: 28px, |
93 |
| - ), |
94 |
| - ), |
95 |
| - $density-scale: $density-scale, |
96 |
| - $property-name: size, |
| 84 | + $size-map: ( |
| 85 | + 0: 48px, |
| 86 | + -1: 44px, |
| 87 | + -2: 40px, |
| 88 | + -3: 36px, |
| 89 | + -4: 32px, |
| 90 | + -5: 28px, |
97 | 91 | );
|
| 92 | + $calculated-size: map.get($size-map, $density-scale); |
98 | 93 |
|
99 | 94 | @include sass-utils.current-selector-or-root() {
|
100 | 95 | @include token-utils.create-token-values(tokens-mat-icon-button.$prefix,
|
|
105 | 100 | .mat-mdc-icon-button.mat-mdc-button-base {
|
106 | 101 | // Match the styles that used to be present. This is necessary for backwards
|
107 | 102 | // compat to match the previous implementations selector count (two classes).
|
108 |
| - @include mdc-icon-button-theme.theme(( |
109 |
| - state-layer-size: $calculated-size, |
110 |
| - )); |
| 103 | + --mdc-icon-button-state-layer-size: #{$calculated-size}; |
111 | 104 |
|
112 | 105 | // TODO: Switch calculated-size to "var(--mdc-icon-button-state-layer-size)"
|
113 | 106 | // Currently fails validation because the variable is "undefined"
|
|
153 | 146 | @include validation.selector-defined(
|
154 | 147 | 'Calls to Angular Material theme mixins with an M3 theme must be wrapped in a selector');
|
155 | 148 | @if ($tokens != ()) {
|
156 |
| - @include mdc-icon-button-theme.theme(map.get($tokens, tokens-mdc-icon-button.$prefix)); |
| 149 | + @include token-utils.create-token-values( |
| 150 | + tokens-mdc-icon-button.$prefix, map.get($tokens, tokens-mdc-icon-button.$prefix)); |
157 | 151 | @include token-utils.create-token-values(
|
158 | 152 | tokens-mat-icon-button.$prefix, map.get($tokens, tokens-mat-icon-button.$prefix));
|
159 | 153 | }
|
|
0 commit comments