@lilt-ui/charts 0.3.0 → 0.4.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/CHANGELOG.md +18 -0
- package/dist/{cartesian-card-Dcd0ZnQL.js → cartesian-card-Cj1o38DC.js} +435 -420
- package/dist/finance.js +1 -1
- package/dist/index.js +768 -608
- package/dist/interaction/use-category-state.d.ts +2 -0
- package/dist/interaction/use-touch-glide.d.ts +26 -0
- package/dist/motion/use-glide.d.ts +7 -3
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { A as e, B as t, C as n, E as r, F as i, G as a, H as o, I as s, J as c, K as l, L as u, M as d, N as f, O as p, P as m, Q as h, R as g, S as _, T as v, U as y, V as b, W as x, X as S, Y as C, Z as w, _ as T, a as ee, b as E, c as D, d as O, f as k, g as te, h as A, j, k as M, l as N, m as P, n as F, o as ne, p as I, q as L, r as R, s as z, t as B, u as V, v as H, w as U, x as W, y as G, z as re } from "./cartesian-card-
|
|
3
|
-
import { n as
|
|
4
|
-
import { S as
|
|
5
|
-
import { a as ge, i as _e, n as ve, r as
|
|
6
|
-
import { useCallback as
|
|
2
|
+
import { A as e, B as t, C as n, E as r, F as i, G as a, H as o, I as s, J as c, K as l, L as u, M as d, N as f, O as p, P as m, Q as h, R as g, S as _, T as v, U as y, V as b, W as x, X as S, Y as C, Z as w, _ as T, a as ee, b as E, c as D, d as O, f as k, g as te, h as A, j, k as M, l as N, m as P, n as F, o as ne, p as I, q as L, r as R, s as z, t as B, u as V, v as H, w as U, x as W, y as G, z as re } from "./cartesian-card-Cj1o38DC.js";
|
|
3
|
+
import { n as ie, t as K } from "./chart-data-CCwLQeXa.js";
|
|
4
|
+
import { S as ae, _ as q, b as oe, c as se, d as ce, f as le, g as ue, h as de, l as J, m as fe, p as pe, u as me, x as he } from "./report-context-Cz0AYdV2.js";
|
|
5
|
+
import { a as ge, i as _e, n as ve, r as ye, t as be } from "./analysis-BJRmXHOB.js";
|
|
6
|
+
import { useCallback as xe, useEffect as Y, useId as Se, useLayoutEffect as Ce, useMemo as we, useRef as Te, useState as X, useSyncExternalStore as Ee } from "react";
|
|
7
7
|
import { Fragment as De, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
8
|
-
import { AnimatePresence as Oe, motion as
|
|
9
|
-
import { scaleLinear as
|
|
10
|
-
import { arc as
|
|
11
|
-
import { animate as
|
|
12
|
-
import { quantileSorted as
|
|
8
|
+
import { AnimatePresence as Oe, motion as $ } from "motion/react";
|
|
9
|
+
import { scaleLinear as ke } from "d3-scale";
|
|
10
|
+
import { arc as Ae } from "d3-shape";
|
|
11
|
+
import { animate as je } from "motion";
|
|
12
|
+
import { quantileSorted as Me } from "d3-array";
|
|
13
13
|
//#region src/toolkit/comparison-details.tsx
|
|
14
|
-
function
|
|
14
|
+
function Ne({ comparison: e, className: t }) {
|
|
15
15
|
let n = e.motion === "none" ? 0 : 150;
|
|
16
16
|
return /* @__PURE__ */ Q("div", {
|
|
17
17
|
className: ["lilt-comparison-details", t].filter(Boolean).join(" "),
|
|
@@ -118,7 +118,7 @@ function Pe({ comparison: e, className: t }) {
|
|
|
118
118
|
}
|
|
119
119
|
//#endregion
|
|
120
120
|
//#region src/toolkit/chart-toolbar.tsx
|
|
121
|
-
function
|
|
121
|
+
function Pe({ actions: e, className: t }) {
|
|
122
122
|
let n = w();
|
|
123
123
|
return /* @__PURE__ */ Q("div", {
|
|
124
124
|
className: ["lilt-chart__toolbar", t].filter(Boolean).join(" "),
|
|
@@ -138,7 +138,7 @@ function Fe({ actions: e, className: t }) {
|
|
|
138
138
|
}
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region src/toolkit/chart-readout.tsx
|
|
141
|
-
function
|
|
141
|
+
function Fe({ className: e }) {
|
|
142
142
|
let t = w();
|
|
143
143
|
return t.readout ? /* @__PURE__ */ Z("div", {
|
|
144
144
|
className: ["lilt-chart__readout", e].filter(Boolean).join(" "),
|
|
@@ -150,7 +150,7 @@ function Ie({ className: e }) {
|
|
|
150
150
|
}
|
|
151
151
|
//#endregion
|
|
152
152
|
//#region src/interaction/focus-overview.tsx
|
|
153
|
-
function
|
|
153
|
+
function Ie({ snapshot: e, range: t, series: n }) {
|
|
154
154
|
let r = e.geometry?.series[n], i = e.xToPixel(t.startX), a = e.xToPixel(t.endX);
|
|
155
155
|
return /* @__PURE__ */ Z("div", {
|
|
156
156
|
className: "lilt-chart__overview",
|
|
@@ -189,28 +189,28 @@ function Le({ snapshot: e, range: t, series: n }) {
|
|
|
189
189
|
}
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region src/toolkit/chart-overview.tsx
|
|
192
|
-
function
|
|
192
|
+
function Le({ className: e }) {
|
|
193
193
|
let t = w();
|
|
194
194
|
return t.overview ? /* @__PURE__ */ Z("div", {
|
|
195
195
|
className: ["lilt-chart__overview-host", e].filter(Boolean).join(" "),
|
|
196
|
-
children: /* @__PURE__ */ Z(
|
|
196
|
+
children: /* @__PURE__ */ Z(Ie, { ...t.overview })
|
|
197
197
|
}) : null;
|
|
198
198
|
}
|
|
199
199
|
//#endregion
|
|
200
200
|
//#region src/interaction/brush-gesture.ts
|
|
201
|
-
function
|
|
201
|
+
function Re(e, t, n) {
|
|
202
202
|
return Math.max(t, Math.min(n, e));
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
if (e.kind === "start") return [
|
|
206
|
-
if (e.kind === "end") return [e.start,
|
|
204
|
+
function ze(e, t, n) {
|
|
205
|
+
if (e.kind === "start") return [Re(t, 0, e.end - 1), e.end];
|
|
206
|
+
if (e.kind === "end") return [e.start, Re(t, e.start + 1, n)];
|
|
207
207
|
if (e.kind === "move") {
|
|
208
|
-
let r = e.end - e.start, i =
|
|
208
|
+
let r = e.end - e.start, i = Re(e.start + t - e.anchor, 0, n - r);
|
|
209
209
|
return [i, i + r];
|
|
210
210
|
}
|
|
211
|
-
return t === e.anchor ? t - e.start <= e.end - t ? [
|
|
211
|
+
return t === e.anchor ? t - e.start <= e.end - t ? [Re(t, 0, e.end - 1), e.end] : [e.start, Re(t, e.start + 1, n)] : [Math.min(e.anchor, t), Math.max(e.anchor, t)];
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function Be() {
|
|
214
214
|
let e = null;
|
|
215
215
|
return {
|
|
216
216
|
get active() {
|
|
@@ -220,11 +220,11 @@ function Ve() {
|
|
|
220
220
|
e = t;
|
|
221
221
|
},
|
|
222
222
|
move(t, n) {
|
|
223
|
-
return e ?
|
|
223
|
+
return e ? ze(e, t, n) : null;
|
|
224
224
|
},
|
|
225
225
|
finish(t, n) {
|
|
226
226
|
let r = e;
|
|
227
|
-
return e = null, r ?
|
|
227
|
+
return e = null, r ? ze(r, t, n) : null;
|
|
228
228
|
},
|
|
229
229
|
cancel() {
|
|
230
230
|
e = null;
|
|
@@ -233,12 +233,12 @@ function Ve() {
|
|
|
233
233
|
}
|
|
234
234
|
//#endregion
|
|
235
235
|
//#region src/interaction/brush-view.tsx
|
|
236
|
-
var
|
|
237
|
-
function
|
|
236
|
+
var Ve = 14, He = 1e3, Ue = 56;
|
|
237
|
+
function We(e, t, n) {
|
|
238
238
|
return Math.max(t, Math.min(n, e));
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
let a = e.data.rows, o = a.length - 1, s = a[0].x, c = a[o].x, l = Te(null), u = Te(
|
|
240
|
+
function Ge({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }) {
|
|
241
|
+
let a = e.data.rows, o = a.length - 1, s = a[0].x, c = a[o].x, l = Te(null), u = Te(Be()), [d, f] = X(null), [p, m] = X(null), [h, g] = X(null), _ = Se().replace(/:/g, ""), v = `lilt-brush-clip-${_}`, y = `lilt-brush-fill-${_}`, b = `lilt-brush-hint-${_}`, x = (e) => {
|
|
242
242
|
let t = 0, n = o;
|
|
243
243
|
for (; t < n;) {
|
|
244
244
|
let r = Math.floor((t + n) / 2);
|
|
@@ -249,7 +249,7 @@ function Ke({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
249
249
|
}, S = t ? x(Math.min(t.startX, t.endX)) : 0, C = t ? x(Math.max(t.startX, t.endX)) : o, [w, T] = d ?? [S, C], ee = (e) => {
|
|
250
250
|
let t = l.current?.getBoundingClientRect();
|
|
251
251
|
if (!t || t.width <= 28) return 0;
|
|
252
|
-
let n =
|
|
252
|
+
let n = We((e - t.left - Ve) / (t.width - 28), 0, 1);
|
|
253
253
|
return x(s + n * (c - s));
|
|
254
254
|
}, E = (e, t) => {
|
|
255
255
|
e >= t || e === S && t === C || i(e === 0 && t === o ? null : {
|
|
@@ -275,7 +275,7 @@ function Ke({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
275
275
|
}, te = () => {
|
|
276
276
|
u.current.cancel(), f(null);
|
|
277
277
|
};
|
|
278
|
-
|
|
278
|
+
Y(() => {
|
|
279
279
|
let e = (e) => {
|
|
280
280
|
let t = u.current.active;
|
|
281
281
|
e.key === "Escape" && t && (e.preventDefault(), e.stopImmediatePropagation(), u.current.cancel(), f(null), l.current?.hasPointerCapture(t.pointerId) && l.current.releasePointerCapture(t.pointerId));
|
|
@@ -308,13 +308,13 @@ function Ke({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
308
308
|
default: return;
|
|
309
309
|
}
|
|
310
310
|
e.preventDefault(), e.stopPropagation();
|
|
311
|
-
let s =
|
|
311
|
+
let s = We(a, r, i);
|
|
312
312
|
t === "start" ? E(s, T) : E(w, s);
|
|
313
|
-
}, j = (e) => (a[e].x - s) / Math.max(1e-9, c - s) * 100, M = j(w), N = j(T), P = e.geometry?.series[n], F = e.geometry?.bars[n] ?? [], ne = (t) => (t - e.plot.left) / Math.max(1, e.plot.width) *
|
|
313
|
+
}, j = (e) => (a[e].x - s) / Math.max(1e-9, c - s) * 100, M = j(w), N = j(T), P = e.geometry?.series[n], F = e.geometry?.bars[n] ?? [], ne = (t) => (t - e.plot.left) / Math.max(1, e.plot.width) * He, I = (t) => 5 + (t - e.plot.top) / Math.max(1, e.plot.height) * 46, L = P?.segments.map((e) => {
|
|
314
314
|
let t = e.points[0], n = e.points[e.points.length - 1], r = [`M${ne(t.x)},${I(t.y)}`, ...e.pieces.map((e) => e.kind === "line" ? `L${ne(e.to.x)},${I(e.to.y)}` : `C${ne(e.control1.x)},${I(e.control1.y)} ${ne(e.control2.x)},${I(e.control2.y)} ${ne(e.to.x)},${I(e.to.y)}`)].join(" ");
|
|
315
315
|
return {
|
|
316
316
|
path: r,
|
|
317
|
-
area: `${r} L${ne(n.x)},${
|
|
317
|
+
area: `${r} L${ne(n.x)},${Ue} L${ne(t.x)},${Ue} Z`
|
|
318
318
|
};
|
|
319
319
|
}), R = w === 0 && T === o, z = d ? `${e.formatX(a[w].x)}–${e.formatX(a[T].x)} · ${T - w + 1} observations` : R ? "Full range" : `${T - w + 1} observations`, B = r || d ? { duration: 0 } : {
|
|
320
320
|
type: "spring",
|
|
@@ -323,7 +323,7 @@ function Ke({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
323
323
|
mass: .85
|
|
324
324
|
}, V = F.map((t) => /* @__PURE__ */ Z("rect", {
|
|
325
325
|
height: Math.max(1, t.height / Math.max(1, e.plot.height) * 46),
|
|
326
|
-
width: Math.max(1, t.width / Math.max(1, e.plot.width) *
|
|
326
|
+
width: Math.max(1, t.width / Math.max(1, e.plot.width) * He),
|
|
327
327
|
x: ne(t.x),
|
|
328
328
|
y: I(t.y)
|
|
329
329
|
}, t.valueX)), H = /* @__PURE__ */ Q(De, { children: [L?.map(({ path: e }, t) => /* @__PURE__ */ Z("path", { d: e }, t)), P?.isolated.map((e, t) => /* @__PURE__ */ Z("circle", {
|
|
@@ -371,7 +371,7 @@ function Ke({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
371
371
|
children: /* @__PURE__ */ Q("div", {
|
|
372
372
|
className: "lilt-chart__brush-rail",
|
|
373
373
|
children: [
|
|
374
|
-
/* @__PURE__ */ Z(
|
|
374
|
+
/* @__PURE__ */ Z($.span, {
|
|
375
375
|
"aria-hidden": "true",
|
|
376
376
|
className: "lilt-chart__brush-selection",
|
|
377
377
|
initial: !1,
|
|
@@ -386,15 +386,15 @@ function Ke({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
386
386
|
/* @__PURE__ */ Q("svg", {
|
|
387
387
|
"aria-hidden": "true",
|
|
388
388
|
preserveAspectRatio: "none",
|
|
389
|
-
viewBox: `0 0 ${
|
|
389
|
+
viewBox: `0 0 ${He} ${Ue}`,
|
|
390
390
|
children: [/* @__PURE__ */ Q("defs", { children: [/* @__PURE__ */ Z("clipPath", {
|
|
391
391
|
id: v,
|
|
392
|
-
children: /* @__PURE__ */ Z(
|
|
392
|
+
children: /* @__PURE__ */ Z($.rect, {
|
|
393
393
|
animate: {
|
|
394
394
|
x: M * 10,
|
|
395
395
|
width: (N - M) * 10
|
|
396
396
|
},
|
|
397
|
-
height:
|
|
397
|
+
height: Ue,
|
|
398
398
|
initial: !1,
|
|
399
399
|
transition: B,
|
|
400
400
|
y: "0"
|
|
@@ -445,7 +445,7 @@ function Ke({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
445
445
|
})
|
|
446
446
|
] })]
|
|
447
447
|
}),
|
|
448
|
-
/* @__PURE__ */ Z(
|
|
448
|
+
/* @__PURE__ */ Z($.span, {
|
|
449
449
|
"aria-hidden": "true",
|
|
450
450
|
className: "lilt-chart__brush-range-track",
|
|
451
451
|
initial: !1,
|
|
@@ -457,7 +457,7 @@ function Ke({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
457
457
|
}),
|
|
458
458
|
["start", "end"].map((t) => {
|
|
459
459
|
let n = t === "start" ? w : T, i = j(n), s = p === t || h === t;
|
|
460
|
-
return /* @__PURE__ */ Z(
|
|
460
|
+
return /* @__PURE__ */ Z($.div, {
|
|
461
461
|
"aria-describedby": b,
|
|
462
462
|
"aria-label": `Range ${t}`,
|
|
463
463
|
"aria-orientation": "horizontal",
|
|
@@ -481,7 +481,7 @@ function Ke({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
481
481
|
children: /* @__PURE__ */ Z("span", {
|
|
482
482
|
"aria-hidden": "true",
|
|
483
483
|
className: "lilt-chart__brush-tooltip-anchor",
|
|
484
|
-
children: /* @__PURE__ */ Z(Oe, { children: s ? /* @__PURE__ */ Z(
|
|
484
|
+
children: /* @__PURE__ */ Z(Oe, { children: s ? /* @__PURE__ */ Z($.span, {
|
|
485
485
|
className: "lilt-chart__brush-tooltip",
|
|
486
486
|
initial: !r && {
|
|
487
487
|
opacity: 0,
|
|
@@ -525,16 +525,16 @@ function Ke({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
525
525
|
}
|
|
526
526
|
//#endregion
|
|
527
527
|
//#region src/toolkit/chart-brush.tsx
|
|
528
|
-
function
|
|
528
|
+
function Ke({ className: e }) {
|
|
529
529
|
let t = w();
|
|
530
530
|
return t.brush ? /* @__PURE__ */ Z("div", {
|
|
531
531
|
className: ["lilt-chart__brush-host", e].filter(Boolean).join(" "),
|
|
532
|
-
children: /* @__PURE__ */ Z(
|
|
532
|
+
children: /* @__PURE__ */ Z(Ge, { ...t.brush })
|
|
533
533
|
}) : null;
|
|
534
534
|
}
|
|
535
535
|
//#endregion
|
|
536
536
|
//#region src/primitives/range-bar.tsx
|
|
537
|
-
var
|
|
537
|
+
var qe = j(function({ series: e, low: t, high: n, className: i }) {
|
|
538
538
|
let a = E("RangeBar", e, [t, n], "column"), o = a.snapshot.data.rows;
|
|
539
539
|
_("RangeBar", o, e, [t, n]);
|
|
540
540
|
let s = new W();
|
|
@@ -571,7 +571,7 @@ var Je = j(function({ series: e, low: t, high: n, className: i }) {
|
|
|
571
571
|
style: { fill: d(i, t, a) }
|
|
572
572
|
});
|
|
573
573
|
}
|
|
574
|
-
}),
|
|
574
|
+
}), Je = 3.25, Ye = j(function({ series: e, low: t, high: n, point: r = !0, className: i }) {
|
|
575
575
|
let a = E("ErrorBar", e, [t, n], "column"), o = a.snapshot.data.rows;
|
|
576
576
|
_("ErrorBar", o, e, [
|
|
577
577
|
t,
|
|
@@ -583,7 +583,7 @@ var Je = j(function({ series: e, low: t, high: n, className: i }) {
|
|
|
583
583
|
let o = f(i, e, [t, n]), u = d(a.descriptor, i, a.color);
|
|
584
584
|
o && s.add(u, p(l, o[0], o[1], a.scales));
|
|
585
585
|
let m = i.values[e];
|
|
586
|
-
r && m != null && c.add(u, v(l, a.scales.y(m),
|
|
586
|
+
r && m != null && c.add(u, v(l, a.scales.y(m), Je));
|
|
587
587
|
}
|
|
588
588
|
return /* @__PURE__ */ Q("g", {
|
|
589
589
|
"aria-hidden": "true",
|
|
@@ -752,7 +752,7 @@ var $e = j(function(e) {
|
|
|
752
752
|
function et(e) {
|
|
753
753
|
let t = e.filter((e) => Number.isFinite(e)).sort((e, t) => e - t);
|
|
754
754
|
if (!t.length) return null;
|
|
755
|
-
let n =
|
|
755
|
+
let n = Me(t, .25), r = Me(t, .5), i = Me(t, .75), a = (i - n) * 1.5, o = t.filter((e) => e >= n - a && e <= i + a);
|
|
756
756
|
return {
|
|
757
757
|
min: Math.min(o[0] ?? n, n),
|
|
758
758
|
q1: n,
|
|
@@ -1010,28 +1010,101 @@ function st(e, t) {
|
|
|
1010
1010
|
onChange: t
|
|
1011
1011
|
}, [
|
|
1012
1012
|
i,
|
|
1013
|
-
|
|
1013
|
+
xe((e) => {
|
|
1014
1014
|
let t = a.current, n = typeof e == "function" ? e(t.selected) : e;
|
|
1015
1015
|
n !== t.selected && (t.controlled === void 0 && r(n), t.onChange?.(n));
|
|
1016
1016
|
}, []),
|
|
1017
|
-
|
|
1017
|
+
xe(() => r(null), [])
|
|
1018
1018
|
];
|
|
1019
1019
|
}
|
|
1020
|
+
function ct(e, t, n) {
|
|
1021
|
+
let r = (n.ownerDocument.elementFromPoint?.(e, t))?.closest("[data-glide-id]");
|
|
1022
|
+
return r && n.contains(r) ? r.getAttribute("data-glide-id") : null;
|
|
1023
|
+
}
|
|
1024
|
+
function lt(e) {
|
|
1025
|
+
let t = Te(e);
|
|
1026
|
+
t.current = e;
|
|
1027
|
+
let { disabled: n } = e, [r, i] = X(null);
|
|
1028
|
+
return Y(() => {
|
|
1029
|
+
if (!r || n) return;
|
|
1030
|
+
let e = null, i = null, a = null, o = 0, s = (e, n) => t.current.resolve(e, n, r), c = () => {
|
|
1031
|
+
e?.hold != null && window.clearTimeout(e.hold), e && (e.hold = null);
|
|
1032
|
+
}, l = () => {
|
|
1033
|
+
i = null, e?.gliding && a && t.current.onGlide(s(a.clientX, a.clientY));
|
|
1034
|
+
}, u = (e, t) => {
|
|
1035
|
+
a = {
|
|
1036
|
+
clientX: e,
|
|
1037
|
+
clientY: t
|
|
1038
|
+
}, i === null && (i = window.requestAnimationFrame(l));
|
|
1039
|
+
}, d = () => {
|
|
1040
|
+
if (e && !e.gliding) {
|
|
1041
|
+
c(), e.gliding = !0;
|
|
1042
|
+
try {
|
|
1043
|
+
r.setPointerCapture?.(e.pointerId);
|
|
1044
|
+
} catch {}
|
|
1045
|
+
t.current.onGlide(s(e.x, e.y));
|
|
1046
|
+
}
|
|
1047
|
+
}, f = () => {
|
|
1048
|
+
c(), i !== null && window.cancelAnimationFrame(i), i = null, a = null, e = null;
|
|
1049
|
+
}, p = (t) => {
|
|
1050
|
+
t.pointerType === "touch" && t.isPrimary && (f(), e = {
|
|
1051
|
+
pointerId: t.pointerId,
|
|
1052
|
+
x: t.clientX,
|
|
1053
|
+
y: t.clientY,
|
|
1054
|
+
gliding: !1,
|
|
1055
|
+
hold: window.setTimeout(d, 320)
|
|
1056
|
+
});
|
|
1057
|
+
}, m = (t) => {
|
|
1058
|
+
if (!e || t.pointerId !== e.pointerId) return;
|
|
1059
|
+
if (e.gliding) {
|
|
1060
|
+
u(t.clientX, t.clientY);
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
let n = Math.abs(t.clientX - e.x), r = Math.abs(t.clientY - e.y);
|
|
1064
|
+
if (!(Math.max(n, r) <= 8)) {
|
|
1065
|
+
if (r >= n) {
|
|
1066
|
+
c();
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
d(), u(t.clientX, t.clientY);
|
|
1070
|
+
}
|
|
1071
|
+
}, h = (n) => {
|
|
1072
|
+
if (!e || n.pointerId !== e.pointerId) return;
|
|
1073
|
+
let { gliding: r, hold: i } = e, a = !r && i !== null;
|
|
1074
|
+
f();
|
|
1075
|
+
let c = s(n.clientX, n.clientY);
|
|
1076
|
+
r ? (t.current.onGlide(null), t.current.onLift?.(c), o = performance.now() + 750) : a && t.current.onTap && (t.current.onTap(c), o = performance.now() + 750);
|
|
1077
|
+
}, g = (n) => {
|
|
1078
|
+
if (!e || n.pointerId !== e.pointerId) return;
|
|
1079
|
+
let r = e.gliding;
|
|
1080
|
+
f(), r && t.current.onGlide(null);
|
|
1081
|
+
}, _ = (t) => {
|
|
1082
|
+
e?.gliding && t.cancelable && t.preventDefault();
|
|
1083
|
+
}, v = (t) => {
|
|
1084
|
+
e && t.preventDefault();
|
|
1085
|
+
}, y = (e) => {
|
|
1086
|
+
performance.now() >= o || (o = 0, e.stopPropagation(), e.preventDefault());
|
|
1087
|
+
};
|
|
1088
|
+
return r.addEventListener("pointerdown", p), r.addEventListener("pointermove", m), r.addEventListener("pointerup", h), r.addEventListener("pointercancel", g), r.addEventListener("touchmove", _, { passive: !1 }), r.addEventListener("contextmenu", v), r.addEventListener("click", y, !0), () => {
|
|
1089
|
+
f(), r.removeEventListener("pointerdown", p), r.removeEventListener("pointermove", m), r.removeEventListener("pointerup", h), r.removeEventListener("pointercancel", g), r.removeEventListener("touchmove", _), r.removeEventListener("contextmenu", v), r.removeEventListener("click", y, !0);
|
|
1090
|
+
};
|
|
1091
|
+
}, [n, r]), i;
|
|
1092
|
+
}
|
|
1020
1093
|
//#endregion
|
|
1021
1094
|
//#region src/interaction/use-category-state.ts
|
|
1022
|
-
function
|
|
1095
|
+
function ut(e, t, n) {
|
|
1023
1096
|
let r = Te({
|
|
1024
1097
|
key: n,
|
|
1025
1098
|
rows: null
|
|
1026
1099
|
}), i = t === "ready" && e ? e : r.current.key === n ? r.current.rows : null;
|
|
1027
|
-
|
|
1100
|
+
Y(() => {
|
|
1028
1101
|
r.current = {
|
|
1029
1102
|
key: n,
|
|
1030
1103
|
rows: i
|
|
1031
1104
|
};
|
|
1032
1105
|
}, [i, n]);
|
|
1033
1106
|
let a = t === "loading" && i === null, [o, s] = X(!1);
|
|
1034
|
-
return
|
|
1107
|
+
return Y(() => {
|
|
1035
1108
|
if (s(!1), !a) return;
|
|
1036
1109
|
let e = window.setTimeout(() => s(!0), 120);
|
|
1037
1110
|
return () => window.clearTimeout(e);
|
|
@@ -1041,25 +1114,30 @@ function ct(e, t, n) {
|
|
|
1041
1114
|
skeleton: o
|
|
1042
1115
|
};
|
|
1043
1116
|
}
|
|
1044
|
-
function
|
|
1045
|
-
let [l, u] = X(null), [d, f] = X(null), [p, m, h] = st(a, o), g = e.some((e) => e.id === p) ? p : null, [_, v] = X(null), y = Te(/* @__PURE__ */ new Map()), b =
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1117
|
+
function dt(e, t, n, r, i = 1, a, o, s = !0, c) {
|
|
1118
|
+
let [l, u] = X(null), [d, f] = X(null), [p, m, h] = st(a, o), g = e.some((e) => e.id === p) ? p : null, [_, v] = X(null), y = Te(/* @__PURE__ */ new Map()), b = lt({
|
|
1119
|
+
resolve: ct,
|
|
1120
|
+
onGlide: u,
|
|
1121
|
+
onLift: (e) => e !== null && m(e),
|
|
1122
|
+
disabled: !t
|
|
1123
|
+
}), x = Te(n);
|
|
1124
|
+
x.current = n;
|
|
1125
|
+
let S = t ? e.find((e) => e.id === (c ? d ?? l ?? c ?? g : g ?? d ?? l)) : void 0, C = S?.id, w = S?.datum, T = S?.value;
|
|
1126
|
+
Y(() => {
|
|
1127
|
+
x.current?.(C === void 0 ? null : {
|
|
1128
|
+
id: C,
|
|
1129
|
+
row: w,
|
|
1130
|
+
value: T ?? null,
|
|
1131
|
+
pinned: g === C
|
|
1054
1132
|
});
|
|
1055
1133
|
}, [
|
|
1056
|
-
S,
|
|
1057
1134
|
C,
|
|
1058
1135
|
w,
|
|
1136
|
+
T,
|
|
1059
1137
|
g
|
|
1060
|
-
]),
|
|
1138
|
+
]), Y(() => {
|
|
1061
1139
|
h(), u(null), f(null), v(null);
|
|
1062
|
-
}, [r, h]),
|
|
1140
|
+
}, [r, h]), Y(() => {
|
|
1063
1141
|
s && p && !e.some((e) => e.id === p) && m(null);
|
|
1064
1142
|
}, [
|
|
1065
1143
|
s,
|
|
@@ -1067,7 +1145,7 @@ function lt(e, t, n, r, i = 1, a, o, s = !0, c) {
|
|
|
1067
1145
|
p,
|
|
1068
1146
|
m
|
|
1069
1147
|
]);
|
|
1070
|
-
let
|
|
1148
|
+
let ee = e.some((e) => e.id === _) ? _ : e[0]?.id, E = (t, n) => {
|
|
1071
1149
|
let r = n;
|
|
1072
1150
|
if (t.key === "ArrowDown") r += i;
|
|
1073
1151
|
else if (t.key === "ArrowUp") r -= i;
|
|
@@ -1082,13 +1160,15 @@ function lt(e, t, n, r, i = 1, a, o, s = !0, c) {
|
|
|
1082
1160
|
t.preventDefault(), y.current.get(e[Math.max(0, Math.min(e.length - 1, r))]?.id)?.focus();
|
|
1083
1161
|
};
|
|
1084
1162
|
return {
|
|
1085
|
-
active:
|
|
1163
|
+
active: S,
|
|
1086
1164
|
pinned: g,
|
|
1165
|
+
glideRef: b,
|
|
1087
1166
|
bind: (e, t) => ({
|
|
1167
|
+
"data-glide-id": e,
|
|
1088
1168
|
ref: (t) => {
|
|
1089
1169
|
t ? y.current.set(e, t) : y.current.delete(e);
|
|
1090
1170
|
},
|
|
1091
|
-
tabIndex: e ===
|
|
1171
|
+
tabIndex: e === ee ? 0 : -1,
|
|
1092
1172
|
"aria-pressed": g === e,
|
|
1093
1173
|
onPointerEnter: () => u(e),
|
|
1094
1174
|
onPointerLeave: () => u(null),
|
|
@@ -1097,21 +1177,21 @@ function lt(e, t, n, r, i = 1, a, o, s = !0, c) {
|
|
|
1097
1177
|
},
|
|
1098
1178
|
onBlur: () => f(null),
|
|
1099
1179
|
onClick: () => m((t) => t === e ? null : e),
|
|
1100
|
-
onKeyDown: (e) =>
|
|
1180
|
+
onKeyDown: (e) => E(e, t)
|
|
1101
1181
|
})
|
|
1102
1182
|
};
|
|
1103
1183
|
}
|
|
1104
1184
|
//#endregion
|
|
1105
1185
|
//#region src/toolkit/chart-range-summary.tsx
|
|
1106
|
-
function
|
|
1107
|
-
let n = S(), r = Ee(n.controller.subscribe, () => n.controller.getSnapshot().focus, () => n.controller.getSnapshot().focus), { props: i } = n, a =
|
|
1186
|
+
function ft({ series: e, className: t }) {
|
|
1187
|
+
let n = S(), r = Ee(n.controller.subscribe, () => n.controller.getSnapshot().focus, () => n.controller.getSnapshot().focus), { props: i } = n, a = ut(i.data, i.status ?? "ready", i.resetKey), o = i.series.find((t) => t.id === (e ?? i.series[0]?.id)), s = we(() => {
|
|
1108
1188
|
if (!o || i.x.type === "category" || !a.rows) return {
|
|
1109
1189
|
value: null,
|
|
1110
1190
|
error: null
|
|
1111
1191
|
};
|
|
1112
1192
|
try {
|
|
1113
1193
|
return {
|
|
1114
|
-
value:
|
|
1194
|
+
value: K(a.rows, {
|
|
1115
1195
|
x: i.x.accessor,
|
|
1116
1196
|
value: o.accessor,
|
|
1117
1197
|
range: r
|
|
@@ -1146,7 +1226,7 @@ function ut({ series: e, className: t }) {
|
|
|
1146
1226
|
mean: "Average",
|
|
1147
1227
|
min: "Low",
|
|
1148
1228
|
max: "High"
|
|
1149
|
-
}[e] }), /* @__PURE__ */ Z("dd", { children: c?.[e] == null ? "—" : /* @__PURE__ */ Z(
|
|
1229
|
+
}[e] }), /* @__PURE__ */ Z("dd", { children: c?.[e] == null ? "—" : /* @__PURE__ */ Z(q, {
|
|
1150
1230
|
value: c[e],
|
|
1151
1231
|
format: l,
|
|
1152
1232
|
motion: i.motion
|
|
@@ -1158,7 +1238,7 @@ function ut({ series: e, className: t }) {
|
|
|
1158
1238
|
}
|
|
1159
1239
|
//#endregion
|
|
1160
1240
|
//#region src/cards/area-chart-card.tsx
|
|
1161
|
-
function
|
|
1241
|
+
function pt({ stack: e, curve: t = "smooth", ...n }) {
|
|
1162
1242
|
return /* @__PURE__ */ Z(B, {
|
|
1163
1243
|
...n,
|
|
1164
1244
|
shape: {
|
|
@@ -1170,7 +1250,7 @@ function dt({ stack: e, curve: t = "smooth", ...n }) {
|
|
|
1170
1250
|
}
|
|
1171
1251
|
//#endregion
|
|
1172
1252
|
//#region src/cards/line-chart-card.tsx
|
|
1173
|
-
function
|
|
1253
|
+
function mt({ curve: e = "smooth", points: t = !1, baseline: n = "auto", ...r }) {
|
|
1174
1254
|
return /* @__PURE__ */ Z(B, {
|
|
1175
1255
|
...r,
|
|
1176
1256
|
shape: {
|
|
@@ -1183,7 +1263,7 @@ function ft({ curve: e = "smooth", points: t = !1, baseline: n = "auto", ...r })
|
|
|
1183
1263
|
}
|
|
1184
1264
|
//#endregion
|
|
1185
1265
|
//#region src/cards/bar-chart-card.tsx
|
|
1186
|
-
function
|
|
1266
|
+
function ht({ stack: e, radius: t = 6, corners: n = "end", tracks: r = !1, barWidth: i, barStyle: a = "solid", ...o }) {
|
|
1187
1267
|
return /* @__PURE__ */ Z(B, {
|
|
1188
1268
|
...o,
|
|
1189
1269
|
shape: {
|
|
@@ -1199,11 +1279,11 @@ function pt({ stack: e, radius: t = 6, corners: n = "end", tracks: r = !1, barWi
|
|
|
1199
1279
|
}
|
|
1200
1280
|
//#endregion
|
|
1201
1281
|
//#region src/lifecycle/skeleton-sheen.tsx
|
|
1202
|
-
var
|
|
1282
|
+
var gt = {
|
|
1203
1283
|
"--lilt-skeleton-paint": "white",
|
|
1204
1284
|
"--lilt-skeleton-gap": "black"
|
|
1205
1285
|
};
|
|
1206
|
-
function
|
|
1286
|
+
function _t({ children: e, width: t, height: n, x: r = 0, y: i = 0, reduced: a = !1 }) {
|
|
1207
1287
|
let o = Se().replace(/:/g, ""), s = Math.max(t * .3, Math.min(t, 60));
|
|
1208
1288
|
return /* @__PURE__ */ Q("g", {
|
|
1209
1289
|
className: "lilt-skeleton",
|
|
@@ -1239,7 +1319,7 @@ function ht({ children: e, width: t, height: n, x: r = 0, y: i = 0, reduced: a =
|
|
|
1239
1319
|
width: t,
|
|
1240
1320
|
height: n,
|
|
1241
1321
|
children: /* @__PURE__ */ Z("g", {
|
|
1242
|
-
style:
|
|
1322
|
+
style: gt,
|
|
1243
1323
|
children: e
|
|
1244
1324
|
})
|
|
1245
1325
|
})] }), /* @__PURE__ */ Z("g", {
|
|
@@ -1261,12 +1341,12 @@ function ht({ children: e, width: t, height: n, x: r = 0, y: i = 0, reduced: a =
|
|
|
1261
1341
|
}
|
|
1262
1342
|
//#endregion
|
|
1263
1343
|
//#region src/cards/stat-card.tsx
|
|
1264
|
-
var
|
|
1265
|
-
function
|
|
1344
|
+
var vt = [], yt = 28;
|
|
1345
|
+
function bt(e, t = yt) {
|
|
1266
1346
|
let n = Math.max(0, Math.min(1, e)) * t;
|
|
1267
1347
|
return Array.from({ length: t }, (e, t) => Math.max(0, Math.min(1, n - t)));
|
|
1268
1348
|
}
|
|
1269
|
-
function
|
|
1349
|
+
function xt({ value: e, target: t, height: n, formatValue: r }) {
|
|
1270
1350
|
let i = e === null || t <= 0 ? 0 : e / t, a = new Intl.NumberFormat("en-US", {
|
|
1271
1351
|
style: "percent",
|
|
1272
1352
|
maximumFractionDigits: 0
|
|
@@ -1281,7 +1361,7 @@ function yt({ value: e, target: t, height: n, formatValue: r }) {
|
|
|
1281
1361
|
"aria-valuemax": t,
|
|
1282
1362
|
"aria-valuenow": e ?? 0,
|
|
1283
1363
|
style: { height: n },
|
|
1284
|
-
children:
|
|
1364
|
+
children: bt(i).map((e, t) => /* @__PURE__ */ Z("span", {
|
|
1285
1365
|
className: "lilt-stat__cell",
|
|
1286
1366
|
children: e > 0 ? /* @__PURE__ */ Z("span", {
|
|
1287
1367
|
className: "lilt-stat__cell-fill",
|
|
@@ -1295,7 +1375,7 @@ function yt({ value: e, target: t, height: n, formatValue: r }) {
|
|
|
1295
1375
|
})]
|
|
1296
1376
|
});
|
|
1297
1377
|
}
|
|
1298
|
-
function
|
|
1378
|
+
function St({ value: e, target: t, size: n, reduced: r, loading: i = !1, formatValue: a }) {
|
|
1299
1379
|
let o = e === null || t <= 0 ? null : Math.max(0, e / t), s = Math.max(4, Math.round(n / 9)), c = (n - s) / 2, l = new Intl.NumberFormat("en-US", {
|
|
1300
1380
|
style: "percent",
|
|
1301
1381
|
maximumFractionDigits: 0
|
|
@@ -1316,7 +1396,7 @@ function bt({ value: e, target: t, size: n, reduced: r, loading: i = !1, formatV
|
|
|
1316
1396
|
viewBox: `0 0 ${n} ${n}`,
|
|
1317
1397
|
width: n,
|
|
1318
1398
|
height: n,
|
|
1319
|
-
children: [i ? /* @__PURE__ */ Z(
|
|
1399
|
+
children: [i ? /* @__PURE__ */ Z(_t, {
|
|
1320
1400
|
width: n,
|
|
1321
1401
|
height: n,
|
|
1322
1402
|
reduced: r,
|
|
@@ -1334,7 +1414,7 @@ function bt({ value: e, target: t, size: n, reduced: r, loading: i = !1, formatV
|
|
|
1334
1414
|
cy: n / 2,
|
|
1335
1415
|
r: c,
|
|
1336
1416
|
strokeWidth: s
|
|
1337
|
-
}), o ? /* @__PURE__ */ Z(
|
|
1417
|
+
}), o ? /* @__PURE__ */ Z($.circle, {
|
|
1338
1418
|
className: "lilt-stat__ring-fill",
|
|
1339
1419
|
cx: n / 2,
|
|
1340
1420
|
cy: n / 2,
|
|
@@ -1345,7 +1425,7 @@ function bt({ value: e, target: t, size: n, reduced: r, loading: i = !1, formatV
|
|
|
1345
1425
|
animate: { pathLength: Math.min(1, o) },
|
|
1346
1426
|
transition: {
|
|
1347
1427
|
duration: r ? 0 : .9,
|
|
1348
|
-
ease:
|
|
1428
|
+
ease: oe
|
|
1349
1429
|
}
|
|
1350
1430
|
}) : null]
|
|
1351
1431
|
}), /* @__PURE__ */ Z("span", {
|
|
@@ -1354,13 +1434,13 @@ function bt({ value: e, target: t, size: n, reduced: r, loading: i = !1, formatV
|
|
|
1354
1434
|
})]
|
|
1355
1435
|
});
|
|
1356
1436
|
}
|
|
1357
|
-
var
|
|
1358
|
-
function
|
|
1437
|
+
var Ct = (e) => e.acceptedRevision;
|
|
1438
|
+
function wt({ title: t, data: n = vt, value: r, x: o, xType: s, headline: l, aggregate: u = "sum", delta: d, deltaTone: f, caption: p, chart: m = "area", barStyle: h = "solid", target: g, sync: _, height: v, color: b, aside: x, valueFormat: S, locale: C, formatValue: w, formatX: E, surface: O = "elevated", badge: k, numberStyle: A, palette: j, loading: N = !1, motion: P, className: F, style: I }) {
|
|
1359
1439
|
let L = ne({
|
|
1360
1440
|
valueFormat: S,
|
|
1361
1441
|
locale: C,
|
|
1362
1442
|
formatValue: w
|
|
1363
|
-
}), R = r ?? "", B = m === "bars", V = (m === "area" || m === "line" || B) && !!r, H = V ? n :
|
|
1443
|
+
}), R = r ?? "", B = m === "bars", V = (m === "area" || m === "line" || B) && !!r, H = V ? n : vt, U = we(() => {
|
|
1364
1444
|
if (o) return D(H, o, s, E);
|
|
1365
1445
|
let e = new Map(H.map((e, t) => [e, t]));
|
|
1366
1446
|
return {
|
|
@@ -1402,18 +1482,18 @@ function St({ title: t, data: n = gt, value: r, x: o, xType: s, headline: l, agg
|
|
|
1402
1482
|
]), re = we(() => ({
|
|
1403
1483
|
includeZero: B,
|
|
1404
1484
|
ticks: 3
|
|
1405
|
-
}), [B]),
|
|
1485
|
+
}), [B]), ie = a({
|
|
1406
1486
|
data: H,
|
|
1407
1487
|
x: W,
|
|
1408
1488
|
y: re,
|
|
1409
1489
|
series: G,
|
|
1410
1490
|
status: N ? "loading" : "ready"
|
|
1411
|
-
}),
|
|
1412
|
-
i(o ? _ : void 0,
|
|
1491
|
+
}), K = y(ie, (e) => e.inspection);
|
|
1492
|
+
i(o ? _ : void 0, ie.getController(), H, o ?? "", U, {
|
|
1413
1493
|
label: t,
|
|
1414
|
-
release:
|
|
1415
|
-
}), y(
|
|
1416
|
-
let
|
|
1494
|
+
release: ie.actions.release
|
|
1495
|
+
}), y(ie, Ct);
|
|
1496
|
+
let q = ie.series.some((e) => e.id === G[0].id) ? G[0].id : null, oe = l ?? (r ? ee(z(n, R), u) : null), se = V && K ? K.series[0]?.value ?? null : void 0, ce = se === void 0 ? oe : se, J = v ?? (m === "meter" ? 10 : B ? 44 : 56), fe = !B, he = ae(P ?? "auto"), ge = m === "ring" && g !== void 0, _e = ge ? `Target ${L.value(g)}` : void 0;
|
|
1417
1497
|
return /* @__PURE__ */ Q(me, {
|
|
1418
1498
|
motion: P,
|
|
1419
1499
|
className: ["lilt-stat", F].filter(Boolean).join(" "),
|
|
@@ -1427,45 +1507,45 @@ function St({ title: t, data: n = gt, value: r, x: o, xType: s, headline: l, agg
|
|
|
1427
1507
|
numberStyle: A,
|
|
1428
1508
|
palette: j,
|
|
1429
1509
|
children: [/* @__PURE__ */ Q(pe, {
|
|
1430
|
-
aside: ge ? /* @__PURE__ */ Q(De, { children: [x, /* @__PURE__ */ Z(
|
|
1510
|
+
aside: ge ? /* @__PURE__ */ Q(De, { children: [x, /* @__PURE__ */ Z(St, {
|
|
1431
1511
|
loading: N,
|
|
1432
|
-
value: N ? null :
|
|
1512
|
+
value: N ? null : oe,
|
|
1433
1513
|
target: g,
|
|
1434
1514
|
size: v ?? 56,
|
|
1435
1515
|
reduced: he,
|
|
1436
1516
|
formatValue: L.value
|
|
1437
1517
|
})] }) : x,
|
|
1438
1518
|
children: [
|
|
1439
|
-
/* @__PURE__ */ Z(
|
|
1440
|
-
/* @__PURE__ */ Z(
|
|
1441
|
-
value:
|
|
1519
|
+
/* @__PURE__ */ Z(de, { children: t }),
|
|
1520
|
+
/* @__PURE__ */ Z(ue, {
|
|
1521
|
+
value: ce,
|
|
1442
1522
|
format: L.value,
|
|
1443
1523
|
loading: N,
|
|
1444
1524
|
motion: P,
|
|
1445
|
-
children: N ||
|
|
1525
|
+
children: N || se !== void 0 || d === void 0 ? null : /* @__PURE__ */ Z(le, {
|
|
1446
1526
|
value: d,
|
|
1447
1527
|
tone: f
|
|
1448
1528
|
})
|
|
1449
1529
|
}),
|
|
1450
1530
|
p || o || _e ? /* @__PURE__ */ Z("p", {
|
|
1451
1531
|
className: "lilt-stat__caption",
|
|
1452
|
-
children: N ? "" :
|
|
1532
|
+
children: N ? "" : se === void 0 ? p ?? _e ?? "" : K?.formattedX ?? ""
|
|
1453
1533
|
}) : null
|
|
1454
1534
|
]
|
|
1455
|
-
}), m === "meter" && g !== void 0 ? N ? /* @__PURE__ */ Z("span", { className: "lilt-card__skeleton lilt-stat__meter-skeleton" }) : /* @__PURE__ */ Z(
|
|
1456
|
-
value:
|
|
1535
|
+
}), m === "meter" && g !== void 0 ? N ? /* @__PURE__ */ Z("span", { className: "lilt-card__skeleton lilt-stat__meter-skeleton" }) : /* @__PURE__ */ Z(xt, {
|
|
1536
|
+
value: oe,
|
|
1457
1537
|
target: g,
|
|
1458
|
-
height:
|
|
1538
|
+
height: J,
|
|
1459
1539
|
formatValue: L.value
|
|
1460
1540
|
}) : V ? /* @__PURE__ */ Z(c, {
|
|
1461
1541
|
className: fe ? "lilt-card__chart lilt-card__chart--bleed lilt-stat__chart" : "lilt-card__chart lilt-stat__chart",
|
|
1462
1542
|
"aria-label": `${t} trend`,
|
|
1463
|
-
model:
|
|
1543
|
+
model: ie,
|
|
1464
1544
|
motion: P,
|
|
1465
1545
|
status: N ? "loading" : "ready",
|
|
1466
1546
|
children: /* @__PURE__ */ Q(e, {
|
|
1467
|
-
model:
|
|
1468
|
-
height:
|
|
1547
|
+
model: ie,
|
|
1548
|
+
height: J,
|
|
1469
1549
|
margins: {
|
|
1470
1550
|
top: 4,
|
|
1471
1551
|
right: 0,
|
|
@@ -1481,12 +1561,12 @@ function St({ title: t, data: n = gt, value: r, x: o, xType: s, headline: l, agg
|
|
|
1481
1561
|
runoff: !0,
|
|
1482
1562
|
axisInset: 20
|
|
1483
1563
|
},
|
|
1484
|
-
children: [m === "area" &&
|
|
1485
|
-
model:
|
|
1486
|
-
series:
|
|
1487
|
-
}) : null,
|
|
1488
|
-
model:
|
|
1489
|
-
series:
|
|
1564
|
+
children: [m === "area" && q ? /* @__PURE__ */ Z(M, {
|
|
1565
|
+
model: ie,
|
|
1566
|
+
series: q
|
|
1567
|
+
}) : null, q ? Z(B ? te : T, {
|
|
1568
|
+
model: ie,
|
|
1569
|
+
series: q
|
|
1490
1570
|
}) : null]
|
|
1491
1571
|
})
|
|
1492
1572
|
}) : null]
|
|
@@ -1494,12 +1574,12 @@ function St({ title: t, data: n = gt, value: r, x: o, xType: s, headline: l, agg
|
|
|
1494
1574
|
}
|
|
1495
1575
|
//#endregion
|
|
1496
1576
|
//#region src/cards/rank.ts
|
|
1497
|
-
var
|
|
1577
|
+
var Tt = "\0other", Et = new Intl.NumberFormat("en-US", {
|
|
1498
1578
|
style: "percent",
|
|
1499
1579
|
maximumFractionDigits: 0
|
|
1500
1580
|
});
|
|
1501
|
-
function
|
|
1502
|
-
let o = (e) => e[n], s =
|
|
1581
|
+
function Dt(e, t, n, r, i, a) {
|
|
1582
|
+
let o = (e) => e[n], s = ye(ve(e, {
|
|
1503
1583
|
id: (e) => String(e[t] ?? ""),
|
|
1504
1584
|
label: (e) => String(e[t] ?? "")
|
|
1505
1585
|
}, (e) => {
|
|
@@ -1513,13 +1593,13 @@ function Tt(e, t, n, r, i, a) {
|
|
|
1513
1593
|
if (i === void 0 || i < 1 || s.length <= i + 1) return s;
|
|
1514
1594
|
let c = s.slice(i).flatMap((e) => e.value === null ? [] : [e.value]);
|
|
1515
1595
|
return [...s.slice(0, i), {
|
|
1516
|
-
id:
|
|
1596
|
+
id: Tt,
|
|
1517
1597
|
label: a,
|
|
1518
1598
|
value: c.length ? c.reduce((e, t) => e + t, 0) : null,
|
|
1519
1599
|
other: !0
|
|
1520
1600
|
}];
|
|
1521
1601
|
}
|
|
1522
|
-
function
|
|
1602
|
+
function Ot(e) {
|
|
1523
1603
|
let t = e.flatMap((e) => e.value === null ? [] : [e.value]), n = t.reduce((e, t) => e + t, 0);
|
|
1524
1604
|
return {
|
|
1525
1605
|
observed: t.length,
|
|
@@ -1529,16 +1609,16 @@ function Et(e) {
|
|
|
1529
1609
|
}
|
|
1530
1610
|
//#endregion
|
|
1531
1611
|
//#region src/cards/horizontal-bar-chart-card.tsx
|
|
1532
|
-
var
|
|
1533
|
-
function
|
|
1534
|
-
let k =
|
|
1612
|
+
var kt = [];
|
|
1613
|
+
function At({ title: e, data: t, category: n, value: r, headline: i, delta: a, deltaTone: o, range: s, ranges: c, defaultRange: l, sort: d = "descending", limit: f, otherLabel: p = "Other", share: m = !0, rank: h = !1, barStyle: _ = "inline", valueFormat: v, locale: y, formatValue: b, color: x, surface: S = "elevated", badge: C, numberStyle: w, palette: T, loading: ee = !1, motion: E = "auto", className: D, style: O }) {
|
|
1614
|
+
let k = ae(E), te = ne({
|
|
1535
1615
|
valueFormat: v,
|
|
1536
1616
|
locale: y,
|
|
1537
1617
|
formatValue: b
|
|
1538
|
-
}), [A, j] = X(l ?? c?.[0]?.id), M = c?.find((e) => e.id === A) ?? c?.[0], N = M?.data ?? t ??
|
|
1618
|
+
}), [A, j] = X(l ?? c?.[0]?.id), M = c?.find((e) => e.id === A) ?? c?.[0], N = M?.data ?? t ?? kt, P = M ? M.delta : a, F = we(() => {
|
|
1539
1619
|
try {
|
|
1540
1620
|
return {
|
|
1541
|
-
rows:
|
|
1621
|
+
rows: Dt(N, n, r, d, f, p),
|
|
1542
1622
|
error: null
|
|
1543
1623
|
};
|
|
1544
1624
|
} catch (e) {
|
|
@@ -1554,10 +1634,14 @@ function Ot({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1554
1634
|
d,
|
|
1555
1635
|
f,
|
|
1556
1636
|
p
|
|
1557
|
-
]), I = F.rows, L =
|
|
1637
|
+
]), I = F.rows, L = Ot(I), R = L.total, z = m && L.shareable, B = we(() => ge(I.map((e) => ({
|
|
1558
1638
|
...e,
|
|
1559
1639
|
datum: e
|
|
1560
|
-
}))), [I]), [V, H] = X(null), [U, W] = X(null), [G, re] = X(null),
|
|
1640
|
+
}))), [I]), [V, H] = X(null), [U, W] = X(null), [G, re] = X(null), ie = G ?? U ?? V, K = I.find((e) => e.id === ie), q = Te(/* @__PURE__ */ new Map()), se = lt({
|
|
1641
|
+
resolve: ct,
|
|
1642
|
+
onGlide: H,
|
|
1643
|
+
onLift: (e) => e !== null && re(e)
|
|
1644
|
+
}), J = M?.headline ?? i ?? (L.observed ? R : null), he = (e) => z && e !== null ? Et.format(e / R) : null, ve = (e, t) => {
|
|
1561
1645
|
let n = t;
|
|
1562
1646
|
if (e.key === "ArrowDown") n = Math.min(I.length - 1, t + 1);
|
|
1563
1647
|
else if (e.key === "ArrowUp") n = Math.max(0, t - 1);
|
|
@@ -1567,18 +1651,18 @@ function Ot({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1567
1651
|
re(null);
|
|
1568
1652
|
return;
|
|
1569
1653
|
} else return;
|
|
1570
|
-
e.preventDefault(),
|
|
1571
|
-
},
|
|
1654
|
+
e.preventDefault(), q.current.get(I[n].id)?.focus();
|
|
1655
|
+
}, ye = {
|
|
1572
1656
|
duration: k ? 0 : .5,
|
|
1573
|
-
ease:
|
|
1574
|
-
},
|
|
1657
|
+
ease: oe
|
|
1658
|
+
}, be = x ? {
|
|
1575
1659
|
...O,
|
|
1576
1660
|
"--lilt-series-1": x
|
|
1577
1661
|
} : O;
|
|
1578
1662
|
return /* @__PURE__ */ Q(me, {
|
|
1579
1663
|
motion: E,
|
|
1580
1664
|
className: ["lilt-list", D].filter(Boolean).join(" "),
|
|
1581
|
-
style:
|
|
1665
|
+
style: be,
|
|
1582
1666
|
"aria-label": e,
|
|
1583
1667
|
surface: S,
|
|
1584
1668
|
badge: C,
|
|
@@ -1594,12 +1678,12 @@ function Ot({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1594
1678
|
value: M?.id,
|
|
1595
1679
|
onValueChange: j
|
|
1596
1680
|
}) : null,
|
|
1597
|
-
children: [/* @__PURE__ */ Z(
|
|
1598
|
-
value:
|
|
1681
|
+
children: [/* @__PURE__ */ Z(de, { children: e }), /* @__PURE__ */ Z(ue, {
|
|
1682
|
+
value: K ? K.value : J,
|
|
1599
1683
|
format: te.value,
|
|
1600
1684
|
loading: ee,
|
|
1601
1685
|
motion: E,
|
|
1602
|
-
children: ee ? null :
|
|
1686
|
+
children: ee ? null : K ? /* @__PURE__ */ Q(ce, { children: [K.label, he(K.value) ? ` · ${he(K.value)}` : ""] }) : P === void 0 ? null : /* @__PURE__ */ Z(le, {
|
|
1603
1687
|
value: P,
|
|
1604
1688
|
tone: o
|
|
1605
1689
|
})
|
|
@@ -1616,7 +1700,9 @@ function Ot({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1616
1700
|
kind: F.error ? "error" : "empty",
|
|
1617
1701
|
message: F.error ?? "No rows for this period."
|
|
1618
1702
|
}) : /* @__PURE__ */ Z("ol", {
|
|
1703
|
+
ref: se,
|
|
1619
1704
|
className: "lilt-list__rows",
|
|
1705
|
+
"data-lilt-glide": "",
|
|
1620
1706
|
"data-style": _,
|
|
1621
1707
|
"data-share": z || void 0,
|
|
1622
1708
|
"data-rank": h || void 0,
|
|
@@ -1624,21 +1710,22 @@ function Ot({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1624
1710
|
children: /* @__PURE__ */ Z(Oe, {
|
|
1625
1711
|
initial: !1,
|
|
1626
1712
|
children: I.map((e, t) => {
|
|
1627
|
-
let n = _e(e.value, B), r = e.id ===
|
|
1628
|
-
return /* @__PURE__ */ Z(
|
|
1713
|
+
let n = _e(e.value, B), r = e.id === K?.id, i = he(e.value), a = k ? 0 : g(t, I.length, 120) / 1e3;
|
|
1714
|
+
return /* @__PURE__ */ Z($.li, {
|
|
1629
1715
|
layout: !k && "position",
|
|
1630
1716
|
"data-active": r || void 0,
|
|
1631
|
-
"data-muted":
|
|
1717
|
+
"data-muted": K && !r || void 0,
|
|
1632
1718
|
"data-other": e.other || void 0,
|
|
1633
1719
|
initial: !k && { opacity: 0 },
|
|
1634
1720
|
animate: { opacity: 1 },
|
|
1635
1721
|
exit: { opacity: 0 },
|
|
1636
|
-
transition:
|
|
1722
|
+
transition: ye,
|
|
1637
1723
|
children: /* @__PURE__ */ Q("button", {
|
|
1638
1724
|
type: "button",
|
|
1639
1725
|
className: "lilt-list__row",
|
|
1726
|
+
"data-glide-id": e.id,
|
|
1640
1727
|
ref: (t) => {
|
|
1641
|
-
t ?
|
|
1728
|
+
t ? q.current.set(e.id, t) : q.current.delete(e.id);
|
|
1642
1729
|
},
|
|
1643
1730
|
tabIndex: e.id === (U ?? I[0]?.id) ? 0 : -1,
|
|
1644
1731
|
"aria-label": `${e.label}: ${e.value === null ? "No data" : te.value(e.value)}${i ? `, ${i} of total` : ""}`,
|
|
@@ -1648,7 +1735,7 @@ function Ot({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1648
1735
|
onFocus: () => W(e.id),
|
|
1649
1736
|
onBlur: () => W(null),
|
|
1650
1737
|
onClick: () => re((t) => t === e.id ? null : e.id),
|
|
1651
|
-
onKeyDown: (e) =>
|
|
1738
|
+
onKeyDown: (e) => ve(e, t),
|
|
1652
1739
|
children: [
|
|
1653
1740
|
h ? /* @__PURE__ */ Z("span", {
|
|
1654
1741
|
className: "lilt-list__rank",
|
|
@@ -1662,7 +1749,7 @@ function Ot({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1662
1749
|
className: "lilt-list__zero",
|
|
1663
1750
|
style: { left: `${n.zero}%` }
|
|
1664
1751
|
}) : null,
|
|
1665
|
-
e.value === null ? null : /* @__PURE__ */ Z(
|
|
1752
|
+
e.value === null ? null : /* @__PURE__ */ Z($.span, {
|
|
1666
1753
|
className: "lilt-list__bar",
|
|
1667
1754
|
"data-negative": e.value < 0 || void 0,
|
|
1668
1755
|
initial: !k && {
|
|
@@ -1674,7 +1761,7 @@ function Ot({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1674
1761
|
width: `${n.width}%`
|
|
1675
1762
|
},
|
|
1676
1763
|
transition: {
|
|
1677
|
-
...
|
|
1764
|
+
...ye,
|
|
1678
1765
|
delay: a
|
|
1679
1766
|
}
|
|
1680
1767
|
}),
|
|
@@ -1705,7 +1792,7 @@ function Ot({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1705
1792
|
}
|
|
1706
1793
|
//#endregion
|
|
1707
1794
|
//#region src/cards/combo-chart-card.tsx
|
|
1708
|
-
function
|
|
1795
|
+
function jt({ bars: e, lines: t, lineScale: n = "shared", stack: r, radius: i = 6, corners: a = "end", tracks: o = !1, barWidth: s, barStyle: c = "solid", curve: l = "smooth", points: u = !0, aggregate: d = "sum", pillPosition: f, ...p }) {
|
|
1709
1796
|
let m = n === "own";
|
|
1710
1797
|
return /* @__PURE__ */ Z(B, {
|
|
1711
1798
|
...p,
|
|
@@ -1732,36 +1819,36 @@ function kt({ bars: e, lines: t, lineScale: n = "shared", stack: r, radius: i =
|
|
|
1732
1819
|
}
|
|
1733
1820
|
//#endregion
|
|
1734
1821
|
//#region src/cards/radial-chart-card.tsx
|
|
1735
|
-
var
|
|
1736
|
-
function
|
|
1822
|
+
var Mt = [], Nt = 92, Pt = 98, Ft = Math.PI * 2;
|
|
1823
|
+
function It(e) {
|
|
1737
1824
|
let t = e.reduce((e, t) => e + Math.max(0, t.value ?? 0), 0), n = 0;
|
|
1738
1825
|
return e.flatMap((e) => {
|
|
1739
1826
|
if (e.value === null || t <= 0) return [];
|
|
1740
1827
|
let r = n;
|
|
1741
|
-
return n += Math.max(0, e.value) / t *
|
|
1828
|
+
return n += Math.max(0, e.value) / t * Ft, [{
|
|
1742
1829
|
id: e.id,
|
|
1743
1830
|
startAngle: r,
|
|
1744
1831
|
endAngle: n
|
|
1745
1832
|
}];
|
|
1746
1833
|
});
|
|
1747
1834
|
}
|
|
1748
|
-
function
|
|
1835
|
+
function Lt(e) {
|
|
1749
1836
|
if (!(e > 0)) return 1;
|
|
1750
1837
|
let t = 10 ** Math.floor(Math.log10(e)) / 4;
|
|
1751
1838
|
return Math.ceil(e * 1.05 / t) * t;
|
|
1752
1839
|
}
|
|
1753
|
-
function
|
|
1754
|
-
let t =
|
|
1840
|
+
function Rt(e) {
|
|
1841
|
+
let t = Lt(Math.max(0, ...e.map((e) => e.value ?? 0)));
|
|
1755
1842
|
return e.flatMap((e) => e.value === null ? [] : [{
|
|
1756
1843
|
id: e.id,
|
|
1757
1844
|
startAngle: 0,
|
|
1758
|
-
endAngle: Math.max(0, e.value) / t *
|
|
1845
|
+
endAngle: Math.max(0, e.value) / t * Ft
|
|
1759
1846
|
}]);
|
|
1760
1847
|
}
|
|
1761
|
-
function
|
|
1848
|
+
function zt(e) {
|
|
1762
1849
|
return 1 - (1 - e) ** 2;
|
|
1763
1850
|
}
|
|
1764
|
-
function
|
|
1851
|
+
function Bt(e, t, n) {
|
|
1765
1852
|
let r = new Map(e.map((e) => [e.id, e]));
|
|
1766
1853
|
return t.map((e) => {
|
|
1767
1854
|
let t = r.get(e.id) ?? {
|
|
@@ -1775,14 +1862,14 @@ function Rt(e, t, n) {
|
|
|
1775
1862
|
};
|
|
1776
1863
|
});
|
|
1777
1864
|
}
|
|
1778
|
-
function
|
|
1779
|
-
let E =
|
|
1865
|
+
function Vt({ title: e, data: t, category: n, value: r, variant: i = "donut", legend: a = i === "rings" ? "tiles" : i === "semi" ? "inline" : "list", headline: o, delta: s, deltaTone: c, range: l, ranges: d, defaultRange: f, limit: p = 5, otherLabel: m = "Other", sort: h = "descending", valueFormat: g, locale: _, formatValue: v, surface: y = "elevated", badge: b, numberStyle: x, palette: S, loading: C = !1, motion: w = "auto", className: T, style: ee }) {
|
|
1866
|
+
let E = ae(w), D = ne({
|
|
1780
1867
|
valueFormat: g,
|
|
1781
1868
|
locale: _,
|
|
1782
1869
|
formatValue: v
|
|
1783
|
-
}), [O, te] = X(f ?? d?.[0]?.id), A = d?.find((e) => e.id === O) ?? d?.[0], j = A?.data ?? t ??
|
|
1870
|
+
}), [O, te] = X(f ?? d?.[0]?.id), A = d?.find((e) => e.id === O) ?? d?.[0], j = A?.data ?? t ?? Mt, M = A ? A.delta : s, N = we(() => {
|
|
1784
1871
|
try {
|
|
1785
|
-
let e =
|
|
1872
|
+
let e = Dt(j, n, r, h, p, m), t = e.find((e) => e.value !== null && e.value < 0);
|
|
1786
1873
|
if (t) throw Error(`Slices can’t be negative, and “${t.label}” is below zero.`);
|
|
1787
1874
|
return {
|
|
1788
1875
|
rows: e,
|
|
@@ -1801,43 +1888,49 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
1801
1888
|
h,
|
|
1802
1889
|
p,
|
|
1803
1890
|
m
|
|
1804
|
-
]), P = N.rows, [F, I] = X([]), L = we(() => P.filter((e) => !F.includes(e.id)), [P, F]), { total: R, observed: z } =
|
|
1891
|
+
]), P = N.rows, [F, I] = X([]), L = we(() => P.filter((e) => !F.includes(e.id)), [P, F]), { total: R, observed: z } = Ot(L), B = Te(/* @__PURE__ */ new Map()), V = (e) => P.find((t) => t.id === e)?.other ? "var(--lilt-reference)" : (B.current.has(e) || B.current.set(e, B.current.size % 6), `var(--lilt-series-${B.current.get(e) + 1})`);
|
|
1805
1892
|
for (let e of P) e.other || V(e.id);
|
|
1806
|
-
let H = i === "rings", U = i === "semi", W = we(() => H ?
|
|
1893
|
+
let H = i === "rings", U = i === "semi", W = we(() => H ? Rt(L) : It(L), [L, H]), [G, re] = X({
|
|
1807
1894
|
key: 0,
|
|
1808
1895
|
from: [],
|
|
1809
1896
|
to: W,
|
|
1810
1897
|
initial: !0
|
|
1811
|
-
}),
|
|
1898
|
+
}), ie = Te([]);
|
|
1812
1899
|
G.to !== W && re({
|
|
1813
1900
|
key: G.key + 1,
|
|
1814
|
-
from:
|
|
1901
|
+
from: ie.current,
|
|
1815
1902
|
to: W,
|
|
1816
|
-
initial:
|
|
1903
|
+
initial: ie.current.length === 0
|
|
1817
1904
|
});
|
|
1818
|
-
let
|
|
1905
|
+
let K = he({
|
|
1819
1906
|
key: G.key,
|
|
1820
1907
|
active: !C,
|
|
1821
1908
|
duration: G.initial ? 900 : 480
|
|
1822
|
-
}, E),
|
|
1823
|
-
let n = H ?
|
|
1909
|
+
}, E), q = K < 1, oe = .09, se = (e) => H && G.initial ? Math.max(0, Math.min(1, (K - e * oe) / (1 - (W.length - 1) * oe || 1))) : K, J = G.initial ? G.to.map((e, t) => {
|
|
1910
|
+
let n = H ? zt(se(t)) : K;
|
|
1824
1911
|
return {
|
|
1825
1912
|
...e,
|
|
1826
1913
|
startAngle: e.startAngle * n,
|
|
1827
1914
|
endAngle: e.endAngle * n
|
|
1828
1915
|
};
|
|
1829
|
-
}) :
|
|
1830
|
-
|
|
1831
|
-
let [ge, _e] = X(null), [ve,
|
|
1832
|
-
|
|
1833
|
-
|
|
1916
|
+
}) : Bt(G.from, G.to, K);
|
|
1917
|
+
ie.current = J;
|
|
1918
|
+
let [ge, _e] = X(null), [ve, ye] = X(null), [be, xe] = X(null), Y = be ?? ve ?? ge, Se = L.find((e) => e.id === Y), Ce = Te(/* @__PURE__ */ new Map()), Ee = lt({
|
|
1919
|
+
resolve: ct,
|
|
1920
|
+
onGlide: _e,
|
|
1921
|
+
onLift: (e) => e !== null && xe(e),
|
|
1922
|
+
disabled: C
|
|
1923
|
+
}), De = (e) => e && e.value !== null && R > 0 && !F.includes(e.id) ? Et.format(e.value / R) : null, Oe = L.find((e) => e.value !== null && !e.other), $ = (e) => {
|
|
1924
|
+
I(e), _e(null), xe(null);
|
|
1925
|
+
}, ke = (e) => F.includes(e) ? $(F.filter((t) => t !== e)) : L.length > 1 ? $([...F, e]) : void 0, je = Se ?? Oe, Me = i === "donut" ? 62 : U ? 64 : 0, Ne = (e) => Ae().innerRadius(Me).outerRadius(e).cornerRadius(i === "donut" ? 3 : U ? 14 : 0).padAngle(J.length > 1 ? U ? .05 : .012 : 0), Pe = Ne(Nt), Fe = Ne(Pt), Ie = (e) => ({
|
|
1834
1926
|
...e,
|
|
1835
1927
|
startAngle: -Math.PI / 2 + e.startAngle / 2,
|
|
1836
1928
|
endAngle: -Math.PI / 2 + e.endAngle / 2
|
|
1837
|
-
}), Le = Math.max(1, W.length), Re = Math.min(9, 62 / Le - 4), ze = (e, t = 0) =>
|
|
1929
|
+
}), Le = Math.max(1, W.length), Re = Math.min(9, 62 / Le - 4), ze = (e, t = 0) => Ae().innerRadius(Nt - e * (Re + 4) - Re - t / 2).outerRadius(Nt - e * (Re + 4) + t / 2).cornerRadius(Re), Be = (e) => ({
|
|
1930
|
+
"data-glide-id": e,
|
|
1838
1931
|
onPointerEnter: () => _e(e),
|
|
1839
1932
|
onPointerLeave: () => _e(null),
|
|
1840
|
-
onClick: () =>
|
|
1933
|
+
onClick: () => xe((t) => t === e ? null : e)
|
|
1841
1934
|
}), Ve = (e, t) => {
|
|
1842
1935
|
let n = t;
|
|
1843
1936
|
if (e.key === "ArrowDown") n = Math.min(P.length - 1, t + 1);
|
|
@@ -1845,7 +1938,7 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
1845
1938
|
else if (e.key === "Home") n = 0;
|
|
1846
1939
|
else if (e.key === "End") n = P.length - 1;
|
|
1847
1940
|
else if (e.key === "Escape") {
|
|
1848
|
-
|
|
1941
|
+
xe(null);
|
|
1849
1942
|
return;
|
|
1850
1943
|
} else return;
|
|
1851
1944
|
e.preventDefault(), Ce.current.get(P[n].id)?.focus();
|
|
@@ -1869,12 +1962,12 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
1869
1962
|
value: A?.id,
|
|
1870
1963
|
onValueChange: te
|
|
1871
1964
|
}) : null,
|
|
1872
|
-
children: [/* @__PURE__ */ Z(
|
|
1965
|
+
children: [/* @__PURE__ */ Z(de, { children: e }), /* @__PURE__ */ Z(ue, {
|
|
1873
1966
|
value: Se ? Se.value : He,
|
|
1874
1967
|
format: D.value,
|
|
1875
1968
|
loading: C,
|
|
1876
1969
|
motion: w,
|
|
1877
|
-
children: C ? null : Se ? /* @__PURE__ */ Q(
|
|
1970
|
+
children: C ? null : Se ? /* @__PURE__ */ Q(ce, { children: [Se.label, De(Se) ? ` · ${De(Se)}` : ""] }) : M === void 0 ? null : /* @__PURE__ */ Z(le, {
|
|
1878
1971
|
value: M,
|
|
1879
1972
|
tone: c
|
|
1880
1973
|
})
|
|
@@ -1887,14 +1980,16 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
1887
1980
|
"data-variant": i,
|
|
1888
1981
|
"data-legend": a,
|
|
1889
1982
|
children: [/* @__PURE__ */ Q("div", {
|
|
1983
|
+
ref: Ee,
|
|
1890
1984
|
className: "lilt-radial-card__graphic",
|
|
1985
|
+
"data-lilt-glide": "",
|
|
1891
1986
|
children: [/* @__PURE__ */ Z("svg", {
|
|
1892
1987
|
"aria-hidden": "true",
|
|
1893
1988
|
className: "lilt-radial-card__svg",
|
|
1894
1989
|
viewBox: U ? "-100 -100 200 104" : "-100 -100 200 200",
|
|
1895
1990
|
"data-loading": C || void 0,
|
|
1896
|
-
"data-drawing":
|
|
1897
|
-
children: C ? /* @__PURE__ */ Z(
|
|
1991
|
+
"data-drawing": q || void 0,
|
|
1992
|
+
children: C ? /* @__PURE__ */ Z(_t, {
|
|
1898
1993
|
x: -100,
|
|
1899
1994
|
y: -100,
|
|
1900
1995
|
width: 200,
|
|
@@ -1909,10 +2004,10 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
1909
2004
|
}) ?? ""
|
|
1910
2005
|
}) : /* @__PURE__ */ Z("circle", {
|
|
1911
2006
|
className: "lilt-radial-card__skeleton",
|
|
1912
|
-
r: (
|
|
1913
|
-
strokeWidth:
|
|
2007
|
+
r: (Nt + Me) / 2,
|
|
2008
|
+
strokeWidth: Nt - Me || Nt
|
|
1914
2009
|
})
|
|
1915
|
-
}) : H ?
|
|
2010
|
+
}) : H ? J.map((e, t) => {
|
|
1916
2011
|
let n = e.id === Se?.id, r = ze(t), i = ze(t, n ? 3 : 0)(e);
|
|
1917
2012
|
return /* @__PURE__ */ Q("g", {
|
|
1918
2013
|
className: "lilt-radial-card__ring",
|
|
@@ -1925,7 +2020,7 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
1925
2020
|
d: r({
|
|
1926
2021
|
id: e.id,
|
|
1927
2022
|
startAngle: 0,
|
|
1928
|
-
endAngle:
|
|
2023
|
+
endAngle: Ft
|
|
1929
2024
|
}) ?? ""
|
|
1930
2025
|
}), i && e.endAngle > 0 ? /* @__PURE__ */ Z("path", {
|
|
1931
2026
|
className: "lilt-radial-card__slice",
|
|
@@ -1933,7 +2028,7 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
1933
2028
|
style: { fill: V(e.id) }
|
|
1934
2029
|
}) : null]
|
|
1935
2030
|
}, e.id);
|
|
1936
|
-
}) :
|
|
2031
|
+
}) : J.map((e) => {
|
|
1937
2032
|
let t = e.id === Se?.id, n = U ? Ie(e) : e, r = (t ? Fe : Pe)(n);
|
|
1938
2033
|
return r ? /* @__PURE__ */ Q("g", { children: [/* @__PURE__ */ Z("path", {
|
|
1939
2034
|
className: "lilt-radial-card__slice",
|
|
@@ -1949,11 +2044,11 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
1949
2044
|
...Be(e.id)
|
|
1950
2045
|
})] }, e.id) : null;
|
|
1951
2046
|
})
|
|
1952
|
-
}), (i === "donut" || U) && !C &&
|
|
2047
|
+
}), (i === "donut" || U) && !C && je ? /* @__PURE__ */ Q("div", {
|
|
1953
2048
|
className: "lilt-radial-card__center",
|
|
1954
2049
|
"aria-hidden": "true",
|
|
1955
|
-
style: G.initial &&
|
|
1956
|
-
children: [/* @__PURE__ */ Z("strong", { children:
|
|
2050
|
+
style: G.initial && q ? { opacity: Math.max(0, (K - .55) / .45) } : void 0,
|
|
2051
|
+
children: [/* @__PURE__ */ Z("strong", { children: De(je) ?? "—" }), /* @__PURE__ */ Z("span", { children: je.label })]
|
|
1957
2052
|
}) : null]
|
|
1958
2053
|
}), a === "list" ? C ? /* @__PURE__ */ Z("div", {
|
|
1959
2054
|
className: "lilt-radial-card__legend",
|
|
@@ -1966,7 +2061,7 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
1966
2061
|
className: "lilt-radial-card__legend",
|
|
1967
2062
|
"aria-label": `${e} by share`,
|
|
1968
2063
|
children: P.map((e, t) => {
|
|
1969
|
-
let n = e.id === Se?.id, r =
|
|
2064
|
+
let n = e.id === Se?.id, r = De(e), i = F.includes(e.id);
|
|
1970
2065
|
return /* @__PURE__ */ Q("li", {
|
|
1971
2066
|
"data-active": n || void 0,
|
|
1972
2067
|
"data-muted": Se && !n || void 0,
|
|
@@ -1982,8 +2077,8 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
1982
2077
|
"aria-pressed": !i,
|
|
1983
2078
|
onPointerEnter: () => !i && _e(e.id),
|
|
1984
2079
|
onPointerLeave: () => _e(null),
|
|
1985
|
-
onFocus: () => !i &&
|
|
1986
|
-
onBlur: () =>
|
|
2080
|
+
onFocus: () => !i && ye(e.id),
|
|
2081
|
+
onBlur: () => ye(null),
|
|
1987
2082
|
onClick: () => ke(e.id),
|
|
1988
2083
|
onKeyDown: (e) => Ve(e, t),
|
|
1989
2084
|
children: [
|
|
@@ -2014,13 +2109,13 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
2014
2109
|
type: "button",
|
|
2015
2110
|
className: "lilt-chart__legend-action",
|
|
2016
2111
|
"aria-label": `Show only ${e.label}`,
|
|
2017
|
-
onClick: () =>
|
|
2112
|
+
onClick: () => $(P.map((e) => e.id).filter((t) => t !== e.id)),
|
|
2018
2113
|
children: "Only"
|
|
2019
2114
|
}) : null, F.length ? /* @__PURE__ */ Z("button", {
|
|
2020
2115
|
type: "button",
|
|
2021
2116
|
className: "lilt-chart__legend-action",
|
|
2022
2117
|
"aria-label": "Show all categories",
|
|
2023
|
-
onClick: () =>
|
|
2118
|
+
onClick: () => $([]),
|
|
2024
2119
|
children: "Show all"
|
|
2025
2120
|
}) : null]
|
|
2026
2121
|
}) : null]
|
|
@@ -2038,10 +2133,10 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
2038
2133
|
formattedValue: e.value === null ? "No data" : D.value(e.value)
|
|
2039
2134
|
})),
|
|
2040
2135
|
activeId: Se?.id ?? null,
|
|
2041
|
-
selectedId:
|
|
2136
|
+
selectedId: be,
|
|
2042
2137
|
onHoverIdChange: _e,
|
|
2043
2138
|
hiddenIds: F,
|
|
2044
|
-
onHiddenIdsChange:
|
|
2139
|
+
onHiddenIdsChange: $,
|
|
2045
2140
|
renderValue: C ? () => /* @__PURE__ */ Z("span", { className: "lilt-card__skeleton lilt-card__skeleton--tile" }) : a === "inline" ? (e) => e.formattedValue : void 0
|
|
2046
2141
|
})]
|
|
2047
2142
|
})]
|
|
@@ -2049,9 +2144,9 @@ function zt({ title: e, data: t, category: n, value: r, variant: i = "donut", le
|
|
|
2049
2144
|
}
|
|
2050
2145
|
//#endregion
|
|
2051
2146
|
//#region src/cards/progress-card.tsx
|
|
2052
|
-
var
|
|
2053
|
-
function
|
|
2054
|
-
let C =
|
|
2147
|
+
var Ht = (e) => `${Math.round(e * 100)}%`;
|
|
2148
|
+
function Ut({ title: e, value: t = null, target: n, label: r = "of goal", variant: i = "ring", delta: a, deltaTone: o, range: s, ranges: c, defaultRange: l, footer: u, valueFormat: d, locale: f, formatValue: p, color: m, surface: h = "elevated", badge: g, numberStyle: _, palette: v, loading: y = !1, motion: b = "auto", className: x, style: S }) {
|
|
2149
|
+
let C = ae(b), w = ne({
|
|
2055
2150
|
valueFormat: d,
|
|
2056
2151
|
locale: f,
|
|
2057
2152
|
formatValue: p
|
|
@@ -2079,12 +2174,12 @@ function Vt({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2079
2174
|
value: E?.id,
|
|
2080
2175
|
onValueChange: ee
|
|
2081
2176
|
}) : null,
|
|
2082
|
-
children: [/* @__PURE__ */ Z(
|
|
2177
|
+
children: [/* @__PURE__ */ Z(de, { children: e }), /* @__PURE__ */ Z(ue, {
|
|
2083
2178
|
value: D,
|
|
2084
2179
|
format: w.value,
|
|
2085
2180
|
loading: y,
|
|
2086
2181
|
motion: b,
|
|
2087
|
-
children: y || k === void 0 ? null : /* @__PURE__ */ Z(
|
|
2182
|
+
children: y || k === void 0 ? null : /* @__PURE__ */ Z(le, {
|
|
2088
2183
|
value: k,
|
|
2089
2184
|
tone: o
|
|
2090
2185
|
})
|
|
@@ -2094,7 +2189,7 @@ function Vt({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2094
2189
|
className: "lilt-progress__graphic",
|
|
2095
2190
|
"data-variant": i,
|
|
2096
2191
|
role: "meter",
|
|
2097
|
-
"aria-label": `${te === null ? "No data" :
|
|
2192
|
+
"aria-label": `${te === null ? "No data" : Ht(te)} ${r}, target ${w.value(O)}`,
|
|
2098
2193
|
"aria-valuemin": 0,
|
|
2099
2194
|
"aria-valuemax": O,
|
|
2100
2195
|
"aria-valuenow": D ?? 0,
|
|
@@ -2108,7 +2203,7 @@ function Vt({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2108
2203
|
cy: 100,
|
|
2109
2204
|
r: N - 20
|
|
2110
2205
|
}) : null,
|
|
2111
|
-
y ? /* @__PURE__ */ Z(
|
|
2206
|
+
y ? /* @__PURE__ */ Z(_t, {
|
|
2112
2207
|
width: 200,
|
|
2113
2208
|
height: A ? 106 : 200,
|
|
2114
2209
|
reduced: C,
|
|
@@ -2136,7 +2231,7 @@ function Vt({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2136
2231
|
r: N,
|
|
2137
2232
|
strokeWidth: M
|
|
2138
2233
|
}),
|
|
2139
|
-
te ? A ? /* @__PURE__ */ Z(
|
|
2234
|
+
te ? A ? /* @__PURE__ */ Z($.path, {
|
|
2140
2235
|
className: "lilt-progress__fill",
|
|
2141
2236
|
d: P,
|
|
2142
2237
|
strokeWidth: M,
|
|
@@ -2144,9 +2239,9 @@ function Vt({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2144
2239
|
animate: { pathLength: Math.min(1, te) },
|
|
2145
2240
|
transition: {
|
|
2146
2241
|
duration: +!C,
|
|
2147
|
-
ease:
|
|
2242
|
+
ease: oe
|
|
2148
2243
|
}
|
|
2149
|
-
}) : /* @__PURE__ */ Z(
|
|
2244
|
+
}) : /* @__PURE__ */ Z($.circle, {
|
|
2150
2245
|
className: "lilt-progress__fill",
|
|
2151
2246
|
cx: 100,
|
|
2152
2247
|
cy: 100,
|
|
@@ -2157,16 +2252,16 @@ function Vt({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2157
2252
|
animate: { pathLength: Math.min(1, te) },
|
|
2158
2253
|
transition: {
|
|
2159
2254
|
duration: +!C,
|
|
2160
|
-
ease:
|
|
2255
|
+
ease: oe
|
|
2161
2256
|
}
|
|
2162
2257
|
}) : null
|
|
2163
2258
|
]
|
|
2164
2259
|
}), /* @__PURE__ */ Q("div", {
|
|
2165
2260
|
className: "lilt-progress__center",
|
|
2166
2261
|
"aria-hidden": "true",
|
|
2167
|
-
children: [/* @__PURE__ */ Z("strong", { children: te === null ? "—" : /* @__PURE__ */ Z(
|
|
2262
|
+
children: [/* @__PURE__ */ Z("strong", { children: te === null ? "—" : /* @__PURE__ */ Z(q, {
|
|
2168
2263
|
value: te,
|
|
2169
|
-
format:
|
|
2264
|
+
format: Ht,
|
|
2170
2265
|
variant: _,
|
|
2171
2266
|
motion: C ? "none" : "auto"
|
|
2172
2267
|
}) }), /* @__PURE__ */ Z("span", { children: r })]
|
|
@@ -2181,19 +2276,19 @@ function Vt({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2181
2276
|
}
|
|
2182
2277
|
//#endregion
|
|
2183
2278
|
//#region src/cards/funnel-chart-card.tsx
|
|
2184
|
-
var
|
|
2279
|
+
var Wt = [], Gt = [
|
|
2185
2280
|
100,
|
|
2186
2281
|
62,
|
|
2187
2282
|
40,
|
|
2188
2283
|
24
|
|
2189
|
-
],
|
|
2190
|
-
function
|
|
2284
|
+
], Kt = 55, qt = 1.4;
|
|
2285
|
+
function Jt(e) {
|
|
2191
2286
|
return e === null ? "—" : e > 0 && e < .01 ? "<1%" : `${Math.round(e * 100)}%`;
|
|
2192
2287
|
}
|
|
2193
|
-
function
|
|
2288
|
+
function Yt(e, t, n, r) {
|
|
2194
2289
|
let i = e * 100, a = i + 100, o = (e) => 50 - e / 2, s = (e) => 50 + e / 2, c = n ?? t;
|
|
2195
2290
|
if (r === "linear") return `M${i},${o(t)} L${a},${o(c)} L${a},${s(c)} L${i},${s(t)} Z`;
|
|
2196
|
-
let l = i +
|
|
2291
|
+
let l = i + Kt, u = (a - l) * .5;
|
|
2197
2292
|
return [
|
|
2198
2293
|
`M${i},${o(t)}`,
|
|
2199
2294
|
`L${l},${o(t)}`,
|
|
@@ -2204,16 +2299,16 @@ function qt(e, t, n, r) {
|
|
|
2204
2299
|
"Z"
|
|
2205
2300
|
].join(" ");
|
|
2206
2301
|
}
|
|
2207
|
-
function
|
|
2208
|
-
let E =
|
|
2302
|
+
function Xt({ title: e, data: t, category: n, value: r, curve: i = "smooth", colors: a = "stages", tracks: o = !1, height: s = 180, headline: c, delta: l, deltaTone: d, range: f, ranges: p, defaultRange: m, valueFormat: h, locale: g, formatValue: _, color: v, surface: y = "elevated", badge: b, numberStyle: x, palette: S, loading: C = !1, motion: w = "auto", className: T, style: ee }) {
|
|
2303
|
+
let E = ae(w), D = ne({
|
|
2209
2304
|
valueFormat: h,
|
|
2210
2305
|
locale: g,
|
|
2211
2306
|
formatValue: _
|
|
2212
|
-
}), [O, te] = X(m ?? p?.[0]?.id), A = p?.find((e) => e.id === O) ?? p?.[0], j = A?.data ?? t ??
|
|
2307
|
+
}), [O, te] = X(m ?? p?.[0]?.id), A = p?.find((e) => e.id === O) ?? p?.[0], j = A?.data ?? t ?? Wt, M = A ? A.delta : l, N = we(() => {
|
|
2213
2308
|
try {
|
|
2214
2309
|
let e = (e, t) => e[t];
|
|
2215
2310
|
return {
|
|
2216
|
-
rows:
|
|
2311
|
+
rows: be({
|
|
2217
2312
|
data: j,
|
|
2218
2313
|
category: {
|
|
2219
2314
|
id: (t) => String(e(t, n) ?? ""),
|
|
@@ -2237,7 +2332,7 @@ function Jt({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2237
2332
|
j,
|
|
2238
2333
|
n,
|
|
2239
2334
|
r
|
|
2240
|
-
]), P = N.rows, F = we(() => P.map((e) => e.share === null ? null : Math.max(
|
|
2335
|
+
]), P = N.rows, F = we(() => P.map((e) => e.share === null ? null : Math.max(qt, e.share * 100)), [P]), [I, L] = X({
|
|
2241
2336
|
key: 0,
|
|
2242
2337
|
from: [],
|
|
2243
2338
|
to: F,
|
|
@@ -2258,13 +2353,18 @@ function Jt({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2258
2353
|
return e === null || n == null ? e : n + (e - n) * z;
|
|
2259
2354
|
});
|
|
2260
2355
|
R.current = B;
|
|
2261
|
-
let V = I.initial ? z : 1, [H, U] = X(null), [W, G] = X(null), re =
|
|
2356
|
+
let V = I.initial ? z : 1, [H, U] = X(null), [W, G] = X(null), re = lt({
|
|
2357
|
+
resolve: ct,
|
|
2358
|
+
onGlide: U,
|
|
2359
|
+
onLift: (e) => e !== null && G(e),
|
|
2360
|
+
disabled: C
|
|
2361
|
+
}), ie = W ?? H, K = P.findIndex((e) => e.id === ie), q = P[K], oe = K > 0 ? P[K - 1] : void 0, se = (e) => a === "single" ? "var(--lilt-series-1)" : `var(--lilt-series-${e % 6 + 1})`, J = C && !P.length ? Gt.length : Math.max(1, P.length), ge = A?.headline ?? c ?? P[0]?.value ?? null, _e = `lilt-funnel-${Se().replace(/:/g, "")}`, ve = !C && (N.error !== null || P.length === 0);
|
|
2262
2362
|
return /* @__PURE__ */ Q(me, {
|
|
2263
2363
|
motion: w,
|
|
2264
2364
|
className: ["lilt-funnel-card", T].filter(Boolean).join(" "),
|
|
2265
2365
|
style: {
|
|
2266
2366
|
...ee,
|
|
2267
|
-
"--lilt-funnel-stages":
|
|
2367
|
+
"--lilt-funnel-stages": J,
|
|
2268
2368
|
...v ? { "--lilt-series-1": v } : {}
|
|
2269
2369
|
},
|
|
2270
2370
|
"aria-label": e,
|
|
@@ -2282,36 +2382,38 @@ function Jt({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2282
2382
|
value: A?.id,
|
|
2283
2383
|
onValueChange: te
|
|
2284
2384
|
}) : null,
|
|
2285
|
-
children: [/* @__PURE__ */ Z(
|
|
2286
|
-
value: q ? q.value :
|
|
2385
|
+
children: [/* @__PURE__ */ Z(de, { children: e }), /* @__PURE__ */ Z(ue, {
|
|
2386
|
+
value: q ? q.value : ge,
|
|
2287
2387
|
format: D.value,
|
|
2288
2388
|
loading: C,
|
|
2289
2389
|
motion: w,
|
|
2290
|
-
children: C ? null : q ? /* @__PURE__ */ Q(
|
|
2390
|
+
children: C ? null : q ? /* @__PURE__ */ Q(ce, { children: [q.label, q.conversion !== null && oe ? ` · ${Jt(q.conversion)} of ${oe.label}` : ""] }) : M === void 0 ? null : /* @__PURE__ */ Z(le, {
|
|
2291
2391
|
value: M,
|
|
2292
2392
|
tone: d
|
|
2293
2393
|
})
|
|
2294
2394
|
})]
|
|
2295
|
-
}),
|
|
2395
|
+
}), ve ? /* @__PURE__ */ Z(u, {
|
|
2296
2396
|
kind: N.error ? "error" : "empty",
|
|
2297
2397
|
message: N.error ?? "No stages for this period."
|
|
2298
2398
|
}) : /* @__PURE__ */ Q(De, { children: [/* @__PURE__ */ Q("div", {
|
|
2399
|
+
ref: re,
|
|
2299
2400
|
className: "lilt-funnel-card__plot",
|
|
2401
|
+
"data-lilt-glide": "",
|
|
2300
2402
|
style: { height: s },
|
|
2301
2403
|
"data-loading": C || void 0,
|
|
2302
2404
|
onPointerLeave: () => U(null),
|
|
2303
2405
|
children: [/* @__PURE__ */ Q("svg", {
|
|
2304
2406
|
"aria-hidden": "true",
|
|
2305
2407
|
className: "lilt-funnel-card__svg",
|
|
2306
|
-
viewBox: `0 0 ${
|
|
2408
|
+
viewBox: `0 0 ${J * 100} 100`,
|
|
2307
2409
|
preserveAspectRatio: "none",
|
|
2308
2410
|
children: [
|
|
2309
2411
|
/* @__PURE__ */ Z("defs", { children: /* @__PURE__ */ Z("clipPath", {
|
|
2310
|
-
id:
|
|
2412
|
+
id: _e,
|
|
2311
2413
|
children: /* @__PURE__ */ Z("rect", {
|
|
2312
2414
|
x: 0,
|
|
2313
2415
|
y: 0,
|
|
2314
|
-
width:
|
|
2416
|
+
width: J * 100 * V,
|
|
2315
2417
|
height: 100
|
|
2316
2418
|
})
|
|
2317
2419
|
}) }),
|
|
@@ -2322,31 +2424,31 @@ function Jt({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2322
2424
|
width: 100,
|
|
2323
2425
|
height: 100
|
|
2324
2426
|
}, `track-${e.id}`)) : null,
|
|
2325
|
-
C ? /* @__PURE__ */ Z(
|
|
2326
|
-
width:
|
|
2427
|
+
C ? /* @__PURE__ */ Z(_t, {
|
|
2428
|
+
width: J * 100,
|
|
2327
2429
|
height: 100,
|
|
2328
2430
|
reduced: E,
|
|
2329
|
-
children:
|
|
2431
|
+
children: Gt.slice(0, J).map((e, t) => /* @__PURE__ */ Z("path", {
|
|
2330
2432
|
className: "lilt-funnel-card__skeleton",
|
|
2331
|
-
d:
|
|
2433
|
+
d: Yt(t, e, Gt[t + 1] ?? null, i)
|
|
2332
2434
|
}, t))
|
|
2333
2435
|
}) : /* @__PURE__ */ Z("g", {
|
|
2334
|
-
clipPath: `url(#${
|
|
2436
|
+
clipPath: `url(#${_e})`,
|
|
2335
2437
|
children: P.map((e, t) => {
|
|
2336
2438
|
let n = B[t];
|
|
2337
2439
|
if (n == null) return null;
|
|
2338
2440
|
let r = t + 1 < P.length ? B[t + 1] ?? null : null;
|
|
2339
2441
|
return /* @__PURE__ */ Z("path", {
|
|
2340
2442
|
className: "lilt-funnel-card__band",
|
|
2341
|
-
d:
|
|
2443
|
+
d: Yt(t, n, r, i),
|
|
2342
2444
|
"data-stage": e.id,
|
|
2343
2445
|
"data-active": e.id === q?.id || void 0,
|
|
2344
2446
|
"data-muted": q && e.id !== q.id || void 0,
|
|
2345
|
-
style: { fill:
|
|
2447
|
+
style: { fill: se(t) }
|
|
2346
2448
|
}, e.id);
|
|
2347
2449
|
})
|
|
2348
2450
|
}),
|
|
2349
|
-
Array.from({ length:
|
|
2451
|
+
Array.from({ length: J - 1 }, (e, t) => /* @__PURE__ */ Z("line", {
|
|
2350
2452
|
className: "lilt-funnel-card__divider",
|
|
2351
2453
|
x1: (t + 1) * 100,
|
|
2352
2454
|
x2: (t + 1) * 100,
|
|
@@ -2360,17 +2462,18 @@ function Jt({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2360
2462
|
tabIndex: -1,
|
|
2361
2463
|
"aria-hidden": "true",
|
|
2362
2464
|
className: "lilt-funnel-card__column",
|
|
2465
|
+
"data-glide-id": e.id,
|
|
2363
2466
|
"data-muted": q && e.id !== q.id || void 0,
|
|
2364
2467
|
style: {
|
|
2365
|
-
left: `${t /
|
|
2366
|
-
width: `${100 /
|
|
2468
|
+
left: `${t / J * 100}%`,
|
|
2469
|
+
width: `${100 / J}%`
|
|
2367
2470
|
},
|
|
2368
2471
|
onPointerEnter: () => U(e.id),
|
|
2369
2472
|
onClick: () => G((t) => t === e.id ? null : e.id),
|
|
2370
2473
|
children: /* @__PURE__ */ Z("span", {
|
|
2371
2474
|
className: "lilt-funnel-card__pill",
|
|
2372
|
-
style: { opacity: V < (t + .5) /
|
|
2373
|
-
children:
|
|
2475
|
+
style: { opacity: V < (t + .5) / J ? 0 : q && e.id !== q.id ? .45 : 1 },
|
|
2476
|
+
children: Jt(e.share)
|
|
2374
2477
|
})
|
|
2375
2478
|
}, e.id))]
|
|
2376
2479
|
}), /* @__PURE__ */ Z(k, {
|
|
@@ -2379,7 +2482,7 @@ function Jt({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2379
2482
|
items: P.map((e, t) => ({
|
|
2380
2483
|
id: e.id,
|
|
2381
2484
|
label: e.label,
|
|
2382
|
-
color: e.value === null ? "transparent" :
|
|
2485
|
+
color: e.value === null ? "transparent" : se(t),
|
|
2383
2486
|
value: e.value,
|
|
2384
2487
|
formattedValue: e.value === null ? "No data" : D.value(e.value)
|
|
2385
2488
|
})),
|
|
@@ -2393,11 +2496,11 @@ function Jt({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2393
2496
|
}
|
|
2394
2497
|
//#endregion
|
|
2395
2498
|
//#region src/cards/heatmap-chart-card.tsx
|
|
2396
|
-
var
|
|
2499
|
+
var Zt = [], Qt = {
|
|
2397
2500
|
rows: 7,
|
|
2398
2501
|
columns: 12
|
|
2399
|
-
},
|
|
2400
|
-
function
|
|
2502
|
+
}, $t = 30, en = 12, tn = 8, nn = (e, t) => `${e}\u0000${t}`;
|
|
2503
|
+
function rn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
2401
2504
|
let s = (e, t) => e[t], c = (e) => ({
|
|
2402
2505
|
columns: [],
|
|
2403
2506
|
rows: [],
|
|
@@ -2421,7 +2524,7 @@ function tn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
2421
2524
|
if (r) return c(`“${t}” isn’t listed in \`${o}\`.`);
|
|
2422
2525
|
n.push(t);
|
|
2423
2526
|
}
|
|
2424
|
-
let h =
|
|
2527
|
+
let h = nn(m, e);
|
|
2425
2528
|
if (d.has(h)) return c(`${m}, ${e} appears twice; each cell needs one row.`);
|
|
2426
2529
|
let g = s(o, r), _ = typeof g == "number" && Number.isFinite(g) ? g : null;
|
|
2427
2530
|
_ !== null && (f = Math.min(f, _), p = Math.max(p, _)), d.set(h, {
|
|
@@ -2443,9 +2546,9 @@ function tn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
2443
2546
|
columns: l,
|
|
2444
2547
|
rows: u,
|
|
2445
2548
|
cells: u.flatMap((e) => l.map((t) => {
|
|
2446
|
-
let n = d.get(
|
|
2549
|
+
let n = d.get(nn(e, t)), r = n?.value ?? null;
|
|
2447
2550
|
return {
|
|
2448
|
-
id:
|
|
2551
|
+
id: nn(e, t),
|
|
2449
2552
|
label: `${e}, ${t}`,
|
|
2450
2553
|
row: e,
|
|
2451
2554
|
column: t,
|
|
@@ -2458,18 +2561,18 @@ function tn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
2458
2561
|
error: null
|
|
2459
2562
|
};
|
|
2460
2563
|
}
|
|
2461
|
-
var
|
|
2462
|
-
function
|
|
2463
|
-
if (t <=
|
|
2464
|
-
let n = Math.ceil(t /
|
|
2564
|
+
var an = (e) => 12 + e * 83;
|
|
2565
|
+
function on(e, t) {
|
|
2566
|
+
if (t <= tn) return "major";
|
|
2567
|
+
let n = Math.ceil(t / en);
|
|
2465
2568
|
return e % (n * 2) == 0 ? "major" : e % n === 0 ? "minor" : "hidden";
|
|
2466
2569
|
}
|
|
2467
|
-
function
|
|
2468
|
-
let A =
|
|
2570
|
+
function sn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, domain: s, aggregate: c = "sum", height: l, radius: d = 5, gap: f = 4, headline: p, delta: m, deltaTone: h, range: g, ranges: _, defaultRange: v, valueFormat: y, locale: b, formatValue: x, color: S, surface: C = "elevated", badge: w, numberStyle: T, palette: E, loading: D = !1, motion: O = "auto", className: k, style: te }) {
|
|
2571
|
+
let A = ae(O), j = ne({
|
|
2469
2572
|
valueFormat: y,
|
|
2470
2573
|
locale: b,
|
|
2471
2574
|
formatValue: x
|
|
2472
|
-
}), [M, N] = X(v ?? _?.[0]?.id), P = _?.find((e) => e.id === M) ?? _?.[0], F = P?.data ?? t ??
|
|
2575
|
+
}), [M, N] = X(v ?? _?.[0]?.id), P = _?.find((e) => e.id === M) ?? _?.[0], F = P?.data ?? t ?? Zt, I = P ? P.delta : m, L = we(() => rn({
|
|
2473
2576
|
data: F,
|
|
2474
2577
|
x: n,
|
|
2475
2578
|
y: r,
|
|
@@ -2485,10 +2588,10 @@ function an({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
2485
2588
|
a,
|
|
2486
2589
|
o,
|
|
2487
2590
|
s
|
|
2488
|
-
]), R =
|
|
2591
|
+
]), R = dt(L.cells, !D, void 0, void 0, L.columns.length), z = L.cells.find((e) => e.id === R.active?.id), B = L.cells.flatMap((e) => e.value === null ? [] : [e.value]), V = P?.headline ?? p ?? ee(B, c), H = L.cells.some((e) => e.value === null), U = !D && (L.error !== null || L.cells.length === 0), W = D && !L.cells.length ? Qt : {
|
|
2489
2592
|
rows: L.rows.length,
|
|
2490
2593
|
columns: L.columns.length
|
|
2491
|
-
}, G = l ? Math.max(8, (l - f * Math.max(0, W.rows - 1)) / Math.max(1, W.rows)) :
|
|
2594
|
+
}, G = l ? Math.max(8, (l - f * Math.max(0, W.rows - 1)) / Math.max(1, W.rows)) : $t;
|
|
2492
2595
|
return /* @__PURE__ */ Q(me, {
|
|
2493
2596
|
motion: O,
|
|
2494
2597
|
className: ["lilt-heatmap-card", k].filter(Boolean).join(" "),
|
|
@@ -2515,17 +2618,17 @@ function an({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
2515
2618
|
value: P?.id,
|
|
2516
2619
|
onValueChange: N
|
|
2517
2620
|
}) : null,
|
|
2518
|
-
children: [/* @__PURE__ */ Z(
|
|
2621
|
+
children: [/* @__PURE__ */ Z(de, { children: e }), /* @__PURE__ */ Z(ue, {
|
|
2519
2622
|
value: z ? z.value : V,
|
|
2520
2623
|
format: j.value,
|
|
2521
2624
|
loading: D,
|
|
2522
2625
|
motion: O,
|
|
2523
|
-
children: D ? null : z ? /* @__PURE__ */ Q(
|
|
2626
|
+
children: D ? null : z ? /* @__PURE__ */ Q(ce, { children: [
|
|
2524
2627
|
z.row,
|
|
2525
2628
|
" · ",
|
|
2526
2629
|
z.column,
|
|
2527
2630
|
z.value === null ? " · No data" : ""
|
|
2528
|
-
] }) : I === void 0 ? null : /* @__PURE__ */ Z(
|
|
2631
|
+
] }) : I === void 0 ? null : /* @__PURE__ */ Z(le, {
|
|
2529
2632
|
value: I,
|
|
2530
2633
|
tone: h
|
|
2531
2634
|
})
|
|
@@ -2554,8 +2657,10 @@ function an({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
2554
2657
|
})
|
|
2555
2658
|
})]
|
|
2556
2659
|
}) : /* @__PURE__ */ Q(De, { children: [/* @__PURE__ */ Q("table", {
|
|
2660
|
+
ref: R.glideRef,
|
|
2557
2661
|
className: "lilt-heatmap-card__grid",
|
|
2558
2662
|
role: "table",
|
|
2663
|
+
"data-lilt-glide": "",
|
|
2559
2664
|
"aria-label": e,
|
|
2560
2665
|
"data-motion": A ? "none" : void 0,
|
|
2561
2666
|
children: [/* @__PURE__ */ Z("tbody", {
|
|
@@ -2581,7 +2686,7 @@ function an({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
2581
2686
|
"data-active": z?.id === a.id || void 0,
|
|
2582
2687
|
"data-muted": z && !o || void 0,
|
|
2583
2688
|
style: {
|
|
2584
|
-
"--lilt-heatmap-card-strength": a.intensity === null ? void 0 : `${
|
|
2689
|
+
"--lilt-heatmap-card-strength": a.intensity === null ? void 0 : `${an(a.intensity)}%`,
|
|
2585
2690
|
"--lilt-heatmap-card-delay": `${Math.min(160, r * 12)}ms`
|
|
2586
2691
|
}
|
|
2587
2692
|
})
|
|
@@ -2596,7 +2701,7 @@ function an({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
2596
2701
|
scope: "col",
|
|
2597
2702
|
role: "columnheader",
|
|
2598
2703
|
className: "lilt-heatmap-card__column-label",
|
|
2599
|
-
"data-tier":
|
|
2704
|
+
"data-tier": on(t, L.columns.length),
|
|
2600
2705
|
"data-active": z?.column === e || void 0,
|
|
2601
2706
|
children: /* @__PURE__ */ Z("span", { children: e })
|
|
2602
2707
|
}, e))]
|
|
@@ -2627,7 +2732,7 @@ function an({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
2627
2732
|
}
|
|
2628
2733
|
//#endregion
|
|
2629
2734
|
//#region src/engine/scatter.ts
|
|
2630
|
-
function
|
|
2735
|
+
function cn(e, t, n, r, i = !1) {
|
|
2631
2736
|
if (!i) {
|
|
2632
2737
|
let r = null, i = Infinity;
|
|
2633
2738
|
for (let a of e) {
|
|
@@ -2647,7 +2752,7 @@ function on(e, t, n, r, i = !1) {
|
|
|
2647
2752
|
}
|
|
2648
2753
|
//#endregion
|
|
2649
2754
|
//#region src/use-chart-width.ts
|
|
2650
|
-
function
|
|
2755
|
+
function ln() {
|
|
2651
2756
|
let e = Te(null), [t, n] = X(0);
|
|
2652
2757
|
return Ce(() => {
|
|
2653
2758
|
let t = e.current;
|
|
@@ -2663,7 +2768,7 @@ function sn() {
|
|
|
2663
2768
|
}
|
|
2664
2769
|
//#endregion
|
|
2665
2770
|
//#region src/cards/scatter-chart-card.tsx
|
|
2666
|
-
var
|
|
2771
|
+
var un = [], dn = 260, fn = 4, pn = 4.5, mn = 3, hn = [
|
|
2667
2772
|
[
|
|
2668
2773
|
.08,
|
|
2669
2774
|
.72,
|
|
@@ -2725,17 +2830,17 @@ var cn = [], ln = 260, un = 4, dn = 4.5, fn = 3, pn = [
|
|
|
2725
2830
|
9
|
|
2726
2831
|
]
|
|
2727
2832
|
];
|
|
2728
|
-
function
|
|
2833
|
+
function gn(e, t = 5) {
|
|
2729
2834
|
if (!e.length) return [0, 1];
|
|
2730
2835
|
let n = Math.min(...e), r = Math.max(...e);
|
|
2731
2836
|
if (n >= 0 && n <= r * .25 && (n = 0), n === r) {
|
|
2732
2837
|
let e = Math.abs(n) || 1;
|
|
2733
2838
|
n -= e, r += e;
|
|
2734
2839
|
}
|
|
2735
|
-
let [i, a] =
|
|
2840
|
+
let [i, a] = ke().domain([n, r]).nice(t).domain();
|
|
2736
2841
|
return [i, a];
|
|
2737
2842
|
}
|
|
2738
|
-
function
|
|
2843
|
+
function _n(e) {
|
|
2739
2844
|
if (e.length < 3) return null;
|
|
2740
2845
|
let t = e.length, n = e.reduce((e, t) => e + t.x, 0) / t, r = e.reduce((e, t) => e + t.y, 0) / t, i = 0, a = 0, o = 0;
|
|
2741
2846
|
for (let { x: t, y: s } of e) i += (t - n) ** 2, a += (t - n) * (s - r), o += (s - r) ** 2;
|
|
@@ -2747,8 +2852,8 @@ function hn(e) {
|
|
|
2747
2852
|
r2: o === 0 ? 1 : a * a / (i * o)
|
|
2748
2853
|
};
|
|
2749
2854
|
}
|
|
2750
|
-
var
|
|
2751
|
-
function
|
|
2855
|
+
var vn = (e, t, n) => `${e} ${e === 1 ? t : n}`, yn = (e, t) => t === void 0 ? void 0 : e[t], bn = (e) => typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
2856
|
+
function xn(e, [t, n], [r, i]) {
|
|
2752
2857
|
let a = (t) => e.slope * t + e.intercept, o = t, s = n;
|
|
2753
2858
|
if (e.slope !== 0) {
|
|
2754
2859
|
let t = (r - e.intercept) / e.slope, n = (i - e.intercept) / e.slope;
|
|
@@ -2761,28 +2866,28 @@ function yn(e, [t, n], [r, i]) {
|
|
|
2761
2866
|
a(s)
|
|
2762
2867
|
];
|
|
2763
2868
|
}
|
|
2764
|
-
function
|
|
2765
|
-
let P =
|
|
2869
|
+
function Sn({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, label: s, xLabel: c, yLabel: l, trend: d = !1, height: f = dn, aggregate: p = "sum", headline: m, delta: h, deltaTone: g, range: _, ranges: v, defaultRange: y, valueFormat: b, xFormat: x, locale: S = "en-US", formatValue: C, formatX: w, color: T, surface: E = "elevated", badge: D, numberStyle: O, palette: te, loading: A = !1, motion: j = "auto", className: M, style: N }) {
|
|
2870
|
+
let P = ae(j), F = ne({
|
|
2766
2871
|
valueFormat: b,
|
|
2767
2872
|
locale: S,
|
|
2768
2873
|
formatValue: C
|
|
2769
|
-
}), I = JSON.stringify(x ?? null), L = we(() => R(S, x), [S, I]), z = w ?? L.full, [B, V] = X(y ?? v?.[0]?.id), H = v?.find((e) => e.id === B) ?? v?.[0], U = H?.data ?? t ??
|
|
2874
|
+
}), I = JSON.stringify(x ?? null), L = we(() => R(S, x), [S, I]), z = w ?? L.full, [B, V] = X(y ?? v?.[0]?.id), H = v?.find((e) => e.id === B) ?? v?.[0], U = H?.data ?? t ?? un, W = H ? H.delta : h, { ref: G, width: re } = ln(), ie = re || 480, K = we(() => {
|
|
2770
2875
|
let e = [], t = U.map((e) => {
|
|
2771
|
-
let t =
|
|
2876
|
+
let t = yn(e, s);
|
|
2772
2877
|
return typeof t == "string" && t ? t : null;
|
|
2773
2878
|
}), a = (e) => e !== null && t.indexOf(e) === t.lastIndexOf(e);
|
|
2774
2879
|
return {
|
|
2775
2880
|
rows: U.map((s, c) => {
|
|
2776
|
-
let l = o === void 0 ? null : String(
|
|
2881
|
+
let l = o === void 0 ? null : String(yn(s, o) ?? "");
|
|
2777
2882
|
l !== null && !e.includes(l) && e.push(l);
|
|
2778
2883
|
let u = t[c];
|
|
2779
2884
|
return {
|
|
2780
2885
|
id: a(u) ? u : `${u ?? ""}\u0000${c}`,
|
|
2781
2886
|
label: u ?? `Point ${c + 1}`,
|
|
2782
2887
|
row: s,
|
|
2783
|
-
x:
|
|
2784
|
-
y:
|
|
2785
|
-
size: i === void 0 ? 1 :
|
|
2888
|
+
x: bn(yn(s, n)),
|
|
2889
|
+
y: bn(yn(s, r)),
|
|
2890
|
+
size: i === void 0 ? 1 : bn(yn(s, i)),
|
|
2786
2891
|
group: l
|
|
2787
2892
|
};
|
|
2788
2893
|
}),
|
|
@@ -2795,20 +2900,30 @@ function bn({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
2795
2900
|
i,
|
|
2796
2901
|
o,
|
|
2797
2902
|
s
|
|
2798
|
-
]),
|
|
2903
|
+
]), q = K.rows.filter((e) => e.x !== null && e.y !== null), oe = K.rows.length - q.length, [se, J] = X([]), he = q.filter((e) => e.group === null || !se.includes(e.group)), ge = (e) => e === null ? "var(--lilt-scatter-card-color, var(--lilt-series-1))" : `var(--lilt-series-${K.groups.indexOf(e) % 6 + 1})`, _e = ie < 420 ? 3 : 5, ve = gn(q.map((e) => e.x), _e), ye = gn(q.map((e) => e.y), fn), be = ke().domain(ye).ticks(fn), Y = ke().domain(ve).ticks(_e), Se = Math.max(8, Math.min(16, ie / 36)), Ce = Math.max(24, ...be.map((e) => F.axis(e).length * 6.6 + 10)), Te = i === void 0 ? 6.5 : Se, Ee = (l ? 26 : 10) + Te, Oe = f - 26 - (c ? 16 : 0) - Te, $ = Ce + Te, Ae = ie - Te - 2, je = ke().domain(ve).range([$, Ae]), Me = ke().domain(ye).range([Oe, Ee]), Ne = Math.max(1, ...q.map((e) => e.size ?? 0)), Pe = (e) => i === void 0 ? pn : mn + (Se - mn) * Math.sqrt(Math.max(0, e ?? 0) / Ne), Fe = [...he].sort((e, t) => e.x - t.x || e.y - t.y).map((e, t) => ({
|
|
2799
2904
|
...e,
|
|
2800
2905
|
cx: je(e.x),
|
|
2801
2906
|
cy: Me(e.y),
|
|
2802
2907
|
radius: Pe(e.size),
|
|
2803
2908
|
color: ge(e.group),
|
|
2804
2909
|
order: t
|
|
2805
|
-
})), Ie = d ?
|
|
2910
|
+
})), Ie = d ? _n(he) : null, Le = Ie && Fe.length ? xn(Ie, [Fe[0].x, Fe.at(-1).x], ye) : null, Re = L.plain, [ze, Be] = X(null), [Ve, He] = X(null), [Ue, We] = X(null), [Ge, Ke] = X(null), [qe, Je] = X(null), Ye = (e) => Fe.find((t) => t.id === e), Xe = Ye(Ve) ?? Ye(Ue) ?? Ye(ze), Ze = Xe ? null : qe ?? Ge, Qe = K.groups.map((e) => ({
|
|
2806
2911
|
name: e,
|
|
2807
|
-
value: ee(
|
|
2808
|
-
})),
|
|
2809
|
-
let
|
|
2810
|
-
|
|
2811
|
-
},
|
|
2912
|
+
value: ee(q.filter((t) => t.group === e).map((e) => e.y), p)
|
|
2913
|
+
})), $e = H?.headline ?? m ?? ee(he.map((e) => e.y), p), et = Xe ? Xe.y : Ze === null ? $e : Qe.find((e) => e.name === Ze)?.value ?? null, tt = (e) => c ? `${c} ${z(e)}` : z(e), nt = (e) => `${e.label}: ${tt(e.x)}, ${l ? `${l} ` : ""}${F.value(e.y)}${i === void 0 || e.size === null ? "" : `, ${a ?? "size"} ${Re(e.size)}`}`, rt = (e, t, n) => {
|
|
2914
|
+
let r = n.getBoundingClientRect();
|
|
2915
|
+
return cn(Fe, e - r.left, t - r.top, Ve);
|
|
2916
|
+
}, it = (e) => {
|
|
2917
|
+
e.pointerType !== "touch" && Be(rt(e.clientX, e.clientY, e.currentTarget));
|
|
2918
|
+
}, at = lt({
|
|
2919
|
+
resolve: rt,
|
|
2920
|
+
onGlide: Be,
|
|
2921
|
+
onLift: (e) => e !== null && He(e),
|
|
2922
|
+
onTap: (e) => He((t) => e && t !== e ? e : null),
|
|
2923
|
+
disabled: A
|
|
2924
|
+
}), ot = xe((e) => {
|
|
2925
|
+
G.current = e, at(e);
|
|
2926
|
+
}, [at, G]), st = (e) => {
|
|
2812
2927
|
if (!Fe.length) return;
|
|
2813
2928
|
let t = Ye(Ue) ?? Ye(Ve), n = t ? t.order : -1, r = null;
|
|
2814
2929
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") r = n + 1;
|
|
@@ -2823,7 +2938,7 @@ function bn({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
2823
2938
|
return;
|
|
2824
2939
|
} else return;
|
|
2825
2940
|
e.preventDefault(), We(Fe[Math.max(0, Math.min(Fe.length - 1, r))].id);
|
|
2826
|
-
},
|
|
2941
|
+
}, ct = !A && K.rows.length === 0, ut = !A && K.rows.length > 0 && q.length === 0, dt = (e) => Xe && Math.abs(je(e) - Xe.cx) < 40, ft = (e) => Xe && Math.abs(Me(e) - Xe.cy) < 16;
|
|
2827
2942
|
return /* @__PURE__ */ Q(me, {
|
|
2828
2943
|
motion: j,
|
|
2829
2944
|
className: ["lilt-scatter-card", M].filter(Boolean).join(" "),
|
|
@@ -2846,53 +2961,54 @@ function bn({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
2846
2961
|
value: H?.id,
|
|
2847
2962
|
onValueChange: V
|
|
2848
2963
|
}) : null,
|
|
2849
|
-
children: [/* @__PURE__ */ Z(
|
|
2850
|
-
value: A ? null :
|
|
2964
|
+
children: [/* @__PURE__ */ Z(de, { children: e }), /* @__PURE__ */ Z(ue, {
|
|
2965
|
+
value: A ? null : et,
|
|
2851
2966
|
format: F.value,
|
|
2852
2967
|
loading: A,
|
|
2853
2968
|
motion: j,
|
|
2854
|
-
children: A ? null :
|
|
2855
|
-
|
|
2969
|
+
children: A ? null : Xe ? /* @__PURE__ */ Q(ce, { children: [
|
|
2970
|
+
Xe.label,
|
|
2856
2971
|
" · ",
|
|
2857
|
-
|
|
2858
|
-
] }) :
|
|
2972
|
+
tt(Xe.x)
|
|
2973
|
+
] }) : Ze === null ? W === void 0 ? null : /* @__PURE__ */ Z(le, {
|
|
2859
2974
|
value: W,
|
|
2860
2975
|
tone: g
|
|
2861
|
-
}) : /* @__PURE__ */ Z(
|
|
2976
|
+
}) : /* @__PURE__ */ Z(ce, { children: Ze })
|
|
2862
2977
|
})]
|
|
2863
|
-
}),
|
|
2978
|
+
}), ct || ut ? /* @__PURE__ */ Z(u, {
|
|
2864
2979
|
kind: "empty",
|
|
2865
|
-
message:
|
|
2980
|
+
message: ct ? "No points for this period." : "No point has both values, so none can be placed."
|
|
2866
2981
|
}) : /* @__PURE__ */ Q(De, { children: [
|
|
2867
2982
|
/* @__PURE__ */ Q("div", {
|
|
2868
|
-
ref:
|
|
2983
|
+
ref: ot,
|
|
2869
2984
|
className: "lilt-scatter-card__plot",
|
|
2985
|
+
"data-lilt-glide": "",
|
|
2870
2986
|
style: { height: f },
|
|
2871
2987
|
"data-lilt-pill": "soft",
|
|
2872
2988
|
"data-loading": A || void 0,
|
|
2873
2989
|
"data-motion": P ? "none" : void 0,
|
|
2874
|
-
"data-active":
|
|
2990
|
+
"data-active": Xe ? "" : void 0,
|
|
2875
2991
|
tabIndex: A ? void 0 : 0,
|
|
2876
2992
|
role: "group",
|
|
2877
|
-
"aria-label": `${e}: ${
|
|
2878
|
-
onPointerMove: A ? void 0 :
|
|
2993
|
+
"aria-label": `${e}: ${vn(Fe.length, "point", "points")}. Arrow keys step through them in order of ${c ?? "x"}; Enter pins one.`,
|
|
2994
|
+
onPointerMove: A ? void 0 : it,
|
|
2879
2995
|
onPointerLeave: () => Be(null),
|
|
2880
2996
|
onClick: () => He((e) => ze && e !== ze ? ze : null),
|
|
2881
|
-
onKeyDown: A ? void 0 :
|
|
2997
|
+
onKeyDown: A ? void 0 : st,
|
|
2882
2998
|
onBlur: () => We(null),
|
|
2883
2999
|
children: [
|
|
2884
3000
|
/* @__PURE__ */ Q("svg", {
|
|
2885
3001
|
"aria-hidden": "true",
|
|
2886
3002
|
className: "lilt-scatter-card__svg",
|
|
2887
|
-
width:
|
|
3003
|
+
width: ie,
|
|
2888
3004
|
height: f,
|
|
2889
|
-
viewBox: `0 0 ${
|
|
3005
|
+
viewBox: `0 0 ${ie} ${f}`,
|
|
2890
3006
|
children: [
|
|
2891
3007
|
/* @__PURE__ */ Z("g", {
|
|
2892
3008
|
className: "lilt-scatter-card__grid",
|
|
2893
|
-
children:
|
|
2894
|
-
x1:
|
|
2895
|
-
x2:
|
|
3009
|
+
children: be.map((e) => /* @__PURE__ */ Z("line", {
|
|
3010
|
+
x1: Ce,
|
|
3011
|
+
x2: ie,
|
|
2896
3012
|
y1: Me(e),
|
|
2897
3013
|
y2: Me(e)
|
|
2898
3014
|
}, e))
|
|
@@ -2900,21 +3016,21 @@ function bn({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
2900
3016
|
A ? null : /* @__PURE__ */ Q("g", {
|
|
2901
3017
|
className: "lilt-chart__axis",
|
|
2902
3018
|
children: [
|
|
2903
|
-
|
|
3019
|
+
be.map((e) => /* @__PURE__ */ Z("text", {
|
|
2904
3020
|
className: "lilt-chart__axis-label",
|
|
2905
|
-
x:
|
|
3021
|
+
x: Ce - 10,
|
|
2906
3022
|
y: Me(e),
|
|
2907
3023
|
dy: "0.35em",
|
|
2908
3024
|
textAnchor: "end",
|
|
2909
|
-
opacity: +!
|
|
3025
|
+
opacity: +!ft(e),
|
|
2910
3026
|
children: F.axis(e)
|
|
2911
3027
|
}, e)),
|
|
2912
|
-
|
|
3028
|
+
Y.map((e) => /* @__PURE__ */ Z("text", {
|
|
2913
3029
|
className: "lilt-chart__axis-label",
|
|
2914
3030
|
x: je(e),
|
|
2915
|
-
y:
|
|
3031
|
+
y: Oe + Te + 18,
|
|
2916
3032
|
textAnchor: "middle",
|
|
2917
|
-
opacity: +!
|
|
3033
|
+
opacity: +!dt(e),
|
|
2918
3034
|
children: L.compact(e)
|
|
2919
3035
|
}, e)),
|
|
2920
3036
|
l ? /* @__PURE__ */ Z("text", {
|
|
@@ -2925,21 +3041,21 @@ function bn({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
2925
3041
|
}) : null,
|
|
2926
3042
|
c ? /* @__PURE__ */ Z("text", {
|
|
2927
3043
|
className: "lilt-scatter-card__axis-title",
|
|
2928
|
-
x:
|
|
3044
|
+
x: Ae,
|
|
2929
3045
|
y: f - 2,
|
|
2930
3046
|
textAnchor: "end",
|
|
2931
3047
|
children: c
|
|
2932
3048
|
}) : null
|
|
2933
3049
|
]
|
|
2934
3050
|
}),
|
|
2935
|
-
A ? /* @__PURE__ */ Z(
|
|
2936
|
-
width:
|
|
3051
|
+
A ? /* @__PURE__ */ Z(_t, {
|
|
3052
|
+
width: ie,
|
|
2937
3053
|
height: f,
|
|
2938
3054
|
reduced: P,
|
|
2939
|
-
children:
|
|
3055
|
+
children: hn.map(([e, t, n], r) => /* @__PURE__ */ Z("circle", {
|
|
2940
3056
|
className: "lilt-scatter-card__skeleton",
|
|
2941
|
-
cx:
|
|
2942
|
-
cy:
|
|
3057
|
+
cx: $ + (Ae - $) * e,
|
|
3058
|
+
cy: Ee + (Oe - Ee) * t,
|
|
2943
3059
|
r: i === void 0 ? 5.5 : n
|
|
2944
3060
|
}, r))
|
|
2945
3061
|
}) : /* @__PURE__ */ Q(De, { children: [
|
|
@@ -2950,26 +3066,26 @@ function bn({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
2950
3066
|
x2: je(Le[2]),
|
|
2951
3067
|
y2: Me(Le[3])
|
|
2952
3068
|
}) : null,
|
|
2953
|
-
|
|
3069
|
+
Xe ? /* @__PURE__ */ Q("g", {
|
|
2954
3070
|
className: "lilt-scatter-card__guides",
|
|
2955
3071
|
children: [/* @__PURE__ */ Z("line", {
|
|
2956
|
-
x1:
|
|
2957
|
-
x2:
|
|
2958
|
-
y1:
|
|
2959
|
-
y2:
|
|
3072
|
+
x1: Xe.cx,
|
|
3073
|
+
x2: Xe.cx,
|
|
3074
|
+
y1: Xe.cy,
|
|
3075
|
+
y2: Oe + Te
|
|
2960
3076
|
}), /* @__PURE__ */ Z("line", {
|
|
2961
|
-
x1:
|
|
2962
|
-
x2:
|
|
2963
|
-
y1:
|
|
2964
|
-
y2:
|
|
3077
|
+
x1: Ce,
|
|
3078
|
+
x2: Xe.cx,
|
|
3079
|
+
y1: Xe.cy,
|
|
3080
|
+
y2: Xe.cy
|
|
2965
3081
|
})]
|
|
2966
3082
|
}) : null,
|
|
2967
3083
|
Fe.map((e) => {
|
|
2968
|
-
let t =
|
|
3084
|
+
let t = Xe && e.id !== Xe.id || Ze !== null && e.group !== Ze;
|
|
2969
3085
|
return /* @__PURE__ */ Z("g", {
|
|
2970
3086
|
className: "lilt-scatter-card__point",
|
|
2971
3087
|
"data-point": e.label,
|
|
2972
|
-
"data-active": e.id ===
|
|
3088
|
+
"data-active": e.id === Xe?.id || void 0,
|
|
2973
3089
|
"data-muted": t || void 0,
|
|
2974
3090
|
style: {
|
|
2975
3091
|
transform: `translate(${e.cx}px, ${e.cy}px)`,
|
|
@@ -2987,51 +3103,51 @@ function bn({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
2987
3103
|
] })
|
|
2988
3104
|
]
|
|
2989
3105
|
}),
|
|
2990
|
-
|
|
3106
|
+
Xe ? /* @__PURE__ */ Q(De, { children: [/* @__PURE__ */ Z("div", {
|
|
2991
3107
|
className: "lilt-chart__x-badge lilt-scatter-card__pill",
|
|
2992
3108
|
style: {
|
|
2993
|
-
left:
|
|
2994
|
-
top:
|
|
3109
|
+
left: Xe.cx,
|
|
3110
|
+
top: Oe + Te + 6,
|
|
2995
3111
|
transform: "translateX(-50%)"
|
|
2996
3112
|
},
|
|
2997
|
-
children: z(
|
|
3113
|
+
children: z(Xe.x)
|
|
2998
3114
|
}), /* @__PURE__ */ Z("div", {
|
|
2999
3115
|
className: "lilt-chart__y-badge lilt-scatter-card__pill",
|
|
3000
3116
|
style: {
|
|
3001
|
-
right:
|
|
3002
|
-
top:
|
|
3117
|
+
right: ie - Ce + 4,
|
|
3118
|
+
top: Xe.cy,
|
|
3003
3119
|
transform: "translateY(-50%)"
|
|
3004
3120
|
},
|
|
3005
|
-
children: F.axis(
|
|
3121
|
+
children: F.axis(Xe.y)
|
|
3006
3122
|
})] }) : null,
|
|
3007
3123
|
/* @__PURE__ */ Z("p", {
|
|
3008
3124
|
className: "lilt-chart__sr-only",
|
|
3009
3125
|
"aria-live": "polite",
|
|
3010
|
-
children:
|
|
3126
|
+
children: Xe ? nt(Xe) : ""
|
|
3011
3127
|
})
|
|
3012
3128
|
]
|
|
3013
3129
|
}),
|
|
3014
|
-
o !== void 0 &&
|
|
3130
|
+
o !== void 0 && K.groups.length ? /* @__PURE__ */ Z(k, {
|
|
3015
3131
|
className: "lilt-card__tiles",
|
|
3016
3132
|
"aria-label": `${e} by group`,
|
|
3017
|
-
items:
|
|
3133
|
+
items: Qe.map((e) => ({
|
|
3018
3134
|
id: e.name,
|
|
3019
3135
|
label: e.name,
|
|
3020
3136
|
color: ge(e.name),
|
|
3021
3137
|
value: e.value,
|
|
3022
3138
|
formattedValue: e.value === null ? "No data" : F.value(e.value)
|
|
3023
3139
|
})),
|
|
3024
|
-
activeId:
|
|
3140
|
+
activeId: Ze,
|
|
3025
3141
|
onHoverIdChange: Ke,
|
|
3026
|
-
hiddenIds:
|
|
3142
|
+
hiddenIds: se,
|
|
3027
3143
|
onHiddenIdsChange: (e) => {
|
|
3028
|
-
|
|
3144
|
+
J(e), Ke(null), Je(null);
|
|
3029
3145
|
},
|
|
3030
3146
|
renderValue: A ? () => /* @__PURE__ */ Z("span", { className: "lilt-card__skeleton lilt-card__skeleton--tile" }) : void 0
|
|
3031
3147
|
}) : null,
|
|
3032
|
-
!A && (Ie ||
|
|
3148
|
+
!A && (Ie || oe) ? /* @__PURE__ */ Q("div", {
|
|
3033
3149
|
className: "lilt-scatter-card__footer",
|
|
3034
|
-
children: [
|
|
3150
|
+
children: [oe ? /* @__PURE__ */ Q("span", { children: [vn(oe, "point is", "points are"), " missing a value and not plotted"] }) : null, Ie ? /* @__PURE__ */ Q("span", {
|
|
3035
3151
|
className: "lilt-scatter-card__fit",
|
|
3036
3152
|
children: [
|
|
3037
3153
|
/* @__PURE__ */ Z("span", {
|
|
@@ -3069,7 +3185,7 @@ function bn({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3069
3185
|
children: a ?? i
|
|
3070
3186
|
})
|
|
3071
3187
|
] }) }),
|
|
3072
|
-
/* @__PURE__ */ Z("tbody", { children:
|
|
3188
|
+
/* @__PURE__ */ Z("tbody", { children: K.rows.map((e) => /* @__PURE__ */ Q("tr", { children: [
|
|
3073
3189
|
/* @__PURE__ */ Z("th", {
|
|
3074
3190
|
scope: "row",
|
|
3075
3191
|
children: e.label
|
|
@@ -3086,7 +3202,7 @@ function bn({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3086
3202
|
}
|
|
3087
3203
|
//#endregion
|
|
3088
3204
|
//#region src/engine/sankey.ts
|
|
3089
|
-
function
|
|
3205
|
+
function Cn(e, t, n) {
|
|
3090
3206
|
let r = /* @__PURE__ */ new Set();
|
|
3091
3207
|
for (let t of e) {
|
|
3092
3208
|
if (!t.id || !t.label || r.has(t.id)) throw Error("Lilt SankeyChart requires unique nonempty node IDs and labels.");
|
|
@@ -3128,7 +3244,7 @@ function xn(e, t, n) {
|
|
|
3128
3244
|
losses: d
|
|
3129
3245
|
};
|
|
3130
3246
|
}
|
|
3131
|
-
function
|
|
3247
|
+
function wn(e, t, n, r = !1) {
|
|
3132
3248
|
if (!e.nodes.length) return {
|
|
3133
3249
|
nodes: [],
|
|
3134
3250
|
links: []
|
|
@@ -3175,7 +3291,7 @@ function Sn(e, t, n, r = !1) {
|
|
|
3175
3291
|
}
|
|
3176
3292
|
//#endregion
|
|
3177
3293
|
//#region src/cards/sankey-chart-card.tsx
|
|
3178
|
-
var
|
|
3294
|
+
var Tn = [], En = 280, Dn = 460, On = [
|
|
3179
3295
|
[
|
|
3180
3296
|
.02,
|
|
3181
3297
|
.32,
|
|
@@ -3211,14 +3327,14 @@ var Cn = [], wn = 280, Tn = 460, En = [
|
|
|
3211
3327
|
.8,
|
|
3212
3328
|
.12
|
|
3213
3329
|
]
|
|
3214
|
-
],
|
|
3215
|
-
function
|
|
3330
|
+
], kn = (e, t) => e[t];
|
|
3331
|
+
function An(e) {
|
|
3216
3332
|
return e.includes("acyclic") ? "The flows loop back on themselves; a Sankey needs every flow to move forward." : e.includes("does not conserve") ? `${e.match(/node "([^"]+)"/)?.[1] ?? "A step"} passes on a different amount than it receives; use conservation="loss" if some flow leaves there.` : e.includes("creates flow") ? `${e.match(/node "([^"]+)"/)?.[1] ?? "A step"} passes on more than it receives.` : e.includes("distinct known source and target") ? "A flow starts and ends at the same step." : e.includes("non-negative") ? "Flow values must be zero or more." : e;
|
|
3217
3333
|
}
|
|
3218
|
-
function
|
|
3334
|
+
function jn({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
3219
3335
|
let a = [], o = /* @__PURE__ */ new Set(), s = [], c = /* @__PURE__ */ new Set();
|
|
3220
3336
|
for (let i of e) {
|
|
3221
|
-
let e = String(
|
|
3337
|
+
let e = String(kn(i, t) ?? "").trim(), l = String(kn(i, n) ?? "").trim();
|
|
3222
3338
|
if (!e || !l) return {
|
|
3223
3339
|
graph: null,
|
|
3224
3340
|
error: "Every flow needs a source and a target."
|
|
@@ -3233,7 +3349,7 @@ function kn({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
|
3233
3349
|
error: `${u} appears twice; combine it into one row.`
|
|
3234
3350
|
};
|
|
3235
3351
|
c.add(u);
|
|
3236
|
-
let d =
|
|
3352
|
+
let d = kn(i, r);
|
|
3237
3353
|
s.push({
|
|
3238
3354
|
id: u,
|
|
3239
3355
|
source: e,
|
|
@@ -3244,23 +3360,23 @@ function kn({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
|
3244
3360
|
}
|
|
3245
3361
|
try {
|
|
3246
3362
|
return {
|
|
3247
|
-
graph:
|
|
3363
|
+
graph: Cn(a, s, i === "strict" ? "strict" : "allow-loss"),
|
|
3248
3364
|
error: null
|
|
3249
3365
|
};
|
|
3250
3366
|
} catch (e) {
|
|
3251
3367
|
return {
|
|
3252
3368
|
graph: null,
|
|
3253
|
-
error:
|
|
3369
|
+
error: An(e instanceof Error ? e.message : "Invalid flows.")
|
|
3254
3370
|
};
|
|
3255
3371
|
}
|
|
3256
3372
|
}
|
|
3257
|
-
var
|
|
3258
|
-
function
|
|
3259
|
-
let T =
|
|
3373
|
+
var Mn = (e, t, n) => `${e} ${e === 1 ? t : n}`, Nn = (e, t) => t > 0 ? `${Math.round(e / t * 100)}%` : "—";
|
|
3374
|
+
function Pn({ title: e, data: t, source: n, target: r, value: i, conservation: a = "loss", height: o = En, headline: s, delta: c, deltaTone: l, range: d, ranges: f, defaultRange: p, valueFormat: m, locale: h, formatValue: g, surface: _ = "elevated", badge: v, numberStyle: y, palette: b, loading: x = !1, motion: S = "auto", className: C, style: w }) {
|
|
3375
|
+
let T = ae(S), ee = ne({
|
|
3260
3376
|
valueFormat: m,
|
|
3261
3377
|
locale: h,
|
|
3262
3378
|
formatValue: g
|
|
3263
|
-
}), [E, D] = X(p ?? f?.[0]?.id), O = f?.find((e) => e.id === E) ?? f?.[0], k = O?.data ?? t ??
|
|
3379
|
+
}), [E, D] = X(p ?? f?.[0]?.id), O = f?.find((e) => e.id === E) ?? f?.[0], k = O?.data ?? t ?? Tn, te = O ? O.delta : c, { ref: A, width: j } = ln(), M = j || 520, N = M < Dn, P = `lilt-sankey-card-${Se().replace(/:/g, "")}`, F = we(() => jn({
|
|
3264
3380
|
data: k,
|
|
3265
3381
|
source: n,
|
|
3266
3382
|
target: r,
|
|
@@ -3272,7 +3388,7 @@ function Mn({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
3272
3388
|
r,
|
|
3273
3389
|
i,
|
|
3274
3390
|
a
|
|
3275
|
-
]), I = F.graph, L = we(() => I ?
|
|
3391
|
+
]), I = F.graph, L = we(() => I ? wn(I, M, o, N) : {
|
|
3276
3392
|
nodes: [],
|
|
3277
3393
|
links: []
|
|
3278
3394
|
}, [
|
|
@@ -3283,36 +3399,43 @@ function Mn({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
3283
3399
|
]), R = new Map(I?.nodes.map((e, t) => [e.id, t]) ?? []), z = (e) => `var(--lilt-series-${(R.get(e) ?? 0) % 6 + 1})`, B = Math.max(0, ...L.nodes.map((e) => e.depth)), V = (e) => I?.links.filter((t) => t.target === e && t.value !== null).reduce((e, t) => e + t.value, 0) ?? 0, H = (e) => I?.links.filter((t) => t.source === e && t.value !== null).reduce((e, t) => e + t.value, 0) ?? 0, U = (e) => I?.links.some((t) => (t.source === e || t.target === e) && t.value !== null) ? Math.max(V(e), H(e)) : null, W = (e) => {
|
|
3284
3400
|
let t = U(e);
|
|
3285
3401
|
return t === null ? "—" : ee.value(t);
|
|
3286
|
-
}, G = L.nodes.filter((e) => e.depth === 0).reduce((e, t) => e + H(t.id), 0) || 0, re = I?.links.filter((e) => e.value === null).length ?? 0,
|
|
3402
|
+
}, G = L.nodes.filter((e) => e.depth === 0).reduce((e, t) => e + H(t.id), 0) || 0, re = I?.links.filter((e) => e.value === null).length ?? 0, ie = L.nodes.filter((e) => e.depth === 0).length, K = [...L.links].sort((e, t) => (L.nodes.find((t) => t.id === e.source)?.depth ?? 0) - (L.nodes.find((e) => e.id === t.source)?.depth ?? 0) || e.sourceY - t.sourceY), [q, oe] = X(null), [se, J] = X(null), [ge, _e] = X(null), ve = se ?? ge ?? q, ye = lt({
|
|
3403
|
+
resolve: ct,
|
|
3404
|
+
onGlide: oe,
|
|
3405
|
+
onLift: (e) => e !== null && J(e),
|
|
3406
|
+
disabled: x
|
|
3407
|
+
}), be = xe((e) => {
|
|
3408
|
+
A.current = e, ye(e);
|
|
3409
|
+
}, [ye, A]), Y = L.links.find((e) => e.id === ve), Ce = Y ? void 0 : L.nodes.find((e) => e.id === ve), Te = (e) => Y ? e.id === Y.id : !Ce || e.source === Ce.id || e.target === Ce.id, Ee = he({
|
|
3287
3410
|
key: O?.id ?? 0,
|
|
3288
3411
|
active: !x,
|
|
3289
3412
|
duration: 720
|
|
3290
|
-
}, T),
|
|
3291
|
-
if (Y)
|
|
3292
|
-
else if (
|
|
3293
|
-
let e = U(
|
|
3294
|
-
|
|
3295
|
-
let n =
|
|
3296
|
-
|
|
3413
|
+
}, T), Oe = O?.headline ?? s ?? G, $ = null;
|
|
3414
|
+
if (Y) Oe = Y.value, $ = `${Y.source} → ${Y.target} · ${Nn(Y.value, U(Y.source) ?? 0)} of ${Y.source}`;
|
|
3415
|
+
else if (Ce) {
|
|
3416
|
+
let e = U(Ce.id), t = I?.losses[Ce.id];
|
|
3417
|
+
Oe = e;
|
|
3418
|
+
let n = Ce.depth === 0 && ie === 1;
|
|
3419
|
+
$ = e === null ? `${Ce.label} · Not measured` : n || !G ? Ce.label : `${Ce.label} · ${Nn(e, G)} of all`, t && ($ += ` · ${ee.value(t)} left here`);
|
|
3297
3420
|
}
|
|
3298
|
-
let
|
|
3299
|
-
if (!
|
|
3300
|
-
let t =
|
|
3421
|
+
let ke = () => Y ? `${Y.source} to ${Y.target}: ${ee.value(Y.value)}` : Ce ? `${Ce.label}: ${W(Ce.id)}` : "", Ae = (e) => {
|
|
3422
|
+
if (!K.length) return;
|
|
3423
|
+
let t = K.findIndex((e) => e.id === (ge ?? se)), n = null;
|
|
3301
3424
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") n = t + 1;
|
|
3302
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") n = t < 0 ?
|
|
3425
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") n = t < 0 ? K.length - 1 : t - 1;
|
|
3303
3426
|
else if (e.key === "Home") n = 0;
|
|
3304
|
-
else if (e.key === "End") n =
|
|
3427
|
+
else if (e.key === "End") n = K.length - 1;
|
|
3305
3428
|
else if ((e.key === "Enter" || e.key === " ") && t >= 0) {
|
|
3306
3429
|
e.preventDefault();
|
|
3307
|
-
let n =
|
|
3308
|
-
|
|
3430
|
+
let n = K[t].id;
|
|
3431
|
+
J((e) => e === n ? null : n);
|
|
3309
3432
|
return;
|
|
3310
3433
|
} else if (e.key === "Escape") {
|
|
3311
|
-
|
|
3434
|
+
J(null), _e(null);
|
|
3312
3435
|
return;
|
|
3313
3436
|
} else return;
|
|
3314
|
-
e.preventDefault(), _e(
|
|
3315
|
-
},
|
|
3437
|
+
e.preventDefault(), _e(K[Math.max(0, Math.min(K.length - 1, n))].id);
|
|
3438
|
+
}, je = (e) => N ? e === B ? "end" : "start" : e === 0 ? "end" : "start", Me = !x && !F.error && k.length === 0;
|
|
3316
3439
|
return /* @__PURE__ */ Q(me, {
|
|
3317
3440
|
motion: S,
|
|
3318
3441
|
className: ["lilt-sankey-card", C].filter(Boolean).join(" "),
|
|
@@ -3332,36 +3455,37 @@ function Mn({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
3332
3455
|
value: O?.id,
|
|
3333
3456
|
onValueChange: D
|
|
3334
3457
|
}) : null,
|
|
3335
|
-
children: [/* @__PURE__ */ Z(
|
|
3336
|
-
value: x ? null :
|
|
3458
|
+
children: [/* @__PURE__ */ Z(de, { children: e }), /* @__PURE__ */ Z(ue, {
|
|
3459
|
+
value: x ? null : Oe,
|
|
3337
3460
|
format: ee.value,
|
|
3338
3461
|
loading: x,
|
|
3339
3462
|
motion: S,
|
|
3340
|
-
children: x ? null :
|
|
3463
|
+
children: x ? null : $ ? /* @__PURE__ */ Z(ce, { children: $ }) : te === void 0 ? null : /* @__PURE__ */ Z(le, {
|
|
3341
3464
|
value: te,
|
|
3342
3465
|
tone: l
|
|
3343
3466
|
})
|
|
3344
3467
|
})]
|
|
3345
|
-
}), F.error ||
|
|
3468
|
+
}), F.error || Me ? /* @__PURE__ */ Z(u, {
|
|
3346
3469
|
kind: F.error ? "error" : "empty",
|
|
3347
3470
|
message: F.error ?? "No flows for this period."
|
|
3348
3471
|
}) : /* @__PURE__ */ Q(De, { children: [
|
|
3349
3472
|
/* @__PURE__ */ Q("div", {
|
|
3350
|
-
ref:
|
|
3473
|
+
ref: be,
|
|
3351
3474
|
className: "lilt-sankey-card__plot",
|
|
3475
|
+
"data-lilt-glide": "",
|
|
3352
3476
|
style: { height: o },
|
|
3353
3477
|
"data-loading": x || void 0,
|
|
3354
3478
|
"data-motion": T ? "none" : void 0,
|
|
3355
3479
|
"data-active": ve ? "" : void 0,
|
|
3356
3480
|
tabIndex: x ? void 0 : 0,
|
|
3357
3481
|
role: "group",
|
|
3358
|
-
"aria-label": `${e}: ${
|
|
3359
|
-
onKeyDown: x ? void 0 :
|
|
3482
|
+
"aria-label": `${e}: ${Mn(L.links.length, "flow", "flows")} between ${Mn(L.nodes.length, "step", "steps")}. Arrow keys step through the flows; Enter pins one.`,
|
|
3483
|
+
onKeyDown: x ? void 0 : Ae,
|
|
3360
3484
|
onBlur: () => _e(null),
|
|
3361
|
-
onPointerLeave: () =>
|
|
3485
|
+
onPointerLeave: () => oe(null),
|
|
3362
3486
|
onClick: (e) => {
|
|
3363
3487
|
let t = e.target;
|
|
3364
|
-
(t === e.currentTarget || t.tagName === "svg") &&
|
|
3488
|
+
(t === e.currentTarget || t.tagName === "svg") && J(null);
|
|
3365
3489
|
},
|
|
3366
3490
|
children: [/* @__PURE__ */ Z("svg", {
|
|
3367
3491
|
"aria-hidden": "true",
|
|
@@ -3369,11 +3493,11 @@ function Mn({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
3369
3493
|
width: M,
|
|
3370
3494
|
height: o,
|
|
3371
3495
|
viewBox: `0 0 ${M} ${o}`,
|
|
3372
|
-
children: x ? /* @__PURE__ */ Z(
|
|
3496
|
+
children: x ? /* @__PURE__ */ Z(_t, {
|
|
3373
3497
|
width: M,
|
|
3374
3498
|
height: o,
|
|
3375
3499
|
reduced: T,
|
|
3376
|
-
children:
|
|
3500
|
+
children: On.map(([e, t, n, r, i], a) => {
|
|
3377
3501
|
let s = (e + n) / 2 * M;
|
|
3378
3502
|
return /* @__PURE__ */ Z("path", {
|
|
3379
3503
|
className: "lilt-sankey-card__skeleton",
|
|
@@ -3387,7 +3511,7 @@ function Mn({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
3387
3511
|
children: /* @__PURE__ */ Z("rect", {
|
|
3388
3512
|
x: 0,
|
|
3389
3513
|
y: 0,
|
|
3390
|
-
width: M *
|
|
3514
|
+
width: M * Ee,
|
|
3391
3515
|
height: o
|
|
3392
3516
|
})
|
|
3393
3517
|
}) }),
|
|
@@ -3396,35 +3520,37 @@ function Mn({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
3396
3520
|
children: L.links.map((e) => /* @__PURE__ */ Z("path", {
|
|
3397
3521
|
className: "lilt-sankey-card__flow",
|
|
3398
3522
|
"data-flow": e.id,
|
|
3523
|
+
"data-glide-id": e.id,
|
|
3399
3524
|
"data-active": e.id === Y?.id || void 0,
|
|
3400
|
-
"data-muted": ve && !
|
|
3525
|
+
"data-muted": ve && !Te(e) || void 0,
|
|
3401
3526
|
d: e.path,
|
|
3402
3527
|
strokeWidth: e.width,
|
|
3403
3528
|
style: { stroke: z(e.source) },
|
|
3404
|
-
onPointerEnter: () =>
|
|
3529
|
+
onPointerEnter: () => oe(e.id),
|
|
3405
3530
|
onClick: (t) => {
|
|
3406
|
-
t.stopPropagation(),
|
|
3531
|
+
t.stopPropagation(), J((t) => t === e.id ? null : e.id);
|
|
3407
3532
|
}
|
|
3408
3533
|
}, e.id))
|
|
3409
3534
|
}),
|
|
3410
3535
|
L.nodes.map((e) => /* @__PURE__ */ Z("rect", {
|
|
3411
3536
|
className: "lilt-sankey-card__node",
|
|
3412
3537
|
"data-node": e.id,
|
|
3413
|
-
"data-
|
|
3538
|
+
"data-glide-id": e.id,
|
|
3539
|
+
"data-muted": ve && e.id !== Ce?.id && e.id !== Y?.source && e.id !== Y?.target || void 0,
|
|
3414
3540
|
x: e.x,
|
|
3415
3541
|
y: e.y,
|
|
3416
3542
|
width: e.width,
|
|
3417
3543
|
height: Math.max(2, e.height),
|
|
3418
3544
|
rx: 3,
|
|
3419
3545
|
style: { fill: z(e.id) },
|
|
3420
|
-
onPointerEnter: () =>
|
|
3421
|
-
onClick: () =>
|
|
3546
|
+
onPointerEnter: () => oe(e.id),
|
|
3547
|
+
onClick: () => J((t) => t === e.id ? null : e.id)
|
|
3422
3548
|
}, e.id)),
|
|
3423
3549
|
L.nodes.map((e) => {
|
|
3424
|
-
let t =
|
|
3550
|
+
let t = je(e.depth), n = t === "end" ? e.x - 8 : e.x + e.width + 8, r = e.y + e.height / 2;
|
|
3425
3551
|
return /* @__PURE__ */ Q("text", {
|
|
3426
3552
|
className: "lilt-sankey-card__label",
|
|
3427
|
-
"data-muted": ve && e.id !==
|
|
3553
|
+
"data-muted": ve && e.id !== Ce?.id && e.id !== Y?.source && e.id !== Y?.target || void 0,
|
|
3428
3554
|
x: n,
|
|
3429
3555
|
y: r,
|
|
3430
3556
|
textAnchor: t,
|
|
@@ -3444,13 +3570,13 @@ function Mn({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
3444
3570
|
}), /* @__PURE__ */ Z("p", {
|
|
3445
3571
|
className: "lilt-chart__sr-only",
|
|
3446
3572
|
"aria-live": "polite",
|
|
3447
|
-
children:
|
|
3573
|
+
children: ke()
|
|
3448
3574
|
})]
|
|
3449
3575
|
}),
|
|
3450
3576
|
!x && re ? /* @__PURE__ */ Q("p", {
|
|
3451
3577
|
className: "lilt-sankey-card__footer",
|
|
3452
3578
|
children: [
|
|
3453
|
-
|
|
3579
|
+
Mn(re, "flow isn’t", "flows aren’t"),
|
|
3454
3580
|
" measured yet and",
|
|
3455
3581
|
" ",
|
|
3456
3582
|
re === 1 ? "isn’t" : "aren’t",
|
|
@@ -3490,34 +3616,34 @@ function Mn({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
3490
3616
|
}
|
|
3491
3617
|
//#endregion
|
|
3492
3618
|
//#region src/cards/radar-chart-card.tsx
|
|
3493
|
-
var
|
|
3494
|
-
function
|
|
3495
|
-
if (e.length *
|
|
3619
|
+
var Fn = [], In = 300, Ln = 4, Rn = 6.6;
|
|
3620
|
+
function zn(e, t) {
|
|
3621
|
+
if (e.length * Rn <= t || !e.includes(" ")) return [e];
|
|
3496
3622
|
let n = e.length / 2, r = -1;
|
|
3497
3623
|
for (let t = 0; t < e.length; t++) e[t] === " " && (r < 0 || Math.abs(t - n) < Math.abs(r - n)) && (r = t);
|
|
3498
3624
|
return [e.slice(0, r), e.slice(r + 1)];
|
|
3499
3625
|
}
|
|
3500
|
-
var
|
|
3626
|
+
var Bn = [
|
|
3501
3627
|
.72,
|
|
3502
3628
|
.58,
|
|
3503
3629
|
.84,
|
|
3504
3630
|
.5,
|
|
3505
3631
|
.66,
|
|
3506
3632
|
.78
|
|
3507
|
-
],
|
|
3508
|
-
function
|
|
3633
|
+
], Vn = (e, t) => e[t], Hn = (e) => typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
3634
|
+
function Un({ data: e, category: t, series: n, domain: r }) {
|
|
3509
3635
|
let i = (e) => ({
|
|
3510
3636
|
dimensions: [],
|
|
3511
3637
|
domain: [0, 1],
|
|
3512
3638
|
error: e
|
|
3513
3639
|
}), a = [], o = /* @__PURE__ */ new Set();
|
|
3514
3640
|
for (let r of e) {
|
|
3515
|
-
let e = String(
|
|
3641
|
+
let e = String(Vn(r, t) ?? "").trim();
|
|
3516
3642
|
if (!e) return i("Every dimension needs a name.");
|
|
3517
3643
|
if (o.has(e)) return i(`“${e}” appears twice; each dimension needs one row.`);
|
|
3518
3644
|
o.add(e), a.push({
|
|
3519
3645
|
name: e,
|
|
3520
|
-
values: n.map((e) =>
|
|
3646
|
+
values: n.map((e) => Hn(Vn(r, e)))
|
|
3521
3647
|
});
|
|
3522
3648
|
}
|
|
3523
3649
|
if (a.length && a.length < 3) return i("A radar needs at least three dimensions to draw a shape.");
|
|
@@ -3528,30 +3654,30 @@ function Vn({ data: e, category: t, series: n, domain: r }) {
|
|
|
3528
3654
|
domain: r,
|
|
3529
3655
|
error: null
|
|
3530
3656
|
} : i("`domain` needs a low end below its high end.");
|
|
3531
|
-
let c = Math.min(0, ...s), l = Math.max(c + 1, ...s), [u, d] =
|
|
3657
|
+
let c = Math.min(0, ...s), l = Math.max(c + 1, ...s), [u, d] = ke().domain([c, l]).nice(Ln).domain();
|
|
3532
3658
|
return {
|
|
3533
3659
|
dimensions: a,
|
|
3534
3660
|
domain: [u, d],
|
|
3535
3661
|
error: null
|
|
3536
3662
|
};
|
|
3537
3663
|
}
|
|
3538
|
-
var
|
|
3539
|
-
function
|
|
3664
|
+
var Wn = (e) => Math.round(e * 100) / 100 || 0;
|
|
3665
|
+
function Gn(e, t, n, r) {
|
|
3540
3666
|
let i = e / t * Math.PI * 2;
|
|
3541
3667
|
return {
|
|
3542
|
-
x:
|
|
3543
|
-
y:
|
|
3668
|
+
x: Wn(Math.sin(i) * r * n),
|
|
3669
|
+
y: Wn(-Math.cos(i) * r * n)
|
|
3544
3670
|
};
|
|
3545
3671
|
}
|
|
3546
|
-
function
|
|
3672
|
+
function Kn(e, t) {
|
|
3547
3673
|
let n = e.length, r = e.every((e) => e !== null), i = "";
|
|
3548
3674
|
if (e.forEach((r, a) => {
|
|
3549
3675
|
if (r === null) return;
|
|
3550
|
-
let { x: o, y: s } =
|
|
3676
|
+
let { x: o, y: s } = Gn(a, n, r, t), c = e[(a - 1 + n) % n];
|
|
3551
3677
|
i += `${i && c !== null ? "L" : "M"}${o.toFixed(2)},${s.toFixed(2)} `;
|
|
3552
3678
|
}), r) i += "Z";
|
|
3553
3679
|
else if (e[0] !== null && e[n - 1] !== null) {
|
|
3554
|
-
let { x: r, y: a } =
|
|
3680
|
+
let { x: r, y: a } = Gn(0, n, e[0], t);
|
|
3555
3681
|
i += `L${r.toFixed(2)},${a.toFixed(2)}`;
|
|
3556
3682
|
}
|
|
3557
3683
|
return {
|
|
@@ -3559,12 +3685,12 @@ function Wn(e, t) {
|
|
|
3559
3685
|
complete: r
|
|
3560
3686
|
};
|
|
3561
3687
|
}
|
|
3562
|
-
function
|
|
3563
|
-
let E =
|
|
3688
|
+
function qn({ title: e, data: t, category: n, series: r, domain: i, aggregate: a = "mean", grid: o = "polygon", height: s = In, headline: c, delta: l, deltaTone: d, range: f, ranges: p, defaultRange: m, valueFormat: h, locale: g, formatValue: _, surface: v = "elevated", badge: y, numberStyle: b, palette: x, loading: S = !1, motion: C = "auto", className: w, style: T }) {
|
|
3689
|
+
let E = ae(C), D = ne({
|
|
3564
3690
|
valueFormat: h,
|
|
3565
3691
|
locale: g,
|
|
3566
3692
|
formatValue: _
|
|
3567
|
-
}), [O, te] = X(m ?? p?.[0]?.id), A = p?.find((e) => e.id === O) ?? p?.[0], j = A?.data ?? t ??
|
|
3693
|
+
}), [O, te] = X(m ?? p?.[0]?.id), A = p?.find((e) => e.id === O) ?? p?.[0], j = A?.data ?? t ?? Fn, M = A ? A.delta : l, { ref: N, width: P } = ln(), F = P || 480, I = r.map((e) => e.key), L = I.join("\0"), R = we(() => Un({
|
|
3568
3694
|
data: j,
|
|
3569
3695
|
category: n,
|
|
3570
3696
|
series: I,
|
|
@@ -3574,41 +3700,48 @@ function Gn({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
3574
3700
|
n,
|
|
3575
3701
|
L,
|
|
3576
3702
|
i
|
|
3577
|
-
]), { dimensions: z, domain: B } = R, V = z.length, H = B[1] - B[0], U = (e) => e === null ? null : (e - B[0]) / H, W = (e) => r[e]?.color ?? `var(--lilt-series-${e % 6 + 1})`, G = (e) => r[e]?.label ?? I[e], re = Math.max(0, r.findIndex((e) => !e.dashed)),
|
|
3703
|
+
]), { dimensions: z, domain: B } = R, V = z.length, H = B[1] - B[0], U = (e) => e === null ? null : (e - B[0]) / H, W = (e) => r[e]?.color ?? `var(--lilt-series-${e % 6 + 1})`, G = (e) => r[e]?.label ?? I[e], re = Math.max(0, r.findIndex((e) => !e.dashed)), ie = (e) => e.name + (e.values.some((e) => e === null) ? " · no data" : ""), K = Math.min(Math.max(40, ...z.map((e) => ie(e).length * Rn)) + 14, F * .24), q = Math.max(40, Math.min((F - K * 2) / 2, (s - 52) / 2)), oe = Math.max(1, ...z.flatMap((e) => zn(ie(e), K - 14).map((e) => e.length * Rn))), se = Math.max(10 / 12, Math.min(1, (K - 14) / oe)), J = F / 2, ge = s / 2, _e = he({
|
|
3578
3704
|
key: A?.id ?? 0,
|
|
3579
3705
|
active: !S && V > 0,
|
|
3580
3706
|
duration: 640
|
|
3581
|
-
}, E), [ve,
|
|
3707
|
+
}, E), [ve, ye] = X(null), [be, Y] = X(null), [Se, Ce] = X(null), [Te, Ee] = X(null), [Oe, $] = X(null), ke = be ?? Se ?? ve, Ae = ke === null ? void 0 : z[ke], je = Oe ?? Te, [Me, Ne] = X([]), Pe = (e) => Me.includes(I[e]), Fe = r.map((e, t) => ee(z.map((e) => e.values[t]).filter((e) => e !== null), a)), Ie = A?.headline ?? c ?? Fe[re] ?? null, Le = Pe(re) ? null : Ae ? Ae.values[re] : Ie, Re = Ae ? r.map((e, t) => ({
|
|
3582
3708
|
item: e,
|
|
3583
3709
|
index: t
|
|
3584
|
-
})).filter(({ index: e }) => e !== re && !Pe(e)).map(({ index: e }) => `${G(e)} ${Ae.values[e] === null ? "no data" : D.value(Ae.values[e])}`) : [], ze = (e) => {
|
|
3585
|
-
if (!V) return;
|
|
3586
|
-
let
|
|
3587
|
-
if (Math.hypot(
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
}
|
|
3591
|
-
let i = (Math.atan2(n, -r) + Math.PI * 2) % (Math.PI * 2);
|
|
3592
|
-
Y(Math.round(i / (Math.PI * 2) * V) % V);
|
|
3710
|
+
})).filter(({ index: e }) => e !== re && !Pe(e)).map(({ index: e }) => `${G(e)} ${Ae.values[e] === null ? "no data" : D.value(Ae.values[e])}`) : [], ze = (e, t, n) => {
|
|
3711
|
+
if (!V) return null;
|
|
3712
|
+
let r = n.getBoundingClientRect(), i = e - r.left - J, a = t - r.top - ge;
|
|
3713
|
+
if (Math.hypot(i, a) > q + K) return null;
|
|
3714
|
+
let o = (Math.atan2(i, -a) + Math.PI * 2) % (Math.PI * 2);
|
|
3715
|
+
return Math.round(o / (Math.PI * 2) * V) % V;
|
|
3593
3716
|
}, Be = (e) => {
|
|
3717
|
+
e.pointerType !== "touch" && ye(ze(e.clientX, e.clientY, e.currentTarget));
|
|
3718
|
+
}, Ve = lt({
|
|
3719
|
+
resolve: ze,
|
|
3720
|
+
onGlide: ye,
|
|
3721
|
+
onLift: (e) => e !== null && Y(e),
|
|
3722
|
+
onTap: (e) => Y((t) => e !== null && t !== e ? e : null),
|
|
3723
|
+
disabled: S
|
|
3724
|
+
}), He = xe((e) => {
|
|
3725
|
+
N.current = e, Ve(e);
|
|
3726
|
+
}, [Ve, N]), Ue = (e) => {
|
|
3594
3727
|
if (!V) return;
|
|
3595
|
-
let t =
|
|
3728
|
+
let t = Se ?? be, n = null;
|
|
3596
3729
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") n = t === null ? 0 : (t + 1) % V;
|
|
3597
3730
|
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") n = t === null ? V - 1 : (t - 1 + V) % V;
|
|
3598
3731
|
else if (e.key === "Home") n = 0;
|
|
3599
3732
|
else if (e.key === "End") n = V - 1;
|
|
3600
3733
|
else if ((e.key === "Enter" || e.key === " ") && t !== null) {
|
|
3601
|
-
e.preventDefault(),
|
|
3734
|
+
e.preventDefault(), Y((e) => e === t ? null : t);
|
|
3602
3735
|
return;
|
|
3603
3736
|
} else if (e.key === "Escape") {
|
|
3604
|
-
|
|
3737
|
+
Y(null), Ce(null);
|
|
3605
3738
|
return;
|
|
3606
3739
|
} else return;
|
|
3607
|
-
e.preventDefault(),
|
|
3608
|
-
},
|
|
3609
|
-
let { x: r, y: i } =
|
|
3610
|
-
return `${n ? "L" : "M"}${(
|
|
3611
|
-
}).join(" ") + " Z",
|
|
3740
|
+
e.preventDefault(), Ce(n);
|
|
3741
|
+
}, We = (e) => o === "circle" ? null : z.map((t, n) => {
|
|
3742
|
+
let { x: r, y: i } = Gn(n, V, e, q);
|
|
3743
|
+
return `${n ? "L" : "M"}${(J + r).toFixed(2)},${(ge + i).toFixed(2)}`;
|
|
3744
|
+
}).join(" ") + " Z", Ge = !S && !R.error && z.length === 0, Ke = z.some((e) => e.values.some((e) => e === null)), qe = Array.from({ length: Ln }, (e, t) => (t + 1) / Ln);
|
|
3612
3745
|
return /* @__PURE__ */ Q(me, {
|
|
3613
3746
|
motion: C,
|
|
3614
3747
|
className: ["lilt-radar-card", w].filter(Boolean).join(" "),
|
|
@@ -3628,34 +3761,35 @@ function Gn({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
3628
3761
|
value: A?.id,
|
|
3629
3762
|
onValueChange: te
|
|
3630
3763
|
}) : null,
|
|
3631
|
-
children: [/* @__PURE__ */ Z(
|
|
3764
|
+
children: [/* @__PURE__ */ Z(de, { children: e }), /* @__PURE__ */ Z(ue, {
|
|
3632
3765
|
value: S ? null : Le,
|
|
3633
3766
|
format: D.value,
|
|
3634
3767
|
loading: S,
|
|
3635
3768
|
motion: C,
|
|
3636
|
-
children: S ? null : Ae ? /* @__PURE__ */ Z(
|
|
3769
|
+
children: S ? null : Ae ? /* @__PURE__ */ Z(ce, { children: [Ae.name, ...Re].join(" · ") }) : M === void 0 ? null : /* @__PURE__ */ Z(le, {
|
|
3637
3770
|
value: M,
|
|
3638
3771
|
tone: d
|
|
3639
3772
|
})
|
|
3640
3773
|
})]
|
|
3641
|
-
}), R.error ||
|
|
3774
|
+
}), R.error || Ge ? /* @__PURE__ */ Z(u, {
|
|
3642
3775
|
kind: R.error ? "error" : "empty",
|
|
3643
3776
|
message: R.error ?? "No dimensions for this period."
|
|
3644
3777
|
}) : /* @__PURE__ */ Q(De, { children: [
|
|
3645
3778
|
/* @__PURE__ */ Q("div", {
|
|
3646
|
-
ref:
|
|
3779
|
+
ref: He,
|
|
3647
3780
|
className: "lilt-radar-card__plot",
|
|
3781
|
+
"data-lilt-glide": "",
|
|
3648
3782
|
style: { height: s },
|
|
3649
3783
|
"data-loading": S || void 0,
|
|
3650
3784
|
"data-motion": E ? "none" : void 0,
|
|
3651
3785
|
tabIndex: S ? void 0 : 0,
|
|
3652
3786
|
role: "group",
|
|
3653
3787
|
"aria-label": `${e}: ${V} dimensions. Arrow keys step around them; Enter pins one.`,
|
|
3654
|
-
onPointerMove: S ? void 0 :
|
|
3655
|
-
onPointerLeave: () =>
|
|
3656
|
-
onClick: () =>
|
|
3657
|
-
onKeyDown: S ? void 0 :
|
|
3658
|
-
onBlur: () =>
|
|
3788
|
+
onPointerMove: S ? void 0 : Be,
|
|
3789
|
+
onPointerLeave: () => ye(null),
|
|
3790
|
+
onClick: () => Y((e) => ve !== null && e !== ve ? ve : null),
|
|
3791
|
+
onKeyDown: S ? void 0 : Ue,
|
|
3792
|
+
onBlur: () => Ce(null),
|
|
3659
3793
|
children: [/* @__PURE__ */ Q("svg", {
|
|
3660
3794
|
"aria-hidden": "true",
|
|
3661
3795
|
className: "lilt-radar-card__svg",
|
|
@@ -3664,40 +3798,40 @@ function Gn({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
3664
3798
|
viewBox: `0 0 ${F} ${s}`,
|
|
3665
3799
|
children: [/* @__PURE__ */ Q("g", {
|
|
3666
3800
|
className: "lilt-radar-card__grid",
|
|
3667
|
-
children: [
|
|
3668
|
-
cx:
|
|
3801
|
+
children: [qe.map((e) => o === "circle" || S ? /* @__PURE__ */ Z("circle", {
|
|
3802
|
+
cx: J,
|
|
3669
3803
|
cy: ge,
|
|
3670
|
-
r:
|
|
3671
|
-
}, e) : /* @__PURE__ */ Z("path", { d:
|
|
3672
|
-
let n =
|
|
3804
|
+
r: q * e
|
|
3805
|
+
}, e) : /* @__PURE__ */ Z("path", { d: We(e) }, e)), S ? null : z.map((e, t) => {
|
|
3806
|
+
let n = Gn(t, V, 1, q);
|
|
3673
3807
|
return /* @__PURE__ */ Z("line", {
|
|
3674
3808
|
"data-active": t === ke || void 0,
|
|
3675
|
-
x1:
|
|
3809
|
+
x1: J,
|
|
3676
3810
|
y1: ge,
|
|
3677
|
-
x2:
|
|
3811
|
+
x2: J + n.x,
|
|
3678
3812
|
y2: ge + n.y
|
|
3679
3813
|
}, e.name);
|
|
3680
3814
|
})]
|
|
3681
|
-
}), S ? /* @__PURE__ */ Z(
|
|
3815
|
+
}), S ? /* @__PURE__ */ Z(_t, {
|
|
3682
3816
|
width: F,
|
|
3683
3817
|
height: s,
|
|
3684
3818
|
reduced: E,
|
|
3685
3819
|
children: /* @__PURE__ */ Z("path", {
|
|
3686
3820
|
className: "lilt-radar-card__skeleton",
|
|
3687
|
-
d:
|
|
3688
|
-
let { x: n, y: r } =
|
|
3689
|
-
return `${t ? "L" : "M"}${(
|
|
3821
|
+
d: Bn.map((e, t) => {
|
|
3822
|
+
let { x: n, y: r } = Gn(t, Bn.length, e, q);
|
|
3823
|
+
return `${t ? "L" : "M"}${(J + n).toFixed(2)},${(ge + r).toFixed(2)}`;
|
|
3690
3824
|
}).join(" ") + " Z"
|
|
3691
3825
|
})
|
|
3692
3826
|
}) : /* @__PURE__ */ Q(De, { children: [
|
|
3693
3827
|
/* @__PURE__ */ Z("g", {
|
|
3694
3828
|
className: "lilt-chart__axis",
|
|
3695
|
-
children:
|
|
3696
|
-
if (
|
|
3697
|
-
let { x: t, y: n } =
|
|
3829
|
+
children: qe.map((e) => {
|
|
3830
|
+
if (q < 110 && e !== .5) return null;
|
|
3831
|
+
let { x: t, y: n } = Gn(.5, V, e, q);
|
|
3698
3832
|
return /* @__PURE__ */ Z("text", {
|
|
3699
3833
|
className: "lilt-radar-card__ring-label",
|
|
3700
|
-
x:
|
|
3834
|
+
x: J + t,
|
|
3701
3835
|
y: ge + n,
|
|
3702
3836
|
dx: 3,
|
|
3703
3837
|
dy: "0.35em",
|
|
@@ -3706,9 +3840,9 @@ function Gn({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
3706
3840
|
})
|
|
3707
3841
|
}),
|
|
3708
3842
|
/* @__PURE__ */ Z("g", {
|
|
3709
|
-
transform: `translate(${
|
|
3843
|
+
transform: `translate(${J} ${ge}) scale(${_e})`,
|
|
3710
3844
|
children: r.map((e, t) => {
|
|
3711
|
-
let { path: n, complete: r } =
|
|
3845
|
+
let { path: n, complete: r } = Kn(z.map((e) => U(e.values[t])), q), i = je !== null && je !== e.key;
|
|
3712
3846
|
return /* @__PURE__ */ Q("g", {
|
|
3713
3847
|
className: "lilt-radar-card__profile",
|
|
3714
3848
|
"data-series": e.key,
|
|
@@ -3728,7 +3862,7 @@ function Gn({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
3728
3862
|
z.map((e, n) => {
|
|
3729
3863
|
let r = U(e.values[t]);
|
|
3730
3864
|
if (r === null) return null;
|
|
3731
|
-
let { x: i, y: a } =
|
|
3865
|
+
let { x: i, y: a } = Gn(n, V, r, q);
|
|
3732
3866
|
return /* @__PURE__ */ Z("circle", {
|
|
3733
3867
|
className: "lilt-radar-card__vertex",
|
|
3734
3868
|
"data-active": n === ke || void 0,
|
|
@@ -3742,17 +3876,17 @@ function Gn({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
3742
3876
|
})
|
|
3743
3877
|
}),
|
|
3744
3878
|
z.map((e, t) => {
|
|
3745
|
-
let { x: n, y: r } =
|
|
3879
|
+
let { x: n, y: r } = Gn(t, V, 1, q + 14), i = Math.abs(n) < 1 ? "middle" : n > 0 ? "start" : "end", a = e.values.some((e) => e === null), o = zn(ie(e), K - 14), s = r < -1 ? -.2 - (o.length - 1) * 1.2 : r > 1 ? .9 : .35 - (o.length - 1) * 1.2 / 2;
|
|
3746
3880
|
return /* @__PURE__ */ Z("text", {
|
|
3747
3881
|
className: "lilt-radar-card__label",
|
|
3748
3882
|
"data-active": t === ke || void 0,
|
|
3749
3883
|
"data-missing": a || void 0,
|
|
3750
|
-
x:
|
|
3884
|
+
x: J + n,
|
|
3751
3885
|
y: ge + r,
|
|
3752
3886
|
textAnchor: i,
|
|
3753
|
-
style:
|
|
3887
|
+
style: se < 1 ? { fontSize: `${(12 * se).toFixed(1)}px` } : void 0,
|
|
3754
3888
|
children: o.map((e, t) => /* @__PURE__ */ Z("tspan", {
|
|
3755
|
-
x:
|
|
3889
|
+
x: J + n,
|
|
3756
3890
|
dy: `${t === 0 ? s.toFixed(2) : "1.2"}em`,
|
|
3757
3891
|
children: e
|
|
3758
3892
|
}, t))
|
|
@@ -3779,14 +3913,14 @@ function Gn({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
3779
3913
|
};
|
|
3780
3914
|
}),
|
|
3781
3915
|
activeId: je,
|
|
3782
|
-
onHoverIdChange:
|
|
3916
|
+
onHoverIdChange: Ee,
|
|
3783
3917
|
hiddenIds: Me,
|
|
3784
3918
|
onHiddenIdsChange: (e) => {
|
|
3785
|
-
Ne(e),
|
|
3919
|
+
Ne(e), Ee(null), $(null);
|
|
3786
3920
|
},
|
|
3787
3921
|
renderValue: S ? () => /* @__PURE__ */ Z("span", { className: "lilt-card__skeleton lilt-card__skeleton--tile" }) : void 0
|
|
3788
3922
|
}),
|
|
3789
|
-
!S &&
|
|
3923
|
+
!S && Ke ? /* @__PURE__ */ Z("p", {
|
|
3790
3924
|
className: "lilt-radar-card__footer",
|
|
3791
3925
|
children: "A missing value breaks the outline at that dimension instead of drawing it as zero."
|
|
3792
3926
|
}) : null,
|
|
@@ -3812,7 +3946,7 @@ function Gn({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
3812
3946
|
}
|
|
3813
3947
|
//#endregion
|
|
3814
3948
|
//#region src/cards/range-chart-card.tsx
|
|
3815
|
-
function
|
|
3949
|
+
function Jn({ low: e, high: t, value: n, label: r, color: i, display: a = "bar", aggregate: o = "mean", tiles: s = !1, ...c }) {
|
|
3816
3950
|
let l = n ?? t, u = (e) => (t) => {
|
|
3817
3951
|
let n = t[e];
|
|
3818
3952
|
return typeof n == "number" ? n : null;
|
|
@@ -3844,12 +3978,12 @@ function Kn({ low: e, high: t, value: n, label: r, color: i, display: a = "bar",
|
|
|
3844
3978
|
accessor: u(t)
|
|
3845
3979
|
}
|
|
3846
3980
|
} }),
|
|
3847
|
-
draw: (e) => e.map((e) => a === "error" ? /* @__PURE__ */ Z(
|
|
3981
|
+
draw: (e) => e.map((e) => a === "error" ? /* @__PURE__ */ Z(Ye, {
|
|
3848
3982
|
series: e,
|
|
3849
3983
|
low: "low",
|
|
3850
3984
|
high: "high",
|
|
3851
3985
|
point: n !== void 0
|
|
3852
|
-
}, e) : /* @__PURE__ */ Z(
|
|
3986
|
+
}, e) : /* @__PURE__ */ Z(qe, {
|
|
3853
3987
|
series: e,
|
|
3854
3988
|
low: "low",
|
|
3855
3989
|
high: "high"
|
|
@@ -3859,7 +3993,7 @@ function Kn({ low: e, high: t, value: n, label: r, color: i, display: a = "bar",
|
|
|
3859
3993
|
}
|
|
3860
3994
|
//#endregion
|
|
3861
3995
|
//#region src/cards/box-plot-card.tsx
|
|
3862
|
-
function
|
|
3996
|
+
function Yn({ data: e = [], x: t, samples: n, label: r = "Median", color: i, outliers: a = !0, headline: o, ...s }) {
|
|
3863
3997
|
let c = we(() => e.map((e) => {
|
|
3864
3998
|
let r = e, i = et(r[n]);
|
|
3865
3999
|
return {
|
|
@@ -3928,12 +4062,12 @@ function qn({ data: e = [], x: t, samples: n, label: r = "Median", color: i, out
|
|
|
3928
4062
|
}
|
|
3929
4063
|
//#endregion
|
|
3930
4064
|
//#region src/engine/slope.ts
|
|
3931
|
-
var
|
|
4065
|
+
var Xn = (e) => {
|
|
3932
4066
|
if (e == null) return null;
|
|
3933
4067
|
if (typeof e != "number" || !Number.isFinite(e)) throw Error("Invalid value: expected a finite number or null.");
|
|
3934
4068
|
return e;
|
|
3935
4069
|
};
|
|
3936
|
-
function
|
|
4070
|
+
function Zn(e, t) {
|
|
3937
4071
|
if (e === null || t === null) return {
|
|
3938
4072
|
change: null,
|
|
3939
4073
|
ratio: null
|
|
@@ -3944,14 +4078,14 @@ function Yn(e, t) {
|
|
|
3944
4078
|
ratio: e > 0 ? n / e : null
|
|
3945
4079
|
};
|
|
3946
4080
|
}
|
|
3947
|
-
function
|
|
4081
|
+
function Qn(e, t, n, r, i = "change") {
|
|
3948
4082
|
let a = (e, t) => e[t], o = ve(e, {
|
|
3949
4083
|
id: (e) => String(a(e, t) ?? ""),
|
|
3950
4084
|
label: (e) => String(a(e, t) ?? "")
|
|
3951
4085
|
}, () => 0).map(({ id: e, label: t, datum: i }) => {
|
|
3952
4086
|
let o, s;
|
|
3953
4087
|
try {
|
|
3954
|
-
o =
|
|
4088
|
+
o = Xn(a(i, n)), s = Xn(a(i, r));
|
|
3955
4089
|
} catch {
|
|
3956
4090
|
throw Error(`Invalid value for category "${e}": expected a finite number or null.`);
|
|
3957
4091
|
}
|
|
@@ -3960,7 +4094,7 @@ function Xn(e, t, n, r, i = "change") {
|
|
|
3960
4094
|
label: t,
|
|
3961
4095
|
from: o,
|
|
3962
4096
|
to: s,
|
|
3963
|
-
...
|
|
4097
|
+
...Zn(o, s)
|
|
3964
4098
|
};
|
|
3965
4099
|
});
|
|
3966
4100
|
if (i === "input") return o;
|
|
@@ -3970,19 +4104,19 @@ function Xn(e, t, n, r, i = "change") {
|
|
|
3970
4104
|
return n === null || r === null ? n === r ? 0 : n === null ? 1 : -1 : r - n;
|
|
3971
4105
|
});
|
|
3972
4106
|
}
|
|
3973
|
-
function
|
|
4107
|
+
function $n(e, t = "sum") {
|
|
3974
4108
|
let n = 0, r = 0, i = 0, a = 0, o = 0;
|
|
3975
4109
|
for (let t of e) t.to !== null && (n += t.to, r += 1), t.from !== null && t.to !== null && (i += t.from, a += t.to, o += 1);
|
|
3976
4110
|
let s = t === "mean";
|
|
3977
4111
|
return {
|
|
3978
4112
|
to: r ? s ? n / r : n : null,
|
|
3979
|
-
...o ?
|
|
4113
|
+
...o ? Zn(s ? i / o : i, s ? a / o : a) : {
|
|
3980
4114
|
change: null,
|
|
3981
4115
|
ratio: null
|
|
3982
4116
|
}
|
|
3983
4117
|
};
|
|
3984
4118
|
}
|
|
3985
|
-
function
|
|
4119
|
+
function er(e) {
|
|
3986
4120
|
let t = e.flatMap((e) => [e.from, e.to].filter((e) => e !== null));
|
|
3987
4121
|
if (!t.length) return [0, 1];
|
|
3988
4122
|
let n = Math.min(...t), r = Math.max(...t);
|
|
@@ -3993,7 +4127,7 @@ function Qn(e) {
|
|
|
3993
4127
|
let i = (r - n) * .06;
|
|
3994
4128
|
return [n - i, r + i];
|
|
3995
4129
|
}
|
|
3996
|
-
function
|
|
4130
|
+
function tr(e, t, n, r) {
|
|
3997
4131
|
let i = e.map((e, t) => ({
|
|
3998
4132
|
target: e,
|
|
3999
4133
|
index: t
|
|
@@ -4020,20 +4154,20 @@ function $n(e, t, n, r) {
|
|
|
4020
4154
|
}
|
|
4021
4155
|
//#endregion
|
|
4022
4156
|
//#region src/cards/slope-chart-card.tsx
|
|
4023
|
-
var
|
|
4024
|
-
function
|
|
4157
|
+
var nr = [], rr = 6.6, ir = 17;
|
|
4158
|
+
function ar(e, t) {
|
|
4025
4159
|
return e === null || e === 0 || t === "neutral" ? "neutral" : e > 0 == (t !== "inverse") ? "positive" : "negative";
|
|
4026
4160
|
}
|
|
4027
|
-
var
|
|
4028
|
-
function
|
|
4029
|
-
let te =
|
|
4161
|
+
var or = (e) => e === null ? "" : `${e >= 0 ? "+" : "−"}${Math.abs(e * 100).toFixed(1)}%`;
|
|
4162
|
+
function sr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r, toLabel: o = i, variant: s = "slope", sort: c = "change", aggregate: l = "sum", headline: d, delta: f, deltaTone: p = "default", range: m, ranges: h, defaultRange: _, color: v, height: y = 260, valueFormat: b, locale: x, formatValue: S, surface: C = "elevated", badge: w, numberStyle: T, palette: ee, loading: E = !1, motion: D = "auto", className: O, style: k }) {
|
|
4163
|
+
let te = ae(D), A = ne({
|
|
4030
4164
|
valueFormat: b,
|
|
4031
4165
|
locale: x,
|
|
4032
4166
|
formatValue: S
|
|
4033
|
-
}), [j, M] = X(_ ?? h?.[0]?.id), N = h?.find((e) => e.id === j) ?? h?.[0], P = N?.data ?? t ??
|
|
4167
|
+
}), [j, M] = X(_ ?? h?.[0]?.id), N = h?.find((e) => e.id === j) ?? h?.[0], P = N?.data ?? t ?? nr, F = we(() => {
|
|
4034
4168
|
try {
|
|
4035
4169
|
return {
|
|
4036
|
-
rows:
|
|
4170
|
+
rows: Qn(P, n, r, i, c),
|
|
4037
4171
|
error: null
|
|
4038
4172
|
};
|
|
4039
4173
|
} catch (e) {
|
|
@@ -4048,7 +4182,12 @@ function ar({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
4048
4182
|
r,
|
|
4049
4183
|
i,
|
|
4050
4184
|
c
|
|
4051
|
-
]), I = F.rows, L = we(() =>
|
|
4185
|
+
]), I = F.rows, L = we(() => $n(I, l), [I, l]), R = we(() => er(I), [I]), [z, B] = X(null), [V, H] = X(null), [U, W] = X(null), G = U ?? V ?? z, re = I.find((e) => e.id === G) ?? null, ie = Te(/* @__PURE__ */ new Map()), K = lt({
|
|
4186
|
+
resolve: ct,
|
|
4187
|
+
onGlide: B,
|
|
4188
|
+
onLift: (e) => e !== null && W(e),
|
|
4189
|
+
disabled: E
|
|
4190
|
+
}), q = N?.headline ?? d ?? L.to, se = N ? N.delta ?? L.ratio : f ?? L.ratio, J = (e) => e === null ? "No data" : A.value(e), he = (e) => `${e.label}: ${a} ${J(e.from)}, ${o} ${J(e.to)}${e.ratio === null ? "" : `, ${or(e.ratio)}`}`, ge = (e, t) => {
|
|
4052
4191
|
let n = t;
|
|
4053
4192
|
if (e.key === "ArrowDown" || e.key === "ArrowRight") n = Math.min(I.length - 1, t + 1);
|
|
4054
4193
|
else if (e.key === "ArrowUp" || e.key === "ArrowLeft") n = Math.max(0, t - 1);
|
|
@@ -4063,34 +4202,35 @@ function ar({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
4063
4202
|
W((e) => e === n ? null : n);
|
|
4064
4203
|
return;
|
|
4065
4204
|
} else return;
|
|
4066
|
-
e.preventDefault(),
|
|
4067
|
-
},
|
|
4205
|
+
e.preventDefault(), ie.current.get(I[n].id)?.focus();
|
|
4206
|
+
}, _e = (e, t) => ({
|
|
4068
4207
|
ref: (t) => {
|
|
4069
|
-
t ?
|
|
4208
|
+
t ? ie.current.set(e.id, t) : ie.current.delete(e.id);
|
|
4070
4209
|
},
|
|
4071
4210
|
tabIndex: e.id === (V ?? I[0]?.id) ? 0 : -1,
|
|
4072
|
-
"aria-label":
|
|
4211
|
+
"aria-label": he(e),
|
|
4073
4212
|
"aria-pressed": U === e.id,
|
|
4074
4213
|
"data-active": e.id === re?.id || void 0,
|
|
4075
4214
|
"data-muted": re !== null && e.id !== re.id || void 0,
|
|
4076
|
-
"data-tone": v ? void 0 :
|
|
4215
|
+
"data-tone": v ? void 0 : ar(e.change, p),
|
|
4216
|
+
"data-glide-id": e.id,
|
|
4077
4217
|
onPointerEnter: () => B(e.id),
|
|
4078
4218
|
onPointerLeave: () => B(null),
|
|
4079
4219
|
onFocus: () => H(e.id),
|
|
4080
4220
|
onBlur: () => H(null),
|
|
4081
4221
|
onClick: () => W((t) => t === e.id ? null : e.id),
|
|
4082
|
-
onKeyDown: (e) =>
|
|
4083
|
-
}),
|
|
4222
|
+
onKeyDown: (e) => ge(e, t)
|
|
4223
|
+
}), ve = {
|
|
4084
4224
|
duration: te ? 0 : .55,
|
|
4085
|
-
ease:
|
|
4086
|
-
},
|
|
4225
|
+
ease: oe
|
|
4226
|
+
}, ye = v ? {
|
|
4087
4227
|
...k,
|
|
4088
4228
|
"--lilt-slope-color": v
|
|
4089
|
-
} : k,
|
|
4229
|
+
} : k, be = I.length === 0 || F.error;
|
|
4090
4230
|
return /* @__PURE__ */ Q(me, {
|
|
4091
4231
|
motion: D,
|
|
4092
4232
|
className: ["lilt-slope", O].filter(Boolean).join(" "),
|
|
4093
|
-
style:
|
|
4233
|
+
style: ye,
|
|
4094
4234
|
"aria-label": e,
|
|
4095
4235
|
surface: C,
|
|
4096
4236
|
badge: w,
|
|
@@ -4107,21 +4247,21 @@ function ar({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
4107
4247
|
value: N?.id,
|
|
4108
4248
|
onValueChange: M
|
|
4109
4249
|
}) : null,
|
|
4110
|
-
children: [/* @__PURE__ */ Z(
|
|
4250
|
+
children: [/* @__PURE__ */ Z(de, { children: e }), /* @__PURE__ */ Z(ue, {
|
|
4111
4251
|
value: re ? re.to : q,
|
|
4112
4252
|
format: A.value,
|
|
4113
4253
|
loading: E,
|
|
4114
4254
|
motion: D,
|
|
4115
|
-
children: E ? null : re ? /* @__PURE__ */ Q(De, { children: [re.ratio === null ? null : /* @__PURE__ */ Z(
|
|
4255
|
+
children: E ? null : re ? /* @__PURE__ */ Q(De, { children: [re.ratio === null ? null : /* @__PURE__ */ Z(le, {
|
|
4116
4256
|
value: re.ratio,
|
|
4117
4257
|
tone: p
|
|
4118
|
-
}), /* @__PURE__ */ Z(
|
|
4119
|
-
value:
|
|
4258
|
+
}), /* @__PURE__ */ Z(ce, { children: re.label })] }) : /* @__PURE__ */ Q(De, { children: [se == null ? null : /* @__PURE__ */ Z(le, {
|
|
4259
|
+
value: se,
|
|
4120
4260
|
tone: p
|
|
4121
|
-
}), /* @__PURE__ */ Q(
|
|
4261
|
+
}), /* @__PURE__ */ Q(ce, { children: ["vs ", a] })] })
|
|
4122
4262
|
})]
|
|
4123
4263
|
}),
|
|
4124
|
-
s === "dumbbell" && !E && !
|
|
4264
|
+
s === "dumbbell" && !E && !be ? /* @__PURE__ */ Q("div", {
|
|
4125
4265
|
className: "lilt-slope__key",
|
|
4126
4266
|
"aria-hidden": "true",
|
|
4127
4267
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -4143,18 +4283,20 @@ function ar({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
4143
4283
|
className: "lilt-slope__skeleton lilt-card__skeleton",
|
|
4144
4284
|
style: { height: y },
|
|
4145
4285
|
"aria-hidden": "true"
|
|
4146
|
-
}) :
|
|
4286
|
+
}) : be ? /* @__PURE__ */ Z(u, {
|
|
4147
4287
|
kind: F.error ? "error" : "empty",
|
|
4148
4288
|
message: F.error ?? "No rows for this period."
|
|
4149
4289
|
}) : s === "dumbbell" ? /* @__PURE__ */ Z("ol", {
|
|
4290
|
+
ref: K,
|
|
4150
4291
|
className: "lilt-slope__rows",
|
|
4292
|
+
"data-lilt-glide": "",
|
|
4151
4293
|
"aria-label": `${e}, ${a} to ${o}`,
|
|
4152
4294
|
children: I.map((e, t) => {
|
|
4153
4295
|
let n = (e) => (e - R[0]) / (R[1] - R[0]) * 100, r = e.from === null ? null : n(e.from), i = e.to === null ? null : n(e.to), a = te ? 0 : g(t, I.length, 140) / 1e3;
|
|
4154
4296
|
return /* @__PURE__ */ Z("li", { children: /* @__PURE__ */ Q("button", {
|
|
4155
4297
|
type: "button",
|
|
4156
4298
|
className: "lilt-slope__row",
|
|
4157
|
-
...
|
|
4299
|
+
..._e(e, t),
|
|
4158
4300
|
children: [
|
|
4159
4301
|
/* @__PURE__ */ Z("span", {
|
|
4160
4302
|
className: "lilt-slope__label",
|
|
@@ -4163,7 +4305,7 @@ function ar({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
4163
4305
|
/* @__PURE__ */ Q("span", {
|
|
4164
4306
|
className: "lilt-slope__track",
|
|
4165
4307
|
children: [
|
|
4166
|
-
r !== null && i !== null ? /* @__PURE__ */ Z(
|
|
4308
|
+
r !== null && i !== null ? /* @__PURE__ */ Z($.span, {
|
|
4167
4309
|
className: "lilt-slope__gap",
|
|
4168
4310
|
initial: !te && {
|
|
4169
4311
|
left: `${r}%`,
|
|
@@ -4174,24 +4316,24 @@ function ar({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
4174
4316
|
width: `${Math.abs(i - r)}%`
|
|
4175
4317
|
},
|
|
4176
4318
|
transition: {
|
|
4177
|
-
...
|
|
4319
|
+
...ve,
|
|
4178
4320
|
delay: a
|
|
4179
4321
|
}
|
|
4180
4322
|
}) : null,
|
|
4181
|
-
r === null ? null : /* @__PURE__ */ Z(
|
|
4323
|
+
r === null ? null : /* @__PURE__ */ Z($.span, {
|
|
4182
4324
|
className: "lilt-slope__dot",
|
|
4183
4325
|
"data-end": "from",
|
|
4184
4326
|
initial: !1,
|
|
4185
4327
|
animate: { left: `${r}%` },
|
|
4186
|
-
transition:
|
|
4328
|
+
transition: ve
|
|
4187
4329
|
}),
|
|
4188
|
-
i === null ? null : /* @__PURE__ */ Z(
|
|
4330
|
+
i === null ? null : /* @__PURE__ */ Z($.span, {
|
|
4189
4331
|
className: "lilt-slope__dot",
|
|
4190
4332
|
"data-end": "to",
|
|
4191
4333
|
initial: te || r === null ? !1 : { left: `${r}%` },
|
|
4192
4334
|
animate: { left: `${i}%` },
|
|
4193
4335
|
transition: {
|
|
4194
|
-
...
|
|
4336
|
+
...ve,
|
|
4195
4337
|
delay: a
|
|
4196
4338
|
}
|
|
4197
4339
|
})
|
|
@@ -4206,12 +4348,12 @@ function ar({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
4206
4348
|
}),
|
|
4207
4349
|
/* @__PURE__ */ Z("span", {
|
|
4208
4350
|
className: "lilt-slope__change",
|
|
4209
|
-
children:
|
|
4351
|
+
children: or(e.ratio) || "—"
|
|
4210
4352
|
})
|
|
4211
4353
|
]
|
|
4212
4354
|
}) }, e.id);
|
|
4213
4355
|
})
|
|
4214
|
-
}) : /* @__PURE__ */ Z(
|
|
4356
|
+
}) : /* @__PURE__ */ Z(cr, {
|
|
4215
4357
|
rows: I,
|
|
4216
4358
|
domain: R,
|
|
4217
4359
|
height: y,
|
|
@@ -4220,57 +4362,61 @@ function ar({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
4220
4362
|
title: e,
|
|
4221
4363
|
format: A.value,
|
|
4222
4364
|
reduced: te,
|
|
4223
|
-
handlers:
|
|
4365
|
+
handlers: _e,
|
|
4366
|
+
glideRef: K
|
|
4224
4367
|
})
|
|
4225
4368
|
]
|
|
4226
4369
|
});
|
|
4227
4370
|
}
|
|
4228
|
-
function
|
|
4229
|
-
let { ref:
|
|
4371
|
+
function cr({ rows: e, domain: t, height: n, fromLabel: r, toLabel: i, title: a, format: o, reduced: s, handlers: c, glideRef: l }) {
|
|
4372
|
+
let { ref: u, width: d } = ln(), f = xe((e) => {
|
|
4373
|
+
u.current = e, l(e);
|
|
4374
|
+
}, [l, u]), p = n - 10, m = (e) => p - (e - t[0]) / (t[1] - t[0]) * (p - 30), h = (e) => e === null ? "No data" : o(e), _ = Math.max(...e.map((e) => e.label.length + 1 + h(e.from).length)), v = Math.max(...e.map((e) => h(e.to).length + 1 + or(e.ratio).length)), y = (_ + v) * rr + 48 > d * .72, b = y ? Math.max(...e.map((e) => e.label.length)) : _, x = y ? Math.max(...e.map((e) => h(e.to).length)) : v, S = Math.min(d * .46, b * rr + 24), C = Math.max(S + 40, d - Math.min(d * .36, x * rr + 24)), w = e.map((e) => e.from === null ? p : m(e.from)), T = e.map((e) => e.to === null ? p : m(e.to)), ee = tr(w, ir, 36, p), E = tr(T, ir, 36, p), D = {
|
|
4230
4375
|
duration: s ? 0 : .6,
|
|
4231
|
-
ease:
|
|
4376
|
+
ease: oe
|
|
4232
4377
|
};
|
|
4233
4378
|
return /* @__PURE__ */ Z("div", {
|
|
4234
|
-
ref:
|
|
4379
|
+
ref: f,
|
|
4235
4380
|
className: "lilt-slope__plot",
|
|
4381
|
+
"data-lilt-glide": "",
|
|
4236
4382
|
style: { height: n },
|
|
4237
|
-
children:
|
|
4238
|
-
width:
|
|
4383
|
+
children: d > 0 ? /* @__PURE__ */ Q("svg", {
|
|
4384
|
+
width: d,
|
|
4239
4385
|
height: n,
|
|
4240
|
-
viewBox: `0 0 ${
|
|
4386
|
+
viewBox: `0 0 ${d} ${n}`,
|
|
4241
4387
|
role: "group",
|
|
4242
4388
|
"aria-label": `${a}, ${r} to ${i}`,
|
|
4243
4389
|
children: [
|
|
4244
4390
|
/* @__PURE__ */ Z("line", {
|
|
4245
4391
|
className: "lilt-slope__axis",
|
|
4246
|
-
x1:
|
|
4247
|
-
x2:
|
|
4392
|
+
x1: S,
|
|
4393
|
+
x2: S,
|
|
4248
4394
|
y1: 24,
|
|
4249
|
-
y2:
|
|
4395
|
+
y2: p
|
|
4250
4396
|
}),
|
|
4251
4397
|
/* @__PURE__ */ Z("line", {
|
|
4252
4398
|
className: "lilt-slope__axis",
|
|
4253
|
-
x1:
|
|
4254
|
-
x2:
|
|
4399
|
+
x1: C,
|
|
4400
|
+
x2: C,
|
|
4255
4401
|
y1: 24,
|
|
4256
|
-
y2:
|
|
4402
|
+
y2: p
|
|
4257
4403
|
}),
|
|
4258
4404
|
/* @__PURE__ */ Z("text", {
|
|
4259
4405
|
className: "lilt-slope__column",
|
|
4260
|
-
x:
|
|
4406
|
+
x: S,
|
|
4261
4407
|
y: 12,
|
|
4262
4408
|
textAnchor: "middle",
|
|
4263
4409
|
children: r
|
|
4264
4410
|
}),
|
|
4265
4411
|
/* @__PURE__ */ Z("text", {
|
|
4266
4412
|
className: "lilt-slope__column",
|
|
4267
|
-
x,
|
|
4413
|
+
x: C,
|
|
4268
4414
|
y: 12,
|
|
4269
4415
|
textAnchor: "middle",
|
|
4270
4416
|
children: i
|
|
4271
4417
|
}),
|
|
4272
4418
|
e.map((t, n) => {
|
|
4273
|
-
let r =
|
|
4419
|
+
let r = w[n], i = T[n], a = s ? 0 : g(n, e.length, 160) / 1e3;
|
|
4274
4420
|
return /* @__PURE__ */ Q("g", {
|
|
4275
4421
|
className: "lilt-slope__line",
|
|
4276
4422
|
role: "button",
|
|
@@ -4278,88 +4424,88 @@ function or({ rows: e, domain: t, height: n, fromLabel: r, toLabel: i, title: a,
|
|
|
4278
4424
|
children: [
|
|
4279
4425
|
t.from !== null && t.to !== null ? /* @__PURE__ */ Q(De, { children: [/* @__PURE__ */ Z("line", {
|
|
4280
4426
|
className: "lilt-slope__hit",
|
|
4281
|
-
x1:
|
|
4282
|
-
x2:
|
|
4427
|
+
x1: S,
|
|
4428
|
+
x2: C,
|
|
4283
4429
|
y1: r,
|
|
4284
4430
|
y2: i
|
|
4285
|
-
}), /* @__PURE__ */ Z(
|
|
4431
|
+
}), /* @__PURE__ */ Z($.line, {
|
|
4286
4432
|
className: "lilt-slope__stroke",
|
|
4287
4433
|
initial: !s && {
|
|
4288
|
-
x2:
|
|
4434
|
+
x2: S,
|
|
4289
4435
|
y2: r,
|
|
4290
|
-
x1:
|
|
4436
|
+
x1: S,
|
|
4291
4437
|
y1: r
|
|
4292
4438
|
},
|
|
4293
4439
|
animate: {
|
|
4294
|
-
x1:
|
|
4440
|
+
x1: S,
|
|
4295
4441
|
y1: r,
|
|
4296
|
-
x2:
|
|
4442
|
+
x2: C,
|
|
4297
4443
|
y2: i
|
|
4298
4444
|
},
|
|
4299
4445
|
transition: {
|
|
4300
|
-
...
|
|
4446
|
+
...D,
|
|
4301
4447
|
delay: a
|
|
4302
4448
|
}
|
|
4303
4449
|
})] }) : null,
|
|
4304
|
-
t.from === null ? null : /* @__PURE__ */ Z(
|
|
4450
|
+
t.from === null ? null : /* @__PURE__ */ Z($.circle, {
|
|
4305
4451
|
className: "lilt-slope__dot-mark",
|
|
4306
4452
|
"data-end": "from",
|
|
4307
4453
|
r: 4,
|
|
4308
4454
|
initial: !1,
|
|
4309
4455
|
animate: {
|
|
4310
|
-
cx:
|
|
4456
|
+
cx: S,
|
|
4311
4457
|
cy: r
|
|
4312
4458
|
},
|
|
4313
|
-
transition:
|
|
4459
|
+
transition: D
|
|
4314
4460
|
}),
|
|
4315
|
-
t.to === null ? null : /* @__PURE__ */ Z(
|
|
4461
|
+
t.to === null ? null : /* @__PURE__ */ Z($.circle, {
|
|
4316
4462
|
className: "lilt-slope__dot-mark",
|
|
4317
4463
|
"data-end": "to",
|
|
4318
4464
|
r: 4.5,
|
|
4319
4465
|
initial: s || t.from === null ? !1 : {
|
|
4320
|
-
cx:
|
|
4466
|
+
cx: S,
|
|
4321
4467
|
cy: r
|
|
4322
4468
|
},
|
|
4323
4469
|
animate: {
|
|
4324
|
-
cx:
|
|
4470
|
+
cx: C,
|
|
4325
4471
|
cy: i
|
|
4326
4472
|
},
|
|
4327
4473
|
transition: {
|
|
4328
|
-
...
|
|
4474
|
+
...D,
|
|
4329
4475
|
delay: a
|
|
4330
4476
|
}
|
|
4331
4477
|
}),
|
|
4332
|
-
/* @__PURE__ */ Q(
|
|
4478
|
+
/* @__PURE__ */ Q($.text, {
|
|
4333
4479
|
className: "lilt-slope__label",
|
|
4334
|
-
x:
|
|
4480
|
+
x: S - 10,
|
|
4335
4481
|
textAnchor: "end",
|
|
4336
4482
|
dominantBaseline: "middle",
|
|
4337
4483
|
initial: !1,
|
|
4338
|
-
animate: { attrY:
|
|
4339
|
-
transition:
|
|
4484
|
+
animate: { attrY: ee[n] },
|
|
4485
|
+
transition: D,
|
|
4340
4486
|
children: [/* @__PURE__ */ Z("tspan", {
|
|
4341
4487
|
className: "lilt-slope__name",
|
|
4342
4488
|
children: t.label
|
|
4343
|
-
}),
|
|
4489
|
+
}), y ? null : /* @__PURE__ */ Z("tspan", {
|
|
4344
4490
|
className: "lilt-slope__number",
|
|
4345
4491
|
dx: 6,
|
|
4346
|
-
children:
|
|
4492
|
+
children: h(t.from)
|
|
4347
4493
|
})]
|
|
4348
4494
|
}),
|
|
4349
|
-
/* @__PURE__ */ Q(
|
|
4495
|
+
/* @__PURE__ */ Q($.text, {
|
|
4350
4496
|
className: "lilt-slope__label",
|
|
4351
|
-
x:
|
|
4497
|
+
x: C + 10,
|
|
4352
4498
|
dominantBaseline: "middle",
|
|
4353
4499
|
initial: !1,
|
|
4354
|
-
animate: { attrY:
|
|
4355
|
-
transition:
|
|
4500
|
+
animate: { attrY: E[n] },
|
|
4501
|
+
transition: D,
|
|
4356
4502
|
children: [/* @__PURE__ */ Z("tspan", {
|
|
4357
4503
|
className: "lilt-slope__end",
|
|
4358
|
-
children:
|
|
4359
|
-
}),
|
|
4504
|
+
children: h(t.to)
|
|
4505
|
+
}), y || t.ratio === null ? null : /* @__PURE__ */ Z("tspan", {
|
|
4360
4506
|
className: "lilt-slope__ratio",
|
|
4361
4507
|
dx: 6,
|
|
4362
|
-
children:
|
|
4508
|
+
children: or(t.ratio)
|
|
4363
4509
|
})]
|
|
4364
4510
|
})
|
|
4365
4511
|
]
|
|
@@ -4371,8 +4517,8 @@ function or({ rows: e, domain: t, height: n, fromLabel: r, toLabel: i, title: a,
|
|
|
4371
4517
|
}
|
|
4372
4518
|
//#endregion
|
|
4373
4519
|
//#region src/activity-ring.tsx
|
|
4374
|
-
var
|
|
4375
|
-
function
|
|
4520
|
+
var lr = .54;
|
|
4521
|
+
function ur(e, t, n, r, i = 60) {
|
|
4376
4522
|
if (!Number.isFinite(r) || r <= 0) throw Error("Lilt ActivityRing maximum must be positive and finite.");
|
|
4377
4523
|
if (!Number.isInteger(i) || i <= 0 || 1440 % i != 0) throw Error("Lilt ActivityRing bucketMinutes must divide a 24-hour day.");
|
|
4378
4524
|
let a = 1440 / i, o = Array.from({ length: a }, (e, t) => ({
|
|
@@ -4393,12 +4539,12 @@ function cr(e, t, n, r, i = 60) {
|
|
|
4393
4539
|
}
|
|
4394
4540
|
return o;
|
|
4395
4541
|
}
|
|
4396
|
-
var
|
|
4542
|
+
var dr = (e) => {
|
|
4397
4543
|
let t = Math.round(e * 60);
|
|
4398
4544
|
return `${String(Math.floor(t / 60)).padStart(2, "0")}:${String(t % 60).padStart(2, "0")}`;
|
|
4399
4545
|
};
|
|
4400
|
-
function
|
|
4401
|
-
let r =
|
|
4546
|
+
function fr(e, t, n) {
|
|
4547
|
+
let r = ae(n), [i, a] = X(0), [o, s] = X(!0), c = Te(i), l = Te(!1);
|
|
4402
4548
|
return Ce(() => {
|
|
4403
4549
|
if (!e || !t || r) {
|
|
4404
4550
|
c.current = 1, a(1);
|
|
@@ -4408,9 +4554,9 @@ function ur(e, t, n) {
|
|
|
4408
4554
|
l.current = !0, s(n);
|
|
4409
4555
|
let i = n ? 0 : c.current >= .999 ? .65 : Math.max(.65, c.current);
|
|
4410
4556
|
c.current = i, a(i);
|
|
4411
|
-
let o =
|
|
4557
|
+
let o = je(i, 1, {
|
|
4412
4558
|
duration: n ? 1.15 : .36,
|
|
4413
|
-
ease:
|
|
4559
|
+
ease: oe,
|
|
4414
4560
|
onUpdate: (e) => {
|
|
4415
4561
|
c.current = e, a(e);
|
|
4416
4562
|
},
|
|
@@ -4429,12 +4575,12 @@ function ur(e, t, n) {
|
|
|
4429
4575
|
reduced: r
|
|
4430
4576
|
};
|
|
4431
4577
|
}
|
|
4432
|
-
function
|
|
4578
|
+
function pr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dotDensity: a = 6, unit: o, formatValue: s = String, center: c, onSelectionChange: l, status: u = "ready", resetKey: d, motion: f = "auto", height: p = 320, className: m, "aria-label": h }) {
|
|
4433
4579
|
if (!o.trim()) throw Error("Lilt ActivityRing requires a measurement unit.");
|
|
4434
4580
|
if (!Number.isFinite(p) || p < 180) throw Error("Lilt ActivityRing height must be at least 180px.");
|
|
4435
4581
|
if (!Number.isInteger(a) || a < 1 || a > 24) throw Error("Lilt ActivityRing dotDensity must be an integer from 1 to 24.");
|
|
4436
4582
|
let g = we(() => u === "ready" ? {
|
|
4437
|
-
slots:
|
|
4583
|
+
slots: ur(e, t, n, r, i),
|
|
4438
4584
|
maximum: r,
|
|
4439
4585
|
bucketMinutes: i,
|
|
4440
4586
|
unit: o,
|
|
@@ -4452,35 +4598,48 @@ function dr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
4452
4598
|
key: d,
|
|
4453
4599
|
frame: g
|
|
4454
4600
|
});
|
|
4455
|
-
|
|
4601
|
+
Y(() => {
|
|
4456
4602
|
g && v({
|
|
4457
4603
|
key: d,
|
|
4458
4604
|
frame: g
|
|
4459
4605
|
});
|
|
4460
4606
|
}, [g, d]);
|
|
4461
|
-
let y = g ?? (_.key === d ? _.frame : null), b = y?.slots, x = 1440 / (y?.bucketMinutes ?? i), S = y?.maximum ?? r, C = y?.unit ?? o, w = y?.formatValue ?? s, { ref: T, width: ee } =
|
|
4607
|
+
let y = g ?? (_.key === d ? _.frame : null), b = y?.slots, x = 1440 / (y?.bucketMinutes ?? i), S = y?.maximum ?? r, C = y?.unit ?? o, w = y?.formatValue ?? s, { ref: T, width: ee } = ln(), E = Math.min(p, Math.max(240, ee || p)), D = E / 2, O = E / 2, k = E * .33, [te, A] = X(null), [j, M] = X(null), N = te ?? j, P = N === null ? null : b?.[N] ?? null, F = P ? {
|
|
4462
4608
|
hour: P.hour,
|
|
4463
4609
|
row: P.row,
|
|
4464
4610
|
value: P.value,
|
|
4465
4611
|
pinned: j === N
|
|
4466
|
-
} : null, { progress: ne, sweeping: I, reduced: L } =
|
|
4467
|
-
|
|
4612
|
+
} : null, { progress: ne, sweeping: I, reduced: L } = fr(b, u === "ready", f), R = Te(null), z = lt({
|
|
4613
|
+
resolve: (e, t, n) => {
|
|
4614
|
+
if (!b) return null;
|
|
4615
|
+
let r = n.getBoundingClientRect(), i = e - r.left - r.width / E * D, a = t - r.top - r.height / E * O, o = Math.hypot(i, a) / (r.width / E || 1);
|
|
4616
|
+
if (o < k * .3 || o > k * 1.3) return null;
|
|
4617
|
+
let s = (Math.atan2(i, -a) + Math.PI * 2) % (Math.PI * 2);
|
|
4618
|
+
return Math.round(s / (Math.PI * 2) * x) % x;
|
|
4619
|
+
},
|
|
4620
|
+
onGlide: A,
|
|
4621
|
+
onLift: (e) => e !== null && M(e),
|
|
4622
|
+
disabled: !b
|
|
4623
|
+
}), B = xe((e) => {
|
|
4624
|
+
R.current = e, z(e);
|
|
4625
|
+
}, [z]);
|
|
4626
|
+
Y(() => {
|
|
4468
4627
|
j !== null && (!b || j >= x) && M(null);
|
|
4469
4628
|
}, [
|
|
4470
4629
|
j,
|
|
4471
4630
|
b,
|
|
4472
4631
|
x
|
|
4473
|
-
]),
|
|
4632
|
+
]), Y(() => {
|
|
4474
4633
|
l?.(F);
|
|
4475
4634
|
}, [
|
|
4476
4635
|
N,
|
|
4477
4636
|
P,
|
|
4478
4637
|
j,
|
|
4479
4638
|
l
|
|
4480
|
-
]),
|
|
4639
|
+
]), Y(() => {
|
|
4481
4640
|
A(null), M(null);
|
|
4482
4641
|
}, [d]);
|
|
4483
|
-
let
|
|
4642
|
+
let V = (e) => {
|
|
4484
4643
|
if (!b) return;
|
|
4485
4644
|
let t = N ?? 0;
|
|
4486
4645
|
[
|
|
@@ -4494,13 +4653,13 @@ function dr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
4494
4653
|
" ",
|
|
4495
4654
|
"Escape"
|
|
4496
4655
|
].includes(e.key) && e.preventDefault(), (e.key === "ArrowRight" || e.key === "ArrowDown") && A((t + 1) % x), (e.key === "ArrowLeft" || e.key === "ArrowUp") && A((t + x - 1) % x), e.key === "Home" && A(0), e.key === "End" && A(x - 1), (e.key === "Enter" || e.key === " ") && M(j === t ? null : t), e.key === "Escape" && (M(null), A(null), R.current?.focus());
|
|
4497
|
-
},
|
|
4656
|
+
}, H = (e, t) => {
|
|
4498
4657
|
let n = e / x * Math.PI * 2 - Math.PI / 2;
|
|
4499
4658
|
return {
|
|
4500
4659
|
x: Number((D + Math.cos(n) * t).toFixed(3)),
|
|
4501
4660
|
y: Number((O + Math.sin(n) * t).toFixed(3))
|
|
4502
4661
|
};
|
|
4503
|
-
},
|
|
4662
|
+
}, U = b?.reduce((e, t) => t.value !== null && (!e || t.value > (e.value ?? -1)) ? t : e, null), W = F ? `${dr(F.hour)}: ${F.value === null ? "No data" : `${w(F.value)} ${C}`}` : "No bucket selected.";
|
|
4504
4663
|
return /* @__PURE__ */ Q("div", {
|
|
4505
4664
|
ref: T,
|
|
4506
4665
|
className: ["lilt-activity", m].filter(Boolean).join(" "),
|
|
@@ -4517,14 +4676,15 @@ function dr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
4517
4676
|
height: E
|
|
4518
4677
|
},
|
|
4519
4678
|
children: [/* @__PURE__ */ Q("svg", {
|
|
4520
|
-
ref:
|
|
4679
|
+
ref: B,
|
|
4680
|
+
"data-lilt-glide": "",
|
|
4521
4681
|
width: E,
|
|
4522
4682
|
height: E,
|
|
4523
4683
|
viewBox: `0 0 ${E} ${E}`,
|
|
4524
4684
|
role: "group",
|
|
4525
4685
|
"aria-label": h,
|
|
4526
4686
|
tabIndex: b ? 0 : -1,
|
|
4527
|
-
onKeyDown:
|
|
4687
|
+
onKeyDown: V,
|
|
4528
4688
|
onPointerLeave: () => A(null),
|
|
4529
4689
|
children: [
|
|
4530
4690
|
/* @__PURE__ */ Z("circle", {
|
|
@@ -4545,15 +4705,15 @@ function dr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
4545
4705
|
onClick: () => M(j === t ? null : t),
|
|
4546
4706
|
children: [
|
|
4547
4707
|
/* @__PURE__ */ Z("line", {
|
|
4548
|
-
x1:
|
|
4549
|
-
y1:
|
|
4550
|
-
x2:
|
|
4551
|
-
y2:
|
|
4708
|
+
x1: H(t, k * .45).x,
|
|
4709
|
+
y1: H(t, k * .45).y,
|
|
4710
|
+
x2: H(t, k * 1.12).x,
|
|
4711
|
+
y2: H(t, k * 1.12).y,
|
|
4552
4712
|
stroke: "transparent",
|
|
4553
4713
|
strokeWidth: "12"
|
|
4554
4714
|
}),
|
|
4555
4715
|
Array.from({ length: a }, (e, n) => {
|
|
4556
|
-
let r =
|
|
4716
|
+
let r = H(t, k * (lr + n / Math.max(1, a - 1) * .5249999999999999)), i = n < o;
|
|
4557
4717
|
return /* @__PURE__ */ Z("circle", {
|
|
4558
4718
|
cx: r.x,
|
|
4559
4719
|
cy: r.y,
|
|
@@ -4563,8 +4723,8 @@ function dr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
4563
4723
|
}, n);
|
|
4564
4724
|
}),
|
|
4565
4725
|
s ? /* @__PURE__ */ Z("circle", {
|
|
4566
|
-
cx:
|
|
4567
|
-
cy:
|
|
4726
|
+
cx: H(t, k * 1.12).x,
|
|
4727
|
+
cy: H(t, k * 1.12).y,
|
|
4568
4728
|
r: "4.5",
|
|
4569
4729
|
fill: "none",
|
|
4570
4730
|
stroke: "var(--lilt-focus)",
|
|
@@ -4573,14 +4733,14 @@ function dr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
4573
4733
|
]
|
|
4574
4734
|
}, t);
|
|
4575
4735
|
}) }),
|
|
4576
|
-
!b && u === "loading" ? /* @__PURE__ */ Z(
|
|
4736
|
+
!b && u === "loading" ? /* @__PURE__ */ Z(_t, {
|
|
4577
4737
|
width: E,
|
|
4578
4738
|
height: E,
|
|
4579
4739
|
reduced: L,
|
|
4580
4740
|
children: Array.from({ length: x }, (e, t) => {
|
|
4581
4741
|
let n = .5 - .5 * Math.cos((t / x * 2 - .25) * Math.PI), r = Math.max(1, Math.round(a * (.25 + .55 * n)));
|
|
4582
4742
|
return Array.from({ length: r }, (e, n) => {
|
|
4583
|
-
let r =
|
|
4743
|
+
let r = H(t, k * (lr + n / Math.max(1, a - 1) * .5249999999999999));
|
|
4584
4744
|
return /* @__PURE__ */ Z("circle", {
|
|
4585
4745
|
className: "lilt-activity__skeleton-dot",
|
|
4586
4746
|
cx: r.x,
|
|
@@ -4596,7 +4756,7 @@ function dr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
4596
4756
|
2,
|
|
4597
4757
|
3
|
|
4598
4758
|
].map((e) => {
|
|
4599
|
-
let t =
|
|
4759
|
+
let t = H(Math.round(e * x / 4), k * 1.26);
|
|
4600
4760
|
return /* @__PURE__ */ Z("text", {
|
|
4601
4761
|
x: t.x,
|
|
4602
4762
|
y: t.y,
|
|
@@ -4610,14 +4770,14 @@ function dr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
4610
4770
|
]
|
|
4611
4771
|
}), /* @__PURE__ */ Z("div", {
|
|
4612
4772
|
className: "lilt-activity__center",
|
|
4613
|
-
children: c ?? /* @__PURE__ */ Q(De, { children: [/* @__PURE__ */ Z("strong", { children:
|
|
4773
|
+
children: c ?? /* @__PURE__ */ Q(De, { children: [/* @__PURE__ */ Z("strong", { children: U ? w(U.value) : "—" }), /* @__PURE__ */ Q("span", { children: [C, " peak"] })] })
|
|
4614
4774
|
})]
|
|
4615
4775
|
}),
|
|
4616
4776
|
/* @__PURE__ */ Z("p", {
|
|
4617
4777
|
className: "lilt-chart__sr-only",
|
|
4618
4778
|
role: "status",
|
|
4619
4779
|
"aria-atomic": "true",
|
|
4620
|
-
children:
|
|
4780
|
+
children: W
|
|
4621
4781
|
}),
|
|
4622
4782
|
/* @__PURE__ */ Q("span", {
|
|
4623
4783
|
className: "lilt-chart__sr-only",
|
|
@@ -4628,27 +4788,27 @@ function dr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
4628
4788
|
}
|
|
4629
4789
|
//#endregion
|
|
4630
4790
|
//#region src/cards/activity-ring-card.tsx
|
|
4631
|
-
var
|
|
4632
|
-
function
|
|
4791
|
+
var mr = [], hr = 280;
|
|
4792
|
+
function gr(e) {
|
|
4633
4793
|
let t = Math.round(e * 60) % 1440;
|
|
4634
4794
|
return `${String(Math.floor(t / 60)).padStart(2, "0")}:${String(t % 60).padStart(2, "0")}`;
|
|
4635
4795
|
}
|
|
4636
|
-
function
|
|
4796
|
+
function _r(e, t) {
|
|
4637
4797
|
return e.includes("bucketMinutes") ? "`bucketMinutes` must divide a day evenly, like 15, 20, 30, 40, or 60." : e.includes("bucket-aligned") ? `Every time must fall on a ${t}-minute slot between 0 and 24, once.` : e.includes("within [0, maximum]") ? "Values must be zero or more and no higher than `maximum`." : e;
|
|
4638
4798
|
}
|
|
4639
|
-
function
|
|
4799
|
+
function vr({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit: a, maximum: o, aggregate: s = "sum", height: c = hr, headline: l, delta: d, deltaTone: f, range: p, ranges: m, defaultRange: h, valueFormat: g, locale: _, formatValue: v, color: y, surface: b = "elevated", badge: x, numberStyle: S, palette: C, loading: w = !1, motion: T = "auto", className: E, style: D }) {
|
|
4640
4800
|
let O = ne({
|
|
4641
4801
|
valueFormat: g,
|
|
4642
4802
|
locale: _,
|
|
4643
4803
|
formatValue: v
|
|
4644
|
-
}), [te, A] = X(h ?? m?.[0]?.id), j = m?.find((e) => e.id === te) ?? m?.[0], M = j?.data ?? t ??
|
|
4804
|
+
}), [te, A] = X(h ?? m?.[0]?.id), j = m?.find((e) => e.id === te) ?? m?.[0], M = j?.data ?? t ?? mr, N = j ? j.delta : d, P = a?.trim() || r, F = xe((e) => e[n], [n]), I = xe((e) => {
|
|
4645
4805
|
let t = e[r];
|
|
4646
4806
|
return typeof t == "number" && Number.isFinite(t) ? t : null;
|
|
4647
4807
|
}, [r]), L = we(() => {
|
|
4648
|
-
let e = M.map(I).filter((e) => e !== null), t = Math.max(0, ...e), n = o ??
|
|
4808
|
+
let e = M.map(I).filter((e) => e !== null), t = Math.max(0, ...e), n = o ?? ke().domain([0, Math.max(1, t)]).nice(4).domain()[1];
|
|
4649
4809
|
try {
|
|
4650
4810
|
return {
|
|
4651
|
-
slots:
|
|
4811
|
+
slots: ur(M, F, I, n, i),
|
|
4652
4812
|
maximum: n,
|
|
4653
4813
|
error: null
|
|
4654
4814
|
};
|
|
@@ -4656,7 +4816,7 @@ function gr({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
4656
4816
|
return {
|
|
4657
4817
|
slots: [],
|
|
4658
4818
|
maximum: n,
|
|
4659
|
-
error:
|
|
4819
|
+
error: _r(e instanceof Error ? e.message : "Invalid activity.", i)
|
|
4660
4820
|
};
|
|
4661
4821
|
}
|
|
4662
4822
|
}, [
|
|
@@ -4665,7 +4825,7 @@ function gr({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
4665
4825
|
I,
|
|
4666
4826
|
o,
|
|
4667
4827
|
i
|
|
4668
|
-
]), [R, z] = X(null), B =
|
|
4828
|
+
]), [R, z] = X(null), B = xe((e) => z(e), []), V = L.slots.filter((e) => e.value !== null), H = V.reduce((e, t) => !e || t.value > e.value ? t : e, null), U = V.reduce((e, t) => !e || t.value < e.value ? t : e, null), W = M.length ? L.slots.length - V.length : 0, G = j?.headline ?? l ?? ee(V.map((e) => e.value), s), re = !w && !L.error && M.length === 0;
|
|
4669
4829
|
return /* @__PURE__ */ Q(me, {
|
|
4670
4830
|
motion: T,
|
|
4671
4831
|
className: ["lilt-activity-card", E].filter(Boolean).join(" "),
|
|
@@ -4688,12 +4848,12 @@ function gr({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
4688
4848
|
value: j?.id,
|
|
4689
4849
|
onValueChange: A
|
|
4690
4850
|
}) : null,
|
|
4691
|
-
children: [/* @__PURE__ */ Z(
|
|
4851
|
+
children: [/* @__PURE__ */ Z(de, { children: e }), /* @__PURE__ */ Z(ue, {
|
|
4692
4852
|
value: w ? null : R ? R.value : G,
|
|
4693
4853
|
format: O.value,
|
|
4694
4854
|
loading: w,
|
|
4695
4855
|
motion: T,
|
|
4696
|
-
children: w ? null : R ? /* @__PURE__ */ Q(
|
|
4856
|
+
children: w ? null : R ? /* @__PURE__ */ Q(ce, { children: [gr(R.hour), R.value === null ? " · No data" : ` · ${P}`] }) : N === void 0 ? null : /* @__PURE__ */ Z(le, {
|
|
4697
4857
|
value: N,
|
|
4698
4858
|
tone: f
|
|
4699
4859
|
})
|
|
@@ -4702,7 +4862,7 @@ function gr({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
4702
4862
|
kind: L.error ? "error" : "empty",
|
|
4703
4863
|
message: L.error ?? "No activity for this period."
|
|
4704
4864
|
}) : /* @__PURE__ */ Q(De, { children: [
|
|
4705
|
-
/* @__PURE__ */ Z(
|
|
4865
|
+
/* @__PURE__ */ Z(pr, {
|
|
4706
4866
|
className: "lilt-activity-card__ring",
|
|
4707
4867
|
"aria-label": e,
|
|
4708
4868
|
data: M,
|
|
@@ -4718,20 +4878,20 @@ function gr({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
4718
4878
|
motion: T,
|
|
4719
4879
|
resetKey: j?.id,
|
|
4720
4880
|
onSelectionChange: B,
|
|
4721
|
-
center: w ? /* @__PURE__ */ Z(De, {}) : /* @__PURE__ */ Q(De, { children: [/* @__PURE__ */ Z("strong", { children: H ? O.value(H.value) : "—" }), /* @__PURE__ */ Z("span", { children: H ? `peak · ${
|
|
4881
|
+
center: w ? /* @__PURE__ */ Z(De, {}) : /* @__PURE__ */ Q(De, { children: [/* @__PURE__ */ Z("strong", { children: H ? O.value(H.value) : "—" }), /* @__PURE__ */ Z("span", { children: H ? `peak · ${gr(H.hour)}` : "no data" })] })
|
|
4722
4882
|
}),
|
|
4723
4883
|
/* @__PURE__ */ Z(k, {
|
|
4724
4884
|
className: "lilt-card__tiles",
|
|
4725
4885
|
"aria-label": `${e}: busiest and quietest times`,
|
|
4726
4886
|
items: [{
|
|
4727
4887
|
id: "busiest",
|
|
4728
|
-
label: H && !w ? `Busiest · ${
|
|
4888
|
+
label: H && !w ? `Busiest · ${gr(H.hour)}` : "Busiest",
|
|
4729
4889
|
color: "var(--lilt-series-1)",
|
|
4730
4890
|
value: H?.value ?? null,
|
|
4731
4891
|
formattedValue: H ? O.value(H.value) : "No data"
|
|
4732
4892
|
}, {
|
|
4733
4893
|
id: "quietest",
|
|
4734
|
-
label: U && !w ? `Quietest · ${
|
|
4894
|
+
label: U && !w ? `Quietest · ${gr(U.hour)}` : "Quietest",
|
|
4735
4895
|
color: "color-mix(in srgb, var(--lilt-series-1) 30%, transparent)",
|
|
4736
4896
|
value: U?.value ?? null,
|
|
4737
4897
|
formattedValue: U ? O.value(U.value) : "No data"
|
|
@@ -4752,4 +4912,4 @@ function gr({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
4752
4912
|
});
|
|
4753
4913
|
}
|
|
4754
4914
|
//#endregion
|
|
4755
|
-
export {
|
|
4915
|
+
export { vr as ActivityRingCard, q as AnimatedNumber, V as Annotations, M as Area, pt as AreaChartCard, te as Bar, ht as BarChartCard, $e as BoxPlot, Yn as BoxPlotCard, se as CardBadge, J as CardFrameContext, ot as ChangeComparison, c as Chart, Ke as ChartBrush, me as ChartCard, ce as ChartCardCaption, le as ChartCardDelta, pe as ChartCardHeader, fe as ChartCardRange, de as ChartCardTitle, ue as ChartCardValue, Le as ChartOverview, e as ChartPlot, ft as ChartRangeSummary, Fe as ChartReadout, Pe as ChartToolbar, jt as ComboChartCard, Ne as ComparisonDetails, Ye as ErrorBar, Xt as FunnelChartCard, A as Grid, sn as HeatmapChartCard, At as HorizontalBarChartCard, H as IntervalBand, at as Legend, T as Line, mt as LineChartCard, Ut as ProgressCard, qn as RadarChartCard, Vt as RadialChartCard, qe as RangeBar, Jn as RangeChartCard, O as ReferenceBand, N as ReferenceLine, Pn as SankeyChartCard, Sn as ScatterChartCard, sr as SlopeChartCard, wt as StatCard, m as Tooltip, k as ValueLegend, I as XAxis, P as YAxis, x as createCartesianChartModel, h as createChartController, nt as serializeChartSvg, et as summarizeBox, be as summarizeFunnelStages, K as summarizeRange, ie as toChartCsv, a as useCartesianChartModel, l as useCartesianModelState, C as useChartComparison, y as useChartState, s as useChartSync };
|