1 | @use 'sass:map';
|
2 | @use '../core/theming/theming';
|
3 | @use '../core/typography/typography';
|
4 | @use '../core/typography/typography-utils';
|
5 | @use '../core/style/list-common';
|
6 |
|
7 |
|
8 | @mixin color($config-or-theme) {
|
9 | $config: theming.get-color-config($config-or-theme);
|
10 | $background: map.get($config, background);
|
11 | $foreground: map.get($config, foreground);
|
12 |
|
13 | .mat-list-base {
|
14 | .mat-list-item {
|
15 | color: theming.get-color-from-palette($foreground, text);
|
16 | }
|
17 |
|
18 | .mat-list-option {
|
19 | color: theming.get-color-from-palette($foreground, text);
|
20 | }
|
21 |
|
22 | .mat-subheader {
|
23 | color: theming.get-color-from-palette($foreground, secondary-text);
|
24 | }
|
25 |
|
26 | .mat-list-item-disabled {
|
27 | background-color: theming.get-color-from-palette($background, disabled-list-option);
|
28 | color: theming.get-color-from-palette($foreground, disabled-text);
|
29 | }
|
30 | }
|
31 |
|
32 | .mat-list-option,
|
33 | .mat-nav-list .mat-list-item,
|
34 | .mat-action-list .mat-list-item {
|
35 | &:hover, &:focus {
|
36 | background: theming.get-color-from-palette($background, 'hover');
|
37 | }
|
38 | }
|
39 |
|
40 | .mat-list-single-selected-option {
|
41 | &, &:hover, &:focus {
|
42 | background: theming.get-color-from-palette($background, hover, 0.12);
|
43 | }
|
44 | }
|
45 | }
|
46 |
|
47 | @mixin typography($config-or-theme) {
|
48 | $config: typography.private-typography-to-2014-config(
|
49 | theming.get-typography-config($config-or-theme));
|
50 | $font-family: typography-utils.font-family($config);
|
51 |
|
52 | .mat-list-item {
|
53 | font-family: $font-family;
|
54 | }
|
55 |
|
56 | .mat-list-option {
|
57 | font-family: $font-family;
|
58 | }
|
59 |
|
60 |
|
61 | .mat-list-base {
|
62 | .mat-list-item {
|
63 | font-size: typography-utils.font-size($config, subheading-2);
|
64 | @include list-common.base(typography-utils.font-size($config, body-1));
|
65 | }
|
66 |
|
67 | .mat-list-option {
|
68 | font-size: typography-utils.font-size($config, subheading-2);
|
69 | @include list-common.base(typography-utils.font-size($config, body-1));
|
70 | }
|
71 |
|
72 | .mat-subheader {
|
73 | font-family: typography-utils.font-family($config, body-2);
|
74 | font-size: typography-utils.font-size($config, body-2);
|
75 | font-weight: typography-utils.font-weight($config, body-2);
|
76 | }
|
77 | }
|
78 |
|
79 |
|
80 | .mat-list-base[dense] {
|
81 | .mat-list-item {
|
82 | font-size: typography-utils.font-size($config, caption);
|
83 | @include list-common.base(typography-utils.font-size($config, caption));
|
84 | }
|
85 |
|
86 | .mat-list-option {
|
87 | font-size: typography-utils.font-size($config, caption);
|
88 | @include list-common.base(typography-utils.font-size($config, caption));
|
89 | }
|
90 |
|
91 | .mat-subheader {
|
92 | font-family: $font-family;
|
93 | font-size: typography-utils.font-size($config, caption);
|
94 | font-weight: typography-utils.font-weight($config, body-2);
|
95 | }
|
96 | }
|
97 | }
|
98 |
|
99 | @mixin _density($config-or-theme) {}
|
100 |
|
101 | @mixin theme($theme-or-color-config) {
|
102 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
103 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-list') {
|
104 | $color: theming.get-color-config($theme);
|
105 | $density: theming.get-density-config($theme);
|
106 | $typography: theming.get-typography-config($theme);
|
107 |
|
108 | @if $color != null {
|
109 | @include color($color);
|
110 | }
|
111 | @if $density != null {
|
112 | @include _density($density);
|
113 | }
|
114 | @if $typography != null {
|
115 | @include typography($typography);
|
116 | }
|
117 | }
|
118 | }
|