import { type HTMLAttributes } from 'react';
import { type VariantProps } from 'class-variance-authority';
import ApexCharts from 'apexcharts';
import { type MarkerShape } from '../annotation-marker';
declare const sparklineVariants: (props?: ({
size?: "auto" | "sm" | "md" | "xs" | null | undefined;
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
export interface SparklineHandle {
updateSeries: (data: (number | null)[]) => void;
updateOptions: (opts: ApexCharts.ApexOptions) => void;
dataURI: () => Promise;
/** Fire the host's annotation handler for `id`, as a pointer press on that
* annotation's band would. No-op when the sparkline is not selectable, or
* when `id` names no currently drawn annotation. */
selectAnnotation: (id: string) => void;
/** Ids of the annotations currently drawn — the only ids `selectAnnotation`
* will accept. Ids only: an annotation's `label` is human-readable and could
* name a clinical event, so it is never exposed. */
getAnnotationIds: () => string[];
/** True when the host wired `onAnnotationSelect`. False means every
* `selectAnnotation` call is a no-op. */
isSelectable: () => boolean;
/** Number of positions in the currently rendered series, gaps included.
* A count only — the plotted values are measurements and stay private. */
getPointCount: () => number;
}
/** Semantic tint for an annotation. Decorative reinforcement of `shape` —
* never the only channel carrying which event this is. */
export type SparklineAnnotationTone = 'neutral' | 'info' | 'success' | 'warning' | 'error' | 'accent';
/**
* A vertical reference line dropped across the plot — the release-annotation
* pattern: "something happened here, look at what the line does around it".
*
* `position` is a FRACTION of the plotted x extent, not an index: `0` is the
* first data point, `1` the last, `0.5` exactly halfway between them. That is
* what lets an event that falls BETWEEN two points be placed at all, and what
* lets the same event land at the same x in a column of stacked sparklines —
* the caller derives the fraction once, from a domain the whole column shares,
* rather than per-series from a point count that differs row to row.
*/
export interface SparklineAnnotation {
/** Stable key — also emitted as `data-annotation-id` for test/agent hooks. */
id: string;
/** Fraction of the plotted x extent: 0 = first point, 1 = last. Clamped. */
position: number;
/** Accessible label, already localised by the caller. Folded into the
* sparkline's own `aria-label` — the line itself says nothing aloud. */
label: string;
/** Shape of the cap drawn at the top of the line. The accessible channel. */
shape?: MarkerShape;
tone?: SparklineAnnotationTone;
}
export interface SparklineProps extends Omit, 'role' | 'children'>, VariantProps {
/** Data points in plot order. `null` is an unmeasured position — it holds
* the point's place on the x extent and draws a gap, so a series measured
* at some positions and not others stays aligned with one that was measured
* at all of them. */
data: (number | null)[];
/** Chart visual style */
variant?: 'line' | 'bar' | 'area';
/** Size preset */
size?: 'xs' | 'sm' | 'md';
/** Accessible label prefix, e.g. "Revenue, 30 days" */
label?: string;
/** Stroke / bar colour override — defaults to var(--primary) via bridge */
color?: string;
/** Show end-point dot with trend direction arrow */
showEndpoint?: boolean;
/**
* Show Apex's hover tooltip with the data point value. Defaults to
* `false` — sparklines are intentionally minimal — opt in when the
* sparkline is large enough to be a primary metric surface (e.g.
* dashboard widgets) and the user benefits from per-point readout.
*/
showTooltip?: boolean;
/** Series name shown in the tooltip, already localised. Defaults to
* `label`, so the tooltip never falls back to Apex's "series-1". */
seriesName?: string;
/** Tooltip title per point, same order and length as `data` (gaps
* included). Omitted = no tooltip title. Never drawn on an axis. */
pointLabels?: readonly string[];
/** Width override — defaults to 100% of container */
width?: string | number;
/** Height override — defaults to the size variant height */
height?: string | number;
/** Vertical reference lines dropped across the plot. Omitted = none, so
* every existing consumer is unaffected. */
annotations?: readonly SparklineAnnotation[];
/**
* Make the drawn annotations POINTER-selectable — a press anywhere in an
* annotation's 44px band calls this with its `id`. Omitted (the default, and
* what every consumer before 1.1.0 gets) leaves them decorative, which is
* what a dashboard sparkline wants: a trend thumbnail should not be a click
* target.
*
* NOT a keyboard route, and deliberately so. The sparkline is `role="img"`,
* whose descendants are not exposed to assistive technology at all, so a
* focusable control drawn inside it would be a tab stop with no accessible
* name. The host MUST therefore already offer a keyboard control that does
* the same thing for the same annotation (WCAG 2.1.1) — this is a pointer
* shortcut to that control, never the only way in.
*
* The band is delivered by the `size` variants only, and follows
* `--min-target-size` on both axes (48px under `.theme-accessible`). Pass
* an explicit `height` and the pointer layer falls back to the drawn
* height, so `height={20}` yields a 20px-tall target — below even WCAG
* 2.5.8.
*/
onAnnotationSelect?: (annotationId: string) => void;
}
export declare const Sparkline: import("react").ForwardRefExoticComponent>;
export {};
//# sourceMappingURL=sparkline.d.ts.map