@actioneer/ads 0.5.9 → 0.6.0
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/components/assistant-ui/composer-harness.js +12 -10
- package/components/breadcrumbs.d.ts +1 -1
- package/components/breadcrumbs.js +42 -38
- package/components/button.js +11 -11
- package/components/card.js +19 -18
- package/components/chart.js +406 -385
- package/components/date-range-picker.d.ts +25 -0
- package/components/date-range-picker.js +187 -0
- package/components/drawer.js +110 -92
- package/components/index.d.ts +1 -0
- package/components/index.js +499 -497
- package/components/panel.js +31 -28
- package/components/tabs.js +1 -1
- package/components/tree.js +86 -58
- package/components/viz-charts.js +186 -183
- package/demo/components/add-to-artifact.js +4 -2
- package/fonts.css +2 -0
- package/llms.txt +22 -2
- package/manifest.json +13755 -8
- package/package.json +4 -1
- package/styles.css +76 -60
- package/theme.css +70 -57
package/components/viz-charts.js
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as a, jsxs as s } from "react/jsx-runtime";
|
|
3
3
|
import * as $ from "react";
|
|
4
|
-
import { cn as
|
|
5
|
-
import { fmtDuration as B, pct1 as
|
|
6
|
-
const
|
|
4
|
+
import { cn as O } from "../lib/cn.js";
|
|
5
|
+
import { fmtDuration as B, pct1 as E, abbr as F, commafy as H } from "../lib/viz-format.js";
|
|
6
|
+
const U = [
|
|
7
7
|
"var(--color-chart-1)",
|
|
8
8
|
"var(--color-chart-2)",
|
|
9
9
|
"var(--color-chart-3)",
|
|
10
10
|
"var(--color-chart-4)",
|
|
11
11
|
"var(--color-chart-5)",
|
|
12
12
|
"var(--color-chart-6)"
|
|
13
|
-
],
|
|
14
|
-
function
|
|
13
|
+
], L = (e) => U[e % U.length], C = "var(--color-chart-1)", I = "var(--color-ink-400)", V = "var(--border)", Y = "var(--foreground)", X = 2.5, Z = 2.5;
|
|
14
|
+
function ee(e, c = 4) {
|
|
15
15
|
if (e <= 0) return { max: 1, ticks: [0, 1] };
|
|
16
|
-
const d = e /
|
|
17
|
-
for (let w = 0; w <=
|
|
18
|
-
return { max:
|
|
16
|
+
const d = e / c, i = Math.pow(10, Math.floor(Math.log10(d))), o = ([1, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10].find((w) => w * i >= d) ?? 10) * i, l = Math.ceil(e / o) * o, y = [];
|
|
17
|
+
for (let w = 0; w <= l + o / 1e6; w += o) y.push(w);
|
|
18
|
+
return { max: l, ticks: y };
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
if (e.length <=
|
|
22
|
-
const d = Math.ceil(e.length /
|
|
20
|
+
function q(e, c = 8) {
|
|
21
|
+
if (e.length <= c) return e;
|
|
22
|
+
const d = Math.ceil(e.length / c);
|
|
23
23
|
return e.map((i, u) => u % d === 0 || u === e.length - 1 ? i : null);
|
|
24
24
|
}
|
|
25
25
|
function P(e) {
|
|
26
26
|
if (!e.length) return "";
|
|
27
27
|
if (e.length === 1) return `M${e[0][0]},${e[0][1]}`;
|
|
28
|
-
let
|
|
28
|
+
let c = `M${e[0][0]},${e[0][1]}`;
|
|
29
29
|
for (let d = 1; d < e.length; d++) {
|
|
30
|
-
const [i, u] = e[d - 1], [o,
|
|
31
|
-
|
|
30
|
+
const [i, u] = e[d - 1], [o, l] = e[d], y = (i + o) / 2;
|
|
31
|
+
c += `C${y},${u} ${y},${l} ${o},${l}`;
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return c;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function K({
|
|
36
36
|
x: e,
|
|
37
|
-
y:
|
|
37
|
+
y: c,
|
|
38
38
|
title: d,
|
|
39
39
|
rows: i,
|
|
40
40
|
flip: u
|
|
41
41
|
}) {
|
|
42
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ s(
|
|
43
43
|
"div",
|
|
44
44
|
{
|
|
45
45
|
className: "pointer-events-none absolute z-10 min-w-[184px] max-w-[248px] rounded-lg bg-foreground px-3 py-2.5 text-background shadow-elevation",
|
|
46
46
|
style: {
|
|
47
47
|
left: e,
|
|
48
|
-
top:
|
|
48
|
+
top: c,
|
|
49
49
|
transform: `translate(${u ? "calc(-100% - 12px)" : "12px"}, -50%)`
|
|
50
50
|
},
|
|
51
51
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
o.dashed ? /* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ a("div", { className: "mb-1.5 text-xs text-background/60", children: d }),
|
|
53
|
+
/* @__PURE__ */ a("div", { className: "flex flex-col gap-1", children: i.map((o, l) => /* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
54
|
+
o.dashed ? /* @__PURE__ */ a(
|
|
55
55
|
"span",
|
|
56
56
|
{
|
|
57
57
|
"aria-hidden": !0,
|
|
58
58
|
className: "h-0 w-3 shrink-0 border-t border-dashed",
|
|
59
59
|
style: { borderColor: o.swatch ?? "currentColor" }
|
|
60
60
|
}
|
|
61
|
-
) : o.swatch ? /* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
] },
|
|
61
|
+
) : o.swatch ? /* @__PURE__ */ a("span", { "aria-hidden": !0, className: "size-2 shrink-0 rounded-dot", style: { background: o.swatch } }) : null,
|
|
62
|
+
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate text-background/70", children: o.label }),
|
|
63
|
+
/* @__PURE__ */ a("span", { className: "shrink-0 font-medium tabular-nums", children: o.value })
|
|
64
|
+
] }, l)) })
|
|
65
65
|
]
|
|
66
66
|
}
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function te({
|
|
70
70
|
items: e
|
|
71
71
|
}) {
|
|
72
|
-
return /* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ a("div", { className: "mb-3 flex flex-wrap items-center justify-end gap-x-4 gap-y-1", children: e.map((c) => /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1.5 text-xs text-secondary", children: [
|
|
73
|
+
/* @__PURE__ */ a(
|
|
74
74
|
"span",
|
|
75
75
|
{
|
|
76
76
|
"aria-hidden": !0,
|
|
77
|
-
className:
|
|
78
|
-
style: { borderColor:
|
|
77
|
+
className: O("h-0 w-4 shrink-0", c.dashed ? "border-t-2 border-dashed" : "border-t-[3px]"),
|
|
78
|
+
style: { borderColor: c.color }
|
|
79
79
|
}
|
|
80
80
|
),
|
|
81
|
-
|
|
82
|
-
] },
|
|
81
|
+
c.label
|
|
82
|
+
] }, c.label)) });
|
|
83
83
|
}
|
|
84
84
|
const b = { l: 56, r: 18, t: 18, b: 34 };
|
|
85
|
-
function
|
|
85
|
+
function oe({
|
|
86
86
|
type: e = "line",
|
|
87
|
-
labels:
|
|
87
|
+
labels: c,
|
|
88
88
|
series: d,
|
|
89
89
|
height: i = 300,
|
|
90
|
-
formatAxis: u =
|
|
90
|
+
formatAxis: u = F,
|
|
91
91
|
formatValue: o = H,
|
|
92
|
-
className:
|
|
92
|
+
className: l
|
|
93
93
|
}) {
|
|
94
94
|
const [y, w] = $.useState(720), N = $.useRef(null);
|
|
95
95
|
$.useEffect(() => {
|
|
@@ -97,10 +97,10 @@ function ne({
|
|
|
97
97
|
const t = new ResizeObserver(([x]) => w(x.contentRect.width));
|
|
98
98
|
return t.observe(N.current), () => t.disconnect();
|
|
99
99
|
}, []);
|
|
100
|
-
const [h, f] = $.useState(null), m = Math.max(0, y - b.l - b.r), M = Math.max(0, i - b.t - b.b),
|
|
101
|
-
return /* @__PURE__ */
|
|
102
|
-
|
|
103
|
-
/* @__PURE__ */
|
|
100
|
+
const [h, f] = $.useState(null), m = Math.max(0, y - b.l - b.r), M = Math.max(0, i - b.t - b.b), r = d.filter((t) => !t.ghost), { max: n, ticks: p } = ee(Math.max(1, ...d.flatMap((t) => t.values))), k = (t) => b.t + M - t / n * M, R = c.length, v = (t) => e === "bar" ? b.l + (t + 0.5) / R * m : b.l + (R <= 1 ? m / 2 : t / (R - 1) * m), _ = [...p].reverse(), D = r.map((t, x) => ({ label: t.name, color: t.color ?? L(x), dashed: t.dashed }));
|
|
101
|
+
return /* @__PURE__ */ s("div", { ref: N, className: O("relative w-full font-sans", l), children: [
|
|
102
|
+
D.length > 1 && /* @__PURE__ */ a(te, { items: D }),
|
|
103
|
+
/* @__PURE__ */ s(
|
|
104
104
|
"svg",
|
|
105
105
|
{
|
|
106
106
|
width: y,
|
|
@@ -108,66 +108,66 @@ function ne({
|
|
|
108
108
|
className: "block select-none",
|
|
109
109
|
onMouseLeave: () => f(null),
|
|
110
110
|
onMouseMove: (t) => {
|
|
111
|
-
const x = t.currentTarget.getBoundingClientRect(), T = t.clientX - x.left,
|
|
112
|
-
f(Math.max(0, Math.min(R - 1,
|
|
111
|
+
const x = t.currentTarget.getBoundingClientRect(), T = t.clientX - x.left, S = Math.round((T - b.l) / m * (R - 1));
|
|
112
|
+
f(Math.max(0, Math.min(R - 1, S)));
|
|
113
113
|
},
|
|
114
114
|
children: [
|
|
115
|
-
|
|
116
|
-
/* @__PURE__ */
|
|
115
|
+
_.map((t, x) => /* @__PURE__ */ s("g", { children: [
|
|
116
|
+
/* @__PURE__ */ a(
|
|
117
117
|
"line",
|
|
118
118
|
{
|
|
119
119
|
x1: b.l,
|
|
120
120
|
x2: b.l + m,
|
|
121
121
|
y1: k(t),
|
|
122
122
|
y2: k(t),
|
|
123
|
-
stroke:
|
|
123
|
+
stroke: V,
|
|
124
124
|
strokeWidth: 1,
|
|
125
125
|
strokeDasharray: t === 0 ? void 0 : "3 4",
|
|
126
126
|
opacity: t === 0 ? 0.9 : 0.6
|
|
127
127
|
}
|
|
128
128
|
),
|
|
129
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ a("text", { x: b.l - 10, y: k(t), dy: "0.32em", textAnchor: "end", className: "fill-tertiary text-[11px] tabular-nums", children: u(t) })
|
|
130
130
|
] }, x)),
|
|
131
|
-
|
|
132
|
-
(t, x) => t == null ? null : /* @__PURE__ */
|
|
131
|
+
q(c).map(
|
|
132
|
+
(t, x) => t == null ? null : /* @__PURE__ */ a("text", { x: v(x), y: i - 12, textAnchor: "middle", className: "fill-tertiary text-[11px] tabular-nums", children: t }, x)
|
|
133
133
|
),
|
|
134
|
-
e === "bar" &&
|
|
135
|
-
const T = m / R,
|
|
136
|
-
return t.values.map((
|
|
137
|
-
const
|
|
138
|
-
return /* @__PURE__ */
|
|
134
|
+
e === "bar" && r.map((t, x) => {
|
|
135
|
+
const T = m / R, S = Math.min(T * 0.7, 64), A = (S - (r.length - 1)) / r.length;
|
|
136
|
+
return t.values.map((j, z) => {
|
|
137
|
+
const J = b.l + z * T + (T - S) / 2 + x * (A + 1), Q = h != null && h !== z;
|
|
138
|
+
return /* @__PURE__ */ a(
|
|
139
139
|
"rect",
|
|
140
140
|
{
|
|
141
|
-
x:
|
|
142
|
-
y: k(
|
|
143
|
-
width: Math.max(0,
|
|
144
|
-
height: b.t + M - k(
|
|
141
|
+
x: J,
|
|
142
|
+
y: k(j),
|
|
143
|
+
width: Math.max(0, A),
|
|
144
|
+
height: b.t + M - k(j),
|
|
145
145
|
rx: 2,
|
|
146
|
-
fill: t.color ??
|
|
147
|
-
opacity:
|
|
146
|
+
fill: t.color ?? L(x),
|
|
147
|
+
opacity: Q ? 0.4 : 1
|
|
148
148
|
},
|
|
149
|
-
`${x}-${
|
|
149
|
+
`${x}-${z}`
|
|
150
150
|
);
|
|
151
151
|
});
|
|
152
152
|
}),
|
|
153
|
-
e === "area" &&
|
|
153
|
+
e === "area" && r[0] && /* @__PURE__ */ a(
|
|
154
154
|
"path",
|
|
155
155
|
{
|
|
156
|
-
d: `${P(
|
|
157
|
-
fill:
|
|
156
|
+
d: `${P(r[0].values.map((t, x) => [v(x), k(t)]))} L${v(R - 1)},${k(0)} L${v(0)},${k(0)} Z`,
|
|
157
|
+
fill: r[0].color ?? L(0),
|
|
158
158
|
opacity: 0.12
|
|
159
159
|
}
|
|
160
160
|
),
|
|
161
161
|
e !== "bar" && d.map((t, x) => {
|
|
162
|
-
const T = t.color ??
|
|
163
|
-
return /* @__PURE__ */
|
|
162
|
+
const T = t.color ?? L(x), S = t.ghost ? "2 4" : t.dashed ? "6 5" : void 0, A = X;
|
|
163
|
+
return /* @__PURE__ */ a(
|
|
164
164
|
"path",
|
|
165
165
|
{
|
|
166
|
-
d: P(t.values.map((
|
|
166
|
+
d: P(t.values.map((j, z) => [v(z), k(j)])),
|
|
167
167
|
fill: "none",
|
|
168
168
|
stroke: T,
|
|
169
|
-
strokeWidth:
|
|
170
|
-
strokeDasharray:
|
|
169
|
+
strokeWidth: A,
|
|
170
|
+
strokeDasharray: S,
|
|
171
171
|
strokeLinecap: "round",
|
|
172
172
|
strokeLinejoin: "round",
|
|
173
173
|
opacity: t.ghost ? 0.4 : 1
|
|
@@ -175,33 +175,36 @@ function ne({
|
|
|
175
175
|
x
|
|
176
176
|
);
|
|
177
177
|
}),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
e !== "bar" && d.flatMap((t, x) => {
|
|
179
|
+
const T = t.color ?? L(x);
|
|
180
|
+
return t.values.map((S, A) => /* @__PURE__ */ a(
|
|
181
181
|
"circle",
|
|
182
182
|
{
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
183
|
+
"aria-hidden": !0,
|
|
184
|
+
cx: v(A),
|
|
185
|
+
cy: k(S),
|
|
186
|
+
r: h === A ? 5.5 : 4,
|
|
187
|
+
fill: "var(--card)",
|
|
188
|
+
stroke: T,
|
|
189
|
+
strokeWidth: h === A ? 3 : Z,
|
|
190
|
+
opacity: t.ghost ? 0.4 : 1
|
|
189
191
|
},
|
|
190
|
-
x
|
|
191
|
-
))
|
|
192
|
-
|
|
192
|
+
`${x}-${A}`
|
|
193
|
+
));
|
|
194
|
+
}),
|
|
195
|
+
h != null && e !== "bar" && /* @__PURE__ */ a("line", { x1: v(h), x2: v(h), y1: b.t, y2: b.t + M, stroke: Y, strokeWidth: 1, opacity: 0.18 })
|
|
193
196
|
]
|
|
194
197
|
}
|
|
195
198
|
),
|
|
196
|
-
h != null && /* @__PURE__ */
|
|
197
|
-
|
|
199
|
+
h != null && /* @__PURE__ */ a(
|
|
200
|
+
K,
|
|
198
201
|
{
|
|
199
202
|
x: v(h),
|
|
200
203
|
y: b.t + M / 2,
|
|
201
204
|
flip: v(h) > b.l + m * 0.66,
|
|
202
|
-
title:
|
|
205
|
+
title: c[h],
|
|
203
206
|
rows: d.map((t) => ({
|
|
204
|
-
swatch: t.color ??
|
|
207
|
+
swatch: t.color ?? L(d.indexOf(t)),
|
|
205
208
|
dashed: t.ghost,
|
|
206
209
|
label: t.name,
|
|
207
210
|
value: o(t.values[h])
|
|
@@ -210,186 +213,186 @@ function ne({
|
|
|
210
213
|
)
|
|
211
214
|
] });
|
|
212
215
|
}
|
|
213
|
-
const g = { l: 22, r: 16, t: 28, b: 98 },
|
|
214
|
-
function
|
|
215
|
-
var
|
|
216
|
+
const g = { l: 22, r: 16, t: 28, b: 98 }, G = "viz-funnel-hatch";
|
|
217
|
+
function ce({ steps: e, height: c = 320, className: d }) {
|
|
218
|
+
var r;
|
|
216
219
|
const [i, u] = $.useState(720), o = $.useRef(null);
|
|
217
220
|
$.useEffect(() => {
|
|
218
221
|
if (!o.current) return;
|
|
219
222
|
const n = new ResizeObserver(([p]) => u(p.contentRect.width));
|
|
220
223
|
return n.observe(o.current), () => n.disconnect();
|
|
221
224
|
}, []);
|
|
222
|
-
const [
|
|
223
|
-
return /* @__PURE__ */
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
/* @__PURE__ */
|
|
225
|
+
const [l, y] = $.useState(null), w = Math.max(0, i - g.l - g.r), N = Math.max(0, c - g.t - g.b), h = ((r = e[0]) == null ? void 0 : r.value) || 1, f = (n) => g.t + N - n * N, m = w / Math.max(1, e.length), M = Math.min(m * 0.56, 120);
|
|
226
|
+
return /* @__PURE__ */ s("div", { ref: o, className: O("relative w-full font-sans", d), children: [
|
|
227
|
+
/* @__PURE__ */ s("svg", { width: i, height: c, className: "block select-none", children: [
|
|
228
|
+
/* @__PURE__ */ a("defs", { children: /* @__PURE__ */ s("pattern", { id: G, width: 6, height: 6, patternTransform: "rotate(45)", patternUnits: "userSpaceOnUse", children: [
|
|
229
|
+
/* @__PURE__ */ a("rect", { width: 6, height: 6, fill: I, opacity: 0.07 }),
|
|
230
|
+
/* @__PURE__ */ a("line", { x1: 0, y1: 0, x2: 0, y2: 6, stroke: I, strokeWidth: 2.5, opacity: 0.22 })
|
|
228
231
|
] }) }),
|
|
229
|
-
[1, 0.75, 0.5, 0.25, 0].map((n) => /* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
+
[1, 0.75, 0.5, 0.25, 0].map((n) => /* @__PURE__ */ s("g", { children: [
|
|
233
|
+
/* @__PURE__ */ a("line", { x1: g.l, x2: g.l + w, y1: f(n), y2: f(n), stroke: V, strokeWidth: 1, strokeDasharray: n === 0 ? void 0 : "3 4", opacity: n === 0 ? 0.9 : 0.6 }),
|
|
234
|
+
/* @__PURE__ */ a("text", { x: g.l, y: f(n) - 4, className: "fill-tertiary text-[10px] tabular-nums", children: n * 100 })
|
|
232
235
|
] }, n)),
|
|
233
236
|
e.map((n, p) => {
|
|
234
|
-
const k = n.value / h, R = p === 0 ? 1 : e[p - 1].value / h, v = g.l + p * m + m / 2,
|
|
235
|
-
return /* @__PURE__ */
|
|
236
|
-
p > 0 && /* @__PURE__ */
|
|
237
|
-
/* @__PURE__ */
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
/* @__PURE__ */
|
|
240
|
-
/* @__PURE__ */
|
|
237
|
+
const k = n.value / h, R = p === 0 ? 1 : e[p - 1].value / h, v = g.l + p * m + m / 2, _ = v - M / 2, D = f(k), t = l != null && l !== p;
|
|
238
|
+
return /* @__PURE__ */ s("g", { opacity: t ? 0.55 : 1, onMouseEnter: () => y(p), onMouseLeave: () => y(null), children: [
|
|
239
|
+
p > 0 && /* @__PURE__ */ a("rect", { x: _, y: f(R), width: M, height: Math.max(0, D - f(R)), rx: 4, fill: `url(#${G})` }),
|
|
240
|
+
/* @__PURE__ */ a("rect", { x: _, y: D, width: M, height: Math.max(0, g.t + N - D), rx: 4, fill: C }),
|
|
241
|
+
/* @__PURE__ */ a("text", { x: v, y: D + 16, textAnchor: "middle", className: "fill-[var(--card)] text-[12px] font-medium tabular-nums", children: F(n.value) }),
|
|
242
|
+
/* @__PURE__ */ a("text", { x: v, y: g.t + N + 24, textAnchor: "middle", className: "fill-secondary text-[12.5px] font-medium", children: n.label }),
|
|
243
|
+
/* @__PURE__ */ s("text", { x: v, y: g.t + N + 45, textAnchor: "middle", className: "fill-foreground text-[12px] font-medium tabular-nums", children: [
|
|
241
244
|
H(n.value),
|
|
242
245
|
" ",
|
|
243
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ a("tspan", { className: "fill-tertiary", children: p === 0 ? "entered" : `→ ${E(k * 100)}` })
|
|
244
247
|
] }),
|
|
245
|
-
p > 0 && /* @__PURE__ */
|
|
248
|
+
p > 0 && /* @__PURE__ */ s("text", { x: v, y: g.t + N + 66, textAnchor: "middle", className: "fill-tertiary text-[12px] font-medium tabular-nums", children: [
|
|
246
249
|
"↘ ",
|
|
247
|
-
|
|
250
|
+
E((1 - n.value / e[p - 1].value) * 100)
|
|
248
251
|
] }),
|
|
249
|
-
p > 0 && n.medianTime != null && /* @__PURE__ */
|
|
252
|
+
p > 0 && n.medianTime != null && /* @__PURE__ */ s("text", { x: v, y: g.t + N + 86, textAnchor: "middle", className: "fill-tertiary text-[11px] tabular-nums", children: [
|
|
250
253
|
"◷ ",
|
|
251
254
|
B(n.medianTime)
|
|
252
255
|
] })
|
|
253
256
|
] }, p);
|
|
254
257
|
})
|
|
255
258
|
] }),
|
|
256
|
-
|
|
257
|
-
|
|
259
|
+
l != null && e[l] && /* @__PURE__ */ a(
|
|
260
|
+
K,
|
|
258
261
|
{
|
|
259
|
-
x: g.l +
|
|
262
|
+
x: g.l + l * m + m / 2,
|
|
260
263
|
y: g.t + N / 2,
|
|
261
|
-
flip:
|
|
262
|
-
title: e[
|
|
264
|
+
flip: l >= e.length - 2,
|
|
265
|
+
title: e[l].label,
|
|
263
266
|
rows: [
|
|
264
|
-
{ swatch:
|
|
265
|
-
...
|
|
266
|
-
{ swatch:
|
|
267
|
-
{ label: "Conversion so far", value:
|
|
268
|
-
{ label: "From previous", value:
|
|
269
|
-
{ label: "Median time", value: B(e[
|
|
267
|
+
{ swatch: C, label: "Converted", value: H(e[l].value) },
|
|
268
|
+
...l > 0 ? [
|
|
269
|
+
{ swatch: I, label: "Dropped off", value: `−${H(e[l - 1].value - e[l].value)}` },
|
|
270
|
+
{ label: "Conversion so far", value: E(e[l].value / h * 100) },
|
|
271
|
+
{ label: "From previous", value: E(e[l].value / e[l - 1].value * 100) },
|
|
272
|
+
{ label: "Median time", value: B(e[l].medianTime) }
|
|
270
273
|
] : []
|
|
271
274
|
]
|
|
272
275
|
}
|
|
273
276
|
)
|
|
274
277
|
] });
|
|
275
278
|
}
|
|
276
|
-
function
|
|
279
|
+
function se({ steps: e, className: c }) {
|
|
277
280
|
var i;
|
|
278
281
|
const d = ((i = e[0]) == null ? void 0 : i.value) || 1;
|
|
279
|
-
return /* @__PURE__ */
|
|
280
|
-
const
|
|
281
|
-
return /* @__PURE__ */
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
/* @__PURE__ */
|
|
284
|
-
/* @__PURE__ */
|
|
282
|
+
return /* @__PURE__ */ a("div", { className: O("flex w-full flex-col gap-[30px] font-sans", c), children: e.map((u, o) => {
|
|
283
|
+
const l = u.value / d, y = o === 0 ? 1 : e[o - 1].value / d;
|
|
284
|
+
return /* @__PURE__ */ s("div", { className: "w-full", children: [
|
|
285
|
+
/* @__PURE__ */ s("div", { className: "mb-1.5 flex items-baseline justify-between gap-3", children: [
|
|
286
|
+
/* @__PURE__ */ s("span", { className: "truncate text-[12.5px] font-medium text-secondary", children: [
|
|
287
|
+
/* @__PURE__ */ s("span", { className: "text-tertiary tabular-nums", children: [
|
|
285
288
|
o + 1,
|
|
286
289
|
"."
|
|
287
290
|
] }),
|
|
288
291
|
" ",
|
|
289
292
|
u.label
|
|
290
293
|
] }),
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
o > 0 && u.avgTime != null && /* @__PURE__ */
|
|
294
|
+
/* @__PURE__ */ s("div", { className: "flex shrink-0 items-baseline gap-3", children: [
|
|
295
|
+
o > 0 && u.avgTime != null && /* @__PURE__ */ s("span", { className: "text-[11px] text-tertiary tabular-nums", children: [
|
|
293
296
|
"Avg time ",
|
|
294
297
|
B(u.avgTime)
|
|
295
298
|
] }),
|
|
296
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ a("span", { className: "text-[12.5px] font-medium text-foreground tabular-nums", children: E(l * 100) })
|
|
297
300
|
] })
|
|
298
301
|
] }),
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
o > 0 && /* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ s("div", { className: "relative h-[46px] w-full overflow-hidden rounded-lg bg-muted-foreground/[0.06]", children: [
|
|
303
|
+
o > 0 && /* @__PURE__ */ a(
|
|
301
304
|
"div",
|
|
302
305
|
{
|
|
303
306
|
className: "absolute inset-y-0 left-0",
|
|
304
307
|
style: {
|
|
305
308
|
width: `${y * 100}%`,
|
|
306
|
-
backgroundImage: `repeating-linear-gradient(45deg, color-mix(in srgb, ${
|
|
309
|
+
backgroundImage: `repeating-linear-gradient(45deg, color-mix(in srgb, ${I} 9%, transparent) 0 4px, color-mix(in srgb, ${I} 22%, transparent) 4px 5px)`
|
|
307
310
|
}
|
|
308
311
|
}
|
|
309
312
|
),
|
|
310
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ a("div", { className: "absolute inset-y-0 left-0 flex items-center rounded-lg", style: { width: `${l * 100}%`, background: C }, children: /* @__PURE__ */ a("span", { className: "ml-3 text-[12px] font-medium text-ink-950 tabular-nums", children: F(u.value) }) })
|
|
311
314
|
] })
|
|
312
315
|
] }, o);
|
|
313
316
|
}) });
|
|
314
317
|
}
|
|
315
318
|
const W = { l: 48, r: 24, t: 34, b: 34 };
|
|
316
|
-
function
|
|
319
|
+
function ie({ points: e, height: c = 300, className: d }) {
|
|
317
320
|
const [i, u] = $.useState(720), o = $.useRef(null);
|
|
318
321
|
$.useEffect(() => {
|
|
319
322
|
if (!o.current) return;
|
|
320
|
-
const
|
|
321
|
-
return
|
|
323
|
+
const r = new ResizeObserver(([n]) => u(n.contentRect.width));
|
|
324
|
+
return r.observe(o.current), () => r.disconnect();
|
|
322
325
|
}, []);
|
|
323
|
-
const [
|
|
324
|
-
return /* @__PURE__ */
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
+
const [l, y] = $.useState(null), w = Math.max(0, i - W.l - W.r), N = Math.max(0, c - W.t - W.b), h = e.length, f = (r) => W.l + (h <= 1 ? w / 2 : r / (h - 1) * w), m = (r) => W.t + N - r / 100 * N, M = e.map((r, n) => [f(n), m(r.v)]);
|
|
327
|
+
return /* @__PURE__ */ s("div", { ref: o, className: O("relative w-full font-sans", d), children: [
|
|
328
|
+
/* @__PURE__ */ s(
|
|
326
329
|
"svg",
|
|
327
330
|
{
|
|
328
331
|
width: i,
|
|
329
|
-
height:
|
|
332
|
+
height: c,
|
|
330
333
|
className: "block select-none",
|
|
331
334
|
onMouseLeave: () => y(null),
|
|
332
|
-
onMouseMove: (
|
|
333
|
-
const n =
|
|
335
|
+
onMouseMove: (r) => {
|
|
336
|
+
const n = r.currentTarget.getBoundingClientRect(), p = Math.round((r.clientX - n.left - W.l) / w * (h - 1));
|
|
334
337
|
y(Math.max(0, Math.min(h - 1, p)));
|
|
335
338
|
},
|
|
336
339
|
children: [
|
|
337
|
-
[100, 75, 50, 25, 0].map((
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */
|
|
340
|
-
|
|
340
|
+
[100, 75, 50, 25, 0].map((r) => /* @__PURE__ */ s("g", { children: [
|
|
341
|
+
/* @__PURE__ */ a("line", { x1: W.l, x2: W.l + w, y1: m(r), y2: m(r), stroke: V, strokeWidth: 1, strokeDasharray: r === 0 ? void 0 : "3 4", opacity: r === 0 ? 0.9 : 0.6 }),
|
|
342
|
+
/* @__PURE__ */ s("text", { x: W.l - 10, y: m(r), dy: "0.32em", textAnchor: "end", className: "fill-tertiary text-[11px] tabular-nums", children: [
|
|
343
|
+
r,
|
|
341
344
|
"%"
|
|
342
345
|
] })
|
|
343
|
-
] },
|
|
344
|
-
|
|
345
|
-
(
|
|
346
|
+
] }, r)),
|
|
347
|
+
q(e).map(
|
|
348
|
+
(r, n) => r == null ? null : /* @__PURE__ */ a("text", { x: f(n), y: c - 12, textAnchor: "middle", className: "fill-tertiary text-[11px] tabular-nums", children: r.label }, n)
|
|
346
349
|
),
|
|
347
|
-
/* @__PURE__ */
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
e.map((
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
|
|
350
|
+
/* @__PURE__ */ a("path", { d: `${P(M)} L${f(h - 1)},${m(0)} L${f(0)},${m(0)} Z`, fill: C, opacity: 0.12 }),
|
|
351
|
+
/* @__PURE__ */ a("path", { d: P(M), fill: "none", stroke: C, strokeWidth: X, strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
352
|
+
e.map((r, n) => /* @__PURE__ */ s("g", { children: [
|
|
353
|
+
/* @__PURE__ */ s("text", { x: f(n), y: m(r.v) - 12, textAnchor: "middle", className: "fill-foreground text-[11.5px] font-medium tabular-nums", children: [
|
|
354
|
+
r.v,
|
|
352
355
|
"%"
|
|
353
356
|
] }),
|
|
354
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ a("circle", { cx: f(n), cy: m(r.v), r: l === n ? 5.5 : 4, fill: "var(--card)", stroke: C, strokeWidth: Z })
|
|
355
358
|
] }, n))
|
|
356
359
|
]
|
|
357
360
|
}
|
|
358
361
|
),
|
|
359
|
-
|
|
360
|
-
|
|
362
|
+
l != null && e[l] && /* @__PURE__ */ a(
|
|
363
|
+
K,
|
|
361
364
|
{
|
|
362
|
-
x: f(
|
|
363
|
-
y: m(e[
|
|
364
|
-
flip:
|
|
365
|
-
title: e[
|
|
366
|
-
rows: [{ swatch:
|
|
365
|
+
x: f(l),
|
|
366
|
+
y: m(e[l].v),
|
|
367
|
+
flip: l >= h - 2,
|
|
368
|
+
title: e[l].label,
|
|
369
|
+
rows: [{ swatch: C, label: "Retention", value: `${e[l].v}%` }]
|
|
367
370
|
}
|
|
368
371
|
)
|
|
369
372
|
] });
|
|
370
373
|
}
|
|
371
|
-
function
|
|
372
|
-
const
|
|
373
|
-
return `color-mix(in srgb, ${
|
|
374
|
+
function ae(e) {
|
|
375
|
+
const c = 10 + Math.max(0, Math.min(100, e)) / 100 * 78;
|
|
376
|
+
return `color-mix(in srgb, ${C} ${c}%, transparent)`;
|
|
374
377
|
}
|
|
375
|
-
function
|
|
376
|
-
return /* @__PURE__ */
|
|
377
|
-
/* @__PURE__ */
|
|
378
|
-
/* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
e.map((i) => /* @__PURE__ */
|
|
378
|
+
function de({ cols: e, cohorts: c, className: d }) {
|
|
379
|
+
return /* @__PURE__ */ a("div", { className: O("w-full overflow-x-auto font-sans", d), children: /* @__PURE__ */ s("table", { className: "w-full border-collapse text-left", children: [
|
|
380
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ s("tr", { className: "text-xs font-medium text-tertiary", children: [
|
|
381
|
+
/* @__PURE__ */ a("th", { className: "sticky left-0 w-[1%] bg-card py-2 pr-4 whitespace-nowrap", children: "Cohort" }),
|
|
382
|
+
/* @__PURE__ */ a("th", { className: "w-[1%] py-2 pr-4 text-right whitespace-nowrap", children: "Users" }),
|
|
383
|
+
e.map((i) => /* @__PURE__ */ a("th", { className: "px-1.5 py-2 text-center tabular-nums", children: i }, i))
|
|
381
384
|
] }) }),
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
i.values.map((u, o) => /* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ a("tbody", { children: c.map((i) => /* @__PURE__ */ s("tr", { children: [
|
|
386
|
+
/* @__PURE__ */ a("td", { className: "sticky left-0 w-[1%] bg-card py-1.5 pr-4 text-[12.5px] text-secondary whitespace-nowrap", children: i.label }),
|
|
387
|
+
/* @__PURE__ */ a("td", { className: "w-[1%] py-1.5 pr-4 text-right text-[12.5px] text-secondary tabular-nums whitespace-nowrap", children: H(i.size) }),
|
|
388
|
+
i.values.map((u, o) => /* @__PURE__ */ a("td", { className: "px-1 py-1", children: u == null ? /* @__PURE__ */ a("div", { className: "py-[9px] text-center text-[12.5px] text-tertiary tabular-nums", children: "—" }) : /* @__PURE__ */ s(
|
|
386
389
|
"div",
|
|
387
390
|
{
|
|
388
|
-
className:
|
|
391
|
+
className: O(
|
|
389
392
|
"rounded-md py-[9px] text-center text-[12.5px] tabular-nums",
|
|
390
393
|
"text-ink-950"
|
|
391
394
|
),
|
|
392
|
-
style: { background:
|
|
395
|
+
style: { background: ae(u) },
|
|
393
396
|
children: [
|
|
394
397
|
u,
|
|
395
398
|
"%"
|
|
@@ -400,9 +403,9 @@ function ie({ cols: e, cohorts: s, className: d }) {
|
|
|
400
403
|
] }) });
|
|
401
404
|
}
|
|
402
405
|
export {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
406
|
+
se as FunnelBarsHorizontal,
|
|
407
|
+
ce as FunnelViz,
|
|
408
|
+
ie as RetentionCurve,
|
|
409
|
+
de as RetentionGrid,
|
|
410
|
+
oe as SeriesChart
|
|
408
411
|
};
|
|
@@ -30,6 +30,8 @@ import "../../components/radio.js";
|
|
|
30
30
|
import "../../components/switch.js";
|
|
31
31
|
import "../../components/number-field.js";
|
|
32
32
|
import { Select as W } from "../../components/select.js";
|
|
33
|
+
import "@internationalized/date";
|
|
34
|
+
import "react-aria-components";
|
|
33
35
|
import "../../components/autocomplete.js";
|
|
34
36
|
import "../../components/slider.js";
|
|
35
37
|
import "../../components/segmented.js";
|
|
@@ -107,7 +109,7 @@ import "../../components/assistant-ui/quote.js";
|
|
|
107
109
|
import "../../components/assistant-ui/sources.js";
|
|
108
110
|
import "../../components/assistant-ui/tool-fallback.js";
|
|
109
111
|
import "../../components/assistant-ui/tool-group.js";
|
|
110
|
-
function
|
|
112
|
+
function oi({
|
|
111
113
|
block: i,
|
|
112
114
|
trigger: v = "button",
|
|
113
115
|
className: A,
|
|
@@ -359,5 +361,5 @@ function ii({
|
|
|
359
361
|
] });
|
|
360
362
|
}
|
|
361
363
|
export {
|
|
362
|
-
|
|
364
|
+
oi as AddToArtifact
|
|
363
365
|
};
|