@fluentui/react-menu 9.0.0-beta.1 → 9.0.0-beta.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +307 -1
- package/CHANGELOG.md +74 -2
- package/dist/react-menu.d.ts +34 -7
- package/lib/components/Menu/Menu.js +3 -3
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +2 -1
- package/lib/components/Menu/renderMenu.js +1 -1
- package/lib/components/Menu/renderMenu.js.map +1 -1
- package/lib/components/Menu/useMenu.js +95 -112
- package/lib/components/Menu/useMenu.js.map +1 -1
- package/lib/components/Menu/useMenuContextValues.js +34 -32
- package/lib/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib/components/MenuDivider/MenuDivider.js +2 -2
- package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/renderMenuDivider.js +6 -7
- package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDivider.js +6 -7
- package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDividerStyles.d.ts +1 -0
- package/lib/components/MenuDivider/useMenuDividerStyles.js +5 -4
- package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib/components/MenuGroup/MenuGroup.js +5 -3
- package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/index.d.ts +1 -0
- package/lib/components/MenuGroup/index.js +1 -0
- package/lib/components/MenuGroup/index.js.map +1 -1
- package/lib/components/MenuGroup/renderMenuGroup.js +6 -7
- package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroup.js +6 -6
- package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroupContextValues.js +7 -7
- package/lib/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroupStyles.d.ts +3 -0
- package/lib/components/MenuGroup/useMenuGroupStyles.js +7 -0
- package/lib/components/MenuGroup/useMenuGroupStyles.js.map +1 -0
- package/lib/components/MenuGroupHeader/MenuGroupHeader.js +2 -2
- package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +6 -7
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +8 -6
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +1 -0
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +5 -4
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.js +2 -2
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/MenuItem/renderMenuItem.js +6 -7
- package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useCharacterSearch.js +6 -6
- package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
- package/lib/components/MenuItem/useMenuItem.js +31 -36
- package/lib/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useMenuItemStyles.d.ts +1 -0
- package/lib/components/MenuItem/useMenuItemStyles.js +5 -4
- package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js +4 -4
- package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemCheckbox/index.d.ts +1 -0
- package/lib/components/MenuItemCheckbox/index.js +1 -0
- package/lib/components/MenuItemCheckbox/index.js.map +1 -1
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +6 -7
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js +12 -13
- package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.d.ts +2 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +4 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
- package/lib/components/MenuItemRadio/MenuItemRadio.js +2 -2
- package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemRadio/index.d.ts +1 -0
- package/lib/components/MenuItemRadio/index.js +1 -0
- package/lib/components/MenuItemRadio/index.js.map +1 -1
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js +6 -7
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemRadio/useMenuItemRadio.js +12 -12
- package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemRadio/useMenuItemRadioStyles.d.ts +1 -0
- package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js +4 -1
- package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
- package/lib/components/MenuList/MenuList.js +3 -3
- package/lib/components/MenuList/MenuList.js.map +1 -1
- package/lib/components/MenuList/MenuList.types.d.ts +8 -6
- package/lib/components/MenuList/renderMenuList.js +6 -7
- package/lib/components/MenuList/renderMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuList.js +66 -86
- package/lib/components/MenuList/useMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuListContextValues.js +18 -16
- package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib/components/MenuList/useMenuListStyles.d.ts +1 -0
- package/lib/components/MenuList/useMenuListStyles.js +5 -4
- package/lib/components/MenuList/useMenuListStyles.js.map +1 -1
- package/lib/components/MenuPopover/MenuPopover.js +2 -2
- package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/renderMenuPopover.js +7 -7
- package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopover.js +29 -38
- package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopoverStyles.d.ts +1 -0
- package/lib/components/MenuPopover/useMenuPopoverStyles.js +7 -6
- package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.js +2 -2
- package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/renderMenuTrigger.js +1 -1
- package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/useMenuTrigger.js +3 -4
- package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/useTriggerElement.js +51 -65
- package/lib/components/MenuTrigger/useTriggerElement.js.map +1 -1
- package/lib/contexts/menuContext.js +5 -11
- package/lib/contexts/menuContext.js.map +1 -1
- package/lib/contexts/menuGroupContext.js +3 -5
- package/lib/contexts/menuGroupContext.js.map +1 -1
- package/lib/contexts/menuListContext.js +7 -17
- package/lib/contexts/menuListContext.js.map +1 -1
- package/lib/contexts/menuTriggerContext.js +3 -5
- package/lib/contexts/menuTriggerContext.js.map +1 -1
- package/lib/selectable/useCheckmarkStyles.js +3 -3
- package/lib/selectable/useCheckmarkStyles.js.map +1 -1
- package/lib/utils/useIsSubmenu.js +2 -4
- package/lib/utils/useIsSubmenu.js.map +1 -1
- package/lib/utils/useOnMenuEnter.js +16 -14
- package/lib/utils/useOnMenuEnter.js.map +1 -1
- package/lib-commonjs/Menu.js +1 -1
- package/lib-commonjs/MenuDivider.js +1 -1
- package/lib-commonjs/MenuGroup.js +1 -1
- package/lib-commonjs/MenuGroupHeader.js +1 -1
- package/lib-commonjs/MenuItem.js +1 -1
- package/lib-commonjs/MenuItemCheckbox.js +1 -1
- package/lib-commonjs/MenuItemRadio.js +1 -1
- package/lib-commonjs/MenuList.js +1 -1
- package/lib-commonjs/MenuPopover.js +1 -1
- package/lib-commonjs/MenuTrigger.js +1 -1
- package/lib-commonjs/components/Menu/Menu.js +6 -6
- package/lib-commonjs/components/Menu/Menu.js.map +1 -1
- package/lib-commonjs/components/Menu/Menu.types.d.ts +2 -1
- package/lib-commonjs/components/Menu/index.js +1 -1
- package/lib-commonjs/components/Menu/renderMenu.js +3 -3
- package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenu.js +104 -122
- package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenuContextValues.js +34 -32
- package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/MenuDivider.js +6 -6
- package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/index.js +1 -1
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +8 -10
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js +7 -9
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.d.ts +1 -0
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +8 -6
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/MenuGroup.js +10 -7
- package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/index.d.ts +1 -0
- package/lib-commonjs/components/MenuGroup/index.js +3 -1
- package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +9 -11
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js +7 -8
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js +8 -8
- package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.d.ts +3 -0
- package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js +18 -0
- package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js.map +1 -0
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js +6 -6
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/index.js +1 -1
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +8 -10
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +10 -9
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +1 -0
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +8 -6
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.js +7 -7
- package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/index.js +1 -1
- package/lib-commonjs/components/MenuItem/renderMenuItem.js +9 -11
- package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useCharacterSearch.js +7 -7
- package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItem.js +38 -44
- package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.d.ts +1 -0
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +9 -7
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js +7 -7
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/index.d.ts +1 -0
- package/lib-commonjs/components/MenuItemCheckbox/index.js +3 -1
- package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +9 -11
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js +17 -19
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.d.ts +2 -1
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +10 -5
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js +6 -6
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/index.d.ts +1 -0
- package/lib-commonjs/components/MenuItemRadio/index.js +3 -1
- package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +9 -11
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js +17 -18
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.d.ts +1 -0
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js +9 -4
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
- package/lib-commonjs/components/MenuList/MenuList.js +8 -8
- package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/MenuList.types.d.ts +8 -6
- package/lib-commonjs/components/MenuList/index.js +1 -1
- package/lib-commonjs/components/MenuList/renderMenuList.js +9 -11
- package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuList.js +72 -93
- package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js +18 -16
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListStyles.d.ts +1 -0
- package/lib-commonjs/components/MenuList/useMenuListStyles.js +8 -6
- package/lib-commonjs/components/MenuList/useMenuListStyles.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/MenuPopover.js +6 -6
- package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/index.js +1 -1
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +10 -11
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js +36 -46
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.d.ts +1 -0
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js +10 -8
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +4 -4
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/index.js +1 -1
- package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js +3 -3
- package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +4 -6
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/useTriggerElement.js +58 -73
- package/lib-commonjs/components/MenuTrigger/useTriggerElement.js.map +1 -1
- package/lib-commonjs/components/index.js +1 -1
- package/lib-commonjs/contexts/menuContext.js +4 -10
- package/lib-commonjs/contexts/menuContext.js.map +1 -1
- package/lib-commonjs/contexts/menuGroupContext.js +3 -5
- package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
- package/lib-commonjs/contexts/menuListContext.js +6 -16
- package/lib-commonjs/contexts/menuListContext.js.map +1 -1
- package/lib-commonjs/contexts/menuTriggerContext.js +3 -5
- package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
- package/lib-commonjs/index.js +1 -1
- package/lib-commonjs/selectable/index.js +1 -1
- package/lib-commonjs/selectable/useCheckmarkStyles.js +4 -4
- package/lib-commonjs/selectable/useCheckmarkStyles.js.map +1 -1
- package/lib-commonjs/utils/index.js +1 -1
- package/lib-commonjs/utils/useIsSubmenu.js +5 -7
- package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
- package/lib-commonjs/utils/useOnMenuEnter.js +18 -16
- package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
- package/package.json +15 -15
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -12
- package/lib/common/isConformant.js.map +0 -1
- package/lib/common/mockUseMenuContext.d.ts +0 -7
- package/lib/common/mockUseMenuContext.js +0 -36
- package/lib/common/mockUseMenuContext.js.map +0 -1
- package/lib/utils/DefaultIcons.d.ts +0 -7
- package/lib/utils/DefaultIcons.js +0 -88
- package/lib/utils/DefaultIcons.js.map +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -23
- package/lib-commonjs/common/isConformant.js.map +0 -1
- package/lib-commonjs/common/mockUseMenuContext.d.ts +0 -7
- package/lib-commonjs/common/mockUseMenuContext.js +0 -47
- package/lib-commonjs/common/mockUseMenuContext.js.map +0 -1
- package/lib-commonjs/utils/DefaultIcons.d.ts +0 -7
- package/lib-commonjs/utils/DefaultIcons.js +0 -100
- package/lib-commonjs/utils/DefaultIcons.js.map +0 -1
@@ -5,48 +5,47 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.useMenuItemRadio = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
9
|
|
10
|
-
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
11
|
|
12
|
-
|
12
|
+
const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
|
13
13
|
|
14
|
-
|
14
|
+
const menuListContext_1 = /*#__PURE__*/require("../../contexts/menuListContext");
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
var useMenuItem_1 = /*#__PURE__*/require("../MenuItem/useMenuItem");
|
16
|
+
const useMenuItem_1 = /*#__PURE__*/require("../MenuItem/useMenuItem");
|
19
17
|
/**
|
20
18
|
* Given user props, returns state and render function for a MenuItemRadio.
|
21
19
|
*/
|
22
20
|
|
23
21
|
|
24
|
-
|
25
|
-
|
22
|
+
const useMenuItemRadio = (props, ref) => {
|
23
|
+
const radioProps = {
|
26
24
|
role: 'menuitemradio'
|
27
25
|
};
|
28
|
-
|
26
|
+
const state = useMenuItem_1.useMenuItem({ ...radioProps,
|
27
|
+
...props,
|
29
28
|
checkmark: react_utilities_1.resolveShorthand(props.checkmark, {
|
30
29
|
defaultProps: {
|
31
30
|
children: React.createElement(react_icons_1.Checkmark16Filled, null)
|
32
31
|
},
|
33
32
|
required: true
|
34
33
|
})
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
}, ref);
|
35
|
+
const selectRadio = menuListContext_1.useMenuListContext(context => context.selectRadio);
|
36
|
+
const {
|
37
|
+
onClick: onClickOriginal
|
38
|
+
} = state.root;
|
39
|
+
const checked = menuListContext_1.useMenuListContext(context => {
|
41
40
|
var _a;
|
42
41
|
|
43
|
-
|
42
|
+
const checkedItems = ((_a = context.checkedValues) === null || _a === void 0 ? void 0 : _a[state.name]) || [];
|
44
43
|
return checkedItems.indexOf(state.value) !== -1;
|
45
44
|
});
|
46
45
|
state.checked = checked;
|
47
46
|
state.root['aria-checked'] = state.checked; // MenuItem state already transforms keyDown to click events
|
48
47
|
|
49
|
-
state.root.onClick =
|
48
|
+
state.root.onClick = e => {
|
50
49
|
if (state.disabled) {
|
51
50
|
e.preventDefault();
|
52
51
|
e.stopPropagation();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuItemRadio/useMenuItemRadio.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuItemRadio/useMenuItemRadio.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,gBAAgB,GAAG,CAAC,KAAD,EAA4B,GAA5B,KAA+E;AAC7G,QAAM,UAAU,GAAG;AACjB,IAAA,IAAI,EAAE;AADW,GAAnB;AAIA,QAAM,KAAK,GAAG,aAAA,CAAA,WAAA,CACZ,EACE,GAAG,UADL;AAEE,OAAG,KAFL;AAGE,IAAA,SAAS,EAAE,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,SAAvB,EAAkC;AAC3C,MAAA,YAAY,EAAE;AAAE,QAAA,QAAQ,EAAE,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,iBAAD,EAAkB,IAAlB;AAAZ,OAD6B;AAE3C,MAAA,QAAQ,EAAE;AAFiC,KAAlC;AAHb,GADY,EASZ,GATY,C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Property(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.useMenuItemRadioStyles = void 0;
|
6
|
+
exports.useMenuItemRadioStyles = exports.menuItemRadioClassName = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
|
9
9
|
|
10
|
-
|
10
|
+
const index_1 = /*#__PURE__*/require("../../selectable/index");
|
11
11
|
|
12
|
-
|
12
|
+
const useMenuItemStyles_1 = /*#__PURE__*/require("../MenuItem/useMenuItemStyles");
|
13
|
+
|
14
|
+
exports.menuItemRadioClassName = 'fui-MenuItemRadio';
|
15
|
+
|
16
|
+
const useMenuItemRadioStyles = state => {
|
17
|
+
state.root.className = react_make_styles_1.mergeClasses(exports.menuItemRadioClassName, state.root.className);
|
13
18
|
useMenuItemStyles_1.useMenuItemStyles(state);
|
14
19
|
index_1.useCheckmarkStyles(state);
|
15
20
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuItemRadio/useMenuItemRadioStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuItemRadio/useMenuItemRadioStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,+BAAA,CAAA;;AAGa,OAAA,CAAA,sBAAA,GAAyB,mBAAzB;;AAEN,MAAM,sBAAsB,GAAI,KAAD,IAA8B;AAClE,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,mBAAA,CAAA,YAAA,CAAa,OAAA,CAAA,sBAAb,EAAqC,KAAK,CAAC,IAAN,CAAW,SAAhD,CAAvB;AAEA,EAAA,mBAAA,CAAA,iBAAA,CAAkB,KAAlB;AACA,EAAA,OAAA,CAAA,kBAAA,CAAmB,KAAnB;AACD,CALM;;AAAM,OAAA,CAAA,sBAAA,GAAsB,sBAAtB","sourceRoot":""}
|
@@ -5,23 +5,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.MenuList = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
9
|
|
10
|
-
|
10
|
+
const useMenuList_1 = /*#__PURE__*/require("./useMenuList");
|
11
11
|
|
12
|
-
|
12
|
+
const renderMenuList_1 = /*#__PURE__*/require("./renderMenuList");
|
13
13
|
|
14
|
-
|
14
|
+
const useMenuListContextValues_1 = /*#__PURE__*/require("./useMenuListContextValues");
|
15
15
|
|
16
|
-
|
16
|
+
const useMenuListStyles_1 = /*#__PURE__*/require("./useMenuListStyles");
|
17
17
|
/**
|
18
18
|
* Define a styled MenuList, using the `useMenuList` hook.
|
19
19
|
*/
|
20
20
|
|
21
21
|
|
22
|
-
exports.MenuList = /*#__PURE__*/React.forwardRef(
|
23
|
-
|
24
|
-
|
22
|
+
exports.MenuList = /*#__PURE__*/React.forwardRef((props, ref) => {
|
23
|
+
const state = useMenuList_1.useMenuList(props, ref);
|
24
|
+
const contextValues = useMenuListContextValues_1.useMenuListContextValues(state);
|
25
25
|
useMenuListStyles_1.useMenuListStyles(state);
|
26
26
|
return renderMenuList_1.renderMenuList(state, contextValues);
|
27
27
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuList/MenuList.tsx"],"names":[],"mappings":";;;;;;;AAAA,
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuList/MenuList.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AACA,MAAA,0BAAA,gBAAA,OAAA,CAAA,4BAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,QAAA,gBAA+C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAC1F,QAAM,KAAK,GAAG,aAAA,CAAA,WAAA,CAAY,KAAZ,EAAmB,GAAnB,CAAd;AACA,QAAM,aAAa,GAAG,0BAAA,CAAA,wBAAA,CAAyB,KAAzB,CAAtB;AACA,EAAA,mBAAA,CAAA,iBAAA,CAAkB,KAAlB;AAEA,SAAO,gBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,aAAtB,CAAP;AACD,CAN2D,CAA/C;AAQb,OAAA,CAAA,QAAA,CAAS,WAAT,GAAuB,UAAvB","sourceRoot":""}
|
@@ -2,6 +2,13 @@ import * as React from 'react';
|
|
2
2
|
import { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
|
3
3
|
import { MenuListContextValue } from '../../contexts/menuListContext';
|
4
4
|
import { SelectableHandler } from '../../selectable/index';
|
5
|
+
export declare type MenuCheckedValueChangeEvent = React.MouseEvent | React.KeyboardEvent;
|
6
|
+
export declare type MenuCheckedValueChangeData = {
|
7
|
+
/** The name of the value */
|
8
|
+
name: string;
|
9
|
+
/** The items for this value that are checked */
|
10
|
+
checkedItems: string[];
|
11
|
+
};
|
5
12
|
export declare type MenuListCommons = {
|
6
13
|
/**
|
7
14
|
* Callback when checked items change for value with a name
|
@@ -9,12 +16,7 @@ export declare type MenuListCommons = {
|
|
9
16
|
* @param event - React's original SyntheticEvent
|
10
17
|
* @param data - A data object with relevant information
|
11
18
|
*/
|
12
|
-
onCheckedValueChange?: (e:
|
13
|
-
/** The name of the value */
|
14
|
-
name: string;
|
15
|
-
/** The items for this value that are checked */
|
16
|
-
checkedItems: string[];
|
17
|
-
}) => void;
|
19
|
+
onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;
|
18
20
|
/**
|
19
21
|
* Map of all checked values
|
20
22
|
*/
|
@@ -5,26 +5,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.renderMenuList = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
9
|
|
10
|
-
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
var menuListContext_1 = /*#__PURE__*/require("../../contexts/menuListContext");
|
12
|
+
const menuListContext_1 = /*#__PURE__*/require("../../contexts/menuListContext");
|
15
13
|
/**
|
16
14
|
* Function that renders the final JSX of the component
|
17
15
|
*/
|
18
16
|
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
const renderMenuList = (state, contextValues) => {
|
19
|
+
const {
|
20
|
+
slots,
|
21
|
+
slotProps
|
22
|
+
} = react_utilities_1.getSlots(state);
|
25
23
|
return React.createElement(menuListContext_1.MenuListProvider, {
|
26
24
|
value: contextValues.menuList
|
27
|
-
}, React.createElement(slots.root,
|
25
|
+
}, React.createElement(slots.root, Object.assign({}, slotProps.root)));
|
28
26
|
};
|
29
27
|
|
30
28
|
exports.renderMenuList = renderMenuList;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuList/renderMenuList.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuList/renderMenuList.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,iBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;AAEA;;AAEG;;;AACI,MAAM,cAAc,GAAG,CAAC,KAAD,EAAuB,aAAvB,KAA+D;AAC3F,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAAwB,KAAxB,CAA7B;AAEA,SACE,KAAA,CAAA,aAAA,CAAC,iBAAA,CAAA,gBAAD,EAAiB;AAAC,IAAA,KAAK,EAAE,aAAa,CAAC;AAAtB,GAAjB,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CADF,CADF;AAKD,CARM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd","sourceRoot":""}
|
@@ -5,31 +5,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.useMenuList = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
9
|
|
10
|
-
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
11
|
|
12
|
-
|
12
|
+
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
13
13
|
|
14
|
-
|
14
|
+
const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
|
15
15
|
|
16
|
-
|
16
|
+
const menuContext_1 = /*#__PURE__*/require("../../contexts/menuContext");
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
var menuContext_2 = /*#__PURE__*/require("../../contexts/menuContext");
|
18
|
+
const menuContext_2 = /*#__PURE__*/require("../../contexts/menuContext");
|
21
19
|
/**
|
22
20
|
* Returns the props and state required to render the component
|
23
21
|
*/
|
24
22
|
|
25
23
|
|
26
|
-
|
27
|
-
|
24
|
+
const useMenuList = (props, ref) => {
|
25
|
+
const focusAttributes = react_tabster_1.useArrowNavigationGroup({
|
28
26
|
circular: true
|
29
27
|
});
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
const {
|
29
|
+
findAllFocusable
|
30
|
+
} = react_tabster_1.useFocusFinders();
|
31
|
+
const menuContext = useMenuContextSelectors();
|
32
|
+
const hasMenuContext = react_context_selector_1.useHasParentContext(menuContext_2.MenuContext);
|
33
33
|
|
34
34
|
if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {
|
35
35
|
// TODO throw warnings in development safely
|
@@ -37,44 +37,44 @@ var useMenuList = function (props, ref) {
|
|
37
37
|
console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');
|
38
38
|
}
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
root: react_utilities_1.getNativeElementProps('div', tslib_1.__assign(tslib_1.__assign({
|
40
|
+
const innerRef = React.useRef(null);
|
41
|
+
const initialState = {
|
42
|
+
root: react_utilities_1.getNativeElementProps('div', {
|
44
43
|
ref: react_utilities_1.useMergedRefs(ref, innerRef),
|
45
44
|
role: 'menu',
|
46
|
-
'aria-labelledby': menuContext.triggerId
|
47
|
-
|
45
|
+
'aria-labelledby': menuContext.triggerId,
|
46
|
+
...focusAttributes,
|
47
|
+
...props
|
48
|
+
}),
|
48
49
|
hasIcons: menuContext.hasIcons,
|
49
|
-
hasCheckmarks: menuContext.hasCheckmarks
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
hasCheckmarks: menuContext.hasCheckmarks,
|
51
|
+
...(hasMenuContext && menuContext),
|
52
|
+
...props
|
53
|
+
};
|
54
|
+
const setFocusByFirstCharacter = React.useCallback((e, itemEl) => {
|
53
55
|
// TODO use some kind of children registration to reduce dependency on DOM roles
|
54
|
-
|
56
|
+
const acceptedRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];
|
55
57
|
|
56
58
|
if (!innerRef.current) {
|
57
59
|
return;
|
58
60
|
}
|
59
61
|
|
60
|
-
|
61
|
-
|
62
|
-
});
|
63
|
-
var startIndex = menuItems.indexOf(itemEl) + 1;
|
62
|
+
const menuItems = findAllFocusable(innerRef.current, el => el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')) !== -1);
|
63
|
+
let startIndex = menuItems.indexOf(itemEl) + 1;
|
64
64
|
|
65
65
|
if (startIndex === menuItems.length) {
|
66
66
|
startIndex = 0;
|
67
67
|
}
|
68
68
|
|
69
|
-
|
69
|
+
const firstChars = menuItems.map(menuItem => {
|
70
70
|
var _a;
|
71
71
|
|
72
72
|
return (_a = menuItem.textContent) === null || _a === void 0 ? void 0 : _a.charAt(0).toLowerCase();
|
73
73
|
});
|
74
|
-
|
74
|
+
const char = e.key.toLowerCase();
|
75
75
|
|
76
|
-
|
77
|
-
for (
|
76
|
+
const getIndexFirstChars = (start, firstChar) => {
|
77
|
+
for (let i = start; i < firstChars.length; i++) {
|
78
78
|
if (char === firstChars[i]) {
|
79
79
|
return i;
|
80
80
|
}
|
@@ -84,7 +84,7 @@ var useMenuList = function (props, ref) {
|
|
84
84
|
}; // Check remaining slots in the menu
|
85
85
|
|
86
86
|
|
87
|
-
|
87
|
+
let index = getIndexFirstChars(startIndex, char); // If not found in remaining slots, check from beginning
|
88
88
|
|
89
89
|
if (index === -1) {
|
90
90
|
index = getIndexFirstChars(0, char);
|
@@ -95,20 +95,17 @@ var useMenuList = function (props, ref) {
|
|
95
95
|
menuItems[index].focus();
|
96
96
|
}
|
97
97
|
}, [findAllFocusable]);
|
98
|
-
|
99
|
-
var _a = react_utilities_1.useControllableState({
|
98
|
+
const [checkedValues, setCheckedValues] = react_utilities_1.useControllableState({
|
100
99
|
state: initialState.checkedValues,
|
101
100
|
defaultState: initialState.defaultCheckedValues,
|
102
101
|
initialState: {}
|
103
|
-
})
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
var newCheckedItems = tslib_1.__spreadArrays(checkedItems);
|
102
|
+
});
|
103
|
+
const {
|
104
|
+
onCheckedValueChange
|
105
|
+
} = initialState;
|
106
|
+
const toggleCheckbox = react_utilities_1.useEventCallback((e, name, value, checked) => {
|
107
|
+
const checkedItems = (checkedValues === null || checkedValues === void 0 ? void 0 : checkedValues[name]) || [];
|
108
|
+
const newCheckedItems = [...checkedItems];
|
112
109
|
|
113
110
|
if (checked) {
|
114
111
|
newCheckedItems.splice(newCheckedItems.indexOf(value), 1);
|
@@ -117,35 +114,29 @@ var useMenuList = function (props, ref) {
|
|
117
114
|
}
|
118
115
|
|
119
116
|
onCheckedValueChange === null || onCheckedValueChange === void 0 ? void 0 : onCheckedValueChange(e, {
|
120
|
-
name
|
117
|
+
name,
|
121
118
|
checkedItems: newCheckedItems
|
122
119
|
});
|
123
|
-
setCheckedValues(
|
124
|
-
|
125
|
-
|
126
|
-
return tslib_1.__assign(tslib_1.__assign({}, s), (_a = {}, _a[name] = newCheckedItems, _a));
|
127
|
-
});
|
120
|
+
setCheckedValues(s => ({ ...s,
|
121
|
+
[name]: newCheckedItems
|
122
|
+
}));
|
128
123
|
});
|
129
|
-
|
130
|
-
|
131
|
-
setCheckedValues(
|
132
|
-
|
133
|
-
|
134
|
-
return tslib_1.__assign(tslib_1.__assign({}, s), (_a = {}, _a[name] = newCheckedItems, _a));
|
135
|
-
});
|
124
|
+
const selectRadio = react_utilities_1.useEventCallback((e, name, value) => {
|
125
|
+
const newCheckedItems = [value];
|
126
|
+
setCheckedValues(s => ({ ...s,
|
127
|
+
[name]: newCheckedItems
|
128
|
+
}));
|
136
129
|
onCheckedValueChange === null || onCheckedValueChange === void 0 ? void 0 : onCheckedValueChange(e, {
|
137
|
-
name
|
130
|
+
name,
|
138
131
|
checkedItems: newCheckedItems
|
139
132
|
});
|
140
133
|
});
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
toggleCheckbox: toggleCheckbox,
|
134
|
+
const state = { ...initialState,
|
135
|
+
setFocusByFirstCharacter,
|
136
|
+
selectRadio,
|
137
|
+
toggleCheckbox,
|
146
138
|
checkedValues: checkedValues !== null && checkedValues !== void 0 ? checkedValues : {}
|
147
|
-
}
|
148
|
-
|
139
|
+
};
|
149
140
|
return state;
|
150
141
|
};
|
151
142
|
|
@@ -154,32 +145,20 @@ exports.useMenuList = useMenuList;
|
|
154
145
|
* Adds some sugar to fetching multiple context selector values
|
155
146
|
*/
|
156
147
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
var defaultCheckedValues = menuContext_1.useMenuContext(function (context) {
|
165
|
-
return context.defaultCheckedValues;
|
166
|
-
});
|
167
|
-
var triggerId = menuContext_1.useMenuContext(function (context) {
|
168
|
-
return context.triggerId;
|
169
|
-
});
|
170
|
-
var hasIcons = menuContext_1.useMenuContext(function (context) {
|
171
|
-
return context.hasIcons;
|
172
|
-
});
|
173
|
-
var hasCheckmarks = menuContext_1.useMenuContext(function (context) {
|
174
|
-
return context.hasCheckmarks;
|
175
|
-
});
|
148
|
+
const useMenuContextSelectors = () => {
|
149
|
+
const checkedValues = menuContext_1.useMenuContext(context => context.checkedValues);
|
150
|
+
const onCheckedValueChange = menuContext_1.useMenuContext(context => context.onCheckedValueChange);
|
151
|
+
const defaultCheckedValues = menuContext_1.useMenuContext(context => context.defaultCheckedValues);
|
152
|
+
const triggerId = menuContext_1.useMenuContext(context => context.triggerId);
|
153
|
+
const hasIcons = menuContext_1.useMenuContext(context => context.hasIcons);
|
154
|
+
const hasCheckmarks = menuContext_1.useMenuContext(context => context.hasCheckmarks);
|
176
155
|
return {
|
177
|
-
checkedValues
|
178
|
-
onCheckedValueChange
|
179
|
-
defaultCheckedValues
|
180
|
-
triggerId
|
181
|
-
hasIcons
|
182
|
-
hasCheckmarks
|
156
|
+
checkedValues,
|
157
|
+
onCheckedValueChange,
|
158
|
+
defaultCheckedValues,
|
159
|
+
triggerId,
|
160
|
+
hasIcons,
|
161
|
+
hasCheckmarks
|
183
162
|
};
|
184
163
|
};
|
185
164
|
/**
|
@@ -187,10 +166,10 @@ var useMenuContextSelectors = function () {
|
|
187
166
|
*/
|
188
167
|
|
189
168
|
|
190
|
-
|
191
|
-
|
169
|
+
const usingPropsAndMenuContext = (props, contextValue, hasMenuContext) => {
|
170
|
+
let isUsingPropsAndContext = false;
|
192
171
|
|
193
|
-
for (
|
172
|
+
for (const val in contextValue) {
|
194
173
|
if (props[val]) {
|
195
174
|
isUsingPropsAndContext = true;
|
196
175
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuList/useMenuList.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuList/useMenuList.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAMA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,4BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,4BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,WAAW,GAAG,CAAC,KAAD,EAAuB,GAAvB,KAAqE;AAC9F,QAAM,eAAe,GAAG,eAAA,CAAA,uBAAA,CAAwB;AAAE,IAAA,QAAQ,EAAE;AAAZ,GAAxB,CAAxB;AACA,QAAM;AAAE,IAAA;AAAF,MAAuB,eAAA,CAAA,eAAA,EAA7B;AACA,QAAM,WAAW,GAAG,uBAAuB,EAA3C;AACA,QAAM,cAAc,GAAG,wBAAA,CAAA,mBAAA,CAAoB,aAAA,CAAA,WAApB,CAAvB;;AAEA,MAAI,wBAAwB,CAAC,KAAD,EAAQ,WAAR,EAAqB,cAArB,CAA5B,EAAkE;AAChE;AACA;AACA,IAAA,OAAO,CAAC,IAAR,CAAa,+FAAb;AACD;;AAED,QAAM,QAAQ,GAAG,KAAK,CAAC,MAAN,CAA0B,IAA1B,CAAjB;AACA,QAAM,YAAY,GAA+B;AAC/C,IAAA,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B;AACjC,MAAA,GAAG,EAAE,iBAAA,CAAA,aAAA,C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AG,MAAK;AACnC,QAAM,aAAa,GAAG,aAAA,CAAA,cAAA,CAAe,OAAO,IAAI,OAAO,CAAC,aAAlC,CAAtB;AACA,QAAM,oBAAoB,GAAG,aAAA,CAAA,cAAA,CAAe,OAAO,IAAI,OAAO,CAAC,oBAAlC,CAA7B;AACA,QAAM,oBAAoB,GAAG,aAAA,CAAA,cAAA,CAAe,OAAO,IAAI,OAAO,CAAC,oBAAlC,CAA7B;AACA,QAAM,SAAS,GAAG,aAAA,CAAA,cAAA,CAAe,OAAO,IAAI,OAAO,CAAC,SAAlC,CAAlB;AACA,QAAM,QAAQ,GAAG,aAAA,CAAA,cAAA,CAAe,OAAO,IAAI,OAAO,CAAC,QAAlC,CAAjB;AACA,QAAM,aAAa,GAAG,aAAA,CAAA,cAAA,CAAe,OAAO,IAAI,OAAO,CAAC,aAAlC,CAAtB;AAEA,SAAO;AACL,IAAA,aADK;AAEL,IAAA,oBAFK;AAGL,IAAA,oBAHK;AAIL,IAAA,SAJK;AAKL,IAAA,QALK;AAML,IAAA;AANK,GAAP;AAQD,CAhBD;AAkBA;;AAEG;;;AACH,MAAM,wBAAwB,GAAG,CAC/B,KAD+B,EAE/B,YAF+B,EAG/B,cAH+B,KAI7B;AACF,MAAI,sBAAsB,GAAG,KAA7B;;AACA,OAAK,MAAM,GAAX,IAAkB,YAAlB,EAAgC;AAC9B,QAAI,KAAK,CAAC,GAAD,CAAT,EAA4G;AAC1G,MAAA,sBAAsB,GAAG,IAAzB;AACD;AACF;;AAED,SAAO,cAAc,IAAI,sBAAzB;AACD,CAbD","sourceRoot":""}
|
@@ -6,25 +6,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.useMenuListContextValues = void 0;
|
7
7
|
|
8
8
|
function useMenuListContextValues(state) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
const {
|
10
|
+
onCheckedValueChange,
|
11
|
+
checkedValues,
|
12
|
+
toggleCheckbox,
|
13
|
+
selectRadio,
|
14
|
+
setFocusByFirstCharacter,
|
15
|
+
hasIcons,
|
16
|
+
hasCheckmarks
|
17
|
+
} = state; // This context is created with "@fluentui/react-context-selector", these is no sense to memoize it
|
16
18
|
|
17
|
-
|
18
|
-
onCheckedValueChange
|
19
|
-
checkedValues
|
20
|
-
toggleCheckbox
|
21
|
-
selectRadio
|
22
|
-
setFocusByFirstCharacter
|
23
|
-
hasIcons
|
24
|
-
hasCheckmarks
|
19
|
+
const menuList = {
|
20
|
+
onCheckedValueChange,
|
21
|
+
checkedValues,
|
22
|
+
toggleCheckbox,
|
23
|
+
selectRadio,
|
24
|
+
setFocusByFirstCharacter,
|
25
|
+
hasIcons,
|
26
|
+
hasCheckmarks
|
25
27
|
};
|
26
28
|
return {
|
27
|
-
menuList
|
29
|
+
menuList
|
28
30
|
};
|
29
31
|
}
|
30
32
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuList/useMenuListContextValues.ts"],"names":[],"mappings":";;;;;;;AAEA,SAAgB,wBAAhB,CAAyC,KAAzC,EAA6D;
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuList/useMenuListContextValues.ts"],"names":[],"mappings":";;;;;;;AAEA,SAAgB,wBAAhB,CAAyC,KAAzC,EAA6D;AAC3D,QAAM;AACJ,IAAA,oBADI;AAEJ,IAAA,aAFI;AAGJ,IAAA,cAHI;AAIJ,IAAA,WAJI;AAKJ,IAAA,wBALI;AAMJ,IAAA,QANI;AAOJ,IAAA;AAPI,MAQF,KARJ,CAD2D,CAW3D;;AACA,QAAM,QAAQ,GAAG;AACf,IAAA,oBADe;AAEf,IAAA,aAFe;AAGf,IAAA,cAHe;AAIf,IAAA,WAJe;AAKf,IAAA,wBALe;AAMf,IAAA,QANe;AAOf,IAAA;AAPe,GAAjB;AAUA,SAAO;AAAE,IAAA;AAAF,GAAP;AACD;;AAvBD,OAAA,CAAA,wBAAA,GAAA,wBAAA","sourceRoot":""}
|
@@ -3,11 +3,13 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.useMenuListStyles = void 0;
|
6
|
+
exports.useMenuListStyles = exports.menuListClassName = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
|
9
9
|
|
10
|
-
|
10
|
+
exports.menuListClassName = 'fui-MenuList';
|
11
|
+
|
12
|
+
const useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
11
13
|
"root": {
|
12
14
|
"mc9l5x": "f22iagw",
|
13
15
|
"Beiy3e4": "f1vx9l62",
|
@@ -21,9 +23,9 @@ var useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
|
21
23
|
*/
|
22
24
|
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
state.root.className = react_make_styles_1.mergeClasses(styles.root, state.root.className);
|
26
|
+
const useMenuListStyles = state => {
|
27
|
+
const styles = useStyles();
|
28
|
+
state.root.className = react_make_styles_1.mergeClasses(exports.menuListClassName, styles.root, state.root.className);
|
27
29
|
return state;
|
28
30
|
};
|
29
31
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuList/useMenuListStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuList/useMenuListStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAGa,OAAA,CAAA,iBAAA,GAAoB,cAApB;;AAEb,MAAM,SAAS,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAQA;;AAEG;;;AACI,MAAM,iBAAiB,GAAI,KAAD,IAAwC;AACvE,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,mBAAA,CAAA,YAAA,CAAa,OAAA,CAAA,iBAAb,EAAgC,MAAM,CAAC,IAAvC,EAA6C,KAAK,CAAC,IAAN,CAAW,SAAxD,CAAvB;AACA,SAAO,KAAP;AACD,CAJM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourceRoot":""}
|