@hitachivantara/uikit-react-core
Version:
Core React components for the NEXT Design System.
56 lines (55 loc) • 1.58 kB
JavaScript
import { jsxs, jsx } from "react/jsx-runtime";
import { forwardRef } from "react";
import { useDefaultProps, mergeStyles } from "@hitachivantara/uikit-react-utils";
import { getColor } from "@hitachivantara/uikit-styles";
import { useClasses } from "./Card.styles.js";
import { staticClasses } from "./Card.styles.js";
const HvCard = forwardRef(function HvCard2(props, ref) {
const {
classes: classesProp,
style,
className,
children,
icon,
selectable,
selected,
statusColor = "sema0",
bgcolor,
...others
} = useDefaultProps("HvCard", props);
const { classes, cx } = useClasses(classesProp);
const barColor = statusColor !== "sema0" && statusColor || selected && "text" || void 0;
return /* @__PURE__ */ jsxs(
"div",
{
ref,
style: mergeStyles(style, {
"--bg-color": getColor(bgcolor),
"--bar-height": selected && "4px",
"--bar-color": getColor(barColor)
}),
"data-color": statusColor,
className: cx(
"HvIsCardGridElement",
classes.root,
{
[classes.selectable]: selectable,
[classes.selected]: selected
},
className
),
...others,
children: [
/* @__PURE__ */ jsxs("div", { className: classes.semanticContainer, children: [
/* @__PURE__ */ jsx("div", { className: classes.semanticBar }),
/* @__PURE__ */ jsx("div", { className: classes.icon, children: icon })
] }),
children
]
}
);
});
export {
HvCard,
staticClasses as cardClasses
};