remix-validated-form 5.0.2 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/ValidatedForm.tsx +0 -427
- package/src/hooks.ts +0 -160
- package/src/index.ts +0 -12
- package/src/internal/MultiValueMap.ts +0 -44
- package/src/internal/constants.ts +0 -4
- package/src/internal/flatten.ts +0 -12
- package/src/internal/formContext.ts +0 -13
- package/src/internal/getInputProps.test.ts +0 -251
- package/src/internal/getInputProps.ts +0 -94
- package/src/internal/hooks.ts +0 -217
- package/src/internal/hydratable.ts +0 -28
- package/src/internal/logic/getCheckboxChecked.ts +0 -10
- package/src/internal/logic/getRadioChecked.ts +0 -18
- package/src/internal/logic/nestedObjectToPathObject.ts +0 -63
- package/src/internal/logic/requestSubmit.test.tsx +0 -24
- package/src/internal/logic/requestSubmit.ts +0 -103
- package/src/internal/state/arrayUtil.ts +0 -451
- package/src/internal/state/controlledFields.ts +0 -86
- package/src/internal/state/createFormStore.ts +0 -591
- package/src/internal/state/fieldArray.tsx +0 -197
- package/src/internal/state/storeHooks.ts +0 -9
- package/src/internal/state/types.ts +0 -1
- package/src/internal/submissionCallbacks.ts +0 -15
- package/src/internal/util.ts +0 -39
- package/src/server.ts +0 -53
- package/src/unreleased/formStateHooks.ts +0 -170
- package/src/userFacingFormContext.ts +0 -147
- package/src/validation/createValidator.ts +0 -53
- package/src/validation/types.ts +0 -72
- package/tsconfig.json +0 -8
package/src/validation/types.ts
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
export type FieldErrors = Record<string, string>;
|
2
|
-
|
3
|
-
export type TouchedFields = Record<string, boolean>;
|
4
|
-
|
5
|
-
export type GenericObject = { [key: string]: any };
|
6
|
-
|
7
|
-
export type ValidatorError = {
|
8
|
-
subaction?: string;
|
9
|
-
formId?: string;
|
10
|
-
fieldErrors: FieldErrors;
|
11
|
-
};
|
12
|
-
|
13
|
-
export type ValidationErrorResponseData = {
|
14
|
-
subaction?: string;
|
15
|
-
formId?: string;
|
16
|
-
fieldErrors: FieldErrors;
|
17
|
-
repopulateFields?: unknown;
|
18
|
-
};
|
19
|
-
|
20
|
-
export type BaseResult = { submittedData: GenericObject; formId?: string };
|
21
|
-
export type ErrorResult = BaseResult & {
|
22
|
-
error: ValidatorError;
|
23
|
-
data: undefined;
|
24
|
-
};
|
25
|
-
export type SuccessResult<DataType> = BaseResult & {
|
26
|
-
data: DataType;
|
27
|
-
error: undefined;
|
28
|
-
};
|
29
|
-
|
30
|
-
/**
|
31
|
-
* The result when validating a form.
|
32
|
-
*/
|
33
|
-
export type ValidationResult<DataType> = SuccessResult<DataType> | ErrorResult;
|
34
|
-
|
35
|
-
/**
|
36
|
-
* The result when validating an individual field in a form.
|
37
|
-
*/
|
38
|
-
export type ValidateFieldResult = { error?: string };
|
39
|
-
|
40
|
-
/**
|
41
|
-
* A `Validator` can be passed to the `validator` prop of a `ValidatedForm`.
|
42
|
-
*/
|
43
|
-
export type Validator<DataType> = {
|
44
|
-
validate: (
|
45
|
-
unvalidatedData: GenericObject
|
46
|
-
) => Promise<ValidationResult<DataType>>;
|
47
|
-
/**
|
48
|
-
* @deprecated Will be removed in a future version of remix-validated-form
|
49
|
-
*/
|
50
|
-
validateField?: (
|
51
|
-
unvalidatedData: GenericObject,
|
52
|
-
field: string
|
53
|
-
) => Promise<ValidateFieldResult>;
|
54
|
-
};
|
55
|
-
|
56
|
-
export type Valid<DataType> = { data: DataType; error: undefined };
|
57
|
-
export type Invalid = { error: FieldErrors; data: undefined };
|
58
|
-
export type CreateValidatorArg<DataType> = {
|
59
|
-
validate: (
|
60
|
-
unvalidatedData: GenericObject
|
61
|
-
) => Promise<Valid<DataType> | Invalid>;
|
62
|
-
validateField: (
|
63
|
-
unvalidatedData: GenericObject,
|
64
|
-
field: string
|
65
|
-
) => Promise<ValidateFieldResult>;
|
66
|
-
};
|
67
|
-
|
68
|
-
export type ValidatorData<T extends Validator<any>> = T extends Validator<
|
69
|
-
infer U
|
70
|
-
>
|
71
|
-
? U
|
72
|
-
: never;
|