odaptos_design_system 2.0.263 → 2.0.264

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.
@@ -14,7 +14,7 @@ interface InputProps {
14
14
  required?: boolean | undefined;
15
15
  name?: string;
16
16
  value: number | null;
17
- onChange: (value: number) => void;
17
+ onChange: (value: number | undefined) => void;
18
18
  onBlur?: (event: any) => void;
19
19
  onKeyDown?: () => void;
20
20
  disabled?: boolean;
@@ -95918,7 +95918,18 @@ const NumberField = props => {
95918
95918
  inputProps: inputProps,
95919
95919
  variant: variant,
95920
95920
  onChange: e => {
95921
- var value = isInteger ? parseInt(e.target.value.replace(/[^\d]/g, ''), 10) : parseFloat(e.target.value);
95921
+ const inputValue = e.target.value;
95922
+ // Allow empty string to enable deletion of 0
95923
+ if (inputValue === '') {
95924
+ onChange && onChange(undefined);
95925
+ return;
95926
+ }
95927
+ var value = isInteger ? parseInt(inputValue.replace(/[^\d]/g, ''), 10) : parseFloat(inputValue);
95928
+ // Handle NaN case
95929
+ if (isNaN(value)) {
95930
+ onChange && onChange(undefined);
95931
+ return;
95932
+ }
95922
95933
  if (max && value > max) value = max;
95923
95934
  if (min && value < min) value = min;
95924
95935
  if (min === 0 && value < 0) value = 0;