{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "alert-dialog", "title": "Alert Dialog", "description": "A modal dialog that interrupts the user for a critical action.", "dependencies": [ "radix-ui", "sonner" ], "registryDependencies": [ "https://ds.formance.com/r/button.json" ], "files": [ { "path": "registry/default/ui/alert-dialog.tsx", "content": "'use client';\n\nimport { AlertDialog as AlertDialogPrimitive } from 'radix-ui';\nimport * as React from 'react';\nimport { toast } from 'sonner';\n\nimport { Button, buttonVariants } from '@/registry/default/ui/button';\nimport { cn } from '@/lib/utils';\n\nfunction AlertDialog({\n ...props\n}: React.ComponentProps) {\n return ;\n}\n\nfunction AlertDialogTrigger({\n ...props\n}: React.ComponentProps) {\n return (\n \n );\n}\n\nfunction AlertDialogPortal({\n ...props\n}: React.ComponentProps) {\n return (\n \n );\n}\n\nfunction AlertDialogOverlay({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n );\n}\n\nfunction AlertDialogContent({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n \n \n \n );\n}\n\nfunction AlertDialogHeader({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n \n );\n}\n\nfunction AlertDialogFooter({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n \n );\n}\n\nfunction AlertDialogTitle({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n );\n}\n\nfunction AlertDialogDescription({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n );\n}\n\nfunction AlertDialogAction({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n );\n}\n\nfunction AlertDialogCancel({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n );\n}\n\nexport type TConfirmAlertProps = {\n title: string;\n description: string;\n open?: boolean;\n children?: React.ReactNode;\n close: () => void;\n onOpenChange: () => void;\n disabledAction?: boolean;\n action: {\n toast?: string;\n variant?:\n | 'link'\n | 'default'\n | 'destructive'\n | 'outline'\n | 'secondary'\n | 'ghost';\n label: string;\n onClick?: () => void;\n };\n};\n\nfunction AlertConfirm({\n title,\n description,\n open,\n close,\n onOpenChange,\n action,\n disabledAction = false,\n children,\n}: TConfirmAlertProps) {\n return (\n \n \n \n {title}\n {description}\n \n {children && children}\n \n {\n close();\n }}\n >\n Cancel\n \n {\n close();\n if (action.toast) {\n toast.success(action.toast);\n }\n if (action.onClick && !disabledAction) {\n action.onClick();\n }\n }}\n data-testid={`confirm-${action.label.toLowerCase()}`}\n >\n {action.label}\n \n \n \n \n );\n}\n\nexport {\n AlertConfirm,\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" } ], "type": "registry:ui" }