{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "page-heading",
  "title": "Page Heading",
  "description": "A page heading in three variants (simple, with meta details, with a cover and avatar): breadcrumb, a title you can rename in place, a Draft or Published status, Copy link that confirms, Preview, a Publish button that flips its label, and a More menu that holds actions on narrow screens.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/page-heading/page-heading.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 MetaIcon = \"briefcase\" | \"pin\" | \"money\" | \"calendar\" | \"users\";\n\nexport interface PageHeadingProps {\n  variant?: \"simple\" | \"meta\" | \"banner\";\n  title?: string;\n  breadcrumb?: string[];\n  meta?: { icon: MetaIcon; label: string }[];\n  /** Image behind the banner variant. */\n  cover?: string;\n  avatar?: string;\n  status?: \"draft\" | \"published\";\n  link?: string;\n  onTitleChange?: (title: string) => void;\n  onPublish?: (published: 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: \"#121212\", border: \"rgba(255,255,255,0.09)\", chip: \"rgba(255,255,255,0.06)\", hover: \"rgba(255,255,255,0.04)\", input: \"#0D0D0D\", on: \"#F5F4F1\", onText: \"#0A0A0A\", green: \"#4ADE80\", amber: \"#FBBF24\", ring: \"rgba(245,244,241,0.6)\", pop: \"#181818\", shadow: \"0 20px 50px -16px rgba(0,0,0,0.8)\" },\n  light: { bg: \"#FAFAF8\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.62)\", faint: \"rgba(10,10,10,0.4)\", card: \"#FFFFFF\", border: \"rgba(10,10,10,0.09)\", chip: \"rgba(10,10,10,0.05)\", hover: \"rgba(10,10,10,0.03)\", input: \"#FAFAF8\", on: \"#0A0A0A\", onText: \"#FAFAF8\", green: \"#15803D\", amber: \"#B45309\", ring: \"rgba(10,10,10,0.5)\", pop: \"#FFFFFF\", shadow: \"0 20px 50px -20px rgba(0,0,0,0.25)\" },\n};\nconst ICONS: Record<MetaIcon, string> = {\n  briefcase: \"M4 8h16v11H4zM9 8V5h6v3M4 13h16\",\n  pin: \"M12 21s-7-6.2-7-11a7 7 0 1 1 14 0c0 4.8-7 11-7 11Zm0-8.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z\",\n  money: \"M3 7h18v10H3zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM6 10v.01M18 14v.01\",\n  calendar: \"M8 3v3m8-3v3M4 9h16M5 6h14a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Z\",\n  users: \"M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm13 9v-1a4 4 0 0 0-3-3.9\",\n};\nconst DEFAULT_META: { icon: MetaIcon; label: string }[] = [\n  { icon: \"briefcase\", label: \"Full-time\" },\n  { icon: \"pin\", label: \"Berlin or remote\" },\n  { icon: \"money\", label: \"€85k – €110k\" },\n  { icon: \"calendar\", label: \"Closes 30 Nov\" },\n];\n\nexport function PageHeading({ variant = \"meta\", title: titleProp = \"Senior Product Designer\", breadcrumb = [\"Jobs\", \"Design\"], meta = DEFAULT_META, cover = \"/demo/9.webp\", avatar = \"/demo/44.webp\", status: statusProp = \"draft\", link = \"https://nexora.io/jobs/senior-product-designer\", onTitleChange, onPublish, theme = \"dark\", className }: PageHeadingProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [title, setTitle] = React.useState(titleProp);\n  const [editing, setEditing] = React.useState(false);\n  const [draft, setDraft] = React.useState(titleProp);\n  const [status, setStatus] = React.useState(statusProp);\n  const [copied, setCopied] = React.useState(false);\n  const [more, setMore] = React.useState(false);\n  const timer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n  const editBtn = React.useRef<HTMLButtonElement>(null);\n  React.useEffect(\n    () => () => {\n      if (timer.current) clearTimeout(timer.current);\n    },\n    [],\n  );\n  React.useEffect(() => {\n    if (!more) return;\n    const down = (e: MouseEvent) => !(e.target as HTMLElement).closest(\"[data-more]\") && setMore(false);\n    const key = (e: KeyboardEvent) => e.key === \"Escape\" && setMore(false);\n    document.addEventListener(\"mousedown\", down);\n    document.addEventListener(\"keydown\", key);\n    return () => {\n      document.removeEventListener(\"mousedown\", down);\n      document.removeEventListener(\"keydown\", key);\n    };\n  }, [more]);\n\n  const commit = () => {\n    const v = draft.trim();\n    setEditing(false);\n    if (v && v !== title) {\n      setTitle(v);\n      onTitleChange?.(v);\n    } else setDraft(title);\n    requestAnimationFrame(() => editBtn.current?.focus());\n  };\n  const copy = () => {\n    navigator.clipboard?.writeText(link).catch(() => {});\n    setCopied(true);\n    if (timer.current) clearTimeout(timer.current);\n    timer.current = setTimeout(() => setCopied(false), 1600);\n  };\n  const togglePublish = () => {\n    const next = status === \"draft\" ? \"published\" : \"draft\";\n    setStatus(next);\n    onPublish?.(next === \"published\");\n  };\n  const focusInput = React.useCallback((el: HTMLInputElement | null) => {\n    el?.focus();\n    el?.select();\n  }, []);\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 ghost = cn(\"flex h-9 cursor-pointer items-center gap-1.5 rounded-lg border bg-transparent px-3 text-[13px]\", focus);\n  const published = status === \"published\";\n\n  const titleEl = editing ? (\n    <form\n      className=\"min-w-0 flex-1\"\n      onSubmit={(e) => {\n        e.preventDefault();\n        commit();\n      }}\n    >\n      <label htmlFor={`${uid}-title`} className=\"sr-only\">\n        Page title\n      </label>\n      <input\n        id={`${uid}-title`}\n        ref={focusInput}\n        value={draft}\n        onChange={(e) => setDraft(e.target.value)}\n        onBlur={commit}\n        onKeyDown={(e) => {\n          if (e.key === \"Escape\") {\n            setDraft(title);\n            setEditing(false);\n            requestAnimationFrame(() => editBtn.current?.focus());\n          }\n        }}\n        className={cn(\"w-full rounded-lg border bg-transparent px-2 py-1 text-[24px] font-semibold tracking-[-0.02em] @[640px]:text-[28px]\", focus)}\n        style={{ borderColor: p.ring, color: p.text, ...ring }}\n      />\n    </form>\n  ) : (\n    <h1 className=\"m-0 flex min-w-0 items-center gap-2 text-[24px] leading-tight font-semibold tracking-[-0.02em] @[640px]:text-[28px]\">\n      <AnimatePresence mode=\"wait\" initial={false}>\n        <motion.span key={title} className=\"min-w-0 @[560px]:truncate\" initial={reduce ? false : { opacity: 0, y: 4 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0, y: -4 }} transition={{ duration: 0.15 }}>\n          {title}\n        </motion.span>\n      </AnimatePresence>\n      <button ref={editBtn} type=\"button\" onClick={() => setEditing(true)} aria-label=\"Edit title\" className={cn(\"flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent\", focus)} style={{ color: p.faint, ...ring }}>\n        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n          <path d=\"M4 20h4L19 9a2.8 2.8 0 0 0-4-4L4 16v4Z\" />\n        </svg>\n      </button>\n    </h1>\n  );\n\n  const statusPill = (\n    <motion.span layout={!reduce} className=\"inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[12px] font-medium\" style={{ background: p.chip, color: published ? p.green : p.amber }} role=\"status\">\n      <span className=\"relative flex h-1.5 w-1.5\">\n        {published && !reduce && <span className=\"absolute inline-flex h-full w-full animate-ping rounded-full opacity-60\" style={{ background: p.green }} />}\n        <span className=\"relative h-1.5 w-1.5 rounded-full\" style={{ background: published ? p.green : p.amber }} />\n      </span>\n      {published ? \"Published\" : \"Draft\"}\n    </motion.span>\n  );\n\n  const actions = (\n    <div className=\"flex shrink-0 items-center gap-2\">\n      <button type=\"button\" onClick={copy} className={cn(ghost, \"hidden @[560px]:flex\")} style={{ borderColor: p.border, color: copied ? p.green : p.text, ...ring }} aria-live=\"polite\">\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\">\n          {copied ? <path d=\"m4 12 5 5L20 6\" /> : <path d=\"M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1\" />}\n        </svg>\n        {copied ? \"Copied\" : \"Copy link\"}\n      </button>\n      <button type=\"button\" className={cn(ghost, \"hidden @[720px]:flex\")} style={{ borderColor: p.border, color: p.text, ...ring }}>\n        Preview\n      </button>\n      <button type=\"button\" onClick={togglePublish} className={cn(\"relative h-9 cursor-pointer overflow-hidden rounded-lg border-0 px-3.5 text-[13px] font-medium\", focus)} style={{ background: published ? p.chip : p.on, color: published ? p.text : p.onText, ...ring }}>\n        <AnimatePresence mode=\"wait\" initial={false}>\n          <motion.span key={status} className=\"block\" initial={reduce ? false : { y: 14, opacity: 0 }} animate={{ y: 0, opacity: 1 }} exit={reduce ? undefined : { y: -14, opacity: 0 }} transition={{ duration: 0.16 }}>\n            {published ? \"Unpublish\" : \"Publish\"}\n          </motion.span>\n        </AnimatePresence>\n      </button>\n      <div className=\"relative @[720px]:hidden\" data-more>\n        <button type=\"button\" aria-label=\"More actions\" aria-haspopup=\"menu\" aria-expanded={more} onClick={() => setMore((m) => !m)} className={cn(\"flex h-9 w-9 cursor-pointer items-center justify-center rounded-lg border bg-transparent\", focus)} style={{ borderColor: p.border, color: p.muted, ...ring }}>\n          <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n            <circle cx=\"5\" cy=\"12\" r=\"1.8\" />\n            <circle cx=\"12\" cy=\"12\" r=\"1.8\" />\n            <circle cx=\"19\" cy=\"12\" r=\"1.8\" />\n          </svg>\n        </button>\n        <AnimatePresence>\n          {more && (\n            <motion.div initial={reduce ? false : { opacity: 0, y: -4 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0, y: -4 }} transition={{ duration: 0.14 }} className=\"absolute right-0 z-20 mt-1.5 w-44 rounded-xl border p-1.5\" style={{ background: p.pop, borderColor: p.border, boxShadow: p.shadow }} role=\"menu\">\n              {[\"Copy link\", \"Preview\", \"Edit title\"].map((l) => (\n                <button\n                  key={l}\n                  type=\"button\"\n                  role=\"menuitem\"\n                  onClick={() => {\n                    if (l === \"Copy link\") copy();\n                    if (l === \"Edit title\") setEditing(true);\n                    setMore(false);\n                  }}\n                  className={cn(\"flex w-full cursor-pointer rounded-lg border-0 bg-transparent px-2.5 py-1.5 text-left text-[13px] hover:bg-[var(--ph-h)]\", focus)}\n                  style={{ color: p.text, [\"--ph-h\" as string]: p.hover, ...ring }}\n                >\n                  {l}\n                </button>\n              ))}\n            </motion.div>\n          )}\n        </AnimatePresence>\n      </div>\n    </div>\n  );\n\n  const crumbs = (\n    <nav aria-label=\"Breadcrumb\">\n      <ol className=\"m-0 flex list-none flex-wrap items-center gap-1.5 p-0 text-[12.5px]\" style={{ color: p.faint }}>\n        {breadcrumb.map((b) => (\n          <React.Fragment key={b}>\n            <li>\n              <a href=\"#\" onClick={(e) => e.preventDefault()} className={cn(\"rounded no-underline hover:underline\", focus)} style={{ color: p.muted, ...ring }}>\n                {b}\n              </a>\n            </li>\n            <li aria-hidden=\"true\">\n              <svg width=\"12\" height=\"12\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\">\n                <path d=\"m6 3 5 5-5 5\" />\n              </svg>\n            </li>\n          </React.Fragment>\n        ))}\n        <li aria-current=\"page\" className=\"max-w-[16rem] truncate\">\n          {title}\n        </li>\n      </ol>\n    </nav>\n  );\n\n  const metaRow = (\n    <ul className=\"m-0 mt-3 flex list-none flex-wrap gap-x-5 gap-y-2 p-0 text-[13px]\" style={{ color: p.muted }}>\n      {meta.map((m) => (\n        <li key={m.label} className=\"flex items-center gap-1.5\">\n          <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" style={{ color: p.faint }}>\n            <path d={ICONS[m.icon]} />\n          </svg>\n          {m.label}\n        </li>\n      ))}\n    </ul>\n  );\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"mx-auto max-w-5xl px-4 py-10 @[640px]:px-6 @[640px]:py-14\">\n        <div className=\"overflow-hidden rounded-2xl border\" style={{ background: p.card, borderColor: p.border }}>\n          {variant === \"banner\" && (\n            <div className=\"relative h-36 @[640px]:h-44\">\n              {/* eslint-disable-next-line @next/next/no-img-element */}\n              <img src={cover} alt=\"\" className=\"h-full w-full object-cover\" />\n              <div className=\"absolute inset-0\" style={{ background: `linear-gradient(to bottom, transparent 40%, ${p.card})` }} />\n            </div>\n          )}\n          <div className={cn(\"p-5 @[640px]:p-7\", variant === \"banner\" && \"-mt-12 pt-0 @[640px]:-mt-14 @[640px]:pt-0\")}>\n            {variant === \"banner\" && (\n              // eslint-disable-next-line @next/next/no-img-element\n              <img src={avatar} alt=\"\" className=\"relative mb-3 h-20 w-20 rounded-2xl border-4 object-cover @[640px]:h-24 @[640px]:w-24\" style={{ borderColor: p.card }} />\n            )}\n            {variant !== \"banner\" && <div className=\"mb-3\">{crumbs}</div>}\n            <div className=\"flex flex-col gap-4 @[560px]:flex-row @[560px]:items-start @[560px]:justify-between\">\n              <div className=\"min-w-0 flex-1\">\n                {titleEl}\n                <div className=\"mt-2 flex flex-wrap items-center gap-2 text-[13px]\" style={{ color: p.faint }}>\n                  {statusPill}\n                  <span>Edited 4 minutes ago</span>\n                </div>\n                {variant !== \"simple\" && metaRow}\n              </div>\n              {actions}\n            </div>\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n\nexport default PageHeading;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}