@nivaro/react 0.3.115 → 0.3.117

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 (29) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +15 -1
  4. package/dist/shared/components/CollectionBrowserView.js +3815 -3576
  5. package/dist/shared/components/DataTable.js +611 -551
  6. package/dist/shared/components/OverflowRail.js +326 -0
  7. package/dist/shared/components/ReportView.js +1086 -1091
  8. package/dist/shared/components/TipLayer.js +8 -8
  9. package/dist/shared/components/cbv/column-totals.js +62 -57
  10. package/dist/shared/components/charts/category-axis.js +93 -0
  11. package/dist/shared/components/integrations/console/SignalCard.js +84 -77
  12. package/dist/shared/components/list/PhonePager.js +50 -0
  13. package/dist/shared/components/notifications/NotificationCenterView.js +67 -68
  14. package/dist/shared/components/pipeline/BindingStartStateSettings.js +163 -0
  15. package/dist/shared/components/pipeline/PipelineEditorView.js +1515 -1475
  16. package/dist/shared/components/queue/OwnerAvatars.js +9 -9
  17. package/dist/shared/components/queue/QueueWorklist.js +2016 -1851
  18. package/dist/shared/components/queue/worklist-helpers.js +10 -6
  19. package/dist/shared/components/ui/popover.js +53 -29
  20. package/dist/shared/lib/keep-row-focus.js +43 -0
  21. package/dist/shared/lib/obligation-banner.js +17 -17
  22. package/dist/shared/lib/rail-menu-context.js +9 -0
  23. package/dist/shared/lib/row-surface.js +7 -0
  24. package/dist/shared/lib/table-pins.js +20 -18
  25. package/dist/shared/lib/upload-file.js +48 -19
  26. package/dist/shared/lib/upload-presence.js +33 -33
  27. package/dist/shared/lib/use-below-md.js +29 -0
  28. package/dist/shared/lib/use-query-entry.js +17 -0
  29. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  import { jsx as L } from "react/jsx-runtime";
2
2
  import { useState as x, useRef as y, useEffect as b, useLayoutEffect as E } from "react";
3
3
  import { createPortal as M } from "react-dom";
4
- const a = [], O = '[data-nvr-header-menu-panel], [role="menu"]', g = 6;
4
+ const l = [], O = '[data-nvr-header-menu-panel], [role="menu"], [data-rail-menu]', g = 6;
5
5
  function W() {
6
- const [t, h] = x(null), [r, l] = x(!1), p = y(null);
7
- return b(() => (a.push(l), a[0] === l && l(!0), () => {
6
+ const [t, h] = x(null), [r, a] = x(!1), p = y(null);
7
+ return b(() => (l.push(a), l[0] === a && a(!0), () => {
8
8
  var e;
9
- const c = a.indexOf(l);
10
- c < 0 || (a.splice(c, 1), c === 0 && ((e = a[0]) == null || e.call(a, !0)));
9
+ const c = l.indexOf(a);
10
+ c < 0 || (l.splice(c, 1), c === 0 && ((e = l[0]) == null || e.call(l, !0)));
11
11
  }), []), b(() => {
12
12
  if (!r) return;
13
13
  const c = (n) => {
@@ -82,11 +82,11 @@ function T(t) {
82
82
  return E(() => {
83
83
  const r = h.current;
84
84
  if (!r) return;
85
- const l = () => {
85
+ const a = () => {
86
86
  (r.scrollWidth > r.clientWidth + 1 || r.scrollHeight > r.clientHeight + 1) && t ? r.setAttribute("data-tip", t) : r.removeAttribute("data-tip");
87
87
  };
88
- if (l(), typeof ResizeObserver > "u") return;
89
- const p = new ResizeObserver(l);
88
+ if (a(), typeof ResizeObserver > "u") return;
89
+ const p = new ResizeObserver(a);
90
90
  return p.observe(r), () => p.disconnect();
91
91
  }, [t]), h;
92
92
  }
@@ -1,4 +1,4 @@
1
- import { formatValue as S } from "../../lib/format-value.js";
1
+ import { formatValue as b } from "../../lib/format-value.js";
2
2
  const g = [
3
3
  { fn: "sum", label: "Sum", short: "Sum" },
4
4
  { fn: "avg", label: "Average", short: "Avg" },
@@ -6,63 +6,68 @@ const g = [
6
6
  { fn: "max", label: "Maximum", short: "Max" },
7
7
  { fn: "count", label: "Count (filled in)", short: "Count" }
8
8
  ];
9
- function b(e) {
9
+ function S(e) {
10
10
  return typeof e == "string" && g.some((n) => n.fn === e);
11
11
  }
12
12
  function v(e) {
13
13
  return /^[A-Za-z_][A-Za-z0-9_]*$/.test(e);
14
14
  }
15
- function w(e, n, t) {
15
+ function w(e, n) {
16
+ const t = /* @__PURE__ */ new Map();
17
+ for (const r of e) {
18
+ const o = t.get(r.fn) ?? [];
19
+ o.includes(r.key) || o.push(r.key), t.set(r.fn, o);
20
+ }
16
21
  return {
17
- [n]: e,
18
- ...t.search ? { search: t.search } : {},
19
- ...t.conditions ? { conditions: t.conditions } : {}
22
+ ...Object.fromEntries([...t].map(([r, o]) => [r, o.join(",")])),
23
+ ...n.search ? { search: n.search } : {},
24
+ ...n.conditions ? { conditions: n.conditions } : {}
20
25
  };
21
26
  }
22
- function M(e, n, t) {
23
- var i, l, c;
24
- const r = (c = (l = (i = e == null ? void 0 : e.data) == null ? void 0 : i[0]) == null ? void 0 : l[t]) == null ? void 0 : c[n];
27
+ function x(e, n, t) {
28
+ var s, l, c;
29
+ const r = (c = (l = (s = e == null ? void 0 : e.data) == null ? void 0 : s[0]) == null ? void 0 : l[t]) == null ? void 0 : c[n];
25
30
  if (r == null || r === "") return null;
26
31
  const o = Number(r);
27
32
  return Number.isFinite(o) ? o : null;
28
33
  }
29
- function $(e, n, t) {
30
- return n === "count" ? Math.round(e).toLocaleString("en-US") : (t == null ? void 0 : t.type) === "number" ? S(String(e), t) : (Math.round(e * 100) / 100).toLocaleString("en-US", { maximumFractionDigits: 2 });
34
+ function M(e, n, t) {
35
+ return n === "count" ? Math.round(e).toLocaleString("en-US") : (t == null ? void 0 : t.type) === "number" ? b(String(e), t) : (Math.round(e * 100) / 100).toLocaleString("en-US", { maximumFractionDigits: 2 });
31
36
  }
32
- const p = (e) => `nvr_cbv_totals_${e}`, _ = (e) => e === "off" || b(e);
33
- function k(e) {
34
- return y(p(e), v);
37
+ const p = (e) => `nvr_cbv_totals_${e}`, y = (e) => e === "off" || S(e);
38
+ function $(e) {
39
+ return _(p(e), v);
35
40
  }
36
- function z(e, n) {
37
- T(p(e), n);
41
+ function j(e, n) {
42
+ O(p(e), n);
38
43
  }
39
- function y(e, n) {
44
+ function _(e, n) {
40
45
  try {
41
46
  const t = localStorage.getItem(e), r = t ? JSON.parse(t) : null;
42
47
  if (!r || typeof r != "object") return {};
43
- const o = r.v === 2 && r.o && typeof r.o == "object" ? r.o : r, i = {};
44
- for (const [l, c] of Object.entries(o)) n(l) && _(c) && (i[l] = c);
45
- return i;
48
+ const o = r.v === 2 && r.o && typeof r.o == "object" ? r.o : r, s = {};
49
+ for (const [l, c] of Object.entries(o)) n(l) && y(c) && (s[l] = c);
50
+ return s;
46
51
  } catch {
47
52
  return {};
48
53
  }
49
54
  }
50
- function T(e, n) {
55
+ function O(e, n) {
51
56
  try {
52
57
  Object.keys(n).length === 0 ? localStorage.removeItem(e) : localStorage.setItem(e, JSON.stringify({ v: 2, o: n }));
53
58
  } catch {
54
59
  }
55
60
  }
56
- function j(e, n) {
61
+ function z(e, n) {
57
62
  const t = { ...e };
58
63
  for (const [r, o] of Object.entries(n))
59
64
  o === "off" ? delete t[r] : t[r] = o;
60
65
  return t;
61
66
  }
62
- function N(e, n, t) {
67
+ function F(e, n, t) {
63
68
  return { ...e, [n]: t ?? "off" };
64
69
  }
65
- function Z(e, n) {
70
+ function N(e, n) {
66
71
  const t = {};
67
72
  for (const [r, o] of Object.entries(e))
68
73
  (o === "off" ? !n[r] : n[r] === o) || (t[r] = o);
@@ -71,8 +76,8 @@ function Z(e, n) {
71
76
  function h(e) {
72
77
  return !e.computed_formula || !!e.computed_store;
73
78
  }
74
- const A = /* @__PURE__ */ new Set(["integer", "bigInteger", "biginteger", "decimal", "float"]);
75
- function O(e) {
79
+ const T = /* @__PURE__ */ new Set(["integer", "bigInteger", "biginteger", "decimal", "float"]);
80
+ function A(e) {
76
81
  const n = String(e ?? "").trim();
77
82
  if (!n) return null;
78
83
  let t = 0;
@@ -80,9 +85,9 @@ function O(e) {
80
85
  for (; t < n.length && /\s/.test(n[t]); ) t++;
81
86
  }, o = () => {
82
87
  r();
83
- const a = n.slice(t), s = /^item\.([A-Za-z_][A-Za-z0-9_]*)/.exec(a);
84
- if (s)
85
- return t += s[0].length, s[1];
88
+ const a = n.slice(t), i = /^item\.([A-Za-z_][A-Za-z0-9_]*)/.exec(a);
89
+ if (i)
90
+ return t += i[0].length, i[1];
86
91
  const u = /^\{\{\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\}\}/.exec(a);
87
92
  if (u)
88
93
  return t += u[0].length, u[1];
@@ -93,21 +98,21 @@ function O(e) {
93
98
  return !d || !m ? null : (t += m[0].length, d);
94
99
  }
95
100
  return null;
96
- }, i = /* @__PURE__ */ new Map(), l = (a) => {
97
- let s = !0;
101
+ }, s = /* @__PURE__ */ new Map(), l = (a) => {
102
+ let i = !0;
98
103
  for (; ; ) {
99
104
  r();
100
105
  let u = a;
101
106
  if (n[t] === "+" || n[t] === "-")
102
107
  n[t] === "-" && (u = u === 1 ? -1 : 1), t++, r();
103
- else if (!s) return !1;
104
- if (s = !1, n[t] === "(") {
108
+ else if (!i) return !1;
109
+ if (i = !1, n[t] === "(") {
105
110
  if (t++, !l(u) || (r(), n[t] !== ")")) return !1;
106
111
  t++;
107
112
  } else {
108
113
  const f = o();
109
114
  if (!f) return !1;
110
- i.set(f, (i.get(f) ?? 0) + u);
115
+ s.set(f, (s.get(f) ?? 0) + u);
111
116
  }
112
117
  if (r(), t >= n.length || n[t] === ")") return !0;
113
118
  if (n[t] !== "+" && n[t] !== "-") return !1;
@@ -115,18 +120,18 @@ function O(e) {
115
120
  };
116
121
  if (!l(1) || (r(), t !== n.length)) return null;
117
122
  const c = [];
118
- for (const [a, s] of i)
119
- if (s === 1 || s === -1) c.push({ field: a, sign: s });
120
- else if (s !== 0) return null;
123
+ for (const [a, i] of s)
124
+ if (i === 1 || i === -1) c.push({ field: a, sign: i });
125
+ else if (i !== 0) return null;
121
126
  return c.length ? c : null;
122
127
  }
123
- function C(e, n) {
128
+ function Z(e, n) {
124
129
  if (h(e)) return { kind: "server" };
125
130
  if (e.computed_type !== "rollup") {
126
- const t = O(e.computed_formula ?? "");
131
+ const t = A(e.computed_formula ?? "");
127
132
  if (t != null && t.every((r) => {
128
133
  const o = n(r.field);
129
- return !!o && h(o) && A.has(String(o.type ?? ""));
134
+ return !!o && h(o) && T.has(String(o.type ?? ""));
130
135
  }))
131
136
  return { kind: "derived", terms: t };
132
137
  }
@@ -135,7 +140,7 @@ function C(e, n) {
135
140
  why: e.computed_type === "rollup" ? "Worked out from linked records each time the list is read, so it has no total." : "Calculated each time the list is read from a formula that does more than add and subtract stored columns, so it has no total."
136
141
  };
137
142
  }
138
- function F(e, n) {
143
+ function C(e, n) {
139
144
  let t = 0;
140
145
  for (const r of e) {
141
146
  const o = n(r.field);
@@ -145,27 +150,27 @@ function F(e, n) {
145
150
  return Math.round(t * 1e6) / 1e6;
146
151
  }
147
152
  function L(e, n, t) {
148
- var i;
149
- const r = ((i = g.find((l) => l.fn === e)) == null ? void 0 : i.label.toLowerCase()) ?? e, o = t == null ? "all matching records" : `all ${t.toLocaleString("en-US")} matching records`;
153
+ var s;
154
+ const r = ((s = g.find((l) => l.fn === e)) == null ? void 0 : s.label.toLowerCase()) ?? e, o = t == null ? "all matching records" : `all ${t.toLocaleString("en-US")} matching records`;
150
155
  return e === "count" ? `Records with ${n} filled in, across ${o}` : `${r.charAt(0).toUpperCase()}${r.slice(1)} of ${n} across ${o}`;
151
156
  }
152
157
  export {
153
158
  g as TOTAL_FNS,
154
- F as combineTerms,
155
- $ as formatTotal,
159
+ C as combineTerms,
160
+ M as formatTotal,
156
161
  h as isStoredField,
157
- b as isTotalFn,
158
- O as linearSumTerms,
159
- k as loadTotalOverrides,
160
- y as loadTotalOverridesAt,
161
- Z as overridesAfterSave,
162
- M as readTotal,
163
- z as rememberTotalOverrides,
164
- T as rememberTotalOverridesAt,
165
- N as setOverride,
166
- j as shownTotals,
162
+ S as isTotalFn,
163
+ A as linearSumTerms,
164
+ $ as loadTotalOverrides,
165
+ _ as loadTotalOverridesAt,
166
+ N as overridesAfterSave,
167
+ x as readTotal,
168
+ j as rememberTotalOverrides,
169
+ O as rememberTotalOverridesAt,
170
+ F as setOverride,
171
+ z as shownTotals,
167
172
  L as totalTip,
173
+ w as totalsBatchParams,
168
174
  v as totalsEligibleKey,
169
- w as totalsParams,
170
- C as totalsSupport
175
+ Z as totalsSupport
171
176
  };
@@ -0,0 +1,93 @@
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { useRef as M, useState as h, useLayoutEffect as S, useEffect as T, useMemo as w } from "react";
3
+ const p = 10.5, v = 10, _ = 0.4, y = 40;
4
+ let u;
5
+ function x(t, o = p) {
6
+ if (u === void 0)
7
+ try {
8
+ u = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null;
9
+ } catch {
10
+ u = null;
11
+ }
12
+ if (u) {
13
+ const i = typeof getComputedStyle == "function" && typeof document < "u" && getComputedStyle(document.body).fontFamily || "sans-serif";
14
+ u.font = `${o}px ${i}`;
15
+ const n = u.measureText(t).width;
16
+ if (n > 0) return n;
17
+ }
18
+ return t.length * o * 0.56;
19
+ }
20
+ function $(t, o) {
21
+ const i = Math.ceil(t + v), n = o > 0 ? Math.floor(o * _) : 200;
22
+ return Math.max(y, Math.min(i, Math.max(y, n)));
23
+ }
24
+ function b(t, o, i = (n) => x(n)) {
25
+ if (i(t) <= o) return { text: t, cut: !1 };
26
+ let n = 0, r = t.length;
27
+ for (; n < r; ) {
28
+ const d = Math.ceil((n + r) / 2);
29
+ i(`${t.slice(0, d).trimEnd()}…`) <= o ? n = d : r = d - 1;
30
+ }
31
+ return { text: `${t.slice(0, n).trimEnd()}…`, cut: !0 };
32
+ }
33
+ function k(t, o = String) {
34
+ const i = M(null), [n, r] = h(0);
35
+ S(() => {
36
+ const e = i.current;
37
+ if (!e || (r(e.clientWidth), typeof ResizeObserver > "u")) return;
38
+ const c = new ResizeObserver(() => r(e.clientWidth));
39
+ return c.observe(e), () => c.disconnect();
40
+ }, []);
41
+ const [d, g] = h(0);
42
+ T(() => {
43
+ var a;
44
+ const e = typeof document < "u" ? document.fonts : void 0;
45
+ if (!e) return;
46
+ let c = !0;
47
+ const l = () => c && g((s) => s + 1);
48
+ return e.ready.then(l), (a = e.addEventListener) == null || a.call(e, "loadingdone", l), () => {
49
+ var s;
50
+ c = !1, (s = e.removeEventListener) == null || s.call(e, "loadingdone", l);
51
+ };
52
+ }, []);
53
+ const C = t.map((e) => o(e)).join("\0"), A = w(
54
+ () => Math.max(0, ...t.map((e) => x(o(e)))),
55
+ [C, d]
56
+ ), m = $(A, n), E = m - v;
57
+ return {
58
+ ref: i,
59
+ yAxisProps: { width: m, tick: (e) => {
60
+ var s;
61
+ const c = o(((s = e.payload) == null ? void 0 : s.value) ?? ""), { text: l, cut: a } = b(c, E);
62
+ return /* @__PURE__ */ f("g", { transform: `translate(${e.x ?? 0},${e.y ?? 0})`, "data-tip": a ? c : void 0, children: /* @__PURE__ */ f(
63
+ "text",
64
+ {
65
+ x: 0,
66
+ y: 0,
67
+ dy: "0.35em",
68
+ textAnchor: "end",
69
+ fontSize: p,
70
+ fill: "currentColor",
71
+ children: l
72
+ }
73
+ ) });
74
+ }, interval: 0, tickLine: !1 }
75
+ };
76
+ }
77
+ function O({
78
+ labels: t,
79
+ format: o,
80
+ className: i,
81
+ children: n
82
+ }) {
83
+ const r = k(t, o);
84
+ return /* @__PURE__ */ f("div", { ref: r.ref, className: i, children: n(r.yAxisProps) });
85
+ }
86
+ export {
87
+ p as CATEGORY_TICK_FONT_PX,
88
+ O as CategoryAxisBox,
89
+ $ as categoryAxisWidth,
90
+ b as fitLabel,
91
+ x as measureTickText,
92
+ k as useCategoryAxis
93
+ };