import { useId, useState, type ReactNode } from "react"; import { Activity } from "lucide-react"; import { cn } from "@/lib/utils"; interface ThinkingReasoningShellProps { active: boolean; expanded: boolean; contextual?: boolean; showHeader?: boolean; collapseLabel?: string; contentId?: string; label: string; children: ReactNode; hasDetails?: boolean; onToggle: () => void; } export function ThinkingReasoningShell({ active, expanded, contextual = false, showHeader = true, collapseLabel, contentId: providedContentId, label, children, hasDetails = true, onToggle, }: ThinkingReasoningShellProps) { const generatedContentId = useId(); const contentId = providedContentId ?? generatedContentId; const [hasExpanded, setHasExpanded] = useState(expanded); if (expanded && !hasExpanded) setHasExpanded(true); const headerClassName = "touch-target inline-flex h-7 min-w-0 items-center gap-1.5 rounded-md px-1.5"; const headerContent = ( <> {active ? : null} {label} ); return (
{showHeader ?
{hasDetails ? ( ) : (
{headerContent}
)}
: null} {hasDetails ? (
{expanded ? ( ) : null}
{hasExpanded ? children : null}
) : null}
); }