1 | @use '../../../cdk/a11y';
|
---|
2 | @use './list-common';
|
---|
3 | @use './layout-common';
|
---|
4 |
|
---|
5 | // The mixins below are shared between mat-menu and mat-select
|
---|
6 |
|
---|
7 | // menu width must be a multiple of 56px
|
---|
8 | $overlay-min-width: 112px !default; // 56 * 2
|
---|
9 | $overlay-max-width: 280px !default; // 56 * 5
|
---|
10 |
|
---|
11 | $item-height: 48px !default;
|
---|
12 | $side-padding: 16px !default;
|
---|
13 | $icon-margin: 16px !default;
|
---|
14 |
|
---|
15 |
|
---|
16 | @mixin base() {
|
---|
17 | min-width: $overlay-min-width;
|
---|
18 | max-width: $overlay-max-width;
|
---|
19 | overflow: auto;
|
---|
20 | -webkit-overflow-scrolling: touch; // for momentum scroll on mobile
|
---|
21 | }
|
---|
22 |
|
---|
23 | @mixin item-base() {
|
---|
24 | @include list-common.truncate-line();
|
---|
25 |
|
---|
26 | // Needs to be a block for the ellipsis to work.
|
---|
27 | display: block;
|
---|
28 | line-height: $item-height;
|
---|
29 | height: $item-height;
|
---|
30 | padding: 0 $side-padding;
|
---|
31 |
|
---|
32 | text-align: left;
|
---|
33 | text-decoration: none; // necessary to reset anchor tags
|
---|
34 |
|
---|
35 | // Required for Edge not to show scrollbars when setting the width manually. See #12112.
|
---|
36 | max-width: 100%;
|
---|
37 |
|
---|
38 | &[disabled] {
|
---|
39 | cursor: default;
|
---|
40 | }
|
---|
41 |
|
---|
42 | [dir='rtl'] & {
|
---|
43 | text-align: right;
|
---|
44 | }
|
---|
45 |
|
---|
46 | .mat-icon {
|
---|
47 | margin-right: $icon-margin;
|
---|
48 | vertical-align: middle;
|
---|
49 |
|
---|
50 | svg {
|
---|
51 | vertical-align: top;
|
---|
52 | }
|
---|
53 |
|
---|
54 | [dir='rtl'] & {
|
---|
55 | margin-left: $icon-margin;
|
---|
56 | margin-right: 0;
|
---|
57 | }
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 | @mixin item-submenu-trigger($side-padding) {
|
---|
62 | // Increase the side padding to prevent the indicator from overlapping the text.
|
---|
63 | padding-right: $side-padding * 2;
|
---|
64 |
|
---|
65 | [dir='rtl'] & {
|
---|
66 | padding-right: $side-padding;
|
---|
67 | padding-left: $side-padding * 2;
|
---|
68 | }
|
---|
69 | }
|
---|
70 |
|
---|
71 | @mixin item-submenu-icon($side-padding) {
|
---|
72 | position: absolute;
|
---|
73 | top: 50%;
|
---|
74 | right: $side-padding;
|
---|
75 | transform: translateY(-50%);
|
---|
76 | width: 5px;
|
---|
77 | height: 10px;
|
---|
78 | fill: currentColor;
|
---|
79 |
|
---|
80 | [dir='rtl'] & {
|
---|
81 | right: auto;
|
---|
82 | left: $side-padding;
|
---|
83 | transform: translateY(-50%) scaleX(-1);
|
---|
84 | }
|
---|
85 |
|
---|
86 | // Fix for Chromium-based browsers blending in the `currentColor` with the background.
|
---|
87 | @include a11y.high-contrast(active, off) {
|
---|
88 | fill: CanvasText;
|
---|
89 | }
|
---|
90 | }
|
---|
91 |
|
---|
92 | @mixin item-ripple() {
|
---|
93 | @include layout-common.fill;
|
---|
94 |
|
---|
95 | // Prevent any pointer events on the ripple container for a menu item. The ripple container is
|
---|
96 | // not the trigger element for the ripples and can be therefore disabled like that. Disabling
|
---|
97 | // the pointer events ensures that there is no `click` event that can bubble up and cause
|
---|
98 | // the menu panel to close.
|
---|
99 | pointer-events: none;
|
---|
100 | }
|
---|