@stealthscale/component-charts 0.2.1 → 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 +29 -13
  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 +9 -8
  123. /package/dist/{recipe-BbGw00ut.js → recipes-BbGw00ut.js} +0 -0
@@ -0,0 +1,701 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { P as HorizontalBarChart } 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/horizontal-bar-chart/examples/bullet.example.tsx
11
+ var bullet_example_exports = /* @__PURE__ */ __exportAll({
12
+ Bullet: () => Bullet,
13
+ source: () => source$4
14
+ });
15
+ const TEAMS = [
16
+ {
17
+ done: .92,
18
+ plan: 1,
19
+ team: "atlas"
20
+ },
21
+ {
22
+ done: .64,
23
+ plan: 1,
24
+ team: "borealis"
25
+ },
26
+ {
27
+ done: 1.08,
28
+ plan: 1,
29
+ team: "cygnus"
30
+ },
31
+ {
32
+ done: .81,
33
+ plan: .9,
34
+ team: "draco"
35
+ },
36
+ {
37
+ done: .97,
38
+ plan: 1.1,
39
+ team: "eridanus"
40
+ },
41
+ {
42
+ done: 1.12,
43
+ plan: 1,
44
+ team: "fornax"
45
+ }
46
+ ];
47
+ function Bullet() {
48
+ const $ = c(37);
49
+ const { t } = useWords("horizontal-bar-chart");
50
+ let t0;
51
+ if ($[0] !== t) {
52
+ t0 = TEAMS.map((t1) => {
53
+ const { done, plan, team } = t1;
54
+ return {
55
+ done,
56
+ plan,
57
+ team: t(`bullet.${team}`)
58
+ };
59
+ });
60
+ $[0] = t;
61
+ $[1] = t0;
62
+ } else t0 = $[1];
63
+ const rows = t0;
64
+ let t1;
65
+ if ($[2] !== t) {
66
+ t1 = t("bullet.caption");
67
+ $[2] = t;
68
+ $[3] = t1;
69
+ } else t1 = $[3];
70
+ let t2;
71
+ if ($[4] !== t) {
72
+ t2 = t("bullet.label");
73
+ $[4] = t;
74
+ $[5] = t2;
75
+ } else t2 = $[5];
76
+ let t3;
77
+ if ($[6] !== t) {
78
+ t3 = t("bullet.done");
79
+ $[6] = t;
80
+ $[7] = t3;
81
+ } else t3 = $[7];
82
+ let t4;
83
+ if ($[8] !== t3) {
84
+ t4 = [{
85
+ key: "done",
86
+ label: t3,
87
+ target: "plan"
88
+ }];
89
+ $[8] = t3;
90
+ $[9] = t4;
91
+ } else t4 = $[9];
92
+ let t5;
93
+ if ($[10] !== t) {
94
+ t5 = t("bullet.target");
95
+ $[10] = t;
96
+ $[11] = t5;
97
+ } else t5 = $[11];
98
+ let t6;
99
+ let t7;
100
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
101
+ t6 = [0, 1.2];
102
+ t7 = { style: "percent" };
103
+ $[12] = t6;
104
+ $[13] = t7;
105
+ } else {
106
+ t6 = $[12];
107
+ t7 = $[13];
108
+ }
109
+ let t8;
110
+ if ($[14] !== t) {
111
+ t8 = t("bullet.behind");
112
+ $[14] = t;
113
+ $[15] = t8;
114
+ } else t8 = $[15];
115
+ let t9;
116
+ if ($[16] !== t8) {
117
+ t9 = {
118
+ color: "error",
119
+ label: t8,
120
+ upTo: .7
121
+ };
122
+ $[16] = t8;
123
+ $[17] = t9;
124
+ } else t9 = $[17];
125
+ let t10;
126
+ if ($[18] !== t) {
127
+ t10 = t("bullet.close");
128
+ $[18] = t;
129
+ $[19] = t10;
130
+ } else t10 = $[19];
131
+ let t11;
132
+ if ($[20] !== t10) {
133
+ t11 = {
134
+ color: "warning",
135
+ label: t10,
136
+ upTo: .9
137
+ };
138
+ $[20] = t10;
139
+ $[21] = t11;
140
+ } else t11 = $[21];
141
+ let t12;
142
+ if ($[22] !== t) {
143
+ t12 = t("bullet.on");
144
+ $[22] = t;
145
+ $[23] = t12;
146
+ } else t12 = $[23];
147
+ let t13;
148
+ if ($[24] !== t12) {
149
+ t13 = {
150
+ color: "success",
151
+ label: t12,
152
+ upTo: 1.2
153
+ };
154
+ $[24] = t12;
155
+ $[25] = t13;
156
+ } else t13 = $[25];
157
+ let t14;
158
+ if ($[26] !== t11 || $[27] !== t13 || $[28] !== t9) {
159
+ t14 = [
160
+ t9,
161
+ t11,
162
+ t13
163
+ ];
164
+ $[26] = t11;
165
+ $[27] = t13;
166
+ $[28] = t9;
167
+ $[29] = t14;
168
+ } else t14 = $[29];
169
+ let t15;
170
+ if ($[30] !== rows || $[31] !== t1 || $[32] !== t14 || $[33] !== t2 || $[34] !== t4 || $[35] !== t5) {
171
+ t15 = /* @__PURE__ */ jsx(HorizontalBarChart, {
172
+ caption: t1,
173
+ categoryKey: "team",
174
+ data: rows,
175
+ label: t2,
176
+ series: t4,
177
+ targetLabel: t5,
178
+ valueDomain: t6,
179
+ valueOptions: t7,
180
+ zones: t14
181
+ });
182
+ $[30] = rows;
183
+ $[31] = t1;
184
+ $[32] = t14;
185
+ $[33] = t2;
186
+ $[34] = t4;
187
+ $[35] = t5;
188
+ $[36] = t15;
189
+ } else t15 = $[36];
190
+ return t15;
191
+ }
192
+ const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { HorizontalBarChart } from \"@stealthscale/component-charts\";\n\nconst TEAMS = [\n { done: 0.92, plan: 1, team: \"atlas\" },\n { done: 0.64, plan: 1, team: \"borealis\" },\n { done: 1.08, plan: 1, team: \"cygnus\" },\n { done: 0.81, plan: 0.9, team: \"draco\" },\n { done: 0.97, plan: 1.1, team: \"eridanus\" },\n { done: 1.12, plan: 1, team: \"fornax\" },\n];\n\nexport function Bullet(): ReactElement {\n const { t } = useWords(\"horizontal-bar-chart\");\n const rows = TEAMS.map(({ done, plan, team }) => ({ done, plan, team: t(`bullet.${team}`) }));\n\n return (\n <HorizontalBarChart\n caption={t(\"bullet.caption\")}\n categoryKey=\"team\"\n data={rows}\n label={t(\"bullet.label\")}\n series={[{ key: \"done\", label: t(\"bullet.done\"), target: \"plan\" }]}\n targetLabel={t(\"bullet.target\")}\n valueDomain={[0, 1.2]}\n valueOptions={{ style: \"percent\" }}\n zones={[\n { color: \"error\", label: t(\"bullet.behind\"), upTo: 0.7 },\n { color: \"warning\", label: t(\"bullet.close\"), upTo: 0.9 },\n { color: \"success\", label: t(\"bullet.on\"), upTo: 1.2 },\n ]}\n />\n );\n}\n";
193
+ //#endregion
194
+ //#region src/horizontal-bar-chart/examples/countries.example.tsx
195
+ var countries_example_exports = /* @__PURE__ */ __exportAll({
196
+ Countries: () => Countries,
197
+ source: () => source$3
198
+ });
199
+ const COUNTRIES$3 = [
200
+ {
201
+ country: "us",
202
+ sessions: 48200
203
+ },
204
+ {
205
+ country: "gb",
206
+ sessions: 21400
207
+ },
208
+ {
209
+ country: "de",
210
+ sessions: 17900
211
+ },
212
+ {
213
+ country: "nl",
214
+ sessions: 12300
215
+ },
216
+ {
217
+ country: "br",
218
+ sessions: 9800
219
+ },
220
+ {
221
+ country: "in",
222
+ sessions: 8600
223
+ }
224
+ ];
225
+ function Countries() {
226
+ const $ = c(16);
227
+ const { t } = useWords("horizontal-bar-chart");
228
+ let t0;
229
+ if ($[0] !== t) {
230
+ t0 = COUNTRIES$3.map((t1) => {
231
+ const { country, sessions } = t1;
232
+ return {
233
+ country: t(`countries.${country}`),
234
+ sessions
235
+ };
236
+ });
237
+ $[0] = t;
238
+ $[1] = t0;
239
+ } else t0 = $[1];
240
+ const rows = t0;
241
+ let t1;
242
+ if ($[2] !== t) {
243
+ t1 = t("countries.caption");
244
+ $[2] = t;
245
+ $[3] = t1;
246
+ } else t1 = $[3];
247
+ let t2;
248
+ if ($[4] !== t) {
249
+ t2 = t("countries.label");
250
+ $[4] = t;
251
+ $[5] = t2;
252
+ } else t2 = $[5];
253
+ let t3;
254
+ if ($[6] !== t) {
255
+ t3 = t("countries.sessions");
256
+ $[6] = t;
257
+ $[7] = t3;
258
+ } else t3 = $[7];
259
+ let t4;
260
+ if ($[8] !== t3) {
261
+ t4 = [{
262
+ color: "indigo",
263
+ key: "sessions",
264
+ label: t3
265
+ }];
266
+ $[8] = t3;
267
+ $[9] = t4;
268
+ } else t4 = $[9];
269
+ let t5;
270
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
271
+ t5 = { notation: "compact" };
272
+ $[10] = t5;
273
+ } else t5 = $[10];
274
+ let t6;
275
+ if ($[11] !== rows || $[12] !== t1 || $[13] !== t2 || $[14] !== t4) {
276
+ t6 = /* @__PURE__ */ jsx(HorizontalBarChart, {
277
+ caption: t1,
278
+ categoryKey: "country",
279
+ data: rows,
280
+ label: t2,
281
+ series: t4,
282
+ valueOptions: t5
283
+ });
284
+ $[11] = rows;
285
+ $[12] = t1;
286
+ $[13] = t2;
287
+ $[14] = t4;
288
+ $[15] = t6;
289
+ } else t6 = $[15];
290
+ return t6;
291
+ }
292
+ const source$3 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { HorizontalBarChart } from \"@stealthscale/component-charts\";\n\nconst COUNTRIES = [\n { country: \"us\", sessions: 48_200 },\n { country: \"gb\", sessions: 21_400 },\n { country: \"de\", sessions: 17_900 },\n { country: \"nl\", sessions: 12_300 },\n { country: \"br\", sessions: 9800 },\n { country: \"in\", sessions: 8600 },\n];\n\nexport function Countries(): ReactElement {\n const { t } = useWords(\"horizontal-bar-chart\");\n const rows = COUNTRIES.map(({ country, sessions }) => ({\n country: t(`countries.${country}`),\n sessions,\n }));\n\n return (\n <HorizontalBarChart\n caption={t(\"countries.caption\")}\n categoryKey=\"country\"\n data={rows}\n label={t(\"countries.label\")}\n series={[{ color: \"indigo\", key: \"sessions\", label: t(\"countries.sessions\") }]}\n valueOptions={{ notation: \"compact\" }}\n />\n );\n}\n";
293
+ //#endregion
294
+ //#region src/horizontal-bar-chart/examples/leader.example.tsx
295
+ var leader_example_exports = /* @__PURE__ */ __exportAll({
296
+ Leader: () => Leader,
297
+ source: () => source$2
298
+ });
299
+ const COUNTRIES$2 = [
300
+ {
301
+ country: "us",
302
+ sessions: 48200
303
+ },
304
+ {
305
+ country: "gb",
306
+ sessions: 21400
307
+ },
308
+ {
309
+ country: "de",
310
+ sessions: 17900
311
+ },
312
+ {
313
+ country: "nl",
314
+ sessions: 12300
315
+ },
316
+ {
317
+ country: "br",
318
+ sessions: 9800
319
+ },
320
+ {
321
+ country: "in",
322
+ sessions: 8600
323
+ }
324
+ ];
325
+ function Leader() {
326
+ const $ = c(16);
327
+ const { t } = useWords("horizontal-bar-chart");
328
+ let t0;
329
+ if ($[0] !== t) {
330
+ t0 = COUNTRIES$2.map((t1) => {
331
+ const { country, sessions } = t1;
332
+ return {
333
+ country: t(`countries.${country}`),
334
+ sessions
335
+ };
336
+ });
337
+ $[0] = t;
338
+ $[1] = t0;
339
+ } else t0 = $[1];
340
+ const rows = t0;
341
+ let t1;
342
+ if ($[2] !== t) {
343
+ t1 = t("leader.caption");
344
+ $[2] = t;
345
+ $[3] = t1;
346
+ } else t1 = $[3];
347
+ let t2;
348
+ if ($[4] !== t) {
349
+ t2 = t("countries.label");
350
+ $[4] = t;
351
+ $[5] = t2;
352
+ } else t2 = $[5];
353
+ let t3;
354
+ if ($[6] !== t) {
355
+ t3 = t("countries.sessions");
356
+ $[6] = t;
357
+ $[7] = t3;
358
+ } else t3 = $[7];
359
+ let t4;
360
+ if ($[8] !== t3) {
361
+ t4 = [{
362
+ color: "indigo",
363
+ key: "sessions",
364
+ label: t3
365
+ }];
366
+ $[8] = t3;
367
+ $[9] = t4;
368
+ } else t4 = $[9];
369
+ let t5;
370
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
371
+ t5 = { notation: "compact" };
372
+ $[10] = t5;
373
+ } else t5 = $[10];
374
+ let t6;
375
+ if ($[11] !== rows || $[12] !== t1 || $[13] !== t2 || $[14] !== t4) {
376
+ t6 = /* @__PURE__ */ jsx(HorizontalBarChart, {
377
+ caption: t1,
378
+ categoryKey: "country",
379
+ data: rows,
380
+ defaultIndex: 0,
381
+ label: t2,
382
+ series: t4,
383
+ valueOptions: t5
384
+ });
385
+ $[11] = rows;
386
+ $[12] = t1;
387
+ $[13] = t2;
388
+ $[14] = t4;
389
+ $[15] = t6;
390
+ } else t6 = $[15];
391
+ return t6;
392
+ }
393
+ const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { HorizontalBarChart } from \"@stealthscale/component-charts\";\n\nconst COUNTRIES = [\n { country: \"us\", sessions: 48_200 },\n { country: \"gb\", sessions: 21_400 },\n { country: \"de\", sessions: 17_900 },\n { country: \"nl\", sessions: 12_300 },\n { country: \"br\", sessions: 9800 },\n { country: \"in\", sessions: 8600 },\n];\n\nexport function Leader(): ReactElement {\n const { t } = useWords(\"horizontal-bar-chart\");\n const rows = COUNTRIES.map(({ country, sessions }) => ({\n country: t(`countries.${country}`),\n sessions,\n }));\n\n return (\n <HorizontalBarChart\n caption={t(\"leader.caption\")}\n categoryKey=\"country\"\n data={rows}\n defaultIndex={0}\n label={t(\"countries.label\")}\n series={[{ color: \"indigo\", key: \"sessions\", label: t(\"countries.sessions\") }]}\n valueOptions={{ notation: \"compact\" }}\n />\n );\n}\n";
394
+ //#endregion
395
+ //#region src/horizontal-bar-chart/examples/replay.example.tsx
396
+ var replay_example_exports = /* @__PURE__ */ __exportAll({
397
+ Replay: () => Replay,
398
+ source: () => source$1
399
+ });
400
+ const COUNTRIES$1 = [
401
+ {
402
+ country: "us",
403
+ sessions: 48200
404
+ },
405
+ {
406
+ country: "gb",
407
+ sessions: 21400
408
+ },
409
+ {
410
+ country: "de",
411
+ sessions: 17900
412
+ },
413
+ {
414
+ country: "nl",
415
+ sessions: 12300
416
+ },
417
+ {
418
+ country: "br",
419
+ sessions: 9800
420
+ },
421
+ {
422
+ country: "in",
423
+ sessions: 8600
424
+ }
425
+ ];
426
+ function Replay() {
427
+ const $ = c(28);
428
+ const { t } = useWords("horizontal-bar-chart");
429
+ const [run, setRun] = useState(0);
430
+ let t0;
431
+ if ($[0] !== t) {
432
+ t0 = COUNTRIES$1.map((t1) => {
433
+ const { country, sessions } = t1;
434
+ return {
435
+ country: t(`countries.${country}`),
436
+ sessions
437
+ };
438
+ });
439
+ $[0] = t;
440
+ $[1] = t0;
441
+ } else t0 = $[1];
442
+ const rows = t0;
443
+ let t1;
444
+ if ($[2] !== t) {
445
+ t1 = t("countries.caption");
446
+ $[2] = t;
447
+ $[3] = t1;
448
+ } else t1 = $[3];
449
+ let t2;
450
+ if ($[4] !== t) {
451
+ t2 = t("countries.label");
452
+ $[4] = t;
453
+ $[5] = t2;
454
+ } else t2 = $[5];
455
+ let t3;
456
+ if ($[6] !== t) {
457
+ t3 = t("countries.sessions");
458
+ $[6] = t;
459
+ $[7] = t3;
460
+ } else t3 = $[7];
461
+ let t4;
462
+ if ($[8] !== t3) {
463
+ t4 = [{
464
+ color: "indigo",
465
+ key: "sessions",
466
+ label: t3
467
+ }];
468
+ $[8] = t3;
469
+ $[9] = t4;
470
+ } else t4 = $[9];
471
+ let t5;
472
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
473
+ t5 = { notation: "compact" };
474
+ $[10] = t5;
475
+ } else t5 = $[10];
476
+ let t6;
477
+ if ($[11] !== rows || $[12] !== run || $[13] !== t1 || $[14] !== t2 || $[15] !== t4) {
478
+ t6 = /* @__PURE__ */ jsx(HorizontalBarChart, {
479
+ animate: true,
480
+ caption: t1,
481
+ categoryKey: "country",
482
+ data: rows,
483
+ label: t2,
484
+ series: t4,
485
+ valueOptions: t5
486
+ }, run);
487
+ $[11] = rows;
488
+ $[12] = run;
489
+ $[13] = t1;
490
+ $[14] = t2;
491
+ $[15] = t4;
492
+ $[16] = t6;
493
+ } else t6 = $[16];
494
+ let t7;
495
+ if ($[17] !== run) {
496
+ t7 = () => {
497
+ setRun(run + 1);
498
+ };
499
+ $[17] = run;
500
+ $[18] = t7;
501
+ } else t7 = $[18];
502
+ let t8;
503
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
504
+ t8 = /* @__PURE__ */ jsx(RotateCcwIcon, {});
505
+ $[19] = t8;
506
+ } else t8 = $[19];
507
+ let t9;
508
+ if ($[20] !== t) {
509
+ t9 = t("replay.replay");
510
+ $[20] = t;
511
+ $[21] = t9;
512
+ } else t9 = $[21];
513
+ let t10;
514
+ if ($[22] !== t7 || $[23] !== t9) {
515
+ t10 = /* @__PURE__ */ jsxs(Button, {
516
+ onClick: t7,
517
+ size: "sm",
518
+ variant: "outline",
519
+ children: [t8, t9]
520
+ });
521
+ $[22] = t7;
522
+ $[23] = t9;
523
+ $[24] = t10;
524
+ } else t10 = $[24];
525
+ let t11;
526
+ if ($[25] !== t10 || $[26] !== t6) {
527
+ t11 = /* @__PURE__ */ jsxs(Stack, {
528
+ align: "flex-start",
529
+ children: [t6, t10]
530
+ });
531
+ $[25] = t10;
532
+ $[26] = t6;
533
+ $[27] = t11;
534
+ } else t11 = $[27];
535
+ return t11;
536
+ }
537
+ 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 { HorizontalBarChart } from \"@stealthscale/component-charts\";\n\nconst COUNTRIES = [\n { country: \"us\", sessions: 48_200 },\n { country: \"gb\", sessions: 21_400 },\n { country: \"de\", sessions: 17_900 },\n { country: \"nl\", sessions: 12_300 },\n { country: \"br\", sessions: 9800 },\n { country: \"in\", sessions: 8600 },\n];\n\nexport function Replay(): ReactElement {\n const { t } = useWords(\"horizontal-bar-chart\");\n const [run, setRun] = useState(0);\n const rows = COUNTRIES.map(({ country, sessions }) => ({\n country: t(`countries.${country}`),\n sessions,\n }));\n\n return (\n <Stack align=\"flex-start\">\n <HorizontalBarChart\n animate\n caption={t(\"countries.caption\")}\n categoryKey=\"country\"\n data={rows}\n key={run}\n label={t(\"countries.label\")}\n series={[{ color: \"indigo\", key: \"sessions\", label: t(\"countries.sessions\") }]}\n valueOptions={{ notation: \"compact\" }}\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";
538
+ //#endregion
539
+ //#region src/horizontal-bar-chart/examples/unvisited.example.tsx
540
+ var unvisited_example_exports = /* @__PURE__ */ __exportAll({
541
+ Unvisited: () => Unvisited,
542
+ source: () => source
543
+ });
544
+ const COUNTRIES = [];
545
+ function Unvisited() {
546
+ const $ = c(15);
547
+ const { t } = useWords("horizontal-bar-chart");
548
+ let t0;
549
+ if ($[0] !== t) {
550
+ t0 = t("unvisited.caption");
551
+ $[0] = t;
552
+ $[1] = t0;
553
+ } else t0 = $[1];
554
+ let t1;
555
+ if ($[2] !== t) {
556
+ t1 = t("unvisited.empty");
557
+ $[2] = t;
558
+ $[3] = t1;
559
+ } else t1 = $[3];
560
+ let t2;
561
+ if ($[4] !== t) {
562
+ t2 = t("countries.label");
563
+ $[4] = t;
564
+ $[5] = t2;
565
+ } else t2 = $[5];
566
+ let t3;
567
+ if ($[6] !== t) {
568
+ t3 = t("countries.sessions");
569
+ $[6] = t;
570
+ $[7] = t3;
571
+ } else t3 = $[7];
572
+ let t4;
573
+ if ($[8] !== t3) {
574
+ t4 = [{
575
+ color: "indigo",
576
+ key: "sessions",
577
+ label: t3
578
+ }];
579
+ $[8] = t3;
580
+ $[9] = t4;
581
+ } else t4 = $[9];
582
+ let t5;
583
+ if ($[10] !== t0 || $[11] !== t1 || $[12] !== t2 || $[13] !== t4) {
584
+ t5 = /* @__PURE__ */ jsx(HorizontalBarChart, {
585
+ caption: t0,
586
+ categoryKey: "country",
587
+ data: COUNTRIES,
588
+ empty: t1,
589
+ label: t2,
590
+ series: t4
591
+ });
592
+ $[10] = t0;
593
+ $[11] = t1;
594
+ $[12] = t2;
595
+ $[13] = t4;
596
+ $[14] = t5;
597
+ } else t5 = $[14];
598
+ return t5;
599
+ }
600
+ const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { HorizontalBarChart } from \"@stealthscale/component-charts\";\n\nconst COUNTRIES: Array<{ country: string; sessions: number }> = [];\n\nexport function Unvisited(): ReactElement {\n const { t } = useWords(\"horizontal-bar-chart\");\n\n return (\n <HorizontalBarChart\n caption={t(\"unvisited.caption\")}\n categoryKey=\"country\"\n data={COUNTRIES}\n empty={t(\"unvisited.empty\")}\n label={t(\"countries.label\")}\n series={[{ color: \"indigo\", key: \"sessions\", label: t(\"countries.sessions\") }]}\n />\n );\n}\n";
601
+ //#endregion
602
+ //#region src/horizontal-bar-chart/horizontal-bar-chart.specimen.tsx
603
+ /**
604
+ * Catalogue page for the horizontal bar chart.
605
+ *
606
+ * @remarks
607
+ * The horizontal bar chart has no recipe of its own: the chart's recipe styles its figure, so
608
+ * every scene is hand-written. The scenes render sessions per country as a ranking, plan
609
+ * attainment per team as bullet graphs, the tooltip open at the first row, the bars animated in
610
+ * with a replay, the ranking at a phone's width, and a week without sessions. Every scene renders
611
+ * a component from `examples/` and shows that file as its source. The words are keys under
612
+ * `horizontal-bar-chart` in `locales/en/specimen/horizontal-bar-chart.json`.
613
+ */
614
+ /**
615
+ * Hand-written scene for a ranking of countries.
616
+ */
617
+ const ranking = {
618
+ about: "horizontal-bar-chart.countries.about",
619
+ draw: () => /* @__PURE__ */ jsx(Room, {
620
+ size: "lg",
621
+ children: /* @__PURE__ */ jsx(Countries, {})
622
+ }),
623
+ example: countries_example_exports,
624
+ title: "horizontal-bar-chart.countries.title"
625
+ };
626
+ /**
627
+ * Hand-written scene for bullet graphs: each team against its plan, over the zones.
628
+ */
629
+ const bullets = {
630
+ about: "horizontal-bar-chart.bullet.about",
631
+ draw: () => /* @__PURE__ */ jsx(Room, {
632
+ size: "lg",
633
+ children: /* @__PURE__ */ jsx(Bullet, {})
634
+ }),
635
+ example: bullet_example_exports,
636
+ title: "horizontal-bar-chart.bullet.title"
637
+ };
638
+ /**
639
+ * Hand-written scene for the tooltip open at a row.
640
+ */
641
+ const tooltip = {
642
+ about: "horizontal-bar-chart.leader.about",
643
+ draw: () => /* @__PURE__ */ jsx(Room, {
644
+ size: "lg",
645
+ children: /* @__PURE__ */ jsx(Leader, {})
646
+ }),
647
+ example: leader_example_exports,
648
+ title: "horizontal-bar-chart.leader.title"
649
+ };
650
+ /**
651
+ * Hand-written scene for the bars animated in, with a replay.
652
+ */
653
+ const animated = {
654
+ about: "horizontal-bar-chart.replay.about",
655
+ draw: () => /* @__PURE__ */ jsx(Room, {
656
+ size: "lg",
657
+ children: /* @__PURE__ */ jsx(Replay, {})
658
+ }),
659
+ example: replay_example_exports,
660
+ title: "horizontal-bar-chart.replay.title"
661
+ };
662
+ /**
663
+ * Hand-written scene for the ranking at a phone's width.
664
+ */
665
+ const narrow = {
666
+ about: "horizontal-bar-chart.narrow.about",
667
+ draw: () => /* @__PURE__ */ jsx(Room, {
668
+ size: "xs",
669
+ children: /* @__PURE__ */ jsx(Countries, {})
670
+ }),
671
+ example: countries_example_exports,
672
+ title: "horizontal-bar-chart.narrow.title"
673
+ };
674
+ /**
675
+ * Hand-written scene for a week without sessions.
676
+ */
677
+ const empty = {
678
+ about: "horizontal-bar-chart.unvisited.about",
679
+ draw: () => /* @__PURE__ */ jsx(Room, {
680
+ size: "md",
681
+ children: /* @__PURE__ */ jsx(Unvisited, {})
682
+ }),
683
+ example: unvisited_example_exports,
684
+ title: "horizontal-bar-chart.unvisited.title"
685
+ };
686
+ var horizontal_bar_chart_specimen_default = specimen({
687
+ about: "horizontal-bar-chart.about",
688
+ id: "components/charts/horizontal-bar-chart",
689
+ imports: "import { HorizontalBarChart } from \"@stealthscale/component-charts\";",
690
+ scenes: [
691
+ ranking,
692
+ bullets,
693
+ tooltip,
694
+ animated,
695
+ narrow,
696
+ empty
697
+ ],
698
+ title: "horizontal-bar-chart.title"
699
+ });
700
+ //#endregion
701
+ export { animated, bullets, horizontal_bar_chart_specimen_default as default, empty, narrow, ranking, tooltip };