import { Rnd } from 'react-rnd';
import { FcrWindowHeader, WindowType } from '../window-header';
import './draggable-dialog.css';
import classNames from 'classnames';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export var FcrDraggableModal = function FcrDraggableModal(_ref) {
  var children = _ref.children,
    title = _ref.title,
    width = _ref.width,
    height = _ref.height,
    onClose = _ref.onClose,
    rootClassName = _ref.rootClassName;
  var DIALOG_WIDTH = width !== null && width !== void 0 ? width : 440;
  var DIALOG_HEIGHT = height !== null && height !== void 0 ? height : 434;
  return /*#__PURE__*/_jsx(Rnd, {
    bounds: '#root',
    enableResizing: false,
    cancel: ".frc-window-header__operates",
    dragHandleClassName: "frc-window-header",
    "default": {
      width: DIALOG_WIDTH,
      height: DIALOG_HEIGHT,
      x: (document.body.clientWidth - DIALOG_WIDTH) / 2,
      y: (document.body.clientHeight - DIALOG_HEIGHT) / 2
    },
    children: /*#__PURE__*/_jsxs("div", {
      className: classNames('frc-draggable-dialog', rootClassName),
      children: [/*#__PURE__*/_jsx(FcrWindowHeader, {
        title: title,
        showClose: true,
        type: WindowType.MODAL,
        onClose: onClose,
        withWindowPopUpButton: false
      }), /*#__PURE__*/_jsx("div", {
        className: "fcr-dialog-content",
        children: children
      })]
    }, "frc-common-dialog")
  }, 'common-dialog');
};