@typeolymp/ui-components 1.19.4 → 1.19.6

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/build/index.js CHANGED
@@ -8044,26 +8044,33 @@ var Number$1 = function (props) {
8044
8044
  inputRef.current.value = "".concat(value);
8045
8045
  return value;
8046
8046
  };
8047
+ var onChange = function () {
8048
+ if (!props.disabled && !!props.onChange) {
8049
+ var value = parseInt(inputRef.current.value);
8050
+ props.onChange(value);
8051
+ }
8052
+ };
8053
+ var onBlur = function () {
8054
+ var value = parseInt(inputRef.current.value);
8055
+ var newValue = setValue(value);
8056
+ // If the value has changed, call the onChange callback
8057
+ if (value !== newValue && !!props.onChange)
8058
+ onChange();
8059
+ if (!!props.onBlur)
8060
+ props.onBlur();
8061
+ };
8047
8062
  var decrease = function () {
8048
8063
  var value = parseInt(inputRef.current.value) - 1;
8049
8064
  setValue(value);
8065
+ onChange();
8050
8066
  inputRef.current.focus();
8051
8067
  };
8052
8068
  var increase = function () {
8053
8069
  var value = parseInt(inputRef.current.value) + 1;
8054
8070
  setValue(value);
8071
+ onChange();
8055
8072
  inputRef.current.focus();
8056
8073
  };
8057
- var onChange = function () {
8058
- var value = parseInt(inputRef.current.value);
8059
- var newValue = setValue(value);
8060
- if (!props.disabled && !!props.onChange)
8061
- props.onChange(newValue);
8062
- };
8063
- var onBlur = function () {
8064
- if (!!props.onBlur)
8065
- props.onBlur();
8066
- };
8067
8074
  return (jsxRuntime.jsxs(Wrapper$6, __assign$2({ disabled: props.disabled }, { children: [jsxRuntime.jsx(Button, { label: "-", disabled: props.disabled, onClick: decrease, tabIndex: -1, type: "button" }), jsxRuntime.jsx(StyledInputNumber, __assign$2({ type: "number" }, props, { defaultValue: props.defaultValue || props.min || 0, onChange: onChange, onBlur: onBlur, ref: inputRef })), jsxRuntime.jsx(Button, { label: "+", disabled: props.disabled, onClick: increase, tabIndex: -1, type: "button" })] })));
8068
8075
  };
8069
8076