@stealthscale/component-charts 0.2.2 → 0.2.3
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/dist/cyclonedx/bom.json +1 -1
- package/dist/index.js +1 -14710
- package/dist/pages/area-chart/area-chart.js +1151 -0
- package/dist/pages/area-chart/area-chart.props.js +3 -0
- package/dist/pages/bar-chart/bar-chart.js +990 -0
- package/dist/pages/bar-chart/bar-chart.props.js +3 -0
- package/dist/pages/box-plot/box-plot.js +1585 -0
- package/dist/pages/box-plot/box-plot.props.js +3 -0
- package/dist/pages/bubble-chart/bubble-chart.js +938 -0
- package/dist/pages/bubble-chart/bubble-chart.props.js +3 -0
- package/dist/pages/burndown-chart/burndown-chart.js +805 -0
- package/dist/pages/burndown-chart/burndown-chart.props.js +3 -0
- package/dist/pages/candlestick-chart/candlestick-chart.js +853 -0
- package/dist/pages/candlestick-chart/candlestick-chart.props.js +3 -0
- package/dist/pages/chart/chart.js +1190 -0
- package/dist/pages/chart/chart.props.js +3 -0
- package/dist/pages/chord-diagram/chord-diagram.js +891 -0
- package/dist/pages/chord-diagram/chord-diagram.props.js +3 -0
- package/dist/pages/combo-chart/combo-chart.js +873 -0
- package/dist/pages/combo-chart/combo-chart.props.js +3 -0
- package/dist/pages/distribution-chart/distribution-chart.js +1066 -0
- package/dist/pages/distribution-chart/distribution-chart.props.js +3 -0
- package/dist/pages/donut-chart/donut-chart.js +726 -0
- package/dist/pages/donut-chart/donut-chart.props.js +3 -0
- package/dist/pages/funnel-chart/funnel-chart.js +1094 -0
- package/dist/pages/funnel-chart/funnel-chart.props.js +3 -0
- package/dist/pages/gauge-chart/gauge-chart.js +767 -0
- package/dist/pages/gauge-chart/gauge-chart.props.js +3 -0
- package/dist/pages/heatmap/heatmap.js +1967 -0
- package/dist/pages/heatmap/heatmap.props.js +3 -0
- package/dist/pages/histogram-chart/histogram-chart.js +768 -0
- package/dist/pages/histogram-chart/histogram-chart.props.js +3 -0
- package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.js +701 -0
- package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.props.js +3 -0
- package/dist/pages/line-chart/line-chart.js +1882 -0
- package/dist/pages/line-chart/line-chart.props.js +3 -0
- package/dist/pages/pages.json +393 -0
- package/dist/pages/pareto-chart/pareto-chart.js +669 -0
- package/dist/pages/pareto-chart/pareto-chart.props.js +3 -0
- package/dist/pages/percent-stacked-bar/percent-stacked-bar.js +662 -0
- package/dist/pages/percent-stacked-bar/percent-stacked-bar.props.js +3 -0
- package/dist/pages/pie-chart/pie-chart.js +1007 -0
- package/dist/pages/pie-chart/pie-chart.props.js +3 -0
- package/dist/pages/polar-area-chart/polar-area-chart.js +812 -0
- package/dist/pages/polar-area-chart/polar-area-chart.props.js +3 -0
- package/dist/pages/radar-chart/radar-chart.js +1101 -0
- package/dist/pages/radar-chart/radar-chart.props.js +3 -0
- package/dist/pages/radial-bar-chart/radial-bar-chart.js +766 -0
- package/dist/pages/radial-bar-chart/radial-bar-chart.props.js +3 -0
- package/dist/pages/range-chart/range-chart.js +914 -0
- package/dist/pages/range-chart/range-chart.props.js +3 -0
- package/dist/pages/regression-overlay/regression-overlay.js +494 -0
- package/dist/pages/regression-overlay/regression-overlay.props.js +3 -0
- package/dist/pages/sankey-chart/sankey-chart.js +700 -0
- package/dist/pages/sankey-chart/sankey-chart.props.js +3 -0
- package/dist/pages/scatter-plot/scatter-plot.js +1248 -0
- package/dist/pages/scatter-plot/scatter-plot.props.js +3 -0
- package/dist/pages/sparkbar/sparkbar.js +629 -0
- package/dist/pages/sparkbar/sparkbar.props.js +3 -0
- package/dist/pages/sparkline/sparkline.js +960 -0
- package/dist/pages/sparkline/sparkline.props.js +3 -0
- package/dist/pages/spend-5xQ76WSj.js +185 -0
- package/dist/pages/stacked-area-chart/stacked-area-chart.js +912 -0
- package/dist/pages/stacked-area-chart/stacked-area-chart.props.js +3 -0
- package/dist/pages/stacked-bar-chart/stacked-bar-chart.js +722 -0
- package/dist/pages/stacked-bar-chart/stacked-bar-chart.props.js +3 -0
- package/dist/pages/step-line-chart/step-line-chart.js +573 -0
- package/dist/pages/step-line-chart/step-line-chart.props.js +3 -0
- package/dist/pages/stream-graph/stream-graph.js +1662 -0
- package/dist/pages/stream-graph/stream-graph.props.js +3 -0
- package/dist/pages/sunburst-chart/sunburst-chart.js +1051 -0
- package/dist/pages/sunburst-chart/sunburst-chart.props.js +3 -0
- package/dist/pages/timeline-chart/timeline-chart.js +1124 -0
- package/dist/pages/timeline-chart/timeline-chart.props.js +3 -0
- package/dist/pages/treemap-chart/treemap-chart.js +904 -0
- package/dist/pages/treemap-chart/treemap-chart.props.js +3 -0
- package/dist/pages/violin-plot/violin-plot.js +1303 -0
- package/dist/pages/violin-plot/violin-plot.props.js +3 -0
- package/dist/pages/visitors-oFFVcbIZ.js +248 -0
- package/dist/pages/waterfall-chart/waterfall-chart.js +1195 -0
- package/dist/pages/waterfall-chart/waterfall-chart.props.js +3 -0
- package/dist/shared-DVZJ2nST.js +14711 -0
- package/dist/theme.js +1 -1
- package/locales/en/specimen/area-chart.json +56 -0
- package/locales/en/specimen/bar-chart.json +56 -0
- package/locales/en/specimen/box-plot.json +65 -0
- package/locales/en/specimen/bubble-chart.json +47 -0
- package/locales/en/specimen/burndown-chart.json +46 -0
- package/locales/en/specimen/candlestick-chart.json +42 -0
- package/locales/en/specimen/chart.json +53 -0
- package/locales/en/specimen/chord-diagram.json +69 -0
- package/locales/en/specimen/combo-chart.json +41 -0
- package/locales/en/specimen/distribution-chart.json +47 -0
- package/locales/en/specimen/donut-chart.json +63 -0
- package/locales/en/specimen/funnel-chart.json +84 -0
- package/locales/en/specimen/gauge-chart.json +68 -0
- package/locales/en/specimen/heatmap.json +187 -0
- package/locales/en/specimen/histogram-chart.json +48 -0
- package/locales/en/specimen/horizontal-bar-chart.json +54 -0
- package/locales/en/specimen/line-chart.json +106 -0
- package/locales/en/specimen/pareto-chart.json +43 -0
- package/locales/en/specimen/percent-stacked-bar.json +37 -0
- package/locales/en/specimen/pie-chart.json +80 -0
- package/locales/en/specimen/polar-area-chart.json +90 -0
- package/locales/en/specimen/radar-chart.json +82 -0
- package/locales/en/specimen/radial-bar-chart.json +62 -0
- package/locales/en/specimen/range-chart.json +42 -0
- package/locales/en/specimen/regression-overlay.json +36 -0
- package/locales/en/specimen/sankey-chart.json +89 -0
- package/locales/en/specimen/scatter-plot.json +88 -0
- package/locales/en/specimen/sparkbar.json +51 -0
- package/locales/en/specimen/sparkline.json +70 -0
- package/locales/en/specimen/stacked-area-chart.json +44 -0
- package/locales/en/specimen/stacked-bar-chart.json +34 -0
- package/locales/en/specimen/step-line-chart.json +33 -0
- package/locales/en/specimen/stream-graph.json +54 -0
- package/locales/en/specimen/sunburst-chart.json +110 -0
- package/locales/en/specimen/timeline-chart.json +77 -0
- package/locales/en/specimen/treemap-chart.json +107 -0
- package/locales/en/specimen/violin-plot.json +54 -0
- package/locales/en/specimen/waterfall-chart.json +71 -0
- package/package.json +8 -7
- /package/dist/{recipe-BbGw00ut.js → recipes-BbGw00ut.js} +0 -0
|
@@ -0,0 +1,938 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { dt as BubbleChart } from "../../shared-DVZJ2nST.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Room, specimen, useWords } from "@stealthscale/specimen";
|
|
7
|
+
import { RotateCcwIcon } from "lucide-react";
|
|
8
|
+
import { Button } from "@stealthscale/component-actions";
|
|
9
|
+
import { Stack } from "@stealthscale/component-layout";
|
|
10
|
+
//#region src/bubble-chart/examples/accounts.example.tsx
|
|
11
|
+
var accounts_example_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
+
Accounts: () => Accounts,
|
|
13
|
+
source: () => source$4
|
|
14
|
+
});
|
|
15
|
+
const BUSINESS$1 = [
|
|
16
|
+
[
|
|
17
|
+
240,
|
|
18
|
+
.66,
|
|
19
|
+
216e3
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
200,
|
|
23
|
+
.43,
|
|
24
|
+
18e4
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
150,
|
|
28
|
+
.71,
|
|
29
|
+
135e3
|
|
30
|
+
],
|
|
31
|
+
[
|
|
32
|
+
120,
|
|
33
|
+
.47,
|
|
34
|
+
108e3
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
85,
|
|
38
|
+
.62,
|
|
39
|
+
76500
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
60,
|
|
43
|
+
.54,
|
|
44
|
+
54e3
|
|
45
|
+
]
|
|
46
|
+
].map(([seats = 0, active = 0, arr = 0]) => ({
|
|
47
|
+
active,
|
|
48
|
+
arr,
|
|
49
|
+
seats
|
|
50
|
+
}));
|
|
51
|
+
const TEAM$1 = [
|
|
52
|
+
[
|
|
53
|
+
30,
|
|
54
|
+
.69,
|
|
55
|
+
18e3
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
25,
|
|
59
|
+
.77,
|
|
60
|
+
15e3
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
20,
|
|
64
|
+
.58,
|
|
65
|
+
12e3
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
15,
|
|
69
|
+
.81,
|
|
70
|
+
9e3
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
12,
|
|
74
|
+
.65,
|
|
75
|
+
7200
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
8,
|
|
79
|
+
.72,
|
|
80
|
+
4800
|
|
81
|
+
]
|
|
82
|
+
].map(([seats = 0, active = 0, arr = 0]) => ({
|
|
83
|
+
active,
|
|
84
|
+
arr,
|
|
85
|
+
seats
|
|
86
|
+
}));
|
|
87
|
+
function Accounts() {
|
|
88
|
+
const $ = c(33);
|
|
89
|
+
const { t } = useWords("bubble-chart");
|
|
90
|
+
let t0;
|
|
91
|
+
if ($[0] !== t) {
|
|
92
|
+
t0 = t("accounts.caption");
|
|
93
|
+
$[0] = t;
|
|
94
|
+
$[1] = t0;
|
|
95
|
+
} else t0 = $[1];
|
|
96
|
+
let t1;
|
|
97
|
+
if ($[2] !== t) {
|
|
98
|
+
t1 = t("accounts.label");
|
|
99
|
+
$[2] = t;
|
|
100
|
+
$[3] = t1;
|
|
101
|
+
} else t1 = $[3];
|
|
102
|
+
let t2;
|
|
103
|
+
if ($[4] !== t) {
|
|
104
|
+
t2 = t("plans");
|
|
105
|
+
$[4] = t;
|
|
106
|
+
$[5] = t2;
|
|
107
|
+
} else t2 = $[5];
|
|
108
|
+
let t3;
|
|
109
|
+
if ($[6] !== t) {
|
|
110
|
+
t3 = t("accounts.business");
|
|
111
|
+
$[6] = t;
|
|
112
|
+
$[7] = t3;
|
|
113
|
+
} else t3 = $[7];
|
|
114
|
+
let t4;
|
|
115
|
+
if ($[8] !== t3) {
|
|
116
|
+
t4 = {
|
|
117
|
+
key: "business",
|
|
118
|
+
label: t3,
|
|
119
|
+
points: BUSINESS$1
|
|
120
|
+
};
|
|
121
|
+
$[8] = t3;
|
|
122
|
+
$[9] = t4;
|
|
123
|
+
} else t4 = $[9];
|
|
124
|
+
let t5;
|
|
125
|
+
if ($[10] !== t) {
|
|
126
|
+
t5 = t("accounts.team");
|
|
127
|
+
$[10] = t;
|
|
128
|
+
$[11] = t5;
|
|
129
|
+
} else t5 = $[11];
|
|
130
|
+
let t6;
|
|
131
|
+
if ($[12] !== t5) {
|
|
132
|
+
t6 = {
|
|
133
|
+
key: "team",
|
|
134
|
+
label: t5,
|
|
135
|
+
points: TEAM$1
|
|
136
|
+
};
|
|
137
|
+
$[12] = t5;
|
|
138
|
+
$[13] = t6;
|
|
139
|
+
} else t6 = $[13];
|
|
140
|
+
let t7;
|
|
141
|
+
if ($[14] !== t4 || $[15] !== t6) {
|
|
142
|
+
t7 = [t4, t6];
|
|
143
|
+
$[14] = t4;
|
|
144
|
+
$[15] = t6;
|
|
145
|
+
$[16] = t7;
|
|
146
|
+
} else t7 = $[16];
|
|
147
|
+
let t8;
|
|
148
|
+
if ($[17] !== t) {
|
|
149
|
+
t8 = t("accounts.arr");
|
|
150
|
+
$[17] = t;
|
|
151
|
+
$[18] = t8;
|
|
152
|
+
} else t8 = $[18];
|
|
153
|
+
let t9;
|
|
154
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
155
|
+
t9 = {
|
|
156
|
+
currency: "EUR",
|
|
157
|
+
notation: "compact",
|
|
158
|
+
style: "currency"
|
|
159
|
+
};
|
|
160
|
+
$[19] = t9;
|
|
161
|
+
} else t9 = $[19];
|
|
162
|
+
let t10;
|
|
163
|
+
if ($[20] !== t) {
|
|
164
|
+
t10 = t("accounts.seats");
|
|
165
|
+
$[20] = t;
|
|
166
|
+
$[21] = t10;
|
|
167
|
+
} else t10 = $[21];
|
|
168
|
+
let t11;
|
|
169
|
+
if ($[22] !== t) {
|
|
170
|
+
t11 = t("accounts.active");
|
|
171
|
+
$[22] = t;
|
|
172
|
+
$[23] = t11;
|
|
173
|
+
} else t11 = $[23];
|
|
174
|
+
let t12;
|
|
175
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
176
|
+
t12 = { style: "percent" };
|
|
177
|
+
$[24] = t12;
|
|
178
|
+
} else t12 = $[24];
|
|
179
|
+
let t13;
|
|
180
|
+
if ($[25] !== t0 || $[26] !== t1 || $[27] !== t10 || $[28] !== t11 || $[29] !== t2 || $[30] !== t7 || $[31] !== t8) {
|
|
181
|
+
t13 = /* @__PURE__ */ jsx(BubbleChart, {
|
|
182
|
+
caption: t0,
|
|
183
|
+
label: t1,
|
|
184
|
+
legendLabel: t2,
|
|
185
|
+
series: t7,
|
|
186
|
+
sizeKey: "arr",
|
|
187
|
+
sizeLabel: t8,
|
|
188
|
+
sizeOptions: t9,
|
|
189
|
+
xKey: "seats",
|
|
190
|
+
xLabel: t10,
|
|
191
|
+
yKey: "active",
|
|
192
|
+
yLabel: t11,
|
|
193
|
+
yOptions: t12
|
|
194
|
+
});
|
|
195
|
+
$[25] = t0;
|
|
196
|
+
$[26] = t1;
|
|
197
|
+
$[27] = t10;
|
|
198
|
+
$[28] = t11;
|
|
199
|
+
$[29] = t2;
|
|
200
|
+
$[30] = t7;
|
|
201
|
+
$[31] = t8;
|
|
202
|
+
$[32] = t13;
|
|
203
|
+
} else t13 = $[32];
|
|
204
|
+
return t13;
|
|
205
|
+
}
|
|
206
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { BubbleChart } from \"@stealthscale/component-charts\";\n\nconst BUSINESS = [\n [240, 0.66, 216_000],\n [200, 0.43, 180_000],\n [150, 0.71, 135_000],\n [120, 0.47, 108_000],\n [85, 0.62, 76_500],\n [60, 0.54, 54_000],\n].map(([seats = 0, active = 0, arr = 0]) => ({ active, arr, seats }));\n\nconst TEAM = [\n [30, 0.69, 18_000],\n [25, 0.77, 15_000],\n [20, 0.58, 12_000],\n [15, 0.81, 9000],\n [12, 0.65, 7200],\n [8, 0.72, 4800],\n].map(([seats = 0, active = 0, arr = 0]) => ({ active, arr, seats }));\n\nexport function Accounts(): ReactElement {\n const { t } = useWords(\"bubble-chart\");\n\n return (\n <BubbleChart\n caption={t(\"accounts.caption\")}\n label={t(\"accounts.label\")}\n legendLabel={t(\"plans\")}\n series={[\n { key: \"business\", label: t(\"accounts.business\"), points: BUSINESS },\n { key: \"team\", label: t(\"accounts.team\"), points: TEAM },\n ]}\n sizeKey=\"arr\"\n sizeLabel={t(\"accounts.arr\")}\n sizeOptions={{ currency: \"EUR\", notation: \"compact\", style: \"currency\" }}\n xKey=\"seats\"\n xLabel={t(\"accounts.seats\")}\n yKey=\"active\"\n yLabel={t(\"accounts.active\")}\n yOptions={{ style: \"percent\" }}\n />\n );\n}\n";
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/bubble-chart/examples/features.example.tsx
|
|
209
|
+
var features_example_exports = /* @__PURE__ */ __exportAll({
|
|
210
|
+
Features: () => Features,
|
|
211
|
+
source: () => source$3
|
|
212
|
+
});
|
|
213
|
+
const FEATURES$1 = [
|
|
214
|
+
[
|
|
215
|
+
.82,
|
|
216
|
+
4.1,
|
|
217
|
+
12400
|
|
218
|
+
],
|
|
219
|
+
[
|
|
220
|
+
.64,
|
|
221
|
+
3.8,
|
|
222
|
+
9700
|
|
223
|
+
],
|
|
224
|
+
[
|
|
225
|
+
.51,
|
|
226
|
+
4.4,
|
|
227
|
+
7700
|
|
228
|
+
],
|
|
229
|
+
[
|
|
230
|
+
.38,
|
|
231
|
+
3.2,
|
|
232
|
+
5800
|
|
233
|
+
],
|
|
234
|
+
[
|
|
235
|
+
.29,
|
|
236
|
+
4.6,
|
|
237
|
+
4400
|
|
238
|
+
],
|
|
239
|
+
[
|
|
240
|
+
.21,
|
|
241
|
+
3.5,
|
|
242
|
+
3200
|
|
243
|
+
],
|
|
244
|
+
[
|
|
245
|
+
.12,
|
|
246
|
+
2.9,
|
|
247
|
+
1800
|
|
248
|
+
],
|
|
249
|
+
[
|
|
250
|
+
.08,
|
|
251
|
+
4.2,
|
|
252
|
+
1200
|
|
253
|
+
]
|
|
254
|
+
].map(([adoption = 0, rating = 0, users = 0]) => ({
|
|
255
|
+
adoption,
|
|
256
|
+
rating,
|
|
257
|
+
users
|
|
258
|
+
}));
|
|
259
|
+
function Features() {
|
|
260
|
+
const $ = c(25);
|
|
261
|
+
const { t } = useWords("bubble-chart");
|
|
262
|
+
let t0;
|
|
263
|
+
if ($[0] !== t) {
|
|
264
|
+
t0 = t("features.caption");
|
|
265
|
+
$[0] = t;
|
|
266
|
+
$[1] = t0;
|
|
267
|
+
} else t0 = $[1];
|
|
268
|
+
let t1;
|
|
269
|
+
if ($[2] !== t) {
|
|
270
|
+
t1 = t("features.label");
|
|
271
|
+
$[2] = t;
|
|
272
|
+
$[3] = t1;
|
|
273
|
+
} else t1 = $[3];
|
|
274
|
+
let t2;
|
|
275
|
+
if ($[4] !== t) {
|
|
276
|
+
t2 = t("features.features");
|
|
277
|
+
$[4] = t;
|
|
278
|
+
$[5] = t2;
|
|
279
|
+
} else t2 = $[5];
|
|
280
|
+
let t3;
|
|
281
|
+
if ($[6] !== t2) {
|
|
282
|
+
t3 = [{
|
|
283
|
+
key: "features",
|
|
284
|
+
label: t2,
|
|
285
|
+
points: FEATURES$1
|
|
286
|
+
}];
|
|
287
|
+
$[6] = t2;
|
|
288
|
+
$[7] = t3;
|
|
289
|
+
} else t3 = $[7];
|
|
290
|
+
let t4;
|
|
291
|
+
if ($[8] !== t) {
|
|
292
|
+
t4 = t("features.users");
|
|
293
|
+
$[8] = t;
|
|
294
|
+
$[9] = t4;
|
|
295
|
+
} else t4 = $[9];
|
|
296
|
+
let t5;
|
|
297
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
298
|
+
t5 = { notation: "compact" };
|
|
299
|
+
$[10] = t5;
|
|
300
|
+
} else t5 = $[10];
|
|
301
|
+
let t6;
|
|
302
|
+
if ($[11] !== t) {
|
|
303
|
+
t6 = t("features.adoption");
|
|
304
|
+
$[11] = t;
|
|
305
|
+
$[12] = t6;
|
|
306
|
+
} else t6 = $[12];
|
|
307
|
+
let t7;
|
|
308
|
+
let t8;
|
|
309
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
310
|
+
t7 = { style: "percent" };
|
|
311
|
+
t8 = [1, 5];
|
|
312
|
+
$[13] = t7;
|
|
313
|
+
$[14] = t8;
|
|
314
|
+
} else {
|
|
315
|
+
t7 = $[13];
|
|
316
|
+
t8 = $[14];
|
|
317
|
+
}
|
|
318
|
+
let t9;
|
|
319
|
+
if ($[15] !== t) {
|
|
320
|
+
t9 = t("features.rating");
|
|
321
|
+
$[15] = t;
|
|
322
|
+
$[16] = t9;
|
|
323
|
+
} else t9 = $[16];
|
|
324
|
+
let t10;
|
|
325
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
326
|
+
t10 = { maximumFractionDigits: 1 };
|
|
327
|
+
$[17] = t10;
|
|
328
|
+
} else t10 = $[17];
|
|
329
|
+
let t11;
|
|
330
|
+
if ($[18] !== t0 || $[19] !== t1 || $[20] !== t3 || $[21] !== t4 || $[22] !== t6 || $[23] !== t9) {
|
|
331
|
+
t11 = /* @__PURE__ */ jsx(BubbleChart, {
|
|
332
|
+
caption: t0,
|
|
333
|
+
label: t1,
|
|
334
|
+
series: t3,
|
|
335
|
+
sizeKey: "users",
|
|
336
|
+
sizeLabel: t4,
|
|
337
|
+
sizeOptions: t5,
|
|
338
|
+
xKey: "adoption",
|
|
339
|
+
xLabel: t6,
|
|
340
|
+
xOptions: t7,
|
|
341
|
+
yDomain: t8,
|
|
342
|
+
yKey: "rating",
|
|
343
|
+
yLabel: t9,
|
|
344
|
+
yOptions: t10
|
|
345
|
+
});
|
|
346
|
+
$[18] = t0;
|
|
347
|
+
$[19] = t1;
|
|
348
|
+
$[20] = t3;
|
|
349
|
+
$[21] = t4;
|
|
350
|
+
$[22] = t6;
|
|
351
|
+
$[23] = t9;
|
|
352
|
+
$[24] = t11;
|
|
353
|
+
} else t11 = $[24];
|
|
354
|
+
return t11;
|
|
355
|
+
}
|
|
356
|
+
const source$3 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { BubbleChart } from \"@stealthscale/component-charts\";\n\nconst FEATURES = [\n [0.82, 4.1, 12_400],\n [0.64, 3.8, 9700],\n [0.51, 4.4, 7700],\n [0.38, 3.2, 5800],\n [0.29, 4.6, 4400],\n [0.21, 3.5, 3200],\n [0.12, 2.9, 1800],\n [0.08, 4.2, 1200],\n].map(([adoption = 0, rating = 0, users = 0]) => ({ adoption, rating, users }));\n\nexport function Features(): ReactElement {\n const { t } = useWords(\"bubble-chart\");\n\n return (\n <BubbleChart\n caption={t(\"features.caption\")}\n label={t(\"features.label\")}\n series={[{ key: \"features\", label: t(\"features.features\"), points: FEATURES }]}\n sizeKey=\"users\"\n sizeLabel={t(\"features.users\")}\n sizeOptions={{ notation: \"compact\" }}\n xKey=\"adoption\"\n xLabel={t(\"features.adoption\")}\n xOptions={{ style: \"percent\" }}\n yDomain={[1, 5]}\n yKey=\"rating\"\n yLabel={t(\"features.rating\")}\n yOptions={{ maximumFractionDigits: 1 }}\n />\n );\n}\n";
|
|
357
|
+
//#endregion
|
|
358
|
+
//#region src/bubble-chart/examples/largest.example.tsx
|
|
359
|
+
var largest_example_exports = /* @__PURE__ */ __exportAll({
|
|
360
|
+
Largest: () => Largest,
|
|
361
|
+
source: () => source$2
|
|
362
|
+
});
|
|
363
|
+
const BUSINESS = [
|
|
364
|
+
[
|
|
365
|
+
240,
|
|
366
|
+
.66,
|
|
367
|
+
216e3
|
|
368
|
+
],
|
|
369
|
+
[
|
|
370
|
+
200,
|
|
371
|
+
.43,
|
|
372
|
+
18e4
|
|
373
|
+
],
|
|
374
|
+
[
|
|
375
|
+
150,
|
|
376
|
+
.71,
|
|
377
|
+
135e3
|
|
378
|
+
],
|
|
379
|
+
[
|
|
380
|
+
120,
|
|
381
|
+
.47,
|
|
382
|
+
108e3
|
|
383
|
+
],
|
|
384
|
+
[
|
|
385
|
+
85,
|
|
386
|
+
.62,
|
|
387
|
+
76500
|
|
388
|
+
],
|
|
389
|
+
[
|
|
390
|
+
60,
|
|
391
|
+
.54,
|
|
392
|
+
54e3
|
|
393
|
+
]
|
|
394
|
+
].map(([seats = 0, active = 0, arr = 0]) => ({
|
|
395
|
+
active,
|
|
396
|
+
arr,
|
|
397
|
+
seats
|
|
398
|
+
}));
|
|
399
|
+
const TEAM = [
|
|
400
|
+
[
|
|
401
|
+
30,
|
|
402
|
+
.69,
|
|
403
|
+
18e3
|
|
404
|
+
],
|
|
405
|
+
[
|
|
406
|
+
25,
|
|
407
|
+
.77,
|
|
408
|
+
15e3
|
|
409
|
+
],
|
|
410
|
+
[
|
|
411
|
+
20,
|
|
412
|
+
.58,
|
|
413
|
+
12e3
|
|
414
|
+
],
|
|
415
|
+
[
|
|
416
|
+
15,
|
|
417
|
+
.81,
|
|
418
|
+
9e3
|
|
419
|
+
],
|
|
420
|
+
[
|
|
421
|
+
12,
|
|
422
|
+
.65,
|
|
423
|
+
7200
|
|
424
|
+
],
|
|
425
|
+
[
|
|
426
|
+
8,
|
|
427
|
+
.72,
|
|
428
|
+
4800
|
|
429
|
+
]
|
|
430
|
+
].map(([seats = 0, active = 0, arr = 0]) => ({
|
|
431
|
+
active,
|
|
432
|
+
arr,
|
|
433
|
+
seats
|
|
434
|
+
}));
|
|
435
|
+
function Largest() {
|
|
436
|
+
const $ = c(33);
|
|
437
|
+
const { t } = useWords("bubble-chart");
|
|
438
|
+
let t0;
|
|
439
|
+
if ($[0] !== t) {
|
|
440
|
+
t0 = t("largest.caption");
|
|
441
|
+
$[0] = t;
|
|
442
|
+
$[1] = t0;
|
|
443
|
+
} else t0 = $[1];
|
|
444
|
+
let t1;
|
|
445
|
+
if ($[2] !== t) {
|
|
446
|
+
t1 = t("accounts.label");
|
|
447
|
+
$[2] = t;
|
|
448
|
+
$[3] = t1;
|
|
449
|
+
} else t1 = $[3];
|
|
450
|
+
let t2;
|
|
451
|
+
if ($[4] !== t) {
|
|
452
|
+
t2 = t("plans");
|
|
453
|
+
$[4] = t;
|
|
454
|
+
$[5] = t2;
|
|
455
|
+
} else t2 = $[5];
|
|
456
|
+
let t3;
|
|
457
|
+
if ($[6] !== t) {
|
|
458
|
+
t3 = t("accounts.business");
|
|
459
|
+
$[6] = t;
|
|
460
|
+
$[7] = t3;
|
|
461
|
+
} else t3 = $[7];
|
|
462
|
+
let t4;
|
|
463
|
+
if ($[8] !== t3) {
|
|
464
|
+
t4 = {
|
|
465
|
+
key: "business",
|
|
466
|
+
label: t3,
|
|
467
|
+
points: BUSINESS
|
|
468
|
+
};
|
|
469
|
+
$[8] = t3;
|
|
470
|
+
$[9] = t4;
|
|
471
|
+
} else t4 = $[9];
|
|
472
|
+
let t5;
|
|
473
|
+
if ($[10] !== t) {
|
|
474
|
+
t5 = t("accounts.team");
|
|
475
|
+
$[10] = t;
|
|
476
|
+
$[11] = t5;
|
|
477
|
+
} else t5 = $[11];
|
|
478
|
+
let t6;
|
|
479
|
+
if ($[12] !== t5) {
|
|
480
|
+
t6 = {
|
|
481
|
+
key: "team",
|
|
482
|
+
label: t5,
|
|
483
|
+
points: TEAM
|
|
484
|
+
};
|
|
485
|
+
$[12] = t5;
|
|
486
|
+
$[13] = t6;
|
|
487
|
+
} else t6 = $[13];
|
|
488
|
+
let t7;
|
|
489
|
+
if ($[14] !== t4 || $[15] !== t6) {
|
|
490
|
+
t7 = [t4, t6];
|
|
491
|
+
$[14] = t4;
|
|
492
|
+
$[15] = t6;
|
|
493
|
+
$[16] = t7;
|
|
494
|
+
} else t7 = $[16];
|
|
495
|
+
let t8;
|
|
496
|
+
if ($[17] !== t) {
|
|
497
|
+
t8 = t("accounts.arr");
|
|
498
|
+
$[17] = t;
|
|
499
|
+
$[18] = t8;
|
|
500
|
+
} else t8 = $[18];
|
|
501
|
+
let t9;
|
|
502
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
503
|
+
t9 = {
|
|
504
|
+
currency: "EUR",
|
|
505
|
+
notation: "compact",
|
|
506
|
+
style: "currency"
|
|
507
|
+
};
|
|
508
|
+
$[19] = t9;
|
|
509
|
+
} else t9 = $[19];
|
|
510
|
+
let t10;
|
|
511
|
+
if ($[20] !== t) {
|
|
512
|
+
t10 = t("accounts.seats");
|
|
513
|
+
$[20] = t;
|
|
514
|
+
$[21] = t10;
|
|
515
|
+
} else t10 = $[21];
|
|
516
|
+
let t11;
|
|
517
|
+
if ($[22] !== t) {
|
|
518
|
+
t11 = t("accounts.active");
|
|
519
|
+
$[22] = t;
|
|
520
|
+
$[23] = t11;
|
|
521
|
+
} else t11 = $[23];
|
|
522
|
+
let t12;
|
|
523
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
524
|
+
t12 = { style: "percent" };
|
|
525
|
+
$[24] = t12;
|
|
526
|
+
} else t12 = $[24];
|
|
527
|
+
let t13;
|
|
528
|
+
if ($[25] !== t0 || $[26] !== t1 || $[27] !== t10 || $[28] !== t11 || $[29] !== t2 || $[30] !== t7 || $[31] !== t8) {
|
|
529
|
+
t13 = /* @__PURE__ */ jsx(BubbleChart, {
|
|
530
|
+
caption: t0,
|
|
531
|
+
defaultIndex: 0,
|
|
532
|
+
label: t1,
|
|
533
|
+
legendLabel: t2,
|
|
534
|
+
series: t7,
|
|
535
|
+
sizeKey: "arr",
|
|
536
|
+
sizeLabel: t8,
|
|
537
|
+
sizeOptions: t9,
|
|
538
|
+
xKey: "seats",
|
|
539
|
+
xLabel: t10,
|
|
540
|
+
yKey: "active",
|
|
541
|
+
yLabel: t11,
|
|
542
|
+
yOptions: t12
|
|
543
|
+
});
|
|
544
|
+
$[25] = t0;
|
|
545
|
+
$[26] = t1;
|
|
546
|
+
$[27] = t10;
|
|
547
|
+
$[28] = t11;
|
|
548
|
+
$[29] = t2;
|
|
549
|
+
$[30] = t7;
|
|
550
|
+
$[31] = t8;
|
|
551
|
+
$[32] = t13;
|
|
552
|
+
} else t13 = $[32];
|
|
553
|
+
return t13;
|
|
554
|
+
}
|
|
555
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { BubbleChart } from \"@stealthscale/component-charts\";\n\nconst BUSINESS = [\n [240, 0.66, 216_000],\n [200, 0.43, 180_000],\n [150, 0.71, 135_000],\n [120, 0.47, 108_000],\n [85, 0.62, 76_500],\n [60, 0.54, 54_000],\n].map(([seats = 0, active = 0, arr = 0]) => ({ active, arr, seats }));\n\nconst TEAM = [\n [30, 0.69, 18_000],\n [25, 0.77, 15_000],\n [20, 0.58, 12_000],\n [15, 0.81, 9000],\n [12, 0.65, 7200],\n [8, 0.72, 4800],\n].map(([seats = 0, active = 0, arr = 0]) => ({ active, arr, seats }));\n\nexport function Largest(): ReactElement {\n const { t } = useWords(\"bubble-chart\");\n\n return (\n <BubbleChart\n caption={t(\"largest.caption\")}\n defaultIndex={0}\n label={t(\"accounts.label\")}\n legendLabel={t(\"plans\")}\n series={[\n { key: \"business\", label: t(\"accounts.business\"), points: BUSINESS },\n { key: \"team\", label: t(\"accounts.team\"), points: TEAM },\n ]}\n sizeKey=\"arr\"\n sizeLabel={t(\"accounts.arr\")}\n sizeOptions={{ currency: \"EUR\", notation: \"compact\", style: \"currency\" }}\n xKey=\"seats\"\n xLabel={t(\"accounts.seats\")}\n yKey=\"active\"\n yLabel={t(\"accounts.active\")}\n yOptions={{ style: \"percent\" }}\n />\n );\n}\n";
|
|
556
|
+
//#endregion
|
|
557
|
+
//#region src/bubble-chart/examples/quiet.example.tsx
|
|
558
|
+
var quiet_example_exports = /* @__PURE__ */ __exportAll({
|
|
559
|
+
Quiet: () => Quiet,
|
|
560
|
+
source: () => source$1
|
|
561
|
+
});
|
|
562
|
+
const ACCOUNTS = [];
|
|
563
|
+
function Quiet() {
|
|
564
|
+
const $ = c(24);
|
|
565
|
+
const { t } = useWords("bubble-chart");
|
|
566
|
+
let t0;
|
|
567
|
+
if ($[0] !== t) {
|
|
568
|
+
t0 = t("quiet.caption");
|
|
569
|
+
$[0] = t;
|
|
570
|
+
$[1] = t0;
|
|
571
|
+
} else t0 = $[1];
|
|
572
|
+
let t1;
|
|
573
|
+
if ($[2] !== t) {
|
|
574
|
+
t1 = t("quiet.empty");
|
|
575
|
+
$[2] = t;
|
|
576
|
+
$[3] = t1;
|
|
577
|
+
} else t1 = $[3];
|
|
578
|
+
let t2;
|
|
579
|
+
if ($[4] !== t) {
|
|
580
|
+
t2 = t("accounts.label");
|
|
581
|
+
$[4] = t;
|
|
582
|
+
$[5] = t2;
|
|
583
|
+
} else t2 = $[5];
|
|
584
|
+
let t3;
|
|
585
|
+
if ($[6] !== t) {
|
|
586
|
+
t3 = t("quiet.accounts");
|
|
587
|
+
$[6] = t;
|
|
588
|
+
$[7] = t3;
|
|
589
|
+
} else t3 = $[7];
|
|
590
|
+
let t4;
|
|
591
|
+
if ($[8] !== t3) {
|
|
592
|
+
t4 = [{
|
|
593
|
+
key: "accounts",
|
|
594
|
+
label: t3,
|
|
595
|
+
points: ACCOUNTS
|
|
596
|
+
}];
|
|
597
|
+
$[8] = t3;
|
|
598
|
+
$[9] = t4;
|
|
599
|
+
} else t4 = $[9];
|
|
600
|
+
let t5;
|
|
601
|
+
if ($[10] !== t) {
|
|
602
|
+
t5 = t("accounts.arr");
|
|
603
|
+
$[10] = t;
|
|
604
|
+
$[11] = t5;
|
|
605
|
+
} else t5 = $[11];
|
|
606
|
+
let t6;
|
|
607
|
+
if ($[12] !== t) {
|
|
608
|
+
t6 = t("accounts.seats");
|
|
609
|
+
$[12] = t;
|
|
610
|
+
$[13] = t6;
|
|
611
|
+
} else t6 = $[13];
|
|
612
|
+
let t7;
|
|
613
|
+
if ($[14] !== t) {
|
|
614
|
+
t7 = t("accounts.active");
|
|
615
|
+
$[14] = t;
|
|
616
|
+
$[15] = t7;
|
|
617
|
+
} else t7 = $[15];
|
|
618
|
+
let t8;
|
|
619
|
+
if ($[16] !== t0 || $[17] !== t1 || $[18] !== t2 || $[19] !== t4 || $[20] !== t5 || $[21] !== t6 || $[22] !== t7) {
|
|
620
|
+
t8 = /* @__PURE__ */ jsx(BubbleChart, {
|
|
621
|
+
caption: t0,
|
|
622
|
+
empty: t1,
|
|
623
|
+
label: t2,
|
|
624
|
+
series: t4,
|
|
625
|
+
sizeKey: "arr",
|
|
626
|
+
sizeLabel: t5,
|
|
627
|
+
xKey: "seats",
|
|
628
|
+
xLabel: t6,
|
|
629
|
+
yKey: "active",
|
|
630
|
+
yLabel: t7
|
|
631
|
+
});
|
|
632
|
+
$[16] = t0;
|
|
633
|
+
$[17] = t1;
|
|
634
|
+
$[18] = t2;
|
|
635
|
+
$[19] = t4;
|
|
636
|
+
$[20] = t5;
|
|
637
|
+
$[21] = t6;
|
|
638
|
+
$[22] = t7;
|
|
639
|
+
$[23] = t8;
|
|
640
|
+
} else t8 = $[23];
|
|
641
|
+
return t8;
|
|
642
|
+
}
|
|
643
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { BubbleChart } from \"@stealthscale/component-charts\";\n\nconst ACCOUNTS: Array<{ active: number; arr: number; seats: number }> = [];\n\nexport function Quiet(): ReactElement {\n const { t } = useWords(\"bubble-chart\");\n\n return (\n <BubbleChart\n caption={t(\"quiet.caption\")}\n empty={t(\"quiet.empty\")}\n label={t(\"accounts.label\")}\n series={[{ key: \"accounts\", label: t(\"quiet.accounts\"), points: ACCOUNTS }]}\n sizeKey=\"arr\"\n sizeLabel={t(\"accounts.arr\")}\n xKey=\"seats\"\n xLabel={t(\"accounts.seats\")}\n yKey=\"active\"\n yLabel={t(\"accounts.active\")}\n />\n );\n}\n";
|
|
644
|
+
//#endregion
|
|
645
|
+
//#region src/bubble-chart/examples/replay.example.tsx
|
|
646
|
+
var replay_example_exports = /* @__PURE__ */ __exportAll({
|
|
647
|
+
Replay: () => Replay,
|
|
648
|
+
source: () => source
|
|
649
|
+
});
|
|
650
|
+
const FEATURES = [
|
|
651
|
+
[
|
|
652
|
+
.82,
|
|
653
|
+
4.1,
|
|
654
|
+
12400
|
|
655
|
+
],
|
|
656
|
+
[
|
|
657
|
+
.64,
|
|
658
|
+
3.8,
|
|
659
|
+
9700
|
|
660
|
+
],
|
|
661
|
+
[
|
|
662
|
+
.51,
|
|
663
|
+
4.4,
|
|
664
|
+
7700
|
|
665
|
+
],
|
|
666
|
+
[
|
|
667
|
+
.38,
|
|
668
|
+
3.2,
|
|
669
|
+
5800
|
|
670
|
+
],
|
|
671
|
+
[
|
|
672
|
+
.29,
|
|
673
|
+
4.6,
|
|
674
|
+
4400
|
|
675
|
+
],
|
|
676
|
+
[
|
|
677
|
+
.21,
|
|
678
|
+
3.5,
|
|
679
|
+
3200
|
|
680
|
+
],
|
|
681
|
+
[
|
|
682
|
+
.12,
|
|
683
|
+
2.9,
|
|
684
|
+
1800
|
|
685
|
+
],
|
|
686
|
+
[
|
|
687
|
+
.08,
|
|
688
|
+
4.2,
|
|
689
|
+
1200
|
|
690
|
+
]
|
|
691
|
+
].map(([adoption = 0, rating = 0, users = 0]) => ({
|
|
692
|
+
adoption,
|
|
693
|
+
rating,
|
|
694
|
+
users
|
|
695
|
+
}));
|
|
696
|
+
function Replay() {
|
|
697
|
+
const $ = c(37);
|
|
698
|
+
const { t } = useWords("bubble-chart");
|
|
699
|
+
const [run, setRun] = useState(0);
|
|
700
|
+
let t0;
|
|
701
|
+
if ($[0] !== t) {
|
|
702
|
+
t0 = t("features.caption");
|
|
703
|
+
$[0] = t;
|
|
704
|
+
$[1] = t0;
|
|
705
|
+
} else t0 = $[1];
|
|
706
|
+
let t1;
|
|
707
|
+
if ($[2] !== t) {
|
|
708
|
+
t1 = t("features.label");
|
|
709
|
+
$[2] = t;
|
|
710
|
+
$[3] = t1;
|
|
711
|
+
} else t1 = $[3];
|
|
712
|
+
let t2;
|
|
713
|
+
if ($[4] !== t) {
|
|
714
|
+
t2 = t("features.features");
|
|
715
|
+
$[4] = t;
|
|
716
|
+
$[5] = t2;
|
|
717
|
+
} else t2 = $[5];
|
|
718
|
+
let t3;
|
|
719
|
+
if ($[6] !== t2) {
|
|
720
|
+
t3 = [{
|
|
721
|
+
key: "features",
|
|
722
|
+
label: t2,
|
|
723
|
+
points: FEATURES
|
|
724
|
+
}];
|
|
725
|
+
$[6] = t2;
|
|
726
|
+
$[7] = t3;
|
|
727
|
+
} else t3 = $[7];
|
|
728
|
+
let t4;
|
|
729
|
+
if ($[8] !== t) {
|
|
730
|
+
t4 = t("features.users");
|
|
731
|
+
$[8] = t;
|
|
732
|
+
$[9] = t4;
|
|
733
|
+
} else t4 = $[9];
|
|
734
|
+
let t5;
|
|
735
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
736
|
+
t5 = { notation: "compact" };
|
|
737
|
+
$[10] = t5;
|
|
738
|
+
} else t5 = $[10];
|
|
739
|
+
let t6;
|
|
740
|
+
if ($[11] !== t) {
|
|
741
|
+
t6 = t("features.adoption");
|
|
742
|
+
$[11] = t;
|
|
743
|
+
$[12] = t6;
|
|
744
|
+
} else t6 = $[12];
|
|
745
|
+
let t7;
|
|
746
|
+
let t8;
|
|
747
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
748
|
+
t7 = { style: "percent" };
|
|
749
|
+
t8 = [1, 5];
|
|
750
|
+
$[13] = t7;
|
|
751
|
+
$[14] = t8;
|
|
752
|
+
} else {
|
|
753
|
+
t7 = $[13];
|
|
754
|
+
t8 = $[14];
|
|
755
|
+
}
|
|
756
|
+
let t9;
|
|
757
|
+
if ($[15] !== t) {
|
|
758
|
+
t9 = t("features.rating");
|
|
759
|
+
$[15] = t;
|
|
760
|
+
$[16] = t9;
|
|
761
|
+
} else t9 = $[16];
|
|
762
|
+
let t10;
|
|
763
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
764
|
+
t10 = { maximumFractionDigits: 1 };
|
|
765
|
+
$[17] = t10;
|
|
766
|
+
} else t10 = $[17];
|
|
767
|
+
let t11;
|
|
768
|
+
if ($[18] !== run || $[19] !== t0 || $[20] !== t1 || $[21] !== t3 || $[22] !== t4 || $[23] !== t6 || $[24] !== t9) {
|
|
769
|
+
t11 = /* @__PURE__ */ jsx(BubbleChart, {
|
|
770
|
+
animate: true,
|
|
771
|
+
caption: t0,
|
|
772
|
+
label: t1,
|
|
773
|
+
series: t3,
|
|
774
|
+
sizeKey: "users",
|
|
775
|
+
sizeLabel: t4,
|
|
776
|
+
sizeOptions: t5,
|
|
777
|
+
xKey: "adoption",
|
|
778
|
+
xLabel: t6,
|
|
779
|
+
xOptions: t7,
|
|
780
|
+
yDomain: t8,
|
|
781
|
+
yKey: "rating",
|
|
782
|
+
yLabel: t9,
|
|
783
|
+
yOptions: t10
|
|
784
|
+
}, run);
|
|
785
|
+
$[18] = run;
|
|
786
|
+
$[19] = t0;
|
|
787
|
+
$[20] = t1;
|
|
788
|
+
$[21] = t3;
|
|
789
|
+
$[22] = t4;
|
|
790
|
+
$[23] = t6;
|
|
791
|
+
$[24] = t9;
|
|
792
|
+
$[25] = t11;
|
|
793
|
+
} else t11 = $[25];
|
|
794
|
+
let t12;
|
|
795
|
+
if ($[26] !== run) {
|
|
796
|
+
t12 = () => {
|
|
797
|
+
setRun(run + 1);
|
|
798
|
+
};
|
|
799
|
+
$[26] = run;
|
|
800
|
+
$[27] = t12;
|
|
801
|
+
} else t12 = $[27];
|
|
802
|
+
let t13;
|
|
803
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
804
|
+
t13 = /* @__PURE__ */ jsx(RotateCcwIcon, {});
|
|
805
|
+
$[28] = t13;
|
|
806
|
+
} else t13 = $[28];
|
|
807
|
+
let t14;
|
|
808
|
+
if ($[29] !== t) {
|
|
809
|
+
t14 = t("replay.replay");
|
|
810
|
+
$[29] = t;
|
|
811
|
+
$[30] = t14;
|
|
812
|
+
} else t14 = $[30];
|
|
813
|
+
let t15;
|
|
814
|
+
if ($[31] !== t12 || $[32] !== t14) {
|
|
815
|
+
t15 = /* @__PURE__ */ jsxs(Button, {
|
|
816
|
+
onClick: t12,
|
|
817
|
+
size: "sm",
|
|
818
|
+
variant: "outline",
|
|
819
|
+
children: [t13, t14]
|
|
820
|
+
});
|
|
821
|
+
$[31] = t12;
|
|
822
|
+
$[32] = t14;
|
|
823
|
+
$[33] = t15;
|
|
824
|
+
} else t15 = $[33];
|
|
825
|
+
let t16;
|
|
826
|
+
if ($[34] !== t11 || $[35] !== t15) {
|
|
827
|
+
t16 = /* @__PURE__ */ jsxs(Stack, {
|
|
828
|
+
align: "flex-start",
|
|
829
|
+
children: [t11, t15]
|
|
830
|
+
});
|
|
831
|
+
$[34] = t11;
|
|
832
|
+
$[35] = t15;
|
|
833
|
+
$[36] = t16;
|
|
834
|
+
} else t16 = $[36];
|
|
835
|
+
return t16;
|
|
836
|
+
}
|
|
837
|
+
const source = "import { type ReactElement, useState } from \"react\";\n\nimport { RotateCcwIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { BubbleChart } from \"@stealthscale/component-charts\";\n\nconst FEATURES = [\n [0.82, 4.1, 12_400],\n [0.64, 3.8, 9700],\n [0.51, 4.4, 7700],\n [0.38, 3.2, 5800],\n [0.29, 4.6, 4400],\n [0.21, 3.5, 3200],\n [0.12, 2.9, 1800],\n [0.08, 4.2, 1200],\n].map(([adoption = 0, rating = 0, users = 0]) => ({ adoption, rating, users }));\n\nexport function Replay(): ReactElement {\n const { t } = useWords(\"bubble-chart\");\n const [run, setRun] = useState(0);\n\n return (\n <Stack align=\"flex-start\">\n <BubbleChart\n animate\n caption={t(\"features.caption\")}\n key={run}\n label={t(\"features.label\")}\n series={[{ key: \"features\", label: t(\"features.features\"), points: FEATURES }]}\n sizeKey=\"users\"\n sizeLabel={t(\"features.users\")}\n sizeOptions={{ notation: \"compact\" }}\n xKey=\"adoption\"\n xLabel={t(\"features.adoption\")}\n xOptions={{ style: \"percent\" }}\n yDomain={[1, 5]}\n yKey=\"rating\"\n yLabel={t(\"features.rating\")}\n yOptions={{ maximumFractionDigits: 1 }}\n />\n <Button\n onClick={() => {\n setRun(run + 1);\n }}\n size=\"sm\"\n variant=\"outline\"\n >\n <RotateCcwIcon />\n {t(\"replay.replay\")}\n </Button>\n </Stack>\n );\n}\n";
|
|
838
|
+
//#endregion
|
|
839
|
+
//#region src/bubble-chart/bubble-chart.specimen.tsx
|
|
840
|
+
/**
|
|
841
|
+
* Catalogue page for the bubble chart.
|
|
842
|
+
*
|
|
843
|
+
* @remarks
|
|
844
|
+
* The bubble chart has no recipe of its own: the chart's recipe styles its figure, so every scene
|
|
845
|
+
* is hand-written. The scenes render accounts of two plans sized by revenue, features sized by
|
|
846
|
+
* their users, the tooltip open at the largest account, the points animated in with a replay,
|
|
847
|
+
* the accounts at a phone's width, and a chart without points. Every scene renders a component
|
|
848
|
+
* from `examples/` and shows that file as its source. The words are keys under `bubble-chart` in
|
|
849
|
+
* `locales/en/specimen/bubble-chart.json`.
|
|
850
|
+
*/
|
|
851
|
+
/**
|
|
852
|
+
* Hand-written scene for two series sized by a third field.
|
|
853
|
+
*/
|
|
854
|
+
const two = {
|
|
855
|
+
about: "bubble-chart.accounts.about",
|
|
856
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
857
|
+
size: "lg",
|
|
858
|
+
children: /* @__PURE__ */ jsx(Accounts, {})
|
|
859
|
+
}),
|
|
860
|
+
example: accounts_example_exports,
|
|
861
|
+
title: "bubble-chart.accounts.title"
|
|
862
|
+
};
|
|
863
|
+
/**
|
|
864
|
+
* Hand-written scene for one series with a stated value domain.
|
|
865
|
+
*/
|
|
866
|
+
const one = {
|
|
867
|
+
about: "bubble-chart.features.about",
|
|
868
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
869
|
+
size: "lg",
|
|
870
|
+
children: /* @__PURE__ */ jsx(Features, {})
|
|
871
|
+
}),
|
|
872
|
+
example: features_example_exports,
|
|
873
|
+
title: "bubble-chart.features.title"
|
|
874
|
+
};
|
|
875
|
+
/**
|
|
876
|
+
* Hand-written scene for the tooltip open at a point.
|
|
877
|
+
*/
|
|
878
|
+
const tooltip = {
|
|
879
|
+
about: "bubble-chart.largest.about",
|
|
880
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
881
|
+
size: "lg",
|
|
882
|
+
children: /* @__PURE__ */ jsx(Largest, {})
|
|
883
|
+
}),
|
|
884
|
+
example: largest_example_exports,
|
|
885
|
+
title: "bubble-chart.largest.title"
|
|
886
|
+
};
|
|
887
|
+
/**
|
|
888
|
+
* Hand-written scene for the points animated in, with a replay.
|
|
889
|
+
*/
|
|
890
|
+
const animated = {
|
|
891
|
+
about: "bubble-chart.replay.about",
|
|
892
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
893
|
+
size: "lg",
|
|
894
|
+
children: /* @__PURE__ */ jsx(Replay, {})
|
|
895
|
+
}),
|
|
896
|
+
example: replay_example_exports,
|
|
897
|
+
title: "bubble-chart.replay.title"
|
|
898
|
+
};
|
|
899
|
+
/**
|
|
900
|
+
* Hand-written scene for the accounts at a phone's width.
|
|
901
|
+
*/
|
|
902
|
+
const narrow = {
|
|
903
|
+
about: "bubble-chart.narrow.about",
|
|
904
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
905
|
+
size: "xs",
|
|
906
|
+
children: /* @__PURE__ */ jsx(Accounts, {})
|
|
907
|
+
}),
|
|
908
|
+
example: accounts_example_exports,
|
|
909
|
+
title: "bubble-chart.narrow.title"
|
|
910
|
+
};
|
|
911
|
+
/**
|
|
912
|
+
* Hand-written scene for a chart without points.
|
|
913
|
+
*/
|
|
914
|
+
const empty = {
|
|
915
|
+
about: "bubble-chart.quiet.about",
|
|
916
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
917
|
+
size: "md",
|
|
918
|
+
children: /* @__PURE__ */ jsx(Quiet, {})
|
|
919
|
+
}),
|
|
920
|
+
example: quiet_example_exports,
|
|
921
|
+
title: "bubble-chart.quiet.title"
|
|
922
|
+
};
|
|
923
|
+
var bubble_chart_specimen_default = specimen({
|
|
924
|
+
about: "bubble-chart.about",
|
|
925
|
+
id: "components/charts/bubble-chart",
|
|
926
|
+
imports: "import { BubbleChart } from \"@stealthscale/component-charts\";",
|
|
927
|
+
scenes: [
|
|
928
|
+
two,
|
|
929
|
+
one,
|
|
930
|
+
tooltip,
|
|
931
|
+
animated,
|
|
932
|
+
narrow,
|
|
933
|
+
empty
|
|
934
|
+
],
|
|
935
|
+
title: "bubble-chart.title"
|
|
936
|
+
});
|
|
937
|
+
//#endregion
|
|
938
|
+
export { animated, bubble_chart_specimen_default as default, empty, narrow, one, tooltip, two };
|