import { CSSProperties, ReactElement, ReactNode } from 'react'; import { ChartMotion, ChartLoadingStyle, ChartEmptyState, ChartPalette, ChartStyle, ChartSurface, RankingOrder, CardLegend, ChartLegendSwatch } from '../types'; import { CardRange } from './cartesian-card'; import { NumericKey, TextKey } from './keys'; import { RankedRow } from './rank'; import { AnimatedNumberVariant } from '../motion/animated-number'; export type RadialChartCardVariant = 'donut' | 'pie' | 'semi' | 'rings'; export interface RadialChartCardProps> { /** 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 category. Omit when `ranges` supplies the data. */ data?: readonly Row[]; /** Text field that names each slice. Names must be unique. */ category: TextKey; /** Numeric field sized by each slice. Values must not be negative; `null` is "No data". */ value: Key; /** * `donut` (default) shows the share in the middle, `pie` fills the circle, `semi` is a half * donut with rounded ends, and `rings` gives each category its own ring on one shared scale. */ variant?: RadialChartCardVariant; /** * Gives the chart depth: every band is lit as a tube from the upper left, ring tracks become * grooves, and a soft shadow lifts the chart off the card. Outlines keep their exact angles, * so shares read the same as the flat chart. */ depth?: boolean; /** * `list` rows with value and share, value `tiles`, an `inline` key, tinted `pills`, or `bars` * that also draw each value against the largest. Defaults to tiles for rings, inline for semi, * and list otherwise. * False removes the legend without changing the data or marks. */ legend?: CardLegend | false; /** The mark beside each legend label: `square` (default), `dot`, or `line`. */ legendSwatch?: ChartLegendSwatch; /** Resting headline. Defaults to the total of every slice. */ headline?: number; /** Fractional change shown as a chip, e.g. 0.082 → +8.2%. */ delta?: number; deltaTone?: 'default' | 'inverse' | 'neutral'; /** Static period label, e.g. "This month". */ range?: string; /** Period select. Each range replaces data, delta, and headline; slices ease to their new size. */ ranges?: readonly CardRange[]; defaultRange?: string; /** * The pinned category, by name, for a selection you own: external filters and a click on a * slice then share it. `null` pins nothing. Omit it and the card keeps its own pin. */ selected?: string | null; /** Asked when a click, tap, or Escape pins or releases a category. */ onSelectedChange?: (category: string | null) => void; /** * Fixed colors by category name, e.g. `{ Critical: '#ef4444' }`, for categories whose color * means something. Others take the palette in order, and keep it as values change. */ colors?: Readonly>; /** * Replaces what the middle of a donut or half donut shows (by default the share of the * hovered, pinned, or largest category). */ center?: (category: RadialCenterCategory) => ReactNode; /** * Slices shown before the rest are added up as one "Other" slice. Defaults to 5, since more * than six colors stop being told apart. `Infinity` shows every category. */ limit?: number; /** Label of the combined slice. Defaults to "Other". */ otherLabel?: string; /** `descending` (default) puts the largest first; `input` keeps your order. */ sort?: RankingOrder; valueFormat?: Intl.NumberFormatOptions; locale?: string; formatValue?: (value: number) => 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; /** Shimmer (default), a clockwise draw, or a gentle pulse. Honors reduced motion. */ 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; } /** The category the middle of the chart speaks for: the active one, or else the largest. */ export interface RadialCenterCategory { category: string; value: number | null; /** Its part of the visible total, 0 to 1; null when unknown. */ share: number | null; /** True while it is hovered, focused, or pinned rather than shown at rest. */ active: boolean; pinned: boolean; } interface Slice { id: string; startAngle: number; endAngle: number; } /** Angles for each observed slice, in row order. Missing values take no room. */ export declare function sliceAngles(rows: readonly RankedRow[]): Slice[]; /** * The top of a rings scale: the largest value rounded up to a quarter step of its magnitude, so * the longest ring stops short of closing and every ring reads against the same full turn. */ export declare function ringScale(max: number): number; /** One ring per observed row: each sweeps from the top by its value on the shared scale. */ export declare function ringAngles(rows: readonly RankedRow[]): Slice[]; /** * A donut or pie card: the headline total, slices with a matching legend, and each slice's * share. Hovering a slice or a legend row reads it in the headline. */ export declare function RadialChartCard>({ title, header, 'aria-label': ariaLabel, data: suppliedData, category, value, variant, depth, legend, legendSwatch, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, limit, otherLabel, sort, valueFormat, locale, formatValue: suppliedFormatValue, surface, badge, numberStyle, palette, selected, onSelectedChange, colors: fixedColors, center, loading, loadingStyle, empty: emptyState, motion: motionMode, className, style, }: RadialChartCardProps): ReactElement; export {};