import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
import { SubmitButton } from "./components/SubmitButton";
import { InputField } from "./components/InputField";
import { SelectField } from "./components/SelectField";
import { CheckboxField } from "./components/CheckBox";
import { InputPasswordField } from "./components/InputPasswordField";

export const { fieldContext, useFieldContext, formContext, useFormContext } =
    createFormHookContexts();

export const { useAppForm } = createFormHook({
    fieldComponents: {
        InputField,
        InputPasswordField,
        SelectField,
        CheckboxField,
    },
    formComponents: { SubmitButton },
    fieldContext,
    formContext,
});
