@lilt-ui/charts 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cards/cartesian-card.d.ts +7 -1
- package/dist/chart-context.d.ts +8 -1
- package/dist/chart.d.ts +1 -1
- package/dist/engine/decimate.d.ts +25 -0
- package/dist/finance.js +99 -98
- package/dist/index.js +642 -642
- package/dist/primitives/runoff.d.ts +6 -7
- package/dist/{report-context-Cz0AYdV2.js → report-context-CkzH-r8B.js} +130 -129
- package/dist/{skeleton-block-Uf1lywJi.js → skeleton-block-C110l-2a.js} +1811 -1669
- package/dist/types.d.ts +6 -0
- package/dist/watch.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, Q as g, R as _, S as v, T as y, U as ee, V as te, W as b, X as x, Y as S, Z as C, _ as ne, _t as w, at as T, b as E, c as D, ct as re, d as O, dt as k, f as A, ft as j, g as M, gt as N, h as P, ht as F, i as I, it as L, j as R, k as z, l as B, lt as
|
|
2
|
+
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, Q as g, R as _, S as v, T as y, U as ee, V as te, W as b, X as x, Y as S, Z as C, _ as ne, _t as w, at as T, b as E, c as D, ct as re, d as O, dt as k, f as A, ft as j, g as M, gt as N, h as P, ht as F, i as I, it as L, j as R, k as z, l as B, lt as ie, m as ae, mt as oe, n as V, nt as H, o as se, ot as U, p as ce, pt as W, q as le, r as ue, rt as G, s as de, st as fe, t as pe, tt as K, u as me, ut as he, v as ge, w as _e, x as ve, y as ye, z as q } from "./skeleton-block-C110l-2a.js";
|
|
3
3
|
import { n as J, t as be } from "./chart-data-CCwLQeXa.js";
|
|
4
|
-
import { S as xe, _ as Se, b as Ce, c as Y, d as we, f as Te, g as Ee, h as De, l as Oe, m as ke, p as Ae, u as je, x as Me } from "./report-context-
|
|
4
|
+
import { S as xe, _ as Se, b as Ce, c as Y, d as we, f as Te, g as Ee, h as De, l as Oe, m as ke, p as Ae, u as je, x as Me } from "./report-context-CkzH-r8B.js";
|
|
5
5
|
import { a as Ne, i as Pe, n as Fe, r as Ie, t as Le } from "./analysis-BJRmXHOB.js";
|
|
6
6
|
import { Fragment as Re, useCallback as ze, useEffect as Be, useId as Ve, useLayoutEffect as He, useMemo as Ue, useRef as We, useState as X, useSyncExternalStore as Ge } from "react";
|
|
7
7
|
import { Fragment as Z, jsx as Q, jsxs as $ } from "react/jsx-runtime";
|
|
8
8
|
import { AnimatePresence as Ke, motion as qe } from "motion/react";
|
|
9
9
|
import { scaleLinear as Je } from "d3-scale";
|
|
10
10
|
import { arc as Ye } from "d3-shape";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { extent as Xe, quantileSorted as Ze } from "d3-array";
|
|
12
|
+
import { animate as Qe } from "motion";
|
|
13
13
|
//#region src/toolkit/comparison-details.tsx
|
|
14
|
-
function
|
|
14
|
+
function $e({ comparison: e, className: t }) {
|
|
15
15
|
let n = e.motion === "none" ? 0 : 150;
|
|
16
16
|
return /* @__PURE__ */ $("div", {
|
|
17
17
|
className: ["lilt-comparison-details", t].filter(Boolean).join(" "),
|
|
18
18
|
children: [
|
|
19
19
|
/* @__PURE__ */ $("div", {
|
|
20
20
|
className: "lilt-comparison-details__heading",
|
|
21
|
-
children: [/* @__PURE__ */ Q(
|
|
21
|
+
children: [/* @__PURE__ */ Q(fe, {
|
|
22
22
|
duration: n,
|
|
23
23
|
offset: 3,
|
|
24
24
|
value: `${e.formattedStartX} → ${e.formattedEndX}`
|
|
@@ -56,7 +56,7 @@ function Qe({ comparison: e, className: t }) {
|
|
|
56
56
|
}),
|
|
57
57
|
/* @__PURE__ */ $("div", {
|
|
58
58
|
className: "lilt-comparison-details__stat",
|
|
59
|
-
children: [/* @__PURE__ */ Q("strong", { children: /* @__PURE__ */ Q(
|
|
59
|
+
children: [/* @__PURE__ */ Q("strong", { children: /* @__PURE__ */ Q(fe, {
|
|
60
60
|
duration: n,
|
|
61
61
|
offset: 3,
|
|
62
62
|
value: e.formattedEndValue
|
|
@@ -74,11 +74,11 @@ function Qe({ comparison: e, className: t }) {
|
|
|
74
74
|
strokeLinecap: "round",
|
|
75
75
|
strokeLinejoin: "round"
|
|
76
76
|
})
|
|
77
|
-
}), /* @__PURE__ */ Q(
|
|
77
|
+
}), /* @__PURE__ */ Q(fe, {
|
|
78
78
|
duration: n,
|
|
79
79
|
offset: 3,
|
|
80
80
|
value: e.formattedChange
|
|
81
|
-
})] }), e.formattedPercentage ? /* @__PURE__ */ Q("small", { children: /* @__PURE__ */ Q(
|
|
81
|
+
})] }), e.formattedPercentage ? /* @__PURE__ */ Q("small", { children: /* @__PURE__ */ Q(fe, {
|
|
82
82
|
duration: n,
|
|
83
83
|
offset: 3,
|
|
84
84
|
value: e.formattedPercentage
|
|
@@ -87,7 +87,7 @@ function Qe({ comparison: e, className: t }) {
|
|
|
87
87
|
}),
|
|
88
88
|
/* @__PURE__ */ $("div", {
|
|
89
89
|
className: "lilt-comparison-details__from",
|
|
90
|
-
children: [/* @__PURE__ */ Q("span", { children: "from " }), /* @__PURE__ */ Q(
|
|
90
|
+
children: [/* @__PURE__ */ Q("span", { children: "from " }), /* @__PURE__ */ Q(fe, {
|
|
91
91
|
duration: n,
|
|
92
92
|
offset: 3,
|
|
93
93
|
value: e.formattedStartValue
|
|
@@ -118,7 +118,7 @@ function Qe({ comparison: e, className: t }) {
|
|
|
118
118
|
}
|
|
119
119
|
//#endregion
|
|
120
120
|
//#region src/toolkit/chart-toolbar.tsx
|
|
121
|
-
function
|
|
121
|
+
function et({ actions: e, className: t }) {
|
|
122
122
|
let n = N();
|
|
123
123
|
return /* @__PURE__ */ $("div", {
|
|
124
124
|
className: ["lilt-chart__toolbar", t].filter(Boolean).join(" "),
|
|
@@ -138,7 +138,7 @@ function $e({ actions: e, className: t }) {
|
|
|
138
138
|
}
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region src/toolkit/chart-readout.tsx
|
|
141
|
-
function
|
|
141
|
+
function tt({ className: e }) {
|
|
142
142
|
let t = N();
|
|
143
143
|
return t.readout ? /* @__PURE__ */ Q("div", {
|
|
144
144
|
className: ["lilt-chart__readout", e].filter(Boolean).join(" "),
|
|
@@ -150,8 +150,8 @@ function et({ className: e }) {
|
|
|
150
150
|
}
|
|
151
151
|
//#endregion
|
|
152
152
|
//#region src/interaction/focus-overview.tsx
|
|
153
|
-
function
|
|
154
|
-
let r = e.geometry?.series[n], i = e.xToPixel(t.startX), a = e.xToPixel(t.endX);
|
|
153
|
+
function nt({ snapshot: e, range: t, series: n }) {
|
|
154
|
+
let r = (e.drawGeometry ?? e.geometry)?.series[n], i = e.xToPixel(t.startX), a = e.xToPixel(t.endX);
|
|
155
155
|
return /* @__PURE__ */ Q("div", {
|
|
156
156
|
className: "lilt-chart__overview",
|
|
157
157
|
children: /* @__PURE__ */ $("svg", {
|
|
@@ -189,28 +189,28 @@ function tt({ snapshot: e, range: t, series: n }) {
|
|
|
189
189
|
}
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region src/toolkit/chart-overview.tsx
|
|
192
|
-
function
|
|
192
|
+
function rt({ className: e }) {
|
|
193
193
|
let t = N();
|
|
194
194
|
return t.overview ? /* @__PURE__ */ Q("div", {
|
|
195
195
|
className: ["lilt-chart__overview-host", e].filter(Boolean).join(" "),
|
|
196
|
-
children: /* @__PURE__ */ Q(
|
|
196
|
+
children: /* @__PURE__ */ Q(nt, { ...t.overview })
|
|
197
197
|
}) : null;
|
|
198
198
|
}
|
|
199
199
|
//#endregion
|
|
200
200
|
//#region src/interaction/brush-gesture.ts
|
|
201
|
-
function
|
|
201
|
+
function it(e, t, n) {
|
|
202
202
|
return Math.max(t, Math.min(n, e));
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
if (e.kind === "start") return [
|
|
206
|
-
if (e.kind === "end") return [e.start,
|
|
204
|
+
function at(e, t, n) {
|
|
205
|
+
if (e.kind === "start") return [it(t, 0, e.end - 1), e.end];
|
|
206
|
+
if (e.kind === "end") return [e.start, it(t, e.start + 1, n)];
|
|
207
207
|
if (e.kind === "move") {
|
|
208
|
-
let r = e.end - e.start, i =
|
|
208
|
+
let r = e.end - e.start, i = it(e.start + t - e.anchor, 0, n - r);
|
|
209
209
|
return [i, i + r];
|
|
210
210
|
}
|
|
211
|
-
return t === e.anchor ? t - e.start <= e.end - t ? [
|
|
211
|
+
return t === e.anchor ? t - e.start <= e.end - t ? [it(t, 0, e.end - 1), e.end] : [e.start, it(t, e.start + 1, n)] : [Math.min(e.anchor, t), Math.max(e.anchor, t)];
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function ot() {
|
|
214
214
|
let e = null;
|
|
215
215
|
return {
|
|
216
216
|
get active() {
|
|
@@ -220,11 +220,11 @@ function at() {
|
|
|
220
220
|
e = t;
|
|
221
221
|
},
|
|
222
222
|
move(t, n) {
|
|
223
|
-
return e ?
|
|
223
|
+
return e ? at(e, t, n) : null;
|
|
224
224
|
},
|
|
225
225
|
finish(t, n) {
|
|
226
226
|
let r = e;
|
|
227
|
-
return e = null, r ?
|
|
227
|
+
return e = null, r ? at(r, t, n) : null;
|
|
228
228
|
},
|
|
229
229
|
cancel() {
|
|
230
230
|
e = null;
|
|
@@ -233,12 +233,12 @@ function at() {
|
|
|
233
233
|
}
|
|
234
234
|
//#endregion
|
|
235
235
|
//#region src/interaction/brush-view.tsx
|
|
236
|
-
var
|
|
237
|
-
function
|
|
236
|
+
var st = 14, ct = 1e3, lt = 56;
|
|
237
|
+
function ut(e, t, n) {
|
|
238
238
|
return Math.max(t, Math.min(n, e));
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
let a = e.data.rows, o = a.length - 1, s = a[0].x, c = a[o].x, l = We(null), u = We(
|
|
240
|
+
function dt({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }) {
|
|
241
|
+
let a = e.data.rows, o = a.length - 1, s = a[0].x, c = a[o].x, l = We(null), u = We(ot()), [d, f] = X(null), [p, m] = X(null), [h, g] = X(null), _ = Ve().replace(/:/g, ""), v = `lilt-brush-clip-${_}`, y = `lilt-brush-fill-${_}`, ee = `lilt-brush-hint-${_}`, te = (e) => {
|
|
242
242
|
let t = 0, n = o;
|
|
243
243
|
for (; t < n;) {
|
|
244
244
|
let r = Math.floor((t + n) / 2);
|
|
@@ -249,7 +249,7 @@ function ut({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
249
249
|
}, b = t ? te(Math.min(t.startX, t.endX)) : 0, x = t ? te(Math.max(t.startX, t.endX)) : o, [S, C] = d ?? [b, x], ne = (e) => {
|
|
250
250
|
let t = l.current?.getBoundingClientRect();
|
|
251
251
|
if (!t || t.width <= 28) return 0;
|
|
252
|
-
let n =
|
|
252
|
+
let n = ut((e - t.left - st) / (t.width - 28), 0, 1);
|
|
253
253
|
return te(s + n * (c - s));
|
|
254
254
|
}, w = (e, t) => {
|
|
255
255
|
e >= t || e === b && t === x || i(e === 0 && t === o ? null : {
|
|
@@ -308,13 +308,13 @@ function ut({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
308
308
|
default: return;
|
|
309
309
|
}
|
|
310
310
|
e.preventDefault(), e.stopPropagation();
|
|
311
|
-
let s =
|
|
311
|
+
let s = ut(a, r, i);
|
|
312
312
|
t === "start" ? w(s, C) : w(S, s);
|
|
313
|
-
}, k = (e) => (a[e].x - s) / Math.max(1e-9, c - s) * 100, A = k(S), j = k(C), M = e.geometry?.series[n], N = e.geometry?.bars[n] ?? [], P = (t) => (t - e.plot.left) / Math.max(1, e.plot.width) *
|
|
313
|
+
}, k = (e) => (a[e].x - s) / Math.max(1e-9, c - s) * 100, A = k(S), j = k(C), M = (e.drawGeometry ?? e.geometry)?.series[n], N = e.geometry?.bars[n] ?? [], P = (t) => (t - e.plot.left) / Math.max(1, e.plot.width) * ct, F = (t) => 5 + (t - e.plot.top) / Math.max(1, e.plot.height) * 46, I = M?.segments.map((e) => {
|
|
314
314
|
let t = e.points[0], n = e.points[e.points.length - 1], r = [`M${P(t.x)},${F(t.y)}`, ...e.pieces.map((e) => e.kind === "line" ? `L${P(e.to.x)},${F(e.to.y)}` : `C${P(e.control1.x)},${F(e.control1.y)} ${P(e.control2.x)},${F(e.control2.y)} ${P(e.to.x)},${F(e.to.y)}`)].join(" ");
|
|
315
315
|
return {
|
|
316
316
|
path: r,
|
|
317
|
-
area: `${r} L${P(n.x)},${
|
|
317
|
+
area: `${r} L${P(n.x)},${lt} L${P(t.x)},${lt} Z`
|
|
318
318
|
};
|
|
319
319
|
}), L = S === 0 && C === o, R = d ? `${e.formatX(a[S].x)}–${e.formatX(a[C].x)} · ${C - S + 1} observations` : L ? "Full range" : `${C - S + 1} observations`, z = r || d ? { duration: 0 } : {
|
|
320
320
|
type: "spring",
|
|
@@ -323,14 +323,14 @@ function ut({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
323
323
|
mass: .85
|
|
324
324
|
}, B = N.map((t) => /* @__PURE__ */ Q("rect", {
|
|
325
325
|
height: Math.max(1, t.height / Math.max(1, e.plot.height) * 46),
|
|
326
|
-
width: Math.max(1, t.width / Math.max(1, e.plot.width) *
|
|
326
|
+
width: Math.max(1, t.width / Math.max(1, e.plot.width) * ct),
|
|
327
327
|
x: P(t.x),
|
|
328
328
|
y: F(t.y)
|
|
329
|
-
}, t.valueX)),
|
|
329
|
+
}, t.valueX)), ie = /* @__PURE__ */ $(Z, { children: [I?.map(({ path: e }, t) => /* @__PURE__ */ Q("path", { d: e }, t)), M?.isolated.map((e, t) => /* @__PURE__ */ Q("circle", {
|
|
330
330
|
cx: P(e.x),
|
|
331
331
|
cy: F(e.y),
|
|
332
332
|
r: "3"
|
|
333
|
-
}, `point-${t}`))] }),
|
|
333
|
+
}, `point-${t}`))] }), ae = I?.map(({ area: e }, t) => /* @__PURE__ */ Q("path", { d: e }, t));
|
|
334
334
|
return /* @__PURE__ */ $("div", {
|
|
335
335
|
"aria-label": "Focus range",
|
|
336
336
|
className: "lilt-chart__brush",
|
|
@@ -386,7 +386,7 @@ function ut({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
386
386
|
/* @__PURE__ */ $("svg", {
|
|
387
387
|
"aria-hidden": "true",
|
|
388
388
|
preserveAspectRatio: "none",
|
|
389
|
-
viewBox: `0 0 ${
|
|
389
|
+
viewBox: `0 0 ${ct} ${lt}`,
|
|
390
390
|
children: [/* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q("clipPath", {
|
|
391
391
|
id: v,
|
|
392
392
|
children: /* @__PURE__ */ Q(qe.rect, {
|
|
@@ -394,7 +394,7 @@ function ut({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
394
394
|
x: A * 10,
|
|
395
395
|
width: (j - A) * 10
|
|
396
396
|
},
|
|
397
|
-
height:
|
|
397
|
+
height: lt,
|
|
398
398
|
initial: !1,
|
|
399
399
|
transition: z,
|
|
400
400
|
y: "0"
|
|
@@ -426,22 +426,22 @@ function ut({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
426
426
|
})] }) : /* @__PURE__ */ $(Z, { children: [
|
|
427
427
|
/* @__PURE__ */ Q("g", {
|
|
428
428
|
className: "lilt-chart__brush-area",
|
|
429
|
-
children:
|
|
429
|
+
children: ae
|
|
430
430
|
}),
|
|
431
431
|
/* @__PURE__ */ Q("g", {
|
|
432
432
|
className: "lilt-chart__brush-area lilt-chart__brush-area--active",
|
|
433
433
|
clipPath: `url(#${v})`,
|
|
434
434
|
style: { fill: `url(#${y})` },
|
|
435
|
-
children:
|
|
435
|
+
children: ae
|
|
436
436
|
}),
|
|
437
437
|
/* @__PURE__ */ Q("g", {
|
|
438
438
|
className: "lilt-chart__brush-line",
|
|
439
|
-
children:
|
|
439
|
+
children: ie
|
|
440
440
|
}),
|
|
441
441
|
/* @__PURE__ */ Q("g", {
|
|
442
442
|
className: "lilt-chart__brush-line lilt-chart__brush-line--active",
|
|
443
443
|
clipPath: `url(#${v})`,
|
|
444
|
-
children:
|
|
444
|
+
children: ie
|
|
445
445
|
})
|
|
446
446
|
] })]
|
|
447
447
|
}),
|
|
@@ -525,22 +525,22 @@ function ut({ snapshot: e, range: t, seriesId: n, reducedMotion: r, onFocus: i }
|
|
|
525
525
|
}
|
|
526
526
|
//#endregion
|
|
527
527
|
//#region src/toolkit/chart-brush.tsx
|
|
528
|
-
function
|
|
528
|
+
function ft({ className: e }) {
|
|
529
529
|
let t = N();
|
|
530
530
|
return t.brush ? /* @__PURE__ */ Q("div", {
|
|
531
531
|
className: ["lilt-chart__brush-host", e].filter(Boolean).join(" "),
|
|
532
|
-
children: /* @__PURE__ */ Q(
|
|
532
|
+
children: /* @__PURE__ */ Q(dt, { ...t.brush })
|
|
533
533
|
}) : null;
|
|
534
534
|
}
|
|
535
535
|
//#endregion
|
|
536
536
|
//#region src/marks/range-loading-mark.tsx
|
|
537
|
-
var
|
|
538
|
-
function
|
|
537
|
+
var pt = "color-mix(in srgb, var(--lilt-skeleton) 64%, var(--lilt-surface))";
|
|
538
|
+
function mt(e, t = !1) {
|
|
539
539
|
return {
|
|
540
540
|
kind: e,
|
|
541
541
|
depth: e !== "error" && t,
|
|
542
542
|
render: ({ cx: n, low: r, high: i, scales: a, mask: s }) => {
|
|
543
|
-
let c = s ? "white" :
|
|
543
|
+
let c = s ? "white" : pt, l = (r + i) / 2, u = (e) => /* @__PURE__ */ Q("path", {
|
|
544
544
|
d: e,
|
|
545
545
|
fill: "none",
|
|
546
546
|
stroke: c,
|
|
@@ -598,7 +598,7 @@ function pt(e, t = !1) {
|
|
|
598
598
|
}
|
|
599
599
|
//#endregion
|
|
600
600
|
//#region src/primitives/range-bar.tsx
|
|
601
|
-
var
|
|
601
|
+
var ht = _(function({ series: e, low: r, high: o, depth: s = !1, className: c }) {
|
|
602
602
|
let l = _e("RangeBar", e, [r, o], "column"), f = l.snapshot.data.rows;
|
|
603
603
|
i("RangeBar", f, e, [r, o]);
|
|
604
604
|
let h = new y(), g = new a();
|
|
@@ -625,7 +625,7 @@ var mt = _(function({ series: e, low: r, high: o, depth: s = !1, className: c })
|
|
|
625
625
|
});
|
|
626
626
|
}, {
|
|
627
627
|
layout: "column",
|
|
628
|
-
loading: (e) =>
|
|
628
|
+
loading: (e) => mt("range", e.depth),
|
|
629
629
|
series: (e) => e.series,
|
|
630
630
|
fields: (e) => [e.low, e.high],
|
|
631
631
|
highlight: (e, { row: t, snapshot: i, descriptor: o, color: s }) => {
|
|
@@ -645,7 +645,7 @@ var mt = _(function({ series: e, low: r, high: o, depth: s = !1, className: c })
|
|
|
645
645
|
style: { fill: d }
|
|
646
646
|
});
|
|
647
647
|
}
|
|
648
|
-
}),
|
|
648
|
+
}), gt = 3.25, _t = _(function({ series: e, low: r, high: a, point: s = !0, className: c }) {
|
|
649
649
|
let l = _e("ErrorBar", e, [r, a], "column"), u = l.snapshot.data.rows;
|
|
650
650
|
i("ErrorBar", u, e, [
|
|
651
651
|
r,
|
|
@@ -657,7 +657,7 @@ var mt = _(function({ series: e, low: r, high: o, depth: s = !1, className: c })
|
|
|
657
657
|
let t = n(i, e, [r, a]), u = q(l.descriptor, i, l.color);
|
|
658
658
|
t && d.add(u, o(c, t[0], t[1], l.scales));
|
|
659
659
|
let p = i.values[e];
|
|
660
|
-
s && p != null && f.add(u, R(c, l.scales.y(p),
|
|
660
|
+
s && p != null && f.add(u, R(c, l.scales.y(p), gt));
|
|
661
661
|
}
|
|
662
662
|
return /* @__PURE__ */ $("g", {
|
|
663
663
|
"aria-hidden": "true",
|
|
@@ -686,7 +686,7 @@ var mt = _(function({ series: e, low: r, high: o, depth: s = !1, className: c })
|
|
|
686
686
|
});
|
|
687
687
|
}, {
|
|
688
688
|
layout: "column",
|
|
689
|
-
loading: () =>
|
|
689
|
+
loading: () => mt("error"),
|
|
690
690
|
series: (e) => e.series,
|
|
691
691
|
fields: (e) => [e.low, e.high],
|
|
692
692
|
highlight: (e, { row: t, snapshot: i, descriptor: a, color: s }) => {
|
|
@@ -708,8 +708,8 @@ var mt = _(function({ series: e, low: r, high: o, depth: s = !1, className: c })
|
|
|
708
708
|
}
|
|
709
709
|
}) : null] });
|
|
710
710
|
}
|
|
711
|
-
}),
|
|
712
|
-
function
|
|
711
|
+
}), vt = 2.5, yt = (e) => `color-mix(in oklab, ${e} 44%, var(--lilt-surface))`;
|
|
712
|
+
function bt(e, t) {
|
|
713
713
|
let r = n(e, t.series, [
|
|
714
714
|
t.min,
|
|
715
715
|
t.q1,
|
|
@@ -724,11 +724,11 @@ function yt(e, t) {
|
|
|
724
724
|
max: r[3]
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
|
-
function
|
|
727
|
+
function xt(e, t, n, r = 0) {
|
|
728
728
|
let i = n.x(e.x);
|
|
729
|
-
return (t.outliers?.(e.datum) ?? []).filter((e) => Number.isFinite(e)).map((e) => R(i, n.y(e) - r,
|
|
729
|
+
return (t.outliers?.(e.datum) ?? []).filter((e) => Number.isFinite(e)).map((e) => R(i, n.y(e) - r, vt)).join("");
|
|
730
730
|
}
|
|
731
|
-
var
|
|
731
|
+
var St = _(function(e) {
|
|
732
732
|
let { series: n, min: r, q1: o, q3: s, max: c, className: l } = e, f = _e("BoxPlot", n, [
|
|
733
733
|
r,
|
|
734
734
|
o,
|
|
@@ -744,17 +744,17 @@ var xt = _(function(e) {
|
|
|
744
744
|
]);
|
|
745
745
|
let m = new y(), g = new a(), _ = new y(), v = new y(), ee = new y();
|
|
746
746
|
for (let { row: n, cx: r } of t(p, f.scales)) {
|
|
747
|
-
let t =
|
|
747
|
+
let t = bt(n, e);
|
|
748
748
|
if (!t) continue;
|
|
749
749
|
let i = q(f.descriptor, n, f.color), a = 0;
|
|
750
750
|
if (e.depth) {
|
|
751
751
|
let e = h(r, t, f.scales);
|
|
752
|
-
a = e.lift, g.add(
|
|
752
|
+
a = e.lift, g.add(yt(i), e.faces), _.add(i, e.lower), v.add(i, e.median + e.upper);
|
|
753
753
|
} else {
|
|
754
754
|
let e = z(r, t, f.scales);
|
|
755
755
|
m.add(i, e.box), v.add(i, e.median + e.whiskers);
|
|
756
756
|
}
|
|
757
|
-
let o =
|
|
757
|
+
let o = xt(n, e, f.scales, a);
|
|
758
758
|
o && ee.add(i, o);
|
|
759
759
|
}
|
|
760
760
|
return /* @__PURE__ */ $("g", {
|
|
@@ -804,7 +804,7 @@ var xt = _(function(e) {
|
|
|
804
804
|
});
|
|
805
805
|
}, {
|
|
806
806
|
layout: "column",
|
|
807
|
-
loading: (e) =>
|
|
807
|
+
loading: (e) => mt("boxplot", e.depth),
|
|
808
808
|
series: (e) => e.series,
|
|
809
809
|
fields: (e) => [
|
|
810
810
|
e.min,
|
|
@@ -813,11 +813,11 @@ var xt = _(function(e) {
|
|
|
813
813
|
e.max
|
|
814
814
|
],
|
|
815
815
|
highlight: (e, { row: t, snapshot: n, descriptor: i, color: o }) => {
|
|
816
|
-
let s =
|
|
816
|
+
let s = bt(t, e);
|
|
817
817
|
if (!s) return null;
|
|
818
818
|
let c = r(n, e.series), l = c.x(t.x), d = z(l, s, c), f = q(i, t, o);
|
|
819
819
|
if (e.depth) {
|
|
820
|
-
let n = h(l, s, c), r =
|
|
820
|
+
let n = h(l, s, c), r = xt(t, e, c, n.lift), i = new a();
|
|
821
821
|
i.add(`color-mix(in oklab, ${f} 58%, var(--lilt-surface))`, n.faces);
|
|
822
822
|
let o = (e, t) => /* @__PURE__ */ Q("path", {
|
|
823
823
|
d: e,
|
|
@@ -837,7 +837,7 @@ var xt = _(function(e) {
|
|
|
837
837
|
}) : null
|
|
838
838
|
] });
|
|
839
839
|
}
|
|
840
|
-
let p =
|
|
840
|
+
let p = xt(t, e, c);
|
|
841
841
|
return /* @__PURE__ */ $(Z, { children: [
|
|
842
842
|
/* @__PURE__ */ Q("path", {
|
|
843
843
|
d: d.box,
|
|
@@ -864,7 +864,7 @@ var xt = _(function(e) {
|
|
|
864
864
|
});
|
|
865
865
|
//#endregion
|
|
866
866
|
//#region src/engine/box.ts
|
|
867
|
-
function
|
|
867
|
+
function Ct(e) {
|
|
868
868
|
let t = e.filter((e) => Number.isFinite(e)).sort((e, t) => e - t);
|
|
869
869
|
if (!t.length) return null;
|
|
870
870
|
let n = Ze(t, .25), r = Ze(t, .5), i = Ze(t, .75), a = (i - n) * 1.5, o = t.filter((e) => e >= n - a && e <= i + a);
|
|
@@ -880,7 +880,7 @@ function St(e) {
|
|
|
880
880
|
}
|
|
881
881
|
//#endregion
|
|
882
882
|
//#region src/export-chart-svg.ts
|
|
883
|
-
var
|
|
883
|
+
var wt = [
|
|
884
884
|
"color",
|
|
885
885
|
"fill",
|
|
886
886
|
"fill-opacity",
|
|
@@ -900,7 +900,7 @@ var Ct = [
|
|
|
900
900
|
"paint-order",
|
|
901
901
|
"vector-effect"
|
|
902
902
|
];
|
|
903
|
-
function
|
|
903
|
+
function Tt(e, t) {
|
|
904
904
|
if (!t.title.trim()) throw Error("Lilt SVG export requires an accessible title.");
|
|
905
905
|
let n = e instanceof SVGSVGElement ? e : e.querySelector(".lilt-chart__svg, .lilt-radial__svg, .lilt-radial-progress svg, .lilt-scatter__svg, .lilt-sankey__svg, .lilt-radar__svg");
|
|
906
906
|
if (!(n instanceof SVGSVGElement)) throw Error("Lilt SVG export supports SVG-backed chart plots. This chart has no SVG plot.");
|
|
@@ -909,7 +909,7 @@ function wt(e, t) {
|
|
|
909
909
|
let o = n.cloneNode(!0), s = [n, ...n.querySelectorAll("*")], c = [o, ...o.querySelectorAll("*")];
|
|
910
910
|
for (let e = 0; e < s.length; e += 1) {
|
|
911
911
|
let t = s[e], n = c[e], r = getComputedStyle(t);
|
|
912
|
-
for (let e of
|
|
912
|
+
for (let e of wt) {
|
|
913
913
|
let t = r.getPropertyValue(e);
|
|
914
914
|
t && n.style.setProperty(e, t);
|
|
915
915
|
}
|
|
@@ -931,11 +931,11 @@ function wt(e, t) {
|
|
|
931
931
|
}
|
|
932
932
|
//#endregion
|
|
933
933
|
//#region src/interaction/legend.tsx
|
|
934
|
-
var
|
|
935
|
-
function
|
|
934
|
+
var Et = () => () => void 0, Dt = () => null;
|
|
935
|
+
function Ot(e = {}) {
|
|
936
936
|
let { model: t, className: n, style: r, variant: i = "cards", swatch: a = "square", by: o = "series", series: s, interactive: c = !0, allowIsolate: l = !1, renderValue: u, renderLabel: d, renderSwatch: f, renderDifference: p, renderItem: m } = e, h = F();
|
|
937
937
|
if (t && t !== h.model) throw Error("Lilt Legend model must be the model supplied to its Chart.");
|
|
938
|
-
let { legend: g } = N(), _ = Ge(t?.subscribe ??
|
|
938
|
+
let { legend: g } = N(), _ = Ge(t?.subscribe ?? Et, t?.getSnapshot ?? Dt, t?.getSnapshot ?? Dt);
|
|
939
939
|
if (!g) return null;
|
|
940
940
|
let v = t ? _?.legend ?? [] : g.series, y = t ? _?.inspection?.x ?? null : g.inspectedX, ee = t ? _?.inspection?.pinned ? _.inspection.x : null : g.pinnedX, te = v.filter((e) => e.visible).map((e) => e.id), b = v.find((e) => e.id === s) ?? v.find((e) => e.visible) ?? v[0], x = t ? _?.observations ?? [] : g.observations, S = o === "observation" ? b ? x.map((e) => ({
|
|
941
941
|
id: e.id,
|
|
@@ -1046,7 +1046,7 @@ function Dt(e = {}) {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
//#endregion
|
|
1048
1048
|
//#region src/primitives/change-comparison.tsx
|
|
1049
|
-
function
|
|
1049
|
+
function kt({ data: e, label: t, series: n, className: r }) {
|
|
1050
1050
|
let i = L(), a = n ?? i.series[0]?.id, o = i.series.find((e) => e.id === a), s = Ue(() => {
|
|
1051
1051
|
if (!o || !i.snapshot.yDomain) return null;
|
|
1052
1052
|
try {
|
|
@@ -1084,10 +1084,10 @@ function Ot({ data: e, label: t, series: n, className: r }) {
|
|
|
1084
1084
|
let p = d.filter((e) => e.length > 1 && l).map((e) => {
|
|
1085
1085
|
let t = i.snapshot.xToPixel(e[0].x), n = i.snapshot.xToPixel(e.at(-1).x), r = Math.max(8, (e.length - 1) * 8), a = Array.from({ length: r + 1 }, (e, i) => {
|
|
1086
1086
|
let a = t + (n - t) * i / r;
|
|
1087
|
-
return
|
|
1087
|
+
return U(l, a);
|
|
1088
1088
|
}), o = Array.from({ length: r + 1 }, (e, i) => {
|
|
1089
1089
|
let a = n - (n - t) * i / r;
|
|
1090
|
-
return
|
|
1090
|
+
return U(c, a);
|
|
1091
1091
|
});
|
|
1092
1092
|
if (a.some((e) => !e) || o.some((e) => !e)) return null;
|
|
1093
1093
|
let s = a.map((e, t) => `${t === 0 ? "M" : "L"}${e.x},${e.y}`), u = o.map((e) => `L${e.x},${e.y}`);
|
|
@@ -1121,7 +1121,7 @@ function Ot({ data: e, label: t, series: n, className: r }) {
|
|
|
1121
1121
|
}
|
|
1122
1122
|
//#endregion
|
|
1123
1123
|
//#region src/interaction/use-pinned-selection.ts
|
|
1124
|
-
function
|
|
1124
|
+
function At(e, t) {
|
|
1125
1125
|
let [n, r] = X(null), i = e === void 0 ? n : e, a = We({
|
|
1126
1126
|
selected: i,
|
|
1127
1127
|
controlled: e,
|
|
@@ -1140,11 +1140,11 @@ function kt(e, t) {
|
|
|
1140
1140
|
ze(() => r(null), [])
|
|
1141
1141
|
];
|
|
1142
1142
|
}
|
|
1143
|
-
function
|
|
1143
|
+
function jt(e, t, n) {
|
|
1144
1144
|
let r = (n.ownerDocument.elementFromPoint?.(e, t))?.closest("[data-glide-id]");
|
|
1145
1145
|
return r && n.contains(r) ? r.getAttribute("data-glide-id") : null;
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1147
|
+
function Mt(e) {
|
|
1148
1148
|
let t = We(e);
|
|
1149
1149
|
t.current = e;
|
|
1150
1150
|
let { disabled: n } = e, [r, i] = X(null);
|
|
@@ -1215,7 +1215,7 @@ function jt(e) {
|
|
|
1215
1215
|
}
|
|
1216
1216
|
//#endregion
|
|
1217
1217
|
//#region src/interaction/use-category-state.ts
|
|
1218
|
-
function
|
|
1218
|
+
function Nt(e, t, n) {
|
|
1219
1219
|
let r = We({
|
|
1220
1220
|
key: n,
|
|
1221
1221
|
rows: null
|
|
@@ -1237,9 +1237,9 @@ function Mt(e, t, n) {
|
|
|
1237
1237
|
skeleton: o
|
|
1238
1238
|
};
|
|
1239
1239
|
}
|
|
1240
|
-
function
|
|
1241
|
-
let [l, u] = X(null), [d, f] = X(null), [p, m, h] =
|
|
1242
|
-
resolve:
|
|
1240
|
+
function Pt(e, t, n, r, i = 1, a, o, s = !0, c) {
|
|
1241
|
+
let [l, u] = X(null), [d, f] = X(null), [p, m, h] = At(a, o), g = e.some((e) => e.id === p) ? p : null, [_, v] = X(null), y = We(/* @__PURE__ */ new Map()), ee = Mt({
|
|
1242
|
+
resolve: jt,
|
|
1243
1243
|
onGlide: u,
|
|
1244
1244
|
onLift: (e) => e !== null && m(e),
|
|
1245
1245
|
disabled: !t
|
|
@@ -1306,8 +1306,8 @@ function Nt(e, t, n, r, i = 1, a, o, s = !0, c) {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
//#endregion
|
|
1308
1308
|
//#region src/toolkit/chart-range-summary.tsx
|
|
1309
|
-
function
|
|
1310
|
-
let n = F(), r = Ge(n.controller.subscribe, () => n.controller.getSnapshot().focus, () => n.controller.getSnapshot().focus), { props: i } = n, a =
|
|
1309
|
+
function Ft({ series: e, className: t }) {
|
|
1310
|
+
let n = F(), r = Ge(n.controller.subscribe, () => n.controller.getSnapshot().focus, () => n.controller.getSnapshot().focus), { props: i } = n, a = Nt(i.data, i.status ?? "ready", i.resetKey), o = i.series.find((t) => t.id === (e ?? i.series[0]?.id)), s = Ue(() => {
|
|
1311
1311
|
if (!o || i.x.type === "category" || !a.rows) return {
|
|
1312
1312
|
value: null,
|
|
1313
1313
|
error: null
|
|
@@ -1361,20 +1361,20 @@ function Pt({ series: e, className: t }) {
|
|
|
1361
1361
|
}
|
|
1362
1362
|
//#endregion
|
|
1363
1363
|
//#region src/cards/area-chart-card.tsx
|
|
1364
|
-
function
|
|
1365
|
-
return /* @__PURE__ */ Q(
|
|
1364
|
+
function It({ stack: e, curve: t = "smooth", ...n }) {
|
|
1365
|
+
return /* @__PURE__ */ Q(V, {
|
|
1366
1366
|
...n,
|
|
1367
1367
|
shape: {
|
|
1368
1368
|
kind: "area",
|
|
1369
|
-
stack:
|
|
1369
|
+
stack: ue(e),
|
|
1370
1370
|
curve: t === "linear" ? "linear" : "monotone"
|
|
1371
1371
|
}
|
|
1372
1372
|
});
|
|
1373
1373
|
}
|
|
1374
1374
|
//#endregion
|
|
1375
1375
|
//#region src/cards/line-chart-card.tsx
|
|
1376
|
-
function
|
|
1377
|
-
return /* @__PURE__ */ Q(
|
|
1376
|
+
function Lt({ curve: e = "smooth", points: t = !1, baseline: n = "auto", ...r }) {
|
|
1377
|
+
return /* @__PURE__ */ Q(V, {
|
|
1378
1378
|
...r,
|
|
1379
1379
|
shape: {
|
|
1380
1380
|
kind: "line",
|
|
@@ -1386,13 +1386,13 @@ function It({ curve: e = "smooth", points: t = !1, baseline: n = "auto", ...r })
|
|
|
1386
1386
|
}
|
|
1387
1387
|
//#endregion
|
|
1388
1388
|
//#region src/cards/bar-chart-card.tsx
|
|
1389
|
-
function
|
|
1390
|
-
return /* @__PURE__ */ Q(
|
|
1389
|
+
function Rt({ stack: e, radius: t = 6, corners: n = "end", tracks: r = !1, barWidth: i, depth: a = !1, barStyle: o = a ? "isometric" : "solid", ...s }) {
|
|
1390
|
+
return /* @__PURE__ */ Q(V, {
|
|
1391
1391
|
...s,
|
|
1392
1392
|
depth: a,
|
|
1393
1393
|
shape: {
|
|
1394
1394
|
kind: "bar",
|
|
1395
|
-
stack:
|
|
1395
|
+
stack: ue(e),
|
|
1396
1396
|
radius: t,
|
|
1397
1397
|
corners: n,
|
|
1398
1398
|
tracks: r,
|
|
@@ -1403,11 +1403,11 @@ function Lt({ stack: e, radius: t = 6, corners: n = "end", tracks: r = !1, barWi
|
|
|
1403
1403
|
}
|
|
1404
1404
|
//#endregion
|
|
1405
1405
|
//#region src/lifecycle/skeleton-sheen.tsx
|
|
1406
|
-
var
|
|
1406
|
+
var zt = "color-mix(in srgb, var(--lilt-skeleton) 64%, var(--lilt-surface))", Bt = {
|
|
1407
1407
|
"--lilt-skeleton-paint": "white",
|
|
1408
1408
|
"--lilt-skeleton-gap": "black"
|
|
1409
1409
|
};
|
|
1410
|
-
function
|
|
1410
|
+
function Vt({ children: e, mask: t, sweep: n, loadingStyle: r = "shimmer", depth: i = !1, width: a, height: o, x: c = 0, y: l = 0, reduced: u = !1 }) {
|
|
1411
1411
|
let d = Ve().replace(/:/g, ""), f = s(!0, r), p = Math.max(a * .3, Math.min(a, 60)), m = n !== void 0 && !u && r !== "shimmer";
|
|
1412
1412
|
return /* @__PURE__ */ $("g", {
|
|
1413
1413
|
ref: f,
|
|
@@ -1461,7 +1461,7 @@ function Bt({ children: e, mask: t, sweep: n, loadingStyle: r = "shimmer", depth
|
|
|
1461
1461
|
width: a,
|
|
1462
1462
|
height: o,
|
|
1463
1463
|
children: /* @__PURE__ */ Q("g", {
|
|
1464
|
-
style:
|
|
1464
|
+
style: Bt,
|
|
1465
1465
|
children: t ?? e
|
|
1466
1466
|
})
|
|
1467
1467
|
})] }), /* @__PURE__ */ Q("g", {
|
|
@@ -1484,12 +1484,12 @@ function Bt({ children: e, mask: t, sweep: n, loadingStyle: r = "shimmer", depth
|
|
|
1484
1484
|
}
|
|
1485
1485
|
//#endregion
|
|
1486
1486
|
//#region src/cards/stat-card.tsx
|
|
1487
|
-
var
|
|
1488
|
-
function
|
|
1487
|
+
var Ht = [], Ut = 28, Wt = "var(--lilt-series-1)", Gt = "color-mix(in oklab, var(--lilt-muted) 16%, var(--lilt-surface))";
|
|
1488
|
+
function Kt(e, t = Ut) {
|
|
1489
1489
|
let n = Math.max(0, Math.min(1, e)) * t;
|
|
1490
1490
|
return Array.from({ length: t }, (e, t) => Math.max(0, Math.min(1, n - t)));
|
|
1491
1491
|
}
|
|
1492
|
-
function
|
|
1492
|
+
function qt({ value: e, target: t, height: n, depth: r = !1, formatValue: i }) {
|
|
1493
1493
|
let a = e === null || t <= 0 ? 0 : e / t, o = new Intl.NumberFormat("en-US", {
|
|
1494
1494
|
style: "percent",
|
|
1495
1495
|
maximumFractionDigits: 0
|
|
@@ -1517,7 +1517,7 @@ function Kt({ value: e, target: t, height: n, depth: r = !1, formatValue: i }) {
|
|
|
1517
1517
|
"aria-valuemax": t,
|
|
1518
1518
|
"aria-valuenow": e ?? 0,
|
|
1519
1519
|
style: { height: n },
|
|
1520
|
-
children:
|
|
1520
|
+
children: Kt(a).map((e, t) => /* @__PURE__ */ Q("span", {
|
|
1521
1521
|
className: "lilt-stat__cell",
|
|
1522
1522
|
children: e > 0 ? /* @__PURE__ */ Q("span", {
|
|
1523
1523
|
className: "lilt-stat__cell-fill",
|
|
@@ -1531,7 +1531,7 @@ function Kt({ value: e, target: t, height: n, depth: r = !1, formatValue: i }) {
|
|
|
1531
1531
|
})]
|
|
1532
1532
|
});
|
|
1533
1533
|
}
|
|
1534
|
-
function
|
|
1534
|
+
function Jt({ value: t, target: n, size: r, reduced: i, loading: a = !1, loadingStyle: o = "shimmer", depth: s = !1, formatValue: c }) {
|
|
1535
1535
|
let l = t === null || n <= 0 ? null : Math.max(0, t / n), u = Math.max(4, Math.round(r / 9)), d = (r - u) / 2, f = new Intl.NumberFormat("en-US", {
|
|
1536
1536
|
style: "percent",
|
|
1537
1537
|
maximumFractionDigits: 0
|
|
@@ -1575,7 +1575,7 @@ function qt({ value: t, target: n, size: r, reduced: i, loading: a = !1, loading
|
|
|
1575
1575
|
viewBox: `0 0 ${r} ${r}`,
|
|
1576
1576
|
width: r,
|
|
1577
1577
|
height: r,
|
|
1578
|
-
children: a ? /* @__PURE__ */ Q(
|
|
1578
|
+
children: a ? /* @__PURE__ */ Q(Vt, {
|
|
1579
1579
|
width: r,
|
|
1580
1580
|
height: r,
|
|
1581
1581
|
reduced: i,
|
|
@@ -1597,24 +1597,24 @@ function qt({ value: t, target: n, size: r, reduced: i, loading: a = !1, loading
|
|
|
1597
1597
|
children: s ? e(u).map((e, t) => /* @__PURE__ */ Q(Re, { children: m({
|
|
1598
1598
|
width: e.strokeWidth,
|
|
1599
1599
|
transform: e.transform,
|
|
1600
|
-
stroke: g(
|
|
1600
|
+
stroke: g(zt, e.amount)
|
|
1601
1601
|
}, !0) }, t)) : m(void 0, !0)
|
|
1602
1602
|
}) : s ? /* @__PURE__ */ $(Z, { children: [
|
|
1603
|
-
/* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(
|
|
1603
|
+
/* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(le, {
|
|
1604
1604
|
id: `${p}-shadow`,
|
|
1605
1605
|
size: 2.5
|
|
1606
1606
|
}) }),
|
|
1607
1607
|
e(u, "groove").map((e, t) => /* @__PURE__ */ Q(Re, { children: m({
|
|
1608
1608
|
width: e.strokeWidth,
|
|
1609
1609
|
transform: e.transform,
|
|
1610
|
-
stroke: g(
|
|
1610
|
+
stroke: g(Gt, e.amount)
|
|
1611
1611
|
}) }, `track-${t}`)),
|
|
1612
1612
|
l ? /* @__PURE__ */ Q("g", {
|
|
1613
1613
|
filter: `url(#${p}-shadow)`,
|
|
1614
1614
|
children: e(u).map((e, t) => /* @__PURE__ */ Q(Re, { children: h({
|
|
1615
1615
|
width: e.strokeWidth,
|
|
1616
1616
|
transform: e.transform,
|
|
1617
|
-
stroke: g(
|
|
1617
|
+
stroke: g(Wt, e.amount)
|
|
1618
1618
|
}) }, `fill-${t}`))
|
|
1619
1619
|
}) : null
|
|
1620
1620
|
] }) : /* @__PURE__ */ $(Z, { children: [m(), l ? h() : null] })
|
|
@@ -1624,13 +1624,13 @@ function qt({ value: t, target: n, size: r, reduced: i, loading: a = !1, loading
|
|
|
1624
1624
|
})]
|
|
1625
1625
|
});
|
|
1626
1626
|
}
|
|
1627
|
-
var
|
|
1628
|
-
function
|
|
1629
|
-
let P =
|
|
1627
|
+
var Yt = (e) => e.acceptedRevision;
|
|
1628
|
+
function Xt({ title: e, data: t = Ht, value: n, x: r, xType: i, headline: a, aggregate: o = "sum", delta: u, deltaTone: d, caption: p, chart: m = "area", depth: h = !1, barStyle: g = h ? "isometric" : "solid", target: _, sync: v, height: y, color: ee, aside: te, valueFormat: b, locale: x, formatValue: S, formatX: C, surface: ne = "elevated", badge: w, numberStyle: T, palette: O, loading: k = !1, motion: A, loadingStyle: j = "shimmer", className: M, style: N }) {
|
|
1629
|
+
let P = de({
|
|
1630
1630
|
valueFormat: b,
|
|
1631
1631
|
locale: x,
|
|
1632
1632
|
formatValue: S
|
|
1633
|
-
}), F = n ?? "", I = m === "bars", L = (m === "area" || m === "line" || I) && !!n, R = L ? t :
|
|
1633
|
+
}), F = n ?? "", I = m === "bars", L = (m === "area" || m === "line" || I) && !!n, R = L ? t : Ht, z = Ue(() => {
|
|
1634
1634
|
if (r) return B(R, r, i, C);
|
|
1635
1635
|
let e = new Map(R.map((e, t) => [e, t]));
|
|
1636
1636
|
return {
|
|
@@ -1642,11 +1642,11 @@ function Yt({ title: e, data: t = Vt, value: n, x: r, xType: i, headline: a, agg
|
|
|
1642
1642
|
R,
|
|
1643
1643
|
r,
|
|
1644
1644
|
i
|
|
1645
|
-
]),
|
|
1645
|
+
]), ie = Ue(() => ({
|
|
1646
1646
|
type: z.kind === "time" ? "time" : "number",
|
|
1647
1647
|
accessor: z.position,
|
|
1648
1648
|
format: z.format
|
|
1649
|
-
}), [z]),
|
|
1649
|
+
}), [z]), ae = Ue(() => [{
|
|
1650
1650
|
id: F || "value",
|
|
1651
1651
|
label: e,
|
|
1652
1652
|
color: "var(--lilt-series-1)",
|
|
@@ -1673,21 +1673,21 @@ function Yt({ title: e, data: t = Vt, value: n, x: r, xType: i, headline: a, agg
|
|
|
1673
1673
|
g,
|
|
1674
1674
|
h,
|
|
1675
1675
|
P.stable
|
|
1676
|
-
]),
|
|
1676
|
+
]), oe = Ue(() => ({
|
|
1677
1677
|
includeZero: I,
|
|
1678
1678
|
ticks: 3
|
|
1679
|
-
}), [I]),
|
|
1679
|
+
}), [I]), V = he({
|
|
1680
1680
|
data: R,
|
|
1681
|
-
x:
|
|
1682
|
-
y:
|
|
1683
|
-
series:
|
|
1681
|
+
x: ie,
|
|
1682
|
+
y: oe,
|
|
1683
|
+
series: ae,
|
|
1684
1684
|
status: k ? "loading" : "ready"
|
|
1685
|
-
}),
|
|
1686
|
-
c(r ? v : void 0,
|
|
1685
|
+
}), H = re(V, (e) => e.inspection);
|
|
1686
|
+
c(r ? v : void 0, V.getController(), R, r ?? "", z, {
|
|
1687
1687
|
label: e,
|
|
1688
|
-
release:
|
|
1689
|
-
}), re(
|
|
1690
|
-
let
|
|
1688
|
+
release: V.actions.release
|
|
1689
|
+
}), re(V, Yt);
|
|
1690
|
+
let U = V.series.some((e) => e.id === ae[0].id) ? ae[0].id : null, ce = a ?? (n ? se(D(t, F), o) : null), le = L && H ? H.series[0]?.value ?? null : void 0, ue = le === void 0 ? ce : le, G = y ?? (m === "meter" ? h ? 12 : 10 : I ? 44 : 56), fe = !I, K = xe(A ?? "auto"), me = s(k, j), ge = m === "ring" && _ !== void 0, _e = ge ? `Target ${P.value(_)}` : void 0;
|
|
1691
1691
|
return /* @__PURE__ */ $(je, {
|
|
1692
1692
|
motion: A,
|
|
1693
1693
|
className: ["lilt-stat", M].filter(Boolean).join(" "),
|
|
@@ -1701,31 +1701,31 @@ function Yt({ title: e, data: t = Vt, value: n, x: r, xType: i, headline: a, agg
|
|
|
1701
1701
|
numberStyle: T,
|
|
1702
1702
|
palette: O,
|
|
1703
1703
|
children: [/* @__PURE__ */ $(Ae, {
|
|
1704
|
-
aside: ge ? /* @__PURE__ */ $(Z, { children: [te, /* @__PURE__ */ Q(
|
|
1704
|
+
aside: ge ? /* @__PURE__ */ $(Z, { children: [te, /* @__PURE__ */ Q(Jt, {
|
|
1705
1705
|
loading: k,
|
|
1706
1706
|
loadingStyle: j,
|
|
1707
|
-
value: k ? null :
|
|
1707
|
+
value: k ? null : ce,
|
|
1708
1708
|
target: _,
|
|
1709
1709
|
size: y ?? 56,
|
|
1710
|
-
reduced:
|
|
1710
|
+
reduced: K,
|
|
1711
1711
|
depth: h,
|
|
1712
1712
|
formatValue: P.value
|
|
1713
1713
|
})] }) : te,
|
|
1714
1714
|
children: [
|
|
1715
1715
|
/* @__PURE__ */ Q(De, { children: e }),
|
|
1716
1716
|
/* @__PURE__ */ Q(Ee, {
|
|
1717
|
-
value:
|
|
1717
|
+
value: ue,
|
|
1718
1718
|
format: P.value,
|
|
1719
1719
|
loading: k,
|
|
1720
1720
|
motion: A,
|
|
1721
|
-
children: k ||
|
|
1721
|
+
children: k || le !== void 0 || u === void 0 ? null : /* @__PURE__ */ Q(Te, {
|
|
1722
1722
|
value: u,
|
|
1723
1723
|
tone: d
|
|
1724
1724
|
})
|
|
1725
1725
|
}),
|
|
1726
1726
|
p || r || _e ? /* @__PURE__ */ Q("p", {
|
|
1727
1727
|
className: "lilt-stat__caption",
|
|
1728
|
-
children: k ? "" :
|
|
1728
|
+
children: k ? "" : le === void 0 ? p ?? _e ?? "" : H?.formattedX ?? ""
|
|
1729
1729
|
}) : null
|
|
1730
1730
|
]
|
|
1731
1731
|
}), m === "meter" && _ !== void 0 ? k ? /* @__PURE__ */ $("div", {
|
|
@@ -1734,27 +1734,27 @@ function Yt({ title: e, data: t = Vt, value: n, x: r, xType: i, headline: a, agg
|
|
|
1734
1734
|
"aria-hidden": "true",
|
|
1735
1735
|
"data-style": j,
|
|
1736
1736
|
"data-depth": h || void 0,
|
|
1737
|
-
"data-reduced-motion":
|
|
1738
|
-
children: [/* @__PURE__ */ Q(
|
|
1737
|
+
"data-reduced-motion": K || void 0,
|
|
1738
|
+
children: [/* @__PURE__ */ Q(pe, { height: G }), /* @__PURE__ */ $("div", {
|
|
1739
1739
|
className: "lilt-stat__meter-labels",
|
|
1740
1740
|
children: [/* @__PURE__ */ Q("span", { children: "—" }), /* @__PURE__ */ Q("span", { children: "—" })]
|
|
1741
1741
|
})]
|
|
1742
|
-
}) : /* @__PURE__ */ Q(
|
|
1743
|
-
value:
|
|
1742
|
+
}) : /* @__PURE__ */ Q(qt, {
|
|
1743
|
+
value: ce,
|
|
1744
1744
|
target: _,
|
|
1745
|
-
height:
|
|
1745
|
+
height: G,
|
|
1746
1746
|
depth: h,
|
|
1747
1747
|
formatValue: P.value
|
|
1748
|
-
}) : L ? /* @__PURE__ */ Q(
|
|
1749
|
-
className:
|
|
1748
|
+
}) : L ? /* @__PURE__ */ Q(W, {
|
|
1749
|
+
className: fe ? "lilt-card__chart lilt-card__chart--bleed lilt-stat__chart" : "lilt-card__chart lilt-stat__chart",
|
|
1750
1750
|
"aria-label": `${e} trend`,
|
|
1751
|
-
model:
|
|
1751
|
+
model: V,
|
|
1752
1752
|
motion: A,
|
|
1753
1753
|
status: k ? "loading" : "ready",
|
|
1754
1754
|
loadingStyle: j,
|
|
1755
1755
|
children: /* @__PURE__ */ $(f, {
|
|
1756
|
-
model:
|
|
1757
|
-
height:
|
|
1756
|
+
model: V,
|
|
1757
|
+
height: G,
|
|
1758
1758
|
margins: {
|
|
1759
1759
|
top: 4,
|
|
1760
1760
|
right: 0,
|
|
@@ -1770,12 +1770,12 @@ function Yt({ title: e, data: t = Vt, value: n, x: r, xType: i, headline: a, agg
|
|
|
1770
1770
|
runoff: !0,
|
|
1771
1771
|
axisInset: 20
|
|
1772
1772
|
},
|
|
1773
|
-
children: [m === "area" &&
|
|
1774
|
-
model:
|
|
1775
|
-
series:
|
|
1776
|
-
}) : null,
|
|
1777
|
-
model:
|
|
1778
|
-
series:
|
|
1773
|
+
children: [m === "area" && U ? /* @__PURE__ */ Q(l, {
|
|
1774
|
+
model: V,
|
|
1775
|
+
series: U
|
|
1776
|
+
}) : null, U ? Q(I ? E : ve, {
|
|
1777
|
+
model: V,
|
|
1778
|
+
series: U
|
|
1779
1779
|
}) : null]
|
|
1780
1780
|
})
|
|
1781
1781
|
}) : null]
|
|
@@ -1783,11 +1783,11 @@ function Yt({ title: e, data: t = Vt, value: n, x: r, xType: i, headline: a, agg
|
|
|
1783
1783
|
}
|
|
1784
1784
|
//#endregion
|
|
1785
1785
|
//#region src/cards/rank.ts
|
|
1786
|
-
var
|
|
1786
|
+
var Zt = "\0other", Qt = new Intl.NumberFormat("en-US", {
|
|
1787
1787
|
style: "percent",
|
|
1788
1788
|
maximumFractionDigits: 0
|
|
1789
1789
|
});
|
|
1790
|
-
function
|
|
1790
|
+
function $t(e, t, n, r, i, a) {
|
|
1791
1791
|
let o = (e) => e[n], s = Ie(Fe(e, {
|
|
1792
1792
|
id: (e) => String(e[t] ?? ""),
|
|
1793
1793
|
label: (e) => String(e[t] ?? "")
|
|
@@ -1802,13 +1802,13 @@ function Qt(e, t, n, r, i, a) {
|
|
|
1802
1802
|
if (i === void 0 || i < 1 || s.length <= i + 1) return s;
|
|
1803
1803
|
let c = s.slice(i).flatMap((e) => e.value === null ? [] : [e.value]);
|
|
1804
1804
|
return [...s.slice(0, i), {
|
|
1805
|
-
id:
|
|
1805
|
+
id: Zt,
|
|
1806
1806
|
label: a,
|
|
1807
1807
|
value: c.length ? c.reduce((e, t) => e + t, 0) : null,
|
|
1808
1808
|
other: !0
|
|
1809
1809
|
}];
|
|
1810
1810
|
}
|
|
1811
|
-
function
|
|
1811
|
+
function en(e) {
|
|
1812
1812
|
let t = e.flatMap((e) => e.value === null ? [] : [e.value]), n = t.reduce((e, t) => e + t, 0);
|
|
1813
1813
|
return {
|
|
1814
1814
|
observed: t.length,
|
|
@@ -1818,16 +1818,16 @@ function $t(e) {
|
|
|
1818
1818
|
}
|
|
1819
1819
|
//#endregion
|
|
1820
1820
|
//#region src/cards/horizontal-bar-chart-card.tsx
|
|
1821
|
-
var
|
|
1822
|
-
function
|
|
1823
|
-
let O = xe(E), k = s(w, T), A =
|
|
1821
|
+
var tn = [];
|
|
1822
|
+
function nn({ title: e, data: t, category: n, value: r, headline: i, delta: a, deltaTone: o, range: c, ranges: l, defaultRange: u, sort: d = "descending", limit: f, otherLabel: p = "Other", share: m = !0, rank: h = !1, depth: g = !1, barStyle: _ = g ? "isometric" : "inline", valueFormat: v, locale: y, formatValue: ee, color: te, surface: x = "elevated", badge: S, numberStyle: C, palette: ne, loading: w = !1, loadingStyle: T = "shimmer", motion: E = "auto", className: D, style: re }) {
|
|
1823
|
+
let O = xe(E), k = s(w, T), A = de({
|
|
1824
1824
|
valueFormat: v,
|
|
1825
1825
|
locale: y,
|
|
1826
1826
|
formatValue: ee
|
|
1827
|
-
}), [j, M] = X(u ?? l?.[0]?.id), N = l?.find((e) => e.id === j) ?? l?.[0], P = N?.data ?? t ??
|
|
1827
|
+
}), [j, M] = X(u ?? l?.[0]?.id), N = l?.find((e) => e.id === j) ?? l?.[0], P = N?.data ?? t ?? tn, F = N ? N.delta : a, I = Ue(() => {
|
|
1828
1828
|
try {
|
|
1829
1829
|
return {
|
|
1830
|
-
rows:
|
|
1830
|
+
rows: $t(P, n, r, d, f, p),
|
|
1831
1831
|
error: null
|
|
1832
1832
|
};
|
|
1833
1833
|
} catch (e) {
|
|
@@ -1843,24 +1843,24 @@ function tn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1843
1843
|
d,
|
|
1844
1844
|
f,
|
|
1845
1845
|
p
|
|
1846
|
-
]), L = I.rows, R =
|
|
1846
|
+
]), L = I.rows, R = en(L), z = R.total, B = m && R.shareable, ie = Ue(() => Ne(L.map((e) => ({
|
|
1847
1847
|
...e,
|
|
1848
1848
|
datum: e
|
|
1849
|
-
}))), [L]), [
|
|
1850
|
-
resolve:
|
|
1851
|
-
onGlide:
|
|
1852
|
-
onLift: (e) => e !== null &&
|
|
1853
|
-
}),
|
|
1849
|
+
}))), [L]), [ae, oe] = X(null), [V, H] = X(null), [se, U] = X(null), ce = se ?? V ?? ae, W = L.find((e) => e.id === ce), le = We(/* @__PURE__ */ new Map()), ue = Mt({
|
|
1850
|
+
resolve: jt,
|
|
1851
|
+
onGlide: oe,
|
|
1852
|
+
onLift: (e) => e !== null && U(e)
|
|
1853
|
+
}), fe = N?.headline ?? i ?? (R.observed ? z : null), K = (e) => B && e !== null ? Qt.format(e / z) : null, me = (e, t) => {
|
|
1854
1854
|
let n = t;
|
|
1855
1855
|
if (e.key === "ArrowDown") n = Math.min(L.length - 1, t + 1);
|
|
1856
1856
|
else if (e.key === "ArrowUp") n = Math.max(0, t - 1);
|
|
1857
1857
|
else if (e.key === "Home") n = 0;
|
|
1858
1858
|
else if (e.key === "End") n = L.length - 1;
|
|
1859
1859
|
else if (e.key === "Escape") {
|
|
1860
|
-
|
|
1860
|
+
U(null);
|
|
1861
1861
|
return;
|
|
1862
1862
|
} else return;
|
|
1863
|
-
e.preventDefault(),
|
|
1863
|
+
e.preventDefault(), le.current.get(L[n].id)?.focus();
|
|
1864
1864
|
}, he = {
|
|
1865
1865
|
duration: O ? 0 : .5,
|
|
1866
1866
|
ease: Ce
|
|
@@ -1888,11 +1888,11 @@ function tn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1888
1888
|
onValueChange: M
|
|
1889
1889
|
}) : null,
|
|
1890
1890
|
children: [/* @__PURE__ */ Q(De, { children: e }), /* @__PURE__ */ Q(Ee, {
|
|
1891
|
-
value:
|
|
1891
|
+
value: W ? W.value : fe,
|
|
1892
1892
|
format: A.value,
|
|
1893
1893
|
loading: w,
|
|
1894
1894
|
motion: E,
|
|
1895
|
-
children: w ? null :
|
|
1895
|
+
children: w ? null : W ? /* @__PURE__ */ $(we, { children: [W.label, K(W.value) ? ` · ${K(W.value)}` : ""] }) : F === void 0 ? null : /* @__PURE__ */ Q(Te, {
|
|
1896
1896
|
value: F,
|
|
1897
1897
|
tone: o
|
|
1898
1898
|
})
|
|
@@ -1906,7 +1906,7 @@ function tn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1906
1906
|
"data-reduced-motion": O || void 0,
|
|
1907
1907
|
children: Array.from({ length: Math.min(f ? f + 1 : 5, 8) }, (e, t) => /* @__PURE__ */ Q("div", {
|
|
1908
1908
|
className: "lilt-list__skeleton",
|
|
1909
|
-
children: /* @__PURE__ */ Q(
|
|
1909
|
+
children: /* @__PURE__ */ Q(pe, {
|
|
1910
1910
|
width: `${88 - t * 13}%`,
|
|
1911
1911
|
step: t
|
|
1912
1912
|
})
|
|
@@ -1915,7 +1915,7 @@ function tn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1915
1915
|
kind: I.error ? "error" : "empty",
|
|
1916
1916
|
message: I.error ?? "No rows for this period."
|
|
1917
1917
|
}) : /* @__PURE__ */ Q("ol", {
|
|
1918
|
-
ref:
|
|
1918
|
+
ref: ue,
|
|
1919
1919
|
className: "lilt-list__rows",
|
|
1920
1920
|
"data-lilt-glide": "",
|
|
1921
1921
|
"data-style": _,
|
|
@@ -1925,11 +1925,11 @@ function tn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1925
1925
|
children: /* @__PURE__ */ Q(Ke, {
|
|
1926
1926
|
initial: !1,
|
|
1927
1927
|
children: L.map((e, t) => {
|
|
1928
|
-
let n = Pe(e.value,
|
|
1928
|
+
let n = Pe(e.value, ie), r = e.id === W?.id, i = K(e.value), a = O ? 0 : G(t, L.length, 120) / 1e3;
|
|
1929
1929
|
return /* @__PURE__ */ Q(qe.li, {
|
|
1930
1930
|
layout: !O && "position",
|
|
1931
1931
|
"data-active": r || void 0,
|
|
1932
|
-
"data-muted":
|
|
1932
|
+
"data-muted": W && !r || void 0,
|
|
1933
1933
|
"data-other": e.other || void 0,
|
|
1934
1934
|
initial: !O && { opacity: 0 },
|
|
1935
1935
|
animate: { opacity: 1 },
|
|
@@ -1940,16 +1940,16 @@ function tn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1940
1940
|
className: "lilt-list__row",
|
|
1941
1941
|
"data-glide-id": e.id,
|
|
1942
1942
|
ref: (t) => {
|
|
1943
|
-
t ?
|
|
1943
|
+
t ? le.current.set(e.id, t) : le.current.delete(e.id);
|
|
1944
1944
|
},
|
|
1945
|
-
tabIndex: e.id === (
|
|
1945
|
+
tabIndex: e.id === (V ?? L[0]?.id) ? 0 : -1,
|
|
1946
1946
|
"aria-label": `${e.label}: ${e.value === null ? "No data" : A.value(e.value)}${i ? `, ${i} of total` : ""}`,
|
|
1947
|
-
"aria-pressed":
|
|
1948
|
-
onPointerEnter: () =>
|
|
1949
|
-
onPointerLeave: () =>
|
|
1950
|
-
onFocus: () =>
|
|
1951
|
-
onBlur: () =>
|
|
1952
|
-
onClick: () =>
|
|
1947
|
+
"aria-pressed": se === e.id,
|
|
1948
|
+
onPointerEnter: () => oe(e.id),
|
|
1949
|
+
onPointerLeave: () => oe(null),
|
|
1950
|
+
onFocus: () => H(e.id),
|
|
1951
|
+
onBlur: () => H(null),
|
|
1952
|
+
onClick: () => U((t) => t === e.id ? null : e.id),
|
|
1953
1953
|
onKeyDown: (e) => me(e, t),
|
|
1954
1954
|
children: [
|
|
1955
1955
|
h ? /* @__PURE__ */ Q("span", {
|
|
@@ -1960,7 +1960,7 @@ function tn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
1960
1960
|
/* @__PURE__ */ $("span", {
|
|
1961
1961
|
className: "lilt-list__bar-area",
|
|
1962
1962
|
children: [
|
|
1963
|
-
|
|
1963
|
+
ie[0] < 0 ? /* @__PURE__ */ Q("span", {
|
|
1964
1964
|
className: "lilt-list__zero",
|
|
1965
1965
|
style: { left: `${n.zero}%` }
|
|
1966
1966
|
}) : null,
|
|
@@ -2007,9 +2007,9 @@ function tn({ title: e, data: t, category: n, value: r, headline: i, delta: a, d
|
|
|
2007
2007
|
}
|
|
2008
2008
|
//#endregion
|
|
2009
2009
|
//#region src/cards/combo-chart-card.tsx
|
|
2010
|
-
function
|
|
2010
|
+
function rn({ 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 }) {
|
|
2011
2011
|
let h = n === "own";
|
|
2012
|
-
return /* @__PURE__ */ Q(
|
|
2012
|
+
return /* @__PURE__ */ Q(V, {
|
|
2013
2013
|
...m,
|
|
2014
2014
|
depth: c,
|
|
2015
2015
|
aggregate: f,
|
|
@@ -2022,7 +2022,7 @@ function nn({ bars: e, lines: t, lineScale: n = "shared", stack: r, radius: i =
|
|
|
2022
2022
|
}))],
|
|
2023
2023
|
shape: {
|
|
2024
2024
|
kind: "bar",
|
|
2025
|
-
stack:
|
|
2025
|
+
stack: ue(r),
|
|
2026
2026
|
radius: i,
|
|
2027
2027
|
corners: a,
|
|
2028
2028
|
tracks: o,
|
|
@@ -2035,36 +2035,36 @@ function nn({ bars: e, lines: t, lineScale: n = "shared", stack: r, radius: i =
|
|
|
2035
2035
|
}
|
|
2036
2036
|
//#endregion
|
|
2037
2037
|
//#region src/cards/radial-chart-card.tsx
|
|
2038
|
-
var
|
|
2039
|
-
function
|
|
2038
|
+
var an = [], on = 92, sn = 98, cn = Math.PI * 2, ln = .94, un = "color-mix(in oklab, var(--lilt-muted) 13%, var(--lilt-surface))";
|
|
2039
|
+
function dn(e) {
|
|
2040
2040
|
let t = e.reduce((e, t) => e + Math.max(0, t.value ?? 0), 0), n = 0;
|
|
2041
2041
|
return e.flatMap((e) => {
|
|
2042
2042
|
if (e.value === null || t <= 0) return [];
|
|
2043
2043
|
let r = n;
|
|
2044
|
-
return n += Math.max(0, e.value) / t *
|
|
2044
|
+
return n += Math.max(0, e.value) / t * cn, [{
|
|
2045
2045
|
id: e.id,
|
|
2046
2046
|
startAngle: r,
|
|
2047
2047
|
endAngle: n
|
|
2048
2048
|
}];
|
|
2049
2049
|
});
|
|
2050
2050
|
}
|
|
2051
|
-
function
|
|
2051
|
+
function fn(e) {
|
|
2052
2052
|
if (!(e > 0)) return 1;
|
|
2053
2053
|
let t = 10 ** Math.floor(Math.log10(e)) / 4;
|
|
2054
2054
|
return Math.ceil(e * 1.05 / t) * t;
|
|
2055
2055
|
}
|
|
2056
|
-
function
|
|
2057
|
-
let t =
|
|
2056
|
+
function pn(e) {
|
|
2057
|
+
let t = fn(Math.max(0, ...e.map((e) => e.value ?? 0)));
|
|
2058
2058
|
return e.flatMap((e) => e.value === null ? [] : [{
|
|
2059
2059
|
id: e.id,
|
|
2060
2060
|
startAngle: 0,
|
|
2061
|
-
endAngle: Math.max(0, e.value) / t *
|
|
2061
|
+
endAngle: Math.max(0, e.value) / t * cn
|
|
2062
2062
|
}]);
|
|
2063
2063
|
}
|
|
2064
|
-
function
|
|
2064
|
+
function mn(e) {
|
|
2065
2065
|
return 1 - (1 - e) ** 2;
|
|
2066
2066
|
}
|
|
2067
|
-
function
|
|
2067
|
+
function hn(e, t, n) {
|
|
2068
2068
|
let r = new Map(e.map((e) => [e.id, e]));
|
|
2069
2069
|
return t.map((e) => {
|
|
2070
2070
|
let t = r.get(e.id) ?? {
|
|
@@ -2078,14 +2078,14 @@ function mn(e, t, n) {
|
|
|
2078
2078
|
};
|
|
2079
2079
|
});
|
|
2080
2080
|
}
|
|
2081
|
-
function
|
|
2082
|
-
let k = xe(D), A =
|
|
2081
|
+
function gn({ title: t, data: n, category: r, value: i, variant: a = "donut", depth: o = !1, legend: s = a === "rings" ? "tiles" : a === "semi" ? "inline" : "list", legendSwatch: c, headline: l, delta: u, deltaTone: d, range: f, ranges: p, defaultRange: m, limit: h = 5, otherLabel: _ = "Other", sort: v = "descending", valueFormat: y, locale: ee, formatValue: te, surface: x = "elevated", badge: S, numberStyle: ne, palette: w, loading: T = !1, loadingStyle: E = "shimmer", motion: D = "auto", className: re, style: O }) {
|
|
2082
|
+
let k = xe(D), A = de({
|
|
2083
2083
|
valueFormat: y,
|
|
2084
2084
|
locale: ee,
|
|
2085
2085
|
formatValue: te
|
|
2086
|
-
}), [j, M] = X(m ?? p?.[0]?.id), N = p?.find((e) => e.id === j) ?? p?.[0], P = N?.data ?? n ??
|
|
2086
|
+
}), [j, M] = X(m ?? p?.[0]?.id), N = p?.find((e) => e.id === j) ?? p?.[0], P = N?.data ?? n ?? an, F = N ? N.delta : u, I = `lilt-radial-depth-${Ve().replace(/:/g, "")}`, L = Ue(() => {
|
|
2087
2087
|
try {
|
|
2088
|
-
let e =
|
|
2088
|
+
let e = $t(P, r, i, v, h, _), t = e.find((e) => e.value !== null && e.value < 0);
|
|
2089
2089
|
if (t) throw Error(`Slices can’t be negative, and “${t.label}” is below zero.`);
|
|
2090
2090
|
return {
|
|
2091
2091
|
rows: e,
|
|
@@ -2104,50 +2104,50 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2104
2104
|
v,
|
|
2105
2105
|
h,
|
|
2106
2106
|
_
|
|
2107
|
-
]), R = L.rows, [z, B] = X([]),
|
|
2108
|
-
for (let e of R) e.other ||
|
|
2109
|
-
let
|
|
2107
|
+
]), R = L.rows, [z, B] = X([]), ie = Ue(() => R.filter((e) => !z.includes(e.id)), [R, z]), { total: oe, observed: V } = en(ie), H = We(/* @__PURE__ */ new Map()), se = (e) => R.find((t) => t.id === e)?.other ? "var(--lilt-reference)" : (H.current.has(e) || H.current.set(e, H.current.size % 6), `var(--lilt-series-${H.current.get(e) + 1})`);
|
|
2108
|
+
for (let e of R) e.other || se(e.id);
|
|
2109
|
+
let U = a === "rings", W = a === "semi", ue = Ue(() => U ? pn(ie) : dn(ie), [ie, U]), [G, fe] = X({
|
|
2110
2110
|
key: 0,
|
|
2111
2111
|
from: [],
|
|
2112
|
-
to:
|
|
2112
|
+
to: ue,
|
|
2113
2113
|
initial: !0
|
|
2114
|
-
}),
|
|
2115
|
-
|
|
2116
|
-
key:
|
|
2117
|
-
from:
|
|
2118
|
-
to:
|
|
2119
|
-
initial:
|
|
2114
|
+
}), pe = We([]);
|
|
2115
|
+
G.to !== ue && fe({
|
|
2116
|
+
key: G.key + 1,
|
|
2117
|
+
from: pe.current,
|
|
2118
|
+
to: ue,
|
|
2119
|
+
initial: pe.current.length === 0
|
|
2120
2120
|
});
|
|
2121
|
-
let
|
|
2122
|
-
key:
|
|
2121
|
+
let K = Me({
|
|
2122
|
+
key: G.key,
|
|
2123
2123
|
active: !T,
|
|
2124
|
-
duration:
|
|
2125
|
-
}, k), me =
|
|
2126
|
-
let n =
|
|
2124
|
+
duration: G.initial ? 900 : 480
|
|
2125
|
+
}, k), me = K < 1, he = .09, ge = (e) => U && G.initial ? Math.max(0, Math.min(1, (K - e * he) / (1 - (ue.length - 1) * he || 1))) : K, _e = G.initial ? G.to.map((e, t) => {
|
|
2126
|
+
let n = U ? mn(ge(t)) : K;
|
|
2127
2127
|
return {
|
|
2128
2128
|
...e,
|
|
2129
2129
|
startAngle: e.startAngle * n,
|
|
2130
2130
|
endAngle: e.endAngle * n
|
|
2131
2131
|
};
|
|
2132
|
-
}) :
|
|
2133
|
-
|
|
2134
|
-
let [ve, ye] = X(null), [q, J] = X(null), [be, Se] = X(null), Ce = be ?? q ?? ve, Y =
|
|
2135
|
-
resolve:
|
|
2132
|
+
}) : hn(G.from, G.to, K);
|
|
2133
|
+
pe.current = _e;
|
|
2134
|
+
let [ve, ye] = X(null), [q, J] = X(null), [be, Se] = X(null), Ce = be ?? q ?? ve, Y = ie.find((e) => e.id === Ce), Oe = We(/* @__PURE__ */ new Map()), Ne = Mt({
|
|
2135
|
+
resolve: jt,
|
|
2136
2136
|
onGlide: ye,
|
|
2137
2137
|
onLift: (e) => e !== null && Se(e),
|
|
2138
2138
|
disabled: T
|
|
2139
|
-
}), Pe = (e) => e && e.value !== null &&
|
|
2139
|
+
}), Pe = (e) => e && e.value !== null && oe > 0 && !z.includes(e.id) ? Qt.format(e.value / oe) : null, Fe = ie.find((e) => e.value !== null && !e.other), Ie = (e) => {
|
|
2140
2140
|
B(e), ye(null), Se(null);
|
|
2141
|
-
}, Le = (e) => z.includes(e) ? Ie(z.filter((t) => t !== e)) :
|
|
2141
|
+
}, Le = (e) => z.includes(e) ? Ie(z.filter((t) => t !== e)) : ie.length > 1 ? Ie([...z, e]) : void 0, Re = Y ?? Fe, ze = a === "donut" ? 62 : W ? 64 : 0, Be = (e) => Ye().innerRadius(ze).outerRadius(e).cornerRadius(a === "donut" ? 3 : W ? 14 : 0).padAngle(_e.length > 1 ? W ? .05 : .012 : 0), He = Be(on), Ge = Be(sn), Ke = (e) => ({
|
|
2142
2142
|
...e,
|
|
2143
2143
|
startAngle: -Math.PI / 2 + e.startAngle / 2,
|
|
2144
2144
|
endAngle: -Math.PI / 2 + e.endAngle / 2
|
|
2145
|
-
}), qe = Math.max(1,
|
|
2145
|
+
}), qe = Math.max(1, ue.length), Je = Math.min(9, 62 / qe - 4), Xe = (e, t = 0) => Ye().innerRadius(on - e * (Je + 4) - Je - t / 2).outerRadius(on - e * (Je + 4) + t / 2).cornerRadius(Je), Ze = (e) => ({
|
|
2146
2146
|
"data-glide-id": e,
|
|
2147
2147
|
onPointerEnter: () => ye(e),
|
|
2148
2148
|
onPointerLeave: () => ye(null),
|
|
2149
2149
|
onClick: () => Se((t) => t === e ? null : e)
|
|
2150
|
-
}), Qe =
|
|
2150
|
+
}), Qe = U ? _e.map((e, t) => {
|
|
2151
2151
|
let n = e.id === Y?.id;
|
|
2152
2152
|
return {
|
|
2153
2153
|
slice: e,
|
|
@@ -2156,22 +2156,22 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2156
2156
|
band: Xe(t)({
|
|
2157
2157
|
id: e.id,
|
|
2158
2158
|
startAngle: 0,
|
|
2159
|
-
endAngle:
|
|
2159
|
+
endAngle: cn
|
|
2160
2160
|
}) ?? "",
|
|
2161
2161
|
path: e.endAngle > 0 ? Xe(t, n ? 3 : 0)(e) : null,
|
|
2162
|
-
color:
|
|
2162
|
+
color: se(e.id)
|
|
2163
2163
|
};
|
|
2164
|
-
}) : [], $e =
|
|
2165
|
-
let t = e.id === Y?.id, n =
|
|
2164
|
+
}) : [], $e = U ? [] : _e.flatMap((e) => {
|
|
2165
|
+
let t = e.id === Y?.id, n = W ? Ke(e) : e, r = (t ? Ge : He)(n);
|
|
2166
2166
|
return r ? [{
|
|
2167
2167
|
slice: e,
|
|
2168
2168
|
isActive: t,
|
|
2169
2169
|
muted: Y && !t || void 0,
|
|
2170
2170
|
angles: n,
|
|
2171
2171
|
path: r,
|
|
2172
|
-
color:
|
|
2172
|
+
color: se(e.id)
|
|
2173
2173
|
}] : [];
|
|
2174
|
-
}), et = () =>
|
|
2174
|
+
}), et = () => U ? Qe.map((e) => /* @__PURE__ */ $("g", {
|
|
2175
2175
|
className: "lilt-radial-card__ring",
|
|
2176
2176
|
"data-category": e.slice.id,
|
|
2177
2177
|
"data-active": e.isActive || void 0,
|
|
@@ -2198,7 +2198,7 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2198
2198
|
"data-category": e.slice.id,
|
|
2199
2199
|
...Ze(e.slice.id)
|
|
2200
2200
|
})] }, e.slice.id)), tt = (e, t, n) => {
|
|
2201
|
-
if (n - t >=
|
|
2201
|
+
if (n - t >= cn - 1e-6) return `M0,${-e}A${e},${e} 0 1 1 0,${e}A${e},${e} 0 1 1 0,${-e}`;
|
|
2202
2202
|
let r = (t) => `${(e * Math.sin(t)).toFixed(3)},${(-e * Math.cos(t)).toFixed(3)}`;
|
|
2203
2203
|
return `M${r(t)}A${e},${e} 0 ${+(n - t > Math.PI)} 1 ${r(n)}`;
|
|
2204
2204
|
}, nt = (t, n, r, i, a, o, s = "tube") => {
|
|
@@ -2223,9 +2223,9 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2223
2223
|
}, t))
|
|
2224
2224
|
})] });
|
|
2225
2225
|
}, rt = (e, t = 0) => ({
|
|
2226
|
-
radius:
|
|
2226
|
+
radius: on - e * (Je + 4) + t / 2 - (Je + t) / 2,
|
|
2227
2227
|
width: Je + t
|
|
2228
|
-
}), it = () =>
|
|
2228
|
+
}), it = () => U ? Qe.map((e, t) => {
|
|
2229
2229
|
if (!e.path) return null;
|
|
2230
2230
|
let n = rt(t, e.isActive ? 3 : 0);
|
|
2231
2231
|
return /* @__PURE__ */ Q("g", {
|
|
@@ -2235,7 +2235,7 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2235
2235
|
children: nt(`ring-${t}`, e.path, n.radius, n.width, e.slice, e.color)
|
|
2236
2236
|
}, e.slice.id);
|
|
2237
2237
|
}) : $e.map((e) => {
|
|
2238
|
-
let t = e.isActive ?
|
|
2238
|
+
let t = e.isActive ? sn : on;
|
|
2239
2239
|
return /* @__PURE__ */ Q("g", {
|
|
2240
2240
|
className: "lilt-radial-card__slice",
|
|
2241
2241
|
"data-category": e.slice.id,
|
|
@@ -2248,10 +2248,10 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2248
2248
|
})
|
|
2249
2249
|
}, e.slice.id);
|
|
2250
2250
|
}), at = () => /* @__PURE__ */ $(Z, { children: [
|
|
2251
|
-
/* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(
|
|
2251
|
+
/* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(le, {
|
|
2252
2252
|
id: `${I}-shadow`,
|
|
2253
2253
|
size: 6
|
|
2254
|
-
}), ze === 0 && !
|
|
2254
|
+
}), ze === 0 && !U ? $e.map((e) => /* @__PURE__ */ Q("radialGradient", {
|
|
2255
2255
|
id: `${I}-dome-${_e.indexOf(e.slice)}`,
|
|
2256
2256
|
gradientUnits: "userSpaceOnUse",
|
|
2257
2257
|
cx: -28,
|
|
@@ -2263,7 +2263,7 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2263
2263
|
[1, -36]
|
|
2264
2264
|
])
|
|
2265
2265
|
}, e.slice.id)) : null] }),
|
|
2266
|
-
|
|
2266
|
+
U ? Qe.map((e, t) => {
|
|
2267
2267
|
let n = rt(t);
|
|
2268
2268
|
return /* @__PURE__ */ $("g", {
|
|
2269
2269
|
className: "lilt-radial-card__ring",
|
|
@@ -2276,15 +2276,15 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2276
2276
|
d: e.band
|
|
2277
2277
|
}), nt(`track-${t}`, e.band, n.radius, n.width, {
|
|
2278
2278
|
startAngle: 0,
|
|
2279
|
-
endAngle:
|
|
2280
|
-
},
|
|
2279
|
+
endAngle: cn
|
|
2280
|
+
}, un, "groove")]
|
|
2281
2281
|
}, `track-${e.slice.id}`);
|
|
2282
2282
|
}) : null,
|
|
2283
2283
|
/* @__PURE__ */ Q("g", {
|
|
2284
2284
|
filter: `url(#${I}-shadow)`,
|
|
2285
2285
|
children: it()
|
|
2286
2286
|
}),
|
|
2287
|
-
|
|
2287
|
+
U ? null : $e.map((e) => /* @__PURE__ */ Q("path", {
|
|
2288
2288
|
className: "lilt-radial-card__hit",
|
|
2289
2289
|
d: Ge(e.angles) ?? e.path,
|
|
2290
2290
|
"data-category": e.slice.id,
|
|
@@ -2301,7 +2301,7 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2301
2301
|
return;
|
|
2302
2302
|
} else return;
|
|
2303
2303
|
e.preventDefault(), Oe.current.get(R[n].id)?.focus();
|
|
2304
|
-
}, st = N?.headline ?? l ?? (
|
|
2304
|
+
}, st = N?.headline ?? l ?? (V ? oe : null), ct = !T && (L.error !== null || oe <= 0), lt = W ? [-Math.PI / 2, Math.PI / 2] : [0, cn], ut = (U ? [
|
|
2305
2305
|
86,
|
|
2306
2306
|
66,
|
|
2307
2307
|
46
|
|
@@ -2323,14 +2323,14 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2323
2323
|
].map((e, t, n) => {
|
|
2324
2324
|
let r = n.slice(0, t).reduce((e, t) => e + t, 0);
|
|
2325
2325
|
return {
|
|
2326
|
-
radius: (
|
|
2327
|
-
width:
|
|
2326
|
+
radius: (on + ze) / 2,
|
|
2327
|
+
width: on - ze,
|
|
2328
2328
|
from: r,
|
|
2329
2329
|
to: r + e,
|
|
2330
2330
|
step: r * 12
|
|
2331
2331
|
};
|
|
2332
2332
|
})).map((e) => {
|
|
2333
|
-
let t =
|
|
2333
|
+
let t = U ? 0 : W ? .025 : .015, n = lt[1] - lt[0];
|
|
2334
2334
|
return {
|
|
2335
2335
|
...e,
|
|
2336
2336
|
startAngle: lt[0] + e.from * n + (e.from > 0 ? t : 0),
|
|
@@ -2394,29 +2394,29 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2394
2394
|
children: [/* @__PURE__ */ Q("svg", {
|
|
2395
2395
|
"aria-hidden": "true",
|
|
2396
2396
|
className: "lilt-radial-card__svg",
|
|
2397
|
-
viewBox:
|
|
2397
|
+
viewBox: W ? "-100 -100 200 104" : "-100 -100 200 200",
|
|
2398
2398
|
"data-loading": T || void 0,
|
|
2399
2399
|
"data-drawing": me || void 0,
|
|
2400
|
-
children: T ? /* @__PURE__ */ Q(
|
|
2400
|
+
children: T ? /* @__PURE__ */ Q(Vt, {
|
|
2401
2401
|
x: -100,
|
|
2402
2402
|
y: -100,
|
|
2403
2403
|
width: 200,
|
|
2404
|
-
height:
|
|
2404
|
+
height: W ? 104 : 200,
|
|
2405
2405
|
reduced: k,
|
|
2406
2406
|
loadingStyle: E,
|
|
2407
2407
|
depth: o,
|
|
2408
2408
|
mask: o ? /* @__PURE__ */ Q("g", {
|
|
2409
|
-
transform: `scale(${
|
|
2409
|
+
transform: `scale(${ln})`,
|
|
2410
2410
|
children: pt(!0)
|
|
2411
2411
|
}) : pt(!0),
|
|
2412
2412
|
children: o ? /* @__PURE__ */ $("g", {
|
|
2413
2413
|
"data-lilt-loading-depth": "",
|
|
2414
|
-
transform: `scale(${
|
|
2414
|
+
transform: `scale(${ln})`,
|
|
2415
2415
|
opacity: .6,
|
|
2416
|
-
children: [/* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(
|
|
2416
|
+
children: [/* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(le, {
|
|
2417
2417
|
id: `${I}-loading-shadow`,
|
|
2418
2418
|
size: 6
|
|
2419
|
-
}), ze === 0 && !
|
|
2419
|
+
}), ze === 0 && !U ? /* @__PURE__ */ Q("radialGradient", {
|
|
2420
2420
|
id: `${I}-loading-dome`,
|
|
2421
2421
|
gradientUnits: "userSpaceOnUse",
|
|
2422
2422
|
cx: -28,
|
|
@@ -2432,7 +2432,7 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2432
2432
|
children: ut.map((e, t) => /* @__PURE__ */ Q("g", {
|
|
2433
2433
|
"data-skeleton": "bloom",
|
|
2434
2434
|
style: dt(e),
|
|
2435
|
-
children: ze === 0 && !
|
|
2435
|
+
children: ze === 0 && !U ? /* @__PURE__ */ Q("path", {
|
|
2436
2436
|
d: ft(e),
|
|
2437
2437
|
fill: `url(#${I}-loading-dome)`
|
|
2438
2438
|
}) : nt(`loading-${t}`, ft(e), e.radius, e.width, e, "var(--lilt-skeleton)")
|
|
@@ -2440,13 +2440,13 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2440
2440
|
})]
|
|
2441
2441
|
}) : pt(!1)
|
|
2442
2442
|
}) : o ? /* @__PURE__ */ Q("g", {
|
|
2443
|
-
transform: `scale(${
|
|
2443
|
+
transform: `scale(${ln})`,
|
|
2444
2444
|
children: at()
|
|
2445
2445
|
}) : et()
|
|
2446
|
-
}), (a === "donut" ||
|
|
2446
|
+
}), (a === "donut" || W) && !T && Re ? /* @__PURE__ */ $("div", {
|
|
2447
2447
|
className: "lilt-radial-card__center",
|
|
2448
2448
|
"aria-hidden": "true",
|
|
2449
|
-
style:
|
|
2449
|
+
style: G.initial && me ? { opacity: Math.max(0, (K - .55) / .45) } : void 0,
|
|
2450
2450
|
children: [/* @__PURE__ */ Q("strong", { children: Pe(Re) ?? "—" }), /* @__PURE__ */ Q("span", { children: Re.label })]
|
|
2451
2451
|
}) : null]
|
|
2452
2452
|
}), s === "list" ? T ? /* @__PURE__ */ Q("div", {
|
|
@@ -2472,7 +2472,7 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2472
2472
|
t ? Oe.current.set(e.id, t) : Oe.current.delete(e.id);
|
|
2473
2473
|
},
|
|
2474
2474
|
tabIndex: e.id === (q ?? R[0]?.id) ? 0 : -1,
|
|
2475
|
-
"aria-label": `${e.label}: ${e.value === null ? "No data" : A.value(e.value)}${r ? `, ${r} of total` : ""}. ${i ? "Hidden; press to show" :
|
|
2475
|
+
"aria-label": `${e.label}: ${e.value === null ? "No data" : A.value(e.value)}${r ? `, ${r} of total` : ""}. ${i ? "Hidden; press to show" : ie.length > 1 ? "Shown; press to hide" : "The only category shown"}`,
|
|
2476
2476
|
"aria-pressed": !i,
|
|
2477
2477
|
onPointerEnter: () => !i && ye(e.id),
|
|
2478
2478
|
onPointerLeave: () => ye(null),
|
|
@@ -2483,7 +2483,7 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2483
2483
|
children: [
|
|
2484
2484
|
/* @__PURE__ */ Q("span", {
|
|
2485
2485
|
className: "lilt-radial-card__swatch",
|
|
2486
|
-
style: e.value === null ? void 0 : i ? { boxShadow: `inset 0 0 0 1.5px ${
|
|
2486
|
+
style: e.value === null ? void 0 : i ? { boxShadow: `inset 0 0 0 1.5px ${se(e.id)}` } : { background: se(e.id) },
|
|
2487
2487
|
"data-missing": e.value === null || void 0
|
|
2488
2488
|
}),
|
|
2489
2489
|
/* @__PURE__ */ Q("span", {
|
|
@@ -2504,7 +2504,7 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2504
2504
|
]
|
|
2505
2505
|
}), R.length > 1 ? /* @__PURE__ */ $("span", {
|
|
2506
2506
|
className: "lilt-chart__legend-actions",
|
|
2507
|
-
children: [
|
|
2507
|
+
children: [ie.length > 1 || i ? /* @__PURE__ */ Q("button", {
|
|
2508
2508
|
type: "button",
|
|
2509
2509
|
className: "lilt-chart__legend-action",
|
|
2510
2510
|
"aria-label": `Show only ${e.label}`,
|
|
@@ -2520,15 +2520,15 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2520
2520
|
}) : null]
|
|
2521
2521
|
}, e.id);
|
|
2522
2522
|
})
|
|
2523
|
-
}) : /* @__PURE__ */ Q(
|
|
2523
|
+
}) : /* @__PURE__ */ Q(ce, {
|
|
2524
2524
|
className: "lilt-radial-card__key",
|
|
2525
2525
|
"aria-label": `${t} by category`,
|
|
2526
|
-
variant:
|
|
2526
|
+
variant: ae(s),
|
|
2527
2527
|
swatch: c,
|
|
2528
2528
|
items: R.map((e) => ({
|
|
2529
2529
|
id: e.id,
|
|
2530
2530
|
label: e.label,
|
|
2531
|
-
color: e.value === null ? "transparent" :
|
|
2531
|
+
color: e.value === null ? "transparent" : se(e.id),
|
|
2532
2532
|
value: e.value,
|
|
2533
2533
|
formattedValue: e.value === null ? "No data" : A.value(e.value)
|
|
2534
2534
|
})),
|
|
@@ -2544,9 +2544,9 @@ function hn({ title: t, data: n, category: r, value: i, variant: a = "donut", de
|
|
|
2544
2544
|
}
|
|
2545
2545
|
//#endregion
|
|
2546
2546
|
//#region src/cards/progress-card.tsx
|
|
2547
|
-
var
|
|
2548
|
-
function
|
|
2549
|
-
let w = xe(S), T = `lilt-progress-depth-${Ve().replace(/:/g, "")}`, E =
|
|
2547
|
+
var _n = (e) => `${Math.round(e * 100)}%`, vn = "var(--lilt-series-1)", yn = "color-mix(in oklab, var(--lilt-muted) 14%, var(--lilt-surface))";
|
|
2548
|
+
function bn({ title: t, value: n = null, target: r, label: i = "of goal", variant: a = "ring", depth: o = !1, delta: s, deltaTone: c, range: l, ranges: u, defaultRange: d, footer: f, valueFormat: p, locale: m, formatValue: h, color: _, surface: v = "elevated", badge: y, numberStyle: ee, palette: te, loading: b = !1, loadingStyle: x = "shimmer", motion: S = "auto", className: C, style: ne }) {
|
|
2549
|
+
let w = xe(S), T = `lilt-progress-depth-${Ve().replace(/:/g, "")}`, E = de({
|
|
2550
2550
|
valueFormat: p,
|
|
2551
2551
|
locale: m,
|
|
2552
2552
|
formatValue: h
|
|
@@ -2628,7 +2628,7 @@ function yn({ title: t, value: n = null, target: r, label: i = "of goal", varian
|
|
|
2628
2628
|
className: "lilt-progress__graphic",
|
|
2629
2629
|
"data-variant": a,
|
|
2630
2630
|
role: "meter",
|
|
2631
|
-
"aria-label": `${M === null ? "No data" :
|
|
2631
|
+
"aria-label": `${M === null ? "No data" : _n(M)} ${i}, target ${E.value(A)}`,
|
|
2632
2632
|
"aria-valuemin": 0,
|
|
2633
2633
|
"aria-valuemax": A,
|
|
2634
2634
|
"aria-valuenow": k ?? 0,
|
|
@@ -2640,7 +2640,7 @@ function yn({ title: t, value: n = null, target: r, label: i = "of goal", varian
|
|
|
2640
2640
|
cx: 100,
|
|
2641
2641
|
cy: 100,
|
|
2642
2642
|
r: I - 20
|
|
2643
|
-
}) : null, b ? /* @__PURE__ */ Q(
|
|
2643
|
+
}) : null, b ? /* @__PURE__ */ Q(Vt, {
|
|
2644
2644
|
width: 200,
|
|
2645
2645
|
height: N ? 106 : 200,
|
|
2646
2646
|
reduced: w,
|
|
@@ -2670,24 +2670,24 @@ function yn({ title: t, value: n = null, target: r, label: i = "of goal", varian
|
|
|
2670
2670
|
children: o ? e(F).map((e, t) => /* @__PURE__ */ Q(Re, { children: R({
|
|
2671
2671
|
width: e.strokeWidth,
|
|
2672
2672
|
transform: e.transform,
|
|
2673
|
-
stroke: g(
|
|
2673
|
+
stroke: g(zt, e.amount)
|
|
2674
2674
|
}, !0) }, t)) : R(void 0, !0)
|
|
2675
2675
|
}) : o ? /* @__PURE__ */ $(Z, { children: [
|
|
2676
|
-
/* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(
|
|
2676
|
+
/* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(le, {
|
|
2677
2677
|
id: `${T}-shadow`,
|
|
2678
2678
|
size: 5
|
|
2679
2679
|
}) }),
|
|
2680
2680
|
e(F, "groove").map((e, t) => /* @__PURE__ */ Q(Re, { children: R({
|
|
2681
2681
|
width: e.strokeWidth,
|
|
2682
2682
|
transform: e.transform,
|
|
2683
|
-
stroke: g(
|
|
2683
|
+
stroke: g(yn, e.amount)
|
|
2684
2684
|
}) }, `track-${t}`)),
|
|
2685
2685
|
M ? /* @__PURE__ */ Q("g", {
|
|
2686
2686
|
filter: `url(#${T}-shadow)`,
|
|
2687
2687
|
children: e(F).map((e, t) => /* @__PURE__ */ Q(Re, { children: B({
|
|
2688
2688
|
width: e.strokeWidth,
|
|
2689
2689
|
transform: e.transform,
|
|
2690
|
-
stroke: g(
|
|
2690
|
+
stroke: g(vn, e.amount)
|
|
2691
2691
|
}) }, `fill-${t}`))
|
|
2692
2692
|
}) : null
|
|
2693
2693
|
] }) : /* @__PURE__ */ $(Z, { children: [R(), M ? B() : null] })]
|
|
@@ -2696,7 +2696,7 @@ function yn({ title: t, value: n = null, target: r, label: i = "of goal", varian
|
|
|
2696
2696
|
"aria-hidden": "true",
|
|
2697
2697
|
children: [/* @__PURE__ */ Q("strong", { children: M === null ? "—" : /* @__PURE__ */ Q(Se, {
|
|
2698
2698
|
value: M,
|
|
2699
|
-
format:
|
|
2699
|
+
format: _n,
|
|
2700
2700
|
variant: ee,
|
|
2701
2701
|
motion: w ? "none" : "auto"
|
|
2702
2702
|
}) }), /* @__PURE__ */ Q("span", { children: i })]
|
|
@@ -2711,19 +2711,19 @@ function yn({ title: t, value: n = null, target: r, label: i = "of goal", varian
|
|
|
2711
2711
|
}
|
|
2712
2712
|
//#endregion
|
|
2713
2713
|
//#region src/cards/funnel-chart-card.tsx
|
|
2714
|
-
var
|
|
2714
|
+
var xn = [], Sn = [
|
|
2715
2715
|
100,
|
|
2716
2716
|
62,
|
|
2717
2717
|
40,
|
|
2718
2718
|
24
|
|
2719
|
-
],
|
|
2720
|
-
function
|
|
2719
|
+
], Cn = 55, wn = 1.4;
|
|
2720
|
+
function Tn(e) {
|
|
2721
2721
|
return e === null ? "—" : e > 0 && e < .01 ? "<1%" : `${Math.round(e * 100)}%`;
|
|
2722
2722
|
}
|
|
2723
|
-
function
|
|
2723
|
+
function En(e, t, n, r) {
|
|
2724
2724
|
let i = e * 100, a = i + 100, o = (e) => 50 - e / 2, s = (e) => 50 + e / 2, c = n ?? t;
|
|
2725
2725
|
if (r === "linear") return `M${i},${o(t)} L${a},${o(c)} L${a},${s(c)} L${i},${s(t)} Z`;
|
|
2726
|
-
let l = i +
|
|
2726
|
+
let l = i + Cn, u = (a - l) * .5;
|
|
2727
2727
|
return [
|
|
2728
2728
|
`M${i},${o(t)}`,
|
|
2729
2729
|
`L${l},${o(t)}`,
|
|
@@ -2734,8 +2734,8 @@ function Tn(e, t, n, r) {
|
|
|
2734
2734
|
"Z"
|
|
2735
2735
|
].join(" ");
|
|
2736
2736
|
}
|
|
2737
|
-
var
|
|
2738
|
-
function
|
|
2737
|
+
var Dn = .28;
|
|
2738
|
+
function On(e, t, n, r) {
|
|
2739
2739
|
let i = e * 100, a = i + 100, o = n ?? t, s = [];
|
|
2740
2740
|
if (r === "linear") for (let e = 0; e <= 24; e += 1) {
|
|
2741
2741
|
let n = e / 24;
|
|
@@ -2745,7 +2745,7 @@ function Dn(e, t, n, r) {
|
|
|
2745
2745
|
});
|
|
2746
2746
|
}
|
|
2747
2747
|
else {
|
|
2748
|
-
let e = i +
|
|
2748
|
+
let e = i + Cn, n = (a - e) * .5;
|
|
2749
2749
|
s.push({
|
|
2750
2750
|
x: i,
|
|
2751
2751
|
half: t / 2
|
|
@@ -2767,15 +2767,15 @@ function Dn(e, t, n, r) {
|
|
|
2767
2767
|
};
|
|
2768
2768
|
});
|
|
2769
2769
|
}
|
|
2770
|
-
function
|
|
2770
|
+
function kn(e, t, n, r) {
|
|
2771
2771
|
return `M${e},${50 - t}A${n},${t} 0 0 ${+(r === "right")} ${e},${50 + t}`;
|
|
2772
2772
|
}
|
|
2773
|
-
function
|
|
2774
|
-
let O = xe(E), k =
|
|
2773
|
+
function An({ title: e, data: t, category: n, value: r, curve: i = "smooth", colors: a = "stages", tracks: o = !1, depth: s = !1, height: c = 180, headline: l, delta: u, deltaTone: d, range: f, ranges: p, defaultRange: m, valueFormat: h, legend: g = "tiles", legendSwatch: _, locale: v, formatValue: y, color: ee, surface: te = "elevated", badge: x, numberStyle: S, palette: ne, loading: w = !1, loadingStyle: T = "shimmer", motion: E = "auto", className: D, style: re }) {
|
|
2774
|
+
let O = xe(E), k = de({
|
|
2775
2775
|
valueFormat: h,
|
|
2776
2776
|
locale: v,
|
|
2777
2777
|
formatValue: y
|
|
2778
|
-
}), [A, j] = X(m ?? p?.[0]?.id), M = p?.find((e) => e.id === A) ?? p?.[0], N = M?.data ?? t ??
|
|
2778
|
+
}), [A, j] = X(m ?? p?.[0]?.id), M = p?.find((e) => e.id === A) ?? p?.[0], N = M?.data ?? t ?? xn, P = M ? M.delta : u, F = Ue(() => {
|
|
2779
2779
|
try {
|
|
2780
2780
|
let e = (e, t) => e[t];
|
|
2781
2781
|
return {
|
|
@@ -2803,7 +2803,7 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2803
2803
|
N,
|
|
2804
2804
|
n,
|
|
2805
2805
|
r
|
|
2806
|
-
]), I = F.rows, L = Ue(() => I.map((e) => e.share === null ? null : Math.max(
|
|
2806
|
+
]), I = F.rows, L = Ue(() => I.map((e) => e.share === null ? null : Math.max(wn, e.share * 100)), [I]), [R, z] = X({
|
|
2807
2807
|
key: 0,
|
|
2808
2808
|
from: [],
|
|
2809
2809
|
to: L,
|
|
@@ -2815,47 +2815,47 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2815
2815
|
to: L,
|
|
2816
2816
|
initial: !1
|
|
2817
2817
|
});
|
|
2818
|
-
let
|
|
2818
|
+
let ie = Me({
|
|
2819
2819
|
key: R.key,
|
|
2820
2820
|
active: !w,
|
|
2821
2821
|
duration: R.initial ? 720 : 480
|
|
2822
|
-
}, O),
|
|
2822
|
+
}, O), oe = R.initial ? R.to : R.to.map((e, t) => {
|
|
2823
2823
|
let n = R.from[t];
|
|
2824
|
-
return e === null || n == null ? e : n + (e - n) *
|
|
2824
|
+
return e === null || n == null ? e : n + (e - n) * ie;
|
|
2825
2825
|
});
|
|
2826
|
-
B.current =
|
|
2827
|
-
let
|
|
2828
|
-
resolve:
|
|
2829
|
-
onGlide:
|
|
2830
|
-
onLift: (e) => e !== null &&
|
|
2826
|
+
B.current = oe;
|
|
2827
|
+
let V = R.initial ? ie : 1, [H, se] = X(null), [U, W] = X(null), le = Mt({
|
|
2828
|
+
resolve: jt,
|
|
2829
|
+
onGlide: se,
|
|
2830
|
+
onLift: (e) => e !== null && W(e),
|
|
2831
2831
|
disabled: w
|
|
2832
|
-
}), [
|
|
2833
|
-
if (
|
|
2834
|
-
let t = () =>
|
|
2835
|
-
t(),
|
|
2836
|
-
}, [
|
|
2837
|
-
let n =
|
|
2832
|
+
}), [ue, G] = X(0), fe = We(null), pe = ze((e) => {
|
|
2833
|
+
if (le(e), fe.current?.disconnect(), fe.current = null, !e || !s || typeof ResizeObserver > "u") return;
|
|
2834
|
+
let t = () => G(e.getBoundingClientRect().width);
|
|
2835
|
+
t(), fe.current = new ResizeObserver(t), fe.current.observe(e);
|
|
2836
|
+
}, [le, s]), K = U ?? H, me = I.findIndex((e) => e.id === K), he = I[me], ge = me > 0 ? I[me - 1] : void 0, _e = (e) => a === "single" ? "var(--lilt-series-1)" : `var(--lilt-series-${e % 6 + 1})`, ve = w && !I.length ? Sn.length : Math.max(1, I.length), ye = w ? Array.from({ length: ve }, (e, t) => {
|
|
2837
|
+
let n = Sn[t] ?? Sn.at(-1), r = t + 1 < ve ? Sn[t + 1] ?? Sn.at(-1) : null;
|
|
2838
2838
|
return {
|
|
2839
2839
|
id: `loading-${t}`,
|
|
2840
2840
|
index: t,
|
|
2841
2841
|
own: n,
|
|
2842
2842
|
next: r,
|
|
2843
2843
|
to: r ?? n,
|
|
2844
|
-
d:
|
|
2845
|
-
color:
|
|
2844
|
+
d: En(t, n, r, i),
|
|
2845
|
+
color: zt,
|
|
2846
2846
|
muted: void 0
|
|
2847
2847
|
};
|
|
2848
2848
|
}) : I.flatMap((e, t) => {
|
|
2849
|
-
let n =
|
|
2849
|
+
let n = oe[t];
|
|
2850
2850
|
if (n == null) return [];
|
|
2851
|
-
let r = t + 1 < I.length ?
|
|
2851
|
+
let r = t + 1 < I.length ? oe[t + 1] ?? null : null;
|
|
2852
2852
|
return [{
|
|
2853
2853
|
id: e.id,
|
|
2854
2854
|
index: t,
|
|
2855
2855
|
own: n,
|
|
2856
2856
|
next: r,
|
|
2857
2857
|
to: r ?? n,
|
|
2858
|
-
d:
|
|
2858
|
+
d: En(t, n, r, i),
|
|
2859
2859
|
color: _e(t),
|
|
2860
2860
|
muted: he && e.id !== he.id || void 0
|
|
2861
2861
|
}];
|
|
@@ -2866,8 +2866,8 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2866
2866
|
"data-active": e.id === he?.id || void 0,
|
|
2867
2867
|
"data-muted": e.muted,
|
|
2868
2868
|
style: { fill: e.color }
|
|
2869
|
-
}, e.id)), J = s &&
|
|
2870
|
-
let e = ve * 100, t = e /
|
|
2869
|
+
}, e.id)), J = s && ue > 0 && ye.length ? (() => {
|
|
2870
|
+
let e = ve * 100, t = e / ue, n = 100 / c, r = (e) => e / n * Dn * t, i = ye[0], a = ye[ye.length - 1], o = r(i.own / 2), s = r(a.to / 2), l = (e - o - s) / e;
|
|
2871
2871
|
return {
|
|
2872
2872
|
left: o,
|
|
2873
2873
|
sx: l,
|
|
@@ -2892,8 +2892,8 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2892
2892
|
id: `${Se}-clip-${t}`,
|
|
2893
2893
|
children: [
|
|
2894
2894
|
/* @__PURE__ */ Q("path", { d: e.d }),
|
|
2895
|
-
/* @__PURE__ */ Q("path", { d: `${
|
|
2896
|
-
n ? /* @__PURE__ */ Q("path", { d: `${
|
|
2895
|
+
/* @__PURE__ */ Q("path", { d: `${kn(c, a, J.rx(a), "right")}Z` }),
|
|
2896
|
+
n ? /* @__PURE__ */ Q("path", { d: `${kn(s, o, J.rx(o), "left")}Z` }) : null
|
|
2897
2897
|
]
|
|
2898
2898
|
}),
|
|
2899
2899
|
/* @__PURE__ */ $("g", {
|
|
@@ -2906,7 +2906,7 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2906
2906
|
height: o * 2,
|
|
2907
2907
|
style: { fill: Ce(t) }
|
|
2908
2908
|
}) : null,
|
|
2909
|
-
|
|
2909
|
+
On(t, e.own, e.next, i).map((e) => /* @__PURE__ */ Q("rect", {
|
|
2910
2910
|
x: e.x,
|
|
2911
2911
|
y: 50 - e.half,
|
|
2912
2912
|
width: e.width,
|
|
@@ -2930,7 +2930,7 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2930
2930
|
style: { fill: `url(#${Se}-cap-${t})` }
|
|
2931
2931
|
}) : /* @__PURE__ */ Q("path", {
|
|
2932
2932
|
className: "lilt-funnel-card__seam",
|
|
2933
|
-
d:
|
|
2933
|
+
d: kn(c, a, J.rx(a), "right"),
|
|
2934
2934
|
fill: "none",
|
|
2935
2935
|
vectorEffect: "non-scaling-stroke"
|
|
2936
2936
|
})
|
|
@@ -2965,7 +2965,7 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2965
2965
|
format: k.value,
|
|
2966
2966
|
loading: w,
|
|
2967
2967
|
motion: E,
|
|
2968
|
-
children: w ? null : he ? /* @__PURE__ */ $(we, { children: [he.label, he.conversion !== null && ge ? ` · ${
|
|
2968
|
+
children: w ? null : he ? /* @__PURE__ */ $(we, { children: [he.label, he.conversion !== null && ge ? ` · ${Tn(he.conversion)} of ${ge.label}` : ""] }) : P === void 0 ? null : /* @__PURE__ */ Q(Te, {
|
|
2969
2969
|
value: P,
|
|
2970
2970
|
tone: d
|
|
2971
2971
|
})
|
|
@@ -2974,12 +2974,12 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2974
2974
|
kind: F.error ? "error" : "empty",
|
|
2975
2975
|
message: F.error ?? "No stages for this period."
|
|
2976
2976
|
}) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ $("div", {
|
|
2977
|
-
ref:
|
|
2977
|
+
ref: pe,
|
|
2978
2978
|
className: "lilt-funnel-card__plot",
|
|
2979
2979
|
"data-lilt-glide": "",
|
|
2980
2980
|
style: { height: c },
|
|
2981
2981
|
"data-loading": w || void 0,
|
|
2982
|
-
onPointerLeave: () =>
|
|
2982
|
+
onPointerLeave: () => se(null),
|
|
2983
2983
|
children: [/* @__PURE__ */ $("svg", {
|
|
2984
2984
|
"aria-hidden": "true",
|
|
2985
2985
|
className: "lilt-funnel-card__svg",
|
|
@@ -2991,7 +2991,7 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
2991
2991
|
children: /* @__PURE__ */ Q("rect", {
|
|
2992
2992
|
x: -10,
|
|
2993
2993
|
y: -10,
|
|
2994
|
-
width:
|
|
2994
|
+
width: V < 1 ? ve * 100 * V + 10 : ve * 100 + 20,
|
|
2995
2995
|
height: 120
|
|
2996
2996
|
})
|
|
2997
2997
|
}), J ? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("filter", {
|
|
@@ -3039,7 +3039,7 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
3039
3039
|
width: 100,
|
|
3040
3040
|
height: 100
|
|
3041
3041
|
}, `track-${e.id}`)) : null,
|
|
3042
|
-
w ? /* @__PURE__ */ Q(
|
|
3042
|
+
w ? /* @__PURE__ */ Q(Vt, {
|
|
3043
3043
|
width: ve * 100,
|
|
3044
3044
|
height: 100,
|
|
3045
3045
|
reduced: O,
|
|
@@ -3090,17 +3090,17 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
3090
3090
|
left: `${t / ve * 100}%`,
|
|
3091
3091
|
width: `${100 / ve}%`
|
|
3092
3092
|
},
|
|
3093
|
-
onPointerEnter: () =>
|
|
3094
|
-
onClick: () =>
|
|
3093
|
+
onPointerEnter: () => se(e.id),
|
|
3094
|
+
onClick: () => W((t) => t === e.id ? null : e.id),
|
|
3095
3095
|
children: /* @__PURE__ */ Q("span", {
|
|
3096
3096
|
className: "lilt-funnel-card__pill",
|
|
3097
|
-
style: { opacity:
|
|
3098
|
-
children:
|
|
3097
|
+
style: { opacity: V < (t + .5) / ve ? 0 : he && e.id !== he.id ? .45 : 1 },
|
|
3098
|
+
children: Tn(e.share)
|
|
3099
3099
|
})
|
|
3100
3100
|
}, e.id))]
|
|
3101
|
-
}), /* @__PURE__ */ Q(
|
|
3101
|
+
}), /* @__PURE__ */ Q(ce, {
|
|
3102
3102
|
className: "lilt-funnel-card__tiles",
|
|
3103
|
-
variant:
|
|
3103
|
+
variant: ae(g),
|
|
3104
3104
|
swatch: _,
|
|
3105
3105
|
"aria-label": `${e} by stage`,
|
|
3106
3106
|
items: I.map((e, t) => ({
|
|
@@ -3111,20 +3111,20 @@ function kn({ title: e, data: t, category: n, value: r, curve: i = "smooth", col
|
|
|
3111
3111
|
formattedValue: e.value === null ? "No data" : k.value(e.value)
|
|
3112
3112
|
})),
|
|
3113
3113
|
activeId: he?.id ?? null,
|
|
3114
|
-
selectedId:
|
|
3115
|
-
onHoverIdChange:
|
|
3116
|
-
onSelectedIdChange:
|
|
3114
|
+
selectedId: U,
|
|
3115
|
+
onHoverIdChange: se,
|
|
3116
|
+
onSelectedIdChange: W,
|
|
3117
3117
|
renderValue: w ? () => /* @__PURE__ */ Q("span", { className: "lilt-card__skeleton lilt-card__skeleton--tile" }) : void 0
|
|
3118
3118
|
})] })]
|
|
3119
3119
|
});
|
|
3120
3120
|
}
|
|
3121
3121
|
//#endregion
|
|
3122
3122
|
//#region src/cards/heatmap-chart-card.tsx
|
|
3123
|
-
var
|
|
3123
|
+
var jn = [], Mn = {
|
|
3124
3124
|
rows: 7,
|
|
3125
3125
|
columns: 12
|
|
3126
|
-
},
|
|
3127
|
-
function
|
|
3126
|
+
}, Nn = 30, Pn = 12, Fn = 8, In = (e, t) => `${e}\u0000${t}`;
|
|
3127
|
+
function Ln({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
3128
3128
|
let s = (e, t) => e[t], c = (e) => ({
|
|
3129
3129
|
columns: [],
|
|
3130
3130
|
rows: [],
|
|
@@ -3148,7 +3148,7 @@ function In({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
3148
3148
|
if (r) return c(`“${t}” isn’t listed in \`${o}\`.`);
|
|
3149
3149
|
n.push(t);
|
|
3150
3150
|
}
|
|
3151
|
-
let h =
|
|
3151
|
+
let h = In(m, e);
|
|
3152
3152
|
if (d.has(h)) return c(`${m}, ${e} appears twice; each cell needs one row.`);
|
|
3153
3153
|
let g = s(o, r), _ = typeof g == "number" && Number.isFinite(g) ? g : null;
|
|
3154
3154
|
_ !== null && (f = Math.min(f, _), p = Math.max(p, _)), d.set(h, {
|
|
@@ -3170,9 +3170,9 @@ function In({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
3170
3170
|
columns: l,
|
|
3171
3171
|
rows: u,
|
|
3172
3172
|
cells: u.flatMap((e) => l.map((t) => {
|
|
3173
|
-
let n = d.get(
|
|
3173
|
+
let n = d.get(In(e, t)), r = n?.value ?? null;
|
|
3174
3174
|
return {
|
|
3175
|
-
id:
|
|
3175
|
+
id: In(e, t),
|
|
3176
3176
|
label: `${e}, ${t}`,
|
|
3177
3177
|
row: e,
|
|
3178
3178
|
column: t,
|
|
@@ -3185,18 +3185,18 @@ function In({ data: e, x: t, y: n, value: r, columns: i, rows: a, domain: o }) {
|
|
|
3185
3185
|
error: null
|
|
3186
3186
|
};
|
|
3187
3187
|
}
|
|
3188
|
-
var
|
|
3189
|
-
function
|
|
3190
|
-
if (t <=
|
|
3191
|
-
let n = Math.ceil(t /
|
|
3188
|
+
var Rn = (e) => 12 + e * 83;
|
|
3189
|
+
function zn(e, t) {
|
|
3190
|
+
if (t <= Fn) return "major";
|
|
3191
|
+
let n = Math.ceil(t / Pn);
|
|
3192
3192
|
return e % (n * 2) == 0 ? "major" : e % n === 0 ? "minor" : "hidden";
|
|
3193
3193
|
}
|
|
3194
|
-
function
|
|
3195
|
-
let A = xe(re), j = s(E, D), M =
|
|
3194
|
+
function Bn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, domain: c, aggregate: l = "sum", height: u, radius: d = 5, gap: f = 4, depth: p = !1, headline: m, delta: h, deltaTone: g, range: _, ranges: v, defaultRange: y, valueFormat: ee, locale: te, formatValue: x, color: S, surface: C = "elevated", badge: ne, numberStyle: w, palette: T, loading: E = !1, loadingStyle: D = "shimmer", motion: re = "auto", className: O, style: k }) {
|
|
3195
|
+
let A = xe(re), j = s(E, D), M = de({
|
|
3196
3196
|
valueFormat: ee,
|
|
3197
3197
|
locale: te,
|
|
3198
3198
|
formatValue: x
|
|
3199
|
-
}), [N, P] = X(y ?? v?.[0]?.id), F = v?.find((e) => e.id === N) ?? v?.[0], I = F?.data ?? t ??
|
|
3199
|
+
}), [N, P] = X(y ?? v?.[0]?.id), F = v?.find((e) => e.id === N) ?? v?.[0], I = F?.data ?? t ?? jn, L = F ? F.delta : h, R = Ue(() => Ln({
|
|
3200
3200
|
data: I,
|
|
3201
3201
|
x: n,
|
|
3202
3202
|
y: r,
|
|
@@ -3212,10 +3212,10 @@ function zn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3212
3212
|
a,
|
|
3213
3213
|
o,
|
|
3214
3214
|
c
|
|
3215
|
-
]), z =
|
|
3215
|
+
]), z = Pt(R.cells, !E, void 0, void 0, R.columns.length), B = R.cells.find((e) => e.id === z.active?.id), ie = R.cells.flatMap((e) => e.value === null ? [] : [e.value]), ae = F?.headline ?? m ?? se(ie, l), oe = R.cells.some((e) => e.value === null), V = !E && (R.error !== null || R.cells.length === 0), H = E && !R.cells.length ? Mn : {
|
|
3216
3216
|
rows: R.rows.length,
|
|
3217
3217
|
columns: R.columns.length
|
|
3218
|
-
},
|
|
3218
|
+
}, U = u ? Math.max(8, (u - f * Math.max(0, H.rows - 1)) / Math.max(1, H.rows)) : Nn;
|
|
3219
3219
|
return /* @__PURE__ */ $(je, {
|
|
3220
3220
|
motion: re,
|
|
3221
3221
|
className: ["lilt-heatmap-card", O].filter(Boolean).join(" "),
|
|
@@ -3223,8 +3223,8 @@ function zn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3223
3223
|
...k,
|
|
3224
3224
|
"--lilt-heatmap-card-gap": `${f}px`,
|
|
3225
3225
|
"--lilt-heatmap-card-radius": `${d}px`,
|
|
3226
|
-
"--lilt-heatmap-card-row": `${
|
|
3227
|
-
"--lilt-heatmap-card-columns":
|
|
3226
|
+
"--lilt-heatmap-card-row": `${U}px`,
|
|
3227
|
+
"--lilt-heatmap-card-columns": H.columns,
|
|
3228
3228
|
...S ? { "--lilt-heatmap-card-color": S } : {}
|
|
3229
3229
|
},
|
|
3230
3230
|
"aria-label": e,
|
|
@@ -3243,7 +3243,7 @@ function zn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3243
3243
|
onValueChange: P
|
|
3244
3244
|
}) : null,
|
|
3245
3245
|
children: [/* @__PURE__ */ Q(De, { children: e }), /* @__PURE__ */ Q(Ee, {
|
|
3246
|
-
value: B ? B.value :
|
|
3246
|
+
value: B ? B.value : ae,
|
|
3247
3247
|
format: M.value,
|
|
3248
3248
|
loading: E,
|
|
3249
3249
|
motion: re,
|
|
@@ -3257,7 +3257,7 @@ function zn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3257
3257
|
tone: g
|
|
3258
3258
|
})
|
|
3259
3259
|
})]
|
|
3260
|
-
}),
|
|
3260
|
+
}), V ? /* @__PURE__ */ Q(b, {
|
|
3261
3261
|
kind: R.error ? "error" : "empty",
|
|
3262
3262
|
message: R.error ?? "No cells for this period."
|
|
3263
3263
|
}) : E ? /* @__PURE__ */ $("div", {
|
|
@@ -3270,16 +3270,16 @@ function zn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3270
3270
|
children: [/* @__PURE__ */ $("table", {
|
|
3271
3271
|
className: "lilt-heatmap-card__grid",
|
|
3272
3272
|
role: "presentation",
|
|
3273
|
-
children: [/* @__PURE__ */ Q("tbody", { children: Array.from({ length:
|
|
3273
|
+
children: [/* @__PURE__ */ Q("tbody", { children: Array.from({ length: H.rows }, (e, t) => /* @__PURE__ */ $("tr", { children: [/* @__PURE__ */ Q("th", {
|
|
3274
3274
|
className: "lilt-heatmap-card__row-label",
|
|
3275
3275
|
children: R.rows[t]
|
|
3276
|
-
}), Array.from({ length:
|
|
3276
|
+
}), Array.from({ length: H.columns }, (e, n) => /* @__PURE__ */ Q("td", { children: /* @__PURE__ */ Q("span", {
|
|
3277
3277
|
className: "lilt-heatmap-card__skeleton",
|
|
3278
3278
|
style: {
|
|
3279
|
-
"--lilt-shine-delay": `${n /
|
|
3279
|
+
"--lilt-shine-delay": `${n / H.columns * .9}s`,
|
|
3280
3280
|
"--lilt-skeleton-step": n + t
|
|
3281
3281
|
}
|
|
3282
|
-
}) }, n))] }, t)) }), /* @__PURE__ */ Q("tfoot", { children: /* @__PURE__ */ $("tr", { children: [/* @__PURE__ */ Q("td", {}), Array.from({ length:
|
|
3282
|
+
}) }, n))] }, t)) }), /* @__PURE__ */ Q("tfoot", { children: /* @__PURE__ */ $("tr", { children: [/* @__PURE__ */ Q("td", {}), Array.from({ length: H.columns }, (e, t) => /* @__PURE__ */ Q("th", { className: "lilt-heatmap-card__column-label" }, t))] }) })]
|
|
3283
3283
|
}), /* @__PURE__ */ Q("div", {
|
|
3284
3284
|
className: "lilt-heatmap-card__footer",
|
|
3285
3285
|
children: /* @__PURE__ */ Q("span", {
|
|
@@ -3318,7 +3318,7 @@ function zn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3318
3318
|
"data-active": B?.id === a.id || void 0,
|
|
3319
3319
|
"data-muted": B && !o || void 0,
|
|
3320
3320
|
style: {
|
|
3321
|
-
"--lilt-heatmap-card-strength": a.intensity === null ? void 0 : `${
|
|
3321
|
+
"--lilt-heatmap-card-strength": a.intensity === null ? void 0 : `${Rn(a.intensity)}%`,
|
|
3322
3322
|
"--lilt-heatmap-card-delay": `${Math.min(160, r * 12)}ms`
|
|
3323
3323
|
}
|
|
3324
3324
|
})
|
|
@@ -3333,7 +3333,7 @@ function zn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3333
3333
|
scope: "col",
|
|
3334
3334
|
role: "columnheader",
|
|
3335
3335
|
className: "lilt-heatmap-card__column-label",
|
|
3336
|
-
"data-tier":
|
|
3336
|
+
"data-tier": zn(t, R.columns.length),
|
|
3337
3337
|
"data-active": B?.column === e || void 0,
|
|
3338
3338
|
children: /* @__PURE__ */ Q("span", { children: e })
|
|
3339
3339
|
}, e))]
|
|
@@ -3341,7 +3341,7 @@ function zn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3341
3341
|
})]
|
|
3342
3342
|
}), /* @__PURE__ */ $("div", {
|
|
3343
3343
|
className: "lilt-heatmap-card__footer",
|
|
3344
|
-
children: [
|
|
3344
|
+
children: [oe ? /* @__PURE__ */ $("span", {
|
|
3345
3345
|
className: "lilt-heatmap-card__key",
|
|
3346
3346
|
children: [/* @__PURE__ */ Q("span", {
|
|
3347
3347
|
className: "lilt-heatmap-card__swatch",
|
|
@@ -3364,7 +3364,7 @@ function zn({ title: e, data: t, x: n, y: r, value: i, columns: a, rows: o, doma
|
|
|
3364
3364
|
}
|
|
3365
3365
|
//#endregion
|
|
3366
3366
|
//#region src/engine/scatter.ts
|
|
3367
|
-
function
|
|
3367
|
+
function Vn(e, t, n, r, i = !1) {
|
|
3368
3368
|
if (!i) {
|
|
3369
3369
|
let r = null, i = Infinity;
|
|
3370
3370
|
for (let a of e) {
|
|
@@ -3384,7 +3384,7 @@ function Bn(e, t, n, r, i = !1) {
|
|
|
3384
3384
|
}
|
|
3385
3385
|
//#endregion
|
|
3386
3386
|
//#region src/use-chart-width.ts
|
|
3387
|
-
function
|
|
3387
|
+
function Hn() {
|
|
3388
3388
|
let e = We(null), [t, n] = X(0);
|
|
3389
3389
|
return He(() => {
|
|
3390
3390
|
let t = e.current;
|
|
@@ -3400,7 +3400,7 @@ function Vn() {
|
|
|
3400
3400
|
}
|
|
3401
3401
|
//#endregion
|
|
3402
3402
|
//#region src/cards/scatter-chart-card.tsx
|
|
3403
|
-
var
|
|
3403
|
+
var Un = [], Wn = 260, Gn = 4, Kn = 4.5, qn = 3, Jn = [
|
|
3404
3404
|
[
|
|
3405
3405
|
.08,
|
|
3406
3406
|
.72,
|
|
@@ -3462,9 +3462,9 @@ var Hn = [], Un = 260, Wn = 4, Gn = 4.5, Kn = 3, qn = [
|
|
|
3462
3462
|
9
|
|
3463
3463
|
]
|
|
3464
3464
|
];
|
|
3465
|
-
function
|
|
3465
|
+
function Yn(e, t = 5) {
|
|
3466
3466
|
if (!e.length) return [0, 1];
|
|
3467
|
-
let n
|
|
3467
|
+
let [n, r] = Xe(e);
|
|
3468
3468
|
if (n >= 0 && n <= r * .25 && (n = 0), n === r) {
|
|
3469
3469
|
let e = Math.abs(n) || 1;
|
|
3470
3470
|
n -= e, r += e;
|
|
@@ -3472,7 +3472,7 @@ function Jn(e, t = 5) {
|
|
|
3472
3472
|
let [i, a] = Je().domain([n, r]).nice(t).domain();
|
|
3473
3473
|
return [i, a];
|
|
3474
3474
|
}
|
|
3475
|
-
function
|
|
3475
|
+
function Xn(e) {
|
|
3476
3476
|
if (e.length < 3) return null;
|
|
3477
3477
|
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;
|
|
3478
3478
|
for (let { x: t, y: s } of e) i += (t - n) ** 2, a += (t - n) * (s - r), o += (s - r) ** 2;
|
|
@@ -3484,8 +3484,8 @@ function Yn(e) {
|
|
|
3484
3484
|
r2: o === 0 ? 1 : a * a / (i * o)
|
|
3485
3485
|
};
|
|
3486
3486
|
}
|
|
3487
|
-
var
|
|
3488
|
-
function
|
|
3487
|
+
var Zn = (e, t, n) => `${e} ${e === 1 ? t : n}`, Qn = (e, t) => t === void 0 ? void 0 : e[t], $n = (e) => typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
3488
|
+
function er(e, [t, n], [r, i]) {
|
|
3489
3489
|
let a = (t) => e.slope * t + e.intercept, o = t, s = n;
|
|
3490
3490
|
if (e.slope !== 0) {
|
|
3491
3491
|
let t = (r - e.intercept) / e.slope, n = (i - e.intercept) / e.slope;
|
|
@@ -3498,64 +3498,64 @@ function $n(e, [t, n], [r, i]) {
|
|
|
3498
3498
|
a(s)
|
|
3499
3499
|
];
|
|
3500
3500
|
}
|
|
3501
|
-
function
|
|
3502
|
-
let F = xe(M), L =
|
|
3501
|
+
function tr({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, label: s, xLabel: c, yLabel: l, trend: u = !1, depth: d = !1, height: f = Wn, aggregate: p = "sum", headline: m, delta: h, deltaTone: g, range: _, ranges: v, defaultRange: y, valueFormat: ee, legend: te = "tiles", legendSwatch: x, xFormat: C, locale: ne = "en-US", formatValue: w, formatX: T, color: E, surface: D = "elevated", badge: re, numberStyle: O, palette: k, loading: A = !1, loadingStyle: j = "shimmer", motion: M = "auto", className: N, style: P }) {
|
|
3502
|
+
let F = xe(M), L = de({
|
|
3503
3503
|
valueFormat: ee,
|
|
3504
3504
|
locale: ne,
|
|
3505
3505
|
formatValue: w
|
|
3506
|
-
}), R = JSON.stringify(C ?? null), z = Ue(() => I(ne, C), [ne, R]), B = T ?? z.full, [
|
|
3507
|
-
let e = [], t =
|
|
3508
|
-
let t =
|
|
3506
|
+
}), R = JSON.stringify(C ?? null), z = Ue(() => I(ne, C), [ne, R]), B = T ?? z.full, [ie, oe] = X(y ?? v?.[0]?.id), V = v?.find((e) => e.id === ie) ?? v?.[0], H = V?.data ?? t ?? Un, U = V ? V.delta : h, { ref: W, width: ue } = Hn(), G = ue || 480, fe = Ue(() => {
|
|
3507
|
+
let e = [], t = H.map((e) => {
|
|
3508
|
+
let t = Qn(e, s);
|
|
3509
3509
|
return typeof t == "string" && t ? t : null;
|
|
3510
3510
|
}), a = (e) => e !== null && t.indexOf(e) === t.lastIndexOf(e);
|
|
3511
3511
|
return {
|
|
3512
|
-
rows:
|
|
3513
|
-
let l = o === void 0 ? null : String(
|
|
3512
|
+
rows: H.map((s, c) => {
|
|
3513
|
+
let l = o === void 0 ? null : String(Qn(s, o) ?? "");
|
|
3514
3514
|
l !== null && !e.includes(l) && e.push(l);
|
|
3515
3515
|
let u = t[c];
|
|
3516
3516
|
return {
|
|
3517
3517
|
id: a(u) ? u : `${u ?? ""}\u0000${c}`,
|
|
3518
3518
|
label: u ?? `Point ${c + 1}`,
|
|
3519
3519
|
row: s,
|
|
3520
|
-
x: Qn(
|
|
3521
|
-
y: Qn(
|
|
3522
|
-
size: i === void 0 ? 1 : Qn(
|
|
3520
|
+
x: $n(Qn(s, n)),
|
|
3521
|
+
y: $n(Qn(s, r)),
|
|
3522
|
+
size: i === void 0 ? 1 : $n(Qn(s, i)),
|
|
3523
3523
|
group: l
|
|
3524
3524
|
};
|
|
3525
3525
|
}),
|
|
3526
3526
|
groups: e
|
|
3527
3527
|
};
|
|
3528
3528
|
}, [
|
|
3529
|
-
|
|
3529
|
+
H,
|
|
3530
3530
|
n,
|
|
3531
3531
|
r,
|
|
3532
3532
|
i,
|
|
3533
3533
|
o,
|
|
3534
3534
|
s
|
|
3535
|
-
]),
|
|
3535
|
+
]), pe = fe.rows.filter((e) => e.x !== null && e.y !== null), K = fe.rows.length - pe.length, [me, he] = X([]), ge = pe.filter((e) => e.group === null || !me.includes(e.group)), _e = (e) => e === null ? "var(--lilt-scatter-card-color, var(--lilt-series-1))" : `var(--lilt-series-${fe.groups.indexOf(e) % 6 + 1})`, ve = G < 420 ? 3 : 5, ye = Yn(pe.map((e) => e.x), ve), q = Yn(pe.map((e) => e.y), Gn), J = Je().domain(q).ticks(Gn), be = Je().domain(ye).ticks(ve), Se = Math.max(8, Math.min(16, G / 36)), Ce = Math.max(24, ...J.map((e) => L.axis(e).length * 6.6 + 10)), Y = i === void 0 ? 6.5 : Se, Oe = (l ? 26 : 10) + Y, Me = f - 26 - (c ? 16 : 0) - Y, Ne = Ce + Y, Pe = G - Y - 2, Fe = Je().domain(ye).range([Ne, Pe]), Ie = Je().domain(q).range([Me, Oe]), Le = Math.max(1, ...pe.map((e) => e.size ?? 0)), Re = (e) => i === void 0 ? Kn : qn + (Se - qn) * Math.sqrt(Math.max(0, e ?? 0) / Le), Be = [...ge].sort((e, t) => e.x - t.x || e.y - t.y).map((e, t) => ({
|
|
3536
3536
|
...e,
|
|
3537
3537
|
cx: Fe(e.x),
|
|
3538
3538
|
cy: Ie(e.y),
|
|
3539
3539
|
radius: Re(e.size),
|
|
3540
3540
|
color: _e(e.group),
|
|
3541
3541
|
order: t
|
|
3542
|
-
})), He = u ?
|
|
3542
|
+
})), He = u ? Xn(ge) : null, We = He && Be.length ? er(He, [Be[0].x, Be.at(-1).x], q) : null, Ge = z.plain, [Ke, qe] = X(null), [Ye, Xe] = X(null), [Ze, Qe] = X(null), [$e, et] = X(null), [tt, nt] = X(null), rt = (e) => Be.find((t) => t.id === e), it = `lilt-scatter-${Ve().replace(/:/g, "")}`, at = [...new Set(Be.map((e) => e.color))], ot = rt(Ye) ?? rt(Ze) ?? rt(Ke), st = ot ? null : tt ?? $e, ct = fe.groups.map((e) => ({
|
|
3543
3543
|
name: e,
|
|
3544
|
-
value:
|
|
3545
|
-
})), lt =
|
|
3544
|
+
value: se(pe.filter((t) => t.group === e).map((e) => e.y), p)
|
|
3545
|
+
})), lt = V?.headline ?? m ?? se(ge.map((e) => e.y), p), ut = ot ? ot.y : st === null ? lt : ct.find((e) => e.name === st)?.value ?? null, dt = (e) => c ? `${c} ${B(e)}` : B(e), ft = (e) => `${e.label}: ${dt(e.x)}, ${l ? `${l} ` : ""}${L.value(e.y)}${i === void 0 || e.size === null ? "" : `, ${a ?? "size"} ${Ge(e.size)}`}`, pt = (e, t, n) => {
|
|
3546
3546
|
let r = n.getBoundingClientRect();
|
|
3547
|
-
return
|
|
3547
|
+
return Vn(Be, e - r.left, t - r.top, Ye);
|
|
3548
3548
|
}, mt = (e) => {
|
|
3549
3549
|
e.pointerType !== "touch" && qe(pt(e.clientX, e.clientY, e.currentTarget));
|
|
3550
|
-
}, ht =
|
|
3550
|
+
}, ht = Mt({
|
|
3551
3551
|
resolve: pt,
|
|
3552
3552
|
onGlide: qe,
|
|
3553
3553
|
onLift: (e) => e !== null && Xe(e),
|
|
3554
3554
|
onTap: (e) => Xe((t) => e && t !== e ? e : null),
|
|
3555
3555
|
disabled: A
|
|
3556
3556
|
}), gt = ze((e) => {
|
|
3557
|
-
|
|
3558
|
-
}, [ht,
|
|
3557
|
+
W.current = e, ht(e);
|
|
3558
|
+
}, [ht, W]), _t = (e) => {
|
|
3559
3559
|
if (!Be.length) return;
|
|
3560
3560
|
let t = rt(Ze) ?? rt(Ye), n = t ? t.order : -1, r = null;
|
|
3561
3561
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") r = n + 1;
|
|
@@ -3570,7 +3570,7 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3570
3570
|
return;
|
|
3571
3571
|
} else return;
|
|
3572
3572
|
e.preventDefault(), Qe(Be[Math.max(0, Math.min(Be.length - 1, r))].id);
|
|
3573
|
-
}, vt = !A &&
|
|
3573
|
+
}, vt = !A && fe.rows.length === 0, yt = !A && fe.rows.length > 0 && pe.length === 0, bt = (e) => ot && Math.abs(Fe(e) - ot.cx) < 40, xt = (e) => ot && Math.abs(Ie(e) - ot.cy) < 16;
|
|
3574
3574
|
return /* @__PURE__ */ $(je, {
|
|
3575
3575
|
motion: M,
|
|
3576
3576
|
className: ["lilt-scatter-card", N].filter(Boolean).join(" "),
|
|
@@ -3590,8 +3590,8 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3590
3590
|
id: e,
|
|
3591
3591
|
label: t
|
|
3592
3592
|
})),
|
|
3593
|
-
value:
|
|
3594
|
-
onValueChange:
|
|
3593
|
+
value: V?.id,
|
|
3594
|
+
onValueChange: oe
|
|
3595
3595
|
}) : null,
|
|
3596
3596
|
children: [/* @__PURE__ */ Q(De, { children: e }), /* @__PURE__ */ Q(Ee, {
|
|
3597
3597
|
value: A ? null : ut,
|
|
@@ -3602,8 +3602,8 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3602
3602
|
ot.label,
|
|
3603
3603
|
" · ",
|
|
3604
3604
|
dt(ot.x)
|
|
3605
|
-
] }) : st === null ?
|
|
3606
|
-
value:
|
|
3605
|
+
] }) : st === null ? U === void 0 ? null : /* @__PURE__ */ Q(Te, {
|
|
3606
|
+
value: U,
|
|
3607
3607
|
tone: g
|
|
3608
3608
|
}) : /* @__PURE__ */ Q(we, { children: st })
|
|
3609
3609
|
})]
|
|
@@ -3622,7 +3622,7 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3622
3622
|
"data-active": ot ? "" : void 0,
|
|
3623
3623
|
tabIndex: A ? void 0 : 0,
|
|
3624
3624
|
role: "group",
|
|
3625
|
-
"aria-label": `${e}: ${
|
|
3625
|
+
"aria-label": `${e}: ${Zn(Be.length, "point", "points")}. Arrow keys step through them in order of ${c ?? "x"}; Enter pins one.`,
|
|
3626
3626
|
onPointerMove: A ? void 0 : mt,
|
|
3627
3627
|
onPointerLeave: () => qe(null),
|
|
3628
3628
|
onClick: () => Xe((e) => Ke && e !== Ke ? Ke : null),
|
|
@@ -3633,15 +3633,15 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3633
3633
|
"aria-hidden": "true",
|
|
3634
3634
|
className: "lilt-scatter-card__svg",
|
|
3635
3635
|
"data-depth": d || void 0,
|
|
3636
|
-
width:
|
|
3636
|
+
width: G,
|
|
3637
3637
|
height: f,
|
|
3638
|
-
viewBox: `0 0 ${
|
|
3638
|
+
viewBox: `0 0 ${G} ${f}`,
|
|
3639
3639
|
children: [
|
|
3640
3640
|
/* @__PURE__ */ Q("g", {
|
|
3641
3641
|
className: "lilt-scatter-card__grid",
|
|
3642
3642
|
children: J.map((e) => /* @__PURE__ */ Q("line", {
|
|
3643
3643
|
x1: Ce,
|
|
3644
|
-
x2:
|
|
3644
|
+
x2: G,
|
|
3645
3645
|
y1: Ie(e),
|
|
3646
3646
|
y2: Ie(e)
|
|
3647
3647
|
}, e))
|
|
@@ -3681,13 +3681,13 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3681
3681
|
}) : null
|
|
3682
3682
|
]
|
|
3683
3683
|
}),
|
|
3684
|
-
A ? /* @__PURE__ */ $(
|
|
3685
|
-
width:
|
|
3684
|
+
A ? /* @__PURE__ */ $(Vt, {
|
|
3685
|
+
width: G,
|
|
3686
3686
|
height: f,
|
|
3687
3687
|
reduced: F,
|
|
3688
3688
|
loadingStyle: j,
|
|
3689
3689
|
depth: d,
|
|
3690
|
-
mask:
|
|
3690
|
+
mask: Jn.map(([e, t, n], r) => /* @__PURE__ */ Q("circle", {
|
|
3691
3691
|
cx: Ne + (Pe - Ne) * e,
|
|
3692
3692
|
cy: Oe + (Me - Oe) * t,
|
|
3693
3693
|
r: i === void 0 ? 5.5 : n,
|
|
@@ -3695,19 +3695,19 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3695
3695
|
}, r)),
|
|
3696
3696
|
children: [d ? /* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(S, {
|
|
3697
3697
|
id: `${it}-loading`,
|
|
3698
|
-
color:
|
|
3699
|
-
}), /* @__PURE__ */ Q(
|
|
3698
|
+
color: zt
|
|
3699
|
+
}), /* @__PURE__ */ Q(le, {
|
|
3700
3700
|
id: `${it}-loading-shadow`,
|
|
3701
3701
|
size: 2.2,
|
|
3702
3702
|
region: {
|
|
3703
3703
|
x: 0,
|
|
3704
3704
|
y: 0,
|
|
3705
|
-
width:
|
|
3705
|
+
width: G,
|
|
3706
3706
|
height: f
|
|
3707
3707
|
}
|
|
3708
3708
|
})] }) : null, /* @__PURE__ */ Q("g", {
|
|
3709
3709
|
filter: d ? `url(#${it}-loading-shadow)` : void 0,
|
|
3710
|
-
children:
|
|
3710
|
+
children: Jn.map(([e, t, n], r) => /* @__PURE__ */ Q("g", {
|
|
3711
3711
|
"data-skeleton": "pop",
|
|
3712
3712
|
style: { "--lilt-skeleton-step": e * 12 },
|
|
3713
3713
|
children: /* @__PURE__ */ Q("circle", {
|
|
@@ -3741,13 +3741,13 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3741
3741
|
y2: ot.cy
|
|
3742
3742
|
})]
|
|
3743
3743
|
}) : null,
|
|
3744
|
-
d ? /* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(
|
|
3744
|
+
d ? /* @__PURE__ */ $("defs", { children: [/* @__PURE__ */ Q(le, {
|
|
3745
3745
|
id: `${it}-shadow`,
|
|
3746
3746
|
size: 2.2,
|
|
3747
3747
|
region: {
|
|
3748
3748
|
x: 0,
|
|
3749
3749
|
y: 0,
|
|
3750
|
-
width:
|
|
3750
|
+
width: G,
|
|
3751
3751
|
height: f
|
|
3752
3752
|
}
|
|
3753
3753
|
}), at.map((e, t) => /* @__PURE__ */ Q(S, {
|
|
@@ -3791,7 +3791,7 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3791
3791
|
}), /* @__PURE__ */ Q("div", {
|
|
3792
3792
|
className: "lilt-chart__y-badge lilt-scatter-card__pill",
|
|
3793
3793
|
style: {
|
|
3794
|
-
right:
|
|
3794
|
+
right: G - Ce + 4,
|
|
3795
3795
|
top: ot.cy,
|
|
3796
3796
|
transform: "translateY(-50%)"
|
|
3797
3797
|
},
|
|
@@ -3804,9 +3804,9 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3804
3804
|
})
|
|
3805
3805
|
]
|
|
3806
3806
|
}),
|
|
3807
|
-
o !== void 0 &&
|
|
3807
|
+
o !== void 0 && fe.groups.length ? /* @__PURE__ */ Q(ce, {
|
|
3808
3808
|
className: "lilt-card__tiles",
|
|
3809
|
-
variant:
|
|
3809
|
+
variant: ae(te),
|
|
3810
3810
|
swatch: x,
|
|
3811
3811
|
"aria-label": `${e} by group`,
|
|
3812
3812
|
items: ct.map((e) => ({
|
|
@@ -3824,9 +3824,9 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3824
3824
|
},
|
|
3825
3825
|
renderValue: A ? () => /* @__PURE__ */ Q("span", { className: "lilt-card__skeleton lilt-card__skeleton--tile" }) : void 0
|
|
3826
3826
|
}) : null,
|
|
3827
|
-
!A && (He ||
|
|
3827
|
+
!A && (He || K) ? /* @__PURE__ */ $("div", {
|
|
3828
3828
|
className: "lilt-scatter-card__footer",
|
|
3829
|
-
children: [
|
|
3829
|
+
children: [K ? /* @__PURE__ */ $("span", { children: [Zn(K, "point is", "points are"), " missing a value and not plotted"] }) : null, He ? /* @__PURE__ */ $("span", {
|
|
3830
3830
|
className: "lilt-scatter-card__fit",
|
|
3831
3831
|
children: [
|
|
3832
3832
|
/* @__PURE__ */ Q("span", {
|
|
@@ -3864,7 +3864,7 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3864
3864
|
children: a ?? i
|
|
3865
3865
|
})
|
|
3866
3866
|
] }) }),
|
|
3867
|
-
/* @__PURE__ */ Q("tbody", { children:
|
|
3867
|
+
/* @__PURE__ */ Q("tbody", { children: fe.rows.map((e) => /* @__PURE__ */ $("tr", { children: [
|
|
3868
3868
|
/* @__PURE__ */ Q("th", {
|
|
3869
3869
|
scope: "row",
|
|
3870
3870
|
children: e.label
|
|
@@ -3881,7 +3881,7 @@ function er({ title: e, data: t, x: n, y: r, size: i, sizeLabel: a, group: o, la
|
|
|
3881
3881
|
}
|
|
3882
3882
|
//#endregion
|
|
3883
3883
|
//#region src/engine/sankey.ts
|
|
3884
|
-
function
|
|
3884
|
+
function nr(e, t, n) {
|
|
3885
3885
|
let r = /* @__PURE__ */ new Set();
|
|
3886
3886
|
for (let t of e) {
|
|
3887
3887
|
if (!t.id || !t.label || r.has(t.id)) throw Error("Lilt SankeyChart requires unique nonempty node IDs and labels.");
|
|
@@ -3923,7 +3923,7 @@ function tr(e, t, n) {
|
|
|
3923
3923
|
losses: d
|
|
3924
3924
|
};
|
|
3925
3925
|
}
|
|
3926
|
-
function
|
|
3926
|
+
function rr(e, t, n, r = !1) {
|
|
3927
3927
|
if (!e.nodes.length) return {
|
|
3928
3928
|
nodes: [],
|
|
3929
3929
|
links: []
|
|
@@ -3970,7 +3970,7 @@ function nr(e, t, n, r = !1) {
|
|
|
3970
3970
|
}
|
|
3971
3971
|
//#endregion
|
|
3972
3972
|
//#region src/cards/sankey-chart-card.tsx
|
|
3973
|
-
var
|
|
3973
|
+
var ir = [], ar = 280, or = 460, sr = 6, cr = [
|
|
3974
3974
|
[
|
|
3975
3975
|
.02,
|
|
3976
3976
|
.32,
|
|
@@ -4006,14 +4006,14 @@ var rr = [], ir = 280, ar = 460, or = 6, sr = [
|
|
|
4006
4006
|
.8,
|
|
4007
4007
|
.12
|
|
4008
4008
|
]
|
|
4009
|
-
],
|
|
4010
|
-
function
|
|
4009
|
+
], lr = (e, t) => e[t];
|
|
4010
|
+
function ur(e) {
|
|
4011
4011
|
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;
|
|
4012
4012
|
}
|
|
4013
|
-
function
|
|
4013
|
+
function dr({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
4014
4014
|
let a = [], o = /* @__PURE__ */ new Set(), s = [], c = /* @__PURE__ */ new Set();
|
|
4015
4015
|
for (let i of e) {
|
|
4016
|
-
let e = String(
|
|
4016
|
+
let e = String(lr(i, t) ?? "").trim(), l = String(lr(i, n) ?? "").trim();
|
|
4017
4017
|
if (!e || !l) return {
|
|
4018
4018
|
graph: null,
|
|
4019
4019
|
error: "Every flow needs a source and a target."
|
|
@@ -4028,7 +4028,7 @@ function ur({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
|
4028
4028
|
error: `${u} appears twice; combine it into one row.`
|
|
4029
4029
|
};
|
|
4030
4030
|
c.add(u);
|
|
4031
|
-
let d =
|
|
4031
|
+
let d = lr(i, r);
|
|
4032
4032
|
s.push({
|
|
4033
4033
|
id: u,
|
|
4034
4034
|
source: e,
|
|
@@ -4039,23 +4039,23 @@ function ur({ data: e, source: t, target: n, value: r, conservation: i }) {
|
|
|
4039
4039
|
}
|
|
4040
4040
|
try {
|
|
4041
4041
|
return {
|
|
4042
|
-
graph:
|
|
4042
|
+
graph: nr(a, s, i === "strict" ? "strict" : "allow-loss"),
|
|
4043
4043
|
error: null
|
|
4044
4044
|
};
|
|
4045
4045
|
} catch (e) {
|
|
4046
4046
|
return {
|
|
4047
4047
|
graph: null,
|
|
4048
|
-
error:
|
|
4048
|
+
error: ur(e instanceof Error ? e.message : "Invalid flows.")
|
|
4049
4049
|
};
|
|
4050
4050
|
}
|
|
4051
4051
|
}
|
|
4052
|
-
var
|
|
4053
|
-
function
|
|
4054
|
-
let D = xe(w), re =
|
|
4052
|
+
var fr = (e, t, n) => `${e} ${e === 1 ? t : n}`, pr = (e, t) => t > 0 ? `${Math.round(e / t * 100)}%` : "—";
|
|
4053
|
+
function mr({ title: t, data: n, source: r, target: i, value: a, conservation: o = "loss", depth: s = !1, height: c = ar, headline: l, delta: u, deltaTone: d, range: f, ranges: p, defaultRange: m, valueFormat: h, locale: _, formatValue: v, surface: y = "elevated", badge: ee, numberStyle: te, palette: S, loading: C = !1, loadingStyle: ne = "shimmer", motion: w = "auto", className: T, style: E }) {
|
|
4054
|
+
let D = xe(w), re = de({
|
|
4055
4055
|
valueFormat: h,
|
|
4056
4056
|
locale: _,
|
|
4057
4057
|
formatValue: v
|
|
4058
|
-
}), [O, k] = X(m ?? p?.[0]?.id), A = p?.find((e) => e.id === O) ?? p?.[0], j = A?.data ?? n ??
|
|
4058
|
+
}), [O, k] = X(m ?? p?.[0]?.id), A = p?.find((e) => e.id === O) ?? p?.[0], j = A?.data ?? n ?? ir, M = A ? A.delta : u, { ref: N, width: P } = Hn(), F = P || 520, I = F < or, L = `lilt-sankey-card-${Ve().replace(/:/g, "")}`, R = Ue(() => dr({
|
|
4059
4059
|
data: j,
|
|
4060
4060
|
source: r,
|
|
4061
4061
|
target: i,
|
|
@@ -4067,7 +4067,7 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4067
4067
|
i,
|
|
4068
4068
|
a,
|
|
4069
4069
|
o
|
|
4070
|
-
]), z = R.graph, B = Ue(() => z ?
|
|
4070
|
+
]), z = R.graph, B = Ue(() => z ? rr(z, F, c, I) : {
|
|
4071
4071
|
nodes: [],
|
|
4072
4072
|
links: []
|
|
4073
4073
|
}, [
|
|
@@ -4075,12 +4075,12 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4075
4075
|
F,
|
|
4076
4076
|
c,
|
|
4077
4077
|
I
|
|
4078
|
-
]),
|
|
4079
|
-
let t =
|
|
4078
|
+
]), ie = new Map(z?.nodes.map((e, t) => [e.id, t]) ?? []), ae = (e) => `var(--lilt-series-${(ie.get(e) ?? 0) % 6 + 1})`, oe = Math.max(0, ...B.nodes.map((e) => e.depth)), V = (e) => z?.links.filter((t) => t.target === e && t.value !== null).reduce((e, t) => e + t.value, 0) ?? 0, se = (e) => z?.links.filter((t) => t.source === e && t.value !== null).reduce((e, t) => e + t.value, 0) ?? 0, U = (e) => z?.links.some((t) => (t.source === e || t.target === e) && t.value !== null) ? Math.max(V(e), se(e)) : null, ce = (e) => {
|
|
4079
|
+
let t = U(e);
|
|
4080
4080
|
return t === null ? "—" : re.value(t);
|
|
4081
|
-
},
|
|
4082
|
-
resolve:
|
|
4083
|
-
onGlide:
|
|
4081
|
+
}, W = B.nodes.filter((e) => e.depth === 0).reduce((e, t) => e + se(t.id), 0) || 0, le = z?.links.filter((e) => e.value === null).length ?? 0, ue = B.nodes.filter((e) => e.depth === 0).length, G = [...B.links].sort((e, t) => (B.nodes.find((t) => t.id === e.source)?.depth ?? 0) - (B.nodes.find((e) => e.id === t.source)?.depth ?? 0) || e.sourceY - t.sourceY), [fe, pe] = X(null), [K, me] = X(null), [he, ge] = X(null), _e = K ?? he ?? fe, ve = Mt({
|
|
4082
|
+
resolve: jt,
|
|
4083
|
+
onGlide: pe,
|
|
4084
4084
|
onLift: (e) => e !== null && me(e),
|
|
4085
4085
|
disabled: C
|
|
4086
4086
|
}), ye = ze((e) => {
|
|
@@ -4089,32 +4089,32 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4089
4089
|
key: A?.id ?? 0,
|
|
4090
4090
|
active: !C,
|
|
4091
4091
|
duration: 720
|
|
4092
|
-
}, D), Ce = A?.headline ?? l ??
|
|
4093
|
-
if (q) Ce = q.value, Y = `${q.source} → ${q.target} · ${
|
|
4092
|
+
}, D), Ce = A?.headline ?? l ?? W, Y = null;
|
|
4093
|
+
if (q) Ce = q.value, Y = `${q.source} → ${q.target} · ${pr(q.value, U(q.source) ?? 0)} of ${q.source}`;
|
|
4094
4094
|
else if (J) {
|
|
4095
|
-
let e =
|
|
4095
|
+
let e = U(J.id), t = z?.losses[J.id];
|
|
4096
4096
|
Ce = e;
|
|
4097
|
-
let n = J.depth === 0 &&
|
|
4098
|
-
Y = e === null ? `${J.label} · Not measured` : n || !
|
|
4097
|
+
let n = J.depth === 0 && ue === 1;
|
|
4098
|
+
Y = e === null ? `${J.label} · Not measured` : n || !W ? J.label : `${J.label} · ${pr(e, W)} of all`, t && (Y += ` · ${re.value(t)} left here`);
|
|
4099
4099
|
}
|
|
4100
|
-
let Oe = () => q ? `${q.source} to ${q.target}: ${re.value(q.value)}` : J ? `${J.label}: ${
|
|
4101
|
-
if (!
|
|
4102
|
-
let t =
|
|
4100
|
+
let Oe = () => q ? `${q.source} to ${q.target}: ${re.value(q.value)}` : J ? `${J.label}: ${ce(J.id)}` : "", Ne = (e) => {
|
|
4101
|
+
if (!G.length) return;
|
|
4102
|
+
let t = G.findIndex((e) => e.id === (he ?? K)), n = null;
|
|
4103
4103
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") n = t + 1;
|
|
4104
|
-
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") n = t < 0 ?
|
|
4104
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") n = t < 0 ? G.length - 1 : t - 1;
|
|
4105
4105
|
else if (e.key === "Home") n = 0;
|
|
4106
|
-
else if (e.key === "End") n =
|
|
4106
|
+
else if (e.key === "End") n = G.length - 1;
|
|
4107
4107
|
else if ((e.key === "Enter" || e.key === " ") && t >= 0) {
|
|
4108
4108
|
e.preventDefault();
|
|
4109
|
-
let n =
|
|
4109
|
+
let n = G[t].id;
|
|
4110
4110
|
me((e) => e === n ? null : n);
|
|
4111
4111
|
return;
|
|
4112
4112
|
} else if (e.key === "Escape") {
|
|
4113
4113
|
me(null), ge(null);
|
|
4114
4114
|
return;
|
|
4115
4115
|
} else return;
|
|
4116
|
-
e.preventDefault(), ge(
|
|
4117
|
-
}, Pe = (e) => I ? e ===
|
|
4116
|
+
e.preventDefault(), ge(G[Math.max(0, Math.min(G.length - 1, n))].id);
|
|
4117
|
+
}, Pe = (e) => I ? e === oe ? "end" : "start" : e === 0 ? "end" : "start", Fe = !C && !R.error && j.length === 0;
|
|
4118
4118
|
return /* @__PURE__ */ $(je, {
|
|
4119
4119
|
motion: w,
|
|
4120
4120
|
className: ["lilt-sankey-card", T].filter(Boolean).join(" "),
|
|
@@ -4158,10 +4158,10 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4158
4158
|
"data-active": _e ? "" : void 0,
|
|
4159
4159
|
tabIndex: C ? void 0 : 0,
|
|
4160
4160
|
role: "group",
|
|
4161
|
-
"aria-label": `${t}: ${
|
|
4161
|
+
"aria-label": `${t}: ${fr(B.links.length, "flow", "flows")} between ${fr(B.nodes.length, "step", "steps")}. Arrow keys step through the flows; Enter pins one.`,
|
|
4162
4162
|
onKeyDown: C ? void 0 : Ne,
|
|
4163
4163
|
onBlur: () => ge(null),
|
|
4164
|
-
onPointerLeave: () =>
|
|
4164
|
+
onPointerLeave: () => pe(null),
|
|
4165
4165
|
onClick: (e) => {
|
|
4166
4166
|
let t = e.target;
|
|
4167
4167
|
(t === e.currentTarget || t.tagName === "svg") && me(null);
|
|
@@ -4172,13 +4172,13 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4172
4172
|
width: F,
|
|
4173
4173
|
height: c,
|
|
4174
4174
|
viewBox: `0 0 ${F} ${c}`,
|
|
4175
|
-
children: C ? /* @__PURE__ */ Q(
|
|
4175
|
+
children: C ? /* @__PURE__ */ Q(Vt, {
|
|
4176
4176
|
width: F,
|
|
4177
4177
|
height: c,
|
|
4178
4178
|
reduced: D,
|
|
4179
4179
|
loadingStyle: ne,
|
|
4180
4180
|
depth: s,
|
|
4181
|
-
mask:
|
|
4181
|
+
mask: cr.map(([e, t, n, r, i], a) => {
|
|
4182
4182
|
let o = (e + n) / 2 * F;
|
|
4183
4183
|
return /* @__PURE__ */ Q("path", {
|
|
4184
4184
|
d: `M${e * F},${t * c} C${o},${t * c} ${o},${r * c} ${n * F},${r * c}`,
|
|
@@ -4187,7 +4187,7 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4187
4187
|
strokeWidth: i * c
|
|
4188
4188
|
}, a);
|
|
4189
4189
|
}),
|
|
4190
|
-
children:
|
|
4190
|
+
children: cr.map(([t, n, r, i, a], o) => {
|
|
4191
4191
|
let l = (t + r) / 2 * F, u = `M${t * F},${n * c} C${l},${n * c} ${l},${i * c} ${r * F},${i * c}`, d = { "--lilt-skeleton-step": t * 12 + o * .6 }, f = {
|
|
4192
4192
|
pathLength: 1,
|
|
4193
4193
|
strokeDasharray: 1
|
|
@@ -4199,7 +4199,7 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4199
4199
|
d: u,
|
|
4200
4200
|
fill: "none",
|
|
4201
4201
|
transform: e.transform,
|
|
4202
|
-
stroke: g(
|
|
4202
|
+
stroke: g(zt, e.amount),
|
|
4203
4203
|
strokeWidth: e.strokeWidth,
|
|
4204
4204
|
"data-skeleton": "stroke",
|
|
4205
4205
|
...f
|
|
@@ -4232,7 +4232,7 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4232
4232
|
"data-glide-id": t.id,
|
|
4233
4233
|
"data-active": t.id === q?.id || void 0,
|
|
4234
4234
|
"data-muted": _e && !be(t) || void 0,
|
|
4235
|
-
onPointerEnter: () =>
|
|
4235
|
+
onPointerEnter: () => pe(t.id),
|
|
4236
4236
|
onClick: (e) => {
|
|
4237
4237
|
e.stopPropagation(), me((e) => e === t.id ? null : t.id);
|
|
4238
4238
|
}
|
|
@@ -4244,7 +4244,7 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4244
4244
|
fill: "none",
|
|
4245
4245
|
transform: e.transform,
|
|
4246
4246
|
style: {
|
|
4247
|
-
stroke: g(
|
|
4247
|
+
stroke: g(ae(t.source), e.amount),
|
|
4248
4248
|
strokeWidth: e.strokeWidth,
|
|
4249
4249
|
strokeOpacity: 1
|
|
4250
4250
|
}
|
|
@@ -4253,17 +4253,17 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4253
4253
|
...n,
|
|
4254
4254
|
d: t.path,
|
|
4255
4255
|
strokeWidth: t.width,
|
|
4256
|
-
style: { stroke:
|
|
4256
|
+
style: { stroke: ae(t.source) }
|
|
4257
4257
|
}, t.id);
|
|
4258
4258
|
})
|
|
4259
4259
|
}),
|
|
4260
4260
|
B.nodes.map((e) => {
|
|
4261
4261
|
let t = _e && e.id !== J?.id && e.id !== q?.source && e.id !== q?.target || void 0, n = Math.max(2, e.height), r = {
|
|
4262
|
-
onPointerEnter: () =>
|
|
4262
|
+
onPointerEnter: () => pe(e.id),
|
|
4263
4263
|
onClick: () => me((t) => t === e.id ? null : e.id)
|
|
4264
4264
|
};
|
|
4265
4265
|
if (s) {
|
|
4266
|
-
let i =
|
|
4266
|
+
let i = H(e.x, e.y, e.width + sr, n, sr), a = x(ae(e.id));
|
|
4267
4267
|
return /* @__PURE__ */ $("g", {
|
|
4268
4268
|
className: "lilt-sankey-card__node",
|
|
4269
4269
|
"data-node": e.id,
|
|
@@ -4296,7 +4296,7 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4296
4296
|
width: e.width,
|
|
4297
4297
|
height: n,
|
|
4298
4298
|
rx: 3,
|
|
4299
|
-
style: { fill:
|
|
4299
|
+
style: { fill: ae(e.id) },
|
|
4300
4300
|
...r
|
|
4301
4301
|
}, e.id);
|
|
4302
4302
|
}),
|
|
@@ -4316,7 +4316,7 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4316
4316
|
x: n,
|
|
4317
4317
|
dy: "1.25em",
|
|
4318
4318
|
className: "lilt-sankey-card__label-value",
|
|
4319
|
-
children:
|
|
4319
|
+
children: ce(e.id)
|
|
4320
4320
|
})]
|
|
4321
4321
|
}, e.id);
|
|
4322
4322
|
})
|
|
@@ -4327,13 +4327,13 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4327
4327
|
children: Oe()
|
|
4328
4328
|
})]
|
|
4329
4329
|
}),
|
|
4330
|
-
!C &&
|
|
4330
|
+
!C && le ? /* @__PURE__ */ $("p", {
|
|
4331
4331
|
className: "lilt-sankey-card__footer",
|
|
4332
4332
|
children: [
|
|
4333
|
-
|
|
4333
|
+
fr(le, "flow isn’t", "flows aren’t"),
|
|
4334
4334
|
" measured yet and",
|
|
4335
4335
|
" ",
|
|
4336
|
-
|
|
4336
|
+
le === 1 ? "isn’t" : "aren’t",
|
|
4337
4337
|
" drawn; totals count measured flows only."
|
|
4338
4338
|
]
|
|
4339
4339
|
}) : null,
|
|
@@ -4370,34 +4370,34 @@ function pr({ title: t, data: n, source: r, target: i, value: a, conservation: o
|
|
|
4370
4370
|
}
|
|
4371
4371
|
//#endregion
|
|
4372
4372
|
//#region src/cards/radar-chart-card.tsx
|
|
4373
|
-
var
|
|
4374
|
-
function
|
|
4375
|
-
if (e.length *
|
|
4373
|
+
var hr = [], gr = 300, _r = 4, vr = 6.6;
|
|
4374
|
+
function yr(e, t) {
|
|
4375
|
+
if (e.length * vr <= t || !e.includes(" ")) return [e];
|
|
4376
4376
|
let n = e.length / 2, r = -1;
|
|
4377
4377
|
for (let t = 0; t < e.length; t++) e[t] === " " && (r < 0 || Math.abs(t - n) < Math.abs(r - n)) && (r = t);
|
|
4378
4378
|
return [e.slice(0, r), e.slice(r + 1)];
|
|
4379
4379
|
}
|
|
4380
|
-
var
|
|
4380
|
+
var br = [
|
|
4381
4381
|
.72,
|
|
4382
4382
|
.58,
|
|
4383
4383
|
.84,
|
|
4384
4384
|
.5,
|
|
4385
4385
|
.66,
|
|
4386
4386
|
.78
|
|
4387
|
-
],
|
|
4388
|
-
function
|
|
4387
|
+
], xr = (e, t) => e[t], Sr = (e) => typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
4388
|
+
function Cr({ data: e, category: t, series: n, domain: r }) {
|
|
4389
4389
|
let i = (e) => ({
|
|
4390
4390
|
dimensions: [],
|
|
4391
4391
|
domain: [0, 1],
|
|
4392
4392
|
error: e
|
|
4393
4393
|
}), a = [], o = /* @__PURE__ */ new Set();
|
|
4394
4394
|
for (let r of e) {
|
|
4395
|
-
let e = String(
|
|
4395
|
+
let e = String(xr(r, t) ?? "").trim();
|
|
4396
4396
|
if (!e) return i("Every dimension needs a name.");
|
|
4397
4397
|
if (o.has(e)) return i(`“${e}” appears twice; each dimension needs one row.`);
|
|
4398
4398
|
o.add(e), a.push({
|
|
4399
4399
|
name: e,
|
|
4400
|
-
values: n.map((e) => xr(
|
|
4400
|
+
values: n.map((e) => Sr(xr(r, e)))
|
|
4401
4401
|
});
|
|
4402
4402
|
}
|
|
4403
4403
|
if (a.length && a.length < 3) return i("A radar needs at least three dimensions to draw a shape.");
|
|
@@ -4408,30 +4408,30 @@ function Sr({ data: e, category: t, series: n, domain: r }) {
|
|
|
4408
4408
|
domain: r,
|
|
4409
4409
|
error: null
|
|
4410
4410
|
} : i("`domain` needs a low end below its high end.");
|
|
4411
|
-
let c = Math.min(0, ...s), l = Math.max(c + 1, ...s), [u, d] = Je().domain([c, l]).nice(
|
|
4411
|
+
let c = Math.min(0, ...s), l = Math.max(c + 1, ...s), [u, d] = Je().domain([c, l]).nice(_r).domain();
|
|
4412
4412
|
return {
|
|
4413
4413
|
dimensions: a,
|
|
4414
4414
|
domain: [u, d],
|
|
4415
4415
|
error: null
|
|
4416
4416
|
};
|
|
4417
4417
|
}
|
|
4418
|
-
var
|
|
4419
|
-
function
|
|
4418
|
+
var wr = (e) => Math.round(e * 100) / 100 || 0;
|
|
4419
|
+
function Tr(e, t, n, r) {
|
|
4420
4420
|
let i = e / t * Math.PI * 2;
|
|
4421
4421
|
return {
|
|
4422
|
-
x:
|
|
4423
|
-
y:
|
|
4422
|
+
x: wr(Math.sin(i) * r * n),
|
|
4423
|
+
y: wr(-Math.cos(i) * r * n)
|
|
4424
4424
|
};
|
|
4425
4425
|
}
|
|
4426
|
-
function
|
|
4426
|
+
function Er(e, t) {
|
|
4427
4427
|
let n = e.length, r = e.every((e) => e !== null), i = "";
|
|
4428
4428
|
if (e.forEach((r, a) => {
|
|
4429
4429
|
if (r === null) return;
|
|
4430
|
-
let { x: o, y: s } =
|
|
4430
|
+
let { x: o, y: s } = Tr(a, n, r, t), c = e[(a - 1 + n) % n];
|
|
4431
4431
|
i += `${i && c !== null ? "L" : "M"}${o.toFixed(2)},${s.toFixed(2)} `;
|
|
4432
4432
|
}), r) i += "Z";
|
|
4433
4433
|
else if (e[0] !== null && e[n - 1] !== null) {
|
|
4434
|
-
let { x: r, y: a } =
|
|
4434
|
+
let { x: r, y: a } = Tr(0, n, e[0], t);
|
|
4435
4435
|
i += `L${r.toFixed(2)},${a.toFixed(2)}`;
|
|
4436
4436
|
}
|
|
4437
4437
|
return {
|
|
@@ -4439,12 +4439,12 @@ function Tr(e, t) {
|
|
|
4439
4439
|
complete: r
|
|
4440
4440
|
};
|
|
4441
4441
|
}
|
|
4442
|
-
function
|
|
4443
|
-
let E = xe(ne), D =
|
|
4442
|
+
function Dr({ title: e, data: t, category: n, series: r, domain: i, aggregate: a = "mean", grid: o = "polygon", height: s = gr, headline: c, delta: l, deltaTone: u, range: d, ranges: f, defaultRange: p, valueFormat: m, legend: h = "tiles", legendSwatch: g, locale: _, formatValue: v, surface: y = "elevated", badge: ee, numberStyle: te, palette: x, loading: S = !1, loadingStyle: C = "shimmer", motion: ne = "auto", className: w, style: T }) {
|
|
4443
|
+
let E = xe(ne), D = de({
|
|
4444
4444
|
valueFormat: m,
|
|
4445
4445
|
locale: _,
|
|
4446
4446
|
formatValue: v
|
|
4447
|
-
}), [re, O] = X(p ?? f?.[0]?.id), k = f?.find((e) => e.id === re) ?? f?.[0], A = k?.data ?? t ??
|
|
4447
|
+
}), [re, O] = X(p ?? f?.[0]?.id), k = f?.find((e) => e.id === re) ?? f?.[0], A = k?.data ?? t ?? hr, j = k ? k.delta : l, { ref: M, width: N } = Hn(), P = N || 480, F = r.map((e) => e.key), I = F.join("\0"), L = Ue(() => Cr({
|
|
4448
4448
|
data: A,
|
|
4449
4449
|
category: n,
|
|
4450
4450
|
series: F,
|
|
@@ -4454,22 +4454,22 @@ function Er({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4454
4454
|
n,
|
|
4455
4455
|
I,
|
|
4456
4456
|
i
|
|
4457
|
-
]), { dimensions: R, domain: z } = L, B = R.length,
|
|
4457
|
+
]), { dimensions: R, domain: z } = L, B = R.length, ie = z[1] - z[0], oe = (e) => e === null ? null : (e - z[0]) / ie, V = (e) => r[e]?.color ?? `var(--lilt-series-${e % 6 + 1})`, H = (e) => r[e]?.label ?? F[e], U = Math.max(0, r.findIndex((e) => !e.dashed)), W = (e) => e.name + (e.values.some((e) => e === null) ? " · no data" : ""), le = Math.min(Math.max(40, ...R.map((e) => W(e).length * vr)) + 14, P * .24), ue = Math.max(40, Math.min((P - le * 2) / 2, (s - 52) / 2)), G = Math.max(1, ...R.flatMap((e) => yr(W(e), le - 14).map((e) => e.length * vr))), fe = Math.max(10 / 12, Math.min(1, (le - 14) / G)), pe = P / 2, K = s / 2, me = Me({
|
|
4458
4458
|
key: k?.id ?? 0,
|
|
4459
4459
|
active: !S && B > 0,
|
|
4460
4460
|
duration: 640
|
|
4461
|
-
}, E), [he, ge] = X(null), [_e, ve] = X(null), [ye, q] = X(null), [J, be] = X(null), [Se, Ce] = X(null), Y = _e ?? ye ?? he, Oe = Y === null ? void 0 : R[Y], Ne = Se ?? J, [Pe, Fe] = X([]), Ie = (e) => Pe.includes(F[e]), Le = r.map((e, t) =>
|
|
4461
|
+
}, E), [he, ge] = X(null), [_e, ve] = X(null), [ye, q] = X(null), [J, be] = X(null), [Se, Ce] = X(null), Y = _e ?? ye ?? he, Oe = Y === null ? void 0 : R[Y], Ne = Se ?? J, [Pe, Fe] = X([]), Ie = (e) => Pe.includes(F[e]), Le = r.map((e, t) => se(R.map((e) => e.values[t]).filter((e) => e !== null), a)), Re = k?.headline ?? c ?? Le[U] ?? null, Be = Ie(U) ? null : Oe ? Oe.values[U] : Re, Ve = Oe ? r.map((e, t) => ({
|
|
4462
4462
|
item: e,
|
|
4463
4463
|
index: t
|
|
4464
|
-
})).filter(({ index: e }) => e !==
|
|
4464
|
+
})).filter(({ index: e }) => e !== U && !Ie(e)).map(({ index: e }) => `${H(e)} ${Oe.values[e] === null ? "no data" : D.value(Oe.values[e])}`) : [], He = (e, t, n) => {
|
|
4465
4465
|
if (!B) return null;
|
|
4466
|
-
let r = n.getBoundingClientRect(), i = e - r.left -
|
|
4467
|
-
if (Math.hypot(i, a) >
|
|
4466
|
+
let r = n.getBoundingClientRect(), i = e - r.left - pe, a = t - r.top - K;
|
|
4467
|
+
if (Math.hypot(i, a) > ue + le) return null;
|
|
4468
4468
|
let o = (Math.atan2(i, -a) + Math.PI * 2) % (Math.PI * 2);
|
|
4469
4469
|
return Math.round(o / (Math.PI * 2) * B) % B;
|
|
4470
4470
|
}, We = (e) => {
|
|
4471
4471
|
e.pointerType !== "touch" && ge(He(e.clientX, e.clientY, e.currentTarget));
|
|
4472
|
-
}, Ge =
|
|
4472
|
+
}, Ge = Mt({
|
|
4473
4473
|
resolve: He,
|
|
4474
4474
|
onGlide: ge,
|
|
4475
4475
|
onLift: (e) => e !== null && ve(e),
|
|
@@ -4493,9 +4493,9 @@ function Er({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4493
4493
|
} else return;
|
|
4494
4494
|
e.preventDefault(), q(n);
|
|
4495
4495
|
}, Je = (e) => o === "circle" ? null : R.map((t, n) => {
|
|
4496
|
-
let { x: r, y: i } =
|
|
4497
|
-
return `${n ? "L" : "M"}${(
|
|
4498
|
-
}).join(" ") + " Z", Ye = !S && !L.error && R.length === 0, Xe = R.some((e) => e.values.some((e) => e === null)), Ze = Array.from({ length:
|
|
4496
|
+
let { x: r, y: i } = Tr(n, B, e, ue);
|
|
4497
|
+
return `${n ? "L" : "M"}${(pe + r).toFixed(2)},${(K + i).toFixed(2)}`;
|
|
4498
|
+
}).join(" ") + " Z", Ye = !S && !L.error && R.length === 0, Xe = R.some((e) => e.values.some((e) => e === null)), Ze = Array.from({ length: _r }, (e, t) => (t + 1) / _r);
|
|
4499
4499
|
return /* @__PURE__ */ $(je, {
|
|
4500
4500
|
motion: ne,
|
|
4501
4501
|
className: ["lilt-radar-card", w].filter(Boolean).join(" "),
|
|
@@ -4553,20 +4553,20 @@ function Er({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4553
4553
|
children: [/* @__PURE__ */ $("g", {
|
|
4554
4554
|
className: "lilt-radar-card__grid",
|
|
4555
4555
|
children: [Ze.map((e) => o === "circle" || S ? /* @__PURE__ */ Q("circle", {
|
|
4556
|
-
cx:
|
|
4557
|
-
cy:
|
|
4558
|
-
r:
|
|
4556
|
+
cx: pe,
|
|
4557
|
+
cy: K,
|
|
4558
|
+
r: ue * e
|
|
4559
4559
|
}, e) : /* @__PURE__ */ Q("path", { d: Je(e) }, e)), S ? null : R.map((e, t) => {
|
|
4560
|
-
let n =
|
|
4560
|
+
let n = Tr(t, B, 1, ue);
|
|
4561
4561
|
return /* @__PURE__ */ Q("line", {
|
|
4562
4562
|
"data-active": t === Y || void 0,
|
|
4563
|
-
x1:
|
|
4564
|
-
y1:
|
|
4565
|
-
x2:
|
|
4566
|
-
y2:
|
|
4563
|
+
x1: pe,
|
|
4564
|
+
y1: K,
|
|
4565
|
+
x2: pe + n.x,
|
|
4566
|
+
y2: K + n.y
|
|
4567
4567
|
}, e.name);
|
|
4568
4568
|
})]
|
|
4569
|
-
}), S ? /* @__PURE__ */ Q(
|
|
4569
|
+
}), S ? /* @__PURE__ */ Q(Vt, {
|
|
4570
4570
|
width: P,
|
|
4571
4571
|
height: s,
|
|
4572
4572
|
reduced: E,
|
|
@@ -4574,39 +4574,39 @@ function Er({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4574
4574
|
children: /* @__PURE__ */ Q("path", {
|
|
4575
4575
|
className: "lilt-radar-card__skeleton",
|
|
4576
4576
|
"data-skeleton": "bloom",
|
|
4577
|
-
style: { transformOrigin: `${
|
|
4578
|
-
d:
|
|
4579
|
-
let { x: n, y: r } =
|
|
4580
|
-
return `${t ? "L" : "M"}${(
|
|
4577
|
+
style: { transformOrigin: `${pe}px ${K}px` },
|
|
4578
|
+
d: br.map((e, t) => {
|
|
4579
|
+
let { x: n, y: r } = Tr(t, br.length, e, ue);
|
|
4580
|
+
return `${t ? "L" : "M"}${(pe + n).toFixed(2)},${(K + r).toFixed(2)}`;
|
|
4581
4581
|
}).join(" ") + " Z"
|
|
4582
4582
|
})
|
|
4583
4583
|
}) : /* @__PURE__ */ $(Z, { children: [
|
|
4584
4584
|
/* @__PURE__ */ Q("g", {
|
|
4585
4585
|
className: "lilt-chart__axis",
|
|
4586
4586
|
children: Ze.map((e) => {
|
|
4587
|
-
if (
|
|
4588
|
-
let { x: t, y: n } =
|
|
4587
|
+
if (ue < 110 && e !== .5) return null;
|
|
4588
|
+
let { x: t, y: n } = Tr(.5, B, e, ue);
|
|
4589
4589
|
return /* @__PURE__ */ Q("text", {
|
|
4590
4590
|
className: "lilt-radar-card__ring-label",
|
|
4591
|
-
x:
|
|
4592
|
-
y:
|
|
4591
|
+
x: pe + t,
|
|
4592
|
+
y: K + n,
|
|
4593
4593
|
dx: 3,
|
|
4594
4594
|
dy: "0.35em",
|
|
4595
|
-
children: D.axis(z[0] +
|
|
4595
|
+
children: D.axis(z[0] + ie * e)
|
|
4596
4596
|
}, e);
|
|
4597
4597
|
})
|
|
4598
4598
|
}),
|
|
4599
4599
|
/* @__PURE__ */ Q("g", {
|
|
4600
|
-
transform: `translate(${
|
|
4600
|
+
transform: `translate(${pe} ${K}) scale(${me})`,
|
|
4601
4601
|
children: r.map((e, t) => {
|
|
4602
|
-
let { path: n, complete: r } =
|
|
4602
|
+
let { path: n, complete: r } = Er(R.map((e) => oe(e.values[t])), ue), i = Ne !== null && Ne !== e.key;
|
|
4603
4603
|
return /* @__PURE__ */ $("g", {
|
|
4604
4604
|
className: "lilt-radar-card__profile",
|
|
4605
4605
|
"data-series": e.key,
|
|
4606
4606
|
"data-dashed": e.dashed || void 0,
|
|
4607
4607
|
"data-muted": i || void 0,
|
|
4608
4608
|
"data-hidden": Ie(t) || void 0,
|
|
4609
|
-
style: { color:
|
|
4609
|
+
style: { color: V(t) },
|
|
4610
4610
|
children: [
|
|
4611
4611
|
r && !e.dashed ? /* @__PURE__ */ Q("path", {
|
|
4612
4612
|
className: "lilt-radar-card__fill",
|
|
@@ -4617,9 +4617,9 @@ function Er({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4617
4617
|
d: n
|
|
4618
4618
|
}),
|
|
4619
4619
|
R.map((e, n) => {
|
|
4620
|
-
let r =
|
|
4620
|
+
let r = oe(e.values[t]);
|
|
4621
4621
|
if (r === null) return null;
|
|
4622
|
-
let { x: i, y: a } =
|
|
4622
|
+
let { x: i, y: a } = Tr(n, B, r, ue);
|
|
4623
4623
|
return /* @__PURE__ */ Q("circle", {
|
|
4624
4624
|
className: "lilt-radar-card__vertex",
|
|
4625
4625
|
"data-active": n === Y || void 0,
|
|
@@ -4633,17 +4633,17 @@ function Er({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4633
4633
|
})
|
|
4634
4634
|
}),
|
|
4635
4635
|
R.map((e, t) => {
|
|
4636
|
-
let { x: n, y: r } =
|
|
4636
|
+
let { x: n, y: r } = Tr(t, B, 1, ue + 14), i = Math.abs(n) < 1 ? "middle" : n > 0 ? "start" : "end", a = e.values.some((e) => e === null), o = yr(W(e), le - 14), s = r < -1 ? -.2 - (o.length - 1) * 1.2 : r > 1 ? .9 : .35 - (o.length - 1) * 1.2 / 2;
|
|
4637
4637
|
return /* @__PURE__ */ Q("text", {
|
|
4638
4638
|
className: "lilt-radar-card__label",
|
|
4639
4639
|
"data-active": t === Y || void 0,
|
|
4640
4640
|
"data-missing": a || void 0,
|
|
4641
|
-
x:
|
|
4642
|
-
y:
|
|
4641
|
+
x: pe + n,
|
|
4642
|
+
y: K + r,
|
|
4643
4643
|
textAnchor: i,
|
|
4644
|
-
style:
|
|
4644
|
+
style: fe < 1 ? { fontSize: `${(12 * fe).toFixed(1)}px` } : void 0,
|
|
4645
4645
|
children: o.map((e, t) => /* @__PURE__ */ Q("tspan", {
|
|
4646
|
-
x:
|
|
4646
|
+
x: pe + n,
|
|
4647
4647
|
dy: `${t === 0 ? s.toFixed(2) : "1.2"}em`,
|
|
4648
4648
|
children: e
|
|
4649
4649
|
}, t))
|
|
@@ -4653,20 +4653,20 @@ function Er({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4653
4653
|
}), /* @__PURE__ */ Q("p", {
|
|
4654
4654
|
className: "lilt-chart__sr-only",
|
|
4655
4655
|
"aria-live": "polite",
|
|
4656
|
-
children: Oe ? `${Oe.name}: ${r.map((e, t) => `${
|
|
4656
|
+
children: Oe ? `${Oe.name}: ${r.map((e, t) => `${H(t)} ${Oe.values[t] === null ? "no data" : D.value(Oe.values[t])}`).join(", ")}` : ""
|
|
4657
4657
|
})]
|
|
4658
4658
|
}),
|
|
4659
|
-
/* @__PURE__ */ Q(
|
|
4659
|
+
/* @__PURE__ */ Q(ce, {
|
|
4660
4660
|
className: "lilt-card__tiles",
|
|
4661
|
-
variant:
|
|
4661
|
+
variant: ae(h),
|
|
4662
4662
|
swatch: g,
|
|
4663
4663
|
"aria-label": `${e} by series`,
|
|
4664
4664
|
items: r.map((e, t) => {
|
|
4665
4665
|
let n = Oe ? Oe.values[t] : Le[t];
|
|
4666
4666
|
return {
|
|
4667
4667
|
id: e.key,
|
|
4668
|
-
label:
|
|
4669
|
-
color:
|
|
4668
|
+
label: H(t),
|
|
4669
|
+
color: V(t),
|
|
4670
4670
|
value: n,
|
|
4671
4671
|
formattedValue: n === null ? "No data" : D.value(n)
|
|
4672
4672
|
};
|
|
@@ -4692,7 +4692,7 @@ function Er({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4692
4692
|
children: "Dimension"
|
|
4693
4693
|
}), r.map((e, t) => /* @__PURE__ */ Q("th", {
|
|
4694
4694
|
scope: "col",
|
|
4695
|
-
children:
|
|
4695
|
+
children: H(t)
|
|
4696
4696
|
}, e.key))] }) }),
|
|
4697
4697
|
/* @__PURE__ */ Q("tbody", { children: R.map((e) => /* @__PURE__ */ $("tr", { children: [/* @__PURE__ */ Q("th", {
|
|
4698
4698
|
scope: "row",
|
|
@@ -4705,12 +4705,12 @@ function Er({ title: e, data: t, category: n, series: r, domain: i, aggregate: a
|
|
|
4705
4705
|
}
|
|
4706
4706
|
//#endregion
|
|
4707
4707
|
//#region src/cards/range-chart-card.tsx
|
|
4708
|
-
function
|
|
4708
|
+
function Or({ low: e, high: t, value: n, label: r, color: i, display: a = "bar", depth: o = !1, aggregate: s = "mean", tiles: c = !1, ...l }) {
|
|
4709
4709
|
let u = n ?? t, d = (e) => (t) => {
|
|
4710
4710
|
let n = t[e];
|
|
4711
4711
|
return typeof n == "number" ? n : null;
|
|
4712
4712
|
};
|
|
4713
|
-
return /* @__PURE__ */ Q(
|
|
4713
|
+
return /* @__PURE__ */ Q(V, {
|
|
4714
4714
|
...l,
|
|
4715
4715
|
aggregate: s,
|
|
4716
4716
|
tiles: c,
|
|
@@ -4737,12 +4737,12 @@ function Dr({ low: e, high: t, value: n, label: r, color: i, display: a = "bar",
|
|
|
4737
4737
|
accessor: d(t)
|
|
4738
4738
|
}
|
|
4739
4739
|
} }),
|
|
4740
|
-
draw: (e) => e.map((e) => a === "error" ? /* @__PURE__ */ Q(
|
|
4740
|
+
draw: (e) => e.map((e) => a === "error" ? /* @__PURE__ */ Q(_t, {
|
|
4741
4741
|
series: e,
|
|
4742
4742
|
low: "low",
|
|
4743
4743
|
high: "high",
|
|
4744
4744
|
point: n !== void 0
|
|
4745
|
-
}, e) : /* @__PURE__ */ Q(
|
|
4745
|
+
}, e) : /* @__PURE__ */ Q(ht, {
|
|
4746
4746
|
series: e,
|
|
4747
4747
|
low: "low",
|
|
4748
4748
|
high: "high",
|
|
@@ -4753,9 +4753,9 @@ function Dr({ low: e, high: t, value: n, label: r, color: i, display: a = "bar",
|
|
|
4753
4753
|
}
|
|
4754
4754
|
//#endregion
|
|
4755
4755
|
//#region src/cards/box-plot-card.tsx
|
|
4756
|
-
function
|
|
4756
|
+
function kr({ data: e = [], x: t, samples: n, label: r = "Median", color: i, outliers: a = !0, depth: o = !1, headline: s, ...c }) {
|
|
4757
4757
|
let l = Ue(() => e.map((e) => {
|
|
4758
|
-
let r = e, i =
|
|
4758
|
+
let r = e, i = Ct(r[n]);
|
|
4759
4759
|
return {
|
|
4760
4760
|
x: r[t],
|
|
4761
4761
|
median: i?.median ?? null,
|
|
@@ -4766,11 +4766,11 @@ function Or({ data: e = [], x: t, samples: n, label: r = "Median", color: i, out
|
|
|
4766
4766
|
e,
|
|
4767
4767
|
n,
|
|
4768
4768
|
t
|
|
4769
|
-
]), u = Ue(() =>
|
|
4769
|
+
]), u = Ue(() => Ct(e.flatMap((e) => e[n]))?.median, [e, n]), d = Ue(() => {
|
|
4770
4770
|
let e = a ? l.flatMap((e) => e.box?.outliers ?? []) : [];
|
|
4771
|
-
return e.length ?
|
|
4771
|
+
return e.length ? Xe(e) : [];
|
|
4772
4772
|
}, [l, a]), f = (e) => (t) => t.box?.[e] ?? null;
|
|
4773
|
-
return /* @__PURE__ */ Q(
|
|
4773
|
+
return /* @__PURE__ */ Q(V, {
|
|
4774
4774
|
...c,
|
|
4775
4775
|
data: l,
|
|
4776
4776
|
x: "x",
|
|
@@ -4809,7 +4809,7 @@ function Or({ data: e = [], x: t, samples: n, label: r = "Median", color: i, out
|
|
|
4809
4809
|
accessor: f("min")
|
|
4810
4810
|
}
|
|
4811
4811
|
} }),
|
|
4812
|
-
draw: (e) => e.map((e) => /* @__PURE__ */ Q(
|
|
4812
|
+
draw: (e) => e.map((e) => /* @__PURE__ */ Q(St, {
|
|
4813
4813
|
series: e,
|
|
4814
4814
|
min: "min",
|
|
4815
4815
|
q1: "q1",
|
|
@@ -4823,12 +4823,12 @@ function Or({ data: e = [], x: t, samples: n, label: r = "Median", color: i, out
|
|
|
4823
4823
|
}
|
|
4824
4824
|
//#endregion
|
|
4825
4825
|
//#region src/engine/slope.ts
|
|
4826
|
-
var
|
|
4826
|
+
var Ar = (e) => {
|
|
4827
4827
|
if (e == null) return null;
|
|
4828
4828
|
if (typeof e != "number" || !Number.isFinite(e)) throw Error("Invalid value: expected a finite number or null.");
|
|
4829
4829
|
return e;
|
|
4830
4830
|
};
|
|
4831
|
-
function
|
|
4831
|
+
function jr(e, t) {
|
|
4832
4832
|
if (e === null || t === null) return {
|
|
4833
4833
|
change: null,
|
|
4834
4834
|
ratio: null
|
|
@@ -4839,14 +4839,14 @@ function Ar(e, t) {
|
|
|
4839
4839
|
ratio: e > 0 ? n / e : null
|
|
4840
4840
|
};
|
|
4841
4841
|
}
|
|
4842
|
-
function
|
|
4842
|
+
function Mr(e, t, n, r, i = "change") {
|
|
4843
4843
|
let a = (e, t) => e[t], o = Fe(e, {
|
|
4844
4844
|
id: (e) => String(a(e, t) ?? ""),
|
|
4845
4845
|
label: (e) => String(a(e, t) ?? "")
|
|
4846
4846
|
}, () => 0).map(({ id: e, label: t, datum: i }) => {
|
|
4847
4847
|
let o, s;
|
|
4848
4848
|
try {
|
|
4849
|
-
o =
|
|
4849
|
+
o = Ar(a(i, n)), s = Ar(a(i, r));
|
|
4850
4850
|
} catch {
|
|
4851
4851
|
throw Error(`Invalid value for category "${e}": expected a finite number or null.`);
|
|
4852
4852
|
}
|
|
@@ -4855,7 +4855,7 @@ function jr(e, t, n, r, i = "change") {
|
|
|
4855
4855
|
label: t,
|
|
4856
4856
|
from: o,
|
|
4857
4857
|
to: s,
|
|
4858
|
-
...
|
|
4858
|
+
...jr(o, s)
|
|
4859
4859
|
};
|
|
4860
4860
|
});
|
|
4861
4861
|
if (i === "input") return o;
|
|
@@ -4865,22 +4865,22 @@ function jr(e, t, n, r, i = "change") {
|
|
|
4865
4865
|
return n === null || r === null ? n === r ? 0 : n === null ? 1 : -1 : r - n;
|
|
4866
4866
|
});
|
|
4867
4867
|
}
|
|
4868
|
-
function
|
|
4868
|
+
function Nr(e, t = "sum") {
|
|
4869
4869
|
let n = 0, r = 0, i = 0, a = 0, o = 0;
|
|
4870
4870
|
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);
|
|
4871
4871
|
let s = t === "mean";
|
|
4872
4872
|
return {
|
|
4873
4873
|
to: r ? s ? n / r : n : null,
|
|
4874
|
-
...o ?
|
|
4874
|
+
...o ? jr(s ? i / o : i, s ? a / o : a) : {
|
|
4875
4875
|
change: null,
|
|
4876
4876
|
ratio: null
|
|
4877
4877
|
}
|
|
4878
4878
|
};
|
|
4879
4879
|
}
|
|
4880
|
-
function
|
|
4880
|
+
function Pr(e) {
|
|
4881
4881
|
let t = e.flatMap((e) => [e.from, e.to].filter((e) => e !== null));
|
|
4882
4882
|
if (!t.length) return [0, 1];
|
|
4883
|
-
let n
|
|
4883
|
+
let [n, r] = Xe(t);
|
|
4884
4884
|
if (n === r) {
|
|
4885
4885
|
let e = Math.max(Math.abs(n) * .1, 1);
|
|
4886
4886
|
return [n - e, r + e];
|
|
@@ -4888,7 +4888,7 @@ function Nr(e) {
|
|
|
4888
4888
|
let i = (r - n) * .06;
|
|
4889
4889
|
return [n - i, r + i];
|
|
4890
4890
|
}
|
|
4891
|
-
function
|
|
4891
|
+
function Fr(e, t, n, r) {
|
|
4892
4892
|
let i = e.map((e, t) => ({
|
|
4893
4893
|
target: e,
|
|
4894
4894
|
index: t
|
|
@@ -4915,20 +4915,20 @@ function Pr(e, t, n, r) {
|
|
|
4915
4915
|
}
|
|
4916
4916
|
//#endregion
|
|
4917
4917
|
//#region src/cards/slope-chart-card.tsx
|
|
4918
|
-
var
|
|
4919
|
-
function
|
|
4918
|
+
var Ir = [], Lr = 6.6, Rr = 17;
|
|
4919
|
+
function zr(e, t) {
|
|
4920
4920
|
return e === null || e === 0 || t === "neutral" ? "neutral" : e > 0 == (t !== "inverse") ? "positive" : "negative";
|
|
4921
4921
|
}
|
|
4922
|
-
var
|
|
4923
|
-
function
|
|
4924
|
-
let O = xe(E), k =
|
|
4922
|
+
var Br = (e) => e === null ? "" : `${e >= 0 ? "+" : "−"}${Math.abs(e * 100).toFixed(1)}%`;
|
|
4923
|
+
function Vr({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r, toLabel: o = i, variant: s = "slope", depth: c = !1, sort: l = "change", aggregate: u = "sum", headline: d, delta: f, deltaTone: p = "default", range: m, ranges: h, defaultRange: g, color: _, height: v = 260, valueFormat: y, locale: ee, formatValue: te, surface: x = "elevated", badge: S, numberStyle: C, palette: ne, loading: w = !1, loadingStyle: T = "shimmer", motion: E = "auto", className: D, style: re }) {
|
|
4924
|
+
let O = xe(E), k = de({
|
|
4925
4925
|
valueFormat: y,
|
|
4926
4926
|
locale: ee,
|
|
4927
4927
|
formatValue: te
|
|
4928
|
-
}), [A, j] = X(g ?? h?.[0]?.id), M = h?.find((e) => e.id === A) ?? h?.[0], N = M?.data ?? t ??
|
|
4928
|
+
}), [A, j] = X(g ?? h?.[0]?.id), M = h?.find((e) => e.id === A) ?? h?.[0], N = M?.data ?? t ?? Ir, P = Ue(() => {
|
|
4929
4929
|
try {
|
|
4930
4930
|
return {
|
|
4931
|
-
rows:
|
|
4931
|
+
rows: Mr(N, n, r, i, l),
|
|
4932
4932
|
error: null
|
|
4933
4933
|
};
|
|
4934
4934
|
} catch (e) {
|
|
@@ -4943,45 +4943,45 @@ function Br({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
4943
4943
|
r,
|
|
4944
4944
|
i,
|
|
4945
4945
|
l
|
|
4946
|
-
]), F = P.rows, I = Ue(() =>
|
|
4947
|
-
resolve:
|
|
4946
|
+
]), F = P.rows, I = Ue(() => Nr(F, u), [F, u]), L = Ue(() => Pr(F), [F]), [R, z] = X(null), [B, ie] = X(null), [ae, oe] = X(null), V = ae ?? B ?? R, H = F.find((e) => e.id === V) ?? null, se = We(/* @__PURE__ */ new Map()), U = Mt({
|
|
4947
|
+
resolve: jt,
|
|
4948
4948
|
onGlide: z,
|
|
4949
|
-
onLift: (e) => e !== null &&
|
|
4949
|
+
onLift: (e) => e !== null && oe(e),
|
|
4950
4950
|
disabled: w
|
|
4951
|
-
}),
|
|
4951
|
+
}), ce = M?.headline ?? d ?? I.to, W = M ? M.delta ?? I.ratio : f ?? I.ratio, le = (e) => e === null ? "No data" : k.value(e), ue = (e) => `${e.label}: ${a} ${le(e.from)}, ${o} ${le(e.to)}${e.ratio === null ? "" : `, ${Br(e.ratio)}`}`, fe = (e, t) => {
|
|
4952
4952
|
let n = t;
|
|
4953
4953
|
if (e.key === "ArrowDown" || e.key === "ArrowRight") n = Math.min(F.length - 1, t + 1);
|
|
4954
4954
|
else if (e.key === "ArrowUp" || e.key === "ArrowLeft") n = Math.max(0, t - 1);
|
|
4955
4955
|
else if (e.key === "Home") n = 0;
|
|
4956
4956
|
else if (e.key === "End") n = F.length - 1;
|
|
4957
4957
|
else if (e.key === "Escape") {
|
|
4958
|
-
|
|
4958
|
+
oe(null);
|
|
4959
4959
|
return;
|
|
4960
4960
|
} else if (e.key === "Enter" || e.key === " ") {
|
|
4961
4961
|
e.preventDefault();
|
|
4962
4962
|
let n = F[t].id;
|
|
4963
|
-
|
|
4963
|
+
oe((e) => e === n ? null : n);
|
|
4964
4964
|
return;
|
|
4965
4965
|
} else return;
|
|
4966
|
-
e.preventDefault(),
|
|
4967
|
-
},
|
|
4966
|
+
e.preventDefault(), se.current.get(F[n].id)?.focus();
|
|
4967
|
+
}, pe = (e, t) => ({
|
|
4968
4968
|
ref: (t) => {
|
|
4969
|
-
t ?
|
|
4969
|
+
t ? se.current.set(e.id, t) : se.current.delete(e.id);
|
|
4970
4970
|
},
|
|
4971
4971
|
tabIndex: e.id === (B ?? F[0]?.id) ? 0 : -1,
|
|
4972
|
-
"aria-label":
|
|
4973
|
-
"aria-pressed":
|
|
4974
|
-
"data-active": e.id ===
|
|
4975
|
-
"data-muted":
|
|
4976
|
-
"data-tone": _ ? void 0 :
|
|
4972
|
+
"aria-label": ue(e),
|
|
4973
|
+
"aria-pressed": ae === e.id,
|
|
4974
|
+
"data-active": e.id === H?.id || void 0,
|
|
4975
|
+
"data-muted": H !== null && e.id !== H.id || void 0,
|
|
4976
|
+
"data-tone": _ ? void 0 : zr(e.change, p),
|
|
4977
4977
|
"data-glide-id": e.id,
|
|
4978
4978
|
onPointerEnter: () => z(e.id),
|
|
4979
4979
|
onPointerLeave: () => z(null),
|
|
4980
|
-
onFocus: () =>
|
|
4981
|
-
onBlur: () =>
|
|
4982
|
-
onClick: () =>
|
|
4983
|
-
onKeyDown: (e) =>
|
|
4984
|
-
}),
|
|
4980
|
+
onFocus: () => ie(e.id),
|
|
4981
|
+
onBlur: () => ie(null),
|
|
4982
|
+
onClick: () => oe((t) => t === e.id ? null : e.id),
|
|
4983
|
+
onKeyDown: (e) => fe(e, t)
|
|
4984
|
+
}), K = {
|
|
4985
4985
|
duration: O ? 0 : .55,
|
|
4986
4986
|
ease: Ce
|
|
4987
4987
|
}, me = _ ? {
|
|
@@ -5009,15 +5009,15 @@ function Br({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5009
5009
|
onValueChange: j
|
|
5010
5010
|
}) : null,
|
|
5011
5011
|
children: [/* @__PURE__ */ Q(De, { children: e }), /* @__PURE__ */ Q(Ee, {
|
|
5012
|
-
value:
|
|
5012
|
+
value: H ? H.to : ce,
|
|
5013
5013
|
format: k.value,
|
|
5014
5014
|
loading: w,
|
|
5015
5015
|
motion: E,
|
|
5016
|
-
children: w ? null :
|
|
5017
|
-
value:
|
|
5016
|
+
children: w ? null : H ? /* @__PURE__ */ $(Z, { children: [H.ratio === null ? null : /* @__PURE__ */ Q(Te, {
|
|
5017
|
+
value: H.ratio,
|
|
5018
5018
|
tone: p
|
|
5019
|
-
}), /* @__PURE__ */ Q(we, { children:
|
|
5020
|
-
value:
|
|
5019
|
+
}), /* @__PURE__ */ Q(we, { children: H.label })] }) : /* @__PURE__ */ $(Z, { children: [W == null ? null : /* @__PURE__ */ Q(Te, {
|
|
5020
|
+
value: W,
|
|
5021
5021
|
tone: p
|
|
5022
5022
|
}), /* @__PURE__ */ $(we, { children: ["vs ", a] })] })
|
|
5023
5023
|
})]
|
|
@@ -5033,7 +5033,7 @@ function Br({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5033
5033
|
children: o
|
|
5034
5034
|
})]
|
|
5035
5035
|
}) : null,
|
|
5036
|
-
w ? /* @__PURE__ */ Q(
|
|
5036
|
+
w ? /* @__PURE__ */ Q(Hr, {
|
|
5037
5037
|
height: v,
|
|
5038
5038
|
variant: s,
|
|
5039
5039
|
depth: c,
|
|
@@ -5043,17 +5043,17 @@ function Br({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5043
5043
|
kind: P.error ? "error" : "empty",
|
|
5044
5044
|
message: P.error ?? "No rows for this period."
|
|
5045
5045
|
}) : s === "dumbbell" ? /* @__PURE__ */ Q("ol", {
|
|
5046
|
-
ref:
|
|
5046
|
+
ref: U,
|
|
5047
5047
|
className: "lilt-slope__rows",
|
|
5048
5048
|
"data-depth": c || void 0,
|
|
5049
5049
|
"data-lilt-glide": "",
|
|
5050
5050
|
"aria-label": `${e}, ${a} to ${o}`,
|
|
5051
5051
|
children: F.map((e, t) => {
|
|
5052
|
-
let n = (e) => (e - L[0]) / (L[1] - L[0]) * 100, r = e.from === null ? null : n(e.from), i = e.to === null ? null : n(e.to), a = O ? 0 :
|
|
5052
|
+
let n = (e) => (e - L[0]) / (L[1] - L[0]) * 100, r = e.from === null ? null : n(e.from), i = e.to === null ? null : n(e.to), a = O ? 0 : G(t, F.length, 140) / 1e3;
|
|
5053
5053
|
return /* @__PURE__ */ Q("li", { children: /* @__PURE__ */ $("button", {
|
|
5054
5054
|
type: "button",
|
|
5055
5055
|
className: "lilt-slope__row",
|
|
5056
|
-
...
|
|
5056
|
+
...pe(e, t),
|
|
5057
5057
|
children: [
|
|
5058
5058
|
/* @__PURE__ */ Q("span", {
|
|
5059
5059
|
className: "lilt-slope__label",
|
|
@@ -5073,7 +5073,7 @@ function Br({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5073
5073
|
width: `${Math.abs(i - r)}%`
|
|
5074
5074
|
},
|
|
5075
5075
|
transition: {
|
|
5076
|
-
...
|
|
5076
|
+
...K,
|
|
5077
5077
|
delay: a
|
|
5078
5078
|
}
|
|
5079
5079
|
}) : null,
|
|
@@ -5082,7 +5082,7 @@ function Br({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5082
5082
|
"data-end": "from",
|
|
5083
5083
|
initial: !1,
|
|
5084
5084
|
animate: { left: `${r}%` },
|
|
5085
|
-
transition:
|
|
5085
|
+
transition: K
|
|
5086
5086
|
}),
|
|
5087
5087
|
i === null ? null : /* @__PURE__ */ Q(qe.span, {
|
|
5088
5088
|
className: "lilt-slope__dot",
|
|
@@ -5090,7 +5090,7 @@ function Br({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5090
5090
|
initial: O || r === null ? !1 : { left: `${r}%` },
|
|
5091
5091
|
animate: { left: `${i}%` },
|
|
5092
5092
|
transition: {
|
|
5093
|
-
...
|
|
5093
|
+
...K,
|
|
5094
5094
|
delay: a
|
|
5095
5095
|
}
|
|
5096
5096
|
})
|
|
@@ -5105,12 +5105,12 @@ function Br({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5105
5105
|
}),
|
|
5106
5106
|
/* @__PURE__ */ Q("span", {
|
|
5107
5107
|
className: "lilt-slope__change",
|
|
5108
|
-
children:
|
|
5108
|
+
children: Br(e.ratio) || "—"
|
|
5109
5109
|
})
|
|
5110
5110
|
]
|
|
5111
5111
|
}) }, e.id);
|
|
5112
5112
|
})
|
|
5113
|
-
}) : /* @__PURE__ */ Q(
|
|
5113
|
+
}) : /* @__PURE__ */ Q(Ur, {
|
|
5114
5114
|
rows: F,
|
|
5115
5115
|
domain: L,
|
|
5116
5116
|
height: v,
|
|
@@ -5119,15 +5119,15 @@ function Br({ title: e, data: t, category: n, from: r, to: i, fromLabel: a = r,
|
|
|
5119
5119
|
title: e,
|
|
5120
5120
|
format: k.value,
|
|
5121
5121
|
reduced: O,
|
|
5122
|
-
handlers:
|
|
5123
|
-
glideRef:
|
|
5122
|
+
handlers: pe,
|
|
5123
|
+
glideRef: U,
|
|
5124
5124
|
depth: c
|
|
5125
5125
|
})
|
|
5126
5126
|
]
|
|
5127
5127
|
});
|
|
5128
5128
|
}
|
|
5129
|
-
function
|
|
5130
|
-
let { ref: o, width: s } =
|
|
5129
|
+
function Hr({ height: t, variant: n, depth: r, reduced: i, loadingStyle: a }) {
|
|
5130
|
+
let { ref: o, width: s } = Hn(), c = s || 320, l = `lilt-slope-loading-${Ve().replace(/:/g, "")}`, u = [
|
|
5131
5131
|
.18,
|
|
5132
5132
|
.34,
|
|
5133
5133
|
.5,
|
|
@@ -5154,7 +5154,7 @@ function Vr({ height: t, variant: n, depth: r, reduced: i, loadingStyle: a }) {
|
|
|
5154
5154
|
cx: e,
|
|
5155
5155
|
cy: n,
|
|
5156
5156
|
r: i,
|
|
5157
|
-
fill: t ? "white" : r ? `url(#${l})` :
|
|
5157
|
+
fill: t ? "white" : r ? `url(#${l})` : zt
|
|
5158
5158
|
})
|
|
5159
5159
|
});
|
|
5160
5160
|
return /* @__PURE__ */ $("g", { children: [
|
|
@@ -5162,7 +5162,7 @@ function Vr({ height: t, variant: n, depth: r, reduced: i, loadingStyle: a }) {
|
|
|
5162
5162
|
d: `M${n},${a}L${i},${o}`,
|
|
5163
5163
|
fill: "none",
|
|
5164
5164
|
transform: e.transform,
|
|
5165
|
-
stroke: g(
|
|
5165
|
+
stroke: g(zt, e.amount),
|
|
5166
5166
|
strokeWidth: e.strokeWidth,
|
|
5167
5167
|
...u
|
|
5168
5168
|
}, t)) : /* @__PURE__ */ Q("line", {
|
|
@@ -5170,7 +5170,7 @@ function Vr({ height: t, variant: n, depth: r, reduced: i, loadingStyle: a }) {
|
|
|
5170
5170
|
x2: i,
|
|
5171
5171
|
y1: a,
|
|
5172
5172
|
y2: o,
|
|
5173
|
-
stroke: t ? "white" :
|
|
5173
|
+
stroke: t ? "white" : zt,
|
|
5174
5174
|
strokeWidth: 2.5,
|
|
5175
5175
|
...u
|
|
5176
5176
|
}),
|
|
@@ -5189,8 +5189,8 @@ function Vr({ height: t, variant: n, depth: r, reduced: i, loadingStyle: a }) {
|
|
|
5189
5189
|
viewBox: `0 0 ${c} ${t}`,
|
|
5190
5190
|
children: [r ? /* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(S, {
|
|
5191
5191
|
id: l,
|
|
5192
|
-
color:
|
|
5193
|
-
}) }) : null, /* @__PURE__ */ Q(
|
|
5192
|
+
color: zt
|
|
5193
|
+
}) }) : null, /* @__PURE__ */ Q(Vt, {
|
|
5194
5194
|
width: c,
|
|
5195
5195
|
height: t,
|
|
5196
5196
|
reduced: i,
|
|
@@ -5202,10 +5202,10 @@ function Vr({ height: t, variant: n, depth: r, reduced: i, loadingStyle: a }) {
|
|
|
5202
5202
|
})
|
|
5203
5203
|
});
|
|
5204
5204
|
}
|
|
5205
|
-
function
|
|
5206
|
-
let { ref: f, width: p } =
|
|
5205
|
+
function Ur({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o, format: s, reduced: c, handlers: l, glideRef: u, depth: d }) {
|
|
5206
|
+
let { ref: f, width: p } = Hn(), m = `lilt-slope-${Ve().replace(/:/g, "")}`, h = "var(--lilt-slope-ink)", _ = ze((e) => {
|
|
5207
5207
|
f.current = e, u(e);
|
|
5208
|
-
}, [u, f]), v = r - 10, y = (e) => v - (e - n[0]) / (n[1] - n[0]) * (v - 30), ee = (e) => e === null ? "No data" : s(e), te = Math.max(...t.map((e) => e.label.length + 1 + ee(e.from).length)), b = Math.max(...t.map((e) => ee(e.to).length + 1 +
|
|
5208
|
+
}, [u, f]), v = r - 10, y = (e) => v - (e - n[0]) / (n[1] - n[0]) * (v - 30), ee = (e) => e === null ? "No data" : s(e), te = Math.max(...t.map((e) => e.label.length + 1 + ee(e.from).length)), b = Math.max(...t.map((e) => ee(e.to).length + 1 + Br(e.ratio).length)), x = (te + b) * Lr + 48 > p * .72, C = x ? Math.max(...t.map((e) => e.label.length)) : te, ne = x ? Math.max(...t.map((e) => ee(e.to).length)) : b, w = Math.min(p * .46, C * Lr + 24), T = Math.max(w + 40, p - Math.min(p * .36, ne * Lr + 24)), E = t.map((e) => e.from === null ? v : y(e.from)), D = t.map((e) => e.to === null ? v : y(e.to)), re = Fr(E, Rr, 36, v), O = Fr(D, Rr, 36, v), k = {
|
|
5209
5209
|
duration: c ? 0 : .6,
|
|
5210
5210
|
ease: Ce
|
|
5211
5211
|
};
|
|
@@ -5222,7 +5222,7 @@ function Hr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5222
5222
|
"aria-label": `${o}, ${i} to ${a}`,
|
|
5223
5223
|
"data-depth": d || void 0,
|
|
5224
5224
|
children: [
|
|
5225
|
-
d ? /* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(
|
|
5225
|
+
d ? /* @__PURE__ */ Q("defs", { children: /* @__PURE__ */ Q(le, {
|
|
5226
5226
|
id: `${m}-shadow`,
|
|
5227
5227
|
size: 2.5,
|
|
5228
5228
|
region: {
|
|
@@ -5261,7 +5261,7 @@ function Hr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5261
5261
|
children: a
|
|
5262
5262
|
}),
|
|
5263
5263
|
t.map((n, r) => {
|
|
5264
|
-
let i = E[r], a = D[r], o = c ? 0 :
|
|
5264
|
+
let i = E[r], a = D[r], o = c ? 0 : G(r, t.length, 160) / 1e3;
|
|
5265
5265
|
return /* @__PURE__ */ $("g", {
|
|
5266
5266
|
className: "lilt-slope__line",
|
|
5267
5267
|
role: "button",
|
|
@@ -5383,7 +5383,7 @@ function Hr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5383
5383
|
}), x || n.ratio === null ? null : /* @__PURE__ */ Q("tspan", {
|
|
5384
5384
|
className: "lilt-slope__ratio",
|
|
5385
5385
|
dx: 6,
|
|
5386
|
-
children:
|
|
5386
|
+
children: Br(n.ratio)
|
|
5387
5387
|
})]
|
|
5388
5388
|
})
|
|
5389
5389
|
]
|
|
@@ -5395,8 +5395,8 @@ function Hr({ rows: t, domain: n, height: r, fromLabel: i, toLabel: a, title: o,
|
|
|
5395
5395
|
}
|
|
5396
5396
|
//#endregion
|
|
5397
5397
|
//#region src/activity-ring.tsx
|
|
5398
|
-
var
|
|
5399
|
-
function
|
|
5398
|
+
var Wr = .54, Gr = 3.2, Kr = "color-mix(in oklab, var(--lilt-grid), var(--lilt-surface) 20%)";
|
|
5399
|
+
function qr(e, t, n, r, i = 60) {
|
|
5400
5400
|
if (!Number.isFinite(r) || r <= 0) throw Error("Lilt ActivityRing maximum must be positive and finite.");
|
|
5401
5401
|
if (!Number.isInteger(i) || i <= 0 || 1440 % i != 0) throw Error("Lilt ActivityRing bucketMinutes must divide a 24-hour day.");
|
|
5402
5402
|
let a = 1440 / i, o = Array.from({ length: a }, (e, t) => ({
|
|
@@ -5417,11 +5417,11 @@ function Kr(e, t, n, r, i = 60) {
|
|
|
5417
5417
|
}
|
|
5418
5418
|
return o;
|
|
5419
5419
|
}
|
|
5420
|
-
var
|
|
5420
|
+
var Jr = (e) => {
|
|
5421
5421
|
let t = Math.round(e * 60);
|
|
5422
5422
|
return `${String(Math.floor(t / 60)).padStart(2, "0")}:${String(t % 60).padStart(2, "0")}`;
|
|
5423
5423
|
};
|
|
5424
|
-
function
|
|
5424
|
+
function Yr(e, t, n) {
|
|
5425
5425
|
let r = xe(n), [i, a] = X(0), [o, s] = X(!0), c = We(i), l = We(!1);
|
|
5426
5426
|
return He(() => {
|
|
5427
5427
|
if (!e || !t || r) {
|
|
@@ -5432,7 +5432,7 @@ function Jr(e, t, n) {
|
|
|
5432
5432
|
l.current = !0, s(n);
|
|
5433
5433
|
let i = n ? 0 : c.current >= .999 ? .65 : Math.max(.65, c.current);
|
|
5434
5434
|
c.current = i, a(i);
|
|
5435
|
-
let o =
|
|
5435
|
+
let o = Qe(i, 1, {
|
|
5436
5436
|
duration: n ? 1.15 : .36,
|
|
5437
5437
|
ease: Ce,
|
|
5438
5438
|
onUpdate: (e) => {
|
|
@@ -5453,12 +5453,12 @@ function Jr(e, t, n) {
|
|
|
5453
5453
|
reduced: r
|
|
5454
5454
|
};
|
|
5455
5455
|
}
|
|
5456
|
-
function
|
|
5456
|
+
function Xr({ 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", resetKey: f, motion: p = "auto", height: m = 320, depth: h = !1, className: _, "aria-label": v }) {
|
|
5457
5457
|
if (!o.trim()) throw Error("Lilt ActivityRing requires a measurement unit.");
|
|
5458
5458
|
if (!Number.isFinite(m) || m < 180) throw Error("Lilt ActivityRing height must be at least 180px.");
|
|
5459
5459
|
if (!Number.isInteger(a) || a < 1 || a > 24) throw Error("Lilt ActivityRing dotDensity must be an integer from 1 to 24.");
|
|
5460
5460
|
let y = Ue(() => u === "ready" ? {
|
|
5461
|
-
slots:
|
|
5461
|
+
slots: qr(e, t, n, r, i),
|
|
5462
5462
|
maximum: r,
|
|
5463
5463
|
bucketMinutes: i,
|
|
5464
5464
|
unit: o,
|
|
@@ -5482,12 +5482,12 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5482
5482
|
frame: y
|
|
5483
5483
|
});
|
|
5484
5484
|
}, [y, f]);
|
|
5485
|
-
let b = y ?? (ee.key === f ? ee.frame : null), x = b?.slots, S = 1440 / (b?.bucketMinutes ?? i), C = b?.maximum ?? r, ne = b?.unit ?? o, w = b?.formatValue ?? s, { ref: T, width: E } =
|
|
5485
|
+
let b = y ?? (ee.key === f ? ee.frame : null), x = b?.slots, S = 1440 / (b?.bucketMinutes ?? i), C = b?.maximum ?? r, ne = b?.unit ?? o, w = b?.formatValue ?? s, { ref: T, width: E } = Hn(), D = Math.min(m, Math.max(240, E || m)), re = D / 2, O = D / 2, k = D * .33, [A, j] = X(null), [M, N] = X(null), P = A ?? M, F = P === null ? null : x?.[P] ?? null, I = F ? {
|
|
5486
5486
|
hour: F.hour,
|
|
5487
5487
|
row: F.row,
|
|
5488
5488
|
value: F.value,
|
|
5489
5489
|
pinned: M === P
|
|
5490
|
-
} : null, { progress: L, sweeping: R, reduced: z } =
|
|
5490
|
+
} : null, { progress: L, sweeping: R, reduced: z } = Yr(x, u === "ready", p), B = We(null), ie = Mt({
|
|
5491
5491
|
resolve: (e, t, n) => {
|
|
5492
5492
|
if (!x) return null;
|
|
5493
5493
|
let r = n.getBoundingClientRect(), i = e - r.left - r.width / D * re, a = t - r.top - r.height / D * O, o = Math.hypot(i, a) / (r.width / D || 1);
|
|
@@ -5498,9 +5498,9 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5498
5498
|
onGlide: j,
|
|
5499
5499
|
onLift: (e) => e !== null && N(e),
|
|
5500
5500
|
disabled: !x
|
|
5501
|
-
}),
|
|
5502
|
-
B.current = e,
|
|
5503
|
-
}, [
|
|
5501
|
+
}), ae = ze((e) => {
|
|
5502
|
+
B.current = e, ie(e);
|
|
5503
|
+
}, [ie]);
|
|
5504
5504
|
Be(() => {
|
|
5505
5505
|
M !== null && (!x || M >= S) && N(null);
|
|
5506
5506
|
}, [
|
|
@@ -5517,7 +5517,7 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5517
5517
|
]), Be(() => {
|
|
5518
5518
|
j(null), N(null);
|
|
5519
5519
|
}, [f]);
|
|
5520
|
-
let
|
|
5520
|
+
let oe = (e) => {
|
|
5521
5521
|
if (!x) return;
|
|
5522
5522
|
let t = P ?? 0;
|
|
5523
5523
|
[
|
|
@@ -5531,24 +5531,24 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5531
5531
|
" ",
|
|
5532
5532
|
"Escape"
|
|
5533
5533
|
].includes(e.key) && e.preventDefault(), (e.key === "ArrowRight" || e.key === "ArrowDown") && j((t + 1) % S), (e.key === "ArrowLeft" || e.key === "ArrowUp") && j((t + S - 1) % S), e.key === "Home" && j(0), e.key === "End" && j(S - 1), (e.key === "Enter" || e.key === " ") && N(M === t ? null : t), e.key === "Escape" && (N(null), j(null), B.current?.focus());
|
|
5534
|
-
},
|
|
5534
|
+
}, V = (e, t) => {
|
|
5535
5535
|
let n = e / S * Math.PI * 2 - Math.PI / 2;
|
|
5536
5536
|
return {
|
|
5537
5537
|
x: Number((re + Math.cos(n) * t).toFixed(3)),
|
|
5538
5538
|
y: Number((O + Math.sin(n) * t).toFixed(3))
|
|
5539
5539
|
};
|
|
5540
|
-
},
|
|
5540
|
+
}, H = x?.reduce((e, t) => t.value !== null && (!e || t.value > (e.value ?? -1)) ? t : e, null), se = (e) => {
|
|
5541
5541
|
let t = x?.[e], n = t?.value == null ? 0 : Math.round(t.value / C * a), r = R ? Math.max(0, Math.min(1, (L - e / S * .7) / .3)) : 1, i = Math.ceil(n * r);
|
|
5542
5542
|
return Array.from({ length: a }, (t, n) => ({
|
|
5543
5543
|
dot: n,
|
|
5544
|
-
...
|
|
5544
|
+
...V(e, k * (Wr + n / Math.max(1, a - 1) * .5249999999999999)),
|
|
5545
5545
|
filled: n < i,
|
|
5546
5546
|
active: P === e
|
|
5547
5547
|
}));
|
|
5548
|
-
},
|
|
5548
|
+
}, U = K(Gr), ce = Array.from({ length: S }, (e, t) => {
|
|
5549
5549
|
let n = .5 - .5 * Math.cos((t / S * 2 - .25) * Math.PI), r = Math.max(1, Math.round(a * (.25 + .55 * n)));
|
|
5550
|
-
return Array.from({ length: r }, (e, n) =>
|
|
5551
|
-
}).flat(),
|
|
5550
|
+
return Array.from({ length: r }, (e, n) => V(t, k * (Wr + n / Math.max(1, a - 1) * .5249999999999999)));
|
|
5551
|
+
}).flat(), W = I ? `${Jr(I.hour)}: ${I.value === null ? "No data" : `${w(I.value)} ${ne}`}` : "No bucket selected.";
|
|
5552
5552
|
return /* @__PURE__ */ $("div", {
|
|
5553
5553
|
ref: T,
|
|
5554
5554
|
className: ["lilt-activity", _].filter(Boolean).join(" "),
|
|
@@ -5565,7 +5565,7 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5565
5565
|
height: D
|
|
5566
5566
|
},
|
|
5567
5567
|
children: [/* @__PURE__ */ $("svg", {
|
|
5568
|
-
ref:
|
|
5568
|
+
ref: ae,
|
|
5569
5569
|
"data-lilt-glide": "",
|
|
5570
5570
|
width: D,
|
|
5571
5571
|
height: D,
|
|
@@ -5573,7 +5573,7 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5573
5573
|
role: "group",
|
|
5574
5574
|
"aria-label": v,
|
|
5575
5575
|
tabIndex: x ? 0 : -1,
|
|
5576
|
-
onKeyDown:
|
|
5576
|
+
onKeyDown: oe,
|
|
5577
5577
|
onPointerLeave: () => j(null),
|
|
5578
5578
|
children: [
|
|
5579
5579
|
/* @__PURE__ */ Q("circle", {
|
|
@@ -5587,15 +5587,15 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5587
5587
|
h ? /* @__PURE__ */ Q("g", {
|
|
5588
5588
|
"data-lilt-depth": "wall",
|
|
5589
5589
|
pointerEvents: "none",
|
|
5590
|
-
children: Array.from({ length: S }, (e, t) =>
|
|
5590
|
+
children: Array.from({ length: S }, (e, t) => se(t).map(({ dot: e, x: n, y: r, filled: i, active: a }) => /* @__PURE__ */ Q("line", {
|
|
5591
5591
|
x1: n,
|
|
5592
5592
|
y1: r,
|
|
5593
|
-
x2: n +
|
|
5594
|
-
y2: r +
|
|
5593
|
+
x2: n + U.dx,
|
|
5594
|
+
y2: r + U.dy,
|
|
5595
5595
|
strokeWidth: (a ? 3.3 : 2.7) * 2,
|
|
5596
5596
|
strokeLinecap: "round",
|
|
5597
5597
|
style: {
|
|
5598
|
-
stroke: g(i ? "var(--lilt-series-1)" :
|
|
5598
|
+
stroke: g(i ? "var(--lilt-series-1)" : Kr, -38),
|
|
5599
5599
|
opacity: i ? a || R ? 1 : L : 1
|
|
5600
5600
|
}
|
|
5601
5601
|
}, `${t}-${e}`)))
|
|
@@ -5610,23 +5610,23 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5610
5610
|
onClick: () => N(M === t ? null : t),
|
|
5611
5611
|
children: [
|
|
5612
5612
|
/* @__PURE__ */ Q("line", {
|
|
5613
|
-
x1:
|
|
5614
|
-
y1:
|
|
5615
|
-
x2:
|
|
5616
|
-
y2:
|
|
5613
|
+
x1: V(t, k * .45).x,
|
|
5614
|
+
y1: V(t, k * .45).y,
|
|
5615
|
+
x2: V(t, k * 1.12).x,
|
|
5616
|
+
y2: V(t, k * 1.12).y,
|
|
5617
5617
|
stroke: "transparent",
|
|
5618
5618
|
strokeWidth: "12"
|
|
5619
5619
|
}),
|
|
5620
|
-
|
|
5620
|
+
se(t).map(({ dot: e, x: t, y: n, filled: r, active: i }) => /* @__PURE__ */ Q("circle", {
|
|
5621
5621
|
cx: t,
|
|
5622
5622
|
cy: n,
|
|
5623
5623
|
r: i ? 3.3 : 2.7,
|
|
5624
|
-
fill: r ? "var(--lilt-series-1)" : h ?
|
|
5624
|
+
fill: r ? "var(--lilt-series-1)" : h ? Kr : "var(--lilt-grid)",
|
|
5625
5625
|
opacity: r ? i || R ? 1 : L : h ? 1 : .8
|
|
5626
5626
|
}, e)),
|
|
5627
5627
|
r ? /* @__PURE__ */ Q("circle", {
|
|
5628
|
-
cx:
|
|
5629
|
-
cy:
|
|
5628
|
+
cx: V(t, k * 1.12).x,
|
|
5629
|
+
cy: V(t, k * 1.12).y,
|
|
5630
5630
|
r: "4.5",
|
|
5631
5631
|
fill: "none",
|
|
5632
5632
|
stroke: "var(--lilt-focus)",
|
|
@@ -5635,27 +5635,27 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5635
5635
|
]
|
|
5636
5636
|
}, t);
|
|
5637
5637
|
}) }),
|
|
5638
|
-
!x && u === "loading" ? /* @__PURE__ */ Q(
|
|
5638
|
+
!x && u === "loading" ? /* @__PURE__ */ Q(Vt, {
|
|
5639
5639
|
width: D,
|
|
5640
5640
|
height: D,
|
|
5641
5641
|
reduced: z,
|
|
5642
5642
|
loadingStyle: d,
|
|
5643
5643
|
depth: h,
|
|
5644
|
-
mask:
|
|
5644
|
+
mask: ce.map(({ x: e, y: t }, n) => /* @__PURE__ */ Q("circle", {
|
|
5645
5645
|
cx: e,
|
|
5646
5646
|
cy: t,
|
|
5647
5647
|
r: 2.7,
|
|
5648
5648
|
fill: "white"
|
|
5649
5649
|
}, n)),
|
|
5650
|
-
children:
|
|
5650
|
+
children: ce.map((e, t) => /* @__PURE__ */ $("g", {
|
|
5651
5651
|
"data-skeleton": "pop",
|
|
5652
|
-
style: { "--lilt-skeleton-step": t * 14 /
|
|
5652
|
+
style: { "--lilt-skeleton-step": t * 14 / ce.length },
|
|
5653
5653
|
children: [h ? /* @__PURE__ */ Q("line", {
|
|
5654
5654
|
x1: e.x,
|
|
5655
5655
|
y1: e.y,
|
|
5656
|
-
x2: e.x +
|
|
5657
|
-
y2: e.y +
|
|
5658
|
-
stroke: g(
|
|
5656
|
+
x2: e.x + U.dx,
|
|
5657
|
+
y2: e.y + U.dy,
|
|
5658
|
+
stroke: g(zt, -38),
|
|
5659
5659
|
strokeWidth: 5.4,
|
|
5660
5660
|
strokeLinecap: "round"
|
|
5661
5661
|
}) : null, /* @__PURE__ */ Q("circle", {
|
|
@@ -5663,7 +5663,7 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5663
5663
|
cx: e.x,
|
|
5664
5664
|
cy: e.y,
|
|
5665
5665
|
r: 2.7,
|
|
5666
|
-
style: h ? { fill: g(
|
|
5666
|
+
style: h ? { fill: g(zt, 12) } : void 0
|
|
5667
5667
|
})]
|
|
5668
5668
|
}, t))
|
|
5669
5669
|
}) : null,
|
|
@@ -5673,7 +5673,7 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5673
5673
|
2,
|
|
5674
5674
|
3
|
|
5675
5675
|
].map((e) => {
|
|
5676
|
-
let t =
|
|
5676
|
+
let t = V(Math.round(e * S / 4), k * 1.26);
|
|
5677
5677
|
return /* @__PURE__ */ Q("text", {
|
|
5678
5678
|
x: t.x,
|
|
5679
5679
|
y: t.y,
|
|
@@ -5687,14 +5687,14 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5687
5687
|
]
|
|
5688
5688
|
}), /* @__PURE__ */ Q("div", {
|
|
5689
5689
|
className: "lilt-activity__center",
|
|
5690
|
-
children: c ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("strong", { children:
|
|
5690
|
+
children: c ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("strong", { children: H ? w(H.value) : "—" }), /* @__PURE__ */ $("span", { children: [ne, " peak"] })] })
|
|
5691
5691
|
})]
|
|
5692
5692
|
}),
|
|
5693
5693
|
/* @__PURE__ */ Q("p", {
|
|
5694
5694
|
className: "lilt-chart__sr-only",
|
|
5695
5695
|
role: "status",
|
|
5696
5696
|
"aria-atomic": "true",
|
|
5697
|
-
children:
|
|
5697
|
+
children: W
|
|
5698
5698
|
}),
|
|
5699
5699
|
/* @__PURE__ */ $("span", {
|
|
5700
5700
|
className: "lilt-chart__sr-only",
|
|
@@ -5705,27 +5705,27 @@ function Yr({ data: e, hour: t, value: n, maximum: r, bucketMinutes: i = 60, dot
|
|
|
5705
5705
|
}
|
|
5706
5706
|
//#endregion
|
|
5707
5707
|
//#region src/cards/activity-ring-card.tsx
|
|
5708
|
-
var
|
|
5709
|
-
function
|
|
5708
|
+
var Zr = [], Qr = 280;
|
|
5709
|
+
function $r(e) {
|
|
5710
5710
|
let t = Math.round(e * 60) % 1440;
|
|
5711
5711
|
return `${String(Math.floor(t / 60)).padStart(2, "0")}:${String(t % 60).padStart(2, "0")}`;
|
|
5712
5712
|
}
|
|
5713
|
-
function
|
|
5713
|
+
function ei(e, t) {
|
|
5714
5714
|
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;
|
|
5715
5715
|
}
|
|
5716
|
-
function
|
|
5717
|
-
let D =
|
|
5716
|
+
function ti({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit: a, maximum: o, aggregate: s = "sum", height: c = Qr, depth: l = !1, headline: u, delta: d, deltaTone: f, range: p, ranges: m, defaultRange: h, valueFormat: g, locale: _, formatValue: v, color: y, surface: ee = "elevated", badge: te, numberStyle: x, palette: S, loading: C = !1, loadingStyle: ne = "shimmer", motion: w = "auto", className: T, style: E }) {
|
|
5717
|
+
let D = de({
|
|
5718
5718
|
valueFormat: g,
|
|
5719
5719
|
locale: _,
|
|
5720
5720
|
formatValue: v
|
|
5721
|
-
}), [re, O] = X(h ?? m?.[0]?.id), k = m?.find((e) => e.id === re) ?? m?.[0], A = k?.data ?? t ??
|
|
5721
|
+
}), [re, O] = X(h ?? m?.[0]?.id), k = m?.find((e) => e.id === re) ?? m?.[0], A = k?.data ?? t ?? Zr, j = k ? k.delta : d, M = a?.trim() || r, N = ze((e) => e[n], [n]), P = ze((e) => {
|
|
5722
5722
|
let t = e[r];
|
|
5723
5723
|
return typeof t == "number" && Number.isFinite(t) ? t : null;
|
|
5724
5724
|
}, [r]), F = Ue(() => {
|
|
5725
5725
|
let e = A.map(P).filter((e) => e !== null), t = Math.max(0, ...e), n = o ?? Je().domain([0, Math.max(1, t)]).nice(4).domain()[1];
|
|
5726
5726
|
try {
|
|
5727
5727
|
return {
|
|
5728
|
-
slots:
|
|
5728
|
+
slots: qr(A, N, P, n, i),
|
|
5729
5729
|
maximum: n,
|
|
5730
5730
|
error: null
|
|
5731
5731
|
};
|
|
@@ -5733,7 +5733,7 @@ function ei({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
5733
5733
|
return {
|
|
5734
5734
|
slots: [],
|
|
5735
5735
|
maximum: n,
|
|
5736
|
-
error:
|
|
5736
|
+
error: ei(e instanceof Error ? e.message : "Invalid activity.", i)
|
|
5737
5737
|
};
|
|
5738
5738
|
}
|
|
5739
5739
|
}, [
|
|
@@ -5742,7 +5742,7 @@ function ei({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
5742
5742
|
P,
|
|
5743
5743
|
o,
|
|
5744
5744
|
i
|
|
5745
|
-
]), [I, L] = X(null), R = ze((e) => L(e), []), z = F.slots.filter((e) => e.value !== null), B = z.reduce((e, t) => !e || t.value > e.value ? t : e, null),
|
|
5745
|
+
]), [I, L] = X(null), R = ze((e) => L(e), []), z = F.slots.filter((e) => e.value !== null), B = z.reduce((e, t) => !e || t.value > e.value ? t : e, null), ie = z.reduce((e, t) => !e || t.value < e.value ? t : e, null), ae = A.length ? F.slots.length - z.length : 0, oe = k?.headline ?? u ?? se(z.map((e) => e.value), s), V = !C && !F.error && A.length === 0;
|
|
5746
5746
|
return /* @__PURE__ */ $(je, {
|
|
5747
5747
|
motion: w,
|
|
5748
5748
|
className: ["lilt-activity-card", T].filter(Boolean).join(" "),
|
|
@@ -5766,20 +5766,20 @@ function ei({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
5766
5766
|
onValueChange: O
|
|
5767
5767
|
}) : null,
|
|
5768
5768
|
children: [/* @__PURE__ */ Q(De, { children: e }), /* @__PURE__ */ Q(Ee, {
|
|
5769
|
-
value: C ? null : I ? I.value :
|
|
5769
|
+
value: C ? null : I ? I.value : oe,
|
|
5770
5770
|
format: D.value,
|
|
5771
5771
|
loading: C,
|
|
5772
5772
|
motion: w,
|
|
5773
|
-
children: C ? null : I ? /* @__PURE__ */ $(we, { children: [
|
|
5773
|
+
children: C ? null : I ? /* @__PURE__ */ $(we, { children: [$r(I.hour), I.value === null ? " · No data" : ` · ${M}`] }) : j === void 0 ? null : /* @__PURE__ */ Q(Te, {
|
|
5774
5774
|
value: j,
|
|
5775
5775
|
tone: f
|
|
5776
5776
|
})
|
|
5777
5777
|
})]
|
|
5778
|
-
}), F.error ||
|
|
5778
|
+
}), F.error || V ? /* @__PURE__ */ Q(b, {
|
|
5779
5779
|
kind: F.error ? "error" : "empty",
|
|
5780
5780
|
message: F.error ?? "No activity for this period."
|
|
5781
5781
|
}) : /* @__PURE__ */ $(Z, { children: [
|
|
5782
|
-
/* @__PURE__ */ Q(
|
|
5782
|
+
/* @__PURE__ */ Q(Xr, {
|
|
5783
5783
|
loadingStyle: ne,
|
|
5784
5784
|
className: "lilt-activity-card__ring",
|
|
5785
5785
|
depth: l,
|
|
@@ -5797,33 +5797,33 @@ function ei({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
5797
5797
|
motion: w,
|
|
5798
5798
|
resetKey: k?.id,
|
|
5799
5799
|
onSelectionChange: R,
|
|
5800
|
-
center: C ? /* @__PURE__ */ Q(Z, {}) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("strong", { children: B ? D.value(B.value) : "—" }), /* @__PURE__ */ Q("span", { children: B ? `peak · ${
|
|
5800
|
+
center: C ? /* @__PURE__ */ Q(Z, {}) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("strong", { children: B ? D.value(B.value) : "—" }), /* @__PURE__ */ Q("span", { children: B ? `peak · ${$r(B.hour)}` : "no data" })] })
|
|
5801
5801
|
}),
|
|
5802
|
-
/* @__PURE__ */ Q(
|
|
5802
|
+
/* @__PURE__ */ Q(ce, {
|
|
5803
5803
|
className: "lilt-card__tiles",
|
|
5804
5804
|
"aria-label": `${e}: busiest and quietest times`,
|
|
5805
5805
|
items: [{
|
|
5806
5806
|
id: "busiest",
|
|
5807
|
-
label: B && !C ? `Busiest · ${
|
|
5807
|
+
label: B && !C ? `Busiest · ${$r(B.hour)}` : "Busiest",
|
|
5808
5808
|
color: "var(--lilt-series-1)",
|
|
5809
5809
|
value: B?.value ?? null,
|
|
5810
5810
|
formattedValue: B ? D.value(B.value) : "No data"
|
|
5811
5811
|
}, {
|
|
5812
5812
|
id: "quietest",
|
|
5813
|
-
label:
|
|
5813
|
+
label: ie && !C ? `Quietest · ${$r(ie.hour)}` : "Quietest",
|
|
5814
5814
|
color: "color-mix(in srgb, var(--lilt-series-1) 30%, transparent)",
|
|
5815
|
-
value:
|
|
5816
|
-
formattedValue:
|
|
5815
|
+
value: ie?.value ?? null,
|
|
5816
|
+
formattedValue: ie ? D.value(ie.value) : "No data"
|
|
5817
5817
|
}],
|
|
5818
5818
|
renderValue: C ? () => /* @__PURE__ */ Q("span", { className: "lilt-card__skeleton lilt-card__skeleton--tile" }) : void 0
|
|
5819
5819
|
}),
|
|
5820
|
-
!C &&
|
|
5820
|
+
!C && ae ? /* @__PURE__ */ $("p", {
|
|
5821
5821
|
className: "lilt-activity-card__footer",
|
|
5822
5822
|
children: [
|
|
5823
|
-
|
|
5823
|
+
ae === 1 ? "1 time slot has" : `${ae} time slots have`,
|
|
5824
5824
|
" no data and",
|
|
5825
5825
|
" ",
|
|
5826
|
-
|
|
5826
|
+
ae === 1 ? "stays" : "stay",
|
|
5827
5827
|
" empty rather than reading as zero."
|
|
5828
5828
|
]
|
|
5829
5829
|
}) : null
|
|
@@ -5831,4 +5831,4 @@ function ei({ title: e, data: t, hour: n, value: r, bucketMinutes: i = 60, unit:
|
|
|
5831
5831
|
});
|
|
5832
5832
|
}
|
|
5833
5833
|
//#endregion
|
|
5834
|
-
export {
|
|
5834
|
+
export { ti as ActivityRingCard, Se as AnimatedNumber, O as Annotations, l as Area, It as AreaChartCard, E as Bar, Rt as BarChartCard, St as BoxPlot, kr as BoxPlotCard, Y as CardBadge, Oe as CardFrameContext, kt as ChangeComparison, W as Chart, ft as ChartBrush, je as ChartCard, we as ChartCardCaption, Te as ChartCardDelta, Ae as ChartCardHeader, ke as ChartCardRange, De as ChartCardTitle, Ee as ChartCardValue, rt as ChartOverview, f as ChartPlot, Ft as ChartRangeSummary, tt as ChartReadout, et as ChartToolbar, rn as ComboChartCard, $e as ComparisonDetails, _t as ErrorBar, An as FunnelChartCard, ye as Grid, Bn as HeatmapChartCard, nn as HorizontalBarChartCard, v as IntervalBand, Ot as Legend, ve as Line, Lt as LineChartCard, bn as ProgressCard, Dr as RadarChartCard, gn as RadialChartCard, ht as RangeBar, Or as RangeChartCard, A as ReferenceBand, me as ReferenceLine, mr as SankeyChartCard, tr as ScatterChartCard, Vr as SlopeChartCard, Xt as StatCard, te as Tooltip, ce as ValueLegend, ne as XAxis, ge as YAxis, ie as createCartesianChartModel, w as createChartController, Tt as serializeChartSvg, Ct as summarizeBox, Le as summarizeFunnelStages, be as summarizeRange, J as toChartCsv, he as useCartesianChartModel, k as useCartesianModelState, oe as useChartComparison, re as useChartState, ee as useChartSync };
|