remix-validated-form 4.0.0 → 4.0.1-beta.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
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
[2K[1G[2m$ npm run build:browser && npm run build:main[22m
|
2
2
|
|
3
|
-
> remix-validated-form@
|
3
|
+
> remix-validated-form@4.0.0 build:browser
|
4
4
|
> tsc --module ESNext --outDir ./browser
|
5
5
|
|
6
6
|
|
7
|
-
> remix-validated-form@
|
7
|
+
> remix-validated-form@4.0.0 build:main
|
8
8
|
> tsc --module CommonJS --outDir ./build
|
9
9
|
|
@@ -47,4 +47,4 @@ export declare type FormProps<DataType> = {
|
|
47
47
|
/**
|
48
48
|
* The primary form component of `remix-validated-form`.
|
49
49
|
*/
|
50
|
-
export declare function ValidatedForm<DataType>({ validator, onSubmit, children, fetcher, action, defaultValues, formRef: formRefProp, onReset, subaction, resetAfterSubmit, disableFocusOnError, ...rest }: FormProps<DataType>): JSX.Element;
|
50
|
+
export declare function ValidatedForm<DataType>({ validator, onSubmit, children, fetcher, action, defaultValues, formRef: formRefProp, onReset, subaction, resetAfterSubmit, disableFocusOnError, method, replace, ...rest }: FormProps<DataType>): JSX.Element;
|
package/browser/ValidatedForm.js
CHANGED
@@ -110,7 +110,7 @@ const focusFirstInvalidInput = (fieldErrors, customFocusHandlers, formElement) =
|
|
110
110
|
/**
|
111
111
|
* The primary form component of `remix-validated-form`.
|
112
112
|
*/
|
113
|
-
export function ValidatedForm({ validator, onSubmit, children, fetcher, action, defaultValues, formRef: formRefProp, onReset, subaction, resetAfterSubmit, disableFocusOnError, ...rest }) {
|
113
|
+
export function ValidatedForm({ validator, onSubmit, children, fetcher, action, defaultValues, formRef: formRefProp, onReset, subaction, resetAfterSubmit, disableFocusOnError, method, replace, ...rest }) {
|
114
114
|
var _a;
|
115
115
|
const backendError = useErrorResponseForThisForm(fetcher, subaction);
|
116
116
|
const [fieldErrors, setFieldErrors] = useFieldErrors(backendError === null || backendError === void 0 ? void 0 : backendError.fieldErrors);
|
@@ -208,7 +208,7 @@ export function ValidatedForm({ validator, onSubmit, children, fetcher, action,
|
|
208
208
|
window.removeEventListener("click", handleClick);
|
209
209
|
};
|
210
210
|
}, []);
|
211
|
-
return (_jsx(Form, { ref: mergeRefs([formRef, formRefProp]), ...rest, action: action, onSubmit: async (e) => {
|
211
|
+
return (_jsx(Form, { ref: mergeRefs([formRef, formRefProp]), ...rest, action: action, method: method, replace: replace, onSubmit: async (e) => {
|
212
212
|
e.preventDefault();
|
213
213
|
setHasBeenSubmitted(true);
|
214
214
|
setIsValidating(true);
|
@@ -225,7 +225,10 @@ export function ValidatedForm({ validator, onSubmit, children, fetcher, action,
|
|
225
225
|
if (fetcher)
|
226
226
|
fetcher.submit(clickedButtonRef.current || e.currentTarget);
|
227
227
|
else
|
228
|
-
submit(clickedButtonRef.current || e.currentTarget
|
228
|
+
submit(clickedButtonRef.current || e.currentTarget, {
|
229
|
+
method,
|
230
|
+
replace,
|
231
|
+
});
|
229
232
|
clickedButtonRef.current = null;
|
230
233
|
}
|
231
234
|
}, onReset: (event) => {
|
package/build/ValidatedForm.d.ts
CHANGED
@@ -47,4 +47,4 @@ export declare type FormProps<DataType> = {
|
|
47
47
|
/**
|
48
48
|
* The primary form component of `remix-validated-form`.
|
49
49
|
*/
|
50
|
-
export declare function ValidatedForm<DataType>({ validator, onSubmit, children, fetcher, action, defaultValues, formRef: formRefProp, onReset, subaction, resetAfterSubmit, disableFocusOnError, ...rest }: FormProps<DataType>): JSX.Element;
|
50
|
+
export declare function ValidatedForm<DataType>({ validator, onSubmit, children, fetcher, action, defaultValues, formRef: formRefProp, onReset, subaction, resetAfterSubmit, disableFocusOnError, method, replace, ...rest }: FormProps<DataType>): JSX.Element;
|
package/build/ValidatedForm.js
CHANGED
@@ -135,7 +135,7 @@ const focusFirstInvalidInput = (fieldErrors, customFocusHandlers, formElement) =
|
|
135
135
|
/**
|
136
136
|
* The primary form component of `remix-validated-form`.
|
137
137
|
*/
|
138
|
-
function ValidatedForm({ validator, onSubmit, children, fetcher, action, defaultValues, formRef: formRefProp, onReset, subaction, resetAfterSubmit, disableFocusOnError, ...rest }) {
|
138
|
+
function ValidatedForm({ validator, onSubmit, children, fetcher, action, defaultValues, formRef: formRefProp, onReset, subaction, resetAfterSubmit, disableFocusOnError, method, replace, ...rest }) {
|
139
139
|
var _a;
|
140
140
|
const backendError = useErrorResponseForThisForm(fetcher, subaction);
|
141
141
|
const [fieldErrors, setFieldErrors] = useFieldErrors(backendError === null || backendError === void 0 ? void 0 : backendError.fieldErrors);
|
@@ -233,7 +233,7 @@ function ValidatedForm({ validator, onSubmit, children, fetcher, action, default
|
|
233
233
|
window.removeEventListener("click", handleClick);
|
234
234
|
};
|
235
235
|
}, []);
|
236
|
-
return ((0, jsx_runtime_1.jsx)(Form, { ref: (0, util_1.mergeRefs)([formRef, formRefProp]), ...rest, action: action, onSubmit: async (e) => {
|
236
|
+
return ((0, jsx_runtime_1.jsx)(Form, { ref: (0, util_1.mergeRefs)([formRef, formRefProp]), ...rest, action: action, method: method, replace: replace, onSubmit: async (e) => {
|
237
237
|
e.preventDefault();
|
238
238
|
setHasBeenSubmitted(true);
|
239
239
|
setIsValidating(true);
|
@@ -250,7 +250,10 @@ function ValidatedForm({ validator, onSubmit, children, fetcher, action, default
|
|
250
250
|
if (fetcher)
|
251
251
|
fetcher.submit(clickedButtonRef.current || e.currentTarget);
|
252
252
|
else
|
253
|
-
submit(clickedButtonRef.current || e.currentTarget
|
253
|
+
submit(clickedButtonRef.current || e.currentTarget, {
|
254
|
+
method,
|
255
|
+
replace,
|
256
|
+
});
|
254
257
|
clickedButtonRef.current = null;
|
255
258
|
}
|
256
259
|
}, onReset: (event) => {
|
package/package.json
CHANGED
package/src/ValidatedForm.tsx
CHANGED
@@ -218,6 +218,8 @@ export function ValidatedForm<DataType>({
|
|
218
218
|
subaction,
|
219
219
|
resetAfterSubmit,
|
220
220
|
disableFocusOnError,
|
221
|
+
method,
|
222
|
+
replace,
|
221
223
|
...rest
|
222
224
|
}: FormProps<DataType>) {
|
223
225
|
const backendError = useErrorResponseForThisForm(fetcher, subaction);
|
@@ -339,6 +341,8 @@ export function ValidatedForm<DataType>({
|
|
339
341
|
ref={mergeRefs([formRef, formRefProp])}
|
340
342
|
{...rest}
|
341
343
|
action={action}
|
344
|
+
method={method}
|
345
|
+
replace={replace}
|
342
346
|
onSubmit={async (e) => {
|
343
347
|
e.preventDefault();
|
344
348
|
setHasBeenSubmitted(true);
|
@@ -360,7 +364,11 @@ export function ValidatedForm<DataType>({
|
|
360
364
|
onSubmit && onSubmit(result.data, e);
|
361
365
|
if (fetcher)
|
362
366
|
fetcher.submit(clickedButtonRef.current || e.currentTarget);
|
363
|
-
else
|
367
|
+
else
|
368
|
+
submit(clickedButtonRef.current || e.currentTarget, {
|
369
|
+
method,
|
370
|
+
replace,
|
371
|
+
});
|
364
372
|
clickedButtonRef.current = null;
|
365
373
|
}
|
366
374
|
}}
|