@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,521 @@
|
|
|
1
|
+
import { ArcDeltaDirection, ArcDeltaMode, ArcTimeGranularity } from "../../lib/vega/formatters.js";
|
|
2
|
+
//#region src/components/MetricCard/MetricCard.model.d.ts
|
|
3
|
+
/** What the consumer's transport reports. */
|
|
4
|
+
type MetricCardStatus = "loading" | "ready" | "error";
|
|
5
|
+
/**
|
|
6
|
+
* What the card actually shows, derived from `status`, the value, the trend
|
|
7
|
+
* and `filtered`. Stamped on the root as `data-state`.
|
|
8
|
+
*/
|
|
9
|
+
type MetricCardState = "loading" | "refreshing" | "ready" | "empty" | "no-match" | "error";
|
|
10
|
+
/** Which way is good: revenue goes up, churn goes down, headcount is neutral. */
|
|
11
|
+
type MetricGoodDirection = "up" | "down" | "none";
|
|
12
|
+
/** How a delta reads once `goodDirection` is applied. Stamped as `data-polarity`. */
|
|
13
|
+
type MetricPolarity = "positive" | "negative" | "neutral";
|
|
14
|
+
type MetricDeltaMode = ArcDeltaMode;
|
|
15
|
+
type MetricTrendMark = "line" | "area" | "bar";
|
|
16
|
+
type MetricTrendScale = "auto" | "zero";
|
|
17
|
+
/** Which axes the sparkline draws. `none` is the sparkline convention; the others turn it into a small labelled chart. */
|
|
18
|
+
type MetricTrendAxes = "none" | "x" | "y" | "both";
|
|
19
|
+
type MetricTrendXType = "temporal" | "quantitative" | "ordinal";
|
|
20
|
+
type MetricCardSize = "sm" | "md" | "lg";
|
|
21
|
+
/** `default` is the metric tile; `highlight` is a card about one window of the trend. Stamped as `data-variant`. */
|
|
22
|
+
type MetricCardVariant = "default" | "highlight";
|
|
23
|
+
/**
|
|
24
|
+
* The window a `highlight` card is about, in the trend's own `x` type: `Date`s
|
|
25
|
+
* or ISO strings for a temporal trend, numbers for a quantitative one, the
|
|
26
|
+
* category labels for an ordinal one. Each bound snaps inward to the nearest
|
|
27
|
+
* finite reading, so a window may begin or end on a gap.
|
|
28
|
+
*/
|
|
29
|
+
interface MetricHighlightRange {
|
|
30
|
+
start: Date | string | number;
|
|
31
|
+
end: Date | string | number;
|
|
32
|
+
/**
|
|
33
|
+
* Names the window — `Steepest 2-day drop`. Shown under the delta badge in
|
|
34
|
+
* place of the formatted period and as the tooltip's title; the period
|
|
35
|
+
* itself stays on the axis, in the tooltip, the popover and the descriptions.
|
|
36
|
+
*/
|
|
37
|
+
label?: string;
|
|
38
|
+
}
|
|
39
|
+
/** A finite reading the window snapped to, with its index in the normalised rows. */
|
|
40
|
+
interface MetricHighlightReading {
|
|
41
|
+
x: number | string;
|
|
42
|
+
y: number;
|
|
43
|
+
index: number;
|
|
44
|
+
}
|
|
45
|
+
/** The resolved window: its two readings, the period as text, and the change between them in every form the card speaks. */
|
|
46
|
+
interface MetricHighlightInfo {
|
|
47
|
+
start: MetricHighlightReading;
|
|
48
|
+
end: MetricHighlightReading;
|
|
49
|
+
label?: string;
|
|
50
|
+
/** The period, formatted with the card's locale — `Aug 7 – 9, 2026`, `Q2 – Q4`. */
|
|
51
|
+
rangeText: string;
|
|
52
|
+
/** The change from start to end in the card's `deltaMode` — what the badge shows; its polarity colours the highlighted marks. */
|
|
53
|
+
delta: MetricDelta;
|
|
54
|
+
/** The change in the value's own units — percentage points for a percent format. */
|
|
55
|
+
absoluteText: string;
|
|
56
|
+
/** The relative change, or `MISSING_VALUE` when the start reading is zero. */
|
|
57
|
+
percentText: string;
|
|
58
|
+
}
|
|
59
|
+
/** A trend row as the highlight sparkline reads it: `hl` marks the window, `tone` carries the window's polarity for the mark colour. */
|
|
60
|
+
interface MetricHighlightTrendRow extends MetricTrendRow {
|
|
61
|
+
hl: boolean;
|
|
62
|
+
tone: MetricPolarity | null;
|
|
63
|
+
}
|
|
64
|
+
/** The readings outside the window, split so the context line stops at the window's edges instead of running under it. */
|
|
65
|
+
interface MetricHighlightContextRow extends MetricTrendRow {
|
|
66
|
+
seg: "before" | "after";
|
|
67
|
+
}
|
|
68
|
+
interface MetricHighlightPoint {
|
|
69
|
+
x: number | string;
|
|
70
|
+
y: number;
|
|
71
|
+
role: "start" | "end";
|
|
72
|
+
tone: MetricPolarity;
|
|
73
|
+
}
|
|
74
|
+
/** One row spanning the window — the band behind a line and the source of the axis anchors. */
|
|
75
|
+
interface MetricHighlightBand {
|
|
76
|
+
start: number | string;
|
|
77
|
+
end: number | string;
|
|
78
|
+
startY: number;
|
|
79
|
+
endY: number;
|
|
80
|
+
tone: MetricPolarity;
|
|
81
|
+
}
|
|
82
|
+
/** A piece of a generated insight sentence: plain text, or a value the card sets in bold. */
|
|
83
|
+
type MetricInsightSegment = string | {
|
|
84
|
+
value: string;
|
|
85
|
+
};
|
|
86
|
+
/** Every named dataset the highlight sparkline reads. */
|
|
87
|
+
interface MetricHighlightDatasets {
|
|
88
|
+
table: MetricHighlightTrendRow[];
|
|
89
|
+
context: MetricHighlightContextRow[];
|
|
90
|
+
highlightRows: MetricHighlightTrendRow[];
|
|
91
|
+
highlightPoints: MetricHighlightPoint[];
|
|
92
|
+
highlight: MetricHighlightBand[];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* One reading of the trend. Cloudscape's `{ x, y }` point contract: `x` is a
|
|
96
|
+
* `Date`, an ISO string, a number or a category label; `y` is the value, or
|
|
97
|
+
* `null` for a period with no reading (drawn as a gap, never as zero).
|
|
98
|
+
*/
|
|
99
|
+
interface MetricTrendPoint {
|
|
100
|
+
x: Date | string | number;
|
|
101
|
+
y: number | null;
|
|
102
|
+
}
|
|
103
|
+
/** A trend point after normalisation: temporal `x` is epoch milliseconds, ordinal `x` a string. */
|
|
104
|
+
interface MetricTrendRow {
|
|
105
|
+
x: number | string;
|
|
106
|
+
y: number | null;
|
|
107
|
+
}
|
|
108
|
+
interface MetricTrendSummary {
|
|
109
|
+
rows: MetricTrendRow[];
|
|
110
|
+
xType: MetricTrendXType;
|
|
111
|
+
/** Points with a finite `y`. */
|
|
112
|
+
count: number;
|
|
113
|
+
first: MetricTrendRow | null;
|
|
114
|
+
last: MetricTrendRow | null;
|
|
115
|
+
/** The last point with a finite `y` — what the endpoint dot marks. */
|
|
116
|
+
latest: MetricTrendRow | null;
|
|
117
|
+
min: number | null;
|
|
118
|
+
max: number | null;
|
|
119
|
+
granularity: ArcTimeGranularity;
|
|
120
|
+
}
|
|
121
|
+
interface MetricDelta {
|
|
122
|
+
direction: ArcDeltaDirection;
|
|
123
|
+
polarity: MetricPolarity;
|
|
124
|
+
/** Signed, formatted change: `+12.4%`, `-0.3 pp`, `+฿124K`. */
|
|
125
|
+
text: string;
|
|
126
|
+
renderedMode: ArcDeltaMode;
|
|
127
|
+
/**
|
|
128
|
+
* The same change in the other form — the absolute amount when `text` is a
|
|
129
|
+
* percent, the relative change when `text` is an amount. `null` when the
|
|
130
|
+
* other form does not exist (a zero baseline has no percent), so the delta
|
|
131
|
+
* tooltip drops the row rather than printing a dash.
|
|
132
|
+
*/
|
|
133
|
+
secondaryText: string | null;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* What the delta tooltip explains: the two readings behind the badge and the
|
|
137
|
+
* change between them, in both forms. `kind` is `window` on the highlight
|
|
138
|
+
* variant, whose badge compares a window's end against its start rather than
|
|
139
|
+
* the headline against the previous period.
|
|
140
|
+
*/
|
|
141
|
+
interface MetricDeltaExplanation {
|
|
142
|
+
kind: "period" | "window";
|
|
143
|
+
/** The reading compared against — the previous period, or the window's start. */
|
|
144
|
+
previousText: string;
|
|
145
|
+
/**
|
|
146
|
+
* The selected baseline's name when the card offers several (`last month`),
|
|
147
|
+
* so the row can name it; `null` when the badge compares against one
|
|
148
|
+
* previous reading, which the rows call `Previous`. Always `null` on the
|
|
149
|
+
* window kind.
|
|
150
|
+
*/
|
|
151
|
+
previousLabel: string | null;
|
|
152
|
+
/** The headline reading — the current period, or the window's end. */
|
|
153
|
+
currentText: string;
|
|
154
|
+
/** The badge's own signed change. */
|
|
155
|
+
changeText: string;
|
|
156
|
+
/** `changeText`'s other form, or `null` when it has none. */
|
|
157
|
+
secondaryText: string | null;
|
|
158
|
+
/** Which form `changeText` is in, so the other form's row can name itself. */
|
|
159
|
+
renderedMode: ArcDeltaMode;
|
|
160
|
+
direction: ArcDeltaDirection;
|
|
161
|
+
/** What the card's comparison line already says — `vs last month`, or the window's name or period. */
|
|
162
|
+
comparisonText: string;
|
|
163
|
+
/** The window's period. `null` on the period kind, which has no window. */
|
|
164
|
+
periodText: string | null;
|
|
165
|
+
}
|
|
166
|
+
interface MetricTargetInfo {
|
|
167
|
+
/** `value / target`, unclamped — 1.1 is 110% of target. */
|
|
168
|
+
ratio: number;
|
|
169
|
+
percentText: string;
|
|
170
|
+
/** Formatted amount represented by the displayed whole percentage × target. */
|
|
171
|
+
progressAmountText: string;
|
|
172
|
+
targetText: string;
|
|
173
|
+
/** Signed relative variance against the target, e.g. `-4.2%`. */
|
|
174
|
+
varianceText: string;
|
|
175
|
+
/** Which side of the target the value sits on — the variance badge's arrow. */
|
|
176
|
+
direction: ArcDeltaDirection;
|
|
177
|
+
met: boolean;
|
|
178
|
+
/** Meter fill: `success` once met, `destructive` when a lower-is-better metric overshoots, else `primary`. */
|
|
179
|
+
variant: "primary" | "success" | "destructive";
|
|
180
|
+
}
|
|
181
|
+
/** Every string the card renders or announces, so a product can localise it. Sentences are functions. */
|
|
182
|
+
interface MetricCardLabels {
|
|
183
|
+
/** Default comparison label when `comparisonLabel` is omitted. */
|
|
184
|
+
previousPeriod: string;
|
|
185
|
+
increase: string;
|
|
186
|
+
decrease: string;
|
|
187
|
+
unchanged: string;
|
|
188
|
+
ofTarget: string;
|
|
189
|
+
vsTarget: string;
|
|
190
|
+
/** Suffix for a percentage-point delta. */
|
|
191
|
+
percentagePoints: string;
|
|
192
|
+
noData: string;
|
|
193
|
+
noMatch: string;
|
|
194
|
+
clearFilters: string;
|
|
195
|
+
error: string;
|
|
196
|
+
retry: string;
|
|
197
|
+
insufficientTrend: string;
|
|
198
|
+
stale: string;
|
|
199
|
+
asOf: string;
|
|
200
|
+
tablePeriod: string;
|
|
201
|
+
tableValue: string;
|
|
202
|
+
/** Label for the dotted target reference line in chart details. */
|
|
203
|
+
target: string;
|
|
204
|
+
/** Highlight variant: the tooltip's start and end rows, its two change rows, the period row under a named window, and the marker read out on the table's highlighted rows. */
|
|
205
|
+
highlightStart: string;
|
|
206
|
+
highlightEnd: string;
|
|
207
|
+
highlightChange: string;
|
|
208
|
+
highlightChangePercent: string;
|
|
209
|
+
highlightRange: string;
|
|
210
|
+
highlighted: string;
|
|
211
|
+
/** Comparison line for the selected baseline when the card offers several — `vs last month`. */
|
|
212
|
+
versus: (baseline: string) => string;
|
|
213
|
+
/** Accessible name of the delta stack when it opens the compare-with menu — `Choose what Revenue is compared with`. */
|
|
214
|
+
chooseComparison: (name: string) => string;
|
|
215
|
+
/** Heading of the compare-with menu's options column, and the comparison line while no baseline is selected. */
|
|
216
|
+
compareWith: string;
|
|
217
|
+
/** The compare-with menu's one row on a tile given a single `previousValue` — the reading behind the badge. */
|
|
218
|
+
previous: string;
|
|
219
|
+
/** Column headers of the compare-with menu's changes — the relative move and the amount in the value's units. */
|
|
220
|
+
changePercent: string;
|
|
221
|
+
changeAmount: string;
|
|
222
|
+
/** Accessible name of the delta stack when it opens the highlight details popover — `Details of the Conversion rate highlight`. */
|
|
223
|
+
highlightDetails: (name: string) => string;
|
|
224
|
+
/** Caption of the details popover's table of the window's readings. */
|
|
225
|
+
highlightReadings: (name: string) => string;
|
|
226
|
+
/** The details popover's context rows: the stretch of the trend before the window, the stretch since it, and the latest reading. */
|
|
227
|
+
highlightBefore: string;
|
|
228
|
+
highlightSince: string;
|
|
229
|
+
highlightLatest: string;
|
|
230
|
+
markNames: Record<MetricTrendMark, string>;
|
|
231
|
+
showTable: (name: string) => string;
|
|
232
|
+
hideTable: (name: string) => string;
|
|
233
|
+
about: (name: string) => string;
|
|
234
|
+
loading: (name: string) => string;
|
|
235
|
+
tableCaption: (name: string) => string;
|
|
236
|
+
targetProgress: (name: string) => string;
|
|
237
|
+
/** Compact label/value rows explaining the target block's displayed values. */
|
|
238
|
+
targetExplanation: (target: MetricTargetInfo) => readonly (readonly [label: string, value: string])[];
|
|
239
|
+
/** Accessible name of the delta group beside the value. */
|
|
240
|
+
deltaComparison: (name: string) => string;
|
|
241
|
+
/** Compact label/value rows explaining the delta badge — the two readings behind it and the change in both forms. */
|
|
242
|
+
deltaExplanation: (delta: MetricDeltaExplanation) => readonly (readonly [label: string, value: string])[];
|
|
243
|
+
trendSummary: (count: number, first: string, last: string, min: string, max: string) => string;
|
|
244
|
+
chartDescription: (input: {
|
|
245
|
+
mark: string;
|
|
246
|
+
name: string;
|
|
247
|
+
count: number;
|
|
248
|
+
first: string;
|
|
249
|
+
last: string;
|
|
250
|
+
min: string;
|
|
251
|
+
max: string;
|
|
252
|
+
latest: string;
|
|
253
|
+
target: string | null;
|
|
254
|
+
}) => string;
|
|
255
|
+
/** The highlight variant's comparison sentence in the card description: `word` is the resolved direction word, `primary` the badge's unsigned change (empty when flat), `secondary` the other form or `null`. */
|
|
256
|
+
highlightSentence: (input: {
|
|
257
|
+
word: string;
|
|
258
|
+
primary: string;
|
|
259
|
+
secondary: string | null;
|
|
260
|
+
range: string;
|
|
261
|
+
label?: string;
|
|
262
|
+
from: string;
|
|
263
|
+
to: string;
|
|
264
|
+
}) => string;
|
|
265
|
+
/** Appended to the sparkline's `aria-label` for the highlight variant. */
|
|
266
|
+
highlightDescription: (input: {
|
|
267
|
+
range: string;
|
|
268
|
+
label?: string;
|
|
269
|
+
from: string;
|
|
270
|
+
to: string;
|
|
271
|
+
direction: ArcDeltaDirection;
|
|
272
|
+
primary: string;
|
|
273
|
+
}) => string;
|
|
274
|
+
/** Accessible name of the AI mark beside the insight sentence. */
|
|
275
|
+
insightMark: string;
|
|
276
|
+
/**
|
|
277
|
+
* The highlight variant's generated insight, as segments so the values —
|
|
278
|
+
* `from`, `to`, `change` and its other form `secondary` (unsigned; `null`
|
|
279
|
+
* when flat or undefined) — render in bold while the words stay plain.
|
|
280
|
+
*/
|
|
281
|
+
highlightInsight: (input: {
|
|
282
|
+
name: string;
|
|
283
|
+
direction: ArcDeltaDirection;
|
|
284
|
+
from: string;
|
|
285
|
+
to: string;
|
|
286
|
+
change: string;
|
|
287
|
+
secondary: string | null;
|
|
288
|
+
range: string;
|
|
289
|
+
label?: string;
|
|
290
|
+
}) => MetricInsightSegment[];
|
|
291
|
+
}
|
|
292
|
+
declare const DEFAULT_METRIC_LABELS: MetricCardLabels;
|
|
293
|
+
declare function resolveMetricLabels(overrides?: Partial<MetricCardLabels>): MetricCardLabels;
|
|
294
|
+
interface DeriveMetricStateInput {
|
|
295
|
+
status: MetricCardStatus;
|
|
296
|
+
/** A finite headline value exists. */
|
|
297
|
+
hasValue: boolean;
|
|
298
|
+
/** Anything is on screen already — a value or trend rows — so a reload is a refresh, not a first load. */
|
|
299
|
+
hasData: boolean;
|
|
300
|
+
filtered: boolean;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* The state machine. Error wins; loading over existing data is a refresh (the
|
|
304
|
+
* previous render stays under the veil); a missing value is `no-match` when
|
|
305
|
+
* the consumer's filter caused it and `empty` otherwise.
|
|
306
|
+
*/
|
|
307
|
+
declare function deriveMetricState({ status, hasValue, hasData, filtered }: DeriveMetricStateInput): MetricCardState;
|
|
308
|
+
/**
|
|
309
|
+
* Normalises `trend` for Vega and the table: temporal `x` becomes epoch
|
|
310
|
+
* milliseconds (numbers are treated as quantitative; pass a `Date` or an ISO
|
|
311
|
+
* string for time), invalid dates are dropped, `null` readings are kept as
|
|
312
|
+
* gaps, and the range and the latest reading are summarised for the text
|
|
313
|
+
* equivalents. Returns `null` when there is no trend at all.
|
|
314
|
+
*/
|
|
315
|
+
declare function normalizeTrend(points: readonly MetricTrendPoint[] | undefined, granularity?: ArcTimeGranularity): MetricTrendSummary | null;
|
|
316
|
+
interface DeriveDeltaOptions {
|
|
317
|
+
deltaMode: MetricDeltaMode;
|
|
318
|
+
goodDirection: MetricGoodDirection;
|
|
319
|
+
format: string;
|
|
320
|
+
locale?: string;
|
|
321
|
+
percentagePoints: string;
|
|
322
|
+
}
|
|
323
|
+
/** The comparison against the previous reading, with polarity resolved through `goodDirection`. */
|
|
324
|
+
declare function deriveDelta(value: number | null | undefined, previousValue: number | null | undefined, { deltaMode, goodDirection, format, locale, percentagePoints }: DeriveDeltaOptions): MetricDelta | null;
|
|
325
|
+
interface DeriveTargetOptions {
|
|
326
|
+
goodDirection: MetricGoodDirection;
|
|
327
|
+
format: string;
|
|
328
|
+
locale?: string;
|
|
329
|
+
formatValue?: (value: number) => string;
|
|
330
|
+
}
|
|
331
|
+
/** Progress against the target. `null` without a usable target (a zero target has no ratio). */
|
|
332
|
+
declare function deriveTarget(value: number | null | undefined, target: number | null | undefined, { goodDirection, format, locale, formatValue }: DeriveTargetOptions): MetricTargetInfo | null;
|
|
333
|
+
/**
|
|
334
|
+
* The granularity an x axis labels its ticks at: the tooltip and table keep
|
|
335
|
+
* the full form (`Sep 8, 2026`); a 250px axis has room for `Sep 8`.
|
|
336
|
+
*/
|
|
337
|
+
declare function axisGranularity(granularity: ArcTimeGranularity): ArcTimeGranularity;
|
|
338
|
+
interface MetricTextFormatters {
|
|
339
|
+
formatY: (value: number | null | undefined) => string;
|
|
340
|
+
formatX: (x: number | string) => string;
|
|
341
|
+
/** A period between two `x` values — a collapsed date range for a temporal axis (`Aug 7 – 9, 2026`), `start – end` otherwise. */
|
|
342
|
+
formatXRange: (start: number | string, end: number | string) => string;
|
|
343
|
+
}
|
|
344
|
+
/** The two formatters every text surface shares — headline, delta, table, tooltip, descriptions. */
|
|
345
|
+
declare function createMetricFormatters({ format, locale, timeZone, formatValue, xType, granularity }: {
|
|
346
|
+
format: string;
|
|
347
|
+
locale?: string;
|
|
348
|
+
timeZone?: string;
|
|
349
|
+
formatValue?: (value: number) => string;
|
|
350
|
+
xType: MetricTrendXType;
|
|
351
|
+
granularity: ArcTimeGranularity;
|
|
352
|
+
}): MetricTextFormatters;
|
|
353
|
+
interface ResolveHighlightOptions {
|
|
354
|
+
deltaMode: MetricDeltaMode;
|
|
355
|
+
goodDirection: MetricGoodDirection;
|
|
356
|
+
format: string;
|
|
357
|
+
locale?: string;
|
|
358
|
+
percentagePoints: string;
|
|
359
|
+
formatters: MetricTextFormatters;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Snaps a highlight window onto the trend and measures it. Each bound moves
|
|
363
|
+
* inward to the nearest finite reading (a temporal or quantitative bound need
|
|
364
|
+
* not hit a point exactly; an ordinal bound is a category label), the bounds
|
|
365
|
+
* may come in either order, and the result is `null` when the window does not
|
|
366
|
+
* hold two distinct finite readings — the card then draws the plain sparkline
|
|
367
|
+
* and stamps `data-highlight="unresolved"` rather than inventing a change.
|
|
368
|
+
*/
|
|
369
|
+
declare function resolveHighlight(summary: MetricTrendSummary | null | undefined, range: MetricHighlightRange | undefined, { deltaMode, goodDirection, format, locale, percentagePoints, formatters }: ResolveHighlightOptions): MetricHighlightInfo | null;
|
|
370
|
+
/**
|
|
371
|
+
* The highlight variant's default insight sentence — what the card shows
|
|
372
|
+
* beside the AI mark when the consumer passes no `insight`. The window's start
|
|
373
|
+
* and end readings and its change (in the badge's form, with the other form
|
|
374
|
+
* in brackets) come back as `{ value }` segments so the card can set them in
|
|
375
|
+
* bold; the words come from `labels.highlightInsight`.
|
|
376
|
+
*/
|
|
377
|
+
declare function buildHighlightInsight({ name, highlight, formatters, labels }: {
|
|
378
|
+
name: string;
|
|
379
|
+
highlight: MetricHighlightInfo;
|
|
380
|
+
formatters: MetricTextFormatters;
|
|
381
|
+
labels: MetricCardLabels;
|
|
382
|
+
}): MetricInsightSegment[];
|
|
383
|
+
/** The plain-text reading of insight segments — for descriptions and tests. */
|
|
384
|
+
declare function insightSegmentsToText(segments: readonly MetricInsightSegment[]): string;
|
|
385
|
+
/**
|
|
386
|
+
* The datasets the highlight sparkline reads, derived once per trend or window
|
|
387
|
+
* change: every row flagged with `hl` (bars colour themselves from it, the
|
|
388
|
+
* hover dot too), the context readings split into a `before` and an `after`
|
|
389
|
+
* run so the gray line stops at the window's edges, the window's own readings
|
|
390
|
+
* for the coloured segment, its two endpoint dots, and the one-row band. A
|
|
391
|
+
* continuous axis decides membership by `x`, an ordinal one by position.
|
|
392
|
+
*/
|
|
393
|
+
declare function buildHighlightDatasets(summary: MetricTrendSummary, info: MetricHighlightInfo): MetricHighlightDatasets;
|
|
394
|
+
/**
|
|
395
|
+
* One baseline the headline can be compared with — yesterday, last week, last
|
|
396
|
+
* month, last year. `key` identifies it for `comparison` (defaults to
|
|
397
|
+
* `label`); `value` is its reading, or `null` when the product has none for
|
|
398
|
+
* it yet — the baseline is then listed in the compare-with menu but cannot be
|
|
399
|
+
* chosen.
|
|
400
|
+
*/
|
|
401
|
+
interface MetricComparison {
|
|
402
|
+
key?: string;
|
|
403
|
+
label: string;
|
|
404
|
+
value: number | null;
|
|
405
|
+
}
|
|
406
|
+
/** The key of the one baseline a tile builds from `previousValue` for its compare-with menu. Never collides with a consumer's key. */
|
|
407
|
+
declare const METRIC_PREVIOUS_KEY = "__previous__";
|
|
408
|
+
/** A baseline after normalisation: a unique key, and a finite value or `null`. */
|
|
409
|
+
interface MetricComparisonRow {
|
|
410
|
+
key: string;
|
|
411
|
+
label: string;
|
|
412
|
+
value: number | null;
|
|
413
|
+
}
|
|
414
|
+
/** What the compare-with menu shows for one baseline: its reading, and the change the headline would show against it in both forms, with the polarity of that change. */
|
|
415
|
+
interface MetricComparisonCandidate {
|
|
416
|
+
row: MetricComparisonRow;
|
|
417
|
+
/** `null` when the baseline or the headline has no finite value. */
|
|
418
|
+
delta: MetricDelta | null;
|
|
419
|
+
polarity: MetricPolarity;
|
|
420
|
+
valueText: string;
|
|
421
|
+
/** The relative change, or `MISSING_VALUE` when it does not exist. */
|
|
422
|
+
percentText: string;
|
|
423
|
+
/** The change in the value's units, or `MISSING_VALUE`. */
|
|
424
|
+
amountText: string;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Normalises the baselines a metric tile offers: keys default to labels (a
|
|
428
|
+
* repeated key is suffixed so two options never collide), non-finite values
|
|
429
|
+
* become `null`. The consumer's order is kept — it is the menu's order.
|
|
430
|
+
*/
|
|
431
|
+
declare function normalizeComparisons(items: readonly MetricComparison[] | undefined): MetricComparisonRow[];
|
|
432
|
+
/**
|
|
433
|
+
* The selected baseline. `null` designates none; a key names one — an absent
|
|
434
|
+
* key selects none rather than a substitute, so the card never compares
|
|
435
|
+
* against something the app did not ask for; `undefined` takes the first
|
|
436
|
+
* baseline with a value, else the first baseline.
|
|
437
|
+
*/
|
|
438
|
+
declare function resolveComparison(rows: readonly MetricComparisonRow[], key: string | null | undefined): MetricComparisonRow | null;
|
|
439
|
+
interface DescribeComparisonsOptions extends DeriveDeltaOptions {
|
|
440
|
+
formatters: MetricTextFormatters;
|
|
441
|
+
}
|
|
442
|
+
/** The compare-with menu's table: every baseline with the change the headline would show against it, in percent and in the value's units. */
|
|
443
|
+
declare function describeComparisons(rows: readonly MetricComparisonRow[], value: number | null | undefined, { formatters, ...options }: DescribeComparisonsOptions): MetricComparisonCandidate[];
|
|
444
|
+
/** A reading as the details popover prints it. */
|
|
445
|
+
interface MetricHighlightReadingText {
|
|
446
|
+
x: number | string;
|
|
447
|
+
xText: string;
|
|
448
|
+
yText: string;
|
|
449
|
+
}
|
|
450
|
+
/** One reading inside the highlighted window, with its change from the previous finite reading inside it. */
|
|
451
|
+
interface MetricHighlightStep extends MetricHighlightReadingText {
|
|
452
|
+
/** The change from the previous finite reading in the window, in the card's `deltaMode`; `null` on the first reading and on a gap. */
|
|
453
|
+
changeText: string | null;
|
|
454
|
+
/** The polarity of that change through `goodDirection`; `neutral` without one. */
|
|
455
|
+
polarity: MetricPolarity;
|
|
456
|
+
role: "start" | "end" | "inside";
|
|
457
|
+
}
|
|
458
|
+
/** A stretch of the trend outside the window — from its first reading to the window's start, or from the window's end to its latest reading — measured end to end. */
|
|
459
|
+
interface MetricHighlightStretch {
|
|
460
|
+
from: MetricHighlightReadingText;
|
|
461
|
+
to: MetricHighlightReadingText;
|
|
462
|
+
/** The stretch's period — `Jul 25 – Aug 7, 2026`. */
|
|
463
|
+
rangeText: string;
|
|
464
|
+
/** The change over the stretch in the card's `deltaMode`, and its other form. */
|
|
465
|
+
changeText: string;
|
|
466
|
+
secondaryText: string | null;
|
|
467
|
+
direction: ArcDeltaDirection;
|
|
468
|
+
polarity: MetricPolarity;
|
|
469
|
+
}
|
|
470
|
+
/** What the highlight details popover shows beyond the window's own change. */
|
|
471
|
+
interface MetricHighlightDetails {
|
|
472
|
+
/** Every reading inside the window, in axis order, gaps included. */
|
|
473
|
+
steps: MetricHighlightStep[];
|
|
474
|
+
/** From the trend's first finite reading to the window's start; `null` when the window starts at the first reading. */
|
|
475
|
+
before: MetricHighlightStretch | null;
|
|
476
|
+
/** From the window's end to the trend's latest finite reading; `null` when the window ends at the latest reading. */
|
|
477
|
+
since: MetricHighlightStretch | null;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* The detail behind a resolved window — what the sparkline cannot show at
|
|
481
|
+
* tile scale: the readings inside the window one by one, each with its step
|
|
482
|
+
* from the previous finite reading, and the trend's movement before the
|
|
483
|
+
* window and since it, so the reader can tell a step change from a slide and
|
|
484
|
+
* a recovery from a plateau. A continuous axis decides membership by `x`, an
|
|
485
|
+
* ordinal one by position.
|
|
486
|
+
*/
|
|
487
|
+
declare function buildHighlightDetails(summary: MetricTrendSummary, info: MetricHighlightInfo, { deltaMode, goodDirection, format, locale, percentagePoints, formatters }: ResolveHighlightOptions): MetricHighlightDetails;
|
|
488
|
+
interface BuildMetricDescriptionInput {
|
|
489
|
+
name: string;
|
|
490
|
+
state: MetricCardState;
|
|
491
|
+
valueText: string;
|
|
492
|
+
unit?: string;
|
|
493
|
+
delta: MetricDelta | null;
|
|
494
|
+
comparisonText: string;
|
|
495
|
+
target: MetricTargetInfo | null;
|
|
496
|
+
trend: MetricTrendSummary | null;
|
|
497
|
+
formatters: MetricTextFormatters;
|
|
498
|
+
asOfText?: string;
|
|
499
|
+
labels: MetricCardLabels;
|
|
500
|
+
/** The highlight variant's resolved window; its change replaces the previous-period sentence. */
|
|
501
|
+
highlight?: MetricHighlightInfo | null;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* The card's text equivalent (Amy Cesal's alt-text formula: what it is, what
|
|
505
|
+
* it shows, why it is here, when it was true) — the figure's accessible
|
|
506
|
+
* description, and the summary a screen reader gets before the parts.
|
|
507
|
+
*/
|
|
508
|
+
declare function buildMetricDescription({ name, state, valueText, unit, delta, comparisonText, target, trend, formatters, asOfText, labels, highlight }: BuildMetricDescriptionInput): string;
|
|
509
|
+
/** The sparkline's own `description` — the `aria-label` Vega stamps on the `graphics-document`. */
|
|
510
|
+
declare function buildMetricChartDescription({ name, mark, trend, target, formatters, labels, highlight }: {
|
|
511
|
+
name: string;
|
|
512
|
+
mark: MetricTrendMark;
|
|
513
|
+
trend: MetricTrendSummary;
|
|
514
|
+
target: MetricTargetInfo | null;
|
|
515
|
+
formatters: MetricTextFormatters;
|
|
516
|
+
labels: MetricCardLabels;
|
|
517
|
+
/** The highlight variant's resolved window, described after the series. */
|
|
518
|
+
highlight?: MetricHighlightInfo | null;
|
|
519
|
+
}): string;
|
|
520
|
+
//#endregion
|
|
521
|
+
export { BuildMetricDescriptionInput, DEFAULT_METRIC_LABELS, DeriveDeltaOptions, DeriveMetricStateInput, DeriveTargetOptions, DescribeComparisonsOptions, METRIC_PREVIOUS_KEY, MetricCardLabels, MetricCardSize, MetricCardState, MetricCardStatus, MetricCardVariant, MetricComparison, MetricComparisonCandidate, MetricComparisonRow, MetricDelta, MetricDeltaExplanation, MetricDeltaMode, MetricGoodDirection, MetricHighlightBand, MetricHighlightContextRow, MetricHighlightDatasets, MetricHighlightDetails, MetricHighlightInfo, MetricHighlightPoint, MetricHighlightRange, MetricHighlightReading, MetricHighlightReadingText, MetricHighlightStep, MetricHighlightStretch, MetricHighlightTrendRow, MetricInsightSegment, MetricPolarity, MetricTargetInfo, MetricTextFormatters, MetricTrendAxes, MetricTrendMark, MetricTrendPoint, MetricTrendRow, MetricTrendScale, MetricTrendSummary, MetricTrendXType, ResolveHighlightOptions, axisGranularity, buildHighlightDatasets, buildHighlightDetails, buildHighlightInsight, buildMetricChartDescription, buildMetricDescription, createMetricFormatters, deriveDelta, deriveMetricState, deriveTarget, describeComparisons, insightSegmentsToText, normalizeComparisons, normalizeTrend, resolveComparison, resolveHighlight, resolveMetricLabels };
|