@smart-factor/gem-ui-components 0.0.53 → 0.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/{Drawer-Bn6zM0s6.js → Drawer-D8kHnT0B.js} +828 -935
  2. package/dist/{Stack-dIR9-9Sw.js → Stack-Dr1yNuib.js} +2620 -2489
  3. package/dist/Tree-B4Bd33fe.js +2958 -0
  4. package/dist/components/AccordionSummary/AccordionSummary.styles.d.ts +1 -0
  5. package/dist/components/Button/Button.styles.d.ts +1 -0
  6. package/dist/components/Dialog/Dialog.styles.d.ts +1 -0
  7. package/dist/components/Drawer/index.js +1 -1
  8. package/dist/components/Dropzone/Dropzone.styles.d.ts +1 -0
  9. package/dist/components/FixedActionsBottomPanel/FixedActionsBottomPanel.styles.d.ts +1 -0
  10. package/dist/components/FormComponents/Autocomplete/types.d.ts +1 -0
  11. package/dist/components/FormComponents/ContextualSearch/ContextualSearch.styles.d.ts +1 -0
  12. package/dist/components/FormComponents/ContextualSearch/mock.d.ts +1 -0
  13. package/dist/components/FormComponents/DatePicker/DatePicker.styles.d.ts +1 -0
  14. package/dist/components/FormComponents/DateTimePicker/DateTimePicker.styles.d.ts +1 -0
  15. package/dist/components/FormComponents/RadioChips/RadioChips.styles.d.ts +1 -0
  16. package/dist/components/FormComponents/Select/Select.styles.d.ts +1 -0
  17. package/dist/components/ResizableWrapper/ResizableWrapper.styles.d.ts +1 -0
  18. package/dist/components/SimpleAutocomplete/SimpleAutocomplete.d.ts +1 -1
  19. package/dist/components/Stepper/Stepper.d.ts +1 -0
  20. package/dist/components/Stepper/Stepper.styles.d.ts +1 -0
  21. package/dist/components/StickyContainer/StickyContainer.styles.d.ts +1 -0
  22. package/dist/components/TableComponents/ContextMenu/ContextMenuContext.d.ts +1 -0
  23. package/dist/components/TableComponents/ContextMenu/ContextMenuPropsContext/ContextMenuPropsContext.d.ts +1 -0
  24. package/dist/components/Toast/Toast.styles.d.ts +1 -0
  25. package/dist/components/Tree/index.js +1 -1
  26. package/dist/consts/data-grid.d.ts +1 -0
  27. package/dist/hooks/useGetFileUrl.d.ts +1 -0
  28. package/dist/licenses.txt +1460 -0
  29. package/dist/main.js +8444 -8922
  30. package/package.json +2 -1
  31. package/dist/Tree-DPMcYDgW.js +0 -3200
@@ -1,3200 +0,0 @@
1
- import { jsx as T, jsxs as we } from "react/jsx-runtime";
2
- import * as E from "react";
3
- import { createElement as on } from "react";
4
- import { D as rn, E as tt, F as sn, G as ln, H as an, k as Ne, l as Ae, m as B, _ as x, o as at, J as cn, T as un, b as X, p as dn, K as pn, u as fn, a as te, P as r, L as mn, q as Fe, t as nt, M as In, x as ct, g as gn, N as ut, d as de, e as ne, n as hn, y as bn, O as yn, Q as dt, B as En, S as xn, A as Cn, I as wn } from "./Stack-dIR9-9Sw.js";
5
- function Tn(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}].`), rn(e, t, n);
7
- }
8
- function vn(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, i) => i < 3 ? parseInt(o, 16) : Math.round(parseInt(o, 16) / 255 * 1e3) / 1e3).join(", ")})` : "";
13
- }
14
- function pt(e) {
15
- if (e.type)
16
- return e;
17
- if (e.charAt(0) === "#")
18
- return pt(vn(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().` : tt(9, e));
23
- let o = e.substring(t + 1, e.length - 1), i;
24
- if (n === "color") {
25
- if (o = o.split(" "), i = 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(i) === -1)
26
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${i}\` color space.
27
- The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.` : tt(10, i));
28
- } else
29
- o = o.split(",");
30
- return o = o.map((p) => parseFloat(p)), {
31
- type: n,
32
- values: o,
33
- colorSpace: i
34
- };
35
- }
36
- function Rn(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((i, p) => p < 3 ? parseInt(i, 10) : i) : 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 ce(e, t) {
47
- return e = pt(e), t = Tn(t), (e.type === "rgb" || e.type === "hsl") && (e.type += "a"), e.type === "color" ? e.values[3] = `/${t}` : e.values[3] = t, Rn(e);
48
- }
49
- function Mn({
50
- props: e,
51
- name: t
52
- }) {
53
- return sn({
54
- props: e,
55
- name: t,
56
- defaultTheme: ln,
57
- themeId: an
58
- });
59
- }
60
- function Sn(e) {
61
- return Ne("MuiCollapse", e);
62
- }
63
- Ae("MuiCollapse", ["root", "horizontal", "vertical", "entered", "hidden", "wrapper", "wrapperInner"]);
64
- const kn = ["addEndListener", "children", "className", "collapsedSize", "component", "easing", "in", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "orientation", "style", "timeout", "TransitionComponent"], On = (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 Fe(o, Sn, n);
76
- }, Pn = B("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
- }) => x({
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" && x({
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
- })), Dn = B("div", {
104
- name: "MuiCollapse",
105
- slot: "Wrapper",
106
- overridesResolver: (e, t) => t.wrapper
107
- })(({
108
- ownerState: e
109
- }) => x({
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
- })), Vn = B("div", {
117
- name: "MuiCollapse",
118
- slot: "WrapperInner",
119
- overridesResolver: (e, t) => t.wrapperInner
120
- })(({
121
- ownerState: e
122
- }) => x({
123
- width: "100%"
124
- }, e.orientation === "horizontal" && {
125
- width: "auto",
126
- height: "100%"
127
- })), Le = /* @__PURE__ */ E.forwardRef(function(t, n) {
128
- const o = at({
129
- props: t,
130
- name: "MuiCollapse"
131
- }), {
132
- addEndListener: i,
133
- children: p,
134
- className: c,
135
- collapsedSize: s = "0px",
136
- component: d,
137
- easing: u,
138
- in: l,
139
- onEnter: a,
140
- onEntered: f,
141
- onEntering: g,
142
- onExit: b,
143
- onExited: m,
144
- onExiting: I,
145
- orientation: h = "vertical",
146
- style: y,
147
- timeout: C = cn.standard,
148
- // eslint-disable-next-line react/prop-types
149
- TransitionComponent: k = un
150
- } = o, w = X(o, kn), R = x({}, o, {
151
- orientation: h,
152
- collapsedSize: s
153
- }), S = On(R), z = dn(), K = pn(), D = E.useRef(null), P = E.useRef(), U = typeof s == "number" ? `${s}px` : s, _ = h === "horizontal", A = _ ? "width" : "height", $ = E.useRef(null), Q = fn(n, $), F = (v) => (N) => {
154
- if (v) {
155
- const j = $.current;
156
- N === void 0 ? v(j) : v(j, N);
157
- }
158
- }, q = () => D.current ? D.current[_ ? "clientWidth" : "clientHeight"] : 0, O = F((v, N) => {
159
- D.current && _ && (D.current.style.position = "absolute"), v.style[A] = U, a && a(v, N);
160
- }), W = F((v, N) => {
161
- const j = q();
162
- D.current && _ && (D.current.style.position = "");
163
- const {
164
- duration: J,
165
- easing: V
166
- } = nt({
167
- style: y,
168
- timeout: C,
169
- easing: u
170
- }, {
171
- mode: "enter"
172
- });
173
- if (C === "auto") {
174
- const le = z.transitions.getAutoHeightDuration(j);
175
- v.style.transitionDuration = `${le}ms`, P.current = le;
176
- } else
177
- v.style.transitionDuration = typeof J == "string" ? J : `${J}ms`;
178
- v.style[A] = `${j}px`, v.style.transitionTimingFunction = V, g && g(v, N);
179
- }), L = F((v, N) => {
180
- v.style[A] = "auto", f && f(v, N);
181
- }), oe = F((v) => {
182
- v.style[A] = `${q()}px`, b && b(v);
183
- }), ge = F(m), Me = F((v) => {
184
- const N = q(), {
185
- duration: j,
186
- easing: J
187
- } = nt({
188
- style: y,
189
- timeout: C,
190
- easing: u
191
- }, {
192
- mode: "exit"
193
- });
194
- if (C === "auto") {
195
- const V = z.transitions.getAutoHeightDuration(N);
196
- v.style.transitionDuration = `${V}ms`, P.current = V;
197
- } else
198
- v.style.transitionDuration = typeof j == "string" ? j : `${j}ms`;
199
- v.style[A] = U, v.style.transitionTimingFunction = J, I && I(v);
200
- });
201
- return /* @__PURE__ */ T(k, x({
202
- in: l,
203
- onEnter: O,
204
- onEntered: L,
205
- onEntering: W,
206
- onExit: oe,
207
- onExited: ge,
208
- onExiting: Me,
209
- addEndListener: (v) => {
210
- C === "auto" && K.start(P.current || 0, v), i && i($.current, v);
211
- },
212
- nodeRef: $,
213
- timeout: C === "auto" ? null : C
214
- }, w, {
215
- children: (v, N) => /* @__PURE__ */ T(Pn, x({
216
- as: d,
217
- className: te(S.root, c, {
218
- entered: S.entered,
219
- exited: !l && U === "0px" && S.hidden
220
- }[v]),
221
- style: x({
222
- [_ ? "minWidth" : "minHeight"]: U
223
- }, y),
224
- ref: Q
225
- }, N, {
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: x({}, R, {
229
- state: v
230
- }),
231
- children: /* @__PURE__ */ T(Dn, {
232
- ownerState: x({}, R, {
233
- state: v
234
- }),
235
- className: S.wrapper,
236
- ref: D,
237
- children: /* @__PURE__ */ T(Vn, {
238
- ownerState: x({}, R, {
239
- state: v
240
- }),
241
- className: S.wrapperInner,
242
- children: p
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: mn,
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 ft = /* @__PURE__ */ E.createContext(void 0);
345
- process.env.NODE_ENV !== "production" && (ft.displayName = "FormControlContext");
346
- function $n() {
347
- return E.useContext(ft);
348
- }
349
- function Nn(e) {
350
- return Ne("PrivateSwitchBase", e);
351
- }
352
- Ae("PrivateSwitchBase", ["root", "checked", "disabled", "input", "edgeStart", "edgeEnd"]);
353
- const An = ["autoFocus", "checked", "checkedIcon", "className", "defaultChecked", "disabled", "disableFocusRipple", "edge", "icon", "id", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "readOnly", "required", "tabIndex", "type", "value"], Fn = (e) => {
354
- const {
355
- classes: t,
356
- checked: n,
357
- disabled: o,
358
- edge: i
359
- } = e, p = {
360
- root: ["root", n && "checked", o && "disabled", i && `edge${de(i)}`],
361
- input: ["input"]
362
- };
363
- return Fe(p, Nn, t);
364
- }, Ln = B(In)(({
365
- ownerState: e
366
- }) => x({
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
- })), jn = B("input", {
374
- shouldForwardProp: ct
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
- }), mt = /* @__PURE__ */ E.forwardRef(function(t, n) {
387
- const {
388
- autoFocus: o,
389
- checked: i,
390
- checkedIcon: p,
391
- className: c,
392
- defaultChecked: s,
393
- disabled: d,
394
- disableFocusRipple: u = !1,
395
- edge: l = !1,
396
- icon: a,
397
- id: f,
398
- inputProps: g,
399
- inputRef: b,
400
- name: m,
401
- onBlur: I,
402
- onChange: h,
403
- onFocus: y,
404
- readOnly: C,
405
- required: k = !1,
406
- tabIndex: w,
407
- type: R,
408
- value: S
409
- } = t, z = X(t, An), [K, D] = gn({
410
- controlled: i,
411
- default: !!s,
412
- name: "SwitchBase",
413
- state: "checked"
414
- }), P = $n(), U = (O) => {
415
- y && y(O), P && P.onFocus && P.onFocus(O);
416
- }, _ = (O) => {
417
- I && I(O), P && P.onBlur && P.onBlur(O);
418
- }, A = (O) => {
419
- if (O.nativeEvent.defaultPrevented)
420
- return;
421
- const W = O.target.checked;
422
- D(W), h && h(O, W);
423
- };
424
- let $ = d;
425
- P && typeof $ > "u" && ($ = P.disabled);
426
- const Q = R === "checkbox" || R === "radio", F = x({}, t, {
427
- checked: K,
428
- disabled: $,
429
- disableFocusRipple: u,
430
- edge: l
431
- }), q = Fn(F);
432
- return /* @__PURE__ */ we(Ln, x({
433
- component: "span",
434
- className: te(q.root, c),
435
- centerRipple: !0,
436
- focusRipple: !u,
437
- disabled: $,
438
- tabIndex: null,
439
- role: void 0,
440
- onFocus: U,
441
- onBlur: _,
442
- ownerState: F,
443
- ref: n
444
- }, z, {
445
- children: [/* @__PURE__ */ T(jn, x({
446
- autoFocus: o,
447
- checked: i,
448
- defaultChecked: s,
449
- className: q.input,
450
- disabled: $,
451
- id: Q ? f : void 0,
452
- name: m,
453
- onChange: A,
454
- readOnly: C,
455
- ref: b,
456
- required: k,
457
- ownerState: F,
458
- tabIndex: w,
459
- type: R
460
- }, R === "checkbox" && S === void 0 ? {} : {
461
- value: S
462
- }, g)), K ? p : a]
463
- }));
464
- });
465
- process.env.NODE_ENV !== "production" && (mt.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: ut,
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 zn = ne(/* @__PURE__ */ T("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"), _n = ne(/* @__PURE__ */ T("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"), Bn = ne(/* @__PURE__ */ T("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 Un(e) {
576
- return Ne("MuiCheckbox", e);
577
- }
578
- const Pe = Ae("MuiCheckbox", ["root", "checked", "disabled", "indeterminate", "colorPrimary", "colorSecondary", "sizeSmall", "sizeMedium"]), Kn = ["checkedIcon", "color", "icon", "indeterminate", "indeterminateIcon", "inputProps", "size", "className"], qn = (e) => {
579
- const {
580
- classes: t,
581
- indeterminate: n,
582
- color: o,
583
- size: i
584
- } = e, p = {
585
- root: ["root", n && "indeterminate", `color${de(o)}`, `size${de(i)}`]
586
- }, c = Fe(p, Un, t);
587
- return x({}, t, c);
588
- }, Xn = B(mt, {
589
- shouldForwardProp: (e) => ct(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${de(n.size)}`], n.color !== "default" && t[`color${de(n.color)}`]];
597
- }
598
- })(({
599
- theme: e,
600
- ownerState: t
601
- }) => x({
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})` : hn(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
- [`&.${Pe.checked}, &.${Pe.indeterminate}`]: {
613
- color: (e.vars || e).palette[t.color].main
614
- },
615
- [`&.${Pe.disabled}`]: {
616
- color: (e.vars || e).palette.action.disabled
617
- }
618
- })), Wn = /* @__PURE__ */ T(_n, {}), Jn = /* @__PURE__ */ T(zn, {}), Hn = /* @__PURE__ */ T(Bn, {}), It = /* @__PURE__ */ E.forwardRef(function(t, n) {
619
- var o, i;
620
- const p = at({
621
- props: t,
622
- name: "MuiCheckbox"
623
- }), {
624
- checkedIcon: c = Wn,
625
- color: s = "primary",
626
- icon: d = Jn,
627
- indeterminate: u = !1,
628
- indeterminateIcon: l = Hn,
629
- inputProps: a,
630
- size: f = "medium",
631
- className: g
632
- } = p, b = X(p, Kn), m = u ? l : d, I = u ? l : c, h = x({}, p, {
633
- color: s,
634
- indeterminate: u,
635
- size: f
636
- }), y = qn(h);
637
- return /* @__PURE__ */ T(Xn, x({
638
- type: "checkbox",
639
- inputProps: x({
640
- "data-indeterminate": u
641
- }, a),
642
- icon: /* @__PURE__ */ E.cloneElement(m, {
643
- fontSize: (o = m.props.fontSize) != null ? o : f
644
- }),
645
- checkedIcon: /* @__PURE__ */ E.cloneElement(I, {
646
- fontSize: (i = I.props.fontSize) != null ? i : f
647
- }),
648
- ownerState: h,
649
- ref: n,
650
- className: te(y.root, g)
651
- }, b, {
652
- classes: y
653
- }));
654
- });
655
- process.env.NODE_ENV !== "production" && (It.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: ut,
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 Gn = ne(/* @__PURE__ */ T("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"), Yn = ne(/* @__PURE__ */ T("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 gt(e, t, n = void 0) {
762
- const o = {};
763
- for (const i in e) {
764
- const p = e[i];
765
- let c = "", s = !0;
766
- for (let d = 0; d < p.length; d += 1) {
767
- const u = p[d];
768
- u && (c += (s === !0 ? "" : " ") + t(u), s = !1, n && n[u] && (c += " " + n[u]));
769
- }
770
- o[i] = c;
771
- }
772
- return o;
773
- }
774
- function ht(e) {
775
- return Mn;
776
- }
777
- const ot = (e) => e, Qn = () => {
778
- let e = ot;
779
- return {
780
- configure(t) {
781
- e = t;
782
- },
783
- generate(t) {
784
- return e(t);
785
- },
786
- reset() {
787
- e = ot;
788
- }
789
- };
790
- }, Zn = Qn(), eo = {
791
- active: "active",
792
- checked: "checked",
793
- completed: "completed",
794
- disabled: "disabled",
795
- error: "error",
796
- expanded: "expanded",
797
- focused: "focused",
798
- focusVisible: "focusVisible",
799
- open: "open",
800
- readOnly: "readOnly",
801
- required: "required",
802
- selected: "selected"
803
- };
804
- function je(e, t, n = "Mui") {
805
- const o = eo[t];
806
- return o ? `${n}-${o}` : `${Zn.generate(e)}-${t}`;
807
- }
808
- function bt(e, t, n = "Mui") {
809
- const o = {};
810
- return t.forEach((i) => {
811
- o[i] = je(e, i, n);
812
- }), o;
813
- }
814
- function to(e, t) {
815
- typeof e == "function" ? e(t) : e && (e.current = t);
816
- }
817
- function pe(...e) {
818
- return E.useMemo(() => e.every((t) => t == null) ? null : (t) => {
819
- e.forEach((n) => {
820
- to(n, t);
821
- });
822
- }, e);
823
- }
824
- function no(e) {
825
- return typeof e == "string";
826
- }
827
- function oo(e, t, n) {
828
- return e === void 0 || no(e) ? t : {
829
- ...t,
830
- ownerState: {
831
- ...t.ownerState,
832
- ...n
833
- }
834
- };
835
- }
836
- function Ve(e, t = []) {
837
- if (e === void 0)
838
- return {};
839
- const n = {};
840
- return Object.keys(e).filter((o) => o.match(/^on[A-Z]/) && typeof e[o] == "function" && !t.includes(o)).forEach((o) => {
841
- n[o] = e[o];
842
- }), n;
843
- }
844
- function rt(e) {
845
- if (e === void 0)
846
- return {};
847
- const t = {};
848
- return Object.keys(e).filter((n) => !(n.match(/^on[A-Z]/) && typeof e[n] == "function")).forEach((n) => {
849
- t[n] = e[n];
850
- }), t;
851
- }
852
- function ro(e) {
853
- const {
854
- getSlotProps: t,
855
- additionalProps: n,
856
- externalSlotProps: o,
857
- externalForwardedProps: i,
858
- className: p
859
- } = e;
860
- if (!t) {
861
- const g = te(n == null ? void 0 : n.className, p, i == null ? void 0 : i.className, o == null ? void 0 : o.className), b = {
862
- ...n == null ? void 0 : n.style,
863
- ...i == null ? void 0 : i.style,
864
- ...o == null ? void 0 : o.style
865
- }, m = {
866
- ...n,
867
- ...i,
868
- ...o
869
- };
870
- return g.length > 0 && (m.className = g), Object.keys(b).length > 0 && (m.style = b), {
871
- props: m,
872
- internalRef: void 0
873
- };
874
- }
875
- const c = Ve({
876
- ...i,
877
- ...o
878
- }), s = rt(o), d = rt(i), u = t(c), l = te(u == null ? void 0 : u.className, n == null ? void 0 : n.className, p, i == null ? void 0 : i.className, o == null ? void 0 : o.className), a = {
879
- ...u == null ? void 0 : u.style,
880
- ...n == null ? void 0 : n.style,
881
- ...i == null ? void 0 : i.style,
882
- ...o == null ? void 0 : o.style
883
- }, f = {
884
- ...u,
885
- ...n,
886
- ...d,
887
- ...s
888
- };
889
- return l.length > 0 && (f.className = l), Object.keys(a).length > 0 && (f.style = a), {
890
- props: f,
891
- internalRef: u.ref
892
- };
893
- }
894
- function Z(e, t, n) {
895
- return typeof e == "function" ? e(t, n) : e;
896
- }
897
- function ue(e) {
898
- var a;
899
- const {
900
- elementType: t,
901
- externalSlotProps: n,
902
- ownerState: o,
903
- skipResolvingSlotProps: i = !1,
904
- ...p
905
- } = e, c = i ? {} : Z(n, o), {
906
- props: s,
907
- internalRef: d
908
- } = ro({
909
- ...p,
910
- externalSlotProps: c
911
- }), u = pe(d, c == null ? void 0 : c.ref, (a = e.additionalProps) == null ? void 0 : a.ref);
912
- return oo(t, {
913
- ...s,
914
- ref: u
915
- }, o);
916
- }
917
- const it = /* @__PURE__ */ new Set();
918
- function Ce(e, t = "warning") {
919
- if (process.env.NODE_ENV === "production")
920
- return;
921
- const n = Array.isArray(e) ? e.join(`
922
- `) : e;
923
- it.has(n) || (it.add(n), t === "error" ? console.error(n) : console.warn(n));
924
- }
925
- function io(e) {
926
- return je("MuiSimpleTreeView", e);
927
- }
928
- bt("MuiSimpleTreeView", ["root"]);
929
- const so = (e, t) => {
930
- const n = E.useRef({}), [o, i] = E.useState(() => {
931
- const c = {};
932
- return e.forEach((s) => {
933
- s.models && Object.entries(s.models).forEach(([d, u]) => {
934
- n.current[d] = {
935
- isControlled: t[d] !== void 0,
936
- getDefaultValue: u.getDefaultValue
937
- }, c[d] = u.getDefaultValue(t);
938
- });
939
- }), c;
940
- }), p = Object.fromEntries(Object.entries(n.current).map(([c, s]) => {
941
- const d = t[c] ?? o[c];
942
- return [c, {
943
- value: d,
944
- setControlledValue: (u) => {
945
- s.isControlled || i((l) => x({}, l, {
946
- [c]: u
947
- }));
948
- }
949
- }];
950
- }));
951
- return process.env.NODE_ENV !== "production" && Object.entries(n.current).forEach(([c, s]) => {
952
- const d = t[c], u = s.getDefaultValue(t);
953
- E.useEffect(() => {
954
- s.isControlled !== (d !== void 0) && console.error([`MUI X: A component is changing the ${s.isControlled ? "" : "un"}controlled ${c} state of TreeView to be ${s.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(`
955
- `));
956
- }, [d]);
957
- const {
958
- current: l
959
- } = E.useRef(u);
960
- E.useEffect(() => {
961
- !s.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(`
962
- `));
963
- }, [JSON.stringify(u)]);
964
- }), p;
965
- };
966
- class lo {
967
- constructor() {
968
- this.maxListeners = 20, this.warnOnce = !1, this.events = {};
969
- }
970
- on(t, n, o = {}) {
971
- let i = this.events[t];
972
- if (i || (i = {
973
- highPriority: /* @__PURE__ */ new Map(),
974
- regular: /* @__PURE__ */ new Map()
975
- }, this.events[t] = i), o.isFirst ? i.highPriority.set(n, !0) : i.regular.set(n, !0), process.env.NODE_ENV !== "production") {
976
- const p = i.highPriority.size + i.regular.size;
977
- p > this.maxListeners && !this.warnOnce && (this.warnOnce = !0, console.warn([`Possible EventEmitter memory leak detected. ${p} ${t} listeners added.`].join(`
978
- `)));
979
- }
980
- }
981
- removeListener(t, n) {
982
- this.events[t] && (this.events[t].regular.delete(n), this.events[t].highPriority.delete(n));
983
- }
984
- removeAllListeners() {
985
- this.events = {};
986
- }
987
- emit(t, ...n) {
988
- const o = this.events[t];
989
- if (!o)
990
- return;
991
- const i = Array.from(o.highPriority.keys()), p = Array.from(o.regular.keys());
992
- for (let c = i.length - 1; c >= 0; c -= 1) {
993
- const s = i[c];
994
- o.highPriority.has(s) && s.apply(this, n);
995
- }
996
- for (let c = 0; c < p.length; c += 1) {
997
- const s = p[c];
998
- o.regular.has(s) && s.apply(this, n);
999
- }
1000
- }
1001
- once(t, n) {
1002
- const o = this;
1003
- this.on(t, function i(...p) {
1004
- o.removeListener(t, i), n.apply(o, p);
1005
- });
1006
- }
1007
- }
1008
- const ao = (e) => e.isPropagationStopped !== void 0, yt = () => {
1009
- const [e] = E.useState(() => new lo()), t = E.useCallback((...o) => {
1010
- const [i, p, c = {}] = o;
1011
- c.defaultMuiPrevented = !1, !(ao(c) && c.isPropagationStopped()) && e.emit(i, p, c);
1012
- }, [e]), n = E.useCallback((o, i) => (e.on(o, i), () => {
1013
- e.removeListener(o, i);
1014
- }), [e]);
1015
- return {
1016
- instance: {
1017
- $$publishEvent: t,
1018
- $$subscribeEvent: n
1019
- }
1020
- };
1021
- };
1022
- yt.params = {};
1023
- const Et = ({
1024
- plugins: e
1025
- }) => {
1026
- const t = new Set(e);
1027
- return {
1028
- instance: {
1029
- getAvailablePlugins: () => t
1030
- }
1031
- };
1032
- };
1033
- Et.params = {};
1034
- let st = 0;
1035
- const co = () => (st += 1, `mui-tree-view-${st}`), Te = ({
1036
- id: e,
1037
- treeId: t = "",
1038
- itemId: n
1039
- }) => e ?? `${t}-${n}`, ze = ({
1040
- params: e,
1041
- state: t,
1042
- setState: n
1043
- }) => {
1044
- E.useEffect(() => {
1045
- n((i) => i.id.treeId === e.id && i.id.treeId !== void 0 ? i : x({}, i, {
1046
- id: x({}, i.id, {
1047
- treeId: e.id ?? co()
1048
- })
1049
- }));
1050
- }, [n, e.id]);
1051
- const o = e.id ?? t.id.treeId;
1052
- return {
1053
- getRootProps: () => ({
1054
- id: o
1055
- }),
1056
- contextValue: {
1057
- treeId: o
1058
- }
1059
- };
1060
- };
1061
- ze.params = {
1062
- id: !0
1063
- };
1064
- ze.getInitialState = ({
1065
- id: e
1066
- }) => ({
1067
- id: {
1068
- treeId: e ?? void 0
1069
- }
1070
- });
1071
- const uo = [yt, Et, ze], po = ["slots", "slotProps", "apiRef", "experimentalFeatures"], fo = (e) => {
1072
- let {
1073
- props: {
1074
- slots: t,
1075
- slotProps: n,
1076
- apiRef: o,
1077
- experimentalFeatures: i
1078
- },
1079
- plugins: p
1080
- } = e, c = X(e.props, po);
1081
- const s = {};
1082
- p.forEach((f) => {
1083
- Object.assign(s, f.params);
1084
- });
1085
- const d = {}, u = {};
1086
- Object.keys(c).forEach((f) => {
1087
- const g = c[f];
1088
- s[f] ? d[f] = g : u[f] = g;
1089
- });
1090
- const l = i ?? {}, a = p.reduce((f, g) => g.getDefaultizedParams ? g.getDefaultizedParams({
1091
- params: f,
1092
- experimentalFeatures: l
1093
- }) : f, d);
1094
- return {
1095
- apiRef: o,
1096
- forwardedProps: u,
1097
- pluginParams: a,
1098
- slots: t ?? {},
1099
- slotProps: n ?? {},
1100
- experimentalFeatures: l
1101
- };
1102
- }, mo = ({
1103
- plugins: e,
1104
- instance: t,
1105
- publicAPI: n,
1106
- rootRef: o
1107
- }) => ({
1108
- runItemPlugins: (s) => {
1109
- let d = null, u = null;
1110
- const l = [], a = {};
1111
- e.forEach((b) => {
1112
- if (!b.itemPlugin)
1113
- return;
1114
- const m = b.itemPlugin({
1115
- props: s,
1116
- rootRef: d,
1117
- contentRef: u
1118
- });
1119
- m != null && m.rootRef && (d = m.rootRef), m != null && m.contentRef && (u = m.contentRef), m != null && m.propsEnhancers && (l.push(m.propsEnhancers), Object.keys(m.propsEnhancers).forEach((I) => {
1120
- a[I] = !0;
1121
- }));
1122
- });
1123
- const f = (b) => (m) => {
1124
- const I = {};
1125
- return l.forEach((h) => {
1126
- const y = h[b];
1127
- y != null && Object.assign(I, y(m));
1128
- }), I;
1129
- }, g = Object.fromEntries(Object.keys(a).map((b) => [b, f(b)]));
1130
- return {
1131
- contentRef: u,
1132
- rootRef: d,
1133
- propsEnhancers: g
1134
- };
1135
- },
1136
- wrapItem: ({
1137
- itemId: s,
1138
- children: d
1139
- }) => {
1140
- let u = d;
1141
- for (let l = e.length - 1; l >= 0; l -= 1) {
1142
- const a = e[l];
1143
- a.wrapItem && (u = a.wrapItem({
1144
- itemId: s,
1145
- children: u,
1146
- instance: t
1147
- }));
1148
- }
1149
- return u;
1150
- },
1151
- wrapRoot: ({
1152
- children: s
1153
- }) => {
1154
- let d = s;
1155
- for (let u = e.length - 1; u >= 0; u -= 1) {
1156
- const l = e[u];
1157
- l.wrapRoot && (d = l.wrapRoot({
1158
- children: d,
1159
- instance: t
1160
- }));
1161
- }
1162
- return d;
1163
- },
1164
- instance: t,
1165
- rootRef: o,
1166
- publicAPI: n
1167
- });
1168
- function Io(e) {
1169
- const t = E.useRef({});
1170
- return e ? (e.current == null && (e.current = {}), e.current) : t.current;
1171
- }
1172
- const go = ({
1173
- plugins: e,
1174
- rootRef: t,
1175
- props: n
1176
- }) => {
1177
- const o = [...uo, ...e], {
1178
- pluginParams: i,
1179
- forwardedProps: p,
1180
- apiRef: c,
1181
- experimentalFeatures: s,
1182
- slots: d,
1183
- slotProps: u
1184
- } = fo({
1185
- plugins: o,
1186
- props: n
1187
- }), l = so(o, i), f = E.useRef({}).current, g = Io(c), b = E.useRef(null), m = pe(b, t), I = mo({
1188
- plugins: o,
1189
- instance: f,
1190
- publicAPI: g,
1191
- rootRef: b
1192
- }), [h, y] = E.useState(() => {
1193
- const R = {};
1194
- return o.forEach((S) => {
1195
- S.getInitialState && Object.assign(R, S.getInitialState(i));
1196
- }), R;
1197
- }), C = [], k = (R) => {
1198
- const S = R({
1199
- instance: f,
1200
- params: i,
1201
- slots: d,
1202
- slotProps: u,
1203
- experimentalFeatures: s,
1204
- state: h,
1205
- setState: y,
1206
- rootRef: b,
1207
- models: l,
1208
- plugins: o
1209
- });
1210
- S.getRootProps && C.push(S.getRootProps), S.publicAPI && Object.assign(g, S.publicAPI), S.instance && Object.assign(f, S.instance), S.contextValue && Object.assign(I, S.contextValue);
1211
- };
1212
- return o.forEach(k), {
1213
- getRootProps: (R = {}) => {
1214
- const S = x({
1215
- role: "tree"
1216
- }, p, R, {
1217
- ref: m
1218
- });
1219
- return C.forEach((z) => {
1220
- Object.assign(S, z(R));
1221
- }), S;
1222
- },
1223
- rootRef: m,
1224
- contextValue: I,
1225
- instance: f
1226
- };
1227
- }, _e = /* @__PURE__ */ E.createContext(null);
1228
- process.env.NODE_ENV !== "production" && (_e.displayName = "TreeViewContext");
1229
- function ho(e) {
1230
- const {
1231
- value: t,
1232
- children: n
1233
- } = e;
1234
- return /* @__PURE__ */ T(_e.Provider, {
1235
- value: t,
1236
- children: t.wrapRoot({
1237
- children: n,
1238
- instance: t.instance
1239
- })
1240
- });
1241
- }
1242
- const se = () => {
1243
- const e = E.useContext(_e);
1244
- if (e == null)
1245
- 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(`
1246
- `));
1247
- return e;
1248
- }, xt = (e, t, n) => {
1249
- e.$$publishEvent(t, n);
1250
- }, ee = "__TREE_VIEW_ROOT_PARENT_ID__", Ct = (e) => {
1251
- const t = {};
1252
- return e.forEach((n, o) => {
1253
- t[n] = o;
1254
- }), t;
1255
- }, ie = /* @__PURE__ */ E.createContext(() => -1);
1256
- process.env.NODE_ENV !== "production" && (ie.displayName = "TreeViewItemDepthContext");
1257
- const bo = ["children"], wt = ({
1258
- items: e,
1259
- isItemDisabled: t,
1260
- getItemLabel: n,
1261
- getItemId: o
1262
- }) => {
1263
- const i = {}, p = {}, c = {
1264
- [ee]: []
1265
- }, s = (u, l, a) => {
1266
- var m, I;
1267
- const f = o ? o(u) : u.id;
1268
- if (f == null)
1269
- 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(`
1270
- `));
1271
- if (i[f] != null)
1272
- 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: "${f}"`].join(`
1273
- `));
1274
- const g = n ? n(u) : u.label;
1275
- if (g == null)
1276
- 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(`
1277
- `));
1278
- i[f] = {
1279
- id: f,
1280
- label: g,
1281
- parentId: a,
1282
- idAttribute: void 0,
1283
- expandable: !!((m = u.children) != null && m.length),
1284
- disabled: t ? t(u) : !1,
1285
- depth: l
1286
- }, p[f] = u;
1287
- const b = a ?? ee;
1288
- c[b] || (c[b] = []), c[b].push(f), (I = u.children) == null || I.forEach((h) => s(h, l + 1, f));
1289
- };
1290
- e.forEach((u) => s(u, 0, null));
1291
- const d = {};
1292
- return Object.keys(c).forEach((u) => {
1293
- d[u] = Ct(c[u]);
1294
- }), {
1295
- itemMetaMap: i,
1296
- itemMap: p,
1297
- itemOrderedChildrenIds: c,
1298
- itemChildrenIndexes: d
1299
- };
1300
- }, me = ({
1301
- instance: e,
1302
- params: t,
1303
- state: n,
1304
- setState: o,
1305
- experimentalFeatures: i
1306
- }) => {
1307
- const p = E.useCallback((h) => n.items.itemMetaMap[h], [n.items.itemMetaMap]), c = E.useCallback((h) => n.items.itemMap[h], [n.items.itemMap]), s = E.useCallback(() => {
1308
- const h = (y) => {
1309
- const C = n.items.itemMap[y], k = X(C, bo), w = n.items.itemOrderedChildrenIds[y];
1310
- return w && (k.children = w.map(h)), k;
1311
- };
1312
- return n.items.itemOrderedChildrenIds[ee].map(h);
1313
- }, [n.items.itemMap, n.items.itemOrderedChildrenIds]), d = E.useCallback((h) => {
1314
- if (h == null)
1315
- return !1;
1316
- let y = e.getItemMeta(h);
1317
- if (!y)
1318
- return !1;
1319
- if (y.disabled)
1320
- return !0;
1321
- for (; y.parentId != null; )
1322
- if (y = e.getItemMeta(y.parentId), y.disabled)
1323
- return !0;
1324
- return !1;
1325
- }, [e]), u = E.useCallback((h) => {
1326
- const y = e.getItemMeta(h).parentId ?? ee;
1327
- return n.items.itemChildrenIndexes[y][h];
1328
- }, [e, n.items.itemChildrenIndexes]), l = E.useCallback((h) => n.items.itemOrderedChildrenIds[h ?? ee] ?? [], [n.items.itemOrderedChildrenIds]), a = (h) => {
1329
- const y = e.getItemMeta(h);
1330
- return y == null ? null : document.getElementById(Te({
1331
- treeId: n.id.treeId,
1332
- itemId: h,
1333
- id: y.idAttribute
1334
- }));
1335
- }, f = (h) => t.disabledItemsFocusable ? !0 : !e.isItemDisabled(h), g = E.useRef(!1), b = E.useCallback(() => {
1336
- g.current = !0;
1337
- }, []), m = E.useCallback(() => g.current, []);
1338
- return E.useEffect(() => {
1339
- e.areItemUpdatesPrevented() || o((h) => {
1340
- const y = wt({
1341
- items: t.items,
1342
- isItemDisabled: t.isItemDisabled,
1343
- getItemId: t.getItemId,
1344
- getItemLabel: t.getItemLabel
1345
- });
1346
- return Object.values(h.items.itemMetaMap).forEach((C) => {
1347
- y.itemMetaMap[C.id] || xt(e, "removeItem", {
1348
- id: C.id
1349
- });
1350
- }), x({}, h, {
1351
- items: y
1352
- });
1353
- });
1354
- }, [e, o, t.items, t.isItemDisabled, t.getItemId, t.getItemLabel]), {
1355
- getRootProps: () => ({
1356
- style: {
1357
- "--TreeView-itemChildrenIndentation": typeof t.itemChildrenIndentation == "number" ? `${t.itemChildrenIndentation}px` : t.itemChildrenIndentation
1358
- }
1359
- }),
1360
- publicAPI: {
1361
- getItem: c,
1362
- getItemDOMElement: a,
1363
- getItemTree: s,
1364
- getItemOrderedChildrenIds: l
1365
- },
1366
- instance: {
1367
- getItemMeta: p,
1368
- getItem: c,
1369
- getItemTree: s,
1370
- getItemsToRender: () => {
1371
- const h = (y) => {
1372
- var k;
1373
- const C = n.items.itemMetaMap[y];
1374
- return {
1375
- label: C.label,
1376
- itemId: C.id,
1377
- id: C.idAttribute,
1378
- children: (k = n.items.itemOrderedChildrenIds[y]) == null ? void 0 : k.map(h)
1379
- };
1380
- };
1381
- return n.items.itemOrderedChildrenIds[ee].map(h);
1382
- },
1383
- getItemIndex: u,
1384
- getItemDOMElement: a,
1385
- getItemOrderedChildrenIds: l,
1386
- isItemDisabled: d,
1387
- isItemNavigable: f,
1388
- preventItemUpdates: b,
1389
- areItemUpdatesPrevented: m
1390
- },
1391
- contextValue: {
1392
- items: {
1393
- onItemClick: t.onItemClick,
1394
- disabledItemsFocusable: t.disabledItemsFocusable,
1395
- indentationAtItemLevel: i.indentationAtItemLevel ?? !1
1396
- }
1397
- }
1398
- };
1399
- };
1400
- me.getInitialState = (e) => ({
1401
- items: wt({
1402
- items: e.items,
1403
- isItemDisabled: e.isItemDisabled,
1404
- getItemId: e.getItemId,
1405
- getItemLabel: e.getItemLabel
1406
- })
1407
- });
1408
- me.getDefaultizedParams = ({
1409
- params: e
1410
- }) => x({}, e, {
1411
- disabledItemsFocusable: e.disabledItemsFocusable ?? !1,
1412
- itemChildrenIndentation: e.itemChildrenIndentation ?? "12px"
1413
- });
1414
- me.wrapRoot = ({
1415
- children: e,
1416
- instance: t
1417
- }) => /* @__PURE__ */ T(ie.Provider, {
1418
- value: (n) => {
1419
- var o;
1420
- return ((o = t.getItemMeta(n)) == null ? void 0 : o.depth) ?? 0;
1421
- },
1422
- children: e
1423
- });
1424
- me.params = {
1425
- disabledItemsFocusable: !0,
1426
- items: !0,
1427
- isItemDisabled: !0,
1428
- getItemLabel: !0,
1429
- getItemId: !0,
1430
- onItemClick: !0,
1431
- itemChildrenIndentation: !0
1432
- };
1433
- const Tt = typeof window < "u" ? E.useLayoutEffect : E.useEffect;
1434
- function G(e) {
1435
- const t = E.useRef(e);
1436
- return Tt(() => {
1437
- t.current = e;
1438
- }), E.useRef((...n) => (
1439
- // @ts-expect-error hide `this`
1440
- (0, t.current)(...n)
1441
- )).current;
1442
- }
1443
- const ve = ({
1444
- instance: e,
1445
- params: t,
1446
- models: n
1447
- }) => {
1448
- const o = E.useMemo(() => {
1449
- const a = /* @__PURE__ */ new Map();
1450
- return n.expandedItems.value.forEach((f) => {
1451
- a.set(f, !0);
1452
- }), a;
1453
- }, [n.expandedItems.value]), i = (a, f) => {
1454
- var g;
1455
- (g = t.onExpandedItemsChange) == null || g.call(t, a, f), n.expandedItems.setControlledValue(f);
1456
- }, p = E.useCallback((a) => o.has(a), [o]), c = E.useCallback((a) => {
1457
- var f;
1458
- return !!((f = e.getItemMeta(a)) != null && f.expandable);
1459
- }, [e]), s = G((a, f) => {
1460
- const g = e.isItemExpanded(f);
1461
- e.setItemExpansion(a, f, !g);
1462
- }), d = G((a, f, g) => {
1463
- if (e.isItemExpanded(f) === g)
1464
- return;
1465
- let m;
1466
- g ? m = [f].concat(n.expandedItems.value) : m = n.expandedItems.value.filter((I) => I !== f), t.onItemExpansionToggle && t.onItemExpansionToggle(a, f, g), i(a, m);
1467
- }), u = (a, f) => {
1468
- const g = e.getItemMeta(f), m = e.getItemOrderedChildrenIds(g.parentId).filter((h) => e.isItemExpandable(h) && !e.isItemExpanded(h)), I = n.expandedItems.value.concat(m);
1469
- m.length > 0 && (t.onItemExpansionToggle && m.forEach((h) => {
1470
- t.onItemExpansionToggle(a, h, !0);
1471
- }), i(a, I));
1472
- }, l = E.useMemo(() => t.expansionTrigger ? t.expansionTrigger : e.isTreeViewEditable ? "iconContainer" : "content", [t.expansionTrigger, e.isTreeViewEditable]);
1473
- return {
1474
- publicAPI: {
1475
- setItemExpansion: d
1476
- },
1477
- instance: {
1478
- isItemExpanded: p,
1479
- isItemExpandable: c,
1480
- setItemExpansion: d,
1481
- toggleItemExpansion: s,
1482
- expandAllSiblings: u
1483
- },
1484
- contextValue: {
1485
- expansion: {
1486
- expansionTrigger: l
1487
- }
1488
- }
1489
- };
1490
- };
1491
- ve.models = {
1492
- expandedItems: {
1493
- getDefaultValue: (e) => e.defaultExpandedItems
1494
- }
1495
- };
1496
- const yo = [];
1497
- ve.getDefaultizedParams = ({
1498
- params: e
1499
- }) => x({}, e, {
1500
- defaultExpandedItems: e.defaultExpandedItems ?? yo
1501
- });
1502
- ve.params = {
1503
- expandedItems: !0,
1504
- defaultExpandedItems: !0,
1505
- onExpandedItemsChange: !0,
1506
- onItemExpansionToggle: !0,
1507
- expansionTrigger: !0
1508
- };
1509
- const vt = (e, t) => {
1510
- let n = t.length - 1;
1511
- for (; n >= 0 && !e.isItemNavigable(t[n]); )
1512
- n -= 1;
1513
- if (n !== -1)
1514
- return t[n];
1515
- }, Rt = (e, t) => {
1516
- const n = e.getItemMeta(t), o = e.getItemOrderedChildrenIds(n.parentId), i = e.getItemIndex(t);
1517
- if (i === 0)
1518
- return n.parentId;
1519
- let p = i - 1;
1520
- for (; !e.isItemNavigable(o[p]) && p >= 0; )
1521
- p -= 1;
1522
- if (p === -1)
1523
- return n.parentId == null ? null : Rt(e, n.parentId);
1524
- let c = o[p], s = vt(e, e.getItemOrderedChildrenIds(c));
1525
- for (; e.isItemExpanded(c) && s != null; )
1526
- c = s, s = e.getItemOrderedChildrenIds(c).find(e.isItemNavigable);
1527
- return c;
1528
- }, ye = (e, t) => {
1529
- if (e.isItemExpanded(t)) {
1530
- const o = e.getItemOrderedChildrenIds(t).find(e.isItemNavigable);
1531
- if (o != null)
1532
- return o;
1533
- }
1534
- let n = e.getItemMeta(t);
1535
- for (; n != null; ) {
1536
- const o = e.getItemOrderedChildrenIds(n.parentId), i = e.getItemIndex(n.id);
1537
- if (i < o.length - 1) {
1538
- let p = i + 1;
1539
- for (; !e.isItemNavigable(o[p]) && p < o.length - 1; )
1540
- p += 1;
1541
- if (e.isItemNavigable(o[p]))
1542
- return o[p];
1543
- }
1544
- n = e.getItemMeta(n.parentId);
1545
- }
1546
- return null;
1547
- }, Mt = (e) => {
1548
- let t = null;
1549
- for (; t == null || e.isItemExpanded(t); ) {
1550
- const n = e.getItemOrderedChildrenIds(t), o = vt(e, n);
1551
- if (o == null)
1552
- return t;
1553
- t = o;
1554
- }
1555
- return t;
1556
- }, fe = (e) => e.getItemOrderedChildrenIds(null).find(e.isItemNavigable), St = (e, t, n) => {
1557
- if (t === n)
1558
- return [t, n];
1559
- const o = e.getItemMeta(t), i = e.getItemMeta(n);
1560
- if (o.parentId === i.id || i.parentId === o.id)
1561
- return i.parentId === o.id ? [o.id, i.id] : [i.id, o.id];
1562
- const p = [o.id], c = [i.id];
1563
- let s = o.parentId, d = i.parentId, u = c.indexOf(s) !== -1, l = p.indexOf(d) !== -1, a = !0, f = !0;
1564
- for (; !l && !u; )
1565
- a && (p.push(s), u = c.indexOf(s) !== -1, a = s !== null, !u && a && (s = e.getItemMeta(s).parentId)), f && !u && (c.push(d), l = p.indexOf(d) !== -1, f = d !== null, !l && f && (d = e.getItemMeta(d).parentId));
1566
- const g = u ? s : d, b = e.getItemOrderedChildrenIds(g), m = p[p.indexOf(g) - 1], I = c[c.indexOf(g) - 1];
1567
- return b.indexOf(m) < b.indexOf(I) ? [t, n] : [n, t];
1568
- }, Eo = (e, t, n) => {
1569
- const o = (d) => {
1570
- if (e.isItemExpandable(d) && e.isItemExpanded(d))
1571
- return e.getItemOrderedChildrenIds(d)[0];
1572
- let u = e.getItemMeta(d);
1573
- for (; u != null; ) {
1574
- const l = e.getItemOrderedChildrenIds(u.parentId), a = e.getItemIndex(u.id);
1575
- if (a < l.length - 1)
1576
- return l[a + 1];
1577
- u = e.getItemMeta(u.parentId);
1578
- }
1579
- throw new Error("Invalid range");
1580
- }, [i, p] = St(e, t, n), c = [i];
1581
- let s = i;
1582
- for (; s !== p; )
1583
- s = o(s), e.isItemDisabled(s) || c.push(s);
1584
- return c;
1585
- }, xo = (e) => {
1586
- let t = fe(e);
1587
- const n = [];
1588
- for (; t != null; )
1589
- n.push(t), t = ye(e, t);
1590
- return n;
1591
- }, $e = (e, t) => t !== e.closest('*[role="treeitem"]'), Ee = (e) => Array.isArray(e) ? e : e != null ? [e] : [], De = (e) => {
1592
- const t = {};
1593
- return e.forEach((n) => {
1594
- t[n] = !0;
1595
- }), t;
1596
- }, Re = ({
1597
- instance: e,
1598
- params: t,
1599
- models: n
1600
- }) => {
1601
- const o = E.useRef(null), i = E.useRef({}), p = E.useMemo(() => {
1602
- const m = /* @__PURE__ */ new Map();
1603
- return Array.isArray(n.selectedItems.value) ? n.selectedItems.value.forEach((I) => {
1604
- m.set(I, !0);
1605
- }) : n.selectedItems.value != null && m.set(n.selectedItems.value, !0), m;
1606
- }, [n.selectedItems.value]), c = (m, I) => {
1607
- if (t.onItemSelectionToggle)
1608
- if (t.multiSelect) {
1609
- const h = I.filter((C) => !e.isItemSelected(C)), y = n.selectedItems.value.filter((C) => !I.includes(C));
1610
- h.forEach((C) => {
1611
- t.onItemSelectionToggle(m, C, !0);
1612
- }), y.forEach((C) => {
1613
- t.onItemSelectionToggle(m, C, !1);
1614
- });
1615
- } else I !== n.selectedItems.value && (n.selectedItems.value != null && t.onItemSelectionToggle(m, n.selectedItems.value, !1), I != null && t.onItemSelectionToggle(m, I, !0));
1616
- t.onSelectedItemsChange && t.onSelectedItemsChange(m, I), n.selectedItems.setControlledValue(I);
1617
- }, s = (m) => p.has(m), d = ({
1618
- event: m,
1619
- itemId: I,
1620
- keepExistingSelection: h = !1,
1621
- shouldBeSelected: y
1622
- }) => {
1623
- if (t.disableSelection)
1624
- return;
1625
- let C;
1626
- if (h) {
1627
- const k = Ee(n.selectedItems.value), w = e.isItemSelected(I);
1628
- w && (y === !1 || y == null) ? C = k.filter((R) => R !== I) : !w && (y === !0 || y == null) ? C = [I].concat(k) : C = k;
1629
- } else
1630
- y === !1 || y == null && e.isItemSelected(I) ? C = t.multiSelect ? [] : null : C = t.multiSelect ? [I] : I;
1631
- c(m, C), o.current = I, i.current = {};
1632
- }, u = (m, [I, h]) => {
1633
- if (t.disableSelection || !t.multiSelect)
1634
- return;
1635
- let y = Ee(n.selectedItems.value).slice();
1636
- Object.keys(i.current).length > 0 && (y = y.filter((R) => !i.current[R]));
1637
- const C = De(y), k = Eo(e, I, h), w = k.filter((R) => !C[R]);
1638
- y = y.concat(w), c(m, y), i.current = De(k);
1639
- };
1640
- return {
1641
- getRootProps: () => ({
1642
- "aria-multiselectable": t.multiSelect
1643
- }),
1644
- publicAPI: {
1645
- selectItem: d
1646
- },
1647
- instance: {
1648
- isItemSelected: s,
1649
- selectItem: d,
1650
- selectAllNavigableItems: (m) => {
1651
- if (t.disableSelection || !t.multiSelect)
1652
- return;
1653
- const I = xo(e);
1654
- c(m, I), i.current = De(I);
1655
- },
1656
- expandSelectionRange: (m, I) => {
1657
- if (o.current != null) {
1658
- const [h, y] = St(e, I, o.current);
1659
- u(m, [h, y]);
1660
- }
1661
- },
1662
- selectRangeFromStartToItem: (m, I) => {
1663
- u(m, [fe(e), I]);
1664
- },
1665
- selectRangeFromItemToEnd: (m, I) => {
1666
- u(m, [I, Mt(e)]);
1667
- },
1668
- selectItemFromArrowNavigation: (m, I, h) => {
1669
- if (t.disableSelection || !t.multiSelect)
1670
- return;
1671
- let y = Ee(n.selectedItems.value).slice();
1672
- Object.keys(i.current).length === 0 ? (y.push(h), i.current = {
1673
- [I]: !0,
1674
- [h]: !0
1675
- }) : (i.current[I] || (i.current = {}), i.current[h] ? (y = y.filter((C) => C !== I), delete i.current[I]) : (y.push(h), i.current[h] = !0)), c(m, y);
1676
- }
1677
- },
1678
- contextValue: {
1679
- selection: {
1680
- multiSelect: t.multiSelect,
1681
- checkboxSelection: t.checkboxSelection,
1682
- disableSelection: t.disableSelection
1683
- }
1684
- }
1685
- };
1686
- };
1687
- Re.models = {
1688
- selectedItems: {
1689
- getDefaultValue: (e) => e.defaultSelectedItems
1690
- }
1691
- };
1692
- const Co = [];
1693
- Re.getDefaultizedParams = ({
1694
- params: e
1695
- }) => x({}, e, {
1696
- disableSelection: e.disableSelection ?? !1,
1697
- multiSelect: e.multiSelect ?? !1,
1698
- checkboxSelection: e.checkboxSelection ?? !1,
1699
- defaultSelectedItems: e.defaultSelectedItems ?? (e.multiSelect ? Co : null)
1700
- });
1701
- Re.params = {
1702
- disableSelection: !0,
1703
- multiSelect: !0,
1704
- checkboxSelection: !0,
1705
- defaultSelectedItems: !0,
1706
- selectedItems: !0,
1707
- onSelectedItemsChange: !0,
1708
- onItemSelectionToggle: !0
1709
- };
1710
- function wo(e) {
1711
- return e && e.ownerDocument || document;
1712
- }
1713
- const lt = 1e3;
1714
- class To {
1715
- constructor(t = lt) {
1716
- this.timeouts = /* @__PURE__ */ new Map(), this.cleanupTimeout = lt, this.cleanupTimeout = t;
1717
- }
1718
- register(t, n, o) {
1719
- this.timeouts || (this.timeouts = /* @__PURE__ */ new Map());
1720
- const i = setTimeout(() => {
1721
- typeof n == "function" && n(), this.timeouts.delete(o.cleanupToken);
1722
- }, this.cleanupTimeout);
1723
- this.timeouts.set(o.cleanupToken, i);
1724
- }
1725
- unregister(t) {
1726
- const n = this.timeouts.get(t.cleanupToken);
1727
- n && (this.timeouts.delete(t.cleanupToken), clearTimeout(n));
1728
- }
1729
- reset() {
1730
- this.timeouts && (this.timeouts.forEach((t, n) => {
1731
- this.unregister({
1732
- cleanupToken: n
1733
- });
1734
- }), this.timeouts = void 0);
1735
- }
1736
- }
1737
- class vo {
1738
- constructor() {
1739
- this.registry = new FinalizationRegistry((t) => {
1740
- typeof t == "function" && t();
1741
- });
1742
- }
1743
- register(t, n, o) {
1744
- this.registry.register(t, n, o);
1745
- }
1746
- unregister(t) {
1747
- this.registry.unregister(t);
1748
- }
1749
- // eslint-disable-next-line class-methods-use-this
1750
- reset() {
1751
- }
1752
- }
1753
- class Ro {
1754
- }
1755
- function Mo(e) {
1756
- let t = 0;
1757
- return function(o, i, p) {
1758
- e.registry === null && (e.registry = typeof FinalizationRegistry < "u" ? new vo() : new To());
1759
- const [c] = E.useState(new Ro()), s = E.useRef(null), d = E.useRef(void 0);
1760
- d.current = p;
1761
- const u = E.useRef(null);
1762
- if (!s.current && d.current) {
1763
- const l = (a, f) => {
1764
- var g;
1765
- f.defaultMuiPrevented || (g = d.current) == null || g.call(d, a, f);
1766
- };
1767
- s.current = o.$$subscribeEvent(i, l), t += 1, u.current = {
1768
- cleanupToken: t
1769
- }, e.registry.register(
1770
- c,
1771
- // The callback below will be called once this reference stops being retained
1772
- () => {
1773
- var a;
1774
- (a = s.current) == null || a.call(s), s.current = null, u.current = null;
1775
- },
1776
- u.current
1777
- );
1778
- } else !d.current && s.current && (s.current(), s.current = null, u.current && (e.registry.unregister(u.current), u.current = null));
1779
- E.useEffect(() => {
1780
- if (!s.current && d.current) {
1781
- const l = (a, f) => {
1782
- var g;
1783
- f.defaultMuiPrevented || (g = d.current) == null || g.call(d, a, f);
1784
- };
1785
- s.current = o.$$subscribeEvent(i, l);
1786
- }
1787
- return u.current && e.registry && (e.registry.unregister(u.current), u.current = null), () => {
1788
- var l;
1789
- (l = s.current) == null || l.call(s), s.current = null;
1790
- };
1791
- }, [o, i]);
1792
- };
1793
- }
1794
- const So = {
1795
- registry: null
1796
- }, ko = Mo(So), kt = (e = document) => {
1797
- const t = e.activeElement;
1798
- return t ? t.shadowRoot ? kt(t.shadowRoot) : t : null;
1799
- };
1800
- function Oo(e) {
1801
- return e.replace(/["\\]/g, "\\$&");
1802
- }
1803
- const Po = (e, t) => {
1804
- let n = Ee(t).find((o) => {
1805
- if (!e.isItemNavigable(o))
1806
- return !1;
1807
- const i = e.getItemMeta(o);
1808
- return i && (i.parentId == null || e.isItemExpanded(i.parentId));
1809
- });
1810
- return n == null && (n = fe(e)), n;
1811
- }, Be = ({
1812
- instance: e,
1813
- params: t,
1814
- state: n,
1815
- setState: o,
1816
- models: i,
1817
- rootRef: p
1818
- }) => {
1819
- const c = Po(e, i.selectedItems.value), s = G((I) => {
1820
- const h = typeof I == "function" ? I(n.focusedItemId) : I;
1821
- n.focusedItemId !== h && o((y) => x({}, y, {
1822
- focusedItemId: h
1823
- }));
1824
- }), d = E.useCallback(() => !!p.current && p.current.contains(kt(wo(p.current))), [p]), u = E.useCallback((I) => n.focusedItemId === I && d(), [n.focusedItemId, d]), l = (I) => {
1825
- const h = e.getItemMeta(I);
1826
- return h && (h.parentId == null || e.isItemExpanded(h.parentId));
1827
- }, a = (I, h) => {
1828
- const y = e.getItemDOMElement(h);
1829
- y && y.focus(), s(h), t.onItemFocus && t.onItemFocus(I, h);
1830
- }, f = G((I, h) => {
1831
- l(h) && a(I, h);
1832
- }), g = G(() => {
1833
- if (n.focusedItemId == null)
1834
- return;
1835
- if (e.getItemMeta(n.focusedItemId)) {
1836
- const h = e.getItemDOMElement(n.focusedItemId);
1837
- h && h.blur();
1838
- }
1839
- s(null);
1840
- }), b = (I) => I === c;
1841
- ko(e, "removeItem", ({
1842
- id: I
1843
- }) => {
1844
- n.focusedItemId === I && a(null, c);
1845
- });
1846
- const m = (I) => (h) => {
1847
- var y;
1848
- (y = I.onFocus) == null || y.call(I, h), !h.defaultMuiPrevented && h.target === h.currentTarget && a(h, c);
1849
- };
1850
- return {
1851
- getRootProps: (I) => ({
1852
- onFocus: m(I)
1853
- }),
1854
- publicAPI: {
1855
- focusItem: f
1856
- },
1857
- instance: {
1858
- isItemFocused: u,
1859
- canItemBeTabbed: b,
1860
- focusItem: f,
1861
- removeFocusedItem: g
1862
- }
1863
- };
1864
- };
1865
- Be.getInitialState = () => ({
1866
- focusedItemId: null
1867
- });
1868
- Be.params = {
1869
- onItemFocus: !0
1870
- };
1871
- const xe = (e, t) => e.getAvailablePlugins().has(t), Do = ({
1872
- props: e
1873
- }) => {
1874
- const {
1875
- instance: t
1876
- } = se(), {
1877
- label: n,
1878
- itemId: o
1879
- } = e, [i, p] = E.useState(n), c = t.isItemBeingEdited(o);
1880
- return E.useEffect(() => {
1881
- c || p(n);
1882
- }, [c, n]), {
1883
- propsEnhancers: {
1884
- labelInput: ({
1885
- externalEventHandlers: s,
1886
- interactions: d
1887
- }) => t.isItemEditable(o) ? {
1888
- value: i ?? "",
1889
- "data-element": "labelInput",
1890
- onChange: (g) => {
1891
- var b;
1892
- (b = s.onChange) == null || b.call(s, g), p(g.target.value);
1893
- },
1894
- onKeyDown: (g) => {
1895
- var m;
1896
- if ((m = s.onKeyDown) == null || m.call(s, g), g.defaultMuiPrevented)
1897
- return;
1898
- const b = g.target;
1899
- g.key === "Enter" && b.value ? d.handleSaveItemLabel(g, b.value) : g.key === "Escape" && d.handleCancelItemLabelEditing(g);
1900
- },
1901
- onBlur: (g) => {
1902
- var b;
1903
- (b = s.onBlur) == null || b.call(s, g), !g.defaultMuiPrevented && g.target.value && d.handleSaveItemLabel(g, g.target.value);
1904
- },
1905
- autoFocus: !0,
1906
- type: "text"
1907
- } : {}
1908
- }
1909
- };
1910
- }, Y = ({
1911
- instance: e,
1912
- state: t,
1913
- setState: n,
1914
- params: o
1915
- }) => {
1916
- const i = E.useRef(t.editedItemId), p = (a) => i.current === a, c = (a) => {
1917
- n((f) => x({}, f, {
1918
- editedItemId: a
1919
- })), i.current = a;
1920
- }, s = (a) => a === t.editedItemId, d = !!o.isItemEditable, u = (a) => {
1921
- if (a == null || !d)
1922
- return !1;
1923
- const f = e.getItem(a);
1924
- return f ? typeof o.isItemEditable == "function" ? o.isItemEditable(f) : !!o.isItemEditable : !1;
1925
- }, l = (a, f) => {
1926
- if (!f)
1927
- 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.", a].join(`
1928
- `));
1929
- n((g) => {
1930
- const b = g.items.itemMetaMap[a];
1931
- return b.label !== f ? x({}, g, {
1932
- items: x({}, g.items, {
1933
- itemMetaMap: x({}, g.items.itemMetaMap, {
1934
- [a]: x({}, b, {
1935
- label: f
1936
- })
1937
- })
1938
- })
1939
- }) : g;
1940
- }), o.onItemLabelChange && o.onItemLabelChange(a, f);
1941
- };
1942
- return {
1943
- instance: {
1944
- setEditedItemId: c,
1945
- isItemBeingEdited: s,
1946
- updateItemLabel: l,
1947
- isItemEditable: u,
1948
- isTreeViewEditable: d,
1949
- isItemBeingEditedRef: p
1950
- },
1951
- publicAPI: {
1952
- updateItemLabel: l
1953
- }
1954
- };
1955
- };
1956
- Y.itemPlugin = Do;
1957
- Y.getDefaultizedParams = ({
1958
- params: e,
1959
- experimentalFeatures: t
1960
- }) => {
1961
- const n = t == null ? void 0 : t.labelEditing;
1962
- return process.env.NODE_ENV !== "production" && e.isItemEditable && !n && Ce(["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 Rich Tree View Pro component.", "Check the documentation for more details: https://mui.com/x/react-tree-view/rich-tree-view/editing/"]), x({}, e, {
1963
- isItemEditable: n ? e.isItemEditable ?? !1 : !1
1964
- });
1965
- };
1966
- Y.getInitialState = () => ({
1967
- editedItemId: null
1968
- });
1969
- Y.params = {
1970
- onItemLabelChange: !0,
1971
- isItemEditable: !0
1972
- };
1973
- function Vo(e) {
1974
- return !!e && e.length === 1 && !!e.match(/\S/);
1975
- }
1976
- const Ot = ({
1977
- instance: e,
1978
- params: t,
1979
- state: n
1980
- }) => {
1981
- const o = bn(), i = E.useRef({}), p = G((l) => {
1982
- i.current = l(i.current);
1983
- });
1984
- E.useEffect(() => {
1985
- if (e.areItemUpdatesPrevented())
1986
- return;
1987
- const l = {}, a = (f) => {
1988
- l[f.id] = f.label.substring(0, 1).toLowerCase();
1989
- };
1990
- Object.values(n.items.itemMetaMap).forEach(a), i.current = l;
1991
- }, [n.items.itemMetaMap, t.getItemId, e]);
1992
- const c = (l, a) => {
1993
- const f = a.toLowerCase(), g = (h) => {
1994
- const y = ye(e, h);
1995
- return y === null ? fe(e) : y;
1996
- };
1997
- let b = null, m = g(l);
1998
- const I = {};
1999
- for (; b == null && !I[m]; )
2000
- i.current[m] === f ? b = m : (I[m] = !0, m = g(m));
2001
- return b;
2002
- }, s = (l) => !t.disableSelection && !e.isItemDisabled(l), d = (l) => !e.isItemDisabled(l) && e.isItemExpandable(l);
2003
- return {
2004
- instance: {
2005
- updateFirstCharMap: p,
2006
- handleItemKeyDown: (l, a) => {
2007
- if (l.defaultMuiPrevented || l.altKey || $e(l.target, l.currentTarget))
2008
- return;
2009
- const f = l.ctrlKey || l.metaKey, g = l.key;
2010
- switch (!0) {
2011
- case (g === " " && s(a)): {
2012
- l.preventDefault(), t.multiSelect && l.shiftKey ? e.expandSelectionRange(l, a) : e.selectItem({
2013
- event: l,
2014
- itemId: a,
2015
- keepExistingSelection: t.multiSelect,
2016
- shouldBeSelected: t.multiSelect ? void 0 : !0
2017
- });
2018
- break;
2019
- }
2020
- case g === "Enter": {
2021
- xe(e, Y) && e.isItemEditable(a) && !e.isItemBeingEdited(a) ? e.setEditedItemId(a) : d(a) ? (e.toggleItemExpansion(l, a), l.preventDefault()) : s(a) && (t.multiSelect ? (l.preventDefault(), e.selectItem({
2022
- event: l,
2023
- itemId: a,
2024
- keepExistingSelection: !0
2025
- })) : e.isItemSelected(a) || (e.selectItem({
2026
- event: l,
2027
- itemId: a
2028
- }), l.preventDefault()));
2029
- break;
2030
- }
2031
- case g === "ArrowDown": {
2032
- const b = ye(e, a);
2033
- b && (l.preventDefault(), e.focusItem(l, b), t.multiSelect && l.shiftKey && s(b) && e.selectItemFromArrowNavigation(l, a, b));
2034
- break;
2035
- }
2036
- case g === "ArrowUp": {
2037
- const b = Rt(e, a);
2038
- b && (l.preventDefault(), e.focusItem(l, b), t.multiSelect && l.shiftKey && s(b) && e.selectItemFromArrowNavigation(l, a, b));
2039
- break;
2040
- }
2041
- case (g === "ArrowRight" && !o || g === "ArrowLeft" && o): {
2042
- if (f)
2043
- return;
2044
- if (e.isItemExpanded(a)) {
2045
- const b = ye(e, a);
2046
- b && (e.focusItem(l, b), l.preventDefault());
2047
- } else d(a) && (e.toggleItemExpansion(l, a), l.preventDefault());
2048
- break;
2049
- }
2050
- case (g === "ArrowLeft" && !o || g === "ArrowRight" && o): {
2051
- if (f)
2052
- return;
2053
- if (d(a) && e.isItemExpanded(a))
2054
- e.toggleItemExpansion(l, a), l.preventDefault();
2055
- else {
2056
- const b = e.getItemMeta(a).parentId;
2057
- b && (e.focusItem(l, b), l.preventDefault());
2058
- }
2059
- break;
2060
- }
2061
- case g === "Home": {
2062
- s(a) && t.multiSelect && f && l.shiftKey ? e.selectRangeFromStartToItem(l, a) : e.focusItem(l, fe(e)), l.preventDefault();
2063
- break;
2064
- }
2065
- case g === "End": {
2066
- s(a) && t.multiSelect && f && l.shiftKey ? e.selectRangeFromItemToEnd(l, a) : e.focusItem(l, Mt(e)), l.preventDefault();
2067
- break;
2068
- }
2069
- case g === "*": {
2070
- e.expandAllSiblings(l, a), l.preventDefault();
2071
- break;
2072
- }
2073
- case (String.fromCharCode(l.keyCode) === "A" && f && t.multiSelect && !t.disableSelection): {
2074
- e.selectAllNavigableItems(l), l.preventDefault();
2075
- break;
2076
- }
2077
- case (!f && !l.shiftKey && Vo(g)): {
2078
- const b = c(a, g);
2079
- b != null && (e.focusItem(l, b), l.preventDefault());
2080
- break;
2081
- }
2082
- }
2083
- }
2084
- }
2085
- };
2086
- };
2087
- Ot.params = {};
2088
- const Pt = ({
2089
- slots: e,
2090
- slotProps: t
2091
- }) => ({
2092
- contextValue: {
2093
- icons: {
2094
- slots: {
2095
- collapseIcon: e.collapseIcon,
2096
- expandIcon: e.expandIcon,
2097
- endIcon: e.endIcon
2098
- },
2099
- slotProps: {
2100
- collapseIcon: t.collapseIcon,
2101
- expandIcon: t.expandIcon,
2102
- endIcon: t.endIcon
2103
- }
2104
- }
2105
- }
2106
- });
2107
- Pt.params = {};
2108
- const Ue = /* @__PURE__ */ E.createContext(null);
2109
- process.env.NODE_ENV !== "production" && (Ue.displayName = "TreeViewChildrenItemContext");
2110
- function Ke(e) {
2111
- const {
2112
- children: t,
2113
- itemId: n = null
2114
- } = e, {
2115
- instance: o,
2116
- treeId: i,
2117
- rootRef: p
2118
- } = se(), c = E.useRef(/* @__PURE__ */ new Map());
2119
- E.useEffect(() => {
2120
- if (!p.current)
2121
- return;
2122
- let d = null;
2123
- if (n == null)
2124
- d = p.current.id;
2125
- else {
2126
- const b = o.getItemMeta(n);
2127
- b !== void 0 && (d = Te({
2128
- itemId: n,
2129
- treeId: i,
2130
- id: b.idAttribute
2131
- }));
2132
- }
2133
- if (d == null)
2134
- return;
2135
- const u = o.getItemOrderedChildrenIds(n ?? null) ?? [], l = Oo(d), a = p.current.querySelectorAll(`${n == null ? "" : `*[id="${l}"] `}[role="treeitem"]:not(*[id="${l}"] [role="treeitem"] [role="treeitem"])`), f = Array.from(a).map((b) => c.current.get(b.id));
2136
- (f.length !== u.length || f.some((b, m) => b !== u[m])) && o.setJSXItemsOrderedChildrenIds(n ?? null, f);
2137
- });
2138
- const s = E.useMemo(() => ({
2139
- registerChild: (d, u) => c.current.set(d, u),
2140
- unregisterChild: (d) => c.current.delete(d),
2141
- parentId: n
2142
- }), [n]);
2143
- return /* @__PURE__ */ T(Ue.Provider, {
2144
- value: s,
2145
- children: t
2146
- });
2147
- }
2148
- process.env.NODE_ENV !== "production" && (Ke.propTypes = {
2149
- children: r.node,
2150
- id: r.string
2151
- });
2152
- const Ie = ({
2153
- instance: e,
2154
- setState: t
2155
- }) => {
2156
- e.preventItemUpdates();
2157
- const n = G((p) => (t((c) => {
2158
- if (c.items.itemMetaMap[p.id] != null)
2159
- 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: "${p.id}"`].join(`
2160
- `));
2161
- return x({}, c, {
2162
- items: x({}, c.items, {
2163
- itemMetaMap: x({}, c.items.itemMetaMap, {
2164
- [p.id]: p
2165
- }),
2166
- // For Simple Tree View, we don't have a proper `item` object, so we create a very basic one.
2167
- itemMap: x({}, c.items.itemMap, {
2168
- [p.id]: {
2169
- id: p.id,
2170
- label: p.label
2171
- }
2172
- })
2173
- })
2174
- });
2175
- }), () => {
2176
- t((c) => {
2177
- const s = x({}, c.items.itemMetaMap), d = x({}, c.items.itemMap);
2178
- return delete s[p.id], delete d[p.id], x({}, c, {
2179
- items: x({}, c.items, {
2180
- itemMetaMap: s,
2181
- itemMap: d
2182
- })
2183
- });
2184
- }), xt(e, "removeItem", {
2185
- id: p.id
2186
- });
2187
- })), o = (p, c) => {
2188
- const s = p ?? ee;
2189
- t((d) => x({}, d, {
2190
- items: x({}, d.items, {
2191
- itemOrderedChildrenIds: x({}, d.items.itemOrderedChildrenIds, {
2192
- [s]: c
2193
- }),
2194
- itemChildrenIndexes: x({}, d.items.itemChildrenIndexes, {
2195
- [s]: Ct(c)
2196
- })
2197
- })
2198
- }));
2199
- }, i = G((p, c) => (e.updateFirstCharMap((s) => (s[p] = c, s)), () => {
2200
- e.updateFirstCharMap((s) => {
2201
- const d = x({}, s);
2202
- return delete d[p], d;
2203
- });
2204
- }));
2205
- return {
2206
- instance: {
2207
- insertJSXItem: n,
2208
- setJSXItemsOrderedChildrenIds: o,
2209
- mapFirstCharFromJSX: i
2210
- }
2211
- };
2212
- }, Dt = (e) => Array.isArray(e) ? e.length > 0 && e.some(Dt) : !!e, $o = ({
2213
- props: e,
2214
- rootRef: t,
2215
- contentRef: n
2216
- }) => {
2217
- const {
2218
- instance: o,
2219
- treeId: i
2220
- } = se(), {
2221
- children: p,
2222
- disabled: c = !1,
2223
- label: s,
2224
- itemId: d,
2225
- id: u
2226
- } = e, l = E.useContext(Ue);
2227
- if (l == null)
2228
- 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(`
2229
- `));
2230
- const {
2231
- registerChild: a,
2232
- unregisterChild: f,
2233
- parentId: g
2234
- } = l, b = Dt(p), m = E.useRef(null), I = pe(m, n);
2235
- return Tt(() => {
2236
- const h = Te({
2237
- itemId: d,
2238
- treeId: i,
2239
- id: u
2240
- });
2241
- return a(h, d), () => {
2242
- f(h);
2243
- };
2244
- }, [a, f, d, u, i]), E.useEffect(() => o.insertJSXItem({
2245
- id: d,
2246
- idAttribute: u,
2247
- parentId: g,
2248
- expandable: b,
2249
- disabled: c
2250
- }), [o, g, d, b, c, u]), E.useEffect(() => {
2251
- var h;
2252
- if (s)
2253
- return o.mapFirstCharFromJSX(d, (((h = m.current) == null ? void 0 : h.textContent) ?? "").substring(0, 1).toLowerCase());
2254
- }, [o, d, s]), {
2255
- contentRef: I,
2256
- rootRef: t
2257
- };
2258
- };
2259
- Ie.itemPlugin = $o;
2260
- Ie.wrapItem = ({
2261
- children: e,
2262
- itemId: t
2263
- }) => {
2264
- const n = E.useContext(ie);
2265
- return /* @__PURE__ */ T(Ke, {
2266
- itemId: t,
2267
- children: /* @__PURE__ */ T(ie.Provider, {
2268
- value: n + 1,
2269
- children: e
2270
- })
2271
- });
2272
- };
2273
- Ie.wrapRoot = ({
2274
- children: e
2275
- }) => /* @__PURE__ */ T(Ke, {
2276
- children: /* @__PURE__ */ T(ie.Provider, {
2277
- value: 0,
2278
- children: e
2279
- })
2280
- });
2281
- Ie.params = {};
2282
- const No = [me, ve, Re, Be, Ot, Pt, Ie], Ao = ht(), Fo = (e) => {
2283
- const {
2284
- classes: t
2285
- } = e;
2286
- return gt({
2287
- root: ["root"]
2288
- }, io, t);
2289
- }, Lo = B("ul", {
2290
- name: "MuiSimpleTreeView",
2291
- slot: "Root",
2292
- overridesResolver: (e, t) => t.root
2293
- })({
2294
- padding: 0,
2295
- margin: 0,
2296
- listStyle: "none",
2297
- outline: 0,
2298
- position: "relative"
2299
- }), jo = [], Vt = /* @__PURE__ */ E.forwardRef(function(t, n) {
2300
- const o = Ao({
2301
- props: t,
2302
- name: "MuiSimpleTreeView"
2303
- }), i = o;
2304
- process.env.NODE_ENV !== "production" && o.items != null && Ce(["MUI X: The Simple Tree View 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/."]);
2305
- const {
2306
- getRootProps: p,
2307
- contextValue: c
2308
- } = go({
2309
- plugins: No,
2310
- rootRef: n,
2311
- props: x({}, o, {
2312
- items: jo
2313
- })
2314
- }), {
2315
- slots: s,
2316
- slotProps: d
2317
- } = o, u = Fo(o), l = (s == null ? void 0 : s.root) ?? Lo, a = ue({
2318
- elementType: l,
2319
- externalSlotProps: d == null ? void 0 : d.root,
2320
- className: u.root,
2321
- getSlotProps: p,
2322
- ownerState: i
2323
- });
2324
- return /* @__PURE__ */ T(ho, {
2325
- value: c,
2326
- children: /* @__PURE__ */ T(l, x({}, a))
2327
- });
2328
- });
2329
- process.env.NODE_ENV !== "production" && (Vt.propTypes = {
2330
- // ----------------------------- Warning --------------------------------
2331
- // | These PropTypes are generated from the TypeScript type definitions |
2332
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
2333
- // ----------------------------------------------------------------------
2334
- /**
2335
- * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
2336
- */
2337
- apiRef: r.shape({
2338
- current: r.shape({
2339
- focusItem: r.func.isRequired,
2340
- getItem: r.func.isRequired,
2341
- getItemDOMElement: r.func.isRequired,
2342
- getItemOrderedChildrenIds: r.func.isRequired,
2343
- getItemTree: r.func.isRequired,
2344
- selectItem: r.func.isRequired,
2345
- setItemExpansion: r.func.isRequired
2346
- })
2347
- }),
2348
- /**
2349
- * If `true`, the Tree View renders a checkbox at the left of its label that allows selecting it.
2350
- * @default false
2351
- */
2352
- checkboxSelection: r.bool,
2353
- /**
2354
- * The content of the component.
2355
- */
2356
- children: r.node,
2357
- /**
2358
- * Override or extend the styles applied to the component.
2359
- */
2360
- classes: r.object,
2361
- className: r.string,
2362
- /**
2363
- * Expanded item ids.
2364
- * Used when the item's expansion is not controlled.
2365
- * @default []
2366
- */
2367
- defaultExpandedItems: r.arrayOf(r.string),
2368
- /**
2369
- * Selected item ids. (Uncontrolled)
2370
- * When `multiSelect` is true this takes an array of strings; when false (default) a string.
2371
- * @default []
2372
- */
2373
- defaultSelectedItems: r.any,
2374
- /**
2375
- * If `true`, will allow focus on disabled items.
2376
- * @default false
2377
- */
2378
- disabledItemsFocusable: r.bool,
2379
- /**
2380
- * If `true` selection is disabled.
2381
- * @default false
2382
- */
2383
- disableSelection: r.bool,
2384
- /**
2385
- * Expanded item ids.
2386
- * Used when the item's expansion is controlled.
2387
- */
2388
- expandedItems: r.arrayOf(r.string),
2389
- /**
2390
- * The slot that triggers the item's expansion when clicked.
2391
- * @default 'content'
2392
- */
2393
- expansionTrigger: r.oneOf(["content", "iconContainer"]),
2394
- /**
2395
- * Unstable features, breaking changes might be introduced.
2396
- * For each feature, if the flag is not explicitly set to `true`,
2397
- * the feature will be fully disabled and any property / method call will not have any effect.
2398
- */
2399
- experimentalFeatures: r.shape({
2400
- indentationAtItemLevel: r.bool
2401
- }),
2402
- /**
2403
- * This prop is used to help implement the accessibility logic.
2404
- * If you don't provide this prop. It falls back to a randomly generated id.
2405
- */
2406
- id: r.string,
2407
- /**
2408
- * Horizontal indentation between an item and its children.
2409
- * Examples: 24, "24px", "2rem", "2em".
2410
- * @default 12px
2411
- */
2412
- itemChildrenIndentation: r.oneOfType([r.number, r.string]),
2413
- /**
2414
- * If `true`, `ctrl` and `shift` will trigger multiselect.
2415
- * @default false
2416
- */
2417
- multiSelect: r.bool,
2418
- /**
2419
- * Callback fired when Tree Items are expanded/collapsed.
2420
- * @param {React.SyntheticEvent} event The DOM event that triggered the change.
2421
- * @param {array} itemIds The ids of the expanded items.
2422
- */
2423
- onExpandedItemsChange: r.func,
2424
- /**
2425
- * Callback fired when the `content` slot of a given Tree Item is clicked.
2426
- * @param {React.MouseEvent} event The DOM event that triggered the change.
2427
- * @param {string} itemId The id of the focused item.
2428
- */
2429
- onItemClick: r.func,
2430
- /**
2431
- * Callback fired when a Tree Item is expanded or collapsed.
2432
- * @param {React.SyntheticEvent} event The DOM event that triggered the change.
2433
- * @param {array} itemId The itemId of the modified item.
2434
- * @param {array} isExpanded `true` if the item has just been expanded, `false` if it has just been collapsed.
2435
- */
2436
- onItemExpansionToggle: r.func,
2437
- /**
2438
- * Callback fired when a given Tree Item is focused.
2439
- * @param {React.SyntheticEvent | null} event The DOM event that triggered the change. **Warning**: This is a generic event not a focus event.
2440
- * @param {string} itemId The id of the focused item.
2441
- */
2442
- onItemFocus: r.func,
2443
- /**
2444
- * Callback fired when a Tree Item is selected or deselected.
2445
- * @param {React.SyntheticEvent} event The DOM event that triggered the change.
2446
- * @param {array} itemId The itemId of the modified item.
2447
- * @param {array} isSelected `true` if the item has just been selected, `false` if it has just been deselected.
2448
- */
2449
- onItemSelectionToggle: r.func,
2450
- /**
2451
- * Callback fired when Tree Items are selected/deselected.
2452
- * @param {React.SyntheticEvent} event The DOM event that triggered the change.
2453
- * @param {string[] | string} itemIds The ids of the selected items.
2454
- * When `multiSelect` is `true`, this is an array of strings; when false (default) a string.
2455
- */
2456
- onSelectedItemsChange: r.func,
2457
- /**
2458
- * Selected item ids. (Controlled)
2459
- * When `multiSelect` is true this takes an array of strings; when false (default) a string.
2460
- */
2461
- selectedItems: r.any,
2462
- /**
2463
- * The props used for each component slot.
2464
- */
2465
- slotProps: r.object,
2466
- /**
2467
- * Overridable component slots.
2468
- */
2469
- slots: r.object,
2470
- /**
2471
- * The system prop that allows defining system overrides as well as additional CSS styles.
2472
- */
2473
- sx: r.oneOfType([r.arrayOf(r.oneOfType([r.func, r.object, r.bool])), r.func, r.object])
2474
- });
2475
- function zo(e, t, n, o, i) {
2476
- if (process.env.NODE_ENV === "production")
2477
- return null;
2478
- const p = i || t;
2479
- return typeof e[t] < "u" ? new Error(`The prop \`${p}\` is not supported. Please remove it.`) : null;
2480
- }
2481
- function _o(e, t) {
2482
- return process.env.NODE_ENV === "production" ? () => null : function(...o) {
2483
- return e(...o) || t(...o);
2484
- };
2485
- }
2486
- function Bo(e) {
2487
- const {
2488
- prototype: t = {}
2489
- } = e;
2490
- return !!t.isReactComponent;
2491
- }
2492
- function Uo(e, t, n, o, i) {
2493
- const p = e[t], c = i || t;
2494
- if (p == null || // When server-side rendering React doesn't warn either.
2495
- // This is not an accurate check for SSR.
2496
- // This is only in place for emotion compat.
2497
- // TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
2498
- typeof window > "u")
2499
- return null;
2500
- let s;
2501
- return typeof p == "function" && !Bo(p) && (s = "Did you accidentally provide a plain function component instead?"), s !== void 0 ? new Error(`Invalid ${o} \`${c}\` supplied to \`${n}\`. Expected an element type that can hold a ref. ${s} For more information see https://mui.com/r/caveat-with-refs-guide`) : null;
2502
- }
2503
- const Ko = _o(r.elementType, Uo);
2504
- function $t(e) {
2505
- const {
2506
- instance: t,
2507
- items: {
2508
- onItemClick: n
2509
- },
2510
- selection: {
2511
- multiSelect: o,
2512
- checkboxSelection: i,
2513
- disableSelection: p
2514
- },
2515
- expansion: {
2516
- expansionTrigger: c
2517
- }
2518
- } = se(), s = t.isItemExpandable(e), d = t.isItemExpanded(e), u = t.isItemFocused(e), l = t.isItemSelected(e), a = t.isItemDisabled(e), f = t != null && t.isItemBeingEdited ? t == null ? void 0 : t.isItemBeingEdited(e) : !1, g = t.isItemEditable ? t.isItemEditable(e) : !1, b = (w) => {
2519
- if (!a) {
2520
- u || t.focusItem(w, e);
2521
- const R = o && (w.shiftKey || w.ctrlKey || w.metaKey);
2522
- s && !(R && t.isItemExpanded(e)) && t.toggleItemExpansion(w, e);
2523
- }
2524
- }, m = (w) => {
2525
- a || (u || t.focusItem(w, e), o && (w.shiftKey || w.ctrlKey || w.metaKey) ? w.shiftKey ? t.expandSelectionRange(w, e) : t.selectItem({
2526
- event: w,
2527
- itemId: e,
2528
- keepExistingSelection: !0
2529
- }) : t.selectItem({
2530
- event: w,
2531
- itemId: e,
2532
- shouldBeSelected: !0
2533
- }));
2534
- }, I = (w) => {
2535
- if (p || a)
2536
- return;
2537
- const R = w.nativeEvent.shiftKey;
2538
- o && R ? t.expandSelectionRange(w, e) : t.selectItem({
2539
- event: w,
2540
- itemId: e,
2541
- keepExistingSelection: o,
2542
- shouldBeSelected: w.target.checked
2543
- });
2544
- }, h = (w) => {
2545
- (w.shiftKey || w.ctrlKey || w.metaKey || a) && w.preventDefault();
2546
- }, y = () => {
2547
- xe(t, Y) && t.isItemEditable(e) && (t.isItemBeingEdited(e) ? t.setEditedItemId(null) : t.setEditedItemId(e));
2548
- };
2549
- return {
2550
- disabled: a,
2551
- expanded: d,
2552
- selected: l,
2553
- focused: u,
2554
- editable: g,
2555
- editing: f,
2556
- disableSelection: p,
2557
- checkboxSelection: i,
2558
- handleExpansion: b,
2559
- handleSelection: m,
2560
- handleCheckboxSelection: I,
2561
- handleContentClick: n,
2562
- preventSelection: h,
2563
- expansionTrigger: c,
2564
- toggleItemEditing: y,
2565
- handleSaveItemLabel: (w, R) => {
2566
- xe(t, Y) && t.isItemBeingEditedRef(e) && (t.updateItemLabel(e, R), y(), t.focusItem(w, e));
2567
- },
2568
- handleCancelItemLabelEditing: (w) => {
2569
- xe(t, Y) && t.isItemBeingEditedRef(e) && (y(), t.focusItem(w, e));
2570
- }
2571
- };
2572
- }
2573
- const qo = B("div", {
2574
- name: "MuiTreeItem2DragAndDropOverlay",
2575
- slot: "Root",
2576
- overridesResolver: (e, t) => t.root,
2577
- shouldForwardProp: (e) => yn(e) && e !== "action"
2578
- })(({
2579
- theme: e
2580
- }) => ({
2581
- position: "absolute",
2582
- left: 0,
2583
- display: "flex",
2584
- top: 0,
2585
- bottom: 0,
2586
- right: 0,
2587
- pointerEvents: "none",
2588
- variants: [{
2589
- props: {
2590
- action: "make-child"
2591
- },
2592
- style: {
2593
- marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
2594
- borderRadius: e.shape.borderRadius,
2595
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.darkChannel} / ${e.vars.palette.action.focusOpacity})` : ce(e.palette.primary.dark, e.palette.action.focusOpacity)
2596
- }
2597
- }, {
2598
- props: {
2599
- action: "reorder-above"
2600
- },
2601
- style: {
2602
- marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
2603
- borderTop: `1px solid ${(e.vars || e).palette.action.active}`
2604
- }
2605
- }, {
2606
- props: {
2607
- action: "reorder-below"
2608
- },
2609
- style: {
2610
- marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
2611
- borderBottom: `1px solid ${(e.vars || e).palette.action.active}`
2612
- }
2613
- }, {
2614
- props: {
2615
- action: "move-to-parent"
2616
- },
2617
- style: {
2618
- marginLeft: "calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",
2619
- borderBottom: `1px solid ${(e.vars || e).palette.action.active}`
2620
- }
2621
- }]
2622
- }));
2623
- function Nt(e) {
2624
- return e.action == null ? null : /* @__PURE__ */ T(qo, x({}, e));
2625
- }
2626
- process.env.NODE_ENV !== "production" && (Nt.propTypes = {
2627
- // ----------------------------- Warning --------------------------------
2628
- // | These PropTypes are generated from the TypeScript type definitions |
2629
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
2630
- // ----------------------------------------------------------------------
2631
- action: r.oneOf(["make-child", "move-to-parent", "reorder-above", "reorder-below"]),
2632
- style: r.object
2633
- });
2634
- const Xo = B("input", {
2635
- name: "MuiTreeItem2",
2636
- slot: "LabelInput",
2637
- overridesResolver: (e, t) => t.labelInput
2638
- })(({
2639
- theme: e
2640
- }) => x({}, e.typography.body1, {
2641
- width: "100%",
2642
- backgroundColor: e.palette.background.paper,
2643
- borderRadius: e.shape.borderRadius,
2644
- border: "none",
2645
- padding: "0 2px",
2646
- boxSizing: "border-box",
2647
- "&:focus": {
2648
- outline: `1px solid ${e.palette.primary.main}`
2649
- }
2650
- })), Wo = ["classes", "className", "displayIcon", "expansionIcon", "icon", "label", "itemId", "onClick", "onMouseDown", "dragAndDropOverlayProps", "labelInputProps"], qe = /* @__PURE__ */ E.forwardRef(function(t, n) {
2651
- const {
2652
- classes: o,
2653
- className: i,
2654
- displayIcon: p,
2655
- expansionIcon: c,
2656
- icon: s,
2657
- label: d,
2658
- itemId: u,
2659
- onClick: l,
2660
- onMouseDown: a,
2661
- dragAndDropOverlayProps: f,
2662
- labelInputProps: g
2663
- } = t, b = X(t, Wo), {
2664
- disabled: m,
2665
- expanded: I,
2666
- selected: h,
2667
- focused: y,
2668
- editing: C,
2669
- editable: k,
2670
- disableSelection: w,
2671
- checkboxSelection: R,
2672
- handleExpansion: S,
2673
- handleSelection: z,
2674
- handleCheckboxSelection: K,
2675
- handleContentClick: D,
2676
- preventSelection: P,
2677
- expansionTrigger: U,
2678
- toggleItemEditing: _
2679
- } = $t(u), A = s || c || p, $ = E.useRef(null), Q = (O) => {
2680
- P(O), a && a(O);
2681
- }, F = (O) => {
2682
- var W;
2683
- D == null || D(O, u), !((W = $.current) != null && W.contains(O.target)) && (U === "content" && S(O), R || z(O), l && l(O));
2684
- }, q = (O) => {
2685
- O.defaultMuiPrevented || _();
2686
- };
2687
- return (
2688
- /* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions -- Key event is handled by the TreeView */
2689
- /* @__PURE__ */ we("div", x({}, b, {
2690
- className: te(o.root, i, I && o.expanded, h && o.selected, y && o.focused, m && o.disabled, C && o.editing, k && o.editable),
2691
- onClick: F,
2692
- onMouseDown: Q,
2693
- ref: n,
2694
- children: [/* @__PURE__ */ T("div", {
2695
- className: o.iconContainer,
2696
- children: A
2697
- }), R && /* @__PURE__ */ T(It, {
2698
- className: o.checkbox,
2699
- checked: h,
2700
- onChange: K,
2701
- disabled: m || w,
2702
- ref: $,
2703
- tabIndex: -1
2704
- }), C ? /* @__PURE__ */ T(Xo, x({}, g, {
2705
- className: o.labelInput
2706
- })) : /* @__PURE__ */ T("div", x({
2707
- className: o.label
2708
- }, k && {
2709
- onDoubleClick: q
2710
- }, {
2711
- children: d
2712
- })), f && /* @__PURE__ */ T(Nt, x({}, f))]
2713
- }))
2714
- );
2715
- });
2716
- process.env.NODE_ENV !== "production" && (qe.propTypes = {
2717
- // ----------------------------- Warning --------------------------------
2718
- // | These PropTypes are generated from the TypeScript type definitions |
2719
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
2720
- // ----------------------------------------------------------------------
2721
- /**
2722
- * Override or extend the styles applied to the component.
2723
- */
2724
- classes: r.object.isRequired,
2725
- className: r.string,
2726
- /**
2727
- * The icon to display next to the Tree Item's label. Either a parent or end icon.
2728
- */
2729
- displayIcon: r.node,
2730
- dragAndDropOverlayProps: r.shape({
2731
- action: r.oneOf(["make-child", "move-to-parent", "reorder-above", "reorder-below"]),
2732
- style: r.object
2733
- }),
2734
- /**
2735
- * The icon to display next to the Tree Item's label. Either an expansion or collapse icon.
2736
- */
2737
- expansionIcon: r.node,
2738
- /**
2739
- * The icon to display next to the Tree Item's label.
2740
- */
2741
- icon: r.node,
2742
- /**
2743
- * The id of the item.
2744
- */
2745
- itemId: r.string.isRequired,
2746
- /**
2747
- * The Tree Item label.
2748
- */
2749
- label: r.node,
2750
- labelInputProps: r.shape({
2751
- autoFocus: r.oneOf([!0]),
2752
- "data-element": r.oneOf(["labelInput"]),
2753
- onBlur: r.func,
2754
- onChange: r.func,
2755
- onKeyDown: r.func,
2756
- type: r.oneOf(["text"]),
2757
- value: r.string
2758
- })
2759
- });
2760
- function Jo(e) {
2761
- return je("MuiTreeItem", e);
2762
- }
2763
- const H = bt("MuiTreeItem", ["root", "groupTransition", "content", "expanded", "selected", "focused", "disabled", "iconContainer", "label", "checkbox", "labelInput", "editable", "editing", "dragAndDropOverlay"]), Ho = ne(/* @__PURE__ */ T("path", {
2764
- d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"
2765
- }), "TreeViewExpandIcon"), Go = ne(/* @__PURE__ */ T("path", {
2766
- d: "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
2767
- }), "TreeViewCollapseIcon");
2768
- function At(e) {
2769
- const {
2770
- children: t,
2771
- itemId: n
2772
- } = e, {
2773
- wrapItem: o,
2774
- instance: i
2775
- } = se();
2776
- return o({
2777
- children: t,
2778
- itemId: n,
2779
- instance: i
2780
- });
2781
- }
2782
- At.propTypes = {
2783
- // ----------------------------- Warning --------------------------------
2784
- // | These PropTypes are generated from the TypeScript type definitions |
2785
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
2786
- // ----------------------------------------------------------------------
2787
- children: r.node,
2788
- itemId: r.string.isRequired
2789
- };
2790
- const Yo = ["children", "className", "slots", "slotProps", "ContentComponent", "ContentProps", "itemId", "id", "label", "onClick", "onMouseDown", "onFocus", "onBlur", "onKeyDown"], Qo = ["ownerState"], Zo = ["ownerState"], er = ["ownerState"], tr = ht(), nr = (e) => {
2791
- const {
2792
- classes: t
2793
- } = e;
2794
- return gt({
2795
- root: ["root"],
2796
- content: ["content"],
2797
- expanded: ["expanded"],
2798
- selected: ["selected"],
2799
- focused: ["focused"],
2800
- disabled: ["disabled"],
2801
- iconContainer: ["iconContainer"],
2802
- checkbox: ["checkbox"],
2803
- label: ["label"],
2804
- labelInput: ["labelInput"],
2805
- editing: ["editing"],
2806
- editable: ["editable"],
2807
- groupTransition: ["groupTransition"]
2808
- }, Jo, t);
2809
- }, or = B("li", {
2810
- name: "MuiTreeItem",
2811
- slot: "Root",
2812
- overridesResolver: (e, t) => t.root
2813
- })({
2814
- listStyle: "none",
2815
- margin: 0,
2816
- padding: 0,
2817
- outline: 0
2818
- }), rr = B(qe, {
2819
- name: "MuiTreeItem",
2820
- slot: "Content",
2821
- overridesResolver: (e, t) => [t.content, t.iconContainer && {
2822
- [`& .${H.iconContainer}`]: t.iconContainer
2823
- }, t.label && {
2824
- [`& .${H.label}`]: t.label
2825
- }],
2826
- shouldForwardProp: (e) => dt(e) && e !== "indentationAtItemLevel"
2827
- })(({
2828
- theme: e
2829
- }) => ({
2830
- padding: e.spacing(0.5, 1),
2831
- borderRadius: e.shape.borderRadius,
2832
- width: "100%",
2833
- boxSizing: "border-box",
2834
- // prevent width + padding to overflow
2835
- position: "relative",
2836
- display: "flex",
2837
- alignItems: "center",
2838
- gap: e.spacing(1),
2839
- cursor: "pointer",
2840
- WebkitTapHighlightColor: "transparent",
2841
- "&:hover": {
2842
- backgroundColor: (e.vars || e).palette.action.hover,
2843
- // Reset on touch devices, it doesn't add specificity
2844
- "@media (hover: none)": {
2845
- backgroundColor: "transparent"
2846
- }
2847
- },
2848
- [`&.${H.disabled}`]: {
2849
- opacity: (e.vars || e).palette.action.disabledOpacity,
2850
- backgroundColor: "transparent"
2851
- },
2852
- [`&.${H.focused}`]: {
2853
- backgroundColor: (e.vars || e).palette.action.focus
2854
- },
2855
- [`&.${H.selected}`]: {
2856
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : ce(e.palette.primary.main, e.palette.action.selectedOpacity),
2857
- "&:hover": {
2858
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))` : ce(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.hoverOpacity),
2859
- // Reset on touch devices, it doesn't add specificity
2860
- "@media (hover: none)": {
2861
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : ce(e.palette.primary.main, e.palette.action.selectedOpacity)
2862
- }
2863
- },
2864
- [`&.${H.focused}`]: {
2865
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))` : ce(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.focusOpacity)
2866
- }
2867
- },
2868
- [`& .${H.iconContainer}`]: {
2869
- width: 16,
2870
- display: "flex",
2871
- flexShrink: 0,
2872
- justifyContent: "center",
2873
- "& svg": {
2874
- fontSize: 18
2875
- }
2876
- },
2877
- [`& .${H.label}`]: x({
2878
- width: "100%",
2879
- boxSizing: "border-box",
2880
- // prevent width + padding to overflow
2881
- // fixes overflow - see https://github.com/mui/material-ui/issues/27372
2882
- minWidth: 0,
2883
- position: "relative"
2884
- }, e.typography.body1),
2885
- [`& .${H.checkbox}`]: {
2886
- padding: 0
2887
- },
2888
- variants: [{
2889
- props: {
2890
- indentationAtItemLevel: !0
2891
- },
2892
- style: {
2893
- paddingLeft: `calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`
2894
- }
2895
- }]
2896
- })), ir = B(Le, {
2897
- name: "MuiTreeItem",
2898
- slot: "GroupTransition",
2899
- overridesResolver: (e, t) => t.groupTransition,
2900
- shouldForwardProp: (e) => dt(e) && e !== "indentationAtItemLevel"
2901
- })({
2902
- margin: 0,
2903
- padding: 0,
2904
- paddingLeft: "var(--TreeView-itemChildrenIndentation)",
2905
- variants: [{
2906
- props: {
2907
- indentationAtItemLevel: !0
2908
- },
2909
- style: {
2910
- paddingLeft: 0
2911
- }
2912
- }]
2913
- }), Ft = /* @__PURE__ */ E.forwardRef(function(t, n) {
2914
- var He, Ge, Ye, Qe;
2915
- const {
2916
- icons: o,
2917
- runItemPlugins: i,
2918
- items: {
2919
- disabledItemsFocusable: p,
2920
- indentationAtItemLevel: c
2921
- },
2922
- selection: {
2923
- disableSelection: s
2924
- },
2925
- expansion: {
2926
- expansionTrigger: d
2927
- },
2928
- treeId: u,
2929
- instance: l
2930
- } = se(), a = E.useContext(ie), f = tr({
2931
- props: t,
2932
- name: "MuiTreeItem"
2933
- }), {
2934
- children: g,
2935
- className: b,
2936
- slots: m,
2937
- slotProps: I,
2938
- ContentComponent: h = qe,
2939
- ContentProps: y,
2940
- itemId: C,
2941
- id: k,
2942
- label: w,
2943
- onClick: R,
2944
- onMouseDown: S,
2945
- onBlur: z,
2946
- onKeyDown: K
2947
- } = f, D = X(f, Yo), {
2948
- expanded: P,
2949
- focused: U,
2950
- selected: _,
2951
- disabled: A,
2952
- editing: $,
2953
- handleExpansion: Q,
2954
- handleCancelItemLabelEditing: F,
2955
- handleSaveItemLabel: q
2956
- } = $t(C);
2957
- process.env.NODE_ENV !== "production" && (f.ContentComponent && Ce(["MUI X: The ContentComponent prop of the TreeItem component is deprecated and will be removed in the next major release.", "You can use the new TreeItem2 component or the new useTreeItem2 hook to customize the rendering of the content.", "For more detail, see https://mui.com/x/react-tree-view/tree-item-customization/."]), f.ContentProps && Ce(["MUI X: The ContentProps prop of the TreeItem component is deprecated and will be removed in the next major release.", "You can use the new TreeItem2 component or the new useTreeItem2 hook to customize the rendering of the content.", "For more detail, see https://mui.com/x/react-tree-view/tree-item-customization/."]));
2958
- const {
2959
- contentRef: O,
2960
- rootRef: W,
2961
- propsEnhancers: L
2962
- } = i(f), oe = E.useRef(null), ge = E.useRef(null), Me = pe(n, W, oe), Xe = pe(y == null ? void 0 : y.ref, O, ge), v = {
2963
- expandIcon: (m == null ? void 0 : m.expandIcon) ?? o.slots.expandIcon ?? Ho,
2964
- collapseIcon: (m == null ? void 0 : m.collapseIcon) ?? o.slots.collapseIcon ?? Go,
2965
- endIcon: (m == null ? void 0 : m.endIcon) ?? o.slots.endIcon,
2966
- icon: m == null ? void 0 : m.icon,
2967
- groupTransition: m == null ? void 0 : m.groupTransition
2968
- }, N = (M) => Array.isArray(M) ? M.length > 0 && M.some(N) : !!M, j = N(g), J = x({}, f, {
2969
- expanded: P,
2970
- focused: U,
2971
- selected: _,
2972
- disabled: A,
2973
- indentationAtItemLevel: c
2974
- }), V = nr(J), le = v.groupTransition ?? void 0, jt = ue({
2975
- elementType: le,
2976
- ownerState: {},
2977
- externalSlotProps: I == null ? void 0 : I.groupTransition,
2978
- additionalProps: x({
2979
- unmountOnExit: !0,
2980
- in: P,
2981
- component: "ul",
2982
- role: "group"
2983
- }, c ? {
2984
- indentationAtItemLevel: !0
2985
- } : {}),
2986
- className: V.groupTransition
2987
- }), zt = (M) => {
2988
- d === "iconContainer" && Q(M);
2989
- }, Se = P ? v.collapseIcon : v.expandIcon, _t = ue({
2990
- elementType: Se,
2991
- ownerState: {},
2992
- externalSlotProps: (M) => P ? x({}, Z(o.slotProps.collapseIcon, M), Z(I == null ? void 0 : I.collapseIcon, M)) : x({}, Z(o.slotProps.expandIcon, M), Z(I == null ? void 0 : I.expandIcon, M)),
2993
- additionalProps: {
2994
- onClick: zt
2995
- }
2996
- }), Bt = X(_t, Qo), Ut = j && Se ? /* @__PURE__ */ T(Se, x({}, Bt)) : null, ke = j ? void 0 : v.endIcon, Kt = ue({
2997
- elementType: ke,
2998
- ownerState: {},
2999
- externalSlotProps: (M) => j ? {} : x({}, Z(o.slotProps.endIcon, M), Z(I == null ? void 0 : I.endIcon, M))
3000
- }), qt = X(Kt, Zo), Xt = ke ? /* @__PURE__ */ T(ke, x({}, qt)) : null, Oe = v.icon, Wt = ue({
3001
- elementType: Oe,
3002
- ownerState: {},
3003
- externalSlotProps: I == null ? void 0 : I.icon
3004
- }), Jt = X(Wt, er), Ht = Oe ? /* @__PURE__ */ T(Oe, x({}, Jt)) : null;
3005
- let he;
3006
- _ ? he = !0 : s || A ? he = void 0 : he = !1;
3007
- function Gt(M) {
3008
- !U && (!A || p) && M.currentTarget === M.target && l.focusItem(M, C);
3009
- }
3010
- function Yt(M) {
3011
- var re, ae, Ze, et;
3012
- z == null || z(M), !($ || // 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
3013
- // 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
3014
- M.relatedTarget && $e(M.relatedTarget, oe.current) && (M.target && ((ae = (re = M.target) == null ? void 0 : re.dataset) == null ? void 0 : ae.element) === "labelInput" && $e(M.target, oe.current) || ((et = (Ze = M.relatedTarget) == null ? void 0 : Ze.dataset) == null ? void 0 : et.element) === "labelInput")) && l.removeFocusedItem();
3015
- }
3016
- const Qt = (M) => {
3017
- var re, ae;
3018
- K == null || K(M), ((ae = (re = M.target) == null ? void 0 : re.dataset) == null ? void 0 : ae.element) !== "labelInput" && l.handleItemKeyDown(M, C);
3019
- }, Zt = Te({
3020
- itemId: C,
3021
- treeId: u,
3022
- id: k
3023
- }), en = l.canItemBeTabbed(C) ? 0 : -1, be = {
3024
- rootRefObject: oe,
3025
- contentRefObject: ge,
3026
- interactions: {
3027
- handleSaveItemLabel: q,
3028
- handleCancelItemLabelEditing: F
3029
- }
3030
- }, tn = ((He = L.root) == null ? void 0 : He.call(L, x({}, be, {
3031
- externalEventHandlers: Ve(D)
3032
- }))) ?? {}, nn = ((Ge = L.content) == null ? void 0 : Ge.call(L, x({}, be, {
3033
- externalEventHandlers: Ve(y)
3034
- }))) ?? {}, We = ((Ye = L.dragAndDropOverlay) == null ? void 0 : Ye.call(L, x({}, be, {
3035
- externalEventHandlers: {}
3036
- }))) ?? {}, Je = ((Qe = L.labelInput) == null ? void 0 : Qe.call(L, x({}, be, {
3037
- externalEventHandlers: {}
3038
- }))) ?? {};
3039
- return /* @__PURE__ */ T(At, {
3040
- itemId: C,
3041
- children: /* @__PURE__ */ we(or, x({
3042
- className: te(V.root, b),
3043
- role: "treeitem",
3044
- "aria-expanded": j ? P : void 0,
3045
- "aria-selected": he,
3046
- "aria-disabled": A || void 0,
3047
- id: Zt,
3048
- tabIndex: en
3049
- }, D, {
3050
- ownerState: J,
3051
- onFocus: Gt,
3052
- onBlur: Yt,
3053
- onKeyDown: Qt,
3054
- ref: Me,
3055
- style: c ? x({}, D.style, {
3056
- "--TreeView-itemDepth": typeof a == "function" ? a(C) : a
3057
- }) : D.style
3058
- }, tn, {
3059
- children: [/* @__PURE__ */ T(rr, x({
3060
- as: h,
3061
- classes: {
3062
- root: V.content,
3063
- expanded: V.expanded,
3064
- selected: V.selected,
3065
- focused: V.focused,
3066
- disabled: V.disabled,
3067
- editable: V.editable,
3068
- editing: V.editing,
3069
- iconContainer: V.iconContainer,
3070
- label: V.label,
3071
- labelInput: V.labelInput,
3072
- checkbox: V.checkbox
3073
- },
3074
- label: w,
3075
- itemId: C,
3076
- onClick: R,
3077
- onMouseDown: S,
3078
- icon: Ht,
3079
- expansionIcon: Ut,
3080
- displayIcon: Xt,
3081
- ownerState: J
3082
- }, y, nn, We.action == null ? {} : {
3083
- dragAndDropOverlayProps: We
3084
- }, Je.value == null ? {} : {
3085
- labelInputProps: Je
3086
- }, {
3087
- ref: Xe
3088
- })), g && /* @__PURE__ */ T(ir, x({
3089
- as: le
3090
- }, jt, {
3091
- children: g
3092
- }))]
3093
- }))
3094
- });
3095
- });
3096
- process.env.NODE_ENV !== "production" && (Ft.propTypes = {
3097
- // ----------------------------- Warning --------------------------------
3098
- // | These PropTypes are generated from the TypeScript type definitions |
3099
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
3100
- // ----------------------------------------------------------------------
3101
- /**
3102
- * The content of the component.
3103
- */
3104
- children: r.node,
3105
- /**
3106
- * Override or extend the styles applied to the component.
3107
- */
3108
- classes: r.object,
3109
- className: r.string,
3110
- /**
3111
- * The component used to render the content of the item.
3112
- * @deprecated Consider using the `<TreeItem2 />` component or the `useTreeItem2` hook instead. For more details, see https://mui.com/x/react-tree-view/tree-item-customization/.
3113
- * @default TreeItemContent
3114
- */
3115
- ContentComponent: Ko,
3116
- /**
3117
- * Props applied to ContentComponent.
3118
- * @deprecated Consider using the `<TreeItem2 />` component or the `useTreeItem2` hook instead. For more details, see https://mui.com/x/react-tree-view/tree-item-customization/.
3119
- */
3120
- ContentProps: r.object,
3121
- /**
3122
- * If `true`, the item is disabled.
3123
- * @default false
3124
- */
3125
- disabled: r.bool,
3126
- /**
3127
- * The id of the item.
3128
- */
3129
- itemId: r.string.isRequired,
3130
- /**
3131
- * The Tree Item label.
3132
- */
3133
- label: r.node,
3134
- /**
3135
- * This prop isn't supported.
3136
- * Use the `onItemFocus` callback on the tree if you need to monitor a item's focus.
3137
- */
3138
- onFocus: zo,
3139
- /**
3140
- * Callback fired when a key of the keyboard is pressed on the item.
3141
- */
3142
- onKeyDown: r.func,
3143
- /**
3144
- * The props used for each component slot.
3145
- * @default {}
3146
- */
3147
- slotProps: r.object,
3148
- /**
3149
- * Overridable component slots.
3150
- * @default {}
3151
- */
3152
- slots: r.object,
3153
- /**
3154
- * The system prop that allows defining system overrides as well as additional CSS styles.
3155
- */
3156
- sx: r.oneOfType([r.arrayOf(r.oneOfType([r.func, r.object, r.bool])), r.func, r.object])
3157
- });
3158
- const ur = ({
3159
- items: e,
3160
- handleCheck: t,
3161
- width: n = "250px",
3162
- height: o = "350px",
3163
- expanded: i
3164
- }) => /* @__PURE__ */ T(En, { width: n, height: o, children: /* @__PURE__ */ T(Vt, { expandedItems: i, children: Lt(e, t) }) }), Lt = (e, t) => e.map((n) => /* @__PURE__ */ on(sr, { ...n, key: n.id, handleCheck: t })), sr = ({
3165
- id: e,
3166
- checked: t,
3167
- children: n,
3168
- label: o,
3169
- handleCheck: i
3170
- }) => /* @__PURE__ */ T(
3171
- Ft,
3172
- {
3173
- itemId: e,
3174
- label: /* @__PURE__ */ we(xn, { flexDirection: "row", alignItems: "center", children: [
3175
- /* @__PURE__ */ T(Cn, { children: o }),
3176
- i && /* @__PURE__ */ T(
3177
- wn,
3178
- {
3179
- disableRipple: !0,
3180
- sx: { marginLeft: "auto" },
3181
- onClick: (p) => {
3182
- p.stopPropagation(), i(e, !t);
3183
- },
3184
- "data-testid": `toggle-visibility-${e}`,
3185
- children: t ? /* @__PURE__ */ T(Gn, { "data-testid": `visibility-icon-${e}` }) : /* @__PURE__ */ T(Yn, { "data-testid": `visibility-off-icon-${e}` })
3186
- }
3187
- )
3188
- ] }),
3189
- children: n.length > 0 && Lt(n, i)
3190
- }
3191
- );
3192
- export {
3193
- Le as C,
3194
- ft as F,
3195
- ur as T,
3196
- ce as a,
3197
- Mn as b,
3198
- It as c,
3199
- $n as u
3200
- };