@parallelworks/tandem-web 0.190.2 → 0.191.1

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.
@@ -0,0 +1,634 @@
1
+ import { actorAvatar as e } from "../lib/avatar.js";
2
+ import { usePeople as t } from "../lib/people.js";
3
+ import { Link as n } from "../lib/router.js";
4
+ import { StatusIcon as r } from "./icons.js";
5
+ import { Avatar as i, Button as a, SegmentedControl as o, Tooltip as s, cx as c } from "@parallelworks/ui";
6
+ import { useEffect as l, useLayoutEffect as u, useRef as d, useState as f } from "react";
7
+ import { useFormatter as p, useTranslations as m } from "use-intl";
8
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
9
+ // src/components/Gantt.tsx
10
+ var ee = [
11
+ "days",
12
+ "weeks",
13
+ "months",
14
+ "quarters"
15
+ ], te = {
16
+ days: 32,
17
+ weeks: 12,
18
+ months: 3.5,
19
+ quarters: 1.4
20
+ }, v = 864e5, y = 34, ne = 18, b = 52, x = 14, S = 10, re = 560, ie = 200, C = (e) => Math.floor(Date.parse(`${e}T00:00:00Z`) / v), w = (e) => (/* @__PURE__ */ new Date(e * v)).toISOString().slice(0, 10), ae = () => {
21
+ let e = /* @__PURE__ */ new Date();
22
+ return Math.floor(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()) / v);
23
+ };
24
+ function T(e, t, n) {
25
+ let { start: r, end: i } = e;
26
+ switch (t) {
27
+ case "move": return {
28
+ start: r === null ? null : r + n,
29
+ end: i === null ? null : i + n
30
+ };
31
+ case "start": return {
32
+ start: Math.min((r ?? i ?? 0) + n, i ?? Infinity),
33
+ end: i
34
+ };
35
+ case "end": return {
36
+ start: r,
37
+ end: Math.max((i ?? r ?? 0) + n, r ?? -Infinity)
38
+ };
39
+ }
40
+ }
41
+ function oe(e, t) {
42
+ let n = {};
43
+ return t.start !== e.start && (n.startDate = t.start === null ? "" : w(t.start)), t.end !== e.end && (n.dueDate = t.end === null ? "" : w(t.end)), n;
44
+ }
45
+ function se(e, t) {
46
+ let n = /* @__PURE__ */ new Date(e * v), r = n.getUTCFullYear(), i = n.getUTCMonth();
47
+ switch (t) {
48
+ case "day": return e;
49
+ case "week": return e - (n.getUTCDay() + 6) % 7;
50
+ case "month": return Date.UTC(r, i, 1) / v;
51
+ case "quarter": return Date.UTC(r, i - i % 3, 1) / v;
52
+ case "year": return Date.UTC(r, 0, 1) / v;
53
+ }
54
+ }
55
+ function E(e, t) {
56
+ let n = /* @__PURE__ */ new Date(e * v);
57
+ switch (t) {
58
+ case "day": return e + 1;
59
+ case "week": return e + 7;
60
+ case "month": return Date.UTC(n.getUTCFullYear(), n.getUTCMonth() + 1, 1) / v;
61
+ case "quarter": return Date.UTC(n.getUTCFullYear(), n.getUTCMonth() + 3, 1) / v;
62
+ case "year": return Date.UTC(n.getUTCFullYear() + 1, 0, 1) / v;
63
+ }
64
+ }
65
+ var ce = {
66
+ days: {
67
+ top: "month",
68
+ bottom: "day"
69
+ },
70
+ weeks: {
71
+ top: "month",
72
+ bottom: "week"
73
+ },
74
+ months: {
75
+ top: "year",
76
+ bottom: "month"
77
+ },
78
+ quarters: {
79
+ top: "year",
80
+ bottom: "quarter"
81
+ }
82
+ }, le = (e) => ({
83
+ triage: "border-status-triage/70 bg-status-triage/20",
84
+ backlog: "border-status-backlog/70 bg-status-backlog/15",
85
+ unstarted: "border-status-unstarted/60 bg-status-unstarted/15",
86
+ started: "border-status-started/70 bg-status-started/25",
87
+ review: "border-status-review/70 bg-status-review/25",
88
+ completed: "border-status-completed/70 bg-status-completed/30",
89
+ canceled: "border-status-canceled/50 bg-status-canceled/10 line-through"
90
+ })[e.status.review ? "review" : e.status.category], ue = (e) => ({
91
+ triage: "bg-status-triage",
92
+ backlog: "bg-status-backlog",
93
+ unstarted: "bg-status-unstarted",
94
+ started: "bg-status-started",
95
+ review: "bg-status-review",
96
+ completed: "bg-status-completed",
97
+ canceled: "bg-status-canceled"
98
+ })[e.status.review ? "review" : e.status.category];
99
+ function D({ workspace: w, issues: D, milestones: de, blocks: fe, canWrite: O, onSchedule: pe }) {
100
+ let k = m("planning.gantt"), me = p(), { nameOf: he, avatarOf: ge } = t(w), _e = d(null), [A, ve] = f("weeks"), [j, M] = f(null), [ye, be] = f(/* @__PURE__ */ new Map()), N = d(null), P = te[A], F = ae(), [I, xe] = f(0);
101
+ l(() => {
102
+ let e = _e.current;
103
+ if (!e) return;
104
+ let t = new ResizeObserver(() => xe(e.clientWidth));
105
+ return t.observe(e), () => t.disconnect();
106
+ }, []);
107
+ let Se = I > 0 && I < 720, L = Se ? ie : re, R = (e) => ye.get(e.id) ?? {
108
+ start: e.startDate ? C(e.startDate) : null,
109
+ end: e.dueDate ? C(e.dueDate) : null
110
+ }, z = (e) => {
111
+ let t = R(e);
112
+ return j?.id === e.id ? T(t, j.mode, j.delta) : t;
113
+ }, B = [...D].sort((e, t) => {
114
+ let n = R(e), r = R(t);
115
+ return (n.start ?? n.end ?? Infinity) - (r.start ?? r.end ?? Infinity) || e.number - t.number;
116
+ }), V = de.filter((e) => e.targetDate).sort((e, t) => C(e.targetDate ?? "") - C(t.targetDate ?? "")), Ce = [...D.flatMap((e) => [e.startDate, e.dueDate]), ...V.map((e) => e.targetDate)].filter((e) => !!e).map(C), { top: H, bottom: U } = ce[A], we = {
117
+ days: 45,
118
+ weeks: 120,
119
+ months: 400,
120
+ quarters: 900
121
+ }[A], W = se(Math.min(F - we / 4, ...Ce) - 7, H), G = E(Math.max(F + we, ...Ce) + 14, H), K = (e) => (e - W) * P, Te = K(G), q = (e) => {
122
+ let t = [];
123
+ for (let n = se(W, e); n < G; n = E(n, e)) n >= W && t.push(n);
124
+ return t;
125
+ }, J = (e, t) => me.dateTime(/* @__PURE__ */ new Date(e * v), {
126
+ ...t,
127
+ timeZone: "UTC"
128
+ }), Ee = (e, t) => {
129
+ switch (t) {
130
+ case "day":
131
+ case "week": return J(e, { day: "numeric" });
132
+ case "month": return J(e, { month: "short" });
133
+ case "quarter": return k("quarter", { number: Math.floor((/* @__PURE__ */ new Date(e * v)).getUTCMonth() / 3) + 1 });
134
+ case "year": return J(e, { year: "numeric" });
135
+ }
136
+ }, De = (e) => H === "month" ? J(e, {
137
+ month: "long",
138
+ year: "numeric"
139
+ }) : Ee(e, "year"), Y = (e) => e.start !== null && e.end !== null && e.start !== e.end ? `${J(e.start, {
140
+ month: "short",
141
+ day: "numeric"
142
+ })} – ${J(e.end, {
143
+ month: "short",
144
+ day: "numeric",
145
+ year: "numeric"
146
+ })}` : J(e.start ?? e.end, {
147
+ month: "short",
148
+ day: "numeric",
149
+ year: "numeric"
150
+ }), Oe = (e = "smooth") => {
151
+ let t = _e.current;
152
+ t && t.scrollTo({
153
+ left: K(F) - (t.clientWidth - L) / 3,
154
+ behavior: e
155
+ });
156
+ };
157
+ u(() => Oe("instant"), [A]);
158
+ let ke = (e, t, n) => {
159
+ let r = oe(t, n);
160
+ Object.keys(r).length !== 0 && (be((t) => new Map(t).set(e.id, n)), pe(e, r).finally(() => be((t) => {
161
+ let n = new Map(t);
162
+ return n.delete(e.id), n;
163
+ })));
164
+ }, Ae = (e, t, n) => {
165
+ O && e.button === 0 && (e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture(e.pointerId), N.current = {
166
+ id: t.id,
167
+ mode: n,
168
+ x: e.clientX
169
+ }, M({
170
+ id: t.id,
171
+ mode: n,
172
+ delta: 0
173
+ }));
174
+ }, je = (e) => {
175
+ let t = N.current;
176
+ if (!t) return;
177
+ let n = Math.round((e.clientX - t.x) / P);
178
+ M((e) => e && e.delta !== n ? {
179
+ ...e,
180
+ delta: n
181
+ } : e);
182
+ }, Me = j !== null;
183
+ l(() => {
184
+ if (!Me) return;
185
+ let e = (e) => {
186
+ e.key === "Escape" && (N.current = null, M(null));
187
+ };
188
+ return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
189
+ }, [Me]);
190
+ let Ne = () => {
191
+ let e = N.current;
192
+ N.current = null;
193
+ let t = e && D.find((t) => t.id === e.id);
194
+ if (!t || !j || j.id !== t.id) return M(null);
195
+ let n = R(t);
196
+ M(null), j.delta !== 0 && ke(t, n, T(n, j.mode, j.delta));
197
+ }, Pe = (e, t) => {
198
+ if (!O || e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
199
+ e.preventDefault();
200
+ let n = z(t), r = (e.key === "ArrowLeft" ? -1 : 1) * (A === "days" ? 1 : 7);
201
+ ke(t, n, T(n, e.shiftKey ? "end" : e.altKey ? "start" : "move", r));
202
+ }, Fe = new Map(B.map((e, t) => [e.id, t])), Ie = (B.length + V.length) * y, X = (e) => {
203
+ let t = e.start ?? e.end, n = e.end ?? e.start;
204
+ if (t === null || n === null) return null;
205
+ if (e.start === null || e.end === null) {
206
+ let e = K(t) + P / 2;
207
+ return {
208
+ left: e - S / 2,
209
+ right: e + S / 2,
210
+ point: !0
211
+ };
212
+ }
213
+ return {
214
+ left: K(t),
215
+ right: Math.max(K(n + 1), K(t) + 6),
216
+ point: !1
217
+ };
218
+ }, Le = (e) => {
219
+ let t = z(e), n = X(t);
220
+ if (!n) return null;
221
+ let r = e.assignees[0], i = r ? he(r.kind, r.handle) : "", a = !n.point && n.right - n.left >= e.title.length * 6.4 + 20, o = (r ? 22 : 0) + (a ? 0 : e.title.length * 6.6 + 6) + i.length * 6.2;
222
+ return [n.left - 4, n.right + x + o + 4];
223
+ }, Re = fe.flatMap((e) => {
224
+ let t = Fe.get(e.blocker), n = Fe.get(e.blocked);
225
+ if (t === void 0 || n === void 0 || t === n) return [];
226
+ let r = z(B[t]), i = z(B[n]), a = X(r), o = X(i);
227
+ if (!a || !o) return [];
228
+ let s = r.end ?? r.start, c = i.start ?? i.end, l = n > t, u = t * y + y / 2, d = n * y + y / 2, f = l ? (t + 1) * y : t * y, p = l ? n * y : (n + 1) * y, m = a.right + 6, h = o.left - 8, g = `M${a.right},${u} H${m} V${f}`;
229
+ if (f !== p) {
230
+ let e = B.slice(Math.min(t, n) + 1, Math.max(t, n)).flatMap((e) => {
231
+ let t = Le(e);
232
+ return t ? [t] : [];
233
+ }), r = (t) => e.every(([e, n]) => t < e || t > n), i = [h, ...Array.from({ length: 160 }, (e, t) => h + (t % 2 ? 1 : -1) * (Math.floor(t / 2) + 1) * 6)].find((e) => e > 0 && r(e)) ?? h;
234
+ g += ` H${i} V${p}`;
235
+ }
236
+ return g += ` H${h} V${d} H${o.left - 1}`, [{
237
+ key: `${e.blocker}-${e.blocked}`,
238
+ path: g,
239
+ late: c <= s
240
+ }];
241
+ }), Z = Math.max(Te, I - L), ze = (e) => [0, 6].includes((/* @__PURE__ */ new Date(e * v)).getUTCDay()), Be = A === "days" || A === "weeks" ? q("month") : [], Q = "flex min-w-0 items-center text-xs text-muted-foreground", $ = Se ? "grid-cols-[minmax(0,1fr)] [&>*:not(:first-child)]:hidden" : "grid-cols-[minmax(0,1fr)_7.5rem_2rem_4.5rem_4.5rem]";
242
+ return /* @__PURE__ */ _("div", {
243
+ className: "flex h-full min-h-0 flex-col",
244
+ children: [/* @__PURE__ */ _("div", {
245
+ className: "flex shrink-0 items-center gap-2 border-b border-border px-4 py-2 md:px-5",
246
+ children: [
247
+ /* @__PURE__ */ g(a, {
248
+ type: "button",
249
+ size: "xs",
250
+ onClick: () => Oe(),
251
+ children: k("today")
252
+ }),
253
+ /* @__PURE__ */ g(o, {
254
+ label: k("zoom"),
255
+ size: "sm",
256
+ value: A,
257
+ onValueChange: ve,
258
+ options: ee.map((e) => ({
259
+ value: e,
260
+ label: k(`zooms.${e}`)
261
+ }))
262
+ }),
263
+ O && /* @__PURE__ */ g("span", {
264
+ className: "ml-auto hidden text-xs text-muted-foreground md:block",
265
+ children: k("hint")
266
+ })
267
+ ]
268
+ }), /* @__PURE__ */ g("div", {
269
+ ref: _e,
270
+ className: "relative min-h-0 flex-1 overflow-auto",
271
+ children: /* @__PURE__ */ _("div", {
272
+ className: "relative",
273
+ style: {
274
+ width: L + Z,
275
+ minHeight: "100%"
276
+ },
277
+ children: [
278
+ /* @__PURE__ */ g("div", {
279
+ "aria-hidden": "true",
280
+ className: "pointer-events-none sticky left-0 z-[3] float-left -mb-[100vh] h-full min-h-[100vh] border-r border-border bg-background",
281
+ style: { width: L }
282
+ }),
283
+ /* @__PURE__ */ _("div", {
284
+ className: "sticky top-0 z-[4] flex border-b border-border bg-background",
285
+ style: { height: b },
286
+ children: [/* @__PURE__ */ _("div", {
287
+ className: `sticky left-0 z-[4] grid shrink-0 ${$} items-end gap-2 border-r border-border bg-background px-4 pb-2 text-xs text-muted-foreground`,
288
+ style: { width: L },
289
+ children: [
290
+ /* @__PURE__ */ g("span", { children: k("subject") }),
291
+ /* @__PURE__ */ g("span", { children: k("status") }),
292
+ /* @__PURE__ */ g("span", { children: /* @__PURE__ */ g("span", {
293
+ className: "sr-only",
294
+ children: k("assignee")
295
+ }) }),
296
+ /* @__PURE__ */ g("span", { children: k("start") }),
297
+ /* @__PURE__ */ g("span", { children: k("finish") })
298
+ ]
299
+ }), /* @__PURE__ */ _("div", {
300
+ className: "relative",
301
+ style: { width: Z },
302
+ "aria-hidden": "true",
303
+ children: [
304
+ /* @__PURE__ */ g("div", {
305
+ className: "absolute inset-x-0 top-0 h-1/2 border-b border-border/60",
306
+ children: [W, ...q(H).filter((e) => e > W)].map((e) => /* @__PURE__ */ g("div", {
307
+ className: "absolute inset-y-0 flex items-center border-l border-border/70",
308
+ style: {
309
+ left: K(e),
310
+ width: K(E(e, H)) - K(e)
311
+ },
312
+ children: /* @__PURE__ */ g("span", {
313
+ className: "sticky truncate px-2 text-[11px] font-medium text-foreground",
314
+ style: { left: L },
315
+ children: De(e)
316
+ })
317
+ }, `t${e}`))
318
+ }),
319
+ q(U).map((e) => /* @__PURE__ */ g("span", {
320
+ className: c("absolute bottom-0 flex h-1/2 items-center justify-center overflow-hidden text-[11px] text-muted-foreground tabular-nums", A === "days" && ze(e) && "bg-muted/60"),
321
+ style: {
322
+ left: K(e),
323
+ width: K(E(e, U)) - K(e)
324
+ },
325
+ children: Ee(e, U)
326
+ }, `b${e}`)),
327
+ F >= W && F < G && /* @__PURE__ */ g("span", {
328
+ className: "absolute bottom-1 z-[1] -translate-x-1/2 rounded-full bg-primary px-1.5 text-[10px] leading-4 font-medium text-primary-foreground",
329
+ style: { left: K(F) + P / 2 },
330
+ children: k("today")
331
+ })
332
+ ]
333
+ })]
334
+ }),
335
+ A === "days" && q("day").filter(ze).map((e) => /* @__PURE__ */ g("div", {
336
+ "aria-hidden": "true",
337
+ className: "pointer-events-none absolute bottom-0 bg-muted/40",
338
+ style: {
339
+ left: L + K(e),
340
+ width: P,
341
+ top: b
342
+ }
343
+ }, `w${e}`)),
344
+ q(U).map((e) => /* @__PURE__ */ g("div", {
345
+ "aria-hidden": "true",
346
+ className: "pointer-events-none absolute bottom-0 w-px bg-border/35",
347
+ style: {
348
+ left: L + K(e),
349
+ top: b
350
+ }
351
+ }, `g${e}`)),
352
+ Be.map((e) => /* @__PURE__ */ g("div", {
353
+ "aria-hidden": "true",
354
+ className: "pointer-events-none absolute bottom-0 w-px bg-border/80",
355
+ style: {
356
+ left: L + K(e),
357
+ top: b
358
+ }
359
+ }, `m${e}`)),
360
+ V.map((e) => /* @__PURE__ */ g("div", {
361
+ "aria-hidden": "true",
362
+ className: "pointer-events-none absolute bottom-0 border-l border-dashed border-foreground/25",
363
+ style: {
364
+ left: L + K(C(e.targetDate ?? "")) + P / 2,
365
+ top: b
366
+ }
367
+ }, `guide${e.id}`)),
368
+ F >= W && F < G && /* @__PURE__ */ g("div", {
369
+ "aria-hidden": "true",
370
+ className: "pointer-events-none absolute bottom-0 z-[2] w-px bg-primary/70",
371
+ style: {
372
+ left: L + K(F) + P / 2,
373
+ top: b
374
+ }
375
+ }),
376
+ /* @__PURE__ */ _("svg", {
377
+ "aria-hidden": "true",
378
+ className: "pointer-events-none absolute z-[2] overflow-visible",
379
+ style: {
380
+ left: L,
381
+ top: b
382
+ },
383
+ width: Z,
384
+ height: Ie,
385
+ children: [/* @__PURE__ */ g("defs", { children: ["arrow", "late"].map((e) => /* @__PURE__ */ g("marker", {
386
+ id: `gantt-${e}`,
387
+ viewBox: "0 0 6 6",
388
+ refX: "5",
389
+ refY: "3",
390
+ markerWidth: "5",
391
+ markerHeight: "5",
392
+ orient: "auto",
393
+ children: /* @__PURE__ */ g("path", {
394
+ d: "M0,0 L6,3 L0,6 z",
395
+ className: e === "late" ? "fill-danger" : "fill-muted-foreground"
396
+ })
397
+ }, e)) }), Re.map((e) => /* @__PURE__ */ g("path", {
398
+ d: e.path,
399
+ fill: "none",
400
+ strokeWidth: 1,
401
+ strokeLinejoin: "round",
402
+ className: e.late ? "stroke-danger" : "stroke-muted-foreground/70",
403
+ markerEnd: `url(#gantt-${e.late ? "late" : "arrow"})`
404
+ }, e.key))]
405
+ }),
406
+ /* @__PURE__ */ _("div", {
407
+ className: "relative",
408
+ children: [
409
+ B.length === 0 && V.length === 0 && /* @__PURE__ */ g("p", {
410
+ className: "sticky left-0 px-4 py-6 text-sm text-muted-foreground",
411
+ style: { width: L },
412
+ children: k("empty")
413
+ }),
414
+ B.map((t) => {
415
+ let a = z(t), o = X(a), l = t.assignees[0], u = l ? he(l.kind, l.handle) : "", d = j?.id === t.id, f = o ? o.right - o.left : 0, p = !!o && !o.point && f >= t.title.length * 6.4 + 20, m = /* @__PURE__ */ _("span", {
416
+ className: "block max-w-64 space-y-0.5",
417
+ children: [
418
+ /* @__PURE__ */ _("span", {
419
+ className: "block font-medium",
420
+ children: [
421
+ t.identifier,
422
+ " ",
423
+ t.title
424
+ ]
425
+ }),
426
+ /* @__PURE__ */ g("span", {
427
+ className: "block text-muted-foreground tabular-nums",
428
+ children: Y(a)
429
+ }),
430
+ u && /* @__PURE__ */ g("span", {
431
+ className: "block text-muted-foreground",
432
+ children: u
433
+ })
434
+ ]
435
+ });
436
+ return /* @__PURE__ */ _("div", {
437
+ className: "group flex border-b border-border/50 hover:bg-muted/40",
438
+ style: { height: y },
439
+ children: [/* @__PURE__ */ _("div", {
440
+ className: `sticky left-0 z-[3] grid shrink-0 ${$} items-center gap-2 border-r border-border bg-background px-4 group-hover:bg-muted`,
441
+ style: { width: L },
442
+ children: [
443
+ /* @__PURE__ */ _("span", {
444
+ className: "flex min-w-0 items-center gap-2 text-sm",
445
+ children: [/* @__PURE__ */ g("span", {
446
+ className: "shrink-0 text-xs text-muted-foreground tabular-nums",
447
+ children: t.identifier
448
+ }), /* @__PURE__ */ g(n, {
449
+ to: "/$workspace/issues/$identifier",
450
+ params: {
451
+ workspace: w,
452
+ identifier: t.identifier
453
+ },
454
+ className: "truncate hover:underline",
455
+ children: t.title
456
+ })]
457
+ }),
458
+ /* @__PURE__ */ _("span", {
459
+ className: Q,
460
+ children: [/* @__PURE__ */ g(r, {
461
+ category: t.status.category,
462
+ review: t.status.review,
463
+ step: t.status.step,
464
+ className: "mr-1.5 shrink-0"
465
+ }), /* @__PURE__ */ g("span", {
466
+ className: "truncate",
467
+ children: t.status.name
468
+ })]
469
+ }),
470
+ /* @__PURE__ */ g("span", {
471
+ className: Q,
472
+ children: l && /* @__PURE__ */ g(i, {
473
+ size: "xs",
474
+ ...e(l.kind),
475
+ name: u,
476
+ src: ge(l.kind, l.handle)
477
+ })
478
+ }),
479
+ /* @__PURE__ */ g("span", {
480
+ className: `${Q} tabular-nums`,
481
+ children: a.start !== null && J(a.start, {
482
+ month: "short",
483
+ day: "numeric"
484
+ })
485
+ }),
486
+ /* @__PURE__ */ g("span", {
487
+ className: `${Q} tabular-nums`,
488
+ children: a.end !== null && J(a.end, {
489
+ month: "short",
490
+ day: "numeric"
491
+ })
492
+ })
493
+ ]
494
+ }), /* @__PURE__ */ _("div", {
495
+ className: "relative",
496
+ style: { width: Z },
497
+ children: [o && /* @__PURE__ */ g(s, {
498
+ content: m,
499
+ children: /* @__PURE__ */ _("div", {
500
+ role: "slider",
501
+ tabIndex: 0,
502
+ "aria-label": k("bar", { issue: `${t.identifier} ${t.title}` }),
503
+ "aria-valuetext": Y(a),
504
+ "aria-valuenow": a.start ?? a.end,
505
+ "aria-readonly": !O,
506
+ onKeyDown: (e) => Pe(e, t),
507
+ onPointerDown: (e) => Ae(e, t, "move"),
508
+ onPointerMove: je,
509
+ onPointerUp: Ne,
510
+ onPointerCancel: () => {
511
+ N.current = null, M(null);
512
+ },
513
+ className: c("absolute z-[1] flex items-center outline-none transition-shadow hover:shadow-sm focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1", o.point ? `rounded-full ring-2 ring-background ${ue(t)}` : `overflow-hidden rounded-[5px] border ${le(t)} hover:brightness-95`, O && (d ? "cursor-grabbing" : "cursor-grab"), ye.has(t.id) && "animate-pulse"),
514
+ style: o.point ? {
515
+ left: o.left,
516
+ width: S,
517
+ height: S,
518
+ top: 12
519
+ } : {
520
+ left: o.left,
521
+ width: f,
522
+ height: ne,
523
+ top: 8
524
+ },
525
+ children: [p && /* @__PURE__ */ g("span", {
526
+ className: "pointer-events-none truncate px-2 text-[11px] leading-none font-medium text-foreground",
527
+ children: t.title
528
+ }), O && !o.point && ["start", "end"].map((e) => /* @__PURE__ */ g("span", {
529
+ "aria-hidden": "true",
530
+ onPointerDown: (n) => Ae(n, t, e),
531
+ onPointerMove: je,
532
+ onPointerUp: Ne,
533
+ className: c("absolute inset-y-0 w-2 cursor-ew-resize opacity-0 group-hover:opacity-100 hover:bg-foreground/15", e === "start" ? "left-0" : "right-0")
534
+ }, e))]
535
+ })
536
+ }), o && /* @__PURE__ */ g("span", {
537
+ "aria-hidden": "true",
538
+ className: "pointer-events-none absolute top-1/2 flex -translate-y-1/2 items-center gap-1.5 text-xs whitespace-nowrap text-muted-foreground",
539
+ style: { left: o.right + x },
540
+ children: d ? /* @__PURE__ */ g("span", {
541
+ className: "tabular-nums",
542
+ children: Y(a)
543
+ }) : /* @__PURE__ */ _(h, { children: [
544
+ l && /* @__PURE__ */ g(i, {
545
+ size: "xs",
546
+ ...e(l.kind),
547
+ name: u,
548
+ src: ge(l.kind, l.handle),
549
+ decorative: !0
550
+ }),
551
+ !p && /* @__PURE__ */ g("span", {
552
+ className: "text-foreground",
553
+ children: t.title
554
+ }),
555
+ u && /* @__PURE__ */ g("span", { children: u })
556
+ ] })
557
+ })]
558
+ })]
559
+ }, t.id);
560
+ }),
561
+ V.map((e, t) => {
562
+ let n = C(e.targetDate ?? "");
563
+ return /* @__PURE__ */ _("div", {
564
+ className: c("group flex border-b border-border/50 hover:bg-muted/40", t === 0 && B.length > 0 && "border-t border-t-border"),
565
+ style: { height: y },
566
+ children: [/* @__PURE__ */ _("div", {
567
+ className: `sticky left-0 z-[3] grid shrink-0 ${$} items-center gap-2 border-r border-border bg-background px-4 group-hover:bg-muted`,
568
+ style: { width: L },
569
+ children: [
570
+ /* @__PURE__ */ _("span", {
571
+ className: "flex min-w-0 items-center gap-2 text-sm",
572
+ children: [/* @__PURE__ */ g("span", {
573
+ "aria-hidden": "true",
574
+ className: "ml-0.5 size-2 shrink-0 rotate-45 rounded-[1px] bg-foreground/70"
575
+ }), /* @__PURE__ */ g("span", {
576
+ className: "truncate",
577
+ children: e.name
578
+ })]
579
+ }),
580
+ /* @__PURE__ */ g("span", {
581
+ className: `${Q} tabular-nums`,
582
+ children: e.progress.total > 0 && k("milestoneDone", {
583
+ done: e.progress.completed,
584
+ total: e.progress.total
585
+ })
586
+ }),
587
+ /* @__PURE__ */ g("span", {}),
588
+ /* @__PURE__ */ g("span", {}),
589
+ /* @__PURE__ */ g("span", {
590
+ className: `${Q} tabular-nums`,
591
+ children: J(n, {
592
+ month: "short",
593
+ day: "numeric"
594
+ })
595
+ })
596
+ ]
597
+ }), /* @__PURE__ */ _("div", {
598
+ className: "relative",
599
+ style: { width: Z },
600
+ children: [/* @__PURE__ */ g(s, {
601
+ content: `${e.name}, ${J(n, {
602
+ month: "short",
603
+ day: "numeric",
604
+ year: "numeric"
605
+ })}`,
606
+ children: /* @__PURE__ */ g("span", {
607
+ role: "img",
608
+ "aria-label": k("milestone", {
609
+ name: e.name,
610
+ date: Y({
611
+ start: n,
612
+ end: n
613
+ })
614
+ }),
615
+ className: "absolute top-1/2 z-[1] size-2.5 -translate-x-1/2 -translate-y-1/2 rotate-45 rounded-[1px] bg-foreground/80 ring-2 ring-background",
616
+ style: { left: K(n) + P / 2 }
617
+ })
618
+ }), /* @__PURE__ */ g("span", {
619
+ "aria-hidden": "true",
620
+ className: "pointer-events-none absolute top-1/2 -translate-y-1/2 text-xs whitespace-nowrap text-muted-foreground",
621
+ style: { left: K(n) + P / 2 + x },
622
+ children: e.name
623
+ })]
624
+ })]
625
+ }, e.id);
626
+ })
627
+ ]
628
+ })
629
+ ]
630
+ })
631
+ })]
632
+ });
633
+ }
634
+ export { D as Gantt };