@nivaro/react 0.3.134 → 0.3.135
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/shared/components/delivery-analytics/DeliveryAnalyticsView.js +13 -13
- package/dist/shared/components/delivery-analytics/charts.js +23 -23
- package/dist/shared/components/delivery-analytics/drill.js +358 -315
- package/dist/shared/components/delivery-analytics/ui.js +83 -75
- package/package.json +1 -1
|
@@ -1,41 +1,49 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { ChevronsUpDown as v, Check as m, X as
|
|
1
|
+
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronsUpDown as v, Check as m, X as w, ArrowUpRight as N, ArrowDownRight as y } from "lucide-react";
|
|
3
3
|
import { createContext as C, useState as $, useContext as f } from "react";
|
|
4
4
|
import { cn as c } from "../../lib/utils.js";
|
|
5
5
|
import { Command as O, CommandInput as S, CommandList as P, CommandEmpty as _, CommandItem as x } from "../ui/command.js";
|
|
6
6
|
import { Popover as E, PopoverTrigger as M, PopoverContent as T } from "../ui/popover.js";
|
|
7
7
|
import { fmtInt as b } from "./url.js";
|
|
8
|
-
const p = C(
|
|
9
|
-
});
|
|
8
|
+
const p = C(null);
|
|
10
9
|
function X({
|
|
11
10
|
cell: e,
|
|
12
11
|
label: t,
|
|
13
12
|
children: l,
|
|
14
|
-
className:
|
|
15
|
-
tip:
|
|
16
|
-
sort:
|
|
13
|
+
className: n,
|
|
14
|
+
tip: i,
|
|
15
|
+
sort: a
|
|
17
16
|
}) {
|
|
18
|
-
const u = f(p),
|
|
19
|
-
return !e
|
|
17
|
+
const u = f(p), o = l ?? b((e == null ? void 0 : e.n) ?? 0);
|
|
18
|
+
return !u && e && e.n > 0 ? /* @__PURE__ */ r(
|
|
20
19
|
"span",
|
|
21
20
|
{
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
"data-da-num-stale": e.n,
|
|
22
|
+
"aria-disabled": "true",
|
|
23
|
+
"data-tip": "Updating — open it once the new figures are in",
|
|
24
|
+
className: c("tabular-nums", n),
|
|
25
|
+
children: o
|
|
26
|
+
}
|
|
27
|
+
) : !e || e.n === 0 || !u ? /* @__PURE__ */ r(
|
|
28
|
+
"span",
|
|
29
|
+
{
|
|
30
|
+
className: c("tabular-nums", n, "text-slate-400 dark:text-muted-foreground/70"),
|
|
31
|
+
children: o
|
|
24
32
|
}
|
|
25
33
|
) : /* @__PURE__ */ r(
|
|
26
34
|
"button",
|
|
27
35
|
{
|
|
28
36
|
type: "button",
|
|
29
37
|
"data-da-num": e.n,
|
|
30
|
-
"data-tip":
|
|
31
|
-
onClick: (
|
|
32
|
-
|
|
38
|
+
"data-tip": i ?? `Show the ${b(e.n)} ${e.n === 1 ? "row" : "rows"} behind this`,
|
|
39
|
+
onClick: (d) => {
|
|
40
|
+
d.stopPropagation(), u(e, t, a ? { sort: a } : void 0);
|
|
33
41
|
},
|
|
34
42
|
className: c(
|
|
35
43
|
"rounded-sm tabular-nums decoration-slate-300 decoration-dotted underline-offset-[3px] hover:underline hover:decoration-solid focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:decoration-muted-foreground/40",
|
|
36
|
-
|
|
44
|
+
n
|
|
37
45
|
),
|
|
38
|
-
children:
|
|
46
|
+
children: o
|
|
39
47
|
}
|
|
40
48
|
);
|
|
41
49
|
}
|
|
@@ -43,28 +51,28 @@ function q({
|
|
|
43
51
|
title: e,
|
|
44
52
|
hint: t,
|
|
45
53
|
actions: l,
|
|
46
|
-
children:
|
|
47
|
-
className:
|
|
48
|
-
id:
|
|
54
|
+
children: n,
|
|
55
|
+
className: i,
|
|
56
|
+
id: a
|
|
49
57
|
}) {
|
|
50
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ s(
|
|
51
59
|
"section",
|
|
52
60
|
{
|
|
53
|
-
"data-da-panel":
|
|
61
|
+
"data-da-panel": a,
|
|
54
62
|
"aria-label": e,
|
|
55
63
|
className: c(
|
|
56
64
|
"min-w-0 rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
57
|
-
|
|
65
|
+
i
|
|
58
66
|
),
|
|
59
67
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ s("header", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: [
|
|
69
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
62
70
|
/* @__PURE__ */ r("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: e }),
|
|
63
71
|
t && /* @__PURE__ */ r("p", { className: "mt-0.5 text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: t })
|
|
64
72
|
] }),
|
|
65
73
|
l
|
|
66
74
|
] }),
|
|
67
|
-
|
|
75
|
+
n
|
|
68
76
|
]
|
|
69
77
|
}
|
|
70
78
|
);
|
|
@@ -73,28 +81,28 @@ function z({
|
|
|
73
81
|
cur: e,
|
|
74
82
|
prev: t,
|
|
75
83
|
label: l,
|
|
76
|
-
goodWhen:
|
|
77
|
-
periodLabel:
|
|
84
|
+
goodWhen: n = "neutral",
|
|
85
|
+
periodLabel: i
|
|
78
86
|
}) {
|
|
79
|
-
const
|
|
87
|
+
const a = f(p);
|
|
80
88
|
if (t.n === 0 && e === 0) return null;
|
|
81
|
-
const u = t.n === 0 ? null : (e - t.n) / t.n,
|
|
82
|
-
return /* @__PURE__ */
|
|
89
|
+
const u = t.n === 0 ? null : (e - t.n) / t.n, o = e > t.n, d = e === t.n, h = d || n === "neutral" ? "text-slate-500 dark:text-muted-foreground" : o && n === "up" || !o && n === "down" ? "text-green-700 dark:text-[#9fbf8a]" : "text-red-700 dark:text-[#e08383]", g = o ? N : y, k = u == null ? "new" : d ? "no change" : `${Math.abs(Math.round(u * 100))}%`;
|
|
90
|
+
return /* @__PURE__ */ s(
|
|
83
91
|
"button",
|
|
84
92
|
{
|
|
85
93
|
type: "button",
|
|
86
94
|
"data-da-delta": "",
|
|
87
|
-
"data-tip": `${b(t.n)} in the ${
|
|
88
|
-
disabled: t.n === 0,
|
|
89
|
-
onClick: () =>
|
|
95
|
+
"data-tip": `${b(t.n)} in the ${i} — show them`,
|
|
96
|
+
disabled: t.n === 0 || !a,
|
|
97
|
+
onClick: () => a == null ? void 0 : a(t, `${l} · previous period`),
|
|
90
98
|
className: c(
|
|
91
99
|
"inline-flex items-center gap-0.5 rounded-sm text-[11px] font-medium tabular-nums enabled:hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
92
100
|
h
|
|
93
101
|
),
|
|
94
102
|
children: [
|
|
95
|
-
!
|
|
103
|
+
!d && u != null && /* @__PURE__ */ r(g, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
96
104
|
k,
|
|
97
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ s("span", { className: "font-normal text-slate-500 dark:text-muted-foreground", children: [
|
|
98
106
|
" vs ",
|
|
99
107
|
b(t.n)
|
|
100
108
|
] })
|
|
@@ -106,33 +114,33 @@ function G({
|
|
|
106
114
|
value: e,
|
|
107
115
|
options: t,
|
|
108
116
|
onChange: l,
|
|
109
|
-
ariaLabel:
|
|
110
|
-
prefix:
|
|
117
|
+
ariaLabel: n,
|
|
118
|
+
prefix: i
|
|
111
119
|
}) {
|
|
112
120
|
return (
|
|
113
121
|
// biome-ignore lint/a11y/useSemanticElements: a toolbar toggle group, not a form fieldset
|
|
114
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ s(
|
|
115
123
|
"div",
|
|
116
124
|
{
|
|
117
125
|
role: "group",
|
|
118
|
-
"aria-label":
|
|
126
|
+
"aria-label": n,
|
|
119
127
|
className: "inline-flex shrink-0 items-center rounded-md border border-slate-200 bg-white p-0.5 dark:border-border dark:bg-card",
|
|
120
128
|
children: [
|
|
121
|
-
|
|
122
|
-
t.map((
|
|
129
|
+
i && /* @__PURE__ */ r("span", { className: "px-2 text-[12px] text-slate-500 dark:text-muted-foreground", children: i }),
|
|
130
|
+
t.map((a) => /* @__PURE__ */ r(
|
|
123
131
|
"button",
|
|
124
132
|
{
|
|
125
133
|
type: "button",
|
|
126
|
-
"aria-pressed": e ===
|
|
127
|
-
"data-tip":
|
|
128
|
-
onClick: () => l(
|
|
134
|
+
"aria-pressed": e === a.value,
|
|
135
|
+
"data-tip": a.tip,
|
|
136
|
+
onClick: () => l(a.value),
|
|
129
137
|
className: c(
|
|
130
138
|
"rounded px-2.5 py-1 text-[12px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
131
|
-
e ===
|
|
139
|
+
e === a.value ? "bg-[#0f172a] text-white dark:bg-nvr-cyan dark:text-[#172940]" : "text-slate-600 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted"
|
|
132
140
|
),
|
|
133
|
-
children:
|
|
141
|
+
children: a.label
|
|
134
142
|
},
|
|
135
|
-
String(
|
|
143
|
+
String(a.value)
|
|
136
144
|
))
|
|
137
145
|
]
|
|
138
146
|
}
|
|
@@ -143,30 +151,30 @@ function H({
|
|
|
143
151
|
label: e,
|
|
144
152
|
value: t,
|
|
145
153
|
options: l,
|
|
146
|
-
onChange:
|
|
147
|
-
allLabel:
|
|
154
|
+
onChange: n,
|
|
155
|
+
allLabel: i
|
|
148
156
|
}) {
|
|
149
|
-
const [
|
|
150
|
-
return /* @__PURE__ */
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
-
/* @__PURE__ */ r(M, { asChild: !0, children: /* @__PURE__ */
|
|
157
|
+
const [a, u] = $(!1), o = l.find((d) => d.value === t);
|
|
158
|
+
return /* @__PURE__ */ s("div", { className: "inline-flex shrink-0 items-center", children: [
|
|
159
|
+
/* @__PURE__ */ s(E, { open: a, onOpenChange: u, children: [
|
|
160
|
+
/* @__PURE__ */ r(M, { asChild: !0, children: /* @__PURE__ */ s(
|
|
153
161
|
"button",
|
|
154
162
|
{
|
|
155
163
|
type: "button",
|
|
156
164
|
"data-da-filter": e,
|
|
157
|
-
"aria-label": `${e}: ${(
|
|
165
|
+
"aria-label": `${e}: ${(o == null ? void 0 : o.label) ?? t ?? i}`,
|
|
158
166
|
className: c(
|
|
159
167
|
"inline-flex h-8 max-w-[220px] items-center gap-1.5 border px-2.5 text-[12px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
160
168
|
t ? "rounded-l-md border-nvr-cyan/60 bg-nvr-cyan/10 text-slate-900 dark:text-foreground" : "rounded-md border-slate-200 bg-white text-slate-600 hover:bg-slate-50 dark:border-border dark:bg-card dark:text-muted-foreground dark:hover:bg-muted"
|
|
161
169
|
),
|
|
162
170
|
children: [
|
|
163
171
|
/* @__PURE__ */ r("span", { className: "text-slate-500 dark:text-muted-foreground", children: e }),
|
|
164
|
-
/* @__PURE__ */ r("span", { className: "min-w-0 truncate font-medium", children: t ? (
|
|
172
|
+
/* @__PURE__ */ r("span", { className: "min-w-0 truncate font-medium", children: t ? (o == null ? void 0 : o.label) ?? t : i }),
|
|
165
173
|
/* @__PURE__ */ r(v, { className: "h-3 w-3 shrink-0 opacity-50", "aria-hidden": !0 })
|
|
166
174
|
]
|
|
167
175
|
}
|
|
168
176
|
) }),
|
|
169
|
-
/* @__PURE__ */ r(T, { className: "w-[260px] p-0", align: "start", children: /* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ r(T, { className: "w-[260px] p-0", align: "start", children: /* @__PURE__ */ s(O, { children: [
|
|
170
178
|
/* @__PURE__ */ r(
|
|
171
179
|
S,
|
|
172
180
|
{
|
|
@@ -174,28 +182,28 @@ function H({
|
|
|
174
182
|
className: "h-9 text-[12.5px]"
|
|
175
183
|
}
|
|
176
184
|
),
|
|
177
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ s(P, { children: [
|
|
178
186
|
/* @__PURE__ */ r(_, { children: "Nothing matches." }),
|
|
179
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ s(
|
|
180
188
|
x,
|
|
181
189
|
{
|
|
182
|
-
value: `__all__ ${
|
|
190
|
+
value: `__all__ ${i}`,
|
|
183
191
|
onSelect: () => {
|
|
184
|
-
|
|
192
|
+
n(null), u(!1);
|
|
185
193
|
},
|
|
186
194
|
className: "text-[12.5px]",
|
|
187
195
|
children: [
|
|
188
196
|
/* @__PURE__ */ r(m, { className: c("mr-2 h-3.5 w-3.5", t ? "opacity-0" : "opacity-100") }),
|
|
189
|
-
|
|
197
|
+
i
|
|
190
198
|
]
|
|
191
199
|
}
|
|
192
200
|
),
|
|
193
|
-
l.map((
|
|
201
|
+
l.map((d) => /* @__PURE__ */ s(
|
|
194
202
|
x,
|
|
195
203
|
{
|
|
196
|
-
value: `${
|
|
204
|
+
value: `${d.label} ${d.value}`,
|
|
197
205
|
onSelect: () => {
|
|
198
|
-
|
|
206
|
+
n(d.value), u(!1);
|
|
199
207
|
},
|
|
200
208
|
className: "text-[12.5px]",
|
|
201
209
|
children: [
|
|
@@ -204,15 +212,15 @@ function H({
|
|
|
204
212
|
{
|
|
205
213
|
className: c(
|
|
206
214
|
"mr-2 h-3.5 w-3.5",
|
|
207
|
-
t ===
|
|
215
|
+
t === d.value ? "opacity-100" : "opacity-0"
|
|
208
216
|
)
|
|
209
217
|
}
|
|
210
218
|
),
|
|
211
|
-
/* @__PURE__ */ r("span", { className: "min-w-0 flex-1 truncate", children:
|
|
212
|
-
|
|
219
|
+
/* @__PURE__ */ r("span", { className: "min-w-0 flex-1 truncate", children: d.label }),
|
|
220
|
+
d.count != null && /* @__PURE__ */ r("span", { className: "ml-2 text-[11px] tabular-nums text-slate-400", children: b(d.count) })
|
|
213
221
|
]
|
|
214
222
|
},
|
|
215
|
-
|
|
223
|
+
d.value
|
|
216
224
|
))
|
|
217
225
|
] })
|
|
218
226
|
] }) })
|
|
@@ -223,21 +231,21 @@ function H({
|
|
|
223
231
|
type: "button",
|
|
224
232
|
"aria-label": `Clear the ${e.toLowerCase()} filter`,
|
|
225
233
|
"data-tip": "Clear",
|
|
226
|
-
onClick: () =>
|
|
234
|
+
onClick: () => n(null),
|
|
227
235
|
className: "inline-flex h-8 items-center rounded-r-md border border-l-0 border-nvr-cyan/60 bg-nvr-cyan/10 px-1.5 text-slate-500 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:text-foreground",
|
|
228
|
-
children: /* @__PURE__ */ r(
|
|
236
|
+
children: /* @__PURE__ */ r(w, { className: "h-3 w-3" })
|
|
229
237
|
}
|
|
230
238
|
)
|
|
231
239
|
] });
|
|
232
240
|
}
|
|
233
|
-
const
|
|
241
|
+
const U = {
|
|
234
242
|
delivered: "border-green-200 bg-green-50 text-green-800 dark:border-[#9fbf8a]/30 dark:bg-[#9fbf8a]/10 dark:text-[#b9d3a6]",
|
|
235
243
|
failed: "border-red-200 bg-red-50 text-red-800 dark:border-[#e08383]/30 dark:bg-[#e08383]/10 dark:text-[#eaa3a3]",
|
|
236
244
|
deferred: "border-sky-200 bg-sky-50 text-sky-800 dark:border-[#8fa6c9]/30 dark:bg-[#8fa6c9]/10 dark:text-[#b3c4dd]",
|
|
237
245
|
dropped: "border-amber-200 bg-amber-50 text-amber-800 dark:border-[#d4936a]/30 dark:bg-[#d4936a]/10 dark:text-[#e2b192]",
|
|
238
246
|
suppressed: "border-amber-200 bg-amber-50 text-amber-800 dark:border-[#d4936a]/30 dark:bg-[#d4936a]/10 dark:text-[#e2b192]",
|
|
239
247
|
test: "border-violet-200 bg-violet-50 text-violet-800 dark:border-border dark:bg-muted dark:text-muted-foreground"
|
|
240
|
-
},
|
|
248
|
+
}, D = "border-slate-200 bg-slate-50 text-slate-700 dark:border-border dark:bg-muted dark:text-muted-foreground";
|
|
241
249
|
function J({
|
|
242
250
|
outcome: e,
|
|
243
251
|
children: t
|
|
@@ -248,7 +256,7 @@ function J({
|
|
|
248
256
|
"data-da-outcome": e,
|
|
249
257
|
className: c(
|
|
250
258
|
"inline-flex items-center whitespace-nowrap rounded-full border px-2 py-px text-[10.5px] font-medium",
|
|
251
|
-
|
|
259
|
+
U[e] ?? D
|
|
252
260
|
),
|
|
253
261
|
children: t
|
|
254
262
|
}
|
|
@@ -259,7 +267,7 @@ function K({
|
|
|
259
267
|
max: t,
|
|
260
268
|
tone: l = "accent"
|
|
261
269
|
}) {
|
|
262
|
-
const
|
|
270
|
+
const n = t > 0 ? Math.max(e > 0 ? 3 : 0, Math.round(e / t * 100)) : 0;
|
|
263
271
|
return /* @__PURE__ */ r(
|
|
264
272
|
"span",
|
|
265
273
|
{
|
|
@@ -272,7 +280,7 @@ function K({
|
|
|
272
280
|
"block h-full rounded-full",
|
|
273
281
|
l === "bad" ? "bg-red-500/70 dark:bg-[#e08383]/70" : "bg-nvr-cyan/70"
|
|
274
282
|
),
|
|
275
|
-
style: { width: `${
|
|
283
|
+
style: { width: `${n}%` }
|
|
276
284
|
}
|
|
277
285
|
)
|
|
278
286
|
}
|