import { ReactElement } from 'react'; /** * How a number animates when it changes: * - `count` (default): the value itself counts to its new total. * - `pop`: the number lifts away and the new one pops in, character by character. * - `slide`: changed digits travel in the direction of change, ones place first. * - `roll`: every digit turns like an odometer, carrying through 9 → 0. * - `flow`: NumberFlow's spinning digits, which need an `Intl.NumberFormat` (cards provide one). * - `scramble`: changed digits cycle through figures before they land. * * Symbols such as a currency sign stay put while the digits beside them change. While values * arrive quickly, as they do when a pointer scrubs a chart, every variant keeps its character * but moves in a short, interruptible form: new digits start part-visible, old ones clear * within a tenth of a second, and each change carries on from wherever the last one was. */ export type AnimatedNumberVariant = 'slide' | 'roll' | 'flow' | 'pop' | 'scramble' | 'count'; export interface AnimatedNumberProps { value: number; /** * A format function or an `Intl.NumberFormat`. An `Intl.NumberFormat` lets every variant tell * symbols from digits exactly; `flow` needs one and slides with a plain function. */ format?: ((value: number) => string) | Intl.NumberFormat; className?: string; motion?: 'auto' | 'none'; /** `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */ variant?: AnimatedNumberVariant; } /** One character of the formatted number. */ export interface NumberCell { /** Stable across values: symbols by kind, digits by place value from the decimal point. */ key: string; char: string; digit: boolean; /** Symbols before and after the number stay in place while its digits change. */ role: 'prefix' | 'number' | 'suffix'; /** Distance from the last character, for the ones-first cascade. */ place: number; } /** * Splits a formatted number into keyed cells. Keys follow meaning rather than position, so the * currency sign keeps its key when a digit is added, and the ones digit is always `i0`. */ export declare function numberCells(text: string, parts?: readonly Intl.NumberFormatPart[]): NumberCell[]; /** Keep interpolation frames at the precision of the accepted measurement. */ export declare function interpolationFrameValue(frame: number, target: number): number; /** The next stop on a digit reel that shows `digit`, turning from `from` in the direction of change. */ export declare function reelTarget(from: number, digit: number, direction: 1 | -1): number; /** AnimatedNumber with its own MotionScope, so it animates wherever it is rendered. */ export declare function AnimatedNumber(props: AnimatedNumberProps): ReactElement;