@react-aria/utils 3.8.2 → 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 +771 -796
- package/dist/main.js.map +1 -1
- package/dist/module.js +753 -724
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +22 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +4 -0
- package/src/mergeProps.ts +24 -27
- package/src/scrollIntoView.ts +65 -0
- package/src/useDescription.ts +2 -1
- package/src/useEvent.ts +39 -0
- 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/module.js
CHANGED
|
@@ -1,822 +1,851 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import _react, { useEffect, useRef, useState, useCallback, useLayoutEffect as _useLayoutEffect } from "react";
|
|
6
|
-
// During SSR, React emits a warning when calling useLayoutEffect.
|
|
7
|
-
// Since neither useLayoutEffect nor useEffect run on the server,
|
|
8
|
-
// we can suppress this by replace it with a noop on the server.
|
|
9
|
-
export const useLayoutEffect = typeof window !== 'undefined' ? _react.useLayoutEffect : () => {};
|
|
10
|
-
let $f8b5fdd96fb429d7102983f777c41307$var$idsUpdaterMap = new Map();
|
|
11
|
-
/**
|
|
12
|
-
* If a default is not provided, generate an id.
|
|
13
|
-
* @param defaultId - Default component id.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export function useId(defaultId) {
|
|
17
|
-
let isRendering = useRef(true);
|
|
18
|
-
isRendering.current = true;
|
|
19
|
-
let [value, setValue] = useState(defaultId);
|
|
20
|
-
let nextId = useRef(null);
|
|
21
|
-
let res = useSSRSafeId(value); // don't memo this, we want it new each render so that the Effects always run
|
|
22
|
-
|
|
23
|
-
let updateValue = val => {
|
|
24
|
-
if (!isRendering.current) {
|
|
25
|
-
setValue(val);
|
|
26
|
-
} else {
|
|
27
|
-
nextId.current = val;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
$f8b5fdd96fb429d7102983f777c41307$var$idsUpdaterMap.set(res, updateValue);
|
|
32
|
-
useLayoutEffect(() => {
|
|
33
|
-
isRendering.current = false;
|
|
34
|
-
}, [updateValue]);
|
|
35
|
-
useLayoutEffect(() => {
|
|
36
|
-
let r = res;
|
|
37
|
-
return () => {
|
|
38
|
-
$f8b5fdd96fb429d7102983f777c41307$var$idsUpdaterMap.delete(r);
|
|
39
|
-
};
|
|
40
|
-
}, [res]);
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
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";
|
|
43
5
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
nextId.current = null;
|
|
47
|
-
}
|
|
48
|
-
}, [setValue, updateValue]);
|
|
49
|
-
return res;
|
|
6
|
+
function $parcel$export(e, n, v, s) {
|
|
7
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
50
8
|
}
|
|
51
|
-
|
|
52
|
-
* Merges two ids.
|
|
53
|
-
* Different ids will trigger a side-effect and re-render components hooked up with `useId`.
|
|
54
|
-
*/
|
|
9
|
+
var $4208ab27be92763a$exports = {};
|
|
55
10
|
|
|
56
|
-
export
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
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);
|
|
60
14
|
|
|
61
|
-
|
|
15
|
+
var $62918828a5c4cefe$exports = {};
|
|
62
16
|
|
|
63
|
-
|
|
64
|
-
setIdA(idB);
|
|
65
|
-
return idB;
|
|
66
|
-
}
|
|
17
|
+
$parcel$export($62918828a5c4cefe$exports, "useLayoutEffect", () => $62918828a5c4cefe$export$e5c5a5f917a5871c);
|
|
67
18
|
|
|
68
|
-
|
|
19
|
+
const $62918828a5c4cefe$export$e5c5a5f917a5871c = typeof window !== 'undefined' ? $gskSG$react.useLayoutEffect : ()=>{
|
|
20
|
+
};
|
|
69
21
|
|
|
70
|
-
if (setIdB) {
|
|
71
|
-
setIdB(idA);
|
|
72
|
-
return idA;
|
|
73
|
-
}
|
|
74
22
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
23
|
+
|
|
24
|
+
|
|
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;
|
|
56
|
+
}
|
|
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;
|
|
92
69
|
}
|
|
93
|
-
|
|
94
|
-
|
|
70
|
+
let setIdB = $4208ab27be92763a$var$idsUpdaterMap.get(idB);
|
|
71
|
+
if (setIdB) {
|
|
72
|
+
setIdB(idA);
|
|
73
|
+
return idA;
|
|
74
|
+
}
|
|
75
|
+
return idB;
|
|
76
|
+
}
|
|
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
|
+
};
|
|
95
105
|
}
|
|
96
106
|
|
|
97
|
-
/*
|
|
98
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
99
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
100
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
101
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
102
|
-
*
|
|
103
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
104
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
105
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
106
|
-
* governing permissions and limitations under the License.
|
|
107
|
-
*/
|
|
108
107
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
108
|
+
var $699afe8e9e0f66de$exports = {};
|
|
109
|
+
|
|
110
|
+
$parcel$export($699afe8e9e0f66de$exports, "mergeProps", () => $699afe8e9e0f66de$export$9d1611c77c2fe928);
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
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
|
+
}
|
|
122
132
|
}
|
|
123
|
-
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
var $7efcb978e02fb174$exports = {};
|
|
138
|
+
|
|
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;
|
|
124
157
|
}
|
|
125
158
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
for (let key in props) {
|
|
158
|
-
if (result[key] === undefined) {
|
|
159
|
-
result[key] = props[key];
|
|
160
|
-
}
|
|
159
|
+
|
|
160
|
+
var $0172e2a3384c2851$exports = {};
|
|
161
|
+
|
|
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
|
+
}
|
|
161
188
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
labelable,
|
|
176
|
-
propNames
|
|
177
|
-
} = opts;
|
|
178
|
-
let filteredProps = {};
|
|
179
|
-
|
|
180
|
-
for (const prop in props) {
|
|
181
|
-
if (Object.prototype.hasOwnProperty.call(props, prop) && ($f6a965352cabf1a7c37e8c1337e5eab$var$DOMPropNames.has(prop) || labelable && $f6a965352cabf1a7c37e8c1337e5eab$var$labelablePropNames.has(prop) || propNames != null && propNames.has(prop) || $f6a965352cabf1a7c37e8c1337e5eab$var$propRe.test(prop))) {
|
|
182
|
-
filteredProps[prop] = props[prop];
|
|
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;
|
|
183
202
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
// Currently necessary for Safari and old Edge:
|
|
189
|
-
// https://caniuse.com/#feat=mdn-api_htmlelement_focus_preventscroll_option
|
|
190
|
-
// See https://bugs.webkit.org/show_bug.cgi?id=178583
|
|
191
|
-
//
|
|
192
|
-
// Original licensing for the following methods can be found in the
|
|
193
|
-
// NOTICE file in the root directory of this source tree.
|
|
194
|
-
// See https://github.com/calvellido/focus-options-polyfill
|
|
195
|
-
export function focusWithoutScrolling(element) {
|
|
196
|
-
if ($bc7c9c3af78f5218ff72cecce15730$var$supportsPreventScroll()) {
|
|
197
|
-
element.focus({
|
|
198
|
-
preventScroll: true
|
|
203
|
+
if (rootScrollingElement instanceof HTMLElement) scrollableElements.push({
|
|
204
|
+
element: rootScrollingElement,
|
|
205
|
+
scrollTop: rootScrollingElement.scrollTop,
|
|
206
|
+
scrollLeft: rootScrollingElement.scrollLeft
|
|
199
207
|
});
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
let $bc7c9c3af78f5218ff72cecce15730$var$supportsPreventScrollCached = null;
|
|
207
|
-
|
|
208
|
-
function $bc7c9c3af78f5218ff72cecce15730$var$supportsPreventScroll() {
|
|
209
|
-
if ($bc7c9c3af78f5218ff72cecce15730$var$supportsPreventScrollCached == null) {
|
|
210
|
-
$bc7c9c3af78f5218ff72cecce15730$var$supportsPreventScrollCached = false;
|
|
211
|
-
|
|
212
|
-
try {
|
|
213
|
-
var focusElem = document.createElement('div');
|
|
214
|
-
focusElem.focus({
|
|
215
|
-
get preventScroll() {
|
|
216
|
-
$bc7c9c3af78f5218ff72cecce15730$var$supportsPreventScrollCached = true;
|
|
217
|
-
return true;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
});
|
|
221
|
-
} catch (e) {// Ignore
|
|
208
|
+
return scrollableElements;
|
|
209
|
+
}
|
|
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;
|
|
222
214
|
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return $bc7c9c3af78f5218ff72cecce15730$var$supportsPreventScrollCached;
|
|
226
215
|
}
|
|
227
216
|
|
|
228
|
-
function $bc7c9c3af78f5218ff72cecce15730$var$getScrollableElements(element) {
|
|
229
|
-
var parent = element.parentNode;
|
|
230
|
-
var scrollableElements = [];
|
|
231
|
-
var rootScrollingElement = document.scrollingElement || document.documentElement;
|
|
232
217
|
|
|
233
|
-
|
|
234
|
-
if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) {
|
|
235
|
-
scrollableElements.push({
|
|
236
|
-
element: parent,
|
|
237
|
-
scrollTop: parent.scrollTop,
|
|
238
|
-
scrollLeft: parent.scrollLeft
|
|
239
|
-
});
|
|
240
|
-
}
|
|
218
|
+
var $5062b1512bdf762b$exports = {};
|
|
241
219
|
|
|
242
|
-
|
|
243
|
-
|
|
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
|
+
}
|
|
244
226
|
|
|
245
|
-
if (rootScrollingElement instanceof HTMLElement) {
|
|
246
|
-
scrollableElements.push({
|
|
247
|
-
element: rootScrollingElement,
|
|
248
|
-
scrollTop: rootScrollingElement.scrollTop,
|
|
249
|
-
scrollLeft: rootScrollingElement.scrollLeft
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
227
|
|
|
253
|
-
|
|
254
|
-
}
|
|
228
|
+
var $5cdbf4ddafd135bc$exports = {};
|
|
255
229
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
element,
|
|
259
|
-
scrollTop,
|
|
260
|
-
scrollLeft
|
|
261
|
-
} of scrollableElements) {
|
|
262
|
-
element.scrollTop = scrollTop;
|
|
263
|
-
element.scrollLeft = scrollLeft;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
230
|
+
$parcel$export($5cdbf4ddafd135bc$exports, "clamp", () => $5cdbf4ddafd135bc$re_export$clamp);
|
|
231
|
+
$parcel$export($5cdbf4ddafd135bc$exports, "snapValueToStep", () => $5cdbf4ddafd135bc$re_export$snapValueToStep);
|
|
266
232
|
|
|
267
|
-
export function getOffset(element, reverse, orientation) {
|
|
268
|
-
if (orientation === void 0) {
|
|
269
|
-
orientation = 'horizontal';
|
|
270
|
-
}
|
|
271
233
|
|
|
272
|
-
let rect = element.getBoundingClientRect();
|
|
273
234
|
|
|
274
|
-
|
|
275
|
-
return orientation === 'horizontal' ? rect.right : rect.bottom;
|
|
276
|
-
}
|
|
235
|
+
var $fdecdd2f4116564c$exports = {};
|
|
277
236
|
|
|
278
|
-
|
|
279
|
-
|
|
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,
|
|
280
249
|
// mapped to a set of CSS properties that are transitioning for that element.
|
|
281
250
|
// This is necessary rather than a simple count of transitions because of browser
|
|
282
251
|
// bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather
|
|
283
252
|
// than one or the other. So we need to track what's actually transitioning so that
|
|
284
253
|
// we can ignore these duplicate events.
|
|
285
|
-
let $
|
|
286
|
-
|
|
287
|
-
let $
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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);
|
|
269
|
+
}
|
|
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);
|
|
281
|
+
}
|
|
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();
|
|
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
|
+
}
|
|
319
304
|
|
|
320
|
-
if (properties.size === 0) {
|
|
321
|
-
e.target.removeEventListener('transitioncancel', onTransitionEnd);
|
|
322
|
-
$b3e8d5c5f32fa26afa6df1b81f09b6b8$var$transitionsByElement.delete(e.target);
|
|
323
|
-
} // If no transitioning elements, call all of the queued callbacks.
|
|
324
305
|
|
|
306
|
+
var $95a0e07fe544f4e9$exports = {};
|
|
325
307
|
|
|
326
|
-
|
|
327
|
-
for (let cb of $b3e8d5c5f32fa26afa6df1b81f09b6b8$var$transitionCallbacks) {
|
|
328
|
-
cb();
|
|
329
|
-
}
|
|
308
|
+
$parcel$export($95a0e07fe544f4e9$exports, "useDrag1D", () => $95a0e07fe544f4e9$export$7bbed75feba39706);
|
|
330
309
|
|
|
331
|
-
$b3e8d5c5f32fa26afa6df1b81f09b6b8$var$transitionCallbacks.clear();
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
310
|
|
|
335
|
-
document.body.addEventListener('transitionrun', onTransitionStart);
|
|
336
|
-
document.body.addEventListener('transitionend', onTransitionEnd);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
if (typeof document !== 'undefined') {
|
|
340
|
-
if (document.readyState !== 'loading') {
|
|
341
|
-
$b3e8d5c5f32fa26afa6df1b81f09b6b8$var$setupGlobalEvents();
|
|
342
|
-
} else {
|
|
343
|
-
document.addEventListener('DOMContentLoaded', $b3e8d5c5f32fa26afa6df1b81f09b6b8$var$setupGlobalEvents);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
export function runAfterTransition(fn) {
|
|
348
|
-
// Wait one frame to see if an animation starts, e.g. a transition on mount.
|
|
349
|
-
requestAnimationFrame(() => {
|
|
350
|
-
// If no transitions are running, call the function immediately.
|
|
351
|
-
// Otherwise, add it to a list of callbacks to run at the end of the animation.
|
|
352
|
-
if ($b3e8d5c5f32fa26afa6df1b81f09b6b8$var$transitionsByElement.size === 0) {
|
|
353
|
-
fn();
|
|
354
|
-
} else {
|
|
355
|
-
$b3e8d5c5f32fa26afa6df1b81f09b6b8$var$transitionCallbacks.add(fn);
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
311
|
// Keep track of elements that we are currently handling dragging for via useDrag1D.
|
|
360
312
|
// If there's an ancestor and a descendant both using useDrag1D(), and the user starts
|
|
361
313
|
// dragging the descendant, we don't want useDrag1D events to fire for the ancestor.
|
|
362
|
-
const $
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
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)=>{
|
|
336
|
+
e.preventDefault();
|
|
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);
|
|
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
|
+
}
|
|
417
428
|
|
|
418
|
-
if (prevPosition.current === nextOffset) {
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
429
|
|
|
422
|
-
|
|
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
|
+
}
|
|
423
474
|
|
|
424
|
-
if (onPositionChange) {
|
|
425
|
-
onPositionChange(nextOffset);
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
475
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
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
|
+
}
|
|
433
502
|
|
|
434
|
-
if (handlers.current.onDrag) {
|
|
435
|
-
handlers.current.onDrag(false);
|
|
436
|
-
}
|
|
437
503
|
|
|
438
|
-
|
|
439
|
-
handlers.current.onPositionChange(nextOffset);
|
|
440
|
-
}
|
|
504
|
+
var $1ea3613dec903cb9$exports = {};
|
|
441
505
|
|
|
442
|
-
|
|
443
|
-
window.removeEventListener('mouseup', onMouseUp, false);
|
|
444
|
-
window.removeEventListener('mousemove', onMouseDragged, false);
|
|
445
|
-
};
|
|
506
|
+
$parcel$export($1ea3613dec903cb9$exports, "useObjectRef", () => $1ea3613dec903cb9$export$4338b53315abf666);
|
|
446
507
|
|
|
447
|
-
let onMouseDown = e => {
|
|
448
|
-
const target = e.currentTarget; // If we're already handling dragging on a descendant with useDrag1D, then
|
|
449
|
-
// we don't want to handle the drag motion on this target as well.
|
|
450
508
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
509
|
+
function $1ea3613dec903cb9$export$4338b53315abf666(forwardedRef) {
|
|
510
|
+
const objRef = $gskSG$useRef();
|
|
511
|
+
/**
|
|
512
|
+
* We're using `useLayoutEffect` here instead of `useEffect` because we want
|
|
513
|
+
* to make sure that the `ref` value is up to date before other places in the
|
|
514
|
+
* the execution cycle try to read it.
|
|
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
|
+
}
|
|
454
524
|
|
|
455
|
-
$be9622dfd8e876c0943b0b4e429554f3$var$draggingElements.push(target);
|
|
456
|
-
window.addEventListener('mousemove', onMouseDragged, false);
|
|
457
|
-
window.addEventListener('mouseup', onMouseUp, false);
|
|
458
|
-
};
|
|
459
525
|
|
|
460
|
-
|
|
461
|
-
if (onHover) {
|
|
462
|
-
onHover(true);
|
|
463
|
-
}
|
|
464
|
-
};
|
|
526
|
+
var $d3ab8ae13db3a1fd$exports = {};
|
|
465
527
|
|
|
466
|
-
|
|
467
|
-
if (onHover) {
|
|
468
|
-
onHover(false);
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
let onKeyDown = e => {
|
|
473
|
-
switch (e.key) {
|
|
474
|
-
case 'Left':
|
|
475
|
-
case 'ArrowLeft':
|
|
476
|
-
if (orientation === 'horizontal') {
|
|
477
|
-
e.preventDefault();
|
|
478
|
-
|
|
479
|
-
if (onDecrement && !reverse) {
|
|
480
|
-
onDecrement();
|
|
481
|
-
} else if (onIncrement && reverse) {
|
|
482
|
-
onIncrement();
|
|
483
|
-
}
|
|
484
|
-
}
|
|
528
|
+
$parcel$export($d3ab8ae13db3a1fd$exports, "useUpdateEffect", () => $d3ab8ae13db3a1fd$export$496315a1608d9602);
|
|
485
529
|
|
|
486
|
-
|
|
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
|
+
}
|
|
487
538
|
|
|
488
|
-
case 'Up':
|
|
489
|
-
case 'ArrowUp':
|
|
490
|
-
if (orientation === 'vertical') {
|
|
491
|
-
e.preventDefault();
|
|
492
539
|
|
|
493
|
-
if (onDecrement && !reverse) {
|
|
494
|
-
onDecrement();
|
|
495
|
-
} else if (onIncrement && reverse) {
|
|
496
|
-
onIncrement();
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
540
|
|
|
500
|
-
|
|
541
|
+
var $f3e728a941364b05$exports = {};
|
|
501
542
|
|
|
502
|
-
|
|
503
|
-
case 'ArrowRight':
|
|
504
|
-
if (orientation === 'horizontal') {
|
|
505
|
-
e.preventDefault();
|
|
543
|
+
$parcel$export($f3e728a941364b05$exports, "useResizeObserver", () => $f3e728a941364b05$export$683480f191c0e3ea);
|
|
506
544
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
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
|
+
};
|
|
512
567
|
}
|
|
568
|
+
}, [
|
|
569
|
+
onResize,
|
|
570
|
+
ref
|
|
571
|
+
]);
|
|
572
|
+
}
|
|
513
573
|
|
|
514
|
-
break;
|
|
515
|
-
|
|
516
|
-
case 'Down':
|
|
517
|
-
case 'ArrowDown':
|
|
518
|
-
if (orientation === 'vertical') {
|
|
519
|
-
e.preventDefault();
|
|
520
|
-
|
|
521
|
-
if (onIncrement && !reverse) {
|
|
522
|
-
onIncrement();
|
|
523
|
-
} else if (onDecrement && reverse) {
|
|
524
|
-
onDecrement();
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
574
|
|
|
528
|
-
|
|
575
|
+
var $518b8f251641d71b$exports = {};
|
|
529
576
|
|
|
530
|
-
|
|
531
|
-
e.preventDefault();
|
|
577
|
+
$parcel$export($518b8f251641d71b$exports, "useSyncRef", () => $518b8f251641d71b$export$4debdb1a3f0fa79e);
|
|
532
578
|
|
|
533
|
-
|
|
534
|
-
|
|
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
|
+
};
|
|
535
586
|
}
|
|
587
|
+
}, [
|
|
588
|
+
context,
|
|
589
|
+
ref
|
|
590
|
+
]);
|
|
591
|
+
}
|
|
536
592
|
|
|
537
|
-
break;
|
|
538
593
|
|
|
539
|
-
|
|
540
|
-
e.preventDefault();
|
|
594
|
+
var $2fe8625dffd76a00$exports = {};
|
|
541
595
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
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);
|
|
604
|
+
}
|
|
545
605
|
|
|
546
|
-
break;
|
|
547
606
|
|
|
548
|
-
|
|
549
|
-
e.preventDefault();
|
|
607
|
+
var $c5fe598a15f005e5$exports = {};
|
|
550
608
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
609
|
+
$parcel$export($c5fe598a15f005e5$exports, "useViewportSize", () => $c5fe598a15f005e5$export$d699905dd57c73ca);
|
|
610
|
+
|
|
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
|
|
638
|
+
};
|
|
639
|
+
}
|
|
554
640
|
|
|
555
|
-
break;
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
|
|
559
|
-
return {
|
|
560
|
-
onMouseDown,
|
|
561
|
-
onMouseEnter,
|
|
562
|
-
onMouseOut,
|
|
563
|
-
onKeyDown
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
export function useGlobalListeners() {
|
|
567
|
-
let globalListeners = useRef(new Map());
|
|
568
|
-
let addGlobalListener = useCallback((eventTarget, type, listener, options) => {
|
|
569
|
-
globalListeners.current.set(listener, {
|
|
570
|
-
type,
|
|
571
|
-
eventTarget,
|
|
572
|
-
options
|
|
573
|
-
});
|
|
574
|
-
eventTarget.addEventListener(type, listener, options);
|
|
575
|
-
}, []);
|
|
576
|
-
let removeGlobalListener = useCallback((eventTarget, type, listener, options) => {
|
|
577
|
-
eventTarget.removeEventListener(type, listener, options);
|
|
578
|
-
globalListeners.current.delete(listener);
|
|
579
|
-
}, []);
|
|
580
|
-
let removeAllGlobalListeners = useCallback(() => {
|
|
581
|
-
globalListeners.current.forEach((value, key) => {
|
|
582
|
-
removeGlobalListener(value.eventTarget, value.type, key, value.options);
|
|
583
|
-
});
|
|
584
|
-
}, [removeGlobalListener]); // eslint-disable-next-line arrow-body-style
|
|
585
641
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
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
|
+
};
|
|
594
681
|
}
|
|
595
682
|
|
|
596
|
-
/**
|
|
597
|
-
* Merges aria-label and aria-labelledby into aria-labelledby when both exist.
|
|
598
|
-
* @param props - Aria label props.
|
|
599
|
-
* @param defaultLabel - Default value for aria-label when not present.
|
|
600
|
-
*/
|
|
601
|
-
export function useLabels(props, defaultLabel) {
|
|
602
|
-
let {
|
|
603
|
-
id,
|
|
604
|
-
'aria-label': label,
|
|
605
|
-
'aria-labelledby': labelledBy
|
|
606
|
-
} = props; // If there is both an aria-label and aria-labelledby,
|
|
607
|
-
// combine them by pointing to the element itself.
|
|
608
|
-
|
|
609
|
-
id = useId(id);
|
|
610
|
-
|
|
611
|
-
if (labelledBy && label) {
|
|
612
|
-
let ids = new Set([...labelledBy.trim().split(/\s+/), id]);
|
|
613
|
-
labelledBy = [...ids].join(' ');
|
|
614
|
-
} else if (labelledBy) {
|
|
615
|
-
labelledBy = labelledBy.trim().split(/\s+/).join(' ');
|
|
616
|
-
} // If no labels are provided, use the default
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
if (!label && !labelledBy && defaultLabel) {
|
|
620
|
-
label = defaultLabel;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
return {
|
|
624
|
-
id,
|
|
625
|
-
'aria-label': label,
|
|
626
|
-
'aria-labelledby': labelledBy
|
|
627
|
-
};
|
|
628
|
-
}
|
|
629
|
-
// Like useEffect, but only called for updates after the initial render.
|
|
630
|
-
export function useUpdateEffect(effect, dependencies) {
|
|
631
|
-
const isInitialMount = useRef(true);
|
|
632
|
-
useEffect(() => {
|
|
633
|
-
if (isInitialMount.current) {
|
|
634
|
-
isInitialMount.current = false;
|
|
635
|
-
} else {
|
|
636
|
-
effect();
|
|
637
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
638
|
-
|
|
639
|
-
}, dependencies);
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
function $d642970c01dc21e3fe2261c17768$var$hasResizeObserver() {
|
|
643
|
-
return typeof window.ResizeObserver !== 'undefined';
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
export function useResizeObserver(options) {
|
|
647
|
-
const {
|
|
648
|
-
ref,
|
|
649
|
-
onResize
|
|
650
|
-
} = options;
|
|
651
|
-
useEffect(() => {
|
|
652
|
-
let element = ref == null ? void 0 : ref.current;
|
|
653
|
-
|
|
654
|
-
if (!element) {
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
683
|
|
|
658
|
-
|
|
659
|
-
window.addEventListener('resize', onResize, false);
|
|
660
|
-
return () => {
|
|
661
|
-
window.removeEventListener('resize', onResize, false);
|
|
662
|
-
};
|
|
663
|
-
} else {
|
|
664
|
-
const resizeObserverInstance = new window.ResizeObserver(entries => {
|
|
665
|
-
if (!entries.length) {
|
|
666
|
-
return;
|
|
667
|
-
}
|
|
684
|
+
var $43a0edf5ccd884bb$exports = {};
|
|
668
685
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}, [context, ref]);
|
|
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;
|
|
690
706
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
node = node.parentElement;
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
return node || document.scrollingElement || document.documentElement;
|
|
707
|
+
function $43a0edf5ccd884bb$var$testPlatform(re) {
|
|
708
|
+
return typeof window !== 'undefined' && window.navigator != null ? re.test(window.navigator.platform) : false;
|
|
697
709
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
710
|
+
function $43a0edf5ccd884bb$export$9ac100e40613ea10() {
|
|
711
|
+
return $43a0edf5ccd884bb$var$testPlatform(/^Mac/);
|
|
712
|
+
}
|
|
713
|
+
function $43a0edf5ccd884bb$export$186c6964ca17d99() {
|
|
714
|
+
return $43a0edf5ccd884bb$var$testPlatform(/^iPhone/);
|
|
715
|
+
}
|
|
716
|
+
function $43a0edf5ccd884bb$export$7bef049ce92e4224() {
|
|
717
|
+
return $43a0edf5ccd884bb$var$testPlatform(/^iPad/) || $43a0edf5ccd884bb$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
718
|
+
}
|
|
719
|
+
function $43a0edf5ccd884bb$export$fedb369cb70207f1() {
|
|
720
|
+
return $43a0edf5ccd884bb$export$186c6964ca17d99() || $43a0edf5ccd884bb$export$7bef049ce92e4224();
|
|
721
|
+
}
|
|
722
|
+
function $43a0edf5ccd884bb$export$e1865c3bedcd822b() {
|
|
723
|
+
return $43a0edf5ccd884bb$export$9ac100e40613ea10() || $43a0edf5ccd884bb$export$fedb369cb70207f1();
|
|
724
|
+
}
|
|
725
|
+
function $43a0edf5ccd884bb$export$78551043582a6a98() {
|
|
726
|
+
return $43a0edf5ccd884bb$var$testUserAgent(/AppleWebKit/) && !$43a0edf5ccd884bb$export$6446a186d09e379e();
|
|
727
|
+
}
|
|
728
|
+
function $43a0edf5ccd884bb$export$6446a186d09e379e() {
|
|
729
|
+
return $43a0edf5ccd884bb$var$testUserAgent(/Chrome/);
|
|
730
|
+
}
|
|
731
|
+
function $43a0edf5ccd884bb$export$a11b0059900ceec8() {
|
|
732
|
+
return $43a0edf5ccd884bb$var$testUserAgent(/Android/);
|
|
702
733
|
}
|
|
703
734
|
|
|
704
|
-
// @ts-ignore
|
|
705
|
-
let $d662329747d896105af008c761523$var$visualViewport = typeof window !== 'undefined' && window.visualViewport;
|
|
706
|
-
export function useViewportSize() {
|
|
707
|
-
let [size, setSize] = useState(() => $d662329747d896105af008c761523$var$getViewportSize());
|
|
708
|
-
useEffect(() => {
|
|
709
|
-
// Use visualViewport api to track available height even on iOS virtual keyboard opening
|
|
710
|
-
let onResize = () => {
|
|
711
|
-
setSize(size => {
|
|
712
|
-
let newSize = $d662329747d896105af008c761523$var$getViewportSize();
|
|
713
|
-
|
|
714
|
-
if (newSize.width === size.width && newSize.height === size.height) {
|
|
715
|
-
return size;
|
|
716
|
-
}
|
|
717
735
|
|
|
718
|
-
|
|
719
|
-
});
|
|
720
|
-
};
|
|
736
|
+
var $6f85328eaea47571$exports = {};
|
|
721
737
|
|
|
722
|
-
|
|
723
|
-
window.addEventListener('resize', onResize);
|
|
724
|
-
} else {
|
|
725
|
-
$d662329747d896105af008c761523$var$visualViewport.addEventListener('resize', onResize);
|
|
726
|
-
}
|
|
738
|
+
$parcel$export($6f85328eaea47571$exports, "useEvent", () => $6f85328eaea47571$export$90fc3a17d93f704c);
|
|
727
739
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
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
|
+
]);
|
|
737
759
|
}
|
|
738
760
|
|
|
739
|
-
function $d662329747d896105af008c761523$var$getViewportSize() {
|
|
740
|
-
return {
|
|
741
|
-
width: ($d662329747d896105af008c761523$var$visualViewport == null ? void 0 : $d662329747d896105af008c761523$var$visualViewport.width) || window.innerWidth,
|
|
742
|
-
height: ($d662329747d896105af008c761523$var$visualViewport == null ? void 0 : $d662329747d896105af008c761523$var$visualViewport.height) || window.innerHeight
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
761
|
|
|
746
|
-
|
|
747
|
-
const $c8aa524f123a75a64d51e06d16b9568$var$descriptionNodes = new Map();
|
|
748
|
-
export function useDescription(description) {
|
|
749
|
-
let [id, setId] = useState(null);
|
|
762
|
+
var $8bfb318ccfa2e412$exports = {};
|
|
750
763
|
|
|
751
|
-
|
|
752
|
-
if (!description) {
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
764
|
+
$parcel$export($8bfb318ccfa2e412$exports, "useValueEffect", () => $8bfb318ccfa2e412$export$14d238f342723f25);
|
|
755
765
|
|
|
756
|
-
let desc = $c8aa524f123a75a64d51e06d16b9568$var$descriptionNodes.get(description);
|
|
757
|
-
|
|
758
|
-
if (!desc) {
|
|
759
|
-
let id = "react-aria-description-" + $c8aa524f123a75a64d51e06d16b9568$var$descriptionId++;
|
|
760
|
-
setId(id);
|
|
761
|
-
let node = document.createElement('div');
|
|
762
|
-
node.id = id;
|
|
763
|
-
node.style.display = 'none';
|
|
764
|
-
node.textContent = description;
|
|
765
|
-
document.body.appendChild(node);
|
|
766
|
-
desc = {
|
|
767
|
-
refCount: 0,
|
|
768
|
-
element: node
|
|
769
|
-
};
|
|
770
|
-
$c8aa524f123a75a64d51e06d16b9568$var$descriptionNodes.set(description, desc);
|
|
771
|
-
} else {
|
|
772
|
-
setId(desc.element.id);
|
|
773
|
-
}
|
|
774
766
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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);
|
|
781
788
|
};
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
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;
|
|
787
825
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
826
|
+
/**
|
|
827
|
+
* Computes the offset left or top from child to ancestor by accumulating
|
|
828
|
+
* offsetLeft or offsetTop through intervening offsetParents.
|
|
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;
|
|
843
|
+
}
|
|
844
|
+
return sum;
|
|
791
845
|
}
|
|
792
846
|
|
|
793
|
-
function $b0986c1243f71db8e992f67117a1ed9$var$testPlatform(re) {
|
|
794
|
-
return typeof window !== 'undefined' && window.navigator != null ? re.test(window.navigator.platform) : false;
|
|
795
|
-
}
|
|
796
847
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
}
|
|
800
|
-
export function isIPhone() {
|
|
801
|
-
return $b0986c1243f71db8e992f67117a1ed9$var$testPlatform(/^iPhone/);
|
|
802
|
-
}
|
|
803
|
-
export function isIPad() {
|
|
804
|
-
return $b0986c1243f71db8e992f67117a1ed9$var$testPlatform(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
805
|
-
isMac() && navigator.maxTouchPoints > 1;
|
|
806
|
-
}
|
|
807
|
-
export function isIOS() {
|
|
808
|
-
return isIPhone() || isIPad();
|
|
809
|
-
}
|
|
810
|
-
export function isAppleDevice() {
|
|
811
|
-
return isMac() || isIOS();
|
|
812
|
-
}
|
|
813
|
-
export function isWebKit() {
|
|
814
|
-
return $b0986c1243f71db8e992f67117a1ed9$var$testUserAgent(/AppleWebKit/) && !isChrome();
|
|
815
|
-
}
|
|
816
|
-
export function isChrome() {
|
|
817
|
-
return $b0986c1243f71db8e992f67117a1ed9$var$testUserAgent(/Chrome/);
|
|
818
|
-
}
|
|
819
|
-
export function isAndroid() {
|
|
820
|
-
return $b0986c1243f71db8e992f67117a1ed9$var$testUserAgent(/Android/);
|
|
821
|
-
}
|
|
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};
|
|
822
851
|
//# sourceMappingURL=module.js.map
|