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