@smart-factor/gem-ui-components 0.0.94 → 0.0.96

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