"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var React = _interopRequireWildcard(require("react"));

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

var _interpolation = require("../../Tools/interpolation");

//  strict
var selectAlign = function selectAlign(align) {
  switch (align) {
    case 'left':
      return 'flex-start';

    case 'center':
      return 'center';

    case 'right':
      return 'flex-end';
  }
};

var Wrapper =
/*#__PURE__*/
_styledComponents.default.div.withConfig({
  componentId: "sc-16acrto-0"
})(["\n  display: flex;\n  flex-direction: row;\n  justify-content: ", ";\n  align-items: center;\n  min-width: 0;\n  flex-basis: ", ";\n\n  & > * {\n    display: ", ";\n    text-overflow: ", ";\n    overflow: ", ";\n    white-space: ", ";\n  }\n"], function (props) {
  return selectAlign(props.align);
}, (0, _interpolation.prop)('width'), function (props) {
  return props.shrunk === true ? 'block' : 'initial';
}, function (props) {
  return props.shrunk === true ? 'ellipsis' : 'initial';
}, function (props) {
  return props.shrunk === true ? 'hidden' : 'initial';
}, function (props) {
  return props.shrunk === true ? 'nowrap' : 'initial';
});

var TableCell = function TableCell(_ref) {
  var children = _ref.children,
      rest = (0, _objectWithoutProperties2.default)(_ref, ["children"]);
  return React.createElement(Wrapper, rest, children);
};

TableCell.propTypes = process.env.NODE_ENV !== "production" ? {
  align: _propTypes.default.oneOf(['left', 'center', 'right']),
  children: _propTypes.default.node,
  shrunk: _propTypes.default.bool,
  width: _propTypes.default.string
} : {};
TableCell.defaultProps = {
  align: 'left',
  shrunk: true,
  width: '100%'
};
var _default = TableCell;
exports.default = _default;