@postenbring/hedwig-react
Version:
React components for [Hedwig Design System](https://github.com/bring/hedwig-design-system).
69 lines (67 loc) • 1.55 kB
JavaScript
import {
__objRest,
__spreadProps,
__spreadValues
} from "./chunk-YOSPWY5K.mjs";
// src/text/text.tsx
import { forwardRef } from "react";
import { clsx } from "@postenbring/hedwig-css/typed-classname";
import { Slot } from "@radix-ui/react-slot";
import { jsx } from "react/jsx-runtime";
var defaultHTMLTag = {
"h1-display": "h1",
h1: "h1",
h2: "h2",
h3: "h3",
"h3-title": "h3",
body: "p",
"body-title": "p",
"body-small": "p",
"body-small-title": "p",
technical: "p",
"technical-title": "p",
caption: "p",
"caption-title": "p"
};
var Text = forwardRef(
(_a, ref) => {
var _b = _a, {
as: Tag,
asChild,
variant = "body",
size = "fluid",
_unstableSpacing: spacing,
children,
className
} = _b, rest = __objRest(_b, [
"as",
"asChild",
"variant",
"size",
"_unstableSpacing",
"children",
"className"
]);
const Component = asChild ? Slot : Tag != null ? Tag : defaultHTMLTag[variant];
const sizeModifier = size !== "fluid" && variant !== "caption" && variant !== "caption-title" && size;
return /* @__PURE__ */ jsx(
Component,
__spreadProps(__spreadValues({
className: clsx(
`hds-text-${variant}`,
sizeModifier && `hds-text--${sizeModifier}`,
spacing && "hds-text--spacing",
className
),
ref
}, rest), {
children
})
);
}
);
Text.displayName = "Text";
export {
Text
};
//# sourceMappingURL=chunk-DMOMTRIY.mjs.map