import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import PropTypes from 'prop-types';
import * as React from 'react';
import styled from 'styled-components';
import { prop } from '../../Tools/interpolation';

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

    case 'center':
      return 'center';

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

var Wrapper =
/*#__PURE__*/
styled.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);
}, 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 = _objectWithoutProperties(_ref, ["children"]);

  return React.createElement(Wrapper, rest, children);
};

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