react-mui-form-validator 1.0.2 → 1.0.3

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.
package/.babelrc CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "presets": ["@babel/preset-env"],
2
+ "presets": ["@babel/preset-env", "@babel/preset-react"],
3
3
  "plugins": ["@babel/plugin-syntax-jsx"]
4
4
  }
@@ -19,6 +19,8 @@ var _excluded = ["errorStyle", "errorMessages", "validators", "requiredError", "
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
21
 
22
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
+
22
24
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
23
25
 
24
26
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -76,12 +78,11 @@ var MuiCheckbox = /*#__PURE__*/function (_MuiComponent) {
76
78
  value = _this$props.value,
77
79
  rest = _objectWithoutProperties(_this$props, _excluded);
78
80
 
79
- return <div>
80
- <_Checkbox.default {...rest} ref={function (r) {
81
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], _extends({}, rest, {
82
+ ref: function ref(r) {
81
83
  _this.input = r;
82
- }} />
83
- {this.errorText()}
84
- </div>;
84
+ }
85
+ })), this.errorText());
85
86
  }
86
87
  }, {
87
88
  key: "errorText",
@@ -92,9 +93,9 @@ var MuiCheckbox = /*#__PURE__*/function (_MuiComponent) {
92
93
  return null;
93
94
  }
94
95
 
95
- return <div style={errorStyle ? errorStyle : style}>
96
- {this.getErrorMessage()}
97
- </div>;
96
+ return /*#__PURE__*/_react["default"].createElement("div", {
97
+ style: errorStyle ? errorStyle : style
98
+ }, this.getErrorMessage());
98
99
  }
99
100
  }]);
100
101
 
@@ -17,6 +17,8 @@ var _excluded = ["error", "errorMessages", "validators", "requiredError", "helpe
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
19
 
20
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
+
20
22
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
21
23
 
22
24
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -67,7 +69,10 @@ var MuiTextField = /*#__PURE__*/function (_MuiComponent) {
67
69
  rest = _objectWithoutProperties(_this$props, _excluded);
68
70
 
69
71
  var isValid = this.state.isValid;
70
- return <_TextField.default {...rest} error={!isValid || error} helperText={!isValid && this.getErrorMessage() || helperText} />;
72
+ return /*#__PURE__*/_react["default"].createElement(_TextField["default"], _extends({}, rest, {
73
+ error: !isValid || error,
74
+ helperText: !isValid && this.getErrorMessage() || helperText
75
+ }));
71
76
  }
72
77
  }]);
73
78
 
@@ -17,6 +17,8 @@ var _excluded = ["error", "errorMessages", "validators", "requiredError", "helpe
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
19
 
20
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
+
20
22
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
21
23
 
22
24
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -67,7 +69,11 @@ var MuiTextSelect = /*#__PURE__*/function (_MuiComponent) {
67
69
  rest = _objectWithoutProperties(_this$props, _excluded);
68
70
 
69
71
  var isValid = this.state.isValid;
70
- return <_TextField.default {...rest} select error={!isValid || error} helperText={!isValid && this.getErrorMessage() || helperText} />;
72
+ return /*#__PURE__*/_react["default"].createElement(_TextField["default"], _extends({}, rest, {
73
+ select: true,
74
+ error: !isValid || error,
75
+ helperText: !isValid && this.getErrorMessage() || helperText
76
+ }));
71
77
  }
72
78
  }]);
73
79
 
@@ -186,12 +186,10 @@ var MuiComponent = /*#__PURE__*/function (_React$Component) {
186
186
  value: function render() {
187
187
  var _this2 = this;
188
188
 
189
- return <_MuiForm.FormContext.Consumer>
190
- {function (_ref) {
191
- var form = _ref.form;
192
- return <div {..._this2.props.containerProps}>{_this2.renderComponent(form)}</div>;
193
- }}
194
- </_MuiForm.FormContext.Consumer>;
189
+ return /*#__PURE__*/_react["default"].createElement(_MuiForm.FormContext.Consumer, null, function (_ref) {
190
+ var form = _ref.form;
191
+ return /*#__PURE__*/_react["default"].createElement("div", _this2.props.containerProps, _this2.renderComponent(form));
192
+ });
195
193
  }
196
194
  }], [{
197
195
  key: "getDerivedStateFromProps",
@@ -21,6 +21,8 @@ var _excluded = ["onSubmit", "instantValidate", "onError", "debounceTime", "chil
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
23
 
24
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
+
24
26
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
27
 
26
28
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -218,11 +220,11 @@ var MuiForm = /*#__PURE__*/function (_React$Component) {
218
220
  children = _this$props.children,
219
221
  rest = _objectWithoutProperties(_this$props, _excluded);
220
222
 
221
- return <FormContext.Provider value={this.getFormHelpers()}>
222
- <form {...rest} onSubmit={this.submit}>
223
- {children}
224
- </form>
225
- </FormContext.Provider>;
223
+ return /*#__PURE__*/_react["default"].createElement(FormContext.Provider, {
224
+ value: this.getFormHelpers()
225
+ }, /*#__PURE__*/_react["default"].createElement("form", _extends({}, rest, {
226
+ onSubmit: this.submit
227
+ }), children));
226
228
  }
227
229
  }]);
228
230
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-mui-form-validator",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Validator for forms designed with material-ui components.",
5
5
  "main": "./lib/index.js",
6
6
  "scripts": {