@burdenoff/microfe-govcitizenhub 2026.720.4 → 2026.720.5

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 (23) hide show
  1. package/dist/govcitizenhub/components/DynamicFormFields.d.ts +17 -0
  2. package/dist/govcitizenhub/components/DynamicFormFields.d.ts.map +1 -0
  3. package/dist/govcitizenhub/components/DynamicFormFields.js +101 -0
  4. package/dist/govcitizenhub/components/DynamicFormFields.js.map +1 -0
  5. package/dist/govcitizenhub/pages/applications/ApplicationsPage.d.ts.map +1 -1
  6. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js +170 -150
  7. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js.map +1 -1
  8. package/dist/govcitizenhub/pages/applications/NewApplicationPage.d.ts +9 -5
  9. package/dist/govcitizenhub/pages/applications/NewApplicationPage.d.ts.map +1 -1
  10. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js +148 -244
  11. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js.map +1 -1
  12. package/dist/govcitizenhub/pages/services/FormFieldBuilder.d.ts +7 -28
  13. package/dist/govcitizenhub/pages/services/FormFieldBuilder.d.ts.map +1 -1
  14. package/dist/govcitizenhub/pages/services/FormFieldBuilder.js +203 -136
  15. package/dist/govcitizenhub/pages/services/FormFieldBuilder.js.map +1 -1
  16. package/dist/govcitizenhub/pages/services/ServiceFormDialog.d.ts.map +1 -1
  17. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js +156 -114
  18. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js.map +1 -1
  19. package/dist/govcitizenhub/utils/dynamicForm.d.ts +46 -0
  20. package/dist/govcitizenhub/utils/dynamicForm.d.ts.map +1 -0
  21. package/dist/govcitizenhub/utils/dynamicForm.js +59 -0
  22. package/dist/govcitizenhub/utils/dynamicForm.js.map +1 -0
  23. package/package.json +1 -1
@@ -1,96 +1,73 @@
1
1
  import { useGovCitizenHub as e } from "../../context/GovCitizenHubContext.js";
2
2
  import "../../context/index.js";
3
- import { cn as t } from "../../utils/cn.js";
4
- import { PageLayout as n } from "../../components/PageLayout.js";
5
- import { formatCurrency as r } from "../../utils/formatters.js";
6
- import { StatusBadge as i } from "../../components/StatusBadge.js";
7
- import { EmptyState as a } from "../../components/EmptyState.js";
8
- import { useGovCreateApplication as o, useGovService as s, useGovServices as ee, useGovSubmitApplication as te } from "../../hooks/useGovApi.js";
9
- import { FILE_FOLDERS as ne, uploadFileToFiles as re } from "../../hooks/useFiles.js";
3
+ import { PageLayout as t } from "../../components/PageLayout.js";
4
+ import { formatCurrency as n } from "../../utils/formatters.js";
5
+ import { StatusBadge as r } from "../../components/StatusBadge.js";
6
+ import { EmptyState as i } from "../../components/EmptyState.js";
7
+ import { useGovCreateApplication as ee, useGovService as te, useGovServices as ne, useGovSubmitApplication as a } from "../../hooks/useGovApi.js";
8
+ import { FILE_FOLDERS as o, uploadFileToFiles as s } from "../../hooks/useFiles.js";
10
9
  import "../../hooks/index.js";
11
10
  import { ErrorView as c, LoadingView as l } from "../../components/StateViews.js";
12
11
  import { describeError as u, notify as d } from "../../lib/toast.js";
13
- import { StatusStepper as ie } from "../../components/StatusStepper.js";
12
+ import { StatusStepper as re } from "../../components/StatusStepper.js";
14
13
  import { KeyValueList as f } from "../../components/KeyValueList.js";
15
- import { useMemo as ae, useState as p } from "react";
16
- import { CheckCircle2 as m, ChevronLeft as oe, ChevronRight as h, Clock as g, FileText as _, Loader2 as v, Save as y, Send as se, UploadCloud as b } from "lucide-react";
17
- import { useSearchParams as ce } from "react-router-dom";
18
- import { Fragment as le, jsx as x, jsxs as S } from "react/jsx-runtime";
19
- import { Button as C, GlassCard as w, Input as T, Label as E, Select as D, SelectContent as O, SelectItem as k, SelectTrigger as A, SelectValue as j, Textarea as M } from "@burdenoff/fe-libs/ui";
14
+ import { isFieldVisible as ie, parseFormFields as ae } from "../../utils/dynamicForm.js";
15
+ import { DynamicFormFields as p } from "../../components/DynamicFormFields.js";
16
+ import { useMemo as m, useState as h } from "react";
17
+ import { ChevronLeft as g, ChevronRight as _, Clock as v, FileText as y, Loader2 as b, Save as x, Send as oe } from "lucide-react";
18
+ import { useSearchParams as se } from "react-router-dom";
19
+ import { Fragment as ce, jsx as S, jsxs as C } from "react/jsx-runtime";
20
+ import { Button as w, GlassCard as T, Input as le, Label as E, Select as ue, SelectContent as de, SelectItem as fe, SelectTrigger as pe, SelectValue as me, Textarea as he } from "@burdenoff/fe-libs/ui";
20
21
  //#region src/govcitizenhub/pages/applications/NewApplicationPage.tsx
21
- var ue = [
22
+ var ge = [
22
23
  "LOW",
23
24
  "NORMAL",
24
25
  "HIGH",
25
26
  "URGENT"
26
- ];
27
- function de(e) {
28
- let t = (e, t) => {
29
- if (!e || typeof e != "object") return null;
30
- let n = e, r = String(n.key ?? n.name ?? n.id ?? t), i = String(n.label ?? n.title ?? r), a = String(n.type ?? "text").toLowerCase(), o = Array.isArray(n.options) ? n.options.map((e) => String(e)) : Array.isArray(n.enum) ? n.enum.map((e) => String(e)) : void 0, s = "text";
31
- return o && o.length ? s = "select" : a.includes("area") || a === "textarea" || a === "multiline" ? s = "textarea" : a === "number" || a === "integer" || a === "float" ? s = "number" : a === "date" || a === "datetime" ? s = "date" : (a === "file" || a === "upload") && (s = "file"), {
32
- key: r,
33
- label: i,
34
- type: s,
35
- required: !!n.required,
36
- options: o
37
- };
38
- };
39
- if (Array.isArray(e)) return e.map((e, n) => t(e, `field_${n}`)).filter((e) => !!e);
40
- if (e && typeof e == "object") {
41
- let n = e;
42
- if (Array.isArray(n.fields)) return n.fields.map((e, n) => t(e, `field_${n}`)).filter((e) => !!e);
43
- if (n.properties && typeof n.properties == "object") return Object.entries(n.properties).map(([e, n]) => t({
44
- ...n,
45
- key: e
46
- }, e)).filter((e) => !!e);
47
- }
48
- return [];
49
- }
50
- var N = [
27
+ ], D = [
51
28
  "choose",
52
29
  "fill",
53
30
  "review"
54
31
  ];
55
- function fe({ service: e }) {
56
- return /* @__PURE__ */ S("div", {
32
+ function O({ service: e }) {
33
+ return /* @__PURE__ */ C("div", {
57
34
  className: "flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-xl border border-border-seam bg-[var(--color-accent-soft)]/50 px-4 py-3",
58
35
  children: [
59
- /* @__PURE__ */ x("span", {
36
+ /* @__PURE__ */ S("span", {
60
37
  className: "inline-flex size-9 shrink-0 items-center justify-center rounded-lg bg-bg-surface text-action-primary-text",
61
- children: /* @__PURE__ */ x(_, { className: "size-5" })
38
+ children: /* @__PURE__ */ S(y, { className: "size-5" })
62
39
  }),
63
- /* @__PURE__ */ x("span", {
40
+ /* @__PURE__ */ S("span", {
64
41
  className: "text-base font-semibold text-text-primary",
65
42
  children: e.name
66
43
  }),
67
- /* @__PURE__ */ x("span", {
44
+ /* @__PURE__ */ S("span", {
68
45
  "aria-hidden": !0,
69
46
  className: "text-text-muted",
70
47
  children: "·"
71
48
  }),
72
- /* @__PURE__ */ x("span", {
49
+ /* @__PURE__ */ S("span", {
73
50
  className: "text-sm text-text-secondary",
74
51
  children: e.agency?.name ?? "Agency"
75
52
  }),
76
- /* @__PURE__ */ x("span", {
53
+ /* @__PURE__ */ S("span", {
77
54
  "aria-hidden": !0,
78
55
  className: "text-text-muted",
79
56
  children: "·"
80
57
  }),
81
- /* @__PURE__ */ x("span", {
58
+ /* @__PURE__ */ S("span", {
82
59
  className: "text-sm text-text-secondary",
83
- children: e.feeType === "FREE" ? "Free" : r(e.feeAmount, e.currency)
60
+ children: e.feeType === "FREE" ? "Free" : n(e.feeAmount, e.currency)
84
61
  }),
85
- /* @__PURE__ */ x("span", {
62
+ /* @__PURE__ */ S("span", {
86
63
  "aria-hidden": !0,
87
64
  className: "text-text-muted",
88
65
  children: "·"
89
66
  }),
90
- /* @__PURE__ */ S("span", {
67
+ /* @__PURE__ */ C("span", {
91
68
  className: "inline-flex items-center gap-1 text-sm text-text-secondary",
92
69
  children: [
93
- /* @__PURE__ */ x(g, { className: "size-3.5" }),
70
+ /* @__PURE__ */ S(v, { className: "size-3.5" }),
94
71
  " ",
95
72
  e.slaDays,
96
73
  "-day SLA"
@@ -99,390 +76,317 @@ function fe({ service: e }) {
99
76
  ]
100
77
  });
101
78
  }
102
- function P() {
103
- let { navigateTo: m } = e(), [g] = ce(), b = g.get("serviceId") ?? void 0, [P, me] = p(b), [F, I] = p(!1), L = P ?? b, R = ee({
79
+ function k() {
80
+ let { navigateTo: v } = e(), [k] = se(), A = k.get("serviceId") ?? void 0, [j, M] = h(A), [N, P] = h(!1), F = j ?? A, I = ne({
104
81
  status: "PUBLISHED",
105
82
  pagination: { limit: 50 }
106
- }), { data: z, isLoading: he, isError: ge, refetch: _e } = s(L), B = o(), V = te(), H = ae(() => de(z?.formSchema ?? null), [z?.formSchema]), [U, ve] = p({}), [W, ye] = p({}), [be, G] = p(null), [K, xe] = p(""), [q, Se] = p(""), [J, Ce] = p("NORMAL"), Y = (e, t) => ve((n) => ({
83
+ }), { data: L, isLoading: _e, isError: ve, refetch: ye } = te(F), R = ee(), z = a(), B = m(() => ae(L?.formSchema ?? null), [L?.formSchema]), [V, be] = h({}), [H, xe] = h({}), [Se, U] = h(null), [W, Ce] = h(""), [G, we] = h(""), [K, Te] = h("NORMAL"), q = (e, t) => be((n) => ({
107
84
  ...n,
108
85
  [e]: t
109
- })), we = async (e, t) => {
86
+ })), J = async (e, t) => {
110
87
  let n = t?.[0];
111
88
  if (n) {
112
- G(e);
89
+ U(e);
113
90
  try {
114
- let t = await re(n, ne.documents);
115
- Y(e, t.id), ye((n) => ({
91
+ let t = await s(n, o.documents);
92
+ q(e, t.id), xe((n) => ({
116
93
  ...n,
117
94
  [e]: t.name
118
95
  }));
119
96
  } catch (e) {
120
97
  d.error("Upload failed", u(e));
121
98
  } finally {
122
- G(null);
99
+ U(null);
123
100
  }
124
101
  }
125
- }, Te = () => {
126
- if (H.length > 0) {
102
+ }, Y = m(() => B.filter((e) => ie(e, V, B)), [B, V]), Ee = () => {
103
+ if (Y.length > 0) {
127
104
  let e = {};
128
- for (let t of H) e[t.key] = U[t.key] ?? "";
105
+ for (let t of Y) e[t.key] = V[t.key] ?? "";
129
106
  return e;
130
107
  }
131
- return K.trim() ? { details: K.trim() } : {};
132
- }, X = H.some((e) => e.required && !(U[e.key] ?? "").trim()), Z = async (e) => {
133
- if (L) try {
134
- let t = await B.mutateAsync({
135
- serviceId: L,
136
- formData: Te(),
137
- priority: J,
138
- reference: q.trim() || null
108
+ return W.trim() ? { details: W.trim() } : {};
109
+ }, X = Y.some((e) => e.required && !(V[e.key] ?? "").trim()), Z = async (e) => {
110
+ if (F) try {
111
+ let t = await R.mutateAsync({
112
+ serviceId: F,
113
+ formData: Ee(),
114
+ priority: K,
115
+ reference: G.trim() || null
139
116
  });
140
- e ? (await V.mutateAsync(t.id), d.success("Application submitted", t.reference)) : d.success("Draft saved", t.reference), m(`applications/${t.id}`);
117
+ e ? (await z.mutateAsync(t.id), d.success("Application submitted", t.reference)) : d.success("Draft saved", t.reference), v(`applications/${t.id}`);
141
118
  } catch (e) {
142
119
  d.error("Could not file the application", u(e));
143
120
  }
144
- }, Q = B.isPending || V.isPending, Ee = L ? F ? 2 : 1 : 0, De = [
121
+ }, Q = R.isPending || z.isPending, De = F ? N ? 2 : 1 : 0, Oe = [
145
122
  {
146
- key: N[0],
123
+ key: D[0],
147
124
  label: "Choose service"
148
125
  },
149
126
  {
150
- key: N[1],
127
+ key: D[1],
151
128
  label: "Fill form"
152
129
  },
153
130
  {
154
- key: N[2],
131
+ key: D[2],
155
132
  label: "Review & submit"
156
133
  }
157
- ], Oe = (e) => e.type === "file" ? W[e.key] ?? "" : U[e.key] ?? "", $ = /* @__PURE__ */ x(ie, {
158
- steps: De,
159
- current: Ee,
134
+ ], ke = (e) => e.type === "file" ? H[e.key] ?? "" : V[e.key] ?? "", $ = /* @__PURE__ */ S(re, {
135
+ steps: Oe,
136
+ current: De,
160
137
  className: "mb-6"
161
138
  });
162
- return L ? /* @__PURE__ */ S(n, {
139
+ return F ? /* @__PURE__ */ C(t, {
163
140
  title: "New application",
164
141
  back: {
165
142
  label: "Applications",
166
- onClick: () => m("applications")
143
+ onClick: () => v("applications")
167
144
  },
168
- description: z ? `Applying for ${z.name}` : "Loading service…",
169
- children: [$, he ? /* @__PURE__ */ x(l, { label: "Loading service…" }) : ge || !z ? /* @__PURE__ */ x(c, {
145
+ description: L ? `Applying for ${L.name}` : "Loading service…",
146
+ children: [$, _e ? /* @__PURE__ */ S(l, { label: "Loading service…" }) : ve || !L ? /* @__PURE__ */ S(c, {
170
147
  message: "We couldn't load this service.",
171
- onRetry: () => _e()
172
- }) : /* @__PURE__ */ S("div", {
148
+ onRetry: () => ye()
149
+ }) : /* @__PURE__ */ C("div", {
173
150
  className: "max-w-3xl space-y-4",
174
- children: [/* @__PURE__ */ x(fe, { service: z }), F ? /* @__PURE__ */ S(w, {
151
+ children: [/* @__PURE__ */ S(O, { service: L }), N ? /* @__PURE__ */ C(T, {
175
152
  treatment: "plain",
176
153
  className: "border-border-seam p-6",
177
154
  children: [
178
- /* @__PURE__ */ x("h2", {
155
+ /* @__PURE__ */ S("h2", {
179
156
  className: "text-lg font-semibold text-text-primary",
180
157
  children: "Review your application"
181
158
  }),
182
- /* @__PURE__ */ x("p", {
159
+ /* @__PURE__ */ S("p", {
183
160
  className: "mt-0.5 text-sm text-text-muted",
184
161
  children: "Check the details below, then submit or save as a draft."
185
162
  }),
186
- /* @__PURE__ */ S("div", {
163
+ /* @__PURE__ */ C("div", {
187
164
  className: "mt-5 space-y-5",
188
165
  children: [
189
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h3", {
166
+ /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("h3", {
190
167
  className: "mb-2 text-sm font-semibold text-text-secondary",
191
168
  children: "Application"
192
- }), /* @__PURE__ */ x(f, {
169
+ }), /* @__PURE__ */ S(f, {
193
170
  items: [
194
171
  {
195
172
  label: "Service",
196
- value: z.name
173
+ value: L.name
197
174
  },
198
175
  {
199
176
  label: "Agency",
200
- value: z.agency?.name ?? "—"
177
+ value: L.agency?.name ?? "—"
201
178
  },
202
179
  {
203
180
  label: "Priority",
204
- value: J.charAt(0) + J.slice(1).toLowerCase()
181
+ value: K.charAt(0) + K.slice(1).toLowerCase()
205
182
  },
206
183
  {
207
184
  label: "Reference",
208
- value: q.trim() || "Auto-generated"
185
+ value: G.trim() || "Auto-generated"
209
186
  }
210
187
  ],
211
188
  columns: 2
212
189
  })] }),
213
- H.length > 0 && /* @__PURE__ */ S("div", {
190
+ Y.length > 0 && /* @__PURE__ */ C("div", {
214
191
  className: "border-t border-border-seam pt-4",
215
- children: [/* @__PURE__ */ x("h3", {
192
+ children: [/* @__PURE__ */ S("h3", {
216
193
  className: "mb-2 text-sm font-semibold text-text-secondary",
217
194
  children: "Your answers"
218
- }), /* @__PURE__ */ x(f, {
195
+ }), /* @__PURE__ */ S(f, {
219
196
  variant: "stacked",
220
197
  columns: 2,
221
- items: H.map((e) => ({
222
- label: /* @__PURE__ */ S(le, { children: [e.label, e.required && /* @__PURE__ */ x("span", {
198
+ items: Y.map((e) => ({
199
+ label: /* @__PURE__ */ C(ce, { children: [e.label, e.required && /* @__PURE__ */ S("span", {
223
200
  className: "text-status-error-text",
224
201
  children: " *"
225
202
  })] }),
226
- value: Oe(e) || /* @__PURE__ */ x("span", {
203
+ value: ke(e) || /* @__PURE__ */ S("span", {
227
204
  className: "text-text-muted",
228
205
  children: "Not provided"
229
206
  })
230
207
  }))
231
208
  })]
232
209
  }),
233
- H.length === 0 && K.trim() && /* @__PURE__ */ S("div", {
210
+ B.length === 0 && W.trim() && /* @__PURE__ */ C("div", {
234
211
  className: "border-t border-border-seam pt-4",
235
- children: [/* @__PURE__ */ x("h3", {
212
+ children: [/* @__PURE__ */ S("h3", {
236
213
  className: "mb-1.5 text-sm font-semibold text-text-secondary",
237
214
  children: "Details"
238
- }), /* @__PURE__ */ x("p", {
215
+ }), /* @__PURE__ */ S("p", {
239
216
  className: "whitespace-pre-wrap text-sm text-text-primary",
240
- children: K.trim()
217
+ children: W.trim()
241
218
  })]
242
219
  })
243
220
  ]
244
221
  }),
245
- /* @__PURE__ */ S("div", {
222
+ /* @__PURE__ */ C("div", {
246
223
  className: "mt-6 flex flex-col gap-2 sm:flex-row sm:justify-between",
247
- children: [/* @__PURE__ */ S(C, {
224
+ children: [/* @__PURE__ */ C(w, {
248
225
  variant: "ghost",
249
- onClick: () => I(!1),
226
+ onClick: () => P(!1),
250
227
  disabled: Q,
251
- children: [/* @__PURE__ */ x(oe, { className: "mr-1.5 h-4 w-4" }), " Back to edit"]
252
- }), /* @__PURE__ */ S("div", {
228
+ children: [/* @__PURE__ */ S(g, { className: "mr-1.5 h-4 w-4" }), " Back to edit"]
229
+ }), /* @__PURE__ */ C("div", {
253
230
  className: "flex flex-col gap-2 sm:flex-row",
254
- children: [/* @__PURE__ */ S(C, {
231
+ children: [/* @__PURE__ */ C(w, {
255
232
  variant: "outline",
256
233
  onClick: () => Z(!1),
257
234
  disabled: Q,
258
- children: [/* @__PURE__ */ x(y, { className: "mr-1.5 h-4 w-4" }), " Save draft"]
259
- }), /* @__PURE__ */ S(C, {
235
+ children: [/* @__PURE__ */ S(x, { className: "mr-1.5 h-4 w-4" }), " Save draft"]
236
+ }), /* @__PURE__ */ C(w, {
260
237
  onClick: () => Z(!0),
261
238
  disabled: Q || X,
262
- children: [Q ? /* @__PURE__ */ x(v, { className: "mr-1.5 h-4 w-4 animate-spin" }) : /* @__PURE__ */ x(se, { className: "mr-1.5 h-4 w-4" }), "Submit application"]
239
+ children: [Q ? /* @__PURE__ */ S(b, { className: "mr-1.5 h-4 w-4 animate-spin" }) : /* @__PURE__ */ S(oe, { className: "mr-1.5 h-4 w-4" }), "Submit application"]
263
240
  })]
264
241
  })]
265
242
  })
266
243
  ]
267
- }) : /* @__PURE__ */ x(w, {
244
+ }) : /* @__PURE__ */ S(T, {
268
245
  treatment: "plain",
269
246
  className: "border-border-seam p-6",
270
- children: /* @__PURE__ */ S("div", {
247
+ children: /* @__PURE__ */ C("div", {
271
248
  className: "flex flex-col gap-4",
272
249
  children: [
273
- /* @__PURE__ */ S("div", {
250
+ /* @__PURE__ */ C("div", {
274
251
  className: "grid gap-4 sm:grid-cols-2",
275
- children: [/* @__PURE__ */ S("div", {
252
+ children: [/* @__PURE__ */ C("div", {
276
253
  className: "grid gap-1.5",
277
- children: [/* @__PURE__ */ x(E, {
254
+ children: [/* @__PURE__ */ S(E, {
278
255
  htmlFor: "app-ref",
279
256
  children: "Reference (optional)"
280
- }), /* @__PURE__ */ x(T, {
257
+ }), /* @__PURE__ */ S(le, {
281
258
  id: "app-ref",
282
- value: q,
283
- onChange: (e) => Se(e.target.value),
259
+ value: G,
260
+ onChange: (e) => we(e.target.value),
284
261
  placeholder: "Auto-generated if left blank"
285
262
  })]
286
- }), /* @__PURE__ */ S("div", {
263
+ }), /* @__PURE__ */ C("div", {
287
264
  className: "grid gap-1.5",
288
- children: [/* @__PURE__ */ x(E, { children: "Priority" }), /* @__PURE__ */ S(D, {
289
- value: J,
290
- onValueChange: (e) => Ce(e),
291
- children: [/* @__PURE__ */ x(A, {
265
+ children: [/* @__PURE__ */ S(E, { children: "Priority" }), /* @__PURE__ */ C(ue, {
266
+ value: K,
267
+ onValueChange: (e) => Te(e),
268
+ children: [/* @__PURE__ */ S(pe, {
292
269
  "aria-label": "Priority",
293
- children: /* @__PURE__ */ x(j, {})
294
- }), /* @__PURE__ */ x(O, { children: ue.map((e) => /* @__PURE__ */ x(k, {
270
+ children: /* @__PURE__ */ S(me, {})
271
+ }), /* @__PURE__ */ S(de, { children: ge.map((e) => /* @__PURE__ */ S(fe, {
295
272
  value: e,
296
273
  children: e.charAt(0) + e.slice(1).toLowerCase()
297
274
  }, e)) })]
298
275
  })]
299
276
  })]
300
277
  }),
301
- H.length > 0 ? /* @__PURE__ */ x("div", {
302
- className: "grid gap-4 sm:grid-cols-2",
303
- children: H.map((e) => /* @__PURE__ */ S("div", {
304
- className: t("grid gap-1.5", e.type === "textarea" || e.type === "file" ? "sm:col-span-2" : ""),
305
- children: [/* @__PURE__ */ S(E, {
306
- htmlFor: `f-${e.key}`,
307
- children: [e.label, e.required && /* @__PURE__ */ x("span", {
308
- className: "text-status-error-text",
309
- children: " *"
310
- })]
311
- }), e.type === "textarea" ? /* @__PURE__ */ x(M, {
312
- id: `f-${e.key}`,
313
- value: U[e.key] ?? "",
314
- onChange: (t) => Y(e.key, t.target.value),
315
- rows: 3
316
- }) : e.type === "select" ? /* @__PURE__ */ S(D, {
317
- value: U[e.key] ?? "",
318
- onValueChange: (t) => Y(e.key, t),
319
- children: [/* @__PURE__ */ x(A, {
320
- id: `f-${e.key}`,
321
- "aria-label": e.label,
322
- children: /* @__PURE__ */ x(j, { placeholder: "Select…" })
323
- }), /* @__PURE__ */ x(O, { children: (e.options ?? []).map((e) => /* @__PURE__ */ x(k, {
324
- value: e,
325
- children: e
326
- }, e)) })]
327
- }) : e.type === "file" ? /* @__PURE__ */ x(pe, {
328
- id: `f-${e.key}`,
329
- label: e.label,
330
- fileName: W[e.key],
331
- uploading: be === e.key,
332
- onSelect: (t) => we(e.key, t)
333
- }) : /* @__PURE__ */ x(T, {
334
- id: `f-${e.key}`,
335
- type: e.type === "number" ? "number" : e.type === "date" ? "date" : "text",
336
- value: U[e.key] ?? "",
337
- onChange: (t) => Y(e.key, t.target.value)
338
- })]
339
- }, e.key))
340
- }) : /* @__PURE__ */ S("div", {
278
+ B.length > 0 ? /* @__PURE__ */ S(p, {
279
+ fields: B,
280
+ values: V,
281
+ onChange: q,
282
+ fileNames: H,
283
+ uploadingKey: Se,
284
+ onFileSelect: J
285
+ }) : /* @__PURE__ */ C("div", {
341
286
  className: "grid gap-1.5",
342
- children: [/* @__PURE__ */ x(E, {
287
+ children: [/* @__PURE__ */ S(E, {
343
288
  htmlFor: "app-details",
344
289
  children: "Application details"
345
- }), /* @__PURE__ */ x(M, {
290
+ }), /* @__PURE__ */ S(he, {
346
291
  id: "app-details",
347
- value: K,
348
- onChange: (e) => xe(e.target.value),
292
+ value: W,
293
+ onChange: (e) => Ce(e.target.value),
349
294
  placeholder: "Describe your request and include any relevant information.",
350
295
  rows: 5
351
296
  })]
352
297
  }),
353
- z.requiredDocuments.length > 0 && /* @__PURE__ */ S("p", {
298
+ L.requiredDocuments.length > 0 && /* @__PURE__ */ C("p", {
354
299
  className: "rounded-lg bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
355
300
  children: [
356
301
  "You will be able to upload the required documents (",
357
- z.requiredDocuments.join(", "),
302
+ L.requiredDocuments.join(", "),
358
303
  ") from the application page after filing."
359
304
  ]
360
305
  }),
361
- X && /* @__PURE__ */ S("p", {
306
+ X && /* @__PURE__ */ C("p", {
362
307
  className: "text-xs text-text-muted",
363
308
  children: [
364
309
  "Fields marked ",
365
- /* @__PURE__ */ x("span", {
310
+ /* @__PURE__ */ S("span", {
366
311
  className: "text-status-error-text",
367
312
  children: "*"
368
313
  }),
369
314
  " are required to submit — you can still save a draft."
370
315
  ]
371
316
  }),
372
- /* @__PURE__ */ S("div", {
317
+ /* @__PURE__ */ C("div", {
373
318
  className: "mt-2 flex flex-col gap-2 sm:flex-row sm:justify-end",
374
- children: [/* @__PURE__ */ S(C, {
319
+ children: [/* @__PURE__ */ C(w, {
375
320
  variant: "outline",
376
321
  onClick: () => Z(!1),
377
322
  disabled: Q,
378
- children: [/* @__PURE__ */ x(y, { className: "mr-1.5 h-4 w-4" }), " Save draft"]
379
- }), /* @__PURE__ */ S(C, {
380
- onClick: () => I(!0),
323
+ children: [/* @__PURE__ */ S(x, { className: "mr-1.5 h-4 w-4" }), " Save draft"]
324
+ }), /* @__PURE__ */ C(w, {
325
+ onClick: () => P(!0),
381
326
  disabled: Q,
382
- children: ["Review & submit ", /* @__PURE__ */ x(h, { className: "ml-1.5 h-4 w-4" })]
327
+ children: ["Review & submit ", /* @__PURE__ */ S(_, { className: "ml-1.5 h-4 w-4" })]
383
328
  })]
384
329
  })
385
330
  ]
386
331
  })
387
332
  })]
388
333
  })]
389
- }) : /* @__PURE__ */ S(n, {
334
+ }) : /* @__PURE__ */ C(t, {
390
335
  title: "New application",
391
336
  back: {
392
337
  label: "Applications",
393
- onClick: () => m("applications")
338
+ onClick: () => v("applications")
394
339
  },
395
340
  description: "Choose the service you want to apply for.",
396
- children: [$, R.isLoading ? /* @__PURE__ */ x(l, { label: "Loading services…" }) : R.isError ? /* @__PURE__ */ x(c, {
341
+ children: [$, I.isLoading ? /* @__PURE__ */ S(l, { label: "Loading services…" }) : I.isError ? /* @__PURE__ */ S(c, {
397
342
  message: "We couldn't load services.",
398
- onRetry: () => R.refetch()
399
- }) : (R.data?.items.length ?? 0) === 0 ? /* @__PURE__ */ x(a, {
343
+ onRetry: () => I.refetch()
344
+ }) : (I.data?.items.length ?? 0) === 0 ? /* @__PURE__ */ S(i, {
400
345
  illustration: "empty-data",
401
346
  title: "No published services",
402
347
  description: "There are no services available to apply for yet. Publish a service first.",
403
- action: /* @__PURE__ */ x(C, {
404
- onClick: () => m("services"),
348
+ action: /* @__PURE__ */ S(w, {
349
+ onClick: () => v("services"),
405
350
  children: "Go to services"
406
351
  })
407
- }) : /* @__PURE__ */ x("div", {
352
+ }) : /* @__PURE__ */ S("div", {
408
353
  className: "grid gap-3 sm:grid-cols-2",
409
- children: R.data?.items.map((e) => /* @__PURE__ */ S("button", {
354
+ children: I.data?.items.map((e) => /* @__PURE__ */ C("button", {
410
355
  type: "button",
411
- onClick: () => me(e.id),
356
+ onClick: () => M(e.id),
412
357
  className: "group flex items-center gap-3 rounded-xl border border-border-seam bg-bg-surface p-4 text-left outline-none transition-colors hover:bg-bg-sunken focus-visible:ring-1 focus-visible:ring-border-focus",
413
358
  children: [
414
- /* @__PURE__ */ x("span", {
359
+ /* @__PURE__ */ S("span", {
415
360
  className: "inline-flex size-10 shrink-0 items-center justify-center rounded-xl bg-[var(--color-accent-soft)] text-action-primary-text",
416
- children: /* @__PURE__ */ x(_, { className: "size-5" })
361
+ children: /* @__PURE__ */ S(y, { className: "size-5" })
417
362
  }),
418
- /* @__PURE__ */ S("div", {
363
+ /* @__PURE__ */ C("div", {
419
364
  className: "min-w-0 flex-1",
420
365
  children: [
421
- /* @__PURE__ */ x("p", {
366
+ /* @__PURE__ */ S("p", {
422
367
  className: "truncate font-medium text-text-primary",
423
368
  children: e.name
424
369
  }),
425
- /* @__PURE__ */ x("p", {
370
+ /* @__PURE__ */ S("p", {
426
371
  className: "truncate text-xs text-text-muted",
427
372
  children: e.agency?.name ?? "Agency"
428
373
  }),
429
- /* @__PURE__ */ S("div", {
374
+ /* @__PURE__ */ C("div", {
430
375
  className: "mt-2 flex items-center gap-2",
431
- children: [/* @__PURE__ */ x(i, { status: e.category }), /* @__PURE__ */ x("span", {
376
+ children: [/* @__PURE__ */ S(r, { status: e.category }), /* @__PURE__ */ S("span", {
432
377
  className: "text-xs text-text-secondary",
433
- children: e.feeType === "FREE" ? "Free" : r(e.feeAmount, e.currency)
378
+ children: e.feeType === "FREE" ? "Free" : n(e.feeAmount, e.currency)
434
379
  })]
435
380
  })
436
381
  ]
437
382
  }),
438
- /* @__PURE__ */ x(h, { className: "h-4 w-4 shrink-0 text-text-muted transition-transform group-hover:translate-x-0.5" })
383
+ /* @__PURE__ */ S(_, { className: "h-4 w-4 shrink-0 text-text-muted transition-transform group-hover:translate-x-0.5" })
439
384
  ]
440
385
  }, e.id))
441
386
  })]
442
387
  });
443
388
  }
444
- function pe({ id: e, label: n, fileName: r, uploading: i, onSelect: a }) {
445
- return /* @__PURE__ */ S("label", {
446
- htmlFor: e,
447
- className: t("flex cursor-pointer items-center gap-3 rounded-xl border-2 border-dashed border-border-seam bg-bg-sunken/40 px-4 py-4 transition-colors hover:border-border-strong", i && "cursor-wait opacity-70"),
448
- children: [
449
- /* @__PURE__ */ x("span", {
450
- className: "inline-flex size-9 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)] text-action-primary-text",
451
- children: i ? /* @__PURE__ */ x(v, {
452
- className: "size-5 animate-spin",
453
- "aria-hidden": "true"
454
- }) : r ? /* @__PURE__ */ x(m, {
455
- className: "size-5 text-status-success-text",
456
- "aria-hidden": "true"
457
- }) : /* @__PURE__ */ x(b, {
458
- className: "size-5",
459
- "aria-hidden": "true"
460
- })
461
- }),
462
- /* @__PURE__ */ S("span", {
463
- className: "min-w-0 flex-1",
464
- children: [/* @__PURE__ */ x("span", {
465
- className: "block truncate text-sm font-medium text-text-primary",
466
- children: i ? "Uploading…" : r || "Click to upload or drag & drop"
467
- }), /* @__PURE__ */ x("span", {
468
- className: "mt-0.5 block text-xs text-text-muted",
469
- children: r ? "Uploaded · click to replace" : "PDF, JPG or PNG"
470
- })]
471
- }),
472
- /* @__PURE__ */ x("input", {
473
- id: e,
474
- type: "file",
475
- className: "sr-only",
476
- "aria-label": `Upload ${n}`,
477
- disabled: i,
478
- onChange: (e) => {
479
- a(e.target.files), e.target.value = "";
480
- }
481
- })
482
- ]
483
- });
484
- }
485
389
  //#endregion
486
- export { P as NewApplicationPage };
390
+ export { k as NewApplicationPage };
487
391
 
488
392
  //# sourceMappingURL=NewApplicationPage.js.map