import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import Modal from '../Modal';
import Icon from '../Icon';
/*
 * Top level Dialog component, not intended to be used directly, if you need
 * a specific type of Dialog, create in the pattern of Notice
 */

const Dialog = ({
  children,
  type,
  icon,
  show,
  options,
  title,
  message,
  onBlur,
  classNames
}) => /*#__PURE__*/React.createElement(Modal, {
  show: show,
  onBlur: onBlur
}, /*#__PURE__*/React.createElement("div", {
  className: cx('dialog', {
    [`dialog--${type}`]: type
  }, classNames)
}, /*#__PURE__*/React.createElement("div", {
  className: "dialog__main"
}, icon && /*#__PURE__*/React.createElement("div", {
  className: "dialog__main-icon"
}, /*#__PURE__*/React.createElement(Icon, {
  name: icon
})), /*#__PURE__*/React.createElement("div", {
  className: "dialog__main-content"
}, /*#__PURE__*/React.createElement("h2", {
  className: "dialog__main-title"
}, title), message, children)), /*#__PURE__*/React.createElement("footer", {
  className: "dialog__footer"
}, options)));

Dialog.propTypes = {
  show: PropTypes.bool,
  title: PropTypes.string.isRequired,
  message: PropTypes.node,
  type: PropTypes.string,
  icon: PropTypes.string,
  children: PropTypes.node,
  options: PropTypes.arrayOf(PropTypes.element),
  onBlur: PropTypes.func,
  classNames: PropTypes.string
};
Dialog.defaultProps = {
  show: false,
  type: null,
  icon: null,
  message: null,
  children: null,
  options: [],
  onBlur: () => {},
  classNames: null
};
export { Dialog };
export default Dialog;