@nivaro/react 0.3.122 → 0.3.124

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.
@@ -1101,7 +1101,7 @@ function _t({
1101
1101
  { kind: "group", key: e.key },
1102
1102
  /* @__PURE__ */ p(me, { children: [
1103
1103
  /* @__PURE__ */ p(
1104
- "h3",
1104
+ "h2",
1105
1105
  {
1106
1106
  "data-read-head": "",
1107
1107
  className: `group/rs relative flex items-center justify-between gap-2 px-5 py-2.5 text-[12.5px] font-semibold text-slate-700 dark:text-slate-200 ${ye(e) ? "border-b border-slate-100 dark:border-slate-800" : ""}`,
@@ -1,81 +1,103 @@
1
- import { jsx as M } from "react/jsx-runtime";
2
- import { useState as b, useRef as y, useEffect as x, useLayoutEffect as E } from "react";
3
- import { createPortal as L } from "react-dom";
4
- const w = [], O = '[data-nvr-header-menu-panel], [role="menu"], [data-rail-menu]', p = 6;
5
- function R() {
6
- const [t, a] = b(null), [u, f] = b(!1), g = y(null);
7
- return x(() => (w.push(f), w[0] === f && f(!0), () => {
1
+ import { jsx as L } from "react/jsx-runtime";
2
+ import { useState as x, useRef as A, useEffect as y, useLayoutEffect as E } from "react";
3
+ import { createPortal as M } from "react-dom";
4
+ const g = [], O = '[data-nvr-header-menu-panel], [role="menu"], [data-rail-menu]', v = 6;
5
+ function W(t) {
6
+ var d;
7
+ const r = (d = t.getAttribute("data-tip")) == null ? void 0 : d.trim();
8
+ if (!r) return;
9
+ const o = t.getAttribute("data-tip-a11y");
10
+ if (o === "label" || o === "desc") {
11
+ t.setAttribute(o === "label" ? "aria-label" : "aria-description", r);
12
+ return;
13
+ }
14
+ const l = (t.textContent ?? "").replace(/\s+/g, " ").trim();
15
+ if (l === r.replace(/\s+/g, " ")) return;
16
+ if (!(!!l || t.hasAttribute("aria-label") || t.hasAttribute("aria-labelledby") || !!t.querySelector('img[alt]:not([alt=""])'))) {
17
+ t.setAttribute("aria-label", r), t.setAttribute("data-tip-a11y", "label");
18
+ return;
19
+ }
20
+ !t.hasAttribute("aria-description") && !t.hasAttribute("aria-describedby") && (t.setAttribute("aria-description", r), t.setAttribute("data-tip-a11y", "desc"));
21
+ }
22
+ function T() {
23
+ const [t, r] = x(null), [o, l] = x(!1), b = A(null);
24
+ return y(() => (g.push(l), g[0] === l && l(!0), () => {
8
25
  var e;
9
- const c = w.indexOf(f);
10
- c < 0 || (w.splice(c, 1), c === 0 && ((e = w[0]) == null || e.call(w, !0)));
11
- }), []), x(() => {
12
- if (!u) return;
13
- const c = (o) => {
14
- var v;
15
- const i = (v = o == null ? void 0 : o.closest) == null ? void 0 : v.call(o, "[data-tip]"), d = i == null ? void 0 : i.getAttribute("data-tip");
16
- if (!i || !d || i.getAttribute("aria-expanded") === "true") {
17
- a((l) => l && null);
26
+ const d = g.indexOf(l);
27
+ d < 0 || (g.splice(d, 1), d === 0 && ((e = g[0]) == null || e.call(g, !0)));
28
+ }), []), y(() => {
29
+ if (!o) return;
30
+ const d = (a) => {
31
+ var p;
32
+ const i = (p = a == null ? void 0 : a.closest) == null ? void 0 : p.call(a, "[data-tip]"), h = i == null ? void 0 : i.getAttribute("data-tip");
33
+ if (!i || !h || i.getAttribute("aria-expanded") === "true") {
34
+ r((f) => f && null);
18
35
  return;
19
36
  }
20
37
  const n = i.getBoundingClientRect(), m = i.closest(O);
21
38
  if (m && m !== i) {
22
- const l = m.getBoundingClientRect();
23
- a({
24
- x: l.left,
39
+ const f = m.getBoundingClientRect();
40
+ r({
41
+ x: f.left,
25
42
  y: n.top,
26
- text: d,
27
- beside: { left: l.left, right: l.right, rowTop: n.top, rowHeight: n.height }
43
+ text: h,
44
+ beside: { left: f.left, right: f.right, rowTop: n.top, rowHeight: n.height }
28
45
  });
29
46
  return;
30
47
  }
31
48
  if (i.getAttribute("data-tip-side") === "right") {
32
- a({
33
- x: n.right + p,
49
+ r({
50
+ x: n.right + v,
34
51
  y: n.top,
35
- text: d,
52
+ text: h,
36
53
  rightOf: { left: n.left, right: n.right, top: n.top, height: n.height }
37
54
  });
38
55
  return;
39
56
  }
40
57
  if (i.getAttribute("data-tip-side") === "top") {
41
- a({ x: n.left, y: n.top, text: d, above: { top: n.top, bottom: n.bottom } });
58
+ r({ x: n.left, y: n.top, text: h, above: { top: n.top, bottom: n.bottom } });
42
59
  return;
43
60
  }
44
- a({ x: n.left, y: n.bottom + 4, text: d });
45
- }, e = (o) => c(o.target), h = () => a(null), s = (o) => {
46
- var d, n;
47
- const i = (n = (d = o.target) == null ? void 0 : d.closest) == null ? void 0 : n.call(d, "[data-tip-focus]");
48
- i && c(i);
49
- }, r = (o) => {
50
- var i, d;
51
- (d = (i = o.target) == null ? void 0 : i.closest) != null && d.call(i, "[data-tip-focus]") && a(null);
61
+ r({ x: n.left, y: n.bottom + 4, text: h });
62
+ }, e = (a) => d(a.target), c = () => r(null), u = (a) => {
63
+ var n, m, p, f;
64
+ const i = (m = (n = a.target) == null ? void 0 : n.closest) == null ? void 0 : m.call(n, "[data-tip]");
65
+ i && W(i);
66
+ const h = (f = (p = a.target) == null ? void 0 : p.closest) == null ? void 0 : f.call(p, "[data-tip-focus]");
67
+ h && d(h);
68
+ }, s = (a) => {
69
+ a.key === "Escape" && r((i) => i && null);
70
+ }, w = (a) => {
71
+ var i, h;
72
+ (h = (i = a.target) == null ? void 0 : i.closest) != null && h.call(i, "[data-tip-focus]") && r(null);
52
73
  };
53
- return window.addEventListener("mouseover", e), window.addEventListener("focusin", s), window.addEventListener("focusout", r), window.addEventListener("pointerdown", h, !0), window.addEventListener("scroll", h, !0), () => {
54
- window.removeEventListener("mouseover", e), window.removeEventListener("focusin", s), window.removeEventListener("focusout", r), window.removeEventListener("pointerdown", h, !0), window.removeEventListener("scroll", h, !0);
74
+ return window.addEventListener("mouseover", e), window.addEventListener("focusin", u), window.addEventListener("focusout", w), window.addEventListener("keydown", s), window.addEventListener("pointerdown", c, !0), window.addEventListener("scroll", c, !0), () => {
75
+ window.removeEventListener("mouseover", e), window.removeEventListener("focusin", u), window.removeEventListener("focusout", w), window.removeEventListener("keydown", s), window.removeEventListener("pointerdown", c, !0), window.removeEventListener("scroll", c, !0);
55
76
  };
56
- }, [u]), E(() => {
77
+ }, [o]), E(() => {
57
78
  if (!t) return;
58
- const c = g.current;
59
- if (!c) return;
60
- const e = c.getBoundingClientRect();
61
- let { x: h, y: s } = t;
79
+ const d = b.current;
80
+ if (!d) return;
81
+ const e = d.getBoundingClientRect();
82
+ let { x: c, y: u } = t;
62
83
  if (t.rightOf) {
63
- const r = t.rightOf, o = r.right + p;
64
- h = o + e.width <= window.innerWidth - 8 ? o : Math.max(8, r.left - p - e.width), s = Math.round(r.top + (r.height - e.height) / 2), s = Math.max(8, Math.min(s, window.innerHeight - e.height - 8));
84
+ const s = t.rightOf, w = s.right + v;
85
+ c = w + e.width <= window.innerWidth - 8 ? w : Math.max(8, s.left - v - e.width), u = Math.round(s.top + (s.height - e.height) / 2), u = Math.max(8, Math.min(u, window.innerHeight - e.height - 8));
65
86
  } else if (t.beside) {
66
- const r = t.beside, o = r.left - p - e.width;
67
- h = o >= 8 ? o : Math.min(r.right + p, Math.max(8, window.innerWidth - e.width - 8)), s = Math.round(r.rowTop + (r.rowHeight - e.height) / 2), s = Math.max(8, Math.min(s, window.innerHeight - e.height - 8));
87
+ const s = t.beside, w = s.left - v - e.width;
88
+ c = w >= 8 ? w : Math.min(s.right + v, Math.max(8, window.innerWidth - e.width - 8)), u = Math.round(s.rowTop + (s.rowHeight - e.height) / 2), u = Math.max(8, Math.min(u, window.innerHeight - e.height - 8));
68
89
  } else if (t.above) {
69
- const r = t.above.top - p - e.height;
70
- s = r >= 8 ? r : t.above.bottom + 4, h + e.width > window.innerWidth - 8 && (h = Math.max(8, window.innerWidth - e.width - 8));
90
+ const s = t.above.top - v - e.height;
91
+ u = s >= 8 ? s : t.above.bottom + 4, c + e.width > window.innerWidth - 8 && (c = Math.max(8, window.innerWidth - e.width - 8));
71
92
  } else
72
- e.right > window.innerWidth - 8 && (h = Math.max(8, window.innerWidth - e.width - 8)), e.bottom > window.innerHeight - 8 && (s = Math.max(8, t.y - e.height - 30));
73
- (h !== t.x || s !== t.y) && a({ ...t, x: h, y: s });
74
- }, [t]), !u || !t ? null : L(
75
- /* @__PURE__ */ M(
93
+ e.right > window.innerWidth - 8 && (c = Math.max(8, window.innerWidth - e.width - 8)), e.bottom > window.innerHeight - 8 && (u = Math.max(8, t.y - e.height - 30));
94
+ (c !== t.x || u !== t.y) && r({ ...t, x: c, y: u });
95
+ }, [t]), !o || !t ? null : M(
96
+ /* @__PURE__ */ L(
76
97
  "div",
77
98
  {
78
- ref: g,
99
+ ref: b,
100
+ role: "tooltip",
79
101
  style: { position: "fixed", left: t.x, top: t.y, zIndex: 120 },
80
102
  className: "pointer-events-none max-w-[340px] whitespace-pre-wrap break-words rounded-md bg-[#0f172a] px-2 py-1 text-[11px] font-medium leading-snug text-white shadow-lg dark:bg-[#334155] dark:ring-1 dark:ring-white/10",
81
103
  children: t.text
@@ -84,20 +106,21 @@ function R() {
84
106
  document.body
85
107
  );
86
108
  }
87
- function T(t) {
88
- const a = y(null);
109
+ function C(t) {
110
+ const r = A(null);
89
111
  return E(() => {
90
- const u = a.current;
91
- if (!u) return;
92
- const f = () => {
93
- (u.scrollWidth > u.clientWidth + 1 || u.scrollHeight > u.clientHeight + 1) && t ? u.setAttribute("data-tip", t) : u.removeAttribute("data-tip");
112
+ const o = r.current;
113
+ if (!o) return;
114
+ const l = () => {
115
+ (o.scrollWidth > o.clientWidth + 1 || o.scrollHeight > o.clientHeight + 1) && t ? o.setAttribute("data-tip", t) : o.removeAttribute("data-tip");
94
116
  };
95
- if (f(), typeof ResizeObserver > "u") return;
96
- const g = new ResizeObserver(f);
97
- return g.observe(u), () => g.disconnect();
98
- }, [t]), a;
117
+ if (l(), typeof ResizeObserver > "u") return;
118
+ const b = new ResizeObserver(l);
119
+ return b.observe(o), () => b.disconnect();
120
+ }, [t]), r;
99
121
  }
100
122
  export {
101
- R as TipLayer,
102
- T as useOverflowTip
123
+ T as TipLayer,
124
+ W as describeTipTarget,
125
+ C as useOverflowTip
103
126
  };
@@ -19,6 +19,7 @@ function f({ rows: i, className: l }) {
19
19
  "span",
20
20
  {
21
21
  "data-integration-dots": !0,
22
+ role: "img",
22
23
  "aria-label": t.map((e) => `${e.api}: ${r[e.tone]}`).join(", "),
23
24
  className: `inline-flex items-center gap-1 ${l ?? ""}`.trim(),
24
25
  children: t.map((e) => {
@@ -1,18 +1,20 @@
1
- import { jsxs as n, jsx as t, Fragment as k } from "react/jsx-runtime";
2
- import { useQuery as y } from "@tanstack/react-query";
3
- import { Sigma as w } from "lucide-react";
4
- import { useState as v } from "react";
5
- import { useNivaroClient as _ } from "../../context.js";
6
- import { get as C } from "../../lib/commands.js";
7
- import { useAfterIdle as S } from "../../lib/defer.js";
8
- import { cn as f } from "../../lib/utils.js";
9
- import { Popover as L, PopoverTrigger as T, PopoverContent as D } from "../ui/popover.js";
10
- import { useFieldLineage as $, lineageSummary as F } from "./FieldRow.js";
11
- const N = [
1
+ import { jsxs as s, jsx as n, Fragment as F } from "react/jsx-runtime";
2
+ import { useQuery as C } from "@tanstack/react-query";
3
+ import { Sigma as O } from "lucide-react";
4
+ import { useState as L } from "react";
5
+ import { useNivaroClient as T } from "../../context.js";
6
+ import { get as D } from "../../lib/commands.js";
7
+ import { compareValueText as $ } from "../../lib/compare-value.js";
8
+ import { useAfterIdle as q } from "../../lib/defer.js";
9
+ import { queryKeys as A } from "../../lib/query-keys.js";
10
+ import { cn as w, titleCase as N } from "../../lib/utils.js";
11
+ import { Popover as W, PopoverTrigger as H, PopoverContent as P } from "../ui/popover.js";
12
+ import { useFieldLineage as j, lineageSummary as E } from "./FieldRow.js";
13
+ const S = [
12
14
  { label: "24h", hours: 24 },
13
15
  { label: "7d", hours: 168 },
14
16
  { label: "30d", hours: 720 }
15
- ], O = {
17
+ ], K = {
16
18
  created: "added",
17
19
  changed: "changed",
18
20
  deleted: "removed",
@@ -20,217 +22,252 @@ const N = [
20
22
  moved_out: "moved away",
21
23
  parent: "set"
22
24
  };
23
- function W({
24
- collection: m,
25
- itemId: c,
26
- field: p,
27
- enabled: u
25
+ function z({
26
+ collection: d,
27
+ itemId: b,
28
+ field: c,
29
+ enabled: y
28
30
  }) {
29
- var d;
30
- const x = _(), [o, h] = v(24), { data: a, isLoading: g } = y({
31
- queryKey: ["number-trail", m, c, p, o],
32
- queryFn: () => x.request(
33
- C(
34
- `/lineage/${m}/${encodeURIComponent(c)}/${p}/changes?hours=${o}`
31
+ var h;
32
+ const p = T(), [u, k] = L(24), { data: a, isLoading: _ } = C({
33
+ queryKey: ["number-trail", d, b, c, u],
34
+ queryFn: () => p.request(
35
+ D(
36
+ `/lineage/${d}/${encodeURIComponent(b)}/${c}/changes?hours=${u}`
35
37
  )
36
- ).then((e) => e.data),
37
- enabled: u,
38
+ ).then((t) => t.data),
39
+ enabled: y,
38
40
  staleTime: 3e4
39
- }), i = (e) => e == null ? "—" : e.toLocaleString(void 0, { maximumFractionDigits: 2 }), r = (e) => e == null ? "" : `${e > 0 ? "+" : e < 0 ? "−" : ""}${Math.abs(e).toLocaleString(void 0, { maximumFractionDigits: 2 })}`, l = (e) => {
40
- const s = new Date(e);
41
- return (Date.now() - s.getTime()) / 36e5 < 24 ? s.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" }) : s.toLocaleDateString(void 0, { month: "short", day: "numeric" });
41
+ }), x = (t) => t == null ? "—" : t.toLocaleString(void 0, { maximumFractionDigits: 2 }), f = (t) => t == null ? "" : `${t > 0 ? "+" : t < 0 ? "−" : ""}${Math.abs(t).toLocaleString(void 0, { maximumFractionDigits: 2 })}`, o = (t) => {
42
+ const m = new Date(t);
43
+ return (Date.now() - m.getTime()) / 36e5 < 24 ? m.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" }) : m.toLocaleDateString(void 0, { month: "short", day: "numeric" });
42
44
  };
43
- return /* @__PURE__ */ n("div", { className: "mt-2 border-t border-slate-100 pt-1.5 dark:border-border", "data-number-trail": !0, children: [
44
- /* @__PURE__ */ n("div", { className: "flex items-center gap-2 px-1", children: [
45
- /* @__PURE__ */ t("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "What changed it" }),
46
- /* @__PURE__ */ t("div", { className: "ml-auto flex gap-0.5", children: N.map((e) => /* @__PURE__ */ t(
45
+ return /* @__PURE__ */ s("div", { className: "mt-2 border-t border-slate-100 pt-1.5 dark:border-border", "data-number-trail": !0, children: [
46
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2 px-1", children: [
47
+ /* @__PURE__ */ n("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "What changed it" }),
48
+ /* @__PURE__ */ n("div", { className: "ml-auto flex gap-0.5", children: S.map((t) => /* @__PURE__ */ n(
47
49
  "button",
48
50
  {
49
51
  type: "button",
50
- onClick: () => h(e.hours),
51
- "data-trail-window": e.label,
52
- className: f(
52
+ onClick: () => k(t.hours),
53
+ "data-trail-window": t.label,
54
+ className: w(
53
55
  "rounded px-1.5 py-px text-[10.5px]",
54
- o === e.hours ? "bg-nvr-cyan text-white" : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
56
+ u === t.hours ? "bg-nvr-cyan text-white" : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
55
57
  ),
56
- children: e.label
58
+ children: t.label
57
59
  },
58
- e.hours
60
+ t.hours
59
61
  )) })
60
62
  ] }),
61
- g && /* @__PURE__ */ t("p", { className: "px-1 py-1 text-slate-400", children: "Reading the trail…" }),
62
- a && a.events.length === 0 && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-slate-400", children: [
63
+ _ && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-slate-400", children: "Reading the trail…" }),
64
+ a && a.events.length === 0 && /* @__PURE__ */ s("p", { className: "px-1 py-1 text-slate-400", children: [
63
65
  "Nothing moved this figure in the last ",
64
- (d = N.find((e) => e.hours === o)) == null ? void 0 : d.label,
66
+ (h = S.find((t) => t.hours === u)) == null ? void 0 : h.label,
65
67
  "."
66
68
  ] }),
67
- a && a.events.length > 0 && /* @__PURE__ */ n(k, { children: [
68
- /* @__PURE__ */ n(
69
+ a && a.events.length > 0 && /* @__PURE__ */ s(F, { children: [
70
+ /* @__PURE__ */ s(
69
71
  "p",
70
72
  {
71
73
  className: "px-1 py-1 text-[11px] text-slate-600 dark:text-slate-300",
72
74
  "data-trail-net": a.net,
73
75
  children: [
74
- /* @__PURE__ */ t("span", { className: "font-medium tabular-nums", children: r(a.net) }),
76
+ /* @__PURE__ */ n("span", { className: "font-medium tabular-nums", children: f(a.net) }),
75
77
  " across",
76
78
  " ",
77
79
  a.events.length,
78
80
  " change",
79
81
  a.events.length === 1 ? "" : "s",
80
- a.value_then_estimate != null && /* @__PURE__ */ n("span", { className: "text-slate-400", children: [
82
+ a.value_then_estimate != null && /* @__PURE__ */ s("span", { className: "text-slate-400", children: [
81
83
  " ",
82
84
  "· was about ",
83
- /* @__PURE__ */ t("span", { className: "tabular-nums", children: i(a.value_then_estimate) })
85
+ /* @__PURE__ */ n("span", { className: "tabular-nums", children: x(a.value_then_estimate) })
84
86
  ] })
85
87
  ]
86
88
  }
87
89
  ),
88
- /* @__PURE__ */ t("div", { className: "max-h-[200px] space-y-px overflow-y-auto", children: a.events.map((e, s) => {
89
- var b;
90
- return /* @__PURE__ */ n(
90
+ /* @__PURE__ */ n("div", { className: "max-h-[200px] space-y-px overflow-y-auto", children: a.events.map((t, m) => {
91
+ var g;
92
+ return /* @__PURE__ */ s(
91
93
  "div",
92
94
  {
93
95
  className: "flex items-baseline gap-2 rounded px-1 py-0.5 hover:bg-slate-50 dark:hover:bg-muted",
94
- title: e.comment ?? void 0,
95
- "data-trail-event": e.action,
96
+ title: t.comment ?? void 0,
97
+ "data-trail-event": t.action,
96
98
  children: [
97
- /* @__PURE__ */ t("span", { className: "w-12 shrink-0 text-[10.5px] tabular-nums text-slate-400", children: l(e.at) }),
98
- /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: [
99
- /* @__PURE__ */ t("span", { className: "text-slate-400", children: ((b = e.by) == null ? void 0 : b.name) ?? (e.via_import ? "an import" : "system") }),
99
+ /* @__PURE__ */ n("span", { className: "w-12 shrink-0 text-[10.5px] tabular-nums text-slate-400", children: o(t.at) }),
100
+ /* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: [
101
+ /* @__PURE__ */ n("span", { className: "text-slate-400", children: ((g = t.by) == null ? void 0 : g.name) ?? (t.via_import ? "an import" : "system") }),
100
102
  " ",
101
- O[e.action] ?? e.action,
103
+ K[t.action] ?? t.action,
102
104
  " ",
103
- /* @__PURE__ */ t("span", { className: "text-slate-800 dark:text-slate-100", children: e.label }),
104
- e.action === "changed" && e.from != null && e.to != null && /* @__PURE__ */ n("span", { className: "text-slate-400", children: [
105
+ /* @__PURE__ */ n("span", { className: "text-slate-800 dark:text-slate-100", children: t.label }),
106
+ t.action === "changed" && t.from != null && t.to != null && /* @__PURE__ */ s("span", { className: "text-slate-400", children: [
105
107
  " ",
106
- i(e.from),
108
+ x(t.from),
107
109
  " → ",
108
- i(e.to)
110
+ x(t.to)
109
111
  ] }),
110
- e.via_import && /* @__PURE__ */ t("span", { className: "ml-1 rounded bg-slate-100 px-1 text-[9.5px] uppercase text-slate-500 dark:bg-muted", children: "import" })
112
+ t.via_import && /* @__PURE__ */ n("span", { className: "ml-1 rounded bg-slate-100 px-1 text-[9.5px] uppercase text-slate-500 dark:bg-muted", children: "import" })
111
113
  ] }),
112
- /* @__PURE__ */ t(
114
+ /* @__PURE__ */ n(
113
115
  "span",
114
116
  {
115
- className: f(
117
+ className: w(
116
118
  "shrink-0 font-mono tabular-nums",
117
- (e.delta ?? 0) > 0 ? "text-[#15803d] dark:text-[#9fbf8a]" : (e.delta ?? 0) < 0 ? "text-[#b91c1c] dark:text-[#e08383]" : "text-slate-400"
119
+ (t.delta ?? 0) > 0 ? "text-[#15803d] dark:text-[#9fbf8a]" : (t.delta ?? 0) < 0 ? "text-[#b91c1c] dark:text-[#e08383]" : "text-slate-400"
118
120
  ),
119
- children: r(e.delta)
121
+ children: f(t.delta)
120
122
  }
121
123
  )
122
124
  ]
123
125
  },
124
- s
126
+ m
125
127
  );
126
128
  }) }),
127
- a.truncated && /* @__PURE__ */ t("p", { className: "px-1 pt-1 text-[10.5px] text-slate-400", children: "Only the first 300 changes are shown." }),
128
- a.note && /* @__PURE__ */ t("p", { className: "px-1 pt-1 text-[10.5px] text-slate-400", children: a.note })
129
+ a.truncated && /* @__PURE__ */ n("p", { className: "px-1 pt-1 text-[10.5px] text-slate-400", children: "Only the first 300 changes are shown." }),
130
+ a.note && /* @__PURE__ */ n("p", { className: "px-1 pt-1 text-[10.5px] text-slate-400", children: a.note })
129
131
  ] })
130
132
  ] });
131
133
  }
132
- function M({
133
- collection: m,
134
- itemId: c,
135
- field: p,
136
- noun: u = "lines"
134
+ const G = {
135
+ sum: "Sum",
136
+ count: "Count",
137
+ avg: "Average",
138
+ min: "Lowest",
139
+ max: "Highest",
140
+ median: "Median",
141
+ distinct_count: "Distinct count",
142
+ weighted_avg: "Weighted average"
143
+ };
144
+ function te({
145
+ collection: d,
146
+ itemId: b,
147
+ field: c,
148
+ noun: y = "lines"
137
149
  }) {
138
- const [x, o] = v(!1), h = S(1500), { data: a, isLoading: g } = $(m, c, p, h), i = F(a, u), r = (l) => l == null ? "—" : Number(l).toLocaleString(void 0, { maximumFractionDigits: 2 });
139
- return !i && !g ? null : /* @__PURE__ */ n(L, { open: x, onOpenChange: o, children: [
140
- /* @__PURE__ */ t(T, { asChild: !0, children: /* @__PURE__ */ n(
150
+ const [p, u] = L(!1), k = q(1500), { data: a, isLoading: _ } = j(d, b, c, k), x = E(a, y), f = T(), { data: o } = C({
151
+ queryKey: A.fieldConfig(d),
152
+ queryFn: () => f.request(D(`/field-config/${d}`)).then((e) => e.data ?? []),
153
+ enabled: p && !!d,
154
+ staleTime: 12e4
155
+ }), h = (e) => {
156
+ var i, r;
157
+ return ((r = (i = o == null ? void 0 : o.find((l) => l.field === e)) == null ? void 0 : i.label) == null ? void 0 : r.trim()) || N(e.replace(/_/g, " "));
158
+ }, t = (e) => {
159
+ const i = /* @__PURE__ */ new Set([
160
+ ...(o ?? []).map((r) => r.field),
161
+ ...Object.keys((a == null ? void 0 : a.inputs) ?? {})
162
+ ]);
163
+ return e.replace(/\{\{\s*([A-Za-z_]\w*)\s*\}\}/g, (r, l) => h(l)).replace(/\b(?:item\.)?([A-Za-z_]\w*)\b/g, (r, l) => i.has(l) ? h(l) : r);
164
+ }, m = (e) => e == null ? "—" : Number(e).toLocaleString(void 0, { maximumFractionDigits: 2 }), g = (e, i) => {
165
+ if (e == null || e === "") return "—";
166
+ const r = i ? o == null ? void 0 : o.find((l) => l.field === i) : void 0;
167
+ return r ? $(e, r) : m(e);
168
+ }, v = (e) => g(e, c);
169
+ return !x && !_ ? null : /* @__PURE__ */ s(W, { open: p, onOpenChange: u, children: [
170
+ /* @__PURE__ */ n(H, { asChild: !0, children: /* @__PURE__ */ s(
141
171
  "button",
142
172
  {
143
173
  type: "button",
144
174
  "data-copy-skip": !0,
145
- onClick: (l) => l.stopPropagation(),
146
- className: f(
175
+ onClick: (e) => e.stopPropagation(),
176
+ className: w(
147
177
  // The Σ alone carries the affordance in every format (Rob,
148
178
  // 2026-09-25: the inline formula ate the band's width); the
149
179
  // formula is the hover tip, the breakdown is the click.
150
180
  "inline-flex shrink-0 items-center self-center text-[11px] font-medium leading-none text-slate-400 hover:text-nvr-cyan dark:text-slate-500",
151
- x && "text-nvr-cyan"
181
+ p && "text-nvr-cyan"
152
182
  ),
153
183
  "data-tip": "Where this number comes from",
154
184
  children: [
155
- /* @__PURE__ */ t(w, { className: "h-2.5 w-2.5 shrink-0", "aria-hidden": "true" }),
156
- /* @__PURE__ */ t("span", { className: "sr-only", children: i ?? "Where this number comes from" })
185
+ /* @__PURE__ */ n(O, { className: "h-2.5 w-2.5 shrink-0", "aria-hidden": "true" }),
186
+ /* @__PURE__ */ n("span", { className: "sr-only", children: x ?? "Where this number comes from" })
157
187
  ]
158
188
  }
159
189
  ) }),
160
- /* @__PURE__ */ n(
161
- D,
190
+ /* @__PURE__ */ s(
191
+ P,
162
192
  {
163
193
  align: "start",
164
194
  className: "w-[380px] p-2 text-[11.5px]",
165
- onClick: (l) => l.stopPropagation(),
195
+ onClick: (e) => e.stopPropagation(),
166
196
  children: [
167
- /* @__PURE__ */ t("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Where this number comes from" }),
168
- a && (a.kind === "read" || a.kind === "write") && /* @__PURE__ */ n("div", { className: "mb-1.5 px-1", "data-lineage-formula": !0, children: [
169
- /* @__PURE__ */ t("p", { className: "font-mono text-[11px] text-slate-700 dark:text-foreground", children: a.formula }),
170
- /* @__PURE__ */ t("p", { className: "mt-0.5 text-[10.5px] text-slate-400", children: a.kind === "read" ? "Computed on read from" : "Stored on save from" }),
171
- /* @__PURE__ */ t("dl", { className: "mt-1 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5", children: Object.entries(a.inputs ?? {}).map(([l, d]) => /* @__PURE__ */ n("div", { className: "contents", children: [
172
- /* @__PURE__ */ t("dt", { className: "font-mono text-[10.5px] text-slate-500", children: l }),
173
- /* @__PURE__ */ t("dd", { className: "text-right tabular-nums text-slate-800 dark:text-foreground", children: r(d) })
174
- ] }, l)) })
197
+ /* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Where this number comes from" }),
198
+ a && (a.kind === "read" || a.kind === "write") && /* @__PURE__ */ s("div", { className: "mb-1.5 px-1", "data-lineage-formula": !0, children: [
199
+ /* @__PURE__ */ n(
200
+ "p",
201
+ {
202
+ className: "text-[11.5px] font-medium text-slate-700 dark:text-foreground",
203
+ "data-tip": a.formula,
204
+ children: t(String(a.formula ?? ""))
205
+ }
206
+ ),
207
+ /* @__PURE__ */ n("p", { className: "mt-0.5 text-[10.5px] text-slate-400", children: a.kind === "read" ? "Computed on read from" : "Stored on save from" }),
208
+ /* @__PURE__ */ n("dl", { className: "mt-1 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5", children: Object.entries(a.inputs ?? {}).map(([e, i]) => /* @__PURE__ */ s("div", { className: "contents", children: [
209
+ /* @__PURE__ */ n("dt", { className: "text-[11px] text-slate-500", "data-tip": e, children: h(e) }),
210
+ /* @__PURE__ */ n("dd", { className: "text-right tabular-nums text-slate-800 dark:text-foreground", children: g(i, e) })
211
+ ] }, e)) })
175
212
  ] }),
176
- ((a == null ? void 0 : a.sources) ?? []).map((l, d) => {
177
- var e;
178
- return /* @__PURE__ */ n("div", { className: "mb-1.5", children: [
179
- /* @__PURE__ */ n("p", { className: "px-1 text-[10.5px] text-slate-400", children: [
180
- (l.aggregate ?? "sum").toUpperCase(),
181
- l.value_field ? ` of ${l.value_field.replace(/_/g, " ")}` : "",
213
+ ((a == null ? void 0 : a.sources) ?? []).map((e, i) => {
214
+ var r;
215
+ return /* @__PURE__ */ s("div", { className: "mb-1.5", children: [
216
+ /* @__PURE__ */ s("p", { className: "px-1 text-[10.5px] text-slate-400", children: [
217
+ G[e.aggregate ?? "sum"] ?? N(e.aggregate ?? "sum"),
218
+ e.value_field ? ` of ${N(e.value_field.replace(/_/g, " "))}` : "",
182
219
  " across",
183
220
  " ",
184
- l.collection.replace(/_/g, " ")
221
+ N(e.collection.replace(/_/g, " "))
185
222
  ] }),
186
- l.note && /* @__PURE__ */ t("p", { className: "px-1 py-1 text-slate-400", children: l.note }),
187
- l.error && /* @__PURE__ */ t("p", { className: "px-1 py-1 text-amber-600", children: l.error }),
188
- /* @__PURE__ */ t("div", { className: "mt-0.5 max-h-[220px] space-y-px overflow-y-auto", children: l.rows.map((s) => /* @__PURE__ */ n(
223
+ e.note && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-slate-400", children: e.note }),
224
+ e.error && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-amber-600", children: e.error }),
225
+ /* @__PURE__ */ n("div", { className: "mt-0.5 max-h-[220px] space-y-px overflow-y-auto", children: e.rows.map((l) => /* @__PURE__ */ s(
189
226
  "div",
190
227
  {
191
228
  className: "flex items-baseline gap-2 rounded px-1 py-0.5 hover:bg-slate-50 dark:hover:bg-muted",
192
229
  children: [
193
- /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: s.label }),
194
- /* @__PURE__ */ t("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: r(s.value) })
230
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: l.label }),
231
+ /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: e.aggregate === "count" ? m(l.value) : v(l.value) })
195
232
  ]
196
233
  },
197
- s.id
234
+ l.id
198
235
  )) }),
199
- l.subtotal != null && /* @__PURE__ */ n("p", { className: "border-t border-slate-100 px-1 pt-1 text-right font-medium text-slate-700 dark:border-border dark:text-slate-200", children: [
236
+ e.subtotal != null && /* @__PURE__ */ s("p", { className: "border-t border-slate-100 px-1 pt-1 text-right font-medium text-slate-700 dark:border-border dark:text-slate-200", children: [
200
237
  "subtotal ",
201
- r(l.subtotal)
238
+ v(e.subtotal)
202
239
  ] }),
203
- (((e = l.excluded) == null ? void 0 : e.length) ?? 0) > 0 && /* @__PURE__ */ n("div", { className: "mt-1 rounded bg-slate-50 px-1 py-1 dark:bg-muted/40", children: [
204
- /* @__PURE__ */ n("p", { className: "text-[10.5px] text-slate-500 dark:text-muted-foreground", children: [
205
- l.excluded.length,
240
+ (((r = e.excluded) == null ? void 0 : r.length) ?? 0) > 0 && /* @__PURE__ */ s("div", { className: "mt-1 rounded bg-slate-50 px-1 py-1 dark:bg-muted/40", children: [
241
+ /* @__PURE__ */ s("p", { className: "text-[10.5px] text-slate-500 dark:text-muted-foreground", children: [
242
+ e.excluded.length,
206
243
  " excluded —",
207
244
  " ",
208
- l.excluded[0].reason.replace(/^does not match: /, "")
245
+ e.excluded[0].reason.replace(/^does not match: /, "")
209
246
  ] }),
210
- l.excluded.slice(0, 8).map((s) => /* @__PURE__ */ n(
247
+ e.excluded.slice(0, 8).map((l) => /* @__PURE__ */ s(
211
248
  "div",
212
249
  {
213
250
  className: "flex items-baseline gap-2 px-0.5 text-[11px] text-slate-400",
214
251
  children: [
215
- /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children: s.label }),
216
- /* @__PURE__ */ t("span", { className: "shrink-0 font-mono tabular-nums", children: r(s.value) })
252
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children: l.label }),
253
+ /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums", children: v(l.value) })
217
254
  ]
218
255
  },
219
- s.id
256
+ l.id
220
257
  ))
221
258
  ] })
222
- ] }, d);
259
+ ] }, i);
223
260
  }),
224
- (a == null ? void 0 : a.stored_value) != null && /* @__PURE__ */ n("p", { className: "px-1 pt-1 text-right text-[11px] text-slate-500", children: [
261
+ (a == null ? void 0 : a.stored_value) != null && /* @__PURE__ */ s("p", { className: "px-1 pt-1 text-right text-[11px] text-slate-500", children: [
225
262
  "stored ",
226
- r(a.stored_value)
263
+ v(a.stored_value)
227
264
  ] }),
228
- /* @__PURE__ */ t(W, { collection: m, itemId: c, field: p, enabled: x })
265
+ /* @__PURE__ */ n(z, { collection: d, itemId: b, field: c, enabled: p })
229
266
  ]
230
267
  }
231
268
  )
232
269
  ] });
233
270
  }
234
271
  export {
235
- M as HeaderRollupExplainer
272
+ te as HeaderRollupExplainer
236
273
  };
@@ -223,7 +223,7 @@ const we = /* @__PURE__ */ new Set([
223
223
  },
224
224
  e.field
225
225
  )),
226
- /* @__PURE__ */ t("th", { className: "w-16" })
226
+ /* @__PURE__ */ t("th", { className: "w-16", children: /* @__PURE__ */ t("span", { className: "sr-only", children: "Actions" }) })
227
227
  ] }) }),
228
228
  /* @__PURE__ */ a("tbody", { children: [
229
229
  d && G.map((e, r) => /* @__PURE__ */ a("tr", { className: "border-b border-slate-100 bg-amber-50/40", children: [