@payfit/unity-components
Version:
57 lines (56 loc) • 1.23 kB
JavaScript
import { text as e } from "./Text.variants.js";
import { forwardRef as t, useMemo as n } from "react";
import { jsx as r } from "react/jsx-runtime";
//#region src/components/text/Text.tsx
var i = {
inherit: "span",
displayHeading: "h1",
h1: "h1",
h2: "h2",
h3: "h3",
h4: "h4",
overline: "h6",
subtitle: "h5",
displayTitle: "h1",
displayBody: "p",
body: "p",
bodyStrong: "strong",
bodySmall: "small",
bodySmallStrong: "strong",
bodyLarge: "p",
bodyLargeStrong: "strong",
action: "span",
actionLarge: "span",
actionSmall: "span",
actionInfo: "span"
}, a = t(({ children: t, variant: a, color: o, isTruncated: s, lineClamp: c, asElement: l, className: u, maxWidthCh: d, ...f }, p) => {
let m = c !== void 0, h = n(() => e({
variant: a,
color: o,
isTruncated: s,
isLineClamped: m,
className: u,
hasCharLimit: d !== void 0
}), [
u,
o,
m,
s,
a,
d
]), g = i[a ?? "inherit"];
return /* @__PURE__ */ r(l ?? g, {
"data-dd-privacy": "mask",
...f,
ref: p,
className: h,
style: {
...c !== void 0 && { "--uy-text-line-clamp": c },
...d !== void 0 && { "--uy-text-max-width-ch": `${d}ch` }
},
children: t
});
});
a.displayName = "Text";
//#endregion
export { a as Text };