import type { FormEvent, ReactNode, Ref } from "react"; import Button from "./Button"; import InsetPanel from "./InsetPanel"; import TextInput from "./TextInput"; import { cx } from "./cx"; interface InlineComposerProps { label: ReactNode; value: string; onChange: (value: string) => void; onSubmit: () => void; placeholder?: string; hint?: ReactNode; error?: ReactNode; submitLabel: ReactNode; disabled?: boolean; inputId: string; inputRef?: Ref; className?: string; action?: ReactNode; } export default function InlineComposer({ label, value, onChange, onSubmit, placeholder, hint, error, submitLabel, disabled = false, inputId, inputRef, className, action, }: InlineComposerProps) { return ( { event.preventDefault(); onSubmit(); }} >
onChange(event.target.value)} placeholder={placeholder} disabled={disabled} className="flex-1" /> {action ?? ( )}
{hint ?
{hint}
: null} {error ? (
{error}
) : null}
); }