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