numora-react 1.0.1 → 1.0.3

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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { ChangeEvent, ClipboardEvent } from 'react';
2
2
  import { FormatOn, ThousandStyle } from 'numora';
3
- interface NumericInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'type' | 'inputMode'> {
3
+ interface NumoraInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'type' | 'inputMode'> {
4
4
  maxDecimals?: number;
5
5
  onChange?: (e: ChangeEvent<HTMLInputElement> | ClipboardEvent<HTMLInputElement>) => void;
6
6
  formatOn?: FormatOn;
@@ -13,5 +13,7 @@ interface NumericInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
13
13
  enableLeadingZeros?: boolean;
14
14
  rawValueMode?: boolean;
15
15
  }
16
- declare const NumericInput: React.ForwardRefExoticComponent<NumericInputProps & React.RefAttributes<HTMLInputElement>>;
17
- export { NumericInput };
16
+ declare const NumoraInput: React.ForwardRefExoticComponent<NumoraInputProps & React.RefAttributes<HTMLInputElement>>;
17
+ export { NumoraInput };
18
+ export { FormatOn, ThousandStyle } from 'numora';
19
+ export type { FormattingOptions, CaretPositionInfo } from 'numora';
package/dist/index.esm.js CHANGED
@@ -1,432 +1,7 @@
1
- import require$$0, { forwardRef } from 'react';
2
- import { FormatOn, ThousandStyle, handleOnPasteNumoraInput, handleOnKeyDownNumoraInput, handleOnChangeNumoraInput } from 'numora';
3
-
4
- var jsxRuntime = {exports: {}};
5
-
6
- var reactJsxRuntime_production = {};
7
-
8
- /**
9
- * @license React
10
- * react-jsx-runtime.production.js
11
- *
12
- * Copyright (c) Meta Platforms, Inc. and affiliates.
13
- *
14
- * This source code is licensed under the MIT license found in the
15
- * LICENSE file in the root directory of this source tree.
16
- */
17
-
18
- var hasRequiredReactJsxRuntime_production;
19
-
20
- function requireReactJsxRuntime_production () {
21
- if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
22
- hasRequiredReactJsxRuntime_production = 1;
23
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
24
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
25
- function jsxProd(type, config, maybeKey) {
26
- var key = null;
27
- void 0 !== maybeKey && (key = "" + maybeKey);
28
- void 0 !== config.key && (key = "" + config.key);
29
- if ("key" in config) {
30
- maybeKey = {};
31
- for (var propName in config)
32
- "key" !== propName && (maybeKey[propName] = config[propName]);
33
- } else maybeKey = config;
34
- config = maybeKey.ref;
35
- return {
36
- $$typeof: REACT_ELEMENT_TYPE,
37
- type: type,
38
- key: key,
39
- ref: void 0 !== config ? config : null,
40
- props: maybeKey
41
- };
42
- }
43
- reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
44
- reactJsxRuntime_production.jsx = jsxProd;
45
- reactJsxRuntime_production.jsxs = jsxProd;
46
- return reactJsxRuntime_production;
47
- }
48
-
49
- var reactJsxRuntime_development = {};
50
-
51
- /**
52
- * @license React
53
- * react-jsx-runtime.development.js
54
- *
55
- * Copyright (c) Meta Platforms, Inc. and affiliates.
56
- *
57
- * This source code is licensed under the MIT license found in the
58
- * LICENSE file in the root directory of this source tree.
59
- */
60
-
61
- var hasRequiredReactJsxRuntime_development;
62
-
63
- function requireReactJsxRuntime_development () {
64
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
65
- hasRequiredReactJsxRuntime_development = 1;
66
- "production" !== process.env.NODE_ENV &&
67
- (function () {
68
- function getComponentNameFromType(type) {
69
- if (null == type) return null;
70
- if ("function" === typeof type)
71
- return type.$$typeof === REACT_CLIENT_REFERENCE
72
- ? null
73
- : type.displayName || type.name || null;
74
- if ("string" === typeof type) return type;
75
- switch (type) {
76
- case REACT_FRAGMENT_TYPE:
77
- return "Fragment";
78
- case REACT_PROFILER_TYPE:
79
- return "Profiler";
80
- case REACT_STRICT_MODE_TYPE:
81
- return "StrictMode";
82
- case REACT_SUSPENSE_TYPE:
83
- return "Suspense";
84
- case REACT_SUSPENSE_LIST_TYPE:
85
- return "SuspenseList";
86
- case REACT_ACTIVITY_TYPE:
87
- return "Activity";
88
- }
89
- if ("object" === typeof type)
90
- switch (
91
- ("number" === typeof type.tag &&
92
- console.error(
93
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
94
- ),
95
- type.$$typeof)
96
- ) {
97
- case REACT_PORTAL_TYPE:
98
- return "Portal";
99
- case REACT_CONTEXT_TYPE:
100
- return (type.displayName || "Context") + ".Provider";
101
- case REACT_CONSUMER_TYPE:
102
- return (type._context.displayName || "Context") + ".Consumer";
103
- case REACT_FORWARD_REF_TYPE:
104
- var innerType = type.render;
105
- type = type.displayName;
106
- type ||
107
- ((type = innerType.displayName || innerType.name || ""),
108
- (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
109
- return type;
110
- case REACT_MEMO_TYPE:
111
- return (
112
- (innerType = type.displayName || null),
113
- null !== innerType
114
- ? innerType
115
- : getComponentNameFromType(type.type) || "Memo"
116
- );
117
- case REACT_LAZY_TYPE:
118
- innerType = type._payload;
119
- type = type._init;
120
- try {
121
- return getComponentNameFromType(type(innerType));
122
- } catch (x) {}
123
- }
124
- return null;
125
- }
126
- function testStringCoercion(value) {
127
- return "" + value;
128
- }
129
- function checkKeyStringCoercion(value) {
130
- try {
131
- testStringCoercion(value);
132
- var JSCompiler_inline_result = !1;
133
- } catch (e) {
134
- JSCompiler_inline_result = true;
135
- }
136
- if (JSCompiler_inline_result) {
137
- JSCompiler_inline_result = console;
138
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
139
- var JSCompiler_inline_result$jscomp$0 =
140
- ("function" === typeof Symbol &&
141
- Symbol.toStringTag &&
142
- value[Symbol.toStringTag]) ||
143
- value.constructor.name ||
144
- "Object";
145
- JSCompiler_temp_const.call(
146
- JSCompiler_inline_result,
147
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
148
- JSCompiler_inline_result$jscomp$0
149
- );
150
- return testStringCoercion(value);
151
- }
152
- }
153
- function getTaskName(type) {
154
- if (type === REACT_FRAGMENT_TYPE) return "<>";
155
- if (
156
- "object" === typeof type &&
157
- null !== type &&
158
- type.$$typeof === REACT_LAZY_TYPE
159
- )
160
- return "<...>";
161
- try {
162
- var name = getComponentNameFromType(type);
163
- return name ? "<" + name + ">" : "<...>";
164
- } catch (x) {
165
- return "<...>";
166
- }
167
- }
168
- function getOwner() {
169
- var dispatcher = ReactSharedInternals.A;
170
- return null === dispatcher ? null : dispatcher.getOwner();
171
- }
172
- function UnknownOwner() {
173
- return Error("react-stack-top-frame");
174
- }
175
- function hasValidKey(config) {
176
- if (hasOwnProperty.call(config, "key")) {
177
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
178
- if (getter && getter.isReactWarning) return false;
179
- }
180
- return void 0 !== config.key;
181
- }
182
- function defineKeyPropWarningGetter(props, displayName) {
183
- function warnAboutAccessingKey() {
184
- specialPropKeyWarningShown ||
185
- ((specialPropKeyWarningShown = true),
186
- console.error(
187
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
188
- displayName
189
- ));
190
- }
191
- warnAboutAccessingKey.isReactWarning = true;
192
- Object.defineProperty(props, "key", {
193
- get: warnAboutAccessingKey,
194
- configurable: true
195
- });
196
- }
197
- function elementRefGetterWithDeprecationWarning() {
198
- var componentName = getComponentNameFromType(this.type);
199
- didWarnAboutElementRef[componentName] ||
200
- ((didWarnAboutElementRef[componentName] = true),
201
- console.error(
202
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
203
- ));
204
- componentName = this.props.ref;
205
- return void 0 !== componentName ? componentName : null;
206
- }
207
- function ReactElement(
208
- type,
209
- key,
210
- self,
211
- source,
212
- owner,
213
- props,
214
- debugStack,
215
- debugTask
216
- ) {
217
- self = props.ref;
218
- type = {
219
- $$typeof: REACT_ELEMENT_TYPE,
220
- type: type,
221
- key: key,
222
- props: props,
223
- _owner: owner
224
- };
225
- null !== (void 0 !== self ? self : null)
226
- ? Object.defineProperty(type, "ref", {
227
- enumerable: false,
228
- get: elementRefGetterWithDeprecationWarning
229
- })
230
- : Object.defineProperty(type, "ref", { enumerable: false, value: null });
231
- type._store = {};
232
- Object.defineProperty(type._store, "validated", {
233
- configurable: false,
234
- enumerable: false,
235
- writable: true,
236
- value: 0
237
- });
238
- Object.defineProperty(type, "_debugInfo", {
239
- configurable: false,
240
- enumerable: false,
241
- writable: true,
242
- value: null
243
- });
244
- Object.defineProperty(type, "_debugStack", {
245
- configurable: false,
246
- enumerable: false,
247
- writable: true,
248
- value: debugStack
249
- });
250
- Object.defineProperty(type, "_debugTask", {
251
- configurable: false,
252
- enumerable: false,
253
- writable: true,
254
- value: debugTask
255
- });
256
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
257
- return type;
258
- }
259
- function jsxDEVImpl(
260
- type,
261
- config,
262
- maybeKey,
263
- isStaticChildren,
264
- source,
265
- self,
266
- debugStack,
267
- debugTask
268
- ) {
269
- var children = config.children;
270
- if (void 0 !== children)
271
- if (isStaticChildren)
272
- if (isArrayImpl(children)) {
273
- for (
274
- isStaticChildren = 0;
275
- isStaticChildren < children.length;
276
- isStaticChildren++
277
- )
278
- validateChildKeys(children[isStaticChildren]);
279
- Object.freeze && Object.freeze(children);
280
- } else
281
- console.error(
282
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
283
- );
284
- else validateChildKeys(children);
285
- if (hasOwnProperty.call(config, "key")) {
286
- children = getComponentNameFromType(type);
287
- var keys = Object.keys(config).filter(function (k) {
288
- return "key" !== k;
289
- });
290
- isStaticChildren =
291
- 0 < keys.length
292
- ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
293
- : "{key: someKey}";
294
- didWarnAboutKeySpread[children + isStaticChildren] ||
295
- ((keys =
296
- 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
297
- console.error(
298
- 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
299
- isStaticChildren,
300
- children,
301
- keys,
302
- children
303
- ),
304
- (didWarnAboutKeySpread[children + isStaticChildren] = true));
305
- }
306
- children = null;
307
- void 0 !== maybeKey &&
308
- (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
309
- hasValidKey(config) &&
310
- (checkKeyStringCoercion(config.key), (children = "" + config.key));
311
- if ("key" in config) {
312
- maybeKey = {};
313
- for (var propName in config)
314
- "key" !== propName && (maybeKey[propName] = config[propName]);
315
- } else maybeKey = config;
316
- children &&
317
- defineKeyPropWarningGetter(
318
- maybeKey,
319
- "function" === typeof type
320
- ? type.displayName || type.name || "Unknown"
321
- : type
322
- );
323
- return ReactElement(
324
- type,
325
- children,
326
- self,
327
- source,
328
- getOwner(),
329
- maybeKey,
330
- debugStack,
331
- debugTask
332
- );
333
- }
334
- function validateChildKeys(node) {
335
- "object" === typeof node &&
336
- null !== node &&
337
- node.$$typeof === REACT_ELEMENT_TYPE &&
338
- node._store &&
339
- (node._store.validated = 1);
340
- }
341
- var React = require$$0,
342
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
343
- REACT_PORTAL_TYPE = Symbol.for("react.portal"),
344
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
345
- REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
346
- REACT_PROFILER_TYPE = Symbol.for("react.profiler");
347
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
348
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
349
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
350
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
351
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
352
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
353
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
354
- REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
355
- REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
356
- ReactSharedInternals =
357
- React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
358
- hasOwnProperty = Object.prototype.hasOwnProperty,
359
- isArrayImpl = Array.isArray,
360
- createTask = console.createTask
361
- ? console.createTask
362
- : function () {
363
- return null;
364
- };
365
- React = {
366
- "react-stack-bottom-frame": function (callStackForError) {
367
- return callStackForError();
368
- }
369
- };
370
- var specialPropKeyWarningShown;
371
- var didWarnAboutElementRef = {};
372
- var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind(
373
- React,
374
- UnknownOwner
375
- )();
376
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
377
- var didWarnAboutKeySpread = {};
378
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
379
- reactJsxRuntime_development.jsx = function (type, config, maybeKey, source, self) {
380
- var trackActualOwner =
381
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
382
- return jsxDEVImpl(
383
- type,
384
- config,
385
- maybeKey,
386
- false,
387
- source,
388
- self,
389
- trackActualOwner
390
- ? Error("react-stack-top-frame")
391
- : unknownOwnerDebugStack,
392
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
393
- );
394
- };
395
- reactJsxRuntime_development.jsxs = function (type, config, maybeKey, source, self) {
396
- var trackActualOwner =
397
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
398
- return jsxDEVImpl(
399
- type,
400
- config,
401
- maybeKey,
402
- true,
403
- source,
404
- self,
405
- trackActualOwner
406
- ? Error("react-stack-top-frame")
407
- : unknownOwnerDebugStack,
408
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
409
- );
410
- };
411
- })();
412
- return reactJsxRuntime_development;
413
- }
414
-
415
- var hasRequiredJsxRuntime;
416
-
417
- function requireJsxRuntime () {
418
- if (hasRequiredJsxRuntime) return jsxRuntime.exports;
419
- hasRequiredJsxRuntime = 1;
420
-
421
- if (process.env.NODE_ENV === 'production') {
422
- jsxRuntime.exports = requireReactJsxRuntime_production();
423
- } else {
424
- jsxRuntime.exports = requireReactJsxRuntime_development();
425
- }
426
- return jsxRuntime.exports;
427
- }
428
-
429
- var jsxRuntimeExports = requireJsxRuntime();
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import React, { forwardRef, useRef, useEffect } from 'react';
3
+ import { formatValueForNumora, ThousandStyle, FormatOn, handleOnPasteNumoraInput, handleOnKeyDownNumoraInput, handleOnChangeNumoraInput } from 'numora';
4
+ export { FormatOn, ThousandStyle } from 'numora';
430
5
 
431
6
  const DEFAULT_PROPS = {
432
7
  autoComplete: 'off',
@@ -438,22 +13,24 @@ const DEFAULT_PROPS = {
438
13
  spellCheck: false,
439
14
  step: 'any'
440
15
  };
441
- const NumericInput = /*#__PURE__*/forwardRef((_ref, ref) => {
442
- let {
443
- maxDecimals = 2,
444
- onChange,
445
- formatOn = FormatOn.Blur,
446
- thousandSeparator = ',',
447
- thousandStyle = ThousandStyle.Thousand,
448
- decimalSeparator = '.',
449
- decimalMinLength,
450
- enableCompactNotation = false,
451
- enableNegative = false,
452
- enableLeadingZeros = false,
453
- rawValueMode = false,
454
- ...props
455
- } = _ref;
456
- const [caretPositionBeforeChange, setCaretPositionBeforeChange] = require$$0.useState();
16
+ const NumoraInput = /*#__PURE__*/forwardRef(({
17
+ maxDecimals = 2,
18
+ onChange,
19
+ formatOn = FormatOn.Blur,
20
+ thousandSeparator = ',',
21
+ thousandStyle = ThousandStyle.Thousand,
22
+ decimalSeparator = '.',
23
+ decimalMinLength,
24
+ enableCompactNotation = false,
25
+ enableNegative = false,
26
+ enableLeadingZeros = false,
27
+ rawValueMode = false,
28
+ ...props
29
+ }, ref) => {
30
+ const [caretPositionBeforeChange, setCaretPositionBeforeChange] = React.useState();
31
+ const inputRef = React.useRef(null);
32
+ const isUserInputRef = useRef(false);
33
+ const previousValueRef = useRef(typeof props.value === 'string' ? props.value : props.value?.toString());
457
34
  const formattingOptions = {
458
35
  formatOn,
459
36
  thousandSeparator,
@@ -465,6 +42,23 @@ const NumericInput = /*#__PURE__*/forwardRef((_ref, ref) => {
465
42
  enableLeadingZeros,
466
43
  rawValueMode
467
44
  };
45
+ // Handle programmatic value changes (when value prop changes externally)
46
+ useEffect(() => {
47
+ const input = inputRef.current;
48
+ if (!input) return;
49
+ const currentValue = typeof props.value === 'string' ? props.value : props.value !== undefined ? String(props.value) : undefined;
50
+ const previousValue = previousValueRef.current;
51
+ // Only format if value changed externally (not from user input)
52
+ if (!isUserInputRef.current && currentValue !== previousValue && currentValue !== undefined) {
53
+ const formatted = formatValueForNumora(currentValue, maxDecimals, formattingOptions);
54
+ // Only update if formatted value differs from current input value
55
+ if (input.value !== formatted) {
56
+ input.value = formatted;
57
+ }
58
+ }
59
+ previousValueRef.current = currentValue;
60
+ isUserInputRef.current = false;
61
+ }, [props.value, maxDecimals, formatOn, thousandSeparator, thousandStyle, decimalSeparator, decimalMinLength, enableCompactNotation, enableNegative, enableLeadingZeros, rawValueMode]);
468
62
  function handleOnKeyDown(e) {
469
63
  const caretInfo = handleOnKeyDownNumoraInput(e.nativeEvent, formattingOptions);
470
64
  if (caretInfo) {
@@ -481,11 +75,13 @@ const NumericInput = /*#__PURE__*/forwardRef((_ref, ref) => {
481
75
  }
482
76
  }
483
77
  function handleOnChange(e) {
78
+ isUserInputRef.current = true;
484
79
  handleOnChangeNumoraInput(e.nativeEvent, maxDecimals, caretPositionBeforeChange, formattingOptions);
485
80
  setCaretPositionBeforeChange(undefined);
486
81
  if (onChange) onChange(e);
487
82
  }
488
83
  function handleOnPaste(e) {
84
+ isUserInputRef.current = true;
489
85
  handleOnPasteNumoraInput(e.nativeEvent, maxDecimals, formattingOptions);
490
86
  if (onChange) onChange(e);
491
87
  }
@@ -503,10 +99,19 @@ const NumericInput = /*#__PURE__*/forwardRef((_ref, ref) => {
503
99
  props.onBlur(e);
504
100
  }
505
101
  }
506
- return jsxRuntimeExports.jsx("input", {
102
+ // Combine refs: forward the ref and also store it internally
103
+ const setRefs = React.useCallback(node => {
104
+ inputRef.current = node;
105
+ if (typeof ref === 'function') {
106
+ ref(node);
107
+ } else if (ref) {
108
+ ref.current = node;
109
+ }
110
+ }, [ref]);
111
+ return jsx("input", {
507
112
  ...DEFAULT_PROPS,
508
113
  ...props,
509
- ref: ref,
114
+ ref: setRefs,
510
115
  onChange: handleOnChange,
511
116
  onKeyDown: handleOnKeyDown,
512
117
  onPaste: handleOnPaste,
@@ -516,7 +121,7 @@ const NumericInput = /*#__PURE__*/forwardRef((_ref, ref) => {
516
121
  inputMode: "decimal"
517
122
  });
518
123
  });
519
- NumericInput.displayName = 'NumericInput';
124
+ NumoraInput.displayName = 'NumoraInput';
520
125
 
521
- export { NumericInput };
126
+ export { NumoraInput };
522
127
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react-jsx-runtime.production.js","../node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react-jsx-runtime.development.js","../node_modules/.pnpm/react@19.1.0/node_modules/react/jsx-runtime.js","../src/index.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\");\nfunction jsxProd(type, config, maybeKey) {\n var key = null;\n void 0 !== maybeKey && (key = \"\" + maybeKey);\n void 0 !== config.key && (key = \"\" + config.key);\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n config = maybeKey.ref;\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: void 0 !== config ? config : null,\n props: maybeKey\n };\n}\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsxProd;\nexports.jsxs = jsxProd;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return (type.displayName || \"Context\") + \".Provider\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(\n type,\n key,\n self,\n source,\n owner,\n props,\n debugStack,\n debugTask\n ) {\n self = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== self ? self : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n source,\n self,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n self,\n source,\n getOwner(),\n maybeKey,\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_ELEMENT_TYPE &&\n node._store &&\n (node._store.validated = 1);\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\");\n Symbol.for(\"react.provider\");\n var REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n \"react-stack-bottom-frame\": function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React[\"react-stack-bottom-frame\"].bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey, source, self) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n source,\n self,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey, source, self) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n source,\n self,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","import React, { ChangeEvent, ClipboardEvent, forwardRef } from 'react';\nimport {\n handleOnChangeNumoraInput,\n handleOnPasteNumoraInput,\n handleOnKeyDownNumoraInput,\n FormatOn,\n ThousandStyle,\n type FormattingOptions,\n type CaretPositionInfo,\n} from 'numora';\n\ninterface NumericInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'type' | 'inputMode'> {\n maxDecimals?: number;\n onChange?: (e: ChangeEvent<HTMLInputElement> | ClipboardEvent<HTMLInputElement>) => void;\n\n // Formatting options\n formatOn?: FormatOn;\n thousandSeparator?: string;\n thousandStyle?: ThousandStyle;\n decimalSeparator?: string;\n decimalMinLength?: number;\n\n // Feature flags\n enableCompactNotation?: boolean;\n enableNegative?: boolean;\n enableLeadingZeros?: boolean;\n rawValueMode?: boolean;\n}\n\nconst DEFAULT_PROPS = {\n autoComplete: 'off',\n autoCorrect: 'off',\n autoCapitalize: 'none',\n minLength: 1,\n placeholder: '0.0',\n pattern: '^[0-9]*[.,]?[0-9]*$',\n spellCheck: false,\n step: 'any',\n};\n\nconst NumericInput = forwardRef<HTMLInputElement, NumericInputProps>(\n ({\n maxDecimals = 2,\n onChange,\n formatOn = FormatOn.Blur,\n thousandSeparator = ',',\n thousandStyle = ThousandStyle.Thousand,\n decimalSeparator = '.',\n decimalMinLength,\n enableCompactNotation = false,\n enableNegative = false,\n enableLeadingZeros = false,\n rawValueMode = false,\n ...props\n }: NumericInputProps, ref) => {\n const [caretPositionBeforeChange, setCaretPositionBeforeChange] =\n React.useState<CaretPositionInfo>();\n\n const formattingOptions: FormattingOptions = {\n formatOn,\n thousandSeparator,\n ThousandStyle: thousandStyle as any,\n decimalSeparator,\n decimalMinLength,\n enableCompactNotation,\n enableNegative,\n enableLeadingZeros,\n rawValueMode,\n };\n\n function handleOnKeyDown(e: React.KeyboardEvent<HTMLInputElement>): void {\n const caretInfo = handleOnKeyDownNumoraInput(e.nativeEvent, formattingOptions);\n\n if (caretInfo) {\n setCaretPositionBeforeChange(caretInfo);\n } else {\n const input = e.currentTarget;\n setCaretPositionBeforeChange({\n selectionStart: input.selectionStart ?? 0,\n selectionEnd: input.selectionEnd ?? 0,\n });\n }\n\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n }\n\n function handleOnChange(e: ChangeEvent<HTMLInputElement>): void {\n handleOnChangeNumoraInput(\n e.nativeEvent,\n maxDecimals,\n caretPositionBeforeChange,\n formattingOptions\n );\n setCaretPositionBeforeChange(undefined);\n if (onChange) onChange(e);\n }\n\n function handleOnPaste(e: ClipboardEvent<HTMLInputElement>): void {\n handleOnPasteNumoraInput(e.nativeEvent, maxDecimals, formattingOptions);\n if (onChange) onChange(e);\n }\n\n function handleOnFocus(e: React.FocusEvent<HTMLInputElement>): void {\n if (formatOn === FormatOn.Blur && thousandSeparator) {\n const target = e.currentTarget;\n target.value = target.value.replace(\n new RegExp(thousandSeparator.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'g'),\n ''\n );\n }\n\n if (props.onFocus) {\n props.onFocus(e);\n }\n }\n\n function handleOnBlur(e: React.FocusEvent<HTMLInputElement>): void {\n if (props.onBlur) {\n props.onBlur(e);\n }\n }\n\n return (\n <input\n {...DEFAULT_PROPS}\n {...props}\n ref={ref}\n onChange={handleOnChange}\n onKeyDown={handleOnKeyDown}\n onPaste={handleOnPaste}\n onFocus={handleOnFocus}\n onBlur={handleOnBlur}\n type=\"text\"\n inputMode=\"decimal\"\n />\n );\n }\n);\n\nNumericInput.displayName = 'NumericInput';\n\nexport { NumericInput };\n"],"names":["jsxRuntimeModule","require$$0","require$$1","DEFAULT_PROPS","autoComplete","autoCorrect","autoCapitalize","minLength","placeholder","pattern","spellCheck","step","NumericInput","forwardRef","_ref","ref","maxDecimals","onChange","formatOn","FormatOn","Blur","thousandSeparator","thousandStyle","ThousandStyle","Thousand","decimalSeparator","decimalMinLength","enableCompactNotation","enableNegative","enableLeadingZeros","rawValueMode","props","caretPositionBeforeChange","setCaretPositionBeforeChange","React","useState","formattingOptions","handleOnKeyDown","e","caretInfo","handleOnKeyDownNumoraInput","nativeEvent","input","currentTarget","selectionStart","selectionEnd","onKeyDown","handleOnChange","handleOnChangeNumoraInput","undefined","handleOnPaste","handleOnPasteNumoraInput","handleOnFocus","target","value","replace","RegExp","onFocus","handleOnBlur","onBlur","_jsx","onPaste","type","inputMode","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAWA,CAAA,IAAI,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC;AACjE,GAAE,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;AACpD,CAAA,SAAS,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE;GACvC,IAAI,GAAG,GAAG,IAAI;GACd,MAAM,KAAK,QAAQ,KAAK,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC;AAC9C,GAAE,MAAM,KAAK,MAAM,CAAC,GAAG,KAAK,GAAG,GAAG,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC;AAClD,GAAE,IAAI,KAAK,IAAI,MAAM,EAAE;KACnB,QAAQ,GAAG,EAAE;AACjB,KAAI,KAAK,IAAI,QAAQ,IAAI,MAAM;AAC/B,OAAM,KAAK,KAAK,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,MAAM;AAC1B,GAAE,MAAM,GAAG,QAAQ,CAAC,GAAG;AACvB,GAAE,OAAO;KACL,QAAQ,EAAE,kBAAkB;KAC5B,IAAI,EAAE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GAAGf,CAAC,CAACK,aAAa;MAC9BU,MAAM,CAACC,KAAK,GAAGD,MAAM,CAACC,KAAK,CAACC,OAAO,CACjC,IAAIC,MAAM,CAACnC,iBAAiB,CAACkC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,EACzE,EAAE,CACH;AACH;IAEA,IAAIxB,KAAK,CAAC0B,OAAO,EAAE;AACjB1B,MAAAA,KAAK,CAAC0B,OAAO,CAACnB,CAAC,CAAC;AAClB;AACF;EAEA,SAASoB,YAAYA,CAACpB,CAAqC,EAAA;IACzD,IAAIP,KAAK,CAAC4B,MAAM,EAAE;AAChB5B,MAAAA,KAAK,CAAC4B,MAAM,CAACrB,CAAC,CAAC;AACjB;AACF;EAEA,OACEsB,qBACM,CAAA,OAAA,EAAA;AAAA,IAAA,GAAAzD,aAAa;AACb,IAAA,GAAA4B,KAAK;AACThB,IAAAA,GAAG,EAAEA,GAAG;AACRE,IAAAA,QAAQ,EAAE8B,cAAc;AACxBD,IAAAA,SAAS,EAAET,eAAe;AAC1BwB,IAAAA,OAAO,EAAEX,aAAa;AACtBO,IAAAA,OAAO,EAAEL,aAAa;AACtBO,IAAAA,MAAM,EAAED,YAAY;AACpBI,IAAAA,IAAI,EAAC,MAAM;AACXC,IAAAA,SAAS,EAAC;AAAS,GAAA,CACnB;AAEN,CAAC;AAGHnD,YAAY,CAACoD,WAAW,GAAG,cAAc;;;;","x_google_ignoreList":[0,1,2]}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/index.tsx"],"sourcesContent":["import React, { ChangeEvent, ClipboardEvent, forwardRef, useEffect, useRef } from 'react';\nimport {\n FormatOn,\n ThousandStyle,\n FormattingOptions,\n CaretPositionInfo,\n handleOnChangeNumoraInput,\n handleOnPasteNumoraInput,\n handleOnKeyDownNumoraInput,\n formatValueForNumora,\n} from 'numora';\n\ninterface NumoraInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'type' | 'inputMode'> {\n maxDecimals?: number;\n onChange?: (e: ChangeEvent<HTMLInputElement> | ClipboardEvent<HTMLInputElement>) => void;\n\n // Formatting options\n formatOn?: FormatOn;\n thousandSeparator?: string;\n thousandStyle?: ThousandStyle;\n decimalSeparator?: string;\n decimalMinLength?: number;\n\n // Feature flags\n enableCompactNotation?: boolean;\n enableNegative?: boolean;\n enableLeadingZeros?: boolean;\n rawValueMode?: boolean;\n}\n\nconst DEFAULT_PROPS = {\n autoComplete: 'off',\n autoCorrect: 'off',\n autoCapitalize: 'none',\n minLength: 1,\n placeholder: '0.0',\n pattern: '^[0-9]*[.,]?[0-9]*$',\n spellCheck: false,\n step: 'any',\n};\n\nconst NumoraInput = forwardRef<HTMLInputElement, NumoraInputProps>(\n ({\n maxDecimals = 2,\n onChange,\n formatOn = FormatOn.Blur,\n thousandSeparator = ',',\n thousandStyle = ThousandStyle.Thousand,\n decimalSeparator = '.',\n decimalMinLength,\n enableCompactNotation = false,\n enableNegative = false,\n enableLeadingZeros = false,\n rawValueMode = false,\n ...props\n }: NumoraInputProps, ref: React.Ref<HTMLInputElement>) => {\n const [caretPositionBeforeChange, setCaretPositionBeforeChange] =\n React.useState<CaretPositionInfo>();\n const inputRef = React.useRef<HTMLInputElement>(null);\n const isUserInputRef = useRef(false);\n const previousValueRef = useRef<string | undefined>(\n typeof props.value === 'string' ? props.value : props.value?.toString()\n );\n\n const formattingOptions: FormattingOptions = {\n formatOn,\n thousandSeparator,\n ThousandStyle: thousandStyle as any,\n decimalSeparator,\n decimalMinLength,\n enableCompactNotation,\n enableNegative,\n enableLeadingZeros,\n rawValueMode,\n };\n\n // Handle programmatic value changes (when value prop changes externally)\n useEffect(() => {\n const input = inputRef.current;\n if (!input) return;\n\n const currentValue = typeof props.value === 'string'\n ? props.value\n : props.value !== undefined\n ? String(props.value)\n : undefined;\n const previousValue = previousValueRef.current;\n\n // Only format if value changed externally (not from user input)\n if (!isUserInputRef.current && currentValue !== previousValue && currentValue !== undefined) {\n const formatted = formatValueForNumora(\n currentValue,\n maxDecimals,\n formattingOptions\n );\n\n // Only update if formatted value differs from current input value\n if (input.value !== formatted) {\n input.value = formatted;\n }\n }\n\n previousValueRef.current = currentValue;\n isUserInputRef.current = false;\n }, [props.value, maxDecimals, formatOn, thousandSeparator, thousandStyle, decimalSeparator, decimalMinLength, enableCompactNotation, enableNegative, enableLeadingZeros, rawValueMode]);\n\n function handleOnKeyDown(e: React.KeyboardEvent<HTMLInputElement>): void {\n const caretInfo = handleOnKeyDownNumoraInput(e.nativeEvent, formattingOptions);\n\n if (caretInfo) {\n setCaretPositionBeforeChange(caretInfo);\n } else {\n const input = e.currentTarget;\n setCaretPositionBeforeChange({\n selectionStart: input.selectionStart ?? 0,\n selectionEnd: input.selectionEnd ?? 0,\n });\n }\n\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n }\n\n function handleOnChange(e: ChangeEvent<HTMLInputElement>): void {\n isUserInputRef.current = true;\n handleOnChangeNumoraInput(\n e.nativeEvent,\n maxDecimals,\n caretPositionBeforeChange,\n formattingOptions\n );\n setCaretPositionBeforeChange(undefined);\n if (onChange) onChange(e);\n }\n\n function handleOnPaste(e: ClipboardEvent<HTMLInputElement>): void {\n isUserInputRef.current = true;\n handleOnPasteNumoraInput(e.nativeEvent, maxDecimals, formattingOptions);\n if (onChange) onChange(e);\n }\n\n function handleOnFocus(e: React.FocusEvent<HTMLInputElement>): void {\n if (formatOn === FormatOn.Blur && thousandSeparator) {\n const target = e.currentTarget;\n target.value = target.value.replace(\n new RegExp(thousandSeparator.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'g'),\n ''\n );\n }\n\n if (props.onFocus) {\n props.onFocus(e);\n }\n }\n\n function handleOnBlur(e: React.FocusEvent<HTMLInputElement>): void {\n if (props.onBlur) {\n props.onBlur(e);\n }\n }\n\n // Combine refs: forward the ref and also store it internally\n const setRefs = React.useCallback((node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n }, [ref]);\n\n return (\n <input\n {...DEFAULT_PROPS}\n {...props}\n ref={setRefs}\n onChange={handleOnChange}\n onKeyDown={handleOnKeyDown}\n onPaste={handleOnPaste}\n onFocus={handleOnFocus}\n onBlur={handleOnBlur}\n type=\"text\"\n inputMode=\"decimal\"\n />\n );\n }\n);\n\nNumoraInput.displayName = 'NumoraInput';\n\nexport { NumoraInput };\nexport { FormatOn, ThousandStyle } from 'numora';\nexport type { FormattingOptions, CaretPositionInfo } from 'numora';\n"],"names":["DEFAULT_PROPS","autoComplete","autoCorrect","autoCapitalize","minLength","placeholder","pattern","spellCheck","step","NumoraInput","forwardRef","maxDecimals","onChange","formatOn","FormatOn","Blur","thousandSeparator","thousandStyle","ThousandStyle","Thousand","decimalSeparator","decimalMinLength","enableCompactNotation","enableNegative","enableLeadingZeros","rawValueMode","props","ref","caretPositionBeforeChange","setCaretPositionBeforeChange","React","useState","inputRef","useRef","isUserInputRef","previousValueRef","value","toString","formattingOptions","useEffect","input","current","currentValue","undefined","String","previousValue","formatted","formatValueForNumora","handleOnKeyDown","e","caretInfo","handleOnKeyDownNumoraInput","nativeEvent","currentTarget","selectionStart","selectionEnd","onKeyDown","handleOnChange","handleOnChangeNumoraInput","handleOnPaste","handleOnPasteNumoraInput","handleOnFocus","target","replace","RegExp","onFocus","handleOnBlur","onBlur","setRefs","useCallback","node","_jsx","onPaste","type","inputMode","displayName"],"mappings":";;;;;AA8BA,MAAMA,aAAa,GAAG;AACpBC,EAAAA,YAAY,EAAE,KAAK;AACnBC,EAAAA,WAAW,EAAE,KAAK;AAClBC,EAAAA,cAAc,EAAE,MAAM;AACtBC,EAAAA,SAAS,EAAE,CAAC;AACZC,EAAAA,WAAW,EAAE,KAAK;AAClBC,EAAAA,OAAO,EAAE,qBAAqB;AAC9BC,EAAAA,UAAU,EAAE,KAAK;AACjBC,EAAAA,IAAI,EAAE;CACP;AAED,MAAMC,WAAW,gBAAGC,UAAU,CAC5B,C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