@thebuoyant-tsdev/mui-ts-library 3.2.1 → 3.6.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 (74) hide show
  1. package/README.de.md +31 -0
  2. package/README.md +31 -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.d.ts +1 -1
  50. package/dist/components/sql-editor/SqlEditor.js +113 -0
  51. package/dist/components/sql-editor/SqlEditor.types.d.ts +9 -0
  52. package/dist/components/sql-editor/SqlEditor.types.js +24 -0
  53. package/dist/components/sql-editor/SqlEditorContent.js +248 -0
  54. package/dist/components/sql-editor/SqlEditorFooter.js +45 -0
  55. package/dist/components/sql-editor/SqlEditorHistoryMenu.d.ts +11 -0
  56. package/dist/components/sql-editor/SqlEditorHistoryMenu.js +75 -0
  57. package/dist/components/sql-editor/SqlEditorToolbar.d.ts +5 -1
  58. package/dist/components/sql-editor/SqlEditorToolbar.js +163 -0
  59. package/dist/components/sql-editor/useSqlQueryHistory.d.ts +6 -0
  60. package/dist/components/sql-editor/useSqlQueryHistory.js +20 -0
  61. package/dist/components/sql-editor/util/sqlQueryHistory.util.d.ts +12 -0
  62. package/dist/components/sql-editor/util/sqlQueryHistory.util.js +28 -0
  63. package/dist/components/sunburst-chart/SunburstChart.js +292 -0
  64. package/dist/components/sunburst-chart/SunburstChart.types.js +4 -0
  65. package/dist/components/tag-selection/TagSelection.js +102 -0
  66. package/dist/components/tag-selection/TagSelection.store.js +40 -0
  67. package/dist/components/tag-selection/TagSelection.types.d.ts +2 -0
  68. package/dist/components/tag-selection/TagSelection.types.js +18 -0
  69. package/dist/components/tag-selection/TagSelectionAutocomplete.js +382 -0
  70. package/dist/components/tag-selection/TagSelectionChip.js +30 -0
  71. package/dist/components/tag-selection/TagSelectionSelectedTags.js +73 -0
  72. package/dist/index.cjs +2 -2
  73. package/dist/index.js +23 -8035
  74. package/package.json +1 -1
@@ -0,0 +1,382 @@
1
+ import { useCallback as e, useLayoutEffect as t, useMemo as n, useRef as r, useState as i } from "react";
2
+ import { Box as a, Tooltip as o, Typography as s, useTheme as c } from "@mui/material";
3
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
4
+ import * as d from "d3";
5
+ //#region src/components/circle-packing-chart/CirclePackingChart.tsx
6
+ var f = .56;
7
+ function p(e, t, n) {
8
+ return e.length * n * f <= t ? e : t >= 3 * n * f + n * 2 ? "…" : "";
9
+ }
10
+ function m({ data: f, size: m = 600, padding: h = 3, sortBy: g = "value", showLabels: _ = !0, showAllLabels: v = !1, labelFontSize: y = 13, innerLabelFontSize: b = 9, labelColor: ee, chartColors: x, depthColorStart: S, depthColorEnd: C, background: w, duration: T = 750, zoomable: E = !1, disabled: D = !1, onCircleClick: O, onZoomChange: k }) {
11
+ let A = c(), j = [
12
+ A.palette.primary.main,
13
+ A.palette.secondary.main,
14
+ A.palette.error.main,
15
+ A.palette.warning.main,
16
+ A.palette.success.main,
17
+ A.palette.info.main
18
+ ], M = ee || A.palette.text.primary, te = w || A.palette.background.default, ne = A.typography.fontFamily, N = n(() => {
19
+ let e = d.hierarchy(f).sum((e) => e.value ?? 0);
20
+ return g === "value" ? e.sort((e, t) => (t.value ?? 0) - (e.value ?? 0)) : e.sort((e, t) => String(e.data.name).localeCompare(String(t.data.name), void 0, {
21
+ numeric: !0,
22
+ sensitivity: "base"
23
+ })), d.pack().size([m, m]).padding(h)(e);
24
+ }, [
25
+ f,
26
+ m,
27
+ h,
28
+ g
29
+ ]), P = N.descendants(), F = n(() => d.max(P, (e) => e.depth) ?? 0, [P]), I = !!(S && C), L = n(() => I ? d.scaleSequential(d.interpolateHcl(S, C)).domain([0, Math.max(1, F)]) : null, [
30
+ I,
31
+ S,
32
+ C,
33
+ F
34
+ ]), R = x && x.length > 0 ? x : j, z = e((e) => e.data.colorConfig?.fill ? e.data.colorConfig.fill : I && L ? e.children ? L(e.depth) : A.palette.background.paper : R[e.depth % R.length], [
35
+ I,
36
+ L,
37
+ R,
38
+ A
39
+ ]), [B, V] = i(1), H = e((e) => {
40
+ if (!E || D || !e.ctrlKey) return;
41
+ e.preventDefault();
42
+ let t = e.deltaY < 0 ? 1.15 : 1 / 1.15;
43
+ V((e) => Math.max(.25, Math.min(8, e * t)));
44
+ }, [E, D]);
45
+ t(() => {
46
+ if (!E) return;
47
+ let e = (e) => {
48
+ e.key === "Escape" && V(1);
49
+ };
50
+ return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
51
+ }, [E]);
52
+ let U = n(() => {
53
+ let e = `${-m / 2} ${-m / 2} ${m} ${m}`;
54
+ if (B === 1) return e;
55
+ let t = m / B, n = (m - t) / 2;
56
+ return `${-m / 2 + n} ${-m / 2 + n} ${t} ${t}`;
57
+ }, [m, B]), W = e((e) => {
58
+ let t = e.value ?? 0, n = N.value ?? 0;
59
+ return {
60
+ id: e.data.id ?? null,
61
+ name: e.data.name,
62
+ value: t || null,
63
+ percentage: n > 0 ? Math.round(t / n * 1e4) / 100 : 0,
64
+ depth: e.depth,
65
+ path: e.ancestors().map((e) => e.data.name).reverse(),
66
+ childrenCount: e.children?.length ?? 0,
67
+ data: e.data
68
+ };
69
+ }, [N]), G = r(null), K = r([
70
+ N.x,
71
+ N.y,
72
+ N.r * 2
73
+ ]), q = r(N), [J, re] = i(N), Y = e((e) => {
74
+ q.current = e, re(e);
75
+ }, []), [ie, ae] = i(f);
76
+ ie !== f && (ae(f), Y(N), q.current = N);
77
+ let X = e((e) => {
78
+ let t = G.current;
79
+ if (!t) return;
80
+ K.current = e;
81
+ let n = m / e[2], r = q.current, i = t.querySelectorAll("g[data-role='nodes'] > g"), a = t.querySelectorAll("g[data-role='nodes'] > g > circle");
82
+ for (let t = 0; t < P.length; t++) {
83
+ let r = P[t], o = i[t];
84
+ o && o.setAttribute("transform", `translate(${(r.x - e[0]) * n},${(r.y - e[1]) * n})`);
85
+ let s = t - 1;
86
+ s >= 0 && a[s] && a[s].setAttribute("r", String(r.r * n));
87
+ }
88
+ if (_) {
89
+ let r = t.querySelectorAll("g[data-role='labels'] > text");
90
+ for (let t = 0; t < P.length; t++) {
91
+ let i = P[t], a = r[t];
92
+ a && (a.setAttribute("transform", `translate(${(i.x - e[0]) * n},${(i.y - e[1]) * n})`), a.setAttribute("font-weight", i.children ? "bold" : "normal"));
93
+ }
94
+ }
95
+ if (v) {
96
+ let i = t.querySelectorAll("g[data-role='inner-labels'] > text");
97
+ for (let t = 0; t < P.length; t++) {
98
+ let a = P[t], o = i[t];
99
+ if (!o) continue;
100
+ let s = a.r * n, c = s * 1.6, l = r === N ? a !== N : a.ancestors().includes(r), u = a.parent === r;
101
+ if (l && !u && s >= 14) {
102
+ let t = p(a.data.name, c, b);
103
+ t ? (o.textContent = t, o.setAttribute("transform", `translate(${(a.x - e[0]) * n},${(a.y - e[1]) * n})`), o.setAttribute("font-weight", a.children ? "bold" : "normal"), o.style.display = "inline") : o.style.display = "none";
104
+ } else o.style.display = "none";
105
+ }
106
+ }
107
+ }, [
108
+ P,
109
+ m,
110
+ _,
111
+ v,
112
+ b,
113
+ N
114
+ ]);
115
+ t(() => {
116
+ X([
117
+ J.x,
118
+ J.y,
119
+ J.r * 2
120
+ ]);
121
+ }, [
122
+ N,
123
+ m,
124
+ J,
125
+ X
126
+ ]);
127
+ let Z = e((e, t) => {
128
+ let n = G.current;
129
+ if (!n) return;
130
+ let r = J, i = K.current, a = [
131
+ e.x,
132
+ e.y,
133
+ e.r * 2
134
+ ];
135
+ Y(e), d.select(n).transition().duration(t).ease(d.easeCubic).tween("zoom", () => {
136
+ let e = d.interpolateZoom(i, a);
137
+ return (t) => X(e(t));
138
+ });
139
+ let o = n.querySelectorAll("g[data-role='labels'] > text");
140
+ d.selectAll(o).transition().duration(t).ease(d.easeCubic).style("fill-opacity", (t, n) => +(P[n].parent === e)).on("start", function(t, n) {
141
+ P[n].parent === e && (this.style.display = "inline");
142
+ }).on("end", function(t, n) {
143
+ P[n].parent !== e && (this.style.display = "none");
144
+ }), k?.({
145
+ previousName: r.data.name,
146
+ currentName: e.data.name,
147
+ currentDepth: e.depth,
148
+ isRoot: e === N
149
+ });
150
+ }, [
151
+ J,
152
+ P,
153
+ N,
154
+ X,
155
+ k,
156
+ Y
157
+ ]), Q = r(null), oe = (e) => {
158
+ Q.current &&= (clearTimeout(Q.current), null), Q.current = setTimeout(() => {
159
+ e(), Q.current = null;
160
+ }, 250);
161
+ }, $ = () => {
162
+ Q.current &&= (clearTimeout(Q.current), null);
163
+ };
164
+ t(() => {
165
+ if (D) return;
166
+ let e = (e) => {
167
+ e.key === "Escape" && ($(), Z(N, T));
168
+ };
169
+ return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
170
+ }, [
171
+ D,
172
+ N,
173
+ T
174
+ ]);
175
+ let se = (e) => {
176
+ if (D || !(e.ctrlKey || e.metaKey)) return;
177
+ $(), e.preventDefault();
178
+ let t = J.parent ?? N;
179
+ t !== J && Z(t, e.altKey ? Math.max(250, T * 10) : T);
180
+ }, ce = {
181
+ followCursor: !0,
182
+ enterDelay: 50,
183
+ enterNextDelay: 0,
184
+ disableHoverListener: D,
185
+ slotProps: { tooltip: { sx: { maxWidth: 220 } } }
186
+ };
187
+ return /* @__PURE__ */ u(a, {
188
+ sx: {
189
+ display: "inline-flex",
190
+ position: "relative",
191
+ opacity: D ? .5 : 1,
192
+ cursor: D ? "not-allowed" : "default",
193
+ userSelect: "none"
194
+ },
195
+ children: [/* @__PURE__ */ u("svg", {
196
+ ref: G,
197
+ width: m,
198
+ height: m,
199
+ viewBox: U,
200
+ onWheel: H,
201
+ style: {
202
+ display: "block",
203
+ background: te,
204
+ fontFamily: ne ?? "sans-serif",
205
+ overflow: E && B > 1 ? "hidden" : "visible"
206
+ },
207
+ role: "img",
208
+ "aria-label": f.name,
209
+ onDoubleClick: se,
210
+ children: [
211
+ /* @__PURE__ */ l("g", {
212
+ "data-role": "nodes",
213
+ children: P.map((e, t) => {
214
+ let n = W(e), r = /* @__PURE__ */ u(a, {
215
+ sx: {
216
+ py: .5,
217
+ minWidth: 160
218
+ },
219
+ children: [/* @__PURE__ */ l(s, {
220
+ variant: "caption",
221
+ sx: {
222
+ fontWeight: "bold",
223
+ display: "block",
224
+ fontSize: "0.8rem"
225
+ },
226
+ children: e.data.name
227
+ }), (e.value ?? 0) > 0 && /* @__PURE__ */ u(a, {
228
+ sx: {
229
+ mt: .75,
230
+ borderTop: "1px solid rgba(255,255,255,0.2)",
231
+ pt: .75
232
+ },
233
+ children: [
234
+ /* @__PURE__ */ u(a, {
235
+ sx: {
236
+ display: "flex",
237
+ justifyContent: "space-between",
238
+ gap: 2
239
+ },
240
+ children: [/* @__PURE__ */ l(s, {
241
+ variant: "caption",
242
+ sx: { opacity: .6 },
243
+ children: "Value"
244
+ }), /* @__PURE__ */ l(s, {
245
+ variant: "caption",
246
+ children: e.value?.toLocaleString()
247
+ })]
248
+ }),
249
+ /* @__PURE__ */ u(a, {
250
+ sx: {
251
+ display: "flex",
252
+ justifyContent: "space-between",
253
+ gap: 2
254
+ },
255
+ children: [/* @__PURE__ */ l(s, {
256
+ variant: "caption",
257
+ sx: { opacity: .6 },
258
+ children: "Share"
259
+ }), /* @__PURE__ */ u(s, {
260
+ variant: "caption",
261
+ children: [n.percentage, "%"]
262
+ })]
263
+ }),
264
+ e.children && /* @__PURE__ */ u(a, {
265
+ sx: {
266
+ display: "flex",
267
+ justifyContent: "space-between",
268
+ gap: 2
269
+ },
270
+ children: [/* @__PURE__ */ l(s, {
271
+ variant: "caption",
272
+ sx: { opacity: .6 },
273
+ children: "Children"
274
+ }), /* @__PURE__ */ l(s, {
275
+ variant: "caption",
276
+ children: e.children.length
277
+ })]
278
+ })
279
+ ]
280
+ })]
281
+ });
282
+ return /* @__PURE__ */ l("g", {
283
+ transform: `translate(${e.x - m / 2},${e.y - m / 2})`,
284
+ children: t === 0 ? null : /* @__PURE__ */ l(o, {
285
+ ...ce,
286
+ title: r,
287
+ children: /* @__PURE__ */ l("circle", {
288
+ r: e.r,
289
+ fill: z(e),
290
+ stroke: e.data.colorConfig?.stroke ?? A.palette.background.paper,
291
+ strokeWidth: .75,
292
+ style: {
293
+ cursor: D ? "not-allowed" : e.children ? "pointer" : "default",
294
+ transition: "stroke-width 0.1s"
295
+ },
296
+ onMouseEnter: (e) => {
297
+ D || (e.currentTarget.style.strokeWidth = "2");
298
+ },
299
+ onMouseLeave: (e) => {
300
+ e.currentTarget.style.strokeWidth = "0.75";
301
+ },
302
+ onClick: (t) => {
303
+ if (!D) {
304
+ if (t.ctrlKey || t.metaKey) {
305
+ if (e.children) {
306
+ let n = t.altKey ? Math.max(250, T * 10) : T;
307
+ oe(() => Z(e, n));
308
+ }
309
+ return;
310
+ }
311
+ O?.(n, t);
312
+ }
313
+ },
314
+ onDoubleClick: (e) => {
315
+ if (!D && (e.ctrlKey || e.metaKey)) {
316
+ $(), e.preventDefault(), e.stopPropagation();
317
+ let t = J.parent ?? N;
318
+ t !== J && Z(t, e.altKey ? Math.max(250, T * 10) : T);
319
+ }
320
+ }
321
+ })
322
+ })
323
+ }, `n-${t}`);
324
+ })
325
+ }),
326
+ _ && /* @__PURE__ */ l("g", {
327
+ "data-role": "labels",
328
+ textAnchor: "middle",
329
+ dominantBaseline: "middle",
330
+ pointerEvents: "none",
331
+ fontSize: y,
332
+ fill: M,
333
+ children: P.map((e, t) => /* @__PURE__ */ l("text", {
334
+ transform: `translate(${e.x - m / 2},${e.y - m / 2})`,
335
+ style: {
336
+ display: e.parent === N ? "inline" : "none",
337
+ fillOpacity: +(e.parent === N)
338
+ },
339
+ children: e.data.name
340
+ }, `lbl-${t}`))
341
+ }),
342
+ v && /* @__PURE__ */ l("g", {
343
+ "data-role": "inner-labels",
344
+ textAnchor: "middle",
345
+ dominantBaseline: "middle",
346
+ pointerEvents: "none",
347
+ fontSize: b,
348
+ fill: M,
349
+ children: P.map((e, t) => /* @__PURE__ */ l("text", {
350
+ transform: `translate(${e.x - m / 2},${e.y - m / 2})`,
351
+ style: { display: "none" }
352
+ }, `inner-lbl-${t}`))
353
+ })
354
+ ]
355
+ }), J !== N && !D && /* @__PURE__ */ l(a, {
356
+ sx: {
357
+ position: "absolute",
358
+ bottom: 6,
359
+ left: 0,
360
+ right: 0,
361
+ display: "flex",
362
+ justifyContent: "center",
363
+ pointerEvents: "none"
364
+ },
365
+ children: /* @__PURE__ */ u(s, {
366
+ variant: "caption",
367
+ sx: {
368
+ bgcolor: "action.hover",
369
+ borderRadius: 1,
370
+ px: 1,
371
+ py: .25,
372
+ color: "text.secondary",
373
+ fontSize: "0.7rem"
374
+ },
375
+ children: [J.ancestors().map((e) => e.data.name).reverse().join(" › "), " · Ctrl / Cmd ⌘+DblClick to zoom out · Escape to reset"]
376
+ })
377
+ })]
378
+ });
379
+ }
380
+ m.displayName = "CirclePackingChart";
381
+ //#endregion
382
+ export { m as CirclePackingChart };
@@ -0,0 +1,4 @@
1
+ //#region src/components/circle-packing-chart/CirclePackingChart.types.ts
2
+ var e = { noData: "No data" };
3
+ //#endregion
4
+ export { e as DEFAULT_CIRCLE_PACKING_TRANSLATION };
@@ -0,0 +1,202 @@
1
+ import { addDays as e, calculateTaskPosition as t } from "./util/gantt-chart.util.js";
2
+ import { STATUS_BAR_COLOR as n } from "./GanttChart.constants.js";
3
+ import { useGanttTheme as r } from "./GanttChart.js";
4
+ import { Box as i, useTheme as a } from "@mui/material";
5
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ //#region src/components/gantt-chart/GanttBarRow.tsx
7
+ function l({ task: n, virtualTop: o, activeDrag: c, displayRange: l, totalWidth: f, gridColumnWidth: p, criticalTaskIds: m, draggable: h = !1, resizable: g = !1, progressDraggable: _ = !1, onTaskClick: v, onMilestoneClick: y, onContextMenu: b, suppressClickRef: x, handleBarMouseDown: S, handleProgressMouseDown: C, formatDragDate: w }) {
8
+ let T = a(), { statusColors: E, criticalPathColor: D, milestoneColor: O, barBorderRadius: k } = r(), A = c?.taskId === n.id, j = n;
9
+ if (A && c) if (c.type === "move") j = {
10
+ ...n,
11
+ startDate: e(n.startDate, c.deltaDays),
12
+ endDate: e(n.endDate, c.deltaDays)
13
+ };
14
+ else if (c.type === "resize") {
15
+ let t = e(n.endDate, c.deltaDays);
16
+ j = {
17
+ ...n,
18
+ endDate: t > n.startDate ? t : e(n.startDate, 1)
19
+ };
20
+ } else c.type === "progress" && c.newProgress !== void 0 && (j = {
21
+ ...n,
22
+ progress: c.newProgress
23
+ });
24
+ let { left: M, width: N } = t(j, l);
25
+ return /* @__PURE__ */ s(i, {
26
+ "data-testid": `gantt-bar-row-${n.id}`,
27
+ style: o === void 0 ? void 0 : {
28
+ position: "absolute",
29
+ top: o,
30
+ left: 0,
31
+ width: "100%"
32
+ },
33
+ sx: {
34
+ height: 40,
35
+ position: "relative",
36
+ borderBottom: "1px solid",
37
+ borderColor: "divider",
38
+ backgroundImage: (e) => `linear-gradient(to right, transparent calc(${p}px - 1px), ${e.palette.divider} calc(${p}px - 1px), ${e.palette.divider} ${p}px)`,
39
+ backgroundSize: `${p}px 100%`,
40
+ backgroundRepeat: "repeat-x"
41
+ },
42
+ children: n.isMilestone ? /* @__PURE__ */ s(u, {
43
+ task: n,
44
+ left: M,
45
+ milestoneColor: O,
46
+ criticalPathColor: D,
47
+ isCritical: m.has(n.id),
48
+ onMilestoneClick: y,
49
+ theme: T
50
+ }) : /* @__PURE__ */ s(d, {
51
+ task: n,
52
+ effectiveTask: j,
53
+ left: M,
54
+ width: N,
55
+ totalWidth: f,
56
+ isDragging: A,
57
+ activeDrag: c,
58
+ draggable: h,
59
+ resizable: g,
60
+ progressDraggable: _,
61
+ isCritical: m.has(n.id),
62
+ statusColors: E,
63
+ criticalPathColor: D,
64
+ barBorderRadius: k,
65
+ onTaskClick: v,
66
+ onContextMenu: b,
67
+ suppressClickRef: x,
68
+ handleBarMouseDown: S,
69
+ handleProgressMouseDown: C,
70
+ formatDragDate: w,
71
+ theme: T
72
+ })
73
+ });
74
+ }
75
+ function u({ task: e, left: t, milestoneColor: n, criticalPathColor: r, isCritical: a, onMilestoneClick: o, theme: c }) {
76
+ return t < 0 || t > 100 ? null : /* @__PURE__ */ s(i, {
77
+ "data-testid": `gantt-milestone-${e.id}`,
78
+ sx: {
79
+ position: "absolute",
80
+ left: `${t}%`,
81
+ top: "50%",
82
+ width: 12,
83
+ height: 12,
84
+ bgcolor: n || "warning.main",
85
+ transform: "translate(-50%, -50%) rotate(45deg)",
86
+ cursor: o ? "pointer" : "default",
87
+ boxShadow: a ? `0 0 0 2.5px ${r || c.palette.error.main}` : void 0,
88
+ "&:hover": o ? { opacity: .8 } : void 0
89
+ },
90
+ onClick: () => o?.(e)
91
+ });
92
+ }
93
+ function d({ task: e, effectiveTask: t, left: r, width: a, totalWidth: l, isDragging: u, activeDrag: d, draggable: p, resizable: m, progressDraggable: h, isCritical: g, statusColors: _, criticalPathColor: v, barBorderRadius: y, onTaskClick: b, onContextMenu: x, suppressClickRef: S, handleBarMouseDown: C, handleProgressMouseDown: w, formatDragDate: T, theme: E }) {
94
+ let D = Math.max(0, r), O = Math.min(100, r + Math.max(a, .5)) - D;
95
+ return O <= 0 ? null : /* @__PURE__ */ c(o, { children: [
96
+ u && d && d.type !== "progress" && d.deltaDays !== 0 && /* @__PURE__ */ s(f, {
97
+ left: D,
98
+ children: d.type === "move" ? `${T(t.startDate)} – ${T(t.endDate)}` : `→ ${T(t.endDate)}`
99
+ }),
100
+ u && d?.type === "progress" && d.newProgress !== void 0 && /* @__PURE__ */ c(f, {
101
+ left: D,
102
+ children: [d.newProgress, "%"]
103
+ }),
104
+ /* @__PURE__ */ c(i, {
105
+ "data-testid": `gantt-bar-${e.id}`,
106
+ sx: {
107
+ position: "absolute",
108
+ left: `${D}%`,
109
+ width: `${O}%`,
110
+ height: 16,
111
+ top: "50%",
112
+ transform: "translateY(-50%)",
113
+ bgcolor: e.color ?? _?.[e.status] ?? n[e.status] ?? "grey.300",
114
+ borderRadius: y === void 0 ? 1 : `${y}px`,
115
+ overflow: "hidden",
116
+ opacity: u ? .75 : 1,
117
+ boxShadow: g ? `inset 0 0 0 2.5px ${v || E.palette.error.main}` : void 0,
118
+ cursor: u ? "grabbing" : p ? "grab" : b ? "pointer" : "default",
119
+ userSelect: "none",
120
+ "&:hover": p || b ? { opacity: u ? .75 : .8 } : void 0
121
+ },
122
+ onMouseDown: p ? (t) => C(t, e, "move") : void 0,
123
+ onContextMenu: (t) => {
124
+ t.preventDefault(), t.stopPropagation(), x(e, t.clientX, t.clientY);
125
+ },
126
+ onClick: () => {
127
+ if (S.current) {
128
+ S.current = !1;
129
+ return;
130
+ }
131
+ b?.(e);
132
+ },
133
+ children: [
134
+ t.progress !== void 0 && t.progress > 0 && /* @__PURE__ */ s(i, {
135
+ "data-testid": `gantt-progress-${e.id}`,
136
+ sx: {
137
+ position: "absolute",
138
+ left: 0,
139
+ top: 0,
140
+ width: `${Math.min(t.progress, 100)}%`,
141
+ height: "100%",
142
+ bgcolor: "currentColor",
143
+ opacity: .4
144
+ }
145
+ }),
146
+ h && /* @__PURE__ */ s(i, {
147
+ "data-testid": `gantt-progress-handle-${e.id}`,
148
+ sx: {
149
+ position: "absolute",
150
+ left: `${Math.min(t.progress ?? 0, 100)}%`,
151
+ top: 0,
152
+ width: 6,
153
+ height: "100%",
154
+ transform: "translateX(-50%)",
155
+ cursor: "ew-resize",
156
+ bgcolor: "rgba(255,255,255,0.35)"
157
+ },
158
+ onMouseDown: (n) => {
159
+ n.stopPropagation();
160
+ let r = O / 100 * l;
161
+ w(n, e, t.progress ?? 0, r);
162
+ }
163
+ }),
164
+ m && /* @__PURE__ */ s(i, {
165
+ "data-testid": `gantt-resize-handle-${e.id}`,
166
+ sx: {
167
+ position: "absolute",
168
+ right: 0,
169
+ top: 0,
170
+ width: 6,
171
+ height: "100%",
172
+ cursor: "ew-resize"
173
+ },
174
+ onMouseDown: (t) => {
175
+ t.stopPropagation(), C(t, e, "resize");
176
+ }
177
+ })
178
+ ]
179
+ })
180
+ ] });
181
+ }
182
+ function f({ left: e, children: t }) {
183
+ return /* @__PURE__ */ s(i, {
184
+ sx: {
185
+ position: "absolute",
186
+ left: `${e}%`,
187
+ top: 2,
188
+ bgcolor: "grey.800",
189
+ color: "common.white",
190
+ borderRadius: .5,
191
+ px: .75,
192
+ lineHeight: "18px",
193
+ fontSize: "0.65rem",
194
+ whiteSpace: "nowrap",
195
+ pointerEvents: "none",
196
+ zIndex: 100
197
+ },
198
+ children: t
199
+ });
200
+ }
201
+ //#endregion
202
+ export { l as GanttBarRow };
@@ -0,0 +1,14 @@
1
+ //#region src/components/gantt-chart/GanttChart.constants.ts
2
+ var e = {
3
+ planned: "warning.light",
4
+ "in-progress": "info.main",
5
+ done: "success.main",
6
+ blocked: "error.main"
7
+ }, t = {
8
+ planned: "warning",
9
+ "in-progress": "info",
10
+ done: "success",
11
+ blocked: "error"
12
+ };
13
+ //#endregion
14
+ export { e as STATUS_BAR_COLOR, t as STATUS_CHIP_COLOR };