@gntik-ai/charts 0.0.0-stage → 0.5.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.
@@ -0,0 +1,642 @@
1
+
2
+ import { TooltipContentProps } from "recharts";
3
+ import { FocusEvent, ReactNode, Ref, SVGAttributes } from "react";
4
+ import { Theme } from "@gntik-ai/tokens/runtime";
5
+ //#region src/theme.d.ts
6
+ /** Series colour name → brand token. Green primary is the hero; the rest are categorical accents. */
7
+ export declare const SERIES_TOKENS: {
8
+ readonly primary: "--primary";
9
+ readonly emerald: "--brand-accent";
10
+ readonly violet: "--category-violet";
11
+ readonly cyan: "--category-cyan";
12
+ readonly amber: "--category-amber";
13
+ readonly rose: "--category-rose";
14
+ readonly info: "--info";
15
+ };
16
+ type ChartColor = keyof typeof SERIES_TOKENS;
17
+ /**
18
+ * Default series order: primary first, then the categorical accents ordered so every adjacent
19
+ * pair differs in luminance by ≥ 1.5:1 in all three themes (see `palette.ts`).
20
+ */
21
+ export declare const CHART_COLORS: readonly ChartColor[];
22
+ interface ChartTheme {
23
+ /** Active theme ("dark" | "light" | "high_contrast"); "dark" on the server and during hydration. */
24
+ theme: Theme;
25
+ grid: string;
26
+ axis: string;
27
+ text: string;
28
+ /** Line/area hover cursor. */
29
+ cursor: string;
30
+ /** Bar hover band. */
31
+ barCursor: string;
32
+ /** Card surface (donut slice separators). */
33
+ surface: string;
34
+ /** Colour for a series name, with optional alpha (0–1). */
35
+ color: (name: ChartColor, alpha?: number) => string;
36
+ }
37
+ interface UseChartThemeOptions {
38
+ /**
39
+ * Resolve the tokens to concrete `hsl(h s% l%)` strings (read from the DOM after hydration),
40
+ * for consumers that cannot use `var()` (canvas, colour maths). Default: `hsl(var(--token))`.
41
+ */
42
+ resolved?: boolean;
43
+ }
44
+ /**
45
+ * Brand colours for Recharts. By default every colour is a `hsl(var(--token))` string: SVG
46
+ * fill/stroke attributes and inline styles resolve it, so server and client render the same
47
+ * markup and a theme switch re-skins the chart without re-rendering. `theme` follows the
48
+ * <html> class after mount. With `{ resolved: true }` colours are read from the live CSS
49
+ * variables once mounted (the server and hydration render use the `var()` strings).
50
+ */
51
+ export declare function useChartTheme({ resolved }?: UseChartThemeOptions): ChartTheme;
52
+ //#endregion
53
+ //#region src/format.d.ts
54
+ /** Formats a numeric value for axes, tooltips and legends. */
55
+ type ValueFormatter = (value: number) => string;
56
+ /** Ready-made value formatters (en-US). */
57
+ export declare const chartFmt: {
58
+ usd: (n: number) => string;
59
+ usd2: (n: number) => string;
60
+ usdCompact: (n: number) => string;
61
+ num: (n: number) => string;
62
+ compact: (n: number) => string;
63
+ ms: (n: number) => string;
64
+ pct: (n: number) => string;
65
+ /** Ratio (0–1) → percent with up to one decimal: `0.125` → `12.5%`. */
66
+ percent: (n: number) => string;
67
+ /** Signed ratio for deltas: `0.042` → `+4.2%`, `-0.1` → `−10%`. */
68
+ percentDelta: (n: number) => string;
69
+ /** Milliseconds → the two largest units: `850` → `850 ms`, `2400` → `2.4 s`, `3_723_000` → `1h 2m`. */
70
+ duration: (n: number) => string;
71
+ /** Seconds → like `duration`: `90` → `1m 30s`. */
72
+ durationS: (n: number) => string;
73
+ /** Bytes → decimal SI units: `1536` → `1.5 kB`, `2_000_000_000` → `2 GB`. */
74
+ bytes: (n: number) => string;
75
+ };
76
+ //#endregion
77
+ //#region src/states.d.ts
78
+ /** Lifecycle of a chart's data. `ready` with no rows renders the empty state. */
79
+ type ChartState = 'ready' | 'loading' | 'empty' | 'error';
80
+ /** State props shared by every chart. */
81
+ interface ChartStateProps {
82
+ /** Data lifecycle. Default `ready` (an empty `data` array still shows the empty state). */
83
+ state?: ChartState;
84
+ /** Message of the empty state. */
85
+ emptyMessage?: ReactNode;
86
+ /** Message of the error state. */
87
+ errorMessage?: ReactNode;
88
+ /** Shows a "Retry" button in the error state. */
89
+ onRetry?: () => void;
90
+ /** Renders a visually hidden data table (screen-reader fallback of the plotted values). */
91
+ dataTable?: boolean;
92
+ }
93
+ interface ChartEmptyProps {
94
+ height?: number;
95
+ children?: ReactNode;
96
+ className?: string;
97
+ }
98
+ /** Placeholder for a chart without data. */
99
+ export declare function ChartEmpty({ height, children, className }: ChartEmptyProps): import("react").JSX.Element;
100
+ interface ChartLoadingProps {
101
+ height?: number;
102
+ /** Accessible label of the busy region. */
103
+ label?: string;
104
+ className?: string;
105
+ }
106
+ /** Skeleton plot (bars over a baseline); the pulse stops under prefers-reduced-motion. */
107
+ export declare function ChartLoading({ height, label, className }: ChartLoadingProps): import("react").JSX.Element;
108
+ interface ChartErrorProps {
109
+ height?: number;
110
+ children?: ReactNode;
111
+ onRetry?: () => void;
112
+ className?: string;
113
+ }
114
+ /** Error placeholder with an optional retry action. */
115
+ export declare function ChartError({ height, children, onRetry, className }: ChartErrorProps): import("react").JSX.Element;
116
+ interface ChartDataTableProps {
117
+ caption: string;
118
+ /** Column headers; the first column is the row header. */
119
+ columns: readonly string[];
120
+ rows: ReadonlyArray<readonly ReactNode[]>;
121
+ /** Show the table instead of hiding it visually. */
122
+ visible?: boolean;
123
+ }
124
+ /** Plain data table: a screen-reader fallback for a chart (visually hidden by default). */
125
+ export declare function ChartDataTable({ caption, columns, rows, visible }: ChartDataTableProps): import("react").JSX.Element;
126
+ //#endregion
127
+ //#region src/shared.d.ts
128
+ /** Keys of a datum (string keys only). */
129
+ type DataKey<T> = Extract<keyof T, string>;
130
+ /** Props shared by every cartesian chart (Tremor-like API). */
131
+ interface BaseChartProps<T extends object> extends ChartStateProps {
132
+ data: readonly T[];
133
+ /** Key of the x-axis (category) field. */
134
+ index: DataKey<T>;
135
+ /** Accessible name of the chart. Falls back to `title`, then to a generated summary. */
136
+ 'aria-label'?: string;
137
+ /** Title rendered inside the SVG (`<title>`), also used as accessible name fallback. */
138
+ title?: string;
139
+ /** Longer description rendered inside the SVG (`<desc>`). */
140
+ description?: string;
141
+ colors?: readonly ChartColor[];
142
+ valueFormatter?: ValueFormatter;
143
+ showLegend?: boolean;
144
+ showGrid?: boolean;
145
+ /** Plot height in px (legend excluded). */
146
+ height?: number;
147
+ className?: string;
148
+ }
149
+ //#endregion
150
+ //#region src/ChartBrush.d.ts
151
+ /** Inclusive `[start, end]` indices into the chart data. */
152
+ type ChartRange = readonly [number, number];
153
+ /** Clamps a range to `[0, length - 1]`, ordered, at least `minSpan` points wide when possible. */
154
+ export declare function clampRange(range: ChartRange | null | undefined, length: number, minSpan?: number): [number, number];
155
+ interface UseChartRangeOptions {
156
+ length: number;
157
+ range?: ChartRange;
158
+ defaultRange?: ChartRange;
159
+ onRangeChange?: (range: ChartRange) => void;
160
+ }
161
+ /** Controlled/uncontrolled brush range; `null` inner state means "everything". */
162
+ export declare function useChartRange({ length, range, defaultRange, onRangeChange }: UseChartRangeOptions): readonly [[number, number], (next: ChartRange) => void];
163
+ interface ChartBrushProps {
164
+ /** Number of data points. */
165
+ length: number;
166
+ range: ChartRange;
167
+ onRangeChange: (range: ChartRange) => void;
168
+ /** Text of the x value at an index (handles' aria-valuetext and the range summary). */
169
+ labelOf: (index: number) => string;
170
+ /** Values of one series, drawn as a faint overview line inside the track. */
171
+ preview?: readonly number[];
172
+ /** Accessible name of the brush group. */
173
+ label?: string;
174
+ className?: string;
175
+ }
176
+ /**
177
+ * Range brush under a time-series chart: two keyboard-accessible handles (`role="slider"`,
178
+ * Arrow keys ±1, PageUp/PageDown ±10%, Home/End) and a draggable window to pan.
179
+ */
180
+ export declare function ChartBrush({ length, range, onRangeChange, labelOf, preview, label, className }: ChartBrushProps): import("react").JSX.Element | null;
181
+ //#endregion
182
+ //#region src/overlays.d.ts
183
+ /** Semantic tone of a threshold or annotation (maps to a brand token, never a raw colour). */
184
+ type ChartTone = 'neutral' | 'primary' | 'success' | 'warning' | 'destructive' | 'info';
185
+ /** A horizontal reference line on the value axis (an SLO, a budget, a limit). */
186
+ interface ChartThreshold {
187
+ /** Value on the value axis. */
188
+ value: number;
189
+ /** Visible label drawn next to the line (thresholds are never colour-only). */
190
+ label: string;
191
+ tone?: ChartTone;
192
+ /** ComboChart only: the axis the value belongs to (default `left`, the bar axis). */
193
+ axis?: 'left' | 'right';
194
+ }
195
+ /** A vertical marker at an x (category) value: a deploy, an incident, a release. */
196
+ interface ChartAnnotation {
197
+ /** Category value on the x axis (must match an `index` value of the data). */
198
+ x: string | number;
199
+ /** Short visible label (drawn on the marker and listed under the chart). */
200
+ label: string;
201
+ /** Longer text shown in the marker tooltip and read by screen readers. */
202
+ description?: string;
203
+ tone?: ChartTone;
204
+ }
205
+ /** Stroke token and contrast-safe text token of each tone. */
206
+ export declare const TONE_TOKENS: Record<ChartTone, {
207
+ stroke: string;
208
+ text: string;
209
+ }>;
210
+ interface ChartMarkersProps {
211
+ thresholds?: readonly ChartThreshold[];
212
+ annotations?: readonly ChartAnnotation[];
213
+ /** Formats threshold values (the chart's value formatter). */
214
+ valueFormatter?: ValueFormatter;
215
+ /** Key of the annotation highlighted in the plot. */
216
+ active?: string | null;
217
+ onActiveChange?: (key: string | null) => void;
218
+ className?: string;
219
+ }
220
+ /**
221
+ * Text list of the thresholds and annotations under a chart: the keyboard and screen-reader
222
+ * route to the same information as the in-plot markers. Focusing or hovering an annotation
223
+ * highlights its marker and opens its tooltip in the plot.
224
+ */
225
+ export declare function ChartMarkers({ thresholds, annotations, valueFormatter, active, onActiveChange, className }: ChartMarkersProps): import("react").JSX.Element | null;
226
+ //#endregion
227
+ //#region src/cartesian-extras.d.ts
228
+ /** Thresholds, annotations, brush zoom and animation: shared by Line, Area, Bar and Combo charts. */
229
+ interface CartesianExtrasProps {
230
+ /** Horizontal reference lines on the value axis, each with a visible label and a tone. */
231
+ thresholds?: readonly ChartThreshold[];
232
+ /** Vertical markers at x values (deploys, incidents), with a label and a tooltip. */
233
+ annotations?: readonly ChartAnnotation[];
234
+ /** Shows a range brush under the plot to zoom into part of the series. */
235
+ brush?: boolean;
236
+ /** Controlled brush range: inclusive `[start, end]` indices into `data`. */
237
+ range?: ChartRange;
238
+ /** Initial brush range (uncontrolled). Default: every point. */
239
+ defaultRange?: ChartRange;
240
+ onRangeChange?: (range: ChartRange) => void;
241
+ /** Animate data changes (e.g. a live series). Always off under prefers-reduced-motion. Default false. */
242
+ animate?: boolean;
243
+ }
244
+ //#endregion
245
+ //#region src/AreaChart.d.ts
246
+ interface AreaChartProps<T extends object> extends CartesianExtrasProps, BaseChartProps<T> {
247
+ categories: ReadonlyArray<DataKey<T>>;
248
+ stacked?: boolean;
249
+ showYAxis?: boolean;
250
+ curve?: 'monotone' | 'linear' | 'step' | 'natural';
251
+ }
252
+ /** Area chart: flat fills (no gradient), no entry animation, interactive legend. */
253
+ export declare function AreaChart<T extends object>({ data, index, categories, colors, valueFormatter, stacked, showLegend, showGrid, showYAxis, curve, height, title, description, className, 'aria-label': ariaLabel, state, emptyMessage, errorMessage, onRetry, dataTable, thresholds, annotations, brush, range, defaultRange, onRangeChange, animate }: AreaChartProps<T>): import("react").JSX.Element;
254
+ //#endregion
255
+ //#region src/BarChart.d.ts
256
+ interface BarChartProps<T extends object> extends CartesianExtrasProps, BaseChartProps<T> {
257
+ categories: ReadonlyArray<DataKey<T>>;
258
+ stacked?: boolean;
259
+ /** "horizontal" = vertical bars (categories on X); "vertical" = horizontal bars (categories on Y). */
260
+ layout?: 'horizontal' | 'vertical';
261
+ showYAxis?: boolean;
262
+ }
263
+ /** Bar chart: vertical, horizontal or stacked; flat fills, no animation. */
264
+ export declare function BarChart<T extends object>({ data, index, categories, colors, valueFormatter, stacked, layout, showLegend, showGrid, showYAxis, height, title, description, className, 'aria-label': ariaLabel, state, emptyMessage, errorMessage, onRetry, dataTable, thresholds, annotations, brush, range, defaultRange, onRangeChange, animate }: BarChartProps<T>): import("react").JSX.Element;
265
+ //#endregion
266
+ //#region src/LineChart.d.ts
267
+ interface LineChartProps<T extends object> extends CartesianExtrasProps, BaseChartProps<T> {
268
+ categories: ReadonlyArray<DataKey<T>>;
269
+ showYAxis?: boolean;
270
+ /** Only label the first and last x ticks. */
271
+ startEndOnly?: boolean;
272
+ curve?: 'monotone' | 'linear' | 'step' | 'natural';
273
+ }
274
+ /** Line chart: 2px strokes, no dots until hover, no animation. */
275
+ export declare function LineChart<T extends object>({ data, index, categories, colors, valueFormatter, showLegend, showGrid, showYAxis, startEndOnly, curve, height, title, description, className, 'aria-label': ariaLabel, state, emptyMessage, errorMessage, onRetry, dataTable, thresholds, annotations, brush, range, defaultRange, onRangeChange, animate }: LineChartProps<T>): import("react").JSX.Element;
276
+ //#endregion
277
+ //#region src/ComboChart.d.ts
278
+ interface ComboChartProps<T extends object> extends CartesianExtrasProps, Omit<BaseChartProps<T>, 'colors' | 'valueFormatter'> {
279
+ /** Series drawn as bars on the left axis. */
280
+ barSeries: DataKey<T>;
281
+ /** Series drawn as a line on the right axis. */
282
+ lineSeries: DataKey<T>;
283
+ barColor?: ChartColor;
284
+ lineColor?: ChartColor;
285
+ barFormatter?: ValueFormatter;
286
+ lineFormatter?: ValueFormatter;
287
+ }
288
+ /** Combo chart: bars on the left axis, a line on the right axis. */
289
+ export declare function ComboChart<T extends object>({ data, index, barSeries, lineSeries, barColor, lineColor, barFormatter, lineFormatter, showLegend, showGrid, height, title, description, className, 'aria-label': ariaLabel, state, emptyMessage, errorMessage, onRetry, dataTable, thresholds, annotations, brush, range, defaultRange, onRangeChange, animate }: ComboChartProps<T>): import("react").JSX.Element;
290
+ //#endregion
291
+ //#region src/DonutChart.d.ts
292
+ interface DonutChartProps<T extends object> extends ChartStateProps {
293
+ data: readonly T[];
294
+ /** Key of the slice name field. */
295
+ index: DataKey<T>;
296
+ /** Key of the slice value field. */
297
+ category: DataKey<T>;
298
+ colors?: readonly ChartColor[];
299
+ valueFormatter?: ValueFormatter;
300
+ variant?: 'donut' | 'pie';
301
+ showLegend?: boolean;
302
+ /** Caption under the total in the donut hole (donut variant only). */
303
+ centerLabel?: string;
304
+ /** Diameter in px. */
305
+ height?: number;
306
+ 'aria-label'?: string;
307
+ title?: string;
308
+ description?: string;
309
+ className?: string;
310
+ }
311
+ /** Donut / pie with a clickable value legend; hidden slices drop out of the total. */
312
+ export declare function DonutChart<T extends object>({ data, index, category, colors, valueFormatter, variant, showLegend, centerLabel, height, title, description, className, 'aria-label': ariaLabel, state, emptyMessage, errorMessage, onRetry, dataTable }: DonutChartProps<T>): import("react").JSX.Element;
313
+ //#endregion
314
+ //#region src/BarList.d.ts
315
+ declare const BAR_LIST_BG: {
316
+ readonly primary: "bg-primary/20";
317
+ readonly violet: "bg-category-violet/20";
318
+ readonly cyan: "bg-category-cyan/20";
319
+ readonly amber: "bg-category-amber/20";
320
+ readonly rose: "bg-category-rose/20";
321
+ };
322
+ interface BarListProps<T extends object> extends Omit<ChartStateProps, 'dataTable'> {
323
+ data: readonly T[];
324
+ index: DataKey<T>;
325
+ category: DataKey<T>;
326
+ valueFormatter?: ValueFormatter;
327
+ color?: keyof typeof BAR_LIST_BG;
328
+ sortOrder?: 'desc' | 'asc' | 'none';
329
+ 'aria-label'?: string;
330
+ className?: string;
331
+ }
332
+ /** Axis-less ranked list: label inside a token-tinted bar, value on the right. */
333
+ export declare function BarList<T extends object>({ data, index, category, valueFormatter, color, sortOrder, className, 'aria-label': ariaLabel, state, emptyMessage, errorMessage, onRetry }: BarListProps<T>): import("react").JSX.Element;
334
+ //#endregion
335
+ //#region src/ChartTooltip.d.ts
336
+ /** The subset of a Recharts tooltip payload entry the brand tooltip reads. */
337
+ interface ChartTooltipEntry {
338
+ name?: string | number;
339
+ value?: unknown;
340
+ color?: string;
341
+ fill?: string;
342
+ payload?: unknown;
343
+ }
344
+ interface ChartTooltipProps {
345
+ active?: boolean;
346
+ payload?: ReadonlyArray<ChartTooltipEntry>;
347
+ label?: string | number;
348
+ valueFormatter?: ValueFormatter;
349
+ /** Per-series formatter; wins over `valueFormatter` (used by ComboChart). */
350
+ seriesFormatter?: (value: unknown, name: string) => string;
351
+ labelFormatter?: (label: string | number) => ReactNode;
352
+ }
353
+ /** Brand tooltip card: label header + one row per series, values in mono. */
354
+ export declare function ChartTooltip({ active, payload, label, valueFormatter, seriesFormatter, labelFormatter }: ChartTooltipProps): import("react").JSX.Element | null;
355
+ /** Adapts Recharts 3 `<Tooltip content>` to the brand tooltip: `content={tooltipContent({ valueFormatter })}`. */
356
+ export declare function tooltipContent(options: Omit<ChartTooltipProps, 'active' | 'payload' | 'label'>): (p: TooltipContentProps) => import("react").JSX.Element;
357
+ //#endregion
358
+ //#region src/ChartLegend.d.ts
359
+ interface ChartLegendItem {
360
+ key: string;
361
+ label: string;
362
+ /** Resolved colour (from `useChartTheme().color`). */
363
+ color: string;
364
+ }
365
+ interface ChartLegendProps {
366
+ items: readonly ChartLegendItem[];
367
+ hidden: ReadonlySet<string>;
368
+ onToggle: (key: string) => void;
369
+ className?: string;
370
+ }
371
+ /** Interactive legend: each entry is a toggle button that shows/hides its series. */
372
+ export declare function ChartLegend({ items, hidden, onToggle, className }: ChartLegendProps): import("react").JSX.Element;
373
+ /** Legend state: the set of hidden series keys plus a toggle. */
374
+ export declare function useHiddenSeries(): [ReadonlySet<string>, (key: string) => void];
375
+ //#endregion
376
+ //#region src/FunnelChart.d.ts
377
+ interface FunnelChartProps<T extends object> extends ChartStateProps {
378
+ /** Stages in order, widest first. */
379
+ data: readonly T[];
380
+ /** Key of the stage name. */
381
+ index: DataKey<T>;
382
+ /** Key of the stage count. */
383
+ category: DataKey<T>;
384
+ /** Hue of the stages (a sequential ramp, strongest first). Default `primary`. */
385
+ color?: ChartColor;
386
+ valueFormatter?: ValueFormatter;
387
+ /** Show the stage list with conversion and drop-off. Default `true`. */
388
+ showStages?: boolean;
389
+ /** Funnel height in px. */
390
+ height?: number;
391
+ 'aria-label'?: string;
392
+ title?: string;
393
+ description?: string;
394
+ className?: string;
395
+ }
396
+ interface FunnelStage {
397
+ name: string;
398
+ value: number;
399
+ /** Share of the first stage (0–1). */
400
+ conversion: number;
401
+ /** Loss from the previous stage (0–1); 0 for the first stage. */
402
+ dropOff: number;
403
+ fill: string;
404
+ }
405
+ /** Stage maths: conversion against the first stage and drop-off against the previous one. */
406
+ export declare function funnelStages(values: ReadonlyArray<{
407
+ name: string;
408
+ value: number;
409
+ }>, fills?: readonly string[]): FunnelStage[];
410
+ /** Staged conversion funnel: trapezoids in a one-hue ramp plus a stage list with drop-off. */
411
+ export declare function FunnelChart<T extends object>({ data, index, category, color, valueFormatter, showStages, height, title, description, className, 'aria-label': ariaLabel, state, emptyMessage, errorMessage, onRetry, dataTable }: FunnelChartProps<T>): import("react").JSX.Element;
412
+ //#endregion
413
+ //#region src/SankeyChart.d.ts
414
+ interface SankeyNodeDatum {
415
+ name: string;
416
+ /** Series colour of the node (and of its outgoing flows). Default: cycles `colors`. */
417
+ color?: ChartColor;
418
+ }
419
+ interface SankeyLinkDatum {
420
+ /** Source node: its name or its index in `nodes`. */
421
+ source: string | number;
422
+ /** Target node: its name or its index in `nodes`. */
423
+ target: string | number;
424
+ value: number;
425
+ }
426
+ interface SankeyChartProps extends ChartStateProps {
427
+ nodes: readonly SankeyNodeDatum[];
428
+ links: readonly SankeyLinkDatum[];
429
+ colors?: readonly ChartColor[];
430
+ valueFormatter?: ValueFormatter;
431
+ /** Plot height in px. */
432
+ height?: number;
433
+ nodeWidth?: number;
434
+ nodePadding?: number;
435
+ 'aria-label'?: string;
436
+ title?: string;
437
+ description?: string;
438
+ className?: string;
439
+ }
440
+ interface ResolvedLink {
441
+ source: number;
442
+ target: number;
443
+ value: number;
444
+ }
445
+ /** Turns name-or-index links into the index links Recharts expects; drops unknown endpoints and non-positive values. */
446
+ export declare function resolveSankeyLinks(nodes: readonly SankeyNodeDatum[], links: readonly SankeyLinkDatum[]): ResolvedLink[];
447
+ /** Flow diagram: nodes as token-coloured bars, links tinted with their source colour. */
448
+ export declare function SankeyChart({ nodes, links, colors, valueFormatter, height, nodeWidth, nodePadding, title, description, className, 'aria-label': ariaLabel, state, emptyMessage, errorMessage, onRetry, dataTable }: SankeyChartProps): import("react").JSX.Element;
449
+ //#endregion
450
+ //#region src/RadarChart.d.ts
451
+ interface RadarChartProps<T extends object> extends Omit<BaseChartProps<T>, 'showGrid'> {
452
+ /** One key per compared entity (a polygon each). `index` holds the axis names. */
453
+ categories: ReadonlyArray<DataKey<T>>;
454
+ /** Upper bound of the radial scale (e.g. 100 for scores). Default: data max. */
455
+ max?: number;
456
+ /** Show the concentric grid. Default `true`. */
457
+ showGrid?: boolean;
458
+ /** Show the radial scale ticks. Default `false`. */
459
+ showRadiusAxis?: boolean;
460
+ }
461
+ /** Multi-axis scores: one translucent polygon per category over a polygonal grid. */
462
+ export declare function RadarChart<T extends object>({ data, index, categories, colors, valueFormatter, max, showLegend, showGrid, showRadiusAxis, height, title, description, className, 'aria-label': ariaLabel, state, emptyMessage, errorMessage, onRetry, dataTable }: RadarChartProps<T>): import("react").JSX.Element;
463
+ //#endregion
464
+ //#region src/Heatmap.d.ts
465
+ interface HeatmapProps<T extends object> extends ChartStateProps {
466
+ /** One row per datum (cohort, day…). */
467
+ data: readonly T[];
468
+ /** Key of the row label. */
469
+ index: DataKey<T>;
470
+ /** Column keys (weeks, hours…), in display order. Missing / non-numeric values render as empty cells. */
471
+ categories: ReadonlyArray<DataKey<T>>;
472
+ /** `sequential` (default) for magnitudes, `diverging` for signed values around `domain[1]`. */
473
+ scale?: 'sequential' | 'diverging';
474
+ /** `[min, max]` or, for diverging, `[min, mid, max]`. Default: the data extent (mid 0). */
475
+ domain?: readonly [number, number] | readonly [number, number, number];
476
+ /** Number of colour steps. Default 6 (sequential) / 7 (diverging). */
477
+ steps?: number;
478
+ /** Hue of the sequential scale. Default `primary`. */
479
+ color?: ChartColor;
480
+ valueFormatter?: ValueFormatter;
481
+ /** Print the value inside each cell. */
482
+ showValues?: boolean;
483
+ /** Show the colour scale under the grid. Default `true`. */
484
+ showScale?: boolean;
485
+ /** Cell height in px (default 28). Ignored when `height` is set. */
486
+ cellHeight?: number;
487
+ /**
488
+ * Height of the grid in px (column labels included): cells shrink or grow to fill it (16–48 px
489
+ * each). Use it to match sibling charts, e.g. inside a ChartCard.
490
+ */
491
+ height?: number;
492
+ /** Row header column label (table fallback). Default: `index`. */
493
+ rowHeader?: string;
494
+ 'aria-label'?: string;
495
+ title?: string;
496
+ className?: string;
497
+ }
498
+ /** Cell height that fits `rows` rows in `height` px (clamped to 16–48), or undefined without a height. */
499
+ export declare function cellHeightFor(height: number | undefined, rows: number): number | undefined;
500
+ /**
501
+ * Cohort / time grid coloured with a sequential or diverging token ramp. The colour grid is
502
+ * a single keyboard stop (arrow keys move the active cell, Home/End jump within the row) with a
503
+ * live readout; screen readers get the full data table (`dataTable`, on by default).
504
+ */
505
+ export declare function Heatmap<T extends object>({ data, index, categories, scale, domain, steps, color, valueFormatter, showValues, showScale, cellHeight: cellHeightProp, height, rowHeader, title, className, 'aria-label': ariaLabel, state, emptyMessage, errorMessage, onRetry, dataTable }: HeatmapProps<T>): import("react").JSX.Element;
506
+ //#endregion
507
+ //#region src/MiniBar.d.ts
508
+ /** Same tones as the `@gntik-ai/ui` Sparkline, so the two can sit side by side in stat cards. */
509
+ type MiniBarTone = 'primary' | 'success' | 'warning' | 'destructive' | 'info' | 'neutral';
510
+ interface MiniBarProps extends Omit<SVGAttributes<SVGSVGElement>, 'className' | 'width' | 'height'> {
511
+ className?: string;
512
+ ref?: Ref<SVGSVGElement>;
513
+ /** The series, oldest first. */
514
+ data: readonly number[];
515
+ /** Per-bar labels (e.g. dates) for hover titles and the accessible summary. */
516
+ labels?: readonly string[];
517
+ tone?: MiniBarTone;
518
+ /** Which bar is drawn at full strength; the rest are muted. Default `last`. */
519
+ highlight?: 'last' | 'max' | 'min' | 'none' | number;
520
+ width?: number;
521
+ height?: number;
522
+ /** What the series measures, used in the generated accessible name ("Deployments"). */
523
+ label?: string;
524
+ formatValue?: (value: number) => string;
525
+ }
526
+ /** "Deployments: 12 bars, latest 9, low 2, high 14, total 84". */
527
+ export declare function describeBars(data: readonly number[], label?: string, format?: (v: number) => string): string;
528
+ /**
529
+ * Sparkline-sized bar chart (pure SVG, no axes): drop-in next to `Sparkline variant="bar"`,
530
+ * with a highlighted bar, per-bar hover titles and a generated `role="img"` summary.
531
+ */
532
+ export declare function MiniBar({ data, labels, tone, highlight, width, height, label, formatValue, className, ...props }: MiniBarProps): import("react").JSX.Element;
533
+ //#endregion
534
+ //#region src/palette.d.ts
535
+ /**
536
+ * Data-viz palette built ONLY from the frozen brand tokens.
537
+ *
538
+ * Categorical: `SAFE_CHART_COLORS` orders the five accents so that every adjacent pair differs
539
+ * in relative luminance by at least 1.5:1 in dark, light and high_contrast (asserted by
540
+ * `palette.test.ts` against `@gntik-ai/tokens/brand.css`). It is the default `CHART_COLORS`
541
+ * order of every chart; this name is kept as an alias.
542
+ *
543
+ * Colour-blind safety: hue alone is never the only channel. Charts pair colour with position,
544
+ * labels or the legend text; use at most five categorical series, prefer a sequential ramp
545
+ * (one hue, varying lightness) for ordered data, and a diverging ramp (destructive ↔ muted ↔
546
+ * primary, i.e. red ↔ green, which deutan/protan viewers confuse) only together with value
547
+ * labels, a signed legend or the `dataTable` fallback — lightness still separates the ends.
548
+ */
549
+ export declare const SAFE_CHART_COLORS: readonly ChartColor[];
550
+ /** A CSS custom property name of a brand token (`--primary`, `--destructive`…). */
551
+ type TokenName = `--${string}`;
552
+ interface SequentialRampOptions {
553
+ /** Hue of the ramp (series colour name). Default `primary`. */
554
+ color?: ChartColor;
555
+ /** Surface the ramp fades into. Default `--card`. */
556
+ surface?: TokenName;
557
+ /**
558
+ * `mix` (default): opaque `color-mix(in oklab, …)` steps — safe for overlapping marks and text on top.
559
+ * `alpha`: `hsl(var(--token) / a)` steps that let the underlying surface show through.
560
+ */
561
+ mode?: 'mix' | 'alpha';
562
+ /** Strength of the weakest step, 0–1. Default 0.14. */
563
+ min?: number;
564
+ }
565
+ interface DivergingRampOptions {
566
+ /** Token for the low end. Default `--destructive`. */
567
+ negative?: TokenName;
568
+ /** Token for the high end. Default `--primary`. */
569
+ positive?: TokenName;
570
+ /** Token for the neutral midpoint. Default `--muted`. */
571
+ mid?: TokenName;
572
+ mode?: 'mix' | 'alpha';
573
+ /** Strength of the weakest non-neutral step, 0–1. Default 0.18. */
574
+ min?: number;
575
+ }
576
+ /**
577
+ * `n` colours from faint to the full token, for ordered magnitudes (heatmaps, choropleths,
578
+ * funnel stages). Every value is a CSS colour string usable as SVG fill/stroke or inline style.
579
+ */
580
+ export declare function sequentialRamp(n: number, options?: SequentialRampOptions): string[];
581
+ /**
582
+ * `n` colours from `negative` (index 0) through the neutral `mid` to `positive` (last index),
583
+ * for signed values around a meaningful centre (deltas, budgets, sentiment). With an odd `n`
584
+ * the middle step is the plain neutral token.
585
+ */
586
+ export declare function divergingRamp(n: number, options?: DivergingRampOptions): string[];
587
+ /**
588
+ * Index of the ramp step for `value`. `domain` is `[min, max]` (sequential) or
589
+ * `[min, mid, max]` (diverging: `mid` maps to the centre of the ramp).
590
+ */
591
+ export declare function rampIndex(value: number, domain: readonly [number, number] | readonly [number, number, number], steps: number): number;
592
+ /** Colour of `value` on `ramp` (see `rampIndex`). */
593
+ export declare function rampColor(value: number, domain: readonly [number, number] | readonly [number, number, number], ramp: readonly string[]): string;
594
+ //#endregion
595
+ //#region src/live.d.ts
596
+ /** `true` when the user asks for reduced motion (false on the server). */
597
+ export declare function usePrefersReducedMotion(): boolean;
598
+ interface UseLiveSeriesOptions<T> {
599
+ /** Points shown before the first `append`. */
600
+ initial?: readonly T[];
601
+ /** Points kept (oldest drop off). Default 60. */
602
+ windowSize?: number;
603
+ /** Freeze the plotted data while the pointer is over the chart or focus is inside it (default true). */
604
+ pauseOnInteraction?: boolean;
605
+ }
606
+ interface LiveSeriesPauseProps {
607
+ onPointerEnter: () => void;
608
+ onPointerLeave: () => void;
609
+ onFocus: () => void;
610
+ onBlur: (e: FocusEvent<HTMLElement>) => void;
611
+ }
612
+ interface LiveSeries<T> {
613
+ /** The data to plot: frozen while paused, the latest window otherwise. */
614
+ data: readonly T[];
615
+ /** Appends one point or several (keeps the last `windowSize`). Buffered while paused. */
616
+ append: (points: T | readonly T[]) => void;
617
+ /** Replaces every point. */
618
+ reset: (points?: readonly T[]) => void;
619
+ /** Paused by interaction (hover/focus) or by `pause()`. */
620
+ paused: boolean;
621
+ /** Paused with `pause()` / `togglePaused()` (a visible Pause button — WCAG 2.2.2). */
622
+ manuallyPaused: boolean;
623
+ pause: () => void;
624
+ resume: () => void;
625
+ togglePaused: () => void;
626
+ /** Points received while paused, shown on resume. */
627
+ pending: number;
628
+ /** The user prefers reduced motion: render updates without animation. */
629
+ reducedMotion: boolean;
630
+ /** Spread on the element wrapping the chart to pause on hover and focus. */
631
+ pauseProps: LiveSeriesPauseProps;
632
+ }
633
+ /**
634
+ * State for a live-updating chart: a sliding window of points, with updates frozen while the
635
+ * user hovers or focuses the chart (so a tooltip or a value does not move under them) and a
636
+ * manual pause. Render with `animate={!reducedMotion}` for smooth transitions only when the
637
+ * user has not asked for reduced motion.
638
+ */
639
+ export declare function useLiveSeries<T>({ initial, windowSize, pauseOnInteraction }?: UseLiveSeriesOptions<T>): LiveSeries<T>;
640
+ //#endregion
641
+ export type { AreaChartProps, BarChartProps, BarListProps, BaseChartProps, CartesianExtrasProps, ChartAnnotation, ChartBrushProps, ChartColor, ChartDataTableProps, ChartEmptyProps, ChartErrorProps, ChartLegendItem, ChartLegendProps, ChartLoadingProps, ChartMarkersProps, ChartRange, ChartState, ChartStateProps, ChartTheme, ChartThreshold, ChartTone, ChartTooltipEntry, ChartTooltipProps, ComboChartProps, DivergingRampOptions, DonutChartProps, FunnelChartProps, FunnelStage, HeatmapProps, LineChartProps, LiveSeries, LiveSeriesPauseProps, MiniBarProps, MiniBarTone, RadarChartProps, SankeyChartProps, SankeyLinkDatum, SankeyNodeDatum, SequentialRampOptions, TokenName, UseChartRangeOptions, UseChartThemeOptions, UseLiveSeriesOptions, ValueFormatter };
642
+ //# sourceMappingURL=index.d.ts.map