var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/hooks/useModal.example.tsx
var useModal_example_exports = {};
__export(useModal_example_exports, {
  BasicExample: () => BasicExample,
  ComplexContentExample: () => ComplexContentExample,
  DynamicConfigExample: () => DynamicConfigExample,
  UseModalExamples: () => UseModalExamples,
  WithConfirmExample: () => WithConfirmExample,
  WithDefaultPropsExample: () => WithDefaultPropsExample
});
module.exports = __toCommonJS(useModal_example_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_useModal = __toESM(require("./useModal"));
var BasicExample = () => {
  const { open, close, Modal } = (0, import_useModal.default)();
  const handleOpenModal = () => {
    open({
      title: "基本示例",
      width: 600
    });
  };
  return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleOpenModal }, "打开基本 Modal"), /* @__PURE__ */ import_react.default.createElement(Modal, null, /* @__PURE__ */ import_react.default.createElement("p", null, "这是一个基本的 modal 内容示例。"), /* @__PURE__ */ import_react.default.createElement("p", null, "点击确定或取消按钮可以关闭 modal。"), /* @__PURE__ */ import_react.default.createElement(import_antd.Space, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: close }, "手动关闭"))));
};
var WithDefaultPropsExample = () => {
  const { open, Modal } = (0, import_useModal.default)({
    defaultProps: {
      title: "默认标题",
      width: 800,
      size: "large",
      okText: "保存",
      cancelText: "取消"
    }
  });
  return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: () => open() }, "打开带默认配置的 Modal"), /* @__PURE__ */ import_react.default.createElement(Modal, null, /* @__PURE__ */ import_react.default.createElement("p", null, "这个 modal 使用了默认配置。"), /* @__PURE__ */ import_react.default.createElement("p", null, "标题、宽度、按钮文字都是预设的。")));
};
var DynamicConfigExample = () => {
  const { open, Modal } = (0, import_useModal.default)();
  const handleOpenSmall = () => {
    open({
      title: "小尺寸 Modal",
      size: "small",
      okText: "确认"
    });
  };
  const handleOpenLarge = () => {
    open({
      title: "大尺寸 Modal",
      size: "large",
      footer: null
      // 隐藏底部按钮
    });
  };
  return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleOpenSmall }, "打开小 Modal"), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleOpenLarge }, "打开大 Modal (无底部)")), /* @__PURE__ */ import_react.default.createElement(Modal, null, /* @__PURE__ */ import_react.default.createElement("p", null, "这个 modal 的配置是动态传入的。")));
};
var WithConfirmExample = () => {
  const { open, close, Modal } = (0, import_useModal.default)();
  const handleSave = async () => {
    console.log("保存数据...");
    await new Promise((resolve) => setTimeout(resolve, 1e3));
    console.log("保存成功！");
    close();
  };
  const handleCancel = () => {
    console.log("取消操作");
    close();
  };
  return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: () => open({ title: "确认操作" }) }, "打开带确认的 Modal"), /* @__PURE__ */ import_react.default.createElement(
    Modal,
    {
      onOk: handleSave,
      onCancel: handleCancel,
      okText: "保存",
      cancelText: "取消"
    },
    /* @__PURE__ */ import_react.default.createElement("p", null, "这个示例展示了如何处理确认和取消操作。"),
    /* @__PURE__ */ import_react.default.createElement("p", null, "点击保存按钮会执行异步操作。")
  ));
};
var ComplexContentExample = () => {
  const [formData, setFormData] = import_react.default.useState({ name: "", email: "" });
  const { open, close, Modal } = (0, import_useModal.default)();
  const handleSubmit = () => {
    console.log("提交表单:", formData);
    close();
  };
  return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: () => open({ title: "用户信息", width: 500 }) }, "打开表单 Modal"), /* @__PURE__ */ import_react.default.createElement(Modal, { onOk: handleSubmit }, /* @__PURE__ */ import_react.default.createElement("div", { style: { padding: "16px 0" } }, /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 16 } }, /* @__PURE__ */ import_react.default.createElement("label", null, "姓名："), /* @__PURE__ */ import_react.default.createElement(
    "input",
    {
      type: "text",
      value: formData.name,
      onChange: (e) => setFormData({ ...formData, name: e.target.value }),
      style: { marginLeft: 8, padding: "4px 8px" }
    }
  )), /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 16 } }, /* @__PURE__ */ import_react.default.createElement("label", null, "邮箱："), /* @__PURE__ */ import_react.default.createElement(
    "input",
    {
      type: "email",
      value: formData.email,
      onChange: (e) => setFormData({ ...formData, email: e.target.value }),
      style: { marginLeft: 8, padding: "4px 8px" }
    }
  )))));
};
var UseModalExamples = () => {
  return /* @__PURE__ */ import_react.default.createElement("div", { style: { padding: 24 } }, /* @__PURE__ */ import_react.default.createElement("h1", null, "useModal Hook 使用示例"), /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 24 } }, /* @__PURE__ */ import_react.default.createElement("h2", null, "基本用法"), /* @__PURE__ */ import_react.default.createElement(BasicExample, null)), /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 24 } }, /* @__PURE__ */ import_react.default.createElement("h2", null, "带默认配置"), /* @__PURE__ */ import_react.default.createElement(WithDefaultPropsExample, null)), /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 24 } }, /* @__PURE__ */ import_react.default.createElement("h2", null, "动态配置"), /* @__PURE__ */ import_react.default.createElement(DynamicConfigExample, null)), /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 24 } }, /* @__PURE__ */ import_react.default.createElement("h2", null, "带确认操作"), /* @__PURE__ */ import_react.default.createElement(WithConfirmExample, null)), /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 24 } }, /* @__PURE__ */ import_react.default.createElement("h2", null, "复杂内容"), /* @__PURE__ */ import_react.default.createElement(ComplexContentExample, null)));
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  BasicExample,
  ComplexContentExample,
  DynamicConfigExample,
  UseModalExamples,
  WithConfirmExample,
  WithDefaultPropsExample
});
