"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Td = exports.Th = exports.Tr = exports.TFoot = exports.THead = exports.TBody = exports.Table = exports.TableTitle = exports.TableContainer = void 0;

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

var _classnames = _interopRequireDefault(require("classnames"));

require("./Table.css");

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 TableContainer = function TableContainer(_ref) {
  var className = _ref.className,
      children = _ref.children,
      restProps = _objectWithoutProperties(_ref, ["className", "children"]);

  return _react.default.createElement("div", _extends({}, restProps, {
    className: (0, _classnames.default)('vs-table-container', className)
  }), children);
};

exports.TableContainer = TableContainer;

var TableTitle = function TableTitle(_ref2) {
  var className = _ref2.className,
      children = _ref2.children,
      restProps = _objectWithoutProperties(_ref2, ["className", "children"]);

  return _react.default.createElement("div", _extends({}, restProps, {
    className: (0, _classnames.default)('vs-table-title', className)
  }), children);
};

exports.TableTitle = TableTitle;

var Table = function Table(_ref3) {
  var className = _ref3.className,
      children = _ref3.children,
      restProps = _objectWithoutProperties(_ref3, ["className", "children"]);

  return _react.default.createElement("table", _extends({}, restProps, {
    className: (0, _classnames.default)('vs-table', className)
  }), children);
};

exports.Table = Table;

var TBody = function TBody(_ref4) {
  var className = _ref4.className,
      children = _ref4.children,
      restProps = _objectWithoutProperties(_ref4, ["className", "children"]);

  return _react.default.createElement("tbody", _extends({}, restProps, {
    className: (0, _classnames.default)('vs-tbody', className)
  }), children);
};

exports.TBody = TBody;

var THead = function THead(_ref5) {
  var className = _ref5.className,
      children = _ref5.children,
      restProps = _objectWithoutProperties(_ref5, ["className", "children"]);

  return _react.default.createElement("thead", _extends({}, restProps, {
    className: (0, _classnames.default)('vs-thead', className)
  }), children);
};

exports.THead = THead;

var TFoot = function TFoot(_ref6) {
  var className = _ref6.className,
      children = _ref6.children,
      restProps = _objectWithoutProperties(_ref6, ["className", "children"]);

  return _react.default.createElement("tfoot", _extends({}, restProps, {
    className: (0, _classnames.default)('vs-tfoot', className)
  }), children);
};

exports.TFoot = TFoot;

var Tr = function Tr(_ref7) {
  var className = _ref7.className,
      children = _ref7.children,
      restProps = _objectWithoutProperties(_ref7, ["className", "children"]);

  return _react.default.createElement("tr", _extends({}, restProps, {
    className: (0, _classnames.default)('vs-row', className)
  }), children);
};

exports.Tr = Tr;

var buildCellClasses = function buildCellClasses(center, className, nowrap, right) {
  return (0, _classnames.default)('vs-cell', className, {
    'vs-cell-right': right
  }, {
    'vs-cell-center': center
  }, {
    'vs-cell-nowrap': nowrap
  });
};

var Th = function Th(_ref8) {
  var center = _ref8.center,
      className = _ref8.className,
      nowrap = _ref8.nowrap,
      right = _ref8.right,
      children = _ref8.children,
      restProps = _objectWithoutProperties(_ref8, ["center", "className", "nowrap", "right", "children"]);

  return _react.default.createElement("th", _extends({}, restProps, {
    className: "".concat(buildCellClasses(center, className, nowrap, right), " vs-table-header")
  }), children);
};

exports.Th = Th;

var Td = function Td(_ref9) {
  var center = _ref9.center,
      className = _ref9.className,
      nowrap = _ref9.nowrap,
      right = _ref9.right,
      children = _ref9.children,
      restProps = _objectWithoutProperties(_ref9, ["center", "className", "nowrap", "right", "children"]);

  return _react.default.createElement("td", _extends({}, restProps, {
    className: buildCellClasses(center, className, nowrap, right)
  }), children);
};

exports.Td = Td;