{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "primitives-radix-alert-dialog",
  "title": "Radix Alert Dialog",
  "description": "A modal dialog that interrupts the user with important content and expects a response.",
  "dependencies": [
    "motion",
    "radix-ui"
  ],
  "registryDependencies": [
    "@odysseyui/hooks-use-controlled-state",
    "@odysseyui/lib-get-strict-context"
  ],
  "files": [
    {
      "path": "registry/primitives/radix/alert-dialog/index.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { AlertDialog as AlertDialogPrimitive } from 'radix-ui';\nimport { AnimatePresence, motion, type HTMLMotionProps } from 'motion/react';\n\nimport { useControlledState } from '@/hooks/use-controlled-state';\nimport { getStrictContext } from '@/lib/get-strict-context';\n\ntype AlertDialogContextType = {\n  isOpen: boolean;\n  setIsOpen: AlertDialogProps['onOpenChange'];\n};\n\nconst [AlertDialogProvider, useAlertDialog] =\n  getStrictContext<AlertDialogContextType>('AlertDialogContext');\n\ntype AlertDialogProps = React.ComponentProps<typeof AlertDialogPrimitive.Root>;\n\nfunction AlertDialog(props: AlertDialogProps) {\n  const [isOpen, setIsOpen] = useControlledState({\n    value: props?.open,\n    defaultValue: props?.defaultOpen,\n    onChange: props?.onOpenChange,\n  });\n\n  return (\n    <AlertDialogProvider value={{ isOpen, setIsOpen }}>\n      <AlertDialogPrimitive.Root\n        data-slot=\"alert-dialog\"\n        {...props}\n        onOpenChange={setIsOpen}\n      />\n    </AlertDialogProvider>\n  );\n}\n\ntype AlertDialogTriggerProps = React.ComponentProps<\n  typeof AlertDialogPrimitive.Trigger\n>;\n\nfunction AlertDialogTrigger(props: AlertDialogTriggerProps) {\n  return (\n    <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n  );\n}\n\ntype AlertDialogPortalProps = Omit<\n  React.ComponentProps<typeof AlertDialogPrimitive.Portal>,\n  'forceMount'\n>;\n\nfunction AlertDialogPortal(props: AlertDialogPortalProps) {\n  const { isOpen } = useAlertDialog();\n\n  return (\n    <AnimatePresence>\n      {isOpen && (\n        <AlertDialogPrimitive.Portal\n          data-slot=\"alert-dialog-portal\"\n          forceMount\n          {...props}\n        />\n      )}\n    </AnimatePresence>\n  );\n}\n\ntype AlertDialogOverlayProps = Omit<\n  React.ComponentProps<typeof AlertDialogPrimitive.Overlay>,\n  'forceMount' | 'asChild'\n> &\n  HTMLMotionProps<'div'>;\n\nfunction AlertDialogOverlay({\n  transition = { duration: 0.2, ease: 'easeInOut' },\n  ...props\n}: AlertDialogOverlayProps) {\n  return (\n    <AlertDialogPrimitive.Overlay\n      data-slot=\"alert-dialog-overlay\"\n      asChild\n      forceMount\n    >\n      <motion.div\n        key=\"alert-dialog-overlay\"\n        initial={{ opacity: 0, filter: 'blur(4px)' }}\n        animate={{ opacity: 1, filter: 'blur(0px)' }}\n        exit={{ opacity: 0, filter: 'blur(4px)' }}\n        transition={transition}\n        {...props}\n      />\n    </AlertDialogPrimitive.Overlay>\n  );\n}\n\ntype AlertDialogFlipDirection = 'top' | 'bottom' | 'left' | 'right';\n\ntype AlertDialogContentProps = Omit<\n  React.ComponentProps<typeof AlertDialogPrimitive.Content>,\n  'forceMount' | 'asChild'\n> &\n  HTMLMotionProps<'div'> & {\n    from?: AlertDialogFlipDirection;\n  };\n\nfunction AlertDialogContent({\n  from = 'top',\n  onOpenAutoFocus,\n  onCloseAutoFocus,\n  onEscapeKeyDown,\n  transition = { type: 'spring', stiffness: 150, damping: 25 },\n  ...props\n}: AlertDialogContentProps) {\n  const initialRotation =\n    from === 'bottom' || from === 'left' ? '20deg' : '-20deg';\n  const isVertical = from === 'top' || from === 'bottom';\n  const rotateAxis = isVertical ? 'rotateX' : 'rotateY';\n\n  return (\n    <AlertDialogPrimitive.Content\n      asChild\n      forceMount\n      onOpenAutoFocus={onOpenAutoFocus}\n      onCloseAutoFocus={onCloseAutoFocus}\n      onEscapeKeyDown={onEscapeKeyDown}\n    >\n      <motion.div\n        key=\"alert-dialog-content\"\n        data-slot=\"alert-dialog-content\"\n        initial={{\n          opacity: 0,\n          filter: 'blur(4px)',\n          transform: `perspective(500px) ${rotateAxis}(${initialRotation}) scale(0.8)`,\n        }}\n        animate={{\n          opacity: 1,\n          filter: 'blur(0px)',\n          transform: `perspective(500px) ${rotateAxis}(0deg) scale(1)`,\n        }}\n        exit={{\n          opacity: 0,\n          filter: 'blur(4px)',\n          transform: `perspective(500px) ${rotateAxis}(${initialRotation}) scale(0.8)`,\n        }}\n        transition={transition}\n        {...props}\n      />\n    </AlertDialogPrimitive.Content>\n  );\n}\n\ntype AlertDialogCancelProps = React.ComponentProps<\n  typeof AlertDialogPrimitive.Cancel\n>;\n\nfunction AlertDialogCancel(props: AlertDialogCancelProps) {\n  return (\n    <AlertDialogPrimitive.Cancel data-slot=\"alert-dialog-cancel\" {...props} />\n  );\n}\n\ntype AlertDialogActionProps = React.ComponentProps<\n  typeof AlertDialogPrimitive.Action\n>;\n\nfunction AlertDialogAction(props: AlertDialogActionProps) {\n  return (\n    <AlertDialogPrimitive.Action data-slot=\"alert-dialog-action\" {...props} />\n  );\n}\n\ntype AlertDialogHeaderProps = React.ComponentProps<'div'>;\n\nfunction AlertDialogHeader(props: AlertDialogHeaderProps) {\n  return <div data-slot=\"alert-dialog-header\" {...props} />;\n}\n\ntype AlertDialogFooterProps = React.ComponentProps<'div'>;\n\nfunction AlertDialogFooter(props: AlertDialogFooterProps) {\n  return <div data-slot=\"alert-dialog-footer\" {...props} />;\n}\n\ntype AlertDialogTitleProps = React.ComponentProps<\n  typeof AlertDialogPrimitive.Title\n>;\n\nfunction AlertDialogTitle(props: AlertDialogTitleProps) {\n  return (\n    <AlertDialogPrimitive.Title data-slot=\"alert-dialog-title\" {...props} />\n  );\n}\n\ntype AlertDialogDescriptionProps = React.ComponentProps<\n  typeof AlertDialogPrimitive.Description\n>;\n\nfunction AlertDialogDescription(props: AlertDialogDescriptionProps) {\n  return (\n    <AlertDialogPrimitive.Description\n      data-slot=\"alert-dialog-description\"\n      {...props}\n    />\n  );\n}\n\nexport {\n  AlertDialog,\n  AlertDialogPortal,\n  AlertDialogOverlay,\n  AlertDialogCancel,\n  AlertDialogAction,\n  AlertDialogTrigger,\n  AlertDialogContent,\n  AlertDialogHeader,\n  AlertDialogFooter,\n  AlertDialogTitle,\n  AlertDialogDescription,\n  useAlertDialog,\n  type AlertDialogProps,\n  type AlertDialogTriggerProps,\n  type AlertDialogPortalProps,\n  type AlertDialogCancelProps,\n  type AlertDialogActionProps,\n  type AlertDialogOverlayProps,\n  type AlertDialogContentProps,\n  type AlertDialogHeaderProps,\n  type AlertDialogFooterProps,\n  type AlertDialogTitleProps,\n  type AlertDialogDescriptionProps,\n  type AlertDialogContextType,\n  type AlertDialogFlipDirection,\n};\n",
      "type": "registry:ui",
      "target": "components/odysseyui/primitives/radix/alert-dialog.tsx"
    }
  ],
  "type": "registry:ui"
}