@nivaro/react 0.3.9 → 0.3.11

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 (80) hide show
  1. package/dist/components/fields/FileField.js +20 -19
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useNivaroForm.js +129 -126
  4. package/dist/hooks/useSessionRecorder.js +1 -1
  5. package/dist/index.d.ts +103 -4
  6. package/dist/index.js +512 -501
  7. package/dist/shared/components/CollectionBrowserView.js +1632 -1564
  8. package/dist/shared/components/ConformanceView.js +36 -35
  9. package/dist/shared/components/ForceReloadBanner.js +58 -34
  10. package/dist/shared/components/ItemEditForm.js +4386 -4142
  11. package/dist/shared/components/JsonMapEditor.js +18 -17
  12. package/dist/shared/components/MatrixEditor.js +8 -7
  13. package/dist/shared/components/MyWorkView.js +32 -31
  14. package/dist/shared/components/PageRenderer.js +527 -479
  15. package/dist/shared/components/QueryStatStrip.js +74 -70
  16. package/dist/shared/components/RecordGridEditor.js +76 -75
  17. package/dist/shared/components/ReportView.js +818 -827
  18. package/dist/shared/components/SheetHeaderBody.js +16 -14
  19. package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
  20. package/dist/shared/components/ai/AskPanel.js +55 -54
  21. package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
  22. package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
  23. package/dist/shared/components/chat/SlashCommands.js +30 -29
  24. package/dist/shared/components/chat/chat-outbox.js +76 -75
  25. package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
  26. package/dist/shared/components/integrations/console/SignalCard.js +124 -123
  27. package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
  28. package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
  29. package/dist/shared/components/item-edit/CloneDialog.js +85 -78
  30. package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
  31. package/dist/shared/components/item-edit/FieldRow.js +20 -19
  32. package/dist/shared/components/item-edit/FilePickerField.js +52 -40
  33. package/dist/shared/components/item-edit/GroupSection.js +221 -221
  34. package/dist/shared/components/item-edit/InlineGridField.js +41 -41
  35. package/dist/shared/components/item-edit/InlineTableField.js +2287 -2275
  36. package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
  37. package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
  38. package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
  39. package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
  40. package/dist/shared/components/item-edit/QuickPicker.js +263 -216
  41. package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
  42. package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
  43. package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
  44. package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
  45. package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
  46. package/dist/shared/components/item-edit/helpers.js +133 -134
  47. package/dist/shared/components/item-edit/line-qty.js +57 -0
  48. package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
  49. package/dist/shared/components/item-edit/staged-links.js +86 -0
  50. package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
  51. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
  52. package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
  53. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
  54. package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
  55. package/dist/shared/components/panels/CommentPanel.js +350 -315
  56. package/dist/shared/components/panels/ItemLockBanner.js +297 -230
  57. package/dist/shared/components/panels/PipelinePanel.js +719 -701
  58. package/dist/shared/components/profile/AiMemoryCard.js +15 -14
  59. package/dist/shared/components/profile/PersonAdminTools.js +70 -67
  60. package/dist/shared/components/queue/QueueItemSheet.js +36 -35
  61. package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
  62. package/dist/shared/components/queue/QueueWorklist.js +1026 -957
  63. package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
  64. package/dist/shared/lib/client-version.js +63 -0
  65. package/dist/shared/lib/force-reload.js +36 -0
  66. package/dist/shared/lib/load-error.js +11 -10
  67. package/dist/shared/lib/obligation-banner.js +14 -13
  68. package/dist/shared/lib/obligation-reason-text.js +13 -0
  69. package/dist/shared/lib/presence-live.js +54 -35
  70. package/dist/shared/lib/query-filter-seed.js +34 -11
  71. package/dist/shared/lib/record-outbox.js +76 -75
  72. package/dist/shared/lib/safe-error.js +39 -0
  73. package/dist/shared/lib/sanitize-html.js +24 -15
  74. package/dist/shared/lib/server-clock.js +11 -7
  75. package/dist/shared/lib/sheet-def.js +38 -22
  76. package/dist/shared/lib/unique-options.js +10 -0
  77. package/dist/shared/lib/unsaved-work.js +62 -0
  78. package/dist/shared/lib/utils.js +57 -43
  79. package/dist/shared/lib/validation-rules.js +58 -34
  80. package/package.json +1 -1
@@ -1,25 +1,25 @@
1
1
  import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import { Copy as D, RotateCcw as J } from "lucide-react";
3
- import { useState as N } from "react";
4
- import { toast as I } from "sonner";
5
- import { useNivaroClient as M } from "../../context.js";
6
- import { post as T } from "../../lib/commands.js";
7
- import { titleCase as $, cn as F } from "../../lib/utils.js";
8
- import { Button as b } from "../ui/button.js";
9
- import { Dialog as q, DialogTrigger as E, DialogContent as H, DialogHeader as K, DialogTitle as P, DialogFooter as Y } from "../ui/dialog.js";
10
- import { Input as u } from "../ui/input.js";
11
- import { Label as O } from "../ui/label.js";
12
- import { Switch as R } from "../ui/switch.js";
13
- const A = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "created_by", "updated_by"]);
14
- function G(l, n, s) {
15
- if (A.has(l.field) || l.computed_formula) return !1;
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";
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";
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
16
  const i = l.interface ?? "";
17
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));
18
18
  }
19
- function Q(l) {
19
+ function W(l) {
20
20
  return l.interface === "sub_rows" || l.type === "sub_rows";
21
21
  }
22
- function U(l) {
22
+ function X(l) {
23
23
  if (!l) return "";
24
24
  try {
25
25
  return new Date(String(l)).toISOString().slice(0, 16);
@@ -27,7 +27,7 @@ function U(l) {
27
27
  return "";
28
28
  }
29
29
  }
30
- function W({ field: l, value: n, onChange: s }) {
30
+ function Z({ field: l, value: n, onChange: s }) {
31
31
  return l.type === "boolean" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
32
32
  /* @__PURE__ */ t(
33
33
  "input",
@@ -40,15 +40,15 @@ function W({ field: l, value: n, onChange: s }) {
40
40
  ),
41
41
  /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: n ? "Yes" : "No" })
42
42
  ] }) : l.type === "datetime" || l.interface === "datetime" ? /* @__PURE__ */ t(
43
- u,
43
+ m,
44
44
  {
45
45
  type: "datetime-local",
46
- value: U(n),
46
+ value: X(n),
47
47
  onChange: (i) => s(i.target.value ? new Date(i.target.value).toISOString() : null),
48
48
  className: "h-7 text-[12px]"
49
49
  }
50
50
  ) : l.type === "date" ? /* @__PURE__ */ t(
51
- u,
51
+ m,
52
52
  {
53
53
  type: "date",
54
54
  value: n ? String(n).slice(0, 10) : "",
@@ -56,7 +56,7 @@ function W({ field: l, value: n, onChange: s }) {
56
56
  className: "h-7 text-[12px]"
57
57
  }
58
58
  ) : l.type === "integer" || l.type === "bigInteger" ? /* @__PURE__ */ t(
59
- u,
59
+ m,
60
60
  {
61
61
  type: "number",
62
62
  step: "1",
@@ -65,7 +65,7 @@ function W({ field: l, value: n, onChange: s }) {
65
65
  className: "h-7 text-[12px]"
66
66
  }
67
67
  ) : l.type === "float" || l.type === "decimal" || l.type === "double" ? /* @__PURE__ */ t(
68
- u,
68
+ m,
69
69
  {
70
70
  type: "number",
71
71
  step: "any",
@@ -74,7 +74,7 @@ function W({ field: l, value: n, onChange: s }) {
74
74
  className: "h-7 text-[12px]"
75
75
  }
76
76
  ) : /* @__PURE__ */ t(
77
- u,
77
+ m,
78
78
  {
79
79
  value: n == null ? "" : String(n),
80
80
  onChange: (i) => s(i.target.value || null),
@@ -83,103 +83,110 @@ function W({ field: l, value: n, onChange: s }) {
83
83
  }
84
84
  );
85
85
  }
86
- function ce({ collection: l, itemId: n, fields: s, relations: i, currentValues: m, onSuccess: p }) {
87
- const z = M(), [B, f] = N(!1), [v, w] = N(!1), [C, h] = N({}), [S, k] = N({}), g = s.filter((e) => G(e, i, l)), x = s.filter(Q);
88
- function L() {
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() {
89
89
  const e = {};
90
- for (const c of g)
91
- e[c.field] = { include: !0, value: m[c.field] ?? null };
92
- h(e);
90
+ for (const o of x)
91
+ e[o.field] = { include: !0, value: f[o.field] ?? null };
92
+ g(e);
93
93
  const a = {};
94
- for (const c of x) a[c.field] = !0;
95
- k(a), f(!0);
94
+ for (const o of y) a[o.field] = !0;
95
+ I(a), h(!0);
96
96
  }
97
- function _(e, a) {
98
- return JSON.stringify(a.value) !== JSON.stringify(m[e] ?? null);
97
+ function D(e, a) {
98
+ return JSON.stringify(a.value) !== JSON.stringify(f[e] ?? null);
99
99
  }
100
- async function j() {
101
- w(!0);
100
+ async function M() {
101
+ var e;
102
+ S(!0);
102
103
  try {
103
- const e = {}, a = [];
104
- for (const o of g) {
105
- const y = C[o.field];
106
- if (y) {
107
- if (!y.include) {
108
- a.push(o.field);
104
+ const a = {}, o = [];
105
+ for (const d of x) {
106
+ const N = k[d.field];
107
+ if (N) {
108
+ if (!N.include) {
109
+ o.push(d.field);
109
110
  continue;
110
111
  }
111
- _(o.field, y) && (e[o.field] = y.value);
112
+ D(d.field, N) && (a[d.field] = N.value);
112
113
  }
113
114
  }
114
- const c = x.filter((o) => S[o.field]).map((o) => o.field), d = await z.request(
115
- T(`/items/${l}/${n}/clone`, { field_overrides: e, exclude_fields: a, include_sub_rows: c })
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 })
116
117
  );
117
- I.success("Item cloned"), f(!1), p(d.data.id);
118
+ h(!1);
119
+ const F = (e = u == null ? void 0 : u.data) == null ? void 0 : e.id;
120
+ if (F == null) {
121
+ v.success("Item cloned — open it from the list");
122
+ return;
123
+ }
124
+ v.success("Item cloned"), p(F);
118
125
  } catch {
119
- I.error("Failed to clone item");
126
+ v.error("Failed to clone item");
120
127
  } finally {
121
- w(!1);
128
+ S(!1);
122
129
  }
123
130
  }
124
- return /* @__PURE__ */ r(q, { open: B, onOpenChange: (e) => {
125
- e ? L() : f(!1);
131
+ return /* @__PURE__ */ r(H, { open: j, onOpenChange: (e) => {
132
+ e ? J() : h(!1);
126
133
  }, children: [
127
- /* @__PURE__ */ t(E, { asChild: !0, children: /* @__PURE__ */ r(b, { size: "sm", variant: "outline", className: "gap-1.5", children: [
128
- /* @__PURE__ */ t(D, { className: "h-3.5 w-3.5" }),
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" }),
129
136
  "Clone"
130
137
  ] }) }),
131
- /* @__PURE__ */ r(H, { className: "flex max-h-[85vh] max-w-lg flex-col overflow-hidden", children: [
132
- /* @__PURE__ */ t(K, { className: "shrink-0 px-6 pt-6", children: /* @__PURE__ */ t(P, { className: "text-[15px]", children: "Clone item" }) }),
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" }) }),
133
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: [
134
- g.length > 0 && /* @__PURE__ */ r("div", { children: [
141
+ x.length > 0 && /* @__PURE__ */ r("div", { children: [
135
142
  /* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Field values" }),
136
- /* @__PURE__ */ t("div", { className: "space-y-2", children: g.map((e) => {
137
- const a = C[e.field];
143
+ /* @__PURE__ */ t("div", { className: "space-y-2", children: x.map((e) => {
144
+ const a = k[e.field];
138
145
  if (!a) return null;
139
- const c = _(e.field, a);
146
+ const o = D(e.field, a);
140
147
  return /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
141
148
  /* @__PURE__ */ t(
142
- R,
149
+ B,
143
150
  {
144
151
  checked: a.include,
145
- onCheckedChange: () => h((d) => ({ ...d, [e.field]: { ...d[e.field], include: !d[e.field].include } })),
152
+ onCheckedChange: () => g((c) => ({ ...c, [e.field]: { ...c[e.field], include: !c[e.field].include } })),
146
153
  className: "mt-1 shrink-0 scale-75"
147
154
  }
148
155
  ),
149
- /* @__PURE__ */ t(O, { className: F("mt-1.5 w-32 shrink-0 truncate text-[12px]", !a.include && "text-slate-400 line-through"), children: $(e.field) }),
150
- /* @__PURE__ */ t("div", { className: F("flex-1", !a.include && "pointer-events-none opacity-40"), children: /* @__PURE__ */ t(
151
- W,
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,
152
159
  {
153
160
  field: e,
154
161
  value: a.value,
155
- onChange: (d) => h((o) => ({ ...o, [e.field]: { ...o[e.field], value: d } }))
162
+ onChange: (c) => g((u) => ({ ...u, [e.field]: { ...u[e.field], value: c } }))
156
163
  }
157
164
  ) }),
158
- c && a.include && /* @__PURE__ */ t(
165
+ o && a.include && /* @__PURE__ */ t(
159
166
  "button",
160
167
  {
161
168
  type: "button",
162
169
  title: "Reset to original",
163
- onClick: () => h((d) => ({ ...d, [e.field]: { ...d[e.field], value: m[e.field] ?? null } })),
170
+ onClick: () => g((c) => ({ ...c, [e.field]: { ...c[e.field], value: f[e.field] ?? null } })),
164
171
  className: "mt-1.5 shrink-0 text-slate-400 hover:text-slate-600",
165
- children: /* @__PURE__ */ t(J, { className: "h-3.5 w-3.5" })
172
+ children: /* @__PURE__ */ t(T, { className: "h-3.5 w-3.5" })
166
173
  }
167
174
  )
168
175
  ] }, e.field);
169
176
  }) })
170
177
  ] }),
171
- x.length > 0 && /* @__PURE__ */ r("div", { children: [
178
+ y.length > 0 && /* @__PURE__ */ r("div", { children: [
172
179
  /* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Sub-rows" }),
173
- /* @__PURE__ */ t("div", { className: "space-y-2", children: x.map((e) => /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
180
+ /* @__PURE__ */ t("div", { className: "space-y-2", children: y.map((e) => /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
174
181
  /* @__PURE__ */ t(
175
- R,
182
+ B,
176
183
  {
177
- checked: !!S[e.field],
178
- onCheckedChange: (a) => k((c) => ({ ...c, [e.field]: a })),
184
+ checked: !!_[e.field],
185
+ onCheckedChange: (a) => I((o) => ({ ...o, [e.field]: a })),
179
186
  className: "shrink-0 scale-75"
180
187
  }
181
188
  ),
182
- /* @__PURE__ */ r(O, { className: "text-[12px]", children: [
189
+ /* @__PURE__ */ r(z, { className: "text-[12px]", children: [
183
190
  "Include ",
184
191
  /* @__PURE__ */ t("span", { className: "font-mono", children: e.field }),
185
192
  " sub-rows"
@@ -187,16 +194,16 @@ function ce({ collection: l, itemId: n, fields: s, relations: i, currentValues:
187
194
  ] }, e.field)) })
188
195
  ] })
189
196
  ] }) }),
190
- /* @__PURE__ */ r(Y, { className: "shrink-0 border-t border-slate-100 px-6 py-4 dark:border-border", children: [
191
- /* @__PURE__ */ t(b, { variant: "outline", size: "sm", onClick: () => f(!1), children: "Cancel" }),
192
- /* @__PURE__ */ r(b, { size: "sm", disabled: v, onClick: j, children: [
193
- /* @__PURE__ */ t(D, { className: "mr-1.5 h-3.5 w-3.5" }),
194
- v ? "Cloning…" : "Clone"
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"
195
202
  ] })
196
203
  ] })
197
204
  ] })
198
205
  ] });
199
206
  }
200
207
  export {
201
- ce as CloneDialog
208
+ ue as CloneDialog
202
209
  };