"use strict";

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

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

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

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");

function _templateObject() {
  var data = (0, _taggedTemplateLiteralLoose2.default)(["content"]);

  _templateObject = function _templateObject() {
    return data;
  };

  return data;
}

var modalDialogPropTypes = {
  size: _propTypes.default.oneOf(_utils.SIZE),
  className: _propTypes.default.string,
  classPrefix: _propTypes.default.string,
  dialogClassName: _propTypes.default.string,
  style: _propTypes.default.object,
  dialogStyle: _propTypes.default.object,
  children: _propTypes.default.node
};
exports.modalDialogPropTypes = modalDialogPropTypes;
var defaultProps = {
  as: 'div',
  classPrefix: 'modal'
};

var ModalDialog = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
  var Component = props.as,
      style = props.style,
      children = props.children,
      dialogClassName = props.dialogClassName,
      dialogStyle = props.dialogStyle,
      classPrefix = props.classPrefix,
      className = props.className,
      size = props.size,
      rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["as", "style", "children", "dialogClassName", "dialogStyle", "classPrefix", "className", "size"]);
  var modalStyle = (0, _extends2.default)({
    display: 'block'
  }, style);

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

  var classes = merge(className, withClassPrefix(size));
  var dialogClasses = merge(dialogClassName, prefix('dialog'));
  return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({}, rest, {
    ref: ref,
    className: classes,
    style: modalStyle
  }), /*#__PURE__*/_react.default.createElement("div", {
    role: "document",
    className: dialogClasses,
    style: dialogStyle
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: prefix(_templateObject())
  }, children)));
});

ModalDialog.displayName = 'ModalDialog';
ModalDialog.defaultProps = defaultProps;
ModalDialog.propTypes = modalDialogPropTypes;
var _default = ModalDialog;
exports.default = _default;