import React from 'react';
import { DataTableHeader } from '../DataTable';
import { getDataTableProps, createColumns } from '../Table';
import { TableContext } from '../TableContext';
import { BulkSelectionConsumer } from '../BulkSelection';
/**
 * TitleBar (aka DataTableHeader)
 */
export const TableTitleBar = ({ dataHook }) => {
    return (React.createElement(TableContext.Consumer, null, tableProps => {
        const dataTableProps = getDataTableProps(tableProps);
        if (tableProps.showSelection) {
            return (React.createElement(BulkSelectionConsumer, { consumerCompName: "Table.TitleBar", providerCompName: "Table" }, bulkSelectionContext => (React.createElement("div", { "data-hook": "table-title-bar" },
                React.createElement(DataTableHeader, { ...dataTableProps, columns: createColumns({
                        tableProps,
                        bulkSelectionContext,
                    }), dataHook: dataHook })))));
        }
        else {
            return (React.createElement("div", { "data-hook": "table-title-bar" },
                React.createElement(DataTableHeader, { ...dataTableProps, columns: createColumns({
                        tableProps,
                    }) })));
        }
    }));
};
TableTitleBar.displayName = 'Table.TitleBar';
//# sourceMappingURL=TableTitleBar.js.map