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/table): move unthemable tokens to theme mixin #27890

Merged
merged 1 commit into from
Oct 5, 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
2 changes: 1 addition & 1 deletion src/material/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ list-density, list-base;
@forward './stepper/stepper-theme' as stepper-* show stepper-theme, stepper-color,
stepper-typography, stepper-density;
@forward './table/table-theme' as table-* show table-theme, table-color, table-typography,
table-density;
table-density, table-base;
@forward './tabs/tabs-theme' as tabs-* show tabs-theme, tabs-color, tabs-typography, tabs-density;
@forward './toolbar/toolbar-theme' as toolbar-* show toolbar-theme, toolbar-color,
toolbar-typography, toolbar-density;
Expand Down
20 changes: 9 additions & 11 deletions src/material/table/_table-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,39 @@
@use '../core/theming/inspection';
@use '../core/typography/typography';
@use '../core/tokens/token-utils';
@use '../core/style/sass-utils';

@mixin _output-tokens {
@if (&) {
@content;
}
@else {
html {
@content;
}
@mixin base($theme) {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values(
tokens-mat-table.$prefix, tokens-mat-table.get-unthemable-tokens());
}
}

@mixin color($theme) {
@include _output-tokens {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values(tokens-mat-table.$prefix,
tokens-mat-table.get-color-tokens($theme));
}
}

@mixin typography($theme) {
@include _output-tokens {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values(tokens-mat-table.$prefix,
tokens-mat-table.get-typography-tokens($theme));
}
}

@mixin density($theme) {
@include _output-tokens {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values(tokens-mat-table.$prefix,
tokens-mat-table.get-density-tokens($theme));
}
}

@mixin theme($theme) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-table') {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
Expand Down
3 changes: 0 additions & 3 deletions src/material/table/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
@include table-flex-styles.private-table-flex-styles();

.mat-mdc-table {
@include token-utils.create-token-values(
tokens-mat-table.$prefix, tokens-mat-table.get-unthemable-tokens());

// MDC Table applies `table-layout: fixed`, but this is a backwards incompatible
// change since the table did not previously apply it.
// TODO: Add a mixin to MDC to set the layout instead of including this override,
Expand Down
Loading