var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import React from 'react';
import { ExpandedValueTooltip } from '../../../ExpandedValueTooltip';
import { HierarchicalAttributeTooltip } from '../../../HierarchicalAttributeTooltip';
import ChipsCount from '../ChipsCount/ChipsCount';
import styles from './FacetTitle.module.css';
var FacetTitle = function (_a) {
    var _b = _a.title, title = _b === void 0 ? '' : _b, _c = _a.chipLabel, chipLabel = _c === void 0 ? 0 : _c, onDelete = _a.onDelete, pathToTitle = _a.pathToTitle, onClick = _a.onClick;
    var isNested = Boolean(pathToTitle && pathToTitle.length > 2);
    var TooltipComponent = isNested ? HierarchicalAttributeTooltip : ExpandedValueTooltip;
    var tooltipProps = isNested ? { pathToTitle: pathToTitle } : { value: title };
    return (React.createElement("div", { className: styles.container, onClick: onClick },
        isNested && (React.createElement(HierarchicalAttributeTooltip, __assign({ placement: "bottom-start" }, tooltipProps),
            React.createElement("div", { className: styles.parent }, pathToTitle[pathToTitle.length - 2]))),
        React.createElement("div", { className: styles.titleContainer },
            React.createElement(TooltipComponent, __assign({ placement: "bottom-start" }, tooltipProps),
                React.createElement("span", { className: styles.title }, title)),
            chipLabel !== 0 && (React.createElement("div", { className: styles.chip },
                React.createElement(ChipsCount, { label: chipLabel, onDelete: onDelete }))))));
};
export default FacetTitle;
