@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,662 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { k as PercentStackedBar } 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/percent-stacked-bar/examples/mix.example.tsx
11
+ var mix_example_exports = /* @__PURE__ */ __exportAll({
12
+ Mix: () => Mix,
13
+ source: () => source$3
14
+ });
15
+ const REGIONS$3 = [
16
+ {
17
+ growth: 520,
18
+ region: "americas",
19
+ scale: 170,
20
+ starter: 610
21
+ },
22
+ {
23
+ growth: 310,
24
+ region: "emea",
25
+ scale: 70,
26
+ starter: 420
27
+ },
28
+ {
29
+ growth: 90,
30
+ region: "apac",
31
+ scale: 30,
32
+ starter: 180
33
+ }
34
+ ];
35
+ function Mix() {
36
+ const $ = c(30);
37
+ const { t } = useWords("percent-stacked-bar");
38
+ let t0;
39
+ if ($[0] !== t) {
40
+ t0 = REGIONS$3.map((t1) => {
41
+ const { growth, region, scale, starter } = t1;
42
+ return {
43
+ growth,
44
+ region: t(`mix.${region}`),
45
+ scale,
46
+ starter
47
+ };
48
+ });
49
+ $[0] = t;
50
+ $[1] = t0;
51
+ } else t0 = $[1];
52
+ const rows = t0;
53
+ let t1;
54
+ if ($[2] !== t) {
55
+ t1 = t("mix.caption");
56
+ $[2] = t;
57
+ $[3] = t1;
58
+ } else t1 = $[3];
59
+ let t2;
60
+ if ($[4] !== t) {
61
+ t2 = t("mix.label");
62
+ $[4] = t;
63
+ $[5] = t2;
64
+ } else t2 = $[5];
65
+ let t3;
66
+ if ($[6] !== t) {
67
+ t3 = t("series");
68
+ $[6] = t;
69
+ $[7] = t3;
70
+ } else t3 = $[7];
71
+ let t4;
72
+ if ($[8] !== t) {
73
+ t4 = t("mix.scale");
74
+ $[8] = t;
75
+ $[9] = t4;
76
+ } else t4 = $[9];
77
+ let t5;
78
+ if ($[10] !== t4) {
79
+ t5 = {
80
+ key: "scale",
81
+ label: t4
82
+ };
83
+ $[10] = t4;
84
+ $[11] = t5;
85
+ } else t5 = $[11];
86
+ let t6;
87
+ if ($[12] !== t) {
88
+ t6 = t("mix.growth");
89
+ $[12] = t;
90
+ $[13] = t6;
91
+ } else t6 = $[13];
92
+ let t7;
93
+ if ($[14] !== t6) {
94
+ t7 = {
95
+ key: "growth",
96
+ label: t6
97
+ };
98
+ $[14] = t6;
99
+ $[15] = t7;
100
+ } else t7 = $[15];
101
+ let t8;
102
+ if ($[16] !== t) {
103
+ t8 = t("mix.starter");
104
+ $[16] = t;
105
+ $[17] = t8;
106
+ } else t8 = $[17];
107
+ let t9;
108
+ if ($[18] !== t8) {
109
+ t9 = {
110
+ key: "starter",
111
+ label: t8
112
+ };
113
+ $[18] = t8;
114
+ $[19] = t9;
115
+ } else t9 = $[19];
116
+ let t10;
117
+ if ($[20] !== t5 || $[21] !== t7 || $[22] !== t9) {
118
+ t10 = [
119
+ t5,
120
+ t7,
121
+ t9
122
+ ];
123
+ $[20] = t5;
124
+ $[21] = t7;
125
+ $[22] = t9;
126
+ $[23] = t10;
127
+ } else t10 = $[23];
128
+ let t11;
129
+ if ($[24] !== rows || $[25] !== t1 || $[26] !== t10 || $[27] !== t2 || $[28] !== t3) {
130
+ t11 = /* @__PURE__ */ jsx(PercentStackedBar, {
131
+ caption: t1,
132
+ categoryKey: "region",
133
+ data: rows,
134
+ label: t2,
135
+ legendLabel: t3,
136
+ series: t10
137
+ });
138
+ $[24] = rows;
139
+ $[25] = t1;
140
+ $[26] = t10;
141
+ $[27] = t2;
142
+ $[28] = t3;
143
+ $[29] = t11;
144
+ } else t11 = $[29];
145
+ return t11;
146
+ }
147
+ const source$3 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { PercentStackedBar } from \"@stealthscale/component-charts\";\n\nconst REGIONS = [\n { growth: 520, region: \"americas\", scale: 170, starter: 610 },\n { growth: 310, region: \"emea\", scale: 70, starter: 420 },\n { growth: 90, region: \"apac\", scale: 30, starter: 180 },\n];\n\nexport function Mix(): ReactElement {\n const { t } = useWords(\"percent-stacked-bar\");\n const rows = REGIONS.map(({ growth, region, scale, starter }) => ({\n growth,\n region: t(`mix.${region}`),\n scale,\n starter,\n }));\n\n return (\n <PercentStackedBar\n caption={t(\"mix.caption\")}\n categoryKey=\"region\"\n data={rows}\n label={t(\"mix.label\")}\n legendLabel={t(\"series\")}\n series={[\n { key: \"scale\", label: t(\"mix.scale\") },\n { key: \"growth\", label: t(\"mix.growth\") },\n { key: \"starter\", label: t(\"mix.starter\") },\n ]}\n />\n );\n}\n";
148
+ //#endregion
149
+ //#region src/percent-stacked-bar/examples/region.example.tsx
150
+ var region_example_exports = /* @__PURE__ */ __exportAll({
151
+ Region: () => Region,
152
+ source: () => source$2
153
+ });
154
+ const REGIONS$2 = [
155
+ {
156
+ growth: 520,
157
+ region: "americas",
158
+ scale: 170,
159
+ starter: 610
160
+ },
161
+ {
162
+ growth: 310,
163
+ region: "emea",
164
+ scale: 70,
165
+ starter: 420
166
+ },
167
+ {
168
+ growth: 90,
169
+ region: "apac",
170
+ scale: 30,
171
+ starter: 180
172
+ }
173
+ ];
174
+ function Region() {
175
+ const $ = c(30);
176
+ const { t } = useWords("percent-stacked-bar");
177
+ let t0;
178
+ if ($[0] !== t) {
179
+ t0 = REGIONS$2.map((t1) => {
180
+ const { growth, region, scale, starter } = t1;
181
+ return {
182
+ growth,
183
+ region: t(`mix.${region}`),
184
+ scale,
185
+ starter
186
+ };
187
+ });
188
+ $[0] = t;
189
+ $[1] = t0;
190
+ } else t0 = $[1];
191
+ const rows = t0;
192
+ let t1;
193
+ if ($[2] !== t) {
194
+ t1 = t("region.caption");
195
+ $[2] = t;
196
+ $[3] = t1;
197
+ } else t1 = $[3];
198
+ let t2;
199
+ if ($[4] !== t) {
200
+ t2 = t("mix.label");
201
+ $[4] = t;
202
+ $[5] = t2;
203
+ } else t2 = $[5];
204
+ let t3;
205
+ if ($[6] !== t) {
206
+ t3 = t("series");
207
+ $[6] = t;
208
+ $[7] = t3;
209
+ } else t3 = $[7];
210
+ let t4;
211
+ if ($[8] !== t) {
212
+ t4 = t("mix.scale");
213
+ $[8] = t;
214
+ $[9] = t4;
215
+ } else t4 = $[9];
216
+ let t5;
217
+ if ($[10] !== t4) {
218
+ t5 = {
219
+ key: "scale",
220
+ label: t4
221
+ };
222
+ $[10] = t4;
223
+ $[11] = t5;
224
+ } else t5 = $[11];
225
+ let t6;
226
+ if ($[12] !== t) {
227
+ t6 = t("mix.growth");
228
+ $[12] = t;
229
+ $[13] = t6;
230
+ } else t6 = $[13];
231
+ let t7;
232
+ if ($[14] !== t6) {
233
+ t7 = {
234
+ key: "growth",
235
+ label: t6
236
+ };
237
+ $[14] = t6;
238
+ $[15] = t7;
239
+ } else t7 = $[15];
240
+ let t8;
241
+ if ($[16] !== t) {
242
+ t8 = t("mix.starter");
243
+ $[16] = t;
244
+ $[17] = t8;
245
+ } else t8 = $[17];
246
+ let t9;
247
+ if ($[18] !== t8) {
248
+ t9 = {
249
+ key: "starter",
250
+ label: t8
251
+ };
252
+ $[18] = t8;
253
+ $[19] = t9;
254
+ } else t9 = $[19];
255
+ let t10;
256
+ if ($[20] !== t5 || $[21] !== t7 || $[22] !== t9) {
257
+ t10 = [
258
+ t5,
259
+ t7,
260
+ t9
261
+ ];
262
+ $[20] = t5;
263
+ $[21] = t7;
264
+ $[22] = t9;
265
+ $[23] = t10;
266
+ } else t10 = $[23];
267
+ let t11;
268
+ if ($[24] !== rows || $[25] !== t1 || $[26] !== t10 || $[27] !== t2 || $[28] !== t3) {
269
+ t11 = /* @__PURE__ */ jsx(PercentStackedBar, {
270
+ caption: t1,
271
+ categoryKey: "region",
272
+ data: rows,
273
+ defaultIndex: 0,
274
+ label: t2,
275
+ legendLabel: t3,
276
+ series: t10
277
+ });
278
+ $[24] = rows;
279
+ $[25] = t1;
280
+ $[26] = t10;
281
+ $[27] = t2;
282
+ $[28] = t3;
283
+ $[29] = t11;
284
+ } else t11 = $[29];
285
+ return t11;
286
+ }
287
+ const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { PercentStackedBar } from \"@stealthscale/component-charts\";\n\nconst REGIONS = [\n { growth: 520, region: \"americas\", scale: 170, starter: 610 },\n { growth: 310, region: \"emea\", scale: 70, starter: 420 },\n { growth: 90, region: \"apac\", scale: 30, starter: 180 },\n];\n\nexport function Region(): ReactElement {\n const { t } = useWords(\"percent-stacked-bar\");\n const rows = REGIONS.map(({ growth, region, scale, starter }) => ({\n growth,\n region: t(`mix.${region}`),\n scale,\n starter,\n }));\n\n return (\n <PercentStackedBar\n caption={t(\"region.caption\")}\n categoryKey=\"region\"\n data={rows}\n defaultIndex={0}\n label={t(\"mix.label\")}\n legendLabel={t(\"series\")}\n series={[\n { key: \"scale\", label: t(\"mix.scale\") },\n { key: \"growth\", label: t(\"mix.growth\") },\n { key: \"starter\", label: t(\"mix.starter\") },\n ]}\n />\n );\n}\n";
288
+ //#endregion
289
+ //#region src/percent-stacked-bar/examples/replay.example.tsx
290
+ var replay_example_exports = /* @__PURE__ */ __exportAll({
291
+ Replay: () => Replay,
292
+ source: () => source$1
293
+ });
294
+ const REGIONS$1 = [
295
+ {
296
+ growth: 520,
297
+ region: "americas",
298
+ scale: 170,
299
+ starter: 610
300
+ },
301
+ {
302
+ growth: 310,
303
+ region: "emea",
304
+ scale: 70,
305
+ starter: 420
306
+ },
307
+ {
308
+ growth: 90,
309
+ region: "apac",
310
+ scale: 30,
311
+ starter: 180
312
+ }
313
+ ];
314
+ function Replay() {
315
+ const $ = c(42);
316
+ const { t } = useWords("percent-stacked-bar");
317
+ const [run, setRun] = useState(0);
318
+ let t0;
319
+ if ($[0] !== t) {
320
+ t0 = REGIONS$1.map((t1) => {
321
+ const { growth, region, scale, starter } = t1;
322
+ return {
323
+ growth,
324
+ region: t(`mix.${region}`),
325
+ scale,
326
+ starter
327
+ };
328
+ });
329
+ $[0] = t;
330
+ $[1] = t0;
331
+ } else t0 = $[1];
332
+ const rows = t0;
333
+ let t1;
334
+ if ($[2] !== t) {
335
+ t1 = t("mix.caption");
336
+ $[2] = t;
337
+ $[3] = t1;
338
+ } else t1 = $[3];
339
+ let t2;
340
+ if ($[4] !== t) {
341
+ t2 = t("mix.label");
342
+ $[4] = t;
343
+ $[5] = t2;
344
+ } else t2 = $[5];
345
+ let t3;
346
+ if ($[6] !== t) {
347
+ t3 = t("series");
348
+ $[6] = t;
349
+ $[7] = t3;
350
+ } else t3 = $[7];
351
+ let t4;
352
+ if ($[8] !== t) {
353
+ t4 = t("mix.scale");
354
+ $[8] = t;
355
+ $[9] = t4;
356
+ } else t4 = $[9];
357
+ let t5;
358
+ if ($[10] !== t4) {
359
+ t5 = {
360
+ key: "scale",
361
+ label: t4
362
+ };
363
+ $[10] = t4;
364
+ $[11] = t5;
365
+ } else t5 = $[11];
366
+ let t6;
367
+ if ($[12] !== t) {
368
+ t6 = t("mix.growth");
369
+ $[12] = t;
370
+ $[13] = t6;
371
+ } else t6 = $[13];
372
+ let t7;
373
+ if ($[14] !== t6) {
374
+ t7 = {
375
+ key: "growth",
376
+ label: t6
377
+ };
378
+ $[14] = t6;
379
+ $[15] = t7;
380
+ } else t7 = $[15];
381
+ let t8;
382
+ if ($[16] !== t) {
383
+ t8 = t("mix.starter");
384
+ $[16] = t;
385
+ $[17] = t8;
386
+ } else t8 = $[17];
387
+ let t9;
388
+ if ($[18] !== t8) {
389
+ t9 = {
390
+ key: "starter",
391
+ label: t8
392
+ };
393
+ $[18] = t8;
394
+ $[19] = t9;
395
+ } else t9 = $[19];
396
+ let t10;
397
+ if ($[20] !== t5 || $[21] !== t7 || $[22] !== t9) {
398
+ t10 = [
399
+ t5,
400
+ t7,
401
+ t9
402
+ ];
403
+ $[20] = t5;
404
+ $[21] = t7;
405
+ $[22] = t9;
406
+ $[23] = t10;
407
+ } else t10 = $[23];
408
+ let t11;
409
+ if ($[24] !== rows || $[25] !== run || $[26] !== t1 || $[27] !== t10 || $[28] !== t2 || $[29] !== t3) {
410
+ t11 = /* @__PURE__ */ jsx(PercentStackedBar, {
411
+ animate: true,
412
+ caption: t1,
413
+ categoryKey: "region",
414
+ data: rows,
415
+ label: t2,
416
+ legendLabel: t3,
417
+ series: t10
418
+ }, run);
419
+ $[24] = rows;
420
+ $[25] = run;
421
+ $[26] = t1;
422
+ $[27] = t10;
423
+ $[28] = t2;
424
+ $[29] = t3;
425
+ $[30] = t11;
426
+ } else t11 = $[30];
427
+ let t12;
428
+ if ($[31] !== run) {
429
+ t12 = () => {
430
+ setRun(run + 1);
431
+ };
432
+ $[31] = run;
433
+ $[32] = t12;
434
+ } else t12 = $[32];
435
+ let t13;
436
+ if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
437
+ t13 = /* @__PURE__ */ jsx(RotateCcwIcon, {});
438
+ $[33] = t13;
439
+ } else t13 = $[33];
440
+ let t14;
441
+ if ($[34] !== t) {
442
+ t14 = t("replay.replay");
443
+ $[34] = t;
444
+ $[35] = t14;
445
+ } else t14 = $[35];
446
+ let t15;
447
+ if ($[36] !== t12 || $[37] !== t14) {
448
+ t15 = /* @__PURE__ */ jsxs(Button, {
449
+ onClick: t12,
450
+ size: "sm",
451
+ variant: "outline",
452
+ children: [t13, t14]
453
+ });
454
+ $[36] = t12;
455
+ $[37] = t14;
456
+ $[38] = t15;
457
+ } else t15 = $[38];
458
+ let t16;
459
+ if ($[39] !== t11 || $[40] !== t15) {
460
+ t16 = /* @__PURE__ */ jsxs(Stack, {
461
+ align: "flex-start",
462
+ children: [t11, t15]
463
+ });
464
+ $[39] = t11;
465
+ $[40] = t15;
466
+ $[41] = t16;
467
+ } else t16 = $[41];
468
+ return t16;
469
+ }
470
+ const source$1 = "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 { PercentStackedBar } from \"@stealthscale/component-charts\";\n\nconst REGIONS = [\n { growth: 520, region: \"americas\", scale: 170, starter: 610 },\n { growth: 310, region: \"emea\", scale: 70, starter: 420 },\n { growth: 90, region: \"apac\", scale: 30, starter: 180 },\n];\n\nexport function Replay(): ReactElement {\n const { t } = useWords(\"percent-stacked-bar\");\n const [run, setRun] = useState(0);\n const rows = REGIONS.map(({ growth, region, scale, starter }) => ({\n growth,\n region: t(`mix.${region}`),\n scale,\n starter,\n }));\n\n return (\n <Stack align=\"flex-start\">\n <PercentStackedBar\n animate\n caption={t(\"mix.caption\")}\n categoryKey=\"region\"\n data={rows}\n key={run}\n label={t(\"mix.label\")}\n legendLabel={t(\"series\")}\n series={[\n { key: \"scale\", label: t(\"mix.scale\") },\n { key: \"growth\", label: t(\"mix.growth\") },\n { key: \"starter\", label: t(\"mix.starter\") },\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";
471
+ //#endregion
472
+ //#region src/percent-stacked-bar/examples/unsold.example.tsx
473
+ var unsold_example_exports = /* @__PURE__ */ __exportAll({
474
+ Unsold: () => Unsold,
475
+ source: () => source
476
+ });
477
+ const REGIONS = [];
478
+ function Unsold() {
479
+ const $ = c(27);
480
+ const { t } = useWords("percent-stacked-bar");
481
+ let t0;
482
+ if ($[0] !== t) {
483
+ t0 = t("unsold.caption");
484
+ $[0] = t;
485
+ $[1] = t0;
486
+ } else t0 = $[1];
487
+ let t1;
488
+ if ($[2] !== t) {
489
+ t1 = t("unsold.empty");
490
+ $[2] = t;
491
+ $[3] = t1;
492
+ } else t1 = $[3];
493
+ let t2;
494
+ if ($[4] !== t) {
495
+ t2 = t("mix.label");
496
+ $[4] = t;
497
+ $[5] = t2;
498
+ } else t2 = $[5];
499
+ let t3;
500
+ if ($[6] !== t) {
501
+ t3 = t("mix.scale");
502
+ $[6] = t;
503
+ $[7] = t3;
504
+ } else t3 = $[7];
505
+ let t4;
506
+ if ($[8] !== t3) {
507
+ t4 = {
508
+ key: "scale",
509
+ label: t3
510
+ };
511
+ $[8] = t3;
512
+ $[9] = t4;
513
+ } else t4 = $[9];
514
+ let t5;
515
+ if ($[10] !== t) {
516
+ t5 = t("mix.growth");
517
+ $[10] = t;
518
+ $[11] = t5;
519
+ } else t5 = $[11];
520
+ let t6;
521
+ if ($[12] !== t5) {
522
+ t6 = {
523
+ key: "growth",
524
+ label: t5
525
+ };
526
+ $[12] = t5;
527
+ $[13] = t6;
528
+ } else t6 = $[13];
529
+ let t7;
530
+ if ($[14] !== t) {
531
+ t7 = t("mix.starter");
532
+ $[14] = t;
533
+ $[15] = t7;
534
+ } else t7 = $[15];
535
+ let t8;
536
+ if ($[16] !== t7) {
537
+ t8 = {
538
+ key: "starter",
539
+ label: t7
540
+ };
541
+ $[16] = t7;
542
+ $[17] = t8;
543
+ } else t8 = $[17];
544
+ let t9;
545
+ if ($[18] !== t4 || $[19] !== t6 || $[20] !== t8) {
546
+ t9 = [
547
+ t4,
548
+ t6,
549
+ t8
550
+ ];
551
+ $[18] = t4;
552
+ $[19] = t6;
553
+ $[20] = t8;
554
+ $[21] = t9;
555
+ } else t9 = $[21];
556
+ let t10;
557
+ if ($[22] !== t0 || $[23] !== t1 || $[24] !== t2 || $[25] !== t9) {
558
+ t10 = /* @__PURE__ */ jsx(PercentStackedBar, {
559
+ caption: t0,
560
+ categoryKey: "region",
561
+ data: REGIONS,
562
+ empty: t1,
563
+ label: t2,
564
+ series: t9
565
+ });
566
+ $[22] = t0;
567
+ $[23] = t1;
568
+ $[24] = t2;
569
+ $[25] = t9;
570
+ $[26] = t10;
571
+ } else t10 = $[26];
572
+ return t10;
573
+ }
574
+ const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { PercentStackedBar } from \"@stealthscale/component-charts\";\n\nconst REGIONS: Array<{ growth: number; region: string; scale: number; starter: number }> = [];\n\nexport function Unsold(): ReactElement {\n const { t } = useWords(\"percent-stacked-bar\");\n\n return (\n <PercentStackedBar\n caption={t(\"unsold.caption\")}\n categoryKey=\"region\"\n data={REGIONS}\n empty={t(\"unsold.empty\")}\n label={t(\"mix.label\")}\n series={[\n { key: \"scale\", label: t(\"mix.scale\") },\n { key: \"growth\", label: t(\"mix.growth\") },\n { key: \"starter\", label: t(\"mix.starter\") },\n ]}\n />\n );\n}\n";
575
+ //#endregion
576
+ //#region src/percent-stacked-bar/percent-stacked-bar.specimen.tsx
577
+ /**
578
+ * Catalogue page for the percent stacked bar chart.
579
+ *
580
+ * @remarks
581
+ * The percent stacked bar chart has no recipe of its own: the chart's recipe styles its figure,
582
+ * so every scene is hand-written. The scenes render customers per plan in each region as shares,
583
+ * the tooltip open at the Americas, the segments animated in with a replay, the mix at a phone's
584
+ * width, and a chart without rows. Every scene renders a component from `examples/` and shows
585
+ * that file as its source. The words are keys under `percent-stacked-bar` in
586
+ * `locales/en/specimen/percent-stacked-bar.json`.
587
+ */
588
+ /**
589
+ * Hand-written scene for shares per region.
590
+ */
591
+ const shares = {
592
+ about: "percent-stacked-bar.mix.about",
593
+ draw: () => /* @__PURE__ */ jsx(Room, {
594
+ size: "lg",
595
+ children: /* @__PURE__ */ jsx(Mix, {})
596
+ }),
597
+ example: mix_example_exports,
598
+ title: "percent-stacked-bar.mix.title"
599
+ };
600
+ /**
601
+ * Hand-written scene for the tooltip open at a row.
602
+ */
603
+ const tooltip = {
604
+ about: "percent-stacked-bar.region.about",
605
+ draw: () => /* @__PURE__ */ jsx(Room, {
606
+ size: "lg",
607
+ children: /* @__PURE__ */ jsx(Region, {})
608
+ }),
609
+ example: region_example_exports,
610
+ title: "percent-stacked-bar.region.title"
611
+ };
612
+ /**
613
+ * Hand-written scene for the segments animated in, with a replay.
614
+ */
615
+ const animated = {
616
+ about: "percent-stacked-bar.replay.about",
617
+ draw: () => /* @__PURE__ */ jsx(Room, {
618
+ size: "lg",
619
+ children: /* @__PURE__ */ jsx(Replay, {})
620
+ }),
621
+ example: replay_example_exports,
622
+ title: "percent-stacked-bar.replay.title"
623
+ };
624
+ /**
625
+ * Hand-written scene for the mix at a phone's width.
626
+ */
627
+ const narrow = {
628
+ about: "percent-stacked-bar.narrow.about",
629
+ draw: () => /* @__PURE__ */ jsx(Room, {
630
+ size: "xs",
631
+ children: /* @__PURE__ */ jsx(Mix, {})
632
+ }),
633
+ example: mix_example_exports,
634
+ title: "percent-stacked-bar.narrow.title"
635
+ };
636
+ /**
637
+ * Hand-written scene for a chart without rows.
638
+ */
639
+ const empty = {
640
+ about: "percent-stacked-bar.unsold.about",
641
+ draw: () => /* @__PURE__ */ jsx(Room, {
642
+ size: "md",
643
+ children: /* @__PURE__ */ jsx(Unsold, {})
644
+ }),
645
+ example: unsold_example_exports,
646
+ title: "percent-stacked-bar.unsold.title"
647
+ };
648
+ var percent_stacked_bar_specimen_default = specimen({
649
+ about: "percent-stacked-bar.about",
650
+ id: "components/charts/percent-stacked-bar",
651
+ imports: "import { PercentStackedBar } from \"@stealthscale/component-charts\";",
652
+ scenes: [
653
+ shares,
654
+ tooltip,
655
+ animated,
656
+ narrow,
657
+ empty
658
+ ],
659
+ title: "percent-stacked-bar.title"
660
+ });
661
+ //#endregion
662
+ export { animated, percent_stacked_bar_specimen_default as default, empty, narrow, shares, tooltip };
@@ -0,0 +1,3 @@
1
+ export const dropped = {"PercentStackedBarProps": {"conditions": 284, "foreign": 1039}};
2
+ export const parts = {"PercentStackedBarProps": [{"accepts": "boolean", "fallback": "", "kind": "option", "name": "animate", "refers": [], "required": false, "says": "Whether the marks animate in, which they do only outside reduced motion."}, {"accepts": "readonly Annotation[]", "fallback": "", "kind": "option", "name": "annotations", "refers": ["kit.Annotation", "kit.ChartColor"], "required": false, "says": "Marks pinned to the data, a moment, a period or a point each, which the tooltip lists at their category. None unless stated."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "caption", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Finding the chart shows, in words, which names the figure."}, {"accepts": "Extract<keyof Row, string>", "fallback": "", "kind": "option", "name": "categoryKey", "refers": [], "required": true, "says": "Field of each row the category axis reads, such as a day or a plan."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "children", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Recharts elements rendered inside the chart after the marks, such as a `ReferenceLine`."}, {"accepts": "Row[]", "fallback": "", "kind": "option", "name": "data", "refers": ["kit.Row"], "required": true, "says": "Rows the chart plots, in order. The array passes to recharts as it is."}, {"accepts": "readonly string[]", "fallback": "", "kind": "option", "name": "defaultHiddenKeys", "refers": [], "required": false, "says": "Keys of the series hidden when the chart first renders, for the uncontrolled case."}, {"accepts": "number", "fallback": "", "kind": "option", "name": "defaultIndex", "refers": [], "required": false, "says": "Index in `data` of the row the tooltip shows when the chart first renders, until the pointer or a key moves it. No tooltip shows at first unless stated."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "empty", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Message the chart renders in the plot's place while it has no rows."}, {"accepts": "boolean", "fallback": "", "kind": "option", "name": "grid", "refers": [], "required": false, "says": "Whether lines cross the plot at the value ticks."}, {"accepts": "readonly string[]", "fallback": "", "kind": "option", "name": "hiddenKeys", "refers": [], "required": false, "says": "Keys of the series the legend hides, where the caller controls them."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "label", "refers": [], "required": true, "says": "Accessible name of the chart's keyboard layer, such as \"Revenue per day\"."}, {"accepts": "DateTimeFormatOptions", "fallback": "", "kind": "option", "name": "labelOptions", "refers": [], "required": false, "says": "`Intl.DateTimeFormat` options the category ticks and the tooltip's heading are written with, for a time axis. The category as it is unless stated."}, {"accepts": "boolean", "fallback": "", "kind": "option", "name": "legend", "refers": [], "required": false, "says": "Whether the legend renders below the plot. It renders while two or more series have rows unless stated."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "legendLabel", "refers": [], "required": false, "says": "Accessible name of the legend's group of buttons."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "locale", "refers": [], "required": false, "says": "Locale the values are written in. The locale in scope unless stated."}, {"accepts": "((hidden: readonly string[]) => void)", "fallback": "", "kind": "option", "name": "onHiddenKeysChange", "refers": [], "required": false, "says": "Called with every key hidden after a press in the legend."}, {"accepts": "\"golden\" | \"landscape\" | \"portrait\" | \"rows\" | \"square\" | \"ultrawide\" | \"video\" | \"wide\"", "fallback": "", "kind": "variant", "name": "ratio", "refers": [], "required": false, "says": "Aspect ratio of the plot and of the empty state in its place, one of the theme's ratios, or `rows` for a plot as tall as its rows."}, {"accepts": "readonly CartesianSeries[]", "fallback": "", "kind": "option", "name": "series", "refers": ["kit.CartesianSeries", "kit.ChartColor", "react.ReactElement", "react.ReactPortal"], "required": true, "says": "Series the chart plots, in the order the legend lists them."}, {"accepts": "AxisDomain", "fallback": "", "kind": "option", "name": "valueDomain", "refers": ["recharts.AxisDomain", "recharts.AxisDomainItem", "recharts.NumberDomain"], "required": false, "says": "Domain of the value axis in recharts' terms, such as `[0, 100]`. From zero unless stated."}, {"accepts": "NumberFormatOptions", "fallback": "", "kind": "option", "name": "valueOptions", "refers": [], "required": false, "says": "`Intl.NumberFormat` options the value ticks and the tooltip's values are written with."}]};
3
+ export const shapes = {"kit.Annotation": [{"accepts": "string | number", "name": "at", "says": "Category the mark is at, or the category its period starts at."}, {"accepts": "ChartColor", "name": "color", "says": "Palette of the mark, such as `warning` for a flagged point. The neutral palette unless stated."}, {"accepts": "string", "name": "key", "says": "Identity of the mark, unique among the chart's annotations."}, {"accepts": "string", "name": "label", "says": "Words for the mark, written on the plot and in the tooltip at its category."}, {"accepts": "string | number", "name": "until", "says": "Category the mark's period ends at, which makes the mark a period."}, {"accepts": "number", "name": "value", "says": "Value of the point the mark rings, which makes the mark a point."}], "kit.ChartColor": [{"accepts": "", "name": "\"accent\"", "says": ""}, {"accepts": "", "name": "\"blue\"", "says": ""}, {"accepts": "", "name": "\"cyan\"", "says": ""}, {"accepts": "", "name": "\"error\"", "says": ""}, {"accepts": "", "name": "\"gray\"", "says": ""}, {"accepts": "", "name": "\"green\"", "says": ""}, {"accepts": "", "name": "\"indigo\"", "says": ""}, {"accepts": "", "name": "\"info\"", "says": ""}, {"accepts": "", "name": "\"neutral\"", "says": ""}, {"accepts": "", "name": "\"orange\"", "says": ""}, {"accepts": "", "name": "\"pink\"", "says": ""}, {"accepts": "", "name": "\"primary\"", "says": ""}, {"accepts": "", "name": "\"purple\"", "says": ""}, {"accepts": "", "name": "\"red\"", "says": ""}, {"accepts": "", "name": "\"secondary\"", "says": ""}, {"accepts": "", "name": "\"series.1\"", "says": ""}, {"accepts": "", "name": "\"series.2\"", "says": ""}, {"accepts": "", "name": "\"series.3\"", "says": ""}, {"accepts": "", "name": "\"series.4\"", "says": ""}, {"accepts": "", "name": "\"series.5\"", "says": ""}, {"accepts": "", "name": "\"series.6\"", "says": ""}, {"accepts": "", "name": "\"series.7\"", "says": ""}, {"accepts": "", "name": "\"series.8\"", "says": ""}, {"accepts": "", "name": "\"success\"", "says": ""}, {"accepts": "", "name": "\"teal\"", "says": ""}, {"accepts": "", "name": "\"warning\"", "says": ""}, {"accepts": "", "name": "\"yellow\"", "says": ""}], "react.ReactElement": [{"accepts": "string | JSXElementConstructor<any>", "name": "type", "says": ""}, {"accepts": "unknown", "name": "props", "says": ""}, {"accepts": "string | null", "name": "key", "says": ""}], "react.ReactPortal": [{"accepts": "ReactNode", "name": "children", "says": ""}, {"accepts": "string | JSXElementConstructor<any>", "name": "type", "says": ""}, {"accepts": "unknown", "name": "props", "says": ""}, {"accepts": "string | null", "name": "key", "says": ""}], "kit.CartesianSeries": [{"accepts": "ChartColor", "name": "color", "says": "Palette the series takes its color from. The theme's series color at its position unless stated."}, {"accepts": "boolean", "name": "dashed", "says": "Whether the series' line renders dashed, as a target or a projection does. A series with `previousOf` renders dashed unless stated."}, {"accepts": "string", "name": "previousOf", "says": "Key of the series this series is the earlier period of, such as last week's revenue for this week's. The series takes the neutral palette unless it states a color, and the tooltip writes the change from it after the other series' value."}, {"accepts": "number", "name": "ink", "says": "Share of the ink, `fg`, in percent, the series' color mixes in: 0 keeps the color, 100 is the ink. The mix keeps 3:1 or more against the page. None unless stated."}, {"accepts": "string", "name": "key", "says": "Field of each row the series reads, which a recharts mark takes as its `dataKey`."}, {"accepts": "ReactNode", "name": "label", "says": "Name the tooltip and the legend show. The key unless stated."}], "recharts.AxisDomain": [{"accepts": "", "name": "readonly string[]", "says": ""}, {"accepts": "", "name": "readonly number[]", "says": ""}, {"accepts": "", "name": "([dataMin, dataMax]: NumberDomain, allowDataOverflow: boolean) => NumberDomain", "says": ""}, {"accepts": "", "name": "readonly [AxisDomainItem, AxisDomainItem]", "says": ""}], "recharts.AxisDomainItem": [{"accepts": "", "name": "string", "says": ""}, {"accepts": "", "name": "number", "says": ""}, {"accepts": "", "name": "(d: number) => string | number", "says": ""}]};