From 73452d78f22a0ef9ea820ff3c1718a44d549a066 Mon Sep 17 00:00:00 2001 From: gustavogoncalves1996 <36679243+gustavogoncalves1996@users.noreply.github.com> Date: Thu, 3 Oct 2024 09:31:03 +0100 Subject: [PATCH 1/2] Update number_format_base.tsx --- src/number_format_base.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/number_format_base.tsx b/src/number_format_base.tsx index 64f1287..c80d357 100644 --- a/src/number_format_base.tsx +++ b/src/number_format_base.tsx @@ -154,9 +154,9 @@ export default function NumberFormatBase( inputValue?: string; input?: HTMLInputElement | null; event?: - | React.ChangeEvent - | React.FocusEvent - | React.KeyboardEvent; + | React.ChangeEvent + | React.FocusEvent + | React.KeyboardEvent; source: SourceType; }) => { const { formattedValue: newFormattedValue = '', input, source, event, numAsString } = params; @@ -432,6 +432,7 @@ export default function NumberFormatBase( onMouseUp: _onMouseUp, onFocus: _onFocus, onBlur: _onBlur, + pattern: /[^0-9,.]/, }); if (displayType === 'text') { From f333a1fda271bd8dded048805454791c2d87a668 Mon Sep 17 00:00:00 2001 From: gustavogoncalves1996 <36679243+gustavogoncalves1996@users.noreply.github.com> Date: Thu, 3 Oct 2024 09:31:55 +0100 Subject: [PATCH 2/2] Update numeric_format.tsx --- src/numeric_format.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/numeric_format.tsx b/src/numeric_format.tsx index fd1281a..38a3b40 100644 --- a/src/numeric_format.tsx +++ b/src/numeric_format.tsx @@ -561,6 +561,7 @@ export function useNumericFormat( getCaretBoundary: (formattedValue: string) => getCaretBoundary(formattedValue, props), onKeyDown: _onKeyDown, onBlur: _onBlur, + pattern: /[^0-9,.]/, }; }