@nivaro/react 0.3.48 → 0.3.50

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 (52) 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 +25 -1
  5. package/dist/shared/components/CellCopyLayer.js +81 -44
  6. package/dist/shared/components/CollectionBrowserView.js +306 -297
  7. package/dist/shared/components/DataTable.js +3 -3
  8. package/dist/shared/components/FulfilmentPill.js +98 -78
  9. package/dist/shared/components/ItemEditForm.js +4682 -4570
  10. package/dist/shared/components/NotificationSourcesCard.js +151 -147
  11. package/dist/shared/components/ProfileView.js +72 -70
  12. package/dist/shared/components/QueryTable.js +462 -333
  13. package/dist/shared/components/imports/ImportConsole.js +4 -4
  14. package/dist/shared/components/integrations/console/IntegrationsConsole.js +58 -50
  15. package/dist/shared/components/item-edit/CatalogPickerField.js +1144 -1127
  16. package/dist/shared/components/item-edit/CloneDialog.js +192 -142
  17. package/dist/shared/components/item-edit/FieldRenderer.js +127 -126
  18. package/dist/shared/components/item-edit/FieldRow.js +236 -226
  19. package/dist/shared/components/item-edit/HeaderTools.js +118 -113
  20. package/dist/shared/components/item-edit/InlineGridField.js +92 -90
  21. package/dist/shared/components/item-edit/InlineTableField.js +3091 -2942
  22. package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
  23. package/dist/shared/components/item-edit/PlanGrid.js +162 -162
  24. package/dist/shared/components/item-edit/PolishFields.js +169 -162
  25. package/dist/shared/components/item-edit/RelationCombobox.js +186 -181
  26. package/dist/shared/components/item-edit/SummaryPanel.js +148 -135
  27. package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
  28. package/dist/shared/components/item-edit/helpers.js +181 -155
  29. package/dist/shared/components/item-edit/line-midair.js +201 -0
  30. package/dist/shared/components/item-edit/soft-rules.js +27 -0
  31. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  32. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +65 -65
  33. package/dist/shared/components/layout-editor/settings/settings-registry.js +4 -4
  34. package/dist/shared/components/notifications/DeliveryChips.js +9 -9
  35. package/dist/shared/components/panels/ItemLockBanner.js +414 -358
  36. package/dist/shared/components/panels/PipelinePanel.js +1171 -975
  37. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  38. package/dist/shared/components/panels/SlaBreachBanner.js +2 -2
  39. package/dist/shared/components/panels/TransitionRequirementsDialog.js +384 -380
  40. package/dist/shared/components/profile/PersonProfile.js +23 -21
  41. package/dist/shared/components/profile/SignedInDevices.js +126 -0
  42. package/dist/shared/components/queue/QueueItemSheet.js +38 -37
  43. package/dist/shared/components/queue/QueueWorklist.js +870 -827
  44. package/dist/shared/components/queue/column-chooser.js +21 -0
  45. package/dist/shared/components/queue/live-state-aspect.js +6 -0
  46. package/dist/shared/components/support/SupportView.js +1 -1
  47. package/dist/shared/components/ui/number-draft-input.js +93 -0
  48. package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
  49. package/dist/shared/lib/edit-lock-fields.js +7 -0
  50. package/dist/shared/lib/error-hints.js +1 -0
  51. package/dist/shared/lib/reimport-visibility.js +10 -0
  52. package/package.json +1 -1
@@ -1,209 +1,259 @@
1
- import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import { Copy as O, RotateCcw as T } from "lucide-react";
3
- import { useState as b } from "react";
4
- import { toast as v } from "sonner";
5
- import { useNivaroClient as $ } from "../../context.js";
6
- import { post as q } from "../../lib/commands.js";
7
- import { titleCase as E, cn as R } from "../../lib/utils.js";
1
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
+ import { Copy as O, RotateCcw as $ } from "lucide-react";
3
+ import { useState as N } from "react";
4
+ import { toast as b } from "sonner";
5
+ import { useNivaroClient as q } from "../../context.js";
6
+ import { post as E } from "../../lib/commands.js";
7
+ import { titleCase as H, cn as R } from "../../lib/utils.js";
8
8
  import { Button as w } from "../ui/button.js";
9
- import { Dialog as H, DialogTrigger as K, DialogContent as P, DialogHeader as Y, DialogTitle as A, DialogFooter as G } from "../ui/dialog.js";
10
- import { Input as m } from "../ui/input.js";
9
+ import { Dialog as K, DialogTrigger as P, DialogContent as Y, DialogHeader as A, DialogTitle as G, DialogFooter as Q } from "../ui/dialog.js";
10
+ import { Input as v } from "../ui/input.js";
11
11
  import { Label as z } from "../ui/label.js";
12
- import { Switch as B } from "../ui/switch.js";
13
- const Q = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "created_by", "updated_by"]);
14
- function U(l, n, s) {
15
- if (Q.has(l.field) || l.computed_formula) return !1;
16
- const i = l.interface ?? "";
17
- return !(["sub_rows", "repeater", "rich_text", "file", "image", "o2m", "m2m", "m2a"].includes(i) || ["sub_rows", "repeater", "rich_text"].includes(l.type) || n.some((p) => p.one_collection === s && p.one_field === l.field));
12
+ import { NumberDraftInput as L } from "../ui/number-draft-input.js";
13
+ import { Switch as j } from "../ui/switch.js";
14
+ const U = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "created_by", "updated_by"]);
15
+ function V(n, l, r) {
16
+ if (U.has(n.field) || n.computed_formula) return !1;
17
+ const s = n.interface ?? "";
18
+ return !(["sub_rows", "repeater", "rich_text", "file", "image", "o2m", "m2m", "m2a"].includes(s) || ["sub_rows", "repeater", "rich_text"].includes(n.type) || l.some((f) => f.one_collection === r && f.one_field === n.field));
18
19
  }
19
- function W(l) {
20
- return l.interface === "sub_rows" || l.type === "sub_rows";
20
+ function W(n) {
21
+ return n.interface === "sub_rows" || n.type === "sub_rows";
21
22
  }
22
- function X(l) {
23
- if (!l) return "";
23
+ function X(n) {
24
+ if (!n) return "";
24
25
  try {
25
- return new Date(String(l)).toISOString().slice(0, 16);
26
+ return new Date(String(n)).toISOString().slice(0, 16);
26
27
  } catch {
27
28
  return "";
28
29
  }
29
30
  }
30
- function Z({ field: l, value: n, onChange: s }) {
31
- return l.type === "boolean" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
31
+ function Z({
32
+ field: n,
33
+ value: l,
34
+ onChange: r
35
+ }) {
36
+ return n.type === "boolean" ? /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
32
37
  /* @__PURE__ */ t(
33
38
  "input",
34
39
  {
35
40
  type: "checkbox",
36
- checked: !!n,
37
- onChange: (i) => s(i.target.checked),
41
+ checked: !!l,
42
+ onChange: (s) => r(s.target.checked),
38
43
  className: "h-4 w-4 accent-nvr-cyan rounded"
39
44
  }
40
45
  ),
41
- /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: n ? "Yes" : "No" })
42
- ] }) : l.type === "datetime" || l.interface === "datetime" ? /* @__PURE__ */ t(
43
- m,
46
+ /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: l ? "Yes" : "No" })
47
+ ] }) : n.type === "datetime" || n.interface === "datetime" ? /* @__PURE__ */ t(
48
+ v,
44
49
  {
45
50
  type: "datetime-local",
46
- value: X(n),
47
- onChange: (i) => s(i.target.value ? new Date(i.target.value).toISOString() : null),
51
+ value: X(l),
52
+ onChange: (s) => r(s.target.value ? new Date(s.target.value).toISOString() : null),
48
53
  className: "h-7 text-[12px]"
49
54
  }
50
- ) : l.type === "date" ? /* @__PURE__ */ t(
51
- m,
55
+ ) : n.type === "date" ? /* @__PURE__ */ t(
56
+ v,
52
57
  {
53
58
  type: "date",
54
- value: n ? String(n).slice(0, 10) : "",
55
- onChange: (i) => s(i.target.value || null),
59
+ value: l ? String(l).slice(0, 10) : "",
60
+ onChange: (s) => r(s.target.value || null),
56
61
  className: "h-7 text-[12px]"
57
62
  }
58
- ) : l.type === "integer" || l.type === "bigInteger" ? /* @__PURE__ */ t(
59
- m,
63
+ ) : n.type === "integer" || n.type === "bigInteger" ? /* @__PURE__ */ t(
64
+ L,
60
65
  {
61
66
  type: "number",
62
67
  step: "1",
63
- value: n == null ? "" : String(n),
64
- onChange: (i) => s(i.target.value === "" ? null : Number(i.target.value)),
68
+ value: l,
69
+ onValue: r,
65
70
  className: "h-7 text-[12px]"
66
71
  }
67
- ) : l.type === "float" || l.type === "decimal" || l.type === "double" ? /* @__PURE__ */ t(
68
- m,
72
+ ) : n.type === "float" || n.type === "decimal" || n.type === "double" ? /* @__PURE__ */ t(
73
+ L,
69
74
  {
70
75
  type: "number",
71
76
  step: "any",
72
- value: n == null ? "" : String(n),
73
- onChange: (i) => s(i.target.value === "" ? null : Number(i.target.value)),
77
+ value: l,
78
+ onValue: r,
74
79
  className: "h-7 text-[12px]"
75
80
  }
76
81
  ) : /* @__PURE__ */ t(
77
- m,
82
+ v,
78
83
  {
79
- value: n == null ? "" : String(n),
80
- onChange: (i) => s(i.target.value || null),
84
+ value: l == null ? "" : String(l),
85
+ onChange: (s) => r(s.target.value || null),
81
86
  className: "h-7 text-[12px]",
82
87
  placeholder: "(empty)"
83
88
  }
84
89
  );
85
90
  }
86
- function ue({ collection: l, itemId: n, fields: s, relations: i, currentValues: f, onSuccess: p }) {
87
- const L = $(), [j, h] = b(!1), [C, S] = b(!1), [k, g] = b({}), [_, I] = b({}), x = s.filter((e) => U(e, i, l)), y = s.filter(W);
88
- function J() {
91
+ function fe({
92
+ collection: n,
93
+ itemId: l,
94
+ fields: r,
95
+ relations: s,
96
+ currentValues: m,
97
+ onSuccess: f
98
+ }) {
99
+ const B = q(), [J, p] = N(!1), [C, k] = N(!1), [S, h] = N({}), [_, I] = N({}), x = r.filter((e) => V(e, s, n)), g = r.filter(W);
100
+ function M() {
89
101
  const e = {};
90
102
  for (const o of x)
91
- e[o.field] = { include: !0, value: f[o.field] ?? null };
92
- g(e);
93
- const a = {};
94
- for (const o of y) a[o.field] = !0;
95
- I(a), h(!0);
103
+ e[o.field] = { include: !0, value: m[o.field] ?? null };
104
+ h(e);
105
+ const i = {};
106
+ for (const o of g) i[o.field] = !0;
107
+ I(i), p(!0);
96
108
  }
97
- function D(e, a) {
98
- return JSON.stringify(a.value) !== JSON.stringify(f[e] ?? null);
109
+ function D(e, i) {
110
+ return JSON.stringify(i.value) !== JSON.stringify(m[e] ?? null);
99
111
  }
100
- async function M() {
112
+ async function T() {
101
113
  var e;
102
- S(!0);
114
+ k(!0);
103
115
  try {
104
- const a = {}, o = [];
116
+ const i = {}, o = [];
105
117
  for (const d of x) {
106
- const N = k[d.field];
107
- if (N) {
108
- if (!N.include) {
118
+ const y = S[d.field];
119
+ if (y) {
120
+ if (!y.include) {
109
121
  o.push(d.field);
110
122
  continue;
111
123
  }
112
- D(d.field, N) && (a[d.field] = N.value);
124
+ D(d.field, y) && (i[d.field] = y.value);
113
125
  }
114
126
  }
115
- const c = y.filter((d) => _[d.field]).map((d) => d.field), u = await L.request(
116
- q(`/items/${l}/${n}/clone`, { field_overrides: a, exclude_fields: o, include_sub_rows: c })
127
+ const c = g.filter((d) => _[d.field]).map((d) => d.field), u = await B.request(
128
+ E(`/items/${n}/${l}/clone`, {
129
+ field_overrides: i,
130
+ exclude_fields: o,
131
+ include_sub_rows: c
132
+ })
117
133
  );
118
- h(!1);
134
+ p(!1);
119
135
  const F = (e = u == null ? void 0 : u.data) == null ? void 0 : e.id;
120
136
  if (F == null) {
121
- v.success("Item cloned — open it from the list");
137
+ b.success("Item cloned — open it from the list");
122
138
  return;
123
139
  }
124
- v.success("Item cloned"), p(F);
140
+ b.success("Item cloned"), f(F);
125
141
  } catch {
126
- v.error("Failed to clone item");
142
+ b.error("Failed to clone item");
127
143
  } finally {
128
- S(!1);
144
+ k(!1);
129
145
  }
130
146
  }
131
- return /* @__PURE__ */ r(H, { open: j, onOpenChange: (e) => {
132
- e ? J() : h(!1);
133
- }, children: [
134
- /* @__PURE__ */ t(K, { asChild: !0, children: /* @__PURE__ */ r(w, { size: "sm", variant: "outline", className: "gap-1.5", children: [
135
- /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" }),
136
- "Clone"
137
- ] }) }),
138
- /* @__PURE__ */ r(P, { className: "flex max-h-[85vh] max-w-lg flex-col overflow-hidden", children: [
139
- /* @__PURE__ */ t(Y, { className: "shrink-0 px-6 pt-6", children: /* @__PURE__ */ t(A, { className: "text-[15px]", children: "Clone item" }) }),
140
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children: /* @__PURE__ */ r("div", { className: "space-y-4", children: [
141
- x.length > 0 && /* @__PURE__ */ r("div", { children: [
142
- /* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Field values" }),
143
- /* @__PURE__ */ t("div", { className: "space-y-2", children: x.map((e) => {
144
- const a = k[e.field];
145
- if (!a) return null;
146
- const o = D(e.field, a);
147
- return /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
148
- /* @__PURE__ */ t(
149
- B,
150
- {
151
- checked: a.include,
152
- onCheckedChange: () => g((c) => ({ ...c, [e.field]: { ...c[e.field], include: !c[e.field].include } })),
153
- className: "mt-1 shrink-0 scale-75"
154
- }
155
- ),
156
- /* @__PURE__ */ t(z, { className: R("mt-1.5 w-32 shrink-0 truncate text-[12px]", !a.include && "text-slate-400 line-through"), children: E(e.field) }),
157
- /* @__PURE__ */ t("div", { className: R("flex-1", !a.include && "pointer-events-none opacity-40"), children: /* @__PURE__ */ t(
158
- Z,
159
- {
160
- field: e,
161
- value: a.value,
162
- onChange: (c) => g((u) => ({ ...u, [e.field]: { ...u[e.field], value: c } }))
163
- }
164
- ) }),
165
- o && a.include && /* @__PURE__ */ t(
166
- "button",
167
- {
168
- type: "button",
169
- title: "Reset to original",
170
- onClick: () => g((c) => ({ ...c, [e.field]: { ...c[e.field], value: f[e.field] ?? null } })),
171
- className: "mt-1.5 shrink-0 text-slate-400 hover:text-slate-600",
172
- children: /* @__PURE__ */ t(T, { className: "h-3.5 w-3.5" })
173
- }
174
- )
175
- ] }, e.field);
176
- }) })
177
- ] }),
178
- y.length > 0 && /* @__PURE__ */ r("div", { children: [
179
- /* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Sub-rows" }),
180
- /* @__PURE__ */ t("div", { className: "space-y-2", children: y.map((e) => /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
181
- /* @__PURE__ */ t(
182
- B,
183
- {
184
- checked: !!_[e.field],
185
- onCheckedChange: (a) => I((o) => ({ ...o, [e.field]: a })),
186
- className: "shrink-0 scale-75"
187
- }
188
- ),
189
- /* @__PURE__ */ r(z, { className: "text-[12px]", children: [
190
- "Include ",
191
- /* @__PURE__ */ t("span", { className: "font-mono", children: e.field }),
192
- " sub-rows"
147
+ return /* @__PURE__ */ a(
148
+ K,
149
+ {
150
+ open: J,
151
+ onOpenChange: (e) => {
152
+ e ? M() : p(!1);
153
+ },
154
+ children: [
155
+ /* @__PURE__ */ t(P, { asChild: !0, children: /* @__PURE__ */ a(w, { size: "sm", variant: "outline", className: "gap-1.5", children: [
156
+ /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" }),
157
+ "Clone"
158
+ ] }) }),
159
+ /* @__PURE__ */ a(Y, { className: "flex max-h-[85vh] max-w-lg flex-col overflow-hidden", children: [
160
+ /* @__PURE__ */ t(A, { className: "shrink-0 px-6 pt-6", children: /* @__PURE__ */ t(G, { className: "text-[15px]", children: "Clone item" }) }),
161
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children: /* @__PURE__ */ a("div", { className: "space-y-4", children: [
162
+ x.length > 0 && /* @__PURE__ */ a("div", { children: [
163
+ /* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Field values" }),
164
+ /* @__PURE__ */ t("div", { className: "space-y-2", children: x.map((e) => {
165
+ const i = S[e.field];
166
+ if (!i) return null;
167
+ const o = D(e.field, i);
168
+ return /* @__PURE__ */ a("div", { className: "flex items-start gap-2", children: [
169
+ /* @__PURE__ */ t(
170
+ j,
171
+ {
172
+ checked: i.include,
173
+ onCheckedChange: () => h((c) => ({
174
+ ...c,
175
+ [e.field]: { ...c[e.field], include: !c[e.field].include }
176
+ })),
177
+ className: "mt-1 shrink-0 scale-75"
178
+ }
179
+ ),
180
+ /* @__PURE__ */ t(
181
+ z,
182
+ {
183
+ className: R(
184
+ "mt-1.5 w-32 shrink-0 truncate text-[12px]",
185
+ !i.include && "text-slate-400 line-through"
186
+ ),
187
+ children: H(e.field)
188
+ }
189
+ ),
190
+ /* @__PURE__ */ t(
191
+ "div",
192
+ {
193
+ className: R(
194
+ "flex-1",
195
+ !i.include && "pointer-events-none opacity-40"
196
+ ),
197
+ children: /* @__PURE__ */ t(
198
+ Z,
199
+ {
200
+ field: e,
201
+ value: i.value,
202
+ onChange: (c) => h((u) => ({
203
+ ...u,
204
+ [e.field]: { ...u[e.field], value: c }
205
+ }))
206
+ }
207
+ )
208
+ }
209
+ ),
210
+ o && i.include && /* @__PURE__ */ t(
211
+ "button",
212
+ {
213
+ type: "button",
214
+ title: "Reset to original",
215
+ onClick: () => h((c) => ({
216
+ ...c,
217
+ [e.field]: { ...c[e.field], value: m[e.field] ?? null }
218
+ })),
219
+ className: "mt-1.5 shrink-0 text-slate-400 hover:text-slate-600",
220
+ children: /* @__PURE__ */ t($, { className: "h-3.5 w-3.5" })
221
+ }
222
+ )
223
+ ] }, e.field);
224
+ }) })
225
+ ] }),
226
+ g.length > 0 && /* @__PURE__ */ a("div", { children: [
227
+ /* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Sub-rows" }),
228
+ /* @__PURE__ */ t("div", { className: "space-y-2", children: g.map((e) => /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
229
+ /* @__PURE__ */ t(
230
+ j,
231
+ {
232
+ checked: !!_[e.field],
233
+ onCheckedChange: (i) => I((o) => ({ ...o, [e.field]: i })),
234
+ className: "shrink-0 scale-75"
235
+ }
236
+ ),
237
+ /* @__PURE__ */ a(z, { className: "text-[12px]", children: [
238
+ "Include ",
239
+ /* @__PURE__ */ t("span", { className: "font-mono", children: e.field }),
240
+ " sub-rows"
241
+ ] })
242
+ ] }, e.field)) })
193
243
  ] })
194
- ] }, e.field)) })
195
- ] })
196
- ] }) }),
197
- /* @__PURE__ */ r(G, { className: "shrink-0 border-t border-slate-100 px-6 py-4 dark:border-border", children: [
198
- /* @__PURE__ */ t(w, { variant: "outline", size: "sm", onClick: () => h(!1), children: "Cancel" }),
199
- /* @__PURE__ */ r(w, { size: "sm", disabled: C, onClick: M, children: [
200
- /* @__PURE__ */ t(O, { className: "mr-1.5 h-3.5 w-3.5" }),
201
- C ? "Cloning…" : "Clone"
244
+ ] }) }),
245
+ /* @__PURE__ */ a(Q, { className: "shrink-0 border-t border-slate-100 px-6 py-4 dark:border-border", children: [
246
+ /* @__PURE__ */ t(w, { variant: "outline", size: "sm", onClick: () => p(!1), children: "Cancel" }),
247
+ /* @__PURE__ */ a(w, { size: "sm", disabled: C, onClick: T, children: [
248
+ /* @__PURE__ */ t(O, { className: "mr-1.5 h-3.5 w-3.5" }),
249
+ C ? "Cloning…" : "Clone"
250
+ ] })
251
+ ] })
202
252
  ] })
203
- ] })
204
- ] })
205
- ] });
253
+ ]
254
+ }
255
+ );
206
256
  }
207
257
  export {
208
- ue as CloneDialog
258
+ fe as CloneDialog
209
259
  };