{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-spotlight-carousel",
  "title": "Pricing Spotlight Carousel",
  "description": "A looping plan carousel with one card in the spotlight: neighbours recede and blur, the active card glows in its own colour with a light that follows the pointer, and you can swipe, click or use the arrow keys.",
  "dependencies": [
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/pricing-spotlight-carousel/pricing-spotlight-carousel.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 type SpotlightTheme = \"dark\" | \"light\";\n\nexport interface SpotlightPlan {\n  name: string;\n  description: string;\n  monthly: number;\n  yearly: number;\n  features: string[];\n  /** Colour of this plan's spotlight. */\n  color?: string;\n  cta?: string;\n}\n\nexport interface PricingSpotlightCarouselProps extends Omit<\n  React.ComponentPropsWithoutRef<\"div\">,\n  \"title\" | \"onSelect\"\n> {\n  theme?: SpotlightTheme;\n  title?: string;\n  plans?: SpotlightPlan[];\n  /** Index of the plan in the spotlight first. */\n  defaultIndex?: number;\n  currency?: string;\n  /** Height of the stage, in px. */\n  height?: number;\n  onSelect?: (plan: SpotlightPlan, yearly: boolean) => void;\n}\n\nconst PALETTES = {\n  dark: {\n    bg: \"#0B0B0D\",\n    border: \"rgba(255,255,255,0.1)\",\n    card: \"#141417\",\n    text: \"#F4F5F7\",\n    sub: \"rgba(255,255,255,0.56)\",\n    faint: \"rgba(255,255,255,0.34)\",\n    chip: \"rgba(255,255,255,0.07)\",\n    dot: \"rgba(255,255,255,0.22)\",\n    btn: \"#F4F5F7\",\n    btnText: \"#0E0E0E\",\n    colors: [\"#8FB8FF\", \"#87FFE3\", \"#B69CFF\", \"#F2A841\"],\n  },\n  light: {\n    bg: \"#F4F3EF\",\n    border: \"rgba(0,0,0,0.09)\",\n    card: \"#FFFFFF\",\n    text: \"#111317\",\n    sub: \"rgba(17,19,23,0.58)\",\n    faint: \"rgba(17,19,23,0.4)\",\n    chip: \"rgba(17,19,23,0.05)\",\n    dot: \"rgba(17,19,23,0.2)\",\n    btn: \"#111317\",\n    btnText: \"#FFFFFF\",\n    colors: [\"#3B6FD8\", \"#0E9F80\", \"#7B5CE0\", \"#D9822B\"],\n  },\n};\n\nconst DEFAULT_PLANS: SpotlightPlan[] = [\n  {\n    name: \"Solo\",\n    description: \"Everything one person needs to ship.\",\n    monthly: 15,\n    yearly: 12,\n    features: [\"1 seat\", \"5 projects\", \"Email support\"],\n  },\n  {\n    name: \"Team\",\n    description: \"Work together without the busywork.\",\n    monthly: 45,\n    yearly: 36,\n    features: [\n      \"10 seats\",\n      \"Unlimited projects\",\n      \"Shared libraries\",\n      \"Priority support\",\n    ],\n  },\n  {\n    name: \"Business\",\n    description: \"Controls and insight for larger teams.\",\n    monthly: 120,\n    yearly: 96,\n    features: [\n      \"50 seats\",\n      \"SSO and roles\",\n      \"Usage analytics\",\n      \"99.9% uptime SLA\",\n    ],\n  },\n  {\n    name: \"Enterprise\",\n    description: \"Your security review, passed.\",\n    monthly: 320,\n    yearly: 256,\n    features: [\n      \"Unlimited seats\",\n      \"Audit log and SCIM\",\n      \"Private cloud\",\n      \"Dedicated manager\",\n    ],\n    cta: \"Talk to sales\",\n  },\n];\n\nexport function PricingSpotlightCarousel({\n  theme = \"dark\",\n  title = \"Find your fit\",\n  plans = DEFAULT_PLANS,\n  defaultIndex = 1,\n  currency = \"$\",\n  height = 430,\n  onSelect,\n  className,\n  style,\n  ...props\n}: PricingSpotlightCarouselProps) {\n  const pal = PALETTES[theme];\n  const id = React.useId();\n  const [index, setIndex] = React.useState(defaultIndex);\n  const [yearly, setYearly] = React.useState(true);\n  const [drag, setDrag] = React.useState(0);\n  const [dragging, setDragging] = React.useState(false);\n  const start = React.useRef<number | null>(null);\n  const moved = React.useRef(false);\n  const stageRef = React.useRef<HTMLDivElement>(null);\n  const n = plans.length;\n  const go = (i: number) => setIndex(((i % n) + n) % n);\n  const spacing = 268;\n\n  const onKey = (e: React.KeyboardEvent) => {\n    if (e.key === \"ArrowRight\") go(index + 1);\n    else if (e.key === \"ArrowLeft\") go(index - 1);\n    else return;\n    e.preventDefault();\n  };\n  const endDrag = () => {\n    if (start.current === null) return;\n    start.current = null;\n    setDragging(false);\n    if (Math.abs(drag) > 60) go(index + (drag < 0 ? 1 : -1));\n    setDrag(0);\n  };\n\n  const arrow =\n    \"grid size-9 cursor-pointer place-items-center rounded-full transition-opacity hover:opacity-75\";\n  return (\n    <section\n      aria-roledescription=\"carousel\"\n      aria-label={title}\n      className={cn(\"w-full overflow-hidden rounded-[24px] py-7\", className)}\n      style={{\n        background: pal.bg,\n        border: `1px solid ${pal.border}`,\n        color: pal.text,\n        fontFamily: \"Inter, -apple-system, BlinkMacSystemFont, sans-serif\",\n        ...style,\n      }}\n      {...props}\n    >\n      <div className=\"flex flex-wrap items-center justify-between gap-3 px-6\">\n        <h3 className=\"m-0 text-[20px] font-semibold tracking-[-0.02em]\">\n          {title}\n        </h3>\n        <button\n          type=\"button\"\n          role=\"switch\"\n          aria-checked={yearly}\n          onClick={() => setYearly((y) => !y)}\n          className=\"flex cursor-pointer items-center gap-2 text-[12.5px] font-medium\"\n          style={{ color: pal.sub }}\n        >\n          <span\n            className=\"relative h-[18px] w-8 rounded-full transition-colors\"\n            style={{ background: yearly ? pal.text : pal.chip }}\n          >\n            <span\n              className=\"absolute top-0.5 left-0.5 size-3.5 rounded-full shadow transition-transform\"\n              style={{\n                background: yearly ? pal.bg : pal.text,\n                transform: yearly ? \"translateX(14px)\" : \"none\",\n              }}\n            />\n          </span>\n          Pay yearly, save 20%\n        </button>\n      </div>\n\n      <div\n        ref={stageRef}\n        tabIndex={0}\n        onKeyDown={onKey}\n        onPointerDown={(e) => {\n          start.current = e.clientX;\n          setDragging(true);\n          moved.current = false;\n        }}\n        onPointerMove={(e) => {\n          if (start.current === null) return;\n          const dx = e.clientX - start.current;\n          if (Math.abs(dx) > 6) moved.current = true;\n          setDrag(dx);\n        }}\n        onPointerUp={endDrag}\n        onPointerCancel={endDrag}\n        onPointerLeave={endDrag}\n        className=\"relative mt-5 cursor-grab touch-pan-y outline-none select-none focus-visible:ring-2 focus-visible:ring-inset active:cursor-grabbing\"\n        style={{ height }}\n      >\n        {plans.map((p, i) => {\n          // Shortest way round the ring, so the carousel loops in both directions.\n          let o = i - index;\n          if (o > n / 2) o -= n;\n          if (o < -n / 2) o += n;\n          const pos = o + drag / spacing;\n          const dist = Math.min(2, Math.abs(pos));\n          const on = o === 0;\n          const color = p.color ?? pal.colors[i % pal.colors.length];\n          const price = yearly ? p.yearly : p.monthly;\n          return (\n            <article\n              key={p.name}\n              id={`${id}-${i}`}\n              aria-roledescription=\"slide\"\n              aria-label={`${p.name}, ${i + 1} of ${n}`}\n              aria-hidden={!on}\n              inert={!on}\n              onClick={() => !moved.current && !on && go(i)}\n              onPointerMove={(e) => {\n                if (!on) return;\n                const r = e.currentTarget.getBoundingClientRect();\n                e.currentTarget.style.setProperty(\n                  \"--mx\",\n                  `${e.clientX - r.left}px`,\n                );\n                e.currentTarget.style.setProperty(\n                  \"--my\",\n                  `${e.clientY - r.top}px`,\n                );\n              }}\n              className={cn(\n                \"absolute top-1/2 left-1/2 flex w-[290px] max-w-[82%] flex-col overflow-hidden rounded-[22px] p-6\",\n                !on && \"cursor-pointer\",\n              )}\n              style={\n                {\n                  height: height - 30,\n                  background: pal.card,\n                  transform: `translate(-50%, -50%) translateX(${pos * spacing}px) scale(${1 - dist * 0.13})`,\n                  opacity: Math.abs(pos) > 1.9 ? 0 : 1 - dist * 0.42,\n                  zIndex: 10 - Math.round(dist * 3),\n                  filter:\n                    dist > 0.4\n                      ? `blur(${Math.min(2, dist * 1.2)}px)`\n                      : undefined,\n                  boxShadow: on\n                    ? `0 0 0 1.5px ${color}, 0 24px 70px -22px ${color}`\n                    : `0 0 0 1px ${pal.border}`,\n                  transition: dragging\n                    ? \"none\"\n                    : \"transform 520ms cubic-bezier(0.22,1,0.36,1), opacity 400ms, box-shadow 400ms, filter 400ms\",\n                  \"--mx\": \"50%\",\n                  \"--my\": \"0%\",\n                } as React.CSSProperties\n              }\n            >\n              {/* A soft light that follows the pointer across the card in the spotlight. */}\n              <span\n                aria-hidden=\"true\"\n                className=\"pointer-events-none absolute inset-0 transition-opacity duration-500\"\n                style={{\n                  opacity: on ? 1 : 0,\n                  background: `radial-gradient(240px circle at var(--mx) var(--my), ${color}2e, transparent 70%)`,\n                }}\n              />\n              <div className=\"relative flex h-full flex-col\">\n                <p className=\"m-0 text-[14px] font-semibold\" style={{ color }}>\n                  {p.name}\n                </p>\n                <p\n                  className=\"m-0 mt-1 text-[12.5px] leading-snug\"\n                  style={{ color: pal.sub }}\n                >\n                  {p.description}\n                </p>\n                <p className=\"m-0 mt-4 flex items-baseline gap-1\">\n                  <span className=\"text-[46px] leading-none font-semibold tracking-[-0.04em] tabular-nums\">\n                    {currency}\n                    {price}\n                  </span>\n                  <span className=\"text-[12.5px]\" style={{ color: pal.sub }}>\n                    / mo\n                  </span>\n                </p>\n                <ul className=\"m-0 mt-4 flex list-none flex-col gap-2 p-0 text-[13px]\">\n                  {p.features.map((f) => (\n                    <li key={f} className=\"flex items-start gap-2\">\n                      <svg\n                        width=\"15\"\n                        height=\"15\"\n                        viewBox=\"0 0 16 16\"\n                        fill=\"none\"\n                        stroke={color}\n                        strokeWidth=\"2\"\n                        strokeLinecap=\"round\"\n                        strokeLinejoin=\"round\"\n                        aria-hidden=\"true\"\n                        className=\"mt-[2px] shrink-0\"\n                      >\n                        <path d=\"M3.2 8.4 6.5 11.6 12.8 4.6\" />\n                      </svg>\n                      {f}\n                    </li>\n                  ))}\n                </ul>\n                <button\n                  type=\"button\"\n                  onClick={() => onSelect?.(p, yearly)}\n                  className=\"mt-auto cursor-pointer rounded-xl py-2.5 text-[13px] font-semibold transition-opacity hover:opacity-90\"\n                  style={{ background: pal.btn, color: pal.btnText }}\n                >\n                  {p.cta ?? `Choose ${p.name}`}\n                </button>\n              </div>\n            </article>\n          );\n        })}\n      </div>\n\n      <div className=\"mt-4 flex items-center justify-center gap-4\">\n        <button\n          type=\"button\"\n          aria-label=\"Previous plan\"\n          onClick={() => go(index - 1)}\n          className={arrow}\n          style={{ background: pal.chip }}\n        >\n          <svg\n            width=\"14\"\n            height=\"14\"\n            viewBox=\"0 0 14 14\"\n            fill=\"none\"\n            stroke=\"currentColor\"\n            strokeWidth=\"1.8\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            aria-hidden=\"true\"\n          >\n            <path d=\"M8.5 3 4.5 7l4 4\" />\n          </svg>\n        </button>\n        <div className=\"flex items-center gap-1.5\">\n          {plans.map((p, i) => (\n            <button\n              key={p.name}\n              type=\"button\"\n              aria-label={`Show ${p.name}`}\n              aria-current={i === index}\n              onClick={() => go(i)}\n              className=\"h-2 cursor-pointer rounded-full transition-[width,background] duration-300\"\n              style={{\n                width: i === index ? 22 : 8,\n                background:\n                  i === index\n                    ? (p.color ?? pal.colors[i % pal.colors.length])\n                    : pal.dot,\n              }}\n            />\n          ))}\n        </div>\n        <button\n          type=\"button\"\n          aria-label=\"Next plan\"\n          onClick={() => go(index + 1)}\n          className={arrow}\n          style={{ background: pal.chip }}\n        >\n          <svg\n            width=\"14\"\n            height=\"14\"\n            viewBox=\"0 0 14 14\"\n            fill=\"none\"\n            stroke=\"currentColor\"\n            strokeWidth=\"1.8\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            aria-hidden=\"true\"\n          >\n            <path d=\"m5.5 3 4 4-4 4\" />\n          </svg>\n        </button>\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}