|
3 | 3 | @use '../../material/core/style/layout-common'; |
4 | 4 | @use '../../cdk/a11y'; |
5 | 5 |
|
6 | | -@include mdc-list.deprecated-without-ripple($query: mdc-helpers.$mat-base-styles-query); |
7 | | - |
8 | 6 | // MDC expects the list element to be a `<ul>`, since we use `<mat-list>` instead we need to |
9 | 7 | // explicitly set `display: block` |
10 | 8 | .mat-mdc-list-base { |
| 9 | + // This mixin needs to be nested so that styles don't leak into other |
| 10 | + // components based on the MDC list (e.g. select, autocomplete). |
| 11 | + @include mdc-list.deprecated-without-ripple($query: mdc-helpers.$mat-base-styles-query); |
11 | 12 | display: block; |
| 13 | + |
| 14 | + // MDC does have 2-line support, but it's a per-list setting, whereas ours applies to individual |
| 15 | + // items. Therefore, we need to add our own styles. |
| 16 | + .mat-mdc-2-line { |
| 17 | + height: 72px; |
| 18 | + |
| 19 | + .mdc-deprecated-list-item__text { |
| 20 | + align-self: flex-start; |
| 21 | + } |
| 22 | + } |
| 23 | + |
| 24 | + // MDC does not support more than 2 lines, so we need to add our own styles. |
| 25 | + .mat-mdc-3-line { |
| 26 | + height: 88px; |
| 27 | + |
| 28 | + .mdc-deprecated-list-item__text { |
| 29 | + align-self: flex-start; |
| 30 | + } |
| 31 | + } |
12 | 32 | } |
13 | 33 |
|
14 | 34 | // .mdc-deprecated-list-item__primary-text adds its own margin settings, so only reset if it doesn't |
|
24 | 44 | } |
25 | 45 |
|
26 | 46 |
|
27 | | -// MDC does have 2-line support, but it's a per-list setting, whereas ours applies to individual |
28 | | -// items. Therefore, we need to add our own styles. |
29 | | -.mat-mdc-2-line { |
30 | | - height: 72px; |
31 | | - |
32 | | - .mdc-deprecated-list-item__text { |
33 | | - align-self: flex-start; |
34 | | - } |
35 | | -} |
36 | | - |
37 | | -// MDC does not support more than 2 lines, so we need to add our own styles. |
38 | | -.mat-mdc-3-line { |
39 | | - height: 88px; |
40 | | - |
41 | | - .mdc-deprecated-list-item__text { |
42 | | - align-self: flex-start; |
43 | | - } |
44 | | -} |
45 | | - |
46 | 47 | // MDC supports avatars, but it's a per-list setting, whereas ours applies to individual |
47 | 48 | // items. Therefore, we need to add our own styles. |
48 | 49 | .mat-mdc-list-avatar { |
|
51 | 52 | $size: 40px; |
52 | 53 | $margin-value: 72px - mdc-list.$deprecated-side-padding - $size; |
53 | 54 |
|
54 | | - width: $size; |
55 | | - height: $size; |
56 | | - border-radius: 50%; |
| 55 | + // These styles need the extra specificity in order to override the ones from MDC. |
| 56 | + .mat-mdc-list-base & { |
| 57 | + width: $size; |
| 58 | + height: $size; |
| 59 | + border-radius: 50%; |
| 60 | + } |
57 | 61 |
|
58 | 62 | // Avatars that come before the text have the .mdc-deprecated-list-item__graphic class. |
59 | 63 | // MDC's .mdc-deprecated-list--avatar-list class would normally apply overrides to set the |
|
0 commit comments