@arcfusionz/arc-analytic-ui 0.0.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/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/AnomalyCard/AnomalyCard.chart.d.ts +64 -0
- package/dist/components/AnomalyCard/AnomalyCard.chart.js +341 -0
- package/dist/components/AnomalyCard/AnomalyCard.d.ts +169 -0
- package/dist/components/AnomalyCard/AnomalyCard.js +1019 -0
- package/dist/components/AnomalyCard/AnomalyCard.model.d.ts +508 -0
- package/dist/components/AnomalyCard/AnomalyCard.model.js +553 -0
- package/dist/components/AnomalyCard/index.d.ts +4 -0
- package/dist/components/AnomalyCard/index.js +4 -0
- package/dist/components/ChartCard/ChartCard.chart.d.ts +72 -0
- package/dist/components/ChartCard/ChartCard.chart.js +1333 -0
- package/dist/components/ChartCard/ChartCard.d.ts +206 -0
- package/dist/components/ChartCard/ChartCard.js +718 -0
- package/dist/components/ChartCard/ChartCard.model.d.ts +452 -0
- package/dist/components/ChartCard/ChartCard.model.js +1223 -0
- package/dist/components/ChartCard/index.d.ts +4 -0
- package/dist/components/ChartCard/index.js +4 -0
- package/dist/components/ComparisonCard/ComparisonCard.chart.d.ts +80 -0
- package/dist/components/ComparisonCard/ComparisonCard.chart.js +337 -0
- package/dist/components/ComparisonCard/ComparisonCard.d.ts +200 -0
- package/dist/components/ComparisonCard/ComparisonCard.js +1325 -0
- package/dist/components/ComparisonCard/ComparisonCard.model.d.ts +309 -0
- package/dist/components/ComparisonCard/ComparisonCard.model.js +263 -0
- package/dist/components/ComparisonCard/index.d.ts +4 -0
- package/dist/components/ComparisonCard/index.js +4 -0
- package/dist/components/ForecastCard/ForecastCard.chart.d.ts +82 -0
- package/dist/components/ForecastCard/ForecastCard.chart.js +416 -0
- package/dist/components/ForecastCard/ForecastCard.d.ts +148 -0
- package/dist/components/ForecastCard/ForecastCard.js +1029 -0
- package/dist/components/ForecastCard/ForecastCard.model.d.ts +497 -0
- package/dist/components/ForecastCard/ForecastCard.model.js +554 -0
- package/dist/components/ForecastCard/index.d.ts +4 -0
- package/dist/components/ForecastCard/index.js +4 -0
- package/dist/components/HighlightCard/HighlightCard.chart.d.ts +122 -0
- package/dist/components/HighlightCard/HighlightCard.chart.js +660 -0
- package/dist/components/HighlightCard/HighlightCard.d.ts +202 -0
- package/dist/components/HighlightCard/HighlightCard.js +1286 -0
- package/dist/components/HighlightCard/HighlightCard.model.d.ts +692 -0
- package/dist/components/HighlightCard/HighlightCard.model.js +875 -0
- package/dist/components/HighlightCard/index.d.ts +4 -0
- package/dist/components/HighlightCard/index.js +4 -0
- package/dist/components/InsightCard/InsightCard.chart.d.ts +91 -0
- package/dist/components/InsightCard/InsightCard.chart.js +471 -0
- package/dist/components/InsightCard/InsightCard.d.ts +161 -0
- package/dist/components/InsightCard/InsightCard.js +961 -0
- package/dist/components/InsightCard/InsightCard.model.d.ts +405 -0
- package/dist/components/InsightCard/InsightCard.model.js +421 -0
- package/dist/components/InsightCard/index.d.ts +4 -0
- package/dist/components/InsightCard/index.js +4 -0
- package/dist/components/MetricCard/MetricCard.chart.d.ts +79 -0
- package/dist/components/MetricCard/MetricCard.chart.js +435 -0
- package/dist/components/MetricCard/MetricCard.d.ts +227 -0
- package/dist/components/MetricCard/MetricCard.js +1293 -0
- package/dist/components/MetricCard/MetricCard.model.d.ts +521 -0
- package/dist/components/MetricCard/MetricCard.model.js +627 -0
- package/dist/components/MetricCard/index.d.ts +4 -0
- package/dist/components/MetricCard/index.js +4 -0
- package/dist/components/ProfileCard/ProfileCard.chart.d.ts +64 -0
- package/dist/components/ProfileCard/ProfileCard.chart.js +427 -0
- package/dist/components/ProfileCard/ProfileCard.d.ts +140 -0
- package/dist/components/ProfileCard/ProfileCard.js +735 -0
- package/dist/components/ProfileCard/ProfileCard.model.d.ts +279 -0
- package/dist/components/ProfileCard/ProfileCard.model.js +244 -0
- package/dist/components/ProfileCard/index.d.ts +4 -0
- package/dist/components/ProfileCard/index.js +4 -0
- package/dist/components/ProgressCard/ProgressCard.chart.d.ts +73 -0
- package/dist/components/ProgressCard/ProgressCard.chart.js +373 -0
- package/dist/components/ProgressCard/ProgressCard.d.ts +137 -0
- package/dist/components/ProgressCard/ProgressCard.js +908 -0
- package/dist/components/ProgressCard/ProgressCard.model.d.ts +385 -0
- package/dist/components/ProgressCard/ProgressCard.model.js +389 -0
- package/dist/components/ProgressCard/index.d.ts +4 -0
- package/dist/components/ProgressCard/index.js +4 -0
- package/dist/components/ReportCard/ReportCard.chart.d.ts +45 -0
- package/dist/components/ReportCard/ReportCard.chart.js +231 -0
- package/dist/components/ReportCard/ReportCard.d.ts +153 -0
- package/dist/components/ReportCard/ReportCard.js +1118 -0
- package/dist/components/ReportCard/ReportCard.model.d.ts +392 -0
- package/dist/components/ReportCard/ReportCard.model.js +399 -0
- package/dist/components/ReportCard/index.d.ts +4 -0
- package/dist/components/ReportCard/index.js +4 -0
- package/dist/components/SankeyCard/SankeyCard.chart.d.ts +75 -0
- package/dist/components/SankeyCard/SankeyCard.chart.js +249 -0
- package/dist/components/SankeyCard/SankeyCard.d.ts +185 -0
- package/dist/components/SankeyCard/SankeyCard.js +788 -0
- package/dist/components/SankeyCard/SankeyCard.model.d.ts +501 -0
- package/dist/components/SankeyCard/SankeyCard.model.js +789 -0
- package/dist/components/SankeyCard/index.d.ts +4 -0
- package/dist/components/SankeyCard/index.js +4 -0
- package/dist/components/StatusCard/StatusCard.chart.d.ts +60 -0
- package/dist/components/StatusCard/StatusCard.chart.js +188 -0
- package/dist/components/StatusCard/StatusCard.d.ts +176 -0
- package/dist/components/StatusCard/StatusCard.js +989 -0
- package/dist/components/StatusCard/StatusCard.model.d.ts +555 -0
- package/dist/components/StatusCard/StatusCard.model.js +776 -0
- package/dist/components/StatusCard/index.d.ts +4 -0
- package/dist/components/StatusCard/index.js +4 -0
- package/dist/components/TableCard/TableCard.chart.d.ts +53 -0
- package/dist/components/TableCard/TableCard.chart.js +192 -0
- package/dist/components/TableCard/TableCard.d.ts +140 -0
- package/dist/components/TableCard/TableCard.js +811 -0
- package/dist/components/TableCard/TableCard.model.d.ts +381 -0
- package/dist/components/TableCard/TableCard.model.js +475 -0
- package/dist/components/TableCard/index.d.ts +4 -0
- package/dist/components/TableCard/index.js +4 -0
- package/dist/components/TargetCard/TargetCard.chart.d.ts +52 -0
- package/dist/components/TargetCard/TargetCard.chart.js +273 -0
- package/dist/components/TargetCard/TargetCard.d.ts +143 -0
- package/dist/components/TargetCard/TargetCard.js +910 -0
- package/dist/components/TargetCard/TargetCard.model.d.ts +468 -0
- package/dist/components/TargetCard/TargetCard.model.js +581 -0
- package/dist/components/TargetCard/index.d.ts +4 -0
- package/dist/components/TargetCard/index.js +4 -0
- package/dist/components/TreeCard/TreeCard.chart.d.ts +80 -0
- package/dist/components/TreeCard/TreeCard.chart.js +178 -0
- package/dist/components/TreeCard/TreeCard.d.ts +182 -0
- package/dist/components/TreeCard/TreeCard.js +1187 -0
- package/dist/components/TreeCard/TreeCard.model.d.ts +330 -0
- package/dist/components/TreeCard/TreeCard.model.js +401 -0
- package/dist/components/TreeCard/index.d.ts +4 -0
- package/dist/components/TreeCard/index.js +4 -0
- package/dist/components/TrendCard/TrendCard.chart.d.ts +75 -0
- package/dist/components/TrendCard/TrendCard.chart.js +393 -0
- package/dist/components/TrendCard/TrendCard.d.ts +224 -0
- package/dist/components/TrendCard/TrendCard.js +1053 -0
- package/dist/components/TrendCard/TrendCard.model.d.ts +545 -0
- package/dist/components/TrendCard/TrendCard.model.js +623 -0
- package/dist/components/TrendCard/index.d.ts +4 -0
- package/dist/components/TrendCard/index.js +4 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +57 -0
- package/dist/lib/vega/ArcVegaChart.d.ts +24 -0
- package/dist/lib/vega/ArcVegaChart.js +42 -0
- package/dist/lib/vega/ArcVegaSurface.d.ts +13 -0
- package/dist/lib/vega/ArcVegaSurface.js +38 -0
- package/dist/lib/vega/axisTicks.js +156 -0
- package/dist/lib/vega/config.d.ts +29 -0
- package/dist/lib/vega/config.js +113 -0
- package/dist/lib/vega/embed.d.ts +29 -0
- package/dist/lib/vega/embed.js +29 -0
- package/dist/lib/vega/engine.d.ts +10 -0
- package/dist/lib/vega/engine.js +6 -0
- package/dist/lib/vega/formatters.d.ts +125 -0
- package/dist/lib/vega/formatters.js +277 -0
- package/dist/lib/vega/index.d.ts +11 -0
- package/dist/lib/vega/load.d.ts +13 -0
- package/dist/lib/vega/load.js +21 -0
- package/dist/lib/vega/time.d.ts +45 -0
- package/dist/lib/vega/time.js +105 -0
- package/dist/lib/vega/tokens.d.ts +73 -0
- package/dist/lib/vega/tokens.js +137 -0
- package/dist/lib/vega/tooltip.d.ts +45 -0
- package/dist/lib/vega/tooltip.js +124 -0
- package/dist/lib/vega/useArcVega.d.ts +43 -0
- package/dist/lib/vega/useArcVega.js +121 -0
- package/package.json +60 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { arcVegaConfig } from "../../lib/vega/config.js";
|
|
2
|
+
//#region src/components/SankeyCard/SankeyCard.chart.ts
|
|
3
|
+
/** Sampled ribbon edges: `RIBBON_SAMPLES` rows per flow (`SankeyRibbonRow`). */
|
|
4
|
+
const SANKEY_RIBBONS_DATASET = "ribbons";
|
|
5
|
+
/** One row per node — the rect, the name and the value line (`SankeyNodeRow`). */
|
|
6
|
+
const SANKEY_NODES_DATASET = "nodes";
|
|
7
|
+
/** The pointed flow. */
|
|
8
|
+
const SANKEY_HOVER_PARAM = "hover";
|
|
9
|
+
/** The pointed node. */
|
|
10
|
+
const SANKEY_NODE_HOVER_PARAM = "nodeHover";
|
|
11
|
+
/**
|
|
12
|
+
* The reader's chosen node, driven from React with `view.signal`. A VARIABLE
|
|
13
|
+
* param, not a selection: consumer-owned state pushed into a selection would
|
|
14
|
+
* live in that selection's `_store` dataset and fight the reader's own
|
|
15
|
+
* pointer, which is the bridge's rule.
|
|
16
|
+
*/
|
|
17
|
+
const SANKEY_SELECTED_PARAM = "selectedNode";
|
|
18
|
+
const RIBBON_OPACITY = .7;
|
|
19
|
+
const RIBBON_HOVER_OPACITY = .92;
|
|
20
|
+
const RIBBON_MUTED_OPACITY = .16;
|
|
21
|
+
const NODE_OPACITY = 1;
|
|
22
|
+
const NODE_MUTED_OPACITY = .35;
|
|
23
|
+
const LABEL_OFFSET = 6;
|
|
24
|
+
/** True while a node is selected and this row does not touch it. */
|
|
25
|
+
const RIBBON_IN_PLAY = `${SANKEY_SELECTED_PARAM} == null || datum.s === ${SANKEY_SELECTED_PARAM} || datum.t === ${SANKEY_SELECTED_PARAM}`;
|
|
26
|
+
const NODE_IN_PLAY = `${SANKEY_SELECTED_PARAM} == null || datum.k === ${SANKEY_SELECTED_PARAM}`;
|
|
27
|
+
/**
|
|
28
|
+
* Builds the flow diagram: the ribbons, then the node rects over their ends,
|
|
29
|
+
* then the names.
|
|
30
|
+
*
|
|
31
|
+
* Colour rides the data (`c`, with `scale: null`) rather than a scale, so
|
|
32
|
+
* whichever job the card gave it — one emphasis hue, the declared polarity,
|
|
33
|
+
* or an identity slot per outcome — the spec stays structural and re-colouring
|
|
34
|
+
* is a data push that cannot repaint a survivor it did not mean to.
|
|
35
|
+
*/
|
|
36
|
+
function buildSankeyPlotSpec(options, tokens) {
|
|
37
|
+
const { height, nodeWidth, padLeft, padRight, padTop, padBottom, labelLimit, labels, labelEndsOutward, showValues, tooltip, selectable, valueFormat, fromTitle, toTitle, valueTitle, locale } = options;
|
|
38
|
+
const x = {
|
|
39
|
+
field: "x",
|
|
40
|
+
type: "quantitative",
|
|
41
|
+
scale: {
|
|
42
|
+
domain: [0, 1],
|
|
43
|
+
nice: false,
|
|
44
|
+
zero: false
|
|
45
|
+
},
|
|
46
|
+
axis: null,
|
|
47
|
+
title: null
|
|
48
|
+
};
|
|
49
|
+
const y = {
|
|
50
|
+
field: "y",
|
|
51
|
+
type: "quantitative",
|
|
52
|
+
scale: {
|
|
53
|
+
domain: [1, 0],
|
|
54
|
+
nice: false,
|
|
55
|
+
zero: false
|
|
56
|
+
},
|
|
57
|
+
axis: null,
|
|
58
|
+
title: null
|
|
59
|
+
};
|
|
60
|
+
const layers = [];
|
|
61
|
+
const ribbonOpacity = (() => {
|
|
62
|
+
const conditions = [];
|
|
63
|
+
if (tooltip) conditions.push({
|
|
64
|
+
param: SANKEY_HOVER_PARAM,
|
|
65
|
+
empty: false,
|
|
66
|
+
value: RIBBON_HOVER_OPACITY
|
|
67
|
+
});
|
|
68
|
+
if (selectable) conditions.push({
|
|
69
|
+
test: RIBBON_IN_PLAY,
|
|
70
|
+
value: RIBBON_OPACITY
|
|
71
|
+
});
|
|
72
|
+
if (conditions.length === 0) return { value: RIBBON_OPACITY };
|
|
73
|
+
return {
|
|
74
|
+
condition: conditions,
|
|
75
|
+
value: selectable ? RIBBON_MUTED_OPACITY : RIBBON_OPACITY
|
|
76
|
+
};
|
|
77
|
+
})();
|
|
78
|
+
layers.push({
|
|
79
|
+
data: { name: SANKEY_RIBBONS_DATASET },
|
|
80
|
+
...tooltip ? { params: [{
|
|
81
|
+
name: SANKEY_HOVER_PARAM,
|
|
82
|
+
select: {
|
|
83
|
+
type: "point",
|
|
84
|
+
on: "pointerover",
|
|
85
|
+
clear: "pointerout",
|
|
86
|
+
fields: ["id"]
|
|
87
|
+
}
|
|
88
|
+
}] } : {},
|
|
89
|
+
mark: {
|
|
90
|
+
type: "area",
|
|
91
|
+
line: false,
|
|
92
|
+
interpolate: "linear",
|
|
93
|
+
aria: false
|
|
94
|
+
},
|
|
95
|
+
encoding: {
|
|
96
|
+
x,
|
|
97
|
+
y,
|
|
98
|
+
y2: { field: "y2" },
|
|
99
|
+
detail: {
|
|
100
|
+
field: "id",
|
|
101
|
+
type: "nominal"
|
|
102
|
+
},
|
|
103
|
+
fill: {
|
|
104
|
+
field: "c",
|
|
105
|
+
type: "nominal",
|
|
106
|
+
scale: null,
|
|
107
|
+
legend: null
|
|
108
|
+
},
|
|
109
|
+
fillOpacity: ribbonOpacity,
|
|
110
|
+
...tooltip ? { tooltip: [
|
|
111
|
+
{
|
|
112
|
+
field: "sl",
|
|
113
|
+
type: "nominal",
|
|
114
|
+
title: fromTitle
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
field: "tl",
|
|
118
|
+
type: "nominal",
|
|
119
|
+
title: toTitle
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
field: "v",
|
|
123
|
+
type: "quantitative",
|
|
124
|
+
title: valueTitle,
|
|
125
|
+
format: valueFormat,
|
|
126
|
+
formatType: "arcNumber"
|
|
127
|
+
}
|
|
128
|
+
] } : {}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const nodeOpacity = selectable ? { opacity: {
|
|
132
|
+
condition: [{
|
|
133
|
+
test: NODE_IN_PLAY,
|
|
134
|
+
value: NODE_OPACITY
|
|
135
|
+
}],
|
|
136
|
+
value: NODE_MUTED_OPACITY
|
|
137
|
+
} } : {};
|
|
138
|
+
layers.push({
|
|
139
|
+
data: { name: SANKEY_NODES_DATASET },
|
|
140
|
+
...tooltip ? { params: [{
|
|
141
|
+
name: SANKEY_NODE_HOVER_PARAM,
|
|
142
|
+
select: {
|
|
143
|
+
type: "point",
|
|
144
|
+
on: "pointerover",
|
|
145
|
+
clear: "pointerout",
|
|
146
|
+
fields: ["k"]
|
|
147
|
+
}
|
|
148
|
+
}] } : {},
|
|
149
|
+
mark: {
|
|
150
|
+
type: "rect",
|
|
151
|
+
width: nodeWidth,
|
|
152
|
+
cornerRadius: 1,
|
|
153
|
+
aria: false
|
|
154
|
+
},
|
|
155
|
+
encoding: {
|
|
156
|
+
x,
|
|
157
|
+
y,
|
|
158
|
+
y2: { field: "y2" },
|
|
159
|
+
fill: {
|
|
160
|
+
field: "c",
|
|
161
|
+
type: "nominal",
|
|
162
|
+
scale: null,
|
|
163
|
+
legend: null
|
|
164
|
+
},
|
|
165
|
+
...nodeOpacity
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
if (labels) {
|
|
169
|
+
const visible = [{ filter: "datum.lab" }];
|
|
170
|
+
const align = labelEndsOutward ? { expr: "datum.first ? 'right' : 'left'" } : { expr: "'left'" };
|
|
171
|
+
const dx = labelEndsOutward ? { expr: `datum.first ? ${-(nodeWidth / 2 + LABEL_OFFSET)} : ${nodeWidth / 2 + LABEL_OFFSET}` } : { expr: String(nodeWidth / 2 + LABEL_OFFSET) };
|
|
172
|
+
layers.push({
|
|
173
|
+
data: { name: SANKEY_NODES_DATASET },
|
|
174
|
+
transform: visible,
|
|
175
|
+
mark: {
|
|
176
|
+
type: "text",
|
|
177
|
+
fontSize: 11,
|
|
178
|
+
fontWeight: 500,
|
|
179
|
+
baseline: showValues ? "bottom" : "middle",
|
|
180
|
+
dy: showValues ? -1 : 0,
|
|
181
|
+
fill: tokens.foreground,
|
|
182
|
+
align,
|
|
183
|
+
dx,
|
|
184
|
+
limit: { expr: labelLimit },
|
|
185
|
+
aria: false
|
|
186
|
+
},
|
|
187
|
+
encoding: {
|
|
188
|
+
x,
|
|
189
|
+
y: {
|
|
190
|
+
...y,
|
|
191
|
+
field: "mid"
|
|
192
|
+
},
|
|
193
|
+
text: {
|
|
194
|
+
field: "label",
|
|
195
|
+
type: "nominal"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
if (showValues) layers.push({
|
|
200
|
+
data: { name: SANKEY_NODES_DATASET },
|
|
201
|
+
transform: [{ filter: "datum.lab && datum.h >= 24" }],
|
|
202
|
+
mark: {
|
|
203
|
+
type: "text",
|
|
204
|
+
fontSize: 10,
|
|
205
|
+
baseline: "top",
|
|
206
|
+
dy: 1,
|
|
207
|
+
fill: tokens.mutedForeground,
|
|
208
|
+
align,
|
|
209
|
+
dx,
|
|
210
|
+
limit: { expr: labelLimit },
|
|
211
|
+
aria: false
|
|
212
|
+
},
|
|
213
|
+
encoding: {
|
|
214
|
+
x,
|
|
215
|
+
y: {
|
|
216
|
+
...y,
|
|
217
|
+
field: "mid"
|
|
218
|
+
},
|
|
219
|
+
text: {
|
|
220
|
+
field: "vt",
|
|
221
|
+
type: "nominal"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
const params = [];
|
|
227
|
+
if (selectable) params.push({
|
|
228
|
+
name: SANKEY_SELECTED_PARAM,
|
|
229
|
+
value: null
|
|
230
|
+
});
|
|
231
|
+
return {
|
|
232
|
+
$schema: "https://vega.github.io/schema/vega-lite/v6.json",
|
|
233
|
+
width: 320,
|
|
234
|
+
height,
|
|
235
|
+
autosize: { type: "none" },
|
|
236
|
+
padding: {
|
|
237
|
+
left: padLeft,
|
|
238
|
+
right: padRight,
|
|
239
|
+
top: padTop,
|
|
240
|
+
bottom: padBottom
|
|
241
|
+
},
|
|
242
|
+
background: "transparent",
|
|
243
|
+
...params.length > 0 ? { params } : {},
|
|
244
|
+
layer: layers,
|
|
245
|
+
config: arcVegaConfig(tokens, { locale })
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
export { SANKEY_HOVER_PARAM, SANKEY_NODES_DATASET, SANKEY_NODE_HOVER_PARAM, SANKEY_RIBBONS_DATASET, SANKEY_SELECTED_PARAM, buildSankeyPlotSpec };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { ArcTimeGranularity } from "../../lib/vega/formatters.js";
|
|
2
|
+
import { SANKEY_MAX_IDENTITY, SANKEY_MIN_FLOWS, SankeyAlign, SankeyCardLabels, SankeyCardSize, SankeyCardStatus, SankeyColor, SankeyLink, SankeyNode, SankeyNodeLabels, SankeyNodeOrder } from "./SankeyCard.model.js";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { BoxProps } from "@arcfusionz/arc-primitive-ui";
|
|
5
|
+
import { TopLevelSpec } from "vega-lite";
|
|
6
|
+
import { Result } from "vega-embed";
|
|
7
|
+
//#region src/components/SankeyCard/SankeyCard.d.ts
|
|
8
|
+
interface SankeyCardProps extends Omit<BoxProps, "children" | "padding" | "title"> {
|
|
9
|
+
/** The flow's name — the panel's heading. Pass `name` too when this is not plain text. */
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
/** Plain-text name used in the generated descriptions and control labels. Defaults to `label` when it is a string. */
|
|
12
|
+
name?: string;
|
|
13
|
+
/** What the flow means, shown in a tooltip behind an info control beside the label and exposed to assistive technology as its description. */
|
|
14
|
+
hint?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The flows — `{ source, target, value }` by node key, plus an optional
|
|
17
|
+
* `label` naming one and a `tone` for `color="polarity"`. Two rows with the
|
|
18
|
+
* same source and target are ONE ribbon (their values add). A negative
|
|
19
|
+
* value, a self-loop, a flow to an undeclared node and a flow that closes a
|
|
20
|
+
* cycle are each rejected, counted, and reported in the details popover and
|
|
21
|
+
* the description — never silently dropped. Pass `[]` while loading.
|
|
22
|
+
*/
|
|
23
|
+
links: readonly SankeyLink[];
|
|
24
|
+
/**
|
|
25
|
+
* The nodes. **Optional** — the card derives the set from `links` — but
|
|
26
|
+
* declaring it fixes the ORDER, which fixes each node's place in its column
|
|
27
|
+
* and its identity colour slot, so the diagram does not reshuffle when the
|
|
28
|
+
* data moves. With `nodes` declared, a link naming an unknown key is a data
|
|
29
|
+
* error rather than a new node.
|
|
30
|
+
*/
|
|
31
|
+
nodes?: readonly SankeyNode[];
|
|
32
|
+
/**
|
|
33
|
+
* Which column a node lands in. `justify` (default) pushes every terminal
|
|
34
|
+
* bucket to the last column, so "where did the volume end up" is one
|
|
35
|
+
* vertical scan; `left` leaves an early exit in the column it was reached
|
|
36
|
+
* in, so the x axis reads as elapsed stages; `right` counts back from the
|
|
37
|
+
* sinks, for when the question is what FEEDS an outcome. Stamped as
|
|
38
|
+
* `data-align`.
|
|
39
|
+
*/
|
|
40
|
+
align?: SankeyAlign;
|
|
41
|
+
/**
|
|
42
|
+
* What colour means. `none` (default) draws every ribbon in the one
|
|
43
|
+
* emphasis hue — thickness and position already carry the comparison, and a
|
|
44
|
+
* hue per stage would only restate the x position. `polarity` uses each
|
|
45
|
+
* link's `tone` on the diverging ends (the funnel answer); `terminal` gives
|
|
46
|
+
* each outcome its own identity slot (where did it land); `node` gives each
|
|
47
|
+
* source one (what produced this). The identity modes cap at
|
|
48
|
+
* `SANKEY_MAX_IDENTITY` and fold the tail to gray rather than repeat a
|
|
49
|
+
* slot. Stamped as `data-color`.
|
|
50
|
+
*/
|
|
51
|
+
color?: SankeyColor;
|
|
52
|
+
/**
|
|
53
|
+
* How nodes stack inside a column. `declared` — the consumer's own order,
|
|
54
|
+
* the default when `nodes` is given — keeps a node in its place through a
|
|
55
|
+
* data change; `value` puts the largest first, and is the default when
|
|
56
|
+
* `nodes` is omitted. `Other` always sits last either way.
|
|
57
|
+
*/
|
|
58
|
+
nodeOrder?: SankeyNodeOrder;
|
|
59
|
+
/**
|
|
60
|
+
* Nodes a column may hold before its smallest fold into one `Other` node.
|
|
61
|
+
* The fold re-routes their flows and the details popover still names every
|
|
62
|
+
* member, so nothing disappears. Default 8. Stamped as `data-folded` when
|
|
63
|
+
* it bites.
|
|
64
|
+
*/
|
|
65
|
+
maxNodesPerStage?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Which node names the plot draws. `all` (default) names every node tall
|
|
68
|
+
* enough to hold one, interior names sitting to the right of their node;
|
|
69
|
+
* `ends` names the first and last columns only, each in its own gutter, so
|
|
70
|
+
* no name sits over a ribbon — the right choice on a narrow panel; `none`
|
|
71
|
+
* leaves every name to the details popover. Stamped as `data-labels`.
|
|
72
|
+
*/
|
|
73
|
+
nodeLabels?: SankeyNodeLabels;
|
|
74
|
+
/** Print each node's total under its name, for nodes tall enough for both lines. Default `false`. */
|
|
75
|
+
showValues?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Names for the columns, left to right — rendered as real text above the
|
|
78
|
+
* plot rather than as Vega marks, so they are selectable and reach
|
|
79
|
+
* assistive technology directly. A shorter array leaves the later columns
|
|
80
|
+
* unnamed.
|
|
81
|
+
*/
|
|
82
|
+
stages?: readonly string[];
|
|
83
|
+
/** The node rect's pixel width. Defaults to the size's own. */
|
|
84
|
+
nodeWidth?: number;
|
|
85
|
+
/** Pixels between stacked nodes. Defaults to the size's own. */
|
|
86
|
+
nodeGap?: number;
|
|
87
|
+
/** 0 draws straight ribbons, 1 (default 0.5) the fully eased S. */
|
|
88
|
+
curvature?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Crossing-reduction passes over the layout. Default 6 — enough for the
|
|
91
|
+
* graphs a panel can hold, and fixed so a Chromatic baseline never drifts.
|
|
92
|
+
* Raise it for a dense graph; 0 keeps the declared stacking exactly.
|
|
93
|
+
*/
|
|
94
|
+
iterations?: number;
|
|
95
|
+
/** The plot's inner height in pixels. Defaults to the size's own, and grows with the busiest column. */
|
|
96
|
+
height?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Key of the node whose paths are highlighted, controlled — pair with
|
|
99
|
+
* `onNodeSelect`. `null` highlights nothing. Every flow that misses the
|
|
100
|
+
* node recedes.
|
|
101
|
+
*/
|
|
102
|
+
selectedNode?: string | null;
|
|
103
|
+
/** The highlighted node on first render when `selectedNode` is uncontrolled. */
|
|
104
|
+
defaultSelectedNode?: string | null;
|
|
105
|
+
/** Called with the node's key when the reader picks one, or `null` when the selection is cleared. */
|
|
106
|
+
onNodeSelect?: (key: string | null) => void;
|
|
107
|
+
/** `arcNumber` grammar for every volume: `number[:digits]`, `integer`, `compact[:digits]`, `percent[:digits]`, `currency:CODE[:digits|compact]`. */
|
|
108
|
+
format?: string;
|
|
109
|
+
/** `arcNumber` grammar for a flow's share of its source. Default `percent:0`. */
|
|
110
|
+
shareFormat?: string;
|
|
111
|
+
/** Custom formatter for volumes. Takes precedence over `format`. */
|
|
112
|
+
formatValue?: (value: number) => string;
|
|
113
|
+
/** Columns the skeleton reserves before `links` arrive, so the panel is already its final height. Default 3. */
|
|
114
|
+
expectedStages?: number;
|
|
115
|
+
/** Nodes per column the skeleton reserves before they arrive. Default 3. */
|
|
116
|
+
expectedNodes?: number;
|
|
117
|
+
/**
|
|
118
|
+
* The takeaway in a sentence, rendered beside the AI mark under the plot.
|
|
119
|
+
* Wrap values in `<strong>`. Omit for the card's own generated sentence —
|
|
120
|
+
* the main flow out of the first stage and the largest declared loss;
|
|
121
|
+
* `false` for none.
|
|
122
|
+
*/
|
|
123
|
+
insight?: ReactNode;
|
|
124
|
+
/** The transport's status. `loading` with data already present is a refresh: the previous render stays under the veil. Default `ready`. */
|
|
125
|
+
status?: SankeyCardStatus;
|
|
126
|
+
/** The consumer's filter is active — no flow then reads as no-match rather than empty. */
|
|
127
|
+
filtered?: boolean;
|
|
128
|
+
/** The data is older than the product's freshness rule (TanStack Query's `isStale`). Shows a badge and stamps `data-stale`. */
|
|
129
|
+
stale?: boolean;
|
|
130
|
+
/** When the data was last true. Rendered as an "as of" line and included in the description. */
|
|
131
|
+
updatedAt?: Date | string | number;
|
|
132
|
+
/** How `updatedAt` is written, in the card's `locale` and `timeZone`. Default `day`. */
|
|
133
|
+
updatedAtFormat?: ArcTimeGranularity | ((date: Date) => string);
|
|
134
|
+
/** Recovery action for the error state; renders a retry button when set. */
|
|
135
|
+
onRetry?: () => void;
|
|
136
|
+
/** Recovery action for the no-match state; renders a clear-filters button when set. */
|
|
137
|
+
onClearFilters?: () => void;
|
|
138
|
+
/** Density: `sm` for a dense grid, `md` (default), `lg` for a hero panel. */
|
|
139
|
+
size?: SankeyCardSize;
|
|
140
|
+
/** Heading level of the label for the document outline. Default 3. */
|
|
141
|
+
titleLevel?: 2 | 3 | 4 | 5 | 6;
|
|
142
|
+
/** BCP 47 locale for every number and date. Thai products on the Gregorian calendar pass `th-TH-u-ca-gregory`. */
|
|
143
|
+
locale?: string;
|
|
144
|
+
/** IANA time zone for the as-of date. Defaults to the runtime's — pass it for deterministic output. */
|
|
145
|
+
timeZone?: string;
|
|
146
|
+
/** Overrides for every rendered or announced string. */
|
|
147
|
+
labels?: Partial<SankeyCardLabels>;
|
|
148
|
+
/** Replaces the generated accessible description of the whole card. */
|
|
149
|
+
description?: string;
|
|
150
|
+
/** Trailing header slot — a ghost `Button` or `Menu`. */
|
|
151
|
+
action?: ReactNode;
|
|
152
|
+
/** Open the details popover on first render. */
|
|
153
|
+
defaultTableOpen?: boolean;
|
|
154
|
+
/** Hide the header info button. Only when another surface exposes the same values to keyboard and screen-reader users. */
|
|
155
|
+
hideTableToggle?: boolean;
|
|
156
|
+
/** Hide the `Alert` that reports broken cycles, unaccounted volume and rejected flows. The description still carries them. */
|
|
157
|
+
hideNotes?: boolean;
|
|
158
|
+
/** Called with vega-embed's result once the plot mounts — for `view` access in advanced compositions. */
|
|
159
|
+
onEmbed?: (result: Result) => void;
|
|
160
|
+
/** Escape hatch: transform the spec before it renders. Voids the token and accessibility guarantees for whatever it changes. */
|
|
161
|
+
patchSpec?: (spec: TopLevelSpec) => TopLevelSpec;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* A flow panel — the tenth member of the analytics card family, and the only
|
|
165
|
+
* one whose subject is the **edges of a graph** rather than a measure.
|
|
166
|
+
*
|
|
167
|
+
* `links` of `{ source, target, value }` become a sankey: stages as columns,
|
|
168
|
+
* nodes as rects, and each flow as a ribbon whose thickness is its quantity.
|
|
169
|
+
* It answers the one question no other card can — *what became of this
|
|
170
|
+
* volume, and where did it leak* — because only a flow diagram draws an edge
|
|
171
|
+
* as a quantity while keeping the chain intact.
|
|
172
|
+
*
|
|
173
|
+
* The card enforces what makes the form honest. A cycle is broken and
|
|
174
|
+
* reported rather than drawn. Volume that arrives and does not leave shows as
|
|
175
|
+
* unfilled node and is named, never balanced away. A graph with fewer than
|
|
176
|
+
* two columns is refused, because a part-to-whole belongs in a `Progress`
|
|
177
|
+
* bar. Colour defaults to a single emphasis hue, since thickness and position
|
|
178
|
+
* already carry the comparison. And every quantity a ribbon encodes is also
|
|
179
|
+
* text — in the tooltip, the flow table with its share of the source, and the
|
|
180
|
+
* node table with in, out and what did not reconcile — which is what makes
|
|
181
|
+
* the weakest channel in the family safe to use.
|
|
182
|
+
*/
|
|
183
|
+
declare const SankeyCard: import("react").ForwardRefExoticComponent<SankeyCardProps & import("react").RefAttributes<HTMLElement>>;
|
|
184
|
+
//#endregion
|
|
185
|
+
export { SankeyCard, SankeyCardProps };
|