@paragrav/rhf-utils 0.0.147 → 0.59.0

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.
Files changed (213) hide show
  1. package/README.md +273 -118
  2. package/dist/dts/Register.d.ts +16 -0
  3. package/dist/dts/_exports/config.d.ts +2 -0
  4. package/dist/dts/_exports/errors.d.ts +3 -0
  5. package/dist/dts/_exports/form.d.ts +7 -0
  6. package/dist/dts/_exports/index.d.ts +13 -0
  7. package/dist/dts/_exports/relay.d.ts +8 -0
  8. package/dist/dts/_exports/submit.d.ts +4 -0
  9. package/dist/dts/_exports/trpc.d.ts +2 -0
  10. package/dist/dts/_exports/types.d.ts +7 -0
  11. package/dist/dts/_exports/zod.d.ts +6 -0
  12. package/dist/dts/client/config/RhfUtilsClientConfigType.d.ts +63 -0
  13. package/dist/dts/client/config/context/RhfUtilsClientConfigContext.d.ts +3 -0
  14. package/dist/dts/client/config/context/RhfUtilsClientConfigProvider.d.ts +7 -0
  15. package/dist/dts/client/config/context/useRhfUtilsClientConfig.d.ts +1 -0
  16. package/dist/{types → dts}/devtool/LazyDevTool.d.ts +3 -4
  17. package/dist/dts/devtool/LazyDevToolViaProviders.d.ts +1 -0
  18. package/dist/{types → dts}/errors/flat/FlatFieldErrorsList.d.ts +2 -2
  19. package/dist/{types → dts}/errors/flat/context/FlatFieldErrorsContextProvider.d.ts +3 -3
  20. package/dist/{types → dts}/errors/flat/context/useFlatFieldErrorsContext.d.ts +1 -2
  21. package/dist/dts/errors/flat/context/useFlatFieldErrorsContextHasOnlyOrphans.d.ts +6 -0
  22. package/dist/{types → dts}/errors/flat/context/useFlatFieldErrorsContextOutput.d.ts +1 -2
  23. package/dist/dts/errors/flat/filterFlatFieldErrors.d.ts +7 -0
  24. package/dist/{types → dts}/errors/flat/flattenFieldErrors.d.ts +1 -2
  25. package/dist/{types → dts}/errors/flat/getFlatFieldErrors.d.ts +2 -1
  26. package/dist/dts/errors/getRefdFromFlatFieldErrors.d.ts +1 -0
  27. package/dist/{types → dts}/errors/isFieldErrorRefd.d.ts +1 -2
  28. package/dist/dts/errors/isFlatFieldErrorEntryRefd.d.ts +5 -0
  29. package/dist/{types → dts}/errors/message/FormErrorMessage.d.ts +2 -2
  30. package/dist/{types → dts}/errors/message/RhfUtilsFieldErrorMessage.d.ts +2 -2
  31. package/dist/{types → dts}/errors/nonfield/RhfUtilsNonFieldErrorMarker.d.ts +2 -2
  32. package/dist/dts/errors/nonfield/RhfUtilsNonFieldErrorMarkerHtmlAttribute.d.ts +4 -0
  33. package/dist/{types → dts}/errors/nonfield/isNonFieldError.d.ts +1 -2
  34. package/dist/dts/errors/nonfield/isNonFieldErrorMarkerInDOM.d.ts +5 -0
  35. package/dist/dts/errors/orphan/getIsOrphanFormErrorWithParentElement.d.ts +5 -0
  36. package/dist/dts/errors/orphan/getOrphansFromFlatFieldErrors.d.ts +2 -0
  37. package/dist/dts/errors/orphan/isOrphanFormError.d.ts +2 -0
  38. package/dist/dts/errors/output/consoleErrors.d.ts +5 -0
  39. package/dist/dts/errors/root/RootErrorsListFromFlatFieldErrorsContext.d.ts +1 -0
  40. package/dist/dts/errors/root/getRootsFromFlatFieldErrors.d.ts +1 -0
  41. package/dist/{types → dts}/errors/root/isFlatFieldErrorEntryPathRoot.d.ts +1 -2
  42. package/dist/{types → dts}/errors/root/isFormErrorPathRoot.d.ts +1 -2
  43. package/dist/{types → dts}/errors/trpc/makeOnSubmitTrpcClientErrorHandler.d.ts +2 -3
  44. package/dist/dts/errors/trpc/trpcClientErrorMessageSchema.d.ts +19 -0
  45. package/dist/dts/errors/trpc/trpcClientErrorToFormSubmitFieldErrorsSchemaTransformer.d.ts +23 -0
  46. package/dist/dts/form/RHF_UseFormReturnWithoutProxiesType.d.ts +15 -0
  47. package/dist/dts/form/RhfUtilsFormComponentPropsType.d.ts +17 -0
  48. package/dist/dts/form/RhfUtilsFormStateWithUtilsType.d.ts +7 -0
  49. package/dist/dts/form/UseRhfUtilsFormChildrenPropsType.d.ts +25 -0
  50. package/dist/dts/form/_Controller.d.ts +4 -0
  51. package/dist/dts/form/context/utils/RhfUtilsContextPropsType.d.ts +11 -0
  52. package/dist/dts/form/context/utils/RhfUtilsContextProvider.d.ts +9 -0
  53. package/dist/dts/form/context/utils/useRhfUtilsContext.d.ts +5 -0
  54. package/dist/dts/form/context/utils/useRhfUtilsContextRequestSubmit.d.ts +4 -0
  55. package/dist/dts/form/defaults/UseRhfUtilsFormGlobalDefaults.d.ts +24 -0
  56. package/dist/dts/form/defaults/UseRhfUtilsFormInstanceDefaults.d.ts +18 -0
  57. package/dist/dts/form/defaults/UseRhfUtilsFormResolvedDefaultsType.d.ts +12 -0
  58. package/dist/dts/form/defaults/form/UseRhfUtilsFormInstanceFormProps.d.ts +6 -0
  59. package/dist/dts/form/defaults/form/getRhfUtilsFormResolvedFormProps.d.ts +2 -0
  60. package/dist/dts/form/defaults/form/useRhfUtilsFormResolvedFormProps.d.ts +293 -0
  61. package/dist/{types/form/RhfUtilsFormOptions.d.ts → dts/form/options/RhfUtilsFormOptionsType.d.ts} +6 -7
  62. package/dist/dts/form/options/getRhfUtilsFormResolvedOptions.d.ts +2 -0
  63. package/dist/dts/form/options/useRhfUtilsFormResolvedOptions.d.ts +8 -0
  64. package/dist/dts/form/providers/RhfUtilsFormProviders.d.ts +6 -0
  65. package/dist/dts/form/providers/RhfUtilsFormProvidersPropsType.d.ts +15 -0
  66. package/dist/dts/form/rhf/UseFormPropsType.d.ts +4 -0
  67. package/dist/dts/form/rhf/getRhfUtilsFormResolvedRhfProps.d.ts +4 -0
  68. package/dist/dts/form/rhf/useRhfFormWithResolvedProps.d.ts +5 -0
  69. package/dist/dts/form/state/relay/FormStateRelayContextProvider.d.ts +4 -0
  70. package/dist/dts/form/state/relay/FormStateRelayedAggregatedType.d.ts +10 -0
  71. package/dist/dts/form/state/relay/FormStateRelayedItemType.d.ts +11 -0
  72. package/dist/dts/form/state/relay/FormStateRelayedOptionsType.d.ts +20 -0
  73. package/dist/dts/form/state/relay/FormStateRelayedType.d.ts +3 -0
  74. package/dist/dts/form/state/relay/pull/hooks.d.ts +31 -0
  75. package/dist/dts/form/state/relay/push/FormStateRelayPusher.d.ts +4 -0
  76. package/dist/dts/form/state/relay/push/useFormStateRelayPusher.d.ts +3 -0
  77. package/dist/dts/form/state/relay/useFormStateRelayContext.d.ts +20 -0
  78. package/dist/dts/form/state/relay/utils.d.ts +4 -0
  79. package/dist/dts/form/utils/getSubmitterButtonData.d.ts +6 -0
  80. package/dist/{types → dts}/form/utils/useFormRequestSubmit.d.ts +1 -2
  81. package/dist/dts/form/utils/useHandleCancelWithCheckIfCanBe.d.ts +4 -0
  82. package/dist/dts/form/utils/useHandleCancelWithCheckIfCanBeViaProviders.d.ts +2 -0
  83. package/dist/{types → dts}/form/utils/useShouldFormBlockNavigation.d.ts +1 -2
  84. package/dist/dts/form/with-handlers-and-children/RhfUtilsForm.d.ts +3 -0
  85. package/dist/dts/form/with-handlers-and-children/RhfUtilsFormProps.d.ts +46 -0
  86. package/dist/dts/form/with-handlers-and-children/_ChildrenViaProviders.d.ts +3 -0
  87. package/dist/dts/form/with-handlers-and-children/_FormWithSubmitHandler.d.ts +4 -0
  88. package/dist/dts/form/with-handlers-and-children/_useHandleSubmit.d.ts +11 -0
  89. package/dist/dts/form/with-providers/RhfUtilsFormWithProviders.d.ts +8 -0
  90. package/dist/dts/form/with-providers/RhfUtilsFormWithProvidersProps.d.ts +4 -0
  91. package/dist/dts/resolvers/ObjectSchema.d.ts +7 -0
  92. package/dist/dts/resolvers/zod/RhfUtilsUseZodFormChildrenFCType.d.ts +7 -0
  93. package/dist/dts/resolvers/zod/RhfUtilsUseZodFormChildrenPropsType.d.ts +4 -0
  94. package/dist/dts/resolvers/zod/ZodTypeSafeFieldValuesType.d.ts +5 -0
  95. package/dist/dts/resolvers/zod/consts.d.ts +4 -0
  96. package/dist/dts/resolvers/zod/form/RhfUtilsZodForm.d.ts +7 -0
  97. package/dist/dts/resolvers/zod/getZodResolver.d.ts +4 -0
  98. package/dist/dts/resolvers/zod/providers/RhfUtilsZodFormProviders.d.ts +8 -0
  99. package/dist/dts/resolvers/zod/with-providers/RhfUtilsZodFormWithProviders.d.ts +10 -0
  100. package/dist/dts/submit/UseRhfUtilsFormOnSubmitContextType.d.ts +23 -0
  101. package/dist/dts/submit/error/FormSubmitError.d.ts +6 -0
  102. package/dist/{types → dts}/submit/error/FormSubmitFieldErrors.d.ts +1 -1
  103. package/dist/dts/submit/error/setCtxErrorsByFormSubmitFieldErrors.d.ts +8 -0
  104. package/dist/dts/submit/last-error/LastSubmitErrorContextProvider.d.ts +4 -0
  105. package/dist/dts/submit/last-error/LastSubmitErrorContextType.d.ts +8 -0
  106. package/dist/dts/submit/last-error/useLastSubmitError.d.ts +4 -0
  107. package/dist/dts/submit/last-error/useLastSubmitErrorContext.d.ts +3 -0
  108. package/dist/dts/submit/last-error/useLastSubmitErrorContextWith.d.ts +2 -0
  109. package/dist/{types → dts}/submit/useFormOnSubmitSuccessfulAndReset.d.ts +1 -2
  110. package/dist/dts/submit/useFormOnSubmitted.d.ts +4 -0
  111. package/dist/{types → dts}/submit/useResetFormOnSubmitted.d.ts +1 -2
  112. package/dist/dts/submit/useRhfUtilsFormOnSubmitContext.d.ts +3 -0
  113. package/dist/dts/submit/useSubmitFormOnChange.d.ts +15 -0
  114. package/dist/dts/submit/useSubmitFormOnEvent.d.ts +9 -0
  115. package/dist/dts/submit/useSubmitFormOnWatch.d.ts +14 -0
  116. package/dist/dts/utils/PassthroughChildren.d.ts +7 -0
  117. package/dist/{types → dts}/utils/createContext.d.ts +1 -2
  118. package/dist/dts/utils/fixedForwardRef.d.ts +5 -0
  119. package/dist/dts/utils/isEmptyObject.d.ts +1 -0
  120. package/dist/dts/utils/types.d.ts +3 -0
  121. package/dist/{types → dts}/utils/useImperativeForwardedRef.d.ts +1 -2
  122. package/dist/dts/utils/useIsFirstRender.d.ts +7 -0
  123. package/dist/dts/utils/useRefIfValueWasTrue.d.ts +2 -0
  124. package/dist/dts/utils/useToggle.d.ts +2 -0
  125. package/dist/dts/vite-env.d.ts +1 -0
  126. package/dist/esm/getFlatFieldErrors.mjs +55 -0
  127. package/dist/esm/index.mjs +503 -383
  128. package/dist/esm/relay.mjs +222 -0
  129. package/dist/esm/trpc.mjs +8 -9
  130. package/package.json +95 -23
  131. package/LICENSE.md +0 -21
  132. package/dist/esm/createContext.mjs +0 -16
  133. package/dist/esm/group.mjs +0 -74
  134. package/dist/esm/useFlatFieldErrorsContext.mjs +0 -10
  135. package/dist/esm/utils.mjs +0 -20
  136. package/dist/types/_exports/group.d.ts +0 -9
  137. package/dist/types/_exports/index.d.ts +0 -15
  138. package/dist/types/_exports/trpc.d.ts +0 -2
  139. package/dist/types/_exports/utils.d.ts +0 -1
  140. package/dist/types/client/config/RhfUtilsClientConfig.d.ts +0 -70
  141. package/dist/types/client/config/useRhfUtilsClientConfigContext.d.ts +0 -4
  142. package/dist/types/client/context.d.ts +0 -2
  143. package/dist/types/client/index.d.ts +0 -25
  144. package/dist/types/client/utils.d.ts +0 -12
  145. package/dist/types/client/zod/RhfUtilsUseFormChildrenZodFC.d.ts +0 -12
  146. package/dist/types/client/zod/RhfUtilsUseFormChildrenZodProps.d.ts +0 -4
  147. package/dist/types/client/zod/ZodTypeFieldValues.d.ts +0 -3
  148. package/dist/types/client/zod/consts.d.ts +0 -4
  149. package/dist/types/client/zod/context/RhfUtilsClientForZodContextProvider.d.ts +0 -7
  150. package/dist/types/client/zod/context/RhfUtilsZodForm.d.ts +0 -8
  151. package/dist/types/client/zod/context/useRhfUtilsClientForZodContext.d.ts +0 -5
  152. package/dist/types/client/zod/context/useRhfUtilsZodForm.d.ts +0 -7
  153. package/dist/types/client/zod/createRhfUtilsClientForZod.d.ts +0 -3
  154. package/dist/types/errors/flat/context/useFlatFieldErrorsContextHasOnlyOrphans.d.ts +0 -7
  155. package/dist/types/errors/flat/filterFlatFieldErrors.d.ts +0 -8
  156. package/dist/types/errors/getRefdFromFlatFieldErrors.d.ts +0 -2
  157. package/dist/types/errors/isFlatFieldErrorEntryRefd.d.ts +0 -6
  158. package/dist/types/errors/nonfield/RhfUtilsNonFieldErrorMarkerHtmlAttribute.d.ts +0 -5
  159. package/dist/types/errors/nonfield/isNonFieldErrorMarkerInDOM.d.ts +0 -6
  160. package/dist/types/errors/orphan/getIsOrphanFormErrorWithParentElement.d.ts +0 -6
  161. package/dist/types/errors/orphan/getOrphansFromFlatFieldErrors.d.ts +0 -3
  162. package/dist/types/errors/orphan/isOrphanFormError.d.ts +0 -3
  163. package/dist/types/errors/output/consoleErrors.d.ts +0 -6
  164. package/dist/types/errors/root/RootErrorsListFromFlatFieldErrorsContext.d.ts +0 -2
  165. package/dist/types/errors/root/getRootsFromFlatFieldErrors.d.ts +0 -2
  166. package/dist/types/errors/trpc/trpcClientErrorMessageSchema.d.ts +0 -23
  167. package/dist/types/errors/trpc/trpcClientErrorToFormSubmitFieldErrorsSchemaTransformer.d.ts +0 -27
  168. package/dist/types/form/Form.d.ts +0 -10
  169. package/dist/types/form/FormWithProviders.d.ts +0 -12
  170. package/dist/types/form/RhfUtilsFormProviders.d.ts +0 -11
  171. package/dist/types/form/UseRhfUtilsFormChildrenProps.d.ts +0 -19
  172. package/dist/types/form/UseRhfUtilsFormOnSubmitContext.d.ts +0 -28
  173. package/dist/types/form/UseRhfUtilsFormProps.d.ts +0 -22
  174. package/dist/types/form/UseRhfUtilsFormReturn.d.ts +0 -19
  175. package/dist/types/form/_Controller.d.ts +0 -5
  176. package/dist/types/form/context/group/FormGroupContextProvider.d.ts +0 -4
  177. package/dist/types/form/context/group/index.d.ts +0 -14
  178. package/dist/types/form/context/group/useFormGroupChildIsMountedTracker.d.ts +0 -5
  179. package/dist/types/form/context/group/useFormGroupChildIsSubmittingTracker.d.ts +0 -5
  180. package/dist/types/form/context/group/useFormGroupChildTracker.d.ts +0 -6
  181. package/dist/types/form/context/group/useFormGroupIsAnyBusy.d.ts +0 -2
  182. package/dist/types/form/context/group/useFormGroupIsChildBusy.d.ts +0 -2
  183. package/dist/types/form/context/group/useFormGroupIsParentBusy.d.ts +0 -2
  184. package/dist/types/form/context/group/useFormGroupParentTracker.d.ts +0 -7
  185. package/dist/types/form/context/group/useFormOrParentIsBusy.d.ts +0 -2
  186. package/dist/types/form/context/utils/RhfUtilsContextProvider.d.ts +0 -8
  187. package/dist/types/form/context/utils/useRhfUtilsContext.d.ts +0 -13
  188. package/dist/types/form/context/utils/useRhfUtilsContextRequestSubmit.d.ts +0 -5
  189. package/dist/types/form/useFormIsBusy.d.ts +0 -2
  190. package/dist/types/form/useRhfUtilsForm.d.ts +0 -15
  191. package/dist/types/form/utils/getSubmitterButtonData.d.ts +0 -7
  192. package/dist/types/register.d.ts +0 -7
  193. package/dist/types/submit/error/FormSubmitError.d.ts +0 -6
  194. package/dist/types/submit/error/setCtxErrorsByFormSubmitFieldErrors.d.ts +0 -9
  195. package/dist/types/submit/useFormOnSubmitted.d.ts +0 -5
  196. package/dist/types/submit/useSubmitFormOnChange.d.ts +0 -8
  197. package/dist/types/utils/PassthroughChildren.d.ts +0 -7
  198. package/dist/types/utils/fixedForwardRef.d.ts +0 -6
  199. package/dist/types/utils/isEmptyObject.d.ts +0 -2
  200. package/dist/types/utils/types.d.ts +0 -1
  201. package/dist/types/utils/useRefIfValueWasTrue.d.ts +0 -2
  202. package/dist/types/utils/useThrowAsyncError.d.ts +0 -5
  203. package/dist/types/utils/useToggle.d.ts +0 -3
  204. /package/dist/{types → dts}/errors/flat/context/FlatFieldErrorsOutputConfig.d.ts +0 -0
  205. /package/dist/{types → dts}/errors/flat/types.d.ts +0 -0
  206. /package/dist/{types → dts}/errors/nonfield/RhfUtilsNonFieldErrorMarker.spec.d.ts +0 -0
  207. /package/dist/{types → dts}/errors/nonfield/RhfUtilsNonFieldErrorMarker.utils.d.ts +0 -0
  208. /package/dist/{types → dts}/errors/output/types.d.ts +0 -0
  209. /package/dist/{types → dts}/errors/root/consts.d.ts +0 -0
  210. /package/dist/{types/form/SafeFieldValues.d.ts → dts/form/rhf/SafeFieldValuesType.d.ts} +0 -0
  211. /package/dist/{types → dts}/main.d.ts +0 -0
  212. /package/dist/{types → dts}/utils/timeoutAsync.d.ts +0 -0
  213. /package/dist/{types → dts}/utils/useDebouncedOnChangeValue.d.ts +0 -0
@@ -1,25 +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
- * Generic object schema type.
10
- */
11
- export type ObjectSchema<TInputKey extends string, TOutputKey extends string> = Record<TInputKey, SafeFieldValues> & Record<TOutputKey, SafeFieldValues>;
12
- export type CreateRhfUtilsClient<TObjectSchema extends ObjectSchema<TObjectSchemaInputKey, TObjectSchemaOutputKey>, TObjectSchemaInputKey extends string, TObjectSchemaOutputKey extends string> = {
13
- useForm: <TSchema extends TObjectSchema, TSchemaInput extends SafeFieldValues = TSchema[TObjectSchemaInputKey], TSchemaOutput extends SafeFieldValues = TSchema[TObjectSchemaOutputKey]>(schema: TSchema, form: UseRhfUtilsFormProps<TSchemaInput, TSchemaOutput>) => UseRhfUtilsFormReturn<TSchemaInput, TSchemaOutput> & {
14
- FormWithProviders: React.FC<React.PropsWithChildren>;
15
- };
16
- FormWithProviders: <TSchema extends TObjectSchema, TSchemaInput extends SafeFieldValues = TSchema[TObjectSchemaInputKey], TSchemaOutput extends SafeFieldValues = TSchema[TObjectSchemaOutputKey]>(props: {
17
- schema: TSchema;
18
- } & FormWithProvidersProps<TSchemaInput, TSchemaOutput>) => JSX.Element;
19
- };
20
- /**
21
- * ...
22
- *
23
- * (We need to use generics to generate types for schema resolver.)
24
- */
25
- 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,12 +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
- * Merge {@link RhfUtilsClientConfig.defaults} with array of {@link UseRhfUtilsFormProps}'s overrides.
7
- */
8
- export declare const mergeRhfUtilsClientConfigDefaultsWithUseRhfUtilsFormProps: <TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>(defaults: RhfUtilsClientConfig["defaults"], ...props: Pick<UseRhfUtilsFormProps<TFieldValues, TTransformedValues>, "rhf" | "utils" | "form">[]) => {
9
- rhf?: Pick<import('react-hook-form').UseFormProps, "mode" | "reValidateMode" | "resetOptions" | "context" | "shouldFocusError" | "shouldUnregister" | "shouldUseNativeValidation" | "progressive" | "criteriaMode" | "delayError">;
10
- utils?: RhfUtilsFormOptions;
11
- form?: Omit<React.PropsWithoutRef<JSX.IntrinsicElements["form"]>, "onSubmit">;
12
- } | undefined;
@@ -1,12 +0,0 @@
1
- import { default as React } from 'react';
2
- import { RhfUtilsUseFormChildrenZodProps } from './RhfUtilsUseFormChildrenZodProps';
3
- import { ZodTypeFieldValues } from './ZodTypeFieldValues';
4
- /**
5
- * {@link React.FC} for {@link RhfUtilsUseFormChildrenZodProps}.
6
- *
7
- * @example
8
- * ```tsx
9
- * const Children: RhfUtilsUseFormChildrenZodFC<typeof schema> = () => {};
10
- * ```
11
- */
12
- export type RhfUtilsUseFormChildrenZodFC<TSchema extends ZodTypeFieldValues> = React.FC<RhfUtilsUseFormChildrenZodProps<TSchema>>;
@@ -1,4 +0,0 @@
1
- import { UseRhfUtilsFormChildrenProps } from '../../form/UseRhfUtilsFormChildrenProps';
2
- import { zodTypeInput, zodTypeOutput } from './consts';
3
- import { ZodTypeFieldValues } from './ZodTypeFieldValues';
4
- export type RhfUtilsUseFormChildrenZodProps<TSchema extends ZodTypeFieldValues> = UseRhfUtilsFormChildrenProps<TSchema[typeof zodTypeInput], TSchema[typeof zodTypeOutput]>;
@@ -1,3 +0,0 @@
1
- import { z } from 'zod';
2
- import { SafeFieldValues } from '../../form/SafeFieldValues';
3
- export type ZodTypeFieldValues = z.ZodType<SafeFieldValues>;
@@ -1,4 +0,0 @@
1
- /** Schema key that returns input type. */
2
- export declare const zodTypeInput = "_input";
3
- /** Schema keys that returns output type. */
4
- export declare const zodTypeOutput = "_output";
@@ -1,7 +0,0 @@
1
- import { default as React } from 'react';
2
- import { RhfUtilsClientConfig } from '../../config/RhfUtilsClientConfig';
3
- type Props = React.PropsWithChildren<{
4
- config?: RhfUtilsClientConfig;
5
- }>;
6
- declare const RhfUtilsClientForZodContextProvider: React.FC<Props>;
7
- export default RhfUtilsClientForZodContextProvider;
@@ -1,8 +0,0 @@
1
- import { UseRhfUtilsFormProps } from '../../../form/UseRhfUtilsFormProps';
2
- import { zodTypeInput, zodTypeOutput } from '../consts';
3
- import { ZodTypeFieldValues } from '../ZodTypeFieldValues';
4
- type Props<TSchema extends ZodTypeFieldValues> = {
5
- schema: TSchema;
6
- } & UseRhfUtilsFormProps<TSchema[typeof zodTypeInput], TSchema[typeof zodTypeOutput]>;
7
- declare function RhfUtilsZodForm<TSchema extends ZodTypeFieldValues>({ schema, ...props }: Props<TSchema>): import("react/jsx-runtime").JSX.Element;
8
- export default RhfUtilsZodForm;
@@ -1,5 +0,0 @@
1
- import { default as createRhfUtilsClientForZod } from '../createRhfUtilsClientForZod';
2
- export type RhfUtilsClientForZodContext = ReturnType<typeof createRhfUtilsClientForZod>;
3
- declare const _RhfUtilsClientForZodContextProvider: import('react').Provider<import('../..').CreateRhfUtilsClient<import('../ZodTypeFieldValues').ZodTypeFieldValues, "_input", "_output"> | undefined>, useRhfUtilsClientForZodContext: () => import('../..').CreateRhfUtilsClient<import('../ZodTypeFieldValues').ZodTypeFieldValues, "_input", "_output">;
4
- export default useRhfUtilsClientForZodContext;
5
- export { _RhfUtilsClientForZodContextProvider };
@@ -1,7 +0,0 @@
1
- import { UseRhfUtilsFormProps } from '../../../form/UseRhfUtilsFormProps';
2
- import { zodTypeInput, zodTypeOutput } from '../consts';
3
- import { ZodTypeFieldValues } from '../ZodTypeFieldValues';
4
- declare const useRhfUtilsZodForm: <TSchema extends ZodTypeFieldValues>(schema: TSchema, form: UseRhfUtilsFormProps<TSchema[typeof zodTypeInput], TSchema[typeof zodTypeOutput]>) => import('../../../form/UseRhfUtilsFormReturn').UseRhfUtilsFormReturn<TSchema["_input"], TSchema["_output"]> & {
5
- FormWithProviders: React.FC<React.PropsWithChildren>;
6
- };
7
- export default useRhfUtilsZodForm;
@@ -1,3 +0,0 @@
1
- import { ZodTypeFieldValues } from './ZodTypeFieldValues';
2
- declare const createRhfUtilsClientForZod: (config: import('../config/RhfUtilsClientConfig').RhfUtilsClientConfig) => import('..').CreateRhfUtilsClient<ZodTypeFieldValues, "_input", "_output">;
3
- export default createRhfUtilsClientForZod;
@@ -1,7 +0,0 @@
1
- /**
2
- * Returns `true` if all errors are orphans.
3
- *
4
- * You may want to treat this case specifically.
5
- */
6
- declare const useFlatFieldErrorsContextHasOnlyOrphans: () => boolean;
7
- export default useFlatFieldErrorsContextHasOnlyOrphans;
@@ -1,8 +0,0 @@
1
- import { FlatFieldErrorEntry, FlatFieldErrors } from './types';
2
- /**
3
- * Filter {@link FlatFieldErrors} by a predicate.
4
- *
5
- * (Encapsulates to and from Object entries.)
6
- */
7
- declare const makeFlatFieldErrorsFilter: (predicate: (entry: FlatFieldErrorEntry, index: number) => boolean) => (errors: FlatFieldErrors) => FlatFieldErrors;
8
- export default makeFlatFieldErrorsFilter;
@@ -1,2 +0,0 @@
1
- declare const getRefdFromFlatFieldErrors: (errors: import('./flat/types').FlatFieldErrors) => import('./flat/types').FlatFieldErrors;
2
- export default getRefdFromFlatFieldErrors;
@@ -1,6 +0,0 @@
1
- import { FlatFieldErrorEntry } from './flat/types';
2
- /**
3
- * Determine if {@link FieldError} is a `ref`'d field error.
4
- */
5
- declare const isFlatFieldErrorEntryRefd: ([, error]: FlatFieldErrorEntry) => boolean;
6
- export default isFlatFieldErrorEntryRefd;
@@ -1,5 +0,0 @@
1
- /**
2
- * HTML data attribute for {@link RhfUtilsNonFieldErrorMarker}.
3
- */
4
- declare const RhfUtilsNonFieldErrorMarkerHtmlAttribute = "data-rhfutils-nonfield-error-marker-path";
5
- export default RhfUtilsNonFieldErrorMarkerHtmlAttribute;
@@ -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,6 +0,0 @@
1
- import { FlatFieldErrorEntry } from '../flat/types';
2
- /**
3
- * Util wrapper for {@link isOrphanFormError} for usage with {@link FlatFieldErrorEntry}.
4
- */
5
- declare const getIsFlatFieldErrorEntryOrphanByParentElement: (parentElement: Pick<HTMLElement, "querySelector">) => ([path, error]: FlatFieldErrorEntry) => boolean;
6
- export default getIsFlatFieldErrorEntryOrphanByParentElement;
@@ -1,3 +0,0 @@
1
- import { FlatFieldErrors } from '../flat/types';
2
- declare const getOrphansFromFlatFieldErrors: (errors: FlatFieldErrors, parentElement: Pick<HTMLElement, "querySelector">) => FlatFieldErrors;
3
- export default getOrphansFromFlatFieldErrors;
@@ -1,3 +0,0 @@
1
- import { FieldError } from 'react-hook-form';
2
- declare const isOrphanFormError: (path: string, error: FieldError, parentElement: Pick<HTMLElement, "querySelector">) => boolean;
3
- export default isOrphanFormError;
@@ -1,6 +0,0 @@
1
- import { SafeFieldValues } from '../../form/SafeFieldValues';
2
- /**
3
- * Output form values and errors to console.
4
- */
5
- declare const consoleErrors: (message: string, values: SafeFieldValues, errors: Record<string, unknown>, type?: "debug" | "error") => void;
6
- export default consoleErrors;
@@ -1,2 +0,0 @@
1
- declare const RootErrorsListFromFlatFieldErrorsContext: React.FC;
2
- export default RootErrorsListFromFlatFieldErrorsContext;
@@ -1,2 +0,0 @@
1
- declare const getRootsFromFlatFieldErrors: (errors: import('../flat/types').FlatFieldErrors) => import('../flat/types').FlatFieldErrors;
2
- export default getRootsFromFlatFieldErrors;
@@ -1,23 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Schema for {@link TRPCClientError} message.
4
- *
5
- * (Sent from backend as JSON string.)
6
- */
7
- declare const trpcClientErrorMessageSchema: z.ZodObject<{
8
- validation: z.ZodString;
9
- code: z.ZodString;
10
- message: z.ZodString;
11
- path: z.ZodArray<z.ZodString, "many">;
12
- }, "strip", z.ZodTypeAny, {
13
- message: string;
14
- code: string;
15
- path: string[];
16
- validation: string;
17
- }, {
18
- message: string;
19
- code: string;
20
- path: string[];
21
- validation: string;
22
- }>;
23
- export default trpcClientErrorMessageSchema;
@@ -1,27 +0,0 @@
1
- import { TRPCClientErrorLike } from '@trpc/client';
2
- import { AnyTRPCRouter } from '@trpc/server';
3
- import { z } from 'zod';
4
- import { FormSubmitFieldErrors } from '../../submit/error/FormSubmitFieldErrors';
5
- /**
6
- * Schema that transforms {@link TRPCClientError} to RHF {@link FormSubmitFieldErrors}.
7
- */
8
- declare const trpcClientErrorToFormSubmitFieldErrorsSchemaTransformer: z.ZodEffects<z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodEffects<z.ZodType<TRPCClientErrorLike<AnyTRPCRouter>, z.ZodTypeDef, TRPCClientErrorLike<AnyTRPCRouter>>, string, TRPCClientErrorLike<AnyTRPCRouter>>, unknown, TRPCClientErrorLike<AnyTRPCRouter>>, z.ZodArray<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
- }>, "many">>, (readonly [string, {
24
- type: string;
25
- message: string;
26
- }])[], TRPCClientErrorLike<AnyTRPCRouter>>, FormSubmitFieldErrors, TRPCClientErrorLike<AnyTRPCRouter>>;
27
- export default trpcClientErrorToFormSubmitFieldErrorsSchemaTransformer;
@@ -1,10 +0,0 @@
1
- import { default as React } from 'react';
2
- import { SafeFieldValues } from './SafeFieldValues';
3
- import { UseRhfUtilsFormProps } from './UseRhfUtilsFormProps';
4
- export type FormChildrenSlots = 'top' | 'bottom';
5
- export type FormProps<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues> = {
6
- formId: string;
7
- formRef: React.RefObject<HTMLFormElement>;
8
- } & Pick<UseRhfUtilsFormProps<TFieldValues, TTransformedValues>, 'onSubmit' | 'onSubmitError' | 'onSubmitInvalid' | 'Children' | 'form' | 'utils'>;
9
- 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;
10
- export default _Form;
@@ -1,12 +0,0 @@
1
- import { SafeFieldValues } from './SafeFieldValues';
2
- import { UseRhfUtilsFormProps } from './UseRhfUtilsFormProps';
3
- export type FormWithProvidersProps<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues> = React.PropsWithChildren<UseRhfUtilsFormProps<TFieldValues, TTransformedValues>>;
4
- /**
5
- * Form providers (with utils) with immediate descendent {@link Form}.
6
- * (Syntactic sugar for {@link useRhfUtilsForm}. Use this for most applications.)
7
- *
8
- * Use {@link useRhfUtilsForm} if you need to specific nesting hierarchy.
9
- * (e.g., wrapping `<tr>` with provider and nesting `<form>` within `<td>` to appease HTML rules.)
10
- */
11
- declare function FormWithProviders<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>(props: FormWithProvidersProps<TFieldValues, TTransformedValues>): import("react/jsx-runtime").JSX.Element;
12
- export default FormWithProviders;
@@ -1,11 +0,0 @@
1
- import { UseFormReturn } from 'react-hook-form';
2
- import { RhfUtilsFormOptions } from './RhfUtilsFormOptions';
3
- import { SafeFieldValues } from './SafeFieldValues';
4
- export type RhfUtilsFormProvidersProps<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues> = React.PropsWithChildren<{
5
- formId: string;
6
- formRef: React.RefObject<HTMLFormElement>;
7
- rhfForm: UseFormReturn<TFieldValues, unknown, TTransformedValues>;
8
- utils?: RhfUtilsFormOptions;
9
- }>;
10
- declare function RhfUtilsFormProviders<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>({ formId, formRef, rhfForm, utils, children, }: RhfUtilsFormProvidersProps<TFieldValues, TTransformedValues>): import("react/jsx-runtime").JSX.Element;
11
- export default RhfUtilsFormProviders;
@@ -1,19 +0,0 @@
1
- import { default as React } from 'react';
2
- import { UseFormReturn } from 'react-hook-form';
3
- import { FormSubmitError } from '../submit/error/FormSubmitError';
4
- import { default as _Controller } from './_Controller';
5
- import { RhfUtilsFormOptions } from './RhfUtilsFormOptions';
6
- import { SafeFieldValues } from './SafeFieldValues';
7
- /**
8
- * Component props for `Children`.
9
- *
10
- * Consider keeping shape in line with `UseRhfUtilsFormOnSubmitProps` and `UseRhfUtilsFormReturn`.
11
- */
12
- export type UseRhfUtilsFormChildrenProps<TFieldValues extends SafeFieldValues = SafeFieldValues, TTransformedValues extends SafeFieldValues = SafeFieldValues> = {
13
- formId: string;
14
- formRef: React.RefObject<HTMLFormElement>;
15
- context: UseFormReturn<TFieldValues, unknown, TTransformedValues>;
16
- utils?: RhfUtilsFormOptions;
17
- Controller: typeof _Controller<TFieldValues>;
18
- FormSubmitError: typeof FormSubmitError<TFieldValues>;
19
- };
@@ -1,28 +0,0 @@
1
- import { default as React } from 'react';
2
- import { UseFormReturn } from 'react-hook-form';
3
- import { FormSubmitError } from '../submit/error/FormSubmitError';
4
- import { FormSubmitFieldErrors } from '../submit/error/FormSubmitFieldErrors';
5
- import { RhfUtilsFormOptions } from './RhfUtilsFormOptions';
6
- import { SafeFieldValues } from './SafeFieldValues';
7
- /**
8
- * Props for onSubmit other than `data` and `event`.
9
- *
10
- * Consider keeping shape in line with `UseRhfUtilsFormChildrenProps` and `UseRhfUtilsFormReturn`.
11
- */
12
- export type UseRhfUtilsFormOnSubmitContext<TFieldValues extends SafeFieldValues = SafeFieldValues, TTransformedValues extends SafeFieldValues = SafeFieldValues> = {
13
- formId: string;
14
- formRef: React.RefObject<HTMLFormElement>;
15
- context: UseFormReturn<TFieldValues, unknown, TTransformedValues>;
16
- utils?: RhfUtilsFormOptions;
17
- FormSubmitError: typeof FormSubmitError<TFieldValues>;
18
- };
19
- /**
20
- * Props for onSubmitError other than `error` and `event`.
21
- */
22
- export type UseRhfUtilsFormOnSubmitErrorContext<TFieldValues extends SafeFieldValues = SafeFieldValues, TTransformedValues extends SafeFieldValues = SafeFieldValues> = {
23
- formId: string;
24
- formRef: React.RefObject<HTMLFormElement>;
25
- context: UseFormReturn<TFieldValues, unknown, TTransformedValues>;
26
- utils?: RhfUtilsFormOptions;
27
- errors?: FormSubmitFieldErrors;
28
- };
@@ -1,22 +0,0 @@
1
- import { default as React } from 'react';
2
- import { SubmitErrorHandler, UseFormProps } from 'react-hook-form';
3
- import { MaybePromise } from '../utils/types';
4
- import { RhfUtilsFormOptions } from './RhfUtilsFormOptions';
5
- import { SafeFieldValues } from './SafeFieldValues';
6
- import { UseRhfUtilsFormChildrenProps } from './UseRhfUtilsFormChildrenProps';
7
- import { UseRhfUtilsFormOnSubmitContext, UseRhfUtilsFormOnSubmitErrorContext } from './UseRhfUtilsFormOnSubmitContext';
8
- export type UseRhfUtilsFormProps<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues> = {
9
- defaultValues?: UseFormProps<TFieldValues>['defaultValues'];
10
- onSubmit?: (values: TTransformedValues, context: UseRhfUtilsFormOnSubmitContext<TFieldValues, TTransformedValues>, event: React.BaseSyntheticEvent<SubmitEvent>) => MaybePromise<unknown>;
11
- /** Submit error handler. (Only for errors not of instance `FormError`, which are handled internally.) */
12
- onSubmitError?: (error: unknown, context: UseRhfUtilsFormOnSubmitErrorContext<TFieldValues, TTransformedValues>, event: React.BaseSyntheticEvent<SubmitEvent>) => void;
13
- /** Submit handler when form is invalid. */
14
- onSubmitInvalid?: SubmitErrorHandler<TFieldValues>;
15
- Children: React.FC<UseRhfUtilsFormChildrenProps<TFieldValues, TTransformedValues>>;
16
- /** {@link RhfUseFormProps} props for RHF's {@link useForm}. */
17
- rhf?: Omit<UseFormProps<TFieldValues>, 'defaultValues'>;
18
- /** {@link RhfUtilsFormOptions} to enabled utils functionality. */
19
- utils?: RhfUtilsFormOptions;
20
- /** {@link FormProps} props for Form. */
21
- form?: Omit<React.PropsWithoutRef<JSX.IntrinsicElements['form']>, 'onSubmit'>;
22
- };
@@ -1,19 +0,0 @@
1
- import { default as React } from 'react';
2
- import { UseFormReturn } from 'react-hook-form';
3
- import { FormSubmitError } from '../submit/error/FormSubmitError';
4
- import { FormProps } from './Form';
5
- import { RhfUtilsFormProvidersProps } from './RhfUtilsFormProviders';
6
- import { SafeFieldValues } from './SafeFieldValues';
7
- /**
8
- * Return type for `useRhfUtilsForm`.
9
- *
10
- * Consider keeping shape in line with `UseRhfUtilsFormChildrenProps` and `UseRhfUtilsFormOnSubmitProps`.
11
- */
12
- export type UseRhfUtilsFormReturn<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues> = {
13
- id: string;
14
- ref: React.RefObject<HTMLFormElement>;
15
- context: UseFormReturn<TFieldValues, unknown, TTransformedValues>;
16
- providerProps: RhfUtilsFormProvidersProps<TFieldValues, TTransformedValues>;
17
- formProps: FormProps<TFieldValues, TTransformedValues>;
18
- FormSubmitError: typeof FormSubmitError<TFieldValues>;
19
- };
@@ -1,5 +0,0 @@
1
- import { ControllerProps, FieldPath } from 'react-hook-form';
2
- import { SafeFieldValues } from './SafeFieldValues';
3
- export type _ControllerProps<TFieldValues extends SafeFieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = Omit<ControllerProps<TFieldValues, TName>, 'control'>;
4
- declare function _Controller<TFieldValues extends SafeFieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(props: _ControllerProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
5
- export default _Controller;
@@ -1,4 +0,0 @@
1
- import { default as React } from 'react';
2
- type Props = React.PropsWithChildren;
3
- declare const FormGroupContextProvider: React.FC<Props>;
4
- export default FormGroupContextProvider;
@@ -1,14 +0,0 @@
1
- export type FormGroupContext = {
2
- /** Dependent forms. */
3
- children: {
4
- busyIds: string[];
5
- busyCount: number;
6
- setBusyId: (id: string, isBusy: boolean) => void;
7
- };
8
- /** Main form. */
9
- parent: {
10
- isBusy: boolean;
11
- setIsBusy: (isBusy: boolean) => void;
12
- };
13
- };
14
- export declare const _FormGroupContextProvider: import('react').Provider<FormGroupContext | undefined>, _useFormGroupContext: () => FormGroupContext, _useFormGroupContextMaybe: () => FormGroupContext | undefined;
@@ -1,5 +0,0 @@
1
- /**
2
- * Mark "child" form as "busy" when mounted.
3
- */
4
- declare const useFormGroupChildIsMountedTracker: () => boolean;
5
- export default useFormGroupChildIsMountedTracker;
@@ -1,5 +0,0 @@
1
- /**
2
- * Mark "child" form as "busy" when submitting.
3
- */
4
- declare const useFormGroupChildIsSubmittingTracker: () => boolean;
5
- export default useFormGroupChildIsSubmittingTracker;
@@ -1,6 +0,0 @@
1
- /**
2
- * Mark "child" form as "busy" via arbitrary boolean.
3
- * Automatically marks as "not busy" on dismount.
4
- */
5
- declare const useFormGroupChildTracker: (track: boolean) => void;
6
- export default useFormGroupChildTracker;
@@ -1,2 +0,0 @@
1
- declare const useFormGroupIsAnyBusy: () => boolean;
2
- export default useFormGroupIsAnyBusy;
@@ -1,2 +0,0 @@
1
- declare const useFormGroupIsChildBusy: () => boolean;
2
- export default useFormGroupIsChildBusy;
@@ -1,2 +0,0 @@
1
- declare const useFormGroupIsParentBusy: () => boolean;
2
- export default useFormGroupIsParentBusy;
@@ -1,7 +0,0 @@
1
- /**
2
- * Connect specific form state as parent context.
3
- *
4
- * Requires usage of provider.
5
- */
6
- declare const useFormGroupParentTracker: () => boolean;
7
- export default useFormGroupParentTracker;
@@ -1,2 +0,0 @@
1
- declare const useFormOrParentIsBusy: () => boolean;
2
- export default useFormOrParentIsBusy;
@@ -1,8 +0,0 @@
1
- import { RhfUtilsFormOptions } from '../../RhfUtilsFormOptions';
2
- type Props = React.PropsWithChildren<{
3
- formId: string;
4
- formRef: React.RefObject<HTMLFormElement>;
5
- options?: RhfUtilsFormOptions;
6
- }>;
7
- declare const RhfUtilsContextProvider: React.FC<Props>;
8
- export default RhfUtilsContextProvider;
@@ -1,13 +0,0 @@
1
- import { RhfUtilsFormOptions } from '../../RhfUtilsFormOptions';
2
- export type RhfUtilsContext = {
3
- formId: string;
4
- formRef: React.RefObject<HTMLFormElement>;
5
- options: RhfUtilsFormOptions | undefined;
6
- };
7
- declare const _RhfUtilsContextProvider: import('react').Provider<RhfUtilsContext | undefined>;
8
- /**
9
- * Use utils from the current form context.
10
- */
11
- declare const useRhfUtilsContext: () => RhfUtilsContext;
12
- export default useRhfUtilsContext;
13
- export { _RhfUtilsContextProvider };
@@ -1,5 +0,0 @@
1
- /**
2
- * Get `requestSubmit` function from the form ref'd in current context.
3
- */
4
- declare const useRhfUtilsContextRequestSubmit: () => (submitter?: HTMLElement | null) => void;
5
- export default useRhfUtilsContextRequestSubmit;
@@ -1,2 +0,0 @@
1
- declare const useFormIsBusy: () => boolean;
2
- export default useFormIsBusy;
@@ -1,15 +0,0 @@
1
- import { SafeFieldValues } from './SafeFieldValues';
2
- import { UseRhfUtilsFormProps } from './UseRhfUtilsFormProps';
3
- import { UseRhfUtilsFormReturn } from './UseRhfUtilsFormReturn';
4
- /**
5
- * Core Rhf Form hook. Use `Form` in `index.ts` for most cases.
6
- * Use this if you need to separate form components.
7
- * e.g., a form for table row due to `form` being considered invalid HTML around `tr` tags.
8
- * With this hook, you can wrap the `tr` tag with `form.Provider` and use `form.Form` inside
9
- * one of the cells. Other components can be outside form while referring to form by its id via `form` attribute.
10
- * see https://caniuse.com/?search=form%20attribute
11
- * @returns Form provider and form.
12
- */
13
- declare const useRhfUtilsForm: <TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>({ defaultValues, onSubmit, onSubmitError, onSubmitInvalid, Children, rhf, form, utils, }: UseRhfUtilsFormProps<TFieldValues, TTransformedValues>) => UseRhfUtilsFormReturn<TFieldValues, TTransformedValues>;
14
- export default useRhfUtilsForm;
15
- export type UseRhfUtilsForm<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues> = typeof useRhfUtilsForm<TFieldValues, TTransformedValues>;
@@ -1,7 +0,0 @@
1
- import { default as React } from 'react';
2
- /**
3
- * Get [name, value] tuple of button/input that submitted form.
4
- * Useful when determining user intent
5
- */
6
- declare const getSubmitterButtonData: (event: React.BaseSyntheticEvent) => [name: string, value: string] | undefined;
7
- export default getSubmitterButtonData;
@@ -1,7 +0,0 @@
1
- /**
2
- * Use this to extend internal types.
3
- *
4
- * For example, `RhfUtilsFormOptions`.
5
- */
6
- export interface Register {
7
- }
@@ -1,6 +0,0 @@
1
- import { SafeFieldValues } from '../../form/SafeFieldValues';
2
- import { FormSubmitFieldErrors } from './FormSubmitFieldErrors';
3
- export declare class FormSubmitError<TFieldValues extends SafeFieldValues = SafeFieldValues> extends Error {
4
- errors: FormSubmitFieldErrors<TFieldValues>;
5
- constructor(errors: FormSubmitFieldErrors<TFieldValues>, message?: string);
6
- }
@@ -1,9 +0,0 @@
1
- import { UseFormReturn } from 'react-hook-form';
2
- import { SafeFieldValues } from '../../form/SafeFieldValues';
3
- import { FormSubmitFieldErrors } from './FormSubmitFieldErrors';
4
- /**
5
- * Handle thrown {@link FormSubmitError}.
6
- * Add key/values as name/message to RHF context errors.
7
- */
8
- declare const setCtxErrorsByFormSubmitFieldErrors: <TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>(ctx: UseFormReturn<TFieldValues, unknown, TTransformedValues>, errors: FormSubmitFieldErrors) => void;
9
- export default setCtxErrorsByFormSubmitFieldErrors;
@@ -1,5 +0,0 @@
1
- import { MaybePromise } from '../utils/types';
2
- declare const useFormOnSubmitted: (callback?: (success: boolean) => MaybePromise<unknown>, options?: {
3
- successful?: boolean;
4
- }) => void;
5
- export default useFormOnSubmitted;
@@ -1,8 +0,0 @@
1
- import { default as React } from 'react';
2
- declare const useSubmitFormOnChange: (formRef: React.RefObject<HTMLFormElement>, options?: {
3
- /** Disable behavior. (Default behavior is enabled for sake of simplicity of general usage.) */
4
- disabled?: boolean;
5
- /** Milliseconds to debounce form submission. (Default is none.) */
6
- debounce?: number;
7
- }) => void;
8
- export default useSubmitFormOnChange;
@@ -1,7 +0,0 @@
1
- /**
2
- * Component for simply passing through children.
3
- *
4
- * (Useful for conditional wrapping of children.)
5
- */
6
- declare const PassthroughChildren: React.FC<React.PropsWithChildren>;
7
- export default PassthroughChildren;
@@ -1,6 +0,0 @@
1
- import { default as React } from 'react';
2
- /**
3
- * @see https://www.totaltypescript.com/forwardref-with-generic-components
4
- */
5
- declare function fixedForwardRef<T, P = object>(render: React.ForwardRefRenderFunction<T, React.PropsWithoutRef<P>>): (props: P & React.RefAttributes<T>) => React.ReactNode;
6
- export default fixedForwardRef;
@@ -1,2 +0,0 @@
1
- declare const isEmptyObject: (obj: Record<string, unknown>) => boolean;
2
- export default isEmptyObject;
@@ -1 +0,0 @@
1
- export type MaybePromise<T> = T | Promise<T>;
@@ -1,2 +0,0 @@
1
- declare const useRefIfValueWasTrue: (value: boolean) => readonly [boolean, () => void];
2
- export default useRefIfValueWasTrue;
@@ -1,5 +0,0 @@
1
- /**
2
- * React cannot handle async errors in event handlers or useEffects.
3
- */
4
- declare const useThrowAsyncError: () => (error: unknown) => void;
5
- export default useThrowAsyncError;
@@ -1,3 +0,0 @@
1
- import { default as React } from 'react';
2
- declare const useToggle: (defaultValue?: boolean) => [boolean, React.DispatchWithoutAction];
3
- export default useToggle;
File without changes