@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,669 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { A as ParetoChart, M as paretoRows, j as paretoCutoff } 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/pareto-chart/examples/defects.example.tsx
11
+ var defects_example_exports = /* @__PURE__ */ __exportAll({
12
+ Defects: () => Defects,
13
+ source: () => source$4
14
+ });
15
+ const CAUSES = [
16
+ {
17
+ cause: "Misprint",
18
+ defects: 34
19
+ },
20
+ {
21
+ cause: "Scratch",
22
+ defects: 182
23
+ },
24
+ {
25
+ cause: "Warp",
26
+ defects: 21
27
+ },
28
+ {
29
+ cause: "Dent",
30
+ defects: 97
31
+ },
32
+ {
33
+ cause: "Stain",
34
+ defects: 15
35
+ },
36
+ {
37
+ cause: "Crack",
38
+ defects: 61
39
+ },
40
+ {
41
+ cause: "Other",
42
+ defects: 10
43
+ }
44
+ ];
45
+ function Defects() {
46
+ const $ = c(21);
47
+ const { t } = useWords("pareto-chart");
48
+ let T0;
49
+ let t0;
50
+ if ($[0] !== t) {
51
+ const cutoff = paretoCutoff(paretoRows(CAUSES, "defects"), .9);
52
+ T0 = ParetoChart;
53
+ t0 = t("defects.caption", {
54
+ count: cutoff,
55
+ total: CAUSES.length
56
+ });
57
+ $[0] = t;
58
+ $[1] = T0;
59
+ $[2] = t0;
60
+ } else {
61
+ T0 = $[1];
62
+ t0 = $[2];
63
+ }
64
+ let t1;
65
+ if ($[3] !== t) {
66
+ t1 = t("cumulative");
67
+ $[3] = t;
68
+ $[4] = t1;
69
+ } else t1 = $[4];
70
+ let t2;
71
+ if ($[5] !== t) {
72
+ t2 = t("defects.label");
73
+ $[5] = t;
74
+ $[6] = t2;
75
+ } else t2 = $[6];
76
+ let t3;
77
+ if ($[7] !== t) {
78
+ t3 = t("series");
79
+ $[7] = t;
80
+ $[8] = t3;
81
+ } else t3 = $[8];
82
+ let t4;
83
+ if ($[9] !== t) {
84
+ t4 = t("defects.threshold");
85
+ $[9] = t;
86
+ $[10] = t4;
87
+ } else t4 = $[10];
88
+ let t5;
89
+ if ($[11] !== t) {
90
+ t5 = t("defects.defects");
91
+ $[11] = t;
92
+ $[12] = t5;
93
+ } else t5 = $[12];
94
+ let t6;
95
+ if ($[13] !== T0 || $[14] !== t0 || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5) {
96
+ t6 = /* @__PURE__ */ jsx(T0, {
97
+ caption: t0,
98
+ categoryKey: "cause",
99
+ cumulativeLabel: t1,
100
+ data: CAUSES,
101
+ label: t2,
102
+ legendLabel: t3,
103
+ threshold: .9,
104
+ thresholdLabel: t4,
105
+ valueKey: "defects",
106
+ valueLabel: t5
107
+ });
108
+ $[13] = T0;
109
+ $[14] = t0;
110
+ $[15] = t1;
111
+ $[16] = t2;
112
+ $[17] = t3;
113
+ $[18] = t4;
114
+ $[19] = t5;
115
+ $[20] = t6;
116
+ } else t6 = $[20];
117
+ return t6;
118
+ }
119
+ const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ParetoChart, paretoCutoff, paretoRows } from \"@stealthscale/component-charts\";\n\nconst CAUSES = [\n { cause: \"Misprint\", defects: 34 },\n { cause: \"Scratch\", defects: 182 },\n { cause: \"Warp\", defects: 21 },\n { cause: \"Dent\", defects: 97 },\n { cause: \"Stain\", defects: 15 },\n { cause: \"Crack\", defects: 61 },\n { cause: \"Other\", defects: 10 },\n];\n\nexport function Defects(): ReactElement {\n const { t } = useWords(\"pareto-chart\");\n const cutoff = paretoCutoff(paretoRows(CAUSES, \"defects\"), 0.9);\n\n return (\n <ParetoChart\n caption={t(\"defects.caption\", { count: cutoff, total: CAUSES.length })}\n categoryKey=\"cause\"\n cumulativeLabel={t(\"cumulative\")}\n data={CAUSES}\n label={t(\"defects.label\")}\n legendLabel={t(\"series\")}\n threshold={0.9}\n thresholdLabel={t(\"defects.threshold\")}\n valueKey=\"defects\"\n valueLabel={t(\"defects.defects\")}\n />\n );\n}\n";
120
+ //#endregion
121
+ //#region src/pareto-chart/examples/largest.example.tsx
122
+ var largest_example_exports = /* @__PURE__ */ __exportAll({
123
+ Largest: () => Largest,
124
+ source: () => source$3
125
+ });
126
+ const REASONS$3 = [
127
+ {
128
+ reason: "Export",
129
+ tickets: 98
130
+ },
131
+ {
132
+ reason: "Login",
133
+ tickets: 412
134
+ },
135
+ {
136
+ reason: "Search",
137
+ tickets: 51
138
+ },
139
+ {
140
+ reason: "Billing",
141
+ tickets: 356
142
+ },
143
+ {
144
+ reason: "Mobile",
145
+ tickets: 37
146
+ },
147
+ {
148
+ reason: "Invites",
149
+ tickets: 64
150
+ },
151
+ {
152
+ reason: "Reports",
153
+ tickets: 22
154
+ },
155
+ {
156
+ reason: "Webhooks",
157
+ tickets: 43
158
+ },
159
+ {
160
+ reason: "Other",
161
+ tickets: 17
162
+ }
163
+ ];
164
+ function Largest() {
165
+ const $ = c(16);
166
+ const { t } = useWords("pareto-chart");
167
+ let t0;
168
+ if ($[0] !== t) {
169
+ t0 = t("largest.caption");
170
+ $[0] = t;
171
+ $[1] = t0;
172
+ } else t0 = $[1];
173
+ let t1;
174
+ if ($[2] !== t) {
175
+ t1 = t("cumulative");
176
+ $[2] = t;
177
+ $[3] = t1;
178
+ } else t1 = $[3];
179
+ let t2;
180
+ if ($[4] !== t) {
181
+ t2 = t("tickets.label");
182
+ $[4] = t;
183
+ $[5] = t2;
184
+ } else t2 = $[5];
185
+ let t3;
186
+ if ($[6] !== t) {
187
+ t3 = t("series");
188
+ $[6] = t;
189
+ $[7] = t3;
190
+ } else t3 = $[7];
191
+ let t4;
192
+ if ($[8] !== t) {
193
+ t4 = t("tickets.tickets");
194
+ $[8] = t;
195
+ $[9] = t4;
196
+ } else t4 = $[9];
197
+ let t5;
198
+ if ($[10] !== t0 || $[11] !== t1 || $[12] !== t2 || $[13] !== t3 || $[14] !== t4) {
199
+ t5 = /* @__PURE__ */ jsx(ParetoChart, {
200
+ caption: t0,
201
+ categoryKey: "reason",
202
+ cumulativeLabel: t1,
203
+ data: REASONS$3,
204
+ defaultIndex: 1,
205
+ label: t2,
206
+ legendLabel: t3,
207
+ valueKey: "tickets",
208
+ valueLabel: t4
209
+ });
210
+ $[10] = t0;
211
+ $[11] = t1;
212
+ $[12] = t2;
213
+ $[13] = t3;
214
+ $[14] = t4;
215
+ $[15] = t5;
216
+ } else t5 = $[15];
217
+ return t5;
218
+ }
219
+ const source$3 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ParetoChart } from \"@stealthscale/component-charts\";\n\nconst REASONS = [\n { reason: \"Export\", tickets: 98 },\n { reason: \"Login\", tickets: 412 },\n { reason: \"Search\", tickets: 51 },\n { reason: \"Billing\", tickets: 356 },\n { reason: \"Mobile\", tickets: 37 },\n { reason: \"Invites\", tickets: 64 },\n { reason: \"Reports\", tickets: 22 },\n { reason: \"Webhooks\", tickets: 43 },\n { reason: \"Other\", tickets: 17 },\n];\n\nexport function Largest(): ReactElement {\n const { t } = useWords(\"pareto-chart\");\n\n return (\n <ParetoChart\n caption={t(\"largest.caption\")}\n categoryKey=\"reason\"\n cumulativeLabel={t(\"cumulative\")}\n data={REASONS}\n defaultIndex={1}\n label={t(\"tickets.label\")}\n legendLabel={t(\"series\")}\n valueKey=\"tickets\"\n valueLabel={t(\"tickets.tickets\")}\n />\n );\n}\n";
220
+ //#endregion
221
+ //#region src/pareto-chart/examples/quiet.example.tsx
222
+ var quiet_example_exports = /* @__PURE__ */ __exportAll({
223
+ Quiet: () => Quiet,
224
+ source: () => source$2
225
+ });
226
+ const REASONS$2 = [];
227
+ function Quiet() {
228
+ const $ = c(19);
229
+ const { t } = useWords("pareto-chart");
230
+ let t0;
231
+ if ($[0] !== t) {
232
+ t0 = t("quiet.caption");
233
+ $[0] = t;
234
+ $[1] = t0;
235
+ } else t0 = $[1];
236
+ let t1;
237
+ if ($[2] !== t) {
238
+ t1 = t("cumulative");
239
+ $[2] = t;
240
+ $[3] = t1;
241
+ } else t1 = $[3];
242
+ let t2;
243
+ if ($[4] !== t) {
244
+ t2 = t("quiet.empty");
245
+ $[4] = t;
246
+ $[5] = t2;
247
+ } else t2 = $[5];
248
+ let t3;
249
+ if ($[6] !== t) {
250
+ t3 = t("tickets.label");
251
+ $[6] = t;
252
+ $[7] = t3;
253
+ } else t3 = $[7];
254
+ let t4;
255
+ if ($[8] !== t) {
256
+ t4 = t("series");
257
+ $[8] = t;
258
+ $[9] = t4;
259
+ } else t4 = $[9];
260
+ let t5;
261
+ if ($[10] !== t) {
262
+ t5 = t("tickets.tickets");
263
+ $[10] = t;
264
+ $[11] = t5;
265
+ } else t5 = $[11];
266
+ let t6;
267
+ if ($[12] !== t0 || $[13] !== t1 || $[14] !== t2 || $[15] !== t3 || $[16] !== t4 || $[17] !== t5) {
268
+ t6 = /* @__PURE__ */ jsx(ParetoChart, {
269
+ caption: t0,
270
+ categoryKey: "reason",
271
+ cumulativeLabel: t1,
272
+ data: REASONS$2,
273
+ empty: t2,
274
+ label: t3,
275
+ legendLabel: t4,
276
+ valueKey: "tickets",
277
+ valueLabel: t5
278
+ });
279
+ $[12] = t0;
280
+ $[13] = t1;
281
+ $[14] = t2;
282
+ $[15] = t3;
283
+ $[16] = t4;
284
+ $[17] = t5;
285
+ $[18] = t6;
286
+ } else t6 = $[18];
287
+ return t6;
288
+ }
289
+ const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ParetoChart } from \"@stealthscale/component-charts\";\n\nconst REASONS: Array<{ reason: string; tickets: number }> = [];\n\nexport function Quiet(): ReactElement {\n const { t } = useWords(\"pareto-chart\");\n\n return (\n <ParetoChart\n caption={t(\"quiet.caption\")}\n categoryKey=\"reason\"\n cumulativeLabel={t(\"cumulative\")}\n data={REASONS}\n empty={t(\"quiet.empty\")}\n label={t(\"tickets.label\")}\n legendLabel={t(\"series\")}\n valueKey=\"tickets\"\n valueLabel={t(\"tickets.tickets\")}\n />\n );\n}\n";
290
+ //#endregion
291
+ //#region src/pareto-chart/examples/replay.example.tsx
292
+ var replay_example_exports = /* @__PURE__ */ __exportAll({
293
+ Replay: () => Replay,
294
+ source: () => source$1
295
+ });
296
+ const REASONS$1 = [
297
+ {
298
+ reason: "Export",
299
+ tickets: 98
300
+ },
301
+ {
302
+ reason: "Login",
303
+ tickets: 412
304
+ },
305
+ {
306
+ reason: "Search",
307
+ tickets: 51
308
+ },
309
+ {
310
+ reason: "Billing",
311
+ tickets: 356
312
+ },
313
+ {
314
+ reason: "Mobile",
315
+ tickets: 37
316
+ },
317
+ {
318
+ reason: "Invites",
319
+ tickets: 64
320
+ },
321
+ {
322
+ reason: "Reports",
323
+ tickets: 22
324
+ },
325
+ {
326
+ reason: "Webhooks",
327
+ tickets: 43
328
+ },
329
+ {
330
+ reason: "Other",
331
+ tickets: 17
332
+ }
333
+ ];
334
+ function Replay() {
335
+ const $ = c(36);
336
+ const { t } = useWords("pareto-chart");
337
+ const [run, setRun] = useState(0);
338
+ let T0;
339
+ let T1;
340
+ let t0;
341
+ let t1;
342
+ let t2;
343
+ if ($[0] !== t) {
344
+ const cutoff = paretoCutoff(paretoRows(REASONS$1, "tickets"));
345
+ T1 = Stack;
346
+ t2 = "flex-start";
347
+ T0 = ParetoChart;
348
+ t0 = true;
349
+ t1 = t("tickets.caption", {
350
+ count: cutoff,
351
+ total: REASONS$1.length
352
+ });
353
+ $[0] = t;
354
+ $[1] = T0;
355
+ $[2] = T1;
356
+ $[3] = t0;
357
+ $[4] = t1;
358
+ $[5] = t2;
359
+ } else {
360
+ T0 = $[1];
361
+ T1 = $[2];
362
+ t0 = $[3];
363
+ t1 = $[4];
364
+ t2 = $[5];
365
+ }
366
+ let t3;
367
+ if ($[6] !== t) {
368
+ t3 = t("cumulative");
369
+ $[6] = t;
370
+ $[7] = t3;
371
+ } else t3 = $[7];
372
+ let t4;
373
+ if ($[8] !== t) {
374
+ t4 = t("tickets.label");
375
+ $[8] = t;
376
+ $[9] = t4;
377
+ } else t4 = $[9];
378
+ let t5;
379
+ if ($[10] !== t) {
380
+ t5 = t("series");
381
+ $[10] = t;
382
+ $[11] = t5;
383
+ } else t5 = $[11];
384
+ let t6;
385
+ if ($[12] !== t) {
386
+ t6 = t("tickets.tickets");
387
+ $[12] = t;
388
+ $[13] = t6;
389
+ } else t6 = $[13];
390
+ let t7;
391
+ if ($[14] !== T0 || $[15] !== run || $[16] !== t0 || $[17] !== t1 || $[18] !== t3 || $[19] !== t4 || $[20] !== t5 || $[21] !== t6) {
392
+ t7 = /* @__PURE__ */ jsx(T0, {
393
+ animate: t0,
394
+ caption: t1,
395
+ categoryKey: "reason",
396
+ cumulativeLabel: t3,
397
+ data: REASONS$1,
398
+ label: t4,
399
+ legendLabel: t5,
400
+ valueKey: "tickets",
401
+ valueLabel: t6
402
+ }, run);
403
+ $[14] = T0;
404
+ $[15] = run;
405
+ $[16] = t0;
406
+ $[17] = t1;
407
+ $[18] = t3;
408
+ $[19] = t4;
409
+ $[20] = t5;
410
+ $[21] = t6;
411
+ $[22] = t7;
412
+ } else t7 = $[22];
413
+ let t8;
414
+ if ($[23] !== run) {
415
+ t8 = () => {
416
+ setRun(run + 1);
417
+ };
418
+ $[23] = run;
419
+ $[24] = t8;
420
+ } else t8 = $[24];
421
+ let t9;
422
+ if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
423
+ t9 = /* @__PURE__ */ jsx(RotateCcwIcon, {});
424
+ $[25] = t9;
425
+ } else t9 = $[25];
426
+ let t10;
427
+ if ($[26] !== t) {
428
+ t10 = t("replay.replay");
429
+ $[26] = t;
430
+ $[27] = t10;
431
+ } else t10 = $[27];
432
+ let t11;
433
+ if ($[28] !== t10 || $[29] !== t8) {
434
+ t11 = /* @__PURE__ */ jsxs(Button, {
435
+ onClick: t8,
436
+ size: "sm",
437
+ variant: "outline",
438
+ children: [t9, t10]
439
+ });
440
+ $[28] = t10;
441
+ $[29] = t8;
442
+ $[30] = t11;
443
+ } else t11 = $[30];
444
+ let t12;
445
+ if ($[31] !== T1 || $[32] !== t11 || $[33] !== t2 || $[34] !== t7) {
446
+ t12 = /* @__PURE__ */ jsxs(T1, {
447
+ align: t2,
448
+ children: [t7, t11]
449
+ });
450
+ $[31] = T1;
451
+ $[32] = t11;
452
+ $[33] = t2;
453
+ $[34] = t7;
454
+ $[35] = t12;
455
+ } else t12 = $[35];
456
+ return t12;
457
+ }
458
+ 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 { ParetoChart, paretoCutoff, paretoRows } from \"@stealthscale/component-charts\";\n\nconst REASONS = [\n { reason: \"Export\", tickets: 98 },\n { reason: \"Login\", tickets: 412 },\n { reason: \"Search\", tickets: 51 },\n { reason: \"Billing\", tickets: 356 },\n { reason: \"Mobile\", tickets: 37 },\n { reason: \"Invites\", tickets: 64 },\n { reason: \"Reports\", tickets: 22 },\n { reason: \"Webhooks\", tickets: 43 },\n { reason: \"Other\", tickets: 17 },\n];\n\nexport function Replay(): ReactElement {\n const { t } = useWords(\"pareto-chart\");\n const [run, setRun] = useState(0);\n const cutoff = paretoCutoff(paretoRows(REASONS, \"tickets\"));\n\n return (\n <Stack align=\"flex-start\">\n <ParetoChart\n animate\n caption={t(\"tickets.caption\", { count: cutoff, total: REASONS.length })}\n categoryKey=\"reason\"\n cumulativeLabel={t(\"cumulative\")}\n data={REASONS}\n key={run}\n label={t(\"tickets.label\")}\n legendLabel={t(\"series\")}\n valueKey=\"tickets\"\n valueLabel={t(\"tickets.tickets\")}\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";
459
+ //#endregion
460
+ //#region src/pareto-chart/examples/tickets.example.tsx
461
+ var tickets_example_exports = /* @__PURE__ */ __exportAll({
462
+ Tickets: () => Tickets,
463
+ source: () => source
464
+ });
465
+ const REASONS = [
466
+ {
467
+ reason: "Export",
468
+ tickets: 98
469
+ },
470
+ {
471
+ reason: "Login",
472
+ tickets: 412
473
+ },
474
+ {
475
+ reason: "Search",
476
+ tickets: 51
477
+ },
478
+ {
479
+ reason: "Billing",
480
+ tickets: 356
481
+ },
482
+ {
483
+ reason: "Mobile",
484
+ tickets: 37
485
+ },
486
+ {
487
+ reason: "Invites",
488
+ tickets: 64
489
+ },
490
+ {
491
+ reason: "Reports",
492
+ tickets: 22
493
+ },
494
+ {
495
+ reason: "Webhooks",
496
+ tickets: 43
497
+ },
498
+ {
499
+ reason: "Other",
500
+ tickets: 17
501
+ }
502
+ ];
503
+ function Tickets() {
504
+ const $ = c(18);
505
+ const { t } = useWords("pareto-chart");
506
+ let T0;
507
+ let t0;
508
+ if ($[0] !== t) {
509
+ const cutoff = paretoCutoff(paretoRows(REASONS, "tickets"));
510
+ T0 = ParetoChart;
511
+ t0 = t("tickets.caption", {
512
+ count: cutoff,
513
+ total: REASONS.length
514
+ });
515
+ $[0] = t;
516
+ $[1] = T0;
517
+ $[2] = t0;
518
+ } else {
519
+ T0 = $[1];
520
+ t0 = $[2];
521
+ }
522
+ let t1;
523
+ if ($[3] !== t) {
524
+ t1 = t("cumulative");
525
+ $[3] = t;
526
+ $[4] = t1;
527
+ } else t1 = $[4];
528
+ let t2;
529
+ if ($[5] !== t) {
530
+ t2 = t("tickets.label");
531
+ $[5] = t;
532
+ $[6] = t2;
533
+ } else t2 = $[6];
534
+ let t3;
535
+ if ($[7] !== t) {
536
+ t3 = t("series");
537
+ $[7] = t;
538
+ $[8] = t3;
539
+ } else t3 = $[8];
540
+ let t4;
541
+ if ($[9] !== t) {
542
+ t4 = t("tickets.tickets");
543
+ $[9] = t;
544
+ $[10] = t4;
545
+ } else t4 = $[10];
546
+ let t5;
547
+ if ($[11] !== T0 || $[12] !== t0 || $[13] !== t1 || $[14] !== t2 || $[15] !== t3 || $[16] !== t4) {
548
+ t5 = /* @__PURE__ */ jsx(T0, {
549
+ caption: t0,
550
+ categoryKey: "reason",
551
+ cumulativeLabel: t1,
552
+ data: REASONS,
553
+ label: t2,
554
+ legendLabel: t3,
555
+ valueKey: "tickets",
556
+ valueLabel: t4
557
+ });
558
+ $[11] = T0;
559
+ $[12] = t0;
560
+ $[13] = t1;
561
+ $[14] = t2;
562
+ $[15] = t3;
563
+ $[16] = t4;
564
+ $[17] = t5;
565
+ } else t5 = $[17];
566
+ return t5;
567
+ }
568
+ const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ParetoChart, paretoCutoff, paretoRows } from \"@stealthscale/component-charts\";\n\nconst REASONS = [\n { reason: \"Export\", tickets: 98 },\n { reason: \"Login\", tickets: 412 },\n { reason: \"Search\", tickets: 51 },\n { reason: \"Billing\", tickets: 356 },\n { reason: \"Mobile\", tickets: 37 },\n { reason: \"Invites\", tickets: 64 },\n { reason: \"Reports\", tickets: 22 },\n { reason: \"Webhooks\", tickets: 43 },\n { reason: \"Other\", tickets: 17 },\n];\n\nexport function Tickets(): ReactElement {\n const { t } = useWords(\"pareto-chart\");\n const cutoff = paretoCutoff(paretoRows(REASONS, \"tickets\"));\n\n return (\n <ParetoChart\n caption={t(\"tickets.caption\", { count: cutoff, total: REASONS.length })}\n categoryKey=\"reason\"\n cumulativeLabel={t(\"cumulative\")}\n data={REASONS}\n label={t(\"tickets.label\")}\n legendLabel={t(\"series\")}\n valueKey=\"tickets\"\n valueLabel={t(\"tickets.tickets\")}\n />\n );\n}\n";
569
+ //#endregion
570
+ //#region src/pareto-chart/pareto-chart.specimen.tsx
571
+ /**
572
+ * Catalogue page for the Pareto chart.
573
+ *
574
+ * @remarks
575
+ * The Pareto chart has no recipe of its own: the chart's recipe styles its figure, so every scene
576
+ * is hand-written. The scenes render support tickets per reason, defects per cause at a 90%
577
+ * threshold, the tooltip open at the second reason, the marks animated in with a replay, the
578
+ * tickets at a phone's width, and a range without rows. Every scene renders a component from
579
+ * `examples/` and shows that file as its source. The words are keys under `pareto-chart` in
580
+ * `locales/en/specimen/pareto-chart.json`.
581
+ */
582
+ /**
583
+ * Hand-written scene for categories sorted by size with their running share.
584
+ */
585
+ const sorted = {
586
+ about: "pareto-chart.tickets.about",
587
+ draw: () => /* @__PURE__ */ jsx(Room, {
588
+ size: "lg",
589
+ children: /* @__PURE__ */ jsx(Tickets, {})
590
+ }),
591
+ example: tickets_example_exports,
592
+ title: "pareto-chart.tickets.title"
593
+ };
594
+ /**
595
+ * Hand-written scene for a stated threshold with its label.
596
+ */
597
+ const threshold = {
598
+ about: "pareto-chart.defects.about",
599
+ draw: () => /* @__PURE__ */ jsx(Room, {
600
+ size: "lg",
601
+ children: /* @__PURE__ */ jsx(Defects, {})
602
+ }),
603
+ example: defects_example_exports,
604
+ title: "pareto-chart.defects.title"
605
+ };
606
+ /**
607
+ * Hand-written scene for the tooltip open at a row.
608
+ */
609
+ const tooltip = {
610
+ about: "pareto-chart.largest.about",
611
+ draw: () => /* @__PURE__ */ jsx(Room, {
612
+ size: "lg",
613
+ children: /* @__PURE__ */ jsx(Largest, {})
614
+ }),
615
+ example: largest_example_exports,
616
+ title: "pareto-chart.largest.title"
617
+ };
618
+ /**
619
+ * Hand-written scene for the marks animated in, with a replay.
620
+ */
621
+ const animated = {
622
+ about: "pareto-chart.replay.about",
623
+ draw: () => /* @__PURE__ */ jsx(Room, {
624
+ size: "lg",
625
+ children: /* @__PURE__ */ jsx(Replay, {})
626
+ }),
627
+ example: replay_example_exports,
628
+ title: "pareto-chart.replay.title"
629
+ };
630
+ /**
631
+ * Hand-written scene for the tickets at a phone's width.
632
+ */
633
+ const narrow = {
634
+ about: "pareto-chart.narrow.about",
635
+ draw: () => /* @__PURE__ */ jsx(Room, {
636
+ size: "xs",
637
+ children: /* @__PURE__ */ jsx(Tickets, {})
638
+ }),
639
+ example: tickets_example_exports,
640
+ title: "pareto-chart.narrow.title"
641
+ };
642
+ /**
643
+ * Hand-written scene for a range without rows.
644
+ */
645
+ const empty = {
646
+ about: "pareto-chart.quiet.about",
647
+ draw: () => /* @__PURE__ */ jsx(Room, {
648
+ size: "md",
649
+ children: /* @__PURE__ */ jsx(Quiet, {})
650
+ }),
651
+ example: quiet_example_exports,
652
+ title: "pareto-chart.quiet.title"
653
+ };
654
+ var pareto_chart_specimen_default = specimen({
655
+ about: "pareto-chart.about",
656
+ id: "components/charts/pareto-chart",
657
+ imports: "import { ParetoChart } from \"@stealthscale/component-charts\";",
658
+ scenes: [
659
+ sorted,
660
+ threshold,
661
+ tooltip,
662
+ animated,
663
+ narrow,
664
+ empty
665
+ ],
666
+ title: "pareto-chart.title"
667
+ });
668
+ //#endregion
669
+ export { animated, pareto_chart_specimen_default as default, empty, narrow, sorted, threshold, tooltip };
@@ -0,0 +1,3 @@
1
+ export const dropped = {"ParetoChartProps": {"conditions": 284, "foreign": 1039}};
2
+ export const parts = {"ParetoChartProps": [{"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": "ReactNode", "fallback": "", "kind": "option", "name": "cumulativeLabel", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Name of the running share's line in the legend and the tooltip."}, {"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": "number", "fallback": "", "kind": "option", "name": "threshold", "refers": [], "required": false, "says": "Share of the total the dashed line marks, from 0 to 1. 0 renders no line."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "thresholdLabel", "refers": [], "required": false, "says": "Words written on the threshold's line, such as \"80% of tickets\". None unless stated."}, {"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": "Extract<keyof Row, string>", "fallback": "", "kind": "option", "name": "valueKey", "refers": [], "required": true, "says": "Field of each row the bars read."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "valueLabel", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Name of the bars in the legend and the tooltip. The field's name 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 = {"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.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": ""}], "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": ""}]};