@fluentui/react-menu 0.0.0-nightly050f89bf0020211102.1 → 0.0.0-nightly442708a36520211209.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +238 -26
- package/CHANGELOG.md +66 -20
- 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/renderMenu.js +1 -1
- package/lib/components/Menu/renderMenu.js.map +1 -1
- package/lib/components/Menu/useMenu.js +103 -117
- 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 +6 -5
- 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 -4
- 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 +16 -8
- 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 +9 -7
- 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 +12 -8
- 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/MenuTrigger.types.d.ts +2 -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 +57 -70
- 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/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 +112 -127
- 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 +6 -9
- 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 +20 -10
- 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 +11 -8
- 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 +14 -9
- 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/MenuTrigger.types.d.ts +2 -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 +64 -78
- 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 +16 -16
- 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-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
|
@@ -5,66 +5,52 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useTriggerElement = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const keyboard_keys_1 = /*#__PURE__*/require("@fluentui/keyboard-keys");
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const menuContext_1 = /*#__PURE__*/require("../../contexts/menuContext");
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const useIsSubmenu_1 = /*#__PURE__*/require("../../utils/useIsSubmenu");
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var noop = function () {
|
|
25
|
-
return null;
|
|
26
|
-
};
|
|
22
|
+
const noop = () => null;
|
|
27
23
|
/**
|
|
28
24
|
* Adds the necessary props to the trigger element
|
|
29
25
|
*/
|
|
30
26
|
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
const useTriggerElement = state => {
|
|
33
29
|
var _a, _b;
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return context.triggerId;
|
|
49
|
-
});
|
|
50
|
-
var openOnHover = menuContext_1.useMenuContext(function (context) {
|
|
51
|
-
return context.openOnHover;
|
|
52
|
-
});
|
|
53
|
-
var openOnContext = menuContext_1.useMenuContext(function (context) {
|
|
54
|
-
return context.openOnContext;
|
|
55
|
-
});
|
|
56
|
-
var isSubmenu = useIsSubmenu_1.useIsSubmenu();
|
|
57
|
-
var findFirstFocusable = react_tabster_1.useFocusFinders().findFirstFocusable;
|
|
58
|
-
var focusFirst = React.useCallback(function () {
|
|
59
|
-
var firstFocusable = findFirstFocusable(menuPopoverRef.current);
|
|
31
|
+
const triggerRef = menuContext_1.useMenuContext(context => context.triggerRef);
|
|
32
|
+
const menuPopoverRef = menuContext_1.useMenuContext(context => context.menuPopoverRef);
|
|
33
|
+
const setOpen = menuContext_1.useMenuContext(context => context.setOpen);
|
|
34
|
+
const open = menuContext_1.useMenuContext(context => context.open);
|
|
35
|
+
const triggerId = menuContext_1.useMenuContext(context => context.triggerId);
|
|
36
|
+
const openOnHover = menuContext_1.useMenuContext(context => context.openOnHover);
|
|
37
|
+
const openOnContext = menuContext_1.useMenuContext(context => context.openOnContext);
|
|
38
|
+
const isSubmenu = useIsSubmenu_1.useIsSubmenu();
|
|
39
|
+
const {
|
|
40
|
+
findFirstFocusable
|
|
41
|
+
} = react_tabster_1.useFocusFinders();
|
|
42
|
+
const focusFirst = React.useCallback(() => {
|
|
43
|
+
const firstFocusable = findFirstFocusable(menuPopoverRef.current);
|
|
60
44
|
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
|
61
45
|
}, [findFirstFocusable, menuPopoverRef]);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
const openedWithKeyboardRef = React.useRef(false);
|
|
47
|
+
const hasMouseMoved = React.useRef(false);
|
|
48
|
+
const {
|
|
49
|
+
dir
|
|
50
|
+
} = react_shared_contexts_1.useFluent();
|
|
51
|
+
const OpenArrowKey = dir === 'ltr' ? keyboard_keys_1.ArrowRight : keyboard_keys_1.ArrowLeft;
|
|
52
|
+
const child = React.isValidElement(state.children) ? react_utilities_1.onlyChild(state.children) : undefined;
|
|
53
|
+
const onContextMenu = react_utilities_1.useEventCallback(e => {
|
|
68
54
|
var _a, _b;
|
|
69
55
|
|
|
70
56
|
if (openOnContext) {
|
|
@@ -77,7 +63,7 @@ var useTriggerElement = function (state) {
|
|
|
77
63
|
|
|
78
64
|
(_b = (_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
79
65
|
});
|
|
80
|
-
|
|
66
|
+
const onClick = react_utilities_1.useEventCallback(e => {
|
|
81
67
|
var _a, _b;
|
|
82
68
|
|
|
83
69
|
if (!openOnContext) {
|
|
@@ -90,7 +76,7 @@ var useTriggerElement = function (state) {
|
|
|
90
76
|
|
|
91
77
|
(_b = (_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
92
78
|
});
|
|
93
|
-
|
|
79
|
+
const onKeyDown = react_utilities_1.useEventCallback(e => {
|
|
94
80
|
var _a, _b, _c;
|
|
95
81
|
|
|
96
82
|
if (react_utilities_1.shouldPreventDefaultOnKeyDown(e)) {
|
|
@@ -99,7 +85,7 @@ var useTriggerElement = function (state) {
|
|
|
99
85
|
(_a = e.target) === null || _a === void 0 ? void 0 : _a.click();
|
|
100
86
|
}
|
|
101
87
|
|
|
102
|
-
|
|
88
|
+
const key = e.key;
|
|
103
89
|
|
|
104
90
|
if (!openOnContext && (isSubmenu && key === OpenArrowKey || !isSubmenu && key === keyboard_keys_1.ArrowDown)) {
|
|
105
91
|
setOpen(e, {
|
|
@@ -120,13 +106,9 @@ var useTriggerElement = function (state) {
|
|
|
120
106
|
focusFirst();
|
|
121
107
|
}
|
|
122
108
|
|
|
123
|
-
if (open && key === keyboard_keys_1.ArrowDown && !isSubmenu) {
|
|
124
|
-
focusFirst();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
109
|
(_c = (_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onKeyDown) === null || _c === void 0 ? void 0 : _c.call(_b, e);
|
|
128
110
|
});
|
|
129
|
-
|
|
111
|
+
const onMouseEnter = react_utilities_1.useEventCallback(e => {
|
|
130
112
|
var _a, _b;
|
|
131
113
|
|
|
132
114
|
if (openOnHover && hasMouseMoved.current) {
|
|
@@ -141,7 +123,7 @@ var useTriggerElement = function (state) {
|
|
|
141
123
|
// First time open the mouse using mousemove and then continue with mouseenter
|
|
142
124
|
// Only use once to determine that the user is using the mouse since it is an expensive event to handle
|
|
143
125
|
|
|
144
|
-
|
|
126
|
+
const onMouseMove = react_utilities_1.useEventCallback(e => {
|
|
145
127
|
if (openOnHover && !hasMouseMoved.current) {
|
|
146
128
|
setOpen(e, {
|
|
147
129
|
open: true,
|
|
@@ -150,7 +132,7 @@ var useTriggerElement = function (state) {
|
|
|
150
132
|
hasMouseMoved.current = true;
|
|
151
133
|
}
|
|
152
134
|
});
|
|
153
|
-
|
|
135
|
+
const onMouseLeave = react_utilities_1.useEventCallback(e => {
|
|
154
136
|
var _a, _b;
|
|
155
137
|
|
|
156
138
|
if (openOnHover) {
|
|
@@ -162,32 +144,36 @@ var useTriggerElement = function (state) {
|
|
|
162
144
|
|
|
163
145
|
(_b = (_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
164
146
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
'aria-haspopup': true,
|
|
147
|
+
const disabled = (_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.disabled;
|
|
148
|
+
const triggerProps = {
|
|
149
|
+
'aria-haspopup': 'menu',
|
|
169
150
|
'aria-expanded': open,
|
|
170
|
-
id: ((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.id) || triggerId
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
151
|
+
id: ((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.id) || triggerId,
|
|
152
|
+
...(!disabled ? {
|
|
153
|
+
onClick,
|
|
154
|
+
onMouseEnter,
|
|
155
|
+
onMouseLeave,
|
|
156
|
+
onContextMenu,
|
|
157
|
+
onKeyDown,
|
|
158
|
+
onMouseMove
|
|
159
|
+
} : // Spread disabled event handlers to implement contract and avoid specific disabled logic in handlers
|
|
160
|
+
{
|
|
161
|
+
onClick: noop,
|
|
162
|
+
onMouseEnter: noop,
|
|
163
|
+
onMouseLeave: noop,
|
|
164
|
+
onContextMenu: noop,
|
|
165
|
+
onKeyDown: noop,
|
|
166
|
+
onMouseMove: noop
|
|
167
|
+
})
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
if (!open && !isSubmenu) {
|
|
171
|
+
triggerProps['aria-expanded'] = undefined;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
state.children = react_utilities_1.applyTriggerPropsToChildren(state.children, { ...triggerProps,
|
|
189
175
|
ref: react_utilities_1.useMergedRefs(typeof state.children !== 'function' && state.children.ref || null, triggerRef)
|
|
190
|
-
})
|
|
176
|
+
});
|
|
191
177
|
return state;
|
|
192
178
|
};
|
|
193
179
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuTrigger/useTriggerElement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuTrigger/useTriggerElement.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OA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AAK,KAAA,CAAL,GAAA,KAAK,CAAE,KAAP,MAAY,IAAZ,IAAY,EAAA,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAY,EAAA,CAAE,EAAd,KAAoB,SAHkB;AAK1C,QAAI,CAAC,QAAD,GACA;AACE,MAAA,OADF;AAEE,MAAA,YAFF;AAGE,MAAA,YAHF;AAIE,MAAA,aAJF;AAKE,MAAA,SALF;AAME,MAAA;AANF,KADA,GASA;AACA;AACE,MAAA,OAAO,EAAE,IADX;AAEE,MAAA,YAAY,EAAE,IAFhB;AAGE,MAAA,YAAY,EAAE,IAHhB;AAIE,MAAA,aAAa,EAAE,IAJjB;AAKE,MAAA,SAAS,EAAE,IALb;AAME,MAAA,WAAW,EAAE;AANf,KAVJ;AAL0C,GAA5C;;AAyBA,MAAI,CAAC,IAAD,IAAS,CAAC,SAAd,EAAyB;AACvB,IAAA,YAAY,CAAC,eAAD,CAAZ,GAAgC,SAAhC;AACD;;AAED,EAAA,KAAK,CAAC,QAAN,GAAiB,iBAAA,CAAA,2BAAA,CAA4B,KAAK,CAAC,QAAlC,EAA4C,EAC3D,GAAG,YADwD;AAE3D,IAAA,GAAG,EAAE,iBAAA,CAAA,aAAA,CAAe,OAAO,KAAK,CAAC,QAAb,KAA0B,UAA1B,IAAwC,KAAK,CAAC,QAAN,CAAe,GAAxD,IAAgE,IAA9E,EAAoF,UAApF;AAFsD,GAA5C,CAAjB;AAKA,SAAO,KAAP;AACD,CAhIM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourceRoot":""}
|
|
@@ -5,17 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useMenuContext = exports.MenuProvider = exports.MenuContext = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
|
|
9
9
|
|
|
10
10
|
exports.MenuContext = /*#__PURE__*/react_context_selector_1.createContext({
|
|
11
11
|
open: false,
|
|
12
|
-
setOpen:
|
|
13
|
-
return false;
|
|
14
|
-
},
|
|
12
|
+
setOpen: () => false,
|
|
15
13
|
checkedValues: {},
|
|
16
|
-
onCheckedValueChange:
|
|
17
|
-
return null;
|
|
18
|
-
},
|
|
14
|
+
onCheckedValueChange: () => null,
|
|
19
15
|
defaultCheckedValues: {},
|
|
20
16
|
isSubmenu: false,
|
|
21
17
|
triggerRef: {
|
|
@@ -32,9 +28,7 @@ exports.MenuContext = /*#__PURE__*/react_context_selector_1.createContext({
|
|
|
32
28
|
});
|
|
33
29
|
exports.MenuProvider = exports.MenuContext.Provider;
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
return react_context_selector_1.useContextSelector(exports.MenuContext, selector);
|
|
37
|
-
};
|
|
31
|
+
const useMenuContext = selector => react_context_selector_1.useContextSelector(exports.MenuContext, selector);
|
|
38
32
|
|
|
39
33
|
exports.useMenuContext = useMenuContext;
|
|
40
34
|
//# sourceMappingURL=menuContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contexts/menuContext.ts"],"names":[],"mappings":";;;;;;;AACA,
|
|
1
|
+
{"version":3,"sources":["../../src/contexts/menuContext.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AAKa,OAAA,CAAA,WAAA,gBAAyC,wBAAA,CAAA,aAAA,CAAgC;AACpF,EAAA,IAAI,EAAE,KAD8E;AAEpF,EAAA,OAAO,EAAE,MAAM,KAFqE;AAGpF,EAAA,aAAa,EAAE,EAHqE;AAIpF,EAAA,oBAAoB,EAAE,MAAM,IAJwD;AAKpF,EAAA,oBAAoB,EAAE,EAL8D;AAMpF,EAAA,SAAS,EAAE,KANyE;AAOpF,EAAA,UAAU,EAAG;AAAE,IAAA,OAAO,EAAE;AAAX,GAPuE;AAQpF,EAAA,cAAc,EAAG;AAAE,IAAA,OAAO,EAAE;AAAX,GARmE;AASpF,EAAA,SAAS,EAAE,EATyE;AAUpF,EAAA,aAAa,EAAE,KAVqE;AAWpF,EAAA,WAAW,EAAE,KAXuE;AAYpF,EAAA,QAAQ,EAAE,KAZ0E;AAapF,EAAA,aAAa,EAAE;AAbqE,CAAhC,CAAzC;AAwCA,OAAA,CAAA,YAAA,GAAe,OAAA,CAAA,WAAA,CAAY,QAA3B;;AAEN,MAAM,cAAc,GAAO,QAAJ,IAC5B,wBAAA,CAAA,kBAAA,CAAmB,OAAA,CAAA,WAAnB,EAAgC,QAAhC,CADK;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd","sourceRoot":""}
|
|
@@ -5,16 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useMenuGroupContext = exports.MenuGroupContextProvider = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const MenuGroupContext = /*#__PURE__*/React.createContext({
|
|
11
11
|
headerId: ''
|
|
12
12
|
});
|
|
13
13
|
exports.MenuGroupContextProvider = MenuGroupContext.Provider;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
return React.useContext(MenuGroupContext);
|
|
17
|
-
};
|
|
15
|
+
const useMenuGroupContext = () => React.useContext(MenuGroupContext);
|
|
18
16
|
|
|
19
17
|
exports.useMenuGroupContext = useMenuGroupContext;
|
|
20
18
|
//# sourceMappingURL=menuGroupContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contexts/menuGroupContext.ts"],"names":[],"mappings":";;;;;;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/contexts/menuGroupContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAEA,MAAM,gBAAgB,gBAAG,KAAK,CAAC,aAAN,CAA2C;AAAE,EAAA,QAAQ,EAAE;AAAZ,CAA3C,CAAzB;AAaa,OAAA,CAAA,wBAAA,GAA2B,gBAAgB,CAAC,QAA5C;;AACN,MAAM,mBAAmB,GAAG,MAAM,KAAK,CAAC,UAAN,CAAiB,gBAAjB,CAAlC;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","sourceRoot":""}
|
|
@@ -5,30 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useMenuListContext = exports.MenuListProvider = exports.MenuListContext = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
|
|
9
9
|
|
|
10
10
|
exports.MenuListContext = /*#__PURE__*/react_context_selector_1.createContext({
|
|
11
11
|
checkedValues: {},
|
|
12
|
-
onCheckedValueChange:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return null;
|
|
17
|
-
},
|
|
18
|
-
toggleCheckbox: function () {
|
|
19
|
-
return null;
|
|
20
|
-
},
|
|
21
|
-
selectRadio: function () {
|
|
22
|
-
return null;
|
|
23
|
-
},
|
|
12
|
+
onCheckedValueChange: () => null,
|
|
13
|
+
setFocusByFirstCharacter: () => null,
|
|
14
|
+
toggleCheckbox: () => null,
|
|
15
|
+
selectRadio: () => null,
|
|
24
16
|
hasIcons: false,
|
|
25
17
|
hasCheckmarks: false
|
|
26
18
|
});
|
|
27
19
|
exports.MenuListProvider = exports.MenuListContext.Provider;
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
return react_context_selector_1.useContextSelector(exports.MenuListContext, selector);
|
|
31
|
-
};
|
|
21
|
+
const useMenuListContext = selector => react_context_selector_1.useContextSelector(exports.MenuListContext, selector);
|
|
32
22
|
|
|
33
23
|
exports.useMenuListContext = useMenuListContext;
|
|
34
24
|
//# sourceMappingURL=menuListContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contexts/menuListContext.tsx"],"names":[],"mappings":";;;;;;;AACA,
|
|
1
|
+
{"version":3,"sources":["../../src/contexts/menuListContext.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AAKa,OAAA,CAAA,eAAA,gBAAiD,wBAAA,CAAA,aAAA,CAAoC;AAChG,EAAA,aAAa,EAAE,EADiF;AAEhG,EAAA,oBAAoB,EAAE,MAAM,IAFoE;AAGhG,EAAA,wBAAwB,EAAE,MAAM,IAHgE;AAIhG,EAAA,cAAc,EAAE,MAAM,IAJ0E;AAKhG,EAAA,WAAW,EAAE,MAAM,IAL6E;AAMhG,EAAA,QAAQ,EAAE,KANsF;AAOhG,EAAA,aAAa,EAAE;AAPiF,CAApC,CAAjD;AAsBA,OAAA,CAAA,gBAAA,GAAmB,OAAA,CAAA,eAAA,CAAgB,QAAnC;;AAEN,MAAM,kBAAkB,GAAQ,QAAL,IAChC,wBAAA,CAAA,kBAAA,CAAmB,OAAA,CAAA,eAAnB,EAAoC,QAApC,CADK;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourceRoot":""}
|
|
@@ -5,18 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useMenuTriggerContext = exports.MenuTriggerContextProvider = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
9
|
/**
|
|
10
10
|
* Context used communicate with child that it is a trigger for a menu
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const MenuTriggerContext = /*#__PURE__*/React.createContext(false);
|
|
15
15
|
exports.MenuTriggerContextProvider = MenuTriggerContext.Provider;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
return React.useContext(MenuTriggerContext);
|
|
19
|
-
};
|
|
17
|
+
const useMenuTriggerContext = () => React.useContext(MenuTriggerContext);
|
|
20
18
|
|
|
21
19
|
exports.useMenuTriggerContext = useMenuTriggerContext;
|
|
22
20
|
//# sourceMappingURL=menuTriggerContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contexts/menuTriggerContext.ts"],"names":[],"mappings":";;;;;;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/contexts/menuTriggerContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAEA;;AAEG;;;AACH,MAAM,kBAAkB,gBAAG,KAAK,CAAC,aAAN,CAA6B,KAA7B,CAA3B;AAEa,OAAA,CAAA,0BAAA,GAA6B,kBAAkB,CAAC,QAAhD;;AACN,MAAM,qBAAqB,GAAG,MAAM,KAAK,CAAC,UAAN,CAAiB,kBAAjB,CAApC;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourceRoot":""}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useCheckmarkStyles = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
|
11
11
|
"root": {
|
|
12
12
|
"a9b677": "fjw5fx7",
|
|
13
13
|
"Bqenvij": "fd461yt",
|
|
@@ -26,8 +26,8 @@ var useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const useCheckmarkStyles = state => {
|
|
30
|
+
const styles = useStyles();
|
|
31
31
|
|
|
32
32
|
if (state.checkmark) {
|
|
33
33
|
state.checkmark.className = react_make_styles_1.mergeClasses(styles.root, state.checked && styles.rootChecked, state.checkmark.className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/selectable/useCheckmarkStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/selectable/useCheckmarkStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAIA,MAAM,SAAS,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAWA;;;;AAIG;;;AACI,MAAM,kBAAkB,GAAI,KAAD,IAAsE;AACtG,QAAM,MAAM,GAAG,SAAS,EAAxB;;AACA,MAAI,KAAK,CAAC,SAAV,EAAqB;AACnB,IAAA,KAAK,CAAC,SAAN,CAAgB,SAAhB,GAA4B,mBAAA,CAAA,YAAA,CAC1B,MAAM,CAAC,IADmB,EAE1B,KAAK,CAAC,OAAN,IAAiB,MAAM,CAAC,WAFE,EAG1B,KAAK,CAAC,SAAN,CAAgB,SAHU,CAA5B;AAKD;AACF,CATM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourceRoot":""}
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useIsSubmenu = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const menuContext_1 = /*#__PURE__*/require("../contexts/menuContext");
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const menuListContext_1 = /*#__PURE__*/require("../contexts/menuListContext");
|
|
13
13
|
/**
|
|
14
14
|
* A component can be a part of a submenu whether its menu context `isSubmenu` flag is true
|
|
15
15
|
* or whether it is a part of a `MenuList`
|
|
@@ -21,10 +21,8 @@ var menuListContext_1 = /*#__PURE__*/require("../contexts/menuListContext");
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
function useIsSubmenu() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
var hasMenuListContext = react_context_selector_1.useHasParentContext(menuListContext_1.MenuListContext);
|
|
24
|
+
const menuContextValue = menuContext_1.useMenuContext(context => context.isSubmenu);
|
|
25
|
+
const hasMenuListContext = react_context_selector_1.useHasParentContext(menuListContext_1.MenuListContext);
|
|
28
26
|
return menuContextValue || hasMenuListContext;
|
|
29
27
|
}
|
|
30
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/useIsSubmenu.ts"],"names":[],"mappings":";;;;;;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/useIsSubmenu.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;;;;;;AAOG;;;AACH,SAAgB,YAAhB,GAA4B;AAC1B,QAAM,gBAAgB,GAAG,aAAA,CAAA,cAAA,CAAe,OAAO,IAAI,OAAO,CAAC,SAAlC,CAAzB;AACA,QAAM,kBAAkB,GAAG,wBAAA,CAAA,mBAAA,CAAoB,iBAAA,CAAA,eAApB,CAA3B;AAEA,SAAO,gBAAgB,IAAI,kBAA3B;AACD;;AALD,OAAA,CAAA,YAAA,GAAA,YAAA","sourceRoot":""}
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.dispatchMenuEnterEvent = exports.useOnMenuMouseEnter = exports.MENU_ENTER_EVENT = 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_portal_1 = /*#__PURE__*/require("@fluentui/react-portal");
|
|
13
13
|
/**
|
|
14
14
|
* Name of the custom event
|
|
15
15
|
*/
|
|
@@ -28,27 +28,29 @@ exports.MENU_ENTER_EVENT = 'fuimenuenter';
|
|
|
28
28
|
* Each nested menu can use the listener to check if the event is from a child or parent menu
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const useOnMenuMouseEnter = options => {
|
|
32
|
+
const {
|
|
33
|
+
refs,
|
|
34
|
+
callback,
|
|
35
|
+
element,
|
|
36
|
+
disabled
|
|
37
|
+
} = options; // Keep mouse event here because this is essentially a custom 'mouseenter' event
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
const listener = react_utilities_1.useEventCallback(ev => {
|
|
38
40
|
var _a;
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
const popoverRef = refs[0];
|
|
43
|
+
const someMenuPopover = ev.target; // someMenu is a child -> will always be contained because of vParents
|
|
42
44
|
// someMenu is a parent -> will always not be contained because no vParent
|
|
43
45
|
// someMenu is the current popover -> it will contain itself
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
const isOutsidePopover = !react_portal_1.elementContains((_a = popoverRef.current) !== null && _a !== void 0 ? _a : null, someMenuPopover);
|
|
46
48
|
|
|
47
49
|
if (isOutsidePopover && !disabled) {
|
|
48
50
|
callback(ev);
|
|
49
51
|
}
|
|
50
52
|
});
|
|
51
|
-
React.useEffect(
|
|
53
|
+
React.useEffect(() => {
|
|
52
54
|
// eslint-disable-next-line eqeqeq
|
|
53
55
|
if (element == null) {
|
|
54
56
|
return;
|
|
@@ -58,7 +60,7 @@ var useOnMenuMouseEnter = function (options) {
|
|
|
58
60
|
element.addEventListener(exports.MENU_ENTER_EVENT, listener);
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
return
|
|
63
|
+
return () => {
|
|
62
64
|
element.removeEventListener(exports.MENU_ENTER_EVENT, listener);
|
|
63
65
|
};
|
|
64
66
|
}, [listener, element, disabled]);
|
|
@@ -71,11 +73,11 @@ exports.useOnMenuMouseEnter = useOnMenuMouseEnter;
|
|
|
71
73
|
* @param nativeEvent the native mouse event this is mapped to
|
|
72
74
|
*/
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
const dispatchMenuEnterEvent = (el, nativeEvent) => {
|
|
75
77
|
el.dispatchEvent(new CustomEvent(exports.MENU_ENTER_EVENT, {
|
|
76
78
|
bubbles: true,
|
|
77
79
|
detail: {
|
|
78
|
-
nativeEvent
|
|
80
|
+
nativeEvent
|
|
79
81
|
}
|
|
80
82
|
}));
|
|
81
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/useOnMenuEnter.ts"],"names":[],"mappings":";;;;;;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/useOnMenuEnter.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAGA;;AAEG;;;AACU,OAAA,CAAA,gBAAA,GAAmB,cAAnB;AAEb;;;;;;;;;;AAUG;;AACI,MAAM,mBAAmB,GAAI,OAAD,IAA8C;AAC/E,QAAM;AAAE,IAAA,IAAF;AAAQ,IAAA,QAAR;AAAkB,IAAA,OAAlB;AAA2B,IAAA;AAA3B,MAAwC,OAA9C,CAD+E,CAG/E;;AACA,QAAM,QAAQ,GAAG,iBAAA,CAAA,gBAAA,CAAkB,EAAD,IAAmB;;;AACnD,UAAM,UAAU,GAAG,IAAI,CAAC,CAAD,CAAvB;AACA,UAAM,eAAe,GAAG,EAAE,CAAC,MAA3B,CAFmD,CAInD;AACA;AACA;;AACA,UAAM,gBAAgB,GAAG,CAAC,cAAA,CAAA,eAAA,CAAe,CAA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