import React, { type ReactNode } from 'react'; import { Pressable, Text, View } from 'react-native'; import { ChevronRight, type LucideIcon } from 'lucide-react-native'; import { themedColor } from '../../theme'; import type { ToolWidgetStatus } from '../toolWidgetUtils'; import { StatusIcon } from './StatusIcon'; import { toolWidgetStyles } from './toolWidgetStyles'; // The header row every tool widget starts with — native analog of the web ToolUIBase. export function ToolWidgetRow({ accessibilityLabel, action, chipText, children, expanded, failureText, icon, note, onPress, onToggle, status, title, }: { accessibilityLabel?: string; /** Right-aligned control in the header row (e.g. the artifact fullscreen button). */ action?: ReactNode; chipText?: string | null; children?: ReactNode; expanded?: boolean; failureText?: string | null; icon: LucideIcon; note?: string | null; onPress?: () => void; onToggle?: () => void; status: ToolWidgetStatus; title: string; }) { const canPress = Boolean(onPress || onToggle); return ( {/* The action sits OUTSIDE the toggle Pressable so it stays tappable when the row has no toggle (a disabled parent must never gate it). */} {title} {chipText ? ( {chipText} ) : null} {note ? {note} : null} {canPress ? ( ) : null} {action ? {action} : null} {failureText ? ( {failureText} ) : null} {expanded && children ? {children} : null} ); }