"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Table = void 0;

var _reactSuperResponsiveTable = require("react-super-responsive-table");

var _react = _interopRequireDefault(require("react"));

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _index = require("./tr/index");

var _index2 = require("./t-body/index");

var _index3 = require("./t-head/index");

var _breakpoints = require("../../../breakpoints");

var _table = require("./table.css-rules");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var StyledResponsiveTable = (0, _styledComponents["default"])(function (_ref) {
  var thWidth = _ref.thWidth,
      className = _ref.className,
      rest = _objectWithoutProperties(_ref, ["thWidth", "className"]);

  return /*#__PURE__*/_react["default"].createElement(_reactSuperResponsiveTable.Table, _extends({}, rest, {
    className: className
  }));
}).withConfig({
  displayName: "StyledResponsiveTable",
  componentId: "zamrba-0"
})(["width:100%;@media (max-width:", "){display:block;td.pivoted{padding-left:", ";}}"], _breakpoints.bpLarge, _table.getColumnHeaderWidthMobile);

var Table = function Table(_ref2) {
  var rows = _ref2.rows,
      headers = _ref2.headers,
      thWidth = _ref2.thWidth,
      className = _ref2.className;
  return /*#__PURE__*/_react["default"].createElement(StyledResponsiveTable, {
    className: className,
    thWidth: thWidth
  }, /*#__PURE__*/_react["default"].createElement(_index3.Thead, null, /*#__PURE__*/_react["default"].createElement(_index.Tr, null, headers.map(function (h) {
    return h;
  }))), /*#__PURE__*/_react["default"].createElement(_index2.Tbody, null, rows.map(function (r) {
    return r;
  })));
};

exports.Table = Table;
Table.displayName = 'Table';