@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
92 lines (89 loc) • 2.66 kB
JavaScript
'use client';
import FlexBasic_default from "../Flex/FlexBasic.mjs";
import Button_default from "../Button/Button.mjs";
import Form_default from "../Form/index.mjs";
import Modal_default from "../Modal/Modal.mjs";
import { styles } from "./style.mjs";
import { memo } from "react";
import { jsx } from "react/jsx-runtime";
import { cx, useResponsive } from "antd-style";
//#region src/FormModal/FormModal.tsx
const FormModal = memo(({ classNames = {}, className, style, closable, styles: styles$1 = {}, allowFullscreen, title, afterOpenChange, width, onCancel, centered, open, afterClose, destroyOnHidden, closeIcon, paddings, height, enableResponsive, zIndex, mask, getContainer, keyboard, focusTriggerAfterClose, forceRender, loading, footer, submitButtonProps, submitLoading, onFinish, submitText, variant = "borderless", gap, onSubmit, children, ref, ...rest }) => {
const { mobile } = useResponsive();
const { form: formClassName, ...modalClassNames } = classNames;
const { form: formStyle, ...modalStyles } = typeof styles$1 === "function" ? { form: void 0 } : styles$1;
return /* @__PURE__ */ jsx(Modal_default, {
afterClose,
afterOpenChange,
allowFullscreen,
centered,
className,
classNames: modalClassNames,
closable,
closeIcon,
confirmLoading: submitLoading,
destroyOnHidden,
enableResponsive,
focusTriggerAfterClose,
footer: null,
forceRender,
getContainer,
height,
keyboard,
loading,
mask,
onCancel,
open,
paddings,
style,
styles: typeof styles$1 === "function" ? styles$1 : {
...modalStyles,
body: {
paddingTop: mobile ? 0 : void 0,
...modalStyles?.body
}
},
title,
width,
zIndex,
children: /* @__PURE__ */ jsx(Form_default, {
className: cx(styles.form, formClassName || ""),
clearOnDestroy: destroyOnHidden,
footer: /* @__PURE__ */ jsx(FlexBasic_default, {
align: "center",
className: styles.footer,
gap: 8,
horizontal: true,
children: footer || /* @__PURE__ */ jsx(Button_default, {
block: true,
htmlType: "submit",
loading: submitLoading,
onClick: onSubmit,
type: "primary",
...submitButtonProps,
style: {
flex: 1,
...submitButtonProps?.style
},
children: submitText || "Submit"
})
}),
gap: gap || (variant === "borderless" ? 24 : gap),
onFinish,
ref,
style: {
paddingBottom: 56,
...formStyle
},
styles: { title: { fontSize: 14 } },
variant,
...rest,
children
})
});
});
FormModal.displayName = "FormModal";
var FormModal_default = FormModal;
//#endregion
export { FormModal_default as default };
//# sourceMappingURL=FormModal.mjs.map