remix-validated-form 5.0.2 → 5.1.1-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/.turbo/turbo-build.log +152 -8
  2. package/dist/index.cjs.js +898 -63
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.d.ts +7 -2
  5. package/dist/index.esm.js +876 -15
  6. package/dist/index.esm.js.map +1 -1
  7. package/package.json +4 -4
  8. package/src/ValidatedForm.tsx +0 -427
  9. package/src/hooks.ts +0 -160
  10. package/src/index.ts +0 -12
  11. package/src/internal/MultiValueMap.ts +0 -44
  12. package/src/internal/constants.ts +0 -4
  13. package/src/internal/flatten.ts +0 -12
  14. package/src/internal/formContext.ts +0 -13
  15. package/src/internal/getInputProps.test.ts +0 -251
  16. package/src/internal/getInputProps.ts +0 -94
  17. package/src/internal/hooks.ts +0 -217
  18. package/src/internal/hydratable.ts +0 -28
  19. package/src/internal/logic/getCheckboxChecked.ts +0 -10
  20. package/src/internal/logic/getRadioChecked.ts +0 -18
  21. package/src/internal/logic/nestedObjectToPathObject.ts +0 -63
  22. package/src/internal/logic/requestSubmit.test.tsx +0 -24
  23. package/src/internal/logic/requestSubmit.ts +0 -103
  24. package/src/internal/state/arrayUtil.ts +0 -451
  25. package/src/internal/state/controlledFields.ts +0 -86
  26. package/src/internal/state/createFormStore.ts +0 -591
  27. package/src/internal/state/fieldArray.tsx +0 -197
  28. package/src/internal/state/storeHooks.ts +0 -9
  29. package/src/internal/state/types.ts +0 -1
  30. package/src/internal/submissionCallbacks.ts +0 -15
  31. package/src/internal/util.ts +0 -39
  32. package/src/server.ts +0 -53
  33. package/src/unreleased/formStateHooks.ts +0 -170
  34. package/src/userFacingFormContext.ts +0 -147
  35. package/src/validation/createValidator.ts +0 -53
  36. package/src/validation/types.ts +0 -72
  37. package/tsconfig.json +0 -8
package/dist/index.d.ts CHANGED
@@ -172,6 +172,9 @@ type FormDefaults = {
172
172
  type internal_FORM_DEFAULTS_FIELD = typeof FORM_DEFAULTS_FIELD;
173
173
  declare const setFormDefaults: <DataType = any>(formId: string, defaultValues: Partial<DataType>) => FormDefaults;
174
174
 
175
+ type DeepPartial<T> = T extends object ? {
176
+ [P in keyof T]?: DeepPartial<T[P]>;
177
+ } : T;
175
178
  type SubactionData<DataType, Subaction extends string | undefined> = DataType & {
176
179
  subaction: Subaction;
177
180
  };
@@ -196,7 +199,7 @@ type FormProps<DataType, Subaction extends string | undefined> = {
196
199
  * Accepts an object of default values for the form
197
200
  * that will automatically be propagated to the form fields via `useField`.
198
201
  */
199
- defaultValues?: Partial<DataForSubaction<DataType, Subaction>>;
202
+ defaultValues?: DeepPartial<DataForSubaction<DataType, Subaction>>;
200
203
  /**
201
204
  * A ref to the form element.
202
205
  */
@@ -222,7 +225,9 @@ type FormProps<DataType, Subaction extends string | undefined> = {
222
225
  /**
223
226
  * The primary form component of `remix-validated-form`.
224
227
  */
225
- declare function ValidatedForm<DataType, Subaction extends string | undefined>({ validator, onSubmit, children, fetcher, action, defaultValues: unMemoizedDefaults, formRef: formRefProp, onReset, subaction, resetAfterSubmit, disableFocusOnError, method, replace, id, preventScrollReset, relative, encType, ...rest }: FormProps<DataType, Subaction>): JSX.Element;
228
+ declare function ValidatedForm<DataType extends {
229
+ [fieldName: string]: any;
230
+ }, Subaction extends string | undefined>({ validator, onSubmit, children, fetcher, action, defaultValues: unMemoizedDefaults, formRef: formRefProp, onReset, subaction, resetAfterSubmit, disableFocusOnError, method, replace, id, preventScrollReset, relative, encType, ...rest }: FormProps<DataType, Subaction>): JSX.Element;
226
231
 
227
232
  /**
228
233
  * Used to create a validator for a form.