Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(material/tabs): move unthemable tokens to theme mixin #27891

Merged
merged 1 commit into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/material/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ menu-base;
stepper-typography, stepper-density, stepper-base;
@forward './table/table-theme' as table-* show table-theme, table-color, table-typography,
table-density, table-base;
@forward './tabs/tabs-theme' as tabs-* show tabs-theme, tabs-color, tabs-typography, tabs-density;
@forward './tabs/tabs-theme' as tabs-* show tabs-theme, tabs-color, tabs-typography, tabs-density,
tabs-base;
@forward './toolbar/toolbar-theme' as toolbar-* show toolbar-theme, toolbar-color,
toolbar-typography, toolbar-density, toolbar-base;
@forward './tooltip/tooltip-theme' as tooltip-* show tooltip-theme, tooltip-color,
Expand Down
10 changes: 0 additions & 10 deletions src/material/tabs/_tabs-common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,6 @@ $mat-tab-animation-duration: 500ms !default;
overflow: hidden;
position: relative;
flex-shrink: 0;

@include mdc-tab-indicator-theme.theme(tokens-mdc-tab-indicator.get-unthemable-tokens());
@include mdc-tab-theme.secondary-navigation-tab-theme(tokens-mdc-tab.get-unthemable-tokens());
@include token-utils.create-token-values(
tokens-mat-tab-header.$prefix, tokens-mat-tab-header.get-unthemable-tokens());
}

.mdc-tab-indicator .mdc-tab-indicator__content {
Expand Down Expand Up @@ -352,11 +347,6 @@ $mat-tab-animation-duration: 500ms !default;

@mixin paginated-tab-header-with-background($header-selector, $tab-selector) {
&.mat-tabs-with-background {
@include token-utils.create-token-values(
tokens-mat-tab-header-with-background.$prefix,
tokens-mat-tab-header-with-background.get-unthemable-tokens()
);

@include token-utils.use-tokens(
tokens-mat-tab-header-with-background.$prefix,
tokens-mat-tab-header-with-background.get-token-slots()
Expand Down
15 changes: 15 additions & 0 deletions src/material/tabs/_tabs-theme.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@use '@material/tab-indicator/tab-indicator-theme' as mdc-tab-indicator-theme;
@use '@material/tab/tab-theme' as mdc-tab-theme;
@use '../core/style/sass-utils';
@use '../core/tokens/m2/mdc/tab' as tokens-mdc-tab;
@use '../core/tokens/m2/mdc/tab-indicator' as tokens-mdc-tab-indicator;
@use '../core/tokens/m2/mat/tab-header' as tokens-mat-tab-header;
Expand All @@ -9,6 +10,19 @@
@use '../core/typography/typography';
@use '../core/tokens/token-utils';

@mixin base($theme) {
@include sass-utils.current-selector-or-root() {
@include mdc-tab-indicator-theme.theme(tokens-mdc-tab-indicator.get-unthemable-tokens());
@include mdc-tab-theme.secondary-navigation-tab-theme(tokens-mdc-tab.get-unthemable-tokens());
@include token-utils.create-token-values(
tokens-mat-tab-header.$prefix, tokens-mat-tab-header.get-unthemable-tokens());
@include token-utils.create-token-values(
tokens-mat-tab-header-with-background.$prefix,
tokens-mat-tab-header-with-background.get-unthemable-tokens()
);
}
}

@mixin color($theme) {
.mat-mdc-tab-group, .mat-mdc-tab-nav-bar {
@include _palette-styles($theme, primary);
Expand Down Expand Up @@ -77,6 +91,7 @@

@mixin theme($theme) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-tabs') {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
Expand Down