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.cjs.js CHANGED
@@ -1,435 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var require$$0 = require('react');
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
4
5
  var numora = require('numora');
5
6
 
6
- var jsxRuntime = {exports: {}};
7
-
8
- var reactJsxRuntime_production = {};
9
-
10
- /**
11
- * @license React
12
- * react-jsx-runtime.production.js
13
- *
14
- * Copyright (c) Meta Platforms, Inc. and affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */
19
-
20
- var hasRequiredReactJsxRuntime_production;
21
-
22
- function requireReactJsxRuntime_production () {
23
- if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
24
- hasRequiredReactJsxRuntime_production = 1;
25
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
26
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
27
- function jsxProd(type, config, maybeKey) {
28
- var key = null;
29
- void 0 !== maybeKey && (key = "" + maybeKey);
30
- void 0 !== config.key && (key = "" + config.key);
31
- if ("key" in config) {
32
- maybeKey = {};
33
- for (var propName in config)
34
- "key" !== propName && (maybeKey[propName] = config[propName]);
35
- } else maybeKey = config;
36
- config = maybeKey.ref;
37
- return {
38
- $$typeof: REACT_ELEMENT_TYPE,
39
- type: type,
40
- key: key,
41
- ref: void 0 !== config ? config : null,
42
- props: maybeKey
43
- };
44
- }
45
- reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
46
- reactJsxRuntime_production.jsx = jsxProd;
47
- reactJsxRuntime_production.jsxs = jsxProd;
48
- return reactJsxRuntime_production;
49
- }
50
-
51
- var reactJsxRuntime_development = {};
52
-
53
- /**
54
- * @license React
55
- * react-jsx-runtime.development.js
56
- *
57
- * Copyright (c) Meta Platforms, Inc. and affiliates.
58
- *
59
- * This source code is licensed under the MIT license found in the
60
- * LICENSE file in the root directory of this source tree.
61
- */
62
-
63
- var hasRequiredReactJsxRuntime_development;
64
-
65
- function requireReactJsxRuntime_development () {
66
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
67
- hasRequiredReactJsxRuntime_development = 1;
68
- "production" !== process.env.NODE_ENV &&
69
- (function () {
70
- function getComponentNameFromType(type) {
71
- if (null == type) return null;
72
- if ("function" === typeof type)
73
- return type.$$typeof === REACT_CLIENT_REFERENCE
74
- ? null
75
- : type.displayName || type.name || null;
76
- if ("string" === typeof type) return type;
77
- switch (type) {
78
- case REACT_FRAGMENT_TYPE:
79
- return "Fragment";
80
- case REACT_PROFILER_TYPE:
81
- return "Profiler";
82
- case REACT_STRICT_MODE_TYPE:
83
- return "StrictMode";
84
- case REACT_SUSPENSE_TYPE:
85
- return "Suspense";
86
- case REACT_SUSPENSE_LIST_TYPE:
87
- return "SuspenseList";
88
- case REACT_ACTIVITY_TYPE:
89
- return "Activity";
90
- }
91
- if ("object" === typeof type)
92
- switch (
93
- ("number" === typeof type.tag &&
94
- console.error(
95
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
96
- ),
97
- type.$$typeof)
98
- ) {
99
- case REACT_PORTAL_TYPE:
100
- return "Portal";
101
- case REACT_CONTEXT_TYPE:
102
- return (type.displayName || "Context") + ".Provider";
103
- case REACT_CONSUMER_TYPE:
104
- return (type._context.displayName || "Context") + ".Consumer";
105
- case REACT_FORWARD_REF_TYPE:
106
- var innerType = type.render;
107
- type = type.displayName;
108
- type ||
109
- ((type = innerType.displayName || innerType.name || ""),
110
- (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
111
- return type;
112
- case REACT_MEMO_TYPE:
113
- return (
114
- (innerType = type.displayName || null),
115
- null !== innerType
116
- ? innerType
117
- : getComponentNameFromType(type.type) || "Memo"
118
- );
119
- case REACT_LAZY_TYPE:
120
- innerType = type._payload;
121
- type = type._init;
122
- try {
123
- return getComponentNameFromType(type(innerType));
124
- } catch (x) {}
125
- }
126
- return null;
127
- }
128
- function testStringCoercion(value) {
129
- return "" + value;
130
- }
131
- function checkKeyStringCoercion(value) {
132
- try {
133
- testStringCoercion(value);
134
- var JSCompiler_inline_result = !1;
135
- } catch (e) {
136
- JSCompiler_inline_result = true;
137
- }
138
- if (JSCompiler_inline_result) {
139
- JSCompiler_inline_result = console;
140
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
141
- var JSCompiler_inline_result$jscomp$0 =
142
- ("function" === typeof Symbol &&
143
- Symbol.toStringTag &&
144
- value[Symbol.toStringTag]) ||
145
- value.constructor.name ||
146
- "Object";
147
- JSCompiler_temp_const.call(
148
- JSCompiler_inline_result,
149
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
150
- JSCompiler_inline_result$jscomp$0
151
- );
152
- return testStringCoercion(value);
153
- }
154
- }
155
- function getTaskName(type) {
156
- if (type === REACT_FRAGMENT_TYPE) return "<>";
157
- if (
158
- "object" === typeof type &&
159
- null !== type &&
160
- type.$$typeof === REACT_LAZY_TYPE
161
- )
162
- return "<...>";
163
- try {
164
- var name = getComponentNameFromType(type);
165
- return name ? "<" + name + ">" : "<...>";
166
- } catch (x) {
167
- return "<...>";
168
- }
169
- }
170
- function getOwner() {
171
- var dispatcher = ReactSharedInternals.A;
172
- return null === dispatcher ? null : dispatcher.getOwner();
173
- }
174
- function UnknownOwner() {
175
- return Error("react-stack-top-frame");
176
- }
177
- function hasValidKey(config) {
178
- if (hasOwnProperty.call(config, "key")) {
179
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
180
- if (getter && getter.isReactWarning) return false;
181
- }
182
- return void 0 !== config.key;
183
- }
184
- function defineKeyPropWarningGetter(props, displayName) {
185
- function warnAboutAccessingKey() {
186
- specialPropKeyWarningShown ||
187
- ((specialPropKeyWarningShown = true),
188
- console.error(
189
- "%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)",
190
- displayName
191
- ));
192
- }
193
- warnAboutAccessingKey.isReactWarning = true;
194
- Object.defineProperty(props, "key", {
195
- get: warnAboutAccessingKey,
196
- configurable: true
197
- });
198
- }
199
- function elementRefGetterWithDeprecationWarning() {
200
- var componentName = getComponentNameFromType(this.type);
201
- didWarnAboutElementRef[componentName] ||
202
- ((didWarnAboutElementRef[componentName] = true),
203
- console.error(
204
- "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."
205
- ));
206
- componentName = this.props.ref;
207
- return void 0 !== componentName ? componentName : null;
208
- }
209
- function ReactElement(
210
- type,
211
- key,
212
- self,
213
- source,
214
- owner,
215
- props,
216
- debugStack,
217
- debugTask
218
- ) {
219
- self = props.ref;
220
- type = {
221
- $$typeof: REACT_ELEMENT_TYPE,
222
- type: type,
223
- key: key,
224
- props: props,
225
- _owner: owner
226
- };
227
- null !== (void 0 !== self ? self : null)
228
- ? Object.defineProperty(type, "ref", {
229
- enumerable: false,
230
- get: elementRefGetterWithDeprecationWarning
231
- })
232
- : Object.defineProperty(type, "ref", { enumerable: false, value: null });
233
- type._store = {};
234
- Object.defineProperty(type._store, "validated", {
235
- configurable: false,
236
- enumerable: false,
237
- writable: true,
238
- value: 0
239
- });
240
- Object.defineProperty(type, "_debugInfo", {
241
- configurable: false,
242
- enumerable: false,
243
- writable: true,
244
- value: null
245
- });
246
- Object.defineProperty(type, "_debugStack", {
247
- configurable: false,
248
- enumerable: false,
249
- writable: true,
250
- value: debugStack
251
- });
252
- Object.defineProperty(type, "_debugTask", {
253
- configurable: false,
254
- enumerable: false,
255
- writable: true,
256
- value: debugTask
257
- });
258
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
259
- return type;
260
- }
261
- function jsxDEVImpl(
262
- type,
263
- config,
264
- maybeKey,
265
- isStaticChildren,
266
- source,
267
- self,
268
- debugStack,
269
- debugTask
270
- ) {
271
- var children = config.children;
272
- if (void 0 !== children)
273
- if (isStaticChildren)
274
- if (isArrayImpl(children)) {
275
- for (
276
- isStaticChildren = 0;
277
- isStaticChildren < children.length;
278
- isStaticChildren++
279
- )
280
- validateChildKeys(children[isStaticChildren]);
281
- Object.freeze && Object.freeze(children);
282
- } else
283
- console.error(
284
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
285
- );
286
- else validateChildKeys(children);
287
- if (hasOwnProperty.call(config, "key")) {
288
- children = getComponentNameFromType(type);
289
- var keys = Object.keys(config).filter(function (k) {
290
- return "key" !== k;
291
- });
292
- isStaticChildren =
293
- 0 < keys.length
294
- ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
295
- : "{key: someKey}";
296
- didWarnAboutKeySpread[children + isStaticChildren] ||
297
- ((keys =
298
- 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
299
- console.error(
300
- '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} />',
301
- isStaticChildren,
302
- children,
303
- keys,
304
- children
305
- ),
306
- (didWarnAboutKeySpread[children + isStaticChildren] = true));
307
- }
308
- children = null;
309
- void 0 !== maybeKey &&
310
- (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
311
- hasValidKey(config) &&
312
- (checkKeyStringCoercion(config.key), (children = "" + config.key));
313
- if ("key" in config) {
314
- maybeKey = {};
315
- for (var propName in config)
316
- "key" !== propName && (maybeKey[propName] = config[propName]);
317
- } else maybeKey = config;
318
- children &&
319
- defineKeyPropWarningGetter(
320
- maybeKey,
321
- "function" === typeof type
322
- ? type.displayName || type.name || "Unknown"
323
- : type
324
- );
325
- return ReactElement(
326
- type,
327
- children,
328
- self,
329
- source,
330
- getOwner(),
331
- maybeKey,
332
- debugStack,
333
- debugTask
334
- );
335
- }
336
- function validateChildKeys(node) {
337
- "object" === typeof node &&
338
- null !== node &&
339
- node.$$typeof === REACT_ELEMENT_TYPE &&
340
- node._store &&
341
- (node._store.validated = 1);
342
- }
343
- var React = require$$0,
344
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
345
- REACT_PORTAL_TYPE = Symbol.for("react.portal"),
346
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
347
- REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
348
- REACT_PROFILER_TYPE = Symbol.for("react.profiler");
349
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
350
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
351
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
352
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
353
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
354
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
355
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
356
- REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
357
- REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
358
- ReactSharedInternals =
359
- React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
360
- hasOwnProperty = Object.prototype.hasOwnProperty,
361
- isArrayImpl = Array.isArray,
362
- createTask = console.createTask
363
- ? console.createTask
364
- : function () {
365
- return null;
366
- };
367
- React = {
368
- "react-stack-bottom-frame": function (callStackForError) {
369
- return callStackForError();
370
- }
371
- };
372
- var specialPropKeyWarningShown;
373
- var didWarnAboutElementRef = {};
374
- var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind(
375
- React,
376
- UnknownOwner
377
- )();
378
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
379
- var didWarnAboutKeySpread = {};
380
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
381
- reactJsxRuntime_development.jsx = function (type, config, maybeKey, source, self) {
382
- var trackActualOwner =
383
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
384
- return jsxDEVImpl(
385
- type,
386
- config,
387
- maybeKey,
388
- false,
389
- source,
390
- self,
391
- trackActualOwner
392
- ? Error("react-stack-top-frame")
393
- : unknownOwnerDebugStack,
394
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
395
- );
396
- };
397
- reactJsxRuntime_development.jsxs = function (type, config, maybeKey, source, self) {
398
- var trackActualOwner =
399
- 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
400
- return jsxDEVImpl(
401
- type,
402
- config,
403
- maybeKey,
404
- true,
405
- source,
406
- self,
407
- trackActualOwner
408
- ? Error("react-stack-top-frame")
409
- : unknownOwnerDebugStack,
410
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
411
- );
412
- };
413
- })();
414
- return reactJsxRuntime_development;
415
- }
416
-
417
- var hasRequiredJsxRuntime;
418
-
419
- function requireJsxRuntime () {
420
- if (hasRequiredJsxRuntime) return jsxRuntime.exports;
421
- hasRequiredJsxRuntime = 1;
422
-
423
- if (process.env.NODE_ENV === 'production') {
424
- jsxRuntime.exports = requireReactJsxRuntime_production();
425
- } else {
426
- jsxRuntime.exports = requireReactJsxRuntime_development();
427
- }
428
- return jsxRuntime.exports;
429
- }
430
-
431
- var jsxRuntimeExports = requireJsxRuntime();
432
-
433
7
  const DEFAULT_PROPS = {
434
8
  autoComplete: 'off',
435
9
  autoCorrect: 'off',
@@ -440,22 +14,24 @@ const DEFAULT_PROPS = {
440
14
  spellCheck: false,
441
15
  step: 'any'
442
16
  };
443
- const NumericInput = /*#__PURE__*/require$$0.forwardRef((_ref, ref) => {
444
- let {
445
- maxDecimals = 2,
446
- onChange,
447
- formatOn = numora.FormatOn.Blur,
448
- thousandSeparator = ',',
449
- thousandStyle = numora.ThousandStyle.Thousand,
450
- decimalSeparator = '.',
451
- decimalMinLength,
452
- enableCompactNotation = false,
453
- enableNegative = false,
454
- enableLeadingZeros = false,
455
- rawValueMode = false,
456
- ...props
457
- } = _ref;
458
- const [caretPositionBeforeChange, setCaretPositionBeforeChange] = require$$0.useState();
17
+ const NumoraInput = /*#__PURE__*/React.forwardRef(({
18
+ maxDecimals = 2,
19
+ onChange,
20
+ formatOn = numora.FormatOn.Blur,
21
+ thousandSeparator = ',',
22
+ thousandStyle = numora.ThousandStyle.Thousand,
23
+ decimalSeparator = '.',
24
+ decimalMinLength,
25
+ enableCompactNotation = false,
26
+ enableNegative = false,
27
+ enableLeadingZeros = false,
28
+ rawValueMode = false,
29
+ ...props
30
+ }, ref) => {
31
+ const [caretPositionBeforeChange, setCaretPositionBeforeChange] = React.useState();
32
+ const inputRef = React.useRef(null);
33
+ const isUserInputRef = React.useRef(false);
34
+ const previousValueRef = React.useRef(typeof props.value === 'string' ? props.value : props.value?.toString());
459
35
  const formattingOptions = {
460
36
  formatOn,
461
37
  thousandSeparator,
@@ -467,6 +43,23 @@ const NumericInput = /*#__PURE__*/require$$0.forwardRef((_ref, ref) => {
467
43
  enableLeadingZeros,
468
44
  rawValueMode
469
45
  };
46
+ // Handle programmatic value changes (when value prop changes externally)
47
+ React.useEffect(() => {
48
+ const input = inputRef.current;
49
+ if (!input) return;
50
+ const currentValue = typeof props.value === 'string' ? props.value : props.value !== undefined ? String(props.value) : undefined;
51
+ const previousValue = previousValueRef.current;
52
+ // Only format if value changed externally (not from user input)
53
+ if (!isUserInputRef.current && currentValue !== previousValue && currentValue !== undefined) {
54
+ const formatted = numora.formatValueForNumora(currentValue, maxDecimals, formattingOptions);
55
+ // Only update if formatted value differs from current input value
56
+ if (input.value !== formatted) {
57
+ input.value = formatted;
58
+ }
59
+ }
60
+ previousValueRef.current = currentValue;
61
+ isUserInputRef.current = false;
62
+ }, [props.value, maxDecimals, formatOn, thousandSeparator, thousandStyle, decimalSeparator, decimalMinLength, enableCompactNotation, enableNegative, enableLeadingZeros, rawValueMode]);
470
63
  function handleOnKeyDown(e) {
471
64
  const caretInfo = numora.handleOnKeyDownNumoraInput(e.nativeEvent, formattingOptions);
472
65
  if (caretInfo) {
@@ -483,11 +76,13 @@ const NumericInput = /*#__PURE__*/require$$0.forwardRef((_ref, ref) => {
483
76
  }
484
77
  }
485
78
  function handleOnChange(e) {
79
+ isUserInputRef.current = true;
486
80
  numora.handleOnChangeNumoraInput(e.nativeEvent, maxDecimals, caretPositionBeforeChange, formattingOptions);
487
81
  setCaretPositionBeforeChange(undefined);
488
82
  if (onChange) onChange(e);
489
83
  }
490
84
  function handleOnPaste(e) {
85
+ isUserInputRef.current = true;
491
86
  numora.handleOnPasteNumoraInput(e.nativeEvent, maxDecimals, formattingOptions);
492
87
  if (onChange) onChange(e);
493
88
  }
@@ -505,10 +100,19 @@ const NumericInput = /*#__PURE__*/require$$0.forwardRef((_ref, ref) => {
505
100
  props.onBlur(e);
506
101
  }
507
102
  }
508
- return jsxRuntimeExports.jsx("input", {
103
+ // Combine refs: forward the ref and also store it internally
104
+ const setRefs = React.useCallback(node => {
105
+ inputRef.current = node;
106
+ if (typeof ref === 'function') {
107
+ ref(node);
108
+ } else if (ref) {
109
+ ref.current = node;
110
+ }
111
+ }, [ref]);
112
+ return jsxRuntime.jsx("input", {
509
113
  ...DEFAULT_PROPS,
510
114
  ...props,
511
- ref: ref,
115
+ ref: setRefs,
512
116
  onChange: handleOnChange,
513
117
  onKeyDown: handleOnKeyDown,
514
118
  onPaste: handleOnPaste,
@@ -518,7 +122,15 @@ const NumericInput = /*#__PURE__*/require$$0.forwardRef((_ref, ref) => {
518
122
  inputMode: "decimal"
519
123
  });
520
124
  });
521
- NumericInput.displayName = 'NumericInput';
125
+ NumoraInput.displayName = 'NumoraInput';
522
126
 
523
- exports.NumericInput = NumericInput;
127
+ Object.defineProperty(exports, "FormatOn", {
128
+ enumerable: true,
129
+ get: function () { return numora.FormatOn; }
130
+ });
131
+ Object.defineProperty(exports, "ThousandStyle", {
132
+ enumerable: true,
133
+ get: function () { return numora.ThousandStyle; }
134
+ });
135
+ exports.NumoraInput = NumoraInput;
524
136
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.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,IA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Ae;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.cjs.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,gBAAU,CAC5B,CAAC;AACCC,EAAAA,WAAW,GAAG,CAAC;EACfC,QAAQ;EACRC,QAAQ,GAAGC,eAAQ,CAACC,IAAI;AACxBC,EAAAA,iBAAiB,GAAG,GAAG;EACvBC,aAAa,GAAGC,oBAAa,CAACC,QAAQ;AACtCC,EAAAA,gBAAgB,GAAG,GAAG;EACtBC,gBAAgB;AAChBC,EAAAA,qBAAqB,GAAG,KAAK;AAC7BC,EAAAA,cAAc,GAAG,KAAK;AACtBC,EAAAA,kBAAkB,GAAG,KAAK;AAC1BC,EAAAA,YAAY,GAAG,KAAK;EACpB,GAAGC;AAAK,CACS,EAAEC,GAAgC,KAAI;EACvD,MAAM,CAACC,yBAAyB,EAAEC,4BAA4B,CAAC,GAC7DC,KAAK,CAACC,QAAQ,EAAqB;AACrC,EAAA,MAAMC,QAAQ,GAAGF,KAAK,CAACG,MAAM,CAAmB,IAAI,CAAC;AACrD,EAAA,MAAMC,cAAc,GAAGD,YAAM,CAAC,KAAK,CAAC;EACpC,MAAME,gBAAgB,GAAGF,YAAM,CAC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