@react-formgen/json-schema
Version:
A headless, type-safe, customizable, and super simple React form generator.
21 lines (20 loc) • 1.86 kB
TypeScript
import { JSONSchema7 } from "json-schema";
import { FormState as CoreFormState } from "@react-formgen/core";
import { ErrorObject } from "ajv";
import { FormgenJSONSchema7, FormProviderProps, FormProps } from "./components";
declare const CoreFormProvider: import("react").FC<Omit<import("@react-formgen/core").FormProviderProps<JSONSchema7 | FormgenJSONSchema7>, "createInitialData">>, useFormContext: <T>(selector: (state: CoreFormState<JSONSchema7 | FormgenJSONSchema7, ErrorObject<string, Record<string, any>, unknown>>) => T) => T, useFormDataAtPath: (path: string[], defaultOnNull?: unknown) => [any, (value: any) => void], useErrorsAtPath: (path: string[]) => ErrorObject<string, Record<string, any>, unknown>[] | undefined, useArrayTemplate: (path: string[], zeroState: () => any, defaultOnNull?: any) => {
valueAtPath: any;
errorsAtPath: ErrorObject<string, Record<string, any>, unknown>[] | undefined;
moveItem: (index: number, direction: "up" | "down") => void;
removeItem: (index: number) => void;
addItem: () => void;
}, useTemplates: () => {
[key: string]: import("react").ComponentType<any>;
}, useRenderTemplate: () => import("react").ComponentType<import("@react-formgen/core").RenderTemplateProps<JSONSchema7 | FormgenJSONSchema7>>, CoreForm: import("react").FC<import("@react-formgen/core").FormProps<JSONSchema7 | FormgenJSONSchema7, ErrorObject<string, Record<string, any>, unknown>>>;
export type FormState = CoreFormState<JSONSchema7 | FormgenJSONSchema7, ErrorObject>;
declare const FormProvider: React.FC<FormProviderProps>;
declare const Form: React.FC<FormProps>;
export { CoreFormProvider, CoreForm, FormProvider, useFormContext, useFormDataAtPath, useErrorsAtPath, useArrayTemplate, useTemplates, useRenderTemplate, Form, };
export * from "./components";
export * from "./utils";
export * from "./hooks";