"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cssClass = void 0;
var React = require("react");
var PropTypes = require("prop-types");
var tablePropTypes = require("./tablePropTypes");
var Column_1 = require("./Column");
var HeaderCell_1 = require("./HeaderCell");
var MorePropTypes_1 = require("../utils/MorePropTypes");
exports.cssClass = {
    CONTAINER: "Table--header",
    ROW: "Table--header--row",
    SORTABLE: "Table--header--cell--sortable",
};
function Header(_a) {
    var children = _a.children, disableSort = _a.disableSort, onSortChange = _a.onSortChange, sortState = _a.sortState;
    return (React.createElement("thead", { className: exports.cssClass.CONTAINER },
        React.createElement("tr", { className: exports.cssClass.ROW }, children.map(function (_a) {
            var column = _a.props;
            return (React.createElement(HeaderCell_1.default, { activeSortDirection: sortState.columnID === column.id ? sortState.direction : null, className: column.header && column.header.className, key: column.id, onSortChange: function () { return onSortChange(column.id); }, sortable: column.sortable && !disableSort, width: column.width }, column.header && column.header.content));
        }))));
}
exports.default = Header;
Header.propTypes = {
    children: PropTypes.arrayOf(MorePropTypes_1.default.instanceOfComponent(Column_1.default)),
    disableSort: PropTypes.bool,
    onSortChange: PropTypes.func,
    sortState: tablePropTypes.sortState,
};
Header.defaultProps = {
    sortState: {},
};
