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