@dcs-tech/ui 0.10.0 → 0.11.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 +362 -0
- package/README.md +3 -2
- package/THIRD_PARTY_NOTICES.md +23 -0
- package/dist/ChartImageMenu-sB2QNQzd.js +9673 -0
- package/dist/ChartView-BstZkP1g.js +1942 -0
- package/dist/{SummaryChart-i6fOdrDM.js → SummaryChart-B5ibDNOZ.js} +11 -10
- package/dist/{SummaryImage-CCt5ozD9.js → SummaryImage-CRP7X2Nl.js} +2 -2
- package/dist/SummarySeeAll-CtYRGV4G.js +101 -0
- package/dist/assets/fileTask.worker-D97s2vRV.js +1 -0
- package/dist/{columnValue-74XDBcVF.js → columnValue-BOn9NC8X.js} +86 -79
- package/dist/exportContext-CMzuzRjc.js +274 -0
- package/dist/{exportEngine-BmDly7iw.js → exportEngine-CYDN8Ty-.js} +167 -137
- package/dist/file-worker.js +1 -1
- package/dist/{fileActions-CFNO14Aj.js → fileActions-DkPEWE-t.js} +1 -1
- package/dist/{geometry-DG134nYI.js → geometry-CFS5If1N.js} +769 -466
- package/dist/index.js +21095 -12669
- package/dist/{labels-BPItSeRU.js → labels-mukFhYkc.js} +124 -1
- package/dist/{runFileTask-BIZTFnZP.js → runFileTask-DI_39TjR.js} +17 -0
- package/dist/scrollArea-B52kugL1.js +291 -0
- package/dist/style.css +1 -1
- package/dist/{summaryChartData-BiQYJbYZ.js → summaryChartData-D15kw64n.js} +6 -5
- package/dist/types/components/Charts/BarList.d.ts +4 -3
- package/dist/types/components/Charts/CalendarHeatmap.d.ts +4 -2
- package/dist/types/components/Charts/Chart.d.ts +3 -2
- package/dist/types/components/Charts/ChartView.d.ts +3 -2
- package/dist/types/components/Charts/ColumnChart.d.ts +4 -3
- package/dist/types/components/Charts/Donut.d.ts +3 -2
- package/dist/types/components/Charts/Funnel.d.ts +3 -2
- package/dist/types/components/Charts/Gauge.d.ts +3 -2
- package/dist/types/components/Charts/LineChart.d.ts +4 -3
- package/dist/types/components/Charts/NumberTrend.d.ts +4 -3
- package/dist/types/components/Charts/Progress.d.ts +3 -2
- package/dist/types/components/Charts/StackedBar.d.ts +3 -2
- package/dist/types/components/Charts/Treemap.d.ts +3 -2
- package/dist/types/components/Charts/chartData.d.ts +6 -0
- package/dist/types/components/Charts/chartImage.d.ts +2 -0
- package/dist/types/components/Charts/geometry.d.ts +3 -0
- package/dist/types/components/Charts/index.d.ts +2 -0
- package/dist/types/components/Charts/palette.d.ts +1 -0
- package/dist/types/components/Charts/parts.d.ts +14 -0
- package/dist/types/components/Charts/useChartMotion.d.ts +8 -0
- package/dist/types/components/DataTable/DataTable.d.ts +3 -1
- package/dist/types/components/DataTable/DisplayPopover.d.ts +1 -0
- package/dist/types/components/DataTable/HeaderMenu.d.ts +1 -0
- package/dist/types/components/DataTable/TableColumnModal.d.ts +4 -1
- package/dist/types/components/DataTable/TableToolbar.d.ts +20 -1
- package/dist/types/components/DataTable/TableView.d.ts +18 -2
- package/dist/types/components/DataTable/cards/CardView.d.ts +25 -5
- package/dist/types/components/DataTable/cards/rowParts.d.ts +1 -0
- package/dist/types/components/DataTable/cellSelection/CellRangeBar.d.ts +16 -0
- package/dist/types/components/DataTable/cellSelection/cellRangeStore.d.ts +18 -0
- package/dist/types/components/DataTable/cellSelection/paintRanges.d.ts +2 -0
- package/dist/types/components/DataTable/cellSelection/useCellSelection.d.ts +63 -0
- package/dist/types/components/DataTable/data/listDelta.d.ts +27 -0
- package/dist/types/components/DataTable/data/rowLineage.d.ts +3 -0
- package/dist/types/components/DataTable/data/rowModels.d.ts +9 -0
- package/dist/types/components/DataTable/data/rowTransaction.d.ts +9 -0
- package/dist/types/components/DataTable/data/useServerData.d.ts +3 -1
- package/dist/types/components/DataTable/export/exportCells.d.ts +5 -2
- package/dist/types/components/DataTable/export/exportEngine.d.ts +7 -2
- package/dist/types/components/DataTable/export/useTableExport.d.ts +17 -1
- package/dist/types/components/DataTable/filters/filterRowModel.d.ts +1 -0
- package/dist/types/components/DataTable/grouping/groupModel.d.ts +11 -0
- package/dist/types/components/DataTable/index.d.ts +1 -1
- package/dist/types/components/DataTable/keyboard/ShortcutsDialog.d.ts +4 -1
- package/dist/types/components/DataTable/keyboard/useGridKeyboard.d.ts +8 -0
- package/dist/types/components/DataTable/labels.d.ts +128 -0
- package/dist/types/components/DataTable/layout/LayoutSwitcher.d.ts +10 -2
- package/dist/types/components/DataTable/layout/useFitWidths.d.ts +7 -0
- package/dist/types/components/DataTable/menu/RowMenu.d.ts +1 -0
- package/dist/types/components/DataTable/menu/buildRowMenu.d.ts +6 -3
- package/dist/types/components/DataTable/motion/RowChangeNotice.d.ts +19 -0
- package/dist/types/components/DataTable/motion/rowChanges.d.ts +25 -0
- package/dist/types/components/DataTable/motion/useNoticeInsets.d.ts +2 -0
- package/dist/types/components/DataTable/motion/useRowChangeNotices.d.ts +35 -0
- package/dist/types/components/DataTable/motion/useRowMotion.d.ts +29 -3
- package/dist/types/components/DataTable/persistence/reconcile.d.ts +4 -0
- package/dist/types/components/DataTable/persistence/useColumnPersistence.d.ts +5 -1
- package/dist/types/components/DataTable/pivot/PivotPanel.d.ts +11 -0
- package/dist/types/components/DataTable/pivot/PivotView.d.ts +22 -0
- package/dist/types/components/DataTable/pivot/pivotModel.d.ts +54 -0
- package/dist/types/components/DataTable/pivot/usePivot.d.ts +44 -0
- package/dist/types/components/DataTable/rows/PressRow.d.ts +1 -0
- package/dist/types/components/DataTable/rows/RowLead.d.ts +23 -0
- package/dist/types/components/DataTable/rows/rowPress.d.ts +2 -0
- package/dist/types/components/DataTable/rows/usePinnedRows.d.ts +34 -0
- package/dist/types/components/DataTable/rows/useRowDrag.d.ts +44 -0
- package/dist/types/components/DataTable/split/SplitView.d.ts +4 -2
- package/dist/types/components/DataTable/summary/SummaryChart.d.ts +2 -1
- package/dist/types/components/DataTable/summary/TableSummary.d.ts +2 -1
- package/dist/types/components/DataTable/summary/summaryModel.d.ts +28 -6
- package/dist/types/components/DataTable/summary/useTableSummary.d.ts +3 -0
- package/dist/types/components/DataTable/toolbar/ToolbarMore.d.ts +14 -0
- package/dist/types/components/DataTable/toolbar/useToolbarFit.d.ts +10 -0
- package/dist/types/components/DataTable/tree/TreeChips.d.ts +5 -0
- package/dist/types/components/DataTable/tree/treeExport.d.ts +54 -0
- package/dist/types/components/DataTable/tree/treeMove.d.ts +1 -0
- package/dist/types/components/DataTable/tree/useTreeChildren.d.ts +15 -0
- package/dist/types/components/DataTable/tree/useTreeData.d.ts +60 -0
- package/dist/types/components/DataTable/types.d.ts +272 -4
- package/dist/types/components/DataTable/useDataChangeTracker.d.ts +11 -4
- package/dist/types/components/DataTable/useTable.d.ts +13 -1
- package/dist/types/components/DataTable/virtual/useVirtualLines.d.ts +1 -0
- package/dist/types/components/EventCalendar/EventCalendar.d.ts +46 -0
- package/dist/types/components/EventCalendar/eventParts.d.ts +10 -0
- package/dist/types/components/EventCalendar/index.d.ts +3 -0
- package/dist/types/components/EventCalendar/useCalendarEdit.d.ts +40 -0
- package/dist/types/components/Icon/Icon.d.ts +36 -0
- package/dist/types/components/Icon/Icon.storyData.d.ts +6 -0
- package/dist/types/components/Icon/IconContext.d.ts +7 -0
- package/dist/types/components/Icon/icons.d.ts +223 -0
- package/dist/types/components/Icon/index.d.ts +7 -0
- package/dist/types/components/Icon/useIconDone.d.ts +5 -0
- package/dist/types/components/Popover/Popover.d.ts +1 -0
- package/dist/types/components/Popover/floatingPosition.d.ts +22 -2
- package/dist/types/components/ReorderList/ReorderList.d.ts +2 -1
- package/dist/types/components/Scroll/ui.d.ts +1 -0
- package/dist/types/components/SlidingHighlight/index.d.ts +2 -0
- package/dist/types/components/SlidingHighlight/useSlidingHighlight.d.ts +20 -0
- package/dist/types/components/Suggest/SuggestionList.d.ts +1 -0
- package/dist/types/components/UIProvider/UILabelsContext.d.ts +34 -0
- package/dist/types/components/UIProvider/UIProvider.d.ts +2 -0
- package/dist/types/core/hooks/index.d.ts +1 -1
- package/dist/types/core/hooks/usePresence.d.ts +1 -0
- package/dist/types/core/icons/actions.icons.d.ts +37 -0
- package/dist/types/core/icons/commerce.icons.d.ts +16 -0
- package/dist/types/core/icons/communication.icons.d.ts +10 -0
- package/dist/types/core/icons/delivery.icons.d.ts +13 -0
- package/dist/types/core/icons/devices.icons.d.ts +16 -0
- package/dist/types/core/icons/files.icons.d.ts +13 -0
- package/dist/types/core/icons/general.icons.d.ts +24 -0
- package/dist/types/core/icons/index.d.ts +14 -0
- package/dist/types/core/icons/media.icons.d.ts +11 -0
- package/dist/types/core/icons/navigation.icons.d.ts +25 -0
- package/dist/types/core/icons/people.icons.d.ts +13 -0
- package/dist/types/core/icons/registry.d.ts +2 -0
- package/dist/types/core/icons/state.icons.d.ts +14 -0
- package/dist/types/core/icons/status.icons.d.ts +10 -0
- package/dist/types/core/icons/table.icons.d.ts +22 -0
- package/dist/types/core/icons/text.icons.d.ts +13 -0
- package/dist/types/core/logic/cellRange.logic.d.ts +66 -0
- package/dist/types/core/logic/cellTouch.logic.d.ts +16 -0
- package/dist/types/core/logic/columnGroups.logic.d.ts +31 -0
- package/dist/types/core/logic/dropdownSide.logic.d.ts +19 -0
- package/dist/types/core/logic/eventCalendar.logic.d.ts +225 -0
- package/dist/types/core/logic/fitColumns.logic.d.ts +7 -0
- package/dist/types/core/logic/icon.logic.d.ts +24 -0
- package/dist/types/core/logic/index.d.ts +16 -0
- package/dist/types/core/logic/pivot.logic.d.ts +100 -0
- package/dist/types/core/logic/rowActions.logic.d.ts +7 -0
- package/dist/types/core/logic/rowDrag.logic.d.ts +36 -0
- package/dist/types/core/logic/rowPinning.logic.d.ts +12 -0
- package/dist/types/core/logic/slidingHighlight.logic.d.ts +20 -0
- package/dist/types/core/logic/toolbarOverflow.logic.d.ts +21 -0
- package/dist/types/core/logic/treeData.logic.d.ts +44 -0
- package/dist/types/core/logic/treeDrag.logic.d.ts +63 -0
- package/dist/types/core/logic/tween.logic.d.ts +33 -0
- package/dist/types/core/logic/visualViewport.logic.d.ts +13 -0
- package/dist/types/core/types/eventCalendar.types.d.ts +18 -0
- package/dist/types/core/types/fileEngine.types.d.ts +6 -0
- package/dist/types/core/types/icon.types.d.ts +109 -0
- package/dist/types/core/types/index.d.ts +2 -0
- package/dist/types/index.d.ts +7 -0
- package/package.json +4 -4
- package/dist/ChartImageMenu-3OfqNFyt.js +0 -1510
- package/dist/ChartView-n4G5_2ro.js +0 -1707
- package/dist/SummarySeeAll-BY8knsRe.js +0 -101
- package/dist/assets/fileTask.worker--Q3rI3Bn.js +0 -1
- package/dist/exportContext-C52ZuHd8.js +0 -166
- package/dist/scrollArea-D84Cwm4o.js +0 -310
|
@@ -1,1707 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { A as e, C as t, Cn as n, D as r, E as i, En as a, F as o, G as s, J as c, K as l, L as u, M as d, N as f, O as p, R as m, S as h, T as g, Tn as _, W as v, X as y, Y as b, Z as x, _ as S, b as C, c as w, ct as T, d as E, f as D, ft as O, g as k, h as A, i as j, j as M, k as N, l as P, m as F, o as I, ot as L, p as R, q as z, r as B, s as V, t as H, u as ee, v as U, vt as te, w as ne, y as re, z as ie } from "./geometry-DG134nYI.js";
|
|
3
|
-
import { useCallback as W, useEffect as ae, useLayoutEffect as G, useMemo as oe, useRef as K, useState as q } from "react";
|
|
4
|
-
import { Fragment as se, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
5
|
-
import { createPortal as ce } from "react-dom";
|
|
6
|
-
// src/core/logic/uiScale.logic.ts
|
|
7
|
-
function le(e) {
|
|
8
|
-
let t = parseFloat(e ?? "");
|
|
9
|
-
return Number.isFinite(t) && t > 0 ? t : 1;
|
|
10
|
-
}
|
|
11
|
-
// src/components/Charts/useUiScale.ts
|
|
12
|
-
function X() {
|
|
13
|
-
let [e, t] = q(null), [n, r] = q(1);
|
|
14
|
-
return G(() => {
|
|
15
|
-
e && r(le(getComputedStyle(e).getPropertyValue("--ui-scale")));
|
|
16
|
-
}), G(() => {
|
|
17
|
-
if (!e || typeof ResizeObserver > "u") return;
|
|
18
|
-
let t = new ResizeObserver(() => r(le(getComputedStyle(e).getPropertyValue("--ui-scale"))));
|
|
19
|
-
return t.observe(e), () => t.disconnect();
|
|
20
|
-
}, [e]), [W((e) => t(e), []), n];
|
|
21
|
-
}
|
|
22
|
-
// src/components/Charts/pointer.ts
|
|
23
|
-
function ue(e, t, n) {
|
|
24
|
-
return n <= 0 || t <= 0 ? null : Math.max(0, Math.min(n - 1, Math.floor(e / t * n)));
|
|
25
|
-
}
|
|
26
|
-
function de(e, t) {
|
|
27
|
-
let n = null, r = Infinity;
|
|
28
|
-
return t.forEach((t, i) => {
|
|
29
|
-
let a = e < t.start ? t.start - e : e > t.end ? e - t.end : 0;
|
|
30
|
-
a < r && (n = i, r = a);
|
|
31
|
-
}), n;
|
|
32
|
-
}
|
|
33
|
-
function fe(e, t, n) {
|
|
34
|
-
let r = null, i = Infinity;
|
|
35
|
-
return n.forEach((n, a) => {
|
|
36
|
-
if (!n) return;
|
|
37
|
-
let o = e < n.left ? n.left - e : e > n.left + n.width ? e - n.left - n.width : 0, s = t < n.top ? n.top - t : t > n.top + n.height ? t - n.top - n.height : 0, c = o * o + s * s;
|
|
38
|
-
c < i && (r = a, i = c);
|
|
39
|
-
}), r;
|
|
40
|
-
}
|
|
41
|
-
function pe(e, t) {
|
|
42
|
-
let n = Math.atan2(e, -t);
|
|
43
|
-
return n < 0 ? n + 2 * Math.PI : n;
|
|
44
|
-
}
|
|
45
|
-
var me = -1;
|
|
46
|
-
function he(e, t, n, r, i) {
|
|
47
|
-
let a = Math.hypot(e, t);
|
|
48
|
-
if (a > n || !i.length) return null;
|
|
49
|
-
if (a < r) return -1;
|
|
50
|
-
let o = pe(e, t), s = 2 * Math.PI, c = (e, t) => ((t - e) % s + s) % s, l = 0, u = Infinity;
|
|
51
|
-
return i.forEach((e, t) => {
|
|
52
|
-
if (o >= e.a0 && o <= e.a1) {
|
|
53
|
-
l = t, u = -1;
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (u < 0) return;
|
|
57
|
-
let n = Math.min(c(o, e.a0), c(e.a1, o));
|
|
58
|
-
n < u && (l = t, u = n);
|
|
59
|
-
}), l;
|
|
60
|
-
}
|
|
61
|
-
var ge = {
|
|
62
|
-
x: 12,
|
|
63
|
-
y: 4
|
|
64
|
-
};
|
|
65
|
-
function _e(e, t, n, r = ge, i = 8) {
|
|
66
|
-
let a = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), o = e.x + r.x, s = "right";
|
|
67
|
-
o + t.width > n.width - i && (o = e.x - r.x - t.width, s = "left");
|
|
68
|
-
let c = e.y + r.y, l = "below";
|
|
69
|
-
return c + t.height > n.height - i && (c = e.y - r.y - t.height, l = "above"), {
|
|
70
|
-
left: a(o, i, n.width - t.width - i),
|
|
71
|
-
top: a(c, i, n.height - t.height - i),
|
|
72
|
-
x: s,
|
|
73
|
-
y: l
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
// src/components/Charts/ChartTooltip.tsx
|
|
77
|
-
var Z = null, ve = 8, ye = () => ({
|
|
78
|
-
width: document.documentElement.clientWidth || window.innerWidth,
|
|
79
|
-
height: document.documentElement.clientHeight || window.innerHeight
|
|
80
|
-
});
|
|
81
|
-
function Q(e) {
|
|
82
|
-
let t = K(e);
|
|
83
|
-
t.current = e;
|
|
84
|
-
let [n] = q(() => ({})), r = K(null), i = K(null), o = _(), [s, c] = q(null), l = K(null), u = K(null), [d, f] = q(null), p = !!e.onPick, m = (e) => e >= 0 && e < t.current.count && (t.current.focusable?.(e) ?? !0), h = W((e) => {
|
|
85
|
-
r.current = e;
|
|
86
|
-
}, []), g = W(() => {
|
|
87
|
-
l.current = null, c(null);
|
|
88
|
-
}, []), v = W((e, t) => {
|
|
89
|
-
Z && Z.id !== n && Z.clear(), Z = {
|
|
90
|
-
id: n,
|
|
91
|
-
clear: g
|
|
92
|
-
}, c((n) => n && n.index === e && n.via === t ? n : {
|
|
93
|
-
index: e,
|
|
94
|
-
via: t
|
|
95
|
-
});
|
|
96
|
-
}, [n, g]);
|
|
97
|
-
ae(() => () => {
|
|
98
|
-
Z?.id === n && (Z = null);
|
|
99
|
-
}, [n]);
|
|
100
|
-
let b = W(() => {
|
|
101
|
-
let e = i.current, n = r.current;
|
|
102
|
-
if (!e || !n || !s) return;
|
|
103
|
-
let o = {
|
|
104
|
-
width: e.offsetWidth,
|
|
105
|
-
height: e.offsetHeight
|
|
106
|
-
}, c;
|
|
107
|
-
if (l.current) c = _e(l.current, o, ye());
|
|
108
|
-
else {
|
|
109
|
-
let e = t.current.anchor?.(s.index, n) ?? be(n, s.index) ?? n.getBoundingClientRect();
|
|
110
|
-
c = a({
|
|
111
|
-
anchor: e,
|
|
112
|
-
tooltip: o,
|
|
113
|
-
viewport: ye(),
|
|
114
|
-
placement: "top",
|
|
115
|
-
offset: 8,
|
|
116
|
-
margin: 8
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
let u = e.parentElement?.getBoundingClientRect() ?? {
|
|
120
|
-
left: 0,
|
|
121
|
-
top: 0
|
|
122
|
-
};
|
|
123
|
-
e.style.transform = `translate(${Math.round(c.left - u.left)}px, ${Math.round(c.top - u.top)}px)`, e.style.visibility = "visible";
|
|
124
|
-
}, [s]);
|
|
125
|
-
G(b), ae(() => {
|
|
126
|
-
if (s?.via !== "touch") return;
|
|
127
|
-
let e = (e) => {
|
|
128
|
-
r.current?.contains(e.target) || g();
|
|
129
|
-
};
|
|
130
|
-
return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
|
|
131
|
-
}, [s?.via, g]);
|
|
132
|
-
let x = (e, n) => {
|
|
133
|
-
let i = r.current;
|
|
134
|
-
if (!i) return null;
|
|
135
|
-
let a = i.getBoundingClientRect();
|
|
136
|
-
return t.current.pick(e - a.left, n - a.top, a, i);
|
|
137
|
-
}, S = (e) => {
|
|
138
|
-
l.current = {
|
|
139
|
-
x: e.clientX,
|
|
140
|
-
y: e.clientY
|
|
141
|
-
};
|
|
142
|
-
let t = x(e.clientX, e.clientY);
|
|
143
|
-
if (t === null) return g();
|
|
144
|
-
v(t, e.pointerType === "touch" ? "touch" : "pointer"), b();
|
|
145
|
-
}, C = [
|
|
146
|
-
d,
|
|
147
|
-
s?.index ?? null,
|
|
148
|
-
e.start ?? null
|
|
149
|
-
].find((e) => e !== null && m(e)) ?? null;
|
|
150
|
-
for (let t = 0; t < e.count && C === null; t++) m(t) && (C = t);
|
|
151
|
-
let w = (e) => {
|
|
152
|
-
let t = e instanceof Element && e !== r.current ? e.closest("[data-hit]") : null;
|
|
153
|
-
return t && r.current?.contains(t) ? Number(t.getAttribute("data-hit")) : null;
|
|
154
|
-
};
|
|
155
|
-
return {
|
|
156
|
-
active: s?.index ?? null,
|
|
157
|
-
pickable: p,
|
|
158
|
-
item: (e, t = {}) => p && m(e) ? {
|
|
159
|
-
"data-hit": e,
|
|
160
|
-
role: "button",
|
|
161
|
-
tabIndex: e === C ? 0 : -1,
|
|
162
|
-
"aria-pressed": t.disabled ? void 0 : !!t.pressed,
|
|
163
|
-
"aria-disabled": t.disabled ? !0 : void 0
|
|
164
|
-
} : { "data-hit": e },
|
|
165
|
-
plotProps: {
|
|
166
|
-
ref: h,
|
|
167
|
-
tabIndex: p ? void 0 : 0,
|
|
168
|
-
"data-chart-plot": "",
|
|
169
|
-
onPointerDown: (e) => {
|
|
170
|
-
e.pointerType === "touch" && (u.current = {
|
|
171
|
-
x: e.clientX,
|
|
172
|
-
y: e.clientY,
|
|
173
|
-
moved: !1
|
|
174
|
-
}, S(e));
|
|
175
|
-
},
|
|
176
|
-
onPointerMove: (e) => {
|
|
177
|
-
if (e.pointerType === "touch") {
|
|
178
|
-
if (!u.current) return;
|
|
179
|
-
Math.hypot(e.clientX - u.current.x, e.clientY - u.current.y) > ve && (u.current.moved = !0);
|
|
180
|
-
}
|
|
181
|
-
S(e);
|
|
182
|
-
},
|
|
183
|
-
onPointerUp: () => {
|
|
184
|
-
u.current && setTimeout(() => u.current = null, 0);
|
|
185
|
-
},
|
|
186
|
-
onPointerLeave: (e) => {
|
|
187
|
-
e.pointerType !== "touch" && g();
|
|
188
|
-
},
|
|
189
|
-
onClick: (e) => {
|
|
190
|
-
if (u.current?.moved) return;
|
|
191
|
-
let n = x(e.clientX, e.clientY);
|
|
192
|
-
n !== null && n >= 0 && t.current.onPick?.(n);
|
|
193
|
-
},
|
|
194
|
-
onKeyDown: (e) => {
|
|
195
|
-
let n = t.current, i = w(e.target);
|
|
196
|
-
if (n.onPick && i !== null && !m(i)) return;
|
|
197
|
-
let a = i ?? (s && s.index >= 0 ? s.index : null);
|
|
198
|
-
if ((e.key === "Enter" || e.key === " ") && a !== null && n.onPick) {
|
|
199
|
-
e.preventDefault(), n.onPick(a);
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
if (e.key === "Escape") return s && e.stopPropagation(), g();
|
|
203
|
-
let o = s && s.index >= 0 ? s.index : n.start ?? null, c = y(e.key, o, n.count, n.keys, n.onPick ? m : void 0);
|
|
204
|
-
c !== null && (e.preventDefault(), l.current = null, v(c, "key"), n.onPick && r.current?.querySelector(`[data-hit="${c}"]`)?.focus());
|
|
205
|
-
},
|
|
206
|
-
onFocus: (e) => {
|
|
207
|
-
let t = w(e.target);
|
|
208
|
-
p && t !== null && (f(t), s?.index !== t && (l.current = null, v(t, "key")));
|
|
209
|
-
},
|
|
210
|
-
onBlur: (e) => {
|
|
211
|
-
e.relatedTarget instanceof Node && r.current?.contains(e.relatedTarget) || s?.via === "key" && g();
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
tooltip: (e) => {
|
|
215
|
-
if (!s || e == null || !o) return null;
|
|
216
|
-
let t = r.current?.closest("[data-theme]")?.getAttribute("data-theme") ?? void 0;
|
|
217
|
-
return ce(/* @__PURE__ */ J("div", {
|
|
218
|
-
className: "chart-tooltip-layer",
|
|
219
|
-
"data-theme": t,
|
|
220
|
-
children: /* @__PURE__ */ J("div", {
|
|
221
|
-
ref: i,
|
|
222
|
-
className: "chart-root chart-tooltip",
|
|
223
|
-
role: "presentation",
|
|
224
|
-
"aria-hidden": !0,
|
|
225
|
-
style: { visibility: "hidden" },
|
|
226
|
-
children: e
|
|
227
|
-
})
|
|
228
|
-
}), o);
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
function be(e, t) {
|
|
233
|
-
let n = e.querySelector(`[data-hit="${t}"]`);
|
|
234
|
-
return n ? n.getBoundingClientRect() : null;
|
|
235
|
-
}
|
|
236
|
-
function xe(e) {
|
|
237
|
-
let t = e.getBoundingClientRect(), n = [];
|
|
238
|
-
return e.querySelectorAll("[data-hit]").forEach((e) => {
|
|
239
|
-
let r = e.getBoundingClientRect();
|
|
240
|
-
n[Number(e.dataset.hit)] = {
|
|
241
|
-
left: r.left - t.left,
|
|
242
|
-
top: r.top - t.top,
|
|
243
|
-
width: r.width,
|
|
244
|
-
height: r.height
|
|
245
|
-
};
|
|
246
|
-
}), n;
|
|
247
|
-
}
|
|
248
|
-
function $({ title: e, rows: t = [], note: n }) {
|
|
249
|
-
return /* @__PURE__ */ Y(se, { children: [
|
|
250
|
-
e != null && e !== "" && /* @__PURE__ */ J("p", {
|
|
251
|
-
className: "chart-tooltip-title",
|
|
252
|
-
children: e
|
|
253
|
-
}),
|
|
254
|
-
t.map((e) => /* @__PURE__ */ Y("p", {
|
|
255
|
-
className: "chart-tooltip-series",
|
|
256
|
-
children: [
|
|
257
|
-
e.color && /* @__PURE__ */ J("span", {
|
|
258
|
-
className: "chart-swatch chart-swatch--small",
|
|
259
|
-
style: { background: e.color }
|
|
260
|
-
}),
|
|
261
|
-
/* @__PURE__ */ J("span", {
|
|
262
|
-
className: "chart-tooltip-label",
|
|
263
|
-
children: e.label
|
|
264
|
-
}),
|
|
265
|
-
/* @__PURE__ */ J("strong", {
|
|
266
|
-
className: "chart-tooltip-value",
|
|
267
|
-
children: e.value
|
|
268
|
-
})
|
|
269
|
-
]
|
|
270
|
-
}, e.key)),
|
|
271
|
-
n != null && n !== "" && /* @__PURE__ */ J("p", {
|
|
272
|
-
className: "chart-tooltip-note",
|
|
273
|
-
children: n
|
|
274
|
-
})
|
|
275
|
-
] });
|
|
276
|
-
}
|
|
277
|
-
// src/components/Charts/BarList.tsx
|
|
278
|
-
function Se({ href: e, className: t, title: n, children: r }) {
|
|
279
|
-
return /* @__PURE__ */ J("a", {
|
|
280
|
-
href: e,
|
|
281
|
-
className: t,
|
|
282
|
-
title: n,
|
|
283
|
-
children: r
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
function Ce({ data: e, series: t, ariaLabel: n, title: r, linkAs: i = Se, compact: a = !1, onSelect: o, selected: u = null, ...d }) {
|
|
287
|
-
let { nf: p, L: m } = x(d), h = (t) => !!o && !e[t]?.href && e[t]?.selectable !== !1, g = Q({
|
|
288
|
-
count: e.length,
|
|
289
|
-
pick: (e, t, n, r) => de(t, xe(r).map((e) => e ? {
|
|
290
|
-
start: e.top,
|
|
291
|
-
end: e.top + e.height
|
|
292
|
-
} : {
|
|
293
|
-
start: Infinity,
|
|
294
|
-
end: Infinity
|
|
295
|
-
})),
|
|
296
|
-
keys: {
|
|
297
|
-
ArrowLeft: 0,
|
|
298
|
-
ArrowRight: 0
|
|
299
|
-
},
|
|
300
|
-
start: u === null ? null : e.findIndex((e) => U(e) === u),
|
|
301
|
-
onPick: o ? (t) => h(t) && o(e[t]) : void 0,
|
|
302
|
-
focusable: (t) => !e[t]?.href
|
|
303
|
-
}), _ = e.map((e) => re(e, t));
|
|
304
|
-
if (_.every((e) => e === 0)) return /* @__PURE__ */ J(l, {
|
|
305
|
-
title: r,
|
|
306
|
-
children: /* @__PURE__ */ J(v, {
|
|
307
|
-
ariaLabel: n,
|
|
308
|
-
text: m.empty,
|
|
309
|
-
compact: a
|
|
310
|
-
})
|
|
311
|
-
});
|
|
312
|
-
let y = P(_), b = _.reduce((e, t) => e + t, 0), S = g.active, C = S === null ? u : U(e[S]), w = S === null ? null : e[S], T = (e, t) => `${e.fullLabel ?? e.label}: ${p(_[t])}`;
|
|
313
|
-
return /* @__PURE__ */ Y(l, {
|
|
314
|
-
title: r,
|
|
315
|
-
children: [
|
|
316
|
-
/* @__PURE__ */ J("div", {
|
|
317
|
-
className: z(`chart-bars chart-plot chart-plot--rows${o ? " chart-plot--pick" : ""}`, a),
|
|
318
|
-
role: o ? "group" : "img",
|
|
319
|
-
"aria-label": !o && w ? T(w, S) : n,
|
|
320
|
-
...g.plotProps,
|
|
321
|
-
children: e.map((e, n) => {
|
|
322
|
-
let r = U(e), a = e.fullLabel ?? e.label, o = g.pickable && !e.href;
|
|
323
|
-
return /* @__PURE__ */ Y("div", {
|
|
324
|
-
...g.item(n, {
|
|
325
|
-
pressed: u === r,
|
|
326
|
-
disabled: !h(n)
|
|
327
|
-
}),
|
|
328
|
-
"aria-label": o ? `${e.label}: ${p(_[n])}` : void 0,
|
|
329
|
-
"aria-description": o && a !== e.label ? a : void 0,
|
|
330
|
-
className: `chart-bars-item${n === S ? " chart-bars-item--active" : ""}${u === r ? " chart-bars-item--on" : ""}`,
|
|
331
|
-
children: [
|
|
332
|
-
e.href ? /* @__PURE__ */ J(i, {
|
|
333
|
-
href: e.href,
|
|
334
|
-
className: "chart-bars-label chart-bars-link",
|
|
335
|
-
title: a,
|
|
336
|
-
children: e.label
|
|
337
|
-
}) : /* @__PURE__ */ J("span", {
|
|
338
|
-
className: "chart-bars-label",
|
|
339
|
-
title: a,
|
|
340
|
-
children: e.label
|
|
341
|
-
}),
|
|
342
|
-
" ",
|
|
343
|
-
/* @__PURE__ */ J("span", {
|
|
344
|
-
className: `chart-bars-bar${C !== null && C !== r ? " chart-faded" : ""}`,
|
|
345
|
-
"aria-hidden": !0,
|
|
346
|
-
children: t.map((n, r) => {
|
|
347
|
-
let i = e.values[n.key] ?? 0;
|
|
348
|
-
if (!i) return null;
|
|
349
|
-
let a = t.slice(r + 1).every((t) => !(e.values[t.key] ?? 0));
|
|
350
|
-
return /* @__PURE__ */ J("span", {
|
|
351
|
-
className: `chart-bars-segment${a ? " chart-bars-segment--end" : ""}`,
|
|
352
|
-
style: {
|
|
353
|
-
width: `${i / y * 100}%`,
|
|
354
|
-
background: L(t.length === 1 && e.slot ? e.slot : n.slot)
|
|
355
|
-
}
|
|
356
|
-
}, n.key);
|
|
357
|
-
})
|
|
358
|
-
}),
|
|
359
|
-
/* @__PURE__ */ J("span", {
|
|
360
|
-
className: "chart-bars-value",
|
|
361
|
-
children: p(_[n])
|
|
362
|
-
})
|
|
363
|
-
]
|
|
364
|
-
}, r);
|
|
365
|
-
})
|
|
366
|
-
}),
|
|
367
|
-
/* @__PURE__ */ J(s, { text: w ? T(w, S) : "" }),
|
|
368
|
-
g.tooltip(w && /* @__PURE__ */ J($, {
|
|
369
|
-
title: w.fullLabel ?? w.label,
|
|
370
|
-
rows: t.map((e) => ({
|
|
371
|
-
key: e.key,
|
|
372
|
-
color: L(t.length === 1 && w.slot ? w.slot : e.slot),
|
|
373
|
-
label: e.label,
|
|
374
|
-
value: p(w.values[e.key] ?? 0)
|
|
375
|
-
})),
|
|
376
|
-
note: m.shareOf(c(f(_[S], b)), p(b))
|
|
377
|
-
}))
|
|
378
|
-
]
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
// src/components/Charts/useBoxSize.ts
|
|
382
|
-
function we() {
|
|
383
|
-
let [e, t] = q(null), [n, r] = q({
|
|
384
|
-
width: 0,
|
|
385
|
-
height: 0
|
|
386
|
-
});
|
|
387
|
-
return G(() => {
|
|
388
|
-
if (!e) return;
|
|
389
|
-
let t = () => {
|
|
390
|
-
let t = e.getBoundingClientRect();
|
|
391
|
-
r((e) => e.width === Math.round(t.width) && e.height === Math.round(t.height) ? e : {
|
|
392
|
-
width: Math.round(t.width),
|
|
393
|
-
height: Math.round(t.height)
|
|
394
|
-
});
|
|
395
|
-
};
|
|
396
|
-
if (t(), typeof ResizeObserver > "u") return;
|
|
397
|
-
let n = new ResizeObserver(t);
|
|
398
|
-
return n.observe(e), () => n.disconnect();
|
|
399
|
-
}, [e]), [W((e) => t(e), []), n];
|
|
400
|
-
}
|
|
401
|
-
function Te() {
|
|
402
|
-
let [e, t] = we();
|
|
403
|
-
return [e, t.width];
|
|
404
|
-
}
|
|
405
|
-
// src/components/Charts/CalendarHeatmap.tsx
|
|
406
|
-
function Ee(e) {
|
|
407
|
-
let t = (t) => {
|
|
408
|
-
try {
|
|
409
|
-
return new Intl.DateTimeFormat(e, {
|
|
410
|
-
...t,
|
|
411
|
-
timeZone: "UTC"
|
|
412
|
-
});
|
|
413
|
-
} catch {
|
|
414
|
-
return new Intl.DateTimeFormat(void 0, {
|
|
415
|
-
...t,
|
|
416
|
-
timeZone: "UTC"
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
return {
|
|
421
|
-
day: t({ dateStyle: "medium" }),
|
|
422
|
-
month: t({ month: "short" }),
|
|
423
|
-
weekday: t({ weekday: "short" })
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
var De = (e) => Array.from({ length: 7 }, (t, n) => Ee(e).weekday.format(Date.UTC(2024, 0, 1 + n)));
|
|
427
|
-
function Oe({ days: e, ariaLabel: t, title: r, onSelect: i, selected: a = null, compact: o = !1, ...c }) {
|
|
428
|
-
let { nf: u, L: d } = x(c), f = n().locale, p = c.locale ?? f, m = oe(() => Ee(p), [p]), h = oe(() => De(p), [p]), g = oe(() => E(e), [e]), [_, y] = Te(), [b, S] = X(), w = ee(y, g.weeks, o ? H.compactMax : H.max, S), O = w.cell + w.gap, k = w.weekdays ? F(S) : 0, A = a === null ? -1 : g.cells.findIndex((e) => e.day === a), j = Q({
|
|
429
|
-
count: g.cells.length,
|
|
430
|
-
pick: (e, t) => fe(e, t, g.cells.map((e) => ({
|
|
431
|
-
left: k + e.week * O,
|
|
432
|
-
top: e.weekday * O,
|
|
433
|
-
width: w.cell,
|
|
434
|
-
height: w.cell
|
|
435
|
-
}))),
|
|
436
|
-
keys: {
|
|
437
|
-
ArrowLeft: -7,
|
|
438
|
-
ArrowRight: 7,
|
|
439
|
-
ArrowUp: -1,
|
|
440
|
-
ArrowDown: 1
|
|
441
|
-
},
|
|
442
|
-
start: A >= 0 ? A : null,
|
|
443
|
-
onPick: i ? (e) => i({
|
|
444
|
-
day: g.cells[e].day,
|
|
445
|
-
count: g.cells[e].count
|
|
446
|
-
}) : void 0
|
|
447
|
-
});
|
|
448
|
-
if (!g.cells.length || g.total === 0) return /* @__PURE__ */ J(l, {
|
|
449
|
-
title: r,
|
|
450
|
-
children: /* @__PURE__ */ J(v, {
|
|
451
|
-
ariaLabel: t,
|
|
452
|
-
text: d.empty,
|
|
453
|
-
compact: o
|
|
454
|
-
})
|
|
455
|
-
});
|
|
456
|
-
let M = (e) => `${m.day.format(C(e.day))}: ${u(e.count)}`, N = j.active, P = N === null ? null : g.cells[N] ?? null, I = `${w.weekdays ? `${k}px ` : ""}repeat(${g.weeks}, ${w.cell}px)`, L = w.weekdays ? 2 : 1;
|
|
457
|
-
return /* @__PURE__ */ J(l, {
|
|
458
|
-
title: r,
|
|
459
|
-
children: /* @__PURE__ */ Y("div", {
|
|
460
|
-
ref: _,
|
|
461
|
-
className: z("chart-calendar", o),
|
|
462
|
-
role: "group",
|
|
463
|
-
"aria-label": `${t}: ${d.total} ${u(g.total)}`,
|
|
464
|
-
children: [
|
|
465
|
-
/* @__PURE__ */ J("div", {
|
|
466
|
-
ref: b,
|
|
467
|
-
className: "chart-calendar-months",
|
|
468
|
-
style: {
|
|
469
|
-
gridTemplateColumns: I,
|
|
470
|
-
columnGap: w.gap
|
|
471
|
-
},
|
|
472
|
-
"aria-hidden": !0,
|
|
473
|
-
children: D(g.months, O, S).map((e) => /* @__PURE__ */ J("span", {
|
|
474
|
-
style: {
|
|
475
|
-
gridRow: 1,
|
|
476
|
-
gridColumn: `${e.week + L} / span ${Math.max(1, Math.ceil(R(S) / O))}`
|
|
477
|
-
},
|
|
478
|
-
children: m.month.format(C(`${e.month}-01`))
|
|
479
|
-
}, e.month))
|
|
480
|
-
}),
|
|
481
|
-
/* @__PURE__ */ Y("div", {
|
|
482
|
-
className: `chart-calendar-grid chart-plot${i ? " chart-plot--pick" : ""}`,
|
|
483
|
-
style: {
|
|
484
|
-
gridTemplateColumns: I,
|
|
485
|
-
gridTemplateRows: `repeat(7, ${w.cell}px)`,
|
|
486
|
-
gap: w.gap
|
|
487
|
-
},
|
|
488
|
-
role: i ? void 0 : "img",
|
|
489
|
-
"aria-label": i ? void 0 : P ? M(P) : t,
|
|
490
|
-
...j.plotProps,
|
|
491
|
-
children: [w.weekdays && h.map((e, t) => /* @__PURE__ */ J("span", {
|
|
492
|
-
className: "chart-calendar-weekday",
|
|
493
|
-
style: {
|
|
494
|
-
gridRow: t + 1,
|
|
495
|
-
gridColumn: 1
|
|
496
|
-
},
|
|
497
|
-
"aria-hidden": !0,
|
|
498
|
-
children: t % 2 == 0 ? e : ""
|
|
499
|
-
}, e)), g.cells.map((e, t) => /* @__PURE__ */ J("span", {
|
|
500
|
-
...j.item(t, { pressed: t === A }),
|
|
501
|
-
"aria-label": j.pickable ? M(e) : void 0,
|
|
502
|
-
className: `chart-calendar-day${t === A ? " chart-calendar-day--on" : ""}${t === N ? " chart-calendar-day--active" : ""}${A >= 0 && t !== A ? " chart-calendar-day--faded" : ""}`,
|
|
503
|
-
style: {
|
|
504
|
-
gridRow: e.weekday + 1,
|
|
505
|
-
gridColumn: e.week + L,
|
|
506
|
-
background: T(e.level),
|
|
507
|
-
borderRadius: w.cell < 8 ? 1 : 2
|
|
508
|
-
},
|
|
509
|
-
"data-level": e.level,
|
|
510
|
-
"aria-hidden": !j.pickable || void 0
|
|
511
|
-
}, e.day))]
|
|
512
|
-
}),
|
|
513
|
-
/* @__PURE__ */ Y("div", {
|
|
514
|
-
className: "chart-calendar-legend",
|
|
515
|
-
"aria-hidden": !0,
|
|
516
|
-
children: [
|
|
517
|
-
/* @__PURE__ */ J("span", { children: d.less }),
|
|
518
|
-
Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ J("span", {
|
|
519
|
-
className: "chart-calendar-swatch",
|
|
520
|
-
style: { background: T(t) }
|
|
521
|
-
}, t)),
|
|
522
|
-
/* @__PURE__ */ J("span", { children: d.more })
|
|
523
|
-
]
|
|
524
|
-
}),
|
|
525
|
-
/* @__PURE__ */ J(s, { text: P ? M(P) : "" }),
|
|
526
|
-
j.tooltip(P && /* @__PURE__ */ J($, {
|
|
527
|
-
title: m.day.format(C(P.day)),
|
|
528
|
-
rows: [{
|
|
529
|
-
key: "n",
|
|
530
|
-
color: T(Math.max(1, P.level)),
|
|
531
|
-
label: t,
|
|
532
|
-
value: u(P.count)
|
|
533
|
-
}]
|
|
534
|
-
}))
|
|
535
|
-
]
|
|
536
|
-
})
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
// src/components/Charts/Legend.tsx
|
|
540
|
-
function ke({ series: e, labels: t }) {
|
|
541
|
-
let { L: n } = x({ labels: t });
|
|
542
|
-
return e.length < 2 ? null : /* @__PURE__ */ J("ul", {
|
|
543
|
-
className: z("chart-legend"),
|
|
544
|
-
"aria-label": n.legend,
|
|
545
|
-
children: e.map((e) => /* @__PURE__ */ Y("li", {
|
|
546
|
-
className: "chart-legend-item",
|
|
547
|
-
children: [/* @__PURE__ */ J("span", {
|
|
548
|
-
className: "chart-swatch",
|
|
549
|
-
style: { background: L(e.slot) },
|
|
550
|
-
"aria-hidden": !0
|
|
551
|
-
}), e.label]
|
|
552
|
-
}, e.key))
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
// src/components/Charts/ColumnChart.tsx
|
|
556
|
-
var Ae = 6, je = 2, Me = 6, Ne = 44;
|
|
557
|
-
function Pe({ data: e, series: t, ariaLabel: n, title: r, height: a, compact: o = !1, mode: c = "stacked", legend: u = !1, onSelect: d, selected: f = null, ...p }) {
|
|
558
|
-
let { nf: m, L: h } = x(p), [g, _] = Te(), [y, b] = X(), C = e.length, T = (t) => !!d && e[t]?.selectable !== !1, E = Q({
|
|
559
|
-
count: C,
|
|
560
|
-
pick: (e, t, n) => ue(e, n.width, C),
|
|
561
|
-
anchor: (e, t) => {
|
|
562
|
-
let n = t.getBoundingClientRect();
|
|
563
|
-
return {
|
|
564
|
-
left: n.left + n.width * e / C,
|
|
565
|
-
top: n.top,
|
|
566
|
-
width: n.width / C,
|
|
567
|
-
height: n.height
|
|
568
|
-
};
|
|
569
|
-
},
|
|
570
|
-
keys: {
|
|
571
|
-
ArrowUp: 0,
|
|
572
|
-
ArrowDown: 0
|
|
573
|
-
},
|
|
574
|
-
start: f === null ? null : e.findIndex((e) => U(e) === f),
|
|
575
|
-
onPick: d ? (t) => T(t) && d(e[t]) : void 0
|
|
576
|
-
}), D = e.map((e) => re(e, t));
|
|
577
|
-
if (D.every((e) => e === 0)) return /* @__PURE__ */ J(l, {
|
|
578
|
-
title: r,
|
|
579
|
-
children: /* @__PURE__ */ J(v, {
|
|
580
|
-
ariaLabel: n,
|
|
581
|
-
text: h.empty,
|
|
582
|
-
compact: o
|
|
583
|
-
})
|
|
584
|
-
});
|
|
585
|
-
let O = (a ?? (o ? 96 : 220)) * b, A = c === "grouped" && t.length > 1, { max: j, ticks: M } = k(S(e, t, A ? "grouped" : "stacked")), N = A ? i(t.length, 100, Ae) : [], P = E.active, F = (P === null ? null : U(e[P])) ?? f, I = _ && _ / Math.max(1, C) < Me ? 0 : je, R = new Set(w(C, Math.max(2, Math.min(12, Math.floor((_ || 600) / (Ne * b)))))), B = (e, n) => `${e.fullLabel ?? e.label}: ${t.length > 1 ? t.map((t) => `${t.label} ${m(e.values[t.key] ?? 0)}`).join(", ") : m(D[n])}`, V = P === null ? null : e[P];
|
|
586
|
-
return /* @__PURE__ */ J(l, {
|
|
587
|
-
title: r,
|
|
588
|
-
children: /* @__PURE__ */ Y("div", {
|
|
589
|
-
ref: g,
|
|
590
|
-
className: z(`chart-columns${A ? " chart-columns--grouped" : ""}`, o),
|
|
591
|
-
role: "group",
|
|
592
|
-
"aria-label": n,
|
|
593
|
-
children: [
|
|
594
|
-
/* @__PURE__ */ Y("div", {
|
|
595
|
-
className: "chart-columns-plot",
|
|
596
|
-
style: { height: O },
|
|
597
|
-
children: [!o && /* @__PURE__ */ J("div", {
|
|
598
|
-
className: "chart-axis-y",
|
|
599
|
-
"aria-hidden": !0,
|
|
600
|
-
children: [...M].reverse().map((e) => /* @__PURE__ */ J("span", { children: m(e) }, e))
|
|
601
|
-
}), /* @__PURE__ */ Y("div", {
|
|
602
|
-
className: `chart-columns-area chart-plot chart-plot--x${d ? " chart-plot--pick" : ""}`,
|
|
603
|
-
role: d ? void 0 : "img",
|
|
604
|
-
"aria-label": d ? void 0 : V ? B(V, P) : n,
|
|
605
|
-
...E.plotProps,
|
|
606
|
-
children: [!o && M.slice(1).map((e) => /* @__PURE__ */ J("div", {
|
|
607
|
-
className: "chart-gridline",
|
|
608
|
-
style: { bottom: `${e / j * 100}%` },
|
|
609
|
-
"aria-hidden": !0
|
|
610
|
-
}, e)), /* @__PURE__ */ J("div", {
|
|
611
|
-
className: "chart-columns-bars",
|
|
612
|
-
style: { gap: I },
|
|
613
|
-
"aria-hidden": !E.pickable || void 0,
|
|
614
|
-
children: e.map((e, n) => {
|
|
615
|
-
let r = U(e), i = F !== null && F !== r ? " chart-faded" : "";
|
|
616
|
-
return /* @__PURE__ */ J("div", {
|
|
617
|
-
...E.item(n, {
|
|
618
|
-
pressed: f === r,
|
|
619
|
-
disabled: !T(n)
|
|
620
|
-
}),
|
|
621
|
-
"aria-label": E.pickable ? B(e, n) : void 0,
|
|
622
|
-
className: `chart-column${n === P ? " chart-column--active" : ""}${f === r ? " chart-column--on" : ""}`,
|
|
623
|
-
children: A ? /* @__PURE__ */ J("span", {
|
|
624
|
-
className: `chart-column-group${i}`,
|
|
625
|
-
children: t.map((t, n) => /* @__PURE__ */ J("span", {
|
|
626
|
-
className: "chart-column-segment chart-column-segment--top chart-column-bar",
|
|
627
|
-
style: {
|
|
628
|
-
left: `${N[n].x}%`,
|
|
629
|
-
width: `${N[n].width}%`,
|
|
630
|
-
height: `${(e.values[t.key] ?? 0) / j * O}px`,
|
|
631
|
-
background: L(t.slot)
|
|
632
|
-
}
|
|
633
|
-
}, t.key))
|
|
634
|
-
}) : /* @__PURE__ */ J("span", {
|
|
635
|
-
className: `chart-column-stack${i}`,
|
|
636
|
-
children: t.map((n, r) => {
|
|
637
|
-
let i = e.values[n.key] ?? 0;
|
|
638
|
-
if (!i) return null;
|
|
639
|
-
let a = t.slice(r + 1).every((t) => !(e.values[t.key] ?? 0));
|
|
640
|
-
return /* @__PURE__ */ J("span", {
|
|
641
|
-
className: `chart-column-segment${a ? " chart-column-segment--top" : ""}`,
|
|
642
|
-
style: {
|
|
643
|
-
height: `${i / j * O}px`,
|
|
644
|
-
background: L(n.slot)
|
|
645
|
-
}
|
|
646
|
-
}, n.key);
|
|
647
|
-
})
|
|
648
|
-
})
|
|
649
|
-
}, r);
|
|
650
|
-
})
|
|
651
|
-
})]
|
|
652
|
-
})]
|
|
653
|
-
}),
|
|
654
|
-
/* @__PURE__ */ J("div", {
|
|
655
|
-
ref: y,
|
|
656
|
-
className: `chart-axis-x${o ? " chart-axis-x--compact" : ""}`,
|
|
657
|
-
style: { gap: I },
|
|
658
|
-
"aria-hidden": !0,
|
|
659
|
-
children: e.map((e, t) => /* @__PURE__ */ J("span", {
|
|
660
|
-
className: f !== null && f !== U(e) ? "chart-faded" : void 0,
|
|
661
|
-
children: R.has(t) ? e.label : ""
|
|
662
|
-
}, U(e)))
|
|
663
|
-
}),
|
|
664
|
-
u && /* @__PURE__ */ J("div", {
|
|
665
|
-
className: "chart-columns-legend",
|
|
666
|
-
children: /* @__PURE__ */ J(ke, {
|
|
667
|
-
series: t,
|
|
668
|
-
labels: p.labels
|
|
669
|
-
})
|
|
670
|
-
}),
|
|
671
|
-
/* @__PURE__ */ J(s, { text: V ? B(V, P) : "" }),
|
|
672
|
-
E.tooltip(V && /* @__PURE__ */ J($, {
|
|
673
|
-
title: V.fullLabel ?? V.label,
|
|
674
|
-
rows: t.map((e) => ({
|
|
675
|
-
key: e.key,
|
|
676
|
-
color: L(e.slot),
|
|
677
|
-
label: e.label,
|
|
678
|
-
value: m(V.values[e.key] ?? 0)
|
|
679
|
-
})),
|
|
680
|
-
note: t.length > 1 ? `${h.total}: ${m(D[P])}` : void 0
|
|
681
|
-
}))
|
|
682
|
-
]
|
|
683
|
-
})
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
// src/components/Charts/useLegendFit.ts
|
|
687
|
-
function Fe(e, t) {
|
|
688
|
-
let [n, r] = q(null), [i, a] = q(e), [o, s] = q(e);
|
|
689
|
-
return G(() => {
|
|
690
|
-
if (!t || !n) {
|
|
691
|
-
a(e), s(e);
|
|
692
|
-
return;
|
|
693
|
-
}
|
|
694
|
-
let r = 0, i = () => {
|
|
695
|
-
let t = n.clientHeight, r = Array.from(n.children).filter((e) => !e.hasAttribute("data-legend-more")), i = e;
|
|
696
|
-
if (t && r.length >= e) {
|
|
697
|
-
let a = n.getBoundingClientRect().top, o = r.filter((e) => e.getBoundingClientRect().bottom - a <= t + .5).length;
|
|
698
|
-
i = o >= e ? e : Math.max(0, o - 1);
|
|
699
|
-
}
|
|
700
|
-
a(i), s(i);
|
|
701
|
-
}, o = () => {
|
|
702
|
-
cancelAnimationFrame(r), a(e), r = requestAnimationFrame(i);
|
|
703
|
-
};
|
|
704
|
-
if (o(), typeof ResizeObserver > "u") return () => cancelAnimationFrame(r);
|
|
705
|
-
let c = n.parentElement ?? n, l = c.clientWidth, u = new ResizeObserver(() => {
|
|
706
|
-
c.clientWidth !== l && (l = c.clientWidth, o());
|
|
707
|
-
});
|
|
708
|
-
return u.observe(c), () => {
|
|
709
|
-
cancelAnimationFrame(r), u.disconnect();
|
|
710
|
-
};
|
|
711
|
-
}, [
|
|
712
|
-
n,
|
|
713
|
-
e,
|
|
714
|
-
t
|
|
715
|
-
]), [
|
|
716
|
-
W((e) => r(e), []),
|
|
717
|
-
t ? i : e,
|
|
718
|
-
t ? o : e
|
|
719
|
-
];
|
|
720
|
-
}
|
|
721
|
-
// src/components/Charts/Donut.tsx
|
|
722
|
-
var Ie = 2.5;
|
|
723
|
-
function Le({ slices: n, ariaLabel: r, title: i, size: a, compact: o = !1, variant: l = "donut", onLegendCut: u, legend: p = !0, onSelect: m, selected: h = null, ...g }) {
|
|
724
|
-
let { nf: _, L: v } = x(g), [y, b] = q(null), [S, C, w] = Fe(n.length, o);
|
|
725
|
-
ae(() => u?.(n.length - w), [
|
|
726
|
-
u,
|
|
727
|
-
n.length,
|
|
728
|
-
w
|
|
729
|
-
]);
|
|
730
|
-
let [T, E] = X(), D = (a ?? (o ? 112 : 168)) * E, O = n.reduce((e, t) => e + t.value, 0), k = l === "pie", A = k ? e(n).map((e) => ({
|
|
731
|
-
slice: e.slice,
|
|
732
|
-
a0: e.a0,
|
|
733
|
-
a1: e.a1
|
|
734
|
-
})) : t(n).map((e) => ({
|
|
735
|
-
slice: e.slice,
|
|
736
|
-
a0: e.start / B * 2 * Math.PI,
|
|
737
|
-
a1: (e.start + e.length) / B * 2 * Math.PI
|
|
738
|
-
})), j = (e) => !!m && n[e].value > 0 && n[e].selectable !== !1, M = Q({
|
|
739
|
-
count: n.length,
|
|
740
|
-
pick: (e, t, r) => {
|
|
741
|
-
let i = r.width / 100, a = 48 * i, o = k ? 0 : 32 * i, s = he(e - r.width / 2, t - r.height / 2, a, o, A);
|
|
742
|
-
return s === null || s === -1 ? s : n.indexOf(A[s].slice);
|
|
743
|
-
},
|
|
744
|
-
anchor: (e, t) => {
|
|
745
|
-
let r = t.getBoundingClientRect(), i = A.find((t) => t.slice === n[e]), a = i ? d(r.left + r.width / 2, r.top + r.height / 2, r.width / 100 * (k ? 36 : 40), (i.a0 + i.a1) / 2) : {
|
|
746
|
-
x: r.left + r.width / 2,
|
|
747
|
-
y: r.top + r.height / 2
|
|
748
|
-
};
|
|
749
|
-
return {
|
|
750
|
-
left: a.x - 1,
|
|
751
|
-
top: a.y - 1,
|
|
752
|
-
width: 2,
|
|
753
|
-
height: 2
|
|
754
|
-
};
|
|
755
|
-
},
|
|
756
|
-
start: h === null ? null : n.findIndex((e) => e.key === h),
|
|
757
|
-
onPick: m ? (e) => j(e) && m(n[e]) : void 0,
|
|
758
|
-
focusable: (e) => n[e].value > 0
|
|
759
|
-
}), N = (e) => {
|
|
760
|
-
let t = n.indexOf(e);
|
|
761
|
-
return {
|
|
762
|
-
...M.item(t, {
|
|
763
|
-
pressed: h === e.key,
|
|
764
|
-
disabled: !j(t)
|
|
765
|
-
}),
|
|
766
|
-
"aria-label": M.pickable ? F(e) : void 0
|
|
767
|
-
};
|
|
768
|
-
}, P = (e) => f(e, O), F = (e) => `${e.label} ${_(e.value)} (${c(P(e.value))})`, I = M.active === -1, R = M.active !== null && M.active >= 0 ? n[M.active] : void 0, V = R?.key ?? y ?? h, H = n.find((e) => e.key === V) ?? n[0], ee = (e) => V !== null && V !== e ? .55 : 1, U = k ? e(n) : [];
|
|
769
|
-
return /* @__PURE__ */ Y("figure", {
|
|
770
|
-
ref: T,
|
|
771
|
-
className: z(k ? "chart-donut chart-pie" : "chart-donut", o),
|
|
772
|
-
"aria-label": r,
|
|
773
|
-
children: [
|
|
774
|
-
i && /* @__PURE__ */ J("figcaption", {
|
|
775
|
-
className: "chart-donut-title",
|
|
776
|
-
children: i
|
|
777
|
-
}),
|
|
778
|
-
/* @__PURE__ */ Y("div", {
|
|
779
|
-
className: `chart-donut-ring chart-plot${m ? " chart-plot--pick" : ""}`,
|
|
780
|
-
style: {
|
|
781
|
-
width: D,
|
|
782
|
-
height: D
|
|
783
|
-
},
|
|
784
|
-
role: m ? void 0 : "img",
|
|
785
|
-
"aria-label": m ? void 0 : R ? F(R) : `${r}: ${n.map(F).join(", ")}`,
|
|
786
|
-
...M.plotProps,
|
|
787
|
-
children: [/* @__PURE__ */ J("svg", {
|
|
788
|
-
viewBox: "0 0 100 100",
|
|
789
|
-
width: D,
|
|
790
|
-
height: D,
|
|
791
|
-
className: "chart-donut-svg",
|
|
792
|
-
overflow: "visible",
|
|
793
|
-
"aria-hidden": !M.pickable || void 0,
|
|
794
|
-
children: k ? O === 0 ? /* @__PURE__ */ J("circle", {
|
|
795
|
-
cx: "50",
|
|
796
|
-
cy: "50",
|
|
797
|
-
r: 48,
|
|
798
|
-
fill: L("rest"),
|
|
799
|
-
opacity: .5,
|
|
800
|
-
"aria-hidden": !0
|
|
801
|
-
}) : U.map((e) => {
|
|
802
|
-
let t = e.slice, n = V === t.key && U.length > 1 ? d(0, 0, Ie, (e.a0 + e.a1) / 2) : null;
|
|
803
|
-
return /* @__PURE__ */ Y("g", {
|
|
804
|
-
transform: n ? `translate(${n.x} ${n.y})` : void 0,
|
|
805
|
-
opacity: ee(t.key),
|
|
806
|
-
className: "chart-pie-slice-group",
|
|
807
|
-
children: [/* @__PURE__ */ J("path", {
|
|
808
|
-
...N(t),
|
|
809
|
-
d: ie(50, 50, 48, e.a0, e.a1),
|
|
810
|
-
fill: L(t.slot),
|
|
811
|
-
stroke: "var(--chart-surface)",
|
|
812
|
-
strokeWidth: +(U.length > 1),
|
|
813
|
-
strokeLinejoin: "round",
|
|
814
|
-
className: "chart-donut-slice chart-pie-slice"
|
|
815
|
-
}), e.label && /* @__PURE__ */ J("text", {
|
|
816
|
-
x: e.label.x,
|
|
817
|
-
y: e.label.y,
|
|
818
|
-
className: "chart-pie-share",
|
|
819
|
-
fill: te(t.slot),
|
|
820
|
-
textAnchor: "middle",
|
|
821
|
-
dominantBaseline: "central",
|
|
822
|
-
"aria-hidden": !0,
|
|
823
|
-
children: c(e.share)
|
|
824
|
-
})]
|
|
825
|
-
}, t.key);
|
|
826
|
-
}) : /* @__PURE__ */ J("g", {
|
|
827
|
-
transform: "rotate(-90 50 50)",
|
|
828
|
-
children: O === 0 ? /* @__PURE__ */ J("circle", {
|
|
829
|
-
cx: "50",
|
|
830
|
-
cy: "50",
|
|
831
|
-
r: 40,
|
|
832
|
-
fill: "none",
|
|
833
|
-
stroke: L("rest"),
|
|
834
|
-
strokeWidth: 16,
|
|
835
|
-
opacity: .5,
|
|
836
|
-
"aria-hidden": !0
|
|
837
|
-
}) : t(n).map(({ slice: e, start: t, length: n }) => /* @__PURE__ */ J("circle", {
|
|
838
|
-
...N(e),
|
|
839
|
-
cx: "50",
|
|
840
|
-
cy: "50",
|
|
841
|
-
r: 40,
|
|
842
|
-
fill: "none",
|
|
843
|
-
stroke: L(e.slot),
|
|
844
|
-
strokeWidth: V === e.key ? 18 : 16,
|
|
845
|
-
strokeDasharray: `${n} ${B}`,
|
|
846
|
-
strokeDashoffset: -t,
|
|
847
|
-
className: "chart-donut-slice",
|
|
848
|
-
opacity: I ? 1 : ee(e.key)
|
|
849
|
-
}, e.key))
|
|
850
|
-
})
|
|
851
|
-
}), k ? O === 0 && /* @__PURE__ */ J("div", {
|
|
852
|
-
className: "chart-donut-centre",
|
|
853
|
-
"aria-hidden": !0,
|
|
854
|
-
children: /* @__PURE__ */ J("span", {
|
|
855
|
-
className: "chart-donut-empty",
|
|
856
|
-
children: v.empty
|
|
857
|
-
})
|
|
858
|
-
}) : /* @__PURE__ */ J("div", {
|
|
859
|
-
className: "chart-donut-centre",
|
|
860
|
-
"aria-hidden": !0,
|
|
861
|
-
children: O > 0 && I ? /* @__PURE__ */ Y(se, { children: [/* @__PURE__ */ J("span", {
|
|
862
|
-
className: "chart-donut-share",
|
|
863
|
-
children: _(O)
|
|
864
|
-
}), /* @__PURE__ */ J("span", {
|
|
865
|
-
className: "chart-donut-share-label",
|
|
866
|
-
children: v.total.toLowerCase()
|
|
867
|
-
})] }) : O > 0 && H ? /* @__PURE__ */ Y(se, { children: [/* @__PURE__ */ J("span", {
|
|
868
|
-
className: "chart-donut-share",
|
|
869
|
-
children: c(P(H.value))
|
|
870
|
-
}), /* @__PURE__ */ J("span", {
|
|
871
|
-
className: "chart-donut-share-label",
|
|
872
|
-
children: H.label.toLowerCase()
|
|
873
|
-
})] }) : /* @__PURE__ */ J("span", {
|
|
874
|
-
className: "chart-donut-empty",
|
|
875
|
-
children: v.empty
|
|
876
|
-
})
|
|
877
|
-
})]
|
|
878
|
-
}),
|
|
879
|
-
p && /* @__PURE__ */ Y("ul", {
|
|
880
|
-
ref: S,
|
|
881
|
-
className: "chart-donut-legend",
|
|
882
|
-
"aria-label": v.legend,
|
|
883
|
-
children: [n.slice(0, C).map((e, t) => /* @__PURE__ */ Y("li", {
|
|
884
|
-
className: `chart-donut-legend-item${j(t) ? " chart-donut-legend-item--hit" : ""}${h === e.key ? " chart-donut-legend-item--on" : ""}${h !== null && h !== e.key ? " chart-faded" : ""}`,
|
|
885
|
-
onMouseEnter: () => b(e.key),
|
|
886
|
-
onMouseLeave: () => b(null),
|
|
887
|
-
onClick: j(t) ? () => m(e) : void 0,
|
|
888
|
-
children: [
|
|
889
|
-
/* @__PURE__ */ J("span", {
|
|
890
|
-
className: "chart-swatch",
|
|
891
|
-
style: { background: L(e.slot) },
|
|
892
|
-
"aria-hidden": !0
|
|
893
|
-
}),
|
|
894
|
-
/* @__PURE__ */ J("span", {
|
|
895
|
-
className: "chart-donut-legend-label",
|
|
896
|
-
children: e.label
|
|
897
|
-
}),
|
|
898
|
-
/* @__PURE__ */ Y("span", {
|
|
899
|
-
className: "chart-donut-legend-value",
|
|
900
|
-
children: [
|
|
901
|
-
_(e.value),
|
|
902
|
-
" · ",
|
|
903
|
-
c(P(e.value))
|
|
904
|
-
]
|
|
905
|
-
})
|
|
906
|
-
]
|
|
907
|
-
}, e.key)), C < n.length && /* @__PURE__ */ J("li", {
|
|
908
|
-
className: "chart-donut-legend-more",
|
|
909
|
-
"data-legend-more": "",
|
|
910
|
-
children: v.moreValues(_(n.length - C))
|
|
911
|
-
})]
|
|
912
|
-
}),
|
|
913
|
-
/* @__PURE__ */ J(s, { text: R ? F(R) : I ? `${v.total} ${_(O)}` : "" }),
|
|
914
|
-
M.tooltip(I ? /* @__PURE__ */ J($, {
|
|
915
|
-
title: r,
|
|
916
|
-
rows: n.map((e) => ({
|
|
917
|
-
key: e.key,
|
|
918
|
-
color: L(e.slot),
|
|
919
|
-
label: e.label,
|
|
920
|
-
value: _(e.value)
|
|
921
|
-
})),
|
|
922
|
-
note: `${v.total}: ${_(O)}`
|
|
923
|
-
}) : R && /* @__PURE__ */ J($, {
|
|
924
|
-
rows: [{
|
|
925
|
-
key: R.key,
|
|
926
|
-
color: L(R.slot),
|
|
927
|
-
label: R.label,
|
|
928
|
-
value: _(R.value)
|
|
929
|
-
}],
|
|
930
|
-
note: v.shareOf(c(P(R.value)), _(O))
|
|
931
|
-
}))
|
|
932
|
-
]
|
|
933
|
-
});
|
|
934
|
-
}
|
|
935
|
-
// src/components/Charts/Funnel.tsx
|
|
936
|
-
function Re({ steps: e, ariaLabel: t, title: n, compact: r = !1, showChange: i = !0, onSelect: a, selected: o = null, ...u }) {
|
|
937
|
-
let { nf: d, L: f } = x(u), p = (t) => !!a && e[t].selectable !== !1, m = Q({
|
|
938
|
-
count: e.length,
|
|
939
|
-
pick: (e, t, n, r) => de(t, xe(r).map((e) => e ? {
|
|
940
|
-
start: e.top,
|
|
941
|
-
end: e.top + e.height
|
|
942
|
-
} : {
|
|
943
|
-
start: Infinity,
|
|
944
|
-
end: Infinity
|
|
945
|
-
})),
|
|
946
|
-
keys: {
|
|
947
|
-
ArrowLeft: 0,
|
|
948
|
-
ArrowRight: 0
|
|
949
|
-
},
|
|
950
|
-
start: o === null ? null : e.findIndex((e) => e.key === o),
|
|
951
|
-
onPick: a ? (t) => p(t) && a(e[t]) : void 0
|
|
952
|
-
});
|
|
953
|
-
if (!e.some((e) => e.value > 0)) return /* @__PURE__ */ J(l, {
|
|
954
|
-
title: n,
|
|
955
|
-
children: /* @__PURE__ */ J(v, {
|
|
956
|
-
ariaLabel: t,
|
|
957
|
-
text: f.empty,
|
|
958
|
-
compact: r
|
|
959
|
-
})
|
|
960
|
-
});
|
|
961
|
-
let h = ne(e).map((e) => i ? e : {
|
|
962
|
-
...e,
|
|
963
|
-
drop: null
|
|
964
|
-
}), g = m.active === null ? null : h[m.active] ?? null, _ = g?.step.key ?? o, y = (e) => `${e.step.label}: ${d(e.step.value)}${e.drop === null ? "" : `, ${f.funnelDrop} ${b(e.drop)}`}`;
|
|
965
|
-
return /* @__PURE__ */ Y(l, {
|
|
966
|
-
title: n,
|
|
967
|
-
children: [
|
|
968
|
-
/* @__PURE__ */ J("ol", {
|
|
969
|
-
className: z(`chart-funnel${i ? "" : " chart-funnel--no-change"} chart-plot chart-plot--rows${a ? " chart-plot--pick" : ""}`, r),
|
|
970
|
-
role: a ? void 0 : "img",
|
|
971
|
-
"aria-label": !a && g ? y(g) : t,
|
|
972
|
-
...m.plotProps,
|
|
973
|
-
children: h.map(({ step: e, width: t, drop: n }, r) => /* @__PURE__ */ J("li", {
|
|
974
|
-
"data-hit": m.pickable ? void 0 : r,
|
|
975
|
-
className: `chart-funnel-item${r === m.active ? " chart-funnel-item--active" : ""}`,
|
|
976
|
-
"aria-hidden": !m.pickable || void 0,
|
|
977
|
-
children: /* @__PURE__ */ Y("span", {
|
|
978
|
-
...m.pickable ? m.item(r, {
|
|
979
|
-
pressed: o === e.key,
|
|
980
|
-
disabled: !p(r)
|
|
981
|
-
}) : {},
|
|
982
|
-
"aria-label": m.pickable ? `${e.label}: ${d(e.value)}${n === null ? "" : `, ${b(n)}`}` : void 0,
|
|
983
|
-
"aria-description": m.pickable && n !== null ? f.funnelDrop : void 0,
|
|
984
|
-
className: `chart-funnel-row${_ !== null && _ !== e.key ? " chart-faded" : ""}`,
|
|
985
|
-
children: [
|
|
986
|
-
/* @__PURE__ */ J("span", {
|
|
987
|
-
className: "chart-funnel-label",
|
|
988
|
-
title: e.label,
|
|
989
|
-
children: e.label
|
|
990
|
-
}),
|
|
991
|
-
" ",
|
|
992
|
-
/* @__PURE__ */ Y("span", {
|
|
993
|
-
className: "chart-funnel-track",
|
|
994
|
-
children: [/* @__PURE__ */ J("span", {
|
|
995
|
-
className: "chart-funnel-bar",
|
|
996
|
-
style: {
|
|
997
|
-
width: `${t * 100}%`,
|
|
998
|
-
background: L(e.slot),
|
|
999
|
-
color: te(e.slot)
|
|
1000
|
-
},
|
|
1001
|
-
children: t >= .18 ? d(e.value) : ""
|
|
1002
|
-
}), t < .18 && /* @__PURE__ */ J("span", {
|
|
1003
|
-
className: "chart-funnel-outside",
|
|
1004
|
-
children: d(e.value)
|
|
1005
|
-
})]
|
|
1006
|
-
}),
|
|
1007
|
-
" ",
|
|
1008
|
-
i && /* @__PURE__ */ J("span", {
|
|
1009
|
-
className: "chart-funnel-drop",
|
|
1010
|
-
"data-change": n === null ? void 0 : n > 0 ? "drop" : n < 0 ? "rise" : "flat",
|
|
1011
|
-
children: n === null ? "" : b(n)
|
|
1012
|
-
})
|
|
1013
|
-
]
|
|
1014
|
-
})
|
|
1015
|
-
}, e.key))
|
|
1016
|
-
}),
|
|
1017
|
-
/* @__PURE__ */ J(s, { text: g ? y(g) : "" }),
|
|
1018
|
-
m.tooltip(g && /* @__PURE__ */ J($, {
|
|
1019
|
-
rows: [{
|
|
1020
|
-
key: g.step.key,
|
|
1021
|
-
color: L(g.step.slot),
|
|
1022
|
-
label: g.step.label,
|
|
1023
|
-
value: d(g.step.value)
|
|
1024
|
-
}],
|
|
1025
|
-
note: [i && m.active > 0 ? `${f.funnelOfFirst}: ${c(g.ofFirst)}` : "", g.drop === null ? "" : `${f.funnelDrop}: ${b(g.drop)}`].filter(Boolean).join(" · ") || void 0
|
|
1026
|
-
}))
|
|
1027
|
-
]
|
|
1028
|
-
});
|
|
1029
|
-
}
|
|
1030
|
-
// src/components/Charts/Gauge.tsx
|
|
1031
|
-
function ze({ value: e, total: t, ariaLabel: n, label: r, variant: i = "half", color: a = 1, size: o, compact: l = !1, ...u }) {
|
|
1032
|
-
let { nf: d, L: p } = x(u), m = j[i], h = f(e, t), { a0: _, a1: v, end: y } = g(i, h), [b, S] = X(), C = (o ?? (i === "half" ? l ? 120 : 168 : l ? 88 : 128)) * S, w = Q({
|
|
1033
|
-
count: 1,
|
|
1034
|
-
pick: (e, t, n) => {
|
|
1035
|
-
let r = n.width / m.width;
|
|
1036
|
-
return he(e - m.cx * r, t - m.cy * r, (m.r + 6) * r, 0, [{
|
|
1037
|
-
a0: _,
|
|
1038
|
-
a1: v
|
|
1039
|
-
}]) === null ? null : 0;
|
|
1040
|
-
}
|
|
1041
|
-
}), T = p.ofTotal(d(e), d(t)), E = L(O(a, h));
|
|
1042
|
-
return /* @__PURE__ */ Y("div", {
|
|
1043
|
-
ref: b,
|
|
1044
|
-
className: z(`chart-gauge chart-gauge--${i}`, l),
|
|
1045
|
-
role: "meter",
|
|
1046
|
-
"aria-label": n,
|
|
1047
|
-
"aria-valuemin": 0,
|
|
1048
|
-
"aria-valuemax": 100,
|
|
1049
|
-
"aria-valuenow": Math.round(h * 10) / 10,
|
|
1050
|
-
"aria-valuetext": `${T} (${c(h)})`,
|
|
1051
|
-
children: [
|
|
1052
|
-
/* @__PURE__ */ Y("div", {
|
|
1053
|
-
className: "chart-gauge-dial chart-plot",
|
|
1054
|
-
style: { width: C },
|
|
1055
|
-
...w.plotProps,
|
|
1056
|
-
children: [/* @__PURE__ */ Y("svg", {
|
|
1057
|
-
viewBox: `0 0 ${m.width} ${m.height}`,
|
|
1058
|
-
width: C,
|
|
1059
|
-
height: C * m.height / m.width,
|
|
1060
|
-
"aria-hidden": !0,
|
|
1061
|
-
children: [/* @__PURE__ */ J("path", {
|
|
1062
|
-
d: I(m.cx, m.cy, m.r, _, v),
|
|
1063
|
-
className: "chart-gauge-track",
|
|
1064
|
-
fill: "none",
|
|
1065
|
-
strokeWidth: 12,
|
|
1066
|
-
strokeLinecap: "round"
|
|
1067
|
-
}), h > 0 && /* @__PURE__ */ J("path", {
|
|
1068
|
-
d: I(m.cx, m.cy, m.r, _, Math.max(y, _ + .01)),
|
|
1069
|
-
className: "chart-gauge-value",
|
|
1070
|
-
fill: "none",
|
|
1071
|
-
stroke: E,
|
|
1072
|
-
strokeWidth: 12,
|
|
1073
|
-
strokeLinecap: "round"
|
|
1074
|
-
})]
|
|
1075
|
-
}), /* @__PURE__ */ J("span", {
|
|
1076
|
-
className: "chart-gauge-share",
|
|
1077
|
-
"aria-hidden": !0,
|
|
1078
|
-
children: c(h)
|
|
1079
|
-
})]
|
|
1080
|
-
}),
|
|
1081
|
-
r !== void 0 && /* @__PURE__ */ J("span", {
|
|
1082
|
-
className: "chart-gauge-label",
|
|
1083
|
-
children: r
|
|
1084
|
-
}),
|
|
1085
|
-
/* @__PURE__ */ J("span", {
|
|
1086
|
-
className: "chart-gauge-of",
|
|
1087
|
-
"aria-hidden": !0,
|
|
1088
|
-
children: T
|
|
1089
|
-
}),
|
|
1090
|
-
/* @__PURE__ */ J(s, { text: w.active === null ? "" : `${T} (${c(h)})` }),
|
|
1091
|
-
w.tooltip(w.active !== null && /* @__PURE__ */ J($, {
|
|
1092
|
-
title: r ?? n,
|
|
1093
|
-
rows: [{
|
|
1094
|
-
key: "v",
|
|
1095
|
-
color: E,
|
|
1096
|
-
label: T,
|
|
1097
|
-
value: c(h)
|
|
1098
|
-
}]
|
|
1099
|
-
}))
|
|
1100
|
-
]
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
// src/components/Charts/LineChart.tsx
|
|
1104
|
-
var Be = 64;
|
|
1105
|
-
function Ve({ data: e, series: t, ariaLabel: n, title: i, area: a = !1, height: o, compact: c = !1, onSelect: u, selected: d = null, ...f }) {
|
|
1106
|
-
let { nf: m, L: h } = x(f), [g, _] = Te(), [y, b] = X(), S = e.length, C = d === null ? -1 : e.findIndex((e) => U(e) === d), T = Q({
|
|
1107
|
-
count: S,
|
|
1108
|
-
pick: (e, t, n) => N(e, n.width, S),
|
|
1109
|
-
anchor: (e, t) => {
|
|
1110
|
-
let n = t.getBoundingClientRect();
|
|
1111
|
-
return {
|
|
1112
|
-
left: n.left + M(e, S, 100) / 100 * n.width - 1,
|
|
1113
|
-
top: n.top,
|
|
1114
|
-
width: 2,
|
|
1115
|
-
height: n.height
|
|
1116
|
-
};
|
|
1117
|
-
},
|
|
1118
|
-
keys: {
|
|
1119
|
-
ArrowUp: 0,
|
|
1120
|
-
ArrowDown: 0
|
|
1121
|
-
},
|
|
1122
|
-
start: C >= 0 ? C : null,
|
|
1123
|
-
onPick: u ? (t) => e[t].selectable !== !1 && u(e[t]) : void 0
|
|
1124
|
-
}), E = e.flatMap((e) => t.map((t) => e.values[t.key] ?? 0));
|
|
1125
|
-
if (!E.some((e) => e > 0)) return /* @__PURE__ */ J(l, {
|
|
1126
|
-
title: i,
|
|
1127
|
-
children: /* @__PURE__ */ J(v, {
|
|
1128
|
-
ariaLabel: n,
|
|
1129
|
-
text: h.empty,
|
|
1130
|
-
compact: c
|
|
1131
|
-
})
|
|
1132
|
-
});
|
|
1133
|
-
let D = (o ?? (c ? 96 : 220)) * b, { max: O, ticks: A } = k(E), j = t.map((t) => ({
|
|
1134
|
-
s: t,
|
|
1135
|
-
points: p(e.map((e) => e.values[t.key] ?? 0), 100, 100, O)
|
|
1136
|
-
})), P = T.active, F = (e) => `${e.fullLabel ?? e.label}: ${t.map((n) => t.length > 1 ? `${n.label} ${m(e.values[n.key] ?? 0)}` : m(e.values[n.key] ?? 0)).join(", ")}`, I = P === null ? null : e[P] ?? null, R = w(S, Math.max(2, Math.min(c ? 4 : 6, Math.floor((_ || 400) / (Be * b))))), B = (e) => `${M(e, S, 100)}%`;
|
|
1137
|
-
return /* @__PURE__ */ J(l, {
|
|
1138
|
-
title: i,
|
|
1139
|
-
children: /* @__PURE__ */ Y("div", {
|
|
1140
|
-
ref: g,
|
|
1141
|
-
className: z(`chart-line${a ? " chart-line--area" : ""}`, c),
|
|
1142
|
-
role: "group",
|
|
1143
|
-
"aria-label": n,
|
|
1144
|
-
children: [
|
|
1145
|
-
/* @__PURE__ */ Y("div", {
|
|
1146
|
-
className: "chart-columns-plot",
|
|
1147
|
-
style: { height: D },
|
|
1148
|
-
children: [!c && /* @__PURE__ */ J("div", {
|
|
1149
|
-
className: "chart-axis-y",
|
|
1150
|
-
"aria-hidden": !0,
|
|
1151
|
-
children: [...A].reverse().map((e) => /* @__PURE__ */ J("span", { children: m(e) }, e))
|
|
1152
|
-
}), /* @__PURE__ */ Y("div", {
|
|
1153
|
-
className: `chart-line-area chart-plot chart-plot--x${u ? " chart-plot--pick" : ""}`,
|
|
1154
|
-
role: u ? void 0 : "img",
|
|
1155
|
-
"aria-label": u ? void 0 : I ? F(I) : n,
|
|
1156
|
-
...T.plotProps,
|
|
1157
|
-
children: [
|
|
1158
|
-
T.pickable && e.map((e, t) => /* @__PURE__ */ J("span", {
|
|
1159
|
-
...T.item(t, {
|
|
1160
|
-
pressed: t === C,
|
|
1161
|
-
disabled: e.selectable === !1
|
|
1162
|
-
}),
|
|
1163
|
-
"aria-label": F(e),
|
|
1164
|
-
className: "chart-line-slot",
|
|
1165
|
-
style: { left: B(t) }
|
|
1166
|
-
}, U(e))),
|
|
1167
|
-
!c && A.slice(1).map((e) => /* @__PURE__ */ J("div", {
|
|
1168
|
-
className: "chart-gridline",
|
|
1169
|
-
style: { bottom: `${e / O * 100}%` },
|
|
1170
|
-
"aria-hidden": !0
|
|
1171
|
-
}, e)),
|
|
1172
|
-
/* @__PURE__ */ Y("svg", {
|
|
1173
|
-
className: "chart-line-svg",
|
|
1174
|
-
viewBox: "0 0 100 100",
|
|
1175
|
-
preserveAspectRatio: "none",
|
|
1176
|
-
width: "100%",
|
|
1177
|
-
height: "100%",
|
|
1178
|
-
"aria-hidden": !0,
|
|
1179
|
-
children: [
|
|
1180
|
-
a && j.map(({ s: e, points: t }) => /* @__PURE__ */ J("path", {
|
|
1181
|
-
d: V(t, 100),
|
|
1182
|
-
fill: L(e.slot),
|
|
1183
|
-
className: "chart-line-fill"
|
|
1184
|
-
}, `a-${e.key}`)),
|
|
1185
|
-
j.map(({ s: e, points: t }) => /* @__PURE__ */ J("path", {
|
|
1186
|
-
d: r(t),
|
|
1187
|
-
fill: "none",
|
|
1188
|
-
stroke: L(e.slot),
|
|
1189
|
-
className: "chart-line-path",
|
|
1190
|
-
vectorEffect: "non-scaling-stroke"
|
|
1191
|
-
}, e.key)),
|
|
1192
|
-
C >= 0 && /* @__PURE__ */ J("line", {
|
|
1193
|
-
className: "chart-line-selected",
|
|
1194
|
-
x1: M(C, S, 100),
|
|
1195
|
-
x2: M(C, S, 100),
|
|
1196
|
-
y1: 0,
|
|
1197
|
-
y2: 100,
|
|
1198
|
-
vectorEffect: "non-scaling-stroke"
|
|
1199
|
-
}),
|
|
1200
|
-
P !== null && /* @__PURE__ */ J("line", {
|
|
1201
|
-
className: "chart-line-crosshair",
|
|
1202
|
-
x1: M(P, S, 100),
|
|
1203
|
-
x2: M(P, S, 100),
|
|
1204
|
-
y1: 0,
|
|
1205
|
-
y2: 100,
|
|
1206
|
-
vectorEffect: "non-scaling-stroke"
|
|
1207
|
-
})
|
|
1208
|
-
]
|
|
1209
|
-
}),
|
|
1210
|
-
[P, C >= 0 ? C : null].map((e, t) => e === null || t === 1 && e === P ? null : j.map(({ s: n, points: r }) => /* @__PURE__ */ J("span", {
|
|
1211
|
-
className: "chart-line-dot",
|
|
1212
|
-
style: {
|
|
1213
|
-
left: B(e),
|
|
1214
|
-
top: `${r[e].y}%`,
|
|
1215
|
-
background: L(n.slot)
|
|
1216
|
-
},
|
|
1217
|
-
"aria-hidden": !0
|
|
1218
|
-
}, `${t}-${n.key}`)))
|
|
1219
|
-
]
|
|
1220
|
-
})]
|
|
1221
|
-
}),
|
|
1222
|
-
/* @__PURE__ */ J("div", {
|
|
1223
|
-
ref: y,
|
|
1224
|
-
className: `chart-line-axis-x${c ? " chart-line-axis-x--compact" : ""}`,
|
|
1225
|
-
"aria-hidden": !0,
|
|
1226
|
-
children: R.map((t) => /* @__PURE__ */ J("span", {
|
|
1227
|
-
style: { left: B(t) },
|
|
1228
|
-
className: t === 0 ? "chart-line-axis-first" : t === S - 1 ? "chart-line-axis-last" : void 0,
|
|
1229
|
-
children: e[t].label
|
|
1230
|
-
}, t))
|
|
1231
|
-
}),
|
|
1232
|
-
/* @__PURE__ */ J(s, { text: I ? F(I) : "" }),
|
|
1233
|
-
T.tooltip(I && /* @__PURE__ */ J($, {
|
|
1234
|
-
title: I.fullLabel ?? I.label,
|
|
1235
|
-
rows: t.map((e) => ({
|
|
1236
|
-
key: e.key,
|
|
1237
|
-
color: L(e.slot),
|
|
1238
|
-
label: e.label,
|
|
1239
|
-
value: m(I.values[e.key] ?? 0)
|
|
1240
|
-
})),
|
|
1241
|
-
note: t.length > 1 ? `${h.total}: ${m(re(I, t))}` : void 0
|
|
1242
|
-
}))
|
|
1243
|
-
]
|
|
1244
|
-
})
|
|
1245
|
-
});
|
|
1246
|
-
}
|
|
1247
|
-
// src/components/Charts/NumberTrend.tsx
|
|
1248
|
-
function He({ value: e, ariaLabel: t, title: n, points: i = [], current: a, previous: l, good: u = "up", slot: d = 1, compact: f = !1, ...p }) {
|
|
1249
|
-
let { nf: g, L: _ } = x(p), v = Q({
|
|
1250
|
-
count: i.length,
|
|
1251
|
-
pick: (e, t, n) => N(e, n.width, i.length),
|
|
1252
|
-
anchor: (e, t) => {
|
|
1253
|
-
let n = t.getBoundingClientRect();
|
|
1254
|
-
return {
|
|
1255
|
-
left: n.left + M(e, i.length, 100) / 100 * n.width - 1,
|
|
1256
|
-
top: n.top,
|
|
1257
|
-
width: 2,
|
|
1258
|
-
height: n.height
|
|
1259
|
-
};
|
|
1260
|
-
},
|
|
1261
|
-
keys: {
|
|
1262
|
-
ArrowUp: 0,
|
|
1263
|
-
ArrowDown: 0
|
|
1264
|
-
}
|
|
1265
|
-
}), y = a ?? i.reduce((e, t) => e + t.value, 0), b = l === void 0 ? null : m(y, l), S = b ? h(b.direction, u) : "neutral", C = b ? b.direction === "up" ? "▲" : b.direction === "down" ? "▼" : "=" : "", w = b ? b.percent === null ? _.deltaNew : c(Math.abs(b.percent)) : "", T = b ? `${b.direction === "up" ? _.deltaUp : b.direction === "down" ? _.deltaDown : _.deltaSame}${b.direction === "same" ? "" : ` ${w}`} ${_.vsPrevious}` : "", E = o(i.map((e) => e.value), 100, 100), D = v.active, O = D === null ? null : i[D] ?? null;
|
|
1266
|
-
return /* @__PURE__ */ Y("div", {
|
|
1267
|
-
className: z("chart-number", f),
|
|
1268
|
-
role: "group",
|
|
1269
|
-
"aria-label": `${t}: ${g(e)}${T ? `, ${T}` : ""}`,
|
|
1270
|
-
children: [
|
|
1271
|
-
n != null && n !== "" && /* @__PURE__ */ J("div", {
|
|
1272
|
-
className: "chart-title",
|
|
1273
|
-
children: n
|
|
1274
|
-
}),
|
|
1275
|
-
/* @__PURE__ */ Y("div", {
|
|
1276
|
-
className: "chart-number-line",
|
|
1277
|
-
"aria-hidden": !0,
|
|
1278
|
-
children: [/* @__PURE__ */ J("span", {
|
|
1279
|
-
className: "chart-number-value",
|
|
1280
|
-
children: g(e)
|
|
1281
|
-
}), b && /* @__PURE__ */ Y("span", {
|
|
1282
|
-
className: "chart-number-delta",
|
|
1283
|
-
"data-tone": S,
|
|
1284
|
-
style: { color: L(S) },
|
|
1285
|
-
children: [
|
|
1286
|
-
C,
|
|
1287
|
-
" ",
|
|
1288
|
-
b.direction === "same" ? c(0) : w
|
|
1289
|
-
]
|
|
1290
|
-
})]
|
|
1291
|
-
}),
|
|
1292
|
-
E.length > 1 && /* @__PURE__ */ Y("div", {
|
|
1293
|
-
className: "chart-number-spark chart-plot chart-plot--x",
|
|
1294
|
-
role: "img",
|
|
1295
|
-
"aria-label": O ? `${O.label}: ${g(O.value)}` : t,
|
|
1296
|
-
...v.plotProps,
|
|
1297
|
-
children: [/* @__PURE__ */ Y("svg", {
|
|
1298
|
-
viewBox: "0 0 100 100",
|
|
1299
|
-
preserveAspectRatio: "none",
|
|
1300
|
-
width: "100%",
|
|
1301
|
-
height: "100%",
|
|
1302
|
-
"aria-hidden": !0,
|
|
1303
|
-
children: [
|
|
1304
|
-
/* @__PURE__ */ J("path", {
|
|
1305
|
-
d: V(E, 100),
|
|
1306
|
-
fill: L(d),
|
|
1307
|
-
className: "chart-line-fill"
|
|
1308
|
-
}),
|
|
1309
|
-
/* @__PURE__ */ J("path", {
|
|
1310
|
-
d: r(E),
|
|
1311
|
-
fill: "none",
|
|
1312
|
-
stroke: L(d),
|
|
1313
|
-
className: "chart-line-path",
|
|
1314
|
-
vectorEffect: "non-scaling-stroke"
|
|
1315
|
-
}),
|
|
1316
|
-
D !== null && /* @__PURE__ */ J("line", {
|
|
1317
|
-
className: "chart-line-crosshair",
|
|
1318
|
-
x1: M(D, i.length, 100),
|
|
1319
|
-
x2: M(D, i.length, 100),
|
|
1320
|
-
y1: 0,
|
|
1321
|
-
y2: 100,
|
|
1322
|
-
vectorEffect: "non-scaling-stroke"
|
|
1323
|
-
})
|
|
1324
|
-
]
|
|
1325
|
-
}), D !== null && E[D] && /* @__PURE__ */ J("span", {
|
|
1326
|
-
className: "chart-line-dot",
|
|
1327
|
-
style: {
|
|
1328
|
-
left: `${E[D].x}%`,
|
|
1329
|
-
top: `${E[D].y}%`,
|
|
1330
|
-
background: L(d)
|
|
1331
|
-
},
|
|
1332
|
-
"aria-hidden": !0
|
|
1333
|
-
})]
|
|
1334
|
-
}),
|
|
1335
|
-
b && /* @__PURE__ */ J("div", {
|
|
1336
|
-
className: "chart-number-note",
|
|
1337
|
-
"aria-hidden": !0,
|
|
1338
|
-
children: _.vsPrevious
|
|
1339
|
-
}),
|
|
1340
|
-
/* @__PURE__ */ J(s, { text: O ? `${O.label}: ${g(O.value)}` : "" }),
|
|
1341
|
-
v.tooltip(O && /* @__PURE__ */ J($, {
|
|
1342
|
-
title: O.label,
|
|
1343
|
-
rows: [{
|
|
1344
|
-
key: "v",
|
|
1345
|
-
color: L(d),
|
|
1346
|
-
label: t,
|
|
1347
|
-
value: g(O.value)
|
|
1348
|
-
}]
|
|
1349
|
-
}))
|
|
1350
|
-
]
|
|
1351
|
-
});
|
|
1352
|
-
}
|
|
1353
|
-
// src/components/Charts/Progress.tsx
|
|
1354
|
-
function Ue({ value: e, total: t, ariaLabel: n, label: r, color: i = 1, compact: a = !1, ...o }) {
|
|
1355
|
-
let { nf: l, L: u } = x(o), d = Q({
|
|
1356
|
-
count: 1,
|
|
1357
|
-
pick: () => 0
|
|
1358
|
-
}), f = t > 0 ? e / t * 100 : 0, p = L(O(i, f)), m = u.ofTotal(l(e), l(t));
|
|
1359
|
-
return /* @__PURE__ */ Y("div", {
|
|
1360
|
-
className: z("chart-progress chart-plot", a),
|
|
1361
|
-
role: "progressbar",
|
|
1362
|
-
"aria-label": n,
|
|
1363
|
-
"aria-valuemin": 0,
|
|
1364
|
-
"aria-valuemax": 100,
|
|
1365
|
-
"aria-valuenow": Math.round(f * 10) / 10,
|
|
1366
|
-
"aria-valuetext": `${l(e)} / ${l(t)} (${c(f)})`,
|
|
1367
|
-
...d.plotProps,
|
|
1368
|
-
children: [
|
|
1369
|
-
r !== void 0 && /* @__PURE__ */ Y("div", {
|
|
1370
|
-
className: "chart-progress-head",
|
|
1371
|
-
children: [/* @__PURE__ */ J("span", {
|
|
1372
|
-
className: "chart-progress-label",
|
|
1373
|
-
children: r
|
|
1374
|
-
}), /* @__PURE__ */ J("span", {
|
|
1375
|
-
className: "chart-progress-share",
|
|
1376
|
-
children: c(f)
|
|
1377
|
-
})]
|
|
1378
|
-
}),
|
|
1379
|
-
/* @__PURE__ */ J("div", {
|
|
1380
|
-
className: "chart-progress-track",
|
|
1381
|
-
children: /* @__PURE__ */ J("div", {
|
|
1382
|
-
className: "chart-progress-fill",
|
|
1383
|
-
style: {
|
|
1384
|
-
width: `${Math.min(100, f)}%`,
|
|
1385
|
-
background: p
|
|
1386
|
-
}
|
|
1387
|
-
})
|
|
1388
|
-
}),
|
|
1389
|
-
/* @__PURE__ */ J(s, { text: d.active === null ? "" : `${m} (${c(f)})` }),
|
|
1390
|
-
d.tooltip(d.active !== null && /* @__PURE__ */ J($, {
|
|
1391
|
-
title: r ?? n,
|
|
1392
|
-
rows: [{
|
|
1393
|
-
key: "v",
|
|
1394
|
-
color: p,
|
|
1395
|
-
label: m,
|
|
1396
|
-
value: c(f)
|
|
1397
|
-
}]
|
|
1398
|
-
}))
|
|
1399
|
-
]
|
|
1400
|
-
});
|
|
1401
|
-
}
|
|
1402
|
-
// src/components/Charts/StackedBar.tsx
|
|
1403
|
-
function We({ slices: e, ariaLabel: t, title: n, compact: r = !1, onLegendCut: i, onSelect: a, selected: o = null, ...u }) {
|
|
1404
|
-
let { nf: d, L: p } = x(u), [m, h] = q(null), [g, _, y] = Fe(e.length, r);
|
|
1405
|
-
ae(() => i?.(e.length - y), [
|
|
1406
|
-
i,
|
|
1407
|
-
e.length,
|
|
1408
|
-
y
|
|
1409
|
-
]);
|
|
1410
|
-
let b = e.filter((e) => e.value > 0), S = (e) => !!a && e.value > 0 && e.selectable !== !1, C = Q({
|
|
1411
|
-
count: b.length,
|
|
1412
|
-
pick: (e, t, n, r) => de(e, xe(r).map((e) => e ? {
|
|
1413
|
-
start: e.left,
|
|
1414
|
-
end: e.left + e.width
|
|
1415
|
-
} : {
|
|
1416
|
-
start: Infinity,
|
|
1417
|
-
end: Infinity
|
|
1418
|
-
})),
|
|
1419
|
-
keys: {
|
|
1420
|
-
ArrowUp: 0,
|
|
1421
|
-
ArrowDown: 0
|
|
1422
|
-
},
|
|
1423
|
-
start: o === null ? null : b.findIndex((e) => e.key === o),
|
|
1424
|
-
onPick: a ? (e) => S(b[e]) && a(b[e]) : void 0
|
|
1425
|
-
}), w = e.reduce((e, t) => e + t.value, 0);
|
|
1426
|
-
if (w === 0) return /* @__PURE__ */ J(l, {
|
|
1427
|
-
title: n,
|
|
1428
|
-
children: /* @__PURE__ */ J(v, {
|
|
1429
|
-
ariaLabel: t,
|
|
1430
|
-
text: p.empty,
|
|
1431
|
-
compact: r
|
|
1432
|
-
})
|
|
1433
|
-
});
|
|
1434
|
-
let T = (e) => f(e, w), E = (e) => `${e.label} ${d(e.value)} (${c(T(e.value))})`, D = C.active === null ? null : b[C.active] ?? null, O = D?.key ?? m ?? o, k = (e) => O !== null && O !== e ? " chart-faded" : "";
|
|
1435
|
-
return /* @__PURE__ */ Y("figure", {
|
|
1436
|
-
className: z("chart-stacked", r),
|
|
1437
|
-
"aria-label": t,
|
|
1438
|
-
children: [
|
|
1439
|
-
n && /* @__PURE__ */ J("figcaption", {
|
|
1440
|
-
className: "chart-title",
|
|
1441
|
-
children: n
|
|
1442
|
-
}),
|
|
1443
|
-
/* @__PURE__ */ J("div", {
|
|
1444
|
-
className: `chart-stacked-bar chart-plot chart-plot--x${a ? " chart-plot--pick" : ""}`,
|
|
1445
|
-
role: a ? void 0 : "img",
|
|
1446
|
-
"aria-label": a ? void 0 : D ? E(D) : `${t}: ${e.map(E).join(", ")}`,
|
|
1447
|
-
...C.plotProps,
|
|
1448
|
-
children: b.map((e, t) => /* @__PURE__ */ J("span", {
|
|
1449
|
-
...C.item(t, {
|
|
1450
|
-
pressed: o === e.key,
|
|
1451
|
-
disabled: !S(e)
|
|
1452
|
-
}),
|
|
1453
|
-
"aria-label": C.pickable ? E(e) : void 0,
|
|
1454
|
-
"aria-hidden": !C.pickable || void 0,
|
|
1455
|
-
className: `chart-stacked-segment${k(e.key)}`,
|
|
1456
|
-
style: {
|
|
1457
|
-
flexGrow: e.value,
|
|
1458
|
-
background: L(e.slot)
|
|
1459
|
-
}
|
|
1460
|
-
}, e.key))
|
|
1461
|
-
}),
|
|
1462
|
-
/* @__PURE__ */ Y("ul", {
|
|
1463
|
-
ref: g,
|
|
1464
|
-
className: "chart-donut-legend chart-stacked-legend",
|
|
1465
|
-
"aria-label": p.legend,
|
|
1466
|
-
children: [e.slice(0, _).map((e) => /* @__PURE__ */ Y("li", {
|
|
1467
|
-
className: `chart-donut-legend-item${S(e) ? " chart-donut-legend-item--hit" : ""}${o === e.key ? " chart-donut-legend-item--on" : ""}${k(e.key)}`,
|
|
1468
|
-
onMouseEnter: () => h(e.key),
|
|
1469
|
-
onMouseLeave: () => h(null),
|
|
1470
|
-
onClick: S(e) ? () => a(e) : void 0,
|
|
1471
|
-
children: [
|
|
1472
|
-
/* @__PURE__ */ J("span", {
|
|
1473
|
-
className: "chart-swatch",
|
|
1474
|
-
style: { background: L(e.slot) },
|
|
1475
|
-
"aria-hidden": !0
|
|
1476
|
-
}),
|
|
1477
|
-
/* @__PURE__ */ J("span", {
|
|
1478
|
-
className: "chart-donut-legend-label",
|
|
1479
|
-
children: e.label
|
|
1480
|
-
}),
|
|
1481
|
-
/* @__PURE__ */ Y("span", {
|
|
1482
|
-
className: "chart-donut-legend-value",
|
|
1483
|
-
children: [
|
|
1484
|
-
d(e.value),
|
|
1485
|
-
" · ",
|
|
1486
|
-
c(T(e.value))
|
|
1487
|
-
]
|
|
1488
|
-
})
|
|
1489
|
-
]
|
|
1490
|
-
}, e.key)), _ < e.length && /* @__PURE__ */ J("li", {
|
|
1491
|
-
className: "chart-donut-legend-more",
|
|
1492
|
-
"data-legend-more": "",
|
|
1493
|
-
children: p.moreValues(d(e.length - _))
|
|
1494
|
-
})]
|
|
1495
|
-
}),
|
|
1496
|
-
/* @__PURE__ */ J(s, { text: D ? E(D) : "" }),
|
|
1497
|
-
C.tooltip(D && /* @__PURE__ */ J($, {
|
|
1498
|
-
rows: [{
|
|
1499
|
-
key: D.key,
|
|
1500
|
-
color: L(D.slot),
|
|
1501
|
-
label: D.label,
|
|
1502
|
-
value: d(D.value)
|
|
1503
|
-
}],
|
|
1504
|
-
note: p.shareOf(c(T(D.value)), d(w))
|
|
1505
|
-
}))
|
|
1506
|
-
]
|
|
1507
|
-
});
|
|
1508
|
-
}
|
|
1509
|
-
// src/components/Charts/Treemap.tsx
|
|
1510
|
-
var Ge = 400;
|
|
1511
|
-
function Ke({ nodes: e, ariaLabel: t, title: n, height: r, compact: i = !1, onSelect: a, selected: o = null, ...d }) {
|
|
1512
|
-
let { nf: p, L: m } = x(d), [h, g] = Te(), _ = g || Ge, [y, b] = X(), S = (r ?? (i ? 120 : 220)) * b, C = e.reduce((e, t) => e + Math.max(0, t.value), 0), w = C > 0 ? u(e, _, S, b) : [], T = w.filter((e) => !e.node.children?.some((e) => e.value > 0)), E = (e) => e.parent ?? e.node, D = (e) => !!a && E(e).selectable !== !1, O = Q({
|
|
1513
|
-
count: T.length,
|
|
1514
|
-
pick: (e, t, n) => fe(e / n.width * _, t / n.height * S, T.map((e) => ({
|
|
1515
|
-
left: e.rect.x,
|
|
1516
|
-
top: e.rect.y,
|
|
1517
|
-
width: e.rect.w,
|
|
1518
|
-
height: e.rect.h
|
|
1519
|
-
}))),
|
|
1520
|
-
start: o === null ? null : T.findIndex((e) => E(e).key === o),
|
|
1521
|
-
onPick: a ? (e) => D(T[e]) && a(E(T[e])) : void 0
|
|
1522
|
-
}), k = O.plotProps.ref, j = W((e) => {
|
|
1523
|
-
h(e), k(e);
|
|
1524
|
-
}, [h, k]);
|
|
1525
|
-
if (C <= 0) return /* @__PURE__ */ J(l, {
|
|
1526
|
-
title: n,
|
|
1527
|
-
children: /* @__PURE__ */ J(v, {
|
|
1528
|
-
ariaLabel: t,
|
|
1529
|
-
text: m.empty,
|
|
1530
|
-
compact: i
|
|
1531
|
-
})
|
|
1532
|
-
});
|
|
1533
|
-
let M = (e) => `${e.parent ? `${e.parent.label} › ` : ""}${e.node.label} ${p(e.node.value)} (${c(f(e.node.value, C))})`, N = (e) => e.parent ? `${e.parent.key}\u0000${e.node.key}` : e.node.key, P = O.active === null ? null : T[O.active] ?? null, F = (e) => ({
|
|
1534
|
-
left: `${e.rect.x / _ * 100}%`,
|
|
1535
|
-
top: `${e.rect.y / S * 100}%`,
|
|
1536
|
-
width: `${e.rect.w / _ * 100}%`,
|
|
1537
|
-
height: `${e.rect.h / S * 100}%`
|
|
1538
|
-
});
|
|
1539
|
-
return /* @__PURE__ */ J(l, {
|
|
1540
|
-
title: n,
|
|
1541
|
-
children: /* @__PURE__ */ Y("div", {
|
|
1542
|
-
ref: y,
|
|
1543
|
-
className: z("chart-treemap", i),
|
|
1544
|
-
role: "group",
|
|
1545
|
-
"aria-label": t,
|
|
1546
|
-
children: [
|
|
1547
|
-
/* @__PURE__ */ J("div", {
|
|
1548
|
-
className: `chart-treemap-box chart-plot${a ? " chart-plot--pick" : ""}`,
|
|
1549
|
-
style: { height: S },
|
|
1550
|
-
role: a ? void 0 : "img",
|
|
1551
|
-
"aria-label": a ? void 0 : P ? M(P) : `${t}: ${T.map(M).join(", ")}`,
|
|
1552
|
-
...O.plotProps,
|
|
1553
|
-
ref: j,
|
|
1554
|
-
children: w.map((e) => {
|
|
1555
|
-
let t = E(e), n = !!e.node.children?.some((e) => e.value > 0), r = e.parent ? e.parent.children.filter((e) => e.value > 0).indexOf(e.node) : 0, i = o !== null && o !== t.key || P !== null && E(P).key !== t.key, a = T.indexOf(e);
|
|
1556
|
-
return /* @__PURE__ */ J("div", {
|
|
1557
|
-
...a >= 0 ? O.item(a, {
|
|
1558
|
-
pressed: o === t.key,
|
|
1559
|
-
disabled: !D(e)
|
|
1560
|
-
}) : {},
|
|
1561
|
-
"aria-label": O.pickable && a >= 0 ? M(e) : void 0,
|
|
1562
|
-
className: `chart-treemap-tile${n ? " chart-treemap-tile--group" : ""}${e.parent ? " chart-treemap-tile--child" : ""}${i ? " chart-faded" : ""}${o === t.key ? " chart-treemap-tile--on" : ""}${P === e ? " chart-treemap-tile--active" : ""}`,
|
|
1563
|
-
style: {
|
|
1564
|
-
...F(e),
|
|
1565
|
-
background: L(t.slot),
|
|
1566
|
-
color: te(t.slot),
|
|
1567
|
-
opacity: e.parent ? A(r) : void 0
|
|
1568
|
-
},
|
|
1569
|
-
"aria-hidden": O.pickable && a >= 0 ? void 0 : !0,
|
|
1570
|
-
children: e.label && /* @__PURE__ */ Y("span", {
|
|
1571
|
-
className: "chart-treemap-label",
|
|
1572
|
-
children: [
|
|
1573
|
-
/* @__PURE__ */ J("span", {
|
|
1574
|
-
className: "chart-treemap-name",
|
|
1575
|
-
children: e.node.label
|
|
1576
|
-
}),
|
|
1577
|
-
" ",
|
|
1578
|
-
!n && /* @__PURE__ */ J("span", {
|
|
1579
|
-
className: "chart-treemap-count",
|
|
1580
|
-
children: p(e.node.value)
|
|
1581
|
-
})
|
|
1582
|
-
]
|
|
1583
|
-
})
|
|
1584
|
-
}, N(e));
|
|
1585
|
-
})
|
|
1586
|
-
}),
|
|
1587
|
-
/* @__PURE__ */ J(s, { text: P ? M(P) : "" }),
|
|
1588
|
-
O.tooltip(P && /* @__PURE__ */ J($, {
|
|
1589
|
-
title: P.parent ? `${P.parent.label} › ${P.node.label}` : P.node.label,
|
|
1590
|
-
rows: [{
|
|
1591
|
-
key: "n",
|
|
1592
|
-
color: L(E(P).slot),
|
|
1593
|
-
label: t,
|
|
1594
|
-
value: p(P.node.value)
|
|
1595
|
-
}],
|
|
1596
|
-
note: m.shareOf(c(f(P.node.value, C)), p(C))
|
|
1597
|
-
}))
|
|
1598
|
-
]
|
|
1599
|
-
})
|
|
1600
|
-
});
|
|
1601
|
-
}
|
|
1602
|
-
// src/components/Charts/ChartView.tsx
|
|
1603
|
-
function qe({ chart: e, ariaLabel: t, compact: n = !1, height: r, size: i, onSelect: a, selected: o = null, linkAs: s, onLegendCut: c, legend: l = !0, ...u }) {
|
|
1604
|
-
let d = {
|
|
1605
|
-
ariaLabel: t,
|
|
1606
|
-
compact: n,
|
|
1607
|
-
...u
|
|
1608
|
-
}, f = a ? (e) => a(e.key ?? e.label) : void 0;
|
|
1609
|
-
switch (e.kind) {
|
|
1610
|
-
case "columns": return /* @__PURE__ */ J(Pe, {
|
|
1611
|
-
data: e.data,
|
|
1612
|
-
series: e.series,
|
|
1613
|
-
mode: e.mode,
|
|
1614
|
-
legend: l && e.series.length > 1,
|
|
1615
|
-
height: r,
|
|
1616
|
-
onSelect: f,
|
|
1617
|
-
selected: o,
|
|
1618
|
-
...d
|
|
1619
|
-
});
|
|
1620
|
-
case "line": return /* @__PURE__ */ J(Ve, {
|
|
1621
|
-
data: e.data,
|
|
1622
|
-
series: e.series,
|
|
1623
|
-
area: e.area,
|
|
1624
|
-
height: r,
|
|
1625
|
-
onSelect: f,
|
|
1626
|
-
selected: o,
|
|
1627
|
-
...d
|
|
1628
|
-
});
|
|
1629
|
-
case "bars": return /* @__PURE__ */ J(Ce, {
|
|
1630
|
-
data: e.data,
|
|
1631
|
-
series: e.series,
|
|
1632
|
-
linkAs: s,
|
|
1633
|
-
onSelect: f,
|
|
1634
|
-
selected: o,
|
|
1635
|
-
...d
|
|
1636
|
-
});
|
|
1637
|
-
case "stacked": return /* @__PURE__ */ J(We, {
|
|
1638
|
-
slices: e.slices,
|
|
1639
|
-
onLegendCut: c,
|
|
1640
|
-
onSelect: f,
|
|
1641
|
-
selected: o,
|
|
1642
|
-
...d
|
|
1643
|
-
});
|
|
1644
|
-
case "donut":
|
|
1645
|
-
case "pie": return /* @__PURE__ */ J(Le, {
|
|
1646
|
-
variant: e.kind,
|
|
1647
|
-
slices: e.slices,
|
|
1648
|
-
size: i,
|
|
1649
|
-
legend: l,
|
|
1650
|
-
onLegendCut: c,
|
|
1651
|
-
onSelect: f,
|
|
1652
|
-
selected: o,
|
|
1653
|
-
...d
|
|
1654
|
-
});
|
|
1655
|
-
case "treemap": return /* @__PURE__ */ J(Ke, {
|
|
1656
|
-
nodes: e.nodes,
|
|
1657
|
-
height: r,
|
|
1658
|
-
onSelect: f,
|
|
1659
|
-
selected: o,
|
|
1660
|
-
...d
|
|
1661
|
-
});
|
|
1662
|
-
case "calendar": return /* @__PURE__ */ J(Oe, {
|
|
1663
|
-
days: e.days,
|
|
1664
|
-
onSelect: a ? (e) => a(e.day) : void 0,
|
|
1665
|
-
selected: o,
|
|
1666
|
-
...d
|
|
1667
|
-
});
|
|
1668
|
-
case "funnel": return /* @__PURE__ */ J(Re, {
|
|
1669
|
-
steps: e.steps,
|
|
1670
|
-
showChange: e.showChange,
|
|
1671
|
-
onSelect: f,
|
|
1672
|
-
selected: o,
|
|
1673
|
-
...d
|
|
1674
|
-
});
|
|
1675
|
-
case "gauge": {
|
|
1676
|
-
let t = e.rows[0];
|
|
1677
|
-
return /* @__PURE__ */ J(ze, {
|
|
1678
|
-
value: t.value,
|
|
1679
|
-
total: t.total,
|
|
1680
|
-
color: t.color,
|
|
1681
|
-
variant: e.variant,
|
|
1682
|
-
label: n ? void 0 : t.label,
|
|
1683
|
-
...d
|
|
1684
|
-
});
|
|
1685
|
-
}
|
|
1686
|
-
case "progress": {
|
|
1687
|
-
let t = e.rows[0];
|
|
1688
|
-
return /* @__PURE__ */ J(Ue, {
|
|
1689
|
-
value: t.value,
|
|
1690
|
-
total: t.total,
|
|
1691
|
-
color: t.color,
|
|
1692
|
-
label: n ? void 0 : t.label,
|
|
1693
|
-
...d
|
|
1694
|
-
});
|
|
1695
|
-
}
|
|
1696
|
-
case "number": return /* @__PURE__ */ J(He, {
|
|
1697
|
-
value: e.value,
|
|
1698
|
-
points: e.points,
|
|
1699
|
-
current: e.current,
|
|
1700
|
-
previous: e.previous,
|
|
1701
|
-
good: e.good,
|
|
1702
|
-
slot: e.slot,
|
|
1703
|
-
...d
|
|
1704
|
-
});
|
|
1705
|
-
}
|
|
1706
|
-
}
|
|
1707
|
-
export { pe as C, he as D, fe as E, de as O, ge as S, _e as T, $ as _, He as a, Q as b, Re as c, ke as d, Oe as f, Ce as g, Te as h, Ue as i, X as k, Le as l, we as m, Ke as n, Ve as o, De as p, We as r, ze as s, qe as t, Pe as u, be as v, ue as w, me as x, xe as y };
|