react-mui-form-validator 1.5.5 → 1.5.7

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.
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ presets: [
3
+ "@babel/preset-flow",
4
+ "@babel/preset-env",
5
+ ["@babel/preset-react", { runtime: "automatic" }],
6
+ ],
7
+ };
package/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default from 'react';
3
- import { TextFieldVariants, FilledTextFieldProps, StandardTextFieldProps, OutlinedTextFieldProps } from '@mui/material';
4
- import { MuiTelInputInfo } from 'mui-tel-input';
3
+ import { FilledTextFieldProps, OutlinedTextFieldProps, StandardTextFieldProps, BoxProps } from '@mui/material';
4
+ import { CountryCode, NumberType } from 'libphonenumber-js';
5
5
 
6
6
  interface required {
7
7
  validator: "required";
@@ -68,8 +68,17 @@ interface allowedExtensions {
68
68
  }
69
69
  type Validator = required | matchRegexp | isEmail | isEmpty | trim | isNumber | isFloat | isPositive | maxNumber | minNumber | maxFloat | minFloat | isString | minStringLength | maxStringLength | isFile | maxFileSize | allowedExtensions;
70
70
 
71
- type MuiTextFieldProps<Variant extends TextFieldVariants = TextFieldVariants> = Variant extends "filled" ? FilledTextFieldProps : Variant extends "standard" ? StandardTextFieldProps : OutlinedTextFieldProps & ValidatorComponentProps;
72
- interface ValidatorComponentProps {
71
+ type MuiTelInputReason = 'country' | 'input';
72
+ interface MuiTelInputInfo {
73
+ countryCode: CountryCode | null;
74
+ countryCallingCode: string | null;
75
+ nationalNumber: string | null;
76
+ numberType: Exclude<NumberType, undefined> | null;
77
+ numberValue: string | null;
78
+ reason: MuiTelInputReason;
79
+ }
80
+
81
+ type ComponentProps = {
73
82
  errorMessages?: string | string[];
74
83
  validators?: Validator[];
75
84
  value: any;
@@ -77,7 +86,8 @@ interface ValidatorComponentProps {
77
86
  withRequiredValidator?: boolean;
78
87
  containerProps?: object;
79
88
  onChangeTel?: (value: string, info: MuiTelInputInfo) => void;
80
- }
89
+ };
90
+ type ValidatorComponentProps = (FilledTextFieldProps | OutlinedTextFieldProps | StandardTextFieldProps) & ComponentProps;
81
91
  interface ValidatorComponentState {
82
92
  isValid?: boolean;
83
93
  value: any;
@@ -92,7 +102,7 @@ interface ValidatorFormProps {
92
102
  debounceTime?: number;
93
103
  }
94
104
 
95
- declare class ValidatorForm extends React$1.Component<ValidatorFormProps> {
105
+ declare class ValidatorForm extends React$1.Component<ValidatorFormProps & BoxProps> {
96
106
  static getValidator: (validator: Validator, value: any, includeRequired: boolean) => boolean;
97
107
  getFormHelpers: () => {
98
108
  form: {
@@ -118,8 +128,11 @@ declare class ValidatorForm extends React$1.Component<ValidatorFormProps> {
118
128
  render(): React$1.JSX.Element;
119
129
  }
120
130
 
121
- declare class ValidatorComponent extends React$1.Component<MuiTextFieldProps & ValidatorComponentProps, ValidatorComponentState> {
122
- [x: string]: any;
131
+ declare class ValidatorComponent extends React$1.Component<ValidatorComponentProps, ValidatorComponentState> {
132
+ renderValidatorComponent(): React$1.ReactNode;
133
+ validateDebounced: any;
134
+ form: any;
135
+ debounceTime: any;
123
136
  getSnapshotBeforeUpdate(nextProps: ValidatorComponentProps, prevState: ValidatorComponentState): {
124
137
  value: any;
125
138
  validators: Validator[];