import React__default, { useContext } from 'react';
import { createPortal } from 'react-dom';
import { M as MODAL_ROOT } from '../index-c9cda9f6.js';
import { a as LocalizationContext } from '../LocalizationContext-2a073ef0.js';
import { a as ButtonTypes, B as Button } from '../index-6a47d16f.js';
import Icon, { IconTypes, IconColors } from './Icon.js';
import IconButton from './IconButton.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../index-ed39099a.js';
import '../stringSet-647493ce.js';
import '../index-5ec69689.js';
import '../tslib.es6-710c6267.js';
import '../_rollupPluginBabelHelpers-3043541a.js';
import 'prop-types';

var ModalHeader = function ModalHeader(_a) {
  var titleText = _a.titleText;
  return /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-modal__header"
  }, /*#__PURE__*/React__default.createElement(Label, {
    type: LabelTypography.H_1,
    color: LabelColors.ONBACKGROUND_1
  }, titleText));
};
var ModalBody = function ModalBody(_a) {
  var children = _a.children;
  return /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-modal__body"
  }, /*#__PURE__*/React__default.createElement(Label, {
    type: LabelTypography.SUBTITLE_1,
    color: LabelColors.ONBACKGROUND_2
  }, children));
};
var ModalFooter = function ModalFooter(_a) {
  var submitText = _a.submitText,
      _b = _a.disabled,
      disabled = _b === void 0 ? false : _b,
      _c = _a.type,
      type = _c === void 0 ? ButtonTypes.DANGER : _c,
      onSubmit = _a.onSubmit,
      onCancel = _a.onCancel;
  var stringSet = useContext(LocalizationContext).stringSet;
  return /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-modal__footer"
  }, /*#__PURE__*/React__default.createElement(Button, {
    type: ButtonTypes.SECONDARY,
    onClick: onCancel
  }, /*#__PURE__*/React__default.createElement(Label, {
    type: LabelTypography.BUTTON_1,
    color: LabelColors.ONBACKGROUND_1
  }, stringSet.BUTTON__CANCEL)), /*#__PURE__*/React__default.createElement(Button, {
    type: type,
    disabled: disabled,
    onClick: onSubmit
  }, submitText));
};
function Modal(props) {
  var _a = props.children,
      children = _a === void 0 ? null : _a,
      titleText = props.titleText,
      submitText = props.submitText,
      _b = props.disabled,
      disabled = _b === void 0 ? false : _b,
      _c = props.hideFooter,
      hideFooter = _c === void 0 ? false : _c,
      _d = props.type,
      type = _d === void 0 ? ButtonTypes.DANGER : _d,
      _e = props.onCancel,
      onCancel = _e === void 0 ? function () {} : _e,
      _f = props.onSubmit,
      onSubmit = _f === void 0 ? function () {} : _f;
  return /*#__PURE__*/createPortal( /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-modal"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-modal__content"
  }, /*#__PURE__*/React__default.createElement(ModalHeader, {
    titleText: titleText
  }), /*#__PURE__*/React__default.createElement(ModalBody, null, children), !hideFooter && /*#__PURE__*/React__default.createElement(ModalFooter, {
    disabled: disabled,
    onCancel: onCancel,
    onSubmit: onSubmit,
    submitText: submitText,
    type: type
  }), /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-modal__close"
  }, /*#__PURE__*/React__default.createElement(IconButton, {
    width: "32px",
    height: "32px",
    onClick: onCancel
  }, /*#__PURE__*/React__default.createElement(Icon, {
    type: IconTypes.CLOSE,
    fillColor: IconColors.DEFAULT,
    width: "24px",
    height: "24px"
  })))), /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-modal__backdrop"
  })), document.getElementById(MODAL_ROOT));
}

export { ModalBody, ModalFooter, ModalHeader, Modal as default };
//# sourceMappingURL=Modal.js.map
