@arolariu/components
Version:
🎨 70+ beautiful, accessible React components built on Base UI. TypeScript-first, CSS Modules styling, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡
138 lines (137 loc) • 4.91 kB
JavaScript
"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { Drawer } from "@base-ui/react/drawer";
import { mergeProps } from "@base-ui/react/merge-props";
import { useRender } from "@base-ui/react/use-render";
import { cn } from "../../lib/utilities.js";
import drawer_module from "./drawer.module.js";
import * as __rspack_external_react from "react";
function drawer_Drawer(props) {
return /*#__PURE__*/ jsx(Drawer.Root, {
...props
});
}
const DrawerTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef((props, ref)=>{
const { className, children, render, ...otherProps } = props;
return /*#__PURE__*/ jsx(Drawer.Trigger, {
ref: ref,
...otherProps,
render: useRender({
defaultTagName: "button",
render: render,
props: mergeProps({
className
}, {})
}),
children: children
});
});
const DrawerPortal = Drawer.Portal;
const DrawerClose = Drawer.Close;
function DrawerOverlay(props) {
const { className, render, ...otherProps } = props;
return /*#__PURE__*/ jsx(Drawer.Backdrop, {
...otherProps,
render: useRender({
defaultTagName: "div",
render: render,
props: mergeProps({
className: cn(drawer_module.backdrop, className)
}, {})
})
});
}
const DrawerContent = /*#__PURE__*/ __rspack_external_react.forwardRef((props, ref)=>{
const { className, children, render, ...otherProps } = props;
return /*#__PURE__*/ jsxs(DrawerPortal, {
children: [
/*#__PURE__*/ jsx(DrawerOverlay, {}),
/*#__PURE__*/ jsxs(Drawer.Popup, {
ref: ref,
...otherProps,
render: useRender({
defaultTagName: "div",
render: render,
props: mergeProps({
className: cn(drawer_module.popup, className)
}, {})
}),
children: [
/*#__PURE__*/ jsx("div", {
className: drawer_module.handle
}),
/*#__PURE__*/ jsx(Drawer.Content, {
className: drawer_module.content,
children: children
})
]
})
]
});
});
function DrawerHeader(props) {
const { asChild = false, children, className, render, ...otherProps } = props;
const renderProp = asChild && /*#__PURE__*/ __rspack_external_react.isValidElement(children) ? children : render;
return useRender({
defaultTagName: "div",
render: renderProp,
props: mergeProps({
className: cn(drawer_module.header, className)
}, otherProps, {
children: renderProp ? void 0 : children
})
});
}
function DrawerFooter(props) {
const { asChild = false, children, className, render, ...otherProps } = props;
const renderProp = asChild && /*#__PURE__*/ __rspack_external_react.isValidElement(children) ? children : render;
return useRender({
defaultTagName: "div",
render: renderProp,
props: mergeProps({
className: cn(drawer_module.footer, className)
}, otherProps, {
children: renderProp ? void 0 : children
})
});
}
function DrawerTitle(props) {
const { className, children, render, ...otherProps } = props;
return /*#__PURE__*/ jsx(Drawer.Title, {
...otherProps,
render: useRender({
defaultTagName: "h2",
render: render,
props: mergeProps({
className: cn(drawer_module.title, className)
}, {})
}),
children: children
});
}
function DrawerDescription(props) {
const { className, children, render, ...otherProps } = props;
return /*#__PURE__*/ jsx(Drawer.Description, {
...otherProps,
render: useRender({
defaultTagName: "p",
render: render,
props: mergeProps({
className: cn(drawer_module.description, className)
}, {})
}),
children: children
});
}
drawer_Drawer.displayName = "Drawer";
DrawerTrigger.displayName = "DrawerTrigger";
DrawerPortal.displayName = "DrawerPortal";
DrawerClose.displayName = "DrawerClose";
DrawerOverlay.displayName = "DrawerOverlay";
DrawerContent.displayName = "DrawerContent";
DrawerHeader.displayName = "DrawerHeader";
DrawerFooter.displayName = "DrawerFooter";
DrawerTitle.displayName = "DrawerTitle";
DrawerDescription.displayName = "DrawerDescription";
export { DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, drawer_Drawer as Drawer };
//# sourceMappingURL=drawer.js.map