@carbon/react 1.78.2 → 1.79.0-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.
Files changed (249) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +835 -835
  2. package/es/components/Accordion/AccordionItem.js +2 -2
  3. package/es/components/Button/Button.d.ts +2 -3
  4. package/es/components/Button/Button.js +29 -19
  5. package/es/components/Button/ButtonBase.js +3 -1
  6. package/es/components/ChatButton/ChatButton.d.ts +2 -3
  7. package/es/components/ChatButton/ChatButton.js +1 -2
  8. package/es/components/ComboBox/ComboBox.js +34 -24
  9. package/es/components/ComposedModal/ComposedModal.js +65 -51
  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 +5 -4
  17. package/es/components/DataTable/TableExpandHeader.d.ts +6 -5
  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 +42 -4
  23. package/es/components/Dialog/index.js +177 -0
  24. package/es/components/ExpandableSearch/ExpandableSearch.js +2 -2
  25. package/es/components/FeatureFlags/index.d.ts +3 -1
  26. package/es/components/FeatureFlags/index.js +3 -0
  27. package/es/components/FileUploader/FileUploader.d.ts +1 -1
  28. package/es/components/FileUploader/FileUploader.js +2 -2
  29. package/es/components/FileUploader/FileUploaderButton.js +2 -2
  30. package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
  31. package/es/components/FileUploader/FileUploaderDropContainer.js +6 -4
  32. package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
  33. package/es/components/FileUploader/FileUploaderItem.js +2 -2
  34. package/es/components/Grid/CSSGrid.js +18 -14
  35. package/es/components/Grid/Column.d.ts +2 -2
  36. package/es/components/Grid/Column.js +7 -8
  37. package/es/components/Grid/FlexGrid.js +7 -6
  38. package/es/components/Grid/GridTypes.d.ts +5 -3
  39. package/es/components/IconButton/index.d.ts +2 -2
  40. package/es/components/IconButton/index.js +4 -4
  41. package/es/components/Layer/index.d.ts +4 -6
  42. package/es/components/Layer/index.js +5 -6
  43. package/es/components/Link/Link.d.ts +2 -3
  44. package/es/components/Link/Link.js +1 -2
  45. package/es/components/ListBox/ListBoxMenuItem.d.ts +3 -3
  46. package/es/components/ListBox/ListBoxMenuItem.js +37 -15
  47. package/es/components/Menu/Menu.js +2 -2
  48. package/es/components/Menu/MenuItem.d.ts +2 -2
  49. package/es/components/Menu/MenuItem.js +3 -3
  50. package/es/components/Modal/Modal.js +121 -49
  51. package/es/components/ModalWrapper/ModalWrapper.js +1 -1
  52. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
  53. package/es/components/MultiSelect/MultiSelect.js +2 -2
  54. package/es/components/MultiSelect/index.d.ts +1 -1
  55. package/es/components/MultiSelect/index.js +1 -8
  56. package/es/components/Notification/Notification.d.ts +5 -13
  57. package/es/components/Notification/Notification.js +3 -4
  58. package/es/components/OverflowMenu/OverflowMenu.d.ts +22 -201
  59. package/es/components/OverflowMenu/OverflowMenu.js +269 -338
  60. package/es/components/OverflowMenu/index.d.ts +5 -5
  61. package/es/components/OverflowMenu/index.js +2 -2
  62. package/es/components/OverflowMenu/next/index.d.ts +4 -4
  63. package/es/components/OverflowMenu/next/index.js +1 -1
  64. package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  65. package/es/components/ProgressIndicator/ProgressIndicator.js +2 -2
  66. package/es/components/RadioTile/RadioTile.js +2 -2
  67. package/es/components/Search/Search.d.ts +2 -3
  68. package/es/components/Search/Search.js +4 -6
  69. package/es/components/Slider/Slider.d.ts +39 -44
  70. package/es/components/Slider/Slider.js +57 -59
  71. package/es/components/Tabs/Tabs.d.ts +3 -6
  72. package/es/components/Tabs/Tabs.js +16 -18
  73. package/es/components/Tag/DismissibleTag.d.ts +3 -5
  74. package/es/components/Tag/DismissibleTag.js +1 -2
  75. package/es/components/Tag/OperationalTag.d.ts +2 -3
  76. package/es/components/Tag/OperationalTag.js +1 -2
  77. package/es/components/Tag/SelectableTag.d.ts +3 -5
  78. package/es/components/Tag/SelectableTag.js +1 -2
  79. package/es/components/Tag/Tag.d.ts +2 -3
  80. package/es/components/Tag/Tag.js +1 -2
  81. package/es/components/Tile/Tile.d.ts +3 -5
  82. package/es/components/Tile/Tile.js +16 -10
  83. package/es/components/Toggletip/index.js +2 -2
  84. package/es/components/Tooltip/DefinitionTooltip.js +2 -2
  85. package/es/components/Tooltip/Tooltip.d.ts +1 -1
  86. package/es/components/Tooltip/Tooltip.js +2 -2
  87. package/es/components/TreeView/TreeNode.d.ts +3 -5
  88. package/es/components/TreeView/TreeNode.js +3 -4
  89. package/es/components/TreeView/TreeView.js +2 -2
  90. package/es/components/UIShell/HeaderContainer.js +2 -2
  91. package/es/components/UIShell/HeaderMenu.js +2 -2
  92. package/es/components/UIShell/HeaderPanel.js +2 -2
  93. package/es/components/UIShell/SideNav.d.ts +1 -1
  94. package/es/components/UIShell/SideNav.js +2 -2
  95. package/es/components/UIShell/SideNavHeader.d.ts +2 -3
  96. package/es/components/UIShell/SideNavHeader.js +1 -2
  97. package/es/components/UIShell/SideNavLink.d.ts +2 -2
  98. package/es/components/UIShell/SideNavLink.js +1 -1
  99. package/es/components/UIShell/SideNavMenu.d.ts +2 -2
  100. package/es/components/UIShell/SideNavMenu.js +3 -3
  101. package/es/components/UIShell/SwitcherItem.js +2 -2
  102. package/es/index.js +1 -1
  103. package/es/internal/FloatingMenu.d.ts +2 -2
  104. package/es/internal/FloatingMenu.js +8 -5
  105. package/es/internal/OptimizedResize.d.ts +18 -0
  106. package/es/internal/OptimizedResize.js +21 -24
  107. package/es/internal/createClassWrapper.d.ts +3 -3
  108. package/es/internal/createClassWrapper.js +4 -4
  109. package/es/internal/keyboard/index.d.ts +9 -0
  110. package/es/internal/keyboard/keys.d.ts +23 -0
  111. package/es/internal/keyboard/keys.js +2 -2
  112. package/es/internal/keyboard/match.d.ts +26 -0
  113. package/es/internal/keyboard/match.js +17 -41
  114. package/es/internal/keyboard/navigation.d.ts +37 -0
  115. package/es/internal/keyboard/navigation.js +15 -27
  116. package/es/internal/useMatchMedia.d.ts +8 -0
  117. package/es/internal/useMatchMedia.js +10 -20
  118. package/es/internal/useMergedRefs.js +3 -0
  119. package/es/internal/useNormalizedInputProps.d.ts +52 -0
  120. package/es/internal/useNormalizedInputProps.js +9 -36
  121. package/lib/components/Accordion/AccordionItem.js +2 -2
  122. package/lib/components/Button/Button.d.ts +2 -3
  123. package/lib/components/Button/Button.js +29 -19
  124. package/lib/components/Button/ButtonBase.js +3 -1
  125. package/lib/components/ChatButton/ChatButton.d.ts +2 -3
  126. package/lib/components/ChatButton/ChatButton.js +1 -2
  127. package/lib/components/ComboBox/ComboBox.js +34 -24
  128. package/lib/components/ComposedModal/ComposedModal.js +64 -50
  129. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
  130. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
  131. package/lib/components/ContentSwitcher/ContentSwitcher.js +3 -3
  132. package/lib/components/DataTable/TableBatchAction.d.ts +3 -3
  133. package/lib/components/DataTable/TableBatchAction.js +1 -1
  134. package/lib/components/DataTable/TableContainer.d.ts +1 -1
  135. package/lib/components/DataTable/TableContainer.js +5 -4
  136. package/lib/components/DataTable/TableExpandHeader.d.ts +6 -5
  137. package/lib/components/DataTable/TableToolbarMenu.d.ts +2 -2
  138. package/lib/components/DataTable/TableToolbarMenu.js +1 -1
  139. package/lib/components/DatePicker/DatePicker.js +2 -2
  140. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
  141. package/lib/components/Dialog/index.d.ts +42 -4
  142. package/lib/components/Dialog/index.js +190 -0
  143. package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -2
  144. package/lib/components/FeatureFlags/index.d.ts +3 -1
  145. package/lib/components/FeatureFlags/index.js +3 -0
  146. package/lib/components/FileUploader/FileUploader.d.ts +1 -1
  147. package/lib/components/FileUploader/FileUploader.js +2 -2
  148. package/lib/components/FileUploader/FileUploaderButton.js +2 -2
  149. package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
  150. package/lib/components/FileUploader/FileUploaderDropContainer.js +6 -4
  151. package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
  152. package/lib/components/FileUploader/FileUploaderItem.js +2 -2
  153. package/lib/components/Grid/CSSGrid.js +18 -14
  154. package/lib/components/Grid/Column.d.ts +2 -2
  155. package/lib/components/Grid/Column.js +7 -8
  156. package/lib/components/Grid/FlexGrid.js +7 -6
  157. package/lib/components/Grid/GridTypes.d.ts +5 -3
  158. package/lib/components/IconButton/index.d.ts +2 -2
  159. package/lib/components/IconButton/index.js +4 -4
  160. package/lib/components/Layer/index.d.ts +4 -6
  161. package/lib/components/Layer/index.js +5 -6
  162. package/lib/components/Link/Link.d.ts +2 -3
  163. package/lib/components/Link/Link.js +1 -2
  164. package/lib/components/ListBox/ListBoxMenuItem.d.ts +3 -3
  165. package/lib/components/ListBox/ListBoxMenuItem.js +36 -14
  166. package/lib/components/Menu/Menu.js +2 -2
  167. package/lib/components/Menu/MenuItem.d.ts +2 -2
  168. package/lib/components/Menu/MenuItem.js +3 -3
  169. package/lib/components/Modal/Modal.js +123 -51
  170. package/lib/components/ModalWrapper/ModalWrapper.js +1 -1
  171. package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
  172. package/lib/components/MultiSelect/MultiSelect.js +2 -2
  173. package/lib/components/MultiSelect/index.d.ts +1 -1
  174. package/lib/components/MultiSelect/index.js +1 -8
  175. package/lib/components/Notification/Notification.d.ts +5 -13
  176. package/lib/components/Notification/Notification.js +3 -4
  177. package/lib/components/OverflowMenu/OverflowMenu.d.ts +22 -201
  178. package/lib/components/OverflowMenu/OverflowMenu.js +268 -336
  179. package/lib/components/OverflowMenu/index.d.ts +5 -5
  180. package/lib/components/OverflowMenu/index.js +2 -2
  181. package/lib/components/OverflowMenu/next/index.d.ts +4 -4
  182. package/lib/components/OverflowMenu/next/index.js +1 -1
  183. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  184. package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -2
  185. package/lib/components/RadioTile/RadioTile.js +2 -2
  186. package/lib/components/Search/Search.d.ts +2 -3
  187. package/lib/components/Search/Search.js +4 -6
  188. package/lib/components/Slider/Slider.d.ts +39 -44
  189. package/lib/components/Slider/Slider.js +57 -59
  190. package/lib/components/Tabs/Tabs.d.ts +3 -6
  191. package/lib/components/Tabs/Tabs.js +16 -18
  192. package/lib/components/Tag/DismissibleTag.d.ts +3 -5
  193. package/lib/components/Tag/DismissibleTag.js +1 -2
  194. package/lib/components/Tag/OperationalTag.d.ts +2 -3
  195. package/lib/components/Tag/OperationalTag.js +1 -2
  196. package/lib/components/Tag/SelectableTag.d.ts +3 -5
  197. package/lib/components/Tag/SelectableTag.js +1 -2
  198. package/lib/components/Tag/Tag.d.ts +2 -3
  199. package/lib/components/Tag/Tag.js +1 -2
  200. package/lib/components/Tile/Tile.d.ts +3 -5
  201. package/lib/components/Tile/Tile.js +16 -10
  202. package/lib/components/Toggletip/index.js +2 -2
  203. package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
  204. package/lib/components/Tooltip/Tooltip.d.ts +1 -1
  205. package/lib/components/Tooltip/Tooltip.js +2 -2
  206. package/lib/components/TreeView/TreeNode.d.ts +3 -5
  207. package/lib/components/TreeView/TreeNode.js +3 -4
  208. package/lib/components/TreeView/TreeView.js +2 -2
  209. package/lib/components/UIShell/HeaderContainer.js +2 -2
  210. package/lib/components/UIShell/HeaderMenu.js +2 -2
  211. package/lib/components/UIShell/HeaderPanel.js +2 -2
  212. package/lib/components/UIShell/SideNav.d.ts +1 -1
  213. package/lib/components/UIShell/SideNav.js +2 -2
  214. package/lib/components/UIShell/SideNavHeader.d.ts +2 -3
  215. package/lib/components/UIShell/SideNavHeader.js +1 -2
  216. package/lib/components/UIShell/SideNavLink.d.ts +2 -2
  217. package/lib/components/UIShell/SideNavLink.js +1 -1
  218. package/lib/components/UIShell/SideNavMenu.d.ts +2 -2
  219. package/lib/components/UIShell/SideNavMenu.js +3 -3
  220. package/lib/components/UIShell/SwitcherItem.js +2 -2
  221. package/lib/index.js +2 -2
  222. package/lib/internal/FloatingMenu.d.ts +2 -2
  223. package/lib/internal/FloatingMenu.js +9 -6
  224. package/lib/internal/OptimizedResize.d.ts +18 -0
  225. package/lib/internal/OptimizedResize.js +21 -24
  226. package/lib/internal/createClassWrapper.d.ts +3 -3
  227. package/lib/internal/createClassWrapper.js +4 -4
  228. package/lib/internal/keyboard/index.d.ts +9 -0
  229. package/lib/internal/keyboard/keys.d.ts +23 -0
  230. package/lib/internal/keyboard/keys.js +2 -2
  231. package/lib/internal/keyboard/match.d.ts +26 -0
  232. package/lib/internal/keyboard/match.js +17 -41
  233. package/lib/internal/keyboard/navigation.d.ts +37 -0
  234. package/lib/internal/keyboard/navigation.js +15 -27
  235. package/lib/internal/useMatchMedia.d.ts +8 -0
  236. package/lib/internal/useMatchMedia.js +10 -20
  237. package/lib/internal/useMergedRefs.js +3 -0
  238. package/lib/internal/useNormalizedInputProps.d.ts +52 -0
  239. package/lib/internal/useNormalizedInputProps.js +9 -36
  240. package/package.json +6 -6
  241. package/scss/components/dialog/_dialog.scss +9 -0
  242. package/scss/components/dialog/_index.scss +9 -0
  243. package/telemetry.yml +1 -0
  244. package/es/components/Modal/next/index.d.ts +0 -171
  245. package/es/internal/focus/index.js +0 -15
  246. package/es/internal/useEffectOnce.js +0 -30
  247. package/lib/components/Modal/next/index.d.ts +0 -171
  248. package/lib/internal/focus/index.js +0 -19
  249. package/lib/internal/useEffectOnce.js +0 -34
@@ -1,13 +1,13 @@
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.
6
6
  */
7
7
  import { type OverflowMenuProps } from './OverflowMenu';
8
- declare function OverflowMenu(props: any): import("react/jsx-runtime").JSX.Element;
9
- declare namespace OverflowMenu {
10
- var displayName: string;
11
- }
8
+ declare const OverflowMenu: {
9
+ (props: OverflowMenuProps): import("react/jsx-runtime").JSX.Element;
10
+ displayName: string;
11
+ };
12
12
  export default OverflowMenu;
13
13
  export { OverflowMenu, type OverflowMenuProps };
@@ -12,10 +12,10 @@ import { OverflowMenu as OverflowMenu$1 } from './OverflowMenu.js';
12
12
  import { createClassWrapper } from '../../internal/createClassWrapper.js';
13
13
 
14
14
  const OverflowMenuV11 = createClassWrapper(OverflowMenu$1);
15
- function OverflowMenu(props) {
15
+ const OverflowMenu = props => {
16
16
  const enableV12OverflowMenu = useFeatureFlag('enable-v12-overflowmenu');
17
17
  return enableV12OverflowMenu ? /*#__PURE__*/React__default.createElement(OverflowMenu$2, props) : /*#__PURE__*/React__default.createElement(OverflowMenuV11, props);
18
- }
18
+ };
19
19
  OverflowMenu.displayName = 'OverflowMenu';
20
20
 
21
21
  export { OverflowMenu, OverflowMenu as default };
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Copyright IBM Corp. 2020, 2023
2
+ * Copyright IBM Corp. 2020, 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.
6
6
  */
7
- import React, { type ComponentType, type FunctionComponent } from 'react';
7
+ import React, { type ElementType } from 'react';
8
8
  interface OverflowMenuProps {
9
9
  /**
10
10
  * **Experimental**: Will attempt to automatically align the floating element to avoid collisions with the viewport and being clipped by ancestor elements.
@@ -27,9 +27,9 @@ interface OverflowMenuProps {
27
27
  */
28
28
  menuAlignment?: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
29
29
  /**
30
- * Optionally provide a custom icon to be rendered on the trigger button.
30
+ * A component used to render an icon.
31
31
  */
32
- renderIcon?: ComponentType | FunctionComponent;
32
+ renderIcon?: ElementType;
33
33
  /**
34
34
  * Specify the size of the menu, from a list of available sizes.
35
35
  */
@@ -165,7 +165,7 @@ OverflowMenu.propTypes = {
165
165
  */
166
166
  menuAlignment: PropTypes.oneOf(['top-start', 'top-end', 'bottom-start', 'bottom-end']),
167
167
  /**
168
- * Optionally provide a custom icon to be rendered on the trigger button.
168
+ * A component used to render an icon.
169
169
  */
170
170
  // @ts-expect-error: PropTypes are not expressive enough to cover this case
171
171
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
@@ -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 from 'react';
12
+ import { ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
13
+ import { match } from '../../internal/keyboard/match.js';
12
14
  import { usePrefix } from '../../internal/usePrefix.js';
13
15
  import { warning } from '../../internal/warning.js';
14
16
  import '../Text/index.js';
15
- import { match } from '../../internal/keyboard/match.js';
16
17
  import { Text } from '../Text/Text.js';
17
- import { ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
18
18
 
19
19
  const OverflowMenuItem = /*#__PURE__*/React__default.forwardRef(function OverflowMenuItem(_ref, ref) {
20
20
  let {
@@ -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';
12
14
  import { Warning, Incomplete, CheckmarkOutline, CircleDash } from '@carbon/icons-react';
13
15
  import { usePrefix } from '../../internal/usePrefix.js';
14
16
  import '../Text/index.js';
15
- import { matches } from '../../internal/keyboard/match.js';
16
17
  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';
13
15
  import { useFallbackId } from '../../internal/useId.js';
14
16
  import { usePrefix } from '../../internal/usePrefix.js';
15
17
  import deprecate from '../../prop-types/deprecate.js';
16
18
  import { noopFn } from '../../internal/noopFn.js';
17
19
  import '../Text/index.js';
18
20
  import { useFeatureFlag } from '../FeatureFlags/index.js';
19
- import { matches } from '../../internal/keyboard/match.js';
20
21
  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, 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.
@@ -62,8 +62,7 @@ export interface SearchProps extends InputPropsBase {
62
62
  */
63
63
  placeholder?: string;
64
64
  /**
65
- * Rendered icon for the Search.
66
- * Can be a React component class
65
+ * A component used to render an icon.
67
66
  */
68
67
  renderIcon?: ComponentType | FunctionComponent;
69
68
  /**
@@ -10,7 +10,8 @@ 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 { focus } from '../../internal/focus/index.js';
13
+ import { Escape, Enter, Space } from '../../internal/keyboard/keys.js';
14
+ import { match } from '../../internal/keyboard/match.js';
14
15
  import { useId } from '../../internal/useId.js';
15
16
  import { usePrefix } from '../../internal/usePrefix.js';
16
17
  import { composeEventHandlers } from '../../tools/events.js';
@@ -18,8 +19,6 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
18
19
  import deprecate from '../../prop-types/deprecate.js';
19
20
  import '../FluidForm/FluidForm.js';
20
21
  import { FormContext } from '../FluidForm/FormContext.js';
21
- import { match } from '../../internal/keyboard/match.js';
22
- import { Escape, Enter, Space } from '../../internal/keyboard/keys.js';
23
22
 
24
23
  var _Close;
25
24
  const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwardRef) {
@@ -90,7 +89,7 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
90
89
  onChange(clearedEvt);
91
90
  onClear();
92
91
  setHasContent(false);
93
- focus(inputRef);
92
+ inputRef.current?.focus();
94
93
  }
95
94
  function handleChange(event) {
96
95
  setHasContent(event.target.value !== '');
@@ -221,8 +220,7 @@ Search.propTypes = {
221
220
  */
222
221
  placeholder: PropTypes.string,
223
222
  /**
224
- * Rendered icon for the Search.
225
- * Can be a React component class
223
+ * A component used to render an icon.
226
224
  */
227
225
  // @ts-expect-error: PropTypes are not expressive enough to cover this case
228
226
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
@@ -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.
@@ -164,11 +164,6 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
164
164
  */
165
165
  warnText?: React.ReactNode;
166
166
  }
167
- interface CalcValueProps {
168
- clientX?: number;
169
- value?: number;
170
- useRawValue?: boolean;
171
- }
172
167
  interface CalcLeftPercentProps {
173
168
  clientX?: number;
174
169
  value?: number;
@@ -355,11 +350,13 @@ declare class Slider extends PureComponent<SliderProps> {
355
350
  */
356
351
  clamp(val: any, min: any, max: any): number;
357
352
  /**
358
- * Takes a value and ensures it fits to the steps of the range
359
- * @param value
360
- * @returns value of the nearest step
353
+ * Rounds a given value to the nearest step defined by the slider's `step`
354
+ * prop.
355
+ *
356
+ * @param value - The value to adjust to the nearest step. Defaults to `0`.
357
+ * @returns The value rounded to the precision determined by the step.
361
358
  */
362
- nearestStepValue(value: any): number;
359
+ nearestStepValue(value?: number): number;
363
360
  /**
364
361
  * Sets up "drag" event handlers and calls `this.onDrag` in case dragging
365
362
  * started on somewhere other than the thumb without a corresponding "move"
@@ -413,46 +410,44 @@ declare class Slider extends PureComponent<SliderProps> {
413
410
  onInputKeyDown: (evt: any) => void;
414
411
  processNewInputValue: (input: HTMLInputElement) => void;
415
412
  calcLeftPercent: ({ clientX, value, range }: CalcLeftPercentProps) => number;
416
- calcSteppedValuePercent: ({ leftPercent, range }: {
417
- leftPercent: any;
418
- range: any;
419
- }) => number[];
420
- /**
421
- * Calculates a new Slider `value` and `left` (thumb offset) given a `clientX`,
422
- * `value`, or neither of those.
423
- * - If `clientX` is specified, it will be used in
424
- * conjunction with the Slider's bounding rectangle to calculate the new
425
- * values.
426
- * - If `clientX` is not specified and `value` is, it will be used to
427
- * calculate new values as though it were the current value of the Slider.
428
- * - If neither `clientX` nor `value` are specified, `this.props.value` will
429
- * be used to calculate the new values as though it were the current value
430
- * of the Slider.
431
- *
432
- * @param {object} params
433
- * @param {number} [params.clientX] Optional clientX value expected to be from
434
- * an event fired by one of the Slider's `DRAG_EVENT_TYPES` events.
435
- * @param {number} [params.value] Optional value use during calculations if
436
- * clientX is not provided.
437
- * @param {boolean} [params.useRawValue=false] `true` to use the given value as-is.
438
- */
439
- calcValue: ({ clientX, value, useRawValue }: CalcValueProps) => {
413
+ /**
414
+ * Calculates the discrete value (snapped to the nearest step) along
415
+ * with the corresponding handle position percentage.
416
+ */
417
+ calcDiscreteValueAndPercent: ({ leftPercent, }: {
418
+ /** The percentage representing the position on the track. */
419
+ leftPercent: number;
420
+ }) => {
421
+ discreteValue: number;
422
+ discretePercent: number;
423
+ };
424
+ /**
425
+ * Calculates the slider's value and handle position based on either a
426
+ * mouse/touch event or an explicit value.
427
+ */
428
+ calcValue: ({ clientX, value, useRawValue, }: {
429
+ /** The x-coordinate from a mouse/touch event. */
430
+ clientX?: number;
431
+ /** Value to base the calculations on (if no `clientX`). */
432
+ value?: number;
433
+ /** Whether to bypass the stepping logic and use the raw value. */
434
+ useRawValue?: boolean;
435
+ }) => {
440
436
  value: number | undefined;
441
437
  left: number;
442
438
  };
443
439
  calcDistanceToHandle: (handle: HandlePosition, clientX: any) => number;
444
440
  /**
445
- * Given the current value, delta and step, calculate the new value.
441
+ * Calculates a new slider value based on the current value, a change delta,
442
+ * and a step.
446
443
  *
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;
444
+ * @param currentValue - The starting value from which the slider is moving.
445
+ * @param delta - The amount to adjust the current value by.
446
+ * @param step - The step. Defaults to `1`.
447
+ * @returns The new slider value, rounded to the same number of decimal places
448
+ * as the step.
449
+ */
450
+ calcValueForDelta: (currentValue: number, delta: number, step?: number) => number;
456
451
  /**
457
452
  * Sets state relevant to the given handle position.
458
453
  *
@@ -10,6 +10,7 @@ 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';
13
14
  import { PrefixContext } from '../../internal/usePrefix.js';
14
15
  import deprecate from '../../prop-types/deprecate.js';
15
16
  import { FeatureFlagContext } from '../FeatureFlags/index.js';
@@ -19,7 +20,6 @@ import '../Tooltip/DefinitionTooltip.js';
19
20
  import { Tooltip } from '../Tooltip/Tooltip.js';
20
21
  import { LowerHandle, LowerHandleFocus, UpperHandle, UpperHandleFocus } from './SliderHandles.js';
21
22
  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, delta, this.props.step)
319
+ value: this.calcValueForDelta(currentValue ?? this.props.min, delta, this.props.step)
320
320
  });
321
321
  this.setValueLeftForHandle(this.state.activeHandle, {
322
322
  value: this.nearestStepValue(value),
@@ -523,67 +523,65 @@ class Slider extends PureComponent {
523
523
  // re-assure Typescript, return 0.
524
524
  return 0;
525
525
  });
526
- _defineProperty(this, "calcSteppedValuePercent", _ref3 => {
526
+ /**
527
+ * Calculates the discrete value (snapped to the nearest step) along
528
+ * with the corresponding handle position percentage.
529
+ */
530
+ _defineProperty(this, "calcDiscreteValueAndPercent", _ref3 => {
527
531
  let {
528
- leftPercent,
529
- range
532
+ leftPercent
530
533
  } = _ref3;
531
534
  const {
532
- step = 1
535
+ step = 1,
536
+ min,
537
+ max
533
538
  } = this.props;
534
- const totalSteps = range / step;
535
- let steppedValue = Math.round(leftPercent * totalSteps) * step;
536
- const steppedPercent = this.clamp(steppedValue / range, 0, 1);
537
- steppedValue = this.clamp(steppedValue + this.props.min, this.props.min, this.props.max);
538
- return [steppedValue, steppedPercent];
539
+ const numSteps = Math.floor((max - min) / step) + ((max - min) % step === 0 ? 1 : 2);
540
+ /** Index of the step that corresponds to `leftPercent`. */
541
+ const stepIndex = Math.round(leftPercent * (numSteps - 1));
542
+ const discreteValue = stepIndex === numSteps - 1 ? max : min + step * stepIndex;
543
+ /** Percentage corresponding to the step index. */
544
+ const discretePercent = stepIndex / (numSteps - 1);
545
+ return {
546
+ discreteValue,
547
+ discretePercent
548
+ };
539
549
  });
540
550
  /**
541
- * Calculates a new Slider `value` and `left` (thumb offset) given a `clientX`,
542
- * `value`, or neither of those.
543
- * - If `clientX` is specified, it will be used in
544
- * conjunction with the Slider's bounding rectangle to calculate the new
545
- * values.
546
- * - If `clientX` is not specified and `value` is, it will be used to
547
- * calculate new values as though it were the current value of the Slider.
548
- * - If neither `clientX` nor `value` are specified, `this.props.value` will
549
- * be used to calculate the new values as though it were the current value
550
- * of the Slider.
551
- *
552
- * @param {object} params
553
- * @param {number} [params.clientX] Optional clientX value expected to be from
554
- * an event fired by one of the Slider's `DRAG_EVENT_TYPES` events.
555
- * @param {number} [params.value] Optional value use during calculations if
556
- * clientX is not provided.
557
- * @param {boolean} [params.useRawValue=false] `true` to use the given value as-is.
551
+ * Calculates the slider's value and handle position based on either a
552
+ * mouse/touch event or an explicit value.
558
553
  */
559
554
  _defineProperty(this, "calcValue", _ref4 => {
560
555
  let {
561
556
  clientX,
562
557
  value,
563
- useRawValue = false
558
+ useRawValue
564
559
  } = _ref4;
565
560
  const range = this.props.max - this.props.min;
566
-
567
- // @todo solve for rtl.
568
- const leftPercent = this.calcLeftPercent({
561
+ const leftPercentRaw = this.calcLeftPercent({
569
562
  clientX,
570
563
  value,
571
564
  range
572
565
  });
566
+ /** `leftPercentRaw` clamped between 0 and 1. */
567
+ const leftPercent = Math.min(1, Math.max(0, leftPercentRaw));
573
568
  if (useRawValue) {
574
- // Adjusts only for min/max of thumb position
575
569
  return {
576
570
  value,
577
- left: Math.min(1, Math.max(0, leftPercent)) * 100
571
+ left: leftPercent * 100
578
572
  };
579
573
  }
580
- const [steppedValue, steppedPercent] = this.calcSteppedValuePercent({
581
- leftPercent,
582
- range
574
+
575
+ // Use the discrete value and percentage for snapping.
576
+ const {
577
+ discreteValue,
578
+ discretePercent
579
+ } = this.calcDiscreteValueAndPercent({
580
+ leftPercent
583
581
  });
584
582
  return {
585
- value: steppedValue,
586
- left: steppedPercent * 100
583
+ value: discreteValue,
584
+ left: discretePercent * 100
587
585
  };
588
586
  });
589
587
  _defineProperty(this, "calcDistanceToHandle", (handle, clientX) => {
@@ -593,19 +591,21 @@ class Slider extends PureComponent {
593
591
  return Math.abs(handleX - clientX);
594
592
  });
595
593
  /**
596
- * Given the current value, delta and step, calculate the new value.
594
+ * Calculates a new slider value based on the current value, a change delta,
595
+ * and a step.
597
596
  *
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.
597
+ * @param currentValue - The starting value from which the slider is moving.
598
+ * @param delta - The amount to adjust the current value by.
599
+ * @param step - The step. Defaults to `1`.
600
+ * @returns The new slider value, rounded to the same number of decimal places
601
+ * as the step.
605
602
  */
606
603
  _defineProperty(this, "calcValueForDelta", function (currentValue, delta) {
607
604
  let step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
608
- return (delta > 0 ? Math.floor(currentValue / step) * step : currentValue) + delta;
605
+ const base = delta > 0 ? Math.floor(currentValue / step) * step : currentValue;
606
+ const newValue = base + delta;
607
+ const decimals = (step.toString().split('.')[1] || '').length;
608
+ return Number(newValue.toFixed(decimals));
609
609
  });
610
610
  /**
611
611
  * Sets state relevant to the given handle position.
@@ -869,18 +869,16 @@ class Slider extends PureComponent {
869
869
  }
870
870
 
871
871
  /**
872
- * Takes a value and ensures it fits to the steps of the range
873
- * @param value
874
- * @returns value of the nearest step
872
+ * Rounds a given value to the nearest step defined by the slider's `step`
873
+ * prop.
874
+ *
875
+ * @param value - The value to adjust to the nearest step. Defaults to `0`.
876
+ * @returns The value rounded to the precision determined by the step.
875
877
  */
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);
878
+ nearestStepValue() {
879
+ let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
880
+ const decimals = (this.props.step?.toString().split('.')[1] || '').length;
881
+ return Number(value.toFixed(decimals));
884
882
  }
885
883
  getClientXFromEvent(event) {
886
884
  let clientX;
@@ -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.
@@ -340,12 +340,9 @@ export interface TabProps extends HTMLAttributes<HTMLElement> {
340
340
  */
341
341
  renderButton?(): ReactNode;
342
342
  /**
343
- * Optional prop to render an icon next to the label.
344
- * Can be a React component class
343
+ * A component used to render an icon.
345
344
  */
346
- renderIcon?: ComponentType<{
347
- size: number;
348
- }>;
345
+ renderIcon?: React.ElementType;
349
346
  /**
350
347
  * An optional label to render under the primary tab label.
351
348
  * Only useful for contained tabs.
@@ -21,12 +21,13 @@ import { isElement } from 'react-is';
21
21
  import '../Tooltip/DefinitionTooltip.js';
22
22
  import { Tooltip } from '../Tooltip/Tooltip.js';
23
23
  import { useControllableState } from '../../internal/useControllableState.js';
24
- import { useEffectOnce } from '../../internal/useEffectOnce.js';
25
24
  import { useId } from '../../internal/useId.js';
26
25
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
27
26
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
28
27
  import { getInteractiveContent } from '../../internal/useNoInteractiveChildren.js';
29
28
  import { usePrefix } from '../../internal/usePrefix.js';
29
+ import { ArrowRight, ArrowLeft, Home, End, ArrowDown, ArrowUp, Delete } from '../../internal/keyboard/keys.js';
30
+ import { matches, match } from '../../internal/keyboard/match.js';
30
31
  import { usePressable } from './usePressable.js';
31
32
  import deprecate from '../../prop-types/deprecate.js';
32
33
  import { useEvent } from '../../internal/useEvent.js';
@@ -34,9 +35,7 @@ import { useMatchMedia } from '../../internal/useMatchMedia.js';
34
35
  import '../Text/index.js';
35
36
  import { BadgeIndicator } from '../BadgeIndicator/index.js';
36
37
  import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
37
- import { matches, match } from '../../internal/keyboard/match.js';
38
38
  import { Text } from '../Text/Text.js';
39
- import { ArrowRight, ArrowLeft, Home, End, ArrowDown, ArrowUp, Delete } from '../../internal/keyboard/keys.js';
40
39
 
41
40
  var _ChevronLeft, _ChevronRight, _BadgeIndicator;
42
41
  const verticalTabHeight = 64;
@@ -382,7 +381,7 @@ function TabList(_ref4) {
382
381
  }
383
382
  }
384
383
  }
385
- useEffectOnce(() => {
384
+ useEffect(() => {
386
385
  const tab = tabs.current[selectedIndex];
387
386
  if (scrollIntoView && tab) {
388
387
  tab.scrollIntoView({
@@ -390,7 +389,7 @@ function TabList(_ref4) {
390
389
  inline: 'nearest'
391
390
  });
392
391
  }
393
- });
392
+ }, []);
394
393
  useEffect(() => {
395
394
  //adding 1 in calculation for firefox support
396
395
  setIsNextButtonVisible(ref.current ? scrollLeft + buttonWidth + ref.current.clientWidth + 1 < ref.current.scrollWidth : false);
@@ -400,7 +399,7 @@ function TabList(_ref4) {
400
399
  }
401
400
  }
402
401
  }, [scrollLeft, children, dismissable, isScrollable]);
403
- useEffectOnce(() => {
402
+ useEffect(() => {
404
403
  if (tabs.current[selectedIndex]?.disabled) {
405
404
  const activeTabs = tabs.current.filter(tab => {
406
405
  return !tab.disabled;
@@ -410,7 +409,7 @@ function TabList(_ref4) {
410
409
  setSelectedIndex(tabs.current.indexOf(tab));
411
410
  }
412
411
  }
413
- });
412
+ }, []);
414
413
  useIsomorphicEffect(() => {
415
414
  if (ref.current) {
416
415
  // adding 1 in calculation for firefox support
@@ -624,7 +623,7 @@ function TabListVertical(_ref8) {
624
623
  setActiveIndex(selectedIndex);
625
624
  }
626
625
  }
627
- useEffectOnce(() => {
626
+ useEffect(() => {
628
627
  if (tabs.current[selectedIndex]?.disabled) {
629
628
  const activeTabs = tabs.current.filter(tab => {
630
629
  return !tab.disabled;
@@ -634,7 +633,7 @@ function TabListVertical(_ref8) {
634
633
  setSelectedIndex(tabs.current.indexOf(tab));
635
634
  }
636
635
  }
637
- });
636
+ }, []);
638
637
  useEffect(() => {
639
638
  function handler() {
640
639
  const containerHeight = ref.current?.offsetHeight;
@@ -1007,22 +1006,21 @@ Tab.propTypes = {
1007
1006
  * Provide a handler that is invoked on the key down event for the control
1008
1007
  */
1009
1008
  onKeyDown: PropTypes.func,
1010
- /*
1009
+ /**
1011
1010
  * An optional parameter to allow overriding the anchor rendering.
1012
1011
  * Useful for using Tab along with react-router or other client
1013
1012
  * side router libraries.
1014
- **/
1013
+ */
1015
1014
  renderButton: PropTypes.func,
1016
1015
  /**
1017
- * Optional prop to render an icon next to the label.
1018
- * Can be a React component class
1016
+ * A component used to render an icon.
1019
1017
  */
1020
1018
  // @ts-expect-error: Invalid prop type derivation
1021
1019
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
1022
- /*
1020
+ /**
1023
1021
  * An optional label to render under the primary tab label.
1024
- /* This prop is only useful for contained tabs
1025
- **/
1022
+ * Only useful for contained tabs.
1023
+ */
1026
1024
  secondaryLabel: PropTypes.string
1027
1025
  };
1028
1026
 
@@ -1124,7 +1122,7 @@ const TabPanel = /*#__PURE__*/React__default.forwardRef(function TabPanel(_ref12
1124
1122
  const className = cx(`${prefix}--tab-content`, customClassName, {
1125
1123
  [`${prefix}--tab-content--interactive`]: interactiveContent
1126
1124
  });
1127
- useEffectOnce(() => {
1125
+ useEffect(() => {
1128
1126
  if (!panel.current) {
1129
1127
  return;
1130
1128
  }
@@ -1133,7 +1131,7 @@ const TabPanel = /*#__PURE__*/React__default.forwardRef(function TabPanel(_ref12
1133
1131
  setInteractiveContent(true);
1134
1132
  setTabIndex(-1);
1135
1133
  }
1136
- });
1134
+ }, []);
1137
1135
 
1138
1136
  // tabindex should only be 0 if no interactive content in children
1139
1137
  useEffect(() => {
@@ -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.
@@ -30,8 +30,7 @@ export interface DismissibleTagBaseProps {
30
30
  */
31
31
  onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
32
32
  /**
33
- * Optional prop to render a custom icon.
34
- * Can be a React component class
33
+ * A component used to render an icon.
35
34
  */
36
35
  renderIcon?: React.ElementType;
37
36
  /**
@@ -86,8 +85,7 @@ declare const DismissibleTag: {
86
85
  */
87
86
  onClose: PropTypes.Requireable<(...args: any[]) => any>;
88
87
  /**
89
- * Optional prop to render a custom icon.
90
- * Can be a React component class
88
+ * A component used to render an icon.
91
89
  */
92
90
  renderIcon: PropTypes.Requireable<object>;
93
91
  /**