@crossed/ui
Version:
A universal & performant styling library for React Native, Next.js & React
68 lines (67 loc) • 2.21 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Root_exports = {};
__export(Root_exports, {
CardRoot: () => CardRoot
});
module.exports = __toCommonJS(Root_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_react = require("react");
var import_layout = require("../../layout");
var import_styled = require("@crossed/styled");
var import_styles = require("./styles");
var import_useMedia = require("../../useMedia");
const CardRoot = (0, import_react.forwardRef)(
({ role, style, size = "auto", ...props }, ref) => {
const { md, xl } = (0, import_useMedia.useMedia)();
const space = (0, import_react.useMemo)(() => {
if (size === "sm")
return "xs";
if (size === "xs")
return "xxs";
if (size === "auto") {
if (xl)
return "lg";
if (md)
return "md";
}
return "xs";
}, [size, md, xl]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_layout.YBox,
{
ref,
role,
space,
...props,
style: (0, import_styled.composeStyles)(
import_styles.cardStyles.root,
import_styles.spacingStyle[size],
props.pressable && import_styles.cardStyles.rootLink,
style
)
}
);
}
);
CardRoot.displayName = "Card";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
CardRoot
});
//# sourceMappingURL=Root.js.map