{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "new-feature-spotlight-bar",
  "title": "New Feature Spotlight Bar",
  "description": "A thin announcement bar that cycles through what's new, with a soft light that follows the pointer. It pauses while you read.",
  "dependencies": [],
  "files": [
    {
      "path": "registry/new-york/new-feature-spotlight-bar/new-feature-spotlight-bar.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface SpotlightFeature {\n  /** Short tag, e.g. \"New\". */\n  tag?: string;\n  title: string;\n  href?: string;\n}\n\nexport interface NewFeatureSpotlightBarProps extends React.ComponentPropsWithoutRef<\"div\"> {\n  theme?: \"dark\" | \"light\";\n  features?: SpotlightFeature[];\n  /** Milliseconds each one stays. Pauses while the pointer is on the bar. */\n  interval?: number;\n  /** Label of the link. */\n  actionLabel?: string;\n  dismissible?: boolean;\n  onDismiss?: () => void;\n}\n\nconst PALETTES = {\n  dark: {\n    bar: \"#0F1011\",\n    surface: \"#161718\",\n    border: \"rgba(255,255,255,0.08)\",\n    text: \"#F7F8F8\",\n    soft: \"#D0D6E0\",\n    sub: \"#8A8F98\",\n    faint: \"#62666D\",\n    chip: \"rgba(255,255,255,0.06)\",\n    btn: \"#E5E5E6\",\n    btnText: \"#08090A\",\n    accent: \"#5E6AD2\",\n    shadow: \"0 8px 32px rgba(0,0,0,0.45)\",\n  },\n  light: {\n    bar: \"#FFFFFF\",\n    surface: \"#FFFFFF\",\n    border: \"rgba(8,9,10,0.1)\",\n    text: \"#08090A\",\n    soft: \"#3C3F44\",\n    sub: \"#62666D\",\n    faint: \"#8A8F98\",\n    chip: \"rgba(8,9,10,0.05)\",\n    btn: \"#08090A\",\n    btnText: \"#F7F8F8\",\n    accent: \"#5E6AD2\",\n    shadow: \"0 8px 28px rgba(8,9,10,0.12)\",\n  },\n};\n\ntype Palette = (typeof PALETTES)[\"dark\"];\n\nconst FONT =\n  '\"Inter Variable\", Inter, \"SF Pro Display\", -apple-system, BlinkMacSystemFont, sans-serif';\n\nfunction useReducedMotion() {\n  return React.useSyncExternalStore(\n    (callback) => {\n      const query = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n      query.addEventListener(\"change\", callback);\n      return () => query.removeEventListener(\"change\", callback);\n    },\n    () => window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches,\n    () => false,\n  );\n}\n\nfunction CloseButton({\n  label,\n  pal,\n  onClick,\n}: {\n  label: string;\n  pal: Palette;\n  onClick: () => void;\n}) {\n  return (\n    <button\n      type=\"button\"\n      aria-label={label}\n      onClick={onClick}\n      className=\"grid size-7 shrink-0 cursor-pointer place-items-center rounded-full transition-colors outline-none hover:bg-[var(--chip)] focus-visible:ring-2\"\n      style={{ \"--chip\": pal.chip, color: pal.sub } as React.CSSProperties}\n    >\n      <svg\n        width=\"10\"\n        height=\"10\"\n        viewBox=\"0 0 10 10\"\n        fill=\"none\"\n        stroke=\"currentColor\"\n        strokeWidth=\"1.6\"\n        strokeLinecap=\"round\"\n        aria-hidden=\"true\"\n      >\n        <path d=\"m1 1 8 8M9 1 1 9\" />\n      </svg>\n    </button>\n  );\n}\n\n/** Folds its content away when closed, so a dismissed bar doesn't leave a gap. */\nfunction Collapse({\n  open,\n  onGone,\n  children,\n}: {\n  open: boolean;\n  onGone?: () => void;\n  children: React.ReactNode;\n}) {\n  return (\n    <div\n      className=\"grid motion-safe:transition-[grid-template-rows,opacity] motion-safe:duration-300\"\n      style={{ gridTemplateRows: open ? \"1fr\" : \"0fr\", opacity: open ? 1 : 0 }}\n      onTransitionEnd={(e) => {\n        if (!open && e.propertyName === \"grid-template-rows\") onGone?.();\n      }}\n    >\n      <div className=\"min-h-0 overflow-hidden\">{children}</div>\n    </div>\n  );\n}\n\nconst FEATURES: SpotlightFeature[] = [\n  { tag: \"New\", title: \"Shared views are here for every team\" },\n  { tag: \"Beta\", title: \"Ask your workspace anything with Search AI\" },\n  { tag: \"Improved\", title: \"Exports now run three times faster\" },\n];\n\nexport function NewFeatureSpotlightBar({\n  theme = \"dark\",\n  features = FEATURES,\n  interval = 2500,\n  actionLabel = \"See what's new\",\n  dismissible = true,\n  onDismiss,\n  className,\n  style,\n  ...props\n}: NewFeatureSpotlightBarProps) {\n  const pal = PALETTES[theme];\n  const reduce = useReducedMotion();\n  const lightRef = React.useRef<HTMLSpanElement>(null);\n  const [index, setIndex] = React.useState(0);\n  const [paused, setPaused] = React.useState(false);\n  const [open, setOpen] = React.useState(true);\n  const count = features.length;\n  const feature = features[index] ?? features[0];\n\n  React.useEffect(() => {\n    if (reduce || paused || count < 2) return;\n    const timer = window.setInterval(\n      () => setIndex((i) => (i + 1) % count),\n      interval,\n    );\n    return () => window.clearInterval(timer);\n  }, [reduce, paused, count, interval]);\n\n  return (\n    <Collapse open={open} onGone={onDismiss}>\n      <div\n        role=\"region\"\n        aria-label=\"What's new\"\n        onPointerEnter={() => setPaused(true)}\n        onPointerLeave={() => {\n          setPaused(false);\n          if (lightRef.current) lightRef.current.style.opacity = \"0\";\n        }}\n        onPointerMove={(e) => {\n          const light = lightRef.current;\n          if (!light || e.pointerType !== \"mouse\") return;\n          const r = e.currentTarget.getBoundingClientRect();\n          light.style.opacity = \"1\";\n          light.style.transform = `translateX(${(e.clientX - r.left - 160).toFixed(0)}px)`;\n        }}\n        className={`relative flex w-full items-center justify-center gap-3 overflow-hidden px-4 py-2 ${className ?? \"\"}`}\n        style={{\n          background: pal.bar,\n          boxShadow: `inset 0 -1px 0 ${pal.border}`,\n          color: pal.text,\n          fontFamily: FONT,\n          ...style,\n        }}\n        {...props}\n      >\n        <span\n          ref={lightRef}\n          aria-hidden=\"true\"\n          className=\"pointer-events-none absolute inset-y-0 left-0 w-80 opacity-0 transition-opacity duration-300\"\n          style={{\n            background: `radial-gradient(160px 70px at 50% 50%, ${pal.accent}55, transparent 75%)`,\n          }}\n        />\n        {/* Every line shares one cell, so a longer title never moves the bar. */}\n        <div\n          aria-live={paused ? \"polite\" : \"off\"}\n          className=\"relative grid min-w-0 grid-cols-[minmax(0,1fr)]\"\n        >\n          {features.map((f, i) => {\n            const on = i === index;\n            const Line = f.href ? \"a\" : \"span\";\n            return (\n              <Line\n                key={f.title}\n                href={f.href}\n                aria-hidden={!on}\n                tabIndex={on ? undefined : -1}\n                className=\"col-start-1 row-start-1 flex min-w-0 items-center justify-center gap-2 no-underline motion-safe:transition-[opacity,transform] motion-safe:duration-500\"\n                style={{\n                  color: pal.text,\n                  opacity: on ? 1 : 0,\n                  transform: on ? \"none\" : \"translateY(10px)\",\n                  pointerEvents: on ? undefined : \"none\",\n                }}\n              >\n                {f.tag && (\n                  <span\n                    className=\"shrink-0 rounded-full px-2 py-px text-[11px] font-[590] text-white\"\n                    style={{ background: pal.accent }}\n                  >\n                    {f.tag}\n                  </span>\n                )}\n                <span className=\"truncate text-[13px] font-[510] tracking-[-0.011em]\">\n                  {f.title}\n                </span>\n              </Line>\n            );\n          })}\n        </div>\n        <a\n          href={feature?.href ?? \"#\"}\n          className=\"relative hidden shrink-0 items-center gap-1 text-[13px] no-underline hover:underline sm:inline-flex\"\n          style={{ color: pal.sub }}\n        >\n          {actionLabel}\n          <span aria-hidden=\"true\">→</span>\n        </a>\n        {count > 1 && (\n          <div\n            className=\"relative hidden shrink-0 items-center gap-1 sm:flex\"\n            role=\"group\"\n            aria-label=\"Choose an announcement\"\n          >\n            {features.map((f, i) => (\n              <button\n                key={f.title}\n                type=\"button\"\n                aria-label={f.title}\n                aria-current={i === index}\n                onClick={() => setIndex(i)}\n                className=\"h-5 cursor-pointer px-[2px]\"\n              >\n                <span\n                  className=\"block h-1 rounded-full transition-[width,opacity] duration-300\"\n                  style={{\n                    width: i === index ? 14 : 5,\n                    background: pal.text,\n                    opacity: i === index ? 0.9 : 0.3,\n                  }}\n                />\n              </button>\n            ))}\n          </div>\n        )}\n        {dismissible && (\n          <span className=\"relative shrink-0\">\n            <CloseButton\n              label=\"Dismiss\"\n              pal={pal}\n              onClick={() => setOpen(false)}\n            />\n          </span>\n        )}\n      </div>\n    </Collapse>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}