@carbon/react 1.104.0-rc.0 → 1.104.1-rc.0

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.
@@ -169,9 +169,7 @@ const NumberInput = React.forwardRef((props, forwardRef) => {
169
169
  */
170
170
  const [value, setValue] = useState(() => {
171
171
  if (controlledValue !== void 0) return controlledValue;
172
- if (defaultValue !== void 0) return defaultValue;
173
- if (allowEmpty) return "";
174
- return 0;
172
+ return defaultValue;
175
173
  });
176
174
  const numberParser = useMemo(() => new NumberParser(locale, formatOptions), [locale, formatOptions]);
177
175
  /**
@@ -301,13 +299,13 @@ const NumberInput = React.forwardRef((props, forwardRef) => {
301
299
  if (inputRef.current) {
302
300
  const currentValue = type === "number" ? Number(inputRef.current.value) : numberValue;
303
301
  let rawValue;
304
- if (Number.isNaN(currentValue) || !currentValue) if (typeof stepStartValue === "number" && stepStartValue) rawValue = stepStartValue;
305
- else if (min && min < 0 && max && max > 0 || !max && !min || max) {
306
- if (direction === `up`) rawValue = 1;
307
- if (direction === `down`) rawValue = -1;
308
- } else if (min && min > 0 && max && max > 0 || min) rawValue = min;
309
- else rawValue = 0;
310
- else if (direction === "up") rawValue = currentValue + step;
302
+ if (Number.isNaN(currentValue) || !currentValue) {
303
+ if (typeof stepStartValue === "number" && stepStartValue) rawValue = stepStartValue;
304
+ else if (min && min < 0 && max && max > 0 || !max && !min || max) {
305
+ if (direction === `up`) rawValue = 1;
306
+ if (direction === `down`) rawValue = -1;
307
+ } else if (min && min > 0 && max && max > 0 || min) rawValue = min;
308
+ } else if (direction === "up") rawValue = currentValue + step;
311
309
  else rawValue = currentValue - step;
312
310
  const precision = Math.max(getDecimalPlaces(currentValue), getDecimalPlaces(step));
313
311
  const newValue = clamp(parseFloat(Number(rawValue).toFixed(precision)), min ?? -Infinity, max ?? Infinity);
@@ -173,9 +173,7 @@ const NumberInput = react.default.forwardRef((props, forwardRef) => {
173
173
  */
174
174
  const [value, setValue] = (0, react.useState)(() => {
175
175
  if (controlledValue !== void 0) return controlledValue;
176
- if (defaultValue !== void 0) return defaultValue;
177
- if (allowEmpty) return "";
178
- return 0;
176
+ return defaultValue;
179
177
  });
180
178
  const numberParser = (0, react.useMemo)(() => new _carbon_utilities.NumberParser(locale, formatOptions), [locale, formatOptions]);
181
179
  /**
@@ -305,13 +303,13 @@ const NumberInput = react.default.forwardRef((props, forwardRef) => {
305
303
  if (inputRef.current) {
306
304
  const currentValue = type === "number" ? Number(inputRef.current.value) : numberValue;
307
305
  let rawValue;
308
- if (Number.isNaN(currentValue) || !currentValue) if (typeof stepStartValue === "number" && stepStartValue) rawValue = stepStartValue;
309
- else if (min && min < 0 && max && max > 0 || !max && !min || max) {
310
- if (direction === `up`) rawValue = 1;
311
- if (direction === `down`) rawValue = -1;
312
- } else if (min && min > 0 && max && max > 0 || min) rawValue = min;
313
- else rawValue = 0;
314
- else if (direction === "up") rawValue = currentValue + step;
306
+ if (Number.isNaN(currentValue) || !currentValue) {
307
+ if (typeof stepStartValue === "number" && stepStartValue) rawValue = stepStartValue;
308
+ else if (min && min < 0 && max && max > 0 || !max && !min || max) {
309
+ if (direction === `up`) rawValue = 1;
310
+ if (direction === `down`) rawValue = -1;
311
+ } else if (min && min > 0 && max && max > 0 || min) rawValue = min;
312
+ } else if (direction === "up") rawValue = currentValue + step;
315
313
  else rawValue = currentValue - step;
316
314
  const precision = Math.max(getDecimalPlaces(currentValue), getDecimalPlaces(step));
317
315
  const newValue = require_clamp.clamp(parseFloat(Number(rawValue).toFixed(precision)), min ?? -Infinity, max ?? Infinity);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/react",
3
3
  "description": "React components for the Carbon Design System",
4
- "version": "1.104.0-rc.0",
4
+ "version": "1.104.1-rc.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -52,11 +52,11 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@babel/runtime": "^7.27.3",
55
- "@carbon/feature-flags": "^1.2.0-rc.0",
56
- "@carbon/icons-react": "^11.77.0-rc.0",
57
- "@carbon/layout": "^11.50.0-rc.0",
58
- "@carbon/styles": "^1.103.0-rc.0",
59
- "@carbon/utilities": "^0.18.0-rc.0",
55
+ "@carbon/feature-flags": "^1.2.0",
56
+ "@carbon/icons-react": "^11.77.1-rc.0",
57
+ "@carbon/layout": "^11.50.0",
58
+ "@carbon/styles": "^1.103.0",
59
+ "@carbon/utilities": "^0.18.0",
60
60
  "@floating-ui/react": "^0.27.4",
61
61
  "@ibm/telemetry-js": "^1.5.0",
62
62
  "classnames": "2.5.1",
@@ -79,7 +79,7 @@
79
79
  "@babel/preset-react": "^7.27.1",
80
80
  "@babel/preset-typescript": "^7.27.1",
81
81
  "@carbon/test-utils": "^10.40.0",
82
- "@carbon/themes": "^11.70.0-rc.0",
82
+ "@carbon/themes": "^11.70.0",
83
83
  "@figma/code-connect": "^1.4.2",
84
84
  "@stackblitz/sdk": "^1.11.0",
85
85
  "@storybook/addon-a11y": "^9.1.8",
@@ -125,5 +125,5 @@
125
125
  "**/*.scss",
126
126
  "**/*.css"
127
127
  ],
128
- "gitHead": "d901529b78f5b70b49309ad45604fa5ec99a2e69"
128
+ "gitHead": "596ff8f5096b02a6f1279128f8366958a62d92b8"
129
129
  }