@react-aria/utils 3.19.0 → 3.21.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 +224 -119
- package/dist/main.js +226 -116
- package/dist/main.js.map +1 -1
- package/dist/module.js +224 -119
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +15 -10
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/filterDOMProps.ts +16 -3
- package/src/index.ts +1 -0
- package/src/isVirtualEvent.ts +1 -1
- package/src/openLink.tsx +154 -0
- package/src/platform.ts +4 -0
- package/src/useSyncRef.ts +1 -1
- package/src/useValueEffect.ts +20 -27
- package/src/useViewportSize.ts +3 -1
package/dist/main.js
CHANGED
|
@@ -19,6 +19,11 @@ $parcel$export(module.exports, "mergeRefs", () => $f05dc24eafaeb7e2$export$c9058
|
|
|
19
19
|
$parcel$export(module.exports, "filterDOMProps", () => $8d15d0e1797d4238$export$457c3d6518dd4c6f);
|
|
20
20
|
$parcel$export(module.exports, "focusWithoutScrolling", () => $1117b6c0d4c4c164$export$de79e2c695e052f3);
|
|
21
21
|
$parcel$export(module.exports, "getOffset", () => $16ec41ef3e36c19c$export$622cea445a1c5b7d);
|
|
22
|
+
$parcel$export(module.exports, "openLink", () => $4068a0fae83b6d84$export$95185d699e05d4d7);
|
|
23
|
+
$parcel$export(module.exports, "getSyntheticLinkProps", () => $4068a0fae83b6d84$export$51437d503373d223);
|
|
24
|
+
$parcel$export(module.exports, "RouterProvider", () => $4068a0fae83b6d84$export$323e4fc2fa4753fb);
|
|
25
|
+
$parcel$export(module.exports, "shouldClientNavigate", () => $4068a0fae83b6d84$export$efa8c9099e530235);
|
|
26
|
+
$parcel$export(module.exports, "useRouter", () => $4068a0fae83b6d84$export$9a302a45f65d0572);
|
|
22
27
|
$parcel$export(module.exports, "runAfterTransition", () => $e8117ebcab55be6a$export$24490316f764c430);
|
|
23
28
|
$parcel$export(module.exports, "useDrag1D", () => $28ed3fb20343b78b$export$7bbed75feba39706);
|
|
24
29
|
$parcel$export(module.exports, "useGlobalListeners", () => $4571ff54ac709100$export$4eaf04e54aa8eed6);
|
|
@@ -98,51 +103,59 @@ const $78605a5d7424e31b$export$e5c5a5f917a5871c = typeof document !== "undefined
|
|
|
98
103
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
99
104
|
* governing permissions and limitations under the License.
|
|
100
105
|
*/
|
|
106
|
+
/*
|
|
107
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
108
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
109
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
110
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
111
|
+
*
|
|
112
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
113
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
114
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
115
|
+
* governing permissions and limitations under the License.
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
function $1254e5bb94ac8761$export$7f54fc3180508a52(fn) {
|
|
119
|
+
const ref = (0, $1Yh1N$react.useRef)(null);
|
|
120
|
+
(0, $78605a5d7424e31b$export$e5c5a5f917a5871c)(()=>{
|
|
121
|
+
ref.current = fn;
|
|
122
|
+
}, [
|
|
123
|
+
fn
|
|
124
|
+
]);
|
|
125
|
+
return (0, $1Yh1N$react.useCallback)((...args)=>{
|
|
126
|
+
const f = ref.current;
|
|
127
|
+
return f(...args);
|
|
128
|
+
}, []);
|
|
129
|
+
}
|
|
130
|
+
|
|
101
131
|
|
|
102
132
|
function $19a2307bfabafaf1$export$14d238f342723f25(defaultValue) {
|
|
103
133
|
let [value, setValue] = (0, $1Yh1N$react.useState)(defaultValue);
|
|
104
|
-
let valueRef = (0, $1Yh1N$react.useRef)(value);
|
|
105
134
|
let effect = (0, $1Yh1N$react.useRef)(null);
|
|
106
|
-
//
|
|
107
|
-
|
|
135
|
+
// Store the function in a ref so we can always access the current version
|
|
136
|
+
// which has the proper `value` in scope.
|
|
137
|
+
let nextRef = (0, $1254e5bb94ac8761$export$7f54fc3180508a52)(()=>{
|
|
108
138
|
// Run the generator to the next yield.
|
|
109
139
|
let newValue = effect.current.next();
|
|
110
|
-
while(!newValue.done && valueRef.current === newValue.value)// If the value is the same as the current value,
|
|
111
|
-
// then continue to the next yield. Otherwise,
|
|
112
|
-
// set the value in state and wait for the next layout effect.
|
|
113
|
-
newValue = effect.current.next();
|
|
114
140
|
// If the generator is done, reset the effect.
|
|
115
141
|
if (newValue.done) {
|
|
116
142
|
effect.current = null;
|
|
117
143
|
return;
|
|
118
144
|
}
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
|
|
123
|
-
setValue(newValue.value);
|
|
124
|
-
|
|
125
|
-
// this list of dependencies is stable, setState and refs never change after first render.
|
|
126
|
-
}, [
|
|
127
|
-
setValue,
|
|
128
|
-
valueRef,
|
|
129
|
-
effect
|
|
130
|
-
]);
|
|
145
|
+
// If the value is the same as the current value,
|
|
146
|
+
// then continue to the next yield. Otherwise,
|
|
147
|
+
// set the value in state and wait for the next layout effect.
|
|
148
|
+
if (value === newValue.value) nextRef();
|
|
149
|
+
else setValue(newValue.value);
|
|
150
|
+
});
|
|
131
151
|
(0, $78605a5d7424e31b$export$e5c5a5f917a5871c)(()=>{
|
|
132
152
|
// If there is an effect currently running, continue to the next yield.
|
|
133
|
-
if (effect.current)
|
|
153
|
+
if (effect.current) nextRef();
|
|
154
|
+
});
|
|
155
|
+
let queue = (0, $1254e5bb94ac8761$export$7f54fc3180508a52)((fn)=>{
|
|
156
|
+
effect.current = fn(value);
|
|
157
|
+
nextRef();
|
|
134
158
|
});
|
|
135
|
-
// queue must be a stable function, much like setState.
|
|
136
|
-
let queue = (0, $1Yh1N$react.useCallback)((fn)=>{
|
|
137
|
-
effect.current = fn(valueRef.current);
|
|
138
|
-
nextIter();
|
|
139
|
-
// this list of dependencies is stable, setState and refs never change after first render.
|
|
140
|
-
// in addition, nextIter is stable as outlined above
|
|
141
|
-
}, [
|
|
142
|
-
nextIter,
|
|
143
|
-
effect,
|
|
144
|
-
valueRef
|
|
145
|
-
]);
|
|
146
159
|
return [
|
|
147
160
|
value,
|
|
148
161
|
queue
|
|
@@ -308,11 +321,20 @@ const $8d15d0e1797d4238$var$labelablePropNames = new Set([
|
|
|
308
321
|
"aria-describedby",
|
|
309
322
|
"aria-details"
|
|
310
323
|
]);
|
|
324
|
+
// See LinkDOMProps in dom.d.ts.
|
|
325
|
+
const $8d15d0e1797d4238$var$linkPropNames = new Set([
|
|
326
|
+
"href",
|
|
327
|
+
"target",
|
|
328
|
+
"rel",
|
|
329
|
+
"download",
|
|
330
|
+
"ping",
|
|
331
|
+
"referrerPolicy"
|
|
332
|
+
]);
|
|
311
333
|
const $8d15d0e1797d4238$var$propRe = /^(data-.*)$/;
|
|
312
334
|
function $8d15d0e1797d4238$export$457c3d6518dd4c6f(props, opts = {}) {
|
|
313
|
-
let { labelable: labelable , propNames: propNames
|
|
335
|
+
let { labelable: labelable, isLink: isLink, propNames: propNames } = opts;
|
|
314
336
|
let filteredProps = {};
|
|
315
|
-
for(const prop in props)if (Object.prototype.hasOwnProperty.call(props, prop) && ($8d15d0e1797d4238$var$DOMPropNames.has(prop) || labelable && $8d15d0e1797d4238$var$labelablePropNames.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $8d15d0e1797d4238$var$propRe.test(prop))) filteredProps[prop] = props[prop];
|
|
337
|
+
for(const prop in props)if (Object.prototype.hasOwnProperty.call(props, prop) && ($8d15d0e1797d4238$var$DOMPropNames.has(prop) || labelable && $8d15d0e1797d4238$var$labelablePropNames.has(prop) || isLink && $8d15d0e1797d4238$var$linkPropNames.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $8d15d0e1797d4238$var$propRe.test(prop))) filteredProps[prop] = props[prop];
|
|
316
338
|
return filteredProps;
|
|
317
339
|
}
|
|
318
340
|
|
|
@@ -375,7 +397,7 @@ function $1117b6c0d4c4c164$var$getScrollableElements(element) {
|
|
|
375
397
|
return scrollableElements;
|
|
376
398
|
}
|
|
377
399
|
function $1117b6c0d4c4c164$var$restoreScrollPosition(scrollableElements) {
|
|
378
|
-
for (let { element: element
|
|
400
|
+
for (let { element: element, scrollTop: scrollTop, scrollLeft: scrollLeft } of scrollableElements){
|
|
379
401
|
element.scrollTop = scrollTop;
|
|
380
402
|
element.scrollLeft = scrollLeft;
|
|
381
403
|
}
|
|
@@ -399,6 +421,162 @@ function $1117b6c0d4c4c164$var$restoreScrollPosition(scrollableElements) {
|
|
|
399
421
|
}
|
|
400
422
|
|
|
401
423
|
|
|
424
|
+
/*
|
|
425
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
426
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
427
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
428
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
429
|
+
*
|
|
430
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
431
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
432
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
433
|
+
* governing permissions and limitations under the License.
|
|
434
|
+
*/ /*
|
|
435
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
436
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
437
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
438
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
439
|
+
*
|
|
440
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
441
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
442
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
443
|
+
* governing permissions and limitations under the License.
|
|
444
|
+
*/ function $9e20cff0af27e8cc$var$testUserAgent(re) {
|
|
445
|
+
var _window_navigator_userAgentData;
|
|
446
|
+
if (typeof window === "undefined" || window.navigator == null) return false;
|
|
447
|
+
return ((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand)=>re.test(brand.brand))) || re.test(window.navigator.userAgent);
|
|
448
|
+
}
|
|
449
|
+
function $9e20cff0af27e8cc$var$testPlatform(re) {
|
|
450
|
+
var _window_navigator_userAgentData;
|
|
451
|
+
return typeof window !== "undefined" && window.navigator != null ? re.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
|
|
452
|
+
}
|
|
453
|
+
function $9e20cff0af27e8cc$export$9ac100e40613ea10() {
|
|
454
|
+
return $9e20cff0af27e8cc$var$testPlatform(/^Mac/i);
|
|
455
|
+
}
|
|
456
|
+
function $9e20cff0af27e8cc$export$186c6964ca17d99() {
|
|
457
|
+
return $9e20cff0af27e8cc$var$testPlatform(/^iPhone/i);
|
|
458
|
+
}
|
|
459
|
+
function $9e20cff0af27e8cc$export$7bef049ce92e4224() {
|
|
460
|
+
return $9e20cff0af27e8cc$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
461
|
+
$9e20cff0af27e8cc$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
462
|
+
}
|
|
463
|
+
function $9e20cff0af27e8cc$export$fedb369cb70207f1() {
|
|
464
|
+
return $9e20cff0af27e8cc$export$186c6964ca17d99() || $9e20cff0af27e8cc$export$7bef049ce92e4224();
|
|
465
|
+
}
|
|
466
|
+
function $9e20cff0af27e8cc$export$e1865c3bedcd822b() {
|
|
467
|
+
return $9e20cff0af27e8cc$export$9ac100e40613ea10() || $9e20cff0af27e8cc$export$fedb369cb70207f1();
|
|
468
|
+
}
|
|
469
|
+
function $9e20cff0af27e8cc$export$78551043582a6a98() {
|
|
470
|
+
return $9e20cff0af27e8cc$var$testUserAgent(/AppleWebKit/i) && !$9e20cff0af27e8cc$export$6446a186d09e379e();
|
|
471
|
+
}
|
|
472
|
+
function $9e20cff0af27e8cc$export$6446a186d09e379e() {
|
|
473
|
+
return $9e20cff0af27e8cc$var$testUserAgent(/Chrome/i);
|
|
474
|
+
}
|
|
475
|
+
function $9e20cff0af27e8cc$export$a11b0059900ceec8() {
|
|
476
|
+
return $9e20cff0af27e8cc$var$testUserAgent(/Android/i);
|
|
477
|
+
}
|
|
478
|
+
function $9e20cff0af27e8cc$export$b7d78993b74f766d() {
|
|
479
|
+
return $9e20cff0af27e8cc$var$testUserAgent(/Firefox/i);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
const $4068a0fae83b6d84$var$RouterContext = /*#__PURE__*/ (0, $1Yh1N$react.createContext)({
|
|
486
|
+
isNative: true,
|
|
487
|
+
open: $4068a0fae83b6d84$var$openSyntheticLink
|
|
488
|
+
});
|
|
489
|
+
function $4068a0fae83b6d84$export$323e4fc2fa4753fb(props) {
|
|
490
|
+
let { children: children, navigate: navigate } = props;
|
|
491
|
+
let ctx = (0, $1Yh1N$react.useMemo)(()=>({
|
|
492
|
+
isNative: false,
|
|
493
|
+
open: (target, modifiers)=>{
|
|
494
|
+
$4068a0fae83b6d84$var$getSyntheticLink(target, (link)=>{
|
|
495
|
+
if ($4068a0fae83b6d84$export$efa8c9099e530235(link, modifiers)) navigate(link.pathname + link.search + link.hash);
|
|
496
|
+
else $4068a0fae83b6d84$export$95185d699e05d4d7(link, modifiers);
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
}), [
|
|
500
|
+
navigate
|
|
501
|
+
]);
|
|
502
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($1Yh1N$react))).createElement($4068a0fae83b6d84$var$RouterContext.Provider, {
|
|
503
|
+
value: ctx
|
|
504
|
+
}, children);
|
|
505
|
+
}
|
|
506
|
+
function $4068a0fae83b6d84$export$9a302a45f65d0572() {
|
|
507
|
+
return (0, $1Yh1N$react.useContext)($4068a0fae83b6d84$var$RouterContext);
|
|
508
|
+
}
|
|
509
|
+
function $4068a0fae83b6d84$export$efa8c9099e530235(link, modifiers) {
|
|
510
|
+
// Use getAttribute here instead of link.target. Firefox will default link.target to "_parent" when inside an iframe.
|
|
511
|
+
let target = link.getAttribute("target");
|
|
512
|
+
return (!target || target === "_self") && link.origin === location.origin && !link.hasAttribute("download") && !modifiers.metaKey && // open in new tab (mac)
|
|
513
|
+
!modifiers.ctrlKey && // open in new tab (windows)
|
|
514
|
+
!modifiers.altKey && // download
|
|
515
|
+
!modifiers.shiftKey;
|
|
516
|
+
}
|
|
517
|
+
function $4068a0fae83b6d84$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
|
|
518
|
+
var _window_event, _window_event_type;
|
|
519
|
+
let { metaKey: metaKey, ctrlKey: ctrlKey, altKey: altKey, shiftKey: shiftKey } = modifiers;
|
|
520
|
+
// Firefox does not recognize keyboard events as a user action by default, and the popup blocker
|
|
521
|
+
// will prevent links with target="_blank" from opening. However, it does allow the event if the
|
|
522
|
+
// Command/Control key is held, which opens the link in a background tab. This seems like the best we can do.
|
|
523
|
+
// See https://bugzilla.mozilla.org/show_bug.cgi?id=257870 and https://bugzilla.mozilla.org/show_bug.cgi?id=746640.
|
|
524
|
+
if ((0, $9e20cff0af27e8cc$export$b7d78993b74f766d)() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
|
|
525
|
+
if ((0, $9e20cff0af27e8cc$export$9ac100e40613ea10)()) metaKey = true;
|
|
526
|
+
else ctrlKey = true;
|
|
527
|
+
}
|
|
528
|
+
// WebKit does not support firing click events with modifier keys, but does support keyboard events.
|
|
529
|
+
// https://github.com/WebKit/WebKit/blob/c03d0ac6e6db178f90923a0a63080b5ca210d25f/Source/WebCore/html/HTMLAnchorElement.cpp#L184
|
|
530
|
+
let event = (0, $9e20cff0af27e8cc$export$78551043582a6a98)() && (0, $9e20cff0af27e8cc$export$9ac100e40613ea10)() && !(0, $9e20cff0af27e8cc$export$7bef049ce92e4224)() && true ? new KeyboardEvent("keydown", {
|
|
531
|
+
keyIdentifier: "Enter",
|
|
532
|
+
metaKey: metaKey,
|
|
533
|
+
ctrlKey: ctrlKey,
|
|
534
|
+
altKey: altKey,
|
|
535
|
+
shiftKey: shiftKey
|
|
536
|
+
}) : new MouseEvent("click", {
|
|
537
|
+
metaKey: metaKey,
|
|
538
|
+
ctrlKey: ctrlKey,
|
|
539
|
+
altKey: altKey,
|
|
540
|
+
shiftKey: shiftKey,
|
|
541
|
+
bubbles: true,
|
|
542
|
+
cancelable: true
|
|
543
|
+
});
|
|
544
|
+
$4068a0fae83b6d84$export$95185d699e05d4d7.isOpening = setOpening;
|
|
545
|
+
(0, $1117b6c0d4c4c164$export$de79e2c695e052f3)(target);
|
|
546
|
+
target.dispatchEvent(event);
|
|
547
|
+
$4068a0fae83b6d84$export$95185d699e05d4d7.isOpening = false;
|
|
548
|
+
}
|
|
549
|
+
$4068a0fae83b6d84$export$95185d699e05d4d7.isOpening = false;
|
|
550
|
+
function $4068a0fae83b6d84$var$getSyntheticLink(target, open) {
|
|
551
|
+
if (target instanceof HTMLAnchorElement) open(target);
|
|
552
|
+
else if (target.hasAttribute("data-href")) {
|
|
553
|
+
let link = document.createElement("a");
|
|
554
|
+
link.href = target.getAttribute("data-href");
|
|
555
|
+
if (target.hasAttribute("data-target")) link.target = target.getAttribute("data-target");
|
|
556
|
+
if (target.hasAttribute("data-rel")) link.rel = target.getAttribute("data-rel");
|
|
557
|
+
if (target.hasAttribute("data-download")) link.download = target.getAttribute("data-download");
|
|
558
|
+
if (target.hasAttribute("data-ping")) link.ping = target.getAttribute("data-ping");
|
|
559
|
+
if (target.hasAttribute("data-referrer-policy")) link.referrerPolicy = target.getAttribute("data-referrer-policy");
|
|
560
|
+
target.appendChild(link);
|
|
561
|
+
open(link);
|
|
562
|
+
target.removeChild(link);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
function $4068a0fae83b6d84$var$openSyntheticLink(target, modifiers) {
|
|
566
|
+
$4068a0fae83b6d84$var$getSyntheticLink(target, (link)=>$4068a0fae83b6d84$export$95185d699e05d4d7(link, modifiers));
|
|
567
|
+
}
|
|
568
|
+
function $4068a0fae83b6d84$export$51437d503373d223(props) {
|
|
569
|
+
return {
|
|
570
|
+
"data-href": props.href,
|
|
571
|
+
"data-target": props.target,
|
|
572
|
+
"data-rel": props.rel,
|
|
573
|
+
"data-download": props.download,
|
|
574
|
+
"data-ping": props.ping,
|
|
575
|
+
"data-referrer-policy": props.referrerPolicy
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
|
|
402
580
|
/*
|
|
403
581
|
* Copyright 2020 Adobe. All rights reserved.
|
|
404
582
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -485,7 +663,7 @@ function $e8117ebcab55be6a$export$24490316f764c430(fn) {
|
|
|
485
663
|
const $28ed3fb20343b78b$var$draggingElements = [];
|
|
486
664
|
function $28ed3fb20343b78b$export$7bbed75feba39706(props) {
|
|
487
665
|
console.warn("useDrag1D is deprecated, please use `useMove` instead https://react-spectrum.adobe.com/react-aria/useMove.html");
|
|
488
|
-
let { containerRef: containerRef
|
|
666
|
+
let { containerRef: containerRef, reverse: reverse, orientation: orientation, onHover: onHover, onDrag: onDrag, onPositionChange: onPositionChange, onIncrement: onIncrement, onDecrement: onDecrement, onIncrementToMax: onIncrementToMax, onDecrementToMin: onDecrementToMin, onCollapseToggle: onCollapseToggle } = props;
|
|
489
667
|
let getPosition = (e)=>orientation === "horizontal" ? e.clientX : e.clientY;
|
|
490
668
|
let getNextOffset = (e)=>{
|
|
491
669
|
let containerOffset = (0, $16ec41ef3e36c19c$export$622cea445a1c5b7d)(containerRef.current, reverse, orientation);
|
|
@@ -662,7 +840,7 @@ function $4571ff54ac709100$export$4eaf04e54aa8eed6() {
|
|
|
662
840
|
* governing permissions and limitations under the License.
|
|
663
841
|
*/
|
|
664
842
|
function $6ec78bde395c477d$export$d6875122194c7b44(props, defaultLabel) {
|
|
665
|
-
let { id: id
|
|
843
|
+
let { id: id, "aria-label": label, "aria-labelledby": labelledBy } = props;
|
|
666
844
|
// If there is both an aria-label and aria-labelledby,
|
|
667
845
|
// combine them by pointing to the element itself.
|
|
668
846
|
id = (0, $8c61827343eed941$export$f680877a34711e37)(id);
|
|
@@ -748,7 +926,7 @@ function $37733e1652f47193$var$hasResizeObserver() {
|
|
|
748
926
|
return typeof window.ResizeObserver !== "undefined";
|
|
749
927
|
}
|
|
750
928
|
function $37733e1652f47193$export$683480f191c0e3ea(options) {
|
|
751
|
-
const { ref: ref
|
|
929
|
+
const { ref: ref, onResize: onResize } = options;
|
|
752
930
|
(0, $1Yh1N$react.useEffect)(()=>{
|
|
753
931
|
let element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
754
932
|
if (!element) return;
|
|
@@ -793,10 +971,7 @@ function $6fc733991a9f977c$export$4debdb1a3f0fa79e(context, ref) {
|
|
|
793
971
|
context.ref.current = null;
|
|
794
972
|
};
|
|
795
973
|
}
|
|
796
|
-
}
|
|
797
|
-
context,
|
|
798
|
-
ref
|
|
799
|
-
]);
|
|
974
|
+
});
|
|
800
975
|
}
|
|
801
976
|
|
|
802
977
|
|
|
@@ -832,10 +1007,15 @@ function $d796e7157ac96470$export$2bb74740c4e19def(node) {
|
|
|
832
1007
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
833
1008
|
* governing permissions and limitations under the License.
|
|
834
1009
|
*/
|
|
1010
|
+
|
|
835
1011
|
// @ts-ignore
|
|
836
1012
|
let $8b24bab62f5c65ad$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
837
1013
|
function $8b24bab62f5c65ad$export$d699905dd57c73ca() {
|
|
838
|
-
let
|
|
1014
|
+
let isSSR = (0, $1Yh1N$reactariassr.useIsSSR)();
|
|
1015
|
+
let [size, setSize] = (0, $1Yh1N$react.useState)(()=>isSSR ? {
|
|
1016
|
+
width: 0,
|
|
1017
|
+
height: 0
|
|
1018
|
+
} : $8b24bab62f5c65ad$var$getViewportSize());
|
|
839
1019
|
(0, $1Yh1N$react.useEffect)(()=>{
|
|
840
1020
|
// Use visualViewport api to track available height even on iOS virtual keyboard opening
|
|
841
1021
|
let onResize = ()=>{
|
|
@@ -911,51 +1091,6 @@ function $34da4502ea8120db$export$f8aeda7b10753fa1(description) {
|
|
|
911
1091
|
}
|
|
912
1092
|
|
|
913
1093
|
|
|
914
|
-
/*
|
|
915
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
916
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
917
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
918
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
919
|
-
*
|
|
920
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
921
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
922
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
923
|
-
* governing permissions and limitations under the License.
|
|
924
|
-
*/ function $9e20cff0af27e8cc$var$testUserAgent(re) {
|
|
925
|
-
var _window_navigator_userAgentData;
|
|
926
|
-
if (typeof window === "undefined" || window.navigator == null) return false;
|
|
927
|
-
return ((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand)=>re.test(brand.brand))) || re.test(window.navigator.userAgent);
|
|
928
|
-
}
|
|
929
|
-
function $9e20cff0af27e8cc$var$testPlatform(re) {
|
|
930
|
-
var _window_navigator_userAgentData;
|
|
931
|
-
return typeof window !== "undefined" && window.navigator != null ? re.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
|
|
932
|
-
}
|
|
933
|
-
function $9e20cff0af27e8cc$export$9ac100e40613ea10() {
|
|
934
|
-
return $9e20cff0af27e8cc$var$testPlatform(/^Mac/i);
|
|
935
|
-
}
|
|
936
|
-
function $9e20cff0af27e8cc$export$186c6964ca17d99() {
|
|
937
|
-
return $9e20cff0af27e8cc$var$testPlatform(/^iPhone/i);
|
|
938
|
-
}
|
|
939
|
-
function $9e20cff0af27e8cc$export$7bef049ce92e4224() {
|
|
940
|
-
return $9e20cff0af27e8cc$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
941
|
-
$9e20cff0af27e8cc$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
942
|
-
}
|
|
943
|
-
function $9e20cff0af27e8cc$export$fedb369cb70207f1() {
|
|
944
|
-
return $9e20cff0af27e8cc$export$186c6964ca17d99() || $9e20cff0af27e8cc$export$7bef049ce92e4224();
|
|
945
|
-
}
|
|
946
|
-
function $9e20cff0af27e8cc$export$e1865c3bedcd822b() {
|
|
947
|
-
return $9e20cff0af27e8cc$export$9ac100e40613ea10() || $9e20cff0af27e8cc$export$fedb369cb70207f1();
|
|
948
|
-
}
|
|
949
|
-
function $9e20cff0af27e8cc$export$78551043582a6a98() {
|
|
950
|
-
return $9e20cff0af27e8cc$var$testUserAgent(/AppleWebKit/i) && !$9e20cff0af27e8cc$export$6446a186d09e379e();
|
|
951
|
-
}
|
|
952
|
-
function $9e20cff0af27e8cc$export$6446a186d09e379e() {
|
|
953
|
-
return $9e20cff0af27e8cc$var$testUserAgent(/Chrome/i);
|
|
954
|
-
}
|
|
955
|
-
function $9e20cff0af27e8cc$export$a11b0059900ceec8() {
|
|
956
|
-
return $9e20cff0af27e8cc$var$testUserAgent(/Android/i);
|
|
957
|
-
}
|
|
958
|
-
|
|
959
1094
|
|
|
960
1095
|
/*
|
|
961
1096
|
* Copyright 2021 Adobe. All rights reserved.
|
|
@@ -968,31 +1103,6 @@ function $9e20cff0af27e8cc$export$a11b0059900ceec8() {
|
|
|
968
1103
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
969
1104
|
* governing permissions and limitations under the License.
|
|
970
1105
|
*/
|
|
971
|
-
/*
|
|
972
|
-
* Copyright 2023 Adobe. All rights reserved.
|
|
973
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
974
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
975
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
976
|
-
*
|
|
977
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
978
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
979
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
980
|
-
* governing permissions and limitations under the License.
|
|
981
|
-
*/
|
|
982
|
-
|
|
983
|
-
function $1254e5bb94ac8761$export$7f54fc3180508a52(fn) {
|
|
984
|
-
const ref = (0, $1Yh1N$react.useRef)(null);
|
|
985
|
-
(0, $78605a5d7424e31b$export$e5c5a5f917a5871c)(()=>{
|
|
986
|
-
ref.current = fn;
|
|
987
|
-
}, [
|
|
988
|
-
fn
|
|
989
|
-
]);
|
|
990
|
-
return (0, $1Yh1N$react.useCallback)((...args)=>{
|
|
991
|
-
const f = ref.current;
|
|
992
|
-
return f(...args);
|
|
993
|
-
}, []);
|
|
994
|
-
}
|
|
995
|
-
|
|
996
1106
|
|
|
997
1107
|
function $2a8c0bb1629926c8$export$90fc3a17d93f704c(ref, event, handler, options) {
|
|
998
1108
|
let handleEvent = (0, $1254e5bb94ac8761$export$7f54fc3180508a52)(handler);
|
|
@@ -1034,7 +1144,7 @@ function $449412113267a1fe$export$53a0910f038337bd(scrollView, element) {
|
|
|
1034
1144
|
let x = scrollView.scrollLeft;
|
|
1035
1145
|
let y = scrollView.scrollTop;
|
|
1036
1146
|
// Account for top/left border offsetting the scroll top/Left
|
|
1037
|
-
let { borderTopWidth: borderTopWidth
|
|
1147
|
+
let { borderTopWidth: borderTopWidth, borderLeftWidth: borderLeftWidth } = getComputedStyle(scrollView);
|
|
1038
1148
|
let borderAdjustedX = scrollView.scrollLeft + parseInt(borderLeftWidth, 10);
|
|
1039
1149
|
let borderAdjustedY = scrollView.scrollTop + parseInt(borderTopWidth, 10);
|
|
1040
1150
|
// Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width
|
|
@@ -1076,11 +1186,11 @@ function $449412113267a1fe$export$c826860796309d1b(targetElement, opts) {
|
|
|
1076
1186
|
var // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()
|
|
1077
1187
|
// won't cause a scroll if the element is already focused and doesn't behave consistently when an element is partially out of view horizontally vs vertically
|
|
1078
1188
|
_targetElement_scrollIntoView;
|
|
1079
|
-
let { left: originalLeft
|
|
1189
|
+
let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
|
|
1080
1190
|
targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
|
|
1081
1191
|
block: "nearest"
|
|
1082
1192
|
});
|
|
1083
|
-
let { left: newLeft
|
|
1193
|
+
let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
|
|
1084
1194
|
// Account for sub pixel differences from rounding
|
|
1085
1195
|
if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
|
|
1086
1196
|
var _opts_containingElement, _opts_containingElement_scrollIntoView, _targetElement_scrollIntoView1;
|
|
@@ -1133,7 +1243,7 @@ function $577e795361f19be9$export$29bf1b5f2c56cf63(event) {
|
|
|
1133
1243
|
// Cannot use "event.pressure === 0" as the sole check due to Safari pointer events always returning pressure === 0
|
|
1134
1244
|
// instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush
|
|
1135
1245
|
// Talkback double tap from Windows Firefox touch screen press
|
|
1136
|
-
return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
|
|
1246
|
+
return !(0, $9e20cff0af27e8cc$export$a11b0059900ceec8)() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
|
|
1137
1247
|
}
|
|
1138
1248
|
|
|
1139
1249
|
|