@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! ⚡
67 lines (66 loc) • 3.98 kB
JavaScript
"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { Close, Content, Description, Overlay, Portal, Root, Title, Trigger } from "@radix-ui/react-dialog";
import { X } from "lucide-react";
import { forwardRef } from "react";
import { cn } from "../../lib/utilities.js";
const Dialog = Root;
const DialogTrigger = Trigger;
const DialogPortal = Portal;
const DialogClose = Close;
const DialogOverlay = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Overlay, {
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 fixed inset-0 z-50 bg-black/80", className),
...props
}));
DialogOverlay.displayName = Overlay.displayName;
const DialogContent = /*#__PURE__*/ forwardRef(({ className, children, ...props }, ref)=>/*#__PURE__*/ jsxs(DialogPortal, {
children: [
/*#__PURE__*/ jsx(DialogOverlay, {}),
/*#__PURE__*/ jsxs(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,
children: [
children,
/*#__PURE__*/ jsxs(Close, {
className: "absolute top-4 right-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-500 dark:ring-offset-neutral-950 dark:focus:ring-neutral-300 dark:data-[state=open]:bg-neutral-800 dark:data-[state=open]:text-neutral-400",
children: [
/*#__PURE__*/ jsx(X, {
className: "h-4 w-4"
}),
/*#__PURE__*/ jsx("span", {
className: "sr-only",
children: "Close"
})
]
})
]
})
]
}));
DialogContent.displayName = Content.displayName;
const DialogHeader = ({ className, ...props })=>/*#__PURE__*/ jsx("div", {
className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className),
...props
});
DialogHeader.displayName = "DialogHeader";
const DialogFooter = ({ className, ...props })=>/*#__PURE__*/ jsx("div", {
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
...props
});
DialogFooter.displayName = "DialogFooter";
const DialogTitle = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Title, {
ref: ref,
className: cn("text-lg leading-none font-semibold tracking-tight", className),
...props
}));
DialogTitle.displayName = Title.displayName;
const DialogDescription = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Description, {
ref: ref,
className: cn("text-sm text-neutral-500 dark:text-neutral-400", className),
...props
}));
DialogDescription.displayName = Description.displayName;
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
//# sourceMappingURL=dialog.js.map