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 { useClassNames } from '../utils';
import { ModalContext } from './Modal';
var defaultProps = {
  as: 'div',
  classPrefix: 'modal-body'
};
var ModalBody = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var Component = props.as,
      classPrefix = props.classPrefix,
      className = props.className,
      style = props.style,
      rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "className", "style"]);

  var _useClassNames = useClassNames(classPrefix),
      withClassPrefix = _useClassNames.withClassPrefix,
      merge = _useClassNames.merge;

  var classes = merge(className, withClassPrefix());
  return /*#__PURE__*/React.createElement(ModalContext.Consumer, null, function (context) {
    var _context$getBodyStyle;

    var bodyStyles = context === null || context === void 0 ? void 0 : (_context$getBodyStyle = context.getBodyStyles) === null || _context$getBodyStyle === void 0 ? void 0 : _context$getBodyStyle.call(context);
    return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
      ref: ref,
      style: _extends({}, bodyStyles, style),
      className: classes
    }));
  });
});
ModalBody.displayName = 'ModalBody';
ModalBody.defaultProps = defaultProps;
ModalBody.propTypes = {
  as: PropTypes.elementType,
  classPrefix: PropTypes.string,
  className: PropTypes.string
};
export default ModalBody;