@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,1051 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { I as hierarchyLeaves, c as SunburstChart } from "../../shared-DVZJ2nST.js";
|
|
3
|
+
import { a as labelled, i as TAIL } from "../spend-5xQ76WSj.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Room, specimen, useWords } from "@stealthscale/specimen";
|
|
8
|
+
import { RotateCcwIcon } from "lucide-react";
|
|
9
|
+
import { Button } from "@stealthscale/component-actions";
|
|
10
|
+
import { Stack } from "@stealthscale/component-layout";
|
|
11
|
+
//#region src/sunburst-chart/examples/spend.ts
|
|
12
|
+
/**
|
|
13
|
+
* Lists the platform team's spend for September: compute 38,400, storage 21,100 and the network
|
|
14
|
+
* 9,300, 68,800 in all.
|
|
15
|
+
*/
|
|
16
|
+
const PLATFORM = {
|
|
17
|
+
children: [
|
|
18
|
+
{
|
|
19
|
+
children: [{
|
|
20
|
+
key: "vms",
|
|
21
|
+
value: 26e3
|
|
22
|
+
}, {
|
|
23
|
+
key: "gpus",
|
|
24
|
+
value: 12400
|
|
25
|
+
}],
|
|
26
|
+
key: "compute"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
children: [{
|
|
30
|
+
key: "blobs",
|
|
31
|
+
value: 15800
|
|
32
|
+
}, {
|
|
33
|
+
key: "backups",
|
|
34
|
+
value: 5300
|
|
35
|
+
}],
|
|
36
|
+
key: "storage"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "network",
|
|
40
|
+
value: 9300
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
key: "platform"
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Lists the product team's spend for September: the web app 14,200 and the mobile app 11,600,
|
|
47
|
+
* 25,800 in all.
|
|
48
|
+
*/
|
|
49
|
+
const PRODUCT = {
|
|
50
|
+
children: [{
|
|
51
|
+
key: "web",
|
|
52
|
+
value: 14200
|
|
53
|
+
}, {
|
|
54
|
+
key: "mobile",
|
|
55
|
+
value: 11600
|
|
56
|
+
}],
|
|
57
|
+
key: "product"
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Lists the data team's services for September: the warehouse 12,800 and the pipelines 7,100.
|
|
61
|
+
*/
|
|
62
|
+
const DATA = [{
|
|
63
|
+
key: "warehouse",
|
|
64
|
+
value: 12800
|
|
65
|
+
}, {
|
|
66
|
+
key: "pipelines",
|
|
67
|
+
value: 7100
|
|
68
|
+
}];
|
|
69
|
+
/**
|
|
70
|
+
* Lists September's cloud bill in euros by team, service and resource: the platform team 68,800,
|
|
71
|
+
* the product team 25,800 and the data team 19,900, 114,500 in all.
|
|
72
|
+
*/
|
|
73
|
+
const SPEND = [
|
|
74
|
+
PLATFORM,
|
|
75
|
+
PRODUCT,
|
|
76
|
+
{
|
|
77
|
+
children: DATA,
|
|
78
|
+
key: "data"
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
/**
|
|
82
|
+
* Lists the bill with a committed-use credit of 3,000 posted to the data team.
|
|
83
|
+
*/
|
|
84
|
+
const CREDITED = [
|
|
85
|
+
PLATFORM,
|
|
86
|
+
PRODUCT,
|
|
87
|
+
{
|
|
88
|
+
children: [...DATA, {
|
|
89
|
+
key: "credit",
|
|
90
|
+
value: -3e3
|
|
91
|
+
}],
|
|
92
|
+
key: "data"
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
/**
|
|
96
|
+
* Lists a file server's folders and subfolders in gigabytes: 6,980 in all, design and video 4,300
|
|
97
|
+
* of it.
|
|
98
|
+
*/
|
|
99
|
+
const STORAGE = [
|
|
100
|
+
{
|
|
101
|
+
children: [{
|
|
102
|
+
key: "screens",
|
|
103
|
+
value: 1500
|
|
104
|
+
}, {
|
|
105
|
+
key: "brand",
|
|
106
|
+
value: 900
|
|
107
|
+
}],
|
|
108
|
+
key: "design"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
children: [{
|
|
112
|
+
key: "footage",
|
|
113
|
+
value: 1300
|
|
114
|
+
}, {
|
|
115
|
+
key: "edits",
|
|
116
|
+
value: 600
|
|
117
|
+
}],
|
|
118
|
+
key: "video"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
children: [{
|
|
122
|
+
key: "daily",
|
|
123
|
+
value: 800
|
|
124
|
+
}, {
|
|
125
|
+
key: "weekly",
|
|
126
|
+
value: 500
|
|
127
|
+
}],
|
|
128
|
+
key: "archive"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
key: "photos",
|
|
132
|
+
value: 860
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
key: "builds",
|
|
136
|
+
value: 520
|
|
137
|
+
}
|
|
138
|
+
];
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/sunburst-chart/examples/credit.example.tsx
|
|
141
|
+
var credit_example_exports = /* @__PURE__ */ __exportAll({
|
|
142
|
+
Credit: () => Credit,
|
|
143
|
+
source: () => source$8
|
|
144
|
+
});
|
|
145
|
+
function Credit() {
|
|
146
|
+
const $ = c(21);
|
|
147
|
+
const { t } = useWords("sunburst-chart");
|
|
148
|
+
let T0;
|
|
149
|
+
let nodes;
|
|
150
|
+
let t0;
|
|
151
|
+
if ($[0] !== t) {
|
|
152
|
+
nodes = labelled(CREDITED, (key) => t(`names.${key}`));
|
|
153
|
+
const below = hierarchyLeaves(nodes).filter(_temp$1);
|
|
154
|
+
T0 = SunburstChart;
|
|
155
|
+
t0 = t("credit.caption", {
|
|
156
|
+
count: below.length,
|
|
157
|
+
names: below.map((leaf_0) => t(`names.${leaf_0.key}`)).join(", ")
|
|
158
|
+
});
|
|
159
|
+
$[0] = t;
|
|
160
|
+
$[1] = T0;
|
|
161
|
+
$[2] = nodes;
|
|
162
|
+
$[3] = t0;
|
|
163
|
+
} else {
|
|
164
|
+
T0 = $[1];
|
|
165
|
+
nodes = $[2];
|
|
166
|
+
t0 = $[3];
|
|
167
|
+
}
|
|
168
|
+
let t1;
|
|
169
|
+
if ($[4] !== t) {
|
|
170
|
+
t1 = t("spend.label");
|
|
171
|
+
$[4] = t;
|
|
172
|
+
$[5] = t1;
|
|
173
|
+
} else t1 = $[5];
|
|
174
|
+
let t2;
|
|
175
|
+
if ($[6] !== t) {
|
|
176
|
+
t2 = t("teams");
|
|
177
|
+
$[6] = t;
|
|
178
|
+
$[7] = t2;
|
|
179
|
+
} else t2 = $[7];
|
|
180
|
+
let t3;
|
|
181
|
+
if ($[8] !== t) {
|
|
182
|
+
t3 = t("share");
|
|
183
|
+
$[8] = t;
|
|
184
|
+
$[9] = t3;
|
|
185
|
+
} else t3 = $[9];
|
|
186
|
+
let t4;
|
|
187
|
+
if ($[10] !== t) {
|
|
188
|
+
t4 = t("value");
|
|
189
|
+
$[10] = t;
|
|
190
|
+
$[11] = t4;
|
|
191
|
+
} else t4 = $[11];
|
|
192
|
+
let t5;
|
|
193
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
194
|
+
t5 = {
|
|
195
|
+
currency: "EUR",
|
|
196
|
+
maximumFractionDigits: 0,
|
|
197
|
+
style: "currency"
|
|
198
|
+
};
|
|
199
|
+
$[12] = t5;
|
|
200
|
+
} else t5 = $[12];
|
|
201
|
+
let t6;
|
|
202
|
+
if ($[13] !== T0 || $[14] !== nodes || $[15] !== t0 || $[16] !== t1 || $[17] !== t2 || $[18] !== t3 || $[19] !== t4) {
|
|
203
|
+
t6 = /* @__PURE__ */ jsx(T0, {
|
|
204
|
+
caption: t0,
|
|
205
|
+
label: t1,
|
|
206
|
+
legendLabel: t2,
|
|
207
|
+
nodes,
|
|
208
|
+
shareLabel: t3,
|
|
209
|
+
valueLabel: t4,
|
|
210
|
+
valueOptions: t5
|
|
211
|
+
});
|
|
212
|
+
$[13] = T0;
|
|
213
|
+
$[14] = nodes;
|
|
214
|
+
$[15] = t0;
|
|
215
|
+
$[16] = t1;
|
|
216
|
+
$[17] = t2;
|
|
217
|
+
$[18] = t3;
|
|
218
|
+
$[19] = t4;
|
|
219
|
+
$[20] = t6;
|
|
220
|
+
} else t6 = $[20];
|
|
221
|
+
return t6;
|
|
222
|
+
}
|
|
223
|
+
function _temp$1(leaf) {
|
|
224
|
+
return leaf.value < 0;
|
|
225
|
+
}
|
|
226
|
+
const source$8 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SunburstChart, hierarchyLeaves } from \"@stealthscale/component-charts\";\n\nimport { CREDITED, labelled } from \"./spend.ts\";\n\nexport function Credit(): ReactElement {\n const { t } = useWords(\"sunburst-chart\");\n const nodes = labelled(CREDITED, (key) => t(`names.${key}`));\n const below = hierarchyLeaves(nodes).filter((leaf) => leaf.value < 0);\n\n return (\n <SunburstChart\n caption={t(\"credit.caption\", {\n count: below.length,\n names: below.map((leaf) => t(`names.${leaf.key}`)).join(\", \"),\n })}\n label={t(\"spend.label\")}\n legendLabel={t(\"teams\")}\n nodes={nodes}\n shareLabel={t(\"share\")}\n valueLabel={t(\"value\")}\n valueOptions={{ currency: \"EUR\", maximumFractionDigits: 0, style: \"currency\" }}\n />\n );\n}\n";
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/sunburst-chart/examples/hidden.example.tsx
|
|
229
|
+
var hidden_example_exports = /* @__PURE__ */ __exportAll({
|
|
230
|
+
Hidden: () => Hidden,
|
|
231
|
+
source: () => source$7
|
|
232
|
+
});
|
|
233
|
+
function Hidden() {
|
|
234
|
+
const $ = c(21);
|
|
235
|
+
const { t } = useWords("sunburst-chart");
|
|
236
|
+
let t0;
|
|
237
|
+
if ($[0] !== t) {
|
|
238
|
+
t0 = t("hidden.caption");
|
|
239
|
+
$[0] = t;
|
|
240
|
+
$[1] = t0;
|
|
241
|
+
} else t0 = $[1];
|
|
242
|
+
let t1;
|
|
243
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
244
|
+
t1 = ["platform"];
|
|
245
|
+
$[2] = t1;
|
|
246
|
+
} else t1 = $[2];
|
|
247
|
+
let t2;
|
|
248
|
+
if ($[3] !== t) {
|
|
249
|
+
t2 = t("spend.label");
|
|
250
|
+
$[3] = t;
|
|
251
|
+
$[4] = t2;
|
|
252
|
+
} else t2 = $[4];
|
|
253
|
+
let t3;
|
|
254
|
+
if ($[5] !== t) {
|
|
255
|
+
t3 = t("teams");
|
|
256
|
+
$[5] = t;
|
|
257
|
+
$[6] = t3;
|
|
258
|
+
} else t3 = $[6];
|
|
259
|
+
let t4;
|
|
260
|
+
if ($[7] !== t) {
|
|
261
|
+
t4 = labelled(SPEND, (key) => t(`names.${key}`));
|
|
262
|
+
$[7] = t;
|
|
263
|
+
$[8] = t4;
|
|
264
|
+
} else t4 = $[8];
|
|
265
|
+
let t5;
|
|
266
|
+
if ($[9] !== t) {
|
|
267
|
+
t5 = t("share");
|
|
268
|
+
$[9] = t;
|
|
269
|
+
$[10] = t5;
|
|
270
|
+
} else t5 = $[10];
|
|
271
|
+
let t6;
|
|
272
|
+
if ($[11] !== t) {
|
|
273
|
+
t6 = t("value");
|
|
274
|
+
$[11] = t;
|
|
275
|
+
$[12] = t6;
|
|
276
|
+
} else t6 = $[12];
|
|
277
|
+
let t7;
|
|
278
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
279
|
+
t7 = {
|
|
280
|
+
currency: "EUR",
|
|
281
|
+
maximumFractionDigits: 0,
|
|
282
|
+
style: "currency"
|
|
283
|
+
};
|
|
284
|
+
$[13] = t7;
|
|
285
|
+
} else t7 = $[13];
|
|
286
|
+
let t8;
|
|
287
|
+
if ($[14] !== t0 || $[15] !== t2 || $[16] !== t3 || $[17] !== t4 || $[18] !== t5 || $[19] !== t6) {
|
|
288
|
+
t8 = /* @__PURE__ */ jsx(SunburstChart, {
|
|
289
|
+
caption: t0,
|
|
290
|
+
defaultHiddenKeys: t1,
|
|
291
|
+
label: t2,
|
|
292
|
+
legendLabel: t3,
|
|
293
|
+
nodes: t4,
|
|
294
|
+
shareLabel: t5,
|
|
295
|
+
valueLabel: t6,
|
|
296
|
+
valueOptions: t7
|
|
297
|
+
});
|
|
298
|
+
$[14] = t0;
|
|
299
|
+
$[15] = t2;
|
|
300
|
+
$[16] = t3;
|
|
301
|
+
$[17] = t4;
|
|
302
|
+
$[18] = t5;
|
|
303
|
+
$[19] = t6;
|
|
304
|
+
$[20] = t8;
|
|
305
|
+
} else t8 = $[20];
|
|
306
|
+
return t8;
|
|
307
|
+
}
|
|
308
|
+
const source$7 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SunburstChart } from \"@stealthscale/component-charts\";\n\nimport { labelled, SPEND } from \"./spend.ts\";\n\nexport function Hidden(): ReactElement {\n const { t } = useWords(\"sunburst-chart\");\n\n return (\n <SunburstChart\n caption={t(\"hidden.caption\")}\n defaultHiddenKeys={[\"platform\"]}\n label={t(\"spend.label\")}\n legendLabel={t(\"teams\")}\n nodes={labelled(SPEND, (key) => t(`names.${key}`))}\n shareLabel={t(\"share\")}\n valueLabel={t(\"value\")}\n valueOptions={{ currency: \"EUR\", maximumFractionDigits: 0, style: \"currency\" }}\n />\n );\n}\n";
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/sunburst-chart/examples/largest.example.tsx
|
|
311
|
+
var largest_example_exports = /* @__PURE__ */ __exportAll({
|
|
312
|
+
Largest: () => Largest,
|
|
313
|
+
source: () => source$6
|
|
314
|
+
});
|
|
315
|
+
function Largest() {
|
|
316
|
+
const $ = c(20);
|
|
317
|
+
const { t } = useWords("sunburst-chart");
|
|
318
|
+
let t0;
|
|
319
|
+
if ($[0] !== t) {
|
|
320
|
+
t0 = t("largest.caption");
|
|
321
|
+
$[0] = t;
|
|
322
|
+
$[1] = t0;
|
|
323
|
+
} else t0 = $[1];
|
|
324
|
+
let t1;
|
|
325
|
+
if ($[2] !== t) {
|
|
326
|
+
t1 = t("spend.label");
|
|
327
|
+
$[2] = t;
|
|
328
|
+
$[3] = t1;
|
|
329
|
+
} else t1 = $[3];
|
|
330
|
+
let t2;
|
|
331
|
+
if ($[4] !== t) {
|
|
332
|
+
t2 = t("teams");
|
|
333
|
+
$[4] = t;
|
|
334
|
+
$[5] = t2;
|
|
335
|
+
} else t2 = $[5];
|
|
336
|
+
let t3;
|
|
337
|
+
if ($[6] !== t) {
|
|
338
|
+
t3 = labelled(SPEND, (key) => t(`names.${key}`));
|
|
339
|
+
$[6] = t;
|
|
340
|
+
$[7] = t3;
|
|
341
|
+
} else t3 = $[7];
|
|
342
|
+
let t4;
|
|
343
|
+
if ($[8] !== t) {
|
|
344
|
+
t4 = t("share");
|
|
345
|
+
$[8] = t;
|
|
346
|
+
$[9] = t4;
|
|
347
|
+
} else t4 = $[9];
|
|
348
|
+
let t5;
|
|
349
|
+
if ($[10] !== t) {
|
|
350
|
+
t5 = t("value");
|
|
351
|
+
$[10] = t;
|
|
352
|
+
$[11] = t5;
|
|
353
|
+
} else t5 = $[11];
|
|
354
|
+
let t6;
|
|
355
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
356
|
+
t6 = {
|
|
357
|
+
currency: "EUR",
|
|
358
|
+
maximumFractionDigits: 0,
|
|
359
|
+
style: "currency"
|
|
360
|
+
};
|
|
361
|
+
$[12] = t6;
|
|
362
|
+
} else t6 = $[12];
|
|
363
|
+
let t7;
|
|
364
|
+
if ($[13] !== t0 || $[14] !== t1 || $[15] !== t2 || $[16] !== t3 || $[17] !== t4 || $[18] !== t5) {
|
|
365
|
+
t7 = /* @__PURE__ */ jsx(SunburstChart, {
|
|
366
|
+
caption: t0,
|
|
367
|
+
defaultIndex: 2,
|
|
368
|
+
label: t1,
|
|
369
|
+
legendLabel: t2,
|
|
370
|
+
nodes: t3,
|
|
371
|
+
shareLabel: t4,
|
|
372
|
+
valueLabel: t5,
|
|
373
|
+
valueOptions: t6
|
|
374
|
+
});
|
|
375
|
+
$[13] = t0;
|
|
376
|
+
$[14] = t1;
|
|
377
|
+
$[15] = t2;
|
|
378
|
+
$[16] = t3;
|
|
379
|
+
$[17] = t4;
|
|
380
|
+
$[18] = t5;
|
|
381
|
+
$[19] = t7;
|
|
382
|
+
} else t7 = $[19];
|
|
383
|
+
return t7;
|
|
384
|
+
}
|
|
385
|
+
const source$6 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SunburstChart } from \"@stealthscale/component-charts\";\n\nimport { labelled, SPEND } from \"./spend.ts\";\n\nexport function Largest(): ReactElement {\n const { t } = useWords(\"sunburst-chart\");\n\n return (\n <SunburstChart\n caption={t(\"largest.caption\")}\n defaultIndex={2}\n label={t(\"spend.label\")}\n legendLabel={t(\"teams\")}\n nodes={labelled(SPEND, (key) => t(`names.${key}`))}\n shareLabel={t(\"share\")}\n valueLabel={t(\"value\")}\n valueOptions={{ currency: \"EUR\", maximumFractionDigits: 0, style: \"currency\" }}\n />\n );\n}\n";
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/sunburst-chart/examples/palette.example.tsx
|
|
388
|
+
var palette_example_exports = /* @__PURE__ */ __exportAll({
|
|
389
|
+
Palette: () => Palette,
|
|
390
|
+
source: () => source$5
|
|
391
|
+
});
|
|
392
|
+
function Palette() {
|
|
393
|
+
const $ = c(20);
|
|
394
|
+
const { t } = useWords("sunburst-chart");
|
|
395
|
+
let t0;
|
|
396
|
+
if ($[0] !== t) {
|
|
397
|
+
t0 = t("palette.caption");
|
|
398
|
+
$[0] = t;
|
|
399
|
+
$[1] = t0;
|
|
400
|
+
} else t0 = $[1];
|
|
401
|
+
let t1;
|
|
402
|
+
if ($[2] !== t) {
|
|
403
|
+
t1 = t("spend.label");
|
|
404
|
+
$[2] = t;
|
|
405
|
+
$[3] = t1;
|
|
406
|
+
} else t1 = $[3];
|
|
407
|
+
let t2;
|
|
408
|
+
if ($[4] !== t) {
|
|
409
|
+
t2 = t("teams");
|
|
410
|
+
$[4] = t;
|
|
411
|
+
$[5] = t2;
|
|
412
|
+
} else t2 = $[5];
|
|
413
|
+
let t3;
|
|
414
|
+
if ($[6] !== t) {
|
|
415
|
+
t3 = labelled(SPEND, (key) => t(`names.${key}`), {
|
|
416
|
+
data: "teal",
|
|
417
|
+
platform: "purple",
|
|
418
|
+
product: "orange"
|
|
419
|
+
});
|
|
420
|
+
$[6] = t;
|
|
421
|
+
$[7] = t3;
|
|
422
|
+
} else t3 = $[7];
|
|
423
|
+
let t4;
|
|
424
|
+
if ($[8] !== t) {
|
|
425
|
+
t4 = t("share");
|
|
426
|
+
$[8] = t;
|
|
427
|
+
$[9] = t4;
|
|
428
|
+
} else t4 = $[9];
|
|
429
|
+
let t5;
|
|
430
|
+
if ($[10] !== t) {
|
|
431
|
+
t5 = t("value");
|
|
432
|
+
$[10] = t;
|
|
433
|
+
$[11] = t5;
|
|
434
|
+
} else t5 = $[11];
|
|
435
|
+
let t6;
|
|
436
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
437
|
+
t6 = {
|
|
438
|
+
currency: "EUR",
|
|
439
|
+
maximumFractionDigits: 0,
|
|
440
|
+
style: "currency"
|
|
441
|
+
};
|
|
442
|
+
$[12] = t6;
|
|
443
|
+
} else t6 = $[12];
|
|
444
|
+
let t7;
|
|
445
|
+
if ($[13] !== t0 || $[14] !== t1 || $[15] !== t2 || $[16] !== t3 || $[17] !== t4 || $[18] !== t5) {
|
|
446
|
+
t7 = /* @__PURE__ */ jsx(SunburstChart, {
|
|
447
|
+
caption: t0,
|
|
448
|
+
label: t1,
|
|
449
|
+
legendLabel: t2,
|
|
450
|
+
nodes: t3,
|
|
451
|
+
shareLabel: t4,
|
|
452
|
+
valueLabel: t5,
|
|
453
|
+
valueOptions: t6,
|
|
454
|
+
values: false
|
|
455
|
+
});
|
|
456
|
+
$[13] = t0;
|
|
457
|
+
$[14] = t1;
|
|
458
|
+
$[15] = t2;
|
|
459
|
+
$[16] = t3;
|
|
460
|
+
$[17] = t4;
|
|
461
|
+
$[18] = t5;
|
|
462
|
+
$[19] = t7;
|
|
463
|
+
} else t7 = $[19];
|
|
464
|
+
return t7;
|
|
465
|
+
}
|
|
466
|
+
const source$5 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SunburstChart } from \"@stealthscale/component-charts\";\n\nimport { labelled, SPEND } from \"./spend.ts\";\n\nexport function Palette(): ReactElement {\n const { t } = useWords(\"sunburst-chart\");\n\n return (\n <SunburstChart\n caption={t(\"palette.caption\")}\n label={t(\"spend.label\")}\n legendLabel={t(\"teams\")}\n nodes={labelled(SPEND, (key) => t(`names.${key}`), {\n data: \"teal\",\n platform: \"purple\",\n product: \"orange\",\n })}\n shareLabel={t(\"share\")}\n valueLabel={t(\"value\")}\n valueOptions={{ currency: \"EUR\", maximumFractionDigits: 0, style: \"currency\" }}\n values={false}\n />\n );\n}\n";
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region src/sunburst-chart/examples/quiet.example.tsx
|
|
469
|
+
var quiet_example_exports = /* @__PURE__ */ __exportAll({
|
|
470
|
+
Quiet: () => Quiet,
|
|
471
|
+
source: () => source$4
|
|
472
|
+
});
|
|
473
|
+
function Quiet() {
|
|
474
|
+
const $ = c(11);
|
|
475
|
+
const { t } = useWords("sunburst-chart");
|
|
476
|
+
let t0;
|
|
477
|
+
if ($[0] !== t) {
|
|
478
|
+
t0 = t("quiet.caption");
|
|
479
|
+
$[0] = t;
|
|
480
|
+
$[1] = t0;
|
|
481
|
+
} else t0 = $[1];
|
|
482
|
+
let t1;
|
|
483
|
+
if ($[2] !== t) {
|
|
484
|
+
t1 = t("quiet.empty");
|
|
485
|
+
$[2] = t;
|
|
486
|
+
$[3] = t1;
|
|
487
|
+
} else t1 = $[3];
|
|
488
|
+
let t2;
|
|
489
|
+
if ($[4] !== t) {
|
|
490
|
+
t2 = t("spend.label");
|
|
491
|
+
$[4] = t;
|
|
492
|
+
$[5] = t2;
|
|
493
|
+
} else t2 = $[5];
|
|
494
|
+
let t3;
|
|
495
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
496
|
+
t3 = [];
|
|
497
|
+
$[6] = t3;
|
|
498
|
+
} else t3 = $[6];
|
|
499
|
+
let t4;
|
|
500
|
+
if ($[7] !== t0 || $[8] !== t1 || $[9] !== t2) {
|
|
501
|
+
t4 = /* @__PURE__ */ jsx(SunburstChart, {
|
|
502
|
+
caption: t0,
|
|
503
|
+
empty: t1,
|
|
504
|
+
label: t2,
|
|
505
|
+
nodes: t3
|
|
506
|
+
});
|
|
507
|
+
$[7] = t0;
|
|
508
|
+
$[8] = t1;
|
|
509
|
+
$[9] = t2;
|
|
510
|
+
$[10] = t4;
|
|
511
|
+
} else t4 = $[10];
|
|
512
|
+
return t4;
|
|
513
|
+
}
|
|
514
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SunburstChart } from \"@stealthscale/component-charts\";\n\nexport function Quiet(): ReactElement {\n const { t } = useWords(\"sunburst-chart\");\n\n return (\n <SunburstChart\n caption={t(\"quiet.caption\")}\n empty={t(\"quiet.empty\")}\n label={t(\"spend.label\")}\n nodes={[]}\n />\n );\n}\n";
|
|
515
|
+
//#endregion
|
|
516
|
+
//#region src/sunburst-chart/examples/replay.example.tsx
|
|
517
|
+
var replay_example_exports = /* @__PURE__ */ __exportAll({
|
|
518
|
+
Replay: () => Replay,
|
|
519
|
+
source: () => source$3
|
|
520
|
+
});
|
|
521
|
+
function Replay() {
|
|
522
|
+
const $ = c(32);
|
|
523
|
+
const { t } = useWords("sunburst-chart");
|
|
524
|
+
const [run, setRun] = useState(0);
|
|
525
|
+
let t0;
|
|
526
|
+
if ($[0] !== t) {
|
|
527
|
+
t0 = t("replay.caption");
|
|
528
|
+
$[0] = t;
|
|
529
|
+
$[1] = t0;
|
|
530
|
+
} else t0 = $[1];
|
|
531
|
+
let t1;
|
|
532
|
+
if ($[2] !== t) {
|
|
533
|
+
t1 = t("spend.label");
|
|
534
|
+
$[2] = t;
|
|
535
|
+
$[3] = t1;
|
|
536
|
+
} else t1 = $[3];
|
|
537
|
+
let t2;
|
|
538
|
+
if ($[4] !== t) {
|
|
539
|
+
t2 = t("teams");
|
|
540
|
+
$[4] = t;
|
|
541
|
+
$[5] = t2;
|
|
542
|
+
} else t2 = $[5];
|
|
543
|
+
let t3;
|
|
544
|
+
if ($[6] !== t) {
|
|
545
|
+
t3 = labelled(SPEND, (key) => t(`names.${key}`));
|
|
546
|
+
$[6] = t;
|
|
547
|
+
$[7] = t3;
|
|
548
|
+
} else t3 = $[7];
|
|
549
|
+
let t4;
|
|
550
|
+
if ($[8] !== t) {
|
|
551
|
+
t4 = t("share");
|
|
552
|
+
$[8] = t;
|
|
553
|
+
$[9] = t4;
|
|
554
|
+
} else t4 = $[9];
|
|
555
|
+
let t5;
|
|
556
|
+
if ($[10] !== t) {
|
|
557
|
+
t5 = t("value");
|
|
558
|
+
$[10] = t;
|
|
559
|
+
$[11] = t5;
|
|
560
|
+
} else t5 = $[11];
|
|
561
|
+
let t6;
|
|
562
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
563
|
+
t6 = {
|
|
564
|
+
currency: "EUR",
|
|
565
|
+
maximumFractionDigits: 0,
|
|
566
|
+
style: "currency"
|
|
567
|
+
};
|
|
568
|
+
$[12] = t6;
|
|
569
|
+
} else t6 = $[12];
|
|
570
|
+
let t7;
|
|
571
|
+
if ($[13] !== run || $[14] !== t0 || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5) {
|
|
572
|
+
t7 = /* @__PURE__ */ jsx(SunburstChart, {
|
|
573
|
+
animate: true,
|
|
574
|
+
caption: t0,
|
|
575
|
+
label: t1,
|
|
576
|
+
legendLabel: t2,
|
|
577
|
+
nodes: t3,
|
|
578
|
+
shareLabel: t4,
|
|
579
|
+
valueLabel: t5,
|
|
580
|
+
valueOptions: t6
|
|
581
|
+
}, run);
|
|
582
|
+
$[13] = run;
|
|
583
|
+
$[14] = t0;
|
|
584
|
+
$[15] = t1;
|
|
585
|
+
$[16] = t2;
|
|
586
|
+
$[17] = t3;
|
|
587
|
+
$[18] = t4;
|
|
588
|
+
$[19] = t5;
|
|
589
|
+
$[20] = t7;
|
|
590
|
+
} else t7 = $[20];
|
|
591
|
+
let t8;
|
|
592
|
+
if ($[21] !== run) {
|
|
593
|
+
t8 = () => {
|
|
594
|
+
setRun(run + 1);
|
|
595
|
+
};
|
|
596
|
+
$[21] = run;
|
|
597
|
+
$[22] = t8;
|
|
598
|
+
} else t8 = $[22];
|
|
599
|
+
let t9;
|
|
600
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
601
|
+
t9 = /* @__PURE__ */ jsx(RotateCcwIcon, {});
|
|
602
|
+
$[23] = t9;
|
|
603
|
+
} else t9 = $[23];
|
|
604
|
+
let t10;
|
|
605
|
+
if ($[24] !== t) {
|
|
606
|
+
t10 = t("replay.replay");
|
|
607
|
+
$[24] = t;
|
|
608
|
+
$[25] = t10;
|
|
609
|
+
} else t10 = $[25];
|
|
610
|
+
let t11;
|
|
611
|
+
if ($[26] !== t10 || $[27] !== t8) {
|
|
612
|
+
t11 = /* @__PURE__ */ jsxs(Button, {
|
|
613
|
+
onClick: t8,
|
|
614
|
+
size: "sm",
|
|
615
|
+
variant: "outline",
|
|
616
|
+
children: [t9, t10]
|
|
617
|
+
});
|
|
618
|
+
$[26] = t10;
|
|
619
|
+
$[27] = t8;
|
|
620
|
+
$[28] = t11;
|
|
621
|
+
} else t11 = $[28];
|
|
622
|
+
let t12;
|
|
623
|
+
if ($[29] !== t11 || $[30] !== t7) {
|
|
624
|
+
t12 = /* @__PURE__ */ jsxs(Stack, {
|
|
625
|
+
align: "flex-start",
|
|
626
|
+
children: [t7, t11]
|
|
627
|
+
});
|
|
628
|
+
$[29] = t11;
|
|
629
|
+
$[30] = t7;
|
|
630
|
+
$[31] = t12;
|
|
631
|
+
} else t12 = $[31];
|
|
632
|
+
return t12;
|
|
633
|
+
}
|
|
634
|
+
const source$3 = "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 { SunburstChart } from \"@stealthscale/component-charts\";\n\nimport { labelled, SPEND } from \"./spend.ts\";\n\nexport function Replay(): ReactElement {\n const { t } = useWords(\"sunburst-chart\");\n const [run, setRun] = useState(0);\n\n return (\n <Stack align=\"flex-start\">\n <SunburstChart\n animate\n caption={t(\"replay.caption\")}\n key={run}\n label={t(\"spend.label\")}\n legendLabel={t(\"teams\")}\n nodes={labelled(SPEND, (key) => t(`names.${key}`))}\n shareLabel={t(\"share\")}\n valueLabel={t(\"value\")}\n valueOptions={{ currency: \"EUR\", maximumFractionDigits: 0, style: \"currency\" }}\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";
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region src/sunburst-chart/examples/spend.example.tsx
|
|
637
|
+
var spend_example_exports = /* @__PURE__ */ __exportAll({
|
|
638
|
+
Spend: () => Spend,
|
|
639
|
+
source: () => source$2
|
|
640
|
+
});
|
|
641
|
+
const EUROS = {
|
|
642
|
+
currency: "EUR",
|
|
643
|
+
maximumFractionDigits: 0,
|
|
644
|
+
style: "currency"
|
|
645
|
+
};
|
|
646
|
+
function Spend() {
|
|
647
|
+
const $ = c(28);
|
|
648
|
+
const { i18n, t } = useWords("sunburst-chart");
|
|
649
|
+
let T0;
|
|
650
|
+
let nodes;
|
|
651
|
+
let t0;
|
|
652
|
+
let t1;
|
|
653
|
+
if ($[0] !== i18n.language || $[1] !== t) {
|
|
654
|
+
let t2;
|
|
655
|
+
if ($[6] !== t) {
|
|
656
|
+
t2 = (key) => t(`names.${key}`);
|
|
657
|
+
$[6] = t;
|
|
658
|
+
$[7] = t2;
|
|
659
|
+
} else t2 = $[7];
|
|
660
|
+
nodes = labelled(SPEND, t2);
|
|
661
|
+
const leaves = hierarchyLeaves(nodes);
|
|
662
|
+
const total = leaves.reduce(_temp, 0);
|
|
663
|
+
const platform = leaves.filter(_temp2).reduce(_temp3, 0);
|
|
664
|
+
T0 = SunburstChart;
|
|
665
|
+
t0 = t("spend.caption", { share: Math.round(platform * 100) });
|
|
666
|
+
t1 = new Intl.NumberFormat(i18n.language, EUROS).format(total);
|
|
667
|
+
$[0] = i18n.language;
|
|
668
|
+
$[1] = t;
|
|
669
|
+
$[2] = T0;
|
|
670
|
+
$[3] = nodes;
|
|
671
|
+
$[4] = t0;
|
|
672
|
+
$[5] = t1;
|
|
673
|
+
} else {
|
|
674
|
+
T0 = $[2];
|
|
675
|
+
nodes = $[3];
|
|
676
|
+
t0 = $[4];
|
|
677
|
+
t1 = $[5];
|
|
678
|
+
}
|
|
679
|
+
let t2;
|
|
680
|
+
if ($[8] !== t) {
|
|
681
|
+
t2 = t("spend.center");
|
|
682
|
+
$[8] = t;
|
|
683
|
+
$[9] = t2;
|
|
684
|
+
} else t2 = $[9];
|
|
685
|
+
let t3;
|
|
686
|
+
if ($[10] !== t) {
|
|
687
|
+
t3 = t("spend.label");
|
|
688
|
+
$[10] = t;
|
|
689
|
+
$[11] = t3;
|
|
690
|
+
} else t3 = $[11];
|
|
691
|
+
let t4;
|
|
692
|
+
if ($[12] !== t) {
|
|
693
|
+
t4 = t("teams");
|
|
694
|
+
$[12] = t;
|
|
695
|
+
$[13] = t4;
|
|
696
|
+
} else t4 = $[13];
|
|
697
|
+
let t5;
|
|
698
|
+
if ($[14] !== t) {
|
|
699
|
+
t5 = t("share");
|
|
700
|
+
$[14] = t;
|
|
701
|
+
$[15] = t5;
|
|
702
|
+
} else t5 = $[15];
|
|
703
|
+
let t6;
|
|
704
|
+
if ($[16] !== t) {
|
|
705
|
+
t6 = t("value");
|
|
706
|
+
$[16] = t;
|
|
707
|
+
$[17] = t6;
|
|
708
|
+
} else t6 = $[17];
|
|
709
|
+
let t7;
|
|
710
|
+
if ($[18] !== T0 || $[19] !== nodes || $[20] !== t0 || $[21] !== t1 || $[22] !== t2 || $[23] !== t3 || $[24] !== t4 || $[25] !== t5 || $[26] !== t6) {
|
|
711
|
+
t7 = /* @__PURE__ */ jsx(T0, {
|
|
712
|
+
caption: t0,
|
|
713
|
+
center: t1,
|
|
714
|
+
centerLabel: t2,
|
|
715
|
+
label: t3,
|
|
716
|
+
legendLabel: t4,
|
|
717
|
+
nodes,
|
|
718
|
+
shareLabel: t5,
|
|
719
|
+
valueLabel: t6,
|
|
720
|
+
valueOptions: EUROS
|
|
721
|
+
});
|
|
722
|
+
$[18] = T0;
|
|
723
|
+
$[19] = nodes;
|
|
724
|
+
$[20] = t0;
|
|
725
|
+
$[21] = t1;
|
|
726
|
+
$[22] = t2;
|
|
727
|
+
$[23] = t3;
|
|
728
|
+
$[24] = t4;
|
|
729
|
+
$[25] = t5;
|
|
730
|
+
$[26] = t6;
|
|
731
|
+
$[27] = t7;
|
|
732
|
+
} else t7 = $[27];
|
|
733
|
+
return t7;
|
|
734
|
+
}
|
|
735
|
+
function _temp3(sum_0, leaf_1) {
|
|
736
|
+
return sum_0 + leaf_1.share;
|
|
737
|
+
}
|
|
738
|
+
function _temp2(leaf_0) {
|
|
739
|
+
return leaf_0.group === "platform";
|
|
740
|
+
}
|
|
741
|
+
function _temp(sum, leaf) {
|
|
742
|
+
return sum + leaf.value;
|
|
743
|
+
}
|
|
744
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SunburstChart, hierarchyLeaves } from \"@stealthscale/component-charts\";\n\nimport { labelled, SPEND } from \"./spend.ts\";\n\nconst EUROS: Intl.NumberFormatOptions = {\n currency: \"EUR\",\n maximumFractionDigits: 0,\n style: \"currency\",\n};\n\nexport function Spend(): ReactElement {\n const { i18n, t } = useWords(\"sunburst-chart\");\n const nodes = labelled(SPEND, (key) => t(`names.${key}`));\n const leaves = hierarchyLeaves(nodes);\n const total = leaves.reduce((sum, leaf) => sum + leaf.value, 0);\n const platform = leaves\n .filter((leaf) => leaf.group === \"platform\")\n .reduce((sum, leaf) => sum + leaf.share, 0);\n\n return (\n <SunburstChart\n caption={t(\"spend.caption\", { share: Math.round(platform * 100) })}\n center={new Intl.NumberFormat(i18n.language, EUROS).format(total)}\n centerLabel={t(\"spend.center\")}\n label={t(\"spend.label\")}\n legendLabel={t(\"teams\")}\n nodes={nodes}\n shareLabel={t(\"share\")}\n valueLabel={t(\"value\")}\n valueOptions={EUROS}\n />\n );\n}\n";
|
|
745
|
+
//#endregion
|
|
746
|
+
//#region src/sunburst-chart/examples/storage.example.tsx
|
|
747
|
+
var storage_example_exports = /* @__PURE__ */ __exportAll({
|
|
748
|
+
Storage: () => Storage,
|
|
749
|
+
source: () => source$1
|
|
750
|
+
});
|
|
751
|
+
function Storage() {
|
|
752
|
+
const $ = c(20);
|
|
753
|
+
const { t } = useWords("sunburst-chart");
|
|
754
|
+
let t0;
|
|
755
|
+
if ($[0] !== t) {
|
|
756
|
+
t0 = t("storage.caption");
|
|
757
|
+
$[0] = t;
|
|
758
|
+
$[1] = t0;
|
|
759
|
+
} else t0 = $[1];
|
|
760
|
+
let t1;
|
|
761
|
+
if ($[2] !== t) {
|
|
762
|
+
t1 = t("storage.label");
|
|
763
|
+
$[2] = t;
|
|
764
|
+
$[3] = t1;
|
|
765
|
+
} else t1 = $[3];
|
|
766
|
+
let t2;
|
|
767
|
+
if ($[4] !== t) {
|
|
768
|
+
t2 = t("folders");
|
|
769
|
+
$[4] = t;
|
|
770
|
+
$[5] = t2;
|
|
771
|
+
} else t2 = $[5];
|
|
772
|
+
let t3;
|
|
773
|
+
if ($[6] !== t) {
|
|
774
|
+
t3 = labelled(STORAGE, (key) => t(`names.${key}`));
|
|
775
|
+
$[6] = t;
|
|
776
|
+
$[7] = t3;
|
|
777
|
+
} else t3 = $[7];
|
|
778
|
+
let t4;
|
|
779
|
+
if ($[8] !== t) {
|
|
780
|
+
t4 = t("storage.share");
|
|
781
|
+
$[8] = t;
|
|
782
|
+
$[9] = t4;
|
|
783
|
+
} else t4 = $[9];
|
|
784
|
+
let t5;
|
|
785
|
+
if ($[10] !== t) {
|
|
786
|
+
t5 = t("storage.value");
|
|
787
|
+
$[10] = t;
|
|
788
|
+
$[11] = t5;
|
|
789
|
+
} else t5 = $[11];
|
|
790
|
+
let t6;
|
|
791
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
792
|
+
t6 = {
|
|
793
|
+
maximumFractionDigits: 0,
|
|
794
|
+
style: "unit",
|
|
795
|
+
unit: "gigabyte"
|
|
796
|
+
};
|
|
797
|
+
$[12] = t6;
|
|
798
|
+
} else t6 = $[12];
|
|
799
|
+
let t7;
|
|
800
|
+
if ($[13] !== t0 || $[14] !== t1 || $[15] !== t2 || $[16] !== t3 || $[17] !== t4 || $[18] !== t5) {
|
|
801
|
+
t7 = /* @__PURE__ */ jsx(SunburstChart, {
|
|
802
|
+
caption: t0,
|
|
803
|
+
label: t1,
|
|
804
|
+
legendLabel: t2,
|
|
805
|
+
nodes: t3,
|
|
806
|
+
shareLabel: t4,
|
|
807
|
+
valueLabel: t5,
|
|
808
|
+
valueOptions: t6
|
|
809
|
+
});
|
|
810
|
+
$[13] = t0;
|
|
811
|
+
$[14] = t1;
|
|
812
|
+
$[15] = t2;
|
|
813
|
+
$[16] = t3;
|
|
814
|
+
$[17] = t4;
|
|
815
|
+
$[18] = t5;
|
|
816
|
+
$[19] = t7;
|
|
817
|
+
} else t7 = $[19];
|
|
818
|
+
return t7;
|
|
819
|
+
}
|
|
820
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SunburstChart } from \"@stealthscale/component-charts\";\n\nimport { labelled, STORAGE } from \"./spend.ts\";\n\nexport function Storage(): ReactElement {\n const { t } = useWords(\"sunburst-chart\");\n\n return (\n <SunburstChart\n caption={t(\"storage.caption\")}\n label={t(\"storage.label\")}\n legendLabel={t(\"folders\")}\n nodes={labelled(STORAGE, (key) => t(`names.${key}`))}\n shareLabel={t(\"storage.share\")}\n valueLabel={t(\"storage.value\")}\n valueOptions={{ maximumFractionDigits: 0, style: \"unit\", unit: \"gigabyte\" }}\n />\n );\n}\n";
|
|
821
|
+
//#endregion
|
|
822
|
+
//#region src/sunburst-chart/examples/tail.example.tsx
|
|
823
|
+
var tail_example_exports = /* @__PURE__ */ __exportAll({
|
|
824
|
+
Tail: () => Tail,
|
|
825
|
+
source: () => source
|
|
826
|
+
});
|
|
827
|
+
function Tail() {
|
|
828
|
+
const $ = c(20);
|
|
829
|
+
const { t } = useWords("sunburst-chart");
|
|
830
|
+
let t0;
|
|
831
|
+
if ($[0] !== t) {
|
|
832
|
+
t0 = t("tail.caption");
|
|
833
|
+
$[0] = t;
|
|
834
|
+
$[1] = t0;
|
|
835
|
+
} else t0 = $[1];
|
|
836
|
+
let t1;
|
|
837
|
+
if ($[2] !== t) {
|
|
838
|
+
t1 = t("tail.label");
|
|
839
|
+
$[2] = t;
|
|
840
|
+
$[3] = t1;
|
|
841
|
+
} else t1 = $[3];
|
|
842
|
+
let t2;
|
|
843
|
+
if ($[4] !== t) {
|
|
844
|
+
t2 = t("teams");
|
|
845
|
+
$[4] = t;
|
|
846
|
+
$[5] = t2;
|
|
847
|
+
} else t2 = $[5];
|
|
848
|
+
let t3;
|
|
849
|
+
if ($[6] !== t) {
|
|
850
|
+
t3 = labelled(TAIL, (key) => t(`names.${key}`));
|
|
851
|
+
$[6] = t;
|
|
852
|
+
$[7] = t3;
|
|
853
|
+
} else t3 = $[7];
|
|
854
|
+
let t4;
|
|
855
|
+
if ($[8] !== t) {
|
|
856
|
+
t4 = t("tail.share");
|
|
857
|
+
$[8] = t;
|
|
858
|
+
$[9] = t4;
|
|
859
|
+
} else t4 = $[9];
|
|
860
|
+
let t5;
|
|
861
|
+
if ($[10] !== t) {
|
|
862
|
+
t5 = t("value");
|
|
863
|
+
$[10] = t;
|
|
864
|
+
$[11] = t5;
|
|
865
|
+
} else t5 = $[11];
|
|
866
|
+
let t6;
|
|
867
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
868
|
+
t6 = {
|
|
869
|
+
currency: "EUR",
|
|
870
|
+
maximumFractionDigits: 0,
|
|
871
|
+
style: "currency"
|
|
872
|
+
};
|
|
873
|
+
$[12] = t6;
|
|
874
|
+
} else t6 = $[12];
|
|
875
|
+
let t7;
|
|
876
|
+
if ($[13] !== t0 || $[14] !== t1 || $[15] !== t2 || $[16] !== t3 || $[17] !== t4 || $[18] !== t5) {
|
|
877
|
+
t7 = /* @__PURE__ */ jsx(SunburstChart, {
|
|
878
|
+
caption: t0,
|
|
879
|
+
label: t1,
|
|
880
|
+
legendLabel: t2,
|
|
881
|
+
nodes: t3,
|
|
882
|
+
shareLabel: t4,
|
|
883
|
+
valueLabel: t5,
|
|
884
|
+
valueOptions: t6
|
|
885
|
+
});
|
|
886
|
+
$[13] = t0;
|
|
887
|
+
$[14] = t1;
|
|
888
|
+
$[15] = t2;
|
|
889
|
+
$[16] = t3;
|
|
890
|
+
$[17] = t4;
|
|
891
|
+
$[18] = t5;
|
|
892
|
+
$[19] = t7;
|
|
893
|
+
} else t7 = $[19];
|
|
894
|
+
return t7;
|
|
895
|
+
}
|
|
896
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { SunburstChart } from \"@stealthscale/component-charts\";\n\nimport { labelled, TAIL } from \"./spend.ts\";\n\nexport function Tail(): ReactElement {\n const { t } = useWords(\"sunburst-chart\");\n\n return (\n <SunburstChart\n caption={t(\"tail.caption\")}\n label={t(\"tail.label\")}\n legendLabel={t(\"teams\")}\n nodes={labelled(TAIL, (key) => t(`names.${key}`))}\n shareLabel={t(\"tail.share\")}\n valueLabel={t(\"value\")}\n valueOptions={{ currency: \"EUR\", maximumFractionDigits: 0, style: \"currency\" }}\n />\n );\n}\n";
|
|
897
|
+
//#endregion
|
|
898
|
+
//#region src/sunburst-chart/sunburst-chart.specimen.tsx
|
|
899
|
+
/**
|
|
900
|
+
* Catalogue page for the sunburst chart.
|
|
901
|
+
*
|
|
902
|
+
* @remarks
|
|
903
|
+
* The sunburst chart has no recipe of its own: the chart's recipe styles its figure, so every
|
|
904
|
+
* scene is hand-written. The scenes render a month's cloud bill by team, service and resource
|
|
905
|
+
* with its total in the hole, the tooltip at the largest resource, a file server's folders in two
|
|
906
|
+
* levels, a team with a long tail of small services, the bill with one team hidden, the teams in
|
|
907
|
+
* stated palettes without totals, the bill with a credit below zero, the bill at a phone's width,
|
|
908
|
+
* the arcs animated in with a replay, and a sunburst without nodes. Every scene renders a
|
|
909
|
+
* component from `examples/` and shows that file as its source. The words are keys under
|
|
910
|
+
* `sunburst-chart` in `locales/en/specimen/sunburst-chart.json`.
|
|
911
|
+
*/
|
|
912
|
+
/**
|
|
913
|
+
* Hand-written scene for a month's cloud bill, its total in the hole.
|
|
914
|
+
*/
|
|
915
|
+
const billed = {
|
|
916
|
+
about: "sunburst-chart.spend.about",
|
|
917
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
918
|
+
size: "md",
|
|
919
|
+
children: /* @__PURE__ */ jsx(Spend, {})
|
|
920
|
+
}),
|
|
921
|
+
example: spend_example_exports,
|
|
922
|
+
title: "sunburst-chart.spend.title"
|
|
923
|
+
};
|
|
924
|
+
/**
|
|
925
|
+
* Hand-written scene for the tooltip at the largest resource.
|
|
926
|
+
*/
|
|
927
|
+
const pointed = {
|
|
928
|
+
about: "sunburst-chart.largest.about",
|
|
929
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
930
|
+
size: "md",
|
|
931
|
+
children: /* @__PURE__ */ jsx(Largest, {})
|
|
932
|
+
}),
|
|
933
|
+
example: largest_example_exports,
|
|
934
|
+
title: "sunburst-chart.largest.title"
|
|
935
|
+
};
|
|
936
|
+
/**
|
|
937
|
+
* Hand-written scene for a file server's folders in two levels.
|
|
938
|
+
*/
|
|
939
|
+
const folders = {
|
|
940
|
+
about: "sunburst-chart.storage.about",
|
|
941
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
942
|
+
size: "md",
|
|
943
|
+
children: /* @__PURE__ */ jsx(Storage, {})
|
|
944
|
+
}),
|
|
945
|
+
example: storage_example_exports,
|
|
946
|
+
title: "sunburst-chart.storage.title"
|
|
947
|
+
};
|
|
948
|
+
/**
|
|
949
|
+
* Hand-written scene for a team with a long tail of small services.
|
|
950
|
+
*/
|
|
951
|
+
const tailed = {
|
|
952
|
+
about: "sunburst-chart.tail.about",
|
|
953
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
954
|
+
size: "md",
|
|
955
|
+
children: /* @__PURE__ */ jsx(Tail, {})
|
|
956
|
+
}),
|
|
957
|
+
example: tail_example_exports,
|
|
958
|
+
title: "sunburst-chart.tail.title"
|
|
959
|
+
};
|
|
960
|
+
/**
|
|
961
|
+
* Hand-written scene for the bill with the platform team hidden.
|
|
962
|
+
*/
|
|
963
|
+
const hid = {
|
|
964
|
+
about: "sunburst-chart.hidden.about",
|
|
965
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
966
|
+
size: "md",
|
|
967
|
+
children: /* @__PURE__ */ jsx(Hidden, {})
|
|
968
|
+
}),
|
|
969
|
+
example: hidden_example_exports,
|
|
970
|
+
title: "sunburst-chart.hidden.title"
|
|
971
|
+
};
|
|
972
|
+
/**
|
|
973
|
+
* Hand-written scene for the teams in stated palettes, without totals.
|
|
974
|
+
*/
|
|
975
|
+
const tinted = {
|
|
976
|
+
about: "sunburst-chart.palette.about",
|
|
977
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
978
|
+
size: "md",
|
|
979
|
+
children: /* @__PURE__ */ jsx(Palette, {})
|
|
980
|
+
}),
|
|
981
|
+
example: palette_example_exports,
|
|
982
|
+
title: "sunburst-chart.palette.title"
|
|
983
|
+
};
|
|
984
|
+
/**
|
|
985
|
+
* Hand-written scene for the bill with a credit below zero, named in the caption.
|
|
986
|
+
*/
|
|
987
|
+
const credited = {
|
|
988
|
+
about: "sunburst-chart.credit.about",
|
|
989
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
990
|
+
size: "md",
|
|
991
|
+
children: /* @__PURE__ */ jsx(Credit, {})
|
|
992
|
+
}),
|
|
993
|
+
example: credit_example_exports,
|
|
994
|
+
title: "sunburst-chart.credit.title"
|
|
995
|
+
};
|
|
996
|
+
/**
|
|
997
|
+
* Hand-written scene for the bill at a phone's width.
|
|
998
|
+
*/
|
|
999
|
+
const narrow = {
|
|
1000
|
+
about: "sunburst-chart.narrow.about",
|
|
1001
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1002
|
+
size: "xs",
|
|
1003
|
+
children: /* @__PURE__ */ jsx(Spend, {})
|
|
1004
|
+
}),
|
|
1005
|
+
example: spend_example_exports,
|
|
1006
|
+
title: "sunburst-chart.narrow.title"
|
|
1007
|
+
};
|
|
1008
|
+
/**
|
|
1009
|
+
* Hand-written scene for the arcs animated in, with a replay.
|
|
1010
|
+
*/
|
|
1011
|
+
const animated = {
|
|
1012
|
+
about: "sunburst-chart.replay.about",
|
|
1013
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1014
|
+
size: "md",
|
|
1015
|
+
children: /* @__PURE__ */ jsx(Replay, {})
|
|
1016
|
+
}),
|
|
1017
|
+
example: replay_example_exports,
|
|
1018
|
+
title: "sunburst-chart.replay.title"
|
|
1019
|
+
};
|
|
1020
|
+
/**
|
|
1021
|
+
* Hand-written scene for a sunburst without nodes.
|
|
1022
|
+
*/
|
|
1023
|
+
const empty = {
|
|
1024
|
+
about: "sunburst-chart.quiet.about",
|
|
1025
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1026
|
+
size: "md",
|
|
1027
|
+
children: /* @__PURE__ */ jsx(Quiet, {})
|
|
1028
|
+
}),
|
|
1029
|
+
example: quiet_example_exports,
|
|
1030
|
+
title: "sunburst-chart.quiet.title"
|
|
1031
|
+
};
|
|
1032
|
+
var sunburst_chart_specimen_default = specimen({
|
|
1033
|
+
about: "sunburst-chart.about",
|
|
1034
|
+
id: "components/charts/sunburst-chart",
|
|
1035
|
+
imports: "import { SunburstChart } from \"@stealthscale/component-charts\";",
|
|
1036
|
+
scenes: [
|
|
1037
|
+
billed,
|
|
1038
|
+
pointed,
|
|
1039
|
+
folders,
|
|
1040
|
+
tailed,
|
|
1041
|
+
hid,
|
|
1042
|
+
tinted,
|
|
1043
|
+
credited,
|
|
1044
|
+
narrow,
|
|
1045
|
+
animated,
|
|
1046
|
+
empty
|
|
1047
|
+
],
|
|
1048
|
+
title: "sunburst-chart.title"
|
|
1049
|
+
});
|
|
1050
|
+
//#endregion
|
|
1051
|
+
export { animated, billed, credited, sunburst_chart_specimen_default as default, empty, folders, hid, narrow, pointed, tailed, tinted };
|