@carbon/react 1.85.1 → 1.86.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.
Files changed (189) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +842 -842
  2. package/es/components/AILabel/index.js +1 -1
  3. package/es/components/Accordion/AccordionItem.d.ts +1 -1
  4. package/es/components/Accordion/AccordionItem.js +1 -1
  5. package/es/components/Checkbox/Checkbox.js +1 -1
  6. package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
  7. package/es/components/CodeSnippet/CodeSnippet.d.ts +2 -2
  8. package/es/components/CodeSnippet/CodeSnippet.js +1 -1
  9. package/es/components/ComboBox/ComboBox.js +1 -1
  10. package/es/components/ComposedModal/ComposedModal.js +1 -1
  11. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
  12. package/es/components/ContentSwitcher/ContentSwitcher.js +1 -1
  13. package/es/components/DataTable/DataTable.d.ts +230 -170
  14. package/es/components/DataTable/DataTable.js +508 -519
  15. package/es/components/DataTable/TableContainer.d.ts +9 -1
  16. package/es/components/DataTable/TableContainer.js +7 -1
  17. package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
  18. package/es/components/DataTable/TableExpandHeader.js +1 -1
  19. package/es/components/DataTable/TableSelectAll.d.ts +2 -2
  20. package/es/components/DataTable/TableSelectAll.js +1 -1
  21. package/es/components/DataTable/TableSelectRow.d.ts +2 -2
  22. package/es/components/DataTable/TableSelectRow.js +1 -1
  23. package/es/components/DataTable/TableToolbar.d.ts +1 -1
  24. package/es/components/DataTable/TableToolbar.js +1 -1
  25. package/es/components/DataTable/TableToolbarMenu.d.ts +2 -18
  26. package/es/components/DataTable/TableToolbarMenu.js +0 -1
  27. package/es/components/DataTable/index.d.ts +1 -1
  28. package/es/components/DataTable/state/getDerivedStateFromProps.js +5 -1
  29. package/es/components/DatePicker/DatePicker.js +1 -1
  30. package/es/components/DatePickerInput/DatePickerInput.js +1 -1
  31. package/es/components/Dropdown/Dropdown.js +1 -1
  32. package/es/components/FeatureFlags/index.d.ts +2 -2
  33. package/es/components/FeatureFlags/index.js +1 -1
  34. package/es/components/FileUploader/FileUploaderButton.d.ts +1 -1
  35. package/es/components/FileUploader/FileUploaderButton.js +1 -1
  36. package/es/components/FileUploader/FileUploaderDropContainer.d.ts +2 -2
  37. package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
  38. package/es/components/FluidTextArea/FluidTextArea.d.ts +1 -1
  39. package/es/components/FluidTextArea/FluidTextArea.js +1 -1
  40. package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
  41. package/es/components/ListBox/ListBox.js +1 -1
  42. package/es/components/Loading/Loading.d.ts +1 -1
  43. package/es/components/Loading/Loading.js +1 -1
  44. package/es/components/Menu/Menu.js +1 -1
  45. package/es/components/Modal/Modal.js +1 -1
  46. package/es/components/MultiSelect/FilterableMultiSelect.js +2 -2
  47. package/es/components/MultiSelect/MultiSelect.js +1 -1
  48. package/es/components/Notification/Notification.d.ts +4 -4
  49. package/es/components/Notification/Notification.js +1 -1
  50. package/es/components/NumberInput/NumberInput.d.ts +7 -0
  51. package/es/components/NumberInput/NumberInput.js +80 -25
  52. package/es/components/OverflowMenu/OverflowMenu.d.ts +2 -6
  53. package/es/components/OverflowMenu/OverflowMenu.js +1 -1
  54. package/es/components/Pagination/Pagination.js +22 -5
  55. package/es/components/RadioButton/RadioButton.js +1 -1
  56. package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  57. package/es/components/RadioTile/RadioTile.js +1 -1
  58. package/es/components/Search/Search.js +1 -1
  59. package/es/components/Select/Select.js +1 -1
  60. package/es/components/Slider/Slider.js +1 -1
  61. package/es/components/StructuredList/StructuredList.d.ts +5 -5
  62. package/es/components/StructuredList/StructuredList.js +1 -1
  63. package/es/components/Tabs/Tabs.d.ts +1 -1
  64. package/es/components/Tabs/Tabs.js +1 -1
  65. package/es/components/Tag/DismissibleTag.js +1 -1
  66. package/es/components/Tag/Tag.js +1 -1
  67. package/es/components/TextArea/TextArea.js +1 -1
  68. package/es/components/TextInput/ControlledPasswordInput.js +1 -1
  69. package/es/components/TextInput/PasswordInput.js +1 -1
  70. package/es/components/TextInput/TextInput.js +1 -1
  71. package/es/components/Tile/Tile.js +1 -1
  72. package/es/components/TileGroup/TileGroup.d.ts +5 -5
  73. package/es/components/TimePicker/TimePicker.d.ts +8 -0
  74. package/es/components/TimePicker/TimePicker.js +6 -4
  75. package/es/components/Tooltip/DefinitionTooltip.d.ts +1 -1
  76. package/es/components/Tooltip/DefinitionTooltip.js +1 -1
  77. package/es/components/TreeView/TreeContext.d.ts +19 -0
  78. package/es/components/TreeView/TreeContext.js +13 -0
  79. package/es/components/TreeView/TreeNode.d.ts +4 -4
  80. package/es/components/TreeView/TreeNode.js +56 -108
  81. package/es/components/TreeView/TreeView.js +42 -79
  82. package/es/components/UIShell/HeaderMenu.js +1 -1
  83. package/es/components/UIShell/HeaderMenuItem.d.ts +1 -1
  84. package/es/components/UIShell/HeaderMenuItem.js +1 -1
  85. package/es/components/UIShell/HeaderName.d.ts +1 -1
  86. package/es/components/UIShell/Link.d.ts +2 -2
  87. package/es/components/UIShell/Link.js +1 -1
  88. package/es/components/UIShell/Switcher.d.ts +1 -1
  89. package/es/components/UIShell/Switcher.js +39 -12
  90. package/es/index.js +1 -1
  91. package/es/internal/useNoInteractiveChildren.d.ts +25 -0
  92. package/es/internal/useNoInteractiveChildren.js +39 -32
  93. package/es/prop-types/deprecate.d.ts +17 -0
  94. package/es/prop-types/deprecate.js +22 -12
  95. package/lib/components/AILabel/index.js +2 -2
  96. package/lib/components/Accordion/AccordionItem.d.ts +1 -1
  97. package/lib/components/Accordion/AccordionItem.js +1 -1
  98. package/lib/components/Checkbox/Checkbox.js +1 -1
  99. package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
  100. package/lib/components/CodeSnippet/CodeSnippet.d.ts +2 -2
  101. package/lib/components/CodeSnippet/CodeSnippet.js +2 -2
  102. package/lib/components/ComboBox/ComboBox.js +3 -3
  103. package/lib/components/ComposedModal/ComposedModal.js +1 -1
  104. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
  105. package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
  106. package/lib/components/DataTable/DataTable.d.ts +230 -170
  107. package/lib/components/DataTable/DataTable.js +507 -518
  108. package/lib/components/DataTable/TableContainer.d.ts +9 -1
  109. package/lib/components/DataTable/TableContainer.js +7 -1
  110. package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
  111. package/lib/components/DataTable/TableExpandHeader.js +1 -1
  112. package/lib/components/DataTable/TableSelectAll.d.ts +2 -2
  113. package/lib/components/DataTable/TableSelectAll.js +1 -1
  114. package/lib/components/DataTable/TableSelectRow.d.ts +2 -2
  115. package/lib/components/DataTable/TableSelectRow.js +1 -1
  116. package/lib/components/DataTable/TableToolbar.d.ts +1 -1
  117. package/lib/components/DataTable/TableToolbar.js +1 -1
  118. package/lib/components/DataTable/TableToolbarMenu.d.ts +2 -18
  119. package/lib/components/DataTable/TableToolbarMenu.js +0 -1
  120. package/lib/components/DataTable/index.d.ts +1 -1
  121. package/lib/components/DataTable/state/getDerivedStateFromProps.js +5 -1
  122. package/lib/components/DatePicker/DatePicker.js +1 -1
  123. package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
  124. package/lib/components/Dropdown/Dropdown.js +3 -3
  125. package/lib/components/FeatureFlags/index.d.ts +2 -2
  126. package/lib/components/FeatureFlags/index.js +1 -1
  127. package/lib/components/FileUploader/FileUploaderButton.d.ts +1 -1
  128. package/lib/components/FileUploader/FileUploaderButton.js +1 -1
  129. package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +2 -2
  130. package/lib/components/FileUploader/FileUploaderDropContainer.js +2 -2
  131. package/lib/components/FluidTextArea/FluidTextArea.d.ts +1 -1
  132. package/lib/components/FluidTextArea/FluidTextArea.js +1 -1
  133. package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
  134. package/lib/components/ListBox/ListBox.js +1 -1
  135. package/lib/components/Loading/Loading.d.ts +1 -1
  136. package/lib/components/Loading/Loading.js +1 -1
  137. package/lib/components/Menu/Menu.js +1 -1
  138. package/lib/components/Modal/Modal.js +1 -1
  139. package/lib/components/MultiSelect/FilterableMultiSelect.js +5 -5
  140. package/lib/components/MultiSelect/MultiSelect.js +2 -2
  141. package/lib/components/Notification/Notification.d.ts +4 -4
  142. package/lib/components/Notification/Notification.js +4 -4
  143. package/lib/components/NumberInput/NumberInput.d.ts +7 -0
  144. package/lib/components/NumberInput/NumberInput.js +81 -26
  145. package/lib/components/OverflowMenu/OverflowMenu.d.ts +2 -6
  146. package/lib/components/OverflowMenu/OverflowMenu.js +2 -2
  147. package/lib/components/Pagination/Pagination.js +21 -4
  148. package/lib/components/RadioButton/RadioButton.js +1 -1
  149. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  150. package/lib/components/RadioTile/RadioTile.js +2 -2
  151. package/lib/components/Search/Search.js +1 -1
  152. package/lib/components/Select/Select.js +2 -2
  153. package/lib/components/Slider/Slider.js +1 -1
  154. package/lib/components/StructuredList/StructuredList.d.ts +5 -5
  155. package/lib/components/StructuredList/StructuredList.js +4 -4
  156. package/lib/components/Tabs/Tabs.d.ts +1 -1
  157. package/lib/components/Tabs/Tabs.js +1 -1
  158. package/lib/components/Tag/DismissibleTag.js +1 -1
  159. package/lib/components/Tag/Tag.js +4 -4
  160. package/lib/components/TextArea/TextArea.js +2 -2
  161. package/lib/components/TextInput/ControlledPasswordInput.js +1 -1
  162. package/lib/components/TextInput/PasswordInput.js +1 -1
  163. package/lib/components/TextInput/TextInput.js +2 -2
  164. package/lib/components/Tile/Tile.js +9 -9
  165. package/lib/components/TileGroup/TileGroup.d.ts +5 -5
  166. package/lib/components/TimePicker/TimePicker.d.ts +8 -0
  167. package/lib/components/TimePicker/TimePicker.js +6 -4
  168. package/lib/components/Tooltip/DefinitionTooltip.d.ts +1 -1
  169. package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
  170. package/lib/components/TreeView/TreeContext.d.ts +19 -0
  171. package/lib/components/TreeView/TreeContext.js +18 -0
  172. package/lib/components/TreeView/TreeNode.d.ts +4 -4
  173. package/lib/components/TreeView/TreeNode.js +55 -107
  174. package/lib/components/TreeView/TreeView.js +41 -78
  175. package/lib/components/UIShell/HeaderMenu.js +1 -1
  176. package/lib/components/UIShell/HeaderMenuItem.d.ts +1 -1
  177. package/lib/components/UIShell/HeaderMenuItem.js +1 -1
  178. package/lib/components/UIShell/HeaderName.d.ts +1 -1
  179. package/lib/components/UIShell/Link.d.ts +2 -2
  180. package/lib/components/UIShell/Link.js +1 -1
  181. package/lib/components/UIShell/Switcher.d.ts +1 -1
  182. package/lib/components/UIShell/Switcher.js +38 -11
  183. package/lib/index.js +1 -1
  184. package/lib/internal/useNoInteractiveChildren.d.ts +25 -0
  185. package/lib/internal/useNoInteractiveChildren.js +39 -32
  186. package/lib/prop-types/deprecate.d.ts +17 -0
  187. package/lib/prop-types/deprecate.js +22 -12
  188. package/package.json +3 -3
  189. package/telemetry.yml +15 -14
@@ -58,7 +58,6 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
58
58
  decorator,
59
59
  disabled = false,
60
60
  disableWheel: disableWheelProp = false,
61
- defaultValue = 0,
62
61
  formatOptions,
63
62
  helperText = '',
64
63
  hideLabel = false,
@@ -73,6 +72,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
73
72
  locale = 'en-US',
74
73
  max,
75
74
  min,
75
+ onBlur,
76
76
  onChange,
77
77
  onClick,
78
78
  onKeyUp,
@@ -83,6 +83,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
83
83
  step = 1,
84
84
  translateWithId: t = id => defaultTranslations[id],
85
85
  type = 'number',
86
+ defaultValue = type === 'number' ? 0 : NaN,
86
87
  warn = false,
87
88
  warnText = '',
88
89
  value: controlledValue,
@@ -122,6 +123,12 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
122
123
  value: typeof controlledValue === 'string' ? numberParser.parse(controlledValue) : controlledValue
123
124
  });
124
125
 
126
+ /**
127
+ * The number value that was previously "committed" to the input on blur
128
+ * Only used when type="text"
129
+ */
130
+ const [previousNumberValue, setPreviousNumberValue] = React.useState(numberValue);
131
+
125
132
  /**
126
133
  * The current text value of the input.
127
134
  * Only used when type=text
@@ -134,6 +141,10 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
134
141
  numberingSystem
135
142
  }), [locale, formatOptions, numberingSystem]);
136
143
  const format = React.useCallback(value => isNaN(value) || value === null ? '' : numberFormatter.format(value), [numberFormatter]);
144
+ if (isControlled && !(isNaN(previousNumberValue) && isNaN(numberValue)) && previousNumberValue !== numberValue) {
145
+ setInputValue(format(numberValue));
146
+ setPreviousNumberValue(numberValue);
147
+ }
137
148
  const inputRef = React.useRef(null);
138
149
  const ref = useMergedRefs.useMergedRefs([forwardRef, inputRef]);
139
150
  const numberInputClasses = cx__default["default"]({
@@ -171,7 +182,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
171
182
  [`${prefix}--number__invalid`]: normalizedProps.invalid || normalizedProps.warn,
172
183
  [`${prefix}--number__invalid--warning`]: normalizedProps.warn
173
184
  });
174
- if (controlledValue !== prevControlledValue) {
185
+ if (controlledValue !== prevControlledValue && !(isNaN(Number(controlledValue)) === isNaN(Number(prevControlledValue)))) {
175
186
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
176
187
  setValue(controlledValue);
177
188
  setPrevControlledValue(controlledValue);
@@ -203,6 +214,8 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
203
214
  }
204
215
  if (type === 'text') {
205
216
  const _value = allowEmpty && event.target.value === '' ? '' : event.target.value;
217
+
218
+ // When isControlled, setNumberValue will not update numberValue in useControllableState.
206
219
  setNumberValue(numberParser.parse(_value));
207
220
  setInputValue(_value);
208
221
  // The onChange prop isn't called here because it will be called on blur
@@ -231,30 +244,46 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
231
244
  };
232
245
  const handleStep = (event, direction) => {
233
246
  if (inputRef.current) {
234
- const currentValue = type === 'number' ? Number(inputRef.current.value) : numberParser.parse(inputRef.current.value);
235
- const rawValue = direction === 'up' ? currentValue + step : currentValue - step;
247
+ const currentValue = type === 'number' ? Number(inputRef.current.value) : numberValue;
248
+ let rawValue;
249
+ if (Number.isNaN(currentValue)) {
250
+ // When the field is empty (NaN), incrementing begins at min,
251
+ // decrementing begins at max.
252
+ // When there's no min or max to use, it begins at 0.
253
+ if (direction === `up` && min) {
254
+ rawValue = min;
255
+ } else if (direction === `down` && max) {
256
+ rawValue = max;
257
+ } else {
258
+ rawValue = 0;
259
+ }
260
+ } else if (direction === 'up') {
261
+ rawValue = currentValue + step;
262
+ } else {
263
+ rawValue = currentValue - step;
264
+ }
236
265
  const precision = Math.max(getDecimalPlaces(currentValue), getDecimalPlaces(step));
237
266
  const floatValue = parseFloat(rawValue.toFixed(precision));
238
267
  const newValue = clamp.clamp(floatValue, min ?? -Infinity, max ?? Infinity);
239
- let state;
268
+ const state = {
269
+ value: newValue,
270
+ direction
271
+ };
240
272
  if (type === 'number') {
241
- state = {
242
- value: allowEmpty && inputRef.current.value === '' && step === 0 ? '' : newValue,
243
- direction
244
- };
245
273
  setValue(state.value);
246
274
  }
247
275
  if (type === 'text') {
276
+ // Calling format() can alter the number (such as rounding it) causing
277
+ // the numberValue to mismatch the formatted value in the input.
278
+ // To avoid this, the newValue is re-parsed after formatting.
248
279
  const formattedNewValue = format(newValue);
249
- state = {
250
- value: allowEmpty && inputRef.current.value === '' && step === 0 ? '' : formattedNewValue,
251
- direction
252
- };
280
+ const parsedFormattedNewValue = numberParser.parse(formattedNewValue);
253
281
 
254
- // newValue does not need to be parsed because it is derived from
255
- // currentValue, which is parsed at the beginning of this function
256
- setNumberValue(newValue);
282
+ // When isControlled, setNumberValue will not actually update
283
+ // numberValue in useControllableState.
284
+ setNumberValue(parsedFormattedNewValue);
257
285
  setInputValue(formattedNewValue);
286
+ setPreviousNumberValue(parsedFormattedNewValue);
258
287
  }
259
288
  if (onChange) {
260
289
  onChange(event, state);
@@ -264,9 +293,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
264
293
  };
265
294
  const handleStepperClick = (event, direction) => {
266
295
  if (inputRef.current) {
267
- const {
268
- state
269
- } = handleStep(event, direction);
296
+ const state = handleStep(event, direction);
270
297
  if (onClick) {
271
298
  onClick(event, state);
272
299
  }
@@ -346,16 +373,37 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
346
373
  const _numberValue = isControlled ? numberParser.parse(inputValue) : numberValue;
347
374
  const formattedValue = isNaN(_numberValue) ? '' : format(_numberValue);
348
375
  setInputValue(formattedValue);
376
+
377
+ // Calling format() can alter the number (such as rounding it)
378
+ // causing the _numberValue to mismatch the formatted value in
379
+ // the input. To avoid this, formattedValue is re-parsed.
380
+ const parsedFormattedNewValue = numberParser.parse(formattedValue);
349
381
  if (onChange) {
350
382
  const state = {
351
- value: formattedValue,
352
- direction: value < e.target.value ? 'up' : 'down'
383
+ value: parsedFormattedNewValue,
384
+ direction: previousNumberValue < parsedFormattedNewValue ? 'up' : 'down'
353
385
  };
354
- onChange(e, state);
386
+
387
+ // If the old and new values are NaN, don't call onChange
388
+ // to avoid an unecessary re-render and potential infinite
389
+ // loop when isControlled.
390
+ if (!(isNaN(previousNumberValue) && isNaN(parsedFormattedNewValue))) {
391
+ onChange(e, state);
392
+ }
393
+ }
394
+
395
+ // If the old and new values are NaN, don't set state to avoid
396
+ // an unecessary re-render and potential infinite loop when
397
+ // isControlled.
398
+ if (!(isNaN(previousNumberValue) && isNaN(numberValue))) {
399
+ setPreviousNumberValue(numberValue);
400
+ }
401
+ if (!(isNaN(numberValue) && isNaN(parsedFormattedNewValue))) {
402
+ setNumberValue(parsedFormattedNewValue);
355
403
  }
356
404
  }
357
- if (rest.onBlur) {
358
- rest.onBlur(e);
405
+ if (onBlur) {
406
+ onBlur(e);
359
407
  }
360
408
  },
361
409
  pattern: pattern,
@@ -375,6 +423,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
375
423
  className: `${prefix}--number__control-btn down-icon`,
376
424
  disabled: disabled || readOnly,
377
425
  onClick: event => handleStepperClick(event, 'down'),
426
+ onBlur: onBlur,
378
427
  tabIndex: -1,
379
428
  title: decrementNumLabel || iconDescription,
380
429
  type: "button"
@@ -387,6 +436,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
387
436
  className: `${prefix}--number__control-btn up-icon`,
388
437
  disabled: disabled || readOnly,
389
438
  onClick: event => handleStepperClick(event, 'up'),
439
+ onBlur: onBlur,
390
440
  tabIndex: -1,
391
441
  title: incrementNumLabel || iconDescription,
392
442
  type: "button"
@@ -476,7 +526,7 @@ NumberInput.propTypes = {
476
526
  /**
477
527
  * `true` to use the light version.
478
528
  */
479
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `NumberInput` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.'),
529
+ light: deprecate.deprecate(PropTypes__default["default"].bool, 'The `light` prop for `NumberInput` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.'),
480
530
  /**
481
531
  * **Experimental:** Specify a [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt)
482
532
  * language code for parsing and formatting. Use with `type="text"`, has no
@@ -491,6 +541,11 @@ NumberInput.propTypes = {
491
541
  * The minimum value.
492
542
  */
493
543
  min: PropTypes__default["default"].number,
544
+ /**
545
+ * Provide an optional handler that is called when the input or stepper
546
+ * buttons are blurred.
547
+ */
548
+ onBlur: PropTypes__default["default"].func,
494
549
  /**
495
550
  * Provide an optional handler that is called when the internal state of
496
551
  * NumberInput changes. This handler is called with event and state info.
@@ -525,7 +580,7 @@ NumberInput.propTypes = {
525
580
  * **Experimental**: Provide a `Slug` component to be rendered inside the
526
581
  * `NumberInput` component
527
582
  */
528
- slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop for `NumberInput` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `decorator` prop. It will be moved in the next major release.'),
583
+ slug: deprecate.deprecate(PropTypes__default["default"].node, 'The `slug` prop for `NumberInput` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `decorator` prop. It will be moved in the next major release.'),
529
584
  /**
530
585
  * Specify how much the values should increase/decrease upon clicking on
531
586
  * up/down button
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import React, { type ElementType, type ReactNode, type Ref } from 'react';
8
8
  import { type MenuDirection, type MenuOffset } from '../../internal/FloatingMenu';
9
- import { PopoverAlignment } from '../Popover';
9
+ import { IconButtonProps } from '../IconButton';
10
10
  /**
11
11
  * Calculates the offset for the floating menu.
12
12
  *
@@ -16,11 +16,7 @@ import { PopoverAlignment } from '../Popover';
16
16
  * the menu arrow.
17
17
  */
18
18
  export declare const getMenuOffset: MenuOffset;
19
- export interface OverflowMenuProps {
20
- /**
21
- * Specify how the trigger tooltip should be aligned.
22
- */
23
- align?: PopoverAlignment;
19
+ export interface OverflowMenuProps extends Omit<IconButtonProps, 'type' | 'aria-haspopup' | 'aria-expanded' | 'aria-controls' | 'className' | 'onClick' | 'id' | 'ref' | 'size' | 'label' | 'kind'> {
24
20
  /**
25
21
  * Specify a label to be read by screen readers on the container node
26
22
  */
@@ -383,7 +383,7 @@ OverflowMenu.propTypes = {
383
383
  * Deprecated, please use `aria-label` instead.
384
384
  * Specify a label to be read by screen readers on the container note.
385
385
  */
386
- ariaLabel: deprecate["default"](PropTypes__default["default"].string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
386
+ ariaLabel: deprecate.deprecate(PropTypes__default["default"].string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
387
387
  /**
388
388
  * The child nodes.
389
389
  */
@@ -420,7 +420,7 @@ OverflowMenu.propTypes = {
420
420
  * `true` to use the light version. For use on $ui-01 backgrounds only.
421
421
  * Don't use this to make OverflowMenu background color same as container background color.
422
422
  */
423
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `OverflowMenu` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead.'),
423
+ light: deprecate.deprecate(PropTypes__default["default"].bool, 'The `light` prop for `OverflowMenu` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead.'),
424
424
  /**
425
425
  * The adjustment in position applied to the floating menu.
426
426
  */
@@ -94,6 +94,7 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
94
94
  const [prevPageSizes, setPrevPageSizes] = React.useState(controlledPageSizes);
95
95
  const [page, setPage] = React.useState(controlledPage);
96
96
  const [prevControlledPage, setPrevControlledPage] = React.useState(controlledPage);
97
+ const [focusTarget, setFocusTarget] = React.useState(null);
97
98
  const [pageSize, setPageSize] = React.useState(() => {
98
99
  return getPageSize(pageSizes, controlledPageSize);
99
100
  });
@@ -117,6 +118,22 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
117
118
  [`${prefix}--pagination__button--no-index`]: forwardButtonDisabled
118
119
  });
119
120
  const selectItems = renderSelectItems(totalPages);
121
+ const focusMap = {
122
+ backward: backBtnRef,
123
+ forward: forwardBtnRef
124
+ };
125
+ const handleFocus = target => {
126
+ const targetRef = focusMap[target];
127
+ if (targetRef?.current && !targetRef.current.disabled) {
128
+ targetRef.current.focus();
129
+ }
130
+ };
131
+ React.useEffect(() => {
132
+ if (focusTarget) {
133
+ handleFocus(focusTarget);
134
+ setFocusTarget(null);
135
+ }
136
+ }, [focusTarget]);
120
137
 
121
138
  // Sync state with props
122
139
  if (controlledPage !== prevControlledPage) {
@@ -173,8 +190,8 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
173
190
  // the icon button becomes disabled and the focus shifts to `main`
174
191
  // this presents an a11y problem for keyboard & screen reader users
175
192
  // instead, we want the focus to shift to the other pagination btn
176
- if (nextPage === totalPages && backBtnRef?.current) {
177
- backBtnRef.current.focus();
193
+ if (nextPage === totalPages) {
194
+ setFocusTarget('backward');
178
195
  }
179
196
  if (onChange) {
180
197
  onChange({
@@ -192,8 +209,8 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
192
209
  // the icon button becomes disabled and the focus shifts to `main`
193
210
  // this presents an a11y problem for keyboard & screen reader users
194
211
  // instead, we want the focus to shift to the other pagination btn
195
- if (nextPage === 1 && forwardBtnRef?.current) {
196
- forwardBtnRef.current.focus();
212
+ if (nextPage === 1) {
213
+ setFocusTarget('forward');
197
214
  }
198
215
  if (onChange) {
199
216
  onChange({
@@ -147,7 +147,7 @@ RadioButton.propTypes = {
147
147
  /**
148
148
  * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButton` component
149
149
  */
150
- slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
150
+ slug: deprecate.deprecate(PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
151
151
  /**
152
152
  * Specify the value of the `<RadioButton>`
153
153
  */
@@ -211,7 +211,7 @@ RadioButtonGroup.propTypes = {
211
211
  /**
212
212
  * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
213
213
  */
214
- slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
214
+ slug: deprecate.deprecate(PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
215
215
  /**
216
216
  * Specify the value that is currently selected in the group
217
217
  */
@@ -148,7 +148,7 @@ RadioTile.propTypes = {
148
148
  * `true` to use the light version. For use on `$layer-01` backgrounds only.
149
149
  * Don't use this to make tile background color same as container background color.
150
150
  */
151
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `RadioTile` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be removed in the next major release.'),
151
+ light: deprecate.deprecate(PropTypes__default["default"].bool, 'The `light` prop for `RadioTile` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be removed in the next major release.'),
152
152
  /**
153
153
  * Provide a `name` for the underlying `<input>`.
154
154
  */
@@ -165,7 +165,7 @@ RadioTile.propTypes = {
165
165
  /**
166
166
  * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioTile` component
167
167
  */
168
- slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop for `RadioTile` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
168
+ slug: deprecate.deprecate(PropTypes__default["default"].node, 'The `slug` prop for `RadioTile` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
169
169
  /**
170
170
  * Specify the tab index of the underlying `<input>`.
171
171
  */
@@ -220,7 +220,7 @@ Search.propTypes = {
220
220
  /**
221
221
  * Specify light version or default version of this control
222
222
  */
223
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `Search` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.'),
223
+ light: deprecate.deprecate(PropTypes__default["default"].bool, 'The `light` prop for `Search` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.'),
224
224
  /**
225
225
  * Optional callback called when the search value changes.
226
226
  */
@@ -249,7 +249,7 @@ Select.propTypes = {
249
249
  * `true` to use the light version. For use on $ui-01 backgrounds only.
250
250
  * Don't use this to make tile background color same as container background color.
251
251
  */
252
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `Select` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.'),
252
+ light: deprecate.deprecate(PropTypes__default["default"].bool, 'The `light` prop for `Select` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.'),
253
253
  /**
254
254
  * Reserved for use with Pagination component. Will not render a label for the
255
255
  * select since Pagination renders one for us.
@@ -268,7 +268,7 @@ Select.propTypes = {
268
268
  * Specify the size of the Select Input.
269
269
  */
270
270
  size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
271
- slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
271
+ slug: deprecate.deprecate(PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
272
272
  /**
273
273
  * Specify whether the control is currently in warning state
274
274
  */
@@ -1192,7 +1192,7 @@ Slider.propTypes = {
1192
1192
  /**
1193
1193
  * `true` to use the light version.
1194
1194
  */
1195
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `Slider` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.'),
1195
+ light: deprecate.deprecate(PropTypes__default["default"].bool, 'The `light` prop for `Slider` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.'),
1196
1196
  /**
1197
1197
  * The maximum value.
1198
1198
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -44,7 +44,7 @@ export declare namespace StructuredListWrapper {
44
44
  * Deprecated, please use `aria-label` instead.
45
45
  * Specify a label to be read by screen readers on the container note.
46
46
  */
47
- ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
47
+ ariaLabel: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
48
48
  /**
49
49
  * Provide the contents of your StructuredListWrapper
50
50
  */
@@ -167,7 +167,7 @@ export declare namespace StructuredListRow {
167
167
  /**
168
168
  * Specify whether a `<label>` should be used
169
169
  */
170
- label: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
170
+ label: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
171
171
  /**
172
172
  * Provide a handler that is invoked on the click
173
173
  */
@@ -214,7 +214,7 @@ export declare namespace StructuredListInput {
214
214
  /**
215
215
  * Specify whether the underlying input should be checked by default
216
216
  */
217
- defaultChecked: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
217
+ defaultChecked: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
218
218
  /**
219
219
  * Specify a custom `id` for the input
220
220
  */
@@ -234,7 +234,7 @@ export declare namespace StructuredListInput {
234
234
  /**
235
235
  * Specify the value of the input
236
236
  */
237
- value: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
237
+ value: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
238
238
  };
239
239
  }
240
240
  export interface StructuredListCellProps extends DivAttrs {
@@ -69,7 +69,7 @@ StructuredListWrapper.propTypes = {
69
69
  * Deprecated, please use `aria-label` instead.
70
70
  * Specify a label to be read by screen readers on the container note.
71
71
  */
72
- ariaLabel: deprecate["default"](PropTypes__default["default"].string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
72
+ ariaLabel: deprecate.deprecate(PropTypes__default["default"].string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
73
73
  /**
74
74
  * Provide the contents of your StructuredListWrapper
75
75
  */
@@ -224,7 +224,7 @@ StructuredListRow.propTypes = {
224
224
  /**
225
225
  * Specify whether a `<label>` should be used
226
226
  */
227
- label: deprecate["default"](PropTypes__default["default"].bool, `\nThe \`label\` prop is no longer needed and will be removed in the next major version of Carbon.`),
227
+ label: deprecate.deprecate(PropTypes__default["default"].bool, `\nThe \`label\` prop is no longer needed and will be removed in the next major version of Carbon.`),
228
228
  /**
229
229
  * Provide a handler that is invoked on the click
230
230
  */
@@ -276,7 +276,7 @@ StructuredListInput.propTypes = {
276
276
  /**
277
277
  * Specify whether the underlying input should be checked by default
278
278
  */
279
- defaultChecked: deprecate["default"](PropTypes__default["default"].bool, `\nThe prop \`defaultChecked\` is no longer needed and will be removed in the next major version of Carbon.`),
279
+ defaultChecked: deprecate.deprecate(PropTypes__default["default"].bool, `\nThe prop \`defaultChecked\` is no longer needed and will be removed in the next major version of Carbon.`),
280
280
  /**
281
281
  * Specify a custom `id` for the input
282
282
  */
@@ -296,7 +296,7 @@ StructuredListInput.propTypes = {
296
296
  /**
297
297
  * Specify the value of the input
298
298
  */
299
- value: deprecate["default"](PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]).isRequired, `\nThe prop \`value\` will be removed in the next major version of Carbon.`)
299
+ value: deprecate.deprecate(PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]).isRequired, `\nThe prop \`value\` will be removed in the next major version of Carbon.`)
300
300
  };
301
301
  function StructuredListCell(props) {
302
302
  const {
@@ -234,7 +234,7 @@ declare namespace TabList {
234
234
  /**
235
235
  * Specify whether to use the light component variant
236
236
  */
237
- light: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
237
+ light: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
238
238
  /**
239
239
  * Provide the props that describe the right overflow button
240
240
  */
@@ -558,7 +558,7 @@ TabList.propTypes = {
558
558
  /**
559
559
  * Specify whether to use the light component variant
560
560
  */
561
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `TabList` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
561
+ light: deprecate.deprecate(PropTypes__default["default"].bool, 'The `light` prop for `TabList` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
562
562
  /**
563
563
  * Provide the props that describe the right overflow button
564
564
  */
@@ -147,7 +147,7 @@ DismissibleTag.propTypes = {
147
147
  /**
148
148
  * **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
149
149
  */
150
- slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
150
+ slug: deprecate.deprecate(PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
151
151
  /**
152
152
  * Provide text to be rendered inside of a the tag.
153
153
  */
@@ -183,7 +183,7 @@ Tag.propTypes = {
183
183
  /**
184
184
  * Determine if `Tag` is a filter/chip
185
185
  */
186
- filter: deprecate["default"](PropTypes__default["default"].bool, 'The `filter` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
186
+ filter: deprecate.deprecate(PropTypes__default["default"].bool, 'The `filter` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
187
187
  /**
188
188
  * Specify the id for the tag.
189
189
  */
@@ -191,7 +191,7 @@ Tag.propTypes = {
191
191
  /**
192
192
  * Click handler for filter tag close button.
193
193
  */
194
- onClose: deprecate["default"](PropTypes__default["default"].func, 'The `onClose` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
194
+ onClose: deprecate.deprecate(PropTypes__default["default"].func, 'The `onClose` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
195
195
  /**
196
196
  * A component used to render an icon.
197
197
  */
@@ -204,11 +204,11 @@ Tag.propTypes = {
204
204
  /**
205
205
  * **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
206
206
  */
207
- slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
207
+ slug: deprecate.deprecate(PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
208
208
  /**
209
209
  * Text to show on clear filters
210
210
  */
211
- title: deprecate["default"](PropTypes__default["default"].string, 'The `title` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
211
+ title: deprecate.deprecate(PropTypes__default["default"].string, 'The `title` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
212
212
  /**
213
213
  * Specify the type of the `Tag`
214
214
  */
@@ -358,7 +358,7 @@ TextArea.propTypes = {
358
358
  * `true` to use the light version. For use on $ui-01 backgrounds only.
359
359
  * Don't use this to make tile background color same as container background color.
360
360
  */
361
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `TextArea` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
361
+ light: deprecate.deprecate(PropTypes__default["default"].bool, 'The `light` prop for `TextArea` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
362
362
  /**
363
363
  * Max entity count allowed for the textarea. This is needed in order for enableCounter to display
364
364
  */
@@ -393,7 +393,7 @@ TextArea.propTypes = {
393
393
  /**
394
394
  * **Experimental**: Provide a `Slug` component to be rendered inside the `TextArea` component
395
395
  */
396
- slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop for `TextArea` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
396
+ slug: deprecate.deprecate(PropTypes__default["default"].node, 'The `slug` prop for `TextArea` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
397
397
  /**
398
398
  * Provide the current value of the `<textarea>`
399
399
  */
@@ -178,7 +178,7 @@ ControlledPasswordInput.propTypes = {
178
178
  * `true` to use the light version. For use on $ui-01 backgrounds only.
179
179
  * Don't use this to make tile background color same as container background color.
180
180
  */
181
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `ControlledPasswordInput` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
181
+ light: deprecate.deprecate(PropTypes__default["default"].bool, 'The `light` prop for `ControlledPasswordInput` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
182
182
  /**
183
183
  * Optionally provide an `onChange` handler that is called whenever `<input>`
184
184
  * is updated
@@ -260,7 +260,7 @@ PasswordInput.propTypes = {
260
260
  * `true` to use the light version. For use on $ui-01 backgrounds only.
261
261
  * Don't use this to make tile background color same as container background color.
262
262
  */
263
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `PasswordInput` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
263
+ light: deprecate.deprecate(PropTypes__default["default"].bool, 'The `light` prop for `PasswordInput` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
264
264
  /**
265
265
  * Optionally provide an `onChange` handler that is called whenever `<input>`
266
266
  * is updated
@@ -284,7 +284,7 @@ TextInput.propTypes = {
284
284
  * `true` to use the light version. For use on $ui-01 backgrounds only.
285
285
  * Don't use this to make tile background color same as container background color.
286
286
  */
287
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `TextInput` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
287
+ light: deprecate.deprecate(PropTypes__default["default"].bool, 'The `light` prop for `TextInput` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
288
288
  /**
289
289
  * Max character count allowed for the input. This is needed in order for enableCounter to display
290
290
  */
@@ -314,7 +314,7 @@ TextInput.propTypes = {
314
314
  /**
315
315
  * **Experimental**: Provide a `Slug` component to be rendered inside the `TextInput` component
316
316
  */
317
- slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop for `TextInput` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
317
+ slug: deprecate.deprecate(PropTypes__default["default"].node, 'The `slug` prop for `TextInput` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
318
318
  /**
319
319
  * Specify the type of the `<input>`
320
320
  */