import React, { useState } from "react"; export default function TextArea({ defaultValue, required = true, placeholder = "Place your text here...", onChange, name = "text-area", disabled = false, initialRows = 5, className = "", autoComplete = "off", wrap = "soft", }) { const [rows, setRows] = useState(initialRows); const handleChange = (e) => { if (onChange) { onChange(e); } // Dynamically adjust rows const textareaLineHeight = 24; const previousRows = e.target.rows; e.target.rows = initialRows; const currentRows = ~~(e.target.scrollHeight / textareaLineHeight); if (currentRows === previousRows) { e.target.rows = currentRows; } if (e.target.scrollHeight > e.target.clientHeight) { e.target.rows = currentRows; } setRows(currentRows); }; return (