Path: blob/master/gate-controller/components/ui/alert-dialog.tsx
1091 views
"use client"12import * as React from "react"3import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"45import { cn } from "@/lib/utils"6import { buttonVariants } from "@/components/ui/button"78function AlertDialog({9...props10}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {11return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />12}1314function AlertDialogTrigger({15...props16}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {17return (18<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />19)20}2122function AlertDialogPortal({23...props24}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {25return (26<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />27)28}2930function AlertDialogOverlay({31className,32...props33}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {34return (35<AlertDialogPrimitive.Overlay36data-slot="alert-dialog-overlay"37className={cn(38"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",39className40)}41{...props}42/>43)44}4546function AlertDialogContent({47className,48...props49}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {50return (51<AlertDialogPortal>52<AlertDialogOverlay />53<AlertDialogPrimitive.Content54data-slot="alert-dialog-content"55className={cn(56"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",57className58)}59{...props}60/>61</AlertDialogPortal>62)63}6465function AlertDialogHeader({66className,67...props68}: React.ComponentProps<"div">) {69return (70<div71data-slot="alert-dialog-header"72className={cn("flex flex-col gap-2 text-center sm:text-left", className)}73{...props}74/>75)76}7778function AlertDialogFooter({79className,80...props81}: React.ComponentProps<"div">) {82return (83<div84data-slot="alert-dialog-footer"85className={cn(86"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",87className88)}89{...props}90/>91)92}9394function AlertDialogTitle({95className,96...props97}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {98return (99<AlertDialogPrimitive.Title100data-slot="alert-dialog-title"101className={cn("text-lg font-semibold", className)}102{...props}103/>104)105}106107function AlertDialogDescription({108className,109...props110}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {111return (112<AlertDialogPrimitive.Description113data-slot="alert-dialog-description"114className={cn("text-muted-foreground text-sm", className)}115{...props}116/>117)118}119120function AlertDialogAction({121className,122...props123}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {124return (125<AlertDialogPrimitive.Action126className={cn(buttonVariants(), className)}127{...props}128/>129)130}131132function AlertDialogCancel({133className,134...props135}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {136return (137<AlertDialogPrimitive.Cancel138className={cn(buttonVariants({ variant: "outline" }), className)}139{...props}140/>141)142}143144export {145AlertDialog,146AlertDialogPortal,147AlertDialogOverlay,148AlertDialogTrigger,149AlertDialogContent,150AlertDialogHeader,151AlertDialogFooter,152AlertDialogTitle,153AlertDialogDescription,154AlertDialogAction,155AlertDialogCancel,156}157158159