UNPKG

@hitachivantara/uikit-react-core

Version:
39 lines (38 loc) 1.24 kB
import { fixedForwardRef } from "../types/generic.js"; import { useClasses } from "./Typography.styles.js"; import { useDefaultProps, useTheme } from "@hitachivantara/uikit-react-utils"; import { jsx } from "react/jsx-runtime"; //#region src/Typography/Typography.tsx var HvTypographyMap = { display: "h1", title1: "h1", title2: "h2", title3: "h3", title4: "h4", body: "p", label: "span", captionLabel: "div", caption1: "div", caption2: "div" }; /** * Typography component is used to render text and paragraphs within an interface. */ var HvTypography = fixedForwardRef(function HvTypography(props, ref) { const { className, component: ComponentProp, classes: classesProp, variant = "body", link, noWrap, disabled, ...others } = useDefaultProps("HvTypography", props); const { classes, css, cx } = useClasses(classesProp); const { activeTheme } = useTheme(); return /* @__PURE__ */ jsx(ComponentProp || HvTypographyMap[variant] || "span", { ref, "data-variant": variant, className: cx(css({ ...activeTheme?.typography[variant] }), classes.root, { [classes.isLink]: link, [classes.noWrap]: noWrap, [classes.disabled]: disabled }, className), disabled, ...others }); }); //#endregion export { HvTypography };