@heroui/card
Version:
Card is a container for text, photos, and actions in the context of a single subject.
52 lines (48 loc) • 2.22 kB
JavaScript
"use client";
;
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);
// src/card-header.tsx
var card_header_exports = {};
__export(card_header_exports, {
default: () => card_header_default
});
module.exports = __toCommonJS(card_header_exports);
var import_system = require("@heroui/system");
var import_react_utils2 = require("@heroui/react-utils");
var import_shared_utils = require("@heroui/shared-utils");
// src/card-context.ts
var import_react_utils = require("@heroui/react-utils");
var [CardProvider, useCardContext] = (0, import_react_utils.createContext)({
name: "CardContext",
strict: true,
errorMessage: "useCardContext: `context` is undefined. Seems you forgot to wrap component within <Card />"
});
// src/card-header.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var CardHeader = (0, import_system.forwardRef)((props, ref) => {
var _a;
const { as, className, children, ...otherProps } = props;
const Component = as || "div";
const domRef = (0, import_react_utils2.useDOMRef)(ref);
const { slots, classNames } = useCardContext();
const headerStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.header, className);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref: domRef, className: (_a = slots.header) == null ? void 0 : _a.call(slots, { class: headerStyles }), ...otherProps, children });
});
CardHeader.displayName = "HeroUI.CardHeader";
var card_header_default = CardHeader;