@nivaro/react 0.3.12 → 0.3.14

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/components/slots/pipeline/OwnersSection.js +79 -75
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +50 -2
  5. package/dist/index.js +601 -596
  6. package/dist/shared/components/CollectionBrowserView.js +2373 -2298
  7. package/dist/shared/components/DataTable.js +347 -335
  8. package/dist/shared/components/ItemEditForm.js +5278 -5149
  9. package/dist/shared/components/ListLoadError.js +33 -0
  10. package/dist/shared/components/PageRenderer.js +562 -529
  11. package/dist/shared/components/ProfileView.js +53 -51
  12. package/dist/shared/components/RecordReadView.js +119 -117
  13. package/dist/shared/components/ReportView.js +1268 -1241
  14. package/dist/shared/components/cbv/export-rows.js +69 -0
  15. package/dist/shared/components/cbv/saved-view-risk.js +35 -0
  16. package/dist/shared/components/cbv/unknown-fields.js +18 -0
  17. package/dist/shared/components/integrations/console/AlertsView.js +27 -25
  18. package/dist/shared/components/integrations/console/EventsView.js +244 -209
  19. package/dist/shared/components/item-edit/CatalogPickerField.js +946 -878
  20. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +84 -57
  21. package/dist/shared/components/item-edit/FieldAffordances.js +63 -61
  22. package/dist/shared/components/item-edit/FieldRow.js +195 -179
  23. package/dist/shared/components/item-edit/FilePickerField.js +257 -254
  24. package/dist/shared/components/item-edit/HeaderTools.js +139 -95
  25. package/dist/shared/components/item-edit/InlineTableField.js +2087 -2075
  26. package/dist/shared/components/item-edit/RecordLiveSync.js +196 -181
  27. package/dist/shared/components/item-edit/RowComments.js +1 -3
  28. package/dist/shared/components/item-edit/SummaryPanel.js +62 -62
  29. package/dist/shared/components/item-edit/UserChip.js +113 -113
  30. package/dist/shared/components/item-edit/file-download.js +18 -0
  31. package/dist/shared/components/item-edit/line-qty.js +67 -32
  32. package/dist/shared/components/item-edit/save-refusal.js +23 -0
  33. package/dist/shared/components/monitoring/TrafficMiniMap.js +9 -9
  34. package/dist/shared/components/panels/CommentPanel.js +30 -30
  35. package/dist/shared/components/panels/ItemLockBanner.js +207 -185
  36. package/dist/shared/components/panels/PipelinePanel.js +915 -786
  37. package/dist/shared/components/pipeline/PipelineEditorView.js +45 -25
  38. package/dist/shared/components/profile/DelegationCard.js +1 -1
  39. package/dist/shared/components/profile/session-actions.js +24 -24
  40. package/dist/shared/components/queue/QueueItemSheet.js +18 -18
  41. package/dist/shared/components/queue/QueueWorklist.js +517 -504
  42. package/dist/shared/components/ui/dropdown-menu.js +8 -7
  43. package/dist/shared/context.js +71 -66
  44. package/dist/shared/lib/draft-store.js +60 -33
  45. package/dist/shared/lib/leave-guard.js +38 -0
  46. package/dist/shared/lib/load-error.js +38 -17
  47. package/dist/shared/lib/summary-mode.js +25 -25
  48. package/dist/shared/lib/table-pins.js +23 -0
  49. package/dist/shared/lib/validation-rules.js +55 -51
  50. package/package.json +1 -1
@@ -0,0 +1,69 @@
1
+ const _ = 1e3, g = 5e4, E = 500, p = 20;
2
+ function h(t, n) {
3
+ const e = [];
4
+ for (let a = 0; a < t.length; a += n) e.push(t.slice(a, a + n));
5
+ return e;
6
+ }
7
+ function S(t) {
8
+ const n = (t ?? "").split(",").map((e) => e.trim()).filter(Boolean);
9
+ return n.some((e) => e.replace(/^-/, "") === "id") || n.push("id"), n.join(",");
10
+ }
11
+ async function R(t, n = 5e4) {
12
+ var o;
13
+ const e = [];
14
+ for (; e.length < n; ) {
15
+ const l = Math.min(1e3, n - e.length), r = await t(e.length, l), i = r.data ?? [];
16
+ e.push(...i);
17
+ const s = Math.min(((o = r.meta) == null ? void 0 : o.limit) ?? r.applied_limit ?? l, l);
18
+ if (i.length === 0 || i.length < s) return { rows: e, truncated: !1 };
19
+ }
20
+ const a = await t(e.length, 1);
21
+ return { rows: e.slice(0, n), truncated: (a.data ?? []).length > 0 };
22
+ }
23
+ async function w(t, n, e, a = 3) {
24
+ const o = {};
25
+ if (t.length === 0 || n.length === 0) return o;
26
+ const l = [];
27
+ for (const s of h(t, 500))
28
+ for (const u of h(n, 20)) l.push([s, u]);
29
+ let r = 0;
30
+ const i = async () => {
31
+ for (; r < l.length; ) {
32
+ const [s, u] = l[r++], f = await e(s, u).catch(() => ({}));
33
+ for (const [c, m] of Object.entries(f)) o[c] = { ...o[c], ...m };
34
+ }
35
+ };
36
+ return await Promise.all(Array.from({ length: Math.min(a, l.length) }, i)), o;
37
+ }
38
+ function L(t) {
39
+ const n = t.template ? [...t.template.matchAll(/\{\{([\w.]+)\}\}/g)].map((e) => e[1]) : [t.labelField];
40
+ return [...new Set(n)].map((e) => `${t.column}.${e}`);
41
+ }
42
+ function P(t, n) {
43
+ const e = (a) => {
44
+ var o;
45
+ return ((o = n == null ? void 0 : n[`${t.column}.${a}`]) == null ? void 0 : o.value) ?? "";
46
+ };
47
+ return t.template ? t.template.replace(/\{\{([\w.]+)\}\}/g, (a, o) => e(o)) : e(t.labelField);
48
+ }
49
+ function A(t, n) {
50
+ return t ? [t.first_name, t.last_name].filter(Boolean).join(" ") || t.email || String(n ?? "") : n == null ? "" : String(n);
51
+ }
52
+ function O(t = /* @__PURE__ */ new Date()) {
53
+ const n = (e) => String(e).padStart(2, "0");
54
+ return `${t.getFullYear()}-${n(t.getMonth() + 1)}-${n(t.getDate())}`;
55
+ }
56
+ export {
57
+ g as EXPORT_MAX_ROWS,
58
+ _ as EXPORT_PAGE_ROWS,
59
+ E as RESOLVE_IDS_PER_CALL,
60
+ p as RESOLVE_PATHS_PER_CALL,
61
+ h as chunk,
62
+ O as localYmd,
63
+ P as m2oLabel,
64
+ L as m2oLabelPaths,
65
+ R as readExportRows,
66
+ w as resolveAllPaths,
67
+ S as stableSort,
68
+ A as userLabel
69
+ };
@@ -0,0 +1,35 @@
1
+ const o = "__at_risk__", l = (t) => t.path.length === 1 && t.path[0] === "$at_risk";
2
+ function u(t, n) {
3
+ return t.length === 0 ? null : {
4
+ id: o,
5
+ path: ["$at_risk"],
6
+ pathLabels: ["Highlight"],
7
+ fieldType: "at_risk",
8
+ op: "_eq",
9
+ value: [...t],
10
+ valueLabels: t.map((r) => {
11
+ var i;
12
+ return ((i = n.find((s) => s.id === r)) == null ? void 0 : i.name) ?? String(r);
13
+ })
14
+ };
15
+ }
16
+ function c(t) {
17
+ const n = [], r = [];
18
+ for (const i of t) {
19
+ if (!l(i)) {
20
+ r.push(i);
21
+ continue;
22
+ }
23
+ const s = Array.isArray(i.value) ? i.value : [i.value];
24
+ for (const a of s) {
25
+ const e = Number(a);
26
+ Number.isFinite(e) && !n.includes(e) && n.push(e);
27
+ }
28
+ }
29
+ return { filters: r, riskIds: n };
30
+ }
31
+ export {
32
+ o as RISK_FILTER_ID,
33
+ u as riskFilterEntry,
34
+ c as splitRiskFilter
35
+ };
@@ -0,0 +1,18 @@
1
+ function l(r) {
2
+ const e = r, t = e == null ? void 0 : e.response, o = t && typeof t == "object" && t.data && typeof t.data == "object" ? t.data : t;
3
+ return (o == null ? void 0 : o.code) !== "UNKNOWN_FIELD" || !Array.isArray(o.fields) ? [] : o.fields.filter((n) => typeof n == "string" && n.length > 0);
4
+ }
5
+ const i = (r, e) => r.toLowerCase() === e.toLowerCase(), s = (r, e) => r.some((t) => t.split(".").some((o) => i(o, e)));
6
+ function c(r, e) {
7
+ return {
8
+ filters: e.filters.filter((t) => !s(t.path, r)),
9
+ sort: e.sort.split(",").map((t) => t.trim()).filter((t) => t && !s([t.replace(/^-/, "")], r)).join(","),
10
+ colFilters: Object.fromEntries(
11
+ Object.entries(e.colFilters).filter(([t]) => !s([t], r))
12
+ )
13
+ };
14
+ }
15
+ export {
16
+ c as dropUnknownField,
17
+ l as unknownFieldsOf
18
+ };
@@ -46,7 +46,7 @@ function me(e, r) {
46
46
  return [...a.entries()].sort(([c], [m]) => l(c) - l(m) || c.localeCompare(m)).map(([c, m]) => ({
47
47
  tab: c,
48
48
  label: s[c] ?? Z(c),
49
- items: [...m].sort((h, p) => h.label.localeCompare(p.label))
49
+ items: [...m].sort((p, u) => p.label.localeCompare(u.label))
50
50
  }));
51
51
  }
52
52
  function K({ title: e, children: r }) {
@@ -64,8 +64,8 @@ function T({
64
64
  label: s,
65
65
  subs: o
66
66
  }) {
67
- var h;
68
- const a = H(), l = o.find((p) => p.signal === e && p.mode === r), m = (a.isPending ? (h = a.variables) == null ? void 0 : h.on : void 0) ?? !!l;
67
+ var p;
68
+ const a = H(), l = o.find((u) => u.signal === e && u.mode === r), m = (a.isPending ? (p = a.variables) == null ? void 0 : p.on : void 0) ?? !!l;
69
69
  return /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-1", children: [
70
70
  /* @__PURE__ */ t(
71
71
  W,
@@ -74,7 +74,7 @@ function T({
74
74
  disabled: a.isPending,
75
75
  "aria-label": `${r === "realtime" ? "Real-time alerts" : "Daily summary"} for ${s}`,
76
76
  "data-ic-sub": `${e}:${r}`,
77
- onCheckedChange: (p) => a.mutate({ signal: e, mode: r, on: p, id: l == null ? void 0 : l.id })
77
+ onCheckedChange: (u) => a.mutate({ signal: e, mode: r, on: u, id: l == null ? void 0 : l.id })
78
78
  }
79
79
  ),
80
80
  a.isError && /* @__PURE__ */ t("span", { role: "alert", className: g("text-[11px]", w.negative), children: $(a.error) })
@@ -84,7 +84,7 @@ function ue({
84
84
  groups: e,
85
85
  entries: r
86
86
  }) {
87
- const s = re(), o = s.data ?? [], a = F(() => new Set(r.map((d) => d.id)), [r]), l = o.filter((d) => d.signal === y || a.has(d.signal)), c = o.filter((d) => d.signal !== y && !a.has(d.signal)), m = o.some((d) => d.signal === y && d.mode === "realtime"), h = o.some((d) => d.signal === y && d.mode === "digest"), p = r.filter(
87
+ const s = re(), o = s.data ?? [], a = F(() => new Set(r.map((d) => d.id)), [r]), l = o.filter((d) => d.signal === y || a.has(d.signal)), c = o.filter((d) => d.signal !== y && !a.has(d.signal)), m = o.some((d) => d.signal === y && d.mode === "realtime"), p = o.some((d) => d.signal === y && d.mode === "digest"), u = r.filter(
88
88
  (d) => d.settings.enabled && d.settings.severity === "critical"
89
89
  ).length, b = l.length, f = o.map((d) => d.last_notified_at).filter((d) => !!d).sort().at(-1);
90
90
  return /* @__PURE__ */ n("section", { className: "space-y-3", "data-ic-my-alerts": !0, children: [
@@ -108,9 +108,11 @@ function ue({
108
108
  /* @__PURE__ */ n("td", { className: "py-3 pl-4 pr-3", children: [
109
109
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-foreground", children: "All critical problems" }),
110
110
  /* @__PURE__ */ n("p", { className: "mt-0.5 max-w-[70ch] text-[12px] text-muted-foreground", children: [
111
- "Every problem marked Critical — ",
112
- p,
113
- " right now — including any raised to Critical later."
111
+ "Every kind of problem marked Critical — ",
112
+ u,
113
+ " ",
114
+ u === 1 ? "kind" : "kinds",
115
+ " today, however many of each are open — including any raised to Critical later."
114
116
  ] })
115
117
  ] }),
116
118
  /* @__PURE__ */ t("td", { className: "px-3 py-3", children: /* @__PURE__ */ t(
@@ -140,7 +142,7 @@ function ue({
140
142
  items: d.items,
141
143
  subs: o,
142
144
  criticalRealtime: m,
143
- criticalDigest: h
145
+ criticalDigest: p
144
146
  },
145
147
  d.tab
146
148
  )),
@@ -290,18 +292,18 @@ function ve({
290
292
  onJumpTab: s
291
293
  }) {
292
294
  var R, B;
293
- const o = ae(), [a, l] = L(() => O(e)), [c, m] = L(!1), h = z();
295
+ const o = ae(), [a, l] = L(() => O(e)), [c, m] = L(!1), p = z();
294
296
  q(() => l(O(e)), [e]);
295
- const p = Object.fromEntries(
297
+ const u = Object.fromEntries(
296
298
  e.thresholds.map((i) => [i.key, fe(i, a.values[i.key] ?? "")])
297
- ), b = Object.values(p).every((i) => i == null), f = O(e), d = e.thresholds.map((i) => i.key).filter((i) => Number(a.values[i]) !== Number(f.values[i])), E = d.length > 0 || a.enabled !== f.enabled || a.severity !== f.severity, D = F(
299
+ ), b = Object.values(u).every((i) => i == null), f = O(e), d = e.thresholds.map((i) => i.key).filter((i) => Number(a.values[i]) !== Number(f.values[i])), E = d.length > 0 || a.enabled !== f.enabled || a.severity !== f.severity, D = F(
298
300
  () => b ? Object.fromEntries(e.thresholds.map((i) => [i.key, Number(a.values[i.key])])) : null,
299
301
  [b, e.thresholds, a.values]
300
302
  ), _ = Q(D, 500), x = ne(e.id, _), V = JSON.stringify(_) !== JSON.stringify(D), J = () => {
301
303
  const i = {};
302
- for (const u of d) {
303
- const N = e.thresholds.find((S) => S.key === u), k = Number(a.values[u]);
304
- i[u] = N && k === N.default ? null : k;
304
+ for (const h of d) {
305
+ const N = e.thresholds.find((S) => S.key === h), k = Number(a.values[h]);
306
+ i[h] = N && k === N.default ? null : k;
305
307
  }
306
308
  a.enabled !== f.enabled && (i.enabled = a.enabled), a.severity !== f.severity && (i.severity = a.severity), m(!1), o.mutate({ signal: e.id, values: i }, { onSuccess: () => m(!0) });
307
309
  }, X = d.length > 0;
@@ -326,23 +328,23 @@ function ve({
326
328
  /* @__PURE__ */ t(
327
329
  W,
328
330
  {
329
- id: `${h}-enabled`,
331
+ id: `${p}-enabled`,
330
332
  checked: a.enabled,
331
- onCheckedChange: (i) => l((u) => ({ ...u, enabled: i })),
333
+ onCheckedChange: (i) => l((h) => ({ ...h, enabled: i })),
332
334
  "data-ic-threshold-enabled": e.id
333
335
  }
334
336
  ),
335
337
  /* @__PURE__ */ t(
336
338
  "label",
337
339
  {
338
- htmlFor: `${h}-enabled`,
340
+ htmlFor: `${p}-enabled`,
339
341
  className: "text-[12.5px] font-medium text-foreground",
340
342
  children: "Check for this problem"
341
343
  }
342
344
  )
343
345
  ] }),
344
346
  /* @__PURE__ */ n("div", { className: "space-y-1", children: [
345
- /* @__PURE__ */ t("p", { className: "text-[11.5px] text-muted-foreground", id: `${h}-sev`, children: "Severity" }),
347
+ /* @__PURE__ */ t("p", { className: "text-[11.5px] text-muted-foreground", id: `${p}-sev`, children: "Severity" }),
346
348
  /* @__PURE__ */ t(
347
349
  ie,
348
350
  {
@@ -351,7 +353,7 @@ function ve({
351
353
  ["critical", "Critical"],
352
354
  ["warn", "Warning"]
353
355
  ],
354
- onChange: (i) => l((u) => ({ ...u, severity: i })),
356
+ onChange: (i) => l((h) => ({ ...h, severity: i })),
355
357
  label: `Severity for ${e.label}`,
356
358
  disabled: !a.enabled,
357
359
  "data-ic-severity": e.id
@@ -360,19 +362,19 @@ function ve({
360
362
  ] })
361
363
  ] }),
362
364
  e.thresholds.length > 0 && /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-x-8 gap-y-4", children: e.thresholds.map((i) => {
363
- const u = `${h}-${i.key}`, N = p[i.key], k = Number(a.values[i.key]);
365
+ const h = `${p}-${i.key}`, N = u[i.key], k = Number(a.values[i.key]);
364
366
  return /* @__PURE__ */ n("div", { className: "w-[200px] space-y-1", children: [
365
- /* @__PURE__ */ t("label", { htmlFor: u, className: "block text-[11.5px] text-muted-foreground", children: i.label }),
367
+ /* @__PURE__ */ t("label", { htmlFor: h, className: "block text-[11.5px] text-muted-foreground", children: i.label }),
366
368
  /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
367
369
  /* @__PURE__ */ t(
368
370
  ee,
369
371
  {
370
- id: u,
372
+ id: h,
371
373
  inputMode: "decimal",
372
374
  value: a.values[i.key] ?? "",
373
375
  disabled: !a.enabled,
374
376
  "aria-invalid": N != null,
375
- "aria-describedby": `${u}-hint`,
377
+ "aria-describedby": `${h}-hint`,
376
378
  "data-ic-threshold-input": `${e.id}:${i.key}`,
377
379
  onChange: (S) => l((M) => ({ ...M, values: { ...M.values, [i.key]: S.target.value } })),
378
380
  className: g(
@@ -386,7 +388,7 @@ function ve({
386
388
  /* @__PURE__ */ t(
387
389
  "p",
388
390
  {
389
- id: `${u}-hint`,
391
+ id: `${h}-hint`,
390
392
  className: g(
391
393
  "text-[11px]",
392
394
  N ? w.negative : "text-muted-foreground"