analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
78 lines (76 loc) • 1.74 kB
JavaScript
import {
Tooltip
} from "./chunk-QBKJAKGY.mjs";
import {
cn
} from "./chunk-53ICLDGS.mjs";
// src/components/TruncatedText/TruncatedText.tsx
import { jsx } from "react/jsx-runtime";
var SIZE_CLASS_MAP = {
"2xs": "text-2xs",
xs: "text-xs",
sm: "text-sm",
md: "text-md",
lg: "text-lg",
xl: "text-xl",
"2xl": "text-2xl",
"3xl": "text-3xl",
"4xl": "text-4xl",
"5xl": "text-5xl",
"6xl": "text-6xl"
};
var WEIGHT_CLASS_MAP = {
hairline: "font-hairline",
light: "font-light",
normal: "font-normal",
medium: "font-medium",
semibold: "font-semibold",
bold: "font-bold",
extrabold: "font-extrabold",
black: "font-black"
};
var TruncatedText = ({
children,
tooltipContent,
tooltipPosition = "top",
size = "md",
weight = "normal",
color = "text-text-950",
className,
wrapperClassName,
as,
...rest
}) => {
const Component = as ?? "span";
const resolvedTooltipContent = tooltipContent ?? (typeof children === "string" ? children : "");
return /* @__PURE__ */ jsx(
Tooltip,
{
content: resolvedTooltipContent,
position: tooltipPosition,
disabled: !resolvedTooltipContent,
usePortal: true,
className: cn("inline-flex min-w-0 max-w-full", wrapperClassName),
children: /* @__PURE__ */ jsx(
Component,
{
className: cn(
"font-primary truncate block min-w-0 max-w-full",
SIZE_CLASS_MAP[size],
WEIGHT_CLASS_MAP[weight],
color,
className
),
...rest,
children
}
)
}
);
};
var TruncatedText_default = TruncatedText;
export {
TruncatedText,
TruncatedText_default
};
//# sourceMappingURL=chunk-2P7LJCTW.mjs.map