remix-validated-form 4.6.10 → 4.6.12
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +27 -30
- package/dist/index.cjs.js +3 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +3 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/internal/getInputProps.ts +5 -5
- package/src/internal/hooks.ts +4 -1
package/package.json
CHANGED
@@ -25,12 +25,12 @@ type HandledProps = "name" | "defaultValue" | "defaultChecked";
|
|
25
25
|
type Callbacks = "onChange" | "onBlur";
|
26
26
|
|
27
27
|
type MinimalInputProps = {
|
28
|
-
onChange?: (...args: any[]) => void;
|
29
|
-
onBlur?: (...args: any[]) => void;
|
28
|
+
onChange?: ((...args: any[]) => void) | undefined;
|
29
|
+
onBlur?: ((...args: any[]) => void) | undefined;
|
30
30
|
defaultValue?: any;
|
31
|
-
defaultChecked?: boolean;
|
32
|
-
name?: string;
|
33
|
-
type?: string;
|
31
|
+
defaultChecked?: boolean | undefined;
|
32
|
+
name?: string | undefined;
|
33
|
+
type?: string | undefined;
|
34
34
|
};
|
35
35
|
|
36
36
|
export type GetInputProps = <T extends MinimalInputProps>(
|
package/src/internal/hooks.ts
CHANGED
@@ -67,7 +67,10 @@ export const useDefaultValuesFromLoader = ({
|
|
67
67
|
// we should use the data from the deepest route.
|
68
68
|
const match = matches
|
69
69
|
.reverse()
|
70
|
-
.find(
|
70
|
+
.find(
|
71
|
+
(match) =>
|
72
|
+
match.data && typeof match.data === "object" && dataKey in match.data
|
73
|
+
);
|
71
74
|
return match?.data[dataKey];
|
72
75
|
}
|
73
76
|
|