{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "testimonial-spotlight",
  "title": "Testimonial Spotlight",
  "description": "A full-bleed photo testimonial slider with crossfade, slide or iris transitions, a thumbnail strip, progress lines, star ratings, and autoplay.",
  "dependencies": [
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/testimonial-spotlight/testimonial-spotlight.tsx",
      "content": "\"use client\";\n\nimport * as React from \"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 TestimonialSpotlightItem {\n  image: string;\n  name: string;\n  role?: string;\n  quote: string;\n  rating?: number;\n}\n\nexport type TestimonialSpotlightTransition = \"crossfade\" | \"slide\" | \"iris\";\n\nexport interface TestimonialSpotlightProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  /** Business or product these reviews are about, named in the schema.org Review markup search engines read. */\n  reviewSubject?: string;\n  reviews?: TestimonialSpotlightItem[];\n  sectionLabel?: string;\n  autoPlay?: boolean;\n  autoPlayInterval?: number;\n  overlayStrength?: number;\n  transitionType?: TestimonialSpotlightTransition;\n  showQuotePrefix?: boolean;\n  showCounter?: boolean;\n  showRating?: boolean;\n  starColor?: string;\n  borderRadius?: number;\n}\n\nconst STAR_INDICES = [0, 1, 2, 3, 4];\n\nconst DEFAULT_REVIEWS: TestimonialSpotlightItem[] = [\n  {\n    image: \"/demo/51.webp\",\n    name: \"James Harrington\",\n    role: \"Founder, Vertex Studio\",\n    quote: \"They work at full speed without losing form. Watching our vision come to life this fast, with this much precision, was something I didn't expect.\",\n    rating: 5,\n  },\n  {\n    image: \"/demo/49.webp\",\n    name: \"Elena Marsh\",\n    role: \"Head of Product, Drift Labs\",\n    quote: \"Steady, silent, unstoppable. Not a word wasted, not a move without purpose, just clean momentum toward the finish.\",\n    rating: 5,\n  },\n  {\n    image: \"/demo/53.webp\",\n    name: \"David Kolbe\",\n    role: \"Creative Director, Altitude Brand\",\n    quote: \"They carved through every challenge like it wasn't there. Sharp instincts, decisive execution, they made it look effortless.\",\n    rating: 5,\n  },\n];\n\nfunction useContainerWidth(ref: React.RefObject<HTMLDivElement | null>) {\n  const [width, setWidth] = React.useState(900);\n  React.useEffect(() => {\n    if (!ref.current) return;\n    const ro = new ResizeObserver(([entry]) => setWidth(entry.contentRect.width));\n    ro.observe(ref.current);\n    return () => ro.disconnect();\n  }, [ref]);\n  return width;\n}\n\nexport function TestimonialSpotlight({\n  reviewSubject,\n  reviews = DEFAULT_REVIEWS,\n  sectionLabel = \"Reviews\",\n  autoPlay = false,\n  autoPlayInterval = 4,\n  overlayStrength = 0.55,\n  transitionType = \"crossfade\",\n  showQuotePrefix = true,\n  showCounter = true,\n  showRating = true,\n  starColor = \"#FFD700\",\n  borderRadius = 0,\n  className,\n  ...props\n}: TestimonialSpotlightProps) {\n  const containerRef = React.useRef<HTMLDivElement>(null);\n  const containerWidth = useContainerWidth(containerRef);\n  const isMobile = containerWidth <= 768;\n  const count = reviews.length;\n\n  const [active, setActive] = React.useState(0);\n  const [transitioning, setTransitioning] = React.useState(false);\n  const [transDir, setTransDir] = React.useState<1 | -1>(1);\n  const [outgoing, setOutgoing] = React.useState<number | null>(null);\n  const [incoming, setIncoming] = React.useState<number | null>(null);\n  const [slideReady, setSlideReady] = React.useState(false);\n  const slideRafRef = React.useRef<number>(0);\n  const slideTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n  const fadeTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n  const DURATION = transitionType === \"crossfade\" ? 700 : transitionType === \"slide\" ? 500 : 600;\n\n  React.useLayoutEffect(() => {\n    if (!transitioning || slideReady || outgoing === null || incoming === null) return;\n    slideRafRef.current = requestAnimationFrame(() => {\n      setActive(incoming);\n      setSlideReady(true);\n      slideTimerRef.current = setTimeout(() => {\n        setOutgoing(null);\n        setIncoming(null);\n        setSlideReady(false);\n        setTransitioning(false);\n      }, DURATION);\n    });\n    return () => {\n      cancelAnimationFrame(slideRafRef.current);\n      if (slideTimerRef.current) clearTimeout(slideTimerRef.current);\n    };\n  }, [transitioning, slideReady, outgoing, incoming, DURATION]);\n\n  const goTo = React.useCallback(\n    (idx: number, dir?: 1 | -1) => {\n      if (transitioning || idx === active) return;\n      const direction = dir ?? (idx > active ? 1 : -1);\n      setTransDir(direction);\n      setTransitioning(true);\n      if (transitionType === \"slide\") {\n        setOutgoing(active);\n        setIncoming(idx);\n        setSlideReady(false);\n      } else {\n        fadeTimerRef.current = setTimeout(() => {\n          setActive(idx);\n          setTransitioning(false);\n        }, DURATION);\n      }\n    },\n    [transitioning, active, DURATION, transitionType],\n  );\n\n  const prev = React.useCallback(() => goTo((active - 1 + count) % count, -1), [active, count, goTo]);\n  const next = React.useCallback(() => goTo((active + 1) % count, 1), [active, count, goTo]);\n\n  React.useEffect(() => {\n    return () => {\n      if (fadeTimerRef.current) clearTimeout(fadeTimerRef.current);\n    };\n  }, []);\n\n  React.useEffect(() => {\n    if (!autoPlay || count < 2) return;\n    const id = setInterval(next, autoPlayInterval * 1000);\n    return () => clearInterval(id);\n  }, [autoPlay, autoPlayInterval, next, count]);\n\n  const onKeyDown = React.useCallback(\n    (e: React.KeyboardEvent) => {\n      if (e.key === \"ArrowLeft\") prev();\n      else if (e.key === \"ArrowRight\") next();\n    },\n    [prev, next],\n  );\n\n  const touchStartX = React.useRef(0);\n  const touchStartY = React.useRef(0);\n  const onTouchStart = (e: React.TouchEvent) => {\n    touchStartX.current = e.touches[0].clientX;\n    touchStartY.current = e.touches[0].clientY;\n  };\n  const onTouchEnd = (e: React.TouchEvent) => {\n    const dx = e.changedTouches[0].clientX - touchStartX.current;\n    const dy = e.changedTouches[0].clientY - touchStartY.current;\n    if (Math.abs(dx) < 40 || Math.abs(dx) < Math.abs(dy)) return;\n    if (dx < 0) next();\n    else prev();\n  };\n\n  const review = reviews[Math.min(active, count - 1)];\n  const padH = isMobile ? 20 : 40;\n  const padBottom = isMobile ? 20 : 44;\n  const topPad = isMobile ? 20 : 28;\n  const quoteSize = isMobile ? 22 : 38;\n  const thumbnailSize = isMobile ? 40 : 36;\n\n  const getLayerStyle = (i: number): React.CSSProperties => {\n    const isActive = i === active;\n\n    if (transitionType === \"slide\") {\n      if (!transitioning) {\n        return { position: \"absolute\", inset: 0, transform: isActive ? \"translateX(0%)\" : \"translateX(100%)\", opacity: isActive ? 1 : 0, transition: \"none\" };\n      }\n      if (!slideReady) {\n        if (i === outgoing) return { position: \"absolute\", inset: 0, transform: \"translateX(0%)\", opacity: 1, transition: \"none\" };\n        if (i === incoming) return { position: \"absolute\", inset: 0, transform: `translateX(${transDir * 100}%)`, opacity: 1, transition: \"none\" };\n        return { position: \"absolute\", inset: 0, opacity: 0, transition: \"none\" };\n      }\n      if (i === outgoing) return { position: \"absolute\", inset: 0, transform: `translateX(${-transDir * 100}%)`, opacity: 1, transition: `transform ${DURATION}ms cubic-bezier(0.77,0,0.175,1)` };\n      if (isActive) return { position: \"absolute\", inset: 0, transform: \"translateX(0%)\", opacity: 1, transition: `transform ${DURATION}ms cubic-bezier(0.77,0,0.175,1)` };\n      return { position: \"absolute\", inset: 0, opacity: 0, transition: \"none\" };\n    }\n\n    if (transitionType === \"iris\") {\n      return {\n        position: \"absolute\",\n        inset: 0,\n        opacity: isActive ? 1 : 0,\n        clipPath: isActive ? (transitioning ? \"circle(0% at 50% 50%)\" : \"circle(150% at 50% 50%)\") : \"circle(150% at 50% 50%)\",\n        transition: isActive ? `clip-path ${DURATION}ms cubic-bezier(0.4,0,0.2,1), opacity 0ms` : \"opacity 0ms\",\n      };\n    }\n\n    return { position: \"absolute\", inset: 0, opacity: isActive ? (transitioning ? 0 : 1) : 0, transition: `opacity ${DURATION}ms ease` };\n  };\n\n  if (count === 0) return null;\n\n  // schema.org Review markup (JSON-LD) for search engines, skipped while the placeholder reviews show.\n  const reviewsJsonLd = reviews === DEFAULT_REVIEWS\n    ? null\n    : JSON.stringify({\n        \"@context\": \"https://schema.org\",\n        \"@graph\": reviews\n          .filter((r) => r.quote && r.name)\n          .map((r) => ({\n            \"@type\": \"Review\",\n            reviewBody: r.quote,\n            author: { \"@type\": \"Person\", name: r.name },\n            ...(reviewSubject ? { itemReviewed: { \"@type\": \"Organization\", name: reviewSubject } } : {}),\n            ...(r.rating ? { reviewRating: { \"@type\": \"Rating\", ratingValue: r.rating, bestRating: 5 } } : {}),\n          })),\n      }).replace(/</g, \"\\\\u003c\");\n\n  return (\n    <div\n      ref={containerRef}\n      tabIndex={0}\n      onKeyDown={onKeyDown}\n      onTouchStart={onTouchStart}\n      onTouchEnd={onTouchEnd}\n      className={cn(\"relative flex h-full w-full flex-col overflow-hidden bg-[#0a0a0a] outline-none\", className)}\n      style={{ borderRadius }}\n      {...props}\n    >\n      {reviewsJsonLd && <script type=\"application/ld+json\" dangerouslySetInnerHTML={{ __html: reviewsJsonLd }} />}\n      <div className=\"relative min-h-0 flex-1 overflow-hidden\">\n        {reviews.map((r, i) => (\n          <div key={i} style={getLayerStyle(i)}>\n            <img src={r.image} alt=\"\" className=\"block h-full w-full object-cover\" />\n          </div>\n        ))}\n\n        <div\n          className=\"pointer-events-none absolute inset-0\"\n          style={{\n            background: `linear-gradient(to bottom, rgba(0,0,0,${overlayStrength * 0.4}) 0%, transparent 30%, transparent 45%, rgba(0,0,0,${overlayStrength * 0.7}) 70%, rgba(0,0,0,${overlayStrength + 0.2}) 100%)`,\n          }}\n        />\n\n        <div className=\"absolute top-0 right-0 left-0 z-10 flex items-center justify-between\" style={{ padding: `${topPad}px ${padH}px` }}>\n          <span className=\"uppercase text-white/50\" style={{ fontSize: isMobile ? 11 : 12, letterSpacing: \"0.35em\", fontFamily: \"'Helvetica Neue', Arial, sans-serif\" }}>\n            {sectionLabel}\n          </span>\n          {showCounter && (\n            <span className=\"text-white/40 tabular-nums\" style={{ fontSize: isMobile ? 10 : 11, letterSpacing: \"0.1em\", fontFamily: \"'Helvetica Neue', Arial, sans-serif\" }}>\n              {String(active + 1).padStart(2, \"0\")} — {String(count).padStart(2, \"0\")}\n            </span>\n          )}\n        </div>\n\n        <div className=\"absolute z-10 flex gap-1.5\" style={{ top: isMobile ? 56 : 72, left: padH, right: padH }}>\n          {reviews.map((_, i) => (\n            <button\n              key={i}\n              type=\"button\"\n              aria-label={`Go to review ${i + 1}`}\n              onClick={() => goTo(i)}\n              className=\"h-px flex-1 cursor-pointer border-0 p-0 transition-colors duration-[400ms]\"\n              style={{ background: i === active ? \"rgba(255,255,255,0.9)\" : \"rgba(255,255,255,0.2)\" }}\n            />\n          ))}\n        </div>\n\n        <div className=\"absolute right-0 bottom-0 left-0 z-10 flex flex-col\" style={{ padding: `0 ${padH}px ${padBottom}px` }}>\n          {showRating && (\n            <div\n              key={`stars-${active}`}\n              className=\"flex gap-1\"\n              style={{ marginBottom: isMobile ? 8 : 12, opacity: transitioning ? 0 : 1, transform: transitioning ? \"translateY(8px)\" : \"translateY(0)\", transition: \"opacity 0.5s ease, transform 0.5s ease\" }}\n            >\n              {STAR_INDICES.map((s) => (\n                <svg key={s} width={isMobile ? 14 : 16} height={isMobile ? 14 : 16} viewBox=\"0 0 16 16\" fill=\"none\">\n                  <path d=\"M8 1.5L9.545 5.91L14.196 6.09L10.554 8.84L11.804 13.34L8 10.79L4.196 13.34L5.446 8.84L1.804 6.09L6.455 5.91L8 1.5Z\" fill={s < (review.rating ?? 0) ? starColor : \"rgba(255,255,255,0.2)\"} />\n                </svg>\n              ))}\n            </div>\n          )}\n\n          <div\n            key={`meta-${active}`}\n            className=\"flex flex-wrap items-baseline gap-3\"\n            style={{ marginBottom: isMobile ? 12 : 20, opacity: transitioning ? 0 : 1, transform: transitioning ? \"translateY(8px)\" : \"translateY(0)\", transition: \"opacity 0.5s ease, transform 0.5s ease\" }}\n          >\n            <span className=\"font-semibold text-white\" style={{ fontSize: isMobile ? 12 : 14, letterSpacing: \"0.02em\", fontFamily: \"'Helvetica Neue', Arial, sans-serif\" }}>\n              {review.name}\n            </span>\n            {review.role && (\n              <>\n                <span className=\"text-[11px] text-white/25\">-</span>\n                <span className=\"text-white/50\" style={{ fontSize: isMobile ? 10 : 14, letterSpacing: \"0.05em\", fontFamily: \"'Helvetica Neue', Arial, sans-serif\" }}>\n                  {review.role}\n                </span>\n              </>\n            )}\n          </div>\n\n          <div\n            key={`quote-${active}`}\n            className=\"tracking-tight text-white\"\n            style={{\n              fontSize: quoteSize,\n              maxWidth: isMobile ? \"100%\" : \"72%\",\n              opacity: transitioning ? 0 : 1,\n              transform: transitioning ? \"translateY(12px)\" : \"translateY(0)\",\n              lineHeight: 1.2,\n              fontFamily: \"'Georgia', serif\",\n              transition: \"opacity 0.5s 0.05s ease, transform 0.5s 0.05s ease\",\n            }}\n          >\n            {showQuotePrefix ? `\"${review.quote}\"` : review.quote}\n          </div>\n\n          <div className={cn(\"mt-8 flex items-center\", isMobile && \"mt-4 flex-col items-start\")} style={{ gap: isMobile ? 12 : 8 }}>\n            <div className=\"flex items-center gap-2\">\n              <button\n                type=\"button\"\n                aria-label=\"Previous slide\"\n                onClick={prev}\n                className=\"flex shrink-0 items-center justify-center rounded-full border border-white/20 bg-white/10 hover:bg-white/20\"\n                style={{ width: isMobile ? 38 : 44, height: isMobile ? 38 : 44, backdropFilter: \"blur(10px)\", WebkitBackdropFilter: \"blur(10px)\", transition: \"background 0.2s ease\" }}\n              >\n                <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\">\n                  <path d=\"M9 2L4 7L9 12\" stroke=\"white\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n                </svg>\n              </button>\n              <button\n                type=\"button\"\n                aria-label=\"Next slide\"\n                onClick={next}\n                className=\"flex shrink-0 items-center justify-center rounded-full border border-white/30 bg-white/90 hover:bg-white\"\n                style={{ width: isMobile ? 38 : 44, height: isMobile ? 38 : 44, backdropFilter: \"blur(10px)\", WebkitBackdropFilter: \"blur(10px)\", transition: \"background 0.2s ease\" }}\n              >\n                <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\">\n                  <path d=\"M5 2L10 7L5 12\" stroke=\"#0a0a0a\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n                </svg>\n              </button>\n            </div>\n\n            <div className=\"scrollbar-none flex gap-1.5 overflow-x-auto\" style={{ marginLeft: isMobile ? 0 : 12 }}>\n              {reviews.map((r, i) => (\n                <button\n                  key={i}\n                  type=\"button\"\n                  aria-label={`Preview review ${i + 1}`}\n                  onClick={() => goTo(i)}\n                  className=\"shrink-0 overflow-hidden rounded-lg border-0 p-0\"\n                  style={{\n                    width: thumbnailSize,\n                    height: thumbnailSize,\n                    opacity: i === active ? 1 : 0.35,\n                    boxShadow: i === active ? \"inset 0 0 0 1.5px rgba(255,255,255,0.85)\" : \"none\",\n                    transition: \"opacity 0.3s ease, box-shadow 0.3s ease\",\n                  }}\n                >\n                  <img src={r.image} alt=\"\" className=\"block h-full w-full object-cover\" />\n                </button>\n              ))}\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}