@nivaro/react 0.3.57 → 0.3.58

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