@nivaro/react 0.3.67 → 0.3.69

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 (32) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +7 -0
  4. package/dist/index.js +836 -835
  5. package/dist/shared/components/ConformanceView.js +34 -34
  6. package/dist/shared/components/ReportView.js +196 -196
  7. package/dist/shared/components/SlaRulesView.js +36 -36
  8. package/dist/shared/components/chat/ChatPanel.js +484 -487
  9. package/dist/shared/components/chat/ChatViews.js +66 -66
  10. package/dist/shared/components/chat/RoomParts.js +159 -157
  11. package/dist/shared/components/help-videos/editor/StatsTab.js +48 -47
  12. package/dist/shared/components/help-videos/editor/VersionsTab.js +17 -16
  13. package/dist/shared/components/imports/CollectionImportPanel.js +72 -72
  14. package/dist/shared/components/item-edit/FieldRenderer.js +186 -182
  15. package/dist/shared/components/item-edit/FieldRow.js +87 -87
  16. package/dist/shared/components/item-edit/FileDownloadCount.js +94 -0
  17. package/dist/shared/components/item-edit/FilePickerField.js +350 -349
  18. package/dist/shared/components/item-edit/RecordInsights.js +90 -91
  19. package/dist/shared/components/item-edit/SummaryPanel.js +31 -31
  20. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +12 -12
  21. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +175 -138
  22. package/dist/shared/components/layout-editor/inspector/RulesTab.js +53 -52
  23. package/dist/shared/components/panels/AddendumPanel.js +409 -411
  24. package/dist/shared/components/panels/CommentPanel.js +169 -162
  25. package/dist/shared/components/panels/PipelinePanel.js +75 -75
  26. package/dist/shared/components/panels/RevisionsPanel.js +103 -103
  27. package/dist/shared/components/queue/QueueWorklist.js +142 -141
  28. package/dist/shared/lib/activity-sentence.js +154 -144
  29. package/dist/shared/lib/format-value.js +15 -15
  30. package/dist/shared/lib/placement-behaviour.js +39 -31
  31. package/dist/shared/lib/utils.js +58 -53
  32. package/package.json +1 -1
@@ -1,5 +1,5 @@
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"]);
1
+ import { formatDateTime as s, toLocalDateString as a, formatRelative as m } from "./utils.js";
2
+ const c = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], l = /* @__PURE__ */ new Set(["true", "1", "yes", "y"]), h = /* @__PURE__ */ new Set(["false", "0", "no", "n"]);
3
3
  function u(t) {
4
4
  return String(t).padStart(2, "0");
5
5
  }
@@ -12,7 +12,7 @@ function f(t, e) {
12
12
  case "YY":
13
13
  return String(r.getFullYear()).slice(-2);
14
14
  case "MMM":
15
- return a[r.getMonth()];
15
+ return c[r.getMonth()];
16
16
  case "MM":
17
17
  return u(r.getMonth() + 1);
18
18
  case "DD":
@@ -36,10 +36,10 @@ function f(t, e) {
36
36
  }
37
37
  });
38
38
  }
39
- function h(t, e) {
39
+ function p(t, e) {
40
40
  if (e.type === "count") return t;
41
41
  if (e.type === "datetime")
42
- return e.template !== "relative" && /h|H/.test(e.template) ? s(t) || t : f(t, e.template);
42
+ return e.template !== "relative" && /h|H/.test(e.template) ? s(t) || t : e.template !== "relative" && /D/.test(e.template) && /M/.test(e.template) && /Y/.test(e.template) ? a(t) || t : f(t, e.template);
43
43
  if (e.type === "number") {
44
44
  const r = Number(t);
45
45
  if (Number.isNaN(r) || t.trim() === "") return t;
@@ -51,14 +51,14 @@ function h(t, e) {
51
51
  return `${e.prefix ?? ""}${i}${e.suffix ?? ""}`;
52
52
  }
53
53
  const n = t.trim().toLowerCase();
54
- return c.has(n) ? e.true_label : l.has(n) ? e.false_label : t;
54
+ return l.has(n) ? e.true_label : h.has(n) ? e.false_label : t;
55
55
  }
56
56
  function N(t, e) {
57
57
  if (!t) return t;
58
58
  const n = t.match(/ \+\d+ more$/), r = n ? n[0] : "";
59
- return (r ? t.slice(0, -r.length) : t).split(", ").map((o) => h(o, e)).join(", ") + r;
59
+ return (r ? t.slice(0, -r.length) : t).split(", ").map((o) => p(o, e)).join(", ") + r;
60
60
  }
61
- function p(t, e = 2) {
61
+ function M(t, e = 2) {
62
62
  const n = typeof t == "string" ? (() => {
63
63
  try {
64
64
  return JSON.parse(t);
@@ -68,8 +68,8 @@ function p(t, e = 2) {
68
68
  })() : t ?? {}, r = Number(n.precision);
69
69
  return Number.isFinite(r) ? Math.min(Math.max(Math.trunc(r), 0), 10) : e;
70
70
  }
71
- function b(t, e) {
72
- const n = p(t);
71
+ function Y(t, e) {
72
+ const n = M(t);
73
73
  return e === "currency" ? {
74
74
  style: "currency",
75
75
  currency: "USD",
@@ -77,16 +77,16 @@ function b(t, e) {
77
77
  maximumFractionDigits: n
78
78
  } : { maximumFractionDigits: n };
79
79
  }
80
- function D(t, e) {
80
+ function b(t, e) {
81
81
  if (e && e.length > 0 && e.length < 50) return e.length;
82
82
  if (!t || t === "—") return (e == null ? void 0 : e.length) ?? 0;
83
83
  const n = t.match(/\+(\d+) more$/);
84
84
  return n ? t.replace(/ \+\d+ more$/, "").split(", ").filter(Boolean).length + Number(n[1]) : t.split(", ").filter(Boolean).length;
85
85
  }
86
86
  export {
87
- D as countFromResolved,
87
+ b as countFromResolved,
88
88
  N as formatMultiValue,
89
- h as formatValue,
90
- b as numericIntlOptions,
91
- p as precisionOf
89
+ p as formatValue,
90
+ Y as numericIntlOptions,
91
+ M as precisionOf
92
92
  };
@@ -1,4 +1,4 @@
1
- function c(t) {
1
+ function o(t) {
2
2
  if (typeof t == "string")
3
3
  try {
4
4
  const e = JSON.parse(t);
@@ -10,17 +10,17 @@ function c(t) {
10
10
  }
11
11
  const u = (t) => Array.isArray(t) ? t.filter((e) => typeof e == "string" && e !== "") : [], f = (t) => typeof t == "string" && t.trim() !== "" ? t : void 0;
12
12
  function y(t) {
13
- const e = c(t).text_rules;
13
+ const e = o(t).text_rules;
14
14
  if (!Array.isArray(e)) return [];
15
15
  const r = [];
16
16
  for (const n of e) {
17
17
  if (!n || typeof n != "object") continue;
18
- const i = n, s = i.type === "role" ? "role" : i.type === "pipeline_state" ? "pipeline_state" : null;
19
- if (!s) continue;
20
- const o = { type: s };
21
- typeof i.pipeline_id == "string" && i.pipeline_id && (o.pipeline_id = i.pipeline_id), s === "pipeline_state" ? o.state_keys = u(i.state_keys) : o.role_ids = u(i.role_ids);
18
+ const i = n, c = i.type === "role" ? "role" : i.type === "pipeline_state" ? "pipeline_state" : null;
19
+ if (!c) continue;
20
+ const s = { type: c };
21
+ typeof i.pipeline_id == "string" && i.pipeline_id && (s.pipeline_id = i.pipeline_id), c === "pipeline_state" ? s.state_keys = u(i.state_keys) : s.role_ids = u(i.role_ids);
22
22
  const l = f(i.label), a = f(i.note);
23
- l !== void 0 && (o.label = l), a !== void 0 && (o.note = a), r.push(o);
23
+ l !== void 0 && (s.label = l), a !== void 0 && (s.note = a), r.push(s);
24
24
  }
25
25
  return r;
26
26
  }
@@ -39,24 +39,30 @@ function h(t, e) {
39
39
  break;
40
40
  return r;
41
41
  }
42
- function k(t) {
43
- const e = c(t);
42
+ function F(t) {
43
+ const e = o(t);
44
44
  return e.recommended === !0 && e.required !== !0;
45
45
  }
46
- function F(t) {
46
+ function U(t) {
47
47
  return t == null || t === "" ? !0 : Array.isArray(t) ? t.length === 0 : typeof t == "string" && t.trim() === "";
48
48
  }
49
49
  function m(t) {
50
- const e = c(t).confirm_change;
50
+ const e = o(t).confirm_change;
51
51
  return e === !0 ? { state_keys: [] } : !e || typeof e != "object" || Array.isArray(e) ? null : { state_keys: u(e.state_keys) };
52
52
  }
53
- function U(t, e) {
53
+ function k(t, e) {
54
54
  const r = m(t);
55
55
  return r ? r.state_keys.length === 0 ? !0 : !!e && r.state_keys.includes(e) : !1;
56
56
  }
57
+ function w(t) {
58
+ return o(t).file_used_in !== !1;
59
+ }
60
+ function D(t) {
61
+ return o(t).file_downloads !== !1;
62
+ }
57
63
  const d = 1e6;
58
- function g(t) {
59
- const e = c(t).counter;
64
+ function _(t) {
65
+ const e = o(t).counter;
60
66
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
61
67
  const r = e, n = Number(r.limit);
62
68
  return {
@@ -64,13 +70,13 @@ function g(t) {
64
70
  limit: r.limit != null && r.limit !== "" && Number.isFinite(n) && n > 0 ? Math.min(d, Math.floor(n)) : null
65
71
  };
66
72
  }
67
- function _(t) {
73
+ function g(t) {
68
74
  if (t == null) return "";
69
75
  const e = typeof t == "string" ? t : typeof t == "object" ? JSON.stringify(t) : String(t);
70
76
  return /<[a-z!/][^>]*>/i.test(e) ? e.replace(/<(br|\/p|\/div|\/li|\/h[1-6])\b[^>]*>/gi, " ").replace(/<[^>]*>/g, "").replace(/&nbsp;/g, " ").replace(/&(amp|lt|gt|quot|#39);/g, "x") : e;
71
77
  }
72
78
  function b(t, e) {
73
- const r = _(t);
79
+ const r = g(t);
74
80
  if (e === "words") {
75
81
  const n = r.trim();
76
82
  return n ? n.split(/\s+/).length : 0;
@@ -81,16 +87,16 @@ function L(t, e) {
81
87
  return e == null ? "ok" : t > e ? "over" : t >= e * 0.9 ? "near" : "ok";
82
88
  }
83
89
  function x(t, e, r) {
84
- const n = g(e);
90
+ const n = _(e);
85
91
  if (!n || n.limit == null) return null;
86
92
  const i = b(t, n.unit);
87
93
  return i <= n.limit ? null : `${r} is over its limit of ${n.limit.toLocaleString("en-US")} ${n.unit} (${i.toLocaleString("en-US")})`;
88
94
  }
89
95
  const S = /^__calc_[a-z0-9_]{1,40}__$/;
90
- function D(t) {
96
+ function O(t) {
91
97
  return S.test(t);
92
98
  }
93
- function w(t) {
99
+ function j(t) {
94
100
  const e = new Set(t);
95
101
  for (let r = 1; ; r++) {
96
102
  const n = `__calc_${r}__`;
@@ -98,13 +104,13 @@ function w(t) {
98
104
  }
99
105
  }
100
106
  const A = ["", "integer", "number", "currency", "percent"];
101
- function O(t) {
102
- const e = c(t).display_formula;
107
+ function $(t) {
108
+ const e = o(t).display_formula;
103
109
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
104
110
  const r = e, n = A.includes(r.format) ? r.format : "", i = typeof r.currency == "string" && /^[A-Z]{3}$/.test(r.currency) ? r.currency : null;
105
111
  return { expr: typeof r.expr == "string" ? r.expr : "", format: n, currency: i };
106
112
  }
107
- function j(t, e) {
113
+ function M(t, e) {
108
114
  if (t == null || !Number.isFinite(t)) return "—";
109
115
  switch (e.format) {
110
116
  case "integer":
@@ -125,20 +131,22 @@ function j(t, e) {
125
131
  }
126
132
  export {
127
133
  d as COUNTER_LIMIT_MAX,
128
- U as confirmChangeApplies,
134
+ k as confirmChangeApplies,
129
135
  m as confirmChangeOf,
130
136
  b as countValue,
131
137
  x as counterError,
132
- g as counterOf,
138
+ _ as counterOf,
133
139
  L as counterState,
134
- O as displayFormulaOf,
135
- j as formatDisplayValue,
136
- D as isDisplayFormulaField,
137
- F as isEmptyValue,
138
- k as isRecommended,
139
- w as nextDisplayFormulaField,
140
- c as overridesObject,
140
+ $ as displayFormulaOf,
141
+ M as formatDisplayValue,
142
+ O as isDisplayFormulaField,
143
+ U as isEmptyValue,
144
+ F as isRecommended,
145
+ j as nextDisplayFormulaField,
146
+ o as overridesObject,
141
147
  h as resolvePlacementText,
148
+ D as showsFileDownloads,
149
+ w as showsFileUsage,
142
150
  p as textRuleMatches,
143
151
  y as textRulesOf
144
152
  };
@@ -1,31 +1,31 @@
1
- import { clsx as d } from "clsx";
2
- import * as h from "lucide-react";
3
- import { twMerge as N } from "tailwind-merge";
4
- import { serverNow as D } from "./server-clock.js";
5
- function M(...t) {
6
- return N(d(t));
7
- }
8
- let u = null;
9
- function b(t) {
1
+ import { clsx as h } from "clsx";
2
+ import * as N from "lucide-react";
3
+ import { twMerge as D } from "tailwind-merge";
4
+ import { serverNow as g } from "./server-clock.js";
5
+ function F(...t) {
6
+ return D(h(t));
7
+ }
8
+ let o = null;
9
+ function M(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
- u = t;
16
+ o = t;
17
17
  }
18
18
  function I() {
19
- return u;
19
+ return o;
20
20
  }
21
- const g = /* @__PURE__ */ new Set(["1899-12-30", "1900-01-01"]);
22
- function m(t) {
21
+ const _ = /* @__PURE__ */ new Set(["1899-12-30", "1900-01-01"]);
22
+ function f(t) {
23
23
  if (t == null || t === "") return !1;
24
24
  const n = t instanceof Date ? Number.isNaN(t.getTime()) ? "" : t.toISOString() : String(t);
25
- return g.has(n.slice(0, 10));
25
+ return _.has(n.slice(0, 10));
26
26
  }
27
- function _(t, n) {
28
- if (m(t)) return "";
27
+ function b(t, n) {
28
+ if (f(t)) return "";
29
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",
@@ -33,20 +33,25 @@ function _(t, n) {
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
- ...e || !u ? {} : { timeZone: u },
36
+ ...e || !o ? {} : { timeZone: o },
37
37
  ...n
38
38
  }).format(r);
39
39
  }
40
40
  function L(t) {
41
- if (m(t)) return "";
41
+ if (f(t)) return "";
42
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());
43
+ return Number.isNaN(r.getTime()) ? String(t) : (e && r.setFullYear(Number(e[1])), new Intl.DateTimeFormat("en-US", {
44
+ month: "short",
45
+ day: "numeric",
46
+ year: "numeric",
47
+ ...e || !o ? {} : { timeZone: o }
48
+ }).format(r));
44
49
  }
45
- function S(t) {
50
+ function m(t) {
46
51
  if (t == null || t === "") return "";
47
52
  const n = t instanceof Date ? t : new Date(t);
48
53
  return Number.isNaN(n.getTime()) ? String(t) : new Intl.DateTimeFormat("en-US", {
49
- ...u ? { timeZone: u } : {},
54
+ ...o ? { timeZone: o } : {},
50
55
  month: "short",
51
56
  day: "numeric",
52
57
  year: "numeric",
@@ -54,11 +59,11 @@ function S(t) {
54
59
  minute: "2-digit"
55
60
  }).format(n);
56
61
  }
57
- let f = "relative", a = "en-US", s = !1;
62
+ let s = "relative", a = "en-US", l = !1;
58
63
  function x(t) {
59
- f = t === "exact" ? "exact" : "relative";
64
+ s = t === "exact" ? "exact" : "relative";
60
65
  }
61
- function U(t) {
66
+ function y(t) {
62
67
  if (t != null && t.locale)
63
68
  try {
64
69
  new Intl.NumberFormat(t.locale), a = t.locale;
@@ -66,9 +71,9 @@ function U(t) {
66
71
  }
67
72
  else
68
73
  a = "en-US";
69
- s = (t == null ? void 0 : t.compact) === !0;
74
+ l = (t == null ? void 0 : t.compact) === !0;
70
75
  }
71
- function y(t, n) {
76
+ function U(t, n) {
72
77
  const e = n.trim().toLowerCase();
73
78
  if (!e) return !0;
74
79
  const r = t.toLowerCase();
@@ -81,72 +86,72 @@ function E(t) {
81
86
  if (n < 48) return `${Math.round(n)}h`;
82
87
  const e = n / 24;
83
88
  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`;
89
+ const u = Math.floor(e), c = Math.round(n - u * 24);
90
+ return c > 0 ? `${u}d ${c}h` : `${u}d`;
86
91
  }
87
92
  if (e < 60) return `${Math.round(e)}d`;
88
93
  const r = Math.floor(e / 30), i = Math.round(e - r * 30);
89
94
  return i > 0 ? `${r}mo ${i}d` : `${r}mo`;
90
95
  }
91
96
  function C(t) {
92
- if (f === "exact") return S(t);
93
- const n = new Date(t), e = D() - n.getTime(), r = Math.floor(e / 6e4);
97
+ if (s === "exact") return m(t);
98
+ const n = new Date(t), e = g() - n.getTime(), r = Math.floor(e / 6e4);
94
99
  if (r < 1) return "just now";
95
100
  if (r < 60) return `${r}m ago`;
96
101
  const i = Math.floor(r / 60);
97
102
  if (i < 24) return `${i}h ago`;
98
- const o = Math.floor(i / 24);
99
- return o < 7 ? `${o}d ago` : _(n);
103
+ const u = Math.floor(i / 24);
104
+ return u < 7 ? `${u}d ago` : m(n);
100
105
  }
101
106
  function T(t) {
102
107
  return t.replace(/_/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
103
108
  }
104
- const l = {
109
+ const d = {
105
110
  _and: [
106
111
  { is_redacted: { _eq: !1 } },
107
112
  { _or: [{ status: { _neq: "suspended" } }, { status: { _null: !0 } }] }
108
113
  ]
109
- }, $ = {
110
- _and: [...l._and, { account_kind: { _null: !0 } }]
114
+ }, S = {
115
+ _and: [...d._and, { account_kind: { _null: !0 } }]
111
116
  };
112
117
  function O(t) {
113
- return t ? l : $;
118
+ return t ? d : S;
114
119
  }
115
- function A(t) {
120
+ function Z(t) {
116
121
  const n = String(t ?? "");
117
122
  return n.startsWith("$t:") ? T(n.slice(3).replace(/-/g, "_")) : n;
118
123
  }
119
- function R(t) {
120
- return t == null ? "—" : s && Math.abs(t) >= 1e4 ? new Intl.NumberFormat(a, {
124
+ function A(t) {
125
+ return t == null ? "—" : l && Math.abs(t) >= 1e4 ? new Intl.NumberFormat(a, {
121
126
  notation: "compact",
122
127
  maximumFractionDigits: 1
123
128
  }).format(t) : t.toLocaleString(a);
124
129
  }
125
- function Z(t) {
130
+ function R(t) {
126
131
  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`;
127
132
  }
128
133
  function B(t) {
129
134
  if (!t) return null;
130
135
  const n = t.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
131
- return h[n];
136
+ return N[n];
132
137
  }
133
138
  export {
134
- l as ACTIVE_USER_OPTION_FILTER,
135
- $ as PEOPLE_USER_OPTION_FILTER,
136
- A as choiceLabel,
137
- M as cn,
138
- _ as formatDate,
139
- S as formatDateTime,
140
- Z as formatFileSize,
141
- R as formatNumber,
139
+ d as ACTIVE_USER_OPTION_FILTER,
140
+ S as PEOPLE_USER_OPTION_FILTER,
141
+ Z as choiceLabel,
142
+ F as cn,
143
+ b as formatDate,
144
+ m as formatDateTime,
145
+ R as formatFileSize,
146
+ A as formatNumber,
142
147
  C as formatRelative,
143
148
  I as getDisplayTimezone,
144
149
  E as humanHours,
145
- m as isNullDate,
146
- y as matchesAllTokens,
150
+ f as isNullDate,
151
+ U as matchesAllTokens,
147
152
  B as resolveCollectionIcon,
148
- b as setDisplayTimezone,
149
- U as setNumberFormat,
153
+ M as setDisplayTimezone,
154
+ y as setNumberFormat,
150
155
  x as setTimeDisplay,
151
156
  T as titleCase,
152
157
  L as toLocalDateString,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.67",
3
+ "version": "0.3.69",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",