@nivaro/react 0.3.110 → 0.3.112

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 (77) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +170 -2
  4. package/dist/index.js +745 -728
  5. package/dist/shared/components/CollectionBrowserView.js +3097 -2972
  6. package/dist/shared/components/CollectionImportBanner.js +135 -0
  7. package/dist/shared/components/ItemEditForm.js +2235 -2218
  8. package/dist/shared/components/JobsTray.js +54 -47
  9. package/dist/shared/components/TipLayer.js +61 -54
  10. package/dist/shared/components/ViewAsPersonButton.js +109 -0
  11. package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
  12. package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
  13. package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
  14. package/dist/shared/components/bulk/bulk-field-options.js +20 -19
  15. package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
  16. package/dist/shared/components/cbv/ColumnHeaderMenu.js +113 -0
  17. package/dist/shared/components/cbv/column-totals.js +66 -0
  18. package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
  19. package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
  20. package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
  21. package/dist/shared/components/collections-directory/directory-data.js +70 -58
  22. package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
  23. package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
  24. package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
  25. package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
  26. package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
  27. package/dist/shared/components/item-edit/FieldRow.js +248 -246
  28. package/dist/shared/components/item-edit/InlineGridField.js +34 -33
  29. package/dist/shared/components/item-edit/InlineTableField.js +3064 -2882
  30. package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
  31. package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
  32. package/dist/shared/components/item-edit/PlanGrid.js +2 -1
  33. package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
  34. package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
  35. package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
  36. package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
  37. package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
  38. package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
  39. package/dist/shared/components/item-edit/grid-search.js +345 -0
  40. package/dist/shared/components/item-edit/render-stability.js +61 -54
  41. package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
  42. package/dist/shared/components/ops-report/DigestSections.js +163 -144
  43. package/dist/shared/components/ops-report/drill.js +97 -97
  44. package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
  45. package/dist/shared/components/panels/AddendumPanel.js +92 -91
  46. package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
  47. package/dist/shared/components/panels/BlockedMove.js +73 -0
  48. package/dist/shared/components/panels/CommentPanel.js +265 -252
  49. package/dist/shared/components/panels/OwnersSlot.js +47 -35
  50. package/dist/shared/components/panels/PipelineInsight.js +186 -0
  51. package/dist/shared/components/panels/PipelinePanel.js +1573 -1475
  52. package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
  53. package/dist/shared/components/panels/RevisionsPanel.js +261 -260
  54. package/dist/shared/components/pipeline/FieldPicker.js +41 -40
  55. package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
  56. package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
  57. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
  58. package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
  59. package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
  60. package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
  61. package/dist/shared/components/profile/PersonHeader.js +29 -29
  62. package/dist/shared/components/profile/PersonProfile.js +30 -28
  63. package/dist/shared/components/profile/SlowScreensCard.js +286 -0
  64. package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
  65. package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
  66. package/dist/shared/components/support/TicketDetailSheet.js +25 -16
  67. package/dist/shared/components/support/TicketSlowScreens.js +32 -0
  68. package/dist/shared/lib/activity-sentence.js +224 -178
  69. package/dist/shared/lib/collection-import-banner.js +27 -0
  70. package/dist/shared/lib/crash-report.js +112 -0
  71. package/dist/shared/lib/export-runs.js +99 -0
  72. package/dist/shared/lib/jobs-tray.js +89 -67
  73. package/dist/shared/lib/list-link.js +76 -69
  74. package/dist/shared/lib/nav-trail.js +180 -76
  75. package/dist/shared/lib/query-keys.js +26 -0
  76. package/dist/shared/lib/view-as.js +16 -11
  77. package/package.json +1 -1
@@ -0,0 +1,91 @@
1
+ import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
+ import { X as m } from "lucide-react";
3
+ import { resolveOptionFilterTokens as b } from "../../lib/option-filter-tokens.js";
4
+ import { cn as h } from "../../lib/utils.js";
5
+ import { parseJson as g } from "../item-edit/helpers.js";
6
+ import { RelatedItemLabel as v, RelationCombobox as x } from "../item-edit/RelationCombobox.js";
7
+ const k = [
8
+ { value: "append", label: "Add", hint: "Add these links; links a record already has stay" },
9
+ { value: "replace", label: "Replace", hint: "Each record’s links become exactly these" },
10
+ { value: "remove", label: "Remove", hint: "Take these links off; the rest stay" }
11
+ ];
12
+ function R({
13
+ related: i,
14
+ fieldLabel: l,
15
+ fieldOptions: u,
16
+ mode: a,
17
+ ids: n,
18
+ onMode: d,
19
+ onIds: s
20
+ }) {
21
+ const o = g(
22
+ u
23
+ ), p = b(
24
+ o != null && o.option_filter && typeof o.option_filter == "object" ? o.option_filter : void 0,
25
+ void 0,
26
+ "new"
27
+ ), f = (e) => n.some((t) => String(t).toLowerCase() === String(e).toLowerCase());
28
+ return /* @__PURE__ */ c("div", { className: "space-y-2", "data-bulk-links": !0, children: [
29
+ /* @__PURE__ */ r(
30
+ "fieldset",
31
+ {
32
+ "aria-label": `How to change ${l}`,
33
+ className: "m-0 grid min-w-0 grid-cols-3 gap-0.5 rounded-md border-0 bg-muted p-0.5",
34
+ children: k.map((e) => /* @__PURE__ */ r(
35
+ "button",
36
+ {
37
+ type: "button",
38
+ "aria-pressed": a === e.value,
39
+ "data-bulk-links-mode": e.value,
40
+ "data-tip": e.hint,
41
+ onClick: () => d(e.value),
42
+ className: h(
43
+ "h-7 rounded-[5px] text-[12.5px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
44
+ a === e.value ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
45
+ ),
46
+ children: e.label
47
+ },
48
+ e.value
49
+ ))
50
+ }
51
+ ),
52
+ n.length > 0 && /* @__PURE__ */ r("ul", { className: "flex flex-wrap gap-1", "aria-label": `Picked ${l}`, children: n.map((e) => /* @__PURE__ */ c(
53
+ "li",
54
+ {
55
+ "data-bulk-links-chip": String(e),
56
+ className: "inline-flex max-w-full items-center gap-1 rounded-full border border-border bg-muted/60 py-0.5 pl-2 pr-1 text-[12px] text-foreground",
57
+ children: [
58
+ /* @__PURE__ */ r("span", { className: "min-w-0 truncate", children: /* @__PURE__ */ r(v, { collection: i, id: e }) }),
59
+ /* @__PURE__ */ r(
60
+ "button",
61
+ {
62
+ type: "button",
63
+ onClick: () => s(n.filter((t) => t !== e)),
64
+ "aria-label": "Remove from the list",
65
+ className: "rounded-full p-0.5 text-muted-foreground hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
66
+ children: /* @__PURE__ */ r(m, { className: "h-3 w-3" })
67
+ }
68
+ )
69
+ ]
70
+ },
71
+ String(e)
72
+ )) }),
73
+ /* @__PURE__ */ r(
74
+ x,
75
+ {
76
+ collection: i,
77
+ value: null,
78
+ onChange: (e) => {
79
+ const t = e && typeof e == "object" ? e.id : e;
80
+ (typeof t == "string" || typeof t == "number") && t !== "" && !f(t) && s([...n, t]);
81
+ },
82
+ extraFilter: p ?? void 0,
83
+ optionSort: typeof (o == null ? void 0 : o.option_sort) == "string" && o.option_sort ? o.option_sort : void 0,
84
+ placeholder: n.length ? "Add another…" : `Pick ${l}…`
85
+ }
86
+ )
87
+ ] });
88
+ }
89
+ export {
90
+ R as BulkLinksValue
91
+ };
@@ -1,12 +1,12 @@
1
1
  import { formSections as s, mergeFormSections as a, HEADER_SECTION_KEY as d } from "../../lib/form-sections.js";
2
2
  import { titleCase as c } from "../../lib/utils.js";
3
3
  function b(e, n = {}) {
4
- const t = e.forms.map(
4
+ const r = e.forms.map(
5
5
  (f) => s(f.groups, f.placements, { ungroupedSort: f.ungrouped_sort })
6
6
  );
7
7
  if (e.no_form > 0) {
8
- const f = new Set(t.flat().flatMap((o) => o.fields.map((r) => r.field))), i = Object.keys(e.fields).filter((o) => !f.has(o)).sort((o, r) => (n[o] || o).localeCompare(n[r] || r));
9
- i.length && t.push([
8
+ const f = new Set(r.flat().flatMap((o) => o.fields.map((t) => t.field))), i = Object.keys(e.fields).filter((o) => !f.has(o)).sort((o, t) => (n[o] || o).localeCompare(n[t] || t));
9
+ i.length && r.push([
10
10
  {
11
11
  key: "__no_form__",
12
12
  label: e.forms.length ? "Other fields" : "Fields",
@@ -15,35 +15,36 @@ function b(e, n = {}) {
15
15
  ]);
16
16
  }
17
17
  const l = [];
18
- for (const f of a(t)) {
18
+ for (const f of a(r)) {
19
19
  const i = f.fields.flatMap((o) => {
20
- const r = e.fields[o.field];
21
- return r ? [
20
+ const t = e.fields[o.field];
21
+ return t ? [
22
22
  {
23
23
  field: o.field,
24
24
  label: o.label || n[o.field] || c(o.field),
25
- writable: Math.max(0, r.records - r.locked),
26
- offForm: Math.max(0, e.readable - r.records),
27
- locked: r.locked,
28
- reason: r.reason,
29
- required: r.required === !0
25
+ writable: Math.max(0, t.records - t.locked),
26
+ offForm: Math.max(0, e.readable - t.records),
27
+ locked: t.locked,
28
+ reason: t.reason,
29
+ required: t.required === !0,
30
+ ...t.m2m ? { m2m: t.m2m } : {}
30
31
  }
31
32
  ] : [];
32
33
  });
33
34
  i.length && l.push({ key: f.key, label: f.label, options: i });
34
35
  }
35
- return u(l);
36
+ return m(l);
36
37
  }
37
- function u(e) {
38
- const n = (l) => l.key === d ? "Record header" : l.label.split(" › ").pop() ?? l.label, t = /* @__PURE__ */ new Map();
39
- for (const l of e) t.set(n(l), (t.get(n(l)) ?? 0) + 1);
40
- return e.map((l) => ({ ...l, label: (t.get(n(l)) ?? 0) > 1 ? l.label : n(l) }));
38
+ function m(e) {
39
+ const n = (l) => l.key === d ? "Record header" : l.label.split(" › ").pop() ?? l.label, r = /* @__PURE__ */ new Map();
40
+ for (const l of e) r.set(n(l), (r.get(n(l)) ?? 0) + 1);
41
+ return e.map((l) => ({ ...l, label: (r.get(n(l)) ?? 0) > 1 ? l.label : n(l) }));
41
42
  }
42
43
  function h(e, n) {
43
- const t = [];
44
- return e.locked > 0 && t.push(
44
+ const r = [];
45
+ return e.locked > 0 && r.push(
45
46
  e.writable === 0 && e.offForm === 0 ? e.reason ?? "Locked" : `locked on ${e.locked}`
46
- ), e.offForm > 0 && t.push(`not on the form of ${e.offForm}`), t.length === 0 ? null : e.writable === 0 && e.offForm === 0 ? t[0] : `${e.writable} of ${n} — ${t.join(", ")}`;
47
+ ), e.offForm > 0 && r.push(`not on the form of ${e.offForm}`), r.length === 0 ? null : e.writable === 0 && e.offForm === 0 ? r[0] : `${e.writable} of ${n} — ${r.join(", ")}`;
47
48
  }
48
49
  export {
49
50
  h as bulkFieldNote,
@@ -0,0 +1,39 @@
1
+ import { plainErrorText as a } from "../../lib/safe-error.js";
2
+ function l(e, o) {
3
+ const n = /* @__PURE__ */ new Set(), s = o.filter((r) => {
4
+ const i = String(r).toLowerCase();
5
+ return n.has(i) ? !1 : (n.add(i), !0);
6
+ });
7
+ return e === "replace" ? { set: s } : e === "remove" ? { delete: s } : { create: s };
8
+ }
9
+ const d = (e, o, n = `${o}s`) => `${e.toLocaleString()} ${e === 1 ? o : n}`;
10
+ function u(e, o = {}) {
11
+ const n = [];
12
+ let s;
13
+ const r = e.links_added ?? 0, i = e.links_removed ?? 0;
14
+ return o.mode && !e.links_unknown ? (e.would_update === 0 ? s = "Nothing would change" : o.mode === "append" ? s = `Adds ${d(r, "link")} to ${d(e.would_update, "record")}` : o.mode === "remove" ? s = `Removes ${d(i, "link")} from ${d(e.would_update, "record")}` : s = r && i ? `Removes ${d(i, "link")} and adds ${r.toLocaleString()} across ${d(e.would_update, "record")}` : r ? `Adds ${d(r, "link")} across ${d(e.would_update, "record")}` : `Removes ${d(i, "link")} across ${d(e.would_update, "record")}`, e.skipped && n.push(
15
+ o.mode === "remove" ? `${d(e.skipped, "record")} ${e.skipped === 1 ? "has" : "have"} none of them` : o.mode === "append" ? `${d(e.skipped, "record")} already ${e.skipped === 1 ? "has" : "have"} them` : `${d(e.skipped, "record")} already ${e.skipped === 1 ? "matches" : "match"}`
16
+ )) : (s = e.would_update === 0 ? "Nothing would change" : `Changes ${d(e.would_update, "record")}`, e.links_unknown && n.push("you cannot read the current links, so this counts every record"), e.skipped && n.push(`${d(e.skipped, "record")} already ${e.skipped === 1 ? "holds" : "hold"} it`)), e.refused && n.push(
17
+ `${d(e.refused, "record")} refused${e.refused_reason ? ` — ${e.refused_reason}` : ""}`
18
+ ), e.unreadable && n.push(`${d(e.unreadable, "record")} you cannot open`), { headline: s, notes: n };
19
+ }
20
+ function c(e) {
21
+ var n, s;
22
+ const o = [`Updated ${d(e.updated, "record")}`];
23
+ if (e.links_added || e.links_removed) {
24
+ const r = [];
25
+ e.links_added && r.push(`${d(e.links_added, "link")} added`), e.links_removed && r.push(`${d(e.links_removed, "link")} removed`), o[0] += ` (${r.join(", ")})`;
26
+ }
27
+ if (e.skipped && o.push(`${e.skipped.toLocaleString()} already there`), e.refused && o.push(
28
+ `${e.refused.toLocaleString()} refused — ${a(e.refused_reason ?? "locked on its form", "locked on its form")}`
29
+ ), e.failed) {
30
+ const r = (s = (n = e.failures) == null ? void 0 : n[0]) == null ? void 0 : s.reason, i = r ? a(r, "could not be changed") : null;
31
+ o.push(`${e.failed.toLocaleString()} not changed${i ? ` — ${i}` : ""}`);
32
+ }
33
+ return o.join(" · ");
34
+ }
35
+ export {
36
+ l as bulkLinksValue,
37
+ u as bulkPreviewSentence,
38
+ c as bulkUpdateOutcome
39
+ };
@@ -0,0 +1,113 @@
1
+ import { jsxs as t, jsx as n } from "react/jsx-runtime";
2
+ import { Sigma as p, ChevronDown as b, PenLine as h, Check as x } from "lucide-react";
3
+ import { useState as g } from "react";
4
+ import { cn as i } from "../../lib/utils.js";
5
+ import { Popover as v, PopoverTrigger as w, PopoverContent as N } from "../ui/popover.js";
6
+ import { TOTAL_FNS as y } from "./column-totals.js";
7
+ function j({
8
+ label: u,
9
+ selectedCount: r,
10
+ onSetSelected: s,
11
+ setUnavailable: a,
12
+ totals: o
13
+ }) {
14
+ const [m, c] = g(!1);
15
+ if (!s && !o) return null;
16
+ const l = (e) => e.stopPropagation(), d = !!(o != null && o.fn);
17
+ return /* @__PURE__ */ t(v, { open: m, onOpenChange: c, children: [
18
+ /* @__PURE__ */ n(w, { asChild: !0, children: /* @__PURE__ */ n(
19
+ "button",
20
+ {
21
+ type: "button",
22
+ onClick: l,
23
+ onKeyDown: l,
24
+ "aria-label": `${u} column menu`,
25
+ "data-cbv-col-menu": !0,
26
+ "data-tip": "Column menu",
27
+ className: i(
28
+ "ml-1 inline-flex h-4 w-4 items-center justify-center rounded align-middle transition-opacity focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
29
+ m || d ? "text-[#00a5cc] opacity-100" : "text-slate-400 opacity-0 hover:text-slate-600 group-hover/hcell:opacity-100 dark:text-slate-500 dark:hover:text-slate-300"
30
+ ),
31
+ children: d ? /* @__PURE__ */ n(p, { className: "h-3 w-3" }) : /* @__PURE__ */ n(b, { className: "h-3 w-3" })
32
+ }
33
+ ) }),
34
+ /* @__PURE__ */ t(
35
+ N,
36
+ {
37
+ align: "start",
38
+ sideOffset: 6,
39
+ className: "w-64 p-1 normal-case tracking-normal",
40
+ onClick: l,
41
+ onKeyDown: l,
42
+ onCloseAutoFocus: (e) => e.preventDefault(),
43
+ "data-cbv-col-menu-panel": !0,
44
+ children: [
45
+ s && /* @__PURE__ */ n("div", { className: i(o && "border-b border-border pb-1"), children: /* @__PURE__ */ t(
46
+ "button",
47
+ {
48
+ type: "button",
49
+ disabled: r === 0 || !!a,
50
+ onClick: () => {
51
+ c(!1), setTimeout(s, 0);
52
+ },
53
+ "data-cbv-col-set": !0,
54
+ className: "flex w-full items-start gap-2 rounded-sm px-2 py-1.5 text-left text-[12.5px] text-foreground hover:bg-muted focus-visible:bg-muted focus-visible:outline-none disabled:cursor-default disabled:hover:bg-transparent",
55
+ children: [
56
+ /* @__PURE__ */ n(h, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
57
+ /* @__PURE__ */ t("span", { className: "min-w-0", children: [
58
+ /* @__PURE__ */ t(
59
+ "span",
60
+ {
61
+ className: i(
62
+ "block",
63
+ (r === 0 || a) && "text-muted-foreground"
64
+ ),
65
+ children: [
66
+ "Set ",
67
+ u,
68
+ " on",
69
+ " ",
70
+ r > 0 ? `${r.toLocaleString()} selected row${r === 1 ? "" : "s"}` : "selected rows",
71
+ "…"
72
+ ]
73
+ }
74
+ ),
75
+ (a || r === 0) && /* @__PURE__ */ n("span", { className: "block text-[11px] leading-4 text-muted-foreground", children: a ?? "Tick the rows to change first." })
76
+ ] })
77
+ ]
78
+ }
79
+ ) }),
80
+ o && /* @__PURE__ */ t("fieldset", { className: i("m-0 min-w-0 border-0 p-0", s && "pt-1"), children: [
81
+ /* @__PURE__ */ n("legend", { className: "px-2 pb-0.5 pt-1 text-[10.5px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Σ Totals row" }),
82
+ [
83
+ { fn: null, label: "Off" },
84
+ ...y
85
+ ].map((e) => {
86
+ const f = (o.fn ?? null) === e.fn;
87
+ return /* @__PURE__ */ t(
88
+ "button",
89
+ {
90
+ type: "button",
91
+ "aria-pressed": f,
92
+ "data-cbv-col-total": e.fn ?? "off",
93
+ onClick: () => {
94
+ o.onChange(e.fn), c(!1);
95
+ },
96
+ className: "flex w-full items-center gap-2 rounded-sm px-2 py-1 text-left text-[12.5px] text-foreground hover:bg-muted focus-visible:bg-muted focus-visible:outline-none",
97
+ children: [
98
+ /* @__PURE__ */ n(x, { className: i("h-3.5 w-3.5 text-[#00a5cc]", !f && "invisible") }),
99
+ e.label
100
+ ]
101
+ },
102
+ e.fn ?? "off"
103
+ );
104
+ })
105
+ ] })
106
+ ]
107
+ }
108
+ )
109
+ ] });
110
+ }
111
+ export {
112
+ j as ColumnHeaderMenu
113
+ };
@@ -0,0 +1,66 @@
1
+ import { formatValue as s } from "../../lib/format-value.js";
2
+ const u = [
3
+ { fn: "sum", label: "Sum", short: "Sum" },
4
+ { fn: "avg", label: "Average", short: "Avg" },
5
+ { fn: "min", label: "Minimum", short: "Min" },
6
+ { fn: "max", label: "Maximum", short: "Max" },
7
+ { fn: "count", label: "Count (filled in)", short: "Count" }
8
+ ];
9
+ function f(t) {
10
+ return typeof t == "string" && u.some((e) => e.fn === t);
11
+ }
12
+ function m(t) {
13
+ return /^[A-Za-z_][A-Za-z0-9_]*$/.test(t);
14
+ }
15
+ function g(t, e, n) {
16
+ return {
17
+ [e]: t,
18
+ ...n.search ? { search: n.search } : {},
19
+ ...n.conditions ? { conditions: n.conditions } : {}
20
+ };
21
+ }
22
+ function h(t, e, n) {
23
+ var a, c, l;
24
+ const o = (l = (c = (a = t == null ? void 0 : t.data) == null ? void 0 : a[0]) == null ? void 0 : c[n]) == null ? void 0 : l[e];
25
+ if (o == null || o === "") return null;
26
+ const r = Number(o);
27
+ return Number.isFinite(r) ? r : null;
28
+ }
29
+ function b(t, e, n) {
30
+ return e === "count" ? Math.round(t).toLocaleString("en-US") : (n == null ? void 0 : n.type) === "number" ? s(String(t), n) : (Math.round(t * 100) / 100).toLocaleString("en-US", { maximumFractionDigits: 2 });
31
+ }
32
+ const i = (t) => `nvr_cbv_totals_${t}`;
33
+ function S(t) {
34
+ try {
35
+ const e = localStorage.getItem(i(t)), n = e ? JSON.parse(e) : null;
36
+ if (!n || typeof n != "object") return {};
37
+ const o = {};
38
+ for (const [r, a] of Object.entries(n))
39
+ m(r) && f(a) && (o[r] = a);
40
+ return o;
41
+ } catch {
42
+ return {};
43
+ }
44
+ }
45
+ function p(t, e) {
46
+ try {
47
+ Object.keys(e).length === 0 ? localStorage.removeItem(i(t)) : localStorage.setItem(i(t), JSON.stringify(e));
48
+ } catch {
49
+ }
50
+ }
51
+ function y(t, e, n) {
52
+ var a;
53
+ const o = ((a = u.find((c) => c.fn === t)) == null ? void 0 : a.label.toLowerCase()) ?? t, r = n == null ? "all matching records" : `all ${n.toLocaleString("en-US")} matching records`;
54
+ return t === "count" ? `Records with ${e} filled in, across ${r}` : `${o.charAt(0).toUpperCase()}${o.slice(1)} of ${e} across ${r}`;
55
+ }
56
+ export {
57
+ u as TOTAL_FNS,
58
+ b as formatTotal,
59
+ f as isTotalFn,
60
+ S as loadRememberedTotals,
61
+ h as readTotal,
62
+ p as rememberTotals,
63
+ y as totalTip,
64
+ m as totalsEligibleKey,
65
+ g as totalsParams
66
+ };
@@ -1,31 +1,31 @@
1
1
  import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
- import { ArrowRight as k, ArrowLeft as g, Workflow as w, LayoutTemplate as y } from "lucide-react";
3
- import { useState as b, useRef as v, useCallback as d, useEffect as u } from "react";
4
- import { titleCase as f, formatRelative as C, formatDateTime as _ } from "../../lib/utils.js";
5
- import { Popover as P, PopoverAnchor as $, PopoverContent as L } from "../ui/popover.js";
2
+ import { AlertTriangle as b, ArrowRight as k, ArrowLeft as w, Workflow as y, LayoutTemplate as v } from "lucide-react";
3
+ import { useState as C, useRef as _, useCallback as d, useEffect as u } from "react";
4
+ import { formatNumber as h, titleCase as f, formatRelative as P, formatDateTime as $ } from "../../lib/utils.js";
5
+ import { Popover as A, PopoverAnchor as S, PopoverContent as E } from "../ui/popover.js";
6
6
  import { Skeleton as c } from "../ui/skeleton.js";
7
- import { useCollectionSummary as S } from "./directory-data.js";
8
- const A = 400, E = 150, h = 6;
9
- function I(s, t = A) {
10
- const [n, i] = b(!1), r = v(null), e = d(() => {
11
- r.current && clearTimeout(r.current), r.current = null;
7
+ import { useCollectionSummary as L } from "./directory-data.js";
8
+ const T = 400, O = 150, N = 6;
9
+ function U(s, e = T) {
10
+ const [n, i] = C(!1), o = _(null), t = d(() => {
11
+ o.current && clearTimeout(o.current), o.current = null;
12
12
  }, []), m = d(() => {
13
- s && (e(), r.current = setTimeout(() => i(!0), t));
14
- }, [s, e, t]), o = d(() => {
15
- e(), r.current = setTimeout(() => i(!1), E);
16
- }, [e]), p = d(() => {
17
- e(), i(!1);
18
- }, [e]);
19
- return u(() => e, [e]), u(() => {
20
- s || p();
21
- }, [s, p]), { open: n, show: m, hide: o, cancel: e, close: p };
13
+ s && (t(), o.current = setTimeout(() => i(!0), e));
14
+ }, [s, t, e]), p = d(() => {
15
+ t(), o.current = setTimeout(() => i(!1), O);
16
+ }, [t]), r = d(() => {
17
+ t(), i(!1);
18
+ }, [t]);
19
+ return u(() => t, [t]), u(() => {
20
+ s || r();
21
+ }, [s, r]), { open: n, show: m, hide: p, cancel: t, close: r };
22
22
  }
23
- function N({ items: s }) {
23
+ function g({ items: s }) {
24
24
  if (s.length === 0)
25
25
  return /* @__PURE__ */ a("p", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: "None" });
26
- const t = s.slice(0, h), n = s.slice(h);
26
+ const e = s.slice(0, N), n = s.slice(N);
27
27
  return /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1", children: [
28
- t.map((i) => /* @__PURE__ */ a(
28
+ e.map((i) => /* @__PURE__ */ a(
29
29
  "span",
30
30
  {
31
31
  "data-tip": i.tip,
@@ -47,131 +47,158 @@ function N({ items: s }) {
47
47
  )
48
48
  ] });
49
49
  }
50
- function x({ icon: s, children: t }) {
50
+ function x({ icon: s, children: e }) {
51
51
  return /* @__PURE__ */ l("p", { className: "mb-1 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:text-slate-500", children: [
52
52
  s,
53
- t
53
+ e
54
54
  ] });
55
55
  }
56
- function O({ collection: s }) {
57
- const { data: t, isLoading: n, isError: i } = S(s, !0);
56
+ function j({ flag: s }) {
57
+ return /* @__PURE__ */ l(
58
+ "div",
59
+ {
60
+ "data-heavy-list-note": !0,
61
+ className: "flex gap-2 rounded-md bg-amber-50 px-2 py-1.5 text-[11.5px] leading-snug text-amber-800 ring-1 ring-inset ring-amber-200 dark:bg-amber-400/10 dark:text-amber-200 dark:ring-amber-400/25",
62
+ children: [
63
+ /* @__PURE__ */ a(b, { className: "mt-px h-3.5 w-3.5 shrink-0", "aria-hidden": "true" }),
64
+ /* @__PURE__ */ l("div", { className: "min-w-0", children: [
65
+ /* @__PURE__ */ a("p", { className: "font-medium", children: "Heavy list columns" }),
66
+ /* @__PURE__ */ a("ul", { className: "mt-0.5 space-y-px", children: s.fields.map((e) => /* @__PURE__ */ l("li", { children: [
67
+ e.label,
68
+ ": up to ",
69
+ h(e.max),
70
+ " per record (avg",
71
+ " ",
72
+ h(Math.round(e.avg)),
73
+ ")"
74
+ ] }, e.field)) }),
75
+ /* @__PURE__ */ a("p", { className: "mt-0.5 text-amber-700/90 dark:text-amber-300/80", children: "The list opens on them. Fix it in Data model → Collection Browser." })
76
+ ] })
77
+ ]
78
+ }
79
+ );
80
+ }
81
+ function D({ collection: s }) {
82
+ const { data: e, isLoading: n, isError: i } = L(s, !0);
58
83
  if (n)
59
84
  return /* @__PURE__ */ l("div", { className: "space-y-2", role: "status", "aria-busy": "true", "aria-label": "Loading summary", children: [
60
85
  /* @__PURE__ */ a(c, { className: "h-3 w-24" }),
61
- [0, 1, 2, 3, 4].map((e) => /* @__PURE__ */ l("div", { className: "flex justify-between gap-4", children: [
86
+ [0, 1, 2, 3, 4].map((t) => /* @__PURE__ */ l("div", { className: "flex justify-between gap-4", children: [
62
87
  /* @__PURE__ */ a(c, { className: "h-3 w-32" }),
63
88
  /* @__PURE__ */ a(c, { className: "h-3 w-12" })
64
- ] }, e)),
89
+ ] }, t)),
65
90
  /* @__PURE__ */ a(c, { className: "h-3 w-20" }),
66
91
  /* @__PURE__ */ a(c, { className: "h-4 w-full" })
67
92
  ] });
68
- if (i || !t)
93
+ if (i || !e)
69
94
  return /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: "Couldn't load this collection's summary." });
70
- const r = Math.max(0, t.field_count - t.fields.length);
95
+ const o = Math.max(0, e.field_count - e.fields.length);
71
96
  return /* @__PURE__ */ l("div", { className: "space-y-3", children: [
72
97
  /* @__PURE__ */ l("div", { children: [
73
98
  /* @__PURE__ */ l(x, { children: [
74
- t.field_count,
99
+ e.field_count,
75
100
  " field",
76
- t.field_count === 1 ? "" : "s"
101
+ e.field_count === 1 ? "" : "s"
77
102
  ] }),
78
- t.fields.length === 0 ? /* @__PURE__ */ a("p", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: "No fields yet" }) : /* @__PURE__ */ a("ul", { className: "space-y-0.5", children: t.fields.slice(0, 8).map((e) => /* @__PURE__ */ l("li", { className: "flex items-baseline justify-between gap-3 text-[12px]", children: [
103
+ e.fields.length === 0 ? /* @__PURE__ */ a("p", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: "No fields yet" }) : /* @__PURE__ */ a("ul", { className: "space-y-0.5", children: e.fields.slice(0, 8).map((t) => /* @__PURE__ */ l("li", { className: "flex items-baseline justify-between gap-3 text-[12px]", children: [
79
104
  /* @__PURE__ */ a(
80
105
  "span",
81
106
  {
82
107
  className: "truncate text-slate-700 dark:text-slate-200",
83
- "data-tip": e.label !== e.field ? e.field : void 0,
84
- children: e.label || e.field
108
+ "data-tip": t.label !== t.field ? t.field : void 0,
109
+ children: t.label || t.field
85
110
  }
86
111
  ),
87
- /* @__PURE__ */ a("span", { className: "shrink-0 font-mono text-[10px] text-slate-400 dark:text-slate-500", children: e.type })
88
- ] }, e.field)) }),
89
- r > 0 && /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11px] text-slate-400 dark:text-slate-500", children: [
112
+ /* @__PURE__ */ a("span", { className: "shrink-0 font-mono text-[10px] text-slate-400 dark:text-slate-500", children: t.type })
113
+ ] }, t.field)) }),
114
+ o > 0 && /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11px] text-slate-400 dark:text-slate-500", children: [
90
115
  "and ",
91
- r,
116
+ o,
92
117
  " more"
93
118
  ] })
94
119
  ] }),
95
120
  /* @__PURE__ */ l("div", { children: [
96
121
  /* @__PURE__ */ a(x, { icon: /* @__PURE__ */ a(k, { className: "h-2.5 w-2.5" }), children: "Points to" }),
97
122
  /* @__PURE__ */ a(
98
- N,
123
+ g,
99
124
  {
100
- items: t.relations_out.map((e) => ({
101
- key: `${e.field}:${e.collection}`,
102
- label: f(e.collection),
103
- tip: `${e.field} → ${e.collection}`
125
+ items: e.relations_out.map((t) => ({
126
+ key: `${t.field}:${t.collection}`,
127
+ label: f(t.collection),
128
+ tip: `${t.field} → ${t.collection}`
104
129
  }))
105
130
  }
106
131
  )
107
132
  ] }),
108
133
  /* @__PURE__ */ l("div", { children: [
109
- /* @__PURE__ */ a(x, { icon: /* @__PURE__ */ a(g, { className: "h-2.5 w-2.5" }), children: "Used by" }),
134
+ /* @__PURE__ */ a(x, { icon: /* @__PURE__ */ a(w, { className: "h-2.5 w-2.5" }), children: "Used by" }),
110
135
  /* @__PURE__ */ a(
111
- N,
136
+ g,
112
137
  {
113
- items: t.relations_in.map((e) => ({
114
- key: `${e.collection}:${e.field}`,
115
- label: f(e.collection),
116
- tip: `${e.collection}.${e.field}`
138
+ items: e.relations_in.map((t) => ({
139
+ key: `${t.collection}:${t.field}`,
140
+ label: f(t.collection),
141
+ tip: `${t.collection}.${t.field}`
117
142
  }))
118
143
  }
119
144
  )
120
145
  ] }),
121
- (t.pipeline || t.forms > 0) && /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-slate-600 dark:text-slate-300", children: [
122
- t.pipeline && /* @__PURE__ */ l("span", { className: "inline-flex min-w-0 items-center gap-1", children: [
123
- /* @__PURE__ */ a(w, { className: "h-3 w-3 shrink-0 text-slate-400 dark:text-slate-500" }),
124
- /* @__PURE__ */ a("span", { className: "truncate", children: t.pipeline })
125
- ] }),
126
- t.forms > 0 && /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", children: [
146
+ (e.pipeline || e.forms > 0) && /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-slate-600 dark:text-slate-300", children: [
147
+ e.pipeline && /* @__PURE__ */ l("span", { className: "inline-flex min-w-0 items-center gap-1", children: [
127
148
  /* @__PURE__ */ a(y, { className: "h-3 w-3 shrink-0 text-slate-400 dark:text-slate-500" }),
128
- t.forms,
149
+ /* @__PURE__ */ a("span", { className: "truncate", children: e.pipeline })
150
+ ] }),
151
+ e.forms > 0 && /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", children: [
152
+ /* @__PURE__ */ a(v, { className: "h-3 w-3 shrink-0 text-slate-400 dark:text-slate-500" }),
153
+ e.forms,
129
154
  " form",
130
- t.forms === 1 ? "" : "s"
155
+ e.forms === 1 ? "" : "s"
131
156
  ] })
132
157
  ] }),
133
- /* @__PURE__ */ a("p", { className: "border-t border-slate-100 pt-2 text-[11px] text-slate-500 dark:border-white/[0.06] dark:text-slate-400", children: t.last_edit ? /* @__PURE__ */ l("span", { "data-tip": _(t.last_edit.at), children: [
158
+ /* @__PURE__ */ a("p", { className: "border-t border-slate-100 pt-2 text-[11px] text-slate-500 dark:border-white/[0.06] dark:text-slate-400", children: e.last_edit ? /* @__PURE__ */ l("span", { "data-tip": $(e.last_edit.at), children: [
134
159
  "Edited ",
135
- C(t.last_edit.at),
136
- t.last_edit.user ? ` by ${t.last_edit.user}` : ""
160
+ P(e.last_edit.at),
161
+ e.last_edit.user ? ` by ${e.last_edit.user}` : ""
137
162
  ] }) : "No edits in the last 90 days" })
138
163
  ] });
139
164
  }
140
- function Y({
165
+ function W({
141
166
  collection: s,
142
- title: t,
143
- open: n,
144
- onClose: i,
145
- onCardEnter: r,
146
- onCardLeave: e,
147
- children: m
167
+ title: e,
168
+ heavyList: n,
169
+ open: i,
170
+ onClose: o,
171
+ onCardEnter: t,
172
+ onCardLeave: m,
173
+ children: p
148
174
  }) {
149
- return /* @__PURE__ */ l(P, { open: n, onOpenChange: (o) => !o && i(), children: [
150
- /* @__PURE__ */ a($, { asChild: !0, children: m }),
151
- n && /* @__PURE__ */ l(
152
- L,
175
+ return /* @__PURE__ */ l(A, { open: i, onOpenChange: (r) => !r && o(), children: [
176
+ /* @__PURE__ */ a(S, { asChild: !0, children: p }),
177
+ i && /* @__PURE__ */ l(
178
+ E,
153
179
  {
154
180
  side: "right",
155
181
  align: "start",
156
182
  sideOffset: 12,
157
183
  collisionPadding: 12,
158
184
  avoidCollisions: !0,
159
- onOpenAutoFocus: (o) => o.preventDefault(),
160
- onCloseAutoFocus: (o) => o.preventDefault(),
161
- onPointerEnter: r,
162
- onPointerLeave: e,
163
- onClick: (o) => o.stopPropagation(),
164
- "aria-label": `${t} summary`,
185
+ onOpenAutoFocus: (r) => r.preventDefault(),
186
+ onCloseAutoFocus: (r) => r.preventDefault(),
187
+ onPointerEnter: t,
188
+ onPointerLeave: m,
189
+ onClick: (r) => r.stopPropagation(),
190
+ "aria-label": `${e} summary`,
165
191
  className: "w-[320px] p-3 motion-reduce:animate-none",
166
192
  children: [
167
- /* @__PURE__ */ a("p", { className: "mb-2 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: t }),
168
- /* @__PURE__ */ a(O, { collection: s })
193
+ /* @__PURE__ */ a("p", { className: "mb-2 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: e }),
194
+ n && n.fields.length > 0 && /* @__PURE__ */ a("div", { className: "mb-2.5", children: /* @__PURE__ */ a(j, { flag: n }) }),
195
+ /* @__PURE__ */ a(D, { collection: s })
169
196
  ]
170
197
  }
171
198
  )
172
199
  ] });
173
200
  }
174
201
  export {
175
- Y as CollectionHoverCard,
176
- I as useHoverIntent
202
+ W as CollectionHoverCard,
203
+ U as useHoverIntent
177
204
  };