import e, { useState as E } from "react";
import { useGeneratedHtmlId as f, EuiLink as p, EuiModal as M, EuiModalHeader as F, EuiModalHeaderTitle as b, EuiModalBody as C } from "@elastic/eui";
import "react-router-dom";
import "../components/Icons/EuiIcon.js";
import { Button as I } from "../components/Button.js";
import { Form as h } from "./Form.js";
const B = ({ schema: m, values: i, onSubmit: n, title: d, buttons: c, button: l }) => {
  const [s, o] = E(!1), u = f({ prefix: "modalForm" }), t = () => o(!1), a = () => o(!0);
  let r;
  return s && (r = /* @__PURE__ */ e.createElement(M, {
    onClose: t,
    initialFocus: "[name=popswitch]"
  }, /* @__PURE__ */ e.createElement(F, null, /* @__PURE__ */ e.createElement(b, null, /* @__PURE__ */ e.createElement("h2", {
    className: "text-lg"
  }, d))), /* @__PURE__ */ e.createElement(C, null, /* @__PURE__ */ e.createElement(h, {
    formId: u,
    data: m,
    values: i,
    onSubmit: n,
    buttons: c,
    onCloseModal: t
  })))), /* @__PURE__ */ e.createElement("div", null, l ? /* @__PURE__ */ e.createElement(I, {
    label: l.label,
    icon: l.icon,
    onClick: a,
    className: "border boder-gray-600"
  }) : /* @__PURE__ */ e.createElement(p, {
    onClick: a
  }, "\u7F16\u8F91"), r);
};
export {
  B as FormModal
};
//# sourceMappingURL=Modal.js.map
