UNPKG

@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! ⚡

83 lines (82 loc) • 4.33 kB
"use client"; import { jsx, jsxs } from "react/jsx-runtime"; import { Close, Content, Description, Overlay, Portal, Root, Title, Trigger } from "@radix-ui/react-dialog"; import { cva } from "class-variance-authority"; import { X } from "lucide-react"; import { forwardRef } from "react"; import { cn } from "../../lib/utilities.js"; const Sheet = Root; const SheetTrigger = Trigger; const SheetClose = Close; const SheetPortal = Portal; const SheetOverlay = /*#__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 })); SheetOverlay.displayName = Overlay.displayName; const sheetVariants = cva("fixed z-50 gap-4 bg-white p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out dark:bg-neutral-950", { variants: { side: { top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm" } }, defaultVariants: { side: "right" } }); const SheetContent = /*#__PURE__*/ forwardRef(({ side = "right", className, children, ...props }, ref)=>/*#__PURE__*/ jsxs(SheetPortal, { children: [ /*#__PURE__*/ jsx(SheetOverlay, {}), /*#__PURE__*/ jsxs(Content, { ref: ref, className: cn(sheetVariants({ side }), className), ...props, 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 dark:ring-offset-neutral-950 dark:focus:ring-neutral-300 dark:data-[state=open]:bg-neutral-800", children: [ /*#__PURE__*/ jsx(X, { className: "h-4 w-4" }), /*#__PURE__*/ jsx("span", { className: "sr-only", children: "Close" }) ] }), children ] }) ] })); SheetContent.displayName = Content.displayName; const SheetHeader = ({ className, ...props })=>/*#__PURE__*/ jsx("div", { className: cn("flex flex-col space-y-2 text-center sm:text-left", className), ...props }); SheetHeader.displayName = "SheetHeader"; const SheetFooter = ({ className, ...props })=>/*#__PURE__*/ jsx("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props }); SheetFooter.displayName = "SheetFooter"; const SheetTitle = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Title, { ref: ref, className: cn("text-lg font-semibold text-neutral-950 dark:text-neutral-50", className), ...props })); SheetTitle.displayName = Title.displayName; const SheetDescription = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Description, { ref: ref, className: cn("text-sm text-neutral-500 dark:text-neutral-400", className), ...props })); SheetDescription.displayName = Description.displayName; export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger }; //# sourceMappingURL=sheet.js.map