@fluentui/react-menu 0.0.0-nightlyd3bf09bf8120211201.1 → 0.0.0-nightlyd514b3e0ee20220121.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +142 -26
- package/CHANGELOG.md +31 -16
- package/Spec.md +21 -16
- package/dist/react-menu.d.ts +54 -12
- package/lib/MenuSplitGroup.d.ts +1 -0
- package/lib/MenuSplitGroup.js +2 -0
- package/lib/MenuSplitGroup.js.map +1 -0
- package/lib/components/Menu/useMenu.js +29 -21
- package/lib/components/Menu/useMenu.js.map +1 -1
- package/lib/components/MenuDivider/renderMenuDivider.js +2 -1
- package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDivider.js +3 -0
- package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDividerStyles.d.ts +1 -1
- package/lib/components/MenuDivider/useMenuDividerStyles.js +1 -0
- package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib/components/MenuGroup/renderMenuGroup.js +2 -1
- package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroup.js +3 -0
- package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +2 -1
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +3 -0
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +1 -0
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.js +0 -2
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.types.d.ts +1 -1
- package/lib/components/MenuItem/renderMenuItem.js +8 -3
- package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useMenuItem.d.ts +1 -5
- package/lib/components/MenuItem/useMenuItem.js +3 -8
- package/lib/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useMenuItemStyles.js +19 -20
- package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +7 -3
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js +7 -3
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib/components/MenuList/renderMenuList.js +2 -1
- package/lib/components/MenuList/renderMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuList.js +3 -0
- package/lib/components/MenuList/useMenuList.js.map +1 -1
- package/lib/components/MenuPopover/renderMenuPopover.js +4 -2
- package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopover.js +3 -0
- package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopoverStyles.js +1 -0
- package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib/components/MenuSplitGroup/MenuSplitGroup.d.ts +6 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.js +15 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +13 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js +2 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -0
- package/lib/components/MenuSplitGroup/index.d.ts +5 -0
- package/lib/components/MenuSplitGroup/index.js +6 -0
- package/lib/components/MenuSplitGroup/index.js.map +1 -0
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +5 -0
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +15 -0
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.d.ts +12 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +67 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +6 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js +35 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -0
- package/lib/components/MenuTrigger/MenuTrigger.d.ts +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.js +4 -3
- package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.types.d.ts +5 -2
- package/lib/components/MenuTrigger/useMenuTrigger.d.ts +2 -1
- package/lib/components/MenuTrigger/useMenuTrigger.js +177 -5
- package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib/index.d.ts +11 -10
- package/lib/index.js +11 -10
- package/lib/index.js.map +1 -1
- package/lib/utils/useOnMenuEnter.js.map +1 -1
- package/lib-commonjs/MenuSplitGroup.d.ts +1 -0
- package/lib-commonjs/MenuSplitGroup.js +10 -0
- package/lib-commonjs/MenuSplitGroup.js.map +1 -0
- package/lib-commonjs/components/Menu/useMenu.js +33 -26
- package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +2 -1
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js +3 -0
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.d.ts +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +2 -0
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +2 -1
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js +3 -0
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +2 -1
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +3 -0
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +2 -0
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.js +0 -3
- package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.types.d.ts +1 -1
- package/lib-commonjs/components/MenuItem/renderMenuItem.js +8 -4
- package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItem.d.ts +1 -5
- package/lib-commonjs/components/MenuItem/useMenuItem.js +5 -10
- package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +21 -20
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +7 -4
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +7 -4
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuList/renderMenuList.js +2 -1
- package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuList.js +3 -0
- package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +4 -2
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js +3 -0
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js +2 -0
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.d.ts +6 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js +26 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +13 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js +6 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/index.d.ts +5 -0
- package/lib-commonjs/components/MenuSplitGroup/index.js +18 -0
- package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +5 -0
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js +26 -0
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.d.ts +12 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +81 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +6 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js +47 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -0
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.d.ts +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +5 -5
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.d.ts +5 -2
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.d.ts +2 -1
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +184 -5
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib-commonjs/index.d.ts +11 -10
- package/lib-commonjs/index.js +16 -14
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
- package/package.json +15 -15
- package/lib/components/MenuTrigger/useTriggerElement.d.ts +0 -5
- package/lib/components/MenuTrigger/useTriggerElement.js +0 -165
- package/lib/components/MenuTrigger/useTriggerElement.js.map +0 -1
- package/lib-commonjs/components/MenuTrigger/useTriggerElement.d.ts +0 -5
- package/lib-commonjs/components/MenuTrigger/useTriggerElement.js +0 -180
- package/lib-commonjs/components/MenuTrigger/useTriggerElement.js.map +0 -1
package/CHANGELOG.json
CHANGED
@@ -2,88 +2,204 @@
|
|
2
2
|
"name": "@fluentui/react-menu",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-menu_v0.0.0-
|
7
|
-
"version": "0.0.0-
|
5
|
+
"date": "Fri, 21 Jan 2022 04:16:22 GMT",
|
6
|
+
"tag": "@fluentui/react-menu_v0.0.0-nightlyd514b3e0ee20220121.1",
|
7
|
+
"version": "0.0.0-nightlyd514b3e0ee20220121.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
11
11
|
"author": "email not defined",
|
12
12
|
"package": "@fluentui/react-menu",
|
13
|
-
"commit": "
|
13
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090",
|
14
14
|
"comment": "Release nightly v9"
|
15
15
|
},
|
16
|
+
{
|
17
|
+
"author": "lingfangao@hotmail.com",
|
18
|
+
"package": "@fluentui/react-menu",
|
19
|
+
"commit": "c2e6c50d56dcb45b4ca9e3a9daf2fae4be10a19e",
|
20
|
+
"comment": "fix: set `aria-expanded` and `aria-haspopup` values correctly"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "lingfangao@hotmail.com",
|
24
|
+
"package": "@fluentui/react-menu",
|
25
|
+
"commit": "6ca0355f6740f836ff4df009687718a380085247",
|
26
|
+
"comment": "fix: Focus on first menu item on click"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "lingfangao@hotmail.com",
|
30
|
+
"package": "@fluentui/react-menu",
|
31
|
+
"commit": "4f22b6dad04ea37eb53e4af23c73d2de4db512a2",
|
32
|
+
"comment": "fix: MenuTrigger should work correctly when `aria-disabled=\"true\"`"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "lingfangao@hotmail.com",
|
36
|
+
"package": "@fluentui/react-menu",
|
37
|
+
"commit": "d2eb57808a403b70845a732a62b55aa64d66b2a0",
|
38
|
+
"comment": "Allow `MenuTrigger` to be wrapped by another trigger"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
42
|
+
"package": "@fluentui/react-menu",
|
43
|
+
"commit": "38c8bed2c707014688ae2ae689033fa36ef23075",
|
44
|
+
"comment": "Updating packages based on changes to focusIndicator functions to remove functions from makeStyles in @fluentui/react-tabster."
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"author": "behowell@microsoft.com",
|
48
|
+
"package": "@fluentui/react-menu",
|
49
|
+
"commit": "7cc28ed8320b00f42d91c63882f10316db2205c5",
|
50
|
+
"comment": "Remove component's shorthandProps array"
|
51
|
+
},
|
16
52
|
{
|
17
53
|
"author": "olfedias@microsoft.com",
|
18
54
|
"package": "@fluentui/react-menu",
|
19
55
|
"commit": "7e0933ed386742df28c416e6b3a6903a0c041f28",
|
20
56
|
"comment": "update styles to not use CSS shorthands"
|
21
57
|
},
|
58
|
+
{
|
59
|
+
"author": "lingfangao@hotmail.com",
|
60
|
+
"package": "@fluentui/react-menu",
|
61
|
+
"commit": "4121754498bba5137f769295e2b7a2899f557278",
|
62
|
+
"comment": "fix: Call `useCheckmarkStyles` in `useMenuItemStyles`"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
66
|
+
"package": "@fluentui/react-menu",
|
67
|
+
"commit": "6c32d0180e89674a46daf795de69e5dc6ca71ef7",
|
68
|
+
"comment": "Updating based on removal of functions from makeStyles."
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
72
|
+
"package": "@fluentui/react-menu",
|
73
|
+
"commit": "227e09f59026e2bd243422427d9e230d6aa892ca",
|
74
|
+
"comment": "Replacing use of functions in makeStyles with direct use of tokens."
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"author": "behowell@microsoft.com",
|
78
|
+
"package": "@fluentui/react-menu",
|
79
|
+
"commit": "23b8a6df449d6e76b90ae5ca9bd2285febdff222",
|
80
|
+
"comment": "Apply fontSize styling to icon slot"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"author": "ololubek@microsoft.com",
|
84
|
+
"package": "@fluentui/react-menu",
|
85
|
+
"commit": "63cbefe55e5db10eedbde19392aa8b6376d6a7f7",
|
86
|
+
"comment": "Update react-icons usage to resizable icons"
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"author": "lingfangao@hotmail.com",
|
90
|
+
"package": "@fluentui/react-menu",
|
91
|
+
"commit": "95a6a32cbffa9d86d6017cf8e0204d4b459ef370",
|
92
|
+
"comment": "feat: implement `MenuSplitGroup` component for split menu items"
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
96
|
+
"package": "@fluentui/react-menu",
|
97
|
+
"commit": "00a5d945904c896a0664de6ba72c145a255f0848",
|
98
|
+
"comment": "Updating use of tokens.fontWeight now that we don't need to use casting."
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"author": "ololubek@microsoft.com",
|
102
|
+
"package": "@fluentui/react-menu",
|
103
|
+
"commit": "7cb2a5d8db1b6a1ddb638aa82d5815ab5ae84e69",
|
104
|
+
"comment": "(fix): Update react-icons dependency to latest version"
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"author": "lingfangao@hotmail.com",
|
108
|
+
"package": "@fluentui/react-menu",
|
109
|
+
"commit": "07d9ed6d1b436b7ca9571c94fbb0bcbdb080f235",
|
110
|
+
"comment": "breaking: MenuTrigger must be the first child of the `Menu`"
|
111
|
+
},
|
22
112
|
{
|
23
113
|
"author": "beachball",
|
24
114
|
"package": "@fluentui/react-menu",
|
25
|
-
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-
|
26
|
-
"commit": "
|
115
|
+
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightlyd514b3e0ee20220121.1",
|
116
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090"
|
27
117
|
},
|
28
118
|
{
|
29
119
|
"author": "beachball",
|
30
120
|
"package": "@fluentui/react-menu",
|
31
|
-
"comment": "Bump @fluentui/react-context-selector to v0.0.0-
|
32
|
-
"commit": "
|
121
|
+
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightlyd514b3e0ee20220121.1",
|
122
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090"
|
33
123
|
},
|
34
124
|
{
|
35
125
|
"author": "beachball",
|
36
126
|
"package": "@fluentui/react-menu",
|
37
|
-
"comment": "Bump @fluentui/react-make-styles to v0.0.0-
|
38
|
-
"commit": "
|
127
|
+
"comment": "Bump @fluentui/react-make-styles to v0.0.0-nightlyd514b3e0ee20220121.1",
|
128
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090"
|
39
129
|
},
|
40
130
|
{
|
41
131
|
"author": "beachball",
|
42
132
|
"package": "@fluentui/react-menu",
|
43
|
-
"comment": "Bump @fluentui/react-portal to v0.0.0-
|
44
|
-
"commit": "
|
133
|
+
"comment": "Bump @fluentui/react-portal to v0.0.0-nightlyd514b3e0ee20220121.1",
|
134
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090"
|
45
135
|
},
|
46
136
|
{
|
47
137
|
"author": "beachball",
|
48
138
|
"package": "@fluentui/react-menu",
|
49
|
-
"comment": "Bump @fluentui/react-positioning to v0.0.0-
|
50
|
-
"commit": "
|
139
|
+
"comment": "Bump @fluentui/react-positioning to v0.0.0-nightlyd514b3e0ee20220121.1",
|
140
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090"
|
51
141
|
},
|
52
142
|
{
|
53
143
|
"author": "beachball",
|
54
144
|
"package": "@fluentui/react-menu",
|
55
|
-
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-
|
56
|
-
"commit": "
|
145
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightlyd514b3e0ee20220121.1",
|
146
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090"
|
57
147
|
},
|
58
148
|
{
|
59
149
|
"author": "beachball",
|
60
150
|
"package": "@fluentui/react-menu",
|
61
|
-
"comment": "Bump @fluentui/react-tabster to v0.0.0-
|
62
|
-
"commit": "
|
151
|
+
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightlyd514b3e0ee20220121.1",
|
152
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090"
|
63
153
|
},
|
64
154
|
{
|
65
155
|
"author": "beachball",
|
66
156
|
"package": "@fluentui/react-menu",
|
67
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-
|
68
|
-
"commit": "
|
157
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightlyd514b3e0ee20220121.1",
|
158
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090"
|
69
159
|
},
|
70
160
|
{
|
71
161
|
"author": "beachball",
|
72
162
|
"package": "@fluentui/react-menu",
|
73
|
-
"comment": "Bump @fluentui/babel-make-styles to v0.0.0-
|
74
|
-
"commit": "
|
163
|
+
"comment": "Bump @fluentui/babel-make-styles to v0.0.0-nightlyd514b3e0ee20220121.1",
|
164
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090"
|
75
165
|
},
|
76
166
|
{
|
77
167
|
"author": "beachball",
|
78
168
|
"package": "@fluentui/react-menu",
|
79
|
-
"comment": "Bump @fluentui/jest-serializer-make-styles to v0.0.0-
|
80
|
-
"commit": "
|
169
|
+
"comment": "Bump @fluentui/jest-serializer-make-styles to v0.0.0-nightlyd514b3e0ee20220121.1",
|
170
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090"
|
81
171
|
},
|
82
172
|
{
|
83
173
|
"author": "beachball",
|
84
174
|
"package": "@fluentui/react-menu",
|
85
|
-
"comment": "Bump @fluentui/react-conformance-make-styles to v0.0.0-
|
86
|
-
"commit": "
|
175
|
+
"comment": "Bump @fluentui/react-conformance-make-styles to v0.0.0-nightlyd514b3e0ee20220121.1",
|
176
|
+
"commit": "89feafb688fbb160fb8519724479b3c68a79d090"
|
177
|
+
}
|
178
|
+
],
|
179
|
+
"none": [
|
180
|
+
{
|
181
|
+
"author": "email not defined",
|
182
|
+
"package": "@fluentui/react-menu",
|
183
|
+
"commit": "97752a0e494875c4dc22b268030d7d5e51b19211",
|
184
|
+
"comment": "Add workaround for cypress bug"
|
185
|
+
},
|
186
|
+
{
|
187
|
+
"author": "olfedias@microsoft.com",
|
188
|
+
"package": "@fluentui/react-menu",
|
189
|
+
"commit": "c061e98be4b4a718c72a144a1f60bb5515824612",
|
190
|
+
"comment": "remove inline-style-expand-shorthand from tsconfigs"
|
191
|
+
},
|
192
|
+
{
|
193
|
+
"author": "elcraig@microsoft.com",
|
194
|
+
"package": "@fluentui/react-menu",
|
195
|
+
"commit": "3360b45ec159250b1346c91afad7dce138e6bc20",
|
196
|
+
"comment": "Update API file to version generated by typescript 4.3"
|
197
|
+
},
|
198
|
+
{
|
199
|
+
"author": "martinhochel@microsoft.com",
|
200
|
+
"package": "@fluentui/react-menu",
|
201
|
+
"commit": "8dfa712156b70414205b87b5b6d099367b0c297d",
|
202
|
+
"comment": "chore: use storybook runner for all vNext packages"
|
87
203
|
}
|
88
204
|
]
|
89
205
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,29 +1,44 @@
|
|
1
1
|
# Change Log - @fluentui/react-menu
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Fri, 21 Jan 2022 04:16:22 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-
|
7
|
+
## [0.0.0-nightlyd514b3e0ee20220121.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-menu_v0.0.0-nightlyd514b3e0ee20220121.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-menu_v9.0.0-beta.5..@fluentui/react-menu_v0.0.0-
|
9
|
+
Fri, 21 Jan 2022 04:16:22 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-menu_v9.0.0-beta.5..@fluentui/react-menu_v0.0.0-nightlyd514b3e0ee20220121.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
|
-
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/
|
14
|
+
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by email not defined)
|
15
|
+
- fix: set `aria-expanded` and `aria-haspopup` values correctly ([PR #20957](https://github.com/microsoft/fluentui/pull/20957) by lingfangao@hotmail.com)
|
16
|
+
- fix: Focus on first menu item on click ([PR #20955](https://github.com/microsoft/fluentui/pull/20955) by lingfangao@hotmail.com)
|
17
|
+
- fix: MenuTrigger should work correctly when `aria-disabled="true"` ([PR #21349](https://github.com/microsoft/fluentui/pull/21349) by lingfangao@hotmail.com)
|
18
|
+
- Allow `MenuTrigger` to be wrapped by another trigger ([PR #21225](https://github.com/microsoft/fluentui/pull/21225) by lingfangao@hotmail.com)
|
19
|
+
- Updating packages based on changes to focusIndicator functions to remove functions from makeStyles in @fluentui/react-tabster. ([PR #21035](https://github.com/microsoft/fluentui/pull/21035) by Humberto.Morimoto@microsoft.com)
|
20
|
+
- Remove component's shorthandProps array ([PR #21134](https://github.com/microsoft/fluentui/pull/21134) by behowell@microsoft.com)
|
15
21
|
- update styles to not use CSS shorthands ([PR #20820](https://github.com/microsoft/fluentui/pull/20820) by olfedias@microsoft.com)
|
16
|
-
-
|
17
|
-
-
|
18
|
-
-
|
19
|
-
-
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
23
|
-
-
|
24
|
-
-
|
25
|
-
- Bump @fluentui/
|
26
|
-
- Bump @fluentui/react-
|
22
|
+
- fix: Call `useCheckmarkStyles` in `useMenuItemStyles` ([PR #20956](https://github.com/microsoft/fluentui/pull/20956) by lingfangao@hotmail.com)
|
23
|
+
- Updating based on removal of functions from makeStyles. ([PR #21239](https://github.com/microsoft/fluentui/pull/21239) by Humberto.Morimoto@microsoft.com)
|
24
|
+
- Replacing use of functions in makeStyles with direct use of tokens. ([PR #21048](https://github.com/microsoft/fluentui/pull/21048) by Humberto.Morimoto@microsoft.com)
|
25
|
+
- Apply fontSize styling to icon slot ([PR #21222](https://github.com/microsoft/fluentui/pull/21222) by behowell@microsoft.com)
|
26
|
+
- Update react-icons usage to resizable icons ([PR #21074](https://github.com/microsoft/fluentui/pull/21074) by ololubek@microsoft.com)
|
27
|
+
- feat: implement `MenuSplitGroup` component for split menu items ([PR #21095](https://github.com/microsoft/fluentui/pull/21095) by lingfangao@hotmail.com)
|
28
|
+
- Updating use of tokens.fontWeight now that we don't need to use casting. ([PR #21217](https://github.com/microsoft/fluentui/pull/21217) by Humberto.Morimoto@microsoft.com)
|
29
|
+
- (fix): Update react-icons dependency to latest version ([PR #20943](https://github.com/microsoft/fluentui/pull/20943) by ololubek@microsoft.com)
|
30
|
+
- breaking: MenuTrigger must be the first child of the `Menu` ([PR #21096](https://github.com/microsoft/fluentui/pull/21096) by lingfangao@hotmail.com)
|
31
|
+
- Bump @fluentui/keyboard-keys to v0.0.0-nightlyd514b3e0ee20220121.1 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by beachball)
|
32
|
+
- Bump @fluentui/react-context-selector to v0.0.0-nightlyd514b3e0ee20220121.1 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by beachball)
|
33
|
+
- Bump @fluentui/react-make-styles to v0.0.0-nightlyd514b3e0ee20220121.1 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by beachball)
|
34
|
+
- Bump @fluentui/react-portal to v0.0.0-nightlyd514b3e0ee20220121.1 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by beachball)
|
35
|
+
- Bump @fluentui/react-positioning to v0.0.0-nightlyd514b3e0ee20220121.1 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by beachball)
|
36
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightlyd514b3e0ee20220121.1 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by beachball)
|
37
|
+
- Bump @fluentui/react-tabster to v0.0.0-nightlyd514b3e0ee20220121.1 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by beachball)
|
38
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightlyd514b3e0ee20220121.1 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by beachball)
|
39
|
+
- Bump @fluentui/babel-make-styles to v0.0.0-nightlyd514b3e0ee20220121.1 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by beachball)
|
40
|
+
- Bump @fluentui/jest-serializer-make-styles to v0.0.0-nightlyd514b3e0ee20220121.1 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by beachball)
|
41
|
+
- Bump @fluentui/react-conformance-make-styles to v0.0.0-nightlyd514b3e0ee20220121.1 ([commit](https://github.com/microsoft/fluentui/commit/89feafb688fbb160fb8519724479b3c68a79d090) by beachball)
|
27
42
|
|
28
43
|
## [9.0.0-beta.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-menu_v9.0.0-beta.5)
|
29
44
|
|
package/Spec.md
CHANGED
@@ -619,7 +619,7 @@ const menu = (
|
|
619
619
|
|
620
620
|
```html
|
621
621
|
<!-- expected DOM output -->
|
622
|
-
<button aria-haspopup="
|
622
|
+
<button aria-haspopup="menu" aria-expanded="true" id="trigger">Open menu</button>
|
623
623
|
<div role="menu" aria-labelledby="trigger">
|
624
624
|
<div role="menuitem" tabindex="0">Option 1</div>
|
625
625
|
<div role="menuitem" tabindex="-1">Option 2</div>
|
@@ -644,7 +644,7 @@ const menu = (
|
|
644
644
|
|
645
645
|
```html
|
646
646
|
<!-- expected DOM output -->
|
647
|
-
<button aria-haspopup="
|
647
|
+
<button aria-haspopup="menu" aria-expanded="true" id="trigger">Open menu</button>
|
648
648
|
<div role="menu" aria-labelledby="trigger">
|
649
649
|
<div role="menuitem" tabindex="0">
|
650
650
|
<span role="presentation"><svg>FileIcon</svg></span>
|
@@ -682,7 +682,7 @@ const menu = (
|
|
682
682
|
|
683
683
|
```html
|
684
684
|
<!-- expected DOM output -->
|
685
|
-
<button aria-haspopup="
|
685
|
+
<button aria-haspopup="menu" aria-expanded="true" id="trigger">Open menu</button>
|
686
686
|
<div role="menu" aria-labelledby="trigger">
|
687
687
|
<div role="menuitem" tabindex="0">Option 1</div>
|
688
688
|
<div role="separator" aria-hidden="true"></div>
|
@@ -719,7 +719,7 @@ const menu = (
|
|
719
719
|
|
720
720
|
```html
|
721
721
|
<!-- expected DOM output -->
|
722
|
-
<button aria-haspopup="
|
722
|
+
<button aria-haspopup="menu" aria-expanded="true" id="trigger">Open menu</button>
|
723
723
|
<div role="menu" aria-labelledby="trigger">
|
724
724
|
<div role="menuitem" tabindex="0">Option 1</div>
|
725
725
|
<div role="separator" aria-hidden="true"></div>
|
@@ -758,10 +758,10 @@ const menu = (
|
|
758
758
|
|
759
759
|
```html
|
760
760
|
<!-- expected DOM output -->
|
761
|
-
<button aria-haspopup="
|
761
|
+
<button aria-haspopup="menu" aria-expanded="true" id="trigger">Open menu</button>
|
762
762
|
<div role="menu" aria-labelledby="trigger">
|
763
763
|
<div role="menuitem" tabindex="0">Option 1</div>
|
764
|
-
<div role="menuitem" tabindex="-1" aria-haspopup="
|
764
|
+
<div role="menuitem" tabindex="-1" aria-haspopup="menu" aria-expanded="false" id="submenu-trigger">Open submenu</div>
|
765
765
|
</div>
|
766
766
|
|
767
767
|
<!-- expected DOM output for submenu -->
|
@@ -843,7 +843,7 @@ const menuSelectableSections = (
|
|
843
843
|
```
|
844
844
|
|
845
845
|
```html
|
846
|
-
<button aria-haspopup="
|
846
|
+
<button aria-haspopup="menu" aria-expanded="true" id="trigger">Open menu</button>
|
847
847
|
|
848
848
|
<!-- expected DOM output for basic checkbox -->
|
849
849
|
<div role="menu" aria-labelledby="trigger">
|
@@ -882,9 +882,12 @@ const menuSplitbutton= (
|
|
882
882
|
<MenuList>
|
883
883
|
<MenuItem>Option 1</MenuItem>
|
884
884
|
<Menu>
|
885
|
-
<
|
886
|
-
<
|
887
|
-
|
885
|
+
<MenuSplitGroup>
|
886
|
+
<MenuItem>Main action</MenuItem>
|
887
|
+
<MenuTrigger>
|
888
|
+
<MenuItem />
|
889
|
+
</MenuTrigger>
|
890
|
+
</MenuSplitGroup>
|
888
891
|
<MenuItem>Option 1</MenuItem>
|
889
892
|
<MenuItem>Option 2</MenuItem>
|
890
893
|
<MenuItem>Option 3</MenuItem>
|
@@ -897,7 +900,7 @@ const menuSplitbutton= (
|
|
897
900
|
```html
|
898
901
|
<div role="menu" aria-labelledby="trigger">
|
899
902
|
<div role="menuitem" tabindex="0">Option 1</div>
|
900
|
-
<div role="menuitem" tabindex="-1" aria-haspopup="
|
903
|
+
<div role="menuitem" tabindex="-1" aria-haspopup="menu" aria-expanded="false" id="submenu-trigger">Open submenu</div>
|
901
904
|
</div>
|
902
905
|
|
903
906
|
<!-- expected DOM output -->
|
@@ -905,7 +908,7 @@ const menuSplitbutton= (
|
|
905
908
|
<div role="menuitem" tabindex="0">Option 1</div>
|
906
909
|
<div role="group">
|
907
910
|
<div role="menuitem" tabindex="-1">content slot</div>
|
908
|
-
<div role="menuitem" tabindex="-1" aria-haspopup="
|
911
|
+
<div role="menuitem" tabindex="-1" aria-haspopup="menu" aria-expanded="false" id="submenu-trgger">
|
909
912
|
<svg>indicator icon</svg>
|
910
913
|
</div>
|
911
914
|
</div>
|
@@ -958,11 +961,13 @@ Below is a set of diagrams that tries to illustrates all the interactions menus
|
|
958
961
|
|
959
962
|
All of the above Mouse events seen previously should apply to the part of the split button that is intended to open a submenu.
|
960
963
|
|
961
|
-
|
962
|
-
|
963
|
-
![Using up/down arrow key](./etc/images/splitbutton-up-down.jpg)
|
964
|
+
> TODO convert these diagrams to excalidraw or smth that is text format
|
965
|
+
> TODO add extra descriptions to diagrams
|
964
966
|
|
965
|
-
|
967
|
+
<img src="./etc/images/menu-interactions/Slide19.PNG" width="700" />
|
968
|
+
<img src="./etc/images/menu-interactions/Slide20.PNG" width="700" />
|
969
|
+
<img src="./etc/images/menu-interactions/Slide21.PNG" width="700" />
|
970
|
+
<img src="./etc/images/menu-interactions/Slide22.PNG" width="700" />
|
966
971
|
|
967
972
|
### MenuItem selection
|
968
973
|
|
package/dist/react-menu.d.ts
CHANGED
@@ -238,18 +238,13 @@ export declare type MenuItemSlots = {
|
|
238
238
|
* Component children are placed in this slot
|
239
239
|
* Avoid using the `children` property in this slot in favour of Component children whenever possible
|
240
240
|
*/
|
241
|
-
content
|
241
|
+
content?: IntrinsicShorthandProps<'span'>;
|
242
242
|
/**
|
243
243
|
* Secondary content rendered opposite the primary content (e.g Shortcut text)
|
244
244
|
*/
|
245
245
|
secondaryContent?: IntrinsicShorthandProps<'span'>;
|
246
246
|
};
|
247
247
|
|
248
|
-
/**
|
249
|
-
* Consts listing which props are shorthand props.
|
250
|
-
*/
|
251
|
-
export declare const menuItemSlots: Array<keyof MenuItemSlots>;
|
252
|
-
|
253
248
|
export declare type MenuItemState = ComponentState<MenuItemSlots> & MenuItemCommons;
|
254
249
|
|
255
250
|
/**
|
@@ -386,6 +381,29 @@ export declare const MenuProvider: React_2.Provider<MenuContextValue> & React_2.
|
|
386
381
|
|
387
382
|
export declare type MenuSlots = {};
|
388
383
|
|
384
|
+
/**
|
385
|
+
* Layout wrapper that provides extra keyboard navigation behavior for two `MenuItem` components.
|
386
|
+
*/
|
387
|
+
export declare const MenuSplitGroup: ForwardRefComponent<MenuSplitGroupProps>;
|
388
|
+
|
389
|
+
export declare const menuSplitGroupClassName = "fui-MenuSplitGroup";
|
390
|
+
|
391
|
+
export declare type MenuSplitGroupCommons = {};
|
392
|
+
|
393
|
+
/**
|
394
|
+
* MenuSplitGroup Props
|
395
|
+
*/
|
396
|
+
export declare type MenuSplitGroupProps = ComponentProps<MenuSplitGroupSlots> & MenuSplitGroupCommons;
|
397
|
+
|
398
|
+
export declare type MenuSplitGroupSlots = {
|
399
|
+
root: IntrinsicShorthandProps<'div'>;
|
400
|
+
};
|
401
|
+
|
402
|
+
/**
|
403
|
+
* State used in rendering MenuSplitGroup
|
404
|
+
*/
|
405
|
+
export declare type MenuSplitGroupState = ComponentState<MenuSplitGroupSlots> & MenuSplitGroupCommons;
|
406
|
+
|
389
407
|
export declare type MenuState = MenuCommons & ComponentState<MenuSlots> & {
|
390
408
|
/**
|
391
409
|
* Callback to open/close the popup
|
@@ -429,13 +447,14 @@ export declare type MenuState = MenuCommons & ComponentState<MenuSlots> & {
|
|
429
447
|
* Wraps a trigger element as an only child
|
430
448
|
* and adds the necessary event handling to open a popup menu
|
431
449
|
*/
|
432
|
-
export declare const MenuTrigger: React_2.
|
450
|
+
export declare const MenuTrigger: React_2.ForwardRefExoticComponent<MenuTriggerProps & React_2.RefAttributes<HTMLElement>>;
|
433
451
|
|
434
452
|
/**
|
435
453
|
* Props that are passed to the child of the MenuTrigger when cloned to ensure correct behaviour for the Menu
|
436
454
|
*/
|
437
|
-
export declare type MenuTriggerChildProps = Required<Pick<React_2.HTMLAttributes<HTMLElement>, 'onClick' | 'onMouseEnter' | 'onMouseLeave' | '
|
455
|
+
export declare type MenuTriggerChildProps = Required<Pick<React_2.HTMLAttributes<HTMLElement>, 'onClick' | 'onMouseEnter' | 'onMouseLeave' | 'onMouseMove' | 'onContextMenu' | 'onKeyDown' | 'aria-haspopup' | 'id'>> & {
|
438
456
|
ref?: React_2.Ref<never>;
|
457
|
+
'aria-expanded': boolean | undefined;
|
439
458
|
};
|
440
459
|
|
441
460
|
export declare const MenuTriggerContextProvider: React_2.Provider<boolean>;
|
@@ -449,7 +468,9 @@ export declare type MenuTriggerProps = {
|
|
449
468
|
}) | ((props: MenuTriggerChildProps) => React_2.ReactNode);
|
450
469
|
};
|
451
470
|
|
452
|
-
export declare type MenuTriggerState =
|
471
|
+
export declare type MenuTriggerState = {
|
472
|
+
children: React_2.ReactNode;
|
473
|
+
};
|
453
474
|
|
454
475
|
/**
|
455
476
|
* Render the final JSX of Menu
|
@@ -498,6 +519,11 @@ export declare const renderMenuList: (state: MenuListState, contextValues: MenuL
|
|
498
519
|
*/
|
499
520
|
export declare const renderMenuPopover: (state: MenuPopoverState) => JSX.Element;
|
500
521
|
|
522
|
+
/**
|
523
|
+
* Render the final JSX of MenuSplitGroup
|
524
|
+
*/
|
525
|
+
export declare const renderMenuSplitGroup: (state: MenuSplitGroupState) => JSX.Element;
|
526
|
+
|
501
527
|
/**
|
502
528
|
* Render the final JSX of MenuTrigger
|
503
529
|
*
|
@@ -535,7 +561,7 @@ export declare function useMenuContextValues(state: MenuState): MenuContextValue
|
|
535
561
|
*/
|
536
562
|
export declare const useMenuDivider: (props: MenuDividerProps, ref: React_2.Ref<HTMLElement>) => MenuDividerState;
|
537
563
|
|
538
|
-
export declare const useMenuDividerStyles: (state: MenuDividerState) =>
|
564
|
+
export declare const useMenuDividerStyles: (state: MenuDividerState) => MenuDividerState;
|
539
565
|
|
540
566
|
/**
|
541
567
|
* Given user props, returns state and render function for a MenuGroup.
|
@@ -551,7 +577,7 @@ export declare function useMenuGroupContextValues(state: MenuGroupState): MenuGr
|
|
551
577
|
*/
|
552
578
|
export declare function useMenuGroupHeader(props: MenuGroupHeaderProps, ref: React_2.Ref<HTMLElement>): MenuGroupHeaderState;
|
553
579
|
|
554
|
-
export declare const useMenuGroupHeaderStyles: (state: MenuGroupHeaderState) =>
|
580
|
+
export declare const useMenuGroupHeaderStyles: (state: MenuGroupHeaderState) => MenuGroupHeaderState;
|
555
581
|
|
556
582
|
export declare const useMenuGroupStyles: (state: MenuGroupState) => MenuGroupState;
|
557
583
|
|
@@ -605,13 +631,29 @@ export declare const useMenuPopover: (props: MenuPopoverProps, ref: React_2.Ref<
|
|
605
631
|
*/
|
606
632
|
export declare const useMenuPopoverStyles: (state: MenuPopoverState) => MenuPopoverState;
|
607
633
|
|
634
|
+
/**
|
635
|
+
* Create the state required to render MenuSplitGroup.
|
636
|
+
*
|
637
|
+
* The returned state can be modified with hooks such as useMenuSplitGroupStyles,
|
638
|
+
* before being passed to renderMenuSplitGroup.
|
639
|
+
*
|
640
|
+
* @param props - props from this instance of MenuSplitGroup
|
641
|
+
* @param ref - reference to root HTMLElement of MenuSplitGroup
|
642
|
+
*/
|
643
|
+
export declare const useMenuSplitGroup: (props: MenuSplitGroupProps, ref: React_2.Ref<HTMLElement>) => MenuSplitGroupState;
|
644
|
+
|
645
|
+
/**
|
646
|
+
* Apply styling to the MenuSplitGroup slots based on the state
|
647
|
+
*/
|
648
|
+
export declare const useMenuSplitGroupStyles: (state: MenuSplitGroupState) => MenuSplitGroupState;
|
649
|
+
|
608
650
|
/**
|
609
651
|
* Create the state required to render MenuTrigger.
|
610
652
|
* Clones the only child component and adds necessary event handling behaviours to open a popup menu
|
611
653
|
*
|
612
654
|
* @param props - props from this instance of MenuTrigger
|
613
655
|
*/
|
614
|
-
export declare const useMenuTrigger: (props: MenuTriggerProps) => MenuTriggerState;
|
656
|
+
export declare const useMenuTrigger: (props: MenuTriggerProps, ref: React_2.Ref<HTMLElement>) => MenuTriggerState;
|
615
657
|
|
616
658
|
export declare const useMenuTriggerContext: () => boolean;
|
617
659
|
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './components/MenuSplitGroup/index';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuSplitGroup.js","sourceRoot":"","sources":["../src/MenuSplitGroup.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
|
@@ -4,7 +4,6 @@ import { useControllableState, useId, useOnClickOutside, useEventCallback } from
|
|
4
4
|
import { useFluent } from '@fluentui/react-shared-contexts';
|
5
5
|
import { elementContains } from '@fluentui/react-portal';
|
6
6
|
import { useFocusFinders } from '@fluentui/react-tabster';
|
7
|
-
import { MenuTrigger } from '../MenuTrigger/index';
|
8
7
|
import { useMenuContext } from '../../contexts/menuContext';
|
9
8
|
import { MENU_ENTER_EVENT, useOnMenuMouseEnter } from '../../utils/index';
|
10
9
|
import { useIsSubmenu } from '../../utils/useIsSubmenu';
|
@@ -29,23 +28,28 @@ export const useMenu = props => {
|
|
29
28
|
};
|
30
29
|
const children = React.Children.toArray(props.children);
|
31
30
|
|
32
|
-
if (
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
if (process.env.NODE_ENV !== 'production') {
|
32
|
+
if (children.length === 0) {
|
33
|
+
// eslint-disable-next-line no-console
|
34
|
+
console.warn('Menu must contain at least one child');
|
35
|
+
}
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
} = children.reduce((acc, child) => {
|
41
|
-
if (child.type === MenuTrigger) {
|
42
|
-
acc.menuTrigger = child;
|
43
|
-
} else {
|
44
|
-
acc.menuPopover = child;
|
37
|
+
if (children.length > 2) {
|
38
|
+
// eslint-disable-next-line no-console
|
39
|
+
console.warn('Menu must contain at most two children');
|
45
40
|
}
|
41
|
+
}
|
42
|
+
|
43
|
+
let menuTrigger = undefined;
|
44
|
+
let menuPopover = undefined;
|
45
|
+
|
46
|
+
if (children.length === 2) {
|
47
|
+
menuTrigger = children[0];
|
48
|
+
menuPopover = children[1];
|
49
|
+
} else if (children.length === 1) {
|
50
|
+
menuPopover = children[0];
|
51
|
+
}
|
46
52
|
|
47
|
-
return acc;
|
48
|
-
}, {});
|
49
53
|
const {
|
50
54
|
targetRef: triggerRef,
|
51
55
|
containerRef: menuPopoverRef
|
@@ -61,7 +65,8 @@ export const useMenu = props => {
|
|
61
65
|
menuTrigger,
|
62
66
|
menuPopover,
|
63
67
|
triggerRef,
|
64
|
-
menuPopoverRef
|
68
|
+
menuPopoverRef,
|
69
|
+
components: {}
|
65
70
|
}; // TODO Better way to narrow types ?
|
66
71
|
|
67
72
|
const [open, setOpen] = useMenuOpenState(initialState);
|
@@ -227,15 +232,18 @@ const useMenuOpenState = state => {
|
|
227
232
|
prevFocusable === null || prevFocusable === void 0 ? void 0 : prevFocusable.focus();
|
228
233
|
}, [findPrevFocusable, state.triggerRef]);
|
229
234
|
React.useEffect(() => {
|
230
|
-
|
231
|
-
|
232
|
-
if (!shouldHandleKeyboardRef.current) {
|
233
|
-
return;
|
235
|
+
if (open) {
|
236
|
+
focusFirst();
|
234
237
|
}
|
238
|
+
}, [open, focusFirst]);
|
239
|
+
React.useEffect(() => {
|
240
|
+
var _a;
|
235
241
|
|
236
242
|
if (open) {
|
237
243
|
focusFirst();
|
238
|
-
}
|
244
|
+
}
|
245
|
+
|
246
|
+
if (shouldHandleKeyboardRef.current && !open) {
|
239
247
|
if (shouldHandleTabRef.current && !state.isSubmenu) {
|
240
248
|
pressedShiftRef.current ? focusBeforeMenuTrigger() : focusAfterMenuTrigger();
|
241
249
|
} else {
|