@lilt-ui/charts 0.12.0 → 0.12.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 +262 -253
- package/README.md +6 -20
- package/dist/finance.js +5 -1
- package/dist/index.js +416 -367
- package/dist/interaction/axis-cursor.d.ts +5 -0
- package/dist/interaction/use-pin-release.d.ts +9 -0
- package/dist/interaction/use-touch-glide.d.ts +4 -0
- package/dist/marks/contract.d.ts +6 -0
- package/dist/primitives/hover-band.d.ts +2 -1
- package/dist/{skeleton-block-CxrRuqe0.js → skeleton-block-ClcPgFdK.js} +1320 -1296
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { $ as e, A as t, B as n, C as r, Ct as i, D as a, E as o, F as s, G as c, H as l, I as u, J as d, K as f, L as p, M as m, N as h, O as g, Q as _, R as v, S as y, St as b, T as x, U as ee, V as te, W as S, X as C, Y as ne, Z as re, _ as ie, _t as ae, at as w, b as oe, bt as T, c as se, ct as E, d as D, dt as O, et as ce, f as k, ft as A, g as j, gt as M, h as N, ht as P, i as F, it as I, j as L, k as R, l as le, lt as ue, m as z, mt as B, n as V, nt as H, o as de, ot as U, p as fe, pt as pe, q as me, r as W, rt as G, s as he, t as ge, tt as _e, u as ve, ut as K, v as q, vt as ye, w as J, wt as Y, x as be, xt as xe, y as Se, yt as Ce, z as we } from "./skeleton-block-
|
|
2
|
+
import { $ as e, A as t, B as n, C as r, Ct as i, D as a, E as o, F as s, G as c, H as l, I as u, J as d, K as f, L as p, M as m, N as h, O as g, Q as _, R as v, S as y, St as b, T as x, U as ee, V as te, W as S, X as C, Y as ne, Z as re, _ as ie, _t as ae, at as w, b as oe, bt as T, c as se, ct as E, d as D, dt as O, et as ce, f as k, ft as A, g as j, gt as M, h as N, ht as P, i as F, it as I, j as L, k as R, l as le, lt as ue, m as z, mt as B, n as V, nt as H, o as de, ot as U, p as fe, pt as pe, q as me, r as W, rt as G, s as he, t as ge, tt as _e, u as ve, ut as K, v as q, vt as ye, w as J, wt as Y, x as be, xt as xe, y as Se, yt as Ce, z as we } from "./skeleton-block-ClcPgFdK.js";
|
|
3
3
|
import { C as Te, S as Ee, _ as De, c as Oe, d as ke, f as Ae, g as je, h as Me, l as Ne, m as Pe, p as Fe, u as Ie, v as Le, w as Re, x as ze } from "./report-context-DLA3I57K.js";
|
|
4
4
|
import { n as Be, t as Ve } from "./chart-data-CCwLQeXa.js";
|
|
5
5
|
import { a as He, i as Ue, n as We, r as Ge, t as Ke } from "./analysis-BJRmXHOB.js";
|
|
@@ -1140,15 +1140,42 @@ function zt(e, t) {
|
|
|
1140
1140
|
Je(() => r(null), [])
|
|
1141
1141
|
];
|
|
1142
1142
|
}
|
|
1143
|
-
|
|
1143
|
+
//#endregion
|
|
1144
|
+
//#region src/interaction/use-pin-release.ts
|
|
1145
|
+
function Bt(e, t, n, r) {
|
|
1146
|
+
let i = $e({
|
|
1147
|
+
release: n,
|
|
1148
|
+
onMark: r
|
|
1149
|
+
});
|
|
1150
|
+
i.current = {
|
|
1151
|
+
release: n,
|
|
1152
|
+
onMark: r
|
|
1153
|
+
};
|
|
1154
|
+
let a = $e(!1);
|
|
1155
|
+
Ye(() => {
|
|
1156
|
+
if (!e) return;
|
|
1157
|
+
let n = () => e.closest("[data-lilt-chart]") ?? e, r = (r) => {
|
|
1158
|
+
let o = r.target instanceof Node ? r.target : null;
|
|
1159
|
+
a.current = !!(o && n().contains(o)), t && (o instanceof Element && o.closest("button, a, input, [role=\"tab\"]") && (!e.contains(o) || !o.closest("[data-glide-id]")) || o && e.contains(o) && (o instanceof Element && o.closest("[data-glide-id]") || i.current.onMark(r, e)) || i.current.release?.());
|
|
1160
|
+
}, o = (e) => {
|
|
1161
|
+
if (!t || e.key !== "Escape" || e.defaultPrevented) return;
|
|
1162
|
+
let r = e.target instanceof Node ? e.target : null, o = !!(r && n().contains(r));
|
|
1163
|
+
(o || a.current) && (!o && r instanceof Element && r.closest("[data-lilt-chart], [role=\"dialog\"]") || (e.preventDefault(), i.current.release?.()));
|
|
1164
|
+
};
|
|
1165
|
+
return document.addEventListener("pointerdown", r, !0), document.addEventListener("keydown", o), () => {
|
|
1166
|
+
document.removeEventListener("pointerdown", r, !0), document.removeEventListener("keydown", o);
|
|
1167
|
+
};
|
|
1168
|
+
}, [e, t]);
|
|
1169
|
+
}
|
|
1170
|
+
function Vt(e, t, n) {
|
|
1144
1171
|
let r = (n.ownerDocument.elementFromPoint?.(e, t))?.closest("[data-glide-id]");
|
|
1145
1172
|
return r && n.contains(r) ? r.getAttribute("data-glide-id") : null;
|
|
1146
1173
|
}
|
|
1147
|
-
function
|
|
1174
|
+
function Ht(e) {
|
|
1148
1175
|
let t = $e(e);
|
|
1149
1176
|
t.current = e;
|
|
1150
1177
|
let { disabled: n } = e, [r, i] = X(null);
|
|
1151
|
-
return Ye(() => {
|
|
1178
|
+
return Bt(r, e.pinned ?? !1, e.onRelease, (e, n) => t.current.resolve(e.clientX, e.clientY, n) !== null), Ye(() => {
|
|
1152
1179
|
if (!r || n) return;
|
|
1153
1180
|
let e = null, i = null, a = null, o = 0, s = (e, n) => t.current.resolve(e, n, r), c = () => {
|
|
1154
1181
|
e?.hold != null && window.clearTimeout(e.hold), e && (e.hold = null);
|
|
@@ -1215,7 +1242,7 @@ function Vt(e) {
|
|
|
1215
1242
|
}
|
|
1216
1243
|
//#endregion
|
|
1217
1244
|
//#region src/interaction/use-category-state.ts
|
|
1218
|
-
function
|
|
1245
|
+
function Ut(e, t, n) {
|
|
1219
1246
|
let r = $e({
|
|
1220
1247
|
key: n,
|
|
1221
1248
|
rows: null
|
|
@@ -1237,11 +1264,13 @@ function Ht(e, t, n) {
|
|
|
1237
1264
|
skeleton: o
|
|
1238
1265
|
};
|
|
1239
1266
|
}
|
|
1240
|
-
function
|
|
1241
|
-
let [l, u] = X(null), [d, f] = X(null), [p, m, h] = zt(a, o), g = e.some((e) => e.id === p) ? p : null, [_, v] = X(null), y = $e(/* @__PURE__ */ new Map()), b =
|
|
1242
|
-
resolve:
|
|
1267
|
+
function Wt(e, t, n, r, i = 1, a, o, s = !0, c) {
|
|
1268
|
+
let [l, u] = X(null), [d, f] = X(null), [p, m, h] = zt(a, o), g = e.some((e) => e.id === p) ? p : null, [_, v] = X(null), y = $e(/* @__PURE__ */ new Map()), b = Ht({
|
|
1269
|
+
resolve: Vt,
|
|
1243
1270
|
onGlide: u,
|
|
1244
1271
|
onLift: (e) => e !== null && m(e),
|
|
1272
|
+
pinned: g !== null,
|
|
1273
|
+
onRelease: () => m(null),
|
|
1245
1274
|
disabled: !t
|
|
1246
1275
|
}), x = $e(n);
|
|
1247
1276
|
x.current = n;
|
|
@@ -1277,7 +1306,7 @@ function Ut(e, t, n, r, i = 1, a, o, s = !0, c) {
|
|
|
1277
1306
|
else if (t.key === "Home") r = t.ctrlKey || i === 1 ? 0 : Math.floor(n / i) * i;
|
|
1278
1307
|
else if (t.key === "End") r = t.ctrlKey || i === 1 ? e.length - 1 : Math.min(e.length - 1, Math.floor(n / i) * i + i - 1);
|
|
1279
1308
|
else if (t.key === "Escape") {
|
|
1280
|
-
m(null);
|
|
1309
|
+
t.preventDefault(), m(null);
|
|
1281
1310
|
return;
|
|
1282
1311
|
} else return;
|
|
1283
1312
|
t.preventDefault(), y.current.get(e[Math.max(0, Math.min(e.length - 1, r))]?.id)?.focus();
|
|
@@ -1306,8 +1335,8 @@ function Ut(e, t, n, r, i = 1, a, o, s = !0, c) {
|
|
|
1306
1335
|
}
|
|
1307
1336
|
//#endregion
|
|
1308
1337
|
//#region src/toolkit/chart-range-summary.tsx
|
|
1309
|
-
function
|
|
1310
|
-
let n = b(), r = et(n.controller.subscribe, () => n.controller.getSnapshot().focus, () => n.controller.getSnapshot().focus), { props: i } = n, a =
|
|
1338
|
+
function Gt({ series: e, className: t }) {
|
|
1339
|
+
let n = b(), r = et(n.controller.subscribe, () => n.controller.getSnapshot().focus, () => n.controller.getSnapshot().focus), { props: i } = n, a = Ut(i.data, i.status ?? "ready", i.resetKey), o = i.series.find((t) => t.id === (e ?? i.series[0]?.id)), s = Qe(() => {
|
|
1311
1340
|
if (!o || i.x.type === "category" || !a.rows) return {
|
|
1312
1341
|
value: null,
|
|
1313
1342
|
error: null
|
|
@@ -1361,7 +1390,7 @@ function Wt({ series: e, className: t }) {
|
|
|
1361
1390
|
}
|
|
1362
1391
|
//#endregion
|
|
1363
1392
|
//#region src/cards/area-chart-card.tsx
|
|
1364
|
-
function
|
|
1393
|
+
function Kt({ stack: e, curve: t = "smooth", ...n }) {
|
|
1365
1394
|
return /* @__PURE__ */ Q(V, {
|
|
1366
1395
|
...n,
|
|
1367
1396
|
shape: {
|
|
@@ -1373,7 +1402,7 @@ function Gt({ stack: e, curve: t = "smooth", ...n }) {
|
|
|
1373
1402
|
}
|
|
1374
1403
|
//#endregion
|
|
1375
1404
|
//#region src/cards/line-chart-card.tsx
|
|
1376
|
-
function
|
|
1405
|
+
function qt({ curve: e = "smooth", points: t = !1, baseline: n = "auto", ...r }) {
|
|
1377
1406
|
return /* @__PURE__ */ Q(V, {
|
|
1378
1407
|
...r,
|
|
1379
1408
|
shape: {
|
|
@@ -1386,7 +1415,7 @@ function Kt({ curve: e = "smooth", points: t = !1, baseline: n = "auto", ...r })
|
|
|
1386
1415
|
}
|
|
1387
1416
|
//#endregion
|
|
1388
1417
|
//#region src/cards/bar-chart-card.tsx
|
|
1389
|
-
function
|
|
1418
|
+
function Jt({ stack: e, radius: t = 6, corners: n = "end", tracks: r = !1, barWidth: i, depth: a = !1, barStyle: o = a ? "isometric" : "solid", ...s }) {
|
|
1390
1419
|
return /* @__PURE__ */ Q(V, {
|
|
1391
1420
|
...s,
|
|
1392
1421
|
depth: a,
|
|
@@ -1403,11 +1432,11 @@ function qt({ stack: e, radius: t = 6, corners: n = "end", tracks: r = !1, barWi
|
|
|
1403
1432
|
}
|
|
1404
1433
|
//#endregion
|
|
1405
1434
|
//#region src/lifecycle/skeleton-sheen.tsx
|
|
1406
|
-
var
|
|
1435
|
+
var Yt = "color-mix(in srgb, var(--lilt-skeleton) 64%, var(--lilt-surface))", Xt = {
|
|
1407
1436
|
"--lilt-skeleton-paint": "white",
|
|
1408
1437
|
"--lilt-skeleton-gap": "black"
|
|
1409
1438
|
};
|
|
1410
|
-
function
|
|
1439
|
+
function Zt({ children: e, mask: t, sweep: n, loadingStyle: r = "shimmer", depth: i = !1, width: a, height: o, x: s = 0, y: c = 0, reduced: l = !1 }) {
|
|
1411
1440
|
let u = Xe().replace(/:/g, ""), d = _(!0, r), f = Math.max(a * .3, Math.min(a, 60)), p = n !== void 0 && !l && r !== "shimmer";
|
|
1412
1441
|
return /* @__PURE__ */ $("g", {
|
|
1413
1442
|
ref: d,
|
|
@@ -1461,7 +1490,7 @@ function Xt({ children: e, mask: t, sweep: n, loadingStyle: r = "shimmer", depth
|
|
|
1461
1490
|
width: a,
|
|
1462
1491
|
height: o,
|
|
1463
1492
|
children: /* @__PURE__ */ Q("g", {
|
|
1464
|
-
style:
|
|
1493
|
+
style: Xt,
|
|
1465
1494
|
children: t ?? e
|
|
1466
1495
|
})
|
|
1467
1496
|
})] }), /* @__PURE__ */ Q("g", {
|
|
@@ -1484,12 +1513,12 @@ function Xt({ children: e, mask: t, sweep: n, loadingStyle: r = "shimmer", depth
|
|
|
1484
1513
|
}
|
|
1485
1514
|
//#endregion
|
|
1486
1515
|
//#region src/cards/stat-card.tsx
|
|
1487
|
-
var
|
|
1488
|
-
function
|
|
1516
|
+
var Qt = [], $t = 28, en = "var(--lilt-series-1)", tn = "color-mix(in oklab, var(--lilt-muted) 16%, var(--lilt-surface))";
|
|
1517
|
+
function nn(e, t = $t) {
|
|
1489
1518
|
let n = Math.max(0, Math.min(1, e)) * t;
|
|
1490
1519
|
return Array.from({ length: t }, (e, t) => Math.max(0, Math.min(1, n - t)));
|
|
1491
1520
|
}
|
|
1492
|
-
function
|
|
1521
|
+
function rn({ value: e, target: t, height: n, depth: r = !1, formatValue: i }) {
|
|
1493
1522
|
let a = e === null || t <= 0 ? 0 : e / t, o = new Intl.NumberFormat("en-US", {
|
|
1494
1523
|
style: "percent",
|
|
1495
1524
|
maximumFractionDigits: 0
|
|
@@ -1517,7 +1546,7 @@ function nn({ value: e, target: t, height: n, depth: r = !1, formatValue: i }) {
|
|
|
1517
1546
|
"aria-valuemax": t,
|
|
1518
1547
|
"aria-valuenow": e ?? 0,
|
|
1519
1548
|
style: { height: n },
|
|
1520
|
-
children:
|
|
1549
|
+
children: nn(a).map((e, t) => /* @__PURE__ */ Q("span", {
|
|
1521
1550
|
className: "lilt-stat__cell",
|
|
1522
1551
|
children: e > 0 ? /* @__PURE__ */ Q("span", {
|
|
1523
1552
|
className: "lilt-stat__cell-fill",
|
|
@@ -1531,7 +1560,7 @@ function nn({ value: e, target: t, height: n, depth: r = !1, formatValue: i }) {
|
|
|
1531
1560
|
})]
|
|
1532
1561
|
});
|
|
1533
1562
|
}
|
|
1534
|
-
function
|
|
1563
|
+
function an({ value: e, target: t, size: n, reduced: r, loading: i = !1, loadingStyle: a = "shimmer", skeletonLeaving: o = !1, depth: s = !1, formatValue: c }) {
|
|
1535
1564
|
let l = e === null || t <= 0 ? null : Math.max(0, e / t), u = Math.max(4, Math.round(n / 9)), d = (n - u) / 2, f = new Intl.NumberFormat("en-US", {
|
|
1536
1565
|
style: "percent",
|
|
1537
1566
|
maximumFractionDigits: 0
|
|
@@ -1591,7 +1620,7 @@ function rn({ value: e, target: t, size: n, reduced: r, loading: i = !1, loading
|
|
|
1591
1620
|
children: /* @__PURE__ */ Q(C, {
|
|
1592
1621
|
leaving: o,
|
|
1593
1622
|
origin: "center",
|
|
1594
|
-
children: /* @__PURE__ */ Q("g", { children: i ? /* @__PURE__ */ Q(
|
|
1623
|
+
children: /* @__PURE__ */ Q("g", { children: i ? /* @__PURE__ */ Q(Zt, {
|
|
1595
1624
|
width: n,
|
|
1596
1625
|
height: n,
|
|
1597
1626
|
reduced: r,
|
|
@@ -1613,7 +1642,7 @@ function rn({ value: e, target: t, size: n, reduced: r, loading: i = !1, loading
|
|
|
1613
1642
|
children: s ? U(u).map((e, t) => /* @__PURE__ */ Q(qe, { children: m({
|
|
1614
1643
|
width: e.strokeWidth,
|
|
1615
1644
|
transform: e.transform,
|
|
1616
|
-
stroke: w(
|
|
1645
|
+
stroke: w(Yt, e.amount)
|
|
1617
1646
|
}, !0) }, t)) : m(void 0, !0)
|
|
1618
1647
|
}) : s ? /* @__PURE__ */ $(Z, { children: [
|
|
1619
1648
|
/* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(ce, {
|
|
@@ -1623,14 +1652,14 @@ function rn({ value: e, target: t, size: n, reduced: r, loading: i = !1, loading
|
|
|
1623
1652
|
U(u, "groove").map((e, t) => /* @__PURE__ */ Q(qe, { children: m({
|
|
1624
1653
|
width: e.strokeWidth,
|
|
1625
1654
|
transform: e.transform,
|
|
1626
|
-
stroke: w(
|
|
1655
|
+
stroke: w(tn, e.amount)
|
|
1627
1656
|
}) }, `track-${t}`)),
|
|
1628
1657
|
l ? /* @__PURE__ */ Q("g", {
|
|
1629
1658
|
filter: `url(#${p}-shadow)`,
|
|
1630
1659
|
children: U(u).map((e, t) => /* @__PURE__ */ Q(qe, { children: h({
|
|
1631
1660
|
width: e.strokeWidth,
|
|
1632
1661
|
transform: e.transform,
|
|
1633
|
-
stroke: w(
|
|
1662
|
+
stroke: w(en, e.amount)
|
|
1634
1663
|
}) }, `fill-${t}`))
|
|
1635
1664
|
}) : null
|
|
1636
1665
|
] }) : /* @__PURE__ */ $(Z, { children: [m(), l ? h() : null] }) })
|
|
@@ -1641,13 +1670,13 @@ function rn({ value: e, target: t, size: n, reduced: r, loading: i = !1, loading
|
|
|
1641
1670
|
})]
|
|
1642
1671
|
});
|
|
1643
1672
|
}
|
|
1644
|
-
var
|
|
1645
|
-
function
|
|
1673
|
+
var on = (e) => e.acceptedRevision;
|
|
1674
|
+
function sn({ title: e, header: t = !0, "aria-label": n = e || "Stat", data: r = Qt, value: i, x: a, xType: o, headline: s, aggregate: c = "sum", delta: l, deltaTone: d, caption: f, chart: m = "area", depth: h = !1, barStyle: g = h ? "isometric" : "solid", target: v, sync: y, height: b, color: x, aside: ee, valueFormat: te, locale: ne, formatValue: ie, formatX: w, surface: E = "elevated", badge: D, numberStyle: O, palette: ce, loading: k = !1, motion: A, loadingStyle: j = "shimmer", empty: M, className: N, style: F }) {
|
|
1646
1675
|
let I = he({
|
|
1647
1676
|
valueFormat: te,
|
|
1648
1677
|
locale: ne,
|
|
1649
1678
|
formatValue: ie
|
|
1650
|
-
}), L = i ?? "", R = m === "bars", ue = (m === "area" || m === "line" || R) && !!i, z = ue ? r :
|
|
1679
|
+
}), L = i ?? "", R = m === "bars", ue = (m === "area" || m === "line" || R) && !!i, z = ue ? r : Qt, B = Qe(() => {
|
|
1651
1680
|
if (a) return le(z, a, o, w);
|
|
1652
1681
|
let e = new Map(z.map((e, t) => [e, t]));
|
|
1653
1682
|
return {
|
|
@@ -1703,8 +1732,8 @@ function on({ title: e, header: t = !0, "aria-label": n = e || "Stat", data: r =
|
|
|
1703
1732
|
S(a ? y : void 0, fe.getController(), z, a ?? "", B, {
|
|
1704
1733
|
label: n,
|
|
1705
1734
|
release: fe.actions.release
|
|
1706
|
-
}), P(fe,
|
|
1707
|
-
let W = fe.series.some((e) => e.id === H[0].id) ? H[0].id : null, G = s ?? (i ? de(se(r, L), c) : null), _e = ue && pe ? pe.series[0]?.value ?? null : void 0, ve = _e === void 0 ? G : _e, K = b ?? (m === "meter" ? h ? 12 : 10 : R ? 44 : 56), q = !R, ye = Te(A ?? "auto"), J = re(k, ye), Y = _(k, j), xe = m === "ring" && v !== void 0, Se = xe ? `Target ${I.value(v)}` : void 0, Ce = xe ? /* @__PURE__ */ Q(
|
|
1735
|
+
}), P(fe, on);
|
|
1736
|
+
let W = fe.series.some((e) => e.id === H[0].id) ? H[0].id : null, G = s ?? (i ? de(se(r, L), c) : null), _e = ue && pe ? pe.series[0]?.value ?? null : void 0, ve = _e === void 0 ? G : _e, K = b ?? (m === "meter" ? h ? 12 : 10 : R ? 44 : 56), q = !R, ye = Te(A ?? "auto"), J = re(k, ye), Y = _(k, j), xe = m === "ring" && v !== void 0, Se = xe ? `Target ${I.value(v)}` : void 0, Ce = xe ? /* @__PURE__ */ Q(an, {
|
|
1708
1737
|
loading: k,
|
|
1709
1738
|
loadingStyle: j,
|
|
1710
1739
|
skeletonLeaving: J,
|
|
@@ -1763,7 +1792,7 @@ function on({ title: e, header: t = !0, "aria-label": n = e || "Stat", data: r =
|
|
|
1763
1792
|
className: "lilt-stat__meter-labels",
|
|
1764
1793
|
children: [/* @__PURE__ */ Q("span", { children: "—" }), /* @__PURE__ */ Q("span", { children: "—" })]
|
|
1765
1794
|
})]
|
|
1766
|
-
}) : /* @__PURE__ */ Q(
|
|
1795
|
+
}) : /* @__PURE__ */ Q(rn, {
|
|
1767
1796
|
value: G,
|
|
1768
1797
|
target: v,
|
|
1769
1798
|
height: K,
|
|
@@ -1813,7 +1842,7 @@ function on({ title: e, header: t = !0, "aria-label": n = e || "Stat", data: r =
|
|
|
1813
1842
|
}
|
|
1814
1843
|
//#endregion
|
|
1815
1844
|
//#region src/cards/use-card-selection.ts
|
|
1816
|
-
function
|
|
1845
|
+
function cn(e, t, n, r) {
|
|
1817
1846
|
let i = e !== void 0, [a, o] = X(null), s = i ? e : a, c = s !== null && n.includes(s) ? s : null, l = $e(c);
|
|
1818
1847
|
l.current = c;
|
|
1819
1848
|
let u = $e(t);
|
|
@@ -1831,11 +1860,11 @@ function sn(e, t, n, r) {
|
|
|
1831
1860
|
}
|
|
1832
1861
|
//#endregion
|
|
1833
1862
|
//#region src/cards/rank.ts
|
|
1834
|
-
var
|
|
1863
|
+
var ln = "\0other", un = new Intl.NumberFormat("en-US", {
|
|
1835
1864
|
style: "percent",
|
|
1836
1865
|
maximumFractionDigits: 0
|
|
1837
1866
|
});
|
|
1838
|
-
function
|
|
1867
|
+
function dn(e, t, n, r, i, a) {
|
|
1839
1868
|
let o = (e) => e[n], s = Ge(We(e, {
|
|
1840
1869
|
id: (e) => String(e[t] ?? ""),
|
|
1841
1870
|
label: (e) => String(e[t] ?? "")
|
|
@@ -1850,13 +1879,13 @@ function un(e, t, n, r, i, a) {
|
|
|
1850
1879
|
if (i === void 0 || i < 1 || s.length <= i + 1) return s;
|
|
1851
1880
|
let c = s.slice(i).flatMap((e) => e.value === null ? [] : [e.value]);
|
|
1852
1881
|
return [...s.slice(0, i), {
|
|
1853
|
-
id:
|
|
1882
|
+
id: ln,
|
|
1854
1883
|
label: a,
|
|
1855
1884
|
value: c.length ? c.reduce((e, t) => e + t, 0) : null,
|
|
1856
1885
|
other: !0
|
|
1857
1886
|
}];
|
|
1858
1887
|
}
|
|
1859
|
-
function
|
|
1888
|
+
function fn(e) {
|
|
1860
1889
|
let t = e.flatMap((e) => e.value === null ? [] : [e.value]), n = t.reduce((e, t) => e + t, 0);
|
|
1861
1890
|
return {
|
|
1862
1891
|
observed: t.length,
|
|
@@ -1866,16 +1895,16 @@ function dn(e) {
|
|
|
1866
1895
|
}
|
|
1867
1896
|
//#endregion
|
|
1868
1897
|
//#region src/cards/horizontal-bar-chart-card.tsx
|
|
1869
|
-
var
|
|
1870
|
-
function
|
|
1898
|
+
var pn = [];
|
|
1899
|
+
function mn({ title: e, header: t = !0, "aria-label": n = e || "Horizontal bar chart", data: r, category: i, value: a, headline: o, delta: s, deltaTone: c, range: l, ranges: u, defaultRange: f, sort: p = "descending", limit: m, otherLabel: h = "Other", share: g = !0, rank: v = !1, depth: y = !1, barStyle: b = y ? "isometric" : "inline", valueFormat: x, locale: ee, formatValue: te, color: S, surface: ie = "elevated", badge: ae, numberStyle: w, palette: oe, selected: T, onSelectedChange: se, loading: E = !1, loadingStyle: D = "shimmer", empty: O = "dots", motion: ce = "auto", className: k, style: A }) {
|
|
1871
1900
|
let j = Te(ce), M = _(E, D), N = re(E, j), P = he({
|
|
1872
1901
|
valueFormat: x,
|
|
1873
1902
|
locale: ee,
|
|
1874
1903
|
formatValue: te
|
|
1875
|
-
}), [F, I] = X(f ?? u?.[0]?.id), L = u?.find((e) => e.id === F) ?? u?.[0], R = L?.data ?? r ??
|
|
1904
|
+
}), [F, I] = X(f ?? u?.[0]?.id), L = u?.find((e) => e.id === F) ?? u?.[0], R = L?.data ?? r ?? pn, le = L ? L.delta : s, ue = Qe(() => {
|
|
1876
1905
|
try {
|
|
1877
1906
|
return {
|
|
1878
|
-
rows:
|
|
1907
|
+
rows: dn(R, i, a, p, m, h),
|
|
1879
1908
|
error: null
|
|
1880
1909
|
};
|
|
1881
1910
|
} catch (e) {
|
|
@@ -1891,21 +1920,23 @@ function pn({ title: e, header: t = !0, "aria-label": n = e || "Horizontal bar c
|
|
|
1891
1920
|
p,
|
|
1892
1921
|
m,
|
|
1893
1922
|
h
|
|
1894
|
-
]), z = ue.rows, B =
|
|
1923
|
+
]), z = ue.rows, B = fn(z), V = B.total, H = g && B.shareable, de = Qe(() => He(z.map((e) => ({
|
|
1895
1924
|
...e,
|
|
1896
1925
|
datum: e
|
|
1897
|
-
}))), [z]), [U, fe] = X(null), [pe, me] = X(null), [W, G] =
|
|
1898
|
-
resolve:
|
|
1926
|
+
}))), [z]), [U, fe] = X(null), [pe, me] = X(null), [W, G] = cn(T, se, Qe(() => z.map((e) => e.id), [z]), !E && ue.error === null), _e = W ?? pe ?? U, ve = z.find((e) => e.id === _e), q = $e(/* @__PURE__ */ new Map()), ye = Ht({
|
|
1927
|
+
resolve: Vt,
|
|
1899
1928
|
onGlide: fe,
|
|
1900
|
-
onLift: (e) => e !== null && G(e)
|
|
1901
|
-
|
|
1929
|
+
onLift: (e) => e !== null && G(e),
|
|
1930
|
+
pinned: W !== null,
|
|
1931
|
+
onRelease: () => G(null)
|
|
1932
|
+
}), J = L?.headline ?? o ?? (B.observed ? V : null), Y = (e) => H && e !== null ? un.format(e / V) : null, be = (e, t) => {
|
|
1902
1933
|
let n = t;
|
|
1903
1934
|
if (e.key === "ArrowDown") n = Math.min(z.length - 1, t + 1);
|
|
1904
1935
|
else if (e.key === "ArrowUp") n = Math.max(0, t - 1);
|
|
1905
1936
|
else if (e.key === "Home") n = 0;
|
|
1906
1937
|
else if (e.key === "End") n = z.length - 1;
|
|
1907
1938
|
else if (e.key === "Escape") {
|
|
1908
|
-
G(null);
|
|
1939
|
+
e.preventDefault(), G(null);
|
|
1909
1940
|
return;
|
|
1910
1941
|
} else return;
|
|
1911
1942
|
e.preventDefault(), q.current.get(z[n].id)?.focus();
|
|
@@ -2140,7 +2171,7 @@ function pn({ title: e, header: t = !0, "aria-label": n = e || "Horizontal bar c
|
|
|
2140
2171
|
}
|
|
2141
2172
|
//#endregion
|
|
2142
2173
|
//#region src/cards/combo-chart-card.tsx
|
|
2143
|
-
function
|
|
2174
|
+
function hn({ 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 }) {
|
|
2144
2175
|
let h = n === "own";
|
|
2145
2176
|
return /* @__PURE__ */ Q(V, {
|
|
2146
2177
|
...m,
|
|
@@ -2168,36 +2199,36 @@ function mn({ bars: e, lines: t, lineScale: n = "shared", stack: r, radius: i =
|
|
|
2168
2199
|
}
|
|
2169
2200
|
//#endregion
|
|
2170
2201
|
//#region src/cards/radial-chart-card.tsx
|
|
2171
|
-
var
|
|
2172
|
-
function
|
|
2202
|
+
var gn = [], _n = 92, vn = 98, yn = Math.PI * 2, bn = .94, xn = "color-mix(in oklab, var(--lilt-muted) 13%, var(--lilt-surface))";
|
|
2203
|
+
function Sn(e) {
|
|
2173
2204
|
let t = e.reduce((e, t) => e + Math.max(0, t.value ?? 0), 0), n = 0;
|
|
2174
2205
|
return e.flatMap((e) => {
|
|
2175
2206
|
if (e.value === null || t <= 0) return [];
|
|
2176
2207
|
let r = n;
|
|
2177
|
-
return n += Math.max(0, e.value) / t *
|
|
2208
|
+
return n += Math.max(0, e.value) / t * yn, [{
|
|
2178
2209
|
id: e.id,
|
|
2179
2210
|
startAngle: r,
|
|
2180
2211
|
endAngle: n
|
|
2181
2212
|
}];
|
|
2182
2213
|
});
|
|
2183
2214
|
}
|
|
2184
|
-
function
|
|
2215
|
+
function Cn(e) {
|
|
2185
2216
|
if (!(e > 0)) return 1;
|
|
2186
2217
|
let t = 10 ** Math.floor(Math.log10(e)) / 4;
|
|
2187
2218
|
return Math.ceil(e * 1.05 / t) * t;
|
|
2188
2219
|
}
|
|
2189
|
-
function
|
|
2190
|
-
let t =
|
|
2220
|
+
function wn(e) {
|
|
2221
|
+
let t = Cn(Math.max(0, ...e.map((e) => e.value ?? 0)));
|
|
2191
2222
|
return e.flatMap((e) => e.value === null ? [] : [{
|
|
2192
2223
|
id: e.id,
|
|
2193
2224
|
startAngle: 0,
|
|
2194
|
-
endAngle: Math.max(0, e.value) / t *
|
|
2225
|
+
endAngle: Math.max(0, e.value) / t * yn
|
|
2195
2226
|
}]);
|
|
2196
2227
|
}
|
|
2197
|
-
function
|
|
2228
|
+
function Tn(e) {
|
|
2198
2229
|
return 1 - (1 - e) ** 2;
|
|
2199
2230
|
}
|
|
2200
|
-
function
|
|
2231
|
+
function En(e, t, n) {
|
|
2201
2232
|
let r = new Map(t.map((e) => [e.id, e])), i = Math.max(0, Math.min(1, n));
|
|
2202
2233
|
return e.flatMap((n, a) => {
|
|
2203
2234
|
if (r.has(n.id)) return [];
|
|
@@ -2211,8 +2242,8 @@ function Tn(e, t, n) {
|
|
|
2211
2242
|
}];
|
|
2212
2243
|
});
|
|
2213
2244
|
}
|
|
2214
|
-
var
|
|
2215
|
-
function
|
|
2245
|
+
var Dn = (e) => e > .05 ? { filter: `blur(${e.toFixed(2)}px)` } : {};
|
|
2246
|
+
function On(e, t, n) {
|
|
2216
2247
|
let r = new Map(e.map((e) => [e.id, e]));
|
|
2217
2248
|
return t.map((e) => {
|
|
2218
2249
|
let t = r.get(e.id) ?? {
|
|
@@ -2226,14 +2257,14 @@ function Dn(e, t, n) {
|
|
|
2226
2257
|
};
|
|
2227
2258
|
});
|
|
2228
2259
|
}
|
|
2229
|
-
function
|
|
2260
|
+
function kn({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", data: r, category: i, value: a, variant: o = "donut", depth: s = !1, legend: c = o === "rings" ? "tiles" : o === "semi" ? "inline" : "list", legendSwatch: l, headline: u, delta: f, deltaTone: p, range: m, ranges: h, defaultRange: g, limit: _ = 5, otherLabel: v = "Other", sort: y = "descending", valueFormat: b, locale: x, formatValue: ee, surface: te = "elevated", badge: S, numberStyle: ie, palette: ae, selected: oe, onSelectedChange: T, colors: se, center: E, loading: D = !1, loadingStyle: O = "shimmer", empty: k = "dots", motion: A = "auto", className: j, style: M }) {
|
|
2230
2261
|
let N = Te(A), P = re(D, N), F = D || P, L = he({
|
|
2231
2262
|
valueFormat: b,
|
|
2232
2263
|
locale: x,
|
|
2233
2264
|
formatValue: ee
|
|
2234
|
-
}), [R, le] = X(g ?? h?.[0]?.id), ue = h?.find((e) => e.id === R) ?? h?.[0], B = ue?.data ?? r ??
|
|
2265
|
+
}), [R, le] = X(g ?? h?.[0]?.id), ue = h?.find((e) => e.id === R) ?? h?.[0], B = ue?.data ?? r ?? gn, V = ue ? ue.delta : f, H = `lilt-radial-depth-${Xe().replace(/:/g, "")}`, de = Qe(() => {
|
|
2235
2266
|
try {
|
|
2236
|
-
let e =
|
|
2267
|
+
let e = dn(B, i, a, y, _, v), t = e.find((e) => e.value !== null && e.value < 0);
|
|
2237
2268
|
if (t) throw Error(`Slices can’t be negative, and “${t.label}” is below zero.`);
|
|
2238
2269
|
return {
|
|
2239
2270
|
rows: e,
|
|
@@ -2252,9 +2283,9 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2252
2283
|
y,
|
|
2253
2284
|
_,
|
|
2254
2285
|
v
|
|
2255
|
-
]), pe = de.rows, [me, W] = X([]), G = Qe(() => pe.filter((e) => !me.includes(e.id)), [pe, me]), { total: ge, observed: _e } =
|
|
2286
|
+
]), pe = de.rows, [me, W] = X([]), G = Qe(() => pe.filter((e) => !me.includes(e.id)), [pe, me]), { total: ge, observed: _e } = fn(G), ve = $e(/* @__PURE__ */ new Map()), K = (e) => se?.[e] || (pe.find((t) => t.id === e)?.other ? "var(--lilt-reference)" : (ve.current.has(e) || ve.current.set(e, ve.current.size % 6), `var(--lilt-series-${ve.current.get(e) + 1})`));
|
|
2256
2287
|
for (let e of pe) !e.other && !se?.[e.id] && K(e.id);
|
|
2257
|
-
let q = o === "rings", ye = o === "semi", J = Qe(() => q ?
|
|
2288
|
+
let q = o === "rings", ye = o === "semi", J = Qe(() => q ? wn(G) : Sn(G), [G, q]), [Y, be] = X({
|
|
2258
2289
|
key: 0,
|
|
2259
2290
|
from: [],
|
|
2260
2291
|
to: J,
|
|
@@ -2272,26 +2303,28 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2272
2303
|
duration: Y.initial ? 900 : 550,
|
|
2273
2304
|
spring: !Y.initial
|
|
2274
2305
|
}, N), we = Ce < 1, De = .09, Oe = (e) => q && Y.initial ? Math.max(0, Math.min(1, (Ce - e * De) / (1 - (J.length - 1) * De || 1))) : Ce, Ne = Y.initial ? Y.to.map((e, t) => {
|
|
2275
|
-
let n = q ?
|
|
2306
|
+
let n = q ? Tn(Oe(t)) : Ce;
|
|
2276
2307
|
return {
|
|
2277
2308
|
...e,
|
|
2278
2309
|
startAngle: e.startAngle * n,
|
|
2279
2310
|
endAngle: e.endAngle * n
|
|
2280
2311
|
};
|
|
2281
|
-
}) :
|
|
2312
|
+
}) : On(Y.from, Y.to, Ce);
|
|
2282
2313
|
xe.current = Ne;
|
|
2283
|
-
let Le = !Y.initial && we, Re = Le && !q ?
|
|
2284
|
-
resolve:
|
|
2314
|
+
let Le = !Y.initial && we, Re = Le && !q ? En(Y.from, Y.to, Ce) : [], ze = Qe(() => new Set(Y.from.map((e) => e.id)), [Y.from]), Be = (e) => Le && !ze.has(e) ? 8 * (1 - Math.max(0, Math.min(1, Ce))) : 0, Ve = Y.initial && we ? 8 * (1 - Ce) ** 2 : 0, [He, Ue] = X(null), [We, Ge] = X(null), [Ke, qe] = cn(oe, T, Qe(() => G.map((e) => e.id), [G]), !D && de.error === null), Je = Ke ?? We ?? He, Ye = G.find((e) => e.id === Je), Ze = $e(/* @__PURE__ */ new Map()), et = Ht({
|
|
2315
|
+
resolve: Vt,
|
|
2285
2316
|
onGlide: Ue,
|
|
2286
2317
|
onLift: (e) => e !== null && qe(e),
|
|
2318
|
+
pinned: Ke !== null,
|
|
2319
|
+
onRelease: () => qe(null),
|
|
2287
2320
|
disabled: D
|
|
2288
|
-
}), tt = (e) => e && e.value !== null && ge > 0 && !me.includes(e.id) ?
|
|
2321
|
+
}), tt = (e) => e && e.value !== null && ge > 0 && !me.includes(e.id) ? un.format(e.value / ge) : null, nt = G.find((e) => e.value !== null && !e.other), rt = (e) => {
|
|
2289
2322
|
W(e), Ue(null), qe(null);
|
|
2290
|
-
}, at = (e) => me.includes(e) ? rt(me.filter((t) => t !== e)) : G.length > 1 ? rt([...me, e]) : void 0, ot = Ye ?? nt, st = o === "donut" ? 62 : ye ? 64 : 0, ct = (e) => it().innerRadius(st).outerRadius(e).cornerRadius(o === "donut" ? 3 : ye ? 14 : 0).padAngle(Ne.length > 1 ? ye ? .05 : .012 : 0), lt = ct(
|
|
2323
|
+
}, at = (e) => me.includes(e) ? rt(me.filter((t) => t !== e)) : G.length > 1 ? rt([...me, e]) : void 0, ot = Ye ?? nt, st = o === "donut" ? 62 : ye ? 64 : 0, ct = (e) => it().innerRadius(st).outerRadius(e).cornerRadius(o === "donut" ? 3 : ye ? 14 : 0).padAngle(Ne.length > 1 ? ye ? .05 : .012 : 0), lt = ct(_n), ut = ct(vn), dt = (e) => ({
|
|
2291
2324
|
...e,
|
|
2292
2325
|
startAngle: -Math.PI / 2 + e.startAngle / 2,
|
|
2293
2326
|
endAngle: -Math.PI / 2 + e.endAngle / 2
|
|
2294
|
-
}), ft = Math.max(1, J.length), pt = Math.min(9, 62 / ft - 4), mt = (e, t = 0) => it().innerRadius(
|
|
2327
|
+
}), ft = Math.max(1, J.length), pt = Math.min(9, 62 / ft - 4), mt = (e, t = 0) => it().innerRadius(_n - e * (pt + 4) - pt - t / 2).outerRadius(_n - e * (pt + 4) + t / 2).cornerRadius(pt), ht = (e) => ({
|
|
2295
2328
|
"data-glide-id": e,
|
|
2296
2329
|
onPointerEnter: () => Ue(e),
|
|
2297
2330
|
onPointerLeave: () => Ue(null),
|
|
@@ -2305,7 +2338,7 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2305
2338
|
band: mt(t)({
|
|
2306
2339
|
id: e.id,
|
|
2307
2340
|
startAngle: 0,
|
|
2308
|
-
endAngle:
|
|
2341
|
+
endAngle: yn
|
|
2309
2342
|
}) ?? "",
|
|
2310
2343
|
path: e.endAngle > 0 ? mt(t, n ? 3 : 0)(e) : null,
|
|
2311
2344
|
color: K(e.id)
|
|
@@ -2331,7 +2364,7 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2331
2364
|
style: {
|
|
2332
2365
|
fill: K(e.id),
|
|
2333
2366
|
opacity: e.opacity,
|
|
2334
|
-
...
|
|
2367
|
+
...Dn(e.blur)
|
|
2335
2368
|
}
|
|
2336
2369
|
}, e.id) : null;
|
|
2337
2370
|
})
|
|
@@ -2349,7 +2382,7 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2349
2382
|
d: e.path,
|
|
2350
2383
|
style: {
|
|
2351
2384
|
fill: e.color,
|
|
2352
|
-
...
|
|
2385
|
+
...Dn(Be(e.slice.id))
|
|
2353
2386
|
}
|
|
2354
2387
|
}) : null]
|
|
2355
2388
|
}, e.slice.id)) : _t.map((e) => /* @__PURE__ */ $("g", { children: [/* @__PURE__ */ Q("path", {
|
|
@@ -2360,7 +2393,7 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2360
2393
|
"data-muted": e.muted,
|
|
2361
2394
|
style: {
|
|
2362
2395
|
fill: e.color,
|
|
2363
|
-
...
|
|
2396
|
+
...Dn(Be(e.slice.id))
|
|
2364
2397
|
}
|
|
2365
2398
|
}), /* @__PURE__ */ Q("path", {
|
|
2366
2399
|
className: "lilt-radial-card__hit",
|
|
@@ -2368,7 +2401,7 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2368
2401
|
"data-category": e.slice.id,
|
|
2369
2402
|
...ht(e.slice.id)
|
|
2370
2403
|
})] }, e.slice.id)), bt = (e, t, n) => {
|
|
2371
|
-
if (n - t >=
|
|
2404
|
+
if (n - t >= yn - 1e-6) return `M0,${-e}A${e},${e} 0 1 1 0,${e}A${e},${e} 0 1 1 0,${-e}`;
|
|
2372
2405
|
let r = (t) => `${(e * Math.sin(t)).toFixed(3)},${(-e * Math.cos(t)).toFixed(3)}`;
|
|
2373
2406
|
return `M${r(t)}A${e},${e} 0 ${+(n - t > Math.PI)} 1 ${r(n)}`;
|
|
2374
2407
|
}, xt = (e, t, n, r, i, a, o = "tube") => {
|
|
@@ -2393,7 +2426,7 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2393
2426
|
}, t))
|
|
2394
2427
|
})] });
|
|
2395
2428
|
}, St = (e, t = 0) => ({
|
|
2396
|
-
radius:
|
|
2429
|
+
radius: _n - e * (pt + 4) + t / 2 - (pt + t) / 2,
|
|
2397
2430
|
width: pt + t
|
|
2398
2431
|
}), Ct = () => q ? gt.map((e, t) => {
|
|
2399
2432
|
if (!e.path) return null;
|
|
@@ -2405,7 +2438,7 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2405
2438
|
children: xt(`ring-${t}`, e.path, n.radius, n.width, e.slice, e.color)
|
|
2406
2439
|
}, e.slice.id);
|
|
2407
2440
|
}) : _t.map((e) => {
|
|
2408
|
-
let t = e.isActive ?
|
|
2441
|
+
let t = e.isActive ? vn : _n;
|
|
2409
2442
|
return /* @__PURE__ */ Q("g", {
|
|
2410
2443
|
className: "lilt-radial-card__slice",
|
|
2411
2444
|
"data-category": e.slice.id,
|
|
@@ -2446,8 +2479,8 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2446
2479
|
d: e.band
|
|
2447
2480
|
}), xt(`track-${t}`, e.band, n.radius, n.width, {
|
|
2448
2481
|
startAngle: 0,
|
|
2449
|
-
endAngle:
|
|
2450
|
-
},
|
|
2482
|
+
endAngle: yn
|
|
2483
|
+
}, xn, "groove")]
|
|
2451
2484
|
}, `track-${e.slice.id}`);
|
|
2452
2485
|
}) : null,
|
|
2453
2486
|
/* @__PURE__ */ Q("g", {
|
|
@@ -2468,7 +2501,7 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2468
2501
|
else if (e.key === "End") n = pe.length - 1;
|
|
2469
2502
|
else return;
|
|
2470
2503
|
e.preventDefault(), Ze.current.get(pe[n].id)?.focus();
|
|
2471
|
-
}, Et = ue?.headline ?? u ?? (_e ? ge : null), Dt = !D && (de.error !== null || ge <= 0), Ot = ye ? [-Math.PI / 2, Math.PI / 2] : [0,
|
|
2504
|
+
}, Et = ue?.headline ?? u ?? (_e ? ge : null), Dt = !D && (de.error !== null || ge <= 0), Ot = ye ? [-Math.PI / 2, Math.PI / 2] : [0, yn], kt = (q ? [
|
|
2472
2505
|
86,
|
|
2473
2506
|
66,
|
|
2474
2507
|
46
|
|
@@ -2490,8 +2523,8 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2490
2523
|
].map((e, t, n) => {
|
|
2491
2524
|
let r = n.slice(0, t).reduce((e, t) => e + t, 0);
|
|
2492
2525
|
return {
|
|
2493
|
-
radius: (
|
|
2494
|
-
width:
|
|
2526
|
+
radius: (_n + st) / 2,
|
|
2527
|
+
width: _n - st,
|
|
2495
2528
|
from: r,
|
|
2496
2529
|
to: r + e,
|
|
2497
2530
|
step: r * 12
|
|
@@ -2599,7 +2632,7 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2599
2632
|
children: /* @__PURE__ */ Q(C, {
|
|
2600
2633
|
leaving: P,
|
|
2601
2634
|
origin: "center",
|
|
2602
|
-
children: /* @__PURE__ */ Q("g", { children: D ? /* @__PURE__ */ Q(
|
|
2635
|
+
children: /* @__PURE__ */ Q("g", { children: D ? /* @__PURE__ */ Q(Zt, {
|
|
2603
2636
|
x: -100,
|
|
2604
2637
|
y: -100,
|
|
2605
2638
|
width: 200,
|
|
@@ -2608,12 +2641,12 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2608
2641
|
loadingStyle: O,
|
|
2609
2642
|
depth: s,
|
|
2610
2643
|
mask: s ? /* @__PURE__ */ Q("g", {
|
|
2611
|
-
transform: `scale(${
|
|
2644
|
+
transform: `scale(${bn})`,
|
|
2612
2645
|
children: Mt(!0)
|
|
2613
2646
|
}) : Mt(!0),
|
|
2614
2647
|
children: s ? /* @__PURE__ */ $("g", {
|
|
2615
2648
|
"data-lilt-loading-depth": "",
|
|
2616
|
-
transform: `scale(${
|
|
2649
|
+
transform: `scale(${bn})`,
|
|
2617
2650
|
opacity: .6,
|
|
2618
2651
|
children: [/* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(ce, {
|
|
2619
2652
|
id: `${H}-loading-shadow`,
|
|
@@ -2643,9 +2676,9 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2643
2676
|
}) : Mt(!1)
|
|
2644
2677
|
}) : /* @__PURE__ */ Q("g", {
|
|
2645
2678
|
"data-lilt-snap": Se ? Se % 2 : void 0,
|
|
2646
|
-
style:
|
|
2679
|
+
style: Dn(Ve),
|
|
2647
2680
|
children: s ? /* @__PURE__ */ $("g", {
|
|
2648
|
-
transform: `scale(${
|
|
2681
|
+
transform: `scale(${bn})`,
|
|
2649
2682
|
children: [wt(), vt]
|
|
2650
2683
|
}) : /* @__PURE__ */ $(Z, { children: [yt(), vt] })
|
|
2651
2684
|
}) })
|
|
@@ -2779,8 +2812,8 @@ function On({ title: e, header: t = !0, "aria-label": n = e || "Radial chart", d
|
|
|
2779
2812
|
}
|
|
2780
2813
|
//#endregion
|
|
2781
2814
|
//#region src/cards/progress-card.tsx
|
|
2782
|
-
var
|
|
2783
|
-
function
|
|
2815
|
+
var An = (e) => `${Math.round(e * 100)}%`, jn = "var(--lilt-series-1)", Mn = "color-mix(in oklab, var(--lilt-muted) 14%, var(--lilt-surface))";
|
|
2816
|
+
function Nn({ title: e, header: t = !0, "aria-label": n = e || "Progress", value: r = null, target: i, label: a = "of goal", variant: o = "ring", depth: s = !1, delta: c, deltaTone: l, range: u, ranges: d, defaultRange: f, footer: p, valueFormat: m, locale: h, formatValue: g, color: _, surface: v = "elevated", badge: y, numberStyle: b, palette: x, loading: ee = !1, loadingStyle: te = "shimmer", motion: S = "auto", className: ne, style: ie }) {
|
|
2784
2817
|
let ae = Te(S), oe = re(ee, ae), T = `lilt-progress-depth-${Xe().replace(/:/g, "")}`, se = he({
|
|
2785
2818
|
valueFormat: m,
|
|
2786
2819
|
locale: h,
|
|
@@ -2876,7 +2909,7 @@ function Mn({ title: e, header: t = !0, "aria-label": n = e || "Progress", value
|
|
|
2876
2909
|
className: "lilt-progress__graphic",
|
|
2877
2910
|
"data-variant": o,
|
|
2878
2911
|
role: "meter",
|
|
2879
|
-
"aria-label": `${M === null ? "No data" :
|
|
2912
|
+
"aria-label": `${M === null ? "No data" : An(M)} ${a}, target ${se.value(A)}`,
|
|
2880
2913
|
"aria-valuemin": 0,
|
|
2881
2914
|
"aria-valuemax": A,
|
|
2882
2915
|
"aria-valuenow": k ?? 0,
|
|
@@ -2891,7 +2924,7 @@ function Mn({ title: e, header: t = !0, "aria-label": n = e || "Progress", value
|
|
|
2891
2924
|
}) : null, /* @__PURE__ */ Q(C, {
|
|
2892
2925
|
leaving: oe,
|
|
2893
2926
|
origin: "center",
|
|
2894
|
-
children: /* @__PURE__ */ Q("g", { children: ee ? /* @__PURE__ */ Q(
|
|
2927
|
+
children: /* @__PURE__ */ Q("g", { children: ee ? /* @__PURE__ */ Q(Zt, {
|
|
2895
2928
|
width: 200,
|
|
2896
2929
|
height: N ? 106 : 200,
|
|
2897
2930
|
reduced: ae,
|
|
@@ -2921,7 +2954,7 @@ function Mn({ title: e, header: t = !0, "aria-label": n = e || "Progress", value
|
|
|
2921
2954
|
children: s ? U(F).map((e, t) => /* @__PURE__ */ Q(qe, { children: R({
|
|
2922
2955
|
width: e.strokeWidth,
|
|
2923
2956
|
transform: e.transform,
|
|
2924
|
-
stroke: w(
|
|
2957
|
+
stroke: w(Yt, e.amount)
|
|
2925
2958
|
}, !0) }, t)) : R(void 0, !0)
|
|
2926
2959
|
}) : s ? /* @__PURE__ */ $(Z, { children: [
|
|
2927
2960
|
/* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(ce, {
|
|
@@ -2931,14 +2964,14 @@ function Mn({ title: e, header: t = !0, "aria-label": n = e || "Progress", value
|
|
|
2931
2964
|
U(F, "groove").map((e, t) => /* @__PURE__ */ Q(qe, { children: R({
|
|
2932
2965
|
width: e.strokeWidth,
|
|
2933
2966
|
transform: e.transform,
|
|
2934
|
-
stroke: w(
|
|
2967
|
+
stroke: w(Mn, e.amount)
|
|
2935
2968
|
}) }, `track-${t}`)),
|
|
2936
2969
|
M ? /* @__PURE__ */ Q("g", {
|
|
2937
2970
|
filter: `url(#${T}-shadow)`,
|
|
2938
2971
|
children: U(F).map((e, t) => /* @__PURE__ */ Q(qe, { children: ue({
|
|
2939
2972
|
width: e.strokeWidth,
|
|
2940
2973
|
transform: e.transform,
|
|
2941
|
-
stroke: w(
|
|
2974
|
+
stroke: w(jn, e.amount)
|
|
2942
2975
|
}) }, `fill-${t}`))
|
|
2943
2976
|
}) : null
|
|
2944
2977
|
] }) : /* @__PURE__ */ $(Z, { children: [R(), M ? ue() : null] }) })
|
|
@@ -2948,7 +2981,7 @@ function Mn({ title: e, header: t = !0, "aria-label": n = e || "Progress", value
|
|
|
2948
2981
|
"aria-hidden": "true",
|
|
2949
2982
|
children: [/* @__PURE__ */ Q("strong", { children: M === null ? "—" : /* @__PURE__ */ Q(Le, {
|
|
2950
2983
|
value: M,
|
|
2951
|
-
format:
|
|
2984
|
+
format: An,
|
|
2952
2985
|
variant: b,
|
|
2953
2986
|
motion: ae ? "none" : "auto"
|
|
2954
2987
|
}) }), /* @__PURE__ */ Q("span", { children: a })]
|
|
@@ -2963,19 +2996,19 @@ function Mn({ title: e, header: t = !0, "aria-label": n = e || "Progress", value
|
|
|
2963
2996
|
}
|
|
2964
2997
|
//#endregion
|
|
2965
2998
|
//#region src/cards/funnel-chart-card.tsx
|
|
2966
|
-
var
|
|
2999
|
+
var Pn = [], Fn = [
|
|
2967
3000
|
100,
|
|
2968
3001
|
62,
|
|
2969
3002
|
40,
|
|
2970
3003
|
24
|
|
2971
|
-
],
|
|
2972
|
-
function
|
|
3004
|
+
], In = 55, Ln = 1.4;
|
|
3005
|
+
function Rn(e) {
|
|
2973
3006
|
return e === null ? "—" : e > 0 && e < .01 ? "<1%" : `${Math.round(e * 100)}%`;
|
|
2974
3007
|
}
|
|
2975
|
-
function
|
|
3008
|
+
function zn(e, t, n, r) {
|
|
2976
3009
|
let i = e * 100, a = i + 100, o = (e) => 50 - e / 2, s = (e) => 50 + e / 2, c = n ?? t;
|
|
2977
3010
|
if (r === "linear") return `M${i},${o(t)} L${a},${o(c)} L${a},${s(c)} L${i},${s(t)} Z`;
|
|
2978
|
-
let l = i +
|
|
3011
|
+
let l = i + In, u = (a - l) * .5;
|
|
2979
3012
|
return [
|
|
2980
3013
|
`M${i},${o(t)}`,
|
|
2981
3014
|
`L${l},${o(t)}`,
|
|
@@ -2986,8 +3019,8 @@ function Rn(e, t, n, r) {
|
|
|
2986
3019
|
"Z"
|
|
2987
3020
|
].join(" ");
|
|
2988
3021
|
}
|
|
2989
|
-
var
|
|
2990
|
-
function
|
|
3022
|
+
var Bn = .28;
|
|
3023
|
+
function Vn(e, t, n, r) {
|
|
2991
3024
|
let i = e * 100, a = i + 100, o = n ?? t, s = [];
|
|
2992
3025
|
if (r === "linear") for (let e = 0; e <= 24; e += 1) {
|
|
2993
3026
|
let n = e / 24;
|
|
@@ -2997,7 +3030,7 @@ function Bn(e, t, n, r) {
|
|
|
2997
3030
|
});
|
|
2998
3031
|
}
|
|
2999
3032
|
else {
|
|
3000
|
-
let e = i +
|
|
3033
|
+
let e = i + In, n = (a - e) * .5;
|
|
3001
3034
|
s.push({
|
|
3002
3035
|
x: i,
|
|
3003
3036
|
half: t / 2
|
|
@@ -3019,15 +3052,15 @@ function Bn(e, t, n, r) {
|
|
|
3019
3052
|
};
|
|
3020
3053
|
});
|
|
3021
3054
|
}
|
|
3022
|
-
function
|
|
3055
|
+
function Hn(e, t, n, r) {
|
|
3023
3056
|
return `M${e},${50 - t}A${n},${t} 0 0 ${+(r === "right")} ${e},${50 + t}`;
|
|
3024
3057
|
}
|
|
3025
|
-
function
|
|
3058
|
+
function Un({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", data: r, category: i, value: a, curve: o = "smooth", colors: s = "stages", tracks: c = !1, depth: u = !1, height: f = 180, headline: p, delta: m, deltaTone: h, range: g, ranges: _, defaultRange: v, valueFormat: y, legend: b = "tiles", legendSwatch: x, locale: ee, formatValue: te, color: S, surface: ie = "elevated", badge: ae, numberStyle: w, palette: oe, selected: T, onSelectedChange: se, loading: E = !1, loadingStyle: D = "shimmer", empty: O = "dots", motion: ce = "auto", className: k, style: A }) {
|
|
3026
3059
|
let j = Te(ce), M = re(E, j), N = E || M, P = he({
|
|
3027
3060
|
valueFormat: y,
|
|
3028
3061
|
locale: ee,
|
|
3029
3062
|
formatValue: te
|
|
3030
|
-
}), [F, L] = X(v ?? _?.[0]?.id), R = _?.find((e) => e.id === F) ?? _?.[0], le = R?.data ?? r ??
|
|
3063
|
+
}), [F, L] = X(v ?? _?.[0]?.id), R = _?.find((e) => e.id === F) ?? _?.[0], le = R?.data ?? r ?? Pn, ue = R ? R.delta : m, B = Qe(() => {
|
|
3031
3064
|
try {
|
|
3032
3065
|
let e = (e, t) => e[t];
|
|
3033
3066
|
return {
|
|
@@ -3055,7 +3088,7 @@ function Hn({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", d
|
|
|
3055
3088
|
le,
|
|
3056
3089
|
i,
|
|
3057
3090
|
a
|
|
3058
|
-
]), V = B.rows, H = Qe(() => V.map((e) => e.share === null ? null : Math.max(
|
|
3091
|
+
]), V = B.rows, H = Qe(() => V.map((e) => e.share === null ? null : Math.max(Ln, e.share * 100)), [V]), [de, U] = X({
|
|
3059
3092
|
key: 0,
|
|
3060
3093
|
from: [],
|
|
3061
3094
|
to: H,
|
|
@@ -3077,27 +3110,29 @@ function Hn({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", d
|
|
|
3077
3110
|
return e === null || n == null ? e : n + (e - n) * me;
|
|
3078
3111
|
});
|
|
3079
3112
|
pe.current = W;
|
|
3080
|
-
let G = de.initial ? me : 1, ge = de.initial && me < 1 ? 8 * (1 - me) ** 2 : 0, _e = de.initial ? 0 : de.key, [ve, K] = X(null), [q, ye] =
|
|
3081
|
-
resolve:
|
|
3113
|
+
let G = de.initial ? me : 1, ge = de.initial && me < 1 ? 8 * (1 - me) ** 2 : 0, _e = de.initial ? 0 : de.key, [ve, K] = X(null), [q, ye] = cn(T, se, Qe(() => V.map((e) => e.id), [V]), !E), J = Ht({
|
|
3114
|
+
resolve: Vt,
|
|
3082
3115
|
onGlide: K,
|
|
3083
3116
|
onLift: (e) => e !== null && ye(e),
|
|
3117
|
+
pinned: q !== null,
|
|
3118
|
+
onRelease: () => ye(null),
|
|
3084
3119
|
disabled: E
|
|
3085
3120
|
}), [Y, be] = X(0), xe = $e(null), Se = Je((e) => {
|
|
3086
3121
|
if (J(e), xe.current?.disconnect(), xe.current = null, !e || !u || typeof ResizeObserver > "u") return;
|
|
3087
3122
|
let t = () => be(l(e).width);
|
|
3088
3123
|
t(), xe.current = new ResizeObserver(t), xe.current.observe(e);
|
|
3089
|
-
}, [J, u]), Ce = q ?? ve, we = V.findIndex((e) => e.id === Ce), De = V[we], Oe = we > 0 ? V[we - 1] : void 0, Ne = (e) => s === "single" ? "var(--lilt-series-1)" : `var(--lilt-series-${e % 6 + 1})`, Le = $e(
|
|
3124
|
+
}, [J, u]), Ce = q ?? ve, we = V.findIndex((e) => e.id === Ce), De = V[we], Oe = we > 0 ? V[we - 1] : void 0, Ne = (e) => s === "single" ? "var(--lilt-series-1)" : `var(--lilt-series-${e % 6 + 1})`, Le = $e(Fn.length), Re = M ? Le.current : E && !V.length ? Fn.length : Math.max(1, V.length);
|
|
3090
3125
|
E && (Le.current = Re);
|
|
3091
3126
|
let ze = E ? Array.from({ length: Re }, (e, t) => {
|
|
3092
|
-
let n =
|
|
3127
|
+
let n = Fn[t] ?? Fn.at(-1), r = t + 1 < Re ? Fn[t + 1] ?? Fn.at(-1) : null;
|
|
3093
3128
|
return {
|
|
3094
3129
|
id: `loading-${t}`,
|
|
3095
3130
|
index: t,
|
|
3096
3131
|
own: n,
|
|
3097
3132
|
next: r,
|
|
3098
3133
|
to: r ?? n,
|
|
3099
|
-
d:
|
|
3100
|
-
color:
|
|
3134
|
+
d: zn(t, n, r, o),
|
|
3135
|
+
color: Yt,
|
|
3101
3136
|
muted: void 0
|
|
3102
3137
|
};
|
|
3103
3138
|
}) : V.flatMap((e, t) => {
|
|
@@ -3110,7 +3145,7 @@ function Hn({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", d
|
|
|
3110
3145
|
own: n,
|
|
3111
3146
|
next: r,
|
|
3112
3147
|
to: r ?? n,
|
|
3113
|
-
d:
|
|
3148
|
+
d: zn(t, n, r, o),
|
|
3114
3149
|
color: Ne(t),
|
|
3115
3150
|
muted: De && e.id !== De.id || void 0
|
|
3116
3151
|
}];
|
|
@@ -3122,7 +3157,7 @@ function Hn({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", d
|
|
|
3122
3157
|
"data-muted": e.muted,
|
|
3123
3158
|
style: { fill: e.color }
|
|
3124
3159
|
}, e.id)), Ve = u && Y > 0 && ze.length ? (() => {
|
|
3125
|
-
let e = Re * 100, t = e / Y, n = 100 / f, r = (e) => e / n *
|
|
3160
|
+
let e = Re * 100, t = e / Y, n = 100 / f, r = (e) => e / n * Bn * t, i = ze[0], a = ze[ze.length - 1], o = r(i.own / 2), s = r(a.to / 2), c = (e - o - s) / e;
|
|
3126
3161
|
return {
|
|
3127
3162
|
left: o,
|
|
3128
3163
|
sx: c,
|
|
@@ -3147,8 +3182,8 @@ function Hn({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", d
|
|
|
3147
3182
|
id: `${Ue}-clip-${t}`,
|
|
3148
3183
|
children: [
|
|
3149
3184
|
/* @__PURE__ */ Q("path", { d: e.d }),
|
|
3150
|
-
/* @__PURE__ */ Q("path", { d: `${
|
|
3151
|
-
n ? /* @__PURE__ */ Q("path", { d: `${
|
|
3185
|
+
/* @__PURE__ */ Q("path", { d: `${Hn(c, i, Ve.rx(i), "right")}Z` }),
|
|
3186
|
+
n ? /* @__PURE__ */ Q("path", { d: `${Hn(s, a, Ve.rx(a), "left")}Z` }) : null
|
|
3152
3187
|
]
|
|
3153
3188
|
}),
|
|
3154
3189
|
/* @__PURE__ */ $("g", {
|
|
@@ -3161,7 +3196,7 @@ function Hn({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", d
|
|
|
3161
3196
|
height: a * 2,
|
|
3162
3197
|
style: { fill: We(t) }
|
|
3163
3198
|
}) : null,
|
|
3164
|
-
|
|
3199
|
+
Vn(t, e.own, e.next, o).map((e) => /* @__PURE__ */ Q("rect", {
|
|
3165
3200
|
x: e.x,
|
|
3166
3201
|
y: 50 - e.half,
|
|
3167
3202
|
width: e.width,
|
|
@@ -3185,7 +3220,7 @@ function Hn({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", d
|
|
|
3185
3220
|
style: { fill: `url(#${Ue}-cap-${t})` }
|
|
3186
3221
|
}) : /* @__PURE__ */ Q("path", {
|
|
3187
3222
|
className: "lilt-funnel-card__seam",
|
|
3188
|
-
d:
|
|
3223
|
+
d: Hn(c, i, Ve.rx(i), "right"),
|
|
3189
3224
|
fill: "none",
|
|
3190
3225
|
vectorEffect: "non-scaling-stroke"
|
|
3191
3226
|
})
|
|
@@ -3220,7 +3255,7 @@ function Hn({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", d
|
|
|
3220
3255
|
format: P.value,
|
|
3221
3256
|
loading: E,
|
|
3222
3257
|
motion: ce,
|
|
3223
|
-
children: E ? null : De ? /* @__PURE__ */ $(ke, { children: [De.label, De.conversion !== null && Oe ? ` · ${
|
|
3258
|
+
children: E ? null : De ? /* @__PURE__ */ $(ke, { children: [De.label, De.conversion !== null && Oe ? ` · ${Rn(De.conversion)} of ${Oe.label}` : ""] }) : !et && ue !== void 0 ? /* @__PURE__ */ Q(Ae, {
|
|
3224
3259
|
value: ue,
|
|
3225
3260
|
tone: h
|
|
3226
3261
|
}) : null
|
|
@@ -3301,7 +3336,7 @@ function Hn({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", d
|
|
|
3301
3336
|
width: 100,
|
|
3302
3337
|
height: 100
|
|
3303
3338
|
}, `track-${e.id}`)) : null,
|
|
3304
|
-
E ? /* @__PURE__ */ Q(
|
|
3339
|
+
E ? /* @__PURE__ */ Q(Zt, {
|
|
3305
3340
|
width: Re * 100,
|
|
3306
3341
|
height: 100,
|
|
3307
3342
|
reduced: j,
|
|
@@ -3360,7 +3395,7 @@ function Hn({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", d
|
|
|
3360
3395
|
children: /* @__PURE__ */ Q("span", {
|
|
3361
3396
|
className: "lilt-funnel-card__pill",
|
|
3362
3397
|
style: { opacity: G < (t + .5) / Re ? 0 : De && e.id !== De.id ? .45 : 1 },
|
|
3363
|
-
children:
|
|
3398
|
+
children: Rn(e.share)
|
|
3364
3399
|
})
|
|
3365
3400
|
}, e.id))]
|
|
3366
3401
|
}), b === !1 ? null : /* @__PURE__ */ Q(fe, {
|
|
@@ -3385,11 +3420,11 @@ function Hn({ title: e, header: t = !0, "aria-label": n = e || "Funnel chart", d
|
|
|
3385
3420
|
}
|
|
3386
3421
|
//#endregion
|
|
3387
3422
|
//#region src/cards/heatmap-chart-card.tsx
|
|
3388
|
-
var
|
|
3423
|
+
var Wn = [], Gn = {
|
|
3389
3424
|
rows: 7,
|
|
3390
3425
|
columns: 12
|
|
3391
|
-
},
|
|
3392
|
-
function
|
|
3426
|
+
}, Kn = 30, qn = 12, Jn = 8, Yn = (e, t) => `${e}\u0000${t}`;
|
|
3427
|
+
function Xn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
3393
3428
|
let s = (e, t) => e[t], c = (e) => ({
|
|
3394
3429
|
columns: [],
|
|
3395
3430
|
rows: [],
|
|
@@ -3413,7 +3448,7 @@ function Yn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
3413
3448
|
if (r) return c(`“${t}” isn’t listed in \`${o}\`.`);
|
|
3414
3449
|
n.push(t);
|
|
3415
3450
|
}
|
|
3416
|
-
let h =
|
|
3451
|
+
let h = Yn(m, e);
|
|
3417
3452
|
if (d.has(h)) return c(`${m}, ${e} appears twice; each cell needs one row.`);
|
|
3418
3453
|
let g = s(o, r), _ = typeof g == "number" && Number.isFinite(g) ? g : null;
|
|
3419
3454
|
_ !== null && (f = Math.min(f, _), p = Math.max(p, _)), d.set(h, {
|
|
@@ -3435,9 +3470,9 @@ function Yn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
3435
3470
|
columns: l,
|
|
3436
3471
|
rows: u,
|
|
3437
3472
|
cells: u.flatMap((e) => l.map((t) => {
|
|
3438
|
-
let n = d.get(
|
|
3473
|
+
let n = d.get(Yn(e, t)), r = n?.value ?? null;
|
|
3439
3474
|
return {
|
|
3440
|
-
id:
|
|
3475
|
+
id: Yn(e, t),
|
|
3441
3476
|
label: `${e}, ${t}`,
|
|
3442
3477
|
row: e,
|
|
3443
3478
|
column: t,
|
|
@@ -3450,13 +3485,13 @@ function Yn({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
3450
3485
|
error: null
|
|
3451
3486
|
};
|
|
3452
3487
|
}
|
|
3453
|
-
var
|
|
3454
|
-
function
|
|
3455
|
-
if (t <=
|
|
3456
|
-
let n = Math.ceil(t /
|
|
3488
|
+
var Zn = (e) => 12 + e * 83;
|
|
3489
|
+
function Qn(e, t) {
|
|
3490
|
+
if (t <= Jn) return "major";
|
|
3491
|
+
let n = Math.ceil(t / qn);
|
|
3457
3492
|
return e % (n * 2) == 0 ? "major" : e % n === 0 ? "minor" : "hidden";
|
|
3458
3493
|
}
|
|
3459
|
-
function
|
|
3494
|
+
function $n({ title: e, header: t = !0, "aria-label": n = e || "Heatmap chart", data: r, x: i, y: a, value: o, columns: s, rows: c, domain: l, aggregate: u = "sum", height: f, radius: p = 5, gap: m = 4, depth: h = !1, headline: g, delta: v, deltaTone: y, range: b, ranges: x, defaultRange: ee, valueFormat: te, locale: S, formatValue: ie, color: ae, surface: w = "elevated", badge: oe, numberStyle: T, palette: se, loading: E = !1, loadingStyle: D = "shimmer", empty: O = "dots", motion: ce = "auto", className: k, style: A }) {
|
|
3460
3495
|
let j = Te(ce), M = _(E, D), N = re(E, j), P = he({
|
|
3461
3496
|
valueFormat: te,
|
|
3462
3497
|
locale: S,
|
|
@@ -3469,7 +3504,7 @@ function Qn({ title: e, header: t = !0, "aria-label": n = e || "Heatmap chart",
|
|
|
3469
3504
|
id: L?.id,
|
|
3470
3505
|
count: R.count + 1
|
|
3471
3506
|
});
|
|
3472
|
-
let ue = L?.data ?? r ??
|
|
3507
|
+
let ue = L?.data ?? r ?? Wn, z = L ? L.delta : v, B = Qe(() => Xn({
|
|
3473
3508
|
data: ue,
|
|
3474
3509
|
x: i,
|
|
3475
3510
|
y: a,
|
|
@@ -3485,10 +3520,10 @@ function Qn({ title: e, header: t = !0, "aria-label": n = e || "Heatmap chart",
|
|
|
3485
3520
|
s,
|
|
3486
3521
|
c,
|
|
3487
3522
|
l
|
|
3488
|
-
]), V =
|
|
3523
|
+
]), V = Wt(B.cells, !E && !N, void 0, void 0, B.columns.length), H = B.cells.find((e) => e.id === V.active?.id), U = B.cells.flatMap((e) => e.value === null ? [] : [e.value]), fe = L?.headline ?? g ?? de(U, u), pe = B.cells.some((e) => e.value === null), me = !E && (B.error !== null || B.cells.length === 0), W = E && !B.cells.length ? Gn : {
|
|
3489
3524
|
rows: B.rows.length,
|
|
3490
3525
|
columns: B.columns.length
|
|
3491
|
-
}, G = f ? Math.max(8, (f - m * Math.max(0, W.rows - 1)) / Math.max(1, W.rows)) :
|
|
3526
|
+
}, G = f ? Math.max(8, (f - m * Math.max(0, W.rows - 1)) / Math.max(1, W.rows)) : Kn;
|
|
3492
3527
|
return /* @__PURE__ */ $(Ie, {
|
|
3493
3528
|
motion: ce,
|
|
3494
3529
|
className: ["lilt-heatmap-card", k].filter(Boolean).join(" "),
|
|
@@ -3599,7 +3634,7 @@ function Qn({ title: e, header: t = !0, "aria-label": n = e || "Heatmap chart",
|
|
|
3599
3634
|
"data-active": H?.id === a.id || void 0,
|
|
3600
3635
|
"data-muted": H && !o || void 0,
|
|
3601
3636
|
style: {
|
|
3602
|
-
"--lilt-heatmap-card-strength": a.intensity === null ? void 0 : `${
|
|
3637
|
+
"--lilt-heatmap-card-strength": a.intensity === null ? void 0 : `${Zn(a.intensity)}%`,
|
|
3603
3638
|
"--lilt-heatmap-card-delay": `${Math.min(160, r * 12)}ms`,
|
|
3604
3639
|
"--lilt-heatmap-card-ripple": `${Math.round((t + r) / Math.max(1, B.rows.length + B.columns.length - 2) * 320)}ms`
|
|
3605
3640
|
}
|
|
@@ -3615,7 +3650,7 @@ function Qn({ title: e, header: t = !0, "aria-label": n = e || "Heatmap chart",
|
|
|
3615
3650
|
scope: "col",
|
|
3616
3651
|
role: "columnheader",
|
|
3617
3652
|
className: "lilt-heatmap-card__column-label",
|
|
3618
|
-
"data-tier":
|
|
3653
|
+
"data-tier": Qn(t, B.columns.length),
|
|
3619
3654
|
"data-active": H?.column === e || void 0,
|
|
3620
3655
|
children: /* @__PURE__ */ Q("span", { children: e })
|
|
3621
3656
|
}, e))]
|
|
@@ -3647,7 +3682,7 @@ function Qn({ title: e, header: t = !0, "aria-label": n = e || "Heatmap chart",
|
|
|
3647
3682
|
}
|
|
3648
3683
|
//#endregion
|
|
3649
3684
|
//#region src/motion/use-departing.ts
|
|
3650
|
-
function
|
|
3685
|
+
function er(e, t, n) {
|
|
3651
3686
|
let r = e.map(t).join("\0"), [i, a] = X(r), [o, s] = X([]), c = $e(e);
|
|
3652
3687
|
if (r !== i) {
|
|
3653
3688
|
let n = new Set(e.map(t)), i = c.current.filter((e) => !n.has(t(e))), o = new Set(i.map(t));
|
|
@@ -3663,17 +3698,17 @@ function $n(e, t, n) {
|
|
|
3663
3698
|
}
|
|
3664
3699
|
//#endregion
|
|
3665
3700
|
//#region src/cards/observations-card.tsx
|
|
3666
|
-
var
|
|
3667
|
-
let n =
|
|
3701
|
+
var tr = [], nr = (e) => `var(--lilt-series-${e % 6 + 1})`, rr = (e, t) => e[t], ir = (e, t) => {
|
|
3702
|
+
let n = rr(e, t);
|
|
3668
3703
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
3669
3704
|
};
|
|
3670
|
-
function
|
|
3671
|
-
let E = Te(S), D = Xe().replace(/:/g, ""), [O, ce] = X(f ?? u?.[0]?.id), k = u?.find((e) => e.id === O) ?? u?.[0], A = k ? k.delta : s, j = k?.data ?? n ??
|
|
3705
|
+
function ar({ title: e, header: t = !0, data: n, height: r = 260, depth: i = !1, headline: a, aggregate: o = "sum", delta: s, deltaTone: c, range: l, ranges: u, defaultRange: f, valueFormat: p, locale: m, formatValue: h, legend: g = "tiles", legendSwatch: _, loading: v = !1, loadingStyle: y = "shimmer", empty: b = "dots", onSelectionChange: x, renderReadout: te, motion: S = "auto", className: ie, color: ae, layout: w, placeholder: oe, family: T, ...se }) {
|
|
3706
|
+
let E = Te(S), D = Xe().replace(/:/g, ""), [O, ce] = X(f ?? u?.[0]?.id), k = u?.find((e) => e.id === O) ?? u?.[0], A = k ? k.delta : s, j = k?.data ?? n ?? tr, M = Ut(v ? null : j, v ? "loading" : "ready", k?.id), N = v && M.rows === null, P = re(N, E), F = N || P, { ref: I, width: L } = ee(), R = L ? Math.max(1, L - 10) : 560, le = Math.max(100, r), ue = M.rows ?? j, B = Qe(() => w(ue, R, le), [
|
|
3672
3707
|
w,
|
|
3673
3708
|
ue,
|
|
3674
3709
|
R,
|
|
3675
3710
|
le
|
|
3676
|
-
]), V =
|
|
3711
|
+
]), V = er(B.marks, (e) => e.id, 420), [U, pe] = X({
|
|
3677
3712
|
id: k?.id,
|
|
3678
3713
|
count: 0,
|
|
3679
3714
|
moving: !1
|
|
@@ -3690,7 +3725,7 @@ function ir({ title: e, header: t = !0, data: n, height: r = 260, depth: i = !1,
|
|
|
3690
3725
|
})), 900);
|
|
3691
3726
|
return () => window.clearTimeout(e);
|
|
3692
3727
|
}, [U.moving, U.count]);
|
|
3693
|
-
let me = oe(R, le), W =
|
|
3728
|
+
let me = oe(R, le), W = Wt(B.error ? [] : B.marks, !F && !v, x, k?.id), G = B.marks.find((e) => e.id === W.active?.id), ge = he({
|
|
3694
3729
|
valueFormat: p,
|
|
3695
3730
|
locale: m,
|
|
3696
3731
|
formatValue: h
|
|
@@ -3780,7 +3815,7 @@ function ir({ title: e, header: t = !0, data: n, height: r = 260, depth: i = !1,
|
|
|
3780
3815
|
"aria-hidden": "true",
|
|
3781
3816
|
children: [N && i ? /* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(H, {
|
|
3782
3817
|
id: `${D}-sphere`,
|
|
3783
|
-
color:
|
|
3818
|
+
color: Yt
|
|
3784
3819
|
}), /* @__PURE__ */ $("linearGradient", {
|
|
3785
3820
|
id: `${D}-face`,
|
|
3786
3821
|
x1: "0",
|
|
@@ -3790,18 +3825,18 @@ function ir({ title: e, header: t = !0, data: n, height: r = 260, depth: i = !1,
|
|
|
3790
3825
|
children: [
|
|
3791
3826
|
/* @__PURE__ */ Q("stop", {
|
|
3792
3827
|
offset: "0",
|
|
3793
|
-
stopColor: `color-mix(in oklab, ${
|
|
3828
|
+
stopColor: `color-mix(in oklab, ${Yt}, white 24%)`
|
|
3794
3829
|
}),
|
|
3795
3830
|
/* @__PURE__ */ Q("stop", {
|
|
3796
3831
|
offset: "0.55",
|
|
3797
|
-
stopColor:
|
|
3832
|
+
stopColor: Yt
|
|
3798
3833
|
}),
|
|
3799
3834
|
/* @__PURE__ */ Q("stop", {
|
|
3800
3835
|
offset: "1",
|
|
3801
|
-
stopColor: `color-mix(in oklab, ${
|
|
3836
|
+
stopColor: `color-mix(in oklab, ${Yt}, black 12%)`
|
|
3802
3837
|
})
|
|
3803
3838
|
]
|
|
3804
|
-
})] }) : null, N ? /* @__PURE__ */ Q(
|
|
3839
|
+
})] }) : null, N ? /* @__PURE__ */ Q(Zt, {
|
|
3805
3840
|
width: Se,
|
|
3806
3841
|
height: Ce,
|
|
3807
3842
|
loadingStyle: y,
|
|
@@ -3826,7 +3861,7 @@ function ir({ title: e, header: t = !0, data: n, height: r = 260, depth: i = !1,
|
|
|
3826
3861
|
top: e.y,
|
|
3827
3862
|
width: e.width,
|
|
3828
3863
|
height: e.height,
|
|
3829
|
-
"--lilt-observation-color": e.color || ae ||
|
|
3864
|
+
"--lilt-observation-color": e.color || ae || nr(0)
|
|
3830
3865
|
}
|
|
3831
3866
|
}, `departing-${e.id}`)),
|
|
3832
3867
|
N ? null : B.marks.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
@@ -3844,7 +3879,7 @@ function ir({ title: e, header: t = !0, data: n, height: r = 260, depth: i = !1,
|
|
|
3844
3879
|
top: e.y,
|
|
3845
3880
|
width: e.width,
|
|
3846
3881
|
height: e.height,
|
|
3847
|
-
"--lilt-observation-color": e.color || ae ||
|
|
3882
|
+
"--lilt-observation-color": e.color || ae || nr(0),
|
|
3848
3883
|
"--lilt-observation-delay": `${Math.min(t, 16) * 18}ms`,
|
|
3849
3884
|
"--lilt-observation-ripple": `${Math.round((e.x + e.y) / Math.max(1, Se + Ce) * 320)}ms`
|
|
3850
3885
|
},
|
|
@@ -3917,7 +3952,7 @@ function ir({ title: e, header: t = !0, data: n, height: r = 260, depth: i = !1,
|
|
|
3917
3952
|
}
|
|
3918
3953
|
//#endregion
|
|
3919
3954
|
//#region src/cards/treemap-chart-card.tsx
|
|
3920
|
-
function
|
|
3955
|
+
function or(e, t, n) {
|
|
3921
3956
|
if (!e.length) return [];
|
|
3922
3957
|
if (e.length === 1) return [{
|
|
3923
3958
|
item: e[0],
|
|
@@ -3937,17 +3972,17 @@ function ar(e, t, n) {
|
|
|
3937
3972
|
y: n.y + c.height,
|
|
3938
3973
|
height: n.height - c.height
|
|
3939
3974
|
};
|
|
3940
|
-
return [...
|
|
3975
|
+
return [...or(e.slice(0, i), t, c), ...or(e.slice(i), t, l)];
|
|
3941
3976
|
}
|
|
3942
|
-
function
|
|
3977
|
+
function sr(e, t, n, r, i, a, o) {
|
|
3943
3978
|
let s = /* @__PURE__ */ new Set(), c = e.map((e) => {
|
|
3944
|
-
let i = String(
|
|
3979
|
+
let i = String(rr(e, t) ?? ""), a = r ? String(rr(e, r) ?? "") : "";
|
|
3945
3980
|
return {
|
|
3946
3981
|
id: JSON.stringify([a, i]),
|
|
3947
3982
|
label: i,
|
|
3948
3983
|
group: a,
|
|
3949
3984
|
datum: e,
|
|
3950
|
-
value:
|
|
3985
|
+
value: ir(e, n)
|
|
3951
3986
|
};
|
|
3952
3987
|
});
|
|
3953
3988
|
for (let e of c) {
|
|
@@ -3968,11 +4003,11 @@ function or(e, t, n, r, i, a, o) {
|
|
|
3968
4003
|
let u = [...new Set(c.map((e) => e.group))].map((e, t) => ({
|
|
3969
4004
|
id: e,
|
|
3970
4005
|
label: e,
|
|
3971
|
-
color: o ??
|
|
4006
|
+
color: o ?? nr(t),
|
|
3972
4007
|
value: c.filter((t) => t.group === e).reduce((e, t) => e + (t.value ?? 0), 0),
|
|
3973
4008
|
rows: l.filter((t) => t.group === e)
|
|
3974
4009
|
})).filter((e) => e.rows.length), d = [], f = [];
|
|
3975
|
-
for (let e of
|
|
4010
|
+
for (let e of or(u, (e) => e.value, {
|
|
3976
4011
|
x: 0,
|
|
3977
4012
|
y: 0,
|
|
3978
4013
|
width: i,
|
|
@@ -3984,7 +4019,7 @@ function or(e, t, n, r, i, a, o) {
|
|
|
3984
4019
|
y: t.y + 14,
|
|
3985
4020
|
text: n.label.length > Math.floor(t.width / 7) ? `${n.label.slice(0, Math.max(1, Math.floor(t.width / 7) - 1))}…` : n.label
|
|
3986
4021
|
});
|
|
3987
|
-
let a =
|
|
4022
|
+
let a = or(n.rows, (e) => e.value, {
|
|
3988
4023
|
...t,
|
|
3989
4024
|
y: t.y + i,
|
|
3990
4025
|
height: t.height - i
|
|
@@ -3996,7 +4031,7 @@ function or(e, t, n, r, i, a, o) {
|
|
|
3996
4031
|
...t,
|
|
3997
4032
|
width: Math.max(0, t.width - i),
|
|
3998
4033
|
height: Math.max(0, t.height - i),
|
|
3999
|
-
color: r ? n.color : o ??
|
|
4034
|
+
color: r ? n.color : o ?? nr(c.indexOf(e)),
|
|
4000
4035
|
text: t.width > 55 && t.height > 26 ? e.label : void 0
|
|
4001
4036
|
});
|
|
4002
4037
|
}
|
|
@@ -4010,15 +4045,15 @@ function or(e, t, n, r, i, a, o) {
|
|
|
4010
4045
|
note: p ? `${p} ${p === 1 ? "tile has" : "tiles have"} zero or missing area; all readings remain in the accessible table.` : void 0
|
|
4011
4046
|
};
|
|
4012
4047
|
}
|
|
4013
|
-
function
|
|
4048
|
+
function cr({ label: e, value: t, group: n, color: r, ...i }) {
|
|
4014
4049
|
return /* @__PURE__ */ Q(me.Provider, {
|
|
4015
4050
|
value: "tiles",
|
|
4016
|
-
children: /* @__PURE__ */ Q(
|
|
4051
|
+
children: /* @__PURE__ */ Q(ar, {
|
|
4017
4052
|
...i,
|
|
4018
4053
|
color: r,
|
|
4019
4054
|
family: "treemap",
|
|
4020
|
-
layout: (i, a, o) =>
|
|
4021
|
-
placeholder: (e, t) =>
|
|
4055
|
+
layout: (i, a, o) => sr(i, e, t, n, a, o, r),
|
|
4056
|
+
placeholder: (e, t) => sr([
|
|
4022
4057
|
{
|
|
4023
4058
|
label: "A",
|
|
4024
4059
|
value: 32
|
|
@@ -4045,18 +4080,18 @@ function sr({ label: e, value: t, group: n, color: r, ...i }) {
|
|
|
4045
4080
|
}
|
|
4046
4081
|
//#endregion
|
|
4047
4082
|
//#region src/cards/calendar-heatmap-card.tsx
|
|
4048
|
-
var
|
|
4049
|
-
function
|
|
4083
|
+
var lr = 864e5;
|
|
4084
|
+
function ur(e) {
|
|
4050
4085
|
if (!(e instanceof Date) && typeof e != "string" && typeof e != "number") return null;
|
|
4051
4086
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : Date.parse(e);
|
|
4052
4087
|
if (!Number.isFinite(t) || !Number.isFinite(new Date(t).getTime())) return null;
|
|
4053
|
-
let n = Math.floor(t /
|
|
4088
|
+
let n = Math.floor(t / lr) * lr;
|
|
4054
4089
|
return typeof e == "string" && /^\d{4}-\d{2}-\d{2}$/.test(e) && new Date(n).toISOString().slice(0, 10) !== e ? null : n;
|
|
4055
4090
|
}
|
|
4056
|
-
function
|
|
4091
|
+
function dr(e, t, n, r, i, a = {}) {
|
|
4057
4092
|
let o = /* @__PURE__ */ new Map();
|
|
4058
4093
|
for (let r of e) {
|
|
4059
|
-
let e =
|
|
4094
|
+
let e = ur(rr(r, t));
|
|
4060
4095
|
if (e === null) return {
|
|
4061
4096
|
marks: [],
|
|
4062
4097
|
error: "Each calendar row needs a valid UTC date."
|
|
@@ -4067,15 +4102,15 @@ function ur(e, t, n, r, i, a = {}) {
|
|
|
4067
4102
|
};
|
|
4068
4103
|
o.set(e, {
|
|
4069
4104
|
datum: r,
|
|
4070
|
-
value:
|
|
4105
|
+
value: ir(r, n)
|
|
4071
4106
|
});
|
|
4072
4107
|
}
|
|
4073
|
-
let s = [...o.keys()], c = a.from === void 0 ? s.length ? Math.min(...s) : null :
|
|
4108
|
+
let s = [...o.keys()], c = a.from === void 0 ? s.length ? Math.min(...s) : null : ur(a.from), l = a.to === void 0 ? s.length ? Math.max(...s) : null : ur(a.to);
|
|
4074
4109
|
if (c === null || l === null) return {
|
|
4075
4110
|
marks: [],
|
|
4076
4111
|
...e.length || a.from !== void 0 || a.to !== void 0 ? { error: "Provide valid from and to dates." } : {}
|
|
4077
4112
|
};
|
|
4078
|
-
if (c > l || (l - c) /
|
|
4113
|
+
if (c > l || (l - c) / lr > 3660) return {
|
|
4079
4114
|
marks: [],
|
|
4080
4115
|
error: "Choose an ordered calendar range of at most ten years."
|
|
4081
4116
|
};
|
|
@@ -4083,7 +4118,7 @@ function ur(e, t, n, r, i, a = {}) {
|
|
|
4083
4118
|
marks: [],
|
|
4084
4119
|
error: "A date falls outside the calendar range; widen from and to."
|
|
4085
4120
|
};
|
|
4086
|
-
let u =
|
|
4121
|
+
let u = ur(a.today ?? Date.now());
|
|
4087
4122
|
if (u === null) return {
|
|
4088
4123
|
marks: [],
|
|
4089
4124
|
error: "today needs a valid UTC date."
|
|
@@ -4093,7 +4128,7 @@ function ur(e, t, n, r, i, a = {}) {
|
|
|
4093
4128
|
marks: [],
|
|
4094
4129
|
error: "domain must contain every value with a finite low end below its high end."
|
|
4095
4130
|
};
|
|
4096
|
-
let m = a.weekStartsOn ?? 1, h = (new Date(c).getUTCDay() - m + 7) % 7, g = Math.ceil(((l - c) /
|
|
4131
|
+
let m = a.weekStartsOn ?? 1, h = (new Date(c).getUTCDay() - m + 7) % 7, g = Math.ceil(((l - c) / lr + 1 + h) / 7), _ = Math.max(12, (r - 34 + 4) / g), v = Math.max(12, (i - 24 + 4) / 7), y = 34 + g * _ - 4, b = 24 + 7 * v - 4, x = [], ee = new Intl.DateTimeFormat(a.locale ?? "en-US", {
|
|
4097
4132
|
month: "short",
|
|
4098
4133
|
timeZone: "UTC"
|
|
4099
4134
|
}), te = new Intl.DateTimeFormat(a.locale ?? "en-US", {
|
|
@@ -4106,7 +4141,7 @@ function ur(e, t, n, r, i, a = {}) {
|
|
|
4106
4141
|
text: te.format(Date.UTC(2024, 0, 7 + (e + m) % 7))
|
|
4107
4142
|
});
|
|
4108
4143
|
let S = [], C = -Infinity;
|
|
4109
|
-
for (let e = c, t = 0; e <= l; e +=
|
|
4144
|
+
for (let e = c, t = 0; e <= l; e += lr, t++) {
|
|
4110
4145
|
let n = new Date(e), r = Math.floor((h + t) / 7), i = (h + t) % 7, s = 34 + r * _;
|
|
4111
4146
|
(t === 0 || n.getUTCDate() === 1) && s - C >= 34 && (x.push({
|
|
4112
4147
|
x: s,
|
|
@@ -4123,7 +4158,7 @@ function ur(e, t, n, r, i, a = {}) {
|
|
|
4123
4158
|
y: 24 + i * v,
|
|
4124
4159
|
width: _ - 4,
|
|
4125
4160
|
height: v - 4,
|
|
4126
|
-
color: `color-mix(in oklab, ${a.color ??
|
|
4161
|
+
color: `color-mix(in oklab, ${a.color ?? nr(0)} ${l === null ? 0 : 12 + (l - f) / (p - f) * 83}%, var(--lilt-card-background, var(--lilt-surface)))`,
|
|
4127
4162
|
missing: l === null && !d,
|
|
4128
4163
|
future: d,
|
|
4129
4164
|
detail: d ? "Not yet observed" : void 0
|
|
@@ -4137,17 +4172,17 @@ function ur(e, t, n, r, i, a = {}) {
|
|
|
4137
4172
|
note: "Less → more color · Hatched: no data · Outline: future day"
|
|
4138
4173
|
};
|
|
4139
4174
|
}
|
|
4140
|
-
function
|
|
4141
|
-
let u =
|
|
4175
|
+
function fr({ date: e, value: t, from: n, to: r, weekStartsOn: i, today: a, domain: o, color: s, locale: c, ...l }) {
|
|
4176
|
+
let u = ur(n) ?? (ur(r) ?? Date.UTC(2024, 2, 31)) - 90 * lr, d = ur(r) ?? u + 90 * lr;
|
|
4142
4177
|
return /* @__PURE__ */ Q(me.Provider, {
|
|
4143
4178
|
value: "tiles",
|
|
4144
|
-
children: /* @__PURE__ */ Q(
|
|
4179
|
+
children: /* @__PURE__ */ Q(ar, {
|
|
4145
4180
|
...l,
|
|
4146
4181
|
color: s,
|
|
4147
4182
|
locale: c,
|
|
4148
4183
|
family: "calendar",
|
|
4149
4184
|
legend: !1,
|
|
4150
|
-
layout: (l, u, d) =>
|
|
4185
|
+
layout: (l, u, d) => dr(l, e, t, u, d, {
|
|
4151
4186
|
from: n,
|
|
4152
4187
|
to: r,
|
|
4153
4188
|
weekStartsOn: i,
|
|
@@ -4156,7 +4191,7 @@ function dr({ date: e, value: t, from: n, to: r, weekStartsOn: i, today: a, doma
|
|
|
4156
4191
|
color: s,
|
|
4157
4192
|
locale: c
|
|
4158
4193
|
}),
|
|
4159
|
-
placeholder: (e, t) =>
|
|
4194
|
+
placeholder: (e, t) => dr([], "", "", e, t, {
|
|
4160
4195
|
from: u,
|
|
4161
4196
|
to: Math.max(u, d),
|
|
4162
4197
|
today: d,
|
|
@@ -4167,14 +4202,14 @@ function dr({ date: e, value: t, from: n, to: r, weekStartsOn: i, today: a, doma
|
|
|
4167
4202
|
}
|
|
4168
4203
|
//#endregion
|
|
4169
4204
|
//#region src/cards/timeline-chart-card.tsx
|
|
4170
|
-
function
|
|
4171
|
-
if (typeof e == "string" &&
|
|
4205
|
+
function pr(e) {
|
|
4206
|
+
if (typeof e == "string" && ur(e.slice(0, 10)) === null) return null;
|
|
4172
4207
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" && /^\d{4}-\d{2}-\d{2}(?:T.*)?$/.test(e) ? Date.parse(e.includes("T") && !/(Z|[+-]\d{2}:\d{2})$/.test(e) ? `${e}Z` : e) : NaN;
|
|
4173
4208
|
return Number.isFinite(t) && Number.isFinite(new Date(t).getTime()) ? t : null;
|
|
4174
4209
|
}
|
|
4175
|
-
function
|
|
4210
|
+
function mr(e, t, n, r, i) {
|
|
4176
4211
|
let a = /* @__PURE__ */ new Set(), o = e.map((e, n) => {
|
|
4177
|
-
let r = String(
|
|
4212
|
+
let r = String(rr(e, t.label) ?? ""), a = t.id ? String(rr(e, t.id) ?? "") : r, o = pr(rr(e, t.start)), s = pr(rr(e, t.end));
|
|
4178
4213
|
return {
|
|
4179
4214
|
id: a,
|
|
4180
4215
|
label: r,
|
|
@@ -4182,8 +4217,8 @@ function pr(e, t, n, r, i) {
|
|
|
4182
4217
|
start: o,
|
|
4183
4218
|
end: s,
|
|
4184
4219
|
value: o === null || s === null ? null : s - o,
|
|
4185
|
-
lane: t.lane ? String(
|
|
4186
|
-
group: t.group ? String(
|
|
4220
|
+
lane: t.lane ? String(rr(e, t.lane) ?? "") : r,
|
|
4221
|
+
group: t.group ? String(rr(e, t.group) ?? "") : void 0,
|
|
4187
4222
|
index: n,
|
|
4188
4223
|
detail: o === null || s === null ? "No data" : `${i(o)} – ${i(s)}`
|
|
4189
4224
|
};
|
|
@@ -4217,7 +4252,7 @@ function pr(e, t, n, r, i) {
|
|
|
4217
4252
|
y: v + i * 32,
|
|
4218
4253
|
width: Math.max(2, o),
|
|
4219
4254
|
height: 22,
|
|
4220
|
-
color: t.color ??
|
|
4255
|
+
color: t.color ?? nr(n.group === void 0 ? e : d.indexOf(n.group)),
|
|
4221
4256
|
shape: "bar",
|
|
4222
4257
|
text: o > 60 ? n.label : void 0
|
|
4223
4258
|
});
|
|
@@ -4248,13 +4283,13 @@ function pr(e, t, n, r, i) {
|
|
|
4248
4283
|
groups: d.length ? d.map((e, n) => ({
|
|
4249
4284
|
id: e,
|
|
4250
4285
|
label: e,
|
|
4251
|
-
color: t.color ??
|
|
4286
|
+
color: t.color ?? nr(n),
|
|
4252
4287
|
value: s.filter((t) => t.group === e).reduce((e, t) => e + t.value, 0)
|
|
4253
4288
|
})) : void 0,
|
|
4254
4289
|
note: o.length > s.length ? `${o.length - s.length} intervals are missing endpoints and are not plotted.` : "Times in UTC · Overlapping intervals occupy separate rows"
|
|
4255
4290
|
};
|
|
4256
4291
|
}
|
|
4257
|
-
function
|
|
4292
|
+
function hr({ label: e, id: t, start: n, end: r, lane: i, group: a, color: o, formatTime: s, locale: c, formatValue: l, aggregate: u = "sum", ...d }) {
|
|
4258
4293
|
let f = new Intl.DateTimeFormat(c ?? "en-US", {
|
|
4259
4294
|
month: "short",
|
|
4260
4295
|
day: "numeric",
|
|
@@ -4265,14 +4300,14 @@ function mr({ label: e, id: t, start: n, end: r, lane: i, group: a, color: o, fo
|
|
|
4265
4300
|
}), p = new Intl.NumberFormat(c ?? "en-US", { maximumFractionDigits: 1 }), m = s ?? ((e) => f.format(e));
|
|
4266
4301
|
return /* @__PURE__ */ Q(me.Provider, {
|
|
4267
4302
|
value: "rows",
|
|
4268
|
-
children: /* @__PURE__ */ Q(
|
|
4303
|
+
children: /* @__PURE__ */ Q(ar, {
|
|
4269
4304
|
...d,
|
|
4270
4305
|
locale: c,
|
|
4271
4306
|
aggregate: u,
|
|
4272
4307
|
formatValue: l ?? ((e) => `${p.format(e / 36e5)} h`),
|
|
4273
4308
|
color: o,
|
|
4274
4309
|
family: "timeline",
|
|
4275
|
-
layout: (s, c, l) =>
|
|
4310
|
+
layout: (s, c, l) => mr(s, {
|
|
4276
4311
|
label: e,
|
|
4277
4312
|
id: t,
|
|
4278
4313
|
start: n,
|
|
@@ -4307,7 +4342,7 @@ function mr({ label: e, id: t, start: n, end: r, lane: i, group: a, color: o, fo
|
|
|
4307
4342
|
}
|
|
4308
4343
|
//#endregion
|
|
4309
4344
|
//#region src/cards/strip-chart-card.tsx
|
|
4310
|
-
function
|
|
4345
|
+
function gr(e, t) {
|
|
4311
4346
|
let n = [];
|
|
4312
4347
|
for (let r = 0; r < e.length; r++) {
|
|
4313
4348
|
let i = n.flatMap((n, i) => {
|
|
@@ -4325,18 +4360,18 @@ function hr(e, t) {
|
|
|
4325
4360
|
}
|
|
4326
4361
|
return n;
|
|
4327
4362
|
}
|
|
4328
|
-
function
|
|
4363
|
+
function _r(e) {
|
|
4329
4364
|
let t = 2166136261;
|
|
4330
4365
|
for (let n = 0; n < e.length; n++) t = Math.imul(t ^ e.charCodeAt(n), 16777619);
|
|
4331
4366
|
return (t >>> 0) % 1e3 / 999 - .5;
|
|
4332
4367
|
}
|
|
4333
|
-
function
|
|
4368
|
+
function vr(e, t, n, r, i, a, o, s, c, l) {
|
|
4334
4369
|
let u = e.map((e, i) => ({
|
|
4335
|
-
id: String(r ?
|
|
4336
|
-
label: r ? String(
|
|
4337
|
-
group: String(
|
|
4370
|
+
id: String(r ? rr(e, r) ?? "" : i),
|
|
4371
|
+
label: r ? String(rr(e, r) ?? "") : `Point ${i + 1}`,
|
|
4372
|
+
group: String(rr(e, t) ?? ""),
|
|
4338
4373
|
datum: e,
|
|
4339
|
-
value:
|
|
4374
|
+
value: ir(e, n)
|
|
4340
4375
|
})), d = /* @__PURE__ */ new Set();
|
|
4341
4376
|
for (let e of u) {
|
|
4342
4377
|
if (!e.id.trim() || d.has(e.id)) return {
|
|
@@ -4352,7 +4387,7 @@ function _r(e, t, n, r, i, a, o, s, c, l) {
|
|
|
4352
4387
|
};
|
|
4353
4388
|
let p = [...new Set(u.map((e) => e.group))], m = Math.max(260, i), h = Math.min(100, m * .27), g = Math.max(2, Math.min(12, Number.isFinite(s) ? s : 4)), _ = f.map((e) => e.value), v = Math.min(..._), y = Math.max(..._), b = rt().domain(v === y ? [v - 1, y + 1] : [v, y]).nice().range([h + g + 3, m - g - 10]), x = [], ee = [], te = 4;
|
|
4354
4389
|
for (let [e, t] of p.entries()) {
|
|
4355
|
-
let n = f.filter((e) => e.group === t).sort((e, t) => e.value - t.value || e.id.localeCompare(t.id)), r = n.map((e) => b(e.value)), i = o === "beeswarm" ?
|
|
4390
|
+
let n = f.filter((e) => e.group === t).sort((e, t) => e.value - t.value || e.id.localeCompare(t.id)), r = n.map((e) => b(e.value)), i = o === "beeswarm" ? gr(r, g * 2 + 1.5) : n.map((e) => _r(e.id) * 28), s = Math.max(16, ...i.map((e) => Math.abs(e) + g)), c = Math.max(s * 2 + 16, (a - 32) / p.length), u = te + c / 2;
|
|
4356
4391
|
ee.push({
|
|
4357
4392
|
x: h - 8,
|
|
4358
4393
|
y: u + 4,
|
|
@@ -4365,7 +4400,7 @@ function _r(e, t, n, r, i, a, o, s, c, l) {
|
|
|
4365
4400
|
y: u + i[a] - g,
|
|
4366
4401
|
width: g * 2,
|
|
4367
4402
|
height: g * 2,
|
|
4368
|
-
color: l ??
|
|
4403
|
+
color: l ?? nr(e),
|
|
4369
4404
|
shape: "dot"
|
|
4370
4405
|
})), te += c;
|
|
4371
4406
|
}
|
|
@@ -4385,11 +4420,11 @@ function _r(e, t, n, r, i, a, o, s, c, l) {
|
|
|
4385
4420
|
note: f.length < u.length ? `${u.length - f.length} ${u.length - f.length === 1 ? "point is" : "points are"} missing a value and not plotted.` : void 0
|
|
4386
4421
|
};
|
|
4387
4422
|
}
|
|
4388
|
-
function
|
|
4423
|
+
function yr({ category: e, value: t, label: n, display: r = "strip", radius: i = 4, color: a, locale: o, valueFormat: s, formatValue: c, aggregate: l = "mean", ...u }) {
|
|
4389
4424
|
let d = c ?? new Intl.NumberFormat(o ?? "en-US", s ?? { maximumFractionDigits: 2 }).format;
|
|
4390
4425
|
return /* @__PURE__ */ Q(me.Provider, {
|
|
4391
4426
|
value: "points",
|
|
4392
|
-
children: /* @__PURE__ */ Q(
|
|
4427
|
+
children: /* @__PURE__ */ Q(ar, {
|
|
4393
4428
|
...u,
|
|
4394
4429
|
color: a,
|
|
4395
4430
|
locale: o,
|
|
@@ -4398,14 +4433,14 @@ function vr({ category: e, value: t, label: n, display: r = "strip", radius: i =
|
|
|
4398
4433
|
aggregate: l,
|
|
4399
4434
|
family: "strip",
|
|
4400
4435
|
legend: !1,
|
|
4401
|
-
layout: (o, s, c) =>
|
|
4436
|
+
layout: (o, s, c) => vr(o, e, t, n, s, c, r, i, d, a),
|
|
4402
4437
|
placeholder: (e, t) => ({ marks: Array.from({ length: 30 }, (n, r) => ({
|
|
4403
4438
|
id: String(r),
|
|
4404
4439
|
label: "",
|
|
4405
4440
|
datum: null,
|
|
4406
4441
|
value: null,
|
|
4407
4442
|
x: 80 + r * 37 % 97 / 100 * (e - 100),
|
|
4408
|
-
y: 32 + Math.floor(r / 10) * ((t - 65) / 3) +
|
|
4443
|
+
y: 32 + Math.floor(r / 10) * ((t - 65) / 3) + _r(String(r)) * 20,
|
|
4409
4444
|
width: 8,
|
|
4410
4445
|
height: 8,
|
|
4411
4446
|
color: "",
|
|
@@ -4416,7 +4451,7 @@ function vr({ category: e, value: t, label: n, display: r = "strip", radius: i =
|
|
|
4416
4451
|
}
|
|
4417
4452
|
//#endregion
|
|
4418
4453
|
//#region src/engine/scatter.ts
|
|
4419
|
-
function
|
|
4454
|
+
function br(e, t, n, r, i = !1) {
|
|
4420
4455
|
if (!i) {
|
|
4421
4456
|
let r = null, i = Infinity;
|
|
4422
4457
|
for (let a of e) {
|
|
@@ -4436,7 +4471,7 @@ function yr(e, t, n, r, i = !1) {
|
|
|
4436
4471
|
}
|
|
4437
4472
|
//#endregion
|
|
4438
4473
|
//#region src/cards/scatter-chart-card.tsx
|
|
4439
|
-
var
|
|
4474
|
+
var xr = [], Sr = 260, Cr = 4, wr = 4.5, Tr = 3, Er = [
|
|
4440
4475
|
[
|
|
4441
4476
|
.08,
|
|
4442
4477
|
.72,
|
|
@@ -4498,7 +4533,7 @@ var br = [], xr = 260, Sr = 4, Cr = 4.5, wr = 3, Tr = [
|
|
|
4498
4533
|
9
|
|
4499
4534
|
]
|
|
4500
4535
|
];
|
|
4501
|
-
function
|
|
4536
|
+
function Dr(e, t = 5) {
|
|
4502
4537
|
if (!e.length) return [0, 1];
|
|
4503
4538
|
let [n, r] = at(e);
|
|
4504
4539
|
if (n >= 0 && n <= r * .25 && (n = 0), n === r) {
|
|
@@ -4508,7 +4543,7 @@ function Er(e, t = 5) {
|
|
|
4508
4543
|
let [i, a] = rt().domain([n, r]).nice(t).domain();
|
|
4509
4544
|
return [i, a];
|
|
4510
4545
|
}
|
|
4511
|
-
function
|
|
4546
|
+
function Or(e) {
|
|
4512
4547
|
if (e.length < 3) return null;
|
|
4513
4548
|
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;
|
|
4514
4549
|
for (let { x: t, y: s } of e) i += (t - n) ** 2, a += (t - n) * (s - r), o += (s - r) ** 2;
|
|
@@ -4520,8 +4555,8 @@ function Dr(e) {
|
|
|
4520
4555
|
r2: o === 0 ? 1 : a * a / (i * o)
|
|
4521
4556
|
};
|
|
4522
4557
|
}
|
|
4523
|
-
var
|
|
4524
|
-
function
|
|
4558
|
+
var kr = (e, t, n) => `${e} ${e === 1 ? t : n}`, Ar = (e, t) => t === void 0 ? void 0 : e[t], jr = (e) => typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
4559
|
+
function Mr(e, [t, n], [r, i]) {
|
|
4525
4560
|
let a = (t) => e.slope * t + e.intercept, o = t, s = n;
|
|
4526
4561
|
if (e.slope !== 0) {
|
|
4527
4562
|
let t = (r - e.intercept) / e.slope, n = (i - e.intercept) / e.slope;
|
|
@@ -4534,28 +4569,28 @@ function jr(e, [t, n], [r, i]) {
|
|
|
4534
4569
|
a(s)
|
|
4535
4570
|
];
|
|
4536
4571
|
}
|
|
4537
|
-
function
|
|
4572
|
+
function Nr({ title: e, header: t = !0, "aria-label": n = e || "Scatter chart", data: r, x: i, y: a, size: o, sizeLabel: s, group: c, label: l, xLabel: u, yLabel: f, trend: p = !1, depth: m = !1, height: h = Sr, aggregate: g = "sum", headline: _, delta: v, deltaTone: y, range: b, ranges: x, defaultRange: te, valueFormat: S, legend: ne = "tiles", legendSwatch: ie, xFormat: ae, locale: w = "en-US", formatValue: oe, formatX: T, color: se, surface: E = "elevated", badge: D, numberStyle: O, palette: k, loading: A = !1, loadingStyle: j = "shimmer", empty: M = "dots", motion: N = "auto", className: P, style: I }) {
|
|
4538
4573
|
let L = Te(N), R = re(A, L), le = A || R, ue = he({
|
|
4539
4574
|
valueFormat: S,
|
|
4540
4575
|
locale: w,
|
|
4541
4576
|
formatValue: oe
|
|
4542
|
-
}), B = JSON.stringify(ae ?? null), V = Qe(() => F(w, ae), [w, B]), U = T ?? V.full, [pe, me] = X(te ?? x?.[0]?.id), W = x?.find((e) => e.id === pe) ?? x?.[0], G = W?.data ?? r ??
|
|
4577
|
+
}), B = JSON.stringify(ae ?? null), V = Qe(() => F(w, ae), [w, B]), U = T ?? V.full, [pe, me] = X(te ?? x?.[0]?.id), W = x?.find((e) => e.id === pe) ?? x?.[0], G = W?.data ?? r ?? xr, ge = W ? W.delta : v, { ref: _e, width: ve } = ee(), K = ve || 480, q = Qe(() => {
|
|
4543
4578
|
let e = [], t = G.map((e) => {
|
|
4544
|
-
let t =
|
|
4579
|
+
let t = Ar(e, l);
|
|
4545
4580
|
return typeof t == "string" && t ? t : null;
|
|
4546
4581
|
}), n = (e) => e !== null && t.indexOf(e) === t.lastIndexOf(e);
|
|
4547
4582
|
return {
|
|
4548
4583
|
rows: G.map((r, s) => {
|
|
4549
|
-
let l = c === void 0 ? null : String(
|
|
4584
|
+
let l = c === void 0 ? null : String(Ar(r, c) ?? "");
|
|
4550
4585
|
l !== null && !e.includes(l) && e.push(l);
|
|
4551
4586
|
let u = t[s];
|
|
4552
4587
|
return {
|
|
4553
4588
|
id: n(u) ? u : `${u ?? ""}\u0000${s}`,
|
|
4554
4589
|
label: u ?? `Point ${s + 1}`,
|
|
4555
4590
|
row: r,
|
|
4556
|
-
x: Ar(
|
|
4557
|
-
y: Ar(
|
|
4558
|
-
size: o === void 0 ? 1 : Ar(
|
|
4591
|
+
x: jr(Ar(r, i)),
|
|
4592
|
+
y: jr(Ar(r, a)),
|
|
4593
|
+
size: o === void 0 ? 1 : jr(Ar(r, o)),
|
|
4559
4594
|
group: l
|
|
4560
4595
|
};
|
|
4561
4596
|
}),
|
|
@@ -4568,25 +4603,29 @@ function Mr({ title: e, header: t = !0, "aria-label": n = e || "Scatter chart",
|
|
|
4568
4603
|
o,
|
|
4569
4604
|
c,
|
|
4570
4605
|
l
|
|
4571
|
-
]), ye = q.rows.filter((e) => e.x !== null && e.y !== null), J = q.rows.length - ye.length, [Y, be] = X([]), xe = ye.filter((e) => e.group === null || !Y.includes(e.group)), Se = (e) => e === null ? "var(--lilt-scatter-card-color, var(--lilt-series-1))" : `var(--lilt-series-${q.groups.indexOf(e) % 6 + 1})`, Ce = K < 420 ? 3 : 5, we =
|
|
4606
|
+
]), ye = q.rows.filter((e) => e.x !== null && e.y !== null), J = q.rows.length - ye.length, [Y, be] = X([]), xe = ye.filter((e) => e.group === null || !Y.includes(e.group)), Se = (e) => e === null ? "var(--lilt-scatter-card-color, var(--lilt-series-1))" : `var(--lilt-series-${q.groups.indexOf(e) % 6 + 1})`, Ce = K < 420 ? 3 : 5, we = Dr(ye.map((e) => e.x), Ce), Ee = Dr(ye.map((e) => e.y), Cr), De = rt().domain(Ee).ticks(Cr), Oe = rt().domain(we).ticks(Ce), Ne = Math.max(8, Math.min(16, K / 36)), Le = Math.max(24, ...De.map((e) => ue.axis(e).length * 6.6 + 10)), Re = o === void 0 ? 6.5 : Ne, ze = (f ? 26 : 10) + Re, Be = h - 26 - (u ? 16 : 0) - Re, Ve = Le + Re, He = K - Re - 2, Ue = rt().domain(we).range([Ve, He]), We = rt().domain(Ee).range([Be, ze]), Ge = Math.max(1, ...ye.map((e) => e.size ?? 0)), Ke = (e) => o === void 0 ? wr : Tr + (Ne - Tr) * Math.sqrt(Math.max(0, e ?? 0) / Ge), qe = [...xe].sort((e, t) => e.x - t.x || e.y - t.y).map((e, t) => ({
|
|
4572
4607
|
...e,
|
|
4573
4608
|
cx: Ue(e.x),
|
|
4574
4609
|
cy: We(e.y),
|
|
4575
4610
|
radius: Ke(e.size),
|
|
4576
4611
|
color: Se(e.group),
|
|
4577
4612
|
order: t
|
|
4578
|
-
})), Ye =
|
|
4613
|
+
})), Ye = er(qe, (e) => e.id, 420), Ze = p ? Or(xe) : null, $e = Ze && qe.length ? Mr(Ze, [qe[0].x, qe.at(-1).x], Ee) : null, et = V.plain, [tt, nt] = X(null), [it, at] = X(null), [ot, st] = X(null), [ct, lt] = X(null), [ut, dt] = X(null), ft = (e) => qe.find((t) => t.id === e), pt = `lilt-scatter-${Xe().replace(/:/g, "")}`, mt = [...new Set(qe.map((e) => e.color))], ht = ft(it) ?? ft(ot) ?? ft(tt), gt = ht ? null : ut ?? ct, _t = q.groups.map((e) => ({
|
|
4579
4614
|
name: e,
|
|
4580
4615
|
value: de(ye.filter((t) => t.group === e).map((e) => e.y), g)
|
|
4581
4616
|
})), vt = W?.headline ?? _ ?? de(xe.map((e) => e.y), g), yt = ht ? ht.y : gt === null ? vt : _t.find((e) => e.name === gt)?.value ?? null, bt = (e) => u ? `${u} ${U(e)}` : U(e), xt = (e) => `${e.label}: ${bt(e.x)}, ${f ? `${f} ` : ""}${ue.value(e.y)}${o === void 0 || e.size === null ? "" : `, ${s ?? "size"} ${et(e.size)}`}`, St = (e, t, n) => {
|
|
4582
4617
|
let r = n.getBoundingClientRect();
|
|
4583
|
-
return
|
|
4618
|
+
return br(qe, e - r.left, t - r.top, it);
|
|
4584
4619
|
}, Ct = (e) => {
|
|
4585
4620
|
e.pointerType !== "touch" && nt(St(e.clientX, e.clientY, e.currentTarget));
|
|
4586
|
-
}, wt =
|
|
4621
|
+
}, wt = Ht({
|
|
4587
4622
|
resolve: St,
|
|
4588
4623
|
onGlide: nt,
|
|
4589
4624
|
onLift: (e) => e !== null && at(e),
|
|
4625
|
+
pinned: it !== null || ut !== null,
|
|
4626
|
+
onRelease: () => {
|
|
4627
|
+
at(null), dt(null);
|
|
4628
|
+
},
|
|
4590
4629
|
onTap: (e) => at((t) => e && t !== e ? e : null),
|
|
4591
4630
|
disabled: A
|
|
4592
4631
|
}), Tt = Je((e) => {
|
|
@@ -4602,7 +4641,7 @@ function Mr({ title: e, header: t = !0, "aria-label": n = e || "Scatter chart",
|
|
|
4602
4641
|
e.preventDefault(), at((e) => e === t.id ? null : t.id);
|
|
4603
4642
|
return;
|
|
4604
4643
|
} else if (e.key === "Escape") {
|
|
4605
|
-
at(null), st(null);
|
|
4644
|
+
e.preventDefault(), at(null), st(null);
|
|
4606
4645
|
return;
|
|
4607
4646
|
} else return;
|
|
4608
4647
|
e.preventDefault(), st(qe[Math.max(0, Math.min(qe.length - 1, r))].id);
|
|
@@ -4660,7 +4699,7 @@ function Mr({ title: e, header: t = !0, "aria-label": n = e || "Scatter chart",
|
|
|
4660
4699
|
"data-active": ht ? "" : void 0,
|
|
4661
4700
|
tabIndex: le ? void 0 : 0,
|
|
4662
4701
|
role: "group",
|
|
4663
|
-
"aria-label": `${n}: ${
|
|
4702
|
+
"aria-label": `${n}: ${kr(qe.length, "point", "points")}. Arrow keys step through them in order of ${u ?? "x"}; Enter pins one.`,
|
|
4664
4703
|
onPointerMove: le ? void 0 : Ct,
|
|
4665
4704
|
onPointerLeave: () => nt(null),
|
|
4666
4705
|
onClick: () => at((e) => tt && e !== tt ? tt : null),
|
|
@@ -4722,13 +4761,13 @@ function Mr({ title: e, header: t = !0, "aria-label": n = e || "Scatter chart",
|
|
|
4722
4761
|
/* @__PURE__ */ Q(C, {
|
|
4723
4762
|
leaving: R,
|
|
4724
4763
|
origin: "bottom",
|
|
4725
|
-
children: /* @__PURE__ */ Q("g", { children: A ? /* @__PURE__ */ $(
|
|
4764
|
+
children: /* @__PURE__ */ Q("g", { children: A ? /* @__PURE__ */ $(Zt, {
|
|
4726
4765
|
width: K,
|
|
4727
4766
|
height: h,
|
|
4728
4767
|
reduced: L,
|
|
4729
4768
|
loadingStyle: j,
|
|
4730
4769
|
depth: m,
|
|
4731
|
-
mask:
|
|
4770
|
+
mask: Er.map(([e, t, n], r) => /* @__PURE__ */ Q("circle", {
|
|
4732
4771
|
cx: Ve + (He - Ve) * e,
|
|
4733
4772
|
cy: ze + (Be - ze) * t,
|
|
4734
4773
|
r: o === void 0 ? 5.5 : n,
|
|
@@ -4736,7 +4775,7 @@ function Mr({ title: e, header: t = !0, "aria-label": n = e || "Scatter chart",
|
|
|
4736
4775
|
}, r)),
|
|
4737
4776
|
children: [m ? /* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(H, {
|
|
4738
4777
|
id: `${pt}-loading`,
|
|
4739
|
-
color:
|
|
4778
|
+
color: Yt
|
|
4740
4779
|
}), /* @__PURE__ */ Q(ce, {
|
|
4741
4780
|
id: `${pt}-loading-shadow`,
|
|
4742
4781
|
size: 2.2,
|
|
@@ -4748,7 +4787,7 @@ function Mr({ title: e, header: t = !0, "aria-label": n = e || "Scatter chart",
|
|
|
4748
4787
|
}
|
|
4749
4788
|
})] }) : null, /* @__PURE__ */ Q("g", {
|
|
4750
4789
|
filter: m ? `url(#${pt}-loading-shadow)` : void 0,
|
|
4751
|
-
children:
|
|
4790
|
+
children: Er.map(([e, t, n], r) => /* @__PURE__ */ Q("g", {
|
|
4752
4791
|
"data-skeleton": "pop",
|
|
4753
4792
|
style: { "--lilt-skeleton-step": e * 12 },
|
|
4754
4793
|
children: /* @__PURE__ */ Q("circle", {
|
|
@@ -4880,7 +4919,7 @@ function Mr({ title: e, header: t = !0, "aria-label": n = e || "Scatter chart",
|
|
|
4880
4919
|
}) : null,
|
|
4881
4920
|
!A && (Ze || J) ? /* @__PURE__ */ $("div", {
|
|
4882
4921
|
className: "lilt-scatter-card__footer",
|
|
4883
|
-
children: [J ? /* @__PURE__ */ $("span", { children: [
|
|
4922
|
+
children: [J ? /* @__PURE__ */ $("span", { children: [kr(J, "point is", "points are"), " missing a value and not plotted"] }) : null, Ze ? /* @__PURE__ */ $("span", {
|
|
4884
4923
|
className: "lilt-scatter-card__fit",
|
|
4885
4924
|
children: [
|
|
4886
4925
|
/* @__PURE__ */ Q("span", {
|
|
@@ -4935,7 +4974,7 @@ function Mr({ title: e, header: t = !0, "aria-label": n = e || "Scatter chart",
|
|
|
4935
4974
|
}
|
|
4936
4975
|
//#endregion
|
|
4937
4976
|
//#region src/engine/sankey.ts
|
|
4938
|
-
function
|
|
4977
|
+
function Pr(e, t, n) {
|
|
4939
4978
|
let r = /* @__PURE__ */ new Set();
|
|
4940
4979
|
for (let t of e) {
|
|
4941
4980
|
if (!t.id || !t.label || r.has(t.id)) throw Error("Lilt SankeyChart requires unique nonempty node IDs and labels.");
|
|
@@ -4977,7 +5016,7 @@ function Nr(e, t, n) {
|
|
|
4977
5016
|
losses: d
|
|
4978
5017
|
};
|
|
4979
5018
|
}
|
|
4980
|
-
function
|
|
5019
|
+
function Fr(e, t, n, r = !1) {
|
|
4981
5020
|
if (!e.nodes.length) return {
|
|
4982
5021
|
nodes: [],
|
|
4983
5022
|
links: []
|
|
@@ -5022,7 +5061,7 @@ function Pr(e, t, n, r = !1) {
|
|
|
5022
5061
|
})
|
|
5023
5062
|
};
|
|
5024
5063
|
}
|
|
5025
|
-
function
|
|
5064
|
+
function Ir(e, t, n) {
|
|
5026
5065
|
let r = (e, t) => e + (t - e) * n, i = Math.max(0, Math.min(1, n)), a = new Map(e.nodes.map((e) => [e.id, e])), o = t.nodes.map((e) => {
|
|
5027
5066
|
let t = a.get(e.id);
|
|
5028
5067
|
return t ? {
|
|
@@ -5053,7 +5092,7 @@ function Fr(e, t, n) {
|
|
|
5053
5092
|
}
|
|
5054
5093
|
//#endregion
|
|
5055
5094
|
//#region src/cards/sankey-chart-card.tsx
|
|
5056
|
-
var
|
|
5095
|
+
var Lr = [], Rr = 280, zr = 460, Br = 6, Vr = [
|
|
5057
5096
|
[[.3, .32], [.68, .2]],
|
|
5058
5097
|
[
|
|
5059
5098
|
[.2, .22],
|
|
@@ -5065,7 +5104,7 @@ var Ir = [], Lr = 280, Rr = 460, zr = 6, Br = [
|
|
|
5065
5104
|
[.5, .22],
|
|
5066
5105
|
[.8, .16]
|
|
5067
5106
|
]
|
|
5068
|
-
],
|
|
5107
|
+
], Hr = [
|
|
5069
5108
|
[
|
|
5070
5109
|
0,
|
|
5071
5110
|
.22,
|
|
@@ -5102,14 +5141,14 @@ var Ir = [], Lr = 280, Rr = 460, zr = 6, Br = [
|
|
|
5102
5141
|
.8,
|
|
5103
5142
|
.15
|
|
5104
5143
|
]
|
|
5105
|
-
],
|
|
5106
|
-
function
|
|
5144
|
+
], Ur = 10, Wr = (e, t) => e[t];
|
|
5145
|
+
function Gr(e) {
|
|
5107
5146
|
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;
|
|
5108
5147
|
}
|
|
5109
|
-
function
|
|
5148
|
+
function Kr({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
5110
5149
|
let a = [], o = /* @__PURE__ */ new Set(), s = [], c = /* @__PURE__ */ new Set();
|
|
5111
5150
|
for (let i of e) {
|
|
5112
|
-
let e = String(
|
|
5151
|
+
let e = String(Wr(i, t) ?? "").trim(), l = String(Wr(i, n) ?? "").trim();
|
|
5113
5152
|
if (!e || !l) return {
|
|
5114
5153
|
graph: null,
|
|
5115
5154
|
error: "Every flow needs a source and a target."
|
|
@@ -5124,7 +5163,7 @@ function Gr({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
|
5124
5163
|
error: `${u} appears twice; combine it into one row.`
|
|
5125
5164
|
};
|
|
5126
5165
|
c.add(u);
|
|
5127
|
-
let d =
|
|
5166
|
+
let d = Wr(i, r);
|
|
5128
5167
|
s.push({
|
|
5129
5168
|
id: u,
|
|
5130
5169
|
source: e,
|
|
@@ -5135,23 +5174,23 @@ function Gr({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
|
5135
5174
|
}
|
|
5136
5175
|
try {
|
|
5137
5176
|
return {
|
|
5138
|
-
graph:
|
|
5177
|
+
graph: Pr(a, s, i === "strict" ? "strict" : "allow-loss"),
|
|
5139
5178
|
error: null
|
|
5140
5179
|
};
|
|
5141
5180
|
} catch (e) {
|
|
5142
5181
|
return {
|
|
5143
5182
|
graph: null,
|
|
5144
|
-
error:
|
|
5183
|
+
error: Gr(e instanceof Error ? e.message : "Invalid flows.")
|
|
5145
5184
|
};
|
|
5146
5185
|
}
|
|
5147
5186
|
}
|
|
5148
|
-
var
|
|
5149
|
-
function
|
|
5187
|
+
var qr = (e, t, n) => `${e} ${e === 1 ? t : n}`, Jr = (e, t) => t > 0 ? `${Math.round(e / t * 100)}%` : "—";
|
|
5188
|
+
function Yr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", data: r, source: i, target: a, value: o, conservation: s = "loss", depth: c = !1, height: l = Rr, headline: u, delta: f, deltaTone: p, range: m, ranges: h, defaultRange: g, valueFormat: _, locale: v, formatValue: y, surface: b = "elevated", badge: x, numberStyle: te, palette: S, loading: ie = !1, loadingStyle: ae = "shimmer", empty: oe = "dots", motion: T = "auto", className: se, style: E }) {
|
|
5150
5189
|
let D = Te(T), O = re(ie, D), ce = ie || O, k = he({
|
|
5151
5190
|
valueFormat: _,
|
|
5152
5191
|
locale: v,
|
|
5153
5192
|
formatValue: y
|
|
5154
|
-
}), [A, j] = X(g ?? h?.[0]?.id), M = h?.find((e) => e.id === A) ?? h?.[0], N = M?.data ?? r ??
|
|
5193
|
+
}), [A, j] = X(g ?? h?.[0]?.id), M = h?.find((e) => e.id === A) ?? h?.[0], N = M?.data ?? r ?? Lr, P = M ? M.delta : f, { ref: F, width: I } = ee(), L = I || 520, R = L < zr, le = `lilt-sankey-card-${Xe().replace(/:/g, "")}`, z = Qe(() => Kr({
|
|
5155
5194
|
data: N,
|
|
5156
5195
|
source: i,
|
|
5157
5196
|
target: a,
|
|
@@ -5163,7 +5202,7 @@ function Jr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", d
|
|
|
5163
5202
|
a,
|
|
5164
5203
|
o,
|
|
5165
5204
|
s
|
|
5166
|
-
]), B = z.graph, V = Qe(() => B ?
|
|
5205
|
+
]), B = z.graph, V = Qe(() => B ? Fr(B, L, l, R) : {
|
|
5167
5206
|
nodes: [],
|
|
5168
5207
|
links: []
|
|
5169
5208
|
}, [
|
|
@@ -5174,10 +5213,12 @@ function Jr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", d
|
|
|
5174
5213
|
]), H = new Map(B?.nodes.map((e, t) => [e.id, t]) ?? []), de = (e) => `var(--lilt-series-${(H.get(e) ?? 0) % 6 + 1})`, fe = Math.max(0, ...V.nodes.map((e) => e.depth)), pe = (e) => B?.links.filter((t) => t.target === e && t.value !== null).reduce((e, t) => e + t.value, 0) ?? 0, me = (e) => B?.links.filter((t) => t.source === e && t.value !== null).reduce((e, t) => e + t.value, 0) ?? 0, W = (e) => B?.links.some((t) => (t.source === e || t.target === e) && t.value !== null) ? Math.max(pe(e), me(e)) : null, ge = (e) => {
|
|
5175
5214
|
let t = W(e);
|
|
5176
5215
|
return t === null ? "—" : k.value(t);
|
|
5177
|
-
}, _e = V.nodes.filter((e) => e.depth === 0).reduce((e, t) => e + me(t.id), 0) || 0, ve = B?.links.filter((e) => e.value === null).length ?? 0, K = V.nodes.filter((e) => e.depth === 0).length, q = [...V.links].sort((e, t) => (V.nodes.find((t) => t.id === e.source)?.depth ?? 0) - (V.nodes.find((e) => e.id === t.source)?.depth ?? 0) || e.sourceY - t.sourceY), [ye, J] = X(null), [Y, be] = X(null), [xe, Se] = X(null), Ce = Y ?? xe ?? ye, we =
|
|
5178
|
-
resolve:
|
|
5216
|
+
}, _e = V.nodes.filter((e) => e.depth === 0).reduce((e, t) => e + me(t.id), 0) || 0, ve = B?.links.filter((e) => e.value === null).length ?? 0, K = V.nodes.filter((e) => e.depth === 0).length, q = [...V.links].sort((e, t) => (V.nodes.find((t) => t.id === e.source)?.depth ?? 0) - (V.nodes.find((e) => e.id === t.source)?.depth ?? 0) || e.sourceY - t.sourceY), [ye, J] = X(null), [Y, be] = X(null), [xe, Se] = X(null), Ce = Y ?? xe ?? ye, we = Ht({
|
|
5217
|
+
resolve: Vt,
|
|
5179
5218
|
onGlide: J,
|
|
5180
5219
|
onLift: (e) => e !== null && be(e),
|
|
5220
|
+
pinned: Y !== null,
|
|
5221
|
+
onRelease: () => be(null),
|
|
5181
5222
|
disabled: ie
|
|
5182
5223
|
}), De = Je((e) => {
|
|
5183
5224
|
F.current = e, we(e);
|
|
@@ -5206,12 +5247,12 @@ function Jr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", d
|
|
|
5206
5247
|
active: He.key > 0 && !ce,
|
|
5207
5248
|
duration: 600,
|
|
5208
5249
|
spring: !0
|
|
5209
|
-
}, D), Ge = ze < 1 ? { filter: `blur(${(8 * (1 - ze)).toFixed(2)}px)` } : void 0, Ke = He.key > 0 && We !== 1 ?
|
|
5250
|
+
}, D), Ge = ze < 1 ? { filter: `blur(${(8 * (1 - ze)).toFixed(2)}px)` } : void 0, Ke = He.key > 0 && We !== 1 ? Ir(He.from, He.to, We) : V;
|
|
5210
5251
|
Ye(() => {
|
|
5211
5252
|
Be.current = Ke;
|
|
5212
5253
|
});
|
|
5213
|
-
let qe = (e) => e === 0 ? 0 : e === 1 ? L / 2 -
|
|
5214
|
-
let o = qe(t) +
|
|
5254
|
+
let qe = (e) => e === 0 ? 0 : e === 1 ? L / 2 - Ur / 2 : L - Ur, Ze = (e) => /* @__PURE__ */ $(Z, { children: [Hr.map(([t, n, r, i], a) => {
|
|
5255
|
+
let o = qe(t) + Ur, s = qe(t + 1), c = (o + s) / 2, u = `M${o},${n * l} C${c},${n * l} ${c},${r * l} ${s},${r * l}`, d = { "--lilt-skeleton-step": t * 4 + 1.5 + a * .35 }, f = {
|
|
5215
5256
|
pathLength: 1,
|
|
5216
5257
|
strokeDasharray: 1
|
|
5217
5258
|
};
|
|
@@ -5222,7 +5263,7 @@ function Jr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", d
|
|
|
5222
5263
|
d: u,
|
|
5223
5264
|
fill: "none",
|
|
5224
5265
|
transform: e.transform,
|
|
5225
|
-
stroke: w(
|
|
5266
|
+
stroke: w(Yt, e.amount),
|
|
5226
5267
|
strokeWidth: e.strokeWidth,
|
|
5227
5268
|
"data-skeleton": "stroke",
|
|
5228
5269
|
...f
|
|
@@ -5235,22 +5276,22 @@ function Jr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", d
|
|
|
5235
5276
|
"data-skeleton": "stroke",
|
|
5236
5277
|
...f
|
|
5237
5278
|
}, a);
|
|
5238
|
-
}),
|
|
5279
|
+
}), Vr.flatMap((e, t) => e.map(([e, n], r) => /* @__PURE__ */ Q("rect", {
|
|
5239
5280
|
className: "lilt-sankey-card__skeleton-node",
|
|
5240
5281
|
"data-skeleton": "rise",
|
|
5241
5282
|
x: qe(t),
|
|
5242
5283
|
y: (e - n / 2) * l,
|
|
5243
|
-
width:
|
|
5284
|
+
width: Ur,
|
|
5244
5285
|
height: n * l,
|
|
5245
5286
|
rx: 3,
|
|
5246
5287
|
style: { "--lilt-skeleton-step": t * 4 + r * .4 }
|
|
5247
5288
|
}, `${t}-${r}`)))] }), et = M?.headline ?? u ?? _e, tt = null;
|
|
5248
|
-
if (Oe) et = Oe.value, tt = `${Oe.source} → ${Oe.target} · ${
|
|
5289
|
+
if (Oe) et = Oe.value, tt = `${Oe.source} → ${Oe.target} · ${Jr(Oe.value, W(Oe.source) ?? 0)} of ${Oe.source}`;
|
|
5249
5290
|
else if (Ne) {
|
|
5250
5291
|
let e = W(Ne.id), t = B?.losses[Ne.id];
|
|
5251
5292
|
et = e;
|
|
5252
5293
|
let n = Ne.depth === 0 && K === 1;
|
|
5253
|
-
tt = e === null ? `${Ne.label} · Not measured` : n || !_e ? Ne.label : `${Ne.label} · ${
|
|
5294
|
+
tt = e === null ? `${Ne.label} · Not measured` : n || !_e ? Ne.label : `${Ne.label} · ${Jr(e, _e)} of all`, t && (tt += ` · ${k.value(t)} left here`);
|
|
5254
5295
|
}
|
|
5255
5296
|
let nt = () => Oe ? `${Oe.source} to ${Oe.target}: ${k.value(Oe.value)}` : Ne ? `${Ne.label}: ${ge(Ne.id)}` : "", rt = (e) => {
|
|
5256
5297
|
if (!q.length) return;
|
|
@@ -5265,7 +5306,7 @@ function Jr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", d
|
|
|
5265
5306
|
be((e) => e === n ? null : n);
|
|
5266
5307
|
return;
|
|
5267
5308
|
} else if (e.key === "Escape") {
|
|
5268
|
-
be(null), Se(null);
|
|
5309
|
+
e.preventDefault(), be(null), Se(null);
|
|
5269
5310
|
return;
|
|
5270
5311
|
} else return;
|
|
5271
5312
|
e.preventDefault(), Se(q[Math.max(0, Math.min(q.length - 1, n))].id);
|
|
@@ -5317,7 +5358,7 @@ function Jr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", d
|
|
|
5317
5358
|
"data-active": Ce ? "" : void 0,
|
|
5318
5359
|
tabIndex: ce ? void 0 : 0,
|
|
5319
5360
|
role: "group",
|
|
5320
|
-
"aria-label": `${n}: ${
|
|
5361
|
+
"aria-label": `${n}: ${qr(V.links.length, "flow", "flows")} between ${qr(V.nodes.length, "step", "steps")}. Arrow keys step through the flows; Enter pins one.`,
|
|
5321
5362
|
onKeyDown: ce ? void 0 : rt,
|
|
5322
5363
|
onBlur: () => Se(null),
|
|
5323
5364
|
onPointerLeave: () => J(null),
|
|
@@ -5334,7 +5375,7 @@ function Jr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", d
|
|
|
5334
5375
|
width: L,
|
|
5335
5376
|
height: l,
|
|
5336
5377
|
viewBox: `0 0 ${L} ${l}`,
|
|
5337
|
-
children: ie ? /* @__PURE__ */ Q(
|
|
5378
|
+
children: ie ? /* @__PURE__ */ Q(Zt, {
|
|
5338
5379
|
width: L,
|
|
5339
5380
|
height: l,
|
|
5340
5381
|
reduced: D,
|
|
@@ -5397,7 +5438,7 @@ function Jr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", d
|
|
|
5397
5438
|
onClick: () => be((t) => t === e.id ? null : e.id)
|
|
5398
5439
|
};
|
|
5399
5440
|
if (c) {
|
|
5400
|
-
let i = ue(e.x, e.y, e.width +
|
|
5441
|
+
let i = ue(e.x, e.y, e.width + Br, n, Br), a = G(de(e.id));
|
|
5401
5442
|
return /* @__PURE__ */ $("g", {
|
|
5402
5443
|
className: "lilt-sankey-card__node",
|
|
5403
5444
|
"data-node": e.id,
|
|
@@ -5466,7 +5507,7 @@ function Jr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", d
|
|
|
5466
5507
|
!ie && ve ? /* @__PURE__ */ $("p", {
|
|
5467
5508
|
className: "lilt-sankey-card__footer",
|
|
5468
5509
|
children: [
|
|
5469
|
-
|
|
5510
|
+
qr(ve, "flow isn’t", "flows aren’t"),
|
|
5470
5511
|
" measured yet and",
|
|
5471
5512
|
" ",
|
|
5472
5513
|
ve === 1 ? "isn’t" : "aren’t",
|
|
@@ -5506,34 +5547,34 @@ function Jr({ title: e, header: t = !0, "aria-label": n = e || "Sankey chart", d
|
|
|
5506
5547
|
}
|
|
5507
5548
|
//#endregion
|
|
5508
5549
|
//#region src/cards/radar-chart-card.tsx
|
|
5509
|
-
var
|
|
5510
|
-
function
|
|
5511
|
-
if (e.length *
|
|
5550
|
+
var Xr = [], Zr = 300, Qr = 4, $r = 6.6;
|
|
5551
|
+
function ei(e, t) {
|
|
5552
|
+
if (e.length * $r <= t || !e.includes(" ")) return [e];
|
|
5512
5553
|
let n = e.length / 2, r = -1;
|
|
5513
5554
|
for (let t = 0; t < e.length; t++) e[t] === " " && (r < 0 || Math.abs(t - n) < Math.abs(r - n)) && (r = t);
|
|
5514
5555
|
return [e.slice(0, r), e.slice(r + 1)];
|
|
5515
5556
|
}
|
|
5516
|
-
var
|
|
5557
|
+
var ti = [
|
|
5517
5558
|
.72,
|
|
5518
5559
|
.58,
|
|
5519
5560
|
.84,
|
|
5520
5561
|
.5,
|
|
5521
5562
|
.66,
|
|
5522
5563
|
.78
|
|
5523
|
-
],
|
|
5524
|
-
function
|
|
5564
|
+
], ni = (e, t) => e[t], ri = (e) => typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
5565
|
+
function ii({ data: e, category: t, series: n, domain: r }) {
|
|
5525
5566
|
let i = (e) => ({
|
|
5526
5567
|
dimensions: [],
|
|
5527
5568
|
domain: [0, 1],
|
|
5528
5569
|
error: e
|
|
5529
5570
|
}), a = [], o = /* @__PURE__ */ new Set();
|
|
5530
5571
|
for (let r of e) {
|
|
5531
|
-
let e = String(
|
|
5572
|
+
let e = String(ni(r, t) ?? "").trim();
|
|
5532
5573
|
if (!e) return i("Every dimension needs a name.");
|
|
5533
5574
|
if (o.has(e)) return i(`“${e}” appears twice; each dimension needs one row.`);
|
|
5534
5575
|
o.add(e), a.push({
|
|
5535
5576
|
name: e,
|
|
5536
|
-
values: n.map((e) => ni(
|
|
5577
|
+
values: n.map((e) => ri(ni(r, e)))
|
|
5537
5578
|
});
|
|
5538
5579
|
}
|
|
5539
5580
|
if (a.length && a.length < 3) return i("A radar needs at least three dimensions to draw a shape.");
|
|
@@ -5544,30 +5585,30 @@ function ri({ data: e, category: t, series: n, domain: r }) {
|
|
|
5544
5585
|
domain: r,
|
|
5545
5586
|
error: null
|
|
5546
5587
|
} : i("`domain` needs a low end below its high end.");
|
|
5547
|
-
let c = Math.min(0, ...s), l = Math.max(c + 1, ...s), [u, d] = rt().domain([c, l]).nice(
|
|
5588
|
+
let c = Math.min(0, ...s), l = Math.max(c + 1, ...s), [u, d] = rt().domain([c, l]).nice(Qr).domain();
|
|
5548
5589
|
return {
|
|
5549
5590
|
dimensions: a,
|
|
5550
5591
|
domain: [u, d],
|
|
5551
5592
|
error: null
|
|
5552
5593
|
};
|
|
5553
5594
|
}
|
|
5554
|
-
var
|
|
5555
|
-
function
|
|
5595
|
+
var ai = (e) => Math.round(e * 100) / 100 || 0;
|
|
5596
|
+
function oi(e, t, n, r) {
|
|
5556
5597
|
let i = e / t * Math.PI * 2;
|
|
5557
5598
|
return {
|
|
5558
|
-
x:
|
|
5559
|
-
y:
|
|
5599
|
+
x: ai(Math.sin(i) * r * n),
|
|
5600
|
+
y: ai(-Math.cos(i) * r * n)
|
|
5560
5601
|
};
|
|
5561
5602
|
}
|
|
5562
|
-
function
|
|
5603
|
+
function si(e, t) {
|
|
5563
5604
|
let n = e.length, r = e.every((e) => e !== null), i = "";
|
|
5564
5605
|
if (e.forEach((r, a) => {
|
|
5565
5606
|
if (r === null) return;
|
|
5566
|
-
let { x: o, y: s } =
|
|
5607
|
+
let { x: o, y: s } = oi(a, n, r, t), c = e[(a - 1 + n) % n];
|
|
5567
5608
|
i += `${i && c !== null ? "L" : "M"}${o.toFixed(2)},${s.toFixed(2)} `;
|
|
5568
5609
|
}), r) i += "Z";
|
|
5569
5610
|
else if (e[0] !== null && e[n - 1] !== null) {
|
|
5570
|
-
let { x: r, y: a } =
|
|
5611
|
+
let { x: r, y: a } = oi(0, n, e[0], t);
|
|
5571
5612
|
i += `L${r.toFixed(2)},${a.toFixed(2)}`;
|
|
5572
5613
|
}
|
|
5573
5614
|
return {
|
|
@@ -5575,12 +5616,12 @@ function oi(e, t) {
|
|
|
5575
5616
|
complete: r
|
|
5576
5617
|
};
|
|
5577
5618
|
}
|
|
5578
|
-
function
|
|
5619
|
+
function ci({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", data: r, category: i, series: a, domain: o, aggregate: s = "mean", grid: c = "polygon", height: l = Zr, headline: u, delta: f, deltaTone: p, range: m, ranges: h, defaultRange: g, valueFormat: _, legend: v = "tiles", legendSwatch: y, locale: b, formatValue: x, surface: te = "elevated", badge: S, numberStyle: ie, palette: ae, loading: w = !1, loadingStyle: oe = "shimmer", empty: T = "dots", motion: se = "auto", className: E, style: D }) {
|
|
5579
5620
|
let O = Te(se), ce = re(w, O), k = w || ce, A = he({
|
|
5580
5621
|
valueFormat: _,
|
|
5581
5622
|
locale: b,
|
|
5582
5623
|
formatValue: x
|
|
5583
|
-
}), [j, M] = X(g ?? h?.[0]?.id), N = h?.find((e) => e.id === j) ?? h?.[0], P = N?.data ?? r ??
|
|
5624
|
+
}), [j, M] = X(g ?? h?.[0]?.id), N = h?.find((e) => e.id === j) ?? h?.[0], P = N?.data ?? r ?? Xr, F = N ? N.delta : f, { ref: I, width: L } = ee(), R = L || 480, le = a.map((e) => e.key), ue = le.join("\0"), B = Qe(() => ii({
|
|
5584
5625
|
data: P,
|
|
5585
5626
|
category: i,
|
|
5586
5627
|
series: le,
|
|
@@ -5590,8 +5631,8 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5590
5631
|
i,
|
|
5591
5632
|
ue,
|
|
5592
5633
|
o
|
|
5593
|
-
]), { dimensions: V, domain: H } = B, U = V.length, pe = H[1] - H[0], me = (e) => e === null ? null : (e - H[0]) / pe, W = (e) => a[e]?.color ?? `var(--lilt-series-${e % 6 + 1})`, G = (e) => a[e]?.label ?? le[e], ge = Math.max(0, a.findIndex((e) => !e.dashed)), _e = (e) => e.name + (e.values.some((e) => e === null) ? " · no data" : ""), ve = Math.min(Math.max(40, ...V.map((e) => _e(e).length *
|
|
5594
|
-
let { x: n, y: r } =
|
|
5634
|
+
]), { dimensions: V, domain: H } = B, U = V.length, pe = H[1] - H[0], me = (e) => e === null ? null : (e - H[0]) / pe, W = (e) => a[e]?.color ?? `var(--lilt-series-${e % 6 + 1})`, G = (e) => a[e]?.label ?? le[e], ge = Math.max(0, a.findIndex((e) => !e.dashed)), _e = (e) => e.name + (e.values.some((e) => e === null) ? " · no data" : ""), ve = Math.min(Math.max(40, ...V.map((e) => _e(e).length * $r)) + 14, R * .24), K = Math.max(40, Math.min((R - ve * 2) / 2, (l - 52) / 2)), q = Math.max(1, ...V.flatMap((e) => ei(_e(e), ve - 14).map((e) => e.length * $r))), ye = Math.max(10 / 12, Math.min(1, (ve - 14) / q)), J = R / 2, Y = l / 2, be = ti.map((e, t) => {
|
|
5635
|
+
let { x: n, y: r } = oi(t, ti.length, e, K);
|
|
5595
5636
|
return `${t ? "L" : "M"}${(J + n).toFixed(2)},${(Y + r).toFixed(2)}`;
|
|
5596
5637
|
}).join(" ") + " Z", xe = Ee({
|
|
5597
5638
|
key: "first",
|
|
@@ -5635,10 +5676,14 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5635
5676
|
return Math.round(o / (Math.PI * 2) * U) % U;
|
|
5636
5677
|
}, dt = (e) => {
|
|
5637
5678
|
e.pointerType !== "touch" && Ve(ut(e.clientX, e.clientY, e.currentTarget));
|
|
5638
|
-
}, ft =
|
|
5679
|
+
}, ft = Ht({
|
|
5639
5680
|
resolve: ut,
|
|
5640
5681
|
onGlide: Ve,
|
|
5641
5682
|
onLift: (e) => e !== null && Ue(e),
|
|
5683
|
+
pinned: He !== null || Xe !== null,
|
|
5684
|
+
onRelease: () => {
|
|
5685
|
+
Ue(null), Ze(null);
|
|
5686
|
+
},
|
|
5642
5687
|
onTap: (e) => Ue((t) => e !== null && t !== e ? e : null),
|
|
5643
5688
|
disabled: w
|
|
5644
5689
|
}), pt = Je((e) => {
|
|
@@ -5654,14 +5699,14 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5654
5699
|
e.preventDefault(), Ue((e) => e === t ? null : t);
|
|
5655
5700
|
return;
|
|
5656
5701
|
} else if (e.key === "Escape") {
|
|
5657
|
-
Ue(null), Ge(null);
|
|
5702
|
+
e.preventDefault(), Ue(null), Ge(null);
|
|
5658
5703
|
return;
|
|
5659
5704
|
} else return;
|
|
5660
5705
|
e.preventDefault(), Ge(n);
|
|
5661
5706
|
}, ht = (e) => c === "circle" ? null : V.map((t, n) => {
|
|
5662
|
-
let { x: r, y: i } =
|
|
5707
|
+
let { x: r, y: i } = oi(n, U, e, K);
|
|
5663
5708
|
return `${n ? "L" : "M"}${(J + r).toFixed(2)},${(Y + i).toFixed(2)}`;
|
|
5664
|
-
}).join(" ") + " Z", gt = !w && !B.error && V.length === 0, _t = V.some((e) => e.values.some((e) => e === null)), vt = Array.from({ length:
|
|
5709
|
+
}).join(" ") + " Z", gt = !w && !B.error && V.length === 0, _t = V.some((e) => e.values.some((e) => e === null)), vt = Array.from({ length: Qr }, (e, t) => (t + 1) / Qr);
|
|
5665
5710
|
return /* @__PURE__ */ $(Ie, {
|
|
5666
5711
|
motion: se,
|
|
5667
5712
|
className: ["lilt-radar-card", E].filter(Boolean).join(" "),
|
|
@@ -5727,7 +5772,7 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5727
5772
|
cy: Y,
|
|
5728
5773
|
r: K * e
|
|
5729
5774
|
}, e) : /* @__PURE__ */ Q("path", { d: ht(e) }, e)), k ? null : V.map((e, t) => {
|
|
5730
|
-
let n =
|
|
5775
|
+
let n = oi(t, U, 1, K);
|
|
5731
5776
|
return /* @__PURE__ */ Q("line", {
|
|
5732
5777
|
"data-active": t === et || void 0,
|
|
5733
5778
|
x1: J,
|
|
@@ -5739,7 +5784,7 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5739
5784
|
}), /* @__PURE__ */ Q(C, {
|
|
5740
5785
|
leaving: ce,
|
|
5741
5786
|
origin: "center",
|
|
5742
|
-
children: /* @__PURE__ */ Q("g", { children: w ? /* @__PURE__ */ $(
|
|
5787
|
+
children: /* @__PURE__ */ Q("g", { children: w ? /* @__PURE__ */ $(Zt, {
|
|
5743
5788
|
width: R,
|
|
5744
5789
|
height: l,
|
|
5745
5790
|
reduced: O,
|
|
@@ -5747,11 +5792,11 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5747
5792
|
children: [
|
|
5748
5793
|
/* @__PURE__ */ Q("path", {
|
|
5749
5794
|
className: "lilt-radar-card__skeleton-grid",
|
|
5750
|
-
d: [.5, 1].map((e) =>
|
|
5751
|
-
let { x: r, y: i } =
|
|
5795
|
+
d: [.5, 1].map((e) => ti.map((t, n) => {
|
|
5796
|
+
let { x: r, y: i } = oi(n, ti.length, e, K);
|
|
5752
5797
|
return `${n ? "L" : "M"}${(J + r).toFixed(2)},${(Y + i).toFixed(2)}`;
|
|
5753
|
-
}).join(" ") + " Z").concat(
|
|
5754
|
-
let { x: n, y: r } =
|
|
5798
|
+
}).join(" ") + " Z").concat(ti.map((e, t) => {
|
|
5799
|
+
let { x: n, y: r } = oi(t, ti.length, 1, K);
|
|
5755
5800
|
return `M${J},${Y} L${(J + n).toFixed(2)},${(Y + r).toFixed(2)}`;
|
|
5756
5801
|
})).join(" ")
|
|
5757
5802
|
}),
|
|
@@ -5760,7 +5805,7 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5760
5805
|
"data-skeleton": "bloom",
|
|
5761
5806
|
style: {
|
|
5762
5807
|
transformOrigin: `${J}px ${Y}px`,
|
|
5763
|
-
"--lilt-skeleton-step":
|
|
5808
|
+
"--lilt-skeleton-step": ti.length * .5 + 1
|
|
5764
5809
|
},
|
|
5765
5810
|
d: be
|
|
5766
5811
|
}),
|
|
@@ -5771,8 +5816,8 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5771
5816
|
strokeDasharray: 1,
|
|
5772
5817
|
d: be
|
|
5773
5818
|
}),
|
|
5774
|
-
|
|
5775
|
-
let { x: n, y: r } =
|
|
5819
|
+
ti.map((e, t) => {
|
|
5820
|
+
let { x: n, y: r } = oi(t, ti.length, e, K);
|
|
5776
5821
|
return /* @__PURE__ */ Q("circle", {
|
|
5777
5822
|
className: "lilt-radar-card__skeleton-vertex",
|
|
5778
5823
|
"data-skeleton": "pop",
|
|
@@ -5788,7 +5833,7 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5788
5833
|
className: "lilt-chart__axis",
|
|
5789
5834
|
children: vt.map((e) => {
|
|
5790
5835
|
if (K < 110 && e !== .5) return null;
|
|
5791
|
-
let { x: t, y: n } =
|
|
5836
|
+
let { x: t, y: n } = oi(.5, U, e, K);
|
|
5792
5837
|
return /* @__PURE__ */ Q("text", {
|
|
5793
5838
|
className: "lilt-radar-card__ring-label",
|
|
5794
5839
|
x: J + t,
|
|
@@ -5804,7 +5849,7 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5804
5849
|
"data-lilt-travel": Oe.key ? Oe.key % 2 : void 0,
|
|
5805
5850
|
style: Se < 1 ? { filter: `blur(${(8 * (1 - Se)).toFixed(2)}px)` } : void 0,
|
|
5806
5851
|
children: a.map((e, t) => {
|
|
5807
|
-
let { path: n, complete: r } =
|
|
5852
|
+
let { path: n, complete: r } = si(V.map((t) => Re(e.key, t.name)), K), i = nt !== null && nt !== e.key;
|
|
5808
5853
|
return /* @__PURE__ */ $("g", {
|
|
5809
5854
|
className: "lilt-radar-card__profile",
|
|
5810
5855
|
"data-series": e.key,
|
|
@@ -5824,7 +5869,7 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5824
5869
|
V.map((t, n) => {
|
|
5825
5870
|
let r = Re(e.key, t.name);
|
|
5826
5871
|
if (r === null) return null;
|
|
5827
|
-
let { x: i, y: a } =
|
|
5872
|
+
let { x: i, y: a } = oi(n, U, r, K);
|
|
5828
5873
|
return /* @__PURE__ */ Q("circle", {
|
|
5829
5874
|
className: "lilt-radar-card__vertex",
|
|
5830
5875
|
"data-active": n === et || void 0,
|
|
@@ -5838,7 +5883,7 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5838
5883
|
})
|
|
5839
5884
|
}),
|
|
5840
5885
|
V.map((e, t) => {
|
|
5841
|
-
let { x: n, y: r } =
|
|
5886
|
+
let { x: n, y: r } = oi(t, U, 1, K + 14), i = Math.abs(n) < 1 ? "middle" : n > 0 ? "start" : "end", a = e.values.some((e) => e === null), o = ei(_e(e), ve - 14), s = r < -1 ? -.2 - (o.length - 1) * 1.2 : r > 1 ? .9 : .35 - (o.length - 1) * 1.2 / 2;
|
|
5842
5887
|
return /* @__PURE__ */ Q("text", {
|
|
5843
5888
|
className: "lilt-radar-card__label",
|
|
5844
5889
|
"data-active": t === et || void 0,
|
|
@@ -5911,7 +5956,7 @@ function si({ title: e, header: t = !0, "aria-label": n = e || "Radar chart", da
|
|
|
5911
5956
|
}
|
|
5912
5957
|
//#endregion
|
|
5913
5958
|
//#region src/cards/range-chart-card.tsx
|
|
5914
|
-
function
|
|
5959
|
+
function li({ low: e, high: t, value: n, label: r, color: i, display: a = "bar", depth: o = !1, aggregate: s = "mean", tiles: c = !1, ...l }) {
|
|
5915
5960
|
let u = n ?? t, d = (e) => (t) => {
|
|
5916
5961
|
let n = t[e];
|
|
5917
5962
|
return typeof n == "number" ? n : null;
|
|
@@ -5959,7 +6004,7 @@ function ci({ low: e, high: t, value: n, label: r, color: i, display: a = "bar",
|
|
|
5959
6004
|
}
|
|
5960
6005
|
//#endregion
|
|
5961
6006
|
//#region src/cards/box-plot-card.tsx
|
|
5962
|
-
function
|
|
6007
|
+
function ui({ data: e = [], x: t, samples: n, label: r = "Median", color: i, outliers: a = !0, depth: o = !1, headline: s, ...c }) {
|
|
5963
6008
|
let l = Qe(() => e.map((e) => {
|
|
5964
6009
|
let r = e, i = Mt(r[n]);
|
|
5965
6010
|
return {
|
|
@@ -6029,12 +6074,12 @@ function li({ data: e = [], x: t, samples: n, label: r = "Median", color: i, out
|
|
|
6029
6074
|
}
|
|
6030
6075
|
//#endregion
|
|
6031
6076
|
//#region src/engine/slope.ts
|
|
6032
|
-
var
|
|
6077
|
+
var di = (e) => {
|
|
6033
6078
|
if (e == null) return null;
|
|
6034
6079
|
if (typeof e != "number" || !Number.isFinite(e)) throw Error("Invalid value: expected a finite number or null.");
|
|
6035
6080
|
return e;
|
|
6036
6081
|
};
|
|
6037
|
-
function
|
|
6082
|
+
function fi(e, t) {
|
|
6038
6083
|
if (e === null || t === null) return {
|
|
6039
6084
|
change: null,
|
|
6040
6085
|
ratio: null
|
|
@@ -6045,14 +6090,14 @@ function di(e, t) {
|
|
|
6045
6090
|
ratio: e > 0 ? n / e : null
|
|
6046
6091
|
};
|
|
6047
6092
|
}
|
|
6048
|
-
function
|
|
6093
|
+
function pi(e, t, n, r, i = "change") {
|
|
6049
6094
|
let a = (e, t) => e[t], o = We(e, {
|
|
6050
6095
|
id: (e) => String(a(e, t) ?? ""),
|
|
6051
6096
|
label: (e) => String(a(e, t) ?? "")
|
|
6052
6097
|
}, () => 0).map(({ id: e, label: t, datum: i }) => {
|
|
6053
6098
|
let o, s;
|
|
6054
6099
|
try {
|
|
6055
|
-
o =
|
|
6100
|
+
o = di(a(i, n)), s = di(a(i, r));
|
|
6056
6101
|
} catch {
|
|
6057
6102
|
throw Error(`Invalid value for category "${e}": expected a finite number or null.`);
|
|
6058
6103
|
}
|
|
@@ -6061,7 +6106,7 @@ function fi(e, t, n, r, i = "change") {
|
|
|
6061
6106
|
label: t,
|
|
6062
6107
|
from: o,
|
|
6063
6108
|
to: s,
|
|
6064
|
-
...
|
|
6109
|
+
...fi(o, s)
|
|
6065
6110
|
};
|
|
6066
6111
|
});
|
|
6067
6112
|
if (i === "input") return o;
|
|
@@ -6071,19 +6116,19 @@ function fi(e, t, n, r, i = "change") {
|
|
|
6071
6116
|
return n === null || r === null ? n === r ? 0 : n === null ? 1 : -1 : r - n;
|
|
6072
6117
|
});
|
|
6073
6118
|
}
|
|
6074
|
-
function
|
|
6119
|
+
function mi(e, t = "sum") {
|
|
6075
6120
|
let n = 0, r = 0, i = 0, a = 0, o = 0;
|
|
6076
6121
|
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);
|
|
6077
6122
|
let s = t === "mean";
|
|
6078
6123
|
return {
|
|
6079
6124
|
to: r ? s ? n / r : n : null,
|
|
6080
|
-
...o ?
|
|
6125
|
+
...o ? fi(s ? i / o : i, s ? a / o : a) : {
|
|
6081
6126
|
change: null,
|
|
6082
6127
|
ratio: null
|
|
6083
6128
|
}
|
|
6084
6129
|
};
|
|
6085
6130
|
}
|
|
6086
|
-
function
|
|
6131
|
+
function hi(e) {
|
|
6087
6132
|
let t = e.flatMap((e) => [e.from, e.to].filter((e) => e !== null));
|
|
6088
6133
|
if (!t.length) return [0, 1];
|
|
6089
6134
|
let [n, r] = at(t);
|
|
@@ -6094,7 +6139,7 @@ function mi(e) {
|
|
|
6094
6139
|
let i = (r - n) * .06;
|
|
6095
6140
|
return [n - i, r + i];
|
|
6096
6141
|
}
|
|
6097
|
-
function
|
|
6142
|
+
function gi(e, t, n, r) {
|
|
6098
6143
|
let i = e.map((e, t) => ({
|
|
6099
6144
|
target: e,
|
|
6100
6145
|
index: t
|
|
@@ -6121,24 +6166,24 @@ function hi(e, t, n, r) {
|
|
|
6121
6166
|
}
|
|
6122
6167
|
//#endregion
|
|
6123
6168
|
//#region src/cards/slope-chart-card.tsx
|
|
6124
|
-
var
|
|
6169
|
+
var _i = {
|
|
6125
6170
|
opacity: 0,
|
|
6126
6171
|
filter: "blur(3px)",
|
|
6127
6172
|
transition: { duration: .32 }
|
|
6128
|
-
},
|
|
6129
|
-
function
|
|
6173
|
+
}, vi = [], yi = 6.6, bi = 17;
|
|
6174
|
+
function xi(e, t) {
|
|
6130
6175
|
return e === null || e === 0 || t === "neutral" ? "neutral" : e > 0 == (t !== "inverse") ? "positive" : "negative";
|
|
6131
6176
|
}
|
|
6132
|
-
var
|
|
6133
|
-
function
|
|
6177
|
+
var Si = (e) => e === null ? "" : `${e >= 0 ? "+" : "−"}${Math.abs(e * 100).toFixed(1)}%`;
|
|
6178
|
+
function Ci({ title: e, header: t = !0, "aria-label": n = e || "Slope chart", data: r, category: i, from: a, to: o, fromLabel: s = a, toLabel: c = o, variant: l = "slope", depth: u = !1, sort: f = "change", aggregate: p = "sum", headline: m, delta: h, deltaTone: g = "default", range: _, ranges: v, defaultRange: y, color: b, height: x = 260, valueFormat: ee, locale: te, formatValue: S, surface: ie = "elevated", badge: ae, numberStyle: w, palette: oe, loading: T = !1, loadingStyle: se = "shimmer", empty: E = "dots", motion: D = "auto", className: O, style: ce }) {
|
|
6134
6179
|
let k = Te(D), A = re(T, k), j = he({
|
|
6135
6180
|
valueFormat: ee,
|
|
6136
6181
|
locale: te,
|
|
6137
6182
|
formatValue: S
|
|
6138
|
-
}), [M, N] = X(y ?? v?.[0]?.id), P = v?.find((e) => e.id === M) ?? v?.[0], F = P?.data ?? r ??
|
|
6183
|
+
}), [M, N] = X(y ?? v?.[0]?.id), P = v?.find((e) => e.id === M) ?? v?.[0], F = P?.data ?? r ?? vi, I = Qe(() => {
|
|
6139
6184
|
try {
|
|
6140
6185
|
return {
|
|
6141
|
-
rows:
|
|
6186
|
+
rows: pi(F, i, a, o, f),
|
|
6142
6187
|
error: null
|
|
6143
6188
|
};
|
|
6144
6189
|
} catch (e) {
|
|
@@ -6153,19 +6198,21 @@ function Si({ title: e, header: t = !0, "aria-label": n = e || "Slope chart", da
|
|
|
6153
6198
|
a,
|
|
6154
6199
|
o,
|
|
6155
6200
|
f
|
|
6156
|
-
]), L = I.rows, R = Qe(() =>
|
|
6157
|
-
resolve:
|
|
6201
|
+
]), L = I.rows, R = Qe(() => mi(L, p), [L, p]), le = Qe(() => hi(L), [L]), [ue, z] = X(null), [B, V] = X(null), [H, de] = X(null), U = H ?? B ?? ue, fe = L.find((e) => e.id === U) ?? null, pe = $e(/* @__PURE__ */ new Map()), me = Ht({
|
|
6202
|
+
resolve: Vt,
|
|
6158
6203
|
onGlide: z,
|
|
6159
6204
|
onLift: (e) => e !== null && de(e),
|
|
6205
|
+
pinned: H !== null,
|
|
6206
|
+
onRelease: () => de(null),
|
|
6160
6207
|
disabled: T
|
|
6161
|
-
}), W = P?.headline ?? m ?? R.to, G = P ? P.delta ?? R.ratio : h ?? R.ratio, ge = (e) => e === null ? "No data" : j.value(e), _e = (e) => `${e.label}: ${s} ${ge(e.from)}, ${c} ${ge(e.to)}${e.ratio === null ? "" : `, ${
|
|
6208
|
+
}), W = P?.headline ?? m ?? R.to, G = P ? P.delta ?? R.ratio : h ?? R.ratio, ge = (e) => e === null ? "No data" : j.value(e), _e = (e) => `${e.label}: ${s} ${ge(e.from)}, ${c} ${ge(e.to)}${e.ratio === null ? "" : `, ${Si(e.ratio)}`}`, ve = (e, t) => {
|
|
6162
6209
|
let n = t;
|
|
6163
6210
|
if (e.key === "ArrowDown" || e.key === "ArrowRight") n = Math.min(L.length - 1, t + 1);
|
|
6164
6211
|
else if (e.key === "ArrowUp" || e.key === "ArrowLeft") n = Math.max(0, t - 1);
|
|
6165
6212
|
else if (e.key === "Home") n = 0;
|
|
6166
6213
|
else if (e.key === "End") n = L.length - 1;
|
|
6167
6214
|
else if (e.key === "Escape") {
|
|
6168
|
-
de(null);
|
|
6215
|
+
e.preventDefault(), de(null);
|
|
6169
6216
|
return;
|
|
6170
6217
|
} else if (e.key === "Enter" || e.key === " ") {
|
|
6171
6218
|
e.preventDefault();
|
|
@@ -6183,7 +6230,7 @@ function Si({ title: e, header: t = !0, "aria-label": n = e || "Slope chart", da
|
|
|
6183
6230
|
"aria-pressed": H === e.id,
|
|
6184
6231
|
"data-active": e.id === fe?.id || void 0,
|
|
6185
6232
|
"data-muted": fe !== null && e.id !== fe.id || void 0,
|
|
6186
|
-
"data-tone": b ? void 0 :
|
|
6233
|
+
"data-tone": b ? void 0 : xi(e.change, g),
|
|
6187
6234
|
"data-glide-id": e.id,
|
|
6188
6235
|
onPointerEnter: () => z(e.id),
|
|
6189
6236
|
onPointerLeave: () => z(null),
|
|
@@ -6247,7 +6294,7 @@ function Si({ title: e, header: t = !0, "aria-label": n = e || "Slope chart", da
|
|
|
6247
6294
|
/* @__PURE__ */ Q(C, {
|
|
6248
6295
|
leaving: A,
|
|
6249
6296
|
origin: "left",
|
|
6250
|
-
children: T ? /* @__PURE__ */ Q(
|
|
6297
|
+
children: T ? /* @__PURE__ */ Q(wi, {
|
|
6251
6298
|
height: x,
|
|
6252
6299
|
variant: l,
|
|
6253
6300
|
depth: u,
|
|
@@ -6271,7 +6318,7 @@ function Si({ title: e, header: t = !0, "aria-label": n = e || "Slope chart", da
|
|
|
6271
6318
|
children: L.map((e, t) => {
|
|
6272
6319
|
let n = (e) => (e - le[0]) / (le[1] - le[0]) * 100, r = e.from === null ? null : n(e.from), i = e.to === null ? null : n(e.to), a = k ? 0 : K(t, L.length, 140) / 1e3;
|
|
6273
6320
|
return /* @__PURE__ */ Q(nt.li, {
|
|
6274
|
-
exit:
|
|
6321
|
+
exit: _i,
|
|
6275
6322
|
children: /* @__PURE__ */ $("button", {
|
|
6276
6323
|
type: "button",
|
|
6277
6324
|
className: "lilt-slope__row",
|
|
@@ -6327,14 +6374,14 @@ function Si({ title: e, header: t = !0, "aria-label": n = e || "Slope chart", da
|
|
|
6327
6374
|
}),
|
|
6328
6375
|
/* @__PURE__ */ Q("span", {
|
|
6329
6376
|
className: "lilt-slope__change",
|
|
6330
|
-
children:
|
|
6377
|
+
children: Si(e.ratio) || "—"
|
|
6331
6378
|
})
|
|
6332
6379
|
]
|
|
6333
6380
|
})
|
|
6334
6381
|
}, e.id);
|
|
6335
6382
|
})
|
|
6336
6383
|
})
|
|
6337
|
-
}) : /* @__PURE__ */ Q(
|
|
6384
|
+
}) : /* @__PURE__ */ Q(Ti, {
|
|
6338
6385
|
rows: L,
|
|
6339
6386
|
domain: le,
|
|
6340
6387
|
height: x,
|
|
@@ -6351,7 +6398,7 @@ function Si({ title: e, header: t = !0, "aria-label": n = e || "Slope chart", da
|
|
|
6351
6398
|
]
|
|
6352
6399
|
});
|
|
6353
6400
|
}
|
|
6354
|
-
function
|
|
6401
|
+
function wi({ height: e, variant: t, depth: n, reduced: r, loadingStyle: i, "data-skeleton-leaving": a }) {
|
|
6355
6402
|
let { ref: o, width: s } = ee(), c = s || 320, l = `lilt-slope-loading-${Xe().replace(/:/g, "")}`, u = [
|
|
6356
6403
|
.18,
|
|
6357
6404
|
.34,
|
|
@@ -6379,7 +6426,7 @@ function Ci({ height: e, variant: t, depth: n, reduced: r, loadingStyle: i, "dat
|
|
|
6379
6426
|
cx: t,
|
|
6380
6427
|
cy: r,
|
|
6381
6428
|
r: i,
|
|
6382
|
-
fill: e ? "white" : n ? `url(#${l})` :
|
|
6429
|
+
fill: e ? "white" : n ? `url(#${l})` : Yt
|
|
6383
6430
|
})
|
|
6384
6431
|
});
|
|
6385
6432
|
return /* @__PURE__ */ $("g", { children: [
|
|
@@ -6387,7 +6434,7 @@ function Ci({ height: e, variant: t, depth: n, reduced: r, loadingStyle: i, "dat
|
|
|
6387
6434
|
d: `M${t},${i}L${r},${a}`,
|
|
6388
6435
|
fill: "none",
|
|
6389
6436
|
transform: e.transform,
|
|
6390
|
-
stroke: w(
|
|
6437
|
+
stroke: w(Yt, e.amount),
|
|
6391
6438
|
strokeWidth: e.strokeWidth,
|
|
6392
6439
|
...c
|
|
6393
6440
|
}, n)) : /* @__PURE__ */ Q("line", {
|
|
@@ -6395,7 +6442,7 @@ function Ci({ height: e, variant: t, depth: n, reduced: r, loadingStyle: i, "dat
|
|
|
6395
6442
|
x2: r,
|
|
6396
6443
|
y1: i,
|
|
6397
6444
|
y2: a,
|
|
6398
|
-
stroke: e ? "white" :
|
|
6445
|
+
stroke: e ? "white" : Yt,
|
|
6399
6446
|
strokeWidth: 2.5,
|
|
6400
6447
|
...c
|
|
6401
6448
|
}),
|
|
@@ -6415,8 +6462,8 @@ function Ci({ height: e, variant: t, depth: n, reduced: r, loadingStyle: i, "dat
|
|
|
6415
6462
|
viewBox: `0 0 ${c} ${e}`,
|
|
6416
6463
|
children: [n ? /* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(H, {
|
|
6417
6464
|
id: l,
|
|
6418
|
-
color:
|
|
6419
|
-
}) }) : null, /* @__PURE__ */ Q(
|
|
6465
|
+
color: Yt
|
|
6466
|
+
}) }) : null, /* @__PURE__ */ Q(Zt, {
|
|
6420
6467
|
width: c,
|
|
6421
6468
|
height: e,
|
|
6422
6469
|
reduced: r,
|
|
@@ -6428,10 +6475,10 @@ function Ci({ height: e, variant: t, depth: n, reduced: r, loadingStyle: i, "dat
|
|
|
6428
6475
|
})
|
|
6429
6476
|
});
|
|
6430
6477
|
}
|
|
6431
|
-
function
|
|
6478
|
+
function Ti({ rows: e, domain: t, height: n, fromLabel: r, toLabel: i, title: a, format: o, reduced: s, handlers: c, glideRef: l, depth: u }) {
|
|
6432
6479
|
let { ref: d, width: f } = ee(), p = `lilt-slope-${Xe().replace(/:/g, "")}`, m = "var(--lilt-slope-ink)", h = Je((e) => {
|
|
6433
6480
|
d.current = e, l(e);
|
|
6434
|
-
}, [l, d]), g = n - 10, _ = (e) => g - (e - t[0]) / (t[1] - t[0]) * (g - 30), v = (e) => e === null ? "No data" : o(e), y = Math.max(...e.map((e) => e.label.length + 1 + v(e.from).length)), b = Math.max(...e.map((e) => v(e.to).length + 1 +
|
|
6481
|
+
}, [l, d]), g = n - 10, _ = (e) => g - (e - t[0]) / (t[1] - t[0]) * (g - 30), v = (e) => e === null ? "No data" : o(e), y = Math.max(...e.map((e) => e.label.length + 1 + v(e.from).length)), b = Math.max(...e.map((e) => v(e.to).length + 1 + Si(e.ratio).length)), x = (y + b) * yi + 48 > f * .72, te = x ? Math.max(...e.map((e) => e.label.length)) : y, S = x ? Math.max(...e.map((e) => v(e.to).length)) : b, C = Math.min(f * .46, te * yi + 24), ne = Math.max(C + 40, f - Math.min(f * .36, S * yi + 24)), re = e.map((e) => e.from === null ? g : _(e.from)), ie = e.map((e) => e.to === null ? g : _(e.to)), ae = gi(re, bi, 36, g), oe = gi(ie, bi, 36, g), T = s ? { duration: 0 } : {
|
|
6435
6482
|
type: "spring",
|
|
6436
6483
|
duration: .65,
|
|
6437
6484
|
bounce: .12
|
|
@@ -6494,7 +6541,7 @@ function wi({ rows: e, domain: t, height: n, fromLabel: r, toLabel: i, title: a,
|
|
|
6494
6541
|
return /* @__PURE__ */ $(nt.g, {
|
|
6495
6542
|
className: "lilt-slope__line",
|
|
6496
6543
|
role: "button",
|
|
6497
|
-
exit:
|
|
6544
|
+
exit: _i,
|
|
6498
6545
|
...c(t, n),
|
|
6499
6546
|
children: [
|
|
6500
6547
|
u ? /* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(H, {
|
|
@@ -6613,7 +6660,7 @@ function wi({ rows: e, domain: t, height: n, fromLabel: r, toLabel: i, title: a,
|
|
|
6613
6660
|
}), x || t.ratio === null ? null : /* @__PURE__ */ Q("tspan", {
|
|
6614
6661
|
className: "lilt-slope__ratio",
|
|
6615
6662
|
dx: 6,
|
|
6616
|
-
children:
|
|
6663
|
+
children: Si(t.ratio)
|
|
6617
6664
|
})]
|
|
6618
6665
|
})
|
|
6619
6666
|
]
|
|
@@ -6626,8 +6673,8 @@ function wi({ rows: e, domain: t, height: n, fromLabel: r, toLabel: i, title: a,
|
|
|
6626
6673
|
}
|
|
6627
6674
|
//#endregion
|
|
6628
6675
|
//#region src/activity-ring.tsx
|
|
6629
|
-
var
|
|
6630
|
-
function
|
|
6676
|
+
var Ei = .54, Di = 3.2, Oi = "color-mix(in oklab, var(--lilt-grid), var(--lilt-surface) 20%)";
|
|
6677
|
+
function ki(e, t, n, r, i = 60) {
|
|
6631
6678
|
if (!Number.isFinite(r) || r <= 0) throw Error("Lilt ActivityRing maximum must be positive and finite.");
|
|
6632
6679
|
if (!Number.isInteger(i) || i <= 0 || 1440 % i != 0) throw Error("Lilt ActivityRing bucketMinutes must divide a 24-hour day.");
|
|
6633
6680
|
let a = 1440 / i, o = Array.from({ length: a }, (e, t) => ({
|
|
@@ -6648,11 +6695,11 @@ function Oi(e, t, n, r, i = 60) {
|
|
|
6648
6695
|
}
|
|
6649
6696
|
return o;
|
|
6650
6697
|
}
|
|
6651
|
-
var
|
|
6698
|
+
var Ai = (e) => {
|
|
6652
6699
|
let t = Math.round(e * 60);
|
|
6653
6700
|
return `${String(Math.floor(t / 60)).padStart(2, "0")}:${String(t % 60).padStart(2, "0")}`;
|
|
6654
6701
|
};
|
|
6655
|
-
function
|
|
6702
|
+
function ji(e, t, n) {
|
|
6656
6703
|
let r = Te(n), [i, a] = X(0), [o, s] = X(!0), c = $e(i), l = $e(!1);
|
|
6657
6704
|
return Ze(() => {
|
|
6658
6705
|
if (!e || !t || r) {
|
|
@@ -6682,12 +6729,12 @@ function Ai(e, t, n) {
|
|
|
6682
6729
|
reduced: r
|
|
6683
6730
|
};
|
|
6684
6731
|
}
|
|
6685
|
-
function
|
|
6732
|
+
function Mi({ 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 }) {
|
|
6686
6733
|
if (!o.trim()) throw Error("Lilt ActivityRing requires a measurement unit.");
|
|
6687
6734
|
if (!Number.isFinite(h) || h < 180) throw Error("Lilt ActivityRing height must be at least 180px.");
|
|
6688
6735
|
if (!Number.isInteger(a) || a < 1 || a > 24) throw Error("Lilt ActivityRing dotDensity must be an integer from 1 to 24.");
|
|
6689
6736
|
let y = Qe(() => u === "ready" ? {
|
|
6690
|
-
slots:
|
|
6737
|
+
slots: ki(e, t, n, r, i),
|
|
6691
6738
|
maximum: r,
|
|
6692
6739
|
bucketMinutes: i,
|
|
6693
6740
|
unit: o,
|
|
@@ -6716,13 +6763,13 @@ function ji({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
6716
6763
|
row: N.row,
|
|
6717
6764
|
value: N.value,
|
|
6718
6765
|
pinned: A === M
|
|
6719
|
-
} : null, { progress: F, sweeping: I, reduced: L } =
|
|
6766
|
+
} : null, { progress: F, sweeping: I, reduced: L } = ji(S, u === "ready", m), R = S?.map((e) => e.value == null ? 0 : Math.round(e.value / ne * a)) ?? [], le = $e(null), ue = $e([]), z = $e(0);
|
|
6720
6767
|
Ze(() => {
|
|
6721
6768
|
le.current && (z.current += 1), ue.current = le.current ?? R;
|
|
6722
6769
|
}, [S]), Ze(() => {
|
|
6723
6770
|
F >= 1 && (le.current = R);
|
|
6724
6771
|
});
|
|
6725
|
-
let B = $e(null), V =
|
|
6772
|
+
let B = $e(null), V = Ht({
|
|
6726
6773
|
resolve: (e, t, n) => {
|
|
6727
6774
|
if (!S) return null;
|
|
6728
6775
|
let r = n.getBoundingClientRect(), i = e - r.left - r.width / T * se, a = t - r.top - r.height / T * D, o = Math.hypot(i, a) / (r.width / T || 1);
|
|
@@ -6732,7 +6779,9 @@ function ji({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
6732
6779
|
},
|
|
6733
6780
|
onGlide: k,
|
|
6734
6781
|
onLift: (e) => e !== null && j(e),
|
|
6735
|
-
disabled: !S
|
|
6782
|
+
disabled: !S,
|
|
6783
|
+
pinned: A !== null,
|
|
6784
|
+
onRelease: () => j(null)
|
|
6736
6785
|
}), H = Je((e) => {
|
|
6737
6786
|
B.current = e, V(e);
|
|
6738
6787
|
}, [V]);
|
|
@@ -6776,14 +6825,14 @@ function ji({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
6776
6825
|
let t = S?.[e], n = t?.value == null ? 0 : Math.round(t.value / ne * a), r = I ? Math.max(0, Math.min(1, (F - e / C * .7) / .3)) : 1, i = ue.current[e], o = Math.max(0, Math.min(1, (F - e / C * .35) / .65)), s = I ? Math.ceil(n * r) : i === void 0 || F >= 1 ? n : Math.round(i + (n - i) * o);
|
|
6777
6826
|
return Array.from({ length: a }, (t, n) => ({
|
|
6778
6827
|
dot: n,
|
|
6779
|
-
...U(e, O * (
|
|
6828
|
+
...U(e, O * (Ei + n / Math.max(1, a - 1) * .5249999999999999)),
|
|
6780
6829
|
filled: n < s,
|
|
6781
6830
|
active: M === e
|
|
6782
6831
|
}));
|
|
6783
|
-
}, me = E(
|
|
6832
|
+
}, me = E(Di), W = Array.from({ length: C }, (e, t) => {
|
|
6784
6833
|
let n = .5 - .5 * Math.cos((t / C * 2 - .25) * Math.PI), r = Math.max(1, Math.round(a * (.25 + .55 * n)));
|
|
6785
|
-
return Array.from({ length: r }, (e, n) => U(t, O * (
|
|
6786
|
-
}).flat(), G = P ? `${
|
|
6834
|
+
return Array.from({ length: r }, (e, n) => U(t, O * (Ei + n / Math.max(1, a - 1) * .5249999999999999)));
|
|
6835
|
+
}).flat(), G = P ? `${Ai(P.hour)}: ${P.value === null ? "No data" : `${ie(P.value)} ${re}`}` : "No bucket selected.";
|
|
6787
6836
|
return /* @__PURE__ */ $("div", {
|
|
6788
6837
|
ref: ae,
|
|
6789
6838
|
className: ["lilt-activity", _].filter(Boolean).join(" "),
|
|
@@ -6831,7 +6880,7 @@ function ji({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
6831
6880
|
strokeWidth: (a ? 3.3 : 2.7) * 2,
|
|
6832
6881
|
strokeLinecap: "round",
|
|
6833
6882
|
style: {
|
|
6834
|
-
stroke: w(i ? "var(--lilt-series-1)" :
|
|
6883
|
+
stroke: w(i ? "var(--lilt-series-1)" : Oi, -38),
|
|
6835
6884
|
opacity: 1
|
|
6836
6885
|
}
|
|
6837
6886
|
}, `${t}-${e}`)))
|
|
@@ -6857,7 +6906,7 @@ function ji({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
6857
6906
|
cx: t,
|
|
6858
6907
|
cy: n,
|
|
6859
6908
|
r: i ? 3.3 : 2.7,
|
|
6860
|
-
fill: r ? "var(--lilt-series-1)" : g ?
|
|
6909
|
+
fill: r ? "var(--lilt-series-1)" : g ? Oi : "var(--lilt-grid)",
|
|
6861
6910
|
opacity: r || g ? 1 : .8
|
|
6862
6911
|
}, e)),
|
|
6863
6912
|
r ? /* @__PURE__ */ Q("circle", {
|
|
@@ -6873,7 +6922,7 @@ function ji({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
6873
6922
|
}) }),
|
|
6874
6923
|
!S && u === "loading" ? /* @__PURE__ */ Q("g", {
|
|
6875
6924
|
"data-skeleton-leaving": f,
|
|
6876
|
-
children: /* @__PURE__ */ Q(
|
|
6925
|
+
children: /* @__PURE__ */ Q(Zt, {
|
|
6877
6926
|
width: T,
|
|
6878
6927
|
height: T,
|
|
6879
6928
|
reduced: L,
|
|
@@ -6893,7 +6942,7 @@ function ji({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
6893
6942
|
y1: e.y,
|
|
6894
6943
|
x2: e.x + me.dx,
|
|
6895
6944
|
y2: e.y + me.dy,
|
|
6896
|
-
stroke: w(
|
|
6945
|
+
stroke: w(Yt, -38),
|
|
6897
6946
|
strokeWidth: 5.4,
|
|
6898
6947
|
strokeLinecap: "round"
|
|
6899
6948
|
}) : null, /* @__PURE__ */ Q("circle", {
|
|
@@ -6901,7 +6950,7 @@ function ji({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
6901
6950
|
cx: e.x,
|
|
6902
6951
|
cy: e.y,
|
|
6903
6952
|
r: 2.7,
|
|
6904
|
-
style: g ? { fill: w(
|
|
6953
|
+
style: g ? { fill: w(Yt, 12) } : void 0
|
|
6905
6954
|
})]
|
|
6906
6955
|
}, t))
|
|
6907
6956
|
})
|
|
@@ -6944,27 +6993,27 @@ function ji({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
6944
6993
|
}
|
|
6945
6994
|
//#endregion
|
|
6946
6995
|
//#region src/cards/activity-ring-card.tsx
|
|
6947
|
-
var
|
|
6948
|
-
function
|
|
6996
|
+
var Ni = [], Pi = 280;
|
|
6997
|
+
function Fi(e) {
|
|
6949
6998
|
let t = Math.round(e * 60) % 1440;
|
|
6950
6999
|
return `${String(Math.floor(t / 60)).padStart(2, "0")}:${String(t % 60).padStart(2, "0")}`;
|
|
6951
7000
|
}
|
|
6952
|
-
function
|
|
7001
|
+
function Ii(e, t) {
|
|
6953
7002
|
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;
|
|
6954
7003
|
}
|
|
6955
|
-
function
|
|
7004
|
+
function Li({ title: e, header: t = !0, "aria-label": n = e || "Activity ring", data: r, hour: i, value: a, bucketMinutes: o = 60, unit: s, maximum: c, aggregate: l = "sum", height: u = Pi, depth: f = !1, headline: p, delta: m, deltaTone: h, range: g, ranges: _, defaultRange: v, valueFormat: y, locale: b, formatValue: x, color: ee, surface: te = "elevated", badge: S, numberStyle: C, palette: ie, loading: ae = !1, loadingStyle: w = "shimmer", empty: oe = "dots", motion: T = "auto", className: se, style: E }) {
|
|
6956
7005
|
let D = he({
|
|
6957
7006
|
valueFormat: y,
|
|
6958
7007
|
locale: b,
|
|
6959
7008
|
formatValue: x
|
|
6960
|
-
}), O = re(ae, Te(T)), [ce, k] = X(v ?? _?.[0]?.id), A = _?.find((e) => e.id === ce) ?? _?.[0], j = A?.data ?? r ??
|
|
7009
|
+
}), O = re(ae, Te(T)), [ce, k] = X(v ?? _?.[0]?.id), A = _?.find((e) => e.id === ce) ?? _?.[0], j = A?.data ?? r ?? Ni, M = A ? A.delta : m, N = s?.trim() || a, P = Je((e) => e[i], [i]), F = Je((e) => {
|
|
6961
7010
|
let t = e[a];
|
|
6962
7011
|
return typeof t == "number" && Number.isFinite(t) ? t : null;
|
|
6963
7012
|
}, [a]), I = Qe(() => {
|
|
6964
7013
|
let e = j.map(F).filter((e) => e !== null), t = Math.max(0, ...e), n = c ?? rt().domain([0, Math.max(1, t)]).nice(4).domain()[1];
|
|
6965
7014
|
try {
|
|
6966
7015
|
return {
|
|
6967
|
-
slots:
|
|
7016
|
+
slots: ki(j, P, F, n, o),
|
|
6968
7017
|
maximum: n,
|
|
6969
7018
|
error: null
|
|
6970
7019
|
};
|
|
@@ -6972,7 +7021,7 @@ function Ii({ title: e, header: t = !0, "aria-label": n = e || "Activity ring",
|
|
|
6972
7021
|
return {
|
|
6973
7022
|
slots: [],
|
|
6974
7023
|
maximum: n,
|
|
6975
|
-
error:
|
|
7024
|
+
error: Ii(e instanceof Error ? e.message : "Invalid activity.", o)
|
|
6976
7025
|
};
|
|
6977
7026
|
}
|
|
6978
7027
|
}, [
|
|
@@ -7009,7 +7058,7 @@ function Ii({ title: e, header: t = !0, "aria-label": n = e || "Activity ring",
|
|
|
7009
7058
|
format: D.value,
|
|
7010
7059
|
loading: ae,
|
|
7011
7060
|
motion: T,
|
|
7012
|
-
children: ae ? null : L ? /* @__PURE__ */ $(ke, { children: [
|
|
7061
|
+
children: ae ? null : L ? /* @__PURE__ */ $(ke, { children: [Fi(L.hour), L.value === null ? " · No data" : ` · ${N}`] }) : !U && M !== void 0 ? /* @__PURE__ */ Q(Ae, {
|
|
7013
7062
|
value: M,
|
|
7014
7063
|
tone: h
|
|
7015
7064
|
}) : null
|
|
@@ -7022,7 +7071,7 @@ function Ii({ title: e, header: t = !0, "aria-label": n = e || "Activity ring",
|
|
|
7022
7071
|
state: oe,
|
|
7023
7072
|
shape: "ring"
|
|
7024
7073
|
}) : /* @__PURE__ */ $(Z, { children: [
|
|
7025
|
-
/* @__PURE__ */ Q(
|
|
7074
|
+
/* @__PURE__ */ Q(Mi, {
|
|
7026
7075
|
loadingStyle: w,
|
|
7027
7076
|
className: "lilt-activity-card__ring",
|
|
7028
7077
|
depth: f,
|
|
@@ -7041,20 +7090,20 @@ function Ii({ title: e, header: t = !0, "aria-label": n = e || "Activity ring",
|
|
|
7041
7090
|
motion: T,
|
|
7042
7091
|
resetKey: A?.id,
|
|
7043
7092
|
onSelectionChange: le,
|
|
7044
|
-
center: ae ? /* @__PURE__ */ Q(Z, {}) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("strong", { children: z ? D.value(z.value) : "—" }), /* @__PURE__ */ Q("span", { children: z ? `peak · ${
|
|
7093
|
+
center: ae ? /* @__PURE__ */ Q(Z, {}) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("strong", { children: z ? D.value(z.value) : "—" }), /* @__PURE__ */ Q("span", { children: z ? `peak · ${Fi(z.hour)}` : "no data" })] })
|
|
7045
7094
|
}),
|
|
7046
7095
|
/* @__PURE__ */ Q(fe, {
|
|
7047
7096
|
className: "lilt-card__tiles",
|
|
7048
7097
|
"aria-label": `${n}: busiest and quietest times`,
|
|
7049
7098
|
items: [{
|
|
7050
7099
|
id: "busiest",
|
|
7051
|
-
label: z && !ae ? `Busiest · ${
|
|
7100
|
+
label: z && !ae ? `Busiest · ${Fi(z.hour)}` : "Busiest",
|
|
7052
7101
|
color: "var(--lilt-series-1)",
|
|
7053
7102
|
value: z?.value ?? null,
|
|
7054
7103
|
formattedValue: z ? D.value(z.value) : "No data"
|
|
7055
7104
|
}, {
|
|
7056
7105
|
id: "quietest",
|
|
7057
|
-
label: B && !ae ? `Quietest · ${
|
|
7106
|
+
label: B && !ae ? `Quietest · ${Fi(B.hour)}` : "Quietest",
|
|
7058
7107
|
color: "color-mix(in srgb, var(--lilt-series-1) 30%, transparent)",
|
|
7059
7108
|
value: B?.value ?? null,
|
|
7060
7109
|
formattedValue: B ? D.value(B.value) : "No data"
|
|
@@ -7075,4 +7124,4 @@ function Ii({ title: e, header: t = !0, "aria-label": n = e || "Activity ring",
|
|
|
7075
7124
|
});
|
|
7076
7125
|
}
|
|
7077
7126
|
//#endregion
|
|
7078
|
-
export {
|
|
7127
|
+
export { Li as ActivityRingCard, Le as AnimatedNumber, D as Annotations, u as Area, Kt as AreaChartCard, oe as Bar, Jt as BarChartCard, jt as BoxPlot, ui as BoxPlotCard, fr as CalendarHeatmapCard, Oe as CardBadge, Ne as CardFrameContext, Rt as ChangeComparison, T as Chart, xt as ChartBrush, Ie as ChartCard, ke as ChartCardCaption, Ae as ChartCardDelta, Fe as ChartCardHeader, Pe as ChartCardRange, Me as ChartCardTitle, je as ChartCardValue, De as ChartComponentsProvider, f as ChartEmpty, ft as ChartOverview, p as ChartPlot, Gt as ChartRangeSummary, ut as ChartReadout, lt as ChartToolbar, hn as ComboChartCard, ct as ComparisonDetails, Et as ErrorBar, Un as FunnelChartCard, Se as Grid, $n as HeatmapChartCard, mn as HorizontalBarChartCard, y as IntervalBand, Lt as Legend, be as Line, qt as LineChartCard, Nn as ProgressCard, ci as RadarChartCard, kn as RadialChartCard, wt as RangeBar, li as RangeChartCard, k as ReferenceBand, ve as ReferenceLine, Yr as SankeyChartCard, Nr as ScatterChartCard, Ci as SlopeChartCard, sn as StatCard, yr as StripChartCard, hr as TimelineChartCard, te as Tooltip, cr as TreemapChartCard, fe as ValueLegend, ie as XAxis, q as YAxis, M as createCartesianChartModel, Y as createChartController, Pt as serializeChartSvg, Mt as summarizeBox, Ke as summarizeFunnelStages, Ve as summarizeRange, Be as toChartCsv, ae as useCartesianChartModel, ye as useCartesianModelState, xe as useChartComparison, P as useChartState, c as useChartSync };
|