@photon-ai/pho-ui 2.11.0 → 2.13.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.
Files changed (42) hide show
  1. package/dist/chunks/badge-DlLJPLeZ.js +78 -0
  2. package/dist/chunks/badge-DlLJPLeZ.js.map +1 -0
  3. package/dist/chunks/bar-chart-BJfr3eyd.js +190 -0
  4. package/dist/chunks/bar-chart-BJfr3eyd.js.map +1 -0
  5. package/dist/chunks/legend-C0mU7dqd.js +60 -0
  6. package/dist/chunks/legend-C0mU7dqd.js.map +1 -0
  7. package/dist/chunks/line-chart-CUR3AxrR.js +453 -0
  8. package/dist/chunks/line-chart-CUR3AxrR.js.map +1 -0
  9. package/dist/chunks/stat-hnNqjWVG.js +85 -0
  10. package/dist/chunks/stat-hnNqjWVG.js.map +1 -0
  11. package/dist/chunks/use-measure-CMVgLouO.js +616 -0
  12. package/dist/chunks/use-measure-CMVgLouO.js.map +1 -0
  13. package/dist/components/badge.js +5 -71
  14. package/dist/components/bar-chart.js +5 -0
  15. package/dist/components/chart.js +8 -0
  16. package/dist/components/line-chart.js +5 -0
  17. package/dist/components/stat.js +6 -0
  18. package/dist/components/toggle.js +14 -14
  19. package/dist/components/toggle.js.map +1 -1
  20. package/dist/index.js +89 -76
  21. package/dist/src/components/badge/badge.d.ts +7 -3
  22. package/dist/src/components/bar-chart/bar-chart.d.ts +9 -0
  23. package/dist/src/components/bar-chart/index.d.ts +2 -0
  24. package/dist/src/components/chart/axes.d.ts +22 -0
  25. package/dist/src/components/chart/color.d.ts +10 -0
  26. package/dist/src/components/chart/format.d.ts +25 -0
  27. package/dist/src/components/chart/index.d.ts +8 -0
  28. package/dist/src/components/chart/legend.d.ts +26 -0
  29. package/dist/src/components/chart/scale.d.ts +34 -0
  30. package/dist/src/components/chart/shell.d.ts +42 -0
  31. package/dist/src/components/chart/tooltip.d.ts +30 -0
  32. package/dist/src/components/chart/types.d.ts +76 -0
  33. package/dist/src/components/chart/use-measure.d.ts +8 -0
  34. package/dist/src/components/line-chart/index.d.ts +2 -0
  35. package/dist/src/components/line-chart/line-chart.d.ts +11 -0
  36. package/dist/src/components/stat/index.d.ts +1 -0
  37. package/dist/src/components/stat/stat.d.ts +61 -0
  38. package/dist/src/components/toggle/toggle.d.ts +5 -1
  39. package/dist/src/index.d.ts +4 -0
  40. package/package.json +23 -1
  41. package/src/styles/theme.css +51 -0
  42. package/dist/components/badge.js.map +0 -1
@@ -0,0 +1,453 @@
1
+ "use client";
2
+ import { i as bt, t as kt } from "./legend-C0mU7dqd.js";
3
+ import { _ as Mt, a as Tt, c as wt, d as Lt, f as St, g as Ct, h as it, i as Et, l as Pt, m as Nt, n as At, o as Ft, p as It, r as zt, s as ot, t as jt, u as Dt, v as Rt } from "./use-measure-CMVgLouO.js";
4
+ import { useMemo as j, useState as Xt } from "react";
5
+ import { jsx as M, jsxs as st } from "react/jsx-runtime";
6
+ function y(t) {
7
+ return function() {
8
+ return t;
9
+ };
10
+ }
11
+ var V = Math.PI, G = 2 * V, A = 1e-6, Wt = G - A;
12
+ function ht(t) {
13
+ this._ += t[0];
14
+ for (let n = 1, e = t.length; n < e; ++n) this._ += arguments[n] + t[n];
15
+ }
16
+ function Yt(t) {
17
+ let n = Math.floor(t);
18
+ if (!(n >= 0)) throw new Error(`invalid digits: ${t}`);
19
+ if (n > 15) return ht;
20
+ const e = 10 ** n;
21
+ return function(o) {
22
+ this._ += o[0];
23
+ for (let l = 1, a = o.length; l < a; ++l) this._ += Math.round(arguments[l] * e) / e + o[l];
24
+ };
25
+ }
26
+ var J = class {
27
+ constructor(t) {
28
+ this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "", this._append = t == null ? ht : Yt(t);
29
+ }
30
+ moveTo(t, n) {
31
+ this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +n}`;
32
+ }
33
+ closePath() {
34
+ this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
35
+ }
36
+ lineTo(t, n) {
37
+ this._append`L${this._x1 = +t},${this._y1 = +n}`;
38
+ }
39
+ quadraticCurveTo(t, n, e, o) {
40
+ this._append`Q${+t},${+n},${this._x1 = +e},${this._y1 = +o}`;
41
+ }
42
+ bezierCurveTo(t, n, e, o, l, a) {
43
+ this._append`C${+t},${+n},${+e},${+o},${this._x1 = +l},${this._y1 = +a}`;
44
+ }
45
+ arcTo(t, n, e, o, l) {
46
+ if (t = +t, n = +n, e = +e, o = +o, l = +l, l < 0) throw new Error(`negative radius: ${l}`);
47
+ let a = this._x1, c = this._y1, r = e - t, u = o - n, s = a - t, m = c - n, i = s * s + m * m;
48
+ if (this._x1 === null) this._append`M${this._x1 = t},${this._y1 = n}`;
49
+ else if (i > A) if (!(Math.abs(m * r - u * s) > A) || !l) this._append`L${this._x1 = t},${this._y1 = n}`;
50
+ else {
51
+ let h = e - a, x = o - c, b = r * r + u * u, S = h * h + x * x, k = Math.sqrt(b), T = Math.sqrt(i), C = l * Math.tan((V - Math.acos((b + i - S) / (2 * k * T))) / 2), $ = C / T, v = C / k;
52
+ Math.abs($ - 1) > A && this._append`L${t + $ * s},${n + $ * m}`, this._append`A${l},${l},0,0,${+(m * h > s * x)},${this._x1 = t + v * r},${this._y1 = n + v * u}`;
53
+ }
54
+ }
55
+ arc(t, n, e, o, l, a) {
56
+ if (t = +t, n = +n, e = +e, a = !!a, e < 0) throw new Error(`negative radius: ${e}`);
57
+ let c = e * Math.cos(o), r = e * Math.sin(o), u = t + c, s = n + r, m = 1 ^ a, i = a ? o - l : l - o;
58
+ this._x1 === null ? this._append`M${u},${s}` : (Math.abs(this._x1 - u) > A || Math.abs(this._y1 - s) > A) && this._append`L${u},${s}`, e && (i < 0 && (i = i % G + G), i > Wt ? this._append`A${e},${e},0,1,${m},${t - c},${n - r}A${e},${e},0,1,${m},${this._x1 = u},${this._y1 = s}` : i > A && this._append`A${e},${e},0,${+(i >= V)},${m},${this._x1 = t + e * Math.cos(l)},${this._y1 = n + e * Math.sin(l)}`);
59
+ }
60
+ rect(t, n, e, o) {
61
+ this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +n}h${e = +e}v${+o}h${-e}Z`;
62
+ }
63
+ toString() {
64
+ return this._;
65
+ }
66
+ };
67
+ function qt() {
68
+ return new J();
69
+ }
70
+ qt.prototype = J.prototype;
71
+ function ct(t) {
72
+ let n = 3;
73
+ return t.digits = function(e) {
74
+ if (!arguments.length) return n;
75
+ if (e == null) n = null;
76
+ else {
77
+ const o = Math.floor(e);
78
+ if (!(o >= 0)) throw new RangeError(`invalid digits: ${e}`);
79
+ n = o;
80
+ }
81
+ return t;
82
+ }, () => new J(n);
83
+ }
84
+ var Kt = Array.prototype.slice;
85
+ function ft(t) {
86
+ return typeof t == "object" && "length" in t ? t : Array.from(t);
87
+ }
88
+ function pt(t) {
89
+ this._context = t;
90
+ }
91
+ pt.prototype = {
92
+ areaStart: function() {
93
+ this._line = 0;
94
+ },
95
+ areaEnd: function() {
96
+ this._line = NaN;
97
+ },
98
+ lineStart: function() {
99
+ this._point = 0;
100
+ },
101
+ lineEnd: function() {
102
+ (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
103
+ },
104
+ point: function(t, n) {
105
+ switch (t = +t, n = +n, this._point) {
106
+ case 0:
107
+ this._point = 1, this._line ? this._context.lineTo(t, n) : this._context.moveTo(t, n);
108
+ break;
109
+ case 1:
110
+ this._point = 2;
111
+ default:
112
+ this._context.lineTo(t, n);
113
+ }
114
+ }
115
+ };
116
+ function B(t) {
117
+ return new pt(t);
118
+ }
119
+ function _t(t) {
120
+ return t[0];
121
+ }
122
+ function dt(t) {
123
+ return t[1];
124
+ }
125
+ function mt(t, n) {
126
+ var e = y(!0), o = null, l = B, a = null, c = ct(r);
127
+ t = typeof t == "function" ? t : t === void 0 ? _t : y(t), n = typeof n == "function" ? n : n === void 0 ? dt : y(n);
128
+ function r(u) {
129
+ var s, m = (u = ft(u)).length, i, h = !1, x;
130
+ for (o == null && (a = l(x = c())), s = 0; s <= m; ++s)
131
+ !(s < m && e(i = u[s], s, u)) === h && ((h = !h) ? a.lineStart() : a.lineEnd()), h && a.point(+t(i, s, u), +n(i, s, u));
132
+ if (x) return a = null, x + "" || null;
133
+ }
134
+ return r.x = function(u) {
135
+ return arguments.length ? (t = typeof u == "function" ? u : y(+u), r) : t;
136
+ }, r.y = function(u) {
137
+ return arguments.length ? (n = typeof u == "function" ? u : y(+u), r) : n;
138
+ }, r.defined = function(u) {
139
+ return arguments.length ? (e = typeof u == "function" ? u : y(!!u), r) : e;
140
+ }, r.curve = function(u) {
141
+ return arguments.length ? (l = u, o != null && (a = l(o)), r) : l;
142
+ }, r.context = function(u) {
143
+ return arguments.length ? (u == null ? o = a = null : a = l(o = u), r) : o;
144
+ }, r;
145
+ }
146
+ function Ot(t, n, e) {
147
+ var o = null, l = y(!0), a = null, c = B, r = null, u = ct(s);
148
+ t = typeof t == "function" ? t : t === void 0 ? _t : y(+t), n = typeof n == "function" ? n : y(n === void 0 ? 0 : +n), e = typeof e == "function" ? e : e === void 0 ? dt : y(+e);
149
+ function s(i) {
150
+ var h, x, b, S = (i = ft(i)).length, k, T = !1, C, $ = new Array(S), v = new Array(S);
151
+ for (a == null && (r = c(C = u())), h = 0; h <= S; ++h) {
152
+ if (!(h < S && l(k = i[h], h, i)) === T)
153
+ if (T = !T)
154
+ x = h, r.areaStart(), r.lineStart();
155
+ else {
156
+ for (r.lineEnd(), r.lineStart(), b = h - 1; b >= x; --b) r.point($[b], v[b]);
157
+ r.lineEnd(), r.areaEnd();
158
+ }
159
+ T && ($[h] = +t(k, h, i), v[h] = +n(k, h, i), r.point(o ? +o(k, h, i) : $[h], e ? +e(k, h, i) : v[h]));
160
+ }
161
+ if (C) return r = null, C + "" || null;
162
+ }
163
+ function m() {
164
+ return mt().defined(l).curve(c).context(a);
165
+ }
166
+ return s.x = function(i) {
167
+ return arguments.length ? (t = typeof i == "function" ? i : y(+i), o = null, s) : t;
168
+ }, s.x0 = function(i) {
169
+ return arguments.length ? (t = typeof i == "function" ? i : y(+i), s) : t;
170
+ }, s.x1 = function(i) {
171
+ return arguments.length ? (o = i == null ? null : typeof i == "function" ? i : y(+i), s) : o;
172
+ }, s.y = function(i) {
173
+ return arguments.length ? (n = typeof i == "function" ? i : y(+i), e = null, s) : n;
174
+ }, s.y0 = function(i) {
175
+ return arguments.length ? (n = typeof i == "function" ? i : y(+i), s) : n;
176
+ }, s.y1 = function(i) {
177
+ return arguments.length ? (e = i == null ? null : typeof i == "function" ? i : y(+i), s) : e;
178
+ }, s.lineX0 = s.lineY0 = function() {
179
+ return m().x(t).y(n);
180
+ }, s.lineY1 = function() {
181
+ return m().x(t).y(e);
182
+ }, s.lineX1 = function() {
183
+ return m().x(o).y(n);
184
+ }, s.defined = function(i) {
185
+ return arguments.length ? (l = typeof i == "function" ? i : y(!!i), s) : l;
186
+ }, s.curve = function(i) {
187
+ return arguments.length ? (c = i, a != null && (r = c(a)), s) : c;
188
+ }, s.context = function(i) {
189
+ return arguments.length ? (i == null ? a = r = null : r = c(a = i), s) : a;
190
+ }, s;
191
+ }
192
+ function rt(t) {
193
+ return t < 0 ? -1 : 1;
194
+ }
195
+ function lt(t, n, e) {
196
+ var o = t._x1 - t._x0, l = n - t._x1, a = (t._y1 - t._y0) / (o || l < 0 && -0), c = (e - t._y1) / (l || o < 0 && -0), r = (a * l + c * o) / (o + l);
197
+ return (rt(a) + rt(c)) * Math.min(Math.abs(a), Math.abs(c), 0.5 * Math.abs(r)) || 0;
198
+ }
199
+ function ut(t, n) {
200
+ var e = t._x1 - t._x0;
201
+ return e ? (3 * (t._y1 - t._y0) / e - n) / 2 : n;
202
+ }
203
+ function U(t, n, e) {
204
+ var o = t._x0, l = t._y0, a = t._x1, c = t._y1, r = (a - o) / 3;
205
+ t._context.bezierCurveTo(o + r, l + r * n, a - r, c - r * e, a, c);
206
+ }
207
+ function Q(t) {
208
+ this._context = t;
209
+ }
210
+ Q.prototype = {
211
+ areaStart: function() {
212
+ this._line = 0;
213
+ },
214
+ areaEnd: function() {
215
+ this._line = NaN;
216
+ },
217
+ lineStart: function() {
218
+ this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN, this._point = 0;
219
+ },
220
+ lineEnd: function() {
221
+ switch (this._point) {
222
+ case 2:
223
+ this._context.lineTo(this._x1, this._y1);
224
+ break;
225
+ case 3:
226
+ U(this, this._t0, ut(this, this._t0));
227
+ }
228
+ (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
229
+ },
230
+ point: function(t, n) {
231
+ var e = NaN;
232
+ if (t = +t, n = +n, !(t === this._x1 && n === this._y1)) {
233
+ switch (this._point) {
234
+ case 0:
235
+ this._point = 1, this._line ? this._context.lineTo(t, n) : this._context.moveTo(t, n);
236
+ break;
237
+ case 1:
238
+ this._point = 2;
239
+ break;
240
+ case 2:
241
+ this._point = 3, U(this, ut(this, e = lt(this, t, n)), e);
242
+ break;
243
+ default:
244
+ U(this, this._t0, e = lt(this, t, n));
245
+ }
246
+ this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = n, this._t0 = e;
247
+ }
248
+ }
249
+ };
250
+ function Ht(t) {
251
+ this._context = new vt(t);
252
+ }
253
+ (Ht.prototype = Object.create(Q.prototype)).point = function(t, n) {
254
+ Q.prototype.point.call(this, n, t);
255
+ };
256
+ function vt(t) {
257
+ this._context = t;
258
+ }
259
+ vt.prototype = {
260
+ moveTo: function(t, n) {
261
+ this._context.moveTo(n, t);
262
+ },
263
+ closePath: function() {
264
+ this._context.closePath();
265
+ },
266
+ lineTo: function(t, n) {
267
+ this._context.lineTo(n, t);
268
+ },
269
+ bezierCurveTo: function(t, n, e, o, l, a) {
270
+ this._context.bezierCurveTo(n, t, o, e, a, l);
271
+ }
272
+ };
273
+ function at(t) {
274
+ return new Q(t);
275
+ }
276
+ var Zt = 2, Bt = 4;
277
+ function Qt({ data: t, series: n, label: e, description: o, height: l = 200, width: a, valueFormat: c, timeFormat: r, locale: u, legend: s, baseline: m = "zero", curve: i = "linear", area: h = !1, breakdownTitle: x, loading: b, empty: S = "Nothing here yet.", className: k, ...T }) {
278
+ const [C, $] = jt(a), [v, K] = Xt(null), f = j(() => {
279
+ const p = n.map((N, L) => bt(N.color, L)), _ = t.map((N) => It(N.x)), g = Tt(_), d = c ?? it(u, !0), H = c ?? it(u), W = r ?? Ft(u, g), Z = n.map((N) => t.map((L) => Ct(L, N.key)));
280
+ let w = 1 / 0, z = -1 / 0;
281
+ for (const N of Z) for (const L of N)
282
+ L != null && (L < w && (w = L), L > z && (z = L));
283
+ w === 1 / 0 && (w = 0, z = 0), m === "zero" && (w = Math.min(0, w), z = Math.max(0, z));
284
+ const et = Pt(w, z);
285
+ return {
286
+ colors: p,
287
+ times: _,
288
+ values: Z,
289
+ axisFormat: d,
290
+ fullFormat: H,
291
+ headingFormat: W,
292
+ y: et,
293
+ yLabels: et.ticks.map(d),
294
+ described: o ?? Nt({
295
+ data: t,
296
+ series: n,
297
+ kind: "line",
298
+ valueFormat: H,
299
+ timeFormat: W
300
+ })
301
+ };
302
+ }, [
303
+ t,
304
+ n,
305
+ m,
306
+ c,
307
+ r,
308
+ u,
309
+ o
310
+ ]), F = Et($, l, f.yLabels), D = t.length, E = f.times[0] ?? 0, R = f.times[D - 1] ?? 0, { left: Y, right: q, top: tt, bottom: nt } = F, O = j(() => ot(R > E ? [E, R] : [E - 1, E + 1], [Y, q]), [
311
+ E,
312
+ R,
313
+ Y,
314
+ q
315
+ ]), I = j(() => ot(f.y.domain, [nt, tt]), [
316
+ f.y.domain,
317
+ nt,
318
+ tt
319
+ ]), P = j(() => f.times.map((p) => O(p)), [f.times, O]), yt = j(() => {
320
+ const p = mt().defined((d) => d[1] != null).x((d) => d[0]).y((d) => I(d[1])).curve(i === "monotone" ? at : B), _ = Math.max(f.y.domain[0], Math.min(0, f.y.domain[1])), g = Ot().defined((d) => d[1] != null).x((d) => d[0]).y0(I(_)).y1((d) => I(d[1])).curve(i === "monotone" ? at : B);
321
+ return f.values.map((d, H) => {
322
+ const W = d.map((Z, w) => [P[w], Z]);
323
+ return {
324
+ stroke: p(W) ?? "",
325
+ area: h && H === 0 ? g(W) ?? "" : null
326
+ };
327
+ });
328
+ }, [
329
+ f.values,
330
+ f.y.domain,
331
+ P,
332
+ I,
333
+ i,
334
+ h
335
+ ]), gt = j(() => {
336
+ const p = q - Y;
337
+ if (D === 0 || p <= 0) return [];
338
+ const _ = St(u), g = Lt(E, R, p);
339
+ return Dt(g, _, p).map((d) => ({
340
+ x: O(d.getTime()),
341
+ label: _(d)
342
+ }));
343
+ }, [
344
+ D,
345
+ E,
346
+ R,
347
+ Y,
348
+ q,
349
+ O,
350
+ u
351
+ ]), xt = (p) => {
352
+ if (D === 0) return;
353
+ const _ = p.currentTarget.getBoundingClientRect(), g = _.width > 0 ? $ / _.width : 1, d = (p.clientX - _.left) * g;
354
+ K(wt(P, d));
355
+ }, X = v != null ? t[v] : void 0, $t = s ?? n.length > 1;
356
+ return /* @__PURE__ */ st(zt, {
357
+ label: e,
358
+ description: f.described,
359
+ height: l,
360
+ width: $,
361
+ containerRef: C,
362
+ loading: b,
363
+ empty: S,
364
+ showEmpty: D === 0 && !b,
365
+ onPlotPointerMove: xt,
366
+ onPlotPointerLeave: () => K(null),
367
+ className: k,
368
+ legend: $t ? /* @__PURE__ */ M(kt, { items: n.map((p, _) => ({
369
+ label: p.label,
370
+ color: f.colors[_],
371
+ kind: "line",
372
+ dashed: p.dashed
373
+ })) }) : null,
374
+ tooltip: v != null && X != null ? /* @__PURE__ */ M(At, {
375
+ x: P[v],
376
+ width: $,
377
+ top: F.top,
378
+ heading: f.headingFormat(new Date(X.x)),
379
+ rows: n.map((p, _) => {
380
+ const g = f.values[_][v];
381
+ return {
382
+ label: p.label,
383
+ value: g == null ? "No data" : f.fullFormat(g),
384
+ color: f.colors[_],
385
+ kind: "line",
386
+ dashed: p.dashed
387
+ };
388
+ }),
389
+ breakdown: X.breakdown,
390
+ breakdownTitle: x,
391
+ valueFormat: f.fullFormat
392
+ }) : null,
393
+ ...T,
394
+ children: [
395
+ /* @__PURE__ */ M(Rt, {
396
+ layout: F,
397
+ ticks: f.y.ticks,
398
+ labels: f.yLabels,
399
+ scale: I
400
+ }),
401
+ /* @__PURE__ */ M(Mt, {
402
+ layout: F,
403
+ ticks: gt
404
+ }),
405
+ v != null && X != null && /* @__PURE__ */ M("line", {
406
+ x1: P[v],
407
+ x2: P[v],
408
+ y1: F.top,
409
+ y2: F.bottom,
410
+ stroke: "var(--color-pho-chart-crosshair)"
411
+ }),
412
+ /* @__PURE__ */ M("g", {
413
+ "data-lines": "",
414
+ children: yt.map((p, _) => /* @__PURE__ */ st("g", {
415
+ "data-series": n[_].key,
416
+ children: [p.area != null && p.area !== "" && /* @__PURE__ */ M("path", {
417
+ d: p.area,
418
+ fill: f.colors[_],
419
+ fillOpacity: 0.1
420
+ }), /* @__PURE__ */ M("path", {
421
+ d: p.stroke,
422
+ fill: "none",
423
+ stroke: f.colors[_],
424
+ strokeWidth: Zt,
425
+ strokeLinejoin: "round",
426
+ strokeLinecap: "round",
427
+ strokeDasharray: n[_].dashed ? "4 4" : void 0
428
+ })]
429
+ }, n[_].key))
430
+ }),
431
+ v != null && X != null && /* @__PURE__ */ M("g", {
432
+ "data-points": "",
433
+ children: f.values.map((p, _) => {
434
+ const g = p[v];
435
+ return g == null ? null : /* @__PURE__ */ M("circle", {
436
+ cx: P[v],
437
+ cy: I(g),
438
+ r: Bt,
439
+ fill: f.colors[_],
440
+ stroke: "var(--pho-surface, var(--background-color-pho-primary))",
441
+ strokeWidth: 2
442
+ }, n[_].key);
443
+ })
444
+ })
445
+ ]
446
+ });
447
+ }
448
+ Qt.displayName = "LineChart";
449
+ export {
450
+ Qt as t
451
+ };
452
+
453
+ //# sourceMappingURL=line-chart-CUR3AxrR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-chart-CUR3AxrR.js","names":["constant","curveLinear","x","pointX","y","pointY","array","constant","curveLinear","pointX","pointY","array","line"],"sources":["../../../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js","../../../../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js","../../../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js","../../../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js","../../../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js","../../../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js","../../../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js","../../../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/area.js","../../../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/monotone.js","../../src/components/line-chart/line-chart.tsx"],"sourcesContent":["export default function(x) {\n return function constant() {\n return x;\n };\n}\n","const pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction append(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n let d = Math.floor(digits);\n if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);\n if (d > 15) return append;\n const k = 10 ** d;\n return function(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n}\n\nexport class Path {\n constructor(digits) {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n this._append = digits == null ? append : appendRound(digits);\n }\n moveTo(x, y) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;\n }\n closePath() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._append`Z`;\n }\n }\n lineTo(x, y) {\n this._append`L${this._x1 = +x},${this._y1 = +y}`;\n }\n quadraticCurveTo(x1, y1, x, y) {\n this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;\n }\n bezierCurveTo(x1, y1, x2, y2, x, y) {\n this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;\n }\n arcTo(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._append`M${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._append`L${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Otherwise, draw an arc!\n else {\n let x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;\n }\n\n this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;\n }\n }\n arc(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._append`M${x0},${y0}`;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._append`L${x0},${y0}`;\n }\n\n // Is this arc empty? We’re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;\n }\n }\n rect(x, y, w, h) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;\n }\n toString() {\n return this._;\n }\n}\n\nexport function path() {\n return new Path;\n}\n\n// Allow instanceof d3.path\npath.prototype = Path.prototype;\n\nexport function pathRound(digits = 3) {\n return new Path(+digits);\n}\n","import {Path} from \"d3-path\";\n\nexport function withPath(shape) {\n let digits = 3;\n\n shape.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) {\n digits = null;\n } else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n return shape;\n };\n\n return () => new Path(digits);\n}\n","export var slice = Array.prototype.slice;\n\nexport default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n","function Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nexport default function(context) {\n return new Linear(context);\n}\n","export function x(p) {\n return p[0];\n}\n\nexport function y(p) {\n return p[1];\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x, y) {\n var defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(line);\n\n x = typeof x === \"function\" ? x : (x === undefined) ? pointX : constant(x);\n y = typeof y === \"function\" ? y : (y === undefined) ? pointY : constant(y);\n\n function line(data) {\n var i,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer;\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x(d, i, data), +y(d, i, data));\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n line.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), line) : x;\n };\n\n line.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), line) : y;\n };\n\n line.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), line) : defined;\n };\n\n line.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;\n };\n\n line.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;\n };\n\n return line;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport line from \"./line.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x0, y0, y1) {\n var x1 = null,\n defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(area);\n\n x0 = typeof x0 === \"function\" ? x0 : (x0 === undefined) ? pointX : constant(+x0);\n y0 = typeof y0 === \"function\" ? y0 : (y0 === undefined) ? constant(0) : constant(+y0);\n y1 = typeof y1 === \"function\" ? y1 : (y1 === undefined) ? pointY : constant(+y1);\n\n function area(data) {\n var i,\n j,\n k,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer,\n x0z = new Array(n),\n y0z = new Array(n);\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) {\n j = i;\n output.areaStart();\n output.lineStart();\n } else {\n output.lineEnd();\n output.lineStart();\n for (k = i - 1; k >= j; --k) {\n output.point(x0z[k], y0z[k]);\n }\n output.lineEnd();\n output.areaEnd();\n }\n }\n if (defined0) {\n x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);\n output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);\n }\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n function arealine() {\n return line().defined(defined).curve(curve).context(context);\n }\n\n area.x = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), x1 = null, area) : x0;\n };\n\n area.x0 = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), area) : x0;\n };\n\n area.x1 = function(_) {\n return arguments.length ? (x1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : x1;\n };\n\n area.y = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), y1 = null, area) : y0;\n };\n\n area.y0 = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), area) : y0;\n };\n\n area.y1 = function(_) {\n return arguments.length ? (y1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : y1;\n };\n\n area.lineX0 =\n area.lineY0 = function() {\n return arealine().x(x0).y(y0);\n };\n\n area.lineY1 = function() {\n return arealine().x(x0).y(y1);\n };\n\n area.lineX1 = function() {\n return arealine().x(x1).y(y0);\n };\n\n area.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), area) : defined;\n };\n\n area.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;\n };\n\n area.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;\n };\n\n return area;\n}\n","function sign(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n}\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n return new MonotoneY(context);\n}\n","import { useMemo, useState, type PointerEvent } from \"react\";\nimport { area as shapeArea, curveLinear, curveMonotoneX, line } from \"d3-shape\";\nimport { XAxis, YAxis } from \"../chart/axes\";\nimport { chartColor } from \"../chart/color\";\nimport { describeChart, numberFormatter, readValue } from \"../chart/format\";\nimport { ChartLegend } from \"../chart/legend\";\nimport {\n bucketSpan,\n bucketTimeFormatter,\n linearScale,\n nearestIndex,\n niceLinearDomain,\n thinTicks,\n timeAxisTicks,\n timeTickFormatter,\n toTime,\n} from \"../chart/scale\";\nimport { ChartShell, chartLayout } from \"../chart/shell\";\nimport { ChartTooltip } from \"../chart/tooltip\";\nimport type { ChartBaseProps, ChartDatum } from \"../chart/types\";\nimport { useMeasuredWidth } from \"../chart/use-measure\";\n\n/**\n * LineChart — series over time as lines: latency percentiles, one line\n * per destination, a min / average / max where the bounds are dashed.\n *\n * Design notes:\n * - A 2px stroke with round joins, no markers at rest. Straight segments\n * by default: a curve invents values between samples, so `curve=\n * \"monotone\"` is a choice the page makes for a smooth-by-nature\n * quantity. `area` washes the surface under a lone series at 10%.\n * - Hover snaps a crosshair to the nearest bucket and rings each series'\n * point in the surface colour, so a dot stays legible where lines\n * cross; the tooltip lists every series at that time.\n * - Gridlines, axis text, legend and the figure's spoken summary are the\n * bar chart's — one system, one reading.\n */\n\nconst LINE_WIDTH = 2;\nconst POINT_RADIUS = 4;\n\nexport interface LineChartProps<\n T extends ChartDatum,\n> extends ChartBaseProps<T> {\n /** Straight segments, or a monotone curve that never overshoots a sample. @default \"linear\" */\n curve?: \"linear\" | \"monotone\";\n /** A soft fill under the first series (a lone one, as a rule). */\n area?: boolean;\n}\n\ntype Point = [number, number | null];\n\nexport function LineChart<T extends ChartDatum>({\n data,\n series,\n label,\n description,\n height = 200,\n width: fixedWidth,\n valueFormat,\n timeFormat,\n locale,\n legend,\n baseline = \"zero\",\n curve = \"linear\",\n area = false,\n breakdownTitle,\n loading,\n empty = \"Nothing here yet.\",\n className,\n ...props\n}: LineChartProps<T>) {\n const [containerRef, width] = useMeasuredWidth<HTMLDivElement>(fixedWidth);\n const [hovered, setHovered] = useState<number | null>(null);\n\n const model = useMemo(() => {\n const colors = series.map((s, index) => chartColor(s.color, index));\n const times = data.map((d) => toTime(d.x));\n const span = bucketSpan(times);\n const axisFormat = valueFormat ?? numberFormatter(locale, true);\n const fullFormat = valueFormat ?? numberFormatter(locale);\n const headingFormat = timeFormat ?? bucketTimeFormatter(locale, span);\n const values = series.map((s) => data.map((d) => readValue(d, s.key)));\n let min = Infinity;\n let max = -Infinity;\n for (const column of values) {\n for (const value of column) {\n if (value == null) continue;\n if (value < min) min = value;\n if (value > max) max = value;\n }\n }\n if (min === Infinity) {\n min = 0;\n max = 0;\n }\n if (baseline === \"zero\") {\n min = Math.min(0, min);\n max = Math.max(0, max);\n }\n const y = niceLinearDomain(min, max);\n return {\n colors,\n times,\n values,\n axisFormat,\n fullFormat,\n headingFormat,\n y,\n yLabels: y.ticks.map(axisFormat),\n described:\n description ??\n describeChart({\n data,\n series,\n kind: \"line\",\n valueFormat: fullFormat,\n timeFormat: headingFormat,\n }),\n };\n }, [data, series, baseline, valueFormat, timeFormat, locale, description]);\n\n const layout = chartLayout(width, height, model.yLabels);\n const n = data.length;\n const t0 = model.times[0] ?? 0;\n const t1 = model.times[n - 1] ?? 0;\n const { left, right, top, bottom } = layout;\n const xScale = useMemo(\n () => linearScale(t1 > t0 ? [t0, t1] : [t0 - 1, t0 + 1], [left, right]),\n [t0, t1, left, right],\n );\n const yScale = useMemo(\n () => linearScale(model.y.domain, [bottom, top]),\n [model.y.domain, bottom, top],\n );\n const xs = useMemo(\n () => model.times.map((t) => xScale(t)),\n [model.times, xScale],\n );\n\n const paths = useMemo(() => {\n const shape = line<Point>()\n .defined((p) => p[1] != null)\n .x((p) => p[0])\n .y((p) => yScale(p[1]!))\n .curve(curve === \"monotone\" ? curveMonotoneX : curveLinear);\n const floor = Math.max(model.y.domain[0], Math.min(0, model.y.domain[1]));\n const fill = shapeArea<Point>()\n .defined((p) => p[1] != null)\n .x((p) => p[0])\n .y0(yScale(floor))\n .y1((p) => yScale(p[1]!))\n .curve(curve === \"monotone\" ? curveMonotoneX : curveLinear);\n return model.values.map((column, index) => {\n const points: Point[] = column.map((value, i) => [xs[i]!, value]);\n return {\n stroke: shape(points) ?? \"\",\n area: area && index === 0 ? (fill(points) ?? \"\") : null,\n };\n });\n }, [model.values, model.y.domain, xs, yScale, curve, area]);\n\n const xTicks = useMemo(() => {\n const innerWidth = right - left;\n if (n === 0 || innerWidth <= 0) return [];\n const format = timeTickFormatter(locale);\n const ticks = timeAxisTicks(t0, t1, innerWidth);\n return thinTicks(ticks, format, innerWidth).map((tick) => ({\n x: xScale(tick.getTime()),\n label: format(tick),\n }));\n }, [n, t0, t1, left, right, xScale, locale]);\n\n const onPointerMove = (event: PointerEvent<SVGSVGElement>) => {\n if (n === 0) return;\n const rect = event.currentTarget.getBoundingClientRect();\n const scale = rect.width > 0 ? width / rect.width : 1;\n const px = (event.clientX - rect.left) * scale;\n setHovered(nearestIndex(xs, px));\n };\n\n const hoveredDatum = hovered != null ? data[hovered] : undefined;\n const showLegend = legend ?? series.length > 1;\n\n return (\n <ChartShell\n label={label}\n description={model.described}\n height={height}\n width={width}\n containerRef={containerRef}\n loading={loading}\n empty={empty}\n showEmpty={n === 0 && !loading}\n onPlotPointerMove={onPointerMove}\n onPlotPointerLeave={() => setHovered(null)}\n className={className}\n legend={\n showLegend ? (\n <ChartLegend\n items={series.map((s, index) => ({\n label: s.label,\n color: model.colors[index]!,\n kind: \"line\",\n dashed: s.dashed,\n }))}\n />\n ) : null\n }\n tooltip={\n hovered != null && hoveredDatum != null ? (\n <ChartTooltip\n x={xs[hovered]!}\n width={width}\n top={layout.top}\n heading={model.headingFormat(new Date(hoveredDatum.x))}\n rows={series.map((s, index) => {\n const value = model.values[index]![hovered];\n return {\n label: s.label,\n value: value == null ? \"No data\" : model.fullFormat(value),\n color: model.colors[index]!,\n kind: \"line\",\n dashed: s.dashed,\n };\n })}\n breakdown={hoveredDatum.breakdown}\n breakdownTitle={breakdownTitle}\n valueFormat={model.fullFormat}\n />\n ) : null\n }\n {...props}\n >\n <YAxis\n layout={layout}\n ticks={model.y.ticks}\n labels={model.yLabels}\n scale={yScale}\n />\n <XAxis layout={layout} ticks={xTicks} />\n {hovered != null && hoveredDatum != null && (\n <line\n x1={xs[hovered]}\n x2={xs[hovered]}\n y1={layout.top}\n y2={layout.bottom}\n stroke=\"var(--color-pho-chart-crosshair)\"\n />\n )}\n <g data-lines=\"\">\n {paths.map((path, index) => (\n <g key={series[index]!.key} data-series={series[index]!.key}>\n {path.area != null && path.area !== \"\" && (\n <path\n d={path.area}\n fill={model.colors[index]}\n fillOpacity={0.1}\n />\n )}\n <path\n d={path.stroke}\n fill=\"none\"\n stroke={model.colors[index]}\n strokeWidth={LINE_WIDTH}\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n strokeDasharray={series[index]!.dashed ? \"4 4\" : undefined}\n />\n </g>\n ))}\n </g>\n {hovered != null && hoveredDatum != null && (\n <g data-points=\"\">\n {model.values.map((column, index) => {\n const value = column[hovered];\n if (value == null) return null;\n return (\n <circle\n key={series[index]!.key}\n cx={xs[hovered]}\n cy={yScale(value)}\n r={POINT_RADIUS}\n fill={model.colors[index]}\n // The surface ring keeps a dot legible where lines cross.\n stroke=\"var(--pho-surface, var(--background-color-pho-primary))\"\n strokeWidth={2}\n />\n );\n })}\n </g>\n )}\n </ChartShell>\n );\n}\n\nLineChart.displayName = \"LineChart\";\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8],"mappings":";;;;;AAAA,SAAA,EAAwB,GAAG;AACzB,SAAO,WAAoB;AACzB,WAAO;AAAA,EACT;AACF;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AM,OAAO,CAAA;AAAA,YACrB,aAAa;AAAA,YACb,gBAAe;AAAA,YACf,eAAc;AAAA,YACd,iBAAiB,EAAO,CAAA,EAAQ,SAAS,QAAQ;AAAA,UAClD,CAAA,CACA;AAAA,QAjBK,GAAA,EAAO,CAAA,EAAQ,GAiBpB,CACJ;AAAA,MACA,CAAA;AAAA,MACF,KAAW,QAAQ,KAAgB,QAClC,gBAAA,EAAC,KAAD;AAAA,QAAG,eAAY;AAAA,QACZ,UAAA,EAAM,OAAO,IAAA,CAAK,GAAQ,MAAU;AACnC,gBAAM,IAAQ,EAAO,CAAA;AACrB,iBAAI,KAAS,OAAa,OAExB,gBAAA,EAAC,UAAD;AAAA,YAEE,IAAI,EAAG,CAAA;AAAA,YACP,IAAI,EAAO,CAAK;AAAA,YAChB,GAAG;AAAA,YACH,MAAM,EAAM,OAAO,CAAA;AAAA,YAEnB,QAAO;AAAA,YACP,aAAa;AAAA,UACd,GARM,EAAO,CAAA,EAAQ,GAQrB;AAAA,QAEL,CAAC;AAAA,MACA,CAAA;AAAA,IAEK;AAAA;AAEhB;AAEA,GAAU,cAAc"}
@@ -0,0 +1,85 @@
1
+ "use client";
2
+ import { t as c } from "./cn-ChIgwEl3.js";
3
+ import { t as p } from "./createReactComponent-BqCmnqfX.js";
4
+ import { r as h } from "./badge-DlLJPLeZ.js";
5
+ import "react";
6
+ import { jsx as a, jsxs as i } from "react/jsx-runtime";
7
+ var y = [["path", {
8
+ d: "M3 7l6 6l4 -4l8 8",
9
+ key: "svg-0"
10
+ }], ["path", {
11
+ d: "M21 10l0 7l-7 0",
12
+ key: "svg-1"
13
+ }]], w = p("outline", "trending-down", "TrendingDown", y), N = [["path", {
14
+ d: "M3 17l6 -6l4 4l8 -8",
15
+ key: "svg-0"
16
+ }], ["path", {
17
+ d: "M14 7l7 0l0 7",
18
+ key: "svg-1"
19
+ }]], b = p("outline", "trending-up", "TrendingUp", N), v = new Intl.NumberFormat("en-US", {
20
+ minimumFractionDigits: 1,
21
+ maximumFractionDigits: 1,
22
+ signDisplay: "exceptZero"
23
+ });
24
+ function _(t) {
25
+ if (typeof t == "number") return t > 0 ? "up" : t < 0 ? "down" : "flat";
26
+ const e = t.trim(), r = e.charAt(0);
27
+ if (!(r === "+" || r === "-" || r === "−")) return "flat";
28
+ const o = e.slice(1).trim();
29
+ return Number.parseFloat(o) === 0 && !/[1-9]/.test(o) ? "flat" : r === "+" ? "up" : "down";
30
+ }
31
+ function k(t, e) {
32
+ return t === "flat" || e === "none" ? "muted" : t === e ? "success" : "error";
33
+ }
34
+ function m({ label: t, value: e, delta: r, deltaDirection: o, deltaGood: d = "up", note: s, className: f, ...x }) {
35
+ const n = r == null ? null : o ?? _(r), g = typeof r == "number" ? `${v.format(r).replace("-", "−")}%` : r, l = n === "up" ? b : n === "down" ? w : null;
36
+ return /* @__PURE__ */ i("div", {
37
+ "data-stat": "",
38
+ className: c("flex min-w-0 flex-col gap-1 px-5 py-4", f),
39
+ ...x,
40
+ children: [
41
+ /* @__PURE__ */ i("div", {
42
+ className: "flex items-start justify-between gap-3",
43
+ children: [/* @__PURE__ */ a("span", {
44
+ className: "text-pho-secondary min-w-0 truncate text-base",
45
+ children: t
46
+ }), r != null && n != null && /* @__PURE__ */ i(h, {
47
+ size: "sm",
48
+ contrast: "low",
49
+ color: k(n, d),
50
+ className: "shrink-0 tabular-nums",
51
+ "data-direction": n,
52
+ children: [l && /* @__PURE__ */ a(l, {
53
+ "aria-hidden": !0,
54
+ className: "size-3"
55
+ }), g]
56
+ })]
57
+ }),
58
+ /* @__PURE__ */ a("span", {
59
+ className: "text-display-md text-pho-primary min-w-0 truncate font-medium",
60
+ children: e
61
+ }),
62
+ s != null && /* @__PURE__ */ a("span", {
63
+ className: "text-pho-description truncate text-xs",
64
+ children: s
65
+ })
66
+ ]
67
+ });
68
+ }
69
+ m.displayName = "Stat";
70
+ function u({ variant: t = "card", className: e, ...r }) {
71
+ return /* @__PURE__ */ a("div", {
72
+ role: "group",
73
+ "data-stat-group": "",
74
+ className: c("bg-pho-secondary [&>*]:bg-pho-primary flex flex-wrap gap-px [&>*]:min-w-0 [&>*]:flex-[1_1_12rem]", t === "card" && "border-pho-secondary rounded-base overflow-hidden border", e),
75
+ ...r
76
+ });
77
+ }
78
+ u.displayName = "Stat.Group";
79
+ m.Group = u;
80
+ export {
81
+ u as n,
82
+ m as t
83
+ };
84
+
85
+ //# sourceMappingURL=stat-hnNqjWVG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stat-hnNqjWVG.js","names":["__iconNode"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconTrendingDown.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconTrendingUp.mjs","../../src/components/stat/stat.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M3 7l6 6l4 -4l8 8\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M21 10l0 7l-7 0\", \"key\": \"svg-1\" }]];\nconst IconTrendingDown = createReactComponent(\"outline\", \"trending-down\", \"TrendingDown\", __iconNode);\n\nexport { __iconNode, IconTrendingDown as default };\n//# sourceMappingURL=IconTrendingDown.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M3 17l6 -6l4 4l8 -8\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M14 7l7 0l0 7\", \"key\": \"svg-1\" }]];\nconst IconTrendingUp = createReactComponent(\"outline\", \"trending-up\", \"TrendingUp\", __iconNode);\n\nexport { __iconNode, IconTrendingUp as default };\n//# sourceMappingURL=IconTrendingUp.mjs.map\n","import { type ComponentProps, type ReactNode } from \"react\";\nimport { IconTrendingDown, IconTrendingUp } from \"@tabler/icons-react\";\nimport { Badge, type BadgeColor } from \"../badge\";\nimport { cn } from \"../../utils/cn\";\n\n/**\n * Stat — a figure with its name: a label, a value, and, when it\n * matters, how the value moved and against what.\n *\n * Design notes:\n * - The value is the loud element: display size, medium weight, the\n * font's proportional figures (tabular digits make a big `121` look\n * loose). Label and note stay in the UI inks; nothing else competes.\n * - The delta is a low-contrast `Badge` beside the label, with an arrow so\n * the direction never rides on colour alone. Its ink says whether the\n * move is good news: `deltaGood` names the good direction, because a\n * drop in bounce rate is green and a drop in visitors is red.\n * - A tile has no chrome of its own. Alone, it sits in whatever card holds\n * it; in a `Stat.Group` the tiles share one frame and hairlines.\n */\n\nexport type StatDirection = \"up\" | \"down\" | \"flat\";\n\nexport interface StatProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n /** What the figure counts — \"Visitors\", \"Active chats\". */\n label: ReactNode;\n /** The figure, already formatted — \"20.8K\", \"8m 32s\", \"1:1\". */\n value: ReactNode;\n /**\n * How the value moved: a number is a percentage change and renders\n * signed with one decimal (\"−42.0%\"); a string renders as written and\n * its sign sets the direction.\n */\n delta?: number | string;\n /** The delta's direction, when the string can't say. Derived otherwise. */\n deltaDirection?: StatDirection;\n /**\n * Which direction is good news: `up` (visitors, revenue), `down` (bounce\n * rate, latency), `none` when a move is just information. @default \"up\"\n */\n deltaGood?: \"up\" | \"down\" | \"none\";\n /** What the delta is against — \"vs. 36.2K prior\". */\n note?: ReactNode;\n}\n\nconst percent = new Intl.NumberFormat(\"en-US\", {\n minimumFractionDigits: 1,\n maximumFractionDigits: 1,\n signDisplay: \"exceptZero\",\n});\n\n/**\n * A leading sign — ASCII or the true minus — sets a string delta's direction.\n * A signed zero (\"+0%\", \"−0.0%\") is still flat: a caller's formatter may\n * sign every value, and zero has not moved.\n */\nfunction directionOf(delta: number | string): StatDirection {\n if (typeof delta === \"number\") {\n return delta > 0 ? \"up\" : delta < 0 ? \"down\" : \"flat\";\n }\n const trimmed = delta.trim();\n const first = trimmed.charAt(0);\n const signed = first === \"+\" || first === \"-\" || first === \"−\";\n if (!signed) return \"flat\";\n const body = trimmed.slice(1).trim();\n if (Number.parseFloat(body) === 0 && !/[1-9]/.test(body)) return \"flat\";\n return first === \"+\" ? \"up\" : \"down\";\n}\n\nfunction deltaColor(\n direction: StatDirection,\n good: NonNullable<StatProps[\"deltaGood\"]>,\n): BadgeColor {\n if (direction === \"flat\" || good === \"none\") return \"muted\";\n return direction === good ? \"success\" : \"error\";\n}\n\nexport function Stat({\n label,\n value,\n delta,\n deltaDirection,\n deltaGood = \"up\",\n note,\n className,\n ...props\n}: StatProps) {\n const direction =\n delta == null ? null : (deltaDirection ?? directionOf(delta));\n const text =\n typeof delta === \"number\"\n ? // The true minus, so the sign reads at badge size.\n `${percent.format(delta).replace(\"-\", \"−\")}%`\n : delta;\n const Arrow =\n direction === \"up\"\n ? IconTrendingUp\n : direction === \"down\"\n ? IconTrendingDown\n : null;\n return (\n <div\n data-stat=\"\"\n className={cn(\"flex min-w-0 flex-col gap-1 px-5 py-4\", className)}\n {...props}\n >\n <div className=\"flex items-start justify-between gap-3\">\n <span className=\"text-pho-secondary min-w-0 truncate text-base\">\n {label}\n </span>\n {delta != null && direction != null && (\n <Badge\n size=\"sm\"\n contrast=\"low\"\n color={deltaColor(direction, deltaGood)}\n className=\"shrink-0 tabular-nums\"\n data-direction={direction}\n >\n {Arrow && <Arrow aria-hidden className=\"size-3\" />}\n {text}\n </Badge>\n )}\n </div>\n <span className=\"text-display-md text-pho-primary min-w-0 truncate font-medium\">\n {value}\n </span>\n {note != null && (\n <span className=\"text-pho-description truncate text-xs\">{note}</span>\n )}\n </div>\n );\n}\n\nStat.displayName = \"Stat\";\n\nexport interface StatGroupProps extends ComponentProps<\"div\"> {\n /**\n * `card` frames the row as a card of its own; `plain` keeps only the\n * hairlines between tiles, for a row inside a card or under a chart.\n * @default \"card\"\n */\n variant?: \"card\" | \"plain\";\n}\n\n/**\n * A row of tiles that reads as one card: hairlines between tiles, and\n * between rows once the tiles wrap on a narrow width. Each tile takes an\n * equal share of its row, never narrower than 12rem; a tile that wraps\n * alone stretches across its line, so the frame never shows a hole.\n */\nexport function StatGroup({\n variant = \"card\",\n className,\n ...props\n}: StatGroupProps) {\n return (\n <div\n // A row of figures is a group, not a form's fieldset: the role, and\n // the caller's `aria-label`, name it for assistive tech.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n data-stat-group=\"\"\n className={cn(\n // The hairlines are the gap: the frame's secondary shows through\n // 1px between tiles, so wrapping rows get a rule too. Flex, not\n // grid: a grid's empty cells on the last row would show through.\n \"bg-pho-secondary [&>*]:bg-pho-primary flex flex-wrap gap-px [&>*]:min-w-0 [&>*]:flex-[1_1_12rem]\",\n variant === \"card\" &&\n \"border-pho-secondary rounded-base overflow-hidden border\",\n className,\n )}\n {...props}\n />\n );\n}\n\nStatGroup.displayName = \"Stat.Group\";\nStat.Group = StatGroup;\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;AASA,IAAMA,IAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAqB,KAAO;AAAQ,CAAC,GAAG,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAmB,KAAO;AAAQ,CAAC,CAAC,GAC1H,IAAmB,EAAqB,WAAW,iBAAiB,gBAAgBA,CAAU,GCD9F,IAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAuB,KAAO;AAAQ,CAAC,GAAG,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAiB,KAAO;AAAQ,CAAC,CAAC,GAC1H,IAAiB,EAAqB,WAAW,eAAe,cAAc,CAAU,GCmCxF,IAAU,IAAI,KAAK,aAAa,SAAS;AAAA,EAC7C,uBAAuB;AAAA,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