/** * InputBar — message input with send button. */ import { useState, useRef, useId } from '@wordpress/element'; const InputBar = ( { onSend, disabled, maxLength, placeholder } ) => { const [ text, setText ] = useState( '' ); const inputRef = useRef(); const fieldId = useId(); const handleSend = () => { const trimmed = text.trim(); if ( ! trimmed || disabled ) return; onSend( trimmed ); setText( '' ); inputRef.current?.focus(); }; const handleKeyDown = ( e ) => { if ( e.key === 'Enter' && ! e.shiftKey ) { e.preventDefault(); handleSend(); } }; return (