diff --git a/packages/design-system/src/components/TextField/TextField.tsx b/packages/design-system/src/components/TextField/TextField.tsx index fc5be331..e1671e9b 100644 --- a/packages/design-system/src/components/TextField/TextField.tsx +++ b/packages/design-system/src/components/TextField/TextField.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { forwardRef } from "react"; import TextFieldIcon from "./TextFieldIcon"; import { BaseTextField } from "./TextField.style"; @@ -9,57 +9,60 @@ import type { SingleTextFieldProps, } from "./TextField.types"; -const SingleTextField = (props: SingleTextFieldProps) => { - const { - size = "small", - leftIcon, - rightIcon, - leftIconSx, - rightIconSx, - onLeftIconClick, - onRightIconClick, - InputProps, - ...restProps - } = props; +const SingleTextField = forwardRef( + (props, ref) => { + const { + size = "small", + leftIcon, + rightIcon, + leftIconSx, + rightIconSx, + onLeftIconClick, + onRightIconClick, + InputProps, + ...restProps + } = props; - return ( - - ), - endAdornment: rightIcon && ( - - ), - }, - ...InputProps, - }} - /> - ); -}; + return ( + + ), + endAdornment: rightIcon && ( + + ), + }, + ...InputProps, + }} + /> + ); + } +); -const MultiTextField = ({ - size = "small", - onChange, - ...restProps -}: MultiTextFieldProps) => { - return ; -}; +const MultiTextField = forwardRef( + ({ size = "small", onChange, ...restProps }, ref) => { + return ( + + ); + } +); -const TextField = (props: TextFieldProps) => { +const TextField = forwardRef((props, ref) => { const { rows, size, @@ -71,14 +74,15 @@ const TextField = (props: TextFieldProps) => { return multiline ? ( ) : ( - + ); -}; +}); export default TextField;