mtrl 0.8.0-next.26 → 0.8.0-next.28

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.
@@ -165,7 +165,7 @@ export interface DialogConfig {
165
165
  zIndex?: number;
166
166
  /**
167
167
  * Duration of open/close animations in milliseconds
168
- * @default 300
168
+ * @default 150
169
169
  */
170
170
  animationDuration?: number;
171
171
  /**
@@ -92,7 +92,7 @@ export interface DrawerConfig extends BaseComponentConfig {
92
92
  items?: DrawerItemConfig[];
93
93
  /**
94
94
  * Drawer width as a CSS value
95
- * @default '360px'
95
+ * @default 360
96
96
  */
97
97
  width?: string | number;
98
98
  /**
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Keeps track of which menu is open, so that opening one closes the last.
3
+ *
4
+ * A menu button's menu is dismissed once the interaction moves outside it, so
5
+ * two menus should never be open together: the screen reader would be told
6
+ * there are two, since both openers carry aria-expanded="true".
7
+ *
8
+ * Menus used to rely on the document click listener each open menu installs to
9
+ * notice a click elsewhere and close. That never fired for another menu's
10
+ * opener, because the opener stops the click from propagating, so menus piled
11
+ * up. Announcing the open here does not depend on how the menu was opened,
12
+ * which the click path could never cover: a menu opened by keyboard or by code
13
+ * closes the previous one just the same.
14
+ *
15
+ * Only root menus take part. Submenus belong to their parent, which closes them.
16
+ */
17
+ /** What the registry needs of a menu: a way to close it */
18
+ export interface RegisteredMenu {
19
+ close: (event?: Event) => void;
20
+ }
21
+ /**
22
+ * Announces that a menu has opened, closing whichever was open before.
23
+ *
24
+ * @param menu - The menu that is opening
25
+ * @param event - The event that opened it, passed to the menu being closed
26
+ */
27
+ export declare const menuOpened: (menu: RegisteredMenu, event?: Event) => void;
28
+ /**
29
+ * Announces that a menu has closed. Closing a menu that is not the open one is
30
+ * a no-op, which is what makes the call safe from any close path, including
31
+ * destroy.
32
+ *
33
+ * @param menu - The menu that is closing
34
+ */
35
+ export declare const menuClosed: (menu: RegisteredMenu) => void;
36
+ /** The menu that is currently open, if any. Exported for tests */
37
+ export declare const currentlyOpenMenu: () => RegisteredMenu | null;
@@ -129,15 +129,11 @@ export interface MenuConfig {
129
129
  * Array of menu items and dividers to display
130
130
  */
131
131
  items: MenuContent[];
132
- /**
133
- * Position of the menu relative to the opener
134
- * @default 'bottom-start'
135
- */
136
132
  /**
137
133
  * Menu variant. `'vertical'` is the M3 expressive menu: a rounded
138
134
  * container holding items that sit apart and change shape as they are
139
- * hovered, focused, pressed or selected. Defaults to `'baseline'`, the
140
- * original M3 menu.
135
+ * hovered, focused, pressed or selected.
136
+ * @default 'baseline'
141
137
  */
142
138
  variant?: MenuVariant;
143
139
  /**
@@ -145,6 +141,10 @@ export interface MenuConfig {
145
141
  * and more prominent, so it should be used sparingly.
146
142
  */
147
143
  color?: MenuColor;
144
+ /**
145
+ * Position of the menu relative to the opener
146
+ * @default 'bottom-start'
147
+ */
148
148
  position?: MenuPosition;
149
149
  /**
150
150
  * Whether the menu should close when an item is clicked
@@ -183,7 +183,7 @@ export interface MenuConfig {
183
183
  maxHeight?: string;
184
184
  /**
185
185
  * Optional offset from the opener (in pixels)
186
- * @default 8
186
+ * @default 0
187
187
  */
188
188
  offset?: number;
189
189
  /**
@@ -55,7 +55,7 @@ export interface ProgressConfig {
55
55
  /**
56
56
  * Thickness of the progress track and indicator
57
57
  * Can be a named preset ('thin', 'default', 'thick') or a specific number in pixels
58
- * @default 'default'
58
+ * @default 'thin'
59
59
  */
60
60
  thickness?: ProgressThickness;
61
61
  /**
@@ -109,7 +109,7 @@ export interface ProgressConfig {
109
109
  /**
110
110
  * Size of the circular progress indicator in dp (only for circular variant)
111
111
  * Clamped between 24 and 240
112
- * @default 50
112
+ * @default 40 (48 when wavy)
113
113
  */
114
114
  size?: number;
115
115
  }