@lilt-ui/charts 0.9.0 → 0.9.1
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 +19 -0
- package/dist/cards/funnel-chart-card.d.ts +8 -1
- package/dist/cards/horizontal-bar-chart-card.d.ts +8 -1
- package/dist/cards/radial-chart-card.d.ts +28 -1
- package/dist/cards/use-card-selection.d.ts +10 -0
- package/dist/finance.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +950 -926
- package/dist/interaction/tooltip-view.d.ts +2 -0
- package/dist/{skeleton-block-9CpTCbZr.js → skeleton-block-CHH5SIAo.js} +667 -645
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +17 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, Q as g, R as _, S as v, T as y, U as ee, V as te, W as ne, X as b, Y as x, Z as S, _ as C, _t as w, at as
|
|
3
|
-
import { n as
|
|
4
|
-
import { S as Ee, _ as
|
|
5
|
-
import { a as
|
|
2
|
+
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, Q as g, R as _, S as v, T as y, U as ee, V as te, W as ne, X as b, Y as x, Z as S, _ as C, _t as w, at as re, b as ie, bt as T, c as E, ct as D, d as O, dt as k, et as A, f as ae, ft as j, g as M, gt as N, h as P, ht as F, i as I, j as L, k as R, l as z, lt as B, m as oe, mt as V, n as H, nt as se, o as ce, ot as U, p as le, pt as ue, q as de, r as fe, rt as pe, s as me, st as he, t as ge, tt as _e, u as W, ut as ve, v as ye, vt as G, w as be, x as xe, xt as Se, y as Ce, yt as we, z as Te } from "./skeleton-block-CHH5SIAo.js";
|
|
3
|
+
import { n as K, t as q } from "./chart-data-CCwLQeXa.js";
|
|
4
|
+
import { S as Ee, _ as De, b as Oe, c as J, d as ke, f as Ae, g as je, h as Me, l as Ne, m as Pe, p as Fe, u as Ie, x as Le } from "./report-context-CkzH-r8B.js";
|
|
5
|
+
import { a as Y, i as Re, n as ze, r as Be, t as Ve } from "./analysis-BJRmXHOB.js";
|
|
6
6
|
import { Fragment as He, useCallback as Ue, useEffect as We, useId as Ge, useLayoutEffect as Ke, useMemo as qe, useRef as Je, useState as X, useSyncExternalStore as Ye } from "react";
|
|
7
7
|
import { Fragment as Z, jsx as Q, jsxs as $ } from "react/jsx-runtime";
|
|
8
8
|
import { AnimatePresence as Xe, motion as Ze } from "motion/react";
|
|
@@ -119,7 +119,7 @@ function rt({ comparison: e, className: t }) {
|
|
|
119
119
|
//#endregion
|
|
120
120
|
//#region src/toolkit/chart-toolbar.tsx
|
|
121
121
|
function it({ actions: e, className: t }) {
|
|
122
|
-
let n =
|
|
122
|
+
let n = T();
|
|
123
123
|
return /* @__PURE__ */ $("div", {
|
|
124
124
|
className: ["lilt-chart__toolbar", t].filter(Boolean).join(" "),
|
|
125
125
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -139,7 +139,7 @@ function it({ actions: e, className: t }) {
|
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region src/toolkit/chart-readout.tsx
|
|
141
141
|
function at({ className: e }) {
|
|
142
|
-
let t =
|
|
142
|
+
let t = T();
|
|
143
143
|
return t.readout ? /* @__PURE__ */ Q("div", {
|
|
144
144
|
className: ["lilt-chart__readout", e].filter(Boolean).join(" "),
|
|
145
145
|
children: /* @__PURE__ */ Q("p", {
|
|
@@ -190,7 +190,7 @@ function ot({ snapshot: e, range: t, series: n }) {
|
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region src/toolkit/chart-overview.tsx
|
|
192
192
|
function st({ className: e }) {
|
|
193
|
-
let t =
|
|
193
|
+
let t = T();
|
|
194
194
|
return t.overview ? /* @__PURE__ */ Q("div", {
|
|
195
195
|
className: ["lilt-chart__overview-host", e].filter(Boolean).join(" "),
|
|
196
196
|
children: /* @__PURE__ */ Q(ot, { ...t.overview })
|
|
@@ -256,7 +256,7 @@ function ht({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
256
256
|
startX: a[e].x,
|
|
257
257
|
endX: a[t].x
|
|
258
258
|
});
|
|
259
|
-
},
|
|
259
|
+
}, re = (e) => {
|
|
260
260
|
if (e.button !== 0) return;
|
|
261
261
|
let n = e.target, r = n.closest("[data-brush-handle]"), i = r?.dataset.brushHandle, a = !!n.closest(".lilt-chart__brush-selection"), o = {
|
|
262
262
|
kind: i ?? (t && a ? "move" : "create"),
|
|
@@ -266,13 +266,13 @@ function ht({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
266
266
|
pointerId: e.pointerId
|
|
267
267
|
};
|
|
268
268
|
u.current.start(o), f([x, S]), r || g(null), r?.focus(), e.currentTarget.setPointerCapture(e.pointerId);
|
|
269
|
-
},
|
|
269
|
+
}, ie = (e) => {
|
|
270
270
|
let t = u.current.move(C(e.clientX), o);
|
|
271
271
|
t && f(t);
|
|
272
|
-
},
|
|
272
|
+
}, T = (e) => {
|
|
273
273
|
let t = u.current.finish(C(e.clientX), o);
|
|
274
274
|
f(null), t && w(...t);
|
|
275
|
-
},
|
|
275
|
+
}, E = () => {
|
|
276
276
|
u.current.cancel(), f(null);
|
|
277
277
|
};
|
|
278
278
|
We(() => {
|
|
@@ -362,11 +362,11 @@ function ht({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
362
362
|
/* @__PURE__ */ Q("div", {
|
|
363
363
|
className: "lilt-chart__brush-track",
|
|
364
364
|
"data-dragging": d ? "true" : void 0,
|
|
365
|
-
onLostPointerCapture:
|
|
366
|
-
onPointerCancel:
|
|
367
|
-
onPointerDown:
|
|
368
|
-
onPointerMove:
|
|
369
|
-
onPointerUp:
|
|
365
|
+
onLostPointerCapture: E,
|
|
366
|
+
onPointerCancel: E,
|
|
367
|
+
onPointerDown: re,
|
|
368
|
+
onPointerMove: ie,
|
|
369
|
+
onPointerUp: T,
|
|
370
370
|
ref: l,
|
|
371
371
|
children: /* @__PURE__ */ $("div", {
|
|
372
372
|
className: "lilt-chart__brush-rail",
|
|
@@ -526,7 +526,7 @@ function ht({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
526
526
|
//#endregion
|
|
527
527
|
//#region src/toolkit/chart-brush.tsx
|
|
528
528
|
function gt({ className: e }) {
|
|
529
|
-
let t =
|
|
529
|
+
let t = T();
|
|
530
530
|
return t.brush ? /* @__PURE__ */ Q("div", {
|
|
531
531
|
className: ["lilt-chart__brush-host", e].filter(Boolean).join(" "),
|
|
532
532
|
children: /* @__PURE__ */ Q(ht, { ...t.brush })
|
|
@@ -599,13 +599,13 @@ function vt(e, t = !1) {
|
|
|
599
599
|
//#endregion
|
|
600
600
|
//#region src/primitives/range-bar.tsx
|
|
601
601
|
var yt = _(function({ series: e, low: r, high: o, depth: s = !1, className: c }) {
|
|
602
|
-
let l =
|
|
602
|
+
let l = be("RangeBar", e, [r, o], "column"), u = l.snapshot.data.rows;
|
|
603
603
|
i("RangeBar", u, e, [r, o]);
|
|
604
604
|
let d = new y(), f = new a();
|
|
605
605
|
for (let { row: i, cx: a } of t(u, l.scales)) {
|
|
606
606
|
let t = n(i, e, [r, o]);
|
|
607
607
|
if (!t) continue;
|
|
608
|
-
let c =
|
|
608
|
+
let c = Te(l.descriptor, i, l.color);
|
|
609
609
|
s ? f.add(c, m(a, t[0], t[1], l.scales)) : d.add(c, p(a, t[0], t[1], l.scales));
|
|
610
610
|
}
|
|
611
611
|
return /* @__PURE__ */ Q("g", {
|
|
@@ -631,7 +631,7 @@ var yt = _(function({ series: e, low: r, high: o, depth: s = !1, className: c })
|
|
|
631
631
|
highlight: (e, { row: t, snapshot: i, descriptor: o, color: s }) => {
|
|
632
632
|
let c = n(t, e.series, [e.low, e.high]);
|
|
633
633
|
if (!c) return null;
|
|
634
|
-
let l = r(i, e.series), u =
|
|
634
|
+
let l = r(i, e.series), u = Te(o, t, s);
|
|
635
635
|
if (e.depth) {
|
|
636
636
|
let e = new a();
|
|
637
637
|
return e.add(u, m(l.x(t.x), c[0], c[1], l)), /* @__PURE__ */ Q("g", {
|
|
@@ -646,7 +646,7 @@ var yt = _(function({ series: e, low: r, high: o, depth: s = !1, className: c })
|
|
|
646
646
|
});
|
|
647
647
|
}
|
|
648
648
|
}), bt = 3.25, xt = _(function({ series: e, low: r, high: a, point: s = !0, className: c }) {
|
|
649
|
-
let l =
|
|
649
|
+
let l = be("ErrorBar", e, [r, a], "column"), u = l.snapshot.data.rows;
|
|
650
650
|
i("ErrorBar", u, e, [
|
|
651
651
|
r,
|
|
652
652
|
{ value: !0 },
|
|
@@ -654,7 +654,7 @@ var yt = _(function({ series: e, low: r, high: o, depth: s = !1, className: c })
|
|
|
654
654
|
]);
|
|
655
655
|
let d = new y(), f = new y();
|
|
656
656
|
for (let { row: i, cx: c } of t(u, l.scales)) {
|
|
657
|
-
let t = n(i, e, [r, a]), u =
|
|
657
|
+
let t = n(i, e, [r, a]), u = Te(l.descriptor, i, l.color);
|
|
658
658
|
t && d.add(u, o(c, t[0], t[1], l.scales));
|
|
659
659
|
let p = i.values[e];
|
|
660
660
|
s && p != null && f.add(u, L(c, l.scales.y(p), bt));
|
|
@@ -692,7 +692,7 @@ var yt = _(function({ series: e, low: r, high: o, depth: s = !1, className: c })
|
|
|
692
692
|
highlight: (e, { row: t, snapshot: i, descriptor: a, color: s }) => {
|
|
693
693
|
let c = n(t, e.series, [e.low, e.high]);
|
|
694
694
|
if (!c) return null;
|
|
695
|
-
let l = r(i, e.series), u = l.x(t.x), d =
|
|
695
|
+
let l = r(i, e.series), u = l.x(t.x), d = Te(a, t, s), f = t.values[e.series];
|
|
696
696
|
return /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("path", {
|
|
697
697
|
d: o(u, c[0], c[1], l),
|
|
698
698
|
fill: "none",
|
|
@@ -729,7 +729,7 @@ function Tt(e, t, n, r = 0) {
|
|
|
729
729
|
return (t.outliers?.(e.datum) ?? []).filter((e) => Number.isFinite(e)).map((e) => L(i, n.y(e) - r, St)).join("");
|
|
730
730
|
}
|
|
731
731
|
var Et = _(function(e) {
|
|
732
|
-
let { series: n, min: r, q1: o, q3: s, max: c, className: l } = e, u =
|
|
732
|
+
let { series: n, min: r, q1: o, q3: s, max: c, className: l } = e, u = be("BoxPlot", n, [
|
|
733
733
|
r,
|
|
734
734
|
o,
|
|
735
735
|
s,
|
|
@@ -746,7 +746,7 @@ var Et = _(function(e) {
|
|
|
746
746
|
for (let { row: n, cx: r } of t(d, u.scales)) {
|
|
747
747
|
let t = wt(n, e);
|
|
748
748
|
if (!t) continue;
|
|
749
|
-
let i =
|
|
749
|
+
let i = Te(u.descriptor, n, u.color), a = 0;
|
|
750
750
|
if (e.depth) {
|
|
751
751
|
let e = h(r, t, u.scales);
|
|
752
752
|
a = e.lift, p.add(Ct(i), e.faces), m.add(i, e.lower), _.add(i, e.median + e.upper);
|
|
@@ -815,7 +815,7 @@ var Et = _(function(e) {
|
|
|
815
815
|
highlight: (e, { row: t, snapshot: n, descriptor: i, color: o }) => {
|
|
816
816
|
let s = wt(t, e);
|
|
817
817
|
if (!s) return null;
|
|
818
|
-
let c = r(n, e.series), l = c.x(t.x), u = R(l, s, c), d =
|
|
818
|
+
let c = r(n, e.series), l = c.x(t.x), u = R(l, s, c), d = Te(i, t, o);
|
|
819
819
|
if (e.depth) {
|
|
820
820
|
let n = h(l, s, c), r = Tt(t, e, c, n.lift), i = new a();
|
|
821
821
|
i.add(`color-mix(in oklab, ${d} 58%, var(--lilt-surface))`, n.faces);
|
|
@@ -824,7 +824,7 @@ var Et = _(function(e) {
|
|
|
824
824
|
fill: "none",
|
|
825
825
|
strokeLinecap: t,
|
|
826
826
|
strokeWidth: 2,
|
|
827
|
-
style: { stroke:
|
|
827
|
+
style: { stroke: se(d, 12) }
|
|
828
828
|
});
|
|
829
829
|
return /* @__PURE__ */ $(Z, { children: [
|
|
830
830
|
o(n.lower, "round"),
|
|
@@ -933,9 +933,9 @@ function kt(e, t) {
|
|
|
933
933
|
//#region src/interaction/legend.tsx
|
|
934
934
|
var At = () => () => void 0, jt = () => null;
|
|
935
935
|
function Mt(e = {}) {
|
|
936
|
-
let { model: t, className: n, style: r, variant: i = "cards", swatch: a = "square", by: o = "series", series: s, interactive: c = !0, allowIsolate: l = !1, renderValue: u, renderLabel: d, renderSwatch: f, renderDifference: p, renderItem: m } = e, h =
|
|
936
|
+
let { model: t, className: n, style: r, variant: i = "cards", swatch: a = "square", by: o = "series", series: s, interactive: c = !0, allowIsolate: l = !1, renderValue: u, renderLabel: d, renderSwatch: f, renderDifference: p, renderItem: m } = e, h = we();
|
|
937
937
|
if (t && t !== h.model) throw Error("Lilt Legend model must be the model supplied to its Chart.");
|
|
938
|
-
let { legend: g } =
|
|
938
|
+
let { legend: g } = T(), _ = Ye(t?.subscribe ?? At, t?.getSnapshot ?? jt, t?.getSnapshot ?? jt);
|
|
939
939
|
if (!g) return null;
|
|
940
940
|
let v = t ? _?.legend ?? [] : g.series, y = t ? _?.inspection?.x ?? null : g.inspectedX, ee = t ? _?.inspection?.pinned ? _.inspection.x : null : g.pinnedX, te = v.filter((e) => e.visible).map((e) => e.id), ne = v.find((e) => e.id === s) ?? v.find((e) => e.visible) ?? v[0], b = t ? _?.observations ?? [] : g.observations, x = o === "observation" ? ne ? b.map((e) => ({
|
|
941
941
|
id: e.id,
|
|
@@ -1084,10 +1084,10 @@ function Nt({ data: e, label: t, series: n, className: r }) {
|
|
|
1084
1084
|
let p = d.filter((e) => e.length > 1 && l).map((e) => {
|
|
1085
1085
|
let t = i.snapshot.xToPixel(e[0].x), n = i.snapshot.xToPixel(e.at(-1).x), r = Math.max(8, (e.length - 1) * 8), a = Array.from({ length: r + 1 }, (e, i) => {
|
|
1086
1086
|
let a = t + (n - t) * i / r;
|
|
1087
|
-
return
|
|
1087
|
+
return ve(l, a);
|
|
1088
1088
|
}), o = Array.from({ length: r + 1 }, (e, i) => {
|
|
1089
1089
|
let a = n - (n - t) * i / r;
|
|
1090
|
-
return
|
|
1090
|
+
return ve(c, a);
|
|
1091
1091
|
});
|
|
1092
1092
|
if (a.some((e) => !e) || o.some((e) => !e)) return null;
|
|
1093
1093
|
let s = a.map((e, t) => `${t === 0 ? "M" : "L"}${e.x},${e.y}`), u = o.map((e) => `L${e.x},${e.y}`);
|
|
@@ -1307,14 +1307,14 @@ function Rt(e, t, n, r, i = 1, a, o, s = !0, c) {
|
|
|
1307
1307
|
//#endregion
|
|
1308
1308
|
//#region src/toolkit/chart-range-summary.tsx
|
|
1309
1309
|
function zt({ series: e, className: t }) {
|
|
1310
|
-
let n =
|
|
1310
|
+
let n = we(), r = Ye(n.controller.subscribe, () => n.controller.getSnapshot().focus, () => n.controller.getSnapshot().focus), { props: i } = n, a = Lt(i.data, i.status ?? "ready", i.resetKey), o = i.series.find((t) => t.id === (e ?? i.series[0]?.id)), s = qe(() => {
|
|
1311
1311
|
if (!o || i.x.type === "category" || !a.rows) return {
|
|
1312
1312
|
value: null,
|
|
1313
1313
|
error: null
|
|
1314
1314
|
};
|
|
1315
1315
|
try {
|
|
1316
1316
|
return {
|
|
1317
|
-
value:
|
|
1317
|
+
value: q(a.rows, {
|
|
1318
1318
|
x: i.x.accessor,
|
|
1319
1319
|
value: o.accessor,
|
|
1320
1320
|
range: r
|
|
@@ -1349,7 +1349,7 @@ function zt({ series: e, className: t }) {
|
|
|
1349
1349
|
mean: "Average",
|
|
1350
1350
|
min: "Low",
|
|
1351
1351
|
max: "High"
|
|
1352
|
-
}[e] }), /* @__PURE__ */ Q("dd", { children: c?.[e] == null ? "—" : /* @__PURE__ */ Q(
|
|
1352
|
+
}[e] }), /* @__PURE__ */ Q("dd", { children: c?.[e] == null ? "—" : /* @__PURE__ */ Q(De, {
|
|
1353
1353
|
value: c[e],
|
|
1354
1354
|
format: l,
|
|
1355
1355
|
motion: i.motion
|
|
@@ -1362,11 +1362,11 @@ function zt({ series: e, className: t }) {
|
|
|
1362
1362
|
//#endregion
|
|
1363
1363
|
//#region src/cards/area-chart-card.tsx
|
|
1364
1364
|
function Bt({ stack: e, curve: t = "smooth", ...n }) {
|
|
1365
|
-
return /* @__PURE__ */ Q(
|
|
1365
|
+
return /* @__PURE__ */ Q(H, {
|
|
1366
1366
|
...n,
|
|
1367
1367
|
shape: {
|
|
1368
1368
|
kind: "area",
|
|
1369
|
-
stack:
|
|
1369
|
+
stack: fe(e),
|
|
1370
1370
|
curve: t === "linear" ? "linear" : "monotone"
|
|
1371
1371
|
}
|
|
1372
1372
|
});
|
|
@@ -1374,7 +1374,7 @@ function Bt({ stack: e, curve: t = "smooth", ...n }) {
|
|
|
1374
1374
|
//#endregion
|
|
1375
1375
|
//#region src/cards/line-chart-card.tsx
|
|
1376
1376
|
function Vt({ curve: e = "smooth", points: t = !1, baseline: n = "auto", ...r }) {
|
|
1377
|
-
return /* @__PURE__ */ Q(
|
|
1377
|
+
return /* @__PURE__ */ Q(H, {
|
|
1378
1378
|
...r,
|
|
1379
1379
|
shape: {
|
|
1380
1380
|
kind: "line",
|
|
@@ -1387,12 +1387,12 @@ function Vt({ curve: e = "smooth", points: t = !1, baseline: n = "auto", ...r })
|
|
|
1387
1387
|
//#endregion
|
|
1388
1388
|
//#region src/cards/bar-chart-card.tsx
|
|
1389
1389
|
function Ht({ stack: e, radius: t = 6, corners: n = "end", tracks: r = !1, barWidth: i, depth: a = !1, barStyle: o = a ? "isometric" : "solid", ...s }) {
|
|
1390
|
-
return /* @__PURE__ */ Q(
|
|
1390
|
+
return /* @__PURE__ */ Q(H, {
|
|
1391
1391
|
...s,
|
|
1392
1392
|
depth: a,
|
|
1393
1393
|
shape: {
|
|
1394
1394
|
kind: "bar",
|
|
1395
|
-
stack:
|
|
1395
|
+
stack: fe(e),
|
|
1396
1396
|
radius: t,
|
|
1397
1397
|
corners: n,
|
|
1398
1398
|
tracks: r,
|
|
@@ -1556,7 +1556,7 @@ function Qt({ value: e, target: t, size: n, reduced: r, loading: i = !1, loading
|
|
|
1556
1556
|
animate: { pathLength: Math.min(1, l ?? 0) },
|
|
1557
1557
|
transition: {
|
|
1558
1558
|
duration: r ? 0 : .9,
|
|
1559
|
-
ease:
|
|
1559
|
+
ease: Oe
|
|
1560
1560
|
}
|
|
1561
1561
|
});
|
|
1562
1562
|
return /* @__PURE__ */ $("div", {
|
|
@@ -1575,7 +1575,7 @@ function Qt({ value: e, target: t, size: n, reduced: r, loading: i = !1, loading
|
|
|
1575
1575
|
viewBox: `0 0 ${n} ${n}`,
|
|
1576
1576
|
width: n,
|
|
1577
1577
|
height: n,
|
|
1578
|
-
children: /* @__PURE__ */ Q(
|
|
1578
|
+
children: /* @__PURE__ */ Q(de, {
|
|
1579
1579
|
leaving: o,
|
|
1580
1580
|
origin: "center",
|
|
1581
1581
|
children: /* @__PURE__ */ Q("g", { children: i ? /* @__PURE__ */ Q(Gt, {
|
|
@@ -1597,27 +1597,27 @@ function Qt({ value: e, target: t, size: n, reduced: r, loading: i = !1, loading
|
|
|
1597
1597
|
strokeDasharray: "1",
|
|
1598
1598
|
transform: `rotate(-90 ${n / 2} ${n / 2})`
|
|
1599
1599
|
}),
|
|
1600
|
-
children: s ?
|
|
1600
|
+
children: s ? pe(u).map((e, t) => /* @__PURE__ */ Q(He, { children: m({
|
|
1601
1601
|
width: e.strokeWidth,
|
|
1602
1602
|
transform: e.transform,
|
|
1603
|
-
stroke:
|
|
1603
|
+
stroke: se(Ut, e.amount)
|
|
1604
1604
|
}, !0) }, t)) : m(void 0, !0)
|
|
1605
1605
|
}) : s ? /* @__PURE__ */ $(Z, { children: [
|
|
1606
1606
|
/* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(S, {
|
|
1607
1607
|
id: `${p}-shadow`,
|
|
1608
1608
|
size: 2.5
|
|
1609
1609
|
}) }),
|
|
1610
|
-
|
|
1610
|
+
pe(u, "groove").map((e, t) => /* @__PURE__ */ Q(He, { children: m({
|
|
1611
1611
|
width: e.strokeWidth,
|
|
1612
1612
|
transform: e.transform,
|
|
1613
|
-
stroke:
|
|
1613
|
+
stroke: se(Yt, e.amount)
|
|
1614
1614
|
}) }, `track-${t}`)),
|
|
1615
1615
|
l ? /* @__PURE__ */ Q("g", {
|
|
1616
1616
|
filter: `url(#${p}-shadow)`,
|
|
1617
|
-
children:
|
|
1617
|
+
children: pe(u).map((e, t) => /* @__PURE__ */ Q(He, { children: h({
|
|
1618
1618
|
width: e.strokeWidth,
|
|
1619
1619
|
transform: e.transform,
|
|
1620
|
-
stroke:
|
|
1620
|
+
stroke: se(Jt, e.amount)
|
|
1621
1621
|
}) }, `fill-${t}`))
|
|
1622
1622
|
}) : null
|
|
1623
1623
|
] }) : /* @__PURE__ */ $(Z, { children: [m(), l ? h() : null] }) })
|
|
@@ -1629,8 +1629,8 @@ function Qt({ value: e, target: t, size: n, reduced: r, loading: i = !1, loading
|
|
|
1629
1629
|
});
|
|
1630
1630
|
}
|
|
1631
1631
|
var $t = (e) => e.acceptedRevision;
|
|
1632
|
-
function en({ title: e, data: t = Kt, value: n, x: r, xType: i, headline: a, aggregate: o = "sum", delta: s, deltaTone: c, caption: d, chart: p = "area", depth: m = !1, barStyle: h = m ? "isometric" : "solid", target: g, sync: _, height: v, color: y, aside: ee, valueFormat: te, locale: b, formatValue: S, formatX: C, surface:
|
|
1633
|
-
let P =
|
|
1632
|
+
function en({ title: e, data: t = Kt, value: n, x: r, xType: i, headline: a, aggregate: o = "sum", delta: s, deltaTone: c, caption: d, chart: p = "area", depth: m = !1, barStyle: h = m ? "isometric" : "solid", target: g, sync: _, height: v, color: y, aside: ee, valueFormat: te, locale: b, formatValue: S, formatX: C, surface: re = "elevated", badge: T, numberStyle: D, palette: O, loading: k = !1, motion: A, loadingStyle: ae = "shimmer", className: M, style: N }) {
|
|
1633
|
+
let P = me({
|
|
1634
1634
|
valueFormat: te,
|
|
1635
1635
|
locale: b,
|
|
1636
1636
|
formatValue: S
|
|
@@ -1650,7 +1650,7 @@ function en({ title: e, data: t = Kt, value: n, x: r, xType: i, headline: a, agg
|
|
|
1650
1650
|
type: B.kind === "time" ? "time" : "number",
|
|
1651
1651
|
accessor: B.position,
|
|
1652
1652
|
format: B.format
|
|
1653
|
-
}), [B]),
|
|
1653
|
+
}), [B]), H = qe(() => [{
|
|
1654
1654
|
id: F || "value",
|
|
1655
1655
|
label: e,
|
|
1656
1656
|
color: "var(--lilt-series-1)",
|
|
@@ -1677,22 +1677,22 @@ function en({ title: e, data: t = Kt, value: n, x: r, xType: i, headline: a, agg
|
|
|
1677
1677
|
h,
|
|
1678
1678
|
m,
|
|
1679
1679
|
P.stable
|
|
1680
|
-
]),
|
|
1680
|
+
]), se = qe(() => ({
|
|
1681
1681
|
includeZero: I,
|
|
1682
1682
|
ticks: 3
|
|
1683
|
-
}), [I]), U =
|
|
1683
|
+
}), [I]), U = V({
|
|
1684
1684
|
data: R,
|
|
1685
1685
|
x: oe,
|
|
1686
|
-
y:
|
|
1687
|
-
series:
|
|
1686
|
+
y: se,
|
|
1687
|
+
series: H,
|
|
1688
1688
|
status: k ? "loading" : "ready"
|
|
1689
1689
|
}), le = j(U, (e) => e.inspection);
|
|
1690
1690
|
ne(r ? _ : void 0, U.getController(), R, r ?? "", B, {
|
|
1691
1691
|
label: e,
|
|
1692
1692
|
release: U.actions.release
|
|
1693
1693
|
}), j(U, $t);
|
|
1694
|
-
let
|
|
1695
|
-
return /* @__PURE__ */ $(
|
|
1694
|
+
let ue = U.series.some((e) => e.id === H[0].id) ? H[0].id : null, fe = a ?? (n ? ce(E(t, F), o) : null), pe = L && le ? le.series[0]?.value ?? null : void 0, he = pe === void 0 ? fe : pe, _e = v ?? (p === "meter" ? m ? 12 : 10 : I ? 44 : 56), W = !I, ve = Ee(A ?? "auto"), ye = u(k, ve), G = x(k, ae), be = p === "ring" && g !== void 0, Se = be ? `Target ${P.value(g)}` : void 0;
|
|
1695
|
+
return /* @__PURE__ */ $(Ie, {
|
|
1696
1696
|
motion: A,
|
|
1697
1697
|
className: ["lilt-stat", M].filter(Boolean).join(" "),
|
|
1698
1698
|
style: y ? {
|
|
@@ -1700,62 +1700,62 @@ function en({ title: e, data: t = Kt, value: n, x: r, xType: i, headline: a, agg
|
|
|
1700
1700
|
"--lilt-series-1": y
|
|
1701
1701
|
} : N,
|
|
1702
1702
|
"aria-label": e,
|
|
1703
|
-
surface:
|
|
1704
|
-
badge:
|
|
1703
|
+
surface: re,
|
|
1704
|
+
badge: T,
|
|
1705
1705
|
numberStyle: D,
|
|
1706
1706
|
palette: O,
|
|
1707
|
-
children: [/* @__PURE__ */ $(
|
|
1708
|
-
aside:
|
|
1707
|
+
children: [/* @__PURE__ */ $(Fe, {
|
|
1708
|
+
aside: be ? /* @__PURE__ */ $(Z, { children: [ee, /* @__PURE__ */ Q(Qt, {
|
|
1709
1709
|
loading: k,
|
|
1710
1710
|
loadingStyle: ae,
|
|
1711
|
-
skeletonLeaving:
|
|
1712
|
-
value: k ? null :
|
|
1711
|
+
skeletonLeaving: ye,
|
|
1712
|
+
value: k ? null : fe,
|
|
1713
1713
|
target: g,
|
|
1714
1714
|
size: v ?? 56,
|
|
1715
|
-
reduced:
|
|
1715
|
+
reduced: ve,
|
|
1716
1716
|
depth: m,
|
|
1717
1717
|
formatValue: P.value
|
|
1718
1718
|
})] }) : ee,
|
|
1719
1719
|
children: [
|
|
1720
|
-
/* @__PURE__ */ Q(
|
|
1721
|
-
/* @__PURE__ */ Q(
|
|
1722
|
-
value:
|
|
1720
|
+
/* @__PURE__ */ Q(Me, { children: e }),
|
|
1721
|
+
/* @__PURE__ */ Q(je, {
|
|
1722
|
+
value: he,
|
|
1723
1723
|
format: P.value,
|
|
1724
1724
|
loading: k,
|
|
1725
1725
|
motion: A,
|
|
1726
|
-
children: k ||
|
|
1726
|
+
children: k || pe !== void 0 || s === void 0 ? null : /* @__PURE__ */ Q(Ae, {
|
|
1727
1727
|
value: s,
|
|
1728
1728
|
tone: c
|
|
1729
1729
|
})
|
|
1730
1730
|
}),
|
|
1731
|
-
d || r ||
|
|
1731
|
+
d || r || Se ? /* @__PURE__ */ Q("p", {
|
|
1732
1732
|
className: "lilt-stat__caption",
|
|
1733
|
-
children: k ? "" :
|
|
1733
|
+
children: k ? "" : pe === void 0 ? d ?? Se ?? "" : le?.formattedX ?? ""
|
|
1734
1734
|
}) : null
|
|
1735
1735
|
]
|
|
1736
|
-
}), p === "meter" && g !== void 0 ? /* @__PURE__ */ Q(
|
|
1737
|
-
leaving:
|
|
1736
|
+
}), p === "meter" && g !== void 0 ? /* @__PURE__ */ Q(de, {
|
|
1737
|
+
leaving: ye,
|
|
1738
1738
|
origin: "left",
|
|
1739
1739
|
children: k ? /* @__PURE__ */ $("div", {
|
|
1740
|
-
ref:
|
|
1740
|
+
ref: G,
|
|
1741
1741
|
className: "lilt-stat__meter lilt-skeleton",
|
|
1742
1742
|
"aria-hidden": "true",
|
|
1743
1743
|
"data-style": ae,
|
|
1744
1744
|
"data-depth": m || void 0,
|
|
1745
|
-
"data-reduced-motion":
|
|
1746
|
-
children: [/* @__PURE__ */ Q(
|
|
1745
|
+
"data-reduced-motion": ve || void 0,
|
|
1746
|
+
children: [/* @__PURE__ */ Q(ge, { height: _e }), /* @__PURE__ */ $("div", {
|
|
1747
1747
|
className: "lilt-stat__meter-labels",
|
|
1748
1748
|
children: [/* @__PURE__ */ Q("span", { children: "—" }), /* @__PURE__ */ Q("span", { children: "—" })]
|
|
1749
1749
|
})]
|
|
1750
1750
|
}) : /* @__PURE__ */ Q(Zt, {
|
|
1751
|
-
value:
|
|
1751
|
+
value: fe,
|
|
1752
1752
|
target: g,
|
|
1753
|
-
height:
|
|
1753
|
+
height: _e,
|
|
1754
1754
|
depth: m,
|
|
1755
1755
|
formatValue: P.value
|
|
1756
1756
|
})
|
|
1757
1757
|
}) : L ? /* @__PURE__ */ Q(w, {
|
|
1758
|
-
className:
|
|
1758
|
+
className: W ? "lilt-card__chart lilt-card__chart--bleed lilt-stat__chart" : "lilt-card__chart lilt-stat__chart",
|
|
1759
1759
|
"aria-label": `${e} trend`,
|
|
1760
1760
|
model: U,
|
|
1761
1761
|
motion: A,
|
|
@@ -1763,7 +1763,7 @@ function en({ title: e, data: t = Kt, value: n, x: r, xType: i, headline: a, agg
|
|
|
1763
1763
|
loadingStyle: ae,
|
|
1764
1764
|
children: /* @__PURE__ */ $(f, {
|
|
1765
1765
|
model: U,
|
|
1766
|
-
height:
|
|
1766
|
+
height: _e,
|
|
1767
1767
|
margins: {
|
|
1768
1768
|
top: 4,
|
|
1769
1769
|
right: 0,
|
|
@@ -1779,24 +1779,42 @@ function en({ title: e, data: t = Kt, value: n, x: r, xType: i, headline: a, agg
|
|
|
1779
1779
|
runoff: !0,
|
|
1780
1780
|
axisInset: 20
|
|
1781
1781
|
},
|
|
1782
|
-
children: [p === "area" &&
|
|
1782
|
+
children: [p === "area" && ue ? /* @__PURE__ */ Q(l, {
|
|
1783
1783
|
model: U,
|
|
1784
|
-
series:
|
|
1785
|
-
}) : null,
|
|
1784
|
+
series: ue
|
|
1785
|
+
}) : null, ue ? Q(I ? ie : xe, {
|
|
1786
1786
|
model: U,
|
|
1787
|
-
series:
|
|
1787
|
+
series: ue
|
|
1788
1788
|
}) : null]
|
|
1789
1789
|
})
|
|
1790
1790
|
}) : null]
|
|
1791
1791
|
});
|
|
1792
1792
|
}
|
|
1793
1793
|
//#endregion
|
|
1794
|
+
//#region src/cards/use-card-selection.ts
|
|
1795
|
+
function tn(e, t, n, r) {
|
|
1796
|
+
let i = e !== void 0, [a, o] = X(null), s = i ? e : a, c = s !== null && n.includes(s) ? s : null, l = Je(c);
|
|
1797
|
+
l.current = c;
|
|
1798
|
+
let u = Je(t);
|
|
1799
|
+
return u.current = t, We(() => {
|
|
1800
|
+
i && r && e !== null && !n.includes(e) && u.current?.(null);
|
|
1801
|
+
}, [
|
|
1802
|
+
i,
|
|
1803
|
+
r,
|
|
1804
|
+
e,
|
|
1805
|
+
n
|
|
1806
|
+
]), [c, (e) => {
|
|
1807
|
+
let t = typeof e == "function" ? e(l.current) : e;
|
|
1808
|
+
i || o(t), t !== l.current && u.current?.(t);
|
|
1809
|
+
}];
|
|
1810
|
+
}
|
|
1811
|
+
//#endregion
|
|
1794
1812
|
//#region src/cards/rank.ts
|
|
1795
|
-
var
|
|
1813
|
+
var nn = "\0other", rn = new Intl.NumberFormat("en-US", {
|
|
1796
1814
|
style: "percent",
|
|
1797
1815
|
maximumFractionDigits: 0
|
|
1798
1816
|
});
|
|
1799
|
-
function
|
|
1817
|
+
function an(e, t, n, r, i, a) {
|
|
1800
1818
|
let o = (e) => e[n], s = Be(ze(e, {
|
|
1801
1819
|
id: (e) => String(e[t] ?? ""),
|
|
1802
1820
|
label: (e) => String(e[t] ?? "")
|
|
@@ -1811,13 +1829,13 @@ function rn(e, t, n, r, i, a) {
|
|
|
1811
1829
|
if (i === void 0 || i < 1 || s.length <= i + 1) return s;
|
|
1812
1830
|
let c = s.slice(i).flatMap((e) => e.value === null ? [] : [e.value]);
|
|
1813
1831
|
return [...s.slice(0, i), {
|
|
1814
|
-
id:
|
|
1832
|
+
id: nn,
|
|
1815
1833
|
label: a,
|
|
1816
1834
|
value: c.length ? c.reduce((e, t) => e + t, 0) : null,
|
|
1817
1835
|
other: !0
|
|
1818
1836
|
}];
|
|
1819
1837
|
}
|
|
1820
|
-
function
|
|
1838
|
+
function on(e) {
|
|
1821
1839
|
let t = e.flatMap((e) => e.value === null ? [] : [e.value]), n = t.reduce((e, t) => e + t, 0);
|
|
1822
1840
|
return {
|
|
1823
1841
|
observed: t.length,
|
|
@@ -1827,16 +1845,16 @@ function an(e) {
|
|
|
1827
1845
|
}
|
|
1828
1846
|
//#endregion
|
|
1829
1847
|
//#region src/cards/horizontal-bar-chart-card.tsx
|
|
1830
|
-
var
|
|
1831
|
-
function
|
|
1832
|
-
let
|
|
1848
|
+
var sn = [];
|
|
1849
|
+
function cn({ title: e, data: t, category: n, value: r, headline: i, delta: a, deltaTone: o, range: s, ranges: c, defaultRange: l, sort: f = "descending", limit: p, otherLabel: m = "Other", share: h = !0, rank: g = !1, depth: _ = !1, barStyle: v = _ ? "isometric" : "inline", valueFormat: y, locale: ee, formatValue: te, color: ne, surface: b = "elevated", badge: S, numberStyle: C, palette: w, selected: re, onSelectedChange: ie, loading: T = !1, loadingStyle: E = "shimmer", motion: D = "auto", className: O, style: k }) {
|
|
1850
|
+
let A = Ee(D), ae = x(T, E), j = u(T, A), M = me({
|
|
1833
1851
|
valueFormat: y,
|
|
1834
1852
|
locale: ee,
|
|
1835
1853
|
formatValue: te
|
|
1836
|
-
}), [
|
|
1854
|
+
}), [N, P] = X(l ?? c?.[0]?.id), F = c?.find((e) => e.id === N) ?? c?.[0], I = F?.data ?? t ?? sn, L = F ? F.delta : a, R = qe(() => {
|
|
1837
1855
|
try {
|
|
1838
1856
|
return {
|
|
1839
|
-
rows:
|
|
1857
|
+
rows: an(I, n, r, f, p, m),
|
|
1840
1858
|
error: null
|
|
1841
1859
|
};
|
|
1842
1860
|
} catch (e) {
|
|
@@ -1846,123 +1864,123 @@ function sn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1846
1864
|
};
|
|
1847
1865
|
}
|
|
1848
1866
|
}, [
|
|
1849
|
-
|
|
1867
|
+
I,
|
|
1850
1868
|
n,
|
|
1851
1869
|
r,
|
|
1852
1870
|
f,
|
|
1853
1871
|
p,
|
|
1854
1872
|
m
|
|
1855
|
-
]),
|
|
1873
|
+
]), z = R.rows, B = on(z), oe = B.total, V = h && B.shareable, H = qe(() => Y(z.map((e) => ({
|
|
1856
1874
|
...e,
|
|
1857
1875
|
datum: e
|
|
1858
|
-
}))), [
|
|
1876
|
+
}))), [z]), [se, ce] = X(null), [U, le] = X(null), [ue, fe] = tn(re, ie, qe(() => z.map((e) => e.id), [z]), !T && R.error === null), pe = ue ?? U ?? se, _e = z.find((e) => e.id === pe), W = Je(/* @__PURE__ */ new Map()), ve = It({
|
|
1859
1877
|
resolve: Ft,
|
|
1860
|
-
onGlide:
|
|
1861
|
-
onLift: (e) => e !== null &&
|
|
1862
|
-
}),
|
|
1878
|
+
onGlide: ce,
|
|
1879
|
+
onLift: (e) => e !== null && fe(e)
|
|
1880
|
+
}), ye = F?.headline ?? i ?? (B.observed ? oe : null), G = (e) => V && e !== null ? rn.format(e / oe) : null, be = (e, t) => {
|
|
1863
1881
|
let n = t;
|
|
1864
|
-
if (e.key === "ArrowDown") n = Math.min(
|
|
1882
|
+
if (e.key === "ArrowDown") n = Math.min(z.length - 1, t + 1);
|
|
1865
1883
|
else if (e.key === "ArrowUp") n = Math.max(0, t - 1);
|
|
1866
1884
|
else if (e.key === "Home") n = 0;
|
|
1867
|
-
else if (e.key === "End") n =
|
|
1885
|
+
else if (e.key === "End") n = z.length - 1;
|
|
1868
1886
|
else if (e.key === "Escape") {
|
|
1869
|
-
|
|
1887
|
+
fe(null);
|
|
1870
1888
|
return;
|
|
1871
1889
|
} else return;
|
|
1872
|
-
e.preventDefault(),
|
|
1873
|
-
},
|
|
1874
|
-
duration:
|
|
1875
|
-
ease:
|
|
1876
|
-
},
|
|
1877
|
-
...
|
|
1890
|
+
e.preventDefault(), W.current.get(z[n].id)?.focus();
|
|
1891
|
+
}, xe = {
|
|
1892
|
+
duration: A ? 0 : .5,
|
|
1893
|
+
ease: Oe
|
|
1894
|
+
}, Se = ne ? {
|
|
1895
|
+
...k,
|
|
1878
1896
|
"--lilt-series-1": ne
|
|
1879
|
-
} :
|
|
1880
|
-
return /* @__PURE__ */ $(
|
|
1881
|
-
motion:
|
|
1882
|
-
className: ["lilt-list",
|
|
1883
|
-
style:
|
|
1897
|
+
} : k;
|
|
1898
|
+
return /* @__PURE__ */ $(Ie, {
|
|
1899
|
+
motion: D,
|
|
1900
|
+
className: ["lilt-list", O].filter(Boolean).join(" "),
|
|
1901
|
+
style: Se,
|
|
1884
1902
|
"aria-label": e,
|
|
1885
1903
|
surface: b,
|
|
1886
1904
|
badge: S,
|
|
1887
1905
|
numberStyle: C,
|
|
1888
1906
|
palette: w,
|
|
1889
|
-
children: [/* @__PURE__ */ $(
|
|
1890
|
-
aside: c || s ? /* @__PURE__ */ Q(
|
|
1907
|
+
children: [/* @__PURE__ */ $(Fe, {
|
|
1908
|
+
aside: c || s ? /* @__PURE__ */ Q(Pe, {
|
|
1891
1909
|
label: s,
|
|
1892
1910
|
options: c?.map(({ id: e, label: t }) => ({
|
|
1893
1911
|
id: e,
|
|
1894
1912
|
label: t
|
|
1895
1913
|
})),
|
|
1896
|
-
value:
|
|
1897
|
-
onValueChange:
|
|
1914
|
+
value: F?.id,
|
|
1915
|
+
onValueChange: P
|
|
1898
1916
|
}) : null,
|
|
1899
|
-
children: [/* @__PURE__ */ Q(
|
|
1900
|
-
value:
|
|
1901
|
-
format:
|
|
1917
|
+
children: [/* @__PURE__ */ Q(Me, { children: e }), /* @__PURE__ */ Q(je, {
|
|
1918
|
+
value: _e ? _e.value : ye,
|
|
1919
|
+
format: M.value,
|
|
1902
1920
|
loading: T,
|
|
1903
|
-
motion:
|
|
1904
|
-
children: T ? null :
|
|
1905
|
-
value:
|
|
1921
|
+
motion: D,
|
|
1922
|
+
children: T ? null : _e ? /* @__PURE__ */ $(ke, { children: [_e.label, G(_e.value) ? ` · ${G(_e.value)}` : ""] }) : L === void 0 ? null : /* @__PURE__ */ Q(Ae, {
|
|
1923
|
+
value: L,
|
|
1906
1924
|
tone: o
|
|
1907
1925
|
})
|
|
1908
1926
|
})]
|
|
1909
|
-
}), /* @__PURE__ */ Q(
|
|
1910
|
-
leaving:
|
|
1927
|
+
}), /* @__PURE__ */ Q(de, {
|
|
1928
|
+
leaving: j,
|
|
1911
1929
|
origin: "left",
|
|
1912
1930
|
children: T ? /* @__PURE__ */ Q("div", {
|
|
1913
|
-
ref:
|
|
1931
|
+
ref: ae,
|
|
1914
1932
|
className: "lilt-list__rows lilt-skeleton",
|
|
1915
1933
|
"aria-hidden": "true",
|
|
1916
|
-
"data-style":
|
|
1934
|
+
"data-style": E,
|
|
1917
1935
|
"data-depth": v === "isometric" || void 0,
|
|
1918
|
-
"data-reduced-motion":
|
|
1936
|
+
"data-reduced-motion": A || void 0,
|
|
1919
1937
|
children: Array.from({ length: Math.min(p ? p + 1 : 5, 8) }, (e, t) => /* @__PURE__ */ Q("div", {
|
|
1920
1938
|
className: "lilt-list__skeleton",
|
|
1921
|
-
children: /* @__PURE__ */ Q(
|
|
1939
|
+
children: /* @__PURE__ */ Q(ge, {
|
|
1922
1940
|
width: `${88 - t * 13}%`,
|
|
1923
1941
|
step: t
|
|
1924
1942
|
})
|
|
1925
1943
|
}, t))
|
|
1926
|
-
}) :
|
|
1927
|
-
kind:
|
|
1928
|
-
message:
|
|
1944
|
+
}) : z.length === 0 || R.error ? /* @__PURE__ */ Q(d, {
|
|
1945
|
+
kind: R.error ? "error" : "empty",
|
|
1946
|
+
message: R.error ?? "No rows for this period."
|
|
1929
1947
|
}) : /* @__PURE__ */ Q("ol", {
|
|
1930
|
-
ref:
|
|
1948
|
+
ref: ve,
|
|
1931
1949
|
className: "lilt-list__rows",
|
|
1932
1950
|
"data-lilt-glide": "",
|
|
1933
1951
|
"data-style": v,
|
|
1934
|
-
"data-share":
|
|
1952
|
+
"data-share": V || void 0,
|
|
1935
1953
|
"data-rank": g || void 0,
|
|
1936
1954
|
"aria-label": `${e} ranking`,
|
|
1937
1955
|
children: /* @__PURE__ */ Q(Xe, {
|
|
1938
1956
|
initial: !1,
|
|
1939
|
-
children:
|
|
1940
|
-
let n = Re(e.value,
|
|
1957
|
+
children: z.map((e, t) => {
|
|
1958
|
+
let n = Re(e.value, H), r = e.id === _e?.id, i = G(e.value), a = A ? 0 : he(t, z.length, 120) / 1e3;
|
|
1941
1959
|
return /* @__PURE__ */ Q(Ze.li, {
|
|
1942
|
-
layout: !
|
|
1960
|
+
layout: !A && "position",
|
|
1943
1961
|
"data-active": r || void 0,
|
|
1944
|
-
"data-muted":
|
|
1962
|
+
"data-muted": _e && !r || void 0,
|
|
1945
1963
|
"data-other": e.other || void 0,
|
|
1946
|
-
initial: !
|
|
1964
|
+
initial: !A && { opacity: 0 },
|
|
1947
1965
|
animate: { opacity: 1 },
|
|
1948
1966
|
exit: { opacity: 0 },
|
|
1949
|
-
transition:
|
|
1967
|
+
transition: xe,
|
|
1950
1968
|
children: /* @__PURE__ */ $("button", {
|
|
1951
1969
|
type: "button",
|
|
1952
1970
|
className: "lilt-list__row",
|
|
1953
1971
|
"data-glide-id": e.id,
|
|
1954
1972
|
ref: (t) => {
|
|
1955
|
-
t ?
|
|
1973
|
+
t ? W.current.set(e.id, t) : W.current.delete(e.id);
|
|
1956
1974
|
},
|
|
1957
|
-
tabIndex: e.id === (
|
|
1958
|
-
"aria-label": `${e.label}: ${e.value === null ? "No data" :
|
|
1959
|
-
"aria-pressed":
|
|
1960
|
-
onPointerEnter: () =>
|
|
1961
|
-
onPointerLeave: () =>
|
|
1962
|
-
onFocus: () =>
|
|
1963
|
-
onBlur: () =>
|
|
1964
|
-
onClick: () =>
|
|
1965
|
-
onKeyDown: (e) =>
|
|
1975
|
+
tabIndex: e.id === (U ?? z[0]?.id) ? 0 : -1,
|
|
1976
|
+
"aria-label": `${e.label}: ${e.value === null ? "No data" : M.value(e.value)}${i ? `, ${i} of total` : ""}`,
|
|
1977
|
+
"aria-pressed": ue === e.id,
|
|
1978
|
+
onPointerEnter: () => ce(e.id),
|
|
1979
|
+
onPointerLeave: () => ce(null),
|
|
1980
|
+
onFocus: () => le(e.id),
|
|
1981
|
+
onBlur: () => le(null),
|
|
1982
|
+
onClick: () => fe((t) => t === e.id ? null : e.id),
|
|
1983
|
+
onKeyDown: (e) => be(e, t),
|
|
1966
1984
|
children: [
|
|
1967
1985
|
g ? /* @__PURE__ */ Q("span", {
|
|
1968
1986
|
className: "lilt-list__rank",
|
|
@@ -1972,14 +1990,14 @@ function sn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1972
1990
|
/* @__PURE__ */ $("span", {
|
|
1973
1991
|
className: "lilt-list__bar-area",
|
|
1974
1992
|
children: [
|
|
1975
|
-
|
|
1993
|
+
H[0] < 0 ? /* @__PURE__ */ Q("span", {
|
|
1976
1994
|
className: "lilt-list__zero",
|
|
1977
1995
|
style: { left: `${n.zero}%` }
|
|
1978
1996
|
}) : null,
|
|
1979
1997
|
e.value === null ? null : /* @__PURE__ */ Q(Ze.span, {
|
|
1980
1998
|
className: "lilt-list__bar",
|
|
1981
1999
|
"data-negative": e.value < 0 || void 0,
|
|
1982
|
-
initial: !
|
|
2000
|
+
initial: !A && {
|
|
1983
2001
|
left: `${n.zero}%`,
|
|
1984
2002
|
width: "0%"
|
|
1985
2003
|
},
|
|
@@ -1988,7 +2006,7 @@ function sn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1988
2006
|
width: `${n.width}%`
|
|
1989
2007
|
},
|
|
1990
2008
|
transition: {
|
|
1991
|
-
...
|
|
2009
|
+
...xe,
|
|
1992
2010
|
delay: a
|
|
1993
2011
|
}
|
|
1994
2012
|
}),
|
|
@@ -2003,9 +2021,9 @@ function sn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
2003
2021
|
children: e.value === null ? /* @__PURE__ */ Q("span", {
|
|
2004
2022
|
className: "lilt-list__missing",
|
|
2005
2023
|
children: "No data"
|
|
2006
|
-
}) :
|
|
2024
|
+
}) : M.value(e.value)
|
|
2007
2025
|
}),
|
|
2008
|
-
|
|
2026
|
+
V ? /* @__PURE__ */ Q("span", {
|
|
2009
2027
|
className: "lilt-list__share",
|
|
2010
2028
|
children: i ?? "—"
|
|
2011
2029
|
}) : null
|
|
@@ -2020,9 +2038,9 @@ function sn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
2020
2038
|
}
|
|
2021
2039
|
//#endregion
|
|
2022
2040
|
//#region src/cards/combo-chart-card.tsx
|
|
2023
|
-
function
|
|
2041
|
+
function ln({ bars: e, lines: t, lineScale: n = "shared", stack: r, radius: i = 6, corners: a = "end", tracks: o = !1, barWidth: s, depth: c = !1, barStyle: l = c ? "isometric" : "solid", curve: u = "smooth", points: d = !0, aggregate: f = "sum", pillPosition: p, ...m }) {
|
|
2024
2042
|
let h = n === "own";
|
|
2025
|
-
return /* @__PURE__ */ Q(
|
|
2043
|
+
return /* @__PURE__ */ Q(H, {
|
|
2026
2044
|
...m,
|
|
2027
2045
|
depth: c,
|
|
2028
2046
|
aggregate: f,
|
|
@@ -2035,7 +2053,7 @@ function cn({ bars: e, lines: t, lineScale: n = "shared", stack: r, radius: i =
|
|
|
2035
2053
|
}))],
|
|
2036
2054
|
shape: {
|
|
2037
2055
|
kind: "bar",
|
|
2038
|
-
stack:
|
|
2056
|
+
stack: fe(r),
|
|
2039
2057
|
radius: i,
|
|
2040
2058
|
corners: a,
|
|
2041
2059
|
tracks: o,
|
|
@@ -2048,36 +2066,36 @@ function cn({ bars: e, lines: t, lineScale: n = "shared", stack: r, radius: i =
|
|
|
2048
2066
|
}
|
|
2049
2067
|
//#endregion
|
|
2050
2068
|
//#region src/cards/radial-chart-card.tsx
|
|
2051
|
-
var
|
|
2052
|
-
function
|
|
2069
|
+
var un = [], dn = 92, fn = 98, pn = Math.PI * 2, mn = .94, hn = "color-mix(in oklab, var(--lilt-muted) 13%, var(--lilt-surface))";
|
|
2070
|
+
function gn(e) {
|
|
2053
2071
|
let t = e.reduce((e, t) => e + Math.max(0, t.value ?? 0), 0), n = 0;
|
|
2054
2072
|
return e.flatMap((e) => {
|
|
2055
2073
|
if (e.value === null || t <= 0) return [];
|
|
2056
2074
|
let r = n;
|
|
2057
|
-
return n += Math.max(0, e.value) / t *
|
|
2075
|
+
return n += Math.max(0, e.value) / t * pn, [{
|
|
2058
2076
|
id: e.id,
|
|
2059
2077
|
startAngle: r,
|
|
2060
2078
|
endAngle: n
|
|
2061
2079
|
}];
|
|
2062
2080
|
});
|
|
2063
2081
|
}
|
|
2064
|
-
function
|
|
2082
|
+
function _n(e) {
|
|
2065
2083
|
if (!(e > 0)) return 1;
|
|
2066
2084
|
let t = 10 ** Math.floor(Math.log10(e)) / 4;
|
|
2067
2085
|
return Math.ceil(e * 1.05 / t) * t;
|
|
2068
2086
|
}
|
|
2069
|
-
function
|
|
2070
|
-
let t =
|
|
2087
|
+
function vn(e) {
|
|
2088
|
+
let t = _n(Math.max(0, ...e.map((e) => e.value ?? 0)));
|
|
2071
2089
|
return e.flatMap((e) => e.value === null ? [] : [{
|
|
2072
2090
|
id: e.id,
|
|
2073
2091
|
startAngle: 0,
|
|
2074
|
-
endAngle: Math.max(0, e.value) / t *
|
|
2092
|
+
endAngle: Math.max(0, e.value) / t * pn
|
|
2075
2093
|
}]);
|
|
2076
2094
|
}
|
|
2077
|
-
function
|
|
2095
|
+
function yn(e) {
|
|
2078
2096
|
return 1 - (1 - e) ** 2;
|
|
2079
2097
|
}
|
|
2080
|
-
function
|
|
2098
|
+
function bn(e, t, n) {
|
|
2081
2099
|
let r = new Map(e.map((e) => [e.id, e]));
|
|
2082
2100
|
return t.map((e) => {
|
|
2083
2101
|
let t = r.get(e.id) ?? {
|
|
@@ -2091,14 +2109,14 @@ function yn(e, t, n) {
|
|
|
2091
2109
|
};
|
|
2092
2110
|
});
|
|
2093
2111
|
}
|
|
2094
|
-
function
|
|
2095
|
-
let
|
|
2112
|
+
function xn({ title: e, data: t, category: n, value: r, variant: i = "donut", depth: a = !1, legend: o = i === "rings" ? "tiles" : i === "semi" ? "inline" : "list", legendSwatch: s, headline: c, delta: l, deltaTone: f, range: p, ranges: m, defaultRange: h, limit: g = 5, otherLabel: _ = "Other", sort: v = "descending", valueFormat: y, locale: ee, formatValue: te, surface: ne = "elevated", badge: b, numberStyle: x, palette: C, selected: w, onSelectedChange: re, colors: ie, center: T, loading: E = !1, loadingStyle: D = "shimmer", motion: O = "auto", className: k, style: A }) {
|
|
2113
|
+
let ae = Ee(O), j = u(E, ae), M = E || j, N = me({
|
|
2096
2114
|
valueFormat: y,
|
|
2097
2115
|
locale: ee,
|
|
2098
2116
|
formatValue: te
|
|
2099
|
-
}), [
|
|
2117
|
+
}), [P, F] = X(h ?? m?.[0]?.id), I = m?.find((e) => e.id === P) ?? m?.[0], L = I?.data ?? t ?? un, R = I ? I.delta : l, z = `lilt-radial-depth-${Ge().replace(/:/g, "")}`, B = qe(() => {
|
|
2100
2118
|
try {
|
|
2101
|
-
let e =
|
|
2119
|
+
let e = an(L, n, r, v, g, _), t = e.find((e) => e.value !== null && e.value < 0);
|
|
2102
2120
|
if (t) throw Error(`Slices can’t be negative, and “${t.label}” is below zero.`);
|
|
2103
2121
|
return {
|
|
2104
2122
|
rows: e,
|
|
@@ -2111,85 +2129,85 @@ function bn({ title: e, data: t, category: n, value: r, variant: i = "donut", de
|
|
|
2111
2129
|
};
|
|
2112
2130
|
}
|
|
2113
2131
|
}, [
|
|
2114
|
-
|
|
2132
|
+
L,
|
|
2115
2133
|
n,
|
|
2116
2134
|
r,
|
|
2117
2135
|
v,
|
|
2118
2136
|
g,
|
|
2119
2137
|
_
|
|
2120
|
-
]),
|
|
2121
|
-
for (let e of
|
|
2122
|
-
let W = i === "rings",
|
|
2138
|
+
]), V = B.rows, [H, ce] = X([]), U = qe(() => V.filter((e) => !H.includes(e.id)), [V, H]), { total: ue, observed: fe } = on(U), he = Je(/* @__PURE__ */ new Map()), ge = (e) => ie?.[e] || (V.find((t) => t.id === e)?.other ? "var(--lilt-reference)" : (he.current.has(e) || he.current.set(e, he.current.size % 6), `var(--lilt-series-${he.current.get(e) + 1})`));
|
|
2139
|
+
for (let e of V) !e.other && !ie?.[e.id] && ge(e.id);
|
|
2140
|
+
let W = i === "rings", ve = i === "semi", ye = qe(() => W ? vn(U) : gn(U), [U, W]), [G, be] = X({
|
|
2123
2141
|
key: 0,
|
|
2124
2142
|
from: [],
|
|
2125
|
-
to:
|
|
2143
|
+
to: ye,
|
|
2126
2144
|
initial: !0
|
|
2127
|
-
}),
|
|
2128
|
-
|
|
2129
|
-
key:
|
|
2130
|
-
from:
|
|
2131
|
-
to:
|
|
2132
|
-
initial:
|
|
2145
|
+
}), xe = Je([]);
|
|
2146
|
+
G.to !== ye && be({
|
|
2147
|
+
key: G.key + 1,
|
|
2148
|
+
from: xe.current,
|
|
2149
|
+
to: ye,
|
|
2150
|
+
initial: xe.current.length === 0
|
|
2133
2151
|
});
|
|
2134
|
-
let
|
|
2135
|
-
key:
|
|
2136
|
-
active: !
|
|
2137
|
-
duration:
|
|
2138
|
-
},
|
|
2139
|
-
let n = W ?
|
|
2152
|
+
let Se = Le({
|
|
2153
|
+
key: G.key,
|
|
2154
|
+
active: !M,
|
|
2155
|
+
duration: G.initial ? 900 : 480
|
|
2156
|
+
}, ae), Ce = Se < 1, we = .09, Te = (e) => W && G.initial ? Math.max(0, Math.min(1, (Se - e * we) / (1 - (ye.length - 1) * we || 1))) : Se, K = G.initial ? G.to.map((e, t) => {
|
|
2157
|
+
let n = W ? yn(Te(t)) : Se;
|
|
2140
2158
|
return {
|
|
2141
2159
|
...e,
|
|
2142
2160
|
startAngle: e.startAngle * n,
|
|
2143
2161
|
endAngle: e.endAngle * n
|
|
2144
2162
|
};
|
|
2145
|
-
}) :
|
|
2146
|
-
|
|
2147
|
-
let [
|
|
2163
|
+
}) : bn(G.from, G.to, Se);
|
|
2164
|
+
xe.current = K;
|
|
2165
|
+
let [q, De] = X(null), [Oe, J] = X(null), [Ne, Y] = tn(w, re, qe(() => U.map((e) => e.id), [U]), !E && B.error === null), Re = Ne ?? Oe ?? q, ze = U.find((e) => e.id === Re), Be = Je(/* @__PURE__ */ new Map()), Ve = It({
|
|
2148
2166
|
resolve: Ft,
|
|
2149
|
-
onGlide:
|
|
2150
|
-
onLift: (e) => e !== null &&
|
|
2151
|
-
disabled:
|
|
2152
|
-
}),
|
|
2153
|
-
|
|
2154
|
-
},
|
|
2167
|
+
onGlide: De,
|
|
2168
|
+
onLift: (e) => e !== null && Y(e),
|
|
2169
|
+
disabled: E
|
|
2170
|
+
}), He = (e) => e && e.value !== null && ue > 0 && !H.includes(e.id) ? rn.format(e.value / ue) : null, Ue = U.find((e) => e.value !== null && !e.other), We = (e) => {
|
|
2171
|
+
ce(e), De(null), Y(null);
|
|
2172
|
+
}, Ke = (e) => H.includes(e) ? We(H.filter((t) => t !== e)) : U.length > 1 ? We([...H, e]) : void 0, Ye = ze ?? Ue, Xe = i === "donut" ? 62 : ve ? 64 : 0, Ze = (e) => $e().innerRadius(Xe).outerRadius(e).cornerRadius(i === "donut" ? 3 : ve ? 14 : 0).padAngle(K.length > 1 ? ve ? .05 : .012 : 0), Qe = Ze(dn), et = Ze(fn), tt = (e) => ({
|
|
2155
2173
|
...e,
|
|
2156
2174
|
startAngle: -Math.PI / 2 + e.startAngle / 2,
|
|
2157
2175
|
endAngle: -Math.PI / 2 + e.endAngle / 2
|
|
2158
|
-
}),
|
|
2176
|
+
}), nt = Math.max(1, ye.length), rt = Math.min(9, 62 / nt - 4), it = (e, t = 0) => $e().innerRadius(dn - e * (rt + 4) - rt - t / 2).outerRadius(dn - e * (rt + 4) + t / 2).cornerRadius(rt), at = (e) => ({
|
|
2159
2177
|
"data-glide-id": e,
|
|
2160
|
-
onPointerEnter: () =>
|
|
2161
|
-
onPointerLeave: () =>
|
|
2162
|
-
onClick: () =>
|
|
2163
|
-
}),
|
|
2164
|
-
let n = e.id ===
|
|
2178
|
+
onPointerEnter: () => De(e),
|
|
2179
|
+
onPointerLeave: () => De(null),
|
|
2180
|
+
onClick: () => Y((t) => t === e ? null : e)
|
|
2181
|
+
}), ot = W ? K.map((e, t) => {
|
|
2182
|
+
let n = e.id === ze?.id;
|
|
2165
2183
|
return {
|
|
2166
2184
|
slice: e,
|
|
2167
2185
|
isActive: n,
|
|
2168
|
-
muted:
|
|
2169
|
-
band:
|
|
2186
|
+
muted: ze && !n || void 0,
|
|
2187
|
+
band: it(t)({
|
|
2170
2188
|
id: e.id,
|
|
2171
2189
|
startAngle: 0,
|
|
2172
|
-
endAngle:
|
|
2190
|
+
endAngle: pn
|
|
2173
2191
|
}) ?? "",
|
|
2174
|
-
path: e.endAngle > 0 ?
|
|
2175
|
-
color:
|
|
2192
|
+
path: e.endAngle > 0 ? it(t, n ? 3 : 0)(e) : null,
|
|
2193
|
+
color: ge(e.id)
|
|
2176
2194
|
};
|
|
2177
|
-
}) : [],
|
|
2178
|
-
let t = e.id ===
|
|
2195
|
+
}) : [], st = W ? [] : K.flatMap((e) => {
|
|
2196
|
+
let t = e.id === ze?.id, n = ve ? tt(e) : e, r = (t ? et : Qe)(n);
|
|
2179
2197
|
return r ? [{
|
|
2180
2198
|
slice: e,
|
|
2181
2199
|
isActive: t,
|
|
2182
|
-
muted:
|
|
2200
|
+
muted: ze && !t || void 0,
|
|
2183
2201
|
angles: n,
|
|
2184
2202
|
path: r,
|
|
2185
|
-
color:
|
|
2203
|
+
color: ge(e.id)
|
|
2186
2204
|
}] : [];
|
|
2187
|
-
}),
|
|
2205
|
+
}), ct = () => W ? ot.map((e) => /* @__PURE__ */ $("g", {
|
|
2188
2206
|
className: "lilt-radial-card__ring",
|
|
2189
2207
|
"data-category": e.slice.id,
|
|
2190
2208
|
"data-active": e.isActive || void 0,
|
|
2191
2209
|
"data-muted": e.muted,
|
|
2192
|
-
...
|
|
2210
|
+
...at(e.slice.id),
|
|
2193
2211
|
children: [/* @__PURE__ */ Q("path", {
|
|
2194
2212
|
className: "lilt-radial-card__track",
|
|
2195
2213
|
d: e.band
|
|
@@ -2198,7 +2216,7 @@ function bn({ title: e, data: t, category: n, value: r, variant: i = "donut", de
|
|
|
2198
2216
|
d: e.path,
|
|
2199
2217
|
style: { fill: e.color }
|
|
2200
2218
|
}) : null]
|
|
2201
|
-
}, e.slice.id)) :
|
|
2219
|
+
}, e.slice.id)) : st.map((e) => /* @__PURE__ */ $("g", { children: [/* @__PURE__ */ Q("path", {
|
|
2202
2220
|
className: "lilt-radial-card__slice",
|
|
2203
2221
|
d: e.path,
|
|
2204
2222
|
"data-category": e.slice.id,
|
|
@@ -2207,114 +2225,114 @@ function bn({ title: e, data: t, category: n, value: r, variant: i = "donut", de
|
|
|
2207
2225
|
style: { fill: e.color }
|
|
2208
2226
|
}), /* @__PURE__ */ Q("path", {
|
|
2209
2227
|
className: "lilt-radial-card__hit",
|
|
2210
|
-
d:
|
|
2228
|
+
d: et(e.angles) ?? e.path,
|
|
2211
2229
|
"data-category": e.slice.id,
|
|
2212
|
-
...
|
|
2213
|
-
})] }, e.slice.id)),
|
|
2214
|
-
if (n - t >=
|
|
2230
|
+
...at(e.slice.id)
|
|
2231
|
+
})] }, e.slice.id)), lt = (e, t, n) => {
|
|
2232
|
+
if (n - t >= pn - 1e-6) return `M0,${-e}A${e},${e} 0 1 1 0,${e}A${e},${e} 0 1 1 0,${-e}`;
|
|
2215
2233
|
let r = (t) => `${(e * Math.sin(t)).toFixed(3)},${(-e * Math.cos(t)).toFixed(3)}`;
|
|
2216
2234
|
return `M${r(t)}A${e},${e} 0 ${+(n - t > Math.PI)} 1 ${r(n)}`;
|
|
2217
|
-
},
|
|
2218
|
-
let s =
|
|
2235
|
+
}, ut = (e, t, n, r, i, a, o = "tube") => {
|
|
2236
|
+
let s = lt(n, i.startAngle - .3, i.endAngle + .3);
|
|
2219
2237
|
return /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("clipPath", {
|
|
2220
|
-
id: `${
|
|
2238
|
+
id: `${z}-${e}`,
|
|
2221
2239
|
children: /* @__PURE__ */ Q("path", {
|
|
2222
2240
|
className: "lilt-radial-card__tube-outline",
|
|
2223
2241
|
d: t
|
|
2224
2242
|
})
|
|
2225
2243
|
}), /* @__PURE__ */ Q("g", {
|
|
2226
|
-
clipPath: `url(#${
|
|
2227
|
-
children:
|
|
2244
|
+
clipPath: `url(#${z}-${e})`,
|
|
2245
|
+
children: pe(r, o).map((e, t) => /* @__PURE__ */ Q("path", {
|
|
2228
2246
|
className: "lilt-radial-card__tube-layer",
|
|
2229
2247
|
d: s,
|
|
2230
2248
|
fill: "none",
|
|
2231
2249
|
transform: e.transform,
|
|
2232
2250
|
style: {
|
|
2233
|
-
stroke:
|
|
2251
|
+
stroke: se(a, e.amount),
|
|
2234
2252
|
strokeWidth: e.strokeWidth
|
|
2235
2253
|
}
|
|
2236
2254
|
}, t))
|
|
2237
2255
|
})] });
|
|
2238
|
-
},
|
|
2239
|
-
radius:
|
|
2240
|
-
width:
|
|
2241
|
-
}),
|
|
2256
|
+
}, dt = (e, t = 0) => ({
|
|
2257
|
+
radius: dn - e * (rt + 4) + t / 2 - (rt + t) / 2,
|
|
2258
|
+
width: rt + t
|
|
2259
|
+
}), ft = () => W ? ot.map((e, t) => {
|
|
2242
2260
|
if (!e.path) return null;
|
|
2243
|
-
let n =
|
|
2261
|
+
let n = dt(t, e.isActive ? 3 : 0);
|
|
2244
2262
|
return /* @__PURE__ */ Q("g", {
|
|
2245
2263
|
className: "lilt-radial-card__slice",
|
|
2246
2264
|
"data-category": e.slice.id,
|
|
2247
2265
|
"data-muted": e.muted,
|
|
2248
|
-
children:
|
|
2266
|
+
children: ut(`ring-${t}`, e.path, n.radius, n.width, e.slice, e.color)
|
|
2249
2267
|
}, e.slice.id);
|
|
2250
|
-
}) :
|
|
2251
|
-
let t = e.isActive ?
|
|
2268
|
+
}) : st.map((e) => {
|
|
2269
|
+
let t = e.isActive ? fn : dn;
|
|
2252
2270
|
return /* @__PURE__ */ Q("g", {
|
|
2253
2271
|
className: "lilt-radial-card__slice",
|
|
2254
2272
|
"data-category": e.slice.id,
|
|
2255
2273
|
"data-active": e.isActive || void 0,
|
|
2256
2274
|
"data-muted": e.muted,
|
|
2257
|
-
children:
|
|
2275
|
+
children: Xe > 0 ? ut(`slice-${K.indexOf(e.slice)}`, e.path, (Xe + t) / 2, t - Xe, e.angles, e.color) : /* @__PURE__ */ Q("path", {
|
|
2258
2276
|
className: "lilt-radial-card__dome",
|
|
2259
2277
|
d: e.path,
|
|
2260
|
-
style: { fill: `url(#${
|
|
2278
|
+
style: { fill: `url(#${z}-dome-${K.indexOf(e.slice)})` }
|
|
2261
2279
|
})
|
|
2262
2280
|
}, e.slice.id);
|
|
2263
|
-
}),
|
|
2281
|
+
}), pt = () => /* @__PURE__ */ $(Z, { children: [
|
|
2264
2282
|
/* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(S, {
|
|
2265
|
-
id: `${
|
|
2283
|
+
id: `${z}-shadow`,
|
|
2266
2284
|
size: 6
|
|
2267
|
-
}),
|
|
2268
|
-
id: `${
|
|
2285
|
+
}), Xe === 0 && !W ? st.map((e) => /* @__PURE__ */ Q("radialGradient", {
|
|
2286
|
+
id: `${z}-dome-${K.indexOf(e.slice)}`,
|
|
2269
2287
|
gradientUnits: "userSpaceOnUse",
|
|
2270
2288
|
cx: -28,
|
|
2271
2289
|
cy: -36,
|
|
2272
2290
|
r: 150,
|
|
2273
|
-
children:
|
|
2291
|
+
children: _e(e.color, [
|
|
2274
2292
|
[0, 26],
|
|
2275
2293
|
[.42, 2],
|
|
2276
2294
|
[1, -36]
|
|
2277
2295
|
])
|
|
2278
2296
|
}, e.slice.id)) : null] }),
|
|
2279
|
-
W ?
|
|
2280
|
-
let n =
|
|
2297
|
+
W ? ot.map((e, t) => {
|
|
2298
|
+
let n = dt(t);
|
|
2281
2299
|
return /* @__PURE__ */ $("g", {
|
|
2282
2300
|
className: "lilt-radial-card__ring",
|
|
2283
2301
|
"data-category": e.slice.id,
|
|
2284
2302
|
"data-active": e.isActive || void 0,
|
|
2285
2303
|
"data-muted": e.muted,
|
|
2286
|
-
...
|
|
2304
|
+
...at(e.slice.id),
|
|
2287
2305
|
children: [/* @__PURE__ */ Q("path", {
|
|
2288
2306
|
className: "lilt-radial-card__track",
|
|
2289
2307
|
d: e.band
|
|
2290
|
-
}),
|
|
2308
|
+
}), ut(`track-${t}`, e.band, n.radius, n.width, {
|
|
2291
2309
|
startAngle: 0,
|
|
2292
|
-
endAngle:
|
|
2293
|
-
},
|
|
2310
|
+
endAngle: pn
|
|
2311
|
+
}, hn, "groove")]
|
|
2294
2312
|
}, `track-${e.slice.id}`);
|
|
2295
2313
|
}) : null,
|
|
2296
2314
|
/* @__PURE__ */ Q("g", {
|
|
2297
|
-
filter: `url(#${
|
|
2298
|
-
children:
|
|
2315
|
+
filter: `url(#${z}-shadow)`,
|
|
2316
|
+
children: ft()
|
|
2299
2317
|
}),
|
|
2300
|
-
W ? null :
|
|
2318
|
+
W ? null : st.map((e) => /* @__PURE__ */ Q("path", {
|
|
2301
2319
|
className: "lilt-radial-card__hit",
|
|
2302
|
-
d:
|
|
2320
|
+
d: et(e.angles) ?? e.path,
|
|
2303
2321
|
"data-category": e.slice.id,
|
|
2304
|
-
...
|
|
2322
|
+
...at(e.slice.id)
|
|
2305
2323
|
}, `hit-${e.slice.id}`))
|
|
2306
|
-
] }),
|
|
2324
|
+
] }), mt = (e, t) => {
|
|
2307
2325
|
let n = t;
|
|
2308
|
-
if (e.key === "ArrowDown") n = Math.min(
|
|
2326
|
+
if (e.key === "ArrowDown") n = Math.min(V.length - 1, t + 1);
|
|
2309
2327
|
else if (e.key === "ArrowUp") n = Math.max(0, t - 1);
|
|
2310
2328
|
else if (e.key === "Home") n = 0;
|
|
2311
|
-
else if (e.key === "End") n =
|
|
2329
|
+
else if (e.key === "End") n = V.length - 1;
|
|
2312
2330
|
else if (e.key === "Escape") {
|
|
2313
|
-
|
|
2331
|
+
Y(null);
|
|
2314
2332
|
return;
|
|
2315
2333
|
} else return;
|
|
2316
|
-
e.preventDefault(),
|
|
2317
|
-
},
|
|
2334
|
+
e.preventDefault(), Be.current.get(V[n].id)?.focus();
|
|
2335
|
+
}, ht = I?.headline ?? c ?? (fe ? ue : null), gt = !E && (B.error !== null || ue <= 0), _t = ve ? [-Math.PI / 2, Math.PI / 2] : [0, pn], vt = (W ? [
|
|
2318
2336
|
86,
|
|
2319
2337
|
66,
|
|
2320
2338
|
46
|
|
@@ -2336,137 +2354,143 @@ function bn({ title: e, data: t, category: n, value: r, variant: i = "donut", de
|
|
|
2336
2354
|
].map((e, t, n) => {
|
|
2337
2355
|
let r = n.slice(0, t).reduce((e, t) => e + t, 0);
|
|
2338
2356
|
return {
|
|
2339
|
-
radius: (
|
|
2340
|
-
width:
|
|
2357
|
+
radius: (dn + Xe) / 2,
|
|
2358
|
+
width: dn - Xe,
|
|
2341
2359
|
from: r,
|
|
2342
2360
|
to: r + e,
|
|
2343
2361
|
step: r * 12
|
|
2344
2362
|
};
|
|
2345
2363
|
})).map((e) => {
|
|
2346
|
-
let t = W ? 0 :
|
|
2364
|
+
let t = W ? 0 : ve ? .025 : .015, n = _t[1] - _t[0];
|
|
2347
2365
|
return {
|
|
2348
2366
|
...e,
|
|
2349
|
-
startAngle:
|
|
2350
|
-
endAngle:
|
|
2367
|
+
startAngle: _t[0] + e.from * n + (e.from > 0 ? t : 0),
|
|
2368
|
+
endAngle: _t[0] + e.to * n - (e.to < 1 ? t : 0)
|
|
2351
2369
|
};
|
|
2352
|
-
}),
|
|
2370
|
+
}), yt = (e) => ({
|
|
2353
2371
|
"--lilt-skeleton-step": e.step,
|
|
2354
2372
|
transformOrigin: "0 0"
|
|
2355
|
-
}),
|
|
2373
|
+
}), bt = (e) => $e().innerRadius(e.radius - e.width / 2).outerRadius(e.radius + e.width / 2)({
|
|
2356
2374
|
id: "",
|
|
2357
2375
|
...e
|
|
2358
|
-
}) ?? "",
|
|
2376
|
+
}) ?? "", xt = (e) => vt.map((t, n) => /* @__PURE__ */ Q("path", {
|
|
2359
2377
|
className: "lilt-radial-card__skeleton",
|
|
2360
|
-
d:
|
|
2378
|
+
d: lt(t.radius, t.startAngle, t.endAngle),
|
|
2361
2379
|
strokeWidth: t.width,
|
|
2362
2380
|
pathLength: 1,
|
|
2363
2381
|
strokeDasharray: e ? void 0 : 1,
|
|
2364
2382
|
"data-skeleton": e ? void 0 : "stroke",
|
|
2365
|
-
style: e ? void 0 :
|
|
2383
|
+
style: e ? void 0 : yt(t)
|
|
2366
2384
|
}, n));
|
|
2367
|
-
return /* @__PURE__ */ $(
|
|
2368
|
-
motion:
|
|
2369
|
-
className: ["lilt-radial-card",
|
|
2370
|
-
style:
|
|
2385
|
+
return /* @__PURE__ */ $(Ie, {
|
|
2386
|
+
motion: O,
|
|
2387
|
+
className: ["lilt-radial-card", k].filter(Boolean).join(" "),
|
|
2388
|
+
style: A,
|
|
2371
2389
|
"aria-label": e,
|
|
2372
2390
|
surface: ne,
|
|
2373
2391
|
badge: b,
|
|
2374
2392
|
numberStyle: x,
|
|
2375
2393
|
palette: C,
|
|
2376
|
-
children: [/* @__PURE__ */ $(
|
|
2377
|
-
aside: m || p ? /* @__PURE__ */ Q(
|
|
2394
|
+
children: [/* @__PURE__ */ $(Fe, {
|
|
2395
|
+
aside: m || p ? /* @__PURE__ */ Q(Pe, {
|
|
2378
2396
|
label: p,
|
|
2379
2397
|
options: m?.map(({ id: e, label: t }) => ({
|
|
2380
2398
|
id: e,
|
|
2381
2399
|
label: t
|
|
2382
2400
|
})),
|
|
2383
|
-
value:
|
|
2384
|
-
onValueChange:
|
|
2401
|
+
value: I?.id,
|
|
2402
|
+
onValueChange: F
|
|
2385
2403
|
}) : null,
|
|
2386
|
-
children: [/* @__PURE__ */ Q(
|
|
2387
|
-
value:
|
|
2388
|
-
format:
|
|
2389
|
-
loading:
|
|
2390
|
-
motion:
|
|
2391
|
-
children:
|
|
2392
|
-
value:
|
|
2404
|
+
children: [/* @__PURE__ */ Q(Me, { children: e }), /* @__PURE__ */ Q(je, {
|
|
2405
|
+
value: ze ? ze.value : ht,
|
|
2406
|
+
format: N.value,
|
|
2407
|
+
loading: E,
|
|
2408
|
+
motion: O,
|
|
2409
|
+
children: E ? null : ze ? /* @__PURE__ */ $(ke, { children: [ze.label, He(ze) ? ` · ${He(ze)}` : ""] }) : R === void 0 ? null : /* @__PURE__ */ Q(Ae, {
|
|
2410
|
+
value: R,
|
|
2393
2411
|
tone: f
|
|
2394
2412
|
})
|
|
2395
2413
|
})]
|
|
2396
|
-
}),
|
|
2397
|
-
kind:
|
|
2398
|
-
message:
|
|
2414
|
+
}), gt ? /* @__PURE__ */ Q(d, {
|
|
2415
|
+
kind: B.error ? "error" : "empty",
|
|
2416
|
+
message: B.error ?? "No positive values for this period."
|
|
2399
2417
|
}) : /* @__PURE__ */ $("div", {
|
|
2400
2418
|
className: "lilt-radial-card__body",
|
|
2401
2419
|
"data-variant": i,
|
|
2402
2420
|
"data-legend": o,
|
|
2403
2421
|
children: [/* @__PURE__ */ $("div", {
|
|
2404
|
-
ref:
|
|
2422
|
+
ref: Ve,
|
|
2405
2423
|
className: "lilt-radial-card__graphic",
|
|
2406
2424
|
"data-lilt-glide": "",
|
|
2407
2425
|
children: [/* @__PURE__ */ Q("svg", {
|
|
2408
2426
|
"aria-hidden": "true",
|
|
2409
2427
|
className: "lilt-radial-card__svg",
|
|
2410
|
-
viewBox:
|
|
2411
|
-
"data-loading":
|
|
2412
|
-
"data-drawing":
|
|
2413
|
-
children: /* @__PURE__ */ Q(
|
|
2414
|
-
leaving:
|
|
2428
|
+
viewBox: ve ? "-100 -100 200 104" : "-100 -100 200 200",
|
|
2429
|
+
"data-loading": M || void 0,
|
|
2430
|
+
"data-drawing": Ce || void 0,
|
|
2431
|
+
children: /* @__PURE__ */ Q(de, {
|
|
2432
|
+
leaving: j,
|
|
2415
2433
|
origin: "center",
|
|
2416
|
-
children: /* @__PURE__ */ Q("g", { children:
|
|
2434
|
+
children: /* @__PURE__ */ Q("g", { children: E ? /* @__PURE__ */ Q(Gt, {
|
|
2417
2435
|
x: -100,
|
|
2418
2436
|
y: -100,
|
|
2419
2437
|
width: 200,
|
|
2420
|
-
height:
|
|
2421
|
-
reduced:
|
|
2422
|
-
loadingStyle:
|
|
2438
|
+
height: ve ? 104 : 200,
|
|
2439
|
+
reduced: ae,
|
|
2440
|
+
loadingStyle: D,
|
|
2423
2441
|
depth: a,
|
|
2424
2442
|
mask: a ? /* @__PURE__ */ Q("g", {
|
|
2425
|
-
transform: `scale(${
|
|
2426
|
-
children:
|
|
2427
|
-
}) :
|
|
2443
|
+
transform: `scale(${mn})`,
|
|
2444
|
+
children: xt(!0)
|
|
2445
|
+
}) : xt(!0),
|
|
2428
2446
|
children: a ? /* @__PURE__ */ $("g", {
|
|
2429
2447
|
"data-lilt-loading-depth": "",
|
|
2430
|
-
transform: `scale(${
|
|
2448
|
+
transform: `scale(${mn})`,
|
|
2431
2449
|
opacity: .6,
|
|
2432
2450
|
children: [/* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(S, {
|
|
2433
|
-
id: `${
|
|
2451
|
+
id: `${z}-loading-shadow`,
|
|
2434
2452
|
size: 6
|
|
2435
|
-
}),
|
|
2436
|
-
id: `${
|
|
2453
|
+
}), Xe === 0 && !W ? /* @__PURE__ */ Q("radialGradient", {
|
|
2454
|
+
id: `${z}-loading-dome`,
|
|
2437
2455
|
gradientUnits: "userSpaceOnUse",
|
|
2438
2456
|
cx: -28,
|
|
2439
2457
|
cy: -36,
|
|
2440
2458
|
r: 150,
|
|
2441
|
-
children:
|
|
2459
|
+
children: _e("var(--lilt-skeleton)", [
|
|
2442
2460
|
[0, 26],
|
|
2443
2461
|
[.42, 2],
|
|
2444
2462
|
[1, -36]
|
|
2445
2463
|
])
|
|
2446
2464
|
}) : null] }), /* @__PURE__ */ Q("g", {
|
|
2447
|
-
filter: `url(#${
|
|
2448
|
-
children:
|
|
2465
|
+
filter: `url(#${z}-loading-shadow)`,
|
|
2466
|
+
children: vt.map((e, t) => /* @__PURE__ */ Q("g", {
|
|
2449
2467
|
"data-skeleton": "bloom",
|
|
2450
|
-
style:
|
|
2451
|
-
children:
|
|
2452
|
-
d:
|
|
2453
|
-
fill: `url(#${
|
|
2454
|
-
}) :
|
|
2468
|
+
style: yt(e),
|
|
2469
|
+
children: Xe === 0 && !W ? /* @__PURE__ */ Q("path", {
|
|
2470
|
+
d: bt(e),
|
|
2471
|
+
fill: `url(#${z}-loading-dome)`
|
|
2472
|
+
}) : ut(`loading-${t}`, bt(e), e.radius, e.width, e, "var(--lilt-skeleton)")
|
|
2455
2473
|
}, t))
|
|
2456
2474
|
})]
|
|
2457
|
-
}) :
|
|
2475
|
+
}) : xt(!1)
|
|
2458
2476
|
}) : a ? /* @__PURE__ */ Q("g", {
|
|
2459
|
-
transform: `scale(${
|
|
2460
|
-
children:
|
|
2461
|
-
}) :
|
|
2477
|
+
transform: `scale(${mn})`,
|
|
2478
|
+
children: pt()
|
|
2479
|
+
}) : ct() })
|
|
2462
2480
|
})
|
|
2463
|
-
}), (i === "donut" ||
|
|
2481
|
+
}), (i === "donut" || ve) && !M && Ye ? /* @__PURE__ */ Q("div", {
|
|
2464
2482
|
className: "lilt-radial-card__center",
|
|
2465
2483
|
"aria-hidden": "true",
|
|
2466
|
-
style:
|
|
2467
|
-
children:
|
|
2484
|
+
style: G.initial && Ce ? { opacity: Math.max(0, (Se - .55) / .45) } : void 0,
|
|
2485
|
+
children: T ? T({
|
|
2486
|
+
category: Ye.label,
|
|
2487
|
+
value: Ye.value,
|
|
2488
|
+
share: Ye.value !== null && ue > 0 ? Ye.value / ue : null,
|
|
2489
|
+
active: Ye === ze,
|
|
2490
|
+
pinned: Ye.id === Ne
|
|
2491
|
+
}) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("strong", { children: He(Ye) ?? "—" }), /* @__PURE__ */ Q("span", { children: Ye.label })] })
|
|
2468
2492
|
}) : null]
|
|
2469
|
-
}), o === "list" ?
|
|
2493
|
+
}), o === "list" ? E ? /* @__PURE__ */ Q("div", {
|
|
2470
2494
|
className: "lilt-radial-card__legend",
|
|
2471
2495
|
"aria-hidden": "true",
|
|
2472
2496
|
children: Array.from({ length: Math.min(g + 1, 6) }, (e, t) => /* @__PURE__ */ Q("div", {
|
|
@@ -2476,31 +2500,31 @@ function bn({ title: e, data: t, category: n, value: r, variant: i = "donut", de
|
|
|
2476
2500
|
}) : /* @__PURE__ */ Q("ol", {
|
|
2477
2501
|
className: "lilt-radial-card__legend",
|
|
2478
2502
|
"aria-label": `${e} by share`,
|
|
2479
|
-
children:
|
|
2480
|
-
let n = e.id ===
|
|
2503
|
+
children: V.map((e, t) => {
|
|
2504
|
+
let n = e.id === ze?.id, r = He(e), i = H.includes(e.id);
|
|
2481
2505
|
return /* @__PURE__ */ $("li", {
|
|
2482
2506
|
"data-active": n || void 0,
|
|
2483
|
-
"data-muted":
|
|
2507
|
+
"data-muted": ze && !n || void 0,
|
|
2484
2508
|
"data-hidden": i || void 0,
|
|
2485
2509
|
children: [/* @__PURE__ */ $("button", {
|
|
2486
2510
|
type: "button",
|
|
2487
2511
|
className: "lilt-radial-card__row",
|
|
2488
2512
|
ref: (t) => {
|
|
2489
|
-
t ?
|
|
2513
|
+
t ? Be.current.set(e.id, t) : Be.current.delete(e.id);
|
|
2490
2514
|
},
|
|
2491
|
-
tabIndex: e.id === (
|
|
2492
|
-
"aria-label": `${e.label}: ${e.value === null ? "No data" :
|
|
2515
|
+
tabIndex: e.id === (Oe ?? V[0]?.id) ? 0 : -1,
|
|
2516
|
+
"aria-label": `${e.label}: ${e.value === null ? "No data" : N.value(e.value)}${r ? `, ${r} of total` : ""}. ${i ? "Hidden; press to show" : U.length > 1 ? "Shown; press to hide" : "The only category shown"}`,
|
|
2493
2517
|
"aria-pressed": !i,
|
|
2494
|
-
onPointerEnter: () => !i &&
|
|
2495
|
-
onPointerLeave: () =>
|
|
2496
|
-
onFocus: () => !i &&
|
|
2497
|
-
onBlur: () =>
|
|
2498
|
-
onClick: () =>
|
|
2499
|
-
onKeyDown: (e) =>
|
|
2518
|
+
onPointerEnter: () => !i && De(e.id),
|
|
2519
|
+
onPointerLeave: () => De(null),
|
|
2520
|
+
onFocus: () => !i && J(e.id),
|
|
2521
|
+
onBlur: () => J(null),
|
|
2522
|
+
onClick: () => Ke(e.id),
|
|
2523
|
+
onKeyDown: (e) => mt(e, t),
|
|
2500
2524
|
children: [
|
|
2501
2525
|
/* @__PURE__ */ Q("span", {
|
|
2502
2526
|
className: "lilt-radial-card__swatch",
|
|
2503
|
-
style: e.value === null ? void 0 : i ? { boxShadow: `inset 0 0 0 1.5px ${
|
|
2527
|
+
style: e.value === null ? void 0 : i ? { boxShadow: `inset 0 0 0 1.5px ${ge(e.id)}` } : { background: ge(e.id) },
|
|
2504
2528
|
"data-missing": e.value === null || void 0
|
|
2505
2529
|
}),
|
|
2506
2530
|
/* @__PURE__ */ Q("span", {
|
|
@@ -2512,26 +2536,26 @@ function bn({ title: e, data: t, category: n, value: r, variant: i = "donut", de
|
|
|
2512
2536
|
children: e.value === null ? /* @__PURE__ */ Q("span", {
|
|
2513
2537
|
className: "lilt-list__missing",
|
|
2514
2538
|
children: "No data"
|
|
2515
|
-
}) :
|
|
2539
|
+
}) : N.value(e.value)
|
|
2516
2540
|
}),
|
|
2517
2541
|
/* @__PURE__ */ Q("span", {
|
|
2518
2542
|
className: "lilt-radial-card__share",
|
|
2519
2543
|
children: r ?? "—"
|
|
2520
2544
|
})
|
|
2521
2545
|
]
|
|
2522
|
-
}),
|
|
2546
|
+
}), V.length > 1 ? /* @__PURE__ */ $("span", {
|
|
2523
2547
|
className: "lilt-chart__legend-actions",
|
|
2524
|
-
children: [
|
|
2548
|
+
children: [U.length > 1 || i ? /* @__PURE__ */ Q("button", {
|
|
2525
2549
|
type: "button",
|
|
2526
2550
|
className: "lilt-chart__legend-action",
|
|
2527
2551
|
"aria-label": `Show only ${e.label}`,
|
|
2528
|
-
onClick: () =>
|
|
2552
|
+
onClick: () => We(V.map((e) => e.id).filter((t) => t !== e.id)),
|
|
2529
2553
|
children: "Only"
|
|
2530
|
-
}) : null,
|
|
2554
|
+
}) : null, H.length ? /* @__PURE__ */ Q("button", {
|
|
2531
2555
|
type: "button",
|
|
2532
2556
|
className: "lilt-chart__legend-action",
|
|
2533
2557
|
"aria-label": "Show all categories",
|
|
2534
|
-
onClick: () =>
|
|
2558
|
+
onClick: () => We([]),
|
|
2535
2559
|
children: "Show all"
|
|
2536
2560
|
}) : null]
|
|
2537
2561
|
}) : null]
|
|
@@ -2542,32 +2566,32 @@ function bn({ title: e, data: t, category: n, value: r, variant: i = "donut", de
|
|
|
2542
2566
|
"aria-label": `${e} by category`,
|
|
2543
2567
|
variant: oe(o),
|
|
2544
2568
|
swatch: s,
|
|
2545
|
-
items:
|
|
2569
|
+
items: V.map((e) => ({
|
|
2546
2570
|
id: e.id,
|
|
2547
2571
|
label: e.label,
|
|
2548
|
-
color: e.value === null ? "transparent" :
|
|
2572
|
+
color: e.value === null ? "transparent" : ge(e.id),
|
|
2549
2573
|
value: e.value,
|
|
2550
|
-
formattedValue: e.value === null ? "No data" :
|
|
2574
|
+
formattedValue: e.value === null ? "No data" : N.value(e.value)
|
|
2551
2575
|
})),
|
|
2552
|
-
activeId:
|
|
2553
|
-
selectedId:
|
|
2554
|
-
onHoverIdChange:
|
|
2555
|
-
hiddenIds:
|
|
2556
|
-
onHiddenIdsChange:
|
|
2557
|
-
renderValue:
|
|
2576
|
+
activeId: ze?.id ?? null,
|
|
2577
|
+
selectedId: Ne,
|
|
2578
|
+
onHoverIdChange: De,
|
|
2579
|
+
hiddenIds: H,
|
|
2580
|
+
onHiddenIdsChange: We,
|
|
2581
|
+
renderValue: E ? () => /* @__PURE__ */ Q("span", { className: "lilt-card__skeleton lilt-card__skeleton--tile" }) : o === "inline" ? (e) => e.formattedValue : void 0
|
|
2558
2582
|
})]
|
|
2559
2583
|
})]
|
|
2560
2584
|
});
|
|
2561
2585
|
}
|
|
2562
2586
|
//#endregion
|
|
2563
2587
|
//#region src/cards/progress-card.tsx
|
|
2564
|
-
var
|
|
2565
|
-
function
|
|
2566
|
-
let w = Ee(b),
|
|
2588
|
+
var Sn = (e) => `${Math.round(e * 100)}%`, Cn = "var(--lilt-series-1)", wn = "color-mix(in oklab, var(--lilt-muted) 14%, var(--lilt-surface))";
|
|
2589
|
+
function Tn({ title: e, value: t = null, target: n, label: r = "of goal", variant: i = "ring", depth: a = !1, delta: o, deltaTone: s, range: c, ranges: l, defaultRange: d, footer: f, valueFormat: p, locale: m, formatValue: h, color: g, surface: _ = "elevated", badge: v, numberStyle: y, palette: ee, loading: te = !1, loadingStyle: ne = "shimmer", motion: b = "auto", className: x, style: C }) {
|
|
2590
|
+
let w = Ee(b), re = u(te, w), ie = `lilt-progress-depth-${Ge().replace(/:/g, "")}`, T = me({
|
|
2567
2591
|
valueFormat: p,
|
|
2568
2592
|
locale: m,
|
|
2569
2593
|
formatValue: h
|
|
2570
|
-
}), [
|
|
2594
|
+
}), [E, D] = X(d ?? l?.[0]?.id), O = l?.find((e) => e.id === E) ?? l?.[0], k = O ? O.value : t, A = O?.target ?? n, ae = O ? O.delta : o, j = te || k === null || !(A > 0) ? null : Math.max(0, k / A), M = i === "gauge", N = i === "thick", P = N ? 26 : 10, F = 90 - P / 2, I = M ? `M ${100 - F} 100 A ${F} ${F} 0 0 1 ${100 + F} 100` : void 0, L = (e, t = !1) => M ? /* @__PURE__ */ Q("path", {
|
|
2571
2595
|
className: "lilt-progress__track",
|
|
2572
2596
|
"data-loading": t || void 0,
|
|
2573
2597
|
d: I,
|
|
@@ -2588,7 +2612,7 @@ function wn({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2588
2612
|
animate: { pathLength: Math.min(1, j ?? 0) },
|
|
2589
2613
|
transition: {
|
|
2590
2614
|
duration: +!w,
|
|
2591
|
-
ease:
|
|
2615
|
+
ease: Oe
|
|
2592
2616
|
}
|
|
2593
2617
|
}, z = (e) => M ? /* @__PURE__ */ Q(Ze.path, {
|
|
2594
2618
|
className: "lilt-progress__fill",
|
|
@@ -2607,7 +2631,7 @@ function wn({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2607
2631
|
style: e ? { stroke: e.stroke } : void 0,
|
|
2608
2632
|
...R
|
|
2609
2633
|
});
|
|
2610
|
-
return /* @__PURE__ */ $(
|
|
2634
|
+
return /* @__PURE__ */ $(Ie, {
|
|
2611
2635
|
motion: b,
|
|
2612
2636
|
className: ["lilt-progress", x].filter(Boolean).join(" "),
|
|
2613
2637
|
style: g ? {
|
|
@@ -2620,8 +2644,8 @@ function wn({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2620
2644
|
numberStyle: y,
|
|
2621
2645
|
palette: ee,
|
|
2622
2646
|
children: [
|
|
2623
|
-
/* @__PURE__ */ $(
|
|
2624
|
-
aside: l || c ? /* @__PURE__ */ Q(
|
|
2647
|
+
/* @__PURE__ */ $(Fe, {
|
|
2648
|
+
aside: l || c ? /* @__PURE__ */ Q(Pe, {
|
|
2625
2649
|
label: c,
|
|
2626
2650
|
options: l?.map(({ id: e, label: t }) => ({
|
|
2627
2651
|
id: e,
|
|
@@ -2630,12 +2654,12 @@ function wn({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2630
2654
|
value: O?.id,
|
|
2631
2655
|
onValueChange: D
|
|
2632
2656
|
}) : null,
|
|
2633
|
-
children: [/* @__PURE__ */ Q(
|
|
2657
|
+
children: [/* @__PURE__ */ Q(Me, { children: e }), /* @__PURE__ */ Q(je, {
|
|
2634
2658
|
value: k,
|
|
2635
|
-
format:
|
|
2659
|
+
format: T.value,
|
|
2636
2660
|
loading: te,
|
|
2637
2661
|
motion: b,
|
|
2638
|
-
children: te || ae === void 0 ? null : /* @__PURE__ */ Q(
|
|
2662
|
+
children: te || ae === void 0 ? null : /* @__PURE__ */ Q(Ae, {
|
|
2639
2663
|
value: ae,
|
|
2640
2664
|
tone: s
|
|
2641
2665
|
})
|
|
@@ -2645,7 +2669,7 @@ function wn({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2645
2669
|
className: "lilt-progress__graphic",
|
|
2646
2670
|
"data-variant": i,
|
|
2647
2671
|
role: "meter",
|
|
2648
|
-
"aria-label": `${j === null ? "No data" :
|
|
2672
|
+
"aria-label": `${j === null ? "No data" : Sn(j)} ${r}, target ${T.value(A)}`,
|
|
2649
2673
|
"aria-valuemin": 0,
|
|
2650
2674
|
"aria-valuemax": A,
|
|
2651
2675
|
"aria-valuenow": k ?? 0,
|
|
@@ -2657,8 +2681,8 @@ function wn({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2657
2681
|
cx: 100,
|
|
2658
2682
|
cy: 100,
|
|
2659
2683
|
r: F - 20
|
|
2660
|
-
}) : null, /* @__PURE__ */ Q(
|
|
2661
|
-
leaving:
|
|
2684
|
+
}) : null, /* @__PURE__ */ Q(de, {
|
|
2685
|
+
leaving: re,
|
|
2662
2686
|
origin: "center",
|
|
2663
2687
|
children: /* @__PURE__ */ Q("g", { children: te ? /* @__PURE__ */ Q(Gt, {
|
|
2664
2688
|
width: 200,
|
|
@@ -2687,27 +2711,27 @@ function wn({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2687
2711
|
strokeDasharray: "1",
|
|
2688
2712
|
transform: "rotate(-90 100 100)"
|
|
2689
2713
|
}),
|
|
2690
|
-
children: a ?
|
|
2714
|
+
children: a ? pe(P).map((e, t) => /* @__PURE__ */ Q(He, { children: L({
|
|
2691
2715
|
width: e.strokeWidth,
|
|
2692
2716
|
transform: e.transform,
|
|
2693
|
-
stroke:
|
|
2717
|
+
stroke: se(Ut, e.amount)
|
|
2694
2718
|
}, !0) }, t)) : L(void 0, !0)
|
|
2695
2719
|
}) : a ? /* @__PURE__ */ $(Z, { children: [
|
|
2696
2720
|
/* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(S, {
|
|
2697
|
-
id: `${
|
|
2721
|
+
id: `${ie}-shadow`,
|
|
2698
2722
|
size: 5
|
|
2699
2723
|
}) }),
|
|
2700
|
-
|
|
2724
|
+
pe(P, "groove").map((e, t) => /* @__PURE__ */ Q(He, { children: L({
|
|
2701
2725
|
width: e.strokeWidth,
|
|
2702
2726
|
transform: e.transform,
|
|
2703
|
-
stroke:
|
|
2727
|
+
stroke: se(wn, e.amount)
|
|
2704
2728
|
}) }, `track-${t}`)),
|
|
2705
2729
|
j ? /* @__PURE__ */ Q("g", {
|
|
2706
|
-
filter: `url(#${
|
|
2707
|
-
children:
|
|
2730
|
+
filter: `url(#${ie}-shadow)`,
|
|
2731
|
+
children: pe(P).map((e, t) => /* @__PURE__ */ Q(He, { children: z({
|
|
2708
2732
|
width: e.strokeWidth,
|
|
2709
2733
|
transform: e.transform,
|
|
2710
|
-
stroke:
|
|
2734
|
+
stroke: se(Cn, e.amount)
|
|
2711
2735
|
}) }, `fill-${t}`))
|
|
2712
2736
|
}) : null
|
|
2713
2737
|
] }) : /* @__PURE__ */ $(Z, { children: [L(), j ? z() : null] }) })
|
|
@@ -2715,9 +2739,9 @@ function wn({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2715
2739
|
}), /* @__PURE__ */ $("div", {
|
|
2716
2740
|
className: "lilt-progress__center",
|
|
2717
2741
|
"aria-hidden": "true",
|
|
2718
|
-
children: [/* @__PURE__ */ Q("strong", { children: j === null ? "—" : /* @__PURE__ */ Q(
|
|
2742
|
+
children: [/* @__PURE__ */ Q("strong", { children: j === null ? "—" : /* @__PURE__ */ Q(De, {
|
|
2719
2743
|
value: j,
|
|
2720
|
-
format:
|
|
2744
|
+
format: Sn,
|
|
2721
2745
|
variant: y,
|
|
2722
2746
|
motion: w ? "none" : "auto"
|
|
2723
2747
|
}) }), /* @__PURE__ */ Q("span", { children: r })]
|
|
@@ -2732,19 +2756,19 @@ function wn({ title: e, value: t = null, target: n, label: r = "of goal", varian
|
|
|
2732
2756
|
}
|
|
2733
2757
|
//#endregion
|
|
2734
2758
|
//#region src/cards/funnel-chart-card.tsx
|
|
2735
|
-
var
|
|
2759
|
+
var En = [], Dn = [
|
|
2736
2760
|
100,
|
|
2737
2761
|
62,
|
|
2738
2762
|
40,
|
|
2739
2763
|
24
|
|
2740
|
-
],
|
|
2741
|
-
function
|
|
2764
|
+
], On = 55, kn = 1.4;
|
|
2765
|
+
function An(e) {
|
|
2742
2766
|
return e === null ? "—" : e > 0 && e < .01 ? "<1%" : `${Math.round(e * 100)}%`;
|
|
2743
2767
|
}
|
|
2744
|
-
function
|
|
2768
|
+
function jn(e, t, n, r) {
|
|
2745
2769
|
let i = e * 100, a = i + 100, o = (e) => 50 - e / 2, s = (e) => 50 + e / 2, c = n ?? t;
|
|
2746
2770
|
if (r === "linear") return `M${i},${o(t)} L${a},${o(c)} L${a},${s(c)} L${i},${s(t)} Z`;
|
|
2747
|
-
let l = i +
|
|
2771
|
+
let l = i + On, u = (a - l) * .5;
|
|
2748
2772
|
return [
|
|
2749
2773
|
`M${i},${o(t)}`,
|
|
2750
2774
|
`L${l},${o(t)}`,
|
|
@@ -2755,8 +2779,8 @@ function An(e, t, n, r) {
|
|
|
2755
2779
|
"Z"
|
|
2756
2780
|
].join(" ");
|
|
2757
2781
|
}
|
|
2758
|
-
var
|
|
2759
|
-
function
|
|
2782
|
+
var Mn = .28;
|
|
2783
|
+
function Nn(e, t, n, r) {
|
|
2760
2784
|
let i = e * 100, a = i + 100, o = n ?? t, s = [];
|
|
2761
2785
|
if (r === "linear") for (let e = 0; e <= 24; e += 1) {
|
|
2762
2786
|
let n = e / 24;
|
|
@@ -2766,7 +2790,7 @@ function Mn(e, t, n, r) {
|
|
|
2766
2790
|
});
|
|
2767
2791
|
}
|
|
2768
2792
|
else {
|
|
2769
|
-
let e = i +
|
|
2793
|
+
let e = i + On, n = (a - e) * .5;
|
|
2770
2794
|
s.push({
|
|
2771
2795
|
x: i,
|
|
2772
2796
|
half: t / 2
|
|
@@ -2788,20 +2812,20 @@ function Mn(e, t, n, r) {
|
|
|
2788
2812
|
};
|
|
2789
2813
|
});
|
|
2790
2814
|
}
|
|
2791
|
-
function
|
|
2815
|
+
function Pn(e, t, n, r) {
|
|
2792
2816
|
return `M${e},${50 - t}A${n},${t} 0 0 ${+(r === "right")} ${e},${50 + t}`;
|
|
2793
2817
|
}
|
|
2794
|
-
function
|
|
2795
|
-
let
|
|
2818
|
+
function Fn({ title: e, data: t, category: n, value: r, curve: i = "smooth", colors: a = "stages", tracks: o = !1, depth: s = !1, height: l = 180, headline: f, delta: p, deltaTone: m, range: h, ranges: g, defaultRange: _, valueFormat: v, legend: y = "tiles", legendSwatch: ee, locale: te, formatValue: ne, color: b, surface: x = "elevated", badge: S, numberStyle: C, palette: w, selected: re, onSelectedChange: ie, loading: T = !1, loadingStyle: E = "shimmer", motion: D = "auto", className: O, style: k }) {
|
|
2819
|
+
let A = Ee(D), ae = u(T, A), j = T || ae, M = me({
|
|
2796
2820
|
valueFormat: v,
|
|
2797
2821
|
locale: te,
|
|
2798
2822
|
formatValue: ne
|
|
2799
|
-
}), [
|
|
2823
|
+
}), [N, P] = X(_ ?? g?.[0]?.id), F = g?.find((e) => e.id === N) ?? g?.[0], I = F?.data ?? t ?? En, L = F ? F.delta : p, R = qe(() => {
|
|
2800
2824
|
try {
|
|
2801
2825
|
let e = (e, t) => e[t];
|
|
2802
2826
|
return {
|
|
2803
2827
|
rows: Ve({
|
|
2804
|
-
data:
|
|
2828
|
+
data: I,
|
|
2805
2829
|
category: {
|
|
2806
2830
|
id: (t) => String(e(t, n) ?? ""),
|
|
2807
2831
|
label: (t) => String(e(t, n) ?? "")
|
|
@@ -2821,76 +2845,76 @@ function Pn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2821
2845
|
};
|
|
2822
2846
|
}
|
|
2823
2847
|
}, [
|
|
2824
|
-
|
|
2848
|
+
I,
|
|
2825
2849
|
n,
|
|
2826
2850
|
r
|
|
2827
|
-
]),
|
|
2851
|
+
]), z = R.rows, B = qe(() => z.map((e) => e.share === null ? null : Math.max(kn, e.share * 100)), [z]), [V, H] = X({
|
|
2828
2852
|
key: 0,
|
|
2829
2853
|
from: [],
|
|
2830
|
-
to:
|
|
2854
|
+
to: B,
|
|
2831
2855
|
initial: !0
|
|
2832
2856
|
}), se = Je([]);
|
|
2833
|
-
|
|
2834
|
-
key:
|
|
2857
|
+
V.to !== B && H({
|
|
2858
|
+
key: V.key + 1,
|
|
2835
2859
|
from: se.current,
|
|
2836
|
-
to:
|
|
2860
|
+
to: B,
|
|
2837
2861
|
initial: !1
|
|
2838
2862
|
});
|
|
2839
|
-
let
|
|
2840
|
-
key:
|
|
2841
|
-
active: !
|
|
2842
|
-
duration:
|
|
2843
|
-
},
|
|
2844
|
-
let n =
|
|
2845
|
-
return e === null || n == null ? e : n + (e - n) *
|
|
2863
|
+
let ce = Le({
|
|
2864
|
+
key: V.key,
|
|
2865
|
+
active: !j,
|
|
2866
|
+
duration: V.initial ? 720 : 480
|
|
2867
|
+
}, A), U = V.initial ? V.to : V.to.map((e, t) => {
|
|
2868
|
+
let n = V.from[t];
|
|
2869
|
+
return e === null || n == null ? e : n + (e - n) * ce;
|
|
2846
2870
|
});
|
|
2847
|
-
se.current =
|
|
2848
|
-
let
|
|
2871
|
+
se.current = U;
|
|
2872
|
+
let ue = V.initial ? ce : 1, [fe, pe] = X(null), [he, ge] = tn(re, ie, qe(() => z.map((e) => e.id), [z]), !T), W = It({
|
|
2849
2873
|
resolve: Ft,
|
|
2850
|
-
onGlide:
|
|
2851
|
-
onLift: (e) => e !== null &&
|
|
2874
|
+
onGlide: pe,
|
|
2875
|
+
onLift: (e) => e !== null && ge(e),
|
|
2852
2876
|
disabled: T
|
|
2853
|
-
}), [
|
|
2854
|
-
if (
|
|
2855
|
-
let t = () =>
|
|
2856
|
-
t(),
|
|
2857
|
-
}, [
|
|
2858
|
-
T && (
|
|
2859
|
-
let
|
|
2860
|
-
let n =
|
|
2877
|
+
}), [ve, ye] = X(0), G = Je(null), be = Ue((e) => {
|
|
2878
|
+
if (W(e), G.current?.disconnect(), G.current = null, !e || !s || typeof ResizeObserver > "u") return;
|
|
2879
|
+
let t = () => ye(c(e).width);
|
|
2880
|
+
t(), G.current = new ResizeObserver(t), G.current.observe(e);
|
|
2881
|
+
}, [W, s]), xe = he ?? fe, Se = z.findIndex((e) => e.id === xe), Ce = z[Se], we = Se > 0 ? z[Se - 1] : void 0, Te = (e) => a === "single" ? "var(--lilt-series-1)" : `var(--lilt-series-${e % 6 + 1})`, K = Je(Dn.length), q = ae ? K.current : T && !z.length ? Dn.length : Math.max(1, z.length);
|
|
2882
|
+
T && (K.current = q);
|
|
2883
|
+
let De = T ? Array.from({ length: q }, (e, t) => {
|
|
2884
|
+
let n = Dn[t] ?? Dn.at(-1), r = t + 1 < q ? Dn[t + 1] ?? Dn.at(-1) : null;
|
|
2861
2885
|
return {
|
|
2862
2886
|
id: `loading-${t}`,
|
|
2863
2887
|
index: t,
|
|
2864
2888
|
own: n,
|
|
2865
2889
|
next: r,
|
|
2866
2890
|
to: r ?? n,
|
|
2867
|
-
d:
|
|
2891
|
+
d: jn(t, n, r, i),
|
|
2868
2892
|
color: Ut,
|
|
2869
2893
|
muted: void 0
|
|
2870
2894
|
};
|
|
2871
|
-
}) :
|
|
2872
|
-
let n =
|
|
2895
|
+
}) : z.flatMap((e, t) => {
|
|
2896
|
+
let n = U[t];
|
|
2873
2897
|
if (n == null) return [];
|
|
2874
|
-
let r = t + 1 <
|
|
2898
|
+
let r = t + 1 < z.length ? U[t + 1] ?? null : null;
|
|
2875
2899
|
return [{
|
|
2876
2900
|
id: e.id,
|
|
2877
2901
|
index: t,
|
|
2878
2902
|
own: n,
|
|
2879
2903
|
next: r,
|
|
2880
2904
|
to: r ?? n,
|
|
2881
|
-
d:
|
|
2882
|
-
color:
|
|
2883
|
-
muted:
|
|
2905
|
+
d: jn(t, n, r, i),
|
|
2906
|
+
color: Te(t),
|
|
2907
|
+
muted: Ce && e.id !== Ce.id || void 0
|
|
2884
2908
|
}];
|
|
2885
|
-
}),
|
|
2909
|
+
}), Oe = () => De.map((e) => /* @__PURE__ */ Q("path", {
|
|
2886
2910
|
className: "lilt-funnel-card__band",
|
|
2887
2911
|
d: e.d,
|
|
2888
2912
|
"data-stage": e.id,
|
|
2889
|
-
"data-active": e.id ===
|
|
2913
|
+
"data-active": e.id === Ce?.id || void 0,
|
|
2890
2914
|
"data-muted": e.muted,
|
|
2891
2915
|
style: { fill: e.color }
|
|
2892
|
-
}, e.id)), J = s &&
|
|
2893
|
-
let e =
|
|
2916
|
+
}, e.id)), J = s && ve > 0 && De.length ? (() => {
|
|
2917
|
+
let e = q * 100, t = e / ve, n = 100 / l, r = (e) => e / n * Mn * t, i = De[0], a = De[De.length - 1], o = r(i.own / 2), s = r(a.to / 2), c = (e - o - s) / e;
|
|
2894
2918
|
return {
|
|
2895
2919
|
left: o,
|
|
2896
2920
|
sx: c,
|
|
@@ -2901,22 +2925,22 @@ function Pn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2901
2925
|
sy: 7 * n
|
|
2902
2926
|
}
|
|
2903
2927
|
};
|
|
2904
|
-
})() : null,
|
|
2905
|
-
let t = e.index, n = e ===
|
|
2928
|
+
})() : null, Ne = `lilt-funnel-${Ge().replace(/:/g, "")}`, Y = `${Ne}-pipe`, Re = (e) => `url(#${Y}-shade-${e})`, ze = (e) => ({ "--lilt-skeleton-step": e * 3 }), Be = () => J ? [...De].reverse().map((e) => {
|
|
2929
|
+
let t = e.index, n = e === De[0], r = e === De[De.length - 1], a = e.to / 2, o = e.own / 2, s = t * 100, c = s + 100;
|
|
2906
2930
|
return /* @__PURE__ */ $("g", {
|
|
2907
2931
|
className: "lilt-funnel-card__pipe",
|
|
2908
2932
|
"data-stage": e.id,
|
|
2909
|
-
"data-active": !T && e.id ===
|
|
2933
|
+
"data-active": !T && e.id === Ce?.id || void 0,
|
|
2910
2934
|
"data-muted": e.muted,
|
|
2911
2935
|
"data-skeleton": T ? "grow" : void 0,
|
|
2912
|
-
style: T ?
|
|
2936
|
+
style: T ? ze(t) : void 0,
|
|
2913
2937
|
children: [
|
|
2914
2938
|
/* @__PURE__ */ $("clipPath", {
|
|
2915
2939
|
id: `${Y}-clip-${t}`,
|
|
2916
2940
|
children: [
|
|
2917
2941
|
/* @__PURE__ */ Q("path", { d: e.d }),
|
|
2918
|
-
/* @__PURE__ */ Q("path", { d: `${
|
|
2919
|
-
n ? /* @__PURE__ */ Q("path", { d: `${
|
|
2942
|
+
/* @__PURE__ */ Q("path", { d: `${Pn(c, a, J.rx(a), "right")}Z` }),
|
|
2943
|
+
n ? /* @__PURE__ */ Q("path", { d: `${Pn(s, o, J.rx(o), "left")}Z` }) : null
|
|
2920
2944
|
]
|
|
2921
2945
|
}),
|
|
2922
2946
|
/* @__PURE__ */ $("g", {
|
|
@@ -2927,21 +2951,21 @@ function Pn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2927
2951
|
y: 50 - o,
|
|
2928
2952
|
width: J.rx(o) + 1.5,
|
|
2929
2953
|
height: o * 2,
|
|
2930
|
-
style: { fill:
|
|
2954
|
+
style: { fill: Re(t) }
|
|
2931
2955
|
}) : null,
|
|
2932
|
-
|
|
2956
|
+
Nn(t, e.own, e.next, i).map((e) => /* @__PURE__ */ Q("rect", {
|
|
2933
2957
|
x: e.x,
|
|
2934
2958
|
y: 50 - e.half,
|
|
2935
2959
|
width: e.width,
|
|
2936
2960
|
height: e.half * 2,
|
|
2937
|
-
style: { fill:
|
|
2961
|
+
style: { fill: Re(t) }
|
|
2938
2962
|
}, e.x)),
|
|
2939
2963
|
/* @__PURE__ */ Q("rect", {
|
|
2940
2964
|
x: c - .5,
|
|
2941
2965
|
y: 50 - a,
|
|
2942
2966
|
width: J.rx(a) + 1,
|
|
2943
2967
|
height: a * 2,
|
|
2944
|
-
style: { fill:
|
|
2968
|
+
style: { fill: Re(t) }
|
|
2945
2969
|
})
|
|
2946
2970
|
]
|
|
2947
2971
|
}),
|
|
@@ -2953,19 +2977,19 @@ function Pn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2953
2977
|
style: { fill: `url(#${Y}-cap-${t})` }
|
|
2954
2978
|
}) : /* @__PURE__ */ Q("path", {
|
|
2955
2979
|
className: "lilt-funnel-card__seam",
|
|
2956
|
-
d:
|
|
2980
|
+
d: Pn(c, a, J.rx(a), "right"),
|
|
2957
2981
|
fill: "none",
|
|
2958
2982
|
vectorEffect: "non-scaling-stroke"
|
|
2959
2983
|
})
|
|
2960
2984
|
]
|
|
2961
2985
|
}, e.id);
|
|
2962
|
-
}) : null,
|
|
2963
|
-
return /* @__PURE__ */ $(
|
|
2964
|
-
motion:
|
|
2965
|
-
className: ["lilt-funnel-card",
|
|
2986
|
+
}) : null, We = F?.headline ?? f ?? z[0]?.value ?? null, Ke = !T && (R.error !== null || z.length === 0);
|
|
2987
|
+
return /* @__PURE__ */ $(Ie, {
|
|
2988
|
+
motion: D,
|
|
2989
|
+
className: ["lilt-funnel-card", O].filter(Boolean).join(" "),
|
|
2966
2990
|
style: {
|
|
2967
|
-
...
|
|
2968
|
-
"--lilt-funnel-stages":
|
|
2991
|
+
...k,
|
|
2992
|
+
"--lilt-funnel-stages": q,
|
|
2969
2993
|
...b ? { "--lilt-series-1": b } : {}
|
|
2970
2994
|
},
|
|
2971
2995
|
"aria-label": e,
|
|
@@ -2973,51 +2997,51 @@ function Pn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2973
2997
|
badge: S,
|
|
2974
2998
|
numberStyle: C,
|
|
2975
2999
|
palette: w,
|
|
2976
|
-
children: [/* @__PURE__ */ $(
|
|
2977
|
-
aside: g || h ? /* @__PURE__ */ Q(
|
|
3000
|
+
children: [/* @__PURE__ */ $(Fe, {
|
|
3001
|
+
aside: g || h ? /* @__PURE__ */ Q(Pe, {
|
|
2978
3002
|
label: h,
|
|
2979
3003
|
options: g?.map(({ id: e, label: t }) => ({
|
|
2980
3004
|
id: e,
|
|
2981
3005
|
label: t
|
|
2982
3006
|
})),
|
|
2983
|
-
value:
|
|
2984
|
-
onValueChange:
|
|
3007
|
+
value: F?.id,
|
|
3008
|
+
onValueChange: P
|
|
2985
3009
|
}) : null,
|
|
2986
|
-
children: [/* @__PURE__ */ Q(
|
|
2987
|
-
value:
|
|
2988
|
-
format:
|
|
3010
|
+
children: [/* @__PURE__ */ Q(Me, { children: e }), /* @__PURE__ */ Q(je, {
|
|
3011
|
+
value: Ce ? Ce.value : We,
|
|
3012
|
+
format: M.value,
|
|
2989
3013
|
loading: T,
|
|
2990
|
-
motion:
|
|
2991
|
-
children: T ? null :
|
|
2992
|
-
value:
|
|
3014
|
+
motion: D,
|
|
3015
|
+
children: T ? null : Ce ? /* @__PURE__ */ $(ke, { children: [Ce.label, Ce.conversion !== null && we ? ` · ${An(Ce.conversion)} of ${we.label}` : ""] }) : L === void 0 ? null : /* @__PURE__ */ Q(Ae, {
|
|
3016
|
+
value: L,
|
|
2993
3017
|
tone: m
|
|
2994
3018
|
})
|
|
2995
3019
|
})]
|
|
2996
|
-
}),
|
|
2997
|
-
kind:
|
|
2998
|
-
message:
|
|
3020
|
+
}), Ke ? /* @__PURE__ */ Q(d, {
|
|
3021
|
+
kind: R.error ? "error" : "empty",
|
|
3022
|
+
message: R.error ?? "No stages for this period."
|
|
2999
3023
|
}) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ $("div", {
|
|
3000
|
-
ref:
|
|
3024
|
+
ref: be,
|
|
3001
3025
|
className: "lilt-funnel-card__plot",
|
|
3002
3026
|
"data-lilt-glide": "",
|
|
3003
3027
|
style: { height: l },
|
|
3004
|
-
"data-loading":
|
|
3005
|
-
onPointerLeave: () =>
|
|
3006
|
-
children: [/* @__PURE__ */ Q(
|
|
3007
|
-
leaving:
|
|
3028
|
+
"data-loading": j || void 0,
|
|
3029
|
+
onPointerLeave: () => pe(null),
|
|
3030
|
+
children: [/* @__PURE__ */ Q(de, {
|
|
3031
|
+
leaving: ae,
|
|
3008
3032
|
origin: "left",
|
|
3009
3033
|
children: /* @__PURE__ */ $("svg", {
|
|
3010
3034
|
"aria-hidden": "true",
|
|
3011
3035
|
className: "lilt-funnel-card__svg",
|
|
3012
|
-
viewBox: `0 0 ${
|
|
3036
|
+
viewBox: `0 0 ${q * 100} 100`,
|
|
3013
3037
|
preserveAspectRatio: "none",
|
|
3014
3038
|
children: [
|
|
3015
3039
|
/* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q("clipPath", {
|
|
3016
|
-
id:
|
|
3040
|
+
id: Ne,
|
|
3017
3041
|
children: /* @__PURE__ */ Q("rect", {
|
|
3018
3042
|
x: -10,
|
|
3019
3043
|
y: -10,
|
|
3020
|
-
width:
|
|
3044
|
+
width: ue < 1 ? q * 100 * ue + 10 : q * 100 + 20,
|
|
3021
3045
|
height: 120
|
|
3022
3046
|
})
|
|
3023
3047
|
}), J ? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("filter", {
|
|
@@ -3033,7 +3057,7 @@ function Pn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
3033
3057
|
floodColor: "black",
|
|
3034
3058
|
floodOpacity: .3
|
|
3035
3059
|
})
|
|
3036
|
-
}),
|
|
3060
|
+
}), De.map((e) => {
|
|
3037
3061
|
let t = e.index;
|
|
3038
3062
|
return /* @__PURE__ */ $(He, { children: [/* @__PURE__ */ Q("linearGradient", {
|
|
3039
3063
|
id: `${Y}-shade-${t}`,
|
|
@@ -3041,7 +3065,7 @@ function Pn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
3041
3065
|
y1: "0",
|
|
3042
3066
|
x2: "0",
|
|
3043
3067
|
y2: "1",
|
|
3044
|
-
children:
|
|
3068
|
+
children: _e(e.color, [
|
|
3045
3069
|
[0, -4],
|
|
3046
3070
|
[.16, 30],
|
|
3047
3071
|
[.34, 10],
|
|
@@ -3055,10 +3079,10 @@ function Pn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
3055
3079
|
y1: "0",
|
|
3056
3080
|
x2: "1",
|
|
3057
3081
|
y2: "1",
|
|
3058
|
-
children:
|
|
3082
|
+
children: _e(e.color, [[0, -6], [1, -34]])
|
|
3059
3083
|
})] }, e.id);
|
|
3060
3084
|
})] }) : null] }),
|
|
3061
|
-
o && !T ?
|
|
3085
|
+
o && !T ? z.map((e, t) => /* @__PURE__ */ Q("rect", {
|
|
3062
3086
|
className: "lilt-funnel-card__track",
|
|
3063
3087
|
x: t * 100,
|
|
3064
3088
|
y: 0,
|
|
@@ -3066,34 +3090,34 @@ function Pn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
3066
3090
|
height: 100
|
|
3067
3091
|
}, `track-${e.id}`)) : null,
|
|
3068
3092
|
T ? /* @__PURE__ */ Q(Gt, {
|
|
3069
|
-
width:
|
|
3093
|
+
width: q * 100,
|
|
3070
3094
|
height: 100,
|
|
3071
|
-
reduced:
|
|
3072
|
-
loadingStyle:
|
|
3095
|
+
reduced: A,
|
|
3096
|
+
loadingStyle: E,
|
|
3073
3097
|
depth: s,
|
|
3074
|
-
mask:
|
|
3098
|
+
mask: De.map((e) => /* @__PURE__ */ Q("path", {
|
|
3075
3099
|
className: "lilt-funnel-card__skeleton",
|
|
3076
3100
|
d: e.d
|
|
3077
3101
|
}, e.id)),
|
|
3078
3102
|
children: J ? /* @__PURE__ */ Q("g", {
|
|
3079
3103
|
transform: `translate(${J.left} 0) scale(${J.sx} 1)`,
|
|
3080
3104
|
filter: `url(#${Y}-shadow)`,
|
|
3081
|
-
children:
|
|
3082
|
-
}) :
|
|
3105
|
+
children: Be()
|
|
3106
|
+
}) : De.map((e) => /* @__PURE__ */ Q("path", {
|
|
3083
3107
|
className: "lilt-funnel-card__skeleton",
|
|
3084
3108
|
d: e.d,
|
|
3085
3109
|
"data-skeleton": "grow",
|
|
3086
|
-
style:
|
|
3110
|
+
style: ze(e.index)
|
|
3087
3111
|
}, e.id))
|
|
3088
3112
|
}) : /* @__PURE__ */ Q("g", {
|
|
3089
|
-
clipPath: `url(#${
|
|
3113
|
+
clipPath: `url(#${Ne})`,
|
|
3090
3114
|
children: J ? /* @__PURE__ */ Q("g", {
|
|
3091
3115
|
transform: `translate(${J.left} 0) scale(${J.sx} 1)`,
|
|
3092
3116
|
filter: `url(#${Y}-shadow)`,
|
|
3093
|
-
children:
|
|
3094
|
-
}) :
|
|
3117
|
+
children: Be()
|
|
3118
|
+
}) : Oe()
|
|
3095
3119
|
}),
|
|
3096
|
-
(J ? [] : Array.from({ length:
|
|
3120
|
+
(J ? [] : Array.from({ length: q - 1 })).map((e, t) => /* @__PURE__ */ Q("line", {
|
|
3097
3121
|
className: "lilt-funnel-card__divider",
|
|
3098
3122
|
x1: (t + 1) * 100,
|
|
3099
3123
|
x2: (t + 1) * 100,
|
|
@@ -3103,26 +3127,26 @@ function Pn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
3103
3127
|
}, `divider-${t}`))
|
|
3104
3128
|
]
|
|
3105
3129
|
})
|
|
3106
|
-
}),
|
|
3130
|
+
}), j ? null : z.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
3107
3131
|
type: "button",
|
|
3108
3132
|
tabIndex: -1,
|
|
3109
3133
|
"aria-hidden": "true",
|
|
3110
3134
|
className: "lilt-funnel-card__column",
|
|
3111
3135
|
"data-glide-id": e.id,
|
|
3112
|
-
"data-muted":
|
|
3136
|
+
"data-muted": Ce && e.id !== Ce.id || void 0,
|
|
3113
3137
|
style: J ? {
|
|
3114
|
-
left: `${(J.left + t * 100 * J.sx) / (
|
|
3115
|
-
width: `${100 * J.sx /
|
|
3138
|
+
left: `${(J.left + t * 100 * J.sx) / (q * 100) * 100}%`,
|
|
3139
|
+
width: `${100 * J.sx / q}%`
|
|
3116
3140
|
} : {
|
|
3117
|
-
left: `${t /
|
|
3118
|
-
width: `${100 /
|
|
3141
|
+
left: `${t / q * 100}%`,
|
|
3142
|
+
width: `${100 / q}%`
|
|
3119
3143
|
},
|
|
3120
|
-
onPointerEnter: () =>
|
|
3121
|
-
onClick: () =>
|
|
3144
|
+
onPointerEnter: () => pe(e.id),
|
|
3145
|
+
onClick: () => ge((t) => t === e.id ? null : e.id),
|
|
3122
3146
|
children: /* @__PURE__ */ Q("span", {
|
|
3123
3147
|
className: "lilt-funnel-card__pill",
|
|
3124
|
-
style: { opacity:
|
|
3125
|
-
children:
|
|
3148
|
+
style: { opacity: ue < (t + .5) / q ? 0 : Ce && e.id !== Ce.id ? .45 : 1 },
|
|
3149
|
+
children: An(e.share)
|
|
3126
3150
|
})
|
|
3127
3151
|
}, e.id))]
|
|
3128
3152
|
}), /* @__PURE__ */ Q(le, {
|
|
@@ -3130,28 +3154,28 @@ function Pn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
3130
3154
|
variant: oe(y),
|
|
3131
3155
|
swatch: ee,
|
|
3132
3156
|
"aria-label": `${e} by stage`,
|
|
3133
|
-
items:
|
|
3157
|
+
items: z.map((e, t) => ({
|
|
3134
3158
|
id: e.id,
|
|
3135
3159
|
label: e.label,
|
|
3136
|
-
color: e.value === null ? "transparent" :
|
|
3160
|
+
color: e.value === null ? "transparent" : Te(t),
|
|
3137
3161
|
value: e.value,
|
|
3138
|
-
formattedValue: e.value === null ? "No data" :
|
|
3162
|
+
formattedValue: e.value === null ? "No data" : M.value(e.value)
|
|
3139
3163
|
})),
|
|
3140
|
-
activeId:
|
|
3141
|
-
selectedId:
|
|
3142
|
-
onHoverIdChange:
|
|
3143
|
-
onSelectedIdChange:
|
|
3164
|
+
activeId: Ce?.id ?? null,
|
|
3165
|
+
selectedId: he,
|
|
3166
|
+
onHoverIdChange: pe,
|
|
3167
|
+
onSelectedIdChange: ge,
|
|
3144
3168
|
renderValue: T ? () => /* @__PURE__ */ Q("span", { className: "lilt-card__skeleton lilt-card__skeleton--tile" }) : void 0
|
|
3145
3169
|
})] })]
|
|
3146
3170
|
});
|
|
3147
3171
|
}
|
|
3148
3172
|
//#endregion
|
|
3149
3173
|
//#region src/cards/heatmap-chart-card.tsx
|
|
3150
|
-
var
|
|
3174
|
+
var In = [], Ln = {
|
|
3151
3175
|
rows: 7,
|
|
3152
3176
|
columns: 12
|
|
3153
|
-
},
|
|
3154
|
-
function
|
|
3177
|
+
}, Rn = 30, zn = 12, Bn = 8, Vn = (e, t) => `${e}\u0000${t}`;
|
|
3178
|
+
function Hn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
3155
3179
|
let s = (e, t) => e[t], c = (e) => ({
|
|
3156
3180
|
columns: [],
|
|
3157
3181
|
rows: [],
|
|
@@ -3175,7 +3199,7 @@ function Vn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
3175
3199
|
if (r) return c(`“${t}” isn’t listed in \`${o}\`.`);
|
|
3176
3200
|
n.push(t);
|
|
3177
3201
|
}
|
|
3178
|
-
let h =
|
|
3202
|
+
let h = Vn(m, e);
|
|
3179
3203
|
if (d.has(h)) return c(`${m}, ${e} appears twice; each cell needs one row.`);
|
|
3180
3204
|
let g = s(o, r), _ = typeof g == "number" && Number.isFinite(g) ? g : null;
|
|
3181
3205
|
_ !== null && (f = Math.min(f, _), p = Math.max(p, _)), d.set(h, {
|
|
@@ -3197,9 +3221,9 @@ function Vn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
3197
3221
|
columns: l,
|
|
3198
3222
|
rows: u,
|
|
3199
3223
|
cells: u.flatMap((e) => l.map((t) => {
|
|
3200
|
-
let n = d.get(
|
|
3224
|
+
let n = d.get(Vn(e, t)), r = n?.value ?? null;
|
|
3201
3225
|
return {
|
|
3202
|
-
id:
|
|
3226
|
+
id: Vn(e, t),
|
|
3203
3227
|
label: `${e}, ${t}`,
|
|
3204
3228
|
row: e,
|
|
3205
3229
|
column: t,
|
|
@@ -3212,18 +3236,18 @@ function Vn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
3212
3236
|
error: null
|
|
3213
3237
|
};
|
|
3214
3238
|
}
|
|
3215
|
-
var
|
|
3216
|
-
function
|
|
3217
|
-
if (t <=
|
|
3218
|
-
let n = Math.ceil(t /
|
|
3239
|
+
var Un = (e) => 12 + e * 83;
|
|
3240
|
+
function Wn(e, t) {
|
|
3241
|
+
if (t <= Bn) return "major";
|
|
3242
|
+
let n = Math.ceil(t / zn);
|
|
3219
3243
|
return e % (n * 2) == 0 ? "major" : e % n === 0 ? "minor" : "hidden";
|
|
3220
3244
|
}
|
|
3221
|
-
function
|
|
3222
|
-
let A = Ee(D), ae = x(
|
|
3245
|
+
function Gn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, domain: s, aggregate: c = "sum", height: l, radius: f = 5, gap: p = 4, depth: m = !1, headline: h, delta: g, deltaTone: _, range: v, ranges: y, defaultRange: ee, valueFormat: te, locale: ne, formatValue: b, color: S, surface: C = "elevated", badge: w, numberStyle: re, palette: ie, loading: T = !1, loadingStyle: E = "shimmer", motion: D = "auto", className: O, style: k }) {
|
|
3246
|
+
let A = Ee(D), ae = x(T, E), j = u(T, A), M = me({
|
|
3223
3247
|
valueFormat: te,
|
|
3224
3248
|
locale: ne,
|
|
3225
3249
|
formatValue: b
|
|
3226
|
-
}), [N, P] = X(ee ?? y?.[0]?.id), F = y?.find((e) => e.id === N) ?? y?.[0], I = F?.data ?? t ??
|
|
3250
|
+
}), [N, P] = X(ee ?? y?.[0]?.id), F = y?.find((e) => e.id === N) ?? y?.[0], I = F?.data ?? t ?? In, L = F ? F.delta : g, R = qe(() => Hn({
|
|
3227
3251
|
data: I,
|
|
3228
3252
|
x: n,
|
|
3229
3253
|
y: r,
|
|
@@ -3239,11 +3263,11 @@ function Wn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3239
3263
|
a,
|
|
3240
3264
|
o,
|
|
3241
3265
|
s
|
|
3242
|
-
]), z = Rt(R.cells, !
|
|
3266
|
+
]), z = Rt(R.cells, !T && !j, void 0, void 0, R.columns.length), B = R.cells.find((e) => e.id === z.active?.id), oe = R.cells.flatMap((e) => e.value === null ? [] : [e.value]), V = F?.headline ?? h ?? ce(oe, c), H = R.cells.some((e) => e.value === null), se = !T && (R.error !== null || R.cells.length === 0), U = T && !R.cells.length ? Ln : {
|
|
3243
3267
|
rows: R.rows.length,
|
|
3244
3268
|
columns: R.columns.length
|
|
3245
|
-
}, le = l ? Math.max(8, (l - p * Math.max(0, U.rows - 1)) / Math.max(1, U.rows)) :
|
|
3246
|
-
return /* @__PURE__ */ $(
|
|
3269
|
+
}, le = l ? Math.max(8, (l - p * Math.max(0, U.rows - 1)) / Math.max(1, U.rows)) : Rn;
|
|
3270
|
+
return /* @__PURE__ */ $(Ie, {
|
|
3247
3271
|
motion: D,
|
|
3248
3272
|
className: ["lilt-heatmap-card", O].filter(Boolean).join(" "),
|
|
3249
3273
|
style: {
|
|
@@ -3257,10 +3281,10 @@ function Wn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3257
3281
|
"aria-label": e,
|
|
3258
3282
|
surface: C,
|
|
3259
3283
|
badge: w,
|
|
3260
|
-
numberStyle:
|
|
3261
|
-
palette:
|
|
3262
|
-
children: [/* @__PURE__ */ $(
|
|
3263
|
-
aside: y || v ? /* @__PURE__ */ Q(
|
|
3284
|
+
numberStyle: re,
|
|
3285
|
+
palette: ie,
|
|
3286
|
+
children: [/* @__PURE__ */ $(Fe, {
|
|
3287
|
+
aside: y || v ? /* @__PURE__ */ Q(Pe, {
|
|
3264
3288
|
label: v,
|
|
3265
3289
|
options: y?.map(({ id: e, label: t }) => ({
|
|
3266
3290
|
id: e,
|
|
@@ -3269,32 +3293,32 @@ function Wn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3269
3293
|
value: F?.id,
|
|
3270
3294
|
onValueChange: P
|
|
3271
3295
|
}) : null,
|
|
3272
|
-
children: [/* @__PURE__ */ Q(
|
|
3273
|
-
value: B ? B.value :
|
|
3296
|
+
children: [/* @__PURE__ */ Q(Me, { children: e }), /* @__PURE__ */ Q(je, {
|
|
3297
|
+
value: B ? B.value : V,
|
|
3274
3298
|
format: M.value,
|
|
3275
|
-
loading:
|
|
3299
|
+
loading: T,
|
|
3276
3300
|
motion: D,
|
|
3277
|
-
children:
|
|
3301
|
+
children: T ? null : B ? /* @__PURE__ */ $(ke, { children: [
|
|
3278
3302
|
B.row,
|
|
3279
3303
|
" · ",
|
|
3280
3304
|
B.column,
|
|
3281
3305
|
B.value === null ? " · No data" : ""
|
|
3282
|
-
] }) : L === void 0 ? null : /* @__PURE__ */ Q(
|
|
3306
|
+
] }) : L === void 0 ? null : /* @__PURE__ */ Q(Ae, {
|
|
3283
3307
|
value: L,
|
|
3284
3308
|
tone: _
|
|
3285
3309
|
})
|
|
3286
3310
|
})]
|
|
3287
|
-
}), /* @__PURE__ */ Q(
|
|
3311
|
+
}), /* @__PURE__ */ Q(de, {
|
|
3288
3312
|
leaving: j,
|
|
3289
3313
|
origin: "center",
|
|
3290
|
-
children:
|
|
3314
|
+
children: se ? /* @__PURE__ */ Q(d, {
|
|
3291
3315
|
kind: R.error ? "error" : "empty",
|
|
3292
3316
|
message: R.error ?? "No cells for this period."
|
|
3293
|
-
}) :
|
|
3317
|
+
}) : T ? /* @__PURE__ */ $("div", {
|
|
3294
3318
|
ref: ae,
|
|
3295
3319
|
className: "lilt-heatmap-card__placeholder lilt-skeleton",
|
|
3296
3320
|
"aria-hidden": "true",
|
|
3297
|
-
"data-style":
|
|
3321
|
+
"data-style": E,
|
|
3298
3322
|
"data-depth": m || void 0,
|
|
3299
3323
|
"data-reduced-motion": A || void 0,
|
|
3300
3324
|
children: [/* @__PURE__ */ $("table", {
|
|
@@ -3348,7 +3372,7 @@ function Wn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3348
3372
|
"data-active": B?.id === a.id || void 0,
|
|
3349
3373
|
"data-muted": B && !o || void 0,
|
|
3350
3374
|
style: {
|
|
3351
|
-
"--lilt-heatmap-card-strength": a.intensity === null ? void 0 : `${
|
|
3375
|
+
"--lilt-heatmap-card-strength": a.intensity === null ? void 0 : `${Un(a.intensity)}%`,
|
|
3352
3376
|
"--lilt-heatmap-card-delay": `${Math.min(160, r * 12)}ms`
|
|
3353
3377
|
}
|
|
3354
3378
|
})
|
|
@@ -3363,7 +3387,7 @@ function Wn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3363
3387
|
scope: "col",
|
|
3364
3388
|
role: "columnheader",
|
|
3365
3389
|
className: "lilt-heatmap-card__column-label",
|
|
3366
|
-
"data-tier":
|
|
3390
|
+
"data-tier": Wn(t, R.columns.length),
|
|
3367
3391
|
"data-active": B?.column === e || void 0,
|
|
3368
3392
|
children: /* @__PURE__ */ Q("span", { children: e })
|
|
3369
3393
|
}, e))]
|
|
@@ -3371,7 +3395,7 @@ function Wn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3371
3395
|
})]
|
|
3372
3396
|
}), /* @__PURE__ */ $("div", {
|
|
3373
3397
|
className: "lilt-heatmap-card__footer",
|
|
3374
|
-
children: [
|
|
3398
|
+
children: [H ? /* @__PURE__ */ $("span", {
|
|
3375
3399
|
className: "lilt-heatmap-card__key",
|
|
3376
3400
|
children: [/* @__PURE__ */ Q("span", {
|
|
3377
3401
|
className: "lilt-heatmap-card__swatch",
|
|
@@ -3395,7 +3419,7 @@ function Wn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3395
3419
|
}
|
|
3396
3420
|
//#endregion
|
|
3397
3421
|
//#region src/engine/scatter.ts
|
|
3398
|
-
function
|
|
3422
|
+
function Kn(e, t, n, r, i = !1) {
|
|
3399
3423
|
if (!i) {
|
|
3400
3424
|
let r = null, i = Infinity;
|
|
3401
3425
|
for (let a of e) {
|
|
@@ -3415,7 +3439,7 @@ function Gn(e, t, n, r, i = !1) {
|
|
|
3415
3439
|
}
|
|
3416
3440
|
//#endregion
|
|
3417
3441
|
//#region src/cards/scatter-chart-card.tsx
|
|
3418
|
-
var
|
|
3442
|
+
var qn = [], Jn = 260, Yn = 4, Xn = 4.5, Zn = 3, Qn = [
|
|
3419
3443
|
[
|
|
3420
3444
|
.08,
|
|
3421
3445
|
.72,
|
|
@@ -3477,7 +3501,7 @@ var Kn = [], qn = 260, Jn = 4, Yn = 4.5, Xn = 3, Zn = [
|
|
|
3477
3501
|
9
|
|
3478
3502
|
]
|
|
3479
3503
|
];
|
|
3480
|
-
function
|
|
3504
|
+
function $n(e, t = 5) {
|
|
3481
3505
|
if (!e.length) return [0, 1];
|
|
3482
3506
|
let [n, r] = et(e);
|
|
3483
3507
|
if (n >= 0 && n <= r * .25 && (n = 0), n === r) {
|
|
@@ -3487,7 +3511,7 @@ function Qn(e, t = 5) {
|
|
|
3487
3511
|
let [i, a] = Qe().domain([n, r]).nice(t).domain();
|
|
3488
3512
|
return [i, a];
|
|
3489
3513
|
}
|
|
3490
|
-
function
|
|
3514
|
+
function er(e) {
|
|
3491
3515
|
if (e.length < 3) return null;
|
|
3492
3516
|
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;
|
|
3493
3517
|
for (let { x: t, y: s } of e) i += (t - n) ** 2, a += (t - n) * (s - r), o += (s - r) ** 2;
|
|
@@ -3499,8 +3523,8 @@ function $n(e) {
|
|
|
3499
3523
|
r2: o === 0 ? 1 : a * a / (i * o)
|
|
3500
3524
|
};
|
|
3501
3525
|
}
|
|
3502
|
-
var
|
|
3503
|
-
function
|
|
3526
|
+
var tr = (e, t, n) => `${e} ${e === 1 ? t : n}`, nr = (e, t) => t === void 0 ? void 0 : e[t], rr = (e) => typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
3527
|
+
function ir(e, [t, n], [r, i]) {
|
|
3504
3528
|
let a = (t) => e.slope * t + e.intercept, o = t, s = n;
|
|
3505
3529
|
if (e.slope !== 0) {
|
|
3506
3530
|
let t = (r - e.intercept) / e.slope, n = (i - e.intercept) / e.slope;
|
|
@@ -3513,53 +3537,53 @@ function rr(e, [t, n], [r, i]) {
|
|
|
3513
3537
|
a(s)
|
|
3514
3538
|
];
|
|
3515
3539
|
}
|
|
3516
|
-
function
|
|
3517
|
-
let L = Ee(N), R = u(j, L), z = j || R, B =
|
|
3540
|
+
function ar({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, label: c, xLabel: l, yLabel: f, trend: p = !1, depth: m = !1, height: h = Jn, aggregate: g = "sum", headline: _, delta: v, deltaTone: y, range: te, ranges: ne, defaultRange: b, valueFormat: x, legend: C = "tiles", legendSwatch: w, xFormat: re, locale: ie = "en-US", formatValue: T, formatX: E, color: D, surface: O = "elevated", badge: k, numberStyle: A, palette: ae, loading: j = !1, loadingStyle: M = "shimmer", motion: N = "auto", className: P, style: F }) {
|
|
3541
|
+
let L = Ee(N), R = u(j, L), z = j || R, B = me({
|
|
3518
3542
|
valueFormat: x,
|
|
3519
|
-
locale:
|
|
3520
|
-
formatValue:
|
|
3521
|
-
}),
|
|
3522
|
-
let e = [], t =
|
|
3523
|
-
let t =
|
|
3543
|
+
locale: ie,
|
|
3544
|
+
formatValue: T
|
|
3545
|
+
}), V = JSON.stringify(re ?? null), H = qe(() => I(ie, re), [ie, V]), se = E ?? H.full, [U, ue] = X(b ?? ne?.[0]?.id), fe = ne?.find((e) => e.id === U) ?? ne?.[0], pe = fe?.data ?? n ?? qn, he = fe ? fe.delta : v, { ref: ge, width: _e } = ee(), W = _e || 480, ve = qe(() => {
|
|
3546
|
+
let e = [], t = pe.map((e) => {
|
|
3547
|
+
let t = nr(e, c);
|
|
3524
3548
|
return typeof t == "string" && t ? t : null;
|
|
3525
3549
|
}), n = (e) => e !== null && t.indexOf(e) === t.lastIndexOf(e);
|
|
3526
3550
|
return {
|
|
3527
|
-
rows:
|
|
3528
|
-
let l = s === void 0 ? null : String(
|
|
3551
|
+
rows: pe.map((o, c) => {
|
|
3552
|
+
let l = s === void 0 ? null : String(nr(o, s) ?? "");
|
|
3529
3553
|
l !== null && !e.includes(l) && e.push(l);
|
|
3530
3554
|
let u = t[c];
|
|
3531
3555
|
return {
|
|
3532
3556
|
id: n(u) ? u : `${u ?? ""}\u0000${c}`,
|
|
3533
3557
|
label: u ?? `Point ${c + 1}`,
|
|
3534
3558
|
row: o,
|
|
3535
|
-
x: nr(
|
|
3536
|
-
y: nr(
|
|
3537
|
-
size: a === void 0 ? 1 : nr(
|
|
3559
|
+
x: rr(nr(o, r)),
|
|
3560
|
+
y: rr(nr(o, i)),
|
|
3561
|
+
size: a === void 0 ? 1 : rr(nr(o, a)),
|
|
3538
3562
|
group: l
|
|
3539
3563
|
};
|
|
3540
3564
|
}),
|
|
3541
3565
|
groups: e
|
|
3542
3566
|
};
|
|
3543
3567
|
}, [
|
|
3544
|
-
|
|
3568
|
+
pe,
|
|
3545
3569
|
r,
|
|
3546
3570
|
i,
|
|
3547
3571
|
a,
|
|
3548
3572
|
s,
|
|
3549
3573
|
c
|
|
3550
|
-
]),
|
|
3574
|
+
]), ye = ve.rows.filter((e) => e.x !== null && e.y !== null), G = ve.rows.length - ye.length, [be, xe] = X([]), Se = ye.filter((e) => e.group === null || !be.includes(e.group)), Ce = (e) => e === null ? "var(--lilt-scatter-card-color, var(--lilt-series-1))" : `var(--lilt-series-${ve.groups.indexOf(e) % 6 + 1})`, we = W < 420 ? 3 : 5, Te = $n(ye.map((e) => e.x), we), K = $n(ye.map((e) => e.y), Yn), q = Qe().domain(K).ticks(Yn), De = Qe().domain(Te).ticks(we), Oe = Math.max(8, Math.min(16, W / 36)), J = Math.max(24, ...q.map((e) => B.axis(e).length * 6.6 + 10)), Ne = a === void 0 ? 6.5 : Oe, Le = (f ? 26 : 10) + Ne, Y = h - 26 - (l ? 16 : 0) - Ne, Re = J + Ne, ze = W - Ne - 2, Be = Qe().domain(Te).range([Re, ze]), Ve = Qe().domain(K).range([Y, Le]), He = Math.max(1, ...ye.map((e) => e.size ?? 0)), We = (e) => a === void 0 ? Xn : Zn + (Oe - Zn) * Math.sqrt(Math.max(0, e ?? 0) / He), Ke = [...Se].sort((e, t) => e.x - t.x || e.y - t.y).map((e, t) => ({
|
|
3551
3575
|
...e,
|
|
3552
3576
|
cx: Be(e.x),
|
|
3553
3577
|
cy: Ve(e.y),
|
|
3554
3578
|
radius: We(e.size),
|
|
3555
|
-
color:
|
|
3579
|
+
color: Ce(e.group),
|
|
3556
3580
|
order: t
|
|
3557
|
-
})), Je = p ?
|
|
3581
|
+
})), Je = p ? er(Se) : null, Ye = Je && Ke.length ? ir(Je, [Ke[0].x, Ke.at(-1).x], K) : null, Xe = H.plain, [Ze, $e] = X(null), [et, tt] = X(null), [nt, rt] = X(null), [it, at] = X(null), [ot, st] = X(null), ct = (e) => Ke.find((t) => t.id === e), lt = `lilt-scatter-${Ge().replace(/:/g, "")}`, ut = [...new Set(Ke.map((e) => e.color))], dt = ct(et) ?? ct(nt) ?? ct(Ze), ft = dt ? null : ot ?? it, pt = ve.groups.map((e) => ({
|
|
3558
3582
|
name: e,
|
|
3559
|
-
value:
|
|
3560
|
-
})), mt =
|
|
3583
|
+
value: ce(ye.filter((t) => t.group === e).map((e) => e.y), g)
|
|
3584
|
+
})), mt = fe?.headline ?? _ ?? ce(Se.map((e) => e.y), g), ht = dt ? dt.y : ft === null ? mt : pt.find((e) => e.name === ft)?.value ?? null, gt = (e) => l ? `${l} ${se(e)}` : se(e), _t = (e) => `${e.label}: ${gt(e.x)}, ${f ? `${f} ` : ""}${B.value(e.y)}${a === void 0 || e.size === null ? "" : `, ${o ?? "size"} ${Xe(e.size)}`}`, vt = (e, t, n) => {
|
|
3561
3585
|
let r = n.getBoundingClientRect();
|
|
3562
|
-
return
|
|
3586
|
+
return Kn(Ke, e - r.left, t - r.top, et);
|
|
3563
3587
|
}, yt = (e) => {
|
|
3564
3588
|
e.pointerType !== "touch" && $e(vt(e.clientX, e.clientY, e.currentTarget));
|
|
3565
3589
|
}, bt = It({
|
|
@@ -3569,8 +3593,8 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3569
3593
|
onTap: (e) => tt((t) => e && t !== e ? e : null),
|
|
3570
3594
|
disabled: j
|
|
3571
3595
|
}), xt = Ue((e) => {
|
|
3572
|
-
|
|
3573
|
-
}, [bt,
|
|
3596
|
+
ge.current = e, bt(e);
|
|
3597
|
+
}, [bt, ge]), St = (e) => {
|
|
3574
3598
|
if (!Ke.length) return;
|
|
3575
3599
|
let t = ct(nt) ?? ct(et), n = t ? t.order : -1, r = null;
|
|
3576
3600
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") r = n + 1;
|
|
@@ -3585,8 +3609,8 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3585
3609
|
return;
|
|
3586
3610
|
} else return;
|
|
3587
3611
|
e.preventDefault(), rt(Ke[Math.max(0, Math.min(Ke.length - 1, r))].id);
|
|
3588
|
-
}, Ct = !j &&
|
|
3589
|
-
return /* @__PURE__ */ $(
|
|
3612
|
+
}, Ct = !j && ve.rows.length === 0, wt = !j && ve.rows.length > 0 && ye.length === 0, Tt = (e) => dt && Math.abs(Be(e) - dt.cx) < 40, Et = (e) => dt && Math.abs(Ve(e) - dt.cy) < 16;
|
|
3613
|
+
return /* @__PURE__ */ $(Ie, {
|
|
3590
3614
|
motion: N,
|
|
3591
3615
|
className: ["lilt-scatter-card", P].filter(Boolean).join(" "),
|
|
3592
3616
|
style: {
|
|
@@ -3598,29 +3622,29 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3598
3622
|
badge: k,
|
|
3599
3623
|
numberStyle: A,
|
|
3600
3624
|
palette: ae,
|
|
3601
|
-
children: [/* @__PURE__ */ $(
|
|
3602
|
-
aside: ne || te ? /* @__PURE__ */ Q(
|
|
3625
|
+
children: [/* @__PURE__ */ $(Fe, {
|
|
3626
|
+
aside: ne || te ? /* @__PURE__ */ Q(Pe, {
|
|
3603
3627
|
label: te,
|
|
3604
3628
|
options: ne?.map(({ id: e, label: t }) => ({
|
|
3605
3629
|
id: e,
|
|
3606
3630
|
label: t
|
|
3607
3631
|
})),
|
|
3608
|
-
value:
|
|
3609
|
-
onValueChange:
|
|
3632
|
+
value: fe?.id,
|
|
3633
|
+
onValueChange: ue
|
|
3610
3634
|
}) : null,
|
|
3611
|
-
children: [/* @__PURE__ */ Q(
|
|
3635
|
+
children: [/* @__PURE__ */ Q(Me, { children: t }), /* @__PURE__ */ Q(je, {
|
|
3612
3636
|
value: j ? null : ht,
|
|
3613
3637
|
format: B.value,
|
|
3614
3638
|
loading: j,
|
|
3615
3639
|
motion: N,
|
|
3616
|
-
children: j ? null : dt ? /* @__PURE__ */ $(
|
|
3640
|
+
children: j ? null : dt ? /* @__PURE__ */ $(ke, { children: [
|
|
3617
3641
|
dt.label,
|
|
3618
3642
|
" · ",
|
|
3619
3643
|
gt(dt.x)
|
|
3620
|
-
] }) : ft === null ?
|
|
3621
|
-
value:
|
|
3644
|
+
] }) : ft === null ? he === void 0 ? null : /* @__PURE__ */ Q(Ae, {
|
|
3645
|
+
value: he,
|
|
3622
3646
|
tone: y
|
|
3623
|
-
}) : /* @__PURE__ */ Q(
|
|
3647
|
+
}) : /* @__PURE__ */ Q(ke, { children: ft })
|
|
3624
3648
|
})]
|
|
3625
3649
|
}), Ct || wt ? /* @__PURE__ */ Q(d, {
|
|
3626
3650
|
kind: "empty",
|
|
@@ -3637,7 +3661,7 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3637
3661
|
"data-active": dt ? "" : void 0,
|
|
3638
3662
|
tabIndex: z ? void 0 : 0,
|
|
3639
3663
|
role: "group",
|
|
3640
|
-
"aria-label": `${t}: ${
|
|
3664
|
+
"aria-label": `${t}: ${tr(Ke.length, "point", "points")}. Arrow keys step through them in order of ${l ?? "x"}; Enter pins one.`,
|
|
3641
3665
|
onPointerMove: z ? void 0 : yt,
|
|
3642
3666
|
onPointerLeave: () => $e(null),
|
|
3643
3667
|
onClick: () => tt((e) => Ze && e !== Ze ? Ze : null),
|
|
@@ -3648,15 +3672,15 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3648
3672
|
"aria-hidden": "true",
|
|
3649
3673
|
className: "lilt-scatter-card__svg",
|
|
3650
3674
|
"data-depth": m || void 0,
|
|
3651
|
-
width:
|
|
3675
|
+
width: W,
|
|
3652
3676
|
height: h,
|
|
3653
|
-
viewBox: `0 0 ${
|
|
3677
|
+
viewBox: `0 0 ${W} ${h}`,
|
|
3654
3678
|
children: [
|
|
3655
3679
|
/* @__PURE__ */ Q("g", {
|
|
3656
3680
|
className: "lilt-scatter-card__grid",
|
|
3657
|
-
children:
|
|
3658
|
-
x1:
|
|
3659
|
-
x2:
|
|
3681
|
+
children: q.map((e) => /* @__PURE__ */ Q("line", {
|
|
3682
|
+
x1: J,
|
|
3683
|
+
x2: W,
|
|
3660
3684
|
y1: Ve(e),
|
|
3661
3685
|
y2: Ve(e)
|
|
3662
3686
|
}, e))
|
|
@@ -3664,22 +3688,22 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3664
3688
|
z ? null : /* @__PURE__ */ $("g", {
|
|
3665
3689
|
className: "lilt-chart__axis",
|
|
3666
3690
|
children: [
|
|
3667
|
-
|
|
3691
|
+
q.map((e) => /* @__PURE__ */ Q("text", {
|
|
3668
3692
|
className: "lilt-chart__axis-label",
|
|
3669
|
-
x:
|
|
3693
|
+
x: J - 10,
|
|
3670
3694
|
y: Ve(e),
|
|
3671
3695
|
dy: "0.35em",
|
|
3672
3696
|
textAnchor: "end",
|
|
3673
3697
|
opacity: +!Et(e),
|
|
3674
3698
|
children: B.axis(e)
|
|
3675
3699
|
}, e)),
|
|
3676
|
-
|
|
3700
|
+
De.map((e) => /* @__PURE__ */ Q("text", {
|
|
3677
3701
|
className: "lilt-chart__axis-label",
|
|
3678
3702
|
x: Be(e),
|
|
3679
|
-
y:
|
|
3703
|
+
y: Y + Ne + 18,
|
|
3680
3704
|
textAnchor: "middle",
|
|
3681
3705
|
opacity: +!Tt(e),
|
|
3682
|
-
children:
|
|
3706
|
+
children: H.compact(e)
|
|
3683
3707
|
}, e)),
|
|
3684
3708
|
f ? /* @__PURE__ */ Q("text", {
|
|
3685
3709
|
className: "lilt-scatter-card__axis-title",
|
|
@@ -3696,18 +3720,18 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3696
3720
|
}) : null
|
|
3697
3721
|
]
|
|
3698
3722
|
}),
|
|
3699
|
-
/* @__PURE__ */ Q(
|
|
3723
|
+
/* @__PURE__ */ Q(de, {
|
|
3700
3724
|
leaving: R,
|
|
3701
3725
|
origin: "bottom",
|
|
3702
3726
|
children: /* @__PURE__ */ Q("g", { children: j ? /* @__PURE__ */ $(Gt, {
|
|
3703
|
-
width:
|
|
3727
|
+
width: W,
|
|
3704
3728
|
height: h,
|
|
3705
3729
|
reduced: L,
|
|
3706
3730
|
loadingStyle: M,
|
|
3707
3731
|
depth: m,
|
|
3708
|
-
mask:
|
|
3732
|
+
mask: Qn.map(([e, t, n], r) => /* @__PURE__ */ Q("circle", {
|
|
3709
3733
|
cx: Re + (ze - Re) * e,
|
|
3710
|
-
cy:
|
|
3734
|
+
cy: Le + (Y - Le) * t,
|
|
3711
3735
|
r: a === void 0 ? 5.5 : n,
|
|
3712
3736
|
fill: "white"
|
|
3713
3737
|
}, r)),
|
|
@@ -3720,18 +3744,18 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3720
3744
|
region: {
|
|
3721
3745
|
x: 0,
|
|
3722
3746
|
y: 0,
|
|
3723
|
-
width:
|
|
3747
|
+
width: W,
|
|
3724
3748
|
height: h
|
|
3725
3749
|
}
|
|
3726
3750
|
})] }) : null, /* @__PURE__ */ Q("g", {
|
|
3727
3751
|
filter: m ? `url(#${lt}-loading-shadow)` : void 0,
|
|
3728
|
-
children:
|
|
3752
|
+
children: Qn.map(([e, t, n], r) => /* @__PURE__ */ Q("g", {
|
|
3729
3753
|
"data-skeleton": "pop",
|
|
3730
3754
|
style: { "--lilt-skeleton-step": e * 12 },
|
|
3731
3755
|
children: /* @__PURE__ */ Q("circle", {
|
|
3732
3756
|
className: "lilt-scatter-card__skeleton",
|
|
3733
3757
|
cx: Re + (ze - Re) * e,
|
|
3734
|
-
cy:
|
|
3758
|
+
cy: Le + (Y - Le) * t,
|
|
3735
3759
|
r: a === void 0 ? 5.5 : n,
|
|
3736
3760
|
style: m ? { fill: `url(#${lt}-loading)` } : void 0
|
|
3737
3761
|
})
|
|
@@ -3751,9 +3775,9 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3751
3775
|
x1: dt.cx,
|
|
3752
3776
|
x2: dt.cx,
|
|
3753
3777
|
y1: dt.cy,
|
|
3754
|
-
y2:
|
|
3778
|
+
y2: Y + Ne
|
|
3755
3779
|
}), /* @__PURE__ */ Q("line", {
|
|
3756
|
-
x1:
|
|
3780
|
+
x1: J,
|
|
3757
3781
|
x2: dt.cx,
|
|
3758
3782
|
y1: dt.cy,
|
|
3759
3783
|
y2: dt.cy
|
|
@@ -3765,7 +3789,7 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3765
3789
|
region: {
|
|
3766
3790
|
x: 0,
|
|
3767
3791
|
y: 0,
|
|
3768
|
-
width:
|
|
3792
|
+
width: W,
|
|
3769
3793
|
height: h
|
|
3770
3794
|
}
|
|
3771
3795
|
}), ut.map((t, n) => /* @__PURE__ */ Q(e, {
|
|
@@ -3803,14 +3827,14 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3803
3827
|
className: "lilt-chart__x-badge lilt-scatter-card__pill",
|
|
3804
3828
|
style: {
|
|
3805
3829
|
left: dt.cx,
|
|
3806
|
-
top:
|
|
3830
|
+
top: Y + Ne + 6,
|
|
3807
3831
|
transform: "translateX(-50%)"
|
|
3808
3832
|
},
|
|
3809
|
-
children:
|
|
3833
|
+
children: se(dt.x)
|
|
3810
3834
|
}), /* @__PURE__ */ Q("div", {
|
|
3811
3835
|
className: "lilt-chart__y-badge lilt-scatter-card__pill",
|
|
3812
3836
|
style: {
|
|
3813
|
-
right:
|
|
3837
|
+
right: W - J + 4,
|
|
3814
3838
|
top: dt.cy,
|
|
3815
3839
|
transform: "translateY(-50%)"
|
|
3816
3840
|
},
|
|
@@ -3823,7 +3847,7 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3823
3847
|
})
|
|
3824
3848
|
]
|
|
3825
3849
|
}),
|
|
3826
|
-
s !== void 0 &&
|
|
3850
|
+
s !== void 0 && ve.groups.length ? /* @__PURE__ */ Q(le, {
|
|
3827
3851
|
className: "lilt-card__tiles",
|
|
3828
3852
|
variant: oe(C),
|
|
3829
3853
|
swatch: w,
|
|
@@ -3831,21 +3855,21 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3831
3855
|
items: pt.map((e) => ({
|
|
3832
3856
|
id: e.name,
|
|
3833
3857
|
label: e.name,
|
|
3834
|
-
color:
|
|
3858
|
+
color: Ce(e.name),
|
|
3835
3859
|
value: e.value,
|
|
3836
3860
|
formattedValue: e.value === null ? "No data" : B.value(e.value)
|
|
3837
3861
|
})),
|
|
3838
3862
|
activeId: ft,
|
|
3839
3863
|
onHoverIdChange: at,
|
|
3840
|
-
hiddenIds:
|
|
3864
|
+
hiddenIds: be,
|
|
3841
3865
|
onHiddenIdsChange: (e) => {
|
|
3842
|
-
|
|
3866
|
+
xe(e), at(null), st(null);
|
|
3843
3867
|
},
|
|
3844
3868
|
renderValue: j ? () => /* @__PURE__ */ Q("span", { className: "lilt-card__skeleton lilt-card__skeleton--tile" }) : void 0
|
|
3845
3869
|
}) : null,
|
|
3846
|
-
!j && (Je ||
|
|
3870
|
+
!j && (Je || G) ? /* @__PURE__ */ $("div", {
|
|
3847
3871
|
className: "lilt-scatter-card__footer",
|
|
3848
|
-
children: [
|
|
3872
|
+
children: [G ? /* @__PURE__ */ $("span", { children: [tr(G, "point is", "points are"), " missing a value and not plotted"] }) : null, Je ? /* @__PURE__ */ $("span", {
|
|
3849
3873
|
className: "lilt-scatter-card__fit",
|
|
3850
3874
|
children: [
|
|
3851
3875
|
/* @__PURE__ */ Q("span", {
|
|
@@ -3883,13 +3907,13 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3883
3907
|
children: o ?? a
|
|
3884
3908
|
})
|
|
3885
3909
|
] }) }),
|
|
3886
|
-
/* @__PURE__ */ Q("tbody", { children:
|
|
3910
|
+
/* @__PURE__ */ Q("tbody", { children: ve.rows.map((e) => /* @__PURE__ */ $("tr", { children: [
|
|
3887
3911
|
/* @__PURE__ */ Q("th", {
|
|
3888
3912
|
scope: "row",
|
|
3889
3913
|
children: e.label
|
|
3890
3914
|
}),
|
|
3891
3915
|
s === void 0 ? null : /* @__PURE__ */ Q("td", { children: e.group }),
|
|
3892
|
-
/* @__PURE__ */ Q("td", { children: e.x === null ? "No data" :
|
|
3916
|
+
/* @__PURE__ */ Q("td", { children: e.x === null ? "No data" : se(e.x) }),
|
|
3893
3917
|
/* @__PURE__ */ Q("td", { children: e.y === null ? "No data" : B.value(e.y) }),
|
|
3894
3918
|
a === void 0 ? null : /* @__PURE__ */ Q("td", { children: e.size === null ? "No data" : Xe(e.size) })
|
|
3895
3919
|
] }, e.id)) })
|
|
@@ -3900,7 +3924,7 @@ function ir({ title: t, data: n, x: r, y: i, size: a, sizeLabel: o, group: s, la
|
|
|
3900
3924
|
}
|
|
3901
3925
|
//#endregion
|
|
3902
3926
|
//#region src/engine/sankey.ts
|
|
3903
|
-
function
|
|
3927
|
+
function or(e, t, n) {
|
|
3904
3928
|
let r = /* @__PURE__ */ new Set();
|
|
3905
3929
|
for (let t of e) {
|
|
3906
3930
|
if (!t.id || !t.label || r.has(t.id)) throw Error("Lilt SankeyChart requires unique nonempty node IDs and labels.");
|
|
@@ -3942,7 +3966,7 @@ function ar(e, t, n) {
|
|
|
3942
3966
|
losses: d
|
|
3943
3967
|
};
|
|
3944
3968
|
}
|
|
3945
|
-
function
|
|
3969
|
+
function sr(e, t, n, r = !1) {
|
|
3946
3970
|
if (!e.nodes.length) return {
|
|
3947
3971
|
nodes: [],
|
|
3948
3972
|
links: []
|
|
@@ -3989,7 +4013,7 @@ function or(e, t, n, r = !1) {
|
|
|
3989
4013
|
}
|
|
3990
4014
|
//#endregion
|
|
3991
4015
|
//#region src/cards/sankey-chart-card.tsx
|
|
3992
|
-
var
|
|
4016
|
+
var cr = [], lr = 280, ur = 460, dr = 6, fr = [
|
|
3993
4017
|
[
|
|
3994
4018
|
.02,
|
|
3995
4019
|
.32,
|
|
@@ -4025,14 +4049,14 @@ var sr = [], cr = 280, lr = 460, ur = 6, dr = [
|
|
|
4025
4049
|
.8,
|
|
4026
4050
|
.12
|
|
4027
4051
|
]
|
|
4028
|
-
],
|
|
4029
|
-
function
|
|
4052
|
+
], pr = (e, t) => e[t];
|
|
4053
|
+
function mr(e) {
|
|
4030
4054
|
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;
|
|
4031
4055
|
}
|
|
4032
|
-
function
|
|
4056
|
+
function hr({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
4033
4057
|
let a = [], o = /* @__PURE__ */ new Set(), s = [], c = /* @__PURE__ */ new Set();
|
|
4034
4058
|
for (let i of e) {
|
|
4035
|
-
let e = String(
|
|
4059
|
+
let e = String(pr(i, t) ?? "").trim(), l = String(pr(i, n) ?? "").trim();
|
|
4036
4060
|
if (!e || !l) return {
|
|
4037
4061
|
graph: null,
|
|
4038
4062
|
error: "Every flow needs a source and a target."
|
|
@@ -4047,7 +4071,7 @@ function mr({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
|
4047
4071
|
error: `${u} appears twice; combine it into one row.`
|
|
4048
4072
|
};
|
|
4049
4073
|
c.add(u);
|
|
4050
|
-
let d =
|
|
4074
|
+
let d = pr(i, r);
|
|
4051
4075
|
s.push({
|
|
4052
4076
|
id: u,
|
|
4053
4077
|
source: e,
|
|
@@ -4058,23 +4082,23 @@ function mr({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
|
4058
4082
|
}
|
|
4059
4083
|
try {
|
|
4060
4084
|
return {
|
|
4061
|
-
graph:
|
|
4085
|
+
graph: or(a, s, i === "strict" ? "strict" : "allow-loss"),
|
|
4062
4086
|
error: null
|
|
4063
4087
|
};
|
|
4064
4088
|
} catch (e) {
|
|
4065
4089
|
return {
|
|
4066
4090
|
graph: null,
|
|
4067
|
-
error:
|
|
4091
|
+
error: mr(e instanceof Error ? e.message : "Invalid flows.")
|
|
4068
4092
|
};
|
|
4069
4093
|
}
|
|
4070
4094
|
}
|
|
4071
|
-
var
|
|
4072
|
-
function
|
|
4073
|
-
let
|
|
4095
|
+
var gr = (e, t, n) => `${e} ${e === 1 ? t : n}`, _r = (e, t) => t > 0 ? `${Math.round(e / t * 100)}%` : "—";
|
|
4096
|
+
function vr({ title: e, data: t, source: n, target: r, value: i, conservation: a = "loss", depth: o = !1, height: s = lr, headline: c, delta: l, deltaTone: f, range: p, ranges: m, defaultRange: h, valueFormat: g, locale: _, formatValue: v, surface: y = "elevated", badge: te, numberStyle: ne, palette: b, loading: x = !1, loadingStyle: S = "shimmer", motion: C = "auto", className: w, style: re }) {
|
|
4097
|
+
let ie = Ee(C), T = u(x, ie), E = x || T, D = me({
|
|
4074
4098
|
valueFormat: g,
|
|
4075
4099
|
locale: _,
|
|
4076
4100
|
formatValue: v
|
|
4077
|
-
}), [O, k] = X(h ?? m?.[0]?.id), ae = m?.find((e) => e.id === O) ?? m?.[0], j = ae?.data ?? t ??
|
|
4101
|
+
}), [O, k] = X(h ?? m?.[0]?.id), ae = m?.find((e) => e.id === O) ?? m?.[0], j = ae?.data ?? t ?? cr, M = ae ? ae.delta : l, { ref: N, width: P } = ee(), F = P || 520, I = F < ur, L = `lilt-sankey-card-${Ge().replace(/:/g, "")}`, R = qe(() => hr({
|
|
4078
4102
|
data: j,
|
|
4079
4103
|
source: n,
|
|
4080
4104
|
target: r,
|
|
@@ -4086,7 +4110,7 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4086
4110
|
r,
|
|
4087
4111
|
i,
|
|
4088
4112
|
a
|
|
4089
|
-
]), z = R.graph, B = qe(() => z ?
|
|
4113
|
+
]), z = R.graph, B = qe(() => z ? sr(z, F, s, I) : {
|
|
4090
4114
|
nodes: [],
|
|
4091
4115
|
links: []
|
|
4092
4116
|
}, [
|
|
@@ -4094,57 +4118,57 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4094
4118
|
F,
|
|
4095
4119
|
s,
|
|
4096
4120
|
I
|
|
4097
|
-
]), oe = new Map(z?.nodes.map((e, t) => [e.id, t]) ?? []),
|
|
4098
|
-
let t =
|
|
4121
|
+
]), oe = new Map(z?.nodes.map((e, t) => [e.id, t]) ?? []), V = (e) => `var(--lilt-series-${(oe.get(e) ?? 0) % 6 + 1})`, H = Math.max(0, ...B.nodes.map((e) => e.depth)), ce = (e) => z?.links.filter((t) => t.target === e && t.value !== null).reduce((e, t) => e + t.value, 0) ?? 0, le = (e) => z?.links.filter((t) => t.source === e && t.value !== null).reduce((e, t) => e + t.value, 0) ?? 0, ue = (e) => z?.links.some((t) => (t.source === e || t.target === e) && t.value !== null) ? Math.max(ce(e), le(e)) : null, fe = (e) => {
|
|
4122
|
+
let t = ue(e);
|
|
4099
4123
|
return t === null ? "—" : D.value(t);
|
|
4100
|
-
},
|
|
4124
|
+
}, he = B.nodes.filter((e) => e.depth === 0).reduce((e, t) => e + le(t.id), 0) || 0, ge = z?.links.filter((e) => e.value === null).length ?? 0, _e = B.nodes.filter((e) => e.depth === 0).length, W = [...B.links].sort((e, t) => (B.nodes.find((t) => t.id === e.source)?.depth ?? 0) - (B.nodes.find((e) => e.id === t.source)?.depth ?? 0) || e.sourceY - t.sourceY), [ve, ye] = X(null), [G, be] = X(null), [xe, Se] = X(null), Ce = G ?? xe ?? ve, we = It({
|
|
4101
4125
|
resolve: Ft,
|
|
4102
|
-
onGlide:
|
|
4103
|
-
onLift: (e) => e !== null &&
|
|
4126
|
+
onGlide: ye,
|
|
4127
|
+
onLift: (e) => e !== null && be(e),
|
|
4104
4128
|
disabled: x
|
|
4105
|
-
}),
|
|
4106
|
-
N.current = e,
|
|
4107
|
-
}, [
|
|
4129
|
+
}), Te = Ue((e) => {
|
|
4130
|
+
N.current = e, we(e);
|
|
4131
|
+
}, [we, N]), K = B.links.find((e) => e.id === Ce), q = K ? void 0 : B.nodes.find((e) => e.id === Ce), De = (e) => K ? e.id === K.id : !q || e.source === q.id || e.target === q.id, Oe = Le({
|
|
4108
4132
|
key: ae?.id ?? 0,
|
|
4109
|
-
active: !
|
|
4133
|
+
active: !E,
|
|
4110
4134
|
duration: 720
|
|
4111
|
-
},
|
|
4112
|
-
if (
|
|
4113
|
-
else if (
|
|
4114
|
-
let e =
|
|
4115
|
-
|
|
4116
|
-
let n =
|
|
4117
|
-
|
|
4135
|
+
}, ie), J = ae?.headline ?? c ?? he, Ne = null;
|
|
4136
|
+
if (K) J = K.value, Ne = `${K.source} → ${K.target} · ${_r(K.value, ue(K.source) ?? 0)} of ${K.source}`;
|
|
4137
|
+
else if (q) {
|
|
4138
|
+
let e = ue(q.id), t = z?.losses[q.id];
|
|
4139
|
+
J = e;
|
|
4140
|
+
let n = q.depth === 0 && _e === 1;
|
|
4141
|
+
Ne = e === null ? `${q.label} · Not measured` : n || !he ? q.label : `${q.label} · ${_r(e, he)} of all`, t && (Ne += ` · ${D.value(t)} left here`);
|
|
4118
4142
|
}
|
|
4119
|
-
let
|
|
4120
|
-
if (!
|
|
4121
|
-
let t =
|
|
4143
|
+
let Y = () => K ? `${K.source} to ${K.target}: ${D.value(K.value)}` : q ? `${q.label}: ${fe(q.id)}` : "", Re = (e) => {
|
|
4144
|
+
if (!W.length) return;
|
|
4145
|
+
let t = W.findIndex((e) => e.id === (xe ?? G)), n = null;
|
|
4122
4146
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") n = t + 1;
|
|
4123
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") n = t < 0 ?
|
|
4147
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") n = t < 0 ? W.length - 1 : t - 1;
|
|
4124
4148
|
else if (e.key === "Home") n = 0;
|
|
4125
|
-
else if (e.key === "End") n =
|
|
4149
|
+
else if (e.key === "End") n = W.length - 1;
|
|
4126
4150
|
else if ((e.key === "Enter" || e.key === " ") && t >= 0) {
|
|
4127
4151
|
e.preventDefault();
|
|
4128
|
-
let n =
|
|
4129
|
-
|
|
4152
|
+
let n = W[t].id;
|
|
4153
|
+
be((e) => e === n ? null : n);
|
|
4130
4154
|
return;
|
|
4131
4155
|
} else if (e.key === "Escape") {
|
|
4132
|
-
|
|
4156
|
+
be(null), Se(null);
|
|
4133
4157
|
return;
|
|
4134
4158
|
} else return;
|
|
4135
|
-
e.preventDefault(),
|
|
4136
|
-
}, ze = (e) => I ? e ===
|
|
4137
|
-
return /* @__PURE__ */ $(
|
|
4159
|
+
e.preventDefault(), Se(W[Math.max(0, Math.min(W.length - 1, n))].id);
|
|
4160
|
+
}, ze = (e) => I ? e === H ? "end" : "start" : e === 0 ? "end" : "start", Be = !x && !R.error && j.length === 0;
|
|
4161
|
+
return /* @__PURE__ */ $(Ie, {
|
|
4138
4162
|
motion: C,
|
|
4139
4163
|
className: ["lilt-sankey-card", w].filter(Boolean).join(" "),
|
|
4140
|
-
style:
|
|
4164
|
+
style: re,
|
|
4141
4165
|
"aria-label": e,
|
|
4142
4166
|
surface: y,
|
|
4143
4167
|
badge: te,
|
|
4144
4168
|
numberStyle: ne,
|
|
4145
4169
|
palette: b,
|
|
4146
|
-
children: [/* @__PURE__ */ $(
|
|
4147
|
-
aside: m || p ? /* @__PURE__ */ Q(
|
|
4170
|
+
children: [/* @__PURE__ */ $(Fe, {
|
|
4171
|
+
aside: m || p ? /* @__PURE__ */ Q(Pe, {
|
|
4148
4172
|
label: p,
|
|
4149
4173
|
options: m?.map(({ id: e, label: t }) => ({
|
|
4150
4174
|
id: e,
|
|
@@ -4153,12 +4177,12 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4153
4177
|
value: ae?.id,
|
|
4154
4178
|
onValueChange: k
|
|
4155
4179
|
}) : null,
|
|
4156
|
-
children: [/* @__PURE__ */ Q(
|
|
4157
|
-
value: x ? null :
|
|
4180
|
+
children: [/* @__PURE__ */ Q(Me, { children: e }), /* @__PURE__ */ Q(je, {
|
|
4181
|
+
value: x ? null : J,
|
|
4158
4182
|
format: D.value,
|
|
4159
4183
|
loading: x,
|
|
4160
4184
|
motion: C,
|
|
4161
|
-
children: x ? null :
|
|
4185
|
+
children: x ? null : Ne ? /* @__PURE__ */ Q(ke, { children: Ne }) : M === void 0 ? null : /* @__PURE__ */ Q(Ae, {
|
|
4162
4186
|
value: M,
|
|
4163
4187
|
tone: f
|
|
4164
4188
|
})
|
|
@@ -4168,25 +4192,25 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4168
4192
|
message: R.error ?? "No flows for this period."
|
|
4169
4193
|
}) : /* @__PURE__ */ $(Z, { children: [
|
|
4170
4194
|
/* @__PURE__ */ $("div", {
|
|
4171
|
-
ref:
|
|
4195
|
+
ref: Te,
|
|
4172
4196
|
className: "lilt-sankey-card__plot",
|
|
4173
4197
|
"data-lilt-glide": "",
|
|
4174
4198
|
style: { height: s },
|
|
4175
|
-
"data-loading":
|
|
4176
|
-
"data-motion":
|
|
4177
|
-
"data-active":
|
|
4178
|
-
tabIndex:
|
|
4199
|
+
"data-loading": E || void 0,
|
|
4200
|
+
"data-motion": ie ? "none" : void 0,
|
|
4201
|
+
"data-active": Ce ? "" : void 0,
|
|
4202
|
+
tabIndex: E ? void 0 : 0,
|
|
4179
4203
|
role: "group",
|
|
4180
|
-
"aria-label": `${e}: ${
|
|
4181
|
-
onKeyDown:
|
|
4182
|
-
onBlur: () =>
|
|
4183
|
-
onPointerLeave: () =>
|
|
4204
|
+
"aria-label": `${e}: ${gr(B.links.length, "flow", "flows")} between ${gr(B.nodes.length, "step", "steps")}. Arrow keys step through the flows; Enter pins one.`,
|
|
4205
|
+
onKeyDown: E ? void 0 : Re,
|
|
4206
|
+
onBlur: () => Se(null),
|
|
4207
|
+
onPointerLeave: () => ye(null),
|
|
4184
4208
|
onClick: (e) => {
|
|
4185
4209
|
let t = e.target;
|
|
4186
|
-
(t === e.currentTarget || t.tagName === "svg") &&
|
|
4210
|
+
(t === e.currentTarget || t.tagName === "svg") && be(null);
|
|
4187
4211
|
},
|
|
4188
|
-
children: [/* @__PURE__ */ Q(
|
|
4189
|
-
leaving:
|
|
4212
|
+
children: [/* @__PURE__ */ Q(de, {
|
|
4213
|
+
leaving: T,
|
|
4190
4214
|
origin: "left",
|
|
4191
4215
|
children: /* @__PURE__ */ Q("svg", {
|
|
4192
4216
|
"aria-hidden": "true",
|
|
@@ -4197,10 +4221,10 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4197
4221
|
children: x ? /* @__PURE__ */ Q(Gt, {
|
|
4198
4222
|
width: F,
|
|
4199
4223
|
height: s,
|
|
4200
|
-
reduced:
|
|
4224
|
+
reduced: ie,
|
|
4201
4225
|
loadingStyle: S,
|
|
4202
4226
|
depth: o,
|
|
4203
|
-
mask:
|
|
4227
|
+
mask: fr.map(([e, t, n, r, i], a) => {
|
|
4204
4228
|
let o = (e + n) / 2 * F;
|
|
4205
4229
|
return /* @__PURE__ */ Q("path", {
|
|
4206
4230
|
d: `M${e * F},${t * s} C${o},${t * s} ${o},${r * s} ${n * F},${r * s}`,
|
|
@@ -4209,7 +4233,7 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4209
4233
|
strokeWidth: i * s
|
|
4210
4234
|
}, a);
|
|
4211
4235
|
}),
|
|
4212
|
-
children:
|
|
4236
|
+
children: fr.map(([e, t, n, r, i], a) => {
|
|
4213
4237
|
let c = (e + n) / 2 * F, l = `M${e * F},${t * s} C${c},${t * s} ${c},${r * s} ${n * F},${r * s}`, u = { "--lilt-skeleton-step": e * 12 + a * .6 }, d = {
|
|
4214
4238
|
pathLength: 1,
|
|
4215
4239
|
strokeDasharray: 1
|
|
@@ -4217,11 +4241,11 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4217
4241
|
return o ? /* @__PURE__ */ Q("g", {
|
|
4218
4242
|
"data-lilt-tube": "",
|
|
4219
4243
|
style: u,
|
|
4220
|
-
children:
|
|
4244
|
+
children: pe(i * s, "tube", [0, 1]).map((e, t) => /* @__PURE__ */ Q("path", {
|
|
4221
4245
|
d: l,
|
|
4222
4246
|
fill: "none",
|
|
4223
4247
|
transform: e.transform,
|
|
4224
|
-
stroke:
|
|
4248
|
+
stroke: se(Ut, e.amount),
|
|
4225
4249
|
strokeWidth: e.strokeWidth,
|
|
4226
4250
|
"data-skeleton": "stroke",
|
|
4227
4251
|
...d
|
|
@@ -4241,7 +4265,7 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4241
4265
|
children: /* @__PURE__ */ Q("rect", {
|
|
4242
4266
|
x: 0,
|
|
4243
4267
|
y: 0,
|
|
4244
|
-
width: F *
|
|
4268
|
+
width: F * Oe,
|
|
4245
4269
|
height: s
|
|
4246
4270
|
})
|
|
4247
4271
|
}) }),
|
|
@@ -4252,21 +4276,21 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4252
4276
|
className: "lilt-sankey-card__flow",
|
|
4253
4277
|
"data-flow": e.id,
|
|
4254
4278
|
"data-glide-id": e.id,
|
|
4255
|
-
"data-active": e.id ===
|
|
4256
|
-
"data-muted":
|
|
4257
|
-
onPointerEnter: () =>
|
|
4279
|
+
"data-active": e.id === K?.id || void 0,
|
|
4280
|
+
"data-muted": Ce && !De(e) || void 0,
|
|
4281
|
+
onPointerEnter: () => ye(e.id),
|
|
4258
4282
|
onClick: (t) => {
|
|
4259
|
-
t.stopPropagation(),
|
|
4283
|
+
t.stopPropagation(), be((t) => t === e.id ? null : e.id);
|
|
4260
4284
|
}
|
|
4261
4285
|
};
|
|
4262
4286
|
return o ? /* @__PURE__ */ Q("g", {
|
|
4263
4287
|
...t,
|
|
4264
|
-
children:
|
|
4288
|
+
children: pe(e.width, "tube", [0, 1]).map((t, n) => /* @__PURE__ */ Q("path", {
|
|
4265
4289
|
d: e.path,
|
|
4266
4290
|
fill: "none",
|
|
4267
4291
|
transform: t.transform,
|
|
4268
4292
|
style: {
|
|
4269
|
-
stroke:
|
|
4293
|
+
stroke: se(V(e.source), t.amount),
|
|
4270
4294
|
strokeWidth: t.strokeWidth,
|
|
4271
4295
|
strokeOpacity: 1
|
|
4272
4296
|
}
|
|
@@ -4275,17 +4299,17 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4275
4299
|
...t,
|
|
4276
4300
|
d: e.path,
|
|
4277
4301
|
strokeWidth: e.width,
|
|
4278
|
-
style: { stroke:
|
|
4302
|
+
style: { stroke: V(e.source) }
|
|
4279
4303
|
}, e.id);
|
|
4280
4304
|
})
|
|
4281
4305
|
}),
|
|
4282
4306
|
B.nodes.map((e) => {
|
|
4283
|
-
let t =
|
|
4284
|
-
onPointerEnter: () =>
|
|
4285
|
-
onClick: () =>
|
|
4307
|
+
let t = Ce && e.id !== q?.id && e.id !== K?.source && e.id !== K?.target || void 0, n = Math.max(2, e.height), r = {
|
|
4308
|
+
onPointerEnter: () => ye(e.id),
|
|
4309
|
+
onClick: () => be((t) => t === e.id ? null : e.id)
|
|
4286
4310
|
};
|
|
4287
4311
|
if (o) {
|
|
4288
|
-
let i = U(e.x, e.y, e.width +
|
|
4312
|
+
let i = U(e.x, e.y, e.width + dr, n, dr), a = A(V(e.id));
|
|
4289
4313
|
return /* @__PURE__ */ $("g", {
|
|
4290
4314
|
className: "lilt-sankey-card__node",
|
|
4291
4315
|
"data-node": e.id,
|
|
@@ -4318,7 +4342,7 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4318
4342
|
width: e.width,
|
|
4319
4343
|
height: n,
|
|
4320
4344
|
rx: 3,
|
|
4321
|
-
style: { fill:
|
|
4345
|
+
style: { fill: V(e.id) },
|
|
4322
4346
|
...r
|
|
4323
4347
|
}, e.id);
|
|
4324
4348
|
}),
|
|
@@ -4326,7 +4350,7 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4326
4350
|
let t = ze(e.depth), n = t === "end" ? e.x - 8 : e.x + e.width + 8, r = e.y + e.height / 2;
|
|
4327
4351
|
return /* @__PURE__ */ $("text", {
|
|
4328
4352
|
className: "lilt-sankey-card__label",
|
|
4329
|
-
"data-muted":
|
|
4353
|
+
"data-muted": Ce && e.id !== q?.id && e.id !== K?.source && e.id !== K?.target || void 0,
|
|
4330
4354
|
x: n,
|
|
4331
4355
|
y: r,
|
|
4332
4356
|
textAnchor: t,
|
|
@@ -4338,7 +4362,7 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4338
4362
|
x: n,
|
|
4339
4363
|
dy: "1.25em",
|
|
4340
4364
|
className: "lilt-sankey-card__label-value",
|
|
4341
|
-
children:
|
|
4365
|
+
children: fe(e.id)
|
|
4342
4366
|
})]
|
|
4343
4367
|
}, e.id);
|
|
4344
4368
|
})
|
|
@@ -4347,20 +4371,20 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4347
4371
|
}), /* @__PURE__ */ Q("p", {
|
|
4348
4372
|
className: "lilt-chart__sr-only",
|
|
4349
4373
|
"aria-live": "polite",
|
|
4350
|
-
children:
|
|
4374
|
+
children: Y()
|
|
4351
4375
|
})]
|
|
4352
4376
|
}),
|
|
4353
|
-
!x &&
|
|
4377
|
+
!x && ge ? /* @__PURE__ */ $("p", {
|
|
4354
4378
|
className: "lilt-sankey-card__footer",
|
|
4355
4379
|
children: [
|
|
4356
|
-
|
|
4380
|
+
gr(ge, "flow isn’t", "flows aren’t"),
|
|
4357
4381
|
" measured yet and",
|
|
4358
4382
|
" ",
|
|
4359
|
-
|
|
4383
|
+
ge === 1 ? "isn’t" : "aren’t",
|
|
4360
4384
|
" drawn; totals count measured flows only."
|
|
4361
4385
|
]
|
|
4362
4386
|
}) : null,
|
|
4363
|
-
|
|
4387
|
+
E || !z ? null : /* @__PURE__ */ $("table", {
|
|
4364
4388
|
className: "lilt-chart__sr-only",
|
|
4365
4389
|
children: [
|
|
4366
4390
|
/* @__PURE__ */ Q("caption", { children: e }),
|
|
@@ -4393,34 +4417,34 @@ function _r({ title: e, data: t, source: n, target: r, value: i, conservation: a
|
|
|
4393
4417
|
}
|
|
4394
4418
|
//#endregion
|
|
4395
4419
|
//#region src/cards/radar-chart-card.tsx
|
|
4396
|
-
var
|
|
4397
|
-
function
|
|
4398
|
-
if (e.length *
|
|
4420
|
+
var yr = [], br = 300, xr = 4, Sr = 6.6;
|
|
4421
|
+
function Cr(e, t) {
|
|
4422
|
+
if (e.length * Sr <= t || !e.includes(" ")) return [e];
|
|
4399
4423
|
let n = e.length / 2, r = -1;
|
|
4400
4424
|
for (let t = 0; t < e.length; t++) e[t] === " " && (r < 0 || Math.abs(t - n) < Math.abs(r - n)) && (r = t);
|
|
4401
4425
|
return [e.slice(0, r), e.slice(r + 1)];
|
|
4402
4426
|
}
|
|
4403
|
-
var
|
|
4427
|
+
var wr = [
|
|
4404
4428
|
.72,
|
|
4405
4429
|
.58,
|
|
4406
4430
|
.84,
|
|
4407
4431
|
.5,
|
|
4408
4432
|
.66,
|
|
4409
4433
|
.78
|
|
4410
|
-
],
|
|
4411
|
-
function
|
|
4434
|
+
], Tr = (e, t) => e[t], Er = (e) => typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
4435
|
+
function Dr({ data: e, category: t, series: n, domain: r }) {
|
|
4412
4436
|
let i = (e) => ({
|
|
4413
4437
|
dimensions: [],
|
|
4414
4438
|
domain: [0, 1],
|
|
4415
4439
|
error: e
|
|
4416
4440
|
}), a = [], o = /* @__PURE__ */ new Set();
|
|
4417
4441
|
for (let r of e) {
|
|
4418
|
-
let e = String(
|
|
4442
|
+
let e = String(Tr(r, t) ?? "").trim();
|
|
4419
4443
|
if (!e) return i("Every dimension needs a name.");
|
|
4420
4444
|
if (o.has(e)) return i(`“${e}” appears twice; each dimension needs one row.`);
|
|
4421
4445
|
o.add(e), a.push({
|
|
4422
4446
|
name: e,
|
|
4423
|
-
values: n.map((e) => Tr(
|
|
4447
|
+
values: n.map((e) => Er(Tr(r, e)))
|
|
4424
4448
|
});
|
|
4425
4449
|
}
|
|
4426
4450
|
if (a.length && a.length < 3) return i("A radar needs at least three dimensions to draw a shape.");
|
|
@@ -4431,30 +4455,30 @@ function Er({ data: e, category: t, series: n, domain: r }) {
|
|
|
4431
4455
|
domain: r,
|
|
4432
4456
|
error: null
|
|
4433
4457
|
} : i("`domain` needs a low end below its high end.");
|
|
4434
|
-
let c = Math.min(0, ...s), l = Math.max(c + 1, ...s), [u, d] = Qe().domain([c, l]).nice(
|
|
4458
|
+
let c = Math.min(0, ...s), l = Math.max(c + 1, ...s), [u, d] = Qe().domain([c, l]).nice(xr).domain();
|
|
4435
4459
|
return {
|
|
4436
4460
|
dimensions: a,
|
|
4437
4461
|
domain: [u, d],
|
|
4438
4462
|
error: null
|
|
4439
4463
|
};
|
|
4440
4464
|
}
|
|
4441
|
-
var
|
|
4442
|
-
function
|
|
4465
|
+
var Or = (e) => Math.round(e * 100) / 100 || 0;
|
|
4466
|
+
function kr(e, t, n, r) {
|
|
4443
4467
|
let i = e / t * Math.PI * 2;
|
|
4444
4468
|
return {
|
|
4445
|
-
x:
|
|
4446
|
-
y:
|
|
4469
|
+
x: Or(Math.sin(i) * r * n),
|
|
4470
|
+
y: Or(-Math.cos(i) * r * n)
|
|
4447
4471
|
};
|
|
4448
4472
|
}
|
|
4449
|
-
function
|
|
4473
|
+
function Ar(e, t) {
|
|
4450
4474
|
let n = e.length, r = e.every((e) => e !== null), i = "";
|
|
4451
4475
|
if (e.forEach((r, a) => {
|
|
4452
4476
|
if (r === null) return;
|
|
4453
|
-
let { x: o, y: s } =
|
|
4477
|
+
let { x: o, y: s } = kr(a, n, r, t), c = e[(a - 1 + n) % n];
|
|
4454
4478
|
i += `${i && c !== null ? "L" : "M"}${o.toFixed(2)},${s.toFixed(2)} `;
|
|
4455
4479
|
}), r) i += "Z";
|
|
4456
4480
|
else if (e[0] !== null && e[n - 1] !== null) {
|
|
4457
|
-
let { x: r, y: a } =
|
|
4481
|
+
let { x: r, y: a } = kr(0, n, e[0], t);
|
|
4458
4482
|
i += `L${r.toFixed(2)},${a.toFixed(2)}`;
|
|
4459
4483
|
}
|
|
4460
4484
|
return {
|
|
@@ -4462,12 +4486,12 @@ function kr(e, t) {
|
|
|
4462
4486
|
complete: r
|
|
4463
4487
|
};
|
|
4464
4488
|
}
|
|
4465
|
-
function
|
|
4466
|
-
let
|
|
4489
|
+
function jr({ title: e, data: t, category: n, series: r, domain: i, aggregate: a = "mean", grid: o = "polygon", height: s = br, headline: c, delta: l, deltaTone: f, range: p, ranges: m, defaultRange: h, valueFormat: g, legend: _ = "tiles", legendSwatch: v, locale: y, formatValue: te, surface: ne = "elevated", badge: b, numberStyle: x, palette: S, loading: C = !1, loadingStyle: w = "shimmer", motion: re = "auto", className: ie, style: T }) {
|
|
4490
|
+
let E = Ee(re), D = u(C, E), O = C || D, k = me({
|
|
4467
4491
|
valueFormat: g,
|
|
4468
4492
|
locale: y,
|
|
4469
4493
|
formatValue: te
|
|
4470
|
-
}), [A, ae] = X(h ?? m?.[0]?.id), j = m?.find((e) => e.id === A) ?? m?.[0], M = j?.data ?? t ??
|
|
4494
|
+
}), [A, ae] = X(h ?? m?.[0]?.id), j = m?.find((e) => e.id === A) ?? m?.[0], M = j?.data ?? t ?? yr, N = j ? j.delta : l, { ref: P, width: F } = ee(), I = F || 480, L = r.map((e) => e.key), R = L.join("\0"), z = qe(() => Dr({
|
|
4471
4495
|
data: M,
|
|
4472
4496
|
category: n,
|
|
4473
4497
|
series: L,
|
|
@@ -4477,59 +4501,59 @@ function Ar({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4477
4501
|
n,
|
|
4478
4502
|
R,
|
|
4479
4503
|
i
|
|
4480
|
-
]), { dimensions: B, domain:
|
|
4504
|
+
]), { dimensions: B, domain: V } = z, H = B.length, se = V[1] - V[0], U = (e) => e === null ? null : (e - V[0]) / se, ue = (e) => r[e]?.color ?? `var(--lilt-series-${e % 6 + 1})`, fe = (e) => r[e]?.label ?? L[e], pe = Math.max(0, r.findIndex((e) => !e.dashed)), he = (e) => e.name + (e.values.some((e) => e === null) ? " · no data" : ""), ge = Math.min(Math.max(40, ...B.map((e) => he(e).length * Sr)) + 14, I * .24), _e = Math.max(40, Math.min((I - ge * 2) / 2, (s - 52) / 2)), W = Math.max(1, ...B.flatMap((e) => Cr(he(e), ge - 14).map((e) => e.length * Sr))), ve = Math.max(10 / 12, Math.min(1, (ge - 14) / W)), ye = I / 2, G = s / 2, be = Le({
|
|
4481
4505
|
key: j?.id ?? 0,
|
|
4482
|
-
active: !O &&
|
|
4506
|
+
active: !O && H > 0,
|
|
4483
4507
|
duration: 640
|
|
4484
|
-
},
|
|
4508
|
+
}, E), [xe, Se] = X(null), [Ce, we] = X(null), [Te, K] = X(null), [q, De] = X(null), [Oe, J] = X(null), Ne = Ce ?? Te ?? xe, Y = Ne === null ? void 0 : B[Ne], Re = Oe ?? q, [ze, Be] = X([]), Ve = (e) => ze.includes(L[e]), He = r.map((e, t) => ce(B.map((e) => e.values[t]).filter((e) => e !== null), a)), We = j?.headline ?? c ?? He[pe] ?? null, Ge = Ve(pe) ? null : Y ? Y.values[pe] : We, Ke = Y ? r.map((e, t) => ({
|
|
4485
4509
|
item: e,
|
|
4486
4510
|
index: t
|
|
4487
|
-
})).filter(({ index: e }) => e !==
|
|
4488
|
-
if (!
|
|
4489
|
-
let r = n.getBoundingClientRect(), i = e - r.left -
|
|
4490
|
-
if (Math.hypot(i, a) >
|
|
4511
|
+
})).filter(({ index: e }) => e !== pe && !Ve(e)).map(({ index: e }) => `${fe(e)} ${Y.values[e] === null ? "no data" : k.value(Y.values[e])}`) : [], Je = (e, t, n) => {
|
|
4512
|
+
if (!H) return null;
|
|
4513
|
+
let r = n.getBoundingClientRect(), i = e - r.left - ye, a = t - r.top - G;
|
|
4514
|
+
if (Math.hypot(i, a) > _e + ge) return null;
|
|
4491
4515
|
let o = (Math.atan2(i, -a) + Math.PI * 2) % (Math.PI * 2);
|
|
4492
|
-
return Math.round(o / (Math.PI * 2) *
|
|
4516
|
+
return Math.round(o / (Math.PI * 2) * H) % H;
|
|
4493
4517
|
}, Ye = (e) => {
|
|
4494
|
-
e.pointerType !== "touch" &&
|
|
4518
|
+
e.pointerType !== "touch" && Se(Je(e.clientX, e.clientY, e.currentTarget));
|
|
4495
4519
|
}, Xe = It({
|
|
4496
4520
|
resolve: Je,
|
|
4497
|
-
onGlide:
|
|
4498
|
-
onLift: (e) => e !== null &&
|
|
4499
|
-
onTap: (e) =>
|
|
4521
|
+
onGlide: Se,
|
|
4522
|
+
onLift: (e) => e !== null && we(e),
|
|
4523
|
+
onTap: (e) => we((t) => e !== null && t !== e ? e : null),
|
|
4500
4524
|
disabled: C
|
|
4501
4525
|
}), Ze = Ue((e) => {
|
|
4502
4526
|
P.current = e, Xe(e);
|
|
4503
4527
|
}, [Xe, P]), Qe = (e) => {
|
|
4504
|
-
if (!
|
|
4505
|
-
let t =
|
|
4506
|
-
if (e.key === "ArrowRight" || e.key === "ArrowDown") n = t === null ? 0 : (t + 1) %
|
|
4507
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") n = t === null ?
|
|
4528
|
+
if (!H) return;
|
|
4529
|
+
let t = Te ?? Ce, n = null;
|
|
4530
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") n = t === null ? 0 : (t + 1) % H;
|
|
4531
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") n = t === null ? H - 1 : (t - 1 + H) % H;
|
|
4508
4532
|
else if (e.key === "Home") n = 0;
|
|
4509
|
-
else if (e.key === "End") n =
|
|
4533
|
+
else if (e.key === "End") n = H - 1;
|
|
4510
4534
|
else if ((e.key === "Enter" || e.key === " ") && t !== null) {
|
|
4511
|
-
e.preventDefault(),
|
|
4535
|
+
e.preventDefault(), we((e) => e === t ? null : t);
|
|
4512
4536
|
return;
|
|
4513
4537
|
} else if (e.key === "Escape") {
|
|
4514
|
-
|
|
4538
|
+
we(null), K(null);
|
|
4515
4539
|
return;
|
|
4516
4540
|
} else return;
|
|
4517
|
-
e.preventDefault(),
|
|
4541
|
+
e.preventDefault(), K(n);
|
|
4518
4542
|
}, $e = (e) => o === "circle" ? null : B.map((t, n) => {
|
|
4519
|
-
let { x: r, y: i } =
|
|
4520
|
-
return `${n ? "L" : "M"}${(
|
|
4521
|
-
}).join(" ") + " Z", et = !C && !z.error && B.length === 0, tt = B.some((e) => e.values.some((e) => e === null)), nt = Array.from({ length:
|
|
4522
|
-
return /* @__PURE__ */ $(
|
|
4523
|
-
motion:
|
|
4524
|
-
className: ["lilt-radar-card",
|
|
4525
|
-
style:
|
|
4543
|
+
let { x: r, y: i } = kr(n, H, e, _e);
|
|
4544
|
+
return `${n ? "L" : "M"}${(ye + r).toFixed(2)},${(G + i).toFixed(2)}`;
|
|
4545
|
+
}).join(" ") + " Z", et = !C && !z.error && B.length === 0, tt = B.some((e) => e.values.some((e) => e === null)), nt = Array.from({ length: xr }, (e, t) => (t + 1) / xr);
|
|
4546
|
+
return /* @__PURE__ */ $(Ie, {
|
|
4547
|
+
motion: re,
|
|
4548
|
+
className: ["lilt-radar-card", ie].filter(Boolean).join(" "),
|
|
4549
|
+
style: T,
|
|
4526
4550
|
"aria-label": e,
|
|
4527
4551
|
surface: ne,
|
|
4528
4552
|
badge: b,
|
|
4529
4553
|
numberStyle: x,
|
|
4530
4554
|
palette: S,
|
|
4531
|
-
children: [/* @__PURE__ */ $(
|
|
4532
|
-
aside: m || p ? /* @__PURE__ */ Q(
|
|
4555
|
+
children: [/* @__PURE__ */ $(Fe, {
|
|
4556
|
+
aside: m || p ? /* @__PURE__ */ Q(Pe, {
|
|
4533
4557
|
label: p,
|
|
4534
4558
|
options: m?.map(({ id: e, label: t }) => ({
|
|
4535
4559
|
id: e,
|
|
@@ -4538,12 +4562,12 @@ function Ar({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4538
4562
|
value: j?.id,
|
|
4539
4563
|
onValueChange: ae
|
|
4540
4564
|
}) : null,
|
|
4541
|
-
children: [/* @__PURE__ */ Q(
|
|
4565
|
+
children: [/* @__PURE__ */ Q(Me, { children: e }), /* @__PURE__ */ Q(je, {
|
|
4542
4566
|
value: C ? null : Ge,
|
|
4543
4567
|
format: k.value,
|
|
4544
4568
|
loading: C,
|
|
4545
|
-
motion:
|
|
4546
|
-
children: C ? null :
|
|
4569
|
+
motion: re,
|
|
4570
|
+
children: C ? null : Y ? /* @__PURE__ */ Q(ke, { children: [Y.name, ...Ke].join(" · ") }) : N === void 0 ? null : /* @__PURE__ */ Q(Ae, {
|
|
4547
4571
|
value: N,
|
|
4548
4572
|
tone: f
|
|
4549
4573
|
})
|
|
@@ -4558,15 +4582,15 @@ function Ar({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4558
4582
|
"data-lilt-glide": "",
|
|
4559
4583
|
style: { height: s },
|
|
4560
4584
|
"data-loading": O || void 0,
|
|
4561
|
-
"data-motion":
|
|
4585
|
+
"data-motion": E ? "none" : void 0,
|
|
4562
4586
|
tabIndex: O ? void 0 : 0,
|
|
4563
4587
|
role: "group",
|
|
4564
|
-
"aria-label": `${e}: ${
|
|
4588
|
+
"aria-label": `${e}: ${H} dimensions. Arrow keys step around them; Enter pins one.`,
|
|
4565
4589
|
onPointerMove: O ? void 0 : Ye,
|
|
4566
|
-
onPointerLeave: () =>
|
|
4567
|
-
onClick: () =>
|
|
4590
|
+
onPointerLeave: () => Se(null),
|
|
4591
|
+
onClick: () => we((e) => xe !== null && e !== xe ? xe : null),
|
|
4568
4592
|
onKeyDown: O ? void 0 : Qe,
|
|
4569
|
-
onBlur: () =>
|
|
4593
|
+
onBlur: () => K(null),
|
|
4570
4594
|
children: [/* @__PURE__ */ $("svg", {
|
|
4571
4595
|
"aria-hidden": "true",
|
|
4572
4596
|
className: "lilt-radar-card__svg",
|
|
@@ -4576,63 +4600,63 @@ function Ar({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4576
4600
|
children: [/* @__PURE__ */ $("g", {
|
|
4577
4601
|
className: "lilt-radar-card__grid",
|
|
4578
4602
|
children: [nt.map((e) => o === "circle" || O ? /* @__PURE__ */ Q("circle", {
|
|
4579
|
-
cx:
|
|
4580
|
-
cy:
|
|
4581
|
-
r:
|
|
4603
|
+
cx: ye,
|
|
4604
|
+
cy: G,
|
|
4605
|
+
r: _e * e
|
|
4582
4606
|
}, e) : /* @__PURE__ */ Q("path", { d: $e(e) }, e)), O ? null : B.map((e, t) => {
|
|
4583
|
-
let n =
|
|
4607
|
+
let n = kr(t, H, 1, _e);
|
|
4584
4608
|
return /* @__PURE__ */ Q("line", {
|
|
4585
|
-
"data-active": t ===
|
|
4586
|
-
x1:
|
|
4587
|
-
y1:
|
|
4588
|
-
x2:
|
|
4589
|
-
y2:
|
|
4609
|
+
"data-active": t === Ne || void 0,
|
|
4610
|
+
x1: ye,
|
|
4611
|
+
y1: G,
|
|
4612
|
+
x2: ye + n.x,
|
|
4613
|
+
y2: G + n.y
|
|
4590
4614
|
}, e.name);
|
|
4591
4615
|
})]
|
|
4592
|
-
}), /* @__PURE__ */ Q(
|
|
4616
|
+
}), /* @__PURE__ */ Q(de, {
|
|
4593
4617
|
leaving: D,
|
|
4594
4618
|
origin: "center",
|
|
4595
4619
|
children: /* @__PURE__ */ Q("g", { children: C ? /* @__PURE__ */ Q(Gt, {
|
|
4596
4620
|
width: I,
|
|
4597
4621
|
height: s,
|
|
4598
|
-
reduced:
|
|
4622
|
+
reduced: E,
|
|
4599
4623
|
loadingStyle: w,
|
|
4600
4624
|
children: /* @__PURE__ */ Q("path", {
|
|
4601
4625
|
className: "lilt-radar-card__skeleton",
|
|
4602
4626
|
"data-skeleton": "bloom",
|
|
4603
|
-
style: { transformOrigin: `${
|
|
4604
|
-
d:
|
|
4605
|
-
let { x: n, y: r } =
|
|
4606
|
-
return `${t ? "L" : "M"}${(
|
|
4627
|
+
style: { transformOrigin: `${ye}px ${G}px` },
|
|
4628
|
+
d: wr.map((e, t) => {
|
|
4629
|
+
let { x: n, y: r } = kr(t, wr.length, e, _e);
|
|
4630
|
+
return `${t ? "L" : "M"}${(ye + n).toFixed(2)},${(G + r).toFixed(2)}`;
|
|
4607
4631
|
}).join(" ") + " Z"
|
|
4608
4632
|
})
|
|
4609
4633
|
}) : /* @__PURE__ */ $(Z, { children: [
|
|
4610
4634
|
/* @__PURE__ */ Q("g", {
|
|
4611
4635
|
className: "lilt-chart__axis",
|
|
4612
4636
|
children: nt.map((e) => {
|
|
4613
|
-
if (
|
|
4614
|
-
let { x: t, y: n } =
|
|
4637
|
+
if (_e < 110 && e !== .5) return null;
|
|
4638
|
+
let { x: t, y: n } = kr(.5, H, e, _e);
|
|
4615
4639
|
return /* @__PURE__ */ Q("text", {
|
|
4616
4640
|
className: "lilt-radar-card__ring-label",
|
|
4617
|
-
x:
|
|
4618
|
-
y:
|
|
4641
|
+
x: ye + t,
|
|
4642
|
+
y: G + n,
|
|
4619
4643
|
dx: 3,
|
|
4620
4644
|
dy: "0.35em",
|
|
4621
|
-
children: k.axis(
|
|
4645
|
+
children: k.axis(V[0] + se * e)
|
|
4622
4646
|
}, e);
|
|
4623
4647
|
})
|
|
4624
4648
|
}),
|
|
4625
4649
|
/* @__PURE__ */ Q("g", {
|
|
4626
|
-
transform: `translate(${
|
|
4650
|
+
transform: `translate(${ye} ${G}) scale(${be})`,
|
|
4627
4651
|
children: r.map((e, t) => {
|
|
4628
|
-
let { path: n, complete: r } =
|
|
4652
|
+
let { path: n, complete: r } = Ar(B.map((e) => U(e.values[t])), _e), i = Re !== null && Re !== e.key;
|
|
4629
4653
|
return /* @__PURE__ */ $("g", {
|
|
4630
4654
|
className: "lilt-radar-card__profile",
|
|
4631
4655
|
"data-series": e.key,
|
|
4632
4656
|
"data-dashed": e.dashed || void 0,
|
|
4633
4657
|
"data-muted": i || void 0,
|
|
4634
4658
|
"data-hidden": Ve(t) || void 0,
|
|
4635
|
-
style: { color:
|
|
4659
|
+
style: { color: ue(t) },
|
|
4636
4660
|
children: [
|
|
4637
4661
|
r && !e.dashed ? /* @__PURE__ */ Q("path", {
|
|
4638
4662
|
className: "lilt-radar-card__fill",
|
|
@@ -4645,13 +4669,13 @@ function Ar({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4645
4669
|
B.map((e, n) => {
|
|
4646
4670
|
let r = U(e.values[t]);
|
|
4647
4671
|
if (r === null) return null;
|
|
4648
|
-
let { x: i, y: a } =
|
|
4672
|
+
let { x: i, y: a } = kr(n, H, r, _e);
|
|
4649
4673
|
return /* @__PURE__ */ Q("circle", {
|
|
4650
4674
|
className: "lilt-radar-card__vertex",
|
|
4651
|
-
"data-active": n ===
|
|
4675
|
+
"data-active": n === Ne || void 0,
|
|
4652
4676
|
cx: i,
|
|
4653
4677
|
cy: a,
|
|
4654
|
-
r: n ===
|
|
4678
|
+
r: n === Ne ? 4.5 : 3
|
|
4655
4679
|
}, e.name);
|
|
4656
4680
|
})
|
|
4657
4681
|
]
|
|
@@ -4659,17 +4683,17 @@ function Ar({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4659
4683
|
})
|
|
4660
4684
|
}),
|
|
4661
4685
|
B.map((e, t) => {
|
|
4662
|
-
let { x: n, y: r } =
|
|
4686
|
+
let { x: n, y: r } = kr(t, H, 1, _e + 14), i = Math.abs(n) < 1 ? "middle" : n > 0 ? "start" : "end", a = e.values.some((e) => e === null), o = Cr(he(e), ge - 14), s = r < -1 ? -.2 - (o.length - 1) * 1.2 : r > 1 ? .9 : .35 - (o.length - 1) * 1.2 / 2;
|
|
4663
4687
|
return /* @__PURE__ */ Q("text", {
|
|
4664
4688
|
className: "lilt-radar-card__label",
|
|
4665
|
-
"data-active": t ===
|
|
4689
|
+
"data-active": t === Ne || void 0,
|
|
4666
4690
|
"data-missing": a || void 0,
|
|
4667
|
-
x:
|
|
4668
|
-
y:
|
|
4691
|
+
x: ye + n,
|
|
4692
|
+
y: G + r,
|
|
4669
4693
|
textAnchor: i,
|
|
4670
|
-
style:
|
|
4694
|
+
style: ve < 1 ? { fontSize: `${(12 * ve).toFixed(1)}px` } : void 0,
|
|
4671
4695
|
children: o.map((e, t) => /* @__PURE__ */ Q("tspan", {
|
|
4672
|
-
x:
|
|
4696
|
+
x: ye + n,
|
|
4673
4697
|
dy: `${t === 0 ? s.toFixed(2) : "1.2"}em`,
|
|
4674
4698
|
children: e
|
|
4675
4699
|
}, t))
|
|
@@ -4680,7 +4704,7 @@ function Ar({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4680
4704
|
}), /* @__PURE__ */ Q("p", {
|
|
4681
4705
|
className: "lilt-chart__sr-only",
|
|
4682
4706
|
"aria-live": "polite",
|
|
4683
|
-
children:
|
|
4707
|
+
children: Y ? `${Y.name}: ${r.map((e, t) => `${fe(t)} ${Y.values[t] === null ? "no data" : k.value(Y.values[t])}`).join(", ")}` : ""
|
|
4684
4708
|
})]
|
|
4685
4709
|
}),
|
|
4686
4710
|
/* @__PURE__ */ Q(le, {
|
|
@@ -4689,20 +4713,20 @@ function Ar({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4689
4713
|
swatch: v,
|
|
4690
4714
|
"aria-label": `${e} by series`,
|
|
4691
4715
|
items: r.map((e, t) => {
|
|
4692
|
-
let n =
|
|
4716
|
+
let n = Y ? Y.values[t] : He[t];
|
|
4693
4717
|
return {
|
|
4694
4718
|
id: e.key,
|
|
4695
|
-
label:
|
|
4696
|
-
color:
|
|
4719
|
+
label: fe(t),
|
|
4720
|
+
color: ue(t),
|
|
4697
4721
|
value: n,
|
|
4698
4722
|
formattedValue: n === null ? "No data" : k.value(n)
|
|
4699
4723
|
};
|
|
4700
4724
|
}),
|
|
4701
4725
|
activeId: Re,
|
|
4702
|
-
onHoverIdChange:
|
|
4726
|
+
onHoverIdChange: De,
|
|
4703
4727
|
hiddenIds: ze,
|
|
4704
4728
|
onHiddenIdsChange: (e) => {
|
|
4705
|
-
Be(e),
|
|
4729
|
+
Be(e), De(null), J(null);
|
|
4706
4730
|
},
|
|
4707
4731
|
renderValue: C ? () => /* @__PURE__ */ Q("span", { className: "lilt-card__skeleton lilt-card__skeleton--tile" }) : void 0
|
|
4708
4732
|
}),
|
|
@@ -4719,7 +4743,7 @@ function Ar({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4719
4743
|
children: "Dimension"
|
|
4720
4744
|
}), r.map((e, t) => /* @__PURE__ */ Q("th", {
|
|
4721
4745
|
scope: "col",
|
|
4722
|
-
children:
|
|
4746
|
+
children: fe(t)
|
|
4723
4747
|
}, e.key))] }) }),
|
|
4724
4748
|
/* @__PURE__ */ Q("tbody", { children: B.map((e) => /* @__PURE__ */ $("tr", { children: [/* @__PURE__ */ Q("th", {
|
|
4725
4749
|
scope: "row",
|
|
@@ -4732,12 +4756,12 @@ function Ar({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4732
4756
|
}
|
|
4733
4757
|
//#endregion
|
|
4734
4758
|
//#region src/cards/range-chart-card.tsx
|
|
4735
|
-
function
|
|
4759
|
+
function Mr({ low: e, high: t, value: n, label: r, color: i, display: a = "bar", depth: o = !1, aggregate: s = "mean", tiles: c = !1, ...l }) {
|
|
4736
4760
|
let u = n ?? t, d = (e) => (t) => {
|
|
4737
4761
|
let n = t[e];
|
|
4738
4762
|
return typeof n == "number" ? n : null;
|
|
4739
4763
|
};
|
|
4740
|
-
return /* @__PURE__ */ Q(
|
|
4764
|
+
return /* @__PURE__ */ Q(H, {
|
|
4741
4765
|
...l,
|
|
4742
4766
|
aggregate: s,
|
|
4743
4767
|
tiles: c,
|
|
@@ -4780,7 +4804,7 @@ function jr({ low: e, high: t, value: n, label: r, color: i, display: a = "bar",
|
|
|
4780
4804
|
}
|
|
4781
4805
|
//#endregion
|
|
4782
4806
|
//#region src/cards/box-plot-card.tsx
|
|
4783
|
-
function
|
|
4807
|
+
function Nr({ data: e = [], x: t, samples: n, label: r = "Median", color: i, outliers: a = !0, depth: o = !1, headline: s, ...c }) {
|
|
4784
4808
|
let l = qe(() => e.map((e) => {
|
|
4785
4809
|
let r = e, i = Dt(r[n]);
|
|
4786
4810
|
return {
|
|
@@ -4797,7 +4821,7 @@ function Mr({ data: e = [], x: t, samples: n, label: r = "Median", color: i, out
|
|
|
4797
4821
|
let e = a ? l.flatMap((e) => e.box?.outliers ?? []) : [];
|
|
4798
4822
|
return e.length ? et(e) : [];
|
|
4799
4823
|
}, [l, a]), f = (e) => (t) => t.box?.[e] ?? null;
|
|
4800
|
-
return /* @__PURE__ */ Q(
|
|
4824
|
+
return /* @__PURE__ */ Q(H, {
|
|
4801
4825
|
...c,
|
|
4802
4826
|
data: l,
|
|
4803
4827
|
x: "x",
|
|
@@ -4850,12 +4874,12 @@ function Mr({ data: e = [], x: t, samples: n, label: r = "Median", color: i, out
|
|
|
4850
4874
|
}
|
|
4851
4875
|
//#endregion
|
|
4852
4876
|
//#region src/engine/slope.ts
|
|
4853
|
-
var
|
|
4877
|
+
var Pr = (e) => {
|
|
4854
4878
|
if (e == null) return null;
|
|
4855
4879
|
if (typeof e != "number" || !Number.isFinite(e)) throw Error("Invalid value: expected a finite number or null.");
|
|
4856
4880
|
return e;
|
|
4857
4881
|
};
|
|
4858
|
-
function
|
|
4882
|
+
function Fr(e, t) {
|
|
4859
4883
|
if (e === null || t === null) return {
|
|
4860
4884
|
change: null,
|
|
4861
4885
|
ratio: null
|
|
@@ -4866,14 +4890,14 @@ function Pr(e, t) {
|
|
|
4866
4890
|
ratio: e > 0 ? n / e : null
|
|
4867
4891
|
};
|
|
4868
4892
|
}
|
|
4869
|
-
function
|
|
4893
|
+
function Ir(e, t, n, r, i = "change") {
|
|
4870
4894
|
let a = (e, t) => e[t], o = ze(e, {
|
|
4871
4895
|
id: (e) => String(a(e, t) ?? ""),
|
|
4872
4896
|
label: (e) => String(a(e, t) ?? "")
|
|
4873
4897
|
}, () => 0).map(({ id: e, label: t, datum: i }) => {
|
|
4874
4898
|
let o, s;
|
|
4875
4899
|
try {
|
|
4876
|
-
o =
|
|
4900
|
+
o = Pr(a(i, n)), s = Pr(a(i, r));
|
|
4877
4901
|
} catch {
|
|
4878
4902
|
throw Error(`Invalid value for category "${e}": expected a finite number or null.`);
|
|
4879
4903
|
}
|
|
@@ -4882,7 +4906,7 @@ function Fr(e, t, n, r, i = "change") {
|
|
|
4882
4906
|
label: t,
|
|
4883
4907
|
from: o,
|
|
4884
4908
|
to: s,
|
|
4885
|
-
...
|
|
4909
|
+
...Fr(o, s)
|
|
4886
4910
|
};
|
|
4887
4911
|
});
|
|
4888
4912
|
if (i === "input") return o;
|
|
@@ -4892,19 +4916,19 @@ function Fr(e, t, n, r, i = "change") {
|
|
|
4892
4916
|
return n === null || r === null ? n === r ? 0 : n === null ? 1 : -1 : r - n;
|
|
4893
4917
|
});
|
|
4894
4918
|
}
|
|
4895
|
-
function
|
|
4919
|
+
function Lr(e, t = "sum") {
|
|
4896
4920
|
let n = 0, r = 0, i = 0, a = 0, o = 0;
|
|
4897
4921
|
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);
|
|
4898
4922
|
let s = t === "mean";
|
|
4899
4923
|
return {
|
|
4900
4924
|
to: r ? s ? n / r : n : null,
|
|
4901
|
-
...o ?
|
|
4925
|
+
...o ? Fr(s ? i / o : i, s ? a / o : a) : {
|
|
4902
4926
|
change: null,
|
|
4903
4927
|
ratio: null
|
|
4904
4928
|
}
|
|
4905
4929
|
};
|
|
4906
4930
|
}
|
|
4907
|
-
function
|
|
4931
|
+
function Rr(e) {
|
|
4908
4932
|
let t = e.flatMap((e) => [e.from, e.to].filter((e) => e !== null));
|
|
4909
4933
|
if (!t.length) return [0, 1];
|
|
4910
4934
|
let [n, r] = et(t);
|
|
@@ -4915,7 +4939,7 @@ function Lr(e) {
|
|
|
4915
4939
|
let i = (r - n) * .06;
|
|
4916
4940
|
return [n - i, r + i];
|
|
4917
4941
|
}
|
|
4918
|
-
function
|
|
4942
|
+
function zr(e, t, n, r) {
|
|
4919
4943
|
let i = e.map((e, t) => ({
|
|
4920
4944
|
target: e,
|
|
4921
4945
|
index: t
|
|
@@ -4942,20 +4966,20 @@ function Rr(e, t, n, r) {
|
|
|
4942
4966
|
}
|
|
4943
4967
|
//#endregion
|
|
4944
4968
|
//#region src/cards/slope-chart-card.tsx
|
|
4945
|
-
var
|
|
4946
|
-
function
|
|
4969
|
+
var Br = [], Vr = 6.6, Hr = 17;
|
|
4970
|
+
function Ur(e, t) {
|
|
4947
4971
|
return e === null || e === 0 || t === "neutral" ? "neutral" : e > 0 == (t !== "inverse") ? "positive" : "negative";
|
|
4948
4972
|
}
|
|
4949
|
-
var
|
|
4950
|
-
function
|
|
4951
|
-
let O = Ee(
|
|
4973
|
+
var Wr = (e) => e === null ? "" : `${e >= 0 ? "+" : "−"}${Math.abs(e * 100).toFixed(1)}%`;
|
|
4974
|
+
function Gr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r, toLabel: o = i, variant: s = "slope", depth: c = !1, sort: l = "change", aggregate: f = "sum", headline: p, delta: m, deltaTone: h = "default", range: g, ranges: _, defaultRange: v, color: y, height: ee = 260, valueFormat: te, locale: ne, formatValue: b, surface: x = "elevated", badge: S, numberStyle: C, palette: w, loading: re = !1, loadingStyle: ie = "shimmer", motion: T = "auto", className: E, style: D }) {
|
|
4975
|
+
let O = Ee(T), k = u(re, O), A = me({
|
|
4952
4976
|
valueFormat: te,
|
|
4953
4977
|
locale: ne,
|
|
4954
4978
|
formatValue: b
|
|
4955
|
-
}), [ae, j] = X(v ?? _?.[0]?.id), M = _?.find((e) => e.id === ae) ?? _?.[0], N = M?.data ?? t ??
|
|
4979
|
+
}), [ae, j] = X(v ?? _?.[0]?.id), M = _?.find((e) => e.id === ae) ?? _?.[0], N = M?.data ?? t ?? Br, P = qe(() => {
|
|
4956
4980
|
try {
|
|
4957
4981
|
return {
|
|
4958
|
-
rows:
|
|
4982
|
+
rows: Ir(N, n, r, i, l),
|
|
4959
4983
|
error: null
|
|
4960
4984
|
};
|
|
4961
4985
|
} catch (e) {
|
|
@@ -4970,63 +4994,63 @@ function Wr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
4970
4994
|
r,
|
|
4971
4995
|
i,
|
|
4972
4996
|
l
|
|
4973
|
-
]), F = P.rows, I = qe(() =>
|
|
4997
|
+
]), F = P.rows, I = qe(() => Lr(F, f), [F, f]), L = qe(() => Rr(F), [F]), [R, z] = X(null), [B, oe] = X(null), [V, H] = X(null), se = V ?? B ?? R, ce = F.find((e) => e.id === se) ?? null, U = Je(/* @__PURE__ */ new Map()), le = It({
|
|
4974
4998
|
resolve: Ft,
|
|
4975
4999
|
onGlide: z,
|
|
4976
|
-
onLift: (e) => e !== null &&
|
|
4977
|
-
disabled:
|
|
4978
|
-
}),
|
|
5000
|
+
onLift: (e) => e !== null && H(e),
|
|
5001
|
+
disabled: re
|
|
5002
|
+
}), ue = M?.headline ?? p ?? I.to, fe = M ? M.delta ?? I.ratio : m ?? I.ratio, pe = (e) => e === null ? "No data" : A.value(e), ge = (e) => `${e.label}: ${a} ${pe(e.from)}, ${o} ${pe(e.to)}${e.ratio === null ? "" : `, ${Wr(e.ratio)}`}`, _e = (e, t) => {
|
|
4979
5003
|
let n = t;
|
|
4980
5004
|
if (e.key === "ArrowDown" || e.key === "ArrowRight") n = Math.min(F.length - 1, t + 1);
|
|
4981
5005
|
else if (e.key === "ArrowUp" || e.key === "ArrowLeft") n = Math.max(0, t - 1);
|
|
4982
5006
|
else if (e.key === "Home") n = 0;
|
|
4983
5007
|
else if (e.key === "End") n = F.length - 1;
|
|
4984
5008
|
else if (e.key === "Escape") {
|
|
4985
|
-
|
|
5009
|
+
H(null);
|
|
4986
5010
|
return;
|
|
4987
5011
|
} else if (e.key === "Enter" || e.key === " ") {
|
|
4988
5012
|
e.preventDefault();
|
|
4989
5013
|
let n = F[t].id;
|
|
4990
|
-
|
|
5014
|
+
H((e) => e === n ? null : n);
|
|
4991
5015
|
return;
|
|
4992
5016
|
} else return;
|
|
4993
5017
|
e.preventDefault(), U.current.get(F[n].id)?.focus();
|
|
4994
|
-
},
|
|
5018
|
+
}, W = (e, t) => ({
|
|
4995
5019
|
ref: (t) => {
|
|
4996
5020
|
t ? U.current.set(e.id, t) : U.current.delete(e.id);
|
|
4997
5021
|
},
|
|
4998
5022
|
tabIndex: e.id === (B ?? F[0]?.id) ? 0 : -1,
|
|
4999
|
-
"aria-label":
|
|
5000
|
-
"aria-pressed":
|
|
5001
|
-
"data-active": e.id ===
|
|
5002
|
-
"data-muted":
|
|
5003
|
-
"data-tone": y ? void 0 :
|
|
5023
|
+
"aria-label": ge(e),
|
|
5024
|
+
"aria-pressed": V === e.id,
|
|
5025
|
+
"data-active": e.id === ce?.id || void 0,
|
|
5026
|
+
"data-muted": ce !== null && e.id !== ce.id || void 0,
|
|
5027
|
+
"data-tone": y ? void 0 : Ur(e.change, h),
|
|
5004
5028
|
"data-glide-id": e.id,
|
|
5005
5029
|
onPointerEnter: () => z(e.id),
|
|
5006
5030
|
onPointerLeave: () => z(null),
|
|
5007
5031
|
onFocus: () => oe(e.id),
|
|
5008
5032
|
onBlur: () => oe(null),
|
|
5009
|
-
onClick: () =>
|
|
5010
|
-
onKeyDown: (e) =>
|
|
5011
|
-
}),
|
|
5033
|
+
onClick: () => H((t) => t === e.id ? null : e.id),
|
|
5034
|
+
onKeyDown: (e) => _e(e, t)
|
|
5035
|
+
}), ve = {
|
|
5012
5036
|
duration: O ? 0 : .55,
|
|
5013
|
-
ease:
|
|
5014
|
-
},
|
|
5037
|
+
ease: Oe
|
|
5038
|
+
}, ye = y ? {
|
|
5015
5039
|
...D,
|
|
5016
5040
|
"--lilt-slope-color": y
|
|
5017
|
-
} : D,
|
|
5018
|
-
return /* @__PURE__ */ $(
|
|
5019
|
-
motion:
|
|
5020
|
-
className: ["lilt-slope",
|
|
5021
|
-
style:
|
|
5041
|
+
} : D, G = F.length === 0 || P.error;
|
|
5042
|
+
return /* @__PURE__ */ $(Ie, {
|
|
5043
|
+
motion: T,
|
|
5044
|
+
className: ["lilt-slope", E].filter(Boolean).join(" "),
|
|
5045
|
+
style: ye,
|
|
5022
5046
|
"aria-label": e,
|
|
5023
5047
|
surface: x,
|
|
5024
5048
|
badge: S,
|
|
5025
5049
|
numberStyle: C,
|
|
5026
5050
|
palette: w,
|
|
5027
5051
|
children: [
|
|
5028
|
-
/* @__PURE__ */ $(
|
|
5029
|
-
aside: _ || g ? /* @__PURE__ */ Q(
|
|
5052
|
+
/* @__PURE__ */ $(Fe, {
|
|
5053
|
+
aside: _ || g ? /* @__PURE__ */ Q(Pe, {
|
|
5030
5054
|
label: g,
|
|
5031
5055
|
options: _?.map(({ id: e, label: t }) => ({
|
|
5032
5056
|
id: e,
|
|
@@ -5035,21 +5059,21 @@ function Wr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5035
5059
|
value: M?.id,
|
|
5036
5060
|
onValueChange: j
|
|
5037
5061
|
}) : null,
|
|
5038
|
-
children: [/* @__PURE__ */ Q(
|
|
5039
|
-
value:
|
|
5062
|
+
children: [/* @__PURE__ */ Q(Me, { children: e }), /* @__PURE__ */ Q(je, {
|
|
5063
|
+
value: ce ? ce.to : ue,
|
|
5040
5064
|
format: A.value,
|
|
5041
|
-
loading:
|
|
5042
|
-
motion:
|
|
5043
|
-
children:
|
|
5044
|
-
value:
|
|
5065
|
+
loading: re,
|
|
5066
|
+
motion: T,
|
|
5067
|
+
children: re ? null : ce ? /* @__PURE__ */ $(Z, { children: [ce.ratio === null ? null : /* @__PURE__ */ Q(Ae, {
|
|
5068
|
+
value: ce.ratio,
|
|
5045
5069
|
tone: h
|
|
5046
|
-
}), /* @__PURE__ */ Q(
|
|
5047
|
-
value:
|
|
5070
|
+
}), /* @__PURE__ */ Q(ke, { children: ce.label })] }) : /* @__PURE__ */ $(Z, { children: [fe == null ? null : /* @__PURE__ */ Q(Ae, {
|
|
5071
|
+
value: fe,
|
|
5048
5072
|
tone: h
|
|
5049
|
-
}), /* @__PURE__ */ $(
|
|
5073
|
+
}), /* @__PURE__ */ $(ke, { children: ["vs ", a] })] })
|
|
5050
5074
|
})]
|
|
5051
5075
|
}),
|
|
5052
|
-
s === "dumbbell" && !
|
|
5076
|
+
s === "dumbbell" && !re && !k && !G ? /* @__PURE__ */ $("div", {
|
|
5053
5077
|
className: "lilt-slope__key",
|
|
5054
5078
|
"aria-hidden": "true",
|
|
5055
5079
|
children: [/* @__PURE__ */ Q("span", {
|
|
@@ -5060,16 +5084,16 @@ function Wr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5060
5084
|
children: o
|
|
5061
5085
|
})]
|
|
5062
5086
|
}) : null,
|
|
5063
|
-
/* @__PURE__ */ Q(
|
|
5087
|
+
/* @__PURE__ */ Q(de, {
|
|
5064
5088
|
leaving: k,
|
|
5065
5089
|
origin: "left",
|
|
5066
|
-
children:
|
|
5090
|
+
children: re ? /* @__PURE__ */ Q(Kr, {
|
|
5067
5091
|
height: ee,
|
|
5068
5092
|
variant: s,
|
|
5069
5093
|
depth: c,
|
|
5070
5094
|
reduced: O,
|
|
5071
|
-
loadingStyle:
|
|
5072
|
-
}) :
|
|
5095
|
+
loadingStyle: ie
|
|
5096
|
+
}) : G ? /* @__PURE__ */ Q(d, {
|
|
5073
5097
|
kind: P.error ? "error" : "empty",
|
|
5074
5098
|
message: P.error ?? "No rows for this period."
|
|
5075
5099
|
}) : s === "dumbbell" ? /* @__PURE__ */ Q("ol", {
|
|
@@ -5079,11 +5103,11 @@ function Wr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5079
5103
|
"data-lilt-glide": "",
|
|
5080
5104
|
"aria-label": `${e}, ${a} to ${o}`,
|
|
5081
5105
|
children: F.map((e, t) => {
|
|
5082
|
-
let n = (e) => (e - L[0]) / (L[1] - L[0]) * 100, r = e.from === null ? null : n(e.from), i = e.to === null ? null : n(e.to), a = O ? 0 :
|
|
5106
|
+
let n = (e) => (e - L[0]) / (L[1] - L[0]) * 100, r = e.from === null ? null : n(e.from), i = e.to === null ? null : n(e.to), a = O ? 0 : he(t, F.length, 140) / 1e3;
|
|
5083
5107
|
return /* @__PURE__ */ Q("li", { children: /* @__PURE__ */ $("button", {
|
|
5084
5108
|
type: "button",
|
|
5085
5109
|
className: "lilt-slope__row",
|
|
5086
|
-
...
|
|
5110
|
+
...W(e, t),
|
|
5087
5111
|
children: [
|
|
5088
5112
|
/* @__PURE__ */ Q("span", {
|
|
5089
5113
|
className: "lilt-slope__label",
|
|
@@ -5103,7 +5127,7 @@ function Wr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5103
5127
|
width: `${Math.abs(i - r)}%`
|
|
5104
5128
|
},
|
|
5105
5129
|
transition: {
|
|
5106
|
-
...
|
|
5130
|
+
...ve,
|
|
5107
5131
|
delay: a
|
|
5108
5132
|
}
|
|
5109
5133
|
}) : null,
|
|
@@ -5112,7 +5136,7 @@ function Wr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5112
5136
|
"data-end": "from",
|
|
5113
5137
|
initial: !1,
|
|
5114
5138
|
animate: { left: `${r}%` },
|
|
5115
|
-
transition:
|
|
5139
|
+
transition: ve
|
|
5116
5140
|
}),
|
|
5117
5141
|
i === null ? null : /* @__PURE__ */ Q(Ze.span, {
|
|
5118
5142
|
className: "lilt-slope__dot",
|
|
@@ -5120,7 +5144,7 @@ function Wr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5120
5144
|
initial: O || r === null ? !1 : { left: `${r}%` },
|
|
5121
5145
|
animate: { left: `${i}%` },
|
|
5122
5146
|
transition: {
|
|
5123
|
-
...
|
|
5147
|
+
...ve,
|
|
5124
5148
|
delay: a
|
|
5125
5149
|
}
|
|
5126
5150
|
})
|
|
@@ -5135,12 +5159,12 @@ function Wr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5135
5159
|
}),
|
|
5136
5160
|
/* @__PURE__ */ Q("span", {
|
|
5137
5161
|
className: "lilt-slope__change",
|
|
5138
|
-
children:
|
|
5162
|
+
children: Wr(e.ratio) || "—"
|
|
5139
5163
|
})
|
|
5140
5164
|
]
|
|
5141
5165
|
}) }, e.id);
|
|
5142
5166
|
})
|
|
5143
|
-
}) : /* @__PURE__ */ Q(
|
|
5167
|
+
}) : /* @__PURE__ */ Q(qr, {
|
|
5144
5168
|
rows: F,
|
|
5145
5169
|
domain: L,
|
|
5146
5170
|
height: ee,
|
|
@@ -5149,7 +5173,7 @@ function Wr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5149
5173
|
title: e,
|
|
5150
5174
|
format: A.value,
|
|
5151
5175
|
reduced: O,
|
|
5152
|
-
handlers:
|
|
5176
|
+
handlers: W,
|
|
5153
5177
|
glideRef: le,
|
|
5154
5178
|
depth: c
|
|
5155
5179
|
})
|
|
@@ -5157,7 +5181,7 @@ function Wr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5157
5181
|
]
|
|
5158
5182
|
});
|
|
5159
5183
|
}
|
|
5160
|
-
function
|
|
5184
|
+
function Kr({ height: t, variant: n, depth: r, reduced: i, loadingStyle: a, "data-skeleton-leaving": o }) {
|
|
5161
5185
|
let { ref: s, width: c } = ee(), l = c || 320, u = `lilt-slope-loading-${Ge().replace(/:/g, "")}`, d = [
|
|
5162
5186
|
.18,
|
|
5163
5187
|
.34,
|
|
@@ -5189,11 +5213,11 @@ function Gr({ height: t, variant: n, depth: r, reduced: i, loadingStyle: a, "dat
|
|
|
5189
5213
|
})
|
|
5190
5214
|
});
|
|
5191
5215
|
return /* @__PURE__ */ $("g", { children: [
|
|
5192
|
-
r && !e ?
|
|
5216
|
+
r && !e ? pe(5).map((e, r) => /* @__PURE__ */ Q("path", {
|
|
5193
5217
|
d: `M${t},${i}L${n},${a}`,
|
|
5194
5218
|
fill: "none",
|
|
5195
5219
|
transform: e.transform,
|
|
5196
|
-
stroke:
|
|
5220
|
+
stroke: se(Ut, e.amount),
|
|
5197
5221
|
strokeWidth: e.strokeWidth,
|
|
5198
5222
|
...c
|
|
5199
5223
|
}, r)) : /* @__PURE__ */ Q("line", {
|
|
@@ -5234,12 +5258,12 @@ function Gr({ height: t, variant: n, depth: r, reduced: i, loadingStyle: a, "dat
|
|
|
5234
5258
|
})
|
|
5235
5259
|
});
|
|
5236
5260
|
}
|
|
5237
|
-
function
|
|
5261
|
+
function qr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o, format: s, reduced: c, handlers: l, glideRef: u, depth: d }) {
|
|
5238
5262
|
let { ref: f, width: p } = ee(), m = `lilt-slope-${Ge().replace(/:/g, "")}`, h = "var(--lilt-slope-ink)", g = Ue((e) => {
|
|
5239
5263
|
f.current = e, u(e);
|
|
5240
|
-
}, [u, f]), _ = r - 10, v = (e) => _ - (e - n[0]) / (n[1] - n[0]) * (_ - 30), y = (e) => e === null ? "No data" : s(e), te = Math.max(...t.map((e) => e.label.length + 1 + y(e.from).length)), ne = Math.max(...t.map((e) => y(e.to).length + 1 +
|
|
5264
|
+
}, [u, f]), _ = r - 10, v = (e) => _ - (e - n[0]) / (n[1] - n[0]) * (_ - 30), y = (e) => e === null ? "No data" : s(e), te = Math.max(...t.map((e) => e.label.length + 1 + y(e.from).length)), ne = Math.max(...t.map((e) => y(e.to).length + 1 + Wr(e.ratio).length)), b = (te + ne) * Vr + 48 > p * .72, x = b ? Math.max(...t.map((e) => e.label.length)) : te, C = b ? Math.max(...t.map((e) => y(e.to).length)) : ne, w = Math.min(p * .46, x * Vr + 24), re = Math.max(w + 40, p - Math.min(p * .36, C * Vr + 24)), ie = t.map((e) => e.from === null ? _ : v(e.from)), T = t.map((e) => e.to === null ? _ : v(e.to)), E = zr(ie, Hr, 36, _), D = zr(T, Hr, 36, _), O = {
|
|
5241
5265
|
duration: c ? 0 : .6,
|
|
5242
|
-
ease:
|
|
5266
|
+
ease: Oe
|
|
5243
5267
|
};
|
|
5244
5268
|
return /* @__PURE__ */ Q("div", {
|
|
5245
5269
|
ref: g,
|
|
@@ -5273,8 +5297,8 @@ function Kr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5273
5297
|
}),
|
|
5274
5298
|
/* @__PURE__ */ Q("line", {
|
|
5275
5299
|
className: "lilt-slope__axis",
|
|
5276
|
-
x1:
|
|
5277
|
-
x2:
|
|
5300
|
+
x1: re,
|
|
5301
|
+
x2: re,
|
|
5278
5302
|
y1: 24,
|
|
5279
5303
|
y2: _
|
|
5280
5304
|
}),
|
|
@@ -5287,13 +5311,13 @@ function Kr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5287
5311
|
}),
|
|
5288
5312
|
/* @__PURE__ */ Q("text", {
|
|
5289
5313
|
className: "lilt-slope__column",
|
|
5290
|
-
x:
|
|
5314
|
+
x: re,
|
|
5291
5315
|
y: 12,
|
|
5292
5316
|
textAnchor: "middle",
|
|
5293
5317
|
children: a
|
|
5294
5318
|
}),
|
|
5295
5319
|
t.map((n, r) => {
|
|
5296
|
-
let i =
|
|
5320
|
+
let i = ie[r], a = T[r], o = c ? 0 : he(r, t.length, 160) / 1e3;
|
|
5297
5321
|
return /* @__PURE__ */ $("g", {
|
|
5298
5322
|
className: "lilt-slope__line",
|
|
5299
5323
|
role: "button",
|
|
@@ -5306,17 +5330,17 @@ function Kr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5306
5330
|
n.from !== null && n.to !== null ? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("line", {
|
|
5307
5331
|
className: "lilt-slope__hit",
|
|
5308
5332
|
x1: w,
|
|
5309
|
-
x2:
|
|
5333
|
+
x2: re,
|
|
5310
5334
|
y1: i,
|
|
5311
5335
|
y2: a
|
|
5312
5336
|
}), d ? /* @__PURE__ */ Q("g", {
|
|
5313
5337
|
filter: `url(#${m}-shadow)`,
|
|
5314
5338
|
pointerEvents: "none",
|
|
5315
|
-
children:
|
|
5339
|
+
children: pe(5).map((e, t) => /* @__PURE__ */ Q(Ze.line, {
|
|
5316
5340
|
transform: e.transform,
|
|
5317
5341
|
strokeLinecap: "round",
|
|
5318
5342
|
style: {
|
|
5319
|
-
stroke:
|
|
5343
|
+
stroke: se(h, e.amount),
|
|
5320
5344
|
strokeWidth: e.strokeWidth
|
|
5321
5345
|
},
|
|
5322
5346
|
initial: !c && {
|
|
@@ -5328,7 +5352,7 @@ function Kr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5328
5352
|
animate: {
|
|
5329
5353
|
x1: w,
|
|
5330
5354
|
y1: i,
|
|
5331
|
-
x2:
|
|
5355
|
+
x2: re,
|
|
5332
5356
|
y2: a
|
|
5333
5357
|
},
|
|
5334
5358
|
transition: {
|
|
@@ -5347,7 +5371,7 @@ function Kr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5347
5371
|
animate: {
|
|
5348
5372
|
x1: w,
|
|
5349
5373
|
y1: i,
|
|
5350
|
-
x2:
|
|
5374
|
+
x2: re,
|
|
5351
5375
|
y2: a
|
|
5352
5376
|
},
|
|
5353
5377
|
transition: {
|
|
@@ -5377,7 +5401,7 @@ function Kr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5377
5401
|
cy: i
|
|
5378
5402
|
},
|
|
5379
5403
|
animate: {
|
|
5380
|
-
cx:
|
|
5404
|
+
cx: re,
|
|
5381
5405
|
cy: a
|
|
5382
5406
|
},
|
|
5383
5407
|
transition: {
|
|
@@ -5391,7 +5415,7 @@ function Kr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5391
5415
|
textAnchor: "end",
|
|
5392
5416
|
dominantBaseline: "middle",
|
|
5393
5417
|
initial: !1,
|
|
5394
|
-
animate: { attrY:
|
|
5418
|
+
animate: { attrY: E[r] },
|
|
5395
5419
|
transition: O,
|
|
5396
5420
|
children: [/* @__PURE__ */ Q("tspan", {
|
|
5397
5421
|
className: "lilt-slope__name",
|
|
@@ -5404,7 +5428,7 @@ function Kr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5404
5428
|
}),
|
|
5405
5429
|
/* @__PURE__ */ $(Ze.text, {
|
|
5406
5430
|
className: "lilt-slope__label",
|
|
5407
|
-
x:
|
|
5431
|
+
x: re + 10,
|
|
5408
5432
|
dominantBaseline: "middle",
|
|
5409
5433
|
initial: !1,
|
|
5410
5434
|
animate: { attrY: D[r] },
|
|
@@ -5415,7 +5439,7 @@ function Kr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5415
5439
|
}), b || n.ratio === null ? null : /* @__PURE__ */ Q("tspan", {
|
|
5416
5440
|
className: "lilt-slope__ratio",
|
|
5417
5441
|
dx: 6,
|
|
5418
|
-
children:
|
|
5442
|
+
children: Wr(n.ratio)
|
|
5419
5443
|
})]
|
|
5420
5444
|
})
|
|
5421
5445
|
]
|
|
@@ -5427,8 +5451,8 @@ function Kr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5427
5451
|
}
|
|
5428
5452
|
//#endregion
|
|
5429
5453
|
//#region src/activity-ring.tsx
|
|
5430
|
-
var
|
|
5431
|
-
function
|
|
5454
|
+
var Jr = .54, Yr = 3.2, Xr = "color-mix(in oklab, var(--lilt-grid), var(--lilt-surface) 20%)";
|
|
5455
|
+
function Zr(e, t, n, r, i = 60) {
|
|
5432
5456
|
if (!Number.isFinite(r) || r <= 0) throw Error("Lilt ActivityRing maximum must be positive and finite.");
|
|
5433
5457
|
if (!Number.isInteger(i) || i <= 0 || 1440 % i != 0) throw Error("Lilt ActivityRing bucketMinutes must divide a 24-hour day.");
|
|
5434
5458
|
let a = 1440 / i, o = Array.from({ length: a }, (e, t) => ({
|
|
@@ -5449,11 +5473,11 @@ function Xr(e, t, n, r, i = 60) {
|
|
|
5449
5473
|
}
|
|
5450
5474
|
return o;
|
|
5451
5475
|
}
|
|
5452
|
-
var
|
|
5476
|
+
var Qr = (e) => {
|
|
5453
5477
|
let t = Math.round(e * 60);
|
|
5454
5478
|
return `${String(Math.floor(t / 60)).padStart(2, "0")}:${String(t % 60).padStart(2, "0")}`;
|
|
5455
5479
|
};
|
|
5456
|
-
function
|
|
5480
|
+
function $r(e, t, n) {
|
|
5457
5481
|
let r = Ee(n), [i, a] = X(0), [o, s] = X(!0), c = Je(i), l = Je(!1);
|
|
5458
5482
|
return Ke(() => {
|
|
5459
5483
|
if (!e || !t || r) {
|
|
@@ -5466,7 +5490,7 @@ function Qr(e, t, n) {
|
|
|
5466
5490
|
c.current = i, a(i);
|
|
5467
5491
|
let o = nt(i, 1, {
|
|
5468
5492
|
duration: n ? 1.15 : .36,
|
|
5469
|
-
ease:
|
|
5493
|
+
ease: Oe,
|
|
5470
5494
|
onUpdate: (e) => {
|
|
5471
5495
|
c.current = e, a(e);
|
|
5472
5496
|
},
|
|
@@ -5485,12 +5509,12 @@ function Qr(e, t, n) {
|
|
|
5485
5509
|
reduced: r
|
|
5486
5510
|
};
|
|
5487
5511
|
}
|
|
5488
|
-
function
|
|
5512
|
+
function ei({ 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", loadingStyle: d = "shimmer", skeletonLeaving: f, resetKey: p, motion: m = "auto", height: h = 320, depth: g = !1, className: _, "aria-label": v }) {
|
|
5489
5513
|
if (!o.trim()) throw Error("Lilt ActivityRing requires a measurement unit.");
|
|
5490
5514
|
if (!Number.isFinite(h) || h < 180) throw Error("Lilt ActivityRing height must be at least 180px.");
|
|
5491
5515
|
if (!Number.isInteger(a) || a < 1 || a > 24) throw Error("Lilt ActivityRing dotDensity must be an integer from 1 to 24.");
|
|
5492
5516
|
let y = qe(() => u === "ready" ? {
|
|
5493
|
-
slots:
|
|
5517
|
+
slots: Zr(e, t, n, r, i),
|
|
5494
5518
|
maximum: r,
|
|
5495
5519
|
bucketMinutes: i,
|
|
5496
5520
|
unit: o,
|
|
@@ -5514,12 +5538,12 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5514
5538
|
frame: y
|
|
5515
5539
|
});
|
|
5516
5540
|
}, [y, p]);
|
|
5517
|
-
let b = y ?? (te.key === p ? te.frame : null), x = b?.slots, S = 1440 / (b?.bucketMinutes ?? i), C = b?.maximum ?? r, w = b?.unit ?? o,
|
|
5541
|
+
let b = y ?? (te.key === p ? te.frame : null), x = b?.slots, S = 1440 / (b?.bucketMinutes ?? i), C = b?.maximum ?? r, w = b?.unit ?? o, ie = b?.formatValue ?? s, { ref: T, width: E } = ee(), D = Math.min(h, Math.max(240, E || h)), O = D / 2, k = D / 2, A = D * .33, [ae, j] = X(null), [M, N] = X(null), P = ae ?? M, F = P === null ? null : x?.[P] ?? null, I = F ? {
|
|
5518
5542
|
hour: F.hour,
|
|
5519
5543
|
row: F.row,
|
|
5520
5544
|
value: F.value,
|
|
5521
5545
|
pinned: M === P
|
|
5522
|
-
} : null, { progress: L, sweeping: R, reduced: z } =
|
|
5546
|
+
} : null, { progress: L, sweeping: R, reduced: z } = $r(x, u === "ready", m), B = Je(null), oe = It({
|
|
5523
5547
|
resolve: (e, t, n) => {
|
|
5524
5548
|
if (!x) return null;
|
|
5525
5549
|
let r = n.getBoundingClientRect(), i = e - r.left - r.width / D * O, a = t - r.top - r.height / D * k, o = Math.hypot(i, a) / (r.width / D || 1);
|
|
@@ -5530,7 +5554,7 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5530
5554
|
onGlide: j,
|
|
5531
5555
|
onLift: (e) => e !== null && N(e),
|
|
5532
5556
|
disabled: !x
|
|
5533
|
-
}),
|
|
5557
|
+
}), V = Ue((e) => {
|
|
5534
5558
|
B.current = e, oe(e);
|
|
5535
5559
|
}, [oe]);
|
|
5536
5560
|
We(() => {
|
|
@@ -5549,7 +5573,7 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5549
5573
|
]), We(() => {
|
|
5550
5574
|
j(null), N(null);
|
|
5551
5575
|
}, [p]);
|
|
5552
|
-
let
|
|
5576
|
+
let H = (e) => {
|
|
5553
5577
|
if (!x) return;
|
|
5554
5578
|
let t = P ?? 0;
|
|
5555
5579
|
[
|
|
@@ -5563,7 +5587,7 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5563
5587
|
" ",
|
|
5564
5588
|
"Escape"
|
|
5565
5589
|
].includes(e.key) && e.preventDefault(), (e.key === "ArrowRight" || e.key === "ArrowDown") && j((t + 1) % S), (e.key === "ArrowLeft" || e.key === "ArrowUp") && j((t + S - 1) % S), e.key === "Home" && j(0), e.key === "End" && j(S - 1), (e.key === "Enter" || e.key === " ") && N(M === t ? null : t), e.key === "Escape" && (N(null), j(null), B.current?.focus());
|
|
5566
|
-
},
|
|
5590
|
+
}, ce = (e, t) => {
|
|
5567
5591
|
let n = e / S * Math.PI * 2 - Math.PI / 2;
|
|
5568
5592
|
return {
|
|
5569
5593
|
x: Number((O + Math.cos(n) * t).toFixed(3)),
|
|
@@ -5573,16 +5597,16 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5573
5597
|
let t = x?.[e], n = t?.value == null ? 0 : Math.round(t.value / C * a), r = R ? Math.max(0, Math.min(1, (L - e / S * .7) / .3)) : 1, i = Math.ceil(n * r);
|
|
5574
5598
|
return Array.from({ length: a }, (t, n) => ({
|
|
5575
5599
|
dot: n,
|
|
5576
|
-
...
|
|
5600
|
+
...ce(e, A * (Jr + n / Math.max(1, a - 1) * .5249999999999999)),
|
|
5577
5601
|
filled: n < i,
|
|
5578
5602
|
active: P === e
|
|
5579
5603
|
}));
|
|
5580
|
-
},
|
|
5604
|
+
}, ue = re(Yr), de = Array.from({ length: S }, (e, t) => {
|
|
5581
5605
|
let n = .5 - .5 * Math.cos((t / S * 2 - .25) * Math.PI), r = Math.max(1, Math.round(a * (.25 + .55 * n)));
|
|
5582
|
-
return Array.from({ length: r }, (e, n) =>
|
|
5583
|
-
}).flat(),
|
|
5606
|
+
return Array.from({ length: r }, (e, n) => ce(t, A * (Jr + n / Math.max(1, a - 1) * .5249999999999999)));
|
|
5607
|
+
}).flat(), fe = I ? `${Qr(I.hour)}: ${I.value === null ? "No data" : `${ie(I.value)} ${w}`}` : "No bucket selected.";
|
|
5584
5608
|
return /* @__PURE__ */ $("div", {
|
|
5585
|
-
ref:
|
|
5609
|
+
ref: T,
|
|
5586
5610
|
className: ["lilt-activity", _].filter(Boolean).join(" "),
|
|
5587
5611
|
"data-lilt-chart": "",
|
|
5588
5612
|
"data-motion": z ? "none" : void 0,
|
|
@@ -5597,7 +5621,7 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5597
5621
|
height: D
|
|
5598
5622
|
},
|
|
5599
5623
|
children: [/* @__PURE__ */ $("svg", {
|
|
5600
|
-
ref:
|
|
5624
|
+
ref: V,
|
|
5601
5625
|
"data-lilt-glide": "",
|
|
5602
5626
|
width: D,
|
|
5603
5627
|
height: D,
|
|
@@ -5605,7 +5629,7 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5605
5629
|
role: "group",
|
|
5606
5630
|
"aria-label": v,
|
|
5607
5631
|
tabIndex: x ? 0 : -1,
|
|
5608
|
-
onKeyDown:
|
|
5632
|
+
onKeyDown: H,
|
|
5609
5633
|
onPointerLeave: () => j(null),
|
|
5610
5634
|
children: [
|
|
5611
5635
|
/* @__PURE__ */ Q("circle", {
|
|
@@ -5622,12 +5646,12 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5622
5646
|
children: Array.from({ length: S }, (e, t) => le(t).map(({ dot: e, x: n, y: r, filled: i, active: a }) => /* @__PURE__ */ Q("line", {
|
|
5623
5647
|
x1: n,
|
|
5624
5648
|
y1: r,
|
|
5625
|
-
x2: n +
|
|
5626
|
-
y2: r +
|
|
5649
|
+
x2: n + ue.dx,
|
|
5650
|
+
y2: r + ue.dy,
|
|
5627
5651
|
strokeWidth: (a ? 3.3 : 2.7) * 2,
|
|
5628
5652
|
strokeLinecap: "round",
|
|
5629
5653
|
style: {
|
|
5630
|
-
stroke:
|
|
5654
|
+
stroke: se(i ? "var(--lilt-series-1)" : Xr, -38),
|
|
5631
5655
|
opacity: i ? a || R ? 1 : L : 1
|
|
5632
5656
|
}
|
|
5633
5657
|
}, `${t}-${e}`)))
|
|
@@ -5642,10 +5666,10 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5642
5666
|
onClick: () => N(M === t ? null : t),
|
|
5643
5667
|
children: [
|
|
5644
5668
|
/* @__PURE__ */ Q("line", {
|
|
5645
|
-
x1:
|
|
5646
|
-
y1:
|
|
5647
|
-
x2:
|
|
5648
|
-
y2:
|
|
5669
|
+
x1: ce(t, A * .45).x,
|
|
5670
|
+
y1: ce(t, A * .45).y,
|
|
5671
|
+
x2: ce(t, A * 1.12).x,
|
|
5672
|
+
y2: ce(t, A * 1.12).y,
|
|
5649
5673
|
stroke: "transparent",
|
|
5650
5674
|
strokeWidth: "12"
|
|
5651
5675
|
}),
|
|
@@ -5653,12 +5677,12 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5653
5677
|
cx: t,
|
|
5654
5678
|
cy: n,
|
|
5655
5679
|
r: i ? 3.3 : 2.7,
|
|
5656
|
-
fill: r ? "var(--lilt-series-1)" : g ?
|
|
5680
|
+
fill: r ? "var(--lilt-series-1)" : g ? Xr : "var(--lilt-grid)",
|
|
5657
5681
|
opacity: r ? i || R ? 1 : L : g ? 1 : .8
|
|
5658
5682
|
}, e)),
|
|
5659
5683
|
r ? /* @__PURE__ */ Q("circle", {
|
|
5660
|
-
cx:
|
|
5661
|
-
cy:
|
|
5684
|
+
cx: ce(t, A * 1.12).x,
|
|
5685
|
+
cy: ce(t, A * 1.12).y,
|
|
5662
5686
|
r: "4.5",
|
|
5663
5687
|
fill: "none",
|
|
5664
5688
|
stroke: "var(--lilt-focus)",
|
|
@@ -5675,21 +5699,21 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5675
5699
|
reduced: z,
|
|
5676
5700
|
loadingStyle: d,
|
|
5677
5701
|
depth: g,
|
|
5678
|
-
mask:
|
|
5702
|
+
mask: de.map(({ x: e, y: t }, n) => /* @__PURE__ */ Q("circle", {
|
|
5679
5703
|
cx: e,
|
|
5680
5704
|
cy: t,
|
|
5681
5705
|
r: 2.7,
|
|
5682
5706
|
fill: "white"
|
|
5683
5707
|
}, n)),
|
|
5684
|
-
children:
|
|
5708
|
+
children: de.map((e, t) => /* @__PURE__ */ $("g", {
|
|
5685
5709
|
"data-skeleton": "pop",
|
|
5686
|
-
style: { "--lilt-skeleton-step": t * 14 /
|
|
5710
|
+
style: { "--lilt-skeleton-step": t * 14 / de.length },
|
|
5687
5711
|
children: [g ? /* @__PURE__ */ Q("line", {
|
|
5688
5712
|
x1: e.x,
|
|
5689
5713
|
y1: e.y,
|
|
5690
|
-
x2: e.x +
|
|
5691
|
-
y2: e.y +
|
|
5692
|
-
stroke:
|
|
5714
|
+
x2: e.x + ue.dx,
|
|
5715
|
+
y2: e.y + ue.dy,
|
|
5716
|
+
stroke: se(Ut, -38),
|
|
5693
5717
|
strokeWidth: 5.4,
|
|
5694
5718
|
strokeLinecap: "round"
|
|
5695
5719
|
}) : null, /* @__PURE__ */ Q("circle", {
|
|
@@ -5697,7 +5721,7 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5697
5721
|
cx: e.x,
|
|
5698
5722
|
cy: e.y,
|
|
5699
5723
|
r: 2.7,
|
|
5700
|
-
style: g ? { fill:
|
|
5724
|
+
style: g ? { fill: se(Ut, 12) } : void 0
|
|
5701
5725
|
})]
|
|
5702
5726
|
}, t))
|
|
5703
5727
|
})
|
|
@@ -5708,7 +5732,7 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5708
5732
|
2,
|
|
5709
5733
|
3
|
|
5710
5734
|
].map((e) => {
|
|
5711
|
-
let t =
|
|
5735
|
+
let t = ce(Math.round(e * S / 4), A * 1.26);
|
|
5712
5736
|
return /* @__PURE__ */ Q("text", {
|
|
5713
5737
|
x: t.x,
|
|
5714
5738
|
y: t.y,
|
|
@@ -5722,14 +5746,14 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5722
5746
|
]
|
|
5723
5747
|
}), /* @__PURE__ */ Q("div", {
|
|
5724
5748
|
className: "lilt-activity__center",
|
|
5725
|
-
children: c ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("strong", { children: U ?
|
|
5749
|
+
children: c ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("strong", { children: U ? ie(U.value) : "—" }), /* @__PURE__ */ $("span", { children: [w, " peak"] })] })
|
|
5726
5750
|
})]
|
|
5727
5751
|
}),
|
|
5728
5752
|
/* @__PURE__ */ Q("p", {
|
|
5729
5753
|
className: "lilt-chart__sr-only",
|
|
5730
5754
|
role: "status",
|
|
5731
5755
|
"aria-atomic": "true",
|
|
5732
|
-
children:
|
|
5756
|
+
children: fe
|
|
5733
5757
|
}),
|
|
5734
5758
|
/* @__PURE__ */ $("span", {
|
|
5735
5759
|
className: "lilt-chart__sr-only",
|
|
@@ -5740,27 +5764,27 @@ function $r({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5740
5764
|
}
|
|
5741
5765
|
//#endregion
|
|
5742
5766
|
//#region src/cards/activity-ring-card.tsx
|
|
5743
|
-
var
|
|
5744
|
-
function
|
|
5767
|
+
var ti = [], ni = 280;
|
|
5768
|
+
function ri(e) {
|
|
5745
5769
|
let t = Math.round(e * 60) % 1440;
|
|
5746
5770
|
return `${String(Math.floor(t / 60)).padStart(2, "0")}:${String(t % 60).padStart(2, "0")}`;
|
|
5747
5771
|
}
|
|
5748
|
-
function
|
|
5772
|
+
function ii(e, t) {
|
|
5749
5773
|
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;
|
|
5750
5774
|
}
|
|
5751
|
-
function
|
|
5752
|
-
let
|
|
5775
|
+
function ai({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit: a, maximum: o, aggregate: s = "sum", height: c = ni, depth: l = !1, headline: f, delta: p, deltaTone: m, range: h, ranges: g, defaultRange: _, valueFormat: v, locale: y, formatValue: ee, color: te, surface: ne = "elevated", badge: b, numberStyle: x, palette: S, loading: C = !1, loadingStyle: w = "shimmer", motion: re = "auto", className: ie, style: T }) {
|
|
5776
|
+
let E = me({
|
|
5753
5777
|
valueFormat: v,
|
|
5754
5778
|
locale: y,
|
|
5755
5779
|
formatValue: ee
|
|
5756
|
-
}), D = u(C, Ee(
|
|
5780
|
+
}), D = u(C, Ee(re)), [O, k] = X(_ ?? g?.[0]?.id), A = g?.find((e) => e.id === O) ?? g?.[0], ae = A?.data ?? t ?? ti, j = A ? A.delta : p, M = a?.trim() || r, N = Ue((e) => e[n], [n]), P = Ue((e) => {
|
|
5757
5781
|
let t = e[r];
|
|
5758
5782
|
return typeof t == "number" && Number.isFinite(t) ? t : null;
|
|
5759
5783
|
}, [r]), F = qe(() => {
|
|
5760
5784
|
let e = ae.map(P).filter((e) => e !== null), t = Math.max(0, ...e), n = o ?? Qe().domain([0, Math.max(1, t)]).nice(4).domain()[1];
|
|
5761
5785
|
try {
|
|
5762
5786
|
return {
|
|
5763
|
-
slots:
|
|
5787
|
+
slots: Zr(ae, N, P, n, i),
|
|
5764
5788
|
maximum: n,
|
|
5765
5789
|
error: null
|
|
5766
5790
|
};
|
|
@@ -5768,7 +5792,7 @@ function ii({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
5768
5792
|
return {
|
|
5769
5793
|
slots: [],
|
|
5770
5794
|
maximum: n,
|
|
5771
|
-
error:
|
|
5795
|
+
error: ii(e instanceof Error ? e.message : "Invalid activity.", i)
|
|
5772
5796
|
};
|
|
5773
5797
|
}
|
|
5774
5798
|
}, [
|
|
@@ -5777,12 +5801,12 @@ function ii({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
5777
5801
|
P,
|
|
5778
5802
|
o,
|
|
5779
5803
|
i
|
|
5780
|
-
]), [I, L] = X(null), R = Ue((e) => L(e), []), z = F.slots.filter((e) => e.value !== null), B = z.reduce((e, t) => !e || t.value > e.value ? t : e, null), oe = z.reduce((e, t) => !e || t.value < e.value ? t : e, null),
|
|
5781
|
-
return /* @__PURE__ */ $(
|
|
5782
|
-
motion:
|
|
5783
|
-
className: ["lilt-activity-card",
|
|
5804
|
+
]), [I, L] = X(null), R = Ue((e) => L(e), []), z = F.slots.filter((e) => e.value !== null), B = z.reduce((e, t) => !e || t.value > e.value ? t : e, null), oe = z.reduce((e, t) => !e || t.value < e.value ? t : e, null), V = ae.length ? F.slots.length - z.length : 0, H = A?.headline ?? f ?? ce(z.map((e) => e.value), s), se = !C && !F.error && ae.length === 0;
|
|
5805
|
+
return /* @__PURE__ */ $(Ie, {
|
|
5806
|
+
motion: re,
|
|
5807
|
+
className: ["lilt-activity-card", ie].filter(Boolean).join(" "),
|
|
5784
5808
|
style: {
|
|
5785
|
-
...
|
|
5809
|
+
...T,
|
|
5786
5810
|
...te ? { "--lilt-series-1": te } : {}
|
|
5787
5811
|
},
|
|
5788
5812
|
"aria-label": e,
|
|
@@ -5790,8 +5814,8 @@ function ii({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
5790
5814
|
badge: b,
|
|
5791
5815
|
numberStyle: x,
|
|
5792
5816
|
palette: S,
|
|
5793
|
-
children: [/* @__PURE__ */ $(
|
|
5794
|
-
aside: g || h ? /* @__PURE__ */ Q(
|
|
5817
|
+
children: [/* @__PURE__ */ $(Fe, {
|
|
5818
|
+
aside: g || h ? /* @__PURE__ */ Q(Pe, {
|
|
5795
5819
|
label: h,
|
|
5796
5820
|
options: g?.map(({ id: e, label: t }) => ({
|
|
5797
5821
|
id: e,
|
|
@@ -5800,21 +5824,21 @@ function ii({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
5800
5824
|
value: A?.id,
|
|
5801
5825
|
onValueChange: k
|
|
5802
5826
|
}) : null,
|
|
5803
|
-
children: [/* @__PURE__ */ Q(
|
|
5804
|
-
value: C ? null : I ? I.value :
|
|
5805
|
-
format:
|
|
5827
|
+
children: [/* @__PURE__ */ Q(Me, { children: e }), /* @__PURE__ */ Q(je, {
|
|
5828
|
+
value: C ? null : I ? I.value : H,
|
|
5829
|
+
format: E.value,
|
|
5806
5830
|
loading: C,
|
|
5807
|
-
motion:
|
|
5808
|
-
children: C ? null : I ? /* @__PURE__ */ $(
|
|
5831
|
+
motion: re,
|
|
5832
|
+
children: C ? null : I ? /* @__PURE__ */ $(ke, { children: [ri(I.hour), I.value === null ? " · No data" : ` · ${M}`] }) : j === void 0 ? null : /* @__PURE__ */ Q(Ae, {
|
|
5809
5833
|
value: j,
|
|
5810
5834
|
tone: m
|
|
5811
5835
|
})
|
|
5812
5836
|
})]
|
|
5813
|
-
}), F.error ||
|
|
5837
|
+
}), F.error || se ? /* @__PURE__ */ Q(d, {
|
|
5814
5838
|
kind: F.error ? "error" : "empty",
|
|
5815
5839
|
message: F.error ?? "No activity for this period."
|
|
5816
5840
|
}) : /* @__PURE__ */ $(Z, { children: [
|
|
5817
|
-
/* @__PURE__ */ Q(
|
|
5841
|
+
/* @__PURE__ */ Q(ei, {
|
|
5818
5842
|
loadingStyle: w,
|
|
5819
5843
|
className: "lilt-activity-card__ring",
|
|
5820
5844
|
depth: l,
|
|
@@ -5825,41 +5849,41 @@ function ii({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
5825
5849
|
maximum: F.maximum,
|
|
5826
5850
|
bucketMinutes: i,
|
|
5827
5851
|
unit: M,
|
|
5828
|
-
formatValue:
|
|
5852
|
+
formatValue: E.value,
|
|
5829
5853
|
height: Math.max(180, c),
|
|
5830
5854
|
dotDensity: 7,
|
|
5831
5855
|
status: C || D ? "loading" : "ready",
|
|
5832
5856
|
skeletonLeaving: D ? "center" : void 0,
|
|
5833
|
-
motion:
|
|
5857
|
+
motion: re,
|
|
5834
5858
|
resetKey: A?.id,
|
|
5835
5859
|
onSelectionChange: R,
|
|
5836
|
-
center: C ? /* @__PURE__ */ Q(Z, {}) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("strong", { children: B ?
|
|
5860
|
+
center: C ? /* @__PURE__ */ Q(Z, {}) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("strong", { children: B ? E.value(B.value) : "—" }), /* @__PURE__ */ Q("span", { children: B ? `peak · ${ri(B.hour)}` : "no data" })] })
|
|
5837
5861
|
}),
|
|
5838
5862
|
/* @__PURE__ */ Q(le, {
|
|
5839
5863
|
className: "lilt-card__tiles",
|
|
5840
5864
|
"aria-label": `${e}: busiest and quietest times`,
|
|
5841
5865
|
items: [{
|
|
5842
5866
|
id: "busiest",
|
|
5843
|
-
label: B && !C ? `Busiest · ${
|
|
5867
|
+
label: B && !C ? `Busiest · ${ri(B.hour)}` : "Busiest",
|
|
5844
5868
|
color: "var(--lilt-series-1)",
|
|
5845
5869
|
value: B?.value ?? null,
|
|
5846
|
-
formattedValue: B ?
|
|
5870
|
+
formattedValue: B ? E.value(B.value) : "No data"
|
|
5847
5871
|
}, {
|
|
5848
5872
|
id: "quietest",
|
|
5849
|
-
label: oe && !C ? `Quietest · ${
|
|
5873
|
+
label: oe && !C ? `Quietest · ${ri(oe.hour)}` : "Quietest",
|
|
5850
5874
|
color: "color-mix(in srgb, var(--lilt-series-1) 30%, transparent)",
|
|
5851
5875
|
value: oe?.value ?? null,
|
|
5852
|
-
formattedValue: oe ?
|
|
5876
|
+
formattedValue: oe ? E.value(oe.value) : "No data"
|
|
5853
5877
|
}],
|
|
5854
5878
|
renderValue: C ? () => /* @__PURE__ */ Q("span", { className: "lilt-card__skeleton lilt-card__skeleton--tile" }) : void 0
|
|
5855
5879
|
}),
|
|
5856
|
-
!C &&
|
|
5880
|
+
!C && V ? /* @__PURE__ */ $("p", {
|
|
5857
5881
|
className: "lilt-activity-card__footer",
|
|
5858
5882
|
children: [
|
|
5859
|
-
|
|
5883
|
+
V === 1 ? "1 time slot has" : `${V} time slots have`,
|
|
5860
5884
|
" no data and",
|
|
5861
5885
|
" ",
|
|
5862
|
-
|
|
5886
|
+
V === 1 ? "stays" : "stay",
|
|
5863
5887
|
" empty rather than reading as zero."
|
|
5864
5888
|
]
|
|
5865
5889
|
}) : null
|
|
@@ -5867,4 +5891,4 @@ function ii({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
5867
5891
|
});
|
|
5868
5892
|
}
|
|
5869
5893
|
//#endregion
|
|
5870
|
-
export {
|
|
5894
|
+
export { ai as ActivityRingCard, De as AnimatedNumber, O as Annotations, l as Area, Bt as AreaChartCard, ie as Bar, Ht as BarChartCard, Et as BoxPlot, Nr as BoxPlotCard, J as CardBadge, Ne as CardFrameContext, Nt as ChangeComparison, w as Chart, gt as ChartBrush, Ie as ChartCard, ke as ChartCardCaption, Ae as ChartCardDelta, Fe as ChartCardHeader, Pe as ChartCardRange, Me as ChartCardTitle, je as ChartCardValue, st as ChartOverview, f as ChartPlot, zt as ChartRangeSummary, at as ChartReadout, it as ChartToolbar, ln as ComboChartCard, rt as ComparisonDetails, xt as ErrorBar, Fn as FunnelChartCard, Ce as Grid, Gn as HeatmapChartCard, cn as HorizontalBarChartCard, v as IntervalBand, Mt as Legend, xe as Line, Vt as LineChartCard, Tn as ProgressCard, jr as RadarChartCard, xn as RadialChartCard, yt as RangeBar, Mr as RangeChartCard, ae as ReferenceBand, W as ReferenceLine, vr as SankeyChartCard, ar as ScatterChartCard, Gr as SlopeChartCard, en as StatCard, te as Tooltip, le as ValueLegend, C as XAxis, ye as YAxis, ue as createCartesianChartModel, Se as createChartController, kt as serializeChartSvg, Dt as summarizeBox, Ve as summarizeFunnelStages, q as summarizeRange, K as toChartCsv, V as useCartesianChartModel, F as useCartesianModelState, G as useChartComparison, j as useChartState, s as useChartSync };
|