@thebuoyant-tsdev/mui-ts-library 3.2.0 → 3.4.0

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 (65) hide show
  1. package/README.de.md +23 -0
  2. package/README.md +23 -0
  3. package/dist/components/chord-chart/ChordChart.js +284 -0
  4. package/dist/components/chord-chart/ChordChart.types.js +4 -0
  5. package/dist/components/circle-packing-chart/CirclePackingChart.js +382 -0
  6. package/dist/components/circle-packing-chart/CirclePackingChart.types.js +4 -0
  7. package/dist/components/gantt-chart/GanttBarRow.js +202 -0
  8. package/dist/components/gantt-chart/GanttChart.constants.js +14 -0
  9. package/dist/components/gantt-chart/GanttChart.js +258 -0
  10. package/dist/components/gantt-chart/GanttChart.store.js +119 -0
  11. package/dist/components/gantt-chart/GanttChart.types.js +47 -0
  12. package/dist/components/gantt-chart/GanttDeleteDialog.js +30 -0
  13. package/dist/components/gantt-chart/GanttDependencyArrows.js +54 -0
  14. package/dist/components/gantt-chart/GanttStatusContextMenu.js +36 -0
  15. package/dist/components/gantt-chart/GanttTaskDialog.js +324 -0
  16. package/dist/components/gantt-chart/GanttTaskPanel.js +415 -0
  17. package/dist/components/gantt-chart/GanttTimeline.js +223 -0
  18. package/dist/components/gantt-chart/GanttTimelineHeader.js +90 -0
  19. package/dist/components/gantt-chart/GanttToolbar.js +157 -0
  20. package/dist/components/gantt-chart/GanttWeekendStrips.js +29 -0
  21. package/dist/components/gantt-chart/hooks/useGanttDrag.js +104 -0
  22. package/dist/components/gantt-chart/util/gantt-chart.util.js +150 -0
  23. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.js +488 -0
  24. package/dist/components/horizontal-tree-chart/HorizontalTreeChart.types.js +8 -0
  25. package/dist/components/json-editor/JsonEditor.js +102 -0
  26. package/dist/components/json-editor/JsonEditor.types.js +21 -0
  27. package/dist/components/json-editor/JsonEditorContent.js +185 -0
  28. package/dist/components/json-editor/JsonEditorFooter.js +55 -0
  29. package/dist/components/json-editor/JsonEditorToolbar.js +148 -0
  30. package/dist/components/password-strength-meter/PasswordStrengthBar.js +66 -0
  31. package/dist/components/password-strength-meter/PasswordStrengthMeter.js +272 -0
  32. package/dist/components/password-strength-meter/PasswordStrengthMeter.types.js +27 -0
  33. package/dist/components/password-strength-meter/util/password-strength.util.js +38 -0
  34. package/dist/components/radial-tree-chart/RadialTreeChart.js +447 -0
  35. package/dist/components/radial-tree-chart/RadialTreeChart.types.js +8 -0
  36. package/dist/components/rich-text-editor/RichTextEditor.js +135 -0
  37. package/dist/components/rich-text-editor/RichTextEditor.types.js +74 -0
  38. package/dist/components/rich-text-editor/RichTextEditorColorPicker.js +185 -0
  39. package/dist/components/rich-text-editor/RichTextEditorContent.js +129 -0
  40. package/dist/components/rich-text-editor/RichTextEditorEmojiPicker.js +110 -0
  41. package/dist/components/rich-text-editor/RichTextEditorFooter.js +33 -0
  42. package/dist/components/rich-text-editor/RichTextEditorImageDialog.js +74 -0
  43. package/dist/components/rich-text-editor/RichTextEditorLinkDialog.js +70 -0
  44. package/dist/components/rich-text-editor/RichTextEditorTableMenu.js +97 -0
  45. package/dist/components/rich-text-editor/RichTextEditorToolbar.js +362 -0
  46. package/dist/components/rich-text-editor/util/emojis.js +739 -0
  47. package/dist/components/shared/ToolbarButton.js +22 -0
  48. package/dist/components/shared/normalizeSize.js +6 -0
  49. package/dist/components/sql-editor/SqlEditor.js +100 -0
  50. package/dist/components/sql-editor/SqlEditor.types.js +20 -0
  51. package/dist/components/sql-editor/SqlEditorContent.js +248 -0
  52. package/dist/components/sql-editor/SqlEditorFooter.js +45 -0
  53. package/dist/components/sql-editor/SqlEditorToolbar.js +151 -0
  54. package/dist/components/sunburst-chart/SunburstChart.js +292 -0
  55. package/dist/components/sunburst-chart/SunburstChart.types.js +4 -0
  56. package/dist/components/tag-selection/TagSelection.js +102 -0
  57. package/dist/components/tag-selection/TagSelection.store.js +40 -0
  58. package/dist/components/tag-selection/TagSelection.types.d.ts +2 -0
  59. package/dist/components/tag-selection/TagSelection.types.js +18 -0
  60. package/dist/components/tag-selection/TagSelectionAutocomplete.js +382 -0
  61. package/dist/components/tag-selection/TagSelectionChip.js +30 -0
  62. package/dist/components/tag-selection/TagSelectionSelectedTags.js +73 -0
  63. package/dist/index.cjs +2 -2
  64. package/dist/index.js +23 -8035
  65. package/package.json +1 -1
@@ -0,0 +1,415 @@
1
+ import { getVisibleTasks as e } from "./util/gantt-chart.util.js";
2
+ import { STATUS_BAR_COLOR as t, STATUS_CHIP_COLOR as n } from "./GanttChart.constants.js";
3
+ import { GanttTaskDialog as r } from "./GanttTaskDialog.js";
4
+ import { GanttDeleteDialog as i } from "./GanttDeleteDialog.js";
5
+ import { useGanttChartStore as a, useGanttTheme as o, useGanttTranslations as s, useRawGanttChartStore as c } from "./GanttChart.js";
6
+ import { useMemo as l, useState as u } from "react";
7
+ import { Box as d, Chip as f, IconButton as p, Menu as m, MenuItem as h, TextField as g, Tooltip as _, Typography as v } from "@mui/material";
8
+ import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
9
+ import S from "@mui/icons-material/Delete";
10
+ import { useVirtualizer as C } from "@tanstack/react-virtual";
11
+ import w from "@mui/icons-material/Add";
12
+ import T from "@mui/icons-material/Edit";
13
+ //#region src/components/gantt-chart/GanttTaskPanel.tsx
14
+ function E(e, t) {
15
+ return {
16
+ planned: t.statusPlanned,
17
+ "in-progress": t.statusInProgress,
18
+ done: t.statusDone,
19
+ blocked: t.statusBlocked
20
+ }[e];
21
+ }
22
+ function D({ task: e, expandedIds: r, toggleExpand: i, hasActionsColumn: a, showAssigneeColumn: c, onTaskClick: l, onAddTask: y, onEditTask: C, onDeleteTask: D, onStatusChange: O, inlineEdit: k, onInlineRename: A }) {
23
+ let [j, M] = u(null), [N, P] = u(null), F = s(), { statusColors: I } = o(), L = () => {
24
+ N !== null && N.trim() && A?.(e, N.trim()), P(null);
25
+ };
26
+ return /* @__PURE__ */ x(d, {
27
+ className: "gantt-task-row",
28
+ "data-testid": `gantt-task-row-${e.id}`,
29
+ sx: {
30
+ height: 40,
31
+ display: "flex",
32
+ alignItems: "center",
33
+ borderBottom: "1px solid",
34
+ borderRight: "1px solid",
35
+ borderColor: "divider",
36
+ cursor: l ? "pointer" : "default",
37
+ "&:hover": l ? { bgcolor: "action.hover" } : void 0
38
+ },
39
+ onClick: () => l?.(e),
40
+ children: [
41
+ /* @__PURE__ */ x(d, {
42
+ sx: {
43
+ flex: 1,
44
+ minWidth: 0,
45
+ display: "flex",
46
+ alignItems: "center",
47
+ gap: .75,
48
+ pl: 1 + e.depth * 2,
49
+ pr: .5,
50
+ height: "100%"
51
+ },
52
+ children: [
53
+ /* @__PURE__ */ b(d, {
54
+ sx: {
55
+ width: 16,
56
+ flexShrink: 0,
57
+ display: "flex",
58
+ justifyContent: "center"
59
+ },
60
+ children: e.children.length > 0 && /* @__PURE__ */ b(d, {
61
+ component: "span",
62
+ sx: {
63
+ fontSize: 9,
64
+ userSelect: "none",
65
+ cursor: "pointer"
66
+ },
67
+ onClick: (t) => {
68
+ t.stopPropagation(), i(e.id);
69
+ },
70
+ children: r.has(e.id) ? "▼" : "▶"
71
+ })
72
+ }),
73
+ /* @__PURE__ */ b(d, { sx: {
74
+ width: 8,
75
+ height: 8,
76
+ borderRadius: e.isMilestone ? 0 : "50%",
77
+ transform: e.isMilestone ? "rotate(45deg)" : void 0,
78
+ flexShrink: 0,
79
+ bgcolor: e.color ?? I?.[e.status] ?? t[e.status] ?? "grey.400"
80
+ } }),
81
+ N === null ? /* @__PURE__ */ b(v, {
82
+ variant: "body2",
83
+ noWrap: !0,
84
+ sx: {
85
+ flex: 1,
86
+ minWidth: 0,
87
+ cursor: k ? "text" : "inherit"
88
+ },
89
+ onDoubleClick: k ? (t) => {
90
+ t.stopPropagation(), P(e.name);
91
+ } : void 0,
92
+ children: e.name
93
+ }) : /* @__PURE__ */ b(g, {
94
+ size: "small",
95
+ variant: "standard",
96
+ value: N,
97
+ autoFocus: !0,
98
+ onChange: (e) => P(e.target.value),
99
+ onBlur: L,
100
+ onKeyDown: (e) => {
101
+ e.key === "Enter" && (e.preventDefault(), L()), e.key === "Escape" && (e.stopPropagation(), P(null));
102
+ },
103
+ onClick: (e) => e.stopPropagation(),
104
+ sx: {
105
+ flex: 1,
106
+ minWidth: 0
107
+ },
108
+ slotProps: { htmlInput: { "data-testid": `gantt-inline-edit-${e.id}` } }
109
+ })
110
+ ]
111
+ }),
112
+ c && /* @__PURE__ */ b(d, {
113
+ sx: {
114
+ width: 110,
115
+ flexShrink: 0,
116
+ display: "flex",
117
+ alignItems: "center",
118
+ px: 1,
119
+ overflow: "hidden"
120
+ },
121
+ children: /* @__PURE__ */ b(v, {
122
+ variant: "caption",
123
+ noWrap: !0,
124
+ color: e.assignee ? "text.primary" : "text.disabled",
125
+ children: e.assignee ?? "—"
126
+ })
127
+ }),
128
+ a && /* @__PURE__ */ x(d, {
129
+ className: "gantt-row-actions",
130
+ sx: {
131
+ width: 96,
132
+ flexShrink: 0,
133
+ display: "flex",
134
+ alignItems: "center",
135
+ justifyContent: "flex-end",
136
+ pr: .5
137
+ },
138
+ children: [
139
+ C && /* @__PURE__ */ b(_, {
140
+ title: F.editTaskTooltip,
141
+ children: /* @__PURE__ */ b(p, {
142
+ size: "small",
143
+ "aria-label": F.editTaskTooltip,
144
+ "data-testid": `gantt-edit-task-${e.id}`,
145
+ onClick: (t) => {
146
+ t.stopPropagation(), C(e);
147
+ },
148
+ children: /* @__PURE__ */ b(T, { fontSize: "inherit" })
149
+ })
150
+ }),
151
+ y && /* @__PURE__ */ b(_, {
152
+ title: F.addTaskTooltip,
153
+ children: /* @__PURE__ */ b(p, {
154
+ size: "small",
155
+ "aria-label": F.addTaskTooltip,
156
+ "data-testid": `gantt-add-task-${e.id}`,
157
+ onClick: (t) => {
158
+ t.stopPropagation(), y(e);
159
+ },
160
+ children: /* @__PURE__ */ b(w, { fontSize: "inherit" })
161
+ })
162
+ }),
163
+ D && /* @__PURE__ */ b(_, {
164
+ title: F.deleteTaskTooltip,
165
+ children: /* @__PURE__ */ b(p, {
166
+ size: "small",
167
+ "aria-label": F.deleteTaskTooltip,
168
+ "data-testid": `gantt-delete-task-${e.id}`,
169
+ onClick: (t) => {
170
+ t.stopPropagation(), D(e);
171
+ },
172
+ children: /* @__PURE__ */ b(S, { fontSize: "inherit" })
173
+ })
174
+ })
175
+ ]
176
+ }),
177
+ /* @__PURE__ */ x(d, {
178
+ sx: {
179
+ width: 90,
180
+ flexShrink: 0,
181
+ display: "flex",
182
+ alignItems: "center",
183
+ justifyContent: "center"
184
+ },
185
+ children: [/* @__PURE__ */ b(f, {
186
+ label: E(e.status, F),
187
+ size: "small",
188
+ variant: "outlined",
189
+ color: e.color ?? I?.[e.status] ? "default" : n[e.status] ?? "default",
190
+ sx: {
191
+ height: 20,
192
+ fontSize: 10,
193
+ cursor: O ? "pointer" : "default",
194
+ ...(e.color ?? I?.[e.status]) && {
195
+ borderColor: e.color ?? I?.[e.status],
196
+ color: e.color ?? I?.[e.status]
197
+ }
198
+ },
199
+ onClick: O ? (e) => {
200
+ e.stopPropagation(), M(e.currentTarget);
201
+ } : void 0
202
+ }), O && /* @__PURE__ */ b(m, {
203
+ anchorEl: j,
204
+ open: !!j,
205
+ onClose: () => M(null),
206
+ children: [
207
+ "planned",
208
+ "in-progress",
209
+ "done",
210
+ "blocked"
211
+ ].map((t) => /* @__PURE__ */ b(h, {
212
+ selected: e.status === t,
213
+ onClick: () => {
214
+ O(e, t), M(null);
215
+ },
216
+ children: E(t, F)
217
+ }, t))
218
+ })]
219
+ })
220
+ ]
221
+ });
222
+ }
223
+ function O({ scrollRef: t, onScroll: n, panelWidth: o, onTaskClick: f, onAddTask: p, onEditTask: m, onDeleteTask: h, onStatusChange: g, onTasksChange: _, enableBuiltinDialogs: S, onTaskCreated: w, onTaskUpdated: T, onTaskDeleted: E, inlineEdit: O, virtualizeRows: k = !1, showAssigneeColumn: A = !1 }) {
224
+ let j = s(), M = c(), N = a((e) => e.taskTree), P = a((e) => e.expandedIds), F = a((e) => e.toggleExpand), I = a((e) => e.timeScale), L = a((e) => e.addTask), R = a((e) => e.updateTask), ee = a((e) => e.deleteTask), z = l(() => e(N, P), [N, P]), B = C({
225
+ count: z.length,
226
+ getScrollElement: () => t.current,
227
+ estimateSize: () => 40,
228
+ overscan: 5
229
+ }), [V, H] = u(!1), [U, W] = u(!1), [G, K] = u(!1), [q, J] = u(null), te = (e) => {
230
+ let t = {
231
+ ...e,
232
+ id: crypto.randomUUID()
233
+ };
234
+ L(t), _?.(M.getState().tasks), w?.(t), H(!1);
235
+ }, ne = (e) => {
236
+ if (!q) return;
237
+ let t = {
238
+ ...e,
239
+ id: q.id
240
+ };
241
+ R(t), _?.(M.getState().tasks), T?.(t), W(!1);
242
+ }, re = () => {
243
+ q && (ee(q.id), _?.(M.getState().tasks), E?.(q.id), K(!1));
244
+ }, Y = (e, t) => {
245
+ let n = {
246
+ ...e,
247
+ name: t
248
+ };
249
+ R(n), _?.(M.getState().tasks), T?.(n);
250
+ }, X = S ? (e) => {
251
+ J(e), H(!0);
252
+ } : p, Z = S ? (e) => {
253
+ J(e), W(!0);
254
+ } : m, Q = S ? (e) => {
255
+ J(e), K(!0);
256
+ } : h, $ = !!(X || Z || Q);
257
+ return /* @__PURE__ */ x(d, {
258
+ ref: t,
259
+ onScroll: n,
260
+ sx: {
261
+ width: o,
262
+ flexShrink: 0,
263
+ overflowY: "auto",
264
+ overflowX: "hidden"
265
+ },
266
+ children: [
267
+ /* @__PURE__ */ x(d, {
268
+ sx: {
269
+ height: I === "days" ? 80 : 40,
270
+ position: "sticky",
271
+ top: 0,
272
+ bgcolor: "background.paper",
273
+ zIndex: 1,
274
+ borderBottom: "1px solid",
275
+ borderRight: "1px solid",
276
+ borderColor: "divider",
277
+ display: "flex",
278
+ flexDirection: "column"
279
+ },
280
+ children: [/* @__PURE__ */ x(d, {
281
+ sx: {
282
+ height: 40,
283
+ display: "flex",
284
+ alignItems: "center",
285
+ borderBottom: I === "days" ? "1px solid" : void 0,
286
+ borderColor: I === "days" ? "divider" : void 0
287
+ },
288
+ children: [
289
+ /* @__PURE__ */ b(d, {
290
+ sx: {
291
+ flex: 1,
292
+ minWidth: 0,
293
+ pl: 2
294
+ },
295
+ children: /* @__PURE__ */ b(v, {
296
+ variant: "caption",
297
+ color: "text.secondary",
298
+ children: j.columnName
299
+ })
300
+ }),
301
+ A && /* @__PURE__ */ b(d, {
302
+ sx: {
303
+ width: 110,
304
+ flexShrink: 0,
305
+ display: "flex",
306
+ alignItems: "center",
307
+ px: 1
308
+ },
309
+ children: /* @__PURE__ */ b(v, {
310
+ variant: "caption",
311
+ color: "text.secondary",
312
+ children: j.columnAssignee
313
+ })
314
+ }),
315
+ $ && /* @__PURE__ */ b(d, {
316
+ sx: {
317
+ width: 96,
318
+ flexShrink: 0,
319
+ display: "flex",
320
+ alignItems: "center",
321
+ justifyContent: "center"
322
+ },
323
+ children: /* @__PURE__ */ b(v, {
324
+ variant: "caption",
325
+ color: "text.secondary",
326
+ children: j.columnActions
327
+ })
328
+ }),
329
+ /* @__PURE__ */ b(d, {
330
+ sx: {
331
+ width: 90,
332
+ flexShrink: 0,
333
+ display: "flex",
334
+ alignItems: "center",
335
+ justifyContent: "center"
336
+ },
337
+ children: /* @__PURE__ */ b(v, {
338
+ variant: "caption",
339
+ color: "text.secondary",
340
+ children: j.columnStatus
341
+ })
342
+ })
343
+ ]
344
+ }), I === "days" && /* @__PURE__ */ b(d, { sx: { flex: 1 } })]
345
+ }),
346
+ k ? /* @__PURE__ */ b(d, {
347
+ sx: {
348
+ position: "relative",
349
+ height: B.getTotalSize()
350
+ },
351
+ children: B.getVirtualItems().map((e) => /* @__PURE__ */ b(d, {
352
+ style: {
353
+ position: "absolute",
354
+ top: 0,
355
+ left: 0,
356
+ width: "100%",
357
+ height: 40,
358
+ transform: `translateY(${e.start}px)`
359
+ },
360
+ children: /* @__PURE__ */ b(D, {
361
+ task: z[e.index],
362
+ expandedIds: P,
363
+ toggleExpand: F,
364
+ hasActionsColumn: $,
365
+ showAssigneeColumn: A,
366
+ onTaskClick: f,
367
+ onAddTask: X,
368
+ onEditTask: Z,
369
+ onDeleteTask: Q,
370
+ onStatusChange: g,
371
+ inlineEdit: O,
372
+ onInlineRename: O ? Y : void 0
373
+ })
374
+ }, e.key))
375
+ }) : z.map((e) => /* @__PURE__ */ b(D, {
376
+ task: e,
377
+ expandedIds: P,
378
+ toggleExpand: F,
379
+ hasActionsColumn: $,
380
+ showAssigneeColumn: A,
381
+ onTaskClick: f,
382
+ onAddTask: X,
383
+ onEditTask: Z,
384
+ onDeleteTask: Q,
385
+ onStatusChange: g,
386
+ inlineEdit: O,
387
+ onInlineRename: O ? Y : void 0
388
+ }, e.id)),
389
+ S && /* @__PURE__ */ x(y, { children: [
390
+ /* @__PURE__ */ b(r, {
391
+ open: V,
392
+ mode: "add",
393
+ defaultParentId: q?.id,
394
+ onSave: te,
395
+ onClose: () => H(!1)
396
+ }),
397
+ /* @__PURE__ */ b(r, {
398
+ open: U,
399
+ mode: "edit",
400
+ initialTask: q ?? void 0,
401
+ onSave: ne,
402
+ onClose: () => W(!1)
403
+ }),
404
+ /* @__PURE__ */ b(i, {
405
+ open: G,
406
+ task: q,
407
+ onConfirm: re,
408
+ onClose: () => K(!1)
409
+ })
410
+ ] })
411
+ ]
412
+ });
413
+ }
414
+ //#endregion
415
+ export { O as GanttTaskPanel };
@@ -0,0 +1,223 @@
1
+ import { calculateTaskPosition as e, computeCriticalPath as t, getDaysInRange as n, getDisplayRange as r, getISOWeekNumber as i, getMonthsInRange as a, getQuartersInRange as o, getVisibleTasks as s, getWeeksInRange as c } from "./util/gantt-chart.util.js";
2
+ import { useGanttDrag as l } from "./hooks/useGanttDrag.js";
3
+ import { GanttTimelineHeader as u } from "./GanttTimelineHeader.js";
4
+ import { GanttBarRow as d } from "./GanttBarRow.js";
5
+ import { GanttWeekendStrips as f } from "./GanttWeekendStrips.js";
6
+ import { GanttStatusContextMenu as p } from "./GanttStatusContextMenu.js";
7
+ import { GanttDependencyArrows as m } from "./GanttDependencyArrows.js";
8
+ import { useGanttChartStore as h, useGanttTheme as ee, useGanttTranslations as te, useRawGanttChartStore as ne } from "./GanttChart.js";
9
+ import { useEffect as re, useId as ie, useMemo as g, useRef as _, useState as ae } from "react";
10
+ import { Box as v, useTheme as oe } from "@mui/material";
11
+ import { Fragment as se, jsx as y, jsxs as ce } from "react/jsx-runtime";
12
+ import { useVirtualizer as le } from "@tanstack/react-virtual";
13
+ //#region src/components/gantt-chart/GanttTimeline.tsx
14
+ function ue(t, n, r) {
15
+ if (r === 0) return [];
16
+ let i = [], a = new Map(t.map((e, t) => [e.id, t]));
17
+ for (let o of t) {
18
+ if (!o.dependencies?.length) continue;
19
+ let s = a.get(o.id), c = e(o, n).left / 100 * r, l = s * 40 + 40 / 2;
20
+ for (let s of o.dependencies) {
21
+ let u = a.get(s);
22
+ if (u === void 0) continue;
23
+ let d = t[u], f = e(d, n), p = (f.left + f.width) / 100 * r, m = u * 40 + 40 / 2, h;
24
+ h = c >= p + 48 ? (p + c) / 2 : p + 24 <= r - 8 ? p + 24 : Math.max(c - 24, 8), i.push({
25
+ key: `${s}-${o.id}`,
26
+ d: `M ${p} ${m} H ${h} V ${l} H ${c}`
27
+ });
28
+ }
29
+ }
30
+ return i;
31
+ }
32
+ function b({ scrollRef: e, onScroll: b, onTaskClick: x, onMilestoneClick: S, draggable: C = !1, resizable: w = !1, progressDraggable: T = !1, showCriticalPath: E = !1, virtualizeRows: de = !1, onTaskMoved: fe, onTaskResized: pe, onTasksChange: D, onStatusChange: O }) {
33
+ let k = h((e) => e.taskTree), A = h((e) => e.tasks), j = h((e) => e.expandedIds), M = h((e) => e.timelineRange), N = h((e) => e.timeScale), me = h((e) => e.updateTask), P = ne(), F = te(), he = oe(), { todayLineColor: ge } = ee(), _e = `gantt-arrow-${ie().replace(/:/g, "")}`, I = g(() => s(k, j), [k, j]), L = g(() => r(M, N), [M, N]), R = g(() => N === "days" ? n(L).map((e) => ({
34
+ key: e.toISOString(),
35
+ label: String(e.getDate()),
36
+ width: 20,
37
+ isWeekend: e.getDay() === 0 || e.getDay() === 6
38
+ })) : N === "weeks" ? c(L).map((e) => ({
39
+ key: e.toISOString(),
40
+ label: `${F.weekColumnPrefix}${i(e)}`,
41
+ width: 40
42
+ })) : N === "quarters" ? o(L).map((e) => ({
43
+ key: e.key,
44
+ label: e.label,
45
+ width: 360
46
+ })) : a(L).map((e) => ({
47
+ key: e.toISOString(),
48
+ label: e.toLocaleString(F.dateLocale, {
49
+ month: "short",
50
+ year: "2-digit"
51
+ }),
52
+ width: 120
53
+ })), [
54
+ N,
55
+ L,
56
+ F.weekColumnPrefix,
57
+ F.dateLocale
58
+ ]), z = g(() => R.reduce((e, t) => e + t.width, 0), [R]), B = g(() => {
59
+ if (N !== "days") return;
60
+ let e = /* @__PURE__ */ new Map();
61
+ for (let t of R) {
62
+ let n = new Date(t.key), r = `${n.getFullYear()}-${n.getMonth()}`;
63
+ e.has(r) || e.set(r, {
64
+ label: n.toLocaleString(F.dateLocale, {
65
+ month: "short",
66
+ year: "2-digit"
67
+ }),
68
+ width: 0
69
+ }), e.get(r).width += 20;
70
+ }
71
+ return Array.from(e.entries()).map(([e, t]) => ({
72
+ key: e,
73
+ ...t
74
+ }));
75
+ }, [
76
+ N,
77
+ R,
78
+ F.dateLocale
79
+ ]), ve = g(() => ue(I, L, z), [
80
+ I,
81
+ L,
82
+ z
83
+ ]), V = g(() => E ? t(A) : /* @__PURE__ */ new Set(), [E, A]), H = le({
84
+ count: I.length,
85
+ getScrollElement: () => e.current,
86
+ estimateSize: () => 40,
87
+ overscan: 5
88
+ }), ye = g(() => {
89
+ if (N !== "days") return [];
90
+ let e = 0;
91
+ return R.flatMap((t) => {
92
+ let n = t.isWeekend ? [{
93
+ key: t.key,
94
+ left: e
95
+ }] : [];
96
+ return e += t.width, n;
97
+ });
98
+ }, [N, R]), U = g(() => {
99
+ let e = Date.now(), t = L.start.getTime(), n = L.end.getTime();
100
+ return e < t || e > n ? null : (e - t) / (n - t) * z;
101
+ }, [L, z]), be = g(() => (/* @__PURE__ */ new Date()).toLocaleDateString(F.dateLocale, {
102
+ weekday: "long",
103
+ day: "numeric",
104
+ month: "long",
105
+ year: "numeric"
106
+ }), [F.dateLocale]), xe = ge || he.palette.primary.main;
107
+ re(() => {
108
+ if (U === null || !e.current) return;
109
+ let t = e.current.clientWidth;
110
+ e.current.scrollLeft = Math.max(0, U - t / 2);
111
+ }, []);
112
+ let W = N === "days" ? 20 : N === "weeks" ? 40 : N === "quarters" ? 360 : 120, G = B ? 80 : 40, { activeDrag: K, suppressClickRef: q, handleBarMouseDown: J, handleProgressMouseDown: Y, formatDragDate: X } = l({
113
+ totalWidth: z,
114
+ displayRange: L,
115
+ onTaskMoved: fe,
116
+ onTaskResized: pe,
117
+ onTasksChange: D
118
+ }), [Se, Z] = ae(null), Q = _(O);
119
+ Q.current = O;
120
+ let $ = _(D);
121
+ return $.current = D, /* @__PURE__ */ y(v, {
122
+ ref: e,
123
+ onScroll: b,
124
+ "data-testid": "gantt-timeline-scroll",
125
+ sx: {
126
+ flex: 1,
127
+ overflow: "auto"
128
+ },
129
+ children: /* @__PURE__ */ ce(v, {
130
+ sx: {
131
+ minWidth: z,
132
+ position: "relative"
133
+ },
134
+ children: [
135
+ /* @__PURE__ */ y(u, {
136
+ columns: R,
137
+ groups: B,
138
+ todayX: U,
139
+ todayLabel: F.todayLabel,
140
+ todayTooltip: be,
141
+ todayColor: xe
142
+ }),
143
+ /* @__PURE__ */ y(f, {
144
+ strips: ye,
145
+ totalWidth: z,
146
+ height: I.length * 40,
147
+ top: G
148
+ }),
149
+ de ? /* @__PURE__ */ y(v, {
150
+ sx: {
151
+ position: "relative",
152
+ height: H.getTotalSize()
153
+ },
154
+ children: H.getVirtualItems().map((e) => /* @__PURE__ */ y(d, {
155
+ task: I[e.index],
156
+ virtualTop: e.start,
157
+ activeDrag: K,
158
+ displayRange: L,
159
+ totalWidth: z,
160
+ gridColumnWidth: W,
161
+ criticalTaskIds: V,
162
+ draggable: C,
163
+ resizable: w,
164
+ progressDraggable: T,
165
+ onTaskClick: x,
166
+ onMilestoneClick: S,
167
+ onContextMenu: (e, t, n) => Z({
168
+ task: e,
169
+ mouseX: t,
170
+ mouseY: n
171
+ }),
172
+ suppressClickRef: q,
173
+ handleBarMouseDown: J,
174
+ handleProgressMouseDown: Y,
175
+ formatDragDate: X
176
+ }, e.key))
177
+ }) : /* @__PURE__ */ y(se, { children: I.map((e) => /* @__PURE__ */ y(d, {
178
+ task: e,
179
+ activeDrag: K,
180
+ displayRange: L,
181
+ totalWidth: z,
182
+ gridColumnWidth: W,
183
+ criticalTaskIds: V,
184
+ draggable: C,
185
+ resizable: w,
186
+ progressDraggable: T,
187
+ onTaskClick: x,
188
+ onMilestoneClick: S,
189
+ onContextMenu: (e, t, n) => Z({
190
+ task: e,
191
+ mouseX: t,
192
+ mouseY: n
193
+ }),
194
+ suppressClickRef: q,
195
+ handleBarMouseDown: J,
196
+ handleProgressMouseDown: Y,
197
+ formatDragDate: X
198
+ }, e.id)) }),
199
+ /* @__PURE__ */ y(p, {
200
+ contextMenu: Se,
201
+ onClose: () => Z(null),
202
+ onSelect: (e, t) => {
203
+ let n = P.getState().tasks.find((t) => t.id === e.id) ?? e;
204
+ me({
205
+ ...n,
206
+ status: t
207
+ }), Q.current?.(n, t), $.current?.(P.getState().tasks), Z(null);
208
+ }
209
+ }),
210
+ /* @__PURE__ */ y(m, {
211
+ dependencyLines: ve,
212
+ todayX: U,
213
+ totalWidth: z,
214
+ height: I.length * 40,
215
+ top: G,
216
+ arrowMarkerId: _e
217
+ })
218
+ ]
219
+ })
220
+ });
221
+ }
222
+ //#endregion
223
+ export { b as GanttTimeline };