@cfx-dev/ui-components 0.0.19 → 0.0.21

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.
Files changed (77) hide show
  1. package/dist/Combination-Dp_plIQU.js +793 -0
  2. package/dist/{Icons-B26SczGZ.js → Icons-BlBKvJD8.js} +40 -98
  3. package/dist/{Rail-BCY3h7eP.js → Rail-CCuyJpf6.js} +11 -11
  4. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  5. package/dist/assets/InputDropzone.css +1 -0
  6. package/dist/assets/ItemPreview.css +1 -0
  7. package/dist/assets/Table.css +1 -0
  8. package/dist/components/BackdropPortal/BackdropPortal.d.ts +1 -0
  9. package/dist/components/BackdropPortal/BackdropPortal.js +9 -7
  10. package/dist/components/Badge/Badge.d.ts +2 -2
  11. package/dist/components/Button/Button.d.ts +2 -1
  12. package/dist/components/Button/Button.js +27 -25
  13. package/dist/components/Button/ButtonBar.d.ts +0 -1
  14. package/dist/components/Button/LinkButton.js +13 -13
  15. package/dist/components/Flyout/Flyout.d.ts +1 -0
  16. package/dist/components/Flyout/Flyout.js +28 -27
  17. package/dist/components/Input/Input.js +1 -1
  18. package/dist/components/Input/RichInput.js +2 -2
  19. package/dist/components/InputDropzone/InputDropzone.d.ts +14 -0
  20. package/dist/components/InputDropzone/InputDropzone.js +1103 -0
  21. package/dist/components/InputDropzone/ItemPreview.d.ts +8 -0
  22. package/dist/components/InputDropzone/ItemPreview.js +24 -0
  23. package/dist/components/Layout/Scrollable/Rail.js +3 -3
  24. package/dist/components/Layout/Scrollable/Scrollable.js +2 -2
  25. package/dist/components/Layout/Scrollable/VirtualScrollable.js +3 -4
  26. package/dist/components/Modal/Modal.d.ts +0 -2
  27. package/dist/components/Modal/Modal.js +3 -3
  28. package/dist/components/NavList/NavList.js +5 -5
  29. package/dist/components/OnScreenSensor.js +6 -6
  30. package/dist/components/Overlay/Overlay.d.ts +1 -0
  31. package/dist/components/Overlay/Overlay.js +16 -15
  32. package/dist/components/Select/Select.js +652 -663
  33. package/dist/components/Shroud/Shroud.js +20 -19
  34. package/dist/components/Switch/Switch.js +1 -1
  35. package/dist/components/Table/Table.d.ts +17 -0
  36. package/dist/components/Table/Table.js +61 -0
  37. package/dist/components/Tabular/Tabular.d.ts +1 -1
  38. package/dist/components/Text/Text.types.d.ts +0 -1
  39. package/dist/components/Title/Title.d.ts +1 -0
  40. package/dist/components/Title/Title.js +26 -25
  41. package/dist/{extends-Dk_bSU3E.js → extends-hS2Bh-Yp.js} +1 -2
  42. package/dist/{index-C75OpfGQ.js → index-2hJuj4UN.js} +2018 -2526
  43. package/dist/index-DQMInta3.js +663 -0
  44. package/dist/index.esm-BkynlSN6.js +72 -0
  45. package/dist/main.d.ts +17 -26
  46. package/dist/main.js +145 -122
  47. package/dist/{medium-Dc7QRuE0.js → medium-JVtzoF2c.js} +3 -3
  48. package/dist/style-guide/Colours/DarkThemeSwatches.d.ts +2 -0
  49. package/dist/style-guide/Colours/DarkThemeSwatches.js +110 -0
  50. package/dist/style-guide/Colours/LightThemeSwatches.d.ts +2 -0
  51. package/dist/style-guide/Colours/LightThemeSwatches.js +105 -0
  52. package/dist/style-guide/Colours/Swatches.d.ts +6 -0
  53. package/dist/style-guide/Colours/Swatches.js +48 -0
  54. package/dist/style-guide/Icons/IconDisplayGrid.d.ts +2 -0
  55. package/dist/style-guide/Icons/IconDisplayGrid.js +42 -0
  56. package/dist/style-guide/Icons/Icons.js +7 -0
  57. package/dist/tslib.es6-CBKHJX9H.js +151 -0
  58. package/dist/utils/functional.js +19 -6
  59. package/dist/utils/hooks.d.ts +2 -1
  60. package/dist/utils/hooks.js +77 -10
  61. package/dist/utils/links.js +1128 -12
  62. package/dist/utils/math.js +8 -3
  63. package/dist/utils/mergeRefs.d.ts +1 -1
  64. package/dist/utils/mergeRefs.js +2 -2
  65. package/dist/utils/outlet.js +19 -4
  66. package/dist/utils/string.js +42 -7
  67. package/package.json +7 -13
  68. package/dist/Combination-Dj-a6dCZ.js +0 -1462
  69. package/dist/components/Icons.js +0 -6
  70. package/dist/functional-C0pE183N.js +0 -30
  71. package/dist/hooks-GAujvL7d.js +0 -86
  72. package/dist/links-CgOD-Vfj.js +0 -1142
  73. package/dist/math-i2ceybzU.js +0 -16
  74. package/dist/outlet-B11a3Kgw.js +0 -27
  75. package/dist/string-NVxCUbqk.js +0 -54
  76. package/dist/tslib.es6-Dd_EkEfR.js +0 -48
  77. /package/dist/{components → style-guide/Icons}/Icons.d.ts +0 -0
@@ -1,1462 +0,0 @@
1
- import { _ as Fe } from "./extends-Dk_bSU3E.js";
2
- import * as D from "react";
3
- import jr, { createContext as $r, PureComponent as Lr } from "react";
4
- import { g as Wr } from "./index-C75OpfGQ.js";
5
- import { a as Ne, c as Ur, u as qr } from "./medium-Dc7QRuE0.js";
6
- import { _ as Br } from "./inheritsLoose-A8WKSWDx.js";
7
- function Yr(e, r) {
8
- if (e == null)
9
- return {};
10
- var n = {};
11
- for (var t in e)
12
- if ({}.hasOwnProperty.call(e, t)) {
13
- if (r.indexOf(t) >= 0)
14
- continue;
15
- n[t] = e[t];
16
- }
17
- return n;
18
- }
19
- var Ae = { exports: {} }, be = { exports: {} }, C = {};
20
- /** @license React v16.13.1
21
- * react-is.production.min.js
22
- *
23
- * Copyright (c) Facebook, Inc. and its affiliates.
24
- *
25
- * This source code is licensed under the MIT license found in the
26
- * LICENSE file in the root directory of this source tree.
27
- */
28
- var Ke;
29
- function Gr() {
30
- if (Ke)
31
- return C;
32
- Ke = 1;
33
- var e = typeof Symbol == "function" && Symbol.for, r = e ? Symbol.for("react.element") : 60103, n = e ? Symbol.for("react.portal") : 60106, t = e ? Symbol.for("react.fragment") : 60107, o = e ? Symbol.for("react.strict_mode") : 60108, a = e ? Symbol.for("react.profiler") : 60114, f = e ? Symbol.for("react.provider") : 60109, s = e ? Symbol.for("react.context") : 60110, b = e ? Symbol.for("react.async_mode") : 60111, l = e ? Symbol.for("react.concurrent_mode") : 60111, p = e ? Symbol.for("react.forward_ref") : 60112, v = e ? Symbol.for("react.suspense") : 60113, m = e ? Symbol.for("react.suspense_list") : 60120, g = e ? Symbol.for("react.memo") : 60115, h = e ? Symbol.for("react.lazy") : 60116, y = e ? Symbol.for("react.block") : 60121, A = e ? Symbol.for("react.fundamental") : 60117, k = e ? Symbol.for("react.responder") : 60118, j = e ? Symbol.for("react.scope") : 60119;
34
- function I(u) {
35
- if (typeof u == "object" && u !== null) {
36
- var q = u.$$typeof;
37
- switch (q) {
38
- case r:
39
- switch (u = u.type, u) {
40
- case b:
41
- case l:
42
- case t:
43
- case a:
44
- case o:
45
- case v:
46
- return u;
47
- default:
48
- switch (u = u && u.$$typeof, u) {
49
- case s:
50
- case p:
51
- case h:
52
- case g:
53
- case f:
54
- return u;
55
- default:
56
- return q;
57
- }
58
- }
59
- case n:
60
- return q;
61
- }
62
- }
63
- }
64
- function N(u) {
65
- return I(u) === l;
66
- }
67
- return C.AsyncMode = b, C.ConcurrentMode = l, C.ContextConsumer = s, C.ContextProvider = f, C.Element = r, C.ForwardRef = p, C.Fragment = t, C.Lazy = h, C.Memo = g, C.Portal = n, C.Profiler = a, C.StrictMode = o, C.Suspense = v, C.isAsyncMode = function(u) {
68
- return N(u) || I(u) === b;
69
- }, C.isConcurrentMode = N, C.isContextConsumer = function(u) {
70
- return I(u) === s;
71
- }, C.isContextProvider = function(u) {
72
- return I(u) === f;
73
- }, C.isElement = function(u) {
74
- return typeof u == "object" && u !== null && u.$$typeof === r;
75
- }, C.isForwardRef = function(u) {
76
- return I(u) === p;
77
- }, C.isFragment = function(u) {
78
- return I(u) === t;
79
- }, C.isLazy = function(u) {
80
- return I(u) === h;
81
- }, C.isMemo = function(u) {
82
- return I(u) === g;
83
- }, C.isPortal = function(u) {
84
- return I(u) === n;
85
- }, C.isProfiler = function(u) {
86
- return I(u) === a;
87
- }, C.isStrictMode = function(u) {
88
- return I(u) === o;
89
- }, C.isSuspense = function(u) {
90
- return I(u) === v;
91
- }, C.isValidElementType = function(u) {
92
- return typeof u == "string" || typeof u == "function" || u === t || u === l || u === a || u === o || u === v || u === m || typeof u == "object" && u !== null && (u.$$typeof === h || u.$$typeof === g || u.$$typeof === f || u.$$typeof === s || u.$$typeof === p || u.$$typeof === A || u.$$typeof === k || u.$$typeof === j || u.$$typeof === y);
93
- }, C.typeOf = I, C;
94
- }
95
- var F = {};
96
- /** @license React v16.13.1
97
- * react-is.development.js
98
- *
99
- * Copyright (c) Facebook, Inc. and its affiliates.
100
- *
101
- * This source code is licensed under the MIT license found in the
102
- * LICENSE file in the root directory of this source tree.
103
- */
104
- var Xe;
105
- function Hr() {
106
- return Xe || (Xe = 1, process.env.NODE_ENV !== "production" && function() {
107
- var e = typeof Symbol == "function" && Symbol.for, r = e ? Symbol.for("react.element") : 60103, n = e ? Symbol.for("react.portal") : 60106, t = e ? Symbol.for("react.fragment") : 60107, o = e ? Symbol.for("react.strict_mode") : 60108, a = e ? Symbol.for("react.profiler") : 60114, f = e ? Symbol.for("react.provider") : 60109, s = e ? Symbol.for("react.context") : 60110, b = e ? Symbol.for("react.async_mode") : 60111, l = e ? Symbol.for("react.concurrent_mode") : 60111, p = e ? Symbol.for("react.forward_ref") : 60112, v = e ? Symbol.for("react.suspense") : 60113, m = e ? Symbol.for("react.suspense_list") : 60120, g = e ? Symbol.for("react.memo") : 60115, h = e ? Symbol.for("react.lazy") : 60116, y = e ? Symbol.for("react.block") : 60121, A = e ? Symbol.for("react.fundamental") : 60117, k = e ? Symbol.for("react.responder") : 60118, j = e ? Symbol.for("react.scope") : 60119;
108
- function I(c) {
109
- return typeof c == "string" || typeof c == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
110
- c === t || c === l || c === a || c === o || c === v || c === m || typeof c == "object" && c !== null && (c.$$typeof === h || c.$$typeof === g || c.$$typeof === f || c.$$typeof === s || c.$$typeof === p || c.$$typeof === A || c.$$typeof === k || c.$$typeof === j || c.$$typeof === y);
111
- }
112
- function N(c) {
113
- if (typeof c == "object" && c !== null) {
114
- var W = c.$$typeof;
115
- switch (W) {
116
- case r:
117
- var re = c.type;
118
- switch (re) {
119
- case b:
120
- case l:
121
- case t:
122
- case a:
123
- case o:
124
- case v:
125
- return re;
126
- default:
127
- var me = re && re.$$typeof;
128
- switch (me) {
129
- case s:
130
- case p:
131
- case h:
132
- case g:
133
- case f:
134
- return me;
135
- default:
136
- return W;
137
- }
138
- }
139
- case n:
140
- return W;
141
- }
142
- }
143
- }
144
- var u = b, q = l, ce = s, fe = f, se = r, de = p, K = t, X = h, H = g, B = n, Z = a, L = o, Y = v, Q = !1;
145
- function ee(c) {
146
- return Q || (Q = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), i(c) || N(c) === b;
147
- }
148
- function i(c) {
149
- return N(c) === l;
150
- }
151
- function d(c) {
152
- return N(c) === s;
153
- }
154
- function O(c) {
155
- return N(c) === f;
156
- }
157
- function T(c) {
158
- return typeof c == "object" && c !== null && c.$$typeof === r;
159
- }
160
- function E(c) {
161
- return N(c) === p;
162
- }
163
- function P(c) {
164
- return N(c) === t;
165
- }
166
- function S(c) {
167
- return N(c) === h;
168
- }
169
- function x(c) {
170
- return N(c) === g;
171
- }
172
- function w(c) {
173
- return N(c) === n;
174
- }
175
- function R(c) {
176
- return N(c) === a;
177
- }
178
- function _(c) {
179
- return N(c) === o;
180
- }
181
- function $(c) {
182
- return N(c) === v;
183
- }
184
- F.AsyncMode = u, F.ConcurrentMode = q, F.ContextConsumer = ce, F.ContextProvider = fe, F.Element = se, F.ForwardRef = de, F.Fragment = K, F.Lazy = X, F.Memo = H, F.Portal = B, F.Profiler = Z, F.StrictMode = L, F.Suspense = Y, F.isAsyncMode = ee, F.isConcurrentMode = i, F.isContextConsumer = d, F.isContextProvider = O, F.isElement = T, F.isForwardRef = E, F.isFragment = P, F.isLazy = S, F.isMemo = x, F.isPortal = w, F.isProfiler = R, F.isStrictMode = _, F.isSuspense = $, F.isValidElementType = I, F.typeOf = N;
185
- }()), F;
186
- }
187
- var Ze;
188
- function dr() {
189
- return Ze || (Ze = 1, process.env.NODE_ENV === "production" ? be.exports = Gr() : be.exports = Hr()), be.exports;
190
- }
191
- /*
192
- object-assign
193
- (c) Sindre Sorhus
194
- @license MIT
195
- */
196
- var ge, Qe;
197
- function Vr() {
198
- if (Qe)
199
- return ge;
200
- Qe = 1;
201
- var e = Object.getOwnPropertySymbols, r = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
202
- function t(a) {
203
- if (a == null)
204
- throw new TypeError("Object.assign cannot be called with null or undefined");
205
- return Object(a);
206
- }
207
- function o() {
208
- try {
209
- if (!Object.assign)
210
- return !1;
211
- var a = new String("abc");
212
- if (a[5] = "de", Object.getOwnPropertyNames(a)[0] === "5")
213
- return !1;
214
- for (var f = {}, s = 0; s < 10; s++)
215
- f["_" + String.fromCharCode(s)] = s;
216
- var b = Object.getOwnPropertyNames(f).map(function(p) {
217
- return f[p];
218
- });
219
- if (b.join("") !== "0123456789")
220
- return !1;
221
- var l = {};
222
- return "abcdefghijklmnopqrst".split("").forEach(function(p) {
223
- l[p] = p;
224
- }), Object.keys(Object.assign({}, l)).join("") === "abcdefghijklmnopqrst";
225
- } catch {
226
- return !1;
227
- }
228
- }
229
- return ge = o() ? Object.assign : function(a, f) {
230
- for (var s, b = t(a), l, p = 1; p < arguments.length; p++) {
231
- s = Object(arguments[p]);
232
- for (var v in s)
233
- r.call(s, v) && (b[v] = s[v]);
234
- if (e) {
235
- l = e(s);
236
- for (var m = 0; m < l.length; m++)
237
- n.call(s, l[m]) && (b[l[m]] = s[l[m]]);
238
- }
239
- }
240
- return b;
241
- }, ge;
242
- }
243
- var Te, er;
244
- function je() {
245
- if (er)
246
- return Te;
247
- er = 1;
248
- var e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
249
- return Te = e, Te;
250
- }
251
- var Oe, rr;
252
- function lr() {
253
- return rr || (rr = 1, Oe = Function.call.bind(Object.prototype.hasOwnProperty)), Oe;
254
- }
255
- var Se, nr;
256
- function zr() {
257
- if (nr)
258
- return Se;
259
- nr = 1;
260
- var e = function() {
261
- };
262
- if (process.env.NODE_ENV !== "production") {
263
- var r = je(), n = {}, t = lr();
264
- e = function(a) {
265
- var f = "Warning: " + a;
266
- typeof console < "u" && console.error(f);
267
- try {
268
- throw new Error(f);
269
- } catch {
270
- }
271
- };
272
- }
273
- function o(a, f, s, b, l) {
274
- if (process.env.NODE_ENV !== "production") {
275
- for (var p in a)
276
- if (t(a, p)) {
277
- var v;
278
- try {
279
- if (typeof a[p] != "function") {
280
- var m = Error(
281
- (b || "React class") + ": " + s + " type `" + p + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[p] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
282
- );
283
- throw m.name = "Invariant Violation", m;
284
- }
285
- v = a[p](f, p, b, s, null, r);
286
- } catch (h) {
287
- v = h;
288
- }
289
- if (v && !(v instanceof Error) && e(
290
- (b || "React class") + ": type specification of " + s + " `" + p + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof v + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
291
- ), v instanceof Error && !(v.message in n)) {
292
- n[v.message] = !0;
293
- var g = l ? l() : "";
294
- e(
295
- "Failed " + s + " type: " + v.message + (g ?? "")
296
- );
297
- }
298
- }
299
- }
300
- }
301
- return o.resetWarningCache = function() {
302
- process.env.NODE_ENV !== "production" && (n = {});
303
- }, Se = o, Se;
304
- }
305
- var xe, tr;
306
- function Jr() {
307
- if (tr)
308
- return xe;
309
- tr = 1;
310
- var e = dr(), r = Vr(), n = je(), t = lr(), o = zr(), a = function() {
311
- };
312
- process.env.NODE_ENV !== "production" && (a = function(s) {
313
- var b = "Warning: " + s;
314
- typeof console < "u" && console.error(b);
315
- try {
316
- throw new Error(b);
317
- } catch {
318
- }
319
- });
320
- function f() {
321
- return null;
322
- }
323
- return xe = function(s, b) {
324
- var l = typeof Symbol == "function" && Symbol.iterator, p = "@@iterator";
325
- function v(i) {
326
- var d = i && (l && i[l] || i[p]);
327
- if (typeof d == "function")
328
- return d;
329
- }
330
- var m = "<<anonymous>>", g = {
331
- array: k("array"),
332
- bigint: k("bigint"),
333
- bool: k("boolean"),
334
- func: k("function"),
335
- number: k("number"),
336
- object: k("object"),
337
- string: k("string"),
338
- symbol: k("symbol"),
339
- any: j(),
340
- arrayOf: I,
341
- element: N(),
342
- elementType: u(),
343
- instanceOf: q,
344
- node: de(),
345
- objectOf: fe,
346
- oneOf: ce,
347
- oneOfType: se,
348
- shape: X,
349
- exact: H
350
- };
351
- function h(i, d) {
352
- return i === d ? i !== 0 || 1 / i === 1 / d : i !== i && d !== d;
353
- }
354
- function y(i, d) {
355
- this.message = i, this.data = d && typeof d == "object" ? d : {}, this.stack = "";
356
- }
357
- y.prototype = Error.prototype;
358
- function A(i) {
359
- if (process.env.NODE_ENV !== "production")
360
- var d = {}, O = 0;
361
- function T(P, S, x, w, R, _, $) {
362
- if (w = w || m, _ = _ || x, $ !== n) {
363
- if (b) {
364
- var c = new Error(
365
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
366
- );
367
- throw c.name = "Invariant Violation", c;
368
- } else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
369
- var W = w + ":" + x;
370
- !d[W] && // Avoid spamming the console because they are often not actionable except for lib authors
371
- O < 3 && (a(
372
- "You are manually calling a React.PropTypes validation function for the `" + _ + "` prop on `" + w + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
373
- ), d[W] = !0, O++);
374
- }
375
- }
376
- return S[x] == null ? P ? S[x] === null ? new y("The " + R + " `" + _ + "` is marked as required " + ("in `" + w + "`, but its value is `null`.")) : new y("The " + R + " `" + _ + "` is marked as required in " + ("`" + w + "`, but its value is `undefined`.")) : null : i(S, x, w, R, _);
377
- }
378
- var E = T.bind(null, !1);
379
- return E.isRequired = T.bind(null, !0), E;
380
- }
381
- function k(i) {
382
- function d(O, T, E, P, S, x) {
383
- var w = O[T], R = L(w);
384
- if (R !== i) {
385
- var _ = Y(w);
386
- return new y(
387
- "Invalid " + P + " `" + S + "` of type " + ("`" + _ + "` supplied to `" + E + "`, expected ") + ("`" + i + "`."),
388
- { expectedType: i }
389
- );
390
- }
391
- return null;
392
- }
393
- return A(d);
394
- }
395
- function j() {
396
- return A(f);
397
- }
398
- function I(i) {
399
- function d(O, T, E, P, S) {
400
- if (typeof i != "function")
401
- return new y("Property `" + S + "` of component `" + E + "` has invalid PropType notation inside arrayOf.");
402
- var x = O[T];
403
- if (!Array.isArray(x)) {
404
- var w = L(x);
405
- return new y("Invalid " + P + " `" + S + "` of type " + ("`" + w + "` supplied to `" + E + "`, expected an array."));
406
- }
407
- for (var R = 0; R < x.length; R++) {
408
- var _ = i(x, R, E, P, S + "[" + R + "]", n);
409
- if (_ instanceof Error)
410
- return _;
411
- }
412
- return null;
413
- }
414
- return A(d);
415
- }
416
- function N() {
417
- function i(d, O, T, E, P) {
418
- var S = d[O];
419
- if (!s(S)) {
420
- var x = L(S);
421
- return new y("Invalid " + E + " `" + P + "` of type " + ("`" + x + "` supplied to `" + T + "`, expected a single ReactElement."));
422
- }
423
- return null;
424
- }
425
- return A(i);
426
- }
427
- function u() {
428
- function i(d, O, T, E, P) {
429
- var S = d[O];
430
- if (!e.isValidElementType(S)) {
431
- var x = L(S);
432
- return new y("Invalid " + E + " `" + P + "` of type " + ("`" + x + "` supplied to `" + T + "`, expected a single ReactElement type."));
433
- }
434
- return null;
435
- }
436
- return A(i);
437
- }
438
- function q(i) {
439
- function d(O, T, E, P, S) {
440
- if (!(O[T] instanceof i)) {
441
- var x = i.name || m, w = ee(O[T]);
442
- return new y("Invalid " + P + " `" + S + "` of type " + ("`" + w + "` supplied to `" + E + "`, expected ") + ("instance of `" + x + "`."));
443
- }
444
- return null;
445
- }
446
- return A(d);
447
- }
448
- function ce(i) {
449
- if (!Array.isArray(i))
450
- return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? a(
451
- "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
452
- ) : a("Invalid argument supplied to oneOf, expected an array.")), f;
453
- function d(O, T, E, P, S) {
454
- for (var x = O[T], w = 0; w < i.length; w++)
455
- if (h(x, i[w]))
456
- return null;
457
- var R = JSON.stringify(i, function($, c) {
458
- var W = Y(c);
459
- return W === "symbol" ? String(c) : c;
460
- });
461
- return new y("Invalid " + P + " `" + S + "` of value `" + String(x) + "` " + ("supplied to `" + E + "`, expected one of " + R + "."));
462
- }
463
- return A(d);
464
- }
465
- function fe(i) {
466
- function d(O, T, E, P, S) {
467
- if (typeof i != "function")
468
- return new y("Property `" + S + "` of component `" + E + "` has invalid PropType notation inside objectOf.");
469
- var x = O[T], w = L(x);
470
- if (w !== "object")
471
- return new y("Invalid " + P + " `" + S + "` of type " + ("`" + w + "` supplied to `" + E + "`, expected an object."));
472
- for (var R in x)
473
- if (t(x, R)) {
474
- var _ = i(x, R, E, P, S + "." + R, n);
475
- if (_ instanceof Error)
476
- return _;
477
- }
478
- return null;
479
- }
480
- return A(d);
481
- }
482
- function se(i) {
483
- if (!Array.isArray(i))
484
- return process.env.NODE_ENV !== "production" && a("Invalid argument supplied to oneOfType, expected an instance of array."), f;
485
- for (var d = 0; d < i.length; d++) {
486
- var O = i[d];
487
- if (typeof O != "function")
488
- return a(
489
- "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + Q(O) + " at index " + d + "."
490
- ), f;
491
- }
492
- function T(E, P, S, x, w) {
493
- for (var R = [], _ = 0; _ < i.length; _++) {
494
- var $ = i[_], c = $(E, P, S, x, w, n);
495
- if (c == null)
496
- return null;
497
- c.data && t(c.data, "expectedType") && R.push(c.data.expectedType);
498
- }
499
- var W = R.length > 0 ? ", expected one of type [" + R.join(", ") + "]" : "";
500
- return new y("Invalid " + x + " `" + w + "` supplied to " + ("`" + S + "`" + W + "."));
501
- }
502
- return A(T);
503
- }
504
- function de() {
505
- function i(d, O, T, E, P) {
506
- return B(d[O]) ? null : new y("Invalid " + E + " `" + P + "` supplied to " + ("`" + T + "`, expected a ReactNode."));
507
- }
508
- return A(i);
509
- }
510
- function K(i, d, O, T, E) {
511
- return new y(
512
- (i || "React class") + ": " + d + " type `" + O + "." + T + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + E + "`."
513
- );
514
- }
515
- function X(i) {
516
- function d(O, T, E, P, S) {
517
- var x = O[T], w = L(x);
518
- if (w !== "object")
519
- return new y("Invalid " + P + " `" + S + "` of type `" + w + "` " + ("supplied to `" + E + "`, expected `object`."));
520
- for (var R in i) {
521
- var _ = i[R];
522
- if (typeof _ != "function")
523
- return K(E, P, S, R, Y(_));
524
- var $ = _(x, R, E, P, S + "." + R, n);
525
- if ($)
526
- return $;
527
- }
528
- return null;
529
- }
530
- return A(d);
531
- }
532
- function H(i) {
533
- function d(O, T, E, P, S) {
534
- var x = O[T], w = L(x);
535
- if (w !== "object")
536
- return new y("Invalid " + P + " `" + S + "` of type `" + w + "` " + ("supplied to `" + E + "`, expected `object`."));
537
- var R = r({}, O[T], i);
538
- for (var _ in R) {
539
- var $ = i[_];
540
- if (t(i, _) && typeof $ != "function")
541
- return K(E, P, S, _, Y($));
542
- if (!$)
543
- return new y(
544
- "Invalid " + P + " `" + S + "` key `" + _ + "` supplied to `" + E + "`.\nBad object: " + JSON.stringify(O[T], null, " ") + `
545
- Valid keys: ` + JSON.stringify(Object.keys(i), null, " ")
546
- );
547
- var c = $(x, _, E, P, S + "." + _, n);
548
- if (c)
549
- return c;
550
- }
551
- return null;
552
- }
553
- return A(d);
554
- }
555
- function B(i) {
556
- switch (typeof i) {
557
- case "number":
558
- case "string":
559
- case "undefined":
560
- return !0;
561
- case "boolean":
562
- return !i;
563
- case "object":
564
- if (Array.isArray(i))
565
- return i.every(B);
566
- if (i === null || s(i))
567
- return !0;
568
- var d = v(i);
569
- if (d) {
570
- var O = d.call(i), T;
571
- if (d !== i.entries) {
572
- for (; !(T = O.next()).done; )
573
- if (!B(T.value))
574
- return !1;
575
- } else
576
- for (; !(T = O.next()).done; ) {
577
- var E = T.value;
578
- if (E && !B(E[1]))
579
- return !1;
580
- }
581
- } else
582
- return !1;
583
- return !0;
584
- default:
585
- return !1;
586
- }
587
- }
588
- function Z(i, d) {
589
- return i === "symbol" ? !0 : d ? d["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && d instanceof Symbol : !1;
590
- }
591
- function L(i) {
592
- var d = typeof i;
593
- return Array.isArray(i) ? "array" : i instanceof RegExp ? "object" : Z(d, i) ? "symbol" : d;
594
- }
595
- function Y(i) {
596
- if (typeof i > "u" || i === null)
597
- return "" + i;
598
- var d = L(i);
599
- if (d === "object") {
600
- if (i instanceof Date)
601
- return "date";
602
- if (i instanceof RegExp)
603
- return "regexp";
604
- }
605
- return d;
606
- }
607
- function Q(i) {
608
- var d = Y(i);
609
- switch (d) {
610
- case "array":
611
- case "object":
612
- return "an " + d;
613
- case "boolean":
614
- case "date":
615
- case "regexp":
616
- return "a " + d;
617
- default:
618
- return d;
619
- }
620
- }
621
- function ee(i) {
622
- return !i.constructor || !i.constructor.name ? m : i.constructor.name;
623
- }
624
- return g.checkPropTypes = o, g.resetWarningCache = o.resetWarningCache, g.PropTypes = g, g;
625
- }, xe;
626
- }
627
- var Pe, or;
628
- function Kr() {
629
- if (or)
630
- return Pe;
631
- or = 1;
632
- var e = je();
633
- function r() {
634
- }
635
- function n() {
636
- }
637
- return n.resetWarningCache = r, Pe = function() {
638
- function t(f, s, b, l, p, v) {
639
- if (v !== e) {
640
- var m = new Error(
641
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
642
- );
643
- throw m.name = "Invariant Violation", m;
644
- }
645
- }
646
- t.isRequired = t;
647
- function o() {
648
- return t;
649
- }
650
- var a = {
651
- array: t,
652
- bigint: t,
653
- bool: t,
654
- func: t,
655
- number: t,
656
- object: t,
657
- string: t,
658
- symbol: t,
659
- any: t,
660
- arrayOf: o,
661
- element: t,
662
- elementType: t,
663
- instanceOf: o,
664
- node: t,
665
- objectOf: o,
666
- oneOf: o,
667
- oneOfType: o,
668
- shape: o,
669
- exact: o,
670
- checkPropTypes: n,
671
- resetWarningCache: r
672
- };
673
- return a.PropTypes = a, a;
674
- }, Pe;
675
- }
676
- if (process.env.NODE_ENV !== "production") {
677
- var Xr = dr(), Zr = !0;
678
- Ae.exports = Jr()(Xr.isElement, Zr);
679
- } else
680
- Ae.exports = Kr()();
681
- var M = Ae.exports;
682
- const vr = /* @__PURE__ */ Wr(M);
683
- var Ie = "data-focus-lock", pr = "data-focus-lock-disabled", Qr = "data-no-focus-lock", en = "data-autofocus-inside", rn = "data-no-autofocus", we = {
684
- width: "1px",
685
- height: "0px",
686
- padding: 0,
687
- overflow: "hidden",
688
- position: "fixed",
689
- top: "1px",
690
- left: "1px"
691
- };
692
- process.env.NODE_ENV !== "production" && vr.node;
693
- var yr = Ne({}, function(e) {
694
- var r = e.target, n = e.currentTarget;
695
- return {
696
- target: r,
697
- currentTarget: n
698
- };
699
- }), mr = Ne(), nn = Ne(), tn = Ur({
700
- async: !0,
701
- ssr: typeof document < "u"
702
- }), on = /* @__PURE__ */ $r(void 0), an = [], $e = /* @__PURE__ */ D.forwardRef(function(r, n) {
703
- var t, o = D.useState(), a = o[0], f = o[1], s = D.useRef(), b = D.useRef(!1), l = D.useRef(null), p = D.useState({}), v = p[1], m = r.children, g = r.disabled, h = g === void 0 ? !1 : g, y = r.noFocusGuards, A = y === void 0 ? !1 : y, k = r.persistentFocus, j = k === void 0 ? !1 : k, I = r.crossFrame, N = I === void 0 ? !0 : I, u = r.autoFocus, q = u === void 0 ? !0 : u, ce = r.allowTextSelection, fe = r.group, se = r.className, de = r.whiteList, K = r.hasPositiveIndices, X = r.shards, H = X === void 0 ? an : X, B = r.as, Z = B === void 0 ? "div" : B, L = r.lockProps, Y = L === void 0 ? {} : L, Q = r.sideCar, ee = r.returnFocus, i = ee === void 0 ? !1 : ee, d = r.focusOptions, O = r.onActivation, T = r.onDeactivation, E = D.useState({}), P = E[0], S = D.useCallback(function(G) {
704
- var ne = G.captureFocusRestore;
705
- if (!l.current) {
706
- var te, V = (te = document) == null ? void 0 : te.activeElement;
707
- l.current = V, V !== document.body && (l.current = ne(V));
708
- }
709
- s.current && O && O(s.current), b.current = !0, v();
710
- }, [O]), x = D.useCallback(function() {
711
- b.current = !1, T && T(s.current), v();
712
- }, [T]), w = D.useCallback(function(G) {
713
- var ne = l.current;
714
- if (ne) {
715
- var te = (typeof ne == "function" ? ne() : ne) || document.body, V = typeof i == "function" ? i(te) : i;
716
- if (V) {
717
- var Je = typeof V == "object" ? V : void 0;
718
- l.current = null, G ? Promise.resolve().then(function() {
719
- return te.focus(Je);
720
- }) : te.focus(Je);
721
- }
722
- }
723
- }, [i]), R = D.useCallback(function(G) {
724
- b.current && yr.useMedium(G);
725
- }, []), _ = mr.useMedium, $ = D.useCallback(function(G) {
726
- s.current !== G && (s.current = G, f(G));
727
- }, []);
728
- process.env.NODE_ENV !== "production" && (typeof ce < "u" && console.warn("React-Focus-Lock: allowTextSelection is deprecated and enabled by default"), D.useEffect(function() {
729
- !s.current && typeof Z != "string" && console.error("FocusLock: could not obtain ref to internal node");
730
- }, []));
731
- var c = Fe((t = {}, t[pr] = h && "disabled", t[Ie] = fe, t), Y), W = A !== !0, re = W && A !== "tail", me = qr([n, $]), Nr = D.useMemo(function() {
732
- return {
733
- observed: s,
734
- shards: H,
735
- enabled: !h,
736
- active: b.current
737
- };
738
- }, [h, b.current, H, a]);
739
- return /* @__PURE__ */ D.createElement(D.Fragment, null, W && [
740
- /* @__PURE__ */ D.createElement("div", {
741
- key: "guard-first",
742
- "data-focus-guard": !0,
743
- tabIndex: h ? -1 : 0,
744
- style: we
745
- }),
746
- K ? /* @__PURE__ */ D.createElement("div", {
747
- key: "guard-nearest",
748
- "data-focus-guard": !0,
749
- tabIndex: h ? -1 : 1,
750
- style: we
751
- }) : null
752
- ], !h && /* @__PURE__ */ D.createElement(Q, {
753
- id: P,
754
- sideCar: tn,
755
- observed: a,
756
- disabled: h,
757
- persistentFocus: j,
758
- crossFrame: N,
759
- autoFocus: q,
760
- whiteList: de,
761
- shards: H,
762
- onActivation: S,
763
- onDeactivation: x,
764
- returnFocus: w,
765
- focusOptions: d
766
- }), /* @__PURE__ */ D.createElement(Z, Fe({
767
- ref: me
768
- }, c, {
769
- className: se,
770
- onBlur: _,
771
- onFocus: R
772
- }), /* @__PURE__ */ D.createElement(on.Provider, {
773
- value: Nr
774
- }, m)), re && /* @__PURE__ */ D.createElement("div", {
775
- "data-focus-guard": !0,
776
- tabIndex: h ? -1 : 0,
777
- style: we
778
- }));
779
- });
780
- $e.propTypes = process.env.NODE_ENV !== "production" ? {
781
- children: M.node,
782
- disabled: M.bool,
783
- returnFocus: M.oneOfType([M.bool, M.object, M.func]),
784
- focusOptions: M.object,
785
- noFocusGuards: M.bool,
786
- hasPositiveIndices: M.bool,
787
- allowTextSelection: M.bool,
788
- autoFocus: M.bool,
789
- persistentFocus: M.bool,
790
- crossFrame: M.bool,
791
- group: M.string,
792
- className: M.string,
793
- whiteList: M.func,
794
- shards: M.arrayOf(M.any),
795
- as: M.oneOfType([M.string, M.func, M.object]),
796
- lockProps: M.object,
797
- onActivation: M.func,
798
- onDeactivation: M.func,
799
- sideCar: M.any.isRequired
800
- } : {};
801
- function ve(e) {
802
- "@babel/helpers - typeof";
803
- return ve = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
804
- return typeof r;
805
- } : function(r) {
806
- return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
807
- }, ve(e);
808
- }
809
- function un(e, r) {
810
- if (ve(e) != "object" || !e)
811
- return e;
812
- var n = e[Symbol.toPrimitive];
813
- if (n !== void 0) {
814
- var t = n.call(e, r || "default");
815
- if (ve(t) != "object")
816
- return t;
817
- throw new TypeError("@@toPrimitive must return a primitive value.");
818
- }
819
- return (r === "string" ? String : Number)(e);
820
- }
821
- function cn(e) {
822
- var r = un(e, "string");
823
- return ve(r) == "symbol" ? r : r + "";
824
- }
825
- function fn(e, r, n) {
826
- return (r = cn(r)) in e ? Object.defineProperty(e, r, {
827
- value: n,
828
- enumerable: !0,
829
- configurable: !0,
830
- writable: !0
831
- }) : e[r] = n, e;
832
- }
833
- function sn(e, r) {
834
- if (process.env.NODE_ENV !== "production") {
835
- if (typeof e != "function")
836
- throw new Error("Expected reducePropsToState to be a function.");
837
- if (typeof r != "function")
838
- throw new Error("Expected handleStateChangeOnClient to be a function.");
839
- }
840
- function n(t) {
841
- return t.displayName || t.name || "Component";
842
- }
843
- return function(o) {
844
- if (process.env.NODE_ENV !== "production" && typeof o != "function")
845
- throw new Error("Expected WrappedComponent to be a React component.");
846
- var a = [], f;
847
- function s() {
848
- f = e(a.map(function(l) {
849
- return l.props;
850
- })), r(f);
851
- }
852
- var b = /* @__PURE__ */ function(l) {
853
- Br(p, l);
854
- function p() {
855
- return l.apply(this, arguments) || this;
856
- }
857
- p.peek = function() {
858
- return f;
859
- };
860
- var v = p.prototype;
861
- return v.componentDidMount = function() {
862
- a.push(this), s();
863
- }, v.componentDidUpdate = function() {
864
- s();
865
- }, v.componentWillUnmount = function() {
866
- var g = a.indexOf(this);
867
- a.splice(g, 1), s();
868
- }, v.render = function() {
869
- return /* @__PURE__ */ jr.createElement(o, this.props);
870
- }, p;
871
- }(Lr);
872
- return fn(b, "displayName", "SideEffect(" + n(o) + ")"), b;
873
- };
874
- }
875
- var U = function(e) {
876
- for (var r = Array(e.length), n = 0; n < e.length; ++n)
877
- r[n] = e[n];
878
- return r;
879
- }, J = function(e) {
880
- return Array.isArray(e) ? e : [e];
881
- }, br = function(e) {
882
- return Array.isArray(e) ? e[0] : e;
883
- }, dn = function(e) {
884
- if (e.nodeType !== Node.ELEMENT_NODE)
885
- return !1;
886
- var r = window.getComputedStyle(e, null);
887
- return !r || !r.getPropertyValue ? !1 : r.getPropertyValue("display") === "none" || r.getPropertyValue("visibility") === "hidden";
888
- }, hr = function(e) {
889
- return e.parentNode && e.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? (
890
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
891
- e.parentNode.host
892
- ) : e.parentNode;
893
- }, Er = function(e) {
894
- return e === document || e && e.nodeType === Node.DOCUMENT_NODE;
895
- }, ln = function(e) {
896
- return e.hasAttribute("inert");
897
- }, vn = function(e, r) {
898
- return !e || Er(e) || !dn(e) && !ln(e) && r(hr(e));
899
- }, gr = function(e, r) {
900
- var n = e.get(r);
901
- if (n !== void 0)
902
- return n;
903
- var t = vn(r, gr.bind(void 0, e));
904
- return e.set(r, t), t;
905
- }, pn = function(e, r) {
906
- return e && !Er(e) ? bn(e) ? r(hr(e)) : !1 : !0;
907
- }, Tr = function(e, r) {
908
- var n = e.get(r);
909
- if (n !== void 0)
910
- return n;
911
- var t = pn(r, Tr.bind(void 0, e));
912
- return e.set(r, t), t;
913
- }, Or = function(e) {
914
- return e.dataset;
915
- }, yn = function(e) {
916
- return e.tagName === "BUTTON";
917
- }, Sr = function(e) {
918
- return e.tagName === "INPUT";
919
- }, xr = function(e) {
920
- return Sr(e) && e.type === "radio";
921
- }, mn = function(e) {
922
- return !((Sr(e) || yn(e)) && (e.type === "hidden" || e.disabled));
923
- }, bn = function(e) {
924
- var r = e.getAttribute(rn);
925
- return ![!0, "true", ""].includes(r);
926
- }, Le = function(e) {
927
- var r;
928
- return !!(e && (!((r = Or(e)) === null || r === void 0) && r.focusGuard));
929
- }, Me = function(e) {
930
- return !Le(e);
931
- }, hn = function(e) {
932
- return !!e;
933
- }, En = function(e, r) {
934
- var n = Math.max(0, e.tabIndex), t = Math.max(0, r.tabIndex), o = n - t, a = e.index - r.index;
935
- if (o) {
936
- if (!n)
937
- return 1;
938
- if (!t)
939
- return -1;
940
- }
941
- return o || a;
942
- }, gn = function(e) {
943
- return e.tabIndex < 0 && !e.hasAttribute("tabindex") ? 0 : e.tabIndex;
944
- }, We = function(e, r, n) {
945
- return U(e).map(function(t, o) {
946
- var a = gn(t);
947
- return {
948
- node: t,
949
- index: o,
950
- tabIndex: n && a === -1 ? (t.dataset || {}).focusGuard ? 0 : -1 : a
951
- };
952
- }).filter(function(t) {
953
- return !r || t.tabIndex >= 0;
954
- }).sort(En);
955
- }, Tn = [
956
- "button:enabled",
957
- "select:enabled",
958
- "textarea:enabled",
959
- "input:enabled",
960
- // elements with explicit roles will also use explicit tabindex
961
- // '[role="button"]',
962
- "a[href]",
963
- "area[href]",
964
- "summary",
965
- "iframe",
966
- "object",
967
- "embed",
968
- "audio[controls]",
969
- "video[controls]",
970
- "[tabindex]",
971
- "[contenteditable]",
972
- "[autofocus]"
973
- ], Ue = Tn.join(","), On = "".concat(Ue, ", [data-focus-guard]"), Pr = function(e, r) {
974
- return U((e.shadowRoot || e).children).reduce(function(n, t) {
975
- return n.concat(t.matches(r ? On : Ue) ? [t] : [], Pr(t));
976
- }, []);
977
- }, Sn = function(e, r) {
978
- var n;
979
- return e instanceof HTMLIFrameElement && (!((n = e.contentDocument) === null || n === void 0) && n.body) ? ue([e.contentDocument.body], r) : [e];
980
- }, ue = function(e, r) {
981
- return e.reduce(function(n, t) {
982
- var o, a = Pr(t, r), f = (o = []).concat.apply(o, a.map(function(s) {
983
- return Sn(s, r);
984
- }));
985
- return n.concat(
986
- // add all tabbables inside and within shadow DOMs in DOM order
987
- f,
988
- // add if node is tabbable itself
989
- t.parentNode ? U(t.parentNode.querySelectorAll(Ue)).filter(function(s) {
990
- return s === t;
991
- }) : []
992
- );
993
- }, []);
994
- }, xn = function(e) {
995
- var r = e.querySelectorAll("[".concat(en, "]"));
996
- return U(r).map(function(n) {
997
- return ue([n]);
998
- }).reduce(function(n, t) {
999
- return n.concat(t);
1000
- }, []);
1001
- }, qe = function(e, r) {
1002
- return U(e).filter(function(n) {
1003
- return gr(r, n);
1004
- }).filter(function(n) {
1005
- return mn(n);
1006
- });
1007
- }, ar = function(e, r) {
1008
- return r === void 0 && (r = /* @__PURE__ */ new Map()), U(e).filter(function(n) {
1009
- return Tr(r, n);
1010
- });
1011
- }, Be = function(e, r, n) {
1012
- return We(qe(ue(e, n), r), !0, n);
1013
- }, he = function(e, r) {
1014
- return We(qe(ue(e), r), !1);
1015
- }, Pn = function(e, r) {
1016
- return qe(xn(e), r);
1017
- }, z = function(e, r) {
1018
- return e.shadowRoot ? z(e.shadowRoot, r) : Object.getPrototypeOf(e).contains !== void 0 && Object.getPrototypeOf(e).contains.call(e, r) ? !0 : U(e.children).some(function(n) {
1019
- var t;
1020
- if (n instanceof HTMLIFrameElement) {
1021
- var o = (t = n.contentDocument) === null || t === void 0 ? void 0 : t.body;
1022
- return o ? z(o, r) : !1;
1023
- }
1024
- return z(n, r);
1025
- });
1026
- }, wn = function(e) {
1027
- for (var r = /* @__PURE__ */ new Set(), n = e.length, t = 0; t < n; t += 1)
1028
- for (var o = t + 1; o < n; o += 1) {
1029
- var a = e[t].compareDocumentPosition(e[o]);
1030
- (a & Node.DOCUMENT_POSITION_CONTAINED_BY) > 0 && r.add(o), (a & Node.DOCUMENT_POSITION_CONTAINS) > 0 && r.add(t);
1031
- }
1032
- return e.filter(function(f, s) {
1033
- return !r.has(s);
1034
- });
1035
- }, wr = function(e) {
1036
- return e.parentNode ? wr(e.parentNode) : e;
1037
- }, Ye = function(e) {
1038
- var r = J(e);
1039
- return r.filter(Boolean).reduce(function(n, t) {
1040
- var o = t.getAttribute(Ie);
1041
- return n.push.apply(n, o ? wn(U(wr(t).querySelectorAll("[".concat(Ie, '="').concat(o, '"]:not([').concat(pr, '="disabled"])')))) : [t]), n;
1042
- }, []);
1043
- }, _n = function(e) {
1044
- try {
1045
- return e();
1046
- } catch {
1047
- return;
1048
- }
1049
- }, pe = function(e) {
1050
- if (e === void 0 && (e = document), !(!e || !e.activeElement)) {
1051
- var r = e.activeElement;
1052
- return r.shadowRoot ? pe(r.shadowRoot) : r instanceof HTMLIFrameElement && _n(function() {
1053
- return r.contentWindow.document;
1054
- }) ? pe(r.contentWindow.document) : r;
1055
- }
1056
- }, Rn = function(e, r) {
1057
- return e === r;
1058
- }, Cn = function(e, r) {
1059
- return !!U(e.querySelectorAll("iframe")).some(function(n) {
1060
- return Rn(n, r);
1061
- });
1062
- }, _r = function(e, r) {
1063
- return r === void 0 && (r = pe(br(e).ownerDocument)), !r || r.dataset && r.dataset.focusGuard ? !1 : Ye(e).some(function(n) {
1064
- return z(n, r) || Cn(n, r);
1065
- });
1066
- }, Fn = function(e) {
1067
- e === void 0 && (e = document);
1068
- var r = pe(e);
1069
- return r ? U(e.querySelectorAll("[".concat(Qr, "]"))).some(function(n) {
1070
- return z(n, r);
1071
- }) : !1;
1072
- }, An = function(e, r) {
1073
- return r.filter(xr).filter(function(n) {
1074
- return n.name === e.name;
1075
- }).filter(function(n) {
1076
- return n.checked;
1077
- })[0] || e;
1078
- }, Ge = function(e, r) {
1079
- return xr(e) && e.name ? An(e, r) : e;
1080
- }, In = function(e) {
1081
- var r = /* @__PURE__ */ new Set();
1082
- return e.forEach(function(n) {
1083
- return r.add(Ge(n, e));
1084
- }), e.filter(function(n) {
1085
- return r.has(n);
1086
- });
1087
- }, ir = function(e) {
1088
- return e[0] && e.length > 1 ? Ge(e[0], e) : e[0];
1089
- }, ur = function(e, r) {
1090
- return e.indexOf(Ge(r, e));
1091
- }, De = "NEW_FOCUS", Mn = function(e, r, n, t, o) {
1092
- var a = e.length, f = e[0], s = e[a - 1], b = Le(t);
1093
- if (!(t && e.indexOf(t) >= 0)) {
1094
- var l = t !== void 0 ? n.indexOf(t) : -1, p = o ? n.indexOf(o) : l, v = o ? e.indexOf(o) : -1;
1095
- if (l === -1)
1096
- return v !== -1 ? v : De;
1097
- if (v === -1)
1098
- return De;
1099
- var m = l - p, g = n.indexOf(f), h = n.indexOf(s), y = In(n), A = t !== void 0 ? y.indexOf(t) : -1, k = A - (o ? y.indexOf(o) : l);
1100
- if (!m && v >= 0 || r.length === 0)
1101
- return v;
1102
- var j = ur(e, r[0]), I = ur(e, r[r.length - 1]);
1103
- if (l <= g && b && Math.abs(m) > 1)
1104
- return I;
1105
- if (l >= h && b && Math.abs(m) > 1)
1106
- return j;
1107
- if (m && Math.abs(k) > 1)
1108
- return v;
1109
- if (l <= g)
1110
- return I;
1111
- if (l > h)
1112
- return j;
1113
- if (m)
1114
- return Math.abs(m) > 1 ? v : (a + v + m) % a;
1115
- }
1116
- }, Dn = function(e) {
1117
- return function(r) {
1118
- var n, t = (n = Or(r)) === null || n === void 0 ? void 0 : n.autofocus;
1119
- return (
1120
- // @ts-expect-error
1121
- r.autofocus || //
1122
- t !== void 0 && t !== "false" || //
1123
- e.indexOf(r) >= 0
1124
- );
1125
- };
1126
- }, cr = function(e, r, n) {
1127
- var t = e.map(function(a) {
1128
- var f = a.node;
1129
- return f;
1130
- }), o = ar(t.filter(Dn(n)));
1131
- return o && o.length ? ir(o) : ir(ar(r));
1132
- }, ke = function(e, r) {
1133
- return r === void 0 && (r = []), r.push(e), e.parentNode && ke(e.parentNode.host || e.parentNode, r), r;
1134
- }, _e = function(e, r) {
1135
- for (var n = ke(e), t = ke(r), o = 0; o < n.length; o += 1) {
1136
- var a = n[o];
1137
- if (t.indexOf(a) >= 0)
1138
- return a;
1139
- }
1140
- return !1;
1141
- }, Rr = function(e, r, n) {
1142
- var t = J(e), o = J(r), a = t[0], f = !1;
1143
- return o.filter(Boolean).forEach(function(s) {
1144
- f = _e(f || s, s) || f, n.filter(Boolean).forEach(function(b) {
1145
- var l = _e(a, b);
1146
- l && (!f || z(l, f) ? f = l : f = _e(l, f));
1147
- });
1148
- }), f;
1149
- }, fr = function(e, r) {
1150
- return e.reduce(function(n, t) {
1151
- return n.concat(Pn(t, r));
1152
- }, []);
1153
- }, kn = function(e, r) {
1154
- var n = /* @__PURE__ */ new Map();
1155
- return r.forEach(function(t) {
1156
- return n.set(t.node, t);
1157
- }), e.map(function(t) {
1158
- return n.get(t);
1159
- }).filter(hn);
1160
- }, Nn = function(e, r) {
1161
- var n = pe(J(e).length > 0 ? document : br(e).ownerDocument), t = Ye(e).filter(Me), o = Rr(n || e, e, t), a = /* @__PURE__ */ new Map(), f = he(t, a), s = f.filter(function(h) {
1162
- var y = h.node;
1163
- return Me(y);
1164
- });
1165
- if (s[0]) {
1166
- var b = he([o], a).map(function(h) {
1167
- var y = h.node;
1168
- return y;
1169
- }), l = kn(b, s), p = l.map(function(h) {
1170
- var y = h.node;
1171
- return y;
1172
- }), v = l.filter(function(h) {
1173
- var y = h.tabIndex;
1174
- return y >= 0;
1175
- }).map(function(h) {
1176
- var y = h.node;
1177
- return y;
1178
- }), m = Mn(p, v, b, n, r);
1179
- if (m === De) {
1180
- var g = (
1181
- // first try only tabbable, and the fallback to all focusable, as long as at least one element should be picked for focus
1182
- cr(f, v, fr(t, a)) || cr(f, p, fr(t, a))
1183
- );
1184
- if (g)
1185
- return { node: g };
1186
- console.warn("focus-lock: cannot find any node to move focus into");
1187
- return;
1188
- }
1189
- return m === void 0 ? m : l[m];
1190
- }
1191
- }, jn = function(e) {
1192
- var r = Ye(e).filter(Me), n = Rr(e, e, r), t = We(ue([n], !0), !0, !0), o = ue(r, !1);
1193
- return t.map(function(a) {
1194
- var f = a.node, s = a.index;
1195
- return {
1196
- node: f,
1197
- index: s,
1198
- lockItem: o.indexOf(f) >= 0,
1199
- guard: Le(f)
1200
- };
1201
- });
1202
- }, He = function(e, r) {
1203
- e && ("focus" in e && e.focus(r), "contentWindow" in e && e.contentWindow && e.contentWindow.focus());
1204
- }, Re = 0, Ce = !1, Cr = function(e, r, n) {
1205
- n === void 0 && (n = {});
1206
- var t = Nn(e, r);
1207
- if (!Ce && t) {
1208
- if (Re > 2) {
1209
- console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"), Ce = !0, setTimeout(function() {
1210
- Ce = !1;
1211
- }, 1);
1212
- return;
1213
- }
1214
- Re++, He(t.node, n.focusOptions), Re--;
1215
- }
1216
- };
1217
- function le(e) {
1218
- if (!e)
1219
- return null;
1220
- if (typeof WeakRef > "u")
1221
- return function() {
1222
- return e || null;
1223
- };
1224
- var r = e ? new WeakRef(e) : null;
1225
- return function() {
1226
- return (r == null ? void 0 : r.deref()) || null;
1227
- };
1228
- }
1229
- var $n = function(e) {
1230
- if (!e)
1231
- return null;
1232
- for (var r = [], n = e; n && n !== document.body; )
1233
- r.push({
1234
- current: le(n),
1235
- parent: le(n.parentElement),
1236
- left: le(n.previousElementSibling),
1237
- right: le(n.nextElementSibling)
1238
- }), n = n.parentElement;
1239
- return {
1240
- element: le(e),
1241
- stack: r,
1242
- ownerDocument: e.ownerDocument
1243
- };
1244
- }, Ln = function(e) {
1245
- var r, n, t, o, a;
1246
- if (e)
1247
- for (var f = e.stack, s = e.ownerDocument, b = /* @__PURE__ */ new Map(), l = 0, p = f; l < p.length; l++) {
1248
- var v = p[l], m = (r = v.parent) === null || r === void 0 ? void 0 : r.call(v);
1249
- if (m && s.contains(m)) {
1250
- for (var g = (n = v.left) === null || n === void 0 ? void 0 : n.call(v), h = v.current(), y = m.contains(h) ? h : void 0, A = (t = v.right) === null || t === void 0 ? void 0 : t.call(v), k = Be([m], b), j = (
1251
- // that is element itself
1252
- (a = (o = y ?? // or something in it's place
1253
- (g == null ? void 0 : g.nextElementSibling)) !== null && o !== void 0 ? o : (
1254
- // or somebody to the right, still close enough
1255
- A
1256
- )) !== null && a !== void 0 ? a : (
1257
- // or somebody to the left, something?
1258
- g
1259
- )
1260
- ); j; ) {
1261
- for (var I = 0, N = k; I < N.length; I++) {
1262
- var u = N[I];
1263
- if (j != null && j.contains(u.node))
1264
- return u.node;
1265
- }
1266
- j = j.nextElementSibling;
1267
- }
1268
- if (k.length)
1269
- return k[0].node;
1270
- }
1271
- }
1272
- }, Wn = function(e) {
1273
- var r = $n(e);
1274
- return function() {
1275
- return Ln(r);
1276
- };
1277
- }, Un = function(e, r, n) {
1278
- if (!e || !r)
1279
- return console.error("no element or scope given"), {};
1280
- var t = J(r);
1281
- if (t.every(function(f) {
1282
- return !z(f, e);
1283
- }))
1284
- return console.error("Active element is not contained in the scope"), {};
1285
- var o = n ? Be(t, /* @__PURE__ */ new Map()) : he(t, /* @__PURE__ */ new Map()), a = o.findIndex(function(f) {
1286
- var s = f.node;
1287
- return s === e;
1288
- });
1289
- if (a !== -1)
1290
- return {
1291
- prev: o[a - 1],
1292
- next: o[a + 1],
1293
- first: o[0],
1294
- last: o[o.length - 1]
1295
- };
1296
- }, qn = function(e, r) {
1297
- var n = r ? Be(J(e), /* @__PURE__ */ new Map()) : he(J(e), /* @__PURE__ */ new Map());
1298
- return {
1299
- first: n[0],
1300
- last: n[n.length - 1]
1301
- };
1302
- }, Bn = function(e) {
1303
- return Object.assign({
1304
- scope: document.body,
1305
- cycle: !0,
1306
- onlyTabbable: !0
1307
- }, e);
1308
- }, Fr = function(e, r, n) {
1309
- r === void 0 && (r = {});
1310
- var t = Bn(r), o = Un(e, t.scope, t.onlyTabbable);
1311
- if (o) {
1312
- var a = n(o, t.cycle);
1313
- a && He(a.node, t.focusOptions);
1314
- }
1315
- }, Yn = function(e, r) {
1316
- r === void 0 && (r = {}), Fr(e, r, function(n, t) {
1317
- var o = n.next, a = n.first;
1318
- return o || t && a;
1319
- });
1320
- }, Gn = function(e, r) {
1321
- r === void 0 && (r = {}), Fr(e, r, function(n, t) {
1322
- var o = n.prev, a = n.last;
1323
- return o || t && a;
1324
- });
1325
- }, Ar = function(e, r, n) {
1326
- var t, o = qn(e, (t = r.onlyTabbable) !== null && t !== void 0 ? t : !0), a = o[n];
1327
- a && He(a.node, r.focusOptions);
1328
- }, Hn = function(e, r) {
1329
- r === void 0 && (r = {}), Ar(e, r, "first");
1330
- }, Vn = function(e, r) {
1331
- r === void 0 && (r = {}), Ar(e, r, "last");
1332
- };
1333
- function Ve(e) {
1334
- setTimeout(e, 1);
1335
- }
1336
- var zn = function(r) {
1337
- return r && "current" in r ? r.current : r;
1338
- }, Jn = function() {
1339
- return document && document.activeElement === document.body;
1340
- }, Kn = function() {
1341
- return Jn() || Fn();
1342
- }, ae = null, oe = null, ie = null, ye = !1, Xn = function() {
1343
- return !0;
1344
- }, Zn = function(r) {
1345
- return (ae.whiteList || Xn)(r);
1346
- }, Qn = function(r, n) {
1347
- ie = {
1348
- observerNode: r,
1349
- portaledElement: n
1350
- };
1351
- }, et = function(r) {
1352
- return ie && ie.portaledElement === r;
1353
- };
1354
- function sr(e, r, n, t) {
1355
- var o = null, a = e;
1356
- do {
1357
- var f = t[a];
1358
- if (f.guard)
1359
- f.node.dataset.focusAutoGuard && (o = f);
1360
- else if (f.lockItem) {
1361
- if (a !== e)
1362
- return;
1363
- o = null;
1364
- } else
1365
- break;
1366
- } while ((a += n) !== r);
1367
- o && (o.node.tabIndex = 0);
1368
- }
1369
- var rt = function(r) {
1370
- return r ? !!ye : ye === "meanwhile";
1371
- }, nt = function e(r, n, t) {
1372
- return n && (n.host === r && (!n.activeElement || t.contains(n.activeElement)) || n.parentNode && e(r, n.parentNode, t));
1373
- }, tt = function(r, n) {
1374
- return n.some(function(t) {
1375
- return nt(r, t, t);
1376
- });
1377
- }, Ee = function() {
1378
- var r = !1;
1379
- if (ae) {
1380
- var n = ae, t = n.observed, o = n.persistentFocus, a = n.autoFocus, f = n.shards, s = n.crossFrame, b = n.focusOptions, l = t || ie && ie.portaledElement, p = document && document.activeElement;
1381
- if (l) {
1382
- var v = [l].concat(f.map(zn).filter(Boolean));
1383
- if ((!p || Zn(p)) && (o || rt(s) || !Kn() || !oe && a) && (l && !(_r(v) || p && tt(p, v) || et(p)) && (document && !oe && p && !a ? (p.blur && p.blur(), document.body.focus()) : (r = Cr(v, oe, {
1384
- focusOptions: b
1385
- }), ie = {})), ye = !1, oe = document && document.activeElement), document && p !== document.activeElement && document.querySelector("[data-focus-auto-guard]")) {
1386
- var m = document && document.activeElement, g = jn(v), h = g.map(function(y) {
1387
- var A = y.node;
1388
- return A;
1389
- }).indexOf(m);
1390
- h > -1 && (g.filter(function(y) {
1391
- var A = y.guard, k = y.node;
1392
- return A && k.dataset.focusAutoGuard;
1393
- }).forEach(function(y) {
1394
- var A = y.node;
1395
- return A.removeAttribute("tabIndex");
1396
- }), sr(h, g.length, 1, g), sr(h, -1, -1, g));
1397
- }
1398
- }
1399
- }
1400
- return r;
1401
- }, Ir = function(r) {
1402
- Ee() && r && (r.stopPropagation(), r.preventDefault());
1403
- }, ze = function() {
1404
- return Ve(Ee);
1405
- }, ot = function(r) {
1406
- var n = r.target, t = r.currentTarget;
1407
- t.contains(n) || Qn(t, n);
1408
- }, at = function() {
1409
- return null;
1410
- };
1411
- process.env.NODE_ENV !== "production" && vr.node.isRequired;
1412
- var Mr = function() {
1413
- ye = "just", Ve(function() {
1414
- ye = "meanwhile";
1415
- });
1416
- }, it = function() {
1417
- document.addEventListener("focusin", Ir), document.addEventListener("focusout", ze), window.addEventListener("blur", Mr);
1418
- }, ut = function() {
1419
- document.removeEventListener("focusin", Ir), document.removeEventListener("focusout", ze), window.removeEventListener("blur", Mr);
1420
- };
1421
- function ct(e) {
1422
- return e.filter(function(r) {
1423
- var n = r.disabled;
1424
- return !n;
1425
- });
1426
- }
1427
- var Dr = {
1428
- moveFocusInside: Cr,
1429
- focusInside: _r,
1430
- focusNextElement: Yn,
1431
- focusPrevElement: Gn,
1432
- focusFirstElement: Hn,
1433
- focusLastElement: Vn,
1434
- captureFocusRestore: Wn
1435
- };
1436
- function ft(e) {
1437
- var r = e.slice(-1)[0];
1438
- r && !ae && it();
1439
- var n = ae, t = n && r && r.id === n.id;
1440
- ae = r, n && !t && (n.onDeactivation(), e.filter(function(o) {
1441
- var a = o.id;
1442
- return a === n.id;
1443
- }).length || n.returnFocus(!r)), r ? (oe = null, (!t || n.observed !== r.observed) && r.onActivation(Dr), Ee(), Ve(Ee)) : (ut(), oe = null);
1444
- }
1445
- yr.assignSyncMedium(ot);
1446
- mr.assignMedium(ze);
1447
- nn.assignMedium(function(e) {
1448
- return e(Dr);
1449
- });
1450
- const st = sn(ct, ft)(at);
1451
- var dt = /* @__PURE__ */ D.forwardRef(function(r, n) {
1452
- return /* @__PURE__ */ D.createElement($e, Fe({
1453
- sideCar: st,
1454
- ref: n
1455
- }, r));
1456
- }), kr = $e.propTypes || {};
1457
- kr.sideCar;
1458
- var lt = Yr(kr, ["sideCar"]);
1459
- dt.propTypes = process.env.NODE_ENV !== "production" ? lt : {};
1460
- export {
1461
- dt as F
1462
- };