@easy-shadcn/react
Version:
Use shadcn/ui easy&enhance like component library
100 lines (94 loc) • 3.25 kB
JavaScript
;
var utils = require('@easy-shadcn/utils');
var React = require('react');
var jsxRuntime = require('react/jsx-runtime');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespace(React);
var Card = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
"div",
{
ref,
className: utils.cn(
"rounded-xl border bg-card text-card-foreground shadow",
className
),
...props
}
));
Card.displayName = "Card";
var CardHeader = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
"div",
{
ref,
className: utils.cn("flex flex-col space-y-1.5 p-6", className),
...props
}
));
CardHeader.displayName = "CardHeader";
var CardTitle = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
"div",
{
ref,
className: utils.cn("font-semibold leading-none tracking-tight", className),
...props
}
));
CardTitle.displayName = "CardTitle";
var CardDescription = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
"div",
{
ref,
className: utils.cn("text-sm text-muted-foreground", className),
...props
}
));
CardDescription.displayName = "CardDescription";
var CardContent = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: utils.cn("p-6 pt-0", className), ...props }));
CardContent.displayName = "CardContent";
var CardFooter = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
"div",
{
ref,
className: utils.cn("flex items-center p-6 pt-0", className),
...props
}
));
CardFooter.displayName = "CardFooter";
var Card2 = ({
headerProps,
title,
titleProps,
description,
descriptionProps,
content,
contentProps,
footer,
footerProps,
...resetProps
}) => {
return /* @__PURE__ */ jsxRuntime.jsxs(Card, { ...resetProps, className: utils.cn("py-6 space-y-6", resetProps?.className), children: [
(title || description) && /* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { ...headerProps, className: utils.cn("px-6 py-0", headerProps?.className), children: [
title && /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { ...titleProps, children: title }),
description && /* @__PURE__ */ jsxRuntime.jsx(CardDescription, { ...descriptionProps, children: description })
] }),
content && /* @__PURE__ */ jsxRuntime.jsx(CardContent, { ...contentProps, className: utils.cn("px-6 py-0", contentProps?.className), children: content }),
footer && /* @__PURE__ */ jsxRuntime.jsx(CardFooter, { ...footerProps, className: utils.cn("px-6 py-0", footerProps?.className), children: footer })
] });
};
exports.Card = Card2;