@smart-factor/gem-ui-components 0.0.51 → 0.0.52

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.
@@ -1,2958 +0,0 @@
1
- import { jsx as w, jsxs as ve } from "react/jsx-runtime";
2
- import * as x from "react";
3
- import { createElement as Ht } from "react";
4
- import { J as Yt, K as Qe, L as Qt, M as Zt, N as en, k as fe, l as me, m as U, _ as D, p as ot, O as tn, T as nn, q as Ne, r as on, Q as rn, h as de, t as Ie, P as r, R as rt, v as ge, x as Ze, U as sn, D as it, f as ln, V as st, a as ue, b as te, n as an, d as cn, g as G, o as dn, E as un, u as pn, B as ce, W as fn, X as lt, Y as ie, A as et, e as mn, F as In, S as gn, H as hn, I as bn } from "./Stack-eW3BwJUw.js";
5
- function yn(e, t = 0, n = 1) {
6
- return process.env.NODE_ENV !== "production" && (e < t || e > n) && console.error(`MUI: The value provided ${e} is out of range [${t}, ${n}].`), Yt(e, t, n);
7
- }
8
- function xn(e) {
9
- e = e.slice(1);
10
- const t = new RegExp(`.{1,${e.length >= 6 ? 2 : 1}}`, "g");
11
- let n = e.match(t);
12
- return n && n[0].length === 1 && (n = n.map((o) => o + o)), n ? `rgb${n.length === 4 ? "a" : ""}(${n.map((o, s) => s < 3 ? parseInt(o, 16) : Math.round(parseInt(o, 16) / 255 * 1e3) / 1e3).join(", ")})` : "";
13
- }
14
- function at(e) {
15
- if (e.type)
16
- return e;
17
- if (e.charAt(0) === "#")
18
- return at(xn(e));
19
- const t = e.indexOf("("), n = e.substring(0, t);
20
- if (["rgb", "rgba", "hsl", "hsla", "color"].indexOf(n) === -1)
21
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${e}\` color.
22
- The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` : Qe(9, e));
23
- let o = e.substring(t + 1, e.length - 1), s;
24
- if (n === "color") {
25
- if (o = o.split(" "), s = o.shift(), o.length === 4 && o[3].charAt(0) === "/" && (o[3] = o[3].slice(1)), ["srgb", "display-p3", "a98-rgb", "prophoto-rgb", "rec-2020"].indexOf(s) === -1)
26
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${s}\` color space.
27
- The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.` : Qe(10, s));
28
- } else
29
- o = o.split(",");
30
- return o = o.map((d) => parseFloat(d)), {
31
- type: n,
32
- values: o,
33
- colorSpace: s
34
- };
35
- }
36
- function En(e) {
37
- const {
38
- type: t,
39
- colorSpace: n
40
- } = e;
41
- let {
42
- values: o
43
- } = e;
44
- return t.indexOf("rgb") !== -1 ? o = o.map((s, d) => d < 3 ? parseInt(s, 10) : s) : t.indexOf("hsl") !== -1 && (o[1] = `${o[1]}%`, o[2] = `${o[2]}%`), t.indexOf("color") !== -1 ? o = `${n} ${o.join(" ")}` : o = `${o.join(", ")}`, `${t}(${o})`;
45
- }
46
- function X(e, t) {
47
- return e = at(e), t = yn(t), (e.type === "rgb" || e.type === "hsl") && (e.type += "a"), e.type === "color" ? e.values[3] = `/${t}` : e.values[3] = t, En(e);
48
- }
49
- function Cn({
50
- props: e,
51
- name: t
52
- }) {
53
- return Qt({
54
- props: e,
55
- name: t,
56
- defaultTheme: Zt,
57
- themeId: en
58
- });
59
- }
60
- function Tn(e) {
61
- return fe("MuiCollapse", e);
62
- }
63
- me("MuiCollapse", ["root", "horizontal", "vertical", "entered", "hidden", "wrapper", "wrapperInner"]);
64
- const wn = ["addEndListener", "children", "className", "collapsedSize", "component", "easing", "in", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "orientation", "style", "timeout", "TransitionComponent"], vn = (e) => {
65
- const {
66
- orientation: t,
67
- classes: n
68
- } = e, o = {
69
- root: ["root", `${t}`],
70
- entered: ["entered"],
71
- hidden: ["hidden"],
72
- wrapper: ["wrapper", `${t}`],
73
- wrapperInner: ["wrapperInner", `${t}`]
74
- };
75
- return ge(o, Tn, n);
76
- }, Mn = U("div", {
77
- name: "MuiCollapse",
78
- slot: "Root",
79
- overridesResolver: (e, t) => {
80
- const {
81
- ownerState: n
82
- } = e;
83
- return [t.root, t[n.orientation], n.state === "entered" && t.entered, n.state === "exited" && !n.in && n.collapsedSize === "0px" && t.hidden];
84
- }
85
- })(({
86
- theme: e,
87
- ownerState: t
88
- }) => D({
89
- height: 0,
90
- overflow: "hidden",
91
- transition: e.transitions.create("height")
92
- }, t.orientation === "horizontal" && {
93
- height: "auto",
94
- width: 0,
95
- transition: e.transitions.create("width")
96
- }, t.state === "entered" && D({
97
- height: "auto",
98
- overflow: "visible"
99
- }, t.orientation === "horizontal" && {
100
- width: "auto"
101
- }), t.state === "exited" && !t.in && t.collapsedSize === "0px" && {
102
- visibility: "hidden"
103
- })), Sn = U("div", {
104
- name: "MuiCollapse",
105
- slot: "Wrapper",
106
- overridesResolver: (e, t) => t.wrapper
107
- })(({
108
- ownerState: e
109
- }) => D({
110
- // Hack to get children with a negative margin to not falsify the height computation.
111
- display: "flex",
112
- width: "100%"
113
- }, e.orientation === "horizontal" && {
114
- width: "auto",
115
- height: "100%"
116
- })), Rn = U("div", {
117
- name: "MuiCollapse",
118
- slot: "WrapperInner",
119
- overridesResolver: (e, t) => t.wrapperInner
120
- })(({
121
- ownerState: e
122
- }) => D({
123
- width: "100%"
124
- }, e.orientation === "horizontal" && {
125
- width: "auto",
126
- height: "100%"
127
- })), Le = /* @__PURE__ */ x.forwardRef(function(t, n) {
128
- const o = ot({
129
- props: t,
130
- name: "MuiCollapse"
131
- }), {
132
- addEndListener: s,
133
- children: d,
134
- className: c,
135
- collapsedSize: i = "0px",
136
- component: p,
137
- easing: u,
138
- in: l,
139
- onEnter: a,
140
- onEntered: m,
141
- onEntering: I,
142
- onExit: h,
143
- onExited: f,
144
- onExiting: g,
145
- orientation: b = "vertical",
146
- style: y,
147
- timeout: C = tn.standard,
148
- // eslint-disable-next-line react/prop-types
149
- TransitionComponent: k = nn
150
- } = o, T = Ne(o, wn), v = D({}, o, {
151
- orientation: b,
152
- collapsedSize: i
153
- }), R = vn(v), B = on(), K = rn(), V = x.useRef(null), A = x.useRef(), z = typeof i == "number" ? `${i}px` : i, j = b === "horizontal", q = j ? "width" : "height", N = x.useRef(null), H = de(n, N), L = (M) => (F) => {
154
- if (M) {
155
- const _ = N.current;
156
- F === void 0 ? M(_) : M(_, F);
157
- }
158
- }, W = () => V.current ? V.current[j ? "clientWidth" : "clientHeight"] : 0, O = L((M, F) => {
159
- V.current && j && (V.current.style.position = "absolute"), M.style[q] = z, a && a(M, F);
160
- }), P = L((M, F) => {
161
- const _ = W();
162
- V.current && j && (V.current.style.position = "");
163
- const {
164
- duration: $,
165
- easing: Y
166
- } = Ze({
167
- style: y,
168
- timeout: C,
169
- easing: u
170
- }, {
171
- mode: "enter"
172
- });
173
- if (C === "auto") {
174
- const xe = B.transitions.getAutoHeightDuration(_);
175
- M.style.transitionDuration = `${xe}ms`, A.current = xe;
176
- } else
177
- M.style.transitionDuration = typeof $ == "string" ? $ : `${$}ms`;
178
- M.style[q] = `${_}px`, M.style.transitionTimingFunction = Y, I && I(M, F);
179
- }), ne = L((M, F) => {
180
- M.style[q] = "auto", m && m(M, F);
181
- }), ye = L((M) => {
182
- M.style[q] = `${W()}px`, h && h(M);
183
- }), Re = L(f), ke = L((M) => {
184
- const F = W(), {
185
- duration: _,
186
- easing: $
187
- } = Ze({
188
- style: y,
189
- timeout: C,
190
- easing: u
191
- }, {
192
- mode: "exit"
193
- });
194
- if (C === "auto") {
195
- const Y = B.transitions.getAutoHeightDuration(F);
196
- M.style.transitionDuration = `${Y}ms`, A.current = Y;
197
- } else
198
- M.style.transitionDuration = typeof _ == "string" ? _ : `${_}ms`;
199
- M.style[q] = z, M.style.transitionTimingFunction = $, g && g(M);
200
- });
201
- return /* @__PURE__ */ w(k, D({
202
- in: l,
203
- onEnter: O,
204
- onEntered: ne,
205
- onEntering: P,
206
- onExit: ye,
207
- onExited: Re,
208
- onExiting: ke,
209
- addEndListener: (M) => {
210
- C === "auto" && K.start(A.current || 0, M), s && s(N.current, M);
211
- },
212
- nodeRef: N,
213
- timeout: C === "auto" ? null : C
214
- }, T, {
215
- children: (M, F) => /* @__PURE__ */ w(Mn, D({
216
- as: p,
217
- className: Ie(R.root, c, {
218
- entered: R.entered,
219
- exited: !l && z === "0px" && R.hidden
220
- }[M]),
221
- style: D({
222
- [j ? "minWidth" : "minHeight"]: z
223
- }, y),
224
- ref: H
225
- }, F, {
226
- // `ownerState` is set after `childProps` to override any existing `ownerState` property in `childProps`
227
- // that might have been forwarded from the Transition component.
228
- ownerState: D({}, v, {
229
- state: M
230
- }),
231
- children: /* @__PURE__ */ w(Sn, {
232
- ownerState: D({}, v, {
233
- state: M
234
- }),
235
- className: R.wrapper,
236
- ref: V,
237
- children: /* @__PURE__ */ w(Rn, {
238
- ownerState: D({}, v, {
239
- state: M
240
- }),
241
- className: R.wrapperInner,
242
- children: d
243
- })
244
- })
245
- }))
246
- }));
247
- });
248
- process.env.NODE_ENV !== "production" && (Le.propTypes = {
249
- // ┌────────────────────────────── Warning ──────────────────────────────┐
250
- // │ These PropTypes are generated from the TypeScript type definitions. │
251
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
252
- // └─────────────────────────────────────────────────────────────────────┘
253
- /**
254
- * Add a custom transition end trigger. Called with the transitioning DOM
255
- * node and a done callback. Allows for more fine grained transition end
256
- * logic. Note: Timeouts are still used as a fallback if provided.
257
- */
258
- addEndListener: r.func,
259
- /**
260
- * The content node to be collapsed.
261
- */
262
- children: r.node,
263
- /**
264
- * Override or extend the styles applied to the component.
265
- */
266
- classes: r.object,
267
- /**
268
- * @ignore
269
- */
270
- className: r.string,
271
- /**
272
- * The width (horizontal) or height (vertical) of the container when collapsed.
273
- * @default '0px'
274
- */
275
- collapsedSize: r.oneOfType([r.number, r.string]),
276
- /**
277
- * The component used for the root node.
278
- * Either a string to use a HTML element or a component.
279
- */
280
- component: rt,
281
- /**
282
- * The transition timing function.
283
- * You may specify a single easing or a object containing enter and exit values.
284
- */
285
- easing: r.oneOfType([r.shape({
286
- enter: r.string,
287
- exit: r.string
288
- }), r.string]),
289
- /**
290
- * If `true`, the component will transition in.
291
- */
292
- in: r.bool,
293
- /**
294
- * @ignore
295
- */
296
- onEnter: r.func,
297
- /**
298
- * @ignore
299
- */
300
- onEntered: r.func,
301
- /**
302
- * @ignore
303
- */
304
- onEntering: r.func,
305
- /**
306
- * @ignore
307
- */
308
- onExit: r.func,
309
- /**
310
- * @ignore
311
- */
312
- onExited: r.func,
313
- /**
314
- * @ignore
315
- */
316
- onExiting: r.func,
317
- /**
318
- * The transition orientation.
319
- * @default 'vertical'
320
- */
321
- orientation: r.oneOf(["horizontal", "vertical"]),
322
- /**
323
- * @ignore
324
- */
325
- style: r.object,
326
- /**
327
- * The system prop that allows defining system overrides as well as additional CSS styles.
328
- */
329
- sx: r.oneOfType([r.arrayOf(r.oneOfType([r.func, r.object, r.bool])), r.func, r.object]),
330
- /**
331
- * The duration for the transition, in milliseconds.
332
- * You may specify a single timeout for all transitions, or individually with an object.
333
- *
334
- * Set to 'auto' to automatically calculate transition time based on height.
335
- * @default duration.standard
336
- */
337
- timeout: r.oneOfType([r.oneOf(["auto"]), r.number, r.shape({
338
- appear: r.number,
339
- enter: r.number,
340
- exit: r.number
341
- })])
342
- });
343
- Le.muiSupportAuto = !0;
344
- const ct = /* @__PURE__ */ x.createContext(void 0);
345
- process.env.NODE_ENV !== "production" && (ct.displayName = "FormControlContext");
346
- function kn() {
347
- return x.useContext(ct);
348
- }
349
- function On(e) {
350
- return fe("PrivateSwitchBase", e);
351
- }
352
- me("PrivateSwitchBase", ["root", "checked", "disabled", "input", "edgeStart", "edgeEnd"]);
353
- const Pn = ["autoFocus", "checked", "checkedIcon", "className", "defaultChecked", "disabled", "disableFocusRipple", "edge", "icon", "id", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "readOnly", "required", "tabIndex", "type", "value"], Dn = (e) => {
354
- const {
355
- classes: t,
356
- checked: n,
357
- disabled: o,
358
- edge: s
359
- } = e, d = {
360
- root: ["root", n && "checked", o && "disabled", s && `edge${ue(s)}`],
361
- input: ["input"]
362
- };
363
- return ge(d, On, t);
364
- }, Vn = U(sn)(({
365
- ownerState: e
366
- }) => D({
367
- padding: 9,
368
- borderRadius: "50%"
369
- }, e.edge === "start" && {
370
- marginLeft: e.size === "small" ? -3 : -12
371
- }, e.edge === "end" && {
372
- marginRight: e.size === "small" ? -3 : -12
373
- })), $n = U("input", {
374
- shouldForwardProp: it
375
- })({
376
- cursor: "inherit",
377
- position: "absolute",
378
- opacity: 0,
379
- width: "100%",
380
- height: "100%",
381
- top: 0,
382
- left: 0,
383
- margin: 0,
384
- padding: 0,
385
- zIndex: 1
386
- }), dt = /* @__PURE__ */ x.forwardRef(function(t, n) {
387
- const {
388
- autoFocus: o,
389
- checked: s,
390
- checkedIcon: d,
391
- className: c,
392
- defaultChecked: i,
393
- disabled: p,
394
- disableFocusRipple: u = !1,
395
- edge: l = !1,
396
- icon: a,
397
- id: m,
398
- inputProps: I,
399
- inputRef: h,
400
- name: f,
401
- onBlur: g,
402
- onChange: b,
403
- onFocus: y,
404
- readOnly: C,
405
- required: k = !1,
406
- tabIndex: T,
407
- type: v,
408
- value: R
409
- } = t, B = Ne(t, Pn), [K, V] = ln({
410
- controlled: s,
411
- default: !!i,
412
- name: "SwitchBase",
413
- state: "checked"
414
- }), A = kn(), z = (O) => {
415
- y && y(O), A && A.onFocus && A.onFocus(O);
416
- }, j = (O) => {
417
- g && g(O), A && A.onBlur && A.onBlur(O);
418
- }, q = (O) => {
419
- if (O.nativeEvent.defaultPrevented)
420
- return;
421
- const P = O.target.checked;
422
- V(P), b && b(O, P);
423
- };
424
- let N = p;
425
- A && typeof N > "u" && (N = A.disabled);
426
- const H = v === "checkbox" || v === "radio", L = D({}, t, {
427
- checked: K,
428
- disabled: N,
429
- disableFocusRipple: u,
430
- edge: l
431
- }), W = Dn(L);
432
- return /* @__PURE__ */ ve(Vn, D({
433
- component: "span",
434
- className: Ie(W.root, c),
435
- centerRipple: !0,
436
- focusRipple: !u,
437
- disabled: N,
438
- tabIndex: null,
439
- role: void 0,
440
- onFocus: z,
441
- onBlur: j,
442
- ownerState: L,
443
- ref: n
444
- }, B, {
445
- children: [/* @__PURE__ */ w($n, D({
446
- autoFocus: o,
447
- checked: s,
448
- defaultChecked: i,
449
- className: W.input,
450
- disabled: N,
451
- id: H ? m : void 0,
452
- name: f,
453
- onChange: q,
454
- readOnly: C,
455
- ref: h,
456
- required: k,
457
- ownerState: L,
458
- tabIndex: T,
459
- type: v
460
- }, v === "checkbox" && R === void 0 ? {} : {
461
- value: R
462
- }, I)), K ? d : a]
463
- }));
464
- });
465
- process.env.NODE_ENV !== "production" && (dt.propTypes = {
466
- /**
467
- * If `true`, the `input` element is focused during the first mount.
468
- */
469
- autoFocus: r.bool,
470
- /**
471
- * If `true`, the component is checked.
472
- */
473
- checked: r.bool,
474
- /**
475
- * The icon to display when the component is checked.
476
- */
477
- checkedIcon: r.node.isRequired,
478
- /**
479
- * Override or extend the styles applied to the component.
480
- */
481
- classes: r.object,
482
- /**
483
- * @ignore
484
- */
485
- className: r.string,
486
- /**
487
- * @ignore
488
- */
489
- defaultChecked: r.bool,
490
- /**
491
- * If `true`, the component is disabled.
492
- */
493
- disabled: r.bool,
494
- /**
495
- * If `true`, the keyboard focus ripple is disabled.
496
- * @default false
497
- */
498
- disableFocusRipple: r.bool,
499
- /**
500
- * If given, uses a negative margin to counteract the padding on one
501
- * side (this is often helpful for aligning the left or right
502
- * side of the icon with content above or below, without ruining the border
503
- * size and shape).
504
- * @default false
505
- */
506
- edge: r.oneOf(["end", "start", !1]),
507
- /**
508
- * The icon to display when the component is unchecked.
509
- */
510
- icon: r.node.isRequired,
511
- /**
512
- * The id of the `input` element.
513
- */
514
- id: r.string,
515
- /**
516
- * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
517
- */
518
- inputProps: r.object,
519
- /**
520
- * Pass a ref to the `input` element.
521
- */
522
- inputRef: st,
523
- /*
524
- * @ignore
525
- */
526
- name: r.string,
527
- /**
528
- * @ignore
529
- */
530
- onBlur: r.func,
531
- /**
532
- * Callback fired when the state is changed.
533
- *
534
- * @param {object} event The event source of the callback.
535
- * You can pull out the new checked state by accessing `event.target.checked` (boolean).
536
- */
537
- onChange: r.func,
538
- /**
539
- * @ignore
540
- */
541
- onFocus: r.func,
542
- /**
543
- * It prevents the user from changing the value of the field
544
- * (not from interacting with the field).
545
- */
546
- readOnly: r.bool,
547
- /**
548
- * If `true`, the `input` element is required.
549
- */
550
- required: r.bool,
551
- /**
552
- * The system prop that allows defining system overrides as well as additional CSS styles.
553
- */
554
- sx: r.object,
555
- /**
556
- * @ignore
557
- */
558
- tabIndex: r.oneOfType([r.number, r.string]),
559
- /**
560
- * The input component prop `type`.
561
- */
562
- type: r.string.isRequired,
563
- /**
564
- * The value of the component.
565
- */
566
- value: r.any
567
- });
568
- const An = te(/* @__PURE__ */ w("path", {
569
- d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
570
- }), "CheckBoxOutlineBlank"), Fn = te(/* @__PURE__ */ w("path", {
571
- d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
572
- }), "CheckBox"), Nn = te(/* @__PURE__ */ w("path", {
573
- d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"
574
- }), "IndeterminateCheckBox");
575
- function Ln(e) {
576
- return fe("MuiCheckbox", e);
577
- }
578
- const $e = me("MuiCheckbox", ["root", "checked", "disabled", "indeterminate", "colorPrimary", "colorSecondary", "sizeSmall", "sizeMedium"]), jn = ["checkedIcon", "color", "icon", "indeterminate", "indeterminateIcon", "inputProps", "size", "className"], _n = (e) => {
579
- const {
580
- classes: t,
581
- indeterminate: n,
582
- color: o,
583
- size: s
584
- } = e, d = {
585
- root: ["root", n && "indeterminate", `color${ue(o)}`, `size${ue(s)}`]
586
- }, c = ge(d, Ln, t);
587
- return D({}, t, c);
588
- }, Bn = U(dt, {
589
- shouldForwardProp: (e) => it(e) || e === "classes",
590
- name: "MuiCheckbox",
591
- slot: "Root",
592
- overridesResolver: (e, t) => {
593
- const {
594
- ownerState: n
595
- } = e;
596
- return [t.root, n.indeterminate && t.indeterminate, t[`size${ue(n.size)}`], n.color !== "default" && t[`color${ue(n.color)}`]];
597
- }
598
- })(({
599
- theme: e,
600
- ownerState: t
601
- }) => D({
602
- color: (e.vars || e).palette.text.secondary
603
- }, !t.disableRipple && {
604
- "&:hover": {
605
- backgroundColor: e.vars ? `rgba(${t.color === "default" ? e.vars.palette.action.activeChannel : e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})` : an(t.color === "default" ? e.palette.action.active : e.palette[t.color].main, e.palette.action.hoverOpacity),
606
- // Reset on touch devices, it doesn't add specificity
607
- "@media (hover: none)": {
608
- backgroundColor: "transparent"
609
- }
610
- }
611
- }, t.color !== "default" && {
612
- [`&.${$e.checked}, &.${$e.indeterminate}`]: {
613
- color: (e.vars || e).palette[t.color].main
614
- },
615
- [`&.${$e.disabled}`]: {
616
- color: (e.vars || e).palette.action.disabled
617
- }
618
- })), zn = /* @__PURE__ */ w(Fn, {}), Un = /* @__PURE__ */ w(An, {}), Kn = /* @__PURE__ */ w(Nn, {}), ut = /* @__PURE__ */ x.forwardRef(function(t, n) {
619
- var o, s;
620
- const d = ot({
621
- props: t,
622
- name: "MuiCheckbox"
623
- }), {
624
- checkedIcon: c = zn,
625
- color: i = "primary",
626
- icon: p = Un,
627
- indeterminate: u = !1,
628
- indeterminateIcon: l = Kn,
629
- inputProps: a,
630
- size: m = "medium",
631
- className: I
632
- } = d, h = Ne(d, jn), f = u ? l : p, g = u ? l : c, b = D({}, d, {
633
- color: i,
634
- indeterminate: u,
635
- size: m
636
- }), y = _n(b);
637
- return /* @__PURE__ */ w(Bn, D({
638
- type: "checkbox",
639
- inputProps: D({
640
- "data-indeterminate": u
641
- }, a),
642
- icon: /* @__PURE__ */ x.cloneElement(f, {
643
- fontSize: (o = f.props.fontSize) != null ? o : m
644
- }),
645
- checkedIcon: /* @__PURE__ */ x.cloneElement(g, {
646
- fontSize: (s = g.props.fontSize) != null ? s : m
647
- }),
648
- ownerState: b,
649
- ref: n,
650
- className: Ie(y.root, I)
651
- }, h, {
652
- classes: y
653
- }));
654
- });
655
- process.env.NODE_ENV !== "production" && (ut.propTypes = {
656
- // ┌────────────────────────────── Warning ──────────────────────────────┐
657
- // │ These PropTypes are generated from the TypeScript type definitions. │
658
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
659
- // └─────────────────────────────────────────────────────────────────────┘
660
- /**
661
- * If `true`, the component is checked.
662
- */
663
- checked: r.bool,
664
- /**
665
- * The icon to display when the component is checked.
666
- * @default <CheckBoxIcon />
667
- */
668
- checkedIcon: r.node,
669
- /**
670
- * Override or extend the styles applied to the component.
671
- */
672
- classes: r.object,
673
- /**
674
- * @ignore
675
- */
676
- className: r.string,
677
- /**
678
- * The color of the component.
679
- * It supports both default and custom theme colors, which can be added as shown in the
680
- * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
681
- * @default 'primary'
682
- */
683
- color: r.oneOfType([r.oneOf(["default", "primary", "secondary", "error", "info", "success", "warning"]), r.string]),
684
- /**
685
- * The default checked state. Use when the component is not controlled.
686
- */
687
- defaultChecked: r.bool,
688
- /**
689
- * If `true`, the component is disabled.
690
- * @default false
691
- */
692
- disabled: r.bool,
693
- /**
694
- * If `true`, the ripple effect is disabled.
695
- * @default false
696
- */
697
- disableRipple: r.bool,
698
- /**
699
- * The icon to display when the component is unchecked.
700
- * @default <CheckBoxOutlineBlankIcon />
701
- */
702
- icon: r.node,
703
- /**
704
- * The id of the `input` element.
705
- */
706
- id: r.string,
707
- /**
708
- * If `true`, the component appears indeterminate.
709
- * This does not set the native input element to indeterminate due
710
- * to inconsistent behavior across browsers.
711
- * However, we set a `data-indeterminate` attribute on the `input`.
712
- * @default false
713
- */
714
- indeterminate: r.bool,
715
- /**
716
- * The icon to display when the component is indeterminate.
717
- * @default <IndeterminateCheckBoxIcon />
718
- */
719
- indeterminateIcon: r.node,
720
- /**
721
- * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
722
- */
723
- inputProps: r.object,
724
- /**
725
- * Pass a ref to the `input` element.
726
- */
727
- inputRef: st,
728
- /**
729
- * Callback fired when the state is changed.
730
- *
731
- * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
732
- * You can pull out the new checked state by accessing `event.target.checked` (boolean).
733
- */
734
- onChange: r.func,
735
- /**
736
- * If `true`, the `input` element is required.
737
- * @default false
738
- */
739
- required: r.bool,
740
- /**
741
- * The size of the component.
742
- * `small` is equivalent to the dense checkbox styling.
743
- * @default 'medium'
744
- */
745
- size: r.oneOfType([r.oneOf(["medium", "small"]), r.string]),
746
- /**
747
- * The system prop that allows defining system overrides as well as additional CSS styles.
748
- */
749
- sx: r.oneOfType([r.arrayOf(r.oneOfType([r.func, r.object, r.bool])), r.func, r.object]),
750
- /**
751
- * The value of the component. The DOM API casts this to a string.
752
- * The browser uses "on" as the default value.
753
- */
754
- value: r.any
755
- });
756
- const qn = te(/* @__PURE__ */ w("path", {
757
- d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"
758
- }), "Visibility"), Xn = te(/* @__PURE__ */ w("path", {
759
- d: "M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z"
760
- }), "VisibilityOff");
761
- function E() {
762
- return E = Object.assign ? Object.assign.bind() : function(e) {
763
- for (var t = 1; t < arguments.length; t++) {
764
- var n = arguments[t];
765
- for (var o in n) ({}).hasOwnProperty.call(n, o) && (e[o] = n[o]);
766
- }
767
- return e;
768
- }, E.apply(null, arguments);
769
- }
770
- function pt(e) {
771
- return Cn;
772
- }
773
- const tt = /* @__PURE__ */ new Set();
774
- function ft(e, t = "warning") {
775
- if (process.env.NODE_ENV === "production")
776
- return;
777
- const n = Array.isArray(e) ? e.join(`
778
- `) : e;
779
- tt.has(n) || (tt.add(n), t === "error" ? console.error(n) : console.warn(n));
780
- }
781
- function Wn(e) {
782
- return fe("MuiSimpleTreeView", e);
783
- }
784
- me("MuiSimpleTreeView", ["root"]);
785
- const Jn = (e, t) => {
786
- const n = x.useRef({}), [o, s] = x.useState(() => {
787
- const c = {};
788
- return e.forEach((i) => {
789
- i.models && Object.entries(i.models).forEach(([p, u]) => {
790
- n.current[p] = {
791
- isControlled: t[p] !== void 0,
792
- getDefaultValue: u.getDefaultValue
793
- }, c[p] = u.getDefaultValue(t);
794
- });
795
- }), c;
796
- }), d = Object.fromEntries(Object.entries(n.current).map(([c, i]) => {
797
- const p = t[c] ?? o[c];
798
- return [c, {
799
- value: p,
800
- setControlledValue: (u) => {
801
- i.isControlled || s((l) => E({}, l, {
802
- [c]: u
803
- }));
804
- }
805
- }];
806
- }));
807
- return process.env.NODE_ENV !== "production" && Object.entries(n.current).forEach(([c, i]) => {
808
- const p = t[c], u = i.getDefaultValue(t);
809
- x.useEffect(() => {
810
- i.isControlled !== (p !== void 0) && console.error([`MUI X: A component is changing the ${i.isControlled ? "" : "un"}controlled ${c} state of TreeView to be ${i.isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${c} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
811
- `));
812
- }, [p]);
813
- const {
814
- current: l
815
- } = x.useRef(u);
816
- x.useEffect(() => {
817
- !i.isControlled && l !== u && console.error([`MUI X: A component is changing the default ${c} state of an uncontrolled TreeView after being initialized. To suppress this warning opt to use a controlled TreeView.`].join(`
818
- `));
819
- }, [JSON.stringify(u)]);
820
- }), d;
821
- };
822
- class Gn {
823
- constructor() {
824
- this.maxListeners = 20, this.warnOnce = !1, this.events = {};
825
- }
826
- on(t, n, o = {}) {
827
- let s = this.events[t];
828
- if (s || (s = {
829
- highPriority: /* @__PURE__ */ new Map(),
830
- regular: /* @__PURE__ */ new Map()
831
- }, this.events[t] = s), o.isFirst ? s.highPriority.set(n, !0) : s.regular.set(n, !0), process.env.NODE_ENV !== "production") {
832
- const d = s.highPriority.size + s.regular.size;
833
- d > this.maxListeners && !this.warnOnce && (this.warnOnce = !0, console.warn([`Possible EventEmitter memory leak detected. ${d} ${t} listeners added.`].join(`
834
- `)));
835
- }
836
- }
837
- removeListener(t, n) {
838
- this.events[t] && (this.events[t].regular.delete(n), this.events[t].highPriority.delete(n));
839
- }
840
- removeAllListeners() {
841
- this.events = {};
842
- }
843
- emit(t, ...n) {
844
- const o = this.events[t];
845
- if (!o)
846
- return;
847
- const s = Array.from(o.highPriority.keys()), d = Array.from(o.regular.keys());
848
- for (let c = s.length - 1; c >= 0; c -= 1) {
849
- const i = s[c];
850
- o.highPriority.has(i) && i.apply(this, n);
851
- }
852
- for (let c = 0; c < d.length; c += 1) {
853
- const i = d[c];
854
- o.regular.has(i) && i.apply(this, n);
855
- }
856
- }
857
- once(t, n) {
858
- const o = this;
859
- this.on(t, function s(...d) {
860
- o.removeListener(t, s), n.apply(o, d);
861
- });
862
- }
863
- }
864
- const Hn = (e) => e.isPropagationStopped !== void 0, mt = () => {
865
- const [e] = x.useState(() => new Gn()), t = x.useCallback((...o) => {
866
- const [s, d, c = {}] = o;
867
- c.defaultMuiPrevented = !1, !(Hn(c) && c.isPropagationStopped()) && e.emit(s, d, c);
868
- }, [e]), n = x.useCallback((o, s) => (e.on(o, s), () => {
869
- e.removeListener(o, s);
870
- }), [e]);
871
- return {
872
- instance: {
873
- $$publishEvent: t,
874
- $$subscribeEvent: n
875
- }
876
- };
877
- };
878
- mt.params = {};
879
- const It = ({
880
- plugins: e
881
- }) => {
882
- const t = new Set(e);
883
- return {
884
- instance: {
885
- getAvailablePlugins: () => t
886
- }
887
- };
888
- };
889
- It.params = {};
890
- const gt = ({
891
- params: e
892
- }) => {
893
- const t = cn(e.id), n = x.useCallback((o, s) => s ?? `${t}-${o}`, [t]);
894
- return {
895
- getRootProps: () => ({
896
- id: t
897
- }),
898
- instance: {
899
- getTreeItemIdAttribute: n
900
- }
901
- };
902
- };
903
- gt.params = {
904
- id: !0
905
- };
906
- const Yn = [mt, It, gt];
907
- function Q(e, t) {
908
- if (e == null) return {};
909
- var n = {};
910
- for (var o in e) if ({}.hasOwnProperty.call(e, o)) {
911
- if (t.includes(o)) continue;
912
- n[o] = e[o];
913
- }
914
- return n;
915
- }
916
- const Qn = ["slots", "slotProps", "apiRef", "experimentalFeatures"], Zn = (e) => {
917
- let {
918
- props: {
919
- slots: t,
920
- slotProps: n,
921
- apiRef: o,
922
- experimentalFeatures: s
923
- },
924
- plugins: d
925
- } = e, c = Q(e.props, Qn);
926
- const i = {};
927
- d.forEach((a) => {
928
- Object.assign(i, a.params);
929
- });
930
- const p = {}, u = {};
931
- Object.keys(c).forEach((a) => {
932
- const m = c[a];
933
- i[a] ? p[a] = m : u[a] = m;
934
- });
935
- const l = d.reduce((a, m) => m.getDefaultizedParams ? m.getDefaultizedParams(a) : a, p);
936
- return {
937
- apiRef: o,
938
- forwardedProps: u,
939
- pluginParams: l,
940
- slots: t ?? {},
941
- slotProps: n ?? {},
942
- experimentalFeatures: s ?? {}
943
- };
944
- }, eo = ({
945
- plugins: e,
946
- instance: t,
947
- publicAPI: n,
948
- rootRef: o
949
- }) => ({
950
- runItemPlugins: (i) => {
951
- let p = null, u = null;
952
- const l = [], a = {};
953
- e.forEach((h) => {
954
- if (!h.itemPlugin)
955
- return;
956
- const f = h.itemPlugin({
957
- props: i,
958
- rootRef: p,
959
- contentRef: u
960
- });
961
- f != null && f.rootRef && (p = f.rootRef), f != null && f.contentRef && (u = f.contentRef), f != null && f.propsEnhancers && (l.push(f.propsEnhancers), Object.keys(f.propsEnhancers).forEach((g) => {
962
- a[g] = !0;
963
- }));
964
- });
965
- const m = (h) => (f) => {
966
- const g = {};
967
- return l.forEach((b) => {
968
- const y = b[h];
969
- y != null && Object.assign(g, y(f));
970
- }), g;
971
- }, I = Object.fromEntries(Object.keys(a).map((h) => [h, m(h)]));
972
- return {
973
- contentRef: u,
974
- rootRef: p,
975
- propsEnhancers: I
976
- };
977
- },
978
- wrapItem: ({
979
- itemId: i,
980
- children: p
981
- }) => {
982
- let u = p;
983
- for (let l = e.length - 1; l >= 0; l -= 1) {
984
- const a = e[l];
985
- a.wrapItem && (u = a.wrapItem({
986
- itemId: i,
987
- children: u,
988
- instance: t
989
- }));
990
- }
991
- return u;
992
- },
993
- wrapRoot: ({
994
- children: i
995
- }) => {
996
- let p = i;
997
- for (let u = e.length - 1; u >= 0; u -= 1) {
998
- const l = e[u];
999
- l.wrapRoot && (p = l.wrapRoot({
1000
- children: p,
1001
- instance: t
1002
- }));
1003
- }
1004
- return p;
1005
- },
1006
- instance: t,
1007
- rootRef: o,
1008
- publicAPI: n
1009
- });
1010
- function to(e) {
1011
- const t = x.useRef({});
1012
- return e ? (e.current == null && (e.current = {}), e.current) : t.current;
1013
- }
1014
- const no = ({
1015
- plugins: e,
1016
- rootRef: t,
1017
- props: n
1018
- }) => {
1019
- const o = [...Yn, ...e], {
1020
- pluginParams: s,
1021
- forwardedProps: d,
1022
- apiRef: c,
1023
- experimentalFeatures: i,
1024
- slots: p,
1025
- slotProps: u
1026
- } = Zn({
1027
- plugins: o,
1028
- props: n
1029
- }), l = Jn(o, s), m = x.useRef({}).current, I = to(c), h = x.useRef(null), f = de(h, t), g = eo({
1030
- plugins: o,
1031
- instance: m,
1032
- publicAPI: I,
1033
- rootRef: h
1034
- }), [b, y] = x.useState(() => {
1035
- const v = {};
1036
- return o.forEach((R) => {
1037
- R.getInitialState && Object.assign(v, R.getInitialState(s));
1038
- }), v;
1039
- }), C = [], k = (v) => {
1040
- const R = v({
1041
- instance: m,
1042
- params: s,
1043
- slots: p,
1044
- slotProps: u,
1045
- experimentalFeatures: i,
1046
- state: b,
1047
- setState: y,
1048
- rootRef: h,
1049
- models: l,
1050
- plugins: o
1051
- });
1052
- R.getRootProps && C.push(R.getRootProps), R.publicAPI && Object.assign(I, R.publicAPI), R.instance && Object.assign(m, R.instance), R.contextValue && Object.assign(g, R.contextValue);
1053
- };
1054
- return o.forEach(k), {
1055
- getRootProps: (v = {}) => {
1056
- const R = E({
1057
- role: "tree"
1058
- }, d, v, {
1059
- ref: f
1060
- });
1061
- return C.forEach((B) => {
1062
- Object.assign(R, B(v));
1063
- }), R;
1064
- },
1065
- rootRef: f,
1066
- contextValue: g,
1067
- instance: m
1068
- };
1069
- }, je = /* @__PURE__ */ x.createContext(null);
1070
- process.env.NODE_ENV !== "production" && (je.displayName = "TreeViewContext");
1071
- function oo(e) {
1072
- const {
1073
- value: t,
1074
- children: n
1075
- } = e;
1076
- return /* @__PURE__ */ w(je.Provider, {
1077
- value: t,
1078
- children: t.wrapRoot({
1079
- children: n
1080
- })
1081
- });
1082
- }
1083
- const le = () => {
1084
- const e = x.useContext(je);
1085
- if (e == null)
1086
- throw new Error(["MUI X: Could not find the Tree View context.", "It looks like you rendered your component outside of a SimpleTreeView or RichTreeView parent component.", "This can also happen if you are bundling multiple versions of the Tree View."].join(`
1087
- `));
1088
- return e;
1089
- }, ht = (e, t, n) => {
1090
- e.$$publishEvent(t, n);
1091
- }, Z = "__TREE_VIEW_ROOT_PARENT_ID__", bt = (e) => {
1092
- const t = {};
1093
- return e.forEach((n, o) => {
1094
- t[n] = o;
1095
- }), t;
1096
- }, se = /* @__PURE__ */ x.createContext(() => -1);
1097
- process.env.NODE_ENV !== "production" && (se.displayName = "TreeViewItemDepthContext");
1098
- const ro = ["children"], yt = ({
1099
- items: e,
1100
- isItemDisabled: t,
1101
- getItemLabel: n,
1102
- getItemId: o
1103
- }) => {
1104
- const s = {}, d = {}, c = {
1105
- [Z]: []
1106
- }, i = (u, l, a) => {
1107
- var f, g;
1108
- const m = o ? o(u) : u.id;
1109
- if (m == null)
1110
- throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.", "Alternatively, you can use the `getItemId` prop to specify a custom id for each item.", "An item was provided without id in the `items` prop:", JSON.stringify(u)].join(`
1111
- `));
1112
- if (s[m] != null)
1113
- throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.", "Alternatively, you can use the `getItemId` prop to specify a custom id for each item.", `Two items were provided with the same id in the \`items\` prop: "${m}"`].join(`
1114
- `));
1115
- const I = n ? n(u) : u.label;
1116
- if (I == null)
1117
- throw new Error(["MUI X: The Tree View component requires all items to have a `label` property.", "Alternatively, you can use the `getItemLabel` prop to specify a custom label for each item.", "An item was provided without label in the `items` prop:", JSON.stringify(u)].join(`
1118
- `));
1119
- s[m] = {
1120
- id: m,
1121
- label: I,
1122
- parentId: a,
1123
- idAttribute: void 0,
1124
- expandable: !!((f = u.children) != null && f.length),
1125
- disabled: t ? t(u) : !1,
1126
- depth: l
1127
- }, d[m] = u;
1128
- const h = a ?? Z;
1129
- c[h] || (c[h] = []), c[h].push(m), (g = u.children) == null || g.forEach((b) => i(b, l + 1, m));
1130
- };
1131
- e.forEach((u) => i(u, 0, null));
1132
- const p = {};
1133
- return Object.keys(c).forEach((u) => {
1134
- p[u] = bt(c[u]);
1135
- }), {
1136
- itemMetaMap: s,
1137
- itemMap: d,
1138
- itemOrderedChildrenIds: c,
1139
- itemChildrenIndexes: p
1140
- };
1141
- }, he = ({
1142
- instance: e,
1143
- params: t,
1144
- state: n,
1145
- setState: o,
1146
- experimentalFeatures: s
1147
- }) => {
1148
- const d = x.useCallback((b) => n.items.itemMetaMap[b], [n.items.itemMetaMap]), c = x.useCallback((b) => n.items.itemMap[b], [n.items.itemMap]), i = x.useCallback(() => {
1149
- const b = (y) => {
1150
- const C = n.items.itemMap[y], k = Q(C, ro), T = n.items.itemOrderedChildrenIds[y];
1151
- return T && (k.children = T.map(b)), k;
1152
- };
1153
- return n.items.itemOrderedChildrenIds[Z].map(b);
1154
- }, [n.items.itemMap, n.items.itemOrderedChildrenIds]), p = x.useCallback((b) => {
1155
- if (b == null)
1156
- return !1;
1157
- let y = e.getItemMeta(b);
1158
- if (!y)
1159
- return !1;
1160
- if (y.disabled)
1161
- return !0;
1162
- for (; y.parentId != null; )
1163
- if (y = e.getItemMeta(y.parentId), y.disabled)
1164
- return !0;
1165
- return !1;
1166
- }, [e]), u = x.useCallback((b) => {
1167
- const y = e.getItemMeta(b).parentId ?? Z;
1168
- return n.items.itemChildrenIndexes[y][b];
1169
- }, [e, n.items.itemChildrenIndexes]), l = x.useCallback((b) => n.items.itemOrderedChildrenIds[b ?? Z] ?? [], [n.items.itemOrderedChildrenIds]), a = (b) => {
1170
- const y = e.getItemMeta(b);
1171
- return y == null ? null : document.getElementById(e.getTreeItemIdAttribute(b, y.idAttribute));
1172
- }, m = (b) => t.disabledItemsFocusable ? !0 : !e.isItemDisabled(b), I = x.useRef(!1), h = x.useCallback(() => {
1173
- I.current = !0;
1174
- }, []), f = x.useCallback(() => I.current, []);
1175
- return x.useEffect(() => {
1176
- e.areItemUpdatesPrevented() || o((b) => {
1177
- const y = yt({
1178
- items: t.items,
1179
- isItemDisabled: t.isItemDisabled,
1180
- getItemId: t.getItemId,
1181
- getItemLabel: t.getItemLabel
1182
- });
1183
- return Object.values(b.items.itemMetaMap).forEach((C) => {
1184
- y.itemMetaMap[C.id] || ht(e, "removeItem", {
1185
- id: C.id
1186
- });
1187
- }), E({}, b, {
1188
- items: y
1189
- });
1190
- });
1191
- }, [e, o, t.items, t.isItemDisabled, t.getItemId, t.getItemLabel]), {
1192
- getRootProps: () => ({
1193
- style: {
1194
- "--TreeView-itemChildrenIndentation": typeof t.itemChildrenIndentation == "number" ? `${t.itemChildrenIndentation}px` : t.itemChildrenIndentation
1195
- }
1196
- }),
1197
- publicAPI: {
1198
- getItem: c,
1199
- getItemDOMElement: a,
1200
- getItemTree: i,
1201
- getItemOrderedChildrenIds: l
1202
- },
1203
- instance: {
1204
- getItemMeta: d,
1205
- getItem: c,
1206
- getItemTree: i,
1207
- getItemsToRender: () => {
1208
- const b = (y) => {
1209
- var k;
1210
- const C = n.items.itemMetaMap[y];
1211
- return {
1212
- label: C.label,
1213
- itemId: C.id,
1214
- id: C.idAttribute,
1215
- children: (k = n.items.itemOrderedChildrenIds[y]) == null ? void 0 : k.map(b)
1216
- };
1217
- };
1218
- return n.items.itemOrderedChildrenIds[Z].map(b);
1219
- },
1220
- getItemIndex: u,
1221
- getItemDOMElement: a,
1222
- getItemOrderedChildrenIds: l,
1223
- isItemDisabled: p,
1224
- isItemNavigable: m,
1225
- preventItemUpdates: h,
1226
- areItemUpdatesPrevented: f
1227
- },
1228
- contextValue: {
1229
- items: {
1230
- onItemClick: t.onItemClick,
1231
- disabledItemsFocusable: t.disabledItemsFocusable,
1232
- indentationAtItemLevel: s.indentationAtItemLevel ?? !1
1233
- }
1234
- }
1235
- };
1236
- };
1237
- he.getInitialState = (e) => ({
1238
- items: yt({
1239
- items: e.items,
1240
- isItemDisabled: e.isItemDisabled,
1241
- getItemId: e.getItemId,
1242
- getItemLabel: e.getItemLabel
1243
- })
1244
- });
1245
- he.getDefaultizedParams = (e) => E({}, e, {
1246
- disabledItemsFocusable: e.disabledItemsFocusable ?? !1,
1247
- itemChildrenIndentation: e.itemChildrenIndentation ?? "12px"
1248
- });
1249
- he.wrapRoot = ({
1250
- children: e,
1251
- instance: t
1252
- }) => /* @__PURE__ */ w(se.Provider, {
1253
- value: (n) => {
1254
- var o;
1255
- return ((o = t.getItemMeta(n)) == null ? void 0 : o.depth) ?? 0;
1256
- },
1257
- children: e
1258
- });
1259
- he.params = {
1260
- disabledItemsFocusable: !0,
1261
- items: !0,
1262
- isItemDisabled: !0,
1263
- getItemLabel: !0,
1264
- getItemId: !0,
1265
- onItemClick: !0,
1266
- itemChildrenIndentation: !0
1267
- };
1268
- const Me = ({
1269
- instance: e,
1270
- params: t,
1271
- models: n
1272
- }) => {
1273
- const o = x.useMemo(() => {
1274
- const a = /* @__PURE__ */ new Map();
1275
- return n.expandedItems.value.forEach((m) => {
1276
- a.set(m, !0);
1277
- }), a;
1278
- }, [n.expandedItems.value]), s = (a, m) => {
1279
- var I;
1280
- (I = t.onExpandedItemsChange) == null || I.call(t, a, m), n.expandedItems.setControlledValue(m);
1281
- }, d = x.useCallback((a) => o.has(a), [o]), c = x.useCallback((a) => {
1282
- var m;
1283
- return !!((m = e.getItemMeta(a)) != null && m.expandable);
1284
- }, [e]), i = G((a, m) => {
1285
- const I = e.isItemExpanded(m);
1286
- e.setItemExpansion(a, m, !I);
1287
- }), p = G((a, m, I) => {
1288
- if (e.isItemExpanded(m) === I)
1289
- return;
1290
- let f;
1291
- I ? f = [m].concat(n.expandedItems.value) : f = n.expandedItems.value.filter((g) => g !== m), t.onItemExpansionToggle && t.onItemExpansionToggle(a, m, I), s(a, f);
1292
- }), u = (a, m) => {
1293
- const I = e.getItemMeta(m), f = e.getItemOrderedChildrenIds(I.parentId).filter((b) => e.isItemExpandable(b) && !e.isItemExpanded(b)), g = n.expandedItems.value.concat(f);
1294
- f.length > 0 && (t.onItemExpansionToggle && f.forEach((b) => {
1295
- t.onItemExpansionToggle(a, b, !0);
1296
- }), s(a, g));
1297
- }, l = x.useMemo(() => t.expansionTrigger ? t.expansionTrigger : e.isTreeViewEditable ? "iconContainer" : "content", [t.expansionTrigger, e.isTreeViewEditable]);
1298
- return {
1299
- publicAPI: {
1300
- setItemExpansion: p
1301
- },
1302
- instance: {
1303
- isItemExpanded: d,
1304
- isItemExpandable: c,
1305
- setItemExpansion: p,
1306
- toggleItemExpansion: i,
1307
- expandAllSiblings: u
1308
- },
1309
- contextValue: {
1310
- expansion: {
1311
- expansionTrigger: l
1312
- }
1313
- }
1314
- };
1315
- };
1316
- Me.models = {
1317
- expandedItems: {
1318
- getDefaultValue: (e) => e.defaultExpandedItems
1319
- }
1320
- };
1321
- const io = [];
1322
- Me.getDefaultizedParams = (e) => E({}, e, {
1323
- defaultExpandedItems: e.defaultExpandedItems ?? io
1324
- });
1325
- Me.params = {
1326
- expandedItems: !0,
1327
- defaultExpandedItems: !0,
1328
- onExpandedItemsChange: !0,
1329
- onItemExpansionToggle: !0,
1330
- expansionTrigger: !0
1331
- };
1332
- const xt = (e, t) => {
1333
- let n = t.length - 1;
1334
- for (; n >= 0 && !e.isItemNavigable(t[n]); )
1335
- n -= 1;
1336
- if (n !== -1)
1337
- return t[n];
1338
- }, Et = (e, t) => {
1339
- const n = e.getItemMeta(t), o = e.getItemOrderedChildrenIds(n.parentId), s = e.getItemIndex(t);
1340
- if (s === 0)
1341
- return n.parentId;
1342
- let d = s - 1;
1343
- for (; !e.isItemNavigable(o[d]) && d >= 0; )
1344
- d -= 1;
1345
- if (d === -1)
1346
- return n.parentId == null ? null : Et(e, n.parentId);
1347
- let c = o[d], i = xt(e, e.getItemOrderedChildrenIds(c));
1348
- for (; e.isItemExpanded(c) && i != null; )
1349
- c = i, i = e.getItemOrderedChildrenIds(c).find(e.isItemNavigable);
1350
- return c;
1351
- }, Ce = (e, t) => {
1352
- if (e.isItemExpanded(t)) {
1353
- const o = e.getItemOrderedChildrenIds(t).find(e.isItemNavigable);
1354
- if (o != null)
1355
- return o;
1356
- }
1357
- let n = e.getItemMeta(t);
1358
- for (; n != null; ) {
1359
- const o = e.getItemOrderedChildrenIds(n.parentId), s = e.getItemIndex(n.id);
1360
- if (s < o.length - 1) {
1361
- let d = s + 1;
1362
- for (; !e.isItemNavigable(o[d]) && d < o.length - 1; )
1363
- d += 1;
1364
- if (e.isItemNavigable(o[d]))
1365
- return o[d];
1366
- }
1367
- n = e.getItemMeta(n.parentId);
1368
- }
1369
- return null;
1370
- }, Ct = (e) => {
1371
- let t = null;
1372
- for (; t == null || e.isItemExpanded(t); ) {
1373
- const n = e.getItemOrderedChildrenIds(t), o = xt(e, n);
1374
- if (o == null)
1375
- return t;
1376
- t = o;
1377
- }
1378
- return t;
1379
- }, pe = (e) => e.getItemOrderedChildrenIds(null).find(e.isItemNavigable), Tt = (e, t, n) => {
1380
- if (t === n)
1381
- return [t, n];
1382
- const o = e.getItemMeta(t), s = e.getItemMeta(n);
1383
- if (o.parentId === s.id || s.parentId === o.id)
1384
- return s.parentId === o.id ? [o.id, s.id] : [s.id, o.id];
1385
- const d = [o.id], c = [s.id];
1386
- let i = o.parentId, p = s.parentId, u = c.indexOf(i) !== -1, l = d.indexOf(p) !== -1, a = !0, m = !0;
1387
- for (; !l && !u; )
1388
- a && (d.push(i), u = c.indexOf(i) !== -1, a = i !== null, !u && a && (i = e.getItemMeta(i).parentId)), m && !u && (c.push(p), l = d.indexOf(p) !== -1, m = p !== null, !l && m && (p = e.getItemMeta(p).parentId));
1389
- const I = u ? i : p, h = e.getItemOrderedChildrenIds(I), f = d[d.indexOf(I) - 1], g = c[c.indexOf(I) - 1];
1390
- return h.indexOf(f) < h.indexOf(g) ? [t, n] : [n, t];
1391
- }, so = (e, t, n) => {
1392
- const o = (p) => {
1393
- if (e.isItemExpandable(p) && e.isItemExpanded(p))
1394
- return e.getItemOrderedChildrenIds(p)[0];
1395
- let u = e.getItemMeta(p);
1396
- for (; u != null; ) {
1397
- const l = e.getItemOrderedChildrenIds(u.parentId), a = e.getItemIndex(u.id);
1398
- if (a < l.length - 1)
1399
- return l[a + 1];
1400
- u = e.getItemMeta(u.parentId);
1401
- }
1402
- throw new Error("Invalid range");
1403
- }, [s, d] = Tt(e, t, n), c = [s];
1404
- let i = s;
1405
- for (; i !== d; )
1406
- i = o(i), e.isItemDisabled(i) || c.push(i);
1407
- return c;
1408
- }, lo = (e) => {
1409
- let t = pe(e);
1410
- const n = [];
1411
- for (; t != null; )
1412
- n.push(t), t = Ce(e, t);
1413
- return n;
1414
- }, Fe = (e, t) => t !== e.closest('*[role="treeitem"]'), Te = (e) => Array.isArray(e) ? e : e != null ? [e] : [], Ae = (e) => {
1415
- const t = {};
1416
- return e.forEach((n) => {
1417
- t[n] = !0;
1418
- }), t;
1419
- }, Se = ({
1420
- instance: e,
1421
- params: t,
1422
- models: n
1423
- }) => {
1424
- const o = x.useRef(null), s = x.useRef({}), d = x.useMemo(() => {
1425
- const f = /* @__PURE__ */ new Map();
1426
- return Array.isArray(n.selectedItems.value) ? n.selectedItems.value.forEach((g) => {
1427
- f.set(g, !0);
1428
- }) : n.selectedItems.value != null && f.set(n.selectedItems.value, !0), f;
1429
- }, [n.selectedItems.value]), c = (f, g) => {
1430
- if (t.onItemSelectionToggle)
1431
- if (t.multiSelect) {
1432
- const b = g.filter((C) => !e.isItemSelected(C)), y = n.selectedItems.value.filter((C) => !g.includes(C));
1433
- b.forEach((C) => {
1434
- t.onItemSelectionToggle(f, C, !0);
1435
- }), y.forEach((C) => {
1436
- t.onItemSelectionToggle(f, C, !1);
1437
- });
1438
- } else g !== n.selectedItems.value && (n.selectedItems.value != null && t.onItemSelectionToggle(f, n.selectedItems.value, !1), g != null && t.onItemSelectionToggle(f, g, !0));
1439
- t.onSelectedItemsChange && t.onSelectedItemsChange(f, g), n.selectedItems.setControlledValue(g);
1440
- }, i = (f) => d.has(f), p = ({
1441
- event: f,
1442
- itemId: g,
1443
- keepExistingSelection: b = !1,
1444
- shouldBeSelected: y
1445
- }) => {
1446
- if (t.disableSelection)
1447
- return;
1448
- let C;
1449
- if (b) {
1450
- const k = Te(n.selectedItems.value), T = e.isItemSelected(g);
1451
- T && (y === !1 || y == null) ? C = k.filter((v) => v !== g) : !T && (y === !0 || y == null) ? C = [g].concat(k) : C = k;
1452
- } else
1453
- y === !1 || y == null && e.isItemSelected(g) ? C = t.multiSelect ? [] : null : C = t.multiSelect ? [g] : g;
1454
- c(f, C), o.current = g, s.current = {};
1455
- }, u = (f, [g, b]) => {
1456
- if (t.disableSelection || !t.multiSelect)
1457
- return;
1458
- let y = Te(n.selectedItems.value).slice();
1459
- Object.keys(s.current).length > 0 && (y = y.filter((v) => !s.current[v]));
1460
- const C = Ae(y), k = so(e, g, b), T = k.filter((v) => !C[v]);
1461
- y = y.concat(T), c(f, y), s.current = Ae(k);
1462
- };
1463
- return {
1464
- getRootProps: () => ({
1465
- "aria-multiselectable": t.multiSelect
1466
- }),
1467
- publicAPI: {
1468
- selectItem: p
1469
- },
1470
- instance: {
1471
- isItemSelected: i,
1472
- selectItem: p,
1473
- selectAllNavigableItems: (f) => {
1474
- if (t.disableSelection || !t.multiSelect)
1475
- return;
1476
- const g = lo(e);
1477
- c(f, g), s.current = Ae(g);
1478
- },
1479
- expandSelectionRange: (f, g) => {
1480
- if (o.current != null) {
1481
- const [b, y] = Tt(e, g, o.current);
1482
- u(f, [b, y]);
1483
- }
1484
- },
1485
- selectRangeFromStartToItem: (f, g) => {
1486
- u(f, [pe(e), g]);
1487
- },
1488
- selectRangeFromItemToEnd: (f, g) => {
1489
- u(f, [g, Ct(e)]);
1490
- },
1491
- selectItemFromArrowNavigation: (f, g, b) => {
1492
- if (t.disableSelection || !t.multiSelect)
1493
- return;
1494
- let y = Te(n.selectedItems.value).slice();
1495
- Object.keys(s.current).length === 0 ? (y.push(b), s.current = {
1496
- [g]: !0,
1497
- [b]: !0
1498
- }) : (s.current[g] || (s.current = {}), s.current[b] ? (y = y.filter((C) => C !== g), delete s.current[g]) : (y.push(b), s.current[b] = !0)), c(f, y);
1499
- }
1500
- },
1501
- contextValue: {
1502
- selection: {
1503
- multiSelect: t.multiSelect,
1504
- checkboxSelection: t.checkboxSelection,
1505
- disableSelection: t.disableSelection
1506
- }
1507
- }
1508
- };
1509
- };
1510
- Se.models = {
1511
- selectedItems: {
1512
- getDefaultValue: (e) => e.defaultSelectedItems
1513
- }
1514
- };
1515
- const ao = [];
1516
- Se.getDefaultizedParams = (e) => E({}, e, {
1517
- disableSelection: e.disableSelection ?? !1,
1518
- multiSelect: e.multiSelect ?? !1,
1519
- checkboxSelection: e.checkboxSelection ?? !1,
1520
- defaultSelectedItems: e.defaultSelectedItems ?? (e.multiSelect ? ao : null)
1521
- });
1522
- Se.params = {
1523
- disableSelection: !0,
1524
- multiSelect: !0,
1525
- checkboxSelection: !0,
1526
- defaultSelectedItems: !0,
1527
- selectedItems: !0,
1528
- onSelectedItemsChange: !0,
1529
- onItemSelectionToggle: !0
1530
- };
1531
- const nt = 1e3;
1532
- class co {
1533
- constructor(t = nt) {
1534
- this.timeouts = /* @__PURE__ */ new Map(), this.cleanupTimeout = nt, this.cleanupTimeout = t;
1535
- }
1536
- register(t, n, o) {
1537
- this.timeouts || (this.timeouts = /* @__PURE__ */ new Map());
1538
- const s = setTimeout(() => {
1539
- typeof n == "function" && n(), this.timeouts.delete(o.cleanupToken);
1540
- }, this.cleanupTimeout);
1541
- this.timeouts.set(o.cleanupToken, s);
1542
- }
1543
- unregister(t) {
1544
- const n = this.timeouts.get(t.cleanupToken);
1545
- n && (this.timeouts.delete(t.cleanupToken), clearTimeout(n));
1546
- }
1547
- reset() {
1548
- this.timeouts && (this.timeouts.forEach((t, n) => {
1549
- this.unregister({
1550
- cleanupToken: n
1551
- });
1552
- }), this.timeouts = void 0);
1553
- }
1554
- }
1555
- class uo {
1556
- constructor() {
1557
- this.registry = new FinalizationRegistry((t) => {
1558
- typeof t == "function" && t();
1559
- });
1560
- }
1561
- register(t, n, o) {
1562
- this.registry.register(t, n, o);
1563
- }
1564
- unregister(t) {
1565
- this.registry.unregister(t);
1566
- }
1567
- // eslint-disable-next-line class-methods-use-this
1568
- reset() {
1569
- }
1570
- }
1571
- class po {
1572
- }
1573
- function fo(e) {
1574
- let t = 0;
1575
- return function(o, s, d) {
1576
- e.registry === null && (e.registry = typeof FinalizationRegistry < "u" ? new uo() : new co());
1577
- const [c] = x.useState(new po()), i = x.useRef(null), p = x.useRef();
1578
- p.current = d;
1579
- const u = x.useRef(null);
1580
- if (!i.current && p.current) {
1581
- const l = (a, m) => {
1582
- var I;
1583
- m.defaultMuiPrevented || (I = p.current) == null || I.call(p, a, m);
1584
- };
1585
- i.current = o.$$subscribeEvent(s, l), t += 1, u.current = {
1586
- cleanupToken: t
1587
- }, e.registry.register(
1588
- c,
1589
- // The callback below will be called once this reference stops being retained
1590
- () => {
1591
- var a;
1592
- (a = i.current) == null || a.call(i), i.current = null, u.current = null;
1593
- },
1594
- u.current
1595
- );
1596
- } else !p.current && i.current && (i.current(), i.current = null, u.current && (e.registry.unregister(u.current), u.current = null));
1597
- x.useEffect(() => {
1598
- if (!i.current && p.current) {
1599
- const l = (a, m) => {
1600
- var I;
1601
- m.defaultMuiPrevented || (I = p.current) == null || I.call(p, a, m);
1602
- };
1603
- i.current = o.$$subscribeEvent(s, l);
1604
- }
1605
- return u.current && e.registry && (e.registry.unregister(u.current), u.current = null), () => {
1606
- var l;
1607
- (l = i.current) == null || l.call(i), i.current = null;
1608
- };
1609
- }, [o, s]);
1610
- };
1611
- }
1612
- const mo = {
1613
- registry: null
1614
- }, Io = fo(mo), wt = (e = document) => {
1615
- const t = e.activeElement;
1616
- return t ? t.shadowRoot ? wt(t.shadowRoot) : t : null;
1617
- };
1618
- function go(e) {
1619
- return e.replace(/["\\]/g, "\\$&");
1620
- }
1621
- const ho = (e, t) => {
1622
- let n = Te(t).find((o) => {
1623
- if (!e.isItemNavigable(o))
1624
- return !1;
1625
- const s = e.getItemMeta(o);
1626
- return s && (s.parentId == null || e.isItemExpanded(s.parentId));
1627
- });
1628
- return n == null && (n = pe(e)), n;
1629
- }, _e = ({
1630
- instance: e,
1631
- params: t,
1632
- state: n,
1633
- setState: o,
1634
- models: s,
1635
- rootRef: d
1636
- }) => {
1637
- const c = ho(e, s.selectedItems.value), i = G((g) => {
1638
- const b = typeof g == "function" ? g(n.focusedItemId) : g;
1639
- n.focusedItemId !== b && o((y) => E({}, y, {
1640
- focusedItemId: b
1641
- }));
1642
- }), p = x.useCallback(() => !!d.current && d.current.contains(wt(dn(d.current))), [d]), u = x.useCallback((g) => n.focusedItemId === g && p(), [n.focusedItemId, p]), l = (g) => {
1643
- const b = e.getItemMeta(g);
1644
- return b && (b.parentId == null || e.isItemExpanded(b.parentId));
1645
- }, a = (g, b) => {
1646
- const y = e.getItemDOMElement(b);
1647
- y && y.focus(), i(b), t.onItemFocus && t.onItemFocus(g, b);
1648
- }, m = G((g, b) => {
1649
- l(b) && a(g, b);
1650
- }), I = G(() => {
1651
- if (n.focusedItemId == null)
1652
- return;
1653
- const g = e.getItemMeta(n.focusedItemId);
1654
- if (g) {
1655
- const b = document.getElementById(e.getTreeItemIdAttribute(n.focusedItemId, g.idAttribute));
1656
- b && b.blur();
1657
- }
1658
- i(null);
1659
- }), h = (g) => g === c;
1660
- Io(e, "removeItem", ({
1661
- id: g
1662
- }) => {
1663
- n.focusedItemId === g && a(null, c);
1664
- });
1665
- const f = (g) => (b) => {
1666
- var y;
1667
- (y = g.onFocus) == null || y.call(g, b), !b.defaultMuiPrevented && b.target === b.currentTarget && a(b, c);
1668
- };
1669
- return {
1670
- getRootProps: (g) => ({
1671
- onFocus: f(g)
1672
- }),
1673
- publicAPI: {
1674
- focusItem: m
1675
- },
1676
- instance: {
1677
- isItemFocused: u,
1678
- canItemBeTabbed: h,
1679
- focusItem: m,
1680
- removeFocusedItem: I
1681
- }
1682
- };
1683
- };
1684
- _e.getInitialState = () => ({
1685
- focusedItemId: null
1686
- });
1687
- _e.params = {
1688
- onItemFocus: !0
1689
- };
1690
- const we = (e, t) => e.getAvailablePlugins().has(t), bo = ({
1691
- props: e
1692
- }) => {
1693
- const {
1694
- instance: t
1695
- } = le(), {
1696
- label: n,
1697
- itemId: o
1698
- } = e, [s, d] = x.useState(n), c = t.isItemBeingEdited(o);
1699
- return x.useEffect(() => {
1700
- c || d(n);
1701
- }, [c, n]), {
1702
- propsEnhancers: {
1703
- labelInput: ({
1704
- externalEventHandlers: i,
1705
- interactions: p
1706
- }) => t.isItemEditable(o) ? {
1707
- value: s ?? "",
1708
- "data-element": "labelInput",
1709
- onChange: (I) => {
1710
- var h;
1711
- (h = i.onChange) == null || h.call(i, I), d(I.target.value);
1712
- },
1713
- onKeyDown: (I) => {
1714
- var f;
1715
- if ((f = i.onKeyDown) == null || f.call(i, I), I.defaultMuiPrevented)
1716
- return;
1717
- const h = I.target;
1718
- I.key === "Enter" && h.value ? p.handleSaveItemLabel(I, h.value) : I.key === "Escape" && p.handleCancelItemLabelEditing(I);
1719
- },
1720
- onBlur: (I) => {
1721
- var h;
1722
- (h = i.onBlur) == null || h.call(i, I), !I.defaultMuiPrevented && I.target.value && p.handleSaveItemLabel(I, I.target.value);
1723
- },
1724
- autoFocus: !0,
1725
- type: "text"
1726
- } : {}
1727
- }
1728
- };
1729
- }, ee = ({
1730
- instance: e,
1731
- state: t,
1732
- setState: n,
1733
- params: o,
1734
- experimentalFeatures: s
1735
- }) => {
1736
- process.env.NODE_ENV !== "production" && o.isItemEditable && !(s != null && s.labelEditing) && ft(["MUI X: The label editing feature requires the `labelEditing` experimental feature to be enabled.", "You can do it by passing `experimentalFeatures={{ labelEditing: true}}` to the `RichTreeViewPro` component.", "Check the documentation for more details: https://mui.com/x/react-tree-view/rich-tree-view/editing/"]);
1737
- const d = x.useRef(t.editedItemId), c = (m) => d.current === m, i = (m) => {
1738
- n((I) => E({}, I, {
1739
- editedItemId: m
1740
- })), d.current = m;
1741
- }, p = (m) => m === t.editedItemId, u = !!o.isItemEditable && !!s.labelEditing, l = (m) => {
1742
- if (m == null || !u)
1743
- return !1;
1744
- const I = e.getItem(m);
1745
- return I ? typeof o.isItemEditable == "function" ? o.isItemEditable(I) : !!o.isItemEditable : !1;
1746
- }, a = (m, I) => {
1747
- if (!I)
1748
- throw new Error(["MUI X: The Tree View component requires all items to have a `label` property.", "The label of an item cannot be empty.", m].join(`
1749
- `));
1750
- n((h) => {
1751
- const f = h.items.itemMetaMap[m];
1752
- return f.label !== I ? E({}, h, {
1753
- items: E({}, h.items, {
1754
- itemMetaMap: E({}, h.items.itemMetaMap, {
1755
- [m]: E({}, f, {
1756
- label: I
1757
- })
1758
- })
1759
- })
1760
- }) : h;
1761
- }), o.onItemLabelChange && o.onItemLabelChange(m, I);
1762
- };
1763
- return {
1764
- instance: {
1765
- setEditedItemId: i,
1766
- isItemBeingEdited: p,
1767
- updateItemLabel: a,
1768
- isItemEditable: l,
1769
- isTreeViewEditable: u,
1770
- isItemBeingEditedRef: c
1771
- },
1772
- publicAPI: {
1773
- updateItemLabel: a
1774
- }
1775
- };
1776
- };
1777
- ee.itemPlugin = bo;
1778
- ee.getInitialState = () => ({
1779
- editedItemId: null
1780
- });
1781
- ee.params = {
1782
- onItemLabelChange: !0,
1783
- isItemEditable: !0
1784
- };
1785
- function yo(e) {
1786
- return !!e && e.length === 1 && !!e.match(/\S/);
1787
- }
1788
- const vt = ({
1789
- instance: e,
1790
- params: t,
1791
- state: n
1792
- }) => {
1793
- const o = un(), s = x.useRef({}), d = G((l) => {
1794
- s.current = l(s.current);
1795
- });
1796
- x.useEffect(() => {
1797
- if (e.areItemUpdatesPrevented())
1798
- return;
1799
- const l = {}, a = (m) => {
1800
- l[m.id] = m.label.substring(0, 1).toLowerCase();
1801
- };
1802
- Object.values(n.items.itemMetaMap).forEach(a), s.current = l;
1803
- }, [n.items.itemMetaMap, t.getItemId, e]);
1804
- const c = (l, a) => {
1805
- const m = a.toLowerCase(), I = (b) => {
1806
- const y = Ce(e, b);
1807
- return y === null ? pe(e) : y;
1808
- };
1809
- let h = null, f = I(l);
1810
- const g = {};
1811
- for (; h == null && !g[f]; )
1812
- s.current[f] === m ? h = f : (g[f] = !0, f = I(f));
1813
- return h;
1814
- }, i = (l) => !t.disableSelection && !e.isItemDisabled(l), p = (l) => !e.isItemDisabled(l) && e.isItemExpandable(l);
1815
- return {
1816
- instance: {
1817
- updateFirstCharMap: d,
1818
- handleItemKeyDown: (l, a) => {
1819
- if (l.defaultMuiPrevented || l.altKey || Fe(l.target, l.currentTarget))
1820
- return;
1821
- const m = l.ctrlKey || l.metaKey, I = l.key;
1822
- switch (!0) {
1823
- case (I === " " && i(a)): {
1824
- l.preventDefault(), t.multiSelect && l.shiftKey ? e.expandSelectionRange(l, a) : e.selectItem({
1825
- event: l,
1826
- itemId: a,
1827
- keepExistingSelection: t.multiSelect,
1828
- shouldBeSelected: t.multiSelect ? void 0 : !0
1829
- });
1830
- break;
1831
- }
1832
- case I === "Enter": {
1833
- we(e, ee) && e.isItemEditable(a) && !e.isItemBeingEdited(a) ? e.setEditedItemId(a) : p(a) ? (e.toggleItemExpansion(l, a), l.preventDefault()) : i(a) && (t.multiSelect ? (l.preventDefault(), e.selectItem({
1834
- event: l,
1835
- itemId: a,
1836
- keepExistingSelection: !0
1837
- })) : e.isItemSelected(a) || (e.selectItem({
1838
- event: l,
1839
- itemId: a
1840
- }), l.preventDefault()));
1841
- break;
1842
- }
1843
- case I === "ArrowDown": {
1844
- const h = Ce(e, a);
1845
- h && (l.preventDefault(), e.focusItem(l, h), t.multiSelect && l.shiftKey && i(h) && e.selectItemFromArrowNavigation(l, a, h));
1846
- break;
1847
- }
1848
- case I === "ArrowUp": {
1849
- const h = Et(e, a);
1850
- h && (l.preventDefault(), e.focusItem(l, h), t.multiSelect && l.shiftKey && i(h) && e.selectItemFromArrowNavigation(l, a, h));
1851
- break;
1852
- }
1853
- case (I === "ArrowRight" && !o || I === "ArrowLeft" && o): {
1854
- if (e.isItemExpanded(a)) {
1855
- const h = Ce(e, a);
1856
- h && (e.focusItem(l, h), l.preventDefault());
1857
- } else p(a) && (e.toggleItemExpansion(l, a), l.preventDefault());
1858
- break;
1859
- }
1860
- case (I === "ArrowLeft" && !o || I === "ArrowRight" && o): {
1861
- if (p(a) && e.isItemExpanded(a))
1862
- e.toggleItemExpansion(l, a), l.preventDefault();
1863
- else {
1864
- const h = e.getItemMeta(a).parentId;
1865
- h && (e.focusItem(l, h), l.preventDefault());
1866
- }
1867
- break;
1868
- }
1869
- case I === "Home": {
1870
- i(a) && t.multiSelect && m && l.shiftKey ? e.selectRangeFromStartToItem(l, a) : e.focusItem(l, pe(e)), l.preventDefault();
1871
- break;
1872
- }
1873
- case I === "End": {
1874
- i(a) && t.multiSelect && m && l.shiftKey ? e.selectRangeFromItemToEnd(l, a) : e.focusItem(l, Ct(e)), l.preventDefault();
1875
- break;
1876
- }
1877
- case I === "*": {
1878
- e.expandAllSiblings(l, a), l.preventDefault();
1879
- break;
1880
- }
1881
- case (I === "a" && m && t.multiSelect && !t.disableSelection): {
1882
- e.selectAllNavigableItems(l), l.preventDefault();
1883
- break;
1884
- }
1885
- case (!m && !l.shiftKey && yo(I)): {
1886
- const h = c(a, I);
1887
- h != null && (e.focusItem(l, h), l.preventDefault());
1888
- break;
1889
- }
1890
- }
1891
- }
1892
- }
1893
- };
1894
- };
1895
- vt.params = {};
1896
- const Mt = ({
1897
- slots: e,
1898
- slotProps: t
1899
- }) => ({
1900
- contextValue: {
1901
- icons: {
1902
- slots: {
1903
- collapseIcon: e.collapseIcon,
1904
- expandIcon: e.expandIcon,
1905
- endIcon: e.endIcon
1906
- },
1907
- slotProps: {
1908
- collapseIcon: t.collapseIcon,
1909
- expandIcon: t.expandIcon,
1910
- endIcon: t.endIcon
1911
- }
1912
- }
1913
- }
1914
- });
1915
- Mt.params = {};
1916
- const Be = /* @__PURE__ */ x.createContext(null);
1917
- process.env.NODE_ENV !== "production" && (Be.displayName = "TreeViewChildrenItemContext");
1918
- function ze(e) {
1919
- const {
1920
- children: t,
1921
- itemId: n = null
1922
- } = e, {
1923
- instance: o,
1924
- rootRef: s
1925
- } = le(), d = x.useRef(/* @__PURE__ */ new Map());
1926
- x.useEffect(() => {
1927
- if (!s.current)
1928
- return;
1929
- let i = null;
1930
- if (n == null)
1931
- i = s.current.id;
1932
- else {
1933
- const I = o.getItemMeta(n);
1934
- I !== void 0 && (i = o.getTreeItemIdAttribute(n, I.idAttribute));
1935
- }
1936
- if (i == null)
1937
- return;
1938
- const p = o.getItemOrderedChildrenIds(n ?? null) ?? [], u = go(i), l = s.current.querySelectorAll(`${n == null ? "" : `*[id="${u}"] `}[role="treeitem"]:not(*[id="${u}"] [role="treeitem"] [role="treeitem"])`), a = Array.from(l).map((I) => d.current.get(I.id));
1939
- (a.length !== p.length || a.some((I, h) => I !== p[h])) && o.setJSXItemsOrderedChildrenIds(n ?? null, a);
1940
- });
1941
- const c = x.useMemo(() => ({
1942
- registerChild: (i, p) => d.current.set(i, p),
1943
- unregisterChild: (i) => d.current.delete(i),
1944
- parentId: n
1945
- }), [n]);
1946
- return /* @__PURE__ */ w(Be.Provider, {
1947
- value: c,
1948
- children: t
1949
- });
1950
- }
1951
- process.env.NODE_ENV !== "production" && (ze.propTypes = {
1952
- children: r.node,
1953
- id: r.string
1954
- });
1955
- const be = ({
1956
- instance: e,
1957
- setState: t
1958
- }) => {
1959
- e.preventItemUpdates();
1960
- const n = G((d) => (t((c) => {
1961
- if (c.items.itemMetaMap[d.id] != null)
1962
- throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.", "Alternatively, you can use the `getItemId` prop to specify a custom id for each item.", `Two items were provided with the same id in the \`items\` prop: "${d.id}"`].join(`
1963
- `));
1964
- return E({}, c, {
1965
- items: E({}, c.items, {
1966
- itemMetaMap: E({}, c.items.itemMetaMap, {
1967
- [d.id]: d
1968
- }),
1969
- // For `SimpleTreeView`, we don't have a proper `item` object, so we create a very basic one.
1970
- itemMap: E({}, c.items.itemMap, {
1971
- [d.id]: {
1972
- id: d.id,
1973
- label: d.label
1974
- }
1975
- })
1976
- })
1977
- });
1978
- }), () => {
1979
- t((c) => {
1980
- const i = E({}, c.items.itemMetaMap), p = E({}, c.items.itemMap);
1981
- return delete i[d.id], delete p[d.id], E({}, c, {
1982
- items: E({}, c.items, {
1983
- itemMetaMap: i,
1984
- itemMap: p
1985
- })
1986
- });
1987
- }), ht(e, "removeItem", {
1988
- id: d.id
1989
- });
1990
- })), o = (d, c) => {
1991
- const i = d ?? Z;
1992
- t((p) => E({}, p, {
1993
- items: E({}, p.items, {
1994
- itemOrderedChildrenIds: E({}, p.items.itemOrderedChildrenIds, {
1995
- [i]: c
1996
- }),
1997
- itemChildrenIndexes: E({}, p.items.itemChildrenIndexes, {
1998
- [i]: bt(c)
1999
- })
2000
- })
2001
- }));
2002
- }, s = G((d, c) => (e.updateFirstCharMap((i) => (i[d] = c, i)), () => {
2003
- e.updateFirstCharMap((i) => {
2004
- const p = E({}, i);
2005
- return delete p[d], p;
2006
- });
2007
- }));
2008
- return {
2009
- instance: {
2010
- insertJSXItem: n,
2011
- setJSXItemsOrderedChildrenIds: o,
2012
- mapFirstCharFromJSX: s
2013
- }
2014
- };
2015
- }, St = (e) => Array.isArray(e) ? e.length > 0 && e.some(St) : !!e, xo = ({
2016
- props: e,
2017
- rootRef: t,
2018
- contentRef: n
2019
- }) => {
2020
- const {
2021
- instance: o
2022
- } = le(), {
2023
- children: s,
2024
- disabled: d = !1,
2025
- label: c,
2026
- itemId: i,
2027
- id: p
2028
- } = e, u = x.useContext(Be);
2029
- if (u == null)
2030
- throw new Error(["MUI X: Could not find the Tree View Children Item context.", "It looks like you rendered your component outside of a SimpleTreeView parent component.", "This can also happen if you are bundling multiple versions of the Tree View."].join(`
2031
- `));
2032
- const {
2033
- registerChild: l,
2034
- unregisterChild: a,
2035
- parentId: m
2036
- } = u, I = St(s), h = x.useRef(null), f = de(h, n);
2037
- return pn(() => {
2038
- const g = o.getTreeItemIdAttribute(i, p);
2039
- return l(g, i), () => {
2040
- a(g);
2041
- };
2042
- }, [o, l, a, i, p]), x.useEffect(() => o.insertJSXItem({
2043
- id: i,
2044
- idAttribute: p,
2045
- parentId: m,
2046
- expandable: I,
2047
- disabled: d
2048
- }), [o, m, i, I, d, p]), x.useEffect(() => {
2049
- var g;
2050
- if (c)
2051
- return o.mapFirstCharFromJSX(i, (((g = h.current) == null ? void 0 : g.textContent) ?? "").substring(0, 1).toLowerCase());
2052
- }, [o, i, c]), {
2053
- contentRef: f,
2054
- rootRef: t
2055
- };
2056
- };
2057
- be.itemPlugin = xo;
2058
- be.wrapItem = ({
2059
- children: e,
2060
- itemId: t
2061
- }) => {
2062
- const n = x.useContext(se);
2063
- return /* @__PURE__ */ w(ze, {
2064
- itemId: t,
2065
- children: /* @__PURE__ */ w(se.Provider, {
2066
- value: n + 1,
2067
- children: e
2068
- })
2069
- });
2070
- };
2071
- be.wrapRoot = ({
2072
- children: e
2073
- }) => /* @__PURE__ */ w(ze, {
2074
- children: /* @__PURE__ */ w(se.Provider, {
2075
- value: 0,
2076
- children: e
2077
- })
2078
- });
2079
- be.params = {};
2080
- const Eo = [he, Me, Se, _e, vt, Mt, be], Co = pt(), To = (e) => {
2081
- const {
2082
- classes: t
2083
- } = e;
2084
- return ge({
2085
- root: ["root"]
2086
- }, Wn, t);
2087
- }, wo = U("ul", {
2088
- name: "MuiSimpleTreeView",
2089
- slot: "Root",
2090
- overridesResolver: (e, t) => t.root
2091
- })({
2092
- padding: 0,
2093
- margin: 0,
2094
- listStyle: "none",
2095
- outline: 0,
2096
- position: "relative"
2097
- }), vo = [], Rt = /* @__PURE__ */ x.forwardRef(function(t, n) {
2098
- const o = Co({
2099
- props: t,
2100
- name: "MuiSimpleTreeView"
2101
- }), s = o;
2102
- process.env.NODE_ENV !== "production" && o.items != null && ft(["MUI X: The `SimpleTreeView` component does not support the `items` prop.", "If you want to add items, you need to pass them as JSX children.", "Check the documentation for more details: https://mui.com/x/react-tree-view/simple-tree-view/items/."]);
2103
- const {
2104
- getRootProps: d,
2105
- contextValue: c
2106
- } = no({
2107
- plugins: Eo,
2108
- rootRef: n,
2109
- props: E({}, o, {
2110
- items: vo
2111
- })
2112
- }), {
2113
- slots: i,
2114
- slotProps: p
2115
- } = o, u = To(o), l = (i == null ? void 0 : i.root) ?? wo, a = ce({
2116
- elementType: l,
2117
- externalSlotProps: p == null ? void 0 : p.root,
2118
- className: u.root,
2119
- getSlotProps: d,
2120
- ownerState: s
2121
- });
2122
- return /* @__PURE__ */ w(oo, {
2123
- value: c,
2124
- children: /* @__PURE__ */ w(l, E({}, a))
2125
- });
2126
- });
2127
- process.env.NODE_ENV !== "production" && (Rt.propTypes = {
2128
- // ----------------------------- Warning --------------------------------
2129
- // | These PropTypes are generated from the TypeScript type definitions |
2130
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
2131
- // ----------------------------------------------------------------------
2132
- /**
2133
- * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
2134
- */
2135
- apiRef: r.shape({
2136
- current: r.shape({
2137
- focusItem: r.func.isRequired,
2138
- getItem: r.func.isRequired,
2139
- getItemDOMElement: r.func.isRequired,
2140
- getItemOrderedChildrenIds: r.func.isRequired,
2141
- getItemTree: r.func.isRequired,
2142
- selectItem: r.func.isRequired,
2143
- setItemExpansion: r.func.isRequired
2144
- })
2145
- }),
2146
- /**
2147
- * If `true`, the tree view renders a checkbox at the left of its label that allows selecting it.
2148
- * @default false
2149
- */
2150
- checkboxSelection: r.bool,
2151
- /**
2152
- * The content of the component.
2153
- */
2154
- children: r.node,
2155
- /**
2156
- * Override or extend the styles applied to the component.
2157
- */
2158
- classes: r.object,
2159
- className: r.string,
2160
- /**
2161
- * Expanded item ids.
2162
- * Used when the item's expansion is not controlled.
2163
- * @default []
2164
- */
2165
- defaultExpandedItems: r.arrayOf(r.string),
2166
- /**
2167
- * Selected item ids. (Uncontrolled)
2168
- * When `multiSelect` is true this takes an array of strings; when false (default) a string.
2169
- * @default []
2170
- */
2171
- defaultSelectedItems: r.any,
2172
- /**
2173
- * If `true`, will allow focus on disabled items.
2174
- * @default false
2175
- */
2176
- disabledItemsFocusable: r.bool,
2177
- /**
2178
- * If `true` selection is disabled.
2179
- * @default false
2180
- */
2181
- disableSelection: r.bool,
2182
- /**
2183
- * Expanded item ids.
2184
- * Used when the item's expansion is controlled.
2185
- */
2186
- expandedItems: r.arrayOf(r.string),
2187
- /**
2188
- * The slot that triggers the item's expansion when clicked.
2189
- * @default 'content'
2190
- */
2191
- expansionTrigger: r.oneOf(["content", "iconContainer"]),
2192
- /**
2193
- * Unstable features, breaking changes might be introduced.
2194
- * For each feature, if the flag is not explicitly set to `true`,
2195
- * the feature will be fully disabled and any property / method call will not have any effect.
2196
- */
2197
- experimentalFeatures: r.shape({
2198
- indentationAtItemLevel: r.bool
2199
- }),
2200
- /**
2201
- * This prop is used to help implement the accessibility logic.
2202
- * If you don't provide this prop. It falls back to a randomly generated id.
2203
- */
2204
- id: r.string,
2205
- /**
2206
- * Horizontal indentation between an item and its children.
2207
- * Examples: 24, "24px", "2rem", "2em".
2208
- * @default 12px
2209
- */
2210
- itemChildrenIndentation: r.oneOfType([r.number, r.string]),
2211
- /**
2212
- * If `true`, `ctrl` and `shift` will trigger multiselect.
2213
- * @default false
2214
- */
2215
- multiSelect: r.bool,
2216
- /**
2217
- * Callback fired when tree items are expanded/collapsed.
2218
- * @param {React.SyntheticEvent} event The DOM event that triggered the change.
2219
- * @param {array} itemIds The ids of the expanded items.
2220
- */
2221
- onExpandedItemsChange: r.func,
2222
- /**
2223
- * Callback fired when the `content` slot of a given tree item is clicked.
2224
- * @param {React.MouseEvent} event The DOM event that triggered the change.
2225
- * @param {string} itemId The id of the focused item.
2226
- */
2227
- onItemClick: r.func,
2228
- /**
2229
- * Callback fired when a tree item is expanded or collapsed.
2230
- * @param {React.SyntheticEvent} event The DOM event that triggered the change.
2231
- * @param {array} itemId The itemId of the modified item.
2232
- * @param {array} isExpanded `true` if the item has just been expanded, `false` if it has just been collapsed.
2233
- */
2234
- onItemExpansionToggle: r.func,
2235
- /**
2236
- * Callback fired when a given tree item is focused.
2237
- * @param {React.SyntheticEvent | null} event The DOM event that triggered the change. **Warning**: This is a generic event not a focus event.
2238
- * @param {string} itemId The id of the focused item.
2239
- */
2240
- onItemFocus: r.func,
2241
- /**
2242
- * Callback fired when a tree item is selected or deselected.
2243
- * @param {React.SyntheticEvent} event The DOM event that triggered the change.
2244
- * @param {array} itemId The itemId of the modified item.
2245
- * @param {array} isSelected `true` if the item has just been selected, `false` if it has just been deselected.
2246
- */
2247
- onItemSelectionToggle: r.func,
2248
- /**
2249
- * Callback fired when tree items are selected/deselected.
2250
- * @param {React.SyntheticEvent} event The DOM event that triggered the change.
2251
- * @param {string[] | string} itemIds The ids of the selected items.
2252
- * When `multiSelect` is `true`, this is an array of strings; when false (default) a string.
2253
- */
2254
- onSelectedItemsChange: r.func,
2255
- /**
2256
- * Selected item ids. (Controlled)
2257
- * When `multiSelect` is true this takes an array of strings; when false (default) a string.
2258
- */
2259
- selectedItems: r.any,
2260
- /**
2261
- * The props used for each component slot.
2262
- */
2263
- slotProps: r.object,
2264
- /**
2265
- * Overridable component slots.
2266
- */
2267
- slots: r.object,
2268
- /**
2269
- * The system prop that allows defining system overrides as well as additional CSS styles.
2270
- */
2271
- sx: r.oneOfType([r.arrayOf(r.oneOfType([r.func, r.object, r.bool])), r.func, r.object])
2272
- });
2273
- function kt(e) {
2274
- const {
2275
- instance: t,
2276
- items: {
2277
- onItemClick: n
2278
- },
2279
- selection: {
2280
- multiSelect: o,
2281
- checkboxSelection: s,
2282
- disableSelection: d
2283
- },
2284
- expansion: {
2285
- expansionTrigger: c
2286
- }
2287
- } = le(), i = t.isItemExpandable(e), p = t.isItemExpanded(e), u = t.isItemFocused(e), l = t.isItemSelected(e), a = t.isItemDisabled(e), m = t != null && t.isItemBeingEdited ? t == null ? void 0 : t.isItemBeingEdited(e) : !1, I = t.isItemEditable ? t.isItemEditable(e) : !1, h = (T) => {
2288
- if (!a) {
2289
- u || t.focusItem(T, e);
2290
- const v = o && (T.shiftKey || T.ctrlKey || T.metaKey);
2291
- i && !(v && t.isItemExpanded(e)) && t.toggleItemExpansion(T, e);
2292
- }
2293
- }, f = (T) => {
2294
- a || (u || t.focusItem(T, e), o && (T.shiftKey || T.ctrlKey || T.metaKey) ? T.shiftKey ? t.expandSelectionRange(T, e) : t.selectItem({
2295
- event: T,
2296
- itemId: e,
2297
- keepExistingSelection: !0
2298
- }) : t.selectItem({
2299
- event: T,
2300
- itemId: e,
2301
- shouldBeSelected: !0
2302
- }));
2303
- }, g = (T) => {
2304
- if (d || a)
2305
- return;
2306
- const v = T.nativeEvent.shiftKey;
2307
- o && v ? t.expandSelectionRange(T, e) : t.selectItem({
2308
- event: T,
2309
- itemId: e,
2310
- keepExistingSelection: o,
2311
- shouldBeSelected: T.target.checked
2312
- });
2313
- }, b = (T) => {
2314
- (T.shiftKey || T.ctrlKey || T.metaKey || a) && T.preventDefault();
2315
- }, y = () => {
2316
- we(t, ee) && t.isItemEditable(e) && (t.isItemBeingEdited(e) ? t.setEditedItemId(null) : t.setEditedItemId(e));
2317
- };
2318
- return {
2319
- disabled: a,
2320
- expanded: p,
2321
- selected: l,
2322
- focused: u,
2323
- editable: I,
2324
- editing: m,
2325
- disableSelection: d,
2326
- checkboxSelection: s,
2327
- handleExpansion: h,
2328
- handleSelection: f,
2329
- handleCheckboxSelection: g,
2330
- handleContentClick: n,
2331
- preventSelection: b,
2332
- expansionTrigger: c,
2333
- toggleItemEditing: y,
2334
- handleSaveItemLabel: (T, v) => {
2335
- we(t, ee) && t.isItemBeingEditedRef(e) && (t.updateItemLabel(e, v), y(), t.focusItem(T, e));
2336
- },
2337
- handleCancelItemLabelEditing: (T) => {
2338
- we(t, ee) && t.isItemBeingEditedRef(e) && (y(), t.focusItem(T, e));
2339
- }
2340
- };
2341
- }
2342
- const Mo = U("div", {
2343
- name: "MuiTreeItem2DragAndDropOverlay",
2344
- slot: "Root",
2345
- overridesResolver: (e, t) => t.root,
2346
- shouldForwardProp: (e) => fn(e) && e !== "action"
2347
- })(({
2348
- theme: e
2349
- }) => ({
2350
- position: "absolute",
2351
- left: 0,
2352
- display: "flex",
2353
- top: 0,
2354
- bottom: 0,
2355
- right: 0,
2356
- pointerEvents: "none",
2357
- variants: [{
2358
- props: {
2359
- action: "make-child"
2360
- },
2361
- style: {
2362
- marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
2363
- borderRadius: e.shape.borderRadius,
2364
- backgroundColor: X((e.vars || e).palette.primary.dark, 0.15)
2365
- }
2366
- }, {
2367
- props: {
2368
- action: "reorder-above"
2369
- },
2370
- style: E({
2371
- marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
2372
- borderTop: `1px solid ${X((e.vars || e).palette.grey[900], 0.6)}`
2373
- }, e.applyStyles("dark", {
2374
- borderTopColor: X((e.vars || e).palette.grey[100], 0.6)
2375
- }))
2376
- }, {
2377
- props: {
2378
- action: "reorder-below"
2379
- },
2380
- style: E({
2381
- marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
2382
- borderBottom: `1px solid ${X((e.vars || e).palette.grey[900], 0.6)}`
2383
- }, e.applyStyles("dark", {
2384
- borderBottomColor: X((e.vars || e).palette.grey[100], 0.6)
2385
- }))
2386
- }, {
2387
- props: {
2388
- action: "move-to-parent"
2389
- },
2390
- style: E({
2391
- marginLeft: "calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",
2392
- borderBottom: `1px solid ${X((e.vars || e).palette.grey[900], 0.6)}`
2393
- }, e.applyStyles("dark", {
2394
- borderBottomColor: X((e.vars || e).palette.grey[900], 0.6)
2395
- }))
2396
- }]
2397
- }));
2398
- function So(e) {
2399
- return e.action == null ? null : /* @__PURE__ */ w(Mo, E({}, e));
2400
- }
2401
- const Ro = U("input", {
2402
- name: "MuiTreeItem2",
2403
- slot: "LabelInput",
2404
- overridesResolver: (e, t) => t.labelInput
2405
- })(({
2406
- theme: e
2407
- }) => E({}, e.typography.body1, {
2408
- width: "100%",
2409
- backgroundColor: e.palette.background.paper,
2410
- borderRadius: e.shape.borderRadius,
2411
- border: "none",
2412
- padding: "0 2px",
2413
- boxSizing: "border-box",
2414
- "&:focus": {
2415
- outline: `1px solid ${e.palette.primary.main}`
2416
- }
2417
- })), ko = ["classes", "className", "displayIcon", "expansionIcon", "icon", "label", "itemId", "onClick", "onMouseDown", "dragAndDropOverlayProps", "labelInputProps"], Ue = /* @__PURE__ */ x.forwardRef(function(t, n) {
2418
- const {
2419
- classes: o,
2420
- className: s,
2421
- displayIcon: d,
2422
- expansionIcon: c,
2423
- icon: i,
2424
- label: p,
2425
- itemId: u,
2426
- onClick: l,
2427
- onMouseDown: a,
2428
- dragAndDropOverlayProps: m,
2429
- labelInputProps: I
2430
- } = t, h = Q(t, ko), {
2431
- disabled: f,
2432
- expanded: g,
2433
- selected: b,
2434
- focused: y,
2435
- editing: C,
2436
- editable: k,
2437
- disableSelection: T,
2438
- checkboxSelection: v,
2439
- handleExpansion: R,
2440
- handleSelection: B,
2441
- handleCheckboxSelection: K,
2442
- handleContentClick: V,
2443
- preventSelection: A,
2444
- expansionTrigger: z,
2445
- toggleItemEditing: j
2446
- } = kt(u), q = i || c || d, N = x.useRef(null), H = (O) => {
2447
- A(O), a && a(O);
2448
- }, L = (O) => {
2449
- var P;
2450
- V == null || V(O, u), !((P = N.current) != null && P.contains(O.target)) && (z === "content" && R(O), v || B(O), l && l(O));
2451
- }, W = (O) => {
2452
- O.defaultMuiPrevented || j();
2453
- };
2454
- return (
2455
- /* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions -- Key event is handled by the TreeView */
2456
- /* @__PURE__ */ ve("div", E({}, h, {
2457
- className: Ie(s, o.root, g && o.expanded, b && o.selected, y && o.focused, f && o.disabled, C && o.editing, k && o.editable),
2458
- onClick: L,
2459
- onMouseDown: H,
2460
- ref: n,
2461
- children: [/* @__PURE__ */ w("div", {
2462
- className: o.iconContainer,
2463
- children: q
2464
- }), v && /* @__PURE__ */ w(ut, {
2465
- className: o.checkbox,
2466
- checked: b,
2467
- onChange: K,
2468
- disabled: f || T,
2469
- ref: N,
2470
- tabIndex: -1
2471
- }), C ? /* @__PURE__ */ w(Ro, E({}, I, {
2472
- className: o.labelInput
2473
- })) : /* @__PURE__ */ w("div", E({
2474
- className: o.label
2475
- }, k && {
2476
- onDoubleClick: W
2477
- }, {
2478
- children: p
2479
- })), m && /* @__PURE__ */ w(So, E({}, m))]
2480
- }))
2481
- );
2482
- });
2483
- process.env.NODE_ENV !== "production" && (Ue.propTypes = {
2484
- // ----------------------------- Warning --------------------------------
2485
- // | These PropTypes are generated from the TypeScript type definitions |
2486
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
2487
- // ----------------------------------------------------------------------
2488
- /**
2489
- * Override or extend the styles applied to the component.
2490
- */
2491
- classes: r.object.isRequired,
2492
- className: r.string,
2493
- /**
2494
- * The icon to display next to the tree item's label. Either a parent or end icon.
2495
- */
2496
- displayIcon: r.node,
2497
- dragAndDropOverlayProps: r.shape({
2498
- action: r.oneOf(["make-child", "move-to-parent", "reorder-above", "reorder-below"]),
2499
- style: r.object
2500
- }),
2501
- /**
2502
- * The icon to display next to the tree item's label. Either an expansion or collapse icon.
2503
- */
2504
- expansionIcon: r.node,
2505
- /**
2506
- * The icon to display next to the tree item's label.
2507
- */
2508
- icon: r.node,
2509
- /**
2510
- * The id of the item.
2511
- */
2512
- itemId: r.string.isRequired,
2513
- /**
2514
- * The tree item label.
2515
- */
2516
- label: r.node,
2517
- labelInputProps: r.shape({
2518
- autoFocus: r.oneOf([!0]),
2519
- "data-element": r.oneOf(["labelInput"]),
2520
- onBlur: r.func,
2521
- onChange: r.func,
2522
- onKeyDown: r.func,
2523
- type: r.oneOf(["text"]),
2524
- value: r.string
2525
- })
2526
- });
2527
- function Oo(e) {
2528
- return fe("MuiTreeItem", e);
2529
- }
2530
- const J = me("MuiTreeItem", ["root", "groupTransition", "content", "expanded", "selected", "focused", "disabled", "iconContainer", "label", "checkbox", "labelInput", "editable", "editing", "dragAndDropOverlay"]), Po = te(/* @__PURE__ */ w("path", {
2531
- d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"
2532
- }), "TreeViewExpandIcon"), Do = te(/* @__PURE__ */ w("path", {
2533
- d: "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
2534
- }), "TreeViewCollapseIcon");
2535
- function Ot(e) {
2536
- const {
2537
- children: t,
2538
- itemId: n
2539
- } = e, {
2540
- wrapItem: o,
2541
- instance: s
2542
- } = le();
2543
- return o({
2544
- children: t,
2545
- itemId: n,
2546
- instance: s
2547
- });
2548
- }
2549
- Ot.propTypes = {
2550
- // ----------------------------- Warning --------------------------------
2551
- // | These PropTypes are generated from the TypeScript type definitions |
2552
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
2553
- // ----------------------------------------------------------------------
2554
- children: r.node,
2555
- itemId: r.string.isRequired
2556
- };
2557
- const Vo = ["children", "className", "slots", "slotProps", "ContentComponent", "ContentProps", "itemId", "id", "label", "onClick", "onMouseDown", "onFocus", "onBlur", "onKeyDown"], $o = ["ownerState"], Ao = ["ownerState"], Fo = ["ownerState"], No = pt(), Lo = (e) => {
2558
- const {
2559
- classes: t
2560
- } = e;
2561
- return ge({
2562
- root: ["root"],
2563
- content: ["content"],
2564
- expanded: ["expanded"],
2565
- selected: ["selected"],
2566
- focused: ["focused"],
2567
- disabled: ["disabled"],
2568
- iconContainer: ["iconContainer"],
2569
- checkbox: ["checkbox"],
2570
- label: ["label"],
2571
- labelInput: ["labelInput"],
2572
- editing: ["editing"],
2573
- editable: ["editable"],
2574
- groupTransition: ["groupTransition"]
2575
- }, Oo, t);
2576
- }, jo = U("li", {
2577
- name: "MuiTreeItem",
2578
- slot: "Root",
2579
- overridesResolver: (e, t) => t.root
2580
- })({
2581
- listStyle: "none",
2582
- margin: 0,
2583
- padding: 0,
2584
- outline: 0
2585
- }), _o = U(Ue, {
2586
- name: "MuiTreeItem",
2587
- slot: "Content",
2588
- overridesResolver: (e, t) => [t.content, t.iconContainer && {
2589
- [`& .${J.iconContainer}`]: t.iconContainer
2590
- }, t.label && {
2591
- [`& .${J.label}`]: t.label
2592
- }],
2593
- shouldForwardProp: (e) => lt(e) && e !== "indentationAtItemLevel"
2594
- })(({
2595
- theme: e
2596
- }) => ({
2597
- padding: e.spacing(0.5, 1),
2598
- borderRadius: e.shape.borderRadius,
2599
- width: "100%",
2600
- boxSizing: "border-box",
2601
- // prevent width + padding to overflow
2602
- position: "relative",
2603
- display: "flex",
2604
- alignItems: "center",
2605
- gap: e.spacing(1),
2606
- cursor: "pointer",
2607
- WebkitTapHighlightColor: "transparent",
2608
- "&:hover": {
2609
- backgroundColor: (e.vars || e).palette.action.hover,
2610
- // Reset on touch devices, it doesn't add specificity
2611
- "@media (hover: none)": {
2612
- backgroundColor: "transparent"
2613
- }
2614
- },
2615
- [`&.${J.disabled}`]: {
2616
- opacity: (e.vars || e).palette.action.disabledOpacity,
2617
- backgroundColor: "transparent"
2618
- },
2619
- [`&.${J.focused}`]: {
2620
- backgroundColor: (e.vars || e).palette.action.focus
2621
- },
2622
- [`&.${J.selected}`]: {
2623
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : X(e.palette.primary.main, e.palette.action.selectedOpacity),
2624
- "&:hover": {
2625
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))` : X(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.hoverOpacity),
2626
- // Reset on touch devices, it doesn't add specificity
2627
- "@media (hover: none)": {
2628
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : X(e.palette.primary.main, e.palette.action.selectedOpacity)
2629
- }
2630
- },
2631
- [`&.${J.focused}`]: {
2632
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))` : X(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.focusOpacity)
2633
- }
2634
- },
2635
- [`& .${J.iconContainer}`]: {
2636
- width: 16,
2637
- display: "flex",
2638
- flexShrink: 0,
2639
- justifyContent: "center",
2640
- "& svg": {
2641
- fontSize: 18
2642
- }
2643
- },
2644
- [`& .${J.label}`]: E({
2645
- width: "100%",
2646
- boxSizing: "border-box",
2647
- // prevent width + padding to overflow
2648
- // fixes overflow - see https://github.com/mui/material-ui/issues/27372
2649
- minWidth: 0,
2650
- position: "relative"
2651
- }, e.typography.body1),
2652
- [`& .${J.checkbox}`]: {
2653
- padding: 0
2654
- },
2655
- variants: [{
2656
- props: {
2657
- indentationAtItemLevel: !0
2658
- },
2659
- style: {
2660
- paddingLeft: `calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`
2661
- }
2662
- }]
2663
- })), Bo = U(Le, {
2664
- name: "MuiTreeItem",
2665
- slot: "GroupTransition",
2666
- overridesResolver: (e, t) => t.groupTransition,
2667
- shouldForwardProp: (e) => lt(e) && e !== "indentationAtItemLevel"
2668
- })({
2669
- margin: 0,
2670
- padding: 0,
2671
- paddingLeft: "var(--TreeView-itemChildrenIndentation)",
2672
- variants: [{
2673
- props: {
2674
- indentationAtItemLevel: !0
2675
- },
2676
- style: {
2677
- paddingLeft: 0
2678
- }
2679
- }]
2680
- }), Pt = /* @__PURE__ */ x.forwardRef(function(t, n) {
2681
- var Xe, We, Je, Ge;
2682
- const {
2683
- icons: o,
2684
- runItemPlugins: s,
2685
- items: {
2686
- disabledItemsFocusable: d,
2687
- indentationAtItemLevel: c
2688
- },
2689
- selection: {
2690
- multiSelect: i
2691
- },
2692
- expansion: {
2693
- expansionTrigger: p
2694
- },
2695
- instance: u
2696
- } = le(), l = x.useContext(se), a = No({
2697
- props: t,
2698
- name: "MuiTreeItem"
2699
- }), {
2700
- children: m,
2701
- className: I,
2702
- slots: h,
2703
- slotProps: f,
2704
- ContentComponent: g = Ue,
2705
- ContentProps: b,
2706
- itemId: y,
2707
- id: C,
2708
- label: k,
2709
- onClick: T,
2710
- onMouseDown: v,
2711
- onBlur: R,
2712
- onKeyDown: B
2713
- } = a, K = Q(a, Vo), {
2714
- expanded: V,
2715
- focused: A,
2716
- selected: z,
2717
- disabled: j,
2718
- editing: q,
2719
- handleExpansion: N,
2720
- handleCancelItemLabelEditing: H,
2721
- handleSaveItemLabel: L
2722
- } = kt(y), {
2723
- contentRef: W,
2724
- rootRef: O,
2725
- propsEnhancers: P
2726
- } = s(a), ne = x.useRef(null), ye = x.useRef(null), Re = de(n, O, ne), ke = de(b == null ? void 0 : b.ref, W, ye), oe = {
2727
- expandIcon: (h == null ? void 0 : h.expandIcon) ?? o.slots.expandIcon ?? Po,
2728
- collapseIcon: (h == null ? void 0 : h.collapseIcon) ?? o.slots.collapseIcon ?? Do,
2729
- endIcon: (h == null ? void 0 : h.endIcon) ?? o.slots.endIcon,
2730
- icon: h == null ? void 0 : h.icon,
2731
- groupTransition: h == null ? void 0 : h.groupTransition
2732
- }, M = (S) => Array.isArray(S) ? S.length > 0 && S.some(M) : !!S, F = M(m), _ = E({}, a, {
2733
- expanded: V,
2734
- focused: A,
2735
- selected: z,
2736
- disabled: j,
2737
- indentationAtItemLevel: c
2738
- }), $ = Lo(_), Y = oe.groupTransition ?? void 0, xe = ce({
2739
- elementType: Y,
2740
- ownerState: {},
2741
- externalSlotProps: f == null ? void 0 : f.groupTransition,
2742
- additionalProps: E({
2743
- unmountOnExit: !0,
2744
- in: V,
2745
- component: "ul",
2746
- role: "group"
2747
- }, c ? {
2748
- indentationAtItemLevel: !0
2749
- } : {}),
2750
- className: $.groupTransition
2751
- }), Vt = (S) => {
2752
- p === "iconContainer" && N(S);
2753
- }, Oe = V ? oe.collapseIcon : oe.expandIcon, $t = ce({
2754
- elementType: Oe,
2755
- ownerState: {},
2756
- externalSlotProps: (S) => V ? E({}, ie(o.slotProps.collapseIcon, S), ie(f == null ? void 0 : f.collapseIcon, S)) : E({}, ie(o.slotProps.expandIcon, S), ie(f == null ? void 0 : f.expandIcon, S)),
2757
- additionalProps: {
2758
- onClick: Vt
2759
- }
2760
- }), At = Q($t, $o), Ft = F && Oe ? /* @__PURE__ */ w(Oe, E({}, At)) : null, Pe = F ? void 0 : oe.endIcon, Nt = ce({
2761
- elementType: Pe,
2762
- ownerState: {},
2763
- externalSlotProps: (S) => F ? {} : E({}, ie(o.slotProps.endIcon, S), ie(f == null ? void 0 : f.endIcon, S))
2764
- }), Lt = Q(Nt, Ao), jt = Pe ? /* @__PURE__ */ w(Pe, E({}, Lt)) : null, De = oe.icon, _t = ce({
2765
- elementType: De,
2766
- ownerState: {},
2767
- externalSlotProps: f == null ? void 0 : f.icon
2768
- }), Bt = Q(_t, Fo), zt = De ? /* @__PURE__ */ w(De, E({}, Bt)) : null;
2769
- let Ve;
2770
- i ? Ve = z : z && (Ve = !0);
2771
- function Ut(S) {
2772
- !A && (!j || d) && S.currentTarget === S.target && u.focusItem(S, y);
2773
- }
2774
- function Kt(S) {
2775
- var re, ae, He, Ye;
2776
- R == null || R(S), !(q || // we can exit the editing state by clicking outside the input (within the tree item) or by pressing Enter or Escape -> we don't want to remove the focused item from the state in these cases
2777
- // we can also exit the editing state by clicking on the root itself -> want to remove the focused item from the state in this case
2778
- S.relatedTarget && Fe(S.relatedTarget, ne.current) && (S.target && ((ae = (re = S.target) == null ? void 0 : re.dataset) == null ? void 0 : ae.element) === "labelInput" && Fe(S.target, ne.current) || ((Ye = (He = S.relatedTarget) == null ? void 0 : He.dataset) == null ? void 0 : Ye.element) === "labelInput")) && u.removeFocusedItem();
2779
- }
2780
- const qt = (S) => {
2781
- var re, ae;
2782
- B == null || B(S), ((ae = (re = S.target) == null ? void 0 : re.dataset) == null ? void 0 : ae.element) !== "labelInput" && u.handleItemKeyDown(S, y);
2783
- }, Xt = u.getTreeItemIdAttribute(y, C), Wt = u.canItemBeTabbed(y) ? 0 : -1, Ee = {
2784
- rootRefObject: ne,
2785
- contentRefObject: ye,
2786
- interactions: {
2787
- handleSaveItemLabel: L,
2788
- handleCancelItemLabelEditing: H
2789
- }
2790
- }, Jt = ((Xe = P.root) == null ? void 0 : Xe.call(P, E({}, Ee, {
2791
- externalEventHandlers: et(K)
2792
- }))) ?? {}, Gt = ((We = P.content) == null ? void 0 : We.call(P, E({}, Ee, {
2793
- externalEventHandlers: et(b)
2794
- }))) ?? {}, Ke = ((Je = P.dragAndDropOverlay) == null ? void 0 : Je.call(P, E({}, Ee, {
2795
- externalEventHandlers: {}
2796
- }))) ?? {}, qe = ((Ge = P.labelInput) == null ? void 0 : Ge.call(P, E({}, Ee, {
2797
- externalEventHandlers: {}
2798
- }))) ?? {};
2799
- return /* @__PURE__ */ w(Ot, {
2800
- itemId: y,
2801
- children: /* @__PURE__ */ ve(jo, E({
2802
- className: Ie($.root, I),
2803
- role: "treeitem",
2804
- "aria-expanded": F ? V : void 0,
2805
- "aria-selected": Ve,
2806
- "aria-disabled": j || void 0,
2807
- id: Xt,
2808
- tabIndex: Wt
2809
- }, K, {
2810
- ownerState: _,
2811
- onFocus: Ut,
2812
- onBlur: Kt,
2813
- onKeyDown: qt,
2814
- ref: Re,
2815
- style: c ? E({}, K.style, {
2816
- "--TreeView-itemDepth": typeof l == "function" ? l(y) : l
2817
- }) : K.style
2818
- }, Jt, {
2819
- children: [/* @__PURE__ */ w(_o, E({
2820
- as: g,
2821
- classes: {
2822
- root: $.content,
2823
- expanded: $.expanded,
2824
- selected: $.selected,
2825
- focused: $.focused,
2826
- disabled: $.disabled,
2827
- editable: $.editable,
2828
- editing: $.editing,
2829
- iconContainer: $.iconContainer,
2830
- label: $.label,
2831
- labelInput: $.labelInput,
2832
- checkbox: $.checkbox
2833
- },
2834
- label: k,
2835
- itemId: y,
2836
- onClick: T,
2837
- onMouseDown: v,
2838
- icon: zt,
2839
- expansionIcon: Ft,
2840
- displayIcon: jt,
2841
- ownerState: _
2842
- }, b, Gt, Ke.action == null ? {} : {
2843
- dragAndDropOverlayProps: Ke
2844
- }, qe.value == null ? {} : {
2845
- labelInputProps: qe
2846
- }, {
2847
- ref: ke
2848
- })), m && /* @__PURE__ */ w(Bo, E({
2849
- as: Y
2850
- }, xe, {
2851
- children: m
2852
- }))]
2853
- }))
2854
- });
2855
- });
2856
- process.env.NODE_ENV !== "production" && (Pt.propTypes = {
2857
- // ----------------------------- Warning --------------------------------
2858
- // | These PropTypes are generated from the TypeScript type definitions |
2859
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
2860
- // ----------------------------------------------------------------------
2861
- /**
2862
- * The content of the component.
2863
- */
2864
- children: r.node,
2865
- /**
2866
- * Override or extend the styles applied to the component.
2867
- */
2868
- classes: r.object,
2869
- className: r.string,
2870
- /**
2871
- * The component used to render the content of the item.
2872
- * @default TreeItemContent
2873
- */
2874
- ContentComponent: rt,
2875
- /**
2876
- * Props applied to ContentComponent.
2877
- */
2878
- ContentProps: r.object,
2879
- /**
2880
- * If `true`, the item is disabled.
2881
- * @default false
2882
- */
2883
- disabled: r.bool,
2884
- /**
2885
- * The id of the item.
2886
- */
2887
- itemId: r.string.isRequired,
2888
- /**
2889
- * The tree item label.
2890
- */
2891
- label: r.node,
2892
- /**
2893
- * This prop isn't supported.
2894
- * Use the `onItemFocus` callback on the tree if you need to monitor a item's focus.
2895
- */
2896
- onFocus: mn,
2897
- /**
2898
- * Callback fired when a key of the keyboard is pressed on the item.
2899
- */
2900
- onKeyDown: r.func,
2901
- /**
2902
- * The props used for each component slot.
2903
- * @default {}
2904
- */
2905
- slotProps: r.object,
2906
- /**
2907
- * Overridable component slots.
2908
- * @default {}
2909
- */
2910
- slots: r.object,
2911
- /**
2912
- * The system prop that allows defining system overrides as well as additional CSS styles.
2913
- */
2914
- sx: r.oneOfType([r.arrayOf(r.oneOfType([r.func, r.object, r.bool])), r.func, r.object])
2915
- });
2916
- const Xo = ({
2917
- items: e,
2918
- handleCheck: t,
2919
- width: n = "250px",
2920
- height: o = "350px",
2921
- expanded: s
2922
- }) => /* @__PURE__ */ w(In, { width: n, height: o, children: /* @__PURE__ */ w(Rt, { expandedItems: s, children: Dt(e, t) }) }), Dt = (e, t) => e.map((n) => /* @__PURE__ */ Ht(zo, { ...n, key: n.id, handleCheck: t })), zo = ({
2923
- id: e,
2924
- checked: t,
2925
- children: n,
2926
- label: o,
2927
- handleCheck: s
2928
- }) => /* @__PURE__ */ w(
2929
- Pt,
2930
- {
2931
- itemId: e,
2932
- label: /* @__PURE__ */ ve(gn, { flexDirection: "row", alignItems: "center", children: [
2933
- /* @__PURE__ */ w(hn, { children: o }),
2934
- s && /* @__PURE__ */ w(
2935
- bn,
2936
- {
2937
- disableRipple: !0,
2938
- sx: { marginLeft: "auto" },
2939
- onClick: (d) => {
2940
- d.stopPropagation(), s(e, !t);
2941
- },
2942
- "data-testid": `toggle-visibility-${e}`,
2943
- children: t ? /* @__PURE__ */ w(qn, { "data-testid": `visibility-icon-${e}` }) : /* @__PURE__ */ w(Xn, { "data-testid": `visibility-off-icon-${e}` })
2944
- }
2945
- )
2946
- ] }),
2947
- children: n.length > 0 && Dt(n, s)
2948
- }
2949
- );
2950
- export {
2951
- Le as C,
2952
- ct as F,
2953
- Xo as T,
2954
- X as a,
2955
- Cn as b,
2956
- ut as c,
2957
- kn as u
2958
- };