raqam 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +344 -0
- package/dist/chunk-IG7CVIA2.js +14 -0
- package/dist/chunk-IG7CVIA2.js.map +1 -0
- package/dist/chunk-NBAZIJ5W.js +25 -0
- package/dist/chunk-NBAZIJ5W.js.map +1 -0
- package/dist/chunk-NSFX2EAT.js +14 -0
- package/dist/chunk-NSFX2EAT.js.map +1 -0
- package/dist/chunk-NTROGAES.js +14 -0
- package/dist/chunk-NTROGAES.js.map +1 -0
- package/dist/chunk-VOBTYII2.js +14 -0
- package/dist/chunk-VOBTYII2.js.map +1 -0
- package/dist/chunk-WTS5RY7S.js +16 -0
- package/dist/chunk-WTS5RY7S.js.map +1 -0
- package/dist/core.cjs +2 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +351 -0
- package/dist/core.d.ts +351 -0
- package/dist/core.js +2 -0
- package/dist/core.js.map +1 -0
- package/dist/index-B8X3-9h1.d.cts +343 -0
- package/dist/index-B8X3-9h1.d.ts +343 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +193 -0
- package/dist/index.d.ts +193 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/locales/ar.cjs +36 -0
- package/dist/locales/ar.cjs.map +1 -0
- package/dist/locales/ar.d.cts +4 -0
- package/dist/locales/ar.d.ts +4 -0
- package/dist/locales/ar.js +4 -0
- package/dist/locales/ar.js.map +1 -0
- package/dist/locales/bn.cjs +36 -0
- package/dist/locales/bn.cjs.map +1 -0
- package/dist/locales/bn.d.cts +4 -0
- package/dist/locales/bn.d.ts +4 -0
- package/dist/locales/bn.js +4 -0
- package/dist/locales/bn.js.map +1 -0
- package/dist/locales/fa.cjs +38 -0
- package/dist/locales/fa.cjs.map +1 -0
- package/dist/locales/fa.d.cts +4 -0
- package/dist/locales/fa.d.ts +4 -0
- package/dist/locales/fa.js +4 -0
- package/dist/locales/fa.js.map +1 -0
- package/dist/locales/hi.cjs +36 -0
- package/dist/locales/hi.cjs.map +1 -0
- package/dist/locales/hi.d.cts +4 -0
- package/dist/locales/hi.d.ts +4 -0
- package/dist/locales/hi.js +4 -0
- package/dist/locales/hi.js.map +1 -0
- package/dist/locales/index.cjs +78 -0
- package/dist/locales/index.cjs.map +1 -0
- package/dist/locales/index.d.cts +5 -0
- package/dist/locales/index.d.ts +5 -0
- package/dist/locales/index.js +8 -0
- package/dist/locales/index.js.map +1 -0
- package/dist/locales/th.cjs +36 -0
- package/dist/locales/th.cjs.map +1 -0
- package/dist/locales/th.d.cts +4 -0
- package/dist/locales/th.d.ts +4 -0
- package/dist/locales/th.js +4 -0
- package/dist/locales/th.js.map +1 -0
- package/dist/react.cjs +3 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +3 -0
- package/dist/react.d.ts +3 -0
- package/dist/react.js +3 -0
- package/dist/react.js.map +1 -0
- package/package.json +170 -0
package/dist/core.d.cts
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
interface LocaleInfo {
|
|
2
|
+
/** Decimal separator for this locale (e.g. "." en-US, "," de-DE, "٫" fa-IR) */
|
|
3
|
+
decimalSeparator: string;
|
|
4
|
+
/** Grouping (thousands) separator (e.g. "," en-US, "." de-DE, "٬" fa-IR) */
|
|
5
|
+
groupingSeparator: string;
|
|
6
|
+
/** Minus sign character (usually "-" but can differ) */
|
|
7
|
+
minusSign: string;
|
|
8
|
+
/** Locale's representation of "0" (e.g. "0" for Latin, "۰" for Persian) */
|
|
9
|
+
zero: string;
|
|
10
|
+
/** Whether this is an RTL locale */
|
|
11
|
+
isRTL: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface FormatResult {
|
|
14
|
+
formatted: string;
|
|
15
|
+
parts: Intl.NumberFormatPart[];
|
|
16
|
+
}
|
|
17
|
+
interface ParseResult {
|
|
18
|
+
/** The parsed number, or null if empty / un-parseable */
|
|
19
|
+
value: number | null;
|
|
20
|
+
/** True for valid numbers */
|
|
21
|
+
isValid: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* True for valid-but-incomplete input that must not be reformatted yet:
|
|
24
|
+
* "-", "1.", "1.0", "1.00", etc.
|
|
25
|
+
*/
|
|
26
|
+
isIntermediate: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* boolean[] of length formattedValue.length + 1.
|
|
30
|
+
* true → cursor may rest at this index
|
|
31
|
+
* false → cursor must not rest here (e.g. inside a thousands separator)
|
|
32
|
+
*/
|
|
33
|
+
type CaretBoundary = boolean[];
|
|
34
|
+
/** Unicode codepoint range [start, end] inclusive representing a digit block */
|
|
35
|
+
type DigitBlock = readonly [number, number];
|
|
36
|
+
interface UseNumberFieldStateOptions {
|
|
37
|
+
/** Controlled numeric value */
|
|
38
|
+
value?: number | null;
|
|
39
|
+
/** Uncontrolled default value */
|
|
40
|
+
defaultValue?: number | null;
|
|
41
|
+
/** Fires on every meaningful value change */
|
|
42
|
+
onChange?: (value: number | null) => void;
|
|
43
|
+
/** BCP 47 locale tag (default: browser locale) */
|
|
44
|
+
locale?: string;
|
|
45
|
+
/** Full Intl.NumberFormatOptions — currency, percent, decimal, etc. */
|
|
46
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
47
|
+
/** Minimum allowed value */
|
|
48
|
+
minValue?: number;
|
|
49
|
+
/** Maximum allowed value */
|
|
50
|
+
maxValue?: number;
|
|
51
|
+
/** Step amount for increment/decrement (default: 1) */
|
|
52
|
+
step?: number;
|
|
53
|
+
/** Large step — Shift+Arrow / PageUp/Down (default: step * 10) */
|
|
54
|
+
largeStep?: number;
|
|
55
|
+
/** Small step — Meta/Ctrl+Arrow (default: step * 0.1) */
|
|
56
|
+
smallStep?: number;
|
|
57
|
+
/** Allow negative values (default: true) */
|
|
58
|
+
allowNegative?: boolean;
|
|
59
|
+
/** Allow decimal values (default: true) */
|
|
60
|
+
allowDecimal?: boolean;
|
|
61
|
+
/** Override maximumFractionDigits from formatOptions */
|
|
62
|
+
maximumFractionDigits?: number;
|
|
63
|
+
/** Override minimumFractionDigits from formatOptions */
|
|
64
|
+
minimumFractionDigits?: number;
|
|
65
|
+
/** Always show exactly maximumFractionDigits decimal places */
|
|
66
|
+
fixedDecimalScale?: boolean;
|
|
67
|
+
/** When clamping happens (default: "blur") */
|
|
68
|
+
clampBehavior?: "blur" | "strict" | "none";
|
|
69
|
+
/** Apply live formatting while typing (default: true) */
|
|
70
|
+
liveFormat?: boolean;
|
|
71
|
+
/** Arbitrary prefix string (e.g. "$") */
|
|
72
|
+
prefix?: string;
|
|
73
|
+
/** Arbitrary suffix string (e.g. " تومان") */
|
|
74
|
+
suffix?: string;
|
|
75
|
+
/** Disable the field */
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
/** Make the field read-only */
|
|
78
|
+
readOnly?: boolean;
|
|
79
|
+
/** Mark the field as required */
|
|
80
|
+
required?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Allow values outside min/max to be typed and committed without clamping.
|
|
83
|
+
* Useful when server-side validation handles clamping.
|
|
84
|
+
* When true, aria-invalid is set when value is out of range.
|
|
85
|
+
* default: false
|
|
86
|
+
*/
|
|
87
|
+
allowOutOfRange?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Custom validation function. Called on every value change.
|
|
90
|
+
* - Return `true` or `null`/`undefined` → valid
|
|
91
|
+
* - Return `false` → invalid (aria-invalid set, no error message)
|
|
92
|
+
* - Return a `string` → invalid with that string as the error message
|
|
93
|
+
*/
|
|
94
|
+
validate?: (value: number | null) => boolean | string | null | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Fires with the raw unformatted string the user typed, preserving full
|
|
97
|
+
* decimal precision before JS float conversion. Useful for financial apps
|
|
98
|
+
* that need arbitrary-precision string arithmetic.
|
|
99
|
+
* Fires alongside `onChange`.
|
|
100
|
+
*/
|
|
101
|
+
onRawChange?: (rawValue: string | null) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Custom format function. When provided, replaces the built-in Intl.NumberFormat
|
|
104
|
+
* formatter for display purposes. Also used for initial display value.
|
|
105
|
+
*/
|
|
106
|
+
formatValue?: (value: number) => string;
|
|
107
|
+
/**
|
|
108
|
+
* Custom parse function. When provided, replaces the built-in locale-aware parser.
|
|
109
|
+
* Must return `{ value: number | null, isIntermediate: boolean }`.
|
|
110
|
+
*/
|
|
111
|
+
parseValue?: (input: string) => {
|
|
112
|
+
value: number | null;
|
|
113
|
+
isIntermediate: boolean;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
interface NumberFieldState {
|
|
117
|
+
/** The display string shown in the input */
|
|
118
|
+
inputValue: string;
|
|
119
|
+
/** The parsed numeric value (null for empty/invalid) */
|
|
120
|
+
numberValue: number | null;
|
|
121
|
+
/**
|
|
122
|
+
* The raw string value exactly as the user typed it (before formatting).
|
|
123
|
+
* Preserves full decimal precision — useful for financial arbitrary-precision math.
|
|
124
|
+
*/
|
|
125
|
+
rawValue: string | null;
|
|
126
|
+
/** Whether increment is currently possible */
|
|
127
|
+
canIncrement: boolean;
|
|
128
|
+
/** Whether decrement is currently possible */
|
|
129
|
+
canDecrement: boolean;
|
|
130
|
+
/** Whether the ScrubArea is currently being dragged */
|
|
131
|
+
isScrubbing: boolean;
|
|
132
|
+
/** Update the isScrubbing state (called by useScrubArea) */
|
|
133
|
+
setIsScrubbing: (val: boolean) => void;
|
|
134
|
+
/** Whether the input is currently focused */
|
|
135
|
+
isFocused: boolean;
|
|
136
|
+
/** Update the isFocused state (called by useNumberField) */
|
|
137
|
+
setIsFocused: (val: boolean) => void;
|
|
138
|
+
/** Current validation state — 'valid' if no validate prop, or based on validate result */
|
|
139
|
+
validationState: "valid" | "invalid";
|
|
140
|
+
/** Error message from validate() if it returned a string, otherwise null */
|
|
141
|
+
validationError: string | null;
|
|
142
|
+
/** Internal: set the reason for the next onChange call (used by useNumberField) */
|
|
143
|
+
_setLastChangeReason: (reason: ChangeReason) => void;
|
|
144
|
+
/** Internal: read the current change reason (used by NumberField.Root) */
|
|
145
|
+
_getLastChangeReason: () => ChangeReason;
|
|
146
|
+
/** Update display string (triggers parse + onChange) */
|
|
147
|
+
setInputValue: (val: string) => void;
|
|
148
|
+
/** Directly set the numeric value (triggers format + onChange) */
|
|
149
|
+
setNumberValue: (val: number | null) => void;
|
|
150
|
+
/** Format + clamp on blur — call from onBlur */
|
|
151
|
+
commit: () => void;
|
|
152
|
+
/** Increment by step */
|
|
153
|
+
increment: (amount?: number) => void;
|
|
154
|
+
/** Decrement by step */
|
|
155
|
+
decrement: (amount?: number) => void;
|
|
156
|
+
/** Jump to maxValue */
|
|
157
|
+
incrementToMax: () => void;
|
|
158
|
+
/** Jump to minValue */
|
|
159
|
+
decrementToMin: () => void;
|
|
160
|
+
/** Raw options (for hooks that need them) */
|
|
161
|
+
options: UseNumberFieldStateOptions;
|
|
162
|
+
}
|
|
163
|
+
/** Reason for a value change — propagated through onValueChange details */
|
|
164
|
+
type ChangeReason = "input" | "clear" | "blur" | "paste" | "keyboard" | "increment" | "decrement" | "wheel" | "scrub";
|
|
165
|
+
interface UseNumberFieldProps extends UseNumberFieldStateOptions {
|
|
166
|
+
/** Visible label text (used for aria-label fallback) */
|
|
167
|
+
label?: string;
|
|
168
|
+
"aria-label"?: string;
|
|
169
|
+
"aria-describedby"?: string;
|
|
170
|
+
"aria-labelledby"?: string;
|
|
171
|
+
/** Form field name — renders a hidden input */
|
|
172
|
+
name?: string;
|
|
173
|
+
/** id for the input element */
|
|
174
|
+
id?: string;
|
|
175
|
+
/** Enable mouse-wheel increment/decrement */
|
|
176
|
+
allowMouseWheel?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Controls what is placed in the clipboard on copy/cut.
|
|
179
|
+
* - 'formatted' (default): browser-native copy of display string
|
|
180
|
+
* - 'raw': numberValue as a plain JS number string (e.g. "1234.56")
|
|
181
|
+
* - 'number': alias for 'raw'
|
|
182
|
+
*/
|
|
183
|
+
copyBehavior?: "formatted" | "raw" | "number";
|
|
184
|
+
/** Milliseconds before press-and-hold repeat starts (default: 400) */
|
|
185
|
+
stepHoldDelay?: number;
|
|
186
|
+
/** Initial milliseconds between repeats during press-and-hold (default: 200) */
|
|
187
|
+
stepHoldInterval?: number;
|
|
188
|
+
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
189
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
190
|
+
}
|
|
191
|
+
interface NumberFieldAria {
|
|
192
|
+
labelProps: React.LabelHTMLAttributes<HTMLLabelElement>;
|
|
193
|
+
groupProps: React.HTMLAttributes<HTMLDivElement>;
|
|
194
|
+
inputProps: React.InputHTMLAttributes<HTMLInputElement>;
|
|
195
|
+
hiddenInputProps: React.InputHTMLAttributes<HTMLInputElement> | null;
|
|
196
|
+
incrementButtonProps: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
197
|
+
decrementButtonProps: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
198
|
+
descriptionProps: React.HTMLAttributes<HTMLElement>;
|
|
199
|
+
errorMessageProps: React.HTMLAttributes<HTMLElement>;
|
|
200
|
+
}
|
|
201
|
+
type StateRenderFn = (props: Record<string, unknown>, state: NumberFieldState) => React.ReactElement;
|
|
202
|
+
type RenderProp = React.ReactElement | StateRenderFn;
|
|
203
|
+
interface NumberFieldRootProps extends UseNumberFieldProps {
|
|
204
|
+
children?: React.ReactNode;
|
|
205
|
+
/** CSS class for the root wrapper div */
|
|
206
|
+
className?: string;
|
|
207
|
+
/** Inline style for the root wrapper div */
|
|
208
|
+
style?: React.CSSProperties;
|
|
209
|
+
/** Fires on every meaningful value change */
|
|
210
|
+
onValueChange?: (value: number | null, details: {
|
|
211
|
+
reason: ChangeReason;
|
|
212
|
+
formattedValue: string;
|
|
213
|
+
event?: React.SyntheticEvent;
|
|
214
|
+
}) => void;
|
|
215
|
+
/** Fires only on commit (blur, Enter) */
|
|
216
|
+
onValueCommitted?: (value: number | null, details: {
|
|
217
|
+
reason: "blur" | "keyboard";
|
|
218
|
+
}) => void;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Format presets — named Intl.NumberFormatOptions configurations for common
|
|
223
|
+
* number input patterns. Use these as the `formatOptions` prop value.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* import { presets } from 'raqam'
|
|
227
|
+
* <NumberField.Root formatOptions={presets.currency('USD')} />
|
|
228
|
+
* <NumberField.Root formatOptions={presets.percent} />
|
|
229
|
+
* <NumberField.Root formatOptions={presets.compact} />
|
|
230
|
+
*/
|
|
231
|
+
declare const presets: {
|
|
232
|
+
/** Currency with standard sign display. Shorthand for `{ style:'currency', currency:code }`. */
|
|
233
|
+
readonly currency: (code: string) => Intl.NumberFormatOptions;
|
|
234
|
+
/**
|
|
235
|
+
* Accounting currency — negatives shown as `(1,234.56)` instead of `-$1,234.56`.
|
|
236
|
+
* Requires the accounting format parser fix (built-in to raqam).
|
|
237
|
+
*/
|
|
238
|
+
readonly accounting: (code: string) => Intl.NumberFormatOptions;
|
|
239
|
+
/** Percentage — formats 0.42 as "42%" */
|
|
240
|
+
readonly percent: Intl.NumberFormatOptions;
|
|
241
|
+
/** Compact short — "1.2K", "3.4M" */
|
|
242
|
+
readonly compact: Intl.NumberFormatOptions;
|
|
243
|
+
/** Compact long — "1.2 thousand", "3.4 million" */
|
|
244
|
+
readonly compactLong: Intl.NumberFormatOptions;
|
|
245
|
+
/** Scientific notation — "1.234E3" */
|
|
246
|
+
readonly scientific: Intl.NumberFormatOptions;
|
|
247
|
+
/** Engineering notation — exponents always multiples of 3 */
|
|
248
|
+
readonly engineering: Intl.NumberFormatOptions;
|
|
249
|
+
/** Integer — no decimal places */
|
|
250
|
+
readonly integer: Intl.NumberFormatOptions;
|
|
251
|
+
/**
|
|
252
|
+
* Financial — always exactly 2 decimal places (fixed scale).
|
|
253
|
+
* Combine with `fixedDecimalScale` prop for strict display.
|
|
254
|
+
*/
|
|
255
|
+
readonly financial: Intl.NumberFormatOptions;
|
|
256
|
+
/**
|
|
257
|
+
* Unit — shorthand for `{ style:'unit', unit:unitCode }`.
|
|
258
|
+
* @example presets.unit('kilometer-per-hour') → { style:'unit', unit:'kilometer-per-hour' }
|
|
259
|
+
*/
|
|
260
|
+
readonly unit: (unit: string) => Intl.NumberFormatOptions;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
interface LocaleConfig {
|
|
264
|
+
/** Extra digit block ranges to register */
|
|
265
|
+
digitBlocks?: DigitBlock[];
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Register additional digit blocks (called by locale plugins as a side effect).
|
|
269
|
+
* Duplicate ranges are silently ignored.
|
|
270
|
+
*/
|
|
271
|
+
declare function registerLocale(config: LocaleConfig): void;
|
|
272
|
+
/**
|
|
273
|
+
* Normalise any Unicode decimal digit in `input` to its ASCII equivalent (0–9).
|
|
274
|
+
* Non-digit characters pass through unchanged.
|
|
275
|
+
*/
|
|
276
|
+
declare function normalizeDigits(input: string): string;
|
|
277
|
+
|
|
278
|
+
interface FormatterOptions {
|
|
279
|
+
locale?: string;
|
|
280
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
281
|
+
prefix?: string;
|
|
282
|
+
suffix?: string;
|
|
283
|
+
minimumFractionDigits?: number;
|
|
284
|
+
maximumFractionDigits?: number;
|
|
285
|
+
fixedDecimalScale?: boolean;
|
|
286
|
+
}
|
|
287
|
+
interface Formatter {
|
|
288
|
+
format(value: number): string;
|
|
289
|
+
formatToParts(value: number): Intl.NumberFormatPart[];
|
|
290
|
+
getLocaleInfo(): LocaleInfo;
|
|
291
|
+
formatResult(value: number): FormatResult;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Create a formatter instance. Intl.NumberFormat is cached — safe to call
|
|
295
|
+
* on every render.
|
|
296
|
+
*/
|
|
297
|
+
declare function createFormatter(opts: FormatterOptions): Formatter;
|
|
298
|
+
|
|
299
|
+
interface ParserOptions {
|
|
300
|
+
locale?: string;
|
|
301
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
302
|
+
allowNegative?: boolean;
|
|
303
|
+
allowDecimal?: boolean;
|
|
304
|
+
prefix?: string;
|
|
305
|
+
suffix?: string;
|
|
306
|
+
}
|
|
307
|
+
interface Parser {
|
|
308
|
+
parse(input: string): ParseResult;
|
|
309
|
+
isIntermediate(input: string): boolean;
|
|
310
|
+
getLocaleInfo(): LocaleInfo;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Create a locale-aware parser. Separator characters are extracted from
|
|
314
|
+
* Intl.NumberFormat — never hardcoded.
|
|
315
|
+
*/
|
|
316
|
+
declare function createParser(opts?: ParserOptions): Parser;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Build a boolean array of length `formattedValue.length + 1`.
|
|
320
|
+
* `true` → cursor may rest at this position.
|
|
321
|
+
* `false` → cursor must snap away (sits inside a formatting-only character
|
|
322
|
+
* such as a grouping separator or a currency prefix).
|
|
323
|
+
*
|
|
324
|
+
* Rules:
|
|
325
|
+
* - Start and end positions are always valid.
|
|
326
|
+
* - A position immediately AFTER a grouping separator is invalid (the
|
|
327
|
+
* cursor would look like it's between two digits but moving left would
|
|
328
|
+
* skip the comma).
|
|
329
|
+
* - A position immediately BEFORE a grouping separator is valid.
|
|
330
|
+
*/
|
|
331
|
+
declare function getCaretBoundary(formattedValue: string, info: LocaleInfo): CaretBoundary;
|
|
332
|
+
/**
|
|
333
|
+
* Compute the new cursor position in `newFormatted` that corresponds
|
|
334
|
+
* semantically to `oldCursor` in `oldInput`.
|
|
335
|
+
*
|
|
336
|
+
* Algorithm (3 stages from the spec):
|
|
337
|
+
*
|
|
338
|
+
* 1. Count accepted characters before `oldCursor` in `oldInput`.
|
|
339
|
+
* 2. Adjust for backspace-over-separator edge case.
|
|
340
|
+
* 3. Walk `newFormatted` to find the position where the same count of
|
|
341
|
+
* accepted chars precede it; snap to the nearest valid boundary.
|
|
342
|
+
*
|
|
343
|
+
* @param oldInput The raw string the user just typed into (pre-format)
|
|
344
|
+
* @param oldCursor selectionStart captured from the native event
|
|
345
|
+
* @param newFormatted The formatted string we're about to display
|
|
346
|
+
* @param info Locale separators
|
|
347
|
+
* @param inputType e.nativeEvent.inputType (optional — for backspace detection)
|
|
348
|
+
*/
|
|
349
|
+
declare function computeNewCursorPosition(oldInput: string, oldCursor: number, newFormatted: string, info: LocaleInfo, inputType?: string): number;
|
|
350
|
+
|
|
351
|
+
export { type CaretBoundary, type ChangeReason, type DigitBlock, type FormatResult, type Formatter, type FormatterOptions, type LocaleConfig, type LocaleInfo, type NumberFieldAria, type NumberFieldRootProps, type NumberFieldState, type ParseResult, type Parser, type ParserOptions, type RenderProp, type StateRenderFn, type UseNumberFieldProps, type UseNumberFieldStateOptions, computeNewCursorPosition, createFormatter, createParser, getCaretBoundary, normalizeDigits, presets, registerLocale };
|