@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.
Files changed (156) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +13 -0
  2. package/dist/components/AnomalyCard/AnomalyCard.chart.d.ts +64 -0
  3. package/dist/components/AnomalyCard/AnomalyCard.chart.js +341 -0
  4. package/dist/components/AnomalyCard/AnomalyCard.d.ts +169 -0
  5. package/dist/components/AnomalyCard/AnomalyCard.js +1019 -0
  6. package/dist/components/AnomalyCard/AnomalyCard.model.d.ts +508 -0
  7. package/dist/components/AnomalyCard/AnomalyCard.model.js +553 -0
  8. package/dist/components/AnomalyCard/index.d.ts +4 -0
  9. package/dist/components/AnomalyCard/index.js +4 -0
  10. package/dist/components/ChartCard/ChartCard.chart.d.ts +72 -0
  11. package/dist/components/ChartCard/ChartCard.chart.js +1333 -0
  12. package/dist/components/ChartCard/ChartCard.d.ts +206 -0
  13. package/dist/components/ChartCard/ChartCard.js +718 -0
  14. package/dist/components/ChartCard/ChartCard.model.d.ts +452 -0
  15. package/dist/components/ChartCard/ChartCard.model.js +1223 -0
  16. package/dist/components/ChartCard/index.d.ts +4 -0
  17. package/dist/components/ChartCard/index.js +4 -0
  18. package/dist/components/ComparisonCard/ComparisonCard.chart.d.ts +80 -0
  19. package/dist/components/ComparisonCard/ComparisonCard.chart.js +337 -0
  20. package/dist/components/ComparisonCard/ComparisonCard.d.ts +200 -0
  21. package/dist/components/ComparisonCard/ComparisonCard.js +1325 -0
  22. package/dist/components/ComparisonCard/ComparisonCard.model.d.ts +309 -0
  23. package/dist/components/ComparisonCard/ComparisonCard.model.js +263 -0
  24. package/dist/components/ComparisonCard/index.d.ts +4 -0
  25. package/dist/components/ComparisonCard/index.js +4 -0
  26. package/dist/components/ForecastCard/ForecastCard.chart.d.ts +82 -0
  27. package/dist/components/ForecastCard/ForecastCard.chart.js +416 -0
  28. package/dist/components/ForecastCard/ForecastCard.d.ts +148 -0
  29. package/dist/components/ForecastCard/ForecastCard.js +1029 -0
  30. package/dist/components/ForecastCard/ForecastCard.model.d.ts +497 -0
  31. package/dist/components/ForecastCard/ForecastCard.model.js +554 -0
  32. package/dist/components/ForecastCard/index.d.ts +4 -0
  33. package/dist/components/ForecastCard/index.js +4 -0
  34. package/dist/components/HighlightCard/HighlightCard.chart.d.ts +122 -0
  35. package/dist/components/HighlightCard/HighlightCard.chart.js +660 -0
  36. package/dist/components/HighlightCard/HighlightCard.d.ts +202 -0
  37. package/dist/components/HighlightCard/HighlightCard.js +1286 -0
  38. package/dist/components/HighlightCard/HighlightCard.model.d.ts +692 -0
  39. package/dist/components/HighlightCard/HighlightCard.model.js +875 -0
  40. package/dist/components/HighlightCard/index.d.ts +4 -0
  41. package/dist/components/HighlightCard/index.js +4 -0
  42. package/dist/components/InsightCard/InsightCard.chart.d.ts +91 -0
  43. package/dist/components/InsightCard/InsightCard.chart.js +471 -0
  44. package/dist/components/InsightCard/InsightCard.d.ts +161 -0
  45. package/dist/components/InsightCard/InsightCard.js +961 -0
  46. package/dist/components/InsightCard/InsightCard.model.d.ts +405 -0
  47. package/dist/components/InsightCard/InsightCard.model.js +421 -0
  48. package/dist/components/InsightCard/index.d.ts +4 -0
  49. package/dist/components/InsightCard/index.js +4 -0
  50. package/dist/components/MetricCard/MetricCard.chart.d.ts +79 -0
  51. package/dist/components/MetricCard/MetricCard.chart.js +435 -0
  52. package/dist/components/MetricCard/MetricCard.d.ts +227 -0
  53. package/dist/components/MetricCard/MetricCard.js +1293 -0
  54. package/dist/components/MetricCard/MetricCard.model.d.ts +521 -0
  55. package/dist/components/MetricCard/MetricCard.model.js +627 -0
  56. package/dist/components/MetricCard/index.d.ts +4 -0
  57. package/dist/components/MetricCard/index.js +4 -0
  58. package/dist/components/ProfileCard/ProfileCard.chart.d.ts +64 -0
  59. package/dist/components/ProfileCard/ProfileCard.chart.js +427 -0
  60. package/dist/components/ProfileCard/ProfileCard.d.ts +140 -0
  61. package/dist/components/ProfileCard/ProfileCard.js +735 -0
  62. package/dist/components/ProfileCard/ProfileCard.model.d.ts +279 -0
  63. package/dist/components/ProfileCard/ProfileCard.model.js +244 -0
  64. package/dist/components/ProfileCard/index.d.ts +4 -0
  65. package/dist/components/ProfileCard/index.js +4 -0
  66. package/dist/components/ProgressCard/ProgressCard.chart.d.ts +73 -0
  67. package/dist/components/ProgressCard/ProgressCard.chart.js +373 -0
  68. package/dist/components/ProgressCard/ProgressCard.d.ts +137 -0
  69. package/dist/components/ProgressCard/ProgressCard.js +908 -0
  70. package/dist/components/ProgressCard/ProgressCard.model.d.ts +385 -0
  71. package/dist/components/ProgressCard/ProgressCard.model.js +389 -0
  72. package/dist/components/ProgressCard/index.d.ts +4 -0
  73. package/dist/components/ProgressCard/index.js +4 -0
  74. package/dist/components/ReportCard/ReportCard.chart.d.ts +45 -0
  75. package/dist/components/ReportCard/ReportCard.chart.js +231 -0
  76. package/dist/components/ReportCard/ReportCard.d.ts +153 -0
  77. package/dist/components/ReportCard/ReportCard.js +1118 -0
  78. package/dist/components/ReportCard/ReportCard.model.d.ts +392 -0
  79. package/dist/components/ReportCard/ReportCard.model.js +399 -0
  80. package/dist/components/ReportCard/index.d.ts +4 -0
  81. package/dist/components/ReportCard/index.js +4 -0
  82. package/dist/components/SankeyCard/SankeyCard.chart.d.ts +75 -0
  83. package/dist/components/SankeyCard/SankeyCard.chart.js +249 -0
  84. package/dist/components/SankeyCard/SankeyCard.d.ts +185 -0
  85. package/dist/components/SankeyCard/SankeyCard.js +788 -0
  86. package/dist/components/SankeyCard/SankeyCard.model.d.ts +501 -0
  87. package/dist/components/SankeyCard/SankeyCard.model.js +789 -0
  88. package/dist/components/SankeyCard/index.d.ts +4 -0
  89. package/dist/components/SankeyCard/index.js +4 -0
  90. package/dist/components/StatusCard/StatusCard.chart.d.ts +60 -0
  91. package/dist/components/StatusCard/StatusCard.chart.js +188 -0
  92. package/dist/components/StatusCard/StatusCard.d.ts +176 -0
  93. package/dist/components/StatusCard/StatusCard.js +989 -0
  94. package/dist/components/StatusCard/StatusCard.model.d.ts +555 -0
  95. package/dist/components/StatusCard/StatusCard.model.js +776 -0
  96. package/dist/components/StatusCard/index.d.ts +4 -0
  97. package/dist/components/StatusCard/index.js +4 -0
  98. package/dist/components/TableCard/TableCard.chart.d.ts +53 -0
  99. package/dist/components/TableCard/TableCard.chart.js +192 -0
  100. package/dist/components/TableCard/TableCard.d.ts +140 -0
  101. package/dist/components/TableCard/TableCard.js +811 -0
  102. package/dist/components/TableCard/TableCard.model.d.ts +381 -0
  103. package/dist/components/TableCard/TableCard.model.js +475 -0
  104. package/dist/components/TableCard/index.d.ts +4 -0
  105. package/dist/components/TableCard/index.js +4 -0
  106. package/dist/components/TargetCard/TargetCard.chart.d.ts +52 -0
  107. package/dist/components/TargetCard/TargetCard.chart.js +273 -0
  108. package/dist/components/TargetCard/TargetCard.d.ts +143 -0
  109. package/dist/components/TargetCard/TargetCard.js +910 -0
  110. package/dist/components/TargetCard/TargetCard.model.d.ts +468 -0
  111. package/dist/components/TargetCard/TargetCard.model.js +581 -0
  112. package/dist/components/TargetCard/index.d.ts +4 -0
  113. package/dist/components/TargetCard/index.js +4 -0
  114. package/dist/components/TreeCard/TreeCard.chart.d.ts +80 -0
  115. package/dist/components/TreeCard/TreeCard.chart.js +178 -0
  116. package/dist/components/TreeCard/TreeCard.d.ts +182 -0
  117. package/dist/components/TreeCard/TreeCard.js +1187 -0
  118. package/dist/components/TreeCard/TreeCard.model.d.ts +330 -0
  119. package/dist/components/TreeCard/TreeCard.model.js +401 -0
  120. package/dist/components/TreeCard/index.d.ts +4 -0
  121. package/dist/components/TreeCard/index.js +4 -0
  122. package/dist/components/TrendCard/TrendCard.chart.d.ts +75 -0
  123. package/dist/components/TrendCard/TrendCard.chart.js +393 -0
  124. package/dist/components/TrendCard/TrendCard.d.ts +224 -0
  125. package/dist/components/TrendCard/TrendCard.js +1053 -0
  126. package/dist/components/TrendCard/TrendCard.model.d.ts +545 -0
  127. package/dist/components/TrendCard/TrendCard.model.js +623 -0
  128. package/dist/components/TrendCard/index.d.ts +4 -0
  129. package/dist/components/TrendCard/index.js +4 -0
  130. package/dist/index.d.ts +76 -0
  131. package/dist/index.js +57 -0
  132. package/dist/lib/vega/ArcVegaChart.d.ts +24 -0
  133. package/dist/lib/vega/ArcVegaChart.js +42 -0
  134. package/dist/lib/vega/ArcVegaSurface.d.ts +13 -0
  135. package/dist/lib/vega/ArcVegaSurface.js +38 -0
  136. package/dist/lib/vega/axisTicks.js +156 -0
  137. package/dist/lib/vega/config.d.ts +29 -0
  138. package/dist/lib/vega/config.js +113 -0
  139. package/dist/lib/vega/embed.d.ts +29 -0
  140. package/dist/lib/vega/embed.js +29 -0
  141. package/dist/lib/vega/engine.d.ts +10 -0
  142. package/dist/lib/vega/engine.js +6 -0
  143. package/dist/lib/vega/formatters.d.ts +125 -0
  144. package/dist/lib/vega/formatters.js +277 -0
  145. package/dist/lib/vega/index.d.ts +11 -0
  146. package/dist/lib/vega/load.d.ts +13 -0
  147. package/dist/lib/vega/load.js +21 -0
  148. package/dist/lib/vega/time.d.ts +45 -0
  149. package/dist/lib/vega/time.js +105 -0
  150. package/dist/lib/vega/tokens.d.ts +73 -0
  151. package/dist/lib/vega/tokens.js +137 -0
  152. package/dist/lib/vega/tooltip.d.ts +45 -0
  153. package/dist/lib/vega/tooltip.js +124 -0
  154. package/dist/lib/vega/useArcVega.d.ts +43 -0
  155. package/dist/lib/vega/useArcVega.js +121 -0
  156. package/package.json +60 -0
@@ -0,0 +1,202 @@
1
+ import { ArcTimeGranularity } from "../../lib/vega/formatters.js";
2
+ import { HighlightBaseline, HighlightCardLabels, HighlightCardSize, HighlightCardStatus, HighlightDeltaMode, HighlightDriver, HighlightGoodDirection, HighlightMark, HighlightPeerMode, HighlightPoint, HighlightScale, HighlightSection, HighlightSeverityThresholds, HighlightWindow } from "./HighlightCard.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/HighlightCard/HighlightCard.d.ts
8
+ interface HighlightCardProps extends Omit<BoxProps, "children" | "padding" | "title"> {
9
+ /** The metric'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
+ /** 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 metric's readings: `{ x, y }` where `x` is a `Date`, an ISO string, a
17
+ * number or a period label, and `y` the value or `null` for a period with no
18
+ * reading (drawn as a gap, never as zero). Rows are sorted along the axis
19
+ * for a temporal or quantitative series; an ordinal series keeps the order
20
+ * you pass, which IS its axis. Pass `[]` while loading to reserve the
21
+ * panel's height.
22
+ */
23
+ series: readonly HighlightPoint[];
24
+ /**
25
+ * The window under analysis: `{ start, end, label? }` in the series' own `x`
26
+ * type. Each bound snaps inward to the nearest finite reading, so a window
27
+ * may begin or end on a gap. A window without two distinct readings is
28
+ * unresolved — the panel says so and stamps `data-window="unresolved"`
29
+ * rather than inventing a change. Pass stable values (ISO strings or
30
+ * memoized `Date`s): the window is re-resolved when they change.
31
+ */
32
+ highlight: HighlightWindow;
33
+ /**
34
+ * What drove the change: `{ key?, label, contribution }` — the signed amount
35
+ * each contributor added, in the value's own units — or `{ from, to }` per
36
+ * contributor, from which the contribution is the difference. Whatever the
37
+ * parts do not account for is drawn and named as an explicit `Unexplained`
38
+ * row, so the decomposition always reconciles with the window's own change
39
+ * or admits that it does not. Omitted, the `drivers` section is not drawn.
40
+ */
41
+ drivers?: readonly HighlightDriver[];
42
+ /**
43
+ * Which analysis sections the panel draws, in this order: `context` (the
44
+ * window inside the whole series), `peers` (how its change compares with
45
+ * every comparable window) and `drivers` (what the change decomposes into).
46
+ * Default all three; a section with no data to draw is skipped. Stamped as
47
+ * `data-sections`.
48
+ */
49
+ sections?: readonly HighlightSection[];
50
+ /**
51
+ * Which comparable windows the change is placed among. `rolling` (default)
52
+ * takes a window of the same length at every offset — the most peers, but
53
+ * overlapping windows share readings, so the spread is narrower than
54
+ * independent sampling would give. `adjacent` tiles non-overlapping windows
55
+ * aligned to the highlight's own start: fewer peers, and the statistically
56
+ * honest set. Either way the panel reports a comparison, never a
57
+ * significance test. Stamped as `data-peers`.
58
+ */
59
+ peerMode?: HighlightPeerMode;
60
+ /**
61
+ * How the placement is expressed. `sigma` (default) reports the typical
62
+ * change, the standard deviation and the window's distance from the mean in
63
+ * them, with the typical range as mean ± 1 sd. `percentile` reports where
64
+ * the change falls in the sorted peers, with the typical range as the 10th
65
+ * to 90th percentile. Stamped as `data-baseline`.
66
+ */
67
+ baseline?: HighlightBaseline;
68
+ /**
69
+ * Fewer comparable windows than this and the `peers` section is not drawn —
70
+ * the panel says there are not enough instead of calling one window out of
71
+ * three "extreme". Default 4.
72
+ */
73
+ minPeers?: number;
74
+ /**
75
+ * Where the verdict boundaries fall: compared against the absolute distance
76
+ * from the mean in standard deviations for the `sigma` baseline (defaults 1
77
+ * / 2 / 3), and against the distance from the median percentile, 0–50, for
78
+ * `percentile` (defaults 40 / 45 / 49 — outside p10–p90, p5–p95, p1–p99). A
79
+ * documented heuristic on the spread of comparable windows, not a test.
80
+ */
81
+ severityThresholds?: HighlightSeverityThresholds;
82
+ /**
83
+ * Fold every driver past this count (by absolute contribution) into one
84
+ * `Other` row whose contribution is their sum — honest only for additive
85
+ * measures, which passing this asserts. Stamped as `data-folded`.
86
+ */
87
+ driverLimit?: number;
88
+ /**
89
+ * How far the contributions may miss the window's own change and still
90
+ * reconcile, as a fraction of that change. Inside it the panel says the
91
+ * parts sum to the total; outside it an `Unexplained` row is drawn. Default
92
+ * `0.005`. Stamped as `data-reconciles`.
93
+ */
94
+ driverTolerance?: number;
95
+ /**
96
+ * Key of the driver the reader has drilled into, controlled — pair with
97
+ * `onDriverSelect`. Omit for the uncontrolled panel
98
+ * (`defaultSelectedDriver`, else none).
99
+ */
100
+ selectedDriver?: string | null;
101
+ /** The drilled driver on first render when `selectedDriver` is uncontrolled. */
102
+ defaultSelectedDriver?: string;
103
+ /**
104
+ * Called with a driver's key when the reader picks it. Setting it makes each
105
+ * driver row a real button — the keyboard path to a drill-through, since
106
+ * Vega has none — and the bars forward their own clicks to it.
107
+ */
108
+ onDriverSelect?: (key: string) => void;
109
+ /** `line` (default, may crop), `area` (zero baseline) or `bar` (zero baseline, discrete periods) for the context plot. */
110
+ mark?: HighlightMark;
111
+ /** Y-scale baseline for a `line` context plot: `auto` (default) fits the data range and reads for shape; `zero` includes zero. Areas and bars always include zero. */
112
+ scale?: HighlightScale;
113
+ /** Draw the context plot's axes with grid lines and labels. Default `true`; `false` shrinks it toward a sparkline — the tables still carry every value. */
114
+ axes?: boolean;
115
+ /** Context-plot height in pixels, axes included. Defaults per `size` (132 / 176 / 216), plus 24 when `axes` draws the x labels. */
116
+ contextHeight?: number;
117
+ /** `percent` (default) is relative change; `absolute` is the difference in the value's units — percentage points for a percent format. Also the unit of the peer strip's axis. */
118
+ deltaMode?: HighlightDeltaMode;
119
+ /**
120
+ * Which direction is good. Drives the polarity of the headline, the window's
121
+ * hue, the marked peer and every driver bar: `up` (revenue), `down` (churn,
122
+ * latency, cost) or `none` (headcount — everything stays neutral). Default
123
+ * `up`.
124
+ */
125
+ goodDirection?: HighlightGoodDirection;
126
+ /**
127
+ * Number format for every reading, contribution, axis, tooltip and table —
128
+ * one grammar so nothing rounds two ways: `number[:digits]`, `integer`,
129
+ * `compact[:digits]`, `percent[:digits]`, `currency:CODE[:digits|compact]`.
130
+ * Default `compact`.
131
+ */
132
+ format?: string;
133
+ /** Custom formatter for values. Takes precedence over `format` everywhere a reading is rendered. */
134
+ formatValue?: (value: number) => string;
135
+ /** Unit shown after the readings line in the muted role (`ms`, `req/s`). Prefer `format="currency:…"` for money. */
136
+ unit?: ReactNode;
137
+ /** Period granularity of temporal `x` values for the axis, tooltips and tables. Inferred from the spacing when omitted. */
138
+ granularity?: ArcTimeGranularity;
139
+ /**
140
+ * The takeaway in a sentence, rendered beside the AI mark under the
141
+ * sections — the insight slot. Wrap values in `<strong>` to set them in
142
+ * bold. Omitted, the panel generates one from the window, its placement and
143
+ * its largest driver; pass `null` or `false` to render none.
144
+ */
145
+ insight?: ReactNode;
146
+ /** The transport's status. `loading` with a series already present is a refresh: the previous render stays under the veil. Default `ready`. */
147
+ status?: HighlightCardStatus;
148
+ /** The consumer's filter is active — no readings then reads as no-match rather than empty, with a clear-filters action when `onClearFilters` is set. */
149
+ filtered?: boolean;
150
+ /** The data is older than the product's freshness rule (TanStack Query's `isStale`). Shows a badge and stamps `data-stale`. */
151
+ stale?: boolean;
152
+ /** When the data was last true. Rendered as an "as of" line and included in the description. */
153
+ updatedAt?: Date | string | number;
154
+ /**
155
+ * How `updatedAt` is written, as a time-grammar granularity — `day`
156
+ * (default), `datetime`, `time`, `month`, `year` — or a formatter for a
157
+ * custom form. Applies to the as-of line and the description alike, in the
158
+ * panel's `locale` and `timeZone`.
159
+ */
160
+ updatedAtFormat?: ArcTimeGranularity | ((date: Date) => string);
161
+ /** Recovery action for the error state; renders a retry button when set. */
162
+ onRetry?: () => void;
163
+ /** Recovery action for the no-match state; renders a clear-filters button when set. */
164
+ onClearFilters?: () => void;
165
+ /** Density: `sm` for dense grids, `md` (default), `lg` for a hero panel. Scales type, padding, plot heights and the driver row step. */
166
+ size?: HighlightCardSize;
167
+ /** Heading level of the label for the document outline. Default 3 — panels usually sit under a page's h2; the section headings take the next level down. */
168
+ titleLevel?: 2 | 3 | 4 | 5 | 6;
169
+ /** BCP 47 locale for every number and date. Defaults to the runtime's. Thai products on the Gregorian calendar pass `th-TH-u-ca-gregory`. */
170
+ locale?: string;
171
+ /** IANA time zone for dates. Defaults to the runtime's — pass it for deterministic output and single-business-zone reporting. */
172
+ timeZone?: string;
173
+ /** Overrides for every rendered or announced string. */
174
+ labels?: Partial<HighlightCardLabels>;
175
+ /** Replaces the generated accessible description of the whole panel (the figure's `aria-describedby` text). */
176
+ description?: string;
177
+ /** Trailing header slot — a ghost `Button` or `Menu` for drill-through, export, or settings. */
178
+ action?: ReactNode;
179
+ /** Open the data popover on first render, anchored to the panel. */
180
+ defaultTableOpen?: boolean;
181
+ /** Hide the header info button for the data popover. Only when another surface exposes the same values to keyboard and screen-reader users. */
182
+ hideTableToggle?: boolean;
183
+ /** Called with vega-embed's result once each plot mounts, with the section it belongs to — for `view` access in advanced compositions. */
184
+ onEmbed?: (result: Result, section: HighlightSection) => void;
185
+ /** Escape hatch: transform a plot's spec before it renders, by section. Voids the token and accessibility guarantees for whatever it changes. */
186
+ patchSpec?: (spec: TopLevelSpec, section: HighlightSection) => TopLevelSpec;
187
+ }
188
+ /**
189
+ * A highlight-analysis panel: one window of a metric, established and
190
+ * explained. The change across the window is the headline; the window is
191
+ * painted inside the whole series; its change is placed among the changes of
192
+ * every comparable window as a strip plot with a typical range and a verdict;
193
+ * and the change is decomposed into signed driver contributions that reconcile
194
+ * with it — plus every loading, empty, error and stale state, layout-stable,
195
+ * with generated text equivalents and a table for every plot.
196
+ *
197
+ * Where `MetricCard variant="highlight"` asserts that a window moved and by
198
+ * how much, HighlightCard answers "is that unusual, and what drove it".
199
+ */
200
+ declare const HighlightCard: import("react").ForwardRefExoticComponent<HighlightCardProps & import("react").RefAttributes<HTMLElement>>;
201
+ //#endregion
202
+ export { HighlightCard, HighlightCardProps };