UNPKG

@hitachivantara/uikit-react-core

Version:

Core React components for the NEXT Design System.

79 lines (78 loc) 2.09 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const jsxRuntime = require("react/jsx-runtime"); const uikitReactUtils = require("@hitachivantara/uikit-react-utils"); const generic = require("../types/generic.cjs"); const Typography_styles = require("./Typography.styles.cjs"); const utils = require("./utils.cjs"); const HvTypographyMap = { display: "h1", title1: "h1", title2: "h2", title3: "h3", title4: "h4", body: "p", label: "span", captionLabel: "div", caption1: "div", caption2: "div", // LEGACY "5xlTitle": "h1", "4xlTitle": "h1", "3xlTitle": "h1", xxlTitle: "h1", xlTitle: "h1", lTitle: "h2", mTitle: "h3", sTitle: "h4", xsTitle: "h5", xxsTitle: "h6", sectionTitle: "p", highlightText: "p", normalText: "p", placeholderText: "p", link: "p", disabledText: "p", selectedNavText: "p", vizText: "p", vizTextDisabled: "p", xsInlineLink: "p" }; const HvTypography = generic.fixedForwardRef(function HvTypography2(props, ref) { const { className, component: ComponentProp, classes: classesProp, variant: variantProp = "body", link = false, noWrap = false, paragraph = false, disabled = false, ...others } = uikitReactUtils.useDefaultProps("HvTypography", props); const { classes, css, cx } = Typography_styles.useClasses(classesProp); const { activeTheme } = uikitReactUtils.useTheme(); const variant = utils.mapVariant(variantProp, activeTheme?.base); const Component = ComponentProp || paragraph && "p" || HvTypographyMap[variant] || "span"; return /* @__PURE__ */ jsxRuntime.jsx( Component, { ref, className: cx( css({ ...activeTheme?.typography[variant] }), classes.root, classes[variant], { [classes.isLink]: link, [classes.noWrap]: noWrap, [classes.disabled]: disabled }, className ), disabled, ...others } ); }); exports.typographyClasses = Typography_styles.staticClasses; exports.HvTypography = HvTypography;