@typeolymp/ui-components 1.19.5 → 1.19.7

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.
@@ -8,7 +8,7 @@ export declare type PropsType = {
8
8
  disabled?: boolean;
9
9
  id?: string;
10
10
  onChange?(value: number): void;
11
- onBlur?(): void;
11
+ onBlur?(value?: number): void;
12
12
  };
13
13
  declare const Number: FC<PropsType>;
14
14
  export default Number;
package/build/index.es.js CHANGED
@@ -8017,29 +8017,32 @@ var Number$1 = function (props) {
8017
8017
  inputRef.current.value = "".concat(value);
8018
8018
  return value;
8019
8019
  };
8020
- var decrease = function () {
8021
- var value = parseInt(inputRef.current.value) - 1;
8022
- setValue(value);
8023
- inputRef.current.focus();
8024
- };
8025
- var increase = function () {
8026
- var value = parseInt(inputRef.current.value) + 1;
8027
- setValue(value);
8028
- inputRef.current.focus();
8029
- };
8030
8020
  var onChange = function () {
8031
- var value = parseInt(inputRef.current.value);
8032
- if (!props.disabled && !!props.onChange)
8021
+ if (!props.disabled && !!props.onChange) {
8022
+ var value = parseInt(inputRef.current.value);
8033
8023
  props.onChange(value);
8024
+ }
8034
8025
  };
8035
8026
  var onBlur = function () {
8036
8027
  var value = parseInt(inputRef.current.value);
8037
8028
  var newValue = setValue(value);
8038
8029
  // If the value has changed, call the onChange callback
8039
8030
  if (value !== newValue && !!props.onChange)
8040
- props.onChange(newValue);
8031
+ onChange();
8041
8032
  if (!!props.onBlur)
8042
- props.onBlur();
8033
+ props.onBlur(newValue);
8034
+ };
8035
+ var decrease = function () {
8036
+ var value = parseInt(inputRef.current.value) - 1;
8037
+ setValue(value);
8038
+ onChange();
8039
+ inputRef.current.focus();
8040
+ };
8041
+ var increase = function () {
8042
+ var value = parseInt(inputRef.current.value) + 1;
8043
+ setValue(value);
8044
+ onChange();
8045
+ inputRef.current.focus();
8043
8046
  };
8044
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" })] })));
8045
8048
  };