import { CloseCircleFilled } from '@ant-design/icons';
import { cx } from '@linaria/core';
import { usePopModal } from '../../core/KitStoreProvider/index.js';
import { Modal } from 'antd';
import React__default from 'react';
import Button from '../../core/Button/index.js';
import { Typo } from '../../core/Typo/index.js';

var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
  enumerable: true,
  configurable: true,
  writable: true,
  value
}) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
    if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
  }
  return a;
};
const DialogStyle = "E_d11hhzf9";
const FooterStyle = "E_f1g147n6";
const SmallDialog = ({
  title,
  cancelText = "\u5173\u95ED",
  okText = "\u786E\u5B9A",
  showOk = true,
  onOk,
  onCancel,
  maskClosable = true,
  closable = true,
  className,
  footerClassName,
  okButtonProps,
  cancelButtonProps,
  children
}) => {
  const popModal = usePopModal();
  const handleClose = () => {
    if (onCancel) {
      onCancel(popModal);
    } else {
      popModal();
    }
  };
  const handleOk = () => {
    if (onOk) {
      onOk(popModal);
    } else {
      popModal();
    }
  };
  return /* @__PURE__ */React__default.createElement(Modal, {
    visible: true,
    title: /* @__PURE__ */React__default.createElement("span", {
      className: Typo.Display.d2_bold_title
    }, title),
    footer: /* @__PURE__ */React__default.createElement("div", {
      className: cx(FooterStyle, footerClassName)
    }, /* @__PURE__ */React__default.createElement(Button, __spreadValues({
      type: "ghost",
      onClick: handleClose
    }, cancelButtonProps), cancelText), showOk && /* @__PURE__ */React__default.createElement(Button, __spreadValues({
      type: "primary",
      onClick: handleOk
    }, okButtonProps), okText)),
    onCancel: handleClose,
    closable,
    maskClosable,
    className: cx(DialogStyle, className),
    closeIcon: /* @__PURE__ */React__default.createElement(CloseCircleFilled, null)
  }, children);
};

export { SmallDialog };
