Skip to content

Commit

Permalink
feat(input): typo
Browse files Browse the repository at this point in the history
  • Loading branch information
fulcanellee committed Nov 8, 2024
1 parent a91ccf0 commit 7eb34cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/input/src/components/base-input/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ export const BaseInput = React.forwardRef<HTMLInputElement, BaseInputProps>(
(event: React.ChangeEvent<HTMLInputElement>) => {
let inputValue = event.target.value;
const target = event.target as HTMLInputElement;
const inInputTypeNumber = target.getAttribute('type') === 'number';
const isInputTypeNumber = target.getAttribute('type') === 'number';
const pattern = /[eE]/g;

if (inInputTypeNumber && pattern.test(inputValue)) {
if (isInputTypeNumber && pattern.test(inputValue)) {
inputValue = inputValue.replace(pattern, '');
}

Expand All @@ -340,9 +340,9 @@ export const BaseInput = React.forwardRef<HTMLInputElement, BaseInputProps>(
*/
const { key, target } = event;
const eventTarget = target as HTMLInputElement;
const inInputTypeNumber = eventTarget.getAttribute('type') === 'number';
const isInputTypeNumber = eventTarget.getAttribute('type') === 'number';

if (inInputTypeNumber && (key === 'e' || key === 'E')) {
if (isInputTypeNumber && (key === 'e' || key === 'E')) {
event.preventDefault();

return;
Expand Down

0 comments on commit 7eb34cd

Please sign in to comment.