@ultraviolet/ui 1.27.0 → 1.27.1

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/dist/index.d.ts CHANGED
@@ -1821,7 +1821,7 @@ type NumberInputProps = {
1821
1821
  */
1822
1822
  text?: string;
1823
1823
  defaultValue?: number;
1824
- value?: number;
1824
+ value?: number | null;
1825
1825
  disabledTooltip?: string;
1826
1826
  className?: string;
1827
1827
  'data-testid'?: string;
@@ -181,7 +181,7 @@ const NumberInput = _ref21 => {
181
181
  }
182
182
  return defaultValue;
183
183
  });
184
- const currentValue = value !== undefined ? value : inputValue;
184
+ const currentValue = value !== undefined && value !== null ? value : inputValue;
185
185
  const setValue = function (newValue,
186
186
  /**
187
187
  * If true, will check if newValue is between minValue and maxValue and set it to minValue or maxValue if it's not.
@@ -190,20 +190,17 @@ const NumberInput = _ref21 => {
190
190
  if (hasMinMaxVerification === void 0) {
191
191
  hasMinMaxVerification = true;
192
192
  }
193
- if (value === undefined) {
194
- if (hasMinMaxVerification) {
195
- if (newValue !== undefined && newValue < minValue) {
196
- setInputValue(minValue);
197
- return;
198
- }
199
- if (newValue !== undefined && maxValue !== undefined && newValue > maxValue) {
200
- setInputValue(maxValue);
201
- return;
202
- }
193
+ let nextValue = newValue;
194
+ if (value === undefined && hasMinMaxVerification) {
195
+ if (newValue !== undefined && newValue < minValue) {
196
+ nextValue = minValue;
197
+ }
198
+ if (newValue !== undefined && maxValue !== undefined && newValue > maxValue) {
199
+ nextValue = maxValue;
203
200
  }
204
- setInputValue(newValue);
205
201
  }
206
- onChange?.(newValue);
202
+ setInputValue(nextValue);
203
+ onChange?.(nextValue);
207
204
  };
208
205
  const offsetFn = direction => () => {
209
206
  const localValue = currentValue ?? 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/ui",
3
- "version": "1.27.0",
3
+ "version": "1.27.1",
4
4
  "description": "Ultraviolet UI",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {