@burdenoff/microfe-planmagnet 2026.928.11 → 2026.930.2

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 (31) hide show
  1. package/dist/generated/global-types.d.ts +43 -1
  2. package/dist/generated/global-types.d.ts.map +1 -1
  3. package/dist/planmagnet/milestones/MilestoneControls.d.ts +41 -0
  4. package/dist/planmagnet/milestones/MilestoneControls.d.ts.map +1 -0
  5. package/dist/planmagnet/milestones/MilestoneControls.js +420 -0
  6. package/dist/planmagnet/milestones/MilestoneControls.js.map +1 -0
  7. package/dist/planmagnet/pages/AnalyticsAnalyticsPagePage.d.ts.map +1 -1
  8. package/dist/planmagnet/pages/AnalyticsAnalyticsPagePage.js +60 -57
  9. package/dist/planmagnet/pages/AnalyticsAnalyticsPagePage.js.map +1 -1
  10. package/dist/planmagnet/pages/ProjectsMilestoneDetailPagePage.d.ts.map +1 -1
  11. package/dist/planmagnet/pages/ProjectsMilestoneDetailPagePage.js +116 -89
  12. package/dist/planmagnet/pages/ProjectsMilestoneDetailPagePage.js.map +1 -1
  13. package/dist/planmagnet/pages/ProjectsMilestonesPagePage.d.ts.map +1 -1
  14. package/dist/planmagnet/pages/ProjectsMilestonesPagePage.js +68 -50
  15. package/dist/planmagnet/pages/ProjectsMilestonesPagePage.js.map +1 -1
  16. package/dist/planmagnet/pages/TasksCreateTaskPagePage.d.ts.map +1 -1
  17. package/dist/planmagnet/pages/TasksCreateTaskPagePage.js +151 -134
  18. package/dist/planmagnet/pages/TasksCreateTaskPagePage.js.map +1 -1
  19. package/dist/planmagnet/pages/TasksEditTaskPagePage.d.ts.map +1 -1
  20. package/dist/planmagnet/pages/TasksEditTaskPagePage.js +149 -126
  21. package/dist/planmagnet/pages/TasksEditTaskPagePage.js.map +1 -1
  22. package/dist/planmagnet/pages/TasksTaskDetailPagePage.d.ts.map +1 -1
  23. package/dist/planmagnet/pages/TasksTaskDetailPagePage.js +150 -137
  24. package/dist/planmagnet/pages/TasksTaskDetailPagePage.js.map +1 -1
  25. package/dist/planmagnet/pages/TeamTeamPagePage.d.ts.map +1 -1
  26. package/dist/planmagnet/pages/TeamTeamPagePage.js +57 -23
  27. package/dist/planmagnet/pages/TeamTeamPagePage.js.map +1 -1
  28. package/dist/planmagnet/sprints/SprintControls.d.ts.map +1 -1
  29. package/dist/planmagnet/sprints/SprintControls.js +312 -179
  30. package/dist/planmagnet/sprints/SprintControls.js.map +1 -1
  31. package/package.json +1 -1
@@ -2,14 +2,14 @@ import { usePlanMagnet as e } from "../providers/PlanMagnetProvider.js";
2
2
  import { throwOnError as t } from "../utils/mutationResult.js";
3
3
  import { ConfirmButton as n, ErrorLine as r } from "../controls/ConfirmButton.js";
4
4
  import { TeamSelect as i } from "../controls/Pickers.js";
5
- import { useDeferredValue as a, useEffect as o, useState as s } from "react";
6
- import { CheckCircle2 as c, Play as l, Plus as u, X as d, XCircle as f } from "lucide-react";
7
- import { gql as p } from "@apollo/client";
8
- import { useApolloClient as m, useMutation as h, useQuery as g } from "@apollo/client/react";
9
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
10
- import { Badge as y, Button as b, Checkbox as x, Input as S, ResponsiveDialog as C, ResponsiveDialogContent as w, ResponsiveDialogDescription as T, ResponsiveDialogFooter as E, ResponsiveDialogHeader as D, ResponsiveDialogTitle as O, ResponsiveDialogTrigger as k } from "@burdenoff/fe-libs/ui";
5
+ import { Fragment as a, useDeferredValue as o, useEffect as s, useState as c } from "react";
6
+ import { CheckCircle2 as l, Play as u, Plus as d, X as f, XCircle as p } from "lucide-react";
7
+ import { gql as m } from "@apollo/client";
8
+ import { useApolloClient as h, useMutation as g, useQuery as _ } from "@apollo/client/react";
9
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
10
+ import { Badge as b, Button as x, Checkbox as S, Input as C, ResponsiveDialog as w, ResponsiveDialogContent as T, ResponsiveDialogDescription as E, ResponsiveDialogFooter as D, ResponsiveDialogHeader as O, ResponsiveDialogTitle as k, ResponsiveDialogTrigger as A } from "@burdenoff/fe-libs/ui";
11
11
  //#region src/planmagnet/sprints/SprintControls.tsx
12
- var A = {
12
+ var j = {
13
13
  start: ["PLANNING"],
14
14
  complete: ["ACTIVE", "REVIEW"],
15
15
  cancel: [
@@ -18,32 +18,164 @@ var A = {
18
18
  "REVIEW"
19
19
  ]
20
20
  };
21
- function j(e) {
22
- return Object.keys(A).filter((t) => A[t].includes(e));
23
- }
24
21
  function M(e) {
22
+ return Object.keys(j).filter((t) => j[t].includes(e));
23
+ }
24
+ function N(e) {
25
25
  return e === "COMPLETED" || e === "CANCELLED";
26
26
  }
27
- var N = [
27
+ var P = [
28
28
  "GetSprints",
29
29
  "GetSprintDetail",
30
30
  "GetSprintForEdit",
31
31
  "GetDashboardData"
32
- ], P = p`
32
+ ], F = m`
33
33
  mutation SprintControlsStart($id: ID!) {
34
34
  planmagnetStartSprint(id: $id) {
35
35
  id
36
36
  status
37
37
  }
38
38
  }
39
- `, F = p`
40
- mutation SprintControlsComplete($id: ID!) {
41
- planmagnetCompleteSprint(id: $id) {
39
+ `, I = m`
40
+ mutation SprintControlsComplete($id: ID!, $input: PlanmagnetCompleteSprintInput) {
41
+ planmagnetCompleteSprint(id: $id, input: $input) {
42
42
  id
43
43
  status
44
44
  }
45
45
  }
46
- `, I = p`
46
+ `, L = m`
47
+ query SprintControlsCompleteScope($id: ID!) {
48
+ planmagnetSprint(id: $id) {
49
+ id
50
+ projectId
51
+ teamId
52
+ }
53
+ }
54
+ `, R = m`
55
+ query SprintControlsCompleteTargets($workspaceId: ID!, $projectId: String, $teamId: String) {
56
+ planmagnetSprints(
57
+ workspaceId: $workspaceId
58
+ filter: { projectId: $projectId, teamId: $teamId }
59
+ pagination: { first: 100 }
60
+ ) {
61
+ items {
62
+ id
63
+ name
64
+ status
65
+ }
66
+ }
67
+ }
68
+ `;
69
+ function z({ sprintId: t, sprintName: n, disabled: r, error: i, onComplete: o }) {
70
+ let { workspaceId: s } = e(), [u, d] = c(!1), [f, p] = c("MOVE_TO_BACKLOG"), [m, h] = c(""), g = _(L, {
71
+ variables: { id: t },
72
+ skip: !u
73
+ }).data?.planmagnetSprint, b = _(R, {
74
+ variables: {
75
+ workspaceId: s,
76
+ projectId: g?.teamId ? null : g?.projectId ?? null,
77
+ teamId: g?.teamId ?? null
78
+ },
79
+ skip: !u || !g || !s
80
+ }), S = (b.data?.planmagnetSprints.items ?? []).filter((e) => e.id !== t && e.status !== "COMPLETED" && e.status !== "CANCELLED"), C = f !== "MOVE_TO_SPRINT" || m !== "", j = async () => {
81
+ await o(f === "MOVE_TO_SPRINT" ? {
82
+ openItems: f,
83
+ targetSprintId: m
84
+ } : { openItems: f }) && d(!1);
85
+ };
86
+ return /* @__PURE__ */ y(w, {
87
+ open: u,
88
+ onOpenChange: d,
89
+ children: [/* @__PURE__ */ v(A, {
90
+ asChild: !0,
91
+ children: /* @__PURE__ */ y(x, {
92
+ size: "sm",
93
+ disabled: r,
94
+ "data-testid": "sprint-complete-open",
95
+ children: [/* @__PURE__ */ v(l, { className: "mr-1 h-4 w-4" }), "Complete sprint"]
96
+ })
97
+ }), /* @__PURE__ */ y(T, {
98
+ className: "max-w-lg",
99
+ children: [
100
+ /* @__PURE__ */ y(O, { children: [/* @__PURE__ */ y(k, { children: [
101
+ "Complete ",
102
+ n,
103
+ "?"
104
+ ] }), /* @__PURE__ */ v(E, { children: "The sprint is closed and cannot be reopened. Choose what happens to work items that are not done or cancelled." })] }),
105
+ /* @__PURE__ */ y("fieldset", {
106
+ className: "space-y-2",
107
+ "data-testid": "sprint-complete-choice",
108
+ children: [/* @__PURE__ */ v("legend", {
109
+ className: "sr-only",
110
+ children: "Unfinished work items"
111
+ }), [
112
+ ["MOVE_TO_BACKLOG", "Return them to the backlog"],
113
+ ["MOVE_TO_SPRINT", "Carry them into another sprint"],
114
+ ["KEEP_IN_SPRINT", "Keep them in this sprint's record"]
115
+ ].map(([e, t]) => /* @__PURE__ */ y(a, { children: [/* @__PURE__ */ y("label", {
116
+ className: "flex items-center gap-2 text-sm cursor-pointer",
117
+ children: [/* @__PURE__ */ v("input", {
118
+ type: "radio",
119
+ name: "sprint-open-items",
120
+ value: e,
121
+ checked: f === e,
122
+ onChange: () => p(e)
123
+ }), t]
124
+ }), e === "MOVE_TO_SPRINT" && f === "MOVE_TO_SPRINT" && /* @__PURE__ */ y("div", {
125
+ className: "pl-6",
126
+ children: [
127
+ /* @__PURE__ */ v("label", {
128
+ htmlFor: "sprint-complete-target",
129
+ className: "text-xs text-muted-foreground",
130
+ children: "Sprint to carry them into"
131
+ }),
132
+ /* @__PURE__ */ y("select", {
133
+ id: "sprint-complete-target",
134
+ className: "mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
135
+ value: m,
136
+ onChange: (e) => h(e.target.value),
137
+ "data-testid": "sprint-complete-target",
138
+ children: [/* @__PURE__ */ v("option", {
139
+ value: "",
140
+ children: "Choose a sprint…"
141
+ }), S.map((e) => /* @__PURE__ */ y("option", {
142
+ value: e.id,
143
+ children: [
144
+ e.name,
145
+ " (",
146
+ e.status.toLowerCase(),
147
+ ")"
148
+ ]
149
+ }, e.id))]
150
+ }),
151
+ b.data && S.length === 0 && /* @__PURE__ */ v("p", {
152
+ className: "mt-1 text-xs text-muted-foreground",
153
+ children: "No other unfinished sprint in this project or team."
154
+ })
155
+ ]
156
+ })] }, e))]
157
+ }),
158
+ i && /* @__PURE__ */ v("p", {
159
+ role: "alert",
160
+ className: "text-sm text-destructive",
161
+ "data-testid": "sprint-complete-error",
162
+ children: i
163
+ }),
164
+ /* @__PURE__ */ y(D, { children: [/* @__PURE__ */ v(x, {
165
+ variant: "outline",
166
+ onClick: () => d(!1),
167
+ children: "Keep it open"
168
+ }), /* @__PURE__ */ v(x, {
169
+ onClick: () => void j(),
170
+ disabled: r || !C,
171
+ "data-testid": "sprint-complete-confirm",
172
+ children: "Complete sprint"
173
+ })] })
174
+ ]
175
+ })]
176
+ });
177
+ }
178
+ var B = m`
47
179
  mutation SprintControlsCancel($id: ID!) {
48
180
  planmagnetCancelSprint(id: $id) {
49
181
  id
@@ -51,69 +183,70 @@ var N = [
51
183
  }
52
184
  }
53
185
  `;
54
- function L({ sprintId: e, sprintName: i, status: a }) {
186
+ function V({ sprintId: e, sprintName: i, status: a }) {
55
187
  let o = {
56
- refetchQueries: N,
188
+ refetchQueries: P,
57
189
  awaitRefetchQueries: !0
58
- }, [u, d] = h(P, o), [p, m] = h(F, o), [g, y] = h(I, o), [x, S] = s(null), C = d.loading || m.loading || y.loading, w = j(a);
59
- if (w.length === 0) return x ? /* @__PURE__ */ _(r, { message: x }) : null;
60
- let T = async (n) => {
61
- S(null);
190
+ }, [s, l] = g(F, o), [d, f] = g(I, o), [m, h] = g(B, o), [_, b] = c(null), S = l.loading || f.loading || h.loading, C = M(a);
191
+ if (C.length === 0) return _ ? /* @__PURE__ */ v(r, { message: _ }) : null;
192
+ let w = async (n, r) => {
193
+ b(null);
62
194
  try {
63
- await t(n({ variables: { id: e } }));
195
+ return await t(n({ variables: {
196
+ id: e,
197
+ ...r ? { input: r } : {}
198
+ } })), !0;
64
199
  } catch (e) {
65
- S(e instanceof Error ? e.message : "The sprint could not be updated.");
200
+ return b(e instanceof Error ? e.message : "The sprint could not be updated."), !1;
66
201
  }
67
202
  };
68
- return /* @__PURE__ */ v("div", {
203
+ return /* @__PURE__ */ y("div", {
69
204
  className: "flex flex-col items-end gap-2",
70
205
  "data-testid": "sprint-lifecycle-actions",
71
- children: [/* @__PURE__ */ v("div", {
206
+ children: [/* @__PURE__ */ y("div", {
72
207
  className: "flex gap-2",
73
208
  children: [
74
- w.includes("start") && /* @__PURE__ */ v(b, {
209
+ C.includes("start") && /* @__PURE__ */ y(x, {
75
210
  size: "sm",
76
- onClick: () => T(u),
77
- disabled: C,
78
- children: [/* @__PURE__ */ _(l, { className: "mr-1 h-4 w-4" }), "Start sprint"]
211
+ onClick: () => w(s),
212
+ disabled: S,
213
+ children: [/* @__PURE__ */ v(u, { className: "mr-1 h-4 w-4" }), "Start sprint"]
79
214
  }),
80
- w.includes("complete") && /* @__PURE__ */ _(n, {
81
- label: "Complete sprint",
82
- icon: /* @__PURE__ */ _(c, { className: "mr-1 h-4 w-4" }),
83
- title: `Complete ${i}?`,
84
- description: "The sprint is closed and its work items can no longer be changed from it. This cannot be undone.",
85
- confirmLabel: "Complete sprint",
86
- disabled: C,
87
- onConfirm: () => T(p)
215
+ C.includes("complete") && /* @__PURE__ */ v(z, {
216
+ sprintId: e,
217
+ sprintName: i,
218
+ disabled: S,
219
+ error: _,
220
+ onComplete: (e) => w(d, e)
88
221
  }),
89
- w.includes("cancel") && /* @__PURE__ */ _(n, {
222
+ C.includes("cancel") && /* @__PURE__ */ v(n, {
90
223
  label: "Cancel sprint",
91
224
  variant: "outline",
92
- icon: /* @__PURE__ */ _(f, { className: "mr-1 h-4 w-4" }),
225
+ icon: /* @__PURE__ */ v(p, { className: "mr-1 h-4 w-4" }),
93
226
  title: `Cancel ${i}?`,
94
227
  description: "The sprint is abandoned and cannot be restarted. Its work items stay in it for the record. This cannot be undone.",
95
228
  confirmLabel: "Cancel sprint",
96
229
  destructive: !0,
97
- disabled: C,
98
- onConfirm: () => T(g)
230
+ disabled: S,
231
+ onConfirm: () => w(m)
99
232
  })
100
233
  ]
101
- }), x && /* @__PURE__ */ _(r, { message: x })]
234
+ }), _ && /* @__PURE__ */ v(r, { message: _ })]
102
235
  });
103
236
  }
104
- var R = p`
237
+ var H = m`
105
238
  mutation SprintControlsAddItems($id: ID!, $input: PlanmagnetSprintWorkItemsInput!) {
106
239
  planmagnetAddWorkItemsToSprint(id: $id, input: $input) {
107
240
  id
108
241
  }
109
242
  }
110
- `, z = p`
243
+ `, U = m`
111
244
  mutation SprintControlsRemoveItems($id: ID!, $input: PlanmagnetSprintWorkItemsInput!) {
112
245
  planmagnetRemoveWorkItemsFromSprint(id: $id, input: $input) {
113
246
  id
114
247
  }
115
248
  }
116
- `, B = p`
249
+ `, W = m`
117
250
  query SprintControlsCandidates($workspaceId: ID!, $filter: PlanmagnetWorkItemFilter) {
118
251
  planmagnetWorkItems(workspaceId: $workspaceId, filter: $filter, pagination: { first: 100 }) {
119
252
  totalCount
@@ -128,13 +261,13 @@ var R = p`
128
261
  }
129
262
  }
130
263
  }
131
- `, V = (e) => e.toLowerCase().replace(/_/g, " ");
132
- function H({ sprintId: e, eligibleProjectIds: n, projectNames: i, status: a, items: o }) {
133
- let c = M(a), [l, u] = h(z, {
134
- refetchQueries: N,
264
+ `, G = (e) => e.toLowerCase().replace(/_/g, " ");
265
+ function K({ sprintId: e, eligibleProjectIds: n, projectNames: i, status: a, items: o }) {
266
+ let s = N(a), [l, u] = g(U, {
267
+ refetchQueries: P,
135
268
  awaitRefetchQueries: !0
136
- }), [f, p] = s(null), [m, g] = s(null), x = async (n) => {
137
- p(null), g(n);
269
+ }), [d, p] = c(null), [m, h] = c(null), _ = async (n) => {
270
+ p(null), h(n);
138
271
  try {
139
272
  await t(l({ variables: {
140
273
  id: e,
@@ -143,74 +276,74 @@ function H({ sprintId: e, eligibleProjectIds: n, projectNames: i, status: a, ite
143
276
  } catch (e) {
144
277
  p(e instanceof Error ? e.message : "The work item could not be removed.");
145
278
  } finally {
146
- g(null);
279
+ h(null);
147
280
  }
148
281
  };
149
- return /* @__PURE__ */ v("div", {
282
+ return /* @__PURE__ */ y("div", {
150
283
  className: "space-y-3",
151
284
  "data-testid": "sprint-work-items",
152
285
  children: [
153
- /* @__PURE__ */ v("div", {
286
+ /* @__PURE__ */ y("div", {
154
287
  className: "flex items-center justify-between",
155
- children: [/* @__PURE__ */ v("p", {
288
+ children: [/* @__PURE__ */ y("p", {
156
289
  className: "text-sm text-muted-foreground",
157
290
  children: [
158
291
  o.length,
159
292
  " work item",
160
293
  o.length === 1 ? "" : "s"
161
294
  ]
162
- }), !c && n.length > 0 && /* @__PURE__ */ _(U, {
295
+ }), !s && n.length > 0 && /* @__PURE__ */ v(q, {
163
296
  sprintId: e,
164
297
  eligibleProjectIds: n,
165
298
  projectNames: i,
166
299
  memberIds: o.map((e) => e.id)
167
300
  })]
168
301
  }),
169
- c && /* @__PURE__ */ v("p", {
302
+ s && /* @__PURE__ */ y("p", {
170
303
  className: "text-xs text-muted-foreground",
171
304
  children: [
172
305
  "This sprint is ",
173
- V(a),
306
+ G(a),
174
307
  "; its work items can no longer be changed."
175
308
  ]
176
309
  }),
177
- !c && n.length === 0 && /* @__PURE__ */ _("p", {
310
+ !s && n.length === 0 && /* @__PURE__ */ v("p", {
178
311
  className: "text-xs text-muted-foreground",
179
312
  children: "This team has no projects yet — add a project to the team before adding work items."
180
313
  }),
181
- f && /* @__PURE__ */ _(r, { message: f }),
182
- o.length === 0 ? /* @__PURE__ */ _("p", {
314
+ d && /* @__PURE__ */ v(r, { message: d }),
315
+ o.length === 0 ? /* @__PURE__ */ v("p", {
183
316
  className: "text-sm text-muted-foreground text-center py-4",
184
317
  children: "No work items in this sprint yet."
185
- }) : /* @__PURE__ */ _("ul", {
318
+ }) : /* @__PURE__ */ v("ul", {
186
319
  className: "space-y-1",
187
- children: o.map((e) => /* @__PURE__ */ v("li", {
320
+ children: o.map((e) => /* @__PURE__ */ y("li", {
188
321
  className: "flex items-center justify-between gap-2 border rounded-md p-2 text-sm",
189
- children: [/* @__PURE__ */ v("span", {
322
+ children: [/* @__PURE__ */ y("span", {
190
323
  className: "min-w-0 truncate",
191
- children: [/* @__PURE__ */ _("span", {
324
+ children: [/* @__PURE__ */ v("span", {
192
325
  className: "text-muted-foreground mr-2",
193
326
  children: e.key
194
327
  }), e.title]
195
- }), /* @__PURE__ */ v("span", {
328
+ }), /* @__PURE__ */ y("span", {
196
329
  className: "flex items-center gap-2 shrink-0",
197
330
  children: [
198
- /* @__PURE__ */ _(y, {
331
+ /* @__PURE__ */ v(b, {
199
332
  variant: "secondary",
200
333
  className: "text-xs capitalize",
201
- children: V(e.status)
334
+ children: G(e.status)
202
335
  }),
203
- /* @__PURE__ */ v("span", {
336
+ /* @__PURE__ */ y("span", {
204
337
  className: "text-xs text-muted-foreground",
205
338
  children: [e.storyPoints ?? 0, " pts"]
206
339
  }),
207
- !c && /* @__PURE__ */ _(b, {
340
+ !s && /* @__PURE__ */ v(x, {
208
341
  size: "sm",
209
342
  variant: "ghost",
210
343
  "aria-label": `Remove ${e.key} from sprint`,
211
344
  disabled: u.loading,
212
- onClick: () => x(e.id),
213
- children: m === e.id ? "…" : /* @__PURE__ */ _(d, { className: "h-4 w-4" })
345
+ onClick: () => _(e.id),
346
+ children: m === e.id ? "…" : /* @__PURE__ */ v(f, { className: "h-4 w-4" })
214
347
  })
215
348
  ]
216
349
  })]
@@ -219,23 +352,23 @@ function H({ sprintId: e, eligibleProjectIds: n, projectNames: i, status: a, ite
219
352
  ]
220
353
  });
221
354
  }
222
- function U({ sprintId: n, eligibleProjectIds: i, projectNames: c, memberIds: l }) {
223
- let { workspaceId: d } = e(), f = m(), [p, g] = s(!1), [A, j] = s(""), M = a(A.trim()), [P, F] = s(/* @__PURE__ */ new Set()), [I, L] = s(null), z = `${i.join(",")}|${l.join(",")}|${M}`, [H, U] = s({
355
+ function q({ sprintId: n, eligibleProjectIds: i, projectNames: a, memberIds: l }) {
356
+ let { workspaceId: u } = e(), f = h(), [p, m] = c(!1), [_, j] = c(""), M = o(_.trim()), [N, F] = c(/* @__PURE__ */ new Set()), [I, L] = c(null), R = `${i.join(",")}|${l.join(",")}|${M}`, [z, B] = c({
224
357
  key: null,
225
358
  items: [],
226
359
  fetchedCount: 0,
227
360
  totalCount: 0,
228
361
  error: null
229
362
  });
230
- o(() => {
231
- if (!p || !d || i.length === 0) return;
363
+ s(() => {
364
+ if (!p || !u || i.length === 0) return;
232
365
  let e = !1;
233
366
  return (async () => {
234
367
  try {
235
368
  let t = await Promise.all(i.map((e) => f.query({
236
- query: B,
369
+ query: W,
237
370
  variables: {
238
- workspaceId: d,
371
+ workspaceId: u,
239
372
  filter: {
240
373
  projectId: e,
241
374
  excludeIds: l,
@@ -245,8 +378,8 @@ function U({ sprintId: n, eligibleProjectIds: i, projectNames: c, memberIds: l }
245
378
  fetchPolicy: "network-only"
246
379
  })));
247
380
  if (e) return;
248
- U({
249
- key: z,
381
+ B({
382
+ key: R,
250
383
  items: t.flatMap((e) => e.data?.planmagnetWorkItems.items ?? []),
251
384
  fetchedCount: t.reduce((e, t) => e + (t.data?.planmagnetWorkItems.items.length ?? 0), 0),
252
385
  totalCount: t.reduce((e, t) => e + (t.data?.planmagnetWorkItems.totalCount ?? 0), 0),
@@ -254,8 +387,8 @@ function U({ sprintId: n, eligibleProjectIds: i, projectNames: c, memberIds: l }
254
387
  });
255
388
  } catch (t) {
256
389
  if (e) return;
257
- U({
258
- key: z,
390
+ B({
391
+ key: R,
259
392
  items: [],
260
393
  fetchedCount: 0,
261
394
  totalCount: 0,
@@ -267,95 +400,95 @@ function U({ sprintId: n, eligibleProjectIds: i, projectNames: c, memberIds: l }
267
400
  };
268
401
  }, [
269
402
  p,
270
- d,
403
+ u,
271
404
  i,
272
405
  l,
273
406
  M,
274
407
  f,
275
- z
408
+ R
276
409
  ]);
277
- let [W, G] = h(R, {
278
- refetchQueries: N,
410
+ let [V, U] = g(H, {
411
+ refetchQueries: P,
279
412
  awaitRefetchQueries: !0
280
- }), K = H.items.filter((e) => e.sprintId !== n), { totalCount: q, fetchedCount: J } = H, Y = p && H.key !== z, X = i.length > 1 && !!c, Z = (e, t) => F((n) => {
413
+ }), K = z.items.filter((e) => e.sprintId !== n), { totalCount: q, fetchedCount: J } = z, Y = p && z.key !== R, X = i.length > 1 && !!a, Z = (e, t) => F((n) => {
281
414
  let r = new Set(n);
282
415
  return t ? r.add(e) : r.delete(e), r;
283
416
  }), Q = () => {
284
417
  F(/* @__PURE__ */ new Set()), j(""), L(null);
285
418
  };
286
- return /* @__PURE__ */ v(C, {
419
+ return /* @__PURE__ */ y(w, {
287
420
  open: p,
288
421
  onOpenChange: (e) => {
289
- g(e), e || Q();
422
+ m(e), e || Q();
290
423
  },
291
- children: [/* @__PURE__ */ _(k, {
424
+ children: [/* @__PURE__ */ v(A, {
292
425
  asChild: !0,
293
- children: /* @__PURE__ */ v(b, {
426
+ children: /* @__PURE__ */ y(x, {
294
427
  size: "sm",
295
428
  variant: "outline",
296
- children: [/* @__PURE__ */ _(u, { className: "mr-1 h-4 w-4" }), "Add work items"]
429
+ children: [/* @__PURE__ */ v(d, { className: "mr-1 h-4 w-4" }), "Add work items"]
297
430
  })
298
- }), /* @__PURE__ */ v(w, {
431
+ }), /* @__PURE__ */ y(T, {
299
432
  className: "max-w-lg",
300
433
  children: [
301
- /* @__PURE__ */ v(D, { children: [/* @__PURE__ */ _(O, { children: "Add work items" }), /* @__PURE__ */ _(T, { children: i.length > 1 ? "Work items from this team's projects. An item already in another sprint moves here." : "Work items from this sprint's project. An item already in another sprint moves here." })] }),
302
- /* @__PURE__ */ _(S, {
303
- value: A,
434
+ /* @__PURE__ */ y(O, { children: [/* @__PURE__ */ v(k, { children: "Add work items" }), /* @__PURE__ */ v(E, { children: i.length > 1 ? "Work items from this team's projects. An item already in another sprint moves here." : "Work items from this sprint's project. An item already in another sprint moves here." })] }),
435
+ /* @__PURE__ */ v(C, {
436
+ value: _,
304
437
  onChange: (e) => j(e.target.value),
305
438
  placeholder: "Search by title",
306
439
  "aria-label": "Search work items"
307
440
  }),
308
- /* @__PURE__ */ v("div", {
441
+ /* @__PURE__ */ y("div", {
309
442
  className: "max-h-80 overflow-y-auto space-y-1",
310
443
  "data-testid": "sprint-add-candidates",
311
444
  children: [
312
- Y && /* @__PURE__ */ _("p", {
445
+ Y && /* @__PURE__ */ v("p", {
313
446
  className: "text-sm text-muted-foreground py-4 text-center",
314
447
  children: "Loading…"
315
448
  }),
316
- !Y && H.error && /* @__PURE__ */ _("p", {
449
+ !Y && z.error && /* @__PURE__ */ v("p", {
317
450
  className: "text-sm text-destructive py-4 text-center",
318
- children: H.error
451
+ children: z.error
319
452
  }),
320
- !Y && !H.error && K.length === 0 && /* @__PURE__ */ _("p", {
453
+ !Y && !z.error && K.length === 0 && /* @__PURE__ */ v("p", {
321
454
  className: "text-sm text-muted-foreground py-4 text-center",
322
455
  children: M ? "No matching work items." : i.length > 1 ? "Every work item in this team's projects is already in this sprint." : "Every work item in this project is already in this sprint."
323
456
  }),
324
457
  K.map((e) => {
325
458
  let t = `sprint-add-${e.id}`;
326
- return /* @__PURE__ */ v("label", {
459
+ return /* @__PURE__ */ y("label", {
327
460
  htmlFor: t,
328
461
  className: "flex items-center gap-3 border rounded-md p-2 text-sm cursor-pointer hover:bg-muted",
329
462
  children: [
330
- /* @__PURE__ */ _(x, {
463
+ /* @__PURE__ */ v(S, {
331
464
  id: t,
332
- checked: P.has(e.id),
465
+ checked: N.has(e.id),
333
466
  onCheckedChange: (t) => Z(e.id, t === !0)
334
467
  }),
335
- /* @__PURE__ */ v("span", {
468
+ /* @__PURE__ */ y("span", {
336
469
  className: "min-w-0 flex-1 truncate",
337
- children: [/* @__PURE__ */ _("span", {
470
+ children: [/* @__PURE__ */ v("span", {
338
471
  className: "text-muted-foreground mr-2",
339
472
  children: e.key
340
473
  }), e.title]
341
474
  }),
342
- X && /* @__PURE__ */ _("span", {
475
+ X && /* @__PURE__ */ v("span", {
343
476
  className: "text-xs text-muted-foreground shrink-0",
344
- children: c?.[e.projectId] ?? e.projectId
477
+ children: a?.[e.projectId] ?? e.projectId
345
478
  }),
346
- e.sprintId && /* @__PURE__ */ _("span", {
479
+ e.sprintId && /* @__PURE__ */ v("span", {
347
480
  className: "text-xs text-muted-foreground shrink-0",
348
481
  children: "in another sprint"
349
482
  }),
350
- /* @__PURE__ */ _(y, {
483
+ /* @__PURE__ */ v(b, {
351
484
  variant: "secondary",
352
485
  className: "text-xs capitalize shrink-0",
353
- children: V(e.status)
486
+ children: G(e.status)
354
487
  })
355
488
  ]
356
489
  }, e.id);
357
490
  }),
358
- J < q && /* @__PURE__ */ v("p", {
491
+ J < q && /* @__PURE__ */ y("p", {
359
492
  className: "text-xs text-muted-foreground pt-2",
360
493
  children: [
361
494
  "Showing the first ",
@@ -367,34 +500,34 @@ function U({ sprintId: n, eligibleProjectIds: i, projectNames: c, memberIds: l }
367
500
  })
368
501
  ]
369
502
  }),
370
- I && /* @__PURE__ */ _(r, { message: I }),
371
- /* @__PURE__ */ _(E, { children: /* @__PURE__ */ _(b, {
503
+ I && /* @__PURE__ */ v(r, { message: I }),
504
+ /* @__PURE__ */ v(D, { children: /* @__PURE__ */ v(x, {
372
505
  onClick: async () => {
373
506
  L(null);
374
507
  try {
375
- await t(W({ variables: {
508
+ await t(V({ variables: {
376
509
  id: n,
377
- input: { workItemIds: [...P] }
378
- } })), Q(), g(!1);
510
+ input: { workItemIds: [...N] }
511
+ } })), Q(), m(!1);
379
512
  } catch (e) {
380
513
  L(e instanceof Error ? e.message : "The work items could not be added.");
381
514
  }
382
515
  },
383
- disabled: P.size === 0 || G.loading,
516
+ disabled: N.size === 0 || U.loading,
384
517
  "data-testid": "sprint-add-confirm",
385
- children: G.loading ? "Adding…" : `Add ${P.size} work item${P.size === 1 ? "" : "s"}`
518
+ children: U.loading ? "Adding…" : `Add ${N.size} work item${N.size === 1 ? "" : "s"}`
386
519
  }) })
387
520
  ]
388
521
  })]
389
522
  });
390
523
  }
391
- var W = p`
524
+ var J = m`
392
525
  mutation SprintControlsCreate($input: PlanmagnetCreateSprintInput!) {
393
526
  planmagnetCreateSprint(input: $input) {
394
527
  id
395
528
  }
396
529
  }
397
- `, G = p`
530
+ `, Y = m`
398
531
  query SprintControlsProjects($workspaceId: ID!) {
399
532
  planmagnetProjects(workspaceId: $workspaceId, pagination: { first: 100 }) {
400
533
  items {
@@ -403,7 +536,7 @@ var W = p`
403
536
  }
404
537
  }
405
538
  }
406
- `, K = {
539
+ `, X = {
407
540
  name: "",
408
541
  projectId: "",
409
542
  startDate: "",
@@ -411,37 +544,37 @@ var W = p`
411
544
  goal: "",
412
545
  capacity: ""
413
546
  };
414
- function q({ onCreated: n, initialScope: a, initialTeamId: o }) {
415
- let { workspaceId: c } = e(), [l, d] = s(!1), [f, p] = s(K), [m, y] = s(a ?? "project"), [x, A] = s(o ?? ""), [j, M] = s(null), { data: P, loading: F, error: I, refetch: L } = g(G, {
416
- variables: { workspaceId: c ?? "" },
417
- skip: !l || !c || m !== "project"
418
- }), R = P?.planmagnetProjects.items ?? [], z = f.projectId || R[0]?.id || "", [B, { loading: V }] = h(W, {
419
- refetchQueries: N,
547
+ function Z({ onCreated: n, initialScope: a, initialTeamId: o }) {
548
+ let { workspaceId: s } = e(), [l, u] = c(!1), [f, p] = c(X), [m, h] = c(a ?? "project"), [b, S] = c(o ?? ""), [j, M] = c(null), { data: N, loading: F, error: I, refetch: L } = _(Y, {
549
+ variables: { workspaceId: s ?? "" },
550
+ skip: !l || !s || m !== "project"
551
+ }), R = N?.planmagnetProjects.items ?? [], z = f.projectId || R[0]?.id || "", [B, { loading: V }] = g(J, {
552
+ refetchQueries: P,
420
553
  awaitRefetchQueries: !0
421
- }), H = f.capacity.trim() === "" ? void 0 : Number(f.capacity), U = H !== void 0 && (!Number.isInteger(H) || H < 0), q = !!(f.startDate && f.endDate && f.endDate < f.startDate), J = m === "project" ? z !== "" : x !== "", Y = f.name.trim() !== "" && J && !U && !q && !V;
422
- return /* @__PURE__ */ v(C, {
554
+ }), H = f.capacity.trim() === "" ? void 0 : Number(f.capacity), U = H !== void 0 && (!Number.isInteger(H) || H < 0), W = !!(f.startDate && f.endDate && f.endDate < f.startDate), G = m === "project" ? z !== "" : b !== "", K = f.name.trim() !== "" && G && !U && !W && !V;
555
+ return /* @__PURE__ */ y(w, {
423
556
  open: l,
424
557
  onOpenChange: (e) => {
425
- d(e), e || M(null);
558
+ u(e), e || M(null);
426
559
  },
427
- children: [/* @__PURE__ */ _(k, {
560
+ children: [/* @__PURE__ */ v(A, {
428
561
  asChild: !0,
429
- children: /* @__PURE__ */ v(b, {
562
+ children: /* @__PURE__ */ y(x, {
430
563
  size: "sm",
431
- children: [/* @__PURE__ */ _(u, { className: "mr-1 h-4 w-4" }), "New sprint"]
564
+ children: [/* @__PURE__ */ v(d, { className: "mr-1 h-4 w-4" }), "New sprint"]
432
565
  })
433
- }), /* @__PURE__ */ v(w, {
566
+ }), /* @__PURE__ */ y(T, {
434
567
  className: "max-w-lg",
435
568
  children: [
436
- /* @__PURE__ */ v(D, { children: [/* @__PURE__ */ _(O, { children: "New sprint" }), /* @__PURE__ */ _(T, { children: "The sprint starts in Planning. Start it when it is ready." })] }),
437
- /* @__PURE__ */ v("div", {
569
+ /* @__PURE__ */ y(O, { children: [/* @__PURE__ */ v(k, { children: "New sprint" }), /* @__PURE__ */ v(E, { children: "The sprint starts in Planning. Start it when it is ready." })] }),
570
+ /* @__PURE__ */ y("div", {
438
571
  className: "space-y-3",
439
572
  children: [
440
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
573
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
441
574
  htmlFor: "new-sprint-name",
442
575
  className: "text-sm font-medium",
443
576
  children: "Name"
444
- }), /* @__PURE__ */ _(S, {
577
+ }), /* @__PURE__ */ v(C, {
445
578
  id: "new-sprint-name",
446
579
  className: "mt-1",
447
580
  value: f.name,
@@ -450,38 +583,38 @@ function q({ onCreated: n, initialScope: a, initialTeamId: o }) {
450
583
  name: e.target.value
451
584
  })
452
585
  })] }),
453
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("span", {
586
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("span", {
454
587
  className: "text-sm font-medium",
455
588
  children: "Belongs to"
456
- }), /* @__PURE__ */ v("div", {
589
+ }), /* @__PURE__ */ y("div", {
457
590
  className: "mt-1 flex gap-2",
458
591
  role: "radiogroup",
459
592
  "aria-label": "Sprint scope",
460
- children: [/* @__PURE__ */ _(b, {
593
+ children: [/* @__PURE__ */ v(x, {
461
594
  type: "button",
462
595
  size: "sm",
463
596
  variant: m === "project" ? "default" : "outline",
464
597
  "aria-pressed": m === "project",
465
598
  "data-testid": "new-sprint-scope-project",
466
- onClick: () => y("project"),
599
+ onClick: () => h("project"),
467
600
  children: "A project"
468
- }), /* @__PURE__ */ _(b, {
601
+ }), /* @__PURE__ */ v(x, {
469
602
  type: "button",
470
603
  size: "sm",
471
604
  variant: m === "team" ? "default" : "outline",
472
605
  "aria-pressed": m === "team",
473
606
  "data-testid": "new-sprint-scope-team",
474
- onClick: () => y("team"),
607
+ onClick: () => h("team"),
475
608
  children: "A team"
476
609
  })]
477
610
  })] }),
478
- m === "project" ? /* @__PURE__ */ v("div", { children: [
479
- /* @__PURE__ */ _("label", {
611
+ m === "project" ? /* @__PURE__ */ y("div", { children: [
612
+ /* @__PURE__ */ v("label", {
480
613
  htmlFor: "new-sprint-project",
481
614
  className: "text-sm font-medium",
482
615
  children: "Project"
483
616
  }),
484
- /* @__PURE__ */ v("select", {
617
+ /* @__PURE__ */ y("select", {
485
618
  id: "new-sprint-project",
486
619
  className: "mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
487
620
  value: z,
@@ -489,18 +622,18 @@ function q({ onCreated: n, initialScope: a, initialTeamId: o }) {
489
622
  ...f,
490
623
  projectId: e.target.value
491
624
  }),
492
- children: [R.length === 0 && /* @__PURE__ */ _("option", {
625
+ children: [R.length === 0 && /* @__PURE__ */ v("option", {
493
626
  value: "",
494
- children: F && !P ? "Loading projects…" : I ? "Projects could not be loaded" : "No projects yet"
495
- }), R.map((e) => /* @__PURE__ */ _("option", {
627
+ children: F && !N ? "Loading projects…" : I ? "Projects could not be loaded" : "No projects yet"
628
+ }), R.map((e) => /* @__PURE__ */ v("option", {
496
629
  value: e.id,
497
630
  children: e.name
498
631
  }, e.id))]
499
632
  }),
500
- I && /* @__PURE__ */ v("p", {
633
+ I && /* @__PURE__ */ y("p", {
501
634
  role: "alert",
502
635
  className: "mt-1 flex items-center gap-2 text-xs text-destructive",
503
- children: [I.message, /* @__PURE__ */ _(b, {
636
+ children: [I.message, /* @__PURE__ */ v(x, {
504
637
  type: "button",
505
638
  size: "sm",
506
639
  variant: "ghost",
@@ -509,36 +642,36 @@ function q({ onCreated: n, initialScope: a, initialTeamId: o }) {
509
642
  children: "Retry"
510
643
  })]
511
644
  }),
512
- !F && !I && P && R.length === 0 && /* @__PURE__ */ _("p", {
645
+ !F && !I && N && R.length === 0 && /* @__PURE__ */ v("p", {
513
646
  className: "mt-1 text-xs text-muted-foreground",
514
647
  children: "Create a project first (Projects → New project)."
515
648
  })
516
- ] }) : /* @__PURE__ */ v("div", { children: [
517
- /* @__PURE__ */ _("label", {
649
+ ] }) : /* @__PURE__ */ y("div", { children: [
650
+ /* @__PURE__ */ v("label", {
518
651
  htmlFor: "new-sprint-team",
519
652
  className: "text-sm font-medium",
520
653
  children: "Team"
521
654
  }),
522
- /* @__PURE__ */ _("div", {
655
+ /* @__PURE__ */ v("div", {
523
656
  className: "mt-1",
524
- children: /* @__PURE__ */ _(i, {
657
+ children: /* @__PURE__ */ v(i, {
525
658
  id: "new-sprint-team",
526
- value: x,
527
- onChange: A
659
+ value: b,
660
+ onChange: S
528
661
  })
529
662
  }),
530
- /* @__PURE__ */ _("p", {
663
+ /* @__PURE__ */ v("p", {
531
664
  className: "mt-1 text-xs text-muted-foreground",
532
665
  children: "Only work items from the team's own projects can join this sprint."
533
666
  })
534
667
  ] }),
535
- /* @__PURE__ */ v("div", {
668
+ /* @__PURE__ */ y("div", {
536
669
  className: "grid grid-cols-2 gap-3",
537
- children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
670
+ children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
538
671
  htmlFor: "new-sprint-start",
539
672
  className: "text-sm font-medium",
540
673
  children: "Start date"
541
- }), /* @__PURE__ */ _(S, {
674
+ }), /* @__PURE__ */ v(C, {
542
675
  id: "new-sprint-start",
543
676
  type: "date",
544
677
  className: "mt-1",
@@ -547,11 +680,11 @@ function q({ onCreated: n, initialScope: a, initialTeamId: o }) {
547
680
  ...f,
548
681
  startDate: e.target.value
549
682
  })
550
- })] }), /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
683
+ })] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
551
684
  htmlFor: "new-sprint-end",
552
685
  className: "text-sm font-medium",
553
686
  children: "End date"
554
- }), /* @__PURE__ */ _(S, {
687
+ }), /* @__PURE__ */ v(C, {
555
688
  id: "new-sprint-end",
556
689
  type: "date",
557
690
  className: "mt-1",
@@ -562,12 +695,12 @@ function q({ onCreated: n, initialScope: a, initialTeamId: o }) {
562
695
  })
563
696
  })] })]
564
697
  }),
565
- q && /* @__PURE__ */ _(r, { message: "The end date is before the start date." }),
566
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
698
+ W && /* @__PURE__ */ v(r, { message: "The end date is before the start date." }),
699
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
567
700
  htmlFor: "new-sprint-capacity",
568
701
  className: "text-sm font-medium",
569
702
  children: "Capacity (story points)"
570
- }), /* @__PURE__ */ _(S, {
703
+ }), /* @__PURE__ */ v(C, {
571
704
  id: "new-sprint-capacity",
572
705
  type: "number",
573
706
  min: 0,
@@ -578,12 +711,12 @@ function q({ onCreated: n, initialScope: a, initialTeamId: o }) {
578
711
  capacity: e.target.value
579
712
  })
580
713
  })] }),
581
- U && /* @__PURE__ */ _(r, { message: "Capacity must be a whole number, 0 or more." }),
582
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
714
+ U && /* @__PURE__ */ v(r, { message: "Capacity must be a whole number, 0 or more." }),
715
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
583
716
  htmlFor: "new-sprint-goal",
584
717
  className: "text-sm font-medium",
585
718
  children: "Goal"
586
- }), /* @__PURE__ */ _(S, {
719
+ }), /* @__PURE__ */ v(C, {
587
720
  id: "new-sprint-goal",
588
721
  className: "mt-1",
589
722
  value: f.goal,
@@ -594,25 +727,25 @@ function q({ onCreated: n, initialScope: a, initialTeamId: o }) {
594
727
  })] })
595
728
  ]
596
729
  }),
597
- j && /* @__PURE__ */ _(r, { message: j }),
598
- /* @__PURE__ */ _(E, { children: /* @__PURE__ */ _(b, {
730
+ j && /* @__PURE__ */ v(r, { message: j }),
731
+ /* @__PURE__ */ v(D, { children: /* @__PURE__ */ v(x, {
599
732
  onClick: async () => {
600
733
  M(null);
601
734
  try {
602
735
  let e = (await t(B({ variables: { input: {
603
736
  name: f.name.trim(),
604
- ...m === "team" ? { teamId: x } : { projectId: z },
737
+ ...m === "team" ? { teamId: b } : { projectId: z },
605
738
  startDate: f.startDate || void 0,
606
739
  endDate: f.endDate || void 0,
607
740
  goal: f.goal.trim() || void 0,
608
741
  capacity: H
609
742
  } } }))).data?.planmagnetCreateSprint.id;
610
- p(K), d(!1), e && n(e);
743
+ p(X), u(!1), e && n(e);
611
744
  } catch (e) {
612
745
  M(e instanceof Error ? e.message : "The sprint could not be created.");
613
746
  }
614
747
  },
615
- disabled: !Y,
748
+ disabled: !K,
616
749
  "data-testid": "new-sprint-submit",
617
750
  children: V ? "Creating…" : "Create sprint"
618
751
  }) })
@@ -621,6 +754,6 @@ function q({ onCreated: n, initialScope: a, initialTeamId: o }) {
621
754
  });
622
755
  }
623
756
  //#endregion
624
- export { q as NewSprintDialog, L as SprintLifecycleActions, H as SprintWorkItemsPanel };
757
+ export { Z as NewSprintDialog, V as SprintLifecycleActions, K as SprintWorkItemsPanel };
625
758
 
626
759
  //# sourceMappingURL=SprintControls.js.map