@react-aria/overlays 3.31.2 → 3.32.0
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/import.mjs +12 -12
- package/dist/main.js +28 -28
- package/dist/main.js.map +1 -1
- package/dist/module.js +12 -12
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +19 -0
- package/package.json +15 -22
- package/src/index.ts +19 -22
- package/dist/DismissButton.main.js +0 -51
- package/dist/DismissButton.main.js.map +0 -1
- package/dist/DismissButton.mjs +0 -46
- package/dist/DismissButton.module.js +0 -46
- package/dist/DismissButton.module.js.map +0 -1
- package/dist/Overlay.main.js +0 -73
- package/dist/Overlay.main.js.map +0 -1
- package/dist/Overlay.mjs +0 -63
- package/dist/Overlay.module.js +0 -63
- package/dist/Overlay.module.js.map +0 -1
- package/dist/PortalProvider.main.js +0 -41
- package/dist/PortalProvider.main.js.map +0 -1
- package/dist/PortalProvider.mjs +0 -31
- package/dist/PortalProvider.module.js +0 -31
- package/dist/PortalProvider.module.js.map +0 -1
- package/dist/ar-AE.main.js +0 -6
- package/dist/ar-AE.main.js.map +0 -1
- package/dist/ar-AE.mjs +0 -8
- package/dist/ar-AE.module.js +0 -8
- package/dist/ar-AE.module.js.map +0 -1
- package/dist/ariaHideOutside.main.js +0 -203
- package/dist/ariaHideOutside.main.js.map +0 -1
- package/dist/ariaHideOutside.mjs +0 -197
- package/dist/ariaHideOutside.module.js +0 -197
- package/dist/ariaHideOutside.module.js.map +0 -1
- package/dist/bg-BG.main.js +0 -6
- package/dist/bg-BG.main.js.map +0 -1
- package/dist/bg-BG.mjs +0 -8
- package/dist/bg-BG.module.js +0 -8
- package/dist/bg-BG.module.js.map +0 -1
- package/dist/calculatePosition.main.js +0 -438
- package/dist/calculatePosition.main.js.map +0 -1
- package/dist/calculatePosition.mjs +0 -432
- package/dist/calculatePosition.module.js +0 -432
- package/dist/calculatePosition.module.js.map +0 -1
- package/dist/cs-CZ.main.js +0 -6
- package/dist/cs-CZ.main.js.map +0 -1
- package/dist/cs-CZ.mjs +0 -8
- package/dist/cs-CZ.module.js +0 -8
- package/dist/cs-CZ.module.js.map +0 -1
- package/dist/da-DK.main.js +0 -6
- package/dist/da-DK.main.js.map +0 -1
- package/dist/da-DK.mjs +0 -8
- package/dist/da-DK.module.js +0 -8
- package/dist/da-DK.module.js.map +0 -1
- package/dist/de-DE.main.js +0 -6
- package/dist/de-DE.main.js.map +0 -1
- package/dist/de-DE.mjs +0 -8
- package/dist/de-DE.module.js +0 -8
- package/dist/de-DE.module.js.map +0 -1
- package/dist/el-GR.main.js +0 -6
- package/dist/el-GR.main.js.map +0 -1
- package/dist/el-GR.mjs +0 -8
- package/dist/el-GR.module.js +0 -8
- package/dist/el-GR.module.js.map +0 -1
- package/dist/en-US.main.js +0 -6
- package/dist/en-US.main.js.map +0 -1
- package/dist/en-US.mjs +0 -8
- package/dist/en-US.module.js +0 -8
- package/dist/en-US.module.js.map +0 -1
- package/dist/es-ES.main.js +0 -6
- package/dist/es-ES.main.js.map +0 -1
- package/dist/es-ES.mjs +0 -8
- package/dist/es-ES.module.js +0 -8
- package/dist/es-ES.module.js.map +0 -1
- package/dist/et-EE.main.js +0 -6
- package/dist/et-EE.main.js.map +0 -1
- package/dist/et-EE.mjs +0 -8
- package/dist/et-EE.module.js +0 -8
- package/dist/et-EE.module.js.map +0 -1
- package/dist/fi-FI.main.js +0 -6
- package/dist/fi-FI.main.js.map +0 -1
- package/dist/fi-FI.mjs +0 -8
- package/dist/fi-FI.module.js +0 -8
- package/dist/fi-FI.module.js.map +0 -1
- package/dist/fr-FR.main.js +0 -6
- package/dist/fr-FR.main.js.map +0 -1
- package/dist/fr-FR.mjs +0 -8
- package/dist/fr-FR.module.js +0 -8
- package/dist/fr-FR.module.js.map +0 -1
- package/dist/he-IL.main.js +0 -6
- package/dist/he-IL.main.js.map +0 -1
- package/dist/he-IL.mjs +0 -8
- package/dist/he-IL.module.js +0 -8
- package/dist/he-IL.module.js.map +0 -1
- package/dist/hr-HR.main.js +0 -6
- package/dist/hr-HR.main.js.map +0 -1
- package/dist/hr-HR.mjs +0 -8
- package/dist/hr-HR.module.js +0 -8
- package/dist/hr-HR.module.js.map +0 -1
- package/dist/hu-HU.main.js +0 -6
- package/dist/hu-HU.main.js.map +0 -1
- package/dist/hu-HU.mjs +0 -8
- package/dist/hu-HU.module.js +0 -8
- package/dist/hu-HU.module.js.map +0 -1
- package/dist/intlStrings.main.js +0 -108
- package/dist/intlStrings.main.js.map +0 -1
- package/dist/intlStrings.mjs +0 -110
- package/dist/intlStrings.module.js +0 -110
- package/dist/intlStrings.module.js.map +0 -1
- package/dist/it-IT.main.js +0 -6
- package/dist/it-IT.main.js.map +0 -1
- package/dist/it-IT.mjs +0 -8
- package/dist/it-IT.module.js +0 -8
- package/dist/it-IT.module.js.map +0 -1
- package/dist/ja-JP.main.js +0 -6
- package/dist/ja-JP.main.js.map +0 -1
- package/dist/ja-JP.mjs +0 -8
- package/dist/ja-JP.module.js +0 -8
- package/dist/ja-JP.module.js.map +0 -1
- package/dist/ko-KR.main.js +0 -6
- package/dist/ko-KR.main.js.map +0 -1
- package/dist/ko-KR.mjs +0 -8
- package/dist/ko-KR.module.js +0 -8
- package/dist/ko-KR.module.js.map +0 -1
- package/dist/lt-LT.main.js +0 -6
- package/dist/lt-LT.main.js.map +0 -1
- package/dist/lt-LT.mjs +0 -8
- package/dist/lt-LT.module.js +0 -8
- package/dist/lt-LT.module.js.map +0 -1
- package/dist/lv-LV.main.js +0 -6
- package/dist/lv-LV.main.js.map +0 -1
- package/dist/lv-LV.mjs +0 -8
- package/dist/lv-LV.module.js +0 -8
- package/dist/lv-LV.module.js.map +0 -1
- package/dist/nb-NO.main.js +0 -6
- package/dist/nb-NO.main.js.map +0 -1
- package/dist/nb-NO.mjs +0 -8
- package/dist/nb-NO.module.js +0 -8
- package/dist/nb-NO.module.js.map +0 -1
- package/dist/nl-NL.main.js +0 -6
- package/dist/nl-NL.main.js.map +0 -1
- package/dist/nl-NL.mjs +0 -8
- package/dist/nl-NL.module.js +0 -8
- package/dist/nl-NL.module.js.map +0 -1
- package/dist/pl-PL.main.js +0 -6
- package/dist/pl-PL.main.js.map +0 -1
- package/dist/pl-PL.mjs +0 -8
- package/dist/pl-PL.module.js +0 -8
- package/dist/pl-PL.module.js.map +0 -1
- package/dist/pt-BR.main.js +0 -6
- package/dist/pt-BR.main.js.map +0 -1
- package/dist/pt-BR.mjs +0 -8
- package/dist/pt-BR.module.js +0 -8
- package/dist/pt-BR.module.js.map +0 -1
- package/dist/pt-PT.main.js +0 -6
- package/dist/pt-PT.main.js.map +0 -1
- package/dist/pt-PT.mjs +0 -8
- package/dist/pt-PT.module.js +0 -8
- package/dist/pt-PT.module.js.map +0 -1
- package/dist/ro-RO.main.js +0 -6
- package/dist/ro-RO.main.js.map +0 -1
- package/dist/ro-RO.mjs +0 -8
- package/dist/ro-RO.module.js +0 -8
- package/dist/ro-RO.module.js.map +0 -1
- package/dist/ru-RU.main.js +0 -6
- package/dist/ru-RU.main.js.map +0 -1
- package/dist/ru-RU.mjs +0 -8
- package/dist/ru-RU.module.js +0 -8
- package/dist/ru-RU.module.js.map +0 -1
- package/dist/sk-SK.main.js +0 -6
- package/dist/sk-SK.main.js.map +0 -1
- package/dist/sk-SK.mjs +0 -8
- package/dist/sk-SK.module.js +0 -8
- package/dist/sk-SK.module.js.map +0 -1
- package/dist/sl-SI.main.js +0 -6
- package/dist/sl-SI.main.js.map +0 -1
- package/dist/sl-SI.mjs +0 -8
- package/dist/sl-SI.module.js +0 -8
- package/dist/sl-SI.module.js.map +0 -1
- package/dist/sr-SP.main.js +0 -6
- package/dist/sr-SP.main.js.map +0 -1
- package/dist/sr-SP.mjs +0 -8
- package/dist/sr-SP.module.js +0 -8
- package/dist/sr-SP.module.js.map +0 -1
- package/dist/sv-SE.main.js +0 -6
- package/dist/sv-SE.main.js.map +0 -1
- package/dist/sv-SE.mjs +0 -8
- package/dist/sv-SE.module.js +0 -8
- package/dist/sv-SE.module.js.map +0 -1
- package/dist/tr-TR.main.js +0 -6
- package/dist/tr-TR.main.js.map +0 -1
- package/dist/tr-TR.mjs +0 -8
- package/dist/tr-TR.module.js +0 -8
- package/dist/tr-TR.module.js.map +0 -1
- package/dist/types.d.ts +0 -355
- package/dist/types.d.ts.map +0 -1
- package/dist/uk-UA.main.js +0 -6
- package/dist/uk-UA.main.js.map +0 -1
- package/dist/uk-UA.mjs +0 -8
- package/dist/uk-UA.module.js +0 -8
- package/dist/uk-UA.module.js.map +0 -1
- package/dist/useCloseOnScroll.main.js +0 -52
- package/dist/useCloseOnScroll.main.js.map +0 -1
- package/dist/useCloseOnScroll.mjs +0 -46
- package/dist/useCloseOnScroll.module.js +0 -46
- package/dist/useCloseOnScroll.module.js.map +0 -1
- package/dist/useModal.main.js +0 -118
- package/dist/useModal.main.js.map +0 -1
- package/dist/useModal.mjs +0 -105
- package/dist/useModal.module.js +0 -105
- package/dist/useModal.module.js.map +0 -1
- package/dist/useModalOverlay.main.js +0 -57
- package/dist/useModalOverlay.main.js.map +0 -1
- package/dist/useModalOverlay.mjs +0 -52
- package/dist/useModalOverlay.module.js +0 -52
- package/dist/useModalOverlay.module.js.map +0 -1
- package/dist/useOverlay.main.js +0 -113
- package/dist/useOverlay.main.js.map +0 -1
- package/dist/useOverlay.mjs +0 -108
- package/dist/useOverlay.module.js +0 -108
- package/dist/useOverlay.module.js.map +0 -1
- package/dist/useOverlayPosition.main.js +0 -226
- package/dist/useOverlayPosition.main.js.map +0 -1
- package/dist/useOverlayPosition.mjs +0 -221
- package/dist/useOverlayPosition.module.js +0 -221
- package/dist/useOverlayPosition.module.js.map +0 -1
- package/dist/useOverlayTrigger.main.js +0 -54
- package/dist/useOverlayTrigger.main.js.map +0 -1
- package/dist/useOverlayTrigger.mjs +0 -49
- package/dist/useOverlayTrigger.module.js +0 -49
- package/dist/useOverlayTrigger.module.js.map +0 -1
- package/dist/usePopover.main.js +0 -77
- package/dist/usePopover.main.js.map +0 -1
- package/dist/usePopover.mjs +0 -72
- package/dist/usePopover.module.js +0 -72
- package/dist/usePopover.module.js.map +0 -1
- package/dist/usePreventScroll.main.js +0 -220
- package/dist/usePreventScroll.main.js.map +0 -1
- package/dist/usePreventScroll.mjs +0 -215
- package/dist/usePreventScroll.module.js +0 -215
- package/dist/usePreventScroll.module.js.map +0 -1
- package/dist/zh-CN.main.js +0 -6
- package/dist/zh-CN.main.js.map +0 -1
- package/dist/zh-CN.mjs +0 -8
- package/dist/zh-CN.module.js +0 -8
- package/dist/zh-CN.module.js.map +0 -1
- package/dist/zh-TW.main.js +0 -6
- package/dist/zh-TW.main.js.map +0 -1
- package/dist/zh-TW.mjs +0 -8
- package/dist/zh-TW.module.js +0 -8
- package/dist/zh-TW.module.js.map +0 -1
- package/src/DismissButton.tsx +0 -52
- package/src/Overlay.tsx +0 -95
- package/src/PortalProvider.tsx +0 -41
- package/src/ariaHideOutside.ts +0 -300
- package/src/calculatePosition.ts +0 -702
- package/src/useCloseOnScroll.ts +0 -65
- package/src/useModal.tsx +0 -197
- package/src/useModalOverlay.ts +0 -69
- package/src/useOverlay.ts +0 -170
- package/src/useOverlayPosition.ts +0 -328
- package/src/useOverlayTrigger.ts +0 -72
- package/src/usePopover.ts +0 -138
- package/src/usePreventScroll.ts +0 -279
package/dist/Overlay.mjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {useUNSAFE_PortalContext as $96b38030c423d352$export$9fc1347d4195ccb3} from "./PortalProvider.mjs";
|
|
2
|
-
import {ClearPressResponder as $1CM7W$ClearPressResponder} from "@react-aria/interactions";
|
|
3
|
-
import {FocusScope as $1CM7W$FocusScope} from "@react-aria/focus";
|
|
4
|
-
import $1CM7W$react, {useState as $1CM7W$useState, useMemo as $1CM7W$useMemo, useContext as $1CM7W$useContext} from "react";
|
|
5
|
-
import $1CM7W$reactdom from "react-dom";
|
|
6
|
-
import {useIsSSR as $1CM7W$useIsSSR} from "@react-aria/ssr";
|
|
7
|
-
import {useLayoutEffect as $1CM7W$useLayoutEffect} from "@react-aria/utils";
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Copyright 2022 Adobe. All rights reserved.
|
|
11
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
13
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
16
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
17
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
|
-
* governing permissions and limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const $337b884510726a0d$export$a2200b96afd16271 = /*#__PURE__*/ (0, $1CM7W$react).createContext(null);
|
|
27
|
-
function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
|
|
28
|
-
let isSSR = (0, $1CM7W$useIsSSR)();
|
|
29
|
-
let { portalContainer: portalContainer = isSSR ? null : document.body, isExiting: isExiting } = props;
|
|
30
|
-
let [contain, setContain] = (0, $1CM7W$useState)(false);
|
|
31
|
-
let contextValue = (0, $1CM7W$useMemo)(()=>({
|
|
32
|
-
contain: contain,
|
|
33
|
-
setContain: setContain
|
|
34
|
-
}), [
|
|
35
|
-
contain,
|
|
36
|
-
setContain
|
|
37
|
-
]);
|
|
38
|
-
let { getContainer: getContainer } = (0, $96b38030c423d352$export$9fc1347d4195ccb3)();
|
|
39
|
-
if (!props.portalContainer && getContainer) portalContainer = getContainer();
|
|
40
|
-
if (!portalContainer) return null;
|
|
41
|
-
let contents = props.children;
|
|
42
|
-
if (!props.disableFocusManagement) contents = /*#__PURE__*/ (0, $1CM7W$react).createElement((0, $1CM7W$FocusScope), {
|
|
43
|
-
restoreFocus: true,
|
|
44
|
-
contain: (props.shouldContainFocus || contain) && !isExiting
|
|
45
|
-
}, contents);
|
|
46
|
-
contents = /*#__PURE__*/ (0, $1CM7W$react).createElement($337b884510726a0d$export$a2200b96afd16271.Provider, {
|
|
47
|
-
value: contextValue
|
|
48
|
-
}, /*#__PURE__*/ (0, $1CM7W$react).createElement((0, $1CM7W$ClearPressResponder), null, contents));
|
|
49
|
-
return /*#__PURE__*/ (0, $1CM7W$reactdom).createPortal(contents, portalContainer);
|
|
50
|
-
}
|
|
51
|
-
function $337b884510726a0d$export$14c98a7594375490() {
|
|
52
|
-
let ctx = (0, $1CM7W$useContext)($337b884510726a0d$export$a2200b96afd16271);
|
|
53
|
-
let setContain = ctx === null || ctx === void 0 ? void 0 : ctx.setContain;
|
|
54
|
-
(0, $1CM7W$useLayoutEffect)(()=>{
|
|
55
|
-
setContain === null || setContain === void 0 ? void 0 : setContain(true);
|
|
56
|
-
}, [
|
|
57
|
-
setContain
|
|
58
|
-
]);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
export {$337b884510726a0d$export$a2200b96afd16271 as OverlayContext, $337b884510726a0d$export$c6fdb837b070b4ff as Overlay, $337b884510726a0d$export$14c98a7594375490 as useOverlayFocusContain};
|
|
63
|
-
//# sourceMappingURL=Overlay.module.js.map
|
package/dist/Overlay.module.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {useUNSAFE_PortalContext as $96b38030c423d352$export$9fc1347d4195ccb3} from "./PortalProvider.module.js";
|
|
2
|
-
import {ClearPressResponder as $1CM7W$ClearPressResponder} from "@react-aria/interactions";
|
|
3
|
-
import {FocusScope as $1CM7W$FocusScope} from "@react-aria/focus";
|
|
4
|
-
import $1CM7W$react, {useState as $1CM7W$useState, useMemo as $1CM7W$useMemo, useContext as $1CM7W$useContext} from "react";
|
|
5
|
-
import $1CM7W$reactdom from "react-dom";
|
|
6
|
-
import {useIsSSR as $1CM7W$useIsSSR} from "@react-aria/ssr";
|
|
7
|
-
import {useLayoutEffect as $1CM7W$useLayoutEffect} from "@react-aria/utils";
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Copyright 2022 Adobe. All rights reserved.
|
|
11
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
13
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
16
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
17
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
|
-
* governing permissions and limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const $337b884510726a0d$export$a2200b96afd16271 = /*#__PURE__*/ (0, $1CM7W$react).createContext(null);
|
|
27
|
-
function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
|
|
28
|
-
let isSSR = (0, $1CM7W$useIsSSR)();
|
|
29
|
-
let { portalContainer: portalContainer = isSSR ? null : document.body, isExiting: isExiting } = props;
|
|
30
|
-
let [contain, setContain] = (0, $1CM7W$useState)(false);
|
|
31
|
-
let contextValue = (0, $1CM7W$useMemo)(()=>({
|
|
32
|
-
contain: contain,
|
|
33
|
-
setContain: setContain
|
|
34
|
-
}), [
|
|
35
|
-
contain,
|
|
36
|
-
setContain
|
|
37
|
-
]);
|
|
38
|
-
let { getContainer: getContainer } = (0, $96b38030c423d352$export$9fc1347d4195ccb3)();
|
|
39
|
-
if (!props.portalContainer && getContainer) portalContainer = getContainer();
|
|
40
|
-
if (!portalContainer) return null;
|
|
41
|
-
let contents = props.children;
|
|
42
|
-
if (!props.disableFocusManagement) contents = /*#__PURE__*/ (0, $1CM7W$react).createElement((0, $1CM7W$FocusScope), {
|
|
43
|
-
restoreFocus: true,
|
|
44
|
-
contain: (props.shouldContainFocus || contain) && !isExiting
|
|
45
|
-
}, contents);
|
|
46
|
-
contents = /*#__PURE__*/ (0, $1CM7W$react).createElement($337b884510726a0d$export$a2200b96afd16271.Provider, {
|
|
47
|
-
value: contextValue
|
|
48
|
-
}, /*#__PURE__*/ (0, $1CM7W$react).createElement((0, $1CM7W$ClearPressResponder), null, contents));
|
|
49
|
-
return /*#__PURE__*/ (0, $1CM7W$reactdom).createPortal(contents, portalContainer);
|
|
50
|
-
}
|
|
51
|
-
function $337b884510726a0d$export$14c98a7594375490() {
|
|
52
|
-
let ctx = (0, $1CM7W$useContext)($337b884510726a0d$export$a2200b96afd16271);
|
|
53
|
-
let setContain = ctx === null || ctx === void 0 ? void 0 : ctx.setContain;
|
|
54
|
-
(0, $1CM7W$useLayoutEffect)(()=>{
|
|
55
|
-
setContain === null || setContain === void 0 ? void 0 : setContain(true);
|
|
56
|
-
}, [
|
|
57
|
-
setContain
|
|
58
|
-
]);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
export {$337b884510726a0d$export$a2200b96afd16271 as OverlayContext, $337b884510726a0d$export$c6fdb837b070b4ff as Overlay, $337b884510726a0d$export$14c98a7594375490 as useOverlayFocusContain};
|
|
63
|
-
//# sourceMappingURL=Overlay.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAmCM,MAAM,0DACX,CAAA,GAAA,YAAI,EAAE,aAAa,CAAuF;AAMrG,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.Context<{contain: boolean, setContain: React.Dispatch<React.SetStateAction<boolean>>} | null> =\n 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,41 +0,0 @@
|
|
|
1
|
-
var $b2rU6$react = require("react");
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function $parcel$interopDefault(a) {
|
|
5
|
-
return a && a.__esModule ? a.default : a;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function $parcel$export(e, n, v, s) {
|
|
9
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
$parcel$export(module.exports, "UNSAFE_PortalProvider", () => $d7347c25ab757295$export$78efe591171d7d45);
|
|
13
|
-
$parcel$export(module.exports, "useUNSAFE_PortalContext", () => $d7347c25ab757295$export$9fc1347d4195ccb3);
|
|
14
|
-
/*
|
|
15
|
-
* Copyright 2024 Adobe. All rights reserved.
|
|
16
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
*
|
|
20
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
-
* governing permissions and limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
const $d7347c25ab757295$export$60d741e20e0aa309 = /*#__PURE__*/ (0, $b2rU6$react.createContext)({});
|
|
26
|
-
function $d7347c25ab757295$export$78efe591171d7d45(props) {
|
|
27
|
-
let { getContainer: getContainer } = props;
|
|
28
|
-
let { getContainer: ctxGetContainer } = $d7347c25ab757295$export$9fc1347d4195ccb3();
|
|
29
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($b2rU6$react))).createElement($d7347c25ab757295$export$60d741e20e0aa309.Provider, {
|
|
30
|
-
value: {
|
|
31
|
-
getContainer: getContainer === null ? undefined : getContainer !== null && getContainer !== void 0 ? getContainer : ctxGetContainer
|
|
32
|
-
}
|
|
33
|
-
}, props.children);
|
|
34
|
-
}
|
|
35
|
-
function $d7347c25ab757295$export$9fc1347d4195ccb3() {
|
|
36
|
-
var _useContext;
|
|
37
|
-
return (_useContext = (0, $b2rU6$react.useContext)($d7347c25ab757295$export$60d741e20e0aa309)) !== null && _useContext !== void 0 ? _useContext : {};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=PortalProvider.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAaM,MAAM,0DAA2D,CAAA,GAAA,0BAAY,EAA8B,CAAC;AAK5G,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: React.Context<PortalProviderContextValue> = 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"}
|
package/dist/PortalProvider.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import $7yuSY$react, {createContext as $7yuSY$createContext, useContext as $7yuSY$useContext} from "react";
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright 2024 Adobe. All rights reserved.
|
|
5
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
-
* governing permissions and limitations under the License.
|
|
13
|
-
*/
|
|
14
|
-
const $96b38030c423d352$export$60d741e20e0aa309 = /*#__PURE__*/ (0, $7yuSY$createContext)({});
|
|
15
|
-
function $96b38030c423d352$export$78efe591171d7d45(props) {
|
|
16
|
-
let { getContainer: getContainer } = props;
|
|
17
|
-
let { getContainer: ctxGetContainer } = $96b38030c423d352$export$9fc1347d4195ccb3();
|
|
18
|
-
return /*#__PURE__*/ (0, $7yuSY$react).createElement($96b38030c423d352$export$60d741e20e0aa309.Provider, {
|
|
19
|
-
value: {
|
|
20
|
-
getContainer: getContainer === null ? undefined : getContainer !== null && getContainer !== void 0 ? getContainer : ctxGetContainer
|
|
21
|
-
}
|
|
22
|
-
}, props.children);
|
|
23
|
-
}
|
|
24
|
-
function $96b38030c423d352$export$9fc1347d4195ccb3() {
|
|
25
|
-
var _useContext;
|
|
26
|
-
return (_useContext = (0, $7yuSY$useContext)($96b38030c423d352$export$60d741e20e0aa309)) !== null && _useContext !== void 0 ? _useContext : {};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export {$96b38030c423d352$export$60d741e20e0aa309 as PortalContext, $96b38030c423d352$export$78efe591171d7d45 as UNSAFE_PortalProvider, $96b38030c423d352$export$9fc1347d4195ccb3 as useUNSAFE_PortalContext};
|
|
31
|
-
//# sourceMappingURL=PortalProvider.module.js.map
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import $7yuSY$react, {createContext as $7yuSY$createContext, useContext as $7yuSY$useContext} from "react";
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright 2024 Adobe. All rights reserved.
|
|
5
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
-
* governing permissions and limitations under the License.
|
|
13
|
-
*/
|
|
14
|
-
const $96b38030c423d352$export$60d741e20e0aa309 = /*#__PURE__*/ (0, $7yuSY$createContext)({});
|
|
15
|
-
function $96b38030c423d352$export$78efe591171d7d45(props) {
|
|
16
|
-
let { getContainer: getContainer } = props;
|
|
17
|
-
let { getContainer: ctxGetContainer } = $96b38030c423d352$export$9fc1347d4195ccb3();
|
|
18
|
-
return /*#__PURE__*/ (0, $7yuSY$react).createElement($96b38030c423d352$export$60d741e20e0aa309.Provider, {
|
|
19
|
-
value: {
|
|
20
|
-
getContainer: getContainer === null ? undefined : getContainer !== null && getContainer !== void 0 ? getContainer : ctxGetContainer
|
|
21
|
-
}
|
|
22
|
-
}, props.children);
|
|
23
|
-
}
|
|
24
|
-
function $96b38030c423d352$export$9fc1347d4195ccb3() {
|
|
25
|
-
var _useContext;
|
|
26
|
-
return (_useContext = (0, $7yuSY$useContext)($96b38030c423d352$export$60d741e20e0aa309)) !== null && _useContext !== void 0 ? _useContext : {};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export {$96b38030c423d352$export$60d741e20e0aa309 as PortalContext, $96b38030c423d352$export$78efe591171d7d45 as UNSAFE_PortalProvider, $96b38030c423d352$export$9fc1347d4195ccb3 as useUNSAFE_PortalContext};
|
|
31
|
-
//# sourceMappingURL=PortalProvider.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAaM,MAAM,0DAA2D,CAAA,GAAA,oBAAY,EAA8B,CAAC;AAK5G,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: React.Context<PortalProviderContextValue> = 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/ar-AE.main.js
DELETED
package/dist/ar-AE.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,mCAAK,CAAC;AACtC","sources":["packages/@react-aria/overlays/intl/ar-AE.json"],"sourcesContent":["{\n \"dismiss\": \"تجاهل\"\n}\n"],"names":[],"version":3,"file":"ar-AE.main.js.map"}
|
package/dist/ar-AE.mjs
DELETED
package/dist/ar-AE.module.js
DELETED
package/dist/ar-AE.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,mCAAK,CAAC;AACtC","sources":["packages/@react-aria/overlays/intl/ar-AE.json"],"sourcesContent":["{\n \"dismiss\": \"تجاهل\"\n}\n"],"names":[],"version":3,"file":"ar-AE.module.js.map"}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
var $4MDXc$reactariautils = require("@react-aria/utils");
|
|
2
|
-
var $4MDXc$reactstatelyflags = require("@react-stately/flags");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function $parcel$export(e, n, v, s) {
|
|
6
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
$parcel$export(module.exports, "ariaHideOutside", () => $08ef1685902b6011$export$1c3ebcada18427bf);
|
|
10
|
-
$parcel$export(module.exports, "keepVisible", () => $08ef1685902b6011$export$1020fa7f77e17884);
|
|
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
|
-
const $08ef1685902b6011$var$supportsInert = typeof HTMLElement !== 'undefined' && 'inert' in HTMLElement.prototype;
|
|
24
|
-
// Keeps a ref count of all hidden elements. Added to when hiding an element, and
|
|
25
|
-
// subtracted from when showing it again. When it reaches zero, aria-hidden is removed.
|
|
26
|
-
let $08ef1685902b6011$var$refCountMap = new WeakMap();
|
|
27
|
-
let $08ef1685902b6011$var$observerStack = [];
|
|
28
|
-
function $08ef1685902b6011$export$1c3ebcada18427bf(targets, options) {
|
|
29
|
-
let windowObj = (0, $4MDXc$reactariautils.getOwnerWindow)(targets === null || targets === void 0 ? void 0 : targets[0]);
|
|
30
|
-
let opts = options instanceof windowObj.Element ? {
|
|
31
|
-
root: options
|
|
32
|
-
} : options;
|
|
33
|
-
var _opts_root;
|
|
34
|
-
let root = (_opts_root = opts === null || opts === void 0 ? void 0 : opts.root) !== null && _opts_root !== void 0 ? _opts_root : document.body;
|
|
35
|
-
let shouldUseInert = (opts === null || opts === void 0 ? void 0 : opts.shouldUseInert) && $08ef1685902b6011$var$supportsInert;
|
|
36
|
-
let visibleNodes = new Set(targets);
|
|
37
|
-
let hiddenNodes = new Set();
|
|
38
|
-
let getHidden = (element)=>{
|
|
39
|
-
return shouldUseInert && element instanceof windowObj.HTMLElement ? element.inert : element.getAttribute('aria-hidden') === 'true';
|
|
40
|
-
};
|
|
41
|
-
let setHidden = (element, hidden)=>{
|
|
42
|
-
if (shouldUseInert && element instanceof windowObj.HTMLElement) element.inert = hidden;
|
|
43
|
-
else if (hidden) element.setAttribute('aria-hidden', 'true');
|
|
44
|
-
else {
|
|
45
|
-
element.removeAttribute('aria-hidden');
|
|
46
|
-
if (element instanceof windowObj.HTMLElement) // We only ever call setHidden with hidden = false when the nodeCount is 1 aka
|
|
47
|
-
// we are trying to make the element visible to screen readers again, so remove inert as well
|
|
48
|
-
element.inert = false;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
let shadowRootsToWatch = new Set();
|
|
52
|
-
if ((0, $4MDXc$reactstatelyflags.shadowDOM)()) // find all shadow roots that are ancestors of the targets
|
|
53
|
-
// traverse upwards until the root is reached
|
|
54
|
-
for (let target of targets){
|
|
55
|
-
let node = target;
|
|
56
|
-
while(node && node !== root){
|
|
57
|
-
let root = node.getRootNode();
|
|
58
|
-
if ('shadowRoot' in root) shadowRootsToWatch.add(root.shadowRoot);
|
|
59
|
-
node = root.parentNode;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
let walk = (root)=>{
|
|
63
|
-
// Keep live announcer and top layer elements (e.g. toasts) visible.
|
|
64
|
-
for (let element of root.querySelectorAll('[data-live-announcer], [data-react-aria-top-layer]'))visibleNodes.add(element);
|
|
65
|
-
let acceptNode = (node)=>{
|
|
66
|
-
// Skip this node and its children if it is one of the target nodes, or a live announcer.
|
|
67
|
-
// Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
|
|
68
|
-
// made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
|
|
69
|
-
// For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
|
|
70
|
-
if (hiddenNodes.has(node) || visibleNodes.has(node) || node.parentElement && hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== 'row') return NodeFilter.FILTER_REJECT;
|
|
71
|
-
// Skip this node but continue to children if one of the targets is inside the node.
|
|
72
|
-
for (let target of visibleNodes){
|
|
73
|
-
if ((0, $4MDXc$reactariautils.nodeContains)(node, target)) return NodeFilter.FILTER_SKIP;
|
|
74
|
-
}
|
|
75
|
-
return NodeFilter.FILTER_ACCEPT;
|
|
76
|
-
};
|
|
77
|
-
let walker = (0, $4MDXc$reactariautils.createShadowTreeWalker)((0, $4MDXc$reactariautils.getOwnerDocument)(root), root, NodeFilter.SHOW_ELEMENT, {
|
|
78
|
-
acceptNode: acceptNode
|
|
79
|
-
});
|
|
80
|
-
// TreeWalker does not include the root.
|
|
81
|
-
let acceptRoot = acceptNode(root);
|
|
82
|
-
if (acceptRoot === NodeFilter.FILTER_ACCEPT) hide(root);
|
|
83
|
-
if (acceptRoot !== NodeFilter.FILTER_REJECT) {
|
|
84
|
-
let node = walker.nextNode();
|
|
85
|
-
while(node != null){
|
|
86
|
-
hide(node);
|
|
87
|
-
node = walker.nextNode();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
let hide = (node)=>{
|
|
92
|
-
var _refCountMap_get;
|
|
93
|
-
let refCount = (_refCountMap_get = $08ef1685902b6011$var$refCountMap.get(node)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
|
|
94
|
-
// If already aria-hidden, and the ref count is zero, then this element
|
|
95
|
-
// was already hidden and there's nothing for us to do.
|
|
96
|
-
if (getHidden(node) && refCount === 0) return;
|
|
97
|
-
if (refCount === 0) setHidden(node, true);
|
|
98
|
-
hiddenNodes.add(node);
|
|
99
|
-
$08ef1685902b6011$var$refCountMap.set(node, refCount + 1);
|
|
100
|
-
};
|
|
101
|
-
// If there is already a MutationObserver listening from a previous call,
|
|
102
|
-
// disconnect it so the new on takes over.
|
|
103
|
-
if ($08ef1685902b6011$var$observerStack.length) $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1].disconnect();
|
|
104
|
-
walk(root);
|
|
105
|
-
let observer = new MutationObserver((changes)=>{
|
|
106
|
-
for (let change of changes){
|
|
107
|
-
if (change.type !== 'childList') continue;
|
|
108
|
-
// If the parent element of the added nodes is not within one of the targets,
|
|
109
|
-
// and not already inside a hidden node, hide all of the new children.
|
|
110
|
-
if (change.target.isConnected && ![
|
|
111
|
-
...visibleNodes,
|
|
112
|
-
...hiddenNodes
|
|
113
|
-
].some((node)=>(0, $4MDXc$reactariautils.nodeContains)(node, change.target))) for (let node of change.addedNodes){
|
|
114
|
-
if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === 'true' || node.dataset.reactAriaTopLayer === 'true')) visibleNodes.add(node);
|
|
115
|
-
else if (node instanceof Element) walk(node);
|
|
116
|
-
}
|
|
117
|
-
if ((0, $4MDXc$reactstatelyflags.shadowDOM)()) {
|
|
118
|
-
// if any of the observed shadow roots were removed, stop observing them
|
|
119
|
-
for (let shadowRoot of shadowRootsToWatch)if (!shadowRoot.isConnected) {
|
|
120
|
-
observer.disconnect();
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
observer.observe(root, {
|
|
127
|
-
childList: true,
|
|
128
|
-
subtree: true
|
|
129
|
-
});
|
|
130
|
-
let shadowObservers = new Set();
|
|
131
|
-
if ((0, $4MDXc$reactstatelyflags.shadowDOM)()) for (let shadowRoot of shadowRootsToWatch){
|
|
132
|
-
// Disconnect single target instead of all https://github.com/whatwg/dom/issues/126
|
|
133
|
-
let shadowObserver = new MutationObserver((changes)=>{
|
|
134
|
-
for (let change of changes){
|
|
135
|
-
if (change.type !== 'childList') continue;
|
|
136
|
-
// If the parent element of the added nodes is not within one of the targets,
|
|
137
|
-
// and not already inside a hidden node, hide all of the new children.
|
|
138
|
-
if (change.target.isConnected && ![
|
|
139
|
-
...visibleNodes,
|
|
140
|
-
...hiddenNodes
|
|
141
|
-
].some((node)=>(0, $4MDXc$reactariautils.nodeContains)(node, change.target))) for (let node of change.addedNodes){
|
|
142
|
-
if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === 'true' || node.dataset.reactAriaTopLayer === 'true')) visibleNodes.add(node);
|
|
143
|
-
else if (node instanceof Element) walk(node);
|
|
144
|
-
}
|
|
145
|
-
if ((0, $4MDXc$reactstatelyflags.shadowDOM)()) {
|
|
146
|
-
// if any of the observed shadow roots were removed, stop observing them
|
|
147
|
-
for (let shadowRoot of shadowRootsToWatch)if (!shadowRoot.isConnected) {
|
|
148
|
-
observer.disconnect();
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
shadowObserver.observe(shadowRoot, {
|
|
155
|
-
childList: true,
|
|
156
|
-
subtree: true
|
|
157
|
-
});
|
|
158
|
-
shadowObservers.add(shadowObserver);
|
|
159
|
-
}
|
|
160
|
-
let observerWrapper = {
|
|
161
|
-
visibleNodes: visibleNodes,
|
|
162
|
-
hiddenNodes: hiddenNodes,
|
|
163
|
-
observe () {
|
|
164
|
-
observer.observe(root, {
|
|
165
|
-
childList: true,
|
|
166
|
-
subtree: true
|
|
167
|
-
});
|
|
168
|
-
},
|
|
169
|
-
disconnect () {
|
|
170
|
-
observer.disconnect();
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
$08ef1685902b6011$var$observerStack.push(observerWrapper);
|
|
174
|
-
return ()=>{
|
|
175
|
-
observer.disconnect();
|
|
176
|
-
if ((0, $4MDXc$reactstatelyflags.shadowDOM)()) for (let shadowObserver of shadowObservers)shadowObserver.disconnect();
|
|
177
|
-
for (let node of hiddenNodes){
|
|
178
|
-
let count = $08ef1685902b6011$var$refCountMap.get(node);
|
|
179
|
-
if (count == null) continue;
|
|
180
|
-
if (count === 1) {
|
|
181
|
-
setHidden(node, false);
|
|
182
|
-
$08ef1685902b6011$var$refCountMap.delete(node);
|
|
183
|
-
} else $08ef1685902b6011$var$refCountMap.set(node, count - 1);
|
|
184
|
-
}
|
|
185
|
-
// Remove this observer from the stack, and start the previous one.
|
|
186
|
-
if (observerWrapper === $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1]) {
|
|
187
|
-
$08ef1685902b6011$var$observerStack.pop();
|
|
188
|
-
if ($08ef1685902b6011$var$observerStack.length) $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1].observe();
|
|
189
|
-
} else $08ef1685902b6011$var$observerStack.splice($08ef1685902b6011$var$observerStack.indexOf(observerWrapper), 1);
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
function $08ef1685902b6011$export$1020fa7f77e17884(element) {
|
|
193
|
-
let observer = $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1];
|
|
194
|
-
if (observer && !observer.visibleNodes.has(element)) {
|
|
195
|
-
observer.visibleNodes.add(element);
|
|
196
|
-
return ()=>{
|
|
197
|
-
observer.visibleNodes.delete(element);
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
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AG,EAAE,CAAC,OAAO;QAEnD,OACE,oCAAc,MAAM,CAAC,oCAAc,OAAO,CAAC,kBAAkB;IAEjE;AACF;AAEO,SAAS,0CAAY,OAAgB;IAC1C,IAAI,WAAW,mCAAa,CAAC,oCAAc,MAAM,GAAG,EAAE;IACtD,IAAI,YAAY,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC,UAAU;QACnD,SAAS,YAAY,CAAC,GAAG,CAAC;QAC1B,OAAO;YACL,SAAS,YAAY,CAAC,MAAM,CAAC;QAC/B;IACF;AACF","sources":["packages/@react-aria/overlays/src/ariaHideOutside.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {createShadowTreeWalker, getOwnerDocument, getOwnerWindow, nodeContains} from '@react-aria/utils';\nimport {shadowDOM} from '@react-stately/flags';\n\nconst supportsInert = typeof HTMLElement !== 'undefined' && 'inert' in HTMLElement.prototype;\n\ninterface AriaHideOutsideOptions {\n root?: Element,\n shouldUseInert?: boolean\n}\n\n// Keeps a ref count of all hidden elements. Added to when hiding an element, and\n// subtracted from when showing it again. When it reaches zero, aria-hidden is removed.\nlet refCountMap = new WeakMap<Element, number>();\ninterface ObserverWrapper {\n visibleNodes: Set<Element>,\n hiddenNodes: Set<Element>,\n observe: () => void,\n disconnect: () => void\n}\nlet observerStack: Array<ObserverWrapper> = [];\n\n/**\n * Hides all elements in the DOM outside the given targets from screen readers using aria-hidden,\n * and returns a function to revert these changes. In addition, changes to the DOM are watched\n * and new elements outside the targets are automatically hidden.\n * @param targets - The elements that should remain visible.\n * @param root - Nothing will be hidden above this element.\n * @returns - A function to restore all hidden elements.\n */\nexport function ariaHideOutside(targets: Element[], options?: AriaHideOutsideOptions | Element) {\n let windowObj = getOwnerWindow(targets?.[0]);\n let opts = options instanceof windowObj.Element ? {root: options} : options;\n let root = opts?.root ?? document.body;\n let shouldUseInert = opts?.shouldUseInert && supportsInert;\n let visibleNodes = new Set<Element>(targets);\n let hiddenNodes = new Set<Element>();\n\n let getHidden = (element: Element) => {\n return shouldUseInert && element instanceof windowObj.HTMLElement ? element.inert : element.getAttribute('aria-hidden') === 'true';\n };\n\n let setHidden = (element: Element, hidden: boolean) => {\n if (shouldUseInert && element instanceof windowObj.HTMLElement) {\n element.inert = hidden;\n } else if (hidden) {\n element.setAttribute('aria-hidden', 'true');\n } else {\n element.removeAttribute('aria-hidden');\n if (element instanceof windowObj.HTMLElement) {\n // We only ever call setHidden with hidden = false when the nodeCount is 1 aka\n // we are trying to make the element visible to screen readers again, so remove inert as well\n element.inert = false;\n }\n }\n };\n\n let shadowRootsToWatch = new Set<ShadowRoot>();\n if (shadowDOM()) {\n // find all shadow roots that are ancestors of the targets\n // traverse upwards until the root is reached\n for (let target of targets) {\n let node = target;\n while (node && node !== root) {\n let root = node.getRootNode();\n if ('shadowRoot' in root) {\n shadowRootsToWatch.add(root.shadowRoot as ShadowRoot);\n }\n node = root.parentNode as Element;\n }\n }\n }\n\n let walk = (root: Element) => {\n // Keep live announcer and top layer elements (e.g. toasts) visible.\n for (let element of root.querySelectorAll('[data-live-announcer], [data-react-aria-top-layer]')) {\n visibleNodes.add(element);\n }\n\n let acceptNode = (node: Element) => {\n // Skip this node and its children if it is one of the target nodes, or a live announcer.\n // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is\n // made for elements with role=\"row\" since VoiceOver on iOS has issues hiding elements with role=\"row\".\n // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).\n if (\n hiddenNodes.has(node) ||\n visibleNodes.has(node) ||\n (node.parentElement && hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== 'row')\n ) {\n return NodeFilter.FILTER_REJECT;\n }\n\n // Skip this node but continue to children if one of the targets is inside the node.\n for (let target of visibleNodes) {\n if (nodeContains(node, target)) {\n return NodeFilter.FILTER_SKIP;\n }\n }\n\n return NodeFilter.FILTER_ACCEPT;\n };\n\n let walker = createShadowTreeWalker(\n getOwnerDocument(root),\n root,\n NodeFilter.SHOW_ELEMENT,\n {acceptNode}\n );\n\n // TreeWalker does not include the root.\n let acceptRoot = acceptNode(root);\n if (acceptRoot === NodeFilter.FILTER_ACCEPT) {\n hide(root);\n }\n\n if (acceptRoot !== NodeFilter.FILTER_REJECT) {\n let node = walker.nextNode() as Element;\n while (node != null) {\n hide(node);\n node = walker.nextNode() as Element;\n }\n }\n };\n\n let hide = (node: Element) => {\n let refCount = refCountMap.get(node) ?? 0;\n\n // If already aria-hidden, and the ref count is zero, then this element\n // was already hidden and there's nothing for us to do.\n if (getHidden(node) && refCount === 0) {\n return;\n }\n\n if (refCount === 0) {\n setHidden(node, true);\n }\n\n hiddenNodes.add(node);\n refCountMap.set(node, refCount + 1);\n };\n\n // If there is already a MutationObserver listening from a previous call,\n // disconnect it so the new on takes over.\n if (observerStack.length) {\n observerStack[observerStack.length - 1].disconnect();\n }\n\n walk(root);\n\n let observer = new MutationObserver(changes => {\n for (let change of changes) {\n if (change.type !== 'childList') {\n continue;\n }\n\n // If the parent element of the added nodes is not within one of the targets,\n // and not already inside a hidden node, hide all of the new children.\n if (\n change.target.isConnected &&\n ![...visibleNodes, ...hiddenNodes].some((node) =>\n nodeContains(node, change.target)\n )\n ) {\n for (let node of change.addedNodes) {\n if (\n (node instanceof HTMLElement || node instanceof SVGElement) &&\n (node.dataset.liveAnnouncer === 'true' || node.dataset.reactAriaTopLayer === 'true')\n ) {\n visibleNodes.add(node);\n } else if (node instanceof Element) {\n walk(node);\n }\n }\n }\n\n if (shadowDOM()) {\n // if any of the observed shadow roots were removed, stop observing them\n for (let shadowRoot of shadowRootsToWatch) {\n if (!shadowRoot.isConnected) {\n observer.disconnect();\n break;\n }\n }\n }\n }\n });\n\n observer.observe(root, {childList: true, subtree: true});\n let shadowObservers = new Set<MutationObserver>();\n if (shadowDOM()) {\n for (let shadowRoot of shadowRootsToWatch) {\n // Disconnect single target instead of all https://github.com/whatwg/dom/issues/126\n let shadowObserver = new MutationObserver(changes => {\n for (let change of changes) {\n if (change.type !== 'childList') {\n continue;\n }\n\n // If the parent element of the added nodes is not within one of the targets,\n // and not already inside a hidden node, hide all of the new children.\n if (\n change.target.isConnected &&\n ![...visibleNodes, ...hiddenNodes].some((node) =>\n nodeContains(node, change.target)\n )\n ) {\n for (let node of change.addedNodes) {\n if (\n (node instanceof HTMLElement || node instanceof SVGElement) &&\n (node.dataset.liveAnnouncer === 'true' || node.dataset.reactAriaTopLayer === 'true')\n ) {\n visibleNodes.add(node);\n } else if (node instanceof Element) {\n walk(node);\n }\n }\n }\n\n if (shadowDOM()) {\n // if any of the observed shadow roots were removed, stop observing them\n for (let shadowRoot of shadowRootsToWatch) {\n if (!shadowRoot.isConnected) {\n observer.disconnect();\n break;\n }\n }\n }\n }\n });\n shadowObserver.observe(shadowRoot, {childList: true, subtree: true});\n shadowObservers.add(shadowObserver);\n }\n }\n\n let observerWrapper: ObserverWrapper = {\n visibleNodes,\n hiddenNodes,\n observe() {\n observer.observe(root, {childList: true, subtree: true});\n },\n disconnect() {\n observer.disconnect();\n }\n };\n\n observerStack.push(observerWrapper);\n\n return (): void => {\n observer.disconnect();\n if (shadowDOM()) {\n for (let shadowObserver of shadowObservers) {\n shadowObserver.disconnect();\n }\n }\n\n for (let node of hiddenNodes) {\n let count = refCountMap.get(node);\n if (count == null) {\n continue;\n }\n if (count === 1) {\n setHidden(node, false);\n refCountMap.delete(node);\n } else {\n refCountMap.set(node, count - 1);\n }\n }\n\n // Remove this observer from the stack, and start the previous one.\n if (observerWrapper === observerStack[observerStack.length - 1]) {\n observerStack.pop();\n if (observerStack.length) {\n observerStack[observerStack.length - 1].observe();\n }\n } else {\n observerStack.splice(observerStack.indexOf(observerWrapper), 1);\n }\n };\n}\n\nexport function keepVisible(element: Element): (() => void) | undefined {\n let observer = observerStack[observerStack.length - 1];\n if (observer && !observer.visibleNodes.has(element)) {\n observer.visibleNodes.add(element);\n return () => {\n observer.visibleNodes.delete(element);\n };\n }\n}\n"],"names":[],"version":3,"file":"ariaHideOutside.main.js.map"}
|