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