import { CSSProperties, ReactElement } from 'react'; import { CardRange } from '../../cards/cartesian-card'; import { KeysOfType, NumericKey, TextKey } from '../../cards/keys'; import { AnimatedNumberVariant } from '../../motion/animated-number'; import { ChartEmptyState, ChartLoadingStyle, ChartMotion, ChartPalette, ChartStyle, ChartSurface } from '../../types'; /** A column the list can sort by. `none` keeps your order. */ export type WatchlistSort = 'none' | 'symbol' | 'price' | 'change'; export interface WatchlistCardProps { /** Optional visible title. Use aria-label to name an embedded list. */ title?: string; /** Show the header, including the headline and period select. Defaults to true. */ header?: boolean; /** Accessible name, independent of the visible title. */ 'aria-label'?: string; /** One row per instrument. Omit when `ranges` supplies the rows. */ data?: readonly Row[]; /** Static period label, e.g. "Today". */ range?: string; /** Period select. Each period swaps the rows; prices roll and sparklines reshape between them. */ ranges?: readonly CardRange[]; /** Initial period id. Defaults to the first. */ defaultRange?: string; /** Text field holding the ticker, such as "SOL". Unique per row. */ symbol: TextKey; /** Text field holding the full name beside the ticker. */ name?: TextKey; /** Field holding the latest price. */ price: NumericKey; /** Field holding the fractional change over the period: 0.012 is up 1.2%. */ change: NumericKey; /** Field holding recent prices, oldest first, drawn as a sparkline. */ history?: KeysOfType; /** Fields holding the period's low and high, drawn as a range with the price marked on it. */ low?: NumericKey; high?: NumericKey; /** Initial sort. Defaults to `none`, your order. */ sort?: WatchlistSort; /** Let readers sort by symbol, price or change from the column headings. Defaults to true. */ sortable?: boolean; /** Price format, e.g. `{ style: 'currency', currency: 'USD' }`. */ valueFormat?: Intl.NumberFormatOptions; locale?: string; surface?: ChartSurface; palette?: ChartPalette; /** How prices animate when they change: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */ numberStyle?: AnimatedNumberVariant; loading?: boolean; /** * How the skeleton moves while `loading`: `shimmer` (default) sweeps a highlight over still rows, * `draw` lays them in order, `breathe` lets them rise and settle. */ loadingStyle?: ChartLoadingStyle; /** * What the card shows with no rows: `dots` (default), the chart's own `shape`, your own element * such as `Nothing watched yet`, or `null` for nothing. */ empty?: ChartEmptyState; motion?: ChartMotion; className?: string; style?: CSSProperties | ChartStyle; /** Reports the hovered or focused row, or null when the pointer leaves. */ onSelectionChange?: (row: Row | null) => void; } /** A sparkline path through recent prices, scaled to the box. */ export declare function sparkPath(values: readonly number[], width: number, height: number): string; /** * A watchlist: each instrument's ticker and name, a sparkline of its recent path, where it sits in * its range, its price and its move. Prices and moves roll when they update, sparklines reshape * between periods, and sorted rows travel to their new places. The headline is the average move; * hovering a row reads that instrument instead. */ export declare function WatchlistCard({ title, header, 'aria-label': ariaLabel, data, range, ranges, defaultRange, symbol, name, price, change, history, low, high, sort: initialSort, sortable, valueFormat, locale, surface, palette, numberStyle, loading, loadingStyle, empty, motion, className, style, onSelectionChange, }: WatchlistCardProps): ReactElement;