Loading files
"use client"
import * as React from "react"
import { XIcon } from "lucide-react"
import { Dialog as DialogPrimitive } from "radix-ui"
import { cn } from "@/ui/utils"
function Dialog({
...props
}) {
return <DialogPrimitive.Root data-slot="dialog" {...props} />;
}
const DialogTrigger = React.forwardRef(function DialogTrigger({
...props
}, ref) {
return <DialogPrimitive.Trigger ref={ref} data-slot="dialog-trigger" {...props} />;
});
function DialogPortal({
...props
}) {
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
}
const DialogClose = React.forwardRef(function DialogClose({
...props
}, ref) {
return <DialogPrimitive.Close ref={ref} data-slot="dialog-close" {...props} />;
});
const DialogOverlay = React.forwardRef(function DialogOverlay({
className,
...props
}, ref) {
return (
<DialogPrimitive.Overlay
ref={ref}
data-slot="dialog-overlay"
className={cn(
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
className
)}
{...props} />
);
});
const DialogContent = React.forwardRef(function DialogContent({
className,
children,
showCloseButton = true,
...props
}, ref) {
return (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
data-slot="dialog-content"
className={cn(
"cad-glass-popover fixed left-[50%] top-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-md border p-6 text-foreground shadow-lg duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
className
)}
{...props}
>
{children}
{showCloseButton ? (
<DialogPrimitive.Close
data-slot="dialog-close"
className="absolute right-4 top-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none"
>
<XIcon className="size-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
) : null}
</DialogPrimitive.Content>
</DialogPortal>
);
});
function DialogHeader({
className,
...props
}) {
return (
<div
data-slot="dialog-header"
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
{...props} />
);
}
function DialogFooter({
className,
...props
}) {
return (
<div
data-slot="dialog-footer"
className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
{...props} />
);
}
const DialogTitle = React.forwardRef(function DialogTitle({
className,
...props
}, ref) {
return (
<DialogPrimitive.Title
ref={ref}
data-slot="dialog-title"
className={cn("text-lg font-semibold", className)}
{...props} />
);
});
const DialogDescription = React.forwardRef(function DialogDescription({
className,
...props
}, ref) {
return (
<DialogPrimitive.Description
ref={ref}
data-slot="dialog-description"
className={cn("text-sm text-muted-foreground", className)}
{...props} />
);
});
export {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogOverlay,
DialogPortal,
DialogTitle,
DialogTrigger,
}
26e259c5cThis file is pinned to the selected release. Download the original to open it in your design tool.