@primer/react-brand
Version:
Primer Brand is a GitHub's design system for creating React-based marketing websites and digital experiences.
54 lines (53 loc) • 1.67 kB
JavaScript
import e from "../node_modules/clsx/dist/clsx.js";
import { useAnimation as t } from "../animation/useAnimation.js";
import n from "./Text.module.js";
import { useMemo as r } from "react";
import { jsx as i } from "react/jsx-runtime";
//#region src/Text/Text.tsx
var a = [
"1000",
"900",
"800",
"700",
"600",
"500",
"400",
"350",
"300",
"200",
"100"
], o = [
"p",
"span",
"div",
"strong",
"em"
], s = ["default", "muted"], c = [
"heavy",
"extrabold",
"bold",
"semibold",
"medium",
"normal",
"light",
"extralight"
], l = [
"mona-sans",
"hubot-sans",
"monospace"
], u = o[1], d = a[9], f = s[0], p = l[0];
function m({ align: a, animate: o, as: s = u, className: c, children: l, font: m = p, size: h = d, variant: g = f, weight: _, style: v, hasAntiAliasing: y = !0, ...b }) {
let { classes: x, styles: S } = t(o), C = r(() => _ ? typeof _ == "string" ? n[`Text--weight-${_}`] : Object.keys(_).map((e) => n[`Text-${e}--weight-${_[e]}`]).join(" ") : null, [_]), w = !!(!y || _ && ["light", "extralight"].includes(_) && ["100", "200"].includes(h) || h === "100"), T = e(x, n.Text, n[`Text-font--${m}`], n[`Text--${g}`], n[`Text--${h}`], !w && n["Text--antialiased"], _ && C, a && n[`Text-align--${a}`], c);
return i(s === "p" ? "p" : s === "em" ? "em" : s === "div" ? "div" : s === "strong" ? "strong" : "span", {
className: T,
style: {
...S,
...v
},
...b,
children: l
});
}
//#endregion
export { m as Text, l as TextFontVariants, a as TextSizes, o as TextTags, s as TextVariants, c as TextWeights, p as defaultFontVariant, d as defaultTextSize, u as defaultTextTag, f as defaultTextVariant };
//# sourceMappingURL=Text.js.map