react-bigint-input 1.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.
- package/README.md +157 -0
- package/dist/index.d.mts +117 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.js +475 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +446 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +56 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
// src/BigIntInput.tsx
|
|
2
|
+
import { Component, createRef } from "react";
|
|
3
|
+
|
|
4
|
+
// src/utils.ts
|
|
5
|
+
function detectSeparators(locale) {
|
|
6
|
+
const parts = new Intl.NumberFormat(locale).formatToParts(123456789e-2);
|
|
7
|
+
let thousands = ",";
|
|
8
|
+
let decimal = ".";
|
|
9
|
+
for (const part of parts) {
|
|
10
|
+
if (part.type === "group") thousands = part.value;
|
|
11
|
+
if (part.type === "decimal") decimal = part.value;
|
|
12
|
+
}
|
|
13
|
+
return { thousands, decimal };
|
|
14
|
+
}
|
|
15
|
+
function formatUnits(value, decimals) {
|
|
16
|
+
if (decimals === 0) return value.toString();
|
|
17
|
+
const isNegative = value < 0n;
|
|
18
|
+
const abs = isNegative ? -value : value;
|
|
19
|
+
const str = abs.toString().padStart(decimals + 1, "0");
|
|
20
|
+
const intPart = str.slice(0, str.length - decimals);
|
|
21
|
+
const fracPart = str.slice(str.length - decimals).replace(/0+$/, "");
|
|
22
|
+
const formatted = fracPart ? `${intPart}.${fracPart}` : intPart;
|
|
23
|
+
return isNegative ? `-${formatted}` : formatted;
|
|
24
|
+
}
|
|
25
|
+
function parseUnits(value, decimals) {
|
|
26
|
+
if (!value || value === "." || value === "-" || value === "-.") return 0n;
|
|
27
|
+
const isNegative = value.startsWith("-");
|
|
28
|
+
const unsigned = isNegative ? value.slice(1) : value;
|
|
29
|
+
const [intPart = "0", fracPart = ""] = unsigned.split(".");
|
|
30
|
+
if (fracPart.length > decimals) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
`Fractional component exceeds decimals (${fracPart.length} > ${decimals})`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
const paddedFrac = fracPart.padEnd(decimals, "0");
|
|
36
|
+
const combined = intPart + paddedFrac;
|
|
37
|
+
const trimmed = combined.replace(/^0+/, "") || "0";
|
|
38
|
+
const result = BigInt(trimmed);
|
|
39
|
+
return isNegative ? -result : result;
|
|
40
|
+
}
|
|
41
|
+
function truncateDecimals(value, maxDecimals) {
|
|
42
|
+
const dotIndex = value.indexOf(".");
|
|
43
|
+
if (dotIndex === -1) return value;
|
|
44
|
+
if (maxDecimals === 0) return value.slice(0, dotIndex);
|
|
45
|
+
return value.slice(0, dotIndex + 1 + maxDecimals);
|
|
46
|
+
}
|
|
47
|
+
function stripLeadingZeros(value) {
|
|
48
|
+
if (!value) return value;
|
|
49
|
+
const isNegative = value.startsWith("-");
|
|
50
|
+
const abs = isNegative ? value.slice(1) : value;
|
|
51
|
+
const dotIndex = abs.indexOf(".");
|
|
52
|
+
let cleaned;
|
|
53
|
+
if (dotIndex > 0) {
|
|
54
|
+
const intPart = abs.slice(0, dotIndex).replace(/^0+/, "") || "0";
|
|
55
|
+
cleaned = intPart + abs.slice(dotIndex);
|
|
56
|
+
} else {
|
|
57
|
+
cleaned = abs.replace(/^0+/, "") || "0";
|
|
58
|
+
}
|
|
59
|
+
return isNegative ? `-${cleaned}` : cleaned;
|
|
60
|
+
}
|
|
61
|
+
function formatValue(value, decimals, format) {
|
|
62
|
+
const raw = formatUnits(value, decimals);
|
|
63
|
+
if (format === "none") return raw;
|
|
64
|
+
let thousand;
|
|
65
|
+
let decimal;
|
|
66
|
+
let intlFormatter = null;
|
|
67
|
+
if (format === "auto") {
|
|
68
|
+
const detected = detectSeparators();
|
|
69
|
+
thousand = detected.thousands;
|
|
70
|
+
decimal = detected.decimal;
|
|
71
|
+
intlFormatter = new Intl.NumberFormat();
|
|
72
|
+
} else if (typeof format === "object" && format.locale) {
|
|
73
|
+
const detected = detectSeparators(format.locale);
|
|
74
|
+
thousand = format.thousand ?? detected.thousands;
|
|
75
|
+
decimal = format.decimal ?? detected.decimal;
|
|
76
|
+
intlFormatter = new Intl.NumberFormat(format.locale);
|
|
77
|
+
} else {
|
|
78
|
+
thousand = format?.thousand ?? ",";
|
|
79
|
+
decimal = format?.decimal ?? ".";
|
|
80
|
+
}
|
|
81
|
+
if (!thousand) return decimal !== "." ? raw.replace(".", decimal) : raw;
|
|
82
|
+
const isNegative = raw.startsWith("-");
|
|
83
|
+
const abs = isNegative ? raw.slice(1) : raw;
|
|
84
|
+
const parts = abs.split(".");
|
|
85
|
+
if (intlFormatter && parts[0]) {
|
|
86
|
+
try {
|
|
87
|
+
parts[0] = intlFormatter.format(BigInt(parts[0]));
|
|
88
|
+
} catch {
|
|
89
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, thousand);
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, thousand);
|
|
93
|
+
}
|
|
94
|
+
const formatted = parts.join(decimal);
|
|
95
|
+
return isNegative ? `-${formatted}` : formatted;
|
|
96
|
+
}
|
|
97
|
+
function parseValue(value, decimals, format) {
|
|
98
|
+
if (!value) return 0n;
|
|
99
|
+
let thousand;
|
|
100
|
+
let decimal;
|
|
101
|
+
if (format === "none") {
|
|
102
|
+
thousand = "";
|
|
103
|
+
decimal = ".";
|
|
104
|
+
} else if (format === "auto") {
|
|
105
|
+
const detected = detectSeparators();
|
|
106
|
+
thousand = detected.thousands;
|
|
107
|
+
decimal = detected.decimal;
|
|
108
|
+
} else if (typeof format === "object" && format.locale) {
|
|
109
|
+
const detected = detectSeparators(format.locale);
|
|
110
|
+
thousand = format.thousand ?? detected.thousands;
|
|
111
|
+
decimal = format.decimal ?? detected.decimal;
|
|
112
|
+
} else {
|
|
113
|
+
thousand = format?.thousand ?? ",";
|
|
114
|
+
decimal = format?.decimal ?? ".";
|
|
115
|
+
}
|
|
116
|
+
let cleaned = value;
|
|
117
|
+
if (thousand) {
|
|
118
|
+
cleaned = cleaned.replace(new RegExp(escapeRegExp(thousand), "g"), "");
|
|
119
|
+
}
|
|
120
|
+
if (decimal !== ".") {
|
|
121
|
+
cleaned = cleaned.replace(new RegExp(escapeRegExp(decimal), "g"), ".");
|
|
122
|
+
}
|
|
123
|
+
return parseUnits(cleaned, decimals);
|
|
124
|
+
}
|
|
125
|
+
function escapeRegExp(str) {
|
|
126
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// src/BigIntInput.tsx
|
|
130
|
+
import { jsx } from "react/jsx-runtime";
|
|
131
|
+
var BigIntInput = class extends Component {
|
|
132
|
+
constructor(props) {
|
|
133
|
+
super(props);
|
|
134
|
+
this.inputRef = createRef();
|
|
135
|
+
this._resolvedFormat = null;
|
|
136
|
+
this._intlFormatter = null;
|
|
137
|
+
this._prevFormatProp = void 0;
|
|
138
|
+
this.pendingCursor = null;
|
|
139
|
+
// --- Event handlers ---
|
|
140
|
+
this.handleChange = (e) => {
|
|
141
|
+
const raw = e.target.value;
|
|
142
|
+
const input = this.inputRef.current;
|
|
143
|
+
const cursorPos = e.target.selectionStart ?? raw.length;
|
|
144
|
+
const { decimals, onChange, max, min } = this.props;
|
|
145
|
+
const dIdx = this.digitIndex(raw, cursorPos);
|
|
146
|
+
const normalized = this.removeThousands(raw);
|
|
147
|
+
const sanitized = this.sanitize(normalized, decimals);
|
|
148
|
+
if (sanitized === null) return;
|
|
149
|
+
const newDisplay = this.addThousands(sanitized);
|
|
150
|
+
const prepended = sanitized.length - normalized.length;
|
|
151
|
+
const adjustedIdx = dIdx + Math.max(0, prepended);
|
|
152
|
+
const newCursor = this.cursorFromDigitIndex(newDisplay, adjustedIdx);
|
|
153
|
+
this.setState({ display: newDisplay }, () => {
|
|
154
|
+
if (input) input.setSelectionRange(newCursor, newCursor);
|
|
155
|
+
});
|
|
156
|
+
try {
|
|
157
|
+
let parsed = parseUnits(sanitized || "0", decimals);
|
|
158
|
+
if (max !== void 0 && parsed > max) {
|
|
159
|
+
parsed = max;
|
|
160
|
+
const maxDisplay = this.valueToDisplay(max, decimals, true);
|
|
161
|
+
this.setState({ display: maxDisplay }, () => {
|
|
162
|
+
if (input) input.setSelectionRange(maxDisplay.length, maxDisplay.length);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (min !== void 0 && parsed < min) {
|
|
166
|
+
parsed = min;
|
|
167
|
+
const minDisplay = this.valueToDisplay(min, decimals, true);
|
|
168
|
+
this.setState({ display: minDisplay }, () => {
|
|
169
|
+
if (input) input.setSelectionRange(minDisplay.length, minDisplay.length);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
onChange(parsed);
|
|
173
|
+
} catch {
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
this.handleKeyDown = (e) => {
|
|
177
|
+
const { thousand } = this.fmt;
|
|
178
|
+
if (!thousand) return;
|
|
179
|
+
const input = e.currentTarget;
|
|
180
|
+
const pos = input.selectionStart;
|
|
181
|
+
const end = input.selectionEnd;
|
|
182
|
+
if (pos === null || end === null) return;
|
|
183
|
+
if (pos !== end) return;
|
|
184
|
+
const val = input.value;
|
|
185
|
+
if (e.key === "Backspace" && pos > 1 && val[pos - 1] === thousand) {
|
|
186
|
+
e.preventDefault();
|
|
187
|
+
const stripped = this.removeThousands(val);
|
|
188
|
+
const digitIdx = this.digitIndex(val, pos - 2);
|
|
189
|
+
const newStripped = stripped.slice(0, digitIdx) + stripped.slice(digitIdx + 1);
|
|
190
|
+
const sanitized = this.sanitize(newStripped, this.props.decimals) ?? "";
|
|
191
|
+
const newDisplay = this.addThousands(sanitized);
|
|
192
|
+
this.pendingCursor = this.cursorFromDigitIndex(newDisplay, digitIdx);
|
|
193
|
+
this.setState({ display: newDisplay });
|
|
194
|
+
try {
|
|
195
|
+
this.props.onChange(parseUnits(sanitized || "0", this.props.decimals));
|
|
196
|
+
} catch {
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (e.key === "Delete" && pos < val.length - 1 && val[pos] === thousand) {
|
|
200
|
+
e.preventDefault();
|
|
201
|
+
const stripped = this.removeThousands(val);
|
|
202
|
+
const digitIdx = this.digitIndex(val, pos);
|
|
203
|
+
const newStripped = stripped.slice(0, digitIdx) + stripped.slice(digitIdx + 1);
|
|
204
|
+
const sanitized = this.sanitize(newStripped, this.props.decimals) ?? "";
|
|
205
|
+
const newDisplay = this.addThousands(sanitized);
|
|
206
|
+
this.pendingCursor = this.cursorFromDigitIndex(newDisplay, digitIdx);
|
|
207
|
+
this.setState({ display: newDisplay });
|
|
208
|
+
try {
|
|
209
|
+
this.props.onChange(parseUnits(sanitized || "0", this.props.decimals));
|
|
210
|
+
} catch {
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
this.handleFocus = (e) => {
|
|
215
|
+
this.setState({ focused: true });
|
|
216
|
+
this.props.onFocus?.(e);
|
|
217
|
+
};
|
|
218
|
+
this.handleBlur = (e) => {
|
|
219
|
+
const { value, decimals, showZero } = this.props;
|
|
220
|
+
this.setState({ focused: false, display: this.valueToDisplay(value, decimals, showZero) });
|
|
221
|
+
this.props.onBlur?.(e);
|
|
222
|
+
};
|
|
223
|
+
this.handlePaste = (e) => {
|
|
224
|
+
const pasted = e.clipboardData.getData("text");
|
|
225
|
+
const { thousand, decimal } = this.fmt;
|
|
226
|
+
const escapedDecimal = escapeRegExp(decimal);
|
|
227
|
+
const escapedThousand = thousand ? escapeRegExp(thousand) : "";
|
|
228
|
+
const minus = this.props.allowNegative ? "\\-" : "";
|
|
229
|
+
const allowed = new RegExp(`^[\\d${escapedDecimal}${escapedThousand}${minus}]+$`);
|
|
230
|
+
if (pasted && !allowed.test(pasted.trim())) {
|
|
231
|
+
e.preventDefault();
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
this._prevFormatProp = props.format;
|
|
235
|
+
this.state = {
|
|
236
|
+
display: this.valueToDisplay(props.value, props.decimals, props.showZero),
|
|
237
|
+
focused: false
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
// --- Format helpers ---
|
|
241
|
+
get fmt() {
|
|
242
|
+
const { format } = this.props;
|
|
243
|
+
if (format === "none") {
|
|
244
|
+
return { thousand: "", decimal: "." };
|
|
245
|
+
}
|
|
246
|
+
if (format === "auto") {
|
|
247
|
+
if (!this._resolvedFormat) {
|
|
248
|
+
const detected = detectSeparators();
|
|
249
|
+
this._resolvedFormat = { thousand: detected.thousands, decimal: detected.decimal };
|
|
250
|
+
this._intlFormatter = new Intl.NumberFormat();
|
|
251
|
+
}
|
|
252
|
+
return this._resolvedFormat;
|
|
253
|
+
}
|
|
254
|
+
if (typeof format === "object") {
|
|
255
|
+
if (format.locale) {
|
|
256
|
+
if (!this._resolvedFormat) {
|
|
257
|
+
const detected = detectSeparators(format.locale);
|
|
258
|
+
this._resolvedFormat = {
|
|
259
|
+
thousand: format.thousand ?? detected.thousands,
|
|
260
|
+
decimal: format.decimal ?? detected.decimal
|
|
261
|
+
};
|
|
262
|
+
this._intlFormatter = new Intl.NumberFormat(format.locale);
|
|
263
|
+
}
|
|
264
|
+
return this._resolvedFormat;
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
thousand: format.thousand ?? ",",
|
|
268
|
+
decimal: format.decimal ?? "."
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
return { thousand: ",", decimal: "." };
|
|
272
|
+
}
|
|
273
|
+
formatChanged() {
|
|
274
|
+
const prev = this._prevFormatProp;
|
|
275
|
+
const curr = this.props.format;
|
|
276
|
+
if (typeof curr === "object" && typeof prev === "object") {
|
|
277
|
+
return curr?.thousand !== prev?.thousand || curr?.decimal !== prev?.decimal || curr?.locale !== prev?.locale;
|
|
278
|
+
}
|
|
279
|
+
return curr !== prev;
|
|
280
|
+
}
|
|
281
|
+
addThousands(value) {
|
|
282
|
+
const { thousand, decimal } = this.fmt;
|
|
283
|
+
if (!thousand) return decimal !== "." ? value.replace(".", decimal) : value;
|
|
284
|
+
const isNegative = value.startsWith("-");
|
|
285
|
+
const abs = isNegative ? value.slice(1) : value;
|
|
286
|
+
const parts = abs.split(".");
|
|
287
|
+
if (this._intlFormatter && parts[0]) {
|
|
288
|
+
try {
|
|
289
|
+
parts[0] = this._intlFormatter.format(BigInt(parts[0]));
|
|
290
|
+
} catch {
|
|
291
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, thousand);
|
|
292
|
+
}
|
|
293
|
+
} else {
|
|
294
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, thousand);
|
|
295
|
+
}
|
|
296
|
+
const formatted = parts.join(decimal);
|
|
297
|
+
return isNegative ? `-${formatted}` : formatted;
|
|
298
|
+
}
|
|
299
|
+
removeThousands(value) {
|
|
300
|
+
const { thousand, decimal } = this.fmt;
|
|
301
|
+
let cleaned = value;
|
|
302
|
+
if (thousand) {
|
|
303
|
+
cleaned = cleaned.replace(new RegExp(escapeRegExp(thousand), "g"), "");
|
|
304
|
+
}
|
|
305
|
+
if (decimal !== ".") {
|
|
306
|
+
cleaned = cleaned.replace(new RegExp(escapeRegExp(decimal), "g"), ".");
|
|
307
|
+
}
|
|
308
|
+
return cleaned;
|
|
309
|
+
}
|
|
310
|
+
// --- Cursor tracking ---
|
|
311
|
+
digitIndex(str, cursorPos) {
|
|
312
|
+
const { thousand } = this.fmt;
|
|
313
|
+
let count = 0;
|
|
314
|
+
for (let i = 0; i < cursorPos && i < str.length; i++) {
|
|
315
|
+
if (str[i] !== thousand) count++;
|
|
316
|
+
}
|
|
317
|
+
return count;
|
|
318
|
+
}
|
|
319
|
+
cursorFromDigitIndex(str, digitIdx) {
|
|
320
|
+
const { thousand } = this.fmt;
|
|
321
|
+
let count = 0;
|
|
322
|
+
for (let i = 0; i < str.length; i++) {
|
|
323
|
+
if (str[i] !== thousand) {
|
|
324
|
+
if (count === digitIdx) return i;
|
|
325
|
+
count++;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return str.length;
|
|
329
|
+
}
|
|
330
|
+
// --- Formatting ---
|
|
331
|
+
valueToDisplay(value, decimals, showZero) {
|
|
332
|
+
if (value === 0n && !showZero) return "";
|
|
333
|
+
return this.addThousands(formatUnits(value, decimals));
|
|
334
|
+
}
|
|
335
|
+
sanitize(input, decimals) {
|
|
336
|
+
if (!input) return "";
|
|
337
|
+
if (input === ".") return decimals > 0 ? "0." : null;
|
|
338
|
+
if (this.props.allowNegative && input === "-.") return decimals > 0 ? "-0." : null;
|
|
339
|
+
let cleaned = this.props.allowNegative ? input.replace(/[^0-9.\-]/g, "") : input.replace(/[^0-9.]/g, "");
|
|
340
|
+
if (this.props.allowNegative) {
|
|
341
|
+
const hasMinus = cleaned.startsWith("-");
|
|
342
|
+
cleaned = cleaned.replace(/-/g, "");
|
|
343
|
+
if (hasMinus) cleaned = "-" + cleaned;
|
|
344
|
+
}
|
|
345
|
+
const dotCount = (cleaned.match(/\./g) || []).length;
|
|
346
|
+
if (dotCount > 1) {
|
|
347
|
+
const firstDot = cleaned.indexOf(".");
|
|
348
|
+
cleaned = cleaned.slice(0, firstDot + 1) + cleaned.slice(firstDot + 1).replace(/\./g, "");
|
|
349
|
+
}
|
|
350
|
+
if (decimals === 0 && cleaned.includes(".")) {
|
|
351
|
+
cleaned = cleaned.split(".")[0];
|
|
352
|
+
}
|
|
353
|
+
cleaned = truncateDecimals(cleaned, decimals);
|
|
354
|
+
cleaned = stripLeadingZeros(cleaned);
|
|
355
|
+
return cleaned;
|
|
356
|
+
}
|
|
357
|
+
// --- Lifecycle ---
|
|
358
|
+
componentDidUpdate(prevProps, _prevState) {
|
|
359
|
+
if (this.formatChanged()) {
|
|
360
|
+
this._resolvedFormat = null;
|
|
361
|
+
this._intlFormatter = null;
|
|
362
|
+
this._prevFormatProp = this.props.format;
|
|
363
|
+
this.setState({
|
|
364
|
+
display: this.valueToDisplay(this.props.value, this.props.decimals, this.props.showZero)
|
|
365
|
+
});
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
this._prevFormatProp = this.props.format;
|
|
369
|
+
if (this.pendingCursor !== null) {
|
|
370
|
+
const cursor = this.pendingCursor;
|
|
371
|
+
this.pendingCursor = null;
|
|
372
|
+
const input = this.inputRef.current;
|
|
373
|
+
if (input) {
|
|
374
|
+
requestAnimationFrame(() => input.setSelectionRange(cursor, cursor));
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
const { value, decimals, showZero } = this.props;
|
|
378
|
+
if (decimals !== prevProps.decimals) {
|
|
379
|
+
this.setState({ display: this.valueToDisplay(value, decimals, showZero) });
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (value !== prevProps.value && !this.state.focused) {
|
|
383
|
+
this.setState({ display: this.valueToDisplay(value, decimals, showZero) });
|
|
384
|
+
}
|
|
385
|
+
if (value !== prevProps.value && this.state.focused) {
|
|
386
|
+
try {
|
|
387
|
+
const parsed = parseUnits(this.removeThousands(this.state.display) || "0", decimals);
|
|
388
|
+
if (parsed !== value) {
|
|
389
|
+
this.setState({ display: this.valueToDisplay(value, decimals, showZero) });
|
|
390
|
+
}
|
|
391
|
+
} catch {
|
|
392
|
+
this.setState({ display: this.valueToDisplay(value, decimals, showZero) });
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
// --- Public API ---
|
|
397
|
+
focus() {
|
|
398
|
+
this.inputRef.current?.focus();
|
|
399
|
+
}
|
|
400
|
+
blur() {
|
|
401
|
+
this.inputRef.current?.blur();
|
|
402
|
+
}
|
|
403
|
+
select() {
|
|
404
|
+
this.inputRef.current?.select();
|
|
405
|
+
}
|
|
406
|
+
render() {
|
|
407
|
+
const { placeholder, disabled, readOnly, className, style, name, id, autoFocus } = this.props;
|
|
408
|
+
return /* @__PURE__ */ jsx(
|
|
409
|
+
"input",
|
|
410
|
+
{
|
|
411
|
+
ref: this.inputRef,
|
|
412
|
+
type: "text",
|
|
413
|
+
inputMode: "decimal",
|
|
414
|
+
autoComplete: "off",
|
|
415
|
+
autoCorrect: "off",
|
|
416
|
+
spellCheck: false,
|
|
417
|
+
value: this.state.display,
|
|
418
|
+
placeholder,
|
|
419
|
+
disabled,
|
|
420
|
+
readOnly,
|
|
421
|
+
className,
|
|
422
|
+
style,
|
|
423
|
+
name,
|
|
424
|
+
id,
|
|
425
|
+
autoFocus,
|
|
426
|
+
onChange: this.handleChange,
|
|
427
|
+
onFocus: this.handleFocus,
|
|
428
|
+
onBlur: this.handleBlur,
|
|
429
|
+
onKeyDown: this.handleKeyDown,
|
|
430
|
+
onPaste: this.handlePaste
|
|
431
|
+
}
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
BigIntInput.defaultProps = {
|
|
436
|
+
showZero: false,
|
|
437
|
+
placeholder: "0",
|
|
438
|
+
format: { thousand: ",", decimal: "." },
|
|
439
|
+
allowNegative: false
|
|
440
|
+
};
|
|
441
|
+
export {
|
|
442
|
+
BigIntInput,
|
|
443
|
+
formatValue,
|
|
444
|
+
parseValue
|
|
445
|
+
};
|
|
446
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/BigIntInput.tsx","../src/utils.ts"],"sourcesContent":["import React, { Component, createRef } from 'react'\nimport { formatUnits, parseUnits, truncateDecimals, stripLeadingZeros, detectSeparators, escapeRegExp } from './utils'\n\nexport interface FormatConfig {\n /** Use Intl.NumberFormat with this locale for grouping (e.g. 'de-DE', 'en-IN') */\n locale?: string\n /** Thousands grouping character (e.g. ',' → 1,000) */\n thousand?: string\n /** Decimal point character (e.g. '.' → 1.5) */\n decimal?: string\n}\n\nexport interface BigIntInputProps {\n /** Current value as BigInt in smallest unit (e.g. wei) */\n value: bigint\n /** Token decimals (e.g. 18 for ETH, 6 for USDC) */\n decimals: number\n /** Fires when the BigInt value changes */\n onChange: (value: bigint) => void\n /** Maximum allowed value (clamped on input) */\n max?: bigint\n /** Minimum allowed value (clamped on input) */\n min?: bigint\n /** Number formatting — \"auto\" (browser locale), \"none\" (raw digits), or a config object */\n format?: FormatConfig | 'auto' | 'none'\n /** Allow negative values (default: false) */\n allowNegative?: boolean\n /** Render \"0\" instead of empty when value is 0n */\n showZero?: boolean\n /** Placeholder text */\n placeholder?: string\n /** Disable the input */\n disabled?: boolean\n /** Read-only mode */\n readOnly?: boolean\n /** CSS class name */\n className?: string\n /** Inline styles */\n style?: React.CSSProperties\n /** HTML name attribute */\n name?: string\n /** HTML id attribute */\n id?: string\n /** Auto-focus on mount */\n autoFocus?: boolean\n /** Focus callback */\n onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void\n /** Blur callback */\n onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void\n}\n\ninterface ResolvedFormat {\n thousand: string\n decimal: string\n}\n\ninterface BigIntInputState {\n display: string\n focused: boolean\n}\n\nexport class BigIntInput extends Component<BigIntInputProps, BigIntInputState> {\n private inputRef = createRef<HTMLInputElement>()\n private _resolvedFormat: ResolvedFormat | null = null\n private _intlFormatter: Intl.NumberFormat | null = null\n private _prevFormatProp: FormatConfig | 'auto' | 'none' | undefined = undefined\n private pendingCursor: number | null = null\n\n static defaultProps = {\n showZero: false,\n placeholder: '0',\n format: { thousand: ',', decimal: '.' },\n allowNegative: false,\n }\n\n constructor(props: BigIntInputProps) {\n super(props)\n this._prevFormatProp = props.format\n this.state = {\n display: this.valueToDisplay(props.value, props.decimals, props.showZero),\n focused: false,\n }\n }\n\n // --- Format helpers ---\n\n private get fmt(): ResolvedFormat {\n const { format } = this.props\n\n if (format === 'none') {\n return { thousand: '', decimal: '.' }\n }\n\n if (format === 'auto') {\n if (!this._resolvedFormat) {\n const detected = detectSeparators()\n this._resolvedFormat = { thousand: detected.thousands, decimal: detected.decimal }\n this._intlFormatter = new Intl.NumberFormat()\n }\n return this._resolvedFormat\n }\n\n if (typeof format === 'object') {\n // If locale is provided, use Intl for that locale\n if (format.locale) {\n if (!this._resolvedFormat) {\n const detected = detectSeparators(format.locale)\n this._resolvedFormat = {\n thousand: format.thousand ?? detected.thousands,\n decimal: format.decimal ?? detected.decimal,\n }\n this._intlFormatter = new Intl.NumberFormat(format.locale)\n }\n return this._resolvedFormat\n }\n\n return {\n thousand: format.thousand ?? ',',\n decimal: format.decimal ?? '.',\n }\n }\n\n return { thousand: ',', decimal: '.' }\n }\n\n private formatChanged(): boolean {\n const prev = this._prevFormatProp\n const curr = this.props.format\n\n if (typeof curr === 'object' && typeof prev === 'object') {\n return curr?.thousand !== prev?.thousand ||\n curr?.decimal !== prev?.decimal ||\n curr?.locale !== prev?.locale\n }\n return curr !== prev\n }\n\n private addThousands(value: string): string {\n const { thousand, decimal } = this.fmt\n\n if (!thousand) return decimal !== '.' ? value.replace('.', decimal) : value\n\n const isNegative = value.startsWith('-')\n const abs = isNegative ? value.slice(1) : value\n const parts = abs.split('.')\n\n if (this._intlFormatter && parts[0]) {\n try {\n parts[0] = this._intlFormatter.format(BigInt(parts[0]))\n } catch {\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousand)\n }\n } else {\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousand)\n }\n\n const formatted = parts.join(decimal)\n return isNegative ? `-${formatted}` : formatted\n }\n\n private removeThousands(value: string): string {\n const { thousand, decimal } = this.fmt\n let cleaned = value\n if (thousand) {\n cleaned = cleaned.replace(new RegExp(escapeRegExp(thousand), 'g'), '')\n }\n if (decimal !== '.') {\n cleaned = cleaned.replace(new RegExp(escapeRegExp(decimal), 'g'), '.')\n }\n return cleaned\n }\n\n // --- Cursor tracking ---\n\n private digitIndex(str: string, cursorPos: number): number {\n const { thousand } = this.fmt\n let count = 0\n for (let i = 0; i < cursorPos && i < str.length; i++) {\n if (str[i] !== thousand) count++\n }\n return count\n }\n\n private cursorFromDigitIndex(str: string, digitIdx: number): number {\n const { thousand } = this.fmt\n let count = 0\n for (let i = 0; i < str.length; i++) {\n if (str[i] !== thousand) {\n if (count === digitIdx) return i\n count++\n }\n }\n return str.length\n }\n\n // --- Formatting ---\n\n private valueToDisplay(value: bigint, decimals: number, showZero?: boolean): string {\n if (value === 0n && !showZero) return ''\n return this.addThousands(formatUnits(value, decimals))\n }\n\n private sanitize(input: string, decimals: number): string | null {\n if (!input) return ''\n if (input === '.') return decimals > 0 ? '0.' : null\n if (this.props.allowNegative && input === '-.') return decimals > 0 ? '-0.' : null\n\n let cleaned = this.props.allowNegative\n ? input.replace(/[^0-9.\\-]/g, '')\n : input.replace(/[^0-9.]/g, '')\n\n // Only allow one minus at the start\n if (this.props.allowNegative) {\n const hasMinus = cleaned.startsWith('-')\n cleaned = cleaned.replace(/-/g, '')\n if (hasMinus) cleaned = '-' + cleaned\n }\n\n const dotCount = (cleaned.match(/\\./g) || []).length\n if (dotCount > 1) {\n const firstDot = cleaned.indexOf('.')\n cleaned = cleaned.slice(0, firstDot + 1) + cleaned.slice(firstDot + 1).replace(/\\./g, '')\n }\n\n if (decimals === 0 && cleaned.includes('.')) {\n cleaned = cleaned.split('.')[0]\n }\n\n cleaned = truncateDecimals(cleaned, decimals)\n cleaned = stripLeadingZeros(cleaned)\n return cleaned\n }\n\n // --- Lifecycle ---\n\n componentDidUpdate(prevProps: BigIntInputProps, _prevState: BigIntInputState) {\n if (this.formatChanged()) {\n this._resolvedFormat = null\n this._intlFormatter = null\n this._prevFormatProp = this.props.format\n this.setState({\n display: this.valueToDisplay(this.props.value, this.props.decimals, this.props.showZero),\n })\n return\n }\n\n this._prevFormatProp = this.props.format\n\n if (this.pendingCursor !== null) {\n const cursor = this.pendingCursor\n this.pendingCursor = null\n const input = this.inputRef.current\n if (input) {\n requestAnimationFrame(() => input.setSelectionRange(cursor, cursor))\n }\n }\n\n const { value, decimals, showZero } = this.props\n\n if (decimals !== prevProps.decimals) {\n this.setState({ display: this.valueToDisplay(value, decimals, showZero) })\n return\n }\n\n if (value !== prevProps.value && !this.state.focused) {\n this.setState({ display: this.valueToDisplay(value, decimals, showZero) })\n }\n\n if (value !== prevProps.value && this.state.focused) {\n try {\n const parsed = parseUnits(this.removeThousands(this.state.display) || '0', decimals)\n if (parsed !== value) {\n this.setState({ display: this.valueToDisplay(value, decimals, showZero) })\n }\n } catch {\n this.setState({ display: this.valueToDisplay(value, decimals, showZero) })\n }\n }\n }\n\n // --- Event handlers ---\n\n private handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const raw = e.target.value\n const input = this.inputRef.current\n const cursorPos = e.target.selectionStart ?? raw.length\n const { decimals, onChange, max, min } = this.props\n\n const dIdx = this.digitIndex(raw, cursorPos)\n const normalized = this.removeThousands(raw)\n const sanitized = this.sanitize(normalized, decimals)\n if (sanitized === null) return\n\n const newDisplay = this.addThousands(sanitized)\n\n const prepended = sanitized.length - normalized.length\n const adjustedIdx = dIdx + Math.max(0, prepended)\n const newCursor = this.cursorFromDigitIndex(newDisplay, adjustedIdx)\n\n this.setState({ display: newDisplay }, () => {\n if (input) input.setSelectionRange(newCursor, newCursor)\n })\n\n try {\n let parsed = parseUnits(sanitized || '0', decimals)\n\n if (max !== undefined && parsed > max) {\n parsed = max\n const maxDisplay = this.valueToDisplay(max, decimals, true)\n this.setState({ display: maxDisplay }, () => {\n if (input) input.setSelectionRange(maxDisplay.length, maxDisplay.length)\n })\n }\n\n if (min !== undefined && parsed < min) {\n parsed = min\n const minDisplay = this.valueToDisplay(min, decimals, true)\n this.setState({ display: minDisplay }, () => {\n if (input) input.setSelectionRange(minDisplay.length, minDisplay.length)\n })\n }\n\n onChange(parsed)\n } catch {\n // Intermediate state (e.g. \"1.\") — don't fire onChange\n }\n }\n\n private handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n const { thousand } = this.fmt\n if (!thousand) return\n\n const input = e.currentTarget\n const pos = input.selectionStart\n const end = input.selectionEnd\n if (pos === null || end === null) return\n if (pos !== end) return\n\n const val = input.value\n\n if (e.key === 'Backspace' && pos > 1 && val[pos - 1] === thousand) {\n e.preventDefault()\n const stripped = this.removeThousands(val)\n const digitIdx = this.digitIndex(val, pos - 2)\n const newStripped = stripped.slice(0, digitIdx) + stripped.slice(digitIdx + 1)\n const sanitized = this.sanitize(newStripped, this.props.decimals) ?? ''\n const newDisplay = this.addThousands(sanitized)\n this.pendingCursor = this.cursorFromDigitIndex(newDisplay, digitIdx)\n this.setState({ display: newDisplay })\n try { this.props.onChange(parseUnits(sanitized || '0', this.props.decimals)) } catch {}\n }\n\n if (e.key === 'Delete' && pos < val.length - 1 && val[pos] === thousand) {\n e.preventDefault()\n const stripped = this.removeThousands(val)\n const digitIdx = this.digitIndex(val, pos)\n const newStripped = stripped.slice(0, digitIdx) + stripped.slice(digitIdx + 1)\n const sanitized = this.sanitize(newStripped, this.props.decimals) ?? ''\n const newDisplay = this.addThousands(sanitized)\n this.pendingCursor = this.cursorFromDigitIndex(newDisplay, digitIdx)\n this.setState({ display: newDisplay })\n try { this.props.onChange(parseUnits(sanitized || '0', this.props.decimals)) } catch {}\n }\n }\n\n private handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n this.setState({ focused: true })\n this.props.onFocus?.(e)\n }\n\n private handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n const { value, decimals, showZero } = this.props\n this.setState({ focused: false, display: this.valueToDisplay(value, decimals, showZero) })\n this.props.onBlur?.(e)\n }\n\n private handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n const pasted = e.clipboardData.getData('text')\n const { thousand, decimal } = this.fmt\n const escapedDecimal = escapeRegExp(decimal)\n const escapedThousand = thousand ? escapeRegExp(thousand) : ''\n const minus = this.props.allowNegative ? '\\\\-' : ''\n const allowed = new RegExp(`^[\\\\d${escapedDecimal}${escapedThousand}${minus}]+$`)\n if (pasted && !allowed.test(pasted.trim())) {\n e.preventDefault()\n }\n }\n\n // --- Public API ---\n\n public focus() { this.inputRef.current?.focus() }\n public blur() { this.inputRef.current?.blur() }\n public select() { this.inputRef.current?.select() }\n\n render() {\n const { placeholder, disabled, readOnly, className, style, name, id, autoFocus } = this.props\n\n return (\n <input\n ref={this.inputRef}\n type=\"text\"\n inputMode=\"decimal\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n spellCheck={false}\n value={this.state.display}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n className={className}\n style={style}\n name={name}\n id={id}\n autoFocus={autoFocus}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n onKeyDown={this.handleKeyDown}\n onPaste={this.handlePaste}\n />\n )\n }\n}\n","/**\n * Detect thousands and decimal separators from the browser locale.\n */\nexport function detectSeparators(locale?: string): { thousands: string; decimal: string } {\n const parts = new Intl.NumberFormat(locale).formatToParts(1234567.89)\n let thousands = ','\n let decimal = '.'\n for (const part of parts) {\n if (part.type === 'group') thousands = part.value\n if (part.type === 'decimal') decimal = part.value\n }\n return { thousands, decimal }\n}\n\n/**\n * Format a BigInt value into a canonical decimal string (always uses '.' as decimal).\n *\n * formatUnits(1500000n, 6) → \"1.5\"\n * formatUnits(0n, 18) → \"0\"\n */\nexport function formatUnits(value: bigint, decimals: number): string {\n if (decimals === 0) return value.toString()\n\n const isNegative = value < 0n\n const abs = isNegative ? -value : value\n const str = abs.toString().padStart(decimals + 1, '0')\n const intPart = str.slice(0, str.length - decimals)\n const fracPart = str.slice(str.length - decimals).replace(/0+$/, '')\n\n const formatted = fracPart ? `${intPart}.${fracPart}` : intPart\n return isNegative ? `-${formatted}` : formatted\n}\n\n/**\n * Parse a canonical decimal string into a BigInt value.\n * Expects '.' as decimal separator.\n *\n * parseUnits(\"1.5\", 6) → 1500000n\n * parseUnits(\"1\", 18) → 1000000000000000000n\n */\nexport function parseUnits(value: string, decimals: number): bigint {\n if (!value || value === '.' || value === '-' || value === '-.') return 0n\n\n const isNegative = value.startsWith('-')\n const unsigned = isNegative ? value.slice(1) : value\n const [intPart = '0', fracPart = ''] = unsigned.split('.')\n\n if (fracPart.length > decimals) {\n throw new Error(\n `Fractional component exceeds decimals (${fracPart.length} > ${decimals})`\n )\n }\n\n const paddedFrac = fracPart.padEnd(decimals, '0')\n const combined = intPart + paddedFrac\n const trimmed = combined.replace(/^0+/, '') || '0'\n const result = BigInt(trimmed)\n return isNegative ? -result : result\n}\n\n/** Truncate a decimal string to a max number of decimal places (no rounding). */\nexport function truncateDecimals(value: string, maxDecimals: number): string {\n const dotIndex = value.indexOf('.')\n if (dotIndex === -1) return value\n if (maxDecimals === 0) return value.slice(0, dotIndex)\n return value.slice(0, dotIndex + 1 + maxDecimals)\n}\n\n/** Strip unnecessary leading zeros from a numeric string. */\nexport function stripLeadingZeros(value: string): string {\n if (!value) return value\n\n const isNegative = value.startsWith('-')\n const abs = isNegative ? value.slice(1) : value\n\n const dotIndex = abs.indexOf('.')\n let cleaned: string\n if (dotIndex > 0) {\n const intPart = abs.slice(0, dotIndex).replace(/^0+/, '') || '0'\n cleaned = intPart + abs.slice(dotIndex)\n } else {\n cleaned = abs.replace(/^0+/, '') || '0'\n }\n\n return isNegative ? `-${cleaned}` : cleaned\n}\n\n/**\n * Format a BigInt value with thousands/decimal separators.\n *\n * formatValue(1500000n, 6) → \"1.5\"\n * formatValue(1234567890n, 6) → \"1,234.56789\"\n * formatValue(1234567890n, 6, { locale: 'de-DE' }) → \"1.234,56789\"\n * formatValue(1234567890n, 6, 'none') → \"1234.56789\"\n */\nexport function formatValue(\n value: bigint,\n decimals: number,\n format?: { locale?: string; thousand?: string; decimal?: string } | 'auto' | 'none'\n): string {\n const raw = formatUnits(value, decimals)\n\n if (format === 'none') return raw\n\n let thousand: string\n let decimal: string\n let intlFormatter: Intl.NumberFormat | null = null\n\n if (format === 'auto') {\n const detected = detectSeparators()\n thousand = detected.thousands\n decimal = detected.decimal\n intlFormatter = new Intl.NumberFormat()\n } else if (typeof format === 'object' && format.locale) {\n const detected = detectSeparators(format.locale)\n thousand = format.thousand ?? detected.thousands\n decimal = format.decimal ?? detected.decimal\n intlFormatter = new Intl.NumberFormat(format.locale)\n } else {\n thousand = format?.thousand ?? ','\n decimal = format?.decimal ?? '.'\n }\n\n if (!thousand) return decimal !== '.' ? raw.replace('.', decimal) : raw\n\n const isNegative = raw.startsWith('-')\n const abs = isNegative ? raw.slice(1) : raw\n const parts = abs.split('.')\n\n if (intlFormatter && parts[0]) {\n try {\n parts[0] = intlFormatter.format(BigInt(parts[0]))\n } catch {\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousand)\n }\n } else {\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousand)\n }\n\n const formatted = parts.join(decimal)\n return isNegative ? `-${formatted}` : formatted\n}\n\n/**\n * Parse a formatted string back into a BigInt value.\n *\n * parseValue(\"1,500.50\", 6) → 1500500000n\n * parseValue(\"1.500,50\", 6, { locale: 'de-DE' }) → 1500500000n\n * parseValue(\"1500\", 6, 'none') → 1500000000n\n * parseValue(\"1,00,000\", 6, { locale: 'en-IN' }) → 100000000000n\n */\nexport function parseValue(\n value: string,\n decimals: number,\n format?: { locale?: string; thousand?: string; decimal?: string } | 'auto' | 'none'\n): bigint {\n if (!value) return 0n\n\n let thousand: string\n let decimal: string\n\n if (format === 'none') {\n thousand = ''\n decimal = '.'\n } else if (format === 'auto') {\n const detected = detectSeparators()\n thousand = detected.thousands\n decimal = detected.decimal\n } else if (typeof format === 'object' && format.locale) {\n const detected = detectSeparators(format.locale)\n thousand = format.thousand ?? detected.thousands\n decimal = format.decimal ?? detected.decimal\n } else {\n thousand = format?.thousand ?? ','\n decimal = format?.decimal ?? '.'\n }\n\n let cleaned = value\n if (thousand) {\n cleaned = cleaned.replace(new RegExp(escapeRegExp(thousand), 'g'), '')\n }\n if (decimal !== '.') {\n cleaned = cleaned.replace(new RegExp(escapeRegExp(decimal), 'g'), '.')\n }\n\n return parseUnits(cleaned, decimals)\n}\n\n/** Escape special regex characters in a string. */\nex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S,KAAK,eAAe,OAAO,UAAU,QAAQ,EAAE,CAAC;AAAA,QAC7E;AAAA,MACJ,QAAQ;AACJ,aAAK,SAAS,EAAE,SAAS,KAAK,eAAe,OAAO,UAAU,QAAQ,EAAE,CAAC;AAAA,MAC7E;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA,EAgHO,QAAQ;AAAE,SAAK,SAAS,SAAS,MAAM;AAAA,EAAE;AAAA,EACzC,OAAO;AAAE,SAAK,SAAS,SAAS,KAAK;AAAA,EAAE;AAAA,EACvC,SAAS;AAAE,SAAK,SAAS,SAAS,OAAO;AAAA,EAAE;AAAA,EAElD,SAAS;AACL,UAAM,EAAE,aAAa,UAAU,UAAU,WAAW,OAAO,MAAM,IAAI,UAAU,IAAI,KAAK;AAExF,WACI;AAAA,MAAC;AAAA;AAAA,QACG,KAAK,KAAK;AAAA,QACV,MAAK;AAAA,QACL,WAAU;AAAA,QACV,cAAa;AAAA,QACb,aAAY;AAAA,QACZ,YAAY;AAAA,QACZ,OAAO,KAAK,MAAM;AAAA,QAClB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU,KAAK;AAAA,QACf,SAAS,KAAK;AAAA,QACd,QAAQ,KAAK;AAAA,QACb,WAAW,KAAK;AAAA,QAChB,SAAS,KAAK;AAAA;AAAA,IAClB;AAAA,EAER;AACJ;AAzWa,YAOF,eAAe;AAAA,EAClB,UAAU;AAAA,EACV,aAAa;AAAA,EACb,QAAQ,EAAE,UAAU,KAAK,SAAS,IAAI;AAAA,EACtC,eAAe;AACnB;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-bigint-input",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A React input component for BigInt values with decimal formatting. Built for crypto/DeFi apps.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsup",
|
|
20
|
+
"dev": "tsup --watch",
|
|
21
|
+
"example": "npx vite example",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"lint": "tsc --noEmit",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"react",
|
|
28
|
+
"bigint",
|
|
29
|
+
"input",
|
|
30
|
+
"ethereum",
|
|
31
|
+
"web3",
|
|
32
|
+
"defi",
|
|
33
|
+
"crypto",
|
|
34
|
+
"decimals",
|
|
35
|
+
"token",
|
|
36
|
+
"swap"
|
|
37
|
+
],
|
|
38
|
+
"author": "0x7361746f736869",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/0x7361746f736869/react-bigint-input.git"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": ">=17.0.0",
|
|
46
|
+
"react-dom": ">=17.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/react": "^19.0.0",
|
|
50
|
+
"react": "^19.0.0",
|
|
51
|
+
"react-dom": "^19.0.0",
|
|
52
|
+
"tsup": "^8.3.0",
|
|
53
|
+
"typescript": "^5.7.0",
|
|
54
|
+
"vitest": "^4.0.18"
|
|
55
|
+
}
|
|
56
|
+
}
|