'use strict';

var icons = require('@ant-design/icons');
var core = require('@linaria/core');
var index = require('../../core/KitStoreProvider/index.js');
var antd = require('antd');
var React = require('react');
var index$2 = require('../../core/Button/index.js');
var index$1 = require('../../core/Typo/index.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);

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 = index.usePopModal();
  const handleClose = () => {
    if (onCancel) {
      onCancel(popModal);
    } else {
      popModal();
    }
  };
  const handleOk = () => {
    if (onOk) {
      onOk(popModal);
    } else {
      popModal();
    }
  };
  return /* @__PURE__ */React__default.default.createElement(antd.Modal, {
    visible: true,
    title: /* @__PURE__ */React__default.default.createElement("span", {
      className: index$1.Typo.Display.d2_bold_title
    }, title),
    footer: /* @__PURE__ */React__default.default.createElement("div", {
      className: core.cx(FooterStyle, footerClassName)
    }, /* @__PURE__ */React__default.default.createElement(index$2, __spreadValues({
      type: "ghost",
      onClick: handleClose
    }, cancelButtonProps), cancelText), showOk && /* @__PURE__ */React__default.default.createElement(index$2, __spreadValues({
      type: "primary",
      onClick: handleOk
    }, okButtonProps), okText)),
    onCancel: handleClose,
    closable,
    maskClosable,
    className: core.cx(DialogStyle, className),
    closeIcon: /* @__PURE__ */React__default.default.createElement(icons.CloseCircleFilled, null)
  }, children);
};

exports.SmallDialog = SmallDialog;
