{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dialog",
  "title": "Dialog",
  "description": "Modal surface that dims everything else and holds focus until the user answers one question.",
  "dependencies": [
    "radix-ui",
    "lucide-react"
  ],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "registry/miseui/ui/dialog.tsx",
      "content": "import type * as React from \"react\"\nimport { Dialog as DialogPrimitive } from \"radix-ui\"\nimport { X } from \"lucide-react\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\n\nconst PLAIN_CONTENT_MOTION_CLASS = [\n  \"duration-(--duration-base) ease-(--ease-mise)\",\n  \"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n  \"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\",\n]\n\n/**\n * Radix exposes no transform-origin for a dialog, since it has no anchor, so the surface grows from its own centre.\n * The enter and exit values stay unqualified so the media overrides below win on source order.\n */\nconst MATERIALIZE_CLASS = [\n  \"duration-(--duration-slow) ease-(--ease-mise-out) will-change-[transform,opacity,filter]\",\n  \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-(--duration-base)\",\n  \"fade-in-0 zoom-in-90 blur-in-md fade-out-0 zoom-out-90 blur-out-md\",\n  \"motion-reduce:zoom-in-100 motion-reduce:zoom-out-100 motion-reduce:blur-in-0 motion-reduce:blur-out-0\",\n  \"[@media(prefers-reduced-transparency:reduce)]:blur-in-0 [@media(prefers-reduced-transparency:reduce)]:blur-out-0\",\n]\n\n/**\n * A registry component cannot own the app root, so the page cannot really scale back. The overlay fakes that\n * depth: the blur radius grows, and the page loses brightness and colour, as an out-of-focus background does.\n * `blur(0px)` rather than `backdrop-blur-none`: only filter lists of the same shape interpolate.\n */\nconst SCRIM_BLUR_CLASS = [\n  \"bg-background/40 backdrop-blur-xl backdrop-brightness-75 backdrop-saturate-50\",\n  \"transition-[backdrop-filter] duration-(--duration-slow) ease-(--ease-mise-out)\",\n  \"starting:backdrop-blur-[0px] data-[state=closed]:backdrop-blur-[0px] data-[state=closed]:duration-(--duration-base)\",\n  \"motion-reduce:transition-none\",\n  \"[@media(prefers-reduced-transparency:reduce)]:bg-background/90 [@media(prefers-reduced-transparency:reduce)]:backdrop-filter-none\",\n]\n\ntype DialogEffect = \"materialize\" | \"scrim-blur\"\n\nfunction Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n  return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n  return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n  return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n  return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\ntype DialogOverlayProps = React.ComponentProps<typeof DialogPrimitive.Overlay> & {\n  /** `scrim-blur` pushes the page back behind a deep blur; DialogContent passes its own effect through. */\n  effect?: DialogEffect\n}\n\nfunction DialogOverlay({ className, effect, ...props }: DialogOverlayProps) {\n  return (\n    <DialogPrimitive.Overlay\n      data-slot=\"dialog-overlay\"\n      data-effect={effect}\n      className={cn(\n        \"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm\",\n        \"duration-(--duration-base) ease-(--ease-mise)\",\n        \"data-[state=open]:animate-in data-[state=open]:fade-in-0\",\n        \"data-[state=closed]:animate-out data-[state=closed]:fade-out-0\",\n        effect === \"scrim-blur\" && SCRIM_BLUR_CLASS,\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\ntype DialogContentProps = React.ComponentProps<typeof DialogPrimitive.Content> & {\n  /** Hide the corner close button when the footer already offers a way out. */\n  showCloseButton?: boolean\n  /** `materialize` brings the surface into focus; `scrim-blur` pushes the page back behind it. */\n  effect?: DialogEffect\n}\n\nfunction DialogContent({ className, children, showCloseButton = true, effect, ...props }: DialogContentProps) {\n  return (\n    <DialogPortal>\n      <DialogOverlay effect={effect} />\n      <DialogPrimitive.Content\n        data-slot=\"dialog-content\"\n        data-effect={effect}\n        className={cn(\n          \"fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg sm:max-w-lg\",\n          effect === \"materialize\" ? MATERIALIZE_CLASS : PLAIN_CONTENT_MOTION_CLASS,\n          effect === \"scrim-blur\" && \"shadow-2xl\",\n          className,\n        )}\n        {...props}\n      >\n        {children}\n        {showCloseButton && (\n          <DialogPrimitive.Close\n            data-slot=\"dialog-close\"\n            className={cn(\n              \"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background\",\n              \"transition-opacity duration-(--duration-fast) ease-(--ease-mise) hover:opacity-100\",\n              \"focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden\",\n              \"disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\",\n              \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n            )}\n          >\n            <X />\n            <span className=\"sr-only\">Close</span>\n          </DialogPrimitive.Close>\n        )}\n      </DialogPrimitive.Content>\n    </DialogPortal>\n  )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"dialog-header\"\n      className={cn(\"flex flex-col gap-2 text-center sm:text-left\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"dialog-footer\"\n      className={cn(\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n  return (\n    <DialogPrimitive.Title\n      data-slot=\"dialog-title\"\n      className={cn(\"text-lg leading-none font-semibold\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n  return (\n    <DialogPrimitive.Description\n      data-slot=\"dialog-description\"\n      className={cn(\"text-sm text-muted-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Dialog,\n  DialogTrigger,\n  DialogPortal,\n  DialogClose,\n  DialogOverlay,\n  DialogContent,\n  DialogHeader,\n  DialogFooter,\n  DialogTitle,\n  DialogDescription,\n  type DialogContentProps,\n  type DialogOverlayProps,\n  type DialogEffect,\n}\n",
      "type": "registry:ui"
    }
  ],
  "categories": [
    "overlays"
  ],
  "type": "registry:ui"
}