import _extends from "@babel/runtime/helpers/esm/extends";
import React, { forwardRef } from "react";
import classnames from "classnames";

// import { DialogContext } from "./DialogContext";

import { DialogActions } from "./DialogActions";
import { DialogContent } from "./DialogContent";
import { DialogContentDivider } from "./DialogContentDivider";
import { DialogTitle } from "./DialogTitle";
import { StyledDialog } from "./Styles";
import { Modal } from "../Modal";
import { Fade } from "../Transitions";
import { SlideFromTop } from "../Transitions/SlideFromTop";
export const _Dialog = /*#__PURE__*/forwardRef((_ref, ref) => {
  let {
    children,
    open = false,
    onClose,
    className,
    enableBackgroundClick = false,
    disableCloseOnEsc = false,
    animate = "slide",
    onClickOutside,
    ...rest
  } = _ref;
  const animateDialog = () => {
    switch (animate) {
      case "fade":
        return /*#__PURE__*/React.createElement(Fade, {
          in: open
        }, /*#__PURE__*/React.createElement(StyledDialog, {
          className: classnames("c-dialog", className)
        }, children));
      default:
        return /*#__PURE__*/React.createElement(SlideFromTop, {
          in: open
        }, /*#__PURE__*/React.createElement(StyledDialog, {
          className: classnames("c-dialog", className)
        }, children));
    }
  };
  return (
    /*#__PURE__*/
    // <DialogContext.Provider value={{}}>
    React.createElement(Modal, _extends({
      ref: ref,
      open: open,
      onClose: onClose,
      disableBackgroundClick: !enableBackgroundClick,
      disableCloseOnEsc: disableCloseOnEsc,
      onClickOutside: onClickOutside
    }, rest), animateDialog())
    // </DialogContext.Provider>
  );
});
_Dialog.displayName = "Dialog";

// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34757
export const Dialog = Object.assign({}, _Dialog, {
  Title: DialogTitle,
  Content: DialogContent,
  ContentDivider: DialogContentDivider,
  Actions: DialogActions
});
//# sourceMappingURL=Dialog.js.map