@nivaro/react 0.3.10 → 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 (43) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useNivaroForm.js +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  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/QueryStatStrip.js +74 -70
  9. package/dist/shared/components/ReportView.js +818 -827
  10. package/dist/shared/components/SheetHeaderBody.js +16 -14
  11. package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
  12. package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
  13. package/dist/shared/components/item-edit/FieldRow.js +20 -19
  14. package/dist/shared/components/item-edit/FilePickerField.js +52 -40
  15. package/dist/shared/components/item-edit/GroupSection.js +221 -221
  16. package/dist/shared/components/item-edit/InlineGridField.js +41 -41
  17. package/dist/shared/components/item-edit/InlineTableField.js +2249 -2238
  18. package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
  19. package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
  20. package/dist/shared/components/item-edit/QuickPicker.js +263 -216
  21. package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
  22. package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
  23. package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
  24. package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
  25. package/dist/shared/components/item-edit/helpers.js +133 -134
  26. package/dist/shared/components/item-edit/line-qty.js +57 -0
  27. package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
  28. package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
  29. package/dist/shared/components/panels/CommentPanel.js +350 -315
  30. package/dist/shared/components/panels/ItemLockBanner.js +297 -230
  31. package/dist/shared/components/panels/PipelinePanel.js +719 -701
  32. package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
  33. package/dist/shared/components/queue/QueueWorklist.js +1005 -935
  34. package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
  35. package/dist/shared/lib/obligation-banner.js +14 -13
  36. package/dist/shared/lib/obligation-reason-text.js +13 -0
  37. package/dist/shared/lib/query-filter-seed.js +34 -11
  38. package/dist/shared/lib/sanitize-html.js +24 -15
  39. package/dist/shared/lib/sheet-def.js +38 -22
  40. package/dist/shared/lib/unique-options.js +10 -0
  41. package/dist/shared/lib/utils.js +57 -43
  42. package/dist/shared/lib/validation-rules.js +58 -34
  43. package/package.json +1 -1
@@ -1,55 +1,55 @@
1
- import { jsxs as g, jsx as s, Fragment as q } from "react/jsx-runtime";
1
+ import { jsxs as g, jsx as s, Fragment as f } from "react/jsx-runtime";
2
2
  import { useQuery as S } from "@tanstack/react-query";
3
- import { useState as h, useEffect as v, useMemo as C } from "react";
3
+ import { useState as d, useEffect as C, useMemo as N } from "react";
4
4
  import { MultiPick as x } from "../CollectionBrowserView.js";
5
- const k = (t) => Array.isArray(t) ? t : t ? [t] : [];
6
- function N({
5
+ const b = (t) => Array.isArray(t) ? t : t ? [t] : [];
6
+ function O({
7
7
  def: t,
8
- selected: o,
9
- onChange: y,
10
- badge: m
8
+ selected: a,
9
+ onChange: k,
10
+ badge: p
11
11
  }) {
12
- const [d, i] = h(!1), [p, c] = h(""), l = t.loadOptions, { data: u = [], isLoading: e } = S({
13
- queryKey: ["queue-quick-facet", t.key, p],
14
- queryFn: () => l ? l(p) : Promise.resolve([]),
15
- enabled: !!l && (d || o.length > 0),
12
+ const [h, i] = d(!1), [y, c] = d(""), l = t.loadOptions, { data: u = [], isLoading: e } = S({
13
+ queryKey: ["queue-quick-facet", t.key, y],
14
+ queryFn: () => l ? l(y) : Promise.resolve([]),
15
+ enabled: !!l && (h || a.length > 0),
16
16
  staleTime: 6e4
17
- }), r = C(() => {
18
- const a = new Set(u.map((n) => n.value));
19
- return [...u, ...o.filter((n) => !a.has(n)).map((n) => ({ label: n, value: n }))];
20
- }, [u, o]);
17
+ }), r = N(() => {
18
+ const o = new Set(u.map((n) => n.value));
19
+ return [...u, ...a.filter((n) => !o.has(n)).map((n) => ({ label: n, value: n }))];
20
+ }, [u, a]);
21
21
  return /* @__PURE__ */ s(
22
22
  x,
23
23
  {
24
24
  label: t.placeholder,
25
25
  options: r,
26
- selected: o,
27
- onChange: (a) => y(a.map(String)),
26
+ selected: a,
27
+ onChange: (o) => k(o.map(String)),
28
28
  loading: e,
29
- badge: m,
29
+ badge: p,
30
30
  onSearch: c,
31
- onOpenChange: (a) => {
32
- a && i(!0);
31
+ onOpenChange: (o) => {
32
+ o && i(!0);
33
33
  }
34
34
  }
35
35
  );
36
36
  }
37
37
  function Q({
38
38
  defs: t,
39
- values: o,
40
- seededKeys: y,
41
- onApply: m,
42
- onClear: d,
39
+ values: a,
40
+ seededKeys: k,
41
+ onApply: p,
42
+ onClear: h,
43
43
  right: i
44
44
  }) {
45
- const p = JSON.stringify(t.map((e) => [e.key, k(o[e.key])])), [c, l] = h({});
46
- v(() => {
45
+ const y = JSON.stringify(t.map((e) => [e.key, b(a[e.key])])), [c, l] = d({});
46
+ C(() => {
47
47
  const e = {};
48
- for (const r of t) e[r.key] = k(o[r.key]);
48
+ for (const r of t) e[r.key] = b(a[r.key]);
49
49
  l(e);
50
- }, [p]);
50
+ }, [y]);
51
51
  const u = t.some(
52
- (e) => JSON.stringify(c[e.key] ?? []) !== JSON.stringify(k(o[e.key]))
52
+ (e) => JSON.stringify(c[e.key] ?? []) !== JSON.stringify(b(a[e.key]))
53
53
  );
54
54
  return t.length === 0 && !i ? null : /* @__PURE__ */ g(
55
55
  "div",
@@ -58,28 +58,30 @@ function Q({
58
58
  "data-queue-quick-filters": !0,
59
59
  children: [
60
60
  t.map((e) => {
61
- const r = c[e.key] ?? [], a = e.restricted ? {
61
+ const r = c[e.key] ?? [], o = e.restricted ? {
62
62
  label: "restricted",
63
63
  cls: "bg-amber-500/15 text-amber-700 dark:text-amber-300",
64
64
  title: `Options limited to your restricted ${e.placeholder} scope`
65
- } : y.has(e.key) && r.length > 0 ? {
66
- label: "default",
65
+ } : k.has(e.key) && r.length > 0 ? {
66
+ label: "your default",
67
67
  cls: "bg-nvr-cyan/[0.12] text-[#0284a8] dark:text-nvr-cyan",
68
68
  title: `Pre-selected from your default ${e.placeholder} scope — adjust freely`
69
- } : null, n = (b) => l((f) => ({ ...f, [e.key]: b }));
70
- return e.loadOptions ? /* @__PURE__ */ s(N, { def: e, selected: r, onChange: n, badge: a }, e.key) : /* @__PURE__ */ s(
69
+ } : null, n = (m) => {
70
+ l((q) => ({ ...q, [e.key]: m })), m.length === 0 && b(a[e.key]).length > 0 && p({ [e.key]: e.multi || e.type === "combobox" ? [] : "" });
71
+ };
72
+ return e.loadOptions ? /* @__PURE__ */ s(O, { def: e, selected: r, onChange: n, badge: o }, e.key) : /* @__PURE__ */ s(
71
73
  x,
72
74
  {
73
75
  label: e.placeholder,
74
76
  options: e.options ?? [],
75
77
  selected: r,
76
- onChange: (b) => n(b.map(String)),
77
- badge: a
78
+ onChange: (m) => n(m.map(String)),
79
+ badge: o
78
80
  },
79
81
  e.key
80
82
  );
81
83
  }),
82
- t.length > 0 && /* @__PURE__ */ g(q, { children: [
84
+ t.length > 0 && /* @__PURE__ */ g(f, { children: [
83
85
  /* @__PURE__ */ s(
84
86
  "button",
85
87
  {
@@ -87,10 +89,10 @@ function Q({
87
89
  onClick: () => {
88
90
  const e = {};
89
91
  for (const r of t) {
90
- const a = c[r.key] ?? [];
91
- e[r.key] = r.multi || r.type === "combobox" ? a : a[0] ?? "";
92
+ const o = c[r.key] ?? [];
93
+ e[r.key] = r.multi || r.type === "combobox" ? o : o[0] ?? "";
92
94
  }
93
- m(e);
95
+ p(e);
94
96
  },
95
97
  className: `h-6 rounded px-2.5 text-[11px] font-semibold text-white transition-[filter] hover:brightness-110 ${u ? "bg-nvr-cyan" : "bg-nvr-cyan opacity-60"}`,
96
98
  "data-queue-quick-apply": !0,
@@ -101,7 +103,7 @@ function Q({
101
103
  "button",
102
104
  {
103
105
  type: "button",
104
- onClick: d,
106
+ onClick: h,
105
107
  className: "h-6 rounded border border-slate-200 px-2 text-[11px] text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:text-slate-200",
106
108
  "data-queue-quick-clear": !0,
107
109
  children: "Clear"