@paragrav/rhf-utils 0.0.138 → 0.0.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -18
- package/dist/esm/{utils/createContext.mjs → createContext.mjs} +1 -1
- package/dist/esm/group.mjs +74 -0
- package/dist/esm/main.mjs +483 -0
- package/dist/esm/trpc.mjs +41 -0
- package/dist/esm/useFlatFieldErrorsContext.mjs +10 -0
- package/dist/esm/utils.mjs +20 -0
- package/dist/types/group.d.ts +9 -0
- package/dist/types/main.d.ts +15 -1
- package/dist/types/trpc.d.ts +2 -0
- package/dist/types/utils.d.ts +1 -0
- package/package.json +22 -4
- package/dist/esm/client/config/useRhfUtilsClientConfigContext.mjs +0 -9
- package/dist/esm/client/index.mjs +0 -49
- package/dist/esm/client/utils.mjs +0 -38
- package/dist/esm/client/zod/context/RhfUtilsClientForZodContextProvider.mjs +0 -17
- package/dist/esm/client/zod/context/RhfUtilsZodForm.mjs +0 -12
- package/dist/esm/client/zod/context/useRhfUtilsClientForZodContext.mjs +0 -9
- package/dist/esm/client/zod/context/useRhfUtilsZodForm.mjs +0 -5
- package/dist/esm/client/zod/createRhfUtilsClientForZod.mjs +0 -6
- package/dist/esm/devtool/LazyDevTool.mjs +0 -15
- package/dist/esm/errors/flat/FlatFieldErrorsList.mjs +0 -17
- package/dist/esm/errors/flat/context/FlatFieldErrorsContextProvider.mjs +0 -27
- package/dist/esm/errors/flat/context/useFlatFieldErrorsContext.mjs +0 -9
- package/dist/esm/errors/flat/context/useFlatFieldErrorsContextHasOnlyOrphans.mjs +0 -9
- package/dist/esm/errors/flat/context/useFlatFieldErrorsContextOutput.mjs +0 -24
- package/dist/esm/errors/flat/filterFlatFieldErrors.mjs +0 -10
- package/dist/esm/errors/flat/flattenFieldErrors.mjs +0 -5
- package/dist/esm/errors/flat/getFlatFieldErrors.mjs +0 -24
- package/dist/esm/errors/getRefdFromFlatFieldErrors.mjs +0 -8
- package/dist/esm/errors/isFieldErrorRefd.mjs +0 -4
- package/dist/esm/errors/isFlatFieldErrorEntryRefd.mjs +0 -5
- package/dist/esm/errors/message/FormErrorMessage.mjs +0 -14
- package/dist/esm/errors/message/RhfUtilsFieldErrorMessage.mjs +0 -14
- package/dist/esm/errors/nonfield/FormNonFieldErrorMarker.mjs +0 -19
- package/dist/esm/errors/nonfield/FormNonFieldErrorMarker.utils.mjs +0 -23
- package/dist/esm/errors/nonfield/FormNonFieldErrorMarkerHtmlAttribute.mjs +0 -4
- package/dist/esm/errors/nonfield/isNonFieldErrorMarkerInDOM.mjs +0 -5
- package/dist/esm/errors/orphan/getIsOrphanFormErrorWithParentElement.mjs +0 -5
- package/dist/esm/errors/orphan/getOrphansFromFlatFieldErrors.mjs +0 -8
- package/dist/esm/errors/orphan/isOrphanFormError.mjs +0 -12
- package/dist/esm/errors/output/consoleErrors.mjs +0 -6
- package/dist/esm/errors/root/RootErrorsListFromFlatFieldErrorsContext.mjs +0 -10
- package/dist/esm/errors/root/consts.mjs +0 -4
- package/dist/esm/errors/root/getRootsFromFlatFieldErrors.mjs +0 -8
- package/dist/esm/errors/root/isFlatFieldErrorEntryPathRoot.mjs +0 -5
- package/dist/esm/errors/root/isFormErrorPathRoot.mjs +0 -5
- package/dist/esm/exports.mjs +0 -46
- package/dist/esm/form/Form.mjs +0 -86
- package/dist/esm/form/FormWithProviders.mjs +0 -11
- package/dist/esm/form/RhfUtilsFormProviders.mjs +0 -24
- package/dist/esm/form/_Controller.mjs +0 -8
- package/dist/esm/form/context/group/FormGroupContextProvider.mjs +0 -30
- package/dist/esm/form/context/group/index.mjs +0 -11
- package/dist/esm/form/context/group/useFormGroupChildIsMountedTracker.mjs +0 -6
- package/dist/esm/form/context/group/useFormGroupChildIsSubmittingTracker.mjs +0 -10
- package/dist/esm/form/context/group/useFormGroupChildTracker.mjs +0 -13
- package/dist/esm/form/context/group/useFormGroupIsAnyBusy.mjs +0 -8
- package/dist/esm/form/context/group/useFormGroupIsChildBusy.mjs +0 -8
- package/dist/esm/form/context/group/useFormGroupIsParentBusy.mjs +0 -8
- package/dist/esm/form/context/group/useFormGroupParentTracker.mjs +0 -13
- package/dist/esm/form/context/group/useFormOrParentIsBusy.mjs +0 -10
- package/dist/esm/form/context/utils/RhfUtilsContextProvider.mjs +0 -23
- package/dist/esm/form/context/utils/useRhfUtilsContext.mjs +0 -6
- package/dist/esm/form/context/utils/useRhfUtilsContextRequestSubmit.mjs +0 -9
- package/dist/esm/form/useFormIsBusy.mjs +0 -8
- package/dist/esm/form/useRhfUtilsForm.mjs +0 -43
- package/dist/esm/form/utils/getSubmitterButtonData.mjs +0 -12
- package/dist/esm/form/utils/useFormRequestSubmit.mjs +0 -13
- package/dist/esm/submit/error/FormSubmitError.mjs +0 -8
- package/dist/esm/submit/error/setCtxErrorsByFormSubmitFieldErrors.mjs +0 -12
- package/dist/esm/submit/useFormOnSubmitted.mjs +0 -12
- package/dist/esm/submit/useResetFormOnSubmitted.mjs +0 -36
- package/dist/esm/submit/useSubmitFormOnChange.mjs +0 -26
- package/dist/esm/utils/PassthroughChildren.mjs +0 -7
- package/dist/esm/utils/isEmptyObject.mjs +0 -4
- package/dist/esm/utils/useDebouncedOnChangeValue.mjs +0 -26
- package/dist/esm/utils/useRefIfValueWasTrue.mjs +0 -14
- package/dist/types/client/config/RhfUtilsClientConfig.d.ts +0 -71
- package/dist/types/client/config/useRhfUtilsClientConfigContext.d.ts +0 -5
- package/dist/types/client/context.d.ts +0 -3
- package/dist/types/client/index.d.ts +0 -30
- package/dist/types/client/utils.d.ts +0 -13
- package/dist/types/client/zod/RhfUtilsUseFormChildrenZodFC.d.ts +0 -13
- package/dist/types/client/zod/RhfUtilsUseFormChildrenZodProps.d.ts +0 -5
- package/dist/types/client/zod/ZodTypeFieldValues.d.ts +0 -4
- package/dist/types/client/zod/consts.d.ts +0 -4
- package/dist/types/client/zod/context/RhfUtilsClientForZodContextProvider.d.ts +0 -8
- package/dist/types/client/zod/context/RhfUtilsZodForm.d.ts +0 -9
- package/dist/types/client/zod/context/useRhfUtilsClientForZodContext.d.ts +0 -6
- package/dist/types/client/zod/context/useRhfUtilsZodForm.d.ts +0 -8
- package/dist/types/client/zod/createRhfUtilsClientForZod.d.ts +0 -4
- package/dist/types/devtool/LazyDevTool.d.ts +0 -12
- package/dist/types/errors/flat/FlatFieldErrorsList.d.ts +0 -7
- package/dist/types/errors/flat/context/FlatFieldErrorsContextProvider.d.ts +0 -11
- package/dist/types/errors/flat/context/FlatFieldErrorsOutputConfig.d.ts +0 -20
- package/dist/types/errors/flat/context/useFlatFieldErrorsContext.d.ts +0 -13
- package/dist/types/errors/flat/context/useFlatFieldErrorsContextHasOnlyOrphans.d.ts +0 -7
- package/dist/types/errors/flat/context/useFlatFieldErrorsContextOutput.d.ts +0 -7
- package/dist/types/errors/flat/filterFlatFieldErrors.d.ts +0 -9
- package/dist/types/errors/flat/flattenFieldErrors.d.ts +0 -16
- package/dist/types/errors/flat/getFlatFieldErrors.d.ts +0 -32
- package/dist/types/errors/flat/types.d.ts +0 -17
- package/dist/types/errors/getRefdFromFlatFieldErrors.d.ts +0 -2
- package/dist/types/errors/isFieldErrorRefd.d.ts +0 -7
- package/dist/types/errors/isFlatFieldErrorEntryRefd.d.ts +0 -7
- package/dist/types/errors/message/FormErrorMessage.d.ts +0 -8
- package/dist/types/errors/message/RhfUtilsFieldErrorMessage.d.ts +0 -10
- package/dist/types/errors/nonfield/FormNonFieldErrorMarker.d.ts +0 -13
- package/dist/types/errors/nonfield/FormNonFieldErrorMarker.spec.d.ts +0 -1
- package/dist/types/errors/nonfield/FormNonFieldErrorMarker.utils.d.ts +0 -18
- package/dist/types/errors/nonfield/FormNonFieldErrorMarkerHtmlAttribute.d.ts +0 -5
- package/dist/types/errors/nonfield/isNonFieldError.d.ts +0 -19
- package/dist/types/errors/nonfield/isNonFieldErrorMarkerInDOM.d.ts +0 -6
- package/dist/types/errors/orphan/getIsOrphanFormErrorWithParentElement.d.ts +0 -7
- package/dist/types/errors/orphan/getOrphansFromFlatFieldErrors.d.ts +0 -4
- package/dist/types/errors/orphan/isOrphanFormError.d.ts +0 -4
- package/dist/types/errors/output/consoleErrors.d.ts +0 -7
- package/dist/types/errors/output/types.d.ts +0 -7
- package/dist/types/errors/root/RootErrorsListFromFlatFieldErrorsContext.d.ts +0 -2
- package/dist/types/errors/root/consts.d.ts +0 -1
- package/dist/types/errors/root/getRootsFromFlatFieldErrors.d.ts +0 -2
- package/dist/types/errors/root/isFlatFieldErrorEntryPathRoot.d.ts +0 -7
- package/dist/types/errors/root/isFormErrorPathRoot.d.ts +0 -7
- package/dist/types/errors/trpc/getOnSubmitTrpcClientErrorHandler.d.ts +0 -11
- package/dist/types/errors/trpc/trpcClientErrorMessageSchema.d.ts +0 -24
- package/dist/types/errors/trpc/trpcClientErrorToFormSubmitFieldErrorsSchemaTransformer.d.ts +0 -28
- package/dist/types/exports.d.ts +0 -29
- package/dist/types/form/Form.d.ts +0 -11
- package/dist/types/form/FormWithProviders.d.ts +0 -13
- package/dist/types/form/RhfUtilsFormOptions.d.ts +0 -29
- package/dist/types/form/RhfUtilsFormProviders.d.ts +0 -12
- package/dist/types/form/SafeFieldValues.d.ts +0 -4
- package/dist/types/form/UseRhfUtilsFormChildrenProps.d.ts +0 -20
- package/dist/types/form/UseRhfUtilsFormOnSubmitContext.d.ts +0 -27
- package/dist/types/form/UseRhfUtilsFormProps.d.ts +0 -23
- package/dist/types/form/UseRhfUtilsFormReturn.d.ts +0 -20
- package/dist/types/form/_Controller.d.ts +0 -6
- package/dist/types/form/context/group/FormGroupContextProvider.d.ts +0 -5
- package/dist/types/form/context/group/index.d.ts +0 -14
- package/dist/types/form/context/group/useFormGroupChildIsMountedTracker.d.ts +0 -5
- package/dist/types/form/context/group/useFormGroupChildIsSubmittingTracker.d.ts +0 -5
- package/dist/types/form/context/group/useFormGroupChildTracker.d.ts +0 -6
- package/dist/types/form/context/group/useFormGroupIsAnyBusy.d.ts +0 -2
- package/dist/types/form/context/group/useFormGroupIsChildBusy.d.ts +0 -2
- package/dist/types/form/context/group/useFormGroupIsParentBusy.d.ts +0 -2
- package/dist/types/form/context/group/useFormGroupParentTracker.d.ts +0 -7
- package/dist/types/form/context/group/useFormOrParentIsBusy.d.ts +0 -2
- package/dist/types/form/context/utils/RhfUtilsContextProvider.d.ts +0 -9
- package/dist/types/form/context/utils/useRhfUtilsContext.d.ts +0 -14
- package/dist/types/form/context/utils/useRhfUtilsContextRequestSubmit.d.ts +0 -5
- package/dist/types/form/useFormIsBusy.d.ts +0 -2
- package/dist/types/form/useRhfUtilsForm.d.ts +0 -16
- package/dist/types/form/utils/getSubmitterButtonData.d.ts +0 -8
- package/dist/types/form/utils/useFormRequestSubmit.d.ts +0 -11
- package/dist/types/form/utils/useShouldFormBlockNavigation.d.ts +0 -26
- package/dist/types/register.d.ts +0 -7
- package/dist/types/submit/error/FormSubmitError.d.ts +0 -7
- package/dist/types/submit/error/FormSubmitFieldErrors.d.ts +0 -15
- package/dist/types/submit/error/setCtxErrorsByFormSubmitFieldErrors.d.ts +0 -10
- package/dist/types/submit/useFormOnSubmitSuccessfulAndReset.d.ts +0 -15
- package/dist/types/submit/useFormOnSubmitted.d.ts +0 -6
- package/dist/types/submit/useResetFormOnSubmitted.d.ts +0 -36
- package/dist/types/submit/useSubmitFormOnChange.d.ts +0 -9
- package/dist/types/utils/PassthroughChildren.d.ts +0 -7
- package/dist/types/utils/createContext.d.ts +0 -12
- package/dist/types/utils/fixedForwardRef.d.ts +0 -7
- package/dist/types/utils/isEmptyObject.d.ts +0 -2
- package/dist/types/utils/timeoutAsync.d.ts +0 -6
- package/dist/types/utils/types.d.ts +0 -1
- package/dist/types/utils/useDebouncedOnChangeValue.d.ts +0 -14
- package/dist/types/utils/useImperativeForwardedRef.d.ts +0 -11
- package/dist/types/utils/useRefIfValueWasTrue.d.ts +0 -2
- package/dist/types/utils/useThrowAsyncError.d.ts +0 -5
- package/dist/types/utils/useToggle.d.ts +0 -4
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { RhfUtilsClientConfig } from './RhfUtilsClientConfig';
|
|
2
|
-
|
|
3
|
-
declare const _RhfUtilsClientConfigContextProvider: import('react').Provider<RhfUtilsClientConfig | undefined>, useRhfUtilsClientConfigMaybeContext: () => RhfUtilsClientConfig | undefined;
|
|
4
|
-
export default useRhfUtilsClientConfigMaybeContext;
|
|
5
|
-
export { _RhfUtilsClientConfigContextProvider };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { CreateRhfUtilsClient, ObjectSchema } from '.';
|
|
2
|
-
|
|
3
|
-
export type RhfUtilsClientContext<TObjectSchema extends ObjectSchema<TObjectSchemaInputKey, TObjectSchemaOutputKey>, TObjectSchemaInputKey extends string, TObjectSchemaOutputKey extends string> = CreateRhfUtilsClient<TObjectSchema, TObjectSchemaInputKey, TObjectSchemaOutputKey>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { Resolver } from 'react-hook-form';
|
|
3
|
-
import { RhfUtilsClientConfig } from './config/RhfUtilsClientConfig';
|
|
4
|
-
import { FormWithProvidersProps } from '../form/FormWithProviders';
|
|
5
|
-
import { SafeFieldValues } from '../form/SafeFieldValues';
|
|
6
|
-
import { UseRhfUtilsFormProps } from '../form/UseRhfUtilsFormProps';
|
|
7
|
-
import { UseRhfUtilsFormReturn } from '../form/UseRhfUtilsFormReturn';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Generic object schema type.
|
|
11
|
-
*/
|
|
12
|
-
export type ObjectSchema<TInputKey extends string, TOutputKey extends string> = {
|
|
13
|
-
[key in TInputKey]: SafeFieldValues;
|
|
14
|
-
} & {
|
|
15
|
-
[key in TOutputKey]: SafeFieldValues;
|
|
16
|
-
};
|
|
17
|
-
export type CreateRhfUtilsClient<TObjectSchema extends ObjectSchema<TObjectSchemaInputKey, TObjectSchemaOutputKey>, TObjectSchemaInputKey extends string, TObjectSchemaOutputKey extends string> = {
|
|
18
|
-
useForm: <TSchema extends TObjectSchema, TSchemaInput extends SafeFieldValues = TSchema[TObjectSchemaInputKey], TSchemaOutput extends SafeFieldValues = TSchema[TObjectSchemaOutputKey], UseRhfUtilsFormPropsForm extends UseRhfUtilsFormProps<TSchemaInput, TSchemaOutput> = UseRhfUtilsFormProps<TSchemaInput, TSchemaOutput>>(schema: TSchema, form: UseRhfUtilsFormPropsForm) => UseRhfUtilsFormReturn<TSchemaInput, TSchemaOutput> & {
|
|
19
|
-
FormWithProviders: React.FC<React.PropsWithChildren>;
|
|
20
|
-
};
|
|
21
|
-
FormWithProviders: <TSchema extends TObjectSchema, TSchemaInput extends SafeFieldValues = TSchema[TObjectSchemaInputKey], TSchemaOutput extends SafeFieldValues = TSchema[TObjectSchemaOutputKey]>(props: {
|
|
22
|
-
schema: TSchema;
|
|
23
|
-
} & FormWithProvidersProps<TSchemaInput, TSchemaOutput>) => JSX.Element;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* ...
|
|
27
|
-
*
|
|
28
|
-
* (We need to use generics to generate types for schema resolver.)
|
|
29
|
-
*/
|
|
30
|
-
export declare const createRhfUtilsClient: <TObjectSchema extends ObjectSchema<TObjectSchemaInputKey, TObjectSchemaOutputKey>, TObjectSchemaInputKey extends string, TObjectSchemaOutputKey extends string>(resolver: (schema: TObjectSchema) => Resolver<SafeFieldValues, unknown>) => (config: RhfUtilsClientConfig) => CreateRhfUtilsClient<TObjectSchema, TObjectSchemaInputKey, TObjectSchemaOutputKey>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RhfUtilsFormOptions } from '../form/RhfUtilsFormOptions';
|
|
2
|
-
import { SafeFieldValues } from '../form/SafeFieldValues';
|
|
3
|
-
import { UseRhfUtilsFormProps } from '../form/UseRhfUtilsFormProps';
|
|
4
|
-
import { RhfUtilsClientConfig } from './config/RhfUtilsClientConfig';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Merge {@link RhfUtilsClientConfig.defaults} with array of {@link UseRhfUtilsFormProps}'s overrides.
|
|
8
|
-
*/
|
|
9
|
-
export declare const mergeRhfUtilsClientConfigDefaultsWithUseRhfUtilsFormProps: <TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>(defaults: RhfUtilsClientConfig["defaults"], ...props: Pick<UseRhfUtilsFormProps<TFieldValues, TTransformedValues>, "rhf" | "utils" | "form">[]) => {
|
|
10
|
-
rhf?: Pick<import('react-hook-form').UseFormProps, "mode" | "reValidateMode" | "resetOptions" | "context" | "shouldFocusError" | "shouldUnregister" | "shouldUseNativeValidation" | "progressive" | "criteriaMode" | "delayError">;
|
|
11
|
-
utils?: RhfUtilsFormOptions;
|
|
12
|
-
form?: Omit<React.PropsWithoutRef<JSX.IntrinsicElements["form"]>, "onSubmit">;
|
|
13
|
-
} | undefined;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { RhfUtilsUseFormChildrenZodProps } from './RhfUtilsUseFormChildrenZodProps';
|
|
3
|
-
import { ZodTypeFieldValues } from './ZodTypeFieldValues';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* {@link React.FC} for {@link RhfUtilsUseFormChildrenZodProps}.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* const Children: RhfUtilsUseFormChildrenZodFC<typeof schema> = () => {};
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export type RhfUtilsUseFormChildrenZodFC<TSchema extends ZodTypeFieldValues> = React.FC<RhfUtilsUseFormChildrenZodProps<TSchema>>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { UseRhfUtilsFormChildrenProps } from '../../form/UseRhfUtilsFormChildrenProps';
|
|
2
|
-
import { zodTypeInput, zodTypeOutput } from './consts';
|
|
3
|
-
import { ZodTypeFieldValues } from './ZodTypeFieldValues';
|
|
4
|
-
|
|
5
|
-
export type RhfUtilsUseFormChildrenZodProps<TSchema extends ZodTypeFieldValues> = UseRhfUtilsFormChildrenProps<TSchema[typeof zodTypeInput], TSchema[typeof zodTypeOutput]>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { RhfUtilsClientConfig } from '../../config/RhfUtilsClientConfig';
|
|
3
|
-
|
|
4
|
-
type Props = React.PropsWithChildren<{
|
|
5
|
-
config?: RhfUtilsClientConfig;
|
|
6
|
-
}>;
|
|
7
|
-
declare const RhfUtilsClientForZodContextProvider: React.FC<Props>;
|
|
8
|
-
export default RhfUtilsClientForZodContextProvider;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { UseRhfUtilsFormProps } from '../../../form/UseRhfUtilsFormProps';
|
|
2
|
-
import { zodTypeInput, zodTypeOutput } from '../consts';
|
|
3
|
-
import { ZodTypeFieldValues } from '../ZodTypeFieldValues';
|
|
4
|
-
|
|
5
|
-
type Props<TSchema extends ZodTypeFieldValues> = {
|
|
6
|
-
schema: TSchema;
|
|
7
|
-
} & UseRhfUtilsFormProps<TSchema[typeof zodTypeInput], TSchema[typeof zodTypeOutput]>;
|
|
8
|
-
declare function RhfUtilsZodForm<TSchema extends ZodTypeFieldValues>({ schema, ...props }: Props<TSchema>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export default RhfUtilsZodForm;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { default as createRhfUtilsClientForZod } from '../createRhfUtilsClientForZod';
|
|
2
|
-
|
|
3
|
-
export type RhfUtilsClientForZodContext = ReturnType<typeof createRhfUtilsClientForZod>;
|
|
4
|
-
declare const _RhfUtilsClientForZodContextProvider: import('react').Provider<import('../..').CreateRhfUtilsClient<import('../ZodTypeFieldValues').ZodTypeFieldValues, "_input", "_output"> | undefined>, useRhfUtilsClientForZodContext: () => import('../..').CreateRhfUtilsClient<import('../ZodTypeFieldValues').ZodTypeFieldValues, "_input", "_output">;
|
|
5
|
-
export default useRhfUtilsClientForZodContext;
|
|
6
|
-
export { _RhfUtilsClientForZodContextProvider };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { UseRhfUtilsFormProps } from '../../../form/UseRhfUtilsFormProps';
|
|
2
|
-
import { zodTypeInput, zodTypeOutput } from '../consts';
|
|
3
|
-
import { ZodTypeFieldValues } from '../ZodTypeFieldValues';
|
|
4
|
-
|
|
5
|
-
declare const useRhfUtilsZodForm: <TSchema extends ZodTypeFieldValues>(schema: TSchema, form: UseRhfUtilsFormProps<TSchema[typeof zodTypeInput], TSchema[typeof zodTypeOutput]>) => import('../../../form/UseRhfUtilsFormReturn').UseRhfUtilsFormReturn<TSchema["_input"], TSchema["_output"]> & {
|
|
6
|
-
FormWithProviders: import('react').FC<import('react').PropsWithChildren>;
|
|
7
|
-
};
|
|
8
|
-
export default useRhfUtilsZodForm;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ZodTypeFieldValues } from './ZodTypeFieldValues';
|
|
2
|
-
|
|
3
|
-
declare const createRhfUtilsClientForZod: (config: import('../config/RhfUtilsClientConfig').RhfUtilsClientConfig) => import('..').CreateRhfUtilsClient<ZodTypeFieldValues, "_input", "_output">;
|
|
4
|
-
export default createRhfUtilsClientForZod;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DevtoolUIProps } from '@hookform/devtools/dist/devToolUI';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
|
|
4
|
-
type LazyDevToolProps = {
|
|
5
|
-
isDevelopment?: boolean;
|
|
6
|
-
props?: Omit<DevtoolUIProps, 'control'>;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Lazy-loaded RHF DevTool.
|
|
10
|
-
*/
|
|
11
|
-
declare const LazyDevTool: React.FC<LazyDevToolProps>;
|
|
12
|
-
export default LazyDevTool;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
type Props = React.PropsWithChildren<{
|
|
4
|
-
formRef: React.RefObject<HTMLFormElement>;
|
|
5
|
-
}>;
|
|
6
|
-
/**
|
|
7
|
-
* Provides a flattened version of the form errors.
|
|
8
|
-
* Allows flattening and filtering to happen once per errors change.
|
|
9
|
-
*/
|
|
10
|
-
declare const FlatFieldErrorsContextProvider: React.FC<Props>;
|
|
11
|
-
export default FlatFieldErrorsContextProvider;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { RhfUtilsErrorsOutputConsoleConfig } from '../../output/types';
|
|
2
|
-
import { FlatFieldErrorsContext } from './useFlatFieldErrorsContext';
|
|
3
|
-
|
|
4
|
-
export type FlatFieldErrorsOutputConfig = {
|
|
5
|
-
/**
|
|
6
|
-
* Configure how/if errors should be outputted to console.
|
|
7
|
-
*
|
|
8
|
-
* Example use cases:
|
|
9
|
-
* - console.debug errors in development environment.
|
|
10
|
-
* - console.error certain errors in production environment.
|
|
11
|
-
*/
|
|
12
|
-
console?: (context: FlatFieldErrorsContext) => RhfUtilsErrorsOutputConsoleConfig | null | false | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* Configure how/if errors should be thrown.
|
|
15
|
-
*
|
|
16
|
-
* Example use case:
|
|
17
|
-
* - bring attention to certain errors in development environment.
|
|
18
|
-
*/
|
|
19
|
-
throw?: (context: FlatFieldErrorsContext) => true | string | false | undefined;
|
|
20
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FlatFieldErrors } from '../types';
|
|
2
|
-
|
|
3
|
-
export type FlatFieldErrorsContext = {
|
|
4
|
-
all: FlatFieldErrors;
|
|
5
|
-
fields: FlatFieldErrors;
|
|
6
|
-
roots: FlatFieldErrors;
|
|
7
|
-
orphans: FlatFieldErrors;
|
|
8
|
-
hasErrors: boolean;
|
|
9
|
-
hasOrphans: boolean;
|
|
10
|
-
};
|
|
11
|
-
declare const _FormErrorsFlatContextProvider: import('react').Provider<FlatFieldErrorsContext | undefined>, useFlatFieldErrorsContext: () => FlatFieldErrorsContext;
|
|
12
|
-
export default useFlatFieldErrorsContext;
|
|
13
|
-
export { _FormErrorsFlatContextProvider };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FlatFieldErrorsOutputConfig } from './FlatFieldErrorsOutputConfig';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Outputs (e.g., console, throw) errors based on config.
|
|
5
|
-
*/
|
|
6
|
-
declare const useFlatFieldErrorsContextOutput: (config?: FlatFieldErrorsOutputConfig) => void;
|
|
7
|
-
export default useFlatFieldErrorsContextOutput;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FlatFieldErrorEntry, FlatFieldErrors } from './types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Filter {@link FlatFieldErrors} by a predicate.
|
|
5
|
-
*
|
|
6
|
-
* (Encapsulates to and from Object entries.)
|
|
7
|
-
*/
|
|
8
|
-
declare const makeFlatFieldErrorsFilter: (predicate: (entry: FlatFieldErrorEntry, index: number) => boolean) => (errors: FlatFieldErrors) => FlatFieldErrors;
|
|
9
|
-
export default makeFlatFieldErrorsFilter;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { FieldErrors } from 'react-hook-form';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Flatten a {@link FieldErrors} object.
|
|
5
|
-
*
|
|
6
|
-
* @returns e.g.,
|
|
7
|
-
* ```ts
|
|
8
|
-
* {
|
|
9
|
-
* "address.street.type": "too_short",
|
|
10
|
-
* "address.street.ref.value": "123",
|
|
11
|
-
* "address.street.message": "Required."
|
|
12
|
-
* }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare const flattenFieldErrors: (errors: FieldErrors) => Record<string, unknown>;
|
|
16
|
-
export default flattenFieldErrors;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FieldErrors } from 'react-hook-form';
|
|
2
|
-
import { FlatFieldErrors } from './types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Get {@link FlatFieldErrors} from {@link FieldErrors}.
|
|
6
|
-
* This makes it easy to work with potentially deeply-nested {@link FieldErrors}.
|
|
7
|
-
*
|
|
8
|
-
* @param errors {@link FieldErrors} object.
|
|
9
|
-
*
|
|
10
|
-
* @returns `FlatFieldErrors` object.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```
|
|
14
|
-
* {
|
|
15
|
-
* "address.street": {
|
|
16
|
-
* type: "too_short",
|
|
17
|
-
* ref: { value: "123" },
|
|
18
|
-
* message: "Required." }
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
declare const getFlatFieldErrors: (errors: FieldErrors) => FlatFieldErrors;
|
|
24
|
-
export default getFlatFieldErrors;
|
|
25
|
-
/**
|
|
26
|
-
* Regular expression to maybe match the end of a leaf node path.
|
|
27
|
-
*
|
|
28
|
-
* i.e., `name.type`, `address.street.message`
|
|
29
|
-
*
|
|
30
|
-
* iow: dot [?: non-capturing]("type" | "message")[\b word boundary][$ end of string]
|
|
31
|
-
*/
|
|
32
|
-
export declare const regexMaybeFieldErrorLeafNodeSuffix: RegExp;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FieldError } from 'react-hook-form';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Flattened field errors object.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* {
|
|
9
|
-
* 'address.street': FieldError
|
|
10
|
-
* }
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export type FlatFieldErrors = Record<string, FieldError>;
|
|
14
|
-
/**
|
|
15
|
-
* Return from `Object.entries` on {@link FlatFieldErrors}.
|
|
16
|
-
*/
|
|
17
|
-
export type FlatFieldErrorEntry = [path: string, error: FieldError];
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
/** Field name as flat path. (e.g., "address.street") */
|
|
3
|
-
path: string;
|
|
4
|
-
/** Optional component to use to display message. (Defaults to {@link FormErrorMessage}) */
|
|
5
|
-
Component?: React.FC<{
|
|
6
|
-
message: string;
|
|
7
|
-
}>;
|
|
8
|
-
};
|
|
9
|
-
declare const RhfUtilsFieldErrorMessage: React.FC<Props>;
|
|
10
|
-
export default RhfUtilsFieldErrorMessage;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
/** Flat field name. (e.g., `address.street`) */
|
|
3
|
-
path: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Empty, hidden marker to indicate a non-field/non-root error is being displayed to user.
|
|
7
|
-
*
|
|
8
|
-
* Example use case:
|
|
9
|
-
* Field array with minimum items.
|
|
10
|
-
* (When there are no items, the error is not associated with a field and is displayed separately.)
|
|
11
|
-
*/
|
|
12
|
-
declare const FormNonFieldErrorMarker: React.FC<Props>;
|
|
13
|
-
export default FormNonFieldErrorMarker;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns query selector for matching non-field error marker.
|
|
3
|
-
* By default includes nested field matching. (See `options.excludeNested`.)
|
|
4
|
-
*
|
|
5
|
-
* @returns One or more selectors in a comma-separated list.
|
|
6
|
-
*/
|
|
7
|
-
export declare const getFormNonFieldErrorMarkerQuerySelector: (path: string, options?: {
|
|
8
|
-
/**
|
|
9
|
-
* Do not look for match as nested field.
|
|
10
|
-
*
|
|
11
|
-
* By default this is enabled to facilitate looking for fields that may be nested inside objects.
|
|
12
|
-
* This is only a problem when a front-end field is nested more deeply than back-end.
|
|
13
|
-
* For example, field arrays require objects as items, so actual field may be `field.value`.
|
|
14
|
-
* This should be safe, as fields are by definition leaf nodes, so will not have nested fields.
|
|
15
|
-
* (If this check should need to be more precise in the future, it may be ideal to distinguish between client/server errors or paths.)
|
|
16
|
-
*/
|
|
17
|
-
excludeNested?: boolean;
|
|
18
|
-
}) => string;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { FieldError } from 'react-hook-form';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Determine if {@link FieldError} is a non-field error (i.e., has no `ref`).
|
|
5
|
-
*
|
|
6
|
-
* A non-field error has no association to an input via {@link FieldError.ref}.
|
|
7
|
-
*
|
|
8
|
-
* These fall into one of two categories:
|
|
9
|
-
* - Root, which are typically displayed to user at bottom/top of form.
|
|
10
|
-
* - Non-root, which fall into two main sub-sets:
|
|
11
|
-
* - Non-orphan (displayed -- typically manually)
|
|
12
|
-
* - e.g., array min/max validation
|
|
13
|
-
* - Orphan (undisplayed), which are typically caused by one of the following cases:
|
|
14
|
-
* - The input is missing.
|
|
15
|
-
* - The schema is incorrect.
|
|
16
|
-
* - The error is not displayed to user with `FormErrorNonFieldMarker`.
|
|
17
|
-
*/
|
|
18
|
-
declare const isNonFieldError: (error: FieldError) => boolean;
|
|
19
|
-
export default isNonFieldError;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Determine if a non-field error marker is in the DOM.
|
|
3
|
-
* Note: this will also look for nested markers to accommodate field arrays
|
|
4
|
-
*/
|
|
5
|
-
declare const isNonFieldErrorMarkerInDOM: (path: string, parentElement: Pick<HTMLElement, "querySelector">) => boolean;
|
|
6
|
-
export default isNonFieldErrorMarkerInDOM;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FlatFieldErrorEntry } from '../flat/types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Util wrapper for {@link isOrphanFormError} for usage with {@link FlatFieldErrorEntry}.
|
|
5
|
-
*/
|
|
6
|
-
declare const getIsFlatFieldErrorEntryOrphanByParentElement: (parentElement: Pick<HTMLElement, "querySelector">) => ([path, error]: FlatFieldErrorEntry) => boolean;
|
|
7
|
-
export default getIsFlatFieldErrorEntryOrphanByParentElement;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SafeFieldValues } from '../../form/SafeFieldValues';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Output form values and errors to console.
|
|
5
|
-
*/
|
|
6
|
-
declare const consoleErrors: (message: string, values: SafeFieldValues, errors: Record<string, unknown>, type?: "debug" | "error") => void;
|
|
7
|
-
export default consoleErrors;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const FormErrorPathRoot = "root";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FlatFieldErrorEntry } from '../flat/types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Util wrapper for {@link isFormErrorPathRoot} for usage with {@link FlatFieldErrorEntry}.
|
|
5
|
-
*/
|
|
6
|
-
declare const isFlatFieldErrorEntryPathRoot: ([path]: FlatFieldErrorEntry) => boolean;
|
|
7
|
-
export default isFlatFieldErrorEntryPathRoot;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RhfUtilsClientConfig } from '../../client/config/RhfUtilsClientConfig';
|
|
2
|
-
import { FormSubmitFieldErrors } from '../../submit/error/FormSubmitFieldErrors';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* HOF that returns submit error handler for {@link RhfUtilsClientConfig.onSubmitErrorUnknown}.
|
|
6
|
-
*
|
|
7
|
-
* @param onError Fallback for handling non-TRPC errors.
|
|
8
|
-
* @returns FormSubmitError
|
|
9
|
-
*/
|
|
10
|
-
declare const getOnSubmitTrpcClientErrorHandler: (onNotTrpcClientError: NonNullable<RhfUtilsClientConfig["onSubmitErrorUnknown"]>) => (error: unknown) => FormSubmitFieldErrors | undefined;
|
|
11
|
-
export default getOnSubmitTrpcClientErrorHandler;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Schema for {@link TRPCClientError} message.
|
|
5
|
-
*
|
|
6
|
-
* (Sent from backend as JSON string.)
|
|
7
|
-
*/
|
|
8
|
-
declare const trpcClientErrorMessageSchema: z.ZodObject<{
|
|
9
|
-
validation: z.ZodString;
|
|
10
|
-
code: z.ZodString;
|
|
11
|
-
message: z.ZodString;
|
|
12
|
-
path: z.ZodArray<z.ZodString, "many">;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
message: string;
|
|
15
|
-
code: string;
|
|
16
|
-
path: string[];
|
|
17
|
-
validation: string;
|
|
18
|
-
}, {
|
|
19
|
-
message: string;
|
|
20
|
-
code: string;
|
|
21
|
-
path: string[];
|
|
22
|
-
validation: string;
|
|
23
|
-
}>;
|
|
24
|
-
export default trpcClientErrorMessageSchema;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { TRPCClientErrorLike } from '@trpc/client';
|
|
2
|
-
import { AnyRouter } from '@trpc/server';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import { FormSubmitFieldErrors } from '../../submit/error/FormSubmitFieldErrors';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Schema that transforms {@link TRPCClientError} to RHF {@link FormSubmitFieldErrors}.
|
|
8
|
-
*/
|
|
9
|
-
declare const trpcClientErrorToFormSubmitFieldErrorsSchemaTransformer: z.ZodEffects<z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodEffects<z.ZodType<TRPCClientErrorLike<AnyRouter>, z.ZodTypeDef, TRPCClientErrorLike<AnyRouter>>, string, TRPCClientErrorLike<AnyRouter>>, unknown, TRPCClientErrorLike<AnyRouter>>, z.ZodArray<z.ZodObject<{
|
|
10
|
-
validation: z.ZodString;
|
|
11
|
-
code: z.ZodString;
|
|
12
|
-
message: z.ZodString;
|
|
13
|
-
path: z.ZodArray<z.ZodString, "many">;
|
|
14
|
-
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
message: string;
|
|
16
|
-
code: string;
|
|
17
|
-
path: string[];
|
|
18
|
-
validation: string;
|
|
19
|
-
}, {
|
|
20
|
-
message: string;
|
|
21
|
-
code: string;
|
|
22
|
-
path: string[];
|
|
23
|
-
validation: string;
|
|
24
|
-
}>, "many">>, (readonly [string, {
|
|
25
|
-
type: string;
|
|
26
|
-
message: string;
|
|
27
|
-
}])[], TRPCClientErrorLike<AnyRouter>>, FormSubmitFieldErrors, TRPCClientErrorLike<AnyRouter>>;
|
|
28
|
-
export default trpcClientErrorToFormSubmitFieldErrorsSchemaTransformer;
|
package/dist/types/exports.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export type { Register } from './register';
|
|
2
|
-
export type { RhfUtilsClientConfig } from './client/config/RhfUtilsClientConfig';
|
|
3
|
-
export { default as RhfUtilsClientForZodContextProvider } from './client/zod/context/RhfUtilsClientForZodContextProvider';
|
|
4
|
-
export { default as RhfUtilsZodForm } from './client/zod/context/RhfUtilsZodForm';
|
|
5
|
-
export { default as useRhfUtilsZodForm } from './client/zod/context/useRhfUtilsZodForm';
|
|
6
|
-
export type { RhfUtilsUseFormChildrenZodFC } from './client/zod/RhfUtilsUseFormChildrenZodFC';
|
|
7
|
-
export type { RhfUtilsUseFormChildrenZodProps } from './client/zod/RhfUtilsUseFormChildrenZodProps';
|
|
8
|
-
export { default as useFlatFieldErrorsContext } from './errors/flat/context/useFlatFieldErrorsContext';
|
|
9
|
-
export { default as useFlatFieldErrorsContextHasOnlyOrphans } from './errors/flat/context/useFlatFieldErrorsContextHasOnlyOrphans';
|
|
10
|
-
export { default as RhfUtilsFieldErrorMessage } from './errors/message/RhfUtilsFieldErrorMessage';
|
|
11
|
-
export { default as FormNonFieldErrorMarker } from './errors/nonfield/FormNonFieldErrorMarker';
|
|
12
|
-
export { default as RootErrorsListFromFlatFieldErrorsContext } from './errors/root/RootErrorsListFromFlatFieldErrorsContext';
|
|
13
|
-
export type { RhfUtilsFormOptions } from './form/RhfUtilsFormOptions';
|
|
14
|
-
export type { SafeFieldValues } from './form/SafeFieldValues';
|
|
15
|
-
export type { UseRhfUtilsFormChildrenProps } from './form/UseRhfUtilsFormChildrenProps';
|
|
16
|
-
export { default as useRhfUtilsContext } from './form/context/utils/useRhfUtilsContext';
|
|
17
|
-
export { default as useRhfUtilsContextRequestSubmit } from './form/context/utils/useRhfUtilsContextRequestSubmit';
|
|
18
|
-
export { default as FormGroupContextProvider } from './form/context/group/FormGroupContextProvider';
|
|
19
|
-
export { default as useFormGroupChildIsMountedTracker } from './form/context/group/useFormGroupChildIsMountedTracker';
|
|
20
|
-
export { default as useFormGroupChildIsSubmittingTracker } from './form/context/group/useFormGroupChildIsSubmittingTracker';
|
|
21
|
-
export { default as useFormGroupChildTracker } from './form/context/group/useFormGroupChildTracker';
|
|
22
|
-
export { default as useFormGroupIsAnyBusy } from './form/context/group/useFormGroupIsAnyBusy';
|
|
23
|
-
export { default as useFormGroupIsChildBusy } from './form/context/group/useFormGroupIsChildBusy';
|
|
24
|
-
export { default as useFormGroupIsParentBusy } from './form/context/group/useFormGroupIsParentBusy';
|
|
25
|
-
export { default as useFormGroupParentTracker } from './form/context/group/useFormGroupParentTracker';
|
|
26
|
-
export { default as useFormOrParentIsBusy } from './form/context/group/useFormOrParentIsBusy';
|
|
27
|
-
export { default as getSubmitterButtonData } from './form/utils/getSubmitterButtonData';
|
|
28
|
-
export { default as useFormRequestSubmit } from './form/utils/useFormRequestSubmit';
|
|
29
|
-
export { FormSubmitError } from './submit/error/FormSubmitError';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { SafeFieldValues } from './SafeFieldValues';
|
|
3
|
-
import { UseRhfUtilsFormProps } from './UseRhfUtilsFormProps';
|
|
4
|
-
|
|
5
|
-
export type FormChildrenSlots = 'top' | 'bottom';
|
|
6
|
-
export type FormProps<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues> = {
|
|
7
|
-
formId: string;
|
|
8
|
-
formRef: React.RefObject<HTMLFormElement>;
|
|
9
|
-
} & Pick<UseRhfUtilsFormProps<TFieldValues, TTransformedValues>, 'onSubmit' | 'onSubmitError' | 'onSubmitInvalid' | 'Children' | 'form' | 'utils'>;
|
|
10
|
-
declare function _Form<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>({ formId, formRef, onSubmit, onSubmitError, onSubmitInvalid, Children, form, utils, }: FormProps<TFieldValues, TTransformedValues>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default _Form;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SafeFieldValues } from './SafeFieldValues';
|
|
2
|
-
import { UseRhfUtilsFormProps } from './UseRhfUtilsFormProps';
|
|
3
|
-
|
|
4
|
-
export type FormWithProvidersProps<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues> = React.PropsWithChildren<UseRhfUtilsFormProps<TFieldValues, TTransformedValues>>;
|
|
5
|
-
/**
|
|
6
|
-
* Form providers (with utils) with immediate descendent {@link Form}.
|
|
7
|
-
* (Syntactic sugar for {@link useRhfUtilsForm}. Use this for most applications.)
|
|
8
|
-
*
|
|
9
|
-
* Use {@link useRhfUtilsForm} if you need to specific nesting hierarchy.
|
|
10
|
-
* (e.g., wrapping `<tr>` with provider and nesting `<form>` within `<td>` to appease HTML rules.)
|
|
11
|
-
*/
|
|
12
|
-
declare function FormWithProviders<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>(props: FormWithProvidersProps<TFieldValues, TTransformedValues>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export default FormWithProviders;
|