react-composable-treeview 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.cjs.js → index.cjs} +8 -8
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/{index.es.js → index.js} +118 -118
- package/dist/index.js.map +1 -0
- package/package.json +3 -3
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Le, { createContext as Ne, useRef as
|
|
2
|
-
var se = { exports: {} },
|
|
1
|
+
import Le, { createContext as Ne, useRef as V, useCallback as Q, useState as $e, forwardRef as K, useContext as L } from "react";
|
|
2
|
+
var se = { exports: {} }, B = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.min.js
|
|
@@ -12,22 +12,22 @@ var se = { exports: {} }, G = {};
|
|
|
12
12
|
var Ie;
|
|
13
13
|
function br() {
|
|
14
14
|
if (Ie)
|
|
15
|
-
return
|
|
15
|
+
return B;
|
|
16
16
|
Ie = 1;
|
|
17
17
|
var t = Le, o = Symbol.for("react.element"), i = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, d = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
18
|
-
function s(
|
|
19
|
-
var g,
|
|
20
|
-
y !== void 0 && (w = "" + y),
|
|
21
|
-
for (g in
|
|
22
|
-
a.call(
|
|
23
|
-
if (
|
|
24
|
-
for (g in
|
|
25
|
-
|
|
26
|
-
return { $$typeof: o, type:
|
|
18
|
+
function s(p, h, y) {
|
|
19
|
+
var g, T = {}, w = null, O = null;
|
|
20
|
+
y !== void 0 && (w = "" + y), h.key !== void 0 && (w = "" + h.key), h.ref !== void 0 && (O = h.ref);
|
|
21
|
+
for (g in h)
|
|
22
|
+
a.call(h, g) && !f.hasOwnProperty(g) && (T[g] = h[g]);
|
|
23
|
+
if (p && p.defaultProps)
|
|
24
|
+
for (g in h = p.defaultProps, h)
|
|
25
|
+
T[g] === void 0 && (T[g] = h[g]);
|
|
26
|
+
return { $$typeof: o, type: p, key: w, ref: O, props: T, _owner: d.current };
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return B.Fragment = i, B.jsx = s, B.jsxs = s, B;
|
|
29
29
|
}
|
|
30
|
-
var
|
|
30
|
+
var q = {};
|
|
31
31
|
/**
|
|
32
32
|
* @license React
|
|
33
33
|
* react-jsx-runtime.development.js
|
|
@@ -40,7 +40,7 @@ var B = {};
|
|
|
40
40
|
var Ve;
|
|
41
41
|
function Rr() {
|
|
42
42
|
return Ve || (Ve = 1, process.env.NODE_ENV !== "production" && function() {
|
|
43
|
-
var t = Le, o = Symbol.for("react.element"), i = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), s = Symbol.for("react.provider"),
|
|
43
|
+
var t = Le, o = Symbol.for("react.element"), i = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), p = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), k = Symbol.iterator, E = "@@iterator";
|
|
44
44
|
function j(e) {
|
|
45
45
|
if (e === null || typeof e != "object")
|
|
46
46
|
return null;
|
|
@@ -52,10 +52,10 @@ function Rr() {
|
|
|
52
52
|
{
|
|
53
53
|
for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), u = 1; u < r; u++)
|
|
54
54
|
n[u - 1] = arguments[u];
|
|
55
|
-
|
|
55
|
+
C("error", e, n);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function C(e, r, n) {
|
|
59
59
|
{
|
|
60
60
|
var u = S.ReactDebugCurrentFrame, v = u.getStackAddendum();
|
|
61
61
|
v !== "" && (r += "%s", n = n.concat([v]));
|
|
@@ -65,10 +65,10 @@ function Rr() {
|
|
|
65
65
|
_.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, _);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
var
|
|
68
|
+
var D = !1, Ye = !1, Ue = !1, Ge = !1, Be = !1, le;
|
|
69
69
|
le = Symbol.for("react.module.reference");
|
|
70
70
|
function qe(e) {
|
|
71
|
-
return !!(typeof e == "string" || typeof e == "function" || e === a || e === f || Be || e === d || e === y || e === g || Ge || e === O ||
|
|
71
|
+
return !!(typeof e == "string" || typeof e == "function" || e === a || e === f || Be || e === d || e === y || e === g || Ge || e === O || D || Ye || Ue || typeof e == "object" && e !== null && (e.$$typeof === w || e.$$typeof === T || e.$$typeof === s || e.$$typeof === p || e.$$typeof === h || // This needs to include all possible module reference object
|
|
72
72
|
// types supported by any Flight configuration anywhere since
|
|
73
73
|
// we don't know which Flight build this will end up being used
|
|
74
74
|
// with.
|
|
@@ -107,15 +107,15 @@ function Rr() {
|
|
|
107
107
|
}
|
|
108
108
|
if (typeof e == "object")
|
|
109
109
|
switch (e.$$typeof) {
|
|
110
|
-
case
|
|
110
|
+
case p:
|
|
111
111
|
var r = e;
|
|
112
112
|
return de(r) + ".Consumer";
|
|
113
113
|
case s:
|
|
114
114
|
var n = e;
|
|
115
115
|
return de(n._context) + ".Provider";
|
|
116
|
-
case
|
|
116
|
+
case h:
|
|
117
117
|
return Ke(e, e.render, "ForwardRef");
|
|
118
|
-
case
|
|
118
|
+
case T:
|
|
119
119
|
var u = e.displayName || null;
|
|
120
120
|
return u !== null ? u : A(e.type) || "Memo";
|
|
121
121
|
case w: {
|
|
@@ -129,14 +129,14 @@ function Rr() {
|
|
|
129
129
|
}
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
132
|
-
var
|
|
132
|
+
var N = Object.assign, U = 0, ve, pe, he, _e, ge, be, Re;
|
|
133
133
|
function Ee() {
|
|
134
134
|
}
|
|
135
135
|
Ee.__reactDisabledLog = !0;
|
|
136
136
|
function Je() {
|
|
137
137
|
{
|
|
138
|
-
if (
|
|
139
|
-
ve = console.log,
|
|
138
|
+
if (U === 0) {
|
|
139
|
+
ve = console.log, pe = console.info, he = console.warn, _e = console.error, ge = console.group, be = console.groupCollapsed, Re = console.groupEnd;
|
|
140
140
|
var e = {
|
|
141
141
|
configurable: !0,
|
|
142
142
|
enumerable: !0,
|
|
@@ -153,42 +153,42 @@ function Rr() {
|
|
|
153
153
|
groupEnd: e
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
U++;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
function Me() {
|
|
160
160
|
{
|
|
161
|
-
if (
|
|
161
|
+
if (U--, U === 0) {
|
|
162
162
|
var e = {
|
|
163
163
|
configurable: !0,
|
|
164
164
|
enumerable: !0,
|
|
165
165
|
writable: !0
|
|
166
166
|
};
|
|
167
167
|
Object.defineProperties(console, {
|
|
168
|
-
log:
|
|
168
|
+
log: N({}, e, {
|
|
169
169
|
value: ve
|
|
170
170
|
}),
|
|
171
|
-
info:
|
|
172
|
-
value: he
|
|
173
|
-
}),
|
|
174
|
-
warn: L({}, e, {
|
|
171
|
+
info: N({}, e, {
|
|
175
172
|
value: pe
|
|
176
173
|
}),
|
|
177
|
-
|
|
174
|
+
warn: N({}, e, {
|
|
175
|
+
value: he
|
|
176
|
+
}),
|
|
177
|
+
error: N({}, e, {
|
|
178
178
|
value: _e
|
|
179
179
|
}),
|
|
180
|
-
group:
|
|
180
|
+
group: N({}, e, {
|
|
181
181
|
value: ge
|
|
182
182
|
}),
|
|
183
|
-
groupCollapsed:
|
|
183
|
+
groupCollapsed: N({}, e, {
|
|
184
184
|
value: be
|
|
185
185
|
}),
|
|
186
|
-
groupEnd:
|
|
186
|
+
groupEnd: N({}, e, {
|
|
187
187
|
value: Re
|
|
188
188
|
})
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
U < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
var re = S.ReactCurrentDispatcher, te;
|
|
@@ -259,14 +259,14 @@ function Rr() {
|
|
|
259
259
|
} catch (F) {
|
|
260
260
|
if (F && u && typeof F.stack == "string") {
|
|
261
261
|
for (var c = F.stack.split(`
|
|
262
|
-
`),
|
|
263
|
-
`), R = c.length - 1, m =
|
|
262
|
+
`), x = u.stack.split(`
|
|
263
|
+
`), R = c.length - 1, m = x.length - 1; R >= 1 && m >= 0 && c[R] !== x[m]; )
|
|
264
264
|
m--;
|
|
265
265
|
for (; R >= 1 && m >= 0; R--, m--)
|
|
266
|
-
if (c[R] !==
|
|
266
|
+
if (c[R] !== x[m]) {
|
|
267
267
|
if (R !== 1 || m !== 1)
|
|
268
268
|
do
|
|
269
|
-
if (R--, m--, m < 0 || c[R] !==
|
|
269
|
+
if (R--, m--, m < 0 || c[R] !== x[m]) {
|
|
270
270
|
var P = `
|
|
271
271
|
` + c[R].replace(" at new ", " at ");
|
|
272
272
|
return e.displayName && P.includes("<anonymous>") && (P = P.replace("<anonymous>", e.displayName)), typeof e == "function" && z.set(e, P), P;
|
|
@@ -278,7 +278,7 @@ function Rr() {
|
|
|
278
278
|
} finally {
|
|
279
279
|
ne = !1, re.current = _, Me(), Error.prepareStackTrace = v;
|
|
280
280
|
}
|
|
281
|
-
var
|
|
281
|
+
var W = e ? e.displayName || e.name : "", De = W ? M(W) : "";
|
|
282
282
|
return typeof e == "function" && z.set(e, De), De;
|
|
283
283
|
}
|
|
284
284
|
function Xe(e, r, n) {
|
|
@@ -303,9 +303,9 @@ function Rr() {
|
|
|
303
303
|
}
|
|
304
304
|
if (typeof e == "object")
|
|
305
305
|
switch (e.$$typeof) {
|
|
306
|
-
case
|
|
306
|
+
case h:
|
|
307
307
|
return Xe(e.render);
|
|
308
|
-
case
|
|
308
|
+
case T:
|
|
309
309
|
return X(e.type, r, n);
|
|
310
310
|
case w: {
|
|
311
311
|
var u = e, v = u._payload, _ = u._init;
|
|
@@ -333,8 +333,8 @@ function Rr() {
|
|
|
333
333
|
var c = void 0;
|
|
334
334
|
try {
|
|
335
335
|
if (typeof e[l] != "function") {
|
|
336
|
-
var
|
|
337
|
-
throw
|
|
336
|
+
var x = Error((u || "React class") + ": " + n + " type `" + l + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[l] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
337
|
+
throw x.name = "Invariant Violation", x;
|
|
338
338
|
}
|
|
339
339
|
c = e[l](r, l, u, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
340
340
|
} catch (R) {
|
|
@@ -368,12 +368,12 @@ function Rr() {
|
|
|
368
368
|
if (rr(e))
|
|
369
369
|
return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", er(e)), Te(e);
|
|
370
370
|
}
|
|
371
|
-
var
|
|
371
|
+
var G = S.ReactCurrentOwner, tr = {
|
|
372
372
|
key: !0,
|
|
373
373
|
ref: !0,
|
|
374
374
|
__self: !0,
|
|
375
375
|
__source: !0
|
|
376
|
-
},
|
|
376
|
+
}, Se, Ce, ae;
|
|
377
377
|
ae = {};
|
|
378
378
|
function nr(e) {
|
|
379
379
|
if (H.call(e, "ref")) {
|
|
@@ -392,15 +392,15 @@ function Rr() {
|
|
|
392
392
|
return e.key !== void 0;
|
|
393
393
|
}
|
|
394
394
|
function ar(e, r) {
|
|
395
|
-
if (typeof e.ref == "string" &&
|
|
396
|
-
var n = A(
|
|
397
|
-
ae[n] || (b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', A(
|
|
395
|
+
if (typeof e.ref == "string" && G.current && r && G.current.stateNode !== r) {
|
|
396
|
+
var n = A(G.current.type);
|
|
397
|
+
ae[n] || (b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', A(G.current.type), e.ref), ae[n] = !0);
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
function ir(e, r) {
|
|
401
401
|
{
|
|
402
402
|
var n = function() {
|
|
403
|
-
|
|
403
|
+
Se || (Se = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
404
404
|
};
|
|
405
405
|
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
406
406
|
get: n,
|
|
@@ -411,7 +411,7 @@ function Rr() {
|
|
|
411
411
|
function ur(e, r) {
|
|
412
412
|
{
|
|
413
413
|
var n = function() {
|
|
414
|
-
|
|
414
|
+
Ce || (Ce = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
415
415
|
};
|
|
416
416
|
n.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
417
417
|
get: n,
|
|
@@ -450,8 +450,8 @@ function Rr() {
|
|
|
450
450
|
};
|
|
451
451
|
function sr(e, r, n, u, v) {
|
|
452
452
|
{
|
|
453
|
-
var _, l = {}, c = null,
|
|
454
|
-
n !== void 0 && (xe(n), c = "" + n), or(r) && (xe(r.key), c = "" + r.key), nr(r) && (
|
|
453
|
+
var _, l = {}, c = null, x = null;
|
|
454
|
+
n !== void 0 && (xe(n), c = "" + n), or(r) && (xe(r.key), c = "" + r.key), nr(r) && (x = r.ref, ar(r, v));
|
|
455
455
|
for (_ in r)
|
|
456
456
|
H.call(r, _) && !tr.hasOwnProperty(_) && (l[_] = r[_]);
|
|
457
457
|
if (e && e.defaultProps) {
|
|
@@ -459,15 +459,15 @@ function Rr() {
|
|
|
459
459
|
for (_ in R)
|
|
460
460
|
l[_] === void 0 && (l[_] = R[_]);
|
|
461
461
|
}
|
|
462
|
-
if (c ||
|
|
462
|
+
if (c || x) {
|
|
463
463
|
var m = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
464
|
-
c && ir(l, m),
|
|
464
|
+
c && ir(l, m), x && ur(l, m);
|
|
465
465
|
}
|
|
466
|
-
return cr(e, c,
|
|
466
|
+
return cr(e, c, x, v, u, G.current, l);
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
var ie = S.ReactCurrentOwner, Pe = S.ReactDebugCurrentFrame;
|
|
470
|
-
function
|
|
470
|
+
function $(e) {
|
|
471
471
|
if (e) {
|
|
472
472
|
var r = e._owner, n = X(e.type, e._source, r ? r.type : null);
|
|
473
473
|
Pe.setExtraStackFrame(n);
|
|
@@ -525,7 +525,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
525
525
|
return;
|
|
526
526
|
ke[n] = !0;
|
|
527
527
|
var u = "";
|
|
528
|
-
e && e._owner && e._owner !== ie.current && (u = " It was passed a child from " + A(e._owner.type) + "."),
|
|
528
|
+
e && e._owner && e._owner !== ie.current && (u = " It was passed a child from " + A(e._owner.type) + "."), $(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, u), $(null);
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
531
|
function Ae(e, r) {
|
|
@@ -555,9 +555,9 @@ Check the top-level render call using <` + n + ">.");
|
|
|
555
555
|
var n;
|
|
556
556
|
if (typeof r == "function")
|
|
557
557
|
n = r.propTypes;
|
|
558
|
-
else if (typeof r == "object" && (r.$$typeof ===
|
|
558
|
+
else if (typeof r == "object" && (r.$$typeof === h || // Note: Memo only checks outer props here.
|
|
559
559
|
// Inner props are checked in the reconciler.
|
|
560
|
-
r.$$typeof ===
|
|
560
|
+
r.$$typeof === T))
|
|
561
561
|
n = r.propTypes;
|
|
562
562
|
else
|
|
563
563
|
return;
|
|
@@ -577,11 +577,11 @@ Check the top-level render call using <` + n + ">.");
|
|
|
577
577
|
for (var r = Object.keys(e.props), n = 0; n < r.length; n++) {
|
|
578
578
|
var u = r[n];
|
|
579
579
|
if (u !== "children" && u !== "key") {
|
|
580
|
-
|
|
580
|
+
$(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", u), $(null);
|
|
581
581
|
break;
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
-
e.ref !== null && (
|
|
584
|
+
e.ref !== null && ($(e), b("Invalid attribute `ref` supplied to `React.Fragment`."), $(null));
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
function Fe(e, r, n, u, v, _) {
|
|
@@ -590,8 +590,8 @@ Check the top-level render call using <` + n + ">.");
|
|
|
590
590
|
if (!l) {
|
|
591
591
|
var c = "";
|
|
592
592
|
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (c += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
593
|
-
var
|
|
594
|
-
|
|
593
|
+
var x = fr(v);
|
|
594
|
+
x ? c += x : c += Oe();
|
|
595
595
|
var R;
|
|
596
596
|
e === null ? R = "null" : oe(e) ? R = "array" : e !== void 0 && e.$$typeof === o ? (R = "<" + (A(e.type) || "Unknown") + " />", c = " Did you accidentally export a JSX literal instead of a component?") : R = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, c);
|
|
597
597
|
}
|
|
@@ -603,8 +603,8 @@ Check the top-level render call using <` + n + ">.");
|
|
|
603
603
|
if (P !== void 0)
|
|
604
604
|
if (u)
|
|
605
605
|
if (oe(P)) {
|
|
606
|
-
for (var
|
|
607
|
-
Ae(P[
|
|
606
|
+
for (var W = 0; W < P.length; W++)
|
|
607
|
+
Ae(P[W], e);
|
|
608
608
|
Object.freeze && Object.freeze(P);
|
|
609
609
|
} else
|
|
610
610
|
b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
@@ -614,19 +614,19 @@ Check the top-level render call using <` + n + ">.");
|
|
|
614
614
|
return e === a ? vr(m) : dr(m), m;
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function pr(e, r, n) {
|
|
618
618
|
return Fe(e, r, n, !0);
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function hr(e, r, n) {
|
|
621
621
|
return Fe(e, r, n, !1);
|
|
622
622
|
}
|
|
623
|
-
var _r =
|
|
624
|
-
|
|
625
|
-
}()),
|
|
623
|
+
var _r = hr, gr = pr;
|
|
624
|
+
q.Fragment = a, q.jsx = _r, q.jsxs = gr;
|
|
625
|
+
}()), q;
|
|
626
626
|
}
|
|
627
627
|
process.env.NODE_ENV === "production" ? se.exports = br() : se.exports = Rr();
|
|
628
|
-
var
|
|
629
|
-
const
|
|
628
|
+
var I = se.exports;
|
|
629
|
+
const J = Ne({
|
|
630
630
|
rootValue: /* @__PURE__ */ new Set(),
|
|
631
631
|
setRootValue: () => {
|
|
632
632
|
},
|
|
@@ -639,29 +639,29 @@ const K = Ne({
|
|
|
639
639
|
}
|
|
640
640
|
});
|
|
641
641
|
function Er() {
|
|
642
|
-
const t =
|
|
642
|
+
const t = V({
|
|
643
643
|
__root__: { value: "__root__", parent: "", children: {}, index: 0, childrenLength: 0, isGroup: !0, ref: { current: null } }
|
|
644
|
-
}), o =
|
|
644
|
+
}), o = V({}), i = Q((a, d, f, s, p) => {
|
|
645
645
|
if (!t.current[d]) {
|
|
646
|
-
o.current[d] ? o.current[d].push([a, d, f, s,
|
|
646
|
+
o.current[d] ? o.current[d].push([a, d, f, s, p]) : o.current[d] = [[a, d, f, s, p]];
|
|
647
647
|
return;
|
|
648
648
|
}
|
|
649
|
-
if (t.current[a] = { value: a, parent: d, children: {}, childrenLength: 0, index: f, isGroup: s, ref:
|
|
650
|
-
for (const
|
|
651
|
-
i(...
|
|
649
|
+
if (t.current[a] = { value: a, parent: d, children: {}, childrenLength: 0, index: f, isGroup: s, ref: p }, t.current[d].children[f] = a, (f + 1 > t.current[d].childrenLength || t.current[t.current[d].childrenLength - 1] == null) && (t.current[d].childrenLength = f + 1), o.current[a]) {
|
|
650
|
+
for (const h of o.current[a])
|
|
651
|
+
i(...h);
|
|
652
652
|
delete o.current[a];
|
|
653
653
|
}
|
|
654
654
|
}, []);
|
|
655
655
|
return [t, i];
|
|
656
656
|
}
|
|
657
|
-
const
|
|
657
|
+
const Y = Ne({
|
|
658
658
|
parent: "",
|
|
659
659
|
getIndex: () => -1
|
|
660
660
|
});
|
|
661
661
|
function mr(t, o, i) {
|
|
662
662
|
const [a, d] = $e(i);
|
|
663
|
-
return [t !== void 0 ? t : a, (
|
|
664
|
-
d(
|
|
663
|
+
return [t !== void 0 ? t : a, (p) => {
|
|
664
|
+
d(p), o && o(a);
|
|
665
665
|
}];
|
|
666
666
|
}
|
|
667
667
|
function ee(t, o) {
|
|
@@ -677,7 +677,7 @@ function fe(...t) {
|
|
|
677
677
|
}, [t]);
|
|
678
678
|
}
|
|
679
679
|
function We() {
|
|
680
|
-
const t =
|
|
680
|
+
const t = V(-1), o = V({});
|
|
681
681
|
return Q((a) => (o.current[a] == null && (o.current[a] = ++t.current), o.current[a]), []);
|
|
682
682
|
}
|
|
683
683
|
const yr = ["ArrowRight", "ArrowUp", "ArrowLeft", "ArrowDown", "Home", "End", "Enter"];
|
|
@@ -695,15 +695,15 @@ function xr(t, o) {
|
|
|
695
695
|
var d, f;
|
|
696
696
|
const i = t[o].parent, a = t[o].index;
|
|
697
697
|
if (a != 0) {
|
|
698
|
-
let s = t[i].children[a - 1],
|
|
699
|
-
for (; t[s].isGroup && (
|
|
700
|
-
s =
|
|
698
|
+
let s = t[i].children[a - 1], p;
|
|
699
|
+
for (; t[s].isGroup && (p = t[s].children[t[s].childrenLength - 1], !(p == null || t[p].ref.current == null)); )
|
|
700
|
+
s = p;
|
|
701
701
|
(d = t[s].ref.current) == null || d.focus();
|
|
702
702
|
return;
|
|
703
703
|
}
|
|
704
704
|
i != "__root__" && ((f = t[i].ref.current) == null || f.focus());
|
|
705
705
|
}
|
|
706
|
-
function
|
|
706
|
+
function Sr(t, o) {
|
|
707
707
|
var d, f;
|
|
708
708
|
if (t[o].isGroup) {
|
|
709
709
|
const s = (d = t[t[o].children[0]]) == null ? void 0 : d.ref.current;
|
|
@@ -720,7 +720,7 @@ function Cr(t, o) {
|
|
|
720
720
|
}
|
|
721
721
|
(f = t[a].ref.current) == null || f.focus();
|
|
722
722
|
}
|
|
723
|
-
function
|
|
723
|
+
function Cr(t) {
|
|
724
724
|
var i;
|
|
725
725
|
const o = t.__root__.children[0];
|
|
726
726
|
(i = t[o].ref.current) == null || i.focus();
|
|
@@ -732,36 +732,36 @@ function Pr(t) {
|
|
|
732
732
|
o = i;
|
|
733
733
|
(a = t[o].ref.current) == null || a.focus();
|
|
734
734
|
}
|
|
735
|
-
const Or =
|
|
736
|
-
const [s,
|
|
735
|
+
const Or = K(({ value: t, onValueChange: o, defaultValue: i, onKeyDown: a, ...d }, f) => {
|
|
736
|
+
const [s, p] = Er(), h = We(), [y, g] = mr(t, o, i ?? /* @__PURE__ */ new Set()), [T, w] = $e(null), O = V(null), k = fe(O, f), E = V(""), j = Q((b) => {
|
|
737
737
|
if (!(!yr.includes(b.key) || !s.current))
|
|
738
738
|
switch (b.key) {
|
|
739
739
|
case "ArrowRight":
|
|
740
740
|
if (!s.current[E.current].isGroup)
|
|
741
741
|
break;
|
|
742
|
-
y.has(E.current) ? wr(s.current, E.current) : g((
|
|
742
|
+
y.has(E.current) ? wr(s.current, E.current) : g((C) => /* @__PURE__ */ new Set([...C, E.current]));
|
|
743
743
|
break;
|
|
744
744
|
case "ArrowLeft":
|
|
745
|
-
y.has(E.current) ? g((
|
|
745
|
+
y.has(E.current) ? g((C) => new Set([...C].filter((D) => D !== E.current))) : Tr(s.current, E.current);
|
|
746
746
|
break;
|
|
747
747
|
case "ArrowUp":
|
|
748
748
|
xr(s.current, E.current);
|
|
749
749
|
break;
|
|
750
750
|
case "ArrowDown":
|
|
751
|
-
|
|
751
|
+
Sr(s.current, E.current);
|
|
752
752
|
break;
|
|
753
753
|
case "Home":
|
|
754
|
-
|
|
754
|
+
Cr(s.current);
|
|
755
755
|
break;
|
|
756
756
|
case "End":
|
|
757
757
|
Pr(s.current);
|
|
758
758
|
break;
|
|
759
759
|
case "Enter":
|
|
760
|
-
w(E.current), y.has(E.current) ? g((
|
|
760
|
+
w(E.current), y.has(E.current) ? g((C) => new Set([...C].filter((D) => D !== E.current))) : g((C) => /* @__PURE__ */ new Set([...C, E.current]));
|
|
761
761
|
break;
|
|
762
762
|
}
|
|
763
763
|
}, [y]), S = ee(a, j);
|
|
764
|
-
return /* @__PURE__ */
|
|
764
|
+
return /* @__PURE__ */ I.jsx(J.Provider, { value: { rootValue: y, setRootValue: g, selection: T, setSelection: w, focus: E, nodeMap: s, pushToNodeMap: p }, children: /* @__PURE__ */ I.jsx(Y.Provider, { value: { parent: "__root__", getIndex: h }, children: /* @__PURE__ */ I.jsx(
|
|
765
765
|
"ul",
|
|
766
766
|
{
|
|
767
767
|
ref: k,
|
|
@@ -771,17 +771,17 @@ const Or = q(({ value: t, onValueChange: o, defaultValue: i, onKeyDown: a, ...d
|
|
|
771
771
|
...d
|
|
772
772
|
}
|
|
773
773
|
) }) });
|
|
774
|
-
}), kr =
|
|
775
|
-
const { selection: d, focus: f, nodeMap: s, pushToNodeMap:
|
|
774
|
+
}), kr = K(({ value: t, onFocus: o, ...i }, a) => {
|
|
775
|
+
const { selection: d, focus: f, nodeMap: s, pushToNodeMap: p } = L(J), { parent: h, getIndex: y } = L(Y), g = V(null), T = fe(g, a), w = ee(o, O);
|
|
776
776
|
function O(E) {
|
|
777
777
|
var j, S, b;
|
|
778
778
|
(S = (j = s.current) == null ? void 0 : j[f.current].ref.current) == null || S.setAttribute("tabindex", "-1"), (b = g.current) == null || b.setAttribute("tabindex", "0"), f.current = t, E.preventDefault();
|
|
779
779
|
}
|
|
780
780
|
const k = y(t);
|
|
781
|
-
return
|
|
781
|
+
return p(t, h, k, !1, g), f.current == "" && h == "__root__" && k == 0 && (f.current = t), /* @__PURE__ */ I.jsx(
|
|
782
782
|
"li",
|
|
783
783
|
{
|
|
784
|
-
ref:
|
|
784
|
+
ref: T,
|
|
785
785
|
role: "treenode",
|
|
786
786
|
"aria-selected": d == t,
|
|
787
787
|
tabIndex: f.current == t ? 0 : -1,
|
|
@@ -789,14 +789,14 @@ const Or = q(({ value: t, onValueChange: o, defaultValue: i, onKeyDown: a, ...d
|
|
|
789
789
|
...i
|
|
790
790
|
}
|
|
791
791
|
);
|
|
792
|
-
}), jr =
|
|
793
|
-
const d = We(), { rootValue: f, selection: s, focus:
|
|
792
|
+
}), jr = K(({ value: t, onFocus: o, ...i }, a) => {
|
|
793
|
+
const d = We(), { rootValue: f, selection: s, focus: p, nodeMap: h, pushToNodeMap: y } = L(J), { parent: g, getIndex: T } = L(Y), w = V(null), O = fe(w, a), k = ee(o, E);
|
|
794
794
|
function E(S) {
|
|
795
|
-
var b,
|
|
796
|
-
(
|
|
795
|
+
var b, C, D;
|
|
796
|
+
(C = (b = h.current) == null ? void 0 : b[p.current].ref.current) == null || C.setAttribute("tabindex", "-1"), (D = w.current) == null || D.setAttribute("tabindex", "0"), p.current = t, S.preventDefault();
|
|
797
797
|
}
|
|
798
|
-
const j =
|
|
799
|
-
return y(t, g, j, !0, w),
|
|
798
|
+
const j = T(t);
|
|
799
|
+
return y(t, g, j, !0, w), p.current == "" && g == "__root__" && j == 0 && (p.current = t), /* @__PURE__ */ I.jsx(Y.Provider, { value: { parent: t, getIndex: d }, children: /* @__PURE__ */ I.jsx(
|
|
800
800
|
"li",
|
|
801
801
|
{
|
|
802
802
|
ref: O,
|
|
@@ -804,17 +804,17 @@ const Or = q(({ value: t, onValueChange: o, defaultValue: i, onKeyDown: a, ...d
|
|
|
804
804
|
"aria-expanded": f.has(t),
|
|
805
805
|
"data-state": f.has(t) ? "open" : "closed",
|
|
806
806
|
"aria-selected": s == t,
|
|
807
|
-
tabIndex:
|
|
807
|
+
tabIndex: p.current == t ? 0 : -1,
|
|
808
808
|
onFocus: k,
|
|
809
809
|
...i
|
|
810
810
|
}
|
|
811
811
|
) });
|
|
812
|
-
}), Ar =
|
|
813
|
-
const { setRootValue: a, setSelection: d } =
|
|
814
|
-
function
|
|
815
|
-
d(f), a((
|
|
812
|
+
}), Ar = K(({ onClick: t, ...o }, i) => {
|
|
813
|
+
const { setRootValue: a, setSelection: d } = L(J), { parent: f } = L(Y), s = ee(t, p);
|
|
814
|
+
function p() {
|
|
815
|
+
d(f), a((h) => h.has(f) ? new Set([...h].filter((y) => y !== f)) : /* @__PURE__ */ new Set([...h, f]));
|
|
816
816
|
}
|
|
817
|
-
return /* @__PURE__ */
|
|
817
|
+
return /* @__PURE__ */ I.jsx(
|
|
818
818
|
"div",
|
|
819
819
|
{
|
|
820
820
|
ref: i,
|
|
@@ -822,10 +822,10 @@ const Or = q(({ value: t, onValueChange: o, defaultValue: i, onKeyDown: a, ...d
|
|
|
822
822
|
...o
|
|
823
823
|
}
|
|
824
824
|
);
|
|
825
|
-
}), Fr =
|
|
826
|
-
const { rootValue: i } =
|
|
825
|
+
}), Fr = K(({ ...t }, o) => {
|
|
826
|
+
const { rootValue: i } = L(J), { parent: a } = L(Y);
|
|
827
827
|
if (i.has(a))
|
|
828
|
-
return /* @__PURE__ */
|
|
828
|
+
return /* @__PURE__ */ I.jsx(
|
|
829
829
|
"ul",
|
|
830
830
|
{
|
|
831
831
|
ref: o,
|
|
@@ -843,4 +843,4 @@ const Or = q(({ value: t, onValueChange: o, defaultValue: i, onKeyDown: a, ...d
|
|
|
843
843
|
export {
|
|
844
844
|
Ir as default
|
|
845
845
|
};
|
|
846
|
-
//# sourceMappingURL=index.
|
|
846
|
+
//# sourceMappingURL=index.js.map
|