import { cn } from "@/lib/utils" import { FC } from "react" import ReactTextareaAutosize from "react-textarea-autosize" interface TextareaAutosizeProps { value: string onValueChange: (value: string) => void textareaRef?: React.RefObject className?: string placeholder?: string minRows?: number maxRows?: number maxLength?: number onKeyDown?: (event: React.KeyboardEvent) => void onPaste?: (event: React.ClipboardEvent) => void onCompositionStart?: (event: React.CompositionEvent) => void onCompositionEnd?: (event: React.CompositionEvent) => void } export const TextareaAutosize: FC = ({ value, onValueChange, textareaRef, className, placeholder = "", minRows = 1, maxRows = 6, maxLength, onKeyDown = () => {}, onPaste = () => {}, onCompositionStart = () => {}, onCompositionEnd = () => {} }) => { return ( maxRows ? minRows : maxRows} placeholder={placeholder} value={value} maxLength={maxLength} onChange={event => onValueChange(event.target.value)} onKeyDown={onKeyDown} onPaste={onPaste} onCompositionStart={onCompositionStart} onCompositionEnd={onCompositionEnd} /> ) }