@paragrav/rhf-utils 0.0.140 → 0.0.142
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 +2 -2
- package/dist/types/_exports/group.d.ts +9 -0
- package/dist/types/_exports/index.d.ts +15 -0
- package/dist/types/_exports/main.d.ts +15 -0
- package/dist/types/_exports/trpc.d.ts +2 -0
- package/dist/types/_exports/utils.d.ts +1 -0
- package/dist/types/client/config/RhfUtilsClientConfig.d.ts +71 -0
- package/dist/types/client/config/useRhfUtilsClientConfigContext.d.ts +5 -0
- package/dist/types/client/context.d.ts +3 -0
- package/dist/types/client/index.d.ts +30 -0
- package/dist/types/client/utils.d.ts +13 -0
- package/dist/types/client/zod/RhfUtilsUseFormChildrenZodFC.d.ts +13 -0
- package/dist/types/client/zod/RhfUtilsUseFormChildrenZodProps.d.ts +5 -0
- package/dist/types/client/zod/ZodTypeFieldValues.d.ts +4 -0
- package/dist/types/client/zod/consts.d.ts +4 -0
- package/dist/types/client/zod/context/RhfUtilsClientForZodContextProvider.d.ts +8 -0
- package/dist/types/client/zod/context/RhfUtilsZodForm.d.ts +9 -0
- package/dist/types/client/zod/context/useRhfUtilsClientForZodContext.d.ts +6 -0
- package/dist/types/client/zod/context/useRhfUtilsZodForm.d.ts +8 -0
- package/dist/types/client/zod/createRhfUtilsClientForZod.d.ts +4 -0
- package/dist/types/devtool/LazyDevTool.d.ts +12 -0
- package/dist/types/errors/flat/FlatFieldErrorsList.d.ts +7 -0
- package/dist/types/errors/flat/context/FlatFieldErrorsContextProvider.d.ts +11 -0
- package/dist/types/errors/flat/context/FlatFieldErrorsOutputConfig.d.ts +20 -0
- package/dist/types/errors/flat/context/useFlatFieldErrorsContext.d.ts +13 -0
- package/dist/types/errors/flat/context/useFlatFieldErrorsContextHasOnlyOrphans.d.ts +7 -0
- package/dist/types/errors/flat/context/useFlatFieldErrorsContextOutput.d.ts +7 -0
- package/dist/types/errors/flat/filterFlatFieldErrors.d.ts +9 -0
- package/dist/types/errors/flat/flattenFieldErrors.d.ts +16 -0
- package/dist/types/errors/flat/getFlatFieldErrors.d.ts +31 -0
- package/dist/types/errors/flat/types.d.ts +17 -0
- package/dist/types/errors/getRefdFromFlatFieldErrors.d.ts +2 -0
- package/dist/types/errors/isFieldErrorRefd.d.ts +7 -0
- package/dist/types/errors/isFlatFieldErrorEntryRefd.d.ts +7 -0
- package/dist/types/errors/message/FormErrorMessage.d.ts +8 -0
- package/dist/types/errors/message/RhfUtilsFieldErrorMessage.d.ts +10 -0
- package/dist/types/errors/nonfield/RhfUtilsNonFieldErrorMarker.d.ts +13 -0
- package/dist/types/errors/nonfield/RhfUtilsNonFieldErrorMarker.spec.d.ts +1 -0
- package/dist/types/errors/nonfield/RhfUtilsNonFieldErrorMarker.utils.d.ts +18 -0
- package/dist/types/errors/nonfield/RhfUtilsNonFieldErrorMarkerHtmlAttribute.d.ts +5 -0
- package/dist/types/errors/nonfield/isNonFieldError.d.ts +19 -0
- package/dist/types/errors/nonfield/isNonFieldErrorMarkerInDOM.d.ts +6 -0
- package/dist/types/errors/orphan/getIsOrphanFormErrorWithParentElement.d.ts +7 -0
- package/dist/types/errors/orphan/getOrphansFromFlatFieldErrors.d.ts +4 -0
- package/dist/types/errors/orphan/isOrphanFormError.d.ts +4 -0
- package/dist/types/errors/output/consoleErrors.d.ts +7 -0
- package/dist/types/errors/output/types.d.ts +7 -0
- package/dist/types/errors/root/RootErrorsListFromFlatFieldErrorsContext.d.ts +2 -0
- package/dist/types/errors/root/consts.d.ts +1 -0
- package/dist/types/errors/root/getRootsFromFlatFieldErrors.d.ts +2 -0
- package/dist/types/errors/root/isFlatFieldErrorEntryPathRoot.d.ts +7 -0
- package/dist/types/errors/root/isFormErrorPathRoot.d.ts +7 -0
- package/dist/types/errors/trpc/makeOnSubmitTrpcClientErrorHandler.d.ts +11 -0
- package/dist/types/errors/trpc/trpcClientErrorMessageSchema.d.ts +24 -0
- package/dist/types/errors/trpc/trpcClientErrorToFormSubmitFieldErrorsSchemaTransformer.d.ts +28 -0
- package/dist/types/form/Form.d.ts +11 -0
- package/dist/types/form/FormWithProviders.d.ts +13 -0
- package/dist/types/form/RhfUtilsFormOptions.d.ts +29 -0
- package/dist/types/form/RhfUtilsFormProviders.d.ts +12 -0
- package/dist/types/form/SafeFieldValues.d.ts +4 -0
- package/dist/types/form/UseRhfUtilsFormChildrenProps.d.ts +20 -0
- package/dist/types/form/UseRhfUtilsFormOnSubmitContext.d.ts +27 -0
- package/dist/types/form/UseRhfUtilsFormProps.d.ts +23 -0
- package/dist/types/form/UseRhfUtilsFormReturn.d.ts +20 -0
- package/dist/types/form/_Controller.d.ts +6 -0
- package/dist/types/form/context/group/FormGroupContextProvider.d.ts +5 -0
- package/dist/types/form/context/group/index.d.ts +14 -0
- package/dist/types/form/context/group/useFormGroupChildIsMountedTracker.d.ts +5 -0
- package/dist/types/form/context/group/useFormGroupChildIsSubmittingTracker.d.ts +5 -0
- package/dist/types/form/context/group/useFormGroupChildTracker.d.ts +6 -0
- package/dist/types/form/context/group/useFormGroupIsAnyBusy.d.ts +2 -0
- package/dist/types/form/context/group/useFormGroupIsChildBusy.d.ts +2 -0
- package/dist/types/form/context/group/useFormGroupIsParentBusy.d.ts +2 -0
- package/dist/types/form/context/group/useFormGroupParentTracker.d.ts +7 -0
- package/dist/types/form/context/group/useFormOrParentIsBusy.d.ts +2 -0
- package/dist/types/form/context/utils/RhfUtilsContextProvider.d.ts +9 -0
- package/dist/types/form/context/utils/useRhfUtilsContext.d.ts +14 -0
- package/dist/types/form/context/utils/useRhfUtilsContextRequestSubmit.d.ts +5 -0
- package/dist/types/form/useFormIsBusy.d.ts +2 -0
- package/dist/types/form/useRhfUtilsForm.d.ts +16 -0
- package/dist/types/form/utils/getSubmitterButtonData.d.ts +8 -0
- package/dist/types/form/utils/useFormRequestSubmit.d.ts +11 -0
- package/dist/types/form/utils/useShouldFormBlockNavigation.d.ts +26 -0
- package/dist/types/group.d.ts +29 -9
- package/dist/types/main.d.ts +1 -15
- package/dist/types/register.d.ts +7 -0
- package/dist/types/submit/error/FormSubmitError.d.ts +7 -0
- package/dist/types/submit/error/FormSubmitFieldErrors.d.ts +15 -0
- package/dist/types/submit/error/setCtxErrorsByFormSubmitFieldErrors.d.ts +10 -0
- package/dist/types/submit/useFormOnSubmitSuccessfulAndReset.d.ts +15 -0
- package/dist/types/submit/useFormOnSubmitted.d.ts +6 -0
- package/dist/types/submit/useResetFormOnSubmitted.d.ts +36 -0
- package/dist/types/submit/useSubmitFormOnChange.d.ts +9 -0
- package/dist/types/trpc.d.ts +8 -2
- package/dist/types/utils/PassthroughChildren.d.ts +7 -0
- package/dist/types/utils/createContext.d.ts +12 -0
- package/dist/types/utils/fixedForwardRef.d.ts +7 -0
- package/dist/types/utils/isEmptyObject.d.ts +2 -0
- package/dist/types/utils/timeoutAsync.d.ts +6 -0
- package/dist/types/utils/types.d.ts +1 -0
- package/dist/types/utils/useDebouncedOnChangeValue.d.ts +14 -0
- package/dist/types/utils/useImperativeForwardedRef.d.ts +11 -0
- package/dist/types/utils/useRefIfValueWasTrue.d.ts +2 -0
- package/dist/types/utils/useThrowAsyncError.d.ts +5 -0
- package/dist/types/utils/useToggle.d.ts +4 -0
- package/dist/types/utils.d.ts +5 -1
- package/package.json +7 -7
- /package/dist/esm/{main.mjs → index.mjs} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create a strictly-typed context that throws error if no provider is found.
|
|
5
|
+
* @returns A tuple with a function to get the context and the context provider.
|
|
6
|
+
*/
|
|
7
|
+
declare function createContext<T = unknown>(): {
|
|
8
|
+
readonly Provider: React.Provider<T | undefined>;
|
|
9
|
+
readonly useMaybe: () => T | undefined;
|
|
10
|
+
readonly useRequired: () => T & ({} | null);
|
|
11
|
+
};
|
|
12
|
+
export default createContext;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @see https://www.totaltypescript.com/forwardref-with-generic-components
|
|
5
|
+
*/
|
|
6
|
+
declare function fixedForwardRef<T, P = object>(render: (props: P, ref: React.Ref<T>) => React.ReactNode): (props: P & React.RefAttributes<T>) => React.ReactNode;
|
|
7
|
+
export default fixedForwardRef;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React hook to debounce onChange event callback.
|
|
3
|
+
*
|
|
4
|
+
* Returns debounced state setter (uses ref internally).
|
|
5
|
+
*
|
|
6
|
+
* When debounce delay has elapsed after setting value,
|
|
7
|
+
* onChange callback is called with latest value.
|
|
8
|
+
*
|
|
9
|
+
* @returns `[setValueDebounced]`
|
|
10
|
+
*/
|
|
11
|
+
export declare const useDebouncedOnChangeValue: <TValue>({ onChange, delay, }: {
|
|
12
|
+
onChange: (value: TValue) => void;
|
|
13
|
+
delay: number;
|
|
14
|
+
}) => readonly [(value: TValue) => void];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create a ref and point forwarded ref to it.
|
|
5
|
+
*
|
|
6
|
+
* Use case: forwarded refs are optional, but sometimes you need the ref.
|
|
7
|
+
*
|
|
8
|
+
* @param forwardedRef Forwarded `ref` prop.
|
|
9
|
+
*/
|
|
10
|
+
declare const useImperativeForwardedRef: <TRef>(forwardedRef?: React.ForwardedRef<TRef>) => React.RefObject<TRef>;
|
|
11
|
+
export default useImperativeForwardedRef;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { default as RootErrorsListFromFlatFieldErrorsContext } from '../errors/root/RootErrorsListFromFlatFieldErrorsContext';
|
|
2
|
+
|
|
3
|
+
export { RootErrorsListFromFlatFieldErrorsContext }
|
|
4
|
+
|
|
5
|
+
export { }
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@paragrav/rhf-utils",
|
|
3
3
|
"author": "paragrav.dev",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.142",
|
|
6
6
|
"description": "Integration utilities for react-hook-form.",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -10,30 +10,30 @@
|
|
|
10
10
|
"dist/esm/*",
|
|
11
11
|
"dist/types/*"
|
|
12
12
|
],
|
|
13
|
-
"module": "./dist/esm/
|
|
13
|
+
"module": "./dist/esm/index.mjs",
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
16
|
"import": {
|
|
17
|
-
"default": "./dist/esm/
|
|
18
|
-
"types": "./dist/types/
|
|
17
|
+
"default": "./dist/esm/index.mjs",
|
|
18
|
+
"types": "./dist/types/_exports/index.d.ts"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"./group": {
|
|
22
22
|
"import": {
|
|
23
23
|
"default": "./dist/esm/group.mjs",
|
|
24
|
-
"types": "./dist/types/group.d.ts"
|
|
24
|
+
"types": "./dist/types/_exports/group.d.ts"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"./trpc": {
|
|
28
28
|
"import": {
|
|
29
29
|
"default": "./dist/esm/trpc.mjs",
|
|
30
|
-
"types": "./dist/types/trpc.d.ts"
|
|
30
|
+
"types": "./dist/types/_exports/trpc.d.ts"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"./utils": {
|
|
34
34
|
"import": {
|
|
35
35
|
"default": "./dist/esm/utils.mjs",
|
|
36
|
-
"types": "./dist/types/utils.d.ts"
|
|
36
|
+
"types": "./dist/types/_exports/utils.d.ts"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
},
|
|
File without changes
|