|
4 | 4 | @use '@material/tab-indicator' as mdc-tab-indicator;
|
5 | 5 | @use '@material/tab-indicator/tab-indicator-theme' as mdc-tab-indicator-theme;
|
6 | 6 | @use '@material/tab' as mdc-tab;
|
7 |
| -@use '@material/tab/tab-theme' as mdc-tab-theme; |
| 7 | +@use '@material/tab/mixins' as mdc-tab-mixins; |
8 | 8 | @use '@material/tab-bar' as mdc-tab-bar;
|
9 | 9 | @use '../mdc-helpers/mdc-helpers';
|
10 | 10 | @use '../../material/core/typography/typography';
|
|
18 | 18 |
|
19 | 19 | @include mdc-helpers.mat-using-mdc-theme($config) {
|
20 | 20 | .mat-mdc-tab, .mat-mdc-tab-link {
|
21 |
| - $surface: mdc-theme-color.$surface; |
22 |
| - $on-surface: rgba(mdc-theme-color.$on-surface, 0.6); |
23 |
| - |
24 |
| - // TODO(crisbeto): these styles should actually be set through the `theme` mixin while the |
25 |
| - // `theme-styles` are included in the `tab` mixin inside `_tabs-common.scss`. Currently |
26 |
| - // they are not, because `theme-styles` outputs the token values directly, rather than |
27 |
| - // generating CSS variables. |
28 |
| - @include mdc-tab-theme.primary-navigation-tab-theme-styles(map.merge( |
29 |
| - mdc-tab-theme.$primary-light-theme, |
30 |
| - ( |
31 |
| - container-color: $surface, |
32 |
| - inactive-focus-state-layer-color: $on-surface, |
33 |
| - inactive-hover-state-layer-color: $on-surface, |
34 |
| - inactive-pressed-state-layer-color: $on-surface, |
35 |
| - with-icon-inactive-focus-icon-color: $on-surface, |
36 |
| - with-icon-inactive-hover-icon-color: $on-surface, |
37 |
| - with-icon-inactive-icon-color: $on-surface, |
38 |
| - with-icon-inactive-pressed-icon-color: $on-surface, |
39 |
| - with-label-text-inactive-focus-label-text-color: $on-surface, |
40 |
| - with-label-text-inactive-hover-label-text-color: $on-surface, |
41 |
| - with-label-text-inactive-label-text-color: $on-surface, |
42 |
| - with-label-text-inactive-pressed-label-text-color: $on-surface, |
43 |
| - |
44 |
| - // TODO(crisbeto): MDC's styles are set up so that the icon size is set through a |
45 |
| - // `font-size` at the root of the tab while the text size of the tab is set on |
46 |
| - // `.mdc-tab__text-label` which overrides the one from the root. The problem is that |
47 |
| - // the `$light-theme` is looking for a `subhead2` level which doesn't exist in MDC's |
48 |
| - // code which in turn causes no text label styles to be emitted and for the icon size |
49 |
| - // to be applied to the entire tab. Since we don't support icons inside the tab |
50 |
| - // anyway, we can temporarily work around it by preventing MDC from emitting icon |
51 |
| - // styles. The correct label typography will be applied by our theme instead. |
52 |
| - with-icon-icon-size: null |
53 |
| - ))); |
| 21 | + &:not(.mat-mdc-tab-disabled) { |
| 22 | + @include mdc-tab-mixins.text-label-color(rgba(mdc-theme-color.$on-surface, 0.6)); |
| 23 | + } |
54 | 24 |
|
55 | 25 | // MDC seems to include a background color on tabs which only stands out on dark themes.
|
56 | 26 | // Disable for now for backwards compatibility. These styles are inside the theme in order
|
|
125 | 95 |
|
126 | 96 | @mixin _palette-styles($color) {
|
127 | 97 | .mat-mdc-tab, .mat-mdc-tab-link {
|
128 |
| - // TODO(crisbeto): these styles should actually be set through the `theme` mixin while the |
129 |
| - // `theme-styles` are included in the `tab` mixin inside `_tabs-common.scss`. Currently |
130 |
| - // they are not, because `theme-styles` outputs the token values directly, rather than |
131 |
| - // generating CSS variables. |
132 |
| - @include mdc-tab-theme.primary-navigation-tab-theme-styles(( |
133 |
| - active-focus-state-layer-color: $color, |
134 |
| - active-hover-state-layer-color: $color, |
135 |
| - active-pressed-state-layer-color: $color, |
136 |
| - with-icon-active-focus-icon-color: $color, |
137 |
| - with-icon-active-hover-icon-color: $color, |
138 |
| - with-icon-active-icon-color: $color, |
139 |
| - with-icon-active-pressed-icon-color: $color, |
140 |
| - with-label-text-active-focus-label-text-color: $color, |
141 |
| - with-label-text-active-hover-label-text-color: $color, |
142 |
| - with-label-text-active-label-text-color: $color, |
143 |
| - with-label-text-active-pressed-label-text-color: $color, |
144 |
| - )); |
145 |
| - |
146 |
| - @include mdc-tab-indicator-theme.theme-styles(( |
147 |
| - active-indicator-color: $color |
148 |
| - )); |
| 98 | + &:not(.mat-mdc-tab-disabled) { |
| 99 | + @include mdc-tab-mixins.active-text-label-color($color); |
| 100 | + @include mdc-tab-indicator-theme.theme-styles((active-indicator-color: $color)); |
| 101 | + } |
149 | 102 | }
|
150 | 103 |
|
151 | 104 | .mdc-tab__ripple::before,
|
|
0 commit comments