{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toast-tabs",
  "type": "registry:ui",
  "title": "Toast Tabs",
  "description": "Interactive toast-styled notification tabs with spring animations.",
  "dependencies": [
    "react",
    "motion"
  ],
  "devDependencies": [
    "@types/react"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "ui/toast-tabs.tsx",
      "content": "'use client';\n\nimport React, { useState, useEffect, useRef, useCallback } from 'react';\nimport {\n  motion,\n  AnimatePresence,\n  useMotionValue,\n  useTransform,\n  useAnimationFrame,\n} from 'motion/react';\nimport { cn } from '@/lib/utils';\n\nexport interface TabData {\n  id: string | number;\n  image: string;\n  title: string;\n  description: string;\n}\n\ninterface ToastTabsProps {\n  tabs?: TabData[];\n  autoplay?: boolean;\n  autoplayDelay?: number; // ms\n  ringColor?: string;\n  className?: string;\n}\n\nconst defaultTabs: TabData[] = [\n  {\n    id: 1,\n    image:\n      'https://images.unsplash.com/photo-1599566150163-29194dcaad36?q=80&w=200&auto=format&fit=crop',\n    title: 'Sarah Jenkins',\n    description: 'The workflow integration is simply seamless. It has completely transformed.',\n  },\n  {\n    id: 2,\n    image:\n      'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?q=80&w=200&auto=format&fit=crop',\n    title: 'Mark Thompson',\n    description:\n      'I was skeptical at first, but the performance gains are undeniable. The snappy animations and clean UI make it a joy to use daily.',\n  },\n  {\n    id: 3,\n    image:\n      'https://images.unsplash.com/photo-1633332755192-727a05c4013d?q=80&w=200&auto=format&fit=crop',\n    title: 'Alex Riviera',\n    description:\n      'Finally, a solution that actually considers dark mode as a first-class citizen. The attention to detail in the design system is outstanding.',\n  },\n];\n\nexport default function ToastTabs({\n  tabs = defaultTabs,\n  autoplay = true,\n  autoplayDelay = 3000,\n  ringColor = '#f97316', // Orange-500 default\n  className,\n}: ToastTabsProps) {\n  const [activeIndex, setActiveIndex] = useState(0);\n  const [isPaused, setIsPaused] = useState(false);\n\n  // Use Motion Value for high-performance animation (no react re-renders)\n  const progressMv = useMotionValue(0);\n  const CIRCUMFERENCE = 175.929; // 2 * pi * 28\n\n  // Map progress (0 -> autoplayDelay) to dashoffset (CIRCUMFERENCE -> 0)\n  const strokeDashoffset = useTransform(progressMv, [0, autoplayDelay], [CIRCUMFERENCE, 0]);\n\n  // Handle Autoplay Loop\n  useAnimationFrame((time, delta) => {\n    if (!isPaused && autoplay) {\n      let newProgress = progressMv.get() + delta;\n\n      if (newProgress >= autoplayDelay) {\n        newProgress = 0;\n        setActiveIndex((prev) => (prev + 1) % tabs.length);\n      }\n      progressMv.set(newProgress);\n    }\n  });\n\n  // Refs for keyboard navigation logic\n  const buttonRefs = useRef<(HTMLButtonElement | null)[]>([]);\n\n  useEffect(() => {\n    // Adjust refs array size if tabs change\n    buttonRefs.current = buttonRefs.current.slice(0, tabs.length);\n  }, [tabs]);\n\n  // Reset progress when manually changing tabs\n  const handleTabClick = (index: number) => {\n    setActiveIndex(index);\n    progressMv.set(0);\n  };\n\n  // Keyboard Navigation\n  const handleKeyDown = (e: React.KeyboardEvent, index: number) => {\n    if (e.key === 'ArrowRight') {\n      e.preventDefault(); // Prevent scroll\n      const nextIndex = (index + 1) % tabs.length;\n      setActiveIndex(nextIndex);\n      buttonRefs.current[nextIndex]?.focus();\n      progressMv.set(0);\n    } else if (e.key === 'ArrowLeft') {\n      e.preventDefault(); // Prevent scroll\n      const prevIndex = (index - 1 + tabs.length) % tabs.length;\n      setActiveIndex(prevIndex);\n      buttonRefs.current[prevIndex]?.focus();\n      progressMv.set(0);\n    }\n  };\n\n  return (\n    <div\n      className={cn(\n        'mx-auto flex w-full max-w-2xl flex-col items-center gap-8 [--beam-color:var(--custom-color)] dark:[--beam-color:#ffffff]',\n        className\n      )}\n      style={{ '--custom-color': ringColor } as React.CSSProperties}\n      onMouseEnter={() => setIsPaused(true)}\n      onMouseLeave={() => {\n        setIsPaused(false);\n      }}\n      onTouchStart={() => setIsPaused(true)}\n      onTouchEnd={() => setIsPaused(false)}\n      onTouchCancel={() => setIsPaused(false)}\n    >\n      {/* --- Content Area (Toast) --- */}\n      <div className=\"relative mb-4 flex min-h-[110px] w-full items-center justify-center px-4 text-center\">\n        <AnimatePresence mode=\"popLayout\">\n          <motion.div\n            key={activeIndex}\n            initial={{ opacity: 0, y: 20, scale: 0.9, filter: 'blur(4px)' }}\n            animate={{ opacity: 1, y: 0, scale: 1, filter: 'blur(0px)' }}\n            exit={{ opacity: 0, y: -20, scale: 0.9, filter: 'blur(4px)' }}\n            transition={{\n              duration: 0.4,\n              type: 'spring',\n              stiffness: 260,\n              damping: 20,\n            }}\n            className=\"relative max-w-xs cursor-default rounded-2xl border-2 border-dotted border-neutral-300 bg-neutral-100 p-3 shadow-sm select-none dark:border-neutral-600 dark:bg-neutral-800\"\n          >\n            <p className=\"text-sm leading-relaxed font-medium text-neutral-900 dark:text-white\">\n              \"{tabs[activeIndex].description}\"\n            </p>\n\n            <div className=\"absolute -bottom-2 left-1/2 h-4 w-4 -translate-x-1/2 rotate-45 border-r-2 border-b-2 border-dotted border-neutral-300 bg-neutral-100 dark:border-neutral-600 dark:bg-neutral-800\" />\n          </motion.div>\n        </AnimatePresence>\n      </div>\n\n      {/* --- Tabs / Head --- */}\n      <div className=\"flex items-center gap-4\" role=\"tablist\">\n        {tabs.map((tab, index) => {\n          const isActive = activeIndex === index;\n          return (\n            <button\n              key={tab.id}\n              ref={(el) => {\n                buttonRefs.current[index] = el;\n              }}\n              onClick={() => handleTabClick(index)}\n              onKeyDown={(e) => handleKeyDown(e, index)}\n              className=\"group relative flex appearance-none items-center justify-center border-none bg-transparent p-0 text-[0px] leading-none transition-transform duration-300 outline-none select-none hover:-translate-y-2 focus:outline-none focus-visible:-translate-y-2 focus-visible:ring-0 focus-visible:outline-none\"\n              style={{ WebkitTapHighlightColor: 'transparent' }}\n              aria-selected={isActive}\n              role=\"tab\"\n              tabIndex={isActive ? 0 : -1}\n            >\n              {/* Active Ring & Progress Indicator (Glass Effect) */}\n              {isActive && (\n                <motion.div\n                  layoutId=\"active-ring\"\n                  className=\"pointer-events-none absolute -inset-2 z-0 rounded-full border border-white/20 bg-neutral-200/50 shadow-sm backdrop-blur-md dark:border-white/10 dark:bg-neutral-700/30\"\n                  transition={{ type: 'spring', stiffness: 300, damping: 30 }}\n                >\n                  {/* Rotating SVG for the beam effect */}\n                  <svg className=\"h-full w-full -rotate-90\" viewBox=\"0 0 60 60\">\n                    {/* Progress Trail (Beam) */}\n                    {autoplay && (\n                      <>\n                        <motion.circle\n                          cx=\"30\"\n                          cy=\"30\"\n                          r=\"28\"\n                          fill=\"none\"\n                          stroke=\"var(--beam-color)\"\n                          strokeWidth=\"1.5\"\n                          strokeDasharray=\"175.929\"\n                          style={{\n                            strokeDashoffset,\n                            filter: `drop-shadow(0 0 2px var(--beam-color))`,\n                          }}\n                          strokeLinecap=\"round\"\n                          className=\"opacity-80\"\n                        />\n                      </>\n                    )}\n\n                    {/* Static ring indicator if no autoplay */}\n                    {!autoplay && (\n                      <circle\n                        cx=\"30\"\n                        cy=\"30\"\n                        r=\"28\"\n                        fill=\"none\"\n                        stroke=\"var(--beam-color)\"\n                        strokeWidth=\"1.5\"\n                        style={{\n                          filter: `drop-shadow(0 0 4px var(--beam-color))`,\n                        }}\n                      />\n                    )}\n                  </svg>\n                </motion.div>\n              )}\n\n              {/* Avatar Image */}\n              <div\n                className={cn(\n                  'relative z-10 h-12 w-12 overflow-hidden rounded-full border-2 transition-all duration-300',\n                  isActive\n                    ? 'z-20 scale-125 border-transparent shadow-xl'\n                    : 'scale-90 border-transparent opacity-40 grayscale group-focus-visible:opacity-100 group-focus-visible:grayscale-0 hover:scale-110 hover:opacity-100 hover:grayscale-0'\n                )}\n              >\n                <img src={tab.image} alt={tab.title} className=\"h-full w-full object-cover\" />\n              </div>\n            </button>\n          );\n        })}\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:ui"
    }
  ]
}