remix-validated-form 5.0.0 → 5.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +7 -7
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/ValidatedForm.tsx +4 -4
- package/src/internal/hooks.ts +1 -1
- 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
|
*/
|
package/dist/index.esm.js
CHANGED
@@ -1147,7 +1147,7 @@ var useHasActiveFormSubmit = ({
|
|
1147
1147
|
fetcher
|
1148
1148
|
}) => {
|
1149
1149
|
let navigation = useNavigation();
|
1150
|
-
const hasActiveSubmission = fetcher ? fetcher.state === "submitting" : navigation.state === "submitting";
|
1150
|
+
const hasActiveSubmission = fetcher ? fetcher.state === "submitting" : navigation.state === "submitting" || navigation.state === "loading";
|
1151
1151
|
return hasActiveSubmission;
|
1152
1152
|
};
|
1153
1153
|
var useFieldTouched = (field, { formId }) => {
|