import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { mapToCssModules, tagPropType } from './utils'; var propTypes = { className: PropTypes.string, cssModule: PropTypes.object, size: PropTypes.string, bordered: PropTypes.bool, borderless: PropTypes.bool, striped: PropTypes.bool, dark: PropTypes.bool, hover: PropTypes.bool, responsive: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), tag: tagPropType, responsiveTag: tagPropType, innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.object]) }; var defaultProps = { tag: 'table', responsiveTag: 'div' }; var Table = function Table(props) { var className = props.className, cssModule = props.cssModule, size = props.size, bordered = props.bordered, borderless = props.borderless, striped = props.striped, dark = props.dark, hover = props.hover, responsive = props.responsive, Tag = props.tag, ResponsiveTag = props.responsiveTag, innerRef = props.innerRef, attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "size", "bordered", "borderless", "striped", "dark", "hover", "responsive", "tag", "responsiveTag", "innerRef"]); var classes = mapToCssModules(classNames(className, 'table', size ? 'table-' + size : false, bordered ? 'table-bordered' : false, borderless ? 'table-borderless' : false, striped ? 'table-striped' : false, dark ? 'table-dark' : false, hover ? 'table-hover' : false), cssModule); var table = /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, { ref: innerRef, className: classes })); if (responsive) { var responsiveClassName = mapToCssModules(responsive === true ? 'table-responsive' : "table-responsive-" + responsive, cssModule); return /*#__PURE__*/React.createElement(ResponsiveTag, { className: responsiveClassName }, table); } return table; }; Table.propTypes = propTypes; Table.defaultProps = defaultProps; export default Table;