@react-aria/utils 3.14.1 → 3.14.2
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/main.js +399 -180
- package/dist/main.js.map +1 -1
- package/dist/module.js +399 -180
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
package/dist/main.js
CHANGED
|
@@ -46,24 +46,104 @@ $parcel$export(module.exports, "clamp", () => $1Yh1N$reactstatelyutils.clamp);
|
|
|
46
46
|
$parcel$export(module.exports, "snapValueToStep", () => $1Yh1N$reactstatelyutils.snapValueToStep);
|
|
47
47
|
$parcel$export(module.exports, "isVirtualClick", () => $577e795361f19be9$export$60278871457622de);
|
|
48
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
|
+
*/
|
|
81
|
+
const $78605a5d7424e31b$export$e5c5a5f917a5871c = typeof window !== "undefined" ? (0, ($parcel$interopDefault($1Yh1N$react))).useLayoutEffect : ()=>{};
|
|
49
82
|
|
|
50
83
|
|
|
51
|
-
const $78605a5d7424e31b$export$e5c5a5f917a5871c = typeof window !== 'undefined' ? ($parcel$interopDefault($1Yh1N$react)).useLayoutEffect : ()=>{
|
|
52
|
-
};
|
|
53
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
|
+
*/
|
|
54
96
|
|
|
97
|
+
function $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
|
+
}
|
|
55
135
|
|
|
56
136
|
|
|
57
137
|
let $8c61827343eed941$var$idsUpdaterMap = new Map();
|
|
58
138
|
function $8c61827343eed941$export$f680877a34711e37(defaultId) {
|
|
59
|
-
let [value, setValue] = $1Yh1N$react.useState(defaultId);
|
|
60
|
-
let nextId = $1Yh1N$react.useRef(null);
|
|
61
|
-
let res = $1Yh1N$reactariassr.useSSRSafeId(value);
|
|
62
|
-
let updateValue = $1Yh1N$react.useCallback((val)=>{
|
|
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)=>{
|
|
63
143
|
nextId.current = val;
|
|
64
144
|
}, []);
|
|
65
145
|
$8c61827343eed941$var$idsUpdaterMap.set(res, updateValue);
|
|
66
|
-
$78605a5d7424e31b$export$e5c5a5f917a5871c(()=>{
|
|
146
|
+
(0, $78605a5d7424e31b$export$e5c5a5f917a5871c)(()=>{
|
|
67
147
|
let r = res;
|
|
68
148
|
return ()=>{
|
|
69
149
|
$8c61827343eed941$var$idsUpdaterMap.delete(r);
|
|
@@ -73,7 +153,7 @@ function $8c61827343eed941$export$f680877a34711e37(defaultId) {
|
|
|
73
153
|
]);
|
|
74
154
|
// This cannot cause an infinite loop because the ref is updated first.
|
|
75
155
|
// eslint-disable-next-line
|
|
76
|
-
$1Yh1N$react.useEffect(()=>{
|
|
156
|
+
(0, $1Yh1N$react.useEffect)(()=>{
|
|
77
157
|
let newId = nextId.current;
|
|
78
158
|
if (newId) {
|
|
79
159
|
nextId.current = null;
|
|
@@ -98,8 +178,8 @@ function $8c61827343eed941$export$cd8c9cb68f842629(idA, idB) {
|
|
|
98
178
|
}
|
|
99
179
|
function $8c61827343eed941$export$b4cc09c592e8fdb8(depArray = []) {
|
|
100
180
|
let id = $8c61827343eed941$export$f680877a34711e37();
|
|
101
|
-
let [resolvedId, setResolvedId] = $19a2307bfabafaf1$export$14d238f342723f25(id);
|
|
102
|
-
let updateId = $1Yh1N$react.useCallback(()=>{
|
|
181
|
+
let [resolvedId, setResolvedId] = (0, $19a2307bfabafaf1$export$14d238f342723f25)(id);
|
|
182
|
+
let updateId = (0, $1Yh1N$react.useCallback)(()=>{
|
|
103
183
|
setResolvedId(function*() {
|
|
104
184
|
yield id;
|
|
105
185
|
yield document.getElementById(id) ? id : undefined;
|
|
@@ -108,7 +188,7 @@ function $8c61827343eed941$export$b4cc09c592e8fdb8(depArray = []) {
|
|
|
108
188
|
id,
|
|
109
189
|
setResolvedId
|
|
110
190
|
]);
|
|
111
|
-
$78605a5d7424e31b$export$e5c5a5f917a5871c(updateId, [
|
|
191
|
+
(0, $78605a5d7424e31b$export$e5c5a5f917a5871c)(updateId, [
|
|
112
192
|
id,
|
|
113
193
|
updateId,
|
|
114
194
|
...depArray
|
|
@@ -117,14 +197,36 @@ function $8c61827343eed941$export$b4cc09c592e8fdb8(depArray = []) {
|
|
|
117
197
|
}
|
|
118
198
|
|
|
119
199
|
|
|
120
|
-
|
|
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) {
|
|
121
213
|
return (...args)=>{
|
|
122
|
-
for (let callback of callbacks)if (typeof callback ===
|
|
214
|
+
for (let callback of callbacks)if (typeof callback === "function") callback(...args);
|
|
123
215
|
};
|
|
124
216
|
}
|
|
125
217
|
|
|
126
218
|
|
|
127
|
-
|
|
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
|
+
*/
|
|
128
230
|
|
|
129
231
|
|
|
130
232
|
function $f847cd1382ea7cd4$export$9d1611c77c2fe928(...args) {
|
|
@@ -139,10 +241,10 @@ function $f847cd1382ea7cd4$export$9d1611c77c2fe928(...args) {
|
|
|
139
241
|
let a = result[key];
|
|
140
242
|
let b = props[key];
|
|
141
243
|
// Chain events
|
|
142
|
-
if (typeof a ===
|
|
143
|
-
key[0] ===
|
|
144
|
-
else if ((key ===
|
|
145
|
-
else if (key ===
|
|
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);
|
|
146
248
|
else result[key] = b !== undefined ? b : a;
|
|
147
249
|
}
|
|
148
250
|
}
|
|
@@ -150,37 +252,65 @@ function $f847cd1382ea7cd4$export$9d1611c77c2fe928(...args) {
|
|
|
150
252
|
}
|
|
151
253
|
|
|
152
254
|
|
|
153
|
-
|
|
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) {
|
|
154
266
|
return (value)=>{
|
|
155
267
|
for (let ref of refs){
|
|
156
|
-
if (typeof ref ===
|
|
268
|
+
if (typeof ref === "function") ref(value);
|
|
157
269
|
else if (ref != null) ref.current = value;
|
|
158
270
|
}
|
|
159
271
|
};
|
|
160
272
|
}
|
|
161
273
|
|
|
162
274
|
|
|
163
|
-
|
|
164
|
-
|
|
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"
|
|
165
287
|
]);
|
|
166
288
|
const $8d15d0e1797d4238$var$labelablePropNames = new Set([
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
289
|
+
"aria-label",
|
|
290
|
+
"aria-labelledby",
|
|
291
|
+
"aria-describedby",
|
|
292
|
+
"aria-details"
|
|
171
293
|
]);
|
|
172
294
|
const $8d15d0e1797d4238$var$propRe = /^(data-.*)$/;
|
|
173
|
-
function $8d15d0e1797d4238$export$457c3d6518dd4c6f(props, opts = {
|
|
174
|
-
}) {
|
|
295
|
+
function $8d15d0e1797d4238$export$457c3d6518dd4c6f(props, opts = {}) {
|
|
175
296
|
let { labelable: labelable , propNames: propNames } = opts;
|
|
176
|
-
let filteredProps = {
|
|
177
|
-
};
|
|
297
|
+
let filteredProps = {};
|
|
178
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];
|
|
179
299
|
return filteredProps;
|
|
180
300
|
}
|
|
181
301
|
|
|
182
302
|
|
|
183
|
-
|
|
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) {
|
|
184
314
|
if ($1117b6c0d4c4c164$var$supportsPreventScroll()) element.focus({
|
|
185
315
|
preventScroll: true
|
|
186
316
|
});
|
|
@@ -195,7 +325,7 @@ function $1117b6c0d4c4c164$var$supportsPreventScroll() {
|
|
|
195
325
|
if ($1117b6c0d4c4c164$var$supportsPreventScrollCached == null) {
|
|
196
326
|
$1117b6c0d4c4c164$var$supportsPreventScrollCached = false;
|
|
197
327
|
try {
|
|
198
|
-
var focusElem = document.createElement(
|
|
328
|
+
var focusElem = document.createElement("div");
|
|
199
329
|
focusElem.focus({
|
|
200
330
|
get preventScroll () {
|
|
201
331
|
$1117b6c0d4c4c164$var$supportsPreventScrollCached = true;
|
|
@@ -235,10 +365,20 @@ function $1117b6c0d4c4c164$var$restoreScrollPosition(scrollableElements) {
|
|
|
235
365
|
}
|
|
236
366
|
|
|
237
367
|
|
|
238
|
-
|
|
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") {
|
|
239
379
|
let rect = element.getBoundingClientRect();
|
|
240
|
-
if (reverse) return orientation ===
|
|
241
|
-
return orientation ===
|
|
380
|
+
if (reverse) return orientation === "horizontal" ? rect.right : rect.bottom;
|
|
381
|
+
return orientation === "horizontal" ? rect.left : rect.top;
|
|
242
382
|
}
|
|
243
383
|
|
|
244
384
|
|
|
@@ -262,7 +402,7 @@ let $e8117ebcab55be6a$var$transitionsByElement = new Map();
|
|
|
262
402
|
// A list of callbacks to call once there are no transitioning elements.
|
|
263
403
|
let $e8117ebcab55be6a$var$transitionCallbacks = new Set();
|
|
264
404
|
function $e8117ebcab55be6a$var$setupGlobalEvents() {
|
|
265
|
-
if (typeof window ===
|
|
405
|
+
if (typeof window === "undefined") return;
|
|
266
406
|
let onTransitionStart = (e)=>{
|
|
267
407
|
// Add the transitioning property to the list for this element.
|
|
268
408
|
let transitions = $e8117ebcab55be6a$var$transitionsByElement.get(e.target);
|
|
@@ -272,7 +412,7 @@ function $e8117ebcab55be6a$var$setupGlobalEvents() {
|
|
|
272
412
|
// The transitioncancel event must be registered on the element itself, rather than as a global
|
|
273
413
|
// event. This enables us to handle when the node is deleted from the document while it is transitioning.
|
|
274
414
|
// In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
|
|
275
|
-
e.target.addEventListener(
|
|
415
|
+
e.target.addEventListener("transitioncancel", onTransitionEnd);
|
|
276
416
|
}
|
|
277
417
|
transitions.add(e.propertyName);
|
|
278
418
|
};
|
|
@@ -283,7 +423,7 @@ function $e8117ebcab55be6a$var$setupGlobalEvents() {
|
|
|
283
423
|
properties.delete(e.propertyName);
|
|
284
424
|
// If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
|
|
285
425
|
if (properties.size === 0) {
|
|
286
|
-
e.target.removeEventListener(
|
|
426
|
+
e.target.removeEventListener("transitioncancel", onTransitionEnd);
|
|
287
427
|
$e8117ebcab55be6a$var$transitionsByElement.delete(e.target);
|
|
288
428
|
}
|
|
289
429
|
// If no transitioning elements, call all of the queued callbacks.
|
|
@@ -292,12 +432,12 @@ function $e8117ebcab55be6a$var$setupGlobalEvents() {
|
|
|
292
432
|
$e8117ebcab55be6a$var$transitionCallbacks.clear();
|
|
293
433
|
}
|
|
294
434
|
};
|
|
295
|
-
document.body.addEventListener(
|
|
296
|
-
document.body.addEventListener(
|
|
435
|
+
document.body.addEventListener("transitionrun", onTransitionStart);
|
|
436
|
+
document.body.addEventListener("transitionend", onTransitionEnd);
|
|
297
437
|
}
|
|
298
|
-
if (typeof document !==
|
|
299
|
-
if (document.readyState !==
|
|
300
|
-
else document.addEventListener(
|
|
438
|
+
if (typeof document !== "undefined") {
|
|
439
|
+
if (document.readyState !== "loading") $e8117ebcab55be6a$var$setupGlobalEvents();
|
|
440
|
+
else document.addEventListener("DOMContentLoaded", $e8117ebcab55be6a$var$setupGlobalEvents);
|
|
301
441
|
}
|
|
302
442
|
function $e8117ebcab55be6a$export$24490316f764c430(fn) {
|
|
303
443
|
// Wait one frame to see if an animation starts, e.g. a transition on mount.
|
|
@@ -310,27 +450,36 @@ function $e8117ebcab55be6a$export$24490316f764c430(fn) {
|
|
|
310
450
|
}
|
|
311
451
|
|
|
312
452
|
|
|
313
|
-
|
|
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
|
+
*/
|
|
314
464
|
|
|
315
465
|
// Keep track of elements that we are currently handling dragging for via useDrag1D.
|
|
316
466
|
// If there's an ancestor and a descendant both using useDrag1D(), and the user starts
|
|
317
467
|
// dragging the descendant, we don't want useDrag1D events to fire for the ancestor.
|
|
318
468
|
const $28ed3fb20343b78b$var$draggingElements = [];
|
|
319
469
|
function $28ed3fb20343b78b$export$7bbed75feba39706(props) {
|
|
320
|
-
console.warn(
|
|
470
|
+
console.warn("useDrag1D is deprecated, please use `useMove` instead https://react-spectrum.adobe.com/react-aria/useMove.html");
|
|
321
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;
|
|
322
|
-
let getPosition = (e)=>orientation ===
|
|
323
|
-
;
|
|
472
|
+
let getPosition = (e)=>orientation === "horizontal" ? e.clientX : e.clientY;
|
|
324
473
|
let getNextOffset = (e)=>{
|
|
325
|
-
let containerOffset = $16ec41ef3e36c19c$export$622cea445a1c5b7d(containerRef.current, reverse, orientation);
|
|
474
|
+
let containerOffset = (0, $16ec41ef3e36c19c$export$622cea445a1c5b7d)(containerRef.current, reverse, orientation);
|
|
326
475
|
let mouseOffset = getPosition(e);
|
|
327
476
|
let nextOffset = reverse ? containerOffset - mouseOffset : mouseOffset - containerOffset;
|
|
328
477
|
return nextOffset;
|
|
329
478
|
};
|
|
330
|
-
let dragging = $1Yh1N$react.useRef(false);
|
|
331
|
-
let prevPosition = $1Yh1N$react.useRef(0);
|
|
479
|
+
let dragging = (0, $1Yh1N$react.useRef)(false);
|
|
480
|
+
let prevPosition = (0, $1Yh1N$react.useRef)(0);
|
|
332
481
|
// Keep track of the current handlers in a ref so that the events can access them.
|
|
333
|
-
let handlers = $1Yh1N$react.useRef({
|
|
482
|
+
let handlers = (0, $1Yh1N$react.useRef)({
|
|
334
483
|
onPositionChange: onPositionChange,
|
|
335
484
|
onDrag: onDrag
|
|
336
485
|
});
|
|
@@ -355,18 +504,17 @@ function $28ed3fb20343b78b$export$7bbed75feba39706(props) {
|
|
|
355
504
|
if (handlers.current.onDrag) handlers.current.onDrag(false);
|
|
356
505
|
if (handlers.current.onPositionChange) handlers.current.onPositionChange(nextOffset);
|
|
357
506
|
$28ed3fb20343b78b$var$draggingElements.splice($28ed3fb20343b78b$var$draggingElements.indexOf(target), 1);
|
|
358
|
-
window.removeEventListener(
|
|
359
|
-
window.removeEventListener(
|
|
507
|
+
window.removeEventListener("mouseup", onMouseUp, false);
|
|
508
|
+
window.removeEventListener("mousemove", onMouseDragged, false);
|
|
360
509
|
};
|
|
361
510
|
let onMouseDown = (e)=>{
|
|
362
511
|
const target = e.currentTarget;
|
|
363
512
|
// If we're already handling dragging on a descendant with useDrag1D, then
|
|
364
513
|
// we don't want to handle the drag motion on this target as well.
|
|
365
|
-
if ($28ed3fb20343b78b$var$draggingElements.some((elt)=>target.contains(elt)
|
|
366
|
-
)) return;
|
|
514
|
+
if ($28ed3fb20343b78b$var$draggingElements.some((elt)=>target.contains(elt))) return;
|
|
367
515
|
$28ed3fb20343b78b$var$draggingElements.push(target);
|
|
368
|
-
window.addEventListener(
|
|
369
|
-
window.addEventListener(
|
|
516
|
+
window.addEventListener("mousemove", onMouseDragged, false);
|
|
517
|
+
window.addEventListener("mouseup", onMouseUp, false);
|
|
370
518
|
};
|
|
371
519
|
let onMouseEnter = ()=>{
|
|
372
520
|
if (onHover) onHover(true);
|
|
@@ -376,47 +524,47 @@ function $28ed3fb20343b78b$export$7bbed75feba39706(props) {
|
|
|
376
524
|
};
|
|
377
525
|
let onKeyDown = (e)=>{
|
|
378
526
|
switch(e.key){
|
|
379
|
-
case
|
|
380
|
-
case
|
|
381
|
-
if (orientation ===
|
|
527
|
+
case "Left":
|
|
528
|
+
case "ArrowLeft":
|
|
529
|
+
if (orientation === "horizontal") {
|
|
382
530
|
e.preventDefault();
|
|
383
531
|
if (onDecrement && !reverse) onDecrement();
|
|
384
532
|
else if (onIncrement && reverse) onIncrement();
|
|
385
533
|
}
|
|
386
534
|
break;
|
|
387
|
-
case
|
|
388
|
-
case
|
|
389
|
-
if (orientation ===
|
|
535
|
+
case "Up":
|
|
536
|
+
case "ArrowUp":
|
|
537
|
+
if (orientation === "vertical") {
|
|
390
538
|
e.preventDefault();
|
|
391
539
|
if (onDecrement && !reverse) onDecrement();
|
|
392
540
|
else if (onIncrement && reverse) onIncrement();
|
|
393
541
|
}
|
|
394
542
|
break;
|
|
395
|
-
case
|
|
396
|
-
case
|
|
397
|
-
if (orientation ===
|
|
543
|
+
case "Right":
|
|
544
|
+
case "ArrowRight":
|
|
545
|
+
if (orientation === "horizontal") {
|
|
398
546
|
e.preventDefault();
|
|
399
547
|
if (onIncrement && !reverse) onIncrement();
|
|
400
548
|
else if (onDecrement && reverse) onDecrement();
|
|
401
549
|
}
|
|
402
550
|
break;
|
|
403
|
-
case
|
|
404
|
-
case
|
|
405
|
-
if (orientation ===
|
|
551
|
+
case "Down":
|
|
552
|
+
case "ArrowDown":
|
|
553
|
+
if (orientation === "vertical") {
|
|
406
554
|
e.preventDefault();
|
|
407
555
|
if (onIncrement && !reverse) onIncrement();
|
|
408
556
|
else if (onDecrement && reverse) onDecrement();
|
|
409
557
|
}
|
|
410
558
|
break;
|
|
411
|
-
case
|
|
559
|
+
case "Home":
|
|
412
560
|
e.preventDefault();
|
|
413
561
|
if (onDecrementToMin) onDecrementToMin();
|
|
414
562
|
break;
|
|
415
|
-
case
|
|
563
|
+
case "End":
|
|
416
564
|
e.preventDefault();
|
|
417
565
|
if (onIncrementToMax) onIncrementToMax();
|
|
418
566
|
break;
|
|
419
|
-
case
|
|
567
|
+
case "Enter":
|
|
420
568
|
e.preventDefault();
|
|
421
569
|
if (onCollapseToggle) onCollapseToggle();
|
|
422
570
|
break;
|
|
@@ -431,10 +579,20 @@ function $28ed3fb20343b78b$export$7bbed75feba39706(props) {
|
|
|
431
579
|
}
|
|
432
580
|
|
|
433
581
|
|
|
434
|
-
|
|
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
|
+
*/
|
|
435
593
|
function $4571ff54ac709100$export$4eaf04e54aa8eed6() {
|
|
436
|
-
let globalListeners = $1Yh1N$react.useRef(new Map());
|
|
437
|
-
let addGlobalListener = $1Yh1N$react.useCallback((eventTarget, type, listener, options)=>{
|
|
594
|
+
let globalListeners = (0, $1Yh1N$react.useRef)(new Map());
|
|
595
|
+
let addGlobalListener = (0, $1Yh1N$react.useCallback)((eventTarget, type, listener, options)=>{
|
|
438
596
|
// Make sure we remove the listener after it is called with the `once` option.
|
|
439
597
|
let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args)=>{
|
|
440
598
|
globalListeners.current.delete(listener);
|
|
@@ -448,13 +606,13 @@ function $4571ff54ac709100$export$4eaf04e54aa8eed6() {
|
|
|
448
606
|
});
|
|
449
607
|
eventTarget.addEventListener(type, listener, options);
|
|
450
608
|
}, []);
|
|
451
|
-
let removeGlobalListener = $1Yh1N$react.useCallback((eventTarget, type, listener, options)=>{
|
|
452
|
-
var
|
|
453
|
-
let fn = ((
|
|
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;
|
|
454
612
|
eventTarget.removeEventListener(type, fn, options);
|
|
455
613
|
globalListeners.current.delete(listener);
|
|
456
614
|
}, []);
|
|
457
|
-
let removeAllGlobalListeners = $1Yh1N$react.useCallback(()=>{
|
|
615
|
+
let removeAllGlobalListeners = (0, $1Yh1N$react.useCallback)(()=>{
|
|
458
616
|
globalListeners.current.forEach((value, key)=>{
|
|
459
617
|
removeGlobalListener(value.eventTarget, value.type, key, value.options);
|
|
460
618
|
});
|
|
@@ -462,7 +620,7 @@ function $4571ff54ac709100$export$4eaf04e54aa8eed6() {
|
|
|
462
620
|
removeGlobalListener
|
|
463
621
|
]);
|
|
464
622
|
// eslint-disable-next-line arrow-body-style
|
|
465
|
-
$1Yh1N$react.useEffect(()=>{
|
|
623
|
+
(0, $1Yh1N$react.useEffect)(()=>{
|
|
466
624
|
return removeAllGlobalListeners;
|
|
467
625
|
}, [
|
|
468
626
|
removeAllGlobalListeners
|
|
@@ -475,12 +633,22 @@ function $4571ff54ac709100$export$4eaf04e54aa8eed6() {
|
|
|
475
633
|
}
|
|
476
634
|
|
|
477
635
|
|
|
478
|
-
|
|
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
|
+
*/
|
|
479
647
|
function $6ec78bde395c477d$export$d6875122194c7b44(props, defaultLabel) {
|
|
480
|
-
let { id: id ,
|
|
648
|
+
let { id: id , "aria-label": label , "aria-labelledby": labelledBy } = props;
|
|
481
649
|
// If there is both an aria-label and aria-labelledby,
|
|
482
650
|
// combine them by pointing to the element itself.
|
|
483
|
-
id = $8c61827343eed941$export$f680877a34711e37(id);
|
|
651
|
+
id = (0, $8c61827343eed941$export$f680877a34711e37)(id);
|
|
484
652
|
if (labelledBy && label) {
|
|
485
653
|
let ids = new Set([
|
|
486
654
|
...labelledBy.trim().split(/\s+/),
|
|
@@ -488,29 +656,39 @@ function $6ec78bde395c477d$export$d6875122194c7b44(props, defaultLabel) {
|
|
|
488
656
|
]);
|
|
489
657
|
labelledBy = [
|
|
490
658
|
...ids
|
|
491
|
-
].join(
|
|
492
|
-
} else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(
|
|
659
|
+
].join(" ");
|
|
660
|
+
} else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(" ");
|
|
493
661
|
// If no labels are provided, use the default
|
|
494
662
|
if (!label && !labelledBy && defaultLabel) label = defaultLabel;
|
|
495
663
|
return {
|
|
496
664
|
id: id,
|
|
497
|
-
|
|
498
|
-
|
|
665
|
+
"aria-label": label,
|
|
666
|
+
"aria-labelledby": labelledBy
|
|
499
667
|
};
|
|
500
668
|
}
|
|
501
669
|
|
|
502
670
|
|
|
503
|
-
|
|
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
|
+
*/
|
|
504
682
|
|
|
505
683
|
function $475b35fe72ba49b3$export$4338b53315abf666(forwardedRef) {
|
|
506
|
-
const objRef = $1Yh1N$react.useRef();
|
|
684
|
+
const objRef = (0, $1Yh1N$react.useRef)();
|
|
507
685
|
/**
|
|
508
686
|
* We're using `useLayoutEffect` here instead of `useEffect` because we want
|
|
509
687
|
* to make sure that the `ref` value is up to date before other places in the
|
|
510
688
|
* the execution cycle try to read it.
|
|
511
|
-
*/ $78605a5d7424e31b$export$e5c5a5f917a5871c(()=>{
|
|
689
|
+
*/ (0, $78605a5d7424e31b$export$e5c5a5f917a5871c)(()=>{
|
|
512
690
|
if (!forwardedRef) return;
|
|
513
|
-
if (typeof forwardedRef ===
|
|
691
|
+
if (typeof forwardedRef === "function") forwardedRef(objRef.current);
|
|
514
692
|
else forwardedRef.current = objRef.current;
|
|
515
693
|
}, [
|
|
516
694
|
forwardedRef
|
|
@@ -519,10 +697,20 @@ function $475b35fe72ba49b3$export$4338b53315abf666(forwardedRef) {
|
|
|
519
697
|
}
|
|
520
698
|
|
|
521
699
|
|
|
522
|
-
|
|
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
|
+
*/
|
|
523
711
|
function $29293a6f5c75b37e$export$496315a1608d9602(effect, dependencies) {
|
|
524
|
-
const isInitialMount = $1Yh1N$react.useRef(true);
|
|
525
|
-
$1Yh1N$react.useEffect(()=>{
|
|
712
|
+
const isInitialMount = (0, $1Yh1N$react.useRef)(true);
|
|
713
|
+
(0, $1Yh1N$react.useEffect)(()=>{
|
|
526
714
|
if (isInitialMount.current) isInitialMount.current = false;
|
|
527
715
|
else effect();
|
|
528
716
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -533,17 +721,17 @@ function $29293a6f5c75b37e$export$496315a1608d9602(effect, dependencies) {
|
|
|
533
721
|
|
|
534
722
|
|
|
535
723
|
function $37733e1652f47193$var$hasResizeObserver() {
|
|
536
|
-
return typeof window.ResizeObserver !==
|
|
724
|
+
return typeof window.ResizeObserver !== "undefined";
|
|
537
725
|
}
|
|
538
726
|
function $37733e1652f47193$export$683480f191c0e3ea(options) {
|
|
539
727
|
const { ref: ref , onResize: onResize } = options;
|
|
540
|
-
$1Yh1N$react.useEffect(()=>{
|
|
728
|
+
(0, $1Yh1N$react.useEffect)(()=>{
|
|
541
729
|
let element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
542
730
|
if (!element) return;
|
|
543
731
|
if (!$37733e1652f47193$var$hasResizeObserver()) {
|
|
544
|
-
window.addEventListener(
|
|
732
|
+
window.addEventListener("resize", onResize, false);
|
|
545
733
|
return ()=>{
|
|
546
|
-
window.removeEventListener(
|
|
734
|
+
window.removeEventListener("resize", onResize, false);
|
|
547
735
|
};
|
|
548
736
|
} else {
|
|
549
737
|
const resizeObserverInstance = new window.ResizeObserver((entries)=>{
|
|
@@ -562,9 +750,19 @@ function $37733e1652f47193$export$683480f191c0e3ea(options) {
|
|
|
562
750
|
}
|
|
563
751
|
|
|
564
752
|
|
|
565
|
-
|
|
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
|
+
*/
|
|
566
764
|
function $6fc733991a9f977c$export$4debdb1a3f0fa79e(context, ref) {
|
|
567
|
-
$78605a5d7424e31b$export$e5c5a5f917a5871c(()=>{
|
|
765
|
+
(0, $78605a5d7424e31b$export$e5c5a5f917a5871c)(()=>{
|
|
568
766
|
if (context && context.ref && ref) {
|
|
569
767
|
context.ref.current = ref.current;
|
|
570
768
|
return ()=>{
|
|
@@ -578,7 +776,17 @@ function $6fc733991a9f977c$export$4debdb1a3f0fa79e(context, ref) {
|
|
|
578
776
|
}
|
|
579
777
|
|
|
580
778
|
|
|
581
|
-
|
|
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) {
|
|
582
790
|
while(node && !$d796e7157ac96470$var$isScrollable(node))node = node.parentElement;
|
|
583
791
|
return node || document.scrollingElement || document.documentElement;
|
|
584
792
|
}
|
|
@@ -588,13 +796,22 @@ function $d796e7157ac96470$var$isScrollable(node) {
|
|
|
588
796
|
}
|
|
589
797
|
|
|
590
798
|
|
|
591
|
-
|
|
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
|
+
*/
|
|
592
810
|
// @ts-ignore
|
|
593
|
-
let $8b24bab62f5c65ad$var$visualViewport = typeof window !==
|
|
811
|
+
let $8b24bab62f5c65ad$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
|
|
594
812
|
function $8b24bab62f5c65ad$export$d699905dd57c73ca() {
|
|
595
|
-
let [
|
|
596
|
-
)
|
|
597
|
-
$1Yh1N$react.useEffect(()=>{
|
|
813
|
+
let [size, setSize] = (0, $1Yh1N$react.useState)(()=>$8b24bab62f5c65ad$var$getViewportSize());
|
|
814
|
+
(0, $1Yh1N$react.useEffect)(()=>{
|
|
598
815
|
// Use visualViewport api to track available height even on iOS virtual keyboard opening
|
|
599
816
|
let onResize = ()=>{
|
|
600
817
|
setSize((size)=>{
|
|
@@ -603,14 +820,14 @@ function $8b24bab62f5c65ad$export$d699905dd57c73ca() {
|
|
|
603
820
|
return newSize;
|
|
604
821
|
});
|
|
605
822
|
};
|
|
606
|
-
if (!$8b24bab62f5c65ad$var$visualViewport) window.addEventListener(
|
|
607
|
-
else $8b24bab62f5c65ad$var$visualViewport.addEventListener(
|
|
823
|
+
if (!$8b24bab62f5c65ad$var$visualViewport) window.addEventListener("resize", onResize);
|
|
824
|
+
else $8b24bab62f5c65ad$var$visualViewport.addEventListener("resize", onResize);
|
|
608
825
|
return ()=>{
|
|
609
|
-
if (!$8b24bab62f5c65ad$var$visualViewport) window.removeEventListener(
|
|
610
|
-
else $8b24bab62f5c65ad$var$visualViewport.removeEventListener(
|
|
826
|
+
if (!$8b24bab62f5c65ad$var$visualViewport) window.removeEventListener("resize", onResize);
|
|
827
|
+
else $8b24bab62f5c65ad$var$visualViewport.removeEventListener("resize", onResize);
|
|
611
828
|
};
|
|
612
829
|
}, []);
|
|
613
|
-
return
|
|
830
|
+
return size;
|
|
614
831
|
}
|
|
615
832
|
function $8b24bab62f5c65ad$var$getViewportSize() {
|
|
616
833
|
return {
|
|
@@ -620,21 +837,31 @@ function $8b24bab62f5c65ad$var$getViewportSize() {
|
|
|
620
837
|
}
|
|
621
838
|
|
|
622
839
|
|
|
623
|
-
|
|
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
|
+
*/
|
|
624
851
|
|
|
625
852
|
let $34da4502ea8120db$var$descriptionId = 0;
|
|
626
853
|
const $34da4502ea8120db$var$descriptionNodes = new Map();
|
|
627
854
|
function $34da4502ea8120db$export$f8aeda7b10753fa1(description) {
|
|
628
|
-
let [
|
|
629
|
-
$78605a5d7424e31b$export$e5c5a5f917a5871c(()=>{
|
|
855
|
+
let [id, setId] = (0, $1Yh1N$react.useState)(undefined);
|
|
856
|
+
(0, $78605a5d7424e31b$export$e5c5a5f917a5871c)(()=>{
|
|
630
857
|
if (!description) return;
|
|
631
858
|
let desc = $34da4502ea8120db$var$descriptionNodes.get(description);
|
|
632
859
|
if (!desc) {
|
|
633
860
|
let id = `react-aria-description-${$34da4502ea8120db$var$descriptionId++}`;
|
|
634
861
|
setId(id);
|
|
635
|
-
let node = document.createElement(
|
|
862
|
+
let node = document.createElement("div");
|
|
636
863
|
node.id = id;
|
|
637
|
-
node.style.display =
|
|
864
|
+
node.style.display = "none";
|
|
638
865
|
node.textContent = description;
|
|
639
866
|
document.body.appendChild(node);
|
|
640
867
|
desc = {
|
|
@@ -654,7 +881,7 @@ function $34da4502ea8120db$export$f8aeda7b10753fa1(description) {
|
|
|
654
881
|
description
|
|
655
882
|
]);
|
|
656
883
|
return {
|
|
657
|
-
|
|
884
|
+
"aria-describedby": description ? id : undefined
|
|
658
885
|
};
|
|
659
886
|
}
|
|
660
887
|
|
|
@@ -670,14 +897,13 @@ function $34da4502ea8120db$export$f8aeda7b10753fa1(description) {
|
|
|
670
897
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
671
898
|
* governing permissions and limitations under the License.
|
|
672
899
|
*/ function $9e20cff0af27e8cc$var$testUserAgent(re) {
|
|
673
|
-
var
|
|
674
|
-
if (typeof window ===
|
|
675
|
-
return ((
|
|
676
|
-
)) || re.test(window.navigator.userAgent);
|
|
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);
|
|
677
903
|
}
|
|
678
904
|
function $9e20cff0af27e8cc$var$testPlatform(re) {
|
|
679
|
-
var
|
|
680
|
-
return typeof window !==
|
|
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;
|
|
681
907
|
}
|
|
682
908
|
function $9e20cff0af27e8cc$export$9ac100e40613ea10() {
|
|
683
909
|
return $9e20cff0af27e8cc$var$testPlatform(/^Mac/i);
|
|
@@ -686,7 +912,8 @@ function $9e20cff0af27e8cc$export$186c6964ca17d99() {
|
|
|
686
912
|
return $9e20cff0af27e8cc$var$testPlatform(/^iPhone/i);
|
|
687
913
|
}
|
|
688
914
|
function $9e20cff0af27e8cc$export$7bef049ce92e4224() {
|
|
689
|
-
return $9e20cff0af27e8cc$var$testPlatform(/^iPad/i) ||
|
|
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;
|
|
690
917
|
}
|
|
691
918
|
function $9e20cff0af27e8cc$export$fedb369cb70207f1() {
|
|
692
919
|
return $9e20cff0af27e8cc$export$186c6964ca17d99() || $9e20cff0af27e8cc$export$7bef049ce92e4224();
|
|
@@ -705,16 +932,25 @@ function $9e20cff0af27e8cc$export$a11b0059900ceec8() {
|
|
|
705
932
|
}
|
|
706
933
|
|
|
707
934
|
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
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
|
+
*/
|
|
946
|
+
function $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)(()=>{
|
|
714
951
|
if (isDisabled) return;
|
|
715
952
|
let element = ref.current;
|
|
716
|
-
let handler = (e)=>handlerRef.current.call(this, e)
|
|
717
|
-
;
|
|
953
|
+
let handler = (e)=>handlerRef.current.call(this, e);
|
|
718
954
|
element.addEventListener(event, handler, options);
|
|
719
955
|
return ()=>{
|
|
720
956
|
element.removeEventListener(event, handler, options);
|
|
@@ -729,50 +965,23 @@ function $2a8c0bb1629926c8$export$90fc3a17d93f704c(ref, event, handler1, options
|
|
|
729
965
|
|
|
730
966
|
|
|
731
967
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
// If the value is the same as the current value,
|
|
750
|
-
// then continue to the next yield. Otherwise,
|
|
751
|
-
// set the value in state and wait for the next layout effect.
|
|
752
|
-
if (value === newValue.value) nextRef.current();
|
|
753
|
-
else setValue(newValue.value);
|
|
754
|
-
};
|
|
755
|
-
$78605a5d7424e31b$export$e5c5a5f917a5871c(()=>{
|
|
756
|
-
// If there is an effect currently running, continue to the next yield.
|
|
757
|
-
if (effect.current) nextRef.current();
|
|
758
|
-
});
|
|
759
|
-
let queue = $1Yh1N$react.useCallback((fn)=>{
|
|
760
|
-
effect.current = fn(valueRef.current);
|
|
761
|
-
nextRef.current();
|
|
762
|
-
}, [
|
|
763
|
-
effect,
|
|
764
|
-
nextRef
|
|
765
|
-
]);
|
|
766
|
-
return [
|
|
767
|
-
value,
|
|
768
|
-
queue
|
|
769
|
-
];
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
function $449412113267a1fe$export$53a0910f038337bd(scrollView, element) {
|
|
774
|
-
let offsetX = $449412113267a1fe$var$relativeOffset(scrollView, element, 'left');
|
|
775
|
-
let offsetY = $449412113267a1fe$var$relativeOffset(scrollView, element, 'top');
|
|
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");
|
|
776
985
|
let width = element.offsetWidth;
|
|
777
986
|
let height = element.offsetHeight;
|
|
778
987
|
let x = scrollView.scrollLeft;
|
|
@@ -790,7 +999,7 @@ function $449412113267a1fe$export$53a0910f038337bd(scrollView, element) {
|
|
|
790
999
|
* Computes the offset left or top from child to ancestor by accumulating
|
|
791
1000
|
* offsetLeft or offsetTop through intervening offsetParents.
|
|
792
1001
|
*/ function $449412113267a1fe$var$relativeOffset(ancestor, child, axis) {
|
|
793
|
-
const prop = axis ===
|
|
1002
|
+
const prop = axis === "left" ? "offsetLeft" : "offsetTop";
|
|
794
1003
|
let sum = 0;
|
|
795
1004
|
while(child.offsetParent){
|
|
796
1005
|
sum += child[prop];
|
|
@@ -809,14 +1018,24 @@ function $449412113267a1fe$export$53a0910f038337bd(scrollView, element) {
|
|
|
809
1018
|
|
|
810
1019
|
|
|
811
1020
|
|
|
812
|
-
|
|
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
|
+
*/
|
|
813
1032
|
function $577e795361f19be9$export$60278871457622de(event) {
|
|
814
1033
|
// JAWS/NVDA with Firefox.
|
|
815
1034
|
if (event.mozInputSource === 0 && event.isTrusted) return true;
|
|
816
1035
|
// Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead
|
|
817
1036
|
// If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check
|
|
818
1037
|
// to detect TalkBack virtual clicks.
|
|
819
|
-
if ($9e20cff0af27e8cc$export$a11b0059900ceec8() && event.pointerType) return event.type ===
|
|
1038
|
+
if ((0, $9e20cff0af27e8cc$export$a11b0059900ceec8)() && event.pointerType) return event.type === "click" && event.buttons === 1;
|
|
820
1039
|
return event.detail === 0 && !event.pointerType;
|
|
821
1040
|
}
|
|
822
1041
|
function $577e795361f19be9$export$29bf1b5f2c56cf63(event) {
|
|
@@ -826,7 +1045,7 @@ function $577e795361f19be9$export$29bf1b5f2c56cf63(event) {
|
|
|
826
1045
|
// Cannot use "event.pressure === 0" as the sole check due to Safari pointer events always returning pressure === 0
|
|
827
1046
|
// instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush
|
|
828
1047
|
// Talkback double tap from Windows Firefox touch screen press
|
|
829
|
-
return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType ===
|
|
1048
|
+
return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
|
|
830
1049
|
}
|
|
831
1050
|
|
|
832
1051
|
|