|
1 | 1 | @use '@angular/cdk'; |
2 | | -@use '@material/menu-surface/mixins' as mdc-menu-surface; |
3 | | -@use '@material/list/evolution-mixins' as mdc-list; |
4 | | - |
5 | | -@include mdc-menu-surface.core-styles($query: structure); |
6 | | - |
7 | | -// Note that the `.mdc-menu-surface` is here in order to bump up the specificity |
8 | | -// and avoid interference with `mat-menu` which uses the same mixins from MDC. |
9 | | -.mdc-menu-surface.mat-mdc-autocomplete-panel { |
| 2 | +@use '../core/style/elevation'; |
| 3 | +@use '../core/tokens/token-utils'; |
| 4 | +@use '../core/tokens/m2/mat/autocomplete' as tokens-mat-autocomplete; |
| 5 | + |
| 6 | +// Even though we don't use the MDC styles, we need to keep the classes in the |
| 7 | +// DOM for the Gmat versions to work. We need to bump up the specificity here |
| 8 | +// so that it's higher than MDC's styles. |
| 9 | +div.mat-mdc-autocomplete-panel { |
| 10 | + @include elevation.elevation(8); |
10 | 11 | width: 100%; // Ensures that the panel matches the overlay width. |
11 | 12 | max-height: 256px; // Prevents lists with a lot of option from growing too high. |
12 | | - position: static; // MDC uses `absolute` by default which will throw off our positioning. |
13 | 13 | visibility: hidden; |
14 | | - // MDC sets the transform-origin programmatically based on whether the dropdown is above or |
15 | | - // below the input. We use our own positioning logic, so we need to set this ourselves. |
16 | 14 | transform-origin: center top; |
| 15 | + overflow: auto; |
| 16 | + padding: 8px 0; |
| 17 | + border-radius: 4px; |
| 18 | + box-sizing: border-box; |
| 19 | + |
| 20 | + // Workaround in case other MDC menu surface styles bleed in. |
| 21 | + position: static; |
| 22 | + |
| 23 | + @include token-utils.use-tokens( |
| 24 | + tokens-mat-autocomplete.$prefix, tokens-mat-autocomplete.get-token-slots()) { |
| 25 | + @include token-utils.create-token-slot(background-color, background-color); |
| 26 | + } |
17 | 27 |
|
18 | | - @include mdc-list.list-base($query: structure); |
19 | 28 | @include cdk.high-contrast(active, off) { |
20 | 29 | outline: solid 1px; |
21 | 30 | } |
|
28 | 37 | .mat-mdc-autocomplete-panel-above & { |
29 | 38 | border-bottom-left-radius: 0; |
30 | 39 | border-bottom-right-radius: 0; |
31 | | - // MDC sets the transform-origin programmatically based on whether the dropdown is above or |
32 | | - // below the input. We use our own positioning logic, so we need to set this ourselves. |
33 | 40 | transform-origin: center bottom; |
34 | 41 | } |
35 | 42 |
|
|
0 commit comments