import React, { forwardRef } from "react"; import { calHeight, StyledInput } from "./styles"; import { useTheme } from '@mui/material/styles'; import Input from '@mui/material/Input'; import { Box, makeStyles, TextField } from "@mui/material"; import InputAdornment from "@mui/material/InputAdornment"; interface FormInputProps { type?: React.HTMLInputTypeAttribute, size?: "small" | "medium", variant?: "outlined" | "filled" | "standard", name?: string, value?: any, placeholder?: string, disabled?: boolean, readonly?:any, onChange?: (event: React.ChangeEvent) => void, onFocus?: (event: React.FocusEvent) => void, onBlur?: (event: React.FocusEvent) => void, innerRef?: React.RefObject, startIcon?: React.ReactSVGElement | React.ReactNode, endIcon?: React.ReactSVGElement | React.ReactNode, sx?:any, error?:boolean } const FormInput = forwardRef((props: FormInputProps, ref) => { const theme = useTheme(); const { type = "text", size = "small", variant = "outlined", name, value, placeholder, disabled = false, onChange, onBlur, onFocus, readonly, innerRef, sx, error, startIcon = null, endIcon = null } = props; const height = calHeight(size) return ( {startIcon}, endAdornment: {endIcon} }} {...{ type, name, value, placeholder, disabled, onChange, onFocus, readonly, onBlur }} /> ) }) export default FormInput;