@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,1190 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { Ct as Root, Et as Empty, Ot as useChart, St as Tooltip$1, Tt as Legend, kt as Caption, wt as Plot } from "../../shared-DVZJ2nST.js";
3
+ import { E as recipe } from "../../recipes-BbGw00ut.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Bar, BarChart, CartesianGrid, Line, LineChart, Pie, PieChart, Tooltip, XAxis, YAxis } from "recharts";
7
+ import { Room, scenesOf, specimen, useWords } from "@stealthscale/specimen";
8
+ //#region src/chart/examples/latency.example.tsx
9
+ var latency_example_exports = /* @__PURE__ */ __exportAll({
10
+ Latency: () => Latency,
11
+ source: () => source$4
12
+ });
13
+ const HOURS = [
14
+ 180,
15
+ 190,
16
+ 210,
17
+ 260,
18
+ 340,
19
+ 390,
20
+ 310,
21
+ 240,
22
+ 205,
23
+ 195,
24
+ 188,
25
+ 182
26
+ ].map((p95, index) => ({
27
+ hour: `2026-09-28T${String(index + 8).padStart(2, "0")}:00:00Z`,
28
+ p95,
29
+ target: 300
30
+ }));
31
+ function Latency() {
32
+ const $ = c(66);
33
+ const { t } = useWords("chart");
34
+ let t0;
35
+ if ($[0] !== t) {
36
+ t0 = t("latency.p95");
37
+ $[0] = t;
38
+ $[1] = t0;
39
+ } else t0 = $[1];
40
+ let t1;
41
+ if ($[2] !== t0) {
42
+ t1 = {
43
+ key: "p95",
44
+ label: t0
45
+ };
46
+ $[2] = t0;
47
+ $[3] = t1;
48
+ } else t1 = $[3];
49
+ let t2;
50
+ if ($[4] !== t) {
51
+ t2 = t("latency.target");
52
+ $[4] = t;
53
+ $[5] = t2;
54
+ } else t2 = $[5];
55
+ let t3;
56
+ if ($[6] !== t2) {
57
+ t3 = {
58
+ color: "error",
59
+ key: "target",
60
+ label: t2
61
+ };
62
+ $[6] = t2;
63
+ $[7] = t3;
64
+ } else t3 = $[7];
65
+ let t4;
66
+ if ($[8] !== t1 || $[9] !== t3) {
67
+ t4 = {
68
+ data: HOURS,
69
+ series: [t1, t3]
70
+ };
71
+ $[8] = t1;
72
+ $[9] = t3;
73
+ $[10] = t4;
74
+ } else t4 = $[10];
75
+ const chart = useChart(t4);
76
+ let t5;
77
+ if ($[11] !== chart) {
78
+ t5 = chart.formatDate({
79
+ hour: "2-digit",
80
+ hourCycle: "h23",
81
+ minute: "2-digit",
82
+ timeZone: "UTC"
83
+ });
84
+ $[11] = chart;
85
+ $[12] = t5;
86
+ } else t5 = $[12];
87
+ const time = t5;
88
+ let t6;
89
+ if ($[13] !== chart) {
90
+ t6 = chart.formatNumber({
91
+ style: "unit",
92
+ unit: "millisecond",
93
+ unitDisplay: "narrow"
94
+ });
95
+ $[13] = chart;
96
+ $[14] = t6;
97
+ } else t6 = $[14];
98
+ const ms = t6;
99
+ const t7 = chart.data;
100
+ let t8;
101
+ if ($[15] !== t) {
102
+ t8 = t("latency.name");
103
+ $[15] = t;
104
+ $[16] = t8;
105
+ } else t8 = $[16];
106
+ let t9;
107
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
108
+ t9 = /* @__PURE__ */ jsx(CartesianGrid, { vertical: false });
109
+ $[17] = t9;
110
+ } else t9 = $[17];
111
+ let t10;
112
+ if ($[18] !== time) {
113
+ t10 = /* @__PURE__ */ jsx(XAxis, {
114
+ dataKey: "hour",
115
+ tickFormatter: time
116
+ });
117
+ $[18] = time;
118
+ $[19] = t10;
119
+ } else t10 = $[19];
120
+ let t11;
121
+ if ($[20] !== ms) {
122
+ t11 = /* @__PURE__ */ jsx(YAxis, {
123
+ tickFormatter: ms,
124
+ width: 64
125
+ });
126
+ $[20] = ms;
127
+ $[21] = t11;
128
+ } else t11 = $[21];
129
+ let t12;
130
+ if ($[22] !== ms || $[23] !== time) {
131
+ t12 = /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(Tooltip$1, {
132
+ formatLabel: time,
133
+ formatValue: ms
134
+ }) });
135
+ $[22] = ms;
136
+ $[23] = time;
137
+ $[24] = t12;
138
+ } else t12 = $[24];
139
+ let t13;
140
+ if ($[25] !== chart) {
141
+ t13 = chart.hidden("p95");
142
+ $[25] = chart;
143
+ $[26] = t13;
144
+ } else t13 = $[26];
145
+ let t14;
146
+ if ($[27] !== chart) {
147
+ t14 = chart.opacity("p95");
148
+ $[27] = chart;
149
+ $[28] = t14;
150
+ } else t14 = $[28];
151
+ let t15;
152
+ if ($[29] !== chart) {
153
+ t15 = chart.color("p95");
154
+ $[29] = chart;
155
+ $[30] = t15;
156
+ } else t15 = $[30];
157
+ let t16;
158
+ if ($[31] !== t13 || $[32] !== t14 || $[33] !== t15) {
159
+ t16 = /* @__PURE__ */ jsx(Line, {
160
+ dataKey: "p95",
161
+ dot: false,
162
+ hide: t13,
163
+ isAnimationActive: false,
164
+ opacity: t14,
165
+ stroke: t15,
166
+ strokeWidth: 2,
167
+ type: "monotone"
168
+ });
169
+ $[31] = t13;
170
+ $[32] = t14;
171
+ $[33] = t15;
172
+ $[34] = t16;
173
+ } else t16 = $[34];
174
+ let t17;
175
+ if ($[35] !== chart) {
176
+ t17 = chart.hidden("target");
177
+ $[35] = chart;
178
+ $[36] = t17;
179
+ } else t17 = $[36];
180
+ let t18;
181
+ if ($[37] !== chart) {
182
+ t18 = chart.opacity("target");
183
+ $[37] = chart;
184
+ $[38] = t18;
185
+ } else t18 = $[38];
186
+ let t19;
187
+ if ($[39] !== chart) {
188
+ t19 = chart.color("target");
189
+ $[39] = chart;
190
+ $[40] = t19;
191
+ } else t19 = $[40];
192
+ let t20;
193
+ if ($[41] !== t17 || $[42] !== t18 || $[43] !== t19) {
194
+ t20 = /* @__PURE__ */ jsx(Line, {
195
+ dataKey: "target",
196
+ dot: false,
197
+ hide: t17,
198
+ isAnimationActive: false,
199
+ opacity: t18,
200
+ stroke: t19,
201
+ strokeDasharray: "6 4",
202
+ strokeWidth: 2
203
+ });
204
+ $[41] = t17;
205
+ $[42] = t18;
206
+ $[43] = t19;
207
+ $[44] = t20;
208
+ } else t20 = $[44];
209
+ let t21;
210
+ if ($[45] !== chart.data || $[46] !== t10 || $[47] !== t11 || $[48] !== t12 || $[49] !== t16 || $[50] !== t20 || $[51] !== t8) {
211
+ t21 = /* @__PURE__ */ jsx(Plot, { children: /* @__PURE__ */ jsxs(LineChart, {
212
+ accessibilityLayer: true,
213
+ data: t7,
214
+ title: t8,
215
+ children: [
216
+ t9,
217
+ t10,
218
+ t11,
219
+ t12,
220
+ t16,
221
+ t20
222
+ ]
223
+ }) });
224
+ $[45] = chart.data;
225
+ $[46] = t10;
226
+ $[47] = t11;
227
+ $[48] = t12;
228
+ $[49] = t16;
229
+ $[50] = t20;
230
+ $[51] = t8;
231
+ $[52] = t21;
232
+ } else t21 = $[52];
233
+ let t22;
234
+ if ($[53] !== t) {
235
+ t22 = t("series");
236
+ $[53] = t;
237
+ $[54] = t22;
238
+ } else t22 = $[54];
239
+ let t23;
240
+ if ($[55] !== t22) {
241
+ t23 = /* @__PURE__ */ jsx(Legend, { label: t22 });
242
+ $[55] = t22;
243
+ $[56] = t23;
244
+ } else t23 = $[56];
245
+ let t24;
246
+ if ($[57] !== t) {
247
+ t24 = t("latency.caption");
248
+ $[57] = t;
249
+ $[58] = t24;
250
+ } else t24 = $[58];
251
+ let t25;
252
+ if ($[59] !== t24) {
253
+ t25 = /* @__PURE__ */ jsx(Caption, { children: t24 });
254
+ $[59] = t24;
255
+ $[60] = t25;
256
+ } else t25 = $[60];
257
+ let t26;
258
+ if ($[61] !== chart || $[62] !== t21 || $[63] !== t23 || $[64] !== t25) {
259
+ t26 = /* @__PURE__ */ jsxs(Root, {
260
+ chart,
261
+ ratio: "wide",
262
+ children: [
263
+ t21,
264
+ t23,
265
+ t25
266
+ ]
267
+ });
268
+ $[61] = chart;
269
+ $[62] = t21;
270
+ $[63] = t23;
271
+ $[64] = t25;
272
+ $[65] = t26;
273
+ } else t26 = $[65];
274
+ return t26;
275
+ }
276
+ const source$4 = "import { type ReactElement } from \"react\";\n\nimport { CartesianGrid, Line, LineChart, Tooltip, XAxis, YAxis } from \"recharts\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Chart } from \"@stealthscale/component-charts\";\n\nconst HOURS = [180, 190, 210, 260, 340, 390, 310, 240, 205, 195, 188, 182].map((p95, index) => ({\n hour: `2026-09-28T${String(index + 8).padStart(2, \"0\")}:00:00Z`,\n p95,\n target: 300,\n}));\n\nexport function Latency(): ReactElement {\n const { t } = useWords(\"chart\");\n const chart = Chart.useChart({\n data: HOURS,\n series: [\n { key: \"p95\", label: t(\"latency.p95\") },\n { color: \"error\", key: \"target\", label: t(\"latency.target\") },\n ],\n });\n const time = chart.formatDate({\n hour: \"2-digit\",\n hourCycle: \"h23\",\n minute: \"2-digit\",\n timeZone: \"UTC\",\n });\n const ms = chart.formatNumber({ style: \"unit\", unit: \"millisecond\", unitDisplay: \"narrow\" });\n\n return (\n <Chart.Root chart={chart} ratio=\"wide\">\n <Chart.Plot>\n <LineChart accessibilityLayer data={chart.data} title={t(\"latency.name\")}>\n <CartesianGrid vertical={false} />\n <XAxis dataKey=\"hour\" tickFormatter={time} />\n <YAxis tickFormatter={ms} width={64} />\n <Tooltip content={<Chart.Tooltip formatLabel={time} formatValue={ms} />} />\n <Line\n dataKey=\"p95\"\n dot={false}\n hide={chart.hidden(\"p95\")}\n isAnimationActive={false}\n opacity={chart.opacity(\"p95\")}\n stroke={chart.color(\"p95\")}\n strokeWidth={2}\n type=\"monotone\"\n />\n <Line\n dataKey=\"target\"\n dot={false}\n hide={chart.hidden(\"target\")}\n isAnimationActive={false}\n opacity={chart.opacity(\"target\")}\n stroke={chart.color(\"target\")}\n strokeDasharray=\"6 4\"\n strokeWidth={2}\n />\n </LineChart>\n </Chart.Plot>\n <Chart.Legend label={t(\"series\")} />\n <Chart.Caption>{t(\"latency.caption\")}</Chart.Caption>\n </Chart.Root>\n );\n}\n";
277
+ //#endregion
278
+ //#region src/chart/examples/payouts.example.tsx
279
+ var payouts_example_exports = /* @__PURE__ */ __exportAll({
280
+ Payouts: () => Payouts,
281
+ source: () => source$3
282
+ });
283
+ const DAYS = [
284
+ {
285
+ day: "2026-09-21",
286
+ paid: 4200,
287
+ refunded: 310
288
+ },
289
+ {
290
+ day: "2026-09-22",
291
+ paid: 5100,
292
+ refunded: 280
293
+ },
294
+ {
295
+ day: "2026-09-23",
296
+ paid: 4800,
297
+ refunded: 910
298
+ },
299
+ {
300
+ day: "2026-09-24",
301
+ paid: 6100,
302
+ refunded: 1250
303
+ },
304
+ {
305
+ day: "2026-09-25",
306
+ paid: 5900,
307
+ refunded: 1120
308
+ },
309
+ {
310
+ day: "2026-09-26",
311
+ paid: 3900,
312
+ refunded: 420
313
+ },
314
+ {
315
+ day: "2026-09-27",
316
+ paid: 3500,
317
+ refunded: 380
318
+ }
319
+ ];
320
+ function Payouts(props) {
321
+ const $ = c(48);
322
+ const { t } = useWords("chart");
323
+ let t0;
324
+ if ($[0] !== t) {
325
+ t0 = t("payouts.paid");
326
+ $[0] = t;
327
+ $[1] = t0;
328
+ } else t0 = $[1];
329
+ let t1;
330
+ if ($[2] !== t0) {
331
+ t1 = {
332
+ key: "paid",
333
+ label: t0
334
+ };
335
+ $[2] = t0;
336
+ $[3] = t1;
337
+ } else t1 = $[3];
338
+ let t2;
339
+ if ($[4] !== t) {
340
+ t2 = t("payouts.refunded");
341
+ $[4] = t;
342
+ $[5] = t2;
343
+ } else t2 = $[5];
344
+ let t3;
345
+ if ($[6] !== t2) {
346
+ t3 = {
347
+ key: "refunded",
348
+ label: t2
349
+ };
350
+ $[6] = t2;
351
+ $[7] = t3;
352
+ } else t3 = $[7];
353
+ let t4;
354
+ if ($[8] !== t1 || $[9] !== t3) {
355
+ t4 = {
356
+ data: DAYS,
357
+ series: [t1, t3]
358
+ };
359
+ $[8] = t1;
360
+ $[9] = t3;
361
+ $[10] = t4;
362
+ } else t4 = $[10];
363
+ const chart = useChart(t4);
364
+ let t5;
365
+ if ($[11] !== chart) {
366
+ t5 = chart.formatNumber({
367
+ currency: "EUR",
368
+ maximumFractionDigits: 0,
369
+ style: "currency"
370
+ });
371
+ $[11] = chart;
372
+ $[12] = t5;
373
+ } else t5 = $[12];
374
+ const euros = t5;
375
+ let t6;
376
+ if ($[13] !== chart) {
377
+ t6 = chart.formatDate({
378
+ timeZone: "UTC",
379
+ weekday: "short"
380
+ });
381
+ $[13] = chart;
382
+ $[14] = t6;
383
+ } else t6 = $[14];
384
+ const weekday = t6;
385
+ const t7 = chart.data;
386
+ let t8;
387
+ if ($[15] !== t) {
388
+ t8 = t("payouts.name");
389
+ $[15] = t;
390
+ $[16] = t8;
391
+ } else t8 = $[16];
392
+ let t9;
393
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
394
+ t9 = /* @__PURE__ */ jsx(CartesianGrid, { vertical: false });
395
+ $[17] = t9;
396
+ } else t9 = $[17];
397
+ let t10;
398
+ if ($[18] !== weekday) {
399
+ t10 = /* @__PURE__ */ jsx(XAxis, {
400
+ dataKey: "day",
401
+ tickFormatter: weekday
402
+ });
403
+ $[18] = weekday;
404
+ $[19] = t10;
405
+ } else t10 = $[19];
406
+ let t11;
407
+ if ($[20] !== euros) {
408
+ t11 = /* @__PURE__ */ jsx(YAxis, {
409
+ tickFormatter: euros,
410
+ width: 72
411
+ });
412
+ $[20] = euros;
413
+ $[21] = t11;
414
+ } else t11 = $[21];
415
+ let t12;
416
+ if ($[22] !== euros || $[23] !== weekday) {
417
+ t12 = /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(Tooltip$1, {
418
+ formatLabel: weekday,
419
+ formatValue: euros
420
+ }) });
421
+ $[22] = euros;
422
+ $[23] = weekday;
423
+ $[24] = t12;
424
+ } else t12 = $[24];
425
+ let t13;
426
+ if ($[25] !== chart.series) {
427
+ t13 = chart.series.map(_temp$1);
428
+ $[25] = chart.series;
429
+ $[26] = t13;
430
+ } else t13 = $[26];
431
+ let t14;
432
+ if ($[27] !== chart.data || $[28] !== t10 || $[29] !== t11 || $[30] !== t12 || $[31] !== t13 || $[32] !== t8) {
433
+ t14 = /* @__PURE__ */ jsx(Plot, { children: /* @__PURE__ */ jsxs(LineChart, {
434
+ accessibilityLayer: true,
435
+ data: t7,
436
+ title: t8,
437
+ children: [
438
+ t9,
439
+ t10,
440
+ t11,
441
+ t12,
442
+ t13
443
+ ]
444
+ }) });
445
+ $[27] = chart.data;
446
+ $[28] = t10;
447
+ $[29] = t11;
448
+ $[30] = t12;
449
+ $[31] = t13;
450
+ $[32] = t8;
451
+ $[33] = t14;
452
+ } else t14 = $[33];
453
+ let t15;
454
+ if ($[34] !== t) {
455
+ t15 = t("series");
456
+ $[34] = t;
457
+ $[35] = t15;
458
+ } else t15 = $[35];
459
+ let t16;
460
+ if ($[36] !== t15) {
461
+ t16 = /* @__PURE__ */ jsx(Legend, { label: t15 });
462
+ $[36] = t15;
463
+ $[37] = t16;
464
+ } else t16 = $[37];
465
+ let t17;
466
+ if ($[38] !== t) {
467
+ t17 = t("payouts.caption");
468
+ $[38] = t;
469
+ $[39] = t17;
470
+ } else t17 = $[39];
471
+ let t18;
472
+ if ($[40] !== t17) {
473
+ t18 = /* @__PURE__ */ jsx(Caption, { children: t17 });
474
+ $[40] = t17;
475
+ $[41] = t18;
476
+ } else t18 = $[41];
477
+ let t19;
478
+ if ($[42] !== chart || $[43] !== props || $[44] !== t14 || $[45] !== t16 || $[46] !== t18) {
479
+ t19 = /* @__PURE__ */ jsxs(Root, {
480
+ chart,
481
+ ...props,
482
+ children: [
483
+ t14,
484
+ t16,
485
+ t18
486
+ ]
487
+ });
488
+ $[42] = chart;
489
+ $[43] = props;
490
+ $[44] = t14;
491
+ $[45] = t16;
492
+ $[46] = t18;
493
+ $[47] = t19;
494
+ } else t19 = $[47];
495
+ return t19;
496
+ }
497
+ function _temp$1(series) {
498
+ return /* @__PURE__ */ jsx(Line, {
499
+ dataKey: series.key,
500
+ dot: false,
501
+ hide: series.hidden,
502
+ isAnimationActive: false,
503
+ opacity: series.opacity,
504
+ stroke: series.color,
505
+ strokeWidth: 2,
506
+ type: "monotone"
507
+ }, series.key);
508
+ }
509
+ const source$3 = "import { type ReactElement } from \"react\";\n\nimport { CartesianGrid, Line, LineChart, Tooltip, XAxis, YAxis } from \"recharts\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Chart } from \"@stealthscale/component-charts\";\n\nconst DAYS = [\n { day: \"2026-09-21\", paid: 4200, refunded: 310 },\n { day: \"2026-09-22\", paid: 5100, refunded: 280 },\n { day: \"2026-09-23\", paid: 4800, refunded: 910 },\n { day: \"2026-09-24\", paid: 6100, refunded: 1250 },\n { day: \"2026-09-25\", paid: 5900, refunded: 1120 },\n { day: \"2026-09-26\", paid: 3900, refunded: 420 },\n { day: \"2026-09-27\", paid: 3500, refunded: 380 },\n];\n\nexport function Payouts(props: Omit<Chart.RootProps, \"chart\">): ReactElement {\n const { t } = useWords(\"chart\");\n const chart = Chart.useChart({\n data: DAYS,\n series: [\n { key: \"paid\", label: t(\"payouts.paid\") },\n { key: \"refunded\", label: t(\"payouts.refunded\") },\n ],\n });\n const euros = chart.formatNumber({\n currency: \"EUR\",\n maximumFractionDigits: 0,\n style: \"currency\",\n });\n const weekday = chart.formatDate({ timeZone: \"UTC\", weekday: \"short\" });\n\n return (\n <Chart.Root chart={chart} {...props}>\n <Chart.Plot>\n <LineChart accessibilityLayer data={chart.data} title={t(\"payouts.name\")}>\n <CartesianGrid vertical={false} />\n <XAxis dataKey=\"day\" tickFormatter={weekday} />\n <YAxis tickFormatter={euros} width={72} />\n <Tooltip content={<Chart.Tooltip formatLabel={weekday} formatValue={euros} />} />\n {chart.series.map((series) => (\n <Line\n dataKey={series.key}\n dot={false}\n hide={series.hidden}\n isAnimationActive={false}\n key={series.key}\n opacity={series.opacity}\n stroke={series.color}\n strokeWidth={2}\n type=\"monotone\"\n />\n ))}\n </LineChart>\n </Chart.Plot>\n <Chart.Legend label={t(\"series\")} />\n <Chart.Caption>{t(\"payouts.caption\")}</Chart.Caption>\n </Chart.Root>\n );\n}\n";
510
+ //#endregion
511
+ //#region src/chart/examples/quiet.example.tsx
512
+ var quiet_example_exports = /* @__PURE__ */ __exportAll({
513
+ Quiet: () => Quiet,
514
+ source: () => source$2
515
+ });
516
+ function Quiet() {
517
+ const $ = c(30);
518
+ const { t } = useWords("chart");
519
+ let t0;
520
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
521
+ t0 = [];
522
+ $[0] = t0;
523
+ } else t0 = $[0];
524
+ let t1;
525
+ if ($[1] !== t) {
526
+ t1 = t("quiet.disputes");
527
+ $[1] = t;
528
+ $[2] = t1;
529
+ } else t1 = $[2];
530
+ let t2;
531
+ if ($[3] !== t1) {
532
+ t2 = {
533
+ data: t0,
534
+ series: [{
535
+ key: "disputes",
536
+ label: t1
537
+ }]
538
+ };
539
+ $[3] = t1;
540
+ $[4] = t2;
541
+ } else t2 = $[4];
542
+ const chart = useChart(t2);
543
+ const t3 = chart.data;
544
+ let t4;
545
+ if ($[5] !== t) {
546
+ t4 = t("quiet.name");
547
+ $[5] = t;
548
+ $[6] = t4;
549
+ } else t4 = $[6];
550
+ let t5;
551
+ let t6;
552
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
553
+ t5 = /* @__PURE__ */ jsx(XAxis, { dataKey: "day" });
554
+ t6 = /* @__PURE__ */ jsx(YAxis, {});
555
+ $[7] = t5;
556
+ $[8] = t6;
557
+ } else {
558
+ t5 = $[7];
559
+ t6 = $[8];
560
+ }
561
+ let t7;
562
+ if ($[9] !== chart) {
563
+ t7 = chart.color("disputes");
564
+ $[9] = chart;
565
+ $[10] = t7;
566
+ } else t7 = $[10];
567
+ let t8;
568
+ if ($[11] !== t7) {
569
+ t8 = /* @__PURE__ */ jsx(Bar, {
570
+ dataKey: "disputes",
571
+ fill: t7,
572
+ isAnimationActive: false
573
+ });
574
+ $[11] = t7;
575
+ $[12] = t8;
576
+ } else t8 = $[12];
577
+ let t9;
578
+ if ($[13] !== chart.data || $[14] !== t4 || $[15] !== t8) {
579
+ t9 = /* @__PURE__ */ jsx(Plot, { children: /* @__PURE__ */ jsxs(BarChart, {
580
+ accessibilityLayer: true,
581
+ data: t3,
582
+ title: t4,
583
+ children: [
584
+ t5,
585
+ t6,
586
+ t8
587
+ ]
588
+ }) });
589
+ $[13] = chart.data;
590
+ $[14] = t4;
591
+ $[15] = t8;
592
+ $[16] = t9;
593
+ } else t9 = $[16];
594
+ let t10;
595
+ if ($[17] !== t) {
596
+ t10 = t("quiet.empty");
597
+ $[17] = t;
598
+ $[18] = t10;
599
+ } else t10 = $[18];
600
+ let t11;
601
+ if ($[19] !== t10) {
602
+ t11 = /* @__PURE__ */ jsx(Empty, { children: t10 });
603
+ $[19] = t10;
604
+ $[20] = t11;
605
+ } else t11 = $[20];
606
+ let t12;
607
+ if ($[21] !== t) {
608
+ t12 = t("quiet.caption");
609
+ $[21] = t;
610
+ $[22] = t12;
611
+ } else t12 = $[22];
612
+ let t13;
613
+ if ($[23] !== t12) {
614
+ t13 = /* @__PURE__ */ jsx(Caption, { children: t12 });
615
+ $[23] = t12;
616
+ $[24] = t13;
617
+ } else t13 = $[24];
618
+ let t14;
619
+ if ($[25] !== chart || $[26] !== t11 || $[27] !== t13 || $[28] !== t9) {
620
+ t14 = /* @__PURE__ */ jsxs(Root, {
621
+ chart,
622
+ children: [
623
+ t9,
624
+ t11,
625
+ t13
626
+ ]
627
+ });
628
+ $[25] = chart;
629
+ $[26] = t11;
630
+ $[27] = t13;
631
+ $[28] = t9;
632
+ $[29] = t14;
633
+ } else t14 = $[29];
634
+ return t14;
635
+ }
636
+ const source$2 = "import { type ReactElement } from \"react\";\n\nimport { Bar, BarChart, XAxis, YAxis } from \"recharts\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Chart } from \"@stealthscale/component-charts\";\n\nexport function Quiet(): ReactElement {\n const { t } = useWords(\"chart\");\n const chart = Chart.useChart({\n data: [],\n series: [{ key: \"disputes\", label: t(\"quiet.disputes\") }],\n });\n\n return (\n <Chart.Root chart={chart}>\n <Chart.Plot>\n <BarChart accessibilityLayer data={chart.data} title={t(\"quiet.name\")}>\n <XAxis dataKey=\"day\" />\n <YAxis />\n <Bar dataKey=\"disputes\" fill={chart.color(\"disputes\")} isAnimationActive={false} />\n </BarChart>\n </Chart.Plot>\n <Chart.Empty>{t(\"quiet.empty\")}</Chart.Empty>\n <Chart.Caption>{t(\"quiet.caption\")}</Chart.Caption>\n </Chart.Root>\n );\n}\n";
637
+ //#endregion
638
+ //#region src/chart/examples/signups.example.tsx
639
+ var signups_example_exports = /* @__PURE__ */ __exportAll({
640
+ Signups: () => Signups,
641
+ source: () => source$1
642
+ });
643
+ const MONTHS = [
644
+ {
645
+ growth: 64,
646
+ month: "2026-04-01",
647
+ scale: 12,
648
+ starter: 120
649
+ },
650
+ {
651
+ growth: 71,
652
+ month: "2026-05-01",
653
+ scale: 15,
654
+ starter: 132
655
+ },
656
+ {
657
+ growth: 88,
658
+ month: "2026-06-01",
659
+ scale: 14,
660
+ starter: 118
661
+ },
662
+ {
663
+ growth: 95,
664
+ month: "2026-07-01",
665
+ scale: 21,
666
+ starter: 141
667
+ },
668
+ {
669
+ growth: 104,
670
+ month: "2026-08-01",
671
+ scale: 26,
672
+ starter: 150
673
+ },
674
+ {
675
+ growth: 118,
676
+ month: "2026-09-01",
677
+ scale: 31,
678
+ starter: 162
679
+ }
680
+ ];
681
+ function Signups() {
682
+ const $ = c(51);
683
+ const { t } = useWords("chart");
684
+ let t0;
685
+ if ($[0] !== t) {
686
+ t0 = t("signups.starter");
687
+ $[0] = t;
688
+ $[1] = t0;
689
+ } else t0 = $[1];
690
+ let t1;
691
+ if ($[2] !== t0) {
692
+ t1 = {
693
+ color: "blue",
694
+ key: "starter",
695
+ label: t0
696
+ };
697
+ $[2] = t0;
698
+ $[3] = t1;
699
+ } else t1 = $[3];
700
+ let t2;
701
+ if ($[4] !== t) {
702
+ t2 = t("signups.growth");
703
+ $[4] = t;
704
+ $[5] = t2;
705
+ } else t2 = $[5];
706
+ let t3;
707
+ if ($[6] !== t2) {
708
+ t3 = {
709
+ color: "teal",
710
+ key: "growth",
711
+ label: t2
712
+ };
713
+ $[6] = t2;
714
+ $[7] = t3;
715
+ } else t3 = $[7];
716
+ let t4;
717
+ if ($[8] !== t) {
718
+ t4 = t("signups.scale");
719
+ $[8] = t;
720
+ $[9] = t4;
721
+ } else t4 = $[9];
722
+ let t5;
723
+ if ($[10] !== t4) {
724
+ t5 = {
725
+ color: "purple",
726
+ key: "scale",
727
+ label: t4
728
+ };
729
+ $[10] = t4;
730
+ $[11] = t5;
731
+ } else t5 = $[11];
732
+ let t6;
733
+ if ($[12] !== t1 || $[13] !== t3 || $[14] !== t5) {
734
+ t6 = {
735
+ data: MONTHS,
736
+ series: [
737
+ t1,
738
+ t3,
739
+ t5
740
+ ]
741
+ };
742
+ $[12] = t1;
743
+ $[13] = t3;
744
+ $[14] = t5;
745
+ $[15] = t6;
746
+ } else t6 = $[15];
747
+ const chart = useChart(t6);
748
+ let t7;
749
+ if ($[16] !== chart) {
750
+ t7 = chart.formatDate({
751
+ month: "short",
752
+ timeZone: "UTC"
753
+ });
754
+ $[16] = chart;
755
+ $[17] = t7;
756
+ } else t7 = $[17];
757
+ const month = t7;
758
+ const t8 = chart.data;
759
+ let t9;
760
+ if ($[18] !== t) {
761
+ t9 = t("signups.name");
762
+ $[18] = t;
763
+ $[19] = t9;
764
+ } else t9 = $[19];
765
+ let t10;
766
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
767
+ t10 = /* @__PURE__ */ jsx(CartesianGrid, { vertical: false });
768
+ $[20] = t10;
769
+ } else t10 = $[20];
770
+ let t11;
771
+ if ($[21] !== month) {
772
+ t11 = /* @__PURE__ */ jsx(XAxis, {
773
+ dataKey: "month",
774
+ tickFormatter: month
775
+ });
776
+ $[21] = month;
777
+ $[22] = t11;
778
+ } else t11 = $[22];
779
+ let t12;
780
+ if ($[23] !== chart) {
781
+ t12 = chart.formatNumber();
782
+ $[23] = chart;
783
+ $[24] = t12;
784
+ } else t12 = $[24];
785
+ let t13;
786
+ if ($[25] !== t12) {
787
+ t13 = /* @__PURE__ */ jsx(YAxis, {
788
+ allowDecimals: false,
789
+ tickFormatter: t12,
790
+ width: 48
791
+ });
792
+ $[25] = t12;
793
+ $[26] = t13;
794
+ } else t13 = $[26];
795
+ let t14;
796
+ if ($[27] !== month) {
797
+ t14 = /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(Tooltip$1, { formatLabel: month }) });
798
+ $[27] = month;
799
+ $[28] = t14;
800
+ } else t14 = $[28];
801
+ let t15;
802
+ if ($[29] !== chart.series) {
803
+ t15 = chart.series.map(_temp);
804
+ $[29] = chart.series;
805
+ $[30] = t15;
806
+ } else t15 = $[30];
807
+ let t16;
808
+ if ($[31] !== chart.data || $[32] !== t11 || $[33] !== t13 || $[34] !== t14 || $[35] !== t15 || $[36] !== t9) {
809
+ t16 = /* @__PURE__ */ jsx(Plot, { children: /* @__PURE__ */ jsxs(BarChart, {
810
+ accessibilityLayer: true,
811
+ data: t8,
812
+ title: t9,
813
+ children: [
814
+ t10,
815
+ t11,
816
+ t13,
817
+ t14,
818
+ t15
819
+ ]
820
+ }) });
821
+ $[31] = chart.data;
822
+ $[32] = t11;
823
+ $[33] = t13;
824
+ $[34] = t14;
825
+ $[35] = t15;
826
+ $[36] = t9;
827
+ $[37] = t16;
828
+ } else t16 = $[37];
829
+ let t17;
830
+ if ($[38] !== t) {
831
+ t17 = t("series");
832
+ $[38] = t;
833
+ $[39] = t17;
834
+ } else t17 = $[39];
835
+ let t18;
836
+ if ($[40] !== t17) {
837
+ t18 = /* @__PURE__ */ jsx(Legend, { label: t17 });
838
+ $[40] = t17;
839
+ $[41] = t18;
840
+ } else t18 = $[41];
841
+ let t19;
842
+ if ($[42] !== t) {
843
+ t19 = t("signups.caption");
844
+ $[42] = t;
845
+ $[43] = t19;
846
+ } else t19 = $[43];
847
+ let t20;
848
+ if ($[44] !== t19) {
849
+ t20 = /* @__PURE__ */ jsx(Caption, { children: t19 });
850
+ $[44] = t19;
851
+ $[45] = t20;
852
+ } else t20 = $[45];
853
+ let t21;
854
+ if ($[46] !== chart || $[47] !== t16 || $[48] !== t18 || $[49] !== t20) {
855
+ t21 = /* @__PURE__ */ jsxs(Root, {
856
+ chart,
857
+ children: [
858
+ t16,
859
+ t18,
860
+ t20
861
+ ]
862
+ });
863
+ $[46] = chart;
864
+ $[47] = t16;
865
+ $[48] = t18;
866
+ $[49] = t20;
867
+ $[50] = t21;
868
+ } else t21 = $[50];
869
+ return t21;
870
+ }
871
+ function _temp(series) {
872
+ return /* @__PURE__ */ jsx(Bar, {
873
+ dataKey: series.key,
874
+ fill: series.color,
875
+ hide: series.hidden,
876
+ isAnimationActive: false,
877
+ opacity: series.opacity,
878
+ stackId: "plan"
879
+ }, series.key);
880
+ }
881
+ const source$1 = "import { type ReactElement } from \"react\";\n\nimport { Bar, BarChart, CartesianGrid, Tooltip, XAxis, YAxis } from \"recharts\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Chart } from \"@stealthscale/component-charts\";\n\nconst MONTHS = [\n { growth: 64, month: \"2026-04-01\", scale: 12, starter: 120 },\n { growth: 71, month: \"2026-05-01\", scale: 15, starter: 132 },\n { growth: 88, month: \"2026-06-01\", scale: 14, starter: 118 },\n { growth: 95, month: \"2026-07-01\", scale: 21, starter: 141 },\n { growth: 104, month: \"2026-08-01\", scale: 26, starter: 150 },\n { growth: 118, month: \"2026-09-01\", scale: 31, starter: 162 },\n];\n\nexport function Signups(): ReactElement {\n const { t } = useWords(\"chart\");\n const chart = Chart.useChart({\n data: MONTHS,\n series: [\n { color: \"blue\", key: \"starter\", label: t(\"signups.starter\") },\n { color: \"teal\", key: \"growth\", label: t(\"signups.growth\") },\n { color: \"purple\", key: \"scale\", label: t(\"signups.scale\") },\n ],\n });\n const month = chart.formatDate({ month: \"short\", timeZone: \"UTC\" });\n\n return (\n <Chart.Root chart={chart}>\n <Chart.Plot>\n <BarChart accessibilityLayer data={chart.data} title={t(\"signups.name\")}>\n <CartesianGrid vertical={false} />\n <XAxis dataKey=\"month\" tickFormatter={month} />\n <YAxis allowDecimals={false} tickFormatter={chart.formatNumber()} width={48} />\n <Tooltip content={<Chart.Tooltip formatLabel={month} />} />\n {chart.series.map((series) => (\n <Bar\n dataKey={series.key}\n fill={series.color}\n hide={series.hidden}\n isAnimationActive={false}\n key={series.key}\n opacity={series.opacity}\n stackId=\"plan\"\n />\n ))}\n </BarChart>\n </Chart.Plot>\n <Chart.Legend label={t(\"series\")} />\n <Chart.Caption>{t(\"signups.caption\")}</Chart.Caption>\n </Chart.Root>\n );\n}\n";
882
+ //#endregion
883
+ //#region src/chart/examples/storage.example.tsx
884
+ var storage_example_exports = /* @__PURE__ */ __exportAll({
885
+ Storage: () => Storage,
886
+ source: () => source
887
+ });
888
+ const KINDS = [
889
+ {
890
+ gigabytes: 118,
891
+ kind: "video"
892
+ },
893
+ {
894
+ gigabytes: 42,
895
+ kind: "images"
896
+ },
897
+ {
898
+ gigabytes: 26,
899
+ kind: "archives"
900
+ },
901
+ {
902
+ gigabytes: 9.5,
903
+ kind: "documents"
904
+ }
905
+ ];
906
+ function Storage() {
907
+ const $ = c(48);
908
+ const { t } = useWords("chart");
909
+ let t0;
910
+ if ($[0] !== t) {
911
+ t0 = t("storage.video");
912
+ $[0] = t;
913
+ $[1] = t0;
914
+ } else t0 = $[1];
915
+ let t1;
916
+ if ($[2] !== t0) {
917
+ t1 = {
918
+ key: "video",
919
+ label: t0
920
+ };
921
+ $[2] = t0;
922
+ $[3] = t1;
923
+ } else t1 = $[3];
924
+ let t2;
925
+ if ($[4] !== t) {
926
+ t2 = t("storage.images");
927
+ $[4] = t;
928
+ $[5] = t2;
929
+ } else t2 = $[5];
930
+ let t3;
931
+ if ($[6] !== t2) {
932
+ t3 = {
933
+ key: "images",
934
+ label: t2
935
+ };
936
+ $[6] = t2;
937
+ $[7] = t3;
938
+ } else t3 = $[7];
939
+ let t4;
940
+ if ($[8] !== t) {
941
+ t4 = t("storage.archives");
942
+ $[8] = t;
943
+ $[9] = t4;
944
+ } else t4 = $[9];
945
+ let t5;
946
+ if ($[10] !== t4) {
947
+ t5 = {
948
+ key: "archives",
949
+ label: t4
950
+ };
951
+ $[10] = t4;
952
+ $[11] = t5;
953
+ } else t5 = $[11];
954
+ let t6;
955
+ if ($[12] !== t) {
956
+ t6 = t("storage.documents");
957
+ $[12] = t;
958
+ $[13] = t6;
959
+ } else t6 = $[13];
960
+ let t7;
961
+ if ($[14] !== t6) {
962
+ t7 = {
963
+ key: "documents",
964
+ label: t6
965
+ };
966
+ $[14] = t6;
967
+ $[15] = t7;
968
+ } else t7 = $[15];
969
+ let t8;
970
+ if ($[16] !== t1 || $[17] !== t3 || $[18] !== t5 || $[19] !== t7) {
971
+ t8 = {
972
+ data: KINDS,
973
+ series: [
974
+ t1,
975
+ t3,
976
+ t5,
977
+ t7
978
+ ]
979
+ };
980
+ $[16] = t1;
981
+ $[17] = t3;
982
+ $[18] = t5;
983
+ $[19] = t7;
984
+ $[20] = t8;
985
+ } else t8 = $[20];
986
+ const chart = useChart(t8);
987
+ let t9;
988
+ if ($[21] !== chart) {
989
+ t9 = chart.formatNumber({
990
+ maximumFractionDigits: 1,
991
+ style: "unit",
992
+ unit: "gigabyte"
993
+ });
994
+ $[21] = chart;
995
+ $[22] = t9;
996
+ } else t9 = $[22];
997
+ const size = t9;
998
+ let t10;
999
+ if ($[23] !== chart) {
1000
+ t10 = chart.data.filter((row) => !chart.hidden(row.kind)).map((t11) => {
1001
+ const { gigabytes, kind } = t11;
1002
+ return {
1003
+ fill: chart.color(kind),
1004
+ gigabytes,
1005
+ kind
1006
+ };
1007
+ });
1008
+ $[23] = chart;
1009
+ $[24] = t10;
1010
+ } else t10 = $[24];
1011
+ const sectors = t10;
1012
+ let t11;
1013
+ if ($[25] !== t) {
1014
+ t11 = t("storage.name");
1015
+ $[25] = t;
1016
+ $[26] = t11;
1017
+ } else t11 = $[26];
1018
+ let t12;
1019
+ if ($[27] !== size) {
1020
+ t12 = /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(Tooltip$1, { formatValue: size }) });
1021
+ $[27] = size;
1022
+ $[28] = t12;
1023
+ } else t12 = $[28];
1024
+ let t13;
1025
+ if ($[29] !== sectors) {
1026
+ t13 = /* @__PURE__ */ jsx(Pie, {
1027
+ data: sectors,
1028
+ dataKey: "gigabytes",
1029
+ innerRadius: "60%",
1030
+ isAnimationActive: false,
1031
+ nameKey: "kind",
1032
+ outerRadius: "90%",
1033
+ paddingAngle: 1,
1034
+ rootTabIndex: -1
1035
+ });
1036
+ $[29] = sectors;
1037
+ $[30] = t13;
1038
+ } else t13 = $[30];
1039
+ let t14;
1040
+ if ($[31] !== t11 || $[32] !== t12 || $[33] !== t13) {
1041
+ t14 = /* @__PURE__ */ jsx(Plot, { children: /* @__PURE__ */ jsxs(PieChart, {
1042
+ accessibilityLayer: true,
1043
+ title: t11,
1044
+ children: [t12, t13]
1045
+ }) });
1046
+ $[31] = t11;
1047
+ $[32] = t12;
1048
+ $[33] = t13;
1049
+ $[34] = t14;
1050
+ } else t14 = $[34];
1051
+ let t15;
1052
+ if ($[35] !== t) {
1053
+ t15 = t("storage.legend");
1054
+ $[35] = t;
1055
+ $[36] = t15;
1056
+ } else t15 = $[36];
1057
+ let t16;
1058
+ if ($[37] !== t15) {
1059
+ t16 = /* @__PURE__ */ jsx(Legend, { label: t15 });
1060
+ $[37] = t15;
1061
+ $[38] = t16;
1062
+ } else t16 = $[38];
1063
+ let t17;
1064
+ if ($[39] !== t) {
1065
+ t17 = t("storage.caption");
1066
+ $[39] = t;
1067
+ $[40] = t17;
1068
+ } else t17 = $[40];
1069
+ let t18;
1070
+ if ($[41] !== t17) {
1071
+ t18 = /* @__PURE__ */ jsx(Caption, { children: t17 });
1072
+ $[41] = t17;
1073
+ $[42] = t18;
1074
+ } else t18 = $[42];
1075
+ let t19;
1076
+ if ($[43] !== chart || $[44] !== t14 || $[45] !== t16 || $[46] !== t18) {
1077
+ t19 = /* @__PURE__ */ jsxs(Root, {
1078
+ chart,
1079
+ ratio: "landscape",
1080
+ children: [
1081
+ t14,
1082
+ t16,
1083
+ t18
1084
+ ]
1085
+ });
1086
+ $[43] = chart;
1087
+ $[44] = t14;
1088
+ $[45] = t16;
1089
+ $[46] = t18;
1090
+ $[47] = t19;
1091
+ } else t19 = $[47];
1092
+ return t19;
1093
+ }
1094
+ const source = "import { type ReactElement } from \"react\";\n\nimport { Pie, PieChart, Tooltip } from \"recharts\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Chart } from \"@stealthscale/component-charts\";\n\nconst KINDS = [\n { gigabytes: 118, kind: \"video\" },\n { gigabytes: 42, kind: \"images\" },\n { gigabytes: 26, kind: \"archives\" },\n { gigabytes: 9.5, kind: \"documents\" },\n];\n\nexport function Storage(): ReactElement {\n const { t } = useWords(\"chart\");\n const chart = Chart.useChart({\n data: KINDS,\n series: [\n { key: \"video\", label: t(\"storage.video\") },\n { key: \"images\", label: t(\"storage.images\") },\n { key: \"archives\", label: t(\"storage.archives\") },\n { key: \"documents\", label: t(\"storage.documents\") },\n ],\n });\n const size = chart.formatNumber({ maximumFractionDigits: 1, style: \"unit\", unit: \"gigabyte\" });\n const sectors = chart.data\n .filter((row) => !chart.hidden(row.kind))\n .map(({ gigabytes, kind }) => ({ fill: chart.color(kind), gigabytes, kind }));\n\n return (\n <Chart.Root chart={chart} ratio=\"landscape\">\n <Chart.Plot>\n <PieChart accessibilityLayer title={t(\"storage.name\")}>\n <Tooltip content={<Chart.Tooltip formatValue={size} />} />\n <Pie\n data={sectors}\n dataKey=\"gigabytes\"\n innerRadius=\"60%\"\n isAnimationActive={false}\n nameKey=\"kind\"\n outerRadius=\"90%\"\n paddingAngle={1}\n rootTabIndex={-1}\n />\n </PieChart>\n </Chart.Plot>\n <Chart.Legend label={t(\"storage.legend\")} />\n <Chart.Caption>{t(\"storage.caption\")}</Chart.Caption>\n </Chart.Root>\n );\n}\n";
1095
+ //#endregion
1096
+ //#region src/chart/chart.specimen.tsx
1097
+ /**
1098
+ * Catalogue page for the chart.
1099
+ *
1100
+ * @remarks
1101
+ * The hand-written scenes render a line chart, stacked bars, a threshold series in the error
1102
+ * palette, a donut whose sectors are series, and the empty state. `scenesOf` generates the
1103
+ * `ratio` scene from the payouts, one chart per ratio in an `md` room. Every scene renders a
1104
+ * component from `examples/` and shows that file as its source. The words are keys under `chart`
1105
+ * in `locales/en/specimen/chart.json`.
1106
+ */
1107
+ /**
1108
+ * Hand-written scene for a line chart of payouts.
1109
+ */
1110
+ const line = {
1111
+ about: "chart.payouts.about",
1112
+ draw: () => /* @__PURE__ */ jsx(Room, {
1113
+ size: "lg",
1114
+ children: /* @__PURE__ */ jsx(Payouts, {})
1115
+ }),
1116
+ example: payouts_example_exports,
1117
+ title: "chart.payouts.title"
1118
+ };
1119
+ /**
1120
+ * Hand-written scene for stacked bars of sign-ups.
1121
+ */
1122
+ const stacked = {
1123
+ about: "chart.signups.about",
1124
+ draw: () => /* @__PURE__ */ jsx(Room, {
1125
+ size: "lg",
1126
+ children: /* @__PURE__ */ jsx(Signups, {})
1127
+ }),
1128
+ example: signups_example_exports,
1129
+ title: "chart.signups.title"
1130
+ };
1131
+ /**
1132
+ * Hand-written scene for a threshold series in the error palette.
1133
+ */
1134
+ const threshold = {
1135
+ about: "chart.latency.about",
1136
+ draw: () => /* @__PURE__ */ jsx(Room, {
1137
+ size: "lg",
1138
+ children: /* @__PURE__ */ jsx(Latency, {})
1139
+ }),
1140
+ example: latency_example_exports,
1141
+ title: "chart.latency.title"
1142
+ };
1143
+ /**
1144
+ * Hand-written scene for a donut whose sectors are series.
1145
+ */
1146
+ const donut = {
1147
+ about: "chart.storage.about",
1148
+ draw: () => /* @__PURE__ */ jsx(Room, {
1149
+ size: "md",
1150
+ children: /* @__PURE__ */ jsx(Storage, {})
1151
+ }),
1152
+ example: storage_example_exports,
1153
+ title: "chart.storage.title"
1154
+ };
1155
+ /**
1156
+ * Hand-written scene for a chart without rows.
1157
+ */
1158
+ const empty = {
1159
+ about: "chart.quiet.about",
1160
+ draw: () => /* @__PURE__ */ jsx(Room, {
1161
+ size: "md",
1162
+ children: /* @__PURE__ */ jsx(Quiet, {})
1163
+ }),
1164
+ example: quiet_example_exports,
1165
+ title: "chart.quiet.title"
1166
+ };
1167
+ var chart_specimen_default = specimen({
1168
+ about: "chart.about",
1169
+ id: "components/charts/chart",
1170
+ imports: "import { Chart } from \"@stealthscale/component-charts\";",
1171
+ scenes: [
1172
+ line,
1173
+ stacked,
1174
+ threshold,
1175
+ donut,
1176
+ empty,
1177
+ ...scenesOf(recipe, {
1178
+ axes: { ratio: { direction: "column" } },
1179
+ draw: (props) => /* @__PURE__ */ jsx(Room, {
1180
+ size: "md",
1181
+ children: /* @__PURE__ */ jsx(Payouts, { ...props })
1182
+ }),
1183
+ example: payouts_example_exports,
1184
+ namespace: "chart"
1185
+ })
1186
+ ],
1187
+ title: "chart.title"
1188
+ });
1189
+ //#endregion
1190
+ export { chart_specimen_default as default, donut, empty, line, stacked, threshold };