|
6 | 6 | @use '../core/tokens/m2/mdc/icon-button' as tokens-mdc-icon-button;
|
7 | 7 |
|
8 | 8 | @use './button-theme-private';
|
9 |
| -@use '../core/mdc-helpers/mdc-helpers'; |
10 | 9 | @use '../core/theming/theming';
|
11 |
| -@use '../core/typography/typography'; |
| 10 | + |
| 11 | +$_icon-size: 24px; |
12 | 12 |
|
13 | 13 | @mixin _ripple-color($color) {
|
14 | 14 | --mat-mdc-button-persistent-ripple-color: #{$color};
|
|
23 | 23 | @return if($is-dark, 'light', 'dark');
|
24 | 24 | }
|
25 | 25 |
|
26 |
| - |
27 | 26 | @mixin color($config-or-theme) {
|
28 | 27 | $config: theming.get-color-config($config-or-theme);
|
29 | 28 | $color-tokens: tokens-mdc-icon-button.get-color-tokens($config);
|
|
66 | 65 | }
|
67 | 66 |
|
68 | 67 | @mixin typography($config-or-theme) {
|
69 |
| - $config: typography.private-typography-to-2018-config( |
70 |
| - theming.get-typography-config($config-or-theme)); |
71 |
| - @include mdc-helpers.using-mdc-typography($config) { |
72 |
| - @include mdc-icon-button.without-ripple($query: mdc-helpers.$mdc-typography-styles-query); |
73 |
| - } |
74 | 68 | }
|
75 | 69 |
|
76 | 70 | @mixin density($config-or-theme) {
|
77 | 71 | $density-scale: theming.get-density-config($config-or-theme);
|
78 |
| - |
79 |
| - .mat-mdc-icon-button { |
80 |
| - // Manually apply the expected density theming, and include the padding |
81 |
| - // as it was applied before |
82 |
| - $calculated-size: mdc-density-functions.prop-value( |
83 |
| - $density-config: ( |
84 |
| - size: ( |
85 |
| - default: 48px, |
86 |
| - maximum: 48px, |
87 |
| - minimum: 28px, |
88 |
| - ), |
| 72 | + // Manually apply the expected density theming, and include the padding |
| 73 | + // as it was applied before |
| 74 | + $calculated-size: mdc-density-functions.prop-value( |
| 75 | + $density-config: ( |
| 76 | + size: ( |
| 77 | + default: 48px, |
| 78 | + maximum: 48px, |
| 79 | + minimum: 28px, |
89 | 80 | ),
|
90 |
| - $density-scale: $density-scale, |
91 |
| - $property-name: size, |
92 |
| - ); |
| 81 | + ), |
| 82 | + $density-scale: $density-scale, |
| 83 | + $property-name: size, |
| 84 | + ); |
93 | 85 |
|
| 86 | + .mat-mdc-icon-button { |
94 | 87 | @include mdc-icon-button-theme.theme((
|
95 | 88 | state-layer-size: $calculated-size,
|
96 | 89 | ));
|
97 | 90 | }
|
| 91 | + |
| 92 | + // Use `mat-mdc-button-base` to increase the specificity over the button's structural styles. |
| 93 | + .mat-mdc-icon-button.mat-mdc-button-base { |
| 94 | + // Match the styles that used to be present. This is necessary for backwards |
| 95 | + // compat to match the previous implementations selector count (two classes). |
| 96 | + // TODO: Switch calculated-size to "var(--mdc-icon-button-state-layer-size)" |
| 97 | + // Currently fails validation because the variable is "undefined" |
| 98 | + // in the sass stack. |
| 99 | + // TODO: Switch icon-size to "var(--mdc-icon-button-icon-size)". Currently |
| 100 | + // fails validation because the variable is "undefined" in the sass stack. |
| 101 | + width: var(--mdc-icon-button-state-layer-size); |
| 102 | + height: var(--mdc-icon-button-state-layer-size); |
| 103 | + padding: ($calculated-size - $_icon-size) / 2; |
| 104 | + |
| 105 | + @include button-theme-private.touch-target-density($density-scale); |
| 106 | + } |
98 | 107 | }
|
99 | 108 |
|
100 | 109 | @mixin theme($theme-or-color-config) {
|
|
0 commit comments