{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "testimonial-pills",
  "title": "Testimonial Pills",
  "description": "Avatar-and-pill testimonial marquee rows with dual-direction scrolling, a depth effect, cursor spotlight glow, and scroll-in reveal.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/testimonial-pills/testimonial-pills.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, useMotionTemplate, useMotionValue, useSpring } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface TestimonialPillItem {\n  text: string;\n  avatar?: string;\n}\n\nexport interface TestimonialPillPalette {\n  bg: string;\n  text: string;\n}\n\nexport interface TestimonialPillsProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  items?: TestimonialPillItem[];\n  rowCount?: number;\n  rowGap?: number;\n  itemGap?: number;\n  direction?: \"left\" | \"right\";\n  alternateDirection?: boolean;\n  speed?: number;\n  speedVariation?: number;\n  pauseOnHover?: boolean;\n  scrollReveal?: boolean;\n  depthEffect?: boolean;\n  depthIntensity?: number;\n  /** Blur the rows farther from the centre. Only applies while depthEffect is on. */\n  depthBlur?: boolean;\n  hoverEnabled?: boolean;\n  hoverScale?: number;\n  /** \"palette\" cycles through `palette`; \"solid\" uses a single pillBg/pillTextColor for every pill. */\n  colorMode?: \"palette\" | \"solid\";\n  palette?: TestimonialPillPalette[];\n  pillBg?: string;\n  pillTextColor?: string;\n  avatarBg?: string;\n  pillHeight?: number;\n  pillRadius?: number;\n  pillPaddingX?: number;\n  fontSize?: number;\n  fontWeight?: number;\n  shadow?: boolean;\n  avatarSize?: number;\n  avatarOverlap?: number;\n  ringWidth?: number;\n  ringColor?: string;\n  edgeFade?: boolean;\n  fadeWidth?: number;\n  spotlight?: boolean;\n  spotlightColor?: string;\n  spotlightSize?: number;\n}\n\ninterface PillStyleConfig {\n  colorMode: \"palette\" | \"solid\";\n  palette: TestimonialPillPalette[];\n  pillBg: string;\n  pillTextColor: string;\n  avatarBg: string;\n  pillHeight: number;\n  pillRadius: number;\n  pillPaddingX: number;\n  fontSize: number;\n  fontWeight: number;\n  shadow: boolean;\n  avatarSize: number;\n  avatarOverlap: number;\n  ringWidth: number;\n  ringColor: string;\n  itemGap: number;\n  hoverEnabled: boolean;\n  hoverScale: number;\n}\n\nconst SPEED_PATTERN = [1, 0.85, 1.18, 0.92, 1.1, 0.96];\n\nconst AVATARS = [\n  \"https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=160&h=160&fit=crop&crop=face&q=80\",\n  \"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=160&h=160&fit=crop&crop=face&q=80\",\n  \"https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=160&h=160&fit=crop&crop=face&q=80\",\n  \"https://images.unsplash.com/photo-1529139574466-a303027c1d8b?w=160&h=160&fit=crop&crop=face&q=80\",\n  \"https://images.unsplash.com/photo-1515886657613-9f3515b0c78f?w=160&h=160&fit=crop&crop=face&q=80\",\n  \"https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=160&h=160&fit=crop&crop=face&q=80\",\n  \"https://images.unsplash.com/photo-1520975954732-35dd22299614?w=160&h=160&fit=crop&crop=face&q=80\",\n  \"https://images.unsplash.com/photo-1469334031218-e382a71b716b?w=160&h=160&fit=crop&crop=face&q=80\",\n];\n\nconst DEFAULT_TEXTS = [\n  \"Very easy to follow\",\n  \"Eye opening\",\n  \"Very insightful\",\n  \"Loved it\",\n  \"Feeling positive\",\n  \"It was useful\",\n  \"Thanks!\",\n  \"Great\",\n  \"So far, so good\",\n  \"Impressed\",\n  \"I'm feeling hopeful\",\n  \"Highly recommend\",\n  \"Super helpful\",\n  \"Worth it\",\n  \"Mind blowing\",\n  \"Couldn't be easier\",\n];\n\nconst DEFAULT_ITEMS: TestimonialPillItem[] = DEFAULT_TEXTS.map((text, i) => ({ text, avatar: AVATARS[i % AVATARS.length] }));\n\nconst DEFAULT_PALETTE: TestimonialPillPalette[] = [\n  { bg: \"#EDE7FC\", text: \"#3F2E78\" },\n  { bg: \"#DFF7EC\", text: \"#15803D\" },\n  { bg: \"#FFEDE3\", text: \"#B45309\" },\n  { bg: \"#E3F0FF\", text: \"#1D4ED8\" },\n  { bg: \"#FDE7F3\", text: \"#BE185C\" },\n];\n\nfunction getPillColors(cfg: PillStyleConfig, colorIndex: number): TestimonialPillPalette {\n  if (cfg.colorMode === \"palette\" && cfg.palette.length > 0) {\n    return cfg.palette[colorIndex % cfg.palette.length];\n  }\n  return { bg: cfg.pillBg, text: cfg.pillTextColor };\n}\n\nfunction PillBlock({ item, cfg, colorIndex }: { item: TestimonialPillItem; cfg: PillStyleConfig; colorIndex: number }) {\n  const colors = getPillColors(cfg, colorIndex);\n  const avatarFallbackBg = cfg.colorMode === \"palette\" ? colors.bg : cfg.avatarBg;\n\n  return (\n    <motion.div\n      className=\"flex shrink-0 items-center\"\n      style={{ marginRight: cfg.itemGap }}\n      whileHover={cfg.hoverEnabled ? { scale: cfg.hoverScale, y: -4, zIndex: 5 } : undefined}\n      transition={{ type: \"spring\", stiffness: 320, damping: 18 }}\n    >\n      <div\n        className=\"relative z-[2] box-border shrink-0 overflow-hidden rounded-full\"\n        style={{\n          width: cfg.avatarSize,\n          height: cfg.avatarSize,\n          marginRight: -cfg.avatarOverlap,\n          border: `${cfg.ringWidth}px solid ${cfg.ringColor}`,\n          background: avatarFallbackBg,\n          boxShadow: cfg.shadow ? \"0 6px 16px rgba(17, 12, 46, 0.14)\" : \"none\",\n        }}\n      >\n        {item.avatar ? (\n          <img src={item.avatar} alt=\"\" draggable={false} className=\"pointer-events-none block h-full w-full select-none object-cover\" />\n        ) : (\n          <div className=\"flex h-full w-full items-center justify-center font-bold opacity-50\" style={{ fontSize: cfg.avatarSize * 0.38, color: colors.text, fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, sans-serif\" }}>\n            {(item.text || \"?\").charAt(0).toUpperCase()}\n          </div>\n        )}\n      </div>\n\n      <div\n        className=\"relative z-[1] box-border flex items-center whitespace-nowrap\"\n        style={{\n          height: cfg.pillHeight,\n          borderRadius: cfg.pillRadius,\n          background: colors.bg,\n          color: colors.text,\n          fontSize: cfg.fontSize,\n          fontWeight: cfg.fontWeight,\n          fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, sans-serif\",\n          paddingLeft: cfg.avatarOverlap + cfg.pillPaddingX,\n          paddingRight: cfg.pillPaddingX,\n          boxShadow: cfg.shadow ? \"0 6px 20px rgba(76, 29, 149, 0.08)\" : \"none\",\n        }}\n      >\n        {item.text}\n      </div>\n    </motion.div>\n  );\n}\n\nfunction PillRow({\n  items,\n  direction,\n  speed,\n  pauseOnHover,\n  cfg,\n}: {\n  items: TestimonialPillItem[];\n  direction: \"left\" | \"right\";\n  speed: number;\n  pauseOnHover: boolean;\n  cfg: PillStyleConfig;\n}) {\n  const trackRef = React.useRef<HTMLDivElement>(null);\n  const [setWidth, setSetWidth] = React.useState(0);\n  const [hovered, setHovered] = React.useState(false);\n\n  React.useEffect(() => {\n    const el = trackRef.current;\n    if (!el) return;\n    const update = () => setSetWidth(el.scrollWidth / 2);\n    update();\n    const ro = new ResizeObserver(update);\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, []);\n\n  const duration = setWidth > 0 ? setWidth / Math.max(speed, 1) : 0;\n  const animationName = direction === \"left\" ? \"tp-scroll-left\" : \"tp-scroll-right\";\n  const paused = pauseOnHover && hovered;\n  const renderedItems = items.length ? [...items, ...items] : [];\n\n  const hoverPad = cfg.hoverEnabled ? Math.ceil((cfg.avatarSize * (cfg.hoverScale - 1)) / 2) + 4 : 0;\n\n  return (\n    <div className=\"w-full overflow-hidden\" style={{ padding: `${hoverPad}px 0` }} onMouseEnter={() => setHovered(true)} onMouseLeave={() => setHovered(false)}>\n      <div\n        ref={trackRef}\n        className=\"flex w-max items-center will-change-transform\"\n        style={{\n          animationName: duration > 0 ? animationName : \"none\",\n          animationDuration: `${duration}s`,\n          animationTimingFunction: \"linear\",\n          animationIterationCount: \"infinite\",\n          animationPlayState: paused ? \"paused\" : \"running\",\n        }}\n      >\n        {renderedItems.map((item, i) => (\n          <PillBlock key={i} item={item} cfg={cfg} colorIndex={i % items.length} />\n        ))}\n      </div>\n    </div>\n  );\n}\n\nexport function TestimonialPills({\n  items = DEFAULT_ITEMS,\n  rowCount = 5,\n  rowGap = 18,\n  itemGap = 22,\n  direction = \"left\",\n  alternateDirection = true,\n  speed = 40,\n  speedVariation = 0.35,\n  pauseOnHover = true,\n  scrollReveal = true,\n  depthEffect = true,\n  depthIntensity = 0.6,\n  depthBlur = true,\n  hoverEnabled = true,\n  hoverScale = 1.08,\n  colorMode = \"palette\",\n  palette = DEFAULT_PALETTE,\n  pillBg = \"#EDE7FC\",\n  pillTextColor = \"#3F2E78\",\n  avatarBg = \"#DCD3F7\",\n  pillHeight = 60,\n  pillRadius = 999,\n  pillPaddingX = 22,\n  fontSize = 17,\n  fontWeight = 600,\n  shadow = true,\n  avatarSize = 68,\n  avatarOverlap = 30,\n  ringWidth = 3,\n  ringColor = \"#FFFFFF\",\n  edgeFade = true,\n  fadeWidth = 60,\n  spotlight = true,\n  spotlightColor = \"rgba(255,255,255,0.45)\",\n  spotlightSize = 420,\n  className,\n  ...props\n}: TestimonialPillsProps) {\n  const containerRef = React.useRef<HTMLDivElement>(null);\n\n  const [revealed, setRevealed] = React.useState(() => !scrollReveal);\n  React.useEffect(() => {\n    if (!scrollReveal || revealed) return;\n    const node = containerRef.current;\n    if (!node) return;\n    const observer = new IntersectionObserver(\n      ([entry]) => {\n        if (entry.isIntersecting) setRevealed(true);\n      },\n      { threshold: 0.15 },\n    );\n    observer.observe(node);\n    return () => observer.disconnect();\n  }, [scrollReveal, revealed]);\n\n  const mouseX = useMotionValue(0);\n  const mouseY = useMotionValue(0);\n  const springX = useSpring(mouseX, { damping: 30, stiffness: 200, mass: 0.5 });\n  const springY = useSpring(mouseY, { damping: 30, stiffness: 200, mass: 0.5 });\n  const spotlightBg = useMotionTemplate`radial-gradient(${spotlightSize}px circle at ${springX}px ${springY}px, ${spotlightColor}, transparent 70%)`;\n  // The glow only shows while the pointer is over the rows, so it never sits at the corner on a dark background.\n  const [pointerInside, setPointerInside] = React.useState(false);\n\n  const cfg: PillStyleConfig = {\n    colorMode,\n    palette,\n    pillBg,\n    pillTextColor,\n    avatarBg,\n    pillHeight,\n    pillRadius,\n    pillPaddingX,\n    fontSize,\n    fontWeight,\n    shadow,\n    avatarSize,\n    avatarOverlap,\n    ringWidth,\n    ringColor,\n    itemGap,\n    hoverEnabled,\n    hoverScale,\n  };\n\n  const rows = React.useMemo(() => {\n    const n = items.length;\n    if (n === 0) return [];\n    const shift = Math.max(1, Math.ceil(n / Math.max(rowCount, 1)));\n    return Array.from({ length: Math.max(rowCount, 1) }, (_, i) => {\n      const offset = (i * shift) % n;\n      return [...items.slice(offset), ...items.slice(0, offset)];\n    });\n  }, [items, rowCount]);\n\n  const maskImage = edgeFade ? `linear-gradient(to right, transparent 0, black ${fadeWidth}px, black calc(100% - ${fadeWidth}px), transparent 100%)` : undefined;\n  const centerIndex = (Math.max(rowCount, 1) - 1) / 2;\n\n  return (\n    <div className={cn(\"relative w-full\", className)} {...props}>\n      <style>{`\n        @keyframes tp-scroll-left { from { transform: translateX(0); } to { transform: translateX(-50%); } }\n        @keyframes tp-scroll-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }\n      `}</style>\n      <div\n        ref={containerRef}\n        onMouseEnter={spotlight ? () => setPointerInside(true) : undefined}\n        onMouseLeave={spotlight ? () => setPointerInside(false) : undefined}\n        onMouseMove={\n          spotlight\n            ? (e) => {\n                const rect = e.currentTarget.getBoundingClientRect();\n                mouseX.set(e.clientX - rect.left);\n                mouseY.set(e.clientY - rect.top);\n              }\n            : undefined\n        }\n        className=\"relative flex w-full flex-col overflow-hidden\"\n        style={{ gap: rowGap, WebkitMaskImage: maskImage, maskImage }}\n      >\n        {rows.map((rowItems, i) => {\n          const rowDirection: \"left\" | \"right\" = alternateDirection ? (i % 2 === 0 ? direction : direction === \"left\" ? \"right\" : \"left\") : direction;\n          const mult = 1 + (SPEED_PATTERN[i % SPEED_PATTERN.length] - 1) * speedVariation;\n          const depthFactor = depthEffect && centerIndex > 0 ? Math.abs(i - centerIndex) / centerIndex : 0;\n          const rowScale = 1 - depthFactor * 0.12 * depthIntensity;\n          const rowOpacity = 1 - depthFactor * 0.35 * depthIntensity;\n          const rowBlur = depthBlur ? depthFactor * 2.5 * depthIntensity : 0;\n          const revealX = rowDirection === \"left\" ? 60 : -60;\n\n          return (\n            <motion.div\n              key={i}\n              style={{ transformOrigin: \"center center\", scale: rowScale, filter: rowBlur > 0.05 ? `blur(${rowBlur}px)` : undefined }}\n              initial={scrollReveal ? { opacity: 0, x: revealX } : false}\n              animate={{ opacity: revealed ? rowOpacity : 0, x: revealed ? 0 : revealX }}\n              transition={{ duration: 0.8, delay: i * 0.08, ease: [0.16, 1, 0.3, 1] }}\n            >\n              <PillRow items={rowItems} direction={rowDirection} speed={Math.max(speed * mult, 1)} pauseOnHover={pauseOnHover} cfg={cfg} />\n            </motion.div>\n          );\n        })}\n\n        {spotlight && <motion.div className=\"pointer-events-none absolute inset-0 z-50\" style={{ background: spotlightBg, opacity: pointerInside ? 1 : 0, transition: \"opacity 0.3s ease\" }} />}\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}