@react-aria/utils 3.14.1 → 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.
package/dist/module.js CHANGED
@@ -3,24 +3,104 @@ import $12uGp$react, {useState as $12uGp$useState, useRef as $12uGp$useRef, useC
3
3
  import {useSSRSafeId as $12uGp$useSSRSafeId} from "@react-aria/ssr";
4
4
  import $12uGp$clsx from "clsx";
5
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 : ()=>{};
6
39
 
7
40
 
8
- const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof window !== 'undefined' ? $12uGp$react.useLayoutEffect : ()=>{
9
- };
10
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
+ */
11
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
+ }
12
92
 
13
93
 
14
94
  let $bdb11010cef70236$var$idsUpdaterMap = new Map();
15
95
  function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
16
- let [value, setValue] = $12uGp$useState(defaultId);
17
- let nextId = $12uGp$useRef(null);
18
- let res = $12uGp$useSSRSafeId(value);
19
- let updateValue = $12uGp$useCallback((val)=>{
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)=>{
20
100
  nextId.current = val;
21
101
  }, []);
22
102
  $bdb11010cef70236$var$idsUpdaterMap.set(res, updateValue);
23
- $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{
103
+ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
24
104
  let r = res;
25
105
  return ()=>{
26
106
  $bdb11010cef70236$var$idsUpdaterMap.delete(r);
@@ -30,7 +110,7 @@ function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
30
110
  ]);
31
111
  // This cannot cause an infinite loop because the ref is updated first.
32
112
  // eslint-disable-next-line
33
- $12uGp$useEffect(()=>{
113
+ (0, $12uGp$useEffect)(()=>{
34
114
  let newId = nextId.current;
35
115
  if (newId) {
36
116
  nextId.current = null;
@@ -55,8 +135,8 @@ function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
55
135
  }
56
136
  function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
57
137
  let id = $bdb11010cef70236$export$f680877a34711e37();
58
- let [resolvedId, setResolvedId] = $1dbecbe27a04f9af$export$14d238f342723f25(id);
59
- let updateId = $12uGp$useCallback(()=>{
138
+ let [resolvedId, setResolvedId] = (0, $1dbecbe27a04f9af$export$14d238f342723f25)(id);
139
+ let updateId = (0, $12uGp$useCallback)(()=>{
60
140
  setResolvedId(function*() {
61
141
  yield id;
62
142
  yield document.getElementById(id) ? id : undefined;
@@ -65,7 +145,7 @@ function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
65
145
  id,
66
146
  setResolvedId
67
147
  ]);
68
- $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(updateId, [
148
+ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(updateId, [
69
149
  id,
70
150
  updateId,
71
151
  ...depArray
@@ -74,14 +154,36 @@ function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
74
154
  }
75
155
 
76
156
 
77
- function $ff5963eb1fccf552$export$e08e3b67e392101e(...callbacks) {
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) {
78
170
  return (...args)=>{
79
- for (let callback of callbacks)if (typeof callback === 'function') callback(...args);
171
+ for (let callback of callbacks)if (typeof callback === "function") callback(...args);
80
172
  };
81
173
  }
82
174
 
83
175
 
84
-
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
+ */
85
187
 
86
188
 
87
189
  function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
@@ -96,10 +198,10 @@ function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
96
198
  let a = result[key];
97
199
  let b = props[key];
98
200
  // Chain events
99
- if (typeof a === 'function' && typeof b === 'function' && // This is a lot faster than a regex.
100
- key[0] === 'o' && key[1] === 'n' && key.charCodeAt(2) >= /* 'A' */ 65 && key.charCodeAt(2) <= /* 'Z' */ 90) result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e(a, b);
101
- else if ((key === 'className' || key === 'UNSAFE_className') && typeof a === 'string' && typeof b === 'string') result[key] = $12uGp$clsx(a, b);
102
- else if (key === 'id' && a && b) result.id = $bdb11010cef70236$export$cd8c9cb68f842629(a, b);
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);
103
205
  else result[key] = b !== undefined ? b : a;
104
206
  }
105
207
  }
@@ -107,37 +209,65 @@ function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
107
209
  }
108
210
 
109
211
 
110
- function $5dc95899b306f630$export$c9058316764c140e(...refs) {
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) {
111
223
  return (value)=>{
112
224
  for (let ref of refs){
113
- if (typeof ref === 'function') ref(value);
225
+ if (typeof ref === "function") ref(value);
114
226
  else if (ref != null) ref.current = value;
115
227
  }
116
228
  };
117
229
  }
118
230
 
119
231
 
120
- const $65484d02dcb7eb3e$var$DOMPropNames = new Set([
121
- 'id'
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"
122
244
  ]);
123
245
  const $65484d02dcb7eb3e$var$labelablePropNames = new Set([
124
- 'aria-label',
125
- 'aria-labelledby',
126
- 'aria-describedby',
127
- 'aria-details'
246
+ "aria-label",
247
+ "aria-labelledby",
248
+ "aria-describedby",
249
+ "aria-details"
128
250
  ]);
129
251
  const $65484d02dcb7eb3e$var$propRe = /^(data-.*)$/;
130
- function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts = {
131
- }) {
252
+ function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts = {}) {
132
253
  let { labelable: labelable , propNames: propNames } = opts;
133
- let filteredProps = {
134
- };
254
+ let filteredProps = {};
135
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];
136
256
  return filteredProps;
137
257
  }
138
258
 
139
259
 
140
- function $7215afc6de606d6b$export$de79e2c695e052f3(element) {
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) {
141
271
  if ($7215afc6de606d6b$var$supportsPreventScroll()) element.focus({
142
272
  preventScroll: true
143
273
  });
@@ -152,7 +282,7 @@ function $7215afc6de606d6b$var$supportsPreventScroll() {
152
282
  if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) {
153
283
  $7215afc6de606d6b$var$supportsPreventScrollCached = false;
154
284
  try {
155
- var focusElem = document.createElement('div');
285
+ var focusElem = document.createElement("div");
156
286
  focusElem.focus({
157
287
  get preventScroll () {
158
288
  $7215afc6de606d6b$var$supportsPreventScrollCached = true;
@@ -192,10 +322,20 @@ function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
192
322
  }
193
323
 
194
324
 
195
- function $ab71dadb03a6fb2e$export$622cea445a1c5b7d(element, reverse, orientation = 'horizontal') {
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") {
196
336
  let rect = element.getBoundingClientRect();
197
- if (reverse) return orientation === 'horizontal' ? rect.right : rect.bottom;
198
- return orientation === 'horizontal' ? rect.left : rect.top;
337
+ if (reverse) return orientation === "horizontal" ? rect.right : rect.bottom;
338
+ return orientation === "horizontal" ? rect.left : rect.top;
199
339
  }
200
340
 
201
341
 
@@ -219,7 +359,7 @@ let $bbed8b41f857bcc0$var$transitionsByElement = new Map();
219
359
  // A list of callbacks to call once there are no transitioning elements.
220
360
  let $bbed8b41f857bcc0$var$transitionCallbacks = new Set();
221
361
  function $bbed8b41f857bcc0$var$setupGlobalEvents() {
222
- if (typeof window === 'undefined') return;
362
+ if (typeof window === "undefined") return;
223
363
  let onTransitionStart = (e)=>{
224
364
  // Add the transitioning property to the list for this element.
225
365
  let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
@@ -229,7 +369,7 @@ function $bbed8b41f857bcc0$var$setupGlobalEvents() {
229
369
  // The transitioncancel event must be registered on the element itself, rather than as a global
230
370
  // event. This enables us to handle when the node is deleted from the document while it is transitioning.
231
371
  // In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
232
- e.target.addEventListener('transitioncancel', onTransitionEnd);
372
+ e.target.addEventListener("transitioncancel", onTransitionEnd);
233
373
  }
234
374
  transitions.add(e.propertyName);
235
375
  };
@@ -240,7 +380,7 @@ function $bbed8b41f857bcc0$var$setupGlobalEvents() {
240
380
  properties.delete(e.propertyName);
241
381
  // If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
242
382
  if (properties.size === 0) {
243
- e.target.removeEventListener('transitioncancel', onTransitionEnd);
383
+ e.target.removeEventListener("transitioncancel", onTransitionEnd);
244
384
  $bbed8b41f857bcc0$var$transitionsByElement.delete(e.target);
245
385
  }
246
386
  // If no transitioning elements, call all of the queued callbacks.
@@ -249,12 +389,12 @@ function $bbed8b41f857bcc0$var$setupGlobalEvents() {
249
389
  $bbed8b41f857bcc0$var$transitionCallbacks.clear();
250
390
  }
251
391
  };
252
- document.body.addEventListener('transitionrun', onTransitionStart);
253
- document.body.addEventListener('transitionend', onTransitionEnd);
392
+ document.body.addEventListener("transitionrun", onTransitionStart);
393
+ document.body.addEventListener("transitionend", onTransitionEnd);
254
394
  }
255
- if (typeof document !== 'undefined') {
256
- if (document.readyState !== 'loading') $bbed8b41f857bcc0$var$setupGlobalEvents();
257
- else document.addEventListener('DOMContentLoaded', $bbed8b41f857bcc0$var$setupGlobalEvents);
395
+ if (typeof document !== "undefined") {
396
+ if (document.readyState !== "loading") $bbed8b41f857bcc0$var$setupGlobalEvents();
397
+ else document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents);
258
398
  }
259
399
  function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
260
400
  // Wait one frame to see if an animation starts, e.g. a transition on mount.
@@ -267,27 +407,36 @@ function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
267
407
  }
268
408
 
269
409
 
270
-
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
+ */
271
421
 
272
422
  // Keep track of elements that we are currently handling dragging for via useDrag1D.
273
423
  // If there's an ancestor and a descendant both using useDrag1D(), and the user starts
274
424
  // dragging the descendant, we don't want useDrag1D events to fire for the ancestor.
275
425
  const $9cc09df9fd7676be$var$draggingElements = [];
276
426
  function $9cc09df9fd7676be$export$7bbed75feba39706(props) {
277
- console.warn('useDrag1D is deprecated, please use `useMove` instead https://react-spectrum.adobe.com/react-aria/useMove.html');
427
+ console.warn("useDrag1D is deprecated, please use `useMove` instead https://react-spectrum.adobe.com/react-aria/useMove.html");
278
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;
279
- let getPosition = (e)=>orientation === 'horizontal' ? e.clientX : e.clientY
280
- ;
429
+ let getPosition = (e)=>orientation === "horizontal" ? e.clientX : e.clientY;
281
430
  let getNextOffset = (e)=>{
282
- let containerOffset = $ab71dadb03a6fb2e$export$622cea445a1c5b7d(containerRef.current, reverse, orientation);
431
+ let containerOffset = (0, $ab71dadb03a6fb2e$export$622cea445a1c5b7d)(containerRef.current, reverse, orientation);
283
432
  let mouseOffset = getPosition(e);
284
433
  let nextOffset = reverse ? containerOffset - mouseOffset : mouseOffset - containerOffset;
285
434
  return nextOffset;
286
435
  };
287
- let dragging = $12uGp$useRef(false);
288
- let prevPosition = $12uGp$useRef(0);
436
+ let dragging = (0, $12uGp$useRef)(false);
437
+ let prevPosition = (0, $12uGp$useRef)(0);
289
438
  // Keep track of the current handlers in a ref so that the events can access them.
290
- let handlers = $12uGp$useRef({
439
+ let handlers = (0, $12uGp$useRef)({
291
440
  onPositionChange: onPositionChange,
292
441
  onDrag: onDrag
293
442
  });
@@ -312,18 +461,17 @@ function $9cc09df9fd7676be$export$7bbed75feba39706(props) {
312
461
  if (handlers.current.onDrag) handlers.current.onDrag(false);
313
462
  if (handlers.current.onPositionChange) handlers.current.onPositionChange(nextOffset);
314
463
  $9cc09df9fd7676be$var$draggingElements.splice($9cc09df9fd7676be$var$draggingElements.indexOf(target), 1);
315
- window.removeEventListener('mouseup', onMouseUp, false);
316
- window.removeEventListener('mousemove', onMouseDragged, false);
464
+ window.removeEventListener("mouseup", onMouseUp, false);
465
+ window.removeEventListener("mousemove", onMouseDragged, false);
317
466
  };
318
467
  let onMouseDown = (e)=>{
319
468
  const target = e.currentTarget;
320
469
  // If we're already handling dragging on a descendant with useDrag1D, then
321
470
  // we don't want to handle the drag motion on this target as well.
322
- if ($9cc09df9fd7676be$var$draggingElements.some((elt)=>target.contains(elt)
323
- )) return;
471
+ if ($9cc09df9fd7676be$var$draggingElements.some((elt)=>target.contains(elt))) return;
324
472
  $9cc09df9fd7676be$var$draggingElements.push(target);
325
- window.addEventListener('mousemove', onMouseDragged, false);
326
- window.addEventListener('mouseup', onMouseUp, false);
473
+ window.addEventListener("mousemove", onMouseDragged, false);
474
+ window.addEventListener("mouseup", onMouseUp, false);
327
475
  };
328
476
  let onMouseEnter = ()=>{
329
477
  if (onHover) onHover(true);
@@ -333,47 +481,47 @@ function $9cc09df9fd7676be$export$7bbed75feba39706(props) {
333
481
  };
334
482
  let onKeyDown = (e)=>{
335
483
  switch(e.key){
336
- case 'Left':
337
- case 'ArrowLeft':
338
- if (orientation === 'horizontal') {
484
+ case "Left":
485
+ case "ArrowLeft":
486
+ if (orientation === "horizontal") {
339
487
  e.preventDefault();
340
488
  if (onDecrement && !reverse) onDecrement();
341
489
  else if (onIncrement && reverse) onIncrement();
342
490
  }
343
491
  break;
344
- case 'Up':
345
- case 'ArrowUp':
346
- if (orientation === 'vertical') {
492
+ case "Up":
493
+ case "ArrowUp":
494
+ if (orientation === "vertical") {
347
495
  e.preventDefault();
348
496
  if (onDecrement && !reverse) onDecrement();
349
497
  else if (onIncrement && reverse) onIncrement();
350
498
  }
351
499
  break;
352
- case 'Right':
353
- case 'ArrowRight':
354
- if (orientation === 'horizontal') {
500
+ case "Right":
501
+ case "ArrowRight":
502
+ if (orientation === "horizontal") {
355
503
  e.preventDefault();
356
504
  if (onIncrement && !reverse) onIncrement();
357
505
  else if (onDecrement && reverse) onDecrement();
358
506
  }
359
507
  break;
360
- case 'Down':
361
- case 'ArrowDown':
362
- if (orientation === 'vertical') {
508
+ case "Down":
509
+ case "ArrowDown":
510
+ if (orientation === "vertical") {
363
511
  e.preventDefault();
364
512
  if (onIncrement && !reverse) onIncrement();
365
513
  else if (onDecrement && reverse) onDecrement();
366
514
  }
367
515
  break;
368
- case 'Home':
516
+ case "Home":
369
517
  e.preventDefault();
370
518
  if (onDecrementToMin) onDecrementToMin();
371
519
  break;
372
- case 'End':
520
+ case "End":
373
521
  e.preventDefault();
374
522
  if (onIncrementToMax) onIncrementToMax();
375
523
  break;
376
- case 'Enter':
524
+ case "Enter":
377
525
  e.preventDefault();
378
526
  if (onCollapseToggle) onCollapseToggle();
379
527
  break;
@@ -388,10 +536,20 @@ function $9cc09df9fd7676be$export$7bbed75feba39706(props) {
388
536
  }
389
537
 
390
538
 
391
-
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
+ */
392
550
  function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
393
- let globalListeners = $12uGp$useRef(new Map());
394
- let addGlobalListener = $12uGp$useCallback((eventTarget, type, listener, options)=>{
551
+ let globalListeners = (0, $12uGp$useRef)(new Map());
552
+ let addGlobalListener = (0, $12uGp$useCallback)((eventTarget, type, listener, options)=>{
395
553
  // Make sure we remove the listener after it is called with the `once` option.
396
554
  let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args)=>{
397
555
  globalListeners.current.delete(listener);
@@ -405,13 +563,13 @@ function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
405
563
  });
406
564
  eventTarget.addEventListener(type, listener, options);
407
565
  }, []);
408
- let removeGlobalListener = $12uGp$useCallback((eventTarget, type, listener, options)=>{
409
- var ref;
410
- let fn = ((ref = globalListeners.current.get(listener)) === null || ref === void 0 ? void 0 : ref.fn) || listener;
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;
411
569
  eventTarget.removeEventListener(type, fn, options);
412
570
  globalListeners.current.delete(listener);
413
571
  }, []);
414
- let removeAllGlobalListeners = $12uGp$useCallback(()=>{
572
+ let removeAllGlobalListeners = (0, $12uGp$useCallback)(()=>{
415
573
  globalListeners.current.forEach((value, key)=>{
416
574
  removeGlobalListener(value.eventTarget, value.type, key, value.options);
417
575
  });
@@ -419,7 +577,7 @@ function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
419
577
  removeGlobalListener
420
578
  ]);
421
579
  // eslint-disable-next-line arrow-body-style
422
- $12uGp$useEffect(()=>{
580
+ (0, $12uGp$useEffect)(()=>{
423
581
  return removeAllGlobalListeners;
424
582
  }, [
425
583
  removeAllGlobalListeners
@@ -432,12 +590,22 @@ function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
432
590
  }
433
591
 
434
592
 
435
-
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
+ */
436
604
  function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
437
- let { id: id , 'aria-label': label , 'aria-labelledby': labelledBy } = props;
605
+ let { id: id , "aria-label": label , "aria-labelledby": labelledBy } = props;
438
606
  // If there is both an aria-label and aria-labelledby,
439
607
  // combine them by pointing to the element itself.
440
- id = $bdb11010cef70236$export$f680877a34711e37(id);
608
+ id = (0, $bdb11010cef70236$export$f680877a34711e37)(id);
441
609
  if (labelledBy && label) {
442
610
  let ids = new Set([
443
611
  ...labelledBy.trim().split(/\s+/),
@@ -445,29 +613,39 @@ function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
445
613
  ]);
446
614
  labelledBy = [
447
615
  ...ids
448
- ].join(' ');
449
- } else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(' ');
616
+ ].join(" ");
617
+ } else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(" ");
450
618
  // If no labels are provided, use the default
451
619
  if (!label && !labelledBy && defaultLabel) label = defaultLabel;
452
620
  return {
453
621
  id: id,
454
- 'aria-label': label,
455
- 'aria-labelledby': labelledBy
622
+ "aria-label": label,
623
+ "aria-labelledby": labelledBy
456
624
  };
457
625
  }
458
626
 
459
627
 
460
-
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
+ */
461
639
 
462
640
  function $df56164dff5785e2$export$4338b53315abf666(forwardedRef) {
463
- const objRef = $12uGp$useRef();
641
+ const objRef = (0, $12uGp$useRef)();
464
642
  /**
465
643
  * We're using `useLayoutEffect` here instead of `useEffect` because we want
466
644
  * to make sure that the `ref` value is up to date before other places in the
467
645
  * the execution cycle try to read it.
468
- */ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{
646
+ */ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
469
647
  if (!forwardedRef) return;
470
- if (typeof forwardedRef === 'function') forwardedRef(objRef.current);
648
+ if (typeof forwardedRef === "function") forwardedRef(objRef.current);
471
649
  else forwardedRef.current = objRef.current;
472
650
  }, [
473
651
  forwardedRef
@@ -476,10 +654,20 @@ function $df56164dff5785e2$export$4338b53315abf666(forwardedRef) {
476
654
  }
477
655
 
478
656
 
479
-
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
+ */
480
668
  function $4f58c5f72bcf79f7$export$496315a1608d9602(effect, dependencies) {
481
- const isInitialMount = $12uGp$useRef(true);
482
- $12uGp$useEffect(()=>{
669
+ const isInitialMount = (0, $12uGp$useRef)(true);
670
+ (0, $12uGp$useEffect)(()=>{
483
671
  if (isInitialMount.current) isInitialMount.current = false;
484
672
  else effect();
485
673
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -490,17 +678,17 @@ function $4f58c5f72bcf79f7$export$496315a1608d9602(effect, dependencies) {
490
678
 
491
679
 
492
680
  function $9daab02d461809db$var$hasResizeObserver() {
493
- return typeof window.ResizeObserver !== 'undefined';
681
+ return typeof window.ResizeObserver !== "undefined";
494
682
  }
495
683
  function $9daab02d461809db$export$683480f191c0e3ea(options) {
496
684
  const { ref: ref , onResize: onResize } = options;
497
- $12uGp$useEffect(()=>{
685
+ (0, $12uGp$useEffect)(()=>{
498
686
  let element = ref === null || ref === void 0 ? void 0 : ref.current;
499
687
  if (!element) return;
500
688
  if (!$9daab02d461809db$var$hasResizeObserver()) {
501
- window.addEventListener('resize', onResize, false);
689
+ window.addEventListener("resize", onResize, false);
502
690
  return ()=>{
503
- window.removeEventListener('resize', onResize, false);
691
+ window.removeEventListener("resize", onResize, false);
504
692
  };
505
693
  } else {
506
694
  const resizeObserverInstance = new window.ResizeObserver((entries)=>{
@@ -519,9 +707,19 @@ function $9daab02d461809db$export$683480f191c0e3ea(options) {
519
707
  }
520
708
 
521
709
 
522
-
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
+ */
523
721
  function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
524
- $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{
722
+ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
525
723
  if (context && context.ref && ref) {
526
724
  context.ref.current = ref.current;
527
725
  return ()=>{
@@ -535,23 +733,43 @@ function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
535
733
  }
536
734
 
537
735
 
538
- function $62d8ded9296f3872$export$cfa2225e87938781(node) {
539
- while(node && !$62d8ded9296f3872$var$isScrollable(node))node = node.parentElement;
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;
540
749
  return node || document.scrollingElement || document.documentElement;
541
750
  }
542
- function $62d8ded9296f3872$var$isScrollable(node) {
751
+ function $62d8ded9296f3872$export$2bb74740c4e19def(node) {
543
752
  let style = window.getComputedStyle(node);
544
753
  return /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
545
754
  }
546
755
 
547
756
 
548
-
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
+ */
549
768
  // @ts-ignore
550
- let $5df64b3807dc15ee$var$visualViewport = typeof window !== 'undefined' && window.visualViewport;
769
+ let $5df64b3807dc15ee$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
551
770
  function $5df64b3807dc15ee$export$d699905dd57c73ca() {
552
- let [size1, setSize] = $12uGp$useState(()=>$5df64b3807dc15ee$var$getViewportSize()
553
- );
554
- $12uGp$useEffect(()=>{
771
+ let [size, setSize] = (0, $12uGp$useState)(()=>$5df64b3807dc15ee$var$getViewportSize());
772
+ (0, $12uGp$useEffect)(()=>{
555
773
  // Use visualViewport api to track available height even on iOS virtual keyboard opening
556
774
  let onResize = ()=>{
557
775
  setSize((size)=>{
@@ -560,14 +778,14 @@ function $5df64b3807dc15ee$export$d699905dd57c73ca() {
560
778
  return newSize;
561
779
  });
562
780
  };
563
- if (!$5df64b3807dc15ee$var$visualViewport) window.addEventListener('resize', onResize);
564
- else $5df64b3807dc15ee$var$visualViewport.addEventListener('resize', onResize);
781
+ if (!$5df64b3807dc15ee$var$visualViewport) window.addEventListener("resize", onResize);
782
+ else $5df64b3807dc15ee$var$visualViewport.addEventListener("resize", onResize);
565
783
  return ()=>{
566
- if (!$5df64b3807dc15ee$var$visualViewport) window.removeEventListener('resize', onResize);
567
- else $5df64b3807dc15ee$var$visualViewport.removeEventListener('resize', onResize);
784
+ if (!$5df64b3807dc15ee$var$visualViewport) window.removeEventListener("resize", onResize);
785
+ else $5df64b3807dc15ee$var$visualViewport.removeEventListener("resize", onResize);
568
786
  };
569
787
  }, []);
570
- return size1;
788
+ return size;
571
789
  }
572
790
  function $5df64b3807dc15ee$var$getViewportSize() {
573
791
  return {
@@ -577,21 +795,31 @@ function $5df64b3807dc15ee$var$getViewportSize() {
577
795
  }
578
796
 
579
797
 
580
-
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
+ */
581
809
 
582
810
  let $ef06256079686ba0$var$descriptionId = 0;
583
811
  const $ef06256079686ba0$var$descriptionNodes = new Map();
584
812
  function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
585
- let [id1, setId] = $12uGp$useState(undefined);
586
- $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{
813
+ let [id, setId] = (0, $12uGp$useState)(undefined);
814
+ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
587
815
  if (!description) return;
588
816
  let desc = $ef06256079686ba0$var$descriptionNodes.get(description);
589
817
  if (!desc) {
590
818
  let id = `react-aria-description-${$ef06256079686ba0$var$descriptionId++}`;
591
819
  setId(id);
592
- let node = document.createElement('div');
820
+ let node = document.createElement("div");
593
821
  node.id = id;
594
- node.style.display = 'none';
822
+ node.style.display = "none";
595
823
  node.textContent = description;
596
824
  document.body.appendChild(node);
597
825
  desc = {
@@ -611,7 +839,7 @@ function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
611
839
  description
612
840
  ]);
613
841
  return {
614
- 'aria-describedby': description ? id1 : undefined
842
+ "aria-describedby": description ? id : undefined
615
843
  };
616
844
  }
617
845
 
@@ -627,14 +855,13 @@ function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
627
855
  * OF ANY KIND, either express or implied. See the License for the specific language
628
856
  * governing permissions and limitations under the License.
629
857
  */ function $c87311424ea30a05$var$testUserAgent(re) {
630
- var ref;
631
- if (typeof window === 'undefined' || window.navigator == null) return false;
632
- return ((ref = window.navigator['userAgentData']) === null || ref === void 0 ? void 0 : ref.brands.some((brand)=>re.test(brand.brand)
633
- )) || re.test(window.navigator.userAgent);
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);
634
861
  }
635
862
  function $c87311424ea30a05$var$testPlatform(re) {
636
- var ref;
637
- return typeof window !== 'undefined' && window.navigator != null ? re.test(((ref = window.navigator['userAgentData']) === null || ref === void 0 ? void 0 : ref.platform) || window.navigator.platform) : false;
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;
638
865
  }
639
866
  function $c87311424ea30a05$export$9ac100e40613ea10() {
640
867
  return $c87311424ea30a05$var$testPlatform(/^Mac/i);
@@ -643,7 +870,8 @@ function $c87311424ea30a05$export$186c6964ca17d99() {
643
870
  return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
644
871
  }
645
872
  function $c87311424ea30a05$export$7bef049ce92e4224() {
646
- return $c87311424ea30a05$var$testPlatform(/^iPad/i) || $c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
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;
647
875
  }
648
876
  function $c87311424ea30a05$export$fedb369cb70207f1() {
649
877
  return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
@@ -662,16 +890,25 @@ function $c87311424ea30a05$export$a11b0059900ceec8() {
662
890
  }
663
891
 
664
892
 
665
-
666
- function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler1, options) {
667
- let handlerRef = $12uGp$useRef(handler1);
668
- handlerRef.current = handler1;
669
- let isDisabled = handler1 == null;
670
- $12uGp$useEffect(()=>{
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)(()=>{
671
909
  if (isDisabled) return;
672
910
  let element = ref.current;
673
- let handler = (e)=>handlerRef.current.call(this, e)
674
- ;
911
+ let handler = (e)=>handlerRef.current.call(this, e);
675
912
  element.addEventListener(event, handler, options);
676
913
  return ()=>{
677
914
  element.removeEventListener(event, handler, options);
@@ -686,59 +923,34 @@ function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler1, options
686
923
 
687
924
 
688
925
 
689
-
690
- function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
691
- let [value, setValue] = $12uGp$useState(defaultValue);
692
- let valueRef = $12uGp$useRef(value);
693
- let effect = $12uGp$useRef(null);
694
- valueRef.current = value;
695
- // Store the function in a ref so we can always access the current version
696
- // which has the proper `value` in scope.
697
- let nextRef = $12uGp$useRef(null);
698
- nextRef.current = ()=>{
699
- // Run the generator to the next yield.
700
- let newValue = effect.current.next();
701
- // If the generator is done, reset the effect.
702
- if (newValue.done) {
703
- effect.current = null;
704
- return;
705
- }
706
- // If the value is the same as the current value,
707
- // then continue to the next yield. Otherwise,
708
- // set the value in state and wait for the next layout effect.
709
- if (value === newValue.value) nextRef.current();
710
- else setValue(newValue.value);
711
- };
712
- $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{
713
- // If there is an effect currently running, continue to the next yield.
714
- if (effect.current) nextRef.current();
715
- });
716
- let queue = $12uGp$useCallback((fn)=>{
717
- effect.current = fn(valueRef.current);
718
- nextRef.current();
719
- }, [
720
- effect,
721
- nextRef
722
- ]);
723
- return [
724
- value,
725
- queue
726
- ];
727
- }
728
-
729
-
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
+ */
730
937
  function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
731
- let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'left');
732
- let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'top');
938
+ let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, "left");
939
+ let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, "top");
733
940
  let width = element.offsetWidth;
734
941
  let height = element.offsetHeight;
735
942
  let x = scrollView.scrollLeft;
736
943
  let y = scrollView.scrollTop;
737
- let maxX = x + scrollView.offsetWidth;
738
- let maxY = y + scrollView.offsetHeight;
739
- if (offsetX <= x) x = offsetX;
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);
740
952
  else if (offsetX + width > maxX) x += offsetX + width - maxX;
741
- if (offsetY <= y) y = offsetY;
953
+ if (offsetY <= borderAdjustedY) y = offsetY - parseInt(borderTopWidth, 10);
742
954
  else if (offsetY + height > maxY) y += offsetY + height - maxY;
743
955
  scrollView.scrollLeft = x;
744
956
  scrollView.scrollTop = y;
@@ -747,7 +959,7 @@ function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
747
959
  * Computes the offset left or top from child to ancestor by accumulating
748
960
  * offsetLeft or offsetTop through intervening offsetParents.
749
961
  */ function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
750
- const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';
962
+ const prop = axis === "left" ? "offsetLeft" : "offsetTop";
751
963
  let sum = 0;
752
964
  while(child.offsetParent){
753
965
  sum += child[prop];
@@ -763,17 +975,63 @@ function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
763
975
  }
764
976
  return sum;
765
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
+ }
766
1014
 
767
1015
 
768
1016
 
769
-
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
+ */
770
1028
  function $6a7db85432448f7f$export$60278871457622de(event) {
771
1029
  // JAWS/NVDA with Firefox.
772
1030
  if (event.mozInputSource === 0 && event.isTrusted) return true;
773
1031
  // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead
774
1032
  // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check
775
1033
  // to detect TalkBack virtual clicks.
776
- if ($c87311424ea30a05$export$a11b0059900ceec8() && event.pointerType) return event.type === 'click' && event.buttons === 1;
1034
+ if ((0, $c87311424ea30a05$export$a11b0059900ceec8)() && event.pointerType) return event.type === "click" && event.buttons === 1;
777
1035
  return event.detail === 0 && !event.pointerType;
778
1036
  }
779
1037
  function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
@@ -783,11 +1041,11 @@ function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
783
1041
  // Cannot use "event.pressure === 0" as the sole check due to Safari pointer events always returning pressure === 0
784
1042
  // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush
785
1043
  // Talkback double tap from Windows Firefox touch screen press
786
- return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse';
1044
+ return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
787
1045
  }
788
1046
 
789
1047
 
790
1048
 
791
1049
 
792
- 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, $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, $4507461a1b870123$re_export$clamp as clamp, $4507461a1b870123$re_export$snapValueToStep as snapValueToStep, $6a7db85432448f7f$export$60278871457622de as isVirtualClick, $6a7db85432448f7f$export$29bf1b5f2c56cf63 as isVirtualPointerEvent};
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};
793
1051
  //# sourceMappingURL=module.js.map