{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"kinetic-testimonials","type":"registry:ui","title":"Kinetic Testimonials","description":"Rows of testimonial cards drifting in opposite directions, pausing on hover with soft edge fades.","dependencies":[],"registryDependencies":["utils"],"files":[{"path":"registry/ui/kinetic-testimonials.tsx","type":"registry:ui","content":"\"use client\";\n\nimport type { CSSProperties } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface Testimonial {\n  quote: string;\n  name: string;\n  /** Role, company or @handle shown under the name. */\n  title?: string;\n  avatar?: string;\n  /** 0 to 5 stars. Omit to hide. */\n  rating?: number;\n}\n\nexport interface KineticTestimonialsProps {\n  testimonials: Testimonial[];\n  /** Number of rows (alternating direction). */\n  rows?: number;\n  /** Seconds for the first row to travel one full loop. Lower is faster. */\n  duration?: number;\n  /** Card width in px. */\n  cardWidth?: number;\n  /** Px between cards and rows. */\n  gap?: number;\n  /** Rotation of the whole band in degrees. */\n  tilt?: number;\n  pauseOnHover?: boolean;\n  fadeEdges?: boolean;\n  className?: string;\n}\n\nconst css = `\n@keyframes kt-scroll{to{transform:translate3d(-50%,0,0)}}\n.kt-track{animation:kt-scroll var(--kt-d) linear infinite}\n.kt-row[data-pause]:hover .kt-track,.kt-row[data-pause]:focus-within .kt-track{animation-play-state:paused}\n.kt-card{transition:transform .4s cubic-bezier(.2,.7,.2,1),opacity .4s,border-color .4s}\n.kt-row[data-pause]:hover .kt-card:not(:hover){opacity:.5}\n.kt-row[data-pause] .kt-card:hover{transform:translateY(-4px)}\n@media (prefers-reduced-motion:reduce){.kt-track{animation:none}}\n`;\n\nfunction Stars({ value }: { value: number }) {\n  return (\n    <div className=\"flex gap-0.5\" aria-label={`${value} out of 5 stars`} role=\"img\">\n      {[0, 1, 2, 3, 4].map((i) => (\n        <svg key={i} viewBox=\"0 0 20 20\" className={cn(\"size-3.5\", i < Math.round(value) ? \"fill-amber-400\" : \"fill-muted\")}>\n          <path d=\"M10 1.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L10 14.9l-5.2 2.7 1-5.8L1.5 7.7l5.9-.9z\" />\n        </svg>\n      ))}\n    </div>\n  );\n}\n\nfunction TestimonialCard({ t, width }: { t: Testimonial; width: number }) {\n  return (\n    <figure\n      className=\"kt-card relative flex shrink-0 flex-col gap-4 rounded-2xl border border-border bg-card/80 p-5 shadow-[0_10px_30px_-18px_rgba(0,0,0,.6)] backdrop-blur hover:border-foreground/25\"\n      style={{ width }}\n    >\n      <svg aria-hidden viewBox=\"0 0 24 24\" className=\"absolute right-4 top-4 size-7 fill-foreground/[.06]\">\n        <path d=\"M4 20v-6.5C4 8.6 6.4 5.4 10.5 4l.9 1.9C9 7 7.9 8.6 7.8 11H11v9zm9.5 0v-6.5c0-4.9 2.4-8.1 6.5-9.5l.9 1.9c-2.4 1.1-3.5 2.7-3.6 5.1h3.2v9z\" />\n      </svg>\n      {t.rating != null && <Stars value={t.rating} />}\n      <blockquote className=\"text-[14.5px] leading-relaxed text-foreground/90\">{t.quote}</blockquote>\n      <figcaption className=\"mt-auto flex items-center gap-3\">\n        {t.avatar ? (\n          // eslint-disable-next-line @next/next/no-img-element\n          <img src={t.avatar} alt=\"\" draggable={false} className=\"size-9 rounded-full object-cover ring-1 ring-border\" />\n        ) : (\n          <span className=\"grid size-9 place-items-center rounded-full bg-muted text-sm font-medium text-foreground\">{t.name[0]}</span>\n        )}\n        <div className=\"min-w-0\">\n          <p className=\"truncate text-sm font-medium text-foreground\">{t.name}</p>\n          {t.title && <p className=\"truncate text-xs text-muted-foreground\">{t.title}</p>}\n        </div>\n      </figcaption>\n    </figure>\n  );\n}\n\nexport function KineticTestimonials({\n  testimonials,\n  rows = 2,\n  duration = 60,\n  cardWidth = 320,\n  gap = 16,\n  tilt = -3,\n  pauseOnHover = true,\n  fadeEdges = true,\n  className,\n}: KineticTestimonialsProps) {\n  const n = testimonials.length;\n  const rowCount = Math.max(1, Math.min(rows, n));\n  const fade = \"linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent)\";\n\n  return (\n    <section\n      aria-label=\"Testimonials\"\n      className={cn(\"relative w-full overflow-hidden py-6\", className)}\n      style={{ maskImage: fadeEdges ? fade : undefined, WebkitMaskImage: fadeEdges ? fade : undefined }}\n    >\n      <style href=\"kinetic-testimonials\" precedence=\"default\">\n        {css}\n      </style>\n      <div className=\"flex flex-col\" style={{ gap, transform: tilt ? `rotate(${tilt}deg) scale(1.08)` : undefined }}>\n        {Array.from({ length: rowCount }, (_, r) => {\n          // Each row starts at a different offset so neighbours never show the same card.\n          const shift = Math.floor((r * n) / rowCount);\n          const list = testimonials.map((_, i) => testimonials[(i + shift) % n]);\n          return (\n            <div key={r} className=\"kt-row\" data-pause={pauseOnHover || undefined}>\n              <div\n                className=\"kt-track flex w-max\"\n                style={\n                  {\n                    \"--kt-d\": `${duration * (1 + r * 0.18)}s`,\n                    animationDirection: r % 2 ? \"reverse\" : \"normal\",\n                  } as CSSProperties\n                }\n              >\n                {/* Two identical halves: sliding by -50% loops seamlessly. */}\n                {[0, 1].map((copy) => (\n                  <div key={copy} aria-hidden={copy === 1 || r > 0 || undefined} className=\"flex shrink-0 items-stretch\" style={{ gap, paddingRight: gap }}>\n                    {list.map((t, i) => (\n                      <TestimonialCard key={i} t={t} width={cardWidth} />\n                    ))}\n                  </div>\n                ))}\n              </div>\n            </div>\n          );\n        })}\n      </div>\n    </section>\n  );\n}\n"}]}