numora-react 3.0.0 → 3.0.1

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.
Files changed (2) hide show
  1. package/README.md +34 -34
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -11,10 +11,10 @@ React component wrapper for [Numora](https://github.com/Sharqiewicz/numora) - a
11
11
  |---------|-------------|
12
12
  | **React Component** | Drop-in replacement for `<input>` with numeric formatting |
13
13
  | **Decimal Precision Control** | Configure maximum decimal places with `maxDecimals` prop |
14
- | **Thousand Separators** | Customizable thousand separators with `thousandsSeparator` prop |
14
+ | **Thousand Separators** | Customizable thousand separators with `thousandSeparator` prop |
15
15
  | **Grouping Styles** | Support for different grouping styles (`thousand`, `lakh`, `wan`) |
16
16
  | **Format on Blur/Change** | Choose when to apply formatting: on blur or on change |
17
- | **Compact Notation Expansion** | When enabled via `shorthandParsing`, expands compact notation during paste (e.g., `"1k"` → `"1000"`, `"1.5m"` → `"1500000"`) |
17
+ | **Compact Notation Expansion** | When enabled via `enableCompactNotation`, expands compact notation during paste (e.g., `"1k"` → `"1000"`, `"1.5m"` → `"1500000"`) |
18
18
  | **Scientific Notation Expansion** | Always automatically expands scientific notation (e.g., `"1.5e-7"` → `"0.00000015"`, `"2e+5"` → `"200000"`) |
19
19
  | **Paste Event Handling** | Intelligent paste handling with automatic sanitization, formatting, and cursor positioning |
20
20
  | **Cursor Position Preservation** | Smart cursor positioning that works with thousand separators, even during formatting |
@@ -22,7 +22,7 @@ React component wrapper for [Numora](https://github.com/Sharqiewicz/numora) - a
22
22
  | **Mobile Keyboard Optimization** | Automatic `inputmode="decimal"` for mobile numeric keyboards |
23
23
  | **Mobile Keyboard Filtering** | Automatically filters non-breaking spaces and Unicode whitespace artifacts from mobile keyboards |
24
24
  | **Non-numeric Character Filtering** | Automatic removal of invalid characters |
25
- | **Comma/Dot Conversion** | When `thousandsGroupStyle` is not set (or `None`), typing comma or dot automatically converts to the configured decimal separator |
25
+ | **Comma/Dot Conversion** | When `thousandStyle` is not set (or `None`), typing comma or dot automatically converts to the configured decimal separator |
26
26
  | **TypeScript Support** | Full TypeScript definitions included |
27
27
  | **Ref Forwarding** | Supports React ref forwarding for direct input access |
28
28
  | **Standard Input Props** | Accepts all standard HTMLInputElement props |
@@ -67,11 +67,11 @@ pnpm add numora-react
67
67
  ### Basic Example
68
68
 
69
69
  ```tsx
70
- import { NumericInput } from 'numora-react';
70
+ import { NumoraInput } from 'numora-react';
71
71
 
72
72
  function App() {
73
73
  return (
74
- <NumericInput
74
+ <NumoraInput
75
75
  maxDecimals={2}
76
76
  onChange={(e) => {
77
77
  console.log('Value:', e.target.value);
@@ -84,20 +84,20 @@ function App() {
84
84
  ### Advanced Example
85
85
 
86
86
  ```tsx
87
- import { NumericInput } from 'numora-react';
87
+ import { NumoraInput } from 'numora-react';
88
88
  import { useRef } from 'react';
89
89
 
90
90
  function PaymentForm() {
91
91
  const inputRef = useRef<HTMLInputElement>(null);
92
92
 
93
93
  return (
94
- <NumericInput
94
+ <NumoraInput
95
95
  ref={inputRef}
96
96
  maxDecimals={18}
97
97
  formatOn="change"
98
- thousandsSeparator=","
99
- thousandsGroupStyle="thousand"
100
- shorthandParsing={true} // Enable compact notation expansion on paste
98
+ thousandSeparator=","
99
+ thousandStyle="thousand"
100
+ enableCompactNotation={true} // Enable compact notation expansion on paste
101
101
  placeholder="Enter amount"
102
102
  className="payment-input"
103
103
  onChange={(e) => {
@@ -118,13 +118,13 @@ function PaymentForm() {
118
118
  ### Compact Notation Example
119
119
 
120
120
  ```tsx
121
- import { NumericInput } from 'numora-react';
121
+ import { NumoraInput } from 'numora-react';
122
122
 
123
123
  function App() {
124
124
  return (
125
- <NumericInput
125
+ <NumoraInput
126
126
  maxDecimals={18}
127
- shorthandParsing={true} // Enable compact notation expansion
127
+ enableCompactNotation={true} // Enable compact notation expansion
128
128
  onChange={(e) => {
129
129
  console.log('Value:', e.target.value);
130
130
  }}
@@ -139,11 +139,11 @@ function App() {
139
139
  ### Scientific Notation Example
140
140
 
141
141
  ```tsx
142
- import { NumericInput } from 'numora-react';
142
+ import { NumoraInput } from 'numora-react';
143
143
 
144
144
  function App() {
145
145
  return (
146
- <NumericInput
146
+ <NumoraInput
147
147
  maxDecimals={18}
148
148
  onChange={(e) => {
149
149
  console.log('Value:', e.target.value);
@@ -163,17 +163,17 @@ function App() {
163
163
 
164
164
  ```tsx
165
165
  import { useForm } from 'react-hook-form';
166
- import { NumericInput } from 'numora-react';
166
+ import { NumoraInput } from 'numora-react';
167
167
 
168
168
  function Form() {
169
169
  const { register, handleSubmit } = useForm();
170
170
 
171
171
  return (
172
172
  <form onSubmit={handleSubmit((data) => console.log(data))}>
173
- <NumericInput
173
+ <NumoraInput
174
174
  {...register('amount')}
175
175
  maxDecimals={2}
176
- thousandsSeparator=","
176
+ thousandSeparator=","
177
177
  />
178
178
  <button type="submit">Submit</button>
179
179
  </form>
@@ -185,7 +185,7 @@ function Form() {
185
185
 
186
186
  ```tsx
187
187
  import { useFormik } from 'formik';
188
- import { NumericInput } from 'numora-react';
188
+ import { NumoraInput } from 'numora-react';
189
189
 
190
190
  function Form() {
191
191
  const formik = useFormik({
@@ -197,13 +197,13 @@ function Form() {
197
197
 
198
198
  return (
199
199
  <form onSubmit={formik.handleSubmit}>
200
- <NumericInput
200
+ <NumoraInput
201
201
  name="amount"
202
202
  value={formik.values.amount}
203
203
  onChange={formik.handleChange}
204
204
  onBlur={formik.handleBlur}
205
205
  maxDecimals={2}
206
- thousandsSeparator=","
206
+ thousandSeparator=","
207
207
  />
208
208
  <button type="submit">Submit</button>
209
209
  </form>
@@ -214,18 +214,18 @@ function Form() {
214
214
  ### Controlled Component
215
215
 
216
216
  ```tsx
217
- import { NumericInput } from 'numora-react';
217
+ import { NumoraInput } from 'numora-react';
218
218
  import { useState } from 'react';
219
219
 
220
220
  function ControlledInput() {
221
221
  const [value, setValue] = useState('');
222
222
 
223
223
  return (
224
- <NumericInput
224
+ <NumoraInput
225
225
  value={value}
226
226
  onChange={(e) => setValue(e.target.value)}
227
227
  maxDecimals={2}
228
- thousandsSeparator=","
228
+ thousandSeparator=","
229
229
  />
230
230
  );
231
231
  }
@@ -234,7 +234,7 @@ function ControlledInput() {
234
234
  ### Uncontrolled Component
235
235
 
236
236
  ```tsx
237
- import { NumericInput } from 'numora-react';
237
+ import { NumoraInput } from 'numora-react';
238
238
  import { useRef } from 'react';
239
239
 
240
240
  function UncontrolledInput() {
@@ -247,10 +247,10 @@ function UncontrolledInput() {
247
247
 
248
248
  return (
249
249
  <>
250
- <NumericInput
250
+ <NumoraInput
251
251
  ref={inputRef}
252
252
  maxDecimals={2}
253
- thousandsSeparator=","
253
+ thousandSeparator=","
254
254
  />
255
255
  <button onClick={handleSubmit}>Get Value</button>
256
256
  </>
@@ -264,9 +264,9 @@ function UncontrolledInput() {
264
264
  |------|------|---------|-------------|
265
265
  | `maxDecimals` | `number` | `2` | Maximum number of decimal places allowed |
266
266
  | `formatOn` | `'blur' \| 'change'` | `'blur'` | When to apply formatting: `'blur'` or `'change'` |
267
- | `thousandsSeparator` | `string` | `','` | Character used as thousand separator |
268
- | `thousandsGroupStyle` | `'thousand' \| 'lakh' \| 'wan'` | `'thousand'` | Grouping style for thousand separators |
269
- | `shorthandParsing` | `boolean` | `false` | Enable compact notation expansion (e.g., `"1k"` → `"1000"`) on paste |
267
+ | `thousandSeparator` | `string` | `','` | Character used as thousand separator |
268
+ | `thousandStyle` | `'thousand' \| 'lakh' \| 'wan'` | `'thousand'` | Grouping style for thousand separators |
269
+ | `enableCompactNotation` | `boolean` | `false` | Enable compact notation expansion (e.g., `"1k"` → `"1000"`) on paste |
270
270
  | `onChange` | `(e: ChangeEvent<HTMLInputElement> \| ClipboardEvent<HTMLInputElement>) => void` | `undefined` | Callback when value changes |
271
271
  | `additionalStyle` | `string` | `undefined` | Additional CSS styles (deprecated, use `style` prop) |
272
272
 
@@ -278,7 +278,7 @@ All standard HTMLInputElement props are also supported (e.g., `placeholder`, `cl
278
278
 
279
279
  ## API Reference
280
280
 
281
- ### NumericInput
281
+ ### NumoraInput
282
282
 
283
283
  A React component that wraps the core Numora functionality in a React-friendly API.
284
284
 
@@ -291,14 +291,14 @@ A React component that wraps the core Numora functionality in a React-friendly A
291
291
  Full TypeScript support is included. The component is typed with proper interfaces:
292
292
 
293
293
  ```tsx
294
- import { NumericInput } from 'numora-react';
294
+ import { NumoraInput } from 'numora-react';
295
295
 
296
296
  // All props are fully typed
297
297
  const input = (
298
- <NumericInput
298
+ <NumoraInput
299
299
  maxDecimals={18} // ✅ TypeScript knows this is a number
300
300
  formatOn="change" // ✅ TypeScript knows valid values
301
- shorthandParsing={true} // ✅ TypeScript knows this is boolean
301
+ enableCompactNotation={true} // ✅ TypeScript knows this is boolean
302
302
  onChange={(e) => {
303
303
  // ✅ e is properly typed as ChangeEvent<HTMLInputElement>
304
304
  console.log(e.target.value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "numora-react",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -62,7 +62,7 @@
62
62
  "rollup-plugin-peer-deps-external": "^2.2.4",
63
63
  "tslib": "^2.8.1",
64
64
  "typescript": "^5.9.3",
65
- "numora": "^3.0.0"
65
+ "numora": "^3.0.1"
66
66
  },
67
67
  "publishConfig": {
68
68
  "access": "public"