@react-aria/overlays 3.27.0 → 3.27.1
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.
- package/dist/DismissButton.main.js.map +1 -1
- package/dist/DismissButton.module.js.map +1 -1
- package/dist/Overlay.main.js.map +1 -1
- package/dist/Overlay.module.js.map +1 -1
- package/dist/PortalProvider.main.js.map +1 -1
- package/dist/PortalProvider.module.js.map +1 -1
- package/dist/types.d.ts +7 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/useModal.main.js.map +1 -1
- package/dist/useModal.module.js.map +1 -1
- package/package.json +11 -11
- package/src/DismissButton.tsx +2 -2
- package/src/Overlay.tsx +1 -1
- package/src/PortalProvider.tsx +3 -3
- package/src/useModal.tsx +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAoBM,SAAS,0CAAc,KAAyB;IACrD,IAAI,aAAC,SAAS,EAAE,GAAG,YAAW,GAAG;IACjC,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAEhE,IAAI,SAAS,CAAA,GAAA,+BAAQ,EAAE,YAAY,gBAAgB,MAAM,CAAC;IAE1D,IAAI,UAAU;QACZ,IAAI,WACF;IAEJ;IAEA,qBACE,0DAAC,CAAA,GAAA,6CAAa,uBACZ,0DAAC;QACE,GAAG,MAAM;QACV,UAAU;QACV,SAAS;QACT,OAAO;YAAC,OAAO;YAAG,QAAQ;QAAC;;AAGnC","sources":["packages/@react-aria/overlays/src/DismissButton.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 {AriaLabelingProps, DOMProps} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport React, {
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAoBM,SAAS,0CAAc,KAAyB;IACrD,IAAI,aAAC,SAAS,EAAE,GAAG,YAAW,GAAG;IACjC,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAEhE,IAAI,SAAS,CAAA,GAAA,+BAAQ,EAAE,YAAY,gBAAgB,MAAM,CAAC;IAE1D,IAAI,UAAU;QACZ,IAAI,WACF;IAEJ;IAEA,qBACE,0DAAC,CAAA,GAAA,6CAAa,uBACZ,0DAAC;QACE,GAAG,MAAM;QACV,UAAU;QACV,SAAS;QACT,OAAO;YAAC,OAAO;YAAG,QAAQ;QAAC;;AAGnC","sources":["packages/@react-aria/overlays/src/DismissButton.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 {AriaLabelingProps, DOMProps} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport React, {JSX} from 'react';\nimport {useLabels} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {VisuallyHidden} from '@react-aria/visually-hidden';\n\nexport interface DismissButtonProps extends AriaLabelingProps, DOMProps {\n /** Called when the dismiss button is activated. */\n onDismiss?: () => void\n}\n\n/**\n * A visually hidden button that can be used to allow screen reader\n * users to dismiss a modal or popup when there is no visual\n * affordance to do so.\n */\nexport function DismissButton(props: DismissButtonProps): JSX.Element {\n let {onDismiss, ...otherProps} = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/overlays');\n\n let labels = useLabels(otherProps, stringFormatter.format('dismiss'));\n\n let onClick = () => {\n if (onDismiss) {\n onDismiss();\n }\n };\n\n return (\n <VisuallyHidden>\n <button\n {...labels}\n tabIndex={-1}\n onClick={onClick}\n style={{width: 1, height: 1}} />\n </VisuallyHidden>\n );\n}\n"],"names":[],"version":3,"file":"DismissButton.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAoBM,SAAS,0CAAc,KAAyB;IACrD,IAAI,aAAC,SAAS,EAAE,GAAG,YAAW,GAAG;IACjC,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAEhE,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE,YAAY,gBAAgB,MAAM,CAAC;IAE1D,IAAI,UAAU;QACZ,IAAI,WACF;IAEJ;IAEA,qBACE,gCAAC,CAAA,GAAA,qBAAa,uBACZ,gCAAC;QACE,GAAG,MAAM;QACV,UAAU;QACV,SAAS;QACT,OAAO;YAAC,OAAO;YAAG,QAAQ;QAAC;;AAGnC","sources":["packages/@react-aria/overlays/src/DismissButton.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 {AriaLabelingProps, DOMProps} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport React, {
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAoBM,SAAS,0CAAc,KAAyB;IACrD,IAAI,aAAC,SAAS,EAAE,GAAG,YAAW,GAAG;IACjC,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAEhE,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE,YAAY,gBAAgB,MAAM,CAAC;IAE1D,IAAI,UAAU;QACZ,IAAI,WACF;IAEJ;IAEA,qBACE,gCAAC,CAAA,GAAA,qBAAa,uBACZ,gCAAC;QACE,GAAG,MAAM;QACV,UAAU;QACV,SAAS;QACT,OAAO;YAAC,OAAO;YAAG,QAAQ;QAAC;;AAGnC","sources":["packages/@react-aria/overlays/src/DismissButton.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 {AriaLabelingProps, DOMProps} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport React, {JSX} from 'react';\nimport {useLabels} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {VisuallyHidden} from '@react-aria/visually-hidden';\n\nexport interface DismissButtonProps extends AriaLabelingProps, DOMProps {\n /** Called when the dismiss button is activated. */\n onDismiss?: () => void\n}\n\n/**\n * A visually hidden button that can be used to allow screen reader\n * users to dismiss a modal or popup when there is no visual\n * affordance to do so.\n */\nexport function DismissButton(props: DismissButtonProps): JSX.Element {\n let {onDismiss, ...otherProps} = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/overlays');\n\n let labels = useLabels(otherProps, stringFormatter.format('dismiss'));\n\n let onClick = () => {\n if (onDismiss) {\n onDismiss();\n }\n };\n\n return (\n <VisuallyHidden>\n <button\n {...labels}\n tabIndex={-1}\n onClick={onClick}\n style={{width: 1, height: 1}} />\n </VisuallyHidden>\n );\n}\n"],"names":[],"version":3,"file":"DismissButton.module.js.map"}
|
package/dist/Overlay.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAmCM,MAAM,0DAAiB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAuF;AAMjI,SAAS,0CAAQ,KAAmB;IACzC,IAAI,QAAQ,CAAA,GAAA,4BAAO;IACnB,IAAI,mBAAC,kBAAkB,QAAQ,OAAO,SAAS,IAAI,aAAE,SAAS,EAAC,GAAG;IAClE,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE;IACrC,IAAI,eAAe,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;qBAAC;wBAAS;QAAU,CAAA,GAAI;QAAC;QAAS;KAAW;IAE/E,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,iDAAsB;IAC3C,IAAI,CAAC,MAAM,eAAe,IAAI,cAC5B,kBAAkB;IAGpB,IAAI,CAAC,iBACH,OAAO;IAGT,IAAI,WAAW,MAAM,QAAQ;IAC7B,IAAI,CAAC,MAAM,sBAAsB,EAC/B,yBACE,0DAAC,CAAA,GAAA,gCAAS;QAAE,cAAA;QAAa,SAAS,AAAC,CAAA,MAAM,kBAAkB,IAAI,OAAM,KAAM,CAAC;OACzE;IAKP,yBACE,0DAAC,0CAAe,QAAQ;QAAC,OAAO;qBAC9B,0DAAC,CAAA,GAAA,gDAAkB,SAChB;IAKP,qBAAO,CAAA,GAAA,yCAAO,EAAE,YAAY,CAAC,UAAU;AACzC;AAGO,SAAS;IACd,IAAI,MAAM,CAAA,GAAA,uBAAS,EAAE;IACrB,IAAI,aAAa,gBAAA,0BAAA,IAAK,UAAU;IAChC,CAAA,GAAA,qCAAc,EAAE;QACd,uBAAA,iCAAA,WAAa;IACf,GAAG;QAAC;KAAW;AACjB","sources":["packages/@react-aria/overlays/src/Overlay.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {ClearPressResponder} from '@react-aria/interactions';\nimport {FocusScope} from '@react-aria/focus';\nimport React, {ReactNode, useContext, useMemo, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport {useIsSSR} from '@react-aria/ssr';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useUNSAFE_PortalContext} from './PortalProvider';\n\nexport interface OverlayProps {\n /**\n * The container element in which the overlay portal will be placed.\n * @default document.body\n */\n portalContainer?: Element,\n /** The overlay to render in the portal. */\n children: ReactNode,\n /**\n * Disables default focus management for the overlay, including containment and restoration.\n * This option should be used very carefully. When focus management is disabled, you must\n * implement focus containment and restoration to ensure the overlay is keyboard accessible.\n */\n disableFocusManagement?: boolean,\n /**\n * Whether to contain focus within the overlay.\n */\n shouldContainFocus?: boolean,\n /**\n * Whether the overlay is currently performing an exit animation. When true,\n * focus is allowed to move outside.\n */\n isExiting?: boolean\n}\n\nexport const OverlayContext = React.createContext<{contain: boolean, setContain: React.Dispatch<React.SetStateAction<boolean>>} | null>(null);\n\n/**\n * A container which renders an overlay such as a popover or modal in a portal,\n * and provides a focus scope for the child elements.\n */\nexport function Overlay(props: OverlayProps):
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAmCM,MAAM,0DAAiB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAuF;AAMjI,SAAS,0CAAQ,KAAmB;IACzC,IAAI,QAAQ,CAAA,GAAA,4BAAO;IACnB,IAAI,mBAAC,kBAAkB,QAAQ,OAAO,SAAS,IAAI,aAAE,SAAS,EAAC,GAAG;IAClE,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE;IACrC,IAAI,eAAe,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;qBAAC;wBAAS;QAAU,CAAA,GAAI;QAAC;QAAS;KAAW;IAE/E,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,iDAAsB;IAC3C,IAAI,CAAC,MAAM,eAAe,IAAI,cAC5B,kBAAkB;IAGpB,IAAI,CAAC,iBACH,OAAO;IAGT,IAAI,WAAW,MAAM,QAAQ;IAC7B,IAAI,CAAC,MAAM,sBAAsB,EAC/B,yBACE,0DAAC,CAAA,GAAA,gCAAS;QAAE,cAAA;QAAa,SAAS,AAAC,CAAA,MAAM,kBAAkB,IAAI,OAAM,KAAM,CAAC;OACzE;IAKP,yBACE,0DAAC,0CAAe,QAAQ;QAAC,OAAO;qBAC9B,0DAAC,CAAA,GAAA,gDAAkB,SAChB;IAKP,qBAAO,CAAA,GAAA,yCAAO,EAAE,YAAY,CAAC,UAAU;AACzC;AAGO,SAAS;IACd,IAAI,MAAM,CAAA,GAAA,uBAAS,EAAE;IACrB,IAAI,aAAa,gBAAA,0BAAA,IAAK,UAAU;IAChC,CAAA,GAAA,qCAAc,EAAE;QACd,uBAAA,iCAAA,WAAa;IACf,GAAG;QAAC;KAAW;AACjB","sources":["packages/@react-aria/overlays/src/Overlay.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {ClearPressResponder} from '@react-aria/interactions';\nimport {FocusScope} from '@react-aria/focus';\nimport React, {ReactNode, useContext, useMemo, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport {useIsSSR} from '@react-aria/ssr';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useUNSAFE_PortalContext} from './PortalProvider';\n\nexport interface OverlayProps {\n /**\n * The container element in which the overlay portal will be placed.\n * @default document.body\n */\n portalContainer?: Element,\n /** The overlay to render in the portal. */\n children: ReactNode,\n /**\n * Disables default focus management for the overlay, including containment and restoration.\n * This option should be used very carefully. When focus management is disabled, you must\n * implement focus containment and restoration to ensure the overlay is keyboard accessible.\n */\n disableFocusManagement?: boolean,\n /**\n * Whether to contain focus within the overlay.\n */\n shouldContainFocus?: boolean,\n /**\n * Whether the overlay is currently performing an exit animation. When true,\n * focus is allowed to move outside.\n */\n isExiting?: boolean\n}\n\nexport const OverlayContext = React.createContext<{contain: boolean, setContain: React.Dispatch<React.SetStateAction<boolean>>} | null>(null);\n\n/**\n * A container which renders an overlay such as a popover or modal in a portal,\n * and provides a focus scope for the child elements.\n */\nexport function Overlay(props: OverlayProps): React.ReactPortal | null {\n let isSSR = useIsSSR();\n let {portalContainer = isSSR ? null : document.body, isExiting} = props;\n let [contain, setContain] = useState(false);\n let contextValue = useMemo(() => ({contain, setContain}), [contain, setContain]);\n\n let {getContainer} = useUNSAFE_PortalContext();\n if (!props.portalContainer && getContainer) {\n portalContainer = getContainer();\n }\n\n if (!portalContainer) {\n return null;\n }\n\n let contents = props.children;\n if (!props.disableFocusManagement) {\n contents = (\n <FocusScope restoreFocus contain={(props.shouldContainFocus || contain) && !isExiting}>\n {contents}\n </FocusScope>\n );\n }\n\n contents = (\n <OverlayContext.Provider value={contextValue}>\n <ClearPressResponder>\n {contents}\n </ClearPressResponder>\n </OverlayContext.Provider>\n );\n\n return ReactDOM.createPortal(contents, portalContainer);\n}\n\n/** @private */\nexport function useOverlayFocusContain(): void {\n let ctx = useContext(OverlayContext);\n let setContain = ctx?.setContain;\n useLayoutEffect(() => {\n setContain?.(true);\n }, [setContain]);\n}\n"],"names":[],"version":3,"file":"Overlay.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAmCM,MAAM,0DAAiB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAuF;AAMjI,SAAS,0CAAQ,KAAmB;IACzC,IAAI,QAAQ,CAAA,GAAA,eAAO;IACnB,IAAI,mBAAC,kBAAkB,QAAQ,OAAO,SAAS,IAAI,aAAE,SAAS,EAAC,GAAG;IAClE,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IACrC,IAAI,eAAe,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;qBAAC;wBAAS;QAAU,CAAA,GAAI;QAAC;QAAS;KAAW;IAE/E,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,yCAAsB;IAC3C,IAAI,CAAC,MAAM,eAAe,IAAI,cAC5B,kBAAkB;IAGpB,IAAI,CAAC,iBACH,OAAO;IAGT,IAAI,WAAW,MAAM,QAAQ;IAC7B,IAAI,CAAC,MAAM,sBAAsB,EAC/B,yBACE,gCAAC,CAAA,GAAA,iBAAS;QAAE,cAAA;QAAa,SAAS,AAAC,CAAA,MAAM,kBAAkB,IAAI,OAAM,KAAM,CAAC;OACzE;IAKP,yBACE,gCAAC,0CAAe,QAAQ;QAAC,OAAO;qBAC9B,gCAAC,CAAA,GAAA,0BAAkB,SAChB;IAKP,qBAAO,CAAA,GAAA,eAAO,EAAE,YAAY,CAAC,UAAU;AACzC;AAGO,SAAS;IACd,IAAI,MAAM,CAAA,GAAA,iBAAS,EAAE;IACrB,IAAI,aAAa,gBAAA,0BAAA,IAAK,UAAU;IAChC,CAAA,GAAA,sBAAc,EAAE;QACd,uBAAA,iCAAA,WAAa;IACf,GAAG;QAAC;KAAW;AACjB","sources":["packages/@react-aria/overlays/src/Overlay.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {ClearPressResponder} from '@react-aria/interactions';\nimport {FocusScope} from '@react-aria/focus';\nimport React, {ReactNode, useContext, useMemo, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport {useIsSSR} from '@react-aria/ssr';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useUNSAFE_PortalContext} from './PortalProvider';\n\nexport interface OverlayProps {\n /**\n * The container element in which the overlay portal will be placed.\n * @default document.body\n */\n portalContainer?: Element,\n /** The overlay to render in the portal. */\n children: ReactNode,\n /**\n * Disables default focus management for the overlay, including containment and restoration.\n * This option should be used very carefully. When focus management is disabled, you must\n * implement focus containment and restoration to ensure the overlay is keyboard accessible.\n */\n disableFocusManagement?: boolean,\n /**\n * Whether to contain focus within the overlay.\n */\n shouldContainFocus?: boolean,\n /**\n * Whether the overlay is currently performing an exit animation. When true,\n * focus is allowed to move outside.\n */\n isExiting?: boolean\n}\n\nexport const OverlayContext = React.createContext<{contain: boolean, setContain: React.Dispatch<React.SetStateAction<boolean>>} | null>(null);\n\n/**\n * A container which renders an overlay such as a popover or modal in a portal,\n * and provides a focus scope for the child elements.\n */\nexport function Overlay(props: OverlayProps):
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAmCM,MAAM,0DAAiB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAuF;AAMjI,SAAS,0CAAQ,KAAmB;IACzC,IAAI,QAAQ,CAAA,GAAA,eAAO;IACnB,IAAI,mBAAC,kBAAkB,QAAQ,OAAO,SAAS,IAAI,aAAE,SAAS,EAAC,GAAG;IAClE,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IACrC,IAAI,eAAe,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;qBAAC;wBAAS;QAAU,CAAA,GAAI;QAAC;QAAS;KAAW;IAE/E,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,yCAAsB;IAC3C,IAAI,CAAC,MAAM,eAAe,IAAI,cAC5B,kBAAkB;IAGpB,IAAI,CAAC,iBACH,OAAO;IAGT,IAAI,WAAW,MAAM,QAAQ;IAC7B,IAAI,CAAC,MAAM,sBAAsB,EAC/B,yBACE,gCAAC,CAAA,GAAA,iBAAS;QAAE,cAAA;QAAa,SAAS,AAAC,CAAA,MAAM,kBAAkB,IAAI,OAAM,KAAM,CAAC;OACzE;IAKP,yBACE,gCAAC,0CAAe,QAAQ;QAAC,OAAO;qBAC9B,gCAAC,CAAA,GAAA,0BAAkB,SAChB;IAKP,qBAAO,CAAA,GAAA,eAAO,EAAE,YAAY,CAAC,UAAU;AACzC;AAGO,SAAS;IACd,IAAI,MAAM,CAAA,GAAA,iBAAS,EAAE;IACrB,IAAI,aAAa,gBAAA,0BAAA,IAAK,UAAU;IAChC,CAAA,GAAA,sBAAc,EAAE;QACd,uBAAA,iCAAA,WAAa;IACf,GAAG;QAAC;KAAW;AACjB","sources":["packages/@react-aria/overlays/src/Overlay.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {ClearPressResponder} from '@react-aria/interactions';\nimport {FocusScope} from '@react-aria/focus';\nimport React, {ReactNode, useContext, useMemo, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport {useIsSSR} from '@react-aria/ssr';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useUNSAFE_PortalContext} from './PortalProvider';\n\nexport interface OverlayProps {\n /**\n * The container element in which the overlay portal will be placed.\n * @default document.body\n */\n portalContainer?: Element,\n /** The overlay to render in the portal. */\n children: ReactNode,\n /**\n * Disables default focus management for the overlay, including containment and restoration.\n * This option should be used very carefully. When focus management is disabled, you must\n * implement focus containment and restoration to ensure the overlay is keyboard accessible.\n */\n disableFocusManagement?: boolean,\n /**\n * Whether to contain focus within the overlay.\n */\n shouldContainFocus?: boolean,\n /**\n * Whether the overlay is currently performing an exit animation. When true,\n * focus is allowed to move outside.\n */\n isExiting?: boolean\n}\n\nexport const OverlayContext = React.createContext<{contain: boolean, setContain: React.Dispatch<React.SetStateAction<boolean>>} | null>(null);\n\n/**\n * A container which renders an overlay such as a popover or modal in a portal,\n * and provides a focus scope for the child elements.\n */\nexport function Overlay(props: OverlayProps): React.ReactPortal | null {\n let isSSR = useIsSSR();\n let {portalContainer = isSSR ? null : document.body, isExiting} = props;\n let [contain, setContain] = useState(false);\n let contextValue = useMemo(() => ({contain, setContain}), [contain, setContain]);\n\n let {getContainer} = useUNSAFE_PortalContext();\n if (!props.portalContainer && getContainer) {\n portalContainer = getContainer();\n }\n\n if (!portalContainer) {\n return null;\n }\n\n let contents = props.children;\n if (!props.disableFocusManagement) {\n contents = (\n <FocusScope restoreFocus contain={(props.shouldContainFocus || contain) && !isExiting}>\n {contents}\n </FocusScope>\n );\n }\n\n contents = (\n <OverlayContext.Provider value={contextValue}>\n <ClearPressResponder>\n {contents}\n </ClearPressResponder>\n </OverlayContext.Provider>\n );\n\n return ReactDOM.createPortal(contents, portalContainer);\n}\n\n/** @private */\nexport function useOverlayFocusContain(): void {\n let ctx = useContext(OverlayContext);\n let setContain = ctx?.setContain;\n useLayoutEffect(() => {\n setContain?.(true);\n }, [setContain]);\n}\n"],"names":[],"version":3,"file":"Overlay.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAaM,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAA8B,CAAC;AAKjE,SAAS,0CAAsB,KAA0B;IAC9D,IAAI,gBAAC,YAAY,EAAC,GAAG;IACrB,IAAI,EAAC,cAAc,eAAe,EAAC,GAAG;IACtC,qBACE,0DAAC,0CAAc,QAAQ;QAAC,OAAO;YAAC,cAAc,iBAAiB,OAAO,YAAY,yBAAA,0BAAA,eAAgB;QAAe;OAC9G,MAAM,QAAQ;AAGrB;AAEO,SAAS;QACP;IAAP,OAAO,CAAA,cAAA,CAAA,GAAA,uBAAS,EAAE,wDAAX,yBAAA,cAA6B,CAAC;AACvC","sources":["packages/@react-aria/overlays/src/PortalProvider.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 React, {createContext, ReactNode, useContext} from 'react';\n\nexport interface PortalProviderProps {\n /** Should return the element where we should portal to. Can clear the context by passing null. */\n getContainer?: () => HTMLElement | null,\n /** The content of the PortalProvider. Should contain all children that want to portal their overlays to the element returned by the provided `getContainer()`. */\n children: ReactNode\n}\n\nexport interface PortalProviderContextValue extends Omit<PortalProviderProps, 'children'>{};\n\nexport const PortalContext = createContext<PortalProviderContextValue>({});\n\n/**\n * Sets the portal container for all overlay elements rendered by its children.\n */\nexport function UNSAFE_PortalProvider(props: PortalProviderProps):
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAaM,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAA8B,CAAC;AAKjE,SAAS,0CAAsB,KAA0B;IAC9D,IAAI,gBAAC,YAAY,EAAC,GAAG;IACrB,IAAI,EAAC,cAAc,eAAe,EAAC,GAAG;IACtC,qBACE,0DAAC,0CAAc,QAAQ;QAAC,OAAO;YAAC,cAAc,iBAAiB,OAAO,YAAY,yBAAA,0BAAA,eAAgB;QAAe;OAC9G,MAAM,QAAQ;AAGrB;AAEO,SAAS;QACP;IAAP,OAAO,CAAA,cAAA,CAAA,GAAA,uBAAS,EAAE,wDAAX,yBAAA,cAA6B,CAAC;AACvC","sources":["packages/@react-aria/overlays/src/PortalProvider.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 React, {createContext, JSX, ReactNode, useContext} from 'react';\n\nexport interface PortalProviderProps {\n /** Should return the element where we should portal to. Can clear the context by passing null. */\n getContainer?: (() => HTMLElement | null) | null,\n /** The content of the PortalProvider. Should contain all children that want to portal their overlays to the element returned by the provided `getContainer()`. */\n children: ReactNode\n}\n\nexport interface PortalProviderContextValue extends Omit<PortalProviderProps, 'children'>{};\n\nexport const PortalContext = createContext<PortalProviderContextValue>({});\n\n/**\n * Sets the portal container for all overlay elements rendered by its children.\n */\nexport function UNSAFE_PortalProvider(props: PortalProviderProps): JSX.Element {\n let {getContainer} = props;\n let {getContainer: ctxGetContainer} = useUNSAFE_PortalContext();\n return (\n <PortalContext.Provider value={{getContainer: getContainer === null ? undefined : getContainer ?? ctxGetContainer}}>\n {props.children}\n </PortalContext.Provider>\n );\n}\n\nexport function useUNSAFE_PortalContext(): PortalProviderContextValue {\n return useContext(PortalContext) ?? {};\n}\n"],"names":[],"version":3,"file":"PortalProvider.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAaM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA8B,CAAC;AAKjE,SAAS,0CAAsB,KAA0B;IAC9D,IAAI,gBAAC,YAAY,EAAC,GAAG;IACrB,IAAI,EAAC,cAAc,eAAe,EAAC,GAAG;IACtC,qBACE,gCAAC,0CAAc,QAAQ;QAAC,OAAO;YAAC,cAAc,iBAAiB,OAAO,YAAY,yBAAA,0BAAA,eAAgB;QAAe;OAC9G,MAAM,QAAQ;AAGrB;AAEO,SAAS;QACP;IAAP,OAAO,CAAA,cAAA,CAAA,GAAA,iBAAS,EAAE,wDAAX,yBAAA,cAA6B,CAAC;AACvC","sources":["packages/@react-aria/overlays/src/PortalProvider.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 React, {createContext, ReactNode, useContext} from 'react';\n\nexport interface PortalProviderProps {\n /** Should return the element where we should portal to. Can clear the context by passing null. */\n getContainer?: () => HTMLElement | null,\n /** The content of the PortalProvider. Should contain all children that want to portal their overlays to the element returned by the provided `getContainer()`. */\n children: ReactNode\n}\n\nexport interface PortalProviderContextValue extends Omit<PortalProviderProps, 'children'>{};\n\nexport const PortalContext = createContext<PortalProviderContextValue>({});\n\n/**\n * Sets the portal container for all overlay elements rendered by its children.\n */\nexport function UNSAFE_PortalProvider(props: PortalProviderProps):
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAaM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA8B,CAAC;AAKjE,SAAS,0CAAsB,KAA0B;IAC9D,IAAI,gBAAC,YAAY,EAAC,GAAG;IACrB,IAAI,EAAC,cAAc,eAAe,EAAC,GAAG;IACtC,qBACE,gCAAC,0CAAc,QAAQ;QAAC,OAAO;YAAC,cAAc,iBAAiB,OAAO,YAAY,yBAAA,0BAAA,eAAgB;QAAe;OAC9G,MAAM,QAAQ;AAGrB;AAEO,SAAS;QACP;IAAP,OAAO,CAAA,cAAA,CAAA,GAAA,iBAAS,EAAE,wDAAX,yBAAA,cAA6B,CAAC;AACvC","sources":["packages/@react-aria/overlays/src/PortalProvider.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 React, {createContext, JSX, ReactNode, useContext} from 'react';\n\nexport interface PortalProviderProps {\n /** Should return the element where we should portal to. Can clear the context by passing null. */\n getContainer?: (() => HTMLElement | null) | null,\n /** The content of the PortalProvider. Should contain all children that want to portal their overlays to the element returned by the provided `getContainer()`. */\n children: ReactNode\n}\n\nexport interface PortalProviderContextValue extends Omit<PortalProviderProps, 'children'>{};\n\nexport const PortalContext = createContext<PortalProviderContextValue>({});\n\n/**\n * Sets the portal container for all overlay elements rendered by its children.\n */\nexport function UNSAFE_PortalProvider(props: PortalProviderProps): JSX.Element {\n let {getContainer} = props;\n let {getContainer: ctxGetContainer} = useUNSAFE_PortalContext();\n return (\n <PortalContext.Provider value={{getContainer: getContainer === null ? undefined : getContainer ?? ctxGetContainer}}>\n {props.children}\n </PortalContext.Provider>\n );\n}\n\nexport function useUNSAFE_PortalContext(): PortalProviderContextValue {\n return useContext(PortalContext) ?? {};\n}\n"],"names":[],"version":3,"file":"PortalProvider.module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { DOMAttributes, RefObject, DOMProps, AriaLabelingProps } from "@react-ty
|
|
|
2
2
|
import { PlacementAxis, PositionProps } from "@react-types/overlays";
|
|
3
3
|
import { AriaButtonProps } from "@react-types/button";
|
|
4
4
|
import { OverlayTriggerState } from "@react-stately/overlays";
|
|
5
|
-
import React, { ReactNode, AriaAttributes } from "react";
|
|
5
|
+
import React, { JSX, ReactNode, AriaAttributes } from "react";
|
|
6
6
|
export interface AriaPositionProps extends PositionProps {
|
|
7
7
|
/**
|
|
8
8
|
* Cross size of the overlay arrow in pixels.
|
|
@@ -124,7 +124,7 @@ interface PreventScrollOptions {
|
|
|
124
124
|
export function usePreventScroll(options?: PreventScrollOptions): void;
|
|
125
125
|
export interface PortalProviderProps {
|
|
126
126
|
/** Should return the element where we should portal to. Can clear the context by passing null. */
|
|
127
|
-
getContainer?: () => HTMLElement | null;
|
|
127
|
+
getContainer?: (() => HTMLElement | null) | null;
|
|
128
128
|
/** The content of the PortalProvider. Should contain all children that want to portal their overlays to the element returned by the provided `getContainer()`. */
|
|
129
129
|
children: ReactNode;
|
|
130
130
|
}
|
|
@@ -133,7 +133,7 @@ export interface PortalProviderContextValue extends Omit<PortalProviderProps, 'c
|
|
|
133
133
|
/**
|
|
134
134
|
* Sets the portal container for all overlay elements rendered by its children.
|
|
135
135
|
*/
|
|
136
|
-
export function UNSAFE_PortalProvider(props: PortalProviderProps):
|
|
136
|
+
export function UNSAFE_PortalProvider(props: PortalProviderProps): JSX.Element;
|
|
137
137
|
export function useUNSAFE_PortalContext(): PortalProviderContextValue;
|
|
138
138
|
export interface ModalProviderProps extends DOMAttributes {
|
|
139
139
|
children: ReactNode;
|
|
@@ -146,7 +146,7 @@ export interface ModalProviderProps extends DOMAttributes {
|
|
|
146
146
|
* subtree from screen readers. This is done using React context in order to account for things
|
|
147
147
|
* like portals, which can cause the React tree and the DOM tree to differ significantly in structure.
|
|
148
148
|
*/
|
|
149
|
-
export function ModalProvider(props: ModalProviderProps):
|
|
149
|
+
export function ModalProvider(props: ModalProviderProps): JSX.Element;
|
|
150
150
|
export interface ModalProviderAria {
|
|
151
151
|
/**
|
|
152
152
|
* Props to be spread on the container element.
|
|
@@ -166,7 +166,7 @@ export function useModalProvider(): ModalProviderAria;
|
|
|
166
166
|
* if a modal or other overlay is opened. Only the top-most modal or
|
|
167
167
|
* overlay should be accessible at once.
|
|
168
168
|
*/
|
|
169
|
-
export function OverlayProvider(props: ModalProviderProps):
|
|
169
|
+
export function OverlayProvider(props: ModalProviderProps): JSX.Element;
|
|
170
170
|
export interface OverlayContainerProps extends ModalProviderProps {
|
|
171
171
|
/**
|
|
172
172
|
* The container element in which the overlay portal will be placed.
|
|
@@ -210,7 +210,7 @@ export interface DismissButtonProps extends AriaLabelingProps, DOMProps {
|
|
|
210
210
|
* users to dismiss a modal or popup when there is no visual
|
|
211
211
|
* affordance to do so.
|
|
212
212
|
*/
|
|
213
|
-
export function DismissButton(props: DismissButtonProps):
|
|
213
|
+
export function DismissButton(props: DismissButtonProps): JSX.Element;
|
|
214
214
|
/**
|
|
215
215
|
* Hides all elements in the DOM outside the given targets from screen readers using aria-hidden,
|
|
216
216
|
* and returns a function to revert these changes. In addition, changes to the DOM are watched
|
|
@@ -304,7 +304,7 @@ export interface OverlayProps {
|
|
|
304
304
|
* A container which renders an overlay such as a popover or modal in a portal,
|
|
305
305
|
* and provides a focus scope for the child elements.
|
|
306
306
|
*/
|
|
307
|
-
export function Overlay(props: OverlayProps):
|
|
307
|
+
export function Overlay(props: OverlayProps): React.ReactPortal | null;
|
|
308
308
|
/** @private */
|
|
309
309
|
export function useOverlayFocusContain(): void;
|
|
310
310
|
export interface AriaModalOverlayProps extends Pick<AriaOverlayProps, 'shouldCloseOnInteractOutside'> {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;AEoBA,kCAAmC,SAAQ,aAAa;IACtD;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,SAAS,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,CAAC;IACrC;;OAEG;IACH,UAAU,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,CAAC;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,CAAC;IACtC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,4DAA4D;IAC5D,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED;IACE,+CAA+C;IAC/C,YAAY,EAAE,aAAa,CAAC;IAC5B,8CAA8C;IAC9C,UAAU,EAAE,aAAa,CAAC;IAC1B,oEAAoE;IACpE,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,2CAA2C;IAC3C,cAAc,IAAI,IAAI,CAAA;CACvB;AASD;;;G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a,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC","sources":["packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/calculatePosition.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useCloseOnScroll.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useOverlayPosition.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useOverlay.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useOverlayTrigger.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/usePreventScroll.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/PortalProvider.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useModal.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/DismissButton.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/ariaHideOutside.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/usePopover.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/Overlay.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useModalOverlay.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/index.ts","packages/@react-aria/overlays/src/index.ts"],"sourcesContent":[null,null,null,null,null,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 */\nexport {useOverlayPosition} from './useOverlayPosition';\nexport {useOverlay} from './useOverlay';\nexport {useOverlayTrigger} from './useOverlayTrigger';\nexport {usePreventScroll} from './usePreventScroll';\nexport {ModalProvider, useModalProvider, OverlayProvider, OverlayContainer, useModal} from './useModal';\nexport {DismissButton} from './DismissButton';\nexport {ariaHideOutside} from './ariaHideOutside';\nexport {usePopover} from './usePopover';\nexport {useModalOverlay} from './useModalOverlay';\nexport {Overlay, useOverlayFocusContain} from './Overlay';\nexport {UNSAFE_PortalProvider, useUNSAFE_PortalContext} from './PortalProvider';\n\nexport type {AriaPositionProps, PositionAria} from './useOverlayPosition';\nexport type {AriaOverlayProps, OverlayAria} from './useOverlay';\nexport type {OverlayTriggerAria, OverlayTriggerProps} from './useOverlayTrigger';\nexport type {AriaModalOptions, ModalAria, ModalProviderAria, ModalProviderProps, OverlayContainerProps} from './useModal';\nexport type {DismissButtonProps} from './DismissButton';\nexport type {AriaPopoverProps, PopoverAria} from './usePopover';\nexport type {AriaModalOverlayProps, ModalOverlayAria} from './useModalOverlay';\nexport type {OverlayProps} from './Overlay';\nexport type {Placement, PlacementAxis, PositionProps} from '@react-types/overlays';\nexport type {PortalProviderProps, PortalProviderContextValue} from './PortalProvider';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAmBD,MAAM,8CAAU,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAsB;AAUlD,SAAS,yCAAc,KAAyB;IACrD,IAAI,YAAC,QAAQ,EAAC,GAAG;IACjB,IAAI,SAAS,CAAA,GAAA,uBAAS,EAAE;IACxB,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,qBAAO,EAAE;IAC3C,IAAI,UAAU,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;oBAC3B;wBACA;YACA;gBACE,cAAc,CAAA,QAAS,QAAQ;gBAC/B,IAAI,QACF,OAAO,QAAQ;YAEnB;YACA;gBACE,cAAc,CAAA,QAAS,QAAQ;gBAC/B,IAAI,QACF,OAAO,WAAW;YAEtB;QACF,CAAA,GAAI;QAAC;QAAQ;KAAW;IAExB,qBACE,0D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;QAC/E,QAAQ,MAAM,CAAC,QAAQ;QACvB,OAAO;YACL,IAAI,WAAW,QAAQ,MAAM,EAC3B,QAAQ,MAAM,CAAC,WAAW;QAE9B;IACF,GAAG;QAAC;QAAS,QAAQ,MAAM;QAAE,oBAAA,8BAAA,QAAS,UAAU;KAAC;IAEjD,OAAO;QACL,YAAY;YACV,gBAAgB,EAAC,oBAAA,8BAAA,QAAS,UAAU;QACtC;IACF;AACF","sources":["packages/@react-aria/overlays/src/useModal.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 {DOMAttributes} from '@react-types/shared';\nimport React, {AriaAttributes, ReactNode, useContext, useEffect, useMemo, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport {useIsSSR} from '@react-aria/ssr';\nimport {useUNSAFE_PortalContext} from './PortalProvider';\n\nexport interface ModalProviderProps extends DOMAttributes {\n children: ReactNode\n}\n\ninterface ModalContext {\n parent: ModalContext | null,\n modalCount: number,\n addModal: () => void,\n removeModal: () => void\n}\n\nconst Context = React.createContext<ModalContext | null>(null);\n\n/**\n * Each ModalProvider tracks how many modals are open in its subtree. On mount, the modals\n * trigger `addModal` to increment the count, and trigger `removeModal` on unmount to decrement it.\n * This is done recursively so that all parent providers are incremented and decremented.\n * If the modal count is greater than zero, we add `aria-hidden` to this provider to hide its\n * subtree from screen readers. This is done using React context in order to account for things\n * like portals, which can cause the React tree and the DOM tree to differ significantly in structure.\n */\nexport function ModalProvider(props: ModalProviderProps):
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;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AAS,CAAC;QACd,IAAI,4BAAA,sCAAA,gBAAiB,OAAO,CAAC,6BAC3B,MAAM,IAAI,MAAM;IAEpB,GAAG;QAAC;KAAgB;IAEpB,IAAI,CAAC,iBACH,OAAO;IAGT,IAAI,yBAAW,0DAAC,2CAAoB;IACpC,qBAAO,CAAA,GAAA,yCAAO,EAAE,YAAY,CAAC,UAAU;AACzC;AAsBO,SAAS,0CAAS,OAA0B;IACjD,4EAA4E;IAC5E,IAAI,UAAU,CAAA,GAAA,uBAAS,EAAE;IACzB,IAAI,CAAC,SACH,MAAM,IAAI,MAAM;IAGlB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAA,oBAAA,8BAAA,QAAS,UAAU,KAAI,CAAC,WAAW,CAAC,QAAQ,MAAM,EACpD;QAGF,+EAA+E;QAC/E,+EAA+E;QAC/E,QAAQ,MAAM,CAAC,QAAQ;QACvB,OAAO;YACL,IAAI,WAAW,QAAQ,MAAM,EAC3B,QAAQ,MAAM,CAAC,WAAW;QAE9B;IACF,GAAG;QAAC;QAAS,QAAQ,MAAM;QAAE,oBAAA,8BAAA,QAAS,UAAU;KAAC;IAEjD,OAAO;QACL,YAAY;YACV,gBAAgB,EAAC,oBAAA,8BAAA,QAAS,UAAU;QACtC;IACF;AACF","sources":["packages/@react-aria/overlays/src/useModal.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 {DOMAttributes} from '@react-types/shared';\nimport React, {AriaAttributes, JSX, ReactNode, useContext, useEffect, useMemo, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport {useIsSSR} from '@react-aria/ssr';\nimport {useUNSAFE_PortalContext} from './PortalProvider';\n\nexport interface ModalProviderProps extends DOMAttributes {\n children: ReactNode\n}\n\ninterface ModalContext {\n parent: ModalContext | null,\n modalCount: number,\n addModal: () => void,\n removeModal: () => void\n}\n\nconst Context = React.createContext<ModalContext | null>(null);\n\n/**\n * Each ModalProvider tracks how many modals are open in its subtree. On mount, the modals\n * trigger `addModal` to increment the count, and trigger `removeModal` on unmount to decrement it.\n * This is done recursively so that all parent providers are incremented and decremented.\n * If the modal count is greater than zero, we add `aria-hidden` to this provider to hide its\n * subtree from screen readers. This is done using React context in order to account for things\n * like portals, which can cause the React tree and the DOM tree to differ significantly in structure.\n */\nexport function ModalProvider(props: ModalProviderProps): JSX.Element {\n let {children} = props;\n let parent = useContext(Context);\n let [modalCount, setModalCount] = useState(0);\n let context = useMemo(() => ({\n parent,\n modalCount,\n addModal() {\n setModalCount(count => count + 1);\n if (parent) {\n parent.addModal();\n }\n },\n removeModal() {\n setModalCount(count => count - 1);\n if (parent) {\n parent.removeModal();\n }\n }\n }), [parent, modalCount]);\n\n return (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n );\n}\n\nexport interface ModalProviderAria {\n /**\n * Props to be spread on the container element.\n */\n modalProviderProps: AriaAttributes\n}\n\n/**\n * Used to determine if the tree should be aria-hidden based on how many\n * modals are open.\n */\nexport function useModalProvider(): ModalProviderAria {\n let context = useContext(Context);\n return {\n modalProviderProps: {\n 'aria-hidden': context && context.modalCount > 0 ? true : undefined\n }\n };\n}\n\n/**\n * Creates a root node that will be aria-hidden if there are other modals open.\n */\nfunction OverlayContainerDOM(props: ModalProviderProps) {\n let {modalProviderProps} = useModalProvider();\n return <div data-overlay-container {...props} {...modalProviderProps} />;\n}\n\n/**\n * An OverlayProvider acts as a container for the top-level application.\n * Any application that uses modal dialogs or other overlays should\n * be wrapped in a `<OverlayProvider>`. This is used to ensure that\n * the main content of the application is hidden from screen readers\n * if a modal or other overlay is opened. Only the top-most modal or\n * overlay should be accessible at once.\n */\nexport function OverlayProvider(props: ModalProviderProps): JSX.Element {\n return (\n <ModalProvider>\n <OverlayContainerDOM {...props} />\n </ModalProvider>\n );\n}\n\nexport interface OverlayContainerProps extends ModalProviderProps {\n /**\n * The container element in which the overlay portal will be placed.\n * @default document.body\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n */\n portalContainer?: Element\n}\n\n/**\n * A container for overlays like modals and popovers. Renders the overlay\n * into a Portal which is placed at the end of the document body.\n * Also ensures that the overlay is hidden from screen readers if a\n * nested modal is opened. Only the top-most modal or overlay should\n * be accessible at once.\n */\nexport function OverlayContainer(props: OverlayContainerProps): React.ReactPortal | null {\n let isSSR = useIsSSR();\n let {portalContainer = isSSR ? null : document.body, ...rest} = props;\n let {getContainer} = useUNSAFE_PortalContext();\n if (!props.portalContainer && getContainer) {\n portalContainer = getContainer();\n }\n\n React.useEffect(() => {\n if (portalContainer?.closest('[data-overlay-container]')) {\n throw new Error('An OverlayContainer must not be inside another container. Please change the portalContainer prop.');\n }\n }, [portalContainer]);\n\n if (!portalContainer) {\n return null;\n }\n\n let contents = <OverlayProvider {...rest} />;\n return ReactDOM.createPortal(contents, portalContainer);\n}\n\ninterface ModalAriaProps extends DOMAttributes {\n /** Data attribute marks the dom node as a modal for the aria-modal-polyfill. */\n 'data-ismodal': boolean\n}\n\nexport interface AriaModalOptions {\n isDisabled?: boolean\n}\n\nexport interface ModalAria {\n /** Props for the modal content element. */\n modalProps: ModalAriaProps\n}\n\n/**\n * Hides content outside the current `<OverlayContainer>` from screen readers\n * on mount and restores it on unmount. Typically used by modal dialogs and\n * other types of overlays to ensure that only the top-most modal is\n * accessible at once.\n */\nexport function useModal(options?: AriaModalOptions): ModalAria {\n // Add aria-hidden to all parent providers on mount, and restore on unmount.\n let context = useContext(Context);\n if (!context) {\n throw new Error('Modal is not contained within a provider');\n }\n\n useEffect(() => {\n if (options?.isDisabled || !context || !context.parent) {\n return;\n }\n\n // The immediate context is from the provider containing this modal, so we only\n // want to trigger aria-hidden on its parents not on the modal provider itself.\n context.parent.addModal();\n return () => {\n if (context && context.parent) {\n context.parent.removeModal();\n }\n };\n }, [context, context.parent, options?.isDisabled]);\n\n return {\n modalProps: {\n 'data-ismodal': !options?.isDisabled\n }\n };\n}\n"],"names":[],"version":3,"file":"useModal.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAmBD,MAAM,8CAAU,CAAA,GAAA,YAAI,EAAE,aAAa,CAAsB;AAUlD,SAAS,yCAAc,KAAyB;IACrD,IAAI,YAAC,QAAQ,EAAC,GAAG;IACjB,IAAI,SAAS,CAAA,GAAA,iBAAS,EAAE;IACxB,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,eAAO,EAAE;IAC3C,IAAI,UAAU,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;oBAC3B;wBACA;YACA;gBACE,cAAc,CAAA,QAAS,QAAQ;gBAC/B,IAAI,QACF,OAAO,QAAQ;YAEnB;YACA;gBACE,cAAc,CAAA,QAAS,QAAQ;gBAC/B,IAAI,QACF,OAAO,WAAW;YAEtB;QACF,CAAA,GAAI;QAAC;QAAQ;KAAW;IAExB,qBACE,gCAAC,8BAAQ,QAAQ;QAAC,OAAO;OACtB;AAGP;AAaO,SAAS;IACd,IAAI,UAAU,CAAA,GAAA,iBAAS,EAAE;IACzB,OAAO;QACL,oBAAoB;YAClB,eAAe,WAAW,QAAQ,UAAU,GAAG,IAAI,OAAO;QAC5D;IACF;AACF;AAEA;;CAEC,GACD,SAAS,0CAAoB,KAAyB;IACpD,IAAI,sBAAC,kBAAkB,EAAC,GAAG;IAC3B,qBAAO,gCAAC;QAAI,0BAAA;QAAwB,GAAG,KAAK;QAAG,GAAG,kBAAkB;;AACtE;AAUO,SAAS,0CAAgB,KAAyB;IACvD,qBACE,gCAAC,8DACC,gCAAC,2CAAwB;AAG/B;AAkBO,SAAS,0CAAiB,KAA4B;IAC3D,IAAI,QAAQ,CAAA,GAAA,eAAO;IACnB,IAAI,mBAAC,kBAAkB,QAAQ,OAAO,SAAS,IAAI,EAAE,GAAG,MAAK,GAAG;IAChE,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,yCAAsB;IAC3C,IAAI,CAAC,MAAM,eAAe,IAAI,cAC5B,kBAAkB;IAGpB,CAAA,GAAA,YAAI,EAAE,SAAS,CAAC;QACd,IAAI,4BAAA,sCAAA,gBAAiB,OAAO,CAAC,6BAC3B,MAAM,IAAI,MAAM;IAEpB,GAAG;QAAC;KAAgB;IAEpB,IAAI,CAAC,iBACH,OAAO;IAGT,IAAI,yBAAW,gCAAC,2CAAoB;IACpC,qBAAO,CAAA,GAAA,eAAO,EAAE,YAAY,CAAC,UAAU;AACzC;AAsBO,SAAS,0CAAS,OAA0B;IACjD,4EAA4E;IAC5E,IAAI,UAAU,CAAA,GAAA,iBAAS,EAAE;IACzB,IAAI,CAAC,SACH,MAAM,IAAI,MAAM;IAGlB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAA,oBAAA,8BAAA,QAAS,UAAU,KAAI,CAAC,WAAW,CAAC,QAAQ,MAAM,EACpD;QAGF,+EAA+E;QAC/E,+EAA+E;QAC/E,QAAQ,MAAM,CAAC,QAAQ;QACvB,OAAO;YACL,IAAI,WAAW,QAAQ,MAAM,EAC3B,QAAQ,MAAM,CAAC,WAAW;QAE9B;IACF,GAAG;QAAC;QAAS,QAAQ,MAAM;QAAE,oBAAA,8BAAA,QAAS,UAAU;KAAC;IAEjD,OAAO;QACL,YAAY;YACV,gBAAgB,EAAC,oBAAA,8BAAA,QAAS,UAAU;QACtC;IACF;AACF","sources":["packages/@react-aria/overlays/src/useModal.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 {DOMAttributes} from '@react-types/shared';\nimport React, {AriaAttributes, ReactNode, useContext, useEffect, useMemo, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport {useIsSSR} from '@react-aria/ssr';\nimport {useUNSAFE_PortalContext} from './PortalProvider';\n\nexport interface ModalProviderProps extends DOMAttributes {\n children: ReactNode\n}\n\ninterface ModalContext {\n parent: ModalContext | null,\n modalCount: number,\n addModal: () => void,\n removeModal: () => void\n}\n\nconst Context = React.createContext<ModalContext | null>(null);\n\n/**\n * Each ModalProvider tracks how many modals are open in its subtree. On mount, the modals\n * trigger `addModal` to increment the count, and trigger `removeModal` on unmount to decrement it.\n * This is done recursively so that all parent providers are incremented and decremented.\n * If the modal count is greater than zero, we add `aria-hidden` to this provider to hide its\n * subtree from screen readers. This is done using React context in order to account for things\n * like portals, which can cause the React tree and the DOM tree to differ significantly in structure.\n */\nexport function ModalProvider(props: ModalProviderProps):
|
|
1
|
+
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAmBD,MAAM,8CAAU,CAAA,GAAA,YAAI,EAAE,aAAa,CAAsB;AAUlD,SAAS,yCAAc,KAAyB;IACrD,IAAI,YAAC,QAAQ,EAAC,GAAG;IACjB,IAAI,SAAS,CAAA,GAAA,iBAAS,EAAE;IACxB,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,eAAO,EAAE;IAC3C,IAAI,UAAU,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;oBAC3B;wBACA;YACA;gBACE,cAAc,CAAA,QAAS,QAAQ;gBAC/B,IAAI,QACF,OAAO,QAAQ;YAEnB;YACA;gBACE,cAAc,CAAA,QAAS,QAAQ;gBAC/B,IAAI,QACF,OAAO,WAAW;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CAAC,QAAQ,MAAM,EACpD;QAGF,+EAA+E;QAC/E,+EAA+E;QAC/E,QAAQ,MAAM,CAAC,QAAQ;QACvB,OAAO;YACL,IAAI,WAAW,QAAQ,MAAM,EAC3B,QAAQ,MAAM,CAAC,WAAW;QAE9B;IACF,GAAG;QAAC;QAAS,QAAQ,MAAM;QAAE,oBAAA,8BAAA,QAAS,UAAU;KAAC;IAEjD,OAAO;QACL,YAAY;YACV,gBAAgB,EAAC,oBAAA,8BAAA,QAAS,UAAU;QACtC;IACF;AACF","sources":["packages/@react-aria/overlays/src/useModal.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 {DOMAttributes} from '@react-types/shared';\nimport React, {AriaAttributes, JSX, ReactNode, useContext, useEffect, useMemo, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport {useIsSSR} from '@react-aria/ssr';\nimport {useUNSAFE_PortalContext} from './PortalProvider';\n\nexport interface ModalProviderProps extends DOMAttributes {\n children: ReactNode\n}\n\ninterface ModalContext {\n parent: ModalContext | null,\n modalCount: number,\n addModal: () => void,\n removeModal: () => void\n}\n\nconst Context = React.createContext<ModalContext | null>(null);\n\n/**\n * Each ModalProvider tracks how many modals are open in its subtree. On mount, the modals\n * trigger `addModal` to increment the count, and trigger `removeModal` on unmount to decrement it.\n * This is done recursively so that all parent providers are incremented and decremented.\n * If the modal count is greater than zero, we add `aria-hidden` to this provider to hide its\n * subtree from screen readers. This is done using React context in order to account for things\n * like portals, which can cause the React tree and the DOM tree to differ significantly in structure.\n */\nexport function ModalProvider(props: ModalProviderProps): JSX.Element {\n let {children} = props;\n let parent = useContext(Context);\n let [modalCount, setModalCount] = useState(0);\n let context = useMemo(() => ({\n parent,\n modalCount,\n addModal() {\n setModalCount(count => count + 1);\n if (parent) {\n parent.addModal();\n }\n },\n removeModal() {\n setModalCount(count => count - 1);\n if (parent) {\n parent.removeModal();\n }\n }\n }), [parent, modalCount]);\n\n return (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n );\n}\n\nexport interface ModalProviderAria {\n /**\n * Props to be spread on the container element.\n */\n modalProviderProps: AriaAttributes\n}\n\n/**\n * Used to determine if the tree should be aria-hidden based on how many\n * modals are open.\n */\nexport function useModalProvider(): ModalProviderAria {\n let context = useContext(Context);\n return {\n modalProviderProps: {\n 'aria-hidden': context && context.modalCount > 0 ? true : undefined\n }\n };\n}\n\n/**\n * Creates a root node that will be aria-hidden if there are other modals open.\n */\nfunction OverlayContainerDOM(props: ModalProviderProps) {\n let {modalProviderProps} = useModalProvider();\n return <div data-overlay-container {...props} {...modalProviderProps} />;\n}\n\n/**\n * An OverlayProvider acts as a container for the top-level application.\n * Any application that uses modal dialogs or other overlays should\n * be wrapped in a `<OverlayProvider>`. This is used to ensure that\n * the main content of the application is hidden from screen readers\n * if a modal or other overlay is opened. Only the top-most modal or\n * overlay should be accessible at once.\n */\nexport function OverlayProvider(props: ModalProviderProps): JSX.Element {\n return (\n <ModalProvider>\n <OverlayContainerDOM {...props} />\n </ModalProvider>\n );\n}\n\nexport interface OverlayContainerProps extends ModalProviderProps {\n /**\n * The container element in which the overlay portal will be placed.\n * @default document.body\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n */\n portalContainer?: Element\n}\n\n/**\n * A container for overlays like modals and popovers. Renders the overlay\n * into a Portal which is placed at the end of the document body.\n * Also ensures that the overlay is hidden from screen readers if a\n * nested modal is opened. Only the top-most modal or overlay should\n * be accessible at once.\n */\nexport function OverlayContainer(props: OverlayContainerProps): React.ReactPortal | null {\n let isSSR = useIsSSR();\n let {portalContainer = isSSR ? null : document.body, ...rest} = props;\n let {getContainer} = useUNSAFE_PortalContext();\n if (!props.portalContainer && getContainer) {\n portalContainer = getContainer();\n }\n\n React.useEffect(() => {\n if (portalContainer?.closest('[data-overlay-container]')) {\n throw new Error('An OverlayContainer must not be inside another container. Please change the portalContainer prop.');\n }\n }, [portalContainer]);\n\n if (!portalContainer) {\n return null;\n }\n\n let contents = <OverlayProvider {...rest} />;\n return ReactDOM.createPortal(contents, portalContainer);\n}\n\ninterface ModalAriaProps extends DOMAttributes {\n /** Data attribute marks the dom node as a modal for the aria-modal-polyfill. */\n 'data-ismodal': boolean\n}\n\nexport interface AriaModalOptions {\n isDisabled?: boolean\n}\n\nexport interface ModalAria {\n /** Props for the modal content element. */\n modalProps: ModalAriaProps\n}\n\n/**\n * Hides content outside the current `<OverlayContainer>` from screen readers\n * on mount and restores it on unmount. Typically used by modal dialogs and\n * other types of overlays to ensure that only the top-most modal is\n * accessible at once.\n */\nexport function useModal(options?: AriaModalOptions): ModalAria {\n // Add aria-hidden to all parent providers on mount, and restore on unmount.\n let context = useContext(Context);\n if (!context) {\n throw new Error('Modal is not contained within a provider');\n }\n\n useEffect(() => {\n if (options?.isDisabled || !context || !context.parent) {\n return;\n }\n\n // The immediate context is from the provider containing this modal, so we only\n // want to trigger aria-hidden on its parents not on the modal provider itself.\n context.parent.addModal();\n return () => {\n if (context && context.parent) {\n context.parent.removeModal();\n }\n };\n }, [context, context.parent, options?.isDisabled]);\n\n return {\n modalProps: {\n 'data-ismodal': !options?.isDisabled\n }\n };\n}\n"],"names":[],"version":3,"file":"useModal.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/overlays",
|
|
3
|
-
"version": "3.27.
|
|
3
|
+
"version": "3.27.1",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/focus": "^3.20.
|
|
26
|
-
"@react-aria/i18n": "^3.12.
|
|
27
|
-
"@react-aria/interactions": "^3.25.
|
|
25
|
+
"@react-aria/focus": "^3.20.3",
|
|
26
|
+
"@react-aria/i18n": "^3.12.9",
|
|
27
|
+
"@react-aria/interactions": "^3.25.1",
|
|
28
28
|
"@react-aria/ssr": "^3.9.8",
|
|
29
|
-
"@react-aria/utils": "^3.
|
|
30
|
-
"@react-aria/visually-hidden": "^3.8.
|
|
31
|
-
"@react-stately/overlays": "^3.6.
|
|
32
|
-
"@react-types/button": "^3.12.
|
|
33
|
-
"@react-types/overlays": "^3.8.
|
|
34
|
-
"@react-types/shared": "^3.29.
|
|
29
|
+
"@react-aria/utils": "^3.29.0",
|
|
30
|
+
"@react-aria/visually-hidden": "^3.8.23",
|
|
31
|
+
"@react-stately/overlays": "^3.6.16",
|
|
32
|
+
"@react-types/button": "^3.12.1",
|
|
33
|
+
"@react-types/overlays": "^3.8.15",
|
|
34
|
+
"@react-types/shared": "^3.29.1",
|
|
35
35
|
"@swc/helpers": "^0.5.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "9c77d4e8267ed39469c65f65da94ece7be509874"
|
|
45
45
|
}
|
package/src/DismissButton.tsx
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import {AriaLabelingProps, DOMProps} from '@react-types/shared';
|
|
14
14
|
// @ts-ignore
|
|
15
15
|
import intlMessages from '../intl/*.json';
|
|
16
|
-
import React, {
|
|
16
|
+
import React, {JSX} from 'react';
|
|
17
17
|
import {useLabels} from '@react-aria/utils';
|
|
18
18
|
import {useLocalizedStringFormatter} from '@react-aria/i18n';
|
|
19
19
|
import {VisuallyHidden} from '@react-aria/visually-hidden';
|
|
@@ -28,7 +28,7 @@ export interface DismissButtonProps extends AriaLabelingProps, DOMProps {
|
|
|
28
28
|
* users to dismiss a modal or popup when there is no visual
|
|
29
29
|
* affordance to do so.
|
|
30
30
|
*/
|
|
31
|
-
export function DismissButton(props: DismissButtonProps):
|
|
31
|
+
export function DismissButton(props: DismissButtonProps): JSX.Element {
|
|
32
32
|
let {onDismiss, ...otherProps} = props;
|
|
33
33
|
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/overlays');
|
|
34
34
|
|
package/src/Overlay.tsx
CHANGED
|
@@ -49,7 +49,7 @@ export const OverlayContext = React.createContext<{contain: boolean, setContain:
|
|
|
49
49
|
* A container which renders an overlay such as a popover or modal in a portal,
|
|
50
50
|
* and provides a focus scope for the child elements.
|
|
51
51
|
*/
|
|
52
|
-
export function Overlay(props: OverlayProps):
|
|
52
|
+
export function Overlay(props: OverlayProps): React.ReactPortal | null {
|
|
53
53
|
let isSSR = useIsSSR();
|
|
54
54
|
let {portalContainer = isSSR ? null : document.body, isExiting} = props;
|
|
55
55
|
let [contain, setContain] = useState(false);
|
package/src/PortalProvider.tsx
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React, {createContext, ReactNode, useContext} from 'react';
|
|
13
|
+
import React, {createContext, JSX, ReactNode, useContext} from 'react';
|
|
14
14
|
|
|
15
15
|
export interface PortalProviderProps {
|
|
16
16
|
/** Should return the element where we should portal to. Can clear the context by passing null. */
|
|
17
|
-
getContainer?: () => HTMLElement | null,
|
|
17
|
+
getContainer?: (() => HTMLElement | null) | null,
|
|
18
18
|
/** The content of the PortalProvider. Should contain all children that want to portal their overlays to the element returned by the provided `getContainer()`. */
|
|
19
19
|
children: ReactNode
|
|
20
20
|
}
|
|
@@ -26,7 +26,7 @@ export const PortalContext = createContext<PortalProviderContextValue>({});
|
|
|
26
26
|
/**
|
|
27
27
|
* Sets the portal container for all overlay elements rendered by its children.
|
|
28
28
|
*/
|
|
29
|
-
export function UNSAFE_PortalProvider(props: PortalProviderProps):
|
|
29
|
+
export function UNSAFE_PortalProvider(props: PortalProviderProps): JSX.Element {
|
|
30
30
|
let {getContainer} = props;
|
|
31
31
|
let {getContainer: ctxGetContainer} = useUNSAFE_PortalContext();
|
|
32
32
|
return (
|
package/src/useModal.tsx
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {DOMAttributes} from '@react-types/shared';
|
|
14
|
-
import React, {AriaAttributes, ReactNode, useContext, useEffect, useMemo, useState} from 'react';
|
|
14
|
+
import React, {AriaAttributes, JSX, ReactNode, useContext, useEffect, useMemo, useState} from 'react';
|
|
15
15
|
import ReactDOM from 'react-dom';
|
|
16
16
|
import {useIsSSR} from '@react-aria/ssr';
|
|
17
17
|
import {useUNSAFE_PortalContext} from './PortalProvider';
|
|
@@ -37,7 +37,7 @@ const Context = React.createContext<ModalContext | null>(null);
|
|
|
37
37
|
* subtree from screen readers. This is done using React context in order to account for things
|
|
38
38
|
* like portals, which can cause the React tree and the DOM tree to differ significantly in structure.
|
|
39
39
|
*/
|
|
40
|
-
export function ModalProvider(props: ModalProviderProps):
|
|
40
|
+
export function ModalProvider(props: ModalProviderProps): JSX.Element {
|
|
41
41
|
let {children} = props;
|
|
42
42
|
let parent = useContext(Context);
|
|
43
43
|
let [modalCount, setModalCount] = useState(0);
|
|
@@ -101,7 +101,7 @@ function OverlayContainerDOM(props: ModalProviderProps) {
|
|
|
101
101
|
* if a modal or other overlay is opened. Only the top-most modal or
|
|
102
102
|
* overlay should be accessible at once.
|
|
103
103
|
*/
|
|
104
|
-
export function OverlayProvider(props: ModalProviderProps):
|
|
104
|
+
export function OverlayProvider(props: ModalProviderProps): JSX.Element {
|
|
105
105
|
return (
|
|
106
106
|
<ModalProvider>
|
|
107
107
|
<OverlayContainerDOM {...props} />
|