@nivaro/react 0.3.52 → 0.3.54

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 (41) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +47 -3
  4. package/dist/shared/components/ItemEditForm.js +4196 -4163
  5. package/dist/shared/components/NotificationBell.js +163 -150
  6. package/dist/shared/components/PageRenderer.js +645 -593
  7. package/dist/shared/components/ProfileView.js +36 -34
  8. package/dist/shared/components/QueryStatStrip.js +96 -89
  9. package/dist/shared/components/QueryTable.js +214 -215
  10. package/dist/shared/components/ReportView.js +548 -529
  11. package/dist/shared/components/alerts/AlertManagerView.js +346 -320
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
  13. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
  14. package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
  15. package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
  16. package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
  17. package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
  19. package/dist/shared/components/item-edit/PlanGrid.js +718 -705
  20. package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
  21. package/dist/shared/components/item-edit/SummaryPanel.js +415 -361
  22. package/dist/shared/components/item-edit/line-qty.js +115 -53
  23. package/dist/shared/components/item-edit/save-outcome.js +48 -0
  24. package/dist/shared/components/item-edit/save-refusal.js +18 -18
  25. package/dist/shared/components/item-edit/stale-banner.js +13 -0
  26. package/dist/shared/components/item-edit/usePersonalDefaults.js +225 -220
  27. package/dist/shared/components/panels/CommentPanel.js +204 -197
  28. package/dist/shared/components/panels/ItemLockBanner.js +318 -291
  29. package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
  30. package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
  31. package/dist/shared/components/panels/RevisionsPanel.js +101 -106
  32. package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
  33. package/dist/shared/components/panels/requirement-side-effects.js +46 -29
  34. package/dist/shared/components/queue/QueueItemSheet.js +219 -146
  35. package/dist/shared/components/queue/QueueWorklist.js +738 -730
  36. package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
  37. package/dist/shared/lib/activity-sentence.js +236 -227
  38. package/dist/shared/lib/draft-store.js +35 -29
  39. package/dist/shared/lib/page-widget-access.js +11 -0
  40. package/dist/shared/lib/record-ref.js +43 -34
  41. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { jsxs as a, jsx as e, Fragment as X } from "react/jsx-runtime";
2
2
  import { readUser as he, readUserCard as be, updateUser as oe, readMyScopes as xe, saveMyScopeDefaults as ge, readItems as te } from "@nivaro/sdk";
3
- import { useQueryClient as K, useQuery as v, useMutation as w } from "@tanstack/react-query";
3
+ import { useQueryClient as M, useQuery as v, useMutation as w } from "@tanstack/react-query";
4
4
  import { Loader2 as ie, Camera as fe, Building2 as ye, Mail as ve, Phone as ke, Clock as Ne, Undo2 as we, Check as Se, UserRound as _e, Filter as Ce, LogOut as qe, ShieldCheck as Pe } from "lucide-react";
5
5
  import { useRef as ue, useEffect as Te, useState as C, useMemo as Ae } from "react";
6
6
  import { useNivaroClient as A, useItemEditAuth as pe } from "../context.js";
@@ -8,8 +8,8 @@ import { get as T, patch as G, post as ee, put as Fe, del as Oe } from "../lib/c
8
8
  import { playNotificationSound as de } from "../lib/notification-sound.js";
9
9
  import { BRAND_ACCENT as ae, parseThemeAccents as De, DEFAULT_THEME_ACCENTS as ce } from "../lib/theme-accents.js";
10
10
  import { announceLocalPrefs as re } from "../lib/user-sync.js";
11
- import { cn as Q, setDisplayTimezone as Ke } from "../lib/utils.js";
12
- import { CustomStatusEditor as Le, activeCustomStatus as Me } from "./CustomStatusEditor.js";
11
+ import { cn as Q, setDisplayTimezone as Me } from "../lib/utils.js";
12
+ import { CustomStatusEditor as Ke, activeCustomStatus as Le } from "./CustomStatusEditor.js";
13
13
  import { mergeNotifyRulesClient as Re, NOTIFY_RULE_CATS as Ie, NotificationRulesEditor as je } from "./notifications/NotificationRulesEditor.js";
14
14
  import { TestMyRules as Ee } from "./notifications/TestMyRules.js";
15
15
  import { AgentsPanel as Qe } from "./profile/AgentsPanel.js";
@@ -32,7 +32,7 @@ const at = (s) => [s.first_name, s.last_name].filter(Boolean).join(" ") || (s.em
32
32
  return (`${((u = s.first_name) == null ? void 0 : u[0]) ?? ""}${((t = s.last_name) == null ? void 0 : t[0]) ?? ""}` || (s.email ?? "?").slice(0, 2)).toUpperCase();
33
33
  }, nt = Ie;
34
34
  function st() {
35
- const s = A(), u = K(), { data: t = [] } = v({
35
+ const s = A(), u = M(), { data: t = [] } = v({
36
36
  queryKey: ["nvr-profile-fields"],
37
37
  queryFn: () => s.request(T("/profile-fields/mine")).then((r) => r.data ?? []).catch(() => [])
38
38
  }), [i, o] = C(null), l = w({
@@ -110,7 +110,7 @@ function st() {
110
110
  }
111
111
  function lt() {
112
112
  var Y, W, se;
113
- const s = A(), u = K(), { data: t } = v({
113
+ const s = A(), u = M(), { data: t } = v({
114
114
  queryKey: ["nvr-profile-prefs"],
115
115
  queryFn: () => s.request(T("/users/me")).then((n) => {
116
116
  var b;
@@ -161,8 +161,8 @@ function lt() {
161
161
  ...r.teams_muted_until ? { teams_muted_until: r.teams_muted_until } : {}
162
162
  };
163
163
  q.mutate(b), F.mutate(b);
164
- }, $ = (n) => g({ ...r, ...n }), L = (t == null ? void 0 : t.notification_sounds) ?? {}, x = (n, b) => {
165
- const N = { ...L };
164
+ }, $ = (n) => g({ ...r, ...n }), K = (t == null ? void 0 : t.notification_sounds) ?? {}, x = (n, b) => {
165
+ const N = { ...K };
166
166
  b === "default" ? delete N[n] : N[n] = b, b !== "default" && de(b, { preview: !0 }), f.mutate({ notification_sounds: Object.keys(N).length ? N : null });
167
167
  }, { data: R } = v({
168
168
  queryKey: ["nvr-noise-suggestions"],
@@ -182,10 +182,10 @@ function lt() {
182
182
  localStorage.setItem("nvr-noise-dismissed", JSON.stringify({ at: Date.now(), cats: b }));
183
183
  } catch {
184
184
  }
185
- }, J = Number.isInteger(Number(t == null ? void 0 : t.digest_hour)) ? Number(t == null ? void 0 : t.digest_hour) : 7, D = (n) => `${n % 12 === 0 ? 12 : n % 12}:45 ${n < 12 ? "AM" : "PM"}`, [z, M] = C(null), E = w({
185
+ }, J = Number.isInteger(Number(t == null ? void 0 : t.digest_hour)) ? Number(t == null ? void 0 : t.digest_hour) : 7, D = (n) => `${n % 12 === 0 ? 12 : n % 12}:45 ${n < 12 ? "AM" : "PM"}`, [z, L] = C(null), E = w({
186
186
  mutationFn: () => s.request(ee("/users/me/digest-test", {})),
187
- onSuccess: (n) => M(n.data.note),
188
- onError: () => M("Test send failed — try again.")
187
+ onSuccess: (n) => L(n.data.note),
188
+ onError: () => L("Test send failed — try again.")
189
189
  }), V = nt.some((n) => k(n.key) === "daily"), Z = ({ text: n }) => /* @__PURE__ */ e(
190
190
  "span",
191
191
  {
@@ -346,7 +346,7 @@ function lt() {
346
346
  U,
347
347
  {
348
348
  ariaLabel: `Sound for ${b}`,
349
- value: L[n] ?? "default",
349
+ value: K[n] ?? "default",
350
350
  options: [
351
351
  { value: "default", label: "Default" },
352
352
  { value: "off", label: "None" },
@@ -442,7 +442,7 @@ function lt() {
442
442
  );
443
443
  }
444
444
  function ot() {
445
- const s = A(), u = K(), { data: t } = v({
445
+ const s = A(), u = M(), { data: t } = v({
446
446
  queryKey: ["nvr-profile-prefs"],
447
447
  queryFn: () => s.request(T("/users/me")).then((c) => {
448
448
  var m;
@@ -480,7 +480,7 @@ function ot() {
480
480
  );
481
481
  }
482
482
  function it() {
483
- const s = A(), u = K(), [t, i] = C(""), o = (() => {
483
+ const s = A(), u = M(), [t, i] = C(""), o = (() => {
484
484
  try {
485
485
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
486
486
  } catch {
@@ -505,7 +505,7 @@ function it() {
505
505
  }), m = typeof (c == null ? void 0 : c.timezone) == "string" ? c.timezone : null, r = w({
506
506
  mutationFn: (p) => s.request(G("/users/me/preferences", { timezone: p })),
507
507
  onSuccess: (p, S) => {
508
- Ke(S), i(""), u.invalidateQueries({ queryKey: ["nvr-profile-prefs"] });
508
+ Me(S), i(""), u.invalidateQueries({ queryKey: ["nvr-profile-prefs"] });
509
509
  }
510
510
  }), h = t.length > 1 ? l.filter((p) => p.toLowerCase().includes(t.toLowerCase())).slice(0, 8) : [];
511
511
  return /* @__PURE__ */ a(
@@ -559,7 +559,7 @@ function it() {
559
559
  );
560
560
  }
561
561
  function dt() {
562
- const s = A(), u = K(), { data: t } = v({
562
+ const s = A(), u = M(), { data: t } = v({
563
563
  queryKey: ["nvr-profile-scopes"],
564
564
  queryFn: () => s.request(xe()).then((o) => o.data)
565
565
  }), i = w({
@@ -639,7 +639,7 @@ function ct({
639
639
  enabled: g.length > 0
640
640
  });
641
641
  for (const d of $) q.set(String(d.id), d.label);
642
- const L = (d) => {
642
+ const K = (d) => {
643
643
  const y = F.has(String(d));
644
644
  i(y ? u.filter((P) => String(P) !== String(d)) : [...u, d]);
645
645
  }, x = c.trim().toLowerCase(), R = x ? k.filter((d) => d.label.toLowerCase().includes(x)) : k, I = x.length === 0 ? k.slice(0, 30) : O && _.length === 0 ? R.slice(0, 30) : _, j = f && (r || x.length > 0);
@@ -671,7 +671,7 @@ function ct({
671
671
  "button",
672
672
  {
673
673
  type: "button",
674
- onClick: () => L(d),
674
+ onClick: () => K(d),
675
675
  "aria-label": `Remove ${q.get(String(d)) ?? d}`,
676
676
  className: "rounded-full px-1 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200",
677
677
  children: "×"
@@ -704,7 +704,7 @@ function ct({
704
704
  "button",
705
705
  {
706
706
  type: "button",
707
- onClick: () => L(d.id),
707
+ onClick: () => K(d.id),
708
708
  className: Q(
709
709
  "flex w-full items-center justify-between px-2.5 py-1.5 text-left text-[12px] hover:bg-slate-50 dark:hover:bg-muted",
710
710
  y ? "font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-600 dark:text-slate-300"
@@ -730,7 +730,7 @@ function ct({
730
730
  "button",
731
731
  {
732
732
  type: "button",
733
- onClick: () => L(d.id),
733
+ onClick: () => K(d.id),
734
734
  className: Q(
735
735
  "rounded-full border px-2.5 py-0.5 text-[11.5px] transition-colors",
736
736
  y ? "border-nvr-cyan bg-nvr-cyan/10 font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:border-slate-300 dark:border-border"
@@ -749,7 +749,7 @@ function mt() {
749
749
  queryKey: ["nvr-settings-2fa"],
750
750
  queryFn: () => t.request({ _method: "GET", _path: "/settings/" }).then((g) => (g == null ? void 0 : g.data) ?? null).catch(() => null),
751
751
  staleTime: 6e5
752
- }), u = (s == null ? void 0 : s.two_factor_enabled) !== !1, t = A(), i = K(), [o, l] = C(null), [c, m] = C(""), [r, h] = C(null), { data: p } = v({
752
+ }), u = (s == null ? void 0 : s.two_factor_enabled) !== !1, t = A(), i = M(), [o, l] = C(null), [c, m] = C(""), [r, h] = C(null), { data: p } = v({
753
753
  queryKey: ["nvr-profile-totp"],
754
754
  queryFn: () => t.request({ _method: "GET", _path: "/two-factor/status" }).then((g) => g.data)
755
755
  }), S = () => void i.invalidateQueries({ queryKey: ["nvr-profile-totp"] }), k = w({
@@ -942,7 +942,7 @@ function ut({
942
942
  pushServiceWorker: t
943
943
  }) {
944
944
  var j;
945
- const i = A(), o = K(), l = pe(), c = !0, m = "me", { data: r } = v({
945
+ const i = A(), o = M(), l = pe(), c = !0, m = "me", { data: r } = v({
946
946
  queryKey: ["nvr-profile-user", m],
947
947
  queryFn: () => i.request(he(m)).then((d) => d.data),
948
948
  enabled: c
@@ -964,18 +964,18 @@ function ut({
964
964
  onSuccess: () => {
965
965
  k(null), o.invalidateQueries({ queryKey: ["nvr-profile-user"] }), o.invalidateQueries({ queryKey: ["nvr-profile-card"] });
966
966
  }
967
- }), [q, g] = C(pt), $ = ue(null), L = w({
967
+ }), [q, g] = C(pt), $ = ue(null), K = w({
968
968
  mutationFn: async (d) => {
969
969
  const y = await new Promise((P, J) => {
970
970
  const D = new Image(), z = URL.createObjectURL(d);
971
971
  D.onload = () => {
972
972
  URL.revokeObjectURL(z);
973
- const M = 96, E = document.createElement("canvas");
974
- E.width = M, E.height = M;
973
+ const L = 96, E = document.createElement("canvas");
974
+ E.width = L, E.height = L;
975
975
  const V = E.getContext("2d");
976
976
  if (!V) return J(new Error("canvas unavailable"));
977
- const Z = Math.max(M / D.width, M / D.height), Y = D.width * Z, W = D.height * Z;
978
- V.drawImage(D, (M - Y) / 2, (M - W) / 2, Y, W), P(E.toDataURL("image/jpeg", 0.85));
977
+ const Z = Math.max(L / D.width, L / D.height), Y = D.width * Z, W = D.height * Z;
978
+ V.drawImage(D, (L - Y) / 2, (L - W) / 2, Y, W), P(E.toDataURL("image/jpeg", 0.85));
979
979
  }, D.onerror = () => {
980
980
  URL.revokeObjectURL(z), J(new Error("not an image"));
981
981
  }, D.src = z;
@@ -1035,7 +1035,7 @@ function ut({
1035
1035
  return (d = $.current) == null ? void 0 : d.click();
1036
1036
  },
1037
1037
  className: "absolute -right-1 -top-1 flex h-7 w-7 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-500 shadow-sm transition-colors hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:bg-background dark:text-slate-300 dark:hover:text-nvr-cyan",
1038
- children: L.isPending ? /* @__PURE__ */ e(ie, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(fe, { className: "h-3.5 w-3.5" })
1038
+ children: K.isPending ? /* @__PURE__ */ e(ie, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(fe, { className: "h-3.5 w-3.5" })
1039
1039
  }
1040
1040
  ),
1041
1041
  /* @__PURE__ */ e(
@@ -1048,7 +1048,7 @@ function ut({
1048
1048
  onChange: (d) => {
1049
1049
  var P;
1050
1050
  const y = (P = d.target.files) == null ? void 0 : P[0];
1051
- y && L.mutate(y), d.target.value = "";
1051
+ y && K.mutate(y), d.target.value = "";
1052
1052
  }
1053
1053
  }
1054
1054
  )
@@ -1064,9 +1064,9 @@ function ut({
1064
1064
  r && // The same status the chat panel's Online tab sets — one editor,
1065
1065
  // one preference, so the profile always agrees with the top bar.
1066
1066
  /* @__PURE__ */ e(
1067
- Le,
1067
+ Ke,
1068
1068
  {
1069
- status: Me(
1069
+ status: Le(
1070
1070
  (j = r.preferences) == null ? void 0 : j.custom_status
1071
1071
  ),
1072
1072
  showExpiry: !0,
@@ -1360,7 +1360,7 @@ function bt() {
1360
1360
  ] });
1361
1361
  }
1362
1362
  function xt() {
1363
- const s = A(), u = K(), { data: t = [] } = v({
1363
+ const s = A(), u = M(), { data: t = [] } = v({
1364
1364
  queryKey: ["my-reminders"],
1365
1365
  queryFn: () => s.request(T("/reminders")).then((p) => p.data).catch(() => []),
1366
1366
  staleTime: 3e4
@@ -1493,7 +1493,7 @@ function gt() {
1493
1493
  ] });
1494
1494
  }
1495
1495
  function ft() {
1496
- const s = A(), u = K(), { data: t } = v({
1496
+ const s = A(), u = M(), { data: t } = v({
1497
1497
  queryKey: ["my-security"],
1498
1498
  queryFn: () => s.request(T("/security/my/sessions")).then((l) => l.data).catch(() => ({ sessions: [], logins: [] })),
1499
1499
  staleTime: 3e4
@@ -1627,7 +1627,7 @@ function yt() {
1627
1627
  ] });
1628
1628
  }
1629
1629
  function vt() {
1630
- const s = A(), u = K(), { data: t } = v({
1630
+ const s = A(), u = M(), { data: t } = v({
1631
1631
  queryKey: ["nvr-profile-prefs"],
1632
1632
  queryFn: () => s.request(T("/users/me")).then((m) => {
1633
1633
  var r;
@@ -1678,11 +1678,13 @@ function vt() {
1678
1678
  }
1679
1679
  )
1680
1680
  ] }),
1681
- /* @__PURE__ */ a("label", { className: "flex cursor-pointer items-center gap-1.5", children: [
1681
+ /* @__PURE__ */ a("label", { htmlFor: "pref-compact-numbers", className: "flex cursor-pointer items-center gap-1.5", children: [
1682
1682
  /* @__PURE__ */ e(
1683
1683
  "input",
1684
1684
  {
1685
+ id: "pref-compact-numbers",
1685
1686
  type: "checkbox",
1687
+ "aria-label": "Compact numbers (1.2M)",
1686
1688
  checked: o.compact === !0,
1687
1689
  onChange: (m) => i.mutate({ number_format: { ...o, compact: m.target.checked } }),
1688
1690
  className: "rounded"
@@ -1,74 +1,78 @@
1
- import { jsx as l, jsxs as y } from "react/jsx-runtime";
2
- import { useQuery as Q } from "@tanstack/react-query";
3
- import { useRef as S, useState as C, useLayoutEffect as A, useId as G } from "react";
1
+ import { jsx as s, jsxs as k } from "react/jsx-runtime";
2
+ import { useQuery as V } from "@tanstack/react-query";
3
+ import { useRef as _, useState as L, useLayoutEffect as B, useId as G } from "react";
4
4
  import { useNivaroClient as J } from "../context.js";
5
- import { post as V } from "../lib/commands.js";
6
- import { matchRows as H, statCoverage as X, statValue as Y, sumField as Z, fmtStat as z, compactStat as ee } from "../lib/query-stats.js";
7
- import { colorPair as I } from "./QueryTable.js";
8
- const te = /* @__PURE__ */ new Set(["ink", "muted"]), re = 150, P = 8;
9
- function ne(e, c) {
10
- const b = S(null), f = S(null);
11
- return A(() => {
12
- const d = b.current, o = f.current;
13
- if (!d || !o) {
14
- c(!0);
5
+ import { post as H } from "../lib/commands.js";
6
+ import { matchRows as X, statCoverage as Y, statValue as Z, sumField as ee, fmtStat as I, compactStat as te } from "../lib/query-stats.js";
7
+ import { colorPair as P } from "./QueryTable.js";
8
+ function re(e, a, d) {
9
+ return !d || e.query || e.format === "date" || e.format === "text" ? a : a === 0 ? null : a;
10
+ }
11
+ const ne = /* @__PURE__ */ new Set(["ink", "muted"]), oe = 150, A = 8;
12
+ function ae(e, a) {
13
+ const d = _(null), p = _(null);
14
+ return B(() => {
15
+ const f = d.current, b = p.current;
16
+ if (!f || !b) {
17
+ a(!0);
15
18
  return;
16
19
  }
17
- const x = () => c(o.offsetWidth <= d.clientWidth);
18
- if (x(), typeof ResizeObserver > "u") return;
19
- const m = new ResizeObserver(x);
20
- return m.observe(d), () => m.disconnect();
21
- }, [e]), { box: b, probe: f };
20
+ const l = () => a(b.offsetWidth <= f.clientWidth);
21
+ if (l(), typeof ResizeObserver > "u") return;
22
+ const x = new ResizeObserver(l);
23
+ return x.observe(f), () => x.disconnect();
24
+ }, [e]), { box: d, probe: p };
22
25
  }
23
- function ae({
26
+ function le({
24
27
  stat: e,
25
- rows: c,
26
- effectiveParams: b,
27
- loading: f,
28
- compact: d,
29
- onFit: o
28
+ rows: a,
29
+ effectiveParams: d,
30
+ loading: p,
31
+ compact: f,
32
+ zeroDash: b,
33
+ onFit: l
30
34
  }) {
31
- const x = J(), [m, p] = C(!1), k = G(), r = e.query, g = r ? {
35
+ const x = J(), [g, m] = L(!1), N = G(), r = e.query, v = r ? {
32
36
  ...r.params ?? {},
33
37
  ...Object.fromEntries(
34
- Object.entries(r.param_from ?? {}).map(([t, K]) => [t, b[K]])
38
+ Object.entries(r.param_from ?? {}).map(([t, Q]) => [t, d[Q]])
35
39
  )
36
- } : null, { data: N, isLoading: n } = Q({
37
- queryKey: ["query-stat", r == null ? void 0 : r.slug, JSON.stringify(g)],
40
+ } : null, { data: w, isLoading: n } = V({
41
+ queryKey: ["query-stat", r == null ? void 0 : r.slug, JSON.stringify(v)],
38
42
  queryFn: () => x.request(
39
- V(`/custom-queries/${r.slug}/execute`, { params: g })
43
+ H(`/custom-queries/${r.slug}/execute`, { params: v })
40
44
  ).then((t) => t.data ?? []),
41
45
  enabled: !!r,
42
46
  staleTime: 6e4
43
- }), u = H(c, e.row_match), s = r ? n : f, a = e.coverage && !s ? X(e, c) : null, _ = !!a && a.reporting === 0, R = e.requires_field, L = !!R && !f && !c.some((t) => t[R] != null && t[R] !== ""), i = s || _ || L ? null : Y(e, c, N ?? null), O = !s && (i == null || i === ""), M = e.format === "date" || e.format === "text", E = r ? r.label_field ? (N ?? []).map((t) => ({
47
+ }), u = X(a, e.row_match), i = r ? n : p, o = e.coverage && !i ? Y(e, a) : null, R = !!o && o.reporting === 0, C = e.requires_field, O = !!C && !p && !a.some((t) => t[C] != null && t[C] !== ""), c = i || R || O ? null : re(e, Z(e, a, w ?? null), b), M = !i && (c == null || c === ""), E = e.format === "date" || e.format === "text", $ = r ? r.label_field ? (w ?? []).map((t) => ({
44
48
  label: String(t[r.label_field] ?? "—"),
45
49
  value: Number(t[r.value_field]) || 0
46
- })) : [] : (e.details ?? []).map((t) => ({ label: t.label, value: Z(u, t.field) })), $ = typeof i == "number" && i < 0 && (e.field_subtract || e.accent_negative), w = $ ? e.accent_negative ?? "negative" : e.accent, v = M || O || !w ? null : $ ? I(w) : I(w, e.accent_dark), B = v && !te.has(String(w).trim().toLowerCase()), j = typeof i == "number" && e.field_subtract && i > 0 ? "+" : "", h = `${j}${z(
47
- i,
50
+ })) : [] : (e.details ?? []).map((t) => ({ label: t.label, value: ee(u, t.field) })), j = typeof c == "number" && c < 0 && (e.field_subtract || e.accent_negative), q = j ? e.accent_negative ?? "negative" : e.accent, h = E || M || !q ? null : j ? P(q) : P(q, e.accent_dark), D = h && !ne.has(String(q).trim().toLowerCase()), F = typeof c == "number" && e.field_subtract && c > 0 ? "+" : "", y = `${F}${I(
51
+ c,
48
52
  e.format,
49
- L ? e.requires_label ?? e.empty_label : e.empty_label
50
- )}`, F = typeof i == "number" && (e.format === void 0 || e.format === "currency" || e.format === "number"), { box: D, probe: U } = ne(F ? h : "", o), T = d && F ? `${j}${ee(i, e.format)}` : h, W = a && a.reporting > 0 && a.reporting < a.total, q = E.length > 0;
53
+ O ? e.requires_label ?? e.empty_label : e.empty_label
54
+ )}`, T = typeof c == "number" && (e.format === void 0 || e.format === "currency" || e.format === "number"), { box: U, probe: W } = ae(T ? y : "", l), z = f && T ? `${F}${te(c, e.format)}` : y, K = o && o.reporting > 0 && o.reporting < o.total, S = $.length > 0;
51
55
  return (
52
56
  // Hover is a mouse convenience; the label button below is the keyboard path.
53
57
  // biome-ignore lint/a11y/noStaticElementInteractions: see above
54
- /* @__PURE__ */ y(
58
+ /* @__PURE__ */ k(
55
59
  "div",
56
60
  {
57
61
  className: "relative min-w-0 rounded-lg border border-slate-200 bg-white px-3 py-2 dark:border-border dark:bg-card",
58
- style: v ? { "--qsa": v[0], "--qsad": v[1] } : void 0,
59
- onMouseEnter: q ? () => p(!0) : void 0,
60
- onMouseLeave: q ? () => p(!1) : void 0,
62
+ style: h ? { "--qsa": h[0], "--qsad": h[1] } : void 0,
63
+ onMouseEnter: S ? () => m(!0) : void 0,
64
+ onMouseLeave: S ? () => m(!1) : void 0,
61
65
  "data-stat-tile": e.label,
62
66
  children: [
63
- B && /* @__PURE__ */ l(
67
+ D && /* @__PURE__ */ s(
64
68
  "span",
65
69
  {
66
70
  "aria-hidden": "true",
67
71
  className: "absolute -inset-x-px -top-px h-[2px] rounded-t-lg bg-[color:var(--qsa)] dark:bg-[color:var(--qsad)]"
68
72
  }
69
73
  ),
70
- /* @__PURE__ */ y("p", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-500 dark:text-slate-400", children: [
71
- e.bg && /* @__PURE__ */ l(
74
+ /* @__PURE__ */ k("p", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-500 dark:text-slate-400", children: [
75
+ e.bg && /* @__PURE__ */ s(
72
76
  "span",
73
77
  {
74
78
  "aria-hidden": "true",
@@ -76,70 +80,70 @@ function ae({
76
80
  style: { backgroundColor: e.bg, filter: "saturate(2.2)" }
77
81
  }
78
82
  ),
79
- q ? (
83
+ S ? (
80
84
  // The breakdown is a disclosure: a real button so keyboard users reach it.
81
- /* @__PURE__ */ l(
85
+ /* @__PURE__ */ s(
82
86
  "button",
83
87
  {
84
88
  type: "button",
85
89
  className: "min-w-0 truncate rounded-sm text-left underline decoration-slate-300 decoration-dotted underline-offset-[3px] outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:decoration-slate-600",
86
- "aria-expanded": m,
87
- "aria-controls": m ? k : void 0,
88
- onFocus: () => p(!0),
89
- onBlur: () => p(!1),
90
- onClick: () => p(!0),
90
+ "aria-expanded": g,
91
+ "aria-controls": g ? N : void 0,
92
+ onFocus: () => m(!0),
93
+ onBlur: () => m(!1),
94
+ onClick: () => m(!0),
91
95
  onKeyDown: (t) => {
92
- t.key === "Escape" && p(!1);
96
+ t.key === "Escape" && m(!1);
93
97
  },
94
98
  title: e.label,
95
99
  children: e.label
96
100
  }
97
101
  )
98
- ) : /* @__PURE__ */ l("span", { className: "truncate", title: e.label, children: e.label })
102
+ ) : /* @__PURE__ */ s("span", { className: "truncate", title: e.label, children: e.label })
99
103
  ] }),
100
- s ? /* @__PURE__ */ l("div", { className: "mt-1 h-5 w-24 animate-pulse rounded bg-slate-200/60 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ y(
104
+ i ? /* @__PURE__ */ s("div", { className: "mt-1 h-5 w-24 animate-pulse rounded bg-slate-200/60 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ k(
101
105
  "p",
102
106
  {
103
- ref: D,
104
- className: `relative mt-0.5 truncate leading-[22px] tabular-nums ${O ? "text-[13px] font-normal text-slate-500 dark:text-slate-400" : M ? "text-[13px] font-medium text-slate-600 dark:text-slate-300" : v ? "text-[15px] font-semibold text-[color:var(--qsa)] dark:text-[color:var(--qsad)]" : "text-[15px] font-semibold text-slate-800 dark:text-slate-100"}`,
105
- title: T !== h ? h : void 0,
107
+ ref: U,
108
+ className: `relative mt-0.5 truncate leading-[22px] tabular-nums ${M ? "text-[13px] font-normal text-slate-500 dark:text-slate-400" : E ? "text-[13px] font-medium text-slate-600 dark:text-slate-300" : h ? "text-[15px] font-semibold text-[color:var(--qsa)] dark:text-[color:var(--qsad)]" : "text-[15px] font-semibold text-slate-800 dark:text-slate-100"}`,
109
+ title: z !== y ? y : void 0,
106
110
  "data-stat-value": !0,
107
111
  children: [
108
- T,
109
- /* @__PURE__ */ l(
112
+ z,
113
+ /* @__PURE__ */ s(
110
114
  "span",
111
115
  {
112
- ref: U,
116
+ ref: W,
113
117
  "aria-hidden": "true",
114
118
  className: "pointer-events-none invisible absolute left-0 top-0 whitespace-nowrap",
115
- children: h
119
+ children: y
116
120
  }
117
121
  )
118
122
  ]
119
123
  }
120
124
  ),
121
- W && /* @__PURE__ */ y(
125
+ K && /* @__PURE__ */ k(
122
126
  "p",
123
127
  {
124
128
  className: "truncate text-[11px] tabular-nums text-slate-500 dark:text-slate-400",
125
129
  "data-stat-coverage": !0,
126
130
  children: [
127
- a.reporting.toLocaleString("en-US"),
131
+ o.reporting.toLocaleString("en-US"),
128
132
  " of ",
129
- a.total.toLocaleString("en-US"),
133
+ o.total.toLocaleString("en-US"),
130
134
  " ",
131
135
  e.coverage
132
136
  ]
133
137
  }
134
138
  ),
135
- m && q && /* @__PURE__ */ l(
139
+ g && S && /* @__PURE__ */ s(
136
140
  "div",
137
141
  {
138
- id: k,
142
+ id: N,
139
143
  className: "absolute left-0 top-full z-40 mt-1 min-w-[220px] rounded-md border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-popover",
140
- children: E.map((t) => /* @__PURE__ */ y("div", { className: "flex justify-between gap-4 py-0.5 text-[12px]", children: [
141
- /* @__PURE__ */ l("span", { className: "text-slate-500 dark:text-slate-400", children: t.label }),
142
- /* @__PURE__ */ l("span", { className: "tabular-nums text-slate-700 dark:text-slate-200", children: z(t.value, e.format) })
144
+ children: $.map((t) => /* @__PURE__ */ k("div", { className: "flex justify-between gap-4 py-0.5 text-[12px]", children: [
145
+ /* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-slate-400", children: t.label }),
146
+ /* @__PURE__ */ s("span", { className: "tabular-nums text-slate-700 dark:text-slate-200", children: I(t.value, e.format) })
143
147
  ] }, t.label))
144
148
  }
145
149
  )
@@ -148,41 +152,43 @@ function ae({
148
152
  )
149
153
  );
150
154
  }
151
- function me({
155
+ function fe({
152
156
  stats: e,
153
- rows: c,
154
- effectiveParams: b,
155
- loading: f
157
+ rows: a,
158
+ effectiveParams: d,
159
+ loading: p,
160
+ zeroDash: f = !1
156
161
  }) {
157
- const d = S(null), o = e.length, [x, m] = C(o), [p, k] = C({}), r = Object.values(p).some(Boolean), g = S(/* @__PURE__ */ new Map()), N = (n) => {
158
- let u = g.current.get(n);
159
- return u || (u = (s) => k((a) => a[n] === !s ? a : { ...a, [n]: !s }), g.current.set(n, u)), u;
162
+ const b = _(null), l = e.length, [x, g] = L(l), [m, N] = L({}), r = Object.values(m).some(Boolean), v = _(/* @__PURE__ */ new Map()), w = (n) => {
163
+ let u = v.current.get(n);
164
+ return u || (u = (i) => N((o) => o[n] === !i ? o : { ...o, [n]: !i }), v.current.set(n, u)), u;
160
165
  };
161
- return A(() => {
162
- const n = d.current;
163
- if (!n || !o) return;
166
+ return B(() => {
167
+ const n = b.current;
168
+ if (!n || !l) return;
164
169
  const u = () => {
165
- const a = Math.max(1, Math.floor((n.clientWidth + P) / (re + P))), _ = Math.ceil(o / a);
166
- m(Math.ceil(o / _));
170
+ const o = Math.max(1, Math.floor((n.clientWidth + A) / (oe + A))), R = Math.ceil(l / o);
171
+ g(Math.ceil(l / R));
167
172
  };
168
173
  if (u(), typeof ResizeObserver > "u") return;
169
- const s = new ResizeObserver(u);
170
- return s.observe(n), () => s.disconnect();
171
- }, [o]), o ? /* @__PURE__ */ l(
174
+ const i = new ResizeObserver(u);
175
+ return i.observe(n), () => i.disconnect();
176
+ }, [l]), l ? /* @__PURE__ */ s(
172
177
  "div",
173
178
  {
174
- ref: d,
179
+ ref: b,
175
180
  className: "grid gap-2 pb-3",
176
181
  style: { gridTemplateColumns: `repeat(${x}, minmax(0, 1fr))` },
177
- children: e.map((n) => /* @__PURE__ */ l(
178
- ae,
182
+ children: e.map((n) => /* @__PURE__ */ s(
183
+ le,
179
184
  {
180
185
  stat: n,
181
- rows: c,
182
- effectiveParams: b,
183
- loading: f,
186
+ rows: a,
187
+ effectiveParams: d,
188
+ loading: p,
184
189
  compact: r,
185
- onFit: N(n.label)
190
+ zeroDash: f,
191
+ onFit: w(n.label)
186
192
  },
187
193
  n.label
188
194
  ))
@@ -190,5 +196,6 @@ function me({
190
196
  ) : null;
191
197
  }
192
198
  export {
193
- me as QueryStatStrip
199
+ fe as QueryStatStrip,
200
+ re as tileValue
194
201
  };