@react-aria/utils 3.23.2 → 3.24.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/chain.main.js +26 -0
- package/dist/chain.main.js.map +1 -0
- package/dist/chain.mjs +21 -0
- package/dist/chain.module.js +21 -0
- package/dist/chain.module.js.map +1 -0
- package/dist/domHelpers.main.js +19 -0
- package/dist/domHelpers.main.js.map +1 -0
- package/dist/domHelpers.mjs +13 -0
- package/dist/domHelpers.module.js +13 -0
- package/dist/domHelpers.module.js.map +1 -0
- package/dist/filterDOMProps.main.js +45 -0
- package/dist/filterDOMProps.main.js.map +1 -0
- package/dist/filterDOMProps.mjs +40 -0
- package/dist/filterDOMProps.module.js +40 -0
- package/dist/filterDOMProps.module.js.map +1 -0
- package/dist/focusWithoutScrolling.main.js +72 -0
- package/dist/focusWithoutScrolling.main.js.map +1 -0
- package/dist/focusWithoutScrolling.mjs +67 -0
- package/dist/focusWithoutScrolling.module.js +67 -0
- package/dist/focusWithoutScrolling.module.js.map +1 -0
- package/dist/getOffset.main.js +24 -0
- package/dist/getOffset.main.js.map +1 -0
- package/dist/getOffset.mjs +19 -0
- package/dist/getOffset.module.js +19 -0
- package/dist/getOffset.module.js.map +1 -0
- package/dist/getScrollParent.main.js +28 -0
- package/dist/getScrollParent.main.js.map +1 -0
- package/dist/getScrollParent.mjs +23 -0
- package/dist/getScrollParent.module.js +23 -0
- package/dist/getScrollParent.module.js.map +1 -0
- package/dist/getScrollParents.main.js +30 -0
- package/dist/getScrollParents.main.js.map +1 -0
- package/dist/getScrollParents.mjs +25 -0
- package/dist/getScrollParents.module.js +25 -0
- package/dist/getScrollParents.module.js.map +1 -0
- package/dist/import.mjs +32 -1232
- package/dist/isScrollable.main.js +25 -0
- package/dist/isScrollable.main.js.map +1 -0
- package/dist/isScrollable.mjs +20 -0
- package/dist/isScrollable.module.js +20 -0
- package/dist/isScrollable.module.js.map +1 -0
- package/dist/isVirtualEvent.main.js +41 -0
- package/dist/isVirtualEvent.main.js.map +1 -0
- package/dist/isVirtualEvent.mjs +35 -0
- package/dist/isVirtualEvent.module.js +35 -0
- package/dist/isVirtualEvent.module.js.map +1 -0
- package/dist/main.js +80 -1282
- package/dist/main.js.map +1 -1
- package/dist/mergeProps.main.js +51 -0
- package/dist/mergeProps.main.js.map +1 -0
- package/dist/mergeProps.mjs +42 -0
- package/dist/mergeProps.module.js +42 -0
- package/dist/mergeProps.module.js.map +1 -0
- package/dist/mergeRefs.main.js +28 -0
- package/dist/mergeRefs.main.js.map +1 -0
- package/dist/mergeRefs.mjs +23 -0
- package/dist/mergeRefs.module.js +23 -0
- package/dist/mergeRefs.module.js.map +1 -0
- package/dist/module.js +32 -1232
- package/dist/module.js.map +1 -1
- package/dist/openLink.main.js +143 -0
- package/dist/openLink.main.js.map +1 -0
- package/dist/openLink.mjs +129 -0
- package/dist/openLink.module.js +129 -0
- package/dist/openLink.module.js.map +1 -0
- package/dist/platform.main.js +64 -0
- package/dist/platform.main.js.map +1 -0
- package/dist/platform.mjs +51 -0
- package/dist/platform.module.js +51 -0
- package/dist/platform.module.js.map +1 -0
- package/dist/runAfterTransition.main.js +82 -0
- package/dist/runAfterTransition.main.js.map +1 -0
- package/dist/runAfterTransition.mjs +77 -0
- package/dist/runAfterTransition.module.js +77 -0
- package/dist/runAfterTransition.module.js.map +1 -0
- package/dist/scrollIntoView.main.js +96 -0
- package/dist/scrollIntoView.main.js.map +1 -0
- package/dist/scrollIntoView.mjs +90 -0
- package/dist/scrollIntoView.module.js +90 -0
- package/dist/scrollIntoView.module.js.map +1 -0
- package/dist/types.d.ts +17 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/useDeepMemo.main.js +30 -0
- package/dist/useDeepMemo.main.js.map +1 -0
- package/dist/useDeepMemo.mjs +25 -0
- package/dist/useDeepMemo.module.js +25 -0
- package/dist/useDeepMemo.module.js.map +1 -0
- package/dist/useDescription.main.js +59 -0
- package/dist/useDescription.main.js.map +1 -0
- package/dist/useDescription.mjs +54 -0
- package/dist/useDescription.module.js +54 -0
- package/dist/useDescription.module.js.map +1 -0
- package/dist/useDrag1D.main.js +139 -0
- package/dist/useDrag1D.main.js.map +1 -0
- package/dist/useDrag1D.mjs +134 -0
- package/dist/useDrag1D.module.js +134 -0
- package/dist/useDrag1D.module.js.map +1 -0
- package/dist/useEffectEvent.main.js +37 -0
- package/dist/useEffectEvent.main.js.map +1 -0
- package/dist/useEffectEvent.mjs +32 -0
- package/dist/useEffectEvent.module.js +32 -0
- package/dist/useEffectEvent.module.js.map +1 -0
- package/dist/useEvent.main.js +42 -0
- package/dist/useEvent.main.js.map +1 -0
- package/dist/useEvent.mjs +37 -0
- package/dist/useEvent.module.js +37 -0
- package/dist/useEvent.module.js.map +1 -0
- package/dist/useFormReset.main.js +41 -0
- package/dist/useFormReset.main.js.map +1 -0
- package/dist/useFormReset.mjs +36 -0
- package/dist/useFormReset.module.js +36 -0
- package/dist/useFormReset.module.js.map +1 -0
- package/dist/useGlobalListeners.main.js +63 -0
- package/dist/useGlobalListeners.main.js.map +1 -0
- package/dist/useGlobalListeners.mjs +58 -0
- package/dist/useGlobalListeners.module.js +58 -0
- package/dist/useGlobalListeners.module.js.map +1 -0
- package/dist/useId.main.js +93 -0
- package/dist/useId.main.js.map +1 -0
- package/dist/useId.mjs +86 -0
- package/dist/useId.module.js +86 -0
- package/dist/useId.module.js.map +1 -0
- package/dist/useLabels.main.js +44 -0
- package/dist/useLabels.main.js.map +1 -0
- package/dist/useLabels.mjs +39 -0
- package/dist/useLabels.module.js +39 -0
- package/dist/useLabels.module.js.map +1 -0
- package/dist/useLayoutEffect.main.js +27 -0
- package/dist/useLayoutEffect.main.js.map +1 -0
- package/dist/useLayoutEffect.mjs +18 -0
- package/dist/useLayoutEffect.module.js +18 -0
- package/dist/useLayoutEffect.module.js.map +1 -0
- package/dist/useObjectRef.main.js +37 -0
- package/dist/useObjectRef.main.js.map +1 -0
- package/dist/useObjectRef.mjs +32 -0
- package/dist/useObjectRef.module.js +32 -0
- package/dist/useObjectRef.module.js.map +1 -0
- package/dist/useResizeObserver.main.js +40 -0
- package/dist/useResizeObserver.main.js.map +1 -0
- package/dist/useResizeObserver.mjs +35 -0
- package/dist/useResizeObserver.module.js +35 -0
- package/dist/useResizeObserver.module.js.map +1 -0
- package/dist/useSyncRef.main.js +32 -0
- package/dist/useSyncRef.main.js.map +1 -0
- package/dist/useSyncRef.mjs +27 -0
- package/dist/useSyncRef.module.js +27 -0
- package/dist/useSyncRef.module.js.map +1 -0
- package/dist/useUpdateEffect.main.js +38 -0
- package/dist/useUpdateEffect.main.js.map +1 -0
- package/dist/useUpdateEffect.mjs +33 -0
- package/dist/useUpdateEffect.module.js +33 -0
- package/dist/useUpdateEffect.module.js.map +1 -0
- package/dist/useValueEffect.main.js +58 -0
- package/dist/useValueEffect.main.js.map +1 -0
- package/dist/useValueEffect.mjs +53 -0
- package/dist/useValueEffect.module.js +53 -0
- package/dist/useValueEffect.module.js.map +1 -0
- package/dist/useViewportSize.main.js +56 -0
- package/dist/useViewportSize.main.js.map +1 -0
- package/dist/useViewportSize.mjs +51 -0
- package/dist/useViewportSize.module.js +51 -0
- package/dist/useViewportSize.module.js.map +1 -0
- package/package.json +5 -5
- package/src/filterDOMProps.ts +1 -0
- package/src/getScrollParent.ts +2 -10
- package/src/getScrollParents.ts +26 -0
- package/src/index.ts +4 -2
- package/src/isScrollable.ts +22 -0
- package/src/mergeRefs.ts +2 -2
- package/src/openLink.tsx +25 -9
- package/src/scrollIntoView.ts +3 -5
package/dist/useId.mjs
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.mjs";
|
|
2
|
+
import {useValueEffect as $1dbecbe27a04f9af$export$14d238f342723f25} from "./useValueEffect.mjs";
|
|
3
|
+
import {useState as $eKkEp$useState, useRef as $eKkEp$useRef, useCallback as $eKkEp$useCallback, useEffect as $eKkEp$useEffect} from "react";
|
|
4
|
+
import {useSSRSafeId as $eKkEp$useSSRSafeId} from "@react-aria/ssr";
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
8
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
+
* governing permissions and limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
// copied from SSRProvider.tsx to reduce exports, if needed again, consider sharing
|
|
21
|
+
let $bdb11010cef70236$var$canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
22
|
+
let $bdb11010cef70236$var$idsUpdaterMap = new Map();
|
|
23
|
+
function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
|
|
24
|
+
let [value, setValue] = (0, $eKkEp$useState)(defaultId);
|
|
25
|
+
let nextId = (0, $eKkEp$useRef)(null);
|
|
26
|
+
let res = (0, $eKkEp$useSSRSafeId)(value);
|
|
27
|
+
let updateValue = (0, $eKkEp$useCallback)((val)=>{
|
|
28
|
+
nextId.current = val;
|
|
29
|
+
}, []);
|
|
30
|
+
if ($bdb11010cef70236$var$canUseDOM) $bdb11010cef70236$var$idsUpdaterMap.set(res, updateValue);
|
|
31
|
+
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
32
|
+
let r = res;
|
|
33
|
+
return ()=>{
|
|
34
|
+
$bdb11010cef70236$var$idsUpdaterMap.delete(r);
|
|
35
|
+
};
|
|
36
|
+
}, [
|
|
37
|
+
res
|
|
38
|
+
]);
|
|
39
|
+
// This cannot cause an infinite loop because the ref is updated first.
|
|
40
|
+
// eslint-disable-next-line
|
|
41
|
+
(0, $eKkEp$useEffect)(()=>{
|
|
42
|
+
let newId = nextId.current;
|
|
43
|
+
if (newId) {
|
|
44
|
+
nextId.current = null;
|
|
45
|
+
setValue(newId);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return res;
|
|
49
|
+
}
|
|
50
|
+
function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
|
|
51
|
+
if (idA === idB) return idA;
|
|
52
|
+
let setIdA = $bdb11010cef70236$var$idsUpdaterMap.get(idA);
|
|
53
|
+
if (setIdA) {
|
|
54
|
+
setIdA(idB);
|
|
55
|
+
return idB;
|
|
56
|
+
}
|
|
57
|
+
let setIdB = $bdb11010cef70236$var$idsUpdaterMap.get(idB);
|
|
58
|
+
if (setIdB) {
|
|
59
|
+
setIdB(idA);
|
|
60
|
+
return idA;
|
|
61
|
+
}
|
|
62
|
+
return idB;
|
|
63
|
+
}
|
|
64
|
+
function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
|
|
65
|
+
let id = $bdb11010cef70236$export$f680877a34711e37();
|
|
66
|
+
let [resolvedId, setResolvedId] = (0, $1dbecbe27a04f9af$export$14d238f342723f25)(id);
|
|
67
|
+
let updateId = (0, $eKkEp$useCallback)(()=>{
|
|
68
|
+
setResolvedId(function*() {
|
|
69
|
+
yield id;
|
|
70
|
+
yield document.getElementById(id) ? id : undefined;
|
|
71
|
+
});
|
|
72
|
+
}, [
|
|
73
|
+
id,
|
|
74
|
+
setResolvedId
|
|
75
|
+
]);
|
|
76
|
+
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(updateId, [
|
|
77
|
+
id,
|
|
78
|
+
updateId,
|
|
79
|
+
...depArray
|
|
80
|
+
]);
|
|
81
|
+
return resolvedId;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
export {$bdb11010cef70236$export$f680877a34711e37 as useId, $bdb11010cef70236$export$cd8c9cb68f842629 as mergeIds, $bdb11010cef70236$export$b4cc09c592e8fdb8 as useSlotId};
|
|
86
|
+
//# sourceMappingURL=useId.module.js.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.module.js";
|
|
2
|
+
import {useValueEffect as $1dbecbe27a04f9af$export$14d238f342723f25} from "./useValueEffect.module.js";
|
|
3
|
+
import {useState as $eKkEp$useState, useRef as $eKkEp$useRef, useCallback as $eKkEp$useCallback, useEffect as $eKkEp$useEffect} from "react";
|
|
4
|
+
import {useSSRSafeId as $eKkEp$useSSRSafeId} from "@react-aria/ssr";
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
8
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
+
* governing permissions and limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
// copied from SSRProvider.tsx to reduce exports, if needed again, consider sharing
|
|
21
|
+
let $bdb11010cef70236$var$canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
22
|
+
let $bdb11010cef70236$var$idsUpdaterMap = new Map();
|
|
23
|
+
function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
|
|
24
|
+
let [value, setValue] = (0, $eKkEp$useState)(defaultId);
|
|
25
|
+
let nextId = (0, $eKkEp$useRef)(null);
|
|
26
|
+
let res = (0, $eKkEp$useSSRSafeId)(value);
|
|
27
|
+
let updateValue = (0, $eKkEp$useCallback)((val)=>{
|
|
28
|
+
nextId.current = val;
|
|
29
|
+
}, []);
|
|
30
|
+
if ($bdb11010cef70236$var$canUseDOM) $bdb11010cef70236$var$idsUpdaterMap.set(res, updateValue);
|
|
31
|
+
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
32
|
+
let r = res;
|
|
33
|
+
return ()=>{
|
|
34
|
+
$bdb11010cef70236$var$idsUpdaterMap.delete(r);
|
|
35
|
+
};
|
|
36
|
+
}, [
|
|
37
|
+
res
|
|
38
|
+
]);
|
|
39
|
+
// This cannot cause an infinite loop because the ref is updated first.
|
|
40
|
+
// eslint-disable-next-line
|
|
41
|
+
(0, $eKkEp$useEffect)(()=>{
|
|
42
|
+
let newId = nextId.current;
|
|
43
|
+
if (newId) {
|
|
44
|
+
nextId.current = null;
|
|
45
|
+
setValue(newId);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return res;
|
|
49
|
+
}
|
|
50
|
+
function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
|
|
51
|
+
if (idA === idB) return idA;
|
|
52
|
+
let setIdA = $bdb11010cef70236$var$idsUpdaterMap.get(idA);
|
|
53
|
+
if (setIdA) {
|
|
54
|
+
setIdA(idB);
|
|
55
|
+
return idB;
|
|
56
|
+
}
|
|
57
|
+
let setIdB = $bdb11010cef70236$var$idsUpdaterMap.get(idB);
|
|
58
|
+
if (setIdB) {
|
|
59
|
+
setIdB(idA);
|
|
60
|
+
return idA;
|
|
61
|
+
}
|
|
62
|
+
return idB;
|
|
63
|
+
}
|
|
64
|
+
function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
|
|
65
|
+
let id = $bdb11010cef70236$export$f680877a34711e37();
|
|
66
|
+
let [resolvedId, setResolvedId] = (0, $1dbecbe27a04f9af$export$14d238f342723f25)(id);
|
|
67
|
+
let updateId = (0, $eKkEp$useCallback)(()=>{
|
|
68
|
+
setResolvedId(function*() {
|
|
69
|
+
yield id;
|
|
70
|
+
yield document.getElementById(id) ? id : undefined;
|
|
71
|
+
});
|
|
72
|
+
}, [
|
|
73
|
+
id,
|
|
74
|
+
setResolvedId
|
|
75
|
+
]);
|
|
76
|
+
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(updateId, [
|
|
77
|
+
id,
|
|
78
|
+
updateId,
|
|
79
|
+
...depArray
|
|
80
|
+
]);
|
|
81
|
+
return resolvedId;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
export {$bdb11010cef70236$export$f680877a34711e37 as useId, $bdb11010cef70236$export$cd8c9cb68f842629 as mergeIds, $bdb11010cef70236$export$b4cc09c592e8fdb8 as useSlotId};
|
|
86
|
+
//# sourceMappingURL=useId.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAOD,mFAAmF;AACnF,IAAI,kCAAY,QACd,OAAO,WAAW,eAClB,OAAO,QAAQ,IACf,OAAO,QAAQ,CAAC,aAAa;AAG/B,IAAI,sCAAkD,IAAI;AAMnD,SAAS,0CAAM,SAAkB;IACtC,IAAI,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,eAAO,EAAE;IACjC,IAAI,SAAS,CAAA,GAAA,aAAK,EAAE;IAEpB,IAAI,MAAM,CAAA,GAAA,mBAAW,EAAE;IAEvB,IAAI,cAAc,CAAA,GAAA,kBAAU,EAAE,CAAC;QAC7B,OAAO,OAAO,GAAG;IACnB,GAAG,EAAE;IAEL,IAAI,iCACF,oCAAc,GAAG,CAAC,KAAK;IAGzB,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,IAAI;QACR,OAAO;YACL,oCAAc,MAAM,CAAC;QACvB;IACF,GAAG;QAAC;KAAI;IAER,uEAAuE;IACvE,2BAA2B;IAC3B,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,QAAQ,OAAO,OAAO;QAC1B,IAAI,OAAO;YACT,OAAO,OAAO,GAAG;YACjB,SAAS;QACX;IACF;IAEA,OAAO;AACT;AAMO,SAAS,0CAAS,GAAW,EAAE,GAAW;IAC/C,IAAI,QAAQ,KACV,OAAO;IAGT,IAAI,SAAS,oCAAc,GAAG,CAAC;IAC/B,IAAI,QAAQ;QACV,OAAO;QACP,OAAO;IACT;IAEA,IAAI,SAAS,oCAAc,GAAG,CAAC;IAC/B,IAAI,QAAQ;QACV,OAAO;QACP,OAAO;IACT;IAEA,OAAO;AACT;AAOO,SAAS,0CAAU,WAA+B,EAAE;IACzD,IAAI,KAAK;IACT,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,yCAAa,EAAE;IACjD,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE;QACzB,cAAc;YACZ,MAAM;YAEN,MAAM,SAAS,cAAc,CAAC,MAAM,KAAK;QAC3C;IACF,GAAG;QAAC;QAAI;KAAc;IAEtB,CAAA,GAAA,yCAAc,EAAE,UAAU;QAAC;QAAI;WAAa;KAAS;IAErD,OAAO;AACT","sources":["packages/@react-aria/utils/src/useId.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 {useCallback, useEffect, useRef, useState} from 'react';\nimport {useLayoutEffect} from './useLayoutEffect';\nimport {useSSRSafeId} from '@react-aria/ssr';\nimport {useValueEffect} from './';\n\n// copied from SSRProvider.tsx to reduce exports, if needed again, consider sharing\nlet canUseDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n\nlet idsUpdaterMap: Map<string, (v: string) => void> = new Map();\n\n/**\n * If a default is not provided, generate an id.\n * @param defaultId - Default component id.\n */\nexport function useId(defaultId?: string): string {\n let [value, setValue] = useState(defaultId);\n let nextId = useRef(null);\n\n let res = useSSRSafeId(value);\n\n let updateValue = useCallback((val) => {\n nextId.current = val;\n }, []);\n\n if (canUseDOM) {\n idsUpdaterMap.set(res, updateValue);\n }\n\n useLayoutEffect(() => {\n let r = res;\n return () => {\n idsUpdaterMap.delete(r);\n };\n }, [res]);\n\n // This cannot cause an infinite loop because the ref is updated first.\n // eslint-disable-next-line\n useEffect(() => {\n let newId = nextId.current;\n if (newId) {\n nextId.current = null;\n setValue(newId);\n }\n });\n\n return res;\n}\n\n/**\n * Merges two ids.\n * Different ids will trigger a side-effect and re-render components hooked up with `useId`.\n */\nexport function mergeIds(idA: string, idB: string): string {\n if (idA === idB) {\n return idA;\n }\n\n let setIdA = idsUpdaterMap.get(idA);\n if (setIdA) {\n setIdA(idB);\n return idB;\n }\n\n let setIdB = idsUpdaterMap.get(idB);\n if (setIdB) {\n setIdB(idA);\n return idA;\n }\n\n return idB;\n}\n\n/**\n * Used to generate an id, and after render, check if that id is rendered so we know\n * if we can use it in places such as labelledby.\n * @param depArray - When to recalculate if the id is in the DOM.\n */\nexport function useSlotId(depArray: ReadonlyArray<any> = []): string {\n let id = useId();\n let [resolvedId, setResolvedId] = useValueEffect(id);\n let updateId = useCallback(() => {\n setResolvedId(function *() {\n yield id;\n\n yield document.getElementById(id) ? id : undefined;\n });\n }, [id, setResolvedId]);\n\n useLayoutEffect(updateId, [id, updateId, ...depArray]);\n\n return resolvedId;\n}\n"],"names":[],"version":3,"file":"useId.module.js.map"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var $8c61827343eed941$exports = require("./useId.main.js");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function $parcel$export(e, n, v, s) {
|
|
5
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
$parcel$export(module.exports, "useLabels", () => $6ec78bde395c477d$export$d6875122194c7b44);
|
|
9
|
+
/*
|
|
10
|
+
* Copyright 2020 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
|
+
function $6ec78bde395c477d$export$d6875122194c7b44(props, defaultLabel) {
|
|
21
|
+
let { id: id, 'aria-label': label, 'aria-labelledby': labelledBy } = props;
|
|
22
|
+
// If there is both an aria-label and aria-labelledby,
|
|
23
|
+
// combine them by pointing to the element itself.
|
|
24
|
+
id = (0, $8c61827343eed941$exports.useId)(id);
|
|
25
|
+
if (labelledBy && label) {
|
|
26
|
+
let ids = new Set([
|
|
27
|
+
id,
|
|
28
|
+
...labelledBy.trim().split(/\s+/)
|
|
29
|
+
]);
|
|
30
|
+
labelledBy = [
|
|
31
|
+
...ids
|
|
32
|
+
].join(' ');
|
|
33
|
+
} else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(' ');
|
|
34
|
+
// If no labels are provided, use the default
|
|
35
|
+
if (!label && !labelledBy && defaultLabel) label = defaultLabel;
|
|
36
|
+
return {
|
|
37
|
+
id: id,
|
|
38
|
+
'aria-label': label,
|
|
39
|
+
'aria-labelledby': labelledBy
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=useLabels.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAUM,SAAS,0CAAU,KAAmC,EAAE,YAAqB;IAClF,IAAI,MACF,EAAE,EACF,cAAc,KAAK,EACnB,mBAAmB,UAAU,EAC9B,GAAG;IAEJ,sDAAsD;IACtD,kDAAkD;IAClD,KAAK,CAAA,GAAA,+BAAI,EAAE;IACX,IAAI,cAAc,OAAO;QACvB,IAAI,MAAM,IAAI,IAAI;YAAC;eAAO,WAAW,IAAI,GAAG,KAAK,CAAC;SAAO;QACzD,aAAa;eAAI;SAAI,CAAC,IAAI,CAAC;IAC7B,OAAO,IAAI,YACT,aAAa,WAAW,IAAI,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC;IAGnD,6CAA6C;IAC7C,IAAI,CAAC,SAAS,CAAC,cAAc,cAC3B,QAAQ;IAGV,OAAO;YACL;QACA,cAAc;QACd,mBAAmB;IACrB;AACF","sources":["packages/@react-aria/utils/src/useLabels.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 {AriaLabelingProps, DOMProps} from '@react-types/shared';\nimport {useId} from './useId';\n\n/**\n * Merges aria-label and aria-labelledby into aria-labelledby when both exist.\n * @param props - Aria label props.\n * @param defaultLabel - Default value for aria-label when not present.\n */\nexport function useLabels(props: DOMProps & AriaLabelingProps, defaultLabel?: string): DOMProps & AriaLabelingProps {\n let {\n id,\n 'aria-label': label,\n 'aria-labelledby': labelledBy\n } = props;\n\n // If there is both an aria-label and aria-labelledby,\n // combine them by pointing to the element itself.\n id = useId(id);\n if (labelledBy && label) {\n let ids = new Set([id, ...labelledBy.trim().split(/\\s+/)]);\n labelledBy = [...ids].join(' ');\n } else if (labelledBy) {\n labelledBy = labelledBy.trim().split(/\\s+/).join(' ');\n }\n\n // If no labels are provided, use the default\n if (!label && !labelledBy && defaultLabel) {\n label = defaultLabel;\n }\n\n return {\n id,\n 'aria-label': label,\n 'aria-labelledby': labelledBy\n };\n}\n"],"names":[],"version":3,"file":"useLabels.main.js.map"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {useId as $bdb11010cef70236$export$f680877a34711e37} from "./useId.mjs";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 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
|
+
function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
15
|
+
let { id: id, 'aria-label': label, 'aria-labelledby': labelledBy } = props;
|
|
16
|
+
// If there is both an aria-label and aria-labelledby,
|
|
17
|
+
// combine them by pointing to the element itself.
|
|
18
|
+
id = (0, $bdb11010cef70236$export$f680877a34711e37)(id);
|
|
19
|
+
if (labelledBy && label) {
|
|
20
|
+
let ids = new Set([
|
|
21
|
+
id,
|
|
22
|
+
...labelledBy.trim().split(/\s+/)
|
|
23
|
+
]);
|
|
24
|
+
labelledBy = [
|
|
25
|
+
...ids
|
|
26
|
+
].join(' ');
|
|
27
|
+
} else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(' ');
|
|
28
|
+
// If no labels are provided, use the default
|
|
29
|
+
if (!label && !labelledBy && defaultLabel) label = defaultLabel;
|
|
30
|
+
return {
|
|
31
|
+
id: id,
|
|
32
|
+
'aria-label': label,
|
|
33
|
+
'aria-labelledby': labelledBy
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
export {$313b98861ee5dd6c$export$d6875122194c7b44 as useLabels};
|
|
39
|
+
//# sourceMappingURL=useLabels.module.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {useId as $bdb11010cef70236$export$f680877a34711e37} from "./useId.module.js";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 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
|
+
function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
15
|
+
let { id: id, 'aria-label': label, 'aria-labelledby': labelledBy } = props;
|
|
16
|
+
// If there is both an aria-label and aria-labelledby,
|
|
17
|
+
// combine them by pointing to the element itself.
|
|
18
|
+
id = (0, $bdb11010cef70236$export$f680877a34711e37)(id);
|
|
19
|
+
if (labelledBy && label) {
|
|
20
|
+
let ids = new Set([
|
|
21
|
+
id,
|
|
22
|
+
...labelledBy.trim().split(/\s+/)
|
|
23
|
+
]);
|
|
24
|
+
labelledBy = [
|
|
25
|
+
...ids
|
|
26
|
+
].join(' ');
|
|
27
|
+
} else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(' ');
|
|
28
|
+
// If no labels are provided, use the default
|
|
29
|
+
if (!label && !labelledBy && defaultLabel) label = defaultLabel;
|
|
30
|
+
return {
|
|
31
|
+
id: id,
|
|
32
|
+
'aria-label': label,
|
|
33
|
+
'aria-labelledby': labelledBy
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
export {$313b98861ee5dd6c$export$d6875122194c7b44 as useLabels};
|
|
39
|
+
//# sourceMappingURL=useLabels.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAUM,SAAS,0CAAU,KAAmC,EAAE,YAAqB;IAClF,IAAI,MACF,EAAE,EACF,cAAc,KAAK,EACnB,mBAAmB,UAAU,EAC9B,GAAG;IAEJ,sDAAsD;IACtD,kDAAkD;IAClD,KAAK,CAAA,GAAA,yCAAI,EAAE;IACX,IAAI,cAAc,OAAO;QACvB,IAAI,MAAM,IAAI,IAAI;YAAC;eAAO,WAAW,IAAI,GAAG,KAAK,CAAC;SAAO;QACzD,aAAa;eAAI;SAAI,CAAC,IAAI,CAAC;IAC7B,OAAO,IAAI,YACT,aAAa,WAAW,IAAI,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC;IAGnD,6CAA6C;IAC7C,IAAI,CAAC,SAAS,CAAC,cAAc,cAC3B,QAAQ;IAGV,OAAO;YACL;QACA,cAAc;QACd,mBAAmB;IACrB;AACF","sources":["packages/@react-aria/utils/src/useLabels.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 {AriaLabelingProps, DOMProps} from '@react-types/shared';\nimport {useId} from './useId';\n\n/**\n * Merges aria-label and aria-labelledby into aria-labelledby when both exist.\n * @param props - Aria label props.\n * @param defaultLabel - Default value for aria-label when not present.\n */\nexport function useLabels(props: DOMProps & AriaLabelingProps, defaultLabel?: string): DOMProps & AriaLabelingProps {\n let {\n id,\n 'aria-label': label,\n 'aria-labelledby': labelledBy\n } = props;\n\n // If there is both an aria-label and aria-labelledby,\n // combine them by pointing to the element itself.\n id = useId(id);\n if (labelledBy && label) {\n let ids = new Set([id, ...labelledBy.trim().split(/\\s+/)]);\n labelledBy = [...ids].join(' ');\n } else if (labelledBy) {\n labelledBy = labelledBy.trim().split(/\\s+/).join(' ');\n }\n\n // If no labels are provided, use the default\n if (!label && !labelledBy && defaultLabel) {\n label = defaultLabel;\n }\n\n return {\n id,\n 'aria-label': label,\n 'aria-labelledby': labelledBy\n };\n}\n"],"names":[],"version":3,"file":"useLabels.module.js.map"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var $ezjoC$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, "useLayoutEffect", () => $78605a5d7424e31b$export$e5c5a5f917a5871c);
|
|
13
|
+
/*
|
|
14
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
15
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
16
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
17
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
*
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
20
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
21
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
|
+
* governing permissions and limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
const $78605a5d7424e31b$export$e5c5a5f917a5871c = typeof document !== 'undefined' ? (0, ($parcel$interopDefault($ezjoC$react))).useLayoutEffect : ()=>{};
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=useLayoutEffect.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAOM,MAAM,4CAAkB,OAAO,aAAa,cAC/C,CAAA,GAAA,sCAAI,EAAE,eAAe,GACrB,KAAO","sources":["packages/@react-aria/utils/src/useLayoutEffect.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 React from 'react';\n\n// During SSR, React emits a warning when calling useLayoutEffect.\n// Since neither useLayoutEffect nor useEffect run on the server,\n// we can suppress this by replace it with a noop on the server.\nexport const useLayoutEffect = typeof document !== 'undefined'\n ? React.useLayoutEffect\n : () => {};\n"],"names":[],"version":3,"file":"useLayoutEffect.main.js.map"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import $HgANd$react from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 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 $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof document !== 'undefined' ? (0, $HgANd$react).useLayoutEffect : ()=>{};
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export {$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c as useLayoutEffect};
|
|
18
|
+
//# sourceMappingURL=useLayoutEffect.module.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import $HgANd$react from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 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 $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof document !== 'undefined' ? (0, $HgANd$react).useLayoutEffect : ()=>{};
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export {$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c as useLayoutEffect};
|
|
18
|
+
//# sourceMappingURL=useLayoutEffect.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAOM,MAAM,4CAAkB,OAAO,aAAa,cAC/C,CAAA,GAAA,YAAI,EAAE,eAAe,GACrB,KAAO","sources":["packages/@react-aria/utils/src/useLayoutEffect.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 React from 'react';\n\n// During SSR, React emits a warning when calling useLayoutEffect.\n// Since neither useLayoutEffect nor useEffect run on the server,\n// we can suppress this by replace it with a noop on the server.\nexport const useLayoutEffect = typeof document !== 'undefined'\n ? React.useLayoutEffect\n : () => {};\n"],"names":[],"version":3,"file":"useLayoutEffect.module.js.map"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var $eMoU1$react = require("react");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function $parcel$export(e, n, v, s) {
|
|
5
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
$parcel$export(module.exports, "useObjectRef", () => $475b35fe72ba49b3$export$4338b53315abf666);
|
|
9
|
+
/*
|
|
10
|
+
* Copyright 2021 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
|
+
function $475b35fe72ba49b3$export$4338b53315abf666(forwardedRef) {
|
|
21
|
+
const objRef = (0, $eMoU1$react.useRef)(null);
|
|
22
|
+
return (0, $eMoU1$react.useMemo)(()=>({
|
|
23
|
+
get current () {
|
|
24
|
+
return objRef.current;
|
|
25
|
+
},
|
|
26
|
+
set current (value){
|
|
27
|
+
objRef.current = value;
|
|
28
|
+
if (typeof forwardedRef === 'function') forwardedRef(value);
|
|
29
|
+
else if (forwardedRef) forwardedRef.current = value;
|
|
30
|
+
}
|
|
31
|
+
}), [
|
|
32
|
+
forwardedRef
|
|
33
|
+
]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=useObjectRef.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAaM,SAAS,0CAAgB,YAAiF;IAC/G,MAAM,SAAqC,CAAA,GAAA,mBAAK,EAAK;IACrD,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;YACpB,IAAI,WAAU;gBACZ,OAAO,OAAO,OAAO;YACvB;YACA,IAAI,SAAQ,MAAO;gBACjB,OAAO,OAAO,GAAG;gBACjB,IAAI,OAAO,iBAAiB,YAC1B,aAAa;qBACR,IAAI,cACT,aAAa,OAAO,GAAG;YAE3B;QACF,CAAA,GAAI;QAAC;KAAa;AACpB","sources":["packages/@react-aria/utils/src/useObjectRef.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {MutableRefObject, useMemo, useRef} from 'react';\n\n/**\n * Offers an object ref for a given callback ref or an object ref. Especially\n * helfpul when passing forwarded refs (created using `React.forwardRef`) to\n * React Aria hooks.\n *\n * @param forwardedRef The original ref intended to be used.\n * @returns An object ref that updates the given ref.\n * @see https://reactjs.org/docs/forwarding-refs.html\n */\nexport function useObjectRef<T>(forwardedRef?: ((instance: T | null) => void) | MutableRefObject<T | null> | null): MutableRefObject<T | null> {\n const objRef: MutableRefObject<T | null> = useRef<T>(null);\n return useMemo(() => ({\n get current() {\n return objRef.current;\n },\n set current(value) {\n objRef.current = value;\n if (typeof forwardedRef === 'function') {\n forwardedRef(value);\n } else if (forwardedRef) {\n forwardedRef.current = value;\n }\n }\n }), [forwardedRef]);\n}\n"],"names":[],"version":3,"file":"useObjectRef.main.js.map"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {useRef as $gbmns$useRef, useMemo as $gbmns$useMemo} from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2021 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
|
+
function $df56164dff5785e2$export$4338b53315abf666(forwardedRef) {
|
|
15
|
+
const objRef = (0, $gbmns$useRef)(null);
|
|
16
|
+
return (0, $gbmns$useMemo)(()=>({
|
|
17
|
+
get current () {
|
|
18
|
+
return objRef.current;
|
|
19
|
+
},
|
|
20
|
+
set current (value){
|
|
21
|
+
objRef.current = value;
|
|
22
|
+
if (typeof forwardedRef === 'function') forwardedRef(value);
|
|
23
|
+
else if (forwardedRef) forwardedRef.current = value;
|
|
24
|
+
}
|
|
25
|
+
}), [
|
|
26
|
+
forwardedRef
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export {$df56164dff5785e2$export$4338b53315abf666 as useObjectRef};
|
|
32
|
+
//# sourceMappingURL=useObjectRef.module.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {useRef as $gbmns$useRef, useMemo as $gbmns$useMemo} from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2021 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
|
+
function $df56164dff5785e2$export$4338b53315abf666(forwardedRef) {
|
|
15
|
+
const objRef = (0, $gbmns$useRef)(null);
|
|
16
|
+
return (0, $gbmns$useMemo)(()=>({
|
|
17
|
+
get current () {
|
|
18
|
+
return objRef.current;
|
|
19
|
+
},
|
|
20
|
+
set current (value){
|
|
21
|
+
objRef.current = value;
|
|
22
|
+
if (typeof forwardedRef === 'function') forwardedRef(value);
|
|
23
|
+
else if (forwardedRef) forwardedRef.current = value;
|
|
24
|
+
}
|
|
25
|
+
}), [
|
|
26
|
+
forwardedRef
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export {$df56164dff5785e2$export$4338b53315abf666 as useObjectRef};
|
|
32
|
+
//# sourceMappingURL=useObjectRef.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAaM,SAAS,0CAAgB,YAAiF;IAC/G,MAAM,SAAqC,CAAA,GAAA,aAAK,EAAK;IACrD,OAAO,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YACpB,IAAI,WAAU;gBACZ,OAAO,OAAO,OAAO;YACvB;YACA,IAAI,SAAQ,MAAO;gBACjB,OAAO,OAAO,GAAG;gBACjB,IAAI,OAAO,iBAAiB,YAC1B,aAAa;qBACR,IAAI,cACT,aAAa,OAAO,GAAG;YAE3B;QACF,CAAA,GAAI;QAAC;KAAa;AACpB","sources":["packages/@react-aria/utils/src/useObjectRef.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {MutableRefObject, useMemo, useRef} from 'react';\n\n/**\n * Offers an object ref for a given callback ref or an object ref. Especially\n * helfpul when passing forwarded refs (created using `React.forwardRef`) to\n * React Aria hooks.\n *\n * @param forwardedRef The original ref intended to be used.\n * @returns An object ref that updates the given ref.\n * @see https://reactjs.org/docs/forwarding-refs.html\n */\nexport function useObjectRef<T>(forwardedRef?: ((instance: T | null) => void) | MutableRefObject<T | null> | null): MutableRefObject<T | null> {\n const objRef: MutableRefObject<T | null> = useRef<T>(null);\n return useMemo(() => ({\n get current() {\n return objRef.current;\n },\n set current(value) {\n objRef.current = value;\n if (typeof forwardedRef === 'function') {\n forwardedRef(value);\n } else if (forwardedRef) {\n forwardedRef.current = value;\n }\n }\n }), [forwardedRef]);\n}\n"],"names":[],"version":3,"file":"useObjectRef.module.js.map"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var $aM4zL$react = require("react");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function $parcel$export(e, n, v, s) {
|
|
5
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
$parcel$export(module.exports, "useResizeObserver", () => $37733e1652f47193$export$683480f191c0e3ea);
|
|
9
|
+
|
|
10
|
+
function $37733e1652f47193$var$hasResizeObserver() {
|
|
11
|
+
return typeof window.ResizeObserver !== 'undefined';
|
|
12
|
+
}
|
|
13
|
+
function $37733e1652f47193$export$683480f191c0e3ea(options) {
|
|
14
|
+
const { ref: ref, onResize: onResize } = options;
|
|
15
|
+
(0, $aM4zL$react.useEffect)(()=>{
|
|
16
|
+
let element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
17
|
+
if (!element) return;
|
|
18
|
+
if (!$37733e1652f47193$var$hasResizeObserver()) {
|
|
19
|
+
window.addEventListener('resize', onResize, false);
|
|
20
|
+
return ()=>{
|
|
21
|
+
window.removeEventListener('resize', onResize, false);
|
|
22
|
+
};
|
|
23
|
+
} else {
|
|
24
|
+
const resizeObserverInstance = new window.ResizeObserver((entries)=>{
|
|
25
|
+
if (!entries.length) return;
|
|
26
|
+
onResize();
|
|
27
|
+
});
|
|
28
|
+
resizeObserverInstance.observe(element);
|
|
29
|
+
return ()=>{
|
|
30
|
+
if (element) resizeObserverInstance.unobserve(element);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}, [
|
|
34
|
+
onResize,
|
|
35
|
+
ref
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=useResizeObserver.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;AAEA,SAAS;IACP,OAAO,OAAO,OAAO,cAAc,KAAK;AAC1C;AAOO,SAAS,0CAAqC,OAAwC;IAC3F,MAAM,OAAC,GAAG,YAAE,QAAQ,EAAC,GAAG;IAExB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,UAAU,gBAAA,0BAAA,IAAK,OAAO;QAC1B,IAAI,CAAC,SACH;QAGF,IAAI,CAAC,2CAAqB;YACxB,OAAO,gBAAgB,CAAC,UAAU,UAAU;YAC5C,OAAO;gBACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;YACjD;QACF,OAAO;YAEL,MAAM,yBAAyB,IAAI,OAAO,cAAc,CAAC,CAAC;gBACxD,IAAI,CAAC,QAAQ,MAAM,EACjB;gBAGF;YACF;YACA,uBAAuB,OAAO,CAAC;YAE/B,OAAO;gBACL,IAAI,SACF,uBAAuB,SAAS,CAAC;YAErC;QACF;IAEF,GAAG;QAAC;QAAU;KAAI;AACpB","sources":["packages/@react-aria/utils/src/useResizeObserver.ts"],"sourcesContent":["import {RefObject, useEffect} from 'react';\n\nfunction hasResizeObserver() {\n return typeof window.ResizeObserver !== 'undefined';\n}\n\ntype useResizeObserverOptionsType<T> = {\n ref: RefObject<T | undefined> | undefined,\n onResize: () => void\n}\n\nexport function useResizeObserver<T extends Element>(options: useResizeObserverOptionsType<T>) {\n const {ref, onResize} = options;\n\n useEffect(() => {\n let element = ref?.current;\n if (!element) {\n return;\n }\n\n if (!hasResizeObserver()) {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n } else {\n\n const resizeObserverInstance = new window.ResizeObserver((entries) => {\n if (!entries.length) {\n return;\n }\n\n onResize();\n });\n resizeObserverInstance.observe(element);\n\n return () => {\n if (element) {\n resizeObserverInstance.unobserve(element);\n }\n };\n }\n\n }, [onResize, ref]);\n}\n"],"names":[],"version":3,"file":"useResizeObserver.main.js.map"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {useEffect as $Vsl8o$useEffect} from "react";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function $9daab02d461809db$var$hasResizeObserver() {
|
|
5
|
+
return typeof window.ResizeObserver !== 'undefined';
|
|
6
|
+
}
|
|
7
|
+
function $9daab02d461809db$export$683480f191c0e3ea(options) {
|
|
8
|
+
const { ref: ref, onResize: onResize } = options;
|
|
9
|
+
(0, $Vsl8o$useEffect)(()=>{
|
|
10
|
+
let element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
11
|
+
if (!element) return;
|
|
12
|
+
if (!$9daab02d461809db$var$hasResizeObserver()) {
|
|
13
|
+
window.addEventListener('resize', onResize, false);
|
|
14
|
+
return ()=>{
|
|
15
|
+
window.removeEventListener('resize', onResize, false);
|
|
16
|
+
};
|
|
17
|
+
} else {
|
|
18
|
+
const resizeObserverInstance = new window.ResizeObserver((entries)=>{
|
|
19
|
+
if (!entries.length) return;
|
|
20
|
+
onResize();
|
|
21
|
+
});
|
|
22
|
+
resizeObserverInstance.observe(element);
|
|
23
|
+
return ()=>{
|
|
24
|
+
if (element) resizeObserverInstance.unobserve(element);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}, [
|
|
28
|
+
onResize,
|
|
29
|
+
ref
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export {$9daab02d461809db$export$683480f191c0e3ea as useResizeObserver};
|
|
35
|
+
//# sourceMappingURL=useResizeObserver.module.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {useEffect as $Vsl8o$useEffect} from "react";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function $9daab02d461809db$var$hasResizeObserver() {
|
|
5
|
+
return typeof window.ResizeObserver !== 'undefined';
|
|
6
|
+
}
|
|
7
|
+
function $9daab02d461809db$export$683480f191c0e3ea(options) {
|
|
8
|
+
const { ref: ref, onResize: onResize } = options;
|
|
9
|
+
(0, $Vsl8o$useEffect)(()=>{
|
|
10
|
+
let element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
11
|
+
if (!element) return;
|
|
12
|
+
if (!$9daab02d461809db$var$hasResizeObserver()) {
|
|
13
|
+
window.addEventListener('resize', onResize, false);
|
|
14
|
+
return ()=>{
|
|
15
|
+
window.removeEventListener('resize', onResize, false);
|
|
16
|
+
};
|
|
17
|
+
} else {
|
|
18
|
+
const resizeObserverInstance = new window.ResizeObserver((entries)=>{
|
|
19
|
+
if (!entries.length) return;
|
|
20
|
+
onResize();
|
|
21
|
+
});
|
|
22
|
+
resizeObserverInstance.observe(element);
|
|
23
|
+
return ()=>{
|
|
24
|
+
if (element) resizeObserverInstance.unobserve(element);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}, [
|
|
28
|
+
onResize,
|
|
29
|
+
ref
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export {$9daab02d461809db$export$683480f191c0e3ea as useResizeObserver};
|
|
35
|
+
//# sourceMappingURL=useResizeObserver.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;AAEA,SAAS;IACP,OAAO,OAAO,OAAO,cAAc,KAAK;AAC1C;AAOO,SAAS,0CAAqC,OAAwC;IAC3F,MAAM,OAAC,GAAG,YAAE,QAAQ,EAAC,GAAG;IAExB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,UAAU,gBAAA,0BAAA,IAAK,OAAO;QAC1B,IAAI,CAAC,SACH;QAGF,IAAI,CAAC,2CAAqB;YACxB,OAAO,gBAAgB,CAAC,UAAU,UAAU;YAC5C,OAAO;gBACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;YACjD;QACF,OAAO;YAEL,MAAM,yBAAyB,IAAI,OAAO,cAAc,CAAC,CAAC;gBACxD,IAAI,CAAC,QAAQ,MAAM,EACjB;gBAGF;YACF;YACA,uBAAuB,OAAO,CAAC;YAE/B,OAAO;gBACL,IAAI,SACF,uBAAuB,SAAS,CAAC;YAErC;QACF;IAEF,GAAG;QAAC;QAAU;KAAI;AACpB","sources":["packages/@react-aria/utils/src/useResizeObserver.ts"],"sourcesContent":["import {RefObject, useEffect} from 'react';\n\nfunction hasResizeObserver() {\n return typeof window.ResizeObserver !== 'undefined';\n}\n\ntype useResizeObserverOptionsType<T> = {\n ref: RefObject<T | undefined> | undefined,\n onResize: () => void\n}\n\nexport function useResizeObserver<T extends Element>(options: useResizeObserverOptionsType<T>) {\n const {ref, onResize} = options;\n\n useEffect(() => {\n let element = ref?.current;\n if (!element) {\n return;\n }\n\n if (!hasResizeObserver()) {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n } else {\n\n const resizeObserverInstance = new window.ResizeObserver((entries) => {\n if (!entries.length) {\n return;\n }\n\n onResize();\n });\n resizeObserverInstance.observe(element);\n\n return () => {\n if (element) {\n resizeObserverInstance.unobserve(element);\n }\n };\n }\n\n }, [onResize, ref]);\n}\n"],"names":[],"version":3,"file":"useResizeObserver.module.js.map"}
|