|
3 | 3 | @import '@material/theme/functions.import';
|
4 | 4 |
|
5 | 5 | @mixin mat-mdc-chips-theme($theme) {
|
6 |
| - @include mdc-chip-set-core-styles($query: $mat-theme-styles-query); |
7 |
| - @include mdc-chip-without-ripple($query: $mat-theme-styles-query); |
8 |
| - |
9 | 6 | $primary: mat-color(map-get($theme, primary));
|
10 | 7 | $accent: mat-color(map-get($theme, accent));
|
11 | 8 | $warn: mat-color(map-get($theme, warn));
|
12 | 9 | $background: map-get($theme, background);
|
13 | 10 | $unselected-background: mat-color($background, unselected-chip);
|
14 | 11 |
|
15 |
| - .mat-mdc-chip { |
16 |
| - @include mdc-chip-fill-color-accessible($unselected-background, |
17 |
| - $query: $mat-theme-styles-query); |
| 12 | + // Save original values of MDC global variables. We need to save these so we can restore the |
| 13 | + // variables to their original values and prevent unintended side effects from using this mixin. |
| 14 | + $orig-mdc-chips-fill-color-default: $mdc-chips-fill-color-default; |
| 15 | + $orig-mdc-chips-ink-color-default: $mdc-chips-ink-color-default; |
| 16 | + $orig-mdc-chips-icon-color: $mdc-chips-icon-color; |
| 17 | + |
| 18 | + @include mat-using-mdc-theme($theme) { |
| 19 | + $mdc-chips-fill-color-default: |
| 20 | + mix(mdc-theme-prop-value(on-surface), mdc-theme-prop-value(surface), 12%) !global; |
| 21 | + $mdc-chips-ink-color-default: rgba(mdc-theme-prop-value(on-surface), 0.87) !global; |
| 22 | + $mdc-chips-icon-color: mdc-theme-prop-value(on-surface) !global; |
| 23 | + |
| 24 | + @include mdc-chip-set-core-styles($query: $mat-theme-styles-query); |
| 25 | + @include mdc-chip-without-ripple($query: $mat-theme-styles-query); |
| 26 | + |
| 27 | + .mat-mdc-chip { |
| 28 | + @include mdc-chip-fill-color-accessible($unselected-background, |
| 29 | + $query: $mat-theme-styles-query); |
18 | 30 |
|
19 |
| - &.mat-primary { |
20 |
| - &.mdc-chip--selected, &.mat-mdc-chip-highlighted { |
21 |
| - @include mdc-chip-fill-color-accessible($primary, $query: $mat-theme-styles-query); |
| 31 | + &.mat-primary { |
| 32 | + &.mdc-chip--selected, &.mat-mdc-chip-highlighted { |
| 33 | + @include mdc-chip-fill-color-accessible($primary, $query: $mat-theme-styles-query); |
| 34 | + } |
22 | 35 | }
|
23 |
| - } |
24 | 36 |
|
25 |
| - &.mat-accent { |
26 |
| - &.mdc-chip--selected, &.mat-mdc-chip-highlighted { |
27 |
| - @include mdc-chip-fill-color-accessible($accent, $query: $mat-theme-styles-query); |
| 37 | + &.mat-accent { |
| 38 | + &.mdc-chip--selected, &.mat-mdc-chip-highlighted { |
| 39 | + @include mdc-chip-fill-color-accessible($accent, $query: $mat-theme-styles-query); |
| 40 | + } |
28 | 41 | }
|
29 |
| - } |
30 | 42 |
|
31 |
| - &.mat-warn { |
32 |
| - &.mdc-chip--selected, &.mat-mdc-chip-highlighted { |
33 |
| - @include mdc-chip-fill-color-accessible($warn, $query: $mat-theme-styles-query); |
| 43 | + &.mat-warn { |
| 44 | + &.mdc-chip--selected, &.mat-mdc-chip-highlighted { |
| 45 | + @include mdc-chip-fill-color-accessible($warn, $query: $mat-theme-styles-query); |
| 46 | + } |
34 | 47 | }
|
35 | 48 | }
|
36 | 49 | }
|
| 50 | + |
| 51 | + // Restore original values of MDC global variables. |
| 52 | + $mdc-chips-fill-color-default: $orig-mdc-chips-fill-color-default !global; |
| 53 | + $mdc-chips-ink-color-default: $orig-mdc-chips-ink-color-default !global; |
| 54 | + $mdc-chips-icon-color: $orig-mdc-chips-icon-color !global; |
37 | 55 | }
|
38 | 56 |
|
39 | 57 | @mixin mat-mdc-chips-typography($config) {
|
|
0 commit comments