remix-validated-form 5.0.0 → 5.0.1
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/.turbo/turbo-build.log +6 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/ValidatedForm.tsx +4 -4
- package/tsconfig.json +1 -1
- package/src/validation/validation.test.ts +0 -330
package/dist/index.d.ts
CHANGED
@@ -175,7 +175,7 @@ declare const setFormDefaults: <DataType = any>(formId: string, defaultValues: P
|
|
175
175
|
type SubactionData<DataType, Subaction extends string | undefined> = DataType & {
|
176
176
|
subaction: Subaction;
|
177
177
|
};
|
178
|
-
type
|
178
|
+
type DataForSubaction<DataType, Subaction extends string | undefined> = Subaction extends string ? SubactionData<DataType, Subaction> extends undefined ? DataType : SubactionData<DataType, Subaction> : DataType;
|
179
179
|
type FormProps<DataType, Subaction extends string | undefined> = {
|
180
180
|
/**
|
181
181
|
* A `Validator` object that describes how to validate the form.
|
@@ -185,7 +185,7 @@ type FormProps<DataType, Subaction extends string | undefined> = {
|
|
185
185
|
* A submit callback that gets called when the form is submitted
|
186
186
|
* after all validations have been run.
|
187
187
|
*/
|
188
|
-
onSubmit?: (data: DataType, event: React.FormEvent<HTMLFormElement>) => void | Promise<void>;
|
188
|
+
onSubmit?: (data: DataForSubaction<DataType, Subaction>, event: React.FormEvent<HTMLFormElement>) => void | Promise<void>;
|
189
189
|
/**
|
190
190
|
* Allows you to provide a `fetcher` from Remix's `useFetcher` hook.
|
191
191
|
* The form will use the fetcher for loading states, action data, etc
|
@@ -196,7 +196,7 @@ type FormProps<DataType, Subaction extends string | undefined> = {
|
|
196
196
|
* Accepts an object of default values for the form
|
197
197
|
* that will automatically be propagated to the form fields via `useField`.
|
198
198
|
*/
|
199
|
-
defaultValues?: Partial<
|
199
|
+
defaultValues?: Partial<DataForSubaction<DataType, Subaction>>;
|
200
200
|
/**
|
201
201
|
* A ref to the form element.
|
202
202
|
*/
|