/** * The `number` mask, as a {@link MaskResolver}. * * Like `./mask-date.ts` and `./mask-time.ts`, a resolver rather than an engine * branch — same public contract as anything you write yourself. * * **Not** ported from cleave. cleave's `NumeralFormatter` reaches its grouping * through `numeralThousandsGroupStyle`, an enum (`thousand` / `lakh` / `wan`) * that hardcodes three of the world's grouping conventions and cannot express a * fourth. Here the separators and the group sizes are *read off* * `Intl.NumberFormat`, which every runtime already ships: * * ```ts * new Intl.NumberFormat('en-IN').formatToParts(-11234567.5) * // …integer '1', group, integer '12', group, integer '34', group, integer '567'… * // → primary group 3, secondary group 2 — lakh, without a lakh table. * ``` * * So `numeralThousandsGroupStyle: 'lakh'` becomes `numberLocale: 'en-IN'`, and * `'none'` becomes `delimiter: ''`. No locale data enters the package, and the * zero-dependency rule holds. * * Three cleave options are deliberately absent; see §10.13 M3 of the Input spec * for the reasoning: `prefix` / `suffix` (the compound already has `Input.Prefix` * and `Input.Suffix`, which sit outside the value and so need no stripping, no * caret override and no "can I delete the symbol" semantics), a min/max range * (a number has no completion signal, so there is no moment at which clamping * would not fight the user mid-keystroke — that belongs in validation), and * `fixedDecimalScale` (padding the fraction is a blur-time affordance, and this * layer never sees blur). */ import type { MaskNumberOptions, MaskResolver } from '@/types'; /** * Inserts `separator` into `digits` right-to-left: one primary group at the end, * then secondary groups. `primary` of 3 and `secondary` of 3 give thousands; * 3 and 2 give lakh. */ export declare const groupDigits: (digits: string, primary: number, secondary: number, separator: string) => string; /** * Builds the `number` mask. * * `` is shorthand for this; call it * directly to wrap or compose the behaviour. * * The caret needs no override. Anchor counting handles every mid-string edit, * and the two cases it cannot see — a stripped leading zero and an inserted * decimal mark — both land at the end of the value, where `useMask` anchors to * the end anyway. * * @param options - Locale, separators and the integer / fraction scales. * * @example * ```tsx * // The v1 `numeral` demo: 1.234.567,89 * const amount = createNumberMask({ number: true, numberLocale: 'tr-TR' }); * save(Number(meta.iso))} /> * ``` */ export declare const createNumberMask: (options: MaskNumberOptions) => MaskResolver;