@fluentui-react-native/menu 0.16.0 → 1.0.2
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.
- package/CHANGELOG.json +46 -1
- package/CHANGELOG.md +26 -2
- package/MIGRATION.md +323 -0
- package/SPEC.md +405 -0
- package/assets/Menu.png +0 -0
- package/assets/Submenu.png +0 -0
- package/assets/checkbox.png +0 -0
- package/lib/MenuItem/useMenuItem.d.ts +2 -0
- package/lib/MenuItem/useMenuItem.d.ts.map +1 -1
- package/lib/MenuItem/useMenuItem.js +17 -28
- package/lib/MenuItem/useMenuItem.js.map +1 -1
- package/lib/MenuItemCheckbox/useMenuItemCheckbox.d.ts.map +1 -1
- package/lib/MenuItemCheckbox/useMenuItemCheckbox.js +23 -9
- package/lib/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib/MenuList/MenuList.types.d.ts +1 -0
- package/lib/MenuList/MenuList.types.d.ts.map +1 -1
- package/lib/MenuList/useMenuList.d.ts.map +1 -1
- package/lib/MenuList/useMenuList.js +13 -1
- package/lib/MenuList/useMenuList.js.map +1 -1
- package/lib/MenuTrigger/MenuTrigger.js +1 -1
- package/lib/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib/context/menuListContext.d.ts.map +1 -1
- package/lib/context/menuListContext.js +1 -0
- package/lib/context/menuListContext.js.map +1 -1
- package/lib-commonjs/MenuItem/useMenuItem.d.ts +2 -0
- package/lib-commonjs/MenuItem/useMenuItem.d.ts.map +1 -1
- package/lib-commonjs/MenuItem/useMenuItem.js +19 -30
- package/lib-commonjs/MenuItem/useMenuItem.js.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/useMenuItemCheckbox.d.ts.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/useMenuItemCheckbox.js +20 -6
- package/lib-commonjs/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/MenuList/MenuList.types.d.ts +1 -0
- package/lib-commonjs/MenuList/MenuList.types.d.ts.map +1 -1
- package/lib-commonjs/MenuList/useMenuList.d.ts.map +1 -1
- package/lib-commonjs/MenuList/useMenuList.js +13 -1
- package/lib-commonjs/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/MenuTrigger/MenuTrigger.js +1 -1
- package/lib-commonjs/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib-commonjs/context/menuListContext.d.ts.map +1 -1
- package/lib-commonjs/context/menuListContext.js +1 -0
- package/lib-commonjs/context/menuListContext.js.map +1 -1
- package/package.json +2 -2
- package/src/MenuItem/useMenuItem.ts +21 -34
- package/src/MenuItemCheckbox/useMenuItemCheckbox.ts +32 -7
- package/src/MenuList/MenuList.types.ts +1 -0
- package/src/MenuList/useMenuList.ts +18 -1
- package/src/MenuTrigger/MenuTrigger.tsx +1 -1
- package/src/context/menuListContext.ts +1 -0
package/SPEC.md
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
# Menu
|
|
2
|
+
|
|
3
|
+
## Background
|
|
4
|
+
|
|
5
|
+
A `Menu` is an component that displays a list of options on a temporary surface. They are invoked when users interact with a button, action, or other control.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
If using FURN's theming, the `Menu` and its sub-components require use of the `ThemeProvider` from `@fluentui-react-native/theme` to work properly with themes. Please see [this page](../../../docs/pages/Guides/UpdateThemeProvider.md) for information on updating your `ThemeProvider` if using the version from `@uifabricshared/theming-react-native`.
|
|
10
|
+
|
|
11
|
+
## Sample code
|
|
12
|
+
|
|
13
|
+
The below samples do not represent the definitive props of the final implemented component, but represent the ideal final implementations. Can be subject to change during the implementation phase.
|
|
14
|
+
|
|
15
|
+
### Basic Menu
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
const menu = (
|
|
21
|
+
<Menu>
|
|
22
|
+
<MenuTrigger>
|
|
23
|
+
<Button>Open menu</Button>
|
|
24
|
+
</MenuTrigger>
|
|
25
|
+
<MenuPopover>
|
|
26
|
+
<MenuList>
|
|
27
|
+
<MenuItem>Option 1</MenuItem>
|
|
28
|
+
<MenuItem>Option 2</MenuItem>
|
|
29
|
+
<MenuItem>Option 3</MenuItem>
|
|
30
|
+
</MenuList>
|
|
31
|
+
</MenuPopover>
|
|
32
|
+
</Menu>
|
|
33
|
+
);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Submenus
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
const menu = (
|
|
42
|
+
<Menu>
|
|
43
|
+
<MenuTrigger>
|
|
44
|
+
<Button>Open menu</Button>
|
|
45
|
+
</MenuTrigger>
|
|
46
|
+
<MenuPopover>
|
|
47
|
+
<MenuList>
|
|
48
|
+
<MenuItem>Option 1</MenuItem>
|
|
49
|
+
<Menu>
|
|
50
|
+
<MenuTrigger>
|
|
51
|
+
<MenuItem>Open submenu</MenuItem>
|
|
52
|
+
</MenuTrigger>
|
|
53
|
+
<MenuPopover>
|
|
54
|
+
<MenuList>
|
|
55
|
+
<MenuItem>Option 1</MenuItem>
|
|
56
|
+
<MenuItem>Option 2</MenuItem>
|
|
57
|
+
<MenuItem>Option 3</MenuItem>
|
|
58
|
+
</MenuList>
|
|
59
|
+
</MenuPopover>
|
|
60
|
+
</Menu>
|
|
61
|
+
</MenuList>
|
|
62
|
+
</MenuPopover>
|
|
63
|
+
</Menu>
|
|
64
|
+
);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Selection
|
|
68
|
+
|
|
69
|
+

|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
const [selectedItems, setSelectedItems] = React.useState([]);
|
|
73
|
+
const onCheckedChange = React.useCallback(
|
|
74
|
+
(e, checked) => {
|
|
75
|
+
setSelectedItems(checked);
|
|
76
|
+
},
|
|
77
|
+
[setSelectedItems],
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const menuCheckbox = (
|
|
81
|
+
<Menu checked={selectedItems} onCheckedChange={onCheckedChange}>
|
|
82
|
+
<MenuTrigger>
|
|
83
|
+
<Button>Open menu</Button>
|
|
84
|
+
</MenuTrigger>
|
|
85
|
+
<MenuPopover>
|
|
86
|
+
<MenuList>
|
|
87
|
+
<MenuItemCheckbox name="checkbox1">Option 1</MenuItemCheckbox>
|
|
88
|
+
<MenuItemCheckbox name="checkbox2">Option 2</MenuItemCheckbox>
|
|
89
|
+
<MenuItemCheckbox name="checkbox3">Option 3</MenuItemCheckbox>
|
|
90
|
+
</MenuList>
|
|
91
|
+
</MenuPopover>
|
|
92
|
+
</Menu>
|
|
93
|
+
);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Variants
|
|
97
|
+
|
|
98
|
+
### Nested menus
|
|
99
|
+
|
|
100
|
+
A `Menu` should be able to trigger a submenu, or an additional instance of `Menu`, as a part of one or more of its options. The nested `Menu` component should have the same functional capabilities as the root `Menu` component, however it will have some default behavioral differences.
|
|
101
|
+
|
|
102
|
+
Nested menus are by default triggered by hovering over a trigger, but can also be opened by invoking the trigger component for the nested `Menu`.
|
|
103
|
+
|
|
104
|
+
### Selection state
|
|
105
|
+
|
|
106
|
+
A `Menu` should be able to track and represent the selection, or checked, state of its options.
|
|
107
|
+
|
|
108
|
+
When an option has a configurable selection state, it does not dismiss the `Menu` when toggled, as opposed to other options which close the `Menu` on being invoked by default.
|
|
109
|
+
|
|
110
|
+
### Sections
|
|
111
|
+
|
|
112
|
+
A `Menu` can be divided into sections using dividers. The `Menu` does not support `MenuGroups` yet, but can visually represent sections using `MenuDividers`.
|
|
113
|
+
|
|
114
|
+
### Disabled option(s)
|
|
115
|
+
|
|
116
|
+
All options in a `Menu` component can be disabled and should provide a visible indication for this purpose. Although disabled actions cannot be invoked, they are keyboard focusable for the purposes of accessibility.
|
|
117
|
+
|
|
118
|
+
## API
|
|
119
|
+
|
|
120
|
+
### Menu
|
|
121
|
+
|
|
122
|
+
The root level component serves as a simplified interface for configuring the triggering of a Menu.
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
export interface MenuProps extends MenuListProps {
|
|
126
|
+
/**
|
|
127
|
+
* Whether the popup is open on mount
|
|
128
|
+
*/
|
|
129
|
+
defaultOpen?: boolean;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* How much delay to have between hover in and showing the menu, in ms.
|
|
133
|
+
*/
|
|
134
|
+
hoverDelay?: number;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Whether the popup is open
|
|
138
|
+
*/
|
|
139
|
+
open?: boolean;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Call back when the component requests to change value
|
|
143
|
+
*/
|
|
144
|
+
onOpenChange?: (e: InteractionEvent, isOpen: boolean) => void;
|
|
145
|
+
|
|
146
|
+
/*
|
|
147
|
+
* Opens the menu on hovering over the trigger
|
|
148
|
+
*/
|
|
149
|
+
openOnHover?: boolean;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Do not dismiss the menu when a menu item is clicked
|
|
153
|
+
*/
|
|
154
|
+
persistOnItemClick?: boolean;
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### MenuTrigger
|
|
159
|
+
|
|
160
|
+
A non-visual component that wraps its child and configures them to be the trigger that will open a menu. This component should only accept one child. Accepts no other props.
|
|
161
|
+
|
|
162
|
+
### MenuPopover
|
|
163
|
+
|
|
164
|
+
This component provides the temporary surface that will host the `Menu`'s options.
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
export type MenuPopoverProps = ICalloutProps;
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### MenuList
|
|
171
|
+
|
|
172
|
+
This component is used internally by `Menu` and manages the context and layout of its items.
|
|
173
|
+
|
|
174
|
+
#### MenuList Props
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
export type MenuListProps = {
|
|
178
|
+
/**
|
|
179
|
+
* Array of all checked items
|
|
180
|
+
*/
|
|
181
|
+
checked?: string[];
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Default items to be checked on mount
|
|
185
|
+
*/
|
|
186
|
+
defaultChecked?: string[];
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* States that menu items can contain selectable items and reserves space for item alignment
|
|
190
|
+
*/
|
|
191
|
+
hasCheckmarks?: boolean;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Callback when checked items change
|
|
195
|
+
*
|
|
196
|
+
* @param checked Array of all currently checked values
|
|
197
|
+
*/
|
|
198
|
+
onCheckedChange?: (e: InteractionEvent, checked[]) => void;
|
|
199
|
+
|
|
200
|
+
};
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### MenuList Tokens
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
export interface MenuListTokens extends LayoutTokens, IBackgroundColorTokens {
|
|
207
|
+
/**
|
|
208
|
+
* Space between items in pixels
|
|
209
|
+
*/
|
|
210
|
+
gap?: number;
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### MenuList Slots
|
|
215
|
+
|
|
216
|
+
- `root` - The container of the `Menu`'s options that wraps all `children`.
|
|
217
|
+
|
|
218
|
+
### MenuDivider
|
|
219
|
+
|
|
220
|
+
Creates a divider element in the `MenuList`. This divider is purely visual and does not handle any grouping logic of the options in the `MenuList`.
|
|
221
|
+
|
|
222
|
+
### MenuItem
|
|
223
|
+
|
|
224
|
+
#### MenuItem Props
|
|
225
|
+
|
|
226
|
+
```ts
|
|
227
|
+
export interface MenuItemProps extends Omit<IWithPressableOptions<ViewProps>, 'onPress'> {
|
|
228
|
+
/**
|
|
229
|
+
* A RefObject to access the IButton interface. Use this to access the public methods and properties of the component.
|
|
230
|
+
*/
|
|
231
|
+
componentRef?: React.RefObject<IFocusable>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* A callback to call on button click event
|
|
235
|
+
*/
|
|
236
|
+
onClick?: (e: InteractionEvent) => void;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Do not dismiss the menu when a menu item is clicked
|
|
240
|
+
*/
|
|
241
|
+
persistOnClick?: boolean;
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### MenuItem Tokens
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
export interface MenuItemTokens extends LayoutTokens, FontTokens, IBorderTokens, IColorTokens {
|
|
249
|
+
/**
|
|
250
|
+
* Height and width in pixels of the space that is reserved to align the item's text with other items which have checkmarks
|
|
251
|
+
*/
|
|
252
|
+
checkmarkSize?: number;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Amount of space in pixels around the indicator that shows that an item has a submenu
|
|
256
|
+
*/
|
|
257
|
+
submenuIndicatorPadding?: number;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Height and width in pixels of the indicator that shows that an item has a submenu
|
|
261
|
+
*/
|
|
262
|
+
submenuIndicatorSize?: number;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Space between parts of the item control in pixels
|
|
266
|
+
*/
|
|
267
|
+
gap?: number;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* States of the item control
|
|
271
|
+
*/
|
|
272
|
+
disabled?: MenuItemTokens;
|
|
273
|
+
focused?: MenuItemTokens;
|
|
274
|
+
hovered?: MenuItemTokens;
|
|
275
|
+
pressed?: MenuItemTokens;
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
#### MenuItem Slots
|
|
280
|
+
|
|
281
|
+
- `root` - The outer container representing the `MenuItem` itself that wraps everything passed via the `children` prop.
|
|
282
|
+
- `content` - If specified, renders the `content` prop as text.
|
|
283
|
+
- `checkmark` - If specified, renders space such that the `content` aligns with other items which have checkmarks. Only used when the `Menu` has `hasCheckmarks`.
|
|
284
|
+
- `submenuIndicator` - If specified, renders an SVG which indicates that the `MenuItem` is a trigger for a nested `Menu`.
|
|
285
|
+
|
|
286
|
+
### MenuItemCheckbox/Radio
|
|
287
|
+
|
|
288
|
+
Variants of `MenuItem` that allows a single or multiple selection state based on the value that it represents. These `MenuItems` do not support submenus. `MenuItemCheckbox` and `MenuItemRadio` share the same types for props, tokens, and slots.
|
|
289
|
+
|
|
290
|
+
#### MenuItemCheckbox/Radio Props
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
export interface MenuItemCheckboxProps extends Omit<IWithPressableOptions<ViewProps>, 'onPress'> {
|
|
294
|
+
/**
|
|
295
|
+
* A RefObject to access the IButton interface. Use this to access the public methods and properties of the component.
|
|
296
|
+
*/
|
|
297
|
+
componentRef?: React.RefObject<IFocusable>;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Identifier for the control
|
|
301
|
+
*/
|
|
302
|
+
name: string;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Do not dismiss the menu when a menu item is clicked
|
|
306
|
+
*/
|
|
307
|
+
persistOnClick?: boolean;
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
#### MenuItemCheckbox/Radio Tokens
|
|
312
|
+
|
|
313
|
+
```ts
|
|
314
|
+
export interface MenuItemCheckboxTokens extends LayoutTokens, FontTokens, IBorderTokens, IColorTokens {
|
|
315
|
+
/**
|
|
316
|
+
* Color of the checkmark icon
|
|
317
|
+
*/
|
|
318
|
+
checkmarkColor?: ColorValue;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Amount of space in pixels around the checkmark icon
|
|
322
|
+
*/
|
|
323
|
+
checkmarkPadding?: number;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Height and width in pixels of the checkmark icon
|
|
327
|
+
*/
|
|
328
|
+
checkmarkSize?: number;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Opacity of the checkmark icon from 0 to 1
|
|
332
|
+
*/
|
|
333
|
+
checkmarkVisibility?: number;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Space between parts of the item control in pixels
|
|
337
|
+
*/
|
|
338
|
+
gap?: number;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* States of the item control
|
|
342
|
+
*/
|
|
343
|
+
checked?: MenuItemCheckboxTokens;
|
|
344
|
+
disabled?: MenuItemCheckboxTokens;
|
|
345
|
+
focused?: MenuItemCheckboxTokens;
|
|
346
|
+
hovered?: MenuItemCheckboxTokens;
|
|
347
|
+
pressed?: MenuItemCheckboxTokens;
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
#### MenuItemCheckbox/Radio Slots
|
|
352
|
+
|
|
353
|
+
- `root` - The outer container representing the `MenuItem` itself that wraps everything passed via the `children` prop.
|
|
354
|
+
- `content` - If specified, renders the `content` prop as text.
|
|
355
|
+
- `checkmark` - If specified, renders an SVG which indicates that the `MenuItem` is selected.
|
|
356
|
+
|
|
357
|
+
## Behaviors
|
|
358
|
+
|
|
359
|
+
### Mouse interactions
|
|
360
|
+
|
|
361
|
+
- Clicking on a menu's trigger will open the menu
|
|
362
|
+
- Clicking outside of a menu's trigger and popover will light dismiss the menu
|
|
363
|
+
- Clicking on a `MenuItem` which is not configured to track selection will invoke the `MenuItem` and close the menu by default
|
|
364
|
+
- Clicking on a `MenuItem` variant which is configured to track selection will toggle its selection state in the configured way and not close the menu.
|
|
365
|
+
- If the menu is configured to open on hover, it will only close once the mouse leaves both the trigger and the popover. There is a delay for this behavior.
|
|
366
|
+
- Submenus are configured to open on hover by default. If the mouse stops hovering over the submenu, only the submenu will close.
|
|
367
|
+
|
|
368
|
+
### Keyboard interactions
|
|
369
|
+
|
|
370
|
+
- When a menu is invoked via keyboard, open the menu and place focus on the first focusable element by default.
|
|
371
|
+
- Up and down inside of the menu that has focus should navigate vertically between keyboard focusable elements
|
|
372
|
+
- On win32, up and down should circularly navigate through a list of menu items. On MacOS, circular navigation does not occur.
|
|
373
|
+
- Right key on a menu item that has an available submenu or split button should invoke the submenu, and move focus into it onto the first focusable item (Left in RTL)
|
|
374
|
+
- Left key when in a submenu should close the submenu and place focus back on the parent menu's item that opened the submenu. (Right in RTL)
|
|
375
|
+
- ESC on a menu should close the currently focused menu. If focus is in a submenu and ESC is hit, it should only close the current submenu and return focus to the parent's element where focus was previously.
|
|
376
|
+
- Space and Enter key execute the action that is currently focused in the menu.
|
|
377
|
+
|
|
378
|
+
### MenuItem selection
|
|
379
|
+
|
|
380
|
+
Below are the interactions that should be supported for all menu items that are required to handle a selection state.
|
|
381
|
+
|
|
382
|
+
In the event that the selection method is a radio, the previous selected item must be unselected.
|
|
383
|
+
|
|
384
|
+
| Type | Action | Result | Details |
|
|
385
|
+
| ------------- | ------ | ------ | -------------------------------------------- |
|
|
386
|
+
| Keyboard | Space | Toggle | Toggle the selection status of the menu item |
|
|
387
|
+
| Keyboard | Enter | Toggle | Toggle the selection status of the menu item |
|
|
388
|
+
| Mouse | Click | Toggle | Toggle the selection status of the menu item |
|
|
389
|
+
| Accessibility | Toggle | Toggle | Toggle the selection status of the menu item |
|
|
390
|
+
|
|
391
|
+
### Positioning
|
|
392
|
+
|
|
393
|
+
#### Menu positioning
|
|
394
|
+
|
|
395
|
+
The default positioning for the root `Menu` is below the trigger and aligned with the left (or right in RTL) edge.
|
|
396
|
+
|
|
397
|
+
#### Submenu positioning
|
|
398
|
+
|
|
399
|
+
The default positioning for a submenu is to the right of the menu item trigger (or left in RTL) and aligned with the top edge.
|
|
400
|
+
|
|
401
|
+
## Accessibility
|
|
402
|
+
|
|
403
|
+
The `MenuTrigger` will set `expand` or `collapsed` state and will respond to actions which explicitly tell it to expand or collapse (win32 only)
|
|
404
|
+
The `MenuPopover` has its role set to `menu`, and `MenuItmes` and variants have their role set to `menuitem`.
|
|
405
|
+
The `MenuItem` variants which track selection have the `Toggle` pattern available.
|
package/assets/Menu.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MenuItemProps, MenuItemState } from './MenuItem.types';
|
|
3
|
+
export declare const triggerKeys: string[];
|
|
4
|
+
export declare const submenuTriggerKeys: string[];
|
|
3
5
|
export declare const useMenuItem: (props: MenuItemProps) => MenuItemState;
|
|
4
6
|
export declare const useHoverFocusEffect: (hovered: boolean, componentRef: React.MutableRefObject<any>) => void;
|
|
5
7
|
//# sourceMappingURL=useMenuItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMenuItem.d.ts","sourceRoot":"","sources":["../../src/MenuItem/useMenuItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"useMenuItem.d.ts","sourceRoot":"","sources":["../../src/MenuItem/useMenuItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAahE,eAAO,MAAM,WAAW,UAAiB,CAAC;AAC1C,eAAO,MAAM,kBAAkB,UAA8C,CAAC;AAE9E,eAAO,MAAM,WAAW,UAAW,aAAa,KAAG,aAqElD,CAAC;AAUF,eAAO,MAAM,mBAAmB,YAAa,OAAO,gBAAgB,MAAM,gBAAgB,CAAC,GAAG,CAAC,SAQ9F,CAAC"}
|
|
@@ -6,50 +6,39 @@ import { isKeyPressEvent, useAsPressable, useKeyDownProps, useViewCommandFocus,
|
|
|
6
6
|
import { useMenuContext } from '../context/menuContext';
|
|
7
7
|
import { useMenuListContext } from '../context/menuListContext';
|
|
8
8
|
import { useMenuTriggerContext } from '../context/menuTriggerContext';
|
|
9
|
-
var triggerKeys = [' ', 'Enter'];
|
|
10
|
-
var submenuTriggerKeys = __spreadArray(__spreadArray([], triggerKeys, true), ['ArrowLeft', 'ArrowRight'], false);
|
|
9
|
+
export var triggerKeys = [' ', 'Enter'];
|
|
10
|
+
export var submenuTriggerKeys = __spreadArray(__spreadArray([], triggerKeys, true), ['ArrowLeft', 'ArrowRight'], false);
|
|
11
11
|
export var useMenuItem = function (props) {
|
|
12
12
|
// attach the pressable state handlers
|
|
13
13
|
var defaultComponentRef = React.useRef(null);
|
|
14
14
|
var onClick = props.onClick, accessibilityState = props.accessibilityState, _a = props.componentRef, componentRef = _a === void 0 ? defaultComponentRef : _a, disabled = props.disabled, persistOnClick = props.persistOnClick, rest = __rest(props, ["onClick", "accessibilityState", "componentRef", "disabled", "persistOnClick"]);
|
|
15
|
+
var _b = useMenuContext(), isSubmenu = _b.isSubmenu, persistOnItemClick = _b.persistOnItemClick, setOpen = _b.setOpen;
|
|
16
|
+
var _c = useMenuListContext(), hasCheckmarks = _c.hasCheckmarks, onArrowClose = _c.onArrowClose;
|
|
15
17
|
var isTrigger = useMenuTriggerContext();
|
|
16
|
-
var
|
|
18
|
+
var shouldPersist = persistOnClick !== null && persistOnClick !== void 0 ? persistOnClick : persistOnItemClick;
|
|
17
19
|
var hasSubmenu = isSubmenu && isTrigger;
|
|
18
|
-
var isInSubmenu = isSubmenu && !isTrigger;
|
|
19
|
-
var shouldPersist = useMenuContext().persistOnItemClick;
|
|
20
|
-
shouldPersist = persistOnClick !== null && persistOnClick !== void 0 ? persistOnClick : shouldPersist;
|
|
21
|
-
var setOpen = useMenuContext().setOpen;
|
|
22
20
|
var onInvoke = React.useCallback(function (e) {
|
|
23
|
-
if (disabled) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
21
|
var isRtl = I18nManager.isRTL;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(
|
|
30
|
-
|
|
22
|
+
var isArrowKey = isKeyPressEvent(e) && (e.nativeEvent.key === 'ArrowLeft' || e.nativeEvent.key === 'ArrowRight');
|
|
23
|
+
var isArrowOpen = hasSubmenu &&
|
|
24
|
+
isKeyPressEvent(e) &&
|
|
25
|
+
((isRtl && e.nativeEvent.key === 'ArrowLeft') || (!isRtl && e.nativeEvent.key === 'ArrowRight'));
|
|
26
|
+
if (!disabled && (!isArrowKey || isArrowOpen)) {
|
|
27
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
31
28
|
}
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
((isRtl && e.nativeEvent.key === 'ArrowLeft') || (!isRtl && e.nativeEvent.key === 'ArrowRight'))) {
|
|
35
|
-
return;
|
|
29
|
+
if (!hasSubmenu && !isArrowKey && !shouldPersist) {
|
|
30
|
+
setOpen(e, false /*isOpen*/, false /*bubble*/);
|
|
36
31
|
}
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
isInSubmenu &&
|
|
41
|
-
((isRtl && e.nativeEvent.key === 'ArrowRight') || (!isRtl && e.nativeEvent.key === 'ArrowLeft'));
|
|
42
|
-
if (isArrowClose || !shouldPersist) {
|
|
43
|
-
setOpen(e, false /*isOpen*/, !isArrowClose /*bubble*/);
|
|
44
|
-
}
|
|
32
|
+
var isArrowClose = isKeyPressEvent(e) && ((isRtl && e.nativeEvent.key === 'ArrowRight') || (!isRtl && e.nativeEvent.key === 'ArrowLeft'));
|
|
33
|
+
if (isArrowClose) {
|
|
34
|
+
onArrowClose === null || onArrowClose === void 0 ? void 0 : onArrowClose(e);
|
|
45
35
|
}
|
|
46
|
-
}, [disabled, hasSubmenu,
|
|
36
|
+
}, [disabled, hasSubmenu, onArrowClose, onClick, setOpen, shouldPersist]);
|
|
47
37
|
var pressable = useAsPressable(__assign(__assign({}, rest), { disabled: disabled, onPress: onInvoke }));
|
|
48
38
|
var itemRef = useViewCommandFocus(componentRef);
|
|
49
39
|
var keys = isSubmenu ? submenuTriggerKeys : triggerKeys;
|
|
50
40
|
// Explicitly override onKeyDown to override the native behavior of moving focus with arrow keys.
|
|
51
41
|
var onKeyDownProps = useKeyDownProps.apply(void 0, __spreadArray([onInvoke], keys, false));
|
|
52
|
-
var hasCheckmarks = useMenuListContext().hasCheckmarks;
|
|
53
42
|
useHoverFocusEffect(pressable.state.hovered, componentRef);
|
|
54
43
|
return {
|
|
55
44
|
props: __assign(__assign(__assign({}, pressable.props), { accessible: true, accessibilityRole: 'menuitem', onAccessibilityTap: props.onAccessibilityTap || onInvoke, accessibilityState: getAccessibilityState(disabled, accessibilityState), enableFocusRing: Platform.select({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMenuItem.js","sourceRoot":"","sources":["../../src/MenuItem/useMenuItem.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAsB,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAEL,eAAe,EACf,cAAc,EACd,eAAe,EACf,mBAAmB,GACpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,IAAM,WAAW,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"useMenuItem.js","sourceRoot":"","sources":["../../src/MenuItem/useMenuItem.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAsB,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAEL,eAAe,EACf,cAAc,EACd,eAAe,EACf,mBAAmB,GACpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,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Y,uBAAZ,YAAY,CAAE,OAAO,0CAAE,IAAI,EAAE,CAAC;SAC/B;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMenuItemCheckbox.d.ts","sourceRoot":"","sources":["../../src/MenuItemCheckbox/useMenuItemCheckbox.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAExF,OAAO,EACL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"useMenuItemCheckbox.d.ts","sourceRoot":"","sources":["../../src/MenuItemCheckbox/useMenuItemCheckbox.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAExF,OAAO,EACL,gBAAgB,EAMjB,MAAM,0CAA0C,CAAC;AAOlD,eAAO,MAAM,mBAAmB,UAAW,qBAAqB,KAAG,qBAgBlE,CAAC;AAUF;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,UAC9B,qBAAqB,sBACR,gBAAgB,KAAK,IAAI,KAC5C,qBA0FF,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __assign, __rest, __spreadArray } from "tslib";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
3
|
+
import { I18nManager, Platform } from 'react-native';
|
|
4
4
|
import { memoize } from '@fluentui-react-native/framework';
|
|
5
|
-
import { useAsPressable,
|
|
5
|
+
import { useAsPressable, useKeyDownProps, useOnPressWithFocus, useViewCommandFocus, } from '@fluentui-react-native/interactive-hooks';
|
|
6
6
|
import { useMenuListContext } from '../context/menuListContext';
|
|
7
|
-
import { useHoverFocusEffect } from '../MenuItem/useMenuItem';
|
|
7
|
+
import { submenuTriggerKeys, triggerKeys, useHoverFocusEffect } from '../MenuItem/useMenuItem';
|
|
8
|
+
import { useMenuContext } from '../context/menuContext';
|
|
8
9
|
var defaultAccessibilityActions = [{ name: 'Toggle' }];
|
|
9
10
|
export var useMenuItemCheckbox = function (props) {
|
|
10
11
|
var _a;
|
|
@@ -35,16 +36,29 @@ function getAccessibilityStateWorker(disabled, checked, accessibilityState) {
|
|
|
35
36
|
* @returns Props and additional state needed to render the component
|
|
36
37
|
*/
|
|
37
38
|
export var useMenuCheckboxInteraction = function (props, toggleCallback) {
|
|
38
|
-
var _a;
|
|
39
39
|
var defaultComponentRef = React.useRef(null);
|
|
40
|
-
var accessibilityActions = props.accessibilityActions, accessibilityLabel = props.accessibilityLabel, accessibilityState = props.accessibilityState,
|
|
41
|
-
var
|
|
42
|
-
var
|
|
40
|
+
var accessibilityActions = props.accessibilityActions, accessibilityLabel = props.accessibilityLabel, accessibilityState = props.accessibilityState, _a = props.componentRef, componentRef = _a === void 0 ? defaultComponentRef : _a, disabled = props.disabled, name = props.name, onAccessibilityAction = props.onAccessibilityAction, rest = __rest(props, ["accessibilityActions", "accessibilityLabel", "accessibilityState", "componentRef", "disabled", "name", "onAccessibilityAction"]);
|
|
41
|
+
var isSubmenu = useMenuContext().isSubmenu;
|
|
42
|
+
var _b = useMenuListContext(), checked = _b.checked, onArrowClose = _b.onArrowClose;
|
|
43
|
+
var isChecked = checked === null || checked === void 0 ? void 0 : checked[name];
|
|
43
44
|
// Ensure focus is placed on checkbox after click
|
|
44
45
|
var toggleCheckedWithFocus = useOnPressWithFocus(componentRef, toggleCallback);
|
|
45
46
|
var pressable = useAsPressable(__assign(__assign({}, rest), { disabled: disabled, onPress: toggleCheckedWithFocus }));
|
|
46
47
|
var buttonRef = useViewCommandFocus(componentRef);
|
|
47
|
-
var
|
|
48
|
+
var onKeysPressed = React.useCallback(function (e) {
|
|
49
|
+
var invokeKey = e.nativeEvent.key === ' ' || e.nativeEvent.key === 'Enter';
|
|
50
|
+
if (!disabled && invokeKey) {
|
|
51
|
+
toggleCallback(e);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
var isRtl = I18nManager.isRTL;
|
|
55
|
+
var isArrowClose = isSubmenu && ((isRtl && e.nativeEvent.key === 'ArrowRight') || (!isRtl && e.nativeEvent.key === 'ArrowLeft'));
|
|
56
|
+
if (isArrowClose) {
|
|
57
|
+
onArrowClose === null || onArrowClose === void 0 ? void 0 : onArrowClose(e);
|
|
58
|
+
}
|
|
59
|
+
}, [disabled, isSubmenu, onArrowClose, toggleCallback]);
|
|
60
|
+
var keys = isSubmenu ? submenuTriggerKeys : triggerKeys;
|
|
61
|
+
var onKeyProps = useKeyDownProps.apply(void 0, __spreadArray([onKeysPressed], keys, false));
|
|
48
62
|
var accessibilityActionsProp = accessibilityActions
|
|
49
63
|
? __spreadArray(__spreadArray([], defaultAccessibilityActions, true), accessibilityActions, true) : defaultAccessibilityActions;
|
|
50
64
|
var onAccessibilityActionProp = React.useCallback(function (event) {
|
|
@@ -56,7 +70,7 @@ export var useMenuCheckboxInteraction = function (props, toggleCallback) {
|
|
|
56
70
|
}
|
|
57
71
|
}, [disabled, toggleCallback, onAccessibilityAction]);
|
|
58
72
|
useHoverFocusEffect(pressable.state.hovered, componentRef);
|
|
59
|
-
var state = __assign(__assign({}, pressable.state), { disabled: !!props.disabled, checked:
|
|
73
|
+
var state = __assign(__assign({}, pressable.state), { disabled: !!props.disabled, checked: isChecked });
|
|
60
74
|
return {
|
|
61
75
|
props: __assign(__assign(__assign({}, pressable.props), { accessible: true, accessibilityActions: accessibilityActionsProp, accessibilityLabel: accessibilityLabel, accessibilityRole: 'menuitem', accessibilityState: getAccessibilityState(disabled, state.checked, accessibilityState), enableFocusRing: Platform.select({
|
|
62
76
|
macos: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMenuItemCheckbox.js","sourceRoot":"","sources":["../../src/MenuItemCheckbox/useMenuItemCheckbox.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/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AAC,KAAK,CAAC,CAAC;SACvD;IACH,CAAC,EACD,CAAC,QAAQ,EAAE,cAAc,EAAE,qBAAqB,CAAC,CAClD,CAAC;IAEF,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAE3D,IAAM,KAAK,yBACN,SAAS,CAAC,KAAK,KAClB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,EAC1B,OAAO,EAAE,SAAS,GACnB,CAAC;IAEF,OAAO;QACL,KAAK,iCACA,SAAS,CAAC,KAAK,KAClB,UAAU,EAAE,IAAI,EAChB,oBAAoB,EAAE,wBAAwB,EAC9C,kBAAkB,oBAAA,EAClB,iBAAiB,EAAE,UAAU,EAC7B,kBAAkB,EAAE,qBAAqB,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,EACtF,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC;gBAC/B,KAAK,EAAE,KAAK;gBACZ,OAAO,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ;aAC5C,CAAC,EACF,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACzB,KAAK,EAAE,CAAC,QAAQ;gBAChB,OAAO,EAAE,IAAI,EAAE,QAAQ;aACxB,CAAC,EACF,qBAAqB,EAAE,yBAAyB,EAChD,GAAG,EAAE,SAAS,KACX,UAAU,CACd;QACD,KAAK,EAAE,KAAK;KACb,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -33,6 +33,7 @@ export interface MenuListState extends Omit<MenuListProps, 'checked' | 'onChecke
|
|
|
33
33
|
props: MenuListProps;
|
|
34
34
|
checked?: Record<string, boolean>;
|
|
35
35
|
isCheckedControlled: boolean;
|
|
36
|
+
onArrowClose?: (e: InteractionEvent) => void;
|
|
36
37
|
onCheckedChange?: (e: InteractionEvent, name: string, isChecked: boolean) => void;
|
|
37
38
|
selectRadio?: (e: InteractionEvent, name: string) => void;
|
|
38
39
|
addRadioItem: (name: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuList.types.d.ts","sourceRoot":"","sources":["../../src/MenuList/MenuList.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,YAAY,aAAa,CAAC;AAEvC,MAAM,WAAW,cAAe,SAAQ,YAAY,EAAE,sBAAsB;IAC1E;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC;IAChE;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACpE;AAED,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,iBAAiB,CAAC;IACvF,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAClF,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,EAAE,IA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AW,aAAc,SAAQ,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,iBAAiB,CAAC;IACvF,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC7C,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAClF,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,iBAAiB,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMenuList.d.ts","sourceRoot":"","sources":["../../src/MenuList/useMenuList.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAchE,eAAO,MAAM,WAAW,WAAY,aAAa,KAAG,
|
|
1
|
+
{"version":3,"file":"useMenuList.d.ts","sourceRoot":"","sources":["../../src/MenuList/useMenuList.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAchE,eAAO,MAAM,WAAW,WAAY,aAAa,KAAG,aA0GnD,CAAC"}
|