@nivaro/react 0.3.49 → 0.3.51

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 (46) hide show
  1. package/dist/components/InlineGridField.js +166 -105
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +38 -4
  5. package/dist/shared/components/ItemEditForm.js +5258 -5034
  6. package/dist/shared/components/QueryTable.js +489 -347
  7. package/dist/shared/components/ReportView.js +105 -99
  8. package/dist/shared/components/alerts/AlertManagerView.js +327 -301
  9. package/dist/shared/components/item-edit/CatalogPickerField.js +1230 -1175
  10. package/dist/shared/components/item-edit/CloneDialog.js +192 -142
  11. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
  12. package/dist/shared/components/item-edit/FieldRenderer.js +249 -244
  13. package/dist/shared/components/item-edit/FieldRow.js +402 -370
  14. package/dist/shared/components/item-edit/FilePickerField.js +315 -307
  15. package/dist/shared/components/item-edit/InlineGridField.js +92 -90
  16. package/dist/shared/components/item-edit/InlineTableField.js +3119 -2951
  17. package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
  18. package/dist/shared/components/item-edit/PlanGrid.js +162 -162
  19. package/dist/shared/components/item-edit/PolishFields.js +169 -162
  20. package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
  21. package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
  22. package/dist/shared/components/item-edit/RelationCombobox.js +198 -191
  23. package/dist/shared/components/item-edit/SummaryPanel.js +282 -259
  24. package/dist/shared/components/item-edit/UserChip.js +233 -200
  25. package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
  26. package/dist/shared/components/item-edit/header-midair.js +51 -0
  27. package/dist/shared/components/item-edit/helpers.js +181 -155
  28. package/dist/shared/components/item-edit/line-midair.js +207 -0
  29. package/dist/shared/components/item-edit/soft-rules.js +27 -0
  30. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  31. package/dist/shared/components/panels/CommentPanel.js +290 -284
  32. package/dist/shared/components/panels/ItemLockBanner.js +414 -358
  33. package/dist/shared/components/panels/PipelinePanel.js +1241 -992
  34. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  35. package/dist/shared/components/panels/TaskPanel.js +71 -61
  36. package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
  37. package/dist/shared/components/panels/requirement-side-effects.js +40 -0
  38. package/dist/shared/components/queue/QueueWorklist.js +925 -871
  39. package/dist/shared/components/queue/column-chooser.js +21 -0
  40. package/dist/shared/components/queue/live-state-aspect.js +6 -0
  41. package/dist/shared/components/ui/number-draft-input.js +93 -0
  42. package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
  43. package/dist/shared/lib/draft-store.js +48 -34
  44. package/dist/shared/lib/error-hints.js +1 -0
  45. package/dist/shared/lib/query-stats.js +60 -60
  46. package/package.json +1 -1
@@ -0,0 +1,175 @@
1
+ import { jsx as r, jsxs as d } from "react/jsx-runtime";
2
+ import { useState as g } from "react";
3
+ import { createPortal as v } from "react-dom";
4
+ import { htmlToText as w } from "../../lib/sanitize-html.js";
5
+ import { titleCase as N } from "../../lib/utils.js";
6
+ import { lineConflictKey as b } from "./line-midair.js";
7
+ function C({
8
+ collision: a,
9
+ fieldLabel: i,
10
+ onCancel: c,
11
+ onResolve: m,
12
+ title: u = "Someone else changed this record",
13
+ intro: f = "These fields were saved by someone else while you were editing. Pick which value wins for each — everything else you changed saves normally.",
14
+ cancelLabel: p = "Cancel save"
15
+ }) {
16
+ const [t, o] = g(
17
+ () => new Set(a.conflicts.map((e) => e.field))
18
+ ), [n, y] = g(null), x = (e) => {
19
+ if (e == null || e === "") return "—";
20
+ if (typeof e == "object") return JSON.stringify(e).slice(0, 120);
21
+ const l = String(e), s = /<[a-z][^>]*>/i.test(l) ? w(l) : l;
22
+ return s.trim() ? s.slice(0, 200) : "—";
23
+ }, k = /* @__PURE__ */ r(
24
+ "span",
25
+ {
26
+ hidden: !0,
27
+ ref: (e) => {
28
+ e && !n && y(e.closest('[role="dialog"]') ?? document.body);
29
+ }
30
+ }
31
+ );
32
+ return n ? v(
33
+ /* @__PURE__ */ d(
34
+ "div",
35
+ {
36
+ role: "dialog",
37
+ "aria-modal": "true",
38
+ "aria-labelledby": "nvr-midair-title",
39
+ className: "pointer-events-auto fixed inset-0 z-[130] flex items-center justify-center",
40
+ onKeyDown: (e) => {
41
+ e.key === "Escape" && (e.stopPropagation(), c());
42
+ },
43
+ children: [
44
+ /* @__PURE__ */ r(
45
+ "button",
46
+ {
47
+ type: "button",
48
+ "aria-label": "Close",
49
+ tabIndex: -1,
50
+ className: "absolute inset-0 cursor-default bg-black/40",
51
+ onClick: c
52
+ }
53
+ ),
54
+ /* @__PURE__ */ d("div", { className: "relative w-[560px] max-w-[94vw] rounded-lg border border-slate-200 bg-white p-5 shadow-xl dark:border-border dark:bg-card", children: [
55
+ /* @__PURE__ */ r(
56
+ "p",
57
+ {
58
+ id: "nvr-midair-title",
59
+ className: "text-[14px] font-semibold text-slate-900 dark:text-foreground",
60
+ children: u
61
+ }
62
+ ),
63
+ /* @__PURE__ */ r("p", { className: "mt-1 text-[12.5px] text-slate-500 dark:text-muted-foreground", children: f }),
64
+ /* @__PURE__ */ r("div", { className: "mt-3 max-h-[320px] space-y-2 overflow-y-auto", children: a.conflicts.map((e) => {
65
+ const l = t.has(e.field);
66
+ return /* @__PURE__ */ d(
67
+ "div",
68
+ {
69
+ className: "rounded-md border border-slate-200 p-2.5 dark:border-border",
70
+ children: [
71
+ /* @__PURE__ */ r("p", { className: "text-[12.5px] font-medium text-slate-800 dark:text-foreground", children: i(e.field) }),
72
+ /* @__PURE__ */ d("div", { className: "mt-1.5 grid grid-cols-2 gap-2", children: [
73
+ /* @__PURE__ */ d(
74
+ "button",
75
+ {
76
+ type: "button",
77
+ onClick: () => o((s) => /* @__PURE__ */ new Set([...s, e.field])),
78
+ className: l ? "rounded-md border-2 border-nvr-cyan/60 bg-nvr-cyan/5 px-2.5 py-1.5 text-left" : "rounded-md border border-slate-200 px-2.5 py-1.5 text-left hover:border-slate-300 dark:border-border",
79
+ children: [
80
+ /* @__PURE__ */ r("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Theirs (current)" }),
81
+ /* @__PURE__ */ r("p", { className: "mt-0.5 break-words text-[12px] text-slate-700 dark:text-foreground", children: x(e.current_value) })
82
+ ]
83
+ }
84
+ ),
85
+ /* @__PURE__ */ d(
86
+ "button",
87
+ {
88
+ type: "button",
89
+ onClick: () => o((s) => {
90
+ const h = new Set(s);
91
+ return h.delete(e.field), h;
92
+ }),
93
+ className: l ? "rounded-md border border-slate-200 px-2.5 py-1.5 text-left hover:border-slate-300 dark:border-border" : "rounded-md border-2 border-amber-400/70 bg-amber-50 px-2.5 py-1.5 text-left dark:bg-amber-400/10",
94
+ children: [
95
+ /* @__PURE__ */ r("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Mine (overwrite)" }),
96
+ /* @__PURE__ */ r("p", { className: "mt-0.5 break-words text-[12px] text-slate-700 dark:text-foreground", children: x(a.mine[e.field]) })
97
+ ]
98
+ }
99
+ )
100
+ ] })
101
+ ]
102
+ },
103
+ e.field
104
+ );
105
+ }) }),
106
+ /* @__PURE__ */ d("div", { className: "mt-4 flex items-center justify-end gap-2", children: [
107
+ /* @__PURE__ */ r(
108
+ "button",
109
+ {
110
+ type: "button",
111
+ onClick: c,
112
+ className: "h-8 rounded-md border border-slate-200 px-3 text-[12.5px] text-slate-600 dark:border-border dark:text-muted-foreground",
113
+ children: p
114
+ }
115
+ ),
116
+ /* @__PURE__ */ r(
117
+ "button",
118
+ {
119
+ type: "button",
120
+ onClick: () => m(t),
121
+ className: "h-8 rounded-md bg-nvr-cyan px-4 text-[12.5px] font-medium text-white",
122
+ children: "Apply & save"
123
+ }
124
+ )
125
+ ] })
126
+ ] })
127
+ ]
128
+ }
129
+ ),
130
+ n
131
+ ) : k;
132
+ }
133
+ function _({
134
+ lines: a,
135
+ fieldLabel: i,
136
+ onCancel: c,
137
+ onResolve: m,
138
+ intro: u = "These line values were saved by someone else after you changed them. Pick which value wins for each — the rest of your changes are saved.",
139
+ cancelLabel: f = "Decide later"
140
+ }) {
141
+ const p = (t) => (i == null ? void 0 : i(t)) || N(t.replace(/_/g, " "));
142
+ return /* @__PURE__ */ r(
143
+ C,
144
+ {
145
+ title: a.length === 1 ? `Someone else changed ${a[0].label}` : `Someone else changed ${a.length} lines`,
146
+ intro: u,
147
+ cancelLabel: f,
148
+ collision: {
149
+ conflicts: a.flatMap(
150
+ (t) => t.conflicts.map((o) => ({
151
+ field: b(t, o.field),
152
+ current_value: o.current_value
153
+ }))
154
+ ),
155
+ mine: Object.fromEntries(
156
+ a.flatMap(
157
+ (t) => t.conflicts.map((o) => [b(t, o.field), t.mine[o.field]])
158
+ )
159
+ )
160
+ },
161
+ fieldLabel: (t) => {
162
+ for (const o of a)
163
+ for (const n of o.conflicts)
164
+ if (b(o, n.field) === t) return `${o.label} · ${p(n.field)}`;
165
+ return t;
166
+ },
167
+ onCancel: c,
168
+ onResolve: m
169
+ }
170
+ );
171
+ }
172
+ export {
173
+ _ as LineCollisionDialog,
174
+ C as MidairCollisionDialog
175
+ };