@fluentui-react-native/menu 0.14.3 → 0.14.6
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 +64 -1
- package/CHANGELOG.md +29 -2
- package/SPEC.md +5 -6
- package/lib/Menu/Menu.types.d.ts +1 -0
- package/lib/Menu/Menu.types.d.ts.map +1 -1
- package/lib/Menu/useMenu.d.ts.map +1 -1
- package/lib/Menu/useMenu.js +31 -11
- package/lib/Menu/useMenu.js.map +1 -1
- package/lib/MenuDivider/MenuDividerTokens.macos.d.ts +5 -0
- package/lib/MenuDivider/MenuDividerTokens.macos.d.ts.map +1 -0
- package/lib/MenuDivider/MenuDividerTokens.macos.js +7 -0
- package/lib/MenuDivider/MenuDividerTokens.macos.js.map +1 -0
- package/lib/MenuItem/MenuItem.styling.d.ts.map +1 -1
- package/lib/MenuItem/MenuItem.styling.js +4 -4
- package/lib/MenuItem/MenuItem.styling.js.map +1 -1
- package/lib/MenuItem/MenuItemTokens.macos.d.ts +5 -0
- package/lib/MenuItem/MenuItemTokens.macos.d.ts.map +1 -0
- package/lib/MenuItem/MenuItemTokens.macos.js +28 -0
- package/lib/MenuItem/MenuItemTokens.macos.js.map +1 -0
- package/lib/MenuItem/useMenuItem.d.ts.map +1 -1
- package/lib/MenuItem/useMenuItem.js +8 -2
- package/lib/MenuItem/useMenuItem.js.map +1 -1
- package/lib/MenuItemCheckbox/MenuItemCheckbox.styling.d.ts.map +1 -1
- package/lib/MenuItemCheckbox/MenuItemCheckbox.styling.js +2 -2
- package/lib/MenuItemCheckbox/MenuItemCheckbox.styling.js.map +1 -1
- package/lib/MenuItemCheckbox/MenuItemCheckboxTokens.macos.d.ts +5 -0
- package/lib/MenuItemCheckbox/MenuItemCheckboxTokens.macos.d.ts.map +1 -0
- package/lib/MenuItemCheckbox/MenuItemCheckboxTokens.macos.js +44 -0
- package/lib/MenuItemCheckbox/MenuItemCheckboxTokens.macos.js.map +1 -0
- package/lib/MenuItemCheckbox/useMenuItemCheckbox.d.ts.map +1 -1
- package/lib/MenuItemCheckbox/useMenuItemCheckbox.js +9 -2
- package/lib/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib/MenuItemRadio/useMenuItemRadio.d.ts.map +1 -1
- package/lib/MenuItemRadio/useMenuItemRadio.js +9 -4
- package/lib/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib/MenuList/MenuList.js +1 -1
- package/lib/MenuList/MenuList.js.map +1 -1
- package/lib/MenuList/MenuList.types.d.ts +11 -6
- package/lib/MenuList/MenuList.types.d.ts.map +1 -1
- package/lib/MenuList/MenuList.types.js.map +1 -1
- package/lib/MenuList/MenuListTokens.macos.d.ts +5 -0
- package/lib/MenuList/MenuListTokens.macos.d.ts.map +1 -0
- package/lib/MenuList/MenuListTokens.macos.js +7 -0
- package/lib/MenuList/MenuListTokens.macos.js.map +1 -0
- package/lib/MenuList/useMenuList.d.ts.map +1 -1
- package/lib/MenuList/useMenuList.js +73 -26
- package/lib/MenuList/useMenuList.js.map +1 -1
- package/lib/MenuList/useMenuListContextValue.js +1 -1
- package/lib/MenuList/useMenuListContextValue.js.map +1 -1
- package/lib/MenuPopover/useMenuPopover.d.ts.map +1 -1
- package/lib/MenuPopover/useMenuPopover.js +3 -1
- package/lib/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib/MenuTrigger/useMenuTrigger.d.ts.map +1 -1
- package/lib/MenuTrigger/useMenuTrigger.js +2 -0
- package/lib/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib/__tests__/Menu.test.js +2 -2
- package/lib/__tests__/Menu.test.js.map +1 -1
- package/lib/context/menuContext.d.ts.map +1 -1
- package/lib/context/menuContext.js +3 -2
- package/lib/context/menuContext.js.map +1 -1
- package/lib/context/menuListContext.d.ts +6 -4
- package/lib/context/menuListContext.d.ts.map +1 -1
- package/lib/context/menuListContext.js +2 -1
- package/lib/context/menuListContext.js.map +1 -1
- package/lib-commonjs/Menu/Menu.types.d.ts +1 -0
- package/lib-commonjs/Menu/Menu.types.d.ts.map +1 -1
- package/lib-commonjs/Menu/useMenu.d.ts.map +1 -1
- package/lib-commonjs/Menu/useMenu.js +31 -11
- package/lib-commonjs/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/MenuDivider/MenuDividerTokens.macos.d.ts +5 -0
- package/lib-commonjs/MenuDivider/MenuDividerTokens.macos.d.ts.map +1 -0
- package/lib-commonjs/MenuDivider/MenuDividerTokens.macos.js +11 -0
- package/lib-commonjs/MenuDivider/MenuDividerTokens.macos.js.map +1 -0
- package/lib-commonjs/MenuItem/MenuItem.styling.d.ts.map +1 -1
- package/lib-commonjs/MenuItem/MenuItem.styling.js +3 -3
- package/lib-commonjs/MenuItem/MenuItem.styling.js.map +1 -1
- package/lib-commonjs/MenuItem/MenuItemTokens.macos.d.ts +5 -0
- package/lib-commonjs/MenuItem/MenuItemTokens.macos.d.ts.map +1 -0
- package/lib-commonjs/MenuItem/MenuItemTokens.macos.js +32 -0
- package/lib-commonjs/MenuItem/MenuItemTokens.macos.js.map +1 -0
- package/lib-commonjs/MenuItem/useMenuItem.d.ts.map +1 -1
- package/lib-commonjs/MenuItem/useMenuItem.js +7 -1
- package/lib-commonjs/MenuItem/useMenuItem.js.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckbox.styling.d.ts.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckbox.styling.js +1 -1
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckbox.styling.js.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckboxTokens.macos.d.ts +5 -0
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckboxTokens.macos.d.ts.map +1 -0
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckboxTokens.macos.js +48 -0
- package/lib-commonjs/MenuItemCheckbox/MenuItemCheckboxTokens.macos.js.map +1 -0
- package/lib-commonjs/MenuItemCheckbox/useMenuItemCheckbox.d.ts.map +1 -1
- package/lib-commonjs/MenuItemCheckbox/useMenuItemCheckbox.js +9 -2
- package/lib-commonjs/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/MenuItemRadio/useMenuItemRadio.d.ts.map +1 -1
- package/lib-commonjs/MenuItemRadio/useMenuItemRadio.js +9 -4
- package/lib-commonjs/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib-commonjs/MenuList/MenuList.js +1 -1
- package/lib-commonjs/MenuList/MenuList.js.map +1 -1
- package/lib-commonjs/MenuList/MenuList.types.d.ts +11 -6
- package/lib-commonjs/MenuList/MenuList.types.d.ts.map +1 -1
- package/lib-commonjs/MenuList/MenuList.types.js.map +1 -1
- package/lib-commonjs/MenuList/MenuListTokens.macos.d.ts +5 -0
- package/lib-commonjs/MenuList/MenuListTokens.macos.d.ts.map +1 -0
- package/lib-commonjs/MenuList/MenuListTokens.macos.js +11 -0
- package/lib-commonjs/MenuList/MenuListTokens.macos.js.map +1 -0
- package/lib-commonjs/MenuList/useMenuList.d.ts.map +1 -1
- package/lib-commonjs/MenuList/useMenuList.js +74 -27
- package/lib-commonjs/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/MenuList/useMenuListContextValue.js +1 -1
- package/lib-commonjs/MenuList/useMenuListContextValue.js.map +1 -1
- package/lib-commonjs/MenuPopover/useMenuPopover.d.ts.map +1 -1
- package/lib-commonjs/MenuPopover/useMenuPopover.js +3 -1
- package/lib-commonjs/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib-commonjs/MenuTrigger/useMenuTrigger.d.ts.map +1 -1
- package/lib-commonjs/MenuTrigger/useMenuTrigger.js +2 -0
- package/lib-commonjs/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib-commonjs/__tests__/Menu.test.js +2 -2
- package/lib-commonjs/__tests__/Menu.test.js.map +1 -1
- package/lib-commonjs/context/menuContext.d.ts.map +1 -1
- package/lib-commonjs/context/menuContext.js +3 -2
- package/lib-commonjs/context/menuContext.js.map +1 -1
- package/lib-commonjs/context/menuListContext.d.ts +6 -4
- package/lib-commonjs/context/menuListContext.d.ts.map +1 -1
- package/lib-commonjs/context/menuListContext.js +2 -1
- package/lib-commonjs/context/menuListContext.js.map +1 -1
- package/package.json +4 -4
- package/src/Menu/Menu.types.ts +1 -0
- package/src/Menu/useMenu.ts +45 -13
- package/src/MenuDivider/MenuDividerTokens.macos.ts +10 -0
- package/src/MenuItem/MenuItem.styling.ts +4 -3
- package/src/MenuItem/MenuItemTokens.macos.ts +31 -0
- package/src/MenuItem/useMenuItem.ts +9 -3
- package/src/MenuItemCheckbox/MenuItemCheckbox.styling.ts +2 -1
- package/src/MenuItemCheckbox/MenuItemCheckboxTokens.macos.ts +47 -0
- package/src/MenuItemCheckbox/useMenuItemCheckbox.ts +10 -4
- package/src/MenuItemRadio/useMenuItemRadio.ts +11 -3
- package/src/MenuList/MenuList.tsx +1 -1
- package/src/MenuList/MenuList.types.ts +11 -5
- package/src/MenuList/MenuListTokens.macos.ts +10 -0
- package/src/MenuList/useMenuList.ts +76 -37
- package/src/MenuList/useMenuListContextValue.ts +1 -1
- package/src/MenuPopover/useMenuPopover.ts +3 -0
- package/src/MenuTrigger/useMenuTrigger.ts +2 -0
- package/src/__tests__/Menu.test.tsx +2 -2
- package/src/__tests__/__snapshots__/Menu.test.tsx.snap +28 -0
- package/src/context/menuContext.ts +3 -2
- package/src/context/menuListContext.ts +5 -2
|
@@ -3,66 +3,105 @@ import React from 'react';
|
|
|
3
3
|
import { useMenuContext } from '../context/menuContext';
|
|
4
4
|
import { MenuListProps, MenuListState } from './MenuList.types';
|
|
5
5
|
|
|
6
|
+
// Track the radio items so we know what to clear selection from when selectRadio is called
|
|
7
|
+
// Purposefully left out of the hook because
|
|
8
|
+
// 1. RadioItems just keeps track of information - changing this array doesn't need to force rerender
|
|
9
|
+
// 2. Keeping them here means these consts are not recreated on every render, which would force rerendering of all children
|
|
10
|
+
const radioItems = [];
|
|
11
|
+
const addRadioItem = (name: string) => {
|
|
12
|
+
radioItems.push(name);
|
|
13
|
+
};
|
|
14
|
+
const removeRadioItem = (name: string) => {
|
|
15
|
+
radioItems.filter((item) => item !== name);
|
|
16
|
+
};
|
|
17
|
+
|
|
6
18
|
export const useMenuList = (_props: MenuListProps): MenuListState => {
|
|
7
19
|
const context = useMenuContext();
|
|
8
20
|
|
|
9
21
|
// MenuList v2 needs to be able to be standalone, but this is not in scope for v1
|
|
10
22
|
// Assuming that checked information will come from parent Menu
|
|
11
|
-
const
|
|
12
|
-
const [checked, onCheckedChange, selectRadio] = useMenuCheckedState(isCheckedControlled, context);
|
|
23
|
+
const { defaultChecked, onCheckedChange: onCheckedChangeOriginal, checked: checkedOriginal } = context;
|
|
13
24
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
// Convert passed in array to map so that i's easier to look up checked state
|
|
26
|
+
const checkedMap = React.useMemo(() => {
|
|
27
|
+
const state = {};
|
|
28
|
+
if (!checkedOriginal) {
|
|
29
|
+
return state;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
for (const key of checkedOriginal) {
|
|
33
|
+
state[key] = true;
|
|
34
|
+
}
|
|
35
|
+
return state;
|
|
36
|
+
}, [checkedOriginal]);
|
|
37
|
+
|
|
38
|
+
const [checkedInternal, setCheckedInternal] = React.useState<Record<string, boolean>>(() => {
|
|
39
|
+
if (checkedMap) {
|
|
40
|
+
return checkedMap;
|
|
41
|
+
}
|
|
22
42
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
] => {
|
|
31
|
-
const { defaultChecked, onCheckedChange, checked } = props;
|
|
32
|
-
const initialState = defaultChecked ?? checked ?? {};
|
|
33
|
-
const [checkedInternal, setCheckedInternal] = React.useState<Record<string, boolean>>(initialState);
|
|
43
|
+
const initialChecked = defaultChecked ?? [];
|
|
44
|
+
const state = {};
|
|
45
|
+
for (const key of initialChecked) {
|
|
46
|
+
state[key] = true;
|
|
47
|
+
}
|
|
48
|
+
return state;
|
|
49
|
+
});
|
|
34
50
|
|
|
35
|
-
const
|
|
51
|
+
const isCheckedControlled = typeof checkedOriginal !== 'undefined';
|
|
52
|
+
const checked = isCheckedControlled ? checkedMap : checkedInternal;
|
|
36
53
|
|
|
37
|
-
const
|
|
54
|
+
const onCheckedChange = React.useCallback(
|
|
38
55
|
(e: InteractionEvent, name: string, isChecked: boolean) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
56
|
+
const updatedChecked = { ...checked };
|
|
57
|
+
if (isChecked) {
|
|
58
|
+
updatedChecked[name] = true;
|
|
59
|
+
} else {
|
|
60
|
+
delete updatedChecked[name];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!isCheckedControlled) {
|
|
43
64
|
setCheckedInternal(updatedChecked);
|
|
44
65
|
}
|
|
45
66
|
|
|
46
|
-
if (
|
|
47
|
-
|
|
67
|
+
if (onCheckedChangeOriginal) {
|
|
68
|
+
onCheckedChangeOriginal(e, Object.keys(updatedChecked));
|
|
48
69
|
}
|
|
49
70
|
},
|
|
50
|
-
[
|
|
71
|
+
[isCheckedControlled, checked, onCheckedChangeOriginal, setCheckedInternal],
|
|
51
72
|
);
|
|
52
73
|
|
|
53
74
|
const selectRadio = React.useCallback(
|
|
54
|
-
(e: InteractionEvent, name: string
|
|
55
|
-
|
|
56
|
-
|
|
75
|
+
(e: InteractionEvent, name: string) => {
|
|
76
|
+
const updatedChecked = {};
|
|
77
|
+
for (const checkedName of Object.keys(checked)) {
|
|
78
|
+
if (!radioItems.includes(checkedName)) {
|
|
79
|
+
// Preserve checked state if non-radio items
|
|
80
|
+
updatedChecked[checkedName] = checked[checkedName];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
updatedChecked[name] = true;
|
|
84
|
+
|
|
85
|
+
if (!isCheckedControlled) {
|
|
57
86
|
setCheckedInternal(updatedChecked);
|
|
58
87
|
}
|
|
59
88
|
|
|
60
|
-
if (
|
|
61
|
-
|
|
89
|
+
if (onCheckedChangeOriginal) {
|
|
90
|
+
onCheckedChangeOriginal(e, Object.keys(updatedChecked));
|
|
62
91
|
}
|
|
63
92
|
},
|
|
64
|
-
[
|
|
93
|
+
[isCheckedControlled, onCheckedChangeOriginal, setCheckedInternal, checked],
|
|
65
94
|
);
|
|
66
95
|
|
|
67
|
-
return
|
|
96
|
+
return {
|
|
97
|
+
props: {
|
|
98
|
+
...context,
|
|
99
|
+
},
|
|
100
|
+
isCheckedControlled,
|
|
101
|
+
checked,
|
|
102
|
+
onCheckedChange,
|
|
103
|
+
selectRadio,
|
|
104
|
+
addRadioItem,
|
|
105
|
+
removeRadioItem,
|
|
106
|
+
};
|
|
68
107
|
};
|
|
@@ -2,5 +2,5 @@ import { MenuListContextValue } from '../context/menuListContext';
|
|
|
2
2
|
import { MenuListState } from './MenuList.types';
|
|
3
3
|
|
|
4
4
|
export const useMenuListContextValue = (state: MenuListState): MenuListContextValue => {
|
|
5
|
-
return { ...state };
|
|
5
|
+
return { hasCheckmarks: state.props.hasCheckmarks, ...state };
|
|
6
6
|
};
|
|
@@ -18,6 +18,7 @@ export const useMenuPopover = (_props: MenuPopoverProps): MenuPopoverState => {
|
|
|
18
18
|
parentPopoverHoverOutTimer,
|
|
19
19
|
popoverHoverOutTimer,
|
|
20
20
|
setPopoverHoverOutTimer,
|
|
21
|
+
shouldFocusOnContainer,
|
|
21
22
|
triggerHoverOutTimer,
|
|
22
23
|
} = context;
|
|
23
24
|
|
|
@@ -60,6 +61,8 @@ export const useMenuPopover = (_props: MenuPopoverProps): MenuPopoverState => {
|
|
|
60
61
|
innerView: {
|
|
61
62
|
onMouseEnter,
|
|
62
63
|
onMouseLeave: isCloseOnHoverOutEnabled && onMouseLeave,
|
|
64
|
+
accessible: shouldFocusOnContainer,
|
|
65
|
+
focusable: shouldFocusOnContainer,
|
|
63
66
|
},
|
|
64
67
|
};
|
|
65
68
|
};
|
|
@@ -38,6 +38,7 @@ export const useMenuTrigger = (): MenuTriggerState => {
|
|
|
38
38
|
if (openOnHover) {
|
|
39
39
|
clearTimeout(popoverHoverOutTimer);
|
|
40
40
|
clearTimeout(triggerHoverOutTimer);
|
|
41
|
+
e.persist();
|
|
41
42
|
setTimeout(() => {
|
|
42
43
|
setOpen(e, true /* isOpen */);
|
|
43
44
|
}, delayHover);
|
|
@@ -49,6 +50,7 @@ export const useMenuTrigger = (): MenuTriggerState => {
|
|
|
49
50
|
const onHoverOut = React.useCallback(
|
|
50
51
|
(e: InteractionEvent) => {
|
|
51
52
|
if (openOnHover) {
|
|
53
|
+
e.persist();
|
|
52
54
|
const timer = setTimeout(() => {
|
|
53
55
|
setOpen(e, false /* isOpen */);
|
|
54
56
|
}, delayHover);
|
|
@@ -110,7 +110,7 @@ describe('Checkbox component tests', () => {
|
|
|
110
110
|
it('Menu open checkbox defaultChecked', () => {
|
|
111
111
|
const tree = renderer
|
|
112
112
|
.create(
|
|
113
|
-
<Menu open defaultChecked={
|
|
113
|
+
<Menu open defaultChecked={['Option 1']}>
|
|
114
114
|
<MenuTrigger>
|
|
115
115
|
<Button>Open</Button>
|
|
116
116
|
</MenuTrigger>
|
|
@@ -130,7 +130,7 @@ describe('Checkbox component tests', () => {
|
|
|
130
130
|
it('Menu open checkbox checked', () => {
|
|
131
131
|
const tree = renderer
|
|
132
132
|
.create(
|
|
133
|
-
<Menu open checked={
|
|
133
|
+
<Menu open checked={['Option 1']}>
|
|
134
134
|
<MenuTrigger>
|
|
135
135
|
<Button>Open</Button>
|
|
136
136
|
</MenuTrigger>
|
|
@@ -153,6 +153,8 @@ Array [
|
|
|
153
153
|
}
|
|
154
154
|
>
|
|
155
155
|
<View
|
|
156
|
+
accessible={false}
|
|
157
|
+
focusable={false}
|
|
156
158
|
onMouseEnter={[Function]}
|
|
157
159
|
onMouseLeave={false}
|
|
158
160
|
>
|
|
@@ -194,6 +196,7 @@ Array [
|
|
|
194
196
|
Object {
|
|
195
197
|
"alignItems": "center",
|
|
196
198
|
"backgroundColor": "#ffffff",
|
|
199
|
+
"borderRadius": 4,
|
|
197
200
|
"display": "flex",
|
|
198
201
|
"flexDirection": "row",
|
|
199
202
|
"maxWidth": 300,
|
|
@@ -248,6 +251,7 @@ Array [
|
|
|
248
251
|
Object {
|
|
249
252
|
"alignItems": "center",
|
|
250
253
|
"backgroundColor": "#ffffff",
|
|
254
|
+
"borderRadius": 4,
|
|
251
255
|
"display": "flex",
|
|
252
256
|
"flexDirection": "row",
|
|
253
257
|
"marginTop": 2,
|
|
@@ -371,6 +375,8 @@ Array [
|
|
|
371
375
|
}
|
|
372
376
|
>
|
|
373
377
|
<View
|
|
378
|
+
accessible={false}
|
|
379
|
+
focusable={false}
|
|
374
380
|
onMouseEnter={[Function]}
|
|
375
381
|
onMouseLeave={false}
|
|
376
382
|
>
|
|
@@ -412,6 +418,7 @@ Array [
|
|
|
412
418
|
Object {
|
|
413
419
|
"alignItems": "center",
|
|
414
420
|
"backgroundColor": "#ffffff",
|
|
421
|
+
"borderRadius": 4,
|
|
415
422
|
"display": "flex",
|
|
416
423
|
"flexDirection": "row",
|
|
417
424
|
"maxWidth": 300,
|
|
@@ -534,6 +541,8 @@ Array [
|
|
|
534
541
|
}
|
|
535
542
|
>
|
|
536
543
|
<View
|
|
544
|
+
accessible={false}
|
|
545
|
+
focusable={false}
|
|
537
546
|
onMouseEnter={[Function]}
|
|
538
547
|
onMouseLeave={false}
|
|
539
548
|
>
|
|
@@ -583,6 +592,7 @@ Array [
|
|
|
583
592
|
Object {
|
|
584
593
|
"alignItems": "center",
|
|
585
594
|
"backgroundColor": "#ffffff",
|
|
595
|
+
"borderRadius": 4,
|
|
586
596
|
"display": "flex",
|
|
587
597
|
"flexDirection": "row",
|
|
588
598
|
"maxWidth": 300,
|
|
@@ -691,6 +701,7 @@ Array [
|
|
|
691
701
|
}
|
|
692
702
|
accessible={true}
|
|
693
703
|
content="Option 2"
|
|
704
|
+
disabled={true}
|
|
694
705
|
enableFocusRing={true}
|
|
695
706
|
focusable={true}
|
|
696
707
|
onAccessibilityAction={[Function]}
|
|
@@ -708,6 +719,7 @@ Array [
|
|
|
708
719
|
Object {
|
|
709
720
|
"alignItems": "center",
|
|
710
721
|
"backgroundColor": "#ffffff",
|
|
722
|
+
"borderRadius": 4,
|
|
711
723
|
"display": "flex",
|
|
712
724
|
"flexDirection": "row",
|
|
713
725
|
"marginTop": 2,
|
|
@@ -883,6 +895,8 @@ Array [
|
|
|
883
895
|
}
|
|
884
896
|
>
|
|
885
897
|
<View
|
|
898
|
+
accessible={false}
|
|
899
|
+
focusable={false}
|
|
886
900
|
onMouseEnter={[Function]}
|
|
887
901
|
onMouseLeave={false}
|
|
888
902
|
>
|
|
@@ -932,6 +946,7 @@ Array [
|
|
|
932
946
|
Object {
|
|
933
947
|
"alignItems": "center",
|
|
934
948
|
"backgroundColor": "#ffffff",
|
|
949
|
+
"borderRadius": 4,
|
|
935
950
|
"display": "flex",
|
|
936
951
|
"flexDirection": "row",
|
|
937
952
|
"maxWidth": 300,
|
|
@@ -1057,6 +1072,7 @@ Array [
|
|
|
1057
1072
|
Object {
|
|
1058
1073
|
"alignItems": "center",
|
|
1059
1074
|
"backgroundColor": "#ffffff",
|
|
1075
|
+
"borderRadius": 4,
|
|
1060
1076
|
"display": "flex",
|
|
1061
1077
|
"flexDirection": "row",
|
|
1062
1078
|
"marginTop": 2,
|
|
@@ -1232,6 +1248,8 @@ Array [
|
|
|
1232
1248
|
}
|
|
1233
1249
|
>
|
|
1234
1250
|
<View
|
|
1251
|
+
accessible={false}
|
|
1252
|
+
focusable={false}
|
|
1235
1253
|
onMouseEnter={[Function]}
|
|
1236
1254
|
onMouseLeave={false}
|
|
1237
1255
|
>
|
|
@@ -1281,6 +1299,7 @@ Array [
|
|
|
1281
1299
|
Object {
|
|
1282
1300
|
"alignItems": "center",
|
|
1283
1301
|
"backgroundColor": "#ffffff",
|
|
1302
|
+
"borderRadius": 4,
|
|
1284
1303
|
"display": "flex",
|
|
1285
1304
|
"flexDirection": "row",
|
|
1286
1305
|
"maxWidth": 300,
|
|
@@ -1406,6 +1425,7 @@ Array [
|
|
|
1406
1425
|
Object {
|
|
1407
1426
|
"alignItems": "center",
|
|
1408
1427
|
"backgroundColor": "#ffffff",
|
|
1428
|
+
"borderRadius": 4,
|
|
1409
1429
|
"display": "flex",
|
|
1410
1430
|
"flexDirection": "row",
|
|
1411
1431
|
"marginTop": 2,
|
|
@@ -1581,6 +1601,8 @@ Array [
|
|
|
1581
1601
|
}
|
|
1582
1602
|
>
|
|
1583
1603
|
<View
|
|
1604
|
+
accessible={false}
|
|
1605
|
+
focusable={false}
|
|
1584
1606
|
onMouseEnter={[Function]}
|
|
1585
1607
|
onMouseLeave={false}
|
|
1586
1608
|
>
|
|
@@ -1630,6 +1652,7 @@ Array [
|
|
|
1630
1652
|
Object {
|
|
1631
1653
|
"alignItems": "center",
|
|
1632
1654
|
"backgroundColor": "#ffffff",
|
|
1655
|
+
"borderRadius": 4,
|
|
1633
1656
|
"display": "flex",
|
|
1634
1657
|
"flexDirection": "row",
|
|
1635
1658
|
"maxWidth": 300,
|
|
@@ -1743,6 +1766,7 @@ Array [
|
|
|
1743
1766
|
Object {
|
|
1744
1767
|
"alignItems": "center",
|
|
1745
1768
|
"backgroundColor": "#ffffff",
|
|
1769
|
+
"borderRadius": 4,
|
|
1746
1770
|
"display": "flex",
|
|
1747
1771
|
"flexDirection": "row",
|
|
1748
1772
|
"marginTop": 2,
|
|
@@ -1918,6 +1942,8 @@ Array [
|
|
|
1918
1942
|
}
|
|
1919
1943
|
>
|
|
1920
1944
|
<View
|
|
1945
|
+
accessible={false}
|
|
1946
|
+
focusable={false}
|
|
1921
1947
|
onMouseEnter={[Function]}
|
|
1922
1948
|
onMouseLeave={false}
|
|
1923
1949
|
>
|
|
@@ -1959,6 +1985,7 @@ Array [
|
|
|
1959
1985
|
Object {
|
|
1960
1986
|
"alignItems": "center",
|
|
1961
1987
|
"backgroundColor": "#ffffff",
|
|
1988
|
+
"borderRadius": 4,
|
|
1962
1989
|
"display": "flex",
|
|
1963
1990
|
"flexDirection": "row",
|
|
1964
1991
|
"maxWidth": 300,
|
|
@@ -2017,6 +2044,7 @@ Array [
|
|
|
2017
2044
|
Object {
|
|
2018
2045
|
"alignItems": "center",
|
|
2019
2046
|
"backgroundColor": "#ffffff",
|
|
2047
|
+
"borderRadius": 4,
|
|
2020
2048
|
"display": "flex",
|
|
2021
2049
|
"flexDirection": "row",
|
|
2022
2050
|
"maxWidth": 300,
|
|
@@ -13,13 +13,14 @@ export interface MenuContextValue extends MenuState {
|
|
|
13
13
|
|
|
14
14
|
export const MenuContext = React.createContext<MenuContextValue>({
|
|
15
15
|
isControlled: false,
|
|
16
|
-
checked:
|
|
17
|
-
defaultChecked:
|
|
16
|
+
checked: [],
|
|
17
|
+
defaultChecked: [],
|
|
18
18
|
hasCheckmarks: false,
|
|
19
19
|
isSubmenu: false,
|
|
20
20
|
open: false,
|
|
21
21
|
onCheckedChange: () => false,
|
|
22
22
|
setOpen: () => false,
|
|
23
|
+
shouldFocusOnContainer: false,
|
|
23
24
|
triggerRef: null,
|
|
24
25
|
});
|
|
25
26
|
|
|
@@ -4,14 +4,17 @@ import type { MenuListState } from '../MenuList/MenuList.types';
|
|
|
4
4
|
/**
|
|
5
5
|
* Context shared between Menu and its child components
|
|
6
6
|
*/
|
|
7
|
-
export type MenuListContextValue = MenuListState
|
|
7
|
+
export type MenuListContextValue = Omit<MenuListState, 'props'> & {
|
|
8
|
+
hasCheckmarks: boolean;
|
|
9
|
+
};
|
|
8
10
|
|
|
9
11
|
export const MenuListContext = React.createContext<MenuListContextValue>({
|
|
10
12
|
isCheckedControlled: false,
|
|
11
13
|
checked: {},
|
|
12
|
-
defaultChecked: {},
|
|
13
14
|
hasCheckmarks: false,
|
|
14
15
|
onCheckedChange: () => false,
|
|
16
|
+
addRadioItem: () => false,
|
|
17
|
+
removeRadioItem: () => false,
|
|
15
18
|
});
|
|
16
19
|
|
|
17
20
|
export const MenuListProvider = MenuListContext.Provider;
|