mtrl 0.8.0-next.18 → 0.8.0-next.20

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.
@@ -1,6 +1,34 @@
1
1
  /**
2
2
  * Menu position options for alignment relative to opener element
3
3
  */
4
+ /**
5
+ * Menu variants
6
+ *
7
+ * The baseline menu is the original M3 design: square-ish corners, a
8
+ * surface-container container, and items that fill the width. The vertical
9
+ * menu is the M3 expressive one: a 16dp container holding 44dp items that
10
+ * sit 2dp apart and change shape as they are hovered, focused, pressed or
11
+ * selected. New designs should take the vertical variant.
12
+ * @category Components
13
+ */
14
+ export declare const MENU_VARIANTS: {
15
+ /** The original M3 menu (default, for compatibility) */
16
+ readonly BASELINE: "baseline";
17
+ /** The M3 expressive vertical menu */
18
+ readonly VERTICAL: "vertical";
19
+ };
20
+ /**
21
+ * Colour mappings for the vertical menu
22
+ *
23
+ * Standard is surface-based and carries lower emphasis; vibrant is
24
+ * tertiary-based, is more prominent, and should be used sparingly
25
+ * (m3.material.io menu guidelines, "Color options").
26
+ * @category Components
27
+ */
28
+ export declare const MENU_COLORS: {
29
+ readonly STANDARD: "standard";
30
+ readonly VIBRANT: "vibrant";
31
+ };
4
32
  export declare const MENU_POSITION: {
5
33
  /** Places menu below the opener, aligned to left edge */
6
34
  readonly BOTTOM_START: "bottom-start";
@@ -31,6 +59,10 @@ export declare const MENU_POSITION: {
31
59
  * Default configuration values for menus
32
60
  */
33
61
  export declare const MENU_DEFAULTS: {
62
+ /** Default variant; the baseline menu, so existing menus are untouched */
63
+ readonly VARIANT: "baseline";
64
+ /** Default colour mapping for the vertical variant */
65
+ readonly COLOR: "standard";
34
66
  /** Default menu position */
35
67
  readonly POSITION: "bottom-start";
36
68
  /** Default offset from the opener (in pixels) */
@@ -61,6 +61,11 @@ export interface MenuItem {
61
61
  * Shown at the end of the menu item
62
62
  */
63
63
  shortcut?: string;
64
+ /**
65
+ * A second line under the label, for a short explanation of the item
66
+ * (vertical menus only)
67
+ */
68
+ supportingText?: string;
64
69
  /**
65
70
  * Whether the menu item is disabled
66
71
  * Disabled items cannot be clicked but remain visible
@@ -108,6 +113,10 @@ export type MenuContent = MenuItem | MenuDivider;
108
113
  *
109
114
  * @category Components
110
115
  */
116
+ /** Menu variants */
117
+ export type MenuVariant = "baseline" | "vertical";
118
+ /** Colour mappings for the vertical menu */
119
+ export type MenuColor = "standard" | "vibrant";
111
120
  export interface MenuConfig {
112
121
  /**
113
122
  * Element to which the menu will be openered
@@ -124,6 +133,18 @@ export interface MenuConfig {
124
133
  * Position of the menu relative to the opener
125
134
  * @default 'bottom-start'
126
135
  */
136
+ /**
137
+ * Menu variant. `'vertical'` is the M3 expressive menu: a rounded
138
+ * 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.
141
+ */
142
+ variant?: MenuVariant;
143
+ /**
144
+ * Colour mapping for the vertical variant. `'vibrant'` is tertiary-based
145
+ * and more prominent, so it should be used sparingly.
146
+ */
147
+ color?: MenuColor;
127
148
  position?: MenuPosition;
128
149
  /**
129
150
  * Whether the menu should close when an item is clicked