@goliapkg/gds 1.0.10 → 1.4.2
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 +10 -6
- package/dist/{avatar-By0U5Vts.js → avatar-l3SaMCmU.js} +10 -10
- package/dist/avatar-l3SaMCmU.js.map +1 -0
- package/dist/index.js +25 -25
- package/dist/l2-primitives/divider.d.ts +11 -2
- package/dist/l2-primitives/divider.d.ts.map +1 -1
- package/dist/l2-primitives/index.d.ts +1 -1
- package/dist/l2-primitives/index.d.ts.map +1 -1
- package/dist/l2-primitives/index.js +10 -10
- package/dist/l2-primitives/input.d.ts +6 -0
- package/dist/l2-primitives/input.d.ts.map +1 -1
- package/dist/l2-primitives/number-input.d.ts +4 -0
- package/dist/l2-primitives/number-input.d.ts.map +1 -1
- package/dist/{l2-primitives-BIiL8hFH.js → l2-primitives-Le0006ck.js} +105 -81
- package/dist/l2-primitives-Le0006ck.js.map +1 -0
- package/dist/l3-atoms/avatar-badge.d.ts +1 -0
- package/dist/l3-atoms/avatar-badge.d.ts.map +1 -1
- package/dist/l3-atoms/avatar.d.ts +2 -0
- package/dist/l3-atoms/avatar.d.ts.map +1 -1
- package/dist/l3-atoms/checkbox.d.ts +7 -0
- package/dist/l3-atoms/checkbox.d.ts.map +1 -1
- package/dist/l3-atoms/index.d.ts +4 -4
- package/dist/l3-atoms/index.d.ts.map +1 -1
- package/dist/l3-atoms/index.js +6 -6
- package/dist/l3-atoms/status-badge.d.ts +8 -0
- package/dist/l3-atoms/status-badge.d.ts.map +1 -1
- package/dist/l3-atoms/status-dot.d.ts +4 -0
- package/dist/l3-atoms/status-dot.d.ts.map +1 -1
- package/dist/l3-atoms/toggle-group.d.ts +16 -2
- package/dist/l3-atoms/toggle-group.d.ts.map +1 -1
- package/dist/{l3-atoms-CsN9IA9J.js → l3-atoms-BxDg3rXt.js} +196 -189
- package/dist/{l3-atoms-CsN9IA9J.js.map → l3-atoms-BxDg3rXt.js.map} +1 -1
- package/dist/l4-molecules/alert.d.ts +7 -1
- package/dist/l4-molecules/alert.d.ts.map +1 -1
- package/dist/l4-molecules/dialog.d.ts +8 -2
- package/dist/l4-molecules/dialog.d.ts.map +1 -1
- package/dist/l4-molecules/index.d.ts +3 -3
- package/dist/l4-molecules/index.d.ts.map +1 -1
- package/dist/l4-molecules/index.js +3 -3
- package/dist/l4-molecules/tabs.d.ts +1 -2
- package/dist/l4-molecules/tabs.d.ts.map +1 -1
- package/dist/{l4-molecules-DHsPjYhl.js → l4-molecules-DftsX-gO.js} +212 -205
- package/dist/l4-molecules-DftsX-gO.js.map +1 -0
- package/dist/l5-organisms/data-table/data-table-body.d.ts +31 -0
- package/dist/l5-organisms/data-table/data-table-body.d.ts.map +1 -0
- package/dist/l5-organisms/data-table/data-table-head.d.ts +22 -0
- package/dist/l5-organisms/data-table/data-table-head.d.ts.map +1 -0
- package/dist/l5-organisms/data-table/data-table-pagination.d.ts +13 -0
- package/dist/l5-organisms/data-table/data-table-pagination.d.ts.map +1 -0
- package/dist/l5-organisms/data-table/data-table-toolbar.d.ts +19 -0
- package/dist/l5-organisms/data-table/data-table-toolbar.d.ts.map +1 -0
- package/dist/l5-organisms/data-table/data-table-types.d.ts +88 -0
- package/dist/l5-organisms/data-table/data-table-types.d.ts.map +1 -0
- package/dist/l5-organisms/data-table/data-table-utils.d.ts +13 -0
- package/dist/l5-organisms/data-table/data-table-utils.d.ts.map +1 -0
- package/dist/l5-organisms/data-table/data-table.d.ts +6 -0
- package/dist/l5-organisms/data-table/data-table.d.ts.map +1 -0
- package/dist/l5-organisms/data-table/index.d.ts +4 -0
- package/dist/l5-organisms/data-table/index.d.ts.map +1 -0
- package/dist/l5-organisms/gantt-chart/gantt-chart-types.d.ts +52 -0
- package/dist/l5-organisms/gantt-chart/gantt-chart-types.d.ts.map +1 -0
- package/dist/l5-organisms/gantt-chart/gantt-chart-utils.d.ts +11 -0
- package/dist/l5-organisms/gantt-chart/gantt-chart-utils.d.ts.map +1 -0
- package/dist/l5-organisms/gantt-chart/gantt-chart.d.ts +3 -0
- package/dist/l5-organisms/gantt-chart/gantt-chart.d.ts.map +1 -0
- package/dist/l5-organisms/gantt-chart/index.d.ts +3 -0
- package/dist/l5-organisms/gantt-chart/index.d.ts.map +1 -0
- package/dist/l5-organisms/index.d.ts +4 -2
- package/dist/l5-organisms/index.d.ts.map +1 -1
- package/dist/l5-organisms/index.js +2 -2
- package/dist/l5-organisms/table.d.ts +12 -0
- package/dist/l5-organisms/table.d.ts.map +1 -1
- package/dist/{l5-organisms-z8mU4eoy.js → l5-organisms-Di1Bm_R6.js} +1352 -292
- package/dist/l5-organisms-Di1Bm_R6.js.map +1 -0
- package/dist/l6-charts/annotated-chart.d.ts +18 -0
- package/dist/l6-charts/annotated-chart.d.ts.map +1 -0
- package/dist/l6-charts/bullet-chart.d.ts +11 -0
- package/dist/l6-charts/bullet-chart.d.ts.map +1 -0
- package/dist/l6-charts/donut-gauge.d.ts +14 -0
- package/dist/l6-charts/donut-gauge.d.ts.map +1 -0
- package/dist/l6-charts/flame-chart.d.ts +13 -0
- package/dist/l6-charts/flame-chart.d.ts.map +1 -0
- package/dist/l6-charts/index.d.ts +12 -0
- package/dist/l6-charts/index.d.ts.map +1 -1
- package/dist/l6-charts/index.js +2 -2
- package/dist/l6-charts/realtime-chart.d.ts +13 -0
- package/dist/l6-charts/realtime-chart.d.ts.map +1 -0
- package/dist/l6-charts/waterfall-chart.d.ts +12 -0
- package/dist/l6-charts/waterfall-chart.d.ts.map +1 -0
- package/dist/l6-charts-Bn9RQLbe.js +2145 -0
- package/dist/l6-charts-Bn9RQLbe.js.map +1 -0
- package/dist/l7-patterns/index.js +1 -1
- package/dist/{l7-patterns-E9ls7Nw6.js → l7-patterns-BCpw0-CS.js} +4 -4
- package/dist/{l7-patterns-E9ls7Nw6.js.map → l7-patterns-BCpw0-CS.js.map} +1 -1
- package/dist/{resize-handle-CktEYqwi.js → resize-handle-ilSc7QRM.js} +6 -3
- package/dist/{resize-handle-CktEYqwi.js.map → resize-handle-ilSc7QRM.js.map} +1 -1
- package/dist/{spinner-D8Ti-TFe.js → spinner-N7UNjdsQ.js} +66 -23
- package/dist/spinner-N7UNjdsQ.js.map +1 -0
- package/package.json +1 -1
- package/dist/avatar-By0U5Vts.js.map +0 -1
- package/dist/l2-primitives-BIiL8hFH.js.map +0 -1
- package/dist/l4-molecules-DHsPjYhl.js.map +0 -1
- package/dist/l5-organisms/data-table.d.ts +0 -24
- package/dist/l5-organisms/data-table.d.ts.map +0 -1
- package/dist/l5-organisms-z8mU4eoy.js.map +0 -1
- package/dist/l6-charts-DYnr5B9X.js +0 -1743
- package/dist/l6-charts-DYnr5B9X.js.map +0 -1
- package/dist/spinner-D8Ti-TFe.js.map +0 -1
|
@@ -0,0 +1,2145 @@
|
|
|
1
|
+
import { r as e, t } from "./glass-CQTlX7IO.js";
|
|
2
|
+
import { forwardRef as n, useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
3
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
|
+
import { Area as u, AreaChart as d, Bar as f, BarChart as p, CartesianGrid as m, Cell as h, ComposedChart as g, Funnel as _, FunnelChart as v, Legend as y, Line as b, LineChart as x, Pie as S, PieChart as C, PolarAngleAxis as ee, PolarGrid as te, PolarRadiusAxis as ne, Radar as re, RadarChart as ie, RadialBar as ae, RadialBarChart as oe, ResponsiveContainer as w, Sankey as se, Scatter as T, ScatterChart as E, Tooltip as D, Treemap as ce, XAxis as O, YAxis as k, ZAxis as le } from "recharts";
|
|
5
|
+
//#region src/l6-charts/annotated-chart.tsx
|
|
6
|
+
var A = 32;
|
|
7
|
+
function ue(e, t, n) {
|
|
8
|
+
if (e.length === 0) return [];
|
|
9
|
+
let r = Math.min(...e.map((e) => e.x)), i = Math.max(...e.map((e) => e.x)), a = Math.min(...e.map((e) => e.y)), o = Math.max(...e.map((e) => e.y)), s = i - r || 1, c = o - a || 1;
|
|
10
|
+
return e.map((e) => ({
|
|
11
|
+
sx: A + (e.x - r) / s * (t - A * 2),
|
|
12
|
+
sy: A + (1 - (e.y - a) / c) * (n - A * 2)
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
function de({ annotations: t, className: n, data: r, height: i = 200 }) {
|
|
16
|
+
let [a, o] = s(null), u = ue(r, 400, i), d = u.map((e) => `${e.sx},${e.sy}`).join(" ");
|
|
17
|
+
return /* @__PURE__ */ l("div", {
|
|
18
|
+
className: e("relative select-none", n),
|
|
19
|
+
"data-component": "annotated-chart",
|
|
20
|
+
children: [/* @__PURE__ */ l("svg", {
|
|
21
|
+
className: "w-full",
|
|
22
|
+
viewBox: `0 0 400 ${i}`,
|
|
23
|
+
children: [/* @__PURE__ */ c("polyline", {
|
|
24
|
+
className: "stroke-accent",
|
|
25
|
+
fill: "none",
|
|
26
|
+
points: d,
|
|
27
|
+
strokeWidth: 2
|
|
28
|
+
}), t.map((e, t) => {
|
|
29
|
+
let n = r.findIndex((t) => t.x === e.x);
|
|
30
|
+
if (n < 0) return null;
|
|
31
|
+
let i = u[n];
|
|
32
|
+
return /* @__PURE__ */ c("g", {
|
|
33
|
+
className: "cursor-pointer outline-none",
|
|
34
|
+
onClick: () => o(a === t ? null : t),
|
|
35
|
+
onKeyDown: (e) => {
|
|
36
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), o(a === t ? null : t));
|
|
37
|
+
},
|
|
38
|
+
role: "button",
|
|
39
|
+
tabIndex: 0,
|
|
40
|
+
children: /* @__PURE__ */ c("rect", {
|
|
41
|
+
fill: e.color ?? "currentColor",
|
|
42
|
+
height: 8,
|
|
43
|
+
rx: 1,
|
|
44
|
+
transform: `translate(${i.sx}, ${i.sy}) rotate(45) translate(-4, -4)`,
|
|
45
|
+
width: 8
|
|
46
|
+
})
|
|
47
|
+
}, t);
|
|
48
|
+
})]
|
|
49
|
+
}), a !== null && (() => {
|
|
50
|
+
let e = t[a], n = r.findIndex((t) => t.x === e.x);
|
|
51
|
+
if (n < 0) return null;
|
|
52
|
+
let o = u[n];
|
|
53
|
+
return /* @__PURE__ */ l("div", {
|
|
54
|
+
className: "absolute z-10 rounded-lg border border-border bg-surface px-3 py-2 shadow-lg",
|
|
55
|
+
style: {
|
|
56
|
+
left: `${o.sx / 400 * 100}%`,
|
|
57
|
+
top: `${o.sy / i * 100}%`
|
|
58
|
+
},
|
|
59
|
+
children: [/* @__PURE__ */ c("div", {
|
|
60
|
+
className: "text-xs font-bold text-fg",
|
|
61
|
+
children: e.label
|
|
62
|
+
}), /* @__PURE__ */ c("div", {
|
|
63
|
+
className: "text-xs text-fg-muted",
|
|
64
|
+
children: e.description
|
|
65
|
+
})]
|
|
66
|
+
});
|
|
67
|
+
})()]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/l6-charts/area-chart.tsx
|
|
72
|
+
var j = "gds-area-gradient", fe = n(function({ data: t, dataKey: n, xKey: r = "name", className: i, height: a = 300, color: o = "var(--gds-accent)", glass: s, ...f }, p) {
|
|
73
|
+
return /* @__PURE__ */ c("div", {
|
|
74
|
+
className: e("w-full", s && "gds-radius-popover backdrop-blur-md bg-white/5", i),
|
|
75
|
+
"data-component": "area-chart",
|
|
76
|
+
ref: p,
|
|
77
|
+
...f,
|
|
78
|
+
children: /* @__PURE__ */ c(w, {
|
|
79
|
+
height: a,
|
|
80
|
+
width: "100%",
|
|
81
|
+
children: /* @__PURE__ */ l(d, {
|
|
82
|
+
data: t,
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ c("defs", { children: /* @__PURE__ */ l("linearGradient", {
|
|
85
|
+
id: j,
|
|
86
|
+
x1: "0",
|
|
87
|
+
x2: "0",
|
|
88
|
+
y1: "0",
|
|
89
|
+
y2: "1",
|
|
90
|
+
children: [/* @__PURE__ */ c("stop", {
|
|
91
|
+
offset: "5%",
|
|
92
|
+
stopColor: o,
|
|
93
|
+
stopOpacity: .3
|
|
94
|
+
}), /* @__PURE__ */ c("stop", {
|
|
95
|
+
offset: "95%",
|
|
96
|
+
stopColor: o,
|
|
97
|
+
stopOpacity: 0
|
|
98
|
+
})]
|
|
99
|
+
}) }),
|
|
100
|
+
/* @__PURE__ */ c(m, {
|
|
101
|
+
stroke: "var(--gds-border, #e5e7eb)",
|
|
102
|
+
strokeDasharray: "3 3"
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ c(O, {
|
|
105
|
+
dataKey: r,
|
|
106
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
107
|
+
tick: { fontSize: 11 }
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ c(k, {
|
|
110
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
111
|
+
tick: { fontSize: 11 }
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ c(D, {}),
|
|
114
|
+
/* @__PURE__ */ c(u, {
|
|
115
|
+
dataKey: n,
|
|
116
|
+
fill: `url(#${j})`,
|
|
117
|
+
fillOpacity: 1,
|
|
118
|
+
stroke: o,
|
|
119
|
+
strokeWidth: 2,
|
|
120
|
+
type: "monotone"
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
}), pe = n(function({ data: t, dataKey: n, xKey: r = "name", className: i, height: a = 300, color: o = "var(--gds-accent)", glass: s, ...u }, d) {
|
|
127
|
+
return /* @__PURE__ */ c("div", {
|
|
128
|
+
className: e("w-full", s && "gds-radius-popover backdrop-blur-md bg-white/5", i),
|
|
129
|
+
"data-component": "bar-chart",
|
|
130
|
+
ref: d,
|
|
131
|
+
...u,
|
|
132
|
+
children: /* @__PURE__ */ c(w, {
|
|
133
|
+
height: a,
|
|
134
|
+
width: "100%",
|
|
135
|
+
children: /* @__PURE__ */ l(p, {
|
|
136
|
+
data: t,
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ c(m, {
|
|
139
|
+
stroke: "var(--gds-border, #e5e7eb)",
|
|
140
|
+
strokeDasharray: "3 3"
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ c(O, {
|
|
143
|
+
dataKey: r,
|
|
144
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
145
|
+
tick: { fontSize: 11 }
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ c(k, {
|
|
148
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
149
|
+
tick: { fontSize: 11 }
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ c(D, {}),
|
|
152
|
+
/* @__PURE__ */ c(f, {
|
|
153
|
+
dataKey: n,
|
|
154
|
+
fill: o,
|
|
155
|
+
radius: [
|
|
156
|
+
4,
|
|
157
|
+
4,
|
|
158
|
+
0,
|
|
159
|
+
0
|
|
160
|
+
]
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/l6-charts/box-plot-stats.ts
|
|
169
|
+
function M(e, t) {
|
|
170
|
+
let n = (e.length - 1) * t, r = Math.floor(n), i = Math.ceil(n);
|
|
171
|
+
return r === i ? e[r] : e[r] + (e[i] - e[r]) * (n - r);
|
|
172
|
+
}
|
|
173
|
+
function me(e) {
|
|
174
|
+
let t = [...e].sort((e, t) => e - t), n = M(t, .25), r = M(t, .5), i = M(t, .75), a = i - n;
|
|
175
|
+
return {
|
|
176
|
+
q1: n,
|
|
177
|
+
median: r,
|
|
178
|
+
q3: i,
|
|
179
|
+
whiskerMin: Math.max(t[0], n - 1.5 * a),
|
|
180
|
+
whiskerMax: Math.min(t[t.length - 1], i + 1.5 * a)
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/l6-charts/box-plot.tsx
|
|
185
|
+
var N = [
|
|
186
|
+
"var(--gds-palette-0, #6366f1)",
|
|
187
|
+
"var(--gds-palette-1, #8b5cf6)",
|
|
188
|
+
"var(--gds-palette-2, #06b6d4)",
|
|
189
|
+
"var(--gds-palette-3, #10b981)",
|
|
190
|
+
"var(--gds-palette-4, #f59e0b)"
|
|
191
|
+
], he = n(function({ data: t, width: n = 400, height: r = 300, glass: i, className: a }, o) {
|
|
192
|
+
let s = {
|
|
193
|
+
top: 20,
|
|
194
|
+
right: 20,
|
|
195
|
+
bottom: 40,
|
|
196
|
+
left: 50
|
|
197
|
+
}, u = n - s.left - s.right, d = r - s.top - s.bottom, f = t.flatMap((e) => e.values), p = f.length > 0 ? Math.min(...f) : 0, m = f.length > 0 ? Math.max(...f) : 1, h = m - p, g = p - h * .1, _ = m + h * .1, v = (e) => s.top + d * (1 - (e - g) / (_ - g)), y = t.length > 0 ? u / t.length : u, b = Math.min(y * .6, 60);
|
|
198
|
+
return /* @__PURE__ */ c("div", {
|
|
199
|
+
ref: o,
|
|
200
|
+
className: e("gds-radius-popover border border-border", i && "backdrop-blur-md bg-white/5", a),
|
|
201
|
+
"data-component": "box-plot",
|
|
202
|
+
children: /* @__PURE__ */ l("svg", {
|
|
203
|
+
width: n,
|
|
204
|
+
height: r,
|
|
205
|
+
viewBox: `0 0 ${n} ${r}`,
|
|
206
|
+
children: [
|
|
207
|
+
/* @__PURE__ */ c("line", {
|
|
208
|
+
x1: s.left,
|
|
209
|
+
y1: s.top,
|
|
210
|
+
x2: s.left,
|
|
211
|
+
y2: s.top + d,
|
|
212
|
+
stroke: "var(--gds-border, #374151)",
|
|
213
|
+
strokeWidth: 1
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ c("line", {
|
|
216
|
+
x1: s.left,
|
|
217
|
+
y1: s.top + d,
|
|
218
|
+
x2: s.left + u,
|
|
219
|
+
y2: s.top + d,
|
|
220
|
+
stroke: "var(--gds-border, #374151)",
|
|
221
|
+
strokeWidth: 1
|
|
222
|
+
}),
|
|
223
|
+
t.map((e, t) => {
|
|
224
|
+
if (e.values.length === 0) return null;
|
|
225
|
+
let n = me(e.values), r = s.left + y * (t + .5), i = N[t % N.length];
|
|
226
|
+
return /* @__PURE__ */ l("g", {
|
|
227
|
+
"data-box": e.label,
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ c("line", {
|
|
230
|
+
x1: r,
|
|
231
|
+
y1: v(n.whiskerMax),
|
|
232
|
+
x2: r,
|
|
233
|
+
y2: v(n.whiskerMin),
|
|
234
|
+
stroke: i,
|
|
235
|
+
strokeWidth: 1.5
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ c("line", {
|
|
238
|
+
x1: r - b * .3,
|
|
239
|
+
y1: v(n.whiskerMin),
|
|
240
|
+
x2: r + b * .3,
|
|
241
|
+
y2: v(n.whiskerMin),
|
|
242
|
+
stroke: i,
|
|
243
|
+
strokeWidth: 1.5
|
|
244
|
+
}),
|
|
245
|
+
/* @__PURE__ */ c("line", {
|
|
246
|
+
x1: r - b * .3,
|
|
247
|
+
y1: v(n.whiskerMax),
|
|
248
|
+
x2: r + b * .3,
|
|
249
|
+
y2: v(n.whiskerMax),
|
|
250
|
+
stroke: i,
|
|
251
|
+
strokeWidth: 1.5
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ c("rect", {
|
|
254
|
+
x: r - b / 2,
|
|
255
|
+
y: v(n.q3),
|
|
256
|
+
width: b,
|
|
257
|
+
height: v(n.q1) - v(n.q3),
|
|
258
|
+
fill: i,
|
|
259
|
+
fillOpacity: .2,
|
|
260
|
+
stroke: i,
|
|
261
|
+
strokeWidth: 1.5
|
|
262
|
+
}),
|
|
263
|
+
/* @__PURE__ */ c("line", {
|
|
264
|
+
x1: r - b / 2,
|
|
265
|
+
y1: v(n.median),
|
|
266
|
+
x2: r + b / 2,
|
|
267
|
+
y2: v(n.median),
|
|
268
|
+
stroke: i,
|
|
269
|
+
strokeWidth: 2
|
|
270
|
+
}),
|
|
271
|
+
/* @__PURE__ */ c("text", {
|
|
272
|
+
x: r,
|
|
273
|
+
y: s.top + d + 20,
|
|
274
|
+
textAnchor: "middle",
|
|
275
|
+
fill: "var(--gds-fg-muted, #9ca3af)",
|
|
276
|
+
fontSize: 10,
|
|
277
|
+
children: e.label
|
|
278
|
+
})
|
|
279
|
+
]
|
|
280
|
+
}, e.label);
|
|
281
|
+
})
|
|
282
|
+
]
|
|
283
|
+
})
|
|
284
|
+
});
|
|
285
|
+
}), ge = n(function({ data: t, xLabel: n, yLabel: r, height: i = 300, glass: a, className: o, ...s }, u) {
|
|
286
|
+
return /* @__PURE__ */ c("div", {
|
|
287
|
+
className: e("w-full gds-radius-popover border border-[var(--gds-border,#e5e7eb)]", a && "backdrop-blur-md bg-white/5", o),
|
|
288
|
+
"data-component": "bubble-chart",
|
|
289
|
+
ref: u,
|
|
290
|
+
...s,
|
|
291
|
+
children: /* @__PURE__ */ c(w, {
|
|
292
|
+
height: i,
|
|
293
|
+
width: "100%",
|
|
294
|
+
children: /* @__PURE__ */ l(E, { children: [
|
|
295
|
+
/* @__PURE__ */ c(O, {
|
|
296
|
+
dataKey: "x",
|
|
297
|
+
name: n,
|
|
298
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
299
|
+
tick: { fontSize: 11 },
|
|
300
|
+
type: "number"
|
|
301
|
+
}),
|
|
302
|
+
/* @__PURE__ */ c(k, {
|
|
303
|
+
dataKey: "y",
|
|
304
|
+
name: r,
|
|
305
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
306
|
+
tick: { fontSize: 11 },
|
|
307
|
+
type: "number"
|
|
308
|
+
}),
|
|
309
|
+
/* @__PURE__ */ c(le, {
|
|
310
|
+
dataKey: "z",
|
|
311
|
+
range: [20, 400],
|
|
312
|
+
type: "number"
|
|
313
|
+
}),
|
|
314
|
+
/* @__PURE__ */ c(D, {}),
|
|
315
|
+
/* @__PURE__ */ c(T, {
|
|
316
|
+
data: t,
|
|
317
|
+
fill: "var(--gds-accent)",
|
|
318
|
+
fillOpacity: .6
|
|
319
|
+
})
|
|
320
|
+
] })
|
|
321
|
+
})
|
|
322
|
+
});
|
|
323
|
+
}), P = 400, F = 28, I = 50;
|
|
324
|
+
function _e({ actual: t, className: n, label: r, max: i, ranges: o, target: s }) {
|
|
325
|
+
let u = a(() => {
|
|
326
|
+
let e = o ?? [
|
|
327
|
+
i * .33,
|
|
328
|
+
i * .66,
|
|
329
|
+
i
|
|
330
|
+
], n = (e) => e / i * P;
|
|
331
|
+
return {
|
|
332
|
+
actualWidth: n(Math.min(t, i)),
|
|
333
|
+
rangeWidths: e.map((e) => n(Math.min(e, i))),
|
|
334
|
+
targetX: n(Math.min(s, i))
|
|
335
|
+
};
|
|
336
|
+
}, [
|
|
337
|
+
t,
|
|
338
|
+
i,
|
|
339
|
+
s,
|
|
340
|
+
o
|
|
341
|
+
]), d = (I - F) / 2;
|
|
342
|
+
return /* @__PURE__ */ l("div", {
|
|
343
|
+
className: e("select-none", n),
|
|
344
|
+
"data-component": "bullet-chart",
|
|
345
|
+
children: [r !== void 0 && /* @__PURE__ */ c("div", {
|
|
346
|
+
className: "mb-1 text-xs font-medium text-fg-muted",
|
|
347
|
+
children: r
|
|
348
|
+
}), /* @__PURE__ */ l("svg", {
|
|
349
|
+
height: I,
|
|
350
|
+
viewBox: `0 0 ${P} ${I}`,
|
|
351
|
+
width: "100%",
|
|
352
|
+
children: [
|
|
353
|
+
u.rangeWidths.map((e, t) => /* @__PURE__ */ c("rect", {
|
|
354
|
+
fill: `var(--gds-palette-${7 - t})`,
|
|
355
|
+
height: F,
|
|
356
|
+
opacity: .15 + t * .08,
|
|
357
|
+
rx: 4,
|
|
358
|
+
width: e,
|
|
359
|
+
x: 0,
|
|
360
|
+
y: d
|
|
361
|
+
}, t)),
|
|
362
|
+
/* @__PURE__ */ c("rect", {
|
|
363
|
+
fill: "var(--gds-accent)",
|
|
364
|
+
height: F * .5,
|
|
365
|
+
rx: 3,
|
|
366
|
+
width: u.actualWidth,
|
|
367
|
+
x: 0,
|
|
368
|
+
y: d + F * .25
|
|
369
|
+
}),
|
|
370
|
+
/* @__PURE__ */ c("line", {
|
|
371
|
+
stroke: "var(--gds-fg)",
|
|
372
|
+
strokeWidth: 2.5,
|
|
373
|
+
x1: u.targetX,
|
|
374
|
+
x2: u.targetX,
|
|
375
|
+
y1: d - 2,
|
|
376
|
+
y2: d + F + 2
|
|
377
|
+
})
|
|
378
|
+
]
|
|
379
|
+
})]
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/l6-charts/bump-chart.tsx
|
|
384
|
+
var L = [
|
|
385
|
+
"var(--gds-palette-0, #6366f1)",
|
|
386
|
+
"var(--gds-palette-1, #8b5cf6)",
|
|
387
|
+
"var(--gds-palette-2, #06b6d4)",
|
|
388
|
+
"var(--gds-palette-3, #10b981)",
|
|
389
|
+
"var(--gds-palette-4, #f59e0b)",
|
|
390
|
+
"var(--gds-palette-5, #ef4444)",
|
|
391
|
+
"var(--gds-palette-6, #ec4899)",
|
|
392
|
+
"var(--gds-palette-7, #14b8a6)",
|
|
393
|
+
"var(--gds-palette-8, #f97316)",
|
|
394
|
+
"var(--gds-palette-9, #a855f7)"
|
|
395
|
+
], ve = n(function({ data: t, series: n, xKey: r = "name", height: i = 300, glass: a, className: o, ...s }, u) {
|
|
396
|
+
return /* @__PURE__ */ c("div", {
|
|
397
|
+
ref: u,
|
|
398
|
+
className: e("w-full gds-radius-popover border border-border", a && "backdrop-blur-md bg-white/5", o),
|
|
399
|
+
"data-component": "bump-chart",
|
|
400
|
+
...s,
|
|
401
|
+
children: /* @__PURE__ */ c(w, {
|
|
402
|
+
height: i,
|
|
403
|
+
width: "100%",
|
|
404
|
+
children: /* @__PURE__ */ l(x, {
|
|
405
|
+
data: t,
|
|
406
|
+
children: [
|
|
407
|
+
/* @__PURE__ */ c(m, {
|
|
408
|
+
stroke: "var(--gds-border, #e5e7eb)",
|
|
409
|
+
strokeDasharray: "3 3"
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ c(O, {
|
|
412
|
+
dataKey: r,
|
|
413
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
414
|
+
tick: { fontSize: 11 }
|
|
415
|
+
}),
|
|
416
|
+
/* @__PURE__ */ c(k, {
|
|
417
|
+
reversed: !0,
|
|
418
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
419
|
+
tick: { fontSize: 11 }
|
|
420
|
+
}),
|
|
421
|
+
/* @__PURE__ */ c(D, {}),
|
|
422
|
+
n.map((e, t) => /* @__PURE__ */ c(b, {
|
|
423
|
+
dataKey: e,
|
|
424
|
+
dot: {
|
|
425
|
+
r: 4,
|
|
426
|
+
fill: L[t % L.length]
|
|
427
|
+
},
|
|
428
|
+
stroke: L[t % L.length],
|
|
429
|
+
strokeWidth: 2,
|
|
430
|
+
type: "monotone"
|
|
431
|
+
}, e))
|
|
432
|
+
]
|
|
433
|
+
})
|
|
434
|
+
})
|
|
435
|
+
});
|
|
436
|
+
}), ye = [
|
|
437
|
+
"Mon",
|
|
438
|
+
"",
|
|
439
|
+
"Wed",
|
|
440
|
+
"",
|
|
441
|
+
"Fri",
|
|
442
|
+
"",
|
|
443
|
+
""
|
|
444
|
+
], be = [
|
|
445
|
+
"Jan",
|
|
446
|
+
"Feb",
|
|
447
|
+
"Mar",
|
|
448
|
+
"Apr",
|
|
449
|
+
"May",
|
|
450
|
+
"Jun",
|
|
451
|
+
"Jul",
|
|
452
|
+
"Aug",
|
|
453
|
+
"Sep",
|
|
454
|
+
"Oct",
|
|
455
|
+
"Nov",
|
|
456
|
+
"Dec"
|
|
457
|
+
];
|
|
458
|
+
function R(e) {
|
|
459
|
+
return (e.getDay() + 6) % 7;
|
|
460
|
+
}
|
|
461
|
+
function xe(e) {
|
|
462
|
+
let t = e.map((e) => e.value).filter((e) => e > 0).sort((e, t) => e - t), n = [];
|
|
463
|
+
if (t.length > 0) for (let e = 1; e <= 4; e++) {
|
|
464
|
+
let r = Math.min(Math.floor(e / 4 * t.length), t.length - 1);
|
|
465
|
+
n.push(t[r]);
|
|
466
|
+
}
|
|
467
|
+
return n;
|
|
468
|
+
}
|
|
469
|
+
function Se(e, t) {
|
|
470
|
+
if (e <= 0) return 0;
|
|
471
|
+
for (let n = 0; n < t.length; n++) if (e <= t[n]) return n + 1;
|
|
472
|
+
return 4;
|
|
473
|
+
}
|
|
474
|
+
function Ce(e, t, n, r) {
|
|
475
|
+
let i = n === void 0 ? /* @__PURE__ */ new Date() : new Date(n), a = t === void 0 ? new Date(i.getFullYear() - 1, i.getMonth(), i.getDate() + 1) : new Date(t), o = /* @__PURE__ */ new Map();
|
|
476
|
+
for (let t of e) o.set(t.date, t.value);
|
|
477
|
+
let s = xe(e), c = [], l = [], u = 0, d = -1, f = new Date(a), p = R(f);
|
|
478
|
+
for (p > 0 && f.setDate(f.getDate() - p); f <= i;) {
|
|
479
|
+
let e = R(f), t = f.toISOString().slice(0, 10), n = o.get(t) ?? 0;
|
|
480
|
+
f.getMonth() !== d && e <= 3 && (l.push({
|
|
481
|
+
label: be[f.getMonth()],
|
|
482
|
+
x: u * r
|
|
483
|
+
}), d = f.getMonth()), c.push({
|
|
484
|
+
x: u * r,
|
|
485
|
+
y: e * r,
|
|
486
|
+
date: t,
|
|
487
|
+
value: n,
|
|
488
|
+
level: Se(n, s)
|
|
489
|
+
}), e === 6 && u++, f.setDate(f.getDate() + 1);
|
|
490
|
+
}
|
|
491
|
+
return {
|
|
492
|
+
cells: c,
|
|
493
|
+
monthLabels: l,
|
|
494
|
+
weeks: u + 1
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/l6-charts/calendar-heatmap.tsx
|
|
499
|
+
var we = n(function({ data: n, startDate: r, endDate: i, colorScale: o = [
|
|
500
|
+
"var(--gds-bg-tertiary)",
|
|
501
|
+
"var(--gds-accent-dim, rgba(99,179,163,0.3))",
|
|
502
|
+
"var(--gds-accent-muted, rgba(99,179,163,0.55))",
|
|
503
|
+
"var(--gds-accent-soft, rgba(99,179,163,0.75))",
|
|
504
|
+
"var(--gds-accent)"
|
|
505
|
+
], cellSize: u = 12, glass: d, className: f }, p) {
|
|
506
|
+
let [m, h] = s(null), g = u + 2, { cells: _, monthLabels: v, weeks: y } = a(() => Ce(n, r, i, g), [
|
|
507
|
+
n,
|
|
508
|
+
r,
|
|
509
|
+
i,
|
|
510
|
+
g
|
|
511
|
+
]), b = 28 + y * g, x = 14 + 7 * g;
|
|
512
|
+
return /* @__PURE__ */ l("div", {
|
|
513
|
+
className: e("relative inline-block", d === !0 && e(t(d), "rounded-lg border border-white/10 p-3"), f),
|
|
514
|
+
"data-component": "calendar-heatmap",
|
|
515
|
+
children: [/* @__PURE__ */ l("svg", {
|
|
516
|
+
ref: p,
|
|
517
|
+
height: x,
|
|
518
|
+
width: b,
|
|
519
|
+
children: [
|
|
520
|
+
v.map((e) => /* @__PURE__ */ c("text", {
|
|
521
|
+
fill: "var(--gds-fg-muted, #888)",
|
|
522
|
+
fontSize: 9,
|
|
523
|
+
x: 28 + e.x,
|
|
524
|
+
y: 10,
|
|
525
|
+
children: e.label
|
|
526
|
+
}, `${e.label}-${e.x}`)),
|
|
527
|
+
ye.map((e, t) => e === "" ? null : /* @__PURE__ */ c("text", {
|
|
528
|
+
fill: "var(--gds-fg-muted, #888)",
|
|
529
|
+
fontSize: 9,
|
|
530
|
+
textAnchor: "end",
|
|
531
|
+
x: 24,
|
|
532
|
+
y: 14 + t * g + u - 2,
|
|
533
|
+
children: e
|
|
534
|
+
}, e)),
|
|
535
|
+
_.map((e) => /* @__PURE__ */ c("rect", {
|
|
536
|
+
fill: o[e.level] ?? o[o.length - 1],
|
|
537
|
+
height: u,
|
|
538
|
+
rx: 2,
|
|
539
|
+
ry: 2,
|
|
540
|
+
width: u,
|
|
541
|
+
x: 28 + e.x,
|
|
542
|
+
y: 14 + e.y,
|
|
543
|
+
onMouseEnter: (t) => {
|
|
544
|
+
let n = t.target.getBoundingClientRect();
|
|
545
|
+
h({
|
|
546
|
+
x: n.x,
|
|
547
|
+
y: n.y,
|
|
548
|
+
text: `${e.date}: ${e.value}`
|
|
549
|
+
});
|
|
550
|
+
},
|
|
551
|
+
onMouseLeave: () => h(null)
|
|
552
|
+
}, e.date))
|
|
553
|
+
]
|
|
554
|
+
}), m !== null && /* @__PURE__ */ c("div", {
|
|
555
|
+
className: "pointer-events-none fixed z-50 rounded bg-surface px-2 py-1 text-[10px] text-fg shadow-md border border-border",
|
|
556
|
+
style: {
|
|
557
|
+
left: m.x,
|
|
558
|
+
top: m.y - 28
|
|
559
|
+
},
|
|
560
|
+
children: m.text
|
|
561
|
+
})]
|
|
562
|
+
});
|
|
563
|
+
});
|
|
564
|
+
//#endregion
|
|
565
|
+
//#region src/l6-charts/candlestick-chart.tsx
|
|
566
|
+
function Te(e) {
|
|
567
|
+
let { x: t = 0, y: n = 0, width: r = 0, height: i = 0, payload: a } = e;
|
|
568
|
+
if (a === void 0 || i === 0 && a.bodyHeight === 0) return null;
|
|
569
|
+
let o = t + r / 2, s = n, u = n + i;
|
|
570
|
+
return /* @__PURE__ */ l("g", { children: [/* @__PURE__ */ c("line", {
|
|
571
|
+
stroke: a.fill,
|
|
572
|
+
strokeWidth: 1,
|
|
573
|
+
x1: o,
|
|
574
|
+
x2: o,
|
|
575
|
+
y1: s - 2,
|
|
576
|
+
y2: u + 2
|
|
577
|
+
}), /* @__PURE__ */ c("rect", {
|
|
578
|
+
fill: a.fill,
|
|
579
|
+
height: Math.max(i, 1),
|
|
580
|
+
rx: 1,
|
|
581
|
+
width: Math.max(r - 2, 2),
|
|
582
|
+
x: t + 1,
|
|
583
|
+
y: n
|
|
584
|
+
})] });
|
|
585
|
+
}
|
|
586
|
+
var Ee = n(function({ data: t, height: n = 300, upColor: r = "var(--gds-success, #22c55e)", downColor: i = "var(--gds-danger, #ef4444)", glass: o, className: s, ...u }, d) {
|
|
587
|
+
let p = a(() => t.map((e) => ({
|
|
588
|
+
date: e.date,
|
|
589
|
+
bodyBottom: Math.min(e.open, e.close),
|
|
590
|
+
bodyHeight: Math.abs(e.close - e.open),
|
|
591
|
+
fill: e.close >= e.open ? r : i,
|
|
592
|
+
high: e.high,
|
|
593
|
+
low: e.low
|
|
594
|
+
})), [
|
|
595
|
+
t,
|
|
596
|
+
r,
|
|
597
|
+
i
|
|
598
|
+
]), h = a(() => {
|
|
599
|
+
let e = t.map((e) => e.low), n = t.map((e) => e.high);
|
|
600
|
+
return [Math.min(...e), Math.max(...n)];
|
|
601
|
+
}, [t]);
|
|
602
|
+
return /* @__PURE__ */ c("div", {
|
|
603
|
+
className: e("w-full gds-radius-popover border border-[var(--gds-border,#e5e7eb)]", o && "backdrop-blur-md bg-white/5", s),
|
|
604
|
+
"data-component": "candlestick-chart",
|
|
605
|
+
ref: d,
|
|
606
|
+
...u,
|
|
607
|
+
children: /* @__PURE__ */ c(w, {
|
|
608
|
+
height: n,
|
|
609
|
+
width: "100%",
|
|
610
|
+
children: /* @__PURE__ */ l(g, {
|
|
611
|
+
data: p,
|
|
612
|
+
children: [
|
|
613
|
+
/* @__PURE__ */ c(m, {
|
|
614
|
+
stroke: "var(--gds-border, #e5e7eb)",
|
|
615
|
+
strokeDasharray: "3 3"
|
|
616
|
+
}),
|
|
617
|
+
/* @__PURE__ */ c(O, {
|
|
618
|
+
dataKey: "date",
|
|
619
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
620
|
+
tick: { fontSize: 11 }
|
|
621
|
+
}),
|
|
622
|
+
/* @__PURE__ */ c(k, {
|
|
623
|
+
domain: h,
|
|
624
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
625
|
+
tick: { fontSize: 11 }
|
|
626
|
+
}),
|
|
627
|
+
/* @__PURE__ */ c(D, {}),
|
|
628
|
+
/* @__PURE__ */ c(f, {
|
|
629
|
+
dataKey: "bodyHeight",
|
|
630
|
+
shape: /* @__PURE__ */ c(Te, {}),
|
|
631
|
+
stackId: "candle"
|
|
632
|
+
})
|
|
633
|
+
]
|
|
634
|
+
})
|
|
635
|
+
})
|
|
636
|
+
});
|
|
637
|
+
}), z = [
|
|
638
|
+
"var(--gds-palette-0, #6366f1)",
|
|
639
|
+
"var(--gds-palette-1, #8b5cf6)",
|
|
640
|
+
"var(--gds-palette-2, #06b6d4)",
|
|
641
|
+
"var(--gds-palette-3, #10b981)",
|
|
642
|
+
"var(--gds-palette-4, #f59e0b)",
|
|
643
|
+
"var(--gds-palette-5, #ef4444)",
|
|
644
|
+
"var(--gds-palette-6, #ec4899)",
|
|
645
|
+
"var(--gds-palette-7, #14b8a6)",
|
|
646
|
+
"var(--gds-palette-8, #f97316)",
|
|
647
|
+
"var(--gds-palette-9, #a855f7)"
|
|
648
|
+
];
|
|
649
|
+
function B(e, t, n, r) {
|
|
650
|
+
return {
|
|
651
|
+
x: e + n * Math.cos(r),
|
|
652
|
+
y: t + n * Math.sin(r)
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
function De(e, t, n, r, i) {
|
|
656
|
+
let a = B(e, t, n, i), o = B(e, t, n, r), s = i - r > Math.PI ? 1 : 0;
|
|
657
|
+
return `M ${a.x} ${a.y} A ${n} ${n} 0 ${s} 0 ${o.x} ${o.y}`;
|
|
658
|
+
}
|
|
659
|
+
function Oe(e, t, n, r) {
|
|
660
|
+
let i = 2 * Math.PI - n * r, a = [], o = -Math.PI / 2;
|
|
661
|
+
for (let s = 0; s < n; s++) {
|
|
662
|
+
let n = e[s] / t * i;
|
|
663
|
+
a.push({
|
|
664
|
+
start: o,
|
|
665
|
+
end: o + n
|
|
666
|
+
}), o += n + r;
|
|
667
|
+
}
|
|
668
|
+
return a;
|
|
669
|
+
}
|
|
670
|
+
function ke(e, t, n, r, i) {
|
|
671
|
+
let a = 2 * Math.PI - r * i, o = [], s = t.map((e) => e.start);
|
|
672
|
+
for (let t = 0; t < r; t++) for (let i = t + 1; i < r; i++) {
|
|
673
|
+
if (e[t][i] + e[i][t] <= 0) continue;
|
|
674
|
+
let r = e[t][i] / n * a, c = e[i][t] / n * a;
|
|
675
|
+
o.push({
|
|
676
|
+
source: t,
|
|
677
|
+
target: i,
|
|
678
|
+
sourceStart: s[t],
|
|
679
|
+
sourceEnd: s[t] + r,
|
|
680
|
+
targetStart: s[i],
|
|
681
|
+
targetEnd: s[i] + c
|
|
682
|
+
}), s[t] += r, s[i] += c;
|
|
683
|
+
}
|
|
684
|
+
return o;
|
|
685
|
+
}
|
|
686
|
+
function Ae(e, t, n, r) {
|
|
687
|
+
let i = B(t, n, r, e.sourceStart), a = B(t, n, r, e.sourceEnd), o = B(t, n, r, e.targetStart), s = B(t, n, r, e.targetEnd);
|
|
688
|
+
return [
|
|
689
|
+
`M ${i.x} ${i.y}`,
|
|
690
|
+
`A ${r} ${r} 0 0 1 ${a.x} ${a.y}`,
|
|
691
|
+
`Q ${t} ${n} ${o.x} ${o.y}`,
|
|
692
|
+
`A ${r} ${r} 0 0 1 ${s.x} ${s.y}`,
|
|
693
|
+
`Q ${t} ${n} ${i.x} ${i.y}`,
|
|
694
|
+
"Z"
|
|
695
|
+
].join(" ");
|
|
696
|
+
}
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region src/l6-charts/chord-diagram.tsx
|
|
699
|
+
var je = n(function({ matrix: t, labels: n, width: r = 300, height: i = 300, glass: a, className: o }, s) {
|
|
700
|
+
let u = n.length, d = r / 2, f = i / 2, p = Math.min(r, i) / 2 - 30, m = p - 12, h = .04, g = t.map((e) => e.reduce((e, t) => e + t, 0)), _ = g.reduce((e, t) => e + t, 0);
|
|
701
|
+
if (_ === 0 || u === 0) return /* @__PURE__ */ c("div", {
|
|
702
|
+
ref: s,
|
|
703
|
+
className: e("gds-radius-popover border border-border", a && "backdrop-blur-md bg-white/5", o),
|
|
704
|
+
"data-component": "chord-diagram",
|
|
705
|
+
children: /* @__PURE__ */ c("svg", {
|
|
706
|
+
width: r,
|
|
707
|
+
height: i,
|
|
708
|
+
viewBox: `0 0 ${r} ${i}`
|
|
709
|
+
})
|
|
710
|
+
});
|
|
711
|
+
let v = Oe(g, _, u, h), y = ke(t, v, _, u, h);
|
|
712
|
+
return /* @__PURE__ */ c("div", {
|
|
713
|
+
ref: s,
|
|
714
|
+
className: e("gds-radius-popover border border-border", a && "backdrop-blur-md bg-white/5", o),
|
|
715
|
+
"data-component": "chord-diagram",
|
|
716
|
+
children: /* @__PURE__ */ l("svg", {
|
|
717
|
+
width: r,
|
|
718
|
+
height: i,
|
|
719
|
+
viewBox: `0 0 ${r} ${i}`,
|
|
720
|
+
children: [
|
|
721
|
+
v.map((e, t) => /* @__PURE__ */ c("path", {
|
|
722
|
+
d: De(d, f, p, e.start, e.end),
|
|
723
|
+
"data-arc": n[t],
|
|
724
|
+
fill: "none",
|
|
725
|
+
stroke: z[t % z.length],
|
|
726
|
+
strokeWidth: 12,
|
|
727
|
+
strokeLinecap: "round"
|
|
728
|
+
}, `arc-${n[t]}`)),
|
|
729
|
+
y.map((e, t) => /* @__PURE__ */ c("path", {
|
|
730
|
+
d: Ae(e, d, f, m),
|
|
731
|
+
fill: z[e.source % z.length],
|
|
732
|
+
fillOpacity: .25,
|
|
733
|
+
stroke: z[e.source % z.length],
|
|
734
|
+
strokeOpacity: .4,
|
|
735
|
+
strokeWidth: .5
|
|
736
|
+
}, `chord-${t}`)),
|
|
737
|
+
v.map((e, t) => {
|
|
738
|
+
let r = (e.start + e.end) / 2, i = B(d, f, p + 16, r), a = r > Math.PI / 2 && r < 3 * Math.PI / 2 ? "end" : "start";
|
|
739
|
+
return /* @__PURE__ */ c("text", {
|
|
740
|
+
x: i.x,
|
|
741
|
+
y: i.y,
|
|
742
|
+
textAnchor: a,
|
|
743
|
+
dominantBaseline: "middle",
|
|
744
|
+
fill: "var(--gds-fg-muted, #9ca3af)",
|
|
745
|
+
fontSize: 10,
|
|
746
|
+
children: n[t]
|
|
747
|
+
}, `label-${n[t]}`);
|
|
748
|
+
})
|
|
749
|
+
]
|
|
750
|
+
})
|
|
751
|
+
});
|
|
752
|
+
}), Me = n(function({ data: n, barKey: r, lineKey: i, xKey: a = "name", barColor: o = "var(--gds-accent)", lineColor: s = "var(--gds-success)", height: u = 300, glass: d, className: p, ...h }, _) {
|
|
753
|
+
return /* @__PURE__ */ c("div", {
|
|
754
|
+
className: e("w-full gds-radius-popover border border-white/[0.06]", t(d), p),
|
|
755
|
+
"data-component": "combo-chart",
|
|
756
|
+
ref: _,
|
|
757
|
+
...h,
|
|
758
|
+
children: /* @__PURE__ */ c(w, {
|
|
759
|
+
height: u,
|
|
760
|
+
width: "100%",
|
|
761
|
+
children: /* @__PURE__ */ l(g, {
|
|
762
|
+
data: n,
|
|
763
|
+
children: [
|
|
764
|
+
/* @__PURE__ */ c(m, {
|
|
765
|
+
stroke: "var(--gds-border, #e5e7eb)",
|
|
766
|
+
strokeDasharray: "3 3"
|
|
767
|
+
}),
|
|
768
|
+
/* @__PURE__ */ c(O, {
|
|
769
|
+
dataKey: a,
|
|
770
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
771
|
+
tick: { fontSize: 11 }
|
|
772
|
+
}),
|
|
773
|
+
/* @__PURE__ */ c(k, {
|
|
774
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
775
|
+
tick: { fontSize: 11 }
|
|
776
|
+
}),
|
|
777
|
+
/* @__PURE__ */ c(D, {}),
|
|
778
|
+
/* @__PURE__ */ c(y, {}),
|
|
779
|
+
/* @__PURE__ */ c(f, {
|
|
780
|
+
dataKey: r,
|
|
781
|
+
fill: o,
|
|
782
|
+
radius: [
|
|
783
|
+
4,
|
|
784
|
+
4,
|
|
785
|
+
0,
|
|
786
|
+
0
|
|
787
|
+
]
|
|
788
|
+
}),
|
|
789
|
+
/* @__PURE__ */ c(b, {
|
|
790
|
+
dataKey: i,
|
|
791
|
+
dot: !1,
|
|
792
|
+
stroke: s,
|
|
793
|
+
strokeWidth: 2,
|
|
794
|
+
type: "monotone"
|
|
795
|
+
})
|
|
796
|
+
]
|
|
797
|
+
})
|
|
798
|
+
})
|
|
799
|
+
});
|
|
800
|
+
}), V = [
|
|
801
|
+
"var(--gds-accent)",
|
|
802
|
+
"var(--gds-success)",
|
|
803
|
+
"var(--gds-warning)",
|
|
804
|
+
"var(--gds-danger)"
|
|
805
|
+
];
|
|
806
|
+
function Ne({ className: t, rings: n, size: r = 160 }) {
|
|
807
|
+
let i = r / 2;
|
|
808
|
+
return /* @__PURE__ */ l("div", {
|
|
809
|
+
className: e("select-none", t),
|
|
810
|
+
"data-component": "donut-gauge",
|
|
811
|
+
children: [/* @__PURE__ */ c("svg", {
|
|
812
|
+
height: r,
|
|
813
|
+
viewBox: `0 0 ${r} ${r}`,
|
|
814
|
+
width: r,
|
|
815
|
+
children: n.map((e, t) => {
|
|
816
|
+
let n = i - 12 / 2 - t * 18;
|
|
817
|
+
if (n <= 0) return null;
|
|
818
|
+
let r = 2 * Math.PI * n, a = r * (e.max > 0 ? Math.min(e.value / e.max, 1) : 0), o = e.color ?? V[t % V.length];
|
|
819
|
+
return /* @__PURE__ */ l("g", { children: [/* @__PURE__ */ c("circle", {
|
|
820
|
+
className: "text-fg-muted/10",
|
|
821
|
+
cx: i,
|
|
822
|
+
cy: i,
|
|
823
|
+
fill: "none",
|
|
824
|
+
r: n,
|
|
825
|
+
stroke: "currentColor",
|
|
826
|
+
strokeWidth: 12
|
|
827
|
+
}), /* @__PURE__ */ c("circle", {
|
|
828
|
+
className: "transition-all duration-500",
|
|
829
|
+
cx: i,
|
|
830
|
+
cy: i,
|
|
831
|
+
fill: "none",
|
|
832
|
+
r: n,
|
|
833
|
+
stroke: o,
|
|
834
|
+
strokeDasharray: `${a} ${r - a}`,
|
|
835
|
+
strokeDashoffset: r / 4,
|
|
836
|
+
strokeLinecap: "round",
|
|
837
|
+
strokeWidth: 12
|
|
838
|
+
})] }, t);
|
|
839
|
+
})
|
|
840
|
+
}), /* @__PURE__ */ c("div", {
|
|
841
|
+
className: "mt-2 flex flex-wrap gap-3",
|
|
842
|
+
children: n.map((e, t) => /* @__PURE__ */ l("div", {
|
|
843
|
+
className: "flex items-center gap-1.5 text-xs text-fg-muted",
|
|
844
|
+
children: [
|
|
845
|
+
/* @__PURE__ */ c("div", {
|
|
846
|
+
className: "h-2 w-2 rounded-full",
|
|
847
|
+
style: { backgroundColor: e.color ?? V[t % V.length] }
|
|
848
|
+
}),
|
|
849
|
+
/* @__PURE__ */ c("span", { children: e.label }),
|
|
850
|
+
/* @__PURE__ */ l("span", {
|
|
851
|
+
className: "font-medium text-fg tabular-nums",
|
|
852
|
+
children: [
|
|
853
|
+
e.value,
|
|
854
|
+
"/",
|
|
855
|
+
e.max
|
|
856
|
+
]
|
|
857
|
+
})
|
|
858
|
+
]
|
|
859
|
+
}, t))
|
|
860
|
+
})]
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
//#endregion
|
|
864
|
+
//#region src/l6-charts/flame-chart.tsx
|
|
865
|
+
var H = [
|
|
866
|
+
"var(--gds-palette-0)",
|
|
867
|
+
"var(--gds-palette-1)",
|
|
868
|
+
"var(--gds-palette-2)",
|
|
869
|
+
"var(--gds-palette-3)",
|
|
870
|
+
"var(--gds-palette-4)",
|
|
871
|
+
"var(--gds-palette-5)",
|
|
872
|
+
"var(--gds-palette-6)",
|
|
873
|
+
"var(--gds-palette-7)"
|
|
874
|
+
];
|
|
875
|
+
function U(e, t, n, r, i, a) {
|
|
876
|
+
let o = i > 0 ? e.value / i * r : 0, s = [{
|
|
877
|
+
color: H[a % H.length],
|
|
878
|
+
depth: t,
|
|
879
|
+
name: e.name,
|
|
880
|
+
width: o,
|
|
881
|
+
x: n
|
|
882
|
+
}];
|
|
883
|
+
if (e.children !== void 0) {
|
|
884
|
+
let i = n;
|
|
885
|
+
e.children.forEach((n, o) => {
|
|
886
|
+
s.push(...U(n, t + 1, i, r, e.value, a + o + 1)), i += e.value > 0 ? n.value / e.value * r : 0;
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
return s;
|
|
890
|
+
}
|
|
891
|
+
var W = 24, G = 600;
|
|
892
|
+
function Pe({ className: t, data: n, height: r = 200 }) {
|
|
893
|
+
let i = a(() => U(n, 0, 0, G, n.value, 0), [n]), o = i.reduce((e, t) => Math.max(e, t.depth), 0), s = Math.max(r, (o + 1) * W);
|
|
894
|
+
return /* @__PURE__ */ c("div", {
|
|
895
|
+
className: e("inline-block overflow-x-auto", t),
|
|
896
|
+
"data-component": "flame-chart",
|
|
897
|
+
children: /* @__PURE__ */ c("svg", {
|
|
898
|
+
height: s,
|
|
899
|
+
viewBox: `0 0 ${G} ${s}`,
|
|
900
|
+
width: G,
|
|
901
|
+
children: i.map((e, t) => /* @__PURE__ */ l("g", { children: [/* @__PURE__ */ c("rect", {
|
|
902
|
+
fill: e.color,
|
|
903
|
+
fillOpacity: .8,
|
|
904
|
+
height: W - 2,
|
|
905
|
+
rx: 2,
|
|
906
|
+
width: Math.max(e.width - 1, 0),
|
|
907
|
+
x: e.x,
|
|
908
|
+
y: e.depth * W
|
|
909
|
+
}), e.width > 40 && /* @__PURE__ */ c("text", {
|
|
910
|
+
dominantBaseline: "middle",
|
|
911
|
+
fill: "var(--gds-fg)",
|
|
912
|
+
fontSize: 10,
|
|
913
|
+
x: e.x + 4,
|
|
914
|
+
y: e.depth * W + W / 2 - 1,
|
|
915
|
+
children: e.name
|
|
916
|
+
})] }, t))
|
|
917
|
+
})
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
//#endregion
|
|
921
|
+
//#region src/l6-charts/flow-chart.tsx
|
|
922
|
+
var Fe = {
|
|
923
|
+
start: "var(--gds-palette-3, #10b981)",
|
|
924
|
+
end: "var(--gds-palette-5, #ef4444)",
|
|
925
|
+
process: "var(--gds-palette-0, #6366f1)",
|
|
926
|
+
decision: "var(--gds-palette-4, #f59e0b)"
|
|
927
|
+
}, K = 100, q = 40;
|
|
928
|
+
function Ie(e, t, n) {
|
|
929
|
+
let r = Fe[e.type ?? "process"], i = e.type ?? "process";
|
|
930
|
+
if (i === "decision") {
|
|
931
|
+
let i = q * .7;
|
|
932
|
+
return /* @__PURE__ */ l("g", {
|
|
933
|
+
"data-node": e.id,
|
|
934
|
+
children: [/* @__PURE__ */ c("polygon", {
|
|
935
|
+
points: `${t},${n - i} ${t + i},${n} ${t},${n + i} ${t - i},${n}`,
|
|
936
|
+
fill: r,
|
|
937
|
+
fillOpacity: .15,
|
|
938
|
+
stroke: r,
|
|
939
|
+
strokeWidth: 1.5
|
|
940
|
+
}), /* @__PURE__ */ c("text", {
|
|
941
|
+
x: t,
|
|
942
|
+
y: n + 4,
|
|
943
|
+
textAnchor: "middle",
|
|
944
|
+
fill: "var(--gds-fg, #e5e7eb)",
|
|
945
|
+
fontSize: 10,
|
|
946
|
+
children: e.label
|
|
947
|
+
})]
|
|
948
|
+
}, e.id);
|
|
949
|
+
}
|
|
950
|
+
let a = i === "start" || i === "end" ? q / 2 : 4;
|
|
951
|
+
return /* @__PURE__ */ l("g", {
|
|
952
|
+
"data-node": e.id,
|
|
953
|
+
children: [/* @__PURE__ */ c("rect", {
|
|
954
|
+
x: t - K / 2,
|
|
955
|
+
y: n - q / 2,
|
|
956
|
+
width: K,
|
|
957
|
+
height: q,
|
|
958
|
+
rx: a,
|
|
959
|
+
fill: r,
|
|
960
|
+
fillOpacity: .15,
|
|
961
|
+
stroke: r,
|
|
962
|
+
strokeWidth: 1.5
|
|
963
|
+
}), /* @__PURE__ */ c("text", {
|
|
964
|
+
x: t,
|
|
965
|
+
y: n + 4,
|
|
966
|
+
textAnchor: "middle",
|
|
967
|
+
fill: "var(--gds-fg, #e5e7eb)",
|
|
968
|
+
fontSize: 10,
|
|
969
|
+
children: e.label
|
|
970
|
+
})]
|
|
971
|
+
}, e.id);
|
|
972
|
+
}
|
|
973
|
+
var Le = n(function({ nodes: t, edges: n, width: r = 600, height: i = 200, glass: a, className: o }, s) {
|
|
974
|
+
let u = t.length > 1 ? (r - 80) / (t.length - 1) : 0, d = t.length === 1 ? r / 2 : 40, f = i / 2, p = new Map(t.map((e, t) => [e.id, {
|
|
975
|
+
x: d + t * u,
|
|
976
|
+
y: f
|
|
977
|
+
}]));
|
|
978
|
+
return /* @__PURE__ */ c("div", {
|
|
979
|
+
ref: s,
|
|
980
|
+
className: e("gds-radius-popover border border-border", a && "backdrop-blur-md bg-white/5", o),
|
|
981
|
+
"data-component": "flow-chart",
|
|
982
|
+
children: /* @__PURE__ */ l("svg", {
|
|
983
|
+
width: r,
|
|
984
|
+
height: i,
|
|
985
|
+
viewBox: `0 0 ${r} ${i}`,
|
|
986
|
+
children: [
|
|
987
|
+
/* @__PURE__ */ c("defs", { children: /* @__PURE__ */ c("marker", {
|
|
988
|
+
id: "gds-arrow",
|
|
989
|
+
markerWidth: "8",
|
|
990
|
+
markerHeight: "6",
|
|
991
|
+
refX: "8",
|
|
992
|
+
refY: "3",
|
|
993
|
+
orient: "auto",
|
|
994
|
+
children: /* @__PURE__ */ c("path", {
|
|
995
|
+
d: "M0,0 L8,3 L0,6",
|
|
996
|
+
fill: "var(--gds-fg-muted, #6b7280)"
|
|
997
|
+
})
|
|
998
|
+
}) }),
|
|
999
|
+
n.map((e, t) => {
|
|
1000
|
+
let n = p.get(e.from), r = p.get(e.to);
|
|
1001
|
+
if (n === void 0 || r === void 0) return null;
|
|
1002
|
+
let i = n.x + K / 2, a = r.x - K / 2, o = (i + a) / 2, s = (n.y + r.y) / 2;
|
|
1003
|
+
return /* @__PURE__ */ l("g", { children: [/* @__PURE__ */ c("line", {
|
|
1004
|
+
x1: i,
|
|
1005
|
+
y1: n.y,
|
|
1006
|
+
x2: a,
|
|
1007
|
+
y2: r.y,
|
|
1008
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1009
|
+
strokeWidth: 1.5,
|
|
1010
|
+
markerEnd: "url(#gds-arrow)"
|
|
1011
|
+
}), e.label !== void 0 && /* @__PURE__ */ c("text", {
|
|
1012
|
+
x: o,
|
|
1013
|
+
y: s - 8,
|
|
1014
|
+
textAnchor: "middle",
|
|
1015
|
+
fill: "var(--gds-fg-muted, #9ca3af)",
|
|
1016
|
+
fontSize: 9,
|
|
1017
|
+
children: e.label
|
|
1018
|
+
})] }, t);
|
|
1019
|
+
}),
|
|
1020
|
+
t.map((e, t) => {
|
|
1021
|
+
let n = p.get(e.id);
|
|
1022
|
+
return n === void 0 ? null : Ie(e, n.x, n.y);
|
|
1023
|
+
})
|
|
1024
|
+
]
|
|
1025
|
+
})
|
|
1026
|
+
});
|
|
1027
|
+
}), Re = [
|
|
1028
|
+
"var(--gds-palette-0, #6366f1)",
|
|
1029
|
+
"var(--gds-palette-1, #22d3ee)",
|
|
1030
|
+
"var(--gds-palette-2, #f59e0b)",
|
|
1031
|
+
"var(--gds-palette-3, #10b981)",
|
|
1032
|
+
"var(--gds-palette-4, #ef4444)",
|
|
1033
|
+
"var(--gds-palette-5, #8b5cf6)",
|
|
1034
|
+
"var(--gds-palette-6, #ec4899)",
|
|
1035
|
+
"var(--gds-palette-7, #14b8a6)",
|
|
1036
|
+
"var(--gds-palette-8, #f97316)",
|
|
1037
|
+
"var(--gds-palette-9, #3b82f6)"
|
|
1038
|
+
], ze = n(function({ data: t, dataKey: n, className: r, height: i = 300, colors: a = Re, glass: o, ...s }, u) {
|
|
1039
|
+
return /* @__PURE__ */ c("div", {
|
|
1040
|
+
className: e("w-full", o && "gds-radius-popover backdrop-blur-md bg-white/5", r),
|
|
1041
|
+
"data-component": "funnel-chart",
|
|
1042
|
+
ref: u,
|
|
1043
|
+
...s,
|
|
1044
|
+
children: /* @__PURE__ */ c(w, {
|
|
1045
|
+
height: i,
|
|
1046
|
+
width: "100%",
|
|
1047
|
+
children: /* @__PURE__ */ l(v, { children: [/* @__PURE__ */ c(D, {}), /* @__PURE__ */ c(_, {
|
|
1048
|
+
dataKey: n,
|
|
1049
|
+
data: t,
|
|
1050
|
+
isAnimationActive: !1,
|
|
1051
|
+
children: t.map((e, t) => /* @__PURE__ */ c(h, { fill: a[t % a.length] }, t))
|
|
1052
|
+
})] })
|
|
1053
|
+
})
|
|
1054
|
+
});
|
|
1055
|
+
}), Be = n(function({ value: t, max: n = 100, className: r, height: i = 200, color: a = "var(--gds-accent)", trackColor: o = "var(--gds-border, #e5e7eb)", label: s, glass: u, ...d }, f) {
|
|
1056
|
+
let p = Math.min(Math.max(t, 0), n), m = n - p, g = [{
|
|
1057
|
+
name: "value",
|
|
1058
|
+
value: p
|
|
1059
|
+
}, {
|
|
1060
|
+
name: "remaining",
|
|
1061
|
+
value: m
|
|
1062
|
+
}];
|
|
1063
|
+
return /* @__PURE__ */ l("div", {
|
|
1064
|
+
className: e("relative w-full", u && "gds-radius-popover backdrop-blur-md bg-white/5", r),
|
|
1065
|
+
"data-component": "gauge",
|
|
1066
|
+
ref: f,
|
|
1067
|
+
...d,
|
|
1068
|
+
children: [/* @__PURE__ */ c(w, {
|
|
1069
|
+
height: i,
|
|
1070
|
+
width: "100%",
|
|
1071
|
+
children: /* @__PURE__ */ c(C, { children: /* @__PURE__ */ l(S, {
|
|
1072
|
+
cx: "50%",
|
|
1073
|
+
cy: "70%",
|
|
1074
|
+
data: g,
|
|
1075
|
+
dataKey: "value",
|
|
1076
|
+
endAngle: 0,
|
|
1077
|
+
innerRadius: "60%",
|
|
1078
|
+
outerRadius: "80%",
|
|
1079
|
+
startAngle: 180,
|
|
1080
|
+
stroke: "none",
|
|
1081
|
+
children: [/* @__PURE__ */ c(h, { fill: a }), /* @__PURE__ */ c(h, { fill: o })]
|
|
1082
|
+
}) })
|
|
1083
|
+
}), /* @__PURE__ */ l("div", {
|
|
1084
|
+
className: "absolute inset-0 flex flex-col items-center justify-center",
|
|
1085
|
+
style: { top: "20%" },
|
|
1086
|
+
children: [/* @__PURE__ */ c("span", {
|
|
1087
|
+
className: "text-2xl font-semibold",
|
|
1088
|
+
style: { color: a },
|
|
1089
|
+
children: p
|
|
1090
|
+
}), s !== void 0 && /* @__PURE__ */ c("span", {
|
|
1091
|
+
className: "gds-text-body text-[var(--gds-fg-muted,#6b7280)]",
|
|
1092
|
+
children: s
|
|
1093
|
+
})]
|
|
1094
|
+
})]
|
|
1095
|
+
});
|
|
1096
|
+
});
|
|
1097
|
+
//#endregion
|
|
1098
|
+
//#region src/l6-charts/heatmap-chart.tsx
|
|
1099
|
+
function Ve(e, t, n) {
|
|
1100
|
+
let r = (e) => {
|
|
1101
|
+
let t = e.replace("#", "");
|
|
1102
|
+
return [
|
|
1103
|
+
parseInt(t.slice(0, 2), 16),
|
|
1104
|
+
parseInt(t.slice(2, 4), 16),
|
|
1105
|
+
parseInt(t.slice(4, 6), 16)
|
|
1106
|
+
];
|
|
1107
|
+
}, [i, a, o] = r(e), [s, c, l] = r(t);
|
|
1108
|
+
return `rgb(${Math.round(i + (s - i) * n)},${Math.round(a + (c - a) * n)},${Math.round(o + (l - o) * n)})`;
|
|
1109
|
+
}
|
|
1110
|
+
var He = n(function({ data: t, xLabels: n, yLabels: r, colorScale: i = {
|
|
1111
|
+
min: "#1e293b",
|
|
1112
|
+
max: "#6366f1"
|
|
1113
|
+
}, className: o, cellSize: s = 32, glass: u, ...d }, f) {
|
|
1114
|
+
let { dataMin: p, dataMax: m } = a(() => {
|
|
1115
|
+
let e = t.flat();
|
|
1116
|
+
return {
|
|
1117
|
+
dataMin: Math.min(...e),
|
|
1118
|
+
dataMax: Math.max(...e)
|
|
1119
|
+
};
|
|
1120
|
+
}, [t]), h = (e) => m === p ? .5 : (e - p) / (m - p);
|
|
1121
|
+
return /* @__PURE__ */ c("div", {
|
|
1122
|
+
className: e("inline-block", u && "gds-radius-popover backdrop-blur-md bg-white/5", o),
|
|
1123
|
+
"data-component": "heatmap-chart",
|
|
1124
|
+
ref: f,
|
|
1125
|
+
...d,
|
|
1126
|
+
children: /* @__PURE__ */ l("div", {
|
|
1127
|
+
className: "flex flex-col gap-px",
|
|
1128
|
+
children: [n !== void 0 && /* @__PURE__ */ c("div", {
|
|
1129
|
+
className: "flex gap-px",
|
|
1130
|
+
style: { paddingLeft: r === void 0 ? 0 : s + 4 },
|
|
1131
|
+
children: n.map((e) => /* @__PURE__ */ c("div", {
|
|
1132
|
+
className: "flex items-center justify-center gds-text-caption text-[var(--gds-fg-muted,#6b7280)]",
|
|
1133
|
+
style: {
|
|
1134
|
+
width: s,
|
|
1135
|
+
height: 16
|
|
1136
|
+
},
|
|
1137
|
+
children: e
|
|
1138
|
+
}, e))
|
|
1139
|
+
}), t.map((e, t) => /* @__PURE__ */ l("div", {
|
|
1140
|
+
className: "flex items-center gap-px",
|
|
1141
|
+
children: [r !== void 0 && r[t] !== void 0 && /* @__PURE__ */ c("div", {
|
|
1142
|
+
className: "flex-shrink-0 text-right gds-text-caption text-[var(--gds-fg-muted,#6b7280)] pr-1",
|
|
1143
|
+
style: { width: s },
|
|
1144
|
+
children: r[t]
|
|
1145
|
+
}), e.map((e, t) => /* @__PURE__ */ c("div", {
|
|
1146
|
+
className: "rounded-sm",
|
|
1147
|
+
style: {
|
|
1148
|
+
width: s,
|
|
1149
|
+
height: s,
|
|
1150
|
+
backgroundColor: Ve(i.min, i.max, h(e))
|
|
1151
|
+
},
|
|
1152
|
+
title: String(e)
|
|
1153
|
+
}, t))]
|
|
1154
|
+
}, t))]
|
|
1155
|
+
})
|
|
1156
|
+
});
|
|
1157
|
+
});
|
|
1158
|
+
//#endregion
|
|
1159
|
+
//#region src/l6-charts/histogram.tsx
|
|
1160
|
+
function Ue(e, t) {
|
|
1161
|
+
if (e.length === 0) return [];
|
|
1162
|
+
let n = Math.min(...e), r = Math.max(...e) - n, i = r === 0 ? 1 : r / t;
|
|
1163
|
+
return Array.from({ length: t }, (r, a) => {
|
|
1164
|
+
let o = n + a * i, s = o + i, c = e.filter((e) => a === t - 1 ? e >= o && e <= s : e >= o && e < s).length;
|
|
1165
|
+
return {
|
|
1166
|
+
range: `${o.toFixed(1)}–${s.toFixed(1)}`,
|
|
1167
|
+
count: c
|
|
1168
|
+
};
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
var We = n(function({ data: t, bins: n = 10, height: r = 300, color: i = "var(--gds-accent)", glass: a, className: o, ...s }, u) {
|
|
1172
|
+
let d = Ue(t, n);
|
|
1173
|
+
return /* @__PURE__ */ c("div", {
|
|
1174
|
+
className: e("w-full gds-radius-popover border border-border", a && "backdrop-blur-md bg-white/5", o),
|
|
1175
|
+
"data-component": "histogram",
|
|
1176
|
+
ref: u,
|
|
1177
|
+
...s,
|
|
1178
|
+
children: /* @__PURE__ */ c(w, {
|
|
1179
|
+
height: r,
|
|
1180
|
+
width: "100%",
|
|
1181
|
+
children: /* @__PURE__ */ l(p, {
|
|
1182
|
+
data: d,
|
|
1183
|
+
children: [
|
|
1184
|
+
/* @__PURE__ */ c(m, {
|
|
1185
|
+
stroke: "var(--gds-border, #e5e7eb)",
|
|
1186
|
+
strokeDasharray: "3 3"
|
|
1187
|
+
}),
|
|
1188
|
+
/* @__PURE__ */ c(O, {
|
|
1189
|
+
dataKey: "range",
|
|
1190
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1191
|
+
tick: { fontSize: 10 }
|
|
1192
|
+
}),
|
|
1193
|
+
/* @__PURE__ */ c(k, {
|
|
1194
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1195
|
+
tick: { fontSize: 11 }
|
|
1196
|
+
}),
|
|
1197
|
+
/* @__PURE__ */ c(D, {}),
|
|
1198
|
+
/* @__PURE__ */ c(f, {
|
|
1199
|
+
dataKey: "count",
|
|
1200
|
+
fill: i,
|
|
1201
|
+
radius: [
|
|
1202
|
+
4,
|
|
1203
|
+
4,
|
|
1204
|
+
0,
|
|
1205
|
+
0
|
|
1206
|
+
]
|
|
1207
|
+
})
|
|
1208
|
+
]
|
|
1209
|
+
})
|
|
1210
|
+
})
|
|
1211
|
+
});
|
|
1212
|
+
}), Ge = n(function({ data: t, dataKey: n, xKey: r = "name", className: i, height: a = 300, color: o = "var(--gds-accent)", glass: s, ...u }, d) {
|
|
1213
|
+
return /* @__PURE__ */ c("div", {
|
|
1214
|
+
className: e("w-full", s && "gds-radius-popover backdrop-blur-md bg-white/5", i),
|
|
1215
|
+
"data-component": "line-chart",
|
|
1216
|
+
ref: d,
|
|
1217
|
+
...u,
|
|
1218
|
+
children: /* @__PURE__ */ c(w, {
|
|
1219
|
+
height: a,
|
|
1220
|
+
width: "100%",
|
|
1221
|
+
children: /* @__PURE__ */ l(x, {
|
|
1222
|
+
data: t,
|
|
1223
|
+
children: [
|
|
1224
|
+
/* @__PURE__ */ c(m, {
|
|
1225
|
+
stroke: "var(--gds-border, #e5e7eb)",
|
|
1226
|
+
strokeDasharray: "3 3"
|
|
1227
|
+
}),
|
|
1228
|
+
/* @__PURE__ */ c(O, {
|
|
1229
|
+
dataKey: r,
|
|
1230
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1231
|
+
tick: { fontSize: 11 }
|
|
1232
|
+
}),
|
|
1233
|
+
/* @__PURE__ */ c(k, {
|
|
1234
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1235
|
+
tick: { fontSize: 11 }
|
|
1236
|
+
}),
|
|
1237
|
+
/* @__PURE__ */ c(D, {}),
|
|
1238
|
+
/* @__PURE__ */ c(b, {
|
|
1239
|
+
dataKey: n,
|
|
1240
|
+
dot: !1,
|
|
1241
|
+
stroke: o,
|
|
1242
|
+
strokeWidth: 2,
|
|
1243
|
+
type: "monotone"
|
|
1244
|
+
})
|
|
1245
|
+
]
|
|
1246
|
+
})
|
|
1247
|
+
})
|
|
1248
|
+
});
|
|
1249
|
+
}), J = [
|
|
1250
|
+
"var(--gds-palette-0, #6366f1)",
|
|
1251
|
+
"var(--gds-palette-1, #8b5cf6)",
|
|
1252
|
+
"var(--gds-palette-2, #06b6d4)",
|
|
1253
|
+
"var(--gds-palette-3, #10b981)",
|
|
1254
|
+
"var(--gds-palette-4, #f59e0b)",
|
|
1255
|
+
"var(--gds-palette-5, #ef4444)",
|
|
1256
|
+
"var(--gds-palette-6, #ec4899)",
|
|
1257
|
+
"var(--gds-palette-7, #14b8a6)",
|
|
1258
|
+
"var(--gds-palette-8, #f97316)",
|
|
1259
|
+
"var(--gds-palette-9, #84cc16)"
|
|
1260
|
+
];
|
|
1261
|
+
function Ke(e, t, n, r) {
|
|
1262
|
+
return Array.from({ length: e }, (i, a) => {
|
|
1263
|
+
let o = 2 * Math.PI * a / e - Math.PI / 2;
|
|
1264
|
+
return {
|
|
1265
|
+
x: t + r * Math.cos(o),
|
|
1266
|
+
y: n + r * Math.sin(o)
|
|
1267
|
+
};
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
var qe = n(function({ nodes: t, edges: n, width: r = 400, height: i = 300, glass: a, className: o }, s) {
|
|
1271
|
+
let u = r / 2, d = i / 2, f = Math.min(u, d) * .65, p = Ke(t.length, u, d, f), m = new Map(t.map((e, t) => [e.id, t])), h = Math.max(8, Math.min(16, 120 / Math.max(t.length, 1)));
|
|
1272
|
+
return /* @__PURE__ */ c("div", {
|
|
1273
|
+
ref: s,
|
|
1274
|
+
className: e("gds-radius-popover border border-border", a && "backdrop-blur-md bg-white/5", o),
|
|
1275
|
+
"data-component": "network-graph",
|
|
1276
|
+
children: /* @__PURE__ */ l("svg", {
|
|
1277
|
+
width: r,
|
|
1278
|
+
height: i,
|
|
1279
|
+
viewBox: `0 0 ${r} ${i}`,
|
|
1280
|
+
children: [n.map((e, t) => {
|
|
1281
|
+
let n = m.get(e.source), r = m.get(e.target);
|
|
1282
|
+
if (n === void 0 || r === void 0) return null;
|
|
1283
|
+
let i = p[n], a = p[r];
|
|
1284
|
+
return /* @__PURE__ */ c("line", {
|
|
1285
|
+
x1: i.x,
|
|
1286
|
+
y1: i.y,
|
|
1287
|
+
x2: a.x,
|
|
1288
|
+
y2: a.y,
|
|
1289
|
+
stroke: "var(--gds-border, #374151)",
|
|
1290
|
+
strokeWidth: 1.5,
|
|
1291
|
+
strokeOpacity: .5
|
|
1292
|
+
}, t);
|
|
1293
|
+
}), t.map((e, t) => {
|
|
1294
|
+
let n = p[t], r = J[(e.group ?? t) % J.length];
|
|
1295
|
+
return /* @__PURE__ */ l("g", { children: [/* @__PURE__ */ c("circle", {
|
|
1296
|
+
cx: n.x,
|
|
1297
|
+
cy: n.y,
|
|
1298
|
+
r: h,
|
|
1299
|
+
fill: r,
|
|
1300
|
+
fillOpacity: .8
|
|
1301
|
+
}), /* @__PURE__ */ c("text", {
|
|
1302
|
+
x: n.x,
|
|
1303
|
+
y: n.y + h + 14,
|
|
1304
|
+
textAnchor: "middle",
|
|
1305
|
+
fill: "var(--gds-fg-muted, #9ca3af)",
|
|
1306
|
+
fontSize: 10,
|
|
1307
|
+
children: e.label
|
|
1308
|
+
})] }, e.id);
|
|
1309
|
+
})]
|
|
1310
|
+
})
|
|
1311
|
+
});
|
|
1312
|
+
}), Je = n(function({ bids: t, asks: n, height: r = 300, bidColor: i = "var(--gds-success, #22c55e)", askColor: o = "var(--gds-danger, #ef4444)", glass: s, className: f, ...p }, h) {
|
|
1313
|
+
let g = a(() => {
|
|
1314
|
+
let e = t.map((e) => ({
|
|
1315
|
+
price: e.price,
|
|
1316
|
+
bidDepth: e.depth,
|
|
1317
|
+
askDepth: void 0
|
|
1318
|
+
})), r = n.map((e) => ({
|
|
1319
|
+
price: e.price,
|
|
1320
|
+
bidDepth: void 0,
|
|
1321
|
+
askDepth: e.depth
|
|
1322
|
+
}));
|
|
1323
|
+
return [...e, ...r].sort((e, t) => e.price - t.price);
|
|
1324
|
+
}, [t, n]);
|
|
1325
|
+
return /* @__PURE__ */ c("div", {
|
|
1326
|
+
ref: h,
|
|
1327
|
+
className: e("w-full gds-radius-popover border border-border", s && "backdrop-blur-md bg-white/5", f),
|
|
1328
|
+
"data-component": "order-book-chart",
|
|
1329
|
+
...p,
|
|
1330
|
+
children: /* @__PURE__ */ c(w, {
|
|
1331
|
+
height: r,
|
|
1332
|
+
width: "100%",
|
|
1333
|
+
children: /* @__PURE__ */ l(d, {
|
|
1334
|
+
data: g,
|
|
1335
|
+
children: [
|
|
1336
|
+
/* @__PURE__ */ c(m, {
|
|
1337
|
+
stroke: "var(--gds-border, #e5e7eb)",
|
|
1338
|
+
strokeDasharray: "3 3"
|
|
1339
|
+
}),
|
|
1340
|
+
/* @__PURE__ */ c(O, {
|
|
1341
|
+
dataKey: "price",
|
|
1342
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1343
|
+
tick: { fontSize: 11 },
|
|
1344
|
+
type: "number",
|
|
1345
|
+
domain: ["dataMin", "dataMax"]
|
|
1346
|
+
}),
|
|
1347
|
+
/* @__PURE__ */ c(k, {
|
|
1348
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1349
|
+
tick: { fontSize: 11 }
|
|
1350
|
+
}),
|
|
1351
|
+
/* @__PURE__ */ c(D, {}),
|
|
1352
|
+
/* @__PURE__ */ c(u, {
|
|
1353
|
+
dataKey: "bidDepth",
|
|
1354
|
+
fill: i,
|
|
1355
|
+
fillOpacity: .3,
|
|
1356
|
+
stroke: i,
|
|
1357
|
+
strokeWidth: 2,
|
|
1358
|
+
type: "stepAfter",
|
|
1359
|
+
connectNulls: !1
|
|
1360
|
+
}),
|
|
1361
|
+
/* @__PURE__ */ c(u, {
|
|
1362
|
+
dataKey: "askDepth",
|
|
1363
|
+
fill: o,
|
|
1364
|
+
fillOpacity: .3,
|
|
1365
|
+
stroke: o,
|
|
1366
|
+
strokeWidth: 2,
|
|
1367
|
+
type: "stepBefore",
|
|
1368
|
+
connectNulls: !1
|
|
1369
|
+
})
|
|
1370
|
+
]
|
|
1371
|
+
})
|
|
1372
|
+
})
|
|
1373
|
+
});
|
|
1374
|
+
}), Ye = [
|
|
1375
|
+
"var(--gds-palette-0, #6366f1)",
|
|
1376
|
+
"var(--gds-palette-1, #22d3ee)",
|
|
1377
|
+
"var(--gds-palette-2, #f59e0b)",
|
|
1378
|
+
"var(--gds-palette-3, #10b981)",
|
|
1379
|
+
"var(--gds-palette-4, #ef4444)",
|
|
1380
|
+
"var(--gds-palette-5, #8b5cf6)",
|
|
1381
|
+
"var(--gds-palette-6, #ec4899)",
|
|
1382
|
+
"var(--gds-palette-7, #14b8a6)",
|
|
1383
|
+
"var(--gds-palette-8, #f97316)",
|
|
1384
|
+
"var(--gds-palette-9, #3b82f6)"
|
|
1385
|
+
], Xe = n(function({ data: t, dataKey: n, nameKey: r = "name", className: i, height: a = 300, colors: o = Ye, innerRadius: s = 0, glass: u, ...d }, f) {
|
|
1386
|
+
return /* @__PURE__ */ c("div", {
|
|
1387
|
+
className: e("w-full", u && "gds-radius-popover backdrop-blur-md bg-white/5", i),
|
|
1388
|
+
"data-component": "pie-chart",
|
|
1389
|
+
ref: f,
|
|
1390
|
+
...d,
|
|
1391
|
+
children: /* @__PURE__ */ c(w, {
|
|
1392
|
+
height: a,
|
|
1393
|
+
width: "100%",
|
|
1394
|
+
children: /* @__PURE__ */ l(C, { children: [/* @__PURE__ */ c(D, {}), /* @__PURE__ */ c(S, {
|
|
1395
|
+
cx: "50%",
|
|
1396
|
+
cy: "50%",
|
|
1397
|
+
data: t,
|
|
1398
|
+
dataKey: n,
|
|
1399
|
+
innerRadius: s,
|
|
1400
|
+
nameKey: r,
|
|
1401
|
+
children: t.map((e, t) => /* @__PURE__ */ c(h, { fill: o[t % o.length] }, t))
|
|
1402
|
+
})] })
|
|
1403
|
+
})
|
|
1404
|
+
});
|
|
1405
|
+
}), Ze = n(function({ data: t, dataKey: n, angleKey: r = "name", className: i, height: a = 300, color: o = "var(--gds-accent)", glass: s, ...u }, d) {
|
|
1406
|
+
return /* @__PURE__ */ c("div", {
|
|
1407
|
+
className: e("w-full", s && "gds-radius-popover backdrop-blur-md bg-white/5", i),
|
|
1408
|
+
"data-component": "radar-chart",
|
|
1409
|
+
ref: d,
|
|
1410
|
+
...u,
|
|
1411
|
+
children: /* @__PURE__ */ c(w, {
|
|
1412
|
+
height: a,
|
|
1413
|
+
width: "100%",
|
|
1414
|
+
children: /* @__PURE__ */ l(ie, {
|
|
1415
|
+
cx: "50%",
|
|
1416
|
+
cy: "50%",
|
|
1417
|
+
data: t,
|
|
1418
|
+
outerRadius: "80%",
|
|
1419
|
+
children: [
|
|
1420
|
+
/* @__PURE__ */ c(te, { stroke: "var(--gds-border, #e5e7eb)" }),
|
|
1421
|
+
/* @__PURE__ */ c(ee, {
|
|
1422
|
+
dataKey: r,
|
|
1423
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1424
|
+
tick: { fontSize: 11 }
|
|
1425
|
+
}),
|
|
1426
|
+
/* @__PURE__ */ c(ne, {
|
|
1427
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1428
|
+
tick: { fontSize: 10 }
|
|
1429
|
+
}),
|
|
1430
|
+
/* @__PURE__ */ c(D, {}),
|
|
1431
|
+
/* @__PURE__ */ c(re, {
|
|
1432
|
+
dataKey: n,
|
|
1433
|
+
fill: o,
|
|
1434
|
+
fillOpacity: .3,
|
|
1435
|
+
stroke: o,
|
|
1436
|
+
strokeWidth: 2
|
|
1437
|
+
})
|
|
1438
|
+
]
|
|
1439
|
+
})
|
|
1440
|
+
})
|
|
1441
|
+
});
|
|
1442
|
+
}), Qe = [
|
|
1443
|
+
"var(--gds-palette-0, #6366f1)",
|
|
1444
|
+
"var(--gds-palette-1, #22d3ee)",
|
|
1445
|
+
"var(--gds-palette-2, #f59e0b)",
|
|
1446
|
+
"var(--gds-palette-3, #10b981)",
|
|
1447
|
+
"var(--gds-palette-4, #ef4444)",
|
|
1448
|
+
"var(--gds-palette-5, #8b5cf6)",
|
|
1449
|
+
"var(--gds-palette-6, #ec4899)",
|
|
1450
|
+
"var(--gds-palette-7, #14b8a6)",
|
|
1451
|
+
"var(--gds-palette-8, #f97316)",
|
|
1452
|
+
"var(--gds-palette-9, #3b82f6)"
|
|
1453
|
+
], $e = n(function({ data: n, height: r = 300, innerRadius: i = "20%", glass: a, className: o, ...s }, u) {
|
|
1454
|
+
let d = n.map((e, t) => ({
|
|
1455
|
+
...e,
|
|
1456
|
+
fill: e.fill ?? Qe[t % Qe.length]
|
|
1457
|
+
}));
|
|
1458
|
+
return /* @__PURE__ */ c("div", {
|
|
1459
|
+
className: e("w-full gds-radius-popover border border-white/[0.06]", t(a), o),
|
|
1460
|
+
"data-component": "radial-bar-chart",
|
|
1461
|
+
ref: u,
|
|
1462
|
+
...s,
|
|
1463
|
+
children: /* @__PURE__ */ c(w, {
|
|
1464
|
+
height: r,
|
|
1465
|
+
width: "100%",
|
|
1466
|
+
children: /* @__PURE__ */ l(oe, {
|
|
1467
|
+
cx: "50%",
|
|
1468
|
+
cy: "50%",
|
|
1469
|
+
data: d,
|
|
1470
|
+
innerRadius: i,
|
|
1471
|
+
outerRadius: "90%",
|
|
1472
|
+
children: [
|
|
1473
|
+
/* @__PURE__ */ c(ae, {
|
|
1474
|
+
dataKey: "value",
|
|
1475
|
+
background: { fill: "rgba(255,255,255,0.05)" }
|
|
1476
|
+
}),
|
|
1477
|
+
/* @__PURE__ */ c(D, {}),
|
|
1478
|
+
/* @__PURE__ */ c(y, { iconSize: 8 })
|
|
1479
|
+
]
|
|
1480
|
+
})
|
|
1481
|
+
})
|
|
1482
|
+
});
|
|
1483
|
+
}), et = n(function({ className: t, color: n, data: a, height: s = 200, label: l, lineWidth: u = 2, maxPoints: d = 200, showGrid: f = !0 }, p) {
|
|
1484
|
+
let m = o(null), h = o(0), g = o(0), _ = r((e) => {
|
|
1485
|
+
m.current = e, typeof p == "function" ? p(e) : p != null && (p.current = e);
|
|
1486
|
+
}, [p]);
|
|
1487
|
+
return i(() => {
|
|
1488
|
+
let e = m.current;
|
|
1489
|
+
if (e === null) return;
|
|
1490
|
+
let t = e.getContext("2d");
|
|
1491
|
+
return t === null ? void 0 : ((a.length !== g.current || a.length > 0) && (g.current = a.length, h.current = requestAnimationFrame(() => {
|
|
1492
|
+
let r = window.devicePixelRatio ?? 1, i = e.getBoundingClientRect(), o = i.width, s = i.height;
|
|
1493
|
+
(e.width !== o * r || e.height !== s * r) && (e.width = o * r, e.height = s * r), t.setTransform(r, 0, 0, r, 0, 0), t.clearRect(0, 0, o, s);
|
|
1494
|
+
let c = getComputedStyle(e), p = n ?? (c.getPropertyValue("--gds-accent").trim() || "#2563eb"), m = c.getPropertyValue("--gds-border").trim() || "#e5e7eb", h = c.getPropertyValue("--gds-fg").trim() || "#1f2937", g = c.getPropertyValue("--gds-fg-muted").trim() || "#6b7280", _ = a.slice(-d);
|
|
1495
|
+
if (_.length === 0) return;
|
|
1496
|
+
let v = Math.min(..._), y = Math.max(..._), b = y - v || 1;
|
|
1497
|
+
if (f) {
|
|
1498
|
+
t.strokeStyle = m, t.lineWidth = .5;
|
|
1499
|
+
for (let e = 0; e <= 4; e++) {
|
|
1500
|
+
let n = 8 + (s - 16) * e / 4;
|
|
1501
|
+
t.beginPath(), t.moveTo(0, n), t.lineTo(o, n), t.stroke();
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
t.strokeStyle = p, t.lineWidth = u, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
|
|
1505
|
+
for (let e = 0; e < _.length; e++) {
|
|
1506
|
+
let n = e / (d - 1) * o, r = 8 + (1 - (_[e] - v) / b) * (s - 16);
|
|
1507
|
+
e === 0 ? t.moveTo(n, r) : t.lineTo(n, r);
|
|
1508
|
+
}
|
|
1509
|
+
t.stroke();
|
|
1510
|
+
let x = t.createLinearGradient(0, 0, 0, s);
|
|
1511
|
+
x.addColorStop(0, p + "40"), x.addColorStop(1, p + "00"), t.fillStyle = x, t.beginPath();
|
|
1512
|
+
for (let e = 0; e < _.length; e++) {
|
|
1513
|
+
let n = e / (d - 1) * o, r = 8 + (1 - (_[e] - v) / b) * (s - 16);
|
|
1514
|
+
e === 0 ? t.moveTo(n, r) : t.lineTo(n, r);
|
|
1515
|
+
}
|
|
1516
|
+
if (_.length > 0) {
|
|
1517
|
+
let e = (_.length - 1) / (d - 1) * o;
|
|
1518
|
+
t.lineTo(e, s), t.lineTo(0, s);
|
|
1519
|
+
}
|
|
1520
|
+
t.closePath(), t.fill();
|
|
1521
|
+
let S = _[_.length - 1];
|
|
1522
|
+
t.font = "bold 12px ui-monospace, monospace", t.fillStyle = h, t.textAlign = "right", t.fillText(S.toFixed(1), o - 8, 16), l !== void 0 && (t.font = "10px system-ui, sans-serif", t.fillStyle = g, t.textAlign = "left", t.fillText(l, 8, 14)), t.font = "9px ui-monospace, monospace", t.fillStyle = g, t.textAlign = "right", t.fillText(y.toFixed(0), o - 8, 18), t.fillText(v.toFixed(0), o - 8, s - 8);
|
|
1523
|
+
})), () => {
|
|
1524
|
+
h.current !== 0 && cancelAnimationFrame(h.current);
|
|
1525
|
+
});
|
|
1526
|
+
}, [
|
|
1527
|
+
a,
|
|
1528
|
+
d,
|
|
1529
|
+
n,
|
|
1530
|
+
u,
|
|
1531
|
+
f,
|
|
1532
|
+
l,
|
|
1533
|
+
s
|
|
1534
|
+
]), /* @__PURE__ */ c("canvas", {
|
|
1535
|
+
className: e("block w-full rounded-lg border border-border bg-surface", t),
|
|
1536
|
+
"data-component": "realtime-chart",
|
|
1537
|
+
ref: _,
|
|
1538
|
+
style: { height: s }
|
|
1539
|
+
});
|
|
1540
|
+
}), tt = n(function({ nodes: t, links: n, className: r, height: i = 300, nodePadding: a = 50, nodeWidth: o = 10, glass: s, ...l }, u) {
|
|
1541
|
+
let d = {
|
|
1542
|
+
nodes: t,
|
|
1543
|
+
links: n
|
|
1544
|
+
};
|
|
1545
|
+
return /* @__PURE__ */ c("div", {
|
|
1546
|
+
className: e("w-full", s && "gds-radius-popover backdrop-blur-md bg-white/5", r),
|
|
1547
|
+
"data-component": "sankey-chart",
|
|
1548
|
+
ref: u,
|
|
1549
|
+
...l,
|
|
1550
|
+
children: /* @__PURE__ */ c(w, {
|
|
1551
|
+
height: i,
|
|
1552
|
+
width: "100%",
|
|
1553
|
+
children: /* @__PURE__ */ c(se, {
|
|
1554
|
+
data: d,
|
|
1555
|
+
nodePadding: a,
|
|
1556
|
+
nodeWidth: o,
|
|
1557
|
+
children: /* @__PURE__ */ c(D, {})
|
|
1558
|
+
})
|
|
1559
|
+
})
|
|
1560
|
+
});
|
|
1561
|
+
}), nt = n(function({ data: t, xKey: n, yKey: r, className: i, height: a = 300, color: o = "var(--gds-accent)", glass: s, ...u }, d) {
|
|
1562
|
+
return /* @__PURE__ */ c("div", {
|
|
1563
|
+
className: e("w-full", s && "gds-radius-popover backdrop-blur-md bg-white/5", i),
|
|
1564
|
+
"data-component": "scatter-chart",
|
|
1565
|
+
ref: d,
|
|
1566
|
+
...u,
|
|
1567
|
+
children: /* @__PURE__ */ c(w, {
|
|
1568
|
+
height: a,
|
|
1569
|
+
width: "100%",
|
|
1570
|
+
children: /* @__PURE__ */ l(E, { children: [
|
|
1571
|
+
/* @__PURE__ */ c(m, {
|
|
1572
|
+
stroke: "var(--gds-border, #e5e7eb)",
|
|
1573
|
+
strokeDasharray: "3 3"
|
|
1574
|
+
}),
|
|
1575
|
+
/* @__PURE__ */ c(O, {
|
|
1576
|
+
dataKey: n,
|
|
1577
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1578
|
+
tick: { fontSize: 11 },
|
|
1579
|
+
type: "number"
|
|
1580
|
+
}),
|
|
1581
|
+
/* @__PURE__ */ c(k, {
|
|
1582
|
+
dataKey: r,
|
|
1583
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1584
|
+
tick: { fontSize: 11 },
|
|
1585
|
+
type: "number"
|
|
1586
|
+
}),
|
|
1587
|
+
/* @__PURE__ */ c(D, {}),
|
|
1588
|
+
/* @__PURE__ */ c(T, {
|
|
1589
|
+
data: t,
|
|
1590
|
+
fill: o
|
|
1591
|
+
})
|
|
1592
|
+
] })
|
|
1593
|
+
})
|
|
1594
|
+
});
|
|
1595
|
+
}), rt = n(function({ data: t, dataKey: n, className: r, height: i = 32, width: a = 120, color: o = "var(--gds-accent)", glass: s, ...l }, u) {
|
|
1596
|
+
return /* @__PURE__ */ c("div", {
|
|
1597
|
+
className: e("inline-block", s && "rounded backdrop-blur-md bg-white/5", r),
|
|
1598
|
+
"data-component": "sparkline",
|
|
1599
|
+
ref: u,
|
|
1600
|
+
...l,
|
|
1601
|
+
children: /* @__PURE__ */ c(w, {
|
|
1602
|
+
height: i,
|
|
1603
|
+
width: a,
|
|
1604
|
+
children: /* @__PURE__ */ c(x, {
|
|
1605
|
+
data: t,
|
|
1606
|
+
children: /* @__PURE__ */ c(b, {
|
|
1607
|
+
dataKey: n,
|
|
1608
|
+
dot: !1,
|
|
1609
|
+
stroke: o,
|
|
1610
|
+
strokeWidth: 1.5,
|
|
1611
|
+
type: "monotone"
|
|
1612
|
+
})
|
|
1613
|
+
})
|
|
1614
|
+
})
|
|
1615
|
+
});
|
|
1616
|
+
}), Y = [
|
|
1617
|
+
"var(--gds-palette-0, #6366f1)",
|
|
1618
|
+
"var(--gds-palette-1, #8b5cf6)",
|
|
1619
|
+
"var(--gds-palette-2, #06b6d4)",
|
|
1620
|
+
"var(--gds-palette-3, #10b981)",
|
|
1621
|
+
"var(--gds-palette-4, #f59e0b)",
|
|
1622
|
+
"var(--gds-palette-5, #ef4444)",
|
|
1623
|
+
"var(--gds-palette-6, #ec4899)",
|
|
1624
|
+
"var(--gds-palette-7, #14b8a6)",
|
|
1625
|
+
"var(--gds-palette-8, #f97316)",
|
|
1626
|
+
"var(--gds-palette-9, #a855f7)"
|
|
1627
|
+
], it = n(function({ data: t, keys: n, xKey: r = "name", height: i = 300, glass: a, className: o, ...s }, f) {
|
|
1628
|
+
return /* @__PURE__ */ c("div", {
|
|
1629
|
+
ref: f,
|
|
1630
|
+
className: e("w-full gds-radius-popover border border-border", a && "backdrop-blur-md bg-white/5", o),
|
|
1631
|
+
"data-component": "stream-chart",
|
|
1632
|
+
...s,
|
|
1633
|
+
children: /* @__PURE__ */ c(w, {
|
|
1634
|
+
height: i,
|
|
1635
|
+
width: "100%",
|
|
1636
|
+
children: /* @__PURE__ */ l(d, {
|
|
1637
|
+
data: t,
|
|
1638
|
+
children: [
|
|
1639
|
+
/* @__PURE__ */ c(O, {
|
|
1640
|
+
dataKey: r,
|
|
1641
|
+
stroke: "var(--gds-fg-muted, #6b7280)",
|
|
1642
|
+
tick: { fontSize: 11 }
|
|
1643
|
+
}),
|
|
1644
|
+
/* @__PURE__ */ c(D, {}),
|
|
1645
|
+
n.map((e, t) => /* @__PURE__ */ c(u, {
|
|
1646
|
+
dataKey: e,
|
|
1647
|
+
fill: Y[t % Y.length],
|
|
1648
|
+
fillOpacity: .6,
|
|
1649
|
+
stackId: "1",
|
|
1650
|
+
stroke: Y[t % Y.length],
|
|
1651
|
+
strokeWidth: 1.5,
|
|
1652
|
+
type: "monotone"
|
|
1653
|
+
}, e))
|
|
1654
|
+
]
|
|
1655
|
+
})
|
|
1656
|
+
})
|
|
1657
|
+
});
|
|
1658
|
+
});
|
|
1659
|
+
//#endregion
|
|
1660
|
+
//#region src/l6-charts/sunburst-math.ts
|
|
1661
|
+
function X(e) {
|
|
1662
|
+
return e.children !== void 0 && e.children.length > 0 ? e.children.reduce((e, t) => e + X(t), 0) : e.value ?? 0;
|
|
1663
|
+
}
|
|
1664
|
+
function at(e, t, n, r, i, a) {
|
|
1665
|
+
let o = Math.min(a - i, 2 * Math.PI - .001), s = o > Math.PI ? 1 : 0, c = e + r * Math.cos(i), l = t + r * Math.sin(i), u = e + r * Math.cos(i + o), d = t + r * Math.sin(i + o), f = e + n * Math.cos(i + o), p = t + n * Math.sin(i + o), m = e + n * Math.cos(i), h = t + n * Math.sin(i);
|
|
1666
|
+
return [
|
|
1667
|
+
`M ${c} ${l}`,
|
|
1668
|
+
`A ${r} ${r} 0 ${s} 1 ${u} ${d}`,
|
|
1669
|
+
`L ${f} ${p}`,
|
|
1670
|
+
`A ${n} ${n} 0 ${s} 0 ${m} ${h}`,
|
|
1671
|
+
"Z"
|
|
1672
|
+
].join(" ");
|
|
1673
|
+
}
|
|
1674
|
+
function ot(e, t, n, r, i) {
|
|
1675
|
+
if (e.children === void 0 || e.children.length === 0) return [];
|
|
1676
|
+
let a = [], o = X(e);
|
|
1677
|
+
if (o === 0) return [];
|
|
1678
|
+
let s = n;
|
|
1679
|
+
for (let c = 0; c < e.children.length; c++) {
|
|
1680
|
+
let l = e.children[c], u = X(l) / o * (r - n), d = s + u;
|
|
1681
|
+
a.push({
|
|
1682
|
+
depth: t,
|
|
1683
|
+
index: i * 10 + c,
|
|
1684
|
+
startAngle: s,
|
|
1685
|
+
endAngle: d
|
|
1686
|
+
}), a.push(...ot(l, t + 1, s, d, i * 10 + c)), s = d;
|
|
1687
|
+
}
|
|
1688
|
+
return a;
|
|
1689
|
+
}
|
|
1690
|
+
//#endregion
|
|
1691
|
+
//#region src/l6-charts/sunburst-chart.tsx
|
|
1692
|
+
var Z = [
|
|
1693
|
+
"var(--gds-palette-0, #6366f1)",
|
|
1694
|
+
"var(--gds-palette-1, #22d3ee)",
|
|
1695
|
+
"var(--gds-palette-2, #f59e0b)",
|
|
1696
|
+
"var(--gds-palette-3, #10b981)",
|
|
1697
|
+
"var(--gds-palette-4, #ef4444)",
|
|
1698
|
+
"var(--gds-palette-5, #8b5cf6)",
|
|
1699
|
+
"var(--gds-palette-6, #ec4899)",
|
|
1700
|
+
"var(--gds-palette-7, #14b8a6)",
|
|
1701
|
+
"var(--gds-palette-8, #f97316)",
|
|
1702
|
+
"var(--gds-palette-9, #3b82f6)"
|
|
1703
|
+
], st = n(function({ data: n, width: r = 300, height: i = 300, glass: a, className: o, ...s }, u) {
|
|
1704
|
+
let d = r / 2, f = i / 2, p = Math.min(d, f) - 10, m = ot(n, 0, -Math.PI / 2, 1.5 * Math.PI, 0), h = m.reduce((e, t) => Math.max(e, t.depth), 0), g = p * .25, _ = (p - g) / (h + 1);
|
|
1705
|
+
return /* @__PURE__ */ c("div", {
|
|
1706
|
+
className: e("inline-flex gds-radius-popover border border-white/[0.06]", t(a), o),
|
|
1707
|
+
"data-component": "sunburst-chart",
|
|
1708
|
+
ref: u,
|
|
1709
|
+
...s,
|
|
1710
|
+
children: /* @__PURE__ */ l("svg", {
|
|
1711
|
+
height: i,
|
|
1712
|
+
width: r,
|
|
1713
|
+
viewBox: `0 0 ${r} ${i}`,
|
|
1714
|
+
children: [m.map((e, t) => {
|
|
1715
|
+
let n = g + e.depth * _, r = n + _ - 1, i = Z[(e.index + e.depth) % Z.length];
|
|
1716
|
+
return /* @__PURE__ */ c("path", {
|
|
1717
|
+
d: at(d, f, n, r, e.startAngle, e.endAngle),
|
|
1718
|
+
fill: i,
|
|
1719
|
+
opacity: 1 - e.depth * .15,
|
|
1720
|
+
stroke: "var(--gds-bg, #000)",
|
|
1721
|
+
strokeWidth: 1,
|
|
1722
|
+
"data-arc": !0
|
|
1723
|
+
}, t);
|
|
1724
|
+
}), /* @__PURE__ */ c("text", {
|
|
1725
|
+
x: d,
|
|
1726
|
+
y: f,
|
|
1727
|
+
textAnchor: "middle",
|
|
1728
|
+
dominantBaseline: "central",
|
|
1729
|
+
fill: "var(--gds-fg, #fff)",
|
|
1730
|
+
fontSize: 12,
|
|
1731
|
+
fontWeight: 600,
|
|
1732
|
+
"data-center-label": !0,
|
|
1733
|
+
children: n.name
|
|
1734
|
+
})]
|
|
1735
|
+
})
|
|
1736
|
+
});
|
|
1737
|
+
}), ct = [
|
|
1738
|
+
"var(--gds-palette-0, #6366f1)",
|
|
1739
|
+
"var(--gds-palette-1, #22d3ee)",
|
|
1740
|
+
"var(--gds-palette-2, #f59e0b)",
|
|
1741
|
+
"var(--gds-palette-3, #10b981)",
|
|
1742
|
+
"var(--gds-palette-4, #ef4444)",
|
|
1743
|
+
"var(--gds-palette-5, #8b5cf6)"
|
|
1744
|
+
], lt = n(function({ events: n, width: r = 600, height: i = 120, glass: a, className: o, ...s }, u) {
|
|
1745
|
+
if (n.length === 0) return /* @__PURE__ */ c("div", {
|
|
1746
|
+
className: e("inline-flex gds-radius-popover border border-white/[0.06]", t(a), o),
|
|
1747
|
+
"data-component": "timeline-chart",
|
|
1748
|
+
ref: u,
|
|
1749
|
+
...s,
|
|
1750
|
+
children: /* @__PURE__ */ c("svg", {
|
|
1751
|
+
height: i,
|
|
1752
|
+
width: r
|
|
1753
|
+
})
|
|
1754
|
+
});
|
|
1755
|
+
let d = i / 2, f = n.map((e) => new Date(e.date).getTime()), p = Math.min(...f), m = Math.max(...f) - p;
|
|
1756
|
+
function h(e) {
|
|
1757
|
+
return m === 0 ? r / 2 : 40 + (e - p) / m * (r - 80);
|
|
1758
|
+
}
|
|
1759
|
+
return /* @__PURE__ */ c("div", {
|
|
1760
|
+
className: e("inline-flex gds-radius-popover border border-white/[0.06]", t(a), o),
|
|
1761
|
+
"data-component": "timeline-chart",
|
|
1762
|
+
ref: u,
|
|
1763
|
+
...s,
|
|
1764
|
+
children: /* @__PURE__ */ l("svg", {
|
|
1765
|
+
height: i,
|
|
1766
|
+
width: r,
|
|
1767
|
+
viewBox: `0 0 ${r} ${i}`,
|
|
1768
|
+
children: [/* @__PURE__ */ c("line", {
|
|
1769
|
+
x1: 40,
|
|
1770
|
+
y1: d,
|
|
1771
|
+
x2: r - 40,
|
|
1772
|
+
y2: d,
|
|
1773
|
+
stroke: "var(--gds-border, #e5e7eb)",
|
|
1774
|
+
strokeWidth: 2
|
|
1775
|
+
}), n.map((e, t) => {
|
|
1776
|
+
let n = f[t], r = h(n), i = t % 2 == 0, a = i ? d - 24 : d + 32, o = e.color ?? ct[t % ct.length], s = new Date(e.date).toLocaleDateString();
|
|
1777
|
+
return /* @__PURE__ */ l("g", {
|
|
1778
|
+
"data-event": !0,
|
|
1779
|
+
children: [
|
|
1780
|
+
/* @__PURE__ */ c("circle", {
|
|
1781
|
+
cx: r,
|
|
1782
|
+
cy: d,
|
|
1783
|
+
r: 5,
|
|
1784
|
+
fill: o
|
|
1785
|
+
}),
|
|
1786
|
+
/* @__PURE__ */ c("line", {
|
|
1787
|
+
x1: r,
|
|
1788
|
+
y1: d + (i ? -6 : 6),
|
|
1789
|
+
x2: r,
|
|
1790
|
+
y2: a + (i ? 10 : -10),
|
|
1791
|
+
stroke: "var(--gds-border, #e5e7eb)",
|
|
1792
|
+
strokeWidth: 1
|
|
1793
|
+
}),
|
|
1794
|
+
/* @__PURE__ */ c("text", {
|
|
1795
|
+
x: r,
|
|
1796
|
+
y: a,
|
|
1797
|
+
textAnchor: "middle",
|
|
1798
|
+
fill: "var(--gds-fg, #fff)",
|
|
1799
|
+
fontSize: 10,
|
|
1800
|
+
fontWeight: 500,
|
|
1801
|
+
"data-label": i ? "above" : "below",
|
|
1802
|
+
children: e.label
|
|
1803
|
+
}),
|
|
1804
|
+
/* @__PURE__ */ c("text", {
|
|
1805
|
+
x: r,
|
|
1806
|
+
y: a + (i ? -10 : 12),
|
|
1807
|
+
textAnchor: "middle",
|
|
1808
|
+
fill: "var(--gds-fg-muted, #6b7280)",
|
|
1809
|
+
fontSize: 8,
|
|
1810
|
+
children: s
|
|
1811
|
+
})
|
|
1812
|
+
]
|
|
1813
|
+
}, t);
|
|
1814
|
+
})]
|
|
1815
|
+
})
|
|
1816
|
+
});
|
|
1817
|
+
}), ut = n(function({ data: t, dataKey: n = "value", className: r, height: i = 300, color: a = "var(--gds-accent)", glass: o, ...s }, l) {
|
|
1818
|
+
return /* @__PURE__ */ c("div", {
|
|
1819
|
+
className: e("w-full", o && "gds-radius-popover backdrop-blur-md bg-white/5", r),
|
|
1820
|
+
"data-component": "treemap-chart",
|
|
1821
|
+
ref: l,
|
|
1822
|
+
...s,
|
|
1823
|
+
children: /* @__PURE__ */ c(w, {
|
|
1824
|
+
height: i,
|
|
1825
|
+
width: "100%",
|
|
1826
|
+
children: /* @__PURE__ */ c(ce, {
|
|
1827
|
+
data: t,
|
|
1828
|
+
dataKey: n,
|
|
1829
|
+
fill: a,
|
|
1830
|
+
stroke: "var(--gds-bg, #fff)"
|
|
1831
|
+
})
|
|
1832
|
+
})
|
|
1833
|
+
});
|
|
1834
|
+
}), dt = [
|
|
1835
|
+
"var(--gds-palette-0, #6366f1)",
|
|
1836
|
+
"var(--gds-palette-1, #8b5cf6)",
|
|
1837
|
+
"var(--gds-palette-2, #06b6d4)",
|
|
1838
|
+
"var(--gds-palette-3, #10b981)",
|
|
1839
|
+
"var(--gds-palette-4, #f59e0b)"
|
|
1840
|
+
];
|
|
1841
|
+
function ft(e, t, n, r) {
|
|
1842
|
+
let i = r - n;
|
|
1843
|
+
if (i === 0) return Array(t).fill(1 / t);
|
|
1844
|
+
let a = Array(t).fill(0), o = i / t;
|
|
1845
|
+
for (let r of e) {
|
|
1846
|
+
let e = Math.min(Math.floor((r - n) / o), t - 1);
|
|
1847
|
+
a[e]++;
|
|
1848
|
+
}
|
|
1849
|
+
let s = Math.max(...a);
|
|
1850
|
+
return s === 0 ? a : a.map((e) => e / s);
|
|
1851
|
+
}
|
|
1852
|
+
function pt(e) {
|
|
1853
|
+
let t = [...e].sort((e, t) => e - t), n = Math.floor(t.length / 2);
|
|
1854
|
+
return t.length % 2 == 0 ? (t[n - 1] + t[n]) / 2 : t[n];
|
|
1855
|
+
}
|
|
1856
|
+
var mt = n(function({ data: t, width: n = 400, height: r = 300, glass: i, className: a }, o) {
|
|
1857
|
+
let s = {
|
|
1858
|
+
top: 20,
|
|
1859
|
+
right: 20,
|
|
1860
|
+
bottom: 40,
|
|
1861
|
+
left: 50
|
|
1862
|
+
}, u = n - s.left - s.right, d = r - s.top - s.bottom, f = t.flatMap((e) => e.values), p = f.length > 0 ? Math.min(...f) : 0, m = f.length > 0 ? Math.max(...f) : 1, h = m - p, g = p - h * .1, _ = m + h * .1, v = (e) => s.top + d * (1 - (e - g) / (_ - g)), y = t.length > 0 ? u / t.length : u, b = Math.min(y * .7, 80) / 2;
|
|
1863
|
+
return /* @__PURE__ */ c("div", {
|
|
1864
|
+
ref: o,
|
|
1865
|
+
className: e("gds-radius-popover border border-border", i && "backdrop-blur-md bg-white/5", a),
|
|
1866
|
+
"data-component": "violin-plot",
|
|
1867
|
+
children: /* @__PURE__ */ l("svg", {
|
|
1868
|
+
width: n,
|
|
1869
|
+
height: r,
|
|
1870
|
+
viewBox: `0 0 ${n} ${r}`,
|
|
1871
|
+
children: [
|
|
1872
|
+
/* @__PURE__ */ c("line", {
|
|
1873
|
+
x1: s.left,
|
|
1874
|
+
y1: s.top,
|
|
1875
|
+
x2: s.left,
|
|
1876
|
+
y2: s.top + d,
|
|
1877
|
+
stroke: "var(--gds-border, #374151)",
|
|
1878
|
+
strokeWidth: 1
|
|
1879
|
+
}),
|
|
1880
|
+
/* @__PURE__ */ c("line", {
|
|
1881
|
+
x1: s.left,
|
|
1882
|
+
y1: s.top + d,
|
|
1883
|
+
x2: s.left + u,
|
|
1884
|
+
y2: s.top + d,
|
|
1885
|
+
stroke: "var(--gds-border, #374151)",
|
|
1886
|
+
strokeWidth: 1
|
|
1887
|
+
}),
|
|
1888
|
+
t.map((e, t) => {
|
|
1889
|
+
if (e.values.length === 0) return null;
|
|
1890
|
+
let n = s.left + y * (t + .5), r = dt[t % dt.length], i = ft(e.values, 20, p, m), a = (_ - g) / 20, o = pt(e.values), u = i.map((e, t) => {
|
|
1891
|
+
let r = v(g + a * (t + .5));
|
|
1892
|
+
return `${n + e * b},${r}`;
|
|
1893
|
+
}), f = [...i].reverse().map((e, t) => {
|
|
1894
|
+
let r = v(g + a * (19 - t + .5));
|
|
1895
|
+
return `${n - e * b},${r}`;
|
|
1896
|
+
}), h = `M ${u[0]} ${u.map((e) => `L ${e}`).join(" ")} ${f.map((e) => `L ${e}`).join(" ")} Z`;
|
|
1897
|
+
return /* @__PURE__ */ l("g", {
|
|
1898
|
+
"data-violin": e.label,
|
|
1899
|
+
children: [
|
|
1900
|
+
/* @__PURE__ */ c("path", {
|
|
1901
|
+
d: h,
|
|
1902
|
+
fill: r,
|
|
1903
|
+
fillOpacity: .25,
|
|
1904
|
+
stroke: r,
|
|
1905
|
+
strokeWidth: 1.5
|
|
1906
|
+
}),
|
|
1907
|
+
/* @__PURE__ */ c("circle", {
|
|
1908
|
+
cx: n,
|
|
1909
|
+
cy: v(o),
|
|
1910
|
+
r: 3,
|
|
1911
|
+
fill: r
|
|
1912
|
+
}),
|
|
1913
|
+
/* @__PURE__ */ c("text", {
|
|
1914
|
+
x: n,
|
|
1915
|
+
y: s.top + d + 20,
|
|
1916
|
+
textAnchor: "middle",
|
|
1917
|
+
fill: "var(--gds-fg-muted, #9ca3af)",
|
|
1918
|
+
fontSize: 10,
|
|
1919
|
+
children: e.label
|
|
1920
|
+
})
|
|
1921
|
+
]
|
|
1922
|
+
}, e.label);
|
|
1923
|
+
})
|
|
1924
|
+
]
|
|
1925
|
+
})
|
|
1926
|
+
});
|
|
1927
|
+
}), Q = [
|
|
1928
|
+
"var(--gds-palette-0, #6366f1)",
|
|
1929
|
+
"var(--gds-palette-1, #22d3ee)",
|
|
1930
|
+
"var(--gds-palette-2, #f59e0b)",
|
|
1931
|
+
"var(--gds-palette-3, #10b981)",
|
|
1932
|
+
"var(--gds-palette-4, #ef4444)",
|
|
1933
|
+
"var(--gds-palette-5, #8b5cf6)",
|
|
1934
|
+
"var(--gds-palette-6, #ec4899)",
|
|
1935
|
+
"var(--gds-palette-7, #14b8a6)",
|
|
1936
|
+
"var(--gds-palette-8, #f97316)",
|
|
1937
|
+
"var(--gds-palette-9, #3b82f6)"
|
|
1938
|
+
], ht = n(function({ data: n, size: r = 200, glass: i, className: a, ...o }, s) {
|
|
1939
|
+
let u = [], d = 0;
|
|
1940
|
+
for (let e = 0; e < n.length; e++) {
|
|
1941
|
+
let t = n[e], r = Math.round(t.value), i = t.color ?? Q[e % Q.length];
|
|
1942
|
+
for (let e = 0; e < r && d < 100; e++) u[d] = i, d++;
|
|
1943
|
+
}
|
|
1944
|
+
for (; d < 100;) u[d] = "transparent", d++;
|
|
1945
|
+
let f = r / 10, p = Math.max(1, f * .1);
|
|
1946
|
+
return /* @__PURE__ */ l("div", {
|
|
1947
|
+
className: e("inline-flex flex-col gds-radius-popover border border-white/[0.06]", t(i), a),
|
|
1948
|
+
"data-component": "waffle-chart",
|
|
1949
|
+
ref: s,
|
|
1950
|
+
...o,
|
|
1951
|
+
children: [/* @__PURE__ */ c("svg", {
|
|
1952
|
+
height: r,
|
|
1953
|
+
width: r,
|
|
1954
|
+
viewBox: `0 0 ${r} ${r}`,
|
|
1955
|
+
children: u.map((e, t) => {
|
|
1956
|
+
let n = Math.floor(t / 10);
|
|
1957
|
+
return /* @__PURE__ */ c("rect", {
|
|
1958
|
+
x: t % 10 * f + p,
|
|
1959
|
+
y: n * f + p,
|
|
1960
|
+
width: f - p * 2,
|
|
1961
|
+
height: f - p * 2,
|
|
1962
|
+
rx: 2,
|
|
1963
|
+
fill: e,
|
|
1964
|
+
"data-cell": t
|
|
1965
|
+
}, t);
|
|
1966
|
+
})
|
|
1967
|
+
}), /* @__PURE__ */ c("div", {
|
|
1968
|
+
className: "flex flex-wrap gap-3 px-2 pb-2 pt-1",
|
|
1969
|
+
children: n.map((e, t) => /* @__PURE__ */ l("div", {
|
|
1970
|
+
className: "flex items-center gap-1.5 text-[10px] text-fg-muted",
|
|
1971
|
+
children: [
|
|
1972
|
+
/* @__PURE__ */ c("span", {
|
|
1973
|
+
className: "inline-block h-2 w-2 rounded-full",
|
|
1974
|
+
style: { backgroundColor: e.color ?? Q[t % Q.length] }
|
|
1975
|
+
}),
|
|
1976
|
+
/* @__PURE__ */ c("span", { children: e.label }),
|
|
1977
|
+
/* @__PURE__ */ l("span", {
|
|
1978
|
+
className: "text-fg-muted/50",
|
|
1979
|
+
children: [e.value, "%"]
|
|
1980
|
+
})
|
|
1981
|
+
]
|
|
1982
|
+
}, e.label))
|
|
1983
|
+
})]
|
|
1984
|
+
});
|
|
1985
|
+
}), gt = n(function({ className: t, data: n, height: r = 300 }, i) {
|
|
1986
|
+
let o = {
|
|
1987
|
+
bottom: 40,
|
|
1988
|
+
left: 12,
|
|
1989
|
+
right: 12,
|
|
1990
|
+
top: 20
|
|
1991
|
+
}, s = a(() => {
|
|
1992
|
+
if (n.length === 0) return {
|
|
1993
|
+
bars: [],
|
|
1994
|
+
maxY: 0,
|
|
1995
|
+
minY: 0
|
|
1996
|
+
};
|
|
1997
|
+
let e = [], t = 0;
|
|
1998
|
+
for (let r of n) {
|
|
1999
|
+
let n = t;
|
|
2000
|
+
t += r.value, e.push({
|
|
2001
|
+
end: t,
|
|
2002
|
+
label: r.label,
|
|
2003
|
+
start: n,
|
|
2004
|
+
type: r.value >= 0 ? "positive" : "negative",
|
|
2005
|
+
value: r.value
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
e.push({
|
|
2009
|
+
end: t,
|
|
2010
|
+
label: "Total",
|
|
2011
|
+
start: 0,
|
|
2012
|
+
type: "total",
|
|
2013
|
+
value: t
|
|
2014
|
+
});
|
|
2015
|
+
let r = e.flatMap((e) => [e.start, e.end]);
|
|
2016
|
+
return {
|
|
2017
|
+
bars: e,
|
|
2018
|
+
maxY: Math.max(0, ...r),
|
|
2019
|
+
minY: Math.min(0, ...r)
|
|
2020
|
+
};
|
|
2021
|
+
}, [n]), u = 500 - o.left - o.right, d = r - o.top - o.bottom, f = s.maxY - s.minY || 1, p = s.bars.length, m = Math.min(40, u / p * .6), h = u / p, g = (e) => o.top + (1 - (e - s.minY) / f) * d, _ = (e) => e === "positive" ? "var(--gds-success)" : e === "negative" ? "var(--gds-danger)" : "var(--gds-accent)";
|
|
2022
|
+
return /* @__PURE__ */ c("div", {
|
|
2023
|
+
className: e("inline-block", t),
|
|
2024
|
+
"data-component": "waterfall-chart",
|
|
2025
|
+
ref: i,
|
|
2026
|
+
children: /* @__PURE__ */ l("svg", {
|
|
2027
|
+
height: r,
|
|
2028
|
+
viewBox: `0 0 500 ${r}`,
|
|
2029
|
+
width: 500,
|
|
2030
|
+
children: [s.bars.map((e, t) => {
|
|
2031
|
+
let n = o.left + t * h + (h - m) / 2, i = g(Math.max(e.start, e.end)), a = g(Math.min(e.start, e.end)), u = Math.max(1, a - i);
|
|
2032
|
+
return /* @__PURE__ */ l("g", { children: [
|
|
2033
|
+
/* @__PURE__ */ c("rect", {
|
|
2034
|
+
fill: _(e.type),
|
|
2035
|
+
fillOpacity: .8,
|
|
2036
|
+
height: u,
|
|
2037
|
+
rx: 2,
|
|
2038
|
+
width: m,
|
|
2039
|
+
x: n,
|
|
2040
|
+
y: i
|
|
2041
|
+
}),
|
|
2042
|
+
e.type !== "total" && t < s.bars.length - 1 && /* @__PURE__ */ c("line", {
|
|
2043
|
+
stroke: "var(--gds-border)",
|
|
2044
|
+
strokeDasharray: "3,3",
|
|
2045
|
+
strokeWidth: 1,
|
|
2046
|
+
x1: n + m,
|
|
2047
|
+
x2: o.left + (t + 1) * h + (h - m) / 2,
|
|
2048
|
+
y1: g(e.end),
|
|
2049
|
+
y2: g(e.end)
|
|
2050
|
+
}),
|
|
2051
|
+
/* @__PURE__ */ c("text", {
|
|
2052
|
+
dominantBaseline: "middle",
|
|
2053
|
+
fill: "var(--gds-fg)",
|
|
2054
|
+
fontSize: 10,
|
|
2055
|
+
fontWeight: "600",
|
|
2056
|
+
textAnchor: "middle",
|
|
2057
|
+
x: n + m / 2,
|
|
2058
|
+
y: i - 8,
|
|
2059
|
+
children: e.value >= 0 ? `+${e.value}` : e.value
|
|
2060
|
+
}),
|
|
2061
|
+
/* @__PURE__ */ c("text", {
|
|
2062
|
+
dominantBaseline: "hanging",
|
|
2063
|
+
fill: "var(--gds-fg-muted)",
|
|
2064
|
+
fontSize: 10,
|
|
2065
|
+
textAnchor: "middle",
|
|
2066
|
+
x: n + m / 2,
|
|
2067
|
+
y: r - o.bottom + 8,
|
|
2068
|
+
children: e.label
|
|
2069
|
+
})
|
|
2070
|
+
] }, t);
|
|
2071
|
+
}), /* @__PURE__ */ c("line", {
|
|
2072
|
+
stroke: "var(--gds-border)",
|
|
2073
|
+
strokeWidth: 1,
|
|
2074
|
+
x1: o.left,
|
|
2075
|
+
x2: 500 - o.right,
|
|
2076
|
+
y1: g(0),
|
|
2077
|
+
y2: g(0)
|
|
2078
|
+
})]
|
|
2079
|
+
})
|
|
2080
|
+
});
|
|
2081
|
+
}), _t = n(function({ data: t, width: n = 400, height: r = 100, progress: i = 0, color: o = "var(--gds-accent, #6366f1)", playedColor: s, glass: l, className: u, ...d }, f) {
|
|
2082
|
+
let p = s ?? o, m = Math.floor(i * t.length), h = r / 2, g = a(() => {
|
|
2083
|
+
if (t.length === 0) return [];
|
|
2084
|
+
let e = n / t.length;
|
|
2085
|
+
return t.map((t, n) => {
|
|
2086
|
+
let r = Math.max(t * h, 1);
|
|
2087
|
+
return {
|
|
2088
|
+
x: n * e,
|
|
2089
|
+
y: h - r,
|
|
2090
|
+
w: Math.max(e - 1, 1),
|
|
2091
|
+
h: r * 2,
|
|
2092
|
+
played: n < m
|
|
2093
|
+
};
|
|
2094
|
+
});
|
|
2095
|
+
}, [
|
|
2096
|
+
t,
|
|
2097
|
+
n,
|
|
2098
|
+
h,
|
|
2099
|
+
m
|
|
2100
|
+
]);
|
|
2101
|
+
return /* @__PURE__ */ c("div", {
|
|
2102
|
+
ref: f,
|
|
2103
|
+
className: e("inline-block gds-radius-popover border border-border", l && "backdrop-blur-md bg-white/5", u),
|
|
2104
|
+
"data-component": "waveform-display",
|
|
2105
|
+
...d,
|
|
2106
|
+
children: /* @__PURE__ */ c("svg", {
|
|
2107
|
+
height: r,
|
|
2108
|
+
width: n,
|
|
2109
|
+
viewBox: `0 0 ${n} ${r}`,
|
|
2110
|
+
children: g.map((e, t) => /* @__PURE__ */ c("rect", {
|
|
2111
|
+
x: e.x,
|
|
2112
|
+
y: e.y,
|
|
2113
|
+
width: e.w,
|
|
2114
|
+
height: e.h,
|
|
2115
|
+
fill: e.played ? p : o,
|
|
2116
|
+
opacity: e.played ? 1 : .3,
|
|
2117
|
+
rx: 1
|
|
2118
|
+
}, t))
|
|
2119
|
+
})
|
|
2120
|
+
});
|
|
2121
|
+
}), $ = Array.from({ length: 10 }, (e, t) => `var(--gds-palette-${t})`), vt = n(function({ words: t, maxFontSize: n = 48, minFontSize: r = 12, glass: i, height: a = 300, className: o, ...s }, l) {
|
|
2122
|
+
let u = t.map((e) => e.weight), d = Math.min(...u), f = Math.max(...u) - d;
|
|
2123
|
+
return /* @__PURE__ */ c("div", {
|
|
2124
|
+
className: e("flex flex-wrap items-center justify-center gap-2 overflow-hidden gds-radius-popover border border-[var(--gds-border,#e5e7eb)]", i && "backdrop-blur-md bg-white/5", o),
|
|
2125
|
+
"data-component": "word-cloud",
|
|
2126
|
+
ref: l,
|
|
2127
|
+
style: { height: a },
|
|
2128
|
+
...s,
|
|
2129
|
+
children: t.map((e, t) => {
|
|
2130
|
+
let i = f === 0 ? .5 : (e.weight - d) / f;
|
|
2131
|
+
return /* @__PURE__ */ c("span", {
|
|
2132
|
+
className: "inline-block select-none px-1",
|
|
2133
|
+
style: {
|
|
2134
|
+
fontSize: Math.round(r + i * (n - r)),
|
|
2135
|
+
color: $[t % $.length]
|
|
2136
|
+
},
|
|
2137
|
+
children: e.text
|
|
2138
|
+
}, `${e.text}-${t}`);
|
|
2139
|
+
})
|
|
2140
|
+
});
|
|
2141
|
+
});
|
|
2142
|
+
//#endregion
|
|
2143
|
+
export { we as A, ze as C, Me as D, Ne as E, pe as F, fe as I, de as L, _e as M, ge as N, je as O, he as P, Be as S, Pe as T, Je as _, mt as a, We as b, st as c, nt as d, tt as f, Xe as g, Ze as h, ht as i, ve as j, Ee as k, it as l, $e as m, _t as n, ut as o, et as p, gt as r, lt as s, vt as t, rt as u, qe as v, Le as w, He as x, Ge as y };
|
|
2144
|
+
|
|
2145
|
+
//# sourceMappingURL=l6-charts-Bn9RQLbe.js.map
|