numora-react 1.0.5 → 1.0.6

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,449 +1,62 @@
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;
7
+ function handleNumoraOnChange(e, options) {
8
+ numora.handleOnChangeNumoraInput(e.nativeEvent, options.decimalMaxLength, options.caretPositionBeforeChange, options.formattingOptions);
9
+ const target = e.target;
10
+ const rawValue = target.getAttribute('data-raw-value') ?? undefined;
11
+ if (rawValue) {
12
+ target.removeAttribute('data-raw-value');
13
+ }
14
+ return {
15
+ value: target.value,
16
+ rawValue
17
+ };
49
18
  }
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;
19
+ function handleNumoraOnPaste(e, options) {
20
+ const value = numora.handleOnPasteNumoraInput(e.nativeEvent, options.decimalMaxLength, options.formattingOptions);
21
+ const target = e.target;
22
+ const rawValue = target.getAttribute('data-raw-value') ?? undefined;
23
+ if (rawValue) {
24
+ target.removeAttribute('data-raw-value');
25
+ }
26
+ return {
27
+ value,
28
+ rawValue
29
+ };
415
30
  }
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;
31
+ function handleNumoraOnKeyDown(e, formattingOptions) {
32
+ return numora.handleOnKeyDownNumoraInput(e.nativeEvent, formattingOptions);
33
+ }
34
+ function handleNumoraOnBlur(e, options) {
35
+ // If formatOn is blur, force formatting on blur by invoking change handler logic
36
+ if (options.formattingOptions.formatOn === numora.FormatOn.Blur) {
37
+ numora.handleOnChangeNumoraInput(e.nativeEvent, options.decimalMaxLength, undefined, {
38
+ ...options.formattingOptions,
39
+ formatOn: numora.FormatOn.Change
40
+ });
41
+ }
42
+ const target = e.target;
43
+ const rawValue = target.getAttribute('data-raw-value') ?? undefined;
44
+ if (rawValue) {
45
+ target.removeAttribute('data-raw-value');
46
+ }
47
+ return {
48
+ value: target.value,
49
+ rawValue
50
+ };
429
51
  }
430
52
 
431
- var jsxRuntimeExports = requireJsxRuntime();
432
-
433
- const DEFAULT_PROPS = {
434
- autoComplete: 'off',
435
- autoCorrect: 'off',
436
- autoCapitalize: 'none',
437
- minLength: 1,
438
- placeholder: '0.0',
439
- pattern: '^[0-9]*[.,]?[0-9]*$',
440
- spellCheck: false,
441
- step: 'any'
442
- };
443
- const NumoraInput = /*#__PURE__*/require$$0.forwardRef((_ref, ref) => {
444
- let {
53
+ const NumoraInput = /*#__PURE__*/react.forwardRef((props, ref) => {
54
+ const {
445
55
  maxDecimals = 2,
446
56
  onChange,
57
+ onPaste,
58
+ onBlur,
59
+ onKeyDown,
447
60
  formatOn = numora.FormatOn.Blur,
448
61
  thousandSeparator = ',',
449
62
  thousandStyle = numora.ThousandStyle.Thousand,
@@ -453,9 +66,20 @@ const NumoraInput = /*#__PURE__*/require$$0.forwardRef((_ref, ref) => {
453
66
  enableNegative = false,
454
67
  enableLeadingZeros = false,
455
68
  rawValueMode = false,
456
- ...props
457
- } = _ref;
458
- const [caretPositionBeforeChange, setCaretPositionBeforeChange] = require$$0.useState();
69
+ value: controlledValue,
70
+ defaultValue,
71
+ ...rest
72
+ } = props;
73
+ const inputRef = react.useRef(null);
74
+ const caretInfoRef = react.useRef(undefined);
75
+ const [internalValue, setInternalValue] = react.useState(controlledValue !== undefined ? String(controlledValue) : defaultValue !== undefined ? String(defaultValue) : '');
76
+ // Keep internal state in sync when controlled
77
+ react.useEffect(() => {
78
+ if (controlledValue !== undefined) {
79
+ setInternalValue(String(controlledValue));
80
+ }
81
+ }, [controlledValue]);
82
+ react.useImperativeHandle(ref, () => inputRef.current, []);
459
83
  const formattingOptions = {
460
84
  formatOn,
461
85
  thousandSeparator,
@@ -467,58 +91,116 @@ const NumoraInput = /*#__PURE__*/require$$0.forwardRef((_ref, ref) => {
467
91
  enableLeadingZeros,
468
92
  rawValueMode
469
93
  };
470
- function handleOnKeyDown(e) {
471
- const caretInfo = numora.handleOnKeyDownNumoraInput(e.nativeEvent, formattingOptions);
472
- if (caretInfo) {
473
- setCaretPositionBeforeChange(caretInfo);
94
+ const formatValueWithCore = value => {
95
+ const el = inputRef.current ?? document.createElement('input');
96
+ el.value = value;
97
+ const fakeEvent = {
98
+ target: el
99
+ };
100
+ numora.handleOnChangeNumoraInput(fakeEvent, maxDecimals, undefined, formattingOptions);
101
+ return el.value;
102
+ };
103
+ // When controlled value changes, normalize/format it for display
104
+ react.useEffect(() => {
105
+ if (controlledValue !== undefined) {
106
+ const formatted = formatValueWithCore(String(controlledValue));
107
+ setInternalValue(formatted);
108
+ }
109
+ }, [controlledValue, formatOn, thousandSeparator, thousandStyle, decimalSeparator, decimalMinLength, enableCompactNotation, enableNegative, enableLeadingZeros, rawValueMode, maxDecimals]);
110
+ const handleChange = e => {
111
+ const {
112
+ value,
113
+ rawValue
114
+ } = handleNumoraOnChange(e, {
115
+ decimalMaxLength: maxDecimals,
116
+ caretPositionBeforeChange: caretInfoRef.current,
117
+ formattingOptions
118
+ });
119
+ caretInfoRef.current = undefined;
120
+ if (controlledValue === undefined) {
121
+ setInternalValue(value);
474
122
  } else {
475
- const input = e.currentTarget;
476
- setCaretPositionBeforeChange({
477
- selectionStart: input.selectionStart ?? 0,
478
- selectionEnd: input.selectionEnd ?? 0
479
- });
123
+ setInternalValue(value);
480
124
  }
481
- if (props.onKeyDown) {
482
- props.onKeyDown(e);
125
+ if (onChange) {
126
+ onChange(e);
483
127
  }
484
- }
485
- function handleOnChange(e) {
486
- numora.handleOnChangeNumoraInput(e.nativeEvent, maxDecimals, caretPositionBeforeChange, formattingOptions);
487
- setCaretPositionBeforeChange(undefined);
488
- if (onChange) onChange(e);
489
- }
490
- function handleOnPaste(e) {
491
- numora.handleOnPasteNumoraInput(e.nativeEvent, maxDecimals, formattingOptions);
492
- if (onChange) onChange(e);
493
- }
494
- function handleOnFocus(e) {
495
- if (formatOn === numora.FormatOn.Blur && thousandSeparator) {
496
- const target = e.currentTarget;
497
- target.value = target.value.replace(new RegExp(thousandSeparator.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), '');
128
+ // Optionally expose rawValue via a custom event attribute if needed later
129
+ if (rawValue && e.target && rawValueMode) {
130
+ // Keep the raw value on the input for consumers that read it directly
131
+ e.target.setAttribute('data-raw-value', rawValue);
498
132
  }
499
- if (props.onFocus) {
500
- props.onFocus(e);
133
+ };
134
+ const handlePaste = e => {
135
+ const {
136
+ value,
137
+ rawValue
138
+ } = handleNumoraOnPaste(e, {
139
+ decimalMaxLength: maxDecimals,
140
+ formattingOptions
141
+ });
142
+ if (controlledValue === undefined) {
143
+ setInternalValue(value);
144
+ } else {
145
+ setInternalValue(value);
501
146
  }
502
- }
503
- function handleOnBlur(e) {
504
- if (props.onBlur) {
505
- props.onBlur(e);
147
+ if (onPaste) {
148
+ onPaste(e);
506
149
  }
507
- }
508
- return jsxRuntimeExports.jsx("input", {
509
- ...DEFAULT_PROPS,
510
- ...props,
511
- ref: ref,
512
- onChange: handleOnChange,
513
- onKeyDown: handleOnKeyDown,
514
- onPaste: handleOnPaste,
515
- onFocus: handleOnFocus,
516
- onBlur: handleOnBlur,
150
+ if (onChange) {
151
+ onChange(e);
152
+ }
153
+ if (rawValue && e.target && rawValueMode) {
154
+ e.target.setAttribute('data-raw-value', rawValue);
155
+ }
156
+ };
157
+ const handleKeyDown = e => {
158
+ caretInfoRef.current = handleNumoraOnKeyDown(e, formattingOptions);
159
+ if (onKeyDown) {
160
+ onKeyDown(e);
161
+ }
162
+ };
163
+ const handleBlur = e => {
164
+ const {
165
+ value,
166
+ rawValue
167
+ } = handleNumoraOnBlur(e, {
168
+ decimalMaxLength: maxDecimals,
169
+ formattingOptions
170
+ });
171
+ if (controlledValue === undefined) {
172
+ setInternalValue(value);
173
+ } else {
174
+ setInternalValue(value);
175
+ }
176
+ if (onBlur) {
177
+ onBlur(e);
178
+ }
179
+ if (rawValue && e.target && rawValueMode) {
180
+ e.target.setAttribute('data-raw-value', rawValue);
181
+ }
182
+ };
183
+ return jsxRuntime.jsx("input", {
184
+ ...rest,
185
+ ref: inputRef,
186
+ value: internalValue,
187
+ onChange: handleChange,
188
+ onPaste: handlePaste,
189
+ onKeyDown: handleKeyDown,
190
+ onBlur: handleBlur,
517
191
  type: "text",
518
192
  inputMode: "decimal"
519
193
  });
520
194
  });
521
195
  NumoraInput.displayName = 'NumoraInput';
522
196
 
523
- module.exports = NumoraInput;
197
+ Object.defineProperty(exports, "FormatOn", {
198
+ enumerable: true,
199
+ get: function () { return numora.FormatOn; }
200
+ });
201
+ Object.defineProperty(exports, "ThousandStyle", {
202
+ enumerable: true,
203
+ get: function () { return numora.ThousandStyle; }
204
+ });
205
+ exports.NumoraInput = NumoraInput;
524
206
  //# sourceMappingURL=index.cjs.js.map