import React, { useContext } from 'react';
import classnames from 'classnames';
import { RowCollapseContext } from '../contexts/RowCollapseContext';
import { CollapseButton } from '../CollapseButton';
import { useStyles } from './styles';
export var CollapseRowButton = function (_a) {
    var _b;
    var rowIndex = _a.rowIndex, rowValue = _a.rowValue, className = _a.className;
    var styles = useStyles();
    var _c = useContext(RowCollapseContext), toggleRowCollapse = _c.toggleRowCollapse, getIsRowCollapsible = _c.getIsRowCollapsible, getIsRowCollapsed = _c.getIsRowCollapsed;
    var isCollapsibleRow = getIsRowCollapsible(rowValue);
    var isCollapsedRow = getIsRowCollapsed(rowIndex);
    return (React.createElement(CollapseButton, { className: classnames(className, (_b = {}, _b[styles.hidden] = !isCollapsibleRow, _b)), isOpen: !isCollapsedRow, onClick: function (e) {
            toggleRowCollapse(rowIndex);
            e.stopPropagation();
        } }));
};
