blockiesui
Version:
A UI library for Blockies
59 lines (56 loc) • 4.4 kB
JavaScript
import { __rest, __assign } from '../../node_modules/.pnpm/@rollup_plugin-typescript@1_1c5553510af13619ab22a8c63104fe51/node_modules/tslib/tslib.es6.js';
import { jsx, jsxs } from 'react/jsx-runtime';
import * as React from 'react';
import { Overlay, Portal, Content, Close, Title, Description, Root, Trigger } from '../../node_modules/.pnpm/@radix-ui_react-dialog@1.1._6fb400f3bbe3d7c4c31990790be0171a/node_modules/@radix-ui/react-dialog/dist/index.js';
import { Cross2Icon } from '../../node_modules/.pnpm/@radix-ui_react-icons@1.3.2_react@18.3.1/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js';
import { cva } from '../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
import { cn } from '../../utils/cn.js';
var Sheet = Root;
var SheetTrigger = Trigger;
var SheetClose = Close;
var SheetPortal = Portal;
var SheetOverlay = React.forwardRef(function (_a, ref) {
var className = _a.className, props = __rest(_a, ["className"]);
return (jsx(Overlay, __assign({ className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className || "") }, props, { ref: ref })));
});
SheetOverlay.displayName = Overlay.displayName;
var sheetVariants = cva("fixed z-50 gap-4 bg-background 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", {
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",
},
});
var SheetContent = React.forwardRef(function (_a, ref) {
var _b = _a.side, side = _b === void 0 ? "right" : _b, className = _a.className, children = _a.children, props = __rest(_a, ["side", "className", "children"]);
return (jsxs(SheetPortal, { children: [jsx(SheetOverlay, {}), jsxs(Content, __assign({ ref: ref, className: cn(sheetVariants({ side: side }), className || "") }, props, { children: [jsxs(Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [jsx(Cross2Icon, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "Close" })] }), children] }))] }));
});
SheetContent.displayName = Content.displayName;
var SheetHeader = function (_a) {
var className = _a.className, props = __rest(_a, ["className"]);
return (jsx("div", __assign({ className: cn("flex flex-col space-y-2 text-center sm:text-left", className || "") }, props)));
};
SheetHeader.displayName = "SheetHeader";
var SheetFooter = function (_a) {
var className = _a.className, props = __rest(_a, ["className"]);
return (jsx("div", __assign({ className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className || "") }, props)));
};
SheetFooter.displayName = "SheetFooter";
var SheetTitle = React.forwardRef(function (_a, ref) {
var className = _a.className, props = __rest(_a, ["className"]);
return (jsx(Title, __assign({ ref: ref, className: cn("text-lg font-semibold text-foreground", className || "") }, props)));
});
SheetTitle.displayName = Title.displayName;
var SheetDescription = React.forwardRef(function (_a, ref) {
var className = _a.className, props = __rest(_a, ["className"]);
return (jsx(Description, __assign({ ref: ref, className: cn("text-sm text-muted-foreground", className || "") }, props)));
});
SheetDescription.displayName = Description.displayName;
export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger };
//# sourceMappingURL=sheet.js.map