@sps-woodland/tabs 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/lib/Tabs.examples.d.ts +2 -0
- package/lib/index.cjs.js +64 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.es.js +2320 -0
- package/lib/manifest.d.ts +2 -0
- package/lib/style.css +1 -0
- package/lib/tab/Tab.css.d.ts +11 -0
- package/lib/tab/Tab.d.ts +9 -0
- package/lib/tab-panel/TabPanel.d.ts +8 -0
- package/lib/tabs/Tabs.css.d.ts +20 -0
- package/lib/tabs/Tabs.d.ts +5 -0
- package/package.json +51 -0
- package/vite.config.js +21 -0
package/lib/index.es.js
ADDED
|
@@ -0,0 +1,2320 @@
|
|
|
1
|
+
import * as R from "react";
|
|
2
|
+
import Q, { useState as A, useRef as x, useCallback as ne, useMemo as z, useEffect as D, useContext as se, useLayoutEffect as ht } from "react";
|
|
3
|
+
import { useCollection as _t } from "@react-stately/collections";
|
|
4
|
+
import { Metadata as ie, modChildren as Wt, cl as vt, Content as jt, useChildTestIdAttrBuilder as Yt } from "@sps-woodland/core";
|
|
5
|
+
import { code as He } from "@spscommerce/utils";
|
|
6
|
+
function $t(t, e, r) {
|
|
7
|
+
let [n, s] = A(t || e), l = x(t !== void 0), u = l.current, d = t !== void 0, p = x(n);
|
|
8
|
+
u !== d && console.warn(`WARN: A component changed from ${u ? "controlled" : "uncontrolled"} to ${d ? "controlled" : "uncontrolled"}.`), l.current = d;
|
|
9
|
+
let h = ne((b, ...S) => {
|
|
10
|
+
let m = (g, ...L) => {
|
|
11
|
+
r && (Object.is(p.current, g) || r(g, ...L)), d || (p.current = g);
|
|
12
|
+
};
|
|
13
|
+
typeof b == "function" ? (console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"), s((L, ...k) => {
|
|
14
|
+
let M = b(d ? p.current : L, ...k);
|
|
15
|
+
return m(M, ...S), d ? L : M;
|
|
16
|
+
})) : (d || s(b), m(b, ...S));
|
|
17
|
+
}, [
|
|
18
|
+
d,
|
|
19
|
+
r
|
|
20
|
+
]);
|
|
21
|
+
return d ? p.current = t : t = n, [
|
|
22
|
+
t,
|
|
23
|
+
h
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
class F extends Set {
|
|
27
|
+
constructor(e, r, n) {
|
|
28
|
+
super(e), e instanceof F ? (this.anchorKey = r || e.anchorKey, this.currentKey = n || e.currentKey) : (this.anchorKey = r, this.currentKey = n);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function Xt(t, e) {
|
|
32
|
+
if (t.size !== e.size)
|
|
33
|
+
return !1;
|
|
34
|
+
for (let r of t)
|
|
35
|
+
if (!e.has(r))
|
|
36
|
+
return !1;
|
|
37
|
+
return !0;
|
|
38
|
+
}
|
|
39
|
+
function qt(t) {
|
|
40
|
+
let { selectionMode: e = "none", disallowEmptySelection: r, allowDuplicateSelectionEvents: n, selectionBehavior: s = "toggle", disabledBehavior: l = "all" } = t, u = x(!1), [, d] = A(!1), p = x(null), h = x(null), [, b] = A(null), S = z(
|
|
41
|
+
() => Ge(t.selectedKeys),
|
|
42
|
+
[
|
|
43
|
+
t.selectedKeys
|
|
44
|
+
]
|
|
45
|
+
), m = z(
|
|
46
|
+
() => Ge(t.defaultSelectedKeys, new F()),
|
|
47
|
+
[
|
|
48
|
+
t.defaultSelectedKeys
|
|
49
|
+
]
|
|
50
|
+
), [g, L] = $t(S, m, t.onSelectionChange), k = z(
|
|
51
|
+
() => t.disabledKeys ? new Set(t.disabledKeys) : /* @__PURE__ */ new Set(),
|
|
52
|
+
[
|
|
53
|
+
t.disabledKeys
|
|
54
|
+
]
|
|
55
|
+
), [M, K] = A(s);
|
|
56
|
+
s === "replace" && M === "toggle" && typeof g == "object" && g.size === 0 && K("replace");
|
|
57
|
+
let P = x(s);
|
|
58
|
+
return D(() => {
|
|
59
|
+
s !== P.current && (K(s), P.current = s);
|
|
60
|
+
}, [
|
|
61
|
+
s
|
|
62
|
+
]), {
|
|
63
|
+
selectionMode: e,
|
|
64
|
+
disallowEmptySelection: r,
|
|
65
|
+
selectionBehavior: M,
|
|
66
|
+
setSelectionBehavior: K,
|
|
67
|
+
get isFocused() {
|
|
68
|
+
return u.current;
|
|
69
|
+
},
|
|
70
|
+
setFocused(w) {
|
|
71
|
+
u.current = w, d(w);
|
|
72
|
+
},
|
|
73
|
+
get focusedKey() {
|
|
74
|
+
return p.current;
|
|
75
|
+
},
|
|
76
|
+
get childFocusStrategy() {
|
|
77
|
+
return h.current;
|
|
78
|
+
},
|
|
79
|
+
setFocusedKey(w, i = "first") {
|
|
80
|
+
p.current = w, h.current = i, b(w);
|
|
81
|
+
},
|
|
82
|
+
selectedKeys: g,
|
|
83
|
+
setSelectedKeys(w) {
|
|
84
|
+
(n || !Xt(w, g)) && L(w);
|
|
85
|
+
},
|
|
86
|
+
disabledKeys: k,
|
|
87
|
+
disabledBehavior: l
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function Ge(t, e) {
|
|
91
|
+
return t ? t === "all" ? "all" : new F(t) : e;
|
|
92
|
+
}
|
|
93
|
+
class Jt {
|
|
94
|
+
get selectionMode() {
|
|
95
|
+
return this.state.selectionMode;
|
|
96
|
+
}
|
|
97
|
+
get disallowEmptySelection() {
|
|
98
|
+
return this.state.disallowEmptySelection;
|
|
99
|
+
}
|
|
100
|
+
get selectionBehavior() {
|
|
101
|
+
return this.state.selectionBehavior;
|
|
102
|
+
}
|
|
103
|
+
setSelectionBehavior(e) {
|
|
104
|
+
this.state.setSelectionBehavior(e);
|
|
105
|
+
}
|
|
106
|
+
get isFocused() {
|
|
107
|
+
return this.state.isFocused;
|
|
108
|
+
}
|
|
109
|
+
setFocused(e) {
|
|
110
|
+
this.state.setFocused(e);
|
|
111
|
+
}
|
|
112
|
+
get focusedKey() {
|
|
113
|
+
return this.state.focusedKey;
|
|
114
|
+
}
|
|
115
|
+
get childFocusStrategy() {
|
|
116
|
+
return this.state.childFocusStrategy;
|
|
117
|
+
}
|
|
118
|
+
setFocusedKey(e, r) {
|
|
119
|
+
this.state.setFocusedKey(e, r);
|
|
120
|
+
}
|
|
121
|
+
get selectedKeys() {
|
|
122
|
+
return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
|
|
123
|
+
}
|
|
124
|
+
get rawSelection() {
|
|
125
|
+
return this.state.selectedKeys;
|
|
126
|
+
}
|
|
127
|
+
isSelected(e) {
|
|
128
|
+
return this.state.selectionMode === "none" ? !1 : (e = this.getKey(e), this.state.selectedKeys === "all" ? this.canSelectItem(e) : this.state.selectedKeys.has(e));
|
|
129
|
+
}
|
|
130
|
+
get isEmpty() {
|
|
131
|
+
return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
|
|
132
|
+
}
|
|
133
|
+
get isSelectAll() {
|
|
134
|
+
if (this.isEmpty)
|
|
135
|
+
return !1;
|
|
136
|
+
if (this.state.selectedKeys === "all")
|
|
137
|
+
return !0;
|
|
138
|
+
if (this._isSelectAll != null)
|
|
139
|
+
return this._isSelectAll;
|
|
140
|
+
let e = this.getSelectAllKeys(), r = this.state.selectedKeys;
|
|
141
|
+
return this._isSelectAll = e.every(
|
|
142
|
+
(n) => r.has(n)
|
|
143
|
+
), this._isSelectAll;
|
|
144
|
+
}
|
|
145
|
+
get firstSelectedKey() {
|
|
146
|
+
let e = null;
|
|
147
|
+
for (let r of this.state.selectedKeys) {
|
|
148
|
+
let n = this.collection.getItem(r);
|
|
149
|
+
(!e || (n == null ? void 0 : n.index) < e.index) && (e = n);
|
|
150
|
+
}
|
|
151
|
+
return e == null ? void 0 : e.key;
|
|
152
|
+
}
|
|
153
|
+
get lastSelectedKey() {
|
|
154
|
+
let e = null;
|
|
155
|
+
for (let r of this.state.selectedKeys) {
|
|
156
|
+
let n = this.collection.getItem(r);
|
|
157
|
+
(!e || (n == null ? void 0 : n.index) > e.index) && (e = n);
|
|
158
|
+
}
|
|
159
|
+
return e == null ? void 0 : e.key;
|
|
160
|
+
}
|
|
161
|
+
get disabledKeys() {
|
|
162
|
+
return this.state.disabledKeys;
|
|
163
|
+
}
|
|
164
|
+
get disabledBehavior() {
|
|
165
|
+
return this.state.disabledBehavior;
|
|
166
|
+
}
|
|
167
|
+
extendSelection(e) {
|
|
168
|
+
if (this.selectionMode === "none")
|
|
169
|
+
return;
|
|
170
|
+
if (this.selectionMode === "single") {
|
|
171
|
+
this.replaceSelection(e);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
e = this.getKey(e);
|
|
175
|
+
let r;
|
|
176
|
+
if (this.state.selectedKeys === "all")
|
|
177
|
+
r = new F([
|
|
178
|
+
e
|
|
179
|
+
], e, e);
|
|
180
|
+
else {
|
|
181
|
+
let n = this.state.selectedKeys, s = n.anchorKey || e;
|
|
182
|
+
r = new F(n, s, e);
|
|
183
|
+
for (let l of this.getKeyRange(s, n.currentKey || e))
|
|
184
|
+
r.delete(l);
|
|
185
|
+
for (let l of this.getKeyRange(e, s))
|
|
186
|
+
this.canSelectItem(l) && r.add(l);
|
|
187
|
+
}
|
|
188
|
+
this.state.setSelectedKeys(r);
|
|
189
|
+
}
|
|
190
|
+
getKeyRange(e, r) {
|
|
191
|
+
let n = this.collection.getItem(e), s = this.collection.getItem(r);
|
|
192
|
+
return n && s ? n.index <= s.index ? this.getKeyRangeInternal(e, r) : this.getKeyRangeInternal(r, e) : [];
|
|
193
|
+
}
|
|
194
|
+
getKeyRangeInternal(e, r) {
|
|
195
|
+
let n = [], s = e;
|
|
196
|
+
for (; s; ) {
|
|
197
|
+
let l = this.collection.getItem(s);
|
|
198
|
+
if ((l && l.type === "item" || l.type === "cell" && this.allowsCellSelection) && n.push(s), s === r)
|
|
199
|
+
return n;
|
|
200
|
+
s = this.collection.getKeyAfter(s);
|
|
201
|
+
}
|
|
202
|
+
return [];
|
|
203
|
+
}
|
|
204
|
+
getKey(e) {
|
|
205
|
+
let r = this.collection.getItem(e);
|
|
206
|
+
if (!r || r.type === "cell" && this.allowsCellSelection)
|
|
207
|
+
return e;
|
|
208
|
+
for (; r.type !== "item" && r.parentKey != null; )
|
|
209
|
+
r = this.collection.getItem(r.parentKey);
|
|
210
|
+
return !r || r.type !== "item" ? null : r.key;
|
|
211
|
+
}
|
|
212
|
+
toggleSelection(e) {
|
|
213
|
+
if (this.selectionMode === "none")
|
|
214
|
+
return;
|
|
215
|
+
if (this.selectionMode === "single" && !this.isSelected(e)) {
|
|
216
|
+
this.replaceSelection(e);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (e = this.getKey(e), e == null)
|
|
220
|
+
return;
|
|
221
|
+
let r = new F(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
|
|
222
|
+
r.has(e) ? r.delete(e) : this.canSelectItem(e) && (r.add(e), r.anchorKey = e, r.currentKey = e), !(this.disallowEmptySelection && r.size === 0) && this.state.setSelectedKeys(r);
|
|
223
|
+
}
|
|
224
|
+
replaceSelection(e) {
|
|
225
|
+
if (this.selectionMode === "none" || (e = this.getKey(e), e == null))
|
|
226
|
+
return;
|
|
227
|
+
let r = this.canSelectItem(e) ? new F([
|
|
228
|
+
e
|
|
229
|
+
], e, e) : new F();
|
|
230
|
+
this.state.setSelectedKeys(r);
|
|
231
|
+
}
|
|
232
|
+
setSelectedKeys(e) {
|
|
233
|
+
if (this.selectionMode === "none")
|
|
234
|
+
return;
|
|
235
|
+
let r = new F();
|
|
236
|
+
for (let n of e)
|
|
237
|
+
if (n = this.getKey(n), n != null && (r.add(n), this.selectionMode === "single"))
|
|
238
|
+
break;
|
|
239
|
+
this.state.setSelectedKeys(r);
|
|
240
|
+
}
|
|
241
|
+
getSelectAllKeys() {
|
|
242
|
+
let e = [], r = (n) => {
|
|
243
|
+
for (; n; ) {
|
|
244
|
+
if (this.canSelectItem(n)) {
|
|
245
|
+
let s = this.collection.getItem(n);
|
|
246
|
+
s.type === "item" && e.push(n), s.hasChildNodes && (this.allowsCellSelection || s.type !== "item") && r([
|
|
247
|
+
...s.childNodes
|
|
248
|
+
][0].key);
|
|
249
|
+
}
|
|
250
|
+
n = this.collection.getKeyAfter(n);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
return r(this.collection.getFirstKey()), e;
|
|
254
|
+
}
|
|
255
|
+
selectAll() {
|
|
256
|
+
this.selectionMode === "multiple" && this.state.setSelectedKeys("all");
|
|
257
|
+
}
|
|
258
|
+
clearSelection() {
|
|
259
|
+
!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0) && this.state.setSelectedKeys(new F());
|
|
260
|
+
}
|
|
261
|
+
toggleSelectAll() {
|
|
262
|
+
this.isSelectAll ? this.clearSelection() : this.selectAll();
|
|
263
|
+
}
|
|
264
|
+
select(e, r) {
|
|
265
|
+
this.selectionMode !== "none" && (this.selectionMode === "single" ? this.isSelected(e) && !this.disallowEmptySelection ? this.toggleSelection(e) : this.replaceSelection(e) : this.selectionBehavior === "toggle" || r && (r.pointerType === "touch" || r.pointerType === "virtual") ? this.toggleSelection(e) : this.replaceSelection(e));
|
|
266
|
+
}
|
|
267
|
+
isSelectionEqual(e) {
|
|
268
|
+
if (e === this.state.selectedKeys)
|
|
269
|
+
return !0;
|
|
270
|
+
let r = this.selectedKeys;
|
|
271
|
+
if (e.size !== r.size)
|
|
272
|
+
return !1;
|
|
273
|
+
for (let n of e)
|
|
274
|
+
if (!r.has(n))
|
|
275
|
+
return !1;
|
|
276
|
+
for (let n of r)
|
|
277
|
+
if (!e.has(n))
|
|
278
|
+
return !1;
|
|
279
|
+
return !0;
|
|
280
|
+
}
|
|
281
|
+
canSelectItem(e) {
|
|
282
|
+
if (this.state.selectionMode === "none" || this.state.disabledKeys.has(e))
|
|
283
|
+
return !1;
|
|
284
|
+
let r = this.collection.getItem(e);
|
|
285
|
+
return !(!r || r.type === "cell" && !this.allowsCellSelection);
|
|
286
|
+
}
|
|
287
|
+
isDisabled(e) {
|
|
288
|
+
return this.state.disabledKeys.has(e) && this.state.disabledBehavior === "all";
|
|
289
|
+
}
|
|
290
|
+
constructor(e, r, n) {
|
|
291
|
+
this.collection = e, this.state = r;
|
|
292
|
+
var s;
|
|
293
|
+
this.allowsCellSelection = (s = n == null ? void 0 : n.allowsCellSelection) !== null && s !== void 0 ? s : !1, this._isSelectAll = null;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
var Zt = Symbol.iterator;
|
|
297
|
+
class _e {
|
|
298
|
+
*[Zt]() {
|
|
299
|
+
yield* this.iterable;
|
|
300
|
+
}
|
|
301
|
+
get size() {
|
|
302
|
+
return this.keyMap.size;
|
|
303
|
+
}
|
|
304
|
+
getKeys() {
|
|
305
|
+
return this.keyMap.keys();
|
|
306
|
+
}
|
|
307
|
+
getKeyBefore(e) {
|
|
308
|
+
let r = this.keyMap.get(e);
|
|
309
|
+
return r ? r.prevKey : null;
|
|
310
|
+
}
|
|
311
|
+
getKeyAfter(e) {
|
|
312
|
+
let r = this.keyMap.get(e);
|
|
313
|
+
return r ? r.nextKey : null;
|
|
314
|
+
}
|
|
315
|
+
getFirstKey() {
|
|
316
|
+
return this.firstKey;
|
|
317
|
+
}
|
|
318
|
+
getLastKey() {
|
|
319
|
+
return this.lastKey;
|
|
320
|
+
}
|
|
321
|
+
getItem(e) {
|
|
322
|
+
return this.keyMap.get(e);
|
|
323
|
+
}
|
|
324
|
+
at(e) {
|
|
325
|
+
const r = [
|
|
326
|
+
...this.getKeys()
|
|
327
|
+
];
|
|
328
|
+
return this.getItem(r[e]);
|
|
329
|
+
}
|
|
330
|
+
constructor(e) {
|
|
331
|
+
this.keyMap = /* @__PURE__ */ new Map(), this.iterable = e;
|
|
332
|
+
let r = (l) => {
|
|
333
|
+
if (this.keyMap.set(l.key, l), l.childNodes && l.type === "section")
|
|
334
|
+
for (let u of l.childNodes)
|
|
335
|
+
r(u);
|
|
336
|
+
};
|
|
337
|
+
for (let l of e)
|
|
338
|
+
r(l);
|
|
339
|
+
let n, s = 0;
|
|
340
|
+
for (let [l, u] of this.keyMap)
|
|
341
|
+
n ? (n.nextKey = l, u.prevKey = n.key) : (this.firstKey = l, u.prevKey = void 0), u.type === "item" && (u.index = s++), n = u, n.nextKey = void 0;
|
|
342
|
+
this.lastKey = n == null ? void 0 : n.key;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function Qt(t) {
|
|
346
|
+
let { filter: e } = t, r = qt(t), n = z(
|
|
347
|
+
() => t.disabledKeys ? new Set(t.disabledKeys) : /* @__PURE__ */ new Set(),
|
|
348
|
+
[
|
|
349
|
+
t.disabledKeys
|
|
350
|
+
]
|
|
351
|
+
), s = (d) => e ? new _e(e(d)) : new _e(d), l = z(
|
|
352
|
+
() => ({
|
|
353
|
+
suppressTextValueWarning: t.suppressTextValueWarning
|
|
354
|
+
}),
|
|
355
|
+
[
|
|
356
|
+
t.suppressTextValueWarning
|
|
357
|
+
]
|
|
358
|
+
), u = _t(t, s, l, [
|
|
359
|
+
e
|
|
360
|
+
]);
|
|
361
|
+
return D(() => {
|
|
362
|
+
r.focusedKey != null && !u.getItem(r.focusedKey) && r.setFocusedKey(null);
|
|
363
|
+
}, [
|
|
364
|
+
u,
|
|
365
|
+
r.focusedKey
|
|
366
|
+
]), {
|
|
367
|
+
collection: u,
|
|
368
|
+
disabledKeys: n,
|
|
369
|
+
selectionManager: new Jt(u, r)
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
function er(t) {
|
|
373
|
+
var e;
|
|
374
|
+
let [r, n] = $t(t.selectedKey, (e = t.defaultSelectedKey) !== null && e !== void 0 ? e : null, t.onSelectionChange), s = z(
|
|
375
|
+
() => r != null ? [
|
|
376
|
+
r
|
|
377
|
+
] : [],
|
|
378
|
+
[
|
|
379
|
+
r
|
|
380
|
+
]
|
|
381
|
+
), { collection: l, disabledKeys: u, selectionManager: d } = Qt({
|
|
382
|
+
...t,
|
|
383
|
+
selectionMode: "single",
|
|
384
|
+
disallowEmptySelection: !0,
|
|
385
|
+
allowDuplicateSelectionEvents: !0,
|
|
386
|
+
selectedKeys: s,
|
|
387
|
+
onSelectionChange: (h) => {
|
|
388
|
+
let b = h.values().next().value;
|
|
389
|
+
b === r && t.onSelectionChange && t.onSelectionChange(b), n(b);
|
|
390
|
+
}
|
|
391
|
+
}), p = r != null ? l.getItem(r) : null;
|
|
392
|
+
return {
|
|
393
|
+
collection: l,
|
|
394
|
+
disabledKeys: u,
|
|
395
|
+
selectionManager: d,
|
|
396
|
+
selectedKey: r,
|
|
397
|
+
setSelectedKey: n,
|
|
398
|
+
selectedItem: p
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
function U() {
|
|
402
|
+
return U = Object.assign || function(t) {
|
|
403
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
404
|
+
var r = arguments[e];
|
|
405
|
+
for (var n in r)
|
|
406
|
+
Object.prototype.hasOwnProperty.call(r, n) && (t[n] = r[n]);
|
|
407
|
+
}
|
|
408
|
+
return t;
|
|
409
|
+
}, U.apply(this, arguments);
|
|
410
|
+
}
|
|
411
|
+
function tr(t) {
|
|
412
|
+
let e = er(U({}, t, {
|
|
413
|
+
suppressTextValueWarning: !0
|
|
414
|
+
}));
|
|
415
|
+
return D(() => {
|
|
416
|
+
let r = e.selectedKey;
|
|
417
|
+
(e.selectionManager.isEmpty || !e.collection.getItem(r)) && (r = e.collection.getFirstKey(), e.selectionManager.replaceSelection(r)), e.selectionManager.focusedKey == null && e.selectionManager.setFocusedKey(r);
|
|
418
|
+
}, [e.selectionManager, e.selectedKey, e.collection]), e;
|
|
419
|
+
}
|
|
420
|
+
const Oe = {
|
|
421
|
+
prefix: String(Math.round(Math.random() * 1e10)),
|
|
422
|
+
current: 0
|
|
423
|
+
}, mt = /* @__PURE__ */ Q.createContext(Oe);
|
|
424
|
+
let rr = Boolean(typeof window < "u" && window.document && window.document.createElement);
|
|
425
|
+
function nr(t) {
|
|
426
|
+
let e = se(mt);
|
|
427
|
+
return e === Oe && !rr && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server."), z(
|
|
428
|
+
() => t || `react-aria${e.prefix}-${++e.current}`,
|
|
429
|
+
[
|
|
430
|
+
t
|
|
431
|
+
]
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
function ir() {
|
|
435
|
+
let e = se(mt) !== Oe, [r, n] = A(e);
|
|
436
|
+
return typeof window < "u" && e && ht(() => {
|
|
437
|
+
n(!1);
|
|
438
|
+
}, []), r;
|
|
439
|
+
}
|
|
440
|
+
const sr = /* @__PURE__ */ new Set([
|
|
441
|
+
"Arab",
|
|
442
|
+
"Syrc",
|
|
443
|
+
"Samr",
|
|
444
|
+
"Mand",
|
|
445
|
+
"Thaa",
|
|
446
|
+
"Mend",
|
|
447
|
+
"Nkoo",
|
|
448
|
+
"Adlm",
|
|
449
|
+
"Rohg",
|
|
450
|
+
"Hebr"
|
|
451
|
+
]), ar = /* @__PURE__ */ new Set([
|
|
452
|
+
"ae",
|
|
453
|
+
"ar",
|
|
454
|
+
"arc",
|
|
455
|
+
"bcc",
|
|
456
|
+
"bqi",
|
|
457
|
+
"ckb",
|
|
458
|
+
"dv",
|
|
459
|
+
"fa",
|
|
460
|
+
"glk",
|
|
461
|
+
"he",
|
|
462
|
+
"ku",
|
|
463
|
+
"mzn",
|
|
464
|
+
"nqo",
|
|
465
|
+
"pnb",
|
|
466
|
+
"ps",
|
|
467
|
+
"sd",
|
|
468
|
+
"ug",
|
|
469
|
+
"ur",
|
|
470
|
+
"yi"
|
|
471
|
+
]);
|
|
472
|
+
function or(t) {
|
|
473
|
+
if (Intl.Locale) {
|
|
474
|
+
let r = new Intl.Locale(t).maximize().script;
|
|
475
|
+
return sr.has(r);
|
|
476
|
+
}
|
|
477
|
+
let e = t.split("-")[0];
|
|
478
|
+
return ar.has(e);
|
|
479
|
+
}
|
|
480
|
+
function Tt() {
|
|
481
|
+
let t = typeof navigator < "u" && (navigator.language || navigator.userLanguage) || "en-US";
|
|
482
|
+
try {
|
|
483
|
+
Intl.DateTimeFormat.supportedLocalesOf([
|
|
484
|
+
t
|
|
485
|
+
]);
|
|
486
|
+
} catch {
|
|
487
|
+
t = "en-US";
|
|
488
|
+
}
|
|
489
|
+
return {
|
|
490
|
+
locale: t,
|
|
491
|
+
direction: or(t) ? "rtl" : "ltr"
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
let Ke = Tt(), re = /* @__PURE__ */ new Set();
|
|
495
|
+
function We() {
|
|
496
|
+
Ke = Tt();
|
|
497
|
+
for (let t of re)
|
|
498
|
+
t(Ke);
|
|
499
|
+
}
|
|
500
|
+
function lr() {
|
|
501
|
+
let t = ir(), [e, r] = A(Ke);
|
|
502
|
+
return D(() => (re.size === 0 && window.addEventListener("languagechange", We), re.add(r), () => {
|
|
503
|
+
re.delete(r), re.size === 0 && window.removeEventListener("languagechange", We);
|
|
504
|
+
}), []), t ? {
|
|
505
|
+
locale: "en-US",
|
|
506
|
+
direction: "ltr"
|
|
507
|
+
} : e;
|
|
508
|
+
}
|
|
509
|
+
const cr = /* @__PURE__ */ Q.createContext(null);
|
|
510
|
+
function Kt() {
|
|
511
|
+
let t = lr();
|
|
512
|
+
return se(cr) || t;
|
|
513
|
+
}
|
|
514
|
+
function Pt(t) {
|
|
515
|
+
var e, r, n = "";
|
|
516
|
+
if (typeof t == "string" || typeof t == "number")
|
|
517
|
+
n += t;
|
|
518
|
+
else if (typeof t == "object")
|
|
519
|
+
if (Array.isArray(t))
|
|
520
|
+
for (e = 0; e < t.length; e++)
|
|
521
|
+
t[e] && (r = Pt(t[e])) && (n && (n += " "), n += r);
|
|
522
|
+
else
|
|
523
|
+
for (e in t)
|
|
524
|
+
t[e] && (n && (n += " "), n += e);
|
|
525
|
+
return n;
|
|
526
|
+
}
|
|
527
|
+
function St() {
|
|
528
|
+
for (var t, e, r = 0, n = ""; r < arguments.length; )
|
|
529
|
+
(t = arguments[r++]) && (e = Pt(t)) && (n && (n += " "), n += e);
|
|
530
|
+
return n;
|
|
531
|
+
}
|
|
532
|
+
const ur = typeof window < "u" ? Q.useLayoutEffect : () => {
|
|
533
|
+
};
|
|
534
|
+
let ye = /* @__PURE__ */ new Map();
|
|
535
|
+
function Et(t) {
|
|
536
|
+
let [e, r] = A(t), n = x(null), s = nr(e), l = ne((u) => {
|
|
537
|
+
n.current = u;
|
|
538
|
+
}, []);
|
|
539
|
+
return ye.set(s, l), ur(() => {
|
|
540
|
+
let u = s;
|
|
541
|
+
return () => {
|
|
542
|
+
ye.delete(u);
|
|
543
|
+
};
|
|
544
|
+
}, [
|
|
545
|
+
s
|
|
546
|
+
]), D(() => {
|
|
547
|
+
let u = n.current;
|
|
548
|
+
u && (n.current = null, r(u));
|
|
549
|
+
}), s;
|
|
550
|
+
}
|
|
551
|
+
function fr(t, e) {
|
|
552
|
+
if (t === e)
|
|
553
|
+
return t;
|
|
554
|
+
let r = ye.get(t);
|
|
555
|
+
if (r)
|
|
556
|
+
return r(e), e;
|
|
557
|
+
let n = ye.get(e);
|
|
558
|
+
return n ? (n(t), t) : e;
|
|
559
|
+
}
|
|
560
|
+
function dr(...t) {
|
|
561
|
+
return (...e) => {
|
|
562
|
+
for (let r of t)
|
|
563
|
+
typeof r == "function" && r(...e);
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function wt(...t) {
|
|
567
|
+
let e = {
|
|
568
|
+
...t[0]
|
|
569
|
+
};
|
|
570
|
+
for (let r = 1; r < t.length; r++) {
|
|
571
|
+
let n = t[r];
|
|
572
|
+
for (let s in n) {
|
|
573
|
+
let l = e[s], u = n[s];
|
|
574
|
+
typeof l == "function" && typeof u == "function" && s[0] === "o" && s[1] === "n" && s.charCodeAt(2) >= 65 && s.charCodeAt(2) <= 90 ? e[s] = dr(l, u) : (s === "className" || s === "UNSAFE_className") && typeof l == "string" && typeof u == "string" ? e[s] = St(l, u) : s === "id" && l && u ? e.id = fr(l, u) : e[s] = u !== void 0 ? u : l;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return e;
|
|
578
|
+
}
|
|
579
|
+
let te = /* @__PURE__ */ new Map(), je = /* @__PURE__ */ new Set();
|
|
580
|
+
function Ye() {
|
|
581
|
+
if (typeof window > "u")
|
|
582
|
+
return;
|
|
583
|
+
let t = (r) => {
|
|
584
|
+
let n = te.get(r.target);
|
|
585
|
+
n || (n = /* @__PURE__ */ new Set(), te.set(r.target, n), r.target.addEventListener("transitioncancel", e)), n.add(r.propertyName);
|
|
586
|
+
}, e = (r) => {
|
|
587
|
+
let n = te.get(r.target);
|
|
588
|
+
if (!!n && (n.delete(r.propertyName), n.size === 0 && (r.target.removeEventListener("transitioncancel", e), te.delete(r.target)), te.size === 0)) {
|
|
589
|
+
for (let s of je)
|
|
590
|
+
s();
|
|
591
|
+
je.clear();
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", e);
|
|
595
|
+
}
|
|
596
|
+
typeof document < "u" && (document.readyState !== "loading" ? Ye() : document.addEventListener("DOMContentLoaded", Ye));
|
|
597
|
+
function xt(t, e) {
|
|
598
|
+
let { id: r, "aria-label": n, "aria-labelledby": s } = t;
|
|
599
|
+
return r = Et(r), s && n ? s = [
|
|
600
|
+
.../* @__PURE__ */ new Set([
|
|
601
|
+
...s.trim().split(/\s+/),
|
|
602
|
+
r
|
|
603
|
+
])
|
|
604
|
+
].join(" ") : s && (s = s.trim().split(/\s+/).join(" ")), !n && !s && e && (n = e), {
|
|
605
|
+
id: r,
|
|
606
|
+
"aria-label": n,
|
|
607
|
+
"aria-labelledby": s
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
const Mt = typeof window < "u" ? Q.useLayoutEffect : () => {
|
|
611
|
+
};
|
|
612
|
+
let Xe = /* @__PURE__ */ new Map();
|
|
613
|
+
function pr(t, e) {
|
|
614
|
+
if (t === e)
|
|
615
|
+
return t;
|
|
616
|
+
let r = Xe.get(t);
|
|
617
|
+
if (r)
|
|
618
|
+
return r(e), e;
|
|
619
|
+
let n = Xe.get(e);
|
|
620
|
+
return n ? (n(t), t) : e;
|
|
621
|
+
}
|
|
622
|
+
function yr(...t) {
|
|
623
|
+
return (...e) => {
|
|
624
|
+
for (let r of t)
|
|
625
|
+
typeof r == "function" && r(...e);
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
function G(...t) {
|
|
629
|
+
let e = {
|
|
630
|
+
...t[0]
|
|
631
|
+
};
|
|
632
|
+
for (let r = 1; r < t.length; r++) {
|
|
633
|
+
let n = t[r];
|
|
634
|
+
for (let s in n) {
|
|
635
|
+
let l = e[s], u = n[s];
|
|
636
|
+
typeof l == "function" && typeof u == "function" && s[0] === "o" && s[1] === "n" && s.charCodeAt(2) >= 65 && s.charCodeAt(2) <= 90 ? e[s] = yr(l, u) : (s === "className" || s === "UNSAFE_className") && typeof l == "string" && typeof u == "string" ? e[s] = St(l, u) : s === "id" && l && u ? e.id = pr(l, u) : e[s] = u !== void 0 ? u : l;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return e;
|
|
640
|
+
}
|
|
641
|
+
function I(t) {
|
|
642
|
+
if (gr())
|
|
643
|
+
t.focus({
|
|
644
|
+
preventScroll: !0
|
|
645
|
+
});
|
|
646
|
+
else {
|
|
647
|
+
let e = br(t);
|
|
648
|
+
t.focus(), hr(e);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
let ce = null;
|
|
652
|
+
function gr() {
|
|
653
|
+
if (ce == null) {
|
|
654
|
+
ce = !1;
|
|
655
|
+
try {
|
|
656
|
+
var t = document.createElement("div");
|
|
657
|
+
t.focus({
|
|
658
|
+
get preventScroll() {
|
|
659
|
+
return ce = !0, !0;
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
} catch {
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return ce;
|
|
666
|
+
}
|
|
667
|
+
function br(t) {
|
|
668
|
+
for (var e = t.parentNode, r = [], n = document.scrollingElement || document.documentElement; e instanceof HTMLElement && e !== n; )
|
|
669
|
+
(e.offsetHeight < e.scrollHeight || e.offsetWidth < e.scrollWidth) && r.push({
|
|
670
|
+
element: e,
|
|
671
|
+
scrollTop: e.scrollTop,
|
|
672
|
+
scrollLeft: e.scrollLeft
|
|
673
|
+
}), e = e.parentNode;
|
|
674
|
+
return n instanceof HTMLElement && r.push({
|
|
675
|
+
element: n,
|
|
676
|
+
scrollTop: n.scrollTop,
|
|
677
|
+
scrollLeft: n.scrollLeft
|
|
678
|
+
}), r;
|
|
679
|
+
}
|
|
680
|
+
function hr(t) {
|
|
681
|
+
for (let { element: e, scrollTop: r, scrollLeft: n } of t)
|
|
682
|
+
e.scrollTop = r, e.scrollLeft = n;
|
|
683
|
+
}
|
|
684
|
+
let X = /* @__PURE__ */ new Map(), Pe = /* @__PURE__ */ new Set();
|
|
685
|
+
function qe() {
|
|
686
|
+
if (typeof window > "u")
|
|
687
|
+
return;
|
|
688
|
+
let t = (r) => {
|
|
689
|
+
let n = X.get(r.target);
|
|
690
|
+
n || (n = /* @__PURE__ */ new Set(), X.set(r.target, n), r.target.addEventListener("transitioncancel", e)), n.add(r.propertyName);
|
|
691
|
+
}, e = (r) => {
|
|
692
|
+
let n = X.get(r.target);
|
|
693
|
+
if (!!n && (n.delete(r.propertyName), n.size === 0 && (r.target.removeEventListener("transitioncancel", e), X.delete(r.target)), X.size === 0)) {
|
|
694
|
+
for (let s of Pe)
|
|
695
|
+
s();
|
|
696
|
+
Pe.clear();
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", e);
|
|
700
|
+
}
|
|
701
|
+
typeof document < "u" && (document.readyState !== "loading" ? qe() : document.addEventListener("DOMContentLoaded", qe));
|
|
702
|
+
function Ie(t) {
|
|
703
|
+
requestAnimationFrame(() => {
|
|
704
|
+
X.size === 0 ? t() : Pe.add(t);
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
function De() {
|
|
708
|
+
let t = x(/* @__PURE__ */ new Map()), e = ne((s, l, u, d) => {
|
|
709
|
+
let p = d != null && d.once ? (...h) => {
|
|
710
|
+
t.current.delete(u), u(...h);
|
|
711
|
+
} : u;
|
|
712
|
+
t.current.set(u, {
|
|
713
|
+
type: l,
|
|
714
|
+
eventTarget: s,
|
|
715
|
+
fn: p,
|
|
716
|
+
options: d
|
|
717
|
+
}), s.addEventListener(l, u, d);
|
|
718
|
+
}, []), r = ne((s, l, u, d) => {
|
|
719
|
+
var p;
|
|
720
|
+
let h = ((p = t.current.get(u)) === null || p === void 0 ? void 0 : p.fn) || u;
|
|
721
|
+
s.removeEventListener(l, h, d), t.current.delete(u);
|
|
722
|
+
}, []), n = ne(() => {
|
|
723
|
+
t.current.forEach((s, l) => {
|
|
724
|
+
r(s.eventTarget, s.type, l, s.options);
|
|
725
|
+
});
|
|
726
|
+
}, [
|
|
727
|
+
r
|
|
728
|
+
]);
|
|
729
|
+
return D(() => n, [
|
|
730
|
+
n
|
|
731
|
+
]), {
|
|
732
|
+
addGlobalListener: e,
|
|
733
|
+
removeGlobalListener: r,
|
|
734
|
+
removeAllGlobalListeners: n
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
function Lt(t, e) {
|
|
738
|
+
Mt(() => {
|
|
739
|
+
if (t && t.ref && e)
|
|
740
|
+
return t.ref.current = e.current, () => {
|
|
741
|
+
t.ref.current = null;
|
|
742
|
+
};
|
|
743
|
+
}, [
|
|
744
|
+
t,
|
|
745
|
+
e
|
|
746
|
+
]);
|
|
747
|
+
}
|
|
748
|
+
let vr = 0;
|
|
749
|
+
const he = /* @__PURE__ */ new Map();
|
|
750
|
+
function $r(t) {
|
|
751
|
+
let [e, r] = A(void 0);
|
|
752
|
+
return Mt(() => {
|
|
753
|
+
if (!t)
|
|
754
|
+
return;
|
|
755
|
+
let n = he.get(t);
|
|
756
|
+
if (n)
|
|
757
|
+
r(n.element.id);
|
|
758
|
+
else {
|
|
759
|
+
let s = `react-aria-description-${vr++}`;
|
|
760
|
+
r(s);
|
|
761
|
+
let l = document.createElement("div");
|
|
762
|
+
l.id = s, l.style.display = "none", l.textContent = t, document.body.appendChild(l), n = {
|
|
763
|
+
refCount: 0,
|
|
764
|
+
element: l
|
|
765
|
+
}, he.set(t, n);
|
|
766
|
+
}
|
|
767
|
+
return n.refCount++, () => {
|
|
768
|
+
--n.refCount === 0 && (n.element.remove(), he.delete(t));
|
|
769
|
+
};
|
|
770
|
+
}, [
|
|
771
|
+
t
|
|
772
|
+
]), {
|
|
773
|
+
"aria-describedby": t ? e : void 0
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
function mr(t) {
|
|
777
|
+
var e;
|
|
778
|
+
return typeof window > "u" || window.navigator == null ? !1 : ((e = window.navigator.userAgentData) === null || e === void 0 ? void 0 : e.brands.some(
|
|
779
|
+
(r) => t.test(r.brand)
|
|
780
|
+
)) || t.test(window.navigator.userAgent);
|
|
781
|
+
}
|
|
782
|
+
function Fe(t) {
|
|
783
|
+
var e;
|
|
784
|
+
return typeof window < "u" && window.navigator != null ? t.test(((e = window.navigator.userAgentData) === null || e === void 0 ? void 0 : e.platform) || window.navigator.platform) : !1;
|
|
785
|
+
}
|
|
786
|
+
function ae() {
|
|
787
|
+
return Fe(/^Mac/i);
|
|
788
|
+
}
|
|
789
|
+
function Tr() {
|
|
790
|
+
return Fe(/^iPhone/i);
|
|
791
|
+
}
|
|
792
|
+
function Kr() {
|
|
793
|
+
return Fe(/^iPad/i) || ae() && navigator.maxTouchPoints > 1;
|
|
794
|
+
}
|
|
795
|
+
function oe() {
|
|
796
|
+
return Tr() || Kr();
|
|
797
|
+
}
|
|
798
|
+
function Pr() {
|
|
799
|
+
return ae() || oe();
|
|
800
|
+
}
|
|
801
|
+
function Sr() {
|
|
802
|
+
return mr(/Android/i);
|
|
803
|
+
}
|
|
804
|
+
function Er(t, e, r, n) {
|
|
805
|
+
let s = x(r);
|
|
806
|
+
s.current = r;
|
|
807
|
+
let l = r == null;
|
|
808
|
+
D(() => {
|
|
809
|
+
if (l)
|
|
810
|
+
return;
|
|
811
|
+
let u = t.current, d = (p) => s.current.call(this, p);
|
|
812
|
+
return u.addEventListener(e, d, n), () => {
|
|
813
|
+
u.removeEventListener(e, d, n);
|
|
814
|
+
};
|
|
815
|
+
}, [
|
|
816
|
+
t,
|
|
817
|
+
e,
|
|
818
|
+
n,
|
|
819
|
+
l
|
|
820
|
+
]);
|
|
821
|
+
}
|
|
822
|
+
function Je(t, e) {
|
|
823
|
+
let r = Ze(t, e, "left"), n = Ze(t, e, "top"), s = e.offsetWidth, l = e.offsetHeight, u = t.scrollLeft, d = t.scrollTop, p = u + t.offsetWidth, h = d + t.offsetHeight;
|
|
824
|
+
r <= u ? u = r : r + s > p && (u += r + s - p), n <= d ? d = n : n + l > h && (d += n + l - h), t.scrollLeft = u, t.scrollTop = d;
|
|
825
|
+
}
|
|
826
|
+
function Ze(t, e, r) {
|
|
827
|
+
const n = r === "left" ? "offsetLeft" : "offsetTop";
|
|
828
|
+
let s = 0;
|
|
829
|
+
for (; e.offsetParent && (s += e[n], e.offsetParent !== t); ) {
|
|
830
|
+
if (e.offsetParent.contains(t)) {
|
|
831
|
+
s -= t[n];
|
|
832
|
+
break;
|
|
833
|
+
}
|
|
834
|
+
e = e.offsetParent;
|
|
835
|
+
}
|
|
836
|
+
return s;
|
|
837
|
+
}
|
|
838
|
+
function Se(t) {
|
|
839
|
+
return t.mozInputSource === 0 && t.isTrusted ? !0 : Sr() && t.pointerType ? t.type === "click" && t.buttons === 1 : t.detail === 0 && !t.pointerType;
|
|
840
|
+
}
|
|
841
|
+
function wr(t) {
|
|
842
|
+
return t.width === 0 && t.height === 0 || t.width === 1 && t.height === 1 && t.pressure === 0 && t.detail === 0 && t.pointerType === "mouse";
|
|
843
|
+
}
|
|
844
|
+
let J = "default", Ee = "", de = /* @__PURE__ */ new WeakMap();
|
|
845
|
+
function Qe(t) {
|
|
846
|
+
oe() ? (J === "default" && (Ee = document.documentElement.style.webkitUserSelect, document.documentElement.style.webkitUserSelect = "none"), J = "disabled") : (t instanceof HTMLElement || t instanceof SVGElement) && (de.set(t, t.style.userSelect), t.style.userSelect = "none");
|
|
847
|
+
}
|
|
848
|
+
function ue(t) {
|
|
849
|
+
if (oe()) {
|
|
850
|
+
if (J !== "disabled")
|
|
851
|
+
return;
|
|
852
|
+
J = "restoring", setTimeout(() => {
|
|
853
|
+
Ie(() => {
|
|
854
|
+
J === "restoring" && (document.documentElement.style.webkitUserSelect === "none" && (document.documentElement.style.webkitUserSelect = Ee || ""), Ee = "", J = "default");
|
|
855
|
+
});
|
|
856
|
+
}, 300);
|
|
857
|
+
} else if ((t instanceof HTMLElement || t instanceof SVGElement) && t && de.has(t)) {
|
|
858
|
+
let e = de.get(t);
|
|
859
|
+
t.style.userSelect === "none" && (t.style.userSelect = e), t.getAttribute("style") === "" && t.removeAttribute("style"), de.delete(t);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
const kt = Q.createContext(null);
|
|
863
|
+
kt.displayName = "PressResponderContext";
|
|
864
|
+
function xr(t) {
|
|
865
|
+
let e = se(kt);
|
|
866
|
+
if (e) {
|
|
867
|
+
let { register: r, ...n } = e;
|
|
868
|
+
t = G(n, t), r();
|
|
869
|
+
}
|
|
870
|
+
return Lt(e, t.ref), t;
|
|
871
|
+
}
|
|
872
|
+
function Ct(t) {
|
|
873
|
+
let {
|
|
874
|
+
onPress: e,
|
|
875
|
+
onPressChange: r,
|
|
876
|
+
onPressStart: n,
|
|
877
|
+
onPressEnd: s,
|
|
878
|
+
onPressUp: l,
|
|
879
|
+
isDisabled: u,
|
|
880
|
+
isPressed: d,
|
|
881
|
+
preventFocusOnPress: p,
|
|
882
|
+
shouldCancelOnPointerExit: h,
|
|
883
|
+
allowTextSelectionOnPress: b,
|
|
884
|
+
ref: S,
|
|
885
|
+
...m
|
|
886
|
+
} = xr(t), g = x(null);
|
|
887
|
+
g.current = {
|
|
888
|
+
onPress: e,
|
|
889
|
+
onPressChange: r,
|
|
890
|
+
onPressStart: n,
|
|
891
|
+
onPressEnd: s,
|
|
892
|
+
onPressUp: l,
|
|
893
|
+
isDisabled: u,
|
|
894
|
+
shouldCancelOnPointerExit: h
|
|
895
|
+
};
|
|
896
|
+
let [L, k] = A(!1), M = x({
|
|
897
|
+
isPressed: !1,
|
|
898
|
+
ignoreEmulatedMouseEvents: !1,
|
|
899
|
+
ignoreClickAfterPress: !1,
|
|
900
|
+
didFirePressStart: !1,
|
|
901
|
+
activePointerId: null,
|
|
902
|
+
target: null,
|
|
903
|
+
isOverTarget: !1,
|
|
904
|
+
pointerType: null
|
|
905
|
+
}), { addGlobalListener: K, removeAllGlobalListeners: P } = De(), w = z(() => {
|
|
906
|
+
let i = M.current, E = (o, f) => {
|
|
907
|
+
let { onPressStart: a, onPressChange: c, isDisabled: O } = g.current;
|
|
908
|
+
O || i.didFirePressStart || (a && a({
|
|
909
|
+
type: "pressstart",
|
|
910
|
+
pointerType: f,
|
|
911
|
+
target: o.currentTarget,
|
|
912
|
+
shiftKey: o.shiftKey,
|
|
913
|
+
metaKey: o.metaKey,
|
|
914
|
+
ctrlKey: o.ctrlKey,
|
|
915
|
+
altKey: o.altKey
|
|
916
|
+
}), c && c(!0), i.didFirePressStart = !0, k(!0));
|
|
917
|
+
}, $ = (o, f, a = !0) => {
|
|
918
|
+
let { onPressEnd: c, onPressChange: O, onPress: ee, isDisabled: be } = g.current;
|
|
919
|
+
!i.didFirePressStart || (i.ignoreClickAfterPress = !0, i.didFirePressStart = !1, c && c({
|
|
920
|
+
type: "pressend",
|
|
921
|
+
pointerType: f,
|
|
922
|
+
target: o.currentTarget,
|
|
923
|
+
shiftKey: o.shiftKey,
|
|
924
|
+
metaKey: o.metaKey,
|
|
925
|
+
ctrlKey: o.ctrlKey,
|
|
926
|
+
altKey: o.altKey
|
|
927
|
+
}), O && O(!1), k(!1), ee && a && !be && ee({
|
|
928
|
+
type: "press",
|
|
929
|
+
pointerType: f,
|
|
930
|
+
target: o.currentTarget,
|
|
931
|
+
shiftKey: o.shiftKey,
|
|
932
|
+
metaKey: o.metaKey,
|
|
933
|
+
ctrlKey: o.ctrlKey,
|
|
934
|
+
altKey: o.altKey
|
|
935
|
+
}));
|
|
936
|
+
}, y = (o, f) => {
|
|
937
|
+
let { onPressUp: a, isDisabled: c } = g.current;
|
|
938
|
+
c || a && a({
|
|
939
|
+
type: "pressup",
|
|
940
|
+
pointerType: f,
|
|
941
|
+
target: o.currentTarget,
|
|
942
|
+
shiftKey: o.shiftKey,
|
|
943
|
+
metaKey: o.metaKey,
|
|
944
|
+
ctrlKey: o.ctrlKey,
|
|
945
|
+
altKey: o.altKey
|
|
946
|
+
});
|
|
947
|
+
}, T = (o) => {
|
|
948
|
+
i.isPressed && (i.isOverTarget && $(N(i.target, o), i.pointerType, !1), i.isPressed = !1, i.isOverTarget = !1, i.activePointerId = null, i.pointerType = null, P(), b || ue(i.target));
|
|
949
|
+
}, v = {
|
|
950
|
+
onKeyDown(o) {
|
|
951
|
+
ve(o.nativeEvent, o.currentTarget) && o.currentTarget.contains(o.target) ? (tt(o.target, o.key) && o.preventDefault(), o.stopPropagation(), !i.isPressed && !o.repeat && (i.target = o.currentTarget, i.isPressed = !0, E(o, "keyboard"), K(document, "keyup", C, !1))) : o.key === "Enter" && we(o.currentTarget) && o.stopPropagation();
|
|
952
|
+
},
|
|
953
|
+
onKeyUp(o) {
|
|
954
|
+
ve(o.nativeEvent, o.currentTarget) && !o.repeat && o.currentTarget.contains(o.target) && y(N(i.target, o), "keyboard");
|
|
955
|
+
},
|
|
956
|
+
onClick(o) {
|
|
957
|
+
o && !o.currentTarget.contains(o.target) || o && o.button === 0 && (o.stopPropagation(), u && o.preventDefault(), !i.ignoreClickAfterPress && !i.ignoreEmulatedMouseEvents && (i.pointerType === "virtual" || Se(o.nativeEvent)) && (!u && !p && I(o.currentTarget), E(o, "virtual"), y(o, "virtual"), $(o, "virtual")), i.ignoreEmulatedMouseEvents = !1, i.ignoreClickAfterPress = !1);
|
|
958
|
+
}
|
|
959
|
+
}, C = (o) => {
|
|
960
|
+
if (i.isPressed && ve(o, i.target)) {
|
|
961
|
+
tt(o.target, o.key) && o.preventDefault(), o.stopPropagation(), i.isPressed = !1;
|
|
962
|
+
let f = o.target;
|
|
963
|
+
$(N(i.target, o), "keyboard", i.target.contains(f)), P(), i.target instanceof HTMLElement && i.target.contains(f) && (we(i.target) || i.target.getAttribute("role") === "link") && i.target.click();
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
if (typeof PointerEvent < "u") {
|
|
967
|
+
v.onPointerDown = (c) => {
|
|
968
|
+
if (!(c.button !== 0 || !c.currentTarget.contains(c.target))) {
|
|
969
|
+
if (wr(c.nativeEvent)) {
|
|
970
|
+
i.pointerType = "virtual";
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
$e(c.currentTarget) && c.preventDefault(), i.pointerType = c.pointerType, c.stopPropagation(), i.isPressed || (i.isPressed = !0, i.isOverTarget = !0, i.activePointerId = c.pointerId, i.target = c.currentTarget, !u && !p && I(c.currentTarget), b || Qe(i.target), E(c, i.pointerType), K(document, "pointermove", o, !1), K(document, "pointerup", f, !1), K(document, "pointercancel", a, !1));
|
|
974
|
+
}
|
|
975
|
+
}, v.onMouseDown = (c) => {
|
|
976
|
+
!c.currentTarget.contains(c.target) || c.button === 0 && ($e(c.currentTarget) && c.preventDefault(), c.stopPropagation());
|
|
977
|
+
}, v.onPointerUp = (c) => {
|
|
978
|
+
!c.currentTarget.contains(c.target) || i.pointerType === "virtual" || c.button === 0 && _(c, c.currentTarget) && y(c, i.pointerType || c.pointerType);
|
|
979
|
+
};
|
|
980
|
+
let o = (c) => {
|
|
981
|
+
c.pointerId === i.activePointerId && (_(c, i.target) ? i.isOverTarget || (i.isOverTarget = !0, E(N(i.target, c), i.pointerType)) : i.isOverTarget && (i.isOverTarget = !1, $(N(i.target, c), i.pointerType, !1), g.current.shouldCancelOnPointerExit && T(c)));
|
|
982
|
+
}, f = (c) => {
|
|
983
|
+
c.pointerId === i.activePointerId && i.isPressed && c.button === 0 && (_(c, i.target) ? $(N(i.target, c), i.pointerType) : i.isOverTarget && $(N(i.target, c), i.pointerType, !1), i.isPressed = !1, i.isOverTarget = !1, i.activePointerId = null, i.pointerType = null, P(), b || ue(i.target));
|
|
984
|
+
}, a = (c) => {
|
|
985
|
+
T(c);
|
|
986
|
+
};
|
|
987
|
+
v.onDragStart = (c) => {
|
|
988
|
+
!c.currentTarget.contains(c.target) || T(c);
|
|
989
|
+
};
|
|
990
|
+
} else {
|
|
991
|
+
v.onMouseDown = (a) => {
|
|
992
|
+
a.button !== 0 || !a.currentTarget.contains(a.target) || ($e(a.currentTarget) && a.preventDefault(), a.stopPropagation(), !i.ignoreEmulatedMouseEvents && (i.isPressed = !0, i.isOverTarget = !0, i.target = a.currentTarget, i.pointerType = Se(a.nativeEvent) ? "virtual" : "mouse", !u && !p && I(a.currentTarget), E(a, i.pointerType), K(document, "mouseup", o, !1)));
|
|
993
|
+
}, v.onMouseEnter = (a) => {
|
|
994
|
+
!a.currentTarget.contains(a.target) || (a.stopPropagation(), i.isPressed && !i.ignoreEmulatedMouseEvents && (i.isOverTarget = !0, E(a, i.pointerType)));
|
|
995
|
+
}, v.onMouseLeave = (a) => {
|
|
996
|
+
!a.currentTarget.contains(a.target) || (a.stopPropagation(), i.isPressed && !i.ignoreEmulatedMouseEvents && (i.isOverTarget = !1, $(a, i.pointerType, !1), g.current.shouldCancelOnPointerExit && T(a)));
|
|
997
|
+
}, v.onMouseUp = (a) => {
|
|
998
|
+
!a.currentTarget.contains(a.target) || !i.ignoreEmulatedMouseEvents && a.button === 0 && y(a, i.pointerType);
|
|
999
|
+
};
|
|
1000
|
+
let o = (a) => {
|
|
1001
|
+
if (a.button === 0) {
|
|
1002
|
+
if (i.isPressed = !1, P(), i.ignoreEmulatedMouseEvents) {
|
|
1003
|
+
i.ignoreEmulatedMouseEvents = !1;
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
_(a, i.target) ? $(N(i.target, a), i.pointerType) : i.isOverTarget && $(N(i.target, a), i.pointerType, !1), i.isOverTarget = !1;
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
v.onTouchStart = (a) => {
|
|
1010
|
+
if (!a.currentTarget.contains(a.target))
|
|
1011
|
+
return;
|
|
1012
|
+
a.stopPropagation();
|
|
1013
|
+
let c = Mr(a.nativeEvent);
|
|
1014
|
+
!c || (i.activePointerId = c.identifier, i.ignoreEmulatedMouseEvents = !0, i.isOverTarget = !0, i.isPressed = !0, i.target = a.currentTarget, i.pointerType = "touch", !u && !p && I(a.currentTarget), b || Qe(i.target), E(a, i.pointerType), K(window, "scroll", f, !0));
|
|
1015
|
+
}, v.onTouchMove = (a) => {
|
|
1016
|
+
if (!a.currentTarget.contains(a.target) || (a.stopPropagation(), !i.isPressed))
|
|
1017
|
+
return;
|
|
1018
|
+
let c = et(a.nativeEvent, i.activePointerId);
|
|
1019
|
+
c && _(c, a.currentTarget) ? i.isOverTarget || (i.isOverTarget = !0, E(a, i.pointerType)) : i.isOverTarget && (i.isOverTarget = !1, $(a, i.pointerType, !1), g.current.shouldCancelOnPointerExit && T(a));
|
|
1020
|
+
}, v.onTouchEnd = (a) => {
|
|
1021
|
+
if (!a.currentTarget.contains(a.target) || (a.stopPropagation(), !i.isPressed))
|
|
1022
|
+
return;
|
|
1023
|
+
let c = et(a.nativeEvent, i.activePointerId);
|
|
1024
|
+
c && _(c, a.currentTarget) ? (y(a, i.pointerType), $(a, i.pointerType)) : i.isOverTarget && $(a, i.pointerType, !1), i.isPressed = !1, i.activePointerId = null, i.isOverTarget = !1, i.ignoreEmulatedMouseEvents = !0, b || ue(i.target), P();
|
|
1025
|
+
}, v.onTouchCancel = (a) => {
|
|
1026
|
+
!a.currentTarget.contains(a.target) || (a.stopPropagation(), i.isPressed && T(a));
|
|
1027
|
+
};
|
|
1028
|
+
let f = (a) => {
|
|
1029
|
+
i.isPressed && a.target.contains(i.target) && T({
|
|
1030
|
+
currentTarget: i.target,
|
|
1031
|
+
shiftKey: !1,
|
|
1032
|
+
ctrlKey: !1,
|
|
1033
|
+
metaKey: !1,
|
|
1034
|
+
altKey: !1
|
|
1035
|
+
});
|
|
1036
|
+
};
|
|
1037
|
+
v.onDragStart = (a) => {
|
|
1038
|
+
!a.currentTarget.contains(a.target) || T(a);
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
return v;
|
|
1042
|
+
}, [
|
|
1043
|
+
K,
|
|
1044
|
+
u,
|
|
1045
|
+
p,
|
|
1046
|
+
P,
|
|
1047
|
+
b
|
|
1048
|
+
]);
|
|
1049
|
+
return D(() => () => {
|
|
1050
|
+
b || ue(M.current.target);
|
|
1051
|
+
}, [
|
|
1052
|
+
b
|
|
1053
|
+
]), {
|
|
1054
|
+
isPressed: d || L,
|
|
1055
|
+
pressProps: G(m, w)
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
function we(t) {
|
|
1059
|
+
return t.tagName === "A" && t.hasAttribute("href");
|
|
1060
|
+
}
|
|
1061
|
+
function ve(t, e) {
|
|
1062
|
+
const { key: r, code: n } = t, s = e, l = s.getAttribute("role");
|
|
1063
|
+
return (r === "Enter" || r === " " || r === "Spacebar" || n === "Space") && !(s instanceof HTMLInputElement && !Ot(s, r) || s instanceof HTMLTextAreaElement || s.isContentEditable) && (!we(s) || l === "button" && r !== "Enter") && !(l === "link" && r !== "Enter");
|
|
1064
|
+
}
|
|
1065
|
+
function Mr(t) {
|
|
1066
|
+
const { targetTouches: e } = t;
|
|
1067
|
+
return e.length > 0 ? e[0] : null;
|
|
1068
|
+
}
|
|
1069
|
+
function et(t, e) {
|
|
1070
|
+
const r = t.changedTouches;
|
|
1071
|
+
for (let n = 0; n < r.length; n++) {
|
|
1072
|
+
const s = r[n];
|
|
1073
|
+
if (s.identifier === e)
|
|
1074
|
+
return s;
|
|
1075
|
+
}
|
|
1076
|
+
return null;
|
|
1077
|
+
}
|
|
1078
|
+
function N(t, e) {
|
|
1079
|
+
return {
|
|
1080
|
+
currentTarget: t,
|
|
1081
|
+
shiftKey: e.shiftKey,
|
|
1082
|
+
ctrlKey: e.ctrlKey,
|
|
1083
|
+
metaKey: e.metaKey,
|
|
1084
|
+
altKey: e.altKey
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
function Lr(t) {
|
|
1088
|
+
let e = t.width / 2 || t.radiusX || 0, r = t.height / 2 || t.radiusY || 0;
|
|
1089
|
+
return {
|
|
1090
|
+
top: t.clientY - r,
|
|
1091
|
+
right: t.clientX + e,
|
|
1092
|
+
bottom: t.clientY + r,
|
|
1093
|
+
left: t.clientX - e
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
function kr(t, e) {
|
|
1097
|
+
return !(t.left > e.right || e.left > t.right || t.top > e.bottom || e.top > t.bottom);
|
|
1098
|
+
}
|
|
1099
|
+
function _(t, e) {
|
|
1100
|
+
let r = e.getBoundingClientRect(), n = Lr(t);
|
|
1101
|
+
return kr(r, n);
|
|
1102
|
+
}
|
|
1103
|
+
function $e(t) {
|
|
1104
|
+
return !(t instanceof HTMLElement) || !t.draggable;
|
|
1105
|
+
}
|
|
1106
|
+
function tt(t, e) {
|
|
1107
|
+
return t instanceof HTMLInputElement ? !Ot(t, e) : t instanceof HTMLButtonElement ? t.type !== "submit" : !0;
|
|
1108
|
+
}
|
|
1109
|
+
const Cr = /* @__PURE__ */ new Set([
|
|
1110
|
+
"checkbox",
|
|
1111
|
+
"radio",
|
|
1112
|
+
"range",
|
|
1113
|
+
"color",
|
|
1114
|
+
"file",
|
|
1115
|
+
"image",
|
|
1116
|
+
"button",
|
|
1117
|
+
"submit",
|
|
1118
|
+
"reset"
|
|
1119
|
+
]);
|
|
1120
|
+
function Ot(t, e) {
|
|
1121
|
+
return t.type === "checkbox" || t.type === "radio" ? e === " " : Cr.has(t.type);
|
|
1122
|
+
}
|
|
1123
|
+
let le = null, Or = /* @__PURE__ */ new Set(), rt = !1, V = !1, xe = !1;
|
|
1124
|
+
function Ae(t, e) {
|
|
1125
|
+
for (let r of Or)
|
|
1126
|
+
r(t, e);
|
|
1127
|
+
}
|
|
1128
|
+
function Ir(t) {
|
|
1129
|
+
return !(t.metaKey || !ae() && t.altKey || t.ctrlKey || t.key === "Control" || t.key === "Shift" || t.key === "Meta");
|
|
1130
|
+
}
|
|
1131
|
+
function nt(t) {
|
|
1132
|
+
V = !0, Ir(t) && (le = "keyboard", Ae("keyboard", t));
|
|
1133
|
+
}
|
|
1134
|
+
function W(t) {
|
|
1135
|
+
le = "pointer", (t.type === "mousedown" || t.type === "pointerdown") && (V = !0, Ae("pointer", t));
|
|
1136
|
+
}
|
|
1137
|
+
function Dr(t) {
|
|
1138
|
+
Se(t) && (V = !0, le = "virtual");
|
|
1139
|
+
}
|
|
1140
|
+
function Fr(t) {
|
|
1141
|
+
t.target === window || t.target === document || (!V && !xe && (le = "virtual", Ae("virtual", t)), V = !1, xe = !1);
|
|
1142
|
+
}
|
|
1143
|
+
function Ar() {
|
|
1144
|
+
V = !1, xe = !0;
|
|
1145
|
+
}
|
|
1146
|
+
function it() {
|
|
1147
|
+
if (typeof window > "u" || rt)
|
|
1148
|
+
return;
|
|
1149
|
+
let t = HTMLElement.prototype.focus;
|
|
1150
|
+
HTMLElement.prototype.focus = function() {
|
|
1151
|
+
V = !0, t.apply(this, arguments);
|
|
1152
|
+
}, document.addEventListener("keydown", nt, !0), document.addEventListener("keyup", nt, !0), document.addEventListener("click", Dr, !0), window.addEventListener("focus", Fr, !0), window.addEventListener("blur", Ar, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown", W, !0), document.addEventListener("pointermove", W, !0), document.addEventListener("pointerup", W, !0)) : (document.addEventListener("mousedown", W, !0), document.addEventListener("mousemove", W, !0), document.addEventListener("mouseup", W, !0)), rt = !0;
|
|
1153
|
+
}
|
|
1154
|
+
typeof document < "u" && (document.readyState !== "loading" ? it() : document.addEventListener("DOMContentLoaded", it));
|
|
1155
|
+
function Rr() {
|
|
1156
|
+
return le;
|
|
1157
|
+
}
|
|
1158
|
+
const zr = 500;
|
|
1159
|
+
function Nr(t) {
|
|
1160
|
+
let { isDisabled: e, onLongPressStart: r, onLongPressEnd: n, onLongPress: s, threshold: l = zr, accessibilityDescription: u } = t;
|
|
1161
|
+
const d = x(null);
|
|
1162
|
+
let { addGlobalListener: p, removeGlobalListener: h } = De(), { pressProps: b } = Ct({
|
|
1163
|
+
isDisabled: e,
|
|
1164
|
+
onPressStart(m) {
|
|
1165
|
+
if ((m.pointerType === "mouse" || m.pointerType === "touch") && (r && r({
|
|
1166
|
+
...m,
|
|
1167
|
+
type: "longpressstart"
|
|
1168
|
+
}), d.current = setTimeout(() => {
|
|
1169
|
+
m.target.dispatchEvent(new PointerEvent("pointercancel", {
|
|
1170
|
+
bubbles: !0
|
|
1171
|
+
})), s && s({
|
|
1172
|
+
...m,
|
|
1173
|
+
type: "longpress"
|
|
1174
|
+
}), d.current = null;
|
|
1175
|
+
}, l), m.pointerType === "touch")) {
|
|
1176
|
+
let g = (L) => {
|
|
1177
|
+
L.preventDefault();
|
|
1178
|
+
};
|
|
1179
|
+
p(m.target, "contextmenu", g, {
|
|
1180
|
+
once: !0
|
|
1181
|
+
}), p(window, "pointerup", () => {
|
|
1182
|
+
setTimeout(() => {
|
|
1183
|
+
h(m.target, "contextmenu", g);
|
|
1184
|
+
}, 30);
|
|
1185
|
+
}, {
|
|
1186
|
+
once: !0
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
},
|
|
1190
|
+
onPressEnd(m) {
|
|
1191
|
+
d.current && clearTimeout(d.current), n && (m.pointerType === "mouse" || m.pointerType === "touch") && n({
|
|
1192
|
+
...m,
|
|
1193
|
+
type: "longpressend"
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
}), S = $r(s && !e ? u : null);
|
|
1197
|
+
return {
|
|
1198
|
+
longPressProps: G(b, S)
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
function Br(t) {
|
|
1202
|
+
if (!(t instanceof HTMLElement) && !(t instanceof SVGElement))
|
|
1203
|
+
return !1;
|
|
1204
|
+
let { display: e, visibility: r } = t.style, n = e !== "none" && r !== "hidden" && r !== "collapse";
|
|
1205
|
+
if (n) {
|
|
1206
|
+
const { getComputedStyle: s } = t.ownerDocument.defaultView;
|
|
1207
|
+
let { display: l, visibility: u } = s(t);
|
|
1208
|
+
n = l !== "none" && u !== "hidden" && u !== "collapse";
|
|
1209
|
+
}
|
|
1210
|
+
return n;
|
|
1211
|
+
}
|
|
1212
|
+
function Ur(t, e) {
|
|
1213
|
+
return !t.hasAttribute("hidden") && (t.nodeName === "DETAILS" && e && e.nodeName !== "SUMMARY" ? t.hasAttribute("open") : !0);
|
|
1214
|
+
}
|
|
1215
|
+
function It(t, e) {
|
|
1216
|
+
return t.nodeName !== "#comment" && Br(t) && Ur(t, e) && (!t.parentElement || It(t.parentElement, t));
|
|
1217
|
+
}
|
|
1218
|
+
const Re = [
|
|
1219
|
+
"input:not([disabled]):not([type=hidden])",
|
|
1220
|
+
"select:not([disabled])",
|
|
1221
|
+
"textarea:not([disabled])",
|
|
1222
|
+
"button:not([disabled])",
|
|
1223
|
+
"a[href]",
|
|
1224
|
+
"area[href]",
|
|
1225
|
+
"summary",
|
|
1226
|
+
"iframe",
|
|
1227
|
+
"object",
|
|
1228
|
+
"embed",
|
|
1229
|
+
"audio[controls]",
|
|
1230
|
+
"video[controls]",
|
|
1231
|
+
"[contenteditable]"
|
|
1232
|
+
], Vr = Re.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
|
|
1233
|
+
Re.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
|
|
1234
|
+
const Hr = Re.join(':not([hidden]):not([tabindex="-1"]),');
|
|
1235
|
+
function Dt(t, e) {
|
|
1236
|
+
return e.some(
|
|
1237
|
+
(r) => r.contains(t)
|
|
1238
|
+
);
|
|
1239
|
+
}
|
|
1240
|
+
function Gr(t, e, r) {
|
|
1241
|
+
let n = e != null && e.tabbable ? Hr : Vr, s = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, {
|
|
1242
|
+
acceptNode(l) {
|
|
1243
|
+
var u;
|
|
1244
|
+
return !(e == null || (u = e.from) === null || u === void 0) && u.contains(l) ? NodeFilter.FILTER_REJECT : l.matches(n) && It(l) && (!r || Dt(l, r)) && (!(e != null && e.accept) || e.accept(l)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
1245
|
+
}
|
|
1246
|
+
});
|
|
1247
|
+
return e != null && e.from && (s.currentNode = e.from), s;
|
|
1248
|
+
}
|
|
1249
|
+
class ze {
|
|
1250
|
+
get size() {
|
|
1251
|
+
return this.fastMap.size;
|
|
1252
|
+
}
|
|
1253
|
+
getTreeNode(e) {
|
|
1254
|
+
return this.fastMap.get(e);
|
|
1255
|
+
}
|
|
1256
|
+
addTreeNode(e, r, n) {
|
|
1257
|
+
let s = this.fastMap.get(r != null ? r : null), l = new st({
|
|
1258
|
+
scopeRef: e
|
|
1259
|
+
});
|
|
1260
|
+
s.addChild(l), l.parent = s, this.fastMap.set(e, l), n && (l.nodeToRestore = n);
|
|
1261
|
+
}
|
|
1262
|
+
removeTreeNode(e) {
|
|
1263
|
+
if (e === null)
|
|
1264
|
+
return;
|
|
1265
|
+
let r = this.fastMap.get(e), n = r.parent;
|
|
1266
|
+
for (let l of this.traverse())
|
|
1267
|
+
l !== r && r.nodeToRestore && l.nodeToRestore && r.scopeRef.current && Dt(l.nodeToRestore, r.scopeRef.current) && (l.nodeToRestore = r.nodeToRestore);
|
|
1268
|
+
let s = r.children;
|
|
1269
|
+
n.removeChild(r), s.length > 0 && s.forEach(
|
|
1270
|
+
(l) => n.addChild(l)
|
|
1271
|
+
), this.fastMap.delete(r.scopeRef);
|
|
1272
|
+
}
|
|
1273
|
+
*traverse(e = this.root) {
|
|
1274
|
+
if (e.scopeRef != null && (yield e), e.children.length > 0)
|
|
1275
|
+
for (let r of e.children)
|
|
1276
|
+
yield* this.traverse(r);
|
|
1277
|
+
}
|
|
1278
|
+
clone() {
|
|
1279
|
+
let e = new ze();
|
|
1280
|
+
for (let r of this.traverse())
|
|
1281
|
+
e.addTreeNode(r.scopeRef, r.parent.scopeRef, r.nodeToRestore);
|
|
1282
|
+
return e;
|
|
1283
|
+
}
|
|
1284
|
+
constructor() {
|
|
1285
|
+
this.fastMap = /* @__PURE__ */ new Map(), this.root = new st({
|
|
1286
|
+
scopeRef: null
|
|
1287
|
+
}), this.fastMap.set(null, this.root);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
class st {
|
|
1291
|
+
addChild(e) {
|
|
1292
|
+
this.children.push(e), e.parent = this;
|
|
1293
|
+
}
|
|
1294
|
+
removeChild(e) {
|
|
1295
|
+
this.children.splice(this.children.indexOf(e), 1), e.parent = void 0;
|
|
1296
|
+
}
|
|
1297
|
+
constructor(e) {
|
|
1298
|
+
this.children = [], this.contain = !1, this.scopeRef = e.scopeRef;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
new ze();
|
|
1302
|
+
function Ft(t) {
|
|
1303
|
+
if (Rr() === "virtual") {
|
|
1304
|
+
let e = document.activeElement;
|
|
1305
|
+
Ie(() => {
|
|
1306
|
+
document.activeElement === e && document.contains(t) && I(t);
|
|
1307
|
+
});
|
|
1308
|
+
} else
|
|
1309
|
+
I(t);
|
|
1310
|
+
}
|
|
1311
|
+
function _r(t) {
|
|
1312
|
+
if (!(t instanceof HTMLElement) && !(t instanceof SVGElement))
|
|
1313
|
+
return !1;
|
|
1314
|
+
let { display: e, visibility: r } = t.style, n = e !== "none" && r !== "hidden" && r !== "collapse";
|
|
1315
|
+
if (n) {
|
|
1316
|
+
const { getComputedStyle: s } = t.ownerDocument.defaultView;
|
|
1317
|
+
let { display: l, visibility: u } = s(t);
|
|
1318
|
+
n = l !== "none" && u !== "hidden" && u !== "collapse";
|
|
1319
|
+
}
|
|
1320
|
+
return n;
|
|
1321
|
+
}
|
|
1322
|
+
function Wr(t, e) {
|
|
1323
|
+
return !t.hasAttribute("hidden") && (t.nodeName === "DETAILS" && e && e.nodeName !== "SUMMARY" ? t.hasAttribute("open") : !0);
|
|
1324
|
+
}
|
|
1325
|
+
function At(t, e) {
|
|
1326
|
+
return t.nodeName !== "#comment" && _r(t) && Wr(t, e) && (!t.parentElement || At(t.parentElement, t));
|
|
1327
|
+
}
|
|
1328
|
+
const Ne = [
|
|
1329
|
+
"input:not([disabled]):not([type=hidden])",
|
|
1330
|
+
"select:not([disabled])",
|
|
1331
|
+
"textarea:not([disabled])",
|
|
1332
|
+
"button:not([disabled])",
|
|
1333
|
+
"a[href]",
|
|
1334
|
+
"area[href]",
|
|
1335
|
+
"summary",
|
|
1336
|
+
"iframe",
|
|
1337
|
+
"object",
|
|
1338
|
+
"embed",
|
|
1339
|
+
"audio[controls]",
|
|
1340
|
+
"video[controls]",
|
|
1341
|
+
"[contenteditable]"
|
|
1342
|
+
], jr = Ne.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
|
|
1343
|
+
Ne.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
|
|
1344
|
+
const Yr = Ne.join(':not([hidden]):not([tabindex="-1"]),');
|
|
1345
|
+
function Rt(t, e) {
|
|
1346
|
+
return e.some(
|
|
1347
|
+
(r) => r.contains(t)
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1350
|
+
function Xr(t, e, r) {
|
|
1351
|
+
let n = e != null && e.tabbable ? Yr : jr, s = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, {
|
|
1352
|
+
acceptNode(l) {
|
|
1353
|
+
var u;
|
|
1354
|
+
return !(e == null || (u = e.from) === null || u === void 0) && u.contains(l) ? NodeFilter.FILTER_REJECT : l.matches(n) && At(l) && (!r || Rt(l, r)) && (!(e != null && e.accept) || e.accept(l)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1357
|
+
return e != null && e.from && (s.currentNode = e.from), s;
|
|
1358
|
+
}
|
|
1359
|
+
class Be {
|
|
1360
|
+
get size() {
|
|
1361
|
+
return this.fastMap.size;
|
|
1362
|
+
}
|
|
1363
|
+
getTreeNode(e) {
|
|
1364
|
+
return this.fastMap.get(e);
|
|
1365
|
+
}
|
|
1366
|
+
addTreeNode(e, r, n) {
|
|
1367
|
+
let s = this.fastMap.get(r != null ? r : null), l = new at({
|
|
1368
|
+
scopeRef: e
|
|
1369
|
+
});
|
|
1370
|
+
s.addChild(l), l.parent = s, this.fastMap.set(e, l), n && (l.nodeToRestore = n);
|
|
1371
|
+
}
|
|
1372
|
+
removeTreeNode(e) {
|
|
1373
|
+
if (e === null)
|
|
1374
|
+
return;
|
|
1375
|
+
let r = this.fastMap.get(e), n = r.parent;
|
|
1376
|
+
for (let l of this.traverse())
|
|
1377
|
+
l !== r && r.nodeToRestore && l.nodeToRestore && r.scopeRef.current && Rt(l.nodeToRestore, r.scopeRef.current) && (l.nodeToRestore = r.nodeToRestore);
|
|
1378
|
+
let s = r.children;
|
|
1379
|
+
n.removeChild(r), s.length > 0 && s.forEach(
|
|
1380
|
+
(l) => n.addChild(l)
|
|
1381
|
+
), this.fastMap.delete(r.scopeRef);
|
|
1382
|
+
}
|
|
1383
|
+
*traverse(e = this.root) {
|
|
1384
|
+
if (e.scopeRef != null && (yield e), e.children.length > 0)
|
|
1385
|
+
for (let r of e.children)
|
|
1386
|
+
yield* this.traverse(r);
|
|
1387
|
+
}
|
|
1388
|
+
clone() {
|
|
1389
|
+
let e = new Be();
|
|
1390
|
+
for (let r of this.traverse())
|
|
1391
|
+
e.addTreeNode(r.scopeRef, r.parent.scopeRef, r.nodeToRestore);
|
|
1392
|
+
return e;
|
|
1393
|
+
}
|
|
1394
|
+
constructor() {
|
|
1395
|
+
this.fastMap = /* @__PURE__ */ new Map(), this.root = new at({
|
|
1396
|
+
scopeRef: null
|
|
1397
|
+
}), this.fastMap.set(null, this.root);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
class at {
|
|
1401
|
+
addChild(e) {
|
|
1402
|
+
this.children.push(e), e.parent = this;
|
|
1403
|
+
}
|
|
1404
|
+
removeChild(e) {
|
|
1405
|
+
this.children.splice(this.children.indexOf(e), 1), e.parent = void 0;
|
|
1406
|
+
}
|
|
1407
|
+
constructor(e) {
|
|
1408
|
+
this.children = [], this.contain = !1, this.scopeRef = e.scopeRef;
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
new Be();
|
|
1412
|
+
function zt(t) {
|
|
1413
|
+
return Pr() ? t.altKey : t.ctrlKey;
|
|
1414
|
+
}
|
|
1415
|
+
function q(t) {
|
|
1416
|
+
return ae() ? t.metaKey : t.ctrlKey;
|
|
1417
|
+
}
|
|
1418
|
+
function qr(t) {
|
|
1419
|
+
let { keyboardDelegate: e, selectionManager: r, onTypeSelect: n } = t, s = x({
|
|
1420
|
+
search: "",
|
|
1421
|
+
timeout: null
|
|
1422
|
+
}).current, l = (u) => {
|
|
1423
|
+
let d = Jr(u.key);
|
|
1424
|
+
if (!d || u.ctrlKey || u.metaKey)
|
|
1425
|
+
return;
|
|
1426
|
+
d === " " && s.search.trim().length > 0 && (u.preventDefault(), "continuePropagation" in u || u.stopPropagation()), s.search += d;
|
|
1427
|
+
let p = e.getKeyForSearch(s.search, r.focusedKey);
|
|
1428
|
+
p == null && (p = e.getKeyForSearch(s.search)), p != null && (r.setFocusedKey(p), n && n(p)), clearTimeout(s.timeout), s.timeout = setTimeout(() => {
|
|
1429
|
+
s.search = "";
|
|
1430
|
+
}, 500);
|
|
1431
|
+
};
|
|
1432
|
+
return {
|
|
1433
|
+
typeSelectProps: {
|
|
1434
|
+
onKeyDownCapture: e.getKeyForSearch ? l : null
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
}
|
|
1438
|
+
function Jr(t) {
|
|
1439
|
+
return t.length === 1 || !/^[A-Z]/i.test(t) ? t : "";
|
|
1440
|
+
}
|
|
1441
|
+
function Zr(t) {
|
|
1442
|
+
let { selectionManager: e, keyboardDelegate: r, ref: n, autoFocus: s = !1, shouldFocusWrap: l = !1, disallowEmptySelection: u = !1, disallowSelectAll: d = !1, selectOnFocus: p = e.selectionBehavior === "replace", disallowTypeAhead: h = !1, shouldUseVirtualFocus: b, allowsTabNavigation: S = !1, isVirtualized: m, scrollRef: g = n } = t, { direction: L } = Kt(), k = (y) => {
|
|
1443
|
+
if (y.altKey && y.key === "Tab" && y.preventDefault(), !n.current.contains(y.target))
|
|
1444
|
+
return;
|
|
1445
|
+
const T = (a, c) => {
|
|
1446
|
+
a != null && (e.setFocusedKey(a, c), y.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(a) : p && !zt(y) && e.replaceSelection(a));
|
|
1447
|
+
};
|
|
1448
|
+
switch (y.key) {
|
|
1449
|
+
case "ArrowDown":
|
|
1450
|
+
if (r.getKeyBelow) {
|
|
1451
|
+
var v, C;
|
|
1452
|
+
y.preventDefault();
|
|
1453
|
+
let a = e.focusedKey != null ? r.getKeyBelow(e.focusedKey) : (v = r.getFirstKey) === null || v === void 0 ? void 0 : v.call(r);
|
|
1454
|
+
a == null && l && (a = (C = r.getFirstKey) === null || C === void 0 ? void 0 : C.call(r, e.focusedKey)), T(a);
|
|
1455
|
+
}
|
|
1456
|
+
break;
|
|
1457
|
+
case "ArrowUp":
|
|
1458
|
+
if (r.getKeyAbove) {
|
|
1459
|
+
var o, f;
|
|
1460
|
+
y.preventDefault();
|
|
1461
|
+
let a = e.focusedKey != null ? r.getKeyAbove(e.focusedKey) : (o = r.getLastKey) === null || o === void 0 ? void 0 : o.call(r);
|
|
1462
|
+
a == null && l && (a = (f = r.getLastKey) === null || f === void 0 ? void 0 : f.call(r, e.focusedKey)), T(a);
|
|
1463
|
+
}
|
|
1464
|
+
break;
|
|
1465
|
+
case "ArrowLeft":
|
|
1466
|
+
if (r.getKeyLeftOf) {
|
|
1467
|
+
y.preventDefault();
|
|
1468
|
+
let a = r.getKeyLeftOf(e.focusedKey);
|
|
1469
|
+
T(a, L === "rtl" ? "first" : "last");
|
|
1470
|
+
}
|
|
1471
|
+
break;
|
|
1472
|
+
case "ArrowRight":
|
|
1473
|
+
if (r.getKeyRightOf) {
|
|
1474
|
+
y.preventDefault();
|
|
1475
|
+
let a = r.getKeyRightOf(e.focusedKey);
|
|
1476
|
+
T(a, L === "rtl" ? "last" : "first");
|
|
1477
|
+
}
|
|
1478
|
+
break;
|
|
1479
|
+
case "Home":
|
|
1480
|
+
if (r.getFirstKey) {
|
|
1481
|
+
y.preventDefault();
|
|
1482
|
+
let a = r.getFirstKey(e.focusedKey, q(y));
|
|
1483
|
+
e.setFocusedKey(a), q(y) && y.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(a) : p && e.replaceSelection(a);
|
|
1484
|
+
}
|
|
1485
|
+
break;
|
|
1486
|
+
case "End":
|
|
1487
|
+
if (r.getLastKey) {
|
|
1488
|
+
y.preventDefault();
|
|
1489
|
+
let a = r.getLastKey(e.focusedKey, q(y));
|
|
1490
|
+
e.setFocusedKey(a), q(y) && y.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(a) : p && e.replaceSelection(a);
|
|
1491
|
+
}
|
|
1492
|
+
break;
|
|
1493
|
+
case "PageDown":
|
|
1494
|
+
if (r.getKeyPageBelow) {
|
|
1495
|
+
y.preventDefault();
|
|
1496
|
+
let a = r.getKeyPageBelow(e.focusedKey);
|
|
1497
|
+
T(a);
|
|
1498
|
+
}
|
|
1499
|
+
break;
|
|
1500
|
+
case "PageUp":
|
|
1501
|
+
if (r.getKeyPageAbove) {
|
|
1502
|
+
y.preventDefault();
|
|
1503
|
+
let a = r.getKeyPageAbove(e.focusedKey);
|
|
1504
|
+
T(a);
|
|
1505
|
+
}
|
|
1506
|
+
break;
|
|
1507
|
+
case "a":
|
|
1508
|
+
q(y) && e.selectionMode === "multiple" && d !== !0 && (y.preventDefault(), e.selectAll());
|
|
1509
|
+
break;
|
|
1510
|
+
case "Escape":
|
|
1511
|
+
y.preventDefault(), u || e.clearSelection();
|
|
1512
|
+
break;
|
|
1513
|
+
case "Tab":
|
|
1514
|
+
if (!S) {
|
|
1515
|
+
if (y.shiftKey)
|
|
1516
|
+
n.current.focus();
|
|
1517
|
+
else {
|
|
1518
|
+
let a = Xr(n.current, {
|
|
1519
|
+
tabbable: !0
|
|
1520
|
+
}), c, O;
|
|
1521
|
+
do
|
|
1522
|
+
O = a.lastChild(), O && (c = O);
|
|
1523
|
+
while (O);
|
|
1524
|
+
c && !c.contains(document.activeElement) && I(c);
|
|
1525
|
+
}
|
|
1526
|
+
break;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
}, M = x({
|
|
1530
|
+
top: 0,
|
|
1531
|
+
left: 0
|
|
1532
|
+
});
|
|
1533
|
+
Er(g, "scroll", m ? null : () => {
|
|
1534
|
+
M.current = {
|
|
1535
|
+
top: g.current.scrollTop,
|
|
1536
|
+
left: g.current.scrollLeft
|
|
1537
|
+
};
|
|
1538
|
+
});
|
|
1539
|
+
let K = (y) => {
|
|
1540
|
+
if (e.isFocused) {
|
|
1541
|
+
y.currentTarget.contains(y.target) || e.setFocused(!1);
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
if (!!y.currentTarget.contains(y.target)) {
|
|
1545
|
+
if (e.setFocused(!0), e.focusedKey == null) {
|
|
1546
|
+
let C = (f) => {
|
|
1547
|
+
f != null && (e.setFocusedKey(f), p && e.replaceSelection(f));
|
|
1548
|
+
}, o = y.relatedTarget;
|
|
1549
|
+
var T, v;
|
|
1550
|
+
o && y.currentTarget.compareDocumentPosition(o) & Node.DOCUMENT_POSITION_FOLLOWING ? C((T = e.lastSelectedKey) !== null && T !== void 0 ? T : r.getLastKey()) : C((v = e.firstSelectedKey) !== null && v !== void 0 ? v : r.getFirstKey());
|
|
1551
|
+
} else if (!m) {
|
|
1552
|
+
g.current.scrollTop = M.current.top, g.current.scrollLeft = M.current.left;
|
|
1553
|
+
let C = g.current.querySelector(`[data-key="${e.focusedKey}"]`);
|
|
1554
|
+
C && (I(C), Je(g.current, C));
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
}, P = (y) => {
|
|
1558
|
+
y.currentTarget.contains(y.relatedTarget) || e.setFocused(!1);
|
|
1559
|
+
};
|
|
1560
|
+
const w = x(s);
|
|
1561
|
+
D(() => {
|
|
1562
|
+
if (w.current) {
|
|
1563
|
+
let y = null;
|
|
1564
|
+
s === "first" && (y = r.getFirstKey()), s === "last" && (y = r.getLastKey());
|
|
1565
|
+
let T = e.selectedKeys;
|
|
1566
|
+
T.size && (y = T.values().next().value), e.setFocused(!0), e.setFocusedKey(y), y == null && !b && Ft(n.current);
|
|
1567
|
+
}
|
|
1568
|
+
w.current = !1;
|
|
1569
|
+
}, []), D(() => {
|
|
1570
|
+
if (!m && e.focusedKey && (g == null ? void 0 : g.current)) {
|
|
1571
|
+
let y = g.current.querySelector(`[data-key="${e.focusedKey}"]`);
|
|
1572
|
+
y && Je(g.current, y);
|
|
1573
|
+
}
|
|
1574
|
+
}, [
|
|
1575
|
+
m,
|
|
1576
|
+
g,
|
|
1577
|
+
e.focusedKey
|
|
1578
|
+
]);
|
|
1579
|
+
let i = {
|
|
1580
|
+
onKeyDown: k,
|
|
1581
|
+
onFocus: K,
|
|
1582
|
+
onBlur: P,
|
|
1583
|
+
onMouseDown(y) {
|
|
1584
|
+
y.currentTarget.contains(y.target) && y.preventDefault();
|
|
1585
|
+
}
|
|
1586
|
+
}, { typeSelectProps: E } = qr({
|
|
1587
|
+
keyboardDelegate: r,
|
|
1588
|
+
selectionManager: e
|
|
1589
|
+
});
|
|
1590
|
+
h || (i = G(E, i));
|
|
1591
|
+
let $;
|
|
1592
|
+
return b || ($ = e.focusedKey == null ? 0 : -1), {
|
|
1593
|
+
collectionProps: {
|
|
1594
|
+
...i,
|
|
1595
|
+
tabIndex: $
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
function Qr(t) {
|
|
1600
|
+
let { selectionManager: e, key: r, ref: n, shouldSelectOnPressUp: s, isVirtualized: l, shouldUseVirtualFocus: u, focus: d, isDisabled: p, onAction: h, allowsDifferentPressOrigin: b } = t, S = (f) => {
|
|
1601
|
+
if (f.pointerType === "keyboard" && zt(f))
|
|
1602
|
+
e.toggleSelection(r);
|
|
1603
|
+
else {
|
|
1604
|
+
if (e.selectionMode === "none")
|
|
1605
|
+
return;
|
|
1606
|
+
e.selectionMode === "single" ? e.isSelected(r) && !e.disallowEmptySelection ? e.toggleSelection(r) : e.replaceSelection(r) : f && f.shiftKey ? e.extendSelection(r) : e.selectionBehavior === "toggle" || f && (q(f) || f.pointerType === "touch" || f.pointerType === "virtual") ? e.toggleSelection(r) : e.replaceSelection(r);
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
D(() => {
|
|
1610
|
+
r === e.focusedKey && e.isFocused && !u && document.activeElement !== n.current && (d ? d() : Ft(n.current));
|
|
1611
|
+
}, [
|
|
1612
|
+
n,
|
|
1613
|
+
r,
|
|
1614
|
+
e.focusedKey,
|
|
1615
|
+
e.childFocusStrategy,
|
|
1616
|
+
e.isFocused,
|
|
1617
|
+
u
|
|
1618
|
+
]);
|
|
1619
|
+
let m = {};
|
|
1620
|
+
u || (m = {
|
|
1621
|
+
tabIndex: r === e.focusedKey ? 0 : -1,
|
|
1622
|
+
onFocus(f) {
|
|
1623
|
+
f.target === n.current && e.setFocusedKey(r);
|
|
1624
|
+
}
|
|
1625
|
+
}), p = p || e.isDisabled(r);
|
|
1626
|
+
let g = !p && e.canSelectItem(r), L = h && !p, k = L && (e.selectionBehavior === "replace" ? !g : e.isEmpty), M = L && g && e.selectionBehavior === "replace", K = k || M, P = x(null), w = K && g, i = x(!1), E = x(!1), $ = {};
|
|
1627
|
+
s ? ($.onPressStart = (f) => {
|
|
1628
|
+
P.current = f.pointerType, i.current = w, f.pointerType === "keyboard" && (!K || lt()) && S(f);
|
|
1629
|
+
}, b ? ($.onPressUp = (f) => {
|
|
1630
|
+
f.pointerType !== "keyboard" && S(f);
|
|
1631
|
+
}, $.onPress = k ? () => h() : null) : $.onPress = (f) => {
|
|
1632
|
+
if (k || M && f.pointerType !== "mouse") {
|
|
1633
|
+
if (f.pointerType === "keyboard" && !ot())
|
|
1634
|
+
return;
|
|
1635
|
+
h();
|
|
1636
|
+
} else
|
|
1637
|
+
f.pointerType !== "keyboard" && S(f);
|
|
1638
|
+
}) : ($.onPressStart = (f) => {
|
|
1639
|
+
P.current = f.pointerType, i.current = w, E.current = k, (f.pointerType === "mouse" && !k || f.pointerType === "keyboard" && (!h || lt())) && S(f);
|
|
1640
|
+
}, $.onPress = (f) => {
|
|
1641
|
+
(f.pointerType === "touch" || f.pointerType === "pen" || f.pointerType === "virtual" || f.pointerType === "keyboard" && K && ot() || f.pointerType === "mouse" && E.current) && (K ? h() : S(f));
|
|
1642
|
+
}), l || (m["data-key"] = r), $.preventFocusOnPress = u;
|
|
1643
|
+
let { pressProps: y, isPressed: T } = Ct($), v = M ? (f) => {
|
|
1644
|
+
P.current === "mouse" && (f.stopPropagation(), f.preventDefault(), h());
|
|
1645
|
+
} : void 0, { longPressProps: C } = Nr({
|
|
1646
|
+
isDisabled: !w,
|
|
1647
|
+
onLongPress(f) {
|
|
1648
|
+
f.pointerType === "touch" && (S(f), e.setSelectionBehavior("toggle"));
|
|
1649
|
+
}
|
|
1650
|
+
});
|
|
1651
|
+
return {
|
|
1652
|
+
itemProps: G(m, g || k ? y : {}, w ? C : {}, {
|
|
1653
|
+
onDoubleClick: v,
|
|
1654
|
+
onDragStart: (f) => {
|
|
1655
|
+
P.current === "touch" && i.current && f.preventDefault();
|
|
1656
|
+
}
|
|
1657
|
+
}),
|
|
1658
|
+
isPressed: T,
|
|
1659
|
+
isSelected: e.isSelected(r),
|
|
1660
|
+
isDisabled: p,
|
|
1661
|
+
allowsSelection: g,
|
|
1662
|
+
hasAction: K
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
function ot() {
|
|
1666
|
+
let t = window.event;
|
|
1667
|
+
return (t == null ? void 0 : t.key) === "Enter";
|
|
1668
|
+
}
|
|
1669
|
+
function lt() {
|
|
1670
|
+
let t = window.event;
|
|
1671
|
+
return (t == null ? void 0 : t.key) === " " || (t == null ? void 0 : t.code) === "Space";
|
|
1672
|
+
}
|
|
1673
|
+
let Z = "default", Me = "", pe = /* @__PURE__ */ new WeakMap();
|
|
1674
|
+
function ct(t) {
|
|
1675
|
+
oe() ? (Z === "default" && (Me = document.documentElement.style.webkitUserSelect, document.documentElement.style.webkitUserSelect = "none"), Z = "disabled") : (t instanceof HTMLElement || t instanceof SVGElement) && (pe.set(t, t.style.userSelect), t.style.userSelect = "none");
|
|
1676
|
+
}
|
|
1677
|
+
function fe(t) {
|
|
1678
|
+
if (oe()) {
|
|
1679
|
+
if (Z !== "disabled")
|
|
1680
|
+
return;
|
|
1681
|
+
Z = "restoring", setTimeout(() => {
|
|
1682
|
+
Ie(() => {
|
|
1683
|
+
Z === "restoring" && (document.documentElement.style.webkitUserSelect === "none" && (document.documentElement.style.webkitUserSelect = Me || ""), Me = "", Z = "default");
|
|
1684
|
+
});
|
|
1685
|
+
}, 300);
|
|
1686
|
+
} else if ((t instanceof HTMLElement || t instanceof SVGElement) && t && pe.has(t)) {
|
|
1687
|
+
let e = pe.get(t);
|
|
1688
|
+
t.style.userSelect === "none" && (t.style.userSelect = e), t.getAttribute("style") === "" && t.removeAttribute("style"), pe.delete(t);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
function Le(t) {
|
|
1692
|
+
return t.mozInputSource === 0 && t.isTrusted ? !0 : t.detail === 0 && !t.pointerType;
|
|
1693
|
+
}
|
|
1694
|
+
const Nt = Q.createContext(null);
|
|
1695
|
+
Nt.displayName = "PressResponderContext";
|
|
1696
|
+
function en(t) {
|
|
1697
|
+
let e = se(Nt);
|
|
1698
|
+
if (e) {
|
|
1699
|
+
let { register: r, ...n } = e;
|
|
1700
|
+
t = G(n, t), r();
|
|
1701
|
+
}
|
|
1702
|
+
return Lt(e, t.ref), t;
|
|
1703
|
+
}
|
|
1704
|
+
function tn(t) {
|
|
1705
|
+
let {
|
|
1706
|
+
onPress: e,
|
|
1707
|
+
onPressChange: r,
|
|
1708
|
+
onPressStart: n,
|
|
1709
|
+
onPressEnd: s,
|
|
1710
|
+
onPressUp: l,
|
|
1711
|
+
isDisabled: u,
|
|
1712
|
+
isPressed: d,
|
|
1713
|
+
preventFocusOnPress: p,
|
|
1714
|
+
shouldCancelOnPointerExit: h,
|
|
1715
|
+
allowTextSelectionOnPress: b,
|
|
1716
|
+
ref: S,
|
|
1717
|
+
...m
|
|
1718
|
+
} = en(t), g = x(null);
|
|
1719
|
+
g.current = {
|
|
1720
|
+
onPress: e,
|
|
1721
|
+
onPressChange: r,
|
|
1722
|
+
onPressStart: n,
|
|
1723
|
+
onPressEnd: s,
|
|
1724
|
+
onPressUp: l,
|
|
1725
|
+
isDisabled: u,
|
|
1726
|
+
shouldCancelOnPointerExit: h
|
|
1727
|
+
};
|
|
1728
|
+
let [L, k] = A(!1), M = x({
|
|
1729
|
+
isPressed: !1,
|
|
1730
|
+
ignoreEmulatedMouseEvents: !1,
|
|
1731
|
+
ignoreClickAfterPress: !1,
|
|
1732
|
+
didFirePressStart: !1,
|
|
1733
|
+
activePointerId: null,
|
|
1734
|
+
target: null,
|
|
1735
|
+
isOverTarget: !1,
|
|
1736
|
+
pointerType: null
|
|
1737
|
+
}), { addGlobalListener: K, removeAllGlobalListeners: P } = De(), w = z(() => {
|
|
1738
|
+
let i = M.current, E = (o, f) => {
|
|
1739
|
+
let { onPressStart: a, onPressChange: c, isDisabled: O } = g.current;
|
|
1740
|
+
O || i.didFirePressStart || (a && a({
|
|
1741
|
+
type: "pressstart",
|
|
1742
|
+
pointerType: f,
|
|
1743
|
+
target: o.currentTarget,
|
|
1744
|
+
shiftKey: o.shiftKey,
|
|
1745
|
+
metaKey: o.metaKey,
|
|
1746
|
+
ctrlKey: o.ctrlKey,
|
|
1747
|
+
altKey: o.altKey
|
|
1748
|
+
}), c && c(!0), i.didFirePressStart = !0, k(!0));
|
|
1749
|
+
}, $ = (o, f, a = !0) => {
|
|
1750
|
+
let { onPressEnd: c, onPressChange: O, onPress: ee, isDisabled: be } = g.current;
|
|
1751
|
+
!i.didFirePressStart || (i.ignoreClickAfterPress = !0, i.didFirePressStart = !1, c && c({
|
|
1752
|
+
type: "pressend",
|
|
1753
|
+
pointerType: f,
|
|
1754
|
+
target: o.currentTarget,
|
|
1755
|
+
shiftKey: o.shiftKey,
|
|
1756
|
+
metaKey: o.metaKey,
|
|
1757
|
+
ctrlKey: o.ctrlKey,
|
|
1758
|
+
altKey: o.altKey
|
|
1759
|
+
}), O && O(!1), k(!1), ee && a && !be && ee({
|
|
1760
|
+
type: "press",
|
|
1761
|
+
pointerType: f,
|
|
1762
|
+
target: o.currentTarget,
|
|
1763
|
+
shiftKey: o.shiftKey,
|
|
1764
|
+
metaKey: o.metaKey,
|
|
1765
|
+
ctrlKey: o.ctrlKey,
|
|
1766
|
+
altKey: o.altKey
|
|
1767
|
+
}));
|
|
1768
|
+
}, y = (o, f) => {
|
|
1769
|
+
let { onPressUp: a, isDisabled: c } = g.current;
|
|
1770
|
+
c || a && a({
|
|
1771
|
+
type: "pressup",
|
|
1772
|
+
pointerType: f,
|
|
1773
|
+
target: o.currentTarget,
|
|
1774
|
+
shiftKey: o.shiftKey,
|
|
1775
|
+
metaKey: o.metaKey,
|
|
1776
|
+
ctrlKey: o.ctrlKey,
|
|
1777
|
+
altKey: o.altKey
|
|
1778
|
+
});
|
|
1779
|
+
}, T = (o) => {
|
|
1780
|
+
i.isPressed && (i.isOverTarget && $(B(i.target, o), i.pointerType, !1), i.isPressed = !1, i.isOverTarget = !1, i.activePointerId = null, i.pointerType = null, P(), b || fe(i.target));
|
|
1781
|
+
}, v = {
|
|
1782
|
+
onKeyDown(o) {
|
|
1783
|
+
me(o.nativeEvent, o.currentTarget) && o.currentTarget.contains(o.target) ? (ft(o.target, o.key) && o.preventDefault(), o.stopPropagation(), !i.isPressed && !o.repeat && (i.target = o.currentTarget, i.isPressed = !0, E(o, "keyboard"), K(document, "keyup", C, !1))) : o.key === "Enter" && ke(o.currentTarget) && o.stopPropagation();
|
|
1784
|
+
},
|
|
1785
|
+
onKeyUp(o) {
|
|
1786
|
+
me(o.nativeEvent, o.currentTarget) && !o.repeat && o.currentTarget.contains(o.target) && y(B(i.target, o), "keyboard");
|
|
1787
|
+
},
|
|
1788
|
+
onClick(o) {
|
|
1789
|
+
o && !o.currentTarget.contains(o.target) || o && o.button === 0 && (o.stopPropagation(), u && o.preventDefault(), !i.ignoreClickAfterPress && !i.ignoreEmulatedMouseEvents && (i.pointerType === "virtual" || Le(o.nativeEvent)) && (!u && !p && I(o.currentTarget), E(o, "virtual"), y(o, "virtual"), $(o, "virtual")), i.ignoreEmulatedMouseEvents = !1, i.ignoreClickAfterPress = !1);
|
|
1790
|
+
}
|
|
1791
|
+
}, C = (o) => {
|
|
1792
|
+
if (i.isPressed && me(o, i.target)) {
|
|
1793
|
+
ft(o.target, o.key) && o.preventDefault(), o.stopPropagation(), i.isPressed = !1;
|
|
1794
|
+
let f = o.target;
|
|
1795
|
+
$(B(i.target, o), "keyboard", i.target.contains(f)), P(), i.target instanceof HTMLElement && i.target.contains(f) && (ke(i.target) || i.target.getAttribute("role") === "link") && i.target.click();
|
|
1796
|
+
}
|
|
1797
|
+
};
|
|
1798
|
+
if (typeof PointerEvent < "u") {
|
|
1799
|
+
v.onPointerDown = (c) => {
|
|
1800
|
+
if (!(c.button !== 0 || !c.currentTarget.contains(c.target))) {
|
|
1801
|
+
if (on(c.nativeEvent)) {
|
|
1802
|
+
i.pointerType = "virtual";
|
|
1803
|
+
return;
|
|
1804
|
+
}
|
|
1805
|
+
Te(c.currentTarget) && c.preventDefault(), i.pointerType = c.pointerType, c.stopPropagation(), i.isPressed || (i.isPressed = !0, i.isOverTarget = !0, i.activePointerId = c.pointerId, i.target = c.currentTarget, !u && !p && I(c.currentTarget), b || ct(i.target), E(c, i.pointerType), K(document, "pointermove", o, !1), K(document, "pointerup", f, !1), K(document, "pointercancel", a, !1));
|
|
1806
|
+
}
|
|
1807
|
+
}, v.onMouseDown = (c) => {
|
|
1808
|
+
!c.currentTarget.contains(c.target) || c.button === 0 && (Te(c.currentTarget) && c.preventDefault(), c.stopPropagation());
|
|
1809
|
+
}, v.onPointerUp = (c) => {
|
|
1810
|
+
!c.currentTarget.contains(c.target) || i.pointerType === "virtual" || c.button === 0 && j(c, c.currentTarget) && y(c, i.pointerType || c.pointerType);
|
|
1811
|
+
};
|
|
1812
|
+
let o = (c) => {
|
|
1813
|
+
c.pointerId === i.activePointerId && (j(c, i.target) ? i.isOverTarget || (i.isOverTarget = !0, E(B(i.target, c), i.pointerType)) : i.isOverTarget && (i.isOverTarget = !1, $(B(i.target, c), i.pointerType, !1), g.current.shouldCancelOnPointerExit && T(c)));
|
|
1814
|
+
}, f = (c) => {
|
|
1815
|
+
c.pointerId === i.activePointerId && i.isPressed && c.button === 0 && (j(c, i.target) ? $(B(i.target, c), i.pointerType) : i.isOverTarget && $(B(i.target, c), i.pointerType, !1), i.isPressed = !1, i.isOverTarget = !1, i.activePointerId = null, i.pointerType = null, P(), b || fe(i.target));
|
|
1816
|
+
}, a = (c) => {
|
|
1817
|
+
T(c);
|
|
1818
|
+
};
|
|
1819
|
+
v.onDragStart = (c) => {
|
|
1820
|
+
!c.currentTarget.contains(c.target) || T(c);
|
|
1821
|
+
};
|
|
1822
|
+
} else {
|
|
1823
|
+
v.onMouseDown = (a) => {
|
|
1824
|
+
a.button !== 0 || !a.currentTarget.contains(a.target) || (Te(a.currentTarget) && a.preventDefault(), a.stopPropagation(), !i.ignoreEmulatedMouseEvents && (i.isPressed = !0, i.isOverTarget = !0, i.target = a.currentTarget, i.pointerType = Le(a.nativeEvent) ? "virtual" : "mouse", !u && !p && I(a.currentTarget), E(a, i.pointerType), K(document, "mouseup", o, !1)));
|
|
1825
|
+
}, v.onMouseEnter = (a) => {
|
|
1826
|
+
!a.currentTarget.contains(a.target) || (a.stopPropagation(), i.isPressed && !i.ignoreEmulatedMouseEvents && (i.isOverTarget = !0, E(a, i.pointerType)));
|
|
1827
|
+
}, v.onMouseLeave = (a) => {
|
|
1828
|
+
!a.currentTarget.contains(a.target) || (a.stopPropagation(), i.isPressed && !i.ignoreEmulatedMouseEvents && (i.isOverTarget = !1, $(a, i.pointerType, !1), g.current.shouldCancelOnPointerExit && T(a)));
|
|
1829
|
+
}, v.onMouseUp = (a) => {
|
|
1830
|
+
!a.currentTarget.contains(a.target) || !i.ignoreEmulatedMouseEvents && a.button === 0 && y(a, i.pointerType);
|
|
1831
|
+
};
|
|
1832
|
+
let o = (a) => {
|
|
1833
|
+
if (a.button === 0) {
|
|
1834
|
+
if (i.isPressed = !1, P(), i.ignoreEmulatedMouseEvents) {
|
|
1835
|
+
i.ignoreEmulatedMouseEvents = !1;
|
|
1836
|
+
return;
|
|
1837
|
+
}
|
|
1838
|
+
j(a, i.target) ? $(B(i.target, a), i.pointerType) : i.isOverTarget && $(B(i.target, a), i.pointerType, !1), i.isOverTarget = !1;
|
|
1839
|
+
}
|
|
1840
|
+
};
|
|
1841
|
+
v.onTouchStart = (a) => {
|
|
1842
|
+
if (!a.currentTarget.contains(a.target))
|
|
1843
|
+
return;
|
|
1844
|
+
a.stopPropagation();
|
|
1845
|
+
let c = rn(a.nativeEvent);
|
|
1846
|
+
!c || (i.activePointerId = c.identifier, i.ignoreEmulatedMouseEvents = !0, i.isOverTarget = !0, i.isPressed = !0, i.target = a.currentTarget, i.pointerType = "touch", !u && !p && I(a.currentTarget), b || ct(i.target), E(a, i.pointerType), K(window, "scroll", f, !0));
|
|
1847
|
+
}, v.onTouchMove = (a) => {
|
|
1848
|
+
if (!a.currentTarget.contains(a.target) || (a.stopPropagation(), !i.isPressed))
|
|
1849
|
+
return;
|
|
1850
|
+
let c = ut(a.nativeEvent, i.activePointerId);
|
|
1851
|
+
c && j(c, a.currentTarget) ? i.isOverTarget || (i.isOverTarget = !0, E(a, i.pointerType)) : i.isOverTarget && (i.isOverTarget = !1, $(a, i.pointerType, !1), g.current.shouldCancelOnPointerExit && T(a));
|
|
1852
|
+
}, v.onTouchEnd = (a) => {
|
|
1853
|
+
if (!a.currentTarget.contains(a.target) || (a.stopPropagation(), !i.isPressed))
|
|
1854
|
+
return;
|
|
1855
|
+
let c = ut(a.nativeEvent, i.activePointerId);
|
|
1856
|
+
c && j(c, a.currentTarget) ? (y(a, i.pointerType), $(a, i.pointerType)) : i.isOverTarget && $(a, i.pointerType, !1), i.isPressed = !1, i.activePointerId = null, i.isOverTarget = !1, i.ignoreEmulatedMouseEvents = !0, b || fe(i.target), P();
|
|
1857
|
+
}, v.onTouchCancel = (a) => {
|
|
1858
|
+
!a.currentTarget.contains(a.target) || (a.stopPropagation(), i.isPressed && T(a));
|
|
1859
|
+
};
|
|
1860
|
+
let f = (a) => {
|
|
1861
|
+
i.isPressed && a.target.contains(i.target) && T({
|
|
1862
|
+
currentTarget: i.target,
|
|
1863
|
+
shiftKey: !1,
|
|
1864
|
+
ctrlKey: !1,
|
|
1865
|
+
metaKey: !1,
|
|
1866
|
+
altKey: !1
|
|
1867
|
+
});
|
|
1868
|
+
};
|
|
1869
|
+
v.onDragStart = (a) => {
|
|
1870
|
+
!a.currentTarget.contains(a.target) || T(a);
|
|
1871
|
+
};
|
|
1872
|
+
}
|
|
1873
|
+
return v;
|
|
1874
|
+
}, [
|
|
1875
|
+
K,
|
|
1876
|
+
u,
|
|
1877
|
+
p,
|
|
1878
|
+
P,
|
|
1879
|
+
b
|
|
1880
|
+
]);
|
|
1881
|
+
return D(() => () => {
|
|
1882
|
+
b || fe(M.current.target);
|
|
1883
|
+
}, [
|
|
1884
|
+
b
|
|
1885
|
+
]), {
|
|
1886
|
+
isPressed: d || L,
|
|
1887
|
+
pressProps: G(m, w)
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
function ke(t) {
|
|
1891
|
+
return t.tagName === "A" && t.hasAttribute("href");
|
|
1892
|
+
}
|
|
1893
|
+
function me(t, e) {
|
|
1894
|
+
const { key: r, code: n } = t, s = e, l = s.getAttribute("role");
|
|
1895
|
+
return (r === "Enter" || r === " " || r === "Spacebar" || n === "Space") && !(s instanceof HTMLInputElement && !Bt(s, r) || s instanceof HTMLTextAreaElement || s.isContentEditable) && (!ke(s) || l === "button" && r !== "Enter") && !(l === "link" && r !== "Enter");
|
|
1896
|
+
}
|
|
1897
|
+
function rn(t) {
|
|
1898
|
+
const { targetTouches: e } = t;
|
|
1899
|
+
return e.length > 0 ? e[0] : null;
|
|
1900
|
+
}
|
|
1901
|
+
function ut(t, e) {
|
|
1902
|
+
const r = t.changedTouches;
|
|
1903
|
+
for (let n = 0; n < r.length; n++) {
|
|
1904
|
+
const s = r[n];
|
|
1905
|
+
if (s.identifier === e)
|
|
1906
|
+
return s;
|
|
1907
|
+
}
|
|
1908
|
+
return null;
|
|
1909
|
+
}
|
|
1910
|
+
function B(t, e) {
|
|
1911
|
+
return {
|
|
1912
|
+
currentTarget: t,
|
|
1913
|
+
shiftKey: e.shiftKey,
|
|
1914
|
+
ctrlKey: e.ctrlKey,
|
|
1915
|
+
metaKey: e.metaKey,
|
|
1916
|
+
altKey: e.altKey
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1919
|
+
function nn(t) {
|
|
1920
|
+
let e = t.width / 2 || t.radiusX || 0, r = t.height / 2 || t.radiusY || 0;
|
|
1921
|
+
return {
|
|
1922
|
+
top: t.clientY - r,
|
|
1923
|
+
right: t.clientX + e,
|
|
1924
|
+
bottom: t.clientY + r,
|
|
1925
|
+
left: t.clientX - e
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
function sn(t, e) {
|
|
1929
|
+
return !(t.left > e.right || e.left > t.right || t.top > e.bottom || e.top > t.bottom);
|
|
1930
|
+
}
|
|
1931
|
+
function j(t, e) {
|
|
1932
|
+
let r = e.getBoundingClientRect(), n = nn(t);
|
|
1933
|
+
return sn(r, n);
|
|
1934
|
+
}
|
|
1935
|
+
function Te(t) {
|
|
1936
|
+
return !(t instanceof HTMLElement) || !t.draggable;
|
|
1937
|
+
}
|
|
1938
|
+
function ft(t, e) {
|
|
1939
|
+
return t instanceof HTMLInputElement ? !Bt(t, e) : t instanceof HTMLButtonElement ? t.type !== "submit" : !0;
|
|
1940
|
+
}
|
|
1941
|
+
const an = /* @__PURE__ */ new Set([
|
|
1942
|
+
"checkbox",
|
|
1943
|
+
"radio",
|
|
1944
|
+
"range",
|
|
1945
|
+
"color",
|
|
1946
|
+
"file",
|
|
1947
|
+
"image",
|
|
1948
|
+
"button",
|
|
1949
|
+
"submit",
|
|
1950
|
+
"reset"
|
|
1951
|
+
]);
|
|
1952
|
+
function Bt(t, e) {
|
|
1953
|
+
return t.type === "checkbox" || t.type === "radio" ? e === " " : an.has(t.type);
|
|
1954
|
+
}
|
|
1955
|
+
function on(t) {
|
|
1956
|
+
return t.width === 0 && t.height === 0 || t.width === 1 && t.height === 1 && t.pressure === 0 && t.detail === 0 && t.pointerType === "mouse";
|
|
1957
|
+
}
|
|
1958
|
+
let ln = /* @__PURE__ */ new Set(), dt = !1, H = !1, Ce = !1;
|
|
1959
|
+
function Ue(t, e) {
|
|
1960
|
+
for (let r of ln)
|
|
1961
|
+
r(t, e);
|
|
1962
|
+
}
|
|
1963
|
+
function cn(t) {
|
|
1964
|
+
return !(t.metaKey || !ae() && t.altKey || t.ctrlKey || t.key === "Control" || t.key === "Shift" || t.key === "Meta");
|
|
1965
|
+
}
|
|
1966
|
+
function pt(t) {
|
|
1967
|
+
H = !0, cn(t) && Ue("keyboard", t);
|
|
1968
|
+
}
|
|
1969
|
+
function Y(t) {
|
|
1970
|
+
(t.type === "mousedown" || t.type === "pointerdown") && (H = !0, Ue("pointer", t));
|
|
1971
|
+
}
|
|
1972
|
+
function un(t) {
|
|
1973
|
+
Le(t) && (H = !0);
|
|
1974
|
+
}
|
|
1975
|
+
function fn(t) {
|
|
1976
|
+
t.target === window || t.target === document || (!H && !Ce && Ue("virtual", t), H = !1, Ce = !1);
|
|
1977
|
+
}
|
|
1978
|
+
function dn() {
|
|
1979
|
+
H = !1, Ce = !0;
|
|
1980
|
+
}
|
|
1981
|
+
function yt() {
|
|
1982
|
+
if (typeof window > "u" || dt)
|
|
1983
|
+
return;
|
|
1984
|
+
let t = HTMLElement.prototype.focus;
|
|
1985
|
+
HTMLElement.prototype.focus = function() {
|
|
1986
|
+
H = !0, t.apply(this, arguments);
|
|
1987
|
+
}, document.addEventListener("keydown", pt, !0), document.addEventListener("keyup", pt, !0), document.addEventListener("click", un, !0), window.addEventListener("focus", fn, !0), window.addEventListener("blur", dn, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown", Y, !0), document.addEventListener("pointermove", Y, !0), document.addEventListener("pointerup", Y, !0)) : (document.addEventListener("mousedown", Y, !0), document.addEventListener("mousemove", Y, !0), document.addEventListener("mouseup", Y, !0)), dt = !0;
|
|
1988
|
+
}
|
|
1989
|
+
typeof document < "u" && (document.readyState !== "loading" ? yt() : document.addEventListener("DOMContentLoaded", yt));
|
|
1990
|
+
const Ut = /* @__PURE__ */ new WeakMap();
|
|
1991
|
+
function ge(t, e, r) {
|
|
1992
|
+
return typeof e == "string" && (e = e.replace(/\s+/g, "")), Ut.get(t) + "-" + r + "-" + e;
|
|
1993
|
+
}
|
|
1994
|
+
function pn(t, e, r) {
|
|
1995
|
+
let {
|
|
1996
|
+
key: n,
|
|
1997
|
+
isDisabled: s
|
|
1998
|
+
} = t, {
|
|
1999
|
+
selectionManager: l,
|
|
2000
|
+
selectedKey: u
|
|
2001
|
+
} = e, d = n === u, {
|
|
2002
|
+
itemProps: p
|
|
2003
|
+
} = Qr({
|
|
2004
|
+
selectionManager: l,
|
|
2005
|
+
key: n,
|
|
2006
|
+
ref: r
|
|
2007
|
+
}), h = s || e.disabledKeys.has(n), {
|
|
2008
|
+
pressProps: b
|
|
2009
|
+
} = tn(U({}, p, {
|
|
2010
|
+
isDisabled: h
|
|
2011
|
+
})), S = ge(e, n, "tab"), m = ge(e, n, "tabpanel"), {
|
|
2012
|
+
tabIndex: g
|
|
2013
|
+
} = b;
|
|
2014
|
+
return {
|
|
2015
|
+
tabProps: U({}, b, {
|
|
2016
|
+
id: S,
|
|
2017
|
+
"aria-selected": d,
|
|
2018
|
+
"aria-disabled": h || void 0,
|
|
2019
|
+
"aria-controls": d ? m : void 0,
|
|
2020
|
+
tabIndex: h ? void 0 : g,
|
|
2021
|
+
role: "tab"
|
|
2022
|
+
})
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
function yn(t, e, r) {
|
|
2026
|
+
let [n, s] = A(0);
|
|
2027
|
+
ht(() => {
|
|
2028
|
+
if (r != null && r.current) {
|
|
2029
|
+
let d = () => {
|
|
2030
|
+
let h = Gr(r.current, {
|
|
2031
|
+
tabbable: !0
|
|
2032
|
+
});
|
|
2033
|
+
s(h.nextNode() ? void 0 : 0);
|
|
2034
|
+
};
|
|
2035
|
+
d();
|
|
2036
|
+
let p = new MutationObserver(d);
|
|
2037
|
+
return p.observe(r.current, {
|
|
2038
|
+
subtree: !0,
|
|
2039
|
+
childList: !0,
|
|
2040
|
+
attributes: !0,
|
|
2041
|
+
attributeFilter: ["tabIndex", "disabled"]
|
|
2042
|
+
}), () => {
|
|
2043
|
+
p.disconnect();
|
|
2044
|
+
};
|
|
2045
|
+
}
|
|
2046
|
+
}, [r]);
|
|
2047
|
+
const l = ge(e, e == null ? void 0 : e.selectedKey, "tabpanel"), u = xt(U({}, t, {
|
|
2048
|
+
id: l,
|
|
2049
|
+
"aria-labelledby": ge(e, e == null ? void 0 : e.selectedKey, "tab")
|
|
2050
|
+
}));
|
|
2051
|
+
return {
|
|
2052
|
+
tabPanelProps: wt(u, {
|
|
2053
|
+
tabIndex: n,
|
|
2054
|
+
role: "tabpanel",
|
|
2055
|
+
"aria-describedby": t["aria-describedby"],
|
|
2056
|
+
"aria-details": t["aria-details"]
|
|
2057
|
+
})
|
|
2058
|
+
};
|
|
2059
|
+
}
|
|
2060
|
+
class gn {
|
|
2061
|
+
constructor(e, r, n, s) {
|
|
2062
|
+
s === void 0 && (s = /* @__PURE__ */ new Set()), this.collection = void 0, this.flipDirection = void 0, this.disabledKeys = void 0, this.orientation = void 0, this.collection = e, this.flipDirection = r === "rtl" && n === "horizontal", this.orientation = n, this.disabledKeys = s;
|
|
2063
|
+
}
|
|
2064
|
+
getKeyLeftOf(e) {
|
|
2065
|
+
return this.flipDirection ? this.getNextKey(e) : this.orientation === "horizontal" ? this.getPreviousKey(e) : null;
|
|
2066
|
+
}
|
|
2067
|
+
getKeyRightOf(e) {
|
|
2068
|
+
return this.flipDirection ? this.getPreviousKey(e) : this.orientation === "horizontal" ? this.getNextKey(e) : null;
|
|
2069
|
+
}
|
|
2070
|
+
getKeyAbove(e) {
|
|
2071
|
+
return this.orientation === "vertical" ? this.getPreviousKey(e) : null;
|
|
2072
|
+
}
|
|
2073
|
+
getKeyBelow(e) {
|
|
2074
|
+
return this.orientation === "vertical" ? this.getNextKey(e) : null;
|
|
2075
|
+
}
|
|
2076
|
+
getFirstKey() {
|
|
2077
|
+
let e = this.collection.getFirstKey();
|
|
2078
|
+
return this.disabledKeys.has(e) && (e = this.getNextKey(e)), e;
|
|
2079
|
+
}
|
|
2080
|
+
getLastKey() {
|
|
2081
|
+
let e = this.collection.getLastKey();
|
|
2082
|
+
return this.disabledKeys.has(e) && (e = this.getPreviousKey(e)), e;
|
|
2083
|
+
}
|
|
2084
|
+
getNextKey(e) {
|
|
2085
|
+
do
|
|
2086
|
+
e = this.collection.getKeyAfter(e), e == null && (e = this.collection.getFirstKey());
|
|
2087
|
+
while (this.disabledKeys.has(e));
|
|
2088
|
+
return e;
|
|
2089
|
+
}
|
|
2090
|
+
getPreviousKey(e) {
|
|
2091
|
+
do
|
|
2092
|
+
e = this.collection.getKeyBefore(e), e == null && (e = this.collection.getLastKey());
|
|
2093
|
+
while (this.disabledKeys.has(e));
|
|
2094
|
+
return e;
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
function bn(t, e, r) {
|
|
2098
|
+
let {
|
|
2099
|
+
orientation: n = "horizontal",
|
|
2100
|
+
keyboardActivation: s = "automatic"
|
|
2101
|
+
} = t, {
|
|
2102
|
+
collection: l,
|
|
2103
|
+
selectionManager: u,
|
|
2104
|
+
disabledKeys: d
|
|
2105
|
+
} = e, {
|
|
2106
|
+
direction: p
|
|
2107
|
+
} = Kt(), h = z(() => new gn(l, p, n, d), [l, d, n, p]), {
|
|
2108
|
+
collectionProps: b
|
|
2109
|
+
} = Zr({
|
|
2110
|
+
ref: r,
|
|
2111
|
+
selectionManager: u,
|
|
2112
|
+
keyboardDelegate: h,
|
|
2113
|
+
selectOnFocus: s === "automatic",
|
|
2114
|
+
disallowEmptySelection: !0,
|
|
2115
|
+
scrollRef: r
|
|
2116
|
+
}), S = Et();
|
|
2117
|
+
Ut.set(e, S);
|
|
2118
|
+
let m = xt(U({}, t, {
|
|
2119
|
+
id: S
|
|
2120
|
+
}));
|
|
2121
|
+
return {
|
|
2122
|
+
tabListProps: U({}, wt(b, m), {
|
|
2123
|
+
role: "tablist",
|
|
2124
|
+
"aria-orientation": n,
|
|
2125
|
+
tabIndex: void 0
|
|
2126
|
+
})
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2129
|
+
function hn(t, e, r) {
|
|
2130
|
+
return e in t ? Object.defineProperty(t, e, {
|
|
2131
|
+
value: r,
|
|
2132
|
+
enumerable: !0,
|
|
2133
|
+
configurable: !0,
|
|
2134
|
+
writable: !0
|
|
2135
|
+
}) : t[e] = r, t;
|
|
2136
|
+
}
|
|
2137
|
+
function gt(t, e) {
|
|
2138
|
+
var r = Object.keys(t);
|
|
2139
|
+
if (Object.getOwnPropertySymbols) {
|
|
2140
|
+
var n = Object.getOwnPropertySymbols(t);
|
|
2141
|
+
e && (n = n.filter(function(s) {
|
|
2142
|
+
return Object.getOwnPropertyDescriptor(t, s).enumerable;
|
|
2143
|
+
})), r.push.apply(r, n);
|
|
2144
|
+
}
|
|
2145
|
+
return r;
|
|
2146
|
+
}
|
|
2147
|
+
function bt(t) {
|
|
2148
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
2149
|
+
var r = arguments[e] != null ? arguments[e] : {};
|
|
2150
|
+
e % 2 ? gt(Object(r), !0).forEach(function(n) {
|
|
2151
|
+
hn(t, n, r[n]);
|
|
2152
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : gt(Object(r)).forEach(function(n) {
|
|
2153
|
+
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
|
|
2154
|
+
});
|
|
2155
|
+
}
|
|
2156
|
+
return t;
|
|
2157
|
+
}
|
|
2158
|
+
var vn = (t, e, r) => {
|
|
2159
|
+
for (var n of Object.keys(t)) {
|
|
2160
|
+
var s;
|
|
2161
|
+
if (t[n] !== ((s = e[n]) !== null && s !== void 0 ? s : r[n]))
|
|
2162
|
+
return !1;
|
|
2163
|
+
}
|
|
2164
|
+
return !0;
|
|
2165
|
+
}, Ve = (t) => (e) => {
|
|
2166
|
+
var r = t.defaultClassName, n = bt(bt({}, t.defaultVariants), e);
|
|
2167
|
+
for (var s in n) {
|
|
2168
|
+
var l, u = (l = n[s]) !== null && l !== void 0 ? l : t.defaultVariants[s];
|
|
2169
|
+
if (u != null) {
|
|
2170
|
+
var d = u;
|
|
2171
|
+
typeof d == "boolean" && (d = d === !0 ? "true" : "false");
|
|
2172
|
+
var p = t.variantClassNames[s][d];
|
|
2173
|
+
p && (r += " " + p);
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
for (var [h, b] of t.compoundVariants)
|
|
2177
|
+
vn(h, n, t.defaultVariants) && (r += " " + b);
|
|
2178
|
+
return r;
|
|
2179
|
+
}, $n = Ve({ defaultClassName: "kz6kzz0", variantClassNames: { context: { container: "kz6kzz1", navigation: "kz6kzz2" }, active: { true: "kz6kzz3", false: "kz6kzz4" }, disabled: { true: "kz6kzz5", false: "kz6kzz6" } }, defaultVariants: {}, compoundVariants: [[{ context: "container", active: !0 }, "kz6kzz7"], [{ context: "container", active: !1 }, "kz6kzz8"], [{ context: "container", active: !1, disabled: !1 }, "kz6kzz9"], [{ context: "navigation", active: !0 }, "kz6kzza"], [{ context: "navigation", active: !1 }, "kz6kzzb"], [{ context: "navigation", active: !1, disabled: !1 }, "kz6kzzc"], [{ context: "navigation", active: !1, disabled: !0 }, "kz6kzzd"]] }), mn = Ve({ defaultClassName: "", variantClassNames: { active: { true: "kz6kzze", false: "kz6kzzf" }, disabled: { true: "kz6kzzg", false: "kz6kzzh" }, context: { navigation: "kz6kzzi", container: "kz6kzzj" } }, defaultVariants: {}, compoundVariants: [[{ context: "navigation", active: !0 }, "kz6kzzk"]] });
|
|
2180
|
+
function Vt({
|
|
2181
|
+
context: t,
|
|
2182
|
+
item: e,
|
|
2183
|
+
state: r,
|
|
2184
|
+
...n
|
|
2185
|
+
}) {
|
|
2186
|
+
const { key: s } = e, l = R.useRef(null), { tabProps: u } = pn({ key: s }, r, l), d = r.selectedKey === s, p = r.disabledKeys.has(s), h = Wt(e.rendered, (b) => b.type.displayName === "SpsTag" || ie.isWoodlandComponent(b.type) && ie.get(b.type).name === "Tag" ? [{
|
|
2187
|
+
className: vt(b.props.className, mn({ active: d, disabled: p, context: t }))
|
|
2188
|
+
}] : [{}]);
|
|
2189
|
+
return /* @__PURE__ */ R.createElement("div", {
|
|
2190
|
+
...u,
|
|
2191
|
+
ref: l,
|
|
2192
|
+
className: $n({ active: d, disabled: p, context: t }),
|
|
2193
|
+
...n
|
|
2194
|
+
}, h);
|
|
2195
|
+
}
|
|
2196
|
+
ie.set(Vt, { name: "Tab" });
|
|
2197
|
+
function Ht({
|
|
2198
|
+
context: t,
|
|
2199
|
+
"data-testid": e,
|
|
2200
|
+
state: r,
|
|
2201
|
+
...n
|
|
2202
|
+
}) {
|
|
2203
|
+
const s = R.useRef(null), { tabPanelProps: l } = yn(n, r, s), u = t === "container" ? jt : "div";
|
|
2204
|
+
return /* @__PURE__ */ R.createElement(u, {
|
|
2205
|
+
...l,
|
|
2206
|
+
ref: s,
|
|
2207
|
+
"data-testid": e
|
|
2208
|
+
}, r.selectedItem ? r.selectedItem.props.children : null);
|
|
2209
|
+
}
|
|
2210
|
+
ie.set(Ht, { name: "TabPanel" });
|
|
2211
|
+
var Tn = Ve({ defaultClassName: "fy26er0", variantClassNames: { context: { container: "fy26er1", navigation: "fy26er2" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2212
|
+
function Gt({
|
|
2213
|
+
className: t,
|
|
2214
|
+
context: e = "navigation",
|
|
2215
|
+
"data-testid": r,
|
|
2216
|
+
...n
|
|
2217
|
+
}) {
|
|
2218
|
+
const s = tr(n), l = R.useRef(null), { tabListProps: u } = bn(n, s, l), d = Yt({ "data-testid": r });
|
|
2219
|
+
return /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement("div", {
|
|
2220
|
+
...u,
|
|
2221
|
+
ref: l,
|
|
2222
|
+
className: vt(Tn({ context: e }), t),
|
|
2223
|
+
"data-testid": r
|
|
2224
|
+
}, [...s.collection].map((p) => /* @__PURE__ */ R.createElement(Vt, {
|
|
2225
|
+
key: p.key,
|
|
2226
|
+
item: p,
|
|
2227
|
+
state: s,
|
|
2228
|
+
context: e,
|
|
2229
|
+
...d(`tab-${String(p.key)}`)
|
|
2230
|
+
}))), /* @__PURE__ */ R.createElement(Ht, {
|
|
2231
|
+
key: s.selectedItem ? s.selectedItem.key : null,
|
|
2232
|
+
state: s,
|
|
2233
|
+
context: e,
|
|
2234
|
+
...d("tab-panel")
|
|
2235
|
+
}));
|
|
2236
|
+
}
|
|
2237
|
+
ie.set(Gt, { name: "Tabs" });
|
|
2238
|
+
const Kn = {
|
|
2239
|
+
components: [Gt],
|
|
2240
|
+
examples: {
|
|
2241
|
+
basic: {
|
|
2242
|
+
label: "Basic Navigation Tabs",
|
|
2243
|
+
description: He`
|
|
2244
|
+
<p>Navigation tabs</p>
|
|
2245
|
+
`,
|
|
2246
|
+
examples: {
|
|
2247
|
+
basic: {
|
|
2248
|
+
react: He`
|
|
2249
|
+
import { Item } from "@react-stately/collections";
|
|
2250
|
+
import { Box, Icon } from "@sps-woodland/core";
|
|
2251
|
+
import { Tabs } from "@sps-woodland/tabs";
|
|
2252
|
+
import { Tag } from "@sps-woodland/tags";
|
|
2253
|
+
|
|
2254
|
+
function Component() {
|
|
2255
|
+
/* If you have no need to know or control which tab is selected, you
|
|
2256
|
+
* can omit this state and the change handler; the tabs will work
|
|
2257
|
+
* on their own. */
|
|
2258
|
+
const [selectedTab, setSelectedTab] = React.useState("trust");
|
|
2259
|
+
|
|
2260
|
+
return (
|
|
2261
|
+
<Tabs
|
|
2262
|
+
selectedKey={selectedTab}
|
|
2263
|
+
onSelectionChange={setSelectedTab}
|
|
2264
|
+
disabledKeys={["bold"]}
|
|
2265
|
+
>
|
|
2266
|
+
<Item key="trust" title="Trust">
|
|
2267
|
+
<p>
|
|
2268
|
+
So, what is it? What is it exactly that's going to revolutionize
|
|
2269
|
+
the way we do business?
|
|
2270
|
+
</p>
|
|
2271
|
+
</Item>
|
|
2272
|
+
<Item
|
|
2273
|
+
key="reliability"
|
|
2274
|
+
title={
|
|
2275
|
+
<>
|
|
2276
|
+
<Box mr="xs">Reliability</Box>
|
|
2277
|
+
<Tag kind="error">00</Tag>
|
|
2278
|
+
</>
|
|
2279
|
+
}
|
|
2280
|
+
>
|
|
2281
|
+
<p>Reliability tab content</p>
|
|
2282
|
+
</Item>
|
|
2283
|
+
<Item
|
|
2284
|
+
key="future"
|
|
2285
|
+
title={
|
|
2286
|
+
<>
|
|
2287
|
+
<Icon icon="heart"/>
|
|
2288
|
+
<Box ml="xs">The Future</Box>
|
|
2289
|
+
</>
|
|
2290
|
+
}
|
|
2291
|
+
>
|
|
2292
|
+
<p>The Future tab content</p>
|
|
2293
|
+
</Item>
|
|
2294
|
+
<Item
|
|
2295
|
+
key="bold"
|
|
2296
|
+
title={
|
|
2297
|
+
<>
|
|
2298
|
+
<Icon icon="heart"/>
|
|
2299
|
+
<Box mx="xs">Bold</Box>
|
|
2300
|
+
<Tag kind="key">00</Tag>
|
|
2301
|
+
</>
|
|
2302
|
+
}
|
|
2303
|
+
>
|
|
2304
|
+
<p>Bold tab content</p>
|
|
2305
|
+
</Item>
|
|
2306
|
+
</Tabs>
|
|
2307
|
+
)
|
|
2308
|
+
}
|
|
2309
|
+
`
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
}, xn = {
|
|
2315
|
+
"Tabbed Navigation": Kn
|
|
2316
|
+
};
|
|
2317
|
+
export {
|
|
2318
|
+
xn as MANIFEST,
|
|
2319
|
+
Gt as Tabs
|
|
2320
|
+
};
|