@react-spectrum/menu 3.22.8 → 3.22.10

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.
Files changed (77) hide show
  1. package/dist/ContextualHelpTrigger.main.js +6 -5
  2. package/dist/ContextualHelpTrigger.main.js.map +1 -1
  3. package/dist/ContextualHelpTrigger.mjs +6 -5
  4. package/dist/ContextualHelpTrigger.module.js +6 -5
  5. package/dist/ContextualHelpTrigger.module.js.map +1 -1
  6. package/dist/Menu.main.js +1 -1
  7. package/dist/Menu.main.js.map +1 -1
  8. package/dist/Menu.mjs +2 -2
  9. package/dist/Menu.module.js +2 -2
  10. package/dist/Menu.module.js.map +1 -1
  11. package/dist/Popover.main.js +196 -0
  12. package/dist/Popover.main.js.map +1 -0
  13. package/dist/Popover.mjs +191 -0
  14. package/dist/Popover.module.js +191 -0
  15. package/dist/Popover.module.js.map +1 -0
  16. package/dist/SubmenuTrigger.main.js +3 -3
  17. package/dist/SubmenuTrigger.main.js.map +1 -1
  18. package/dist/SubmenuTrigger.mjs +4 -4
  19. package/dist/SubmenuTrigger.module.js +4 -4
  20. package/dist/SubmenuTrigger.module.js.map +1 -1
  21. package/dist/Underlay.main.js +54 -0
  22. package/dist/Underlay.main.js.map +1 -0
  23. package/dist/Underlay.mjs +49 -0
  24. package/dist/Underlay.module.js +49 -0
  25. package/dist/Underlay.module.js.map +1 -0
  26. package/dist/calculatePosition.main.js +392 -0
  27. package/dist/calculatePosition.main.js.map +1 -0
  28. package/dist/calculatePosition.mjs +386 -0
  29. package/dist/calculatePosition.module.js +386 -0
  30. package/dist/calculatePosition.module.js.map +1 -0
  31. package/dist/menu.2259a533.css +210 -0
  32. package/dist/menu.2259a533.css.map +1 -0
  33. package/dist/menu.359a0c0a.css +131 -0
  34. package/dist/menu.359a0c0a.css.map +1 -0
  35. package/dist/menu.57b3a408.css +12 -0
  36. package/dist/menu.57b3a408.css.map +1 -0
  37. package/dist/overlays_css.main.js +35 -0
  38. package/dist/overlays_css.main.js.map +1 -0
  39. package/dist/overlays_css.mjs +37 -0
  40. package/dist/overlays_css.module.js +37 -0
  41. package/dist/overlays_css.module.js.map +1 -0
  42. package/dist/popover_vars_css.main.js +83 -0
  43. package/dist/popover_vars_css.main.js.map +1 -0
  44. package/dist/popover_vars_css.mjs +85 -0
  45. package/dist/popover_vars_css.module.js +85 -0
  46. package/dist/popover_vars_css.module.js.map +1 -0
  47. package/dist/types.d.ts.map +1 -1
  48. package/dist/underlay_vars_css.main.js +50 -0
  49. package/dist/underlay_vars_css.main.js.map +1 -0
  50. package/dist/underlay_vars_css.mjs +52 -0
  51. package/dist/underlay_vars_css.module.js +52 -0
  52. package/dist/underlay_vars_css.module.js.map +1 -0
  53. package/dist/useCloseOnScroll.main.js +51 -0
  54. package/dist/useCloseOnScroll.main.js.map +1 -0
  55. package/dist/useCloseOnScroll.mjs +46 -0
  56. package/dist/useCloseOnScroll.module.js +46 -0
  57. package/dist/useCloseOnScroll.module.js.map +1 -0
  58. package/dist/useOverlayPosition.main.js +225 -0
  59. package/dist/useOverlayPosition.main.js.map +1 -0
  60. package/dist/useOverlayPosition.mjs +220 -0
  61. package/dist/useOverlayPosition.module.js +220 -0
  62. package/dist/useOverlayPosition.module.js.map +1 -0
  63. package/dist/usePopover.main.js +73 -0
  64. package/dist/usePopover.main.js.map +1 -0
  65. package/dist/usePopover.mjs +68 -0
  66. package/dist/usePopover.module.js +68 -0
  67. package/dist/usePopover.module.js.map +1 -0
  68. package/package.json +23 -23
  69. package/src/ContextualHelpTrigger.tsx +4 -3
  70. package/src/Menu.tsx +2 -1
  71. package/src/Popover.tsx +240 -0
  72. package/src/SubmenuTrigger.tsx +3 -3
  73. package/src/Underlay.tsx +43 -0
  74. package/src/calculatePosition.ts +627 -0
  75. package/src/useCloseOnScroll.ts +65 -0
  76. package/src/useOverlayPosition.ts +327 -0
  77. package/src/usePopover.ts +136 -0
@@ -1,9 +1,9 @@
1
1
  var $cac834c4bc0a51d3$exports = require("./context.main.js");
2
+ var $25179ade6a3f679b$exports = require("./Popover.main.js");
2
3
  require("./menu.2ec1fdaf.css");
3
4
  var $3deee0fd2b46e64f$exports = require("./menu_vars_css.main.js");
4
5
  var $esjnM$reactspectrumutils = require("@react-spectrum/utils");
5
6
  var $esjnM$reactariautils = require("@react-aria/utils");
6
- var $esjnM$reactspectrumoverlays = require("@react-spectrum/overlays");
7
7
  var $esjnM$react = require("react");
8
8
  var $esjnM$reactdom = require("react-dom");
9
9
  var $esjnM$reactariai18n = require("@react-aria/i18n");
@@ -55,7 +55,7 @@ function $86ed235c4695ff3f$var$SubmenuTrigger(props) {
55
55
  let isMobile = (0, $esjnM$reactspectrumutils.useIsMobileDevice)();
56
56
  let onBackButtonPress = ()=>{
57
57
  submenuTriggerState.close();
58
- if (parentMenuRef.current && !parentMenuRef.current.contains(document.activeElement)) parentMenuRef.current.focus();
58
+ if (parentMenuRef.current && !(0, $esjnM$reactariautils.nodeContains)(parentMenuRef.current, document.activeElement)) parentMenuRef.current.focus();
59
59
  };
60
60
  let { direction: direction } = (0, $esjnM$reactariai18n.useLocale)();
61
61
  let mobileSubmenuKeyDown = (e)=>{
@@ -84,7 +84,7 @@ function $86ed235c4695ff3f$var$SubmenuTrigger(props) {
84
84
  submenuTriggerState.close();
85
85
  (_parentMenuRef_current = parentMenuRef.current) === null || _parentMenuRef_current === void 0 ? void 0 : _parentMenuRef_current.focus();
86
86
  };
87
- overlay = /*#__PURE__*/ (0, ($parcel$interopDefault($esjnM$react))).createElement((0, $esjnM$reactspectrumoverlays.Popover), {
87
+ overlay = /*#__PURE__*/ (0, ($parcel$interopDefault($esjnM$react))).createElement((0, $25179ade6a3f679b$exports.Popover), {
88
88
  ...popoverProps,
89
89
  onDismissButtonPress: onDismissButtonPress,
90
90
  UNSAFE_className: (0, $esjnM$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Submenu-popover'),
@@ -1 +1 @@
1
- {"mappings":";;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AI,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>(null);\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 unknown 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,YAA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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, nodeContains} from '@react-aria/utils';\nimport {Popover} from './Popover';\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>(null);\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 && !nodeContains(parentMenuRef.current, 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 unknown as (props: SpectrumSubmenuTriggerProps) => JSX.Element;\nexport {_SubmenuTrigger as SubmenuTrigger};\n"],"names":[],"version":3,"file":"SubmenuTrigger.main.js.map"}
@@ -1,9 +1,9 @@
1
1
  import {MenuContext as $d94604d52c3e3feb$export$c7e742effb1c51e2, SubmenuTriggerContext as $d94604d52c3e3feb$export$8d97fe02339fc0e3, useMenuStateContext as $d94604d52c3e3feb$export$efa3856fc0e85e7f} from "./context.mjs";
2
+ import {Popover as $bf810f3fb07f8592$export$5b6b19405a83ff9d} from "./Popover.mjs";
2
3
  import "./menu.2ec1fdaf.css";
3
4
  import $byZ4r$menu_vars_cssmodulejs from "./menu_vars_css.mjs";
4
5
  import {useIsMobileDevice as $byZ4r$useIsMobileDevice, classNames as $byZ4r$classNames} from "@react-spectrum/utils";
5
- import {mergeProps as $byZ4r$mergeProps} from "@react-aria/utils";
6
- import {Popover as $byZ4r$Popover} from "@react-spectrum/overlays";
6
+ import {nodeContains as $byZ4r$nodeContains, mergeProps as $byZ4r$mergeProps} from "@react-aria/utils";
7
7
  import $byZ4r$react, {useRef as $byZ4r$useRef} from "react";
8
8
  import $byZ4r$reactdom from "react-dom";
9
9
  import {useLocale as $byZ4r$useLocale} from "@react-aria/i18n";
@@ -49,7 +49,7 @@ function $3f13e15cf95c3893$var$SubmenuTrigger(props) {
49
49
  let isMobile = (0, $byZ4r$useIsMobileDevice)();
50
50
  let onBackButtonPress = ()=>{
51
51
  submenuTriggerState.close();
52
- if (parentMenuRef.current && !parentMenuRef.current.contains(document.activeElement)) parentMenuRef.current.focus();
52
+ if (parentMenuRef.current && !(0, $byZ4r$nodeContains)(parentMenuRef.current, document.activeElement)) parentMenuRef.current.focus();
53
53
  };
54
54
  let { direction: direction } = (0, $byZ4r$useLocale)();
55
55
  let mobileSubmenuKeyDown = (e)=>{
@@ -78,7 +78,7 @@ function $3f13e15cf95c3893$var$SubmenuTrigger(props) {
78
78
  submenuTriggerState.close();
79
79
  (_parentMenuRef_current = parentMenuRef.current) === null || _parentMenuRef_current === void 0 ? void 0 : _parentMenuRef_current.focus();
80
80
  };
81
- overlay = /*#__PURE__*/ (0, $byZ4r$react).createElement((0, $byZ4r$Popover), {
81
+ overlay = /*#__PURE__*/ (0, $byZ4r$react).createElement((0, $bf810f3fb07f8592$export$5b6b19405a83ff9d), {
82
82
  ...popoverProps,
83
83
  onDismissButtonPress: onDismissButtonPress,
84
84
  UNSAFE_className: (0, $byZ4r$classNames)((0, ($parcel$interopDefault($byZ4r$menu_vars_cssmodulejs))), 'spectrum-Submenu-popover'),
@@ -1,9 +1,9 @@
1
1
  import {MenuContext as $d94604d52c3e3feb$export$c7e742effb1c51e2, SubmenuTriggerContext as $d94604d52c3e3feb$export$8d97fe02339fc0e3, useMenuStateContext as $d94604d52c3e3feb$export$efa3856fc0e85e7f} from "./context.module.js";
2
+ import {Popover as $bf810f3fb07f8592$export$5b6b19405a83ff9d} from "./Popover.module.js";
2
3
  import "./menu.2ec1fdaf.css";
3
4
  import $byZ4r$menu_vars_cssmodulejs from "./menu_vars_css.module.js";
4
5
  import {useIsMobileDevice as $byZ4r$useIsMobileDevice, classNames as $byZ4r$classNames} from "@react-spectrum/utils";
5
- import {mergeProps as $byZ4r$mergeProps} from "@react-aria/utils";
6
- import {Popover as $byZ4r$Popover} from "@react-spectrum/overlays";
6
+ import {nodeContains as $byZ4r$nodeContains, mergeProps as $byZ4r$mergeProps} from "@react-aria/utils";
7
7
  import $byZ4r$react, {useRef as $byZ4r$useRef} from "react";
8
8
  import $byZ4r$reactdom from "react-dom";
9
9
  import {useLocale as $byZ4r$useLocale} from "@react-aria/i18n";
@@ -49,7 +49,7 @@ function $3f13e15cf95c3893$var$SubmenuTrigger(props) {
49
49
  let isMobile = (0, $byZ4r$useIsMobileDevice)();
50
50
  let onBackButtonPress = ()=>{
51
51
  submenuTriggerState.close();
52
- if (parentMenuRef.current && !parentMenuRef.current.contains(document.activeElement)) parentMenuRef.current.focus();
52
+ if (parentMenuRef.current && !(0, $byZ4r$nodeContains)(parentMenuRef.current, document.activeElement)) parentMenuRef.current.focus();
53
53
  };
54
54
  let { direction: direction } = (0, $byZ4r$useLocale)();
55
55
  let mobileSubmenuKeyDown = (e)=>{
@@ -78,7 +78,7 @@ function $3f13e15cf95c3893$var$SubmenuTrigger(props) {
78
78
  submenuTriggerState.close();
79
79
  (_parentMenuRef_current = parentMenuRef.current) === null || _parentMenuRef_current === void 0 ? void 0 : _parentMenuRef_current.focus();
80
80
  };
81
- overlay = /*#__PURE__*/ (0, $byZ4r$react).createElement((0, $byZ4r$Popover), {
81
+ overlay = /*#__PURE__*/ (0, $byZ4r$react).createElement((0, $bf810f3fb07f8592$export$5b6b19405a83ff9d), {
82
82
  ...popoverProps,
83
83
  onDismissButtonPress: onDismissButtonPress,
84
84
  UNSAFE_className: (0, $byZ4r$classNames)((0, ($parcel$interopDefault($byZ4r$menu_vars_cssmodulejs))), 'spectrum-Submenu-popover'),
@@ -1 +1 @@
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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\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>(null);\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 unknown 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,CAAA,GAAA,mBAAW,EAAE,cAAc,OAAO,EAAE,SAAS,aAAa,GACtF,cAAc,OAAO,CAAC,KAAK;IAE/B;IAEA,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,uB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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;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, nodeContains} from '@react-aria/utils';\nimport {Popover} from './Popover';\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>(null);\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 && !nodeContains(parentMenuRef.current, 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 unknown as (props: SpectrumSubmenuTriggerProps) => JSX.Element;\nexport {_SubmenuTrigger as SubmenuTrigger};\n"],"names":[],"version":3,"file":"SubmenuTrigger.module.js.map"}
@@ -0,0 +1,54 @@
1
+ require("./menu.359a0c0a.css");
2
+ var $42908e91b4c5f428$exports = require("./underlay_vars_css.main.js");
3
+ var $h7ylx$reactspectrumutils = require("@react-spectrum/utils");
4
+ var $h7ylx$reactariautils = require("@react-aria/utils");
5
+ var $h7ylx$react = require("react");
6
+
7
+
8
+ function $parcel$interopDefault(a) {
9
+ return a && a.__esModule ? a.default : a;
10
+ }
11
+
12
+ function $parcel$export(e, n, v, s) {
13
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
14
+ }
15
+
16
+ $parcel$export(module.exports, "Underlay", () => $986adbd937b58c55$export$f360afc887607b02);
17
+ /*
18
+ * Copyright 2020 Adobe. All rights reserved.
19
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
20
+ * you may not use this file except in compliance with the License. You may obtain a copy
21
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software distributed under
24
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
25
+ * OF ANY KIND, either express or implied. See the License for the specific language
26
+ * governing permissions and limitations under the License.
27
+ */
28
+
29
+
30
+
31
+ function $986adbd937b58c55$export$f360afc887607b02({ isOpen: isOpen, isTransparent: isTransparent, ...otherProps }) {
32
+ let pageHeight = undefined;
33
+ if (typeof document !== 'undefined') {
34
+ let scrollingElement = (0, $h7ylx$reactariautils.isScrollable)(document.body) ? document.body : document.scrollingElement || document.documentElement;
35
+ // Prevent Firefox from adding scrollbars when the page has a fractional height.
36
+ let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;
37
+ pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;
38
+ }
39
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($h7ylx$react))).createElement("div", {
40
+ "data-testid": "underlay",
41
+ ...otherProps,
42
+ // Cover the entire document so iOS 26 Safari doesn't clip the underlay to the inner viewport.
43
+ style: {
44
+ height: pageHeight
45
+ },
46
+ className: (0, $h7ylx$reactspectrumutils.classNames)((0, ($parcel$interopDefault($42908e91b4c5f428$exports))), 'spectrum-Underlay', {
47
+ 'is-open': isOpen,
48
+ 'spectrum-Underlay--transparent': isTransparent
49
+ })
50
+ });
51
+ }
52
+
53
+
54
+ //# sourceMappingURL=Underlay.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,SAAS,0CAAS,UAAC,MAAM,iBAAE,aAAa,EAAE,GAAG,YAA0B;IAC5E,IAAI,aAAiC;IACrC,IAAI,OAAO,aAAa,aAAa;QACnC,IAAI,mBAAmB,CAAA,GAAA,kCAAW,EAAE,SAAS,IAAI,IAAI,SAAS,IAAI,GAAG,SAAS,gBAAgB,IAAI,SAAS,eAAe;QAC1H,gFAAgF;QAChF,IAAI,6BAA6B,iBAAiB,qBAAqB,GAAG,MAAM,GAAG;QACnF,aAAa,iBAAiB,YAAY,GAAG;IAC/C;IAEA,qBACE,0DAAC;QACC,eAAY;QACX,GAAG,UAAU;QACd,8FAA8F;QAC9F,OAAO;YAAC,QAAQ;QAAU;QAC1B,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAa,GAAG,qBAAqB;YACzD,WAAW;YACX,kCAAkC;QACpC;;AAEN","sources":["packages/@react-spectrum/menu/src/Underlay.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} from '@react-spectrum/utils';\nimport {isScrollable} from '@react-aria/utils';\nimport React, {JSX} from 'react';\nimport underlayStyles from '@adobe/spectrum-css-temp/components/underlay/vars.css';\n\ninterface UnderlayProps {\n isOpen?: boolean,\n isTransparent?: boolean\n}\n\nexport function Underlay({isOpen, isTransparent, ...otherProps}: UnderlayProps): JSX.Element {\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body) ? document.body : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional height.\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n return (\n <div\n data-testid=\"underlay\"\n {...otherProps}\n // Cover the entire document so iOS 26 Safari doesn't clip the underlay to the inner viewport.\n style={{height: pageHeight}}\n className={classNames(underlayStyles, 'spectrum-Underlay', {\n 'is-open': isOpen,\n 'spectrum-Underlay--transparent': isTransparent\n })} />\n );\n}\n"],"names":[],"version":3,"file":"Underlay.main.js.map"}
@@ -0,0 +1,49 @@
1
+ import "./menu.359a0c0a.css";
2
+ import $kr6R3$underlay_vars_cssmodulejs from "./underlay_vars_css.mjs";
3
+ import {classNames as $kr6R3$classNames} from "@react-spectrum/utils";
4
+ import {isScrollable as $kr6R3$isScrollable} from "@react-aria/utils";
5
+ import $kr6R3$react from "react";
6
+
7
+
8
+ function $parcel$interopDefault(a) {
9
+ return a && a.__esModule ? a.default : a;
10
+ }
11
+ /*
12
+ * Copyright 2020 Adobe. All rights reserved.
13
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License. You may obtain a copy
15
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software distributed under
18
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
+ * OF ANY KIND, either express or implied. See the License for the specific language
20
+ * governing permissions and limitations under the License.
21
+ */
22
+
23
+
24
+
25
+ function $274a838403463b67$export$f360afc887607b02({ isOpen: isOpen, isTransparent: isTransparent, ...otherProps }) {
26
+ let pageHeight = undefined;
27
+ if (typeof document !== 'undefined') {
28
+ let scrollingElement = (0, $kr6R3$isScrollable)(document.body) ? document.body : document.scrollingElement || document.documentElement;
29
+ // Prevent Firefox from adding scrollbars when the page has a fractional height.
30
+ let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;
31
+ pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;
32
+ }
33
+ return /*#__PURE__*/ (0, $kr6R3$react).createElement("div", {
34
+ "data-testid": "underlay",
35
+ ...otherProps,
36
+ // Cover the entire document so iOS 26 Safari doesn't clip the underlay to the inner viewport.
37
+ style: {
38
+ height: pageHeight
39
+ },
40
+ className: (0, $kr6R3$classNames)((0, ($parcel$interopDefault($kr6R3$underlay_vars_cssmodulejs))), 'spectrum-Underlay', {
41
+ 'is-open': isOpen,
42
+ 'spectrum-Underlay--transparent': isTransparent
43
+ })
44
+ });
45
+ }
46
+
47
+
48
+ export {$274a838403463b67$export$f360afc887607b02 as Underlay};
49
+ //# sourceMappingURL=Underlay.module.js.map
@@ -0,0 +1,49 @@
1
+ import "./menu.359a0c0a.css";
2
+ import $kr6R3$underlay_vars_cssmodulejs from "./underlay_vars_css.module.js";
3
+ import {classNames as $kr6R3$classNames} from "@react-spectrum/utils";
4
+ import {isScrollable as $kr6R3$isScrollable} from "@react-aria/utils";
5
+ import $kr6R3$react from "react";
6
+
7
+
8
+ function $parcel$interopDefault(a) {
9
+ return a && a.__esModule ? a.default : a;
10
+ }
11
+ /*
12
+ * Copyright 2020 Adobe. All rights reserved.
13
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License. You may obtain a copy
15
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software distributed under
18
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
+ * OF ANY KIND, either express or implied. See the License for the specific language
20
+ * governing permissions and limitations under the License.
21
+ */
22
+
23
+
24
+
25
+ function $274a838403463b67$export$f360afc887607b02({ isOpen: isOpen, isTransparent: isTransparent, ...otherProps }) {
26
+ let pageHeight = undefined;
27
+ if (typeof document !== 'undefined') {
28
+ let scrollingElement = (0, $kr6R3$isScrollable)(document.body) ? document.body : document.scrollingElement || document.documentElement;
29
+ // Prevent Firefox from adding scrollbars when the page has a fractional height.
30
+ let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;
31
+ pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;
32
+ }
33
+ return /*#__PURE__*/ (0, $kr6R3$react).createElement("div", {
34
+ "data-testid": "underlay",
35
+ ...otherProps,
36
+ // Cover the entire document so iOS 26 Safari doesn't clip the underlay to the inner viewport.
37
+ style: {
38
+ height: pageHeight
39
+ },
40
+ className: (0, $kr6R3$classNames)((0, ($parcel$interopDefault($kr6R3$underlay_vars_cssmodulejs))), 'spectrum-Underlay', {
41
+ 'is-open': isOpen,
42
+ 'spectrum-Underlay--transparent': isTransparent
43
+ })
44
+ });
45
+ }
46
+
47
+
48
+ export {$274a838403463b67$export$f360afc887607b02 as Underlay};
49
+ //# sourceMappingURL=Underlay.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,SAAS,0CAAS,UAAC,MAAM,iBAAE,aAAa,EAAE,GAAG,YAA0B;IAC5E,IAAI,aAAiC;IACrC,IAAI,OAAO,aAAa,aAAa;QACnC,IAAI,mBAAmB,CAAA,GAAA,mBAAW,EAAE,SAAS,IAAI,IAAI,SAAS,IAAI,GAAG,SAAS,gBAAgB,IAAI,SAAS,eAAe;QAC1H,gFAAgF;QAChF,IAAI,6BAA6B,iBAAiB,qBAAqB,GAAG,MAAM,GAAG;QACnF,aAAa,iBAAiB,YAAY,GAAG;IAC/C;IAEA,qBACE,gCAAC;QACC,eAAY;QACX,GAAG,UAAU;QACd,8FAA8F;QAC9F,OAAO;YAAC,QAAQ;QAAU;QAC1B,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAa,GAAG,qBAAqB;YACzD,WAAW;YACX,kCAAkC;QACpC;;AAEN","sources":["packages/@react-spectrum/menu/src/Underlay.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} from '@react-spectrum/utils';\nimport {isScrollable} from '@react-aria/utils';\nimport React, {JSX} from 'react';\nimport underlayStyles from '@adobe/spectrum-css-temp/components/underlay/vars.css';\n\ninterface UnderlayProps {\n isOpen?: boolean,\n isTransparent?: boolean\n}\n\nexport function Underlay({isOpen, isTransparent, ...otherProps}: UnderlayProps): JSX.Element {\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body) ? document.body : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional height.\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n return (\n <div\n data-testid=\"underlay\"\n {...otherProps}\n // Cover the entire document so iOS 26 Safari doesn't clip the underlay to the inner viewport.\n style={{height: pageHeight}}\n className={classNames(underlayStyles, 'spectrum-Underlay', {\n 'is-open': isOpen,\n 'spectrum-Underlay--transparent': isTransparent\n })} />\n );\n}\n"],"names":[],"version":3,"file":"Underlay.module.js.map"}