@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.es.js CHANGED
@@ -8017,26 +8017,33 @@ var Number$1 = function (props) {
8017
8017
  inputRef.current.value = "".concat(value);
8018
8018
  return value;
8019
8019
  };
8020
+ var onChange = function () {
8021
+ if (!props.disabled && !!props.onChange) {
8022
+ var value = parseInt(inputRef.current.value);
8023
+ props.onChange(value);
8024
+ }
8025
+ };
8026
+ var onBlur = function () {
8027
+ var value = parseInt(inputRef.current.value);
8028
+ var newValue = setValue(value);
8029
+ // If the value has changed, call the onChange callback
8030
+ if (value !== newValue && !!props.onChange)
8031
+ onChange();
8032
+ if (!!props.onBlur)
8033
+ props.onBlur();
8034
+ };
8020
8035
  var decrease = function () {
8021
8036
  var value = parseInt(inputRef.current.value) - 1;
8022
8037
  setValue(value);
8038
+ onChange();
8023
8039
  inputRef.current.focus();
8024
8040
  };
8025
8041
  var increase = function () {
8026
8042
  var value = parseInt(inputRef.current.value) + 1;
8027
8043
  setValue(value);
8044
+ onChange();
8028
8045
  inputRef.current.focus();
8029
8046
  };
8030
- var onChange = function () {
8031
- var value = parseInt(inputRef.current.value);
8032
- var newValue = setValue(value);
8033
- if (!props.disabled && !!props.onChange)
8034
- props.onChange(newValue);
8035
- };
8036
- var onBlur = function () {
8037
- if (!!props.onBlur)
8038
- props.onBlur();
8039
- };
8040
8047
  return (jsxs(Wrapper$6, __assign$2({ disabled: props.disabled }, { children: [jsx$1(Button, { label: "-", disabled: props.disabled, onClick: decrease, tabIndex: -1, type: "button" }), jsx$1(StyledInputNumber, __assign$2({ type: "number" }, props, { defaultValue: props.defaultValue || props.min || 0, onChange: onChange, onBlur: onBlur, ref: inputRef })), jsx$1(Button, { label: "+", disabled: props.disabled, onClick: increase, tabIndex: -1, type: "button" })] })));
8041
8048
  };
8042
8049