import { Send } from 'lucide-react'; import { MESSAGE_MAX_LENGTH } from '../../constants'; /** * Chat Input component with send button and character counter * * @param {string} value - Input value * @param {function} onChange - Change handler for input * @param {function} onSubmit - Submit handler for form * @param {boolean} disabled - Whether input is disabled (e.g., when not connected) * @param {string} placeholder - Placeholder text (default: "Write a message...") * @param {string} className - Additional classes for the form * @param {boolean} autoFocus - Whether to autofocus the input */ const ChatInput = ({ value, onChange, onSubmit, disabled = false, placeholder = 'Write a message...', className = '', autoFocus = false }) => { const handleSubmit = (e) => { e.preventDefault(); if (!value.trim() || disabled) return; onSubmit(e); }; const charCount = value.length; const isNearLimit = charCount > MESSAGE_MAX_LENGTH * 0.8; // 80% of limit const isOverLimit = charCount > MESSAGE_MAX_LENGTH; return (