"use strict";

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

exports.__esModule = true;
exports.default = void 0;

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

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

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

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

var _utils = require("../utils");

var _Modal = require("./Modal");

var defaultProps = {
  as: 'div',
  classPrefix: 'modal-body'
};

var ModalBody = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
  var Component = props.as,
      classPrefix = props.classPrefix,
      className = props.className,
      style = props.style,
      rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["as", "classPrefix", "className", "style"]);

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

  var classes = merge(className, withClassPrefix());
  return /*#__PURE__*/_react.default.createElement(_Modal.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.default.createElement(Component, (0, _extends2.default)({}, rest, {
      ref: ref,
      style: (0, _extends2.default)({}, bodyStyles, style),
      className: classes
    }));
  });
});

ModalBody.displayName = 'ModalBody';
ModalBody.defaultProps = defaultProps;
ModalBody.propTypes = {
  as: _propTypes.default.elementType,
  classPrefix: _propTypes.default.string,
  className: _propTypes.default.string
};
var _default = ModalBody;
exports.default = _default;