import { CSSProperties, ReactElement, ReactNode } from 'react'; import { ChartBarAppearance, ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types'; import { NumericKey, XKey, XKind } from './keys'; import { CardAggregate } from './format'; import { AnimatedNumberVariant } from '../motion/animated-number'; export type StatCardChart = 'area' | 'line' | 'bars' | 'meter' | 'ring' | 'none'; export interface StatCardProps> { /** The metric's name, e.g. "Revenue". Also names the card for screen readers. */ /** Optional visible title. Use aria-label to name an embedded chart. */ title?: string; /** Show the header, including headline and period controls. Defaults to true. */ header?: boolean; /** Accessible name, independent of the visible title. */ 'aria-label'?: string; /** One row per observation. Optional when `headline` is supplied. */ data?: readonly Row[]; /** Numeric field to summarize and chart. */ value?: Key; /** Field that names each observation on hover: text, number, or Date. */ x?: XKey; /** Override x inference. Numbers default to `number`; use `time` for timestamps. */ xType?: XKind; /** Resting value. Defaults to `value` summarized with `aggregate`. */ headline?: number; /** * How the resting value summarizes the data: `sum` (default) for counts and money, `mean` or * `max` for rates, `last` for levels such as active users. */ aggregate?: CardAggregate; /** Fractional change shown as a chip, e.g. 0.082 → +8.2%. */ delta?: number; deltaTone?: 'default' | 'inverse' | 'neutral'; /** Quiet text beside the delta, e.g. "vs last month". */ caption?: string; /** * The small chart: `area` (default), `line`, or `bars` under the value; a `meter` of cells or a * `ring` beside the value, both filling toward `target`; or `none`. */ chart?: StatCardChart; /** Bar treatment for `chart="bars"`: `solid` (default), `segmented`, `needle`, `gradient`, `outline`, or `isometric`. */ barStyle?: ChartBarAppearance; /** * Gives the small chart depth: lines and the ring become lit tubes, the meter a solid bar, and bars default * to `isometric`. Values still read from the front faces. */ depth?: boolean; /** Goal for `chart="meter"` or `chart="ring"`, in the same unit as the value. */ target?: number; /** * Link the small chart's hover with every card that uses the same name, matched by `x`. * Requires `x`. */ sync?: string; /** Chart height in pixels. Defaults to 56 (also the ring's size), or 10 for a meter. */ height?: number; /** Any CSS color. Defaults to the palette's first color. */ color?: string; /** Right side of the header, e.g. an icon or a menu. */ aside?: ReactNode; valueFormat?: Intl.NumberFormatOptions; locale?: string; formatValue?: (value: number) => string; formatX?: (value: string | number | Date) => string; /** `elevated` (default), `outline`, or `ghost` inside your own card. */ surface?: ChartSurface; /** A glass tab tucked behind the card's top edge, e.g. a caption, a command, or actions. */ badge?: ReactNode; /** Headline motion: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */ numberStyle?: AnimatedNumberVariant; palette?: ChartPalette; loading?: boolean; loadingStyle?: ChartLoadingStyle; /** * What the trend shows when the period has no data: `dots` (default), the chart's own `shape`, * your own element, or `null` for nothing. The headline reads a dash either way. */ empty?: ChartEmptyState; motion?: ChartMotion; className?: string; style?: CSSProperties | ChartStyle; } /** Cells of a meter: whole cells up to the value, then one cell trimmed to the exact remainder. */ export declare function meterCells(ratio: number, count?: number): number[]; export declare function StatCard>({ title, header, 'aria-label': ariaLabel, data, value: valueKey, x, xType, headline: suppliedHeadline, aggregate, delta, deltaTone, caption, chart, depth, barStyle, target, sync, height, color, aside, valueFormat, locale, formatValue: suppliedFormatValue, formatX, surface, badge, numberStyle, palette, loading, motion, loadingStyle, empty, className, style, }: StatCardProps): ReactElement;