@fluentui/react-menu 9.0.0-nightly.46b9ea7036.0 → 9.0.0-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +451 -34
- package/CHANGELOG.md +102 -22
- package/Spec.md +21 -16
- package/dist/react-menu.d.ts +140 -71
- package/lib/MenuSplitGroup.d.ts +1 -0
- package/lib/MenuSplitGroup.js +2 -0
- package/lib/MenuSplitGroup.js.map +1 -0
- package/lib/components/Menu/Menu.js +7 -7
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +1 -1
- package/lib/components/Menu/renderMenu.d.ts +1 -1
- package/lib/components/Menu/renderMenu.js +1 -1
- package/lib/components/Menu/renderMenu.js.map +1 -1
- package/lib/components/Menu/useMenu.d.ts +2 -2
- package/lib/components/Menu/useMenu.js +119 -128
- package/lib/components/Menu/useMenu.js.map +1 -1
- package/lib/components/Menu/useMenuContextValues.d.ts +1 -1
- package/lib/components/Menu/useMenuContextValues.js +35 -33
- package/lib/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib/components/MenuDivider/MenuDivider.d.ts +1 -1
- package/lib/components/MenuDivider/MenuDivider.js +8 -8
- package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/MenuDivider.types.d.ts +2 -2
- package/lib/components/MenuDivider/renderMenuDivider.d.ts +1 -1
- package/lib/components/MenuDivider/renderMenuDivider.js +7 -7
- package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDivider.d.ts +1 -1
- package/lib/components/MenuDivider/useMenuDivider.js +9 -7
- package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDividerStyles.d.ts +2 -1
- package/lib/components/MenuDivider/useMenuDividerStyles.js +7 -5
- package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib/components/MenuGroup/MenuGroup.d.ts +1 -1
- package/lib/components/MenuGroup/MenuGroup.js +10 -8
- package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/MenuGroup.types.d.ts +3 -3
- 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.d.ts +1 -1
- package/lib/components/MenuGroup/renderMenuGroup.js +7 -7
- package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroup.d.ts +1 -1
- package/lib/components/MenuGroup/useMenuGroup.js +10 -7
- package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroupContextValues.d.ts +1 -1
- package/lib/components/MenuGroup/useMenuGroupContextValues.js +8 -8
- 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.d.ts +1 -1
- package/lib/components/MenuGroupHeader/MenuGroupHeader.js +8 -8
- package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/MenuGroupHeader.types.d.ts +2 -2
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.d.ts +1 -1
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +7 -7
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.d.ts +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +13 -8
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +2 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +7 -5
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.d.ts +1 -1
- package/lib/components/MenuItem/MenuItem.js +8 -10
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.types.d.ts +7 -7
- package/lib/components/MenuItem/renderMenuItem.d.ts +1 -1
- package/lib/components/MenuItem/renderMenuItem.js +12 -8
- package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useCharacterSearch.js +7 -7
- package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
- package/lib/components/MenuItem/useMenuItem.d.ts +2 -6
- package/lib/components/MenuItem/useMenuItem.js +35 -45
- package/lib/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useMenuItemStyles.d.ts +2 -1
- package/lib/components/MenuItem/useMenuItemStyles.js +31 -27
- package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib/components/MenuItemCheckbox/MenuItemCheckbox.d.ts +1 -1
- package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js +8 -8
- 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.d.ts +1 -1
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +11 -8
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.d.ts +1 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js +14 -15
- package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.d.ts +2 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +8 -5
- package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
- package/lib/components/MenuItemRadio/MenuItemRadio.d.ts +1 -1
- package/lib/components/MenuItemRadio/MenuItemRadio.js +8 -8
- 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.d.ts +1 -1
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js +11 -8
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemRadio/useMenuItemRadio.d.ts +1 -1
- package/lib/components/MenuItemRadio/useMenuItemRadio.js +14 -14
- package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemRadio/useMenuItemRadioStyles.d.ts +2 -1
- package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js +8 -5
- package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
- package/lib/components/MenuList/MenuList.d.ts +1 -1
- package/lib/components/MenuList/MenuList.js +10 -10
- package/lib/components/MenuList/MenuList.js.map +1 -1
- package/lib/components/MenuList/MenuList.types.d.ts +12 -10
- package/lib/components/MenuList/index.d.ts +1 -1
- package/lib/components/MenuList/index.js +0 -1
- package/lib/components/MenuList/index.js.map +1 -1
- package/lib/components/MenuList/renderMenuList.d.ts +1 -1
- package/lib/components/MenuList/renderMenuList.js +7 -7
- package/lib/components/MenuList/renderMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuList.d.ts +1 -1
- package/lib/components/MenuList/useMenuList.js +70 -87
- package/lib/components/MenuList/useMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuListContextValues.d.ts +1 -1
- package/lib/components/MenuList/useMenuListContextValues.js +19 -17
- package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib/components/MenuList/useMenuListStyles.d.ts +2 -1
- package/lib/components/MenuList/useMenuListStyles.js +9 -7
- package/lib/components/MenuList/useMenuListStyles.js.map +1 -1
- package/lib/components/MenuPopover/MenuPopover.js +7 -7
- package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/MenuPopover.types.d.ts +2 -2
- package/lib/components/MenuPopover/renderMenuPopover.d.ts +1 -1
- package/lib/components/MenuPopover/renderMenuPopover.js +9 -7
- package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopover.d.ts +3 -3
- package/lib/components/MenuPopover/useMenuPopover.js +35 -41
- package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopoverStyles.d.ts +2 -1
- package/lib/components/MenuPopover/useMenuPopoverStyles.js +13 -8
- package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib/components/MenuSplitGroup/MenuSplitGroup.d.ts +6 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.js +15 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +14 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js +2 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -0
- package/lib/components/MenuSplitGroup/index.d.ts +5 -0
- package/lib/components/MenuSplitGroup/index.js +6 -0
- package/lib/components/MenuSplitGroup/index.js.map +1 -0
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +5 -0
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +15 -0
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.d.ts +12 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +67 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +6 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js +35 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -0
- package/lib/components/MenuTrigger/MenuTrigger.d.ts +2 -1
- package/lib/components/MenuTrigger/MenuTrigger.js +6 -5
- package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.types.d.ts +6 -3
- package/lib/components/MenuTrigger/renderMenuTrigger.d.ts +1 -1
- package/lib/components/MenuTrigger/renderMenuTrigger.js +1 -1
- package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/useMenuTrigger.d.ts +2 -2
- package/lib/components/MenuTrigger/useMenuTrigger.js +166 -5
- package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib/contexts/menuContext.d.ts +1 -1
- package/lib/contexts/menuContext.js +5 -11
- package/lib/contexts/menuContext.js.map +1 -1
- package/lib/contexts/menuGroupContext.d.ts +1 -1
- package/lib/contexts/menuGroupContext.js +3 -5
- package/lib/contexts/menuGroupContext.js.map +1 -1
- package/lib/contexts/menuListContext.d.ts +1 -1
- package/lib/contexts/menuListContext.js +7 -17
- package/lib/contexts/menuListContext.js.map +1 -1
- package/lib/contexts/menuTriggerContext.d.ts +1 -1
- package/lib/contexts/menuTriggerContext.js +3 -5
- package/lib/contexts/menuTriggerContext.js.map +1 -1
- package/lib/index.d.ts +11 -10
- package/lib/index.js +11 -10
- package/lib/index.js.map +1 -1
- package/lib/selectable/useCheckmarkStyles.d.ts +2 -2
- package/lib/selectable/useCheckmarkStyles.js +4 -4
- package/lib/selectable/useCheckmarkStyles.js.map +1 -1
- package/lib/utils/useIsSubmenu.js +3 -5
- 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/MenuSplitGroup.d.ts +1 -0
- package/lib-commonjs/MenuSplitGroup.js +10 -0
- package/lib-commonjs/MenuSplitGroup.js.map +1 -0
- package/lib-commonjs/MenuTrigger.js +1 -1
- package/lib-commonjs/components/Menu/Menu.js +7 -7
- package/lib-commonjs/components/Menu/Menu.js.map +1 -1
- package/lib-commonjs/components/Menu/Menu.types.d.ts +1 -1
- package/lib-commonjs/components/Menu/index.js +1 -1
- package/lib-commonjs/components/Menu/renderMenu.d.ts +1 -1
- package/lib-commonjs/components/Menu/renderMenu.js +5 -5
- package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenu.d.ts +2 -2
- package/lib-commonjs/components/Menu/useMenu.js +130 -141
- package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenuContextValues.d.ts +1 -1
- package/lib-commonjs/components/Menu/useMenuContextValues.js +37 -35
- package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/MenuDivider.d.ts +1 -1
- package/lib-commonjs/components/MenuDivider/MenuDivider.js +9 -9
- package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/MenuDivider.types.d.ts +2 -2
- package/lib-commonjs/components/MenuDivider/index.js +1 -1
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.d.ts +1 -1
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +11 -12
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDivider.d.ts +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js +12 -11
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.d.ts +2 -1
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +11 -7
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/MenuGroup.d.ts +1 -1
- package/lib-commonjs/components/MenuGroup/MenuGroup.js +12 -9
- package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/MenuGroup.types.d.ts +3 -3
- 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.d.ts +1 -1
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +12 -13
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroup.d.ts +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js +13 -11
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.d.ts +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js +11 -11
- 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.d.ts +1 -1
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js +9 -9
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.d.ts +2 -2
- package/lib-commonjs/components/MenuGroupHeader/index.js +1 -1
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.d.ts +1 -1
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +11 -12
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.d.ts +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +16 -12
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +2 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +11 -7
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.d.ts +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.js +9 -12
- package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.types.d.ts +7 -7
- package/lib-commonjs/components/MenuItem/index.js +1 -1
- package/lib-commonjs/components/MenuItem/renderMenuItem.d.ts +1 -1
- package/lib-commonjs/components/MenuItem/renderMenuItem.js +16 -14
- 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.d.ts +2 -6
- package/lib-commonjs/components/MenuItem/useMenuItem.js +42 -53
- package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.d.ts +2 -1
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +40 -33
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.d.ts +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js +9 -9
- 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.d.ts +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +15 -14
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.d.ts +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js +19 -21
- 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 +12 -7
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.d.ts +1 -1
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js +9 -9
- 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.d.ts +1 -1
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +15 -14
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.d.ts +1 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js +19 -20
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.d.ts +2 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js +12 -7
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
- package/lib-commonjs/components/MenuList/MenuList.d.ts +1 -1
- package/lib-commonjs/components/MenuList/MenuList.js +11 -11
- package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/MenuList.types.d.ts +12 -10
- package/lib-commonjs/components/MenuList/index.d.ts +1 -1
- package/lib-commonjs/components/MenuList/index.js +1 -3
- package/lib-commonjs/components/MenuList/index.js.map +1 -1
- package/lib-commonjs/components/MenuList/renderMenuList.d.ts +1 -1
- package/lib-commonjs/components/MenuList/renderMenuList.js +12 -13
- package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuList.d.ts +1 -1
- package/lib-commonjs/components/MenuList/useMenuList.js +77 -95
- package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListContextValues.d.ts +1 -1
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js +21 -19
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListStyles.d.ts +2 -1
- package/lib-commonjs/components/MenuList/useMenuListStyles.js +12 -9
- package/lib-commonjs/components/MenuList/useMenuListStyles.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/MenuPopover.js +8 -8
- package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/MenuPopover.types.d.ts +2 -2
- package/lib-commonjs/components/MenuPopover/index.js +1 -1
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.d.ts +1 -1
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +14 -13
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopover.d.ts +3 -3
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js +43 -50
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.d.ts +2 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js +17 -10
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.d.ts +6 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js +26 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +14 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js +6 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/index.d.ts +5 -0
- package/lib-commonjs/components/MenuSplitGroup/index.js +18 -0
- package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +5 -0
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js +26 -0
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.d.ts +12 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +81 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +6 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js +47 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -0
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.d.ts +2 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +6 -5
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.d.ts +6 -3
- package/lib-commonjs/components/MenuTrigger/index.js +1 -1
- package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.d.ts +1 -1
- package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js +5 -5
- package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.d.ts +2 -2
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +174 -7
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib-commonjs/components/index.js +1 -1
- package/lib-commonjs/contexts/menuContext.d.ts +1 -1
- package/lib-commonjs/contexts/menuContext.js +6 -12
- package/lib-commonjs/contexts/menuContext.js.map +1 -1
- package/lib-commonjs/contexts/menuGroupContext.d.ts +1 -1
- package/lib-commonjs/contexts/menuGroupContext.js +5 -7
- package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
- package/lib-commonjs/contexts/menuListContext.d.ts +1 -1
- package/lib-commonjs/contexts/menuListContext.js +8 -18
- package/lib-commonjs/contexts/menuListContext.js.map +1 -1
- package/lib-commonjs/contexts/menuTriggerContext.d.ts +1 -1
- package/lib-commonjs/contexts/menuTriggerContext.js +5 -7
- package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
- package/lib-commonjs/index.d.ts +11 -10
- package/lib-commonjs/index.js +17 -15
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/selectable/index.js +1 -1
- package/lib-commonjs/selectable/useCheckmarkStyles.d.ts +2 -2
- package/lib-commonjs/selectable/useCheckmarkStyles.js +7 -7
- 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 -17
- 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/components/MenuTrigger/useTriggerElement.d.ts +0 -5
- package/lib/components/MenuTrigger/useTriggerElement.js +0 -179
- package/lib/components/MenuTrigger/useTriggerElement.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/components/MenuTrigger/useTriggerElement.d.ts +0 -5
- package/lib-commonjs/components/MenuTrigger/useTriggerElement.js +0 -195
- package/lib-commonjs/components/MenuTrigger/useTriggerElement.js.map +0 -1
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/MenuDivider/index"), exports);
|
10
10
|
//# sourceMappingURL=MenuDivider.js.map
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/MenuGroup/index"), exports);
|
10
10
|
//# sourceMappingURL=MenuGroup.js.map
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/MenuGroupHeader/index"), exports);
|
10
10
|
//# sourceMappingURL=MenuGroupHeader.js.map
|
package/lib-commonjs/MenuItem.js
CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/MenuItem/index"), exports);
|
10
10
|
//# sourceMappingURL=MenuItem.js.map
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/MenuItemCheckbox/index"), exports);
|
10
10
|
//# sourceMappingURL=MenuItemCheckbox.js.map
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/MenuItemRadio/index"), exports);
|
10
10
|
//# sourceMappingURL=MenuItemRadio.js.map
|
package/lib-commonjs/MenuList.js
CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/MenuList/index"), exports);
|
10
10
|
//# sourceMappingURL=MenuList.js.map
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/MenuPopover/index"), exports);
|
10
10
|
//# sourceMappingURL=MenuPopover.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './components/MenuSplitGroup/index';
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
|
+
|
9
|
+
tslib_1.__exportStar(require("./components/MenuSplitGroup/index"), exports);
|
10
|
+
//# sourceMappingURL=MenuSplitGroup.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/MenuSplitGroup.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mCAAA,CAAA,EAAA,OAAA","sourceRoot":""}
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/MenuTrigger/index"), exports);
|
10
10
|
//# sourceMappingURL=MenuTrigger.js.map
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.Menu = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const useMenu_1 = /*#__PURE__*/require("./useMenu");
|
9
9
|
|
10
|
-
|
10
|
+
const useMenuContextValues_1 = /*#__PURE__*/require("./useMenuContextValues");
|
11
11
|
|
12
|
-
|
12
|
+
const renderMenu_1 = /*#__PURE__*/require("./renderMenu");
|
13
13
|
/**
|
14
14
|
* Wrapper component that manages state for a popup MenuList and a MenuTrigger
|
15
15
|
*/
|
16
16
|
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
return renderMenu_1.
|
18
|
+
const Menu = props => {
|
19
|
+
const state = useMenu_1.useMenu_unstable(props);
|
20
|
+
const contextValues = useMenuContextValues_1.useMenuContextValues_unstable(state);
|
21
|
+
return renderMenu_1.renderMenu_unstable(state, contextValues);
|
22
22
|
};
|
23
23
|
|
24
24
|
exports.Menu = Menu;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Menu/Menu.tsx"],"names":[],"mappings":";;;;;;;AACA,
|
1
|
+
{"version":3,"sources":["../../../src/components/Menu/Menu.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,SAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,IAAI,GAAwB,KAAK,IAAG;AAC/C,QAAM,KAAK,GAAG,SAAA,CAAA,gBAAA,CAAiB,KAAjB,CAAd;AACA,QAAM,aAAa,GAAG,sBAAA,CAAA,6BAAA,CAA8B,KAA9B,CAAtB;AAEA,SAAO,YAAA,CAAA,mBAAA,CAAoB,KAApB,EAA2B,aAA3B,CAAP;AACD,CALM;;AAAM,OAAA,CAAA,IAAA,GAAI,IAAJ;AAOb,OAAA,CAAA,IAAA,CAAK,WAAL,GAAmB,MAAnB","sourceRoot":""}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { ComponentProps, ComponentState } from '@fluentui/react-utilities';
|
3
3
|
import { usePopperMouseTarget, PositioningShorthand } from '@fluentui/react-positioning';
|
4
|
-
import { MenuListCommons } from '../MenuList/
|
4
|
+
import { MenuListCommons } from '../MenuList/MenuList.types';
|
5
5
|
import { MenuContextValue } from '../../contexts/menuContext';
|
6
6
|
declare type MenuCommons = MenuListCommons & {
|
7
7
|
/**
|
@@ -2,4 +2,4 @@ import type { MenuContextValues, MenuState } from './Menu.types';
|
|
2
2
|
/**
|
3
3
|
* Render the final JSX of Menu
|
4
4
|
*/
|
5
|
-
export declare const
|
5
|
+
export declare const renderMenu_unstable: (state: MenuState, contextValues: MenuContextValues) => JSX.Element;
|
@@ -3,21 +3,21 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.renderMenu_unstable = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
9
|
|
10
|
-
|
10
|
+
const menuContext_1 = /*#__PURE__*/require("../../contexts/menuContext");
|
11
11
|
/**
|
12
12
|
* Render the final JSX of Menu
|
13
13
|
*/
|
14
14
|
|
15
15
|
|
16
|
-
|
16
|
+
const renderMenu_unstable = (state, contextValues) => {
|
17
17
|
return React.createElement(menuContext_1.MenuProvider, {
|
18
18
|
value: contextValues.menu
|
19
19
|
}, state.menuTrigger, state.open && state.menuPopover);
|
20
20
|
};
|
21
21
|
|
22
|
-
exports.
|
22
|
+
exports.renderMenu_unstable = renderMenu_unstable;
|
23
23
|
//# sourceMappingURL=renderMenu.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Menu/renderMenu.tsx"],"names":[],"mappings":";;;;;;;AAAA,
|
1
|
+
{"version":3,"sources":["../../../src/components/Menu/renderMenu.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,4BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,mBAAmB,GAAG,CAAC,KAAD,EAAmB,aAAnB,KAAuD;AACxF,SACE,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,YAAD,EAAa;AAAC,IAAA,KAAK,EAAE,aAAa,CAAC;AAAtB,GAAb,EACG,KAAK,CAAC,WADT,EAEG,KAAK,CAAC,IAAN,IAAc,KAAK,CAAC,WAFvB,CADF;AAMD,CAPM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","sourceRoot":""}
|
@@ -3,8 +3,8 @@ import type { MenuProps, MenuState } from './Menu.types';
|
|
3
3
|
* Create the state required to render Menu.
|
4
4
|
*
|
5
5
|
* The returned state can be modified with hooks such as useMenuStyles,
|
6
|
-
* before being passed to
|
6
|
+
* before being passed to renderMenu_unstable.
|
7
7
|
*
|
8
8
|
* @param props - props from this instance of Menu
|
9
9
|
*/
|
10
|
-
export declare const
|
10
|
+
export declare const useMenu_unstable: (props: MenuProps) => MenuState;
|
@@ -3,170 +3,159 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.useMenu_unstable = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
9
|
|
10
|
-
|
10
|
+
const react_positioning_1 = /*#__PURE__*/require("@fluentui/react-positioning");
|
11
11
|
|
12
|
-
|
12
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
13
13
|
|
14
|
-
|
14
|
+
const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
|
15
15
|
|
16
|
-
|
16
|
+
const react_portal_1 = /*#__PURE__*/require("@fluentui/react-portal");
|
17
17
|
|
18
|
-
|
18
|
+
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
19
19
|
|
20
|
-
|
20
|
+
const menuContext_1 = /*#__PURE__*/require("../../contexts/menuContext");
|
21
21
|
|
22
|
-
|
22
|
+
const index_1 = /*#__PURE__*/require("../../utils/index");
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
var index_2 = /*#__PURE__*/require("../../utils/index");
|
27
|
-
|
28
|
-
var useIsSubmenu_1 = /*#__PURE__*/require("../../utils/useIsSubmenu");
|
24
|
+
const useIsSubmenu_1 = /*#__PURE__*/require("../../utils/useIsSubmenu");
|
29
25
|
/**
|
30
26
|
* Create the state required to render Menu.
|
31
27
|
*
|
32
28
|
* The returned state can be modified with hooks such as useMenuStyles,
|
33
|
-
* before being passed to
|
29
|
+
* before being passed to renderMenu_unstable.
|
34
30
|
*
|
35
31
|
* @param props - props from this instance of Menu
|
36
32
|
*/
|
37
33
|
|
38
34
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
contextTarget = _a[0],
|
45
|
-
setContextTarget = _a[1];
|
46
|
-
|
47
|
-
var popperState = tslib_1.__assign({
|
35
|
+
const useMenu_unstable = props => {
|
36
|
+
const triggerId = react_utilities_1.useId('menu');
|
37
|
+
const isSubmenu = useIsSubmenu_1.useIsSubmenu();
|
38
|
+
const [contextTarget, setContextTarget] = react_positioning_1.usePopperMouseTarget();
|
39
|
+
const popperState = {
|
48
40
|
position: isSubmenu ? 'after' : 'below',
|
49
41
|
align: isSubmenu ? 'top' : 'start',
|
50
|
-
target: props.openOnContext ? contextTarget : undefined
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
if (
|
56
|
-
|
57
|
-
|
58
|
-
|
42
|
+
target: props.openOnContext ? contextTarget : undefined,
|
43
|
+
...react_positioning_1.resolvePositioningShorthand(props.positioning)
|
44
|
+
};
|
45
|
+
const children = React.Children.toArray(props.children);
|
46
|
+
|
47
|
+
if (process.env.NODE_ENV !== 'production') {
|
48
|
+
if (children.length === 0) {
|
49
|
+
// eslint-disable-next-line no-console
|
50
|
+
console.warn('Menu must contain at least one child');
|
51
|
+
}
|
59
52
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
} else {
|
64
|
-
acc.menuPopover = child;
|
53
|
+
if (children.length > 2) {
|
54
|
+
// eslint-disable-next-line no-console
|
55
|
+
console.warn('Menu must contain at most two children');
|
65
56
|
}
|
57
|
+
}
|
66
58
|
|
67
|
-
|
68
|
-
|
69
|
-
menuTrigger = _b.menuTrigger,
|
70
|
-
menuPopover = _b.menuPopover;
|
59
|
+
let menuTrigger = undefined;
|
60
|
+
let menuPopover = undefined;
|
71
61
|
|
72
|
-
|
73
|
-
|
74
|
-
|
62
|
+
if (children.length === 2) {
|
63
|
+
menuTrigger = children[0];
|
64
|
+
menuPopover = children[1];
|
65
|
+
} else if (children.length === 1) {
|
66
|
+
menuPopover = children[0];
|
67
|
+
}
|
75
68
|
|
76
|
-
|
69
|
+
const {
|
70
|
+
targetRef: triggerRef,
|
71
|
+
containerRef: menuPopoverRef
|
72
|
+
} = react_positioning_1.usePopper(popperState);
|
73
|
+
const initialState = {
|
77
74
|
hoverDelay: 500,
|
78
|
-
triggerId
|
75
|
+
triggerId,
|
79
76
|
isSubmenu: !!isSubmenu,
|
80
77
|
openOnHover: !!isSubmenu,
|
81
|
-
contextTarget
|
82
|
-
setContextTarget
|
83
|
-
|
84
|
-
menuTrigger
|
85
|
-
menuPopover
|
86
|
-
triggerRef
|
87
|
-
menuPopoverRef
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
return tslib_1.__assign(tslib_1.__assign({}, initialState), {
|
100
|
-
open: open,
|
101
|
-
setOpen: setOpen,
|
102
|
-
checkedValues: checkedValues,
|
103
|
-
onCheckedValueChange: onCheckedValueChange
|
104
|
-
});
|
78
|
+
contextTarget,
|
79
|
+
setContextTarget,
|
80
|
+
...props,
|
81
|
+
menuTrigger,
|
82
|
+
menuPopover,
|
83
|
+
triggerRef,
|
84
|
+
menuPopoverRef,
|
85
|
+
components: {}
|
86
|
+
}; // TODO Better way to narrow types ?
|
87
|
+
|
88
|
+
const [open, setOpen] = useMenuOpenState(initialState);
|
89
|
+
const [checkedValues, onCheckedValueChange] = useMenuSelectableState(initialState);
|
90
|
+
return { ...initialState,
|
91
|
+
open,
|
92
|
+
setOpen,
|
93
|
+
checkedValues,
|
94
|
+
onCheckedValueChange
|
95
|
+
};
|
105
96
|
};
|
106
97
|
|
107
|
-
exports.
|
98
|
+
exports.useMenu_unstable = useMenu_unstable;
|
108
99
|
/**
|
109
100
|
* Adds appropriate state values and handlers for selectable items
|
110
101
|
* i.e checkboxes and radios
|
111
102
|
*/
|
112
103
|
|
113
|
-
|
114
|
-
|
104
|
+
const useMenuSelectableState = state => {
|
105
|
+
const [checkedValues, setCheckedValues] = react_utilities_1.useControllableState({
|
115
106
|
state: state.checkedValues,
|
116
107
|
defaultState: state.defaultCheckedValues,
|
117
108
|
initialState: {}
|
118
|
-
})
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
109
|
+
});
|
110
|
+
const {
|
111
|
+
onCheckedValueChange: onCheckedValueChangeOriginal
|
112
|
+
} = state;
|
113
|
+
const onCheckedValueChange = react_utilities_1.useEventCallback((e, {
|
114
|
+
name,
|
115
|
+
checkedItems
|
116
|
+
}) => {
|
127
117
|
if (onCheckedValueChangeOriginal) {
|
128
118
|
onCheckedValueChangeOriginal(e, {
|
129
|
-
name
|
130
|
-
checkedItems
|
119
|
+
name,
|
120
|
+
checkedItems
|
131
121
|
});
|
132
122
|
}
|
133
123
|
|
134
|
-
setCheckedValues(
|
135
|
-
|
136
|
-
|
137
|
-
|
124
|
+
setCheckedValues(s => {
|
125
|
+
return s ? { ...s,
|
126
|
+
[name]: checkedItems
|
127
|
+
} : {
|
128
|
+
[name]: checkedItems
|
129
|
+
};
|
138
130
|
});
|
139
131
|
});
|
140
132
|
return [checkedValues, onCheckedValueChange];
|
141
133
|
};
|
142
134
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
135
|
+
const useMenuOpenState = state => {
|
136
|
+
const {
|
137
|
+
targetDocument
|
138
|
+
} = react_shared_contexts_1.useFluent();
|
139
|
+
const parentSetOpen = menuContext_1.useMenuContext_unstable(context => context.setOpen);
|
140
|
+
const onOpenChange = react_utilities_1.useEventCallback((e, data) => {
|
149
141
|
var _a;
|
150
142
|
|
151
143
|
return (_a = state.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(state, e, data);
|
152
144
|
});
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
var _a = react_utilities_1.useControllableState({
|
145
|
+
const shouldHandleKeyboardRef = React.useRef(false);
|
146
|
+
const shouldHandleTabRef = React.useRef(false);
|
147
|
+
const pressedShiftRef = React.useRef(false);
|
148
|
+
const setOpenTimeout = React.useRef(0);
|
149
|
+
const enteringTriggerRef = React.useRef(false);
|
150
|
+
const [open, setOpenState] = react_utilities_1.useControllableState({
|
160
151
|
state: state.open,
|
161
152
|
defaultState: state.defaultOpen,
|
162
153
|
initialState: false
|
163
|
-
})
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
var event = e instanceof CustomEvent && e.type === index_2.MENU_ENTER_EVENT ? e.detail.nativeEvent : e;
|
169
|
-
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(event, tslib_1.__assign({}, data));
|
154
|
+
});
|
155
|
+
const trySetOpen = react_utilities_1.useEventCallback((e, data) => {
|
156
|
+
const event = e instanceof CustomEvent && e.type === index_1.MENU_ENTER_EVENT ? e.detail.nativeEvent : e;
|
157
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(event, { ...data
|
158
|
+
});
|
170
159
|
|
171
160
|
if (data.open && e.type === 'contextmenu') {
|
172
161
|
state.setContextTarget(e);
|
@@ -183,12 +172,13 @@ var useMenuOpenState = function (state) {
|
|
183
172
|
}
|
184
173
|
|
185
174
|
if (data.bubble) {
|
186
|
-
parentSetOpen(e,
|
175
|
+
parentSetOpen(e, { ...data
|
176
|
+
});
|
187
177
|
}
|
188
178
|
|
189
179
|
setOpenState(data.open);
|
190
180
|
});
|
191
|
-
|
181
|
+
const setOpen = react_utilities_1.useEventCallback((e, data) => {
|
192
182
|
var _a;
|
193
183
|
|
194
184
|
clearTimeout(setOpenTimeout.current);
|
@@ -198,7 +188,7 @@ var useMenuOpenState = function (state) {
|
|
198
188
|
e.persist();
|
199
189
|
}
|
200
190
|
|
201
|
-
if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type ===
|
191
|
+
if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === index_1.MENU_ENTER_EVENT) {
|
202
192
|
if ((_a = state.triggerRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
|
203
193
|
enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';
|
204
194
|
} // FIXME leaking Node timeout type
|
@@ -206,9 +196,7 @@ var useMenuOpenState = function (state) {
|
|
206
196
|
// @ts-ignore
|
207
197
|
|
208
198
|
|
209
|
-
setOpenTimeout.current = setTimeout(
|
210
|
-
return trySetOpen(e, data);
|
211
|
-
}, state.hoverDelay);
|
199
|
+
setOpenTimeout.current = setTimeout(() => trySetOpen(e, data), state.hoverDelay);
|
212
200
|
} else {
|
213
201
|
trySetOpen(e, data);
|
214
202
|
}
|
@@ -218,15 +206,13 @@ var useMenuOpenState = function (state) {
|
|
218
206
|
disabled: !open,
|
219
207
|
element: targetDocument,
|
220
208
|
refs: [state.menuPopoverRef, state.triggerRef],
|
221
|
-
callback:
|
222
|
-
|
223
|
-
|
224
|
-
});
|
225
|
-
}
|
209
|
+
callback: e => setOpen(e, {
|
210
|
+
open: false
|
211
|
+
})
|
226
212
|
});
|
227
|
-
|
213
|
+
index_1.useOnMenuMouseEnter({
|
228
214
|
element: targetDocument,
|
229
|
-
callback:
|
215
|
+
callback: e => {
|
230
216
|
// When moving from a menu directly back to its trigger, this handler can close the menu
|
231
217
|
// Explicitly check a flag to see if this situation happens
|
232
218
|
if (!enteringTriggerRef.current) {
|
@@ -240,39 +226,42 @@ var useMenuOpenState = function (state) {
|
|
240
226
|
}); // Clear timeout on unmount
|
241
227
|
// Setting state after a component unmounts can cause memory leaks
|
242
228
|
|
243
|
-
React.useEffect(
|
244
|
-
return
|
229
|
+
React.useEffect(() => {
|
230
|
+
return () => {
|
245
231
|
clearTimeout(setOpenTimeout.current);
|
246
232
|
};
|
247
233
|
}, []); // Manage focus for open state
|
248
234
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
235
|
+
const {
|
236
|
+
findFirstFocusable,
|
237
|
+
findNextFocusable,
|
238
|
+
findPrevFocusable
|
239
|
+
} = react_tabster_1.useFocusFinders();
|
240
|
+
const focusFirst = React.useCallback(() => {
|
241
|
+
const firstFocusable = findFirstFocusable(state.menuPopoverRef.current);
|
256
242
|
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
257
243
|
}, [findFirstFocusable, state.menuPopoverRef]);
|
258
|
-
|
259
|
-
|
244
|
+
const focusAfterMenuTrigger = React.useCallback(() => {
|
245
|
+
const nextFocusable = findNextFocusable(state.triggerRef.current);
|
260
246
|
nextFocusable === null || nextFocusable === void 0 ? void 0 : nextFocusable.focus();
|
261
247
|
}, [findNextFocusable, state.triggerRef]);
|
262
|
-
|
263
|
-
|
248
|
+
const focusBeforeMenuTrigger = React.useCallback(() => {
|
249
|
+
const prevFocusable = findPrevFocusable(state.triggerRef.current);
|
264
250
|
prevFocusable === null || prevFocusable === void 0 ? void 0 : prevFocusable.focus();
|
265
251
|
}, [findPrevFocusable, state.triggerRef]);
|
266
|
-
React.useEffect(
|
267
|
-
|
268
|
-
|
269
|
-
if (!shouldHandleKeyboardRef.current) {
|
270
|
-
return;
|
252
|
+
React.useEffect(() => {
|
253
|
+
if (open) {
|
254
|
+
focusFirst();
|
271
255
|
}
|
256
|
+
}, [open, focusFirst]);
|
257
|
+
React.useEffect(() => {
|
258
|
+
var _a;
|
272
259
|
|
273
260
|
if (open) {
|
274
261
|
focusFirst();
|
275
|
-
}
|
262
|
+
}
|
263
|
+
|
264
|
+
if (shouldHandleKeyboardRef.current && !open) {
|
276
265
|
if (shouldHandleTabRef.current && !state.isSubmenu) {
|
277
266
|
pressedShiftRef.current ? focusBeforeMenuTrigger() : focusAfterMenuTrigger();
|
278
267
|
} else {
|