export type PercentageInputOptions = { /** * Maximum number of digits allowed after the decimal point. Anything * beyond this is silently truncated as the user types. Defaults to 2. */ decimalPlaces?: number; }; /** * Sanitise a percentage-input string as the user types. * * Designed for use inside a descriptor's `getOnChange`. Rules: * * - Allows digits and a single decimal point; everything else is dropped. * - Caps the integer side at 100. Any 3+ digit value starting with `100` * clamps to `'100'` and drops the fractional part. Other 3+ digit values * truncate to their first two digits (preserves the "can't exceed 99" * behaviour you'd expect from a percentage input). * - Caps the fractional side at `decimalPlaces` digits (default 2). * - Collapses leading zeros on the integer part (`'07'` → `'7'`) but * preserves a lone `'0'` so the user can type `'0'` or `'0.5'`. * - Normalises a leading dot (`'.5'` → `'0.5'`). * - Preserves a trailing dot (`'5.'`) so the user can keep typing. * - Returns `''` for empty input. * * @example * percentageInput('33.333') // '33.33' * percentageInput('33.333', { decimalPlaces: 3 }) // '33.333' * percentageInput('100.5') // '100' * percentageInput('.5') // '0.5' * percentageInput('5a.2b') // '5.2' */ export declare const percentageInput: (value: string, options?: PercentageInputOptions) => string;