@mechane-ai/elements 0.42.0 → 0.44.0
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/README.md +32 -32
- package/dist/ai.js +1 -1
- package/dist/catalog.json +89 -1
- package/dist/{categorical-values-B6lGI7BH.js → categorical-values-ByvFLaNE.js} +3 -3
- package/dist/{chart-frame-D0enjyj9.js → chart-frame-Bcd9Tpt5.js} +75 -23
- package/dist/{chart-input-D4_Awave.js → chart-input-B6_HXFDP.js} +2 -2
- package/dist/{chart-navigation-D4-pdgpj.js → chart-navigation-BAbb5PV9.js} +56 -32
- package/dist/charts/cartesian.js +1701 -551
- package/dist/charts/distribution.js +41 -28
- package/dist/charts/graph.js +443 -76
- package/dist/charts/hierarchy.js +5 -5
- package/dist/charts/matrix.js +232 -63
- package/dist/charts/timeline.js +2 -2
- package/dist/charts.js +2 -2
- package/dist/collections.js +2 -2
- package/dist/{constants.stylex-BILvnwUk.js → constants.stylex-CaVa9yGN.js} +9 -9
- package/dist/content/tree.js +1 -1
- package/dist/feedback.js +1 -1
- package/dist/label-spacing-BncjePGb.js +6 -0
- package/dist/packages/charts/src/cartesian/bar-chart.d.ts +15 -3
- package/dist/packages/charts/src/cartesian/bar-data.d.ts +43 -0
- package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +32 -0
- package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +29 -0
- package/dist/packages/charts/src/cartesian/bridge-data.d.ts +40 -0
- package/dist/packages/charts/src/cartesian/index.d.ts +7 -2
- package/dist/packages/charts/src/cartesian/reference-lines.d.ts +34 -0
- package/dist/packages/charts/src/cartesian/sparkline.d.ts +10 -1
- package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +66 -0
- package/dist/packages/charts/src/cartesian/time-series-data.d.ts +11 -1
- package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +35 -0
- package/dist/packages/charts/src/cartesian/time-series.d.ts +6 -1
- package/dist/packages/charts/src/chart-inspection.d.ts +3 -1
- package/dist/packages/charts/src/chart-navigation.d.ts +3 -1
- package/dist/packages/charts/src/chart-series-marker.d.ts +8 -1
- package/dist/packages/charts/src/chart-surface.d.ts +2 -0
- package/dist/packages/charts/src/chart-theme.d.ts +29 -2
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +3 -1
- package/dist/packages/charts/src/graph/flow-diagram.d.ts +26 -0
- package/dist/packages/charts/src/graph/flow-layout.d.ts +70 -0
- package/dist/packages/charts/src/graph/index.d.ts +2 -0
- package/dist/packages/charts/src/index.d.ts +1 -1
- package/dist/packages/charts/src/label-spacing.d.ts +15 -0
- package/dist/packages/charts/src/matrix/matrix-cells.d.ts +4 -0
- package/dist/packages/charts/src/matrix/matrix-strip.d.ts +20 -0
- package/dist/packages/charts/src/matrix/matrix-types.d.ts +21 -0
- package/dist/packages/charts/src/matrix/matrix.d.ts +8 -19
- package/dist/{plot-width-BQQS-mw9.js → plot-width-8cXdAjoD.js} +31 -2
- package/dist/{src-BpvnBWrF.js → src-CDp1JtwC.js} +1 -1
- package/dist/styles2.css +141 -18
- package/dist/tokens.js +1 -1
- package/package.json +1 -1
- package/packages/foundations/src/constants.stylex.ts +9 -9
- package/packages/foundations/src/tokens.stylex.ts +9 -9
- package/recipes/allocation-report.tsx +115 -0
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ChartReport, ChartSelection } from '../chart-frame.tsx';
|
|
3
3
|
import type { HeatmapScale } from './heatmap-scale.ts';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly label: string;
|
|
7
|
-
};
|
|
8
|
-
export type MatrixCell = {
|
|
9
|
-
readonly id: string;
|
|
10
|
-
readonly rowId: string;
|
|
11
|
-
readonly columnId: string;
|
|
12
|
-
} & ({
|
|
13
|
-
readonly kind: 'value';
|
|
14
|
-
readonly value: number;
|
|
15
|
-
} | {
|
|
16
|
-
readonly kind: 'masked';
|
|
17
|
-
readonly reason: string;
|
|
18
|
-
} | {
|
|
19
|
-
readonly kind: 'missing';
|
|
20
|
-
readonly reason: string;
|
|
21
|
-
});
|
|
4
|
+
import type { MatrixAxisItem, MatrixCell } from './matrix-types.ts';
|
|
5
|
+
export type { MatrixAxisItem, MatrixCell } from './matrix-types.ts';
|
|
22
6
|
export type MatrixProps = HeatmapScale & {
|
|
23
7
|
readonly title: string;
|
|
24
8
|
readonly report?: ChartReport | undefined;
|
|
@@ -30,6 +14,11 @@ export type MatrixProps = HeatmapScale & {
|
|
|
30
14
|
readonly formatValue: (value: number) => string;
|
|
31
15
|
readonly selection?: ChartSelection;
|
|
32
16
|
readonly emptyLabel: string;
|
|
17
|
+
/**
|
|
18
|
+
* The values variant draws square cells with short values for exact comparison. The strip variant draws compact
|
|
19
|
+
* intensity rows that fill the width, such as months across categories. Absent means values.
|
|
20
|
+
*/
|
|
21
|
+
readonly variant?: 'values' | 'strip' | undefined;
|
|
33
22
|
};
|
|
34
23
|
export declare const MAX_MATRIX_CELLS = 4096;
|
|
35
|
-
export declare function Matrix({ title, report, description, rows, columns, cells, domain, palette, valueLabel, formatValue, selection, emptyLabel, }: MatrixProps): ReactNode;
|
|
24
|
+
export declare function Matrix({ title, report, description, rows, columns, cells, domain, palette, valueLabel, formatValue, selection, emptyLabel, variant, }: MatrixProps): ReactNode;
|
|
@@ -22,7 +22,12 @@ var n = {
|
|
|
22
22
|
grid: {
|
|
23
23
|
kjVXCG: "x13hfdr1",
|
|
24
24
|
kfJifR: "xnpr05h",
|
|
25
|
-
|
|
25
|
+
kREpy8: "x13efnbd",
|
|
26
|
+
$$css: !0
|
|
27
|
+
},
|
|
28
|
+
baseline: {
|
|
29
|
+
kjVXCG: "x1crw9hw",
|
|
30
|
+
kfJifR: "xnpr05h",
|
|
26
31
|
kREpy8: "x13efnbd",
|
|
27
32
|
$$css: !0
|
|
28
33
|
},
|
|
@@ -34,8 +39,22 @@ var n = {
|
|
|
34
39
|
kcqcaj: "xss6m8b",
|
|
35
40
|
$$css: !0
|
|
36
41
|
},
|
|
42
|
+
strongLabel: {
|
|
43
|
+
kDwRjp: "xlrhuyr",
|
|
44
|
+
k63SB2: "xk4h15q",
|
|
45
|
+
$$css: !0
|
|
46
|
+
},
|
|
47
|
+
haloLabel: {
|
|
48
|
+
kCrYw0: "x1x0jnz8",
|
|
49
|
+
kjVXCG: "xaep1og",
|
|
50
|
+
kfJifR: "xqjr0vm",
|
|
51
|
+
kJdQPc: "x1f6yumg",
|
|
52
|
+
$$css: !0
|
|
53
|
+
},
|
|
37
54
|
mark: {
|
|
38
|
-
kfJifR: "
|
|
55
|
+
kfJifR: "xvlca1e",
|
|
56
|
+
kU5bRw: "x1owpc8m",
|
|
57
|
+
kJdQPc: "x1f6yumg",
|
|
39
58
|
kREpy8: "x13efnbd",
|
|
40
59
|
$$css: !0
|
|
41
60
|
},
|
|
@@ -48,6 +67,16 @@ var n = {
|
|
|
48
67
|
inspectable: {
|
|
49
68
|
k3XXqK: "x1t137rt",
|
|
50
69
|
$$css: !0
|
|
70
|
+
},
|
|
71
|
+
emphasis: {
|
|
72
|
+
k1ekBW: "x19991ni",
|
|
73
|
+
kIyJzY: "xtitasy x12w9bfk",
|
|
74
|
+
kAMwcw: "x1faw7qm",
|
|
75
|
+
$$css: !0
|
|
76
|
+
},
|
|
77
|
+
receded: {
|
|
78
|
+
kSiTet: "xk8c4ds",
|
|
79
|
+
$$css: !0
|
|
51
80
|
}
|
|
52
81
|
}, r = 640;
|
|
53
82
|
function i() {
|
|
@@ -2,7 +2,7 @@ import { i as e, s as t } from "./src-DcW_gMX8.js";
|
|
|
2
2
|
import { a as n, n as r, r as i, t as a } from "./control-styles-D3q_Qyxi.js";
|
|
3
3
|
import { i as o, n as s, r as c } from "./tokens.stylex-dF5CACEJ.js";
|
|
4
4
|
import { t as l } from "./accessibility-P89UG9-r.js";
|
|
5
|
-
import { c as u } from "./constants.stylex-
|
|
5
|
+
import { c as u } from "./constants.stylex-CaVa9yGN.js";
|
|
6
6
|
import * as d from "@stylexjs/stylex";
|
|
7
7
|
import { mergeProps as f } from "@ui-sdk/react/primitive";
|
|
8
8
|
import { createContext as p, useContext as m, useEffect as h, useRef as g, useState as _ } from "react";
|
package/dist/styles2.css
CHANGED
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
:root, .x102x4ow {
|
|
25
|
-
--x1nlt3ga: #
|
|
26
|
-
--x5yb4il: #
|
|
27
|
-
--x3s82iy: #
|
|
28
|
-
--x1t7wf97: #
|
|
29
|
-
--x13umt8e: #
|
|
30
|
-
--x1f0bn7f: #
|
|
31
|
-
--xiumgsg: #
|
|
32
|
-
--x1l35zjm: #
|
|
33
|
-
--x5dm89x: #
|
|
25
|
+
--x1nlt3ga: #1d4f91;
|
|
26
|
+
--x5yb4il: #3f76c3;
|
|
27
|
+
--x3s82iy: #9c6d1a;
|
|
28
|
+
--x1t7wf97: #5f8bc6;
|
|
29
|
+
--x13umt8e: #2d7a6e;
|
|
30
|
+
--x1f0bn7f: #6e7889;
|
|
31
|
+
--xiumgsg: #b13838;
|
|
32
|
+
--x1l35zjm: #1d4f91;
|
|
33
|
+
--x5dm89x: #e5e8ee;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
:root, .x181h4q1 {
|
|
@@ -188,15 +188,15 @@
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
.x8pee18.x8pee18, .x8pee18.x8pee18:root {
|
|
191
|
-
--x5dm89x: #
|
|
192
|
-
--xiumgsg: #
|
|
193
|
-
--x1l35zjm: #
|
|
194
|
-
--x1nlt3ga: #
|
|
195
|
-
--x5yb4il: #
|
|
196
|
-
--x3s82iy: #
|
|
197
|
-
--x1t7wf97: #
|
|
198
|
-
--x13umt8e: #
|
|
199
|
-
--x1f0bn7f: #
|
|
191
|
+
--x5dm89x: #2c313a;
|
|
192
|
+
--xiumgsg: #e47c80;
|
|
193
|
+
--x1l35zjm: #6ea2e8;
|
|
194
|
+
--x1nlt3ga: #6ea2e8;
|
|
195
|
+
--x5yb4il: #9bc0f0;
|
|
196
|
+
--x3s82iy: #dfa94b;
|
|
197
|
+
--x1t7wf97: #5885c4;
|
|
198
|
+
--x13umt8e: #63b5a7;
|
|
199
|
+
--x1f0bn7f: #949eb0;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
.xilj48j.xilj48j, .xilj48j.xilj48j:root {
|
|
@@ -1086,6 +1086,10 @@
|
|
|
1086
1086
|
column-gap: var(--x1qq5i99);
|
|
1087
1087
|
}
|
|
1088
1088
|
|
|
1089
|
+
.xuwhhnn {
|
|
1090
|
+
column-gap: var(--xjighox);
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1089
1093
|
.xa2sdi0 {
|
|
1090
1094
|
column-gap: var(--xxhyxt);
|
|
1091
1095
|
}
|
|
@@ -1182,6 +1186,10 @@
|
|
|
1182
1186
|
fill: none;
|
|
1183
1187
|
}
|
|
1184
1188
|
|
|
1189
|
+
.x19zyb68 {
|
|
1190
|
+
fill: var(--x-fill);
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1185
1193
|
.x1fytgo2 {
|
|
1186
1194
|
fill: var(--x13kja51);
|
|
1187
1195
|
}
|
|
@@ -1198,6 +1206,10 @@
|
|
|
1198
1206
|
fill: var(--x24btp3);
|
|
1199
1207
|
}
|
|
1200
1208
|
|
|
1209
|
+
.x1y22c7u {
|
|
1210
|
+
fill: var(--x5dm89x);
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1201
1213
|
.x2wnxhi {
|
|
1202
1214
|
fill: var(--x7wqmh8);
|
|
1203
1215
|
}
|
|
@@ -1210,6 +1222,18 @@
|
|
|
1210
1222
|
fill-opacity: .08;
|
|
1211
1223
|
}
|
|
1212
1224
|
|
|
1225
|
+
.xd6etog {
|
|
1226
|
+
fill-opacity: .16;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
.x14kjgpu {
|
|
1230
|
+
fill-opacity: .34;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
.xif5ylx {
|
|
1234
|
+
fill-opacity: .62;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1213
1237
|
.x1l7klhg {
|
|
1214
1238
|
flex-basis: 100%;
|
|
1215
1239
|
}
|
|
@@ -1374,6 +1398,10 @@
|
|
|
1374
1398
|
grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
|
|
1375
1399
|
}
|
|
1376
1400
|
|
|
1401
|
+
.xqketvx {
|
|
1402
|
+
grid-template-columns: var(--x-gridTemplateColumns);
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1377
1405
|
.x1eqwfih {
|
|
1378
1406
|
grid-template-columns: var(--x1ud0cvw) minmax(0,1fr);
|
|
1379
1407
|
}
|
|
@@ -1422,6 +1450,10 @@
|
|
|
1422
1450
|
letter-spacing: var(--xgto76l);
|
|
1423
1451
|
}
|
|
1424
1452
|
|
|
1453
|
+
.xo5v014 {
|
|
1454
|
+
line-height: 1;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1425
1457
|
.xasj1m4 {
|
|
1426
1458
|
line-height: calc(var(--x14tmdi9) - 2px);
|
|
1427
1459
|
}
|
|
@@ -1490,10 +1522,18 @@
|
|
|
1490
1522
|
object-fit: cover;
|
|
1491
1523
|
}
|
|
1492
1524
|
|
|
1525
|
+
.xz5rk10 {
|
|
1526
|
+
opacity: .2;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1493
1529
|
.xuzhngd {
|
|
1494
1530
|
opacity: .3;
|
|
1495
1531
|
}
|
|
1496
1532
|
|
|
1533
|
+
.xk8c4ds {
|
|
1534
|
+
opacity: .32;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1497
1537
|
.x1hc1fzr {
|
|
1498
1538
|
opacity: 1;
|
|
1499
1539
|
}
|
|
@@ -1610,6 +1650,10 @@
|
|
|
1610
1650
|
padding-inline-start: var(--xxhyxt);
|
|
1611
1651
|
}
|
|
1612
1652
|
|
|
1653
|
+
.x1x0jnz8 {
|
|
1654
|
+
paint-order: stroke;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1613
1657
|
.x67bb7w {
|
|
1614
1658
|
pointer-events: auto;
|
|
1615
1659
|
}
|
|
@@ -1654,6 +1698,10 @@
|
|
|
1654
1698
|
row-gap: var(--x1xijsos);
|
|
1655
1699
|
}
|
|
1656
1700
|
|
|
1701
|
+
.x1hm1d26 {
|
|
1702
|
+
row-gap: var(--xjighox);
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1657
1705
|
.xpb3s3w {
|
|
1658
1706
|
row-gap: var(--xxhyxt);
|
|
1659
1707
|
}
|
|
@@ -1670,6 +1718,10 @@
|
|
|
1670
1718
|
stroke: currentColor;
|
|
1671
1719
|
}
|
|
1672
1720
|
|
|
1721
|
+
.x6mkzkt {
|
|
1722
|
+
stroke: var(--x-stroke);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1673
1725
|
.xaep1og {
|
|
1674
1726
|
stroke: var(--x13kja51);
|
|
1675
1727
|
}
|
|
@@ -1694,6 +1746,18 @@
|
|
|
1694
1746
|
stroke: var(--xzqn2nu);
|
|
1695
1747
|
}
|
|
1696
1748
|
|
|
1749
|
+
.xbw2l0c {
|
|
1750
|
+
stroke-dasharray: 2 2;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
.x1bpwu3k {
|
|
1754
|
+
stroke-dasharray: 2 3;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
.x1ypbokr {
|
|
1758
|
+
stroke-dasharray: 3 2;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1697
1761
|
.x1ntoi03 {
|
|
1698
1762
|
stroke-dasharray: 3 3;
|
|
1699
1763
|
}
|
|
@@ -1702,6 +1766,30 @@
|
|
|
1702
1766
|
stroke-dasharray: 4 3;
|
|
1703
1767
|
}
|
|
1704
1768
|
|
|
1769
|
+
.x1dz65qj {
|
|
1770
|
+
stroke-dasharray: 5 4;
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
.x5lxx2x {
|
|
1774
|
+
stroke-linecap: butt;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
.x1owpc8m {
|
|
1778
|
+
stroke-linecap: round;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
.x1f6yumg {
|
|
1782
|
+
stroke-linejoin: round;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
.x1bsw5e1 {
|
|
1786
|
+
stroke-opacity: .45;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
.x1r6sdyr {
|
|
1790
|
+
stroke-width: 1.25px;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1705
1793
|
.xhr4kjn {
|
|
1706
1794
|
stroke-width: 1.5px;
|
|
1707
1795
|
}
|
|
@@ -1714,6 +1802,10 @@
|
|
|
1714
1802
|
stroke-width: 2px;
|
|
1715
1803
|
}
|
|
1716
1804
|
|
|
1805
|
+
.xqjr0vm {
|
|
1806
|
+
stroke-width: 3px;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1717
1809
|
.xzly4p3 {
|
|
1718
1810
|
stroke-width: var(--xxx3t85);
|
|
1719
1811
|
}
|
|
@@ -1758,6 +1850,10 @@
|
|
|
1758
1850
|
text-decoration-line: underline;
|
|
1759
1851
|
}
|
|
1760
1852
|
|
|
1853
|
+
.xbrixnn {
|
|
1854
|
+
text-overflow: clip;
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1761
1857
|
.xlyipyv {
|
|
1762
1858
|
text-overflow: ellipsis;
|
|
1763
1859
|
}
|
|
@@ -2414,6 +2510,10 @@
|
|
|
2414
2510
|
height: 20px;
|
|
2415
2511
|
}
|
|
2416
2512
|
|
|
2513
|
+
.x17rw0jw {
|
|
2514
|
+
height: 22px;
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2417
2517
|
.xxk0z11 {
|
|
2418
2518
|
height: 24px;
|
|
2419
2519
|
}
|
|
@@ -3415,6 +3515,10 @@
|
|
|
3415
3515
|
color: var(--x169lqhw);
|
|
3416
3516
|
}
|
|
3417
3517
|
|
|
3518
|
+
.xqd9x96.xqd9x96:hover {
|
|
3519
|
+
outline-color: var(--x169lqhw);
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3418
3522
|
.x5638nf.x5638nf:hover {
|
|
3419
3523
|
text-decoration-line: underline;
|
|
3420
3524
|
}
|
|
@@ -3477,6 +3581,10 @@
|
|
|
3477
3581
|
}
|
|
3478
3582
|
|
|
3479
3583
|
@media (pointer: coarse) {
|
|
3584
|
+
.x1ilzfib.x1ilzfib {
|
|
3585
|
+
height: 32px;
|
|
3586
|
+
}
|
|
3587
|
+
|
|
3480
3588
|
.x992rv9.x992rv9 {
|
|
3481
3589
|
height: var(--x6uufy4);
|
|
3482
3590
|
}
|
|
@@ -3916,6 +4024,16 @@
|
|
|
3916
4024
|
inherits: false
|
|
3917
4025
|
}
|
|
3918
4026
|
|
|
4027
|
+
@property --x-fill {
|
|
4028
|
+
syntax: "*";
|
|
4029
|
+
inherits: false
|
|
4030
|
+
}
|
|
4031
|
+
|
|
4032
|
+
@property --x-gridTemplateColumns {
|
|
4033
|
+
syntax: "*";
|
|
4034
|
+
inherits: false
|
|
4035
|
+
}
|
|
4036
|
+
|
|
3919
4037
|
@property --x-height {
|
|
3920
4038
|
syntax: "*";
|
|
3921
4039
|
inherits: false
|
|
@@ -3946,6 +4064,11 @@
|
|
|
3946
4064
|
inherits: false
|
|
3947
4065
|
}
|
|
3948
4066
|
|
|
4067
|
+
@property --x-stroke {
|
|
4068
|
+
syntax: "*";
|
|
4069
|
+
inherits: false
|
|
4070
|
+
}
|
|
4071
|
+
|
|
3949
4072
|
@property --x-top {
|
|
3950
4073
|
syntax: "*";
|
|
3951
4074
|
inherits: false
|
package/dist/tokens.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./constants.stylex-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./constants.stylex-CaVa9yGN.js";
|
|
2
2
|
import { a as l, c as u, d, f, i as p, l as m, n as h, o as g, r as _, s as v, t as y, u as b } from "./tokens.stylex-dF5CACEJ.js";
|
|
3
3
|
export { y as avatarColors, h as chartColors, _ as colors, c as conditions, p as controls, i as darkAvatarColors, o as darkChartColors, n as darkColors, e as darkShadows, a as darkSyntaxColors, s as layers, t as loading, l as motion, g as pageGeometry, v as radii, u as reportGeometry, m as shadows, b as spacing, d as syntaxColors, r as tableGeometry, f as typography };
|
package/package.json
CHANGED
|
@@ -21,15 +21,15 @@ export const darkColors = stylex.defineConsts({
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
export const darkChartColors = stylex.defineConsts({
|
|
24
|
-
series1: '#
|
|
25
|
-
series2: '#
|
|
26
|
-
series3: '#
|
|
27
|
-
series4: '#
|
|
28
|
-
series5: '#
|
|
29
|
-
series6: '#
|
|
30
|
-
negative: '#
|
|
31
|
-
positive: '#
|
|
32
|
-
missing: '#
|
|
24
|
+
series1: '#6ea2e8',
|
|
25
|
+
series2: '#9bc0f0',
|
|
26
|
+
series3: '#dfa94b',
|
|
27
|
+
series4: '#5885c4',
|
|
28
|
+
series5: '#63b5a7',
|
|
29
|
+
series6: '#949eb0',
|
|
30
|
+
negative: '#e47c80',
|
|
31
|
+
positive: '#6ea2e8',
|
|
32
|
+
missing: '#2c313a',
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
export const darkAvatarColors = stylex.defineConsts({
|
|
@@ -21,15 +21,15 @@ export const colors = stylex.defineVars({
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
export const chartColors = stylex.defineVars({
|
|
24
|
-
series1: '#
|
|
25
|
-
series2: '#
|
|
26
|
-
series3: '#
|
|
27
|
-
series4: '#
|
|
28
|
-
series5: '#
|
|
29
|
-
series6: '#
|
|
30
|
-
negative: '#
|
|
31
|
-
positive: '#
|
|
32
|
-
missing: '#
|
|
24
|
+
series1: '#1d4f91',
|
|
25
|
+
series2: '#3f76c3',
|
|
26
|
+
series3: '#9c6d1a',
|
|
27
|
+
series4: '#5f8bc6',
|
|
28
|
+
series5: '#2d7a6e',
|
|
29
|
+
series6: '#6e7889',
|
|
30
|
+
negative: '#b13838',
|
|
31
|
+
positive: '#1d4f91',
|
|
32
|
+
missing: '#e5e8ee',
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
export const avatarColors = stylex.defineVars({
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Stack, Text } from '@mechane-ai/elements';
|
|
2
|
+
import type { ChartTone } from '@mechane-ai/elements/charts';
|
|
3
|
+
import { BreakdownBar, BridgeChart } from '@mechane-ai/elements/charts/cartesian';
|
|
4
|
+
import type { BridgeStep, ChartReferenceLine } from '@mechane-ai/elements/charts/cartesian';
|
|
5
|
+
import { FlowDiagram } from '@mechane-ai/elements/charts/graph';
|
|
6
|
+
import type { FlowLink, FlowNode } from '@mechane-ai/elements/charts/graph';
|
|
7
|
+
import { PageContent, PageLayout } from '@mechane-ai/elements/layout';
|
|
8
|
+
|
|
9
|
+
type AllocationPart = { readonly id: string; readonly label: string; readonly amount: number };
|
|
10
|
+
|
|
11
|
+
type Commitment = AllocationPart & { readonly tone: ChartTone; readonly parts?: ReadonlyArray<AllocationPart> };
|
|
12
|
+
|
|
13
|
+
type AllocationProps = {
|
|
14
|
+
readonly title: string;
|
|
15
|
+
readonly headline: string;
|
|
16
|
+
readonly totalLabel: string;
|
|
17
|
+
readonly total: number;
|
|
18
|
+
readonly commitments: ReadonlyArray<Commitment>;
|
|
19
|
+
readonly remainderLabel: string;
|
|
20
|
+
readonly target?: ChartReferenceLine;
|
|
21
|
+
readonly explanation: 'bridge' | 'flow';
|
|
22
|
+
readonly formatValue: (value: number) => string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const REMAINDER_ID = 'remainder';
|
|
26
|
+
const REMAINDER_TONE: ChartTone = 'series2';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Explain how one total divides among commitments and what remains, with the parts strip above one explanatory chart.
|
|
30
|
+
* Use a BridgeChart for the path from total to remainder, or a FlowDiagram when commitments divide again. Give each
|
|
31
|
+
* commitment one tone everywhere; the application computes amounts and writes the report's one-sentence headline.
|
|
32
|
+
*/
|
|
33
|
+
export function AllocationReport({
|
|
34
|
+
title,
|
|
35
|
+
headline,
|
|
36
|
+
totalLabel,
|
|
37
|
+
total,
|
|
38
|
+
commitments,
|
|
39
|
+
remainderLabel,
|
|
40
|
+
target,
|
|
41
|
+
explanation,
|
|
42
|
+
formatValue,
|
|
43
|
+
}: AllocationProps) {
|
|
44
|
+
const remainder = total - commitments.reduce((sum, commitment) => sum + commitment.amount, 0);
|
|
45
|
+
const report = { summary: <Text>{headline}</Text> };
|
|
46
|
+
|
|
47
|
+
const steps: ReadonlyArray<BridgeStep> = [
|
|
48
|
+
{ id: 'total', label: totalLabel, kind: 'start', value: total, tone: 'series1' },
|
|
49
|
+
...commitments.map((commitment): BridgeStep => ({
|
|
50
|
+
id: commitment.id,
|
|
51
|
+
label: commitment.label,
|
|
52
|
+
kind: 'change',
|
|
53
|
+
value: -commitment.amount,
|
|
54
|
+
tone: commitment.tone,
|
|
55
|
+
})),
|
|
56
|
+
{ id: REMAINDER_ID, label: remainderLabel, kind: 'total', tone: REMAINDER_TONE },
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
const nodes: ReadonlyArray<FlowNode> = [
|
|
60
|
+
{ id: 'total', label: totalLabel, tone: 'series1' },
|
|
61
|
+
...commitments.flatMap((commitment) => [
|
|
62
|
+
{ id: commitment.id, label: commitment.label, tone: commitment.tone },
|
|
63
|
+
...(commitment.parts ?? []).map((part) => ({ id: part.id, label: part.label, tone: commitment.tone })),
|
|
64
|
+
]),
|
|
65
|
+
{ id: REMAINDER_ID, label: remainderLabel, tone: REMAINDER_TONE },
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
const links: ReadonlyArray<FlowLink> = [
|
|
69
|
+
...commitments.flatMap((commitment) => [
|
|
70
|
+
{ id: `total-${commitment.id}`, sourceId: 'total', targetId: commitment.id, value: commitment.amount },
|
|
71
|
+
...(commitment.parts ?? []).map((part) => ({
|
|
72
|
+
id: `${commitment.id}-${part.id}`,
|
|
73
|
+
sourceId: commitment.id,
|
|
74
|
+
targetId: part.id,
|
|
75
|
+
value: part.amount,
|
|
76
|
+
})),
|
|
77
|
+
]),
|
|
78
|
+
{ id: `total-${REMAINDER_ID}`, sourceId: 'total', targetId: REMAINDER_ID, value: remainder },
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<PageLayout title={title} showNavigation={false}>
|
|
83
|
+
<PageContent>
|
|
84
|
+
<Stack>
|
|
85
|
+
<BreakdownBar
|
|
86
|
+
title={`${totalLabel}: ${formatValue(total)}`}
|
|
87
|
+
items={[
|
|
88
|
+
...commitments.map(({ id, label, amount, tone }) => ({ id, label, value: amount, tone })),
|
|
89
|
+
{ id: REMAINDER_ID, label: remainderLabel, value: remainder, tone: REMAINDER_TONE },
|
|
90
|
+
]}
|
|
91
|
+
total={total}
|
|
92
|
+
formatValue={formatValue}
|
|
93
|
+
/>
|
|
94
|
+
{explanation === 'bridge' ? (
|
|
95
|
+
<BridgeChart
|
|
96
|
+
title={`From ${totalLabel.toLowerCase()} to ${remainderLabel.toLowerCase()}`}
|
|
97
|
+
report={report}
|
|
98
|
+
steps={steps}
|
|
99
|
+
formatValue={formatValue}
|
|
100
|
+
referenceLines={target === undefined ? [] : [target]}
|
|
101
|
+
/>
|
|
102
|
+
) : (
|
|
103
|
+
<FlowDiagram
|
|
104
|
+
title={`Where ${totalLabel.toLowerCase()} goes`}
|
|
105
|
+
report={report}
|
|
106
|
+
nodes={nodes}
|
|
107
|
+
links={links}
|
|
108
|
+
formatValue={formatValue}
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
111
|
+
</Stack>
|
|
112
|
+
</PageContent>
|
|
113
|
+
</PageLayout>
|
|
114
|
+
);
|
|
115
|
+
}
|