remix-validated-form 4.6.4 → 4.6.5
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 +12 -12
- package/.turbo/turbo-typecheck.log +1 -0
- package/browser/ValidatedForm.d.ts +3 -3
- package/browser/hooks.d.ts +1 -1
- package/browser/internal/formContext.d.ts +3 -3
- package/browser/internal/getInputProps.d.ts +7 -7
- package/browser/internal/hydratable.d.ts +1 -1
- package/browser/internal/state/createFormStore.d.ts +3 -3
- package/browser/internal/state/fieldArray.d.ts +5 -5
- package/browser/internal/state/types.d.ts +1 -1
- package/browser/server.d.ts +1 -1
- package/browser/unreleased/formStateHooks.d.ts +2 -2
- package/browser/userFacingFormContext.d.ts +1 -1
- package/browser/validation/types.d.ts +15 -15
- package/dist/remix-validated-form.cjs.js +4 -4
- package/dist/remix-validated-form.cjs.js.map +1 -1
- package/dist/remix-validated-form.es.js +19 -11
- package/dist/remix-validated-form.es.js.map +1 -1
- package/dist/remix-validated-form.umd.js +4 -4
- package/dist/remix-validated-form.umd.js.map +1 -1
- package/dist/types/ValidatedForm.d.ts +2 -2
- package/dist/types/hooks.d.ts +8 -8
- package/dist/types/internal/formContext.d.ts +2 -2
- package/dist/types/internal/hooks.d.ts +1 -1
- package/dist/types/internal/logic/requestSubmit.d.ts +1 -1
- package/dist/types/unreleased/formStateHooks.d.ts +2 -2
- package/dist/types/userFacingFormContext.d.ts +1 -1
- package/package.json +4 -3
- package/src/ValidatedForm.tsx +2 -1
- package/src/internal/formContext.ts +2 -2
- package/stats.html +1 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Form as RemixForm
|
1
|
+
import { FetcherWithComponents, Form as RemixForm } from "@remix-run/react";
|
2
2
|
import React, { ComponentProps } from "react";
|
3
3
|
import { Validator } from "./validation/types";
|
4
4
|
export declare type FormProps<DataType> = {
|
@@ -16,7 +16,7 @@ export declare type FormProps<DataType> = {
|
|
16
16
|
* The form will use the fetcher for loading states, action data, etc
|
17
17
|
* instead of the default form action.
|
18
18
|
*/
|
19
|
-
fetcher?:
|
19
|
+
fetcher?: FetcherWithComponents<any>;
|
20
20
|
/**
|
21
21
|
* Accepts an object of default values for the form
|
22
22
|
* that will automatically be propagated to the form fields via `useField`.
|
package/dist/types/hooks.d.ts
CHANGED
@@ -6,13 +6,13 @@ import { GetInputProps, ValidationBehaviorOptions } from "./internal/getInputPro
|
|
6
6
|
*
|
7
7
|
* @param formId
|
8
8
|
*/
|
9
|
-
export declare const useIsSubmitting: (formId?: string
|
9
|
+
export declare const useIsSubmitting: (formId?: string) => boolean;
|
10
10
|
/**
|
11
11
|
* Returns whether or not the current form is valid.
|
12
12
|
*
|
13
13
|
* @param formId the id of the form. Only necessary if being used outside a ValidatedForm.
|
14
14
|
*/
|
15
|
-
export declare const useIsValid: (formId?: string
|
15
|
+
export declare const useIsValid: (formId?: string) => boolean;
|
16
16
|
export declare type FieldProps = {
|
17
17
|
/**
|
18
18
|
* The validation error message if there is one.
|
@@ -52,16 +52,16 @@ export declare const useField: (name: string, options?: {
|
|
52
52
|
* when the input needs to receive focus due to a validation error.
|
53
53
|
* This is useful for custom components that use a hidden input.
|
54
54
|
*/
|
55
|
-
handleReceiveFocus?: (
|
55
|
+
handleReceiveFocus?: () => void;
|
56
56
|
/**
|
57
57
|
* Allows you to specify when a field gets validated (when using getInputProps)
|
58
58
|
*/
|
59
|
-
validationBehavior?: Partial<ValidationBehaviorOptions
|
59
|
+
validationBehavior?: Partial<ValidationBehaviorOptions>;
|
60
60
|
/**
|
61
61
|
* The formId of the form you want to use.
|
62
62
|
* This is not necesary if the input is used inside a form.
|
63
63
|
*/
|
64
|
-
formId?: string
|
65
|
-
}
|
66
|
-
export declare const useControlField: <T>(name: string, formId?: string
|
67
|
-
export declare const useUpdateControlledField: (formId?: string
|
64
|
+
formId?: string;
|
65
|
+
}) => FieldProps;
|
66
|
+
export declare const useControlField: <T>(name: string, formId?: string) => readonly [T, (value: T) => void];
|
67
|
+
export declare const useUpdateControlledField: (formId?: string) => (field: string, value: unknown) => void;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import {
|
2
|
+
import { FetcherWithComponents } from "@remix-run/react";
|
3
3
|
export declare type InternalFormContextValue = {
|
4
4
|
formId: string | symbol;
|
5
5
|
action?: string;
|
@@ -7,6 +7,6 @@ export declare type InternalFormContextValue = {
|
|
7
7
|
defaultValuesProp?: {
|
8
8
|
[fieldName: string]: any;
|
9
9
|
};
|
10
|
-
fetcher?:
|
10
|
+
fetcher?: FetcherWithComponents<unknown>;
|
11
11
|
};
|
12
12
|
export declare const InternalFormContext: import("react").Context<InternalFormContextValue | null>;
|
@@ -2,7 +2,7 @@ import { FieldErrors, ValidationErrorResponseData } from "..";
|
|
2
2
|
import { InternalFormContextValue } from "./formContext";
|
3
3
|
import { Hydratable } from "./hydratable";
|
4
4
|
import { InternalFormId } from "./state/types";
|
5
|
-
export declare const useInternalFormContext: (formId?: string | symbol
|
5
|
+
export declare const useInternalFormContext: (formId?: string | symbol, hookName?: string) => InternalFormContextValue;
|
6
6
|
export declare function useErrorResponseForForm({ fetcher, subaction, formId, }: InternalFormContextValue): ValidationErrorResponseData | null;
|
7
7
|
export declare const useFieldErrorsForForm: (context: InternalFormContextValue) => Hydratable<FieldErrors | undefined>;
|
8
8
|
export declare const useDefaultValuesFromLoader: ({ formId, }: InternalFormContextValue) => any;
|
@@ -2,4 +2,4 @@
|
|
2
2
|
* Ponyfill of the HTMLFormElement.requestSubmit() method.
|
3
3
|
* Based on polyfill from: https://github.com/javan/form-request-submit-polyfill/blob/main/form-request-submit-polyfill.js
|
4
4
|
*/
|
5
|
-
export declare const requestSubmit: (element: HTMLFormElement, submitter?: HTMLElement
|
5
|
+
export declare const requestSubmit: (element: HTMLFormElement, submitter?: HTMLElement) => void;
|
@@ -16,7 +16,7 @@ export declare type FormState = {
|
|
16
16
|
*
|
17
17
|
* @param formId the id of the form. Only necessary if being used outside a ValidatedForm.
|
18
18
|
*/
|
19
|
-
export declare const useFormState: (formId?: string
|
19
|
+
export declare const useFormState: (formId?: string) => FormState;
|
20
20
|
export declare type FormHelpers = {
|
21
21
|
/**
|
22
22
|
* Clear the error of the specified field.
|
@@ -61,4 +61,4 @@ export declare type FormHelpers = {
|
|
61
61
|
*
|
62
62
|
* @param formId the id of the form. Only necessary if being used outside a ValidatedForm.
|
63
63
|
*/
|
64
|
-
export declare const useFormHelpers: (formId?: string
|
64
|
+
export declare const useFormHelpers: (formId?: string) => FormHelpers;
|
@@ -82,4 +82,4 @@ export declare type FormContextValue = {
|
|
82
82
|
/**
|
83
83
|
* Provides access to some of the internal state of the form.
|
84
84
|
*/
|
85
|
-
export declare const useFormContext: (formId?: string
|
85
|
+
export declare const useFormContext: (formId?: string) => FormContextValue;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "remix-validated-form",
|
3
|
-
"version": "4.6.
|
3
|
+
"version": "4.6.5",
|
4
4
|
"description": "Form component and utils for easy form validation in remix",
|
5
5
|
"browser": "./dist/remix-validated-form.cjs.js",
|
6
6
|
"main": "./dist/remix-validated-form.umd.js",
|
@@ -15,7 +15,8 @@
|
|
15
15
|
"dev": "tsc --module ESNext --outDir ./browser --watch",
|
16
16
|
"build": "vite build",
|
17
17
|
"prepublishOnly": "cp ../../README.md ./README.md && npm run build",
|
18
|
-
"postpublish": "rm ./README.md"
|
18
|
+
"postpublish": "rm ./README.md",
|
19
|
+
"typecheck": "tsc --noEmit"
|
19
20
|
},
|
20
21
|
"author": {
|
21
22
|
"name": "Aaron Pettengill",
|
@@ -37,7 +38,7 @@
|
|
37
38
|
"react": "^17.0.2 || ^18.0.0"
|
38
39
|
},
|
39
40
|
"devDependencies": {
|
40
|
-
"@remix-run/react": "^1.6
|
41
|
+
"@remix-run/react": "^1.7.6",
|
41
42
|
"@testing-library/react": "^13.3.0",
|
42
43
|
"@types/react": "^18.0.9",
|
43
44
|
"fetch-blob": "^3.1.3",
|
package/src/ValidatedForm.tsx
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import {
|
2
|
+
FetcherWithComponents,
|
2
3
|
Form as RemixForm,
|
3
4
|
FormMethod,
|
4
5
|
useFetcher,
|
@@ -59,7 +60,7 @@ export type FormProps<DataType> = {
|
|
59
60
|
* The form will use the fetcher for loading states, action data, etc
|
60
61
|
* instead of the default form action.
|
61
62
|
*/
|
62
|
-
fetcher?:
|
63
|
+
fetcher?: FetcherWithComponents<any>;
|
63
64
|
/**
|
64
65
|
* Accepts an object of default values for the form
|
65
66
|
* that will automatically be propagated to the form fields via `useField`.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { FetcherWithComponents } from "@remix-run/react";
|
2
2
|
import { createContext } from "react";
|
3
3
|
|
4
4
|
export type InternalFormContextValue = {
|
@@ -6,7 +6,7 @@ export type InternalFormContextValue = {
|
|
6
6
|
action?: string;
|
7
7
|
subaction?: string;
|
8
8
|
defaultValuesProp?: { [fieldName: string]: any };
|
9
|
-
fetcher?:
|
9
|
+
fetcher?: FetcherWithComponents<unknown>;
|
10
10
|
};
|
11
11
|
|
12
12
|
export const InternalFormContext =
|