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