/** One unit a figure may be read or typed in: its label, and how many of the figure's own unit one of it holds. */ export interface UnitRung { label: string; factor: number; } /** * A FIGURE'S UNIT AS PLAIN DATA — the shape `@lotics/shared`'s `unitScale(unit, locale)` hands a surface that * cannot import the catalog. `label` follows the figure; `ladder` is where a compact place may read it, its own * rung first (factor 1), then each larger — one rung for a counted noun, which never scales; `entries` are the * units an entry may be typed in, each named by its case-folded words. */ export interface UnitScale { label: string; ladder: readonly UnitRung[]; entries: readonly (UnitRung & { names: readonly string[]; })[]; } export interface FormatMoneyOptions { locale?: string; currency?: string; /** * In the locale's own words: `vi` "1,3 tỷ ₫" / "2,7 tr ₫" / "486 tr ₫", others M and B ("$1.2M") — a tenth * kept under ten of the unit, the same digits wherever it is read. For stat cards whose full figure is in the * table below, never the table. */ compact?: boolean; /** * `Intl` floors at the currency's minor unit, so a 0,019 US$/kg rate prints `0,02`, a 5% error. * Set it on unit prices; totals keep two decimals. */ maxFractionDigits?: number; /** * `false`: the figure at the currency's decimals (or `compact`'s form) with no symbol — the first of a pair * whose bound names the currency once (`41,10 / 375,00 US$`, `overBound`). */ symbol?: false; /** * With `compact`: the magnitude its unit is read at — a chart's largest figure — so every figure on one * chart takes one form (`−0,6 tr ₫` beside `−126 tr ₫`, never `−609.900 ₫`). */ scale?: number; } /** * `vi` gets its own words (tỷ, tr); other locales M and B, since "1 tr USD" on a US register reads as a typo. * No compact form falls back to grouped digits. Money is `formatMoney` with `compact`. `scale`, as * `FormatMoneyOptions.scale`; unstated, the figure is its own. A figure in a `unit` reads in the largest rung of its * ladder it reaches — 12 500 kg is "12,5 tấn", a tenth kept under a hundred of it; short of the next rung it keeps * its own unit and its digits. A plain figure keeps `inUnit`'s digits alone or at a scale: "2,7 tr", "486 tr". */ export declare function formatCompactNumber(value: number, locale?: string, scale?: number, unit?: Pick): string; /** * A figure's two written forms and where its sign stands: `full` with its sign or unit, `bare` the same digits * alone, and `leads` where the sign comes before the figure (`$12`) rather than after it (`12 ₫`, `12 kg`). */ export interface FigureNotation { full: (value: number) => string; bare: (value: number) => string; leads: boolean; } /** * A FIGURE AGAINST ITS BOUND, the one way `x / y` is written wherever it is read — a summary line, a meter's * caption, a goal's tile. A sign or unit that follows the figure stands once, after the bound: `14.160 / 52.000 ₫`, * `12 / 800 kg`. One that leads it stands on both, `$14,160.00 / $52,000.00`, since a bare figure before a signed * one reads as a count of something else. `null` has counted nothing yet: a dash. `figure` and `bound` are the * halves, for a surface that sets them apart. */ export declare function overBound(value: number | null, bound: number, notation: FigureNotation): { figure: string; bound: string; text: string; }; /** * A RANGE OF FIGURES, the one way `from–to` is written wherever a range is read — a filter's pill, a band's name. As * `overBound` writes a pair: a sign or unit that follows the figure stands once, after the upper end (`1–5 t`, * `20.000.000–50.000.000 ₫`); one that leads it stands on both (`$1.00–$5.00`). One end open reads the other with * `≥` or `≤`; both open, nothing. */ export declare function figureRange(min: number | null, max: number | null, notation: FigureNotation): string; /** Money in `currency`, its sign where `locale` writes it — before the figure (`$1.00`) or after it (`1 ₫`). */ export declare function moneyNotation(locale: string, currency: string, options?: Omit): FigureNotation; /** A quantity in `unit`, the unit after the figure; `compact`, in the rung of its ladder `scale` reaches, so both * figures of a pair read in one. */ export declare function quantityNotation(locale: string, unit: Pick, options?: { compact?: boolean; scale?: number; }): FigureNotation; /** * One statement for display and parsing, since `NumberInput` derives its accepted symbols from * these options; the same notation as {@link formatMoney}, so a figure keeps its shape on focus. */ export declare function moneyFormat(currency: string): Intl.NumberFormatOptions; /** * THE money formatter, defaulting to `1.234.567 ₫`. Never hand-roll grouping or ₫. Negatives take * the kit's one minus (`signed`). */ export declare function formatMoney(value: number, options?: FormatMoneyOptions): string; /** A bare figure in the locale's grouping, with the kit's one minus — the same negative money takes. */ export declare function formatNumber(value: number, options?: { locale?: string; maxFractionDigits?: number; }): string;