@nivaro/react 0.3.63 → 0.3.65

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