"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OverflowTypography = exports.DEFAULT_ROWS_COUNT = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const Tooltip_1 = require("../Tooltip");
const Typography_1 = require("../Typography");
const styles_1 = require("./styles");
const useLogic_1 = require("./useLogic");
exports.DEFAULT_ROWS_COUNT = 1;
exports.OverflowTypography = (0, react_1.forwardRef)((props, forwardedRef) => {
    const { ref, secondPartLabel, firstPartLabel, hasVisibleLastSymbols, hasMultipleRows, tooltipTitle, } = (0, useLogic_1.useLogic)({
        ...props,
        forwardedRef,
    });
    const { tooltipProps, children, rowsCount = exports.DEFAULT_ROWS_COUNT, visibleLastSymbolsCount, align = 'left', ...restProps } = props;
    const typographyProps = {
        ...restProps,
        ref,
        align,
        children,
        rowsCount,
        hasMultipleRows,
    };
    if (hasVisibleLastSymbols) {
        return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: tooltipTitle, disableInteractive: true, ...tooltipProps, children: (0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { "$align": align, children: [(0, jsx_runtime_1.jsx)(styles_1.StyledTypography, { component: "span", children: firstPartLabel, ref: ref, hasMultipleRows: hasMultipleRows, rowsCount: 1, ...restProps }), (0, jsx_runtime_1.jsx)(Typography_1.Typography, { children: secondPartLabel, ...restProps, component: "span" })] }) }));
    }
    return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: tooltipTitle, disableInteractive: true, ...tooltipProps, children: (0, jsx_runtime_1.jsx)(styles_1.StyledTypography, { ...typographyProps }) }));
});
