@paragrav/rhf-utils 0.71.0 → 0.73.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.
package/README.md CHANGED
@@ -9,18 +9,23 @@ Integration and utility library for [react-hook-form](https://www.react-hook-for
9
9
  - TypeScript-first
10
10
  - global configuration (🔗 [`RhfUtilsClientConfig`](#config) section)
11
11
  - RHF (`UseFormProps`) and utilities (`RhfUtilsFormOptions`) options defaults
12
- - inject your own hooks and UI (`FormInjector`)
12
+ - inject your own hooks and UI (`useFormHooks`, `FormOutlet`) ✨
13
13
  - server error transformation (`onSubmitErrorUnknown`) ✨
14
14
  - handle cancel prompt (`useCanFormBeCancelled`) ✨
15
15
  - RHF `FormState.errors` logging/throwing (`RhfUtilsClientConfig.fieldErrors`) ✨
16
16
  - form-level configuration (🔗 [`RhfUtilsZodForm`](#form-with-providers) section)
17
17
  - RHF and utilities options overrides
18
- - extendable utilities options type (`RhfUtilsFormOptions`)
19
18
  - throw error (`FormSubmitError`) in submit handler to add errors to RHF context and fail submit
20
19
  - handle submit error (`onSubmitError` / `useLastSubmitError`)
21
20
  - context injection for children (`RhfUtilsZodForm.Children`), including:
22
- - formId, formRef, RHF context, utilities options
21
+ - `RhfUtilsContext` (see section below)
23
22
  - schema-typed Controller component and FormSubmitError class
23
+ - RHF context
24
+ - options (🔗 [`RhfUtilsFormOptions`](#rhfutilsformoptions) section) ✨
25
+ - extend with your own per-form options (e.g., `enableMyPrompter`)
26
+ - context (🔗 [`RhfUtilsContext`](#rhfutilscontext) section) ✨
27
+ - use `useRhfUtilsContext` to access options in your hook/component structure
28
+ - `formId`, `formRef`, `options`
24
29
  - form state relay (🔗 [`FormRelayContextProvider`](#form-state-relay) section) ✨
25
30
  - access specific form's state from outside that form/provider
26
31
  - assign forms into groups and watch collectively
@@ -41,10 +46,12 @@ yarn add @paragrav/rhf-utils # yarn
41
46
 
42
47
  ## Quick Start
43
48
 
44
- - 🔗 [Config](#config) (`RhfUtilsClientConfig`): define your global config (optional)
45
- - 🔗 [Provider](#config-provider) (`RhfUtilsClientConfigProvider`): add to your global stack
46
- - 🔗 [Form With Providers](#form-with-providers) (`RhfUtilsZodFormWithProviders`): use as form component
47
- - 🔗 [Form State Relay](#form-state-relay) (`FormRelayContextProvider`): relay form state
49
+ - 🔗 [Config](#config) (`RhfUtilsClientConfig`) - define your global config (optional)
50
+ - 🔗 [Provider](#config-provider) (`RhfUtilsClientConfigProvider`) - add to your global stack
51
+ - 🔗 [Form With Providers](#form-with-providers) (`RhfUtilsZodFormWithProviders`) - use as form component
52
+ - 🔗 [Options](#rhfutilsformoptions) (`RhfUtilsFormOptions`) - global, per-form flags
53
+ - 🔗 [Context](#rhfutilscontext) (`RhfUtilsContext`) - utils context
54
+ - 🔗 [Form State Relay](#form-state-relay) (`FormRelayContextProvider`) - relay form state
48
55
 
49
56
  ## Config
50
57
 
@@ -74,22 +81,17 @@ export const rhfUtilsClientConfig: RhfUtilsClientConfig = {
74
81
  // optional form component to use (defaults to primitive HTML form)
75
82
  FormComponent: Form.Root,
76
83
 
77
- // inject your own hooks and components
78
- // into all RhfUtilsZodForm instances
79
- FormInjector: (
80
- // RhfUtilsFormInjectorProps
84
+ // inject your hooks across all RhfUtilsZodForm instances
85
+ useFormHooks: (
86
+ // RhfUtilsClientConfigUseFormHooksProps
81
87
  {
82
- Outlet, // Form instance (RhfUtilsZodForm.Children) "outlet"
83
-
84
- formId, // unique id string
85
- formRef, // form element ref
86
- context, // rhf UseFormReturn (without proxy `formState`)
87
- options, // RhfUtilsFormOptions (with any custom props)
88
- Controller, // rhf controller (SafeFieldValues-typed; no schema at this level)
89
- FormSubmitError, // error class (SafeFieldValues-typed; no schema at this level)
88
+ formId, // unique id string
89
+ formRef, // form element ref
90
+ options, // RhfUtilsFormOptions (with any custom props)
91
+ lastSubmit, // last submit state (see "Last Submit" section)
92
+ rhf, // rhf UseFormReturn (without proxy `formState`)
90
93
  },
91
94
  ) => {
92
- // hook injected across all instances
93
95
  useMyGlobalFormHook();
94
96
 
95
97
  // hook injected across all instances with per-instance opt-in flag via custom option props
@@ -97,17 +99,31 @@ export const rhfUtilsClientConfig: RhfUtilsClientConfig = {
97
99
  useMyOptionalFormHook({
98
100
  enabled: !!options.enableMyOptionalFormHook,
99
101
  });
102
+ },
100
103
 
101
- return (
102
- <>
103
- {/* Form instance (RhfUtilsZodForm.Children) "outlet" (see "Component Hierarchy" section). */}
104
- <Outlet />
104
+ // inject your components across all RhfUtilsZodForm instances
105
+ FormOutlet: (
106
+ // RhfUtilsClientConfigOutletProps
107
+ {
108
+ formId, // unique id string
109
+ formRef, // form element ref
110
+ options, // RhfUtilsFormOptions (with any custom props)
111
+ lastSubmit, // current form submit state
112
+ rhf, // rhf UseFormReturn (without proxy `formState`)
105
113
 
106
- {/* root errors list */}
107
- <RootErrorsList />
108
- </>
109
- );
110
- },
114
+ Outlet, // Form instance (RhfUtilsZodForm.Children) "outlet"
115
+ Controller, // rhf controller (SafeFieldValues-typed; no schema at this level)
116
+ FormSubmitError, // error class (SafeFieldValues-typed; no schema at this level)
117
+ },
118
+ ) => (
119
+ <>
120
+ {/* Form instance (RhfUtilsZodForm.Children) "outlet" (see "Component Hierarchy" section). */}
121
+ <Outlet />
122
+
123
+ {/* root errors list */}
124
+ <RootErrorsList />
125
+ </>
126
+ ),
111
127
 
112
128
  // hook that returns callback to determine whether form can be cancelled
113
129
  // if `true`, `RhfUtilsZodForm.onCancel` at form-level is called (e.g., parent component hides form)
@@ -116,13 +132,15 @@ export const rhfUtilsClientConfig: RhfUtilsClientConfig = {
116
132
  // (i.e., calling your own hook in `FormComponent`)
117
133
  useCanFormBeCancelled: () => {
118
134
  const { isDirty } = useFormState();
119
- const myPrompter = useMyPrompter();
120
135
 
121
- // return callback to be called at event-time
122
- return ({ options }) =>
136
+ const canFormBeCancelled = ({ utils, lastSubmit, rhf }) =>
123
137
  !options.enableMyPrompter || // my prompter option not enabled
124
138
  !isDirty || // or rhf form state not dirty
125
- confirm('Are you sure you want to cancel?'); // or user confirms
139
+ lastSubmit.status.current === 'success' || // successful submit before form state updated
140
+ confirm('Are you sure?'); // or user confirms
141
+
142
+ // return callback to be called at event-time
143
+ return canFormBeCancelled;
126
144
  },
127
145
 
128
146
  // non-FormSubmitError thrown in onSubmit
@@ -204,8 +222,8 @@ Currently, only `zod` schemas are supported.
204
222
  }}
205
223
  // submit handler
206
224
  onSubmit={({ input, output, api }, context, event) => registerService(api)}
207
- onSubmitSuccess={(onSubmitResult, { input, output, api }, context, event) =>
208
- navigate('/app/' + onSubmitResult.id)
225
+ onSubmitSuccess={(submitResult, { input, output, api }, context, event) =>
226
+ navigate('/app/' + submitResult.id)
209
227
  }
210
228
  // handle error declaratively (i.e., no throw/catch)
211
229
  onSubmitError={({ error, context, event }) => {
@@ -356,10 +374,6 @@ Any non-`FormSubmitError` error thrown from your submit handler (e.g., fetch/axi
356
374
 
357
375
  Most common use case will be transforming backend errors to frontend shape expected by RHF.
358
376
 
359
- ### Last Submit Error
360
-
361
- Sometimes, perhaps outside any specific `FormContext`, you need direct access to the actual error object that was thrown, which caused the last submit to fail. The `useLastSubmitError` hook allows you to do just this. (You can probably handle most form-specific cases via `onSubmitErrorUnknown`, which receives error as well.)
362
-
363
377
  ## `RhfUtilsFormOptions`
364
378
 
365
379
  These built-in options can be set globally and/or per form.
@@ -370,7 +384,7 @@ type RhfUtilsFormOptions = {
370
384
  stopSubmitPropagation?: boolean;
371
385
 
372
386
  /** Request submit on change. */
373
- submitOnChange?: { debounce?: number };
387
+ submitOnWatch?: { debounce?: number };
374
388
 
375
389
  /**
376
390
  * Reset form values and state (e.g., isDirty, etc.) after submit -- on success and/or error.
@@ -387,15 +401,9 @@ type RhfUtilsFormOptions = {
387
401
  };
388
402
  ```
389
403
 
390
- If you need access to options deeper in your component structure, use `useRhfUtilsContext` to receive `RhfUtilsContext` object, which includes `formId`, `formRef`, `options`, and `lastSubmitStateRef`.
391
-
392
- `lastSubmitStateRef` (a ref with possible value of `null | 'submitting' | 'success' | 'error'`) conveys current submit state via ref -- i.e., without needing to wait for next render cycle. If your form navigates away via `onSubmitSuccess`, RHF's `useFormContext` still shows form as `isDirty` and `isSubmitting`, which makes it difficult to distinguish from a user-initiated navigation before form is submitted successfully.
393
-
394
- Use `useRhfUtilsContextRequestSubmit` hook to get `requestSubmit` function for current form ref in context. This is useful when you need to trigger form submission programatically.
395
-
396
- ## Extend `RhfUtilsFormOptions`
404
+ ### Extend
397
405
 
398
- Extend `RhfUtilsFormOptions` with custom options, which get passed to `RhfUtilsClientConfig`'s `ChildrenWrapper` and `RhfUtilsZodForm`'s `Children` components via `options` prop. These can take any shape, and allow you to override your own functionality at form-level.
406
+ Extend `RhfUtilsFormOptions` with custom options, which get passed to `RhfUtilsClientConfig`'s `useFormHooks` and `FormOutlet`; and `RhfUtilsZodForm`'s `Children` components via `options` prop. These can take any shape, and allow you to override your own functionality at form-level.
399
407
 
400
408
  ```tsx
401
409
  import '@paragrav/rhf-utils';
@@ -412,7 +420,29 @@ declare module '@paragrav/rhf-utils' {
412
420
  }
413
421
  ```
414
422
 
415
- ## <a id="form-state-relay"></a> Form State Relay
423
+ ## `RhfUtilsContext`
424
+
425
+ If you need access to options deeper in your component structure, use `useRhfUtilsContext` to receive `RhfUtilsContext` object, which includes `formId`, `formRef`, `options` (with extended properties), and last submit status and error.
426
+
427
+ ## Last Submit Context
428
+
429
+ If you need access to metadata about the last submit outside of form, use `useLastSubmit` to receive the following data.
430
+
431
+ ### Status (ref)
432
+
433
+ The property `status` (a ref with possible value of `null | 'submitting' | 'success' | 'error'`) conveys current submit state via ref -- i.e., without needing to wait for next render cycle. If your form navigates away via `onSubmitSuccess`, RHF's `useFormContext` still shows form as `isDirty` and `isSubmitting`, which makes it difficult to distinguish from a user-initiated navigation before form is submitted successfully.
434
+
435
+ ### Error (state)
436
+
437
+ Sometimes, such as outside any specific `FormContext`, you need direct access to the actual error object that was thrown, which caused the last submit to fail. The `useLastSubmitError` hook allows you to do just this. (You can probably handle most form-specific cases via `onSubmitErrorUnknown`, which receives error as well.)
438
+
439
+ ---
440
+
441
+ ### Request Submit
442
+
443
+ Use `useRhfUtilsContextRequestSubmit` hook to get `requestSubmit` function for current form ref in context. This is useful when you need to trigger form submission programatically.
444
+
445
+ ## Form State Relay
416
446
 
417
447
  Sometimes you need to access one or more forms' state outside its respective context.
418
448
 
@@ -1,4 +1,4 @@
1
- import { i as SafeFieldValues, t as RhfUtilsContext } from "./RhfUtilsContextType-BFmDtONY.js";
1
+ import { r as SafeFieldValues, t as RhfUtilsContext } from "./RhfUtilsContextType-Cqg-0i2U.js";
2
2
  import { FormState } from "react-hook-form";
3
3
 
4
4
  //#region src/form/relay/types.d.ts
@@ -27,4 +27,4 @@ type FormRelayOptions = {
27
27
  };
28
28
  //#endregion
29
29
  export { FormRelay as n, FormRelayStateSelected as r, FormRelayOptions as t };
30
- //# sourceMappingURL=FormRelayOptions-mBqiP41Z.d.ts.map
30
+ //# sourceMappingURL=FormRelayOptions-BtNZLz8X.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormRelayOptions-mBqiP41Z.d.ts","names":[],"sources":["../../src/form/relay/types.ts","../../src/form/relay/FormRelayOptions.ts"],"mappings":";;;;KAOY,SAAA,sBAA+B,eAAA,GAAkB,eAAA;EAEzD,KAAA,EAAO,sBAAA,CAAuB,YAAA;EAC9B,OAAA,EAAS,gBAAA;EACT,KAAA,EAAO,eAAA;AAAA;AAAA,KAGC,sBAAA,sBACW,eAAA,GAAkB,eAAA,IACrC,OAAA,CACF,SAAA,CAAU,YAAA;EACR,SAAA;AAAA;;;KCZQ,gBAAA;EDCA;;;;ECIV,MAAA,GAAS,SAAA,EAAW,SAAA,CAAU,eAAA,MAAqB,sBAAA;EDFnB;;;;;ECShC,MAAA;AAAA"}
1
+ {"version":3,"file":"FormRelayOptions-BtNZLz8X.d.ts","names":[],"sources":["../../src/form/relay/types.ts","../../src/form/relay/FormRelayOptions.ts"],"mappings":";;;;KAOY,SAAA,sBAA+B,eAAA,GAAkB,eAAA;EAEzD,KAAA,EAAO,sBAAA,CAAuB,YAAA;EAC9B,OAAA,EAAS,gBAAA;EACT,KAAA,EAAO,eAAA;AAAA;AAAA,KAGC,sBAAA,sBACW,eAAA,GAAkB,eAAA,IACrC,OAAA,CACF,SAAA,CAAU,YAAA;EACR,SAAA;AAAA;;;KCZQ,gBAAA;EDCA;;;;ECIV,MAAA,GAAS,SAAA,EAAW,SAAA,CAAU,eAAA,MAAqB,sBAAA;EDFnB;;;;;ECShC,MAAA;AAAA"}
@@ -106,7 +106,8 @@ const flattenFieldErrors = (errors) => flatten(errors);
106
106
  */
107
107
  const getFlatFieldErrors = (errors) => {
108
108
  const flattened = flattenFieldErrors(errors);
109
- return Object.fromEntries(Object.keys(flattened).reduce((entriesAccumulator, flattenedKey) => {
109
+ const flattenedKeys = Object.keys(flattened);
110
+ return Object.fromEntries(flattenedKeys.reduce((entriesAccumulator, flattenedKey) => {
110
111
  /**
111
112
  * Maybe path.
112
113
  *
@@ -191,4 +192,4 @@ const FormRelaySetter = ({ options }) => {
191
192
  //#endregion
192
193
  export { _RhfUtilsContextProvider as a, FormRelayContextProvider as c, isEmptyObject as i, useFormRelayContext as l, useFormRelaySet as n, useRhfUtilsContext as o, getFlatFieldErrors as r, useRhfUtilsMaybeContext as s, FormRelaySetter as t, createContext as u };
193
194
 
194
- //# sourceMappingURL=FormRelaySetter-BKO0Wodf.js.map
195
+ //# sourceMappingURL=FormRelaySetter-Cuh0-4HA.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormRelaySetter-BKO0Wodf.js","names":[],"sources":["../../src/utils/createContext.ts","../../src/form/relay/context/useFormRelayContext.ts","../../src/form/relay/context/FormRelayContextProvider.tsx","../../src/form/context/utils/useRhfUtilsContext.tsx","../../src/utils/isEmptyObject.ts","../../src/errors/flat/flattenFieldErrors.ts","../../src/errors/flat/getFlatFieldErrors.ts","../../src/form/relay/set/useFormRelaySet.ts","../../src/form/relay/set/FormRelaySetter.tsx"],"sourcesContent":["import React from 'react';\n\n/**\n * Create a strictly-typed context that throws error if no provider is found.\n * @returns A tuple with a function to get the context and the context provider.\n */\nexport function createContext<T = unknown>() {\n const context = React.createContext<T | undefined>(undefined);\n\n const useMaybe = () => React.useContext(context);\n\n const useRequired = () => {\n const c = useMaybe();\n\n // type guard\n if (c === undefined) throw new Error();\n\n return c;\n };\n\n return {\n Provider: context.Provider,\n useMaybe,\n useRequired,\n } as const;\n}\n","import type { RhfUtilsContext } from '@/form/context/utils/RhfUtilsContextType';\n\nimport { createContext } from '@/utils/createContext';\n\nimport type { FormRelayOptions } from '../FormRelayOptions';\nimport type { FormRelay, FormRelayStateSelected } from '../types';\n\nexport type FormsRelayed = Record<\n string, // form id\n FormRelay\n>;\n\nexport type FormRelayContext = {\n // set\n\n add: (\n state: FormRelayStateSelected,\n utils: RhfUtilsContext,\n options: FormRelayOptions,\n ) => void;\n\n update: (id: string, state: FormRelayStateSelected) => void;\n\n remove: (id: string) => void;\n\n // state\n\n state: FormsRelayed;\n};\n\nexport const {\n Provider: _FormRelayContextProvider,\n useRequired: useFormRelayContext,\n} = createContext<FormRelayContext>();\n","import React from 'react';\n\nimport type { RhfUtilsContext } from '@/form/context/utils/RhfUtilsContextType';\n\nimport type { FormRelayOptions } from '../FormRelayOptions';\nimport type { FormRelayStateSelected } from '../types';\n\nimport type { FormsRelayed } from './useFormRelayContext';\nimport { _FormRelayContextProvider } from './useFormRelayContext';\n\ntype Props = React.PropsWithChildren;\n\nexport const FormRelayContextProvider: React.FC<Props> = ({ children }) => {\n // state\n\n const [state, setState] = React.useState<FormsRelayed>({});\n\n // set\n\n const add = React.useCallback(\n (\n formState: FormRelayStateSelected,\n utils: RhfUtilsContext,\n options: FormRelayOptions,\n ) => {\n if (state[utils.formId]) throw new Error('Form id already exists.');\n\n setState((forms) => ({\n ...forms,\n [utils.formId]: { state: formState, utils, options },\n }));\n },\n\n [state],\n );\n\n const update = React.useCallback(\n (id: string, state: FormRelayStateSelected) => {\n setState((forms) => {\n const current = forms[id];\n\n if (!current) throw new Error(\"Form id doesn't exist\");\n\n return {\n ...forms,\n [id]: { ...current, state },\n };\n });\n },\n [],\n );\n\n const remove = React.useCallback((id: string) => {\n setState((forms) =>\n Object.fromEntries(\n Object.entries(forms)\n // keep only other ids\n .filter(([entryId]) => entryId !== id),\n ),\n );\n }, []);\n\n //\n\n return (\n <_FormRelayContextProvider\n value={{\n // set\n\n add,\n update,\n remove,\n\n // get\n\n state,\n }}\n >\n {children}\n </_FormRelayContextProvider>\n );\n};\n","import { createContext } from '@/utils/createContext';\n\nimport type { RhfUtilsContext } from './RhfUtilsContextType';\n\nconst {\n Provider: _RhfUtilsContextProvider,\n useRequired: useRhfUtilsContext,\n useMaybe: useRhfUtilsMaybeContext,\n} = createContext<RhfUtilsContext>();\n\nexport {\n _RhfUtilsContextProvider,\n useRhfUtilsContext,\n useRhfUtilsMaybeContext,\n};\n","export const isEmptyObject = (obj: Record<string, unknown>) =>\n Object.keys(obj).length === 0;\n","import { flatten } from 'flat';\nimport type { FieldErrors } from 'react-hook-form';\n\n/**\n * Flatten a {@link FieldErrors} object.\n *\n * @returns e.g.,\n * ```ts\n * {\n * \"address.street.type\": \"too_short\",\n * \"address.street.ref.value\": \"123\",\n * \"address.street.message\": \"Required.\"\n * }\n * ```\n */\nexport const flattenFieldErrors = (errors: FieldErrors) =>\n flatten<FieldErrors, Record<string, unknown>>(errors);\n","import type { FieldError, FieldErrors } from 'react-hook-form';\nimport { get } from 'react-hook-form';\n\nimport type { SafeFieldValues } from '@/form/rhf/SafeFieldValuesType';\n\nimport { flattenFieldErrors } from './flattenFieldErrors';\nimport type { FlatFieldErrors } from './types';\n\n/**\n * Get {@link FlatFieldErrors} from {@link FieldErrors}.\n * This makes it easy to work with potentially deeply-nested {@link FieldErrors}.\n *\n * @param errors {@link FieldErrors} object.\n *\n * @returns `FlatFieldErrors` object.\n *\n * @example\n * ```\n * {\n * \"address.street\": {\n * type: \"too_short\",\n * ref: { value: \"123\" },\n * message: \"Required.\" }\n * }\n * }\n * ```\n */\nexport const getFlatFieldErrors = (errors: FieldErrors): FlatFieldErrors => {\n // flatten object for simpler processing\n const flattened = flattenFieldErrors(errors);\n\n // get flattened keys (e.g., `name.message`), which we must transform back to actual paths (e.g., `name`)\n const flattenedKeys = Object.keys(flattened);\n\n // rebuild FlatFieldErrors\n return Object.fromEntries(\n flattenedKeys.reduce<[PropertyKey, FieldError][]>(\n (entriesAccumulator, flattenedKey) => {\n /**\n * Maybe path.\n *\n * Derived from flattened key by removing leaf node suffix (if present).\n *\n * @example\n * path: `address.street.message` -> `address.street`\n * @example\n * not path: `address.street.ref` -> `address.street.ref` (no suffix match to replace)\n */\n const maybePath = flattenedKey.replace(\n regexMaybeFieldErrorLeafNodeSuffix,\n '',\n );\n\n // if nothing replaced, then it's not a leaf node; return early\n if (maybePath === flattenedKey) return entriesAccumulator;\n\n // find field error in original FieldErrors object\n // has dual-purpose of confirming that each path is valid\n const fieldError = get(errors, maybePath, undefined) as\n | FieldError\n | undefined;\n\n // if no field error found, then derived path was wrong; return early\n if (!fieldError) return entriesAccumulator;\n\n /**\n * Add entry to accumulator.\n *\n * (If it's a duplicate (e.g., `.type` leaf node matched before `.message`),\n * it doesn't matter because `Object.fromEntries` will just overwrite\n * first entry with second matching key/value.)\n */\n entriesAccumulator.push([maybePath, fieldError]);\n\n return entriesAccumulator;\n },\n\n [], // entries\n ),\n );\n};\n\n//\n\n/**\n * Regular expression to maybe match the end of a leaf node path.\n *\n * i.e., `name.type`, `address.street.message`\n *\n * iow: dot [?: non-capturing](\"type\" | \"message\")[\\b word boundary][$ end of string]\n */\nexport const regexMaybeFieldErrorLeafNodeSuffix = /\\.(?:type|message)\\b$/;\n\n//\n\nexport type FieldErrorsSansRef<\n TFieldValues extends SafeFieldValues = SafeFieldValues,\n> = Record<\n keyof TFieldValues | 'root',\n Partial<Pick<FieldError, 'message' | 'type'>> & {\n hasRef: boolean;\n }\n>;\n\nexport const getFlatFieldErrorsSansRef = <TFieldValues extends SafeFieldValues>(\n errors: FieldErrors<TFieldValues>,\n) =>\n Object.fromEntries(\n Object.entries(getFlatFieldErrors(errors)).map(([name, error]) => [\n name,\n {\n type: error.type,\n message: error.message,\n hasRef: !!error.ref, // strip out actual ref, etc. (avoid circular JSON error)\n },\n ]),\n ) as FieldErrorsSansRef<TFieldValues>;\n","import React from 'react';\nimport { useFormState } from 'react-hook-form';\n\nimport { getFlatFieldErrorsSansRef } from '@/errors/flat/getFlatFieldErrors';\n\nimport { useRhfUtilsContext } from '@/form/context/utils/useRhfUtilsContext';\n\nimport { useFormRelayContext } from '../context/useFormRelayContext';\nimport type { FormRelayOptions } from '../FormRelayOptions';\nimport type { FormRelayStateSelected } from '../types';\n\nexport const useFormRelaySet = (options?: FormRelayOptions) => {\n if (!options) return;\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [memoOptions] = React.useState(options);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFormRelayOnMount(memoOptions);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFormRelayOnChange(memoOptions);\n};\n\n// HELPERS\n\n// mount\n\nconst useFormRelayOnMount = (options: FormRelayOptions) => {\n const utils = useRhfUtilsContext();\n const relay = useFormRelayContext();\n const formStateForRelay = useFormStateForRelay(options);\n\n React.useEffect(\n () => {\n relay.add(formStateForRelay, utils, options);\n\n // unmount\n return () => {\n relay.remove(utils.formId);\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n};\n\n// update\n\nconst useFormRelayOnChange = (options: FormRelayOptions) => {\n const utils = useRhfUtilsContext();\n const relay = useFormRelayContext();\n const formStateForRelay = useFormStateForRelay(options);\n\n React.useEffect(\n // when form state changes, publish to relay context\n () => {\n relay.update(utils.formId, formStateForRelay);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [formStateForRelay],\n );\n};\n\n// relayed form state\n\n/** Transform, memo-ize {@link useFormState}'s return to {@link FormRelayed} */\nconst useFormStateForRelay = (\n options: FormRelayOptions,\n): FormRelayStateSelected => {\n const formState = useFormState();\n\n const formStateSelected = options.select(formState);\n\n const formStateSelectedJson = JSON.stringify({\n ...formStateSelected,\n errors:\n formStateSelected.errors &&\n getFlatFieldErrorsSansRef(formStateSelected.errors),\n });\n\n const memoFormStateSelected = React.useMemo(\n // when watch JSON changes, update memo\n () => formStateSelected,\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [formStateSelectedJson],\n );\n\n return memoFormStateSelected;\n};\n","import type { FormRelayOptions } from '../FormRelayOptions';\n\nimport { useFormRelaySet } from './useFormRelaySet';\n\ntype Props = {\n options?: FormRelayOptions;\n};\n\nexport const FormRelaySetter: React.FC<Props> = ({ options }) => {\n useFormRelaySet(options);\n\n return null;\n};\n"],"mappings":";;;;;;;;;AAMA,SAAgB,gBAA6B;CAC3C,MAAM,UAAU,MAAM,cAA6B,KAAA,CAAS;CAE5D,MAAM,iBAAiB,MAAM,WAAW,OAAO;CAE/C,MAAM,oBAAoB;EACxB,MAAM,IAAI,SAAS;EAGnB,IAAI,MAAM,KAAA,GAAW,MAAM,IAAI,MAAM;EAErC,OAAO;CACT;CAEA,OAAO;EACL,UAAU,QAAQ;EAClB;EACA;CACF;AACF;;;ACKA,MAAa,EACX,UAAU,2BACV,aAAa,wBACX,cAAgC;;;ACrBpC,MAAa,4BAA6C,EAAE,eAAe;CAGzE,MAAM,CAAC,OAAO,YAAY,MAAM,SAAuB,CAAC,CAAC;CAiDzD,OACE,oBAAC,2BAAD;EACE,OAAO;GAGL,KAlDM,MAAM,aAEd,WACA,OACA,YACG;IACH,IAAI,MAAM,MAAM,SAAS,MAAM,IAAI,MAAM,yBAAyB;IAElE,UAAU,WAAW;KACnB,GAAG;MACF,MAAM,SAAS;MAAE,OAAO;MAAW;MAAO;KAAQ;IACrD,EAAE;GACJ,GAEA,CAAC,KAAK,CAoCA;GACF,QAlCS,MAAM,aAClB,IAAY,UAAkC;IAC7C,UAA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ACzGF,MAAa,mBAAmB,YAA+B;CAC7D,IAAI,CAAC,SAAS;CAGd,MAAM,CAAC,eAAe,MAAM,SAAS,OAAO;CAG5C,oBAAoB,WAAW;CAE/B,qBAAqB,WAAW;AAClC;AAMA,MAAM,uBAAuB,YAA8B;CACzD,MAAM,QAAQ,mBAAmB;CACjC,MAAM,QAAQ,oBAAoB;CAClC,MAAM,oBAAoB,qBAAqB,OAAO;CAEtD,MAAM,gBACE;EACJ,MAAM,IAAI,mBAAmB,OAAO,OAAO;EAG3C,aAAa;GACX,MAAM,OAAO,MAAM,MAAM;EAC3B;CACF,GAEA,CAAC,CACH;AACF;AAIA,MAAM,wBAAwB,YAA8B;CAC1D,MAAM,QAAQ,mBAAmB;CACjC,MAAM,QAAQ,oBAAoB;CAClC,MAAM,oBAAoB,qBAAqB,OAAO;CAEtD,MAAM,gBAEE;EACJ,MAAM,OAAO,MAAM,QAAQ,iBAAiB;CAC9C,GAEA,CAAC,iBAAiB,CACpB;AACF;;AAKA,MAAM,wBACJ,YAC2B;CAC3B,MAAM,YAAY,aAAa;CAE/B,MAAM,oBAAoB,QAAQ,OAAO,SAAS;CAElD,MAAM,wBAAwB,KAAK,UAAU;EAC3C,GAAG;EACH,QACE,kBAAkB,UAClB,0BAA0B,kBAAkB,MAAM;CACtD,CAAC;CAUD,OAR8B,MAAM,cAE5B,mBAGN,CAAC,qBAAqB,CAGG;AAC7B;;;ACjFA,MAAa,mBAAoC,EAAE,cAAc;CAC/D,gBAAgB,OAAO;CAEvB,OAAO;AACT"}
1
+ {"version":3,"file":"FormRelaySetter-Cuh0-4HA.js","names":[],"sources":["../../src/utils/createContext.ts","../../src/form/relay/context/useFormRelayContext.ts","../../src/form/relay/context/FormRelayContextProvider.tsx","../../src/form/context/utils/useRhfUtilsContext.tsx","../../src/utils/isEmptyObject.ts","../../src/errors/flat/flattenFieldErrors.ts","../../src/errors/flat/getFlatFieldErrors.ts","../../src/form/relay/set/useFormRelaySet.ts","../../src/form/relay/set/FormRelaySetter.tsx"],"sourcesContent":["import React from 'react';\n\n/**\n * Create a strictly-typed context that throws error if no provider is found.\n * @returns A tuple with a function to get the context and the context provider.\n */\nexport function createContext<T = unknown>() {\n const context = React.createContext<T | undefined>(undefined);\n\n const useMaybe = () => React.useContext(context);\n\n const useRequired = () => {\n const c = useMaybe();\n\n // type guard\n if (c === undefined) throw new Error();\n\n return c;\n };\n\n return {\n Provider: context.Provider,\n useMaybe,\n useRequired,\n } as const;\n}\n","import type { RhfUtilsContext } from '@/form/context/utils/RhfUtilsContextType';\n\nimport { createContext } from '@/utils/createContext';\n\nimport type { FormRelayOptions } from '../FormRelayOptions';\nimport type { FormRelay, FormRelayStateSelected } from '../types';\n\nexport type FormsRelayed = Record<\n string, // form id\n FormRelay\n>;\n\nexport type FormRelayContext = {\n // set\n\n add: (\n state: FormRelayStateSelected,\n utils: RhfUtilsContext,\n options: FormRelayOptions,\n ) => void;\n\n update: (id: string, state: FormRelayStateSelected) => void;\n\n remove: (id: string) => void;\n\n // state\n\n state: FormsRelayed;\n};\n\nexport const {\n Provider: _FormRelayContextProvider,\n useRequired: useFormRelayContext,\n} = createContext<FormRelayContext>();\n","import React from 'react';\n\nimport type { RhfUtilsContext } from '@/form/context/utils/RhfUtilsContextType';\n\nimport type { FormRelayOptions } from '../FormRelayOptions';\nimport type { FormRelayStateSelected } from '../types';\n\nimport type { FormsRelayed } from './useFormRelayContext';\nimport { _FormRelayContextProvider } from './useFormRelayContext';\n\ntype Props = React.PropsWithChildren;\n\nexport const FormRelayContextProvider: React.FC<Props> = ({ children }) => {\n // state\n\n const [state, setState] = React.useState<FormsRelayed>({});\n\n // set\n\n const add = React.useCallback(\n (\n formState: FormRelayStateSelected,\n utils: RhfUtilsContext,\n options: FormRelayOptions,\n ) => {\n if (state[utils.formId]) throw new Error('Form id already exists.');\n\n setState((forms) => ({\n ...forms,\n [utils.formId]: { state: formState, utils, options },\n }));\n },\n\n [state],\n );\n\n const update = React.useCallback(\n (id: string, state: FormRelayStateSelected) => {\n setState((forms) => {\n const current = forms[id];\n\n if (!current) throw new Error(\"Form id doesn't exist\");\n\n return {\n ...forms,\n [id]: { ...current, state },\n };\n });\n },\n [],\n );\n\n const remove = React.useCallback((id: string) => {\n setState((forms) =>\n Object.fromEntries(\n Object.entries(forms)\n // keep only other ids\n .filter(([entryId]) => entryId !== id),\n ),\n );\n }, []);\n\n //\n\n return (\n <_FormRelayContextProvider\n value={{\n // set\n\n add,\n update,\n remove,\n\n // get\n\n state,\n }}\n >\n {children}\n </_FormRelayContextProvider>\n );\n};\n","import { createContext } from '@/utils/createContext';\n\nimport type { RhfUtilsContext } from './RhfUtilsContextType';\n\nconst {\n Provider: _RhfUtilsContextProvider,\n useRequired: useRhfUtilsContext,\n useMaybe: useRhfUtilsMaybeContext,\n} = createContext<RhfUtilsContext>();\n\nexport {\n _RhfUtilsContextProvider,\n useRhfUtilsContext,\n useRhfUtilsMaybeContext,\n};\n","export const isEmptyObject = (obj: Record<string, unknown>) =>\n Object.keys(obj).length === 0;\n","import { flatten } from 'flat';\nimport type { FieldErrors } from 'react-hook-form';\n\n/**\n * Flatten a {@link FieldErrors} object.\n *\n * @returns e.g.,\n * ```ts\n * {\n * \"address.street.type\": \"too_short\",\n * \"address.street.ref.value\": \"123\",\n * \"address.street.message\": \"Required.\"\n * }\n * ```\n */\nexport const flattenFieldErrors = (errors: FieldErrors) =>\n flatten<FieldErrors, Record<string, unknown>>(errors);\n","import type { FieldError, FieldErrors } from 'react-hook-form';\nimport { get } from 'react-hook-form';\n\nimport type { SafeFieldValues } from '@/form/rhf/SafeFieldValuesType';\n\nimport { flattenFieldErrors } from './flattenFieldErrors';\nimport type { FlatFieldErrors } from './types';\n\n/**\n * Get {@link FlatFieldErrors} from {@link FieldErrors}.\n * This makes it easy to work with potentially deeply-nested {@link FieldErrors}.\n *\n * @param errors {@link FieldErrors} object.\n *\n * @returns `FlatFieldErrors` object.\n *\n * @example\n * ```\n * {\n * \"address.street\": {\n * type: \"too_short\",\n * ref: { value: \"123\" },\n * message: \"Required.\" }\n * }\n * }\n * ```\n */\nexport const getFlatFieldErrors = (errors: FieldErrors): FlatFieldErrors => {\n // flatten object for simpler processing\n const flattened = flattenFieldErrors(errors);\n\n // get flattened keys (e.g., `name.message`), which we must transform back to actual paths (e.g., `name`)\n const flattenedKeys = Object.keys(flattened);\n\n // rebuild FlatFieldErrors\n return Object.fromEntries(\n flattenedKeys.reduce<[PropertyKey, FieldError][]>(\n (entriesAccumulator, flattenedKey) => {\n /**\n * Maybe path.\n *\n * Derived from flattened key by removing leaf node suffix (if present).\n *\n * @example\n * path: `address.street.message` -> `address.street`\n * @example\n * not path: `address.street.ref` -> `address.street.ref` (no suffix match to replace)\n */\n const maybePath = flattenedKey.replace(\n regexMaybeFieldErrorLeafNodeSuffix,\n '',\n );\n\n // if nothing replaced, then it's not a leaf node; return early\n if (maybePath === flattenedKey) return entriesAccumulator;\n\n // find field error in original FieldErrors object\n // has dual-purpose of confirming that each path is valid\n const fieldError = get(errors, maybePath, undefined) as\n | FieldError\n | undefined;\n\n // if no field error found, then derived path was wrong; return early\n if (!fieldError) return entriesAccumulator;\n\n /**\n * Add entry to accumulator.\n *\n * (If it's a duplicate (e.g., `.type` leaf node matched before `.message`),\n * it doesn't matter because `Object.fromEntries` will just overwrite\n * first entry with second matching key/value.)\n */\n entriesAccumulator.push([maybePath, fieldError]);\n\n return entriesAccumulator;\n },\n\n [], // entries\n ),\n );\n};\n\n//\n\n/**\n * Regular expression to maybe match the end of a leaf node path.\n *\n * i.e., `name.type`, `address.street.message`\n *\n * iow: dot [?: non-capturing](\"type\" | \"message\")[\\b word boundary][$ end of string]\n */\nexport const regexMaybeFieldErrorLeafNodeSuffix = /\\.(?:type|message)\\b$/;\n\n//\n\nexport type FieldErrorsSansRef<\n TFieldValues extends SafeFieldValues = SafeFieldValues,\n> = Record<\n keyof TFieldValues | 'root',\n Partial<Pick<FieldError, 'message' | 'type'>> & {\n hasRef: boolean;\n }\n>;\n\nexport const getFlatFieldErrorsSansRef = <TFieldValues extends SafeFieldValues>(\n errors: FieldErrors<TFieldValues>,\n) =>\n Object.fromEntries(\n Object.entries(getFlatFieldErrors(errors)).map(([name, error]) => [\n name,\n {\n type: error.type,\n message: error.message,\n hasRef: !!error.ref, // strip out actual ref, etc. (avoid circular JSON error)\n },\n ]),\n ) as FieldErrorsSansRef<TFieldValues>;\n","import React from 'react';\nimport { useFormState } from 'react-hook-form';\n\nimport { getFlatFieldErrorsSansRef } from '@/errors/flat/getFlatFieldErrors';\n\nimport { useRhfUtilsContext } from '@/form/context/utils/useRhfUtilsContext';\n\nimport { useFormRelayContext } from '../context/useFormRelayContext';\nimport type { FormRelayOptions } from '../FormRelayOptions';\nimport type { FormRelayStateSelected } from '../types';\n\nexport const useFormRelaySet = (options?: FormRelayOptions) => {\n if (!options) return;\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [memoOptions] = React.useState(options);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFormRelayOnMount(memoOptions);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFormRelayOnChange(memoOptions);\n};\n\n// HELPERS\n\n// mount\n\nconst useFormRelayOnMount = (options: FormRelayOptions) => {\n const utils = useRhfUtilsContext();\n const relay = useFormRelayContext();\n const formStateForRelay = useFormStateForRelay(options);\n\n React.useEffect(\n () => {\n relay.add(formStateForRelay, utils, options);\n\n // unmount\n return () => {\n relay.remove(utils.formId);\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n};\n\n// update\n\nconst useFormRelayOnChange = (options: FormRelayOptions) => {\n const utils = useRhfUtilsContext();\n const relay = useFormRelayContext();\n const formStateForRelay = useFormStateForRelay(options);\n\n React.useEffect(\n // when form state changes, publish to relay context\n () => {\n relay.update(utils.formId, formStateForRelay);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [formStateForRelay],\n );\n};\n\n// relayed form state\n\n/** Transform, memo-ize {@link useFormState}'s return to {@link FormRelayed} */\nconst useFormStateForRelay = (\n options: FormRelayOptions,\n): FormRelayStateSelected => {\n const formState = useFormState();\n\n const formStateSelected = options.select(formState);\n\n const formStateSelectedJson = JSON.stringify({\n ...formStateSelected,\n errors:\n formStateSelected.errors &&\n getFlatFieldErrorsSansRef(formStateSelected.errors),\n });\n\n const memoFormStateSelected = React.useMemo(\n // when watch JSON changes, update memo\n () => formStateSelected,\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [formStateSelectedJson],\n );\n\n return memoFormStateSelected;\n};\n","import type { FormRelayOptions } from '../FormRelayOptions';\n\nimport { useFormRelaySet } from './useFormRelaySet';\n\ntype Props = {\n options?: FormRelayOptions;\n};\n\nexport const FormRelaySetter: React.FC<Props> = ({ options }) => {\n useFormRelaySet(options);\n\n return null;\n};\n"],"mappings":";;;;;;;;;AAMA,SAAgB,gBAA6B;CAC3C,MAAM,UAAU,MAAM,cAA6B,KAAA,CAAS;CAE5D,MAAM,iBAAiB,MAAM,WAAW,OAAO;CAE/C,MAAM,oBAAoB;EACxB,MAAM,IAAI,SAAS;EAGnB,IAAI,MAAM,KAAA,GAAW,MAAM,IAAI,MAAM;EAErC,OAAO;CACT;CAEA,OAAO;EACL,UAAU,QAAQ;EAClB;EACA;CACF;AACF;;;ACKA,MAAa,EACX,UAAU,2BACV,aAAa,wBACX,cAAgC;;;ACrBpC,MAAa,4BAA6C,EAAE,eAAe;CAGzE,MAAM,CAAC,OAAO,YAAY,MAAM,SAAuB,CAAC,CAAC;CAiDzD,OACE,oBAAC,2BAAD;EACE,OAAO;GAGL,KAlDM,MAAM,aAEd,WACA,OACA,YACG;IACH,IAAI,MAAM,MAAM,SAAS,MAAM,IAAI,MAAM,yBAAyB;IAElE,UAAU,WAAW;KACnB,GAAG;MACF,MAAM,SAAS;MAAE,OAAO;MAAW;MAAO;KAAQ;IACrD,EAAE;GACJ,GAEA,CAAC,KAAK,CAoCA;GACF,QAlCS,MAAM,aAClB,IAAY,UAAkC;IAC7C,UAAU,UA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CACH;;;ACzGF,MAAa,mBAAmB,YAA+B;CAC7D,IAAI,CAAC,SAAS;CAGd,MAAM,CAAC,eAAe,MAAM,SAAS,OAAO;CAG5C,oBAAoB,WAAW;CAE/B,qBAAqB,WAAW;AAClC;AAMA,MAAM,uBAAuB,YAA8B;CACzD,MAAM,QAAQ,mBAAmB;CACjC,MAAM,QAAQ,oBAAoB;CAClC,MAAM,oBAAoB,qBAAqB,OAAO;CAEtD,MAAM,gBACE;EACJ,MAAM,IAAI,mBAAmB,OAAO,OAAO;EAG3C,aAAa;GACX,MAAM,OAAO,MAAM,MAAM;EAC3B;CACF,GAEA,CAAC,CACH;AACF;AAIA,MAAM,wBAAwB,YAA8B;CAC1D,MAAM,QAAQ,mBAAmB;CACjC,MAAM,QAAQ,oBAAoB;CAClC,MAAM,oBAAoB,qBAAqB,OAAO;CAEtD,MAAM,gBAEE;EACJ,MAAM,OAAO,MAAM,QAAQ,iBAAiB;CAC9C,GAEA,CAAC,iBAAiB,CACpB;AACF;;AAKA,MAAM,wBACJ,YAC2B;CAC3B,MAAM,YAAY,aAAa;CAE/B,MAAM,oBAAoB,QAAQ,OAAO,SAAS;CAElD,MAAM,wBAAwB,KAAK,UAAU;EAC3C,GAAG;EACH,QACE,kBAAkB,UAClB,0BAA0B,kBAAkB,MAAM;CACtD,CAAC;CAUD,OAR8B,MAAM,cAE5B,mBAGN,CAAC,qBAAqB,CAGG;AAC7B;;;ACjFA,MAAa,mBAAoC,EAAE,cAAc;CAC/D,gBAAgB,OAAO;CAEvB,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { a as RhfUtilsFormOptions, i as SafeFieldValues, t as RhfUtilsContext } from "./RhfUtilsContextType-BFmDtONY.js";
1
+ import { i as RhfUtilsFormOptions, r as SafeFieldValues, t as RhfUtilsContext } from "./RhfUtilsContextType-Cqg-0i2U.js";
2
2
  import React$1 from "react";
3
3
  import { ControllerProps, FieldError, FieldPath, UseFormProps, UseFormReturn } from "react-hook-form";
4
4
 
@@ -101,6 +101,34 @@ declare class FormSubmitError<TFieldValues extends SafeFieldValues = SafeFieldVa
101
101
  constructor(errors: FormSubmitFieldErrors<TAllValues>, message?: string);
102
102
  }
103
103
  //#endregion
104
+ //#region src/submit/last/error/LastSubmitErrorType.d.ts
105
+ type LastSubmitError = {
106
+ error: unknown;
107
+ event: React.BaseSyntheticEvent;
108
+ };
109
+ //#endregion
110
+ //#region src/submit/last/status/LastSubmitStatusType.d.ts
111
+ type LastSubmitStatus = null | 'submitting' | 'success' | 'error';
112
+ //#endregion
113
+ //#region src/submit/last/context/LastSubmitContextType.d.ts
114
+ type LastSubmitContext = {
115
+ status: {
116
+ ref: React.RefObject<LastSubmitStatus | null>;
117
+ };
118
+ error: {
119
+ /**
120
+ * Last submit error (with event).
121
+ */
122
+ state: LastSubmitError | undefined;
123
+ set: (error: unknown, event: React.BaseSyntheticEvent) => void;
124
+ reset: () => void;
125
+ };
126
+ };
127
+ type LastSubmitContextRead = {
128
+ status: LastSubmitContext['status']['ref'];
129
+ error: LastSubmitContext['error']['state'];
130
+ };
131
+ //#endregion
104
132
  //#region src/submit/UseRhfUtilsFormOnSubmitContextType.d.ts
105
133
  /**
106
134
  * Props for onSubmit other than `data` and `event`.
@@ -109,6 +137,7 @@ declare class FormSubmitError<TFieldValues extends SafeFieldValues = SafeFieldVa
109
137
  */
110
138
  type UseRhfUtilsFormOnSubmitContext<TFieldValues extends SafeFieldValues = SafeFieldValues, TTransformedValues extends SafeFieldValues = TFieldValues, TApiValues extends undefined | SafeFieldValues = undefined> = {
111
139
  utils: RhfUtilsContext;
140
+ lastSubmit: LastSubmitContextRead;
112
141
  rhf: UseFormReturn<TFieldValues, unknown, TTransformedValues>;
113
142
  FormSubmitError: typeof FormSubmitError<TFieldValues, TApiValues>;
114
143
  };
@@ -117,6 +146,7 @@ type UseRhfUtilsFormOnSubmitContext<TFieldValues extends SafeFieldValues = SafeF
117
146
  */
118
147
  type UseRhfUtilsFormOnSubmitErrorContext<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues> = {
119
148
  utils: RhfUtilsContext;
149
+ lastSubmit: LastSubmitContextRead;
120
150
  rhf: UseFormReturn<TFieldValues, unknown, TTransformedValues>;
121
151
  errors?: FormSubmitFieldErrors;
122
152
  };
@@ -130,15 +160,22 @@ type Merge<A, B, C = unknown, D = unknown> = D & Omit<C, keyof D> & Omit<Omit<B,
130
160
  type _ControllerProps<TFieldValues extends SafeFieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = Omit<ControllerProps<TFieldValues, TName>, 'control'>;
131
161
  declare const _Controller: <TFieldValues extends SafeFieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(props: _ControllerProps<TFieldValues, TName>) => import("react").JSX.Element;
132
162
  //#endregion
133
- //#region src/client/config/RhfUtilsFormInjectorProps.d.ts
163
+ //#region src/client/config/RhfUtilsClientConfigUseFormHooksProps.d.ts
134
164
  /**
135
- * RhfUtilsClientConfig's FormComponent props.
165
+ * RhfUtilsClientConfig's `useFormHooks` props.
136
166
  */
137
- type RhfUtilsFormInjectorProps<TFieldValues extends SafeFieldValues = SafeFieldValues, TTransformedValues extends SafeFieldValues = TFieldValues> = Merge<{
138
- /** Form instance children (`RhfUtilsZodForm.Children`) to output amid globally-injected code. */Outlet: React.FC;
139
- }, RhfUtilsContext, {
167
+ type RhfUtilsClientConfigUseFormHooksProps<TFieldValues extends SafeFieldValues = SafeFieldValues, TTransformedValues extends SafeFieldValues = TFieldValues> = Merge<RhfUtilsContext, {
168
+ lastSubmit: LastSubmitContextRead;
140
169
  rhf: UseFormReturn<TFieldValues, unknown, TTransformedValues>;
141
- Controller: typeof _Controller<TFieldValues>;
170
+ }>;
171
+ //#endregion
172
+ //#region src/client/config/RhfUtilsClientConfigFormOutletProps.d.ts
173
+ /**
174
+ * RhfUtilsClientConfig's FormComponent props.
175
+ */
176
+ type RhfUtilsClientConfigFormOutletProps<TFieldValues extends SafeFieldValues = SafeFieldValues, TTransformedValues extends SafeFieldValues = TFieldValues> = Merge<RhfUtilsClientConfigUseFormHooksProps<TFieldValues, TTransformedValues>, {
177
+ /** Form instance children (`RhfUtilsZodForm.Children`) to output amid globally-injected code. */Outlet: React.FC; /** RHF Controller (SafeFieldValues-typed; no schema at this level). */
178
+ Controller: typeof _Controller<TFieldValues>; /** Error class (SafeFieldValues-typed; no schema at this level). */
142
179
  FormSubmitError: typeof FormSubmitError<TFieldValues>;
143
180
  }>;
144
181
  //#endregion
@@ -160,7 +197,19 @@ type RhfUtilsClientConfig = {
160
197
  */
161
198
  FormComponent?: React.FC<React.PropsWithChildren<React.HTMLAttributes<HTMLFormElement>>>;
162
199
  /**
163
- * Inject your own hooks, components, etc., into every form instance.
200
+ * Inject your own hooks across all form instances.
201
+ *
202
+ * @description
203
+ *
204
+ * (NOTE: context params are not schema-typed as not possible at this level.)
205
+ *
206
+ * @example
207
+ *
208
+ * See README.
209
+ */
210
+ useFormHooks?: (props: RhfUtilsClientConfigUseFormHooksProps) => void;
211
+ /**
212
+ * Inject your components across all form instances.
164
213
  *
165
214
  * @description
166
215
  *
@@ -170,7 +219,7 @@ type RhfUtilsClientConfig = {
170
219
  *
171
220
  * See README.
172
221
  */
173
- FormInjector?: React.FC<RhfUtilsFormInjectorProps>;
222
+ FormOutlet?: React.FC<RhfUtilsClientConfigFormOutletProps>;
174
223
  /**
175
224
  * A hook that returns a callback that determines whether form can be cancelled at event-time.
176
225
  *
@@ -209,5 +258,5 @@ type RhfUtilsClientConfig = {
209
258
  };
210
259
  };
211
260
  //#endregion
212
- export { UseRhfUtilsFormOnSubmitContext as a, FormSubmitFieldErrors as c, MaybePromise as i, RhfUseFormInstanceProps as l, RhfUtilsFormInjectorProps as n, UseRhfUtilsFormOnSubmitErrorContext as o, _Controller as r, FormSubmitError as s, RhfUtilsClientConfig as t, useFlatFieldErrorsContext as u };
213
- //# sourceMappingURL=RhfUtilsClientConfigType-CeOJzNAc.d.ts.map
261
+ export { UseRhfUtilsFormOnSubmitContext as a, LastSubmitStatus as c, FormSubmitFieldErrors as d, RhfUseFormInstanceProps as f, MaybePromise as i, LastSubmitError as l, RhfUtilsClientConfigFormOutletProps as n, UseRhfUtilsFormOnSubmitErrorContext as o, useFlatFieldErrorsContext as p, _Controller as r, LastSubmitContextRead as s, RhfUtilsClientConfig as t, FormSubmitError as u };
262
+ //# sourceMappingURL=RhfUtilsClientConfigType-CCgbRG3a.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RhfUtilsClientConfigType-CCgbRG3a.d.ts","names":[],"sources":["../../src/errors/output/types.ts","../../src/errors/flat/types.ts","../../src/errors/flat/context/useFlatFieldErrorsContext.ts","../../src/errors/flat/context/FlatFieldErrorsOutputConfig.ts","../../src/form/rhf/UseFormPropsType.ts","../../src/form/defaults/UseRhfUtilsFormGlobalDefaults.ts","../../src/submit/error/FormSubmitFieldErrors.ts","../../src/submit/error/FormSubmitError.ts","../../src/submit/last/error/LastSubmitErrorType.ts","../../src/submit/last/status/LastSubmitStatusType.ts","../../src/submit/last/context/LastSubmitContextType.ts","../../src/submit/UseRhfUtilsFormOnSubmitContextType.ts","../../src/utils/types.ts","../../src/form/_Controller.tsx","../../src/client/config/RhfUtilsClientConfigUseFormHooksProps.ts","../../src/client/config/RhfUtilsClientConfigFormOutletProps.ts","../../src/client/config/RhfUtilsClientConfigType.ts"],"mappings":";;;;;;;;KAGY,iCAAA;EACV,IAAA;EACA,OAAO;AAAA;;;;;;;AAFT;;;;AAES;;KCOG,eAAA,GAAkB,MAAM,SAAS,UAAA;;;KCRjC,sBAAA;EACV,GAAA,EAAK,eAAA;EACL,MAAA,EAAQ,eAAA;EACR,KAAA,EAAO,eAAA;EACP,OAAA,EAAS,eAAA;EAET,SAAA;EACA,UAAA;AAAA;AAAA,cAIU,8BAAA,kBAA8B,QAAA,CAAA,sBAAA,eAC3B,yBAAA,QAAyB,sBACG;;;KCb/B,2BAAA;;;AHDZ;;;;AAES;EGOP,OAAA,IACE,OAAA,EA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EfX7C,iGecL,MAAA,EAAQ,KAAA,CAAM,EAAA;EAGd,UAAA,SAAmB,WAAA,CAAY,YAAA,GdVvB;EcYR,eAAA,SAAwB,eAAA,CAAgB,YAAA;AAAA;;;;;AfnBnC;;;KgBYG,oBAAA;EfLA;;;EeSV,QAAA,GAAW,6BAAA;EfT0C;;;;ACRvD;EcwBE,aAAA,GAAgB,KAAA,CAAM,EAAA,CACpB,KAAA,CAAM,iBAAA,CAAkB,KAAA,CAAM,cAAA,CAAe,eAAA;;;;;;;;;;;;EAc/C,YAAA,IAAgB,KAAA,EAAO,qCAAA;EdpChB;;;;;;AAIG;AACV;;;;Ec4CA,UAAA,GAAa,KAAA,CAAM,EAAA,CAAG,mCAAA;EdzCkB;;;AAEC;;;;ACb3C;;;;;;;;EaqEE,qBAAA,UACE,KAAA,EAAO,8BAAA,KACJ,YAAA;Eb9DM;;;;;;;AAUsB;;;EagEjC,oBAAA,IAAwB,KAAA,cAAmB,qBAAA;EZnFjC;;;EYwFV,WAAA;IZvFY;AAad;;IY8EI,MAAA,GAAS,2BAAA;EAAA;AAAA"}
@@ -1,7 +1,24 @@
1
- import React, { RefObject } from "react";
1
+ import React from "react";
2
2
  import { DevtoolUIProps } from "@hookform/devtools/dist/devToolUI";
3
- import { Register } from "@/Register";
4
3
 
4
+ //#region src/Register.d.ts
5
+ /**
6
+ * Use this to extend internal types.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * declare module '@paragrav/rhf-utils' {
11
+ * export interface Register {
12
+ * RhfUtilsFormOptions: {
13
+ * myCustomOption?: boolean;
14
+ * };
15
+ * }
16
+ * }
17
+ * ```
18
+ */
19
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions, @typescript-eslint/no-empty-object-type
20
+ interface Register {}
21
+ //#endregion
5
22
  //#region src/submit/useResetFormOnSubmitted.d.ts
6
23
  /**
7
24
  * Configuration options for {@link useResetFormOnSubmitted}.
@@ -57,9 +74,6 @@ type RhfUtilsFormOptions = {
57
74
  */
58
75
  type SafeFieldValues = Record<string, unknown>;
59
76
  //#endregion
60
- //#region src/form/context/utils/LastSubmitStateType.d.ts
61
- type LastSubmitState = null | 'submitting' | 'success' | 'error';
62
- //#endregion
63
77
  //#region src/form/context/utils/RhfUtilsContextProvider.d.ts
64
78
  type RhfUtilsContextProviderProps = {
65
79
  formId: string;
@@ -68,15 +82,7 @@ type RhfUtilsContextProviderProps = {
68
82
  };
69
83
  //#endregion
70
84
  //#region src/form/context/utils/RhfUtilsContextType.d.ts
71
- type RhfUtilsContext = RhfUtilsContextProviderProps & {
72
- /**
73
- * Current form submit state.
74
- *
75
- * e.g., can be used to determine whether safe to redirect (navigate) without prompter.
76
- * Unlike RHF's `isSubmitSuccessful`, is computed/set immediately after `onSubmit` succeeds/fails.
77
- */
78
- lastSubmitStateRef: RefObject<LastSubmitState>;
79
- };
85
+ type RhfUtilsContext = RhfUtilsContextProviderProps;
80
86
  //#endregion
81
- export { RhfUtilsFormOptions as a, SafeFieldValues as i, RhfUtilsContextProviderProps as n, LastSubmitState as r, RhfUtilsContext as t };
82
- //# sourceMappingURL=RhfUtilsContextType-BFmDtONY.d.ts.map
87
+ export { Register as a, RhfUtilsFormOptions as i, RhfUtilsContextProviderProps as n, SafeFieldValues as r, RhfUtilsContext as t };
88
+ //# sourceMappingURL=RhfUtilsContextType-Cqg-0i2U.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RhfUtilsContextType-Cqg-0i2U.d.ts","names":[],"sources":["../../src/Register.d.ts","../../src/submit/useResetFormOnSubmitted.ts","../../src/submit/useSubmitFormOnWatch.ts","../../src/form/options/RhfUtilsFormOptionsType.ts","../../src/form/rhf/SafeFieldValuesType.ts","../../src/form/context/utils/RhfUtilsContextProvider.tsx","../../src/form/context/utils/RhfUtilsContextType.ts"],"mappings":";;;;;;;;AAeA;;;;AAAyB;;;;ACRzB;;;UDQiB,QAAA;;;;;;KCRL,8BAAA;EDQK;;;;AAAQ;ECGnB,OAAA;IAAY,MAAA;EAAA;EAXN;;;EAgBN,KAAA;IAAU,MAAA;EAAA;AAAA;;;KChBJ,2BAAA;qEAEV,QAAQ;AAAA;;;AFMV;;;;AAAyB;AAAzB,KGHY,mBAAA;0CAIR,qBAAA;EFTQ;;;EEcR,aAAA,GAAgB,2BAAA,EFHd;EEMF,gBAAA,GAAmB,8BAAA;EFDjB;;;AAAgB;;EEQlB,OAAA,aAAoB,IAAA,CAAK,cAAA;AAAA,KAGxB,QAAA;EACC,mBAAA;AAAA,IAGE,oBAAA;;;;;;KCnCI,eAAA,GAAkB,MAAM;;;KCUxB,4BAAA;EACV,MAAA;EACA,OAAA,EAAS,KAAA,CAAM,SAAA,CAAU,eAAA,ULAF;EKGvB,OAAA,EAAS,mBAAA;AAAA;;;KChBC,eAAA,GAAkB,4BAA4B"}
@@ -1,28 +1,10 @@
1
- import { a as UseRhfUtilsFormOnSubmitContext, c as FormSubmitFieldErrors, i as MaybePromise, l as RhfUseFormInstanceProps, n as RhfUtilsFormInjectorProps, o as UseRhfUtilsFormOnSubmitErrorContext, r as _Controller, s as FormSubmitError, t as RhfUtilsClientConfig, u as useFlatFieldErrorsContext } from "./RhfUtilsClientConfigType-CeOJzNAc.js";
2
- import { a as RhfUtilsFormOptions, i as SafeFieldValues, n as RhfUtilsContextProviderProps, r as LastSubmitState, t as RhfUtilsContext } from "./RhfUtilsContextType-BFmDtONY.js";
3
- import { t as FormRelayOptions } from "./FormRelayOptions-mBqiP41Z.js";
1
+ import { a as Register, i as RhfUtilsFormOptions, n as RhfUtilsContextProviderProps, r as SafeFieldValues, t as RhfUtilsContext } from "./RhfUtilsContextType-Cqg-0i2U.js";
2
+ import { a as UseRhfUtilsFormOnSubmitContext, c as LastSubmitStatus, d as FormSubmitFieldErrors, f as RhfUseFormInstanceProps, i as MaybePromise, l as LastSubmitError, n as RhfUtilsClientConfigFormOutletProps, o as UseRhfUtilsFormOnSubmitErrorContext, p as useFlatFieldErrorsContext, r as _Controller, s as LastSubmitContextRead, t as RhfUtilsClientConfig, u as FormSubmitError } from "./RhfUtilsClientConfigType-CCgbRG3a.js";
3
+ import { t as FormRelayOptions } from "./FormRelayOptions-BtNZLz8X.js";
4
4
  import React$1 from "react";
5
5
  import { Resolver, SubmitErrorHandler, UseFormProps, UseFormReturn } from "react-hook-form";
6
6
  import { z } from "zod";
7
7
 
8
- //#region src/Register.d.ts
9
- /**
10
- * Use this to extend internal types.
11
- *
12
- * @example
13
- * ```ts
14
- * declare module '@paragrav/rhf-utils' {
15
- * export interface Register {
16
- * RhfUtilsFormOptions: {
17
- * myCustomOption?: boolean;
18
- * };
19
- * }
20
- * }
21
- * ```
22
- */
23
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions, @typescript-eslint/no-empty-object-type
24
- interface Register {}
25
- //#endregion
26
8
  //#region src/client/config/context/RhfUtilsClientConfigProvider.d.ts
27
9
  type Props$4 = React$1.PropsWithChildren<{
28
10
  config?: RhfUtilsClientConfig;
@@ -51,9 +33,7 @@ type Props$3 = {
51
33
  declare const RhfUtilsNonFieldErrorMarker: React.FC<Props$3>;
52
34
  //#endregion
53
35
  //#region src/form/context/utils/useRhfUtilsContext.d.ts
54
- declare const _RhfUtilsContextProvider: import("react").Provider<RhfUtilsContext | undefined>, useRhfUtilsContext: () => RhfUtilsContextProviderProps & {
55
- lastSubmitStateRef: import("react").RefObject<LastSubmitState>;
56
- }, useRhfUtilsMaybeContext: () => RhfUtilsContext | undefined;
36
+ declare const _RhfUtilsContextProvider: import("react").Provider<RhfUtilsContextProviderProps | undefined>, useRhfUtilsContext: () => RhfUtilsContextProviderProps, useRhfUtilsMaybeContext: () => RhfUtilsContextProviderProps | undefined;
57
37
  //#endregion
58
38
  //#region src/form/RHF_UseFormReturnWithoutProxiesType.d.ts
59
39
  /**
@@ -100,11 +80,10 @@ type UseRhfUtilsFormChildrenProps<TFieldValues extends SafeFieldValues, TTransfo
100
80
  */
101
81
  declare const useFormRequestSubmit: (ref: React$1.RefObject<HTMLFormElement | null>) => HTMLFormElement["requestSubmit"];
102
82
  //#endregion
103
- //#region src/submit/last-error/useLastSubmitError.d.ts
104
- declare const useLastSubmitError: () => {
105
- error: unknown;
106
- event: React.BaseSyntheticEvent;
107
- } | undefined;
83
+ //#region src/submit/last/context/useLastSubmitContext.d.ts
84
+ declare const useLastSubmit: () => LastSubmitContextRead;
85
+ declare const useLastSubmitStatus: () => import("react").RefObject<LastSubmitStatus>;
86
+ declare const useLastSubmitError: () => LastSubmitError | undefined;
108
87
  //#endregion
109
88
  //#region src/form/defaults/form/UseRhfUtilsFormInstanceFormProps.d.ts
110
89
  type DataAttributes = Record<`data-${string}`, string>;
@@ -221,5 +200,5 @@ type RhfUtilsUseZodFormChildrenFC<TSchema extends ZodTypeSafeFieldValues, TChild
221
200
  */
222
201
 
223
202
  //#endregion
224
- export { FormSubmitError, type FormSubmitFieldErrors, type Register, type RhfUtilsClientConfig, RhfUtilsClientConfigProvider, type RhfUtilsFormInjectorProps, type RhfUtilsFormOptions, RhfUtilsNonFieldErrorMarker, type RhfUtilsUseZodFormChildrenFC, type RhfUtilsUseZodFormChildrenProps, RhfUtilsZodForm, RhfUtilsZodFormProviders, RhfUtilsZodFormWithProviders, type SafeFieldValues, type RHF_UseFormReturnWithoutProxies as UseFormReturnWithoutProxies, type UseRhfUtilsFormChildrenProps, type UseRhfUtilsFormOnSubmitContext, type UseRhfUtilsFormOnSubmitErrorContext, type ZodTypeSafeFieldValues, useFlatFieldErrorsContext, useFlatFieldErrorsContextHasOnlyOrphans, useFormRequestSubmit, useLastSubmitError, useRhfUtilsContext };
203
+ export { FormSubmitError, type FormSubmitFieldErrors, type Register, type RhfUtilsClientConfig, type RhfUtilsClientConfigFormOutletProps, RhfUtilsClientConfigProvider, type RhfUtilsFormOptions, RhfUtilsNonFieldErrorMarker, type RhfUtilsUseZodFormChildrenFC, type RhfUtilsUseZodFormChildrenProps, RhfUtilsZodForm, RhfUtilsZodFormProviders, RhfUtilsZodFormWithProviders, type SafeFieldValues, type RHF_UseFormReturnWithoutProxies as UseFormReturnWithoutProxies, type UseRhfUtilsFormChildrenProps, type UseRhfUtilsFormOnSubmitContext, type UseRhfUtilsFormOnSubmitErrorContext, type ZodTypeSafeFieldValues, useFlatFieldErrorsContext, useFlatFieldErrorsContextHasOnlyOrphans, useFormRequestSubmit, useLastSubmit, useLastSubmitError, useLastSubmitStatus, useRhfUtilsContext };
225
204
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/Register.d.ts","../../src/client/config/context/RhfUtilsClientConfigProvider.tsx","../../src/errors/flat/context/useFlatFieldErrorsContextHasOnlyOrphans.ts","../../src/errors/nonfield/RhfUtilsNonFieldErrorMarker.tsx","../../src/form/context/utils/useRhfUtilsContext.tsx","../../src/form/RHF_UseFormReturnWithoutProxiesType.ts","../../src/form/UseRhfUtilsFormChildrenPropsType.ts","../../src/form/utils/useFormRequestSubmit.ts","../../src/submit/last-error/useLastSubmitError.ts","../../src/form/defaults/form/UseRhfUtilsFormInstanceFormProps.ts","../../src/form/with-handlers-and-children/RhfUtilsFormPropsOnBeforeSubmitInvariants.ts","../../src/form/with-handlers-and-children/RhfUtilsFormProps.ts","../../src/resolvers/zod/consts.ts","../../src/resolvers/zod/ZodTypeSafeFieldValuesType.ts","../../src/resolvers/zod/form/RhfUtilsZodForm.tsx","../../src/form/providers/RhfUtilsFormProvidersPropsType.ts","../../src/resolvers/zod/providers/RhfUtilsZodFormProviders.tsx","../../src/resolvers/zod/with-providers/RhfUtilsZodFormWithProviders.tsx","../../src/resolvers/zod/RhfUtilsUseZodFormChildrenPropsType.ts","../../src/resolvers/zod/RhfUtilsUseZodFormChildrenFCType.ts","../../src/_exports/index.ts"],"mappings":";;;;;;;;;;;;;;;;AAeA;;;;AAAyB;;;UAAR,QAAA;;;KCPZ,OAAA,GAAQ,OAAA,CAAM,iBAAiB;EAClC,MAAA,GAAS,oBAAA;AAAA;AAAA,cAGE,4BAAA,EAA8B,OA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ACf,cAAA;;;;;;KCHU,4BAAA,iBACM,sBAAA,gCAEd,OAAA,CAAM,EAAA,CAAG,+BAAA,CAAgC,OAAA,EAAS,cAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/config/context/RhfUtilsClientConfigProvider.tsx","../../src/errors/flat/context/useFlatFieldErrorsContextHasOnlyOrphans.ts","../../src/errors/nonfield/RhfUtilsNonFieldErrorMarker.tsx","../../src/form/context/utils/useRhfUtilsContext.tsx","../../src/form/RHF_UseFormReturnWithoutProxiesType.ts","../../src/form/UseRhfUtilsFormChildrenPropsType.ts","../../src/form/utils/useFormRequestSubmit.ts","../../src/submit/last/context/useLastSubmitContext.ts","../../src/form/defaults/form/UseRhfUtilsFormInstanceFormProps.ts","../../src/form/with-handlers-and-children/RhfUtilsFormPropsOnBeforeSubmitInvariants.ts","../../src/form/with-handlers-and-children/RhfUtilsFormProps.ts","../../src/resolvers/zod/consts.ts","../../src/resolvers/zod/ZodTypeSafeFieldValuesType.ts","../../src/resolvers/zod/form/RhfUtilsZodForm.tsx","../../src/form/providers/RhfUtilsFormProvidersPropsType.ts","../../src/resolvers/zod/providers/RhfUtilsZodFormProviders.tsx","../../src/resolvers/zod/with-providers/RhfUtilsZodFormWithProviders.tsx","../../src/resolvers/zod/RhfUtilsUseZodFormChildrenPropsType.ts","../../src/resolvers/zod/RhfUtilsUseZodFormChildrenFCType.ts","../../src/_exports/index.ts"],"mappings":";;;;;;;;KAQK,OAAA,GAAQ,OAAA,CAAM,iBAAiB;EAClC,MAAA,GAAS,oBAAA;AAAA;AAAA,cAGE,4BAAA,EAA8B,OAAA,CAAM,EAAE,CAAC,OAAA;;;;;;;;cCHvC,uCAAA;;;KCPR,OAAA;kDAEH,IAAI;AAAA;;;;;AFAkE;;;cEU3D,2BAAA,EAA6B,KAAA,CAAM,EAAE,CAAC,OAAA;;;cCTvC,wBAAA,kBAAwB,QAAA,CAAA,4BAAA,eACrB,kBAAA,QADqB,4BAAA,EAExB,uB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