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