@fluentui/react-menu 9.4.1 → 9.5.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +119 -1
- package/CHANGELOG.md +32 -2
- package/dist/index.d.ts +102 -14
- package/lib/components/Menu/Menu.types.js.map +1 -1
- package/lib/components/Menu/useMenu.js +23 -26
- package/lib/components/Menu/useMenu.js.map +1 -1
- package/lib/components/Menu/useMenuContextValues.js +0 -2
- package/lib/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDividerStyles.js +2 -2
- package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroup.js +1 -1
- package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib/components/MenuItem/useMenuItem.js +3 -1
- package/lib/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib/components/MenuList/MenuList.types.js.map +1 -1
- package/lib/components/MenuList/useMenuList.js +20 -29
- package/lib/components/MenuList/useMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuListContextValues.js +0 -2
- package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopover.js +20 -14
- package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib/components/MenuTrigger/useMenuTrigger.js +42 -28
- package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib/contexts/menuContext.js +0 -1
- package/lib/contexts/menuContext.js.map +1 -1
- package/lib/contexts/menuListContext.js +0 -1
- package/lib/contexts/menuListContext.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-amd/Menu.js +6 -0
- package/lib-amd/Menu.js.map +1 -0
- package/lib-amd/MenuDivider.js +6 -0
- package/lib-amd/MenuDivider.js.map +1 -0
- package/lib-amd/MenuGroup.js +6 -0
- package/lib-amd/MenuGroup.js.map +1 -0
- package/lib-amd/MenuGroupHeader.js +6 -0
- package/lib-amd/MenuGroupHeader.js.map +1 -0
- package/lib-amd/MenuItem.js +6 -0
- package/lib-amd/MenuItem.js.map +1 -0
- package/lib-amd/MenuItemCheckbox.js +6 -0
- package/lib-amd/MenuItemCheckbox.js.map +1 -0
- package/lib-amd/MenuItemRadio.js +6 -0
- package/lib-amd/MenuItemRadio.js.map +1 -0
- package/lib-amd/MenuList.js +6 -0
- package/lib-amd/MenuList.js.map +1 -0
- package/lib-amd/MenuPopover.js +6 -0
- package/lib-amd/MenuPopover.js.map +1 -0
- package/lib-amd/MenuSplitGroup.js +6 -0
- package/lib-amd/MenuSplitGroup.js.map +1 -0
- package/lib-amd/MenuTrigger.js +6 -0
- package/lib-amd/MenuTrigger.js.map +1 -0
- package/lib-amd/components/Menu/Menu.js +16 -0
- package/lib-amd/components/Menu/Menu.js.map +1 -0
- package/lib-amd/components/Menu/Menu.types.js +5 -0
- package/lib-amd/components/Menu/Menu.types.js.map +1 -0
- package/lib-amd/components/Menu/index.js +10 -0
- package/lib-amd/components/Menu/index.js.map +1 -0
- package/lib-amd/components/Menu/renderMenu.js +15 -0
- package/lib-amd/components/Menu/renderMenu.js.map +1 -0
- package/lib-amd/components/Menu/useMenu.js +230 -0
- package/lib-amd/components/Menu/useMenu.js.map +1 -0
- package/lib-amd/components/Menu/useMenuContextValues.js +28 -0
- package/lib-amd/components/Menu/useMenuContextValues.js.map +1 -0
- package/lib-amd/components/MenuDivider/MenuDivider.js +15 -0
- package/lib-amd/components/MenuDivider/MenuDivider.js.map +1 -0
- package/lib-amd/components/MenuDivider/MenuDivider.types.js +5 -0
- package/lib-amd/components/MenuDivider/MenuDivider.types.js.map +1 -0
- package/lib-amd/components/MenuDivider/index.js +10 -0
- package/lib-amd/components/MenuDivider/index.js.map +1 -0
- package/lib-amd/components/MenuDivider/renderMenuDivider.js +15 -0
- package/lib-amd/components/MenuDivider/renderMenuDivider.js.map +1 -0
- package/lib-amd/components/MenuDivider/useMenuDivider.js +18 -0
- package/lib-amd/components/MenuDivider/useMenuDivider.js.map +1 -0
- package/lib-amd/components/MenuDivider/useMenuDividerStyles.js +18 -0
- package/lib-amd/components/MenuDivider/useMenuDividerStyles.js.map +1 -0
- package/lib-amd/components/MenuGroup/MenuGroup.js +16 -0
- package/lib-amd/components/MenuGroup/MenuGroup.js.map +1 -0
- package/lib-amd/components/MenuGroup/MenuGroup.types.js +5 -0
- package/lib-amd/components/MenuGroup/MenuGroup.types.js.map +1 -0
- package/lib-amd/components/MenuGroup/index.js +11 -0
- package/lib-amd/components/MenuGroup/index.js.map +1 -0
- package/lib-amd/components/MenuGroup/renderMenuGroup.js +16 -0
- package/lib-amd/components/MenuGroup/renderMenuGroup.js.map +1 -0
- package/lib-amd/components/MenuGroup/useMenuGroup.js +20 -0
- package/lib-amd/components/MenuGroup/useMenuGroup.js.map +1 -0
- package/lib-amd/components/MenuGroup/useMenuGroupContextValues.js +12 -0
- package/lib-amd/components/MenuGroup/useMenuGroupContextValues.js.map +1 -0
- package/lib-amd/components/MenuGroup/useMenuGroupStyles.js +14 -0
- package/lib-amd/components/MenuGroup/useMenuGroupStyles.js.map +1 -0
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.js +15 -0
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -0
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.types.js +5 -0
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -0
- package/lib-amd/components/MenuGroupHeader/index.js +10 -0
- package/lib-amd/components/MenuGroupHeader/index.js.map +1 -0
- package/lib-amd/components/MenuGroupHeader/renderMenuGroupHeader.js +15 -0
- package/lib-amd/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -0
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeader.js +19 -0
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -0
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +27 -0
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -0
- package/lib-amd/components/MenuItem/MenuItem.js +15 -0
- package/lib-amd/components/MenuItem/MenuItem.js.map +1 -0
- package/lib-amd/components/MenuItem/MenuItem.types.js +5 -0
- package/lib-amd/components/MenuItem/MenuItem.types.js.map +1 -0
- package/lib-amd/components/MenuItem/index.js +10 -0
- package/lib-amd/components/MenuItem/index.js.map +1 -0
- package/lib-amd/components/MenuItem/renderMenuItem.js +19 -0
- package/lib-amd/components/MenuItem/renderMenuItem.js.map +1 -0
- package/lib-amd/components/MenuItem/useCharacterSearch.js +22 -0
- package/lib-amd/components/MenuItem/useCharacterSearch.js.map +1 -0
- package/lib-amd/components/MenuItem/useMenuItem.js +80 -0
- package/lib-amd/components/MenuItem/useMenuItem.js.map +1 -0
- package/lib-amd/components/MenuItem/useMenuItemStyles.js +100 -0
- package/lib-amd/components/MenuItem/useMenuItemStyles.js.map +1 -0
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.js +15 -0
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -0
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.types.js +5 -0
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -0
- package/lib-amd/components/MenuItemCheckbox/index.js +10 -0
- package/lib-amd/components/MenuItemCheckbox/index.js.map +1 -0
- package/lib-amd/components/MenuItemCheckbox/renderMenuItemCheckbox.js +16 -0
- package/lib-amd/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -0
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckbox.js +26 -0
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -0
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +31 -0
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -0
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.js +15 -0
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.js.map +1 -0
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.types.js +5 -0
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -0
- package/lib-amd/components/MenuItemRadio/index.js +10 -0
- package/lib-amd/components/MenuItemRadio/index.js.map +1 -0
- package/lib-amd/components/MenuItemRadio/renderMenuItemRadio.js +19 -0
- package/lib-amd/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -0
- package/lib-amd/components/MenuItemRadio/useMenuItemRadio.js +27 -0
- package/lib-amd/components/MenuItemRadio/useMenuItemRadio.js.map +1 -0
- package/lib-amd/components/MenuItemRadio/useMenuItemRadioStyles.js +31 -0
- package/lib-amd/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -0
- package/lib-amd/components/MenuList/MenuList.js +16 -0
- package/lib-amd/components/MenuList/MenuList.js.map +1 -0
- package/lib-amd/components/MenuList/MenuList.types.js +5 -0
- package/lib-amd/components/MenuList/MenuList.types.js.map +1 -0
- package/lib-amd/components/MenuList/index.js +11 -0
- package/lib-amd/components/MenuList/index.js.map +1 -0
- package/lib-amd/components/MenuList/renderMenuList.js +15 -0
- package/lib-amd/components/MenuList/renderMenuList.js.map +1 -0
- package/lib-amd/components/MenuList/useMenuList.js +124 -0
- package/lib-amd/components/MenuList/useMenuList.js.map +1 -0
- package/lib-amd/components/MenuList/useMenuListContextValues.js +20 -0
- package/lib-amd/components/MenuList/useMenuListContextValues.js.map +1 -0
- package/lib-amd/components/MenuList/useMenuListStyles.js +21 -0
- package/lib-amd/components/MenuList/useMenuListStyles.js.map +1 -0
- package/lib-amd/components/MenuPopover/MenuPopover.js +15 -0
- package/lib-amd/components/MenuPopover/MenuPopover.js.map +1 -0
- package/lib-amd/components/MenuPopover/MenuPopover.types.js +5 -0
- package/lib-amd/components/MenuPopover/MenuPopover.types.js.map +1 -0
- package/lib-amd/components/MenuPopover/index.js +10 -0
- package/lib-amd/components/MenuPopover/index.js.map +1 -0
- package/lib-amd/components/MenuPopover/renderMenuPopover.js +18 -0
- package/lib-amd/components/MenuPopover/renderMenuPopover.js.map +1 -0
- package/lib-amd/components/MenuPopover/useMenuPopover.js +82 -0
- package/lib-amd/components/MenuPopover/useMenuPopover.js.map +1 -0
- package/lib-amd/components/MenuPopover/useMenuPopoverStyles.js +21 -0
- package/lib-amd/components/MenuPopover/useMenuPopoverStyles.js.map +1 -0
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.js +15 -0
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -0
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.types.js +5 -0
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -0
- package/lib-amd/components/MenuSplitGroup/index.js +10 -0
- package/lib-amd/components/MenuSplitGroup/index.js.map +1 -0
- package/lib-amd/components/MenuSplitGroup/renderMenuSplitGroup.js +14 -0
- package/lib-amd/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -0
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroup.js +47 -0
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -0
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroupStyles.js +43 -0
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -0
- package/lib-amd/components/MenuTrigger/MenuTrigger.js +18 -0
- package/lib-amd/components/MenuTrigger/MenuTrigger.js.map +1 -0
- package/lib-amd/components/MenuTrigger/MenuTrigger.types.js +5 -0
- package/lib-amd/components/MenuTrigger/MenuTrigger.types.js.map +1 -0
- package/lib-amd/components/MenuTrigger/index.js +9 -0
- package/lib-amd/components/MenuTrigger/index.js.map +1 -0
- package/lib-amd/components/MenuTrigger/renderMenuTrigger.js +15 -0
- package/lib-amd/components/MenuTrigger/renderMenuTrigger.js.map +1 -0
- package/lib-amd/components/MenuTrigger/useMenuTrigger.js +112 -0
- package/lib-amd/components/MenuTrigger/useMenuTrigger.js.map +1 -0
- package/lib-amd/components/index.js +7 -0
- package/lib-amd/components/index.js.map +1 -0
- package/lib-amd/contexts/menuContext.js +31 -0
- package/lib-amd/contexts/menuContext.js.map +1 -0
- package/lib-amd/contexts/menuGroupContext.js +13 -0
- package/lib-amd/contexts/menuGroupContext.js.map +1 -0
- package/lib-amd/contexts/menuListContext.js +23 -0
- package/lib-amd/contexts/menuListContext.js.map +1 -0
- package/lib-amd/contexts/menuTriggerContext.js +14 -0
- package/lib-amd/contexts/menuTriggerContext.js.map +1 -0
- package/lib-amd/index.js +69 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-amd/selectable/index.js +7 -0
- package/lib-amd/selectable/index.js.map +1 -0
- package/lib-amd/selectable/types.js +5 -0
- package/lib-amd/selectable/types.js.map +1 -0
- package/lib-amd/selectable/useCheckmarkStyles.js +28 -0
- package/lib-amd/selectable/useCheckmarkStyles.js.map +1 -0
- package/lib-amd/utils/index.js +6 -0
- package/lib-amd/utils/index.js.map +1 -0
- package/lib-amd/utils/useIsSubmenu.js +20 -0
- package/lib-amd/utils/useIsSubmenu.js.map +1 -0
- package/lib-amd/utils/useOnMenuEnter.js +59 -0
- package/lib-amd/utils/useOnMenuEnter.js.map +1 -0
- package/lib-commonjs/components/Menu/useMenu.js +23 -26
- package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenuContextValues.js +0 -2
- package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +2 -2
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItem.js +3 -1
- package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuList.js +20 -29
- package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js +0 -2
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js +20 -14
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +42 -28
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib-commonjs/contexts/menuContext.js +0 -1
- package/lib-commonjs/contexts/menuContext.js.map +1 -1
- package/lib-commonjs/contexts/menuListContext.js +0 -1
- package/lib-commonjs/contexts/menuListContext.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +9 -9
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-menu/src/contexts/menuListContext.tsx"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAKA,OAAO,MAAM,eAAe,gBAAkC,aAAa,CACzE,SADyE,CAApE;AAIP,MAAM,2BAA2B,GAAyB;EACxD,aAAa,EAAE,EADyC;EAExD,
|
1
|
+
{"version":3,"sources":["packages/react-components/react-menu/src/contexts/menuListContext.tsx"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAKA,OAAO,MAAM,eAAe,gBAAkC,aAAa,CACzE,SADyE,CAApE;AAIP,MAAM,2BAA2B,GAAyB;EACxD,aAAa,EAAE,EADyC;EAExD,wBAAwB,EAAE,MAAM,IAFwB;EAGxD,cAAc,EAAE,MAAM,IAHkC;EAIxD,WAAW,EAAE,MAAM,IAJqC;EAKxD,QAAQ,EAAE,KAL8C;EAMxD,aAAa,EAAE;AANyC,CAA1D;AA4BA,OAAO,MAAM,gBAAgB,GAAG,eAAe,CAAC,QAAzC;AAEP,OAAO,MAAM,2BAA2B,GAAQ,QAAL,IACzC,kBAAkB,CAAC,eAAD,EAAkB,CAAC,GAAG,GAAG,2BAAP,KAAuC,QAAQ,CAAC,GAAD,CAAjE,CADb","sourcesContent":["import * as React from 'react';\nimport { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport type { SelectableHandler } from '../selectable/index';\nimport type { MenuCheckedValueChangeData, MenuCheckedValueChangeEvent, MenuListProps } from '../components/index';\n\nexport const MenuListContext: Context<MenuListContextValue> = createContext<MenuListContextValue | undefined>(\n undefined,\n) as Context<MenuListContextValue>;\n\nconst menuListContextDefaultValue: MenuListContextValue = {\n checkedValues: {},\n setFocusByFirstCharacter: () => null,\n toggleCheckbox: () => null,\n selectRadio: () => null,\n hasIcons: false,\n hasCheckmarks: false,\n};\n\n/**\n * Context shared between MenuList and its children components\n */\nexport type MenuListContextValue = Pick<MenuListProps, 'checkedValues' | 'hasIcons' | 'hasCheckmarks'> & {\n setFocusByFirstCharacter?: (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => void;\n toggleCheckbox?: SelectableHandler;\n selectRadio?: SelectableHandler;\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n *\n * @deprecated this property is not used internally anymore,\n * the signature remains just to avoid breaking changes\n */\n onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;\n};\n\nexport const MenuListProvider = MenuListContext.Provider;\n\nexport const useMenuListContext_unstable = <T,>(selector: ContextSelector<MenuListContextValue, T>) =>\n useContextSelector(MenuListContext, (ctx = menuListContextDefaultValue) => selector(ctx));\n"],"sourceRoot":"../src/"}
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-menu/src/index.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,EAAuB,uBAAvB,QAAsD,wBAAtD;AAEA,SAAS,0BAAT,EAAqC,8BAArC,QAA2E,+BAA3E;AACA,SAAS,wBAAT,EAAmC,4BAAnC,QAAuE,6BAAvE;AAEA,SAAS,gBAAT,EAA2B,2BAA3B,QAA8D,4BAA9D;AA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,oBAA5C","sourcesContent":["export { MenuProvider, useMenuContext_unstable } from './contexts/menuContext';\nexport type { MenuContextValue } from './contexts/menuContext';\nexport { MenuTriggerContextProvider, useMenuTriggerContext_unstable } from './contexts/menuTriggerContext';\nexport { MenuGroupContextProvider, useMenuGroupContext_unstable } from './contexts/menuGroupContext';\nexport type { MenuGroupContextValue } from './contexts/menuGroupContext';\nexport { MenuListProvider, useMenuListContext_unstable } from './contexts/menuListContext';\nexport type { MenuListContextValue } from './contexts/menuListContext';\n\nexport { Menu, renderMenu_unstable, useMenuContextValues_unstable, useMenu_unstable } from './Menu';\nexport type {\n MenuContextValues,\n MenuOpenChangeData,\n MenuOpenEvent,\n // MenuOpenEvents is deprecated but removing it would be a breaking change\n // eslint-disable-next-line deprecation/deprecation\n MenuOpenEvents,\n MenuProps,\n MenuSlots,\n MenuState,\n} from './Menu';\nexport {\n MenuDivider,\n menuDividerClassNames,\n renderMenuDivider_unstable,\n useMenuDividerStyles_unstable,\n useMenuDivider_unstable,\n} from './MenuDivider';\nexport type { MenuDividerProps, MenuDividerSlots, MenuDividerState } from './MenuDivider';\nexport {\n MenuGroup,\n menuGroupClassNames,\n renderMenuGroup_unstable,\n useMenuGroupContextValues_unstable,\n useMenuGroupStyles_unstable,\n useMenuGroup_unstable,\n} from './MenuGroup';\nexport type { MenuGroupContextValues, MenuGroupProps, MenuGroupSlots, MenuGroupState } from './MenuGroup';\nexport {\n MenuGroupHeader,\n menuGroupHeaderClassNames,\n renderMenuGroupHeader_unstable,\n useMenuGroupHeaderStyles_unstable,\n useMenuGroupHeader_unstable,\n} from './MenuGroupHeader';\nexport type { MenuGroupHeaderProps, MenuGroupHeaderSlots, MenuGroupHeaderState } from './MenuGroupHeader';\nexport {\n MenuItem,\n menuItemClassNames,\n renderMenuItem_unstable,\n useMenuItemStyles_unstable,\n useMenuItem_unstable,\n} from './MenuItem';\nexport type { MenuItemProps, MenuItemSlots, MenuItemState } from './MenuItem';\nexport {\n MenuItemCheckbox,\n menuItemCheckboxClassNames,\n renderMenuItemCheckbox_unstable,\n useMenuItemCheckboxStyles_unstable,\n useMenuItemCheckbox_unstable,\n} from './MenuItemCheckbox';\nexport type { MenuItemCheckboxProps, MenuItemCheckboxState } from './MenuItemCheckbox';\nexport {\n MenuItemRadio,\n menuItemRadioClassNames,\n renderMenuItemRadio_unstable,\n useMenuItemRadioStyles_unstable,\n useMenuItemRadio_unstable,\n} from './MenuItemRadio';\nexport type { MenuItemRadioProps, MenuItemRadioState } from './MenuItemRadio';\nexport {\n MenuList,\n menuListClassNames,\n renderMenuList_unstable,\n useMenuListContextValues_unstable,\n useMenuListStyles_unstable,\n useMenuList_unstable,\n} from './MenuList';\nexport type {\n MenuCheckedValueChangeData,\n MenuCheckedValueChangeEvent,\n MenuListContextValues,\n MenuListProps,\n MenuListSlots,\n MenuListState,\n // UninitializedMenuListState is deprecated but removing it would be a breaking change\n // eslint-disable-next-line deprecation/deprecation\n UninitializedMenuListState,\n} from './MenuList';\nexport {\n MenuPopover,\n menuPopoverClassNames,\n renderMenuPopover_unstable,\n useMenuPopoverStyles_unstable,\n useMenuPopover_unstable,\n} from './MenuPopover';\nexport type { MenuPopoverProps, MenuPopoverSlots, MenuPopoverState } from './MenuPopover';\nexport {\n MenuSplitGroup,\n menuSplitGroupClassNames,\n renderMenuSplitGroup_unstable,\n useMenuSplitGroupStyles_unstable,\n useMenuSplitGroup_unstable,\n} from './MenuSplitGroup';\nexport type { MenuSplitGroupProps, MenuSplitGroupSlots, MenuSplitGroupState } from './MenuSplitGroup';\nexport { MenuTrigger, renderMenuTrigger_unstable, useMenuTrigger_unstable } from './MenuTrigger';\nexport type { MenuTriggerChildProps, MenuTriggerProps, MenuTriggerState } from './MenuTrigger';\n\nexport { useCheckmarkStyles_unstable } from './selectable/index';\nexport type { MenuItemSelectableProps, MenuItemSelectableState, SelectableHandler } from './selectable/index';\n"],"sourceRoot":"../src/"}
|
package/lib-amd/Menu.js
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/Menu/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=Menu.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/Menu.ts"],"names":[],"mappings":";;;IAAA,uCAAwC","sourcesContent":["export * from './components/Menu/index';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/MenuDivider/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=MenuDivider.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuDivider.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/MenuDivider.ts"],"names":[],"mappings":";;;IAAA,uCAA+C","sourcesContent":["export * from './components/MenuDivider/index';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/MenuGroup/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=MenuGroup.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuGroup.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/MenuGroup.ts"],"names":[],"mappings":";;;IAAA,uCAA6C","sourcesContent":["export * from './components/MenuGroup/index';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/MenuGroupHeader/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=MenuGroupHeader.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuGroupHeader.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/MenuGroupHeader.ts"],"names":[],"mappings":";;;IAAA,uCAAmD","sourcesContent":["export * from './components/MenuGroupHeader/index';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/MenuItem/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=MenuItem.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuItem.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/MenuItem.ts"],"names":[],"mappings":";;;IAAA,uCAA4C","sourcesContent":["export * from './components/MenuItem/index';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/MenuItemCheckbox/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=MenuItemCheckbox.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuItemCheckbox.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/MenuItemCheckbox.ts"],"names":[],"mappings":";;;IAAA,uCAAoD","sourcesContent":["export * from './components/MenuItemCheckbox/index';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/MenuItemRadio/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=MenuItemRadio.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuItemRadio.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/MenuItemRadio.ts"],"names":[],"mappings":";;;IAAA,uCAAiD","sourcesContent":["export * from './components/MenuItemRadio/index';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/MenuList/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=MenuList.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuList.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/MenuList.ts"],"names":[],"mappings":";;;IAAA,uCAA4C","sourcesContent":["export * from './components/MenuList/index';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/MenuPopover/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=MenuPopover.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuPopover.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/MenuPopover.ts"],"names":[],"mappings":";;;IAAA,uCAA+C","sourcesContent":["export * from './components/MenuPopover/index';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/MenuSplitGroup/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=MenuSplitGroup.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuSplitGroup.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/MenuSplitGroup.ts"],"names":[],"mappings":";;;IAAA,uCAAkD","sourcesContent":["export * from './components/MenuSplitGroup/index';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/MenuTrigger/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=MenuTrigger.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuTrigger.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-menu/src/MenuTrigger.ts"],"names":[],"mappings":";;;IAAA,uCAA+C","sourcesContent":["export * from './components/MenuTrigger/index';\n"]}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
define(["require", "exports", "./useMenu", "./useMenuContextValues", "./renderMenu"], function (require, exports, useMenu_1, useMenuContextValues_1, renderMenu_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.Menu = void 0;
|
5
|
+
/**
|
6
|
+
* Wrapper component that manages state for a popup MenuList and a MenuTrigger
|
7
|
+
*/
|
8
|
+
var Menu = function (props) {
|
9
|
+
var state = useMenu_1.useMenu_unstable(props);
|
10
|
+
var contextValues = useMenuContextValues_1.useMenuContextValues_unstable(state);
|
11
|
+
return renderMenu_1.renderMenu_unstable(state, contextValues);
|
12
|
+
};
|
13
|
+
exports.Menu = Menu;
|
14
|
+
exports.Menu.displayName = 'Menu';
|
15
|
+
});
|
16
|
+
//# sourceMappingURL=Menu.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/Menu/Menu.tsx"],"names":[],"mappings":";;;;IAMA;;OAEG;IACI,IAAM,IAAI,GAAwB,UAAA,KAAK;QAC5C,IAAM,KAAK,GAAG,0BAAgB,CAAC,KAAK,CAAC,CAAC;QACtC,IAAM,aAAa,GAAG,oDAA6B,CAAC,KAAK,CAAC,CAAC;QAE3D,OAAO,gCAAmB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACnD,CAAC,CAAC;IALW,QAAA,IAAI,QAKf;IAEF,YAAI,CAAC,WAAW,GAAG,MAAM,CAAC","sourcesContent":["import * as React from 'react';\nimport { useMenu_unstable } from './useMenu';\nimport { useMenuContextValues_unstable } from './useMenuContextValues';\nimport { renderMenu_unstable } from './renderMenu';\nimport type { MenuProps } from './Menu.types';\n\n/**\n * Wrapper component that manages state for a popup MenuList and a MenuTrigger\n */\nexport const Menu: React.FC<MenuProps> = props => {\n const state = useMenu_unstable(props);\n const contextValues = useMenuContextValues_unstable(state);\n\n return renderMenu_unstable(state, contextValues);\n};\n\nMenu.displayName = 'Menu';\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Menu.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/Menu/Menu.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { PositioningVirtualElement, SetVirtualMouseTarget } from '@fluentui/react-positioning';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\nimport type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { MenuContextValue } from '../../contexts/menuContext';\nimport type { MenuListProps } from '../MenuList/MenuList.types';\n\nexport type MenuSlots = {};\n\n/**\n * Extends and drills down Menulist props to simplify API\n */\nexport type MenuProps = ComponentProps<MenuSlots> &\n Pick<\n MenuListProps,\n 'checkedValues' | 'defaultCheckedValues' | 'hasCheckmarks' | 'hasIcons' | 'onCheckedValueChange'\n > & {\n /**\n * Can contain two children including {@link MenuTrigger} and {@link MenuPopover}.\n * Alternatively can only contain {@link MenuPopover} if using a custom `target`.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n\n /**\n * Sets the delay for mouse open/close for the popover one mouse enter/leave\n */\n hoverDelay?: number;\n\n /**\n * Root menus are rendered out of DOM order on `document.body`, use this to render the menu in DOM order\n * This option is disregarded for submenus\n *\n * @default false\n */\n inline?: boolean;\n\n /**\n * Call back when the component requests to change value\n * The `open` value is used as a hint when directly controlling the component\n */\n onOpenChange?: (e: MenuOpenEvent, data: MenuOpenChangeData) => void;\n\n /**\n * Whether the popup is open\n *\n * @default false\n */\n open?: boolean;\n\n /**\n * Whether the popup is open by default\n *\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * Opens the menu on right click (context menu), removes all other menu open interactions\n *\n * @default false\n */\n openOnContext?: boolean;\n\n /**\n * Opens the menu on hover\n *\n * @default false\n */\n openOnHover?: boolean;\n\n /**\n * Do not dismiss the menu when a menu item is clicked\n *\n * @default false\n */\n persistOnItemClick?: boolean;\n\n /**\n * Configures the positioned menu\n */\n positioning?: PositioningShorthand;\n\n /**\n * Close when scroll outside of it\n *\n * @default false\n */\n closeOnScroll?: boolean;\n };\n\nexport type MenuState = ComponentState<MenuSlots> &\n Required<\n Pick<\n MenuProps,\n | 'hasCheckmarks'\n | 'hasIcons'\n | 'inline'\n | 'checkedValues'\n | 'onCheckedValueChange'\n | 'open'\n | 'openOnHover'\n | 'closeOnScroll'\n | 'hoverDelay'\n | 'openOnContext'\n | 'persistOnItemClick'\n >\n > & {\n /**\n * Anchors the popper to the mouse click for context events\n */\n contextTarget?: PositioningVirtualElement;\n\n /**\n * Whether this menu is a submenu\n */\n isSubmenu: boolean;\n\n /**\n * Internal react node that just simplifies handling children\n */\n menuPopover: React.ReactNode;\n\n /**\n * The ref for the popup\n */\n menuPopoverRef: React.MutableRefObject<HTMLElement>;\n\n /**\n * Internal react node that just simplifies handling children\n */\n menuTrigger: React.ReactNode;\n\n /**\n * A callback to set the target of the popper to the mouse click for context events\n */\n setContextTarget: SetVirtualMouseTarget;\n\n /**\n * Callback to open/close the popup\n */\n setOpen: (e: MenuOpenEvent, data: MenuOpenChangeData) => void;\n\n /**\n * Id for the MenuTrigger element for aria relationship\n */\n triggerId: string;\n\n /**\n * The ref for the MenuTrigger, used for popup positioning\n */\n triggerRef: React.MutableRefObject<HTMLElement>;\n\n /**\n * Call back when the component requests to change value\n * The `open` value is used as a hint when directly controlling the component\n * @deprecated this property is not used internally anymore,\n * the signature remains just to avoid breaking changes\n */\n onOpenChange?: (e: MenuOpenEvent, data: MenuOpenChangeData) => void;\n /**\n * Default values to be checked on mount\n @deprecated this property is not used internally anymore,\n * the signature remains just to avoid breaking changes\n */\n defaultCheckedValues?: Record<string, string[]>;\n };\n\nexport type MenuContextValues = {\n menu: MenuContextValue;\n};\n\n/**\n * The supported events that will trigger open/close of the menu\n */\nexport type MenuOpenEvent = MenuOpenChangeData['event'];\n/**\n * @deprecated use MenuOpenEvent instead\n */\nexport type MenuOpenEvents = MenuOpenEvent;\n\n/**\n * Data attached to open/close events\n */\nexport type MenuOpenChangeData = {\n /**\n * indicates whether the request for the open state was bubbled from a nested menu\n */\n bubble?: boolean;\n /**\n * Indicates whether the change of state was a keyboard interaction\n * @deprecated\n * This should not be used, since `Enter`, `Space` and click should be interpreted as the same thing as a click\n */\n keyboard?: boolean;\n open: boolean;\n} & (\n | {\n type: 'menuTriggerContextMenu';\n event: React.MouseEvent<HTMLElement>;\n }\n | {\n type: 'menuTriggerClick';\n event: React.MouseEvent<HTMLElement>;\n }\n | {\n type: 'menuTriggerMouseEnter';\n event: React.MouseEvent<HTMLElement>;\n }\n | {\n type: 'menuTriggerMouseLeave';\n event: React.MouseEvent<HTMLElement>;\n }\n | {\n type: 'menuTriggerMouseMove';\n event: React.MouseEvent<HTMLElement>;\n }\n | {\n type: 'menuTriggerKeyDown';\n event: React.KeyboardEvent<HTMLElement>;\n }\n | {\n type: 'menuItemClick';\n event: React.MouseEvent<HTMLElement>;\n }\n | {\n type: 'menuPopoverMouseEnter';\n event: React.MouseEvent<HTMLElement>;\n }\n | {\n type: 'menuPopoverKeyDown';\n event: React.KeyboardEvent<HTMLElement>;\n }\n | {\n type: 'clickOutside';\n event: MouseEvent | TouchEvent;\n }\n | {\n type: 'scrollOutside';\n event: MouseEvent | TouchEvent;\n }\n | {\n type: 'menuMouseEnter';\n event: MouseEvent | TouchEvent;\n }\n);\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./Menu", "./Menu.types", "./renderMenu", "./useMenu", "./useMenuContextValues"], function (require, exports, tslib_1, Menu_1, Menu_types_1, renderMenu_1, useMenu_1, useMenuContextValues_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(Menu_1, exports);
|
5
|
+
tslib_1.__exportStar(Menu_types_1, exports);
|
6
|
+
tslib_1.__exportStar(renderMenu_1, exports);
|
7
|
+
tslib_1.__exportStar(useMenu_1, exports);
|
8
|
+
tslib_1.__exportStar(useMenuContextValues_1, exports);
|
9
|
+
});
|
10
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/Menu/index.ts"],"names":[],"mappings":";;;IAAA,sCAAuB;IACvB,4CAA6B;IAC7B,4CAA6B;IAC7B,yCAA0B;IAC1B,sDAAuC","sourcesContent":["export * from './Menu';\nexport * from './Menu.types';\nexport * from './renderMenu';\nexport * from './useMenu';\nexport * from './useMenuContextValues';\n"]}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
define(["require", "exports", "react", "../../contexts/menuContext"], function (require, exports, React, menuContext_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.renderMenu_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Render the final JSX of Menu
|
7
|
+
*/
|
8
|
+
var renderMenu_unstable = function (state, contextValues) {
|
9
|
+
return (React.createElement(menuContext_1.MenuProvider, { value: contextValues.menu },
|
10
|
+
state.menuTrigger,
|
11
|
+
state.open && state.menuPopover));
|
12
|
+
};
|
13
|
+
exports.renderMenu_unstable = renderMenu_unstable;
|
14
|
+
});
|
15
|
+
//# sourceMappingURL=renderMenu.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"renderMenu.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/Menu/renderMenu.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,mBAAmB,GAAG,UAAC,KAAgB,EAAE,aAAgC;QACpF,OAAO,CACL,oBAAC,0BAAY,IAAC,KAAK,EAAE,aAAa,CAAC,IAAI;YACpC,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,WAAW,CACnB,CAChB,CAAC;IACJ,CAAC,CAAC;IAPW,QAAA,mBAAmB,uBAO9B","sourcesContent":["import * as React from 'react';\nimport { MenuProvider } from '../../contexts/menuContext';\nimport type { MenuContextValues, MenuState } from './Menu.types';\n\n/**\n * Render the final JSX of Menu\n */\nexport const renderMenu_unstable = (state: MenuState, contextValues: MenuContextValues) => {\n return (\n <MenuProvider value={contextValues.menu}>\n {state.menuTrigger}\n {state.open && state.menuPopover}\n </MenuProvider>\n );\n};\n"]}
|
@@ -0,0 +1,230 @@
|
|
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", "@fluentui/keyboard-keys"], 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, keyboard_keys_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.useMenu_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Create the state required to render Menu.
|
7
|
+
*
|
8
|
+
* The returned state can be modified with hooks such as useMenuStyles,
|
9
|
+
* before being passed to renderMenu_unstable.
|
10
|
+
*
|
11
|
+
* @param props - props from this instance of Menu
|
12
|
+
*/
|
13
|
+
var useMenu_unstable = function (props) {
|
14
|
+
var isSubmenu = useIsSubmenu_1.useIsSubmenu();
|
15
|
+
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;
|
16
|
+
var triggerId = react_utilities_1.useId('menu');
|
17
|
+
var _j = react_positioning_1.usePositioningMouseTarget(), contextTarget = _j[0], setContextTarget = _j[1];
|
18
|
+
var positioningState = tslib_1.__assign({ position: isSubmenu ? 'after' : 'below', align: isSubmenu ? 'top' : 'start', target: props.openOnContext ? contextTarget : undefined }, react_positioning_1.resolvePositioningShorthand(props.positioning));
|
19
|
+
var children = React.Children.toArray(props.children);
|
20
|
+
if (process.env.NODE_ENV !== 'production') {
|
21
|
+
if (children.length === 0) {
|
22
|
+
// eslint-disable-next-line no-console
|
23
|
+
console.warn('Menu must contain at least one child');
|
24
|
+
}
|
25
|
+
if (children.length > 2) {
|
26
|
+
// eslint-disable-next-line no-console
|
27
|
+
console.warn('Menu must contain at most two children');
|
28
|
+
}
|
29
|
+
}
|
30
|
+
var menuTrigger = undefined;
|
31
|
+
var menuPopover = undefined;
|
32
|
+
if (children.length === 2) {
|
33
|
+
menuTrigger = children[0];
|
34
|
+
menuPopover = children[1];
|
35
|
+
}
|
36
|
+
else if (children.length === 1) {
|
37
|
+
menuPopover = children[0];
|
38
|
+
}
|
39
|
+
var _k = react_positioning_1.usePositioning(positioningState), triggerRef = _k.targetRef, menuPopoverRef = _k.containerRef;
|
40
|
+
// TODO Better way to narrow types ?
|
41
|
+
var _l = useMenuOpenState({
|
42
|
+
hoverDelay: hoverDelay,
|
43
|
+
isSubmenu: isSubmenu,
|
44
|
+
setContextTarget: setContextTarget,
|
45
|
+
closeOnScroll: closeOnScroll,
|
46
|
+
menuPopoverRef: menuPopoverRef,
|
47
|
+
triggerRef: triggerRef,
|
48
|
+
open: props.open,
|
49
|
+
defaultOpen: props.defaultOpen,
|
50
|
+
onOpenChange: props.onOpenChange,
|
51
|
+
openOnContext: openOnContext,
|
52
|
+
}), open = _l[0], setOpen = _l[1];
|
53
|
+
var _m = useMenuSelectableState({
|
54
|
+
checkedValues: props.checkedValues,
|
55
|
+
defaultCheckedValues: defaultCheckedValues,
|
56
|
+
onCheckedValueChange: props.onCheckedValueChange,
|
57
|
+
}), checkedValues = _m[0], onCheckedValueChange = _m[1];
|
58
|
+
return {
|
59
|
+
inline: inline,
|
60
|
+
hoverDelay: hoverDelay,
|
61
|
+
triggerId: triggerId,
|
62
|
+
isSubmenu: isSubmenu,
|
63
|
+
openOnHover: openOnHover,
|
64
|
+
contextTarget: contextTarget,
|
65
|
+
setContextTarget: setContextTarget,
|
66
|
+
hasCheckmarks: hasCheckmarks,
|
67
|
+
hasIcons: hasIcons,
|
68
|
+
closeOnScroll: closeOnScroll,
|
69
|
+
menuTrigger: menuTrigger,
|
70
|
+
menuPopover: menuPopover,
|
71
|
+
triggerRef: triggerRef,
|
72
|
+
menuPopoverRef: menuPopoverRef,
|
73
|
+
components: {},
|
74
|
+
openOnContext: openOnContext,
|
75
|
+
open: open,
|
76
|
+
setOpen: setOpen,
|
77
|
+
checkedValues: checkedValues,
|
78
|
+
onCheckedValueChange: onCheckedValueChange,
|
79
|
+
persistOnItemClick: persistOnItemClick,
|
80
|
+
};
|
81
|
+
};
|
82
|
+
exports.useMenu_unstable = useMenu_unstable;
|
83
|
+
/**
|
84
|
+
* Adds appropriate state values and handlers for selectable items
|
85
|
+
* i.e checkboxes and radios
|
86
|
+
*/
|
87
|
+
var useMenuSelectableState = function (props) {
|
88
|
+
var _a = react_utilities_1.useControllableState({
|
89
|
+
state: props.checkedValues,
|
90
|
+
defaultState: props.defaultCheckedValues,
|
91
|
+
initialState: {},
|
92
|
+
}), checkedValues = _a[0], setCheckedValues = _a[1];
|
93
|
+
var onCheckedValueChange = react_utilities_1.useEventCallback(function (e, _a) {
|
94
|
+
var _b;
|
95
|
+
var name = _a.name, checkedItems = _a.checkedItems;
|
96
|
+
(_b = props.onCheckedValueChange) === null || _b === void 0 ? void 0 : _b.call(props, e, { name: name, checkedItems: checkedItems });
|
97
|
+
setCheckedValues(function (currentValue) {
|
98
|
+
var _a;
|
99
|
+
return (tslib_1.__assign(tslib_1.__assign({}, currentValue), (_a = {}, _a[name] = checkedItems, _a)));
|
100
|
+
});
|
101
|
+
});
|
102
|
+
return [checkedValues, onCheckedValueChange];
|
103
|
+
};
|
104
|
+
var useMenuOpenState = function (state) {
|
105
|
+
var targetDocument = react_shared_contexts_1.useFluent_unstable().targetDocument;
|
106
|
+
var parentSetOpen = menuContext_1.useMenuContext_unstable(function (context) { return context.setOpen; });
|
107
|
+
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); });
|
108
|
+
var shouldHandleCloseRef = React.useRef(false);
|
109
|
+
var shouldHandleTabRef = React.useRef(false);
|
110
|
+
var pressedShiftRef = React.useRef(false);
|
111
|
+
var setOpenTimeout = React.useRef(0);
|
112
|
+
var enteringTriggerRef = React.useRef(false);
|
113
|
+
var _a = react_utilities_1.useControllableState({
|
114
|
+
state: state.open,
|
115
|
+
defaultState: state.defaultOpen,
|
116
|
+
initialState: false,
|
117
|
+
}), open = _a[0], setOpenState = _a[1];
|
118
|
+
var trySetOpen = react_utilities_1.useEventCallback(function (e, data) {
|
119
|
+
var event = e instanceof CustomEvent && e.type === index_1.MENU_ENTER_EVENT ? e.detail.nativeEvent : e;
|
120
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(event, tslib_1.__assign({}, data));
|
121
|
+
if (data.open && e.type === 'contextmenu') {
|
122
|
+
state.setContextTarget(e);
|
123
|
+
}
|
124
|
+
if (!data.open) {
|
125
|
+
state.setContextTarget(undefined);
|
126
|
+
shouldHandleCloseRef.current = true;
|
127
|
+
}
|
128
|
+
if (e.type === 'keydown') {
|
129
|
+
if (e.key === keyboard_keys_1.Tab) {
|
130
|
+
shouldHandleTabRef.current = true;
|
131
|
+
pressedShiftRef.current = e.shiftKey;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
if (data.bubble) {
|
135
|
+
parentSetOpen(e, tslib_1.__assign({}, data));
|
136
|
+
}
|
137
|
+
setOpenState(data.open);
|
138
|
+
});
|
139
|
+
var setOpen = react_utilities_1.useEventCallback(function (e, data) {
|
140
|
+
var _a;
|
141
|
+
clearTimeout(setOpenTimeout.current);
|
142
|
+
if (!(e instanceof Event) && e.persist) {
|
143
|
+
// < React 17 still uses pooled synthetic events
|
144
|
+
e.persist();
|
145
|
+
}
|
146
|
+
if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === index_1.MENU_ENTER_EVENT) {
|
147
|
+
if ((_a = state.triggerRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
|
148
|
+
enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';
|
149
|
+
}
|
150
|
+
// FIXME leaking Node timeout type
|
151
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
152
|
+
// @ts-ignore
|
153
|
+
setOpenTimeout.current = setTimeout(function () { return trySetOpen(e, data); }, state.hoverDelay);
|
154
|
+
}
|
155
|
+
else {
|
156
|
+
trySetOpen(e, data);
|
157
|
+
}
|
158
|
+
});
|
159
|
+
react_utilities_1.useOnClickOutside({
|
160
|
+
contains: react_portal_1.elementContains,
|
161
|
+
disabled: !open,
|
162
|
+
element: targetDocument,
|
163
|
+
refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(Boolean),
|
164
|
+
callback: function (event) { return setOpen(event, { open: false, type: 'clickOutside', event: event }); },
|
165
|
+
});
|
166
|
+
// only close on scroll for context, or when closeOnScroll is specified
|
167
|
+
var closeOnScroll = state.openOnContext || state.closeOnScroll;
|
168
|
+
react_utilities_1.useOnScrollOutside({
|
169
|
+
contains: react_portal_1.elementContains,
|
170
|
+
element: targetDocument,
|
171
|
+
callback: function (event) { return setOpen(event, { open: false, type: 'scrollOutside', event: event }); },
|
172
|
+
refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(Boolean),
|
173
|
+
disabled: !open || !closeOnScroll,
|
174
|
+
});
|
175
|
+
index_1.useOnMenuMouseEnter({
|
176
|
+
element: targetDocument,
|
177
|
+
callback: function (event) {
|
178
|
+
// When moving from a menu directly back to its trigger, this handler can close the menu
|
179
|
+
// Explicitly check a flag to see if this situation happens
|
180
|
+
if (!enteringTriggerRef.current) {
|
181
|
+
setOpen(event, { open: false, type: 'menuMouseEnter', event: event });
|
182
|
+
}
|
183
|
+
},
|
184
|
+
disabled: !open,
|
185
|
+
refs: [state.menuPopoverRef],
|
186
|
+
});
|
187
|
+
// Clear timeout on unmount
|
188
|
+
// Setting state after a component unmounts can cause memory leaks
|
189
|
+
React.useEffect(function () {
|
190
|
+
return function () {
|
191
|
+
clearTimeout(setOpenTimeout.current);
|
192
|
+
};
|
193
|
+
}, []);
|
194
|
+
// Manage focus for open state
|
195
|
+
var _b = react_tabster_1.useFocusFinders(), findFirstFocusable = _b.findFirstFocusable, findNextFocusable = _b.findNextFocusable, findPrevFocusable = _b.findPrevFocusable;
|
196
|
+
var focusFirst = React.useCallback(function () {
|
197
|
+
var firstFocusable = findFirstFocusable(state.menuPopoverRef.current);
|
198
|
+
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
199
|
+
}, [findFirstFocusable, state.menuPopoverRef]);
|
200
|
+
var focusAfterMenuTrigger = React.useCallback(function () {
|
201
|
+
var nextFocusable = findNextFocusable(state.triggerRef.current);
|
202
|
+
nextFocusable === null || nextFocusable === void 0 ? void 0 : nextFocusable.focus();
|
203
|
+
}, [findNextFocusable, state.triggerRef]);
|
204
|
+
var focusBeforeMenuTrigger = React.useCallback(function () {
|
205
|
+
var prevFocusable = findPrevFocusable(state.triggerRef.current);
|
206
|
+
prevFocusable === null || prevFocusable === void 0 ? void 0 : prevFocusable.focus();
|
207
|
+
}, [findPrevFocusable, state.triggerRef]);
|
208
|
+
React.useEffect(function () {
|
209
|
+
var _a;
|
210
|
+
if (open) {
|
211
|
+
focusFirst();
|
212
|
+
}
|
213
|
+
else {
|
214
|
+
if (shouldHandleCloseRef.current) {
|
215
|
+
if (shouldHandleTabRef.current && !state.isSubmenu) {
|
216
|
+
pressedShiftRef.current ? focusBeforeMenuTrigger() : focusAfterMenuTrigger();
|
217
|
+
}
|
218
|
+
else {
|
219
|
+
(_a = state.triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
shouldHandleCloseRef.current = false;
|
224
|
+
shouldHandleTabRef.current = false;
|
225
|
+
pressedShiftRef.current = false;
|
226
|
+
}, [state.triggerRef, state.isSubmenu, open, focusFirst, focusAfterMenuTrigger, focusBeforeMenuTrigger]);
|
227
|
+
return [open, setOpen];
|
228
|
+
};
|
229
|
+
});
|
230
|
+
//# sourceMappingURL=useMenu.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useMenu.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/Menu/useMenu.tsx"],"names":[],"mappings":";;;;IAkBA;;;;;;;OAOG;IACI,IAAM,gBAAgB,GAAG,UAAC,KAAgB;QAC/C,IAAM,SAAS,GAAG,2BAAY,EAAE,CAAC;QAE/B,IAAA,KASE,KAAK,WATS,EAAhB,UAAU,mBAAG,GAAG,KAAA,EAChB,KAQE,KAAK,OARO,EAAd,MAAM,mBAAG,KAAK,KAAA,EACd,KAOE,KAAK,cAPc,EAArB,aAAa,mBAAG,KAAK,KAAA,EACrB,KAME,KAAK,SANS,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,KAKE,KAAK,cALc,EAArB,aAAa,mBAAG,KAAK,KAAA,EACrB,KAIE,KAAK,cAJc,EAArB,aAAa,mBAAG,KAAK,KAAA,EACrB,KAGE,KAAK,mBAHmB,EAA1B,kBAAkB,mBAAG,KAAK,KAAA,EAC1B,KAEE,KAAK,YAFgB,EAAvB,WAAW,mBAAG,SAAS,KAAA,EACvB,oBAAoB,GAClB,KAAK,qBADa,CACZ;QACV,IAAM,SAAS,GAAG,uBAAK,CAAC,MAAM,CAAC,CAAC;QAC1B,IAAA,KAAoC,6CAAyB,EAAE,EAA9D,aAAa,QAAA,EAAE,gBAAgB,QAA+B,CAAC;QAEtE,IAAM,gBAAgB,GAAG,mBACvB,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACvC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAClC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,IACpD,+CAA2B,CAAC,KAAK,CAAC,WAAW,CAAC,CACzC,CAAC;QAEX,IAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAyB,CAAC;QAEhF,IAAI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K,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAClE,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,EAAE,CAAC;QACzB,CAAC,EAAE,CAAC,iBAAiB,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;QAE1C,KAAK,CAAC,SAAS,CAAC;;YACd,IAAI,IAAI,EAAE;gBACR,UAAU,EAAE,CAAC;aACd;iBAAM;gBACL,IAAI,oBAAoB,CAAC,OAAO,EAAE;oBAChC,IAAI,kBAAkB,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;wBAClD,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;qBAC9E;yBAAM;wBACL,MAAA,KAAK,CAAC,UAAU,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;qBACnC;iBACF;aACF;YAED,oBAAoB,CAAC,OAAO,GAAG,KAAK,CAAC;YACrC,kBAAkB,CAAC,OAAO,GAAG,KAAK,CAAC;YACnC,eAAe,CAAC,OAAO,GAAG,KAAK,CAAC;QAClC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,qBAAqB,EAAE,sBAAsB,CAAC,CAAC,CAAC;QAEzG,OAAO,CAAC,IAAI,EAAE,OAAO,CAAU,CAAC;IAClC,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { usePositioningMouseTarget, usePositioning, resolvePositioningShorthand } 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';\nimport { Tab } from '@fluentui/keyboard-keys';\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 } = 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 ...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 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 shouldHandleTabRef = React.useRef(false);\n const pressedShiftRef = 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 (e.type === 'keydown') {\n if ((e as React.KeyboardEvent<HTMLElement>).key === Tab) {\n shouldHandleTabRef.current = true;\n pressedShiftRef.current = (e as React.KeyboardEvent<HTMLElement>).shiftKey;\n }\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, findNextFocusable, findPrevFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(() => {\n const firstFocusable = findFirstFocusable(state.menuPopoverRef.current);\n firstFocusable?.focus();\n }, [findFirstFocusable, state.menuPopoverRef]);\n\n const focusAfterMenuTrigger = React.useCallback(() => {\n const nextFocusable = findNextFocusable(state.triggerRef.current);\n nextFocusable?.focus();\n }, [findNextFocusable, state.triggerRef]);\n\n const focusBeforeMenuTrigger = React.useCallback(() => {\n const prevFocusable = findPrevFocusable(state.triggerRef.current);\n prevFocusable?.focus();\n }, [findPrevFocusable, state.triggerRef]);\n\n React.useEffect(() => {\n if (open) {\n focusFirst();\n } else {\n if (shouldHandleCloseRef.current) {\n if (shouldHandleTabRef.current && !state.isSubmenu) {\n pressedShiftRef.current ? focusBeforeMenuTrigger() : focusAfterMenuTrigger();\n } else {\n state.triggerRef.current?.focus();\n }\n }\n }\n\n shouldHandleCloseRef.current = false;\n shouldHandleTabRef.current = false;\n pressedShiftRef.current = false;\n }, [state.triggerRef, state.isSubmenu, open, focusFirst, focusAfterMenuTrigger, focusBeforeMenuTrigger]);\n\n return [open, setOpen] as const;\n};\n"]}
|
@@ -0,0 +1,28 @@
|
|
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, 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
|
+
onCheckedValueChange: onCheckedValueChange,
|
16
|
+
open: open,
|
17
|
+
openOnContext: openOnContext,
|
18
|
+
openOnHover: openOnHover,
|
19
|
+
persistOnItemClick: persistOnItemClick,
|
20
|
+
setOpen: setOpen,
|
21
|
+
triggerId: triggerId,
|
22
|
+
triggerRef: triggerRef,
|
23
|
+
};
|
24
|
+
return { menu: menu };
|
25
|
+
}
|
26
|
+
exports.useMenuContextValues_unstable = useMenuContextValues_unstable;
|
27
|
+
});
|
28
|
+
//# sourceMappingURL=useMenuContextValues.js.map
|
@@ -0,0 +1 @@
|
|
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,GAcX,KAAK,cAdM,EACb,aAAa,GAaX,KAAK,cAbM,EACb,QAAQ,GAYN,KAAK,SAZC,EACR,MAAM,GAWJ,KAAK,OAXD,EACN,SAAS,GAUP,KAAK,UAVE,EACT,cAAc,GASZ,KAAK,eATO,EACd,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,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;IArCD,sEAqCC","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 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 onCheckedValueChange,\n open,\n openOnContext,\n openOnHover,\n persistOnItemClick,\n setOpen,\n triggerId,\n triggerRef,\n };\n\n return { menu };\n}\n"]}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
define(["require", "exports", "react", "./useMenuDivider", "./useMenuDividerStyles", "./renderMenuDivider"], function (require, exports, React, useMenuDivider_1, useMenuDividerStyles_1, renderMenuDivider_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
|
+
return renderMenuDivider_1.renderMenuDivider_unstable(state);
|
12
|
+
});
|
13
|
+
exports.MenuDivider.displayName = 'MenuDivider';
|
14
|
+
});
|
15
|
+
//# sourceMappingURL=MenuDivider.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuDivider.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuDivider/MenuDivider.tsx"],"names":[],"mappings":";;;;IAOA;;OAEG;IACU,QAAA,WAAW,GAA0C,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAC5F,IAAM,KAAK,GAAG,wCAAuB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClD,oDAA6B,CAAC,KAAK,CAAC,CAAC;QAErC,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';\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 useMenuDividerStyles_unstable(state);\n\n return renderMenuDivider_unstable(state);\n});\n\nMenuDivider.displayName = 'MenuDivider';\n"]}
|
@@ -0,0 +1 @@
|
|
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"]}
|