Skip to content

Commit

Permalink
fix(material/tooltip): Move unthemable tokens to theme mixin (#27569)
Browse files Browse the repository at this point in the history
Though these tokens are not currently affected by the theme, in the future they will be affected by the design system used for theming (M2 or M3)

BREAKING CHANGE:
There are new styles emitted by mat.tooltip-theme that are not
emitted by any of: mat.tooltip-color, mat.tooltip-typography,
mat.tooltip-density. If you rely on the partial mixins only and don't
call mat.tooltip-theme, you can add mat.tooltip-base to get the
missing styles.
  • Loading branch information
amysorto authored Aug 4, 2023
1 parent 0474040 commit ccd2d7f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/material/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ legacy-tabs-typography;
@forward './legacy-tooltip/tooltip-theme' as legacy-tooltip-* show legacy-tooltip-theme,
legacy-tooltip-color, legacy-tooltip-typography;
@forward './tooltip/tooltip-theme' as tooltip-* show tooltip-theme, tooltip-color,
tooltip-typography, tooltip-density;
tooltip-typography, tooltip-density, tooltip-base;
@forward './tree/tree-theme' as tree-* show tree-theme, tree-color, tree-typography, tree-density;

// MDC Helpers
Expand Down
9 changes: 9 additions & 0 deletions src/material/tooltip/_tooltip-theme.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
@use '@material/tooltip/plain-tooltip-theme' as mdc-plain-tooltip-theme;
@use '../core/style/sass-utils';
@use '../core/theming/theming';
@use '../core/typography/typography';
@use '../core/tokens/m2/mdc/plain-tooltip' as m2-mdc-plain-tooltip;

@mixin base($config-or-theme) {
// Add default values for tokens not related to color, typography, or density.
@include sass-utils.current-selector-or-root() {
@include mdc-plain-tooltip-theme.theme(m2-mdc-plain-tooltip.get-unthemable-tokens());
}
}

@mixin color($config-or-theme) {
$config: theming.get-color-config($config-or-theme);
$mdc-tooltip-color-tokens: m2-mdc-plain-tooltip.get-color-tokens($config);
Expand Down Expand Up @@ -41,6 +49,7 @@
$density: theming.get-density-config($theme);
$typography: theming.get-typography-config($theme);

@include base($theme);
@if $color != null {
@include color($color);
}
Expand Down
3 changes: 0 additions & 3 deletions src/material/tooltip/tooltip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ $emit-fallback-vars: false) {
.mat-mdc-tooltip {
// Add the official slots for the MDC tooltip.
@include mdc-plain-tooltip-theme.theme-styles($mdc-tooltip-token-slots);

// Add default values for MDC tooltip tokens that aren't outputted by the theming API.
@include mdc-plain-tooltip-theme.theme(m2-mdc-plain-tooltip.get-unthemable-tokens());
}
}

Expand Down

0 comments on commit ccd2d7f

Please sign in to comment.