react-mui-form-validator 1.1.1 → 1.1.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 (2) hide show
  1. package/dist/index.js +19 -22
  2. package/package.json +2 -8
package/dist/index.js CHANGED
@@ -100,13 +100,11 @@ var import_react5 = __toESM(require("react"));
100
100
  // src/core/validator/ValidatorComponent.jsx
101
101
  var import_react4 = __toESM(require("react"));
102
102
  var import_prop_types3 = __toESM(require("prop-types"));
103
- var import_promise_polyfill2 = __toESM(require("promise-polyfill"));
104
103
  var import_react_lifecycles_compat = require("react-lifecycles-compat");
105
104
 
106
105
  // src/core/validator/ValidatorForm.jsx
107
106
  var import_react3 = __toESM(require("react"));
108
107
  var import_prop_types2 = __toESM(require("prop-types"));
109
- var import_promise_polyfill = __toESM(require("promise-polyfill"));
110
108
 
111
109
  // src/core/context/index.ts
112
110
  var import_react2 = __toESM(require("react"));
@@ -300,10 +298,10 @@ var ValidatorForm = class extends import_react3.default.Component {
300
298
  };
301
299
  walk = (children, dryRun) => {
302
300
  const self = this;
303
- return new import_promise_polyfill.default((resolve) => {
301
+ return new Promise((resolve) => {
304
302
  let result = true;
305
303
  if (Array.isArray(children)) {
306
- import_promise_polyfill.default.all(
304
+ Promise.all(
307
305
  children.map((input) => self.checkInput(input, dryRun))
308
306
  ).then((data) => {
309
307
  data.forEach((item) => {
@@ -318,7 +316,7 @@ var ValidatorForm = class extends import_react3.default.Component {
318
316
  }
319
317
  });
320
318
  };
321
- checkInput = (input, dryRun) => new import_promise_polyfill.default((resolve) => {
319
+ checkInput = (input, dryRun) => new Promise((resolve) => {
322
320
  let result = true;
323
321
  const validators = input.props.validators;
324
322
  if (validators) {
@@ -332,7 +330,7 @@ var ValidatorForm = class extends import_react3.default.Component {
332
330
  resolve(result);
333
331
  }
334
332
  });
335
- validate = (input, includeRequired, dryRun) => new import_promise_polyfill.default((resolve) => {
333
+ validate = (input, includeRequired, dryRun) => new Promise((resolve) => {
336
334
  const { value } = input.props;
337
335
  input.validate(value, includeRequired, dryRun).then((valid) => {
338
336
  if (!valid) {
@@ -474,26 +472,25 @@ var ValidatorComponent = class extends import_react4.default.Component {
474
472
  this.debounceTime = this.form.debounceTime;
475
473
  this.validateDebounced = debounce(this.validate, this.debounceTime);
476
474
  };
477
- validate = (value, includeRequired = false, dryRun = false) => {
478
- const validations = import_promise_polyfill2.default.all(
475
+ validate = async (value, includeRequired = false, dryRun = false) => {
476
+ const validations = Promise.all(
479
477
  this.state.validators.map((validator) => ValidatorForm_default.getValidator(validator, value, includeRequired))
480
478
  );
481
- return validations.then((results) => {
482
- this.invalid = [];
483
- let valid = true;
484
- results.forEach((result, key) => {
485
- if (!result) {
486
- valid = false;
487
- this.invalid.push(key);
488
- }
489
- });
490
- if (!dryRun) {
491
- this.setState({ isValid: valid }, () => {
492
- this.props.validatorListener(this.state.isValid);
493
- });
479
+ const results = await validations;
480
+ this.invalid = [];
481
+ let valid = true;
482
+ results.forEach((result, key) => {
483
+ if (!result) {
484
+ valid = false;
485
+ this.invalid.push(key);
494
486
  }
495
- return valid;
496
487
  });
488
+ if (!dryRun) {
489
+ this.setState({ isValid: valid }, () => {
490
+ this.props.validatorListener(this.state.isValid);
491
+ });
492
+ }
493
+ return valid;
497
494
  };
498
495
  isValid = () => this.state.isValid;
499
496
  makeInvalid = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-mui-form-validator",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Validator for forms designed with material-ui components.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,14 +27,10 @@
27
27
  "dependencies": {
28
28
  "@mui/material": "^5.13.6",
29
29
  "@types/prop-types": "^15.7.5",
30
- "gud": "^1.0.0",
31
- "promise-polyfill": "^8.3.0",
32
30
  "prop-types": "^15.8.1",
33
31
  "react": "^18.2.0",
34
32
  "react-dom": "^18.2.0",
35
- "react-hook-form": "^7.45.1",
36
33
  "react-lifecycles-compat": "^3.0.4",
37
- "tiny-warning": "^1.0.3",
38
34
  "tsup": "^7.1.0",
39
35
  "typescript": "^5.1.6",
40
36
  "warning": "^4.0.3"
@@ -45,7 +41,6 @@
45
41
  },
46
42
  "devDependencies": {
47
43
  "@types/node": "^20.3.3",
48
- "@types/promise-polyfill": "^6.0.4",
49
44
  "@types/react": "18.2.14",
50
45
  "@types/react-dom": "^18.2.6",
51
46
  "@types/react-lifecycles-compat": "^3.0.1",
@@ -59,7 +54,6 @@
59
54
  "eslint-plugin-jsx-a11y": "^6.7.1",
60
55
  "eslint-plugin-prettier": "4.2.1",
61
56
  "eslint-plugin-react": "^7.32.2",
62
- "eslint-plugin-react-hooks": "^4.6.0",
63
- "rimraf": "^5.0.1"
57
+ "eslint-plugin-react-hooks": "^4.6.0"
64
58
  }
65
59
  }