"use client"; import type { ChatStatus } from "ai"; import { ArrowUp, Building2, CalendarRange, ChevronDown, Hand, Mic, Plus, Square, Stethoscope, } from "lucide-react"; import { type KeyboardEvent, useCallback, useState } from "react"; import { cn } from "@/lib/utils"; type ChatInputProps = { onSubmit: (text: string) => void; status: ChatStatus; onStop?: () => void; }; const iconButton = "flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"; const pillButton = "flex h-8 items-center gap-1.5 rounded-lg px-2 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"; const contextPill = "flex h-7 items-center gap-1.5 rounded-md px-2 text-[13px] text-muted-foreground transition-colors hover:bg-foreground/5 hover:text-foreground"; export function ChatInput({ onSubmit, status, onStop }: ChatInputProps) { const [value, setValue] = useState(""); const isGenerating = status === "submitted" || status === "streaming"; const canSend = value.trim().length > 0 && !isGenerating; const submit = useCallback(() => { const trimmed = value.trim(); if (!trimmed || isGenerating) { return; } onSubmit(trimmed); setValue(""); }, [value, isGenerating, onSubmit]); const handleKeyDown = useCallback( (event: KeyboardEvent) => { if ( event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing ) { event.preventDefault(); submit(); } }, [submit] ); return (
{ event.preventDefault(); submit(); }} className="w-full overflow-hidden rounded-[28px] border border-border/60 bg-[oklch(0.172_0.006_277)] shadow-sm" > {/* Top (lighter) card: textarea + toolbar, with a slightly smaller bottom radius */}