UNPKG

wix-style-react

Version:
32 lines 1.44 kB
import React from 'react'; import PropTypes from 'prop-types'; 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'; TableTitleBar.propTypes = { dataHook: PropTypes.string, }; //# sourceMappingURL=TableTitleBar.js.map