material 3.7.1 → 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/README.md +2 -2
  2. package/dist/components/slider/features/controller.js +24 -8
  3. package/dist/elements/css/bottom-app-bar.css +1 -1
  4. package/dist/elements/css/bottom-app-bar.js +1 -1
  5. package/dist/elements/css/card.css +1 -1
  6. package/dist/elements/css/card.js +1 -1
  7. package/dist/elements/css/checkbox.css +1 -1
  8. package/dist/elements/css/checkbox.js +1 -1
  9. package/dist/elements/css/datepicker.css +1 -1
  10. package/dist/elements/css/datepicker.js +1 -1
  11. package/dist/elements/css/dialog.css +1 -1
  12. package/dist/elements/css/dialog.js +1 -1
  13. package/dist/elements/css/menu.css +1 -1
  14. package/dist/elements/css/menu.js +1 -1
  15. package/dist/elements/css/radios.css +1 -1
  16. package/dist/elements/css/radios.js +1 -1
  17. package/dist/elements/css/select.css +1 -1
  18. package/dist/elements/css/select.js +1 -1
  19. package/dist/elements/css/slider.css +1 -1
  20. package/dist/elements/css/slider.js +1 -1
  21. package/dist/elements/css/tabs.css +1 -1
  22. package/dist/elements/css/tabs.js +1 -1
  23. package/dist/elements/css/text-field.css +1 -1
  24. package/dist/elements/css/text-field.js +1 -1
  25. package/dist/elements/css/timepicker.css +1 -1
  26. package/dist/elements/css/timepicker.js +1 -1
  27. package/dist/elements/css/top-app-bar.css +1 -1
  28. package/dist/elements/css/top-app-bar.js +1 -1
  29. package/dist/elements/preupgrade/badge.css +1 -1
  30. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  31. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  32. package/dist/elements/preupgrade/button-group.css +1 -1
  33. package/dist/elements/preupgrade/button.css +1 -1
  34. package/dist/elements/preupgrade/card.css +1 -1
  35. package/dist/elements/preupgrade/carousel.css +1 -1
  36. package/dist/elements/preupgrade/checkbox.css +1 -1
  37. package/dist/elements/preupgrade/chips.css +1 -1
  38. package/dist/elements/preupgrade/datepicker.css +1 -1
  39. package/dist/elements/preupgrade/dialog.css +1 -1
  40. package/dist/elements/preupgrade/divider.css +1 -1
  41. package/dist/elements/preupgrade/drawer.css +1 -1
  42. package/dist/elements/preupgrade/extended-fab.css +1 -1
  43. package/dist/elements/preupgrade/fab-menu.css +1 -1
  44. package/dist/elements/preupgrade/fab.css +1 -1
  45. package/dist/elements/preupgrade/icon-button.css +1 -1
  46. package/dist/elements/preupgrade/list.css +1 -1
  47. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  48. package/dist/elements/preupgrade/menu.css +1 -1
  49. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  50. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  51. package/dist/elements/preupgrade/progress.css +1 -1
  52. package/dist/elements/preupgrade/radios.css +1 -1
  53. package/dist/elements/preupgrade/search.css +1 -1
  54. package/dist/elements/preupgrade/select.css +1 -1
  55. package/dist/elements/preupgrade/side-sheet.css +1 -1
  56. package/dist/elements/preupgrade/slider.css +1 -1
  57. package/dist/elements/preupgrade/snackbar.css +1 -1
  58. package/dist/elements/preupgrade/split-button.css +1 -1
  59. package/dist/elements/preupgrade/switch.css +1 -1
  60. package/dist/elements/preupgrade/tabs.css +1 -1
  61. package/dist/elements/preupgrade/text-field.css +1 -1
  62. package/dist/elements/preupgrade/timepicker.css +1 -1
  63. package/dist/elements/preupgrade/toolbar.css +1 -1
  64. package/dist/elements/preupgrade/tooltip.css +1 -1
  65. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  66. package/dist/elements/preupgrade.css +1 -1
  67. package/dist/styles/badge.css +1 -1
  68. package/dist/styles/base-lite.css +1 -1
  69. package/dist/styles/base.css +1 -1
  70. package/dist/styles/bottom-app-bar.css +2 -2
  71. package/dist/styles/bottom-sheet.css +1 -1
  72. package/dist/styles/button-group.css +1 -1
  73. package/dist/styles/button.css +1 -1
  74. package/dist/styles/card.css +2 -2
  75. package/dist/styles/carousel.css +1 -1
  76. package/dist/styles/checkbox.css +2 -2
  77. package/dist/styles/chips.css +1 -1
  78. package/dist/styles/contrast.css +1 -1
  79. package/dist/styles/datepicker.css +2 -2
  80. package/dist/styles/dialog.css +2 -2
  81. package/dist/styles/divider.css +1 -1
  82. package/dist/styles/drawer.css +1 -1
  83. package/dist/styles/extended-fab.css +1 -1
  84. package/dist/styles/fab-menu.css +1 -1
  85. package/dist/styles/fab.css +1 -1
  86. package/dist/styles/icon-button.css +1 -1
  87. package/dist/styles/list.css +1 -1
  88. package/dist/styles/loading-indicator.css +1 -1
  89. package/dist/styles/menu.css +2 -2
  90. package/dist/styles/navigation-bar.css +1 -1
  91. package/dist/styles/navigation-rail.css +1 -1
  92. package/dist/styles/progress.css +1 -1
  93. package/dist/styles/radios.css +2 -2
  94. package/dist/styles/search.css +1 -1
  95. package/dist/styles/select.css +2 -2
  96. package/dist/styles/side-sheet.css +1 -1
  97. package/dist/styles/slider.css +2 -2
  98. package/dist/styles/snackbar.css +1 -1
  99. package/dist/styles/split-button.css +1 -1
  100. package/dist/styles/switch.css +1 -1
  101. package/dist/styles/tabs.css +2 -2
  102. package/dist/styles/text-field.css +2 -2
  103. package/dist/styles/timepicker.css +2 -2
  104. package/dist/styles/toolbar.css +1 -1
  105. package/dist/styles/tooltip.css +1 -1
  106. package/dist/styles/top-app-bar.css +2 -2
  107. package/dist/styles/typography.css +1 -1
  108. package/dist/styles/utilities.css +1 -1
  109. package/dist/styles.css +2 -2
  110. package/dist/themes/autumn-contrast.css +1 -1
  111. package/dist/themes/autumn.css +1 -1
  112. package/dist/themes/baseline-contrast.css +1 -1
  113. package/dist/themes/baseline.css +1 -1
  114. package/dist/themes/brownbeige-contrast.css +1 -1
  115. package/dist/themes/brownbeige.css +1 -1
  116. package/dist/themes/content-contrast.css +1 -1
  117. package/dist/themes/content.css +1 -1
  118. package/dist/themes/desert-contrast.css +1 -1
  119. package/dist/themes/desert.css +1 -1
  120. package/dist/themes/expressive-contrast.css +1 -1
  121. package/dist/themes/expressive.css +1 -1
  122. package/dist/themes/fidelity-contrast.css +1 -1
  123. package/dist/themes/fidelity.css +1 -1
  124. package/dist/themes/forest-contrast.css +1 -1
  125. package/dist/themes/forest.css +1 -1
  126. package/dist/themes/fruit-salad-contrast.css +1 -1
  127. package/dist/themes/fruit-salad.css +1 -1
  128. package/dist/themes/highcontrast-contrast.css +1 -1
  129. package/dist/themes/highcontrast.css +1 -1
  130. package/dist/themes/monochrome-contrast.css +1 -1
  131. package/dist/themes/monochrome.css +1 -1
  132. package/dist/themes/neutral-contrast.css +1 -1
  133. package/dist/themes/neutral.css +1 -1
  134. package/dist/themes/ocean-contrast.css +1 -1
  135. package/dist/themes/ocean.css +1 -1
  136. package/dist/themes/rainbow-contrast.css +1 -1
  137. package/dist/themes/rainbow.css +1 -1
  138. package/dist/themes/sageivory-contrast.css +1 -1
  139. package/dist/themes/sageivory.css +1 -1
  140. package/dist/themes/spring-contrast.css +1 -1
  141. package/dist/themes/spring.css +1 -1
  142. package/dist/themes/summer-contrast.css +1 -1
  143. package/dist/themes/summer.css +1 -1
  144. package/dist/themes/sunset-contrast.css +1 -1
  145. package/dist/themes/sunset.css +1 -1
  146. package/dist/themes/tealcaramel-contrast.css +1 -1
  147. package/dist/themes/tealcaramel.css +1 -1
  148. package/dist/themes/vibrant-contrast.css +1 -1
  149. package/dist/themes/vibrant.css +1 -1
  150. package/package.json +2 -1
  151. package/src/styles/abstract/_base.scss +0 -1
  152. package/src/styles/abstract/_direction.scss +121 -152
  153. package/src/styles/abstract/_emit.scss +7 -16
  154. package/src/styles/abstract/_floating-placement.scss +9 -10
  155. package/src/styles/abstract/_functions.scss +64 -79
  156. package/src/styles/abstract/_mixins.scss +355 -459
  157. package/src/styles/abstract/_theme.scss +122 -136
  158. package/src/styles/abstract/_variables.scss +320 -390
  159. package/src/styles/abstract/chips/_assist.scss +2 -3
  160. package/src/styles/abstract/chips/_filter.scss +2 -3
  161. package/src/styles/abstract/chips/_input.scss +2 -3
  162. package/src/styles/abstract/chips/_suggestion.scss +2 -3
  163. package/src/styles/base/_body-theme.scss +10 -15
  164. package/src/styles/base/_document.scss +10 -33
  165. package/src/styles/base/_reset.scss +20 -40
  166. package/src/styles/base/_tokens.scss +6 -21
  167. package/src/styles/base/_typescale-tokens.scss +12 -16
  168. package/src/styles/base/_typography.scss +28 -37
  169. package/src/styles/components/_badge.scss +171 -193
  170. package/src/styles/components/_bottom-app-bar.scss +72 -88
  171. package/src/styles/components/_bottom-sheet.scss +188 -232
  172. package/src/styles/components/_button-group.scss +140 -189
  173. package/src/styles/components/_button.scss +382 -478
  174. package/src/styles/components/_card.scss +349 -473
  175. package/src/styles/components/_carousel.scss +134 -156
  176. package/src/styles/components/_checkbox.scss +208 -247
  177. package/src/styles/components/_chips.scss +239 -304
  178. package/src/styles/components/_datepicker.scss +172 -220
  179. package/src/styles/components/_dialog.scss +428 -553
  180. package/src/styles/components/_divider.scss +37 -46
  181. package/src/styles/components/_drawer.scss +571 -678
  182. package/src/styles/components/_extended-fab.scss +263 -294
  183. package/src/styles/components/_fab-menu.scss +225 -267
  184. package/src/styles/components/_fab.scss +197 -218
  185. package/src/styles/components/_icon-button.scss +483 -588
  186. package/src/styles/components/_list.scss +115 -144
  187. package/src/styles/components/_loading-indicator.scss +23 -29
  188. package/src/styles/components/_menu.scss +543 -699
  189. package/src/styles/components/_navigation-bar.scss +189 -234
  190. package/src/styles/components/_navigation-rail.scss +256 -312
  191. package/src/styles/components/_progress.scss +60 -85
  192. package/src/styles/components/_radios.scss +170 -205
  193. package/src/styles/components/_search.scss +369 -455
  194. package/src/styles/components/_select.scss +78 -185
  195. package/src/styles/components/_side-sheet.scss +234 -292
  196. package/src/styles/components/_slider.scss +289 -367
  197. package/src/styles/components/_snackbar.scss +149 -198
  198. package/src/styles/components/_split-button.scss +139 -228
  199. package/src/styles/components/_switch.scss +282 -349
  200. package/src/styles/components/_tabs.scss +350 -547
  201. package/src/styles/components/_text-field.scss +788 -978
  202. package/src/styles/components/_timepicker.scss +435 -506
  203. package/src/styles/components/_toolbar.scss +178 -242
  204. package/src/styles/components/_tooltip.scss +152 -197
  205. package/src/styles/components/_top-app-bar.scss +206 -224
  206. package/src/styles/elements/_badge.scss +42 -61
  207. package/src/styles/elements/_bottom-app-bar.scss +14 -20
  208. package/src/styles/elements/_bottom-sheet.scss +0 -3
  209. package/src/styles/elements/_button-group.scss +80 -80
  210. package/src/styles/elements/_button.scss +72 -88
  211. package/src/styles/elements/_card.scss +48 -57
  212. package/src/styles/elements/_carousel.scss +2 -5
  213. package/src/styles/elements/_checkbox.scss +32 -43
  214. package/src/styles/elements/_chips.scss +18 -22
  215. package/src/styles/elements/_config.scss +11 -26
  216. package/src/styles/elements/_datepicker.scss +17 -22
  217. package/src/styles/elements/_dialog.scss +0 -3
  218. package/src/styles/elements/_divider.scss +11 -13
  219. package/src/styles/elements/_drawer.scss +9 -14
  220. package/src/styles/elements/_extended-fab.scss +36 -40
  221. package/src/styles/elements/_fab-menu.scss +21 -25
  222. package/src/styles/elements/_fab.scss +17 -20
  223. package/src/styles/elements/_field.scss +93 -114
  224. package/src/styles/elements/_icon-button.scss +34 -38
  225. package/src/styles/elements/_index.scss +0 -4
  226. package/src/styles/elements/_list.scss +19 -26
  227. package/src/styles/elements/_loading-indicator.scss +6 -9
  228. package/src/styles/elements/_menu.scss +0 -3
  229. package/src/styles/elements/_navigation-bar.scss +5 -9
  230. package/src/styles/elements/_navigation-rail.scss +10 -15
  231. package/src/styles/elements/_progress.scss +15 -18
  232. package/src/styles/elements/_radios.scss +24 -49
  233. package/src/styles/elements/_search.scss +19 -24
  234. package/src/styles/elements/_select.scss +4 -9
  235. package/src/styles/elements/_side-sheet.scss +0 -3
  236. package/src/styles/elements/_slider.scss +15 -35
  237. package/src/styles/elements/_snackbar.scss +0 -3
  238. package/src/styles/elements/_split-button.scss +33 -39
  239. package/src/styles/elements/_switch.scss +50 -90
  240. package/src/styles/elements/_tabs.scss +9 -13
  241. package/src/styles/elements/_text-field.scss +150 -178
  242. package/src/styles/elements/_timepicker.scss +0 -3
  243. package/src/styles/elements/_toolbar.scss +30 -35
  244. package/src/styles/elements/_tooltip.scss +0 -3
  245. package/src/styles/elements/_top-app-bar.scss +38 -45
  246. package/src/styles/main.scss +0 -15
  247. package/src/styles/themes/_autumn.scss +240 -258
  248. package/src/styles/themes/_base-theme.scss +96 -128
  249. package/src/styles/themes/_baseline.scss +273 -314
  250. package/src/styles/themes/_brownbeige.scss +242 -250
  251. package/src/styles/themes/_content.scss +240 -248
  252. package/src/styles/themes/_desert.scss +242 -250
  253. package/src/styles/themes/_expressive.scss +242 -250
  254. package/src/styles/themes/_fidelity.scss +240 -248
  255. package/src/styles/themes/_forest.scss +242 -259
  256. package/src/styles/themes/_fruit-salad.scss +242 -250
  257. package/src/styles/themes/_highcontrast.scss +164 -172
  258. package/src/styles/themes/_index.scss +0 -1
  259. package/src/styles/themes/_monochrome.scss +226 -234
  260. package/src/styles/themes/_neutral.scss +242 -250
  261. package/src/styles/themes/_ocean.scss +242 -259
  262. package/src/styles/themes/_rainbow.scss +242 -250
  263. package/src/styles/themes/_sageivory.scss +242 -250
  264. package/src/styles/themes/_spring.scss +238 -255
  265. package/src/styles/themes/_summer.scss +242 -250
  266. package/src/styles/themes/_sunset.scss +242 -259
  267. package/src/styles/themes/_tealcaramel.scss +242 -250
  268. package/src/styles/themes/_vibrant.scss +242 -250
  269. package/src/styles/utilities/_colors.scss +44 -50
  270. package/src/styles/utilities/_flexbox.scss +48 -59
  271. package/src/styles/utilities/_layout.scss +516 -591
  272. package/src/styles/utilities/_ripple.scss +61 -70
  273. package/src/styles/utilities/_spacing.scss +120 -127
  274. package/src/styles/utilities/_typography.scss +45 -58
  275. package/src/styles/utilities/_visibility.scss +61 -76
  276. package/dist/package.json +0 -488
@@ -1,4 +1,3 @@
1
- // src/styles/components/_menu.scss
2
1
  @use "../../styles/abstract/base" as base;
3
2
  @use "../../styles/abstract/variables" as v;
4
3
  @use "../../styles/abstract/mixins" as m;
@@ -10,706 +9,551 @@ $prefix: base.$prefix;
10
9
 
11
10
  $component: "#{$prefix}-menu";
12
11
 
13
- // Right to left. An ancestor's dir, which needs no script, and
14
- // --rtl, which position.ts sets from the computed direction, for a menu in
15
- // a shadow root, where a dir outside it does not reach. Physical sides:
16
- // bundlers lower logical insets and :dir() into :lang() lists that miss
17
- // dir="rtl".
18
12
  @mixin mirrored {
19
- [dir='rtl'] &,
20
- &.#{$component}--rtl {
21
- @content;
22
- }
13
+ [dir='rtl'] &,
14
+ &.#{$component}--rtl {
15
+ @content;
16
+ }
23
17
  }
24
18
 
25
19
  .#{$component} {
26
- // Base styles
27
- @include m.typography("body-medium");
28
- @include m.shape("extra-small");
29
-
30
- position: fixed;
31
- z-index: f.get-z-index("menu");
32
- min-width: 112px;
33
- max-width: 280px;
34
- padding: 8px 0; // Keep padding consistent
35
- background-color: t.color("surface-container");
36
- color: t.color("on-surface");
37
- @include m.elevation(2);
38
- overflow: hidden;
39
-
40
- // Initial state - hidden with proper transform origin
41
- display: flex;
42
- flex-direction: column;
43
- opacity: 0;
44
- transform-origin: top center;
45
- // The menu grows in height from its anchor when it opens, and closing is
46
- // the same motion in reverse: the closed state is the height it opens
47
- // from, on the same duration and curve
48
- transform: scaleY(0);
49
- pointer-events: none;
50
- // Closed, the menu is out of the tab order and the accessibility tree: an
51
- // <m-menu> keeps its closed menu in its shadow root, where its first item
52
- // was a tab stop. A transition keeps it visible while it moves either way.
53
- visibility: hidden;
54
-
55
- // Material Design 3 standard animation curve for menus
56
- transition:
57
- transform v.motion("duration-medium1") v.motion("easing-emphasized"),
58
- opacity v.motion("duration-medium1") v.motion("easing-emphasized"),
59
- visibility v.motion("duration-medium1");
60
-
61
- // A top-layer menu is a popover (`layer: "top"`). The browser's popover
62
- // defaults centre it in the viewport inside a border; the menu places
63
- // itself, so they are cleared.
64
- &[popover] {
65
- inset: auto;
66
- margin: 0;
67
- border: 0;
68
- }
69
-
70
- // Visible state
71
- &--visible {
72
- opacity: 1;
73
- transform: scaleY(1);
74
- pointer-events: auto;
75
- visibility: visible;
76
- }
77
-
78
- // Position variations with appropriate transform origins
79
- &--position-top,
80
- &--position-top-start,
81
- &--position-top-end {
82
- transform-origin: bottom center;
83
- }
84
-
85
- // Submenu styling
86
- &--submenu {
87
- position: absolute;
88
- z-index: f.get-z-index("menu") + 1;
89
- }
90
-
91
- // A run of items between gaps. The element is presentational: it exists so
92
- // a gap can split the menu into separate surfaces in the vertical variant.
93
- // A standard menu is one surface, so here a group is only spacing.
94
- &__group {
95
- display: block;
96
- list-style: none;
97
-
98
- > ul {
99
- margin: 0;
100
- padding: 0;
101
- list-style: none;
102
- }
103
-
104
- + .#{$component}__group {
105
- margin-top: 8px;
106
- }
107
- }
108
-
109
- // List container
110
- &__list {
111
- margin: 0;
112
- padding: 0;
113
- list-style: none;
114
- overflow-y: auto;
115
- flex: 1 1 auto;
116
- min-height: 0; // Required for flex children with overflow
117
- @include m.scrollbar;
118
- width: 100%;
119
- }
120
-
121
- // Menu items
122
- &__item {
123
- @include m.typography("label-large");
124
- @include m.flex-row;
125
-
126
- position: relative;
127
- min-height: 48px;
128
- // 12dp each side (m3.material.io menu specs, "Measurements"), with
129
- // room at the end for a trailing mark
130
- padding: 12px;
131
- padding-inline-end: 40px;
132
- cursor: pointer;
133
- user-select: none;
134
- color: t.color("on-surface");
135
- white-space: nowrap;
136
- text-overflow: ellipsis;
137
- overflow: hidden;
138
- width: 100%;
139
- box-sizing: border-box;
140
-
141
- // State layer effects
142
- &:hover {
143
- @include m.state-layer(t.color("on-surface"), "hover");
144
- }
145
-
146
- // The focus layer is for a person navigating by key. Focus moves into
147
- // the menu however it was opened, so keying this off `:focus` marked
148
- // the first item as soon as the menu appeared under the pointer, which
149
- // reads as a highlight nobody asked for.
150
- &:focus {
151
- outline: none;
152
- }
153
-
154
- &:focus-visible,
155
- &--active {
156
- @include m.state-layer(t.color("on-surface"), "focus");
157
- }
158
-
159
- &:active {
160
- @include m.state-layer(t.color("on-surface"), "pressed");
161
- }
162
-
163
- // Submenu indicator
164
- &--submenu {
165
- padding-right: 48px;
166
-
167
- &::after {
168
- content: "";
169
- position: absolute;
170
- right: 12px;
171
- top: 50%;
172
- transform: translateY(-50%);
173
- width: 24px;
174
- height: 24px;
175
- mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 17l5-5-5-5v10z'/%3E%3C/svg%3E")
176
- center / contain no-repeat;
177
- -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 17l5-5-5-5v10z'/%3E%3C/svg%3E")
178
- center / contain no-repeat;
179
- background-color: currentColor;
180
- opacity: 0.87;
181
- }
182
-
183
- &[aria-expanded="true"] {
184
- @include m.state-layer(t.color("on-surface"), "hover");
185
-
186
- &::after {
187
- opacity: 1;
188
- }
189
- }
190
- }
191
-
192
- // Disabled: it can be focused and read, it just cannot be chosen
193
- // (m3.material.io menu accessibility, "Interactability")
194
- &--disabled {
195
- cursor: default;
196
- color: t.alpha("on-surface", 0.38);
197
-
198
- // The icon, the supporting line and the shortcut are the item's
199
- // content, and disabled they dim with the label rather than keep
200
- // their own colours: the spec puts every disabled part on
201
- // on-surface at 0.38 (md.comp.menu.list-item.*.disabled.*,
202
- // md.comp.menus.standard.menu-item.disabled.*)
203
- .#{$component}__item-icon,
204
- .#{$component}__item-supporting,
205
- .#{$component}__item-shortcut {
206
- color: inherit;
207
- }
208
-
209
- &:hover,
210
- &:active {
211
- &::before {
212
- opacity: 0;
213
- }
214
- }
215
- }
216
-
217
- // Selected state for select component
218
- // Selected: a secondary-container behind it and its own label colour
219
- // (MenuTokens.ListItemSelectedContainerColor and
220
- // ListItemSelectedLabelTextColor). The check is the second cue the
221
- // accessibility guidance asks for on top of colour.
222
- &--selected {
223
- background-color: t.color("secondary-container");
224
- color: t.color("on-secondary-container");
225
-
226
- &:hover {
227
- @include m.state-layer(t.color("on-secondary-container"), "hover");
228
- }
229
-
230
- &:focus-visible,
231
- &.#{$component}__item--active {
232
- @include m.state-layer(t.color("on-secondary-container"), "focus");
233
- }
234
-
235
- &:active {
236
- @include m.state-layer(t.color("on-secondary-container"), "pressed");
237
- }
238
-
239
- .#{$component}__item-icon,
240
- .#{$component}__item-shortcut {
241
- color: inherit;
242
- }
243
-
244
- &::after {
245
- content: "";
246
- position: absolute;
247
- // At the item's end in either direction, where the padding
248
- // keeps room for it: `right` alone left it over the text in
249
- // RTL. Both sides are set and the start margin takes the
250
- // space between: bundlers lower a logical inset
251
- // (inset-inline-end) into :lang() lists that miss dir="rtl",
252
- // and leave a logical margin as written.
253
- left: 12px;
254
- right: 12px;
255
- margin-inline-start: auto;
256
- top: 50%;
257
- transform: translateY(-50%);
258
- width: 18px;
259
- height: 18px;
260
- mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='20 6 9 17 4 12' stroke='white' stroke-width='2' fill='none'/%3E%3C/svg%3E")
261
- center / contain no-repeat;
262
- -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='20 6 9 17 4 12' stroke='white' stroke-width='2' fill='none'/%3E%3C/svg%3E")
263
- center / contain no-repeat;
264
- background-color: currentColor;
265
- }
266
-
267
- // Selected and disabled: the selection's own colours at the
268
- // disabled opacity, and no state layer for an item that cannot be
269
- // chosen. Written with the compound so it wins over either single
270
- // state, whichever order they are read in
271
- // (md.comp.menus.standard.menu-item.selected.disabled: content and
272
- // container both at 0.38).
273
- &.#{$component}__item--disabled {
274
- background-color: t.alpha("secondary-container", 0.38);
275
- color: t.alpha("on-secondary-container", 0.38);
276
-
277
- &:hover,
278
- &:active {
279
- &::before {
280
- opacity: 0;
281
- }
282
- }
283
- }
284
- }
285
-
286
- // Content containers inside menu items
287
- &-content {
288
- display: flex;
289
- align-items: center;
290
- width: 100%;
291
- overflow: hidden;
292
- }
293
-
294
- &-icon {
295
- margin-inline-end: 12px;
296
- display: flex;
297
- align-items: center;
298
- justify-content: center;
299
- flex-shrink: 0;
300
- color: t.color("on-surface-variant");
301
-
302
- svg {
303
- width: 24px;
304
- height: 24px;
305
- }
306
- }
307
-
308
- &-text {
309
- flex: 1;
310
- white-space: nowrap;
311
- overflow: hidden;
312
- text-overflow: ellipsis;
313
- }
314
-
315
- // A label with a line under it. The stacking belongs to every
316
- // variant, so a supporting line never runs into its label; the
317
- // vertical menu adds its own type and colour on top.
318
- &-label {
319
- display: flex;
320
- flex-direction: column;
321
- justify-content: center;
322
- flex: 1;
323
- min-width: 0;
324
- }
325
-
326
- &-supporting {
327
- @include m.typography("body-medium");
328
- color: t.color("on-surface-variant");
329
- white-space: nowrap;
330
- overflow: hidden;
331
- text-overflow: ellipsis;
332
- }
333
-
334
- &-shortcut {
335
- margin-left: 12px;
336
- color: t.color("on-surface-variant");
337
- flex-shrink: 0;
338
- }
339
- }
340
-
341
- // Divider
342
- &__divider {
343
- height: 1px;
344
- // The list is a flex column: in a menu that scrolls, a divider that
345
- // may shrink is the one item without a minimum, and collapses to 0
346
- flex-shrink: 0;
347
- margin: 8px 0;
348
- background-color: t.color("outline-variant");
349
- }
350
-
351
- // Accessibility
352
- @include m.focus-ring(".#{$component}__item:focus-visible");
353
-
354
- // Reduced motion preference support
355
- @include m.reduced-motion {
356
- transition: opacity v.motion("duration-short2") linear, visibility v.motion("duration-short2");
357
-
358
- &,
359
- &--visible {
360
- transform: none;
361
- }
362
- }
363
-
364
- // High contrast mode
365
- @include m.high-contrast {
366
- border: 1px solid CurrentColor;
367
-
368
- .#{$component}__divider {
369
- background-color: CurrentColor;
370
- }
371
-
372
- .#{$component}__item--disabled {
373
- opacity: 1;
374
- color: GrayText;
375
- }
376
- }
377
-
378
- // Dense variant — compact items for toolbars and dense UIs
379
- &--dense {
380
- padding: 4px 0;
381
-
382
- .#{$component}__item {
383
- @include m.typography("body-medium");
384
- min-height: 32px;
385
- padding: 4px 12px;
386
- padding-right: 32px;
387
-
388
- &--submenu {
389
- padding-right: 36px;
390
- }
391
-
392
- &-icon svg {
393
- width: 16px;
394
- height: 16px;
395
- }
396
- }
397
-
398
- .#{$component}__divider {
399
- margin: 4px 0;
400
- }
401
- }
402
-
403
- // RTL Support
404
- // -------------------------------------------------------------------------
405
- // The M3 expressive vertical menu (Compose SegmentedMenuTokens and
406
- // StandardMenuTokens / VibrantMenuTokens). A 16dp container holding 44dp
407
- // items 2dp apart; an item is a 4dp rectangle at rest and rounds to 12dp
408
- // as it is hovered, focused, pressed or selected, which is the expressive
409
- // state this variant is for. The first and last items round to 12dp on
410
- // their outer corners so the column reads as one block.
411
- // -------------------------------------------------------------------------
412
- &--vertical {
413
- // Standard: surface-based, the lower-emphasis mapping
414
- --#{$prefix}-menu-container: #{t.color("surface-container-low")};
415
- --#{$prefix}-menu-label: #{t.color("on-surface")};
416
- --#{$prefix}-menu-supporting: #{t.color("on-surface-variant")};
417
- --#{$prefix}-menu-selected-container: #{t.color("tertiary-container")};
418
- --#{$prefix}-menu-selected-label: #{t.color("on-tertiary-container")};
419
- // Selected and disabled: the standard menu dims the container with its
420
- // content (md.comp.menus.standard.menu-item.selected.disabled.container,
421
- // tertiary-container at 0.38). The vibrant menu's spec carries no
422
- // container colour for the state, so it overrides this below with the
423
- // enabled selection's container, undimmed.
424
- --#{$prefix}-menu-selected-disabled-container: color-mix(
425
- in srgb,
426
- var(--#{$prefix}-menu-selected-container) 38%,
427
- transparent
428
- );
429
-
430
- border-radius: v.shape("large");
431
- background-color: var(--#{$prefix}-menu-container);
432
- color: var(--#{$prefix}-menu-label);
433
- // GroupPadding. The vertical menu has no container spacing token of
434
- // its own: it is made of groups, and a menu with no gaps is one group,
435
- // so the container's inset is the group's. The 8dp that was here is
436
- // the horizontal variant's ContainerTopSpace, which does not apply.
437
- padding: 4px;
438
-
439
- // Vibrant: tertiary-based, more prominent, to be used sparingly
440
- &.#{$component}--vibrant {
441
- --#{$prefix}-menu-container: #{t.color("tertiary-container")};
442
- --#{$prefix}-menu-label: #{t.color("on-tertiary-container")};
443
- --#{$prefix}-menu-supporting: #{t.color("on-tertiary-container")};
444
- --#{$prefix}-menu-selected-container: #{t.color("tertiary")};
445
- --#{$prefix}-menu-selected-label: #{t.color("on-tertiary")};
446
- // No container token for the vibrant selected disabled state: the
447
- // container is the enabled selection's, at full opacity
448
- --#{$prefix}-menu-selected-disabled-container: var(--#{$prefix}-menu-selected-container);
449
- }
450
-
451
- .#{$component}__list {
452
- display: flex;
453
- flex-direction: column;
454
- gap: 2px; // SegmentedGap
455
- }
456
-
457
- .#{$component}__item {
458
- @include m.typography("body-large");
459
- min-height: 44px; // SegmentedMenuTokens.Item
460
- padding: 8px 16px; // ItemTopSpace / ItemLeadingSpace
461
- padding-inline-end: 16px;
462
- color: var(--#{$prefix}-menu-label);
463
- border-radius: v.shape("extra-small"); // ItemShape
464
- transition:
465
- border-radius v.motion("spring-fast-spatial-duration")
466
- v.motion("spring-fast-spatial-easing"),
467
- background-color v.motion("duration-short2")
468
- v.motion("easing-standard");
469
-
470
- // The shape is the state: 4dp at rest, 12dp once it is touched
471
- &:hover,
472
- &:focus-visible,
473
- &--active,
474
- &:active {
475
- border-radius: v.shape("medium");
476
- }
477
-
478
- // The ends of the column round outwards, so the items read as one
479
- // (a block edge, not an inline one: the pair mirrors to itself,
480
- // so the arms form needs no direction arm).
481
- &:first-child {
482
- @include d.corners($start-start: v.shape("medium"), $start-end: v.shape("medium"), $arm: false);
483
- }
484
-
485
- &:last-child {
486
- @include d.corners($end-start: v.shape("medium"), $end-end: v.shape("medium"), $arm: false);
487
- }
488
-
489
- &--selected {
490
- background-color: var(--#{$prefix}-menu-selected-container);
491
- color: var(--#{$prefix}-menu-selected-label);
492
- border-radius: v.shape("medium"); // ItemSelectedShape
493
-
494
- &:hover {
495
- @include m.state-layer(var(--#{$prefix}-menu-selected-label), "hover");
496
- }
497
-
498
- &:focus-visible,
499
- &.#{$component}__item--active {
500
- @include m.state-layer(var(--#{$prefix}-menu-selected-label), "focus");
501
- }
502
-
503
- &:active {
504
- @include m.state-layer(var(--#{$prefix}-menu-selected-label), "pressed");
505
- }
506
-
507
- // Selected and disabled: the container and content of the
508
- // selection at 0.38, the vibrant container excepted (its
509
- // custom property says which), and no layer to hover or press
510
- // (md.comp.menus.standard.menu-item.selected.disabled,
511
- // md.comp.menus.vibrant.menu-item.selected.disabled).
512
- &.#{$component}__item--disabled {
513
- background-color: var(--#{$prefix}-menu-selected-disabled-container);
514
- color: color-mix(in srgb, var(--#{$prefix}-menu-selected-label) 38%, transparent);
515
-
516
- &:hover,
517
- &:active {
518
- &::before {
519
- opacity: 0;
520
- }
521
- }
522
- }
523
- }
524
-
525
- // M3 puts a selected item's check before its label, never at the
526
- // end: the vertical selected-state figure shows colour and shape
527
- // alone, and the guidelines' select figures show a leading check
528
- // (m3.material.io/components/menus/specs and /guidelines). The
529
- // vertical item's 16px end padding has no room for the horizontal
530
- // variant's trailing mark, which otherwise covers the last 14px
531
- // of the label. An item with a submenu keeps the mark it has.
532
- &--selected:not(.#{$component}__item--submenu)::after {
533
- content: none;
534
- }
535
-
536
- &--disabled {
537
- color: color-mix(in srgb, var(--#{$prefix}-menu-label) 38%, transparent);
538
-
539
- // Icon, supporting text and shortcut dim with the label, on
540
- // its colour: every disabled part of a standard item is
541
- // on-surface at 0.38, of a vibrant item on-tertiary-container
542
- // (md.comp.menus.standard.menu-item.disabled.*,
543
- // md.comp.menus.vibrant.menu-item.disabled.*), which is the
544
- // label's own colour in both mappings
545
- .#{$component}__item-icon,
546
- .#{$component}__item-supporting,
547
- .#{$component}__item-shortcut {
548
- color: inherit;
549
- }
550
- }
551
-
552
- &-icon {
553
- color: var(--#{$prefix}-menu-supporting);
554
- margin-inline-end: 12px; // ItemBetweenSpace
555
-
556
- svg {
557
- // ItemLeadingIconSize / ItemTrailingIconSize
558
- width: 20px;
559
- height: 20px;
560
- }
561
- }
562
-
563
- &-shortcut {
564
- @include m.typography("label-small"); // ItemTrailingSupportingTextFont
565
- color: var(--#{$prefix}-menu-supporting);
566
- }
567
-
568
- // A label with a line under it
569
- &-label {
570
- display: flex;
571
- flex-direction: column;
572
- justify-content: center;
573
- flex: 1;
574
- min-width: 0;
575
- }
576
-
577
- &-supporting {
578
- @include m.typography("body-medium"); // ItemSupportingTextFont
579
- color: var(--#{$prefix}-menu-supporting);
580
- white-space: nowrap;
581
- overflow: hidden;
582
- text-overflow: ellipsis;
583
- }
584
-
585
- &--selected {
586
- .#{$component}__item-icon,
587
- .#{$component}__item-shortcut,
588
- .#{$component}__item-supporting {
589
- color: inherit;
590
- }
591
- }
592
- }
593
-
594
- // A grouped menu separates its runs of items two ways, as the spec
595
- // shows: a divider line across one surface, or a gap
596
- // (m3.material.io menu guidelines, "Gaps & dividers")
597
- .#{$component}__divider {
598
- margin: 6px 0;
599
- }
600
- }
601
-
602
- // -------------------------------------------------------------------------
603
- // The gap separator: the menu stops being one surface and each group
604
- // becomes its own, keeping the container's shape and elevation.
605
- //
606
- // The measurements come from the vertical menu specimen on
607
- // m3.material.io/components/menus, which the guidelines show but do not
608
- // give numbers for. Read off that image at its 2px-per-dp scale: a 44dp
609
- // item, a 16dp group corner, 4dp of padding inside each group and 2dp
610
- // between them, so two items either side of a boundary sit 10dp apart.
611
- // The group hugs its items more tightly than the whole-menu container
612
- // does, which is what keeps a gap from reading as a chasm.
613
- // -------------------------------------------------------------------------
614
- &--vertical:has(.#{$component}__group) {
615
- background-color: transparent;
616
- box-shadow: none;
617
- padding: 0;
618
-
619
- // Each group casts its own shadow. The container clips so that item
620
- // backgrounds stay inside its rounded corners, but there is no
621
- // container here to stay inside, and clipping would cut the shadows
622
- // off square.
623
- overflow: visible;
624
-
625
- .#{$component}__list {
626
- overflow: visible;
627
- // the separator is the 2dp the variant already puts between items
628
- gap: 2px;
629
- }
630
-
631
- .#{$component}__group {
632
- background-color: var(--#{$prefix}-menu-container);
633
- padding: 4px; // GroupPadding
634
- @include m.elevation(2);
635
-
636
- // A corner facing a gap is the group's own shape, 8dp
637
- // (SegmentedMenuTokens.GroupShape). Only the outside of the menu
638
- // keeps the 16dp container shape, so the run of groups reads as
639
- // one menu that has been cut, rather than as loose cards.
640
- border-radius: v.shape("small");
641
-
642
- // Block edges again: the pairs mirror to themselves
643
- &:first-child {
644
- @include d.corners($start-start: v.shape("large"), $start-end: v.shape("large"), $arm: false); // ContainerShape
645
- }
646
-
647
- &:last-child {
648
- @include d.corners($end-start: v.shape("large"), $end-end: v.shape("large"), $arm: false);
649
- }
650
-
651
- // its own margin would add to the list gap
652
- + .#{$component}__group {
653
- margin-top: 0;
654
- }
655
-
656
- // and the items inside keep the 2dp separation of the variant
657
- > ul {
658
- display: flex;
659
- flex-direction: column;
660
- gap: 2px;
661
- }
662
- }
663
- }
664
-
665
- // -------------------------------------------------------------------------
666
- // Shape morph on the container: while a submenu is open, the menu that
667
- // opened it steps back to an 8dp corner and the active one takes 24dp
668
- // (SegmentedMenuTokens.ActiveContainerShape and InactiveContainerShape).
669
- // This is the expressive active state the spec describes.
670
- // -------------------------------------------------------------------------
671
- &--vertical {
672
- transition:
673
- transform v.motion("duration-medium1") v.motion("easing-emphasized"),
674
- opacity v.motion("duration-medium1") v.motion("easing-emphasized"),
675
- visibility v.motion("duration-medium1"),
676
- border-radius v.motion("spring-fast-spatial-duration")
677
- v.motion("spring-fast-spatial-easing");
678
-
679
- &.#{$component}--active {
680
- border-radius: 24px;
681
- }
682
-
683
- &.#{$component}--inactive {
684
- border-radius: v.shape("small");
685
- }
686
- }
687
-
688
- @include mirrored {
689
- transform-origin: top right;
690
- }
691
-
692
- // --position-top is its own class. A suffix on the --rtl compound would
693
- // compile to menu--rtl--position-top, which nothing carries.
694
- [dir='rtl'] &--position-top,
695
- [dir='rtl'] &--position-top-start,
696
- [dir='rtl'] &--position-top-end,
697
- &.#{$component}--rtl.#{$component}--position-top,
698
- &.#{$component}--rtl.#{$component}--position-top-start,
699
- &.#{$component}--rtl.#{$component}--position-top-end {
700
- transform-origin: bottom right;
701
- }
702
-
703
- @include mirrored {
704
- .#{$component}__item--submenu {
705
- padding-right: 16px;
706
- padding-left: 48px;
707
-
708
- &::after {
709
- right: auto;
710
- left: 16px;
711
- transform: translateY(-50%) rotate(180deg);
712
- }
713
- }
714
- }
20
+ @include m.typography("body-medium");
21
+ @include m.shape("extra-small");
22
+
23
+ position: fixed;
24
+ z-index: f.get-z-index("menu");
25
+ min-width: 112px;
26
+ max-width: 280px;
27
+ padding: 8px 0;
28
+ background-color: t.color("surface-container");
29
+ color: t.color("on-surface");
30
+ @include m.elevation(2);
31
+ overflow: hidden;
32
+
33
+ display: flex;
34
+ flex-direction: column;
35
+ opacity: 0;
36
+ transform-origin: top center;
37
+ transform: scaleY(0);
38
+ pointer-events: none;
39
+ visibility: hidden;
40
+
41
+ transition:
42
+ transform v.motion("duration-medium1") v.motion("easing-emphasized"),
43
+ opacity v.motion("duration-medium1") v.motion("easing-emphasized"),
44
+ visibility v.motion("duration-medium1");
45
+
46
+ &[popover] {
47
+ inset: auto;
48
+ margin: 0;
49
+ border: 0;
50
+ }
51
+
52
+ &--visible {
53
+ opacity: 1;
54
+ transform: scaleY(1);
55
+ pointer-events: auto;
56
+ visibility: visible;
57
+ }
58
+
59
+ &--position-top {
60
+ transform-origin: bottom center;
61
+ }
62
+
63
+ &--submenu {
64
+ position: absolute;
65
+ z-index: f.get-z-index("menu") + 1;
66
+ }
67
+
68
+ &__group {
69
+ display: block;
70
+ list-style: none;
71
+
72
+ > ul {
73
+ margin: 0;
74
+ padding: 0;
75
+ list-style: none;
76
+ }
77
+
78
+ + .#{$component}__group {
79
+ margin-top: 8px;
80
+ }
81
+ }
82
+
83
+ &__list {
84
+ margin: 0;
85
+ padding: 0;
86
+ list-style: none;
87
+ overflow-y: auto;
88
+ flex: 1 1 auto;
89
+ min-height: 0;
90
+ @include m.scrollbar;
91
+ width: 100%;
92
+ }
93
+
94
+ &__item {
95
+ @include m.typography("label-large");
96
+ @include m.flex-row;
97
+
98
+ position: relative;
99
+ min-height: 48px;
100
+ padding: 12px;
101
+ padding-inline-end: 40px;
102
+ cursor: pointer;
103
+ user-select: none;
104
+ color: t.color("on-surface");
105
+ white-space: nowrap;
106
+ text-overflow: ellipsis;
107
+ overflow: hidden;
108
+ width: 100%;
109
+ box-sizing: border-box;
110
+
111
+ &:hover {
112
+ @include m.state-layer(t.color("on-surface"), "hover");
113
+ }
114
+
115
+ &:focus {
116
+ outline: none;
117
+ }
118
+
119
+ &:focus-visible,
120
+ &--active {
121
+ @include m.state-layer(t.color("on-surface"), "focus");
122
+ }
123
+
124
+ &:active {
125
+ @include m.state-layer(t.color("on-surface"), "pressed");
126
+ }
127
+
128
+ &--submenu {
129
+ padding-right: 48px;
130
+
131
+ &::after {
132
+ content: "";
133
+ position: absolute;
134
+ right: 12px;
135
+ top: 50%;
136
+ transform: translateY(-50%);
137
+ width: 24px;
138
+ height: 24px;
139
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 17l5-5-5-5v10z'/%3E%3C/svg%3E")
140
+ center / contain no-repeat;
141
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 17l5-5-5-5v10z'/%3E%3C/svg%3E")
142
+ center / contain no-repeat;
143
+ background-color: currentColor;
144
+ opacity: 0.87;
145
+ }
146
+
147
+ &[aria-expanded="true"] {
148
+ @include m.state-layer(t.color("on-surface"), "hover");
149
+
150
+ &::after {
151
+ opacity: 1;
152
+ }
153
+ }
154
+ }
155
+
156
+ &--disabled {
157
+ cursor: default;
158
+ color: t.alpha("on-surface", 0.38);
159
+
160
+ .#{$component}__item-icon,
161
+ .#{$component}__item-supporting,
162
+ .#{$component}__item-shortcut {
163
+ color: inherit;
164
+ }
165
+
166
+ &:hover,
167
+ &:active {
168
+ &::before {
169
+ opacity: 0;
170
+ }
171
+ }
172
+ }
173
+
174
+ &--selected {
175
+ background-color: t.color("secondary-container");
176
+ color: t.color("on-secondary-container");
177
+
178
+ &:hover {
179
+ @include m.state-layer(t.color("on-secondary-container"), "hover");
180
+ }
181
+
182
+ &:focus-visible,
183
+ &.#{$component}__item--active {
184
+ @include m.state-layer(t.color("on-secondary-container"), "focus");
185
+ }
186
+
187
+ &:active {
188
+ @include m.state-layer(t.color("on-secondary-container"), "pressed");
189
+ }
190
+
191
+ .#{$component}__item-icon,
192
+ .#{$component}__item-shortcut {
193
+ color: inherit;
194
+ }
195
+
196
+ &::after {
197
+ content: "";
198
+ position: absolute;
199
+ left: 12px;
200
+ right: 12px;
201
+ margin-inline-start: auto;
202
+ top: 50%;
203
+ transform: translateY(-50%);
204
+ width: 18px;
205
+ height: 18px;
206
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='20 6 9 17 4 12' stroke='white' stroke-width='2' fill='none'/%3E%3C/svg%3E")
207
+ center / contain no-repeat;
208
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='20 6 9 17 4 12' stroke='white' stroke-width='2' fill='none'/%3E%3C/svg%3E")
209
+ center / contain no-repeat;
210
+ background-color: currentColor;
211
+ }
212
+
213
+ &.#{$component}__item--disabled {
214
+ background-color: t.alpha("secondary-container", 0.38);
215
+ color: t.alpha("on-secondary-container", 0.38);
216
+
217
+ &:hover,
218
+ &:active {
219
+ &::before {
220
+ opacity: 0;
221
+ }
222
+ }
223
+ }
224
+ }
225
+
226
+ &-content {
227
+ display: flex;
228
+ align-items: center;
229
+ width: 100%;
230
+ overflow: hidden;
231
+ }
232
+
233
+ &-icon {
234
+ margin-inline-end: 12px;
235
+ display: flex;
236
+ align-items: center;
237
+ justify-content: center;
238
+ flex-shrink: 0;
239
+ color: t.color("on-surface-variant");
240
+
241
+ svg {
242
+ width: 24px;
243
+ height: 24px;
244
+ }
245
+ }
246
+
247
+ &-text {
248
+ flex: 1;
249
+ white-space: nowrap;
250
+ overflow: hidden;
251
+ text-overflow: ellipsis;
252
+ }
253
+
254
+ &-label {
255
+ display: flex;
256
+ flex-direction: column;
257
+ justify-content: center;
258
+ flex: 1;
259
+ min-width: 0;
260
+ }
261
+
262
+ &-supporting {
263
+ @include m.typography("body-medium");
264
+ color: t.color("on-surface-variant");
265
+ white-space: nowrap;
266
+ overflow: hidden;
267
+ text-overflow: ellipsis;
268
+ }
269
+
270
+ &-shortcut {
271
+ margin-left: 12px;
272
+ color: t.color("on-surface-variant");
273
+ flex-shrink: 0;
274
+ }
275
+ }
276
+
277
+ &__divider {
278
+ height: 1px;
279
+ flex-shrink: 0;
280
+ margin: 8px 0;
281
+ background-color: t.color("outline-variant");
282
+ }
283
+
284
+ @include m.focus-ring(".#{$component}__item:focus-visible");
285
+
286
+ @include m.reduced-motion {
287
+ transition: opacity v.motion("duration-short2") linear, visibility v.motion("duration-short2");
288
+
289
+ &,
290
+ &--visible {
291
+ transform: none;
292
+ }
293
+ }
294
+
295
+ @include m.high-contrast {
296
+ border: 1px solid CurrentColor;
297
+
298
+ .#{$component}__divider {
299
+ background-color: CurrentColor;
300
+ }
301
+
302
+ .#{$component}__item--disabled {
303
+ opacity: 1;
304
+ color: GrayText;
305
+ }
306
+ }
307
+
308
+ &--dense {
309
+ padding: 4px 0;
310
+
311
+ .#{$component}__item {
312
+ @include m.typography("body-medium");
313
+ min-height: 32px;
314
+ padding: 4px 12px;
315
+ padding-right: 32px;
316
+
317
+ &--submenu {
318
+ padding-right: 36px;
319
+ }
320
+
321
+ &-icon svg {
322
+ width: 16px;
323
+ height: 16px;
324
+ }
325
+ }
326
+
327
+ .#{$component}__divider {
328
+ margin: 4px 0;
329
+ }
330
+ }
331
+
332
+ &--vertical {
333
+ --#{$prefix}-menu-container: #{t.color("surface-container-low")};
334
+ --#{$prefix}-menu-label: #{t.color("on-surface")};
335
+ --#{$prefix}-menu-supporting: #{t.color("on-surface-variant")};
336
+ --#{$prefix}-menu-selected-container: #{t.color("tertiary-container")};
337
+ --#{$prefix}-menu-selected-label: #{t.color("on-tertiary-container")};
338
+ --#{$prefix}-menu-selected-disabled-container: color-mix(
339
+ in srgb,
340
+ var(--#{$prefix}-menu-selected-container) 38%,
341
+ transparent
342
+ );
343
+
344
+ border-radius: v.shape("large");
345
+ background-color: var(--#{$prefix}-menu-container);
346
+ color: var(--#{$prefix}-menu-label);
347
+ padding: 4px;
348
+
349
+ &.#{$component}--vibrant {
350
+ --#{$prefix}-menu-container: #{t.color("tertiary-container")};
351
+ --#{$prefix}-menu-label: #{t.color("on-tertiary-container")};
352
+ --#{$prefix}-menu-supporting: #{t.color("on-tertiary-container")};
353
+ --#{$prefix}-menu-selected-container: #{t.color("tertiary")};
354
+ --#{$prefix}-menu-selected-label: #{t.color("on-tertiary")};
355
+ --#{$prefix}-menu-selected-disabled-container: var(--#{$prefix}-menu-selected-container);
356
+ }
357
+
358
+ .#{$component}__list {
359
+ display: flex;
360
+ flex-direction: column;
361
+ gap: 2px;
362
+ }
363
+
364
+ .#{$component}__item {
365
+ @include m.typography("body-large");
366
+ min-height: 44px;
367
+ padding: 8px 16px;
368
+ padding-inline-end: 16px;
369
+ color: var(--#{$prefix}-menu-label);
370
+ border-radius: v.shape("extra-small");
371
+ transition:
372
+ border-radius v.motion("spring-fast-spatial-duration")
373
+ v.motion("spring-fast-spatial-easing"),
374
+ background-color v.motion("duration-short2")
375
+ v.motion("easing-standard");
376
+
377
+ &:hover,
378
+ &:focus-visible,
379
+ &--active,
380
+ &:active {
381
+ border-radius: v.shape("medium");
382
+ }
383
+
384
+ &:first-child {
385
+ @include d.corners($start-start: v.shape("medium"), $start-end: v.shape("medium"), $arm: false);
386
+ }
387
+
388
+ &:last-child {
389
+ @include d.corners($end-start: v.shape("medium"), $end-end: v.shape("medium"), $arm: false);
390
+ }
391
+
392
+ &--selected {
393
+ background-color: var(--#{$prefix}-menu-selected-container);
394
+ color: var(--#{$prefix}-menu-selected-label);
395
+ border-radius: v.shape("medium");
396
+
397
+ &:hover {
398
+ @include m.state-layer(var(--#{$prefix}-menu-selected-label), "hover");
399
+ }
400
+
401
+ &:focus-visible,
402
+ &.#{$component}__item--active {
403
+ @include m.state-layer(var(--#{$prefix}-menu-selected-label), "focus");
404
+ }
405
+
406
+ &:active {
407
+ @include m.state-layer(var(--#{$prefix}-menu-selected-label), "pressed");
408
+ }
409
+
410
+ &.#{$component}__item--disabled {
411
+ background-color: var(--#{$prefix}-menu-selected-disabled-container);
412
+ color: color-mix(in srgb, var(--#{$prefix}-menu-selected-label) 38%, transparent);
413
+
414
+ &:hover,
415
+ &:active {
416
+ &::before {
417
+ opacity: 0;
418
+ }
419
+ }
420
+ }
421
+ }
422
+
423
+ &--selected:not(.#{$component}__item--submenu)::after {
424
+ content: none;
425
+ }
426
+
427
+ &--disabled {
428
+ color: color-mix(in srgb, var(--#{$prefix}-menu-label) 38%, transparent);
429
+
430
+ .#{$component}__item-icon,
431
+ .#{$component}__item-supporting,
432
+ .#{$component}__item-shortcut {
433
+ color: inherit;
434
+ }
435
+ }
436
+
437
+ &-icon {
438
+ color: var(--#{$prefix}-menu-supporting);
439
+ margin-inline-end: 12px;
440
+
441
+ svg {
442
+ width: 20px;
443
+ height: 20px;
444
+ }
445
+ }
446
+
447
+ &-shortcut {
448
+ @include m.typography("label-small");
449
+ color: var(--#{$prefix}-menu-supporting);
450
+ }
451
+
452
+ &-label {
453
+ display: flex;
454
+ flex-direction: column;
455
+ justify-content: center;
456
+ flex: 1;
457
+ min-width: 0;
458
+ }
459
+
460
+ &-supporting {
461
+ @include m.typography("body-medium");
462
+ color: var(--#{$prefix}-menu-supporting);
463
+ white-space: nowrap;
464
+ overflow: hidden;
465
+ text-overflow: ellipsis;
466
+ }
467
+
468
+ &--selected {
469
+ .#{$component}__item-icon,
470
+ .#{$component}__item-shortcut,
471
+ .#{$component}__item-supporting {
472
+ color: inherit;
473
+ }
474
+ }
475
+ }
476
+
477
+ .#{$component}__divider {
478
+ margin: 6px 0;
479
+ }
480
+ }
481
+
482
+ &--vertical:has(.#{$component}__group) {
483
+ background-color: transparent;
484
+ box-shadow: none;
485
+ padding: 0;
486
+
487
+ overflow: visible;
488
+
489
+ .#{$component}__list {
490
+ overflow: visible;
491
+ gap: 2px;
492
+ }
493
+
494
+ .#{$component}__group {
495
+ background-color: var(--#{$prefix}-menu-container);
496
+ padding: 4px;
497
+ @include m.elevation(2);
498
+
499
+ border-radius: v.shape("small");
500
+
501
+ &:first-child {
502
+ @include d.corners($start-start: v.shape("large"), $start-end: v.shape("large"), $arm: false);
503
+ }
504
+
505
+ &:last-child {
506
+ @include d.corners($end-start: v.shape("large"), $end-end: v.shape("large"), $arm: false);
507
+ }
508
+
509
+ + .#{$component}__group {
510
+ margin-top: 0;
511
+ }
512
+
513
+ > ul {
514
+ display: flex;
515
+ flex-direction: column;
516
+ gap: 2px;
517
+ }
518
+ }
519
+ }
520
+
521
+ &--vertical {
522
+ transition:
523
+ transform v.motion("duration-medium1") v.motion("easing-emphasized"),
524
+ opacity v.motion("duration-medium1") v.motion("easing-emphasized"),
525
+ visibility v.motion("duration-medium1"),
526
+ border-radius v.motion("spring-fast-spatial-duration")
527
+ v.motion("spring-fast-spatial-easing");
528
+
529
+ &.#{$component}--active {
530
+ border-radius: 24px;
531
+ }
532
+
533
+ &.#{$component}--inactive {
534
+ border-radius: v.shape("small");
535
+ }
536
+ }
537
+
538
+ @include mirrored {
539
+ transform-origin: top right;
540
+ }
541
+
542
+ [dir='rtl'] &--position-top,
543
+ &.#{$component}--rtl.#{$component}--position-top {
544
+ transform-origin: bottom right;
545
+ }
546
+
547
+ @include mirrored {
548
+ .#{$component}__item--submenu {
549
+ padding-right: 16px;
550
+ padding-left: 48px;
551
+
552
+ &::after {
553
+ right: auto;
554
+ left: 16px;
555
+ transform: translateY(-50%) rotate(180deg);
556
+ }
557
+ }
558
+ }
715
559
  }