Skip to content

Commit 3fc744e

Browse files
committed
fix mat-list
1 parent 2c97f6d commit 3fc744e

File tree

4 files changed

+21
-40
lines changed

4 files changed

+21
-40
lines changed

src/material/list/_list-option-theme.import.scss

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/material/list/_list-option-theme.scss

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/material/list/_list-theme.scss

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,42 @@
11
@use 'sass:map';
22
@use '@material/list/evolution-mixins';
3+
@use '@material/checkbox/checkbox-theme' as mdc-checkbox-theme;
34
@use '@material/list/list-theme' as mdc-list-theme;
45

56
@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;
79
@use '../core/typography/typography';
810
@use '../core/typography/typography-utils';
9-
@use '../core/mdc-helpers/mdc-helpers';
10-
@use './list-option-theme';
1111

1212
@mixin color($config-or-theme) {
1313
$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);
1817

1918

2019
// Add values for MDC list tokens.
2120
.mat-mdc-list-base {
2221
@include mdc-list-theme.theme($mdc-list-color-tokens);
2322
}
2423

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));
3634
}
3735

3836
// There is no token for activated color on nav list.
3937
// TODO(mmalerba): Add a token to MDC or make a custom one.
4038
.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));
4240
}
4341

4442
// TODO(mmalerba): Leaking styles from the old MDC list mixins used in other components can cause
@@ -55,7 +53,7 @@
5553

5654
@mixin density($config-or-theme) {
5755
$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);
5957

6058
// Add values for MDC list tokens.
6159
.mat-mdc-list-base {
@@ -98,7 +96,7 @@
9896
@mixin typography($config-or-theme) {
9997
$config: typography.private-typography-to-2018-config(
10098
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);
102100

103101
// Add values for MDC list tokens.
104102
.mat-mdc-list-base {

src/material/list/list-option.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@use '@material/radio/radio-theme' as mdc-radio-theme;
66

77
@use '../core/mdc-helpers/mdc-helpers';
8-
@use '../checkbox/checkbox-private';
8+
@use '../core/tokens/m2/mdc/checkbox' as tokens-mdc-checkbox;
99
@use '../radio/radio-private';
1010
@use './list-option-trailing-avatar-compat';
1111
@use './list-item-hcm-indicator';
@@ -42,11 +42,9 @@
4242
// We can't use the MDC checkbox here directly, because this checkbox is purely
4343
// decorative and including the MDC one will bring in unnecessary JS.
4444
.mdc-checkbox {
45-
$config: map.merge(checkbox-private.$private-checkbox-theme-config, $without-ripple-config);
46-
4745
// MDC theme styles also include structural styles so we have to include the theme at least
4846
// once here. The values will be overwritten by our own theme file afterwards.
49-
@include mdc-checkbox-theme.theme-styles($config);
47+
@include mdc-checkbox-theme.theme-styles(tokens-mdc-checkbox.get-token-slots());
5048
}
5149

5250
// We can't use the MDC radio here directly, because this radio is purely

0 commit comments

Comments
 (0)