@arolariu/components
Version:
🎨 70+ beautiful, accessible React components built on Radix UI. TypeScript-first, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡
65 lines (64 loc) • 3.71 kB
JavaScript
"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { Action, Cancel, Content, Description, Overlay, Portal, Root, Title, Trigger } from "@radix-ui/react-alert-dialog";
import { forwardRef } from "react";
import { buttonVariants } from "./button.js";
import { cn } from "../../lib/utilities.js";
const AlertDialog = Root;
const AlertDialogTrigger = Trigger;
const AlertDialogPortal = Portal;
const AlertDialogOverlay = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Overlay, {
className: cn("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/80", className),
...props,
ref: ref
}));
AlertDialogOverlay.displayName = Overlay.displayName;
const AlertDialogContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsxs(AlertDialogPortal, {
children: [
/*#__PURE__*/ jsx(AlertDialogOverlay, {}),
/*#__PURE__*/ jsx(Content, {
ref: ref,
className: cn("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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-neutral-200 bg-white p-6 shadow-lg duration-200 sm:rounded-lg dark:border-neutral-800 dark:bg-neutral-950", className),
...props
})
]
}));
AlertDialogContent.displayName = Content.displayName;
const AlertDialogHeader = ({ className, ...props })=>/*#__PURE__*/ jsx("div", {
className: cn("flex flex-col space-y-2 text-center sm:text-left", className),
...props
});
AlertDialogHeader.displayName = "AlertDialogHeader";
const AlertDialogFooter = ({ className, ...props })=>/*#__PURE__*/ jsx("div", {
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
...props
});
AlertDialogFooter.displayName = "AlertDialogFooter";
const AlertDialogTitle = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Title, {
ref: ref,
className: cn("text-lg font-semibold", className),
...props
}));
AlertDialogTitle.displayName = Title.displayName;
const AlertDialogDescription = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Description, {
ref: ref,
className: cn("text-sm text-neutral-500 dark:text-neutral-400", className),
...props
}));
AlertDialogDescription.displayName = Description.displayName;
const AlertDialogAction = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Action, {
ref: ref,
className: cn(buttonVariants(), className),
...props
}));
AlertDialogAction.displayName = Action.displayName;
const AlertDialogCancel = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Cancel, {
ref: ref,
className: cn(buttonVariants({
variant: "outline"
}), "mt-2 sm:mt-0", className),
...props
}));
AlertDialogCancel.displayName = Cancel.displayName;
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
//# sourceMappingURL=alert-dialog.js.map