@carbon/react 1.78.1 → 1.78.2

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 (217) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +764 -764
  2. package/es/components/Accordion/AccordionItem.js +2 -2
  3. package/es/components/Button/Button.d.ts +3 -2
  4. package/es/components/Button/Button.js +2 -1
  5. package/es/components/Button/ButtonBase.js +1 -1
  6. package/es/components/ChatButton/ChatButton.d.ts +3 -2
  7. package/es/components/ChatButton/ChatButton.js +2 -1
  8. package/es/components/ComboBox/ComboBox.js +24 -34
  9. package/es/components/ComposedModal/ComposedModal.js +51 -65
  10. package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
  11. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
  12. package/es/components/ContentSwitcher/ContentSwitcher.js +3 -3
  13. package/es/components/DataTable/TableBatchAction.d.ts +3 -3
  14. package/es/components/DataTable/TableBatchAction.js +1 -1
  15. package/es/components/DataTable/TableContainer.d.ts +1 -1
  16. package/es/components/DataTable/TableContainer.js +3 -3
  17. package/es/components/DataTable/TableExpandHeader.d.ts +5 -6
  18. package/es/components/DataTable/TableToolbarMenu.d.ts +2 -2
  19. package/es/components/DataTable/TableToolbarMenu.js +1 -1
  20. package/es/components/DatePicker/DatePicker.js +2 -2
  21. package/es/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
  22. package/es/components/Dialog/index.d.ts +4 -42
  23. package/es/components/ExpandableSearch/ExpandableSearch.js +2 -2
  24. package/es/components/FeatureFlags/index.d.ts +1 -3
  25. package/es/components/FeatureFlags/index.js +0 -3
  26. package/es/components/FileUploader/FileUploader.d.ts +1 -1
  27. package/es/components/FileUploader/FileUploader.js +2 -2
  28. package/es/components/FileUploader/FileUploaderButton.js +2 -2
  29. package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
  30. package/es/components/FileUploader/FileUploaderDropContainer.js +4 -6
  31. package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
  32. package/es/components/FileUploader/FileUploaderItem.js +2 -2
  33. package/es/components/Grid/CSSGrid.js +14 -18
  34. package/es/components/Grid/FlexGrid.js +6 -7
  35. package/es/components/Grid/GridTypes.d.ts +3 -5
  36. package/es/components/IconButton/index.js +3 -3
  37. package/es/components/Layer/index.d.ts +6 -4
  38. package/es/components/Layer/index.js +6 -5
  39. package/es/components/Link/Link.d.ts +3 -2
  40. package/es/components/Link/Link.js +2 -1
  41. package/es/components/ListBox/ListBoxMenuItem.d.ts +3 -3
  42. package/es/components/ListBox/ListBoxMenuItem.js +15 -37
  43. package/es/components/Menu/Menu.js +2 -2
  44. package/es/components/Menu/MenuItem.d.ts +2 -2
  45. package/es/components/Menu/MenuItem.js +3 -3
  46. package/es/components/Modal/Modal.js +49 -121
  47. package/es/components/Modal/next/index.d.ts +171 -0
  48. package/es/components/ModalWrapper/ModalWrapper.js +1 -1
  49. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
  50. package/es/components/MultiSelect/MultiSelect.js +2 -2
  51. package/es/components/Notification/Notification.d.ts +13 -5
  52. package/es/components/Notification/Notification.js +4 -3
  53. package/es/components/OverflowMenu/OverflowMenu.d.ts +8 -4
  54. package/es/components/OverflowMenu/OverflowMenu.js +3 -3
  55. package/es/components/OverflowMenu/next/index.d.ts +2 -2
  56. package/es/components/OverflowMenu/next/index.js +1 -1
  57. package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  58. package/es/components/ProgressIndicator/ProgressIndicator.js +2 -2
  59. package/es/components/RadioTile/RadioTile.js +2 -2
  60. package/es/components/Search/Search.d.ts +3 -2
  61. package/es/components/Search/Search.js +6 -4
  62. package/es/components/Slider/Slider.d.ts +15 -16
  63. package/es/components/Slider/Slider.js +22 -22
  64. package/es/components/Tabs/Tabs.d.ts +6 -3
  65. package/es/components/Tabs/Tabs.js +9 -8
  66. package/es/components/Tag/DismissibleTag.d.ts +5 -3
  67. package/es/components/Tag/DismissibleTag.js +2 -1
  68. package/es/components/Tag/OperationalTag.d.ts +3 -2
  69. package/es/components/Tag/OperationalTag.js +2 -1
  70. package/es/components/Tag/SelectableTag.d.ts +5 -3
  71. package/es/components/Tag/SelectableTag.js +2 -1
  72. package/es/components/Tag/Tag.d.ts +3 -2
  73. package/es/components/Tag/Tag.js +2 -1
  74. package/es/components/Tile/Tile.d.ts +5 -3
  75. package/es/components/Tile/Tile.js +6 -8
  76. package/es/components/Toggletip/index.js +2 -2
  77. package/es/components/Tooltip/DefinitionTooltip.js +2 -2
  78. package/es/components/Tooltip/Tooltip.d.ts +1 -1
  79. package/es/components/Tooltip/Tooltip.js +2 -2
  80. package/es/components/TreeView/TreeNode.d.ts +5 -3
  81. package/es/components/TreeView/TreeNode.js +4 -3
  82. package/es/components/TreeView/TreeView.js +2 -2
  83. package/es/components/UIShell/HeaderContainer.js +2 -2
  84. package/es/components/UIShell/HeaderMenu.js +2 -2
  85. package/es/components/UIShell/HeaderPanel.js +2 -2
  86. package/es/components/UIShell/SideNav.d.ts +1 -1
  87. package/es/components/UIShell/SideNav.js +2 -2
  88. package/es/components/UIShell/SideNavHeader.d.ts +3 -2
  89. package/es/components/UIShell/SideNavHeader.js +2 -1
  90. package/es/components/UIShell/SideNavLink.d.ts +2 -2
  91. package/es/components/UIShell/SideNavLink.js +1 -1
  92. package/es/components/UIShell/SideNavMenu.d.ts +2 -2
  93. package/es/components/UIShell/SideNavMenu.js +3 -3
  94. package/es/components/UIShell/SwitcherItem.js +2 -2
  95. package/es/internal/FloatingMenu.js +4 -4
  96. package/es/internal/OptimizedResize.js +24 -21
  97. package/es/internal/focus/index.js +15 -0
  98. package/es/internal/keyboard/keys.js +2 -2
  99. package/es/internal/keyboard/match.js +41 -17
  100. package/es/internal/keyboard/navigation.js +27 -15
  101. package/es/internal/useMergedRefs.js +0 -3
  102. package/lib/components/Accordion/AccordionItem.js +2 -2
  103. package/lib/components/Button/Button.d.ts +3 -2
  104. package/lib/components/Button/Button.js +2 -1
  105. package/lib/components/Button/ButtonBase.js +1 -1
  106. package/lib/components/ChatButton/ChatButton.d.ts +3 -2
  107. package/lib/components/ChatButton/ChatButton.js +2 -1
  108. package/lib/components/ComboBox/ComboBox.js +24 -34
  109. package/lib/components/ComposedModal/ComposedModal.js +50 -64
  110. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
  111. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
  112. package/lib/components/ContentSwitcher/ContentSwitcher.js +3 -3
  113. package/lib/components/DataTable/TableBatchAction.d.ts +3 -3
  114. package/lib/components/DataTable/TableBatchAction.js +1 -1
  115. package/lib/components/DataTable/TableContainer.d.ts +1 -1
  116. package/lib/components/DataTable/TableContainer.js +3 -3
  117. package/lib/components/DataTable/TableExpandHeader.d.ts +5 -6
  118. package/lib/components/DataTable/TableToolbarMenu.d.ts +2 -2
  119. package/lib/components/DataTable/TableToolbarMenu.js +1 -1
  120. package/lib/components/DatePicker/DatePicker.js +2 -2
  121. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
  122. package/lib/components/Dialog/index.d.ts +4 -42
  123. package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -2
  124. package/lib/components/FeatureFlags/index.d.ts +1 -3
  125. package/lib/components/FeatureFlags/index.js +0 -3
  126. package/lib/components/FileUploader/FileUploader.d.ts +1 -1
  127. package/lib/components/FileUploader/FileUploader.js +2 -2
  128. package/lib/components/FileUploader/FileUploaderButton.js +2 -2
  129. package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
  130. package/lib/components/FileUploader/FileUploaderDropContainer.js +4 -6
  131. package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
  132. package/lib/components/FileUploader/FileUploaderItem.js +2 -2
  133. package/lib/components/Grid/CSSGrid.js +14 -18
  134. package/lib/components/Grid/FlexGrid.js +6 -7
  135. package/lib/components/Grid/GridTypes.d.ts +3 -5
  136. package/lib/components/IconButton/index.js +3 -3
  137. package/lib/components/Layer/index.d.ts +6 -4
  138. package/lib/components/Layer/index.js +6 -5
  139. package/lib/components/Link/Link.d.ts +3 -2
  140. package/lib/components/Link/Link.js +2 -1
  141. package/lib/components/ListBox/ListBoxMenuItem.d.ts +3 -3
  142. package/lib/components/ListBox/ListBoxMenuItem.js +14 -36
  143. package/lib/components/Menu/Menu.js +2 -2
  144. package/lib/components/Menu/MenuItem.d.ts +2 -2
  145. package/lib/components/Menu/MenuItem.js +3 -3
  146. package/lib/components/Modal/Modal.js +51 -123
  147. package/lib/components/Modal/next/index.d.ts +171 -0
  148. package/lib/components/ModalWrapper/ModalWrapper.js +1 -1
  149. package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
  150. package/lib/components/MultiSelect/MultiSelect.js +2 -2
  151. package/lib/components/Notification/Notification.d.ts +13 -5
  152. package/lib/components/Notification/Notification.js +4 -3
  153. package/lib/components/OverflowMenu/OverflowMenu.d.ts +8 -4
  154. package/lib/components/OverflowMenu/OverflowMenu.js +3 -3
  155. package/lib/components/OverflowMenu/next/index.d.ts +2 -2
  156. package/lib/components/OverflowMenu/next/index.js +1 -1
  157. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  158. package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -2
  159. package/lib/components/RadioTile/RadioTile.js +2 -2
  160. package/lib/components/Search/Search.d.ts +3 -2
  161. package/lib/components/Search/Search.js +6 -4
  162. package/lib/components/Slider/Slider.d.ts +15 -16
  163. package/lib/components/Slider/Slider.js +22 -22
  164. package/lib/components/Tabs/Tabs.d.ts +6 -3
  165. package/lib/components/Tabs/Tabs.js +9 -8
  166. package/lib/components/Tag/DismissibleTag.d.ts +5 -3
  167. package/lib/components/Tag/DismissibleTag.js +2 -1
  168. package/lib/components/Tag/OperationalTag.d.ts +3 -2
  169. package/lib/components/Tag/OperationalTag.js +2 -1
  170. package/lib/components/Tag/SelectableTag.d.ts +5 -3
  171. package/lib/components/Tag/SelectableTag.js +2 -1
  172. package/lib/components/Tag/Tag.d.ts +3 -2
  173. package/lib/components/Tag/Tag.js +2 -1
  174. package/lib/components/Tile/Tile.d.ts +5 -3
  175. package/lib/components/Tile/Tile.js +6 -8
  176. package/lib/components/Toggletip/index.js +2 -2
  177. package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
  178. package/lib/components/Tooltip/Tooltip.d.ts +1 -1
  179. package/lib/components/Tooltip/Tooltip.js +2 -2
  180. package/lib/components/TreeView/TreeNode.d.ts +5 -3
  181. package/lib/components/TreeView/TreeNode.js +4 -3
  182. package/lib/components/TreeView/TreeView.js +2 -2
  183. package/lib/components/UIShell/HeaderContainer.js +2 -2
  184. package/lib/components/UIShell/HeaderMenu.js +2 -2
  185. package/lib/components/UIShell/HeaderPanel.js +2 -2
  186. package/lib/components/UIShell/SideNav.d.ts +1 -1
  187. package/lib/components/UIShell/SideNav.js +2 -2
  188. package/lib/components/UIShell/SideNavHeader.d.ts +3 -2
  189. package/lib/components/UIShell/SideNavHeader.js +2 -1
  190. package/lib/components/UIShell/SideNavLink.d.ts +2 -2
  191. package/lib/components/UIShell/SideNavLink.js +1 -1
  192. package/lib/components/UIShell/SideNavMenu.d.ts +2 -2
  193. package/lib/components/UIShell/SideNavMenu.js +3 -3
  194. package/lib/components/UIShell/SwitcherItem.js +2 -2
  195. package/lib/internal/FloatingMenu.js +5 -5
  196. package/lib/internal/OptimizedResize.js +24 -21
  197. package/lib/internal/focus/index.js +19 -0
  198. package/lib/internal/keyboard/keys.js +2 -2
  199. package/lib/internal/keyboard/match.js +41 -17
  200. package/lib/internal/keyboard/navigation.js +27 -15
  201. package/lib/internal/useMergedRefs.js +0 -3
  202. package/package.json +6 -6
  203. package/telemetry.yml +0 -1
  204. package/es/components/Dialog/index.js +0 -177
  205. package/es/internal/OptimizedResize.d.ts +0 -18
  206. package/es/internal/keyboard/index.d.ts +0 -9
  207. package/es/internal/keyboard/keys.d.ts +0 -23
  208. package/es/internal/keyboard/match.d.ts +0 -26
  209. package/es/internal/keyboard/navigation.d.ts +0 -37
  210. package/lib/components/Dialog/index.js +0 -190
  211. package/lib/internal/OptimizedResize.d.ts +0 -18
  212. package/lib/internal/keyboard/index.d.ts +0 -9
  213. package/lib/internal/keyboard/keys.d.ts +0 -23
  214. package/lib/internal/keyboard/match.d.ts +0 -26
  215. package/lib/internal/keyboard/navigation.d.ts +0 -37
  216. package/scss/components/dialog/_dialog.scss +0 -9
  217. package/scss/components/dialog/_index.scss +0 -9
@@ -9,12 +9,12 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import React__default, { useState } from 'react';
12
- import { Enter, Space } from '../../internal/keyboard/keys.js';
13
- import { matches } from '../../internal/keyboard/match.js';
14
12
  import { Warning, Incomplete, CheckmarkOutline, CircleDash } from '@carbon/icons-react';
15
13
  import { usePrefix } from '../../internal/usePrefix.js';
16
14
  import '../Text/index.js';
15
+ import { matches } from '../../internal/keyboard/match.js';
17
16
  import { Text } from '../Text/Text.js';
17
+ import { Enter, Space } from '../../internal/keyboard/keys.js';
18
18
 
19
19
  const defaultTranslations = {
20
20
  'carbon.progress-step.complete': 'Complete',
@@ -10,15 +10,15 @@ import { RadioButtonChecked, RadioButton, CheckmarkFilled } from '@carbon/icons-
10
10
  import cx from 'classnames';
11
11
  import PropTypes from 'prop-types';
12
12
  import React__default from 'react';
13
- import { Enter, Space } from '../../internal/keyboard/keys.js';
14
- import { matches } from '../../internal/keyboard/match.js';
15
13
  import { useFallbackId } from '../../internal/useId.js';
16
14
  import { usePrefix } from '../../internal/usePrefix.js';
17
15
  import deprecate from '../../prop-types/deprecate.js';
18
16
  import { noopFn } from '../../internal/noopFn.js';
19
17
  import '../Text/index.js';
20
18
  import { useFeatureFlag } from '../FeatureFlags/index.js';
19
+ import { matches } from '../../internal/keyboard/match.js';
21
20
  import { Text } from '../Text/Text.js';
21
+ import { Enter, Space } from '../../internal/keyboard/keys.js';
22
22
 
23
23
  var _RadioButtonChecked, _RadioButton, _CheckmarkFilled;
24
24
  const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref, ref) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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.
@@ -62,7 +62,8 @@ export interface SearchProps extends InputPropsBase {
62
62
  */
63
63
  placeholder?: string;
64
64
  /**
65
- * A component used to render an icon.
65
+ * Rendered icon for the Search.
66
+ * Can be a React component class
66
67
  */
67
68
  renderIcon?: ComponentType | FunctionComponent;
68
69
  /**
@@ -10,8 +10,7 @@ import { Close, Search as Search$1 } from '@carbon/icons-react';
10
10
  import cx from 'classnames';
11
11
  import PropTypes from 'prop-types';
12
12
  import React__default, { useContext, useRef, useState } from 'react';
13
- import { Escape, Enter, Space } from '../../internal/keyboard/keys.js';
14
- import { match } from '../../internal/keyboard/match.js';
13
+ import { focus } from '../../internal/focus/index.js';
15
14
  import { useId } from '../../internal/useId.js';
16
15
  import { usePrefix } from '../../internal/usePrefix.js';
17
16
  import { composeEventHandlers } from '../../tools/events.js';
@@ -19,6 +18,8 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
19
18
  import deprecate from '../../prop-types/deprecate.js';
20
19
  import '../FluidForm/FluidForm.js';
21
20
  import { FormContext } from '../FluidForm/FormContext.js';
21
+ import { match } from '../../internal/keyboard/match.js';
22
+ import { Escape, Enter, Space } from '../../internal/keyboard/keys.js';
22
23
 
23
24
  var _Close;
24
25
  const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwardRef) {
@@ -89,7 +90,7 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
89
90
  onChange(clearedEvt);
90
91
  onClear();
91
92
  setHasContent(false);
92
- inputRef.current?.focus();
93
+ focus(inputRef);
93
94
  }
94
95
  function handleChange(event) {
95
96
  setHasContent(event.target.value !== '');
@@ -220,7 +221,8 @@ Search.propTypes = {
220
221
  */
221
222
  placeholder: PropTypes.string,
222
223
  /**
223
- * A component used to render an icon.
224
+ * Rendered icon for the Search.
225
+ * Can be a React component class
224
226
  */
225
227
  // @ts-expect-error: PropTypes are not expressive enough to cover this case
226
228
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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.
@@ -355,13 +355,11 @@ declare class Slider extends PureComponent<SliderProps> {
355
355
  */
356
356
  clamp(val: any, min: any, max: any): number;
357
357
  /**
358
- * Rounds a given value to the nearest step defined by the slider's `step`
359
- * prop.
360
- *
361
- * @param value - The value to adjust to the nearest step. Defaults to `0`.
362
- * @returns The value rounded to the precision determined by the step.
358
+ * Takes a value and ensures it fits to the steps of the range
359
+ * @param value
360
+ * @returns value of the nearest step
363
361
  */
364
- nearestStepValue(value?: number): number;
362
+ nearestStepValue(value: any): number;
365
363
  /**
366
364
  * Sets up "drag" event handlers and calls `this.onDrag` in case dragging
367
365
  * started on somewhere other than the thumb without a corresponding "move"
@@ -444,16 +442,17 @@ declare class Slider extends PureComponent<SliderProps> {
444
442
  };
445
443
  calcDistanceToHandle: (handle: HandlePosition, clientX: any) => number;
446
444
  /**
447
- * Calculates a new slider value based on the current value, a change delta,
448
- * and a step.
445
+ * Given the current value, delta and step, calculate the new value.
449
446
  *
450
- * @param currentValue - The starting value from which the slider is moving.
451
- * @param delta - The amount to adjust the current value by.
452
- * @param step - The step. Defaults to `1`.
453
- * @returns The new slider value, rounded to the same number of decimal places
454
- * as the step.
455
- */
456
- calcValueForDelta: (currentValue: number, delta: number, step?: number) => number;
447
+ * @param {number} currentValue
448
+ * Current value user is moving from.
449
+ * @param {number} delta
450
+ * Movement from the current value. Can be positive or negative.
451
+ * @param {number} step
452
+ * A value determining how much the value should increase/decrease by moving
453
+ * the thumb by mouse.
454
+ */
455
+ calcValueForDelta: (currentValue: any, delta: any, step?: number) => any;
457
456
  /**
458
457
  * Sets state relevant to the given handle position.
459
458
  *
@@ -10,7 +10,6 @@ import React__default, { PureComponent } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
12
  import { ArrowDown, ArrowLeft, ArrowUp, ArrowRight, Enter } from '../../internal/keyboard/keys.js';
13
- import { matches } from '../../internal/keyboard/match.js';
14
13
  import { PrefixContext } from '../../internal/usePrefix.js';
15
14
  import deprecate from '../../prop-types/deprecate.js';
16
15
  import { FeatureFlagContext } from '../FeatureFlags/index.js';
@@ -20,6 +19,7 @@ import '../Tooltip/DefinitionTooltip.js';
20
19
  import { Tooltip } from '../Tooltip/Tooltip.js';
21
20
  import { LowerHandle, LowerHandleFocus, UpperHandle, UpperHandleFocus } from './SliderHandles.js';
22
21
  import { throttle } from '../../node_modules/es-toolkit/dist/compat/function/throttle.mjs.js';
22
+ import { matches } from '../../internal/keyboard/match.js';
23
23
  import { Text } from '../Text/Text.js';
24
24
 
25
25
  const ThumbWrapper = _ref => {
@@ -316,7 +316,7 @@ class Slider extends PureComponent {
316
316
  value,
317
317
  left
318
318
  } = this.calcValue({
319
- value: this.calcValueForDelta(currentValue ?? this.props.min, delta, this.props.step)
319
+ value: this.calcValueForDelta(currentValue, delta, this.props.step)
320
320
  });
321
321
  this.setValueLeftForHandle(this.state.activeHandle, {
322
322
  value: this.nearestStepValue(value),
@@ -593,21 +593,19 @@ class Slider extends PureComponent {
593
593
  return Math.abs(handleX - clientX);
594
594
  });
595
595
  /**
596
- * Calculates a new slider value based on the current value, a change delta,
597
- * and a step.
596
+ * Given the current value, delta and step, calculate the new value.
598
597
  *
599
- * @param currentValue - The starting value from which the slider is moving.
600
- * @param delta - The amount to adjust the current value by.
601
- * @param step - The step. Defaults to `1`.
602
- * @returns The new slider value, rounded to the same number of decimal places
603
- * as the step.
598
+ * @param {number} currentValue
599
+ * Current value user is moving from.
600
+ * @param {number} delta
601
+ * Movement from the current value. Can be positive or negative.
602
+ * @param {number} step
603
+ * A value determining how much the value should increase/decrease by moving
604
+ * the thumb by mouse.
604
605
  */
605
606
  _defineProperty(this, "calcValueForDelta", function (currentValue, delta) {
606
607
  let step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
607
- const base = delta > 0 ? Math.floor(currentValue / step) * step : currentValue;
608
- const newValue = base + delta;
609
- const decimals = (step.toString().split('.')[1] || '').length;
610
- return Number(newValue.toFixed(decimals));
608
+ return (delta > 0 ? Math.floor(currentValue / step) * step : currentValue) + delta;
611
609
  });
612
610
  /**
613
611
  * Sets state relevant to the given handle position.
@@ -871,16 +869,18 @@ class Slider extends PureComponent {
871
869
  }
872
870
 
873
871
  /**
874
- * Rounds a given value to the nearest step defined by the slider's `step`
875
- * prop.
876
- *
877
- * @param value - The value to adjust to the nearest step. Defaults to `0`.
878
- * @returns The value rounded to the precision determined by the step.
872
+ * Takes a value and ensures it fits to the steps of the range
873
+ * @param value
874
+ * @returns value of the nearest step
879
875
  */
880
- nearestStepValue() {
881
- let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
882
- const decimals = (this.props.step?.toString().split('.')[1] || '').length;
883
- return Number(value.toFixed(decimals));
876
+ nearestStepValue(value) {
877
+ const tempInput = document.createElement('input');
878
+ tempInput.type = 'range';
879
+ tempInput.min = `${this.props.min}`;
880
+ tempInput.max = `${this.props.max}`;
881
+ tempInput.step = `${this.props.step}`;
882
+ tempInput.value = `${value}`;
883
+ return parseFloat(tempInput.value);
884
884
  }
885
885
  getClientXFromEvent(event) {
886
886
  let clientX;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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.
@@ -340,9 +340,12 @@ export interface TabProps extends HTMLAttributes<HTMLElement> {
340
340
  */
341
341
  renderButton?(): ReactNode;
342
342
  /**
343
- * A component used to render an icon.
343
+ * Optional prop to render an icon next to the label.
344
+ * Can be a React component class
344
345
  */
345
- renderIcon?: React.ElementType;
346
+ renderIcon?: ComponentType<{
347
+ size: number;
348
+ }>;
346
349
  /**
347
350
  * An optional label to render under the primary tab label.
348
351
  * Only useful for contained tabs.
@@ -27,8 +27,6 @@ import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
27
27
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
28
28
  import { getInteractiveContent } from '../../internal/useNoInteractiveChildren.js';
29
29
  import { usePrefix } from '../../internal/usePrefix.js';
30
- import { ArrowRight, ArrowLeft, Home, End, ArrowDown, ArrowUp, Delete } from '../../internal/keyboard/keys.js';
31
- import { matches, match } from '../../internal/keyboard/match.js';
32
30
  import { usePressable } from './usePressable.js';
33
31
  import deprecate from '../../prop-types/deprecate.js';
34
32
  import { useEvent } from '../../internal/useEvent.js';
@@ -36,7 +34,9 @@ import { useMatchMedia } from '../../internal/useMatchMedia.js';
36
34
  import '../Text/index.js';
37
35
  import { BadgeIndicator } from '../BadgeIndicator/index.js';
38
36
  import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
37
+ import { matches, match } from '../../internal/keyboard/match.js';
39
38
  import { Text } from '../Text/Text.js';
39
+ import { ArrowRight, ArrowLeft, Home, End, ArrowDown, ArrowUp, Delete } from '../../internal/keyboard/keys.js';
40
40
 
41
41
  var _ChevronLeft, _ChevronRight, _BadgeIndicator;
42
42
  const verticalTabHeight = 64;
@@ -1007,21 +1007,22 @@ Tab.propTypes = {
1007
1007
  * Provide a handler that is invoked on the key down event for the control
1008
1008
  */
1009
1009
  onKeyDown: PropTypes.func,
1010
- /**
1010
+ /*
1011
1011
  * An optional parameter to allow overriding the anchor rendering.
1012
1012
  * Useful for using Tab along with react-router or other client
1013
1013
  * side router libraries.
1014
- */
1014
+ **/
1015
1015
  renderButton: PropTypes.func,
1016
1016
  /**
1017
- * A component used to render an icon.
1017
+ * Optional prop to render an icon next to the label.
1018
+ * Can be a React component class
1018
1019
  */
1019
1020
  // @ts-expect-error: Invalid prop type derivation
1020
1021
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
1021
- /**
1022
+ /*
1022
1023
  * An optional label to render under the primary tab label.
1023
- * Only useful for contained tabs.
1024
- */
1024
+ /* This prop is only useful for contained tabs
1025
+ **/
1025
1026
  secondaryLabel: PropTypes.string
1026
1027
  };
1027
1028
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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.
@@ -30,7 +30,8 @@ export interface DismissibleTagBaseProps {
30
30
  */
31
31
  onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
32
32
  /**
33
- * A component used to render an icon.
33
+ * Optional prop to render a custom icon.
34
+ * Can be a React component class
34
35
  */
35
36
  renderIcon?: React.ElementType;
36
37
  /**
@@ -85,7 +86,8 @@ declare const DismissibleTag: {
85
86
  */
86
87
  onClose: PropTypes.Requireable<(...args: any[]) => any>;
87
88
  /**
88
- * A component used to render an icon.
89
+ * Optional prop to render a custom icon.
90
+ * Can be a React component class
89
91
  */
90
92
  renderIcon: PropTypes.Requireable<object>;
91
93
  /**
@@ -119,7 +119,8 @@ DismissibleTag.propTypes = {
119
119
  */
120
120
  onClose: PropTypes.func,
121
121
  /**
122
- * A component used to render an icon.
122
+ * Optional prop to render a custom icon.
123
+ * Can be a React component class
123
124
  */
124
125
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
125
126
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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.
@@ -33,7 +33,8 @@ export interface OperationalTagBaseProps {
33
33
  */
34
34
  id?: string;
35
35
  /**
36
- * A component used to render an icon.
36
+ * Optional prop to render a custom icon.
37
+ * Can be a React component class
37
38
  */
38
39
  renderIcon?: React.ElementType;
39
40
  onClick?: MouseEventHandler;
@@ -101,7 +101,8 @@ OperationalTag.propTypes = {
101
101
  */
102
102
  id: PropTypes.string,
103
103
  /**
104
- * A component used to render an icon.
104
+ * Optional prop to render a custom icon.
105
+ * Can be a React component class
105
106
  */
106
107
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
107
108
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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.
@@ -22,7 +22,8 @@ export interface SelectableTagBaseProps {
22
22
  */
23
23
  id?: string;
24
24
  /**
25
- * A component used to render an icon.
25
+ * Optional prop to render a custom icon.
26
+ * Can be a React component class
26
27
  */
27
28
  renderIcon?: React.ElementType;
28
29
  /**
@@ -64,7 +65,8 @@ declare const SelectableTag: {
64
65
  */
65
66
  id: PropTypes.Requireable<string>;
66
67
  /**
67
- * A component used to render an icon.
68
+ * Optional prop to render a custom icon.
69
+ * Can be a React component class
68
70
  */
69
71
  renderIcon: PropTypes.Requireable<object>;
70
72
  /**
@@ -98,7 +98,8 @@ SelectableTag.propTypes = {
98
98
  */
99
99
  id: PropTypes.string,
100
100
  /**
101
- * A component used to render an icon.
101
+ * Optional prop to render a custom icon.
102
+ * Can be a React component class
102
103
  */
103
104
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
104
105
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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.
@@ -58,7 +58,8 @@ export interface TagBaseProps {
58
58
  */
59
59
  onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
60
60
  /**
61
- * A component used to render an icon.
61
+ * Optional prop to render a custom icon.
62
+ * Can be a React component class
62
63
  */
63
64
  renderIcon?: React.ElementType;
64
65
  /**
@@ -176,7 +176,8 @@ Tag.propTypes = {
176
176
  */
177
177
  onClose: deprecate(PropTypes.func, 'The `onClose` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
178
178
  /**
179
- * A component used to render an icon.
179
+ * Optional prop to render a custom icon.
180
+ * Can be a React component class
180
181
  */
181
182
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
182
183
  /**
@@ -4,7 +4,7 @@
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.
6
6
  */
7
- import React, { type ReactNode, type MouseEvent, type KeyboardEvent, type HTMLAttributes, type ChangeEvent } from 'react';
7
+ import React, { type ReactNode, type MouseEvent, type KeyboardEvent, type HTMLAttributes, type ChangeEvent, type ComponentType } from 'react';
8
8
  export interface TileProps extends HTMLAttributes<HTMLDivElement> {
9
9
  children?: ReactNode;
10
10
  className?: string;
@@ -53,9 +53,11 @@ export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
53
53
  */
54
54
  href?: string;
55
55
  /**
56
- * A component used to render an icon.
56
+ * Optional prop to allow overriding the icon rendering.
57
57
  */
58
- renderIcon?: React.ElementType;
58
+ renderIcon?: ComponentType<{
59
+ className?: string;
60
+ }>;
59
61
  /**
60
62
  * Specify the function to run when the ClickableTile is clicked
61
63
  */
@@ -11,8 +11,6 @@ import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
12
  import { AiLabel, CheckboxCheckedFilled, Checkbox, ChevronDown, ArrowRight, Error } from '@carbon/icons-react';
13
13
  import Link from '../Link/Link.js';
14
- import { Enter, Space } from '../../internal/keyboard/keys.js';
15
- import { matches } from '../../internal/keyboard/match.js';
16
14
  import deprecate from '../../prop-types/deprecate.js';
17
15
  import { composeEventHandlers } from '../../tools/events.js';
18
16
  import { usePrefix } from '../../internal/usePrefix.js';
@@ -22,7 +20,9 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
22
20
  import { useFeatureFlag } from '../FeatureFlags/index.js';
23
21
  import { useId } from '../../internal/useId.js';
24
22
  import '../Text/index.js';
23
+ import { matches } from '../../internal/keyboard/match.js';
25
24
  import { Text } from '../Text/Text.js';
25
+ import { Enter, Space } from '../../internal/keyboard/keys.js';
26
26
 
27
27
  var _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
28
28
  const Tile = /*#__PURE__*/React__default.forwardRef(function Tile(_ref, ref) {
@@ -201,7 +201,8 @@ ClickableTile.propTypes = {
201
201
  */
202
202
  rel: PropTypes.string,
203
203
  /**
204
- * A component used to render an icon.
204
+ * Optional prop to allow overriding the icon rendering.
205
+ * Can be a React component class
205
206
  */
206
207
  // @ts-expect-error: Invalid derived prop type, seemingly no real solution.
207
208
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
@@ -244,12 +245,9 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
244
245
  if (normalizedDecorator && decoratorRef.current && decoratorRef.current.contains(evt.target)) {
245
246
  return;
246
247
  }
247
- setIsSelected(prevSelected => {
248
- const newSelected = !prevSelected;
249
- onChange(evt, newSelected, id);
250
- return newSelected;
251
- });
248
+ setIsSelected(!isSelected);
252
249
  clickHandler(evt);
250
+ onChange(evt, isSelected, id);
253
251
  }
254
252
  function handleKeyDown(evt) {
255
253
  evt?.persist?.();
@@ -10,11 +10,11 @@ import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import React__default, { useRef, useState, useContext } from 'react';
12
12
  import { Popover, PopoverContent } from '../Popover/index.js';
13
- import { Escape } from '../../internal/keyboard/keys.js';
14
- import { match } from '../../internal/keyboard/match.js';
15
13
  import { useWindowEvent } from '../../internal/useEvent.js';
16
14
  import { useId } from '../../internal/useId.js';
17
15
  import { usePrefix } from '../../internal/usePrefix.js';
16
+ import { match } from '../../internal/keyboard/match.js';
17
+ import { Escape } from '../../internal/keyboard/keys.js';
18
18
 
19
19
  /**
20
20
  * Used to render the label for a Toggletip
@@ -10,11 +10,11 @@ import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import React__default, { useState } from 'react';
12
12
  import { Popover, PopoverContent } from '../Popover/index.js';
13
- import { Escape } from '../../internal/keyboard/keys.js';
14
- import { match } from '../../internal/keyboard/match.js';
15
13
  import { useFallbackId } from '../../internal/useId.js';
16
14
  import { usePrefix } from '../../internal/usePrefix.js';
17
15
  import deprecate from '../../prop-types/deprecate.js';
16
+ import { match } from '../../internal/keyboard/match.js';
17
+ import { Escape } from '../../internal/keyboard/keys.js';
18
18
 
19
19
  const DefinitionTooltip = _ref => {
20
20
  let {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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.
@@ -10,13 +10,13 @@ import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import React__default, { useRef, useState, useCallback, useEffect } from 'react';
12
12
  import { Popover, PopoverContent } from '../Popover/index.js';
13
- import { Escape, Enter, Space } from '../../internal/keyboard/keys.js';
14
- import { match } from '../../internal/keyboard/match.js';
15
13
  import { useDelayedState } from '../../internal/useDelayedState.js';
16
14
  import { useId } from '../../internal/useId.js';
17
15
  import { useNoInteractiveChildren } from '../../internal/useNoInteractiveChildren.js';
18
16
  import { usePrefix } from '../../internal/usePrefix.js';
19
17
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
18
+ import { match } from '../../internal/keyboard/match.js';
19
+ import { Escape, Enter, Space } from '../../internal/keyboard/keys.js';
20
20
 
21
21
  /**
22
22
  * Event types that trigger a "drag" to stop.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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.
@@ -62,7 +62,8 @@ export type TreeNodeProps = {
62
62
  */
63
63
  onTreeSelect?: (event: React.MouseEvent, node?: TreeNodeProps) => void;
64
64
  /**
65
- * A component used to render an icon.
65
+ * Optional prop to allow each node to have an associated icon.
66
+ * Can be a React component class
66
67
  */
67
68
  renderIcon?: ComponentType | FunctionComponent;
68
69
  /**
@@ -136,7 +137,8 @@ declare const TreeNode: React.ForwardRefExoticComponent<{
136
137
  */
137
138
  onTreeSelect?: (event: React.MouseEvent, node?: TreeNodeProps) => void;
138
139
  /**
139
- * A component used to render an icon.
140
+ * Optional prop to allow each node to have an associated icon.
141
+ * Can be a React component class
140
142
  */
141
143
  renderIcon?: ComponentType | FunctionComponent;
142
144
  /**
@@ -10,12 +10,12 @@ import { CaretDown } from '@carbon/icons-react';
10
10
  import cx from 'classnames';
11
11
  import PropTypes from 'prop-types';
12
12
  import React__default, { useRef, useState, useEffect } from 'react';
13
- import { ArrowLeft, ArrowRight, Enter, Space } from '../../internal/keyboard/keys.js';
14
- import { matches, match } from '../../internal/keyboard/match.js';
15
13
  import { useControllableState } from '../../internal/useControllableState.js';
16
14
  import { usePrefix } from '../../internal/usePrefix.js';
17
15
  import uniqueId from '../../tools/uniqueId.js';
18
16
  import { useFeatureFlag } from '../FeatureFlags/index.js';
17
+ import { matches, match } from '../../internal/keyboard/match.js';
18
+ import { ArrowLeft, ArrowRight, Enter, Space } from '../../internal/keyboard/keys.js';
19
19
 
20
20
  const TreeNode = /*#__PURE__*/React__default.forwardRef((_ref, forwardedRef) => {
21
21
  let {
@@ -400,7 +400,8 @@ TreeNode.propTypes = {
400
400
  */
401
401
  onTreeSelect: PropTypes.func,
402
402
  /**
403
- * A component used to render an icon.
403
+ * Optional prop to allow each node to have an associated icon.
404
+ * Can be a React component class
404
405
  */
405
406
  // @ts-ignore
406
407
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
@@ -9,13 +9,13 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import React__default, { useRef, useState, useEffect } from 'react';
12
- import { ArrowUp, ArrowDown, Home, End } from '../../internal/keyboard/keys.js';
13
- import { matches, match } from '../../internal/keyboard/match.js';
14
12
  import { useControllableState } from '../../internal/useControllableState.js';
15
13
  import { usePrefix } from '../../internal/usePrefix.js';
16
14
  import uniqueId from '../../tools/uniqueId.js';
17
15
  import { useFeatureFlag } from '../FeatureFlags/index.js';
18
16
  import TreeNode from './TreeNode.js';
17
+ import { matches, match } from '../../internal/keyboard/match.js';
18
+ import { ArrowUp, ArrowDown, Home, End } from '../../internal/keyboard/keys.js';
19
19
 
20
20
  const TreeView = _ref => {
21
21
  let {
@@ -8,9 +8,9 @@
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
10
  import React__default, { useState, useCallback } from 'react';
11
- import { Escape } from '../../internal/keyboard/keys.js';
12
- import { match } from '../../internal/keyboard/match.js';
13
11
  import { useWindowEvent } from '../../internal/useEvent.js';
12
+ import { match } from '../../internal/keyboard/match.js';
13
+ import { Escape } from '../../internal/keyboard/keys.js';
14
14
 
15
15
  function HeaderContainer(_ref) {
16
16
  let {