|
1 | 1 | @use 'sass:map';
|
2 | 2 | @use '@material/list/evolution-mixins';
|
| 3 | +@use '@material/checkbox/checkbox-theme' as mdc-checkbox-theme; |
3 | 4 | @use '@material/list/list-theme' as mdc-list-theme;
|
4 | 5 |
|
5 | 6 | @use '../core/theming/theming';
|
6 |
| -@use '../core/tokens/m2/mdc/list' as m2-mdc-list; |
| 7 | +@use '../core/tokens/m2/mdc/checkbox' as tokens-mdc-checkbox; |
| 8 | +@use '../core/tokens/m2/mdc/list' as tokens-mdc-list; |
7 | 9 | @use '../core/typography/typography';
|
8 | 10 | @use '../core/typography/typography-utils';
|
9 |
| -@use '../core/mdc-helpers/mdc-helpers'; |
10 |
| -@use './list-option-theme'; |
11 | 11 |
|
12 | 12 | @mixin color($config-or-theme) {
|
13 | 13 | $config: theming.get-color-config($config-or-theme);
|
14 |
| - $primary: theming.get-color-from-palette(map.get($config, primary)); |
15 |
| - $accent: theming.get-color-from-palette(map.get($config, accent)); |
16 |
| - $warn: theming.get-color-from-palette(map.get($config, warn)); |
17 |
| - $mdc-list-color-tokens: m2-mdc-list.get-color-tokens($config); |
| 14 | + $primary: map.get($config, primary); |
| 15 | + $warn: map.get($config, warn); |
| 16 | + $mdc-list-color-tokens: tokens-mdc-list.get-color-tokens($config); |
18 | 17 |
|
19 | 18 |
|
20 | 19 | // Add values for MDC list tokens.
|
21 | 20 | .mat-mdc-list-base {
|
22 | 21 | @include mdc-list-theme.theme($mdc-list-color-tokens);
|
23 | 22 | }
|
24 | 23 |
|
25 |
| - // TODO(mmalerba): This should use MDC checkbox's token API instead. |
26 |
| - @include mdc-helpers.using-mdc-theme($config) { |
27 |
| - .mat-mdc-list-option { |
28 |
| - @include list-option-theme.private-list-option-color-override($config, $primary, primary); |
29 |
| - } |
30 |
| - .mat-mdc-list-option.mat-accent { |
31 |
| - @include list-option-theme.private-list-option-color-override($config, $accent, secondary); |
32 |
| - } |
33 |
| - .mat-mdc-list-option.mat-warn { |
34 |
| - @include list-option-theme.private-list-option-color-override($config, $warn, error); |
35 |
| - } |
| 24 | + .mat-mdc-list-option { |
| 25 | + $primary-config: map.merge($config, (accent: $primary)); |
| 26 | + @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-color-tokens($primary-config)); |
| 27 | + } |
| 28 | + .mat-mdc-list-option.mat-accent { |
| 29 | + @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-color-tokens($config)); |
| 30 | + } |
| 31 | + .mat-mdc-list-option.mat-warn { |
| 32 | + $warn-config: map.merge($config, (accent: $warn)); |
| 33 | + @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-color-tokens($warn-config)); |
36 | 34 | }
|
37 | 35 |
|
38 | 36 | // There is no token for activated color on nav list.
|
39 | 37 | // TODO(mmalerba): Add a token to MDC or make a custom one.
|
40 | 38 | .mat-mdc-list-base.mat-mdc-list-base {
|
41 |
| - @include evolution-mixins.list-selected-ink-color($primary); |
| 39 | + @include evolution-mixins.list-selected-ink-color(theming.get-color-from-palette($primary)); |
42 | 40 | }
|
43 | 41 |
|
44 | 42 | // TODO(mmalerba): Leaking styles from the old MDC list mixins used in other components can cause
|
|
55 | 53 |
|
56 | 54 | @mixin density($config-or-theme) {
|
57 | 55 | $density-scale: theming.get-density-config($config-or-theme);
|
58 |
| - $mdc-list-density-tokens: m2-mdc-list.get-density-tokens($density-scale); |
| 56 | + $mdc-list-density-tokens: tokens-mdc-list.get-density-tokens($density-scale); |
59 | 57 |
|
60 | 58 | // Add values for MDC list tokens.
|
61 | 59 | .mat-mdc-list-base {
|
|
98 | 96 | @mixin typography($config-or-theme) {
|
99 | 97 | $config: typography.private-typography-to-2018-config(
|
100 | 98 | theming.get-typography-config($config-or-theme));
|
101 |
| - $mdc-list-typography-tokens: m2-mdc-list.get-typography-tokens($config); |
| 99 | + $mdc-list-typography-tokens: tokens-mdc-list.get-typography-tokens($config); |
102 | 100 |
|
103 | 101 | // Add values for MDC list tokens.
|
104 | 102 | .mat-mdc-list-base {
|
|
0 commit comments