import { CSSProperties, ReactElement, ReactNode } from 'react'; import { ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../types'; import { CardRange } from './cartesian-card'; import { NumericKey, TextKey } from './keys'; import { AnimatedNumberVariant } from '../motion/animated-number'; /** How the resting headline summarizes every known cell. */ export type HeatmapAggregate = 'sum' | 'mean' | 'max'; export interface HeatmapChartCardProps> { /** 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 cell. Omit when `ranges` supplies the data. */ data?: readonly Row[]; /** Text field that places a cell in a column, e.g. the hour. */ x: TextKey; /** Text field that places a cell in a row, e.g. the weekday. */ y: TextKey; /** The measurement that sets the cell's color. `null` or an absent cell reads "No data". */ value: Key; /** Column order. Defaults to the order columns first appear in the data. */ columns?: readonly string[]; /** Row order. Defaults to the order rows first appear in the data. */ rows?: readonly string[]; /** * Values at the light and dark ends of the scale. Fix it to compare periods on one scale; * by default it runs from zero (or the lowest value, if negative) to the highest value. */ domain?: readonly [number, number]; /** How the resting headline sums up the cells: `sum` (default), `mean`, or `max`. */ aggregate?: HeatmapAggregate; /** Grid height in pixels, shared by the rows. Defaults to 30 pixels per row. */ height?: number; /** Corner radius of each cell in pixels. Defaults to 5; 0 gives square cells. */ radius?: number; /** Space between cells in pixels. Defaults to 4. */ gap?: number; /** * Raises every cell as a cushioned tile with a lit top edge and a soft shadow. All tiles share * one height: color still carries the value. */ depth?: boolean; /** Resting headline. Defaults to the `aggregate` of every known cell. */ headline?: number; /** Fractional change shown as a chip, e.g. 0.052 → +5.2%. */ delta?: number; deltaTone?: 'default' | 'inverse' | 'neutral'; /** Static period label, e.g. "Last 7 days". */ range?: string; /** Period select. Each range replaces data, delta, and headline; cells ease to their new color. */ ranges?: readonly CardRange[]; defaultRange?: string; valueFormat?: Intl.NumberFormatOptions; locale?: string; formatValue?: (value: number) => string; /** Any CSS color for the dark end of the scale. Defaults to the palette's first color. */ color?: string; 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 card shows when the period has no data: `dots` (default), the chart's own `shape`, * your own element such as `No visits yet`, or `null` for nothing. */ empty?: ChartEmptyState; /** `none` turns off decorative motion; reduced-motion users get this automatically. */ motion?: ChartMotion; className?: string; style?: CSSProperties | ChartStyle; } export interface HeatmapGridCell { /** `row` and `column` joined, unique within the grid. */ id: string; label: string; row: string; column: string; datum: Row | null; /** `null` when the cell is missing or has no value; zero is a real reading. */ value: number | null; /** Position between the domain ends, 0 to 1. `null` when there is no value. */ intensity: number | null; } export interface HeatmapGrid { columns: string[]; rows: string[]; /** Row-major: every column of the first row, then the next row. */ cells: HeatmapGridCell[]; domain: readonly [number, number]; error: string | null; } /** * Lay rows of data out as a grid. Rows and columns keep the order given, or the order they * first appear; a cell with no row, or a `null` value, stays in the grid as missing. */ export declare function heatmapGrid({ data, x, y, value, columns: columnOrder, rows: rowOrder, domain: suppliedDomain, }: { data: readonly Row[]; x: string; y: string; value: string; columns?: readonly string[]; rows?: readonly string[]; domain?: readonly [number, number]; }): HeatmapGrid; /** The share of the accent color a cell gets: never fully clear, so zero still reads as a value. */ export declare const cellStrength: (intensity: number) => number; /** * Which axis labels show. Up to eight columns always fit; beyond that, narrow cards drop every * other label (`minor`), and past twelve columns only every nth label shows at all. */ export declare function labelTier(index: number, count: number): 'major' | 'minor' | 'hidden'; /** * A heatmap card: a grid of cells colored by value, with the row and column of each cell * labeled. Hovering or focusing a cell reads it in the headline; arrow keys move between cells. * Missing cells are hatched and say "No data", so they never read as zero. */ export declare function HeatmapChartCard>({ title, header, 'aria-label': ariaLabel, data: suppliedData, x, y, value, columns, rows: rowOrder, domain, aggregate, height, radius, gap, depth, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, locale, formatValue: suppliedFormatValue, color, surface, badge, numberStyle, palette, loading, loadingStyle, empty: emptyState, motion: motionMode, className, style, }: HeatmapChartCardProps): ReactElement;