import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Tooltip } from "react-tooltip";
// import "react-tooltip/dist/react-tooltip.css";
import "./style.scss";
import { v4 as uuidv4 } from "uuid";
const TruncateText = ({ text = "Placeholder text to be truncated is as follows", length = 20, toolTipClassName = "", toolTipPosition = "top", }) => {
    const truncatedText = text.length > length ? `${text.slice(0, length)}...` : text;
    const toolTipId = uuidv4();
    if (text.length > length) {
        return (_jsx(_Fragment, { children: _jsxs("span", { "data-tooltip-id": toolTipId, className: toolTipClassName, children: [truncatedText, _jsx(Tooltip, { id: toolTipId, className: "toolTipStyling", content: text, place: toolTipPosition })] }) }));
    }
    return _jsx("span", { children: truncatedText });
};
export default TruncateText;
