@carbon/react 1.76.0 → 1.77.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 (188) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +810 -775
  2. package/es/components/Button/Button.d.ts +9 -1
  3. package/es/components/Button/Button.js +8 -0
  4. package/es/components/CodeSnippet/CodeSnippet.d.ts +2 -2
  5. package/es/components/ComboBox/ComboBox.d.ts +2 -2
  6. package/es/components/ComboBox/ComboBox.js +34 -12
  7. package/es/components/ComboButton/index.js +1 -2
  8. package/es/components/ComposedModal/ComposedModal.js +1 -1
  9. package/es/components/ContentSwitcher/index.d.ts +0 -1
  10. package/es/components/ContextMenu/useContextMenu.d.ts +0 -1
  11. package/es/components/Copy/Copy.js +1 -1
  12. package/es/components/DataTable/DataTable.d.ts +12 -20
  13. package/es/components/DataTable/DataTable.js +1 -9
  14. package/es/components/DataTable/Table.js +1 -1
  15. package/es/components/DataTable/TableActionList.d.ts +1 -1
  16. package/es/components/DataTable/TableBody.js +1 -1
  17. package/es/components/DataTable/TableContext.d.ts +0 -1
  18. package/es/components/DataTable/TableHead.d.ts +1 -1
  19. package/es/components/DataTable/TableToolbarContent.d.ts +1 -1
  20. package/es/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
  21. package/es/components/DatePickerInput/DatePickerInput.js +1 -1
  22. package/es/components/Dropdown/Dropdown.js +1 -2
  23. package/es/components/FluidForm/FormContext.d.ts +0 -1
  24. package/es/components/Grid/CSSGrid.js +1 -1
  25. package/es/components/Grid/Grid.js +1 -1
  26. package/es/components/Grid/GridTypes.d.ts +0 -1
  27. package/es/components/Heading/index.d.ts +1 -1
  28. package/es/components/IconButton/index.d.ts +17 -1
  29. package/es/components/IconButton/index.js +20 -1
  30. package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
  31. package/es/components/InlineLoading/InlineLoading.d.ts +1 -1
  32. package/es/components/InlineLoading/InlineLoading.js +21 -7
  33. package/es/components/Menu/Menu.js +2 -2
  34. package/es/components/Menu/MenuContext.d.ts +1 -1
  35. package/es/components/MenuButton/index.d.ts +1 -1
  36. package/es/components/MenuButton/index.js +1 -2
  37. package/es/components/Modal/Modal.js +1 -1
  38. package/es/components/Modal/next/index.d.ts +175 -0
  39. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
  40. package/es/components/MultiSelect/FilterableMultiSelect.js +12 -5
  41. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  42. package/es/components/MultiSelect/MultiSelect.js +1 -2
  43. package/es/components/Pagination/Pagination.js +2 -2
  44. package/es/components/Popover/index.js +2 -3
  45. package/es/components/PrimaryButton/PrimaryButton.d.ts +1 -1
  46. package/es/components/RadioTile/RadioTile.d.ts +1 -1
  47. package/es/components/SecondaryButton/SecondaryButton.d.ts +1 -1
  48. package/es/components/Slider/Slider.d.ts +1 -1
  49. package/es/components/Slider/Slider.js +1 -1
  50. package/es/components/Slider/index.d.ts +0 -1
  51. package/es/components/Tabs/Tabs.d.ts +3 -3
  52. package/es/components/Tabs/Tabs.js +4 -4
  53. package/es/components/Tag/DismissibleTag.d.ts +2 -2
  54. package/es/components/Tag/OperationalTag.d.ts +1 -1
  55. package/es/components/Tag/SelectableTag.d.ts +2 -2
  56. package/es/components/Text/index.d.ts +2 -2
  57. package/es/components/TextInput/PasswordInput.d.ts +1 -1
  58. package/es/components/Theme/index.d.ts +1 -1
  59. package/es/components/Tile/Tile.d.ts +1 -1
  60. package/es/components/Tile/Tile.js +1 -1
  61. package/es/components/Toggletip/index.d.ts +3 -3
  62. package/es/components/Toggletip/index.js +5 -4
  63. package/es/components/Tooltip/Tooltip.d.ts +17 -1
  64. package/es/components/Tooltip/Tooltip.js +12 -2
  65. package/es/components/TreeView/TreeNode.d.ts +27 -19
  66. package/es/components/TreeView/TreeNode.js +100 -31
  67. package/es/components/TreeView/TreeView.js +1 -1
  68. package/es/components/UIShell/Content.d.ts +9 -9
  69. package/es/components/UIShell/HeaderGlobalBar.d.ts +1 -1
  70. package/es/components/UIShell/HeaderMenu.d.ts +69 -25
  71. package/es/components/UIShell/HeaderMenuButton.d.ts +69 -27
  72. package/es/components/UIShell/HeaderMenuItem.d.ts +4 -3
  73. package/es/components/UIShell/HeaderMenuItem.js +1 -1
  74. package/es/components/UIShell/HeaderName.js +1 -1
  75. package/es/components/UIShell/HeaderNavigation.d.ts +69 -25
  76. package/es/components/UIShell/Link.d.ts +14 -11
  77. package/es/components/UIShell/Link.js +5 -6
  78. package/es/components/UIShell/SideNav.js +3 -3
  79. package/es/components/UIShell/SideNavLink.js +1 -1
  80. package/es/components/UIShell/SideNavMenuItem.d.ts +51 -3
  81. package/es/components/UIShell/SideNavMenuItem.js +6 -6
  82. package/es/components/UIShell/SwitcherItem.d.ts +2 -2
  83. package/es/components/UIShell/SwitcherItem.js +1 -1
  84. package/es/internal/PolymorphicProps.d.ts +0 -1
  85. package/es/internal/Selection.d.ts +38 -0
  86. package/es/internal/Selection.js +26 -113
  87. package/es/node_modules/es-toolkit/dist/compat/function/debounce.mjs.js +55 -0
  88. package/es/node_modules/es-toolkit/dist/compat/function/throttle.mjs.js +23 -0
  89. package/es/node_modules/es-toolkit/dist/function/debounce.mjs.js +70 -0
  90. package/es/tools/wrapComponent.d.ts +1 -1
  91. package/lib/components/Button/Button.d.ts +9 -1
  92. package/lib/components/Button/Button.js +8 -0
  93. package/lib/components/CodeSnippet/CodeSnippet.d.ts +2 -2
  94. package/lib/components/ComboBox/ComboBox.d.ts +2 -2
  95. package/lib/components/ComboBox/ComboBox.js +34 -12
  96. package/lib/components/ComboButton/index.js +1 -2
  97. package/lib/components/ComposedModal/ComposedModal.js +2 -2
  98. package/lib/components/ContentSwitcher/index.d.ts +0 -1
  99. package/lib/components/ContextMenu/useContextMenu.d.ts +0 -1
  100. package/lib/components/Copy/Copy.js +2 -2
  101. package/lib/components/DataTable/DataTable.d.ts +12 -20
  102. package/lib/components/DataTable/DataTable.js +1 -9
  103. package/lib/components/DataTable/Table.js +3 -3
  104. package/lib/components/DataTable/TableActionList.d.ts +1 -1
  105. package/lib/components/DataTable/TableBody.js +1 -1
  106. package/lib/components/DataTable/TableContext.d.ts +0 -1
  107. package/lib/components/DataTable/TableHead.d.ts +1 -1
  108. package/lib/components/DataTable/TableToolbarContent.d.ts +1 -1
  109. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
  110. package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
  111. package/lib/components/Dropdown/Dropdown.js +1 -2
  112. package/lib/components/FluidForm/FormContext.d.ts +0 -1
  113. package/lib/components/Grid/CSSGrid.js +1 -1
  114. package/lib/components/Grid/Grid.js +1 -1
  115. package/lib/components/Grid/GridTypes.d.ts +0 -1
  116. package/lib/components/Heading/index.d.ts +1 -1
  117. package/lib/components/IconButton/index.d.ts +17 -1
  118. package/lib/components/IconButton/index.js +20 -1
  119. package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
  120. package/lib/components/InlineLoading/InlineLoading.d.ts +1 -1
  121. package/lib/components/InlineLoading/InlineLoading.js +20 -6
  122. package/lib/components/Menu/Menu.js +2 -2
  123. package/lib/components/Menu/MenuContext.d.ts +1 -1
  124. package/lib/components/MenuButton/index.d.ts +1 -1
  125. package/lib/components/MenuButton/index.js +1 -2
  126. package/lib/components/Modal/Modal.js +2 -2
  127. package/lib/components/Modal/next/index.d.ts +175 -0
  128. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
  129. package/lib/components/MultiSelect/FilterableMultiSelect.js +11 -4
  130. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  131. package/lib/components/MultiSelect/MultiSelect.js +1 -2
  132. package/lib/components/Pagination/Pagination.js +3 -2
  133. package/lib/components/Popover/index.js +2 -3
  134. package/lib/components/PrimaryButton/PrimaryButton.d.ts +1 -1
  135. package/lib/components/RadioTile/RadioTile.d.ts +1 -1
  136. package/lib/components/SecondaryButton/SecondaryButton.d.ts +1 -1
  137. package/lib/components/Slider/Slider.d.ts +1 -1
  138. package/lib/components/Slider/Slider.js +2 -2
  139. package/lib/components/Slider/index.d.ts +0 -1
  140. package/lib/components/Tabs/Tabs.d.ts +3 -3
  141. package/lib/components/Tabs/Tabs.js +6 -6
  142. package/lib/components/Tag/DismissibleTag.d.ts +2 -2
  143. package/lib/components/Tag/OperationalTag.d.ts +1 -1
  144. package/lib/components/Tag/SelectableTag.d.ts +2 -2
  145. package/lib/components/Text/index.d.ts +2 -2
  146. package/lib/components/TextInput/PasswordInput.d.ts +1 -1
  147. package/lib/components/Theme/index.d.ts +1 -1
  148. package/lib/components/Tile/Tile.d.ts +1 -1
  149. package/lib/components/Tile/Tile.js +1 -1
  150. package/lib/components/Toggletip/index.d.ts +3 -3
  151. package/lib/components/Toggletip/index.js +5 -4
  152. package/lib/components/Tooltip/Tooltip.d.ts +17 -1
  153. package/lib/components/Tooltip/Tooltip.js +12 -2
  154. package/lib/components/TreeView/TreeNode.d.ts +27 -19
  155. package/lib/components/TreeView/TreeNode.js +100 -31
  156. package/lib/components/TreeView/TreeView.js +1 -1
  157. package/lib/components/UIShell/Content.d.ts +9 -9
  158. package/lib/components/UIShell/HeaderGlobalBar.d.ts +1 -1
  159. package/lib/components/UIShell/HeaderMenu.d.ts +69 -25
  160. package/lib/components/UIShell/HeaderMenuButton.d.ts +69 -27
  161. package/lib/components/UIShell/HeaderMenuItem.d.ts +4 -3
  162. package/lib/components/UIShell/HeaderMenuItem.js +1 -1
  163. package/lib/components/UIShell/HeaderName.js +1 -1
  164. package/lib/components/UIShell/HeaderNavigation.d.ts +69 -25
  165. package/lib/components/UIShell/Link.d.ts +14 -11
  166. package/lib/components/UIShell/Link.js +4 -4
  167. package/lib/components/UIShell/SideNav.js +3 -3
  168. package/lib/components/UIShell/SideNavLink.js +1 -1
  169. package/lib/components/UIShell/SideNavMenuItem.d.ts +51 -3
  170. package/lib/components/UIShell/SideNavMenuItem.js +6 -6
  171. package/lib/components/UIShell/SwitcherItem.d.ts +2 -2
  172. package/lib/components/UIShell/SwitcherItem.js +1 -1
  173. package/lib/internal/PolymorphicProps.d.ts +0 -1
  174. package/lib/internal/Selection.d.ts +38 -0
  175. package/lib/internal/Selection.js +24 -114
  176. package/lib/node_modules/es-toolkit/dist/compat/function/debounce.mjs.js +59 -0
  177. package/lib/node_modules/es-toolkit/dist/compat/function/throttle.mjs.js +27 -0
  178. package/lib/node_modules/es-toolkit/dist/function/debounce.mjs.js +74 -0
  179. package/lib/tools/wrapComponent.d.ts +1 -1
  180. package/package.json +10 -9
  181. package/es/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +0 -896
  182. package/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +0 -76
  183. package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +0 -139
  184. package/es/tools/array.js +0 -29
  185. package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +0 -909
  186. package/lib/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +0 -80
  187. package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +0 -163
  188. package/lib/tools/array.js +0 -33
@@ -38,7 +38,9 @@ const IconButton = /*#__PURE__*/React__default.forwardRef(function IconButton(_r
38
38
  closeOnActivation = true,
39
39
  defaultOpen = false,
40
40
  disabled,
41
+ dropShadow = false,
41
42
  enterDelayMs = 100,
43
+ highContrast = true,
42
44
  kind,
43
45
  label,
44
46
  leaveDelayMs = 100,
@@ -57,7 +59,9 @@ const IconButton = /*#__PURE__*/React__default.forwardRef(function IconButton(_r
57
59
  closeOnActivation: closeOnActivation,
58
60
  className: tooltipClasses,
59
61
  defaultOpen: defaultOpen,
62
+ dropShadow: dropShadow,
60
63
  enterDelayMs: enterDelayMs,
64
+ highContrast: highContrast,
61
65
  label: label,
62
66
  leaveDelayMs: leaveDelayMs
63
67
  }, /*#__PURE__*/React__default.createElement(ButtonBase, _extends({}, rest, {
@@ -124,6 +128,10 @@ IconButton.propTypes = {
124
128
  * Specify whether the tooltip should be open when it first renders
125
129
  */
126
130
  defaultOpen: PropTypes.bool,
131
+ /**
132
+ * Specify whether a drop shadow should be rendered on the tooltip
133
+ */
134
+ dropShadow: PropTypes.bool,
127
135
  /**
128
136
  * Specify whether the Button should be disabled, or not
129
137
  */
@@ -135,8 +143,11 @@ IconButton.propTypes = {
135
143
  /**
136
144
  * Specify whether the IconButton is currently selected
137
145
  */
138
-
139
146
  isSelected: PropTypes.bool,
147
+ /**
148
+ * Render the tooltip using the high-contrast theme
149
+ */
150
+ highContrast: PropTypes.bool,
140
151
  /**
141
152
  * Specify the type of button to be used as the base for the IconButton
142
153
  */
@@ -152,10 +163,18 @@ IconButton.propTypes = {
152
163
  * Specify the duration in milliseconds to delay before hiding the tooltip
153
164
  */
154
165
  leaveDelayMs: PropTypes.number,
166
+ /**
167
+ * Optionally specify a `rel` when using an `<a>` element.
168
+ */
169
+ rel: PropTypes.string,
155
170
  /**
156
171
  * Specify the size of the Button. Defaults to `md`.
157
172
  */
158
173
  size: PropTypes.oneOf(['sm', 'md', 'lg']),
174
+ /**
175
+ * Optionally specify a `target` when using an `<a>` element.
176
+ */
177
+ target: PropTypes.string,
159
178
  /**
160
179
  * Specify an optional className to be added to your Tooltip wrapper
161
180
  */
@@ -95,7 +95,7 @@ InlineCheckbox.propTypes = {
95
95
  */
96
96
  id: PropTypes.string.isRequired,
97
97
  /**
98
- * Specify whether the control is in an indterminate state
98
+ * Specify whether the control is in an indeterminate state
99
99
  */
100
100
  indeterminate: PropTypes.bool,
101
101
  /**
@@ -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.
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default from 'react';
9
+ import React__default, { useRef, useEffect } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
12
  import { ErrorFilled, CheckmarkFilled } from '@carbon/icons-react';
@@ -25,6 +25,22 @@ const InlineLoading = _ref => {
25
25
  } = _ref;
26
26
  const prefix = usePrefix();
27
27
  const loadingClasses = cx(`${prefix}--inline-loading`, className);
28
+ const timerRef = useRef(null);
29
+ useEffect(() => {
30
+ if (status === 'finished') {
31
+ timerRef.current = setTimeout(() => {
32
+ if (onSuccess) {
33
+ onSuccess();
34
+ }
35
+ }, successDelay);
36
+ }
37
+ return () => {
38
+ if (timerRef.current) {
39
+ clearTimeout(timerRef.current);
40
+ timerRef.current = null;
41
+ }
42
+ };
43
+ }, [status, onSuccess, successDelay]);
28
44
  const getLoading = () => {
29
45
  let iconLabel = iconDescription ? iconDescription : status;
30
46
  if (status === 'error') {
@@ -33,11 +49,6 @@ const InlineLoading = _ref => {
33
49
  }, /*#__PURE__*/React__default.createElement("title", null, iconLabel));
34
50
  }
35
51
  if (status === 'finished') {
36
- setTimeout(() => {
37
- if (onSuccess) {
38
- onSuccess();
39
- }
40
- }, successDelay);
41
52
  return /*#__PURE__*/React__default.createElement(CheckmarkFilled, {
42
53
  className: `${prefix}--inline-loading__checkmark-container`
43
54
  }, /*#__PURE__*/React__default.createElement("title", null, iconLabel));
@@ -55,6 +66,9 @@ const InlineLoading = _ref => {
55
66
  }
56
67
  return undefined;
57
68
  };
69
+
70
+ // TODO: Should this element only be constructed, similar to
71
+ // `loadingAnimation`, if `description` is specified?
58
72
  const loadingText = /*#__PURE__*/React__default.createElement("div", {
59
73
  className: `${prefix}--inline-loading__text`
60
74
  }, description);
@@ -65,7 +79,7 @@ const InlineLoading = _ref => {
65
79
  return /*#__PURE__*/React__default.createElement("div", _extends({
66
80
  className: loadingClasses
67
81
  }, rest, {
68
- "aria-live": 'assertive'
82
+ "aria-live": rest['aria-live'] ?? 'assertive'
69
83
  }), loadingAnimation, description && loadingText);
70
84
  };
71
85
  InlineLoading.propTypes = {
@@ -191,7 +191,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
191
191
  }
192
192
  };
193
193
 
194
- // Avoid that the Menu render incorrectly when the postion is set in the right side of the screen
194
+ // Avoid that the Menu render incorrectly when the position is set in the right side of the screen
195
195
  if (actionButtonWidth && actionButtonWidth < axes.x.size && (menuAlignment === 'bottom' || menuAlignment === 'top')) {
196
196
  axes.x.size = actionButtonWidth;
197
197
  }
@@ -219,7 +219,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
219
219
  max - spacing - size];
220
220
  const topAlignment = menuAlignment === 'top' || menuAlignment === 'top-end' || menuAlignment === 'top-start';
221
221
 
222
- // If the tooltip is not visible in the top, switch to the bototm
222
+ // If the tooltip is not visible in the top, switch to the bottom
223
223
  if (typeof options[0] === 'number' && topAlignment && options[0] >= 0 && !options[1] && axis === 'y') {
224
224
  menu.current.style.transform = 'translate(0)';
225
225
  } else if (topAlignment && !options[0] && axis === 'y') {
@@ -21,7 +21,7 @@ declare function menuReducer(state: StateType, action: ActionType): {
21
21
  hasIcons: boolean;
22
22
  isRoot: boolean;
23
23
  mode: "full" | "basic";
24
- size: "sm" | "md" | "lg" | "xs" | null;
24
+ size: "xs" | "sm" | "md" | "lg" | null;
25
25
  items: any[];
26
26
  requestCloseRoot: (e: Pick<KeyboardEvent<HTMLUListElement>, "type">) => void;
27
27
  };
@@ -30,7 +30,7 @@ export interface MenuButtonProps extends ComponentProps<'div'> {
30
30
  /**
31
31
  * Experimental property. Specify how the menu should align with the button element
32
32
  */
33
- menuAlignment: MenuAlignment;
33
+ menuAlignment?: MenuAlignment;
34
34
  /**
35
35
  * Specify the size of the button and menu.
36
36
  */
@@ -152,13 +152,12 @@ MenuButton.propTypes = {
152
152
  // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
153
153
  kind: PropTypes.oneOf(validButtonKinds),
154
154
  /**
155
- * Provide the label to be renderd on the trigger button.
155
+ * Provide the label to be rendered on the trigger button.
156
156
  */
157
157
  label: PropTypes.string.isRequired,
158
158
  /**
159
159
  * Experimental property. Specify how the menu should align with the button element
160
160
  */
161
- // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
162
161
  menuAlignment: PropTypes.oneOf(['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end']),
163
162
  /**
164
163
  * Specify the size of the button and menu.
@@ -18,7 +18,6 @@ import InlineLoading from '../InlineLoading/InlineLoading.js';
18
18
  import { Layer } from '../Layer/index.js';
19
19
  import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
20
20
  import wrapFocus, { wrapFocusWithoutSentinels, elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
21
- import { debounce } from 'es-toolkit/compat';
22
21
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
23
22
  import { useId } from '../../internal/useId.js';
24
23
  import { usePrefix } from '../../internal/usePrefix.js';
@@ -28,6 +27,7 @@ import '../Text/index.js';
28
27
  import { useFeatureFlag } from '../FeatureFlags/index.js';
29
28
  import { composeEventHandlers } from '../../tools/events.js';
30
29
  import deprecate from '../../prop-types/deprecate.js';
30
+ import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
31
31
  import { Text } from '../Text/Text.js';
32
32
  import { match } from '../../internal/keyboard/match.js';
33
33
  import { Escape, Enter, Tab } from '../../internal/keyboard/keys.js';
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React, { ReactNode } from 'react';
8
+ import { ReactAttr } from '../../../types/common';
9
+ import { InlineLoadingStatus } from '../../InlineLoading/InlineLoading';
10
+ export declare const ModalSizes: readonly ["xs", "sm", "md", "lg"];
11
+ export type ModalSize = (typeof ModalSizes)[number];
12
+ export interface ModalSecondaryButton {
13
+ buttonText?: string | ReactNode;
14
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
15
+ }
16
+ export interface BaseModalProps extends ReactAttr<HTMLDivElement> {
17
+ /**
18
+ * Required props for the accessibility label of the header
19
+ */
20
+ 'aria-label'?: string;
21
+ /**
22
+ * Provide the contents of your Modal
23
+ */
24
+ children?: ReactNode;
25
+ /**
26
+ * Specify an optional className to be applied to the modal root node
27
+ */
28
+ className?: string;
29
+ /**
30
+ * Specify an label for the close button of the modal; defaults to close
31
+ */
32
+ closeButtonLabel?: string;
33
+ /**
34
+ * Specify whether the Modal is for dangerous actions
35
+ */
36
+ danger?: boolean;
37
+ /**
38
+ * **Experimental**: Provide a decorator component to be rendered inside the `Modal` component
39
+ */
40
+ decorator?: ReactNode;
41
+ /**
42
+ * Specify whether the modal contains scrolling content
43
+ */
44
+ hasScrollingContent?: boolean;
45
+ /**
46
+ * Specify the DOM element ID of the top-level node.
47
+ */
48
+ id?: string;
49
+ /**
50
+ * Specify whether or not the Modal content should have any inner padding.
51
+ */
52
+ isFullWidth?: boolean;
53
+ /**
54
+ * Provide a ref to return focus to once the modal is closed.
55
+ */
56
+ launcherButtonRef?: any;
57
+ /**
58
+ * Specify the description for the loading text
59
+ */
60
+ loadingDescription?: string;
61
+ /**
62
+ * Specify the description for the loading text
63
+ */
64
+ loadingIconDescription?: string;
65
+ /**
66
+ * Specify loading status
67
+ */
68
+ loadingStatus?: InlineLoadingStatus;
69
+ /**
70
+ * Specify a label to be read by screen readers on the modal root node
71
+ */
72
+ modalAriaLabel?: string;
73
+ /**
74
+ * Specify the content of the modal header title.
75
+ */
76
+ modalHeading?: ReactNode;
77
+ /**
78
+ * Specify the content of the modal header label.
79
+ */
80
+ modalLabel?: ReactNode;
81
+ /**
82
+ * Specify a handler for keypresses.
83
+ * @deprecated this property is unused
84
+ */
85
+ onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
86
+ /**
87
+ * Specify an optional handler to be invoked when loading is
88
+ * successful
89
+ */
90
+ onLoadingSuccess?: () => void;
91
+ /**
92
+ * Specify a handler for closing modal.
93
+ * The handler should care of closing modal, e.g. changing `open` prop.
94
+ */
95
+ onRequestClose?: React.ReactEventHandler<HTMLElement>;
96
+ /**
97
+ * Specify a handler for "submitting" modal.
98
+ * The handler should care of closing modal, e.g. changing `open` prop, if necessary.
99
+ */
100
+ onRequestSubmit?: React.ReactEventHandler<HTMLElement>;
101
+ /**
102
+ * Specify a handler for the secondary button.
103
+ * Useful if separate handler from `onRequestClose` is desirable
104
+ */
105
+ onSecondarySubmit?: React.ReactEventHandler<HTMLElement>;
106
+ /**
107
+ * Specify whether the Modal is currently open
108
+ */
109
+ open?: boolean;
110
+ /**
111
+ * Prevent closing on click outside of modal
112
+ */
113
+ preventCloseOnClickOutside?: boolean;
114
+ /**
115
+ * Specify whether the Button should be disabled, or not
116
+ */
117
+ primaryButtonDisabled?: boolean;
118
+ /**
119
+ * Specify the text for the primary button
120
+ */
121
+ primaryButtonText?: ReactNode;
122
+ /**
123
+ * Specify the text for the secondary button
124
+ */
125
+ secondaryButtonText?: ReactNode;
126
+ /**
127
+ * Specify an array of config objects for secondary buttons
128
+ */
129
+ secondaryButtons?: ModalSecondaryButton[];
130
+ /**
131
+ * Specify a CSS selector that matches the DOM element that should
132
+ * be focused when the Modal opens
133
+ */
134
+ selectorPrimaryFocus?: string;
135
+ /**
136
+ * Specify CSS selectors that match DOM elements working as floating menus.
137
+ * Focusing on those elements won't trigger "focus-wrap" behavior
138
+ */
139
+ selectorsFloatingMenus?: string[];
140
+ /**
141
+ * Specify if Enter key should be used as "submit" action
142
+ */
143
+ shouldSubmitOnEnter?: boolean;
144
+ /**
145
+ * Specify the size variant.
146
+ */
147
+ size?: ModalSize;
148
+ }
149
+ interface PassiveModal extends BaseModalProps {
150
+ /**
151
+ * Specify whether the modal should be button-less
152
+ */
153
+ passiveModal?: true;
154
+ /**
155
+ * Specify whether the Modal is displaying an alert, error or warning. Should
156
+ * go hand in hand with the `danger` prop. This changes the `role` to
157
+ * `alertdialog` and cannot be used with passive modals.
158
+ */
159
+ alert?: never;
160
+ }
161
+ interface NonPassiveModal extends BaseModalProps {
162
+ /**
163
+ * Specify whether the modal should be button-less
164
+ */
165
+ passiveModal?: false;
166
+ /**
167
+ * Specify whether the Modal is displaying an alert, error or warning. Should
168
+ * go hand in hand with the `danger` prop. This changes the `role` to
169
+ * `alertdialog` and cannot be used with passive modals.
170
+ */
171
+ alert?: boolean;
172
+ }
173
+ export type ModalProps = PassiveModal | NonPassiveModal;
174
+ declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
175
+ export default Modal;
@@ -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.
@@ -63,7 +63,7 @@ export interface FilterableMultiSelectProps<ItemType> extends MultiSelectSorting
63
63
  /**
64
64
  * Default sorter is assigned if not provided.
65
65
  */
66
- filterItems(items: readonly ItemType[], extra: {
66
+ filterItems?(items: readonly ItemType[], extra: {
67
67
  inputValue: string | null;
68
68
  itemToString: NonNullable<UseComboboxProps<ItemType>['itemToString']>;
69
69
  }): ItemType[];
@@ -11,7 +11,7 @@ import cx from 'classnames';
11
11
  import Downshift, { useCombobox, useMultipleSelection } from 'downshift';
12
12
  import isEqual from 'react-fast-compare';
13
13
  import PropTypes from 'prop-types';
14
- import React__default, { useContext, useState, useLayoutEffect, useRef, useMemo, useEffect } from 'react';
14
+ import React__default, { useContext, useRef, useState, useLayoutEffect, useMemo, useEffect } from 'react';
15
15
  import { defaultFilterItems } from '../ComboBox/tools/filter.js';
16
16
  import { sortingPropTypes } from './MultiSelectPropTypes.js';
17
17
  import ListBox from '../ListBox/index.js';
@@ -26,8 +26,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
26
26
  import '../FluidForm/FluidForm.js';
27
27
  import { FormContext } from '../FluidForm/FormContext.js';
28
28
  import { useSelection } from '../../internal/Selection.js';
29
- import { useFloating, flip, size, autoUpdate } from '@floating-ui/react';
30
- import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
29
+ import { useFloating, flip, size, hide, autoUpdate } from '@floating-ui/react';
31
30
  import { match } from '../../internal/keyboard/match.js';
32
31
  import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
33
32
  import { Escape, Space, Enter, Delete, Tab, Home, End } from '../../internal/keyboard/keys.js';
@@ -107,6 +106,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
107
106
  const {
108
107
  isFluid
109
108
  } = useContext(FormContext);
109
+ const isFirstRender = useRef(true);
110
110
  const [isFocused, setIsFocused] = useState(false);
111
111
  const [isOpen, setIsOpen] = useState(!!open);
112
112
  const [prevOpen, setPrevOpen] = useState(!!open);
@@ -241,8 +241,15 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
241
241
  }
242
242
  }
243
243
  useEffect(() => {
244
- onMenuChange?.(isOpen);
245
- }, [isOpen, onMenuChange]);
244
+ if (isFirstRender.current) {
245
+ isFirstRender.current = false;
246
+ if (open) {
247
+ onMenuChange?.(isOpen);
248
+ }
249
+ } else {
250
+ onMenuChange?.(isOpen);
251
+ }
252
+ }, [isOpen, onMenuChange, open]);
246
253
  const {
247
254
  getToggleButtonProps,
248
255
  getLabelProps,
@@ -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.
@@ -25,8 +25,7 @@ import { FormContext } from '../FluidForm/FormContext.js';
25
25
  import Checkbox from '../Checkbox/Checkbox.js';
26
26
  import '../Checkbox/Checkbox.Skeleton.js';
27
27
  import { noopFn } from '../../internal/noopFn.js';
28
- import { useFloating, flip, size, autoUpdate } from '@floating-ui/react';
29
- import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
28
+ import { useFloating, flip, size, hide, autoUpdate } from '@floating-ui/react';
30
29
  import { useFeatureFlag } from '../FeatureFlags/index.js';
31
30
  import { match } from '../../internal/keyboard/match.js';
32
31
  import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
@@ -13,10 +13,10 @@ import React__default, { useRef, useState } from 'react';
13
13
  import Select from '../Select/Select.js';
14
14
  import '../Select/Select.Skeleton.js';
15
15
  import SelectItem from '../SelectItem/SelectItem.js';
16
- import { equals } from '../../tools/array.js';
17
16
  import { useFallbackId } from '../../internal/useId.js';
18
17
  import { usePrefix } from '../../internal/usePrefix.js';
19
18
  import { IconButton } from '../IconButton/index.js';
19
+ import isEqual from 'react-fast-compare';
20
20
 
21
21
  var _CaretLeft, _CaretRight;
22
22
  function mapPageSizesToObject(sizes) {
@@ -117,7 +117,7 @@ const Pagination = /*#__PURE__*/React__default.forwardRef(function Pagination(_r
117
117
  setPageSize(getPageSize(pageSizes, controlledPageSize));
118
118
  setPrevControlledPageSize(controlledPageSize);
119
119
  }
120
- if (!equals(controlledPageSizes, prevPageSizes)) {
120
+ if (!isEqual(controlledPageSizes, prevPageSizes)) {
121
121
  const pageSizes = mapPageSizesToObject(controlledPageSizes);
122
122
  const hasPageSize = pageSizes.find(size => {
123
123
  return size.value === pageSize;
@@ -15,8 +15,7 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
15
15
  import { usePrefix } from '../../internal/usePrefix.js';
16
16
  import { useWindowEvent } from '../../internal/useEvent.js';
17
17
  import { mapPopoverAlignProp } from '../../tools/createPropAdapter.js';
18
- import { useFloating, offset, flip, arrow, autoUpdate } from '@floating-ui/react';
19
- import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
18
+ import { useFloating, offset, flip, arrow, hide, autoUpdate } from '@floating-ui/react';
20
19
  import { useFeatureFlag } from '../FeatureFlags/index.js';
21
20
 
22
21
  const PopoverContext = /*#__PURE__*/React__default.createContext({
@@ -235,7 +234,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
235
234
  // For a popover, there isn't an explicit trigger component, it's just the first child that's
236
235
  // passed in which should *not* be PopoverContent.
237
236
  // For a toggletip there is a specific trigger component, ToggletipButton.
238
- // In either of these caes we want to set this as the reference node for floating-ui autoAlign
237
+ // In either of these cases we want to set this as the reference node for floating-ui autoAlign
239
238
  // positioning.
240
239
  if (enableFloatingStyles && item?.type?.displayName !== 'PopoverContent' || enableFloatingStyles && item?.type?.displayName === 'ToggletipButton') {
241
240
  // Set the reference element for floating-ui
@@ -6,5 +6,5 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import { ButtonProps } from '../Button';
9
- declare const PrimaryButton: <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
9
+ declare const PrimaryButton: <T extends React.ElementType>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
10
10
  export default PrimaryButton;
@@ -53,7 +53,7 @@ export interface RadioTileProps {
53
53
  onChange?: (value: string | number, name: string | undefined, event: React.ChangeEvent<HTMLInputElement> | React.KeyboardEvent<HTMLInputElement>) => void;
54
54
  /**
55
55
  * @deprecated please use `decorator` instead.
56
- * **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
56
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioTile` component
57
57
  */
58
58
  slug?: React.ReactNode;
59
59
  /**
@@ -6,5 +6,5 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import { ButtonProps } from '../Button';
9
- declare const SecondaryButton: <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
9
+ declare const SecondaryButton: <T extends React.ElementType>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
10
10
  export default SecondaryButton;
@@ -387,7 +387,7 @@ declare class Slider extends PureComponent<SliderProps> {
387
387
  * Throttles calls to `this._onDrag` by limiting events to being processed at
388
388
  * most once every `EVENT_THROTTLE` milliseconds.
389
389
  */
390
- onDrag: import("es-toolkit/dist/compat/function/debounce").DebouncedFunction<(evt: any, activeHandle?: HandlePosition | null) => void>;
390
+ onDrag: import("es-toolkit/compat").DebouncedFunc<(evt: any, activeHandle?: HandlePosition | null) => void>;
391
391
  /**
392
392
  * Handles a `keydown` event by recalculating the value/thumb and setting
393
393
  * state accordingly.
@@ -9,7 +9,6 @@ import { defineProperty as _defineProperty, extends as _extends } from '../../_v
9
9
  import React__default, { PureComponent } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
- import { throttle } from 'es-toolkit/compat';
13
12
  import { ArrowDown, ArrowLeft, ArrowUp, ArrowRight, Enter } from '../../internal/keyboard/keys.js';
14
13
  import { PrefixContext } from '../../internal/usePrefix.js';
15
14
  import deprecate from '../../prop-types/deprecate.js';
@@ -19,6 +18,7 @@ import '../Text/index.js';
19
18
  import '../Tooltip/DefinitionTooltip.js';
20
19
  import { Tooltip } from '../Tooltip/Tooltip.js';
21
20
  import { LowerHandle, LowerHandleFocus, UpperHandle, UpperHandleFocus } from './SliderHandles.js';
21
+ import { throttle } from '../../node_modules/es-toolkit/dist/compat/function/throttle.mjs.js';
22
22
  import { matches } from '../../internal/keyboard/match.js';
23
23
  import { Text } from '../Text/Text.js';
24
24
 
@@ -4,7 +4,6 @@
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
- /// <reference types="react" />
8
7
  declare const Slider: import("react").FunctionComponent<import("./Slider").SliderProps>;
9
8
  export { default as SliderSkeleton } from './Slider.Skeleton';
10
9
  export default Slider;
@@ -265,7 +265,7 @@ export interface TabListVerticalProps extends DivAttributes {
265
265
  * Provide an accessible label to be read when a user interacts with this
266
266
  * component
267
267
  */
268
- 'aria-label': string;
268
+ 'aria-label'?: string;
269
269
  /**
270
270
  * Provide child elements to be rendered inside `ContentTabs`.
271
271
  * These elements should render a `ContentTab`
@@ -293,7 +293,7 @@ declare namespace TabListVertical {
293
293
  * Provide an accessible label to be read when a user interacts with this
294
294
  * component
295
295
  */
296
- 'aria-label': PropTypes.Validator<string>;
296
+ 'aria-label': PropTypes.Requireable<string>;
297
297
  /**
298
298
  * Provide child elements to be rendered inside `ContentTabs`.
299
299
  * These elements should render a `ContentTab`
@@ -348,7 +348,7 @@ export interface TabProps extends HTMLAttributes<HTMLElement> {
348
348
  }>;
349
349
  /**
350
350
  * An optional label to render under the primary tab label.
351
- * Only useful for conained tabs.
351
+ * Only useful for contained tabs.
352
352
  */
353
353
  secondaryLabel?: string;
354
354
  }
@@ -9,7 +9,6 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import { ChevronLeft, ChevronRight, Close } from '@carbon/icons-react';
10
10
  import { breakpoints } from '@carbon/layout';
11
11
  import cx from 'classnames';
12
- import { debounce } from 'es-toolkit/compat';
13
12
  import PropTypes from 'prop-types';
14
13
  import React__default, { useState, useRef, useCallback, useEffect, forwardRef } from 'react';
15
14
  import '../Grid/FlexGrid.js';
@@ -33,6 +32,7 @@ import deprecate from '../../prop-types/deprecate.js';
33
32
  import { useEvent } from '../../internal/useEvent.js';
34
33
  import { useMatchMedia } from '../../internal/useMatchMedia.js';
35
34
  import '../Text/index.js';
35
+ import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
36
36
  import { Text } from '../Text/Text.js';
37
37
  import { matches, match } from '../../internal/keyboard/match.js';
38
38
  import { ArrowRight, ArrowLeft, Home, End, ArrowDown, ArrowUp, Delete } from '../../internal/keyboard/keys.js';
@@ -716,7 +716,7 @@ TabListVertical.propTypes = {
716
716
  * Provide an accessible label to be read when a user interacts with this
717
717
  * component
718
718
  */
719
- 'aria-label': PropTypes.string.isRequired,
719
+ 'aria-label': PropTypes.string,
720
720
  /**
721
721
  * Provide child elements to be rendered inside `ContentTabs`.
722
722
  * These elements should render a `ContentTab`
@@ -899,7 +899,7 @@ const Tab = /*#__PURE__*/forwardRef(function Tab(_ref10, forwardRef) {
899
899
  })));
900
900
  const hasIcon = Icon ?? dismissable;
901
901
 
902
- // should only happen for vertical variation, so no dissimisamble icon is needed here
902
+ // should only happen for vertical variation, so no dismissable icon is needed here
903
903
  if (isEllipsisApplied) {
904
904
  return /*#__PURE__*/React__default.createElement(Tooltip, {
905
905
  label: children,
@@ -1017,7 +1017,7 @@ Tab.propTypes = {
1017
1017
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
1018
1018
  /*
1019
1019
  * An optional label to render under the primary tab label.
1020
- /* This prop is only useful for conained tabs
1020
+ /* This prop is only useful for contained tabs
1021
1021
  **/
1022
1022
  secondaryLabel: PropTypes.string
1023
1023
  };