@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/import.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, useMemo as $12uGp$useMemo} from "react";
|
|
3
|
-
import {useSSRSafeId as $12uGp$useSSRSafeId} from "@react-aria/ssr";
|
|
2
|
+
import $12uGp$react, {useState as $12uGp$useState, useRef as $12uGp$useRef, useCallback as $12uGp$useCallback, useEffect as $12uGp$useEffect, createContext as $12uGp$createContext, useMemo as $12uGp$useMemo, useContext as $12uGp$useContext} from "react";
|
|
3
|
+
import {useSSRSafeId as $12uGp$useSSRSafeId, useIsSSR as $12uGp$useIsSSR} from "@react-aria/ssr";
|
|
4
4
|
import $12uGp$clsx from "clsx";
|
|
5
5
|
|
|
6
6
|
/*
|
|
@@ -50,51 +50,59 @@ const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof document !== "undefined
|
|
|
50
50
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
51
51
|
* governing permissions and limitations under the License.
|
|
52
52
|
*/
|
|
53
|
+
/*
|
|
54
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
55
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
56
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
57
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
58
|
+
*
|
|
59
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
60
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
61
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
62
|
+
* governing permissions and limitations under the License.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
function $8ae05eaa5c114e9c$export$7f54fc3180508a52(fn) {
|
|
66
|
+
const ref = (0, $12uGp$useRef)(null);
|
|
67
|
+
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
68
|
+
ref.current = fn;
|
|
69
|
+
}, [
|
|
70
|
+
fn
|
|
71
|
+
]);
|
|
72
|
+
return (0, $12uGp$useCallback)((...args)=>{
|
|
73
|
+
const f = ref.current;
|
|
74
|
+
return f(...args);
|
|
75
|
+
}, []);
|
|
76
|
+
}
|
|
77
|
+
|
|
53
78
|
|
|
54
79
|
function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
|
|
55
80
|
let [value, setValue] = (0, $12uGp$useState)(defaultValue);
|
|
56
|
-
let valueRef = (0, $12uGp$useRef)(value);
|
|
57
81
|
let effect = (0, $12uGp$useRef)(null);
|
|
58
|
-
//
|
|
59
|
-
|
|
82
|
+
// Store the function in a ref so we can always access the current version
|
|
83
|
+
// which has the proper `value` in scope.
|
|
84
|
+
let nextRef = (0, $8ae05eaa5c114e9c$export$7f54fc3180508a52)(()=>{
|
|
60
85
|
// Run the generator to the next yield.
|
|
61
86
|
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();
|
|
66
87
|
// If the generator is done, reset the effect.
|
|
67
88
|
if (newValue.done) {
|
|
68
89
|
effect.current = null;
|
|
69
90
|
return;
|
|
70
91
|
}
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
setValue(newValue.value);
|
|
76
|
-
|
|
77
|
-
// this list of dependencies is stable, setState and refs never change after first render.
|
|
78
|
-
}, [
|
|
79
|
-
setValue,
|
|
80
|
-
valueRef,
|
|
81
|
-
effect
|
|
82
|
-
]);
|
|
92
|
+
// If the value is the same as the current value,
|
|
93
|
+
// then continue to the next yield. Otherwise,
|
|
94
|
+
// set the value in state and wait for the next layout effect.
|
|
95
|
+
if (value === newValue.value) nextRef();
|
|
96
|
+
else setValue(newValue.value);
|
|
97
|
+
});
|
|
83
98
|
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
84
99
|
// If there is an effect currently running, continue to the next yield.
|
|
85
|
-
if (effect.current)
|
|
100
|
+
if (effect.current) nextRef();
|
|
101
|
+
});
|
|
102
|
+
let queue = (0, $8ae05eaa5c114e9c$export$7f54fc3180508a52)((fn)=>{
|
|
103
|
+
effect.current = fn(value);
|
|
104
|
+
nextRef();
|
|
86
105
|
});
|
|
87
|
-
// queue must be a stable function, much like setState.
|
|
88
|
-
let queue = (0, $12uGp$useCallback)((fn)=>{
|
|
89
|
-
effect.current = fn(valueRef.current);
|
|
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
|
|
93
|
-
}, [
|
|
94
|
-
nextIter,
|
|
95
|
-
effect,
|
|
96
|
-
valueRef
|
|
97
|
-
]);
|
|
98
106
|
return [
|
|
99
107
|
value,
|
|
100
108
|
queue
|
|
@@ -260,11 +268,20 @@ const $65484d02dcb7eb3e$var$labelablePropNames = new Set([
|
|
|
260
268
|
"aria-describedby",
|
|
261
269
|
"aria-details"
|
|
262
270
|
]);
|
|
271
|
+
// See LinkDOMProps in dom.d.ts.
|
|
272
|
+
const $65484d02dcb7eb3e$var$linkPropNames = new Set([
|
|
273
|
+
"href",
|
|
274
|
+
"target",
|
|
275
|
+
"rel",
|
|
276
|
+
"download",
|
|
277
|
+
"ping",
|
|
278
|
+
"referrerPolicy"
|
|
279
|
+
]);
|
|
263
280
|
const $65484d02dcb7eb3e$var$propRe = /^(data-.*)$/;
|
|
264
281
|
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts = {}) {
|
|
265
|
-
let { labelable: labelable , propNames: propNames
|
|
282
|
+
let { labelable: labelable, isLink: isLink, propNames: propNames } = opts;
|
|
266
283
|
let filteredProps = {};
|
|
267
|
-
for(const prop in props)if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe.test(prop))) filteredProps[prop] = props[prop];
|
|
284
|
+
for(const prop in props)if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe.test(prop))) filteredProps[prop] = props[prop];
|
|
268
285
|
return filteredProps;
|
|
269
286
|
}
|
|
270
287
|
|
|
@@ -327,7 +344,7 @@ function $7215afc6de606d6b$var$getScrollableElements(element) {
|
|
|
327
344
|
return scrollableElements;
|
|
328
345
|
}
|
|
329
346
|
function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
|
|
330
|
-
for (let { element: element
|
|
347
|
+
for (let { element: element, scrollTop: scrollTop, scrollLeft: scrollLeft } of scrollableElements){
|
|
331
348
|
element.scrollTop = scrollTop;
|
|
332
349
|
element.scrollLeft = scrollLeft;
|
|
333
350
|
}
|
|
@@ -351,6 +368,162 @@ function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
|
|
|
351
368
|
}
|
|
352
369
|
|
|
353
370
|
|
|
371
|
+
/*
|
|
372
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
373
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
374
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
375
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
376
|
+
*
|
|
377
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
378
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
379
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
380
|
+
* governing permissions and limitations under the License.
|
|
381
|
+
*/ /*
|
|
382
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
383
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
384
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
385
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
386
|
+
*
|
|
387
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
388
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
389
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
390
|
+
* governing permissions and limitations under the License.
|
|
391
|
+
*/ function $c87311424ea30a05$var$testUserAgent(re) {
|
|
392
|
+
var _window_navigator_userAgentData;
|
|
393
|
+
if (typeof window === "undefined" || window.navigator == null) return false;
|
|
394
|
+
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);
|
|
395
|
+
}
|
|
396
|
+
function $c87311424ea30a05$var$testPlatform(re) {
|
|
397
|
+
var _window_navigator_userAgentData;
|
|
398
|
+
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;
|
|
399
|
+
}
|
|
400
|
+
function $c87311424ea30a05$export$9ac100e40613ea10() {
|
|
401
|
+
return $c87311424ea30a05$var$testPlatform(/^Mac/i);
|
|
402
|
+
}
|
|
403
|
+
function $c87311424ea30a05$export$186c6964ca17d99() {
|
|
404
|
+
return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
|
|
405
|
+
}
|
|
406
|
+
function $c87311424ea30a05$export$7bef049ce92e4224() {
|
|
407
|
+
return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
408
|
+
$c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
409
|
+
}
|
|
410
|
+
function $c87311424ea30a05$export$fedb369cb70207f1() {
|
|
411
|
+
return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
|
|
412
|
+
}
|
|
413
|
+
function $c87311424ea30a05$export$e1865c3bedcd822b() {
|
|
414
|
+
return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
|
|
415
|
+
}
|
|
416
|
+
function $c87311424ea30a05$export$78551043582a6a98() {
|
|
417
|
+
return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
|
|
418
|
+
}
|
|
419
|
+
function $c87311424ea30a05$export$6446a186d09e379e() {
|
|
420
|
+
return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
|
|
421
|
+
}
|
|
422
|
+
function $c87311424ea30a05$export$a11b0059900ceec8() {
|
|
423
|
+
return $c87311424ea30a05$var$testUserAgent(/Android/i);
|
|
424
|
+
}
|
|
425
|
+
function $c87311424ea30a05$export$b7d78993b74f766d() {
|
|
426
|
+
return $c87311424ea30a05$var$testUserAgent(/Firefox/i);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
const $ea8dcbcb9ea1b556$var$RouterContext = /*#__PURE__*/ (0, $12uGp$createContext)({
|
|
433
|
+
isNative: true,
|
|
434
|
+
open: $ea8dcbcb9ea1b556$var$openSyntheticLink
|
|
435
|
+
});
|
|
436
|
+
function $ea8dcbcb9ea1b556$export$323e4fc2fa4753fb(props) {
|
|
437
|
+
let { children: children, navigate: navigate } = props;
|
|
438
|
+
let ctx = (0, $12uGp$useMemo)(()=>({
|
|
439
|
+
isNative: false,
|
|
440
|
+
open: (target, modifiers)=>{
|
|
441
|
+
$ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link)=>{
|
|
442
|
+
if ($ea8dcbcb9ea1b556$export$efa8c9099e530235(link, modifiers)) navigate(link.pathname + link.search + link.hash);
|
|
443
|
+
else $ea8dcbcb9ea1b556$export$95185d699e05d4d7(link, modifiers);
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
}), [
|
|
447
|
+
navigate
|
|
448
|
+
]);
|
|
449
|
+
return /*#__PURE__*/ (0, $12uGp$react).createElement($ea8dcbcb9ea1b556$var$RouterContext.Provider, {
|
|
450
|
+
value: ctx
|
|
451
|
+
}, children);
|
|
452
|
+
}
|
|
453
|
+
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572() {
|
|
454
|
+
return (0, $12uGp$useContext)($ea8dcbcb9ea1b556$var$RouterContext);
|
|
455
|
+
}
|
|
456
|
+
function $ea8dcbcb9ea1b556$export$efa8c9099e530235(link, modifiers) {
|
|
457
|
+
// Use getAttribute here instead of link.target. Firefox will default link.target to "_parent" when inside an iframe.
|
|
458
|
+
let target = link.getAttribute("target");
|
|
459
|
+
return (!target || target === "_self") && link.origin === location.origin && !link.hasAttribute("download") && !modifiers.metaKey && // open in new tab (mac)
|
|
460
|
+
!modifiers.ctrlKey && // open in new tab (windows)
|
|
461
|
+
!modifiers.altKey && // download
|
|
462
|
+
!modifiers.shiftKey;
|
|
463
|
+
}
|
|
464
|
+
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
|
|
465
|
+
var _window_event, _window_event_type;
|
|
466
|
+
let { metaKey: metaKey, ctrlKey: ctrlKey, altKey: altKey, shiftKey: shiftKey } = modifiers;
|
|
467
|
+
// Firefox does not recognize keyboard events as a user action by default, and the popup blocker
|
|
468
|
+
// will prevent links with target="_blank" from opening. However, it does allow the event if the
|
|
469
|
+
// Command/Control key is held, which opens the link in a background tab. This seems like the best we can do.
|
|
470
|
+
// See https://bugzilla.mozilla.org/show_bug.cgi?id=257870 and https://bugzilla.mozilla.org/show_bug.cgi?id=746640.
|
|
471
|
+
if ((0, $c87311424ea30a05$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") {
|
|
472
|
+
if ((0, $c87311424ea30a05$export$9ac100e40613ea10)()) metaKey = true;
|
|
473
|
+
else ctrlKey = true;
|
|
474
|
+
}
|
|
475
|
+
// WebKit does not support firing click events with modifier keys, but does support keyboard events.
|
|
476
|
+
// https://github.com/WebKit/WebKit/blob/c03d0ac6e6db178f90923a0a63080b5ca210d25f/Source/WebCore/html/HTMLAnchorElement.cpp#L184
|
|
477
|
+
let event = (0, $c87311424ea30a05$export$78551043582a6a98)() && (0, $c87311424ea30a05$export$9ac100e40613ea10)() && !(0, $c87311424ea30a05$export$7bef049ce92e4224)() && true ? new KeyboardEvent("keydown", {
|
|
478
|
+
keyIdentifier: "Enter",
|
|
479
|
+
metaKey: metaKey,
|
|
480
|
+
ctrlKey: ctrlKey,
|
|
481
|
+
altKey: altKey,
|
|
482
|
+
shiftKey: shiftKey
|
|
483
|
+
}) : new MouseEvent("click", {
|
|
484
|
+
metaKey: metaKey,
|
|
485
|
+
ctrlKey: ctrlKey,
|
|
486
|
+
altKey: altKey,
|
|
487
|
+
shiftKey: shiftKey,
|
|
488
|
+
bubbles: true,
|
|
489
|
+
cancelable: true
|
|
490
|
+
});
|
|
491
|
+
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = setOpening;
|
|
492
|
+
(0, $7215afc6de606d6b$export$de79e2c695e052f3)(target);
|
|
493
|
+
target.dispatchEvent(event);
|
|
494
|
+
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
|
|
495
|
+
}
|
|
496
|
+
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
|
|
497
|
+
function $ea8dcbcb9ea1b556$var$getSyntheticLink(target, open) {
|
|
498
|
+
if (target instanceof HTMLAnchorElement) open(target);
|
|
499
|
+
else if (target.hasAttribute("data-href")) {
|
|
500
|
+
let link = document.createElement("a");
|
|
501
|
+
link.href = target.getAttribute("data-href");
|
|
502
|
+
if (target.hasAttribute("data-target")) link.target = target.getAttribute("data-target");
|
|
503
|
+
if (target.hasAttribute("data-rel")) link.rel = target.getAttribute("data-rel");
|
|
504
|
+
if (target.hasAttribute("data-download")) link.download = target.getAttribute("data-download");
|
|
505
|
+
if (target.hasAttribute("data-ping")) link.ping = target.getAttribute("data-ping");
|
|
506
|
+
if (target.hasAttribute("data-referrer-policy")) link.referrerPolicy = target.getAttribute("data-referrer-policy");
|
|
507
|
+
target.appendChild(link);
|
|
508
|
+
open(link);
|
|
509
|
+
target.removeChild(link);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
function $ea8dcbcb9ea1b556$var$openSyntheticLink(target, modifiers) {
|
|
513
|
+
$ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link)=>$ea8dcbcb9ea1b556$export$95185d699e05d4d7(link, modifiers));
|
|
514
|
+
}
|
|
515
|
+
function $ea8dcbcb9ea1b556$export$51437d503373d223(props) {
|
|
516
|
+
return {
|
|
517
|
+
"data-href": props.href,
|
|
518
|
+
"data-target": props.target,
|
|
519
|
+
"data-rel": props.rel,
|
|
520
|
+
"data-download": props.download,
|
|
521
|
+
"data-ping": props.ping,
|
|
522
|
+
"data-referrer-policy": props.referrerPolicy
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
|
|
354
527
|
/*
|
|
355
528
|
* Copyright 2020 Adobe. All rights reserved.
|
|
356
529
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -437,7 +610,7 @@ function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
|
|
|
437
610
|
const $9cc09df9fd7676be$var$draggingElements = [];
|
|
438
611
|
function $9cc09df9fd7676be$export$7bbed75feba39706(props) {
|
|
439
612
|
console.warn("useDrag1D is deprecated, please use `useMove` instead https://react-spectrum.adobe.com/react-aria/useMove.html");
|
|
440
|
-
let { containerRef: containerRef
|
|
613
|
+
let { containerRef: containerRef, reverse: reverse, orientation: orientation, onHover: onHover, onDrag: onDrag, onPositionChange: onPositionChange, onIncrement: onIncrement, onDecrement: onDecrement, onIncrementToMax: onIncrementToMax, onDecrementToMin: onDecrementToMin, onCollapseToggle: onCollapseToggle } = props;
|
|
441
614
|
let getPosition = (e)=>orientation === "horizontal" ? e.clientX : e.clientY;
|
|
442
615
|
let getNextOffset = (e)=>{
|
|
443
616
|
let containerOffset = (0, $ab71dadb03a6fb2e$export$622cea445a1c5b7d)(containerRef.current, reverse, orientation);
|
|
@@ -614,7 +787,7 @@ function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
|
|
|
614
787
|
* governing permissions and limitations under the License.
|
|
615
788
|
*/
|
|
616
789
|
function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
617
|
-
let { id: id
|
|
790
|
+
let { id: id, "aria-label": label, "aria-labelledby": labelledBy } = props;
|
|
618
791
|
// If there is both an aria-label and aria-labelledby,
|
|
619
792
|
// combine them by pointing to the element itself.
|
|
620
793
|
id = (0, $bdb11010cef70236$export$f680877a34711e37)(id);
|
|
@@ -700,7 +873,7 @@ function $9daab02d461809db$var$hasResizeObserver() {
|
|
|
700
873
|
return typeof window.ResizeObserver !== "undefined";
|
|
701
874
|
}
|
|
702
875
|
function $9daab02d461809db$export$683480f191c0e3ea(options) {
|
|
703
|
-
const { ref: ref
|
|
876
|
+
const { ref: ref, onResize: onResize } = options;
|
|
704
877
|
(0, $12uGp$useEffect)(()=>{
|
|
705
878
|
let element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
706
879
|
if (!element) return;
|
|
@@ -745,10 +918,7 @@ function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
|
|
|
745
918
|
context.ref.current = null;
|
|
746
919
|
};
|
|
747
920
|
}
|
|
748
|
-
}
|
|
749
|
-
context,
|
|
750
|
-
ref
|
|
751
|
-
]);
|
|
921
|
+
});
|
|
752
922
|
}
|
|
753
923
|
|
|
754
924
|
|
|
@@ -784,10 +954,15 @@ function $62d8ded9296f3872$export$2bb74740c4e19def(node) {
|
|
|
784
954
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
785
955
|
* governing permissions and limitations under the License.
|
|
786
956
|
*/
|
|
957
|
+
|
|
787
958
|
// @ts-ignore
|
|
788
959
|
let $5df64b3807dc15ee$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
789
960
|
function $5df64b3807dc15ee$export$d699905dd57c73ca() {
|
|
790
|
-
let
|
|
961
|
+
let isSSR = (0, $12uGp$useIsSSR)();
|
|
962
|
+
let [size, setSize] = (0, $12uGp$useState)(()=>isSSR ? {
|
|
963
|
+
width: 0,
|
|
964
|
+
height: 0
|
|
965
|
+
} : $5df64b3807dc15ee$var$getViewportSize());
|
|
791
966
|
(0, $12uGp$useEffect)(()=>{
|
|
792
967
|
// Use visualViewport api to track available height even on iOS virtual keyboard opening
|
|
793
968
|
let onResize = ()=>{
|
|
@@ -863,51 +1038,6 @@ function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
|
|
|
863
1038
|
}
|
|
864
1039
|
|
|
865
1040
|
|
|
866
|
-
/*
|
|
867
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
868
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
869
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
870
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
871
|
-
*
|
|
872
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
873
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
874
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
875
|
-
* governing permissions and limitations under the License.
|
|
876
|
-
*/ function $c87311424ea30a05$var$testUserAgent(re) {
|
|
877
|
-
var _window_navigator_userAgentData;
|
|
878
|
-
if (typeof window === "undefined" || window.navigator == null) return false;
|
|
879
|
-
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);
|
|
880
|
-
}
|
|
881
|
-
function $c87311424ea30a05$var$testPlatform(re) {
|
|
882
|
-
var _window_navigator_userAgentData;
|
|
883
|
-
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;
|
|
884
|
-
}
|
|
885
|
-
function $c87311424ea30a05$export$9ac100e40613ea10() {
|
|
886
|
-
return $c87311424ea30a05$var$testPlatform(/^Mac/i);
|
|
887
|
-
}
|
|
888
|
-
function $c87311424ea30a05$export$186c6964ca17d99() {
|
|
889
|
-
return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
|
|
890
|
-
}
|
|
891
|
-
function $c87311424ea30a05$export$7bef049ce92e4224() {
|
|
892
|
-
return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
893
|
-
$c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
894
|
-
}
|
|
895
|
-
function $c87311424ea30a05$export$fedb369cb70207f1() {
|
|
896
|
-
return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
|
|
897
|
-
}
|
|
898
|
-
function $c87311424ea30a05$export$e1865c3bedcd822b() {
|
|
899
|
-
return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
|
|
900
|
-
}
|
|
901
|
-
function $c87311424ea30a05$export$78551043582a6a98() {
|
|
902
|
-
return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
|
|
903
|
-
}
|
|
904
|
-
function $c87311424ea30a05$export$6446a186d09e379e() {
|
|
905
|
-
return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
|
|
906
|
-
}
|
|
907
|
-
function $c87311424ea30a05$export$a11b0059900ceec8() {
|
|
908
|
-
return $c87311424ea30a05$var$testUserAgent(/Android/i);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
1041
|
|
|
912
1042
|
/*
|
|
913
1043
|
* Copyright 2021 Adobe. All rights reserved.
|
|
@@ -920,31 +1050,6 @@ function $c87311424ea30a05$export$a11b0059900ceec8() {
|
|
|
920
1050
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
921
1051
|
* governing permissions and limitations under the License.
|
|
922
1052
|
*/
|
|
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
1053
|
|
|
949
1054
|
function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler, options) {
|
|
950
1055
|
let handleEvent = (0, $8ae05eaa5c114e9c$export$7f54fc3180508a52)(handler);
|
|
@@ -986,7 +1091,7 @@ function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
|
|
|
986
1091
|
let x = scrollView.scrollLeft;
|
|
987
1092
|
let y = scrollView.scrollTop;
|
|
988
1093
|
// Account for top/left border offsetting the scroll top/Left
|
|
989
|
-
let { borderTopWidth: borderTopWidth
|
|
1094
|
+
let { borderTopWidth: borderTopWidth, borderLeftWidth: borderLeftWidth } = getComputedStyle(scrollView);
|
|
990
1095
|
let borderAdjustedX = scrollView.scrollLeft + parseInt(borderLeftWidth, 10);
|
|
991
1096
|
let borderAdjustedY = scrollView.scrollTop + parseInt(borderTopWidth, 10);
|
|
992
1097
|
// Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width
|
|
@@ -1028,11 +1133,11 @@ function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts) {
|
|
|
1028
1133
|
var // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()
|
|
1029
1134
|
// 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
|
|
1030
1135
|
_targetElement_scrollIntoView;
|
|
1031
|
-
let { left: originalLeft
|
|
1136
|
+
let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
|
|
1032
1137
|
targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
|
|
1033
1138
|
block: "nearest"
|
|
1034
1139
|
});
|
|
1035
|
-
let { left: newLeft
|
|
1140
|
+
let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
|
|
1036
1141
|
// Account for sub pixel differences from rounding
|
|
1037
1142
|
if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
|
|
1038
1143
|
var _opts_containingElement, _opts_containingElement_scrollIntoView, _targetElement_scrollIntoView1;
|
|
@@ -1085,7 +1190,7 @@ function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
|
|
|
1085
1190
|
// Cannot use "event.pressure === 0" as the sole check due to Safari pointer events always returning pressure === 0
|
|
1086
1191
|
// instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush
|
|
1087
1192
|
// Talkback double tap from Windows Firefox touch screen press
|
|
1088
|
-
return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
|
|
1193
|
+
return !(0, $c87311424ea30a05$export$a11b0059900ceec8)() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
|
|
1089
1194
|
}
|
|
1090
1195
|
|
|
1091
1196
|
|
|
@@ -1144,5 +1249,5 @@ function $99facab73266f662$export$5add1d006293d136(ref, initialValue, onReset) {
|
|
|
1144
1249
|
|
|
1145
1250
|
|
|
1146
1251
|
|
|
1147
|
-
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, $99facab73266f662$export$5add1d006293d136 as useFormReset};
|
|
1252
|
+
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, $ea8dcbcb9ea1b556$export$95185d699e05d4d7 as openLink, $ea8dcbcb9ea1b556$export$51437d503373d223 as getSyntheticLinkProps, $ea8dcbcb9ea1b556$export$323e4fc2fa4753fb as RouterProvider, $ea8dcbcb9ea1b556$export$efa8c9099e530235 as shouldClientNavigate, $ea8dcbcb9ea1b556$export$9a302a45f65d0572 as useRouter, $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, $99facab73266f662$export$5add1d006293d136 as useFormReset};
|
|
1148
1253
|
//# sourceMappingURL=module.js.map
|