@fluentui/react-menu 9.7.4 → 9.7.6
Sign up to get free protection for your applications and to get access to all the features.
- package/.swcrc +30 -0
- package/CHANGELOG.json +127 -1
- package/CHANGELOG.md +36 -2
- package/lib/Menu.js.map +1 -1
- package/lib/MenuDivider.js.map +1 -1
- package/lib/MenuGroup.js.map +1 -1
- package/lib/MenuGroupHeader.js.map +1 -1
- package/lib/MenuItem.js.map +1 -1
- package/lib/MenuItemCheckbox.js.map +1 -1
- package/lib/MenuItemRadio.js.map +1 -1
- package/lib/MenuList.js.map +1 -1
- package/lib/MenuPopover.js.map +1 -1
- package/lib/MenuSplitGroup.js.map +1 -1
- package/lib/MenuTrigger.js.map +1 -1
- package/lib/components/Menu/Menu.js +1 -0
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.types.js +1 -1
- package/lib/components/Menu/Menu.types.js.map +1 -1
- package/lib/components/Menu/index.js.map +1 -1
- package/lib/components/Menu/renderMenu.js.map +1 -1
- package/lib/components/Menu/useMenu.js +9 -8
- package/lib/components/Menu/useMenu.js.map +1 -1
- package/lib/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/MenuDivider.types.js.map +1 -1
- package/lib/components/MenuDivider/index.js.map +1 -1
- package/lib/components/MenuDivider/renderMenuDivider.js +1 -3
- package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDivider.js +1 -0
- package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/MenuGroup.types.js.map +1 -1
- package/lib/components/MenuGroup/index.js.map +1 -1
- package/lib/components/MenuGroup/renderMenuGroup.js +1 -3
- package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroup.js +1 -0
- package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
- package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
- package/lib/components/MenuGroupHeader/index.js.map +1 -1
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +1 -3
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +1 -0
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.types.js.map +1 -1
- package/lib/components/MenuItem/index.js.map +1 -1
- package/lib/components/MenuItem/renderMenuItem.js +1 -13
- package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useCharacterSearch.js +3 -2
- package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
- package/lib/components/MenuItem/useMenuItem.js +7 -7
- package/lib/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useMenuItemStyles.js +15 -2
- package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
- package/lib/components/MenuItemCheckbox/index.js.map +1 -1
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +1 -11
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js +4 -4
- package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
- package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
- package/lib/components/MenuItemRadio/index.js.map +1 -1
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js +1 -11
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemRadio/useMenuItemRadio.js +4 -4
- package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
- package/lib/components/MenuList/MenuList.js.map +1 -1
- package/lib/components/MenuList/MenuList.types.js +1 -1
- package/lib/components/MenuList/MenuList.types.js.map +1 -1
- package/lib/components/MenuList/index.js.map +1 -1
- package/lib/components/MenuList/renderMenuList.js +1 -3
- package/lib/components/MenuList/renderMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuList.js +6 -5
- package/lib/components/MenuList/useMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib/components/MenuList/useMenuListStyles.js.map +1 -1
- package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/MenuPopover.types.js.map +1 -1
- package/lib/components/MenuPopover/index.js.map +1 -1
- package/lib/components/MenuPopover/renderMenuPopover.js +2 -6
- package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopover.js +4 -4
- package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
- package/lib/components/MenuSplitGroup/index.js.map +1 -1
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +1 -3
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +2 -2
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.js +1 -0
- package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.types.js +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
- package/lib/components/MenuTrigger/index.js.map +1 -1
- package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/contexts/menuContext.js +1 -0
- package/lib/contexts/menuContext.js.map +1 -1
- package/lib/contexts/menuGroupContext.js +2 -4
- package/lib/contexts/menuGroupContext.js.map +1 -1
- package/lib/contexts/menuListContext.js +1 -0
- package/lib/contexts/menuListContext.js.map +1 -1
- package/lib/contexts/menuTriggerContext.js +2 -4
- package/lib/contexts/menuTriggerContext.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/selectable/index.js.map +1 -1
- package/lib/selectable/types.js +1 -1
- package/lib/selectable/types.js.map +1 -1
- package/lib/selectable/useCheckmarkStyles.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/useIsSubmenu.js.map +1 -1
- package/lib/utils/useOnMenuEnter.js +2 -2
- package/lib/utils/useOnMenuEnter.js.map +1 -1
- package/lib-commonjs/Menu.js +5 -4
- package/lib-commonjs/Menu.js.map +1 -1
- package/lib-commonjs/MenuDivider.js +5 -4
- package/lib-commonjs/MenuDivider.js.map +1 -1
- package/lib-commonjs/MenuGroup.js +5 -4
- package/lib-commonjs/MenuGroup.js.map +1 -1
- package/lib-commonjs/MenuGroupHeader.js +5 -4
- package/lib-commonjs/MenuGroupHeader.js.map +1 -1
- package/lib-commonjs/MenuItem.js +5 -4
- package/lib-commonjs/MenuItem.js.map +1 -1
- package/lib-commonjs/MenuItemCheckbox.js +5 -4
- package/lib-commonjs/MenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/MenuItemRadio.js +5 -4
- package/lib-commonjs/MenuItemRadio.js.map +1 -1
- package/lib-commonjs/MenuList.js +5 -4
- package/lib-commonjs/MenuList.js.map +1 -1
- package/lib-commonjs/MenuPopover.js +5 -4
- package/lib-commonjs/MenuPopover.js.map +1 -1
- package/lib-commonjs/MenuSplitGroup.js +5 -4
- package/lib-commonjs/MenuSplitGroup.js.map +1 -1
- package/lib-commonjs/MenuTrigger.js +5 -4
- package/lib-commonjs/MenuTrigger.js.map +1 -1
- package/lib-commonjs/components/Menu/Menu.js +16 -15
- package/lib-commonjs/components/Menu/Menu.js.map +1 -1
- package/lib-commonjs/components/Menu/Menu.types.js +5 -2
- package/lib-commonjs/components/Menu/Menu.types.js.map +1 -1
- package/lib-commonjs/components/Menu/index.js +9 -8
- package/lib-commonjs/components/Menu/index.js.map +1 -1
- package/lib-commonjs/components/Menu/renderMenu.js +14 -14
- package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenu.js +258 -256
- package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenuContextValues.js +29 -43
- package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/MenuDivider.js +19 -20
- package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/MenuDivider.types.js +3 -2
- package/lib-commonjs/components/MenuDivider/MenuDivider.types.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/index.js +9 -8
- package/lib-commonjs/components/MenuDivider/index.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +13 -19
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js +22 -21
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +47 -25
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/MenuGroup.js +21 -22
- package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/MenuGroup.types.js +3 -2
- package/lib-commonjs/components/MenuGroup/MenuGroup.types.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/index.js +10 -9
- package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +16 -22
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js +23 -22
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js +18 -15
- package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js +19 -11
- package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js +19 -20
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js +3 -2
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/index.js +9 -8
- package/lib-commonjs/components/MenuGroupHeader/index.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +13 -19
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +22 -23
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +47 -25
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.js +19 -20
- package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.types.js +3 -2
- package/lib-commonjs/components/MenuItem/MenuItem.types.js.map +1 -1
- package/lib-commonjs/components/MenuItem/index.js +9 -8
- package/lib-commonjs/components/MenuItem/index.js.map +1 -1
- package/lib-commonjs/components/MenuItem/renderMenuItem.js +13 -28
- package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useCharacterSearch.js +24 -22
- package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItem.js +97 -104
- package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +318 -137
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js +19 -20
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js +3 -2
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/index.js +9 -8
- package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +13 -24
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js +44 -45
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +38 -30
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js +19 -20
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js +3 -2
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/index.js +9 -8
- package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +13 -27
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js +42 -45
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js +38 -30
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
- package/lib-commonjs/components/MenuList/MenuList.js +21 -22
- package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/MenuList.types.js +5 -2
- package/lib-commonjs/components/MenuList/MenuList.types.js.map +1 -1
- package/lib-commonjs/components/MenuList/index.js +10 -9
- package/lib-commonjs/components/MenuList/index.js.map +1 -1
- package/lib-commonjs/components/MenuList/renderMenuList.js +16 -21
- package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuList.js +143 -137
- package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js +20 -25
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListStyles.js +33 -23
- package/lib-commonjs/components/MenuList/useMenuListStyles.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/MenuPopover.js +19 -20
- package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/MenuPopover.types.js +3 -2
- package/lib-commonjs/components/MenuPopover/MenuPopover.types.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/index.js +9 -8
- package/lib-commonjs/components/MenuPopover/index.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +19 -26
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js +102 -110
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js +121 -50
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js +19 -20
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js +3 -2
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/index.js +9 -8
- package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js +13 -18
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +58 -64
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js +61 -32
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +15 -15
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js +5 -2
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/index.js +8 -7
- package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js +14 -16
- package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +163 -170
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib-commonjs/components/index.js +6 -5
- package/lib-commonjs/components/index.js.map +1 -1
- package/lib-commonjs/contexts/menuContext.js +38 -27
- package/lib-commonjs/contexts/menuContext.js.map +1 -1
- package/lib-commonjs/contexts/menuGroupContext.js +19 -12
- package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
- package/lib-commonjs/contexts/menuListContext.js +25 -14
- package/lib-commonjs/contexts/menuListContext.js.map +1 -1
- package/lib-commonjs/contexts/menuTriggerContext.js +18 -12
- package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
- package/lib-commonjs/index.js +91 -399
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/selectable/index.js +6 -5
- package/lib-commonjs/selectable/index.js.map +1 -1
- package/lib-commonjs/selectable/types.js +5 -2
- package/lib-commonjs/selectable/types.js.map +1 -1
- package/lib-commonjs/selectable/useCheckmarkStyles.js +28 -26
- package/lib-commonjs/selectable/useCheckmarkStyles.js.map +1 -1
- package/lib-commonjs/utils/index.js +5 -4
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/useIsSubmenu.js +13 -19
- package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
- package/lib-commonjs/utils/useOnMenuEnter.js +57 -68
- package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
- package/package.json +15 -14
- package/lib-amd/Menu.js +0 -6
- package/lib-amd/Menu.js.map +0 -1
- package/lib-amd/MenuDivider.js +0 -6
- package/lib-amd/MenuDivider.js.map +0 -1
- package/lib-amd/MenuGroup.js +0 -6
- package/lib-amd/MenuGroup.js.map +0 -1
- package/lib-amd/MenuGroupHeader.js +0 -6
- package/lib-amd/MenuGroupHeader.js.map +0 -1
- package/lib-amd/MenuItem.js +0 -6
- package/lib-amd/MenuItem.js.map +0 -1
- package/lib-amd/MenuItemCheckbox.js +0 -6
- package/lib-amd/MenuItemCheckbox.js.map +0 -1
- package/lib-amd/MenuItemRadio.js +0 -6
- package/lib-amd/MenuItemRadio.js.map +0 -1
- package/lib-amd/MenuList.js +0 -6
- package/lib-amd/MenuList.js.map +0 -1
- package/lib-amd/MenuPopover.js +0 -6
- package/lib-amd/MenuPopover.js.map +0 -1
- package/lib-amd/MenuSplitGroup.js +0 -6
- package/lib-amd/MenuSplitGroup.js.map +0 -1
- package/lib-amd/MenuTrigger.js +0 -6
- package/lib-amd/MenuTrigger.js.map +0 -1
- package/lib-amd/components/Menu/Menu.js +0 -16
- package/lib-amd/components/Menu/Menu.js.map +0 -1
- package/lib-amd/components/Menu/Menu.types.js +0 -5
- package/lib-amd/components/Menu/Menu.types.js.map +0 -1
- package/lib-amd/components/Menu/index.js +0 -10
- package/lib-amd/components/Menu/index.js.map +0 -1
- package/lib-amd/components/Menu/renderMenu.js +0 -15
- package/lib-amd/components/Menu/renderMenu.js.map +0 -1
- package/lib-amd/components/Menu/useMenu.js +0 -224
- package/lib-amd/components/Menu/useMenu.js.map +0 -1
- package/lib-amd/components/Menu/useMenuContextValues.js +0 -29
- package/lib-amd/components/Menu/useMenuContextValues.js.map +0 -1
- package/lib-amd/components/MenuDivider/MenuDivider.js +0 -17
- package/lib-amd/components/MenuDivider/MenuDivider.js.map +0 -1
- package/lib-amd/components/MenuDivider/MenuDivider.types.js +0 -5
- package/lib-amd/components/MenuDivider/MenuDivider.types.js.map +0 -1
- package/lib-amd/components/MenuDivider/index.js +0 -10
- package/lib-amd/components/MenuDivider/index.js.map +0 -1
- package/lib-amd/components/MenuDivider/renderMenuDivider.js +0 -15
- package/lib-amd/components/MenuDivider/renderMenuDivider.js.map +0 -1
- package/lib-amd/components/MenuDivider/useMenuDivider.js +0 -18
- package/lib-amd/components/MenuDivider/useMenuDivider.js.map +0 -1
- package/lib-amd/components/MenuDivider/useMenuDividerStyles.js +0 -18
- package/lib-amd/components/MenuDivider/useMenuDividerStyles.js.map +0 -1
- package/lib-amd/components/MenuGroup/MenuGroup.js +0 -18
- package/lib-amd/components/MenuGroup/MenuGroup.js.map +0 -1
- package/lib-amd/components/MenuGroup/MenuGroup.types.js +0 -5
- package/lib-amd/components/MenuGroup/MenuGroup.types.js.map +0 -1
- package/lib-amd/components/MenuGroup/index.js +0 -11
- package/lib-amd/components/MenuGroup/index.js.map +0 -1
- package/lib-amd/components/MenuGroup/renderMenuGroup.js +0 -16
- package/lib-amd/components/MenuGroup/renderMenuGroup.js.map +0 -1
- package/lib-amd/components/MenuGroup/useMenuGroup.js +0 -20
- package/lib-amd/components/MenuGroup/useMenuGroup.js.map +0 -1
- package/lib-amd/components/MenuGroup/useMenuGroupContextValues.js +0 -12
- package/lib-amd/components/MenuGroup/useMenuGroupContextValues.js.map +0 -1
- package/lib-amd/components/MenuGroup/useMenuGroupStyles.js +0 -14
- package/lib-amd/components/MenuGroup/useMenuGroupStyles.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.js +0 -17
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.types.js +0 -5
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.types.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/index.js +0 -10
- package/lib-amd/components/MenuGroupHeader/index.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/renderMenuGroupHeader.js +0 -15
- package/lib-amd/components/MenuGroupHeader/renderMenuGroupHeader.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeader.js +0 -19
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeader.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +0 -27
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +0 -1
- package/lib-amd/components/MenuItem/MenuItem.js +0 -17
- package/lib-amd/components/MenuItem/MenuItem.js.map +0 -1
- package/lib-amd/components/MenuItem/MenuItem.types.js +0 -5
- package/lib-amd/components/MenuItem/MenuItem.types.js.map +0 -1
- package/lib-amd/components/MenuItem/index.js +0 -10
- package/lib-amd/components/MenuItem/index.js.map +0 -1
- package/lib-amd/components/MenuItem/renderMenuItem.js +0 -19
- package/lib-amd/components/MenuItem/renderMenuItem.js.map +0 -1
- package/lib-amd/components/MenuItem/useCharacterSearch.js +0 -22
- package/lib-amd/components/MenuItem/useCharacterSearch.js.map +0 -1
- package/lib-amd/components/MenuItem/useMenuItem.js +0 -75
- package/lib-amd/components/MenuItem/useMenuItem.js.map +0 -1
- package/lib-amd/components/MenuItem/useMenuItemStyles.js +0 -109
- package/lib-amd/components/MenuItem/useMenuItemStyles.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.js +0 -17
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.types.js +0 -5
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/index.js +0 -10
- package/lib-amd/components/MenuItemCheckbox/index.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/renderMenuItemCheckbox.js +0 -16
- package/lib-amd/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckbox.js +0 -26
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +0 -31
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.js +0 -17
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.types.js +0 -5
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.types.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/index.js +0 -10
- package/lib-amd/components/MenuItemRadio/index.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/renderMenuItemRadio.js +0 -19
- package/lib-amd/components/MenuItemRadio/renderMenuItemRadio.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/useMenuItemRadio.js +0 -27
- package/lib-amd/components/MenuItemRadio/useMenuItemRadio.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/useMenuItemRadioStyles.js +0 -31
- package/lib-amd/components/MenuItemRadio/useMenuItemRadioStyles.js.map +0 -1
- package/lib-amd/components/MenuList/MenuList.js +0 -18
- package/lib-amd/components/MenuList/MenuList.js.map +0 -1
- package/lib-amd/components/MenuList/MenuList.types.js +0 -5
- package/lib-amd/components/MenuList/MenuList.types.js.map +0 -1
- package/lib-amd/components/MenuList/index.js +0 -11
- package/lib-amd/components/MenuList/index.js.map +0 -1
- package/lib-amd/components/MenuList/renderMenuList.js +0 -15
- package/lib-amd/components/MenuList/renderMenuList.js.map +0 -1
- package/lib-amd/components/MenuList/useMenuList.js +0 -125
- package/lib-amd/components/MenuList/useMenuList.js.map +0 -1
- package/lib-amd/components/MenuList/useMenuListContextValues.js +0 -20
- package/lib-amd/components/MenuList/useMenuListContextValues.js.map +0 -1
- package/lib-amd/components/MenuList/useMenuListStyles.js +0 -21
- package/lib-amd/components/MenuList/useMenuListStyles.js.map +0 -1
- package/lib-amd/components/MenuPopover/MenuPopover.js +0 -17
- package/lib-amd/components/MenuPopover/MenuPopover.js.map +0 -1
- package/lib-amd/components/MenuPopover/MenuPopover.types.js +0 -5
- package/lib-amd/components/MenuPopover/MenuPopover.types.js.map +0 -1
- package/lib-amd/components/MenuPopover/index.js +0 -10
- package/lib-amd/components/MenuPopover/index.js.map +0 -1
- package/lib-amd/components/MenuPopover/renderMenuPopover.js +0 -18
- package/lib-amd/components/MenuPopover/renderMenuPopover.js.map +0 -1
- package/lib-amd/components/MenuPopover/useMenuPopover.js +0 -83
- package/lib-amd/components/MenuPopover/useMenuPopover.js.map +0 -1
- package/lib-amd/components/MenuPopover/useMenuPopoverStyles.js +0 -21
- package/lib-amd/components/MenuPopover/useMenuPopoverStyles.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.js +0 -17
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.types.js +0 -5
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.types.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/index.js +0 -10
- package/lib-amd/components/MenuSplitGroup/index.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/renderMenuSplitGroup.js +0 -14
- package/lib-amd/components/MenuSplitGroup/renderMenuSplitGroup.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroup.js +0 -47
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroup.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroupStyles.js +0 -43
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +0 -1
- package/lib-amd/components/MenuTrigger/MenuTrigger.js +0 -18
- package/lib-amd/components/MenuTrigger/MenuTrigger.js.map +0 -1
- package/lib-amd/components/MenuTrigger/MenuTrigger.types.js +0 -5
- package/lib-amd/components/MenuTrigger/MenuTrigger.types.js.map +0 -1
- package/lib-amd/components/MenuTrigger/index.js +0 -9
- package/lib-amd/components/MenuTrigger/index.js.map +0 -1
- package/lib-amd/components/MenuTrigger/renderMenuTrigger.js +0 -15
- package/lib-amd/components/MenuTrigger/renderMenuTrigger.js.map +0 -1
- package/lib-amd/components/MenuTrigger/useMenuTrigger.js +0 -112
- package/lib-amd/components/MenuTrigger/useMenuTrigger.js.map +0 -1
- package/lib-amd/components/index.js +0 -7
- package/lib-amd/components/index.js.map +0 -1
- package/lib-amd/contexts/menuContext.js +0 -32
- package/lib-amd/contexts/menuContext.js.map +0 -1
- package/lib-amd/contexts/menuGroupContext.js +0 -13
- package/lib-amd/contexts/menuGroupContext.js.map +0 -1
- package/lib-amd/contexts/menuListContext.js +0 -23
- package/lib-amd/contexts/menuListContext.js.map +0 -1
- package/lib-amd/contexts/menuTriggerContext.js +0 -14
- package/lib-amd/contexts/menuTriggerContext.js.map +0 -1
- package/lib-amd/index.js +0 -69
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/selectable/index.js +0 -7
- package/lib-amd/selectable/index.js.map +0 -1
- package/lib-amd/selectable/types.js +0 -5
- package/lib-amd/selectable/types.js.map +0 -1
- package/lib-amd/selectable/useCheckmarkStyles.js +0 -28
- package/lib-amd/selectable/useCheckmarkStyles.js.map +0 -1
- package/lib-amd/utils/index.js +0 -6
- package/lib-amd/utils/index.js.map +0 -1
- package/lib-amd/utils/useIsSubmenu.js +0 -20
- package/lib-amd/utils/useIsSubmenu.js.map +0 -1
- package/lib-amd/utils/useOnMenuEnter.js +0 -59
- package/lib-amd/utils/useOnMenuEnter.js.map +0 -1
@@ -1,224 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "react", "@fluentui/react-positioning", "@fluentui/react-utilities", "@fluentui/react-shared-contexts", "@fluentui/react-portal", "@fluentui/react-tabster", "../../contexts/menuContext", "../../utils/index", "../../utils/useIsSubmenu"], function (require, exports, tslib_1, React, react_positioning_1, react_utilities_1, react_shared_contexts_1, react_portal_1, react_tabster_1, menuContext_1, index_1, useIsSubmenu_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useMenu_unstable = void 0;
|
5
|
-
// If it's not possible to position the submenu in smaller viewports, try
|
6
|
-
// and fallback to this order of positions
|
7
|
-
var submenuFallbackPositions = [
|
8
|
-
'after',
|
9
|
-
'after-bottom',
|
10
|
-
'before-top',
|
11
|
-
'before',
|
12
|
-
'before-bottom',
|
13
|
-
'above',
|
14
|
-
];
|
15
|
-
/**
|
16
|
-
* Create the state required to render Menu.
|
17
|
-
*
|
18
|
-
* The returned state can be modified with hooks such as useMenuStyles,
|
19
|
-
* before being passed to renderMenu_unstable.
|
20
|
-
*
|
21
|
-
* @param props - props from this instance of Menu
|
22
|
-
*/
|
23
|
-
var useMenu_unstable = function (props) {
|
24
|
-
var isSubmenu = useIsSubmenu_1.useIsSubmenu();
|
25
|
-
var _a = props.hoverDelay, hoverDelay = _a === void 0 ? 500 : _a, _b = props.inline, inline = _b === void 0 ? false : _b, _c = props.hasCheckmarks, hasCheckmarks = _c === void 0 ? false : _c, _d = props.hasIcons, hasIcons = _d === void 0 ? false : _d, _e = props.closeOnScroll, closeOnScroll = _e === void 0 ? false : _e, _f = props.openOnContext, openOnContext = _f === void 0 ? false : _f, _g = props.persistOnItemClick, persistOnItemClick = _g === void 0 ? false : _g, _h = props.openOnHover, openOnHover = _h === void 0 ? isSubmenu : _h, defaultCheckedValues = props.defaultCheckedValues, _j = props.mountNode, mountNode = _j === void 0 ? null : _j;
|
26
|
-
var triggerId = react_utilities_1.useId('menu');
|
27
|
-
var _k = react_positioning_1.usePositioningMouseTarget(), contextTarget = _k[0], setContextTarget = _k[1];
|
28
|
-
var positioningState = tslib_1.__assign({ position: isSubmenu ? 'after' : 'below', align: isSubmenu ? 'top' : 'start', target: props.openOnContext ? contextTarget : undefined, fallbackPositions: isSubmenu ? submenuFallbackPositions : undefined }, react_positioning_1.resolvePositioningShorthand(props.positioning));
|
29
|
-
var children = React.Children.toArray(props.children);
|
30
|
-
if (process.env.NODE_ENV !== 'production') {
|
31
|
-
if (children.length === 0) {
|
32
|
-
// eslint-disable-next-line no-console
|
33
|
-
console.warn('Menu must contain at least one child');
|
34
|
-
}
|
35
|
-
if (children.length > 2) {
|
36
|
-
// eslint-disable-next-line no-console
|
37
|
-
console.warn('Menu must contain at most two children');
|
38
|
-
}
|
39
|
-
}
|
40
|
-
var menuTrigger = undefined;
|
41
|
-
var menuPopover = undefined;
|
42
|
-
if (children.length === 2) {
|
43
|
-
menuTrigger = children[0];
|
44
|
-
menuPopover = children[1];
|
45
|
-
}
|
46
|
-
else if (children.length === 1) {
|
47
|
-
menuPopover = children[0];
|
48
|
-
}
|
49
|
-
var _l = react_positioning_1.usePositioning(positioningState), triggerRef = _l.targetRef, menuPopoverRef = _l.containerRef;
|
50
|
-
// TODO Better way to narrow types ?
|
51
|
-
var _m = useMenuOpenState({
|
52
|
-
hoverDelay: hoverDelay,
|
53
|
-
isSubmenu: isSubmenu,
|
54
|
-
setContextTarget: setContextTarget,
|
55
|
-
closeOnScroll: closeOnScroll,
|
56
|
-
menuPopoverRef: menuPopoverRef,
|
57
|
-
triggerRef: triggerRef,
|
58
|
-
open: props.open,
|
59
|
-
defaultOpen: props.defaultOpen,
|
60
|
-
onOpenChange: props.onOpenChange,
|
61
|
-
openOnContext: openOnContext,
|
62
|
-
}), open = _m[0], setOpen = _m[1];
|
63
|
-
var _o = useMenuSelectableState({
|
64
|
-
checkedValues: props.checkedValues,
|
65
|
-
defaultCheckedValues: defaultCheckedValues,
|
66
|
-
onCheckedValueChange: props.onCheckedValueChange,
|
67
|
-
}), checkedValues = _o[0], onCheckedValueChange = _o[1];
|
68
|
-
return {
|
69
|
-
inline: inline,
|
70
|
-
hoverDelay: hoverDelay,
|
71
|
-
triggerId: triggerId,
|
72
|
-
isSubmenu: isSubmenu,
|
73
|
-
openOnHover: openOnHover,
|
74
|
-
contextTarget: contextTarget,
|
75
|
-
setContextTarget: setContextTarget,
|
76
|
-
hasCheckmarks: hasCheckmarks,
|
77
|
-
hasIcons: hasIcons,
|
78
|
-
closeOnScroll: closeOnScroll,
|
79
|
-
menuTrigger: menuTrigger,
|
80
|
-
menuPopover: menuPopover,
|
81
|
-
mountNode: mountNode,
|
82
|
-
triggerRef: triggerRef,
|
83
|
-
menuPopoverRef: menuPopoverRef,
|
84
|
-
components: {},
|
85
|
-
openOnContext: openOnContext,
|
86
|
-
open: open,
|
87
|
-
setOpen: setOpen,
|
88
|
-
checkedValues: checkedValues,
|
89
|
-
onCheckedValueChange: onCheckedValueChange,
|
90
|
-
persistOnItemClick: persistOnItemClick,
|
91
|
-
};
|
92
|
-
};
|
93
|
-
exports.useMenu_unstable = useMenu_unstable;
|
94
|
-
/**
|
95
|
-
* Adds appropriate state values and handlers for selectable items
|
96
|
-
* i.e checkboxes and radios
|
97
|
-
*/
|
98
|
-
var useMenuSelectableState = function (props) {
|
99
|
-
var _a = react_utilities_1.useControllableState({
|
100
|
-
state: props.checkedValues,
|
101
|
-
defaultState: props.defaultCheckedValues,
|
102
|
-
initialState: {},
|
103
|
-
}), checkedValues = _a[0], setCheckedValues = _a[1];
|
104
|
-
var onCheckedValueChange = react_utilities_1.useEventCallback(function (e, _a) {
|
105
|
-
var _b;
|
106
|
-
var name = _a.name, checkedItems = _a.checkedItems;
|
107
|
-
(_b = props.onCheckedValueChange) === null || _b === void 0 ? void 0 : _b.call(props, e, { name: name, checkedItems: checkedItems });
|
108
|
-
setCheckedValues(function (currentValue) {
|
109
|
-
var _a;
|
110
|
-
return (tslib_1.__assign(tslib_1.__assign({}, currentValue), (_a = {}, _a[name] = checkedItems, _a)));
|
111
|
-
});
|
112
|
-
});
|
113
|
-
return [checkedValues, onCheckedValueChange];
|
114
|
-
};
|
115
|
-
var useMenuOpenState = function (state) {
|
116
|
-
var targetDocument = react_shared_contexts_1.useFluent_unstable().targetDocument;
|
117
|
-
var parentSetOpen = menuContext_1.useMenuContext_unstable(function (context) { return context.setOpen; });
|
118
|
-
var onOpenChange = react_utilities_1.useEventCallback(function (e, data) { var _a; return (_a = state.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(state, e, data); });
|
119
|
-
var shouldHandleCloseRef = React.useRef(false);
|
120
|
-
var setOpenTimeout = React.useRef(0);
|
121
|
-
var enteringTriggerRef = React.useRef(false);
|
122
|
-
var _a = react_utilities_1.useControllableState({
|
123
|
-
state: state.open,
|
124
|
-
defaultState: state.defaultOpen,
|
125
|
-
initialState: false,
|
126
|
-
}), open = _a[0], setOpenState = _a[1];
|
127
|
-
var trySetOpen = react_utilities_1.useEventCallback(function (e, data) {
|
128
|
-
var event = e instanceof CustomEvent && e.type === index_1.MENU_ENTER_EVENT ? e.detail.nativeEvent : e;
|
129
|
-
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(event, tslib_1.__assign({}, data));
|
130
|
-
if (data.open && e.type === 'contextmenu') {
|
131
|
-
state.setContextTarget(e);
|
132
|
-
}
|
133
|
-
if (!data.open) {
|
134
|
-
state.setContextTarget(undefined);
|
135
|
-
shouldHandleCloseRef.current = true;
|
136
|
-
}
|
137
|
-
if (data.bubble) {
|
138
|
-
parentSetOpen(e, tslib_1.__assign({}, data));
|
139
|
-
}
|
140
|
-
setOpenState(data.open);
|
141
|
-
});
|
142
|
-
var setOpen = react_utilities_1.useEventCallback(function (e, data) {
|
143
|
-
var _a;
|
144
|
-
clearTimeout(setOpenTimeout.current);
|
145
|
-
if (!(e instanceof Event) && e.persist) {
|
146
|
-
// < React 17 still uses pooled synthetic events
|
147
|
-
e.persist();
|
148
|
-
}
|
149
|
-
if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === index_1.MENU_ENTER_EVENT) {
|
150
|
-
if ((_a = state.triggerRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
|
151
|
-
enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';
|
152
|
-
}
|
153
|
-
// FIXME leaking Node timeout type
|
154
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
155
|
-
// @ts-ignore
|
156
|
-
setOpenTimeout.current = setTimeout(function () { return trySetOpen(e, data); }, state.hoverDelay);
|
157
|
-
}
|
158
|
-
else {
|
159
|
-
trySetOpen(e, data);
|
160
|
-
}
|
161
|
-
});
|
162
|
-
react_utilities_1.useOnClickOutside({
|
163
|
-
contains: react_portal_1.elementContains,
|
164
|
-
disabled: !open,
|
165
|
-
element: targetDocument,
|
166
|
-
refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(Boolean),
|
167
|
-
callback: function (event) { return setOpen(event, { open: false, type: 'clickOutside', event: event }); },
|
168
|
-
});
|
169
|
-
// only close on scroll for context, or when closeOnScroll is specified
|
170
|
-
var closeOnScroll = state.openOnContext || state.closeOnScroll;
|
171
|
-
react_utilities_1.useOnScrollOutside({
|
172
|
-
contains: react_portal_1.elementContains,
|
173
|
-
element: targetDocument,
|
174
|
-
callback: function (event) { return setOpen(event, { open: false, type: 'scrollOutside', event: event }); },
|
175
|
-
refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(Boolean),
|
176
|
-
disabled: !open || !closeOnScroll,
|
177
|
-
});
|
178
|
-
index_1.useOnMenuMouseEnter({
|
179
|
-
element: targetDocument,
|
180
|
-
callback: function (event) {
|
181
|
-
// When moving from a menu directly back to its trigger, this handler can close the menu
|
182
|
-
// Explicitly check a flag to see if this situation happens
|
183
|
-
if (!enteringTriggerRef.current) {
|
184
|
-
setOpen(event, { open: false, type: 'menuMouseEnter', event: event });
|
185
|
-
}
|
186
|
-
},
|
187
|
-
disabled: !open,
|
188
|
-
refs: [state.menuPopoverRef],
|
189
|
-
});
|
190
|
-
// Clear timeout on unmount
|
191
|
-
// Setting state after a component unmounts can cause memory leaks
|
192
|
-
React.useEffect(function () {
|
193
|
-
return function () {
|
194
|
-
clearTimeout(setOpenTimeout.current);
|
195
|
-
};
|
196
|
-
}, []);
|
197
|
-
// Manage focus for open state
|
198
|
-
var findFirstFocusable = react_tabster_1.useFocusFinders().findFirstFocusable;
|
199
|
-
var focusFirst = React.useCallback(function () {
|
200
|
-
var firstFocusable = findFirstFocusable(state.menuPopoverRef.current);
|
201
|
-
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
202
|
-
}, [findFirstFocusable, state.menuPopoverRef]);
|
203
|
-
React.useEffect(function () {
|
204
|
-
var _a;
|
205
|
-
if (open) {
|
206
|
-
focusFirst();
|
207
|
-
}
|
208
|
-
else {
|
209
|
-
if (shouldHandleCloseRef.current) {
|
210
|
-
// We know that React effects are sync so we focus the trigger here
|
211
|
-
// after any event handler (event handlers will update state and re-render).
|
212
|
-
// Since the browser only performs the default behaviour for the Tab key once
|
213
|
-
// keyboard events have fully bubbled up the window, the browser will move
|
214
|
-
// focus to the next tabbable element before/after the trigger if needed.
|
215
|
-
// If the Tab key was not pressed, focus will remain on the trigger as expected.
|
216
|
-
(_a = state.triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
217
|
-
}
|
218
|
-
}
|
219
|
-
shouldHandleCloseRef.current = false;
|
220
|
-
}, [state.triggerRef, state.isSubmenu, open, focusFirst]);
|
221
|
-
return [open, setOpen];
|
222
|
-
};
|
223
|
-
});
|
224
|
-
//# sourceMappingURL=useMenu.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useMenu.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/Menu/useMenu.tsx"],"names":[],"mappings":";;;;IAsBA,yEAAyE;IACzE,0CAA0C;IAC1C,IAAM,wBAAwB,GAAgC;QAC5D,OAAO;QACP,cAAc;QACd,YAAY;QACZ,QAAQ;QACR,eAAe;QACf,OAAO;KACR,CAAC;IAEF;;;;;;;OAOG;IACI,IAAM,gBAAgB,GAAG,UAAC,KAAgB;QAC/C,IAAM,SAAS,GAAG,2BAAY,EAAE,CAAC;QAE/B,IAAA,KAUE,KAAK,WAVS,EAAhB,UAAU,mBAAG,GAAG,KAAA,EAChB,KASE,KAAK,OATO,EAAd,MAAM,mBAAG,KAAK,KAAA,EACd,KAQE,KAAK,cARc,EAArB,aAAa,mBAAG,KAAK,KAAA,EACrB,KAOE,KAAK,SAPS,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,KAME,KAAK,cANc,EAArB,aAA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CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACxE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,EAAE,CAAC;QAC1B,CAAC,EAAE,CAAC,kBAAkB,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;QAE/C,KAAK,CAAC,SAAS,CAAC;;YACd,IAAI,IAAI,EAAE;gBACR,UAAU,EAAE,CAAC;aACd;iBAAM;gBACL,IAAI,oBAAoB,CAAC,OAAO,EAAE;oBAChC,mEAAmE;oBACnE,4EAA4E;oBAC5E,6EAA6E;oBAC7E,0EAA0E;oBAC1E,yEAAyE;oBACzE,gFAAgF;oBAChF,MAAA,KAAK,CAAC,UAAU,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;iBACnC;aACF;YAED,oBAAoB,CAAC,OAAO,GAAG,KAAK,CAAC;QACvC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;QAE1D,OAAO,CAAC,IAAI,EAAE,OAAO,CAAU,CAAC;IAClC,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport {\n usePositioningMouseTarget,\n usePositioning,\n resolvePositioningShorthand,\n PositioningShorthandValue,\n} from '@fluentui/react-positioning';\nimport {\n useControllableState,\n useId,\n useOnClickOutside,\n useEventCallback,\n useOnScrollOutside,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { elementContains } from '@fluentui/react-portal';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MENU_ENTER_EVENT, useOnMenuMouseEnter } from '../../utils/index';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport type { MenuOpenChangeData, MenuOpenEvent, MenuProps, MenuState } from './Menu.types';\n\n// If it's not possible to position the submenu in smaller viewports, try\n// and fallback to this order of positions\nconst submenuFallbackPositions: PositioningShorthandValue[] = [\n 'after',\n 'after-bottom',\n 'before-top',\n 'before',\n 'before-bottom',\n 'above',\n];\n\n/**\n * Create the state required to render Menu.\n *\n * The returned state can be modified with hooks such as useMenuStyles,\n * before being passed to renderMenu_unstable.\n *\n * @param props - props from this instance of Menu\n */\nexport const useMenu_unstable = (props: MenuProps): MenuState => {\n const isSubmenu = useIsSubmenu();\n const {\n hoverDelay = 500,\n inline = false,\n hasCheckmarks = false,\n hasIcons = false,\n closeOnScroll = false,\n openOnContext = false,\n persistOnItemClick = false,\n openOnHover = isSubmenu,\n defaultCheckedValues,\n mountNode = null,\n } = props;\n const triggerId = useId('menu');\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n\n const positioningState = {\n position: isSubmenu ? 'after' : 'below',\n align: isSubmenu ? 'top' : 'start',\n target: props.openOnContext ? contextTarget : undefined,\n fallbackPositions: isSubmenu ? submenuFallbackPositions : undefined,\n ...resolvePositioningShorthand(props.positioning),\n } as const;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n if (process.env.NODE_ENV !== 'production') {\n if (children.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at least one child');\n }\n\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at most two children');\n }\n }\n\n let menuTrigger: React.ReactElement | undefined = undefined;\n let menuPopover: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n menuTrigger = children[0];\n menuPopover = children[1];\n } else if (children.length === 1) {\n menuPopover = children[0];\n }\n\n const { targetRef: triggerRef, containerRef: menuPopoverRef } = usePositioning(positioningState);\n\n // TODO Better way to narrow types ?\n const [open, setOpen] = useMenuOpenState({\n hoverDelay,\n isSubmenu,\n setContextTarget,\n closeOnScroll,\n menuPopoverRef,\n triggerRef,\n open: props.open,\n defaultOpen: props.defaultOpen,\n onOpenChange: props.onOpenChange,\n openOnContext,\n });\n\n const [checkedValues, onCheckedValueChange] = useMenuSelectableState({\n checkedValues: props.checkedValues,\n defaultCheckedValues,\n onCheckedValueChange: props.onCheckedValueChange,\n });\n\n return {\n inline,\n hoverDelay,\n triggerId,\n isSubmenu,\n openOnHover,\n contextTarget,\n setContextTarget,\n hasCheckmarks,\n hasIcons,\n closeOnScroll,\n menuTrigger,\n menuPopover,\n mountNode,\n triggerRef,\n menuPopoverRef,\n components: {},\n openOnContext,\n open,\n setOpen,\n checkedValues,\n onCheckedValueChange,\n persistOnItemClick,\n };\n};\n\n/**\n * Adds appropriate state values and handlers for selectable items\n * i.e checkboxes and radios\n */\nconst useMenuSelectableState = (\n props: Pick<MenuProps, 'checkedValues' | 'defaultCheckedValues' | 'onCheckedValueChange'>,\n) => {\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues,\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n const onCheckedValueChange: MenuState['onCheckedValueChange'] = useEventCallback((e, { name, checkedItems }) => {\n props.onCheckedValueChange?.(e, { name, checkedItems });\n\n setCheckedValues(currentValue => ({\n ...currentValue,\n [name]: checkedItems,\n }));\n });\n\n return [checkedValues, onCheckedValueChange] as const;\n};\n\nconst useMenuOpenState = (\n state: Pick<\n MenuState,\n | 'isSubmenu'\n | 'menuPopoverRef'\n | 'setContextTarget'\n | 'triggerRef'\n | 'openOnContext'\n | 'closeOnScroll'\n | 'hoverDelay'\n > &\n Pick<MenuProps, 'open' | 'defaultOpen' | 'onOpenChange'>,\n) => {\n const { targetDocument } = useFluent();\n const parentSetOpen = useMenuContext_unstable(context => context.setOpen);\n const onOpenChange: MenuProps['onOpenChange'] = useEventCallback((e, data) => state.onOpenChange?.(e, data));\n\n const shouldHandleCloseRef = React.useRef(false);\n const setOpenTimeout = React.useRef(0);\n const enteringTriggerRef = React.useRef(false);\n\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false,\n });\n\n const trySetOpen = useEventCallback((e: MenuOpenEvent, data: MenuOpenChangeData) => {\n const event = e instanceof CustomEvent && e.type === MENU_ENTER_EVENT ? e.detail.nativeEvent : e;\n onOpenChange?.(event, { ...data });\n if (data.open && e.type === 'contextmenu') {\n state.setContextTarget(e as React.MouseEvent);\n }\n\n if (!data.open) {\n state.setContextTarget(undefined);\n shouldHandleCloseRef.current = true;\n }\n\n if (data.bubble) {\n parentSetOpen(e, { ...data });\n }\n\n setOpenState(data.open);\n });\n\n const setOpen = useEventCallback((e: MenuOpenEvent, data: MenuOpenChangeData) => {\n clearTimeout(setOpenTimeout.current);\n if (!(e instanceof Event) && e.persist) {\n // < React 17 still uses pooled synthetic events\n e.persist();\n }\n\n if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === MENU_ENTER_EVENT) {\n if (state.triggerRef.current?.contains(e.target as HTMLElement)) {\n enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';\n }\n\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeout.current = setTimeout(() => trySetOpen(e, data), state.hoverDelay);\n } else {\n trySetOpen(e, data);\n }\n });\n\n useOnClickOutside({\n contains: elementContains,\n disabled: !open,\n element: targetDocument,\n refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(\n Boolean,\n ) as React.MutableRefObject<HTMLElement>[],\n callback: event => setOpen(event, { open: false, type: 'clickOutside', event }),\n });\n\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = state.openOnContext || state.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: event => setOpen(event, { open: false, type: 'scrollOutside', event }),\n refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(\n Boolean,\n ) as React.MutableRefObject<HTMLElement>[],\n disabled: !open || !closeOnScroll,\n });\n\n useOnMenuMouseEnter({\n element: targetDocument,\n callback: event => {\n // When moving from a menu directly back to its trigger, this handler can close the menu\n // Explicitly check a flag to see if this situation happens\n if (!enteringTriggerRef.current) {\n setOpen(event, { open: false, type: 'menuMouseEnter', event });\n }\n },\n disabled: !open,\n refs: [state.menuPopoverRef],\n });\n\n // Clear timeout on unmount\n // Setting state after a component unmounts can cause memory leaks\n React.useEffect(() => {\n return () => {\n clearTimeout(setOpenTimeout.current);\n };\n }, []);\n\n // Manage focus for open state\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(() => {\n const firstFocusable = findFirstFocusable(state.menuPopoverRef.current);\n firstFocusable?.focus();\n }, [findFirstFocusable, state.menuPopoverRef]);\n\n React.useEffect(() => {\n if (open) {\n focusFirst();\n } else {\n if (shouldHandleCloseRef.current) {\n // We know that React effects are sync so we focus the trigger here\n // after any event handler (event handlers will update state and re-render).\n // Since the browser only performs the default behaviour for the Tab key once\n // keyboard events have fully bubbled up the window, the browser will move\n // focus to the next tabbable element before/after the trigger if needed.\n // If the Tab key was not pressed, focus will remain on the trigger as expected.\n state.triggerRef.current?.focus();\n }\n }\n\n shouldHandleCloseRef.current = false;\n }, [state.triggerRef, state.isSubmenu, open, focusFirst]);\n\n return [open, setOpen] as const;\n};\n"]}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
define(["require", "exports"], function (require, exports) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useMenuContextValues_unstable = void 0;
|
5
|
-
function useMenuContextValues_unstable(state) {
|
6
|
-
var checkedValues = state.checkedValues, hasCheckmarks = state.hasCheckmarks, hasIcons = state.hasIcons, inline = state.inline, isSubmenu = state.isSubmenu, menuPopoverRef = state.menuPopoverRef, mountNode = state.mountNode, onCheckedValueChange = state.onCheckedValueChange, open = state.open, openOnContext = state.openOnContext, openOnHover = state.openOnHover, persistOnItemClick = state.persistOnItemClick, setOpen = state.setOpen, triggerId = state.triggerId, triggerRef = state.triggerRef;
|
7
|
-
// This context is created with "@fluentui/react-context-selector", these is no sense to memoize it
|
8
|
-
var menu = {
|
9
|
-
checkedValues: checkedValues,
|
10
|
-
hasCheckmarks: hasCheckmarks,
|
11
|
-
hasIcons: hasIcons,
|
12
|
-
inline: inline,
|
13
|
-
isSubmenu: isSubmenu,
|
14
|
-
menuPopoverRef: menuPopoverRef,
|
15
|
-
mountNode: mountNode,
|
16
|
-
onCheckedValueChange: onCheckedValueChange,
|
17
|
-
open: open,
|
18
|
-
openOnContext: openOnContext,
|
19
|
-
openOnHover: openOnHover,
|
20
|
-
persistOnItemClick: persistOnItemClick,
|
21
|
-
setOpen: setOpen,
|
22
|
-
triggerId: triggerId,
|
23
|
-
triggerRef: triggerRef,
|
24
|
-
};
|
25
|
-
return { menu: menu };
|
26
|
-
}
|
27
|
-
exports.useMenuContextValues_unstable = useMenuContextValues_unstable;
|
28
|
-
});
|
29
|
-
//# sourceMappingURL=useMenuContextValues.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useMenuContextValues.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/Menu/useMenuContextValues.ts"],"names":[],"mappings":";;;;IAEA,SAAgB,6BAA6B,CAAC,KAAgB;QAE1D,IAAA,aAAa,GAeX,KAAK,cAfM,EACb,aAAa,GAcX,KAAK,cAdM,EACb,QAAQ,GAaN,KAAK,SAbC,EACR,MAAM,GAYJ,KAAK,OAZD,EACN,SAAS,GAWP,KAAK,UAXE,EACT,cAAc,GAUZ,KAAK,eAVO,EACd,SAAS,GASP,KAAK,UATE,EACT,oBAAoB,GAQlB,KAAK,qBARa,EACpB,IAAI,GAOF,KAAK,KAPH,EACJ,aAAa,GAMX,KAAK,cANM,EACb,WAAW,GAKT,KAAK,YALI,EACX,kBAAkB,GAIhB,KAAK,mBAJW,EAClB,OAAO,GAGL,KAAK,QAHA,EACP,SAAS,GAEP,KAAK,UAFE,EACT,UAAU,GACR,KAAK,WADG,CACF;QAEV,mGAAmG;QACnG,IAAM,IAAI,GAAG;YACX,aAAa,eAAA;YACb,aAAa,eAAA;YACb,QAAQ,UAAA;YACR,MAAM,QAAA;YACN,SAAS,WAAA;YACT,cAAc,gBAAA;YACd,SAAS,WAAA;YACT,oBAAoB,sBAAA;YACpB,IAAI,MAAA;YACJ,aAAa,eAAA;YACb,WAAW,aAAA;YACX,kBAAkB,oBAAA;YAClB,OAAO,SAAA;YACP,SAAS,WAAA;YACT,UAAU,YAAA;SACX,CAAC;QAEF,OAAO,EAAE,IAAI,MAAA,EAAE,CAAC;IAClB,CAAC;IAvCD,sEAuCC","sourcesContent":["import type { MenuContextValues, MenuState } from './Menu.types';\n\nexport function useMenuContextValues_unstable(state: MenuState): MenuContextValues {\n const {\n checkedValues,\n hasCheckmarks,\n hasIcons,\n inline,\n isSubmenu,\n menuPopoverRef,\n mountNode,\n onCheckedValueChange,\n open,\n openOnContext,\n openOnHover,\n persistOnItemClick,\n setOpen,\n triggerId,\n triggerRef,\n } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", these is no sense to memoize it\n const menu = {\n checkedValues,\n hasCheckmarks,\n hasIcons,\n inline,\n isSubmenu,\n menuPopoverRef,\n mountNode,\n onCheckedValueChange,\n open,\n openOnContext,\n openOnHover,\n persistOnItemClick,\n setOpen,\n triggerId,\n triggerRef,\n };\n\n return { menu };\n}\n"]}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
define(["require", "exports", "react", "./useMenuDivider", "./useMenuDividerStyles", "./renderMenuDivider", "@fluentui/react-shared-contexts"], function (require, exports, React, useMenuDivider_1, useMenuDividerStyles_1, renderMenuDivider_1, react_shared_contexts_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.MenuDivider = void 0;
|
5
|
-
/**
|
6
|
-
* Define a styled MenuDivider, using the `useMenuDivider_unstable` hook.
|
7
|
-
*/
|
8
|
-
exports.MenuDivider = React.forwardRef(function (props, ref) {
|
9
|
-
var state = useMenuDivider_1.useMenuDivider_unstable(props, ref);
|
10
|
-
useMenuDividerStyles_1.useMenuDividerStyles_unstable(state);
|
11
|
-
var useCustomStyles = react_shared_contexts_1.useCustomStyleHooks_unstable().useMenuDividerStyles_unstable;
|
12
|
-
useCustomStyles(state);
|
13
|
-
return renderMenuDivider_1.renderMenuDivider_unstable(state);
|
14
|
-
});
|
15
|
-
exports.MenuDivider.displayName = 'MenuDivider';
|
16
|
-
});
|
17
|
-
//# sourceMappingURL=MenuDivider.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MenuDivider.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuDivider/MenuDivider.tsx"],"names":[],"mappings":";;;;IAQA;;OAEG;IACU,QAAA,WAAW,GAA0C,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAC5F,IAAM,KAAK,GAAG,wCAAuB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAElD,oDAA6B,CAAC,KAAK,CAAC,CAAC;QAE7B,IAA+B,eAAe,GAAK,oDAA4B,EAAE,8BAAnC,CAAoC;QAC1F,eAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,8CAA0B,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import * as React from 'react';\nimport { useMenuDivider_unstable } from './useMenuDivider';\nimport { useMenuDividerStyles_unstable } from './useMenuDividerStyles';\nimport { renderMenuDivider_unstable } from './renderMenuDivider';\nimport type { MenuDividerProps } from './MenuDivider.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Define a styled MenuDivider, using the `useMenuDivider_unstable` hook.\n */\nexport const MenuDivider: ForwardRefComponent<MenuDividerProps> = React.forwardRef((props, ref) => {\n const state = useMenuDivider_unstable(props, ref);\n\n useMenuDividerStyles_unstable(state);\n\n const { useMenuDividerStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderMenuDivider_unstable(state);\n});\n\nMenuDivider.displayName = 'MenuDivider';\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MenuDivider.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuDivider/MenuDivider.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type MenuDividerSlots = {\n root: Slot<'div'>;\n};\n\nexport type MenuDividerProps = ComponentProps<MenuDividerSlots>;\n\nexport type MenuDividerState = ComponentState<MenuDividerSlots>;\n"]}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "./MenuDivider.types", "./MenuDivider", "./renderMenuDivider", "./useMenuDivider", "./useMenuDividerStyles"], function (require, exports, tslib_1, MenuDivider_types_1, MenuDivider_1, renderMenuDivider_1, useMenuDivider_1, useMenuDividerStyles_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
tslib_1.__exportStar(MenuDivider_types_1, exports);
|
5
|
-
tslib_1.__exportStar(MenuDivider_1, exports);
|
6
|
-
tslib_1.__exportStar(renderMenuDivider_1, exports);
|
7
|
-
tslib_1.__exportStar(useMenuDivider_1, exports);
|
8
|
-
tslib_1.__exportStar(useMenuDividerStyles_1, exports);
|
9
|
-
});
|
10
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuDivider/index.ts"],"names":[],"mappings":";;;IAAA,mDAAoC;IACpC,6CAA8B;IAC9B,mDAAoC;IACpC,gDAAiC;IACjC,sDAAuC","sourcesContent":["export * from './MenuDivider.types';\nexport * from './MenuDivider';\nexport * from './renderMenuDivider';\nexport * from './useMenuDivider';\nexport * from './useMenuDividerStyles';\n"]}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.renderMenuDivider_unstable = void 0;
|
5
|
-
/**
|
6
|
-
* Redefine the render function to add slots. Reuse the menudivider structure but add
|
7
|
-
* slots to children.
|
8
|
-
*/
|
9
|
-
var renderMenuDivider_unstable = function (state) {
|
10
|
-
var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
|
11
|
-
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root));
|
12
|
-
};
|
13
|
-
exports.renderMenuDivider_unstable = renderMenuDivider_unstable;
|
14
|
-
});
|
15
|
-
//# sourceMappingURL=renderMenuDivider.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"renderMenuDivider.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuDivider/renderMenuDivider.tsx"],"names":[],"mappings":";;;;IAIA;;;OAGG;IACI,IAAM,0BAA0B,GAAG,UAAC,KAAuB;QAC1D,IAAA,KAAuB,0BAAQ,CAAmB,KAAK,CAAC,EAAtD,KAAK,WAAA,EAAE,SAAS,eAAsC,CAAC;QAE/D,OAAO,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CAAC;IAC5C,CAAC,CAAC;IAJW,QAAA,0BAA0B,8BAIrC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { MenuDividerSlots, MenuDividerState } from './MenuDivider.types';\n\n/**\n * Redefine the render function to add slots. Reuse the menudivider structure but add\n * slots to children.\n */\nexport const renderMenuDivider_unstable = (state: MenuDividerState) => {\n const { slots, slotProps } = getSlots<MenuDividerSlots>(state);\n\n return <slots.root {...slotProps.root} />;\n};\n"]}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "@fluentui/react-utilities"], function (require, exports, tslib_1, react_utilities_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useMenuDivider_unstable = void 0;
|
5
|
-
/**
|
6
|
-
* Given user props, returns state and render function for a MenuDivider.
|
7
|
-
*/
|
8
|
-
var useMenuDivider_unstable = function (props, ref) {
|
9
|
-
return {
|
10
|
-
components: {
|
11
|
-
root: 'div',
|
12
|
-
},
|
13
|
-
root: react_utilities_1.getNativeElementProps('div', tslib_1.__assign(tslib_1.__assign({ role: 'presentation', 'aria-hidden': true }, props), { ref: ref })),
|
14
|
-
};
|
15
|
-
};
|
16
|
-
exports.useMenuDivider_unstable = useMenuDivider_unstable;
|
17
|
-
});
|
18
|
-
//# sourceMappingURL=useMenuDivider.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useMenuDivider.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuDivider/useMenuDivider.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,uBAAuB,GAAG,UAAC,KAAuB,EAAE,GAA2B;QAC1F,OAAO;YACL,UAAU,EAAE;gBACV,IAAI,EAAE,KAAK;aACZ;YACD,IAAI,EAAE,uCAAqB,CAAC,KAAK,sCAC/B,IAAI,EAAE,cAAc,EACpB,aAAa,EAAE,IAAI,IAChB,KAAK,KACR,GAAG,KAAA,IACH;SACH,CAAC;IACJ,CAAC,CAAC;IAZW,QAAA,uBAAuB,2BAYlC","sourcesContent":["import { getNativeElementProps } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type { MenuDividerProps, MenuDividerState } from './MenuDivider.types';\n\n/**\n * Given user props, returns state and render function for a MenuDivider.\n */\nexport const useMenuDivider_unstable = (props: MenuDividerProps, ref: React.Ref<HTMLElement>): MenuDividerState => {\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n role: 'presentation',\n 'aria-hidden': true,\n ...props,\n ref,\n }),\n };\n};\n"]}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme"], function (require, exports, tslib_1, react_1, react_theme_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useMenuDividerStyles_unstable = exports.menuDividerClassNames = void 0;
|
5
|
-
exports.menuDividerClassNames = {
|
6
|
-
root: 'fui-MenuDivider',
|
7
|
-
};
|
8
|
-
var useStyles = react_1.makeStyles({
|
9
|
-
root: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.margin('4px', '-5px', '4px', '-5px')), { width: 'auto' }), react_1.shorthands.borderBottom(react_theme_1.tokens.strokeWidthThin, 'solid', react_theme_1.tokens.colorNeutralStroke2)),
|
10
|
-
});
|
11
|
-
var useMenuDividerStyles_unstable = function (state) {
|
12
|
-
var styles = useStyles();
|
13
|
-
state.root.className = react_1.mergeClasses(exports.menuDividerClassNames.root, styles.root, state.root.className);
|
14
|
-
return state;
|
15
|
-
};
|
16
|
-
exports.useMenuDividerStyles_unstable = useMenuDividerStyles_unstable;
|
17
|
-
});
|
18
|
-
//# sourceMappingURL=useMenuDividerStyles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useMenuDividerStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuDivider/useMenuDividerStyles.ts"],"names":[],"mappings":";;;;IAKa,QAAA,qBAAqB,GAAqC;QACrE,IAAI,EAAE,iBAAiB;KACxB,CAAC;IAEF,IAAM,SAAS,GAAG,kBAAU,CAAC;QAC3B,IAAI,yDACC,kBAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAClD,KAAK,EAAE,MAAM,KACV,kBAAU,CAAC,YAAY,CAAC,oBAAM,CAAC,eAAe,EAAE,OAAO,EAAE,oBAAM,CAAC,mBAAmB,CAAC,CACxF;KACF,CAAC,CAAC;IAEI,IAAM,6BAA6B,GAAG,UAAC,KAAuB;QACnE,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CAAC,6BAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEnG,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IALW,QAAA,6BAA6B,iCAKxC","sourcesContent":["import { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { MenuDividerSlots, MenuDividerState } from './MenuDivider.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const menuDividerClassNames: SlotClassNames<MenuDividerSlots> = {\n root: 'fui-MenuDivider',\n};\n\nconst useStyles = makeStyles({\n root: {\n ...shorthands.margin('4px', '-5px', '4px', '-5px'),\n width: 'auto',\n ...shorthands.borderBottom(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke2),\n },\n});\n\nexport const useMenuDividerStyles_unstable = (state: MenuDividerState) => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuDividerClassNames.root, styles.root, state.root.className);\n\n return state;\n};\n"]}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
define(["require", "exports", "react", "./useMenuGroup", "./renderMenuGroup", "./useMenuGroupContextValues", "./useMenuGroupStyles", "@fluentui/react-shared-contexts"], function (require, exports, React, useMenuGroup_1, renderMenuGroup_1, useMenuGroupContextValues_1, useMenuGroupStyles_1, react_shared_contexts_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.MenuGroup = void 0;
|
5
|
-
/**
|
6
|
-
* Define a styled MenuGroup, using the `useMenuGroup_unstable` hook.
|
7
|
-
*/
|
8
|
-
exports.MenuGroup = React.forwardRef(function (props, ref) {
|
9
|
-
var state = useMenuGroup_1.useMenuGroup_unstable(props, ref);
|
10
|
-
var contextValues = useMenuGroupContextValues_1.useMenuGroupContextValues_unstable(state);
|
11
|
-
useMenuGroupStyles_1.useMenuGroupStyles_unstable(state);
|
12
|
-
var useCustomStyles = react_shared_contexts_1.useCustomStyleHooks_unstable().useMenuGroupStyles_unstable;
|
13
|
-
useCustomStyles(state);
|
14
|
-
return renderMenuGroup_1.renderMenuGroup_unstable(state, contextValues);
|
15
|
-
});
|
16
|
-
exports.MenuGroup.displayName = 'MenuGroup';
|
17
|
-
});
|
18
|
-
//# sourceMappingURL=MenuGroup.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MenuGroup.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuGroup/MenuGroup.tsx"],"names":[],"mappings":";;;;IASA;;OAEG;IACU,QAAA,SAAS,GAAwC,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QACxF,IAAM,KAAK,GAAG,oCAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAChD,IAAM,aAAa,GAAG,8DAAkC,CAAC,KAAK,CAAC,CAAC;QAEhE,gDAA2B,CAAC,KAAK,CAAC,CAAC;QAE3B,IAA6B,eAAe,GAAK,oDAA4B,EAAE,4BAAnC,CAAoC;QACxF,eAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,0CAAwB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,iBAAS,CAAC,WAAW,GAAG,WAAW,CAAC","sourcesContent":["import * as React from 'react';\nimport { useMenuGroup_unstable } from './useMenuGroup';\nimport { renderMenuGroup_unstable } from './renderMenuGroup';\nimport { useMenuGroupContextValues_unstable } from './useMenuGroupContextValues';\nimport type { MenuGroupProps } from './MenuGroup.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useMenuGroupStyles_unstable } from './useMenuGroupStyles';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Define a styled MenuGroup, using the `useMenuGroup_unstable` hook.\n */\nexport const MenuGroup: ForwardRefComponent<MenuGroupProps> = React.forwardRef((props, ref) => {\n const state = useMenuGroup_unstable(props, ref);\n const contextValues = useMenuGroupContextValues_unstable(state);\n\n useMenuGroupStyles_unstable(state);\n\n const { useMenuGroupStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderMenuGroup_unstable(state, contextValues);\n});\n\nMenuGroup.displayName = 'MenuGroup';\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MenuGroup.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuGroup/MenuGroup.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { MenuGroupContextValue } from '../../contexts/menuGroupContext';\n\nexport type MenuGroupSlots = {\n root: Slot<'div'>;\n};\n\nexport type MenuGroupProps = ComponentProps<MenuGroupSlots>;\n\nexport type MenuGroupState = ComponentState<MenuGroupSlots> & {\n /**\n * id applied to the DOM element of `MenuGroupHeader`\n */\n headerId: string;\n};\n\nexport type MenuGroupContextValues = {\n menuGroup: MenuGroupContextValue;\n};\n"]}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "./MenuGroup.types", "./MenuGroup", "./renderMenuGroup", "./useMenuGroup", "./useMenuGroupContextValues", "./useMenuGroupStyles"], function (require, exports, tslib_1, MenuGroup_types_1, MenuGroup_1, renderMenuGroup_1, useMenuGroup_1, useMenuGroupContextValues_1, useMenuGroupStyles_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
tslib_1.__exportStar(MenuGroup_types_1, exports);
|
5
|
-
tslib_1.__exportStar(MenuGroup_1, exports);
|
6
|
-
tslib_1.__exportStar(renderMenuGroup_1, exports);
|
7
|
-
tslib_1.__exportStar(useMenuGroup_1, exports);
|
8
|
-
tslib_1.__exportStar(useMenuGroupContextValues_1, exports);
|
9
|
-
tslib_1.__exportStar(useMenuGroupStyles_1, exports);
|
10
|
-
});
|
11
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuGroup/index.ts"],"names":[],"mappings":";;;IAAA,iDAAkC;IAClC,2CAA4B;IAC5B,iDAAkC;IAClC,8CAA+B;IAC/B,2DAA4C;IAC5C,oDAAqC","sourcesContent":["export * from './MenuGroup.types';\nexport * from './MenuGroup';\nexport * from './renderMenuGroup';\nexport * from './useMenuGroup';\nexport * from './useMenuGroupContextValues';\nexport * from './useMenuGroupStyles';\n"]}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "../../contexts/menuGroupContext"], function (require, exports, tslib_1, React, react_utilities_1, menuGroupContext_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.renderMenuGroup_unstable = void 0;
|
5
|
-
/**
|
6
|
-
* Redefine the render function to add slots. Reuse the menugroup structure but add
|
7
|
-
* slots to children.
|
8
|
-
*/
|
9
|
-
var renderMenuGroup_unstable = function (state, contextValues) {
|
10
|
-
var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
|
11
|
-
return (React.createElement(menuGroupContext_1.MenuGroupContextProvider, { value: contextValues.menuGroup },
|
12
|
-
React.createElement(slots.root, tslib_1.__assign({}, slotProps.root))));
|
13
|
-
};
|
14
|
-
exports.renderMenuGroup_unstable = renderMenuGroup_unstable;
|
15
|
-
});
|
16
|
-
//# sourceMappingURL=renderMenuGroup.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"renderMenuGroup.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuGroup/renderMenuGroup.tsx"],"names":[],"mappings":";;;;IAKA;;;OAGG;IACI,IAAM,wBAAwB,GAAG,UAAC,KAAqB,EAAE,aAAqC;QAC7F,IAAA,KAAuB,0BAAQ,CAAiB,KAAK,CAAC,EAApD,KAAK,WAAA,EAAE,SAAS,eAAoC,CAAC;QAE7D,OAAO,CACL,oBAAC,2CAAwB,IAAC,KAAK,EAAE,aAAa,CAAC,SAAS;YACtD,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CACT,CAC5B,CAAC;IACJ,CAAC,CAAC;IARW,QAAA,wBAAwB,4BAQnC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { MenuGroupContextValues, MenuGroupSlots, MenuGroupState } from './MenuGroup.types';\nimport { MenuGroupContextProvider } from '../../contexts/menuGroupContext';\n\n/**\n * Redefine the render function to add slots. Reuse the menugroup structure but add\n * slots to children.\n */\nexport const renderMenuGroup_unstable = (state: MenuGroupState, contextValues: MenuGroupContextValues) => {\n const { slots, slotProps } = getSlots<MenuGroupSlots>(state);\n\n return (\n <MenuGroupContextProvider value={contextValues.menuGroup}>\n <slots.root {...slotProps.root} />\n </MenuGroupContextProvider>\n );\n};\n"]}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "@fluentui/react-utilities"], function (require, exports, tslib_1, react_utilities_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useMenuGroup_unstable = void 0;
|
5
|
-
/**
|
6
|
-
* Given user props, returns state and render function for a MenuGroup.
|
7
|
-
*/
|
8
|
-
function useMenuGroup_unstable(props, ref) {
|
9
|
-
var headerId = react_utilities_1.useId('menu-group');
|
10
|
-
return {
|
11
|
-
components: {
|
12
|
-
root: 'div',
|
13
|
-
},
|
14
|
-
root: react_utilities_1.getNativeElementProps('div', tslib_1.__assign({ ref: ref, 'aria-labelledby': headerId, role: 'group' }, props)),
|
15
|
-
headerId: headerId,
|
16
|
-
};
|
17
|
-
}
|
18
|
-
exports.useMenuGroup_unstable = useMenuGroup_unstable;
|
19
|
-
});
|
20
|
-
//# sourceMappingURL=useMenuGroup.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useMenuGroup.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuGroup/useMenuGroup.ts"],"names":[],"mappings":";;;;IAIA;;OAEG;IACH,SAAgB,qBAAqB,CAAC,KAAqB,EAAE,GAA2B;QACtF,IAAM,QAAQ,GAAG,uBAAK,CAAC,YAAY,CAAC,CAAC;QAErC,OAAO;YACL,UAAU,EAAE;gBACV,IAAI,EAAE,KAAK;aACZ;YACD,IAAI,EAAE,uCAAqB,CAAC,KAAK,qBAC/B,GAAG,KAAA,EACH,iBAAiB,EAAE,QAAQ,EAC3B,IAAI,EAAE,OAAO,IACV,KAAK,EACR;YACF,QAAQ,UAAA;SACT,CAAC;IACJ,CAAC;IAfD,sDAeC","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useId } from '@fluentui/react-utilities';\nimport { MenuGroupProps, MenuGroupState } from './MenuGroup.types';\n\n/**\n * Given user props, returns state and render function for a MenuGroup.\n */\nexport function useMenuGroup_unstable(props: MenuGroupProps, ref: React.Ref<HTMLElement>): MenuGroupState {\n const headerId = useId('menu-group');\n\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref,\n 'aria-labelledby': headerId,\n role: 'group',\n ...props,\n }),\n headerId,\n };\n}\n"]}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
define(["require", "exports", "react"], function (require, exports, React) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useMenuGroupContextValues_unstable = void 0;
|
5
|
-
function useMenuGroupContextValues_unstable(state) {
|
6
|
-
var headerId = state.headerId;
|
7
|
-
var menuGroup = React.useMemo(function () { return ({ headerId: headerId }); }, [headerId]);
|
8
|
-
return { menuGroup: menuGroup };
|
9
|
-
}
|
10
|
-
exports.useMenuGroupContextValues_unstable = useMenuGroupContextValues_unstable;
|
11
|
-
});
|
12
|
-
//# sourceMappingURL=useMenuGroupContextValues.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useMenuGroupContextValues.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuGroup/useMenuGroupContextValues.ts"],"names":[],"mappings":";;;;IAGA,SAAgB,kCAAkC,CAAC,KAAqB;QAC9D,IAAA,QAAQ,GAAK,KAAK,SAAV,CAAW;QAC3B,IAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,cAAM,OAAA,CAAC,EAAE,QAAQ,UAAA,EAAE,CAAC,EAAd,CAAc,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QAElE,OAAO,EAAE,SAAS,WAAA,EAAE,CAAC;IACvB,CAAC;IALD,gFAKC","sourcesContent":["import * as React from 'react';\nimport type { MenuGroupContextValues, MenuGroupState } from './MenuGroup.types';\n\nexport function useMenuGroupContextValues_unstable(state: MenuGroupState): MenuGroupContextValues {\n const { headerId } = state;\n const menuGroup = React.useMemo(() => ({ headerId }), [headerId]);\n\n return { menuGroup };\n}\n"]}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
define(["require", "exports", "@griffel/react"], function (require, exports, react_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useMenuGroupStyles_unstable = exports.menuGroupClassNames = void 0;
|
5
|
-
exports.menuGroupClassNames = {
|
6
|
-
root: 'fui-MenuGroup',
|
7
|
-
};
|
8
|
-
var useMenuGroupStyles_unstable = function (state) {
|
9
|
-
state.root.className = react_1.mergeClasses(exports.menuGroupClassNames.root, state.root.className);
|
10
|
-
return state;
|
11
|
-
};
|
12
|
-
exports.useMenuGroupStyles_unstable = useMenuGroupStyles_unstable;
|
13
|
-
});
|
14
|
-
//# sourceMappingURL=useMenuGroupStyles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useMenuGroupStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuGroup/useMenuGroupStyles.ts"],"names":[],"mappings":";;;;IAIa,QAAA,mBAAmB,GAAmC;QACjE,IAAI,EAAE,eAAe;KACtB,CAAC;IAEK,IAAM,2BAA2B,GAAG,UAAC,KAAqB;QAC/D,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CAAC,2BAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEpF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAJW,QAAA,2BAA2B,+BAItC","sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { mergeClasses } from '@griffel/react';\nimport type { MenuGroupSlots, MenuGroupState } from './MenuGroup.types';\n\nexport const menuGroupClassNames: SlotClassNames<MenuGroupSlots> = {\n root: 'fui-MenuGroup',\n};\n\nexport const useMenuGroupStyles_unstable = (state: MenuGroupState): MenuGroupState => {\n state.root.className = mergeClasses(menuGroupClassNames.root, state.root.className);\n\n return state;\n};\n"]}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
define(["require", "exports", "react", "./useMenuGroupHeader", "./useMenuGroupHeaderStyles", "./renderMenuGroupHeader", "@fluentui/react-shared-contexts"], function (require, exports, React, useMenuGroupHeader_1, useMenuGroupHeaderStyles_1, renderMenuGroupHeader_1, react_shared_contexts_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.MenuGroupHeader = void 0;
|
5
|
-
/**
|
6
|
-
* Define a styled MenuGroupHeader, using the `useMenuGroupHeader_unstable` hook.
|
7
|
-
*/
|
8
|
-
exports.MenuGroupHeader = React.forwardRef(function (props, ref) {
|
9
|
-
var state = useMenuGroupHeader_1.useMenuGroupHeader_unstable(props, ref);
|
10
|
-
useMenuGroupHeaderStyles_1.useMenuGroupHeaderStyles_unstable(state);
|
11
|
-
var useCustomStyles = react_shared_contexts_1.useCustomStyleHooks_unstable().useMenuGroupHeaderStyles_unstable;
|
12
|
-
useCustomStyles(state);
|
13
|
-
return renderMenuGroupHeader_1.renderMenuGroupHeader_unstable(state);
|
14
|
-
});
|
15
|
-
exports.MenuGroupHeader.displayName = 'MenuGroupHeader';
|
16
|
-
});
|
17
|
-
//# sourceMappingURL=MenuGroupHeader.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MenuGroupHeader.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuGroupHeader/MenuGroupHeader.tsx"],"names":[],"mappings":";;;;IAQA;;OAEG;IACU,QAAA,eAAe,GAA8C,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QACpG,IAAM,KAAK,GAAG,gDAA2B,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEtD,4DAAiC,CAAC,KAAK,CAAC,CAAC;QAEjC,IAAmC,eAAe,GAAK,oDAA4B,EAAE,kCAAnC,CAAoC;QAC9F,eAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,sDAA8B,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,uBAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["import * as React from 'react';\nimport { useMenuGroupHeader_unstable } from './useMenuGroupHeader';\nimport { useMenuGroupHeaderStyles_unstable } from './useMenuGroupHeaderStyles';\nimport { renderMenuGroupHeader_unstable } from './renderMenuGroupHeader';\nimport type { MenuGroupHeaderProps } from './MenuGroupHeader.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Define a styled MenuGroupHeader, using the `useMenuGroupHeader_unstable` hook.\n */\nexport const MenuGroupHeader: ForwardRefComponent<MenuGroupHeaderProps> = React.forwardRef((props, ref) => {\n const state = useMenuGroupHeader_unstable(props, ref);\n\n useMenuGroupHeaderStyles_unstable(state);\n\n const { useMenuGroupHeaderStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderMenuGroupHeader_unstable(state);\n});\n\nMenuGroupHeader.displayName = 'MenuGroupHeader';\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MenuGroupHeader.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuGroupHeader/MenuGroupHeader.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type MenuGroupHeaderSlots = {\n root: Slot<'div'>;\n};\n\nexport type MenuGroupHeaderProps = ComponentProps<MenuGroupHeaderSlots>;\n\nexport type MenuGroupHeaderState = ComponentState<MenuGroupHeaderSlots>;\n"]}
|