@react-aria/utils 3.16.0 → 3.18.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 +102 -41
- package/dist/main.js +102 -39
- package/dist/main.js.map +1 -1
- package/dist/module.js +102 -41
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +2 -0
- package/src/useDeepMemo.ts +27 -0
- package/src/useDrag1D.ts +2 -0
- package/src/useEffectEvent.ts +25 -0
- package/src/useEvent.ts +6 -9
- package/src/useLabels.ts +1 -1
- package/src/useObjectRef.ts +12 -27
- package/src/useUpdateEffect.ts +10 -1
- package/src/useValueEffect.ts +22 -19
package/dist/import.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {clamp as $4507461a1b870123$re_export$clamp, snapValueToStep as $4507461a1b870123$re_export$snapValueToStep} from "@react-stately/utils";
|
|
2
|
-
import $12uGp$react, {useState as $12uGp$useState, useRef as $12uGp$useRef, useCallback as $12uGp$useCallback, useEffect as $12uGp$useEffect} from "react";
|
|
2
|
+
import $12uGp$react, {useState as $12uGp$useState, useRef as $12uGp$useRef, useCallback as $12uGp$useCallback, useEffect as $12uGp$useEffect, useMemo as $12uGp$useMemo} from "react";
|
|
3
3
|
import {useSSRSafeId as $12uGp$useSSRSafeId} from "@react-aria/ssr";
|
|
4
4
|
import $12uGp$clsx from "clsx";
|
|
5
5
|
|
|
@@ -55,34 +55,45 @@ function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
|
|
|
55
55
|
let [value, setValue] = (0, $12uGp$useState)(defaultValue);
|
|
56
56
|
let valueRef = (0, $12uGp$useRef)(value);
|
|
57
57
|
let effect = (0, $12uGp$useRef)(null);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// which has the proper `value` in scope.
|
|
61
|
-
let nextRef = (0, $12uGp$useRef)(null);
|
|
62
|
-
nextRef.current = ()=>{
|
|
58
|
+
// Must be stable so that `queue` is stable.
|
|
59
|
+
let nextIter = (0, $12uGp$useCallback)(()=>{
|
|
63
60
|
// Run the generator to the next yield.
|
|
64
61
|
let newValue = effect.current.next();
|
|
62
|
+
while(!newValue.done && valueRef.current === newValue.value)// If the value is the same as the current value,
|
|
63
|
+
// then continue to the next yield. Otherwise,
|
|
64
|
+
// set the value in state and wait for the next layout effect.
|
|
65
|
+
newValue = effect.current.next();
|
|
65
66
|
// If the generator is done, reset the effect.
|
|
66
67
|
if (newValue.done) {
|
|
67
68
|
effect.current = null;
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
// Always update valueRef when setting the state.
|
|
72
|
+
// This is needed because the function is not regenerated with the new state value since
|
|
73
|
+
// they must be stable across renders. Instead, it gets carried in the ref, but the setState
|
|
74
|
+
// is also needed in order to cause a rerender.
|
|
75
|
+
setValue(newValue.value);
|
|
76
|
+
valueRef.current = newValue.value;
|
|
77
|
+
// this list of dependencies is stable, setState and refs never change after first render.
|
|
78
|
+
}, [
|
|
79
|
+
setValue,
|
|
80
|
+
valueRef,
|
|
81
|
+
effect
|
|
82
|
+
]);
|
|
76
83
|
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
77
84
|
// If there is an effect currently running, continue to the next yield.
|
|
78
|
-
if (effect.current)
|
|
85
|
+
if (effect.current) nextIter();
|
|
79
86
|
});
|
|
87
|
+
// queue must be a stable function, much like setState.
|
|
80
88
|
let queue = (0, $12uGp$useCallback)((fn)=>{
|
|
81
89
|
effect.current = fn(valueRef.current);
|
|
82
|
-
|
|
90
|
+
nextIter();
|
|
91
|
+
// this list of dependencies is stable, setState and refs never change after first render.
|
|
92
|
+
// in addition, nextIter is stable as outlined above
|
|
83
93
|
}, [
|
|
94
|
+
nextIter,
|
|
84
95
|
effect,
|
|
85
|
-
|
|
96
|
+
valueRef
|
|
86
97
|
]);
|
|
87
98
|
return [
|
|
88
99
|
value,
|
|
@@ -418,7 +429,7 @@ function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
|
|
|
418
429
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
419
430
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
420
431
|
* governing permissions and limitations under the License.
|
|
421
|
-
*/
|
|
432
|
+
*/ /* eslint-disable rulesdir/pure-render */
|
|
422
433
|
|
|
423
434
|
// Keep track of elements that we are currently handling dragging for via useDrag1D.
|
|
424
435
|
// If there's an ancestor and a descendant both using useDrag1D(), and the user starts
|
|
@@ -609,8 +620,8 @@ function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
|
609
620
|
id = (0, $bdb11010cef70236$export$f680877a34711e37)(id);
|
|
610
621
|
if (labelledBy && label) {
|
|
611
622
|
let ids = new Set([
|
|
612
|
-
|
|
613
|
-
|
|
623
|
+
id,
|
|
624
|
+
...labelledBy.trim().split(/\s+/)
|
|
614
625
|
]);
|
|
615
626
|
labelledBy = [
|
|
616
627
|
...ids
|
|
@@ -637,25 +648,20 @@ function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
|
637
648
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
638
649
|
* governing permissions and limitations under the License.
|
|
639
650
|
*/
|
|
640
|
-
|
|
641
651
|
function $df56164dff5785e2$export$4338b53315abf666(forwardedRef) {
|
|
642
652
|
const objRef = (0, $12uGp$useRef)();
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
else forwardedRef.current = null;
|
|
654
|
-
};
|
|
655
|
-
}, [
|
|
653
|
+
return (0, $12uGp$useMemo)(()=>({
|
|
654
|
+
get current () {
|
|
655
|
+
return objRef.current;
|
|
656
|
+
},
|
|
657
|
+
set current (value){
|
|
658
|
+
objRef.current = value;
|
|
659
|
+
if (typeof forwardedRef === "function") forwardedRef(value);
|
|
660
|
+
else if (forwardedRef) forwardedRef.current = value;
|
|
661
|
+
}
|
|
662
|
+
}), [
|
|
656
663
|
forwardedRef
|
|
657
664
|
]);
|
|
658
|
-
return objRef;
|
|
659
665
|
}
|
|
660
666
|
|
|
661
667
|
|
|
@@ -672,9 +678,17 @@ function $df56164dff5785e2$export$4338b53315abf666(forwardedRef) {
|
|
|
672
678
|
*/
|
|
673
679
|
function $4f58c5f72bcf79f7$export$496315a1608d9602(effect, dependencies) {
|
|
674
680
|
const isInitialMount = (0, $12uGp$useRef)(true);
|
|
681
|
+
const lastDeps = (0, $12uGp$useRef)(null);
|
|
682
|
+
(0, $12uGp$useEffect)(()=>{
|
|
683
|
+
isInitialMount.current = true;
|
|
684
|
+
return ()=>{
|
|
685
|
+
isInitialMount.current = false;
|
|
686
|
+
};
|
|
687
|
+
}, []);
|
|
675
688
|
(0, $12uGp$useEffect)(()=>{
|
|
676
689
|
if (isInitialMount.current) isInitialMount.current = false;
|
|
677
|
-
else effect();
|
|
690
|
+
else if (!lastDeps.current || dependencies.some((dep, i)=>!Object.is(dep, lastDeps[i]))) effect();
|
|
691
|
+
lastDeps.current = dependencies;
|
|
678
692
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
679
693
|
}, dependencies);
|
|
680
694
|
}
|
|
@@ -906,23 +920,48 @@ function $c87311424ea30a05$export$a11b0059900ceec8() {
|
|
|
906
920
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
907
921
|
* governing permissions and limitations under the License.
|
|
908
922
|
*/
|
|
923
|
+
/*
|
|
924
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
925
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
926
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
927
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
928
|
+
*
|
|
929
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
930
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
931
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
932
|
+
* governing permissions and limitations under the License.
|
|
933
|
+
*/
|
|
934
|
+
|
|
935
|
+
function $8ae05eaa5c114e9c$export$7f54fc3180508a52(fn) {
|
|
936
|
+
const ref = (0, $12uGp$useRef)(null);
|
|
937
|
+
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
938
|
+
ref.current = fn;
|
|
939
|
+
}, [
|
|
940
|
+
fn
|
|
941
|
+
]);
|
|
942
|
+
return (0, $12uGp$useCallback)((...args)=>{
|
|
943
|
+
const f = ref.current;
|
|
944
|
+
return f(...args);
|
|
945
|
+
}, []);
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
|
|
909
949
|
function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler, options) {
|
|
910
|
-
let
|
|
911
|
-
handlerRef.current = handler;
|
|
950
|
+
let handleEvent = (0, $8ae05eaa5c114e9c$export$7f54fc3180508a52)(handler);
|
|
912
951
|
let isDisabled = handler == null;
|
|
913
952
|
(0, $12uGp$useEffect)(()=>{
|
|
914
953
|
if (isDisabled) return;
|
|
915
954
|
let element = ref.current;
|
|
916
|
-
|
|
917
|
-
element.addEventListener(event, handler, options);
|
|
955
|
+
element.addEventListener(event, handleEvent, options);
|
|
918
956
|
return ()=>{
|
|
919
|
-
element.removeEventListener(event,
|
|
957
|
+
element.removeEventListener(event, handleEvent, options);
|
|
920
958
|
};
|
|
921
959
|
}, [
|
|
922
960
|
ref,
|
|
923
961
|
event,
|
|
924
962
|
options,
|
|
925
|
-
isDisabled
|
|
963
|
+
isDisabled,
|
|
964
|
+
handleEvent
|
|
926
965
|
]);
|
|
927
966
|
}
|
|
928
967
|
|
|
@@ -1051,6 +1090,28 @@ function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
|
|
|
1051
1090
|
|
|
1052
1091
|
|
|
1053
1092
|
|
|
1093
|
+
/*
|
|
1094
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
1095
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1096
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1097
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1098
|
+
*
|
|
1099
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1100
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1101
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1102
|
+
* governing permissions and limitations under the License.
|
|
1103
|
+
*/ /* eslint-disable rulesdir/pure-render */
|
|
1104
|
+
function $5a387cc49350e6db$export$722debc0e56fea39(value, isEqual) {
|
|
1105
|
+
// Using a ref during render is ok here because it's only an optimization – both values are equivalent.
|
|
1106
|
+
// If a render is thrown away, it'll still work the same no matter if the next render is the same or not.
|
|
1107
|
+
let lastValue = (0, $12uGp$useRef)(null);
|
|
1108
|
+
if (value && lastValue.current && isEqual(value, lastValue.current)) value = lastValue.current;
|
|
1109
|
+
lastValue.current = value;
|
|
1110
|
+
return value;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
|
|
1054
1115
|
|
|
1055
|
-
export {$bdb11010cef70236$export$f680877a34711e37 as useId, $bdb11010cef70236$export$cd8c9cb68f842629 as mergeIds, $bdb11010cef70236$export$b4cc09c592e8fdb8 as useSlotId, $ff5963eb1fccf552$export$e08e3b67e392101e as chain, $3ef42575df84b30b$export$9d1611c77c2fe928 as mergeProps, $5dc95899b306f630$export$c9058316764c140e as mergeRefs, $65484d02dcb7eb3e$export$457c3d6518dd4c6f as filterDOMProps, $7215afc6de606d6b$export$de79e2c695e052f3 as focusWithoutScrolling, $ab71dadb03a6fb2e$export$622cea445a1c5b7d as getOffset, $bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition, $9cc09df9fd7676be$export$7bbed75feba39706 as useDrag1D, $03deb23ff14920c4$export$4eaf04e54aa8eed6 as useGlobalListeners, $313b98861ee5dd6c$export$d6875122194c7b44 as useLabels, $df56164dff5785e2$export$4338b53315abf666 as useObjectRef, $4f58c5f72bcf79f7$export$496315a1608d9602 as useUpdateEffect, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c as useLayoutEffect, $9daab02d461809db$export$683480f191c0e3ea as useResizeObserver, $e7801be82b4b2a53$export$4debdb1a3f0fa79e as useSyncRef, $62d8ded9296f3872$export$cfa2225e87938781 as getScrollParent, $62d8ded9296f3872$export$2bb74740c4e19def as isScrollable, $5df64b3807dc15ee$export$d699905dd57c73ca as useViewportSize, $ef06256079686ba0$export$f8aeda7b10753fa1 as useDescription, $c87311424ea30a05$export$9ac100e40613ea10 as isMac, $c87311424ea30a05$export$186c6964ca17d99 as isIPhone, $c87311424ea30a05$export$7bef049ce92e4224 as isIPad, $c87311424ea30a05$export$fedb369cb70207f1 as isIOS, $c87311424ea30a05$export$e1865c3bedcd822b as isAppleDevice, $c87311424ea30a05$export$78551043582a6a98 as isWebKit, $c87311424ea30a05$export$6446a186d09e379e as isChrome, $c87311424ea30a05$export$a11b0059900ceec8 as isAndroid, $e9faafb641e167db$export$90fc3a17d93f704c as useEvent, $1dbecbe27a04f9af$export$14d238f342723f25 as useValueEffect, $2f04cbc44ee30ce0$export$53a0910f038337bd as scrollIntoView, $2f04cbc44ee30ce0$export$c826860796309d1b as scrollIntoViewport, $4507461a1b870123$re_export$clamp as clamp, $4507461a1b870123$re_export$snapValueToStep as snapValueToStep, $6a7db85432448f7f$export$60278871457622de as isVirtualClick, $6a7db85432448f7f$export$29bf1b5f2c56cf63 as isVirtualPointerEvent};
|
|
1116
|
+
export {$bdb11010cef70236$export$f680877a34711e37 as useId, $bdb11010cef70236$export$cd8c9cb68f842629 as mergeIds, $bdb11010cef70236$export$b4cc09c592e8fdb8 as useSlotId, $ff5963eb1fccf552$export$e08e3b67e392101e as chain, $3ef42575df84b30b$export$9d1611c77c2fe928 as mergeProps, $5dc95899b306f630$export$c9058316764c140e as mergeRefs, $65484d02dcb7eb3e$export$457c3d6518dd4c6f as filterDOMProps, $7215afc6de606d6b$export$de79e2c695e052f3 as focusWithoutScrolling, $ab71dadb03a6fb2e$export$622cea445a1c5b7d as getOffset, $bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition, $9cc09df9fd7676be$export$7bbed75feba39706 as useDrag1D, $03deb23ff14920c4$export$4eaf04e54aa8eed6 as useGlobalListeners, $313b98861ee5dd6c$export$d6875122194c7b44 as useLabels, $df56164dff5785e2$export$4338b53315abf666 as useObjectRef, $4f58c5f72bcf79f7$export$496315a1608d9602 as useUpdateEffect, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c as useLayoutEffect, $9daab02d461809db$export$683480f191c0e3ea as useResizeObserver, $e7801be82b4b2a53$export$4debdb1a3f0fa79e as useSyncRef, $62d8ded9296f3872$export$cfa2225e87938781 as getScrollParent, $62d8ded9296f3872$export$2bb74740c4e19def as isScrollable, $5df64b3807dc15ee$export$d699905dd57c73ca as useViewportSize, $ef06256079686ba0$export$f8aeda7b10753fa1 as useDescription, $c87311424ea30a05$export$9ac100e40613ea10 as isMac, $c87311424ea30a05$export$186c6964ca17d99 as isIPhone, $c87311424ea30a05$export$7bef049ce92e4224 as isIPad, $c87311424ea30a05$export$fedb369cb70207f1 as isIOS, $c87311424ea30a05$export$e1865c3bedcd822b as isAppleDevice, $c87311424ea30a05$export$78551043582a6a98 as isWebKit, $c87311424ea30a05$export$6446a186d09e379e as isChrome, $c87311424ea30a05$export$a11b0059900ceec8 as isAndroid, $e9faafb641e167db$export$90fc3a17d93f704c as useEvent, $1dbecbe27a04f9af$export$14d238f342723f25 as useValueEffect, $2f04cbc44ee30ce0$export$53a0910f038337bd as scrollIntoView, $2f04cbc44ee30ce0$export$c826860796309d1b as scrollIntoViewport, $4507461a1b870123$re_export$clamp as clamp, $4507461a1b870123$re_export$snapValueToStep as snapValueToStep, $6a7db85432448f7f$export$60278871457622de as isVirtualClick, $6a7db85432448f7f$export$29bf1b5f2c56cf63 as isVirtualPointerEvent, $8ae05eaa5c114e9c$export$7f54fc3180508a52 as useEffectEvent, $5a387cc49350e6db$export$722debc0e56fea39 as useDeepMemo};
|
|
1056
1117
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -48,6 +48,8 @@ $parcel$export(module.exports, "clamp", () => $1Yh1N$reactstatelyutils.clamp);
|
|
|
48
48
|
$parcel$export(module.exports, "snapValueToStep", () => $1Yh1N$reactstatelyutils.snapValueToStep);
|
|
49
49
|
$parcel$export(module.exports, "isVirtualClick", () => $577e795361f19be9$export$60278871457622de);
|
|
50
50
|
$parcel$export(module.exports, "isVirtualPointerEvent", () => $577e795361f19be9$export$29bf1b5f2c56cf63);
|
|
51
|
+
$parcel$export(module.exports, "useEffectEvent", () => $1254e5bb94ac8761$export$7f54fc3180508a52);
|
|
52
|
+
$parcel$export(module.exports, "useDeepMemo", () => $20e6e72fbf5dc81e$export$722debc0e56fea39);
|
|
51
53
|
/*
|
|
52
54
|
* Copyright 2020 Adobe. All rights reserved.
|
|
53
55
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -100,34 +102,45 @@ function $19a2307bfabafaf1$export$14d238f342723f25(defaultValue) {
|
|
|
100
102
|
let [value, setValue] = (0, $1Yh1N$react.useState)(defaultValue);
|
|
101
103
|
let valueRef = (0, $1Yh1N$react.useRef)(value);
|
|
102
104
|
let effect = (0, $1Yh1N$react.useRef)(null);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
// which has the proper `value` in scope.
|
|
106
|
-
let nextRef = (0, $1Yh1N$react.useRef)(null);
|
|
107
|
-
nextRef.current = ()=>{
|
|
105
|
+
// Must be stable so that `queue` is stable.
|
|
106
|
+
let nextIter = (0, $1Yh1N$react.useCallback)(()=>{
|
|
108
107
|
// Run the generator to the next yield.
|
|
109
108
|
let newValue = effect.current.next();
|
|
109
|
+
while(!newValue.done && valueRef.current === newValue.value)// If the value is the same as the current value,
|
|
110
|
+
// then continue to the next yield. Otherwise,
|
|
111
|
+
// set the value in state and wait for the next layout effect.
|
|
112
|
+
newValue = effect.current.next();
|
|
110
113
|
// If the generator is done, reset the effect.
|
|
111
114
|
if (newValue.done) {
|
|
112
115
|
effect.current = null;
|
|
113
116
|
return;
|
|
114
117
|
}
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
// Always update valueRef when setting the state.
|
|
119
|
+
// This is needed because the function is not regenerated with the new state value since
|
|
120
|
+
// they must be stable across renders. Instead, it gets carried in the ref, but the setState
|
|
121
|
+
// is also needed in order to cause a rerender.
|
|
122
|
+
setValue(newValue.value);
|
|
123
|
+
valueRef.current = newValue.value;
|
|
124
|
+
// this list of dependencies is stable, setState and refs never change after first render.
|
|
125
|
+
}, [
|
|
126
|
+
setValue,
|
|
127
|
+
valueRef,
|
|
128
|
+
effect
|
|
129
|
+
]);
|
|
121
130
|
(0, $78605a5d7424e31b$export$e5c5a5f917a5871c)(()=>{
|
|
122
131
|
// If there is an effect currently running, continue to the next yield.
|
|
123
|
-
if (effect.current)
|
|
132
|
+
if (effect.current) nextIter();
|
|
124
133
|
});
|
|
134
|
+
// queue must be a stable function, much like setState.
|
|
125
135
|
let queue = (0, $1Yh1N$react.useCallback)((fn)=>{
|
|
126
136
|
effect.current = fn(valueRef.current);
|
|
127
|
-
|
|
137
|
+
nextIter();
|
|
138
|
+
// this list of dependencies is stable, setState and refs never change after first render.
|
|
139
|
+
// in addition, nextIter is stable as outlined above
|
|
128
140
|
}, [
|
|
141
|
+
nextIter,
|
|
129
142
|
effect,
|
|
130
|
-
|
|
143
|
+
valueRef
|
|
131
144
|
]);
|
|
132
145
|
return [
|
|
133
146
|
value,
|
|
@@ -463,7 +476,7 @@ function $e8117ebcab55be6a$export$24490316f764c430(fn) {
|
|
|
463
476
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
464
477
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
465
478
|
* governing permissions and limitations under the License.
|
|
466
|
-
*/
|
|
479
|
+
*/ /* eslint-disable rulesdir/pure-render */
|
|
467
480
|
|
|
468
481
|
// Keep track of elements that we are currently handling dragging for via useDrag1D.
|
|
469
482
|
// If there's an ancestor and a descendant both using useDrag1D(), and the user starts
|
|
@@ -654,8 +667,8 @@ function $6ec78bde395c477d$export$d6875122194c7b44(props, defaultLabel) {
|
|
|
654
667
|
id = (0, $8c61827343eed941$export$f680877a34711e37)(id);
|
|
655
668
|
if (labelledBy && label) {
|
|
656
669
|
let ids = new Set([
|
|
657
|
-
|
|
658
|
-
|
|
670
|
+
id,
|
|
671
|
+
...labelledBy.trim().split(/\s+/)
|
|
659
672
|
]);
|
|
660
673
|
labelledBy = [
|
|
661
674
|
...ids
|
|
@@ -682,25 +695,20 @@ function $6ec78bde395c477d$export$d6875122194c7b44(props, defaultLabel) {
|
|
|
682
695
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
683
696
|
* governing permissions and limitations under the License.
|
|
684
697
|
*/
|
|
685
|
-
|
|
686
698
|
function $475b35fe72ba49b3$export$4338b53315abf666(forwardedRef) {
|
|
687
699
|
const objRef = (0, $1Yh1N$react.useRef)();
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
else forwardedRef.current = null;
|
|
699
|
-
};
|
|
700
|
-
}, [
|
|
700
|
+
return (0, $1Yh1N$react.useMemo)(()=>({
|
|
701
|
+
get current () {
|
|
702
|
+
return objRef.current;
|
|
703
|
+
},
|
|
704
|
+
set current (value){
|
|
705
|
+
objRef.current = value;
|
|
706
|
+
if (typeof forwardedRef === "function") forwardedRef(value);
|
|
707
|
+
else if (forwardedRef) forwardedRef.current = value;
|
|
708
|
+
}
|
|
709
|
+
}), [
|
|
701
710
|
forwardedRef
|
|
702
711
|
]);
|
|
703
|
-
return objRef;
|
|
704
712
|
}
|
|
705
713
|
|
|
706
714
|
|
|
@@ -717,9 +725,17 @@ function $475b35fe72ba49b3$export$4338b53315abf666(forwardedRef) {
|
|
|
717
725
|
*/
|
|
718
726
|
function $29293a6f5c75b37e$export$496315a1608d9602(effect, dependencies) {
|
|
719
727
|
const isInitialMount = (0, $1Yh1N$react.useRef)(true);
|
|
728
|
+
const lastDeps = (0, $1Yh1N$react.useRef)(null);
|
|
729
|
+
(0, $1Yh1N$react.useEffect)(()=>{
|
|
730
|
+
isInitialMount.current = true;
|
|
731
|
+
return ()=>{
|
|
732
|
+
isInitialMount.current = false;
|
|
733
|
+
};
|
|
734
|
+
}, []);
|
|
720
735
|
(0, $1Yh1N$react.useEffect)(()=>{
|
|
721
736
|
if (isInitialMount.current) isInitialMount.current = false;
|
|
722
|
-
else effect();
|
|
737
|
+
else if (!lastDeps.current || dependencies.some((dep, i)=>!Object.is(dep, lastDeps[i]))) effect();
|
|
738
|
+
lastDeps.current = dependencies;
|
|
723
739
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
724
740
|
}, dependencies);
|
|
725
741
|
}
|
|
@@ -951,23 +967,48 @@ function $9e20cff0af27e8cc$export$a11b0059900ceec8() {
|
|
|
951
967
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
952
968
|
* governing permissions and limitations under the License.
|
|
953
969
|
*/
|
|
970
|
+
/*
|
|
971
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
972
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
973
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
974
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
975
|
+
*
|
|
976
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
977
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
978
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
979
|
+
* governing permissions and limitations under the License.
|
|
980
|
+
*/
|
|
981
|
+
|
|
982
|
+
function $1254e5bb94ac8761$export$7f54fc3180508a52(fn) {
|
|
983
|
+
const ref = (0, $1Yh1N$react.useRef)(null);
|
|
984
|
+
(0, $78605a5d7424e31b$export$e5c5a5f917a5871c)(()=>{
|
|
985
|
+
ref.current = fn;
|
|
986
|
+
}, [
|
|
987
|
+
fn
|
|
988
|
+
]);
|
|
989
|
+
return (0, $1Yh1N$react.useCallback)((...args)=>{
|
|
990
|
+
const f = ref.current;
|
|
991
|
+
return f(...args);
|
|
992
|
+
}, []);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
|
|
954
996
|
function $2a8c0bb1629926c8$export$90fc3a17d93f704c(ref, event, handler, options) {
|
|
955
|
-
let
|
|
956
|
-
handlerRef.current = handler;
|
|
997
|
+
let handleEvent = (0, $1254e5bb94ac8761$export$7f54fc3180508a52)(handler);
|
|
957
998
|
let isDisabled = handler == null;
|
|
958
999
|
(0, $1Yh1N$react.useEffect)(()=>{
|
|
959
1000
|
if (isDisabled) return;
|
|
960
1001
|
let element = ref.current;
|
|
961
|
-
|
|
962
|
-
element.addEventListener(event, handler, options);
|
|
1002
|
+
element.addEventListener(event, handleEvent, options);
|
|
963
1003
|
return ()=>{
|
|
964
|
-
element.removeEventListener(event,
|
|
1004
|
+
element.removeEventListener(event, handleEvent, options);
|
|
965
1005
|
};
|
|
966
1006
|
}, [
|
|
967
1007
|
ref,
|
|
968
1008
|
event,
|
|
969
1009
|
options,
|
|
970
|
-
isDisabled
|
|
1010
|
+
isDisabled,
|
|
1011
|
+
handleEvent
|
|
971
1012
|
]);
|
|
972
1013
|
}
|
|
973
1014
|
|
|
@@ -1096,5 +1137,27 @@ function $577e795361f19be9$export$29bf1b5f2c56cf63(event) {
|
|
|
1096
1137
|
|
|
1097
1138
|
|
|
1098
1139
|
|
|
1140
|
+
/*
|
|
1141
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
1142
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1143
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1144
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1145
|
+
*
|
|
1146
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1147
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1148
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1149
|
+
* governing permissions and limitations under the License.
|
|
1150
|
+
*/ /* eslint-disable rulesdir/pure-render */
|
|
1151
|
+
function $20e6e72fbf5dc81e$export$722debc0e56fea39(value, isEqual) {
|
|
1152
|
+
// Using a ref during render is ok here because it's only an optimization – both values are equivalent.
|
|
1153
|
+
// If a render is thrown away, it'll still work the same no matter if the next render is the same or not.
|
|
1154
|
+
let lastValue = (0, $1Yh1N$react.useRef)(null);
|
|
1155
|
+
if (value && lastValue.current && isEqual(value, lastValue.current)) value = lastValue.current;
|
|
1156
|
+
lastValue.current = value;
|
|
1157
|
+
return value;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
|
|
1099
1162
|
|
|
1100
1163
|
//# sourceMappingURL=main.js.map
|