@nivaro/react 0.3.87 → 0.3.89
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.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +518 -516
- package/dist/shared/components/ops-report/CompareTab.js +110 -0
- package/dist/shared/components/ops-report/DigestSections.js +1134 -0
- package/dist/shared/components/ops-report/OpsReportView.js +88 -0
- package/dist/shared/components/ops-report/ReportTab.js +527 -0
- package/dist/shared/components/ops-report/SettingsPanel.js +247 -0
- package/dist/shared/components/ops-report/TrendsTab.js +191 -0
- package/dist/shared/components/ops-report/chip.js +17 -0
- package/dist/shared/components/ops-report/drill.js +328 -0
- package/dist/shared/components/ops-report/format.js +163 -0
- package/dist/shared/components/ops-report/ui.js +208 -0
- package/dist/shared/components/panels/MoveToStatePanel.js +127 -0
- package/dist/shared/components/panels/PipelinePanel.js +1044 -1029
- package/dist/shared/lib/ops-report-types.js +141 -0
- package/package.json +1 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N, useMemo as y } from "react";
|
|
3
|
+
import { OPS_KPI_META as k } from "../../lib/ops-report-types.js";
|
|
4
|
+
import { cn as $ } from "../../lib/utils.js";
|
|
5
|
+
import { shortDay as c, kpiMeta as O, formatKpi as p, num as _, goodClass as j, VERDICT as S, weekday as C, NO_VERDICT_DOT as E } from "./format.js";
|
|
6
|
+
import { Pick as v } from "./ui.js";
|
|
7
|
+
function I(e) {
|
|
8
|
+
return `${C(e.day)} ${c(e.day)}${e.verdict ? ` · ${S[e.verdict].label}` : ""}${e.score != null ? ` · ${e.score}` : ""}`;
|
|
9
|
+
}
|
|
10
|
+
function w({ r: e }) {
|
|
11
|
+
return e ? /* @__PURE__ */ o("div", { className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card", children: [
|
|
12
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2 text-[12.5px] font-semibold text-slate-900 dark:text-foreground", children: [
|
|
13
|
+
/* @__PURE__ */ a(
|
|
14
|
+
"span",
|
|
15
|
+
{
|
|
16
|
+
"aria-hidden": !0,
|
|
17
|
+
className: $(
|
|
18
|
+
"h-2.5 w-2.5 rounded-full",
|
|
19
|
+
e.verdict ? S[e.verdict].dot : E
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
C(e.day),
|
|
24
|
+
" ",
|
|
25
|
+
c(e.day),
|
|
26
|
+
e.score != null && /* @__PURE__ */ a("span", { className: "ml-auto tabular-nums text-slate-500 dark:text-muted-foreground", children: e.score })
|
|
27
|
+
] }),
|
|
28
|
+
/* @__PURE__ */ a("p", { className: "mt-1 text-[12px] leading-snug text-slate-600 dark:text-muted-foreground", children: e.headline ?? "No write-up for this day." })
|
|
29
|
+
] }) : /* @__PURE__ */ a("div", {});
|
|
30
|
+
}
|
|
31
|
+
function B({ rows: e }) {
|
|
32
|
+
const [x, M] = N(() => {
|
|
33
|
+
var t, l;
|
|
34
|
+
return String(((t = e[1]) == null ? void 0 : t.id) ?? ((l = e[0]) == null ? void 0 : l.id) ?? "");
|
|
35
|
+
}), [h, D] = N(() => {
|
|
36
|
+
var t;
|
|
37
|
+
return String(((t = e[0]) == null ? void 0 : t.id) ?? "");
|
|
38
|
+
}), f = y(() => e.map((t) => ({ value: String(t.id), label: I(t) })), [e]), n = e.find((t) => String(t.id) === x), s = e.find((t) => String(t.id) === h), T = y(() => {
|
|
39
|
+
const t = /* @__PURE__ */ new Set();
|
|
40
|
+
for (const d of [n, s])
|
|
41
|
+
for (const [r, m] of Object.entries((d == null ? void 0 : d.kpis) ?? {})) m != null && t.add(r);
|
|
42
|
+
const l = k.map((d) => d.key).filter((d) => t.has(d)), i = [...t].filter((d) => !k.some((r) => r.key === d)).sort();
|
|
43
|
+
return [...l, ...i];
|
|
44
|
+
}, [n, s]);
|
|
45
|
+
return e.length < 2 ? /* @__PURE__ */ a("p", { className: "flex-1 p-10 text-center text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "Compare needs at least two days of reports." }) : /* @__PURE__ */ a(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: "min-h-0 flex-1 overflow-y-auto bg-slate-50 p-4 dark:bg-background",
|
|
49
|
+
"data-ops-compare": "",
|
|
50
|
+
children: /* @__PURE__ */ o("div", { className: "mx-auto max-w-[1000px] space-y-3", children: [
|
|
51
|
+
/* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
52
|
+
/* @__PURE__ */ a(
|
|
53
|
+
v,
|
|
54
|
+
{
|
|
55
|
+
ariaLabel: "First day",
|
|
56
|
+
value: x,
|
|
57
|
+
onChange: M,
|
|
58
|
+
options: f,
|
|
59
|
+
className: "w-[260px]"
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ a("span", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "against" }),
|
|
63
|
+
/* @__PURE__ */ a(
|
|
64
|
+
v,
|
|
65
|
+
{
|
|
66
|
+
ariaLabel: "Second day",
|
|
67
|
+
value: h,
|
|
68
|
+
onChange: D,
|
|
69
|
+
options: f,
|
|
70
|
+
className: "w-[260px]"
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ o("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
75
|
+
/* @__PURE__ */ a(w, { r: n }),
|
|
76
|
+
/* @__PURE__ */ a(w, { r: s })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ a("div", { className: "overflow-x-auto rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ o("table", { className: "w-full text-[12px]", children: [
|
|
79
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ o("tr", { className: "border-b border-slate-200 text-[10.5px] uppercase tracking-wide text-slate-500 dark:border-border dark:text-muted-foreground", children: [
|
|
80
|
+
/* @__PURE__ */ a("th", { className: "px-3 py-1.5 text-left font-medium", children: "Number" }),
|
|
81
|
+
/* @__PURE__ */ a("th", { className: "px-3 py-1.5 text-right font-medium", children: n ? c(n.day) : "" }),
|
|
82
|
+
/* @__PURE__ */ a("th", { className: "px-3 py-1.5 text-right font-medium", children: s ? c(s.day) : "" }),
|
|
83
|
+
/* @__PURE__ */ a("th", { className: "px-3 py-1.5 text-right font-medium", children: "Difference" })
|
|
84
|
+
] }) }),
|
|
85
|
+
/* @__PURE__ */ a("tbody", { children: T.map((t) => {
|
|
86
|
+
var b, g;
|
|
87
|
+
const l = O(t), i = (b = n == null ? void 0 : n.kpis) == null ? void 0 : b[t], d = (g = s == null ? void 0 : s.kpis) == null ? void 0 : g[t], r = i != null && d != null ? d - i : null, m = r == null || r === 0 || l.better == null ? null : l.better === "down" ? r < 0 : r > 0, u = r != null && i ? r / i * 100 : null;
|
|
88
|
+
return /* @__PURE__ */ o(
|
|
89
|
+
"tr",
|
|
90
|
+
{
|
|
91
|
+
"data-ops-compare-row": t,
|
|
92
|
+
className: "border-b border-slate-100 last:border-0 dark:border-border/60",
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ a("td", { className: "px-3 py-1 text-slate-700 dark:text-foreground", children: l.label }),
|
|
95
|
+
/* @__PURE__ */ a("td", { className: "px-3 py-1 text-right tabular-nums", children: p(i, l.unit) }),
|
|
96
|
+
/* @__PURE__ */ a("td", { className: "px-3 py-1 text-right tabular-nums", children: p(d, l.unit) }),
|
|
97
|
+
/* @__PURE__ */ a("td", { className: $("px-3 py-1 text-right tabular-nums", j(m)), children: r == null ? "–" : r === 0 ? "same" : `${r > 0 ? "+" : "−"}${p(Math.abs(r), l.unit)}${u != null ? ` (${r > 0 ? "+" : "−"}${_(Math.abs(u), Math.abs(u) < 10 ? 1 : 0)}%)` : ""}` })
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
t
|
|
101
|
+
);
|
|
102
|
+
}) })
|
|
103
|
+
] }) })
|
|
104
|
+
] })
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
B as CompareTab
|
|
110
|
+
};
|