numora-react 1.0.8 → 2.0.5

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 formatValue,\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 formatOn is blur, format the value using the pure formatting utility\n if (options.formattingOptions.formatOn === FormatOn.Blur) {\n const { formatted, raw } = formatValue(\n e.target.value,\n options.decimalMaxLength,\n { ...options.formattingOptions, formatOn: FormatOn.Change }\n );\n e.target.value = formatted;\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 forwardRef,\n useImperativeHandle,\n} from 'react';\nimport {\n FormatOn,\n ThousandStyle,\n formatValue,\n type CaretPositionInfo,\n type FormattingOptions,\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 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 getFormattedDefaultValue = (): string => {\n if (defaultValue !== undefined) {\n const { formatted } = formatValue(String(defaultValue), maxDecimals, formattingOptions);\n return formatted;\n }\n return '';\n };\n\n const getInitialControlledValue = (): string => {\n if (controlledValue !== undefined) {\n const { formatted } = formatValue(String(controlledValue), maxDecimals, formattingOptions);\n return formatted;\n }\n return '';\n };\n\n const [internalValue, setInternalValue] = useState<string>(getInitialControlledValue);\n\n useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);\n\n // When controlled value changes, normalize/format it for display\n useEffect(() => {\n if (controlledValue !== undefined) {\n const { formatted } = formatValue(String(controlledValue), maxDecimals, formattingOptions);\n setInternalValue(formatted);\n }\n }, [controlledValue, maxDecimals, formatOn, thousandSeparator, thousandStyle, decimalSeparator, decimalMinLength, enableCompactNotation, enableNegative, enableLeadingZeros, rawValueMode]);\n\n const isControlled = controlledValue !== undefined;\n\n const updateValue = (value: string) => {\n if (isControlled) {\n setInternalValue(value);\n }\n };\n\n const syncEventValue = (\n target: HTMLInputElement,\n formattedValue: string,\n rawValue?: string\n ): void => {\n Object.defineProperty(target, 'value', {\n writable: true,\n value: formattedValue,\n });\n\n if (rawValue !== undefined) {\n Object.defineProperty(target, 'rawValue', {\n writable: true,\n value: rawValue,\n enumerable: true,\n configurable: true,\n });\n }\n };\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 syncEventValue(e.target, value, rawValue);\n updateValue(value);\n\n if (onChange) {\n onChange(e);\n }\n };\n\n const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n const { value, rawValue } = handleNumoraOnPaste(e, {\n decimalMaxLength: maxDecimals,\n formattingOptions,\n });\n\n syncEventValue(e.target as HTMLInputElement, value, rawValue);\n updateValue(value);\n\n if (onPaste) {\n onPaste(e);\n }\n if (onChange) {\n onChange(e);\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 syncEventValue(e.target, value, rawValue);\n updateValue(value);\n\n if (onBlur) {\n onBlur(e);\n }\n };\n\n return (\n <input\n {...rest}\n ref={inputRef}\n {...(isControlled\n ? { value: internalValue }\n : { defaultValue: getFormattedDefaultValue() }\n )}\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":["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,KA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AAC,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC;QACzC,WAAW,CAAC,KAAK,CAAC;QAElB,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,CAAC,CAAC;QACX;AACF,IAAA,CAAC;IAED,QACEC,oCACM,IAAI,EACR,GAAG,EAAE,QAAQ,EAAA,IACR;AACH,cAAE,EAAE,KAAK,EAAE,aAAa;AACxB,cAAE,EAAE,YAAY,EAAE,wBAAwB,EAAE,EAAE,CAC/C,EACD,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;;;;","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": "2.0.5",
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
+ "numora": "^2.0.5",
60
+ "react": "^19.2.3",
61
+ "react-dom": "^19.2.3",
62
+ "rollup": "^4.53.5",
62
63
  "rollup-plugin-peer-deps-external": "^2.2.4",
63
64
  "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"
65
+ "typescript": "^5.9.3"
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
+ formatValue,
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,22 @@ 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
76
+ // If formatOn is blur, format the value using the pure formatting utility
88
77
  if (options.formattingOptions.formatOn === FormatOn.Blur) {
89
- handleOnChangeNumoraInput(
90
- e.nativeEvent as unknown as Event,
78
+ const { formatted, raw } = formatValue(
79
+ e.target.value,
91
80
  options.decimalMaxLength,
92
- undefined,
93
81
  { ...options.formattingOptions, formatOn: FormatOn.Change }
94
82
  );
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');
83
+ e.target.value = formatted;
84
+ return {
85
+ value: formatted,
86
+ rawValue: raw,
87
+ };
101
88
  }
102
89
 
103
90
  return {
104
- value: target.value,
105
- rawValue,
91
+ value: e.target.value,
92
+ rawValue: undefined,
106
93
  };
107
94
  }
package/src/index.tsx CHANGED
@@ -8,9 +8,9 @@ import React, {
8
8
  import {
9
9
  FormatOn,
10
10
  ThousandStyle,
11
+ formatValue,
11
12
  type CaretPositionInfo,
12
13
  type FormattingOptions,
13
- handleOnChangeNumoraInput,
14
14
  } from 'numora';
15
15
  import {
16
16
  handleNumoraOnBlur,
@@ -63,23 +63,6 @@ const NumoraInput = forwardRef<HTMLInputElement, NumoraInputProps>((props, ref)
63
63
  const inputRef = useRef<HTMLInputElement>(null);
64
64
  const caretInfoRef = useRef<CaretPositionInfo | undefined>(undefined);
65
65
 
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
66
  const formattingOptions: FormattingOptions & { rawValueMode?: boolean } = {
84
67
  formatOn,
85
68
  thousandSeparator,
@@ -92,21 +75,61 @@ const NumoraInput = forwardRef<HTMLInputElement, NumoraInputProps>((props, ref)
92
75
  rawValueMode,
93
76
  };
94
77
 
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;
78
+ const getFormattedDefaultValue = (): string => {
79
+ if (defaultValue !== undefined) {
80
+ const { formatted } = formatValue(String(defaultValue), maxDecimals, formattingOptions);
81
+ return formatted;
82
+ }
83
+ return '';
101
84
  };
102
85
 
86
+ const getInitialControlledValue = (): string => {
87
+ if (controlledValue !== undefined) {
88
+ const { formatted } = formatValue(String(controlledValue), maxDecimals, formattingOptions);
89
+ return formatted;
90
+ }
91
+ return '';
92
+ };
93
+
94
+ const [internalValue, setInternalValue] = useState<string>(getInitialControlledValue);
95
+
96
+ useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);
97
+
103
98
  // When controlled value changes, normalize/format it for display
104
99
  useEffect(() => {
105
100
  if (controlledValue !== undefined) {
106
- const formatted = formatValueWithCore(String(controlledValue));
101
+ const { formatted } = formatValue(String(controlledValue), maxDecimals, formattingOptions);
107
102
  setInternalValue(formatted);
108
103
  }
109
- }, [controlledValue, formatOn, thousandSeparator, thousandStyle, decimalSeparator, decimalMinLength, enableCompactNotation, enableNegative, enableLeadingZeros, rawValueMode, maxDecimals]);
104
+ }, [controlledValue, maxDecimals, formatOn, thousandSeparator, thousandStyle, decimalSeparator, decimalMinLength, enableCompactNotation, enableNegative, enableLeadingZeros, rawValueMode]);
105
+
106
+ const isControlled = controlledValue !== undefined;
107
+
108
+ const updateValue = (value: string) => {
109
+ if (isControlled) {
110
+ setInternalValue(value);
111
+ }
112
+ };
113
+
114
+ const syncEventValue = (
115
+ target: HTMLInputElement,
116
+ formattedValue: string,
117
+ rawValue?: string
118
+ ): void => {
119
+ Object.defineProperty(target, 'value', {
120
+ writable: true,
121
+ value: formattedValue,
122
+ });
123
+
124
+ if (rawValue !== undefined) {
125
+ Object.defineProperty(target, 'rawValue', {
126
+ writable: true,
127
+ value: rawValue,
128
+ enumerable: true,
129
+ configurable: true,
130
+ });
131
+ }
132
+ };
110
133
 
111
134
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
112
135
  const { value, rawValue } = handleNumoraOnChange(e, {
@@ -116,21 +139,12 @@ const NumoraInput = forwardRef<HTMLInputElement, NumoraInputProps>((props, ref)
116
139
  });
117
140
  caretInfoRef.current = undefined;
118
141
 
119
- if (controlledValue === undefined) {
120
- setInternalValue(value);
121
- } else {
122
- setInternalValue(value);
123
- }
142
+ syncEventValue(e.target, value, rawValue);
143
+ updateValue(value);
124
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);
133
- }
134
148
  };
135
149
 
136
150
  const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {
@@ -139,11 +153,8 @@ const NumoraInput = forwardRef<HTMLInputElement, NumoraInputProps>((props, ref)
139
153
  formattingOptions,
140
154
  });
141
155
 
142
- if (controlledValue === undefined) {
143
- setInternalValue(value);
144
- } else {
145
- setInternalValue(value);
146
- }
156
+ syncEventValue(e.target as HTMLInputElement, value, rawValue);
157
+ updateValue(value);
147
158
 
148
159
  if (onPaste) {
149
160
  onPaste(e);
@@ -151,10 +162,6 @@ const NumoraInput = forwardRef<HTMLInputElement, NumoraInputProps>((props, ref)
151
162
  if (onChange) {
152
163
  onChange(e);
153
164
  }
154
-
155
- if (rawValue && e.target && rawValueMode) {
156
- (e.target as HTMLInputElement).setAttribute('data-raw-value', rawValue);
157
- }
158
165
  };
159
166
 
160
167
  const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
@@ -170,26 +177,22 @@ const NumoraInput = forwardRef<HTMLInputElement, NumoraInputProps>((props, ref)
170
177
  formattingOptions,
171
178
  });
172
179
 
173
- if (controlledValue === undefined) {
174
- setInternalValue(value);
175
- } else {
176
- setInternalValue(value);
177
- }
180
+ syncEventValue(e.target, value, rawValue);
181
+ updateValue(value);
178
182
 
179
183
  if (onBlur) {
180
184
  onBlur(e);
181
185
  }
182
-
183
- if (rawValue && e.target && rawValueMode) {
184
- (e.target as HTMLInputElement).setAttribute('data-raw-value', rawValue);
185
- }
186
186
  };
187
187
 
188
188
  return (
189
189
  <input
190
190
  {...rest}
191
191
  ref={inputRef}
192
- value={internalValue}
192
+ {...(isControlled
193
+ ? { value: internalValue }
194
+ : { defaultValue: getFormattedDefaultValue() }
195
+ )}
193
196
  onChange={handleChange}
194
197
  onPaste={handlePaste}
195
198
  onKeyDown={handleKeyDown}
package/dist/index.cjs DELETED
@@ -1,171 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var react = require('react');
5
- var numora = require('numora');
6
-
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
- };
18
- }
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
- };
30
- }
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, { ...options.formattingOptions, formatOn: numora.FormatOn.Change });
38
- }
39
- const target = e.target;
40
- const rawValue = target.getAttribute('data-raw-value') ?? undefined;
41
- if (rawValue) {
42
- target.removeAttribute('data-raw-value');
43
- }
44
- return {
45
- value: target.value,
46
- rawValue,
47
- };
48
- }
49
-
50
- const NumoraInput = react.forwardRef((props, ref) => {
51
- const { maxDecimals = 2, onChange, onPaste, onBlur, onKeyDown, formatOn = numora.FormatOn.Blur, thousandSeparator = ',', thousandStyle = numora.ThousandStyle.Thousand, decimalSeparator = '.', decimalMinLength, enableCompactNotation = false, enableNegative = false, enableLeadingZeros = false, rawValueMode = false, value: controlledValue, defaultValue, ...rest } = props;
52
- const inputRef = react.useRef(null);
53
- const caretInfoRef = react.useRef(undefined);
54
- const [internalValue, setInternalValue] = react.useState(controlledValue !== undefined
55
- ? String(controlledValue)
56
- : defaultValue !== undefined
57
- ? String(defaultValue)
58
- : '');
59
- // Keep internal state in sync when controlled
60
- react.useEffect(() => {
61
- if (controlledValue !== undefined) {
62
- setInternalValue(String(controlledValue));
63
- }
64
- }, [controlledValue]);
65
- react.useImperativeHandle(ref, () => inputRef.current, []);
66
- const formattingOptions = {
67
- formatOn,
68
- thousandSeparator,
69
- ThousandStyle: thousandStyle,
70
- decimalSeparator,
71
- decimalMinLength,
72
- enableCompactNotation,
73
- enableNegative,
74
- enableLeadingZeros,
75
- rawValueMode,
76
- };
77
- const formatValueWithCore = (value) => {
78
- const el = inputRef.current ?? document.createElement('input');
79
- el.value = value;
80
- const fakeEvent = { target: el };
81
- numora.handleOnChangeNumoraInput(fakeEvent, maxDecimals, undefined, formattingOptions);
82
- return el.value;
83
- };
84
- // When controlled value changes, normalize/format it for display
85
- react.useEffect(() => {
86
- if (controlledValue !== undefined) {
87
- const formatted = formatValueWithCore(String(controlledValue));
88
- setInternalValue(formatted);
89
- }
90
- }, [controlledValue, formatOn, thousandSeparator, thousandStyle, decimalSeparator, decimalMinLength, enableCompactNotation, enableNegative, enableLeadingZeros, rawValueMode, maxDecimals]);
91
- const handleChange = (e) => {
92
- const { value, rawValue } = handleNumoraOnChange(e, {
93
- decimalMaxLength: maxDecimals,
94
- caretPositionBeforeChange: caretInfoRef.current,
95
- formattingOptions,
96
- });
97
- caretInfoRef.current = undefined;
98
- if (controlledValue === undefined) {
99
- setInternalValue(value);
100
- }
101
- else {
102
- setInternalValue(value);
103
- }
104
- if (onChange) {
105
- onChange(e);
106
- }
107
- // Optionally expose rawValue via a custom event attribute if needed later
108
- if (rawValue && e.target && rawValueMode) {
109
- // Keep the raw value on the input for consumers that read it directly
110
- e.target.setAttribute('data-raw-value', rawValue);
111
- }
112
- };
113
- const handlePaste = (e) => {
114
- const { value, rawValue } = handleNumoraOnPaste(e, {
115
- decimalMaxLength: maxDecimals,
116
- formattingOptions,
117
- });
118
- if (controlledValue === undefined) {
119
- setInternalValue(value);
120
- }
121
- else {
122
- setInternalValue(value);
123
- }
124
- if (onPaste) {
125
- onPaste(e);
126
- }
127
- if (onChange) {
128
- onChange(e);
129
- }
130
- if (rawValue && e.target && rawValueMode) {
131
- e.target.setAttribute('data-raw-value', rawValue);
132
- }
133
- };
134
- const handleKeyDown = (e) => {
135
- caretInfoRef.current = handleNumoraOnKeyDown(e, formattingOptions);
136
- if (onKeyDown) {
137
- onKeyDown(e);
138
- }
139
- };
140
- const handleBlur = (e) => {
141
- const { value, rawValue } = handleNumoraOnBlur(e, {
142
- decimalMaxLength: maxDecimals,
143
- formattingOptions,
144
- });
145
- if (controlledValue === undefined) {
146
- setInternalValue(value);
147
- }
148
- else {
149
- setInternalValue(value);
150
- }
151
- if (onBlur) {
152
- onBlur(e);
153
- }
154
- if (rawValue && e.target && rawValueMode) {
155
- e.target.setAttribute('data-raw-value', rawValue);
156
- }
157
- };
158
- return (jsxRuntime.jsx("input", { ...rest, ref: inputRef, value: internalValue, onChange: handleChange, onPaste: handlePaste, onKeyDown: handleKeyDown, onBlur: handleBlur, type: "text", inputMode: "decimal" }));
159
- });
160
- NumoraInput.displayName = 'NumoraInput';
161
-
162
- Object.defineProperty(exports, "FormatOn", {
163
- enumerable: true,
164
- get: function () { return numora.FormatOn; }
165
- });
166
- Object.defineProperty(exports, "ThousandStyle", {
167
- enumerable: true,
168
- get: function () { return numora.ThousandStyle; }
169
- });
170
- exports.NumoraInput = NumoraInput;
171
- //# sourceMappingURL=index.cjs.map