import type { ModalProps } from "@mantine/core"; import type { ContextModalProps } from "@mantine/modals"; import { useState } from "react"; import { type Modal2Ref, ModalBody, ModalFooter, ModalTitle } from "ui/components/modal/Modal2"; import { Step, Steps, useStepContext } from "ui/components/steps/Steps"; import { StepCreate } from "ui/modules/data/components/schema/create-modal/step.create"; import { StepEntity } from "./step.entity"; import { StepEntityFields } from "./step.entity.fields"; import { StepRelation } from "./step.relation"; import { StepSelect } from "./step.select"; import Templates from "./templates/register"; import type { TCreateModalSchema } from "./schema"; export type CreateModalRef = Modal2Ref; export function CreateModal({ context, id, innerProps: { initialPath = [], initialState }, }: ContextModalProps<{ initialPath?: string[]; initialState?: TCreateModalSchema }>) { const [path, setPath] = useState(initialPath); function close() { context.closeModal(id); } return ( {/* Templates */} {Templates.map(([Component, meta]) => ( ))} ); } CreateModal.defaultTitle = undefined; CreateModal.modalProps = { withCloseButton: false, size: "xl", padding: 0, } satisfies Partial; export { ModalBody, ModalFooter, ModalTitle, useStepContext };