From e759f13b8e5a4853e304b452a611c4cf54152a51 Mon Sep 17 00:00:00 2001 From: amitbadala Date: Fri, 27 Oct 2023 16:38:25 +0530 Subject: [PATCH] Reverting onChange changes --- lib/build/emailpassword-shared7.js | 13 ++++++------- .../emailpassword/components/library/input.d.ts | 2 +- .../emailpassword/components/library/formBase.tsx | 4 ++-- .../emailpassword/components/library/input.tsx | 7 +++++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/build/emailpassword-shared7.js b/lib/build/emailpassword-shared7.js index d1db6600f..f726a9ba2 100644 --- a/lib/build/emailpassword-shared7.js +++ b/lib/build/emailpassword-shared7.js @@ -336,7 +336,10 @@ var Input = function (_a) { } function handleChange(event) { if (onChange) { - onChange(event.target.value); + onChange({ + id: name, + value: event.target.value, + }); } } if (autoComplete === undefined) { @@ -749,9 +752,7 @@ var FormBase = function (props) { autofocus: field.autofocus, onInputFocus: onInputFocus, onInputBlur: onInputBlur, - onChange: function (value) { - return onInputChange({ id: field.id, value: value }); - }, + onChange: onInputChange, hasError: fstate.error !== undefined, }) : jsxRuntime.jsx(Input, { @@ -763,9 +764,7 @@ var FormBase = function (props) { autoComplete: field.autoComplete, onInputFocus: onInputFocus, onInputBlur: onInputBlur, - onChange: function (value) { - return onInputChange({ id: field.id, value: value }); - }, + onChange: onInputChange, autofocus: field.autofocus, hasError: fstate.error !== undefined, }), diff --git a/lib/build/recipe/emailpassword/components/library/input.d.ts b/lib/build/recipe/emailpassword/components/library/input.d.ts index a9d8890e2..44893e14a 100644 --- a/lib/build/recipe/emailpassword/components/library/input.d.ts +++ b/lib/build/recipe/emailpassword/components/library/input.d.ts @@ -11,7 +11,7 @@ export declare type InputProps = { value: string; onInputBlur?: (field: APIFormField) => void; onInputFocus?: (field: APIFormField) => void; - onChange?: (value: string) => void; + onChange?: (field: APIFormField) => void; }; declare const Input: React.FC; export default Input; diff --git a/lib/ts/recipe/emailpassword/components/library/formBase.tsx b/lib/ts/recipe/emailpassword/components/library/formBase.tsx index 964ebed21..0b84616a7 100644 --- a/lib/ts/recipe/emailpassword/components/library/formBase.tsx +++ b/lib/ts/recipe/emailpassword/components/library/formBase.tsx @@ -252,7 +252,7 @@ export const FormBase: React.FC> = (props) => { autofocus={field.autofocus} onInputFocus={onInputFocus} onInputBlur={onInputBlur} - onChange={(value) => onInputChange({ id: field.id, value: value })} + onChange={onInputChange} hasError={fstate.error !== undefined} /> ) : ( @@ -265,7 +265,7 @@ export const FormBase: React.FC> = (props) => { autoComplete={field.autoComplete} onInputFocus={onInputFocus} onInputBlur={onInputBlur} - onChange={(value) => onInputChange({ id: field.id, value: value })} + onChange={onInputChange} autofocus={field.autofocus} hasError={fstate.error !== undefined} /> diff --git a/lib/ts/recipe/emailpassword/components/library/input.tsx b/lib/ts/recipe/emailpassword/components/library/input.tsx index a72cea67d..70f34f331 100644 --- a/lib/ts/recipe/emailpassword/components/library/input.tsx +++ b/lib/ts/recipe/emailpassword/components/library/input.tsx @@ -34,7 +34,7 @@ export type InputProps = { value: string; onInputBlur?: (field: APIFormField) => void; onInputFocus?: (field: APIFormField) => void; - onChange?: (value: string) => void; + onChange?: (field: APIFormField) => void; }; const Input: React.FC = ({ @@ -77,7 +77,10 @@ const Input: React.FC = ({ function handleChange(event: ChangeEvent) { if (onChange) { - onChange(event.target.value); + onChange({ + id: name, + value: event.target.value, + }); } }