@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.
Files changed (123) hide show
  1. package/dist/cyclonedx/bom.json +1 -1
  2. package/dist/index.js +1 -14710
  3. package/dist/pages/area-chart/area-chart.js +1151 -0
  4. package/dist/pages/area-chart/area-chart.props.js +3 -0
  5. package/dist/pages/bar-chart/bar-chart.js +990 -0
  6. package/dist/pages/bar-chart/bar-chart.props.js +3 -0
  7. package/dist/pages/box-plot/box-plot.js +1585 -0
  8. package/dist/pages/box-plot/box-plot.props.js +3 -0
  9. package/dist/pages/bubble-chart/bubble-chart.js +938 -0
  10. package/dist/pages/bubble-chart/bubble-chart.props.js +3 -0
  11. package/dist/pages/burndown-chart/burndown-chart.js +805 -0
  12. package/dist/pages/burndown-chart/burndown-chart.props.js +3 -0
  13. package/dist/pages/candlestick-chart/candlestick-chart.js +853 -0
  14. package/dist/pages/candlestick-chart/candlestick-chart.props.js +3 -0
  15. package/dist/pages/chart/chart.js +1190 -0
  16. package/dist/pages/chart/chart.props.js +3 -0
  17. package/dist/pages/chord-diagram/chord-diagram.js +891 -0
  18. package/dist/pages/chord-diagram/chord-diagram.props.js +3 -0
  19. package/dist/pages/combo-chart/combo-chart.js +873 -0
  20. package/dist/pages/combo-chart/combo-chart.props.js +3 -0
  21. package/dist/pages/distribution-chart/distribution-chart.js +1066 -0
  22. package/dist/pages/distribution-chart/distribution-chart.props.js +3 -0
  23. package/dist/pages/donut-chart/donut-chart.js +726 -0
  24. package/dist/pages/donut-chart/donut-chart.props.js +3 -0
  25. package/dist/pages/funnel-chart/funnel-chart.js +1094 -0
  26. package/dist/pages/funnel-chart/funnel-chart.props.js +3 -0
  27. package/dist/pages/gauge-chart/gauge-chart.js +767 -0
  28. package/dist/pages/gauge-chart/gauge-chart.props.js +3 -0
  29. package/dist/pages/heatmap/heatmap.js +1967 -0
  30. package/dist/pages/heatmap/heatmap.props.js +3 -0
  31. package/dist/pages/histogram-chart/histogram-chart.js +768 -0
  32. package/dist/pages/histogram-chart/histogram-chart.props.js +3 -0
  33. package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.js +701 -0
  34. package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.props.js +3 -0
  35. package/dist/pages/line-chart/line-chart.js +1882 -0
  36. package/dist/pages/line-chart/line-chart.props.js +3 -0
  37. package/dist/pages/pages.json +393 -0
  38. package/dist/pages/pareto-chart/pareto-chart.js +669 -0
  39. package/dist/pages/pareto-chart/pareto-chart.props.js +3 -0
  40. package/dist/pages/percent-stacked-bar/percent-stacked-bar.js +662 -0
  41. package/dist/pages/percent-stacked-bar/percent-stacked-bar.props.js +3 -0
  42. package/dist/pages/pie-chart/pie-chart.js +1007 -0
  43. package/dist/pages/pie-chart/pie-chart.props.js +3 -0
  44. package/dist/pages/polar-area-chart/polar-area-chart.js +812 -0
  45. package/dist/pages/polar-area-chart/polar-area-chart.props.js +3 -0
  46. package/dist/pages/radar-chart/radar-chart.js +1101 -0
  47. package/dist/pages/radar-chart/radar-chart.props.js +3 -0
  48. package/dist/pages/radial-bar-chart/radial-bar-chart.js +766 -0
  49. package/dist/pages/radial-bar-chart/radial-bar-chart.props.js +3 -0
  50. package/dist/pages/range-chart/range-chart.js +914 -0
  51. package/dist/pages/range-chart/range-chart.props.js +3 -0
  52. package/dist/pages/regression-overlay/regression-overlay.js +494 -0
  53. package/dist/pages/regression-overlay/regression-overlay.props.js +3 -0
  54. package/dist/pages/sankey-chart/sankey-chart.js +700 -0
  55. package/dist/pages/sankey-chart/sankey-chart.props.js +3 -0
  56. package/dist/pages/scatter-plot/scatter-plot.js +1248 -0
  57. package/dist/pages/scatter-plot/scatter-plot.props.js +3 -0
  58. package/dist/pages/sparkbar/sparkbar.js +629 -0
  59. package/dist/pages/sparkbar/sparkbar.props.js +3 -0
  60. package/dist/pages/sparkline/sparkline.js +960 -0
  61. package/dist/pages/sparkline/sparkline.props.js +3 -0
  62. package/dist/pages/spend-5xQ76WSj.js +185 -0
  63. package/dist/pages/stacked-area-chart/stacked-area-chart.js +912 -0
  64. package/dist/pages/stacked-area-chart/stacked-area-chart.props.js +3 -0
  65. package/dist/pages/stacked-bar-chart/stacked-bar-chart.js +722 -0
  66. package/dist/pages/stacked-bar-chart/stacked-bar-chart.props.js +3 -0
  67. package/dist/pages/step-line-chart/step-line-chart.js +573 -0
  68. package/dist/pages/step-line-chart/step-line-chart.props.js +3 -0
  69. package/dist/pages/stream-graph/stream-graph.js +1662 -0
  70. package/dist/pages/stream-graph/stream-graph.props.js +3 -0
  71. package/dist/pages/sunburst-chart/sunburst-chart.js +1051 -0
  72. package/dist/pages/sunburst-chart/sunburst-chart.props.js +3 -0
  73. package/dist/pages/timeline-chart/timeline-chart.js +1124 -0
  74. package/dist/pages/timeline-chart/timeline-chart.props.js +3 -0
  75. package/dist/pages/treemap-chart/treemap-chart.js +904 -0
  76. package/dist/pages/treemap-chart/treemap-chart.props.js +3 -0
  77. package/dist/pages/violin-plot/violin-plot.js +1303 -0
  78. package/dist/pages/violin-plot/violin-plot.props.js +3 -0
  79. package/dist/pages/visitors-oFFVcbIZ.js +248 -0
  80. package/dist/pages/waterfall-chart/waterfall-chart.js +1195 -0
  81. package/dist/pages/waterfall-chart/waterfall-chart.props.js +3 -0
  82. package/dist/shared-DVZJ2nST.js +14711 -0
  83. package/dist/theme.js +1 -1
  84. package/locales/en/specimen/area-chart.json +56 -0
  85. package/locales/en/specimen/bar-chart.json +56 -0
  86. package/locales/en/specimen/box-plot.json +65 -0
  87. package/locales/en/specimen/bubble-chart.json +47 -0
  88. package/locales/en/specimen/burndown-chart.json +46 -0
  89. package/locales/en/specimen/candlestick-chart.json +42 -0
  90. package/locales/en/specimen/chart.json +53 -0
  91. package/locales/en/specimen/chord-diagram.json +69 -0
  92. package/locales/en/specimen/combo-chart.json +41 -0
  93. package/locales/en/specimen/distribution-chart.json +47 -0
  94. package/locales/en/specimen/donut-chart.json +63 -0
  95. package/locales/en/specimen/funnel-chart.json +84 -0
  96. package/locales/en/specimen/gauge-chart.json +68 -0
  97. package/locales/en/specimen/heatmap.json +187 -0
  98. package/locales/en/specimen/histogram-chart.json +48 -0
  99. package/locales/en/specimen/horizontal-bar-chart.json +54 -0
  100. package/locales/en/specimen/line-chart.json +106 -0
  101. package/locales/en/specimen/pareto-chart.json +43 -0
  102. package/locales/en/specimen/percent-stacked-bar.json +37 -0
  103. package/locales/en/specimen/pie-chart.json +80 -0
  104. package/locales/en/specimen/polar-area-chart.json +90 -0
  105. package/locales/en/specimen/radar-chart.json +82 -0
  106. package/locales/en/specimen/radial-bar-chart.json +62 -0
  107. package/locales/en/specimen/range-chart.json +42 -0
  108. package/locales/en/specimen/regression-overlay.json +36 -0
  109. package/locales/en/specimen/sankey-chart.json +89 -0
  110. package/locales/en/specimen/scatter-plot.json +88 -0
  111. package/locales/en/specimen/sparkbar.json +51 -0
  112. package/locales/en/specimen/sparkline.json +70 -0
  113. package/locales/en/specimen/stacked-area-chart.json +44 -0
  114. package/locales/en/specimen/stacked-bar-chart.json +34 -0
  115. package/locales/en/specimen/step-line-chart.json +33 -0
  116. package/locales/en/specimen/stream-graph.json +54 -0
  117. package/locales/en/specimen/sunburst-chart.json +110 -0
  118. package/locales/en/specimen/timeline-chart.json +77 -0
  119. package/locales/en/specimen/treemap-chart.json +107 -0
  120. package/locales/en/specimen/violin-plot.json +54 -0
  121. package/locales/en/specimen/waterfall-chart.json +71 -0
  122. package/package.json +8 -7
  123. /package/dist/{recipe-BbGw00ut.js → recipes-BbGw00ut.js} +0 -0
@@ -0,0 +1,726 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { G as DonutChart } 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/donut-chart/examples/incidents.example.tsx
11
+ var incidents_example_exports = /* @__PURE__ */ __exportAll({
12
+ Incidents: () => Incidents,
13
+ source: () => source$5
14
+ });
15
+ const CAUSES = [
16
+ {
17
+ count: 14,
18
+ key: "deploy"
19
+ },
20
+ {
21
+ count: 9,
22
+ key: "dependency"
23
+ },
24
+ {
25
+ count: 6,
26
+ key: "capacity"
27
+ },
28
+ {
29
+ count: 3,
30
+ key: "network"
31
+ },
32
+ {
33
+ count: 2,
34
+ key: "certificate"
35
+ },
36
+ {
37
+ count: 1,
38
+ key: "dns"
39
+ }
40
+ ];
41
+ function Incidents() {
42
+ const $ = c(20);
43
+ const { t } = useWords("donut-chart");
44
+ let t0;
45
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
46
+ t0 = CAUSES.reduce(_temp$1, 0);
47
+ $[0] = t0;
48
+ } else t0 = $[0];
49
+ const total = t0;
50
+ let t1;
51
+ if ($[1] !== t) {
52
+ t1 = t("incidents.caption");
53
+ $[1] = t;
54
+ $[2] = t1;
55
+ } else t1 = $[2];
56
+ const t2 = String(total);
57
+ let t3;
58
+ if ($[3] !== t) {
59
+ t3 = t("incidents.center");
60
+ $[3] = t;
61
+ $[4] = t3;
62
+ } else t3 = $[4];
63
+ let t4;
64
+ if ($[5] !== t) {
65
+ t4 = t("incidents.label");
66
+ $[5] = t;
67
+ $[6] = t4;
68
+ } else t4 = $[6];
69
+ let t5;
70
+ if ($[7] !== t) {
71
+ t5 = t("incidents.legend");
72
+ $[7] = t;
73
+ $[8] = t5;
74
+ } else t5 = $[8];
75
+ let t6;
76
+ if ($[9] !== t) {
77
+ t6 = t("incidents.other");
78
+ $[9] = t;
79
+ $[10] = t6;
80
+ } else t6 = $[10];
81
+ let t7;
82
+ if ($[11] !== t) {
83
+ t7 = CAUSES.map((t8) => {
84
+ const { count, key } = t8;
85
+ return {
86
+ key,
87
+ label: t(`incidents.${key}`),
88
+ value: count
89
+ };
90
+ });
91
+ $[11] = t;
92
+ $[12] = t7;
93
+ } else t7 = $[12];
94
+ let t8;
95
+ if ($[13] !== t1 || $[14] !== t3 || $[15] !== t4 || $[16] !== t5 || $[17] !== t6 || $[18] !== t7) {
96
+ t8 = /* @__PURE__ */ jsx(DonutChart, {
97
+ caption: t1,
98
+ center: t2,
99
+ centerLabel: t3,
100
+ label: t4,
101
+ legendLabel: t5,
102
+ maxSlices: 4,
103
+ otherLabel: t6,
104
+ slices: t7
105
+ });
106
+ $[13] = t1;
107
+ $[14] = t3;
108
+ $[15] = t4;
109
+ $[16] = t5;
110
+ $[17] = t6;
111
+ $[18] = t7;
112
+ $[19] = t8;
113
+ } else t8 = $[19];
114
+ return t8;
115
+ }
116
+ function _temp$1(sum, cause) {
117
+ return sum + cause.count;
118
+ }
119
+ const source$5 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { DonutChart } from \"@stealthscale/component-charts\";\n\nconst CAUSES = [\n { count: 14, key: \"deploy\" },\n { count: 9, key: \"dependency\" },\n { count: 6, key: \"capacity\" },\n { count: 3, key: \"network\" },\n { count: 2, key: \"certificate\" },\n { count: 1, key: \"dns\" },\n];\n\nexport function Incidents(): ReactElement {\n const { t } = useWords(\"donut-chart\");\n const total = CAUSES.reduce((sum, cause) => sum + cause.count, 0);\n\n return (\n <DonutChart\n caption={t(\"incidents.caption\")}\n center={String(total)}\n centerLabel={t(\"incidents.center\")}\n label={t(\"incidents.label\")}\n legendLabel={t(\"incidents.legend\")}\n maxSlices={4}\n otherLabel={t(\"incidents.other\")}\n slices={CAUSES.map(({ count, key }) => ({ key, label: t(`incidents.${key}`), value: count }))}\n />\n );\n}\n";
120
+ //#endregion
121
+ //#region src/donut-chart/examples/largest.example.tsx
122
+ var largest_example_exports = /* @__PURE__ */ __exportAll({
123
+ Largest: () => Largest,
124
+ source: () => source$4
125
+ });
126
+ const KINDS$2 = [
127
+ {
128
+ gigabytes: 118,
129
+ key: "video"
130
+ },
131
+ {
132
+ gigabytes: 42,
133
+ key: "images"
134
+ },
135
+ {
136
+ gigabytes: 26,
137
+ key: "archives"
138
+ },
139
+ {
140
+ gigabytes: 9.5,
141
+ key: "documents"
142
+ }
143
+ ];
144
+ function Largest() {
145
+ const $ = c(14);
146
+ const { t } = useWords("donut-chart");
147
+ let t0;
148
+ if ($[0] !== t) {
149
+ t0 = t("largest.caption");
150
+ $[0] = t;
151
+ $[1] = t0;
152
+ } else t0 = $[1];
153
+ let t1;
154
+ if ($[2] !== t) {
155
+ t1 = t("usage.label");
156
+ $[2] = t;
157
+ $[3] = t1;
158
+ } else t1 = $[3];
159
+ let t2;
160
+ if ($[4] !== t) {
161
+ t2 = t("usage.legend");
162
+ $[4] = t;
163
+ $[5] = t2;
164
+ } else t2 = $[5];
165
+ let t3;
166
+ if ($[6] !== t) {
167
+ t3 = KINDS$2.map((t4) => {
168
+ const { gigabytes: value, key } = t4;
169
+ return {
170
+ key,
171
+ label: t(`usage.${key}`),
172
+ value
173
+ };
174
+ });
175
+ $[6] = t;
176
+ $[7] = t3;
177
+ } else t3 = $[7];
178
+ let t4;
179
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
180
+ t4 = {
181
+ maximumFractionDigits: 1,
182
+ style: "unit",
183
+ unit: "gigabyte"
184
+ };
185
+ $[8] = t4;
186
+ } else t4 = $[8];
187
+ let t5;
188
+ if ($[9] !== t0 || $[10] !== t1 || $[11] !== t2 || $[12] !== t3) {
189
+ t5 = /* @__PURE__ */ jsx(DonutChart, {
190
+ caption: t0,
191
+ defaultIndex: 0,
192
+ label: t1,
193
+ legendLabel: t2,
194
+ slices: t3,
195
+ valueOptions: t4
196
+ });
197
+ $[9] = t0;
198
+ $[10] = t1;
199
+ $[11] = t2;
200
+ $[12] = t3;
201
+ $[13] = t5;
202
+ } else t5 = $[13];
203
+ return t5;
204
+ }
205
+ const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { DonutChart } from \"@stealthscale/component-charts\";\n\nconst KINDS = [\n { gigabytes: 118, key: \"video\" },\n { gigabytes: 42, key: \"images\" },\n { gigabytes: 26, key: \"archives\" },\n { gigabytes: 9.5, key: \"documents\" },\n];\n\nexport function Largest(): ReactElement {\n const { t } = useWords(\"donut-chart\");\n\n return (\n <DonutChart\n caption={t(\"largest.caption\")}\n defaultIndex={0}\n label={t(\"usage.label\")}\n legendLabel={t(\"usage.legend\")}\n slices={KINDS.map(({ gigabytes: value, key }) => ({ key, label: t(`usage.${key}`), value }))}\n valueOptions={{ maximumFractionDigits: 1, style: \"unit\", unit: \"gigabyte\" }}\n />\n );\n}\n";
206
+ //#endregion
207
+ //#region src/donut-chart/examples/replay.example.tsx
208
+ var replay_example_exports = /* @__PURE__ */ __exportAll({
209
+ Replay: () => Replay,
210
+ source: () => source$3
211
+ });
212
+ const KINDS$1 = [
213
+ {
214
+ gigabytes: 118,
215
+ key: "video"
216
+ },
217
+ {
218
+ gigabytes: 42,
219
+ key: "images"
220
+ },
221
+ {
222
+ gigabytes: 26,
223
+ key: "archives"
224
+ },
225
+ {
226
+ gigabytes: 9.5,
227
+ key: "documents"
228
+ }
229
+ ];
230
+ function Replay() {
231
+ const $ = c(25);
232
+ const { t } = useWords("donut-chart");
233
+ const [run, setRun] = useState(0);
234
+ let t0;
235
+ if ($[0] !== t) {
236
+ t0 = t("usage.caption");
237
+ $[0] = t;
238
+ $[1] = t0;
239
+ } else t0 = $[1];
240
+ let t1;
241
+ if ($[2] !== t) {
242
+ t1 = t("usage.label");
243
+ $[2] = t;
244
+ $[3] = t1;
245
+ } else t1 = $[3];
246
+ let t2;
247
+ if ($[4] !== t) {
248
+ t2 = t("usage.legend");
249
+ $[4] = t;
250
+ $[5] = t2;
251
+ } else t2 = $[5];
252
+ let t3;
253
+ if ($[6] !== t) {
254
+ t3 = KINDS$1.map((t4) => {
255
+ const { gigabytes, key } = t4;
256
+ return {
257
+ key,
258
+ label: t(`usage.${key}`),
259
+ value: gigabytes
260
+ };
261
+ });
262
+ $[6] = t;
263
+ $[7] = t3;
264
+ } else t3 = $[7];
265
+ let t4;
266
+ if ($[8] !== run || $[9] !== t0 || $[10] !== t1 || $[11] !== t2 || $[12] !== t3) {
267
+ t4 = /* @__PURE__ */ jsx(DonutChart, {
268
+ animate: true,
269
+ caption: t0,
270
+ label: t1,
271
+ legendLabel: t2,
272
+ slices: t3
273
+ }, run);
274
+ $[8] = run;
275
+ $[9] = t0;
276
+ $[10] = t1;
277
+ $[11] = t2;
278
+ $[12] = t3;
279
+ $[13] = t4;
280
+ } else t4 = $[13];
281
+ let t5;
282
+ if ($[14] !== run) {
283
+ t5 = () => {
284
+ setRun(run + 1);
285
+ };
286
+ $[14] = run;
287
+ $[15] = t5;
288
+ } else t5 = $[15];
289
+ let t6;
290
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
291
+ t6 = /* @__PURE__ */ jsx(RotateCcwIcon, {});
292
+ $[16] = t6;
293
+ } else t6 = $[16];
294
+ let t7;
295
+ if ($[17] !== t) {
296
+ t7 = t("replay.replay");
297
+ $[17] = t;
298
+ $[18] = t7;
299
+ } else t7 = $[18];
300
+ let t8;
301
+ if ($[19] !== t5 || $[20] !== t7) {
302
+ t8 = /* @__PURE__ */ jsxs(Button, {
303
+ onClick: t5,
304
+ size: "sm",
305
+ variant: "outline",
306
+ children: [t6, t7]
307
+ });
308
+ $[19] = t5;
309
+ $[20] = t7;
310
+ $[21] = t8;
311
+ } else t8 = $[21];
312
+ let t9;
313
+ if ($[22] !== t4 || $[23] !== t8) {
314
+ t9 = /* @__PURE__ */ jsxs(Stack, {
315
+ align: "flex-start",
316
+ children: [t4, t8]
317
+ });
318
+ $[22] = t4;
319
+ $[23] = t8;
320
+ $[24] = t9;
321
+ } else t9 = $[24];
322
+ return t9;
323
+ }
324
+ 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 { DonutChart } from \"@stealthscale/component-charts\";\n\nconst KINDS = [\n { gigabytes: 118, key: \"video\" },\n { gigabytes: 42, key: \"images\" },\n { gigabytes: 26, key: \"archives\" },\n { gigabytes: 9.5, key: \"documents\" },\n];\n\nexport function Replay(): ReactElement {\n const { t } = useWords(\"donut-chart\");\n const [run, setRun] = useState(0);\n\n return (\n <Stack align=\"flex-start\">\n <DonutChart\n animate\n caption={t(\"usage.caption\")}\n key={run}\n label={t(\"usage.label\")}\n legendLabel={t(\"usage.legend\")}\n slices={KINDS.map(({ gigabytes, key }) => ({\n key,\n label: t(`usage.${key}`),\n value: gigabytes,\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";
325
+ //#endregion
326
+ //#region src/donut-chart/examples/share.example.tsx
327
+ var share_example_exports = /* @__PURE__ */ __exportAll({
328
+ Share: () => Share,
329
+ source: () => source$2
330
+ });
331
+ function Share() {
332
+ const $ = c(33);
333
+ const { t } = useWords("donut-chart");
334
+ let t0;
335
+ if ($[0] !== t) {
336
+ t0 = t("share.caption");
337
+ $[0] = t;
338
+ $[1] = t0;
339
+ } else t0 = $[1];
340
+ let t1;
341
+ if ($[2] !== t) {
342
+ t1 = t("share.center");
343
+ $[2] = t;
344
+ $[3] = t1;
345
+ } else t1 = $[3];
346
+ let t2;
347
+ if ($[4] !== t) {
348
+ t2 = t("share.centerLabel");
349
+ $[4] = t;
350
+ $[5] = t2;
351
+ } else t2 = $[5];
352
+ let t3;
353
+ if ($[6] !== t) {
354
+ t3 = t("share.label");
355
+ $[6] = t;
356
+ $[7] = t3;
357
+ } else t3 = $[7];
358
+ let t4;
359
+ if ($[8] !== t) {
360
+ t4 = t("share.legend");
361
+ $[8] = t;
362
+ $[9] = t4;
363
+ } else t4 = $[9];
364
+ let t5;
365
+ if ($[10] !== t) {
366
+ t5 = t("share.starter");
367
+ $[10] = t;
368
+ $[11] = t5;
369
+ } else t5 = $[11];
370
+ let t6;
371
+ if ($[12] !== t5) {
372
+ t6 = {
373
+ key: "starter",
374
+ label: t5,
375
+ value: 610
376
+ };
377
+ $[12] = t5;
378
+ $[13] = t6;
379
+ } else t6 = $[13];
380
+ let t7;
381
+ if ($[14] !== t) {
382
+ t7 = t("share.growth");
383
+ $[14] = t;
384
+ $[15] = t7;
385
+ } else t7 = $[15];
386
+ let t8;
387
+ if ($[16] !== t7) {
388
+ t8 = {
389
+ key: "growth",
390
+ label: t7,
391
+ value: 520
392
+ };
393
+ $[16] = t7;
394
+ $[17] = t8;
395
+ } else t8 = $[17];
396
+ let t9;
397
+ if ($[18] !== t) {
398
+ t9 = t("share.scale");
399
+ $[18] = t;
400
+ $[19] = t9;
401
+ } else t9 = $[19];
402
+ let t10;
403
+ if ($[20] !== t9) {
404
+ t10 = {
405
+ key: "scale",
406
+ label: t9,
407
+ value: 170
408
+ };
409
+ $[20] = t9;
410
+ $[21] = t10;
411
+ } else t10 = $[21];
412
+ let t11;
413
+ if ($[22] !== t10 || $[23] !== t6 || $[24] !== t8) {
414
+ t11 = [
415
+ t6,
416
+ t8,
417
+ t10
418
+ ];
419
+ $[22] = t10;
420
+ $[23] = t6;
421
+ $[24] = t8;
422
+ $[25] = t11;
423
+ } else t11 = $[25];
424
+ let t12;
425
+ if ($[26] !== t0 || $[27] !== t1 || $[28] !== t11 || $[29] !== t2 || $[30] !== t3 || $[31] !== t4) {
426
+ t12 = /* @__PURE__ */ jsx(DonutChart, {
427
+ caption: t0,
428
+ center: t1,
429
+ centerLabel: t2,
430
+ label: t3,
431
+ legendLabel: t4,
432
+ slices: t11
433
+ });
434
+ $[26] = t0;
435
+ $[27] = t1;
436
+ $[28] = t11;
437
+ $[29] = t2;
438
+ $[30] = t3;
439
+ $[31] = t4;
440
+ $[32] = t12;
441
+ } else t12 = $[32];
442
+ return t12;
443
+ }
444
+ const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { DonutChart } from \"@stealthscale/component-charts\";\n\nexport function Share(): ReactElement {\n const { t } = useWords(\"donut-chart\");\n\n return (\n <DonutChart\n caption={t(\"share.caption\")}\n center={t(\"share.center\")}\n centerLabel={t(\"share.centerLabel\")}\n label={t(\"share.label\")}\n legendLabel={t(\"share.legend\")}\n slices={[\n { key: \"starter\", label: t(\"share.starter\"), value: 610 },\n { key: \"growth\", label: t(\"share.growth\"), value: 520 },\n { key: \"scale\", label: t(\"share.scale\"), value: 170 },\n ]}\n />\n );\n}\n";
445
+ //#endregion
446
+ //#region src/donut-chart/examples/unused.example.tsx
447
+ var unused_example_exports = /* @__PURE__ */ __exportAll({
448
+ Unused: () => Unused,
449
+ source: () => source$1
450
+ });
451
+ function Unused() {
452
+ const $ = c(11);
453
+ const { t } = useWords("donut-chart");
454
+ let t0;
455
+ if ($[0] !== t) {
456
+ t0 = t("unused.caption");
457
+ $[0] = t;
458
+ $[1] = t0;
459
+ } else t0 = $[1];
460
+ let t1;
461
+ if ($[2] !== t) {
462
+ t1 = t("unused.empty");
463
+ $[2] = t;
464
+ $[3] = t1;
465
+ } else t1 = $[3];
466
+ let t2;
467
+ if ($[4] !== t) {
468
+ t2 = t("usage.label");
469
+ $[4] = t;
470
+ $[5] = t2;
471
+ } else t2 = $[5];
472
+ let t3;
473
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
474
+ t3 = [];
475
+ $[6] = t3;
476
+ } else t3 = $[6];
477
+ let t4;
478
+ if ($[7] !== t0 || $[8] !== t1 || $[9] !== t2) {
479
+ t4 = /* @__PURE__ */ jsx(DonutChart, {
480
+ caption: t0,
481
+ empty: t1,
482
+ label: t2,
483
+ slices: t3
484
+ });
485
+ $[7] = t0;
486
+ $[8] = t1;
487
+ $[9] = t2;
488
+ $[10] = t4;
489
+ } else t4 = $[10];
490
+ return t4;
491
+ }
492
+ const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { DonutChart } from \"@stealthscale/component-charts\";\n\nexport function Unused(): ReactElement {\n const { t } = useWords(\"donut-chart\");\n\n return (\n <DonutChart\n caption={t(\"unused.caption\")}\n empty={t(\"unused.empty\")}\n label={t(\"usage.label\")}\n slices={[]}\n />\n );\n}\n";
493
+ //#endregion
494
+ //#region src/donut-chart/examples/usage.example.tsx
495
+ var usage_example_exports = /* @__PURE__ */ __exportAll({
496
+ Usage: () => Usage,
497
+ source: () => source
498
+ });
499
+ const KINDS = [
500
+ {
501
+ gigabytes: 118,
502
+ key: "video"
503
+ },
504
+ {
505
+ gigabytes: 42,
506
+ key: "images"
507
+ },
508
+ {
509
+ gigabytes: 26,
510
+ key: "archives"
511
+ },
512
+ {
513
+ gigabytes: 9.5,
514
+ key: "documents"
515
+ }
516
+ ];
517
+ function Usage() {
518
+ const $ = c(24);
519
+ const { i18n, t } = useWords("donut-chart");
520
+ let T0;
521
+ let t0;
522
+ let t1;
523
+ if ($[0] !== i18n.language || $[1] !== t) {
524
+ const gigabytes = new Intl.NumberFormat(i18n.language, {
525
+ maximumFractionDigits: 1,
526
+ style: "unit",
527
+ unit: "gigabyte"
528
+ });
529
+ const total = KINDS.reduce(_temp, 0);
530
+ T0 = DonutChart;
531
+ if ($[5] !== t) {
532
+ t0 = t("usage.caption");
533
+ $[5] = t;
534
+ $[6] = t0;
535
+ } else t0 = $[6];
536
+ t1 = gigabytes.format(total);
537
+ $[0] = i18n.language;
538
+ $[1] = t;
539
+ $[2] = T0;
540
+ $[3] = t0;
541
+ $[4] = t1;
542
+ } else {
543
+ T0 = $[2];
544
+ t0 = $[3];
545
+ t1 = $[4];
546
+ }
547
+ let t2;
548
+ if ($[7] !== t) {
549
+ t2 = t("usage.center");
550
+ $[7] = t;
551
+ $[8] = t2;
552
+ } else t2 = $[8];
553
+ let t3;
554
+ if ($[9] !== t) {
555
+ t3 = t("usage.label");
556
+ $[9] = t;
557
+ $[10] = t3;
558
+ } else t3 = $[10];
559
+ let t4;
560
+ if ($[11] !== t) {
561
+ t4 = t("usage.legend");
562
+ $[11] = t;
563
+ $[12] = t4;
564
+ } else t4 = $[12];
565
+ let t5;
566
+ if ($[13] !== t) {
567
+ t5 = KINDS.map((t6) => {
568
+ const { gigabytes: value, key } = t6;
569
+ return {
570
+ key,
571
+ label: t(`usage.${key}`),
572
+ value
573
+ };
574
+ });
575
+ $[13] = t;
576
+ $[14] = t5;
577
+ } else t5 = $[14];
578
+ let t6;
579
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
580
+ t6 = {
581
+ maximumFractionDigits: 1,
582
+ style: "unit",
583
+ unit: "gigabyte"
584
+ };
585
+ $[15] = t6;
586
+ } else t6 = $[15];
587
+ let t7;
588
+ if ($[16] !== T0 || $[17] !== t0 || $[18] !== t1 || $[19] !== t2 || $[20] !== t3 || $[21] !== t4 || $[22] !== t5) {
589
+ t7 = /* @__PURE__ */ jsx(T0, {
590
+ caption: t0,
591
+ center: t1,
592
+ centerLabel: t2,
593
+ label: t3,
594
+ legendLabel: t4,
595
+ slices: t5,
596
+ valueOptions: t6
597
+ });
598
+ $[16] = T0;
599
+ $[17] = t0;
600
+ $[18] = t1;
601
+ $[19] = t2;
602
+ $[20] = t3;
603
+ $[21] = t4;
604
+ $[22] = t5;
605
+ $[23] = t7;
606
+ } else t7 = $[23];
607
+ return t7;
608
+ }
609
+ function _temp(sum, kind) {
610
+ return sum + kind.gigabytes;
611
+ }
612
+ const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { DonutChart } from \"@stealthscale/component-charts\";\n\nconst KINDS = [\n { gigabytes: 118, key: \"video\" },\n { gigabytes: 42, key: \"images\" },\n { gigabytes: 26, key: \"archives\" },\n { gigabytes: 9.5, key: \"documents\" },\n];\n\nexport function Usage(): ReactElement {\n const { i18n, t } = useWords(\"donut-chart\");\n const gigabytes = new Intl.NumberFormat(i18n.language, {\n maximumFractionDigits: 1,\n style: \"unit\",\n unit: \"gigabyte\",\n });\n const total = KINDS.reduce((sum, kind) => sum + kind.gigabytes, 0);\n\n return (\n <DonutChart\n caption={t(\"usage.caption\")}\n center={gigabytes.format(total)}\n centerLabel={t(\"usage.center\")}\n label={t(\"usage.label\")}\n legendLabel={t(\"usage.legend\")}\n slices={KINDS.map(({ gigabytes: value, key }) => ({ key, label: t(`usage.${key}`), value }))}\n valueOptions={{ maximumFractionDigits: 1, style: \"unit\", unit: \"gigabyte\" }}\n />\n );\n}\n";
613
+ //#endregion
614
+ //#region src/donut-chart/donut-chart.specimen.tsx
615
+ /**
616
+ * Catalogue page for the donut chart.
617
+ *
618
+ * @remarks
619
+ * The donut chart has no recipe of its own: the chart's recipe styles its figure and the figure
620
+ * in the hole, so every scene is hand-written. The scenes render storage with the total in the
621
+ * hole, the tooltip open at the largest slice, the largest share in the hole, incidents with the
622
+ * tail gathered, the ring animated in with a replay, the storage at a phone's width, and a chart
623
+ * without slices. Every scene renders a component from `examples/` and shows that file as its
624
+ * source. The words are keys under `donut-chart` in `locales/en/specimen/donut-chart.json`.
625
+ */
626
+ /**
627
+ * Hand-written scene for the total in the hole.
628
+ */
629
+ const total = {
630
+ about: "donut-chart.usage.about",
631
+ draw: () => /* @__PURE__ */ jsx(Room, {
632
+ size: "sm",
633
+ children: /* @__PURE__ */ jsx(Usage, {})
634
+ }),
635
+ example: usage_example_exports,
636
+ title: "donut-chart.usage.title"
637
+ };
638
+ /**
639
+ * Hand-written scene for the tooltip open at the largest slice.
640
+ */
641
+ const tooltip = {
642
+ about: "donut-chart.largest.about",
643
+ draw: () => /* @__PURE__ */ jsx(Room, {
644
+ size: "sm",
645
+ children: /* @__PURE__ */ jsx(Largest, {})
646
+ }),
647
+ example: largest_example_exports,
648
+ title: "donut-chart.largest.title"
649
+ };
650
+ /**
651
+ * Hand-written scene for the largest share in the hole.
652
+ */
653
+ const leading = {
654
+ about: "donut-chart.share.about",
655
+ draw: () => /* @__PURE__ */ jsx(Room, {
656
+ size: "sm",
657
+ children: /* @__PURE__ */ jsx(Share, {})
658
+ }),
659
+ example: share_example_exports,
660
+ title: "donut-chart.share.title"
661
+ };
662
+ /**
663
+ * Hand-written scene for the tail gathered into one slice.
664
+ */
665
+ const tail = {
666
+ about: "donut-chart.incidents.about",
667
+ draw: () => /* @__PURE__ */ jsx(Room, {
668
+ size: "sm",
669
+ children: /* @__PURE__ */ jsx(Incidents, {})
670
+ }),
671
+ example: incidents_example_exports,
672
+ title: "donut-chart.incidents.title"
673
+ };
674
+ /**
675
+ * Hand-written scene for the ring animated in, with a replay.
676
+ */
677
+ const animated = {
678
+ about: "donut-chart.replay.about",
679
+ draw: () => /* @__PURE__ */ jsx(Room, {
680
+ size: "sm",
681
+ children: /* @__PURE__ */ jsx(Replay, {})
682
+ }),
683
+ example: replay_example_exports,
684
+ title: "donut-chart.replay.title"
685
+ };
686
+ /**
687
+ * Hand-written scene for the storage at a phone's width.
688
+ */
689
+ const narrow = {
690
+ about: "donut-chart.narrow.about",
691
+ draw: () => /* @__PURE__ */ jsx(Room, {
692
+ size: "xs",
693
+ children: /* @__PURE__ */ jsx(Usage, {})
694
+ }),
695
+ example: usage_example_exports,
696
+ title: "donut-chart.narrow.title"
697
+ };
698
+ /**
699
+ * Hand-written scene for a chart without slices.
700
+ */
701
+ const empty = {
702
+ about: "donut-chart.unused.about",
703
+ draw: () => /* @__PURE__ */ jsx(Room, {
704
+ size: "sm",
705
+ children: /* @__PURE__ */ jsx(Unused, {})
706
+ }),
707
+ example: unused_example_exports,
708
+ title: "donut-chart.unused.title"
709
+ };
710
+ var donut_chart_specimen_default = specimen({
711
+ about: "donut-chart.about",
712
+ id: "components/charts/donut-chart",
713
+ imports: "import { DonutChart } from \"@stealthscale/component-charts\";",
714
+ scenes: [
715
+ total,
716
+ tooltip,
717
+ leading,
718
+ tail,
719
+ animated,
720
+ narrow,
721
+ empty
722
+ ],
723
+ title: "donut-chart.title"
724
+ });
725
+ //#endregion
726
+ export { animated, donut_chart_specimen_default as default, empty, leading, narrow, tail, tooltip, total };