import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import classnames from 'classnames';
import RcDialog from 'rc-dialog';
import { useState } from 'react';
import { FcrIcon } from '../icon';
import { FcrIconType } from '../icon/type';
import { FcrBasicConfirmDialog } from './basic-confirm-dialog';
import { FcrClassDialog } from './class-dialog';
import { FcrConfirmDialog } from './confirm-dialog';
import './index.css';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var BaseDialog = function BaseDialog(props) {
  var visible = props.visible,
    onClose = props.onClose,
    children = props.children,
    maskClosable = props.maskClosable,
    width = props.width,
    classNames = props.classNames,
    _props$closable = props.closable,
    closable = _props$closable === void 0 ? true : _props$closable,
    closeIcon = props.closeIcon,
    _props$mask = props.mask,
    mask = _props$mask === void 0 ? true : _props$mask,
    bodyStyle = props.bodyStyle,
    wrapClassName = props.wrapClassName,
    getContainer = props.getContainer,
    _props$center = props.center,
    center = _props$center === void 0 ? true : _props$center,
    afterClose = props.afterClose,
    destroyOnClose = props.destroyOnClose,
    maskStyle = props.maskStyle,
    wrapStyle = props.wrapStyle,
    zIndex = props.zIndex,
    forceRender = props.forceRender;
  var defaultColor = 'var(--fcr_ui_scene_icontext1)';
  var hoverColor = 'var(--fcr_ui_scene_ramp_brand6)';
  var _useState = useState(defaultColor),
    _useState2 = _slicedToArray(_useState, 2),
    color = _useState2[0],
    setColor = _useState2[1];
  var handleHover = function handleHover() {
    setColor(hoverColor);
  };
  var handleLeave = function handleLeave() {
    setColor(defaultColor);
  };
  return /*#__PURE__*/_jsxs(RcDialog, {
    forceRender: forceRender,
    zIndex: zIndex,
    wrapStyle: wrapStyle,
    maskStyle: maskStyle,
    destroyOnClose: destroyOnClose,
    afterClose: afterClose,
    getContainer: getContainer,
    wrapClassName: classnames({
      'fcr-dialog-center': center
    }, wrapClassName),
    bodyStyle: bodyStyle,
    mask: mask,
    className: classNames,
    width: width || 415,
    maskClosable: maskClosable,
    footer: null,
    prefixCls: "fcr-dialog",
    animation: 'zoom',
    maskAnimation: 'fade',
    closable: false,
    visible: visible,
    onClose: onClose,
    children: [closable ? closeIcon ? closeIcon : /*#__PURE__*/_jsx("div", {
      onClick: onClose,
      className: classnames('fcr-dialog-close'),
      onMouseEnter: handleHover,
      onMouseLeave: handleLeave,
      children: /*#__PURE__*/_jsx(FcrIcon, {
        type: FcrIconType.FCR_CLOSE,
        colors: {
          iconPrimary: color
        },
        size: 18
      })
    }) : null, children]
  });
};
export { FcrConfirmDialog, FcrClassDialog, BaseDialog, FcrBasicConfirmDialog };
export { FcrDialogApi } from './confirm';