UNPKG

@primer/react-brand

Version:

Primer Brand is a GitHub's design system for creating React-based marketing websites and digital experiences.

74 lines (73 loc) 2.72 kB
import e from "../node_modules/clsx/dist/clsx.js"; import { useAnimation as t } from "../animation/useAnimation.js"; import { Text as n } from "../Text/Text.js"; import '../packages/design-tokens/lib/design-tokens/css/tokens/functional/components/statistic/base-DWOQrMC8.css';/* empty css */ import r from "./Statistic.module.js"; import i, { forwardRef as a, useMemo as o } from "react"; import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime"; //#region src/Statistic/Statistic.tsx var u = [ "small", "medium", "large" ], d = [ "none", "condensed", "normal", "spacious" ], f = { root: "Statistic" }, p = { small: "600", medium: "800", large: "1000" }, m = (e, t) => t ? typeof t == "string" || typeof t == "number" ? r[`Statistic--${e}-${t}`] : Object.keys(t).map((n) => r[`Statistic--${n}-${e}-${t[n]}`]).join(" ") : "", h = a(({ animate: n, className: a, children: u, "data-testid": d, size: h = "large", variant: v = "default", padding: y = "none", leadingComponent: b, trailingComponent: x, style: S, ...C }, w) => { let { classes: T, styles: E } = t(n), D = o(() => m("padding", y), [y]), O = o(() => { let e = i.Children.toArray(u).find((e) => i.isValidElement(e) && e.type === g); return i.isValidElement(e) ? e : void 0; }, [u]), k = o(() => { let e = i.Children.toArray(u).find((e) => i.isValidElement(e) && e.type === _); return i.isValidElement(e) ? e : void 0; }, [u]), A = O; return k && A && (A = i.cloneElement(A, { children: /* @__PURE__ */ l(s, { children: [ A.props.children, " ", k ] }) })), /* @__PURE__ */ l("div", { ref: w, className: e(r[`Statistic--variant-${v}`], D, T, a), style: { ...E, ...S }, "data-testid": d || f.root, ...C, children: [ b && /* @__PURE__ */ c(b, {}), A && i.cloneElement(A, { size: A.props.size || p[h] }), x && /* @__PURE__ */ c(x, {}) ] }); }), g = a(({ as: t = "p", className: i, children: a, font: o = "hubot-sans", weight: s = "medium", size: l = "1000", ...u }, d) => /* @__PURE__ */ c(n, { as: t, ref: d, className: e(r.Statistic__heading, i), font: o, weight: s, size: l, ...u, children: a })), _ = a(({ children: t, className: i, size: a = "300", variant: o = "muted", ...s }, l) => /* @__PURE__ */ c(n, { variant: o === "accent" ? "muted" : o, ref: l, size: a, font: "mona-sans", className: e(r.Statistic__description, r[`Statistic__description--${o}`], i), ...s, children: t })), v = Object.assign(h, { Heading: g, Description: _, testIds: f }); //#endregion export { v as Statistic, u as StatisticSizes, d as StatisticSpacingValues }; //# sourceMappingURL=Statistic.js.map