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