{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "alert-dialog",
  "type": "registry:ui",
  "title": "Alert Dialog",
  "description": "A dialog that interrupts with a question and waits for an answer: it has no close button and does not close on a click outside.",
  "categories": [
    "ui"
  ],
  "dependencies": [
    "class-variance-authority",
    "radix-ui"
  ],
  "registryDependencies": [
    "@rivier-ui/theme",
    "@rivier-ui/button",
    "@rivier-ui/cn"
  ],
  "files": [
    {
      "path": "registry/ui/alert-dialog.tsx",
      "type": "registry:ui",
      "target": "components/ui/alert-dialog.tsx",
      "content": "\"use client\";\n/**\n * @name alert-dialog\n * @category ui\n * @description A dialog that interrupts with a question and waits for an answer: it has no close button and does not close on a click outside.\n * @when Confirming something that cannot be undone (deleting, sending, leaving with unsaved work). Focus starts on AlertDialogCancel, so Enter never destroys by accident. For a task with fields, or anything that may simply be dismissed, use dialog; where the action can be taken back, do it at once and offer undo-line.\n * @example\n * <AlertDialog>\n *   <AlertDialogTrigger asChild><Button variant=\"outline\">Delete project</Button></AlertDialogTrigger>\n *   <AlertDialogContent>\n *     <AlertDialogHeader>\n *       <AlertDialogTitle>Delete this project?</AlertDialogTitle>\n *       <AlertDialogDescription>Its files and history are removed for everyone. This cannot be undone.</AlertDialogDescription>\n *     </AlertDialogHeader>\n *     <AlertDialogFooter>\n *       <AlertDialogCancel>Keep it</AlertDialogCancel>\n *       <AlertDialogAction variant=\"destructive\" onClick={remove}>Delete</AlertDialogAction>\n *     </AlertDialogFooter>\n *   </AlertDialogContent>\n * </AlertDialog>\n */\nimport { AlertDialog as AlertDialogPrimitive } from \"radix-ui\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport type { ComponentProps } from \"react\";\nimport { buttonVariants } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/cn\";\n\nexport function AlertDialog(props: ComponentProps<typeof AlertDialogPrimitive.Root>) {\n  return <AlertDialogPrimitive.Root {...props} />;\n}\n\nexport function AlertDialogTrigger(props: ComponentProps<typeof AlertDialogPrimitive.Trigger>) {\n  return <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />;\n}\n\nexport function AlertDialogOverlay({ className, ...props }: ComponentProps<typeof AlertDialogPrimitive.Overlay>) {\n  return (\n    <AlertDialogPrimitive.Overlay\n      data-slot=\"alert-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\n/** The window, with its portal and overlay. Give it an AlertDialogTitle and an AlertDialogDescription: they are what is read out when it opens. */\nexport function AlertDialogContent({ className, ...props }: ComponentProps<typeof AlertDialogPrimitive.Content>) {\n  return (\n    <AlertDialogPrimitive.Portal>\n      <AlertDialogOverlay />\n      <AlertDialogPrimitive.Content\n        data-slot=\"alert-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-md 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    </AlertDialogPrimitive.Portal>\n  );\n}\n\nexport function AlertDialogHeader({ className, ...props }: ComponentProps<\"div\">) {\n  return <div data-slot=\"alert-dialog-header\" className={cn(\"flex flex-col gap-1.5 text-start\", className)} {...props} />;\n}\n\nexport function AlertDialogTitle({ className, ...props }: ComponentProps<typeof AlertDialogPrimitive.Title>) {\n  return <AlertDialogPrimitive.Title data-slot=\"alert-dialog-title\" className={cn(\"text-base font-medium leading-tight\", className)} {...props} />;\n}\n\nexport function AlertDialogDescription({ className, ...props }: ComponentProps<typeof AlertDialogPrimitive.Description>) {\n  return <AlertDialogPrimitive.Description data-slot=\"alert-dialog-description\" className={cn(\"text-sm text-muted-foreground\", className)} {...props} />;\n}\n\n/** Actions: stacked on phones with the action first, in a row at the end from `sm`. */\nexport function AlertDialogFooter({ className, ...props }: ComponentProps<\"div\">) {\n  return <div data-slot=\"alert-dialog-footer\" className={cn(\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\", className)} {...props} />;\n}\n\ntype ButtonLook = VariantProps<typeof buttonVariants>;\n\n/** The answer that goes ahead. It closes the dialog; `variant=\"destructive\"` when it deletes. */\nexport function AlertDialogAction({ className, variant, size, ...props }: ComponentProps<typeof AlertDialogPrimitive.Action> & ButtonLook) {\n  return <AlertDialogPrimitive.Action data-slot=\"alert-dialog-action\" className={cn(buttonVariants({ variant, size }), className)} {...props} />;\n}\n\n/** The answer that changes nothing. Focus starts here, and Escape does the same. */\nexport function AlertDialogCancel({ className, variant = \"outline\", size, ...props }: ComponentProps<typeof AlertDialogPrimitive.Cancel> & ButtonLook) {\n  return <AlertDialogPrimitive.Cancel data-slot=\"alert-dialog-cancel\" className={cn(buttonVariants({ variant, size }), className)} {...props} />;\n}\n"
    }
  ],
  "meta": {
    "category": "ui",
    "when": "Confirming something that cannot be undone (deleting, sending, leaving with unsaved work). Focus starts on AlertDialogCancel, so Enter never destroys by accident. For a task with fields, or anything that may simply be dismissed, use dialog; where the action can be taken back, do it at once and offer undo-line.",
    "example": "<AlertDialog>\n  <AlertDialogTrigger asChild><Button variant=\"outline\">Delete project</Button></AlertDialogTrigger>\n  <AlertDialogContent>\n    <AlertDialogHeader>\n      <AlertDialogTitle>Delete this project?</AlertDialogTitle>\n      <AlertDialogDescription>Its files and history are removed for everyone. This cannot be undone.</AlertDialogDescription>\n    </AlertDialogHeader>\n    <AlertDialogFooter>\n      <AlertDialogCancel>Keep it</AlertDialogCancel>\n      <AlertDialogAction variant=\"destructive\" onClick={remove}>Delete</AlertDialogAction>\n    </AlertDialogFooter>\n  </AlertDialogContent>\n</AlertDialog>",
    "client": true
  }
}
