Skip to content

Commit

Permalink
Remove 2 digit decimal restriction on number input
Browse files Browse the repository at this point in the history
  • Loading branch information
calebjacob committed Jul 31, 2024
1 parent 2d03d79 commit 15823f1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-pagoda/ui",
"version": "0.2.4",
"version": "0.2.5",
"description": "A React component library that implements the official NEAR design system.",
"license": "MIT",
"repository": {
Expand Down
9 changes: 0 additions & 9 deletions src/utils/input-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ export function numberInputHandler(
validCharacters.substring(0, indexOfDecimal) + '.' + validCharacters.substring(indexOfDecimal).replace(/\./g, '');
}

if (allowDecimal && validCharacters.includes('.')) {
// Ensures only 2 decimal digits
const indexOfDecimal = validCharacters.indexOf('.');
validCharacters =
validCharacters.substring(0, indexOfDecimal) +
'.' +
validCharacters.substring(indexOfDecimal, indexOfDecimal + 3).replace(/\./g, '');
}

if (validCharacters !== event.currentTarget.value) {
event.currentTarget.value = validCharacters;
}
Expand Down

0 comments on commit 15823f1

Please sign in to comment.