@agent-factory-platform/ui-kit 0.7.1 → 0.9.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/README.md +22 -0
- package/dist/charts/adapter.js +111 -0
- package/dist/charts/basic.d.ts +2 -0
- package/dist/charts/basic.js +115 -0
- package/dist/charts/chart-tooltip.js +21 -0
- package/dist/charts/event-markers-primitive.d.ts +10 -1
- package/dist/charts/event-markers-primitive.js +116 -0
- package/dist/charts/index.d.ts +1 -0
- package/dist/charts/ohlc-annotations.d.ts +56 -0
- package/dist/charts/ohlc-annotations.js +84 -0
- package/dist/charts/ohlc.d.ts +5 -1
- package/dist/charts/ohlc.js +240 -0
- package/dist/charts/series.js +584 -0
- package/dist/charts/theme.js +35 -0
- package/dist/charts/time-combo.js +17 -0
- package/dist/component-api.js +3 -5
- package/dist/component-api.json.js +9 -0
- package/dist/component-manifest.json.js +9 -0
- package/dist/components/alert.js +35 -0
- package/dist/components/avatar.js +101 -0
- package/dist/components/badge.js +111 -0
- package/dist/components/button-group.js +22 -0
- package/dist/components/button.js +64 -0
- package/dist/components/calendar-period-navigator.js +34 -0
- package/dist/components/card.js +35 -0
- package/dist/components/chart-frame.js +53 -0
- package/dist/components/color-picker.js +155 -0
- package/dist/components/combobox.js +129 -0
- package/dist/components/command-dialog.js +89 -0
- package/dist/components/confirm-dialog.js +57 -0
- package/dist/components/data-table.js +135 -0
- package/dist/components/date-time.js +203 -0
- package/dist/components/disclosure.js +29 -0
- package/dist/components/drawer.js +150 -0
- package/dist/components/dropdown-select.js +191 -0
- package/dist/components/field.js +21 -0
- package/dist/components/floating-window.js +159 -0
- package/dist/components/heading.js +21 -0
- package/dist/components/hover-tip.js +90 -0
- package/dist/components/icon-tip.js +12 -0
- package/dist/components/input-group.js +16 -0
- package/dist/components/input-otp.js +56 -0
- package/dist/components/input.js +44 -0
- package/dist/components/item.js +47 -0
- package/dist/components/kbd.js +18 -0
- package/dist/components/line-chart.js +79 -0
- package/dist/components/listbox.js +33 -0
- package/dist/components/live-value.js +26 -0
- package/dist/components/modal.js +140 -0
- package/dist/components/multi-select.js +54 -0
- package/dist/components/native-select.js +17 -0
- package/dist/components/navigation.js +42 -0
- package/dist/components/page.js +24 -0
- package/dist/components/popover-menu.js +164 -0
- package/dist/components/progress.js +23 -0
- package/dist/components/resizable-pane.js +73 -0
- package/dist/components/scroll-load-more.js +61 -0
- package/dist/components/seg-slider.js +42 -0
- package/dist/components/segmented-control.js +46 -0
- package/dist/components/selection-controls.js +119 -0
- package/dist/components/sidebar.js +23 -0
- package/dist/components/skeleton.js +9 -0
- package/dist/components/slider.js +162 -0
- package/dist/components/sliding-tabs.js +118 -0
- package/dist/components/spinner.js +9 -0
- package/dist/components/spotlight-tour.js +122 -0
- package/dist/components/stat-card.js +23 -0
- package/dist/components/state-view.js +75 -0
- package/dist/components/stats-table.js +17 -0
- package/dist/components/table.js +24 -0
- package/dist/components/tag-pill.d.ts +4 -1
- package/dist/components/tag-pill.js +69 -0
- package/dist/components/theme-editor.js +159 -0
- package/dist/components/toast.js +66 -0
- package/dist/components/toolbar.js +46 -0
- package/dist/components/utility.js +19 -0
- package/dist/components/widget-frame.js +41 -0
- package/dist/components/widget-picker.js +87 -0
- package/dist/components/workspace-grid.js +468 -0
- package/dist/focus-modality.js +3 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.js +228 -5564
- package/dist/lib/cn.js +6 -0
- package/dist/lib/focus-modality.js +16 -0
- package/dist/lib/motion.js +27 -0
- package/dist/lib/viewport.js +13 -0
- package/dist/manifest.js +5 -7
- package/dist/styles.js +1 -1
- package/dist/theme.js +158 -0
- package/package.json +1 -1
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
import { jsx as t, jsxs as p, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { useId as B } from "react";
|
|
3
|
+
import { ResponsiveContainer as C, AreaChart as X, CartesianGrid as T, XAxis as _, YAxis as $, ReferenceArea as V, ReferenceLine as A, Tooltip as D, Area as R, ReferenceDot as U, ComposedChart as E, Bar as K, Line as J, LineChart as tt, Treemap as et } from "recharts";
|
|
4
|
+
import { ChartTooltip as z } from "./chart-tooltip.js";
|
|
5
|
+
import { CHART as e, gridProps as F, axisProps as k, CATEGORICAL as Y } from "./theme.js";
|
|
6
|
+
function q(i) {
|
|
7
|
+
return [...i].sort((h, d) => d.size - h.size).slice(0, Math.min(3, i.length));
|
|
8
|
+
}
|
|
9
|
+
function it(i, h, d) {
|
|
10
|
+
if (!i.length || !h.length || d !== void 0 && !Number.isFinite(d) || [...i, ...h].some((x) => !Number.isFinite(x.price) || !Number.isFinite(x.size) || x.size < 0)) return null;
|
|
11
|
+
const o = [...i].sort((x, M) => M.price - x.price), r = [...h].sort((x, M) => x.price - M.price);
|
|
12
|
+
let c = 0, l = 0;
|
|
13
|
+
const a = o.map((x) => ({ price: x.price, bid: c += x.size, size: x.size })), s = r.map((x) => ({ price: x.price, ask: l += x.size, size: x.size })), u = o[0].price, m = r[0].price, n = d ?? (u + m) / 2, v = a[a.length - 1].price, b = s[s.length - 1].price, y = Math.max(n - v, b - n, Number.EPSILON), f = [n - y, n + y], g = [
|
|
14
|
+
{ price: f[0], bid: c },
|
|
15
|
+
...a.reverse(),
|
|
16
|
+
{ price: n, bid: 0 },
|
|
17
|
+
{ price: n, ask: 0 },
|
|
18
|
+
...s,
|
|
19
|
+
{ price: f[1], ask: l }
|
|
20
|
+
];
|
|
21
|
+
return {
|
|
22
|
+
center: n,
|
|
23
|
+
bestBid: u,
|
|
24
|
+
bestAsk: m,
|
|
25
|
+
data: g,
|
|
26
|
+
domain: f,
|
|
27
|
+
bidTotal: c,
|
|
28
|
+
askTotal: l,
|
|
29
|
+
spread: m - u,
|
|
30
|
+
bidWalls: q(a),
|
|
31
|
+
askWalls: q(s)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function mt({ bids: i, asks: h, mid: d, height: o = 280, valueFormat: r = (m) => m.toLocaleString(), sizeFormat: c = (m) => m.toLocaleString(void 0, { maximumFractionDigits: 2 }), bidLabel: l = "Bid", askLabel: a = "Ask", spreadLabel: s = "Spread", ariaLabel: u = "Cumulative depth" }) {
|
|
35
|
+
const m = B().replace(/:/g, ""), n = it(i, h, d);
|
|
36
|
+
if (!n) return /* @__PURE__ */ t("div", { className: "grid h-72 place-items-center text-graphite", children: "-" });
|
|
37
|
+
const v = n.bidTotal + n.askTotal, b = v > 0 ? n.bidTotal / v : 0.5, y = 1 - b;
|
|
38
|
+
return /* @__PURE__ */ p("div", { role: "img", "aria-label": u, className: "flex min-w-0 flex-col", style: { height: o }, children: [
|
|
39
|
+
/* @__PURE__ */ p("div", { className: "mb-2 shrink-0 rounded-lg border border-border/70 bg-surface-muted/55 px-3 py-2", children: [
|
|
40
|
+
/* @__PURE__ */ p("div", { className: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-2", children: [
|
|
41
|
+
/* @__PURE__ */ p("div", { className: "min-w-0", children: [
|
|
42
|
+
/* @__PURE__ */ p("span", { className: "inline-flex items-center gap-1.5 text-micro uppercase tracking-[0.04em] text-graphite", children: [
|
|
43
|
+
/* @__PURE__ */ t("span", { className: "size-1.5 rounded-full bg-up shadow-[0_0_8px_var(--color-up)]", "aria-hidden": !0 }),
|
|
44
|
+
l
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ p("div", { className: "mt-0.5 flex min-w-0 items-baseline gap-1.5 font-data tabular-nums", children: [
|
|
47
|
+
/* @__PURE__ */ t("strong", { className: "truncate text-data text-up", children: r(n.bestBid) }),
|
|
48
|
+
/* @__PURE__ */ t("span", { className: "truncate text-micro text-graphite", children: c(n.bidTotal) })
|
|
49
|
+
] })
|
|
50
|
+
] }),
|
|
51
|
+
/* @__PURE__ */ p("div", { className: "min-w-[6.75rem] rounded-md bg-surface-raised/80 px-2.5 py-1 text-center shadow-subtle ring-1 ring-border/70", children: [
|
|
52
|
+
/* @__PURE__ */ t("span", { className: "block text-micro uppercase tracking-[0.04em] text-graphite", children: s }),
|
|
53
|
+
/* @__PURE__ */ t("strong", { className: "mt-0.5 block font-data text-caption tabular-nums text-ink", children: r(n.spread) })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ p("div", { className: "min-w-0 text-right", children: [
|
|
56
|
+
/* @__PURE__ */ p("span", { className: "inline-flex items-center gap-1.5 text-micro uppercase tracking-[0.04em] text-graphite", children: [
|
|
57
|
+
a,
|
|
58
|
+
/* @__PURE__ */ t("span", { className: "size-1.5 rounded-full bg-down shadow-[0_0_8px_var(--color-down)]", "aria-hidden": !0 })
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ p("div", { className: "mt-0.5 flex min-w-0 items-baseline justify-end gap-1.5 font-data tabular-nums", children: [
|
|
61
|
+
/* @__PURE__ */ t("span", { className: "truncate text-micro text-graphite", children: c(n.askTotal) }),
|
|
62
|
+
/* @__PURE__ */ t("strong", { className: "truncate text-data text-down", children: r(n.bestAsk) })
|
|
63
|
+
] })
|
|
64
|
+
] })
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ p("div", { "data-testid": "depth-imbalance", className: "mt-2 grid h-1.5 gap-0.5 overflow-hidden rounded-indicator bg-surface-canvas", style: { gridTemplateColumns: `${b}fr ${y}fr` }, "aria-hidden": !0, children: [
|
|
67
|
+
/* @__PURE__ */ t("span", { className: "rounded-l-indicator bg-up" }),
|
|
68
|
+
/* @__PURE__ */ t("span", { className: "rounded-r-indicator bg-down" })
|
|
69
|
+
] })
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-hidden rounded-lg bg-[radial-gradient(circle_at_50%_0,var(--color-surface-muted),transparent_52%)] ring-1 ring-border/40", children: /* @__PURE__ */ t(C, { width: "100%", height: "100%", children: /* @__PURE__ */ p(X, { data: n.data, margin: { top: 12, right: 8, left: 8, bottom: 2 }, accessibilityLayer: !1, tabIndex: -1, className: "outline-none", children: [
|
|
72
|
+
/* @__PURE__ */ p("defs", { children: [
|
|
73
|
+
/* @__PURE__ */ p("linearGradient", { id: `${m}-bid`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
74
|
+
/* @__PURE__ */ t("stop", { offset: "0%", stopColor: e.up, stopOpacity: 0.5 }),
|
|
75
|
+
/* @__PURE__ */ t("stop", { offset: "55%", stopColor: e.up, stopOpacity: 0.16 }),
|
|
76
|
+
/* @__PURE__ */ t("stop", { offset: "100%", stopColor: e.up, stopOpacity: 0.025 })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ p("linearGradient", { id: `${m}-ask`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
79
|
+
/* @__PURE__ */ t("stop", { offset: "0%", stopColor: e.down, stopOpacity: 0.5 }),
|
|
80
|
+
/* @__PURE__ */ t("stop", { offset: "55%", stopColor: e.down, stopOpacity: 0.16 }),
|
|
81
|
+
/* @__PURE__ */ t("stop", { offset: "100%", stopColor: e.down, stopOpacity: 0.025 })
|
|
82
|
+
] })
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ t(T, { ...F }),
|
|
85
|
+
/* @__PURE__ */ t(_, { dataKey: "price", type: "number", domain: n.domain, allowDataOverflow: !0, ...k, tickFormatter: r, minTickGap: 52 }),
|
|
86
|
+
/* @__PURE__ */ t($, { orientation: "right", ...k, width: 58, tickFormatter: (f) => c(Number(f)) }),
|
|
87
|
+
/* @__PURE__ */ t(V, { x1: n.bestBid, x2: n.bestAsk, fill: e.ink, fillOpacity: 0.055, strokeOpacity: 0 }),
|
|
88
|
+
/* @__PURE__ */ t(A, { x: n.bestBid, stroke: e.up, strokeOpacity: 0.32, strokeDasharray: "2 4" }),
|
|
89
|
+
/* @__PURE__ */ t(A, { x: n.bestAsk, stroke: e.down, strokeOpacity: 0.32, strokeDasharray: "2 4" }),
|
|
90
|
+
/* @__PURE__ */ t(A, { x: n.center, stroke: e.ink, strokeOpacity: 0.66, strokeDasharray: "3 3" }),
|
|
91
|
+
/* @__PURE__ */ t(D, { content: /* @__PURE__ */ t(z, { labelFormat: (f) => r(Number(f)), valueFormat: (f) => c(Number(f)) }) }),
|
|
92
|
+
/* @__PURE__ */ t(R, { type: "stepAfter", dataKey: "bid", name: l, stroke: e.up, strokeWidth: 2, fill: `url(#${m}-bid)`, dot: !1, activeDot: { r: 3, strokeWidth: 1, stroke: e.surface, fill: e.up }, connectNulls: !1, isAnimationActive: !1 }),
|
|
93
|
+
/* @__PURE__ */ t(R, { type: "stepBefore", dataKey: "ask", name: a, stroke: e.down, strokeWidth: 2, fill: `url(#${m}-ask)`, dot: !1, activeDot: { r: 3, strokeWidth: 1, stroke: e.surface, fill: e.down }, connectNulls: !1, isAnimationActive: !1 }),
|
|
94
|
+
n.bidWalls.map((f) => /* @__PURE__ */ t(U, { x: f.price, y: f.bid, r: 2.75, fill: e.up, stroke: e.surface, strokeWidth: 1 }, `bid-wall-${f.price}`)),
|
|
95
|
+
n.askWalls.map((f) => /* @__PURE__ */ t(U, { x: f.price, y: f.ask, r: 2.75, fill: e.down, stroke: e.surface, strokeWidth: 1 }, `ask-wall-${f.price}`))
|
|
96
|
+
] }) }) })
|
|
97
|
+
] });
|
|
98
|
+
}
|
|
99
|
+
function ht({
|
|
100
|
+
data: i,
|
|
101
|
+
positiveLabel: h,
|
|
102
|
+
negativeLabel: d,
|
|
103
|
+
positiveTone: o = "up",
|
|
104
|
+
negativeTone: r = "down",
|
|
105
|
+
orientation: c = "vertical",
|
|
106
|
+
numericAxis: l = !1,
|
|
107
|
+
reference: a,
|
|
108
|
+
height: s = 320,
|
|
109
|
+
axisFormat: u = String,
|
|
110
|
+
valueFormat: m = String,
|
|
111
|
+
ariaLabel: n
|
|
112
|
+
}) {
|
|
113
|
+
const v = B().replace(/:/g, ""), b = c === "horizontal", y = o === "down" ? e.down : o === "blue" ? e.blue : e.up, f = r === "up" ? e.up : r === "blue" ? e.blue : e.down, g = Math.max(1, ...i.flatMap((w) => [Math.abs(w.positive), Math.abs(w.negative)])) * 1.08, x = [-g, -g / 2, 0, g / 2, g], M = i.map((w) => ({
|
|
114
|
+
...w,
|
|
115
|
+
axis: l ? Number(w.label) : w.label,
|
|
116
|
+
positive: Math.abs(w.positive),
|
|
117
|
+
negative: -Math.abs(w.negative)
|
|
118
|
+
})), O = {
|
|
119
|
+
...k,
|
|
120
|
+
domain: [-g, g],
|
|
121
|
+
ticks: x,
|
|
122
|
+
tickFormatter: (w) => m(Math.abs(w))
|
|
123
|
+
}, I = {
|
|
124
|
+
...k,
|
|
125
|
+
dataKey: "axis",
|
|
126
|
+
tickFormatter: u
|
|
127
|
+
};
|
|
128
|
+
return /* @__PURE__ */ t("div", { role: n ? "img" : void 0, "aria-label": n, style: { height: s }, className: "w-full min-w-0 overflow-visible [&_.recharts-surface]:overflow-visible [&_.recharts-surface]:outline-none", children: /* @__PURE__ */ t(C, { width: "100%", height: "100%", children: /* @__PURE__ */ p(E, { data: M, layout: b ? "vertical" : "horizontal", stackOffset: "sign", margin: { top: 12, right: 12, left: 8, bottom: 2 }, accessibilityLayer: !1, tabIndex: -1, children: [
|
|
129
|
+
/* @__PURE__ */ p("defs", { children: [
|
|
130
|
+
/* @__PURE__ */ p("linearGradient", { id: `${v}-positive-v`, x1: "0", y1: "1", x2: "0", y2: "0", children: [
|
|
131
|
+
/* @__PURE__ */ t("stop", { offset: "0%", stopColor: y, stopOpacity: 0.35 }),
|
|
132
|
+
/* @__PURE__ */ t("stop", { offset: "100%", stopColor: y, stopOpacity: 0.92 })
|
|
133
|
+
] }),
|
|
134
|
+
/* @__PURE__ */ p("linearGradient", { id: `${v}-negative-v`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
135
|
+
/* @__PURE__ */ t("stop", { offset: "0%", stopColor: f, stopOpacity: 0.35 }),
|
|
136
|
+
/* @__PURE__ */ t("stop", { offset: "100%", stopColor: f, stopOpacity: 0.92 })
|
|
137
|
+
] }),
|
|
138
|
+
/* @__PURE__ */ p("linearGradient", { id: `${v}-positive-h`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
139
|
+
/* @__PURE__ */ t("stop", { offset: "0%", stopColor: y, stopOpacity: 0.35 }),
|
|
140
|
+
/* @__PURE__ */ t("stop", { offset: "100%", stopColor: y, stopOpacity: 0.92 })
|
|
141
|
+
] }),
|
|
142
|
+
/* @__PURE__ */ p("linearGradient", { id: `${v}-negative-h`, x1: "1", y1: "0", x2: "0", y2: "0", children: [
|
|
143
|
+
/* @__PURE__ */ t("stop", { offset: "0%", stopColor: f, stopOpacity: 0.35 }),
|
|
144
|
+
/* @__PURE__ */ t("stop", { offset: "100%", stopColor: f, stopOpacity: 0.92 })
|
|
145
|
+
] })
|
|
146
|
+
] }),
|
|
147
|
+
/* @__PURE__ */ t(T, { ...F, vertical: b, horizontal: !b }),
|
|
148
|
+
b ? /* @__PURE__ */ p(L, { children: [
|
|
149
|
+
/* @__PURE__ */ t(_, { type: "number", ...O }),
|
|
150
|
+
/* @__PURE__ */ t($, { type: "category", width: 84, ...I }),
|
|
151
|
+
/* @__PURE__ */ t(A, { x: 0, stroke: e.axis }),
|
|
152
|
+
a && /* @__PURE__ */ t(A, { y: l ? Number(a.value) : a.value, stroke: e.warning, strokeWidth: 1.5, strokeDasharray: "5 3", label: { value: a.label, position: "insideTopRight", fill: e.warning, fontSize: 10, fontFamily: e.font } })
|
|
153
|
+
] }) : /* @__PURE__ */ p(L, { children: [
|
|
154
|
+
/* @__PURE__ */ t(_, { type: l ? "number" : "category", domain: l ? ["dataMin", "dataMax"] : void 0, ...I, minTickGap: 28 }),
|
|
155
|
+
/* @__PURE__ */ t($, { type: "number", width: 62, ...O }),
|
|
156
|
+
/* @__PURE__ */ t(A, { y: 0, stroke: e.axis }),
|
|
157
|
+
a && /* @__PURE__ */ t(A, { x: l ? Number(a.value) : a.value, stroke: e.warning, strokeWidth: 1.5, strokeDasharray: "5 3", label: { value: a.label, position: "insideTop", fill: e.warning, fontSize: 10, fontFamily: e.font } })
|
|
158
|
+
] }),
|
|
159
|
+
/* @__PURE__ */ t(D, { cursor: { fill: e.dove, fillOpacity: 0.08 }, content: /* @__PURE__ */ t(z, { valueFormat: (w) => m(Math.abs(Number(w))), labelFormat: u }) }),
|
|
160
|
+
/* @__PURE__ */ t(K, { dataKey: "positive", name: h, fill: `url(#${v}-positive-${b ? "h" : "v"})`, stackId: "direction", maxBarSize: b ? 24 : 18, radius: b ? [0, 4, 4, 0] : [4, 4, 0, 0], isAnimationActive: !1 }),
|
|
161
|
+
/* @__PURE__ */ t(K, { dataKey: "negative", name: d, fill: `url(#${v}-negative-${b ? "h" : "v"})`, stackId: "direction", maxBarSize: b ? 24 : 18, radius: b ? [4, 0, 0, 4] : [0, 0, 4, 4], isAnimationActive: !1 })
|
|
162
|
+
] }) }) });
|
|
163
|
+
}
|
|
164
|
+
function pt({ data: i, primaryLabel: h, secondaryLabel: d, primaryFormat: o = String, secondaryFormat: r = String, labelFormat: c = String, height: l = 320, ariaLabel: a }) {
|
|
165
|
+
const s = B().replace(/:/g, ""), u = G(i.map((n) => n.primary), !1), m = G(i.map((n) => n.secondary), !1);
|
|
166
|
+
return /* @__PURE__ */ t("div", { role: a ? "img" : void 0, "aria-label": a, style: { height: l }, className: "w-full min-w-0 overflow-visible [&_.recharts-surface]:overflow-visible [&_.recharts-surface]:outline-none", children: /* @__PURE__ */ t(C, { width: "100%", height: "100%", children: /* @__PURE__ */ p(E, { data: i, margin: { top: 10, right: 8, left: 2, bottom: 0 }, accessibilityLayer: !1, tabIndex: -1, children: [
|
|
167
|
+
/* @__PURE__ */ t("defs", { children: /* @__PURE__ */ p("linearGradient", { id: `${s}-primary`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
168
|
+
/* @__PURE__ */ t("stop", { offset: "0%", stopColor: e.up, stopOpacity: 0.22 }),
|
|
169
|
+
/* @__PURE__ */ t("stop", { offset: "100%", stopColor: e.up, stopOpacity: 0.02 })
|
|
170
|
+
] }) }),
|
|
171
|
+
/* @__PURE__ */ t(T, { ...F }),
|
|
172
|
+
/* @__PURE__ */ t(_, { dataKey: "label", type: "number", scale: "time", domain: ["dataMin", "dataMax"], ...k, tickFormatter: c, minTickGap: 64 }),
|
|
173
|
+
/* @__PURE__ */ t($, { yAxisId: "primary", ...k, width: W(u, o), tickFormatter: o, domain: u }),
|
|
174
|
+
/* @__PURE__ */ t($, { yAxisId: "secondary", orientation: "right", ...k, width: W(m, r), tickFormatter: r, domain: m }),
|
|
175
|
+
/* @__PURE__ */ t(D, { content: /* @__PURE__ */ t(z, { labelFormat: c, valueFormat: (n, v) => v === d ? r(n) : o(n) }) }),
|
|
176
|
+
/* @__PURE__ */ t(R, { yAxisId: "primary", type: "monotone", dataKey: "primary", name: h, stroke: e.up, strokeWidth: 1.75, fill: `url(#${s}-primary)`, dot: !1, activeDot: { r: 3 }, isAnimationActive: !1 }),
|
|
177
|
+
/* @__PURE__ */ t(J, { yAxisId: "secondary", type: "monotone", dataKey: "secondary", name: d, stroke: e.blue, strokeWidth: 1.75, dot: !1, activeDot: { r: 3 }, isAnimationActive: !1 })
|
|
178
|
+
] }) }) });
|
|
179
|
+
}
|
|
180
|
+
function ft({ data: i, primaryLabel: h, secondaryLabel: d, primaryFormat: o = String, secondaryFormat: r = String, labelFormat: c = String, height: l = 320, ariaLabel: a }) {
|
|
181
|
+
const s = G(i.map((m) => m.primary), !0), u = G(i.map((m) => m.secondary), !0);
|
|
182
|
+
return /* @__PURE__ */ t("div", { role: a ? "img" : void 0, "aria-label": a, style: { height: l }, className: "w-full min-w-0 overflow-visible [&_.recharts-surface]:overflow-visible [&_.recharts-surface]:outline-none", children: /* @__PURE__ */ t(C, { width: "100%", height: "100%", children: /* @__PURE__ */ p(E, { data: i, margin: { top: 10, right: 8, left: 2, bottom: 0 }, accessibilityLayer: !1, tabIndex: -1, children: [
|
|
183
|
+
/* @__PURE__ */ t(T, { ...F }),
|
|
184
|
+
/* @__PURE__ */ t(_, { dataKey: "label", ...k, tickFormatter: c }),
|
|
185
|
+
/* @__PURE__ */ t($, { yAxisId: "primary", ...k, width: W(s, o), tickFormatter: o, domain: s }),
|
|
186
|
+
/* @__PURE__ */ t($, { yAxisId: "secondary", orientation: "right", ...k, width: W(u, r), tickFormatter: r, domain: u }),
|
|
187
|
+
/* @__PURE__ */ t(D, { cursor: { fill: e.dove, fillOpacity: 0.08 }, content: /* @__PURE__ */ t(z, { labelFormat: c, valueFormat: (m, n) => n === d ? r(m) : o(m) }) }),
|
|
188
|
+
/* @__PURE__ */ t(K, { yAxisId: "primary", dataKey: "primary", name: h, fill: e.blue, fillOpacity: 0.78, maxBarSize: 32, radius: [4, 4, 0, 0], isAnimationActive: !1 }),
|
|
189
|
+
/* @__PURE__ */ t(K, { yAxisId: "secondary", dataKey: "secondary", name: d, fill: e.up, fillOpacity: 0.78, maxBarSize: 32, radius: [4, 4, 0, 0], isAnimationActive: !1 })
|
|
190
|
+
] }) }) });
|
|
191
|
+
}
|
|
192
|
+
function ut({ data: i, primaryLabel: h, secondaryLabel: d, valueFormat: o = String, labelFormat: r = String, height: c = 320, ariaLabel: l }) {
|
|
193
|
+
const a = B().replace(/:/g, ""), s = Math.max(1, ...i.flatMap((u) => [u.primary, u.secondary])) * 1.08;
|
|
194
|
+
return /* @__PURE__ */ t("div", { role: l ? "img" : void 0, "aria-label": l, style: { height: c }, className: "w-full min-w-0 overflow-visible [&_.recharts-surface]:overflow-visible [&_.recharts-surface]:outline-none", children: /* @__PURE__ */ t(C, { width: "100%", height: "100%", children: /* @__PURE__ */ p(E, { data: i, margin: { top: 10, right: 8, left: 2, bottom: 0 }, accessibilityLayer: !1, tabIndex: -1, children: [
|
|
195
|
+
/* @__PURE__ */ p("defs", { children: [
|
|
196
|
+
/* @__PURE__ */ p("linearGradient", { id: `${a}-primary`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
197
|
+
/* @__PURE__ */ t("stop", { offset: "0%", stopColor: e.up, stopOpacity: 0.9 }),
|
|
198
|
+
/* @__PURE__ */ t("stop", { offset: "100%", stopColor: e.up, stopOpacity: 0.34 })
|
|
199
|
+
] }),
|
|
200
|
+
/* @__PURE__ */ p("linearGradient", { id: `${a}-secondary`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
201
|
+
/* @__PURE__ */ t("stop", { offset: "0%", stopColor: e.down, stopOpacity: 0.9 }),
|
|
202
|
+
/* @__PURE__ */ t("stop", { offset: "100%", stopColor: e.down, stopOpacity: 0.34 })
|
|
203
|
+
] })
|
|
204
|
+
] }),
|
|
205
|
+
/* @__PURE__ */ t(T, { ...F }),
|
|
206
|
+
/* @__PURE__ */ t(_, { dataKey: "label", ...k, tickFormatter: r }),
|
|
207
|
+
/* @__PURE__ */ t($, { ...k, width: W([0, s], o), tickFormatter: o, domain: [0, s] }),
|
|
208
|
+
/* @__PURE__ */ t(D, { cursor: { fill: e.dove, fillOpacity: 0.08 }, content: /* @__PURE__ */ t(z, { labelFormat: r, valueFormat: o }) }),
|
|
209
|
+
/* @__PURE__ */ t(K, { dataKey: "primary", name: h, fill: `url(#${a}-primary)`, maxBarSize: 32, radius: [4, 4, 0, 0], isAnimationActive: !1 }),
|
|
210
|
+
/* @__PURE__ */ t(K, { dataKey: "secondary", name: d, fill: `url(#${a}-secondary)`, maxBarSize: 32, radius: [4, 4, 0, 0], isAnimationActive: !1 })
|
|
211
|
+
] }) }) });
|
|
212
|
+
}
|
|
213
|
+
function Q({ markers: i }) {
|
|
214
|
+
return i.map((h) => /* @__PURE__ */ t(
|
|
215
|
+
U,
|
|
216
|
+
{
|
|
217
|
+
x: h.timestamp,
|
|
218
|
+
y: h.value,
|
|
219
|
+
r: 2.75,
|
|
220
|
+
fill: e.surface,
|
|
221
|
+
stroke: h.tone === "down" ? e.down : e.up,
|
|
222
|
+
strokeWidth: 1.6,
|
|
223
|
+
ifOverflow: "hidden"
|
|
224
|
+
},
|
|
225
|
+
h.id
|
|
226
|
+
));
|
|
227
|
+
}
|
|
228
|
+
function W(i, h) {
|
|
229
|
+
const d = [i[0], i[1], (i[0] + i[1]) / 2];
|
|
230
|
+
let o = 4;
|
|
231
|
+
for (const r of d)
|
|
232
|
+
Number.isFinite(r) && (o = Math.max(o, String(h(r)).length));
|
|
233
|
+
return Math.min(120, Math.max(84, Math.round(o * 8.2) + 24));
|
|
234
|
+
}
|
|
235
|
+
function G(i, h) {
|
|
236
|
+
if (!i.length) return [0, 1];
|
|
237
|
+
const d = Math.min(...i), o = Math.max(...i);
|
|
238
|
+
if (!h) {
|
|
239
|
+
const u = Math.max(o - d, Math.abs(o) * 0.02, 1) * 0.12;
|
|
240
|
+
return [d - u, o + u];
|
|
241
|
+
}
|
|
242
|
+
const r = Math.min(0, d), c = Math.max(0, o), l = c - r, a = Math.max(1, l > 0 ? l * 0.12 : Math.abs(c || r) * 0.1);
|
|
243
|
+
return [r >= 0 ? 0 : r - a, c + a];
|
|
244
|
+
}
|
|
245
|
+
function yt({
|
|
246
|
+
data: i,
|
|
247
|
+
height: h = 280,
|
|
248
|
+
name: d = "Value",
|
|
249
|
+
valueFormat: o = String,
|
|
250
|
+
timestampFormat: r = String,
|
|
251
|
+
tooltipContent: c,
|
|
252
|
+
markers: l = [],
|
|
253
|
+
tone: a = "signed",
|
|
254
|
+
referenceValue: s,
|
|
255
|
+
includeZero: u = !0,
|
|
256
|
+
showLastDot: m = !1,
|
|
257
|
+
onActiveValueChange: n,
|
|
258
|
+
testId: v,
|
|
259
|
+
ariaLabel: b
|
|
260
|
+
}) {
|
|
261
|
+
const y = B().replace(/:/g, ""), f = [...i.map((N) => N.value), s].filter((N) => typeof N == "number" && Number.isFinite(N)), g = G(f, u), x = g[0], M = g[1], O = x >= 0 ? 1 : M <= 0 ? 0 : M / (M - x || 1), I = Math.max(...f, 0) - Math.min(...f, 0), w = u && i.length > 0 && Math.abs(i[0].value) <= Math.max(1, Math.abs(I) * 5e-3), P = W(g, o);
|
|
262
|
+
return /* @__PURE__ */ t(
|
|
263
|
+
"div",
|
|
264
|
+
{
|
|
265
|
+
"data-testid": v,
|
|
266
|
+
role: b ? "img" : void 0,
|
|
267
|
+
"aria-label": b,
|
|
268
|
+
style: { height: h },
|
|
269
|
+
className: "w-full min-w-0 overflow-visible [&_.recharts-surface]:overflow-visible [&_.recharts-surface]:outline-none [&_.recharts-wrapper]:overflow-visible [&_.recharts-wrapper]:outline-none [&_.recharts-yAxis_.recharts-cartesian-axis-tick-value]:overflow-visible",
|
|
270
|
+
children: /* @__PURE__ */ t(C, { width: "100%", height: "100%", children: /* @__PURE__ */ p(
|
|
271
|
+
X,
|
|
272
|
+
{
|
|
273
|
+
data: i,
|
|
274
|
+
margin: { top: 8, right: 8, left: 2, bottom: 0 },
|
|
275
|
+
accessibilityLayer: !1,
|
|
276
|
+
tabIndex: -1,
|
|
277
|
+
onMouseMove: (N) => {
|
|
278
|
+
if (!n) return;
|
|
279
|
+
const S = N == null ? void 0 : N.activeTooltipIndex, j = typeof S == "number" ? S : Number(S);
|
|
280
|
+
n(Number.isFinite(j) && i[j] ? i[j].value : null);
|
|
281
|
+
},
|
|
282
|
+
onMouseLeave: () => n == null ? void 0 : n(null),
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ p("defs", { children: [
|
|
285
|
+
/* @__PURE__ */ p("linearGradient", { id: `${y}-signed-stroke`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
286
|
+
/* @__PURE__ */ t("stop", { offset: 0, stopColor: e.up }),
|
|
287
|
+
/* @__PURE__ */ t("stop", { offset: O, stopColor: e.up }),
|
|
288
|
+
/* @__PURE__ */ t("stop", { offset: O, stopColor: e.down }),
|
|
289
|
+
/* @__PURE__ */ t("stop", { offset: 1, stopColor: e.down })
|
|
290
|
+
] }),
|
|
291
|
+
/* @__PURE__ */ p("linearGradient", { id: `${y}-signed-fill`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
292
|
+
/* @__PURE__ */ t("stop", { offset: 0, stopColor: e.up, stopOpacity: 0.3 }),
|
|
293
|
+
/* @__PURE__ */ t("stop", { offset: O, stopColor: e.up, stopOpacity: 0.08 }),
|
|
294
|
+
/* @__PURE__ */ t("stop", { offset: O, stopColor: e.down, stopOpacity: 0.08 }),
|
|
295
|
+
/* @__PURE__ */ t("stop", { offset: 1, stopColor: e.down, stopOpacity: 0.3 })
|
|
296
|
+
] }),
|
|
297
|
+
/* @__PURE__ */ t("pattern", { id: `${y}-signed-hatch`, patternUnits: "userSpaceOnUse", width: 5, height: 5, patternTransform: "rotate(45)", children: /* @__PURE__ */ t("line", { x1: 0, y1: 0, x2: 0, y2: 5, stroke: e.ink, strokeWidth: 1.1, strokeOpacity: 0.14 }) })
|
|
298
|
+
] }),
|
|
299
|
+
/* @__PURE__ */ t(T, { ...F }),
|
|
300
|
+
/* @__PURE__ */ t(_, { dataKey: "timestamp", type: "number", scale: "time", domain: ["dataMin", "dataMax"], ...k, tickFormatter: r, minTickGap: 64 }),
|
|
301
|
+
/* @__PURE__ */ t(
|
|
302
|
+
$,
|
|
303
|
+
{
|
|
304
|
+
...k,
|
|
305
|
+
domain: g,
|
|
306
|
+
width: P,
|
|
307
|
+
tickFormatter: o,
|
|
308
|
+
tick: { ...k.tick, width: P },
|
|
309
|
+
interval: "preserveStartEnd"
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
a === "signed" && u && f.some((N) => N < 0) && /* @__PURE__ */ t(A, { y: 0, stroke: e.axis, strokeDasharray: "3 5" }),
|
|
313
|
+
s != null && /* @__PURE__ */ t(A, { y: s, stroke: e.axis, strokeDasharray: "3 5" }),
|
|
314
|
+
/* @__PURE__ */ t(D, { content: c ?? /* @__PURE__ */ t(z, { valueFormat: o, labelFormat: r }) }),
|
|
315
|
+
/* @__PURE__ */ t(
|
|
316
|
+
R,
|
|
317
|
+
{
|
|
318
|
+
type: "monotone",
|
|
319
|
+
dataKey: "value",
|
|
320
|
+
name: d,
|
|
321
|
+
stroke: a === "blue" ? e.blue : a === "up" ? e.up : a === "warning" ? e.warning : `url(#${y}-signed-stroke)`,
|
|
322
|
+
strokeWidth: 1.8,
|
|
323
|
+
fill: a === "blue" ? e.sky : a === "up" ? e.up : a === "warning" ? e.warning : `url(#${y}-signed-fill)`,
|
|
324
|
+
fillOpacity: a === "blue" ? 0.45 : a === "up" || a === "warning" ? 0.1 : 1,
|
|
325
|
+
dot: (N) => {
|
|
326
|
+
var H;
|
|
327
|
+
const S = N.index ?? -1;
|
|
328
|
+
if (!(N.cx != null && N.cy != null && (m && S === i.length - 1 || w && S === 0 && a === "signed"))) return /* @__PURE__ */ t("g", {}, `signed-dot-${S}`);
|
|
329
|
+
const Z = ((H = i[S]) == null ? void 0 : H.value) ?? 0;
|
|
330
|
+
return /* @__PURE__ */ t(
|
|
331
|
+
"circle",
|
|
332
|
+
{
|
|
333
|
+
cx: N.cx,
|
|
334
|
+
cy: N.cy,
|
|
335
|
+
r: S === 0 ? 3 : 4,
|
|
336
|
+
fill: Z < 0 ? e.down : e.up,
|
|
337
|
+
stroke: e.surface,
|
|
338
|
+
strokeWidth: 1
|
|
339
|
+
},
|
|
340
|
+
S === 0 ? "signed-origin-dot" : "signed-last-dot"
|
|
341
|
+
);
|
|
342
|
+
},
|
|
343
|
+
activeDot: { r: 3, stroke: e.surface, strokeWidth: 1.5 },
|
|
344
|
+
isAnimationActive: !1
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
a === "signed" && /* @__PURE__ */ t(R, { type: "monotone", dataKey: "value", stroke: "none", fill: `url(#${y}-signed-hatch)`, dot: !1, activeDot: !1, isAnimationActive: !1, legendType: "none" }),
|
|
348
|
+
/* @__PURE__ */ t(Q, { markers: l })
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
) })
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
function at(i, h = !1) {
|
|
356
|
+
const d = /* @__PURE__ */ new Set();
|
|
357
|
+
for (const a of i) {
|
|
358
|
+
if (!a.id || ["timestamp", "value", "__proto__", "constructor", "prototype"].includes(a.id) || d.has(a.id))
|
|
359
|
+
throw new RangeError("Series IDs must be unique and cannot use reserved data keys");
|
|
360
|
+
d.add(a.id);
|
|
361
|
+
}
|
|
362
|
+
const o = [...new Set(i.flatMap((a) => a.data.map((s) => s.timestamp)))].sort((a, s) => a - s), r = i.map((a) => a.data.slice().sort((s, u) => s.timestamp - u.timestamp)), c = r.map(() => 0), l = r.map(() => {
|
|
363
|
+
});
|
|
364
|
+
return o.map((a) => {
|
|
365
|
+
const s = { timestamp: a, value: 0 };
|
|
366
|
+
return r.forEach((u, m) => {
|
|
367
|
+
for (; c[m] < u.length && u[c[m]].timestamp <= a; )
|
|
368
|
+
l[m] = u[c[m]].value, c[m] += 1;
|
|
369
|
+
l[m] != null ? (s[i[m].id] = l[m], s.value += l[m]) : h && (s[i[m].id] = 0);
|
|
370
|
+
}), s;
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
function gt({
|
|
374
|
+
series: i,
|
|
375
|
+
height: h = 280,
|
|
376
|
+
valueFormat: d = String,
|
|
377
|
+
timestampFormat: o = String,
|
|
378
|
+
tooltipContent: r,
|
|
379
|
+
markers: c = [],
|
|
380
|
+
includeZero: l = !0,
|
|
381
|
+
onActiveValueChange: a,
|
|
382
|
+
testId: s,
|
|
383
|
+
ariaLabel: u
|
|
384
|
+
}) {
|
|
385
|
+
const m = at(i, l), n = i.flatMap((y) => y.data.map((f) => f.value)).filter(Number.isFinite), v = G(n, l), b = W(v, d);
|
|
386
|
+
return /* @__PURE__ */ t(
|
|
387
|
+
"div",
|
|
388
|
+
{
|
|
389
|
+
"data-testid": s,
|
|
390
|
+
role: u ? "img" : void 0,
|
|
391
|
+
"aria-label": u,
|
|
392
|
+
style: { height: h },
|
|
393
|
+
className: "w-full min-w-0 overflow-visible [&_.recharts-surface]:overflow-visible [&_.recharts-surface]:outline-none [&_.recharts-wrapper]:overflow-visible [&_.recharts-wrapper]:outline-none",
|
|
394
|
+
children: /* @__PURE__ */ t(C, { width: "100%", height: "100%", children: /* @__PURE__ */ p(
|
|
395
|
+
tt,
|
|
396
|
+
{
|
|
397
|
+
data: m,
|
|
398
|
+
margin: { top: 8, right: 8, left: 2, bottom: 0 },
|
|
399
|
+
accessibilityLayer: !1,
|
|
400
|
+
tabIndex: -1,
|
|
401
|
+
onMouseMove: (y) => {
|
|
402
|
+
if (!a) return;
|
|
403
|
+
const f = y == null ? void 0 : y.activeTooltipIndex, g = typeof f == "number" ? f : Number(f);
|
|
404
|
+
a(Number.isFinite(g) && m[g] ? m[g].value : null);
|
|
405
|
+
},
|
|
406
|
+
onMouseLeave: () => a == null ? void 0 : a(null),
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ t(T, { ...F }),
|
|
409
|
+
/* @__PURE__ */ t(_, { dataKey: "timestamp", type: "number", scale: "time", domain: ["dataMin", "dataMax"], ...k, tickFormatter: o, minTickGap: 64 }),
|
|
410
|
+
/* @__PURE__ */ t($, { ...k, domain: v, width: b, tickFormatter: d, tick: { ...k.tick, width: b }, interval: "preserveStartEnd" }),
|
|
411
|
+
l && n.some((y) => y < 0) && /* @__PURE__ */ t(A, { y: 0, stroke: e.axis, strokeDasharray: "3 5" }),
|
|
412
|
+
/* @__PURE__ */ t(D, { content: r ?? /* @__PURE__ */ t(z, { valueFormat: d, labelFormat: o }) }),
|
|
413
|
+
i.map((y, f) => /* @__PURE__ */ t(
|
|
414
|
+
J,
|
|
415
|
+
{
|
|
416
|
+
type: "monotone",
|
|
417
|
+
dataKey: y.id,
|
|
418
|
+
name: y.name,
|
|
419
|
+
stroke: y.color ?? Y[f % Y.length],
|
|
420
|
+
strokeWidth: 2,
|
|
421
|
+
dot: !1,
|
|
422
|
+
activeDot: { r: 3, stroke: e.surface, strokeWidth: 1.5 },
|
|
423
|
+
connectNulls: !1,
|
|
424
|
+
isAnimationActive: !1
|
|
425
|
+
},
|
|
426
|
+
y.id
|
|
427
|
+
)),
|
|
428
|
+
/* @__PURE__ */ t(Q, { markers: c })
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
) })
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
function xt({
|
|
436
|
+
data: i,
|
|
437
|
+
height: h = 280,
|
|
438
|
+
name: d = "Value",
|
|
439
|
+
valueFormat: o = String,
|
|
440
|
+
timestampFormat: r = String,
|
|
441
|
+
tooltipContent: c,
|
|
442
|
+
onActiveValueChange: l,
|
|
443
|
+
testId: a,
|
|
444
|
+
ariaLabel: s
|
|
445
|
+
}) {
|
|
446
|
+
const u = B().replace(/:/g, ""), m = i.map((g) => g.value).filter(Number.isFinite), n = Math.max(0, ...m), v = Math.max(0.05, n > 0 ? n * 0.12 : 0.2), b = [0, n + v], y = W(b, o), f = i.map((g) => ({
|
|
447
|
+
timestamp: g.timestamp,
|
|
448
|
+
value: Math.max(0, Number.isFinite(g.value) ? g.value : 0)
|
|
449
|
+
}));
|
|
450
|
+
return /* @__PURE__ */ t(
|
|
451
|
+
"div",
|
|
452
|
+
{
|
|
453
|
+
"data-testid": a,
|
|
454
|
+
role: s ? "img" : void 0,
|
|
455
|
+
"aria-label": s,
|
|
456
|
+
style: { height: h },
|
|
457
|
+
className: "w-full min-w-0 overflow-visible [&_.recharts-surface]:overflow-visible [&_.recharts-surface]:outline-none [&_.recharts-wrapper]:overflow-visible [&_.recharts-wrapper]:outline-none",
|
|
458
|
+
children: /* @__PURE__ */ t(C, { width: "100%", height: "100%", children: /* @__PURE__ */ p(
|
|
459
|
+
E,
|
|
460
|
+
{
|
|
461
|
+
data: f,
|
|
462
|
+
margin: { top: 8, right: 8, left: 2, bottom: 0 },
|
|
463
|
+
accessibilityLayer: !1,
|
|
464
|
+
tabIndex: -1,
|
|
465
|
+
onMouseMove: (g) => {
|
|
466
|
+
if (!l) return;
|
|
467
|
+
const x = g == null ? void 0 : g.activeTooltipIndex, M = typeof x == "number" ? x : Number(x);
|
|
468
|
+
l(Number.isFinite(M) && f[M] ? f[M].value : null);
|
|
469
|
+
},
|
|
470
|
+
onMouseLeave: () => l == null ? void 0 : l(null),
|
|
471
|
+
children: [
|
|
472
|
+
/* @__PURE__ */ t("defs", { children: /* @__PURE__ */ p("pattern", { id: `${u}-bar-hatch`, patternUnits: "userSpaceOnUse", width: 6, height: 6, patternTransform: "rotate(45)", children: [
|
|
473
|
+
/* @__PURE__ */ t("rect", { width: 6, height: 6, fill: e.sky }),
|
|
474
|
+
/* @__PURE__ */ t("line", { x1: 0, y1: 0, x2: 0, y2: 6, stroke: e.blue, strokeWidth: 1.4, strokeOpacity: 0.78 }),
|
|
475
|
+
/* @__PURE__ */ t("line", { x1: 3, y1: 0, x2: 3, y2: 6, stroke: e.ink, strokeWidth: 0.9, strokeOpacity: 0.14 })
|
|
476
|
+
] }) }),
|
|
477
|
+
/* @__PURE__ */ t(T, { ...F }),
|
|
478
|
+
/* @__PURE__ */ t(_, { dataKey: "timestamp", type: "number", scale: "time", domain: ["dataMin", "dataMax"], ...k, tickFormatter: r, minTickGap: 64 }),
|
|
479
|
+
/* @__PURE__ */ t(
|
|
480
|
+
$,
|
|
481
|
+
{
|
|
482
|
+
...k,
|
|
483
|
+
domain: b,
|
|
484
|
+
width: y,
|
|
485
|
+
tickFormatter: o,
|
|
486
|
+
tick: { ...k.tick, width: y },
|
|
487
|
+
interval: "preserveStartEnd"
|
|
488
|
+
}
|
|
489
|
+
),
|
|
490
|
+
/* @__PURE__ */ t(D, { content: c ?? /* @__PURE__ */ t(z, { valueFormat: o, labelFormat: r }), cursor: { fill: e.dove, fillOpacity: 0.12 } }),
|
|
491
|
+
/* @__PURE__ */ t(
|
|
492
|
+
K,
|
|
493
|
+
{
|
|
494
|
+
dataKey: "value",
|
|
495
|
+
name: d,
|
|
496
|
+
fill: `url(#${u}-bar-hatch)`,
|
|
497
|
+
maxBarSize: 36,
|
|
498
|
+
radius: [3, 3, 0, 0],
|
|
499
|
+
isAnimationActive: !1
|
|
500
|
+
}
|
|
501
|
+
)
|
|
502
|
+
]
|
|
503
|
+
}
|
|
504
|
+
) })
|
|
505
|
+
}
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
function rt(i) {
|
|
509
|
+
const h = `weighted-heatmap-${B()}`, { x: d, y: o, width: r, height: c, name: l, depth: a } = i;
|
|
510
|
+
if (a === 0) return null;
|
|
511
|
+
const s = Number.isFinite(i.change) ? Number(i.change) : 0, u = Number.isFinite(i.value) ? Number(i.value) : 0, m = Math.max(1e-6, Number(i.intensityMax) || 10), n = typeof i.valueFormat == "function" ? i.valueFormat : String, v = typeof i.changeFormat == "function" ? i.changeFormat : (S) => `${S >= 0 ? "+" : ""}${S.toFixed(2)}%`, b = s >= 0, y = n(u), f = v(s), g = i, x = typeof i.hrefForItem == "function" ? i.hrefForItem(g) : void 0, M = typeof i.itemAriaLabel == "function" ? i.itemAriaLabel(g) : `${l ?? ""} · ${y} · ${f}`, O = r > 72 && c > 58, I = r > 44 && c > 28, w = O ? 16 : I ? 12 : 0, P = w > 0 && typeof i.renderIcon == "function" ? i.renderIcon(g, w) : void 0, N = /* @__PURE__ */ p(L, { children: [
|
|
512
|
+
/* @__PURE__ */ t("defs", { children: /* @__PURE__ */ t("clipPath", { id: h, children: /* @__PURE__ */ t("rect", { x: d + 3, y: o + 3, width: Math.max(0, r - 6), height: Math.max(0, c - 6), rx: 3 }) }) }),
|
|
513
|
+
/* @__PURE__ */ t(
|
|
514
|
+
"rect",
|
|
515
|
+
{
|
|
516
|
+
x: d + 1,
|
|
517
|
+
y: o + 1,
|
|
518
|
+
width: Math.max(0, r - 2),
|
|
519
|
+
height: Math.max(0, c - 2),
|
|
520
|
+
rx: 4,
|
|
521
|
+
fill: b ? e.up : e.down,
|
|
522
|
+
fillOpacity: Math.min(0.9, 0.52 + Math.abs(s) / m * 0.38),
|
|
523
|
+
className: "origin-center transition-transform duration-150 motion-reduce:transition-none",
|
|
524
|
+
style: { transformBox: "fill-box" },
|
|
525
|
+
children: /* @__PURE__ */ t("title", { children: `${l ?? ""} · ${y} · ${f}` })
|
|
526
|
+
}
|
|
527
|
+
),
|
|
528
|
+
P && /* @__PURE__ */ t("foreignObject", { clipPath: `url(#${h})`, x: d + 7, y: o + 7, width: w, height: w, className: "pointer-events-none overflow-hidden", children: /* @__PURE__ */ t("div", { style: { width: w, height: w }, className: "grid place-items-center", children: P }) }),
|
|
529
|
+
O ? /* @__PURE__ */ p(L, { children: [
|
|
530
|
+
/* @__PURE__ */ t("text", { clipPath: `url(#${h})`, x: d + r / 2, y: o + c / 2 - 13, textAnchor: "middle", fill: "var(--color-on-status)", fontFamily: e.font, fontSize: 12, fontWeight: 600, children: l ?? "" }),
|
|
531
|
+
/* @__PURE__ */ t("text", { clipPath: `url(#${h})`, x: d + r / 2, y: o + c / 2 + 4, textAnchor: "middle", fill: "var(--color-on-status)", fontFamily: e.font, fontSize: 11, children: y }),
|
|
532
|
+
/* @__PURE__ */ t("text", { clipPath: `url(#${h})`, x: d + r / 2, y: o + c / 2 + 21, textAnchor: "middle", fill: "var(--color-on-status)", fontFamily: e.font, fontSize: 11, children: f })
|
|
533
|
+
] }) : I ? /* @__PURE__ */ p(L, { children: [
|
|
534
|
+
/* @__PURE__ */ t("text", { clipPath: `url(#${h})`, x: d + r / 2, y: o + c / 2 - 3, textAnchor: "middle", fill: "var(--color-on-status)", fontFamily: e.font, fontSize: 11, fontWeight: 600, children: l ?? "" }),
|
|
535
|
+
/* @__PURE__ */ t("text", { clipPath: `url(#${h})`, x: d + r / 2, y: o + c / 2 + 13, textAnchor: "middle", fill: "var(--color-on-status)", fontFamily: e.font, fontSize: 10, children: f })
|
|
536
|
+
] }) : /* @__PURE__ */ t("text", { clipPath: `url(#${h})`, x: d + 4, y: o + Math.min(c - 4, Math.max(11, c / 2 + 3)), fill: "var(--color-on-status)", fontFamily: e.font, fontSize: 9, fontWeight: 600, children: l ?? "" })
|
|
537
|
+
] });
|
|
538
|
+
return x ? /* @__PURE__ */ t("a", { href: x, "aria-label": M, "data-weighted-heatmap-name": l, className: "group outline-none", children: N }) : /* @__PURE__ */ t("g", { "aria-label": M, "data-weighted-heatmap-name": l, className: "group outline-none", children: N });
|
|
539
|
+
}
|
|
540
|
+
function ot({ active: i, payload: h, valueFormat: d, changeFormat: o, valueLabel: r, changeLabel: c, renderIcon: l }) {
|
|
541
|
+
var u;
|
|
542
|
+
const a = (u = h == null ? void 0 : h[0]) == null ? void 0 : u.payload, s = (a == null ? void 0 : a.payload) ?? a;
|
|
543
|
+
return !i || !s || typeof s.name != "string" ? null : /* @__PURE__ */ p("div", { role: "tooltip", className: "min-w-40 rounded-panel border border-border bg-surface-raised px-3 py-2 shadow-pop", style: { fontFamily: e.font }, children: [
|
|
544
|
+
/* @__PURE__ */ p("div", { className: "mb-2 flex items-center gap-2 text-body-sm font-[600] text-ink", children: [
|
|
545
|
+
typeof l == "function" && l(s, 16),
|
|
546
|
+
/* @__PURE__ */ t("span", { children: s.name })
|
|
547
|
+
] }),
|
|
548
|
+
/* @__PURE__ */ p("div", { className: "flex items-center justify-between gap-4 text-caption", children: [
|
|
549
|
+
/* @__PURE__ */ t("span", { className: "text-graphite", children: r }),
|
|
550
|
+
/* @__PURE__ */ t("span", { className: "font-data tabular-nums text-ink", children: d(s.value) })
|
|
551
|
+
] }),
|
|
552
|
+
/* @__PURE__ */ p("div", { className: "mt-1 flex items-center justify-between gap-4 text-caption", children: [
|
|
553
|
+
/* @__PURE__ */ t("span", { className: "text-graphite", children: c }),
|
|
554
|
+
/* @__PURE__ */ t("span", { className: s.change >= 0 ? "text-up" : "text-down", children: o(s.change) })
|
|
555
|
+
] })
|
|
556
|
+
] });
|
|
557
|
+
}
|
|
558
|
+
function bt({ data: i, height: h = 300, ariaLabel: d = "Weighted heatmap", valueFormat: o = String, changeFormat: r = (n) => `${n >= 0 ? "+" : ""}${n.toFixed(2)}%`, intensityMax: c = 10, valueLabel: l = "Value", changeLabel: a = "Change", renderIcon: s, hrefForItem: u, itemAriaLabel: m }) {
|
|
559
|
+
return /* @__PURE__ */ p("div", { "data-weighted-heatmap-root": !0, role: "img", "aria-label": d, className: "h-full w-full [&_.recharts-surface]:outline-none", style: { height: h }, children: [
|
|
560
|
+
/* @__PURE__ */ t("style", { children: `
|
|
561
|
+
[data-weighted-heatmap-root] [data-weighted-heatmap-name]:hover > rect,
|
|
562
|
+
[data-weighted-heatmap-root] [data-weighted-heatmap-name]:focus-visible > rect {
|
|
563
|
+
transform: scale(1.015);
|
|
564
|
+
stroke: var(--color-rust);
|
|
565
|
+
stroke-width: 1.5px;
|
|
566
|
+
}
|
|
567
|
+
` }),
|
|
568
|
+
/* @__PURE__ */ t(C, { width: "100%", height: "100%", children: /* @__PURE__ */ t(et, { data: i, dataKey: "value", nameKey: "name", content: /* @__PURE__ */ t(rt, { valueFormat: o, changeFormat: r, intensityMax: c, renderIcon: s, hrefForItem: u, itemAriaLabel: m }), isAnimationActive: !1, children: /* @__PURE__ */ t(D, { cursor: !1, content: /* @__PURE__ */ t(ot, { valueFormat: o, changeFormat: r, valueLabel: l, changeLabel: a, renderIcon: s }) }) }) })
|
|
569
|
+
] });
|
|
570
|
+
}
|
|
571
|
+
export {
|
|
572
|
+
mt as DepthChart,
|
|
573
|
+
ht as DivergingBarChart,
|
|
574
|
+
ft as DualAxisBarChart,
|
|
575
|
+
pt as DualAxisLineChart,
|
|
576
|
+
ut as GroupedBarChart,
|
|
577
|
+
gt as MultiLineChart,
|
|
578
|
+
yt as SignedAreaChart,
|
|
579
|
+
xt as TimeBarChart,
|
|
580
|
+
bt as WeightedHeatmap,
|
|
581
|
+
at as alignTimeLineSeries,
|
|
582
|
+
it as buildDepthSeries,
|
|
583
|
+
W as chartYAxisWidth
|
|
584
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const r = {
|
|
2
|
+
rust: "var(--color-rust)",
|
|
3
|
+
blue: "var(--color-data-blue)",
|
|
4
|
+
ink: "var(--color-ink)",
|
|
5
|
+
ash: "var(--color-ash)",
|
|
6
|
+
graphite: "var(--color-graphite)",
|
|
7
|
+
dove: "var(--color-dove)",
|
|
8
|
+
grid: "var(--color-chart-grid)",
|
|
9
|
+
axis: "var(--color-chart-axis)",
|
|
10
|
+
canvas: "var(--color-surface-canvas)",
|
|
11
|
+
surface: "var(--color-surface-raised)",
|
|
12
|
+
up: "var(--color-up)",
|
|
13
|
+
down: "var(--color-down)",
|
|
14
|
+
warning: "var(--color-warning)",
|
|
15
|
+
apricot: "var(--color-apricot-wash)",
|
|
16
|
+
sky: "var(--color-sky-wash)",
|
|
17
|
+
white: "var(--color-surface-raised)",
|
|
18
|
+
font: "var(--font-sohne)"
|
|
19
|
+
}, a = ["var(--color-data-1)", "var(--color-data-2)", "var(--color-data-3)", "var(--color-data-4)", "var(--color-data-5)"], o = {
|
|
20
|
+
tick: { fill: r.graphite, fontSize: 12, fontFamily: r.font },
|
|
21
|
+
tickLine: !1,
|
|
22
|
+
axisLine: { stroke: r.axis },
|
|
23
|
+
tickMargin: 8
|
|
24
|
+
}, c = {
|
|
25
|
+
stroke: r.grid,
|
|
26
|
+
strokeOpacity: 1,
|
|
27
|
+
strokeDasharray: "2 6",
|
|
28
|
+
vertical: !1
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
a as CATEGORICAL,
|
|
32
|
+
r as CHART,
|
|
33
|
+
o as axisProps,
|
|
34
|
+
c as gridProps
|
|
35
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as a, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { ResponsiveContainer as c, ComposedChart as h, CartesianGrid as f, XAxis as y, YAxis as C, ReferenceLine as g, Tooltip as k, Bar as A, Line as x } from "recharts";
|
|
3
|
+
import { ChartTooltip as T } from "./chart-tooltip.js";
|
|
4
|
+
import { gridProps as b, axisProps as n, CHART as v, CATEGORICAL as o } from "./theme.js";
|
|
5
|
+
function K({ data: s, series: l, height: d = 320, timestampFormat: r = String, valueFormat: t = String, ariaLabel: m = "Time series comparison" }) {
|
|
6
|
+
return /* @__PURE__ */ a("div", { role: "img", "aria-label": m, style: { height: d }, className: "w-full min-w-0", children: /* @__PURE__ */ a(c, { width: "100%", height: "100%", children: /* @__PURE__ */ p(h, { data: s, margin: { top: 10, right: 8, left: 4, bottom: 0 }, children: [
|
|
7
|
+
/* @__PURE__ */ a(f, { ...b }),
|
|
8
|
+
/* @__PURE__ */ a(y, { dataKey: "timestamp", type: "number", scale: "time", domain: ["dataMin", "dataMax"], ...n, tickFormatter: r, minTickGap: 64 }),
|
|
9
|
+
/* @__PURE__ */ a(C, { ...n, width: 84, tickFormatter: t }),
|
|
10
|
+
/* @__PURE__ */ a(g, { y: 0, stroke: v.axis }),
|
|
11
|
+
/* @__PURE__ */ a(k, { content: /* @__PURE__ */ a(T, { labelFormat: r, valueFormat: t }) }),
|
|
12
|
+
l.map((i, e) => i.kind === "bar" ? /* @__PURE__ */ a(A, { dataKey: i.id, name: i.name, fill: i.color ?? o[e % o.length], fillOpacity: i.opacity ?? 0.3, maxBarSize: 18, isAnimationActive: !1 }, i.id) : /* @__PURE__ */ a(x, { type: "monotone", dataKey: i.id, name: i.name, stroke: i.color ?? o[e % o.length], strokeOpacity: i.opacity ?? 1, strokeDasharray: i.dashed ? "4 3" : void 0, strokeWidth: 2, dot: !1, isAnimationActive: !1 }, i.id))
|
|
13
|
+
] }) }) });
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
K as TimeComboChart
|
|
17
|
+
};
|