import { FormatOn, ThousandStyle } from './types'; export interface NumoraInputOptions extends Partial> { formatOn?: FormatOn; thousandSeparator?: string; thousandStyle?: ThousandStyle; decimalSeparator?: string; decimalMaxLength?: number; decimalMinLength?: number; locale?: string | true; enableCompactNotation?: boolean; enableNegative?: boolean; enableLeadingZeros?: boolean; autoAddLeadingZero?: boolean; rawValueMode?: boolean; /** Max raw length (digits + decimal sep + leading `-`). Separators not counted. */ maxLength?: number; /** Reject keystroke/paste if this returns false. Called with post-sanitization raw value. */ isAllowed?: (rawValue: string) => boolean; onChange?: (value: string) => void; value?: string; defaultValue?: string; } export declare class NumoraInput { private element; private resolvedOptions; private rawValue; private suppressNextInputEvent; private pendingMouseStrip; private caretPositionBeforeChange?; constructor(container: HTMLElement, options: NumoraInputOptions); private toRaw; private setDefaultValue; private createInputElement; private setupEventListeners; /** * Runs `fn` with `suppressNextInputEvent` set so the synchronous `input` event fired * by `setRangeText` is short-circuited in `handleChange`. Exactly one set/clear pair * per write; try/finally guarantees the flag clears even if `fn` throws. */ private withInternalWrite; private handleValueChange; private applyDisplaySeparators; private handleBeforeInput; private handleChange; private handleKeyDown; private handlePaste; private stripSeparatorsAndMapCaret; private handleFocus; private handleMouseDown; private handleClick; private handleBlur; getValue(): string; /** * Sets the input's value programmatically. * * @param value - The new value. In `rawValueMode`, this is treated as raw and re-formatted for display. * @param options.undoable - Defaults to `true`: routes the write through `setRangeText` * so the browser's undo stack stays intact and `Ctrl+Z` can revert this call. Pass * `false` only when you intentionally want to wipe the undo history (e.g. form reset). */ setValue(value: string, options?: { undoable?: boolean; }): void; disable(): void; enable(): void; addEventListener(event: string, callback: EventListenerOrEventListenerObject): void; removeEventListener(event: string, callback: EventListenerOrEventListenerObject): void; /** * Returns the underlying HTMLInputElement for direct access. * This allows users to interact with the input as a normal HTMLInputElement. */ getElement(): HTMLInputElement; /** * Gets the current value of the input. * In rawValueMode, returns the raw numeric value without formatting. * Otherwise, returns the formatted display value. */ get value(): string; /** * Sets the value of the input. * In rawValueMode, the value will be formatted for display. * Otherwise, sets the value directly. */ set value(val: string); /** * Gets the value as a number, similar to HTMLInputElement.valueAsNumber. * Returns NaN if the value cannot be converted to a number. * * **Precision warning**: this getter returns a JavaScript `number` (IEEE 754 double). * Values beyond ~15 significant digits will lose precision. Numora is designed around * string values for this reason - prefer {@link getValue} when exact precision matters. * Treat `valueAsNumber` strictly as an escape hatch for arithmetic that you already know * is safe at float precision. */ get valueAsNumber(): number; /** * Sets the value from a number, similar to HTMLInputElement.valueAsNumber. */ set valueAsNumber(num: number); }