@fluentui/react-menu 0.0.0-nightly-20220518-0420.1 → 0.0.0-nightly-20220523-0424.1
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 +43 -19
- package/CHANGELOG.md +16 -12
- package/dist/index.d.ts +119 -107
- package/lib/components/Menu/Menu.types.js.map +1 -1
- package/lib/components/Menu/useMenu.js +1 -1
- package/lib/components/Menu/useMenu.js.map +1 -1
- package/lib/components/Menu/useMenuContextValues.js +20 -20
- package/lib/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.types.js.map +1 -1
- package/lib/components/MenuItem/useMenuItemStyles.js +5 -1
- package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib/components/MenuList/MenuList.types.js.map +1 -1
- package/lib/components/MenuList/index.js +1 -0
- package/lib/components/MenuList/index.js.map +1 -1
- package/lib/components/MenuList/useMenuList.js +2 -2
- package/lib/components/MenuList/useMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuListContextValues.js +8 -8
- package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenu.js +1 -1
- package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenuContextValues.js +20 -20
- package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +6 -1
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib-commonjs/components/MenuList/index.js +2 -0
- package/lib-commonjs/components/MenuList/index.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuList.js +2 -2
- package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js +8 -8
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "@fluentui/react-menu",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
6
|
-
"tag": "@fluentui/react-menu_v0.0.0-nightly-
|
|
7
|
-
"version": "0.0.0-nightly-
|
|
5
|
+
"date": "Mon, 23 May 2022 04:37:37 GMT",
|
|
6
|
+
"tag": "@fluentui/react-menu_v0.0.0-nightly-20220523-0424.1",
|
|
7
|
+
"version": "0.0.0-nightly-20220523-0424.1",
|
|
8
8
|
"comments": {
|
|
9
9
|
"prerelease": [
|
|
10
10
|
{
|
|
@@ -13,53 +13,77 @@
|
|
|
13
13
|
"commit": "f120fe9160ad7311a87af0cfacd8d2fb26275e34",
|
|
14
14
|
"comment": "chore: Update Griffel to latest version"
|
|
15
15
|
},
|
|
16
|
+
{
|
|
17
|
+
"author": "yuanboxue@microsoft.com",
|
|
18
|
+
"package": "@fluentui/react-menu",
|
|
19
|
+
"commit": "01a1b4cd08dea21d547c1c2a05382426c5e7ea24",
|
|
20
|
+
"comment": "feat: Fill icon on hover"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "lingfangao@hotmail.com",
|
|
24
|
+
"package": "@fluentui/react-menu",
|
|
25
|
+
"commit": "aaaf6d769e834645418a1144b109c679317fe393",
|
|
26
|
+
"comment": "fix: Context menu closes when its trigger is left clicked"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "olfedias@microsoft.com",
|
|
30
|
+
"package": "@fluentui/react-menu",
|
|
31
|
+
"commit": "60804cec07a495b8a5d1fc66338bf0443b212144",
|
|
32
|
+
"comment": "chore: Update Griffel to latest version"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
36
|
+
"package": "@fluentui/react-menu",
|
|
37
|
+
"commit": "11ba59f23523bedc29014cd29f7141c5debc6242",
|
|
38
|
+
"comment": "Removing Common types from all Menu components."
|
|
39
|
+
},
|
|
16
40
|
{
|
|
17
41
|
"author": "beachball",
|
|
18
42
|
"package": "@fluentui/react-menu",
|
|
19
|
-
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-
|
|
20
|
-
"commit": "
|
|
43
|
+
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-20220523-0424.1",
|
|
44
|
+
"commit": "38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21"
|
|
21
45
|
},
|
|
22
46
|
{
|
|
23
47
|
"author": "beachball",
|
|
24
48
|
"package": "@fluentui/react-menu",
|
|
25
|
-
"comment": "Bump @fluentui/react-portal to v0.0.0-nightly-
|
|
26
|
-
"commit": "
|
|
49
|
+
"comment": "Bump @fluentui/react-portal to v0.0.0-nightly-20220523-0424.1",
|
|
50
|
+
"commit": "38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21"
|
|
27
51
|
},
|
|
28
52
|
{
|
|
29
53
|
"author": "beachball",
|
|
30
54
|
"package": "@fluentui/react-menu",
|
|
31
|
-
"comment": "Bump @fluentui/react-positioning to v0.0.0-nightly-
|
|
32
|
-
"commit": "
|
|
55
|
+
"comment": "Bump @fluentui/react-positioning to v0.0.0-nightly-20220523-0424.1",
|
|
56
|
+
"commit": "38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21"
|
|
33
57
|
},
|
|
34
58
|
{
|
|
35
59
|
"author": "beachball",
|
|
36
60
|
"package": "@fluentui/react-menu",
|
|
37
|
-
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
|
38
|
-
"commit": "
|
|
61
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20220523-0424.1",
|
|
62
|
+
"commit": "38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21"
|
|
39
63
|
},
|
|
40
64
|
{
|
|
41
65
|
"author": "beachball",
|
|
42
66
|
"package": "@fluentui/react-menu",
|
|
43
|
-
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-
|
|
44
|
-
"commit": "
|
|
67
|
+
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20220523-0424.1",
|
|
68
|
+
"commit": "38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21"
|
|
45
69
|
},
|
|
46
70
|
{
|
|
47
71
|
"author": "beachball",
|
|
48
72
|
"package": "@fluentui/react-menu",
|
|
49
|
-
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-
|
|
50
|
-
"commit": "
|
|
73
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20220523-0424.1",
|
|
74
|
+
"commit": "38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21"
|
|
51
75
|
},
|
|
52
76
|
{
|
|
53
77
|
"author": "beachball",
|
|
54
78
|
"package": "@fluentui/react-menu",
|
|
55
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
|
56
|
-
"commit": "
|
|
79
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20220523-0424.1",
|
|
80
|
+
"commit": "38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21"
|
|
57
81
|
},
|
|
58
82
|
{
|
|
59
83
|
"author": "beachball",
|
|
60
84
|
"package": "@fluentui/react-menu",
|
|
61
|
-
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
|
62
|
-
"commit": "
|
|
85
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220523-0424.1",
|
|
86
|
+
"commit": "38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21"
|
|
63
87
|
}
|
|
64
88
|
]
|
|
65
89
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-menu
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 23 May 2022 04:37:37 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.0.0-nightly-
|
|
7
|
+
## [0.0.0-nightly-20220523-0424.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-menu_v0.0.0-nightly-20220523-0424.1)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-menu_v9.0.0-rc.9..@fluentui/react-menu_v0.0.0-nightly-
|
|
9
|
+
Mon, 23 May 2022 04:37:37 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-menu_v9.0.0-rc.9..@fluentui/react-menu_v0.0.0-nightly-20220523-0424.1)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
14
|
- chore: Update Griffel to latest version ([PR #22894](https://github.com/microsoft/fluentui/pull/22894) by olfedias@microsoft.com)
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- Bump @fluentui/react-
|
|
20
|
-
- Bump @fluentui/react-
|
|
21
|
-
- Bump @fluentui/react-
|
|
22
|
-
- Bump @fluentui/react-
|
|
15
|
+
- feat: Fill icon on hover ([PR #23084](https://github.com/microsoft/fluentui/pull/23084) by yuanboxue@microsoft.com)
|
|
16
|
+
- fix: Context menu closes when its trigger is left clicked ([PR #23089](https://github.com/microsoft/fluentui/pull/23089) by lingfangao@hotmail.com)
|
|
17
|
+
- chore: Update Griffel to latest version ([PR #23029](https://github.com/microsoft/fluentui/pull/23029) by olfedias@microsoft.com)
|
|
18
|
+
- Removing Common types from all Menu components. ([PR #22958](https://github.com/microsoft/fluentui/pull/22958) by Humberto.Morimoto@microsoft.com)
|
|
19
|
+
- Bump @fluentui/react-context-selector to v0.0.0-nightly-20220523-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21) by beachball)
|
|
20
|
+
- Bump @fluentui/react-portal to v0.0.0-nightly-20220523-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21) by beachball)
|
|
21
|
+
- Bump @fluentui/react-positioning to v0.0.0-nightly-20220523-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21) by beachball)
|
|
22
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20220523-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21) by beachball)
|
|
23
|
+
- Bump @fluentui/react-tabster to v0.0.0-nightly-20220523-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21) by beachball)
|
|
24
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20220523-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21) by beachball)
|
|
25
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20220523-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21) by beachball)
|
|
26
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220523-0424.1 ([commit](https://github.com/microsoft/fluentui/commit/38c77f1ec2382f1d63ab33ac977ca1bd5a6b2d21) by beachball)
|
|
23
27
|
|
|
24
28
|
## [9.0.0-rc.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-menu_v9.0.0-rc.9)
|
|
25
29
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ComponentProps } from '@fluentui/react-utilities';
|
|
2
|
-
import { ComponentState } from '@fluentui/react-utilities';
|
|
1
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
2
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
|
3
3
|
import type { Context } from '@fluentui/react-context-selector';
|
|
4
4
|
import type { ContextSelector } from '@fluentui/react-context-selector';
|
|
5
5
|
import type { FluentTriggerComponent } from '@fluentui/react-utilities';
|
|
6
6
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
7
|
-
import { PositioningShorthand } from '@fluentui/react-positioning';
|
|
7
|
+
import type { PositioningShorthand } from '@fluentui/react-positioning';
|
|
8
8
|
import * as React_2 from 'react';
|
|
9
9
|
import type { Slot } from '@fluentui/react-utilities';
|
|
10
10
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
@@ -16,48 +16,14 @@ import { usePopperMouseTarget } from '@fluentui/react-positioning';
|
|
|
16
16
|
export declare const Menu: React_2.FC<MenuProps>;
|
|
17
17
|
|
|
18
18
|
export declare type MenuCheckedValueChangeData = {
|
|
19
|
-
/** The name of the value */
|
|
20
|
-
name: string;
|
|
21
19
|
/** The items for this value that are checked */
|
|
22
20
|
checkedItems: string[];
|
|
21
|
+
/** The name of the value */
|
|
22
|
+
name: string;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export declare type MenuCheckedValueChangeEvent = React_2.MouseEvent | React_2.KeyboardEvent;
|
|
26
26
|
|
|
27
|
-
declare type MenuCommons = MenuListCommons & {
|
|
28
|
-
/**
|
|
29
|
-
* Whether the popup is open
|
|
30
|
-
*/
|
|
31
|
-
open: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Call back when the component requests to change value
|
|
34
|
-
* The `open` value is used as a hint when directly controlling the component
|
|
35
|
-
*/
|
|
36
|
-
onOpenChange?: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Whether the popup is open by default
|
|
39
|
-
*/
|
|
40
|
-
defaultOpen?: boolean;
|
|
41
|
-
openOnHover: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Opens the menu on right click (context menu), removes all other menu open interactions
|
|
44
|
-
*/
|
|
45
|
-
openOnContext?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Root menus are rendered out of DOM order on `document.body`, use this to render the menu in DOM order
|
|
48
|
-
* This option is disregarded for submenus
|
|
49
|
-
*/
|
|
50
|
-
inline?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Do not dismiss the menu when a menu item is clicked
|
|
53
|
-
*/
|
|
54
|
-
persistOnItemClick?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Sets the delay for mouse open/close for the popover one mouse enter/leave
|
|
57
|
-
*/
|
|
58
|
-
hoverDelay?: number;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
27
|
export declare const MenuContext: Context<MenuContextValue>;
|
|
62
28
|
|
|
63
29
|
/**
|
|
@@ -184,23 +150,27 @@ export declare const menuItemClassName = "fui-MenuItem";
|
|
|
184
150
|
|
|
185
151
|
export declare const menuItemClassNames: SlotClassNames<MenuItemSlots>;
|
|
186
152
|
|
|
187
|
-
declare type
|
|
188
|
-
/**
|
|
189
|
-
* If the menu item is a trigger for a submenu
|
|
190
|
-
*/
|
|
191
|
-
hasSubmenu?: boolean;
|
|
153
|
+
export declare type MenuItemProps = ComponentProps<Partial<MenuItemSlots>> & {
|
|
192
154
|
/**
|
|
193
155
|
* Applies disabled styles to menu item but remains focusable
|
|
156
|
+
*
|
|
157
|
+
* @default false
|
|
194
158
|
*/
|
|
195
159
|
disabled?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* If the menu item is a trigger for a submenu
|
|
162
|
+
*
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
hasSubmenu?: boolean;
|
|
196
166
|
/**
|
|
197
167
|
* Clicking on the menu item will not dismiss an open menu
|
|
168
|
+
*
|
|
169
|
+
* @default false
|
|
198
170
|
*/
|
|
199
171
|
persistOnClick?: boolean;
|
|
200
172
|
};
|
|
201
173
|
|
|
202
|
-
export declare type MenuItemProps = ComponentProps<Partial<MenuItemSlots>> & MenuItemCommons;
|
|
203
|
-
|
|
204
174
|
/**
|
|
205
175
|
* Define a styled MenuItemRadio, using the `useMenuItemRadio_unstable` hook.
|
|
206
176
|
*/
|
|
@@ -277,7 +247,7 @@ export declare type MenuItemSlots = {
|
|
|
277
247
|
secondaryContent?: Slot<'span'>;
|
|
278
248
|
};
|
|
279
249
|
|
|
280
|
-
export declare type MenuItemState = ComponentState<MenuItemSlots> &
|
|
250
|
+
export declare type MenuItemState = ComponentState<MenuItemSlots> & Pick<MenuItemProps, 'disabled' | 'hasSubmenu' | 'persistOnClick'>;
|
|
281
251
|
|
|
282
252
|
/**
|
|
283
253
|
* Define a styled MenuList, using the `useMenuList_unstable` hook.
|
|
@@ -291,32 +261,6 @@ export declare const menuListClassName = "fui-MenuList";
|
|
|
291
261
|
|
|
292
262
|
export declare const menuListClassNames: SlotClassNames<MenuListSlots>;
|
|
293
263
|
|
|
294
|
-
declare type MenuListCommons = {
|
|
295
|
-
/**
|
|
296
|
-
* Callback when checked items change for value with a name
|
|
297
|
-
*
|
|
298
|
-
* @param event - React's original SyntheticEvent
|
|
299
|
-
* @param data - A data object with relevant information
|
|
300
|
-
*/
|
|
301
|
-
onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;
|
|
302
|
-
/**
|
|
303
|
-
* Map of all checked values
|
|
304
|
-
*/
|
|
305
|
-
checkedValues: Record<string, string[]>;
|
|
306
|
-
/**
|
|
307
|
-
* Default values to be checked on mount
|
|
308
|
-
*/
|
|
309
|
-
defaultCheckedValues?: Record<string, string[]>;
|
|
310
|
-
/**
|
|
311
|
-
* States that menu items can contain icons and reserve slots for item alignment
|
|
312
|
-
*/
|
|
313
|
-
hasIcons?: boolean;
|
|
314
|
-
/**
|
|
315
|
-
* States that menu items can contain selectable items and reserve slots for item alignment
|
|
316
|
-
*/
|
|
317
|
-
hasCheckmarks?: boolean;
|
|
318
|
-
};
|
|
319
|
-
|
|
320
264
|
export declare const MenuListContext: Context<MenuListContextValue>;
|
|
321
265
|
|
|
322
266
|
/**
|
|
@@ -332,7 +276,31 @@ export declare type MenuListContextValues = {
|
|
|
332
276
|
menuList: MenuListContextValue;
|
|
333
277
|
};
|
|
334
278
|
|
|
335
|
-
export declare type MenuListProps = ComponentProps<MenuListSlots> &
|
|
279
|
+
export declare type MenuListProps = ComponentProps<MenuListSlots> & {
|
|
280
|
+
/**
|
|
281
|
+
* Map of all checked values
|
|
282
|
+
*/
|
|
283
|
+
checkedValues?: Record<string, string[]>;
|
|
284
|
+
/**
|
|
285
|
+
* Default values to be checked on mount
|
|
286
|
+
*/
|
|
287
|
+
defaultCheckedValues?: Record<string, string[]>;
|
|
288
|
+
/**
|
|
289
|
+
* States that menu items can contain selectable items and reserve slots for item alignment
|
|
290
|
+
*/
|
|
291
|
+
hasCheckmarks?: boolean;
|
|
292
|
+
/**
|
|
293
|
+
* States that menu items can contain icons and reserve slots for item alignment
|
|
294
|
+
*/
|
|
295
|
+
hasIcons?: boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Callback when checked items change for value with a name
|
|
298
|
+
*
|
|
299
|
+
* @param event - React's original SyntheticEvent
|
|
300
|
+
* @param data - A data object with relevant information
|
|
301
|
+
*/
|
|
302
|
+
onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;
|
|
303
|
+
};
|
|
336
304
|
|
|
337
305
|
export declare const MenuListProvider: React_2.Provider<MenuListContextValue> & React_2.FC<React_2.ProviderProps<MenuListContextValue>>;
|
|
338
306
|
|
|
@@ -340,37 +308,37 @@ export declare type MenuListSlots = {
|
|
|
340
308
|
root: Slot<'div'>;
|
|
341
309
|
};
|
|
342
310
|
|
|
343
|
-
export declare type MenuListState = ComponentState<MenuListSlots> &
|
|
311
|
+
export declare type MenuListState = ComponentState<MenuListSlots> & Pick<MenuListProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & Required<Pick<MenuListProps, 'checkedValues' | 'hasCheckmarks' | 'hasIcons'>> & {
|
|
312
|
+
/**
|
|
313
|
+
* Selects a radio item, will de-select the currently selected ratio item
|
|
314
|
+
*/
|
|
315
|
+
selectRadio: SelectableHandler;
|
|
344
316
|
/**
|
|
345
317
|
* Callback to set focus on the next menu item by first character
|
|
346
318
|
*/
|
|
347
319
|
setFocusByFirstCharacter: NonNullable<MenuListContextValue['setFocusByFirstCharacter']>;
|
|
348
320
|
toggleCheckbox: SelectableHandler;
|
|
349
|
-
/**
|
|
350
|
-
* Selects a radio item, will de-select the currently selected ratio item
|
|
351
|
-
*/
|
|
352
|
-
selectRadio: SelectableHandler;
|
|
353
321
|
};
|
|
354
322
|
|
|
355
323
|
/**
|
|
356
324
|
* Data attached to open/close events
|
|
357
325
|
*/
|
|
358
326
|
export declare type MenuOpenChangeData = {
|
|
359
|
-
open: boolean;
|
|
360
|
-
/**
|
|
361
|
-
* Indicates whether the change of state was a keyboard interaction
|
|
362
|
-
*/
|
|
363
|
-
keyboard?: boolean;
|
|
364
327
|
/**
|
|
365
328
|
* indicates whether the request for the open state was bubbled from a nested menu
|
|
366
329
|
*/
|
|
367
330
|
bubble?: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* Indicates whether the change of state was a keyboard interaction
|
|
333
|
+
*/
|
|
334
|
+
keyboard?: boolean;
|
|
335
|
+
open: boolean;
|
|
368
336
|
};
|
|
369
337
|
|
|
370
338
|
/**
|
|
371
339
|
* The supported events that will trigger open/close of the menu
|
|
372
340
|
*/
|
|
373
|
-
export declare type MenuOpenEvents = MouseEvent | TouchEvent | React_2.
|
|
341
|
+
export declare type MenuOpenEvents = MouseEvent | TouchEvent | React_2.FocusEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement> | React_2.MouseEvent<HTMLElement>;
|
|
374
342
|
|
|
375
343
|
/**
|
|
376
344
|
* Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus
|
|
@@ -407,12 +375,58 @@ export declare type MenuPopoverState = ComponentState<MenuPopoverSlots> & {
|
|
|
407
375
|
/**
|
|
408
376
|
* Extends and drills down Menulist props to simplify API
|
|
409
377
|
*/
|
|
410
|
-
export declare type MenuProps =
|
|
378
|
+
export declare type MenuProps = ComponentProps<MenuSlots> & Pick<MenuListProps, 'checkedValues' | 'defaultCheckedValues' | 'hasCheckmarks' | 'hasIcons' | 'onCheckedValueChange'> & {
|
|
411
379
|
/**
|
|
412
380
|
* Can contain two children including {@link MenuTrigger} and {@link MenuPopover}.
|
|
413
381
|
* Alternatively can only contain {@link MenuPopover} if using a custom `target`.
|
|
414
382
|
*/
|
|
415
383
|
children: [JSX.Element, JSX.Element] | JSX.Element;
|
|
384
|
+
/**
|
|
385
|
+
* Whether the popup is open by default
|
|
386
|
+
*
|
|
387
|
+
* @default false
|
|
388
|
+
*/
|
|
389
|
+
defaultOpen?: boolean;
|
|
390
|
+
/**
|
|
391
|
+
* Sets the delay for mouse open/close for the popover one mouse enter/leave
|
|
392
|
+
*/
|
|
393
|
+
hoverDelay?: number;
|
|
394
|
+
/**
|
|
395
|
+
* Root menus are rendered out of DOM order on `document.body`, use this to render the menu in DOM order
|
|
396
|
+
* This option is disregarded for submenus
|
|
397
|
+
*
|
|
398
|
+
* @default false
|
|
399
|
+
*/
|
|
400
|
+
inline?: boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Call back when the component requests to change value
|
|
403
|
+
* The `open` value is used as a hint when directly controlling the component
|
|
404
|
+
*/
|
|
405
|
+
onOpenChange?: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;
|
|
406
|
+
/**
|
|
407
|
+
* Whether the popup is open
|
|
408
|
+
*
|
|
409
|
+
* @default false
|
|
410
|
+
*/
|
|
411
|
+
open?: boolean;
|
|
412
|
+
/**
|
|
413
|
+
* Opens the menu on right click (context menu), removes all other menu open interactions
|
|
414
|
+
*
|
|
415
|
+
* @default false
|
|
416
|
+
*/
|
|
417
|
+
openOnContext?: boolean;
|
|
418
|
+
/**
|
|
419
|
+
* Opens the menu on hover
|
|
420
|
+
*
|
|
421
|
+
* @default false
|
|
422
|
+
*/
|
|
423
|
+
openOnHover?: boolean;
|
|
424
|
+
/**
|
|
425
|
+
* Do not dismiss the menu when a menu item is clicked
|
|
426
|
+
*
|
|
427
|
+
* @default false
|
|
428
|
+
*/
|
|
429
|
+
persistOnItemClick?: boolean;
|
|
416
430
|
/**
|
|
417
431
|
* Configures the positioned menu
|
|
418
432
|
*/
|
|
@@ -435,12 +449,10 @@ export declare const menuSplitGroupClassName = "fui-MenuSplitGroup";
|
|
|
435
449
|
|
|
436
450
|
export declare const menuSplitGroupClassNames: SlotClassNames<MenuSplitGroupSlots>;
|
|
437
451
|
|
|
438
|
-
declare type MenuSplitGroupCommons = {};
|
|
439
|
-
|
|
440
452
|
/**
|
|
441
453
|
* MenuSplitGroup Props
|
|
442
454
|
*/
|
|
443
|
-
export declare type MenuSplitGroupProps = ComponentProps<MenuSplitGroupSlots
|
|
455
|
+
export declare type MenuSplitGroupProps = ComponentProps<MenuSplitGroupSlots>;
|
|
444
456
|
|
|
445
457
|
export declare type MenuSplitGroupSlots = {
|
|
446
458
|
root: Slot<'div'>;
|
|
@@ -449,45 +461,45 @@ export declare type MenuSplitGroupSlots = {
|
|
|
449
461
|
/**
|
|
450
462
|
* State used in rendering MenuSplitGroup
|
|
451
463
|
*/
|
|
452
|
-
export declare type MenuSplitGroupState = ComponentState<MenuSplitGroupSlots
|
|
464
|
+
export declare type MenuSplitGroupState = ComponentState<MenuSplitGroupSlots>;
|
|
453
465
|
|
|
454
|
-
export declare type MenuState =
|
|
466
|
+
export declare type MenuState = ComponentState<MenuSlots> & Pick<MenuProps, 'defaultCheckedValues' | 'hasCheckmarks' | 'hasIcons' | 'inline' | 'onOpenChange' | 'openOnContext' | 'persistOnItemClick'> & Required<Pick<MenuProps, 'checkedValues' | 'onCheckedValueChange' | 'open' | 'openOnHover'>> & {
|
|
455
467
|
/**
|
|
456
|
-
*
|
|
468
|
+
* Anchors the popper to the mouse click for context events
|
|
457
469
|
*/
|
|
458
|
-
|
|
470
|
+
contextTarget: ReturnType<typeof usePopperMouseTarget>[0];
|
|
459
471
|
/**
|
|
460
|
-
*
|
|
472
|
+
* Whether this menu is a submenu
|
|
461
473
|
*/
|
|
462
|
-
|
|
474
|
+
isSubmenu: boolean;
|
|
463
475
|
/**
|
|
464
476
|
* Internal react node that just simplifies handling children
|
|
465
477
|
*/
|
|
466
|
-
|
|
478
|
+
menuPopover: React_2.ReactNode;
|
|
467
479
|
/**
|
|
468
480
|
* The ref for the popup
|
|
469
481
|
*/
|
|
470
482
|
menuPopoverRef: React_2.MutableRefObject<HTMLElement>;
|
|
471
483
|
/**
|
|
472
|
-
*
|
|
484
|
+
* Internal react node that just simplifies handling children
|
|
473
485
|
*/
|
|
474
|
-
|
|
486
|
+
menuTrigger: React_2.ReactNode;
|
|
475
487
|
/**
|
|
476
|
-
*
|
|
488
|
+
* A callback to set the target of the popper to the mouse click for context events
|
|
477
489
|
*/
|
|
478
|
-
|
|
490
|
+
setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];
|
|
479
491
|
/**
|
|
480
|
-
*
|
|
492
|
+
* Callback to open/close the popup
|
|
481
493
|
*/
|
|
482
|
-
|
|
494
|
+
setOpen: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;
|
|
483
495
|
/**
|
|
484
|
-
*
|
|
496
|
+
* Id for the MenuTrigger element for aria relationship
|
|
485
497
|
*/
|
|
486
|
-
|
|
498
|
+
triggerId: string;
|
|
487
499
|
/**
|
|
488
|
-
*
|
|
500
|
+
* The ref for the MenuTrigger, used for popup positioning
|
|
489
501
|
*/
|
|
490
|
-
|
|
502
|
+
triggerRef: React_2.MutableRefObject<HTMLElement>;
|
|
491
503
|
};
|
|
492
504
|
|
|
493
505
|
/**
|
|
@@ -581,7 +593,7 @@ export declare const renderMenuTrigger_unstable: (state: MenuTriggerState) => JS
|
|
|
581
593
|
|
|
582
594
|
export declare type SelectableHandler = (e: React_2.MouseEvent | React_2.KeyboardEvent, name: string, value: string, checked: boolean) => void;
|
|
583
595
|
|
|
584
|
-
export declare type UninitializedMenuListState = Omit<MenuListState, '
|
|
596
|
+
export declare type UninitializedMenuListState = Omit<MenuListState, 'checkedValues' | 'selectRadio' | 'setFocusByFirstCharacter' | 'toggleCheckbox'> & Partial<Pick<MenuListState, 'checkedValues'>>;
|
|
585
597
|
|
|
586
598
|
/**
|
|
587
599
|
* Applies styles to a checkmark slot for selectable menu items
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.types.js","sourceRoot":"../src/","sources":["components/Menu/Menu.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"Menu.types.js","sourceRoot":"../src/","sources":["components/Menu/Menu.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { usePopperMouseTarget } from '@fluentui/react-positioning';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\nimport type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { MenuContextValue } from '../../contexts/menuContext';\nimport type { MenuListProps } from '../MenuList/MenuList.types';\n\nexport type MenuSlots = {};\n\n/**\n * Extends and drills down Menulist props to simplify API\n */\nexport type MenuProps = ComponentProps<MenuSlots> &\n Pick<\n MenuListProps,\n 'checkedValues' | 'defaultCheckedValues' | 'hasCheckmarks' | 'hasIcons' | 'onCheckedValueChange'\n > & {\n /**\n * Can contain two children including {@link MenuTrigger} and {@link MenuPopover}.\n * Alternatively can only contain {@link MenuPopover} if using a custom `target`.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n\n /**\n * Whether the popup is open by default\n *\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * Sets the delay for mouse open/close for the popover one mouse enter/leave\n */\n hoverDelay?: number;\n\n /**\n * Root menus are rendered out of DOM order on `document.body`, use this to render the menu in DOM order\n * This option is disregarded for submenus\n *\n * @default false\n */\n inline?: boolean;\n\n /**\n * Call back when the component requests to change value\n * The `open` value is used as a hint when directly controlling the component\n */\n onOpenChange?: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;\n\n /**\n * Whether the popup is open\n *\n * @default false\n */\n open?: boolean;\n\n /**\n * Opens the menu on right click (context menu), removes all other menu open interactions\n *\n * @default false\n */\n openOnContext?: boolean;\n\n /**\n * Opens the menu on hover\n *\n * @default false\n */\n openOnHover?: boolean;\n\n /**\n * Do not dismiss the menu when a menu item is clicked\n *\n * @default false\n */\n persistOnItemClick?: boolean;\n\n /**\n * Configures the positioned menu\n */\n positioning?: PositioningShorthand;\n };\n\nexport type MenuState = ComponentState<MenuSlots> &\n Pick<\n MenuProps,\n | 'defaultCheckedValues'\n | 'hasCheckmarks'\n | 'hasIcons'\n | 'inline'\n | 'onOpenChange'\n | 'openOnContext'\n | 'persistOnItemClick'\n > &\n Required<Pick<MenuProps, 'checkedValues' | 'onCheckedValueChange' | 'open' | 'openOnHover'>> & {\n /**\n * Anchors the popper to the mouse click for context events\n */\n contextTarget: ReturnType<typeof usePopperMouseTarget>[0];\n\n /**\n * Whether this menu is a submenu\n */\n isSubmenu: boolean;\n\n /**\n * Internal react node that just simplifies handling children\n */\n menuPopover: React.ReactNode;\n\n /**\n * The ref for the popup\n */\n menuPopoverRef: React.MutableRefObject<HTMLElement>;\n\n /**\n * Internal react node that just simplifies handling children\n */\n menuTrigger: React.ReactNode;\n\n /**\n * A callback to set the target of the popper to the mouse click for context events\n */\n setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];\n\n /**\n * Callback to open/close the popup\n */\n setOpen: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;\n\n /**\n * Id for the MenuTrigger element for aria relationship\n */\n triggerId: string;\n\n /**\n * The ref for the MenuTrigger, used for popup positioning\n */\n triggerRef: React.MutableRefObject<HTMLElement>;\n };\n\n/**\n * Data attached to open/close events\n */\nexport type MenuOpenChangeData = {\n /**\n * indicates whether the request for the open state was bubbled from a nested menu\n */\n bubble?: boolean;\n /**\n * Indicates whether the change of state was a keyboard interaction\n */\n keyboard?: boolean;\n open: boolean;\n};\n\nexport type MenuContextValues = {\n menu: MenuContextValue;\n};\n\n/**\n * The supported events that will trigger open/close of the menu\n */\nexport type MenuOpenEvents =\n | MouseEvent\n | TouchEvent\n | React.FocusEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.MouseEvent<HTMLElement>;\n"]}
|
|
@@ -187,7 +187,7 @@ const useMenuOpenState = state => {
|
|
|
187
187
|
contains: elementContains,
|
|
188
188
|
disabled: !open,
|
|
189
189
|
element: targetDocument,
|
|
190
|
-
refs: [state.menuPopoverRef, state.triggerRef],
|
|
190
|
+
refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(Boolean),
|
|
191
191
|
callback: e => setOpen(e, {
|
|
192
192
|
open: false
|
|
193
193
|
})
|