{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "whats-new-widget",
  "title": "What's New / In-app Changelog Widget",
  "description": "An in-app changelog that opens from a ✦ What's new button with an unread count: a spotlight card for the big release, New, Improved and Fixed tags with filter tabs, entries that expand for details, unread dots, Mark all as read, a Helpful? vote on each update and an email subscription switch.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/whats-new-widget/whats-new-widget.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } 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 type UpdateTag = \"new\" | \"improved\" | \"fixed\";\n\nexport interface ProductUpdate {\n  id: string;\n  tag: UpdateTag;\n  title: string;\n  summary: string;\n  /** Extra detail shown when expanded. */\n  details?: string[];\n  /** YYYY-MM-DD */\n  date: string;\n  /** Show as the large spotlight card. */\n  featured?: boolean;\n  unread?: boolean;\n  href?: string;\n}\n\nexport interface WhatsNewWidgetProps {\n  title?: string;\n  updates?: ProductUpdate[];\n  /** Start with the panel open. */\n  defaultOpen?: boolean;\n  onFeedback?: (id: string, helpful: boolean) => void;\n  onSubscribe?: (on: boolean) => void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.62)\", faint: \"rgba(245,244,241,0.36)\", card: \"#141414\", bar: \"#101010\", border: \"rgba(255,255,255,0.09)\", chip: \"rgba(255,255,255,0.06)\", hover: \"rgba(255,255,255,0.035)\", skel: \"rgba(255,255,255,0.045)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", accent: \"#FB923C\", ring: \"rgba(245,244,241,0.6)\", shadow: \"0 30px 70px -20px rgba(0,0,0,0.85)\" },\n  light: { bg: \"#F4F4F1\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.62)\", faint: \"rgba(10,10,10,0.4)\", card: \"#FFFFFF\", bar: \"#FFFFFF\", border: \"rgba(10,10,10,0.09)\", chip: \"rgba(10,10,10,0.05)\", hover: \"rgba(10,10,10,0.025)\", skel: \"rgba(10,10,10,0.05)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", accent: \"#EA580C\", ring: \"rgba(10,10,10,0.5)\", shadow: \"0 30px 70px -24px rgba(0,0,0,0.25)\" },\n};\nconst TAGS: Record<UpdateTag, { label: string; color: string }> = {\n  new: { label: \"New\", color: \"#FB923C\" },\n  improved: { label: \"Improved\", color: \"#60A5FA\" },\n  fixed: { label: \"Fixed\", color: \"#4ADE80\" },\n};\n\nconst DEFAULT_UPDATES: ProductUpdate[] = [\n  { id: \"u1\", tag: \"new\", title: \"AI summaries for every thread\", summary: \"Long conversations now open with a three-line summary and the decisions that were made.\", details: [\"Works in English, German, Spanish and Turkish.\", \"Turn it off per workspace in Settings → AI.\", \"Summaries never leave your region.\"], date: \"2026-10-30\", featured: true, unread: true, href: \"#\" },\n  { id: \"u2\", tag: \"new\", title: \"Recurring tasks\", summary: \"Repeat a task every day, week or month, or on the last Friday of the quarter.\", details: [\"Edit one occurrence or the whole series.\", \"Due dates move with the schedule.\"], date: \"2026-10-24\", unread: true, href: \"#\" },\n  { id: \"u3\", tag: \"improved\", title: \"Search is 4× faster\", summary: \"Results now appear as you type, even in workspaces with a million items.\", details: [\"Filters for author, date and type.\", \"Search inside attachments.\"], date: \"2026-10-18\", unread: true },\n  { id: \"u4\", tag: \"fixed\", title: \"Calendar sync on iOS\", summary: \"Events created on iPhone no longer show up an hour late after daylight saving changes.\", date: \"2026-10-12\" },\n  { id: \"u5\", tag: \"improved\", title: \"Bulk edit in tables\", summary: \"Select rows and change status, owner or due date for all of them at once.\", date: \"2026-10-03\" },\n];\n\nconst MONTHS = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\nconst fmt = (d: string) => `${Number(d.slice(8, 10))} ${MONTHS[Number(d.slice(5, 7)) - 1]}`;\n\ntype Filter = \"all\" | UpdateTag;\n\nexport function WhatsNewWidget({ title = \"What's new\", updates = DEFAULT_UPDATES, defaultOpen = true, onFeedback, onSubscribe, theme = \"dark\", className }: WhatsNewWidgetProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [open, setOpen] = React.useState(defaultOpen);\n  const [read, setRead] = React.useState<string[]>(() => updates.filter((u) => !u.unread).map((u) => u.id));\n  const [filter, setFilter] = React.useState<Filter>(\"all\");\n  const [expanded, setExpanded] = React.useState<string | null>(null);\n  const [votes, setVotes] = React.useState<Record<string, boolean>>({});\n  const [subscribed, setSubscribed] = React.useState(false);\n  const wrap = React.useRef<HTMLDivElement>(null);\n  const trigger = React.useRef<HTMLButtonElement>(null);\n\n  React.useEffect(() => {\n    if (!open) return;\n    const down = (e: MouseEvent) => {\n      if (wrap.current && !wrap.current.contains(e.target as Node)) setOpen(false);\n    };\n    // On the document, so Escape still works after a clicked control inside the panel disappears.\n    const key = (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") {\n        setOpen(false);\n        trigger.current?.focus();\n      }\n    };\n    document.addEventListener(\"mousedown\", down);\n    document.addEventListener(\"keydown\", key);\n    return () => {\n      document.removeEventListener(\"mousedown\", down);\n      document.removeEventListener(\"keydown\", key);\n    };\n  }, [open]);\n\n  const unread = updates.filter((u) => !read.includes(u.id)).length;\n  const rows = updates.filter((u) => filter === \"all\" || u.tag === filter);\n  const featured = filter === \"all\" ? rows.find((u) => u.featured) : undefined;\n  const rest = rows.filter((u) => u !== featured);\n  const markRead = (id: string) => setRead((r) => (r.includes(id) ? r : [...r, id]));\n\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.card } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n  const tagPill = (t: UpdateTag) => (\n    <span className=\"rounded-full px-1.5 py-px text-[10.5px] font-semibold\" style={{ background: `${TAGS[t].color}1F`, color: TAGS[t].color }}>\n      {TAGS[t].label}\n    </span>\n  );\n  const feedback = (u: ProductUpdate) => (\n    <div className=\"mt-3 flex items-center gap-2 text-[12px]\" style={{ color: p.faint }}>\n      {votes[u.id] === undefined ? (\n        <>\n          Helpful?\n          {[true, false].map((h) => (\n            <button\n              key={String(h)}\n              type=\"button\"\n              aria-label={h ? \"Yes, helpful\" : \"Not helpful\"}\n              onClick={() => {\n                setVotes((v) => ({ ...v, [u.id]: h }));\n                onFeedback?.(u.id, h);\n              }}\n              className={cn(\"flex h-7 w-7 cursor-pointer items-center justify-center rounded-md border bg-transparent\", focus)}\n              style={{ borderColor: p.border, color: p.muted, ...ring }}\n            >\n              <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" style={{ transform: h ? undefined : \"rotate(180deg)\" }}>\n                <path d=\"M7 11v9H4v-9h3Zm0 0 4-7c1.5 0 2.5 1 2 3l-1 3h6a2 2 0 0 1 2 2.3l-1.2 6A2 2 0 0 1 16.8 20H7\" />\n              </svg>\n            </button>\n          ))}\n        </>\n      ) : (\n        <motion.span initial={reduce ? false : { opacity: 0, y: 2 }} animate={{ opacity: 1, y: 0 }} role=\"status\">\n          {votes[u.id] ? \"Glad it helps! 🙌\" : \"Thanks, we'll keep improving it.\"}\n        </motion.span>\n      )}\n    </div>\n  );\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"mx-auto min-h-[720px] max-w-6xl px-4 py-8 @[640px]:px-6\">\n        {/* Sample app chrome */}\n        <div className=\"flex items-center justify-between rounded-xl border px-4 py-2.5\" style={{ background: p.bar, borderColor: p.border }}>\n          <div className=\"flex items-center gap-3\" aria-hidden=\"true\">\n            <span className=\"h-6 w-6 rounded-md\" style={{ background: p.on }} />\n            <span className=\"hidden h-3 w-20 rounded @[560px]:block\" style={{ background: p.skel }} />\n            <span className=\"hidden h-3 w-16 rounded @[560px]:block\" style={{ background: p.skel }} />\n          </div>\n          <div ref={wrap} className=\"relative\">\n            <button\n              ref={trigger}\n              type=\"button\"\n              aria-haspopup=\"dialog\"\n              aria-expanded={open}\n              aria-controls={`${uid}-panel`}\n              onClick={() => setOpen((o) => !o)}\n              className={cn(\"relative flex h-9 cursor-pointer items-center gap-2 rounded-full border px-3 text-[13px]\", focus)}\n              style={{ borderColor: p.border, background: open ? p.chip : \"transparent\", color: p.text, ...ring }}\n            >\n              <motion.span aria-hidden=\"true\" style={{ color: p.accent }} animate={unread && !reduce && !open ? { rotate: [0, -12, 12, -6, 0] } : { rotate: 0 }} transition={{ duration: 0.8, repeat: unread && !open ? Infinity : 0, repeatDelay: 3 }}>\n                ✦\n              </motion.span>\n              {title}\n              <AnimatePresence>\n                {unread > 0 && (\n                  <motion.span initial={reduce ? false : { scale: 0 }} animate={{ scale: 1 }} exit={reduce ? undefined : { scale: 0 }} className=\"flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-[11px] font-semibold tabular-nums\" style={{ background: p.accent, color: \"#0A0A0A\" }}>\n                    {unread}\n                    <span className=\"sr-only\"> unread</span>\n                  </motion.span>\n                )}\n              </AnimatePresence>\n            </button>\n\n            <AnimatePresence>\n              {open && (\n                <motion.div\n                  id={`${uid}-panel`}\n                  role=\"dialog\"\n                  aria-labelledby={`${uid}-title`}\n                  initial={reduce ? false : { opacity: 0, y: -8, scale: 0.98 }}\n                  animate={{ opacity: 1, y: 0, scale: 1 }}\n                  exit={reduce ? undefined : { opacity: 0, y: -6, scale: 0.98 }}\n                  transition={{ duration: 0.16 }}\n                  className=\"absolute right-0 z-20 mt-2 flex max-h-[600px] w-[min(400px,calc(100vw-48px))] origin-top-right flex-col overflow-hidden rounded-2xl border\"\n                  style={{ background: p.card, borderColor: p.border, boxShadow: p.shadow }}\n                >\n                  <div className=\"flex items-center justify-between gap-2 px-4 pt-4\">\n                    <h2 id={`${uid}-title`} className=\"m-0 text-[16px] font-semibold tracking-[-0.01em]\">\n                      {title}\n                    </h2>\n                    <button type=\"button\" disabled={!unread} onClick={() => setRead(updates.map((u) => u.id))} className={cn(\"cursor-pointer rounded border-0 bg-transparent px-1 text-[12.5px] disabled:cursor-default disabled:opacity-40\", focus)} style={{ color: p.muted, ...ring }}>\n                      Mark all as read\n                    </button>\n                  </div>\n                  <div role=\"tablist\" aria-label=\"Filter updates\" className=\"flex gap-1 border-b px-3 pt-2\" style={{ borderColor: p.border }}>\n                    {([\"all\", \"new\", \"improved\", \"fixed\"] as Filter[]).map((f) => (\n                      <button key={f} type=\"button\" role=\"tab\" aria-selected={filter === f} onClick={() => setFilter(f)} className={cn(\"relative cursor-pointer border-0 bg-transparent px-2 pt-1 pb-2.5 text-[12.5px]\", focus)} style={{ color: filter === f ? p.text : p.muted, ...ring }}>\n                        {f === \"all\" ? \"All\" : TAGS[f].label}\n                        {filter === f && <motion.span layoutId={`${uid}-tab`} className=\"absolute inset-x-1 -bottom-px h-[2px] rounded-full\" style={{ background: p.on }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 38 }} />}\n                      </button>\n                    ))}\n                  </div>\n\n                  <div className=\"min-h-0 flex-1 overflow-y-auto p-3\">\n                    {featured && (\n                      <article className=\"mb-2 overflow-hidden rounded-xl border\" style={{ borderColor: p.border }} onMouseEnter={() => markRead(featured.id)} onFocus={() => markRead(featured.id)}>\n                        <div className=\"relative h-32 overflow-hidden\" style={{ background: \"linear-gradient(135deg,#1d1208,#2a1530 55%,#0d1c33)\" }} aria-hidden=\"true\">\n                          {[0, 1, 2].map((i) => (\n                            <motion.span key={i} className=\"absolute left-6 h-2.5 rounded-full\" style={{ top: 30 + i * 22, width: [180, 140, 110][i], background: i === 0 ? \"rgba(255,255,255,0.85)\" : \"rgba(255,255,255,0.35)\" }} initial={reduce ? false : { scaleX: 0, originX: 0 }} animate={{ scaleX: 1 }} transition={{ delay: 0.2 + i * 0.12, duration: 0.5 }} />\n                          ))}\n                          <motion.span className=\"absolute top-6 right-6 flex h-9 w-9 items-center justify-center rounded-full text-[16px]\" style={{ background: \"rgba(251,146,60,0.25)\", color: \"#FB923C\" }} animate={reduce ? undefined : { scale: [1, 1.12, 1] }} transition={{ duration: 2, repeat: Infinity }}>\n                            ✦\n                          </motion.span>\n                        </div>\n                        <div className=\"p-3.5\">\n                          <div className=\"flex items-center gap-2\">\n                            {tagPill(featured.tag)}\n                            <span className=\"text-[11.5px]\" style={{ color: p.faint }}>\n                              {fmt(featured.date)}\n                            </span>\n                            {!read.includes(featured.id) && <span className=\"h-1.5 w-1.5 rounded-full\" style={{ background: p.accent }} aria-label=\"Unread\" />}\n                          </div>\n                          <h3 className=\"m-0 mt-1.5 text-[15px] font-semibold\">{featured.title}</h3>\n                          <p className=\"m-0 mt-1 text-[13px] leading-[1.55]\" style={{ color: p.muted }}>\n                            {featured.summary}\n                          </p>\n                          {featured.details && (\n                            <ul className=\"m-0 mt-2 flex list-none flex-col gap-1 p-0\">\n                              {featured.details.map((d) => (\n                                <li key={d} className=\"flex gap-2 text-[12.5px]\" style={{ color: p.muted }}>\n                                  <span style={{ color: p.accent }} aria-hidden=\"true\">\n                                    ·\n                                  </span>\n                                  {d}\n                                </li>\n                              ))}\n                            </ul>\n                          )}\n                          {feedback(featured)}\n                        </div>\n                      </article>\n                    )}\n                    <ul className=\"m-0 list-none p-0\">\n                      <AnimatePresence initial={false} mode=\"popLayout\">\n                        {rest.map((u) => {\n                          const isOpen = expanded === u.id;\n                          const isUnread = !read.includes(u.id);\n                          return (\n                            <motion.li key={u.id} layout={!reduce} initial={reduce ? false : { opacity: 0 }} animate={{ opacity: 1 }} exit={reduce ? undefined : { opacity: 0, transition: { duration: 0.1 } }} className=\"rounded-xl\" style={{ background: isOpen ? p.hover : \"transparent\" }}>\n                              <button\n                                type=\"button\"\n                                aria-expanded={isOpen}\n                                aria-controls={`${uid}-${u.id}`}\n                                onClick={() => {\n                                  setExpanded(isOpen ? null : u.id);\n                                  markRead(u.id);\n                                }}\n                                className={cn(\"flex w-full cursor-pointer gap-3 rounded-xl border-0 bg-transparent p-2.5 text-left\", focus)}\n                                style={{ color: p.text, ...ring }}\n                              >\n                                <span className=\"mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full\" style={{ background: isUnread ? p.accent : \"transparent\" }} aria-hidden=\"true\" />\n                                <span className=\"min-w-0 flex-1\">\n                                  <span className=\"flex items-center gap-2\">\n                                    {tagPill(u.tag)}\n                                    <span className=\"text-[11.5px]\" style={{ color: p.faint }}>\n                                      {fmt(u.date)}\n                                    </span>\n                                    {isUnread && <span className=\"sr-only\">Unread</span>}\n                                  </span>\n                                  <span className=\"mt-1 block text-[13.5px] font-medium\">{u.title}</span>\n                                  <span className={cn(\"mt-0.5 block text-[12.5px] leading-[1.5]\", !isOpen && \"line-clamp-1\")} style={{ color: p.muted }}>\n                                    {u.summary}\n                                  </span>\n                                </span>\n                                <motion.svg width=\"13\" height=\"13\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className=\"mt-1 shrink-0\" style={{ color: p.faint }} animate={{ rotate: isOpen ? 180 : 0 }} aria-hidden=\"true\">\n                                  <path d=\"m4 6 4 4 4-4\" />\n                                </motion.svg>\n                              </button>\n                              <AnimatePresence initial={false}>\n                                {isOpen && (\n                                  <motion.div id={`${uid}-${u.id}`} initial={reduce ? false : { height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={reduce ? undefined : { height: 0, opacity: 0 }} transition={{ duration: 0.2 }} className=\"overflow-hidden\">\n                                    <div className=\"pr-3 pb-3 pl-[30px]\">\n                                      {u.details?.map((d) => (\n                                        <p key={d} className=\"m-0 mt-1 text-[12.5px]\" style={{ color: p.muted }}>\n                                          · {d}\n                                        </p>\n                                      ))}\n                                      {u.href && (\n                                        <a href={u.href} onClick={(e) => e.preventDefault()} className={cn(\"mt-2 inline-block rounded text-[12.5px] font-medium underline-offset-2 hover:underline\", focus)} style={{ color: p.text, ...ring }}>\n                                          Read the full note →\n                                        </a>\n                                      )}\n                                      {feedback(u)}\n                                    </div>\n                                  </motion.div>\n                                )}\n                              </AnimatePresence>\n                            </motion.li>\n                          );\n                        })}\n                      </AnimatePresence>\n                    </ul>\n                    {rows.length === 0 && (\n                      <p className=\"m-0 py-10 text-center text-[13px]\" style={{ color: p.muted }}>\n                        Nothing in this category yet.\n                      </p>\n                    )}\n                  </div>\n\n                  <div className=\"flex items-center justify-between gap-3 border-t px-4 py-3\" style={{ borderColor: p.border }}>\n                    <span className=\"text-[12.5px]\" style={{ color: p.muted }}>\n                      Email me product updates\n                    </span>\n                    <button\n                      type=\"button\"\n                      role=\"switch\"\n                      aria-checked={subscribed}\n                      aria-label=\"Email me product updates\"\n                      onClick={() => {\n                        setSubscribed((s) => !s);\n                        onSubscribe?.(!subscribed);\n                      }}\n                      className={cn(\"relative h-5 w-9 cursor-pointer rounded-full border-0 transition-colors\", focus)}\n                      style={{ background: subscribed ? p.accent : p.chip, ...ring }}\n                    >\n                      <motion.span className=\"absolute top-0.5 h-4 w-4 rounded-full\" style={{ background: subscribed ? \"#fff\" : p.faint }} initial={false} animate={{ left: subscribed ? 18 : 2 }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 600, damping: 34 }} />\n                    </button>\n                  </div>\n                </motion.div>\n              )}\n            </AnimatePresence>\n          </div>\n        </div>\n\n        {/* Sample page content */}\n        <div className=\"mt-6 grid gap-4 @[720px]:grid-cols-3\" aria-hidden=\"true\">\n          <span className=\"h-28 rounded-xl\" style={{ background: p.skel }} />\n          <span className=\"h-28 rounded-xl\" style={{ background: p.skel }} />\n          <span className=\"h-28 rounded-xl\" style={{ background: p.skel }} />\n          <span className=\"h-72 rounded-xl @[720px]:col-span-2\" style={{ background: p.skel }} />\n          <span className=\"h-72 rounded-xl\" style={{ background: p.skel }} />\n        </div>\n      </div>\n    </section>\n  );\n}\n\nexport default WhatsNewWidget;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}