@react-spectrum/menu 3.19.2-nightly.4674 → 3.19.2-nightly.4683

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AA6BD,SAAS,4CAAsB,KAAqC;IAClE,IAAI,iBAAC,gBAAgB,kBAAO,SAAS,EAAC,GAAG;IAEzC,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAiB;IACvC,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAE;IACxB,IAAI,oBAAC,gBAAgB,oBAAE,gBAAgB,wBAAE,oBAAoB,EAAE,MAAM,aAAa,SAAE,KAAK,EAAC,GAAG,CAAA,GAAA,6CAAkB;IAC/G,IAAI,sBAAsB,CAAA,GAAA,8CAAqB,EAAE;QAAC,YAAY;IAAS,GAAG;QAAC,GAAG,oBAAoB;QAAE,GAAG,KAAK;IAAA;IAC5G,IAAI,aAAa,CAAA,GAAA,sCAAW,EAAE;IAC9B,IAAI,uBAAC,mBAAmB,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,sCAAgB,EAAE;uBAC1D;oBACA;QACA,MAAM;QACN,YAAY,CAAC;IACf,GAAG,qBAAqB;IACxB,IAAI,WAAW,CAAA,GAAA,2CAAgB;IAC/B,IAAI,CAAC,sBAAsB,wBAAwB,GAAG,CAAA,GAAA,qBAAO,EAAE;IAC/D,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,oBAAoB,MAAM,EAC5B,wBAAwB;IAE5B,GAAG;QAAC,oBAAoB,MAAM;KAAC;IAC/B,IAAI,QAAQ,CAAC;IACb,IAAI,eACF,QAAQ;QACN,QAAQ;YACN,kBAAkB,CAAA,GAAA,oCAAS,EACzB,CAAA,GAAA,mDAAS,GACT,wCACA;gBACE,kDAAkD;YACpD,GACA,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDA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,SAAS;YAAC,GAAG,QAAQ,KAAK;YAAE,eAAe;YAAM,WAAW;QAAI;QAC5F,SAAS,CAAC,wBACR,0DAAC;gBAAsB,KAAK,QAAQ,GAAG;gBAAE,WAAW,QAAQ,GAAG;gBAAG,GAAG,KAAK;eACvE,SACA;IAGP;AACF;AAEA,IAAI,4CAAQ","sources":["packages/@react-spectrum/menu/src/ContextualHelpTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, SlotProvider, unwrapDOMRef, useIsMobileDevice} from '@react-spectrum/utils';\nimport {FocusScope} from '@react-aria/focus';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport helpStyles from '@adobe/spectrum-css-temp/components/contextualhelp/vars.css';\nimport {ItemProps, Key} from '@react-types/shared';\nimport {Popover} from '@react-spectrum/overlays';\nimport React, {JSX, ReactElement, useEffect, useRef, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {SubmenuTriggerContext, useMenuStateContext} from './context';\nimport {TrayHeaderWrapper} from './Menu';\nimport {useSubmenuTrigger} from '@react-aria/menu';\nimport {useSubmenuTriggerState} from '@react-stately/menu';\n\ninterface MenuDialogTriggerProps {\n /** Whether the menu item is currently unavailable. */\n isUnavailable?: boolean,\n /** The triggering Item and the Dialog, respectively. */\n children: [ReactElement, ReactElement]\n}\n\ninterface InternalMenuDialogTriggerProps extends MenuDialogTriggerProps {\n targetKey: Key\n}\n\nexport interface SpectrumMenuDialogTriggerProps extends MenuDialogTriggerProps {}\n\nfunction ContextualHelpTrigger(props: InternalMenuDialogTriggerProps): ReactElement {\n let {isUnavailable = false, targetKey} = props;\n\n let triggerRef = useRef<HTMLLIElement>(null);\n let popoverRef = useRef(null);\n let {popoverContainer, trayContainerRef, rootMenuTriggerState, menu: parentMenuRef, state} = useMenuStateContext();\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: targetKey}, {...rootMenuTriggerState, ...state});\n let submenuRef = unwrapDOMRef(popoverRef);\n let {submenuTriggerProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n type: 'dialog',\n isDisabled: !isUnavailable\n }, submenuTriggerState, triggerRef);\n let isMobile = useIsMobileDevice();\n let [traySubmenuAnimation, setTraySubmenuAnimation] = useState('');\n useEffect(() => {\n if (submenuTriggerState.isOpen) {\n setTraySubmenuAnimation('spectrum-TraySubmenu-enter');\n }\n }, [submenuTriggerState.isOpen]);\n let slots = {};\n if (isUnavailable) {\n slots = {\n dialog: {\n UNSAFE_className: classNames(\n helpStyles,\n 'react-spectrum-ContextualHelp-dialog',\n {\n 'react-spectrum-ContextualHelp-dialog--isMobile': isMobile\n },\n classNames(\n styles,\n {\n 'spectrum-Menu-subdialog': !isMobile,\n [traySubmenuAnimation]: isMobile\n }\n )\n )\n },\n content: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-content']},\n footer: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-footer']}\n };\n }\n let [trigger] = React.Children.toArray(props.children);\n let [, content] = props.children as [ReactElement, ReactElement];\n\n let onBlurWithin = (e) => {\n if (e.relatedTarget && popoverRef.current && (!popoverRef?.current?.UNSAFE_getDOMNode()?.contains(e.relatedTarget) && !(e.relatedTarget === triggerRef.current && getInteractionModality() === 'pointer'))) {\n if (submenuTriggerState.isOpen) {\n submenuTriggerState.close();\n }\n }\n };\n\n let overlay;\n let tray;\n let onBackButtonPress = () => {\n setTraySubmenuAnimation('spectrum-TraySubmenu-exit');\n setTimeout(() => {\n submenuTriggerState.close();\n if (parentMenuRef.current && !parentMenuRef.current.contains(document.activeElement)) {\n parentMenuRef.current.focus();\n }\n }, 220); // Matches transition duration\n };\n\n if (isMobile) {\n delete submenuTriggerProps.onBlur;\n delete submenuTriggerProps.onHoverChange;\n if (trayContainerRef.current && submenuTriggerState.isOpen) {\n let subDialogKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'Escape':\n e.stopPropagation();\n onBackButtonPress();\n break;\n }\n };\n\n tray = (\n <TrayHeaderWrapper\n isSubmenu\n parentMenuTreeState={state}\n rootMenuTriggerState={rootMenuTriggerState}\n wrapperKeyDown={subDialogKeyDown}\n onBackButtonPress={onBackButtonPress}>\n {content}\n </TrayHeaderWrapper>\n );\n\n overlay = ReactDOM.createPortal(tray, trayContainerRef.current);\n }\n } else {\n let onDismissButtonPress = () => {\n submenuTriggerState.close();\n parentMenuRef.current?.focus();\n };\n\n overlay = (\n <Popover\n {...popoverProps}\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', filter: 'unset', borderWidth: '0px'}}\n UNSAFE_className={classNames(styles, 'spectrum-Submenu-popover')}\n onDismissButtonPress={onDismissButtonPress}\n onBlurWithin={onBlurWithin}\n container={popoverContainer}\n state={submenuTriggerState}\n ref={popoverRef}\n triggerRef={triggerRef}\n placement=\"end top\"\n containerPadding={0}\n hideArrow\n enableBothDismissButtons>\n <FocusScope restoreFocus>\n {content}\n </FocusScope>\n </Popover>\n );\n }\n\n return (\n <>\n <SubmenuTriggerContext.Provider value={{isUnavailable, triggerRef, ...submenuTriggerProps}}>{trigger}</SubmenuTriggerContext.Provider>\n <SlotProvider slots={slots}>\n {submenuTriggerState.isOpen && overlay}\n </SlotProvider>\n </>\n );\n}\n\nContextualHelpTrigger.getCollectionNode = function* getCollectionNode<T>(props: ItemProps<T>) {\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger] = childArray;\n let [, content] = props.children as [ReactElement, ReactElement];\n\n yield {\n element: React.cloneElement(trigger, {...trigger.props, hasChildItems: true, isTrigger: true}),\n wrapper: (element) => (\n <ContextualHelpTrigger key={element.key} targetKey={element.key} {...props}>\n {element}\n {content}\n </ContextualHelpTrigger>\n )\n };\n};\n\nlet _Item = ContextualHelpTrigger as (props: SpectrumMenuDialogTriggerProps) => JSX.Element;\nexport {_Item as ContextualHelpTrigger};\n"],"names":[],"version":3,"file":"ContextualHelpTrigger.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AA6BD,SAAS,4CAAsB,KAAqC;IAClE,IAAI,iBAAC,gBAAgB,kBAAO,SAAS,EAAC,GAAG;IAEzC,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAiB;IACvC,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAE;IACxB,IAAI,oBAAC,gBAAgB,oBAAE,gBAAgB,wBAAE,oBAAoB,EAAE,MAAM,aAAa,SAAE,KAAK,EAAC,GAAG,CAAA,GAAA,6CAAkB;IAC/G,IAAI,sBAAsB,CAAA,GAAA,8CAAqB,EAAE;QAAC,YAAY;IAAS,GAAG;QAAC,GAAG,oBAAoB;QAAE,GAAG,KAAK;IAAA;IAC5G,IAAI,aAAa,CAAA,GAAA,sCAAW,EAAE;IAC9B,IAAI,uBAAC,mBAAmB,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,sCAAgB,EAAE;uBAC1D;oBACA;QACA,MAAM;QACN,YAAY,CAAC;IACf,GAAG,qBAAqB;IACxB,IAAI,WAAW,CAAA,GAAA,2CAAgB;IAC/B,IAAI,CAAC,sBAAsB,wBAAwB,GAAG,CAAA,GAAA,qBAAO,EAAE;IAC/D,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,oBAAoB,MAAM,EAC5B,wBAAwB;IAE5B,GAAG;QAAC,oBAAoB,MAAM;KAAC;IAC/B,IAAI,QAAQ,CAAC;IACb,IAAI,eACF,QAAQ;Q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IAEpB;IACA,IAAI,CAAC,QAAQ,GAAG;IAChB,IAAI,GAAG,QAAQ,GAAG,MAAM,QAAQ;IAEhC,MAAM;QACJ,uBAAS,CAAA,GAAA,sCAAI,EAAE,YAAY,CAAC,SAAS;YAAC,GAAG,QAAQ,KAAK;YAAS,eAAe;YAAM,WAAW;QAAI;QACnG,SAAS,CAAC,wBACR,0DAAC;gBAAsB,KAAK,QAAQ,GAAG;gBAAE,WAAW,QAAQ,GAAG;gBAAG,GAAG,KAAK;eACvE,SACA;IAGP;AACF;AAEA,IAAI,4CAAQ","sources":["packages/@react-spectrum/menu/src/ContextualHelpTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, SlotProvider, unwrapDOMRef, useIsMobileDevice} from '@react-spectrum/utils';\nimport {FocusScope} from '@react-aria/focus';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport helpStyles from '@adobe/spectrum-css-temp/components/contextualhelp/vars.css';\nimport {ItemProps, Key} from '@react-types/shared';\nimport {Popover} from '@react-spectrum/overlays';\nimport React, {JSX, ReactElement, useEffect, useRef, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {SubmenuTriggerContext, useMenuStateContext} from './context';\nimport {TrayHeaderWrapper} from './Menu';\nimport {useSubmenuTrigger} from '@react-aria/menu';\nimport {useSubmenuTriggerState} from '@react-stately/menu';\n\ninterface MenuDialogTriggerProps {\n /** Whether the menu item is currently unavailable. */\n isUnavailable?: boolean,\n /** The triggering Item and the Dialog, respectively. */\n children: [ReactElement, ReactElement]\n}\n\ninterface InternalMenuDialogTriggerProps extends MenuDialogTriggerProps {\n targetKey: Key\n}\n\nexport interface SpectrumMenuDialogTriggerProps extends MenuDialogTriggerProps {}\n\nfunction ContextualHelpTrigger(props: InternalMenuDialogTriggerProps): ReactElement {\n let {isUnavailable = false, targetKey} = props;\n\n let triggerRef = useRef<HTMLLIElement>(null);\n let popoverRef = useRef(null);\n let {popoverContainer, trayContainerRef, rootMenuTriggerState, menu: parentMenuRef, state} = useMenuStateContext();\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: targetKey}, {...rootMenuTriggerState, ...state});\n let submenuRef = unwrapDOMRef(popoverRef);\n let {submenuTriggerProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n type: 'dialog',\n isDisabled: !isUnavailable\n }, submenuTriggerState, triggerRef);\n let isMobile = useIsMobileDevice();\n let [traySubmenuAnimation, setTraySubmenuAnimation] = useState('');\n useEffect(() => {\n if (submenuTriggerState.isOpen) {\n setTraySubmenuAnimation('spectrum-TraySubmenu-enter');\n }\n }, [submenuTriggerState.isOpen]);\n let slots = {};\n if (isUnavailable) {\n slots = {\n dialog: {\n UNSAFE_className: classNames(\n helpStyles,\n 'react-spectrum-ContextualHelp-dialog',\n {\n 'react-spectrum-ContextualHelp-dialog--isMobile': isMobile\n },\n classNames(\n styles,\n {\n 'spectrum-Menu-subdialog': !isMobile,\n [traySubmenuAnimation]: isMobile\n }\n )\n )\n },\n content: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-content']},\n footer: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-footer']}\n };\n }\n let [trigger] = React.Children.toArray(props.children);\n let [, content] = props.children as [ReactElement, ReactElement];\n\n let onBlurWithin = (e) => {\n if (e.relatedTarget && popoverRef.current && (!popoverRef?.current?.UNSAFE_getDOMNode()?.contains(e.relatedTarget) && !(e.relatedTarget === triggerRef.current && getInteractionModality() === 'pointer'))) {\n if (submenuTriggerState.isOpen) {\n submenuTriggerState.close();\n }\n }\n };\n\n let overlay;\n let tray;\n let onBackButtonPress = () => {\n setTraySubmenuAnimation('spectrum-TraySubmenu-exit');\n setTimeout(() => {\n submenuTriggerState.close();\n if (parentMenuRef.current && !parentMenuRef.current.contains(document.activeElement)) {\n parentMenuRef.current.focus();\n }\n }, 220); // Matches transition duration\n };\n\n if (isMobile) {\n delete submenuTriggerProps.onBlur;\n delete submenuTriggerProps.onHoverChange;\n if (trayContainerRef.current && submenuTriggerState.isOpen) {\n let subDialogKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'Escape':\n e.stopPropagation();\n onBackButtonPress();\n break;\n }\n };\n\n tray = (\n <TrayHeaderWrapper\n isSubmenu\n parentMenuTreeState={state}\n rootMenuTriggerState={rootMenuTriggerState}\n wrapperKeyDown={subDialogKeyDown}\n onBackButtonPress={onBackButtonPress}>\n {content}\n </TrayHeaderWrapper>\n );\n\n overlay = ReactDOM.createPortal(tray, trayContainerRef.current);\n }\n } else {\n let onDismissButtonPress = () => {\n submenuTriggerState.close();\n parentMenuRef.current?.focus();\n };\n\n overlay = (\n <Popover\n {...popoverProps}\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', filter: 'unset', borderWidth: '0px'}}\n UNSAFE_className={classNames(styles, 'spectrum-Submenu-popover')}\n onDismissButtonPress={onDismissButtonPress}\n onBlurWithin={onBlurWithin}\n container={popoverContainer}\n state={submenuTriggerState}\n ref={popoverRef}\n triggerRef={triggerRef}\n placement=\"end top\"\n containerPadding={0}\n hideArrow\n enableBothDismissButtons>\n <FocusScope restoreFocus>\n {content}\n </FocusScope>\n </Popover>\n );\n }\n\n return (\n <>\n <SubmenuTriggerContext.Provider value={{isUnavailable, triggerRef, ...submenuTriggerProps}}>{trigger}</SubmenuTriggerContext.Provider>\n <SlotProvider slots={slots}>\n {submenuTriggerState.isOpen && overlay}\n </SlotProvider>\n </>\n );\n}\n\nContextualHelpTrigger.getCollectionNode = function* getCollectionNode<T>(props: ItemProps<T>) {\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger] = childArray;\n let [, content] = props.children as [ReactElement, ReactElement];\n\n yield {\n element: React.cloneElement(trigger, {...trigger.props as any, hasChildItems: true, isTrigger: true}),\n wrapper: (element) => (\n <ContextualHelpTrigger key={element.key} targetKey={element.key} {...props}>\n {element}\n {content}\n </ContextualHelpTrigger>\n )\n };\n};\n\nlet _Item = ContextualHelpTrigger as (props: SpectrumMenuDialogTriggerProps) => JSX.Element;\nexport {_Item as ContextualHelpTrigger};\n"],"names":[],"version":3,"file":"ContextualHelpTrigger.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AA6BD,SAAS,4CAAsB,KAAqC;IAClE,IAAI,iBAAC,gBAAgB,kBAAO,SAAS,EAAC,GAAG;IAEzC,IAAI,aAAa,CAAA,GAAA,aAAK,EAAiB;IACvC,IAAI,aAAa,CAAA,GAAA,aAAK,EAAE;IACxB,IAAI,oBAAC,gBAAgB,oBAAE,gBAAgB,wBAAE,oBAAoB,EAAE,MAAM,aAAa,SAAE,KAAK,EAAC,GAAG,CAAA,GAAA,yCAAkB;IAC/G,IAAI,sBAAsB,CAAA,GAAA,6BAAqB,EAAE;QAAC,YAAY;IAAS,GAAG;QAAC,GAAG,oBAAoB;QAAE,GAAG,KAAK;IAAA;IAC5G,IAAI,aAAa,CAAA,GAAA,mBAAW,EAAE;IAC9B,IAAI,uBAAC,mBAAmB,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;uBAC1D;oBACA;QACA,MAAM;QACN,YAAY,CAAC;IACf,GAAG,qBAAqB;IACxB,IAAI,WAAW,CAAA,GAAA,wBAAgB;IAC/B,IAAI,CAAC,sBAAsB,wBAAwB,GAAG,CAAA,GAAA,eAAO,EAAE;IAC/D,CAAA,GAA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GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,CAAA;QACrC,kBAAI,CAAA,GAAA,YAAI,EAAE,cAAc,CAAC,QACvB,WAAW,IAAI,CAAC;IAEpB;IACA,IAAI,CAAC,QAAQ,GAAG;IAChB,IAAI,GAAG,QAAQ,GAAG,MAAM,QAAQ;IAEhC,MAAM;QACJ,uBAAS,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,SAAS;YAAC,GAAG,QAAQ,KAAK;YAAE,eAAe;YAAM,WAAW;QAAI;QAC5F,SAAS,CAAC,wBACR,gCAAC;gBAAsB,KAAK,QAAQ,GAAG;gBAAE,WAAW,QAAQ,GAAG;gBAAG,GAAG,KAAK;eACvE,SACA;IAGP;AACF;AAEA,IAAI,4CAAQ","sources":["packages/@react-spectrum/menu/src/ContextualHelpTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, SlotProvider, unwrapDOMRef, useIsMobileDevice} from '@react-spectrum/utils';\nimport {FocusScope} from '@react-aria/focus';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport helpStyles from '@adobe/spectrum-css-temp/components/contextualhelp/vars.css';\nimport {ItemProps, Key} from '@react-types/shared';\nimport {Popover} from '@react-spectrum/overlays';\nimport React, {JSX, ReactElement, useEffect, useRef, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {SubmenuTriggerContext, useMenuStateContext} from './context';\nimport {TrayHeaderWrapper} from './Menu';\nimport {useSubmenuTrigger} from '@react-aria/menu';\nimport {useSubmenuTriggerState} from '@react-stately/menu';\n\ninterface MenuDialogTriggerProps {\n /** Whether the menu item is currently unavailable. */\n isUnavailable?: boolean,\n /** The triggering Item and the Dialog, respectively. */\n children: [ReactElement, ReactElement]\n}\n\ninterface InternalMenuDialogTriggerProps extends MenuDialogTriggerProps {\n targetKey: Key\n}\n\nexport interface SpectrumMenuDialogTriggerProps extends MenuDialogTriggerProps {}\n\nfunction ContextualHelpTrigger(props: InternalMenuDialogTriggerProps): ReactElement {\n let {isUnavailable = false, targetKey} = props;\n\n let triggerRef = useRef<HTMLLIElement>(null);\n let popoverRef = useRef(null);\n let {popoverContainer, trayContainerRef, rootMenuTriggerState, menu: parentMenuRef, state} = useMenuStateContext();\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: targetKey}, {...rootMenuTriggerState, ...state});\n let submenuRef = unwrapDOMRef(popoverRef);\n let {submenuTriggerProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n type: 'dialog',\n isDisabled: !isUnavailable\n }, submenuTriggerState, triggerRef);\n let isMobile = useIsMobileDevice();\n let [traySubmenuAnimation, setTraySubmenuAnimation] = useState('');\n useEffect(() => {\n if (submenuTriggerState.isOpen) {\n setTraySubmenuAnimation('spectrum-TraySubmenu-enter');\n }\n }, [submenuTriggerState.isOpen]);\n let slots = {};\n if (isUnavailable) {\n slots = {\n dialog: {\n UNSAFE_className: classNames(\n helpStyles,\n 'react-spectrum-ContextualHelp-dialog',\n {\n 'react-spectrum-ContextualHelp-dialog--isMobile': isMobile\n },\n classNames(\n styles,\n {\n 'spectrum-Menu-subdialog': !isMobile,\n [traySubmenuAnimation]: isMobile\n }\n )\n )\n },\n content: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-content']},\n footer: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-footer']}\n };\n }\n let [trigger] = React.Children.toArray(props.children);\n let [, content] = props.children as [ReactElement, ReactElement];\n\n let onBlurWithin = (e) => {\n if (e.relatedTarget && popoverRef.current && (!popoverRef?.current?.UNSAFE_getDOMNode()?.contains(e.relatedTarget) && !(e.relatedTarget === triggerRef.current && getInteractionModality() === 'pointer'))) {\n if (submenuTriggerState.isOpen) {\n submenuTriggerState.close();\n }\n }\n };\n\n let overlay;\n let tray;\n let onBackButtonPress = () => {\n setTraySubmenuAnimation('spectrum-TraySubmenu-exit');\n setTimeout(() => {\n submenuTriggerState.close();\n if (parentMenuRef.current && !parentMenuRef.current.contains(document.activeElement)) {\n parentMenuRef.current.focus();\n }\n }, 220); // Matches transition duration\n };\n\n if (isMobile) {\n delete submenuTriggerProps.onBlur;\n delete submenuTriggerProps.onHoverChange;\n if (trayContainerRef.current && submenuTriggerState.isOpen) {\n let subDialogKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'Escape':\n e.stopPropagation();\n onBackButtonPress();\n break;\n }\n };\n\n tray = (\n <TrayHeaderWrapper\n isSubmenu\n parentMenuTreeState={state}\n rootMenuTriggerState={rootMenuTriggerState}\n wrapperKeyDown={subDialogKeyDown}\n onBackButtonPress={onBackButtonPress}>\n {content}\n </TrayHeaderWrapper>\n );\n\n overlay = ReactDOM.createPortal(tray, trayContainerRef.current);\n }\n } else {\n let onDismissButtonPress = () => {\n submenuTriggerState.close();\n parentMenuRef.current?.focus();\n };\n\n overlay = (\n <Popover\n {...popoverProps}\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', filter: 'unset', borderWidth: '0px'}}\n UNSAFE_className={classNames(styles, 'spectrum-Submenu-popover')}\n onDismissButtonPress={onDismissButtonPress}\n onBlurWithin={onBlurWithin}\n container={popoverContainer}\n state={submenuTriggerState}\n ref={popoverRef}\n triggerRef={triggerRef}\n placement=\"end top\"\n containerPadding={0}\n hideArrow\n enableBothDismissButtons>\n <FocusScope restoreFocus>\n {content}\n </FocusScope>\n </Popover>\n );\n }\n\n return (\n <>\n <SubmenuTriggerContext.Provider value={{isUnavailable, triggerRef, ...submenuTriggerProps}}>{trigger}</SubmenuTriggerContext.Provider>\n <SlotProvider slots={slots}>\n {submenuTriggerState.isOpen && overlay}\n </SlotProvider>\n </>\n );\n}\n\nContextualHelpTrigger.getCollectionNode = function* getCollectionNode<T>(props: ItemProps<T>) {\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger] = childArray;\n let [, content] = props.children as [ReactElement, ReactElement];\n\n yield {\n element: React.cloneElement(trigger, {...trigger.props, hasChildItems: true, isTrigger: true}),\n wrapper: (element) => (\n <ContextualHelpTrigger key={element.key} targetKey={element.key} {...props}>\n {element}\n {content}\n </ContextualHelpTrigger>\n )\n };\n};\n\nlet _Item = ContextualHelpTrigger as (props: SpectrumMenuDialogTriggerProps) => JSX.Element;\nexport {_Item as ContextualHelpTrigger};\n"],"names":[],"version":3,"file":"ContextualHelpTrigger.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AA6BD,SAAS,4CAAsB,KAAqC;IAClE,IAAI,iBAAC,gBAAgB,kBAAO,SAAS,EAAC,GAAG;IAEzC,IAAI,aAAa,CAAA,GAAA,aAAK,EAAiB;IACvC,IAAI,aAAa,CAAA,GAAA,aAAK,EAAE;IACxB,IAAI,oBAAC,gBAAgB,oBAAE,gBAAgB,wBAAE,oBAAoB,EAAE,MAAM,aAAa,SAAE,KAAK,EAAC,GAAG,CAAA,GAAA,yCAAkB;IAC/G,IAAI,sBAAsB,CAAA,GAAA,6BAAqB,EAAE;QAAC,YAAY;IAAS,GAAG;QAAC,GAAG,oBAAoB;QAAE,GAAG,KAAK;IAAA;IAC5G,IAAI,aAAa,CAAA,GAAA,mBAAW,EAAE;IAC9B,IAAI,uBAAC,mBAAmB,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;uBAC1D;oBACA;QACA,MAAM;QACN,YAAY,CAAC;IACf,GAAG,qBA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AO;OAClB,oBAAoB,MAAM,IAAI;AAIvC;AAEA,4CAAsB,iBAAiB,GAAG,UAAU,kBAAqB,KAAmB;IAC1F,IAAI,aAA6B,EAAE;IACnC,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,CAAA;QACrC,kBAAI,CAAA,GAAA,YAAI,EAAE,cAAc,CAAC,QACvB,WAAW,IAAI,CAAC;IAEpB;IACA,IAAI,CAAC,QAAQ,GAAG;IAChB,IAAI,GAAG,QAAQ,GAAG,MAAM,QAAQ;IAEhC,MAAM;QACJ,uBAAS,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,SAAS;YAAC,GAAG,QAAQ,KAAK;YAAS,eAAe;YAAM,WAAW;QAAI;QACnG,SAAS,CAAC,wBACR,gCAAC;gBAAsB,KAAK,QAAQ,GAAG;gBAAE,WAAW,QAAQ,GAAG;gBAAG,GAAG,KAAK;eACvE,SACA;IAGP;AACF;AAEA,IAAI,4CAAQ","sources":["packages/@react-spectrum/menu/src/ContextualHelpTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, SlotProvider, unwrapDOMRef, useIsMobileDevice} from '@react-spectrum/utils';\nimport {FocusScope} from '@react-aria/focus';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport helpStyles from '@adobe/spectrum-css-temp/components/contextualhelp/vars.css';\nimport {ItemProps, Key} from '@react-types/shared';\nimport {Popover} from '@react-spectrum/overlays';\nimport React, {JSX, ReactElement, useEffect, useRef, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {SubmenuTriggerContext, useMenuStateContext} from './context';\nimport {TrayHeaderWrapper} from './Menu';\nimport {useSubmenuTrigger} from '@react-aria/menu';\nimport {useSubmenuTriggerState} from '@react-stately/menu';\n\ninterface MenuDialogTriggerProps {\n /** Whether the menu item is currently unavailable. */\n isUnavailable?: boolean,\n /** The triggering Item and the Dialog, respectively. */\n children: [ReactElement, ReactElement]\n}\n\ninterface InternalMenuDialogTriggerProps extends MenuDialogTriggerProps {\n targetKey: Key\n}\n\nexport interface SpectrumMenuDialogTriggerProps extends MenuDialogTriggerProps {}\n\nfunction ContextualHelpTrigger(props: InternalMenuDialogTriggerProps): ReactElement {\n let {isUnavailable = false, targetKey} = props;\n\n let triggerRef = useRef<HTMLLIElement>(null);\n let popoverRef = useRef(null);\n let {popoverContainer, trayContainerRef, rootMenuTriggerState, menu: parentMenuRef, state} = useMenuStateContext();\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: targetKey}, {...rootMenuTriggerState, ...state});\n let submenuRef = unwrapDOMRef(popoverRef);\n let {submenuTriggerProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n type: 'dialog',\n isDisabled: !isUnavailable\n }, submenuTriggerState, triggerRef);\n let isMobile = useIsMobileDevice();\n let [traySubmenuAnimation, setTraySubmenuAnimation] = useState('');\n useEffect(() => {\n if (submenuTriggerState.isOpen) {\n setTraySubmenuAnimation('spectrum-TraySubmenu-enter');\n }\n }, [submenuTriggerState.isOpen]);\n let slots = {};\n if (isUnavailable) {\n slots = {\n dialog: {\n UNSAFE_className: classNames(\n helpStyles,\n 'react-spectrum-ContextualHelp-dialog',\n {\n 'react-spectrum-ContextualHelp-dialog--isMobile': isMobile\n },\n classNames(\n styles,\n {\n 'spectrum-Menu-subdialog': !isMobile,\n [traySubmenuAnimation]: isMobile\n }\n )\n )\n },\n content: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-content']},\n footer: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-footer']}\n };\n }\n let [trigger] = React.Children.toArray(props.children);\n let [, content] = props.children as [ReactElement, ReactElement];\n\n let onBlurWithin = (e) => {\n if (e.relatedTarget && popoverRef.current && (!popoverRef?.current?.UNSAFE_getDOMNode()?.contains(e.relatedTarget) && !(e.relatedTarget === triggerRef.current && getInteractionModality() === 'pointer'))) {\n if (submenuTriggerState.isOpen) {\n submenuTriggerState.close();\n }\n }\n };\n\n let overlay;\n let tray;\n let onBackButtonPress = () => {\n setTraySubmenuAnimation('spectrum-TraySubmenu-exit');\n setTimeout(() => {\n submenuTriggerState.close();\n if (parentMenuRef.current && !parentMenuRef.current.contains(document.activeElement)) {\n parentMenuRef.current.focus();\n }\n }, 220); // Matches transition duration\n };\n\n if (isMobile) {\n delete submenuTriggerProps.onBlur;\n delete submenuTriggerProps.onHoverChange;\n if (trayContainerRef.current && submenuTriggerState.isOpen) {\n let subDialogKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'Escape':\n e.stopPropagation();\n onBackButtonPress();\n break;\n }\n };\n\n tray = (\n <TrayHeaderWrapper\n isSubmenu\n parentMenuTreeState={state}\n rootMenuTriggerState={rootMenuTriggerState}\n wrapperKeyDown={subDialogKeyDown}\n onBackButtonPress={onBackButtonPress}>\n {content}\n </TrayHeaderWrapper>\n );\n\n overlay = ReactDOM.createPortal(tray, trayContainerRef.current);\n }\n } else {\n let onDismissButtonPress = () => {\n submenuTriggerState.close();\n parentMenuRef.current?.focus();\n };\n\n overlay = (\n <Popover\n {...popoverProps}\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', filter: 'unset', borderWidth: '0px'}}\n UNSAFE_className={classNames(styles, 'spectrum-Submenu-popover')}\n onDismissButtonPress={onDismissButtonPress}\n onBlurWithin={onBlurWithin}\n container={popoverContainer}\n state={submenuTriggerState}\n ref={popoverRef}\n triggerRef={triggerRef}\n placement=\"end top\"\n containerPadding={0}\n hideArrow\n enableBothDismissButtons>\n <FocusScope restoreFocus>\n {content}\n </FocusScope>\n </Popover>\n );\n }\n\n return (\n <>\n <SubmenuTriggerContext.Provider value={{isUnavailable, triggerRef, ...submenuTriggerProps}}>{trigger}</SubmenuTriggerContext.Provider>\n <SlotProvider slots={slots}>\n {submenuTriggerState.isOpen && overlay}\n </SlotProvider>\n </>\n );\n}\n\nContextualHelpTrigger.getCollectionNode = function* getCollectionNode<T>(props: ItemProps<T>) {\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger] = childArray;\n let [, content] = props.children as [ReactElement, ReactElement];\n\n yield {\n element: React.cloneElement(trigger, {...trigger.props as any, hasChildItems: true, isTrigger: true}),\n wrapper: (element) => (\n <ContextualHelpTrigger key={element.key} targetKey={element.key} {...props}>\n {element}\n {content}\n </ContextualHelpTrigger>\n )\n };\n};\n\nlet _Item = ContextualHelpTrigger as (props: SpectrumMenuDialogTriggerProps) => JSX.Element;\nexport {_Item as ContextualHelpTrigger};\n"],"names":[],"version":3,"file":"ContextualHelpTrigger.module.js.map"}
@@ -37,10 +37,10 @@ $parcel$export(module.exports, "MenuTrigger", () => $e56311f7204399c7$export$27d
37
37
 
38
38
 
39
39
  function $e56311f7204399c7$var$MenuTrigger(props, ref) {
40
- let triggerRef = (0, $6doGq$react.useRef)();
40
+ let triggerRef = (0, $6doGq$react.useRef)(undefined);
41
41
  let domRef = (0, $6doGq$reactspectrumutils.useDOMRef)(ref);
42
42
  let menuTriggerRef = domRef || triggerRef;
43
- let menuRef = (0, $6doGq$react.useRef)();
43
+ let menuRef = (0, $6doGq$react.useRef)(undefined);
44
44
  let { children: children, align: align = 'start', shouldFlip: shouldFlip = true, direction: direction = 'bottom', closeOnSelect: closeOnSelect, trigger: trigger = 'press' } = props;
45
45
  let [menuTrigger, menu] = (0, ($parcel$interopDefault($6doGq$react))).Children.toArray(children);
46
46
  let state = (0, $6doGq$reactstatelymenu.useM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AAE,OAAO;QAAO,eAAA;OACjB;SAIL,wBACE,0DAAC,CAAA,GAAA,oCAAM;QACL,cAAc;YAAC,UAAU;YAAS,UAAU;YAAW,QAAQ;YAAS,aAAa;QAAK;QAC1F,OAAO;QACP,YAAY;QACZ,WAAW;QACX,WAAW;QACX,WAAA;QACA,YAAY;OACX;IAKP,qBACE,0DAAC,CAAA,GAAA,qBAAO,uBACN,0DAAC,CAAA,GAAA,sCAAW;QAAE,OAAO;YAAC,cAAc;gBAAC,gBAAgB,YAAY;YAAW;QAAC;qBAC3E,0DAAC,CAAA,GAAA,2CAAa;QAAG,GAAG,gBAAgB;QAAE,KAAK;QAAgB,WAAW,MAAM,MAAM;OAC/E,6BAGL,0DAAC,CAAA,GAAA,qCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B;AAIT;AAEA;;;CAGC,GACD,IAAI,0DAAe,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/menu/src/MenuTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, SlotProvider, useDOMRef, useIsMobileDevice} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {MenuContext} from './context';\nimport {Placement} from '@react-types/overlays';\nimport {Popover, Tray} from '@react-spectrum/overlays';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {forwardRef, Fragment, useRef} from 'react';\nimport {SpectrumMenuTriggerProps} from '@react-types/menu';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useMenuTrigger} from '@react-aria/menu';\nimport {useMenuTriggerState} from '@react-stately/menu';\n\nfunction MenuTrigger(props: SpectrumMenuTriggerProps, ref: DOMRef<HTMLElement>) {\n let triggerRef = useRef<HTMLElement>();\n let domRef = useDOMRef(ref);\n let menuTriggerRef = domRef || triggerRef;\n let menuRef = useRef<HTMLDivElement>();\n let {\n children,\n align = 'start',\n shouldFlip = true,\n direction = 'bottom',\n closeOnSelect,\n trigger = 'press'\n } = props;\n\n let [menuTrigger, menu] = React.Children.toArray(children);\n let state = useMenuTriggerState(props);\n\n let {menuTriggerProps, menuProps} = useMenuTrigger({trigger}, state, menuTriggerRef);\n\n let initialPlacement: Placement;\n switch (direction) {\n case 'left':\n case 'right':\n case 'start':\n case 'end':\n initialPlacement = `${direction} ${align === 'end' ? 'bottom' : 'top'}` as Placement;\n break;\n case 'bottom':\n case 'top':\n default:\n initialPlacement = `${direction} ${align}` as Placement;\n }\n\n let isMobile = useIsMobileDevice();\n let menuContext = {\n ...menuProps,\n ref: menuRef,\n onClose: state.close,\n closeOnSelect,\n autoFocus: state.focusStrategy || true,\n UNSAFE_style: isMobile ? {\n width: '100%',\n maxHeight: 'inherit'\n } : undefined,\n UNSAFE_className: classNames(styles, {'spectrum-Menu-popover': !isMobile}),\n state\n };\n\n // On small screen devices, the menu is rendered in a tray, otherwise a popover.\n let overlay;\n if (isMobile) {\n overlay = (\n <Tray state={state} isFixedHeight>\n {menu}\n </Tray>\n );\n } else {\n overlay = (\n <Popover\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', filter: 'unset', borderWidth: '0px'}}\n state={state}\n triggerRef={menuTriggerRef}\n scrollRef={menuRef}\n placement={initialPlacement}\n hideArrow\n shouldFlip={shouldFlip}>\n {menu}\n </Popover>\n );\n }\n\n return (\n <Fragment>\n <SlotProvider slots={{actionButton: {holdAffordance: trigger === 'longPress'}}}>\n <PressResponder {...menuTriggerProps} ref={menuTriggerRef} isPressed={state.isOpen}>\n {menuTrigger}\n </PressResponder>\n </SlotProvider>\n <MenuContext.Provider value={menuContext}>\n {overlay}\n </MenuContext.Provider>\n </Fragment>\n );\n}\n\n/**\n * The MenuTrigger serves as a wrapper around a Menu and its associated trigger,\n * linking the Menu's open state with the trigger's press state.\n */\nlet _MenuTrigger = forwardRef(MenuTrigger);\nexport {_MenuTrigger as MenuTrigger};\n"],"names":[],"version":3,"file":"MenuTrigger.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAcD,SAAS,kCAAY,KAA+B,EAAE,GAAwB;IAC5E,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAe;IACrC,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,iBAAiB,UAAU;IAC/B,IAAI,UAAU,CAAA,GAAA,mBAAK,EAAkB;IACrC,IAAI,YACF,QAAQ,SACR,QAAQ,qBACR,aAAa,iBACb,YAAY,yBACZ,aAAa,WACb,UAAU,SACX,GAAG;IAEJ,IAAI,CAAC,aAAa,KAAK,GAAG,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACjD,IAAI,QAAQ,CAAA,GAAA,2CAAkB,EAAE;IAEhC,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,mCAAa,EAAE;iBAAC;IAAO,GAAG,OAAO;IAErE,IAAI;IACJ,OAAQ;QACN,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,mBAAmB,CAAC,EAAE,UAAU,CAAC,EAAE,UAAU,QAAQ,WAAW,MAAM,CAAC;YACvE;QACF,KAAK;QACL,KAAK;QACL;YACE,mBAAmB,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAC9C;IAEA,IAAI,WAAW,CAAA,GAAA,2CAAgB;IAC/B,IAAI,cAAc;QAChB,GAAG,SAAS;QACZ,KAAK;QACL,SAAS,MAAM,KAAK;uBACpB;QACA,WAAW,MAAM,aAAa,IAAI;QAClC,cAAc,WAAW;YACvB,OAAO;YACP,WAAW;QACb,IAAI;QACJ,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YAAC,yBAAyB,CAAC;QAAQ;eACxE;IACF;IAEA,gFAAgF;IAChF,IAAI;IACJ,IAAI,UACF,wBACE,0DAAC,CAAA,GAAA,iCAAG;QAAE,OAAO;QAAO,eAAA;OACjB;SAIL,wBACE,0DAAC,CAAA,GAAA,oCAAM;QACL,cAAc;YAAC,UAAU;YAAS,UAAU;YAAW,QAAQ;YAAS,aAAa;QAAK;QAC1F,OAAO;QACP,YAAY;QACZ,WAAW;QACX,WAAW;QACX,WAAA;QACA,YAAY;OACX;IAKP,qBACE,0DAAC,CAAA,GAAA,qBAAO,uBACN,0DAAC,CAAA,GAAA,sCAAW;QAAE,OAAO;YAAC,cAAc;gBAAC,gBAAgB,YAAY;YAAW;QAAC;qBAC3E,0DAAC,CAAA,GAAA,2CAAa;QAAG,GAAG,gBAAgB;QAAE,KAAK;QAAgB,WAAW,MAAM,MAAM;OAC/E,6BAGL,0DAAC,CAAA,GAAA,qCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B;AAIT;AAEA;;;CAGC,GACD,IAAI,0DAAe,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/menu/src/MenuTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, SlotProvider, useDOMRef, useIsMobileDevice} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {MenuContext} from './context';\nimport {Placement} from '@react-types/overlays';\nimport {Popover, Tray} from '@react-spectrum/overlays';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {forwardRef, Fragment, useRef} from 'react';\nimport {SpectrumMenuTriggerProps} from '@react-types/menu';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useMenuTrigger} from '@react-aria/menu';\nimport {useMenuTriggerState} from '@react-stately/menu';\n\nfunction MenuTrigger(props: SpectrumMenuTriggerProps, ref: DOMRef<HTMLElement>) {\n let triggerRef = useRef<HTMLElement>(undefined);\n let domRef = useDOMRef(ref);\n let menuTriggerRef = domRef || triggerRef;\n let menuRef = useRef<HTMLDivElement>(undefined);\n let {\n children,\n align = 'start',\n shouldFlip = true,\n direction = 'bottom',\n closeOnSelect,\n trigger = 'press'\n } = props;\n\n let [menuTrigger, menu] = React.Children.toArray(children);\n let state = useMenuTriggerState(props);\n\n let {menuTriggerProps, menuProps} = useMenuTrigger({trigger}, state, menuTriggerRef);\n\n let initialPlacement: Placement;\n switch (direction) {\n case 'left':\n case 'right':\n case 'start':\n case 'end':\n initialPlacement = `${direction} ${align === 'end' ? 'bottom' : 'top'}` as Placement;\n break;\n case 'bottom':\n case 'top':\n default:\n initialPlacement = `${direction} ${align}` as Placement;\n }\n\n let isMobile = useIsMobileDevice();\n let menuContext = {\n ...menuProps,\n ref: menuRef,\n onClose: state.close,\n closeOnSelect,\n autoFocus: state.focusStrategy || true,\n UNSAFE_style: isMobile ? {\n width: '100%',\n maxHeight: 'inherit'\n } : undefined,\n UNSAFE_className: classNames(styles, {'spectrum-Menu-popover': !isMobile}),\n state\n };\n\n // On small screen devices, the menu is rendered in a tray, otherwise a popover.\n let overlay;\n if (isMobile) {\n overlay = (\n <Tray state={state} isFixedHeight>\n {menu}\n </Tray>\n );\n } else {\n overlay = (\n <Popover\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', filter: 'unset', borderWidth: '0px'}}\n state={state}\n triggerRef={menuTriggerRef}\n scrollRef={menuRef}\n placement={initialPlacement}\n hideArrow\n shouldFlip={shouldFlip}>\n {menu}\n </Popover>\n );\n }\n\n return (\n <Fragment>\n <SlotProvider slots={{actionButton: {holdAffordance: trigger === 'longPress'}}}>\n <PressResponder {...menuTriggerProps} ref={menuTriggerRef} isPressed={state.isOpen}>\n {menuTrigger}\n </PressResponder>\n </SlotProvider>\n <MenuContext.Provider value={menuContext}>\n {overlay}\n </MenuContext.Provider>\n </Fragment>\n );\n}\n\n/**\n * The MenuTrigger serves as a wrapper around a Menu and its associated trigger,\n * linking the Menu's open state with the trigger's press state.\n */\nlet _MenuTrigger = forwardRef(MenuTrigger);\nexport {_MenuTrigger as MenuTrigger};\n"],"names":[],"version":3,"file":"MenuTrigger.main.js.map"}
@@ -31,10 +31,10 @@ function $parcel$interopDefault(a) {
31
31
 
32
32
 
33
33
  function $aa0b855f135b86e3$var$MenuTrigger(props, ref) {
34
- let triggerRef = (0, $5R0iF$useRef)();
34
+ let triggerRef = (0, $5R0iF$useRef)(undefined);
35
35
  let domRef = (0, $5R0iF$useDOMRef)(ref);
36
36
  let menuTriggerRef = domRef || triggerRef;
37
- let menuRef = (0, $5R0iF$useRef)();
37
+ let menuRef = (0, $5R0iF$useRef)(undefined);
38
38
  let { children: children, align: align = 'start', shouldFlip: shouldFlip = true, direction: direction = 'bottom', closeOnSelect: closeOnSelect, trigger: trigger = 'press' } = props;
39
39
  let [menuTrigger, menu] = (0, $5R0iF$react).Children.toArray(children);
40
40
  let state = (0, $5R0iF$useMenuTriggerState)(props);
@@ -31,10 +31,10 @@ function $parcel$interopDefault(a) {
31
31
 
32
32
 
33
33
  function $aa0b855f135b86e3$var$MenuTrigger(props, ref) {
34
- let triggerRef = (0, $5R0iF$useRef)();
34
+ let triggerRef = (0, $5R0iF$useRef)(undefined);
35
35
  let domRef = (0, $5R0iF$useDOMRef)(ref);
36
36
  let menuTriggerRef = domRef || triggerRef;
37
- let menuRef = (0, $5R0iF$useRef)();
37
+ let menuRef = (0, $5R0iF$useRef)(undefined);
38
38
  let { children: children, align: align = 'start', shouldFlip: shouldFlip = true, direction: direction = 'bottom', closeOnSelect: closeOnSelect, trigger: trigger = 'press' } = props;
39
39
  let [menuTrigger, menu] = (0, $5R0iF$react).Children.toArray(children);
40
40
  let state = (0, $5R0iF$useMenuTriggerState)(props);
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAcD,SAAS,kCAAY,KAA+B,EAAE,GAAwB;IAC5E,IAAI,aAAa,CAAA,GAAA,aAAK;IACtB,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,iBAAiB,UAAU;IAC/B,IAAI,UAAU,CAAA,GAAA,aAAK;IACnB,IAAI,YACF,QAAQ,SACR,QAAQ,qBACR,aAAa,iBACb,YAAY,yBACZ,aAAa,WACb,UAAU,SACX,GAAG;IAEJ,IAAI,CAAC,aAAa,KAAK,GAAG,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACjD,IAAI,QAAQ,CAAA,GAAA,0BAAkB,EAAE;IAEhC,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;iBAAC;IAAO,GAAG,OAAO;IAErE,IAAI;IACJ,OAAQ;QACN,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,mBAAmB,CAAC,EAAE,UAAU,CAAC,EAAE,UAAU,QAAQ,WAAW,MAAM,CAAC;YACvE;QACF,KAAK;QACL,KAAK;QACL;YACE,mBAAmB,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAC9C;IAEA,IAAI,WAAW,CAAA,GAAA,wBAAgB;IAC/B,IAAI,cAAc;QAChB,GAAG,SAAS;QACZ,KAAK;QACL,SAAS,MAAM,KAAK;uBACpB;QACA,WAAW,MAAM,aAAa,IAAI;QAClC,cAAc,WAAW;YACvB,OAAO;YACP,WAAW;QACb,IAAI;QACJ,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;YAAC,yBAAyB,CAAC;QAAQ;eACxE;IACF;IAEA,gFAAgF;IAChF,IAAI;IACJ,IAAI,UACF,wBACE,gCAAC,CAAA,GAAA,WAAG;QAAE,OAAO;QAAO,eAAA;OACjB;SAIL,wBACE,gCAAC,CAAA,GAAA,cAAM;QACL,cAAc;YAAC,UAAU;YAAS,UAAU;YAAW,QAAQ;YAAS,aAAa;QAAK;QAC1F,OAAO;QACP,YAAY;QACZ,WAAW;QACX,WAAW;QACX,WAAA;QACA,YAAY;OACX;IAKP,qBACE,gCAAC,CAAA,GAAA,eAAO,uBACN,gCAAC,CAAA,GAAA,mBAAW;QAAE,OAAO;YAAC,cAAc;gBAAC,gBAAgB,YAAY;YAAW;QAAC;qBAC3E,gCAAC,CAAA,GAAA,qBAAa;QAAG,GAAG,gBAAgB;QAAE,KAAK;QAAgB,WAAW,MAAM,MAAM;OAC/E,6BAGL,gCAAC,CAAA,GAAA,yCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B;AAIT;AAEA;;;CAGC,GACD,IAAI,0DAAe,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/menu/src/MenuTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, SlotProvider, useDOMRef, useIsMobileDevice} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {MenuContext} from './context';\nimport {Placement} from '@react-types/overlays';\nimport {Popover, Tray} from '@react-spectrum/overlays';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {forwardRef, Fragment, useRef} from 'react';\nimport {SpectrumMenuTriggerProps} from '@react-types/menu';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useMenuTrigger} from '@react-aria/menu';\nimport {useMenuTriggerState} from '@react-stately/menu';\n\nfunction MenuTrigger(props: SpectrumMenuTriggerProps, ref: DOMRef<HTMLElement>) {\n let triggerRef = useRef<HTMLElement>();\n let domRef = useDOMRef(ref);\n let menuTriggerRef = domRef || triggerRef;\n let menuRef = useRef<HTMLDivElement>();\n let {\n children,\n align = 'start',\n shouldFlip = true,\n direction = 'bottom',\n closeOnSelect,\n trigger = 'press'\n } = props;\n\n let [menuTrigger, menu] = React.Children.toArray(children);\n let state = useMenuTriggerState(props);\n\n let {menuTriggerProps, menuProps} = useMenuTrigger({trigger}, state, menuTriggerRef);\n\n let initialPlacement: Placement;\n switch (direction) {\n case 'left':\n case 'right':\n case 'start':\n case 'end':\n initialPlacement = `${direction} ${align === 'end' ? 'bottom' : 'top'}` as Placement;\n break;\n case 'bottom':\n case 'top':\n default:\n initialPlacement = `${direction} ${align}` as Placement;\n }\n\n let isMobile = useIsMobileDevice();\n let menuContext = {\n ...menuProps,\n ref: menuRef,\n onClose: state.close,\n closeOnSelect,\n autoFocus: state.focusStrategy || true,\n UNSAFE_style: isMobile ? {\n width: '100%',\n maxHeight: 'inherit'\n } : undefined,\n UNSAFE_className: classNames(styles, {'spectrum-Menu-popover': !isMobile}),\n state\n };\n\n // On small screen devices, the menu is rendered in a tray, otherwise a popover.\n let overlay;\n if (isMobile) {\n overlay = (\n <Tray state={state} isFixedHeight>\n {menu}\n </Tray>\n );\n } else {\n overlay = (\n <Popover\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', filter: 'unset', borderWidth: '0px'}}\n state={state}\n triggerRef={menuTriggerRef}\n scrollRef={menuRef}\n placement={initialPlacement}\n hideArrow\n shouldFlip={shouldFlip}>\n {menu}\n </Popover>\n );\n }\n\n return (\n <Fragment>\n <SlotProvider slots={{actionButton: {holdAffordance: trigger === 'longPress'}}}>\n <PressResponder {...menuTriggerProps} ref={menuTriggerRef} isPressed={state.isOpen}>\n {menuTrigger}\n </PressResponder>\n </SlotProvider>\n <MenuContext.Provider value={menuContext}>\n {overlay}\n </MenuContext.Provider>\n </Fragment>\n );\n}\n\n/**\n * The MenuTrigger serves as a wrapper around a Menu and its associated trigger,\n * linking the Menu's open state with the trigger's press state.\n */\nlet _MenuTrigger = forwardRef(MenuTrigger);\nexport {_MenuTrigger as MenuTrigger};\n"],"names":[],"version":3,"file":"MenuTrigger.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAcD,SAAS,kCAAY,KAA+B,EAAE,GAAwB;IAC5E,IAAI,aAAa,CAAA,GAAA,aAAK,EAAe;IACrC,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,iBAAiB,UAAU;IAC/B,IAAI,UAAU,CAAA,GAAA,aAAK,EAAkB;IACrC,IAAI,YACF,QAAQ,SACR,QAAQ,qBACR,aAAa,iBACb,YAAY,yBACZ,aAAa,WACb,UAAU,SACX,GAAG;IAEJ,IAAI,CAAC,aAAa,KAAK,GAAG,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACjD,IAAI,QAAQ,CAAA,GAAA,0BAAkB,EAAE;IAEhC,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;iBAAC;IAAO,GAAG,OAAO;IAErE,IAAI;IACJ,OAAQ;QACN,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,mBAAmB,CAAC,EAAE,UAAU,CAAC,EAAE,UAAU,QAAQ,WAAW,MAAM,CAAC;YACvE;QACF,KAAK;QACL,KAAK;QACL;YACE,mBAAmB,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAC9C;IAEA,IAAI,WAAW,CAAA,GAAA,wBAAgB;IAC/B,IAAI,cAAc;QAChB,GAAG,SAAS;QACZ,KAAK;QACL,SAAS,MAAM,KAAK;uBACpB;QACA,WAAW,MAAM,aAAa,IAAI;QAClC,cAAc,WAAW;YACvB,OAAO;YACP,WAAW;QACb,IAAI;QACJ,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;YAAC,yBAAyB,CAAC;QAAQ;eACxE;IACF;IAEA,gFAAgF;IAChF,IAAI;IACJ,IAAI,UACF,wBACE,gCAAC,CAAA,GAAA,WAAG;QAAE,OAAO;QAAO,eAAA;OACjB;SAIL,wBACE,gCAAC,CAAA,GAAA,cAAM;QACL,cAAc;YAAC,UAAU;YAAS,UAAU;YAAW,QAAQ;YAAS,aAAa;QAAK;QAC1F,OAAO;QACP,YAAY;QACZ,WAAW;QACX,WAAW;QACX,WAAA;QACA,YAAY;OACX;IAKP,qBACE,gCAAC,CAAA,GAAA,eAAO,uBACN,gCAAC,CAAA,GAAA,mBAAW;QAAE,OAAO;YAAC,cAAc;gBAAC,gBAAgB,YAAY;YAAW;QAAC;qBAC3E,gCAAC,CAAA,GAAA,qBAAa;QAAG,GAAG,gBAAgB;QAAE,KAAK;QAAgB,WAAW,MAAM,MAAM;OAC/E,6BAGL,gCAAC,CAAA,GAAA,yCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B;AAIT;AAEA;;;CAGC,GACD,IAAI,0DAAe,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/menu/src/MenuTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, SlotProvider, useDOMRef, useIsMobileDevice} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {MenuContext} from './context';\nimport {Placement} from '@react-types/overlays';\nimport {Popover, Tray} from '@react-spectrum/overlays';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {forwardRef, Fragment, useRef} from 'react';\nimport {SpectrumMenuTriggerProps} from '@react-types/menu';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useMenuTrigger} from '@react-aria/menu';\nimport {useMenuTriggerState} from '@react-stately/menu';\n\nfunction MenuTrigger(props: SpectrumMenuTriggerProps, ref: DOMRef<HTMLElement>) {\n let triggerRef = useRef<HTMLElement>(undefined);\n let domRef = useDOMRef(ref);\n let menuTriggerRef = domRef || triggerRef;\n let menuRef = useRef<HTMLDivElement>(undefined);\n let {\n children,\n align = 'start',\n shouldFlip = true,\n direction = 'bottom',\n closeOnSelect,\n trigger = 'press'\n } = props;\n\n let [menuTrigger, menu] = React.Children.toArray(children);\n let state = useMenuTriggerState(props);\n\n let {menuTriggerProps, menuProps} = useMenuTrigger({trigger}, state, menuTriggerRef);\n\n let initialPlacement: Placement;\n switch (direction) {\n case 'left':\n case 'right':\n case 'start':\n case 'end':\n initialPlacement = `${direction} ${align === 'end' ? 'bottom' : 'top'}` as Placement;\n break;\n case 'bottom':\n case 'top':\n default:\n initialPlacement = `${direction} ${align}` as Placement;\n }\n\n let isMobile = useIsMobileDevice();\n let menuContext = {\n ...menuProps,\n ref: menuRef,\n onClose: state.close,\n closeOnSelect,\n autoFocus: state.focusStrategy || true,\n UNSAFE_style: isMobile ? {\n width: '100%',\n maxHeight: 'inherit'\n } : undefined,\n UNSAFE_className: classNames(styles, {'spectrum-Menu-popover': !isMobile}),\n state\n };\n\n // On small screen devices, the menu is rendered in a tray, otherwise a popover.\n let overlay;\n if (isMobile) {\n overlay = (\n <Tray state={state} isFixedHeight>\n {menu}\n </Tray>\n );\n } else {\n overlay = (\n <Popover\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', filter: 'unset', borderWidth: '0px'}}\n state={state}\n triggerRef={menuTriggerRef}\n scrollRef={menuRef}\n placement={initialPlacement}\n hideArrow\n shouldFlip={shouldFlip}>\n {menu}\n </Popover>\n );\n }\n\n return (\n <Fragment>\n <SlotProvider slots={{actionButton: {holdAffordance: trigger === 'longPress'}}}>\n <PressResponder {...menuTriggerProps} ref={menuTriggerRef} isPressed={state.isOpen}>\n {menuTrigger}\n </PressResponder>\n </SlotProvider>\n <MenuContext.Provider value={menuContext}>\n {overlay}\n </MenuContext.Provider>\n </Fragment>\n );\n}\n\n/**\n * The MenuTrigger serves as a wrapper around a Menu and its associated trigger,\n * linking the Menu's open state with the trigger's press state.\n */\nlet _MenuTrigger = forwardRef(MenuTrigger);\nexport {_MenuTrigger as MenuTrigger};\n"],"names":[],"version":3,"file":"MenuTrigger.module.js.map"}
@@ -41,7 +41,7 @@ $parcel$export(module.exports, "SubmenuTrigger", () => $86ed235c4695ff3f$export$
41
41
 
42
42
 
43
43
  function $86ed235c4695ff3f$var$SubmenuTrigger(props) {
44
- let triggerRef = (0, $esjnM$react.useRef)();
44
+ let triggerRef = (0, $esjnM$react.useRef)(undefined);
45
45
  let { children: children, targetKey: targetKey } = props;
46
46
  let [menuTrigger, menu] = (0, ($parcel$interopDefault($esjnM$react))).Children.toArray(children);
47
47
  let { popoverContainer: popoverContainer, trayContainerRef: trayContainerRef, menu: parentMenuRef, submenu: menuRef, rootMenuTriggerState: rootMenuTriggerState } = (0, $cac834c4bc0a51d3$exports.useMenuStateContext)();
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBD,SAAS,qCAAe,KAA0B;IAChD,IAAI,aAAa,CAAA,GAAA,mBAAK;IACtB,IAAI,YACF,QAAQ,aACR,SAAS,EACV,GAAG;IAEJ,IAAI,CAAC,aAAa,KAAK,GAAG,CAAA,GAAA,sC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,QAAQ,GAAG;gBAAG,GAAG,KAAK;eAChE,SACA;IAGP;AACF;AAEA,IAAI,4CAAkB","sources":["packages/@react-spectrum/menu/src/SubmenuTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, useIsMobileDevice} from '@react-spectrum/utils';\nimport {Key} from '@react-types/shared';\nimport {MenuContext, SubmenuTriggerContext, useMenuStateContext} from './context';\nimport {mergeProps} from '@react-aria/utils';\nimport {Popover} from '@react-spectrum/overlays';\nimport React, {ReactElement, useRef} from 'react';\nimport ReactDOM from 'react-dom';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSubmenuTrigger} from '@react-aria/menu';\nimport {useSubmenuTriggerState} from '@react-stately/menu';\n\ninterface SubmenuTriggerProps {\n /**\n * The contents of the SubmenuTrigger - an Item and a Menu.\n */\n children: ReactElement[],\n targetKey: Key\n}\n\nexport interface SpectrumSubmenuTriggerProps extends Omit<SubmenuTriggerProps, 'targetKey'> {}\n\nfunction SubmenuTrigger(props: SubmenuTriggerProps) {\n let triggerRef = useRef<HTMLDivElement>();\n let {\n children,\n targetKey\n } = props;\n\n let [menuTrigger, menu] = React.Children.toArray(children);\n let {popoverContainer, trayContainerRef, menu: parentMenuRef, submenu: menuRef, rootMenuTriggerState} = useMenuStateContext();\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: targetKey}, rootMenuTriggerState);\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef: menuRef\n }, submenuTriggerState, triggerRef);\n let isMobile = useIsMobileDevice();\n let onBackButtonPress = () => {\n submenuTriggerState.close();\n if (parentMenuRef.current && !parentMenuRef.current.contains(document.activeElement)) {\n parentMenuRef.current.focus();\n }\n };\n\n let {direction} = useLocale();\n let mobileSubmenuKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'ArrowLeft':\n if (direction === 'ltr') {\n triggerRef.current.focus();\n }\n break;\n case 'ArrowRight':\n if (direction === 'rtl') {\n triggerRef.current.focus();\n }\n break;\n }\n };\n\n let overlay;\n\n if (isMobile) {\n delete submenuTriggerProps.onBlur;\n delete submenuTriggerProps.onHoverChange;\n submenuProps.autoFocus ??= true;\n if (trayContainerRef.current && submenuTriggerState.isOpen) {\n overlay = ReactDOM.createPortal(menu, trayContainerRef.current);\n }\n } else {\n let onDismissButtonPress = () => {\n submenuTriggerState.close();\n parentMenuRef.current?.focus();\n };\n\n overlay = (\n <Popover\n {...popoverProps}\n onDismissButtonPress={onDismissButtonPress}\n UNSAFE_className={classNames(styles, 'spectrum-Submenu-popover')}\n container={popoverContainer}\n containerPadding={0}\n enableBothDismissButtons\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', borderWidth: '0px'}}\n state={submenuTriggerState}\n triggerRef={triggerRef}\n scrollRef={menuRef}\n placement=\"end top\"\n hideArrow>\n {menu}\n </Popover>\n );\n }\n\n let menuContext = {\n ...mergeProps(submenuProps, {\n ref: menuRef,\n UNSAFE_style: isMobile ? {\n width: '100%',\n maxHeight: 'inherit'\n } : undefined,\n UNSAFE_className: classNames(styles, {'spectrum-Menu-popover': !isMobile}),\n ...(isMobile && {\n onBackButtonPress,\n onKeyDown: mobileSubmenuKeyDown\n })\n })\n };\n\n return (\n <>\n <SubmenuTriggerContext.Provider value={{triggerRef, ...submenuTriggerProps}}>{menuTrigger}</SubmenuTriggerContext.Provider>\n <MenuContext.Provider value={menuContext}>\n {overlay}\n </MenuContext.Provider>\n </>\n );\n}\n\nSubmenuTrigger.getCollectionNode = function* (props: SpectrumSubmenuTriggerProps) {\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger] = childArray;\n let [, content] = props.children as [ReactElement, ReactElement];\n\n yield {\n element: React.cloneElement(trigger, {...trigger.props, hasChildItems: true, isTrigger: true}),\n wrapper: (element) => (\n <SubmenuTrigger key={element.key} targetKey={element.key} {...props}>\n {element}\n {content}\n </SubmenuTrigger>\n )\n };\n};\n\nlet _SubmenuTrigger = SubmenuTrigger as (props: SpectrumSubmenuTriggerProps) => JSX.Element;\nexport {_SubmenuTrigger as SubmenuTrigger};\n"],"names":[],"version":3,"file":"SubmenuTrigger.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBD,SAAS,qCAAe,KAA0B;IAChD,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAkB;IACxC,IAAI,YACF,QAAQ,aACR,SAAS,EACV,GAAG;IAEJ,IAAI,CAAC,aAAa,KAAK,GAAG,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACjD,IAAI,oBAAC,gBAAgB,oBAAE,gBAAgB,EAAE,MAAM,aAAa,EAAE,SAAS,OAAO,wBAAE,oBAAoB,EAAC,GAAG,CAAA,GAAA,6CAAkB;IAC1H,IAAI,sBAAsB,CAAA,GAAA,8CAAqB,EAAE;QAAC,YAAY;IAAS,GAAG;IAC1E,IAAI,uBAAC,mBAAmB,gBAAE,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,sCAAgB,EAAE;uBACxE;QACA,YAAY;IACd,GAAG,qBAAqB;IACxB,IAAI,WAAW,CAAA,GAAA,2CAAgB;IAC/B,IAAI,oBAAoB;QACtB,oBAAoB,KAAK;QACzB,IAAI,cAAc,OAAO,IAAI,CAAC,cAAc,OAAO,CAAC,QAAQ,CAAC,SAAS,aAAa,GACjF,c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EAAE;IACJ;IAEA,qBACE,oIACE,0DAAC,CAAA,GAAA,+CAAoB,EAAE,QAAQ;QAAC,OAAO;wBAAC;YAAY,GAAG,mBAAmB;QAAA;OAAI,4BAC9E,0DAAC,CAAA,GAAA,qCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B;AAIT;AAEA,qCAAe,iBAAiB,GAAG,UAAW,KAAkC;IAC9E,IAAI,aAA6B,EAAE;IACnC,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,CAAA;QACrC,kBAAI,CAAA,GAAA,sCAAI,EAAE,cAAc,CAAC,QACvB,WAAW,IAAI,CAAC;IAEpB;IACA,IAAI,CAAC,QAAQ,GAAG;IAChB,IAAI,GAAG,QAAQ,GAAG,MAAM,QAAQ;IAEhC,MAAM;QACJ,uBAAS,CAAA,GAAA,sCAAI,EAAE,YAAY,CAAC,SAAS;YAAC,GAAG,QAAQ,KAAK;YAAS,eAAe;YAAM,WAAW;QAAI;QACnG,SAAS,CAAC,wBACR,0DAAC;gBAAe,KAAK,QAAQ,GAAG;gBAAE,WAAW,QAAQ,GAAG;gBAAG,GAAG,KAAK;eAChE,SACA;IAGP;AACF;AAEA,IAAI,4CAAkB","sources":["packages/@react-spectrum/menu/src/SubmenuTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, useIsMobileDevice} from '@react-spectrum/utils';\nimport {Key} from '@react-types/shared';\nimport {MenuContext, SubmenuTriggerContext, useMenuStateContext} from './context';\nimport {mergeProps} from '@react-aria/utils';\nimport {Popover} from '@react-spectrum/overlays';\nimport React, {type JSX, ReactElement, useRef} from 'react';\nimport ReactDOM from 'react-dom';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSubmenuTrigger} from '@react-aria/menu';\nimport {useSubmenuTriggerState} from '@react-stately/menu';\n\ninterface SubmenuTriggerProps {\n /**\n * The contents of the SubmenuTrigger - an Item and a Menu.\n */\n children: ReactElement<any>[],\n targetKey: Key\n}\n\nexport interface SpectrumSubmenuTriggerProps extends Omit<SubmenuTriggerProps, 'targetKey'> {}\n\nfunction SubmenuTrigger(props: SubmenuTriggerProps) {\n let triggerRef = useRef<HTMLDivElement>(undefined);\n let {\n children,\n targetKey\n } = props;\n\n let [menuTrigger, menu] = React.Children.toArray(children);\n let {popoverContainer, trayContainerRef, menu: parentMenuRef, submenu: menuRef, rootMenuTriggerState} = useMenuStateContext();\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: targetKey}, rootMenuTriggerState);\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef: menuRef\n }, submenuTriggerState, triggerRef);\n let isMobile = useIsMobileDevice();\n let onBackButtonPress = () => {\n submenuTriggerState.close();\n if (parentMenuRef.current && !parentMenuRef.current.contains(document.activeElement)) {\n parentMenuRef.current.focus();\n }\n };\n\n let {direction} = useLocale();\n let mobileSubmenuKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'ArrowLeft':\n if (direction === 'ltr') {\n triggerRef.current.focus();\n }\n break;\n case 'ArrowRight':\n if (direction === 'rtl') {\n triggerRef.current.focus();\n }\n break;\n }\n };\n\n let overlay;\n\n if (isMobile) {\n delete submenuTriggerProps.onBlur;\n delete submenuTriggerProps.onHoverChange;\n submenuProps.autoFocus ??= true;\n if (trayContainerRef.current && submenuTriggerState.isOpen) {\n overlay = ReactDOM.createPortal(menu, trayContainerRef.current);\n }\n } else {\n let onDismissButtonPress = () => {\n submenuTriggerState.close();\n parentMenuRef.current?.focus();\n };\n\n overlay = (\n <Popover\n {...popoverProps}\n onDismissButtonPress={onDismissButtonPress}\n UNSAFE_className={classNames(styles, 'spectrum-Submenu-popover')}\n container={popoverContainer}\n containerPadding={0}\n enableBothDismissButtons\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', borderWidth: '0px'}}\n state={submenuTriggerState}\n triggerRef={triggerRef}\n scrollRef={menuRef}\n placement=\"end top\"\n hideArrow>\n {menu}\n </Popover>\n );\n }\n\n let menuContext = {\n ...mergeProps(submenuProps, {\n ref: menuRef,\n UNSAFE_style: isMobile ? {\n width: '100%',\n maxHeight: 'inherit'\n } : undefined,\n UNSAFE_className: classNames(styles, {'spectrum-Menu-popover': !isMobile}),\n ...(isMobile && {\n onBackButtonPress,\n onKeyDown: mobileSubmenuKeyDown\n })\n })\n };\n\n return (\n <>\n <SubmenuTriggerContext.Provider value={{triggerRef, ...submenuTriggerProps}}>{menuTrigger}</SubmenuTriggerContext.Provider>\n <MenuContext.Provider value={menuContext}>\n {overlay}\n </MenuContext.Provider>\n </>\n );\n}\n\nSubmenuTrigger.getCollectionNode = function* (props: SpectrumSubmenuTriggerProps) {\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger] = childArray;\n let [, content] = props.children as [ReactElement, ReactElement];\n\n yield {\n element: React.cloneElement(trigger, {...trigger.props as any, hasChildItems: true, isTrigger: true}),\n wrapper: (element) => (\n <SubmenuTrigger key={element.key} targetKey={element.key} {...props}>\n {element}\n {content}\n </SubmenuTrigger>\n )\n };\n};\n\nlet _SubmenuTrigger = SubmenuTrigger as (props: SpectrumSubmenuTriggerProps) => JSX.Element;\nexport {_SubmenuTrigger as SubmenuTrigger};\n"],"names":[],"version":3,"file":"SubmenuTrigger.main.js.map"}
@@ -35,7 +35,7 @@ function $parcel$interopDefault(a) {
35
35
 
36
36
 
37
37
  function $3f13e15cf95c3893$var$SubmenuTrigger(props) {
38
- let triggerRef = (0, $byZ4r$useRef)();
38
+ let triggerRef = (0, $byZ4r$useRef)(undefined);
39
39
  let { children: children, targetKey: targetKey } = props;
40
40
  let [menuTrigger, menu] = (0, $byZ4r$react).Children.toArray(children);
41
41
  let { popoverContainer: popoverContainer, trayContainerRef: trayContainerRef, menu: parentMenuRef, submenu: menuRef, rootMenuTriggerState: rootMenuTriggerState } = (0, $d94604d52c3e3feb$export$efa3856fc0e85e7f)();
@@ -35,7 +35,7 @@ function $parcel$interopDefault(a) {
35
35
 
36
36
 
37
37
  function $3f13e15cf95c3893$var$SubmenuTrigger(props) {
38
- let triggerRef = (0, $byZ4r$useRef)();
38
+ let triggerRef = (0, $byZ4r$useRef)(undefined);
39
39
  let { children: children, targetKey: targetKey } = props;
40
40
  let [menuTrigger, menu] = (0, $byZ4r$react).Children.toArray(children);
41
41
  let { popoverContainer: popoverContainer, trayContainerRef: trayContainerRef, menu: parentMenuRef, submenu: menuRef, rootMenuTriggerState: rootMenuTriggerState } = (0, $d94604d52c3e3feb$export$efa3856fc0e85e7f)();
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBD,SAAS,qCAAe,KAA0B;IAChD,IAAI,aAAa,CAAA,GAAA,aAAK;IACtB,IAAI,YACF,QAAQ,aACR,SAAS,EACV,GAAG;IAEJ,IAAI,CAAC,aAAa,KAAK,GAAG,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACjD,IAAI,oBAAC,gBAAgB,oBAAE,gBAAgB,EAAE,MAAM,aAAa,EAAE,SAAS,OAAO,wBAAE,oBAAoB,EAAC,GAAG,CAAA,GAAA,yCAAkB;IAC1H,IAAI,sBAAsB,CAAA,GAAA,6BAAqB,EAAE;QAAC,YAAY;IAAS,GAAG;IAC1E,IAAI,uBAAC,mBAAmB,gBAAE,YAAY,gBAAE,YAAY,EAAC,GAA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iBAAS,EAAE,cAAc;YAC1B,KAAK;YACL,cAAc,WAAW;gBACvB,OAAO;gBACP,WAAW;YACb,IAAI;YACJ,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;gBAAC,yBAAyB,CAAC;YAAQ;YACxE,GAAI,YAAY;mCACd;gBACA,WAAW;YACb,CAAC;QACH,EAAE;IACJ;IAEA,qBACE,gFACE,gCAAC,CAAA,GAAA,yCAAoB,EAAE,QAAQ;QAAC,OAAO;wBAAC;YAAY,GAAG,mBAAmB;QAAA;OAAI,4BAC9E,gCAAC,CAAA,GAAA,yCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B;AAIT;AAEA,qCAAe,iBAAiB,GAAG,UAAW,KAAkC;IAC9E,IAAI,aAA6B,EAAE;IACnC,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,CAAA;QACrC,kBAAI,CAAA,GAAA,YAAI,EAAE,cAAc,CAAC,QACvB,WAAW,IAAI,CAAC;IAEpB;IACA,IAAI,CAAC,QAAQ,GAAG;IAChB,IAAI,GAAG,QAAQ,GAAG,MAAM,QAAQ;IAEhC,MAAM;QACJ,uBAAS,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,SAAS;YAAC,GAAG,QAAQ,KAAK;YAAE,eAAe;YAAM,WAAW;QAAI;QAC5F,SAAS,CAAC,wBACR,gCAAC;gBAAe,KAAK,QAAQ,GAAG;gBAAE,WAAW,QAAQ,GAAG;gBAAG,GAAG,KAAK;eAChE,SACA;IAGP;AACF;AAEA,IAAI,4CAAkB","sources":["packages/@react-spectrum/menu/src/SubmenuTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, useIsMobileDevice} from '@react-spectrum/utils';\nimport {Key} from '@react-types/shared';\nimport {MenuContext, SubmenuTriggerContext, useMenuStateContext} from './context';\nimport {mergeProps} from '@react-aria/utils';\nimport {Popover} from '@react-spectrum/overlays';\nimport React, {ReactElement, useRef} from 'react';\nimport ReactDOM from 'react-dom';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSubmenuTrigger} from '@react-aria/menu';\nimport {useSubmenuTriggerState} from '@react-stately/menu';\n\ninterface SubmenuTriggerProps {\n /**\n * The contents of the SubmenuTrigger - an Item and a Menu.\n */\n children: ReactElement[],\n targetKey: Key\n}\n\nexport interface SpectrumSubmenuTriggerProps extends Omit<SubmenuTriggerProps, 'targetKey'> {}\n\nfunction SubmenuTrigger(props: SubmenuTriggerProps) {\n let triggerRef = useRef<HTMLDivElement>();\n let {\n children,\n targetKey\n } = props;\n\n let [menuTrigger, menu] = React.Children.toArray(children);\n let {popoverContainer, trayContainerRef, menu: parentMenuRef, submenu: menuRef, rootMenuTriggerState} = useMenuStateContext();\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: targetKey}, rootMenuTriggerState);\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef: menuRef\n }, submenuTriggerState, triggerRef);\n let isMobile = useIsMobileDevice();\n let onBackButtonPress = () => {\n submenuTriggerState.close();\n if (parentMenuRef.current && !parentMenuRef.current.contains(document.activeElement)) {\n parentMenuRef.current.focus();\n }\n };\n\n let {direction} = useLocale();\n let mobileSubmenuKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'ArrowLeft':\n if (direction === 'ltr') {\n triggerRef.current.focus();\n }\n break;\n case 'ArrowRight':\n if (direction === 'rtl') {\n triggerRef.current.focus();\n }\n break;\n }\n };\n\n let overlay;\n\n if (isMobile) {\n delete submenuTriggerProps.onBlur;\n delete submenuTriggerProps.onHoverChange;\n submenuProps.autoFocus ??= true;\n if (trayContainerRef.current && submenuTriggerState.isOpen) {\n overlay = ReactDOM.createPortal(menu, trayContainerRef.current);\n }\n } else {\n let onDismissButtonPress = () => {\n submenuTriggerState.close();\n parentMenuRef.current?.focus();\n };\n\n overlay = (\n <Popover\n {...popoverProps}\n onDismissButtonPress={onDismissButtonPress}\n UNSAFE_className={classNames(styles, 'spectrum-Submenu-popover')}\n container={popoverContainer}\n containerPadding={0}\n enableBothDismissButtons\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', borderWidth: '0px'}}\n state={submenuTriggerState}\n triggerRef={triggerRef}\n scrollRef={menuRef}\n placement=\"end top\"\n hideArrow>\n {menu}\n </Popover>\n );\n }\n\n let menuContext = {\n ...mergeProps(submenuProps, {\n ref: menuRef,\n UNSAFE_style: isMobile ? {\n width: '100%',\n maxHeight: 'inherit'\n } : undefined,\n UNSAFE_className: classNames(styles, {'spectrum-Menu-popover': !isMobile}),\n ...(isMobile && {\n onBackButtonPress,\n onKeyDown: mobileSubmenuKeyDown\n })\n })\n };\n\n return (\n <>\n <SubmenuTriggerContext.Provider value={{triggerRef, ...submenuTriggerProps}}>{menuTrigger}</SubmenuTriggerContext.Provider>\n <MenuContext.Provider value={menuContext}>\n {overlay}\n </MenuContext.Provider>\n </>\n );\n}\n\nSubmenuTrigger.getCollectionNode = function* (props: SpectrumSubmenuTriggerProps) {\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger] = childArray;\n let [, content] = props.children as [ReactElement, ReactElement];\n\n yield {\n element: React.cloneElement(trigger, {...trigger.props, hasChildItems: true, isTrigger: true}),\n wrapper: (element) => (\n <SubmenuTrigger key={element.key} targetKey={element.key} {...props}>\n {element}\n {content}\n </SubmenuTrigger>\n )\n };\n};\n\nlet _SubmenuTrigger = SubmenuTrigger as (props: SpectrumSubmenuTriggerProps) => JSX.Element;\nexport {_SubmenuTrigger as SubmenuTrigger};\n"],"names":[],"version":3,"file":"SubmenuTrigger.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBD,SAAS,qCAAe,KAA0B;IAChD,IAAI,aAAa,CAAA,GAAA,aAAK,EAAkB;IACxC,IAAI,YACF,QAAQ,aACR,SAAS,EACV,GAAG;IAEJ,IAAI,CAAC,aAAa,KAAK,GAAG,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACjD,IAAI,oBAAC,gBAAgB,oBAAE,gBAAgB,EAAE,MAAM,aAAa,EAAE,SAAS,OAAO,wBAAE,oBAAoB,EAAC,GAAG,CAAA,GAAA,yCAAkB;IAC1H,IAAI,sBAAsB,CAAA,GAAA,6BAAqB,EAAE;QAAC,YAAY;IAAS,GAAG;IAC1E,IAAI,uBAAC,mBAAmB,gBAAE,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;uBACxE;QACA,YAAY;IACd,GAAG,qBAAqB;IACxB,IAAI,WAAW,CAAA,GAAA,wBAAgB;IAC/B,IAAI,oBAAoB;QACtB,oBAAoB,KAAK;QACzB,IAAI,cAAc,OAAO,IAAI,CAAC,cAAc,OAAO,CAAC,QAAQ,CAAC,SAAS,aAAa,GACjF,cAAc,OAAO,CAAC,KAAK;IAE/B;IAEA,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,uBAAuB,CAAC;QAC1B,OAAQ,EAAE,GAAG;YACX,KAAK;gBACH,IAAI,cAAc,OAChB,WAAW,OAAO,CAAC,KAAK;gBAE1B;YACF,KAAK;gBACH,IAAI,cAAc,OAChB,WAAW,OAAO,CAAC,KAAK;gBAE1B;QACJ;IACF;IAEA,IAAI;IAEJ,IAAI,UAAW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MAAM,QAAQ,EAAE,CAAA;QACrC,kBAAI,CAAA,GAAA,YAAI,EAAE,cAAc,CAAC,QACvB,WAAW,IAAI,CAAC;IAEpB;IACA,IAAI,CAAC,QAAQ,GAAG;IAChB,IAAI,GAAG,QAAQ,GAAG,MAAM,QAAQ;IAEhC,MAAM;QACJ,uBAAS,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,SAAS;YAAC,GAAG,QAAQ,KAAK;YAAS,eAAe;YAAM,WAAW;QAAI;QACnG,SAAS,CAAC,wBACR,gCAAC;gBAAe,KAAK,QAAQ,GAAG;gBAAE,WAAW,QAAQ,GAAG;gBAAG,GAAG,KAAK;eAChE,SACA;IAGP;AACF;AAEA,IAAI,4CAAkB","sources":["packages/@react-spectrum/menu/src/SubmenuTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, useIsMobileDevice} from '@react-spectrum/utils';\nimport {Key} from '@react-types/shared';\nimport {MenuContext, SubmenuTriggerContext, useMenuStateContext} from './context';\nimport {mergeProps} from '@react-aria/utils';\nimport {Popover} from '@react-spectrum/overlays';\nimport React, {type JSX, ReactElement, useRef} from 'react';\nimport ReactDOM from 'react-dom';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSubmenuTrigger} from '@react-aria/menu';\nimport {useSubmenuTriggerState} from '@react-stately/menu';\n\ninterface SubmenuTriggerProps {\n /**\n * The contents of the SubmenuTrigger - an Item and a Menu.\n */\n children: ReactElement<any>[],\n targetKey: Key\n}\n\nexport interface SpectrumSubmenuTriggerProps extends Omit<SubmenuTriggerProps, 'targetKey'> {}\n\nfunction SubmenuTrigger(props: SubmenuTriggerProps) {\n let triggerRef = useRef<HTMLDivElement>(undefined);\n let {\n children,\n targetKey\n } = props;\n\n let [menuTrigger, menu] = React.Children.toArray(children);\n let {popoverContainer, trayContainerRef, menu: parentMenuRef, submenu: menuRef, rootMenuTriggerState} = useMenuStateContext();\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: targetKey}, rootMenuTriggerState);\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef: menuRef\n }, submenuTriggerState, triggerRef);\n let isMobile = useIsMobileDevice();\n let onBackButtonPress = () => {\n submenuTriggerState.close();\n if (parentMenuRef.current && !parentMenuRef.current.contains(document.activeElement)) {\n parentMenuRef.current.focus();\n }\n };\n\n let {direction} = useLocale();\n let mobileSubmenuKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'ArrowLeft':\n if (direction === 'ltr') {\n triggerRef.current.focus();\n }\n break;\n case 'ArrowRight':\n if (direction === 'rtl') {\n triggerRef.current.focus();\n }\n break;\n }\n };\n\n let overlay;\n\n if (isMobile) {\n delete submenuTriggerProps.onBlur;\n delete submenuTriggerProps.onHoverChange;\n submenuProps.autoFocus ??= true;\n if (trayContainerRef.current && submenuTriggerState.isOpen) {\n overlay = ReactDOM.createPortal(menu, trayContainerRef.current);\n }\n } else {\n let onDismissButtonPress = () => {\n submenuTriggerState.close();\n parentMenuRef.current?.focus();\n };\n\n overlay = (\n <Popover\n {...popoverProps}\n onDismissButtonPress={onDismissButtonPress}\n UNSAFE_className={classNames(styles, 'spectrum-Submenu-popover')}\n container={popoverContainer}\n containerPadding={0}\n enableBothDismissButtons\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', borderWidth: '0px'}}\n state={submenuTriggerState}\n triggerRef={triggerRef}\n scrollRef={menuRef}\n placement=\"end top\"\n hideArrow>\n {menu}\n </Popover>\n );\n }\n\n let menuContext = {\n ...mergeProps(submenuProps, {\n ref: menuRef,\n UNSAFE_style: isMobile ? {\n width: '100%',\n maxHeight: 'inherit'\n } : undefined,\n UNSAFE_className: classNames(styles, {'spectrum-Menu-popover': !isMobile}),\n ...(isMobile && {\n onBackButtonPress,\n onKeyDown: mobileSubmenuKeyDown\n })\n })\n };\n\n return (\n <>\n <SubmenuTriggerContext.Provider value={{triggerRef, ...submenuTriggerProps}}>{menuTrigger}</SubmenuTriggerContext.Provider>\n <MenuContext.Provider value={menuContext}>\n {overlay}\n </MenuContext.Provider>\n </>\n );\n}\n\nSubmenuTrigger.getCollectionNode = function* (props: SpectrumSubmenuTriggerProps) {\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger] = childArray;\n let [, content] = props.children as [ReactElement, ReactElement];\n\n yield {\n element: React.cloneElement(trigger, {...trigger.props as any, hasChildItems: true, isTrigger: true}),\n wrapper: (element) => (\n <SubmenuTrigger key={element.key} targetKey={element.key} {...props}>\n {element}\n {content}\n </SubmenuTrigger>\n )\n };\n};\n\nlet _SubmenuTrigger = SubmenuTrigger as (props: SpectrumSubmenuTriggerProps) => JSX.Element;\nexport {_SubmenuTrigger as SubmenuTrigger};\n"],"names":[],"version":3,"file":"SubmenuTrigger.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAkBM,MAAM,4CAAc,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAmB,CAAC;AAE3D,SAAS;IACd,OAAO,CAAA,GAAA,uBAAS,EAAE;AACpB;AAWO,MAAM,4CAAwB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAyC;AAE1F,SAAS;IACd,OAAO,CAAA,GAAA,uBAAS,EAAE;AACpB;AAWO,MAAM,4CAAmB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAA6B;AAEzE,SAAS;IACd,OAAO,CAAA,GAAA,uBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/menu/src/context.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMProps, FocusStrategy, HoverEvents, KeyboardEvents, PressEvents} from '@react-types/shared';\nimport React, {HTMLAttributes, MutableRefObject, RefObject, useContext} from 'react';\nimport {RootMenuTriggerState} from '@react-stately/menu';\nimport {TreeState} from '@react-stately/tree';\n\nexport interface MenuContextValue extends Omit<HTMLAttributes<HTMLElement>, 'autoFocus' | 'onKeyDown'>, Pick<KeyboardEvents, 'onKeyDown'> {\n onClose?: () => void,\n closeOnSelect?: boolean,\n shouldFocusWrap?: boolean,\n autoFocus?: boolean | FocusStrategy,\n ref?: MutableRefObject<HTMLDivElement>,\n state?: RootMenuTriggerState,\n onBackButtonPress?: () => void,\n submenuLevel?: number\n}\n\nexport const MenuContext = React.createContext<MenuContextValue>({});\n\nexport function useMenuContext(): MenuContextValue {\n return useContext(MenuContext);\n}\n\nexport interface SubmenuTriggerContextValue extends DOMProps, Pick<PressEvents, 'onPressStart' | 'onPress'>, Pick<HoverEvents, 'onHoverChange'>, Pick<KeyboardEvents, 'onKeyDown'> {\n isUnavailable?: boolean,\n triggerRef?: MutableRefObject<HTMLElement>,\n 'aria-expanded'?: boolean | 'true' | 'false',\n 'aria-controls'?: string,\n 'aria-haspopup'?: 'dialog' | 'menu',\n isOpen?: boolean\n}\n\nexport const SubmenuTriggerContext = React.createContext<SubmenuTriggerContextValue | undefined>(undefined);\n\nexport function useSubmenuTriggerContext(): SubmenuTriggerContextValue {\n return useContext(SubmenuTriggerContext);\n}\n\nexport interface MenuStateContextValue<T> {\n state?: TreeState<T>,\n popoverContainer?: HTMLElement,\n trayContainerRef?: RefObject<HTMLElement>,\n menu?: RefObject<HTMLDivElement>,\n submenu?: RefObject<HTMLDivElement>,\n rootMenuTriggerState?: RootMenuTriggerState\n}\n\nexport const MenuStateContext = React.createContext<MenuStateContextValue<any>>(undefined);\n\nexport function useMenuStateContext<T>(): MenuStateContextValue<T> {\n return useContext(MenuStateContext);\n}\n"],"names":[],"version":3,"file":"context.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAkBM,MAAM,4CAAc,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAmB,CAAC;AAE3D,SAAS;IACd,OAAO,CAAA,GAAA,uBAAS,EAAE;AACpB;AAWO,MAAM,4CAAwB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAyC;AAE1F,SAAS;IACd,OAAO,CAAA,GAAA,uBAAS,EAAE;AACpB;AAWO,MAAM,4CAAmB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAA6B;AAEzE,SAAS;IACd,OAAO,CAAA,GAAA,uBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/menu/src/context.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMProps, FocusStrategy, HoverEvents, KeyboardEvents, PressEvents} from '@react-types/shared';\nimport React, {HTMLAttributes, MutableRefObject, RefObject, useContext} from 'react';\nimport {RootMenuTriggerState} from '@react-stately/menu';\nimport {TreeState} from '@react-stately/tree';\n\nexport interface MenuContextValue extends Omit<HTMLAttributes<HTMLElement>, 'autoFocus' | 'onKeyDown'>, Pick<KeyboardEvents, 'onKeyDown'> {\n onClose?: () => void,\n closeOnSelect?: boolean,\n shouldFocusWrap?: boolean,\n autoFocus?: boolean | FocusStrategy,\n ref?: MutableRefObject<HTMLDivElement>,\n state?: RootMenuTriggerState,\n onBackButtonPress?: () => void,\n submenuLevel?: number\n}\n\nexport const MenuContext = React.createContext<MenuContextValue>({});\n\nexport function useMenuContext(): MenuContextValue {\n return useContext(MenuContext);\n}\n\nexport interface SubmenuTriggerContextValue extends DOMProps, Pick<PressEvents, 'onPressStart' | 'onPress'>, Pick<HoverEvents, 'onHoverChange'>, Pick<KeyboardEvents, 'onKeyDown'> {\n isUnavailable?: boolean,\n triggerRef?: MutableRefObject<HTMLElement>,\n 'aria-expanded'?: boolean | 'true' | 'false',\n 'aria-controls'?: string,\n 'aria-haspopup'?: 'dialog' | 'menu',\n isOpen?: boolean\n}\n\nexport const SubmenuTriggerContext = React.createContext<SubmenuTriggerContextValue | undefined>(undefined);\n\nexport function useSubmenuTriggerContext(): SubmenuTriggerContextValue {\n return useContext(SubmenuTriggerContext);\n}\n\nexport interface MenuStateContextValue<T> {\n state?: TreeState<T>,\n popoverContainer?: HTMLElement,\n trayContainerRef?: RefObject<HTMLElement | null>,\n menu?: RefObject<HTMLDivElement | null>,\n submenu?: RefObject<HTMLDivElement | null>,\n rootMenuTriggerState?: RootMenuTriggerState\n}\n\nexport const MenuStateContext = React.createContext<MenuStateContextValue<any>>(undefined);\n\nexport function useMenuStateContext<T>(): MenuStateContextValue<T> {\n return useContext(MenuStateContext);\n}\n"],"names":[],"version":3,"file":"context.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAkBM,MAAM,4CAAc,CAAA,GAAA,YAAI,EAAE,aAAa,CAAmB,CAAC;AAE3D,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE;AACpB;AAWO,MAAM,4CAAwB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAyC;AAE1F,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE;AACpB;AAWO,MAAM,4CAAmB,CAAA,GAAA,YAAI,EAAE,aAAa,CAA6B;AAEzE,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/menu/src/context.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMProps, FocusStrategy, HoverEvents, KeyboardEvents, PressEvents} from '@react-types/shared';\nimport React, {HTMLAttributes, MutableRefObject, RefObject, useContext} from 'react';\nimport {RootMenuTriggerState} from '@react-stately/menu';\nimport {TreeState} from '@react-stately/tree';\n\nexport interface MenuContextValue extends Omit<HTMLAttributes<HTMLElement>, 'autoFocus' | 'onKeyDown'>, Pick<KeyboardEvents, 'onKeyDown'> {\n onClose?: () => void,\n closeOnSelect?: boolean,\n shouldFocusWrap?: boolean,\n autoFocus?: boolean | FocusStrategy,\n ref?: MutableRefObject<HTMLDivElement>,\n state?: RootMenuTriggerState,\n onBackButtonPress?: () => void,\n submenuLevel?: number\n}\n\nexport const MenuContext = React.createContext<MenuContextValue>({});\n\nexport function useMenuContext(): MenuContextValue {\n return useContext(MenuContext);\n}\n\nexport interface SubmenuTriggerContextValue extends DOMProps, Pick<PressEvents, 'onPressStart' | 'onPress'>, Pick<HoverEvents, 'onHoverChange'>, Pick<KeyboardEvents, 'onKeyDown'> {\n isUnavailable?: boolean,\n triggerRef?: MutableRefObject<HTMLElement>,\n 'aria-expanded'?: boolean | 'true' | 'false',\n 'aria-controls'?: string,\n 'aria-haspopup'?: 'dialog' | 'menu',\n isOpen?: boolean\n}\n\nexport const SubmenuTriggerContext = React.createContext<SubmenuTriggerContextValue | undefined>(undefined);\n\nexport function useSubmenuTriggerContext(): SubmenuTriggerContextValue {\n return useContext(SubmenuTriggerContext);\n}\n\nexport interface MenuStateContextValue<T> {\n state?: TreeState<T>,\n popoverContainer?: HTMLElement,\n trayContainerRef?: RefObject<HTMLElement>,\n menu?: RefObject<HTMLDivElement>,\n submenu?: RefObject<HTMLDivElement>,\n rootMenuTriggerState?: RootMenuTriggerState\n}\n\nexport const MenuStateContext = React.createContext<MenuStateContextValue<any>>(undefined);\n\nexport function useMenuStateContext<T>(): MenuStateContextValue<T> {\n return useContext(MenuStateContext);\n}\n"],"names":[],"version":3,"file":"context.module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAkBM,MAAM,4CAAc,CAAA,GAAA,YAAI,EAAE,aAAa,CAAmB,CAAC;AAE3D,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE;AACpB;AAWO,MAAM,4CAAwB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAyC;AAE1F,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE;AACpB;AAWO,MAAM,4CAAmB,CAAA,GAAA,YAAI,EAAE,aAAa,CAA6B;AAEzE,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/menu/src/context.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMProps, FocusStrategy, HoverEvents, KeyboardEvents, PressEvents} from '@react-types/shared';\nimport React, {HTMLAttributes, MutableRefObject, RefObject, useContext} from 'react';\nimport {RootMenuTriggerState} from '@react-stately/menu';\nimport {TreeState} from '@react-stately/tree';\n\nexport interface MenuContextValue extends Omit<HTMLAttributes<HTMLElement>, 'autoFocus' | 'onKeyDown'>, Pick<KeyboardEvents, 'onKeyDown'> {\n onClose?: () => void,\n closeOnSelect?: boolean,\n shouldFocusWrap?: boolean,\n autoFocus?: boolean | FocusStrategy,\n ref?: MutableRefObject<HTMLDivElement>,\n state?: RootMenuTriggerState,\n onBackButtonPress?: () => void,\n submenuLevel?: number\n}\n\nexport const MenuContext = React.createContext<MenuContextValue>({});\n\nexport function useMenuContext(): MenuContextValue {\n return useContext(MenuContext);\n}\n\nexport interface SubmenuTriggerContextValue extends DOMProps, Pick<PressEvents, 'onPressStart' | 'onPress'>, Pick<HoverEvents, 'onHoverChange'>, Pick<KeyboardEvents, 'onKeyDown'> {\n isUnavailable?: boolean,\n triggerRef?: MutableRefObject<HTMLElement>,\n 'aria-expanded'?: boolean | 'true' | 'false',\n 'aria-controls'?: string,\n 'aria-haspopup'?: 'dialog' | 'menu',\n isOpen?: boolean\n}\n\nexport const SubmenuTriggerContext = React.createContext<SubmenuTriggerContextValue | undefined>(undefined);\n\nexport function useSubmenuTriggerContext(): SubmenuTriggerContextValue {\n return useContext(SubmenuTriggerContext);\n}\n\nexport interface MenuStateContextValue<T> {\n state?: TreeState<T>,\n popoverContainer?: HTMLElement,\n trayContainerRef?: RefObject<HTMLElement | null>,\n menu?: RefObject<HTMLDivElement | null>,\n submenu?: RefObject<HTMLDivElement | null>,\n rootMenuTriggerState?: RootMenuTriggerState\n}\n\nexport const MenuStateContext = React.createContext<MenuStateContextValue<any>>(undefined);\n\nexport function useMenuStateContext<T>(): MenuStateContextValue<T> {\n return useContext(MenuStateContext);\n}\n"],"names":[],"version":3,"file":"context.module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React, { ReactElement, JSX } from "react";
1
+ import React, { JSX, ReactElement } from "react";
2
2
  import { SpectrumMenuTriggerProps, SpectrumMenuProps, SpectrumActionMenuProps } from "@react-types/menu";
3
3
  import { DOMRefValue, Key, DOMRef, FocusableRef } from "@react-types/shared";
4
4
  /**
@@ -10,7 +10,7 @@ interface SubmenuTriggerProps {
10
10
  /**
11
11
  * The contents of the SubmenuTrigger - an Item and a Menu.
12
12
  */
13
- children: ReactElement[];
13
+ children: ReactElement<any>[];
14
14
  targetKey: Key;
15
15
  }
16
16
  export interface SpectrumSubmenuTriggerProps extends Omit<SubmenuTriggerProps, 'targetKey'> {
@@ -1 +1 @@
1
- {"mappings":";;;AC6GA;;;GAGG;AACH,OAAA,IAAI,sHAAsC,CAAC;ACzF3C;IACE;;OAEG;IACH,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,EAAE,GAAG,CAAA;CACf;AAED,4CAA6C,SAAQ,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC;CAAG;AAwH9F,OAAA,IAAI,wBAA4C,2BAA2B,KAAK,WAAW,CAAC;AGgE5F;;GAEG;AAGH,OAAA,MAAM;UAA2E,OAAO,cAAc,CAAC;MAAM,YAAY,CAAC;ACrK1H;;GAEG;AACH,OAAA,MAAM;UAAuF,aAAa,iBAAiB,CAAC;MAAM,YAAY,CAAC;ACjC/I;IACE,sDAAsD;IACtD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,wDAAwD;IACxD,QAAQ,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;CACvC;AAMD,+CAAgD,SAAQ,sBAAsB;CAAG;AA0JjF,OAAA,IAAI,+BAAyC,8BAA8B,KAAK,WAAW,CAAC;AC5K5F,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,4BAA4B,CAAC;AACzD,YAAY,EAAC,uBAAuB,EAAE,iBAAiB,EAAE,wBAAwB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/context.ts","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/MenuTrigger.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/SubmenuTrigger.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/MenuItem.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/MenuSection.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/Menu.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/ActionMenu.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/ContextualHelpTrigger.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/index.ts","packages/@react-spectrum/menu/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {MenuTrigger} from './MenuTrigger';\nexport {SubmenuTrigger} from './SubmenuTrigger';\nexport {Menu} from './Menu';\nexport {ActionMenu} from './ActionMenu';\nexport {ContextualHelpTrigger} from './ContextualHelpTrigger';\nexport {Item, Section} from '@react-stately/collections';\nexport type {SpectrumActionMenuProps, SpectrumMenuProps, SpectrumMenuTriggerProps} from '@react-types/menu';\nexport type {SpectrumMenuDialogTriggerProps} from './ContextualHelpTrigger';\nexport type {SpectrumSubmenuTriggerProps} from './SubmenuTrigger';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;AC6GA;;;GAGG;AACH,OAAA,IAAI,sHAAsC,CAAC;ACzF3C;IACE;;OAEG;IACH,QAAQ,EAAE,aAAa,GAAG,CAAC,EAAE,CAAC;IAC9B,SAAS,EAAE,GAAG,CAAA;CACf;AAED,4CAA6C,SAAQ,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC;CAAG;AAwH9F,OAAA,IAAI,wBAA4C,2BAA2B,KAAK,WAAW,CAAC;AGgE5F;;GAEG;AAGH,OAAA,MAAM;UAA2E,OAAO,cAAc,CAAC;MAAM,YAAY,CAAC;ACrK1H;;GAEG;AACH,OAAA,MAAM;UAAuF,aAAa,iBAAiB,CAAC;MAAM,YAAY,CAAC;ACjC/I;IACE,sDAAsD;IACtD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,wDAAwD;IACxD,QAAQ,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;CACvC;AAMD,+CAAgD,SAAQ,sBAAsB;CAAG;AA0JjF,OAAA,IAAI,+BAAyC,8BAA8B,KAAK,WAAW,CAAC;AC5K5F,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,4BAA4B,CAAC;AACzD,YAAY,EAAC,uBAAuB,EAAE,iBAAiB,EAAE,wBAAwB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/context.ts","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/MenuTrigger.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/SubmenuTrigger.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/MenuItem.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/MenuSection.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/Menu.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/ActionMenu.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/ContextualHelpTrigger.tsx","packages/@react-spectrum/menu/src/packages/@react-spectrum/menu/src/index.ts","packages/@react-spectrum/menu/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {MenuTrigger} from './MenuTrigger';\nexport {SubmenuTrigger} from './SubmenuTrigger';\nexport {Menu} from './Menu';\nexport {ActionMenu} from './ActionMenu';\nexport {ContextualHelpTrigger} from './ContextualHelpTrigger';\nexport {Item, Section} from '@react-stately/collections';\nexport type {SpectrumActionMenuProps, SpectrumMenuProps, SpectrumMenuTriggerProps} from '@react-types/menu';\nexport type {SpectrumMenuDialogTriggerProps} from './ContextualHelpTrigger';\nexport type {SpectrumSubmenuTriggerProps} from './SubmenuTrigger';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/menu",
3
- "version": "3.19.2-nightly.4674+59136f78e",
3
+ "version": "3.19.2-nightly.4683+4e3af379e",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -36,39 +36,39 @@
36
36
  "url": "https://github.com/adobe/react-spectrum"
37
37
  },
38
38
  "dependencies": {
39
- "@react-aria/focus": "3.0.0-nightly.2962+59136f78e",
40
- "@react-aria/i18n": "3.0.0-nightly.2962+59136f78e",
41
- "@react-aria/interactions": "3.0.0-nightly.2962+59136f78e",
42
- "@react-aria/menu": "3.14.2-nightly.4674+59136f78e",
43
- "@react-aria/overlays": "3.0.0-nightly.2962+59136f78e",
44
- "@react-aria/separator": "3.0.0-nightly.2962+59136f78e",
45
- "@react-aria/utils": "3.0.0-nightly.2962+59136f78e",
46
- "@react-spectrum/button": "3.0.0-nightly.2962+59136f78e",
47
- "@react-spectrum/layout": "3.6.6-nightly.4674+59136f78e",
48
- "@react-spectrum/overlays": "3.0.0-nightly.2962+59136f78e",
49
- "@react-spectrum/text": "3.5.6-nightly.4674+59136f78e",
50
- "@react-spectrum/utils": "3.0.0-nightly.2962+59136f78e",
51
- "@react-stately/collections": "3.0.0-nightly.2962+59136f78e",
52
- "@react-stately/menu": "3.7.2-nightly.4674+59136f78e",
53
- "@react-stately/overlays": "3.6.8-nightly.4674+59136f78e",
54
- "@react-stately/tree": "3.0.0-nightly.2962+59136f78e",
55
- "@react-types/menu": "3.9.10-nightly.4674+59136f78e",
56
- "@react-types/overlays": "3.8.8-nightly.4674+59136f78e",
57
- "@react-types/shared": "3.0.0-nightly.2962+59136f78e",
58
- "@spectrum-icons/ui": "3.0.0-nightly.2962+59136f78e",
59
- "@spectrum-icons/workflow": "3.0.0-nightly.2962+59136f78e",
39
+ "@react-aria/focus": "3.0.0-nightly.2971+4e3af379e",
40
+ "@react-aria/i18n": "3.0.0-nightly.2971+4e3af379e",
41
+ "@react-aria/interactions": "3.0.0-nightly.2971+4e3af379e",
42
+ "@react-aria/menu": "3.14.2-nightly.4683+4e3af379e",
43
+ "@react-aria/overlays": "3.0.0-nightly.2971+4e3af379e",
44
+ "@react-aria/separator": "3.0.0-nightly.2971+4e3af379e",
45
+ "@react-aria/utils": "3.0.0-nightly.2971+4e3af379e",
46
+ "@react-spectrum/button": "3.0.0-nightly.2971+4e3af379e",
47
+ "@react-spectrum/layout": "3.6.6-nightly.4683+4e3af379e",
48
+ "@react-spectrum/overlays": "3.0.0-nightly.2971+4e3af379e",
49
+ "@react-spectrum/text": "3.5.6-nightly.4683+4e3af379e",
50
+ "@react-spectrum/utils": "3.0.0-nightly.2971+4e3af379e",
51
+ "@react-stately/collections": "3.0.0-nightly.2971+4e3af379e",
52
+ "@react-stately/menu": "3.7.2-nightly.4683+4e3af379e",
53
+ "@react-stately/overlays": "3.6.8-nightly.4683+4e3af379e",
54
+ "@react-stately/tree": "3.0.0-nightly.2971+4e3af379e",
55
+ "@react-types/menu": "3.9.10-nightly.4683+4e3af379e",
56
+ "@react-types/overlays": "3.8.8-nightly.4683+4e3af379e",
57
+ "@react-types/shared": "3.0.0-nightly.2971+4e3af379e",
58
+ "@spectrum-icons/ui": "3.0.0-nightly.2971+4e3af379e",
59
+ "@spectrum-icons/workflow": "3.0.0-nightly.2971+4e3af379e",
60
60
  "@swc/helpers": "^0.5.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@adobe/spectrum-css-temp": "3.0.0-nightly.2962+59136f78e"
63
+ "@adobe/spectrum-css-temp": "3.0.0-nightly.2971+4e3af379e"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@react-spectrum/provider": "^3.0.0",
67
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
68
- "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
67
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
68
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
69
69
  },
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "59136f78e853e97bb4067a1268750c9f85900bf6"
73
+ "gitHead": "4e3af379e569faac3b374e0ed5a98b2a19cd92c3"
74
74
  }
@@ -179,7 +179,7 @@ ContextualHelpTrigger.getCollectionNode = function* getCollectionNode<T>(props:
179
179
  let [, content] = props.children as [ReactElement, ReactElement];
180
180
 
181
181
  yield {
182
- element: React.cloneElement(trigger, {...trigger.props, hasChildItems: true, isTrigger: true}),
182
+ element: React.cloneElement(trigger, {...trigger.props as any, hasChildItems: true, isTrigger: true}),
183
183
  wrapper: (element) => (
184
184
  <ContextualHelpTrigger key={element.key} targetKey={element.key} {...props}>
185
185
  {element}
@@ -23,10 +23,10 @@ import {useMenuTrigger} from '@react-aria/menu';
23
23
  import {useMenuTriggerState} from '@react-stately/menu';
24
24
 
25
25
  function MenuTrigger(props: SpectrumMenuTriggerProps, ref: DOMRef<HTMLElement>) {
26
- let triggerRef = useRef<HTMLElement>();
26
+ let triggerRef = useRef<HTMLElement>(undefined);
27
27
  let domRef = useDOMRef(ref);
28
28
  let menuTriggerRef = domRef || triggerRef;
29
- let menuRef = useRef<HTMLDivElement>();
29
+ let menuRef = useRef<HTMLDivElement>(undefined);
30
30
  let {
31
31
  children,
32
32
  align = 'start',
@@ -15,7 +15,7 @@ import {Key} from '@react-types/shared';
15
15
  import {MenuContext, SubmenuTriggerContext, useMenuStateContext} from './context';
16
16
  import {mergeProps} from '@react-aria/utils';
17
17
  import {Popover} from '@react-spectrum/overlays';
18
- import React, {ReactElement, useRef} from 'react';
18
+ import React, {type JSX, ReactElement, useRef} from 'react';
19
19
  import ReactDOM from 'react-dom';
20
20
  import styles from '@adobe/spectrum-css-temp/components/menu/vars.css';
21
21
  import {useLocale} from '@react-aria/i18n';
@@ -26,14 +26,14 @@ interface SubmenuTriggerProps {
26
26
  /**
27
27
  * The contents of the SubmenuTrigger - an Item and a Menu.
28
28
  */
29
- children: ReactElement[],
29
+ children: ReactElement<any>[],
30
30
  targetKey: Key
31
31
  }
32
32
 
33
33
  export interface SpectrumSubmenuTriggerProps extends Omit<SubmenuTriggerProps, 'targetKey'> {}
34
34
 
35
35
  function SubmenuTrigger(props: SubmenuTriggerProps) {
36
- let triggerRef = useRef<HTMLDivElement>();
36
+ let triggerRef = useRef<HTMLDivElement>(undefined);
37
37
  let {
38
38
  children,
39
39
  targetKey
@@ -140,7 +140,7 @@ SubmenuTrigger.getCollectionNode = function* (props: SpectrumSubmenuTriggerProps
140
140
  let [, content] = props.children as [ReactElement, ReactElement];
141
141
 
142
142
  yield {
143
- element: React.cloneElement(trigger, {...trigger.props, hasChildItems: true, isTrigger: true}),
143
+ element: React.cloneElement(trigger, {...trigger.props as any, hasChildItems: true, isTrigger: true}),
144
144
  wrapper: (element) => (
145
145
  <SubmenuTrigger key={element.key} targetKey={element.key} {...props}>
146
146
  {element}
package/src/context.ts CHANGED
@@ -50,9 +50,9 @@ export function useSubmenuTriggerContext(): SubmenuTriggerContextValue {
50
50
  export interface MenuStateContextValue<T> {
51
51
  state?: TreeState<T>,
52
52
  popoverContainer?: HTMLElement,
53
- trayContainerRef?: RefObject<HTMLElement>,
54
- menu?: RefObject<HTMLDivElement>,
55
- submenu?: RefObject<HTMLDivElement>,
53
+ trayContainerRef?: RefObject<HTMLElement | null>,
54
+ menu?: RefObject<HTMLDivElement | null>,
55
+ submenu?: RefObject<HTMLDivElement | null>,
56
56
  rootMenuTriggerState?: RootMenuTriggerState
57
57
  }
58
58