gform-react 2.0.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/dist/cjs/gform-react.development.js +274 -205
- 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/index.development.js +280 -210
- 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 +5 -12
- package/native/dist/cjs/gform-react-native.development.js +219 -281
- 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 +225 -285
- 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 +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
Dispatch,
|
|
3
3
|
HTMLAttributes,
|
|
4
|
-
MutableRefObject,
|
|
5
4
|
ReactNode,
|
|
6
5
|
SetStateAction,
|
|
7
6
|
HTMLInputTypeAttribute,
|
|
@@ -17,7 +16,7 @@ import {
|
|
|
17
16
|
InputHTMLAttributes,
|
|
18
17
|
FC,
|
|
19
18
|
ClipboardEvent,
|
|
20
|
-
RefObject, DetailedHTMLProps, FormHTMLAttributes
|
|
19
|
+
RefObject, DetailedHTMLProps, FormHTMLAttributes, Ref
|
|
21
20
|
} from "react";
|
|
22
21
|
|
|
23
22
|
export type RawData<T> = {
|
|
@@ -195,7 +194,7 @@ export type GInputProps = BaseGenericFieldProps & Omit<InputHTMLAttributes<HTMLI
|
|
|
195
194
|
element?: GInputElementHandler<string>;
|
|
196
195
|
});
|
|
197
196
|
|
|
198
|
-
export declare const GInput: FC<GInputProps & {ref?:
|
|
197
|
+
export declare const GInput: FC<GInputProps & {ref?: Ref<HTMLElement | null>}>;
|
|
199
198
|
|
|
200
199
|
export type GFormState<T> = IForm<T>
|
|
201
200
|
&
|
|
@@ -204,16 +203,12 @@ export type GFormState<T> = IForm<T>
|
|
|
204
203
|
isValid: boolean;
|
|
205
204
|
/**indicates whether the form is invalid */
|
|
206
205
|
isInvalid: boolean;
|
|
207
|
-
/**returns the loading state */
|
|
208
|
-
loading: boolean;
|
|
209
206
|
/**returns an object with key value pairs represents the form*/
|
|
210
207
|
toRawData(options?: ToRawDataOptions<T>): RawData<T>;
|
|
211
208
|
/**returns `FormData` instance represents the form*/
|
|
212
209
|
toFormData(options?: ToFormDataOptions<T>): FormData;
|
|
213
210
|
/**returns `URLSearchParams` instance represents the form*/
|
|
214
211
|
toURLSearchParams(options?: ToURLSearchParamsOptions<T>): URLSearchParams;
|
|
215
|
-
/**update the loading state */
|
|
216
|
-
setLoading: Dispatch<SetStateAction<boolean>>;
|
|
217
212
|
/**update the validity state (invokes all defined validators) */
|
|
218
213
|
checkValidity(): boolean;
|
|
219
214
|
/**manually dispatch any changes to input(s) */
|
|
@@ -260,8 +255,6 @@ export declare class GValidator<T = any> {
|
|
|
260
255
|
|
|
261
256
|
export type GFormProps<T> = Omit<DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, 'onSubmit' | 'onPaste' | 'onChange' | 'children'> & {
|
|
262
257
|
children?: ReactNode | ReactNode[] | ((state: GFormState<T>) => ReactNode | ReactNode[]);
|
|
263
|
-
/** @param loader - a component to display while loading (optional). */
|
|
264
|
-
loader?: ReactNode;
|
|
265
258
|
/** @param stateRef - pass a ref which will points to the current state of the form (optional). */
|
|
266
259
|
stateRef?: RefObject<GFormState<T> | undefined>;
|
|
267
260
|
/** @param onSubmit - a handler for the form submission (optional). */
|
|
@@ -279,7 +272,7 @@ export type GFormProps<T> = Omit<DetailedHTMLProps<FormHTMLAttributes<HTMLFormEl
|
|
|
279
272
|
* @optional
|
|
280
273
|
*/
|
|
281
274
|
optimized?: boolean;
|
|
282
|
-
ref?:
|
|
275
|
+
ref?: Ref<HTMLFormElement | null>;
|
|
283
276
|
};
|
|
284
277
|
|
|
285
278
|
/**
|
|
@@ -287,4 +280,4 @@ export type GFormProps<T> = Omit<DetailedHTMLProps<FormHTMLAttributes<HTMLFormEl
|
|
|
287
280
|
* @link Docs - https://gform-react.onrender.com
|
|
288
281
|
* @link Npm - https://www.npmjs.com/package/gform-react
|
|
289
282
|
*/
|
|
290
|
-
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;
|