@react-aria/utils 3.17.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 +64 -40
- package/dist/main.js +63 -38
- package/dist/main.js.map +1 -1
- package/dist/module.js +64 -40
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +1 -0
- package/src/useDeepMemo.ts +27 -0
- package/src/useDrag1D.ts +2 -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/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
|
|
|
@@ -429,7 +429,7 @@ function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
|
|
|
429
429
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
430
430
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
431
431
|
* governing permissions and limitations under the License.
|
|
432
|
-
*/
|
|
432
|
+
*/ /* eslint-disable rulesdir/pure-render */
|
|
433
433
|
|
|
434
434
|
// Keep track of elements that we are currently handling dragging for via useDrag1D.
|
|
435
435
|
// If there's an ancestor and a descendant both using useDrag1D(), and the user starts
|
|
@@ -620,8 +620,8 @@ function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
|
620
620
|
id = (0, $bdb11010cef70236$export$f680877a34711e37)(id);
|
|
621
621
|
if (labelledBy && label) {
|
|
622
622
|
let ids = new Set([
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
id,
|
|
624
|
+
...labelledBy.trim().split(/\s+/)
|
|
625
625
|
]);
|
|
626
626
|
labelledBy = [
|
|
627
627
|
...ids
|
|
@@ -648,25 +648,20 @@ function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
|
648
648
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
649
649
|
* governing permissions and limitations under the License.
|
|
650
650
|
*/
|
|
651
|
-
|
|
652
651
|
function $df56164dff5785e2$export$4338b53315abf666(forwardedRef) {
|
|
653
652
|
const objRef = (0, $12uGp$useRef)();
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
else forwardedRef.current = null;
|
|
665
|
-
};
|
|
666
|
-
}, [
|
|
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
|
+
}), [
|
|
667
663
|
forwardedRef
|
|
668
664
|
]);
|
|
669
|
-
return objRef;
|
|
670
665
|
}
|
|
671
666
|
|
|
672
667
|
|
|
@@ -683,9 +678,17 @@ function $df56164dff5785e2$export$4338b53315abf666(forwardedRef) {
|
|
|
683
678
|
*/
|
|
684
679
|
function $4f58c5f72bcf79f7$export$496315a1608d9602(effect, dependencies) {
|
|
685
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
|
+
}, []);
|
|
686
688
|
(0, $12uGp$useEffect)(()=>{
|
|
687
689
|
if (isInitialMount.current) isInitialMount.current = false;
|
|
688
|
-
else effect();
|
|
690
|
+
else if (!lastDeps.current || dependencies.some((dep, i)=>!Object.is(dep, lastDeps[i]))) effect();
|
|
691
|
+
lastDeps.current = dependencies;
|
|
689
692
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
690
693
|
}, dependencies);
|
|
691
694
|
}
|
|
@@ -917,23 +920,48 @@ function $c87311424ea30a05$export$a11b0059900ceec8() {
|
|
|
917
920
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
918
921
|
* governing permissions and limitations under the License.
|
|
919
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
|
+
|
|
920
949
|
function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler, options) {
|
|
921
|
-
let
|
|
922
|
-
handlerRef.current = handler;
|
|
950
|
+
let handleEvent = (0, $8ae05eaa5c114e9c$export$7f54fc3180508a52)(handler);
|
|
923
951
|
let isDisabled = handler == null;
|
|
924
952
|
(0, $12uGp$useEffect)(()=>{
|
|
925
953
|
if (isDisabled) return;
|
|
926
954
|
let element = ref.current;
|
|
927
|
-
|
|
928
|
-
element.addEventListener(event, handler, options);
|
|
955
|
+
element.addEventListener(event, handleEvent, options);
|
|
929
956
|
return ()=>{
|
|
930
|
-
element.removeEventListener(event,
|
|
957
|
+
element.removeEventListener(event, handleEvent, options);
|
|
931
958
|
};
|
|
932
959
|
}, [
|
|
933
960
|
ref,
|
|
934
961
|
event,
|
|
935
962
|
options,
|
|
936
|
-
isDisabled
|
|
963
|
+
isDisabled,
|
|
964
|
+
handleEvent
|
|
937
965
|
]);
|
|
938
966
|
}
|
|
939
967
|
|
|
@@ -1061,6 +1089,7 @@ function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
|
|
|
1061
1089
|
}
|
|
1062
1090
|
|
|
1063
1091
|
|
|
1092
|
+
|
|
1064
1093
|
/*
|
|
1065
1094
|
* Copyright 2023 Adobe. All rights reserved.
|
|
1066
1095
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -1071,23 +1100,18 @@ function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
|
|
|
1071
1100
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1072
1101
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1073
1102
|
* governing permissions and limitations under the License.
|
|
1074
|
-
*/
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
(0, $
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
]);
|
|
1083
|
-
return (0, $12uGp$useCallback)((...args)=>{
|
|
1084
|
-
const f = ref.current;
|
|
1085
|
-
return f(...args);
|
|
1086
|
-
}, []);
|
|
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;
|
|
1087
1111
|
}
|
|
1088
1112
|
|
|
1089
1113
|
|
|
1090
1114
|
|
|
1091
1115
|
|
|
1092
|
-
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};
|
|
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};
|
|
1093
1117
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -49,6 +49,7 @@ $parcel$export(module.exports, "snapValueToStep", () => $1Yh1N$reactstatelyutils
|
|
|
49
49
|
$parcel$export(module.exports, "isVirtualClick", () => $577e795361f19be9$export$60278871457622de);
|
|
50
50
|
$parcel$export(module.exports, "isVirtualPointerEvent", () => $577e795361f19be9$export$29bf1b5f2c56cf63);
|
|
51
51
|
$parcel$export(module.exports, "useEffectEvent", () => $1254e5bb94ac8761$export$7f54fc3180508a52);
|
|
52
|
+
$parcel$export(module.exports, "useDeepMemo", () => $20e6e72fbf5dc81e$export$722debc0e56fea39);
|
|
52
53
|
/*
|
|
53
54
|
* Copyright 2020 Adobe. All rights reserved.
|
|
54
55
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -475,7 +476,7 @@ function $e8117ebcab55be6a$export$24490316f764c430(fn) {
|
|
|
475
476
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
476
477
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
477
478
|
* governing permissions and limitations under the License.
|
|
478
|
-
*/
|
|
479
|
+
*/ /* eslint-disable rulesdir/pure-render */
|
|
479
480
|
|
|
480
481
|
// Keep track of elements that we are currently handling dragging for via useDrag1D.
|
|
481
482
|
// If there's an ancestor and a descendant both using useDrag1D(), and the user starts
|
|
@@ -666,8 +667,8 @@ function $6ec78bde395c477d$export$d6875122194c7b44(props, defaultLabel) {
|
|
|
666
667
|
id = (0, $8c61827343eed941$export$f680877a34711e37)(id);
|
|
667
668
|
if (labelledBy && label) {
|
|
668
669
|
let ids = new Set([
|
|
669
|
-
|
|
670
|
-
|
|
670
|
+
id,
|
|
671
|
+
...labelledBy.trim().split(/\s+/)
|
|
671
672
|
]);
|
|
672
673
|
labelledBy = [
|
|
673
674
|
...ids
|
|
@@ -694,25 +695,20 @@ function $6ec78bde395c477d$export$d6875122194c7b44(props, defaultLabel) {
|
|
|
694
695
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
695
696
|
* governing permissions and limitations under the License.
|
|
696
697
|
*/
|
|
697
|
-
|
|
698
698
|
function $475b35fe72ba49b3$export$4338b53315abf666(forwardedRef) {
|
|
699
699
|
const objRef = (0, $1Yh1N$react.useRef)();
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
else forwardedRef.current = null;
|
|
711
|
-
};
|
|
712
|
-
}, [
|
|
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
|
+
}), [
|
|
713
710
|
forwardedRef
|
|
714
711
|
]);
|
|
715
|
-
return objRef;
|
|
716
712
|
}
|
|
717
713
|
|
|
718
714
|
|
|
@@ -729,9 +725,17 @@ function $475b35fe72ba49b3$export$4338b53315abf666(forwardedRef) {
|
|
|
729
725
|
*/
|
|
730
726
|
function $29293a6f5c75b37e$export$496315a1608d9602(effect, dependencies) {
|
|
731
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
|
+
}, []);
|
|
732
735
|
(0, $1Yh1N$react.useEffect)(()=>{
|
|
733
736
|
if (isInitialMount.current) isInitialMount.current = false;
|
|
734
|
-
else effect();
|
|
737
|
+
else if (!lastDeps.current || dependencies.some((dep, i)=>!Object.is(dep, lastDeps[i]))) effect();
|
|
738
|
+
lastDeps.current = dependencies;
|
|
735
739
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
736
740
|
}, dependencies);
|
|
737
741
|
}
|
|
@@ -963,23 +967,48 @@ function $9e20cff0af27e8cc$export$a11b0059900ceec8() {
|
|
|
963
967
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
964
968
|
* governing permissions and limitations under the License.
|
|
965
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
|
+
|
|
966
996
|
function $2a8c0bb1629926c8$export$90fc3a17d93f704c(ref, event, handler, options) {
|
|
967
|
-
let
|
|
968
|
-
handlerRef.current = handler;
|
|
997
|
+
let handleEvent = (0, $1254e5bb94ac8761$export$7f54fc3180508a52)(handler);
|
|
969
998
|
let isDisabled = handler == null;
|
|
970
999
|
(0, $1Yh1N$react.useEffect)(()=>{
|
|
971
1000
|
if (isDisabled) return;
|
|
972
1001
|
let element = ref.current;
|
|
973
|
-
|
|
974
|
-
element.addEventListener(event, handler, options);
|
|
1002
|
+
element.addEventListener(event, handleEvent, options);
|
|
975
1003
|
return ()=>{
|
|
976
|
-
element.removeEventListener(event,
|
|
1004
|
+
element.removeEventListener(event, handleEvent, options);
|
|
977
1005
|
};
|
|
978
1006
|
}, [
|
|
979
1007
|
ref,
|
|
980
1008
|
event,
|
|
981
1009
|
options,
|
|
982
|
-
isDisabled
|
|
1010
|
+
isDisabled,
|
|
1011
|
+
handleEvent
|
|
983
1012
|
]);
|
|
984
1013
|
}
|
|
985
1014
|
|
|
@@ -1107,6 +1136,7 @@ function $577e795361f19be9$export$29bf1b5f2c56cf63(event) {
|
|
|
1107
1136
|
}
|
|
1108
1137
|
|
|
1109
1138
|
|
|
1139
|
+
|
|
1110
1140
|
/*
|
|
1111
1141
|
* Copyright 2023 Adobe. All rights reserved.
|
|
1112
1142
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -1117,19 +1147,14 @@ function $577e795361f19be9$export$29bf1b5f2c56cf63(event) {
|
|
|
1117
1147
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1118
1148
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1119
1149
|
* governing permissions and limitations under the License.
|
|
1120
|
-
*/
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
(0, $
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
]);
|
|
1129
|
-
return (0, $1Yh1N$react.useCallback)((...args)=>{
|
|
1130
|
-
const f = ref.current;
|
|
1131
|
-
return f(...args);
|
|
1132
|
-
}, []);
|
|
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;
|
|
1133
1158
|
}
|
|
1134
1159
|
|
|
1135
1160
|
|