Skip to content

Commit

Permalink
fix: number input regex not allowing "-" sign (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
RakeshUP authored Oct 9, 2023
1 parent 696053d commit d7ef0dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- mobile pagination

### Fixed

- Fix incorrect regex on Number Input that prevents "-" sign from being entered

## [0.2.18] - 2023-09-29

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/components/input/numberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const NumberInput: React.FC<NumberInputProps> = ({
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
// this handles pasting in the value/ could also use onPaste event
if (!includeDecimal) {
event.target.value = event.target.value.replace(/[^0-9]/g, '');
event.target.value = event.target.value.replace(/[^-0-9]/g, '');
}

onChange?.(event);
Expand Down

0 comments on commit d7ef0dc

Please sign in to comment.