numora 2.0.3 → 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.
@@ -19,6 +19,13 @@ export declare function handleOnKeyDownNumoraInput(e: KeyboardEvent, formattingO
19
19
  * @param decimalMaxLength - The maximum number of decimal places allowed.
20
20
  * @param caretPositionBeforeChange - Optional caret position info from keydown handler
21
21
  * @param formattingOptions - Optional formatting options for real-time formatting
22
+ * @returns Object with formatted value and raw value
22
23
  */
23
- export declare function handleOnChangeNumoraInput(e: Event, decimalMaxLength: number, caretPositionBeforeChange?: CaretPositionInfo, formattingOptions?: FormattingOptions): void;
24
- export declare function handleOnPasteNumoraInput(e: ClipboardEvent, decimalMaxLength: number, formattingOptions?: FormattingOptions): string;
24
+ export declare function handleOnChangeNumoraInput(e: Event, decimalMaxLength: number, caretPositionBeforeChange?: CaretPositionInfo, formattingOptions?: FormattingOptions): {
25
+ formatted: string;
26
+ raw: string;
27
+ };
28
+ export declare function handleOnPasteNumoraInput(e: ClipboardEvent, decimalMaxLength: number, formattingOptions?: FormattingOptions): {
29
+ formatted: string;
30
+ raw: string;
31
+ };
@@ -0,0 +1,28 @@
1
+ import { type FormattingOptions } from '@/types';
2
+ /**
3
+ * Processes and formats a numeric input value by sanitizing, trimming decimals, and applying formatting.
4
+ * This is a pure function that doesn't require DOM elements or events.
5
+ *
6
+ * @param rawValue - The raw input value to process
7
+ * @param decimalMaxLength - Maximum number of decimal places allowed
8
+ * @param formattingOptions - Optional formatting options
9
+ * @param shouldRemoveThousandSeparators - Whether to remove thousand separators during sanitization (default: determined by formatOn)
10
+ * @returns Object with formatted value and raw value (raw value is the value before formatting)
11
+ */
12
+ export declare function processAndFormatValue(rawValue: string, decimalMaxLength: number, formattingOptions?: FormattingOptions, shouldRemoveThousandSeparators?: boolean): {
13
+ formatted: string;
14
+ raw: string;
15
+ };
16
+ /**
17
+ * Formats a value for display using the provided formatting options.
18
+ * This is a pure function that can be used without DOM events.
19
+ *
20
+ * @param value - The value to format
21
+ * @param decimalMaxLength - Maximum number of decimal places allowed
22
+ * @param formattingOptions - Optional formatting options
23
+ * @returns Object with formatted value and raw value
24
+ */
25
+ export declare function formatValue(value: string, decimalMaxLength: number, formattingOptions?: FormattingOptions): {
26
+ formatted: string;
27
+ raw: string;
28
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "numora",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "Precision-first numeric input library for DeFi and financial applications",
5
5
  "homepage": "https://numora.xyz/",
6
6
  "main": "dist/index.js",
@@ -61,7 +61,7 @@
61
61
  "access": "public"
62
62
  },
63
63
  "scripts": {
64
- "build": "vite build && tsc --emitDeclarationOnly",
64
+ "build": "vite build & tsc --emitDeclarationOnly",
65
65
  "test": "vitest run",
66
66
  "dev": "vite build --watch"
67
67
  }