{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "alert-dialog",
  "title": "Alert Dialog",
  "description": "Confirm destructive or irreversible actions with Base UI Alert Dialog.",
  "dependencies": [
    "@base-ui/react",
    "motion"
  ],
  "registryDependencies": [
    "@atroui/utils",
    "@atroui/motion",
    "@atroui/button"
  ],
  "files": [
    {
      "path": "registry/default/ui/alert-dialog.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { AlertDialog as AlertDialogPrimitive } from \"@base-ui/react/alert-dialog\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\n\nimport {\n  backdropMotion,\n  dialogContentMotion,\n} from \"@/lib/motion\"\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"./button\"\n\n/** Layered overlay elevation — heaviest stack. */\nconst dialogElevation = \"ds-elev-overlay\"\n\ntype AlertDialogOpenContextValue = {\n  open: boolean\n}\n\nconst AlertDialogOpenContext =\n  React.createContext<AlertDialogOpenContextValue | null>(null)\n\nfunction useAlertDialogOpen() {\n  const ctx = React.useContext(AlertDialogOpenContext)\n  if (!ctx) {\n    throw new Error(\"AlertDialog parts must be used within <AlertDialog>\")\n  }\n  return ctx.open\n}\n\nfunction AlertDialog({\n  open: openProp,\n  defaultOpen = false,\n  onOpenChange,\n  ...props\n}: AlertDialogPrimitive.Root.Props) {\n  const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen)\n  const isControlled = openProp !== undefined\n  const open = isControlled ? openProp : uncontrolledOpen\n\n  const handleOpenChange = React.useCallback<\n    NonNullable<AlertDialogPrimitive.Root.Props[\"onOpenChange\"]>\n  >(\n    (next, eventDetails) => {\n      if (!isControlled) setUncontrolledOpen(next)\n      onOpenChange?.(next, eventDetails)\n    },\n    [isControlled, onOpenChange]\n  )\n\n  return (\n    <AlertDialogOpenContext.Provider value={{ open }}>\n      <AlertDialogPrimitive.Root\n        data-slot=\"alert-dialog\"\n        open={open}\n        onOpenChange={handleOpenChange}\n        {...props}\n      />\n    </AlertDialogOpenContext.Provider>\n  )\n}\n\nfunction AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props) {\n  return (\n    <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n  )\n}\n\nfunction AlertDialogPortal({ ...props }: AlertDialogPrimitive.Portal.Props) {\n  return (\n    <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />\n  )\n}\n\nfunction AlertDialogOverlay({\n  className,\n  render,\n  ...props\n}: AlertDialogPrimitive.Backdrop.Props) {\n  const reduce = useReducedMotion()\n  return (\n    <AlertDialogPrimitive.Backdrop\n      data-slot=\"alert-dialog-overlay\"\n      className={cn(\"dialog-overlay fixed inset-0 isolate z-50\", className)}\n      render={render ?? <motion.div {...backdropMotion(reduce)} />}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogContent({\n  className,\n  size = \"default\",\n  render,\n  ...props\n}: AlertDialogPrimitive.Popup.Props & {\n  size?: \"default\" | \"sm\"\n}) {\n  const open = useAlertDialogOpen()\n  const reduce = useReducedMotion()\n\n  return (\n    <AnimatePresence>\n      {open ? (\n        <AlertDialogPortal keepMounted key=\"alert-dialog-portal\">\n          <AlertDialogOverlay />\n          <AlertDialogPrimitive.Popup\n            data-slot=\"alert-dialog-content\"\n            data-size={size}\n            className={cn(\n              \"group/alert-dialog-content fixed top-1/2 left-1/2 z-50 flex w-full max-w-[calc(100%-2rem)] flex-col gap-4 overflow-hidden rounded-[var(--atro-panel-radius,var(--radius))] bg-popover p-5 text-sm text-popover-foreground outline-none\",\n              \"data-[size=default]:sm:max-w-md data-[size=sm]:sm:max-w-sm\",\n              dialogElevation,\n              className\n            )}\n            render={render ?? <motion.div {...dialogContentMotion(reduce)} />}\n            {...props}\n          />\n        </AlertDialogPortal>\n      ) : null}\n    </AnimatePresence>\n  )\n}\n\nfunction AlertDialogHeader({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"alert-dialog-header\"\n      className={cn(\"flex flex-col gap-2\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogFooter({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"alert-dialog-footer\"\n      className={cn(\n        \"mt-1 flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogTitle({\n  className,\n  ...props\n}: AlertDialogPrimitive.Title.Props) {\n  return (\n    <AlertDialogPrimitive.Title\n      data-slot=\"alert-dialog-title\"\n      className={cn(\n        \"text-[0.9375rem] font-medium leading-snug tracking-tight\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogDescription({\n  className,\n  ...props\n}: AlertDialogPrimitive.Description.Props) {\n  return (\n    <AlertDialogPrimitive.Description\n      data-slot=\"alert-dialog-description\"\n      className={cn(\"text-sm leading-relaxed text-muted-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogAction({\n  className,\n  variant = \"default\",\n  size = \"default\",\n  ...props\n}: AlertDialogPrimitive.Close.Props &\n  Pick<React.ComponentProps<typeof Button>, \"variant\" | \"size\">) {\n  return (\n    <AlertDialogPrimitive.Close\n      data-slot=\"alert-dialog-action\"\n      className={cn(className)}\n      render={<Button variant={variant} size={size} />}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogCancel({\n  className,\n  variant = \"outline\",\n  size = \"default\",\n  ...props\n}: AlertDialogPrimitive.Close.Props &\n  Pick<React.ComponentProps<typeof Button>, \"variant\" | \"size\">) {\n  return (\n    <AlertDialogPrimitive.Close\n      data-slot=\"alert-dialog-cancel\"\n      className={cn(className)}\n      render={<Button variant={variant} size={size} />}\n      {...props}\n    />\n  )\n}\n\nexport {\n  AlertDialog,\n  AlertDialogAction,\n  AlertDialogCancel,\n  AlertDialogContent,\n  AlertDialogDescription,\n  AlertDialogFooter,\n  AlertDialogHeader,\n  AlertDialogOverlay,\n  AlertDialogPortal,\n  AlertDialogTitle,\n  AlertDialogTrigger,\n}\n",
      "type": "registry:ui",
      "target": "components/ui/alert-dialog.tsx"
    }
  ],
  "type": "registry:ui"
}