@jobber/components 4.22.0 → 4.22.1

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.
@@ -24,6 +24,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
24
24
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
25
25
 
26
26
  function InputNumberInternal(props, ref) {
27
+ var _a;
27
28
  const inputRef = React.createRef();
28
29
  React.useImperativeHandle(ref, () => ({
29
30
  blur: () => {
@@ -39,7 +40,19 @@ function InputNumberInternal(props, ref) {
39
40
  }
40
41
  },
41
42
  }));
42
- return (React__default["default"].createElement(FormField.FormField, Object.assign({}, props, { type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: getOverLimitMessage }) })));
43
+ return (React__default["default"].createElement(FormField.FormField, Object.assign({}, props, { type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: customValidators((_a = props.validations) === null || _a === void 0 ? void 0 : _a.validate) }) })));
44
+ function customValidators(validators) {
45
+ if (validators == null) {
46
+ return getOverLimitMessage;
47
+ }
48
+ else if (typeof validators === "function") {
49
+ return {
50
+ customValidation: validators,
51
+ getOverLimitMessage,
52
+ };
53
+ }
54
+ return Object.assign(Object.assign({}, validators), { getOverLimitMessage });
55
+ }
43
56
  function handleChange(newValue) {
44
57
  props.onChange && props.onChange(newValue);
45
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "4.22.0",
3
+ "version": "4.22.1",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -83,5 +83,5 @@
83
83
  "> 1%",
84
84
  "IE 10"
85
85
  ],
86
- "gitHead": "a729ddb656cab68baadcb0dcf1f6d58b20b4d8bc"
86
+ "gitHead": "9ade94dbff4f71a8e934d6ce08b33a759330a280"
87
87
  }