@fluentui/react-menu 9.14.9 → 9.14.11
Sign up to get free protection for your applications and to get access to all the features.
- 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/MenuItemLink.js.map +1 -1
- package/lib/MenuItemRadio.js.map +1 -1
- package/lib/MenuItemSwitch.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.map +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.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.map +1 -1
- package/lib/components/MenuDivider/useMenuDivider.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.map +1 -1
- package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroupContextValues.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.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.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.map +1 -1
- package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
- package/lib/components/MenuItem/useMenuItem.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.map +1 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemLink/MenuItemLink.js +2 -0
- package/lib/components/MenuItemLink/MenuItemLink.js.map +1 -1
- package/lib/components/MenuItemLink/MenuItemLink.types.js +3 -1
- package/lib/components/MenuItemLink/MenuItemLink.types.js.map +1 -1
- package/lib/components/MenuItemLink/index.js.map +1 -1
- package/lib/components/MenuItemLink/renderMenuItemLink.js.map +1 -1
- package/lib/components/MenuItemLink/useMenuItemLink.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.map +1 -1
- package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemSwitch/MenuItemSwitch.js.map +1 -1
- package/lib/components/MenuItemSwitch/MenuItemSwitch.types.js +3 -1
- package/lib/components/MenuItemSwitch/MenuItemSwitch.types.js.map +1 -1
- package/lib/components/MenuItemSwitch/index.js.map +1 -1
- package/lib/components/MenuItemSwitch/renderMenuItemSwitch.js.map +1 -1
- package/lib/components/MenuItemSwitch/useMenuItemSwitch.js.map +1 -1
- package/lib/components/MenuList/MenuList.js.map +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.map +1 -1
- package/lib/components/MenuList/useMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/MenuPopover.types.js +3 -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.map +1 -1
- package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js +3 -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.map +1 -1
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.js.map +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.map +1 -1
- package/lib/contexts/menuGroupContext.js.map +1 -1
- package/lib/contexts/menuListContext.js.map +1 -1
- 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.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/useIsSubmenu.js.map +1 -1
- package/lib/utils/useOnMenuEnter.js.map +1 -1
- package/lib-commonjs/Menu.js.map +1 -1
- package/lib-commonjs/MenuDivider.js.map +1 -1
- package/lib-commonjs/MenuGroup.js.map +1 -1
- package/lib-commonjs/MenuGroupHeader.js.map +1 -1
- package/lib-commonjs/MenuItem.js.map +1 -1
- package/lib-commonjs/MenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/MenuItemLink.js.map +1 -1
- package/lib-commonjs/MenuItemRadio.js.map +1 -1
- package/lib-commonjs/MenuItemSwitch.js.map +1 -1
- package/lib-commonjs/MenuList.js.map +1 -1
- package/lib-commonjs/MenuPopover.js.map +1 -1
- package/lib-commonjs/MenuSplitGroup.js.map +1 -1
- package/lib-commonjs/MenuTrigger.js.map +1 -1
- package/lib-commonjs/components/Menu/Menu.js.map +1 -1
- package/lib-commonjs/components/Menu/Menu.types.js.map +1 -1
- package/lib-commonjs/components/Menu/index.js.map +1 -1
- package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/MenuDivider.types.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/index.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/MenuGroup.types.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/index.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.types.js.map +1 -1
- package/lib-commonjs/components/MenuItem/index.js.map +1 -1
- package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuItemLink/MenuItemLink.js +2 -0
- package/lib-commonjs/components/MenuItemLink/MenuItemLink.js.map +1 -1
- package/lib-commonjs/components/MenuItemLink/MenuItemLink.types.js +3 -1
- package/lib-commonjs/components/MenuItemLink/MenuItemLink.types.js.map +1 -1
- package/lib-commonjs/components/MenuItemLink/index.js.map +1 -1
- package/lib-commonjs/components/MenuItemLink/renderMenuItemLink.js.map +1 -1
- package/lib-commonjs/components/MenuItemLink/useMenuItemLink.js.map +1 -1
- package/lib-commonjs/components/MenuItemLink/useMenuItemLinkStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuItemSwitch/MenuItemSwitch.js.map +1 -1
- package/lib-commonjs/components/MenuItemSwitch/MenuItemSwitch.types.js +3 -1
- package/lib-commonjs/components/MenuItemSwitch/MenuItemSwitch.types.js.map +1 -1
- package/lib-commonjs/components/MenuItemSwitch/index.js.map +1 -1
- package/lib-commonjs/components/MenuItemSwitch/renderMenuItemSwitch.js.map +1 -1
- package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitch.js.map +1 -1
- package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js +3 -3
- package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/MenuList.types.js.map +1 -1
- package/lib-commonjs/components/MenuList/index.js.map +1 -1
- package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/MenuPopover.types.js +3 -1
- package/lib-commonjs/components/MenuPopover/MenuPopover.types.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/index.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js +3 -1
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib-commonjs/components/index.js.map +1 -1
- package/lib-commonjs/contexts/menuContext.js.map +1 -1
- package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
- package/lib-commonjs/contexts/menuListContext.js.map +1 -1
- package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
- package/lib-commonjs/index.js +136 -136
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/selectable/index.js.map +1 -1
- package/lib-commonjs/selectable/types.js.map +1 -1
- package/lib-commonjs/selectable/useCheckmarkStyles.styles.js.map +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
- package/lib-commonjs/utils/useOnMenuEnter.js +3 -3
- package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
- package/package.json +9 -9
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useMenuTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport { useFocusFinders, useRestoreFocusTarget } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowRight, ArrowLeft, Escape, ArrowDown } from '@fluentui/keyboard-keys';\nimport { applyTriggerPropsToChildren, getTriggerChild, isHTMLElement, mergeCallbacks, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n/**\n * Create the state required to render MenuTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup menu\n *\n * @param props - props from this instance of MenuTrigger\n */ export const useMenuTrigger_unstable = (props)=>{\n const { children, disableButtonEnhancement = false } = props;\n const triggerRef = useMenuContext_unstable((context)=>context.triggerRef);\n const menuPopoverRef = useMenuContext_unstable((context)=>context.menuPopoverRef);\n const setOpen = useMenuContext_unstable((context)=>context.setOpen);\n const open = useMenuContext_unstable((context)=>context.open);\n const triggerId = useMenuContext_unstable((context)=>context.triggerId);\n const openOnHover = useMenuContext_unstable((context)=>context.openOnHover);\n const openOnContext = useMenuContext_unstable((context)=>context.openOnContext);\n const restoreFocusTargetAttribute = useRestoreFocusTarget();\n const isSubmenu = useIsSubmenu();\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(()=>{\n const firstFocusable = findFirstFocusable(menuPopoverRef.current);\n firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();\n }, [\n findFirstFocusable,\n menuPopoverRef\n ]);\n const openedWithKeyboardRef = React.useRef(false);\n const hasMouseMoved = React.useRef(false);\n const { dir } = useFluent();\n const OpenArrowKey = dir === 'ltr' ? ArrowRight : ArrowLeft;\n const child = getTriggerChild(children);\n const onContextMenu = (event)=>{\n if (isTargetDisabled(event) || event.isDefaultPrevented()) {\n return;\n }\n if (openOnContext) {\n event.preventDefault();\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerContextMenu',\n event\n });\n }\n };\n const onClick = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (!openOnContext) {\n setOpen(event, {\n open: !open,\n keyboard: openedWithKeyboardRef.current,\n type: 'menuTriggerClick',\n event\n });\n openedWithKeyboardRef.current = false;\n }\n };\n const onKeyDown = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n const key = event.key;\n if (!openOnContext && (isSubmenu && key === OpenArrowKey || !isSubmenu && key === ArrowDown)) {\n setOpen(event, {\n open: true,\n keyboard: true,\n type: 'menuTriggerKeyDown',\n event\n });\n }\n if (key === Escape && !isSubmenu) {\n setOpen(event, {\n open: false,\n keyboard: true,\n type: 'menuTriggerKeyDown',\n event\n });\n }\n // if menu is already open, can't rely on effects to focus\n if (open && key === OpenArrowKey && isSubmenu) {\n focusFirst();\n }\n };\n const onMouseEnter = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && hasMouseMoved.current) {\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerMouseEnter',\n event\n });\n }\n };\n // Opening a menu when a mouse hasn't moved and just entering the trigger is a bad a11y experience\n // First time open the mouse using mousemove and then continue with mouseenter\n // Only use once to determine that the user is using the mouse since it is an expensive event to handle\n const onMouseMove = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && !hasMouseMoved.current) {\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerMouseMove',\n event\n });\n hasMouseMoved.current = true;\n }\n };\n const onMouseLeave = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover) {\n setOpen(event, {\n open: false,\n keyboard: false,\n type: 'menuTriggerMouseLeave',\n event\n });\n }\n };\n const contextMenuProps = {\n id: triggerId,\n ...restoreFocusTargetAttribute,\n ...child === null || child === void 0 ? void 0 : child.props,\n ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref),\n onMouseEnter: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)),\n onMouseMove: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseMove, onMouseMove))\n };\n const triggerChildProps = {\n 'aria-haspopup': 'menu',\n 'aria-expanded': !open && !isSubmenu ? undefined : open,\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))\n };\n const ariaButtonTriggerChildProps = useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', triggerChildProps);\n return {\n isSubmenu,\n children: applyTriggerPropsToChildren(children, openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps)\n };\n};\nconst isTargetDisabled = (event)=>{\n const isDisabled = (el)=>el.hasAttribute('disabled') || el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') === 'true';\n if (isHTMLElement(event.target) && isDisabled(event.target)) {\n return true;\n }\n return isHTMLElement(event.currentTarget) && isDisabled(event.currentTarget);\n};\n"],"names":["useMenuTrigger_unstable","props","children","disableButtonEnhancement","triggerRef","useMenuContext_unstable","context","menuPopoverRef","setOpen","open","triggerId","openOnHover","openOnContext","restoreFocusTargetAttribute","useRestoreFocusTarget","isSubmenu","useIsSubmenu","findFirstFocusable","useFocusFinders","focusFirst","React","useCallback","firstFocusable","current","focus","openedWithKeyboardRef","useRef","hasMouseMoved","dir","useFluent","OpenArrowKey","ArrowRight","ArrowLeft","child","getTriggerChild","onContextMenu","event","isTargetDisabled","isDefaultPrevented","preventDefault","keyboard","type","onClick","onKeyDown","key","ArrowDown","Escape","onMouseEnter","onMouseMove","onMouseLeave","contextMenuProps","id","ref","useMergedRefs","useEventCallback","mergeCallbacks","triggerChildProps","undefined","ariaButtonTriggerChildProps","useARIAButtonProps","applyTriggerPropsToChildren","isDisabled","el","hasAttribute","getAttribute","isHTMLElement","target","currentTarget"],"mappings":";;;;+BAaiBA;;;eAAAA;;;;iEAbM;6BACiB;8BACX;8BAC0B;qCACP;8BACS;gCACoE;2BAC1F;AAMxB,MAAMA,0BAA0B,CAACC;IACxC,MAAM,EAAEC,QAAQ,EAAEC,2BAA2B,KAAK,EAAE,GAAGF;IACvD,MAAMG,aAAaC,IAAAA,oCAAuB,EAAC,CAACC,UAAUA,QAAQF,UAAU;IACxE,MAAMG,iBAAiBF,IAAAA,oCAAuB,EAAC,CAACC,UAAUA,QAAQC,cAAc;IAChF,MAAMC,UAAUH,IAAAA,oCAAuB,EAAC,CAACC,UAAUA,QAAQE,OAAO;IAClE,MAAMC,OAAOJ,IAAAA,oCAAuB,EAAC,CAACC,UAAUA,QAAQG,IAAI;IAC5D,MAAMC,YAAYL,IAAAA,oCAAuB,EAAC,CAACC,UAAUA,QAAQI,SAAS;IACtE,MAAMC,cAAcN,IAAAA,oCAAuB,EAAC,CAACC,UAAUA,QAAQK,WAAW;IAC1E,MAAMC,gBAAgBP,IAAAA,oCAAuB,EAAC,CAACC,UAAUA,QAAQM,aAAa;IAC9E,MAAMC,8BAA8BC,IAAAA,mCAAqB;IACzD,MAAMC,YAAYC,IAAAA,0BAAY;IAC9B,MAAM,EAAEC,kBAAkB,EAAE,GAAGC,IAAAA,6BAAe;IAC9C,MAAMC,aAAaC,OAAMC,WAAW,CAAC;QACjC,MAAMC,iBAAiBL,mBAAmBV,eAAegB,OAAO;QAChED,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeE,KAAK;IACxF,GAAG;Q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6BAAa,EAAC7B,MAAM+B,aAAa,KAAKN,WAAWzB,MAAM+B,aAAa;AAC/E"}
|
1
|
+
{"version":3,"sources":["useMenuTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport { MenuTriggerProps, MenuTriggerState } from './MenuTrigger.types';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport { useFocusFinders, useRestoreFocusTarget } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowRight, ArrowLeft, Escape, ArrowDown } from '@fluentui/keyboard-keys';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n isHTMLElement,\n mergeCallbacks,\n useEventCallback,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n\n/**\n * Create the state required to render MenuTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup menu\n *\n * @param props - props from this instance of MenuTrigger\n */\nexport const useMenuTrigger_unstable = (props: MenuTriggerProps): MenuTriggerState => {\n const { children, disableButtonEnhancement = false } = props;\n\n const triggerRef = useMenuContext_unstable(context => context.triggerRef);\n const menuPopoverRef = useMenuContext_unstable(context => context.menuPopoverRef);\n const setOpen = useMenuContext_unstable(context => context.setOpen);\n const open = useMenuContext_unstable(context => context.open);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const openOnHover = useMenuContext_unstable(context => context.openOnHover);\n const openOnContext = useMenuContext_unstable(context => context.openOnContext);\n const restoreFocusTargetAttribute = useRestoreFocusTarget();\n\n const isSubmenu = useIsSubmenu();\n\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(() => {\n const firstFocusable = findFirstFocusable(menuPopoverRef.current);\n firstFocusable?.focus();\n }, [findFirstFocusable, menuPopoverRef]);\n\n const openedWithKeyboardRef = React.useRef(false);\n const hasMouseMoved = React.useRef(false);\n\n const { dir } = useFluent();\n const OpenArrowKey = dir === 'ltr' ? ArrowRight : ArrowLeft;\n\n const child = getTriggerChild(children);\n\n const onContextMenu = (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event) || event.isDefaultPrevented()) {\n return;\n }\n\n if (openOnContext) {\n event.preventDefault();\n setOpen(event, { open: true, keyboard: false, type: 'menuTriggerContextMenu', event });\n }\n };\n\n const onClick = (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event)) {\n return;\n }\n\n if (!openOnContext) {\n setOpen(event, { open: !open, keyboard: openedWithKeyboardRef.current, type: 'menuTriggerClick', event });\n openedWithKeyboardRef.current = false;\n }\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event)) {\n return;\n }\n\n const key = event.key;\n\n if (!openOnContext && ((isSubmenu && key === OpenArrowKey) || (!isSubmenu && key === ArrowDown))) {\n setOpen(event, { open: true, keyboard: true, type: 'menuTriggerKeyDown', event });\n }\n\n if (key === Escape && !isSubmenu) {\n setOpen(event, { open: false, keyboard: true, type: 'menuTriggerKeyDown', event });\n }\n\n // if menu is already open, can't rely on effects to focus\n if (open && key === OpenArrowKey && isSubmenu) {\n focusFirst();\n }\n };\n\n const onMouseEnter = (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && hasMouseMoved.current) {\n setOpen(event, { open: true, keyboard: false, type: 'menuTriggerMouseEnter', event });\n }\n };\n\n // Opening a menu when a mouse hasn't moved and just entering the trigger is a bad a11y experience\n // First time open the mouse using mousemove and then continue with mouseenter\n // Only use once to determine that the user is using the mouse since it is an expensive event to handle\n const onMouseMove = (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && !hasMouseMoved.current) {\n setOpen(event, { open: true, keyboard: false, type: 'menuTriggerMouseMove', event });\n hasMouseMoved.current = true;\n }\n };\n\n const onMouseLeave = (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover) {\n setOpen(event, { open: false, keyboard: false, type: 'menuTriggerMouseLeave', event });\n }\n };\n\n const contextMenuProps = {\n id: triggerId,\n ...restoreFocusTargetAttribute,\n ...child?.props,\n ref: useMergedRefs(triggerRef, child?.ref),\n onMouseEnter: useEventCallback(mergeCallbacks(child?.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child?.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child?.props.onContextMenu, onContextMenu)),\n onMouseMove: useEventCallback(mergeCallbacks(child?.props.onMouseMove, onMouseMove)),\n };\n\n const triggerChildProps = {\n 'aria-haspopup': 'menu',\n 'aria-expanded': !open && !isSubmenu ? undefined : open,\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child?.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child?.props.onKeyDown, onKeyDown)),\n } as const;\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n triggerChildProps,\n );\n\n return {\n isSubmenu,\n children: applyTriggerPropsToChildren(\n children,\n openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n\nconst isTargetDisabled = (event: React.SyntheticEvent | Event) => {\n const isDisabled = (el: HTMLElement) =>\n el.hasAttribute('disabled') || (el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') === 'true');\n if (isHTMLElement(event.target) && isDisabled(event.target)) {\n return true;\n }\n\n return isHTMLElement(event.currentTarget) && isDisabled(event.currentTarget);\n};\n"],"names":["useMenuTrigger_unstable","props","children","disableButtonEnhancement","triggerRef","useMenuContext_unstable","context","menuPopoverRef","setOpen","open","triggerId","openOnHover","openOnContext","restoreFocusTargetAttribute","useRestoreFocusTarget","isSubmenu","useIsSubmenu","findFirstFocusable","useFocusFinders","focusFirst","React","useCallback","firstFocusable","current","focus","openedWithKeyboardRef","useRef","hasMouseMoved","dir","useFluent","OpenArrowKey","ArrowRight","ArrowLeft","child","getTriggerChild","onContextMenu","event","isTargetDisabled","isDefaultPrevented","preventDefault","keyboard","type","onClick","onKeyDown","key","ArrowDown","Escape","onMouseEnter","onMouseMove","onMouseLeave","contextMenuProps","id","ref","useMergedRefs","useEventCallback","mergeCallbacks","triggerChildProps","undefined","ariaButtonTriggerChildProps","useARIAButtonProps","applyTriggerPropsToChildren","isDisabled","el","hasAttribute","getAttribute","isHTMLElement","target","currentTarget"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAuBaA;;;eAAAA;;;;iEAvBU;6BAEiB;8BACX;8BAC0B;qCACP;8BACS;gCAQlD;2BAC4B;AAQ5B,MAAMA,0BAA0B,CAACC;IACtC,MAAM,EAAEC,QAAQ,EAAEC,2BAA2B,KAAK,EAAE,GAAGF;IAEvD,MAAMG,aAAaC,IAAAA,oCAAAA,EAAwBC,CAAAA,UAAWA,QAAQF,UAAU;IACxE,MAAMG,iBAAiBF,IAAAA,oCAAAA,EAAwBC,CAAAA,UAAWA,QAAQC,cAAc;IAChF,MAAMC,UAAUH,IAAAA,oCAAAA,EAAwBC,CAAAA,UAAWA,QAAQE,OAAO;IAClE,MAAMC,OAAOJ,IAAAA,oCAAAA,EAAwBC,CAAAA,UAAWA,QAAQG,IAAI;IAC5D,MAAMC,YAAYL,IAAAA,oCAAAA,EAAwB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,6BAAAA,EAClC1B,CAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOQ,IAAI,AAAJA,MAAS,YAAYR,CAAAA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOQ,IAAI,AAAJA,MAAS,MAAMR,MAAMQ,IAAI,GAAG,OAC/De;IAGF,OAAO;QACLzC;QACAb,UAAU0D,IAAAA,2CAAAA,EACR1D,UACAU,gBAAgBsC,mBAAmB/C,2BAA2BqD,oBAAoBE;IAEtF;AACF;AAEA,MAAMrB,mBAAmB,CAACD;IACxB,MAAMyB,aAAa,CAACC,KAClBA,GAAGC,YAAY,CAAC,eAAgBD,GAAGC,YAAY,CAAC,oBAAoBD,GAAGE,YAAY,CAAC,qBAAqB;IAC3G,IAAIC,IAAAA,6BAAAA,EAAc7B,MAAM8B,MAAM,KAAKL,WAAWzB,MAAM8B,MAAM,GAAG;QAC3D,OAAO;IACT;IAEA,OAAOD,IAAAA,6BAAAA,EAAc7B,MAAM+B,aAAa,KAAKN,WAAWzB,MAAM+B,aAAa;AAC7E"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './MenuItem/index';\nexport * from './MenuList/index';\n"],"names":[],"rangeMappings":";;;;;;","mappings":";;;;;uBAAc;uBACA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["menuContext.
|
1
|
+
{"version":3,"sources":["menuContext.ts"],"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 { MenuState } from '../components/Menu/index';\n\nexport const MenuContext: Context<MenuContextValue> = createContext<MenuContextValue | undefined>(\n undefined,\n) as Context<MenuContextValue>;\n\nconst menuContextDefaultValue: MenuContextValue = {\n open: false,\n setOpen: () => false,\n checkedValues: {},\n onCheckedValueChange: () => null,\n isSubmenu: false,\n triggerRef: { current: null } as unknown as React.MutableRefObject<HTMLElement>,\n menuPopoverRef: { current: null } as unknown as React.MutableRefObject<HTMLElement>,\n mountNode: null,\n triggerId: '',\n openOnContext: false,\n openOnHover: false,\n hasIcons: false,\n hasCheckmarks: false,\n inline: false,\n persistOnItemClick: false,\n};\n\n/**\n * Context shared between Menu and its children components\n *\n * Extends and drills down MenuList props to simplify API\n */\nexport type MenuContextValue = Pick<\n MenuState,\n | 'openOnHover'\n | 'openOnContext'\n | 'triggerRef'\n | 'menuPopoverRef'\n | 'setOpen'\n | 'isSubmenu'\n | 'mountNode'\n | 'triggerId'\n | 'hasIcons'\n | 'hasCheckmarks'\n | 'persistOnItemClick'\n | 'inline'\n | 'checkedValues'\n | 'onCheckedValueChange'\n> & {\n open: boolean;\n triggerId: string;\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 const MenuProvider = MenuContext.Provider;\n\nexport const useMenuContext_unstable = <T>(selector: ContextSelector<MenuContextValue, T>) =>\n useContextSelector(MenuContext, (ctx = menuContextDefaultValue) => selector(ctx));\n"],"names":["MenuContext","MenuProvider","useMenuContext_unstable","createContext","undefined","menuContextDefaultValue","open","setOpen","checkedValues","onCheckedValueChange","isSubmenu","triggerRef","current","menuPopoverRef","mountNode","triggerId","openOnContext","openOnHover","hasIcons","hasCheckmarks","inline","persistOnItemClick","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAKaA,WAAAA;eAAAA;;IAsDAC,YAAAA;eAAAA;;IAEAC,uBAAAA;eAAAA;;;;iEA7DU;sCAC2B;AAI3C,MAAMF,cAAyCG,IAAAA,mCAAAA,EACpDC;AAGF,MAAMC,0BAA4C;IAChDC,MAAM;IACNC,SAAS,IAAM;IACfC,eAAe,CAAC;IAChBC,sBAAsB,IAAM;IAC5BC,WAAW;IACXC,YAAY;QAAEC,SAAS;IAAK;IAC5BC,gBAAgB;QAAED,SAAS;IAAK;IAChCE,WAAW;IACXC,WAAW;IACXC,eAAe;IACfC,aAAa;IACbC,UAAU;IACVC,eAAe;IACfC,QAAQ;IACRC,oBAAoB;AACtB;AAkCO,MAAMpB,eAAeD,YAAYsB,QAAQ;AAEzC,MAAMpB,0BAA0B,CAAIqB,WACzCC,IAAAA,wCAAAA,EAAmBxB,aAAa,CAACyB,MAAMpB,uBAAuB,GAAKkB,SAASE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["menuGroupContext.
|
1
|
+
{"version":3,"sources":["menuGroupContext.ts"],"sourcesContent":["import * as React from 'react';\n\nconst MenuGroupContext = React.createContext<MenuGroupContextValue | undefined>(\n undefined,\n) as React.Context<MenuGroupContextValue>;\n\nconst menuGroupContextDefaultValue: MenuGroupContextValue = {\n headerId: '',\n};\n\n/**\n * Context used to guarantee correct aria-relationship between header\n * and group information\n */\nexport type MenuGroupContextValue = {\n /**\n * Element id applied to the `MenuGroupHeader` component\n */\n headerId: string;\n};\n\nexport const MenuGroupContextProvider = MenuGroupContext.Provider;\nexport const useMenuGroupContext_unstable = () => React.useContext(MenuGroupContext) ?? menuGroupContextDefaultValue;\n"],"names":["MenuGroupContextProvider","useMenuGroupContext_unstable","MenuGroupContext","React","createContext","undefined","menuGroupContextDefaultValue","headerId","Provider","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAqBaA,wBAAAA;eAAAA;;IACAC,4BAAAA;eAAAA;;;;iEAtBU;AAEvB,MAAMC,iCAAmBC,OAAMC,aAAa,CAC1CC;AAGF,MAAMC,+BAAsD;IAC1DC,UAAU;AACZ;AAaO,MAAMP,2BAA2BE,iBAAiBM,QAAQ;AAC1D,MAAMP,+BAA+B;QAAME;WAAAA,CAAAA,oBAAAA,OAAMM,UAAU,CAACP,iBAAAA,MAAAA,QAAjBC,sBAAAA,KAAAA,IAAAA,oBAAsCG;AAA2B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["menuListContext.
|
1
|
+
{"version":3,"sources":["menuListContext.tsx"],"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"],"names":["MenuListContext","MenuListProvider","useMenuListContext_unstable","createContext","undefined","menuListContextDefaultValue","checkedValues","setFocusByFirstCharacter","toggleCheckbox","selectRadio","hasIcons","hasCheckmarks","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAMaA,eAAAA;eAAAA;;IAgCAC,gBAAAA;eAAAA;;IAEAC,2BAAAA;eAAAA;;;;iEAxCU;sCAC2B;AAK3C,MAAMF,kBAAiDG,IAAAA,mCAAAA,EAC5DC;AAGF,MAAMC,8BAAoD;IACxDC,eAAe,CAAC;IAChBC,0BAA0B,IAAM;IAChCC,gBAAgB,IAAM;IACtBC,aAAa,IAAM;IACnBC,UAAU;IACVC,eAAe;AACjB;AAqBO,MAAMV,mBAAmBD,gBAAgBY,QAAQ;AAEjD,MAAMV,8BAA8B,CAAKW,WAC9CC,IAAAA,wCAAAA,EAAmBd,iBAAiB,CAACe,MAAMV,2BAA2B,GAAKQ,SAASE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["menuTriggerContext.
|
1
|
+
{"version":3,"sources":["menuTriggerContext.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Context used communicate with a child menu item that it is a trigger for a submenu\n */\nconst MenuTriggerContext = React.createContext<boolean | undefined>(undefined) as React.Context<boolean>;\n\nconst menuTriggerContextDefaultValue = false;\n\nexport const MenuTriggerContextProvider = MenuTriggerContext.Provider;\nexport const useMenuTriggerContext_unstable = () =>\n React.useContext(MenuTriggerContext) ?? menuTriggerContextDefaultValue;\n"],"names":["MenuTriggerContextProvider","useMenuTriggerContext_unstable","MenuTriggerContext","React","createContext","undefined","menuTriggerContextDefaultValue","Provider","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IASaA,0BAAAA;eAAAA;;IACAC,8BAAAA;eAAAA;;;;iEAVU;AAEvB;;CAEC,GACD,MAAMC,mCAAqBC,OAAMC,aAAa,CAAsBC;AAEpE,MAAMC,iCAAiC;AAEhC,MAAMN,6BAA6BE,mBAAmBK,QAAQ;AAC9D,MAAMN,iCAAiC;QAC5CE;WAAAA,CAAAA,oBAAAA,OAAMK,UAAU,CAACN,mBAAAA,MAAAA,QAAjBC,sBAAAA,KAAAA,IAAAA,oBAAwCG;AAA6B"}
|
package/lib-commonjs/index.js
CHANGED
@@ -9,113 +9,167 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
|
13
|
-
return
|
12
|
+
MENU_ENTER_EVENT: function() {
|
13
|
+
return _utils.MENU_ENTER_EVENT;
|
14
14
|
},
|
15
|
-
|
16
|
-
return
|
15
|
+
Menu: function() {
|
16
|
+
return _Menu.Menu;
|
17
17
|
},
|
18
|
-
|
19
|
-
return
|
18
|
+
MenuDivider: function() {
|
19
|
+
return _MenuDivider.MenuDivider;
|
20
20
|
},
|
21
|
-
|
22
|
-
return
|
21
|
+
MenuGroup: function() {
|
22
|
+
return _MenuGroup.MenuGroup;
|
23
23
|
},
|
24
24
|
MenuGroupContextProvider: function() {
|
25
25
|
return _menuGroupContext.MenuGroupContextProvider;
|
26
26
|
},
|
27
|
-
|
28
|
-
return
|
27
|
+
MenuGroupHeader: function() {
|
28
|
+
return _MenuGroupHeader.MenuGroupHeader;
|
29
|
+
},
|
30
|
+
MenuItem: function() {
|
31
|
+
return _MenuItem.MenuItem;
|
32
|
+
},
|
33
|
+
MenuItemCheckbox: function() {
|
34
|
+
return _MenuItemCheckbox.MenuItemCheckbox;
|
35
|
+
},
|
36
|
+
MenuItemLink: function() {
|
37
|
+
return _MenuItemLink.MenuItemLink;
|
38
|
+
},
|
39
|
+
MenuItemRadio: function() {
|
40
|
+
return _MenuItemRadio.MenuItemRadio;
|
41
|
+
},
|
42
|
+
MenuItemSwitch: function() {
|
43
|
+
return _MenuItemSwitch.MenuItemSwitch;
|
44
|
+
},
|
45
|
+
MenuList: function() {
|
46
|
+
return _MenuList.MenuList;
|
29
47
|
},
|
30
48
|
MenuListProvider: function() {
|
31
49
|
return _menuListContext.MenuListProvider;
|
32
50
|
},
|
33
|
-
|
34
|
-
return
|
51
|
+
MenuPopover: function() {
|
52
|
+
return _MenuPopover.MenuPopover;
|
35
53
|
},
|
36
|
-
|
37
|
-
return
|
54
|
+
MenuProvider: function() {
|
55
|
+
return _menuContext.MenuProvider;
|
38
56
|
},
|
39
|
-
|
40
|
-
return
|
57
|
+
MenuSplitGroup: function() {
|
58
|
+
return _MenuSplitGroup.MenuSplitGroup;
|
41
59
|
},
|
42
|
-
|
43
|
-
return
|
60
|
+
MenuTrigger: function() {
|
61
|
+
return _MenuTrigger.MenuTrigger;
|
44
62
|
},
|
45
|
-
|
46
|
-
return
|
63
|
+
MenuTriggerContextProvider: function() {
|
64
|
+
return _menuTriggerContext.MenuTriggerContextProvider;
|
47
65
|
},
|
48
|
-
|
49
|
-
return
|
66
|
+
dispatchMenuEnterEvent: function() {
|
67
|
+
return _utils.dispatchMenuEnterEvent;
|
50
68
|
},
|
51
69
|
menuDividerClassNames: function() {
|
52
70
|
return _MenuDivider.menuDividerClassNames;
|
53
71
|
},
|
54
|
-
|
55
|
-
return
|
72
|
+
menuGroupClassNames: function() {
|
73
|
+
return _MenuGroup.menuGroupClassNames;
|
56
74
|
},
|
57
|
-
|
58
|
-
return
|
75
|
+
menuGroupHeaderClassNames: function() {
|
76
|
+
return _MenuGroupHeader.menuGroupHeaderClassNames;
|
59
77
|
},
|
60
|
-
|
61
|
-
return
|
78
|
+
menuItemCheckboxClassNames: function() {
|
79
|
+
return _MenuItemCheckbox.menuItemCheckboxClassNames;
|
62
80
|
},
|
63
|
-
|
64
|
-
return
|
81
|
+
menuItemClassNames: function() {
|
82
|
+
return _MenuItem.menuItemClassNames;
|
65
83
|
},
|
66
|
-
|
67
|
-
return
|
84
|
+
menuItemLinkClassNames: function() {
|
85
|
+
return _MenuItemLink.menuItemLinkClassNames;
|
68
86
|
},
|
69
|
-
|
70
|
-
return
|
87
|
+
menuItemRadioClassNames: function() {
|
88
|
+
return _MenuItemRadio.menuItemRadioClassNames;
|
71
89
|
},
|
72
|
-
|
73
|
-
return
|
90
|
+
menuItemSwitchClassNames: function() {
|
91
|
+
return _MenuItemSwitch.menuItemSwitchClassNames;
|
74
92
|
},
|
75
|
-
|
76
|
-
return
|
93
|
+
menuListClassNames: function() {
|
94
|
+
return _MenuList.menuListClassNames;
|
77
95
|
},
|
78
|
-
|
79
|
-
return
|
96
|
+
menuPopoverClassNames: function() {
|
97
|
+
return _MenuPopover.menuPopoverClassNames;
|
80
98
|
},
|
81
|
-
|
82
|
-
return
|
99
|
+
menuSplitGroupClassNames: function() {
|
100
|
+
return _MenuSplitGroup.menuSplitGroupClassNames;
|
83
101
|
},
|
84
|
-
|
85
|
-
return
|
102
|
+
renderMenuDivider_unstable: function() {
|
103
|
+
return _MenuDivider.renderMenuDivider_unstable;
|
86
104
|
},
|
87
105
|
renderMenuGroupHeader_unstable: function() {
|
88
106
|
return _MenuGroupHeader.renderMenuGroupHeader_unstable;
|
89
107
|
},
|
90
|
-
|
91
|
-
return
|
108
|
+
renderMenuGroup_unstable: function() {
|
109
|
+
return _MenuGroup.renderMenuGroup_unstable;
|
92
110
|
},
|
93
|
-
|
94
|
-
return
|
111
|
+
renderMenuItemCheckbox_unstable: function() {
|
112
|
+
return _MenuItemCheckbox.renderMenuItemCheckbox_unstable;
|
95
113
|
},
|
96
|
-
|
97
|
-
return
|
114
|
+
renderMenuItemLink_unstable: function() {
|
115
|
+
return _MenuItemLink.renderMenuItemLink_unstable;
|
98
116
|
},
|
99
|
-
|
100
|
-
return
|
117
|
+
renderMenuItemRadio_unstable: function() {
|
118
|
+
return _MenuItemRadio.renderMenuItemRadio_unstable;
|
119
|
+
},
|
120
|
+
renderMenuItemSwitch_unstable: function() {
|
121
|
+
return _MenuItemSwitch.renderMenuItemSwitch_unstable;
|
101
122
|
},
|
102
123
|
renderMenuItem_unstable: function() {
|
103
124
|
return _MenuItem.renderMenuItem_unstable;
|
104
125
|
},
|
105
|
-
|
106
|
-
return
|
126
|
+
renderMenuList_unstable: function() {
|
127
|
+
return _MenuList.renderMenuList_unstable;
|
107
128
|
},
|
108
|
-
|
109
|
-
return
|
129
|
+
renderMenuPopover_unstable: function() {
|
130
|
+
return _MenuPopover.renderMenuPopover_unstable;
|
110
131
|
},
|
111
|
-
|
112
|
-
return
|
132
|
+
renderMenuSplitGroup_unstable: function() {
|
133
|
+
return _MenuSplitGroup.renderMenuSplitGroup_unstable;
|
113
134
|
},
|
114
|
-
|
115
|
-
return
|
135
|
+
renderMenuTrigger_unstable: function() {
|
136
|
+
return _MenuTrigger.renderMenuTrigger_unstable;
|
116
137
|
},
|
117
|
-
|
118
|
-
return
|
138
|
+
renderMenu_unstable: function() {
|
139
|
+
return _Menu.renderMenu_unstable;
|
140
|
+
},
|
141
|
+
useCheckmarkStyles_unstable: function() {
|
142
|
+
return _index.useCheckmarkStyles_unstable;
|
143
|
+
},
|
144
|
+
useMenuContextValues_unstable: function() {
|
145
|
+
return _Menu.useMenuContextValues_unstable;
|
146
|
+
},
|
147
|
+
useMenuContext_unstable: function() {
|
148
|
+
return _menuContext.useMenuContext_unstable;
|
149
|
+
},
|
150
|
+
useMenuDividerStyles_unstable: function() {
|
151
|
+
return _MenuDivider.useMenuDividerStyles_unstable;
|
152
|
+
},
|
153
|
+
useMenuDivider_unstable: function() {
|
154
|
+
return _MenuDivider.useMenuDivider_unstable;
|
155
|
+
},
|
156
|
+
useMenuGroupContextValues_unstable: function() {
|
157
|
+
return _MenuGroup.useMenuGroupContextValues_unstable;
|
158
|
+
},
|
159
|
+
useMenuGroupContext_unstable: function() {
|
160
|
+
return _menuGroupContext.useMenuGroupContext_unstable;
|
161
|
+
},
|
162
|
+
useMenuGroupHeaderStyles_unstable: function() {
|
163
|
+
return _MenuGroupHeader.useMenuGroupHeaderStyles_unstable;
|
164
|
+
},
|
165
|
+
useMenuGroupHeader_unstable: function() {
|
166
|
+
return _MenuGroupHeader.useMenuGroupHeader_unstable;
|
167
|
+
},
|
168
|
+
useMenuGroupStyles_unstable: function() {
|
169
|
+
return _MenuGroup.useMenuGroupStyles_unstable;
|
170
|
+
},
|
171
|
+
useMenuGroup_unstable: function() {
|
172
|
+
return _MenuGroup.useMenuGroup_unstable;
|
119
173
|
},
|
120
174
|
useMenuItemCheckboxStyles_unstable: function() {
|
121
175
|
return _MenuItemCheckbox.useMenuItemCheckboxStyles_unstable;
|
@@ -123,14 +177,11 @@ _export(exports, {
|
|
123
177
|
useMenuItemCheckbox_unstable: function() {
|
124
178
|
return _MenuItemCheckbox.useMenuItemCheckbox_unstable;
|
125
179
|
},
|
126
|
-
|
127
|
-
return
|
128
|
-
},
|
129
|
-
menuItemRadioClassNames: function() {
|
130
|
-
return _MenuItemRadio.menuItemRadioClassNames;
|
180
|
+
useMenuItemLinkStyles_unstable: function() {
|
181
|
+
return _MenuItemLink.useMenuItemLinkStyles_unstable;
|
131
182
|
},
|
132
|
-
|
133
|
-
return
|
183
|
+
useMenuItemLink_unstable: function() {
|
184
|
+
return _MenuItemLink.useMenuItemLink_unstable;
|
134
185
|
},
|
135
186
|
useMenuItemRadioStyles_unstable: function() {
|
136
187
|
return _MenuItemRadio.useMenuItemRadioStyles_unstable;
|
@@ -138,104 +189,53 @@ _export(exports, {
|
|
138
189
|
useMenuItemRadio_unstable: function() {
|
139
190
|
return _MenuItemRadio.useMenuItemRadio_unstable;
|
140
191
|
},
|
141
|
-
|
142
|
-
return
|
192
|
+
useMenuItemStyles_unstable: function() {
|
193
|
+
return _MenuItem.useMenuItemStyles_unstable;
|
143
194
|
},
|
144
|
-
|
145
|
-
return
|
195
|
+
useMenuItemSwitchStyles_unstable: function() {
|
196
|
+
return _MenuItemSwitch.useMenuItemSwitchStyles_unstable;
|
146
197
|
},
|
147
|
-
|
148
|
-
return
|
198
|
+
useMenuItemSwitch_unstable: function() {
|
199
|
+
return _MenuItemSwitch.useMenuItemSwitch_unstable;
|
200
|
+
},
|
201
|
+
useMenuItem_unstable: function() {
|
202
|
+
return _MenuItem.useMenuItem_unstable;
|
149
203
|
},
|
150
204
|
useMenuListContextValues_unstable: function() {
|
151
205
|
return _MenuList.useMenuListContextValues_unstable;
|
152
206
|
},
|
207
|
+
useMenuListContext_unstable: function() {
|
208
|
+
return _menuListContext.useMenuListContext_unstable;
|
209
|
+
},
|
153
210
|
useMenuListStyles_unstable: function() {
|
154
211
|
return _MenuList.useMenuListStyles_unstable;
|
155
212
|
},
|
156
213
|
useMenuList_unstable: function() {
|
157
214
|
return _MenuList.useMenuList_unstable;
|
158
215
|
},
|
159
|
-
MenuPopover: function() {
|
160
|
-
return _MenuPopover.MenuPopover;
|
161
|
-
},
|
162
|
-
menuPopoverClassNames: function() {
|
163
|
-
return _MenuPopover.menuPopoverClassNames;
|
164
|
-
},
|
165
|
-
renderMenuPopover_unstable: function() {
|
166
|
-
return _MenuPopover.renderMenuPopover_unstable;
|
167
|
-
},
|
168
216
|
useMenuPopoverStyles_unstable: function() {
|
169
217
|
return _MenuPopover.useMenuPopoverStyles_unstable;
|
170
218
|
},
|
171
219
|
useMenuPopover_unstable: function() {
|
172
220
|
return _MenuPopover.useMenuPopover_unstable;
|
173
221
|
},
|
174
|
-
MenuSplitGroup: function() {
|
175
|
-
return _MenuSplitGroup.MenuSplitGroup;
|
176
|
-
},
|
177
|
-
menuSplitGroupClassNames: function() {
|
178
|
-
return _MenuSplitGroup.menuSplitGroupClassNames;
|
179
|
-
},
|
180
|
-
renderMenuSplitGroup_unstable: function() {
|
181
|
-
return _MenuSplitGroup.renderMenuSplitGroup_unstable;
|
182
|
-
},
|
183
222
|
useMenuSplitGroupStyles_unstable: function() {
|
184
223
|
return _MenuSplitGroup.useMenuSplitGroupStyles_unstable;
|
185
224
|
},
|
186
225
|
useMenuSplitGroup_unstable: function() {
|
187
226
|
return _MenuSplitGroup.useMenuSplitGroup_unstable;
|
188
227
|
},
|
189
|
-
|
190
|
-
return
|
191
|
-
},
|
192
|
-
renderMenuTrigger_unstable: function() {
|
193
|
-
return _MenuTrigger.renderMenuTrigger_unstable;
|
228
|
+
useMenuTriggerContext_unstable: function() {
|
229
|
+
return _menuTriggerContext.useMenuTriggerContext_unstable;
|
194
230
|
},
|
195
231
|
useMenuTrigger_unstable: function() {
|
196
232
|
return _MenuTrigger.useMenuTrigger_unstable;
|
197
233
|
},
|
198
|
-
|
199
|
-
return
|
200
|
-
},
|
201
|
-
MenuItemLink: function() {
|
202
|
-
return _MenuItemLink.MenuItemLink;
|
203
|
-
},
|
204
|
-
menuItemLinkClassNames: function() {
|
205
|
-
return _MenuItemLink.menuItemLinkClassNames;
|
206
|
-
},
|
207
|
-
renderMenuItemLink_unstable: function() {
|
208
|
-
return _MenuItemLink.renderMenuItemLink_unstable;
|
209
|
-
},
|
210
|
-
useMenuItemLinkStyles_unstable: function() {
|
211
|
-
return _MenuItemLink.useMenuItemLinkStyles_unstable;
|
212
|
-
},
|
213
|
-
useMenuItemLink_unstable: function() {
|
214
|
-
return _MenuItemLink.useMenuItemLink_unstable;
|
215
|
-
},
|
216
|
-
MENU_ENTER_EVENT: function() {
|
217
|
-
return _utils.MENU_ENTER_EVENT;
|
218
|
-
},
|
219
|
-
dispatchMenuEnterEvent: function() {
|
220
|
-
return _utils.dispatchMenuEnterEvent;
|
234
|
+
useMenu_unstable: function() {
|
235
|
+
return _Menu.useMenu_unstable;
|
221
236
|
},
|
222
237
|
useOnMenuMouseEnter: function() {
|
223
238
|
return _utils.useOnMenuMouseEnter;
|
224
|
-
},
|
225
|
-
MenuItemSwitch: function() {
|
226
|
-
return _MenuItemSwitch.MenuItemSwitch;
|
227
|
-
},
|
228
|
-
useMenuItemSwitch_unstable: function() {
|
229
|
-
return _MenuItemSwitch.useMenuItemSwitch_unstable;
|
230
|
-
},
|
231
|
-
useMenuItemSwitchStyles_unstable: function() {
|
232
|
-
return _MenuItemSwitch.useMenuItemSwitchStyles_unstable;
|
233
|
-
},
|
234
|
-
renderMenuItemSwitch_unstable: function() {
|
235
|
-
return _MenuItemSwitch.renderMenuItemSwitch_unstable;
|
236
|
-
},
|
237
|
-
menuItemSwitchClassNames: function() {
|
238
|
-
return _MenuItemSwitch.menuItemSwitchClassNames;
|
239
239
|
}
|
240
240
|
});
|
241
241
|
const _menuContext = require("./contexts/menuContext");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.
|
1
|
+
{"version":3,"sources":["index.ts"],"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\nexport {\n MenuItemLink,\n menuItemLinkClassNames,\n renderMenuItemLink_unstable,\n useMenuItemLinkStyles_unstable,\n useMenuItemLink_unstable,\n} from './MenuItemLink';\nexport type { MenuItemLinkProps, MenuItemLinkSlots, MenuItemLinkState } from './MenuItemLink';\n\nexport { MENU_ENTER_EVENT, dispatchMenuEnterEvent, useOnMenuMouseEnter } from './utils';\nexport {\n MenuItemSwitch,\n useMenuItemSwitch_unstable,\n useMenuItemSwitchStyles_unstable,\n renderMenuItemSwitch_unstable,\n menuItemSwitchClassNames,\n} from './MenuItemSwitch';\n\nexport type { MenuItemSwitchProps, MenuItemSwitchState, MenuItemSwitchSlots } from './MenuItemSwitch';\n"],"names":["MENU_ENTER_EVENT","Menu","MenuDivider","MenuGroup","MenuGroupContextProvider","MenuGroupHeader","MenuItem","MenuItemCheckbox","MenuItemLink","MenuItemRadio","MenuItemSwitch","MenuList","MenuListProvider","MenuPopover","MenuProvider","MenuSplitGroup","MenuTrigger","MenuTriggerContextProvider","dispatchMenuEnterEvent","menuDividerClassNames","menuGroupClassNames","menuGroupHeaderClassNames","menuItemCheckboxClassNames","menuItemClassNames","menuItemLinkClassNames","menuItemRadioClassNames","menuItemSwitchClassNames","menuListClassNames","menuPopoverClassNames","menuSplitGroupClassNames","renderMenuDivider_unstable","renderMenuGroupHeader_unstable","renderMenuGroup_unstable","renderMenuItemCheckbox_unstable","renderMenuItemLink_unstable","renderMenuItemRadio_unstable","renderMenuItemSwitch_unstable","renderMenuItem_unstable","renderMenuList_unstable","renderMenuPopover_unstable","renderMenuSplitGroup_unstable","renderMenuTrigger_unstable","renderMenu_unstable","useCheckmarkStyles_unstable","useMenuContextValues_unstable","useMenuContext_unstable","useMenuDividerStyles_unstable","useMenuDivider_unstable","useMenuGroupContextValues_unstable","useMenuGroupContext_unstable","useMenuGroupHeaderStyles_unstable","useMenuGroupHeader_unstable","useMenuGroupStyles_unstable","useMenuGroup_unstable","useMenuItemCheckboxStyles_unstable","useMenuItemCheckbox_unstable","useMenuItemLinkStyles_unstable","useMenuItemLink_unstable","useMenuItemRadioStyles_unstable","useMenuItemRadio_unstable","useMenuItemStyles_unstable","useMenuItemSwitchStyles_unstable","useMenuItemSwitch_unstable","useMenuItem_unstable","useMenuListContextValues_unstable","useMenuListContext_unstable","useMenuListStyles_unstable","useMenuList_unstable","useMenuPopoverStyles_unstable","useMenuPopover_unstable","useMenuSplitGroupStyles_unstable","useMenuSplitGroup_unstable","useMenuTriggerContext_unstable","useMenuTrigger_unstable","useMenu_unstable","useOnMenuMouseEnter"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAuHSA,gBAAgB;eAAhBA,uBAAgB;;IA/GhBC,IAAI;eAAJA,UAAI;;IAaXC,WAAW;eAAXA,wBAAW;;IAQXC,SAAS;eAATA,oBAAS;;IA1BFC,wBAAwB;eAAxBA,0CAAwB;;IAmC/BC,eAAe;eAAfA,gCAAe;;IAQfC,QAAQ;eAARA,kBAAQ;;IAQRC,gBAAgB;eAAhBA,kCAAgB;;IAyDhBC,YAAY;eAAZA,0BAAY;;IAjDZC,aAAa;eAAbA,4BAAa;;IA2DbC,cAAc;eAAdA,8BAAc;;IAnDdC,QAAQ;eAARA,kBAAQ;;IAjEDC,gBAAgB;eAAhBA,iCAAgB;;IAoFvBC,WAAW;eAAXA,wBAAW;;IAzFJC,YAAY;eAAZA,yBAAY;;IAiGnBC,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AAiC;eAAjCA,kDAAiC;;IACjCC,2BAA2B;eAA3BA,4CAA2B;;IAT3BC,2BAA2B;eAA3BA,sCAA2B;;IAC3BC,qBAAqB;eAArBA,gCAAqB;;IAuBrBC,kCAAkC;eAAlCA,oDAAkC;;IAClCC,4BAA4B;eAA5BA,8CAA4B;;IAwD5BC,8BAA8B;eAA9BA,4CAA8B;;IAC9BC,wBAAwB;eAAxBA,sCAAwB;;IAlDxBC,+BAA+B;eAA/BA,8CAA+B;;IAC/BC,yBAAyB;eAAzBA,wCAAyB;;IAjBzBC,0BAA0B;eAA1BA,oCAA0B;;IA0E1BC,gCAAgC;eAAhCA,gDAAgC;;IADhCC,0BAA0B;eAA1BA,0CAA0B;;IAxE1BC,oBAAoB;eAApBA,8BAAoB;;IAuBpBC,iCAAiC;eAAjCA,2CAAiC;;IApERC,2BAA2B;eAA3BA,4CAA2B;;IAqEpDC,0BAA0B;eAA1BA,oCAA0B;;IAC1BC,oBAAoB;eAApBA,8BAAoB;;IAiBpBC,6BAA6B;eAA7BA,0CAA6B;;IAC7BC,uBAAuB;eAAvBA,oCAAuB;;IAOvBC,gCAAgC;eAAhCA,gDAAgC;;IAChCC,0BAA0B;eAA1BA,0CAA0B;;IAnGSC,8BAA8B;eAA9BA,kDAA8B;;IAsGjBC,uBAAuB;eAAvBA,oCAAuB;;IAhGNC,gBAAgB;eAAhBA,sBAAgB;;IA+GhCC,mBAAmB;eAAnBA,0BAAmB;;;6BAvHhB;oCAEqB;kCACJ;iCAET;sBAG6B;6BAkBpF;2BASA;iCAQA;0BAQA;kCAQA;+BAQA;0BASA;6BAkBA;gCAQA;6BAE0E;uBAGrC;8BASrC;uBAGuE;gCAOvE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './useCheckmarkStyles.styles';\nexport * from './types';\n"],"names":[],"rangeMappings":";;;;;;","mappings":";;;;;uBAAc;uBACA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["types.
|
1
|
+
{"version":3,"sources":["types.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type SelectableHandler = (\n e: React.MouseEvent | React.KeyboardEvent,\n name: string,\n value: string,\n checked: boolean,\n) => void;\n\n/**\n * Props for selecatble menu items\n */\nexport type MenuItemSelectableProps = {\n /**\n * Follows input convention\n * https://www.w3schools.com/jsref/prop_checkbox_name.asp\n */\n name: string;\n\n /**\n * Follows input convention\n * https://www.w3schools.com/jsref/prop_checkbox_value.asp\n */\n value: string;\n};\n\n/**\n * State for selectable menu items\n */\nexport type MenuItemSelectableState = MenuItemSelectableProps & {\n /**\n * Selectable is checked\n */\n checked: boolean;\n};\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useCheckmarkStyles.styles.js"],"sourcesContent":["import { mergeClasses,
|
1
|
+
{"version":3,"sources":["useCheckmarkStyles.styles.js"],"sourcesContent":["import { mergeClasses, makeStyles } from '@griffel/react';\nconst useStyles = makeStyles({\n root: {\n width: '16px',\n height: '16px',\n visibility: 'hidden'\n },\n rootChecked: {\n visibility: 'visible'\n }\n});\n/**\n * Applies styles to a checkmark slot for selectable menu items\n *\n * @param state - should contain a `checkmark` slot\n */ export const useCheckmarkStyles_unstable = (state)=>{\n 'use no memo';\n const styles = useStyles();\n if (state.checkmark) {\n state.checkmark.className = mergeClasses(styles.root, state.checked && styles.rootChecked, state.checkmark.className);\n }\n};\n"],"names":["useCheckmarkStyles_unstable","useStyles","__styles","root","a9b677","Bqenvij","Bcdw1i0","rootChecked","d","state","styles","checkmark","className","mergeClasses","checked"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAeiBA;;;eAAAA;;;uBAfwB;AACzC,MAAMC,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAC,MAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,SAAA;IAAA;IAAAC,aAAA;QAAAD,SAAA;IAAA;AAAA,GAAA;IAAAE,GAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA;AAcP,MAAMR,8BAA+BS,CAAAA;IAC5C;IACA,MAAMC,SAAST;IACf,IAAIQ,MAAME,SAAS,EAAE;QACjBF,MAAME,SAAS,CAACC,SAAS,GAAGC,IAAAA,mBAAY,EAACH,OAAOP,IAAI,EAAEM,MAAMK,OAAO,IAAIJ,OAAOH,WAAW,EAAEE,MAAME,SAAS,CAACC,SAAS;IACxH;AACJ"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './useOnMenuEnter';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useIsSubmenu.
|
1
|
+
{"version":3,"sources":["useIsSubmenu.ts"],"sourcesContent":["import { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../contexts/menuContext';\nimport { MenuListContext } from '../contexts/menuListContext';\n\n/**\n * A component can be a part of a submenu whether its menu context `isSubmenu` flag is true\n * or whether it is a part of a `MenuList`\n *\n * A simple hook to check box contexts easily\n *\n * @returns whether the component is part of a submenu\n */\nexport function useIsSubmenu() {\n const menuContextValue = useMenuContext_unstable(context => context.isSubmenu);\n const hasMenuListContext = useHasParentContext(MenuListContext);\n\n return menuContextValue || hasMenuListContext;\n}\n"],"names":["useIsSubmenu","menuContextValue","useMenuContext_unstable","context","isSubmenu","hasMenuListContext","useHasParentContext","MenuListContext"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":";;;;+BAYgBA;;;eAAAA;;;sCAZoB;6BACI;iCACR;AAUzB,SAASA;IACd,MAAMC,mBAAmBC,IAAAA,oCAAAA,EAAwBC,CAAAA,UAAWA,QAAQC,SAAS;IAC7E,MAAMC,qBAAqBC,IAAAA,yCAAAA,EAAoBC,gCAAAA;IAE/C,OAAON,oBAAoBI;AAC7B"}
|
@@ -12,11 +12,11 @@ _export(exports, {
|
|
12
12
|
MENU_ENTER_EVENT: function() {
|
13
13
|
return MENU_ENTER_EVENT;
|
14
14
|
},
|
15
|
-
useOnMenuMouseEnter: function() {
|
16
|
-
return useOnMenuMouseEnter;
|
17
|
-
},
|
18
15
|
dispatchMenuEnterEvent: function() {
|
19
16
|
return dispatchMenuEnterEvent;
|
17
|
+
},
|
18
|
+
useOnMenuMouseEnter: function() {
|
19
|
+
return useOnMenuMouseEnter;
|
20
20
|
}
|
21
21
|
});
|
22
22
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|