@cgi-learning-hub/ui 1.4.0-dev.1742214247 → 1.4.0-dev.1742227742

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 (39) hide show
  1. package/dist/CustomTreeItem-DBgMgvLx.cjs +3 -0
  2. package/dist/CustomTreeItem-ca-TgHSV.js +1329 -0
  3. package/dist/Folder-DXybV_jP.js +8 -0
  4. package/dist/Folder-DiQqYwXI.cjs +1 -0
  5. package/dist/MoreVert-CxgmXooO.cjs +1 -0
  6. package/dist/MoreVert-rsN-POLa.js +8 -0
  7. package/dist/components/FolderCard/FolderCard.cjs.js +1 -0
  8. package/dist/components/FolderCard/FolderCard.d.ts +10 -0
  9. package/dist/components/FolderCard/FolderCard.es.js +78 -0
  10. package/dist/components/FolderCard/index.cjs.js +1 -0
  11. package/dist/components/FolderCard/index.d.ts +2 -0
  12. package/dist/components/FolderCard/index.es.js +4 -0
  13. package/dist/components/FolderCard/styles.cjs.js +1 -0
  14. package/dist/components/FolderCard/styles.d.ts +10 -0
  15. package/dist/components/FolderCard/styles.es.js +13 -0
  16. package/dist/components/FolderCard/types.cjs.js +1 -0
  17. package/dist/components/FolderCard/types.d.ts +11 -0
  18. package/dist/components/FolderCard/types.es.js +14 -0
  19. package/dist/components/ResourceCard/ResourceCard.cjs.js +1 -1
  20. package/dist/components/ResourceCard/ResourceCard.es.js +16 -18
  21. package/dist/components/TreeView/TreeView.cjs.js +4 -4
  22. package/dist/components/TreeView/TreeView.es.js +21 -22
  23. package/dist/components/TreeView/components/CustomTreeItem.cjs.js +1 -1
  24. package/dist/components/TreeView/components/CustomTreeItem.es.js +1 -1
  25. package/dist/components/TreeView/utils.cjs.js +1 -1
  26. package/dist/components/TreeView/utils.es.js +26 -27
  27. package/dist/components/index.cjs.js +1 -1
  28. package/dist/components/index.d.ts +2 -0
  29. package/dist/components/index.es.js +266 -260
  30. package/dist/components/stories/FolderCard.stories.cjs.js +1 -0
  31. package/dist/components/stories/FolderCard.stories.d.ts +7 -0
  32. package/dist/components/stories/FolderCard.stories.es.js +71 -0
  33. package/dist/index.cjs.js +1 -1
  34. package/dist/index.es.js +266 -260
  35. package/package.json +1 -1
  36. package/dist/Collapse-Bvxtq7n-.cjs +0 -1
  37. package/dist/Collapse-CcMCOZ3q.js +0 -334
  38. package/dist/CustomTreeItem-CG7mGHC9.cjs +0 -3
  39. package/dist/CustomTreeItem-PTf-e74x.js +0 -1003
@@ -1,1003 +0,0 @@
1
- import { jsx as x, jsxs as W } from "react/jsx-runtime";
2
- import { c as X } from "./createSvgIcon-B62eln-G.js";
3
- import { B as Pe } from "./Box-GMNejc_m.js";
4
- import { _ as u } from "./ButtonBase-CU1npQuI.js";
5
- import * as E from "react";
6
- import { w as Re } from "./warning-C8W811fV.js";
7
- import { u as le } from "./useForkRef-C_4o__cU.js";
8
- import { e as S, r as de } from "./resolveComponentProps-CIdMNno4.js";
9
- import { treeContentStyle as Ee, arrowContainerStyle as Oe, expandedGroupStyle as Se } from "./components/TreeView/style.es.js";
10
- import { getIconComponent as De } from "./components/TreeView/utils.es.js";
11
- import { n as B, P as y, G as ke, H as Me, I as Le } from "./generateUtilityClasses-EXBFO7eY.js";
12
- import { a as ue } from "./TransitionGroupContext-DbLioz_6.js";
13
- import { u as Ne } from "./useThemeProps-v-SfXuGn.js";
14
- import { s as k, f as Y, c as Ve } from "./DefaultPropsProvider-CQixa6JQ.js";
15
- import { C as Ae } from "./Collapse-CcMCOZ3q.js";
16
- import { C as Be } from "./Checkbox-CtRSDqOe.js";
17
- import { u as Ke } from "./unsupportedProp-BuVD30Gh.js";
18
- import { u as D } from "./useSlotProps-U2Iu6E0j.js";
19
- const $e = X(/* @__PURE__ */ x("path", {
20
- d: "M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"
21
- }), "KeyboardArrowDown"), Fe = X(/* @__PURE__ */ x("path", {
22
- d: "M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"
23
- }), "KeyboardArrowRight");
24
- function je(e) {
25
- return Ne;
26
- }
27
- let ce = 0;
28
- const kt = () => (ce += 1, `mui-tree-view-${ce}`), qe = ({
29
- id: e,
30
- treeId: o = "",
31
- itemId: t
32
- }) => e ?? `${o}-${t}`, be = /* @__PURE__ */ E.createContext(null);
33
- process.env.NODE_ENV !== "production" && (be.displayName = "TreeViewContext");
34
- const K = () => {
35
- const e = E.useContext(be);
36
- if (e == null)
37
- 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(`
38
- `));
39
- return e;
40
- }, ge = /* @__PURE__ */ E.createContext(() => -1);
41
- process.env.NODE_ENV !== "production" && (ge.displayName = "TreeViewItemDepthContext");
42
- const me = (e, o) => {
43
- let t = o.length - 1;
44
- for (; t >= 0 && !e.isItemNavigable(o[t]); )
45
- t -= 1;
46
- if (t !== -1)
47
- return o[t];
48
- }, ze = (e, o) => {
49
- const t = e.getItemMeta(o), i = e.getItemOrderedChildrenIds(t.parentId), p = e.getItemIndex(o);
50
- if (p === 0)
51
- return t.parentId;
52
- let l = p - 1;
53
- for (; !e.isItemNavigable(i[l]) && l >= 0; )
54
- l -= 1;
55
- if (l === -1)
56
- return t.parentId == null ? null : ze(e, t.parentId);
57
- let b = i[l], s = me(e, e.getItemOrderedChildrenIds(b));
58
- for (; e.isItemExpanded(b) && s != null; )
59
- b = s, s = e.getItemOrderedChildrenIds(b).find(e.isItemNavigable);
60
- return b;
61
- }, _e = (e, o) => {
62
- if (e.isItemExpanded(o)) {
63
- const i = e.getItemOrderedChildrenIds(o).find(e.isItemNavigable);
64
- if (i != null)
65
- return i;
66
- }
67
- let t = e.getItemMeta(o);
68
- for (; t != null; ) {
69
- const i = e.getItemOrderedChildrenIds(t.parentId), p = e.getItemIndex(t.id);
70
- if (p < i.length - 1) {
71
- let l = p + 1;
72
- for (; !e.isItemNavigable(i[l]) && l < i.length - 1; )
73
- l += 1;
74
- if (e.isItemNavigable(i[l]))
75
- return i[l];
76
- }
77
- t = e.getItemMeta(t.parentId);
78
- }
79
- return null;
80
- }, Mt = (e) => {
81
- let o = null;
82
- for (; o == null || e.isItemExpanded(o); ) {
83
- const t = e.getItemOrderedChildrenIds(o), i = me(e, t);
84
- if (i == null)
85
- return o;
86
- o = i;
87
- }
88
- return o;
89
- }, Ue = (e) => e.getItemOrderedChildrenIds(null).find(e.isItemNavigable), Ge = (e, o, t) => {
90
- if (o === t)
91
- return [o, t];
92
- const i = e.getItemMeta(o), p = e.getItemMeta(t);
93
- if (i.parentId === p.id || p.parentId === i.id)
94
- return p.parentId === i.id ? [i.id, p.id] : [p.id, i.id];
95
- const l = [i.id], b = [p.id];
96
- let s = i.parentId, g = p.parentId, c = b.indexOf(s) !== -1, I = l.indexOf(g) !== -1, m = !0, h = !0;
97
- for (; !I && !c; )
98
- m && (l.push(s), c = b.indexOf(s) !== -1, m = s !== null, !c && m && (s = e.getItemMeta(s).parentId)), h && !c && (b.push(g), I = l.indexOf(g) !== -1, h = g !== null, !I && h && (g = e.getItemMeta(g).parentId));
99
- const r = c ? s : g, f = e.getItemOrderedChildrenIds(r), R = l[l.indexOf(r) - 1], V = b[b.indexOf(r) - 1];
100
- return f.indexOf(R) < f.indexOf(V) ? [o, t] : [t, o];
101
- }, Lt = (e, o, t) => {
102
- const i = (g) => {
103
- if (e.isItemExpandable(g) && e.isItemExpanded(g))
104
- return e.getItemOrderedChildrenIds(g)[0];
105
- let c = e.getItemMeta(g);
106
- for (; c != null; ) {
107
- const I = e.getItemOrderedChildrenIds(c.parentId), m = e.getItemIndex(c.id);
108
- if (m < I.length - 1)
109
- return I[m + 1];
110
- c = e.getItemMeta(c.parentId);
111
- }
112
- throw new Error("Invalid range");
113
- }, [p, l] = Ge(e, o, t), b = [p];
114
- let s = p;
115
- for (; s !== l; )
116
- s = i(s), e.isItemDisabled(s) || b.push(s);
117
- return b;
118
- }, Nt = (e) => {
119
- let o = Ue(e);
120
- const t = [];
121
- for (; o != null; )
122
- t.push(o), o = _e(e, o);
123
- return t;
124
- }, pe = (e, o) => o !== e.closest('*[role="treeitem"]'), ne = (e, o) => e.getAvailablePlugins().has(o), We = ({
125
- props: e
126
- }) => {
127
- const {
128
- instance: o
129
- } = K(), {
130
- label: t,
131
- itemId: i
132
- } = e, [p, l] = E.useState(t), b = o.isItemBeingEdited(i);
133
- return E.useEffect(() => {
134
- b || l(t);
135
- }, [b, t]), {
136
- propsEnhancers: {
137
- labelInput: ({
138
- externalEventHandlers: s,
139
- interactions: g
140
- }) => o.isItemEditable(i) ? {
141
- value: p ?? "",
142
- "data-element": "labelInput",
143
- onChange: (r) => {
144
- var f;
145
- (f = s.onChange) == null || f.call(s, r), l(r.target.value);
146
- },
147
- onKeyDown: (r) => {
148
- var R;
149
- if ((R = s.onKeyDown) == null || R.call(s, r), r.defaultMuiPrevented)
150
- return;
151
- const f = r.target;
152
- r.key === "Enter" && f.value ? g.handleSaveItemLabel(r, f.value) : r.key === "Escape" && g.handleCancelItemLabelEditing(r);
153
- },
154
- onBlur: (r) => {
155
- var f;
156
- (f = s.onBlur) == null || f.call(s, r), !r.defaultMuiPrevented && r.target.value && g.handleSaveItemLabel(r, r.target.value);
157
- },
158
- autoFocus: !0,
159
- type: "text"
160
- } : {}
161
- }
162
- };
163
- }, M = ({
164
- instance: e,
165
- state: o,
166
- setState: t,
167
- params: i
168
- }) => {
169
- const p = E.useRef(o.editedItemId), l = (m) => p.current === m, b = (m) => {
170
- t((h) => u({}, h, {
171
- editedItemId: m
172
- })), p.current = m;
173
- }, s = (m) => m === o.editedItemId, g = !!i.isItemEditable, c = (m) => {
174
- if (m == null || !g)
175
- return !1;
176
- const h = e.getItem(m);
177
- return h ? typeof i.isItemEditable == "function" ? i.isItemEditable(h) : !!i.isItemEditable : !1;
178
- }, I = (m, h) => {
179
- if (!h)
180
- throw new Error(["MUI X: The Tree View component requires all items to have a `label` property.", "The label of an item cannot be empty.", m].join(`
181
- `));
182
- t((r) => {
183
- const f = r.items.itemMetaMap[m];
184
- return f.label !== h ? u({}, r, {
185
- items: u({}, r.items, {
186
- itemMetaMap: u({}, r.items.itemMetaMap, {
187
- [m]: u({}, f, {
188
- label: h
189
- })
190
- })
191
- })
192
- }) : r;
193
- }), i.onItemLabelChange && i.onItemLabelChange(m, h);
194
- };
195
- return {
196
- instance: {
197
- setEditedItemId: b,
198
- isItemBeingEdited: s,
199
- updateItemLabel: I,
200
- isItemEditable: c,
201
- isTreeViewEditable: g,
202
- isItemBeingEditedRef: l
203
- },
204
- publicAPI: {
205
- updateItemLabel: I
206
- }
207
- };
208
- };
209
- M.itemPlugin = We;
210
- M.getDefaultizedParams = ({
211
- params: e,
212
- experimentalFeatures: o
213
- }) => {
214
- const t = o == null ? void 0 : o.labelEditing;
215
- return process.env.NODE_ENV !== "production" && e.isItemEditable && !t && Re(["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/"]), u({}, e, {
216
- isItemEditable: t ? e.isItemEditable ?? !1 : !1
217
- });
218
- };
219
- M.getInitialState = () => ({
220
- editedItemId: null
221
- });
222
- M.params = {
223
- onItemLabelChange: !0,
224
- isItemEditable: !0
225
- };
226
- const Xe = k("div", {
227
- name: "MuiTreeItem2DragAndDropOverlay",
228
- slot: "Root",
229
- overridesResolver: (e, o) => o.root,
230
- shouldForwardProp: (e) => Y(e) && e !== "action"
231
- })(({
232
- theme: e
233
- }) => ({
234
- position: "absolute",
235
- left: 0,
236
- display: "flex",
237
- top: 0,
238
- bottom: 0,
239
- right: 0,
240
- pointerEvents: "none",
241
- variants: [{
242
- props: {
243
- action: "make-child"
244
- },
245
- style: {
246
- marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
247
- borderRadius: e.shape.borderRadius,
248
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.darkChannel} / ${e.vars.palette.action.focusOpacity})` : B(e.palette.primary.dark, e.palette.action.focusOpacity)
249
- }
250
- }, {
251
- props: {
252
- action: "reorder-above"
253
- },
254
- style: {
255
- marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
256
- borderTop: `1px solid ${(e.vars || e).palette.action.active}`
257
- }
258
- }, {
259
- props: {
260
- action: "reorder-below"
261
- },
262
- style: {
263
- marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
264
- borderBottom: `1px solid ${(e.vars || e).palette.action.active}`
265
- }
266
- }, {
267
- props: {
268
- action: "move-to-parent"
269
- },
270
- style: {
271
- marginLeft: "calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",
272
- borderBottom: `1px solid ${(e.vars || e).palette.action.active}`
273
- }
274
- }]
275
- }));
276
- function Ie(e) {
277
- return e.action == null ? null : /* @__PURE__ */ x(Xe, u({}, e));
278
- }
279
- process.env.NODE_ENV !== "production" && (Ie.propTypes = {
280
- // ----------------------------- Warning --------------------------------
281
- // | These PropTypes are generated from the TypeScript type definitions |
282
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
283
- // ----------------------------------------------------------------------
284
- action: y.oneOf(["make-child", "move-to-parent", "reorder-above", "reorder-below"]),
285
- style: y.object
286
- });
287
- const Ye = k("input", {
288
- name: "MuiTreeItem2",
289
- slot: "LabelInput",
290
- overridesResolver: (e, o) => o.labelInput
291
- })(({
292
- theme: e
293
- }) => u({}, e.typography.body1, {
294
- width: "100%",
295
- backgroundColor: e.palette.background.paper,
296
- borderRadius: e.shape.borderRadius,
297
- border: "none",
298
- padding: "0 2px",
299
- boxSizing: "border-box",
300
- "&:focus": {
301
- outline: `1px solid ${e.palette.primary.main}`
302
- }
303
- }));
304
- function Je(e) {
305
- return Me("MuiTreeItem", e);
306
- }
307
- const Vt = ke("MuiTreeItem", ["root", "groupTransition", "content", "expanded", "selected", "focused", "disabled", "iconContainer", "label", "checkbox", "labelInput", "editable", "editing", "dragAndDropOverlay"]), Qe = X(/* @__PURE__ */ x("path", {
308
- d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"
309
- }), "TreeViewExpandIcon"), Ze = X(/* @__PURE__ */ x("path", {
310
- d: "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
311
- }), "TreeViewCollapseIcon");
312
- function re(e) {
313
- const {
314
- children: o,
315
- itemId: t
316
- } = e, {
317
- wrapItem: i,
318
- instance: p
319
- } = K();
320
- return i({
321
- children: o,
322
- itemId: t,
323
- instance: p
324
- });
325
- }
326
- re.propTypes = {
327
- // ----------------------------- Warning --------------------------------
328
- // | These PropTypes are generated from the TypeScript type definitions |
329
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
330
- // ----------------------------------------------------------------------
331
- children: y.node,
332
- itemId: y.string.isRequired
333
- };
334
- const fe = (e) => Array.isArray(e) ? e.length > 0 && e.some(fe) : !!e, He = ({
335
- itemId: e,
336
- children: o
337
- }) => {
338
- const {
339
- instance: t,
340
- selection: {
341
- multiSelect: i
342
- },
343
- publicAPI: p
344
- } = K(), l = {
345
- expandable: fe(o),
346
- expanded: t.isItemExpanded(e),
347
- focused: t.isItemFocused(e),
348
- selected: t.isItemSelected(e),
349
- disabled: t.isItemDisabled(e),
350
- editing: t != null && t.isItemBeingEdited ? t == null ? void 0 : t.isItemBeingEdited(e) : !1,
351
- editable: t.isItemEditable ? t.isItemEditable(e) : !1
352
- }, b = (r) => {
353
- if (l.disabled)
354
- return;
355
- l.focused || t.focusItem(r, e);
356
- const f = i && (r.shiftKey || r.ctrlKey || r.metaKey);
357
- l.expandable && !(f && t.isItemExpanded(e)) && t.toggleItemExpansion(r, e);
358
- }, s = (r) => {
359
- if (l.disabled)
360
- return;
361
- l.focused || t.focusItem(r, e), i && (r.shiftKey || r.ctrlKey || r.metaKey) ? r.shiftKey ? t.expandSelectionRange(r, e) : t.selectItem({
362
- event: r,
363
- itemId: e,
364
- keepExistingSelection: !0
365
- }) : t.selectItem({
366
- event: r,
367
- itemId: e,
368
- shouldBeSelected: !0
369
- });
370
- }, g = (r) => {
371
- const f = r.nativeEvent.shiftKey;
372
- i && f ? t.expandSelectionRange(r, e) : t.selectItem({
373
- event: r,
374
- itemId: e,
375
- keepExistingSelection: i,
376
- shouldBeSelected: r.target.checked
377
- });
378
- }, c = () => {
379
- ne(t, M) && t.isItemEditable(e) && (t.isItemBeingEdited(e) ? t.setEditedItemId(null) : t.setEditedItemId(e));
380
- };
381
- return {
382
- interactions: {
383
- handleExpansion: b,
384
- handleSelection: s,
385
- handleCheckboxSelection: g,
386
- toggleItemEditing: c,
387
- handleSaveItemLabel: (r, f) => {
388
- ne(t, M) && t.isItemBeingEditedRef(e) && (t.updateItemLabel(e, f), c(), t.focusItem(r, e));
389
- },
390
- handleCancelItemLabelEditing: (r) => {
391
- ne(t, M) && t.isItemBeingEditedRef(e) && (c(), t.focusItem(r, e));
392
- }
393
- },
394
- status: l,
395
- publicAPI: p
396
- };
397
- }, et = (e) => {
398
- const {
399
- runItemPlugins: o,
400
- items: {
401
- onItemClick: t,
402
- disabledItemsFocusable: i,
403
- indentationAtItemLevel: p
404
- },
405
- selection: {
406
- disableSelection: l,
407
- checkboxSelection: b
408
- },
409
- expansion: {
410
- expansionTrigger: s
411
- },
412
- treeId: g,
413
- instance: c,
414
- publicAPI: I
415
- } = K(), m = E.useContext(ge), {
416
- id: h,
417
- itemId: r,
418
- label: f,
419
- children: R,
420
- rootRef: V
421
- } = e, {
422
- rootRef: J,
423
- contentRef: Q,
424
- propsEnhancers: P
425
- } = o(e), {
426
- interactions: w,
427
- status: T
428
- } = He({
429
- itemId: r,
430
- children: R
431
- }), v = E.useRef(null), L = E.useRef(null), $ = le(V, J, v), F = le(Q, L), j = E.useRef(null), q = qe({
432
- itemId: r,
433
- treeId: g,
434
- id: h
435
- }), Z = c.canItemBeTabbed(r) ? 0 : -1, N = {
436
- rootRefObject: v,
437
- contentRefObject: L,
438
- interactions: w
439
- }, H = (a) => (n) => {
440
- var C;
441
- if ((C = a.onFocus) == null || C.call(a, n), n.defaultMuiPrevented)
442
- return;
443
- const d = !T.disabled || i;
444
- !T.focused && d && n.currentTarget === n.target && c.focusItem(n, r);
445
- }, z = (a) => (n) => {
446
- var C, O, A, ae, se;
447
- if ((C = a.onBlur) == null || C.call(a, n), n.defaultMuiPrevented)
448
- return;
449
- const d = c.getItemDOMElement(r);
450
- T.editing || // 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
451
- // 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
452
- n.relatedTarget && pe(n.relatedTarget, d) && (n.target && ((A = (O = n.target) == null ? void 0 : O.dataset) == null ? void 0 : A.element) === "labelInput" && pe(n.target, d) || ((se = (ae = n.relatedTarget) == null ? void 0 : ae.dataset) == null ? void 0 : se.element) === "labelInput") || c.removeFocusedItem();
453
- }, ee = (a) => (n) => {
454
- var d, C, O;
455
- (d = a.onKeyDown) == null || d.call(a, n), !(n.defaultMuiPrevented || ((O = (C = n.target) == null ? void 0 : C.dataset) == null ? void 0 : O.element) === "labelInput") && c.handleItemKeyDown(n, r);
456
- }, _ = (a) => (n) => {
457
- var d;
458
- (d = a.onDoubleClick) == null || d.call(a, n), !n.defaultMuiPrevented && w.toggleItemEditing();
459
- }, te = (a) => (n) => {
460
- var d, C;
461
- (d = a.onClick) == null || d.call(a, n), t == null || t(n, r), !(n.defaultMuiPrevented || (C = j.current) != null && C.contains(n.target)) && (s === "content" && w.handleExpansion(n), b || w.handleSelection(n));
462
- }, U = (a) => (n) => {
463
- var d;
464
- (d = a.onMouseDown) == null || d.call(a, n), !n.defaultMuiPrevented && (n.shiftKey || n.ctrlKey || n.metaKey || T.disabled) && n.preventDefault();
465
- }, oe = (a) => (n) => {
466
- var d;
467
- (d = a.onChange) == null || d.call(a, n), !n.defaultMuiPrevented && (l || T.disabled || w.handleCheckboxSelection(n));
468
- }, G = (a) => (n) => {
469
- var d;
470
- (d = a.onClick) == null || d.call(a, n), !n.defaultMuiPrevented && s === "iconContainer" && w.handleExpansion(n);
471
- };
472
- return {
473
- getRootProps: (a = {}) => {
474
- var A;
475
- const n = u({}, S(e), S(a));
476
- let d;
477
- T.selected ? d = !0 : l || T.disabled ? d = void 0 : d = !1;
478
- const C = u({}, n, {
479
- ref: $,
480
- role: "treeitem",
481
- tabIndex: Z,
482
- id: q,
483
- "aria-expanded": T.expandable ? T.expanded : void 0,
484
- "aria-selected": d,
485
- "aria-disabled": T.disabled || void 0
486
- }, a, {
487
- onFocus: H(n),
488
- onBlur: z(n),
489
- onKeyDown: ee(n)
490
- });
491
- p && (C.style = {
492
- "--TreeView-itemDepth": typeof m == "function" ? m(r) : m
493
- });
494
- const O = ((A = P.root) == null ? void 0 : A.call(P, u({}, N, {
495
- externalEventHandlers: n
496
- }))) ?? {};
497
- return u({}, C, O);
498
- },
499
- getContentProps: (a = {}) => {
500
- var O;
501
- const n = S(a), d = u({}, n, a, {
502
- ref: F,
503
- onClick: te(n),
504
- onMouseDown: U(n),
505
- status: T
506
- });
507
- p && (d.indentationAtItemLevel = !0);
508
- const C = ((O = P.content) == null ? void 0 : O.call(P, u({}, N, {
509
- externalEventHandlers: n
510
- }))) ?? {};
511
- return u({}, d, C);
512
- },
513
- getGroupTransitionProps: (a = {}) => {
514
- const n = S(a), d = u({}, n, {
515
- unmountOnExit: !0,
516
- component: "ul",
517
- role: "group",
518
- in: T.expanded,
519
- children: R
520
- }, a);
521
- return p && (d.indentationAtItemLevel = !0), d;
522
- },
523
- getIconContainerProps: (a = {}) => {
524
- const n = S(a);
525
- return u({}, n, a, {
526
- onClick: G(n)
527
- });
528
- },
529
- getCheckboxProps: (a = {}) => {
530
- const n = S(a);
531
- return u({}, n, {
532
- visible: b,
533
- ref: j,
534
- checked: T.selected,
535
- disabled: l || T.disabled,
536
- tabIndex: -1
537
- }, a, {
538
- onChange: oe(n)
539
- });
540
- },
541
- getLabelProps: (a = {}) => {
542
- const n = u({}, S(a)), d = u({}, n, {
543
- children: f
544
- }, a, {
545
- onDoubleClick: _(n)
546
- });
547
- return c.isTreeViewEditable && (d.editable = T.editable), d;
548
- },
549
- getLabelInputProps: (a = {}) => {
550
- var C;
551
- const n = S(a), d = ((C = P.labelInput) == null ? void 0 : C.call(P, {
552
- rootRefObject: v,
553
- contentRefObject: L,
554
- externalEventHandlers: n,
555
- interactions: w
556
- })) ?? {};
557
- return u({}, a, d);
558
- },
559
- getDragAndDropOverlayProps: (a = {}) => {
560
- var C;
561
- const n = S(a), d = ((C = P.dragAndDropOverlay) == null ? void 0 : C.call(P, u({}, N, {
562
- externalEventHandlers: n
563
- }))) ?? {};
564
- return u({}, a, d);
565
- },
566
- rootRef: $,
567
- status: T,
568
- publicAPI: I
569
- };
570
- }, ye = et;
571
- function xe(e) {
572
- const {
573
- slots: o,
574
- slotProps: t,
575
- status: i
576
- } = e, p = K(), l = u({}, p.icons.slots, {
577
- expandIcon: p.icons.slots.expandIcon ?? Qe,
578
- collapseIcon: p.icons.slots.collapseIcon ?? Ze
579
- }), b = p.icons.slotProps;
580
- let s;
581
- o != null && o.icon ? s = "icon" : i.expandable ? i.expanded ? s = "collapseIcon" : s = "expandIcon" : s = "endIcon";
582
- const g = (o == null ? void 0 : o[s]) ?? l[s], c = D({
583
- elementType: g,
584
- externalSlotProps: (I) => u({}, de(b[s], I), de(t == null ? void 0 : t[s], I)),
585
- // TODO: Add proper ownerState
586
- ownerState: {}
587
- });
588
- return g ? /* @__PURE__ */ x(g, u({}, c)) : null;
589
- }
590
- process.env.NODE_ENV !== "production" && (xe.propTypes = {
591
- // ----------------------------- Warning --------------------------------
592
- // | These PropTypes are generated from the TypeScript type definitions |
593
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
594
- // ----------------------------------------------------------------------
595
- /**
596
- * The props used for each component slot.
597
- * @default {}
598
- */
599
- slotProps: y.object,
600
- /**
601
- * Overridable component slots.
602
- * @default {}
603
- */
604
- slots: y.object,
605
- status: y.shape({
606
- disabled: y.bool.isRequired,
607
- editable: y.bool.isRequired,
608
- editing: y.bool.isRequired,
609
- expandable: y.bool.isRequired,
610
- expanded: y.bool.isRequired,
611
- focused: y.bool.isRequired,
612
- selected: y.bool.isRequired
613
- }).isRequired
614
- });
615
- const tt = ["visible"], ot = ["id", "itemId", "label", "disabled", "children", "slots", "slotProps"], nt = je(), Ce = k("li", {
616
- name: "MuiTreeItem2",
617
- slot: "Root",
618
- overridesResolver: (e, o) => o.root
619
- })({
620
- listStyle: "none",
621
- margin: 0,
622
- padding: 0,
623
- outline: 0
624
- }), he = k("div", {
625
- name: "MuiTreeItem2",
626
- slot: "Content",
627
- overridesResolver: (e, o) => o.content,
628
- shouldForwardProp: (e) => Y(e) && e !== "status" && e !== "indentationAtItemLevel"
629
- })(({
630
- theme: e
631
- }) => ({
632
- padding: e.spacing(0.5, 1),
633
- borderRadius: e.shape.borderRadius,
634
- width: "100%",
635
- boxSizing: "border-box",
636
- // prevent width + padding to overflow
637
- position: "relative",
638
- display: "flex",
639
- alignItems: "center",
640
- gap: e.spacing(1),
641
- cursor: "pointer",
642
- WebkitTapHighlightColor: "transparent",
643
- "&:hover": {
644
- backgroundColor: (e.vars || e).palette.action.hover,
645
- // Reset on touch devices, it doesn't add specificity
646
- "@media (hover: none)": {
647
- backgroundColor: "transparent"
648
- }
649
- },
650
- variants: [{
651
- props: {
652
- indentationAtItemLevel: !0
653
- },
654
- style: {
655
- paddingLeft: `calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`
656
- }
657
- }, {
658
- props: ({
659
- status: o
660
- }) => o.disabled,
661
- style: {
662
- opacity: (e.vars || e).palette.action.disabledOpacity,
663
- backgroundColor: "transparent"
664
- }
665
- }, {
666
- props: ({
667
- status: o
668
- }) => o.focused,
669
- style: {
670
- backgroundColor: (e.vars || e).palette.action.focus
671
- }
672
- }, {
673
- props: ({
674
- status: o
675
- }) => o.selected,
676
- style: {
677
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : B(e.palette.primary.main, e.palette.action.selectedOpacity),
678
- "&:hover": {
679
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))` : B(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.hoverOpacity),
680
- // Reset on touch devices, it doesn't add specificity
681
- "@media (hover: none)": {
682
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})` : B(e.palette.primary.main, e.palette.action.selectedOpacity)
683
- }
684
- }
685
- }
686
- }, {
687
- props: ({
688
- status: o
689
- }) => o.selected && o.focused,
690
- style: {
691
- backgroundColor: e.vars ? `rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))` : B(e.palette.primary.main, e.palette.action.selectedOpacity + e.palette.action.focusOpacity)
692
- }
693
- }]
694
- })), Te = k("div", {
695
- name: "MuiTreeItem2",
696
- slot: "Label",
697
- overridesResolver: (e, o) => o.label,
698
- shouldForwardProp: (e) => Y(e) && e !== "editable"
699
- })(({
700
- theme: e
701
- }) => u({
702
- width: "100%",
703
- boxSizing: "border-box",
704
- // prevent width + padding to overflow
705
- // fixes overflow - see https://github.com/mui/material-ui/issues/27372
706
- minWidth: 0,
707
- position: "relative",
708
- overflow: "hidden"
709
- }, e.typography.body1, {
710
- variants: [{
711
- props: ({
712
- editable: o
713
- }) => o,
714
- style: {
715
- paddingLeft: "2px"
716
- }
717
- }]
718
- })), ve = k("div", {
719
- name: "MuiTreeItem2",
720
- slot: "IconContainer",
721
- overridesResolver: (e, o) => o.iconContainer
722
- })({
723
- width: 16,
724
- display: "flex",
725
- flexShrink: 0,
726
- justifyContent: "center",
727
- "& svg": {
728
- fontSize: 18
729
- }
730
- }), we = k(Ae, {
731
- name: "MuiTreeItem2",
732
- slot: "GroupTransition",
733
- overridesResolver: (e, o) => o.groupTransition,
734
- shouldForwardProp: (e) => Y(e) && e !== "indentationAtItemLevel"
735
- })({
736
- margin: 0,
737
- padding: 0,
738
- paddingLeft: "var(--TreeView-itemChildrenIndentation)",
739
- variants: [{
740
- props: {
741
- indentationAtItemLevel: !0
742
- },
743
- style: {
744
- paddingLeft: 0
745
- }
746
- }]
747
- }), rt = k(/* @__PURE__ */ E.forwardRef((e, o) => {
748
- const {
749
- visible: t
750
- } = e, i = ue(e, tt);
751
- return t ? /* @__PURE__ */ x(Be, u({}, i, {
752
- ref: o
753
- })) : null;
754
- }), {
755
- name: "MuiTreeItem2",
756
- slot: "Checkbox",
757
- overridesResolver: (e, o) => o.checkbox
758
- })({
759
- padding: 0
760
- }), it = (e) => {
761
- const {
762
- classes: o
763
- } = e;
764
- return Ve({
765
- root: ["root"],
766
- content: ["content"],
767
- expanded: ["expanded"],
768
- editing: ["editing"],
769
- editable: ["editable"],
770
- selected: ["selected"],
771
- focused: ["focused"],
772
- disabled: ["disabled"],
773
- iconContainer: ["iconContainer"],
774
- checkbox: ["checkbox"],
775
- label: ["label"],
776
- groupTransition: ["groupTransition"],
777
- labelInput: ["labelInput"],
778
- dragAndDropOverlay: ["dragAndDropOverlay"]
779
- }, Je, o);
780
- }, at = /* @__PURE__ */ E.forwardRef(function(o, t) {
781
- const i = nt({
782
- props: o,
783
- name: "MuiTreeItem2"
784
- }), {
785
- id: p,
786
- itemId: l,
787
- label: b,
788
- disabled: s,
789
- children: g,
790
- slots: c = {},
791
- slotProps: I = {}
792
- } = i, m = ue(i, ot), {
793
- getRootProps: h,
794
- getContentProps: r,
795
- getIconContainerProps: f,
796
- getCheckboxProps: R,
797
- getLabelProps: V,
798
- getGroupTransitionProps: J,
799
- getLabelInputProps: Q,
800
- getDragAndDropOverlayProps: P,
801
- status: w
802
- } = ye({
803
- id: p,
804
- itemId: l,
805
- children: g,
806
- label: b,
807
- disabled: s
808
- }), T = u({}, i, w), v = it(T), L = c.root ?? Ce, $ = D({
809
- elementType: L,
810
- getSlotProps: h,
811
- externalForwardedProps: m,
812
- externalSlotProps: I.root,
813
- additionalProps: {
814
- ref: t
815
- },
816
- ownerState: {},
817
- className: v.root
818
- }), F = c.content ?? he, j = D({
819
- elementType: F,
820
- getSlotProps: r,
821
- externalSlotProps: I.content,
822
- ownerState: {},
823
- className: Le(v.content, w.expanded && v.expanded, w.selected && v.selected, w.focused && v.focused, w.disabled && v.disabled, w.editing && v.editing, w.editable && v.editable)
824
- }), q = c.iconContainer ?? ve, Z = D({
825
- elementType: q,
826
- getSlotProps: f,
827
- externalSlotProps: I.iconContainer,
828
- ownerState: {},
829
- className: v.iconContainer
830
- }), N = c.label ?? Te, H = D({
831
- elementType: N,
832
- getSlotProps: V,
833
- externalSlotProps: I.label,
834
- ownerState: {},
835
- className: v.label
836
- }), z = c.checkbox ?? rt, ee = D({
837
- elementType: z,
838
- getSlotProps: R,
839
- externalSlotProps: I.checkbox,
840
- ownerState: {},
841
- className: v.checkbox
842
- }), _ = c.groupTransition ?? void 0, te = D({
843
- elementType: _,
844
- getSlotProps: J,
845
- externalSlotProps: I.groupTransition,
846
- ownerState: {},
847
- className: v.groupTransition
848
- }), U = c.labelInput ?? Ye, oe = D({
849
- elementType: U,
850
- getSlotProps: Q,
851
- externalSlotProps: I.labelInput,
852
- ownerState: {},
853
- className: v.labelInput
854
- }), G = c.dragAndDropOverlay ?? Ie, ie = D({
855
- elementType: G,
856
- getSlotProps: P,
857
- externalSlotProps: I.dragAndDropOverlay,
858
- ownerState: {},
859
- className: v.dragAndDropOverlay
860
- });
861
- return /* @__PURE__ */ x(re, {
862
- itemId: l,
863
- children: /* @__PURE__ */ W(L, u({}, $, {
864
- children: [/* @__PURE__ */ W(F, u({}, j, {
865
- children: [/* @__PURE__ */ x(q, u({}, Z, {
866
- children: /* @__PURE__ */ x(xe, {
867
- status: w,
868
- slots: c,
869
- slotProps: I
870
- })
871
- })), /* @__PURE__ */ x(z, u({}, ee)), w.editing ? /* @__PURE__ */ x(U, u({}, oe)) : /* @__PURE__ */ x(N, u({}, H)), /* @__PURE__ */ x(G, u({}, ie))]
872
- })), g && /* @__PURE__ */ x(we, u({
873
- as: _
874
- }, te))]
875
- }))
876
- });
877
- });
878
- process.env.NODE_ENV !== "production" && (at.propTypes = {
879
- // ----------------------------- Warning --------------------------------
880
- // | These PropTypes are generated from the TypeScript type definitions |
881
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
882
- // ----------------------------------------------------------------------
883
- /**
884
- * The content of the component.
885
- */
886
- children: y.node,
887
- /**
888
- * Override or extend the styles applied to the component.
889
- */
890
- classes: y.object,
891
- className: y.string,
892
- /**
893
- * If `true`, the item is disabled.
894
- * @default false
895
- */
896
- disabled: y.bool,
897
- /**
898
- * The id attribute of the item. If not provided, it will be generated.
899
- */
900
- id: y.string,
901
- /**
902
- * The id of the item.
903
- * Must be unique.
904
- */
905
- itemId: y.string.isRequired,
906
- /**
907
- * The label of the item.
908
- */
909
- label: y.node,
910
- /**
911
- * Callback fired when the item root is blurred.
912
- */
913
- onBlur: y.func,
914
- /**
915
- * This prop isn't supported.
916
- * Use the `onItemFocus` callback on the tree if you need to monitor an item's focus.
917
- */
918
- onFocus: Ke,
919
- /**
920
- * Callback fired when a key is pressed on the keyboard and the tree is in focus.
921
- */
922
- onKeyDown: y.func,
923
- /**
924
- * The props used for each component slot.
925
- * @default {}
926
- */
927
- slotProps: y.object,
928
- /**
929
- * Overridable component slots.
930
- * @default {}
931
- */
932
- slots: y.object
933
- });
934
- function At(e) {
935
- const {
936
- id: o,
937
- itemId: t,
938
- label: i,
939
- disabled: p,
940
- children: l,
941
- itemData: b,
942
- iconColor: s = "primary",
943
- ref: g
944
- } = e, c = De(
945
- b == null ? void 0 : b.iconType,
946
- b == null ? void 0 : b.customIcon
947
- ), {
948
- getRootProps: I,
949
- getContentProps: m,
950
- getLabelProps: h,
951
- getGroupTransitionProps: r,
952
- getIconContainerProps: f,
953
- status: R
954
- } = ye({ id: o, itemId: t, label: i, disabled: p, children: l, rootRef: g });
955
- return /* @__PURE__ */ x(re, { itemId: t, children: /* @__PURE__ */ W(
956
- Ce,
957
- {
958
- ...I(),
959
- "data-treeview-item": t || "",
960
- "data-treeview-item-label": i || "",
961
- children: [
962
- /* @__PURE__ */ W(he, { ...m(), style: Ee, children: [
963
- /* @__PURE__ */ x(ve, { ...f(), children: /* @__PURE__ */ x(c, { fontSize: "small", color: s }) }),
964
- /* @__PURE__ */ x(Te, { ...h() }),
965
- /* @__PURE__ */ x(Pe, { sx: Oe, children: R.expandable && (R.expanded ? /* @__PURE__ */ x($e, { fontSize: "small" }) : /* @__PURE__ */ x(Fe, { fontSize: "small" })) })
966
- ] }),
967
- l && /* @__PURE__ */ x(
968
- we,
969
- {
970
- ...r(),
971
- style: R.expanded ? Se : void 0
972
- }
973
- )
974
- ]
975
- }
976
- ) });
977
- }
978
- export {
979
- At as C,
980
- be as T,
981
- ge as a,
982
- Mt as b,
983
- kt as c,
984
- Ue as d,
985
- Nt as e,
986
- Ge as f,
987
- qe as g,
988
- Lt as h,
989
- pe as i,
990
- _e as j,
991
- ze as k,
992
- ne as l,
993
- K as m,
994
- Ye as n,
995
- Ie as o,
996
- je as p,
997
- Ze as q,
998
- Qe as r,
999
- re as s,
1000
- Je as t,
1001
- M as u,
1002
- Vt as v
1003
- };