{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dialog",
  "type": "registry:ui",
  "title": "Dialog",
  "description": "A letter that slides up out of its envelope.",
  "categories": [
    "core"
  ],
  "files": [
    {
      "path": "ui/dialog.tsx",
      "type": "registry:ui",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { Dialog as DialogPrimitive } from \"radix-ui\";\n\n// Popups render in a layer on <body> that copies the paper type of the nearest [data-paper]\n// element (and follows it if it changes). That keeps their theme without trapping them inside the\n// container's stacking context, so sticky headers can't cover them.\nfunction usePaperContainer() {\n  const anchor = React.useRef<HTMLSpanElement>(null);\n  const [container, setContainer] = React.useState<HTMLElement | undefined>();\n  React.useEffect(() => {\n    const source = anchor.current?.closest<HTMLElement>(\"[data-paper]\");\n    if (!source || source === document.documentElement) return;\n    const layer = document.createElement(\"div\");\n    layer.setAttribute(\"data-paper-layer\", \"\");\n    const sync = () => layer.setAttribute(\"data-paper\", source.getAttribute(\"data-paper\") ?? \"\");\n    sync();\n    document.body.appendChild(layer);\n    const observer = new MutationObserver(sync);\n    observer.observe(source, { attributes: true, attributeFilter: [\"data-paper\"] });\n    setContainer(layer);\n    return () => {\n      observer.disconnect();\n      layer.remove();\n    };\n  }, []);\n  return [anchor, container] as const;\n}\n\n/** A letter that slides up out of its envelope. */\nexport const Dialog = DialogPrimitive.Root;\nexport const DialogTrigger = DialogPrimitive.Trigger;\nexport const DialogClose = DialogPrimitive.Close;\n\nexport function DialogContent({\n  className = \"\",\n  children,\n  showClose = true,\n  ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & { showClose?: boolean }) {\n  const [anchor, container] = usePaperContainer();\n\n  return (\n    <>\n    <span ref={anchor} hidden />\n    <DialogPrimitive.Portal container={container}>\n      <DialogPrimitive.Overlay\n        data-paper-motion\n        className=\"fixed inset-0 z-50 bg-[rgb(28_22_14/.45)] backdrop-blur-[2px] data-[state=closed]:animate-[paper-fade-out_.2s_ease_both] data-[state=open]:animate-[paper-fade-in_.2s_ease_both]\"\n      />\n      <DialogPrimitive.Content\n        data-paper-motion\n        className={`paper fixed left-1/2 top-1/2 z-50 w-[calc(100%-2rem)] max-w-lg rounded-[3px] border border-(--edge) bg-(--paper-raised) p-7 text-(--ink) shadow-[0_24px_60px_-12px_rgb(0_0_0/.5)] outline-none data-[state=closed]:animate-[paper-letter-out_.2s_ease-in_both] data-[state=open]:animate-[paper-letter-in_.4s_cubic-bezier(.2,.9,.3,1.1)_both] ${className}`}\n        {...props}\n      >\n        {/* fold line across the letter */}\n        <div aria-hidden className=\"pointer-events-none absolute inset-x-0 top-1/3 h-px bg-[linear-gradient(90deg,transparent,rgb(0_0_0/.07)_15%,rgb(0_0_0/.07)_85%,transparent)]\" />\n        {children}\n        {showClose && (\n          <DialogPrimitive.Close\n            className=\"absolute right-4 top-4 cursor-pointer rounded-[3px] px-1.5 text-[18px] leading-none text-(--ink-muted) outline-none transition-colors hover:text-(--ink) focus-visible:ring-2 focus-visible:ring-(--pen)\"\n            style={{ fontFamily: \"var(--font-type, 'Courier New', monospace)\" }}\n            aria-label=\"Close\"\n          >\n            ×\n          </DialogPrimitive.Close>\n        )}\n      </DialogPrimitive.Content>\n    </DialogPrimitive.Portal>\n    </>\n  );\n}\n\nexport function DialogHeader({ className = \"\", ...props }: React.HTMLAttributes<HTMLDivElement>) {\n  return <div className={`mb-4 flex flex-col gap-1.5 pr-6 ${className}`} {...props} />;\n}\n\nexport function DialogFooter({ className = \"\", ...props }: React.HTMLAttributes<HTMLDivElement>) {\n  return <div className={`mt-6 flex flex-col-reverse gap-3 sm:flex-row sm:justify-end ${className}`} {...props} />;\n}\n\nexport function DialogTitle({ className = \"\", style, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n  return (\n    <DialogPrimitive.Title\n      className={`text-[24px] font-semibold leading-tight tracking-tight ${className}`}\n      style={{ fontFamily: \"var(--font-display, Georgia, serif)\", ...style }}\n      {...props}\n    />\n  );\n}\n\nexport function DialogDescription({ className = \"\", ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n  return <DialogPrimitive.Description className={`text-[14px] leading-relaxed text-(--ink-muted) ${className}`} {...props} />;\n}\n"
    }
  ],
  "dependencies": [
    "radix-ui"
  ]
}