| 1 | "use client"; |
| 2 | |
| 3 | import * as React from |
| 4 | import { cn } |
| 5 | import { AlertDialog as |
| 6 | |
| 7 | import { Button } |
| 8 | |
| 9 | function AlertDialog({ |
| 10 | ...props |
| 11 | }: React. |
| 12 | return <AlertDialogPrimitive.Root data-slot |
| 13 | } |
| 14 | |
| 15 | function AlertDialogTrigger({ |
| 16 | ...props |
| 17 | }: React. |
| 18 | return ( |
| 19 | <AlertDialogPrimitive.Trigger data-slot=" |
| 20 | ); |
| 21 | } |
| 22 | |
| 23 | function AlertDialogPortal({ |
| 24 | ...props |
| 25 | }: React. |
| 26 | return ( |
| 27 | <AlertDialogPrimitive.Portal data-slot=" |
| 28 | ); |
| 29 | } |
| 30 | |
| 31 | function AlertDialogOverlay({ |
| 32 | className, |
| 33 | ...props |
| 34 | }: React. |
| 35 | return ( |
| 36 | <AlertDialogPrimitive.Overlay |
| 37 | data-slot="alert-dialog-overlay" |
| 38 | className={cn( |
| 39 | "fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", |
| 40 | className, |
| 41 | )} |
| 42 | {...props} |
| 43 | /> |
| 44 | ); |
| 45 | } |
| 46 | |
| 47 | function AlertDialogContent({ |
| 48 | className, |
| 49 | size = "default" |
| 50 | ...props |
| 51 | }: React. |
| 52 | size?: " |
| 53 | }) { |
| 54 | return ( |
| 55 | <AlertDialogPortal> |
| 56 | <AlertDialogOverlay /> |
| 57 | <AlertDialogPrimitive.Content |
| 58 | data-slot="alert-dialog-content" |
| 59 | data-size={size} |
| 60 | className={cn( |
| 61 | "group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", |
| 62 | className, |
| 63 | )} |
| 64 | {...props} |
| 65 | /> |
| 66 | </AlertDialogPortal> |
| 67 | ); |
| 68 | } |
| 69 | |
| 70 | function AlertDialogHeader({ |
| 71 | className, |
| 72 | ...props |
| 73 | }: React. |
| 74 | return ( |
| 75 | <div |
| 76 | data-slot="alert-dialog-header" |
| 77 | className={cn( |
| 78 | "grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", |
| 79 | className, |
| 80 | )} |
| 81 | {...props} |
| 82 | /> |
| 83 | ); |
| 84 | } |
| 85 | |
| 86 | function AlertDialogFooter({ |
| 87 | className, |
| 88 | ...props |
| 89 | }: React. |
| 90 | return ( |
| 91 | <div |
| 92 | data-slot="alert-dialog-footer" |
| 93 | className={cn( |
| 94 | "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end", |
| 95 | className, |
| 96 | )} |
| 97 | {...props} |
| 98 | /> |
| 99 | ); |
| 100 | } |
| 101 | |
| 102 | function AlertDialogMedia({ |
| 103 | className, |
| 104 | ...props |
| 105 | }: React. |
| 106 | return ( |
| 107 | <div |
| 108 | data-slot="alert-dialog-media" |
| 109 | className={cn( |
| 110 | "mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6", |
| 111 | className, |
| 112 | )} |
| 113 | {...props} |
| 114 | /> |
| 115 | ); |
| 116 | } |
| 117 | |
| 118 | function AlertDialogTitle({ |
| 119 | className, |
| 120 | ...props |
| 121 | }: React. |
| 122 | return ( |
| 123 | <AlertDialogPrimitive.Title |
| 124 | data-slot="alert-dialog-title" |
| 125 | className={cn( |
| 126 | "font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", |
| 127 | className, |
| 128 | )} |
| 129 | {...props} |
| 130 | /> |
| 131 | ); |
| 132 | } |
| 133 | |
| 134 | function AlertDialogDescription({ |
| 135 | className, |
| 136 | ...props |
| 137 | }: React. |
| 138 | return ( |
| 139 | <AlertDialogPrimitive.Description |
| 140 | data-slot="alert-dialog-description" |
| 141 | className={cn( |
| 142 | "text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", |
| 143 | className, |
| 144 | )} |
| 145 | {...props} |
| 146 | /> |
| 147 | ); |
| 148 | } |
| 149 | |
| 150 | function AlertDialogAction({ |
| 151 | className, |
| 152 | variant = "default" |
| 153 | size = "default" |
| 154 | ...props |
| 155 | }: React. |
| 156 | Pick<React |
| 157 | return ( |
| 158 | <Button variant={ |
| 159 | <AlertDialogPrimitive.Action |
| 160 | data-slot="alert-dialog-action" |
| 161 | className={cn(className |
| 162 | {...props} |
| 163 | /> |
| 164 | </Button> |
| 165 | ); |
| 166 | } |
| 167 | |
| 168 | function AlertDialogCancel({ |
| 169 | className, |
| 170 | variant = "outline" |
| 171 | size = "default" |
| 172 | ...props |
| 173 | }: React. |
| 174 | Pick<React |
| 175 | return ( |
| 176 | <Button variant={ |
| 177 | <AlertDialogPrimitive.Cancel |
| 178 | data-slot="alert-dialog-cancel" |
| 179 | className={cn(className |
| 180 | {...props} |
| 181 | /> |
| 182 | </Button> |
| 183 | ); |
| 184 | } |
| 185 | |
| 186 | export { |
| 187 | AlertDialog, |
| 188 | AlertDialogAction, |
| 189 | AlertDialogCancel, |
| 190 | AlertDialogContent, |
| 191 | AlertDialogDescription, |
| 192 | AlertDialogFooter, |
| 193 | AlertDialogHeader, |
| 194 | AlertDialogMedia, |
| 195 | AlertDialogOverlay, |
| 196 | AlertDialogPortal, |
| 197 | AlertDialogTitle, |
| 198 | AlertDialogTrigger, |
| 199 | }; |