@parallelworks/tandem-web 0.189.2 → 0.189.4

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.
@@ -1,58 +1,58 @@
1
1
  import { api as e, unwrap as t } from "../api/client.js";
2
2
  import { invalidateIssueViews as n } from "../api/mutations.js";
3
- import { cyclesQuery as r, issueTemplatesQuery as i, labelsQuery as ee, myTeamsQuery as a, statusesQuery as te, teamsQuery as ne } from "../api/queries.js";
4
- import { parseAssigneeKey as re, useAssigneeOptions as ie } from "../lib/assignees.js";
5
- import { attachmentPrefix as ae, insertPreviews as oe, readDataURL as se, uploadAttachment as ce } from "../lib/attachments.js";
6
- import { useConfirm as le } from "../lib/confirm.js";
7
- import { hasValue as o } from "../lib/customFields.js";
8
- import { issueTypesQuery as ue, typesFor as de } from "../lib/issueTypes.js";
9
- import { withoutLink as fe } from "../lib/markdownLinks.js";
10
- import { PickManyBox as pe, usePickMany as me } from "../lib/pickMany.js";
11
- import { useCan as he } from "../lib/roles.js";
12
- import { useNavigate as ge } from "../lib/router.js";
13
- import { useTime as _e } from "../lib/time.js";
14
- import { AttachButton as ve, useAttachmentsOn as ye } from "./Attachments.js";
15
- import { NewIssueFields as be } from "./CustomFields.js";
16
- import { Editor as xe } from "./Editor.js";
17
- import { TypeIcon as Se } from "./IssueTypes.js";
18
- import { CalendarIcon as Ce, CycleIcon as we, EstimateIcon as Te, FileTextIcon as Ee, FolderIcon as De, PriorityIcon as Oe, StatusIcon as ke, TagIcon as Ae, UserIcon as je, usePriorityNames as Me } from "./icons.js";
19
- import { scalePoints as Ne, useEstimateLabel as Pe } from "./Planning.js";
20
- import { TeamForm as Fe } from "./TeamForm.js";
21
- import { Button as Ie, Combobox as s, CreateModal as Le, DatePicker as Re, Modal as ze, buttonClasses as Be, toast as Ve } from "@parallelworks/ui";
22
- import { useEffect as He, useRef as c, useState as l } from "react";
23
- import { useErrorMessage as Ue } from "@parallelworks/problem/react";
24
- import { useTranslations as u } from "use-intl";
25
- import { Fragment as We, jsx as d, jsxs as f } from "react/jsx-runtime";
26
- import { useQuery as p, useQueryClient as Ge, useSuspenseQuery as Ke } from "@tanstack/react-query";
3
+ import { cyclesQuery as r, issueTemplatesQuery as i, labelsQuery as a, myTeamsQuery as o, statusesQuery as ee, teamsQuery as te } from "../api/queries.js";
4
+ import { parseAssigneeKey as ne, useAssigneeOptions as re } from "../lib/assignees.js";
5
+ import { attachmentPrefix as ie, insertPreviews as ae, readDataURL as oe, uploadAttachment as se } from "../lib/attachments.js";
6
+ import { useConfirm as ce } from "../lib/confirm.js";
7
+ import { hasValue as s } from "../lib/customFields.js";
8
+ import { issueTypesQuery as le, typesFor as ue } from "../lib/issueTypes.js";
9
+ import { withoutLink as de } from "../lib/markdownLinks.js";
10
+ import { PickManyBox as fe, usePickMany as pe } from "../lib/pickMany.js";
11
+ import { useCan as me } from "../lib/roles.js";
12
+ import { useNavigate as he } from "../lib/router.js";
13
+ import { useTime as ge } from "../lib/time.js";
14
+ import { AttachButton as _e, useAttachmentsOn as ve } from "./Attachments.js";
15
+ import { NewIssueFields as ye } from "./CustomFields.js";
16
+ import { Editor as be } from "./Editor.js";
17
+ import { TypeIcon as xe } from "./IssueTypes.js";
18
+ import { CalendarIcon as Se, CycleIcon as Ce, EstimateIcon as we, FileTextIcon as Te, FolderIcon as Ee, PriorityIcon as De, StatusIcon as Oe, TagIcon as ke, UserIcon as Ae, usePriorityNames as je } from "./icons.js";
19
+ import { scalePoints as Me, useEstimateLabel as Ne } from "./Planning.js";
20
+ import { TeamForm as Pe } from "./TeamForm.js";
21
+ import { Button as Fe, Combobox as c, CreateModal as Ie, DatePicker as Le, Modal as Re, buttonClasses as ze, toast as Be } from "@parallelworks/ui";
22
+ import { useEffect as Ve, useRef as l, useState as u } from "react";
23
+ import { useErrorMessage as He } from "@parallelworks/problem/react";
24
+ import { useTranslations as d } from "use-intl";
25
+ import { Fragment as Ue, jsx as f, jsxs as p } from "react/jsx-runtime";
26
+ import { useQuery as m, useQueryClient as We, useSuspenseQuery as Ge } from "@tanstack/react-query";
27
27
  // src/components/NewIssueDialog.tsx
28
- function m({ workspace: m, defaultTeam: h, defaultTitle: Ye = "", defaultBody: g = "", defaultArea: _, origin: v, defaults: y = {}, onCreated: Xe, onClose: b }) {
29
- let { data: Ze } = Ke(a(m)), { data: Qe = [] } = p(ne(m)), $e = h && !Ze.some((e) => e.key === h) ? Qe.find((e) => e.key === h) : void 0, x = [...Ze, ...$e ? [$e] : []].filter((e) => !e.archivedAt), S = !Ye && !g && !_ && !v && Object.keys(y).length === 0, [C] = l(() => S ? qe(m) : void 0), [w, et] = l(h ?? x.find((e) => e.key === C?.team)?.key ?? x[0]?.key ?? ""), { data: T = [] } = p({
30
- ...te(m, w),
31
- enabled: !!w
32
- }), { data: tt = [] } = p(ee(m)), { data: E = [] } = p({
33
- ...i(m, w),
34
- enabled: !!w
35
- }), [D, nt] = l(null), rt = E.find((e) => e.id === D), [O, it] = l(Ye || C?.title || ""), k = c(O), at = u("issueTemplates"), ot = ie(m, !0), st = Me(), A = u("newIssue"), ct = Ue(), j = u("common"), M = he(m, "manage_teams"), [N, P] = l(g || C?.body || ""), lt = c(N), [ut, dt] = l(y.statusId ?? null), [F, ft] = l(y.priority ?? 0), [I, pt] = l(0), [L, mt] = l(""), [R, ht] = l(y.cycleId ?? ""), z = u("planning"), gt = Pe(), _t = _e(), { data: vt = [] } = p({
36
- ...r(m, w),
37
- enabled: !!x.find((e) => e.key === w)?.cyclesEnabled
38
- }), yt = vt.find((e) => e.id === R), bt = (e) => e.name ? z("cycleNamed", {
28
+ function h({ workspace: h, defaultTeam: g, defaultTitle: Je = "", defaultBody: _ = "", defaultArea: v, origin: y, defaults: b = {}, onCreated: Ye, onClose: x }) {
29
+ let { data: Xe } = Ge(o(h)), { data: Ze = [] } = m(te(h)), Qe = g && !Xe.some((e) => e.key === g) ? Ze.find((e) => e.key === g) : void 0, S = [...Xe, ...Qe ? [Qe] : []].filter((e) => !e.archivedAt), C = !Je && !_ && !v && !y && Object.keys(b).length === 0, [w] = u(() => C ? Ke(h) : void 0), [T, $e] = u(g ?? S.find((e) => e.key === w?.team)?.key ?? S[0]?.key ?? ""), { data: E = [] } = m({
30
+ ...ee(h, T),
31
+ enabled: !!T
32
+ }), { data: et = [] } = m(a(h)), { data: D = [] } = m({
33
+ ...i(h, T),
34
+ enabled: !!T
35
+ }), [O, tt] = u(null), nt = D.find((e) => e.id === O), [k, rt] = u(Je || w?.title || ""), A = l(k), it = d("issueTemplates"), at = re(h, !0), ot = je(), j = d("newIssue"), st = He(), M = d("common"), N = me(h, "manage_teams"), [P, F] = u(_ || w?.body || ""), ct = l(P), [lt, ut] = u(b.statusId ?? null), [I, dt] = u(b.priority ?? 0), [L, ft] = u(0), [R, pt] = u(""), [z, mt] = u(b.cycleId ?? ""), B = d("planning"), ht = Ne(), gt = ge(), { data: _t = [] } = m({
36
+ ...r(h, T),
37
+ enabled: !!S.find((e) => e.key === T)?.cyclesEnabled
38
+ }), vt = _t.find((e) => e.id === z), yt = (e) => e.name ? B("cycleNamed", {
39
39
  number: e.number,
40
40
  name: e.name
41
- }) : z("cycle", { number: e.number }), B = x.find((e) => e.key === w)?.estimateScale ?? "none", [V, xt] = l(y.assignees ?? []), [H, St] = l(y.labelIds ?? []), [U, W] = l({}), [G, Ct] = l(null), { data: wt } = p(ue(m)), K = de(wt, x.find((e) => e.key === w)?.id), q = K.find((e) => e.id === G), Tt = u("issueTypes"), [J, Y] = l(null), Et = me(J === "assignees", () => Y(null)), Dt = me(J === "labels", () => Y(null)), [Ot, kt] = l(null), At = Ge(), jt = ge(), { confirm: Mt, dialog: Nt } = le(), Pt = c(!1);
42
- He(() => {
41
+ }) : B("cycle", { number: e.number }), V = S.find((e) => e.key === T)?.estimateScale ?? "none", [H, bt] = u(b.assignees ?? []), [U, xt] = u(b.labelIds ?? []), [W, St] = u({}), [G, Ct] = u(null), { data: wt } = m(le(h)), K = ue(wt, S.find((e) => e.key === T)?.id), q = K.find((e) => e.id === G), Tt = d("issueTypes"), [J, Y] = u(null), Et = pe(J === "assignees", () => Y(null)), Dt = pe(J === "labels", () => Y(null)), [Ot, kt] = u(null), At = We(), jt = he(), { confirm: Mt, dialog: Nt } = ce(), Pt = l(!1);
42
+ Ve(() => {
43
43
  let e = () => {
44
- S && Je(m, {
45
- team: w,
46
- title: k.current,
47
- body: N
48
- }), b();
44
+ C && qe(h, {
45
+ team: T,
46
+ title: A.current,
47
+ body: P
48
+ }), x();
49
49
  }, t = (t) => {
50
50
  if (!(t.key !== "Escape" || J !== null || Pt.current) && !document.querySelector("[role=\"menu\"], [role=\"listbox\"]")) {
51
- if (k.current === O && N === lt.current) return e();
51
+ if (A.current === k && P === ct.current) return e();
52
52
  Pt.current = !0, Mt({
53
- title: A("closeTitle"),
54
- description: A(S ? "closeKeepsDraft" : "closeLoses"),
55
- confirmLabel: j("close"),
53
+ title: j("closeTitle"),
54
+ description: j(C ? "closeKeepsDraft" : "closeLoses"),
55
+ confirmLabel: M("close"),
56
56
  onConfirm: async () => e()
57
57
  }).finally(() => {
58
58
  Pt.current = !1;
@@ -62,16 +62,16 @@ function m({ workspace: m, defaultTeam: h, defaultTitle: Ye = "", defaultBody: g
62
62
  return window.addEventListener("keydown", t, !0), () => window.removeEventListener("keydown", t, !0);
63
63
  }, [
64
64
  J,
65
- S,
66
- m,
67
- w,
68
- N,
69
- O,
70
- b,
65
+ C,
66
+ h,
67
+ T,
68
+ P,
69
+ k,
70
+ x,
71
71
  Mt,
72
- A,
73
- j
74
- ]), He(() => {
72
+ j,
73
+ M
74
+ ]), Ve(() => {
75
75
  let e = (e) => {
76
76
  if (e.metaKey || e.ctrlKey || e.altKey || e.key.length !== 1 || document.activeElement && document.activeElement !== document.body) return;
77
77
  let t = document.querySelector("[role=\"dialog\"]");
@@ -82,173 +82,173 @@ function m({ workspace: m, defaultTeam: h, defaultTitle: Ye = "", defaultBody: g
82
82
  return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
83
83
  }, []);
84
84
  let Ft = () => {
85
- S && Je(m, {
86
- team: w,
85
+ C && qe(h, {
86
+ team: T,
87
87
  title: "",
88
88
  body: ""
89
- }), b();
90
- }, X = T.find((e) => e.id === ut) ?? T.find((e) => e.category === "unstarted"), Z = c(null), Q = c(/* @__PURE__ */ new Map()), It = ye(), Lt = u("issue.attachments"), Rt = async (e, t) => {
89
+ }), x();
90
+ }, X = E.find((e) => e.id === lt) ?? E.find((e) => e.category === "triage") ?? E.find((e) => e.category === "unstarted"), Z = l(null), Q = l(/* @__PURE__ */ new Map()), It = ve(), Lt = d("issue.attachments"), Rt = async (e, t) => {
91
91
  if (!It) {
92
- Ve.error(Lt("off", { name: e[0]?.name ?? "" }));
92
+ Be.error(Lt("off", { name: e[0]?.name ?? "" }));
93
93
  return;
94
94
  }
95
95
  let n = await Promise.all(e.map(async (e) => ({
96
96
  file: e,
97
- src: await se(e)
97
+ src: await oe(e)
98
98
  })));
99
99
  for (let { file: e, src: t } of n) Q.current.set(t, e);
100
- Z.current && !Z.current.isDestroyed && oe(Z.current, n, t);
100
+ Z.current && !Z.current.isDestroyed && ae(Z.current, n, t);
101
101
  }, zt = async (t) => {
102
- let n = N;
103
- for (let [e, r] of Q.current) if (N.includes(e)) try {
104
- let i = await ce(m, t, r);
105
- n = n.replaceAll(`(${e})`, `(${ae}${i.id})`);
102
+ let n = P;
103
+ for (let [e, r] of Q.current) if (P.includes(e)) try {
104
+ let i = await se(h, t, r);
105
+ n = n.replaceAll(`(${e})`, `(${ie}${i.id})`);
106
106
  } catch (t) {
107
- n = fe(n, e), Ve.error(A("attachFailed", {
107
+ n = de(n, e), Be.error(j("attachFailed", {
108
108
  name: r.name,
109
- reason: ct(t)
109
+ reason: st(t)
110
110
  }));
111
111
  }
112
112
  await e.PATCH("/api/v1/workspaces/{workspace}/issues/{identifier}", {
113
113
  params: { path: {
114
- workspace: m,
114
+ workspace: h,
115
115
  identifier: t
116
116
  } },
117
117
  body: { body: n }
118
118
  });
119
119
  }, Bt = async (r, i) => {
120
- if (!w) return !1;
120
+ if (!T) return !1;
121
121
  kt(null);
122
- let ee = [...Q.current.keys()].filter((e) => N.includes(e));
122
+ let a = [...Q.current.keys()].filter((e) => P.includes(e));
123
123
  try {
124
- let a = t(await e.POST("/api/v1/workspaces/{workspace}/teams/{key}/issues", {
124
+ let o = t(await e.POST("/api/v1/workspaces/{workspace}/teams/{key}/issues", {
125
125
  params: { path: {
126
- workspace: m,
127
- key: w
126
+ workspace: h,
127
+ key: T
128
128
  } },
129
129
  body: {
130
130
  title: r,
131
- body: ee.reduce(fe, N),
132
- priority: F,
131
+ body: a.reduce(de, P),
132
+ priority: I,
133
133
  ...X && { statusId: X.id },
134
- assignees: V.map(re),
135
- labelIds: H,
134
+ assignees: H.map(ne),
135
+ labelIds: U,
136
136
  ...q && { typeId: q.id },
137
- ...Object.values(U).some(o) && { fields: Object.fromEntries(Object.entries(U).filter(([, e]) => o(e))) },
138
- ...I && Ne(B).includes(I) && { estimate: I },
139
- ...L && { dueDate: L },
140
- ...R && { cycleId: R },
141
- ...(!h || w === h) && _ && { area: _ },
142
- ...(!h || w === h) && v && { origin: v },
143
- ...(!h || w === h) && y.projectId && { projectId: y.projectId }
137
+ ...Object.values(W).some(s) && { fields: Object.fromEntries(Object.entries(W).filter(([, e]) => s(e))) },
138
+ ...L && Me(V).includes(L) && { estimate: L },
139
+ ...R && { dueDate: R },
140
+ ...z && { cycleId: z },
141
+ ...(!g || T === g) && v && { area: v },
142
+ ...(!g || T === g) && y && { origin: y },
143
+ ...(!g || T === g) && b.projectId && { projectId: b.projectId }
144
144
  }
145
145
  }));
146
- return ee.length > 0 && await zt(a.identifier), n(At, m, a.identifier), Xe?.(a), i && jt({
146
+ return a.length > 0 && await zt(o.identifier), n(At, h, o.identifier), Ye?.(o), i && jt({
147
147
  to: "/$workspace/issues/$identifier",
148
148
  params: {
149
- workspace: m,
150
- identifier: a.identifier
149
+ workspace: h,
150
+ identifier: o.identifier
151
151
  }
152
152
  }), !0;
153
153
  } catch (e) {
154
- return kt(ct(e)), !1;
154
+ return kt(st(e)), !1;
155
155
  }
156
- }, $ = Be({ size: "sm" });
157
- if (x.length === 0) return /* @__PURE__ */ d(ze, {
156
+ }, $ = ze({ size: "sm" });
157
+ if (S.length === 0) return /* @__PURE__ */ f(Re, {
158
158
  open: !0,
159
- onClose: b,
159
+ onClose: x,
160
160
  size: "lg",
161
- title: A("noTeamTitle"),
162
- description: A(M ? "noTeamDescription" : "noTeamAskAdmin"),
163
- ...!M && { footer: /* @__PURE__ */ d(Ie, {
161
+ title: j("noTeamTitle"),
162
+ description: j(N ? "noTeamDescription" : "noTeamAskAdmin"),
163
+ ...!N && { footer: /* @__PURE__ */ f(Fe, {
164
164
  type: "button",
165
- onClick: b,
166
- children: j("close")
165
+ onClick: x,
166
+ children: M("close")
167
167
  }) },
168
- children: M && /* @__PURE__ */ d(Fe, {
169
- workspace: m,
168
+ children: N && /* @__PURE__ */ f(Pe, {
169
+ workspace: h,
170
170
  autoFocus: !0,
171
- onCreated: (e) => et(e.key)
171
+ onCreated: (e) => $e(e.key)
172
172
  })
173
173
  });
174
- let Vt = x.find((e) => e.key === w);
175
- return /* @__PURE__ */ f(We, { children: [/* @__PURE__ */ d(Le, {
174
+ let Vt = S.find((e) => e.key === T);
175
+ return /* @__PURE__ */ p(Ue, { children: [/* @__PURE__ */ f(Ie, {
176
176
  open: !0,
177
177
  onClose: Ft,
178
178
  size: "xl",
179
- typeIcon: /* @__PURE__ */ d(De, { className: "size-3.5" }),
179
+ typeIcon: /* @__PURE__ */ f(Ee, { className: "size-3.5" }),
180
180
  typeLabel: Vt?.name ?? "",
181
- typeMenu: x.map((e) => ({
181
+ typeMenu: S.map((e) => ({
182
182
  label: e.name,
183
183
  hint: e.key,
184
- checked: e.key === w,
184
+ checked: e.key === T,
185
185
  onClick: () => {
186
- et(e.key), dt(null), nt(null), W({}), Ct(null), ht("");
186
+ $e(e.key), ut(null), tt(null), St({}), Ct(null), mt("");
187
187
  }
188
188
  })),
189
189
  typeMenuSearch: {
190
- placeholder: A("moveToTeam"),
191
- empty: A("noTeamMatches")
190
+ placeholder: j("moveToTeam"),
191
+ empty: j("noTeamMatches")
192
192
  },
193
- namePlaceholder: A("issueTitle"),
194
- initialName: O,
193
+ namePlaceholder: j("issueTitle"),
194
+ initialName: k,
195
195
  onNameChange: (e) => {
196
- k.current = e;
196
+ A.current = e;
197
197
  },
198
- submitLabel: A("create"),
199
- descriptionField: /* @__PURE__ */ f("div", {
198
+ submitLabel: j("create"),
199
+ descriptionField: /* @__PURE__ */ p("div", {
200
200
  className: "min-h-24 pb-2",
201
- children: [/* @__PURE__ */ d(xe, {
202
- value: N,
203
- onChange: P,
201
+ children: [/* @__PURE__ */ f(be, {
202
+ value: P,
203
+ onChange: F,
204
204
  onFiles: (e, t) => void Rt(e, t),
205
205
  onEditor: (e) => {
206
206
  Z.current = e;
207
207
  },
208
208
  onSubmit: () => {},
209
- placeholder: A("descriptionPlaceholder"),
210
- label: j("description"),
209
+ placeholder: j("descriptionPlaceholder"),
210
+ label: M("description"),
211
211
  className: "min-h-24"
212
- }), /* @__PURE__ */ d(be, {
213
- workspace: m,
214
- teamId: x.find((e) => e.key === w)?.id,
212
+ }), /* @__PURE__ */ f(ye, {
213
+ workspace: h,
214
+ teamId: S.find((e) => e.key === T)?.id,
215
215
  typeId: G,
216
- values: U,
217
- onChange: W
216
+ values: W,
217
+ onChange: St
218
218
  })]
219
219
  }),
220
- dirty: N !== g || D !== null || ut !== null || F !== 0 || I !== 0 || L !== "" || R !== "" || V.length > 0 || H.length > 0 || G !== null || Object.values(U).some(o),
221
- footerHint: A("hint"),
220
+ dirty: P !== _ || O !== null || lt !== null || I !== 0 || L !== 0 || R !== "" || z !== "" || H.length > 0 || U.length > 0 || G !== null || Object.values(W).some(s),
221
+ footerHint: j("hint"),
222
222
  error: Ot,
223
223
  onSubmit: (e, t, n, { modifier: r }) => Bt(e, r),
224
- properties: /* @__PURE__ */ f(We, { children: [
225
- E.length > 0 && /* @__PURE__ */ d(s, {
224
+ properties: /* @__PURE__ */ p(Ue, { children: [
225
+ D.length > 0 && /* @__PURE__ */ f(c, {
226
226
  open: J === "template",
227
227
  onOpenChange: (e) => Y(e ? "template" : null),
228
- items: E.map((e) => ({
228
+ items: D.map((e) => ({
229
229
  value: e.id,
230
230
  label: e.name,
231
- icon: /* @__PURE__ */ d(Ee, { className: "size-3.5 text-muted-foreground" })
231
+ icon: /* @__PURE__ */ f(Te, { className: "size-3.5 text-muted-foreground" })
232
232
  })),
233
- value: D,
233
+ value: O,
234
234
  onValueChange: (e) => {
235
- let t = E.find((t) => t.id === e);
236
- t && (nt(t.id), t.title && (it(t.title), k.current = t.title), P(t.body), ft(t.priority), St(t.labelIds), W(t.fields), Ct(t.typeId ?? null));
235
+ let t = D.find((t) => t.id === e);
236
+ t && (tt(t.id), t.title && (rt(t.title), A.current = t.title), F(t.body), dt(t.priority), xt(t.labelIds), St(t.fields), Ct(t.typeId ?? null));
237
237
  },
238
- placeholder: at("choose"),
239
- trigger: /* @__PURE__ */ f("button", {
238
+ placeholder: it("choose"),
239
+ trigger: /* @__PURE__ */ p("button", {
240
240
  type: "button",
241
241
  className: $,
242
- children: [/* @__PURE__ */ d(Ee, { className: "size-3.5" }), rt?.name ?? at("choose")]
242
+ children: [/* @__PURE__ */ f(Te, { className: "size-3.5" }), nt?.name ?? it("choose")]
243
243
  })
244
244
  }),
245
- K.length > 0 && /* @__PURE__ */ d(s, {
245
+ K.length > 0 && /* @__PURE__ */ f(c, {
246
246
  open: J === "type",
247
247
  onOpenChange: (e) => Y(e ? "type" : null),
248
248
  items: K.map((e) => ({
249
249
  value: e.id,
250
250
  label: e.name,
251
- icon: /* @__PURE__ */ d(Se, {
251
+ icon: /* @__PURE__ */ f(xe, {
252
252
  type: e,
253
253
  className: "size-3.5"
254
254
  })
@@ -256,44 +256,44 @@ function m({ workspace: m, defaultTeam: h, defaultTitle: Ye = "", defaultBody: g
256
256
  value: G,
257
257
  onValueChange: (e) => {
258
258
  let t = K.find((t) => t.id === e);
259
- Ct(t?.id ?? null), t?.template && !N.trim() && P(t.template);
259
+ Ct(t?.id ?? null), t?.template && !P.trim() && F(t.template);
260
260
  },
261
261
  placeholder: Tt("type"),
262
- trigger: /* @__PURE__ */ f("button", {
262
+ trigger: /* @__PURE__ */ p("button", {
263
263
  type: "button",
264
264
  className: $,
265
- children: [q && /* @__PURE__ */ d(Se, {
265
+ children: [q && /* @__PURE__ */ f(xe, {
266
266
  type: q,
267
267
  className: "size-3.5"
268
268
  }), q?.name ?? Tt("type")]
269
269
  })
270
270
  }),
271
- /* @__PURE__ */ d(s, {
271
+ /* @__PURE__ */ f(c, {
272
272
  open: J === "status",
273
273
  onOpenChange: (e) => Y(e ? "status" : null),
274
- items: T.map((e) => ({
274
+ items: E.map((e) => ({
275
275
  value: e.id,
276
276
  label: e.name,
277
- icon: /* @__PURE__ */ d(ke, {
277
+ icon: /* @__PURE__ */ f(Oe, {
278
278
  category: e.category,
279
279
  review: e.review,
280
280
  step: e.step
281
281
  })
282
282
  })),
283
283
  value: X?.id ?? null,
284
- onValueChange: (e) => e !== null && dt(e),
285
- placeholder: A("changeStatus"),
286
- trigger: /* @__PURE__ */ f("button", {
284
+ onValueChange: (e) => e !== null && ut(e),
285
+ placeholder: j("changeStatus"),
286
+ trigger: /* @__PURE__ */ p("button", {
287
287
  type: "button",
288
288
  className: $,
289
- children: [X && /* @__PURE__ */ d(ke, {
289
+ children: [X && /* @__PURE__ */ f(Oe, {
290
290
  category: X.category,
291
291
  review: X.review,
292
292
  step: X.step
293
- }), X?.name ?? j("status")]
293
+ }), X?.name ?? M("status")]
294
294
  })
295
295
  }),
296
- /* @__PURE__ */ d(s, {
296
+ /* @__PURE__ */ f(c, {
297
297
  open: J === "priority",
298
298
  onOpenChange: (e) => Y(e ? "priority" : null),
299
299
  items: [
@@ -304,125 +304,125 @@ function m({ workspace: m, defaultTeam: h, defaultTitle: Ye = "", defaultBody: g
304
304
  0
305
305
  ].map((e) => ({
306
306
  value: String(e),
307
- label: st[e] ?? "",
308
- icon: /* @__PURE__ */ d(Oe, { priority: e })
307
+ label: ot[e] ?? "",
308
+ icon: /* @__PURE__ */ f(De, { priority: e })
309
309
  })),
310
- value: String(F),
311
- onValueChange: (e) => e !== null && ft(Number(e)),
312
- placeholder: A("setPriority"),
313
- trigger: /* @__PURE__ */ f("button", {
310
+ value: String(I),
311
+ onValueChange: (e) => e !== null && dt(Number(e)),
312
+ placeholder: j("setPriority"),
313
+ trigger: /* @__PURE__ */ p("button", {
314
314
  type: "button",
315
315
  className: $,
316
- children: [/* @__PURE__ */ d(Oe, { priority: F }), F ? st[F] : j("priority")]
316
+ children: [/* @__PURE__ */ f(De, { priority: I }), I ? ot[I] : M("priority")]
317
317
  })
318
318
  }),
319
- /* @__PURE__ */ d(s, {
319
+ /* @__PURE__ */ f(c, {
320
320
  multiple: !0,
321
321
  open: J === "assignees",
322
322
  onOpenChange: (e) => Y(e ? "assignees" : null),
323
- items: ot,
324
- value: V,
323
+ items: at,
324
+ value: H,
325
325
  onValueChange: (e) => {
326
- xt(e), Et();
326
+ bt(e), Et();
327
327
  },
328
- placeholder: A("assignTo"),
329
- trigger: /* @__PURE__ */ f("button", {
328
+ placeholder: j("assignTo"),
329
+ trigger: /* @__PURE__ */ p("button", {
330
330
  type: "button",
331
331
  className: $,
332
- children: [/* @__PURE__ */ d(je, { className: "size-3.5" }), V.length ? A("assignedCount", { count: V.length }) : j("assignee")]
332
+ children: [/* @__PURE__ */ f(Ae, { className: "size-3.5" }), H.length ? j("assignedCount", { count: H.length }) : M("assignee")]
333
333
  })
334
334
  }),
335
- /* @__PURE__ */ d(s, {
335
+ /* @__PURE__ */ f(c, {
336
336
  multiple: !0,
337
337
  open: J === "labels",
338
338
  onOpenChange: (e) => Y(e ? "labels" : null),
339
- items: tt.map((e) => ({
339
+ items: et.map((e) => ({
340
340
  value: e.id,
341
341
  label: e.name,
342
- icon: /* @__PURE__ */ f("span", {
342
+ icon: /* @__PURE__ */ p("span", {
343
343
  className: "flex items-center gap-2",
344
- children: [/* @__PURE__ */ d(pe, {}), /* @__PURE__ */ d("span", {
344
+ children: [/* @__PURE__ */ f(fe, {}), /* @__PURE__ */ f("span", {
345
345
  className: "size-2.5 rounded-full",
346
346
  style: { background: e.color }
347
347
  })]
348
348
  })
349
349
  })),
350
- value: H,
350
+ value: U,
351
351
  onValueChange: (e) => {
352
- St(e), Dt();
352
+ xt(e), Dt();
353
353
  },
354
- placeholder: A("addLabels"),
355
- trigger: /* @__PURE__ */ f("button", {
354
+ placeholder: j("addLabels"),
355
+ trigger: /* @__PURE__ */ p("button", {
356
356
  type: "button",
357
357
  className: $,
358
- children: [/* @__PURE__ */ d(Ae, { className: "size-3.5" }), H.length ? A("labelCount", { count: H.length }) : j("labels")]
358
+ children: [/* @__PURE__ */ f(ke, { className: "size-3.5" }), U.length ? j("labelCount", { count: U.length }) : M("labels")]
359
359
  })
360
360
  }),
361
- B !== "none" && /* @__PURE__ */ d(s, {
361
+ V !== "none" && /* @__PURE__ */ f(c, {
362
362
  open: J === "estimate",
363
363
  onOpenChange: (e) => Y(e ? "estimate" : null),
364
- items: [0, ...Ne(B)].map((e) => ({
364
+ items: [0, ...Me(V)].map((e) => ({
365
365
  value: String(e),
366
- label: e ? gt(e, B) : z("noEstimate")
366
+ label: e ? ht(e, V) : B("noEstimate")
367
367
  })),
368
- value: String(I),
369
- onValueChange: (e) => e !== null && pt(Number(e)),
370
- placeholder: z("setEstimate"),
371
- trigger: /* @__PURE__ */ f("button", {
368
+ value: String(L),
369
+ onValueChange: (e) => e !== null && ft(Number(e)),
370
+ placeholder: B("setEstimate"),
371
+ trigger: /* @__PURE__ */ p("button", {
372
372
  type: "button",
373
373
  className: $,
374
- children: [/* @__PURE__ */ d(Te, { className: "size-3.5" }), I ? gt(I, B) : z("estimate")]
374
+ children: [/* @__PURE__ */ f(we, { className: "size-3.5" }), L ? ht(L, V) : B("estimate")]
375
375
  })
376
376
  }),
377
- Vt?.cyclesEnabled && /* @__PURE__ */ d(s, {
377
+ Vt?.cyclesEnabled && /* @__PURE__ */ f(c, {
378
378
  open: J === "cycle",
379
379
  onOpenChange: (e) => Y(e ? "cycle" : null),
380
380
  items: [{
381
381
  value: "",
382
- label: z("noCycle")
383
- }, ...vt.filter((e) => e.state !== "past").map((e) => ({
382
+ label: B("noCycle")
383
+ }, ..._t.filter((e) => e.state !== "past").map((e) => ({
384
384
  value: e.id,
385
- label: bt(e),
386
- description: z("stateAndDates", {
387
- state: z(`states.${e.state}`),
388
- dates: _t.dayRange(e.startsOn, e.endsOn)
385
+ label: yt(e),
386
+ description: B("stateAndDates", {
387
+ state: B(`states.${e.state}`),
388
+ dates: gt.dayRange(e.startsOn, e.endsOn)
389
389
  })
390
390
  }))],
391
- value: R,
392
- onValueChange: (e) => e !== null && ht(e),
393
- placeholder: z("cycleLabel"),
394
- trigger: /* @__PURE__ */ f("button", {
391
+ value: z,
392
+ onValueChange: (e) => e !== null && mt(e),
393
+ placeholder: B("cycleLabel"),
394
+ trigger: /* @__PURE__ */ p("button", {
395
395
  type: "button",
396
396
  className: $,
397
- children: [/* @__PURE__ */ d(we, { className: "size-3.5" }), yt ? bt(yt) : z("cycleLabel")]
397
+ children: [/* @__PURE__ */ f(Ce, { className: "size-3.5" }), vt ? yt(vt) : B("cycleLabel")]
398
398
  })
399
399
  }),
400
- /* @__PURE__ */ d(Re, {
401
- value: L,
402
- onValueChange: mt,
403
- "aria-label": z("dueDate"),
404
- trigger: /* @__PURE__ */ f("button", {
400
+ /* @__PURE__ */ f(Le, {
401
+ value: R,
402
+ onValueChange: pt,
403
+ "aria-label": B("dueDate"),
404
+ trigger: /* @__PURE__ */ p("button", {
405
405
  type: "button",
406
406
  className: $,
407
- children: [/* @__PURE__ */ d(Ce, { className: "size-3.5" }), L ? z("dueOn", { date: _t.day(L) }) : z("dueDate")]
407
+ children: [/* @__PURE__ */ f(Se, { className: "size-3.5" }), R ? B("dueOn", { date: gt.day(R) }) : B("dueDate")]
408
408
  })
409
409
  }),
410
- /* @__PURE__ */ d(ve, { onFiles: (e) => void Rt(e) })
410
+ /* @__PURE__ */ f(_e, { onFiles: (e) => void Rt(e) })
411
411
  ] })
412
412
  }), Nt] });
413
413
  }
414
- var h = (e) => `tandem:new-issue-draft:${e}`;
415
- function qe(e) {
414
+ var g = (e) => `tandem:new-issue-draft:${e}`;
415
+ function Ke(e) {
416
416
  try {
417
- let t = JSON.parse(localStorage.getItem(h(e)) ?? "null");
417
+ let t = JSON.parse(localStorage.getItem(g(e)) ?? "null");
418
418
  return t && typeof t.title == "string" && typeof t.body == "string" ? t : void 0;
419
419
  } catch {
420
420
  return;
421
421
  }
422
422
  }
423
- function Je(e, t) {
423
+ function qe(e, t) {
424
424
  try {
425
- t.title.trim() || t.body.trim() ? localStorage.setItem(h(e), JSON.stringify(t)) : localStorage.removeItem(h(e));
425
+ t.title.trim() || t.body.trim() ? localStorage.setItem(g(e), JSON.stringify(t)) : localStorage.removeItem(g(e));
426
426
  } catch {}
427
427
  }
428
- export { m as NewIssueDialog };
428
+ export { h as NewIssueDialog };