{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "follow-up-suggestions",
  "type": "registry:component",
  "title": "Follow-up Suggestions",
  "description": "Horizontal suggestion chip row with edge fades.",
  "files": [
    {
      "path": "registry/tonic/follow-up-suggestions/follow-up-suggestions.tsx",
      "content": "\"use client\"\n\nimport { useCallback, useEffect, useRef, useState } from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport type FollowUpSuggestion = {\n  prompt: string\n  title?: string\n  label?: string\n}\n\nexport function FollowUpSuggestions({\n  suggestions,\n  onSelect,\n  className,\n}: {\n  suggestions: readonly FollowUpSuggestion[]\n  onSelect?: (prompt: string) => void\n  className?: string\n}) {\n  const scrollRef = useRef<HTMLDivElement>(null)\n  const rtlRef = useRef<boolean | null>(null)\n  const [fades, setFades] = useState({ left: false, right: false })\n\n  const updateFades = useCallback(() => {\n    const el = scrollRef.current\n    if (!el) return\n    const maxScroll = el.scrollWidth - el.clientWidth\n    const fromStart = Math.abs(el.scrollLeft)\n    const rtl = (rtlRef.current ??=\n      getComputedStyle(el).direction === \"rtl\")\n    const [left, right] = rtl\n      ? [maxScroll - fromStart, fromStart]\n      : [fromStart, maxScroll - fromStart]\n    setFades((prev) => {\n      const next = { left: left > 1, right: right > 1 }\n      return prev.left === next.left && prev.right === next.right ? prev : next\n    })\n  }, [])\n\n  useEffect(() => {\n    updateFades()\n    const el = scrollRef.current\n    if (!el?.firstElementChild) return undefined\n    const observer = new ResizeObserver(updateFades)\n    observer.observe(el)\n    observer.observe(el.firstElementChild)\n    return () => observer.disconnect()\n  }, [updateFades, suggestions])\n\n  if (suggestions.length === 0) return null\n\n  const maskImage = `linear-gradient(to right, ${\n    fades.left ? \"transparent, black 2rem\" : \"black\"\n  }, ${fades.right ? \"black calc(100% - 2rem), transparent\" : \"black\"})`\n\n  return (\n    <div\n      ref={scrollRef}\n      onScroll={updateFades}\n      data-slot=\"follow-up-suggestions\"\n      className={cn(\n        \"-my-1 w-full overflow-x-auto py-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n        className\n      )}\n      style={{ maskImage, WebkitMaskImage: maskImage }}\n    >\n      <div className=\"mx-auto flex min-h-8 w-max items-center gap-2 px-0.5\">\n        {suggestions.map((suggestion, idx) => (\n          <button\n            key={idx}\n            type=\"button\"\n            className=\"bg-background hover:bg-muted/80 rounded-full border px-3 py-1 text-sm whitespace-nowrap transition-colors ease-in\"\n            onClick={() => onSelect?.(suggestion.prompt)}\n          >\n            {suggestion.title ?? suggestion.prompt}\n            {suggestion.label ? (\n              <span className=\"text-muted-foreground ms-1\">\n                {suggestion.label}\n              </span>\n            ) : null}\n          </button>\n        ))}\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:component"
    }
  ]
}