@nivaro/react 0.3.10 → 0.3.12

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/useNivaroForm.js +1 -1
  3. package/dist/hooks/useSessionRecorder.js +109 -102
  4. package/dist/index.d.ts +34 -3
  5. package/dist/shared/components/CollectionBrowserView.js +1546 -1477
  6. package/dist/shared/components/ItemEditForm.js +4332 -4195
  7. package/dist/shared/components/PageRenderer.js +512 -465
  8. package/dist/shared/components/ProfileView.js +115 -109
  9. package/dist/shared/components/QueryStatStrip.js +74 -70
  10. package/dist/shared/components/ReportView.js +818 -827
  11. package/dist/shared/components/SheetHeaderBody.js +16 -14
  12. package/dist/shared/components/chat/ChatPanel.js +492 -472
  13. package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
  14. package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
  15. package/dist/shared/components/item-edit/FieldRow.js +20 -19
  16. package/dist/shared/components/item-edit/FilePickerField.js +52 -40
  17. package/dist/shared/components/item-edit/GroupSection.js +221 -221
  18. package/dist/shared/components/item-edit/InlineGridField.js +41 -41
  19. package/dist/shared/components/item-edit/InlineTableField.js +2249 -2238
  20. package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
  21. package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
  22. package/dist/shared/components/item-edit/QuickPicker.js +263 -216
  23. package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
  24. package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
  25. package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
  26. package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
  27. package/dist/shared/components/item-edit/UserChip.js +301 -233
  28. package/dist/shared/components/item-edit/helpers.js +133 -134
  29. package/dist/shared/components/item-edit/line-qty.js +57 -0
  30. package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
  31. package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
  32. package/dist/shared/components/panels/CommentPanel.js +350 -315
  33. package/dist/shared/components/panels/ItemLockBanner.js +297 -230
  34. package/dist/shared/components/panels/PipelinePanel.js +719 -701
  35. package/dist/shared/components/profile/PersonAdminTools.js +168 -144
  36. package/dist/shared/components/profile/PersonProfile.js +42 -41
  37. package/dist/shared/components/profile/session-actions.js +52 -0
  38. package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
  39. package/dist/shared/components/queue/QueueWorklist.js +1005 -935
  40. package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
  41. package/dist/shared/lib/obligation-banner.js +14 -13
  42. package/dist/shared/lib/obligation-reason-text.js +13 -0
  43. package/dist/shared/lib/query-filter-seed.js +34 -11
  44. package/dist/shared/lib/replay-checkout.js +20 -0
  45. package/dist/shared/lib/sanitize-html.js +24 -15
  46. package/dist/shared/lib/sheet-def.js +38 -22
  47. package/dist/shared/lib/unique-options.js +10 -0
  48. package/dist/shared/lib/utils.js +57 -43
  49. package/dist/shared/lib/validation-rules.js +58 -34
  50. package/package.json +1 -1
@@ -5,7 +5,7 @@ import F from "@tiptap/extension-placeholder";
5
5
  import J from "@tiptap/extension-underline";
6
6
  import { useEditor as P, EditorContent as K } from "@tiptap/react";
7
7
  import W from "@tiptap/starter-kit";
8
- import { Bold as z, Italic as Q, UnderlineIcon as V, Strikethrough as X, Heading1 as G, Heading2 as Y, Heading3 as Z, List as ee, ListOrdered as te, Quote as re, Code as ie, Minus as ne, Link as oe, Link2Off as ae, FileSymlink as E, Check as le, X as I, Loader2 as se } from "lucide-react";
8
+ import { Bold as z, Italic as Q, UnderlineIcon as V, Strikethrough as X, Heading1 as G, Heading2 as Y, Heading3 as Z, List as ee, ListOrdered as te, Quote as re, Code as ie, Minus as ne, Link as ae, Link2Off as oe, FileSymlink as E, Check as le, X as I, Loader2 as se } from "lucide-react";
9
9
  import { useState as v, useRef as T, useMemo as ce, useEffect as R } from "react";
10
10
  import { useApiFetchConfig as de, useItemNavigation as pe } from "../../context.js";
11
11
  import { cn as j } from "../../lib/utils.js";
@@ -16,20 +16,20 @@ function S(i) {
16
16
  function B(i) {
17
17
  try {
18
18
  return (JSON.parse(i || "{}").blocks ?? []).map((l) => {
19
- const o = S(String(l.data.text ?? "")), a = Math.max(1, Math.min(6, Number(l.data.level ?? 2)));
19
+ const a = S(String(l.data.text ?? "")), o = Math.max(1, Math.min(6, Number(l.data.level ?? 2)));
20
20
  switch (l.type) {
21
21
  case "paragraph":
22
- return `<p>${o}</p>`;
22
+ return `<p>${a}</p>`;
23
23
  case "header":
24
- return `<h${a}>${o}</h${a}>`;
24
+ return `<h${o}>${a}</h${o}>`;
25
25
  case "list": {
26
26
  const c = (l.data.items ?? []).map((m) => `<li>${S(m)}</li>`).join("");
27
27
  return l.data.style === "ordered" ? `<ol>${c}</ol>` : `<ul>${c}</ul>`;
28
28
  }
29
29
  case "quote":
30
- return `<blockquote><p>${o}</p></blockquote>`;
30
+ return `<blockquote><p>${a}</p></blockquote>`;
31
31
  default:
32
- return o ? `<p>${o}</p>` : "";
32
+ return a ? `<p>${a}</p>` : "";
33
33
  }
34
34
  }).join("");
35
35
  } catch {
@@ -40,21 +40,21 @@ function s({
40
40
  active: i,
41
41
  title: u,
42
42
  onClick: l,
43
- children: o
43
+ children: a
44
44
  }) {
45
45
  return /* @__PURE__ */ e(
46
46
  "button",
47
47
  {
48
48
  type: "button",
49
49
  title: u,
50
- onMouseDown: (a) => {
51
- a.preventDefault(), l();
50
+ onMouseDown: (o) => {
51
+ o.preventDefault(), l();
52
52
  },
53
53
  className: j(
54
54
  "flex h-6 w-6 items-center justify-center rounded text-slate-500 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-300 dark:hover:bg-[#334155] dark:hover:text-white",
55
55
  i && "bg-slate-200 text-slate-900 dark:bg-[#334155] dark:text-white"
56
56
  ),
57
- children: o
57
+ children: a
58
58
  }
59
59
  );
60
60
  }
@@ -65,26 +65,36 @@ function De({
65
65
  value: i,
66
66
  onChange: u,
67
67
  placeholder: l,
68
- disabled: o,
69
- pastePlain: a
68
+ disabled: a,
69
+ pastePlain: o
70
70
  }) {
71
71
  const [c, m] = v(!1), [g, _] = v(""), [k, y] = v(!1), w = T(null), f = de(), N = pe(), h = ce(() => i ? i.trimStart().startsWith('{"time":') && i.includes('"blocks":') ? B(i) : i : "", [i]), t = P({
72
72
  immediatelyRender: !1,
73
73
  extensions: [
74
- W.configure({ bulletList: { keepMarks: !0 }, orderedList: { keepMarks: !0 } }),
74
+ // StarterKit 3 bundles its own Link (autolink on) and Underline; they are
75
+ // registered below with this editor's options, so the kit's copies stay out.
76
+ W.configure({
77
+ bulletList: { keepMarks: !0 },
78
+ orderedList: { keepMarks: !0 },
79
+ link: !1,
80
+ underline: !1
81
+ }),
75
82
  J,
76
83
  F.configure({ placeholder: l ?? "Start writing…" }),
77
84
  // 'record' protocol (#666): record://<collection>/<id> links survive the
78
85
  // Link extension's allowed-URI validation and render as record chips.
79
- U.configure({ openOnClick: !1, autolink: !0, protocols: ["record"] })
86
+ // No autolink while typing: EFP site codes read like domains (byron.il,
87
+ // oswego.il) and every one became a bogus http:// link in notes that go
88
+ // to suppliers. Links are explicit — the toolbar, or pasting a URL.
89
+ U.configure({ openOnClick: !1, autolink: !1, protocols: ["record"] })
80
90
  ],
81
91
  content: h,
82
- editable: !o,
92
+ editable: !a,
83
93
  // NEVER undefined: an explicit `editorProps: undefined` overrides tiptap's
84
94
  // `{}` default in the options merge, and 3.26's createView reads
85
95
  // `editorProps.dispatchTransaction` unguarded — every non-pastePlain
86
96
  // editor crashed at mount ("Cannot read properties of undefined").
87
- editorProps: a ? {
97
+ editorProps: o ? {
88
98
  handlePaste(n, d) {
89
99
  var L;
90
100
  const C = (L = d.clipboardData) == null ? void 0 : L.getData("text/plain");
@@ -117,10 +127,10 @@ function De({
117
127
  {
118
128
  className: j(
119
129
  "overflow-hidden rounded-md border border-slate-200 bg-background focus-within:ring-1 focus-within:ring-nvr-cyan focus-within:border-nvr-cyan dark:border-border",
120
- o && "opacity-60"
130
+ a && "opacity-60"
121
131
  ),
122
132
  children: [
123
- !o && /* @__PURE__ */ b(O, { children: [
133
+ !a && /* @__PURE__ */ b(O, { children: [
124
134
  /* @__PURE__ */ b("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-slate-200 bg-slate-50 px-2 py-1.5 dark:border-border dark:bg-muted", children: [
125
135
  /* @__PURE__ */ e(
126
136
  s,
@@ -239,7 +249,7 @@ function De({
239
249
  title: "Link",
240
250
  active: t.isActive("link"),
241
251
  onClick: p,
242
- children: /* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5" })
252
+ children: /* @__PURE__ */ e(ae, { className: "h-3.5 w-3.5" })
243
253
  }
244
254
  ),
245
255
  t.isActive("link") && /* @__PURE__ */ e(
@@ -247,7 +257,7 @@ function De({
247
257
  {
248
258
  title: "Remove link",
249
259
  onClick: () => t.chain().focus().unsetLink().run(),
250
- children: /* @__PURE__ */ e(ae, { className: "h-3.5 w-3.5" })
260
+ children: /* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5" })
251
261
  }
252
262
  ),
253
263
  /* @__PURE__ */ e(
@@ -349,18 +359,18 @@ function De({
349
359
  );
350
360
  }
351
361
  function he(i, u) {
352
- return i ? i.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (l, o) => {
353
- if (o.includes(".")) return "";
354
- const a = u[o];
355
- return a == null ? "" : String(a);
362
+ return i ? i.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (l, a) => {
363
+ if (a.includes(".")) return "";
364
+ const o = u[a];
365
+ return o == null ? "" : String(o);
356
366
  }).replace(/\s+/g, " ").trim() : "";
357
367
  }
358
368
  function me(i, u) {
359
369
  const l = he(u, i);
360
370
  if (l) return l;
361
- for (const o of ["name", "title", "label", "subject"]) {
362
- const a = i[o];
363
- if (typeof a == "string" && a.trim()) return a.trim();
371
+ for (const a of ["name", "title", "label", "subject"]) {
372
+ const o = i[a];
373
+ if (typeof o == "string" && o.trim()) return o.trim();
364
374
  }
365
375
  return `#${String(i.id ?? "")}`;
366
376
  }
@@ -368,8 +378,8 @@ function fe({
368
378
  apiBase: i,
369
379
  authHeaders: u,
370
380
  credentials: l,
371
- onInsert: o,
372
- onClose: a
381
+ onInsert: a,
382
+ onClose: o
373
383
  }) {
374
384
  const [c, m] = v(""), [g, _] = v(""), [k, y] = v("");
375
385
  R(() => {
@@ -422,7 +432,7 @@ function fe({
422
432
  {
423
433
  value: g,
424
434
  onChange: (r) => _(r.target.value),
425
- onKeyDown: (r) => r.key === "Escape" && a(),
435
+ onKeyDown: (r) => r.key === "Escape" && o(),
426
436
  placeholder: c ? "Search records…" : "Pick a collection first",
427
437
  disabled: !c,
428
438
  "aria-label": "Search records",
@@ -436,7 +446,7 @@ function fe({
436
446
  type: "button",
437
447
  title: "Close",
438
448
  onMouseDown: (r) => {
439
- r.preventDefault(), a();
449
+ r.preventDefault(), o();
440
450
  },
441
451
  className: "flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100",
442
452
  children: /* @__PURE__ */ e(I, { className: "h-3.5 w-3.5" })
@@ -451,7 +461,7 @@ function fe({
451
461
  {
452
462
  type: "button",
453
463
  onMouseDown: (A) => {
454
- A.preventDefault(), x && o(p, `record://${c}/${x}`);
464
+ A.preventDefault(), x && a(p, `record://${c}/${x}`);
455
465
  },
456
466
  className: "flex w-full items-center gap-1.5 px-2 py-1 text-left text-[12px] text-slate-700 hover:bg-muted",
457
467
  children: [