@react-aria/utils 3.14.2 → 3.15.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.
@@ -0,0 +1,1051 @@
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";
3
+ import {useSSRSafeId as $12uGp$useSSRSafeId} from "@react-aria/ssr";
4
+ import $12uGp$clsx from "clsx";
5
+
6
+ /*
7
+ * Copyright 2020 Adobe. All rights reserved.
8
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License. You may obtain a copy
10
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software distributed under
13
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
+ * OF ANY KIND, either express or implied. See the License for the specific language
15
+ * governing permissions and limitations under the License.
16
+ */ /*
17
+ * Copyright 2020 Adobe. All rights reserved.
18
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
+ * you may not use this file except in compliance with the License. You may obtain a copy
20
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
21
+ *
22
+ * Unless required by applicable law or agreed to in writing, software distributed under
23
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
24
+ * OF ANY KIND, either express or implied. See the License for the specific language
25
+ * governing permissions and limitations under the License.
26
+ */
27
+ /*
28
+ * Copyright 2020 Adobe. All rights reserved.
29
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
30
+ * you may not use this file except in compliance with the License. You may obtain a copy
31
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
32
+ *
33
+ * Unless required by applicable law or agreed to in writing, software distributed under
34
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
35
+ * OF ANY KIND, either express or implied. See the License for the specific language
36
+ * governing permissions and limitations under the License.
37
+ */
38
+ const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof window !== "undefined" ? (0, $12uGp$react).useLayoutEffect : ()=>{};
39
+
40
+
41
+
42
+ /*
43
+ * Copyright 2020 Adobe. All rights reserved.
44
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
45
+ * you may not use this file except in compliance with the License. You may obtain a copy
46
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
47
+ *
48
+ * Unless required by applicable law or agreed to in writing, software distributed under
49
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
50
+ * OF ANY KIND, either express or implied. See the License for the specific language
51
+ * governing permissions and limitations under the License.
52
+ */
53
+
54
+ function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
55
+ let [value, setValue] = (0, $12uGp$useState)(defaultValue);
56
+ let valueRef = (0, $12uGp$useRef)(value);
57
+ let effect = (0, $12uGp$useRef)(null);
58
+ valueRef.current = value;
59
+ // Store the function in a ref so we can always access the current version
60
+ // which has the proper `value` in scope.
61
+ let nextRef = (0, $12uGp$useRef)(null);
62
+ nextRef.current = ()=>{
63
+ // Run the generator to the next yield.
64
+ let newValue = effect.current.next();
65
+ // If the generator is done, reset the effect.
66
+ if (newValue.done) {
67
+ effect.current = null;
68
+ return;
69
+ }
70
+ // If the value is the same as the current value,
71
+ // then continue to the next yield. Otherwise,
72
+ // set the value in state and wait for the next layout effect.
73
+ if (value === newValue.value) nextRef.current();
74
+ else setValue(newValue.value);
75
+ };
76
+ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
77
+ // If there is an effect currently running, continue to the next yield.
78
+ if (effect.current) nextRef.current();
79
+ });
80
+ let queue = (0, $12uGp$useCallback)((fn)=>{
81
+ effect.current = fn(valueRef.current);
82
+ nextRef.current();
83
+ }, [
84
+ effect,
85
+ nextRef
86
+ ]);
87
+ return [
88
+ value,
89
+ queue
90
+ ];
91
+ }
92
+
93
+
94
+ let $bdb11010cef70236$var$idsUpdaterMap = new Map();
95
+ function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
96
+ let [value, setValue] = (0, $12uGp$useState)(defaultId);
97
+ let nextId = (0, $12uGp$useRef)(null);
98
+ let res = (0, $12uGp$useSSRSafeId)(value);
99
+ let updateValue = (0, $12uGp$useCallback)((val)=>{
100
+ nextId.current = val;
101
+ }, []);
102
+ $bdb11010cef70236$var$idsUpdaterMap.set(res, updateValue);
103
+ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
104
+ let r = res;
105
+ return ()=>{
106
+ $bdb11010cef70236$var$idsUpdaterMap.delete(r);
107
+ };
108
+ }, [
109
+ res
110
+ ]);
111
+ // This cannot cause an infinite loop because the ref is updated first.
112
+ // eslint-disable-next-line
113
+ (0, $12uGp$useEffect)(()=>{
114
+ let newId = nextId.current;
115
+ if (newId) {
116
+ nextId.current = null;
117
+ setValue(newId);
118
+ }
119
+ });
120
+ return res;
121
+ }
122
+ function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
123
+ if (idA === idB) return idA;
124
+ let setIdA = $bdb11010cef70236$var$idsUpdaterMap.get(idA);
125
+ if (setIdA) {
126
+ setIdA(idB);
127
+ return idB;
128
+ }
129
+ let setIdB = $bdb11010cef70236$var$idsUpdaterMap.get(idB);
130
+ if (setIdB) {
131
+ setIdB(idA);
132
+ return idA;
133
+ }
134
+ return idB;
135
+ }
136
+ function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
137
+ let id = $bdb11010cef70236$export$f680877a34711e37();
138
+ let [resolvedId, setResolvedId] = (0, $1dbecbe27a04f9af$export$14d238f342723f25)(id);
139
+ let updateId = (0, $12uGp$useCallback)(()=>{
140
+ setResolvedId(function*() {
141
+ yield id;
142
+ yield document.getElementById(id) ? id : undefined;
143
+ });
144
+ }, [
145
+ id,
146
+ setResolvedId
147
+ ]);
148
+ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(updateId, [
149
+ id,
150
+ updateId,
151
+ ...depArray
152
+ ]);
153
+ return resolvedId;
154
+ }
155
+
156
+
157
+ /*
158
+ * Copyright 2020 Adobe. All rights reserved.
159
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
160
+ * you may not use this file except in compliance with the License. You may obtain a copy
161
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
162
+ *
163
+ * Unless required by applicable law or agreed to in writing, software distributed under
164
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
165
+ * OF ANY KIND, either express or implied. See the License for the specific language
166
+ * governing permissions and limitations under the License.
167
+ */ /**
168
+ * Calls all functions in the order they were chained with the same arguments.
169
+ */ function $ff5963eb1fccf552$export$e08e3b67e392101e(...callbacks) {
170
+ return (...args)=>{
171
+ for (let callback of callbacks)if (typeof callback === "function") callback(...args);
172
+ };
173
+ }
174
+
175
+
176
+ /*
177
+ * Copyright 2020 Adobe. All rights reserved.
178
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
179
+ * you may not use this file except in compliance with the License. You may obtain a copy
180
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
181
+ *
182
+ * Unless required by applicable law or agreed to in writing, software distributed under
183
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
184
+ * OF ANY KIND, either express or implied. See the License for the specific language
185
+ * governing permissions and limitations under the License.
186
+ */
187
+
188
+
189
+ function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
190
+ // Start with a base clone of the first argument. This is a lot faster than starting
191
+ // with an empty object and adding properties as we go.
192
+ let result = {
193
+ ...args[0]
194
+ };
195
+ for(let i = 1; i < args.length; i++){
196
+ let props = args[i];
197
+ for(let key in props){
198
+ let a = result[key];
199
+ let b = props[key];
200
+ // Chain events
201
+ if (typeof a === "function" && typeof b === "function" && // This is a lot faster than a regex.
202
+ key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */ 65 && key.charCodeAt(2) <= /* 'Z' */ 90) result[key] = (0, $ff5963eb1fccf552$export$e08e3b67e392101e)(a, b);
203
+ else if ((key === "className" || key === "UNSAFE_className") && typeof a === "string" && typeof b === "string") result[key] = (0, $12uGp$clsx)(a, b);
204
+ else if (key === "id" && a && b) result.id = (0, $bdb11010cef70236$export$cd8c9cb68f842629)(a, b);
205
+ else result[key] = b !== undefined ? b : a;
206
+ }
207
+ }
208
+ return result;
209
+ }
210
+
211
+
212
+ /*
213
+ * Copyright 2020 Adobe. All rights reserved.
214
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
215
+ * you may not use this file except in compliance with the License. You may obtain a copy
216
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
217
+ *
218
+ * Unless required by applicable law or agreed to in writing, software distributed under
219
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
220
+ * OF ANY KIND, either express or implied. See the License for the specific language
221
+ * governing permissions and limitations under the License.
222
+ */ function $5dc95899b306f630$export$c9058316764c140e(...refs) {
223
+ return (value)=>{
224
+ for (let ref of refs){
225
+ if (typeof ref === "function") ref(value);
226
+ else if (ref != null) ref.current = value;
227
+ }
228
+ };
229
+ }
230
+
231
+
232
+ /*
233
+ * Copyright 2020 Adobe. All rights reserved.
234
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
235
+ * you may not use this file except in compliance with the License. You may obtain a copy
236
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
237
+ *
238
+ * Unless required by applicable law or agreed to in writing, software distributed under
239
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
240
+ * OF ANY KIND, either express or implied. See the License for the specific language
241
+ * governing permissions and limitations under the License.
242
+ */ const $65484d02dcb7eb3e$var$DOMPropNames = new Set([
243
+ "id"
244
+ ]);
245
+ const $65484d02dcb7eb3e$var$labelablePropNames = new Set([
246
+ "aria-label",
247
+ "aria-labelledby",
248
+ "aria-describedby",
249
+ "aria-details"
250
+ ]);
251
+ const $65484d02dcb7eb3e$var$propRe = /^(data-.*)$/;
252
+ function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts = {}) {
253
+ let { labelable: labelable , propNames: propNames } = opts;
254
+ let filteredProps = {};
255
+ 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];
256
+ return filteredProps;
257
+ }
258
+
259
+
260
+ /*
261
+ * Copyright 2020 Adobe. All rights reserved.
262
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
263
+ * you may not use this file except in compliance with the License. You may obtain a copy
264
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
265
+ *
266
+ * Unless required by applicable law or agreed to in writing, software distributed under
267
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
268
+ * OF ANY KIND, either express or implied. See the License for the specific language
269
+ * governing permissions and limitations under the License.
270
+ */ function $7215afc6de606d6b$export$de79e2c695e052f3(element) {
271
+ if ($7215afc6de606d6b$var$supportsPreventScroll()) element.focus({
272
+ preventScroll: true
273
+ });
274
+ else {
275
+ let scrollableElements = $7215afc6de606d6b$var$getScrollableElements(element);
276
+ element.focus();
277
+ $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements);
278
+ }
279
+ }
280
+ let $7215afc6de606d6b$var$supportsPreventScrollCached = null;
281
+ function $7215afc6de606d6b$var$supportsPreventScroll() {
282
+ if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) {
283
+ $7215afc6de606d6b$var$supportsPreventScrollCached = false;
284
+ try {
285
+ var focusElem = document.createElement("div");
286
+ focusElem.focus({
287
+ get preventScroll () {
288
+ $7215afc6de606d6b$var$supportsPreventScrollCached = true;
289
+ return true;
290
+ }
291
+ });
292
+ } catch (e) {
293
+ // Ignore
294
+ }
295
+ }
296
+ return $7215afc6de606d6b$var$supportsPreventScrollCached;
297
+ }
298
+ function $7215afc6de606d6b$var$getScrollableElements(element) {
299
+ var parent = element.parentNode;
300
+ var scrollableElements = [];
301
+ var rootScrollingElement = document.scrollingElement || document.documentElement;
302
+ while(parent instanceof HTMLElement && parent !== rootScrollingElement){
303
+ if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) scrollableElements.push({
304
+ element: parent,
305
+ scrollTop: parent.scrollTop,
306
+ scrollLeft: parent.scrollLeft
307
+ });
308
+ parent = parent.parentNode;
309
+ }
310
+ if (rootScrollingElement instanceof HTMLElement) scrollableElements.push({
311
+ element: rootScrollingElement,
312
+ scrollTop: rootScrollingElement.scrollTop,
313
+ scrollLeft: rootScrollingElement.scrollLeft
314
+ });
315
+ return scrollableElements;
316
+ }
317
+ function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
318
+ for (let { element: element , scrollTop: scrollTop , scrollLeft: scrollLeft } of scrollableElements){
319
+ element.scrollTop = scrollTop;
320
+ element.scrollLeft = scrollLeft;
321
+ }
322
+ }
323
+
324
+
325
+ /*
326
+ * Copyright 2020 Adobe. All rights reserved.
327
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
328
+ * you may not use this file except in compliance with the License. You may obtain a copy
329
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
330
+ *
331
+ * Unless required by applicable law or agreed to in writing, software distributed under
332
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
333
+ * OF ANY KIND, either express or implied. See the License for the specific language
334
+ * governing permissions and limitations under the License.
335
+ */ function $ab71dadb03a6fb2e$export$622cea445a1c5b7d(element, reverse, orientation = "horizontal") {
336
+ let rect = element.getBoundingClientRect();
337
+ if (reverse) return orientation === "horizontal" ? rect.right : rect.bottom;
338
+ return orientation === "horizontal" ? rect.left : rect.top;
339
+ }
340
+
341
+
342
+ /*
343
+ * Copyright 2020 Adobe. All rights reserved.
344
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
345
+ * you may not use this file except in compliance with the License. You may obtain a copy
346
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
347
+ *
348
+ * Unless required by applicable law or agreed to in writing, software distributed under
349
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
350
+ * OF ANY KIND, either express or implied. See the License for the specific language
351
+ * governing permissions and limitations under the License.
352
+ */ // We store a global list of elements that are currently transitioning,
353
+ // mapped to a set of CSS properties that are transitioning for that element.
354
+ // This is necessary rather than a simple count of transitions because of browser
355
+ // bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather
356
+ // than one or the other. So we need to track what's actually transitioning so that
357
+ // we can ignore these duplicate events.
358
+ let $bbed8b41f857bcc0$var$transitionsByElement = new Map();
359
+ // A list of callbacks to call once there are no transitioning elements.
360
+ let $bbed8b41f857bcc0$var$transitionCallbacks = new Set();
361
+ function $bbed8b41f857bcc0$var$setupGlobalEvents() {
362
+ if (typeof window === "undefined") return;
363
+ let onTransitionStart = (e)=>{
364
+ // Add the transitioning property to the list for this element.
365
+ let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
366
+ if (!transitions) {
367
+ transitions = new Set();
368
+ $bbed8b41f857bcc0$var$transitionsByElement.set(e.target, transitions);
369
+ // The transitioncancel event must be registered on the element itself, rather than as a global
370
+ // event. This enables us to handle when the node is deleted from the document while it is transitioning.
371
+ // In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
372
+ e.target.addEventListener("transitioncancel", onTransitionEnd);
373
+ }
374
+ transitions.add(e.propertyName);
375
+ };
376
+ let onTransitionEnd = (e)=>{
377
+ // Remove property from list of transitioning properties.
378
+ let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
379
+ if (!properties) return;
380
+ properties.delete(e.propertyName);
381
+ // If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
382
+ if (properties.size === 0) {
383
+ e.target.removeEventListener("transitioncancel", onTransitionEnd);
384
+ $bbed8b41f857bcc0$var$transitionsByElement.delete(e.target);
385
+ }
386
+ // If no transitioning elements, call all of the queued callbacks.
387
+ if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
388
+ for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks)cb();
389
+ $bbed8b41f857bcc0$var$transitionCallbacks.clear();
390
+ }
391
+ };
392
+ document.body.addEventListener("transitionrun", onTransitionStart);
393
+ document.body.addEventListener("transitionend", onTransitionEnd);
394
+ }
395
+ if (typeof document !== "undefined") {
396
+ if (document.readyState !== "loading") $bbed8b41f857bcc0$var$setupGlobalEvents();
397
+ else document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents);
398
+ }
399
+ function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
400
+ // Wait one frame to see if an animation starts, e.g. a transition on mount.
401
+ requestAnimationFrame(()=>{
402
+ // If no transitions are running, call the function immediately.
403
+ // Otherwise, add it to a list of callbacks to run at the end of the animation.
404
+ if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) fn();
405
+ else $bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
406
+ });
407
+ }
408
+
409
+
410
+ /*
411
+ * Copyright 2020 Adobe. All rights reserved.
412
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
413
+ * you may not use this file except in compliance with the License. You may obtain a copy
414
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
415
+ *
416
+ * Unless required by applicable law or agreed to in writing, software distributed under
417
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
418
+ * OF ANY KIND, either express or implied. See the License for the specific language
419
+ * governing permissions and limitations under the License.
420
+ */
421
+
422
+ // Keep track of elements that we are currently handling dragging for via useDrag1D.
423
+ // If there's an ancestor and a descendant both using useDrag1D(), and the user starts
424
+ // dragging the descendant, we don't want useDrag1D events to fire for the ancestor.
425
+ const $9cc09df9fd7676be$var$draggingElements = [];
426
+ function $9cc09df9fd7676be$export$7bbed75feba39706(props) {
427
+ console.warn("useDrag1D is deprecated, please use `useMove` instead https://react-spectrum.adobe.com/react-aria/useMove.html");
428
+ let { containerRef: containerRef , reverse: reverse , orientation: orientation , onHover: onHover , onDrag: onDrag , onPositionChange: onPositionChange , onIncrement: onIncrement , onDecrement: onDecrement , onIncrementToMax: onIncrementToMax , onDecrementToMin: onDecrementToMin , onCollapseToggle: onCollapseToggle } = props;
429
+ let getPosition = (e)=>orientation === "horizontal" ? e.clientX : e.clientY;
430
+ let getNextOffset = (e)=>{
431
+ let containerOffset = (0, $ab71dadb03a6fb2e$export$622cea445a1c5b7d)(containerRef.current, reverse, orientation);
432
+ let mouseOffset = getPosition(e);
433
+ let nextOffset = reverse ? containerOffset - mouseOffset : mouseOffset - containerOffset;
434
+ return nextOffset;
435
+ };
436
+ let dragging = (0, $12uGp$useRef)(false);
437
+ let prevPosition = (0, $12uGp$useRef)(0);
438
+ // Keep track of the current handlers in a ref so that the events can access them.
439
+ let handlers = (0, $12uGp$useRef)({
440
+ onPositionChange: onPositionChange,
441
+ onDrag: onDrag
442
+ });
443
+ handlers.current.onDrag = onDrag;
444
+ handlers.current.onPositionChange = onPositionChange;
445
+ let onMouseDragged = (e)=>{
446
+ e.preventDefault();
447
+ let nextOffset = getNextOffset(e);
448
+ if (!dragging.current) {
449
+ dragging.current = true;
450
+ if (handlers.current.onDrag) handlers.current.onDrag(true);
451
+ if (handlers.current.onPositionChange) handlers.current.onPositionChange(nextOffset);
452
+ }
453
+ if (prevPosition.current === nextOffset) return;
454
+ prevPosition.current = nextOffset;
455
+ if (onPositionChange) onPositionChange(nextOffset);
456
+ };
457
+ let onMouseUp = (e)=>{
458
+ const target = e.target;
459
+ dragging.current = false;
460
+ let nextOffset = getNextOffset(e);
461
+ if (handlers.current.onDrag) handlers.current.onDrag(false);
462
+ if (handlers.current.onPositionChange) handlers.current.onPositionChange(nextOffset);
463
+ $9cc09df9fd7676be$var$draggingElements.splice($9cc09df9fd7676be$var$draggingElements.indexOf(target), 1);
464
+ window.removeEventListener("mouseup", onMouseUp, false);
465
+ window.removeEventListener("mousemove", onMouseDragged, false);
466
+ };
467
+ let onMouseDown = (e)=>{
468
+ const target = e.currentTarget;
469
+ // If we're already handling dragging on a descendant with useDrag1D, then
470
+ // we don't want to handle the drag motion on this target as well.
471
+ if ($9cc09df9fd7676be$var$draggingElements.some((elt)=>target.contains(elt))) return;
472
+ $9cc09df9fd7676be$var$draggingElements.push(target);
473
+ window.addEventListener("mousemove", onMouseDragged, false);
474
+ window.addEventListener("mouseup", onMouseUp, false);
475
+ };
476
+ let onMouseEnter = ()=>{
477
+ if (onHover) onHover(true);
478
+ };
479
+ let onMouseOut = ()=>{
480
+ if (onHover) onHover(false);
481
+ };
482
+ let onKeyDown = (e)=>{
483
+ switch(e.key){
484
+ case "Left":
485
+ case "ArrowLeft":
486
+ if (orientation === "horizontal") {
487
+ e.preventDefault();
488
+ if (onDecrement && !reverse) onDecrement();
489
+ else if (onIncrement && reverse) onIncrement();
490
+ }
491
+ break;
492
+ case "Up":
493
+ case "ArrowUp":
494
+ if (orientation === "vertical") {
495
+ e.preventDefault();
496
+ if (onDecrement && !reverse) onDecrement();
497
+ else if (onIncrement && reverse) onIncrement();
498
+ }
499
+ break;
500
+ case "Right":
501
+ case "ArrowRight":
502
+ if (orientation === "horizontal") {
503
+ e.preventDefault();
504
+ if (onIncrement && !reverse) onIncrement();
505
+ else if (onDecrement && reverse) onDecrement();
506
+ }
507
+ break;
508
+ case "Down":
509
+ case "ArrowDown":
510
+ if (orientation === "vertical") {
511
+ e.preventDefault();
512
+ if (onIncrement && !reverse) onIncrement();
513
+ else if (onDecrement && reverse) onDecrement();
514
+ }
515
+ break;
516
+ case "Home":
517
+ e.preventDefault();
518
+ if (onDecrementToMin) onDecrementToMin();
519
+ break;
520
+ case "End":
521
+ e.preventDefault();
522
+ if (onIncrementToMax) onIncrementToMax();
523
+ break;
524
+ case "Enter":
525
+ e.preventDefault();
526
+ if (onCollapseToggle) onCollapseToggle();
527
+ break;
528
+ }
529
+ };
530
+ return {
531
+ onMouseDown: onMouseDown,
532
+ onMouseEnter: onMouseEnter,
533
+ onMouseOut: onMouseOut,
534
+ onKeyDown: onKeyDown
535
+ };
536
+ }
537
+
538
+
539
+ /*
540
+ * Copyright 2020 Adobe. All rights reserved.
541
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
542
+ * you may not use this file except in compliance with the License. You may obtain a copy
543
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
544
+ *
545
+ * Unless required by applicable law or agreed to in writing, software distributed under
546
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
547
+ * OF ANY KIND, either express or implied. See the License for the specific language
548
+ * governing permissions and limitations under the License.
549
+ */
550
+ function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
551
+ let globalListeners = (0, $12uGp$useRef)(new Map());
552
+ let addGlobalListener = (0, $12uGp$useCallback)((eventTarget, type, listener, options)=>{
553
+ // Make sure we remove the listener after it is called with the `once` option.
554
+ let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args)=>{
555
+ globalListeners.current.delete(listener);
556
+ listener(...args);
557
+ } : listener;
558
+ globalListeners.current.set(listener, {
559
+ type: type,
560
+ eventTarget: eventTarget,
561
+ fn: fn,
562
+ options: options
563
+ });
564
+ eventTarget.addEventListener(type, listener, options);
565
+ }, []);
566
+ let removeGlobalListener = (0, $12uGp$useCallback)((eventTarget, type, listener, options)=>{
567
+ var _globalListeners_current_get;
568
+ let fn = ((_globalListeners_current_get = globalListeners.current.get(listener)) === null || _globalListeners_current_get === void 0 ? void 0 : _globalListeners_current_get.fn) || listener;
569
+ eventTarget.removeEventListener(type, fn, options);
570
+ globalListeners.current.delete(listener);
571
+ }, []);
572
+ let removeAllGlobalListeners = (0, $12uGp$useCallback)(()=>{
573
+ globalListeners.current.forEach((value, key)=>{
574
+ removeGlobalListener(value.eventTarget, value.type, key, value.options);
575
+ });
576
+ }, [
577
+ removeGlobalListener
578
+ ]);
579
+ // eslint-disable-next-line arrow-body-style
580
+ (0, $12uGp$useEffect)(()=>{
581
+ return removeAllGlobalListeners;
582
+ }, [
583
+ removeAllGlobalListeners
584
+ ]);
585
+ return {
586
+ addGlobalListener: addGlobalListener,
587
+ removeGlobalListener: removeGlobalListener,
588
+ removeAllGlobalListeners: removeAllGlobalListeners
589
+ };
590
+ }
591
+
592
+
593
+ /*
594
+ * Copyright 2020 Adobe. All rights reserved.
595
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
596
+ * you may not use this file except in compliance with the License. You may obtain a copy
597
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
598
+ *
599
+ * Unless required by applicable law or agreed to in writing, software distributed under
600
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
601
+ * OF ANY KIND, either express or implied. See the License for the specific language
602
+ * governing permissions and limitations under the License.
603
+ */
604
+ function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
605
+ let { id: id , "aria-label": label , "aria-labelledby": labelledBy } = props;
606
+ // If there is both an aria-label and aria-labelledby,
607
+ // combine them by pointing to the element itself.
608
+ id = (0, $bdb11010cef70236$export$f680877a34711e37)(id);
609
+ if (labelledBy && label) {
610
+ let ids = new Set([
611
+ ...labelledBy.trim().split(/\s+/),
612
+ id
613
+ ]);
614
+ labelledBy = [
615
+ ...ids
616
+ ].join(" ");
617
+ } else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(" ");
618
+ // If no labels are provided, use the default
619
+ if (!label && !labelledBy && defaultLabel) label = defaultLabel;
620
+ return {
621
+ id: id,
622
+ "aria-label": label,
623
+ "aria-labelledby": labelledBy
624
+ };
625
+ }
626
+
627
+
628
+ /*
629
+ * Copyright 2021 Adobe. All rights reserved.
630
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
631
+ * you may not use this file except in compliance with the License. You may obtain a copy
632
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
633
+ *
634
+ * Unless required by applicable law or agreed to in writing, software distributed under
635
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
636
+ * OF ANY KIND, either express or implied. See the License for the specific language
637
+ * governing permissions and limitations under the License.
638
+ */
639
+
640
+ function $df56164dff5785e2$export$4338b53315abf666(forwardedRef) {
641
+ const objRef = (0, $12uGp$useRef)();
642
+ /**
643
+ * We're using `useLayoutEffect` here instead of `useEffect` because we want
644
+ * to make sure that the `ref` value is up to date before other places in the
645
+ * the execution cycle try to read it.
646
+ */ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
647
+ if (!forwardedRef) return;
648
+ if (typeof forwardedRef === "function") forwardedRef(objRef.current);
649
+ else forwardedRef.current = objRef.current;
650
+ }, [
651
+ forwardedRef
652
+ ]);
653
+ return objRef;
654
+ }
655
+
656
+
657
+ /*
658
+ * Copyright 2020 Adobe. All rights reserved.
659
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
660
+ * you may not use this file except in compliance with the License. You may obtain a copy
661
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
662
+ *
663
+ * Unless required by applicable law or agreed to in writing, software distributed under
664
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
665
+ * OF ANY KIND, either express or implied. See the License for the specific language
666
+ * governing permissions and limitations under the License.
667
+ */
668
+ function $4f58c5f72bcf79f7$export$496315a1608d9602(effect, dependencies) {
669
+ const isInitialMount = (0, $12uGp$useRef)(true);
670
+ (0, $12uGp$useEffect)(()=>{
671
+ if (isInitialMount.current) isInitialMount.current = false;
672
+ else effect();
673
+ // eslint-disable-next-line react-hooks/exhaustive-deps
674
+ }, dependencies);
675
+ }
676
+
677
+
678
+
679
+
680
+ function $9daab02d461809db$var$hasResizeObserver() {
681
+ return typeof window.ResizeObserver !== "undefined";
682
+ }
683
+ function $9daab02d461809db$export$683480f191c0e3ea(options) {
684
+ const { ref: ref , onResize: onResize } = options;
685
+ (0, $12uGp$useEffect)(()=>{
686
+ let element = ref === null || ref === void 0 ? void 0 : ref.current;
687
+ if (!element) return;
688
+ if (!$9daab02d461809db$var$hasResizeObserver()) {
689
+ window.addEventListener("resize", onResize, false);
690
+ return ()=>{
691
+ window.removeEventListener("resize", onResize, false);
692
+ };
693
+ } else {
694
+ const resizeObserverInstance = new window.ResizeObserver((entries)=>{
695
+ if (!entries.length) return;
696
+ onResize();
697
+ });
698
+ resizeObserverInstance.observe(element);
699
+ return ()=>{
700
+ if (element) resizeObserverInstance.unobserve(element);
701
+ };
702
+ }
703
+ }, [
704
+ onResize,
705
+ ref
706
+ ]);
707
+ }
708
+
709
+
710
+ /*
711
+ * Copyright 2020 Adobe. All rights reserved.
712
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
713
+ * you may not use this file except in compliance with the License. You may obtain a copy
714
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
715
+ *
716
+ * Unless required by applicable law or agreed to in writing, software distributed under
717
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
718
+ * OF ANY KIND, either express or implied. See the License for the specific language
719
+ * governing permissions and limitations under the License.
720
+ */
721
+ function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
722
+ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
723
+ if (context && context.ref && ref) {
724
+ context.ref.current = ref.current;
725
+ return ()=>{
726
+ context.ref.current = null;
727
+ };
728
+ }
729
+ }, [
730
+ context,
731
+ ref
732
+ ]);
733
+ }
734
+
735
+
736
+ /*
737
+ * Copyright 2020 Adobe. All rights reserved.
738
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
739
+ * you may not use this file except in compliance with the License. You may obtain a copy
740
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
741
+ *
742
+ * Unless required by applicable law or agreed to in writing, software distributed under
743
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
744
+ * OF ANY KIND, either express or implied. See the License for the specific language
745
+ * governing permissions and limitations under the License.
746
+ */ function $62d8ded9296f3872$export$cfa2225e87938781(node) {
747
+ if ($62d8ded9296f3872$export$2bb74740c4e19def(node)) node = node.parentElement;
748
+ while(node && !$62d8ded9296f3872$export$2bb74740c4e19def(node))node = node.parentElement;
749
+ return node || document.scrollingElement || document.documentElement;
750
+ }
751
+ function $62d8ded9296f3872$export$2bb74740c4e19def(node) {
752
+ let style = window.getComputedStyle(node);
753
+ return /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
754
+ }
755
+
756
+
757
+ /*
758
+ * Copyright 2020 Adobe. All rights reserved.
759
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
760
+ * you may not use this file except in compliance with the License. You may obtain a copy
761
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
762
+ *
763
+ * Unless required by applicable law or agreed to in writing, software distributed under
764
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
765
+ * OF ANY KIND, either express or implied. See the License for the specific language
766
+ * governing permissions and limitations under the License.
767
+ */
768
+ // @ts-ignore
769
+ let $5df64b3807dc15ee$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
770
+ function $5df64b3807dc15ee$export$d699905dd57c73ca() {
771
+ let [size, setSize] = (0, $12uGp$useState)(()=>$5df64b3807dc15ee$var$getViewportSize());
772
+ (0, $12uGp$useEffect)(()=>{
773
+ // Use visualViewport api to track available height even on iOS virtual keyboard opening
774
+ let onResize = ()=>{
775
+ setSize((size)=>{
776
+ let newSize = $5df64b3807dc15ee$var$getViewportSize();
777
+ if (newSize.width === size.width && newSize.height === size.height) return size;
778
+ return newSize;
779
+ });
780
+ };
781
+ if (!$5df64b3807dc15ee$var$visualViewport) window.addEventListener("resize", onResize);
782
+ else $5df64b3807dc15ee$var$visualViewport.addEventListener("resize", onResize);
783
+ return ()=>{
784
+ if (!$5df64b3807dc15ee$var$visualViewport) window.removeEventListener("resize", onResize);
785
+ else $5df64b3807dc15ee$var$visualViewport.removeEventListener("resize", onResize);
786
+ };
787
+ }, []);
788
+ return size;
789
+ }
790
+ function $5df64b3807dc15ee$var$getViewportSize() {
791
+ return {
792
+ width: ($5df64b3807dc15ee$var$visualViewport === null || $5df64b3807dc15ee$var$visualViewport === void 0 ? void 0 : $5df64b3807dc15ee$var$visualViewport.width) || window.innerWidth,
793
+ height: ($5df64b3807dc15ee$var$visualViewport === null || $5df64b3807dc15ee$var$visualViewport === void 0 ? void 0 : $5df64b3807dc15ee$var$visualViewport.height) || window.innerHeight
794
+ };
795
+ }
796
+
797
+
798
+ /*
799
+ * Copyright 2020 Adobe. All rights reserved.
800
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
801
+ * you may not use this file except in compliance with the License. You may obtain a copy
802
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
803
+ *
804
+ * Unless required by applicable law or agreed to in writing, software distributed under
805
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
806
+ * OF ANY KIND, either express or implied. See the License for the specific language
807
+ * governing permissions and limitations under the License.
808
+ */
809
+
810
+ let $ef06256079686ba0$var$descriptionId = 0;
811
+ const $ef06256079686ba0$var$descriptionNodes = new Map();
812
+ function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
813
+ let [id, setId] = (0, $12uGp$useState)(undefined);
814
+ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
815
+ if (!description) return;
816
+ let desc = $ef06256079686ba0$var$descriptionNodes.get(description);
817
+ if (!desc) {
818
+ let id = `react-aria-description-${$ef06256079686ba0$var$descriptionId++}`;
819
+ setId(id);
820
+ let node = document.createElement("div");
821
+ node.id = id;
822
+ node.style.display = "none";
823
+ node.textContent = description;
824
+ document.body.appendChild(node);
825
+ desc = {
826
+ refCount: 0,
827
+ element: node
828
+ };
829
+ $ef06256079686ba0$var$descriptionNodes.set(description, desc);
830
+ } else setId(desc.element.id);
831
+ desc.refCount++;
832
+ return ()=>{
833
+ if (--desc.refCount === 0) {
834
+ desc.element.remove();
835
+ $ef06256079686ba0$var$descriptionNodes.delete(description);
836
+ }
837
+ };
838
+ }, [
839
+ description
840
+ ]);
841
+ return {
842
+ "aria-describedby": description ? id : undefined
843
+ };
844
+ }
845
+
846
+
847
+ /*
848
+ * Copyright 2020 Adobe. All rights reserved.
849
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
850
+ * you may not use this file except in compliance with the License. You may obtain a copy
851
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
852
+ *
853
+ * Unless required by applicable law or agreed to in writing, software distributed under
854
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
855
+ * OF ANY KIND, either express or implied. See the License for the specific language
856
+ * governing permissions and limitations under the License.
857
+ */ function $c87311424ea30a05$var$testUserAgent(re) {
858
+ var _window_navigator_userAgentData;
859
+ if (typeof window === "undefined" || window.navigator == null) return false;
860
+ 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);
861
+ }
862
+ function $c87311424ea30a05$var$testPlatform(re) {
863
+ var _window_navigator_userAgentData;
864
+ 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;
865
+ }
866
+ function $c87311424ea30a05$export$9ac100e40613ea10() {
867
+ return $c87311424ea30a05$var$testPlatform(/^Mac/i);
868
+ }
869
+ function $c87311424ea30a05$export$186c6964ca17d99() {
870
+ return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
871
+ }
872
+ function $c87311424ea30a05$export$7bef049ce92e4224() {
873
+ return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
874
+ $c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
875
+ }
876
+ function $c87311424ea30a05$export$fedb369cb70207f1() {
877
+ return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
878
+ }
879
+ function $c87311424ea30a05$export$e1865c3bedcd822b() {
880
+ return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
881
+ }
882
+ function $c87311424ea30a05$export$78551043582a6a98() {
883
+ return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
884
+ }
885
+ function $c87311424ea30a05$export$6446a186d09e379e() {
886
+ return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
887
+ }
888
+ function $c87311424ea30a05$export$a11b0059900ceec8() {
889
+ return $c87311424ea30a05$var$testUserAgent(/Android/i);
890
+ }
891
+
892
+
893
+ /*
894
+ * Copyright 2021 Adobe. All rights reserved.
895
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
896
+ * you may not use this file except in compliance with the License. You may obtain a copy
897
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
898
+ *
899
+ * Unless required by applicable law or agreed to in writing, software distributed under
900
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
901
+ * OF ANY KIND, either express or implied. See the License for the specific language
902
+ * governing permissions and limitations under the License.
903
+ */
904
+ function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler, options) {
905
+ let handlerRef = (0, $12uGp$useRef)(handler);
906
+ handlerRef.current = handler;
907
+ let isDisabled = handler == null;
908
+ (0, $12uGp$useEffect)(()=>{
909
+ if (isDisabled) return;
910
+ let element = ref.current;
911
+ let handler = (e)=>handlerRef.current.call(this, e);
912
+ element.addEventListener(event, handler, options);
913
+ return ()=>{
914
+ element.removeEventListener(event, handler, options);
915
+ };
916
+ }, [
917
+ ref,
918
+ event,
919
+ options,
920
+ isDisabled
921
+ ]);
922
+ }
923
+
924
+
925
+
926
+ /*
927
+ * Copyright 2020 Adobe. All rights reserved.
928
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
929
+ * you may not use this file except in compliance with the License. You may obtain a copy
930
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
931
+ *
932
+ * Unless required by applicable law or agreed to in writing, software distributed under
933
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
934
+ * OF ANY KIND, either express or implied. See the License for the specific language
935
+ * governing permissions and limitations under the License.
936
+ */
937
+ function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
938
+ let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, "left");
939
+ let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, "top");
940
+ let width = element.offsetWidth;
941
+ let height = element.offsetHeight;
942
+ let x = scrollView.scrollLeft;
943
+ let y = scrollView.scrollTop;
944
+ // Account for top/left border offsetting the scroll top/Left
945
+ let { borderTopWidth: borderTopWidth , borderLeftWidth: borderLeftWidth } = getComputedStyle(scrollView);
946
+ let borderAdjustedX = scrollView.scrollLeft + parseInt(borderLeftWidth, 10);
947
+ let borderAdjustedY = scrollView.scrollTop + parseInt(borderTopWidth, 10);
948
+ // Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width
949
+ let maxX = borderAdjustedX + scrollView.clientWidth;
950
+ let maxY = borderAdjustedY + scrollView.clientHeight;
951
+ if (offsetX <= x) x = offsetX - parseInt(borderLeftWidth, 10);
952
+ else if (offsetX + width > maxX) x += offsetX + width - maxX;
953
+ if (offsetY <= borderAdjustedY) y = offsetY - parseInt(borderTopWidth, 10);
954
+ else if (offsetY + height > maxY) y += offsetY + height - maxY;
955
+ scrollView.scrollLeft = x;
956
+ scrollView.scrollTop = y;
957
+ }
958
+ /**
959
+ * Computes the offset left or top from child to ancestor by accumulating
960
+ * offsetLeft or offsetTop through intervening offsetParents.
961
+ */ function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
962
+ const prop = axis === "left" ? "offsetLeft" : "offsetTop";
963
+ let sum = 0;
964
+ while(child.offsetParent){
965
+ sum += child[prop];
966
+ if (child.offsetParent === ancestor) break;
967
+ else if (child.offsetParent.contains(ancestor)) {
968
+ // If the ancestor is not `position:relative`, then we stop at
969
+ // _its_ offset parent, and we subtract off _its_ offset, so that
970
+ // we end up with the proper offset from child to ancestor.
971
+ sum -= ancestor[prop];
972
+ break;
973
+ }
974
+ child = child.offsetParent;
975
+ }
976
+ return sum;
977
+ }
978
+ function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts) {
979
+ if (document.contains(targetElement)) {
980
+ let root = document.scrollingElement || document.documentElement;
981
+ let isScrollPrevented = window.getComputedStyle(root).overflow === "hidden";
982
+ // If scrolling is not currently prevented then we aren’t in a overlay nor is a overlay open, just use element.scrollIntoView to bring the element into view
983
+ if (!isScrollPrevented) {
984
+ var // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()
985
+ // 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
986
+ _targetElement_scrollIntoView;
987
+ let { left: originalLeft , top: originalTop } = targetElement.getBoundingClientRect();
988
+ targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
989
+ block: "nearest"
990
+ });
991
+ let { left: newLeft , top: newTop } = targetElement.getBoundingClientRect();
992
+ // Account for sub pixel differences from rounding
993
+ if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
994
+ var _opts_containingElement, _opts_containingElement_scrollIntoView, _targetElement_scrollIntoView1;
995
+ opts === null || opts === void 0 ? void 0 : (_opts_containingElement = opts.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
996
+ block: "center",
997
+ inline: "center"
998
+ });
999
+ (_targetElement_scrollIntoView1 = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView1 === void 0 ? void 0 : _targetElement_scrollIntoView1.call(targetElement, {
1000
+ block: "nearest"
1001
+ });
1002
+ }
1003
+ } else {
1004
+ let scrollParent = (0, $62d8ded9296f3872$export$cfa2225e87938781)(targetElement);
1005
+ // If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.
1006
+ while(targetElement && scrollParent && targetElement !== root && scrollParent !== root){
1007
+ $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
1008
+ targetElement = scrollParent;
1009
+ scrollParent = (0, $62d8ded9296f3872$export$cfa2225e87938781)(targetElement);
1010
+ }
1011
+ }
1012
+ }
1013
+ }
1014
+
1015
+
1016
+
1017
+ /*
1018
+ * Copyright 2022 Adobe. All rights reserved.
1019
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1020
+ * you may not use this file except in compliance with the License. You may obtain a copy
1021
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1022
+ *
1023
+ * Unless required by applicable law or agreed to in writing, software distributed under
1024
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1025
+ * OF ANY KIND, either express or implied. See the License for the specific language
1026
+ * governing permissions and limitations under the License.
1027
+ */
1028
+ function $6a7db85432448f7f$export$60278871457622de(event) {
1029
+ // JAWS/NVDA with Firefox.
1030
+ if (event.mozInputSource === 0 && event.isTrusted) return true;
1031
+ // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead
1032
+ // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check
1033
+ // to detect TalkBack virtual clicks.
1034
+ if ((0, $c87311424ea30a05$export$a11b0059900ceec8)() && event.pointerType) return event.type === "click" && event.buttons === 1;
1035
+ return event.detail === 0 && !event.pointerType;
1036
+ }
1037
+ function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
1038
+ // If the pointer size is zero, then we assume it's from a screen reader.
1039
+ // Android TalkBack double tap will sometimes return a event with width and height of 1
1040
+ // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.
1041
+ // Cannot use "event.pressure === 0" as the sole check due to Safari pointer events always returning pressure === 0
1042
+ // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush
1043
+ // Talkback double tap from Windows Firefox touch screen press
1044
+ return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
1045
+ }
1046
+
1047
+
1048
+
1049
+
1050
+ 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};
1051
+ //# sourceMappingURL=module.js.map