|
67 | 67 | } |
68 | 68 |
|
69 | 69 | @mixin density($theme) { |
| 70 | + $tokens: m2-icon-button.get-density-tokens($theme); |
70 | 71 | @if inspection.get-theme-version($theme) == 1 { |
71 | | - @include token-utils.values(map.get(m3-icon-button.get-tokens($theme), density)); |
72 | | - } @else { |
73 | | - $icon-size: 24px; |
74 | | - $density-scale: inspection.get-theme-density($theme); |
75 | | - $size-map: ( |
76 | | - 0: 48px, |
77 | | - -1: 44px, |
78 | | - -2: 40px, |
79 | | - -3: 36px, |
80 | | - -4: 32px, |
81 | | - -5: 28px, |
82 | | - ); |
83 | | - $calculated-size: map.get($size-map, $density-scale); |
84 | | - |
85 | | - @include token-utils.values( |
86 | | - m2-icon-button.get-density-tokens( |
87 | | - $theme, $exclude: (icon-button-state-layer-size)) |
88 | | - ); |
89 | | - |
90 | | - // Use `mat-mdc-button-base` to increase the specificity over the button's structural styles. |
91 | | - .mat-mdc-icon-button.mat-mdc-button-base { |
92 | | - // Match the styles that used to be present. This is necessary for backwards |
93 | | - // compat to match the previous implementations selector count (two classes). |
94 | | - --mdc-icon-button-state-layer-size: #{$calculated-size}; |
95 | | - --mat-icon-button-state-layer-size: #{$calculated-size}; |
96 | | - |
97 | | - // TODO: Switch calculated-size to "var(--mat-icon-button-state-layer-size)" |
98 | | - // Currently fails validation because the variable is "undefined" |
99 | | - // in the sass stack. |
100 | | - // TODO: Switch icon-size to "var(--mat-icon-button-icon-size)". Currently |
101 | | - // fails validation because the variable is "undefined" in the sass stack. |
102 | | - width: var(--mat-icon-button-state-layer-size); |
103 | | - height: var(--mat-icon-button-state-layer-size); |
104 | | - padding: math.div($calculated-size - $icon-size, 2); |
105 | | - } |
| 72 | + $tokens: map.get(m3-icon-button.get-tokens($theme), density); |
106 | 73 | } |
| 74 | + |
| 75 | + @include token-utils.values($tokens); |
107 | 76 | } |
108 | 77 |
|
109 | 78 | /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction. |
|
0 commit comments