@steroidsjs/core 3.0.0-beta.106 → 3.0.0-beta.107

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.
@@ -21,10 +21,8 @@ function useSaveCursorPosition(inputParams) {
21
21
  var onChange = react_1["default"].useCallback(function (event, value) {
22
22
  var _a, _b;
23
23
  if (value === void 0) { value = null; }
24
- if (event) {
25
- setCursor((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.selectionStart);
26
- }
27
- inputParams.onChange.call(null, value || ((_b = event === null || event === void 0 ? void 0 : event.target) === null || _b === void 0 ? void 0 : _b.value));
24
+ setCursor((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.selectionStart);
25
+ inputParams.onChange(value || ((_b = event.target) === null || _b === void 0 ? void 0 : _b.value));
28
26
  }, [inputParams]);
29
27
  return {
30
28
  inputRef: inputRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "3.0.0-beta.106",
3
+ "version": "3.0.0-beta.107",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -97,18 +97,11 @@ function InputField(props) {
97
97
  }
98
98
  }, [inputRef, maskedInputRef]);
99
99
  (0, useInputFieldWarningByType_1.useInputFieldWarningByType)(props.type);
100
- var onChangeHandle = (0, react_1.useCallback)(function (e, value) {
101
- var _a;
102
- var currentValue = value !== null && value !== void 0 ? value : (_a = e.target) === null || _a === void 0 ? void 0 : _a.value;
103
- if (props.onChange) {
104
- props.onChange(e, currentValue);
105
- }
106
- }, [props]);
107
- var onClear = React.useCallback(function () { return onChangeHandle(null, ''); }, [onChangeHandle]);
100
+ var onClear = React.useCallback(function () { return props.input.onChange(''); }, [props.input]);
108
101
  var inputProps = (0, react_1.useMemo)(function () {
109
102
  var _a;
110
- return (__assign({ type: props.type, name: props.input.name, value: (_a = props.input.value) !== null && _a !== void 0 ? _a : '', onInput: onChangeHandle, placeholder: props.placeholder, disabled: props.disabled }, props.inputProps));
111
- }, [onChangeHandle, props.disabled, props.input.name, props.input.value, props.inputProps, props.placeholder, props.type]);
103
+ return (__assign({ type: props.type, name: props.input.name, value: (_a = props.input.value) !== null && _a !== void 0 ? _a : '', onInput: onChange, placeholder: props.placeholder, disabled: props.disabled }, props.inputProps));
104
+ }, [onChange, props.disabled, props.input.name, props.input.value, props.inputProps, props.placeholder, props.type]);
112
105
  // No render for hidden input
113
106
  if (props.type === 'hidden') {
114
107
  return null;