"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.TableTitleBar = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _DataTable = require("../DataTable");
var _Table = require("../Table");
var _TableContext = require("../TableContext");
var _BulkSelection = require("../BulkSelection");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/Table/components/TableTitleBar.jsx",
  _this = void 0;
/**
 * TitleBar (aka DataTableHeader)
 */
var TableTitleBar = exports.TableTitleBar = function TableTitleBar(_ref) {
  var dataHook = _ref.dataHook;
  return /*#__PURE__*/_react["default"].createElement(_TableContext.TableContext.Consumer, {
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 12,
      columnNumber: 5
    }
  }, function (tableProps) {
    var dataTableProps = (0, _Table.getDataTableProps)(tableProps);
    if (tableProps.showSelection) {
      return /*#__PURE__*/_react["default"].createElement(_BulkSelection.BulkSelectionConsumer, {
        consumerCompName: "Table.TitleBar",
        providerCompName: "Table",
        __self: _this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 17,
          columnNumber: 13
        }
      }, function (bulkSelectionContext) {
        return /*#__PURE__*/_react["default"].createElement("div", {
          "data-hook": "table-title-bar",
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 22,
            columnNumber: 17
          }
        }, /*#__PURE__*/_react["default"].createElement(_DataTable.DataTableHeader, (0, _extends2["default"])({}, dataTableProps, {
          columns: (0, _Table.createColumns)({
            tableProps: tableProps,
            bulkSelectionContext: bulkSelectionContext
          }),
          dataHook: dataHook,
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 23,
            columnNumber: 19
          }
        })));
      });
    } else {
      return /*#__PURE__*/_react["default"].createElement("div", {
        "data-hook": "table-title-bar",
        __self: _this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 37,
          columnNumber: 13
        }
      }, /*#__PURE__*/_react["default"].createElement(_DataTable.DataTableHeader, (0, _extends2["default"])({}, dataTableProps, {
        columns: (0, _Table.createColumns)({
          tableProps: tableProps
        }),
        __self: _this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 38,
          columnNumber: 15
        }
      })));
    }
  });
};
TableTitleBar.displayName = 'Table.TitleBar';