numora-react 1.0.8 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/handlers.ts","../src/index.tsx"],"sourcesContent":["import type React from 'react';\nimport {\n handleOnChangeNumoraInput,\n handleOnKeyDownNumoraInput,\n handleOnPasteNumoraInput,\n type CaretPositionInfo,\n type FormattingOptions,\n FormatOn,\n} from 'numora';\n\ntype ChangeResult = {\n value: string;\n rawValue?: string;\n};\n\ntype PasteResult = ChangeResult;\ntype BlurResult = ChangeResult;\n\ntype BaseOptions = {\n decimalMaxLength: number;\n caretPositionBeforeChange?: CaretPositionInfo;\n formattingOptions: FormattingOptions & { rawValueMode?: boolean };\n};\n\nexport function handleNumoraOnChange(\n e: React.ChangeEvent<HTMLInputElement>,\n options: BaseOptions\n): ChangeResult {\n handleOnChangeNumoraInput(\n e.nativeEvent as unknown as Event,\n options.decimalMaxLength,\n options.caretPositionBeforeChange,\n options.formattingOptions\n );\n\n const target = e.target;\n const rawValue = target.getAttribute('data-raw-value') ?? undefined;\n if (rawValue) {\n target.removeAttribute('data-raw-value');\n }\n\n return {\n value: target.value,\n rawValue,\n };\n}\n\nexport function handleNumoraOnPaste(\n e: React.ClipboardEvent<HTMLInputElement>,\n options: Omit<BaseOptions, 'caretPositionBeforeChange'>\n): PasteResult {\n const value = handleOnPasteNumoraInput(\n e.nativeEvent as ClipboardEvent,\n options.decimalMaxLength,\n options.formattingOptions\n );\n\n const target = e.target as HTMLInputElement;\n const rawValue = target.getAttribute('data-raw-value') ?? undefined;\n if (rawValue) {\n target.removeAttribute('data-raw-value');\n }\n\n return {\n value,\n rawValue,\n };\n}\n\nexport function handleNumoraOnKeyDown(\n e: React.KeyboardEvent<HTMLInputElement>,\n formattingOptions: FormattingOptions\n): CaretPositionInfo | undefined {\n return handleOnKeyDownNumoraInput(\n e.nativeEvent as unknown as KeyboardEvent,\n formattingOptions\n );\n}\n\nexport function handleNumoraOnBlur(\n e: React.FocusEvent<HTMLInputElement>,\n options: {\n decimalMaxLength: number;\n formattingOptions: FormattingOptions & { rawValueMode?: boolean };\n }\n): BlurResult {\n // If formatOn is blur, force formatting on blur by invoking change handler logic\n if (options.formattingOptions.formatOn === FormatOn.Blur) {\n handleOnChangeNumoraInput(\n e.nativeEvent as unknown as Event,\n options.decimalMaxLength,\n undefined,\n { ...options.formattingOptions, formatOn: FormatOn.Change }\n );\n }\n\n const target = e.target;\n const rawValue = target.getAttribute('data-raw-value') ?? undefined;\n if (rawValue) {\n target.removeAttribute('data-raw-value');\n }\n\n return {\n value: target.value,\n rawValue,\n };\n}\n","import React, {\n useRef,\n useState,\n useEffect,\n forwardRef,\n useImperativeHandle,\n} from 'react';\nimport {\n FormatOn,\n ThousandStyle,\n type CaretPositionInfo,\n type FormattingOptions,\n handleOnChangeNumoraInput,\n} from 'numora';\nimport {\n handleNumoraOnBlur,\n handleNumoraOnChange,\n handleNumoraOnKeyDown,\n handleNumoraOnPaste,\n} from './handlers';\n\ninterface NumoraInputProps\n extends Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'onChange' | 'type' | 'inputMode'\n > {\n maxDecimals?: number;\n onChange?: (e: React.ChangeEvent<HTMLInputElement> | React.ClipboardEvent<HTMLInputElement>) => void;\n\n formatOn?: FormatOn;\n thousandSeparator?: string;\n thousandStyle?: ThousandStyle;\n decimalSeparator?: string;\n decimalMinLength?: number;\n\n enableCompactNotation?: boolean;\n enableNegative?: boolean;\n enableLeadingZeros?: boolean;\n rawValueMode?: boolean;\n}\n\nconst NumoraInput = forwardRef<HTMLInputElement, NumoraInputProps>((props, ref) => {\n const {\n maxDecimals = 2,\n onChange,\n onPaste,\n onBlur,\n onKeyDown,\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 value: controlledValue,\n defaultValue,\n ...rest\n } = props;\n\n const inputRef = useRef<HTMLInputElement>(null);\n const caretInfoRef = useRef<CaretPositionInfo | undefined>(undefined);\n\n const [internalValue, setInternalValue] = useState<string>(\n controlledValue !== undefined\n ? String(controlledValue)\n : defaultValue !== undefined\n ? String(defaultValue)\n : ''\n );\n\n // Keep internal state in sync when controlled\n useEffect(() => {\n if (controlledValue !== undefined) {\n setInternalValue(String(controlledValue));\n }\n }, [controlledValue]);\n\n useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);\n\n const formattingOptions: FormattingOptions & { rawValueMode?: boolean } = {\n formatOn,\n thousandSeparator,\n ThousandStyle: thousandStyle,\n decimalSeparator,\n decimalMinLength,\n enableCompactNotation,\n enableNegative,\n enableLeadingZeros,\n rawValueMode,\n };\n\n const formatValueWithCore = (value: string): string => {\n const el = inputRef.current ?? document.createElement('input');\n el.value = value;\n const fakeEvent = { target: el } as unknown as Event;\n handleOnChangeNumoraInput(fakeEvent, maxDecimals, undefined, formattingOptions);\n return el.value;\n };\n\n // When controlled value changes, normalize/format it for display\n useEffect(() => {\n if (controlledValue !== undefined) {\n const formatted = formatValueWithCore(String(controlledValue));\n setInternalValue(formatted);\n }\n }, [controlledValue, formatOn, thousandSeparator, thousandStyle, decimalSeparator, decimalMinLength, enableCompactNotation, enableNegative, enableLeadingZeros, rawValueMode, maxDecimals]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const { value, rawValue } = handleNumoraOnChange(e, {\n decimalMaxLength: maxDecimals,\n caretPositionBeforeChange: caretInfoRef.current,\n formattingOptions,\n });\n caretInfoRef.current = undefined;\n\n if (controlledValue === undefined) {\n setInternalValue(value);\n } else {\n setInternalValue(value);\n }\n\n if (onChange) {\n onChange(e);\n }\n\n // Optionally expose rawValue via a custom event attribute if needed later\n if (rawValue && e.target && rawValueMode) {\n // Keep the raw value on the input for consumers that read it directly\n e.target.setAttribute('data-raw-value', rawValue);\n }\n };\n\n const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n const { value, rawValue } = handleNumoraOnPaste(e, {\n decimalMaxLength: maxDecimals,\n formattingOptions,\n });\n\n if (controlledValue === undefined) {\n setInternalValue(value);\n } else {\n setInternalValue(value);\n }\n\n if (onPaste) {\n onPaste(e);\n }\n if (onChange) {\n onChange(e);\n }\n\n if (rawValue && e.target && rawValueMode) {\n (e.target as HTMLInputElement).setAttribute('data-raw-value', rawValue);\n }\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n caretInfoRef.current = handleNumoraOnKeyDown(e, formattingOptions);\n if (onKeyDown) {\n onKeyDown(e);\n }\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n const { value, rawValue } = handleNumoraOnBlur(e, {\n decimalMaxLength: maxDecimals,\n formattingOptions,\n });\n\n if (controlledValue === undefined) {\n setInternalValue(value);\n } else {\n setInternalValue(value);\n }\n\n if (onBlur) {\n onBlur(e);\n }\n\n if (rawValue && e.target && rawValueMode) {\n (e.target as HTMLInputElement).setAttribute('data-raw-value', rawValue);\n }\n };\n\n return (\n <input\n {...rest}\n ref={inputRef}\n value={internalValue}\n onChange={handleChange}\n onPaste={handlePaste}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n type=\"text\"\n inputMode=\"decimal\"\n />\n );\n});\n\nNumoraInput.displayName = 'NumoraInput';\n\nexport { NumoraInput };\nexport { FormatOn, ThousandStyle } from 'numora';\nexport type { FormattingOptions, CaretPositionInfo } from 'numora';\n"],"names":["_jsx"],"mappings":";;;;;AAwBM,SAAU,oBAAoB,CAClC,CAAsC,EACtC,OAAoB,EAAA;AAEpB,IAAA,yBAAyB,CACvB,CAAC,CAAC,WAA+B,EACjC,OAAO,CAAC,gBAAgB,EACxB,OAAO,CAAC,yBAAyB,EACjC,OAAO,CAAC,iBAAiB,CAC1B;AAED,IAAA,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM;IACvB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K,CAAC;QACzB;aAAO;YACL,gBAAgB,CAAC,KAAK,CAAC;QACzB;QAEA,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,CAAC,CAAC;QACX;QAEA,IAAI,QAAQ,IAAI,CAAC,CAAC,MAAM,IAAI,YAAY,EAAE;YACvC,CAAC,CAAC,MAA2B,CAAC,YAAY,CAAC,gBAAgB,EAAE,QAAQ,CAAC;QACzE;AACF,IAAA,CAAC;AAED,IAAA,QACEA,GAAA,CAAA,OAAA,EAAA,EAAA,GACM,IAAI,EACR,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,SAAS,EAAA,CACnB;AAEN,CAAC;AAED,WAAW,CAAC,WAAW,GAAG,aAAa;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.production.js","../../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js","../src/handlers.ts","../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\";\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(type, key, props, owner, debugStack, debugTask) {\n var refProp = 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 !== refProp ? refProp : 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 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 maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\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 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) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\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) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\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 type React from 'react';\nimport {\n handleOnChangeNumoraInput,\n handleOnKeyDownNumoraInput,\n handleOnPasteNumoraInput,\n formatValueForDisplay,\n type CaretPositionInfo,\n type FormattingOptions,\n FormatOn,\n} from 'numora';\n\ntype ChangeResult = {\n value: string;\n rawValue?: string;\n};\n\ntype PasteResult = ChangeResult;\ntype BlurResult = ChangeResult;\n\ntype BaseOptions = {\n decimalMaxLength: number;\n caretPositionBeforeChange?: CaretPositionInfo;\n formattingOptions: FormattingOptions & { rawValueMode?: boolean };\n};\n\nexport function handleNumoraOnChange(\n e: React.ChangeEvent<HTMLInputElement>,\n options: BaseOptions\n): ChangeResult {\n const { formatted, raw } = handleOnChangeNumoraInput(\n e.nativeEvent as unknown as Event,\n options.decimalMaxLength,\n options.caretPositionBeforeChange,\n options.formattingOptions\n );\n\n return {\n value: formatted,\n rawValue: raw,\n };\n}\n\nexport function handleNumoraOnPaste(\n e: React.ClipboardEvent<HTMLInputElement>,\n options: Omit<BaseOptions, 'caretPositionBeforeChange'>\n): PasteResult {\n const { formatted, raw } = handleOnPasteNumoraInput(\n e.nativeEvent as ClipboardEvent,\n options.decimalMaxLength,\n options.formattingOptions\n );\n\n return {\n value: formatted,\n rawValue: raw,\n };\n}\n\nexport function handleNumoraOnKeyDown(\n e: React.KeyboardEvent<HTMLInputElement>,\n formattingOptions: FormattingOptions\n): CaretPositionInfo | undefined {\n return handleOnKeyDownNumoraInput(\n e.nativeEvent as unknown as KeyboardEvent,\n formattingOptions\n );\n}\n\nexport function handleNumoraOnBlur(\n e: React.FocusEvent<HTMLInputElement>,\n options: {\n decimalMaxLength: number;\n formattingOptions: FormattingOptions & { rawValueMode?: boolean };\n }\n): BlurResult {\n if (options.formattingOptions.formatOn === FormatOn.Blur) {\n const { formatted, raw } = formatValueForDisplay(\n e.target.value,\n options.decimalMaxLength,\n { ...options.formattingOptions, formatOn: FormatOn.Change }\n );\n return {\n value: formatted,\n rawValue: raw,\n };\n }\n\n return {\n value: e.target.value,\n rawValue: undefined,\n };\n}\n","import React, {\n useRef,\n useState,\n useEffect,\n useLayoutEffect,\n forwardRef,\n useCallback,\n} from 'react';\nimport {\n FormatOn,\n ThousandStyle,\n formatValueForDisplay,\n type CaretPositionInfo,\n type FormattingOptions,\n} from 'numora';\nimport {\n handleNumoraOnBlur,\n handleNumoraOnChange,\n handleNumoraOnKeyDown,\n handleNumoraOnPaste,\n} from './handlers';\n\nexport interface NumoraInputProps\n extends Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'onChange' | 'type' | 'inputMode'\n > {\n maxDecimals?: number;\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n\n formatOn?: FormatOn;\n thousandSeparator?: string;\n thousandStyle?: ThousandStyle;\n decimalSeparator?: string;\n decimalMinLength?: number;\n\n enableCompactNotation?: boolean;\n enableNegative?: boolean;\n enableLeadingZeros?: boolean;\n rawValueMode?: boolean;\n}\n\nconst NumoraInput = forwardRef<HTMLInputElement, NumoraInputProps>((props, ref) => {\n const {\n maxDecimals = 2,\n onChange,\n onPaste,\n onBlur,\n onKeyDown,\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 value: controlledValue,\n defaultValue,\n ...rest\n } = props;\n\n const internalInputRef = useRef<HTMLInputElement>(null);\n const caretInfoRef = useRef<CaretPositionInfo | undefined>(undefined);\n const lastCaretPosRef = useRef<number | null>(null);\n\n const formattingOptions: FormattingOptions = {\n formatOn,\n thousandSeparator,\n ThousandStyle: thousandStyle,\n decimalSeparator,\n decimalMinLength,\n enableCompactNotation,\n enableNegative,\n enableLeadingZeros,\n rawValueMode,\n };\n\n const getInitialValue = (): string => {\n const valueToFormat = controlledValue !== undefined ? controlledValue : defaultValue;\n if (valueToFormat !== undefined) {\n const { formatted } = formatValueForDisplay(String(valueToFormat), maxDecimals, formattingOptions);\n return formatted;\n }\n return '';\n };\n\n const [displayValue, setDisplayValue] = useState<string>(getInitialValue);\n\n // Sync external ref with internal ref\n useLayoutEffect(() => {\n if (!ref) return;\n if (typeof ref === 'function') {\n ref(internalInputRef.current);\n } else {\n ref.current = internalInputRef.current;\n }\n }, [ref]);\n\n // When controlled value changes from outside, update display value\n useEffect(() => {\n if (controlledValue !== undefined) {\n const { formatted } = formatValueForDisplay(String(controlledValue), maxDecimals, formattingOptions);\n if (formatted !== displayValue) {\n setDisplayValue(formatted);\n }\n }\n }, [controlledValue, maxDecimals, formattingOptions]);\n\n // Restore cursor position after render\n useLayoutEffect(() => {\n if (internalInputRef.current && lastCaretPosRef.current !== null) {\n const input = internalInputRef.current;\n const pos = lastCaretPosRef.current;\n input.setSelectionRange(pos, pos);\n lastCaretPosRef.current = null;\n }\n });\n\n const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const { value, rawValue } = handleNumoraOnChange(e, {\n decimalMaxLength: maxDecimals,\n caretPositionBeforeChange: caretInfoRef.current,\n formattingOptions,\n });\n\n // Store cursor position AFTER core library has calculated and set it\n // The core library modifies the DOM element directly during handleNumoraOnChange\n // Read from the input ref (which is the same element) to get the position set by the core library\n if (internalInputRef.current) {\n const cursorPos = internalInputRef.current.selectionStart;\n if (cursorPos !== null && cursorPos !== undefined) {\n lastCaretPosRef.current = cursorPos;\n }\n }\n\n caretInfoRef.current = undefined;\n\n // Add rawValue to the event object without overriding 'value' property\n (e.target as any).rawValue = rawValue;\n\n setDisplayValue(value);\n\n if (onChange) {\n onChange(e);\n }\n }, [maxDecimals, formattingOptions, onChange]);\n\n const handleKeyDown = useCallback((e: React.KeyboardEvent<HTMLInputElement>) => {\n const coreCaretInfo = handleNumoraOnKeyDown(e, formattingOptions);\n \n // Always capture cursor position info, even if core library doesn't return it\n // This is needed for cursor position calculation during normal typing (not just Delete/Backspace)\n if (!coreCaretInfo && internalInputRef.current) {\n const selectionStart = internalInputRef.current.selectionStart ?? 0;\n const selectionEnd = internalInputRef.current.selectionEnd ?? 0;\n caretInfoRef.current = {\n selectionStart,\n selectionEnd,\n };\n } else {\n caretInfoRef.current = coreCaretInfo;\n }\n \n if (onKeyDown) {\n onKeyDown(e);\n }\n }, [formattingOptions, onKeyDown]);\n\n const handlePaste = useCallback((e: React.ClipboardEvent<HTMLInputElement>) => {\n const { value, rawValue } = handleNumoraOnPaste(e, {\n decimalMaxLength: maxDecimals,\n formattingOptions,\n });\n\n // For paste, we often want to move cursor to the end of pasted content\n // handleNumoraOnPaste already handles DOM value and cursor, but React will overwrite it.\n // So we capture where the core logic set the cursor.\n lastCaretPosRef.current = (e.target as HTMLInputElement).selectionStart;\n (e.target as any).rawValue = rawValue;\n\n setDisplayValue(value);\n\n if (onPaste) {\n onPaste(e);\n }\n\n // Trigger onChange manually because paste event doesn't always trigger a ChangeEvent in all React versions\n // when we preventDefault.\n if (onChange) {\n const changeEvent = e as unknown as React.ChangeEvent<HTMLInputElement>;\n onChange(changeEvent);\n }\n }, [maxDecimals, formattingOptions, onPaste, onChange]);\n\n const handleBlur = useCallback((e: React.FocusEvent<HTMLInputElement>) => {\n const { value, rawValue } = handleNumoraOnBlur(e, {\n decimalMaxLength: maxDecimals,\n formattingOptions,\n });\n\n (e.target as any).rawValue = rawValue;\n setDisplayValue(value);\n\n if (onBlur) {\n onBlur(e);\n }\n }, [maxDecimals, formattingOptions, onBlur]);\n\n return (\n <input\n {...rest}\n ref={internalInputRef}\n value={displayValue}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n onBlur={handleBlur}\n type=\"text\"\n inputMode=\"decimal\"\n spellCheck={false}\n autoComplete=\"off\"\n />\n );\n});\n\nNumoraInput.displayName = 'NumoraInput';\n\nexport { NumoraInput };\nexport { FormatOn, ThousandStyle } from 'numora';\nexport type { FormattingOptions, CaretPositionInfo } from 'numora';\n"],"names":["jsxRuntimeModule","require$$0","require$$1","_jsx"],"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;GACnE,CAAG,MAAM,QAAQ,GAAG,MAAM;AAC1B,GAAE,MAAM,GAAG,QAAQ,CAAC,GAAG;AACvB,GAAE,OAAO;KACL,QAAQ,EAAE,kBAAkB;KAC5B,IAAI,EAAE,IAAI;KACV,GAAG,EAAE,GAAG;KACR,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,GAAG,IAAI;AAC1C,KAAI,KAAK,EAAE;IACR;AACH,CAAA;AACA,CAAA,0BAAA,CAAA,QAAgB,GAAG,mBAAmB;AACtC,CAAA,0BAAA,CAAA,GAAW,GAAG,OAAO;AACrB,CAAA,0BAAA,CAAA,IAAY,GAAG,OAAO;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AC;QACX;IACF,CAAC,EAAE,CAAC,WAAW,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAE5C,QACEC,oCACM,IAAI,EACR,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,SAAS,EACnB,UAAU,EAAE,KAAK,EACjB,YAAY,EAAC,KAAK,EAAA,CAClB;AAEN,CAAC;AAED,WAAW,CAAC,WAAW,GAAG,aAAa;;;;","x_google_ignoreList":[0,1,2]}
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "numora-react",
3
- "version": "1.0.8",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
- "main": "./dist/index.cjs",
5
+ "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
8
+ "description": "React component wrapper for Numora",
9
+ "homepage": "https://numora.xyz/",
8
10
  "exports": {
9
11
  ".": {
10
12
  "types": "./dist/index.d.ts",
11
13
  "import": "./dist/index.mjs",
12
- "require": "./dist/index.cjs"
14
+ "require": "./dist/index.js"
13
15
  }
14
16
  },
15
17
  "sideEffects": false,
@@ -48,23 +50,19 @@
48
50
  }
49
51
  ],
50
52
  "license": "MIT",
51
- "peerDependencies": {
52
- "react": "^18.0.0 || ^19.0.0",
53
- "react-dom": "^18.0.0 || ^19.0.0"
54
- },
55
53
  "devDependencies": {
56
- "@rollup/plugin-commonjs": "^28.0.3",
57
- "@rollup/plugin-node-resolve": "^16.0.1",
58
- "@rollup/plugin-typescript": "^12.1.2",
59
- "@types/react": "^19.1.0",
60
- "@types/react-dom": "^19.1.2",
61
- "rollup": "^4.38.0",
54
+ "@rollup/plugin-commonjs": "^28.0.9",
55
+ "@rollup/plugin-node-resolve": "^16.0.3",
56
+ "@rollup/plugin-typescript": "^12.3.0",
57
+ "@types/react": "^19.2.7",
58
+ "@types/react-dom": "^19.2.3",
59
+ "react": "^19.2.3",
60
+ "react-dom": "^19.2.3",
61
+ "rollup": "^4.53.5",
62
62
  "rollup-plugin-peer-deps-external": "^2.2.4",
63
63
  "tslib": "^2.8.1",
64
- "typescript": "^5.8.2",
65
- "react": "^19.1.0",
66
- "react-dom": "^19.1.0",
67
- "numora": "^2.0.2"
64
+ "typescript": "^5.9.3",
65
+ "numora": "^3.0.0"
68
66
  },
69
67
  "publishConfig": {
70
68
  "access": "public"
package/src/handlers.ts CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  handleOnChangeNumoraInput,
4
4
  handleOnKeyDownNumoraInput,
5
5
  handleOnPasteNumoraInput,
6
+ formatValueForDisplay,
6
7
  type CaretPositionInfo,
7
8
  type FormattingOptions,
8
9
  FormatOn,
@@ -26,22 +27,16 @@ export function handleNumoraOnChange(
26
27
  e: React.ChangeEvent<HTMLInputElement>,
27
28
  options: BaseOptions
28
29
  ): ChangeResult {
29
- handleOnChangeNumoraInput(
30
+ const { formatted, raw } = handleOnChangeNumoraInput(
30
31
  e.nativeEvent as unknown as Event,
31
32
  options.decimalMaxLength,
32
33
  options.caretPositionBeforeChange,
33
34
  options.formattingOptions
34
35
  );
35
36
 
36
- const target = e.target;
37
- const rawValue = target.getAttribute('data-raw-value') ?? undefined;
38
- if (rawValue) {
39
- target.removeAttribute('data-raw-value');
40
- }
41
-
42
37
  return {
43
- value: target.value,
44
- rawValue,
38
+ value: formatted,
39
+ rawValue: raw,
45
40
  };
46
41
  }
47
42
 
@@ -49,21 +44,15 @@ export function handleNumoraOnPaste(
49
44
  e: React.ClipboardEvent<HTMLInputElement>,
50
45
  options: Omit<BaseOptions, 'caretPositionBeforeChange'>
51
46
  ): PasteResult {
52
- const value = handleOnPasteNumoraInput(
47
+ const { formatted, raw } = handleOnPasteNumoraInput(
53
48
  e.nativeEvent as ClipboardEvent,
54
49
  options.decimalMaxLength,
55
50
  options.formattingOptions
56
51
  );
57
52
 
58
- const target = e.target as HTMLInputElement;
59
- const rawValue = target.getAttribute('data-raw-value') ?? undefined;
60
- if (rawValue) {
61
- target.removeAttribute('data-raw-value');
62
- }
63
-
64
53
  return {
65
- value,
66
- rawValue,
54
+ value: formatted,
55
+ rawValue: raw,
67
56
  };
68
57
  }
69
58
 
@@ -84,24 +73,20 @@ export function handleNumoraOnBlur(
84
73
  formattingOptions: FormattingOptions & { rawValueMode?: boolean };
85
74
  }
86
75
  ): BlurResult {
87
- // If formatOn is blur, force formatting on blur by invoking change handler logic
88
76
  if (options.formattingOptions.formatOn === FormatOn.Blur) {
89
- handleOnChangeNumoraInput(
90
- e.nativeEvent as unknown as Event,
77
+ const { formatted, raw } = formatValueForDisplay(
78
+ e.target.value,
91
79
  options.decimalMaxLength,
92
- undefined,
93
80
  { ...options.formattingOptions, formatOn: FormatOn.Change }
94
81
  );
95
- }
96
-
97
- const target = e.target;
98
- const rawValue = target.getAttribute('data-raw-value') ?? undefined;
99
- if (rawValue) {
100
- target.removeAttribute('data-raw-value');
82
+ return {
83
+ value: formatted,
84
+ rawValue: raw,
85
+ };
101
86
  }
102
87
 
103
88
  return {
104
- value: target.value,
105
- rawValue,
89
+ value: e.target.value,
90
+ rawValue: undefined,
106
91
  };
107
92
  }
package/src/index.tsx CHANGED
@@ -2,15 +2,16 @@ import React, {
2
2
  useRef,
3
3
  useState,
4
4
  useEffect,
5
+ useLayoutEffect,
5
6
  forwardRef,
6
- useImperativeHandle,
7
+ useCallback,
7
8
  } from 'react';
8
9
  import {
9
10
  FormatOn,
10
11
  ThousandStyle,
12
+ formatValueForDisplay,
11
13
  type CaretPositionInfo,
12
14
  type FormattingOptions,
13
- handleOnChangeNumoraInput,
14
15
  } from 'numora';
15
16
  import {
16
17
  handleNumoraOnBlur,
@@ -19,13 +20,13 @@ import {
19
20
  handleNumoraOnPaste,
20
21
  } from './handlers';
21
22
 
22
- interface NumoraInputProps
23
+ export interface NumoraInputProps
23
24
  extends Omit<
24
25
  React.InputHTMLAttributes<HTMLInputElement>,
25
26
  'onChange' | 'type' | 'inputMode'
26
27
  > {
27
28
  maxDecimals?: number;
28
- onChange?: (e: React.ChangeEvent<HTMLInputElement> | React.ClipboardEvent<HTMLInputElement>) => void;
29
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
29
30
 
30
31
  formatOn?: FormatOn;
31
32
  thousandSeparator?: string;
@@ -60,27 +61,11 @@ const NumoraInput = forwardRef<HTMLInputElement, NumoraInputProps>((props, ref)
60
61
  ...rest
61
62
  } = props;
62
63
 
63
- const inputRef = useRef<HTMLInputElement>(null);
64
+ const internalInputRef = useRef<HTMLInputElement>(null);
64
65
  const caretInfoRef = useRef<CaretPositionInfo | undefined>(undefined);
66
+ const lastCaretPosRef = useRef<number | null>(null);
65
67
 
66
- const [internalValue, setInternalValue] = useState<string>(
67
- controlledValue !== undefined
68
- ? String(controlledValue)
69
- : defaultValue !== undefined
70
- ? String(defaultValue)
71
- : ''
72
- );
73
-
74
- // Keep internal state in sync when controlled
75
- useEffect(() => {
76
- if (controlledValue !== undefined) {
77
- setInternalValue(String(controlledValue));
78
- }
79
- }, [controlledValue]);
80
-
81
- useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);
82
-
83
- const formattingOptions: FormattingOptions & { rawValueMode?: boolean } = {
68
+ const formattingOptions: FormattingOptions = {
84
69
  formatOn,
85
70
  thousandSeparator,
86
71
  ThousandStyle: thousandStyle,
@@ -92,110 +77,150 @@ const NumoraInput = forwardRef<HTMLInputElement, NumoraInputProps>((props, ref)
92
77
  rawValueMode,
93
78
  };
94
79
 
95
- const formatValueWithCore = (value: string): string => {
96
- const el = inputRef.current ?? document.createElement('input');
97
- el.value = value;
98
- const fakeEvent = { target: el } as unknown as Event;
99
- handleOnChangeNumoraInput(fakeEvent, maxDecimals, undefined, formattingOptions);
100
- return el.value;
80
+ const getInitialValue = (): string => {
81
+ const valueToFormat = controlledValue !== undefined ? controlledValue : defaultValue;
82
+ if (valueToFormat !== undefined) {
83
+ const { formatted } = formatValueForDisplay(String(valueToFormat), maxDecimals, formattingOptions);
84
+ return formatted;
85
+ }
86
+ return '';
101
87
  };
102
88
 
103
- // When controlled value changes, normalize/format it for display
89
+ const [displayValue, setDisplayValue] = useState<string>(getInitialValue);
90
+
91
+ // Sync external ref with internal ref
92
+ useLayoutEffect(() => {
93
+ if (!ref) return;
94
+ if (typeof ref === 'function') {
95
+ ref(internalInputRef.current);
96
+ } else {
97
+ ref.current = internalInputRef.current;
98
+ }
99
+ }, [ref]);
100
+
101
+ // When controlled value changes from outside, update display value
104
102
  useEffect(() => {
105
103
  if (controlledValue !== undefined) {
106
- const formatted = formatValueWithCore(String(controlledValue));
107
- setInternalValue(formatted);
104
+ const { formatted } = formatValueForDisplay(String(controlledValue), maxDecimals, formattingOptions);
105
+ if (formatted !== displayValue) {
106
+ setDisplayValue(formatted);
107
+ }
108
108
  }
109
- }, [controlledValue, formatOn, thousandSeparator, thousandStyle, decimalSeparator, decimalMinLength, enableCompactNotation, enableNegative, enableLeadingZeros, rawValueMode, maxDecimals]);
109
+ }, [controlledValue, maxDecimals, formattingOptions]);
110
+
111
+ // Restore cursor position after render
112
+ useLayoutEffect(() => {
113
+ if (internalInputRef.current && lastCaretPosRef.current !== null) {
114
+ const input = internalInputRef.current;
115
+ const pos = lastCaretPosRef.current;
116
+ input.setSelectionRange(pos, pos);
117
+ lastCaretPosRef.current = null;
118
+ }
119
+ });
110
120
 
111
- const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
121
+ const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
112
122
  const { value, rawValue } = handleNumoraOnChange(e, {
113
123
  decimalMaxLength: maxDecimals,
114
124
  caretPositionBeforeChange: caretInfoRef.current,
115
125
  formattingOptions,
116
126
  });
117
- caretInfoRef.current = undefined;
118
127
 
119
- if (controlledValue === undefined) {
120
- setInternalValue(value);
121
- } else {
122
- setInternalValue(value);
128
+ // Store cursor position AFTER core library has calculated and set it
129
+ // The core library modifies the DOM element directly during handleNumoraOnChange
130
+ // Read from the input ref (which is the same element) to get the position set by the core library
131
+ if (internalInputRef.current) {
132
+ const cursorPos = internalInputRef.current.selectionStart;
133
+ if (cursorPos !== null && cursorPos !== undefined) {
134
+ lastCaretPosRef.current = cursorPos;
135
+ }
123
136
  }
124
137
 
138
+ caretInfoRef.current = undefined;
139
+
140
+ // Add rawValue to the event object without overriding 'value' property
141
+ (e.target as any).rawValue = rawValue;
142
+
143
+ setDisplayValue(value);
144
+
125
145
  if (onChange) {
126
146
  onChange(e);
127
147
  }
128
-
129
- // Optionally expose rawValue via a custom event attribute if needed later
130
- if (rawValue && e.target && rawValueMode) {
131
- // Keep the raw value on the input for consumers that read it directly
132
- e.target.setAttribute('data-raw-value', rawValue);
148
+ }, [maxDecimals, formattingOptions, onChange]);
149
+
150
+ const handleKeyDown = useCallback((e: React.KeyboardEvent<HTMLInputElement>) => {
151
+ const coreCaretInfo = handleNumoraOnKeyDown(e, formattingOptions);
152
+
153
+ // Always capture cursor position info, even if core library doesn't return it
154
+ // This is needed for cursor position calculation during normal typing (not just Delete/Backspace)
155
+ if (!coreCaretInfo && internalInputRef.current) {
156
+ const selectionStart = internalInputRef.current.selectionStart ?? 0;
157
+ const selectionEnd = internalInputRef.current.selectionEnd ?? 0;
158
+ caretInfoRef.current = {
159
+ selectionStart,
160
+ selectionEnd,
161
+ };
162
+ } else {
163
+ caretInfoRef.current = coreCaretInfo;
133
164
  }
134
- };
165
+
166
+ if (onKeyDown) {
167
+ onKeyDown(e);
168
+ }
169
+ }, [formattingOptions, onKeyDown]);
135
170
 
136
- const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {
171
+ const handlePaste = useCallback((e: React.ClipboardEvent<HTMLInputElement>) => {
137
172
  const { value, rawValue } = handleNumoraOnPaste(e, {
138
173
  decimalMaxLength: maxDecimals,
139
174
  formattingOptions,
140
175
  });
141
176
 
142
- if (controlledValue === undefined) {
143
- setInternalValue(value);
144
- } else {
145
- setInternalValue(value);
146
- }
177
+ // For paste, we often want to move cursor to the end of pasted content
178
+ // handleNumoraOnPaste already handles DOM value and cursor, but React will overwrite it.
179
+ // So we capture where the core logic set the cursor.
180
+ lastCaretPosRef.current = (e.target as HTMLInputElement).selectionStart;
181
+ (e.target as any).rawValue = rawValue;
182
+
183
+ setDisplayValue(value);
147
184
 
148
185
  if (onPaste) {
149
186
  onPaste(e);
150
187
  }
151
- if (onChange) {
152
- onChange(e);
153
- }
154
-
155
- if (rawValue && e.target && rawValueMode) {
156
- (e.target as HTMLInputElement).setAttribute('data-raw-value', rawValue);
157
- }
158
- };
159
188
 
160
- const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
161
- caretInfoRef.current = handleNumoraOnKeyDown(e, formattingOptions);
162
- if (onKeyDown) {
163
- onKeyDown(e);
189
+ // Trigger onChange manually because paste event doesn't always trigger a ChangeEvent in all React versions
190
+ // when we preventDefault.
191
+ if (onChange) {
192
+ const changeEvent = e as unknown as React.ChangeEvent<HTMLInputElement>;
193
+ onChange(changeEvent);
164
194
  }
165
- };
195
+ }, [maxDecimals, formattingOptions, onPaste, onChange]);
166
196
 
167
- const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
197
+ const handleBlur = useCallback((e: React.FocusEvent<HTMLInputElement>) => {
168
198
  const { value, rawValue } = handleNumoraOnBlur(e, {
169
199
  decimalMaxLength: maxDecimals,
170
200
  formattingOptions,
171
201
  });
172
202
 
173
- if (controlledValue === undefined) {
174
- setInternalValue(value);
175
- } else {
176
- setInternalValue(value);
177
- }
203
+ (e.target as any).rawValue = rawValue;
204
+ setDisplayValue(value);
178
205
 
179
206
  if (onBlur) {
180
207
  onBlur(e);
181
208
  }
182
-
183
- if (rawValue && e.target && rawValueMode) {
184
- (e.target as HTMLInputElement).setAttribute('data-raw-value', rawValue);
185
- }
186
- };
209
+ }, [maxDecimals, formattingOptions, onBlur]);
187
210
 
188
211
  return (
189
212
  <input
190
213
  {...rest}
191
- ref={inputRef}
192
- value={internalValue}
214
+ ref={internalInputRef}
215
+ value={displayValue}
193
216
  onChange={handleChange}
194
- onPaste={handlePaste}
195
217
  onKeyDown={handleKeyDown}
218
+ onPaste={handlePaste}
196
219
  onBlur={handleBlur}
197
220
  type="text"
198
221
  inputMode="decimal"
222
+ spellCheck={false}
223
+ autoComplete="off"
199
224
  />
200
225
  );
201
226
  });