import { useId, useState } from "react"; import { cn } from "../../lib/utils"; /** * Long error text clamped to a few lines with a toggle to reveal the rest. * Short single-line text renders as-is without the toggle. */ export function ExpandableText({ text, className, collapsedClassName = "line-clamp-3", expandLabel = "Show full error", }: { text: string; className?: string; collapsedClassName?: string; expandLabel?: string; }) { const textId = useId(); const [expanded, setExpanded] = useState(false); const canExpand = text.length > 180 || text.includes("\n"); return (