remix-validated-form 3.3.0 → 3.3.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 +2 -2
- package/README.md +2 -2
- package/browser/internal/getInputProps.d.ts +5 -3
- package/browser/internal/test.d.ts +0 -0
- package/browser/internal/test.js +0 -0
- package/browser/internal/useMultiValueMap.d.ts +1 -0
- package/browser/internal/useMultiValueMap.js +11 -0
- package/build/internal/MultiValueMap.d.ts +0 -0
- package/build/internal/MultiValueMap.js +0 -0
- package/build/internal/getInputProps.d.ts +5 -3
- package/build/internal/test.d.ts +0 -0
- package/build/internal/test.js +0 -0
- package/package.json +1 -1
- package/src/internal/getInputProps.ts +4 -3
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.
|
3
|
+
> remix-validated-form@3.3.0 build:browser
|
4
4
|
> tsc --module ESNext --outDir ./browser
|
5
5
|
|
6
6
|
|
7
|
-
> remix-validated-form@3.
|
7
|
+
> remix-validated-form@3.3.0 build:main
|
8
8
|
> tsc --module CommonJS --outDir ./build
|
9
9
|
|
package/README.md
CHANGED
@@ -63,7 +63,7 @@ type MyInputProps = {
|
|
63
63
|
label: string;
|
64
64
|
};
|
65
65
|
|
66
|
-
export const MyInput = ({ name, label }:
|
66
|
+
export const MyInput = ({ name, label }: MyInputProps) => {
|
67
67
|
const { error, getInputProps } = useField(name);
|
68
68
|
return (
|
69
69
|
<div>
|
@@ -257,4 +257,4 @@ See the [Remix](https://remix.run/docs/en/v1/api/remix#sessionflashkey-value) do
|
|
257
257
|
|
258
258
|
## Why is my cancel button triggering form submission?
|
259
259
|
Problem: the cancel button has an onClick handler to navigate away from the form route but instead it is submitting the form.
|
260
|
-
A button defaults to `type="submit"` in a form which will submit the form by default. If you want to prevent this you can add `type="reset"` or `type="button"` to the cancel button.
|
260
|
+
A button defaults to `type="submit"` in a form which will submit the form by default. If you want to prevent this you can add `type="reset"` or `type="button"` to the cancel button.
|
@@ -14,8 +14,10 @@ export declare type CreateGetInputPropsOptions = {
|
|
14
14
|
validationBehavior?: Partial<ValidationBehaviorOptions>;
|
15
15
|
name: string;
|
16
16
|
};
|
17
|
-
declare type
|
18
|
-
|
19
|
-
|
17
|
+
declare type OmitHandledProps = {
|
18
|
+
name?: never;
|
19
|
+
defaultValue?: never;
|
20
|
+
};
|
21
|
+
export declare type GetInputProps = <T extends Record<string, any>>(props?: T & OmitHandledProps) => T;
|
20
22
|
export declare const createGetInputProps: ({ clearError, validate, defaultValue, touched, setTouched, hasBeenSubmitted, validationBehavior, name, }: CreateGetInputPropsOptions) => GetInputProps;
|
21
23
|
export {};
|
File without changes
|
package/browser/internal/test.js
CHANGED
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const useMultiValueMap: <Key, Value>() => () => any;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { MultiValueMap } from "multi-value-map";
|
2
|
+
import { useRef } from "react";
|
3
|
+
export const useMultiValueMap = () => {
|
4
|
+
const ref = useRef(null);
|
5
|
+
return () => {
|
6
|
+
if (ref.current)
|
7
|
+
return ref.current;
|
8
|
+
ref.current = new MultiValueMap();
|
9
|
+
return ref.current;
|
10
|
+
};
|
11
|
+
};
|
File without changes
|
File without changes
|
@@ -14,8 +14,10 @@ export declare type CreateGetInputPropsOptions = {
|
|
14
14
|
validationBehavior?: Partial<ValidationBehaviorOptions>;
|
15
15
|
name: string;
|
16
16
|
};
|
17
|
-
declare type
|
18
|
-
|
19
|
-
|
17
|
+
declare type OmitHandledProps = {
|
18
|
+
name?: never;
|
19
|
+
defaultValue?: never;
|
20
|
+
};
|
21
|
+
export declare type GetInputProps = <T extends Record<string, any>>(props?: T & OmitHandledProps) => T;
|
20
22
|
export declare const createGetInputProps: ({ clearError, validate, defaultValue, touched, setTouched, hasBeenSubmitted, validationBehavior, name, }: CreateGetInputPropsOptions) => GetInputProps;
|
21
23
|
export {};
|
package/build/internal/test.d.ts
CHANGED
File without changes
|
package/build/internal/test.js
CHANGED
File without changes
|
package/package.json
CHANGED
@@ -17,11 +17,12 @@ export type CreateGetInputPropsOptions = {
|
|
17
17
|
name: string;
|
18
18
|
};
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
// Using Omit<T, HandledProps> breaks type inference sometimes for some reason.
|
21
|
+
// Doing T & OmitHandledProps gives us the same behavior without breaking type inference.
|
22
|
+
type OmitHandledProps = { name?: never; defaultValue?: never };
|
22
23
|
|
23
24
|
export type GetInputProps = <T extends Record<string, any>>(
|
24
|
-
props?:
|
25
|
+
props?: T & OmitHandledProps
|
25
26
|
) => T;
|
26
27
|
|
27
28
|
const defaultValidationBehavior: ValidationBehaviorOptions = {
|