analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
78 lines (70 loc) • 2.15 kB
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
var _chunkOSTHYDKMjs = require('./chunk-OSTHYDKM.js');
var _chunkTN3AYOMVjs = require('./chunk-TN3AYOMV.js');
// src/components/TruncatedText/TruncatedText.tsx
var _jsxruntime = require('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 = _nullishCoalesce(as, () => ( "span"));
const resolvedTooltipContent = _nullishCoalesce(tooltipContent, () => ( (typeof children === "string" ? children : "")));
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkOSTHYDKMjs.Tooltip,
{
content: resolvedTooltipContent,
position: tooltipPosition,
disabled: !resolvedTooltipContent,
usePortal: true,
className: _chunkTN3AYOMVjs.cn.call(void 0, "inline-flex min-w-0 max-w-full", wrapperClassName),
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
Component,
{
className: _chunkTN3AYOMVjs.cn.call(void 0,
"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;
exports.TruncatedText = TruncatedText; exports.TruncatedText_default = TruncatedText_default;
//# sourceMappingURL=chunk-ZK5QTM5C.js.map