@actioneer/ads 1.0.6 → 1.0.8

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