"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AttributeCellRenderer = void 0;
var react_1 = __importDefault(require("react"));
var classnames_1 = __importDefault(require("classnames"));
var ExpandedValueTooltip_1 = require("../../../ExpandedValueTooltip");
var withTableContext_1 = require("../../../HOCs/withTableContext");
var useClickableChartStyle_1 = require("../../../hooks/useClickableChartStyle");
var styles_1 = require("./styles");
var AttributeCellRenderer = function (_a) {
    var _b = _a.value, value = _b === void 0 ? '' : _b, onClick = _a.onClick;
    var styles = (0, styles_1.useStyles)();
    var clickable = (0, useClickableChartStyle_1.useClickableChartStyle)(onClick);
    return (react_1.default.createElement(ExpandedValueTooltip_1.ExpandedValueTooltip, { value: value },
        react_1.default.createElement("div", { "data-reltio-id": "attribute-cell-renderer", className: (0, classnames_1.default)(styles.attribute, clickable), onClick: onClick }, value)));
};
exports.AttributeCellRenderer = AttributeCellRenderer;
exports.default = (0, withTableContext_1.withTableContext)(function (_a, _b) {
    var onItemClick = _a.onItemClick;
    var group = _b.rowValue.group;
    return {
        onClick: onItemClick &&
            (function () {
                onItemClick(group);
            })
    };
})(exports.AttributeCellRenderer);
