{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "retro-dialog",
  "title": "RetroDialog",
  "description": "A Mac OS 9 styled modal dialog with OS9 window frame, striped title bar with close box, description area, and footer for action buttons. Zooms out of its trigger with Finder zoom rects. Built on UI SDK Dialog.",
  "dependencies": [
    "@ui-sdk/core@0.1.0-beta.1",
    "@ui-sdk/react@0.1.0-beta.1"
  ],
  "registryDependencies": [
    "https://nostalgia-ui.com/r/nostalgia-theme.json",
    "https://nostalgia-ui.com/r/retro-motion.json"
  ],
  "files": [
    {
      "path": "registry/new-york/ui/retro-dialog.tsx",
      "content": "\"use client\"\n\n/*\n * RetroDialog: a Mac OS 9 movable-modal window on UI SDK.\n *\n * Crafted moment: zoom rects. The window grows out of the button that opened\n * it as a trail of outlines, then appears; closing flies the outlines back to\n * the button, as the Finder did. Modern flair eases the rects, classic steps\n * them, reduced motion skips them.\n *\n * No dimmed backdrop: OS 9 never darkened the desktop behind a window.\n */\n\nimport * as React from \"react\"\nimport {\n  Dialog as DialogPrimitive,\n  DialogBackdrop as DialogBackdropPrimitive,\n  DialogClose as DialogClosePrimitive,\n  DialogContent as DialogContentPrimitive,\n  DialogDescription as DialogDescriptionPrimitive,\n  DialogTitle as DialogTitlePrimitive,\n  DialogTrigger as DialogTriggerPrimitive,\n} from \"@ui-sdk/react/dialog\"\n\nimport { cn } from \"@/lib/utils\"\nimport { ZOOM_CONTENT_CLASS, popupClass, useMergedRef, useZoomRects } from \"@/registry/new-york/lib/retro-motion\"\n\ntype ZoomContextValue = ReturnType<typeof useZoomRects>\n\nconst ZoomContext = React.createContext<ZoomContextValue | null>(null)\n\nfunction useZoom() {\n  const ctx = React.useContext(ZoomContext)\n  if (!ctx) throw new Error(\"RetroDialog parts must be inside <RetroDialog>\")\n  return ctx\n}\n\nfunction RetroDialog({ onOpenChange, ...props }: React.ComponentProps<typeof DialogPrimitive>) {\n  const zoom = useZoomRects()\n  return (\n    <ZoomContext.Provider value={zoom}>\n      <DialogPrimitive\n        onOpenChange={(open, details) => {\n          onOpenChange?.(open, details)\n          /* closing: the window vanishes at once and the rects fly home */\n          zoom.onOpenChange(open)\n        }}\n        {...props}\n      />\n    </ZoomContext.Provider>\n  )\n}\n\nfunction RetroDialogTrigger({ ref, ...props }: React.ComponentProps<typeof DialogTriggerPrimitive>) {\n  const { triggerRef } = useZoom()\n  return <DialogTriggerPrimitive ref={useMergedRef(ref, triggerRef)} {...props} />\n}\n\nfunction RetroDialogClose(props: React.ComponentProps<typeof DialogClosePrimitive>) {\n  return <DialogClosePrimitive {...props} />\n}\n\n/* Box properties carry `!` so UI SDK's popup reset can't strip them in apps\n * that haven't declared `@layer ui-sdk;` first. */\nconst retroDialogContentClass = cn(\n  \"fixed! inset-auto! left-1/2! top-1/2! m-0! p-0! w-[calc(100%-2rem)]! max-w-[425px]! h-auto! max-h-[calc(100dvh-2rem)]!\",\n  \"-translate-x-1/2 -translate-y-1/2 flex flex-col outline-none overflow-visible!\",\n  \"border! border-os9-black! bg-os9-gray-200! text-os9-black! shadow-[var(--os9-shadow-window)]\"\n)\n\nfunction RetroDialogContent({\n  className,\n  children,\n  ref,\n  ...props\n}: Omit<React.ComponentProps<typeof DialogContentPrimitive>, \"className\"> & {\n  className?: string\n}) {\n  const { contentRef } = useZoom()\n  return (\n    <>\n      {/* OS 9 never dimmed the desktop behind a window */}\n      <DialogBackdropPrimitive className=\"fixed! inset-0! z-50 bg-transparent!\" />\n      <DialogContentPrimitive\n        ref={useMergedRef(ref, contentRef)}\n        className={popupClass(\n          cn(\n            \"z-50\",\n            retroDialogContentClass,\n            /* appear in one frame once the zoom rects land; vanish at once on close */\n            ZOOM_CONTENT_CLASS\n          ),\n          className\n        )}\n        {...props}\n      >\n        {children}\n      </DialogContentPrimitive>\n    </>\n  )\n}\n\nconst stripes = \"os9-stripes flex-1 min-w-[4px] h-[13px]\"\nconst stripeShadow = { boxShadow: \"inset 1px 0 0 #eee, inset -1px 0 0 #c5c5c5\" }\n\nfunction RetroDialogHeader({ className, children, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div className={cn(\"relative flex h-[19px] items-center bg-os9-gray-400\", className)} {...props}>\n      <span className={cn(stripes, \"ml-[4px]\")} style={stripeShadow} aria-hidden />\n      {children}\n      <span className={stripes} style={stripeShadow} aria-hidden />\n      <DialogClosePrimitive\n        className=\"relative size-[13px] shrink-0 cursor-default mx-[4px] outline-none focus-visible:os9-focus-ring\"\n        aria-label=\"Close\"\n      >\n        <span\n          className=\"absolute inset-[2px] border border-os9-black\"\n          style={{ backgroundImage: \"linear-gradient(135deg, #9a9a9a 0%, #f1f1f1 100%)\" }}\n        />\n        <span\n          className=\"absolute inset-[2px]\"\n          style={{ boxShadow: \"inset 1px 1px 0 rgba(255,255,255,0.6), inset -1px -1px 0 rgba(0,0,0,0.15)\" }}\n        />\n      </DialogClosePrimitive>\n    </div>\n  )\n}\n\nfunction RetroDialogTitle({\n  className,\n  ...props\n}: Omit<React.ComponentProps<typeof DialogTitlePrimitive>, \"className\"> & { className?: string }) {\n  return (\n    <DialogTitlePrimitive\n      className={cn(\n        \"shrink-0 whitespace-nowrap px-[4px] text-[12px] tracking-[0.42px] leading-[0.98]\",\n        \"font-[family-name:var(--os9-font-heading)] text-os9-black\",\n        \"max-w-[60%] overflow-hidden text-ellipsis\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction RetroDialogDescription({\n  className,\n  ...props\n}: Omit<React.ComponentProps<typeof DialogDescriptionPrimitive>, \"className\"> & {\n  className?: string\n}) {\n  return (\n    <DialogDescriptionPrimitive\n      className={cn(\"text-[10px] font-[family-name:var(--os9-font-sans)] text-os9-gray-700\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction RetroDialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return <div className={cn(\"flex flex-row justify-end gap-2\", className)} {...props} />\n}\n\nexport {\n  retroDialogContentClass,\n  RetroDialog,\n  RetroDialogTrigger,\n  RetroDialogContent,\n  RetroDialogHeader,\n  RetroDialogTitle,\n  RetroDialogDescription,\n  RetroDialogFooter,\n  RetroDialogClose,\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}