From 72aba9d523045c1c6d288146f5e2ab311e1037d4 Mon Sep 17 00:00:00 2001 From: adibmbrk Date: Wed, 5 Feb 2025 20:46:00 +0530 Subject: [PATCH 1/2] fix(react): fix `TextField` component to set endAdornment conditionally --- packages/react/src/components/TextField/TextField.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/react/src/components/TextField/TextField.tsx b/packages/react/src/components/TextField/TextField.tsx index 8a47a429..79d9de86 100644 --- a/packages/react/src/components/TextField/TextField.tsx +++ b/packages/react/src/components/TextField/TextField.tsx @@ -56,7 +56,7 @@ export type TextFieldProps = { const PasswordField: ForwardRefExoticComponent = forwardRef( ( - {type, variant, ...rest}: TextFieldProps, + {type, variant, InputProps = {}, ...rest}: TextFieldProps, ref: Ref, ): ReactElement => { const [showPassword, setShowPassword] = useState(false); @@ -72,7 +72,8 @@ const PasswordField: ForwardRefExoticComponent = forwardRef( ref={ref} type={showPassword ? 'text' : 'password'} InputProps={{ - endAdornment: ( + ...InputProps, + endAdornment: InputProps.endAdornment || ( Date: Fri, 7 Feb 2025 14:14:02 +0530 Subject: [PATCH 2/2] chore: refactor input props in `PasswordField` --- packages/react/src/components/TextField/TextField.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react/src/components/TextField/TextField.tsx b/packages/react/src/components/TextField/TextField.tsx index 79d9de86..a30bfff3 100644 --- a/packages/react/src/components/TextField/TextField.tsx +++ b/packages/react/src/components/TextField/TextField.tsx @@ -56,7 +56,7 @@ export type TextFieldProps = { const PasswordField: ForwardRefExoticComponent = forwardRef( ( - {type, variant, InputProps = {}, ...rest}: TextFieldProps, + {type, variant, InputProps, ...rest}: TextFieldProps, ref: Ref, ): ReactElement => { const [showPassword, setShowPassword] = useState(false); @@ -72,8 +72,8 @@ const PasswordField: ForwardRefExoticComponent = forwardRef( ref={ref} type={showPassword ? 'text' : 'password'} InputProps={{ - ...InputProps, - endAdornment: InputProps.endAdornment || ( + ...(InputProps ?? {}), + endAdornment: InputProps?.endAdornment || (