{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dialog",
  "type": "registry:ui",
  "title": "Dialog",
  "description": "A modal window over a dimmed page, with parts for a header, title, description and footer.",
  "categories": [
    "ui"
  ],
  "dependencies": [
    "lucide-react",
    "radix-ui"
  ],
  "registryDependencies": [
    "@rivier-ui/theme",
    "@rivier-ui/cn"
  ],
  "files": [
    {
      "path": "registry/ui/dialog.tsx",
      "type": "registry:ui",
      "target": "components/ui/dialog.tsx",
      "content": "\"use client\";\n/**\n * @name dialog\n * @category ui\n * @description A modal window over a dimmed page, with parts for a header, title, description and footer.\n * @when A short task or a decision that must be finished or dismissed before going on. For a panel from an edge (menus, filters, details) use sheet; for something small attached to a control use popover. Always give it a DialogTitle (add className=\"sr-only\" to hide it). Opened by a DialogTrigger, focus returns to that trigger on close. Opened by state with no trigger (a shortcut, a menu item), Radix has nothing to return to: remember the opener (`opener.current = document.activeElement` before opening) and refocus it in `onCloseAutoFocus={(event) => { event.preventDefault(); opener.current?.focus(); }}` on DialogContent.\n * @example\n * <Dialog>\n *   <DialogTrigger asChild><Button variant=\"outline\">Rename</Button></DialogTrigger>\n *   <DialogContent>\n *     <DialogHeader>\n *       <DialogTitle>Rename project</DialogTitle>\n *       <DialogDescription>The address of the project does not change.</DialogDescription>\n *     </DialogHeader>\n *     <input aria-label=\"Name\" defaultValue=\"Atlas\" className=\"h-control rounded-control border border-input px-3 text-base\" />\n *     <DialogFooter>\n *       <DialogClose asChild><Button variant=\"outline\">Cancel</Button></DialogClose>\n *       <Button>Save</Button>\n *     </DialogFooter>\n *   </DialogContent>\n * </Dialog>\n */\nimport { Dialog as DialogPrimitive } from \"radix-ui\";\nimport { X } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\nexport function Dialog(props: ComponentProps<typeof DialogPrimitive.Root>) {\n  return <DialogPrimitive.Root {...props} />;\n}\n\nexport function DialogTrigger(props: ComponentProps<typeof DialogPrimitive.Trigger>) {\n  return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nexport function DialogClose(props: ComponentProps<typeof DialogPrimitive.Close>) {\n  return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nexport function DialogOverlay({ className, ...props }: ComponentProps<typeof DialogPrimitive.Overlay>) {\n  return (\n    <DialogPrimitive.Overlay\n      data-slot=\"dialog-overlay\"\n      className={cn(\n        \"fixed inset-0 z-50 bg-overlay ease-out animation-duration-(--duration-base) fade-in-0 fade-out-0 data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:animate-none!\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport type DialogContentProps = ComponentProps<typeof DialogPrimitive.Content> & {\n  /** The close button in the top corner. Turn it off only when the content has its own way out. */\n  showCloseButton?: boolean;\n  /** The close button's accessible name. Translate it with the rest of the interface. */\n  closeLabel?: string;\n};\n\n/** The window, with its portal and overlay. Never taller or wider than the viewport: it scrolls inside. */\nexport function DialogContent({ className, children, showCloseButton = true, closeLabel = \"Close\", ...props }: DialogContentProps) {\n  return (\n    <DialogPrimitive.Portal>\n      <DialogOverlay />\n      <DialogPrimitive.Content\n        data-slot=\"dialog-content\"\n        className={cn(\n          \"fixed inset-0 z-50 m-auto flex h-fit max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg flex-col gap-4 overflow-y-auto rounded-surface border bg-card p-6 text-card-foreground ease-out animation-duration-(--duration-base) fade-in-0 fade-out-0 zoom-in-95 zoom-out-95 data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:animate-none!\",\n          className,\n        )}\n        {...props}\n      >\n        {children}\n        {showCloseButton ? (\n          <DialogPrimitive.Close\n            data-slot=\"dialog-close-button\"\n            aria-label={closeLabel}\n            className=\"absolute end-2 top-2 inline-flex size-(--control-h) items-center justify-center rounded-control text-muted-foreground transition-[background-color,color] duration-instant ease-out hover:bg-accent hover:text-foreground motion-reduce:transition-none\"\n          >\n            <X aria-hidden=\"true\" strokeWidth={1.5} className=\"size-4\" />\n          </DialogPrimitive.Close>\n        ) : null}\n      </DialogPrimitive.Content>\n    </DialogPrimitive.Portal>\n  );\n}\n\n/** Leaves room at the end for the close button. */\nexport function DialogHeader({ className, ...props }: ComponentProps<\"div\">) {\n  return <div data-slot=\"dialog-header\" className={cn(\"flex flex-col gap-1.5 pe-8 text-start\", className)} {...props} />;\n}\n\nexport function DialogTitle({ className, ...props }: ComponentProps<typeof DialogPrimitive.Title>) {\n  return <DialogPrimitive.Title data-slot=\"dialog-title\" className={cn(\"text-base font-medium leading-tight\", className)} {...props} />;\n}\n\nexport function DialogDescription({ className, ...props }: ComponentProps<typeof DialogPrimitive.Description>) {\n  return <DialogPrimitive.Description data-slot=\"dialog-description\" className={cn(\"text-sm text-muted-foreground\", className)} {...props} />;\n}\n\n/** Actions: stacked on phones with the main action first, in a row at the end from `sm`. */\nexport function DialogFooter({ className, ...props }: ComponentProps<\"div\">) {\n  return <div data-slot=\"dialog-footer\" className={cn(\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\", className)} {...props} />;\n}\n"
    }
  ],
  "meta": {
    "category": "ui",
    "when": "A short task or a decision that must be finished or dismissed before going on. For a panel from an edge (menus, filters, details) use sheet; for something small attached to a control use popover. Always give it a DialogTitle (add className=\"sr-only\" to hide it). Opened by a DialogTrigger, focus returns to that trigger on close. Opened by state with no trigger (a shortcut, a menu item), Radix has nothing to return to: remember the opener (`opener.current = document.activeElement` before opening) and refocus it in `onCloseAutoFocus={(event) => { event.preventDefault(); opener.current?.focus(); }}` on DialogContent.",
    "example": "<Dialog>\n  <DialogTrigger asChild><Button variant=\"outline\">Rename</Button></DialogTrigger>\n  <DialogContent>\n    <DialogHeader>\n      <DialogTitle>Rename project</DialogTitle>\n      <DialogDescription>The address of the project does not change.</DialogDescription>\n    </DialogHeader>\n    <input aria-label=\"Name\" defaultValue=\"Atlas\" className=\"h-control rounded-control border border-input px-3 text-base\" />\n    <DialogFooter>\n      <DialogClose asChild><Button variant=\"outline\">Cancel</Button></DialogClose>\n      <Button>Save</Button>\n    </DialogFooter>\n  </DialogContent>\n</Dialog>",
    "client": true
  }
}
