diff --git a/src/material/button/_icon-button-theme.scss b/src/material/button/_icon-button-theme.scss index 4803070d0b18..65ac247b13df 100644 --- a/src/material/button/_icon-button-theme.scss +++ b/src/material/button/_icon-button-theme.scss @@ -1,5 +1,4 @@ @use 'sass:map'; -@use 'sass:math'; @use './m2-icon-button'; @use './m3-icon-button'; @use '../core/tokens/token-utils'; @@ -67,43 +66,12 @@ } @mixin density($theme) { + $tokens: m2-icon-button.get-density-tokens($theme); @if inspection.get-theme-version($theme) == 1 { - @include token-utils.values(map.get(m3-icon-button.get-tokens($theme), density)); - } @else { - $icon-size: 24px; - $density-scale: inspection.get-theme-density($theme); - $size-map: ( - 0: 48px, - -1: 44px, - -2: 40px, - -3: 36px, - -4: 32px, - -5: 28px, - ); - $calculated-size: map.get($size-map, $density-scale); - - @include token-utils.values( - m2-icon-button.get-density-tokens( - $theme, $exclude: (icon-button-state-layer-size)) - ); - - // Use `mat-mdc-button-base` to increase the specificity over the button's structural styles. - .mat-mdc-icon-button.mat-mdc-button-base { - // Match the styles that used to be present. This is necessary for backwards - // compat to match the previous implementations selector count (two classes). - --mdc-icon-button-state-layer-size: #{$calculated-size}; - --mat-icon-button-state-layer-size: #{$calculated-size}; - - // TODO: Switch calculated-size to "var(--mat-icon-button-state-layer-size)" - // Currently fails validation because the variable is "undefined" - // in the sass stack. - // TODO: Switch icon-size to "var(--mat-icon-button-icon-size)". Currently - // fails validation because the variable is "undefined" in the sass stack. - width: var(--mat-icon-button-state-layer-size); - height: var(--mat-icon-button-state-layer-size); - padding: math.div($calculated-size - $icon-size, 2); - } + $tokens: map.get(m3-icon-button.get-tokens($theme), density); } + + @include token-utils.values($tokens); } /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.