gform-react 2.0.1 → 2.5.2

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 (30) hide show
  1. package/dist/cjs/gform-react.development.js +314 -213
  2. package/dist/cjs/gform-react.development.js.map +1 -1
  3. package/dist/cjs/gform-react.production.js +1 -1
  4. package/dist/cjs/gform-react.production.js.map +1 -1
  5. package/dist/esm/GForm.production.js +1 -1
  6. package/dist/esm/GForm.production.js.map +1 -1
  7. package/dist/esm/GInput.production.js +1 -1
  8. package/dist/esm/GInput.production.js.map +1 -1
  9. package/dist/esm/GValidator.production.js +1 -1
  10. package/dist/esm/GValidator.production.js.map +1 -1
  11. package/dist/esm/index.development.js +320 -218
  12. package/dist/esm/index.development.js.map +1 -1
  13. package/dist/esm/index.js +2 -1
  14. package/dist/esm/shared.production.js +1 -1
  15. package/dist/esm/shared.production.js.map +1 -1
  16. package/dist/index.d.ts +13 -13
  17. package/native/dist/cjs/gform-react-native.development.js +254 -264
  18. package/native/dist/cjs/gform-react-native.development.js.map +1 -1
  19. package/native/dist/cjs/gform-react-native.production.js +1 -1
  20. package/native/dist/cjs/gform-react-native.production.js.map +1 -1
  21. package/native/dist/esm/RNGForm.production.js +1 -1
  22. package/native/dist/esm/RNGForm.production.js.map +1 -1
  23. package/native/dist/esm/RNGInput.production.js +1 -1
  24. package/native/dist/esm/RNGInput.production.js.map +1 -1
  25. package/native/dist/esm/index.development.js +260 -268
  26. package/native/dist/esm/index.development.js.map +1 -1
  27. package/native/dist/esm/shared.production.js +1 -1
  28. package/native/dist/esm/shared.production.js.map +1 -1
  29. package/native/dist/index.d.ts +4 -8
  30. 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?: MutableRefObject<HTMLElement | null>}>;
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) */
@@ -248,7 +243,14 @@ export declare class GValidator<T = any> {
248
243
  withRangeUnderflowMessage(message: string | GConstraintValidator): GValidator<T>;
249
244
  /**register a `rangeOverflow` violation handler (use this with `max` attribute) */
250
245
  withRangeOverflowMessage(message: string | GConstraintValidator): GValidator<T>;
251
- /**register a `typeMismatch` violation handler */
246
+ /**
247
+ * register a `typeMismatch` violation handler<br />
248
+ * if its possible use `pattern` attribute (and `withPatternMismatchMessage`) or `custom validation` instead.<br/>
249
+ * use the `type` attribute to set the input's keyboard (for example type `'tel'` will show on mobile phones only numpads)
250
+ * and then with `pattern` or `custom validation` you can validate it.<br/>
251
+ * the reason for that is `type` is not a solid validation and likely will be replaced anyway.<br />
252
+ * if `pattern` or `custom` are used, then `withTypeMismatchMessage` is ignored
253
+ * */
252
254
  withTypeMismatchMessage(message: string | GConstraintValidator): GValidator<T>;
253
255
  /**register a `stepMismatch` violation handler (use this with `step` attribute)*/
254
256
  withStepMismatchMessage(message: string | GConstraintValidator): GValidator<T>;
@@ -260,8 +262,6 @@ export declare class GValidator<T = any> {
260
262
 
261
263
  export type GFormProps<T> = Omit<DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, 'onSubmit' | 'onPaste' | 'onChange' | 'children'> & {
262
264
  children?: ReactNode | ReactNode[] | ((state: GFormState<T>) => ReactNode | ReactNode[]);
263
- /** @param loader - a component to display while loading (optional). */
264
- loader?: ReactNode;
265
265
  /** @param stateRef - pass a ref which will points to the current state of the form (optional). */
266
266
  stateRef?: RefObject<GFormState<T> | undefined>;
267
267
  /** @param onSubmit - a handler for the form submission (optional). */
@@ -279,7 +279,7 @@ export type GFormProps<T> = Omit<DetailedHTMLProps<FormHTMLAttributes<HTMLFormEl
279
279
  * @optional
280
280
  */
281
281
  optimized?: boolean;
282
- ref?: MutableRefObject<HTMLFormElement | null>;
282
+ ref?: Ref<HTMLFormElement | null>;
283
283
  };
284
284
 
285
285
  /**
@@ -287,4 +287,4 @@ export type GFormProps<T> = Omit<DetailedHTMLProps<FormHTMLAttributes<HTMLFormEl
287
287
  * @link Docs - https://gform-react.onrender.com
288
288
  * @link Npm - https://www.npmjs.com/package/gform-react
289
289
  */
290
- export const GForm: <T extends any>({loader,stateRef,onSubmit,onChange,children,validators,onInit,optimized,...rest}: GFormProps<T>) => JSX.Element;
290
+ export const GForm: <T extends any>({stateRef,onSubmit,onChange,children,validators,onInit,optimized,...rest}: GFormProps<T>) => JSX.Element;