|
1 | | -@use 'sass:map'; |
2 | 1 | @use '@angular/cdk'; |
3 | | -@use '@material/list/evolution-mixins' as mdc-list-mixins; |
4 | | -@use '@material/list/evolution-variables' as mdc-list-variables; |
5 | | -@use '@material/typography/typography' as mdc-typography; |
6 | 2 |
|
7 | 3 | @use '../tokens/m2/mat/option' as tokens-mat-option; |
8 | 4 | @use '../tokens/m2/mdc/list' as tokens-mdc-list; |
9 | 5 | @use '../tokens/token-utils'; |
10 | | -@use '../mdc-helpers/mdc-helpers'; |
11 | 6 | @use '../style/vendor-prefixes'; |
12 | 7 | @use '../style/layout-common'; |
13 | 8 |
|
| 9 | +$_side-padding: 16px; |
14 | 10 |
|
15 | 11 | .mat-mdc-option { |
16 | | - @include mdc-list-mixins.item-base; |
17 | | - @include mdc-list-mixins.item-spacing( |
18 | | - mdc-list-variables.$side-padding, $query: mdc-helpers.$mdc-base-styles-query); |
19 | 12 | @include vendor-prefixes.user-select(none); |
20 | | - @include mdc-typography.smooth-font(); |
| 13 | + @include vendor-prefixes.smooth-font(); |
| 14 | + display: flex; |
| 15 | + position: relative; |
| 16 | + align-items: center; |
| 17 | + justify-content: flex-start; |
| 18 | + overflow: hidden; |
| 19 | + min-height: 48px; |
| 20 | + padding: 0 16px; |
21 | 21 | cursor: pointer; |
22 | 22 | -webkit-tap-highlight-color: transparent; |
23 | 23 |
|
|
38 | 38 | &:focus.mdc-list-item, |
39 | 39 | &.mat-mdc-option-active.mdc-list-item { |
40 | 40 | @include token-utils.create-token-slot(background-color, focus-state-layer-color); |
| 41 | + outline: 0; |
41 | 42 | } |
42 | 43 |
|
43 | 44 | &.mdc-list-item--selected:not(.mdc-list-item--disabled) { |
|
65 | 66 | background: transparent; |
66 | 67 | } |
67 | 68 |
|
68 | | - // Set the `min-height` here ourselves, instead of going through |
69 | | - // the `mdc-list-one-line-item-density` mixin, because it sets a `height` |
70 | | - // which doesn't work well with multi-line options. |
71 | | - $height-config: map.get(mdc-list-variables.$one-line-item-density-config, height); |
72 | | - min-height: map.get($height-config, default); |
73 | | - |
74 | 69 | &.mdc-list-item--disabled { |
75 | 70 | // This is the same as `mdc-list-mixins.list-disabled-opacity` which |
76 | 71 | // we can't use directly, because it comes with some selectors. |
|
84 | 79 | // MatOption uses a child `<div>` element for its focus state to align with how ListItem does |
85 | 80 | // its focus state. |
86 | 81 | .mat-mdc-option-pseudo-checkbox, .mdc-list-item__primary-text, > mat-icon { |
87 | | - opacity: mdc-list-variables.$content-disabled-opacity; |
| 82 | + opacity: 0.38; |
88 | 83 | } |
89 | 84 |
|
90 | 85 | // Prevent clicking on disabled options with mouse. Support focusing on disabled option using |
|
96 | 91 | // Note that we bump the padding here, rather than padding inside the |
97 | 92 | // group so that ripples still reach to the edges of the panel. |
98 | 93 | .mat-mdc-optgroup &:not(.mat-mdc-option-multiple) { |
99 | | - padding-left: mdc-list-variables.$side-padding * 2; |
| 94 | + padding-left: $_side-padding * 2; |
100 | 95 |
|
101 | 96 | [dir='rtl'] & { |
102 | | - padding-left: mdc-list-variables.$side-padding; |
103 | | - padding-right: mdc-list-variables.$side-padding * 2; |
| 97 | + padding-left: $_side-padding; |
| 98 | + padding-right: $_side-padding * 2; |
104 | 99 | } |
105 | 100 | } |
106 | 101 |
|
107 | 102 | .mat-icon, |
108 | 103 | .mat-pseudo-checkbox-full { |
109 | | - margin-right: mdc-list-variables.$side-padding; |
| 104 | + margin-right: $_side-padding; |
110 | 105 | flex-shrink: 0; |
111 | 106 |
|
112 | 107 | [dir='rtl'] & { |
113 | 108 | margin-right: 0; |
114 | | - margin-left: mdc-list-variables.$side-padding; |
| 109 | + margin-left: $_side-padding; |
115 | 110 | } |
116 | 111 | } |
117 | 112 |
|
118 | 113 | .mat-pseudo-checkbox-minimal { |
119 | | - margin-left: mdc-list-variables.$side-padding; |
| 114 | + margin-left: $_side-padding; |
120 | 115 | flex-shrink: 0; |
121 | 116 |
|
122 | 117 | [dir='rtl'] & { |
123 | | - margin-right: mdc-list-variables.$side-padding; |
| 118 | + margin-right: $_side-padding; |
124 | 119 | margin-left: 0; |
125 | 120 | } |
126 | 121 | } |
|
169 | 164 | content: ''; |
170 | 165 | position: absolute; |
171 | 166 | top: 50%; |
172 | | - right: mdc-list-variables.$side-padding; |
| 167 | + right: $_side-padding; |
173 | 168 | transform: translateY(-50%); |
174 | 169 | width: $size; |
175 | 170 | height: 0; |
|
179 | 174 |
|
180 | 175 | [dir='rtl'] &.mdc-list-item--selected:not(.mat-mdc-option-multiple)::after { |
181 | 176 | right: auto; |
182 | | - left: mdc-list-variables.$side-padding; |
| 177 | + left: $_side-padding; |
183 | 178 | } |
184 | 179 | } |
185 | 180 | } |
|
0 commit comments