@nivaro/react 0.3.52 → 0.3.53

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 (34) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +47 -3
  4. package/dist/shared/components/ItemEditForm.js +3851 -3821
  5. package/dist/shared/components/NotificationBell.js +163 -150
  6. package/dist/shared/components/PageRenderer.js +600 -549
  7. package/dist/shared/components/ProfileView.js +36 -34
  8. package/dist/shared/components/QueryStatStrip.js +96 -89
  9. package/dist/shared/components/QueryTable.js +214 -215
  10. package/dist/shared/components/ReportView.js +548 -529
  11. package/dist/shared/components/alerts/AlertManagerView.js +346 -320
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
  13. package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
  14. package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
  15. package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
  16. package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
  17. package/dist/shared/components/item-edit/PlanGrid.js +718 -705
  18. package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
  19. package/dist/shared/components/item-edit/line-qty.js +115 -53
  20. package/dist/shared/components/item-edit/save-refusal.js +18 -18
  21. package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
  22. package/dist/shared/components/panels/CommentPanel.js +204 -197
  23. package/dist/shared/components/panels/ItemLockBanner.js +318 -291
  24. package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
  25. package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
  26. package/dist/shared/components/panels/RevisionsPanel.js +101 -106
  27. package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
  28. package/dist/shared/components/panels/requirement-side-effects.js +46 -29
  29. package/dist/shared/components/queue/QueueItemSheet.js +219 -146
  30. package/dist/shared/components/queue/QueueWorklist.js +738 -730
  31. package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
  32. package/dist/shared/lib/activity-sentence.js +236 -227
  33. package/dist/shared/lib/record-ref.js +43 -34
  34. package/package.json +1 -1
@@ -1,27 +1,27 @@
1
- import { jsx as a, jsxs as m } from "react/jsx-runtime";
2
- import { useQuery as ee } from "@tanstack/react-query";
3
- import { ChevronRight as te, AlertCircle as re } from "lucide-react";
4
- import { useState as T, useMemo as V } from "react";
5
- import { useNivaroClient as le, useItemEditAuth as ae } from "../../context.js";
6
- import { post as z, patch as ne } from "../../lib/commands.js";
7
- import { formatDateTime as B, cn as K, formatDate as se } from "../../lib/utils.js";
8
- import { TooltipProvider as oe, Tooltip as ie, TooltipTrigger as de, TooltipContent as ue } from "../ui/tooltip.js";
9
- function L(t) {
10
- return t === !0 || t === 1 || t === "1" || t === "true";
1
+ import { jsx as n, jsxs as f } from "react/jsx-runtime";
2
+ import { useQuery as ne } from "@tanstack/react-query";
3
+ import { ChevronRight as ae, AlertCircle as se } from "lucide-react";
4
+ import { useState as T, useMemo as K } from "react";
5
+ import { useNivaroClient as oe, useItemEditAuth as ie } from "../../context.js";
6
+ import { post as W, patch as de } from "../../lib/commands.js";
7
+ import { formatDateTime as Y, cn as B, formatDate as ue } from "../../lib/utils.js";
8
+ import { TooltipProvider as ce, Tooltip as me, TooltipTrigger as pe, TooltipContent as be } from "../ui/tooltip.js";
9
+ function H(r) {
10
+ return r === !0 || r === 1 || r === "1" || r === "true";
11
11
  }
12
- function D(t, r) {
13
- if (t == null || t === "") return "—";
14
- if (r === "currency" || r === "number") {
15
- const i = Number(t);
16
- return Number.isNaN(i) ? String(t) : r === "currency" ? new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(i) : new Intl.NumberFormat().format(i);
12
+ function A(r, t) {
13
+ if (r == null || r === "") return "—";
14
+ if (t === "currency" || t === "number") {
15
+ const a = Number(r);
16
+ return Number.isNaN(a) ? String(r) : t === "currency" ? new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(a) : new Intl.NumberFormat().format(a);
17
17
  }
18
- if (r === "date" || r === "datetime") {
19
- const i = new Date(t);
20
- return Number.isNaN(i.getTime()) ? String(t) : r === "date" ? se(i) : B(i);
18
+ if (t === "date" || t === "datetime") {
19
+ const a = new Date(r);
20
+ return Number.isNaN(a.getTime()) ? String(r) : t === "date" ? ue(typeof r == "string" ? r : a) : Y(a);
21
21
  }
22
- return String(t);
22
+ return String(r);
23
23
  }
24
- const P = {
24
+ const I = {
25
25
  green: "#16a34a",
26
26
  red: "#dc2626",
27
27
  amber: "#d97706",
@@ -29,110 +29,127 @@ const P = {
29
29
  purple: "#9333ea",
30
30
  slate: "#64748b"
31
31
  };
32
- function ce(t) {
32
+ function fe(r) {
33
33
  return {
34
- backgroundColor: t ? `${t}22` : "#f1f5f9",
35
- color: t ?? "#475569",
36
- border: `1px solid ${t ? `${t}44` : "#e2e8f0"}`
34
+ backgroundColor: r ? `${r}22` : "#f1f5f9",
35
+ color: r ?? "#475569",
36
+ border: `1px solid ${r ? `${r}44` : "#e2e8f0"}`
37
37
  };
38
38
  }
39
- function E({ label: t, color: r }) {
40
- const i = r ? P[r] ?? null : null;
41
- return /* @__PURE__ */ a(
39
+ function M({ label: r, color: t }) {
40
+ const a = t ? I[t] ?? null : null;
41
+ return /* @__PURE__ */ n(
42
42
  "span",
43
43
  {
44
44
  className: "inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] font-medium",
45
- style: ce(i),
46
- children: t
45
+ style: fe(a),
46
+ children: r
47
47
  }
48
48
  );
49
49
  }
50
- function me(t, r) {
51
- if (t == null || t === "")
52
- return r.empty_label ? { label: r.empty_label, color: r.empty_color ?? "blue" } : { label: "—", color: null };
53
- const i = r.options.find((f) => f.value === String(t));
54
- return i ? { label: i.label, color: i.color } : { label: String(t), color: null };
50
+ function xe(r, t) {
51
+ if (r == null || r === "")
52
+ return t.empty_label ? { label: t.empty_label, color: t.empty_color ?? "blue" } : { label: "—", color: null };
53
+ const a = t.options.find((u) => u.value === String(r));
54
+ return a ? { label: a.status_label || a.label, color: a.color } : { label: String(r), color: null };
55
55
  }
56
- function pe(t, r) {
57
- const i = /* @__PURE__ */ new Map();
58
- for (const x of t.rows) {
59
- const s = String(x.group ?? ""), g = i.get(s);
60
- g ? g.push(x) : i.set(s, [x]);
56
+ function he(r, t) {
57
+ const a = /* @__PURE__ */ new Map();
58
+ for (const x of r.rows) {
59
+ const s = String(x.group ?? ""), h = a.get(s);
60
+ h ? h.push(x) : a.set(s, [x]);
61
61
  }
62
- const f = Array.from(i.entries()).map(([x, s]) => {
63
- const h = new Set(s.map((q) => String(q.status ?? ""))).size > 1, $ = h ? null : s[0].status;
64
- let N = null;
65
- return r && s.every((v) => r in v.values) && (N = s.reduce((v, A) => v + (Number(A.values[r]) || 0), 0)), { key: x, rows: s, count: s.length, sum: N, uniformStatus: $, mixedStatus: h };
62
+ const u = Array.from(a.entries()).map(([x, s]) => {
63
+ const y = new Set(s.map((F) => String(F.status ?? ""))).size > 1, D = y ? null : s[0].status;
64
+ let _ = null;
65
+ return t && s.every((S) => t in S.values) && (_ = s.reduce((S, O) => S + (Number(O.values[t]) || 0), 0)), { key: x, rows: s, count: s.length, sum: _, uniformStatus: D, mixedStatus: y };
66
66
  });
67
- return f.sort((x, s) => x.key.localeCompare(s.key, void 0, { numeric: !0 })), f;
67
+ return u.sort((x, s) => x.key.localeCompare(s.key, void 0, { numeric: !0 })), u;
68
68
  }
69
- function W(t, r, i) {
70
- let f = null;
71
- for (const x of t) {
72
- const s = x.values[r];
69
+ function Q(r, t, a) {
70
+ let u = null;
71
+ for (const x of r) {
72
+ const s = x.values[t];
73
73
  if (s == null || s === "") continue;
74
- const g = typeof s == "number" ? s : Date.parse(String(s)), h = Number.isNaN(g) ? Number(s) : g;
75
- Number.isFinite(h) && (f == null || (i ? h > f : h < f)) && (f = h);
74
+ const h = typeof s == "number" ? s : Date.parse(String(s)), y = Number.isNaN(h) ? Number(s) : h;
75
+ Number.isFinite(y) && (u == null || (a ? y > u : y < u)) && (u = y);
76
76
  }
77
- return f;
77
+ return u;
78
78
  }
79
- function Ne({
80
- data: t,
81
- config: r,
82
- loading: i,
83
- error: f,
79
+ function X(r, t) {
80
+ const a = r.rows[0], u = (x) => {
81
+ const s = t.find((y) => y.role === x);
82
+ if (!s || !a) return null;
83
+ const h = a.values[s.field];
84
+ return h == null || h === "" ? null : `${s.prefix ?? ""}${A(h, s.format)}`;
85
+ };
86
+ return { title: u("title") ?? (r.key || "—"), subtitle: u("subtitle") };
87
+ }
88
+ function J(r, t) {
89
+ const a = (t == null ? void 0 : t.trim()) || "row";
90
+ return `${r} ${a}${r === 1 ? "" : "s"}`;
91
+ }
92
+ function ye(r, t, a) {
93
+ const u = a != null && a.trim() ? `${a.trim()} ` : "";
94
+ return `${r.label} ${u}${t.title}${t.subtitle ? ` · ${t.subtitle}` : ""}?`;
95
+ }
96
+ function Ce({
97
+ data: r,
98
+ config: t,
99
+ loading: a,
100
+ error: u,
84
101
  onRefetch: x,
85
102
  hostRecordId: s,
86
- emptyLabel: g
103
+ emptyLabel: h
87
104
  }) {
88
- const h = le(), { userId: $ } = ae(), [N, q] = T(() => /* @__PURE__ */ new Set()), [v, A] = T(null), [G, H] = T({}), [b, _] = T(null), [F, M] = T(""), I = V(() => {
89
- const e = t ? pe(t, r.aggregate_sum) : [], o = r.group_sort;
105
+ const y = oe(), { userId: D } = ie(), [_, F] = T(() => /* @__PURE__ */ new Set()), [S, O] = T(null), [R, Z] = T({}), [m, $] = T(null), [E, L] = T(""), U = K(() => {
106
+ const e = r ? he(r, t.aggregate_sum) : [], o = t.group_sort;
90
107
  if (!(o != null && o.field)) return e;
91
108
  const p = o.direction === "desc";
92
109
  return [...e].sort((k, d) => {
93
- const c = W(k.rows, o.field, p), y = W(d.rows, o.field, p);
94
- return c == null && y == null ? 0 : c == null ? 1 : y == null ? -1 : p ? y - c : c - y;
110
+ const b = Q(k.rows, o.field, p), w = Q(d.rows, o.field, p);
111
+ return b == null && w == null ? 0 : b == null ? 1 : w == null ? -1 : p ? w - b : b - w;
95
112
  });
96
- }, [t, r.aggregate_sum, r.group_sort]), j = V(() => ((t == null ? void 0 : t.rows) ?? []).map((e) => String(e.id)), [t]), { data: S } = ee({
97
- queryKey: ["review-list-enrich", r.enrich_endpoint ?? "", j.join(",")],
98
- queryFn: () => h.request(
99
- z(r.enrich_endpoint, { ids: j })
113
+ }, [r, t.aggregate_sum, t.group_sort]), P = K(() => ((r == null ? void 0 : r.rows) ?? []).map((e) => String(e.id)), [r]), { data: C } = ne({
114
+ queryKey: ["review-list-enrich", t.enrich_endpoint ?? "", P.join(",")],
115
+ queryFn: () => y.request(
116
+ W(t.enrich_endpoint, { ids: P })
100
117
  ).then((e) => {
101
118
  var o;
102
119
  return ((o = e == null ? void 0 : e.data) == null ? void 0 : o.rows) ?? {};
103
120
  }).catch(() => ({})),
104
- enabled: !!r.enrich_endpoint && j.length > 0,
121
+ enabled: !!t.enrich_endpoint && P.length > 0,
105
122
  staleTime: 3e4
106
- }), O = (e) => S == null ? void 0 : S[String(e)], R = !!S && Object.values(S).some((e) => {
123
+ }), j = (e) => C == null ? void 0 : C[String(e)], V = !!C && Object.values(C).some((e) => {
107
124
  var o;
108
125
  return (((o = e.chips) == null ? void 0 : o.length) ?? 0) > 0;
109
- }), Q = I.length === 1;
110
- if (i)
111
- return /* @__PURE__ */ a("div", { className: "space-y-2", children: [0, 1].map((e) => /* @__PURE__ */ a(
126
+ }), ee = U.length === 1;
127
+ if (a)
128
+ return /* @__PURE__ */ n("div", { className: "space-y-2", children: [0, 1].map((e) => /* @__PURE__ */ n(
112
129
  "div",
113
130
  {
114
131
  className: "animate-pulse h-12 rounded-md bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]"
115
132
  },
116
133
  e
117
134
  )) });
118
- if (f)
119
- return /* @__PURE__ */ a("p", { className: "text-[12px] text-red-500", children: f });
120
- if (!t || t.rows.length === 0)
121
- return /* @__PURE__ */ a("p", { className: "text-[12px] italic text-slate-400", children: g ? `No ${g.toLowerCase()} yet` : "Nothing here yet" });
122
- const X = (e) => {
123
- q((o) => {
135
+ if (u)
136
+ return /* @__PURE__ */ n("p", { className: "text-[12px] text-red-500", children: u });
137
+ if (!r || r.rows.length === 0)
138
+ return /* @__PURE__ */ n("p", { className: "text-[12px] italic text-slate-400", children: h ? `No ${h.toLowerCase()} yet` : "Nothing here yet" });
139
+ const te = (e) => {
140
+ F((o) => {
124
141
  const p = new Set(o);
125
142
  return p.has(e) ? p.delete(e) : p.add(e), p;
126
143
  });
127
- }, J = (e, o) => {
128
- M(""), _({ group: e, option: o });
129
- }, Y = async (e, o, p) => {
130
- A(e.key);
144
+ }, re = (e, o) => {
145
+ L(""), $({ group: e, option: o });
146
+ }, le = async (e, o, p) => {
147
+ O(e.key);
131
148
  let k = null;
132
- if (r.status.action_endpoint)
149
+ if (t.status.action_endpoint)
133
150
  try {
134
- await h.request(
135
- z(r.status.action_endpoint, {
151
+ await y.request(
152
+ W(t.status.action_endpoint, {
136
153
  ids: e.rows.map((d) => d.id),
137
154
  status: o.value,
138
155
  // The status each row showed: the endpoint may refuse (409) rows
@@ -146,162 +163,173 @@ function Ne({
146
163
  })
147
164
  );
148
165
  } catch (d) {
149
- const c = d == null ? void 0 : d.response;
150
- k = (c == null ? void 0 : c.error) ?? "Failed to update";
166
+ const b = d == null ? void 0 : d.response;
167
+ k = (b == null ? void 0 : b.error) ?? "Failed to update";
151
168
  }
152
169
  else {
153
- const d = r.status.stamp_date_field ? (/* @__PURE__ */ new Date()).toISOString() : void 0, y = (await Promise.all(
154
- e.rows.map(async (w) => {
155
- const l = { [r.status.field]: o.value };
156
- r.status.stamp_user_field && $ && (l[r.status.stamp_user_field] = $), r.status.stamp_date_field && (l[r.status.stamp_date_field] = d), p && (l._change_reason = p);
170
+ const d = t.status.stamp_date_field ? (/* @__PURE__ */ new Date()).toISOString() : void 0, w = (await Promise.all(
171
+ e.rows.map(async (g) => {
172
+ const N = { [t.status.field]: o.value };
173
+ t.status.stamp_user_field && D && (N[t.status.stamp_user_field] = D), t.status.stamp_date_field && (N[t.status.stamp_date_field] = d), p && (N._change_reason = p);
157
174
  try {
158
- return await h.request(ne(`/items/${r.collection}/${w.id}`, l)), { ok: !0 };
159
- } catch (u) {
160
- const n = u == null ? void 0 : u.response;
161
- return { ok: !1, error: (n == null ? void 0 : n.error) ?? "Failed to update" };
175
+ return await y.request(de(`/items/${t.collection}/${g.id}`, N)), { ok: !0 };
176
+ } catch (v) {
177
+ const l = v == null ? void 0 : v.response;
178
+ return { ok: !1, error: (l == null ? void 0 : l.error) ?? "Failed to update" };
162
179
  }
163
180
  })
164
- )).filter((w) => !w.ok);
165
- y.length > 0 && (k = `${y.length} of ${e.rows.length} row(s) failed to update`);
181
+ )).filter((g) => !g.ok);
182
+ w.length > 0 && (k = `${w.length} of ${e.rows.length} row(s) failed to update`);
166
183
  }
167
- A(null), H((d) => {
168
- const c = { ...d };
169
- return k ? c[e.key] = k : delete c[e.key], c;
184
+ O(null), Z((d) => {
185
+ const b = { ...d };
186
+ return k ? b[e.key] = k : delete b[e.key], b;
170
187
  }), x();
171
- }, U = t.columns.line_columns, Z = t.columns.group_meta;
172
- return /* @__PURE__ */ a(oe, { delayDuration: 200, children: /* @__PURE__ */ m("div", { className: "space-y-2", children: [
173
- t.truncated && /* @__PURE__ */ a("p", { className: "text-[11px] text-amber-600 dark:text-amber-400", children: "Showing first 2000 rows — some rows may be missing." }),
174
- I.map((e) => {
175
- const o = Q ? !N.has(e.key) : N.has(e.key), p = e.rows.every((l) => {
176
- var u;
177
- return ((u = O(l.id)) == null ? void 0 : u.can_act) !== !1;
178
- }), k = e.mixedStatus ? { label: "Mixed", color: null } : me(e.uniformStatus, r.status), d = e.rows[0], c = d.stamp_user, y = d.stamp_date, w = e.rows.reduce((l, u) => {
179
- var n;
180
- for (const C of ((n = O(u.id)) == null ? void 0 : n.chips) ?? []) {
181
- if (C.tone === "danger") return "danger";
182
- C.tone === "warn" && l == null && (l = "warn");
188
+ }, z = r.columns.line_columns, G = r.columns.group_meta;
189
+ return /* @__PURE__ */ n(ce, { delayDuration: 200, children: /* @__PURE__ */ f("div", { className: "space-y-2", children: [
190
+ r.truncated && /* @__PURE__ */ n("p", { className: "text-[11px] text-amber-600 dark:text-amber-400", children: "Showing first 2000 rows — some rows may be missing." }),
191
+ U.map((e) => {
192
+ const o = ee ? !_.has(e.key) : _.has(e.key), p = e.rows.every((l) => {
193
+ var c;
194
+ return ((c = j(l.id)) == null ? void 0 : c.can_act) !== !1;
195
+ }), k = e.rows.map((l) => {
196
+ var c;
197
+ return (c = j(l.id)) == null ? void 0 : c.reason;
198
+ }).find((l) => !!l) ?? "Only the workflow contact chain (or the PO requestor for invalid holds) can decide this", d = X(e, G), b = e.mixedStatus ? { label: "Mixed", color: null } : xe(e.uniformStatus, t.status), w = e.rows[0], g = w.stamp_user, N = w.stamp_date, v = e.rows.reduce((l, c) => {
199
+ var i;
200
+ for (const q of ((i = j(c.id)) == null ? void 0 : i.chips) ?? []) {
201
+ if (q.tone === "danger") return "danger";
202
+ q.tone === "warn" && l == null && (l = "warn");
183
203
  }
184
204
  return l;
185
205
  }, null);
186
- return /* @__PURE__ */ m(
206
+ return /* @__PURE__ */ f(
187
207
  "div",
188
208
  {
189
209
  "data-review-group": e.key,
190
- "data-review-tone": w ?? void 0,
191
- className: K(
210
+ "data-review-tone": v ?? void 0,
211
+ className: B(
192
212
  "rounded-md border",
193
- w === "danger" ? "border-l-2 border-l-red-500 border-red-200 bg-red-50/40 dark:border-red-500/40 dark:bg-red-500/5" : w === "warn" ? "border-l-2 border-l-amber-500 border-amber-200 bg-amber-50/40 dark:border-amber-500/40 dark:bg-amber-500/5" : "border-slate-200 dark:border-border"
213
+ v === "danger" ? "border-l-2 border-l-red-500 border-red-200 bg-red-50/40 dark:border-red-500/40 dark:bg-red-500/5" : v === "warn" ? "border-l-2 border-l-amber-500 border-amber-200 bg-amber-50/40 dark:border-amber-500/40 dark:bg-amber-500/5" : "border-slate-200 dark:border-border"
194
214
  ),
195
215
  children: [
196
- /* @__PURE__ */ m("div", { className: "flex w-full flex-wrap items-center gap-2 px-3 py-2", children: [
197
- /* @__PURE__ */ m(
216
+ /* @__PURE__ */ f("div", { className: "flex w-full flex-wrap items-center gap-2 px-3 py-2", children: [
217
+ /* @__PURE__ */ f(
198
218
  "button",
199
219
  {
200
220
  type: "button",
201
- onClick: () => X(e.key),
221
+ onClick: () => te(e.key),
202
222
  className: "flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",
203
223
  children: [
204
- /* @__PURE__ */ a(
205
- te,
224
+ /* @__PURE__ */ n(
225
+ ae,
206
226
  {
207
227
  className: `h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform ${o ? "rotate-90" : ""}`
208
228
  }
209
229
  ),
210
- /* @__PURE__ */ a("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: e.key || "—" }),
211
- /* @__PURE__ */ m("span", { className: "text-[11px] text-slate-400", children: [
212
- e.count,
213
- " row",
214
- e.count === 1 ? "" : "s",
215
- e.sum != null ? ` · ${D(e.sum, r.aggregate_sum_format ?? "number")}` : ""
230
+ /* @__PURE__ */ n(
231
+ "span",
232
+ {
233
+ className: "text-[12px] font-medium text-slate-700 dark:text-slate-200",
234
+ "data-review-group-title": !0,
235
+ children: d.title
236
+ }
237
+ ),
238
+ d.subtitle && /* @__PURE__ */ n("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: d.subtitle }),
239
+ /* @__PURE__ */ f("span", { className: "text-[11px] text-slate-400", children: [
240
+ J(e.count, t.row_noun),
241
+ e.sum != null ? ` · ${A(e.sum, t.aggregate_sum_format ?? "number")}` : ""
216
242
  ] }),
217
- Z.map((l) => {
218
- const u = d.values[l.field];
219
- return l.format === "flag" ? L(u) ? /* @__PURE__ */ a(E, { label: l.label, color: l.color ?? "amber" }, l.field) : null : u == null || u === "" ? null : /* @__PURE__ */ m(
243
+ G.map((l) => {
244
+ if (l.role) return null;
245
+ const c = w.values[l.field];
246
+ return l.format === "flag" ? H(c) ? /* @__PURE__ */ n(M, { label: l.label, color: l.color ?? "amber" }, l.field) : null : c == null || c === "" ? null : /* @__PURE__ */ f(
220
247
  "span",
221
248
  {
222
249
  className: "rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-medium text-slate-500 dark:bg-slate-800 dark:text-slate-400",
223
250
  children: [
224
251
  l.label,
225
252
  ": ",
226
- D(u, l.format)
253
+ A(c, l.format)
227
254
  ]
228
255
  },
229
256
  l.field
230
257
  );
231
258
  }),
232
- /* @__PURE__ */ a(E, { label: k.label, color: k.color }),
233
- c && /* @__PURE__ */ m(ie, { children: [
234
- /* @__PURE__ */ a(de, { asChild: !0, children: /* @__PURE__ */ a("span", { className: "cursor-default text-[11px] text-slate-400 underline decoration-dotted", children: c.label }) }),
235
- /* @__PURE__ */ m(ue, { side: "top", className: "text-[12px]", children: [
236
- /* @__PURE__ */ a("p", { className: "font-medium", children: c.label }),
237
- y && /* @__PURE__ */ a("p", { className: "text-muted-foreground", children: B(y) })
259
+ /* @__PURE__ */ n(M, { label: b.label, color: b.color }),
260
+ g && /* @__PURE__ */ f(me, { children: [
261
+ /* @__PURE__ */ n(pe, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "cursor-default text-[11px] text-slate-400 underline decoration-dotted", children: g.label }) }),
262
+ /* @__PURE__ */ f(be, { side: "top", className: "text-[12px]", children: [
263
+ /* @__PURE__ */ n("p", { className: "font-medium", children: g.label }),
264
+ N && /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: Y(N) })
238
265
  ] })
239
266
  ] })
240
267
  ]
241
268
  }
242
269
  ),
243
- /* @__PURE__ */ m("span", { className: "flex flex-wrap items-center gap-1.5", children: [
244
- !p && /* @__PURE__ */ a(
270
+ /* @__PURE__ */ f("span", { className: "flex flex-wrap items-center gap-1.5", children: [
271
+ !p && /* @__PURE__ */ n(
245
272
  "span",
246
273
  {
247
274
  className: "text-[11px] text-slate-400",
248
- title: "Only the workflow contact chain (or the PO requestor for invalid holds) can decide this",
275
+ title: k,
276
+ "data-review-view-only": !0,
249
277
  children: "View only"
250
278
  }
251
279
  ),
252
- p && r.status.options.map((l) => {
253
- const u = !e.mixedStatus && String(e.uniformStatus) === l.value, n = P[l.color] ?? P.slate, C = v === e.key;
254
- return /* @__PURE__ */ a(
280
+ p && t.status.options.map((l) => {
281
+ const c = !e.mixedStatus && String(e.uniformStatus) === l.value, i = I[l.color] ?? I.slate, q = S === e.key;
282
+ return /* @__PURE__ */ n(
255
283
  "button",
256
284
  {
257
285
  type: "button",
258
- disabled: C || u,
259
- onClick: () => J(e, l),
286
+ disabled: q || c,
287
+ onClick: () => re(e, l),
260
288
  className: "rounded-md border px-2.5 py-1 text-[11px] font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",
261
289
  style: {
262
- backgroundColor: u ? `${n}22` : "transparent",
263
- borderColor: `${n}55`,
264
- color: n
290
+ backgroundColor: c ? `${i}22` : "transparent",
291
+ borderColor: `${i}55`,
292
+ color: i
265
293
  },
266
- children: C ? "…" : l.label
294
+ children: q ? "…" : l.label
267
295
  },
268
296
  l.value
269
297
  );
270
298
  })
271
299
  ] })
272
300
  ] }),
273
- G[e.key] && /* @__PURE__ */ m("p", { className: "flex items-center gap-1 px-3 pb-2 text-[11px] text-red-600", children: [
274
- /* @__PURE__ */ a(re, { className: "h-3 w-3 shrink-0" }),
275
- G[e.key]
301
+ R[e.key] && /* @__PURE__ */ f("p", { className: "flex items-center gap-1 px-3 pb-2 text-[11px] text-red-600", children: [
302
+ /* @__PURE__ */ n(se, { className: "h-3 w-3 shrink-0" }),
303
+ R[e.key]
276
304
  ] }),
277
- o && /* @__PURE__ */ a("div", { className: "overflow-x-auto border-t border-slate-100 dark:border-border/50", children: /* @__PURE__ */ m("table", { className: "w-full border-collapse text-[12px]", children: [
278
- /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ m("tr", { className: "border-b border-slate-200 bg-slate-50/60 text-left text-[11px] font-medium text-slate-400 dark:border-border dark:bg-white/[0.02]", children: [
279
- U.map((l) => /* @__PURE__ */ a("th", { className: "px-2.5 py-1.5 font-medium", children: l.label }, l.field)),
280
- R && /* @__PURE__ */ a("th", { className: "px-2.5 py-1.5 font-medium", children: "Match" })
305
+ o && /* @__PURE__ */ n("div", { className: "overflow-x-auto border-t border-slate-100 dark:border-border/50", children: /* @__PURE__ */ f("table", { className: "w-full border-collapse text-[12px]", children: [
306
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ f("tr", { className: "border-b border-slate-200 bg-slate-50/60 text-left text-[11px] font-medium text-slate-400 dark:border-border dark:bg-white/[0.02]", children: [
307
+ z.map((l) => /* @__PURE__ */ n("th", { className: "px-2.5 py-1.5 font-medium", children: l.label }, l.field)),
308
+ V && /* @__PURE__ */ n("th", { className: "px-2.5 py-1.5 font-medium", children: "Match" })
281
309
  ] }) }),
282
- /* @__PURE__ */ a("tbody", { children: e.rows.map((l) => {
283
- var u;
284
- return /* @__PURE__ */ m(
310
+ /* @__PURE__ */ n("tbody", { children: e.rows.map((l) => {
311
+ var c;
312
+ return /* @__PURE__ */ f(
285
313
  "tr",
286
314
  {
287
315
  className: "border-b border-slate-100 last:border-b-0 dark:border-border/50",
288
316
  children: [
289
- U.map((n) => /* @__PURE__ */ a(
317
+ z.map((i) => /* @__PURE__ */ n(
290
318
  "td",
291
319
  {
292
320
  className: "px-2.5 py-1.5 text-slate-600 dark:text-slate-300",
293
- children: n.format === "flag" ? L(l.values[n.field]) ? /* @__PURE__ */ a(E, { label: n.label, color: n.color ?? "amber" }) : "—" : D(l.values[n.field], n.format)
321
+ children: i.format === "flag" ? H(l.values[i.field]) ? /* @__PURE__ */ n(M, { label: i.label, color: i.color ?? "amber" }) : "—" : A(l.values[i.field], i.format)
294
322
  },
295
- n.field
323
+ i.field
296
324
  )),
297
- R && /* @__PURE__ */ a("td", { className: "px-2.5 py-1.5", children: /* @__PURE__ */ a("span", { className: "flex flex-wrap gap-1", children: (((u = O(l.id)) == null ? void 0 : u.chips) ?? []).map((n) => /* @__PURE__ */ a(
325
+ V && /* @__PURE__ */ n("td", { className: "px-2.5 py-1.5", children: /* @__PURE__ */ n("span", { className: "flex flex-wrap gap-1", children: (((c = j(l.id)) == null ? void 0 : c.chips) ?? []).map((i) => /* @__PURE__ */ n(
298
326
  "span",
299
327
  {
300
- title: n.title,
301
- className: n.tone === "ok" ? "rounded-full bg-emerald-50 px-2 py-0.5 text-[10.5px] font-medium text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400" : n.tone === "danger" ? "rounded-full bg-red-50 px-2 py-0.5 text-[10.5px] font-medium text-red-700 dark:bg-red-500/10 dark:text-red-400" : n.tone === "warn" ? "rounded-full bg-amber-50 px-2 py-0.5 text-[10.5px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-400" : "rounded-full bg-slate-100 px-2 py-0.5 text-[10.5px] font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300",
302
- children: n.label
328
+ title: i.title,
329
+ className: i.tone === "ok" ? "rounded-full bg-emerald-50 px-2 py-0.5 text-[10.5px] font-medium text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400" : i.tone === "danger" ? "rounded-full bg-red-50 px-2 py-0.5 text-[10.5px] font-medium text-red-700 dark:bg-red-500/10 dark:text-red-400" : i.tone === "warn" ? "rounded-full bg-amber-50 px-2 py-0.5 text-[10.5px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-400" : "rounded-full bg-slate-100 px-2 py-0.5 text-[10.5px] font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300",
330
+ children: i.label
303
331
  },
304
- n.label
332
+ i.label
305
333
  )) }) })
306
334
  ]
307
335
  },
@@ -314,83 +342,87 @@ function Ne({
314
342
  e.key
315
343
  );
316
344
  }),
317
- b && /* @__PURE__ */ a(
345
+ m && /* @__PURE__ */ n(
318
346
  "div",
319
347
  {
320
348
  className: "fixed inset-0 z-[130] flex items-center justify-center bg-black/40 p-4",
321
- onClick: () => _(null),
349
+ onClick: () => $(null),
322
350
  onKeyDown: (e) => {
323
- e.key === "Escape" && (e.stopPropagation(), _(null));
351
+ e.key === "Escape" && (e.stopPropagation(), $(null));
324
352
  },
325
- children: /* @__PURE__ */ m(
353
+ children: /* @__PURE__ */ f(
326
354
  "div",
327
355
  {
328
356
  role: "dialog",
329
357
  "aria-modal": "true",
330
358
  "aria-labelledby": "review-confirm-title",
331
- "data-review-confirm": b.option.value,
359
+ "data-review-confirm": m.option.value,
332
360
  className: "w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-xl dark:border-border dark:bg-card",
333
361
  onClick: (e) => e.stopPropagation(),
334
362
  children: [
335
- /* @__PURE__ */ m(
363
+ /* @__PURE__ */ n(
336
364
  "p",
337
365
  {
338
366
  id: "review-confirm-title",
339
367
  className: "text-[13px] font-medium text-slate-700 dark:text-slate-200",
340
- children: [
341
- b.option.label,
342
- " ",
343
- b.group.key || "these rows",
344
- "?"
345
- ]
368
+ children: ye(
369
+ m.option,
370
+ X(m.group, G),
371
+ t.group_noun
372
+ )
346
373
  }
347
374
  ),
348
- /* @__PURE__ */ m("p", { className: "mt-1 rounded-md border border-slate-200 bg-slate-50 px-2.5 py-1.5 text-[12px] tabular-nums text-slate-600 dark:border-border dark:bg-white/[0.03] dark:text-slate-300", children: [
349
- b.group.count,
350
- " row",
351
- b.group.count === 1 ? "" : "s",
352
- b.group.sum != null ? ` · ${D(b.group.sum, r.aggregate_sum_format ?? "number")}` : ""
375
+ /* @__PURE__ */ f("p", { className: "mt-1 rounded-md border border-slate-200 bg-slate-50 px-2.5 py-1.5 text-[12px] tabular-nums text-slate-600 dark:border-border dark:bg-white/[0.03] dark:text-slate-300", children: [
376
+ J(m.group.count, t.row_noun),
377
+ m.group.sum != null ? ` · ${A(m.group.sum, t.aggregate_sum_format ?? "number")}` : ""
353
378
  ] }),
354
- /* @__PURE__ */ a("p", { className: "mt-1.5 text-[11px] text-slate-500 dark:text-slate-400", children: b.option.require_note ? "A reason is required for this decision. It is recorded with the record." : "Nothing changes until you confirm. A note is optional and is recorded with the decision." }),
355
- /* @__PURE__ */ a(
379
+ /* @__PURE__ */ n(
380
+ "p",
381
+ {
382
+ className: "mt-1.5 text-[11px] text-slate-500 dark:text-slate-400",
383
+ "data-review-confirm-notice": !0,
384
+ children: m.option.confirm_notice ? `${m.option.confirm_notice}${m.option.require_note ? " A reason is required." : ""}` : m.option.require_note ? "A reason is required for this decision. It is recorded with the record." : "Nothing changes until you confirm. A note is optional and is recorded with the decision."
385
+ }
386
+ ),
387
+ /* @__PURE__ */ n(
356
388
  "textarea",
357
389
  {
358
- value: F,
359
- onChange: (e) => M(e.target.value),
390
+ value: E,
391
+ onChange: (e) => L(e.target.value),
360
392
  rows: 3,
361
393
  autoFocus: !0,
362
- "aria-label": b.option.require_note ? "Reason" : "Note (optional)",
394
+ "aria-label": m.option.require_note ? "Reason" : "Note (optional)",
363
395
  "data-review-confirm-note": !0,
364
396
  className: "mt-2 w-full rounded-md border border-slate-200 bg-white px-2.5 py-1.5 text-[12px] text-slate-700 outline-none focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-slate-200",
365
- placeholder: b.option.require_note ? "Why is this being rejected?" : "Note (optional)"
397
+ placeholder: m.option.require_note ? "Why is this being rejected?" : "Note (optional)"
366
398
  }
367
399
  ),
368
- /* @__PURE__ */ m("div", { className: "mt-3 flex items-center justify-end gap-1.5", children: [
369
- /* @__PURE__ */ a(
400
+ /* @__PURE__ */ f("div", { className: "mt-3 flex items-center justify-end gap-1.5", children: [
401
+ /* @__PURE__ */ n(
370
402
  "button",
371
403
  {
372
404
  type: "button",
373
405
  "data-review-confirm-cancel": !0,
374
- onClick: () => _(null),
406
+ onClick: () => $(null),
375
407
  className: "rounded px-2.5 py-1 text-[11px] text-slate-500 hover:bg-slate-100 dark:hover:bg-muted",
376
408
  children: "Cancel"
377
409
  }
378
410
  ),
379
- /* @__PURE__ */ a(
411
+ /* @__PURE__ */ n(
380
412
  "button",
381
413
  {
382
414
  type: "button",
383
415
  "data-review-confirm-submit": !0,
384
- disabled: !!b.option.require_note && !F.trim(),
416
+ disabled: !!m.option.require_note && !E.trim(),
385
417
  onClick: () => {
386
- const e = b;
387
- _(null), Y(e.group, e.option, F.trim() || null);
418
+ const e = m;
419
+ $(null), le(e.group, e.option, E.trim() || null);
388
420
  },
389
- className: K(
421
+ className: B(
390
422
  "rounded px-3 py-1 text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
391
- b.option.require_note ? "bg-red-600 text-white" : "bg-nvr-cyan text-white"
423
+ m.option.require_note ? "bg-red-600 text-white" : "bg-nvr-cyan text-white"
392
424
  ),
393
- children: b.option.label
425
+ children: m.option.label
394
426
  }
395
427
  )
396
428
  ] })
@@ -402,7 +434,10 @@ function Ne({
402
434
  ] }) });
403
435
  }
404
436
  export {
405
- Ne as ReviewListWidget,
406
- P as STATUS_COLOR_HEX,
407
- D as formatValue
437
+ Ce as ReviewListWidget,
438
+ I as STATUS_COLOR_HEX,
439
+ ye as confirmTitle,
440
+ J as countLabel,
441
+ A as formatValue,
442
+ X as groupName
408
443
  };