UNPKG

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