🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

react-mui-form-validator

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-mui-form-validator - npm Package Compare versions

Comparing version
1.5.5
to
1.5.6
+7
babel.config.js
module.exports = {
presets: [
"@babel/preset-flow",
"@babel/preset-env",
["@babel/preset-react", { runtime: "automatic" }],
],
};
+14
-4
{
"name": "react-mui-form-validator",
"version": "1.5.5",
"version": "1.5.6",
"description": "Validator for forms designed with material-ui components.",

@@ -20,2 +20,3 @@ "main": "lib/index.js",

"mui",
"mui-validator",
"material-ui",

@@ -43,11 +44,20 @@ "form",

"devDependencies": {
"@mui/material": "^5.14.16",
"@babel/preset-env": "^7.23.2",
"@babel/preset-flow": "^7.22.15",
"@babel/preset-react": "^7.22.15",
"@jest/globals": "^29.7.0",
"@mui/material": "^5.14.17",
"@testing-library/react": "^14.0.0",
"@types/node": "^20.8.10",
"@types/react": "^18.2.34",
"@types/react": "^18.2.36",
"@types/react-dom": "^18.2.14",
"@types/react-lifecycles-compat": "^3.0.3",
"@types/react-test-renderer": "^18.0.5",
"babel-jest": "^29.7.0",
"jest": "^29.7.0",
"mui-tel-input": "4.0.1",
"react-scripts": "5.0.1",
"react-test-renderer": "^18.2.0",
"rimraf": "^5.0.5",
"tsup": "^7.2.0",
"react-scripts": "5.0.1",
"typescript": "^4.9.5"

@@ -54,0 +64,0 @@ },

@@ -26,2 +26,2 @@ {

"include": ["src/**/*"]
}
}
import * as React$1 from 'react';
import React__default from 'react';
import { TextFieldVariants, FilledTextFieldProps, StandardTextFieldProps, OutlinedTextFieldProps } from '@mui/material';
import { MuiTelInputInfo } from 'mui-tel-input';
interface required {
validator: "required";
}
interface matchRegexp {
validator: "matchRegexp";
regexp: RegExp | string;
}
interface isEmail {
validator: "isEmail";
}
interface isEmpty {
validator: "isEmpty";
}
interface trim {
validator: "trim";
}
interface isNumber {
validator: "isNumber";
}
interface isFloat {
validator: "isFloat";
}
interface isPositive {
validator: "isPositive";
}
interface maxNumber {
validator: "maxNumber";
max: number;
}
interface minNumber {
validator: "minNumber";
min: number;
}
interface maxFloat {
validator: "maxFloat";
max: number;
}
interface minFloat {
validator: "minFloat";
min: number;
}
interface isString {
validator: "isString";
}
interface minStringLength {
validator: "minStringLength";
min: number;
}
interface maxStringLength {
validator: "maxStringLength";
max: number;
}
interface isFile {
validator: "isFile";
}
interface maxFileSize {
validator: "maxFileSize";
max: number;
}
interface allowedExtensions {
validator: "allowedExtensions";
fileTypes: string;
}
type Validator = required | matchRegexp | isEmail | isEmpty | trim | isNumber | isFloat | isPositive | maxNumber | minNumber | maxFloat | minFloat | isString | minStringLength | maxStringLength | isFile | maxFileSize | allowedExtensions;
type MuiTextFieldProps<Variant extends TextFieldVariants = TextFieldVariants> = Variant extends "filled" ? FilledTextFieldProps : Variant extends "standard" ? StandardTextFieldProps : OutlinedTextFieldProps & ValidatorComponentProps;
interface ValidatorComponentProps {
errorMessages?: string | string[];
validators?: Validator[];
value: any;
validatorListener?: (value: boolean) => void;
withRequiredValidator?: boolean;
containerProps?: object;
onChangeTel?: (value: string, info: MuiTelInputInfo) => void;
}
interface ValidatorComponentState {
isValid?: boolean;
value: any;
errorMessages?: string | string[];
validators?: Validator[];
}
interface ValidatorFormProps {
children: React.ReactNode;
onSubmit: () => void;
instantValidate?: boolean;
onError?: (errors: any) => void;
debounceTime?: number;
}
declare class ValidatorForm extends React$1.Component<ValidatorFormProps> {
static getValidator: (validator: Validator, value: any, includeRequired: boolean) => boolean;
getFormHelpers: () => {
form: {
attachToForm: (component: any) => void;
detachFromForm: (component: any) => void;
instantValidate: boolean;
debounceTime: number;
};
};
instantValidate: boolean;
childs: any[];
errors: any[];
debounceTime: number;
attachToForm: (component: any) => void;
detachFromForm: (component: any) => void;
submit: (event: React$1.FormEvent<HTMLFormElement>) => void;
walk: (children: any[], dryRun?: boolean) => Promise<boolean>;
checkInput: (input: any, dryRun?: boolean) => Promise<boolean>;
validate: (input: any, includeRequired: boolean, dryRun?: boolean) => Promise<boolean>;
find: (collection: any[], fn: (item: any) => boolean) => any;
resetValidations: () => void;
isFormValid: (dryRun?: boolean) => Promise<boolean>;
render(): React$1.JSX.Element;
}
declare class ValidatorComponent extends React$1.Component<MuiTextFieldProps & ValidatorComponentProps, ValidatorComponentState> {
[x: string]: any;
getSnapshotBeforeUpdate(nextProps: ValidatorComponentProps, prevState: ValidatorComponentState): {
value: any;
validators: Validator[];
errorMessages: string | string[];
} | {
value: any;
validators?: undefined;
errorMessages?: undefined;
};
state: {
isValid: boolean;
value: any;
errorMessages: string | string[] | undefined;
validators: Validator[] | undefined;
};
componentDidMount(): void;
shouldComponentUpdate(nextProps: ValidatorComponentProps, nextState: ValidatorComponentState): boolean;
componentDidUpdate(prevProps: ValidatorComponentProps, prevState: ValidatorComponentState): void;
componentWillUnmount(): void;
getErrorMessage: () => string | boolean | string[];
instantValidate: boolean;
invalid: number[];
configure: () => void;
validate: (value: any, includeRequired?: boolean, dryRun?: boolean) => Promise<boolean>;
isValid: () => boolean;
makeInvalid: () => void;
makeValid: () => void;
renderComponent: (form: ValidatorForm) => React$1.ReactNode;
render(): React$1.JSX.Element;
}
declare class MuiSelect extends ValidatorComponent {
renderValidatorComponent(): React$1.JSX.Element;
}
declare class MuiTextField extends ValidatorComponent {
renderValidatorComponent(): React__default.JSX.Element;
}
declare class MuiTelInputDefault extends ValidatorComponent {
renderValidatorComponent(): React__default.JSX.Element;
}
export { ValidatorComponent as MuiComponent, ValidatorForm as MuiForm, MuiTelInputDefault as MuiPhoneNumber, MuiSelect, MuiTextField, Validator as MuiValidator };

Sorry, the diff of this file is too big to display