@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
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuPopover/MenuPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,kBAA/B;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AAIA;;AAEG;;AACH,OAAO,
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuPopover/MenuPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,kBAA/B;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AAIA;;AAEG;;AACH,OAAO,MAAM,WAAW,gBAA0C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAChG,QAAM,KAAK,GAAG,cAAc,CAAC,KAAD,EAAQ,GAAR,CAA5B;AAEA,EAAA,oBAAoB,CAAC,KAAD,CAApB;AACA,SAAO,iBAAiB,CAAC,KAAD,CAAxB;AACD,CALiE,CAA3D;AAOP,WAAW,CAAC,WAAZ,GAA0B,aAA1B","sourceRoot":""}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { getSlots } from '@fluentui/react-utilities';
|
4
3
|
import { Portal } from '@fluentui/react-portal';
|
@@ -6,15 +5,16 @@ import { Portal } from '@fluentui/react-portal';
|
|
6
5
|
* Render the final JSX of MenuPopover
|
7
6
|
*/
|
8
7
|
|
9
|
-
export
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
export const renderMenuPopover = state => {
|
9
|
+
const {
|
10
|
+
slots,
|
11
|
+
slotProps
|
12
|
+
} = getSlots(state);
|
13
13
|
|
14
14
|
if (state.inline) {
|
15
|
-
return /*#__PURE__*/React.createElement(slots.root,
|
15
|
+
return /*#__PURE__*/React.createElement(slots.root, Object.assign({}, slotProps.root));
|
16
16
|
}
|
17
17
|
|
18
|
-
return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(slots.root,
|
18
|
+
return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(slots.root, Object.assign({}, slotProps.root)));
|
19
19
|
};
|
20
20
|
//# sourceMappingURL=renderMenuPopover.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuPopover/renderMenuPopover.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuPopover/renderMenuPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAEA,SAAS,MAAT,QAAuB,wBAAvB;AAEA;;AAEG;;AACH,OAAO,MAAM,iBAAiB,GAAI,KAAD,IAA4B;AAC3D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAmB,KAAnB,CAArC;;AAEA,MAAI,KAAK,CAAC,MAAV,EAAkB;AAChB,wBAAO,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAAP;AACD;;AAED,sBACE,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO,IAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CADF,CADF;AAKD,CAZM","sourceRoot":""}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { ArrowLeft, Tab, ArrowRight, Escape } from '@fluentui/keyboard-keys';
|
4
3
|
import { getNativeElementProps, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';
|
@@ -16,59 +15,51 @@ import { useIsSubmenu } from '../../utils/useIsSubmenu';
|
|
16
15
|
* @param ref - reference to root HTMLElement of MenuPopover
|
17
16
|
*/
|
18
17
|
|
19
|
-
export
|
18
|
+
export const useMenuPopover = (props, ref) => {
|
20
19
|
var _a;
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
});
|
31
|
-
|
32
|
-
var canDispatchCustomEventRef = React.useRef(true);
|
33
|
-
var throttleDispatchTimerRef = React.useRef(0);
|
34
|
-
var dir = useFluent().dir;
|
35
|
-
var CloseArrowKey = dir === 'ltr' ? ArrowLeft : ArrowRight; // use DOM listener since react events propagate up the react tree
|
21
|
+
const popoverRef = useMenuContext(context => context.menuPopoverRef);
|
22
|
+
const setOpen = useMenuContext(context => context.setOpen);
|
23
|
+
const openOnHover = useMenuContext(context => context.openOnHover);
|
24
|
+
const isSubmenu = useIsSubmenu();
|
25
|
+
const canDispatchCustomEventRef = React.useRef(true);
|
26
|
+
const throttleDispatchTimerRef = React.useRef(0);
|
27
|
+
const {
|
28
|
+
dir
|
29
|
+
} = useFluent();
|
30
|
+
const CloseArrowKey = dir === 'ltr' ? ArrowLeft : ArrowRight; // use DOM listener since react events propagate up the react tree
|
36
31
|
// no need to do `contains` logic as menus are all positioned in different portals
|
37
32
|
|
38
|
-
|
33
|
+
const mouseOverListenerCallbackRef = React.useCallback(node => {
|
39
34
|
if (node) {
|
40
35
|
// Dispatches the custom menu mouse enter event with throttling
|
41
36
|
// Needs to trigger on mouseover to support keyboard + mouse together
|
42
37
|
// i.e. keyboard opens submenus while cursor is still on the parent
|
43
|
-
node.addEventListener('mouseover',
|
38
|
+
node.addEventListener('mouseover', e => {
|
44
39
|
if (canDispatchCustomEventRef.current) {
|
45
40
|
canDispatchCustomEventRef.current = false;
|
46
41
|
dispatchMenuEnterEvent(popoverRef.current, e); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
47
42
|
// @ts-ignore #16889 Node setTimeout type leaking
|
48
43
|
|
49
|
-
throttleDispatchTimerRef.current = setTimeout(
|
50
|
-
return canDispatchCustomEventRef.current = true;
|
51
|
-
}, 250);
|
44
|
+
throttleDispatchTimerRef.current = setTimeout(() => canDispatchCustomEventRef.current = true, 250);
|
52
45
|
}
|
53
46
|
});
|
54
47
|
}
|
55
48
|
}, [popoverRef, throttleDispatchTimerRef]);
|
56
|
-
React.useEffect(
|
57
|
-
(
|
58
|
-
return clearTimeout(throttleDispatchTimerRef.current);
|
59
|
-
});
|
49
|
+
React.useEffect(() => {
|
50
|
+
() => clearTimeout(throttleDispatchTimerRef.current);
|
60
51
|
}, []);
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
role: 'presentation'
|
66
|
-
}, props), {
|
52
|
+
const inline = (_a = useMenuContext(context => context.inline)) !== null && _a !== void 0 ? _a : false;
|
53
|
+
const rootProps = getNativeElementProps('div', {
|
54
|
+
role: 'presentation',
|
55
|
+
...props,
|
67
56
|
ref: useMergedRefs(ref, popoverRef, mouseOverListenerCallbackRef)
|
68
|
-
})
|
69
|
-
|
70
|
-
|
71
|
-
|
57
|
+
});
|
58
|
+
const {
|
59
|
+
onMouseEnter: onMouseEnterOriginal,
|
60
|
+
onKeyDown: onKeyDownOriginal
|
61
|
+
} = rootProps;
|
62
|
+
rootProps.onMouseEnter = useEventCallback(e => {
|
72
63
|
if (openOnHover) {
|
73
64
|
setOpen(e, {
|
74
65
|
open: true,
|
@@ -78,10 +69,10 @@ export var useMenuPopover = function (props, ref) {
|
|
78
69
|
|
79
70
|
onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(e);
|
80
71
|
});
|
81
|
-
rootProps.onKeyDown = useEventCallback(
|
72
|
+
rootProps.onKeyDown = useEventCallback(e => {
|
82
73
|
var _a;
|
83
74
|
|
84
|
-
|
75
|
+
const key = e.key;
|
85
76
|
|
86
77
|
if (key === Escape || isSubmenu && key === CloseArrowKey) {
|
87
78
|
if ((_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
|
@@ -103,7 +94,7 @@ export var useMenuPopover = function (props, ref) {
|
|
103
94
|
onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(e);
|
104
95
|
});
|
105
96
|
return {
|
106
|
-
inline
|
97
|
+
inline,
|
107
98
|
root: rootProps
|
108
99
|
};
|
109
100
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuPopover/useMenuPopover.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuPopover/useMenuPopover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,SAAT,EAAoB,GAApB,EAAyB,UAAzB,EAAqC,MAArC,QAAmD,yBAAnD;AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,aAAlD,QAAuE,2BAAvE;AAEA,SAAS,cAAT,QAA+B,4BAA/B;AACA,SAAS,sBAAT,QAAuC,mBAAvC;AACA,SAAS,SAAT,QAA0B,iCAA1B;AACA,SAAS,YAAT,QAA6B,0BAA7B;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,cAAc,GAAG,CAAC,KAAD,EAA0B,GAA1B,KAA2E;;;AACvG,QAAM,UAAU,GAAG,cAAc,CAAC,OAAO,IAAI,OAAO,CAAC,cAApB,CAAjC;AACA,QAAM,OAAO,GAAG,cAAc,CAAC,OAAO,IAAI,OAAO,CAAC,OAApB,CAA9B;AACA,QAAM,WAAW,GAAG,cAAc,CAAC,OAAO,IAAI,OAAO,CAAC,WAApB,CAAlC;AACA,QAAM,SAAS,GAAG,YAAY,EAA9B;AACA,QAAM,yBAAyB,GAAG,KAAK,CAAC,MAAN,C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AACD,GAfqC,CAAtC;AAiBA,SAAO;AACL,IAAA,MADK;AAEL,IAAA,IAAI,EAAE;AAFD,GAAP;AAID,CA3EM","sourceRoot":""}
|
@@ -1,13 +1,14 @@
|
|
1
1
|
import { mergeClasses, __styles } from '@fluentui/react-make-styles';
|
2
|
+
export const menuPopoverClassName = 'fui-MenuPopover';
|
2
3
|
|
3
|
-
|
4
|
+
const useStyles = /*#__PURE__*/__styles({
|
4
5
|
"root": {
|
5
6
|
"Dimara": "ft85np5",
|
6
7
|
"De3pzq": "fxugw4r",
|
7
8
|
"Bf4jedk": "fkqu4gx",
|
8
9
|
"B2u0y6b": "f1kaai3v",
|
9
10
|
"a9b677": "f1ahpp82",
|
10
|
-
"E5pizo":
|
11
|
+
"E5pizo": "f1hg901r",
|
11
12
|
"z8tnut": "f10ra9hq",
|
12
13
|
"z189sj": ["f8wuabp", "fycuoez"],
|
13
14
|
"Byoj8tv": "f1y2xyjm",
|
@@ -26,16 +27,16 @@ var useStyles = /*#__PURE__*/__styles({
|
|
26
27
|
"zhjwy3": ["fjscplz", "f1gn591s"]
|
27
28
|
}
|
28
29
|
}, {
|
29
|
-
"d": [".ft85np5{border-radius:var(--borderRadiusMedium);}", ".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".fkqu4gx{min-width:128px;}", ".f1kaai3v{max-width:300px;}", ".f1ahpp82{width:-webkit-max-content;width:-moz-max-content;width:max-content;}", ".f1hg901r{box-shadow:var(--shadow16);}", ".
|
30
|
+
"d": [".ft85np5{border-radius:var(--borderRadiusMedium);}", ".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".fkqu4gx{min-width:128px;}", ".f1kaai3v{max-width:300px;}", ".f1ahpp82{width:-webkit-max-content;width:-moz-max-content;width:max-content;}", ".f1hg901r{box-shadow:var(--shadow16);}", ".f10ra9hq{padding-top:4px;}", ".f8wuabp{padding-right:4px;}", ".fycuoez{padding-left:4px;}", ".f1y2xyjm{padding-bottom:4px;}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}"]
|
30
31
|
});
|
31
32
|
/**
|
32
33
|
* Apply styling to the Menu slots based on the state
|
33
34
|
*/
|
34
35
|
|
35
36
|
|
36
|
-
export
|
37
|
-
|
38
|
-
state.root.className = mergeClasses(styles.root, state.root.className);
|
37
|
+
export const useMenuPopoverStyles = state => {
|
38
|
+
const styles = useStyles();
|
39
|
+
state.root.className = mergeClasses(menuPopoverClassName, styles.root, state.root.className);
|
39
40
|
return state;
|
40
41
|
};
|
41
42
|
//# sourceMappingURL=useMenuPopoverStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuPopover/useMenuPopoverStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,6BAAzC
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuPopover/useMenuPopoverStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,6BAAzC;AAGA,OAAO,MAAM,oBAAoB,GAAG,iBAA7B;;AAEP,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAaA;;AAEG;;;AACH,OAAO,MAAM,oBAAoB,GAAI,KAAD,IAA8C;AAChF,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,oBAAD,EAAuB,MAAM,CAAC,IAA9B,EAAoC,KAAK,CAAC,IAAN,CAAW,SAA/C,CAAnC;AACA,SAAO,KAAP;AACD,CAJM","sourceRoot":""}
|
@@ -5,8 +5,8 @@ import { renderMenuTrigger } from './renderMenuTrigger';
|
|
5
5
|
* and adds the necessary event handling to open a popup menu
|
6
6
|
*/
|
7
7
|
|
8
|
-
export
|
9
|
-
|
8
|
+
export const MenuTrigger = props => {
|
9
|
+
const state = useMenuTrigger(props);
|
10
10
|
return renderMenuTrigger(state);
|
11
11
|
};
|
12
12
|
MenuTrigger.displayName = 'MenuTrigger';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuTrigger/MenuTrigger.tsx"],"names":[],"mappings":"AACA,SAAS,cAAT,QAA+B,kBAA/B;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AAGA;;;AAGG;;AACH,OAAO,
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuTrigger/MenuTrigger.tsx"],"names":[],"mappings":"AACA,SAAS,cAAT,QAA+B,kBAA/B;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AAGA;;;AAGG;;AACH,OAAO,MAAM,WAAW,GAA+B,KAAK,IAAG;AAC7D,QAAM,KAAK,GAAG,cAAc,CAAC,KAAD,CAA5B;AAEA,SAAO,iBAAiB,CAAC,KAAD,CAAxB;AACD,CAJM;AAMP,WAAW,CAAC,WAAZ,GAA0B,aAA1B","sourceRoot":""}
|
@@ -6,7 +6,7 @@ import { MenuTriggerContextProvider } from '../../contexts/menuTriggerContext';
|
|
6
6
|
* Only renders children
|
7
7
|
*/
|
8
8
|
|
9
|
-
export
|
9
|
+
export const renderMenuTrigger = state => {
|
10
10
|
return /*#__PURE__*/React.createElement(MenuTriggerContextProvider, {
|
11
11
|
value: true
|
12
12
|
}, state.children);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuTrigger/renderMenuTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,0BAAT,QAA2C,mCAA3C;AAGA;;;;AAIG;;AACH,OAAO,
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuTrigger/renderMenuTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,0BAAT,QAA2C,mCAA3C;AAGA;;;;AAIG;;AACH,OAAO,MAAM,iBAAiB,GAAI,KAAD,IAA4B;AAC3D,sBAAO,KAAA,CAAA,aAAA,CAAC,0BAAD,EAA2B;AAAC,IAAA,KAAK,EAAE;AAAR,GAA3B,EAA0C,KAAK,CAAC,QAAhD,CAAP;AACD,CAFM","sourceRoot":""}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import { useTriggerElement } from './useTriggerElement';
|
3
2
|
/**
|
4
3
|
* Create the state required to render MenuTrigger.
|
@@ -7,9 +6,9 @@ import { useTriggerElement } from './useTriggerElement';
|
|
7
6
|
* @param props - props from this instance of MenuTrigger
|
8
7
|
*/
|
9
8
|
|
10
|
-
export
|
11
|
-
|
12
|
-
|
9
|
+
export const useMenuTrigger = props => {
|
10
|
+
const state = { ...props
|
11
|
+
}; // TODO just move the contents of this hook here
|
13
12
|
|
14
13
|
return useTriggerElement(state);
|
15
14
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuTrigger/useMenuTrigger.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuTrigger/useMenuTrigger.ts"],"names":[],"mappings":"AAAA,SAAS,iBAAT,QAAkC,qBAAlC;AAGA;;;;;AAKG;;AACH,OAAO,MAAM,cAAc,GAAI,KAAD,IAA8C;AAC1E,QAAM,KAAK,GAAG,EAAE,GAAG;AAAL,GAAd,CAD0E,CAG1E;;AACA,SAAO,iBAAiB,CAAC,KAAD,CAAxB;AACD,CALM","sourceRoot":""}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { ArrowRight, ArrowDown, ArrowLeft, Escape } from '@fluentui/keyboard-keys';
|
4
3
|
import { applyTriggerPropsToChildren, onlyChild, shouldPreventDefaultOnKeyDown, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';
|
@@ -7,50 +6,38 @@ import { useMenuContext } from '../../contexts/menuContext';
|
|
7
6
|
import { useFluent } from '@fluentui/react-shared-contexts';
|
8
7
|
import { useIsSubmenu } from '../../utils/useIsSubmenu';
|
9
8
|
|
10
|
-
|
11
|
-
return null;
|
12
|
-
};
|
9
|
+
const noop = () => null;
|
13
10
|
/**
|
14
11
|
* Adds the necessary props to the trigger element
|
15
12
|
*/
|
16
13
|
|
17
14
|
|
18
|
-
export
|
15
|
+
export const useTriggerElement = state => {
|
19
16
|
var _a, _b;
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
return context.triggerId;
|
35
|
-
});
|
36
|
-
var openOnHover = useMenuContext(function (context) {
|
37
|
-
return context.openOnHover;
|
38
|
-
});
|
39
|
-
var openOnContext = useMenuContext(function (context) {
|
40
|
-
return context.openOnContext;
|
41
|
-
});
|
42
|
-
var isSubmenu = useIsSubmenu();
|
43
|
-
var findFirstFocusable = useFocusFinders().findFirstFocusable;
|
44
|
-
var focusFirst = React.useCallback(function () {
|
45
|
-
var firstFocusable = findFirstFocusable(menuPopoverRef.current);
|
18
|
+
const triggerRef = useMenuContext(context => context.triggerRef);
|
19
|
+
const menuPopoverRef = useMenuContext(context => context.menuPopoverRef);
|
20
|
+
const setOpen = useMenuContext(context => context.setOpen);
|
21
|
+
const open = useMenuContext(context => context.open);
|
22
|
+
const triggerId = useMenuContext(context => context.triggerId);
|
23
|
+
const openOnHover = useMenuContext(context => context.openOnHover);
|
24
|
+
const openOnContext = useMenuContext(context => context.openOnContext);
|
25
|
+
const isSubmenu = useIsSubmenu();
|
26
|
+
const {
|
27
|
+
findFirstFocusable
|
28
|
+
} = useFocusFinders();
|
29
|
+
const focusFirst = React.useCallback(() => {
|
30
|
+
const firstFocusable = findFirstFocusable(menuPopoverRef.current);
|
46
31
|
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
47
32
|
}, [findFirstFocusable, menuPopoverRef]);
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
33
|
+
const openedWithKeyboardRef = React.useRef(false);
|
34
|
+
const hasMouseMoved = React.useRef(false);
|
35
|
+
const {
|
36
|
+
dir
|
37
|
+
} = useFluent();
|
38
|
+
const OpenArrowKey = dir === 'ltr' ? ArrowRight : ArrowLeft;
|
39
|
+
const child = /*#__PURE__*/React.isValidElement(state.children) ? onlyChild(state.children) : undefined;
|
40
|
+
const onContextMenu = useEventCallback(e => {
|
54
41
|
var _a, _b;
|
55
42
|
|
56
43
|
if (openOnContext) {
|
@@ -63,7 +50,7 @@ export var useTriggerElement = function (state) {
|
|
63
50
|
|
64
51
|
(_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);
|
65
52
|
});
|
66
|
-
|
53
|
+
const onClick = useEventCallback(e => {
|
67
54
|
var _a, _b;
|
68
55
|
|
69
56
|
if (!openOnContext) {
|
@@ -76,7 +63,7 @@ export var useTriggerElement = function (state) {
|
|
76
63
|
|
77
64
|
(_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);
|
78
65
|
});
|
79
|
-
|
66
|
+
const onKeyDown = useEventCallback(e => {
|
80
67
|
var _a, _b, _c;
|
81
68
|
|
82
69
|
if (shouldPreventDefaultOnKeyDown(e)) {
|
@@ -85,7 +72,7 @@ export var useTriggerElement = function (state) {
|
|
85
72
|
(_a = e.target) === null || _a === void 0 ? void 0 : _a.click();
|
86
73
|
}
|
87
74
|
|
88
|
-
|
75
|
+
const key = e.key;
|
89
76
|
|
90
77
|
if (!openOnContext && (isSubmenu && key === OpenArrowKey || !isSubmenu && key === ArrowDown)) {
|
91
78
|
setOpen(e, {
|
@@ -112,7 +99,7 @@ export var useTriggerElement = function (state) {
|
|
112
99
|
|
113
100
|
(_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);
|
114
101
|
});
|
115
|
-
|
102
|
+
const onMouseEnter = useEventCallback(e => {
|
116
103
|
var _a, _b;
|
117
104
|
|
118
105
|
if (openOnHover && hasMouseMoved.current) {
|
@@ -127,7 +114,7 @@ export var useTriggerElement = function (state) {
|
|
127
114
|
// First time open the mouse using mousemove and then continue with mouseenter
|
128
115
|
// Only use once to determine that the user is using the mouse since it is an expensive event to handle
|
129
116
|
|
130
|
-
|
117
|
+
const onMouseMove = useEventCallback(e => {
|
131
118
|
if (openOnHover && !hasMouseMoved.current) {
|
132
119
|
setOpen(e, {
|
133
120
|
open: true,
|
@@ -136,7 +123,7 @@ export var useTriggerElement = function (state) {
|
|
136
123
|
hasMouseMoved.current = true;
|
137
124
|
}
|
138
125
|
});
|
139
|
-
|
126
|
+
const onMouseLeave = useEventCallback(e => {
|
140
127
|
var _a, _b;
|
141
128
|
|
142
129
|
if (openOnHover) {
|
@@ -148,32 +135,31 @@ export var useTriggerElement = function (state) {
|
|
148
135
|
|
149
136
|
(_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);
|
150
137
|
});
|
151
|
-
|
152
|
-
|
153
|
-
var triggerProps = __assign({
|
138
|
+
const disabled = (_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.disabled;
|
139
|
+
const triggerProps = {
|
154
140
|
'aria-haspopup': true,
|
155
141
|
'aria-expanded': open,
|
156
|
-
id: ((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.id) || triggerId
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
state.children = applyTriggerPropsToChildren(state.children,
|
142
|
+
id: ((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.id) || triggerId,
|
143
|
+
...(!disabled ? {
|
144
|
+
onClick,
|
145
|
+
onMouseEnter,
|
146
|
+
onMouseLeave,
|
147
|
+
onContextMenu,
|
148
|
+
onKeyDown,
|
149
|
+
onMouseMove
|
150
|
+
} : // Spread disabled event handlers to implement contract and avoid specific disabled logic in handlers
|
151
|
+
{
|
152
|
+
onClick: noop,
|
153
|
+
onMouseEnter: noop,
|
154
|
+
onMouseLeave: noop,
|
155
|
+
onContextMenu: noop,
|
156
|
+
onKeyDown: noop,
|
157
|
+
onMouseMove: noop
|
158
|
+
})
|
159
|
+
};
|
160
|
+
state.children = applyTriggerPropsToChildren(state.children, { ...triggerProps,
|
175
161
|
ref: useMergedRefs(typeof state.children !== 'function' && state.children.ref || null, triggerRef)
|
176
|
-
})
|
162
|
+
});
|
177
163
|
return state;
|
178
164
|
};
|
179
165
|
//# sourceMappingURL=useTriggerElement.js.map
|
@@ -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,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,U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,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,EAAA,KAAK,CAAC,QAAN,GAAiB,2BAA2B,CAAC,KAAK,CAAC,QAAP,EAAiB,EAC3D,GAAG,YADwD;AAE3D,IAAA,GAAG,EAAE,aAAa,CAAE,OAAO,KAAK,CAAC,QAAb,KAA0B,UAA1B,IAAwC,KAAK,CAAC,QAAN,CAAe,GAAxD,IAAgE,IAAjE,EAAuE,UAAvE;AAFyC,GAAjB,CAA5C;AAKA,SAAO,KAAP;AACD,CAhIM","sourceRoot":""}
|
@@ -1,13 +1,9 @@
|
|
1
1
|
import { createContext, useContextSelector } from '@fluentui/react-context-selector';
|
2
|
-
export
|
2
|
+
export const MenuContext = /*#__PURE__*/createContext({
|
3
3
|
open: false,
|
4
|
-
setOpen:
|
5
|
-
return false;
|
6
|
-
},
|
4
|
+
setOpen: () => false,
|
7
5
|
checkedValues: {},
|
8
|
-
onCheckedValueChange:
|
9
|
-
return null;
|
10
|
-
},
|
6
|
+
onCheckedValueChange: () => null,
|
11
7
|
defaultCheckedValues: {},
|
12
8
|
isSubmenu: false,
|
13
9
|
triggerRef: {
|
@@ -22,8 +18,6 @@ export var MenuContext = /*#__PURE__*/createContext({
|
|
22
18
|
hasIcons: false,
|
23
19
|
hasCheckmarks: false
|
24
20
|
});
|
25
|
-
export
|
26
|
-
export
|
27
|
-
return useContextSelector(MenuContext, selector);
|
28
|
-
};
|
21
|
+
export const MenuProvider = MenuContext.Provider;
|
22
|
+
export const useMenuContext = selector => useContextSelector(MenuContext, selector);
|
29
23
|
//# sourceMappingURL=menuContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/contexts/menuContext.ts"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAKA,OAAO,
|
1
|
+
{"version":3,"sources":["../../src/contexts/menuContext.ts"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAKA,OAAO,MAAM,WAAW,gBAA8B,aAAa,CAAmB;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,CAAnB,CAA5D;AAwCP,OAAO,MAAM,YAAY,GAAG,WAAW,CAAC,QAAjC;AAEP,OAAO,MAAM,cAAc,GAAO,QAAJ,IAC5B,kBAAkB,CAAC,WAAD,EAAc,QAAd,CADb","sourceRoot":""}
|
@@ -1,9 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
|
2
|
+
const MenuGroupContext = /*#__PURE__*/React.createContext({
|
3
3
|
headerId: ''
|
4
4
|
});
|
5
|
-
export
|
6
|
-
export
|
7
|
-
return React.useContext(MenuGroupContext);
|
8
|
-
};
|
5
|
+
export const MenuGroupContextProvider = MenuGroupContext.Provider;
|
6
|
+
export const useMenuGroupContext = () => React.useContext(MenuGroupContext);
|
9
7
|
//# sourceMappingURL=menuGroupContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/contexts/menuGroupContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,
|
1
|
+
{"version":3,"sources":["../../src/contexts/menuGroupContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,MAAM,gBAAgB,gBAAG,KAAK,CAAC,aAAN,CAA2C;AAAE,EAAA,QAAQ,EAAE;AAAZ,CAA3C,CAAzB;AAaA,OAAO,MAAM,wBAAwB,GAAG,gBAAgB,CAAC,QAAlD;AACP,OAAO,MAAM,mBAAmB,GAAG,MAAM,KAAK,CAAC,UAAN,CAAiB,gBAAjB,CAAlC","sourceRoot":""}
|
@@ -1,23 +1,13 @@
|
|
1
1
|
import { createContext, useContextSelector } from '@fluentui/react-context-selector';
|
2
|
-
export
|
2
|
+
export const MenuListContext = /*#__PURE__*/createContext({
|
3
3
|
checkedValues: {},
|
4
|
-
onCheckedValueChange:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
return null;
|
9
|
-
},
|
10
|
-
toggleCheckbox: function () {
|
11
|
-
return null;
|
12
|
-
},
|
13
|
-
selectRadio: function () {
|
14
|
-
return null;
|
15
|
-
},
|
4
|
+
onCheckedValueChange: () => null,
|
5
|
+
setFocusByFirstCharacter: () => null,
|
6
|
+
toggleCheckbox: () => null,
|
7
|
+
selectRadio: () => null,
|
16
8
|
hasIcons: false,
|
17
9
|
hasCheckmarks: false
|
18
10
|
});
|
19
|
-
export
|
20
|
-
export
|
21
|
-
return useContextSelector(MenuListContext, selector);
|
22
|
-
};
|
11
|
+
export const MenuListProvider = MenuListContext.Provider;
|
12
|
+
export const useMenuListContext = selector => useContextSelector(MenuListContext, selector);
|
23
13
|
//# sourceMappingURL=menuListContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/contexts/menuListContext.tsx"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAKA,OAAO,
|
1
|
+
{"version":3,"sources":["../../src/contexts/menuListContext.tsx"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAKA,OAAO,MAAM,eAAe,gBAAkC,aAAa,CAAuB;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,CAAvB,CAApE;AAsBP,OAAO,MAAM,gBAAgB,GAAG,eAAe,CAAC,QAAzC;AAEP,OAAO,MAAM,kBAAkB,GAAQ,QAAL,IAChC,kBAAkB,CAAC,eAAD,EAAkB,QAAlB,CADb","sourceRoot":""}
|
@@ -3,9 +3,7 @@ import * as React from 'react';
|
|
3
3
|
* Context used communicate with child that it is a trigger for a menu
|
4
4
|
*/
|
5
5
|
|
6
|
-
|
7
|
-
export
|
8
|
-
export
|
9
|
-
return React.useContext(MenuTriggerContext);
|
10
|
-
};
|
6
|
+
const MenuTriggerContext = /*#__PURE__*/React.createContext(false);
|
7
|
+
export const MenuTriggerContextProvider = MenuTriggerContext.Provider;
|
8
|
+
export const useMenuTriggerContext = () => React.useContext(MenuTriggerContext);
|
11
9
|
//# sourceMappingURL=menuTriggerContext.js.map
|