|
5 | 5 | @use '../core/style/layout-common';
|
6 | 6 | @use '../core/focus-indicators/private' as focus-indicators-private;
|
7 | 7 |
|
8 |
| -@include mdc-chip.without-ripple-styles($query: mdc-helpers.$mdc-base-styles-query); |
| 8 | +// We *should* be able to include these styles through MDC's |
| 9 | +// `theme-styles` mixin, but we can't at the time of writing. |
| 10 | +@mixin _missing-mdc-theme-styles() { |
| 11 | + .mat-mdc-standard-chip { |
| 12 | + @include mdc-chip-theme.checkmark-size(mdc-chip-theme.$checkmark-size); |
| 13 | + @include mdc-chip-theme.trailing-action-size(mdc-chip-theme.$trailing-action-size); |
| 14 | + @include mdc-chip-theme.horizontal-padding( |
| 15 | + mdc-chip-theme.$leading-padding, |
| 16 | + mdc-chip-theme.$trailing-padding); |
| 17 | + @include mdc-chip-theme.with-graphic-horizontal-padding( |
| 18 | + mdc-chip-theme.$graphic-leading-padding, |
| 19 | + mdc-chip-theme.$graphic-trailing-padding, |
| 20 | + mdc-chip-theme.$trailing-padding); |
| 21 | + @include mdc-chip-theme.with-trailing-action-horizontal-padding( |
| 22 | + mdc-chip-theme.$leading-padding, |
| 23 | + mdc-chip-theme.$trailing-action-leading-padding, |
| 24 | + mdc-chip-theme.$trailing-action-trailing-padding); |
| 25 | + @include mdc-chip-theme.with-graphic-and-trailing-action-horizontal-padding( |
| 26 | + mdc-chip-theme.$graphic-leading-padding, |
| 27 | + mdc-chip-theme.$graphic-trailing-padding, |
| 28 | + mdc-chip-theme.$trailing-action-leading-padding, |
| 29 | + mdc-chip-theme.$trailing-action-trailing-padding); |
| 30 | + |
| 31 | + // MDC has some code looking for a `with-icon-selected-disabled-icon-color` token for this |
| 32 | + // color, but the token isn't defined in the theme map so the validation throws an error. |
| 33 | + // We don't change the color anyway so we can point it to the enable color instead. |
| 34 | + &.mdc-evolution-chip--disabled .mdc-evolution-chip__checkmark { |
| 35 | + color: var(--mdc-chip-with-icon-selected-icon-color, currentColor); |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | + .mdc-evolution-chip--with-avatar { |
| 40 | + @include mdc-chip-theme.with-graphic-horizontal-padding( |
| 41 | + mdc-chip-theme.$avatar-leading-padding, |
| 42 | + mdc-chip-theme.$avatar-trailing-padding, |
| 43 | + mdc-chip-theme.$trailing-padding |
| 44 | + ); |
| 45 | + @include mdc-chip-theme.with-graphic-and-trailing-action-horizontal-padding( |
| 46 | + mdc-chip-theme.$avatar-leading-padding, |
| 47 | + mdc-chip-theme.$avatar-trailing-padding, |
| 48 | + mdc-chip-theme.$trailing-action-leading-padding, |
| 49 | + mdc-chip-theme.$trailing-action-trailing-padding |
| 50 | + ); |
| 51 | + @include mdc-chip-theme.graphic-size(mdc-chip-theme.$avatar-size); |
| 52 | + @include mdc-chip-theme.icon-size(mdc-chip-theme.$avatar-size); |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +@include mdc-helpers.disable-mdc-fallback-declarations { |
| 57 | + @include mdc-chip.static-styles(); |
| 58 | + @include _missing-mdc-theme-styles(); |
| 59 | +} |
9 | 60 |
|
10 | 61 | .mat-mdc-standard-chip {
|
11 |
| - @include mdc-chip-theme.theme-styles(( |
12 |
| - with-avatar-avatar-shape: ( |
13 |
| - family: 'rounded', |
14 |
| - radius: (14px, 14px, 14px, 14px) |
15 |
| - ), |
16 |
| - with-icon-icon-size: 18px, |
17 |
| - with-leading-icon-disabled-leading-icon-opacity: 0.38, |
18 |
| - with-leading-icon-leading-icon-size: 20px, |
19 |
| - with-trailing-icon-disabled-trailing-icon-opacity: 0.38, |
20 |
| - with-avatar-avatar-size: 28px, |
21 |
| - with-avatar-disabled-avatar-opacity: 0.38, |
22 |
| - with-icon-disabled-icon-opacity: 0.38, |
23 |
| - with-trailing-icon-trailing-icon-size: 18px, |
24 |
| - flat-disabled-outline-opacity: 0.12, |
25 |
| - flat-disabled-unselected-outline-opacity: 0.12, |
26 |
| - flat-selected-outline-width: 0, |
27 |
| - outline-width: 1px, |
28 |
| - flat-unselected-outline-width: 1px, |
29 |
| - flat-outline-width: 1px, |
30 |
| - disabled-label-text-opacity: 0.38, |
31 |
| - disabled-outline-opacity: 0.12, |
32 |
| - elevated-disabled-container-opacity: 0.12, |
33 |
| - container-height: 32px, |
34 |
| - container-shape: ( |
35 |
| - family: 'rounded', |
36 |
| - radius: (16px, 16px, 16px, 16px) |
37 |
| - ), |
38 |
| - )); |
| 62 | + @include mdc-helpers.disable-mdc-fallback-declarations { |
| 63 | + @include mdc-chip-theme.theme-styles(( |
| 64 | + // Static tokens |
| 65 | + with-avatar-avatar-shape: ( |
| 66 | + family: 'rounded', |
| 67 | + radius: (14px, 14px, 14px, 14px) |
| 68 | + ), |
| 69 | + with-icon-icon-size: 18px, |
| 70 | + with-leading-icon-disabled-leading-icon-opacity: 0.38, |
| 71 | + with-leading-icon-leading-icon-size: 20px, |
| 72 | + with-trailing-icon-disabled-trailing-icon-opacity: 0.38, |
| 73 | + with-avatar-avatar-size: 28px, |
| 74 | + with-avatar-disabled-avatar-opacity: 0.38, |
| 75 | + with-icon-disabled-icon-opacity: 0.38, |
| 76 | + with-trailing-icon-trailing-icon-size: 18px, |
| 77 | + flat-disabled-outline-opacity: 0.12, |
| 78 | + flat-disabled-unselected-outline-opacity: 0.12, |
| 79 | + flat-selected-outline-width: 0, |
| 80 | + outline-width: 1px, |
| 81 | + flat-unselected-outline-width: 1px, |
| 82 | + flat-outline-width: 1px, |
| 83 | + disabled-label-text-opacity: 0.38, |
| 84 | + disabled-outline-opacity: 0.12, |
| 85 | + elevated-disabled-container-opacity: 0.12, |
| 86 | + container-height: 32px, |
| 87 | + container-shape: ( |
| 88 | + family: 'rounded', |
| 89 | + radius: (16px, 16px, 16px, 16px) |
| 90 | + ), |
| 91 | + |
| 92 | + // Tokens that will be overwritten in the theme |
| 93 | + elevated-container-color: transparent, |
| 94 | + elevated-disabled-container-color: transparent, |
| 95 | + label-text-color: currentColor, |
| 96 | + disabled-label-text-color: currentColor, |
| 97 | + with-icon-icon-color: currentColor, |
| 98 | + with-icon-disabled-icon-color: currentColor, |
| 99 | + with-trailing-icon-disabled-trailing-icon-color: currentColor, |
| 100 | + with-trailing-icon-trailing-icon-color: currentColor, |
| 101 | + with-icon-selected-icon-color: currentColor, |
| 102 | + )); |
| 103 | + } |
39 | 104 |
|
40 | 105 | @include cdk.high-contrast(active, off) {
|
41 | 106 | outline: solid 1px;
|
|
144 | 209 | // In case an icon or text is used as an avatar.
|
145 | 210 | text-align: center;
|
146 | 211 | line-height: 1;
|
| 212 | + |
| 213 | + // Technically the avatar is only supposed to have an image, but we also allow for icons. |
| 214 | + // Set the color so the icons inherit the correct color. |
| 215 | + color: var(--mdc-chip-with-icon-icon-color, currentColor); |
147 | 216 | }
|
148 | 217 |
|
149 | 218 | // Required for the strong focus indicator to fill the chip.
|
|
0 commit comments