@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,178 @@
|
|
|
1
|
+
import { arcVegaConfig } from "../../lib/vega/config.js";
|
|
2
|
+
//#region src/components/TreeCard/TreeCard.chart.ts
|
|
3
|
+
/** The visible rows: `{ key, label, depth, value, share, role, inFocus }` per `TreeRow`, in display order. */
|
|
4
|
+
const TREE_TABLE_DATASET = "table";
|
|
5
|
+
/** Zero or one row `{ value: 0 }` — a hairline at zero, pushed only when a visible value is negative. */
|
|
6
|
+
const TREE_ZERO_DATASET = "zero";
|
|
7
|
+
/** The hovered row's point selection. */
|
|
8
|
+
const TREE_HOVER_PARAM = "hover";
|
|
9
|
+
/**
|
|
10
|
+
* The upper bound of the shared value scale — the tree's total, pushed as a
|
|
11
|
+
* signal.
|
|
12
|
+
*
|
|
13
|
+
* Pinning the domain to the whole rather than to the tallest visible bar is
|
|
14
|
+
* what makes a bar's length read as its share of the total at every depth,
|
|
15
|
+
* whether or not the total is itself a row. It rides a signal, not the spec,
|
|
16
|
+
* because the total is data: baking it into the spec would re-embed the view
|
|
17
|
+
* on every refresh.
|
|
18
|
+
*/
|
|
19
|
+
const TREE_TOTAL_PARAM = "treeTotal";
|
|
20
|
+
const TREE_MAX_BAR_HEIGHT = 24;
|
|
21
|
+
const RESTING_OPACITY = .6;
|
|
22
|
+
const ROW_DOMAIN_EXPR = `pluck(data('${TREE_TABLE_DATASET}'), 'key')`;
|
|
23
|
+
/**
|
|
24
|
+
* Depth reads through the sequential ramp's top steps, darkest at the root.
|
|
25
|
+
*
|
|
26
|
+
* Only three: the ramp's lighter steps (`chart-sequential-1…4`) do not clear
|
|
27
|
+
* WCAG 1.4.11's 3:1 against `background` — `primary-400` measures 2.7:1 on
|
|
28
|
+
* white — so a fourth shade would buy a depth cue by making the deepest bars
|
|
29
|
+
* unreadable. Depth past the third level therefore repeats the third step;
|
|
30
|
+
* indentation, the disclosure control and `aria-level` carry the rest, so the
|
|
31
|
+
* hierarchy never depends on the ramp alone.
|
|
32
|
+
*/
|
|
33
|
+
const TREE_DEPTH_STEPS = [
|
|
34
|
+
6,
|
|
35
|
+
5,
|
|
36
|
+
4
|
|
37
|
+
];
|
|
38
|
+
/** The exact hue a row's bar wears — the swatches in the legend, chips and tooltip read from this too. */
|
|
39
|
+
function treeBarColor(tokens, { depth, role, inFocus }, colorBy, emphasize) {
|
|
40
|
+
if (role === "residual") return tokens.context;
|
|
41
|
+
if (colorBy === "emphasis") return !emphasize || inFocus ? tokens.emphasis : tokens.context;
|
|
42
|
+
const step = TREE_DEPTH_STEPS[Math.min(depth, TREE_DEPTH_STEPS.length - 1)];
|
|
43
|
+
return tokens.sequential[step] ?? tokens.emphasis;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Builds the bars: one horizontal bar per visible row on a shared zero-based
|
|
47
|
+
* scale (length compares magnitude — Cleveland & McGill's second-best channel
|
|
48
|
+
* — and, because the whole is on the same scale, reads as share of it), the
|
|
49
|
+
* fill carrying depth through the sequential ramp or the selected branch
|
|
50
|
+
* through the emphasis hue, a hairline at zero once a value is negative, and
|
|
51
|
+
* a hover selection that keeps the pointed bar solid while its siblings
|
|
52
|
+
* recede. Every band has no padding, so the bar centers line up with the DOM
|
|
53
|
+
* rows that carry the names, values and shares.
|
|
54
|
+
*/
|
|
55
|
+
function buildTreeBarsSpec(options, tokens) {
|
|
56
|
+
const { barHeight, height, zeroRule, tooltip, colorBy, emphasize, itemTitle, valueTitle, shareTitle, valueFormat, shareFormat, locale } = options;
|
|
57
|
+
const xField = {
|
|
58
|
+
field: "value",
|
|
59
|
+
type: "quantitative",
|
|
60
|
+
axis: null,
|
|
61
|
+
scale: {
|
|
62
|
+
zero: true,
|
|
63
|
+
nice: false,
|
|
64
|
+
domainMax: { expr: TREE_TOTAL_PARAM }
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const yField = {
|
|
68
|
+
field: "key",
|
|
69
|
+
type: "nominal",
|
|
70
|
+
sort: null,
|
|
71
|
+
axis: null,
|
|
72
|
+
scale: {
|
|
73
|
+
domain: { expr: ROW_DOMAIN_EXPR },
|
|
74
|
+
paddingInner: 0,
|
|
75
|
+
paddingOuter: 0
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const layers = [];
|
|
79
|
+
if (zeroRule) layers.push({
|
|
80
|
+
data: { name: TREE_ZERO_DATASET },
|
|
81
|
+
mark: {
|
|
82
|
+
type: "rule",
|
|
83
|
+
stroke: tokens.axis,
|
|
84
|
+
strokeWidth: 1,
|
|
85
|
+
aria: false
|
|
86
|
+
},
|
|
87
|
+
encoding: { x: xField }
|
|
88
|
+
});
|
|
89
|
+
const residualCondition = {
|
|
90
|
+
test: "datum.role === 'residual'",
|
|
91
|
+
value: tokens.context
|
|
92
|
+
};
|
|
93
|
+
const fill = colorBy === "emphasis" ? emphasize ? {
|
|
94
|
+
condition: [residualCondition, {
|
|
95
|
+
test: "datum.inFocus",
|
|
96
|
+
value: tokens.emphasis
|
|
97
|
+
}],
|
|
98
|
+
value: tokens.context
|
|
99
|
+
} : {
|
|
100
|
+
condition: [residualCondition],
|
|
101
|
+
value: tokens.emphasis
|
|
102
|
+
} : {
|
|
103
|
+
condition: [residualCondition, ...TREE_DEPTH_STEPS.slice(0, -1).map((step, depth) => ({
|
|
104
|
+
test: `datum.depth === ${depth}`,
|
|
105
|
+
value: tokens.sequential[step] ?? tokens.emphasis
|
|
106
|
+
}))],
|
|
107
|
+
value: tokens.sequential[TREE_DEPTH_STEPS[TREE_DEPTH_STEPS.length - 1]] ?? tokens.emphasis
|
|
108
|
+
};
|
|
109
|
+
layers.push({
|
|
110
|
+
...tooltip ? { params: [{
|
|
111
|
+
name: TREE_HOVER_PARAM,
|
|
112
|
+
select: {
|
|
113
|
+
type: "point",
|
|
114
|
+
on: "pointerover",
|
|
115
|
+
clear: "pointerout",
|
|
116
|
+
encodings: ["y"]
|
|
117
|
+
}
|
|
118
|
+
}] } : {},
|
|
119
|
+
mark: {
|
|
120
|
+
type: "bar",
|
|
121
|
+
height: Math.min(24, barHeight),
|
|
122
|
+
cornerRadiusEnd: 2,
|
|
123
|
+
aria: false
|
|
124
|
+
},
|
|
125
|
+
encoding: {
|
|
126
|
+
y: yField,
|
|
127
|
+
x: xField,
|
|
128
|
+
fill,
|
|
129
|
+
...tooltip ? {
|
|
130
|
+
opacity: {
|
|
131
|
+
condition: {
|
|
132
|
+
param: TREE_HOVER_PARAM,
|
|
133
|
+
value: 1
|
|
134
|
+
},
|
|
135
|
+
value: RESTING_OPACITY
|
|
136
|
+
},
|
|
137
|
+
tooltip: [
|
|
138
|
+
{
|
|
139
|
+
field: "label",
|
|
140
|
+
type: "nominal",
|
|
141
|
+
title: itemTitle
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
field: "value",
|
|
145
|
+
type: "quantitative",
|
|
146
|
+
title: valueTitle,
|
|
147
|
+
format: valueFormat,
|
|
148
|
+
formatType: "arcNumber"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
field: "share",
|
|
152
|
+
type: "quantitative",
|
|
153
|
+
title: shareTitle,
|
|
154
|
+
format: shareFormat,
|
|
155
|
+
formatType: "arcNumber"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
} : {}
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
return {
|
|
162
|
+
$schema: "https://vega.github.io/schema/vega-lite/v6.json",
|
|
163
|
+
width: 240,
|
|
164
|
+
height,
|
|
165
|
+
autosize: { type: "none" },
|
|
166
|
+
padding: 0,
|
|
167
|
+
background: "transparent",
|
|
168
|
+
params: [{
|
|
169
|
+
name: TREE_TOTAL_PARAM,
|
|
170
|
+
value: 1
|
|
171
|
+
}],
|
|
172
|
+
data: { name: TREE_TABLE_DATASET },
|
|
173
|
+
layer: layers,
|
|
174
|
+
config: arcVegaConfig(tokens, { locale })
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
export { TREE_DEPTH_STEPS, TREE_HOVER_PARAM, TREE_MAX_BAR_HEIGHT, TREE_TABLE_DATASET, TREE_TOTAL_PARAM, TREE_ZERO_DATASET, buildTreeBarsSpec, treeBarColor };
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { ArcTimeGranularity } from "../../lib/vega/formatters.js";
|
|
2
|
+
import { TreeCardLabels, TreeCardSize, TreeCardStatus, TreeColorBy, TreeDeltaMode, TreeGoodDirection, TreeHeadline, TreeNode, TreeRollup, TreeRowSecondary, TreeSort } from "./TreeCard.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/TreeCard/TreeCard.d.ts
|
|
8
|
+
interface TreeCardProps extends Omit<BoxProps, "children" | "padding" | "title"> {
|
|
9
|
+
/** The metric's name — the tile'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
|
+
/** Definition of the metric, shown in a tooltip behind an info control beside the label and exposed to assistive technology as the control's description. */
|
|
14
|
+
hint?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The hierarchy, as nested `{ key?, label, value?, previous?, children? }`
|
|
17
|
+
* records. `key` identifies a node among its siblings and defaults to
|
|
18
|
+
* `label`; the card joins it with its ancestors' keys, so the keys it hands
|
|
19
|
+
* back through `expanded`, `selected` and their callbacks are paths like
|
|
20
|
+
* `online/marketplace`. Give the leaves their `value` and let `rollup`
|
|
21
|
+
* total the branches, or give every level its own reading with
|
|
22
|
+
* `rollup="own"`. Pass `[]` while loading — `expectedRows` rows are
|
|
23
|
+
* reserved.
|
|
24
|
+
*/
|
|
25
|
+
nodes: readonly TreeNode[];
|
|
26
|
+
/**
|
|
27
|
+
* Where a parent's value comes from. `sum` (default) always rolls the
|
|
28
|
+
* children up, so the parts reconcile with the whole by construction.
|
|
29
|
+
* `own` prefers a parent's own reading and reports whatever its children do
|
|
30
|
+
* not account for as an explicit `Unallocated` row. Stamped as `data-rollup`.
|
|
31
|
+
*/
|
|
32
|
+
rollup?: TreeRollup;
|
|
33
|
+
/** Sibling order inside every parent: `none` (default) keeps the consumer's order, `desc` and `asc` rank by value with missing values last. */
|
|
34
|
+
sort?: TreeSort;
|
|
35
|
+
/**
|
|
36
|
+
* Fold each parent's tail past this many children into one `Other` row
|
|
37
|
+
* whose value is the sum of the folded values — for additive measures
|
|
38
|
+
* (counts, revenue), never for rates or averages. The count includes the
|
|
39
|
+
* `Other` row, so `maxChildren={4}` shows three named children beside it.
|
|
40
|
+
* Default: no fold.
|
|
41
|
+
*/
|
|
42
|
+
maxChildren?: number;
|
|
43
|
+
/** Drop every node deeper than this level (0-based, so `1` shows two levels). Ancestors keep the dropped values in their rollup. Default: the whole tree. */
|
|
44
|
+
maxDepth?: number;
|
|
45
|
+
/** Report a parent's unaccounted remainder as an `Unallocated` row. Only ever fires under `rollup="own"`. Default `true`. */
|
|
46
|
+
showResidual?: boolean;
|
|
47
|
+
/** Fraction of a parent's own reading below which a mismatch with its children is rounding rather than a gap. Default `0.0005` (0.05%). */
|
|
48
|
+
residualTolerance?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Keys of the open branches, controlled — pair with `onExpandedChange`.
|
|
51
|
+
* Omit for the uncontrolled card (`defaultExpanded`, else every branch
|
|
52
|
+
* shallower than `defaultExpandDepth`).
|
|
53
|
+
*/
|
|
54
|
+
expanded?: readonly string[];
|
|
55
|
+
/** The open branches on first render when `expanded` is uncontrolled. Takes precedence over `defaultExpandDepth`. */
|
|
56
|
+
defaultExpanded?: readonly string[];
|
|
57
|
+
/** With neither `expanded` nor `defaultExpanded`, every branch shallower than this level starts open. Default 1 — the top level and its children are visible. */
|
|
58
|
+
defaultExpandDepth?: number;
|
|
59
|
+
/** Called with the open branches' keys whenever the reader opens or closes one. */
|
|
60
|
+
onExpandedChange?: (keys: string[]) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Key of the selected row, controlled — pair with `onSelectedChange`. It is
|
|
63
|
+
* the `focus` headline's subject and, under `colorBy="emphasis"`, the
|
|
64
|
+
* branch that takes the hue. Omit for the uncontrolled card
|
|
65
|
+
* (`defaultSelected`, else nothing selected).
|
|
66
|
+
*/
|
|
67
|
+
selected?: string | null;
|
|
68
|
+
/** The selected row on first render when `selected` is uncontrolled. */
|
|
69
|
+
defaultSelected?: string | null;
|
|
70
|
+
/** Called with the chosen row's key — or `null` when the reader deselects it — on click or Enter. */
|
|
71
|
+
onSelectedChange?: (key: string | null) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Let the reader select a row. Rows stay focusable and arrow-navigable
|
|
74
|
+
* either way, since opening a branch is always a keyboard action. A value
|
|
75
|
+
* the app controls without its change handler (`selected` without
|
|
76
|
+
* `onSelectedChange`) is pinned. Default `true`; `false` for a static tile.
|
|
77
|
+
* Stamped as `data-selectable`.
|
|
78
|
+
*/
|
|
79
|
+
selectable?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* What the big number is. `total` (default) is the sum of the top-level
|
|
82
|
+
* rows. `focus` follows the selection and falls back to the total while
|
|
83
|
+
* nothing is selected. `none` leaves the tree to carry the card. Stamped as
|
|
84
|
+
* `data-headline`.
|
|
85
|
+
*/
|
|
86
|
+
headline?: TreeHeadline;
|
|
87
|
+
/** What the total is called, under the headline value and in the description. Default `labels.total`. */
|
|
88
|
+
totalLabel?: ReactNode;
|
|
89
|
+
/**
|
|
90
|
+
* Name the headline's subject in a chip under the value — a soft primary
|
|
91
|
+
* `Badge` with a swatch in the row's bar hue. Default `true`; `false` when
|
|
92
|
+
* the card's title already names it. Not rendered with `headline="none"`.
|
|
93
|
+
*/
|
|
94
|
+
headlineChip?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* What the bars encode. `depth` (default) ramps the sequential steps by
|
|
97
|
+
* level, redundantly with the indentation. `emphasis` paints the selected
|
|
98
|
+
* branch and its descendants in the emphasis hue and everything else in the
|
|
99
|
+
* context gray. Stamped as `data-color-by`.
|
|
100
|
+
*/
|
|
101
|
+
colorBy?: TreeColorBy;
|
|
102
|
+
/**
|
|
103
|
+
* The second figure beside each row's value: `share` of its parent
|
|
104
|
+
* (default), `share-of-total`, the `delta` against `previous`, or `none`.
|
|
105
|
+
* Stamped as `data-row-secondary`.
|
|
106
|
+
*/
|
|
107
|
+
rowSecondary?: TreeRowSecondary;
|
|
108
|
+
/** `percent` (default) is relative change; `absolute` is the difference in the value's units — percentage points for a `percent` format. Also the form of every row's change in the table and tooltip. */
|
|
109
|
+
deltaMode?: TreeDeltaMode;
|
|
110
|
+
/** Which direction is good: `up` (revenue), `down` (cost, churn) or `none` (headcount — the delta stays neutral). Drives the badge's polarity color. Default `up`. */
|
|
111
|
+
goodDirection?: TreeGoodDirection;
|
|
112
|
+
/**
|
|
113
|
+
* Number format for the headline, rows, delta, table and tooltip — one
|
|
114
|
+
* grammar so nothing rounds two ways: `number[:digits]`, `integer`,
|
|
115
|
+
* `compact[:digits]`, `percent[:digits]`, `currency:CODE[:digits|compact]`.
|
|
116
|
+
* Default `compact` (`3.8M`).
|
|
117
|
+
*/
|
|
118
|
+
format?: string;
|
|
119
|
+
/** Custom formatter for values. Takes precedence over `format` everywhere a value is rendered. */
|
|
120
|
+
formatValue?: (value: number) => string;
|
|
121
|
+
/** Format grammar for shares. Default `percent:0` (`55%`). */
|
|
122
|
+
shareFormat?: string;
|
|
123
|
+
/** Unit shown after the headline value in the muted role (`ms`, `req/s`). Prefer `format="currency:…"` for money. */
|
|
124
|
+
unit?: ReactNode;
|
|
125
|
+
/** Rows the skeleton reserves before `nodes` arrive, so the tile is already its final height. Default 4. */
|
|
126
|
+
expectedRows?: number;
|
|
127
|
+
/** Show the header control that opens or closes every branch at once. Default `true`; hidden when nothing can be opened. */
|
|
128
|
+
showExpandAll?: boolean;
|
|
129
|
+
/** The takeaway in a sentence, rendered beside the AI mark under the tree. Wrap values in `<strong>` to set them in bold. */
|
|
130
|
+
insight?: ReactNode;
|
|
131
|
+
/** The transport's status. `loading` with nodes already present is a refresh: the previous render stays under the veil. Default `ready`. */
|
|
132
|
+
status?: TreeCardStatus;
|
|
133
|
+
/** The consumer's filter is active — no values then reads as no-match rather than empty, with a clear-filters action when `onClearFilters` is set. */
|
|
134
|
+
filtered?: boolean;
|
|
135
|
+
/** The data is older than the product's freshness rule (TanStack Query's `isStale`). Shows a badge and stamps `data-stale`. */
|
|
136
|
+
stale?: boolean;
|
|
137
|
+
/** When the data was last true. Rendered as an "as of" line and included in the description. */
|
|
138
|
+
updatedAt?: Date | string | number;
|
|
139
|
+
/** How `updatedAt` is written, as a time-grammar granularity — `day` (default), `datetime`, `time`, `month`, `year` — or a formatter. */
|
|
140
|
+
updatedAtFormat?: ArcTimeGranularity | ((date: Date) => string);
|
|
141
|
+
/** Recovery action for the error state; renders a retry button when set. */
|
|
142
|
+
onRetry?: () => void;
|
|
143
|
+
/** Recovery action for the no-match state; renders a clear-filters button when set. */
|
|
144
|
+
onClearFilters?: () => void;
|
|
145
|
+
/** Density: `sm` for dense grids, `md` (default), `lg` for a hero breakdown. Scales type, padding, the row height (24 / 28 / 32px), the bar thickness and the indent. */
|
|
146
|
+
size?: TreeCardSize;
|
|
147
|
+
/** Heading level of the label for the document outline. Default 3. */
|
|
148
|
+
titleLevel?: 2 | 3 | 4 | 5 | 6;
|
|
149
|
+
/** BCP 47 locale for every number and date. Thai products on the Gregorian calendar pass `th-TH-u-ca-gregory`. */
|
|
150
|
+
locale?: string;
|
|
151
|
+
/** IANA time zone for the as-of date. Defaults to the runtime's — pass it for deterministic output. */
|
|
152
|
+
timeZone?: string;
|
|
153
|
+
/** Overrides for every rendered or announced string. */
|
|
154
|
+
labels?: Partial<TreeCardLabels>;
|
|
155
|
+
/** Replaces the generated accessible description of the whole card. */
|
|
156
|
+
description?: string;
|
|
157
|
+
/** Trailing header slot — a ghost `Button` or `Menu` for drill-through, export, or settings. */
|
|
158
|
+
action?: ReactNode;
|
|
159
|
+
/** Open the data popover on first render, anchored to the card. */
|
|
160
|
+
defaultTableOpen?: boolean;
|
|
161
|
+
/** Hide the header info button for the data popover. Only when another surface exposes the same values to keyboard and screen-reader users. */
|
|
162
|
+
hideTableToggle?: boolean;
|
|
163
|
+
/** Called with vega-embed's result once the bars mount — for `view` access in advanced compositions. */
|
|
164
|
+
onEmbed?: (result: Result) => void;
|
|
165
|
+
/** Escape hatch: transform the bars' spec before it renders. Voids the token and accessibility guarantees for whatever it changes. */
|
|
166
|
+
patchSpec?: (spec: TopLevelSpec) => TopLevelSpec;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* A hierarchical breakdown tile — the decomposition subtype of the KPI card
|
|
170
|
+
* family beside `MetricCard` and `ComparisonCard`: one total broken into
|
|
171
|
+
* nested parts as indented, expandable rows whose bars share a single
|
|
172
|
+
* zero-based scale, so every bar length reads as its share of the whole.
|
|
173
|
+
* Depth rides the sequential ramp, each row carries its value and share as
|
|
174
|
+
* text, an optional `previous` per node turns it into a decomposition of
|
|
175
|
+
* change with the family's polarity badge, and every loading, empty, error
|
|
176
|
+
* and stale state is layout-stable inside one `Box` frame — with a generated
|
|
177
|
+
* text equivalent, full WAI-ARIA tree keyboard navigation, and a data table
|
|
178
|
+
* in an info popover.
|
|
179
|
+
*/
|
|
180
|
+
declare const TreeCard: import("react").ForwardRefExoticComponent<TreeCardProps & import("react").RefAttributes<HTMLElement>>;
|
|
181
|
+
//#endregion
|
|
182
|
+
export { TreeCard, TreeCardProps };
|