remix-validated-form 5.0.2 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
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.