gform-react 1.11.1 → 2.5.0
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/README.md +4 -3
- package/dist/cjs/gform-react.development.js +280 -238
- package/dist/cjs/gform-react.development.js.map +1 -1
- package/dist/cjs/gform-react.production.js +1 -1
- package/dist/cjs/gform-react.production.js.map +1 -1
- package/dist/esm/GForm.production.js +1 -1
- package/dist/esm/GForm.production.js.map +1 -1
- package/dist/esm/GInput.production.js +1 -1
- package/dist/esm/GInput.production.js.map +1 -1
- package/dist/esm/GValidator.production.js +1 -1
- package/dist/esm/GValidator.production.js.map +1 -1
- package/dist/esm/index.development.js +286 -243
- package/dist/esm/index.development.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/shared.production.js +1 -1
- package/dist/esm/shared.production.js.map +1 -1
- package/dist/index.d.ts +25 -12
- package/native/dist/cjs/gform-react-native.development.js +222 -284
- package/native/dist/cjs/gform-react-native.development.js.map +1 -1
- package/native/dist/cjs/gform-react-native.production.js +1 -1
- package/native/dist/cjs/gform-react-native.production.js.map +1 -1
- package/native/dist/esm/RNGForm.production.js +1 -1
- package/native/dist/esm/RNGForm.production.js.map +1 -1
- package/native/dist/esm/RNGInput.production.js +1 -1
- package/native/dist/esm/RNGInput.production.js.map +1 -1
- package/native/dist/esm/index.development.js +228 -288
- package/native/dist/esm/index.development.js.map +1 -1
- package/native/dist/esm/shared.production.js +1 -1
- package/native/dist/esm/shared.production.js.map +1 -1
- package/native/dist/index.d.ts +4 -8
- package/package.json +27 -24
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
Dispatch,
|
|
3
|
+
HTMLAttributes,
|
|
4
|
+
ReactNode,
|
|
5
|
+
SetStateAction,
|
|
6
|
+
HTMLInputTypeAttribute,
|
|
7
|
+
FocusEvent,
|
|
8
|
+
InvalidEvent,
|
|
9
|
+
FormEventHandler,
|
|
10
|
+
ChangeEventHandler,
|
|
11
|
+
FocusEventHandler,
|
|
12
|
+
EventHandler,
|
|
13
|
+
SyntheticEvent,
|
|
14
|
+
ChangeEvent,
|
|
15
|
+
FormEvent,
|
|
16
|
+
InputHTMLAttributes,
|
|
17
|
+
FC,
|
|
18
|
+
ClipboardEvent,
|
|
19
|
+
RefObject, DetailedHTMLProps, FormHTMLAttributes, Ref
|
|
20
|
+
} from "react";
|
|
2
21
|
|
|
3
22
|
export type RawData<T> = {
|
|
4
23
|
[key in keyof T]: T[key];
|
|
@@ -175,7 +194,7 @@ export type GInputProps = BaseGenericFieldProps & Omit<InputHTMLAttributes<HTMLI
|
|
|
175
194
|
element?: GInputElementHandler<string>;
|
|
176
195
|
});
|
|
177
196
|
|
|
178
|
-
export declare const GInput: FC<GInputProps & {ref?:
|
|
197
|
+
export declare const GInput: FC<GInputProps & {ref?: Ref<HTMLElement | null>}>;
|
|
179
198
|
|
|
180
199
|
export type GFormState<T> = IForm<T>
|
|
181
200
|
&
|
|
@@ -184,16 +203,12 @@ export type GFormState<T> = IForm<T>
|
|
|
184
203
|
isValid: boolean;
|
|
185
204
|
/**indicates whether the form is invalid */
|
|
186
205
|
isInvalid: boolean;
|
|
187
|
-
/**returns the loading state */
|
|
188
|
-
loading: boolean;
|
|
189
206
|
/**returns an object with key value pairs represents the form*/
|
|
190
207
|
toRawData(options?: ToRawDataOptions<T>): RawData<T>;
|
|
191
208
|
/**returns `FormData` instance represents the form*/
|
|
192
209
|
toFormData(options?: ToFormDataOptions<T>): FormData;
|
|
193
210
|
/**returns `URLSearchParams` instance represents the form*/
|
|
194
211
|
toURLSearchParams(options?: ToURLSearchParamsOptions<T>): URLSearchParams;
|
|
195
|
-
/**update the loading state */
|
|
196
|
-
setLoading: Dispatch<SetStateAction<boolean>>;
|
|
197
212
|
/**update the validity state (invokes all defined validators) */
|
|
198
213
|
checkValidity(): boolean;
|
|
199
214
|
/**manually dispatch any changes to input(s) */
|
|
@@ -238,12 +253,10 @@ export declare class GValidator<T = any> {
|
|
|
238
253
|
withCustomValidationAsync(handler: GCustomValidatorHandlerAsync<T>): GValidator<T>;
|
|
239
254
|
}
|
|
240
255
|
|
|
241
|
-
export type GFormProps<T> = Omit<
|
|
256
|
+
export type GFormProps<T> = Omit<DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, 'onSubmit' | 'onPaste' | 'onChange' | 'children'> & {
|
|
242
257
|
children?: ReactNode | ReactNode[] | ((state: GFormState<T>) => ReactNode | ReactNode[]);
|
|
243
|
-
/** @param loader - a component to display while loading (optional). */
|
|
244
|
-
loader?: ReactNode;
|
|
245
258
|
/** @param stateRef - pass a ref which will points to the current state of the form (optional). */
|
|
246
|
-
stateRef?:
|
|
259
|
+
stateRef?: RefObject<GFormState<T> | undefined>;
|
|
247
260
|
/** @param onSubmit - a handler for the form submission (optional). */
|
|
248
261
|
onSubmit?: (state: GFormState<T>, e: FormEvent<HTMLFormElement>) => void;
|
|
249
262
|
/** @param onChange - register onChange handler (optional). */
|
|
@@ -259,7 +272,7 @@ export type GFormProps<T> = Omit<HTMLAttributes<HTMLFormElement>, 'onSubmit' | '
|
|
|
259
272
|
* @optional
|
|
260
273
|
*/
|
|
261
274
|
optimized?: boolean;
|
|
262
|
-
ref?:
|
|
275
|
+
ref?: Ref<HTMLFormElement | null>;
|
|
263
276
|
};
|
|
264
277
|
|
|
265
278
|
/**
|
|
@@ -267,4 +280,4 @@ export type GFormProps<T> = Omit<HTMLAttributes<HTMLFormElement>, 'onSubmit' | '
|
|
|
267
280
|
* @link Docs - https://gform-react.onrender.com
|
|
268
281
|
* @link Npm - https://www.npmjs.com/package/gform-react
|
|
269
282
|
*/
|
|
270
|
-
export const GForm: <T extends any>({
|
|
283
|
+
export const GForm: <T extends any>({stateRef,onSubmit,onChange,children,validators,onInit,optimized,...rest}: GFormProps<T>) => JSX.Element;
|