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.
Files changed (31) hide show
  1. package/README.md +4 -3
  2. package/dist/cjs/gform-react.development.js +280 -238
  3. package/dist/cjs/gform-react.development.js.map +1 -1
  4. package/dist/cjs/gform-react.production.js +1 -1
  5. package/dist/cjs/gform-react.production.js.map +1 -1
  6. package/dist/esm/GForm.production.js +1 -1
  7. package/dist/esm/GForm.production.js.map +1 -1
  8. package/dist/esm/GInput.production.js +1 -1
  9. package/dist/esm/GInput.production.js.map +1 -1
  10. package/dist/esm/GValidator.production.js +1 -1
  11. package/dist/esm/GValidator.production.js.map +1 -1
  12. package/dist/esm/index.development.js +286 -243
  13. package/dist/esm/index.development.js.map +1 -1
  14. package/dist/esm/index.js +2 -1
  15. package/dist/esm/shared.production.js +1 -1
  16. package/dist/esm/shared.production.js.map +1 -1
  17. package/dist/index.d.ts +25 -12
  18. package/native/dist/cjs/gform-react-native.development.js +222 -284
  19. package/native/dist/cjs/gform-react-native.development.js.map +1 -1
  20. package/native/dist/cjs/gform-react-native.production.js +1 -1
  21. package/native/dist/cjs/gform-react-native.production.js.map +1 -1
  22. package/native/dist/esm/RNGForm.production.js +1 -1
  23. package/native/dist/esm/RNGForm.production.js.map +1 -1
  24. package/native/dist/esm/RNGInput.production.js +1 -1
  25. package/native/dist/esm/RNGInput.production.js.map +1 -1
  26. package/native/dist/esm/index.development.js +228 -288
  27. package/native/dist/esm/index.development.js.map +1 -1
  28. package/native/dist/esm/shared.production.js +1 -1
  29. package/native/dist/esm/shared.production.js.map +1 -1
  30. package/native/dist/index.d.ts +4 -8
  31. package/package.json +27 -24
package/dist/index.d.ts CHANGED
@@ -1,4 +1,23 @@
1
- import type { Dispatch, HTMLAttributes, MutableRefObject, ReactNode, SetStateAction, HTMLInputTypeAttribute, FocusEvent, InvalidEvent, FormEventHandler, ChangeEventHandler, FocusEventHandler, EventHandler, SyntheticEvent, ChangeEvent, FormEvent, InputHTMLAttributes, FC, ClipboardEvent } from "react";
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?: MutableRefObject<HTMLElement | null>}>;
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<HTMLAttributes<HTMLFormElement>, 'onSubmit' | 'onPaste' | 'onChange' | 'children'> & {
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?: MutableRefObject<GFormState<T> | undefined>;
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?: MutableRefObject<HTMLFormElement | null>;
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>({loader,stateRef,onSubmit,onChange,children,validators,onInit,optimized,...rest}: GFormProps<T>) => JSX.Element;
283
+ export const GForm: <T extends any>({stateRef,onSubmit,onChange,children,validators,onInit,optimized,...rest}: GFormProps<T>) => JSX.Element;