Skip to content

Commit 192588d

Browse files
authored
refactor(multiple): Add base mixin for components with no base tokens (#27893)
This ensures API consistency and gives us a place to put base tokens, should any be added in the future.
1 parent 1a86f21 commit 192588d

File tree

13 files changed

+48
-12
lines changed

13 files changed

+48
-12
lines changed

src/material/_index.scss

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,19 @@
5555
@forward './core/core-theme' as core-* show core-color, core-theme, core-typography, core-density;
5656
@forward './core/ripple/ripple-theme' as ripple-* show ripple-color, ripple-theme;
5757
@forward './core/option/option-theme' as option-* show option-color, option-typography,
58-
option-theme, option-density;
58+
option-theme, option-density, option-base;
5959
@forward './core/option/optgroup-theme' as optgroup-* show optgroup-color, optgroup-typography,
60-
optgroup-theme, optgroup-density;
60+
optgroup-theme, optgroup-density, optgroup-base;
6161
@forward './core/selection/pseudo-checkbox/pseudo-checkbox-theme' as pseudo-checkbox-* show
6262
pseudo-checkbox-color, pseudo-checkbox-typography, pseudo-checkbox-theme;
6363
@forward './core/selection/pseudo-checkbox/pseudo-checkbox-common' as pseudo-checkbox-* show
6464
pseudo-checkbox-legacy-size;
6565
@forward './core/focus-indicators/focus-indicators-theme' as strong-focus-indicators-* show
6666
strong-focus-indicators-color, strong-focus-indicators-theme;
6767
@forward './autocomplete/autocomplete-theme' as autocomplete-* show autocomplete-theme,
68-
autocomplete-color, autocomplete-typography, autocomplete-density;
68+
autocomplete-color, autocomplete-typography, autocomplete-density, autocomplete-base;
6969
@forward './badge/badge-theme' as badge-* show badge-theme, badge-color, badge-typography,
70-
badge-density;
70+
badge-density, badge-base;
7171
@forward './bottom-sheet/bottom-sheet-theme' as bottom-sheet-* show bottom-sheet-theme,
7272
bottom-sheet-color, bottom-sheet-typography, bottom-sheet-density;
7373
@forward './button/button-theme' as button-* show button-theme, button-color, button-typography,
@@ -85,7 +85,7 @@
8585
@forward './chips/chips-theme' as chips-* show chips-theme, chips-color, chips-typography,
8686
chips-density;
8787
@forward './datepicker/datepicker-theme' as datepicker-* show datepicker-theme, datepicker-color,
88-
datepicker-typography, datepicker-date-range-colors, datepicker-density;
88+
datepicker-typography, datepicker-date-range-colors, datepicker-density, datepicker-base;
8989
@forward './dialog/dialog-theme' as dialog-* show dialog-theme, dialog-color, dialog-typography,
9090
dialog-density, dialog-base;
9191
@forward './dialog/dialog-legacy-padding' as dialog-* show dialog-legacy-padding;
@@ -96,15 +96,16 @@
9696
@forward './form-field/form-field-theme' as form-field-* show form-field-theme,
9797
form-field-color, form-field-typography, form-field-density;
9898
@forward './grid-list/grid-list-theme' as grid-list-* show grid-list-theme, grid-list-color,
99-
grid-list-typography, grid-list-density;
100-
@forward './icon/icon-theme' as icon-* show icon-theme, icon-color, icon-typography, icon-density;
99+
grid-list-typography, grid-list-density, grid-list-base;
100+
@forward './icon/icon-theme' as icon-* show icon-theme, icon-color, icon-typography, icon-density,
101+
icon-base;
101102
@forward './input/input-theme' as input-* show input-theme, input-color, input-typography,
102-
input-density;
103+
input-density, input-base;
103104
@forward './list/list-theme' as list-* show list-theme, list-color, list-typography,
104105
list-density, list-base;
105106
@forward './menu/menu-theme' as menu-* show menu-theme, menu-color, menu-typography, menu-density;
106107
@forward './paginator/paginator-theme' as paginator-* show paginator-theme, paginator-color,
107-
paginator-typography, paginator-density;
108+
paginator-typography, paginator-density, paginator-base;
108109
@forward './progress-bar/progress-bar-theme' as progress-bar-* show
109110
progress-bar-theme, progress-bar-color, progress-bar-typography,
110111
progress-bar-density, progress-bar-base;
@@ -114,7 +115,7 @@ list-density, list-base;
114115
@forward './radio/radio-theme' as radio-* show radio-theme, radio-color, radio-typography,
115116
radio-density, radio-base;
116117
@forward './select/select-theme' as select-* show select-theme, select-color, select-typography,
117-
select-density;
118+
select-density, select-base;
118119
@forward './sidenav/sidenav-theme' as sidenav-* show sidenav-theme, sidenav-color,
119120
sidenav-typography, sidenav-density;
120121
@forward './slide-toggle/slide-toggle-theme' as slide-toggle-* show
@@ -125,12 +126,12 @@ list-density, list-base;
125126
snack-bar-typography, snack-bar-density, snack-bar-base;
126127
@forward './sort/sort-theme' as sort-* show sort-theme, sort-color, sort-typography, sort-density;
127128
@forward './stepper/stepper-theme' as stepper-* show stepper-theme, stepper-color,
128-
stepper-typography, stepper-density;
129+
stepper-typography, stepper-density, stepper-base;
129130
@forward './table/table-theme' as table-* show table-theme, table-color, table-typography,
130131
table-density;
131132
@forward './tabs/tabs-theme' as tabs-* show tabs-theme, tabs-color, tabs-typography, tabs-density;
132133
@forward './toolbar/toolbar-theme' as toolbar-* show toolbar-theme, toolbar-color,
133-
toolbar-typography, toolbar-density;
134+
toolbar-typography, toolbar-density, toolbar-base;
134135
@forward './tooltip/tooltip-theme' as tooltip-* show tooltip-theme, tooltip-color,
135136
tooltip-typography, tooltip-density, tooltip-base;
136137
@forward './tree/tree-theme' as tree-* show tree-theme, tree-color, tree-typography, tree-density;

src/material/autocomplete/_autocomplete-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
@use '../core/tokens/token-utils';
66
@use '../core/tokens/m2/mat/autocomplete' as tokens-mat-autocomplete;
77

8+
@mixin base($theme) {}
9+
810
@mixin color($theme) {
911
@include sass-utils.current-selector-or-root() {
1012
@include token-utils.create-token-values(tokens-mat-autocomplete.$prefix,
@@ -18,6 +20,7 @@
1820

1921
@mixin theme($theme) {
2022
@include theming.private-check-duplicate-theme-styles($theme, 'mat-autocomplete') {
23+
@include base($theme);
2124
@if inspection.theme-has($theme, color) {
2225
@include color($theme);
2326
}

src/material/badge/_badge-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ $_emit-fallback-vars: true;
164164
}
165165
}
166166

167+
@mixin base($theme) {}
168+
167169
@mixin color($theme) {
168170
@include sass-utils.current-selector-or-root() {
169171
@include token-utils.create-token-values(tokens-mat-badge.$prefix,
@@ -204,6 +206,7 @@ $_emit-fallback-vars: true;
204206
}
205207
}
206208

209+
@include base($theme);
207210
@if inspection.theme-has($theme, color) {
208211
@include color($theme);
209212
}

src/material/core/option/_optgroup-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
@use '../theming/inspection';
77
@use '../typography/typography';
88

9+
@mixin base($theme) {}
10+
911
@mixin color($theme) {
1012
@include sass-utils.current-selector-or-root() {
1113
@include token-utils.create-token-values(tokens-mat-optgroup.$prefix,
@@ -25,6 +27,7 @@
2527

2628
@mixin theme($theme) {
2729
@include theming.private-check-duplicate-theme-styles($theme, 'mat-optgroup') {
30+
@include base($theme);
2831
@if inspection.theme-has($theme, color) {
2932
@include color($theme);
3033
}

src/material/core/option/_option-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
@use '../theming/inspection';
77
@use '../typography/typography';
88

9+
@mixin base($theme) {}
10+
911
@mixin color($theme) {
1012
@include sass-utils.current-selector-or-root() {
1113
@include token-utils.create-token-values(tokens-mat-option.$prefix,
@@ -35,6 +37,7 @@
3537

3638
@mixin theme($theme) {
3739
@include theming.private-check-duplicate-theme-styles($theme, 'mat-option') {
40+
@include base($theme);
3841
@if inspection.theme-has($theme, color) {
3942
@include color($theme);
4043
}

src/material/datepicker/_datepicker-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ $calendar-weekday-table-font-size: 11px !default;
2727
map.merge($calendar-tokens, $range-tokens));
2828
}
2929

30+
@mixin base($theme) {}
31+
3032
@mixin color($theme) {
3133
@include sass-utils.current-selector-or-root() {
3234
@include token-utils.create-token-values(tokens-mat-datepicker.$prefix,
@@ -96,6 +98,7 @@ $calendar-weekday-table-font-size: 11px !default;
9698

9799
@mixin theme($theme) {
98100
@include theming.private-check-duplicate-theme-styles($theme, 'mat-datepicker') {
101+
@include base($theme);
99102
@if inspection.theme-has($theme, color) {
100103
@include color($theme);
101104
}

src/material/grid-list/_grid-list-theme.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@use '../core/style/sass-utils';
66
@use '../core/tokens/token-utils';
77

8+
@mixin base($theme) {}
89

910
// Include this empty mixin for consistency with the other components.
1011
@mixin color($theme) {}
@@ -20,6 +21,7 @@
2021

2122
@mixin theme($theme) {
2223
@include theming.private-check-duplicate-theme-styles($theme, 'mat-grid-list') {
24+
@include base($theme);
2325
@if inspection.theme-has($theme, color) {
2426
@include color($theme);
2527
}

src/material/icon/_icon-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
@include token-utils.create-token-values(tokens-mat-icon.$prefix, $tokens);
1111
}
1212

13+
@mixin base($theme) {}
14+
1315
@mixin color($theme) {
1416
@include sass-utils.current-selector-or-root() {
1517
@include token-utils.create-token-values(tokens-mat-icon.$prefix,
@@ -37,6 +39,7 @@
3739

3840
@mixin theme($theme) {
3941
@include theming.private-check-duplicate-theme-styles($theme, 'mat-icon') {
42+
@include base($theme);
4043
@if inspection.theme-has($theme, color) {
4144
@include color($theme);
4245
}

src/material/input/_input-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
@use '../core/theming/inspection';
33
@use '../core/typography/typography';
44

5+
@mixin base($theme) {}
6+
57
@mixin color($theme) {}
68

79
@mixin typography($theme) {}
@@ -10,6 +12,7 @@
1012

1113
@mixin theme($theme) {
1214
@include theming.private-check-duplicate-theme-styles($theme, 'mat-input') {
15+
@include base($theme);
1316
@if inspection.theme-has($theme, color) {
1417
@include color($theme);
1518
}

src/material/paginator/_paginator-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
@use '../core/tokens/token-utils';
88
@use '../form-field/form-field-density';
99

10+
@mixin base($theme) {}
11+
1012
@mixin color($theme) {
1113
@include sass-utils.current-selector-or-root() {
1214
@include token-utils.create-token-values(tokens-mat-paginator.$prefix,
@@ -45,6 +47,7 @@
4547

4648
@mixin theme($theme) {
4749
@include theming.private-check-duplicate-theme-styles($theme, 'mat-paginator') {
50+
@include base($theme);
4851
@if inspection.theme-has($theme, color) {
4952
@include color($theme);
5053
}

src/material/select/_select-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
@use '../core/theming/inspection';
99
@use '../core/typography/typography';
1010

11+
@mixin base($theme) {}
12+
1113
@mixin color($theme) {
1214
@include sass-utils.current-selector-or-root() {
1315
@include token-utils.create-token-values(tokens-mat-select.$prefix,
@@ -58,6 +60,7 @@
5860

5961
@mixin theme($theme) {
6062
@include theming.private-check-duplicate-theme-styles($theme, 'mat-select') {
63+
@include base($theme);
6164
@if inspection.theme-has($theme, color) {
6265
@include color($theme);
6366
}

src/material/stepper/_stepper-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
@use '../core/tokens/token-utils';
66
@use '../core/tokens/m2/mat/stepper' as tokens-mat-stepper;
77

8+
@mixin base($theme) {}
9+
810
@mixin color($theme) {
911
@include sass-utils.current-selector-or-root() {
1012
@include token-utils.create-token-values(tokens-mat-stepper.$prefix,
@@ -38,6 +40,7 @@
3840

3941
@mixin theme($theme) {
4042
@include theming.private-check-duplicate-theme-styles($theme, 'mat-stepper') {
43+
@include base($theme);
4144
@if inspection.theme-has($theme, color) {
4245
@include color($theme);
4346
}

src/material/toolbar/_toolbar-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
);
1717
}
1818

19+
@mixin base($theme) {}
20+
1921
@mixin color($theme) {
2022
@if inspection.get-theme-version($theme) == 1 {
2123
@include _theme-from-tokens(inspection.get-theme-tokens($theme, color));
@@ -75,6 +77,7 @@
7577
@include _theme-from-tokens(inspection.get-theme-tokens($theme));
7678
}
7779
@else {
80+
@include base($theme);
7881
@if inspection.theme-has($theme, color) {
7982
@include color($theme);
8083
}

0 commit comments

Comments
 (0)