import { type ComponentType, type ForwardRefExoticComponent, type PropsWithoutRef, type RefAttributes } from 'react';
import type { CreateModalOptions, ModalChildProps, ModalContainerRef, ModalWrapperProps } from './types';
/**
* 创建一个自动管理生命周期的 Modal 容器。
*
* - 自动管理 open 状态,通过 ref 暴露 `open(params)` / `close()` 方法
* - open=false 时 Content 完全卸载,内部所有 useState / useForm 等自动销毁
* - 泛型 P 决定 open() 的参数结构,Content 通过 `params` 接收
* - 支持 `beforeClose` 守卫,可在关闭前拦截(如表单脏检查)
* - 支持 `destroyAfterClose`,等待退出动画结束后再卸载内容
*
* @example
* ```tsx
* const UserFormModal = createModal<{ mode: 'create' | 'edit'; id?: string }>(
* ({ params, onClose, onSuccess }) => {
* const [form] = SForm.useForm();
* return (
*
>(Content: ComponentType