@nivaro/react 0.3.66 → 0.3.67

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 (27) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +8 -1
  4. package/dist/shared/components/ActivityEntry.js +28 -28
  5. package/dist/shared/components/CollectionBrowserView.js +584 -585
  6. package/dist/shared/components/ItemEditForm.js +1758 -1758
  7. package/dist/shared/components/RecordCompare.js +149 -129
  8. package/dist/shared/components/bulk/BulkCompareButton.js +16 -16
  9. package/dist/shared/components/integrations/IntegrationObligationsView.js +199 -187
  10. package/dist/shared/components/integrations/console/EventsView.js +22 -24
  11. package/dist/shared/components/integrations/console/SubmissionRow.js +6 -13
  12. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +29 -28
  13. package/dist/shared/components/integrations/console/tone.js +22 -21
  14. package/dist/shared/components/item-edit/FieldRow.js +193 -193
  15. package/dist/shared/components/item-edit/GroupSection.js +209 -209
  16. package/dist/shared/components/item-edit/RecordInsights.js +46 -45
  17. package/dist/shared/components/panels/BranchLanes.js +7 -7
  18. package/dist/shared/components/panels/CommentPanel.js +72 -72
  19. package/dist/shared/components/panels/PipelinePanel.js +261 -261
  20. package/dist/shared/components/panels/RecordIntegrityBanner.js +78 -78
  21. package/dist/shared/components/panels/RevisionsPanel.js +220 -220
  22. package/dist/shared/components/panels/TaskPanel.js +75 -75
  23. package/dist/shared/components/queue/QueueWorklist.js +499 -498
  24. package/dist/shared/lib/compare-value.js +73 -0
  25. package/dist/shared/lib/format-value.js +19 -18
  26. package/dist/shared/lib/utils.js +59 -57
  27. package/package.json +1 -1
@@ -0,0 +1,73 @@
1
+ import { choiceLabel as S, formatDate as y, formatDateTime as l } from "./utils.js";
2
+ function f(r) {
3
+ if (!r) return {};
4
+ if (typeof r == "string")
5
+ try {
6
+ const t = JSON.parse(r);
7
+ return t && typeof t == "object" && !Array.isArray(t) ? t : {};
8
+ } catch {
9
+ return {};
10
+ }
11
+ return typeof r == "object" && !Array.isArray(r) ? r : {};
12
+ }
13
+ function p(r) {
14
+ const t = f(r == null ? void 0 : r.options), e = f(r == null ? void 0 : r.display_options);
15
+ return (Array.isArray(t.choices) ? t.choices : Array.isArray(e.choices) ? e.choices : []).filter((o) => !!o && typeof o == "object");
16
+ }
17
+ const a = /* @__PURE__ */ new Set(["boolean"]), b = /* @__PURE__ */ new Set(["timestamp", "datetime", "datetime-local"]), d = /* @__PURE__ */ new Set(["integer", "biginteger", "decimal", "float", "bigint"]);
18
+ function h(r) {
19
+ const t = f(r == null ? void 0 : r.options), e = f(r == null ? void 0 : r.display_options);
20
+ if (String(t.format ?? e.format ?? "") !== "currency" && !t.currency && !e.currency) return null;
21
+ const o = String(t.currency ?? e.currency ?? "USD").toUpperCase();
22
+ return /^[A-Z]{3}$/.test(o) ? o : "USD";
23
+ }
24
+ function g(r, t) {
25
+ if (r == null || r === "") return "—";
26
+ const e = p(t);
27
+ if (e.length > 0) {
28
+ const n = e.find((s) => String(s.value) === String(r));
29
+ if (n && n.text != null && String(n.text).trim()) return S(String(n.text));
30
+ }
31
+ const i = String((t == null ? void 0 : t.type) ?? "").toLowerCase(), o = String((t == null ? void 0 : t.interface) ?? "").toLowerCase();
32
+ if (typeof r == "boolean" || a.has(i) || o === "boolean") {
33
+ const n = String(r).toLowerCase();
34
+ if (r === !0 || n === "true" || n === "1") return "Yes";
35
+ if (r === !1 || n === "false" || n === "0") return "No";
36
+ }
37
+ if (i === "date") return y(String(r)) || String(r);
38
+ if (b.has(i) || typeof r == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(r)) {
39
+ const n = String(r);
40
+ if (/^\d{4}-\d{2}-\d{2}(T00:00:00(\.0+)?Z)?$/.test(n)) return y(n) || n;
41
+ const s = new Date(n);
42
+ return Number.isNaN(s.getTime()) ? n : l(s);
43
+ }
44
+ const c = typeof r == "number" ? r : Number(String(r).trim());
45
+ if ((typeof r == "number" || d.has(i)) && String(r).trim() !== "" && Number.isFinite(c)) {
46
+ const n = h(t);
47
+ if (n)
48
+ try {
49
+ return c.toLocaleString("en-US", { style: "currency", currency: n });
50
+ } catch {
51
+ return c.toLocaleString("en-US", { style: "currency", currency: "USD" });
52
+ }
53
+ return i === "integer" || i === "biginteger" || i === "bigint" ? String(c) : c.toLocaleString("en-US", { maximumFractionDigits: 2 });
54
+ }
55
+ const u = String(r);
56
+ return u.length > 160 ? `${u.slice(0, 160)}…` : u;
57
+ }
58
+ function T(r, t) {
59
+ if (Array.isArray(r) && r.every((e) => e == null || typeof e != "object")) {
60
+ const e = r.filter((i) => i != null && i !== "").map((i) => g(i, t));
61
+ return e.length ? e.join(", ") : "—";
62
+ }
63
+ if (r && typeof r == "object")
64
+ try {
65
+ return JSON.stringify(r).slice(0, 80);
66
+ } catch {
67
+ return "—";
68
+ }
69
+ return g(r, t);
70
+ }
71
+ export {
72
+ T as compareValueText
73
+ };
@@ -1,11 +1,11 @@
1
- import { formatRelative as s } from "./utils.js";
2
- const a = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], m = /* @__PURE__ */ new Set(["true", "1", "yes", "y"]), c = /* @__PURE__ */ new Set(["false", "0", "no", "n"]);
1
+ import { formatDateTime as s, formatRelative as m } from "./utils.js";
2
+ const a = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], c = /* @__PURE__ */ new Set(["true", "1", "yes", "y"]), l = /* @__PURE__ */ new Set(["false", "0", "no", "n"]);
3
3
  function u(t) {
4
4
  return String(t).padStart(2, "0");
5
5
  }
6
- function l(t, e) {
6
+ function f(t, e) {
7
7
  const n = t.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/), r = n ? new Date(Number(n[1]), Number(n[2]) - 1, Number(n[3])) : new Date(t);
8
- return Number.isNaN(r.getTime()) ? t : e === "relative" ? s(r) : e.replace(/YYYY|MMM|YY|MM|DD|HH|hh|mm|ss|h|A|a/g, (i) => {
8
+ return Number.isNaN(r.getTime()) ? t : e === "relative" ? m(r) : e.replace(/YYYY|MMM|YY|MM|DD|HH|hh|mm|ss|h|A|a/g, (i) => {
9
9
  switch (i) {
10
10
  case "YYYY":
11
11
  return String(r.getFullYear());
@@ -36,9 +36,10 @@ function l(t, e) {
36
36
  }
37
37
  });
38
38
  }
39
- function f(t, e) {
39
+ function h(t, e) {
40
40
  if (e.type === "count") return t;
41
- if (e.type === "datetime") return l(t, e.template);
41
+ if (e.type === "datetime")
42
+ return e.template !== "relative" && /h|H/.test(e.template) ? s(t) || t : f(t, e.template);
42
43
  if (e.type === "number") {
43
44
  const r = Number(t);
44
45
  if (Number.isNaN(r) || t.trim() === "") return t;
@@ -50,14 +51,14 @@ function f(t, e) {
50
51
  return `${e.prefix ?? ""}${i}${e.suffix ?? ""}`;
51
52
  }
52
53
  const n = t.trim().toLowerCase();
53
- return m.has(n) ? e.true_label : c.has(n) ? e.false_label : t;
54
+ return c.has(n) ? e.true_label : l.has(n) ? e.false_label : t;
54
55
  }
55
- function M(t, e) {
56
+ function N(t, e) {
56
57
  if (!t) return t;
57
58
  const n = t.match(/ \+\d+ more$/), r = n ? n[0] : "";
58
- return (r ? t.slice(0, -r.length) : t).split(", ").map((o) => f(o, e)).join(", ") + r;
59
+ return (r ? t.slice(0, -r.length) : t).split(", ").map((o) => h(o, e)).join(", ") + r;
59
60
  }
60
- function h(t, e = 2) {
61
+ function p(t, e = 2) {
61
62
  const n = typeof t == "string" ? (() => {
62
63
  try {
63
64
  return JSON.parse(t);
@@ -67,8 +68,8 @@ function h(t, e = 2) {
67
68
  })() : t ?? {}, r = Number(n.precision);
68
69
  return Number.isFinite(r) ? Math.min(Math.max(Math.trunc(r), 0), 10) : e;
69
70
  }
70
- function N(t, e) {
71
- const n = h(t);
71
+ function b(t, e) {
72
+ const n = p(t);
72
73
  return e === "currency" ? {
73
74
  style: "currency",
74
75
  currency: "USD",
@@ -76,16 +77,16 @@ function N(t, e) {
76
77
  maximumFractionDigits: n
77
78
  } : { maximumFractionDigits: n };
78
79
  }
79
- function b(t, e) {
80
+ function D(t, e) {
80
81
  if (e && e.length > 0 && e.length < 50) return e.length;
81
82
  if (!t || t === "—") return (e == null ? void 0 : e.length) ?? 0;
82
83
  const n = t.match(/\+(\d+) more$/);
83
84
  return n ? t.replace(/ \+\d+ more$/, "").split(", ").filter(Boolean).length + Number(n[1]) : t.split(", ").filter(Boolean).length;
84
85
  }
85
86
  export {
86
- b as countFromResolved,
87
- M as formatMultiValue,
88
- f as formatValue,
89
- N as numericIntlOptions,
90
- h as precisionOf
87
+ D as countFromResolved,
88
+ N as formatMultiValue,
89
+ h as formatValue,
90
+ b as numericIntlOptions,
91
+ p as precisionOf
91
92
  };
@@ -1,135 +1,137 @@
1
1
  import { clsx as d } from "clsx";
2
2
  import * as h from "lucide-react";
3
- import { twMerge as D } from "tailwind-merge";
4
- import { serverNow as N } from "./server-clock.js";
3
+ import { twMerge as N } from "tailwind-merge";
4
+ import { serverNow as D } from "./server-clock.js";
5
5
  function M(...t) {
6
- return D(d(t));
6
+ return N(d(t));
7
7
  }
8
- let a = null;
9
- function I(t) {
8
+ let u = null;
9
+ function b(t) {
10
10
  if (t)
11
11
  try {
12
12
  new Intl.DateTimeFormat("en-US", { timeZone: t });
13
13
  } catch {
14
14
  return;
15
15
  }
16
- a = t;
16
+ u = t;
17
17
  }
18
- function L() {
19
- return a;
18
+ function I() {
19
+ return u;
20
20
  }
21
21
  const g = /* @__PURE__ */ new Set(["1899-12-30", "1900-01-01"]);
22
22
  function m(t) {
23
23
  if (t == null || t === "") return !1;
24
- const e = t instanceof Date ? Number.isNaN(t.getTime()) ? "" : t.toISOString() : String(t);
25
- return g.has(e.slice(0, 10));
24
+ const n = t instanceof Date ? Number.isNaN(t.getTime()) ? "" : t.toISOString() : String(t);
25
+ return g.has(n.slice(0, 10));
26
26
  }
27
- function _(t, e) {
27
+ function _(t, n) {
28
28
  if (m(t)) return "";
29
- const n = typeof t == "string" ? t.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/) : null, r = n ? new Date(Number(n[1]), Number(n[2]) - 1, Number(n[3])) : new Date(t);
29
+ const e = typeof t == "string" ? t.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/) : null, r = e ? new Date(Number(e[1]), Number(e[2]) - 1, Number(e[3])) : new Date(t);
30
30
  return new Intl.DateTimeFormat("en-US", {
31
31
  month: "short",
32
32
  day: "numeric",
33
33
  year: "numeric",
34
34
  // Calendar-day values never shift zones; real timestamps follow the
35
35
  // user's preferred zone when one is set.
36
- ...n || !a ? {} : { timeZone: a },
37
- ...e
36
+ ...e || !u ? {} : { timeZone: u },
37
+ ...n
38
38
  }).format(r);
39
39
  }
40
- function b(t) {
40
+ function L(t) {
41
41
  if (m(t)) return "";
42
- const e = t instanceof Date ? null : String(t), n = e == null ? void 0 : e.match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00:00(?:\.0+)?(?:Z|[+-]00:?00)?)?$/), r = n ? new Date(Number(n[1]), Number(n[2]) - 1, Number(n[3])) : t instanceof Date ? t : new Date(String(t));
43
- return Number.isNaN(r.getTime()) ? String(t) : (n && r.setFullYear(Number(n[1])), r.toLocaleDateString());
42
+ const n = t instanceof Date ? null : String(t), e = n == null ? void 0 : n.match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00:00(?:\.0+)?(?:Z|[+-]00:?00)?)?$/), r = e ? new Date(Number(e[1]), Number(e[2]) - 1, Number(e[3])) : t instanceof Date ? t : new Date(String(t));
43
+ return Number.isNaN(r.getTime()) ? String(t) : (e && r.setFullYear(Number(e[1])), r.toLocaleDateString());
44
44
  }
45
45
  function S(t) {
46
- return new Intl.DateTimeFormat("en-US", {
47
- ...a ? { timeZone: a } : {},
46
+ if (t == null || t === "") return "";
47
+ const n = t instanceof Date ? t : new Date(t);
48
+ return Number.isNaN(n.getTime()) ? String(t) : new Intl.DateTimeFormat("en-US", {
49
+ ...u ? { timeZone: u } : {},
48
50
  month: "short",
49
51
  day: "numeric",
50
52
  year: "numeric",
51
53
  hour: "numeric",
52
54
  minute: "2-digit"
53
- }).format(new Date(t));
55
+ }).format(n);
54
56
  }
55
- let f = "relative", u = "en-US", l = !1;
57
+ let f = "relative", a = "en-US", s = !1;
56
58
  function x(t) {
57
59
  f = t === "exact" ? "exact" : "relative";
58
60
  }
59
61
  function U(t) {
60
62
  if (t != null && t.locale)
61
63
  try {
62
- new Intl.NumberFormat(t.locale), u = t.locale;
64
+ new Intl.NumberFormat(t.locale), a = t.locale;
63
65
  } catch {
64
66
  }
65
67
  else
66
- u = "en-US";
67
- l = (t == null ? void 0 : t.compact) === !0;
68
+ a = "en-US";
69
+ s = (t == null ? void 0 : t.compact) === !0;
68
70
  }
69
- function y(t, e) {
70
- const n = e.trim().toLowerCase();
71
- if (!n) return !0;
71
+ function y(t, n) {
72
+ const e = n.trim().toLowerCase();
73
+ if (!e) return !0;
72
74
  const r = t.toLowerCase();
73
- return n.split(/\s+/).every((o) => r.includes(o));
75
+ return e.split(/\s+/).every((i) => r.includes(i));
74
76
  }
75
77
  function E(t) {
76
78
  if (t == null || Number.isNaN(t)) return "—";
77
- const e = Math.max(0, t);
78
- if (e < 1) return `${Math.max(1, Math.round(e * 60))}m`;
79
- if (e < 48) return `${Math.round(e)}h`;
80
- const n = e / 24;
81
- if (n < 7) {
82
- const i = Math.floor(n), c = Math.round(e - i * 24);
83
- return c > 0 ? `${i}d ${c}h` : `${i}d`;
79
+ const n = Math.max(0, t);
80
+ if (n < 1) return `${Math.max(1, Math.round(n * 60))}m`;
81
+ if (n < 48) return `${Math.round(n)}h`;
82
+ const e = n / 24;
83
+ if (e < 7) {
84
+ const o = Math.floor(e), c = Math.round(n - o * 24);
85
+ return c > 0 ? `${o}d ${c}h` : `${o}d`;
84
86
  }
85
- if (n < 60) return `${Math.round(n)}d`;
86
- const r = Math.floor(n / 30), o = Math.round(n - r * 30);
87
- return o > 0 ? `${r}mo ${o}d` : `${r}mo`;
87
+ if (e < 60) return `${Math.round(e)}d`;
88
+ const r = Math.floor(e / 30), i = Math.round(e - r * 30);
89
+ return i > 0 ? `${r}mo ${i}d` : `${r}mo`;
88
90
  }
89
91
  function C(t) {
90
92
  if (f === "exact") return S(t);
91
- const e = new Date(t), n = N() - e.getTime(), r = Math.floor(n / 6e4);
93
+ const n = new Date(t), e = D() - n.getTime(), r = Math.floor(e / 6e4);
92
94
  if (r < 1) return "just now";
93
95
  if (r < 60) return `${r}m ago`;
94
- const o = Math.floor(r / 60);
95
- if (o < 24) return `${o}h ago`;
96
- const i = Math.floor(o / 24);
97
- return i < 7 ? `${i}d ago` : _(e);
96
+ const i = Math.floor(r / 60);
97
+ if (i < 24) return `${i}h ago`;
98
+ const o = Math.floor(i / 24);
99
+ return o < 7 ? `${o}d ago` : _(n);
98
100
  }
99
101
  function T(t) {
100
- return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
102
+ return t.replace(/_/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
101
103
  }
102
- const s = {
104
+ const l = {
103
105
  _and: [
104
106
  { is_redacted: { _eq: !1 } },
105
107
  { _or: [{ status: { _neq: "suspended" } }, { status: { _null: !0 } }] }
106
108
  ]
107
109
  }, $ = {
108
- _and: [...s._and, { account_kind: { _null: !0 } }]
110
+ _and: [...l._and, { account_kind: { _null: !0 } }]
109
111
  };
110
112
  function O(t) {
111
- return t ? s : $;
113
+ return t ? l : $;
112
114
  }
113
115
  function A(t) {
114
- const e = String(t ?? "");
115
- return e.startsWith("$t:") ? T(e.slice(3).replace(/-/g, "_")) : e;
116
+ const n = String(t ?? "");
117
+ return n.startsWith("$t:") ? T(n.slice(3).replace(/-/g, "_")) : n;
116
118
  }
117
119
  function R(t) {
118
- return t == null ? "—" : l && Math.abs(t) >= 1e4 ? new Intl.NumberFormat(u, {
120
+ return t == null ? "—" : s && Math.abs(t) >= 1e4 ? new Intl.NumberFormat(a, {
119
121
  notation: "compact",
120
122
  maximumFractionDigits: 1
121
- }).format(t) : t.toLocaleString(u);
123
+ }).format(t) : t.toLocaleString(a);
122
124
  }
123
125
  function Z(t) {
124
126
  return t == null ? "—" : t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : t < 1024 * 1024 * 1024 ? `${(t / (1024 * 1024)).toFixed(1)} MB` : `${(t / (1024 * 1024 * 1024)).toFixed(2)} GB`;
125
127
  }
126
128
  function B(t) {
127
129
  if (!t) return null;
128
- const e = t.split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("");
129
- return h[e];
130
+ const n = t.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
131
+ return h[n];
130
132
  }
131
133
  export {
132
- s as ACTIVE_USER_OPTION_FILTER,
134
+ l as ACTIVE_USER_OPTION_FILTER,
133
135
  $ as PEOPLE_USER_OPTION_FILTER,
134
136
  A as choiceLabel,
135
137
  M as cn,
@@ -138,15 +140,15 @@ export {
138
140
  Z as formatFileSize,
139
141
  R as formatNumber,
140
142
  C as formatRelative,
141
- L as getDisplayTimezone,
143
+ I as getDisplayTimezone,
142
144
  E as humanHours,
143
145
  m as isNullDate,
144
146
  y as matchesAllTokens,
145
147
  B as resolveCollectionIcon,
146
- I as setDisplayTimezone,
148
+ b as setDisplayTimezone,
147
149
  U as setNumberFormat,
148
150
  x as setTimeDisplay,
149
151
  T as titleCase,
150
- b as toLocalDateString,
152
+ L as toLocalDateString,
151
153
  O as userOptionFilter
152
154
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.66",
3
+ "version": "0.3.67",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",