|
4 | 4 | @use '../core/mdc-helpers/mdc-helpers';
|
5 | 5 | @use '../core/style/layout-common';
|
6 | 6 | @use '../core/focus-indicators/private' as focus-indicators-private;
|
7 |
| -@use '../core/tokens/m2/mdc/chip' as m2-mdc-chip; |
| 7 | +@use '../core/tokens/m2/mdc/chip' as tokens-mdc-chip; |
| 8 | +@use '../core/tokens/m2/mat/chip' as tokens-mat-chip; |
8 | 9 | @use '../core/tokens/token-utils';
|
9 | 10 | @use '@material/theme/custom-properties' as mdc-custom-properties;
|
10 | 11 |
|
11 | 12 | // The slots for tokens that will be configured in the theme can be emitted with no fallback.
|
12 | 13 | @include mdc-custom-properties.configure($emit-fallback-values: false, $emit-fallback-vars: false) {
|
13 |
| - $token-slots: m2-mdc-chip.get-token-slots(); |
| 14 | + $mdc-chip-token-slots: tokens-mdc-chip.get-token-slots(); |
| 15 | + $mat-chip-token-slots: tokens-mat-chip.get-token-slots(); |
14 | 16 |
|
15 | 17 | // Add the MDC chip static styles.
|
16 | 18 | @include mdc-chip.static-styles();
|
17 | 19 |
|
18 | 20 | .mat-mdc-standard-chip {
|
19 | 21 | // Add the official slots for the MDC chip.
|
20 |
| - @include mdc-chip-theme.theme-styles($token-slots); |
| 22 | + @include mdc-chip-theme.theme-styles($mdc-chip-token-slots); |
21 | 23 | }
|
22 | 24 |
|
23 | 25 | // Add additional slots for the MDC chip tokens, needed in Angular Material.
|
24 |
| - @include token-utils.use-tokens(m2-mdc-chip.$prefix, $token-slots) { |
| 26 | + @include token-utils.use-tokens(tokens-mdc-chip.$prefix, $mdc-chip-token-slots) { |
25 | 27 | .mat-mdc-chip-focus-overlay {
|
26 | 28 | @include token-utils.create-token-slot(background, focus-state-layer-color);
|
27 | 29 | @include token-utils.create-token-slot(opacity, focus-state-layer-opacity);
|
28 | 30 | }
|
29 | 31 | }
|
| 32 | + |
| 33 | + @include token-utils.use-tokens(tokens-mat-chip.$prefix, $mat-chip-token-slots) { |
| 34 | + // Historically, MDC did not support disabled chips, so we needed our own disabled styles. |
| 35 | + // Now that MDC supports disabled styles, we should switch to using theirs. |
| 36 | + .mat-mdc-standard-chip.mdc-evolution-chip--disabled { |
| 37 | + @include token-utils.create-token-slot(opacity, disabled-container-opacity); |
| 38 | + } |
| 39 | + } |
30 | 40 | }
|
31 | 41 |
|
32 | 42 | // We *should* be able to include these styles through MDC's
|
33 | 43 | // `theme-styles` mixin, but we can't at the time of writing.
|
34 | 44 | @mixin _missing-mdc-theme-styles() {
|
35 | 45 | .mat-mdc-standard-chip {
|
| 46 | + @include mdc-chip-theme.outline-style(solid); |
36 | 47 | @include mdc-chip-theme.checkmark-size(mdc-chip-theme.$checkmark-size);
|
37 | 48 | @include mdc-chip-theme.trailing-action-size(mdc-chip-theme.$trailing-action-size);
|
38 | 49 | @include mdc-chip-theme.horizontal-padding(
|
|
98 | 109 | }
|
99 | 110 | }
|
100 | 111 |
|
101 |
| - // Angular Material supports disabled chips, which MDC does not. |
102 |
| - // Dim the disabled chips and stop MDC from changing the icon color on click. |
103 |
| - &.mdc-evolution-chip--disabled { |
104 |
| - opacity: 0.4; |
105 |
| - } |
106 |
| - |
107 | 112 | // MDC sets `overflow: hidden` on these elements in order to truncate the text. This is
|
108 | 113 | // unnecessary since our chips don't truncate their text and it makes it difficult to style
|
109 | 114 | // the strong focus indicators so we need to override it.
|
|
0 commit comments