@carbon/react 1.47.0 → 1.48.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 (76) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +914 -839
  2. package/es/components/Button/Button.d.ts +1 -3
  3. package/es/components/Button/Button.js +9 -3
  4. package/es/components/ComboButton/index.js +1 -0
  5. package/es/components/ComposedModal/ModalHeader.js +10 -4
  6. package/es/components/DangerButton/DangerButton.js +2 -2
  7. package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
  8. package/es/components/DataTable/TableExpandRow.d.ts +1 -1
  9. package/es/components/DataTable/TableExpandRow.js +0 -1
  10. package/es/components/DataTable/TableHeader.d.ts +10 -1
  11. package/es/components/DataTable/index.d.ts +3 -2
  12. package/es/components/DatePicker/DatePicker.js +3 -2
  13. package/es/components/Dropdown/Dropdown.d.ts +3 -2
  14. package/es/components/Dropdown/index.d.ts +2 -2
  15. package/es/components/ExpandableSearch/ExpandableSearch.js +6 -3
  16. package/es/components/IconButton/index.d.ts +70 -0
  17. package/es/components/IconButton/index.js +6 -5
  18. package/es/components/ListBox/ListBoxMenuIcon.d.ts +3 -6
  19. package/es/components/ListBox/ListBoxMenuIcon.js +4 -8
  20. package/es/components/ListBox/index.d.ts +1 -0
  21. package/es/components/Menu/Menu.d.ts +59 -0
  22. package/es/components/Menu/Menu.js +33 -10
  23. package/es/components/Menu/MenuContext.d.ts +32 -0
  24. package/es/components/Menu/MenuItem.d.ts +119 -0
  25. package/es/components/Menu/MenuItem.js +17 -12
  26. package/es/components/Menu/index.d.ts +9 -0
  27. package/es/components/MenuButton/index.js +1 -0
  28. package/es/components/Modal/Modal.d.ts +1 -1
  29. package/es/components/Modal/Modal.js +10 -6
  30. package/es/components/OverflowMenu/next/index.js +1 -0
  31. package/es/components/Slug/index.js +5 -1
  32. package/es/components/Tooltip/Tooltip.js +1 -9
  33. package/es/components/TreeView/TreeNode.js +11 -3
  34. package/es/components/TreeView/TreeView.js +1 -1
  35. package/es/components/UIShell/HeaderMenu.js +1 -1
  36. package/es/components/UIShell/SwitcherItem.d.ts +4 -0
  37. package/es/components/UIShell/SwitcherItem.js +4 -0
  38. package/es/index.js +3 -3
  39. package/lib/components/Button/Button.d.ts +1 -3
  40. package/lib/components/Button/Button.js +9 -3
  41. package/lib/components/ComboButton/index.js +1 -0
  42. package/lib/components/ComposedModal/ModalHeader.js +10 -4
  43. package/lib/components/DangerButton/DangerButton.js +2 -2
  44. package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
  45. package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
  46. package/lib/components/DataTable/TableExpandRow.js +0 -1
  47. package/lib/components/DataTable/TableHeader.d.ts +10 -1
  48. package/lib/components/DataTable/index.d.ts +3 -2
  49. package/lib/components/DatePicker/DatePicker.js +3 -2
  50. package/lib/components/Dropdown/Dropdown.d.ts +3 -2
  51. package/lib/components/Dropdown/index.d.ts +2 -2
  52. package/lib/components/ExpandableSearch/ExpandableSearch.js +5 -2
  53. package/lib/components/IconButton/index.d.ts +70 -0
  54. package/lib/components/IconButton/index.js +6 -4
  55. package/lib/components/ListBox/ListBoxMenuIcon.d.ts +3 -6
  56. package/lib/components/ListBox/ListBoxMenuIcon.js +3 -8
  57. package/lib/components/ListBox/index.d.ts +1 -0
  58. package/lib/components/Menu/Menu.d.ts +59 -0
  59. package/lib/components/Menu/Menu.js +33 -10
  60. package/lib/components/Menu/MenuContext.d.ts +32 -0
  61. package/lib/components/Menu/MenuItem.d.ts +119 -0
  62. package/lib/components/Menu/MenuItem.js +17 -12
  63. package/lib/components/Menu/index.d.ts +9 -0
  64. package/lib/components/MenuButton/index.js +1 -0
  65. package/lib/components/Modal/Modal.d.ts +1 -1
  66. package/lib/components/Modal/Modal.js +10 -6
  67. package/lib/components/OverflowMenu/next/index.js +1 -0
  68. package/lib/components/Slug/index.js +5 -1
  69. package/lib/components/Tooltip/Tooltip.js +0 -8
  70. package/lib/components/TreeView/TreeNode.js +11 -3
  71. package/lib/components/TreeView/TreeView.js +1 -1
  72. package/lib/components/UIShell/HeaderMenu.js +1 -1
  73. package/lib/components/UIShell/SwitcherItem.d.ts +4 -0
  74. package/lib/components/UIShell/SwitcherItem.js +4 -0
  75. package/lib/index.js +9 -8
  76. package/package.json +7 -7
@@ -23,6 +23,7 @@ var requiredIfGivenPropIsTruthy = require('../../prop-types/requiredIfGivenPropI
23
23
  var wrapFocus = require('../../internal/wrapFocus.js');
24
24
  var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
25
25
  var usePrefix = require('../../internal/usePrefix.js');
26
+ var index = require('../IconButton/index.js');
26
27
  var noopFn = require('../../internal/noopFn.js');
27
28
  require('../Text/index.js');
28
29
  var Text = require('../Text/Text.js');
@@ -61,7 +62,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
61
62
  shouldSubmitOnEnter,
62
63
  size,
63
64
  hasScrollingContent = false,
64
- closeButtonLabel,
65
+ closeButtonLabel = 'Close',
65
66
  preventCloseOnClickOutside = false,
66
67
  isFullWidth,
67
68
  launcherButtonRef,
@@ -211,19 +212,22 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
211
212
  size: 'lg'
212
213
  });
213
214
  }
214
- const modalButton = /*#__PURE__*/React__default["default"].createElement("button", {
215
+ const modalButton = /*#__PURE__*/React__default["default"].createElement("div", {
216
+ className: `${prefix}--modal-close-button`
217
+ }, /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
215
218
  className: modalCloseButtonClass,
216
- type: "button",
219
+ label: closeButtonLabel,
217
220
  onClick: onRequestClose,
218
- title: ariaLabel,
219
- "aria-label": closeButtonLabel ? closeButtonLabel : 'close',
221
+ title: closeButtonLabel,
222
+ "aria-label": closeButtonLabel,
223
+ align: "left",
220
224
  ref: button
221
225
  }, /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, {
222
226
  size: 20,
223
227
  "aria-hidden": "true",
224
228
  tabIndex: "-1",
225
229
  className: `${modalCloseButtonClass}__icon`
226
- }));
230
+ })));
227
231
  const modalBody = /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
228
232
  ref: innerModal,
229
233
  role: "dialog"
@@ -16,6 +16,7 @@ var cx = require('classnames');
16
16
  var iconsReact = require('@carbon/icons-react');
17
17
  var index = require('../../IconButton/index.js');
18
18
  var Menu = require('../../Menu/Menu.js');
19
+ require('../../Menu/MenuItem.js');
19
20
  var useId = require('../../../internal/useId.js');
20
21
  var usePrefix = require('../../../internal/usePrefix.js');
21
22
  var useAttachedMenu = require('../../../internal/useAttachedMenu.js');
@@ -32,14 +32,17 @@ const SlugContent = /*#__PURE__*/React__default["default"].forwardRef(function S
32
32
  className
33
33
  } = _ref;
34
34
  const prefix = usePrefix.usePrefix();
35
+ const hasSlugActions = React__default["default"].Children.toArray(children).some(child => child.type?.displayName === 'SlugActions');
35
36
  const slugContentClasses = cx__default["default"](className, {
36
- [`${prefix}--slug-content`]: true
37
+ [`${prefix}--slug-content`]: true,
38
+ [`${prefix}--slug-content--with-actions`]: hasSlugActions
37
39
  });
38
40
  return /*#__PURE__*/React__default["default"].createElement(index.ToggletipContent, {
39
41
  className: slugContentClasses,
40
42
  ref: ref
41
43
  }, children);
42
44
  });
45
+ SlugContent.displayName = 'SlugContent';
43
46
  SlugContent.propTypes = {
44
47
  /**
45
48
  * Specify the content you want rendered inside the slug ToggleTip
@@ -64,6 +67,7 @@ const SlugActions = /*#__PURE__*/React__default["default"].forwardRef(function S
64
67
  ref: ref
65
68
  }, children);
66
69
  });
70
+ SlugActions.displayName = 'SlugActions';
67
71
  SlugActions.propTypes = {
68
72
  /**
69
73
  * Specify the content you want rendered inside the slug callout toolbar
@@ -120,14 +120,6 @@ function Tooltip(_ref) {
120
120
  }
121
121
  }, [isPointerIntersecting, leaveDelayMs, setOpen]);
122
122
  useNoInteractiveChildren.useNoInteractiveChildren(tooltipRef, 'The Tooltip component must have no interactive content rendered by the' + '`label` or `description` prop');
123
- React.useEffect(() => {
124
- if (containerRef !== null && containerRef.current) {
125
- const interactiveContent = useNoInteractiveChildren.getInteractiveContent(containerRef.current);
126
- if (!interactiveContent) {
127
- setOpen(false);
128
- }
129
- }
130
- });
131
123
  React.useEffect(() => {
132
124
  if (isDragging) {
133
125
  // Register drag stop handlers.
@@ -32,6 +32,7 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
32
32
  className,
33
33
  depth,
34
34
  disabled,
35
+ id: nodeId,
35
36
  isExpanded,
36
37
  label,
37
38
  onNodeFocusEvent,
@@ -45,7 +46,7 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
45
46
  } = _ref;
46
47
  const {
47
48
  current: id
48
- } = React.useRef(rest.id || uniqueId["default"]());
49
+ } = React.useRef(nodeId || uniqueId["default"]());
49
50
  const [expanded, setExpanded] = React.useState(isExpanded);
50
51
  const currentNode = React.useRef(null);
51
52
  const currentNodeLabel = React.useRef(null);
@@ -256,7 +257,8 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
256
257
  });
257
258
  TreeNode.propTypes = {
258
259
  /**
259
- * The value of the active node in the tree
260
+ * **Note:** this is controlled by the parent TreeView component, do not set manually.
261
+ * The ID of the active node in the tree
260
262
  */
261
263
  active: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]),
262
264
  /**
@@ -268,13 +270,18 @@ TreeNode.propTypes = {
268
270
  */
269
271
  className: PropTypes__default["default"].string,
270
272
  /**
271
- * TreeNode depth to determine spacing, automatically calculated by default
273
+ * * **Note:** this is controlled by the parent TreeView component, do not set manually.
274
+ * TreeNode depth to determine spacing
272
275
  */
273
276
  depth: PropTypes__default["default"].number,
274
277
  /**
275
278
  * Specify if the TreeNode is disabled
276
279
  */
277
280
  disabled: PropTypes__default["default"].bool,
281
+ /**
282
+ * Specify the TreeNode's ID. Must be unique in the DOM and is used for props.active and props.selected
283
+ */
284
+ id: PropTypes__default["default"].string,
278
285
  /**
279
286
  * Specify if the TreeNode is expanded (only applicable to parent nodes)
280
287
  */
@@ -305,6 +312,7 @@ TreeNode.propTypes = {
305
312
  */
306
313
  renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
307
314
  /**
315
+ * **Note:** this is controlled by the parent TreeView component, do not set manually.
308
316
  * Array containing all selected node IDs in the tree
309
317
  */
310
318
  selected: PropTypes__default["default"].arrayOf(PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number])),
@@ -202,7 +202,7 @@ function TreeView(_ref) {
202
202
  }
203
203
  TreeView.propTypes = {
204
204
  /**
205
- * Mark the active node in the tree, represented by its value
205
+ * Mark the active node in the tree, represented by its ID
206
206
  */
207
207
  active: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]),
208
208
  /**
@@ -158,7 +158,7 @@ class HeaderMenu extends React__default["default"].Component {
158
158
  onKeyDown,
159
159
  ...rest
160
160
  } = this.props;
161
- const hasActiveDescendant = childrenArg => React__default["default"].Children.toArray(childrenArg).some(child => child.props.isActive || child.props.isCurrentPage || child.props.children instanceof Array && hasActiveDescendant(child.props.children));
161
+ const hasActiveDescendant = childrenArg => React__default["default"].Children.toArray(childrenArg).some(child => child.props && (child.props.isActive || child.props.isCurrentPage || child.props.children instanceof Array && hasActiveDescendant(child.props.children)));
162
162
  const accessibilityLabel = {
163
163
  'aria-label': ariaLabel,
164
164
  'aria-labelledby': ariaLabelledBy
@@ -23,6 +23,10 @@ interface BaseSwitcherItemProps {
23
23
  * event handlers
24
24
  */
25
25
  onKeyDown?: (event: KeyboardEvent) => void;
26
+ /**
27
+ * event handlers
28
+ */
29
+ onClick?: (event: MouseEvent) => void;
26
30
  /**
27
31
  * Specify the tab index of the Link
28
32
  */
@@ -98,6 +98,10 @@ SwitcherItem.propTypes = {
98
98
  * Specify the index of the SwitcherItem
99
99
  */
100
100
  index: PropTypes__default["default"].number,
101
+ /**
102
+ * event handlers
103
+ */
104
+ onClick: PropTypes__default["default"].func,
101
105
  /**
102
106
  * event handlers
103
107
  */
package/lib/index.js CHANGED
@@ -64,6 +64,8 @@ var InlineLoading = require('./components/InlineLoading/InlineLoading.js');
64
64
  var Link = require('./components/Link/Link.js');
65
65
  var ListItem = require('./components/ListItem/ListItem.js');
66
66
  var Loading = require('./components/Loading/Loading.js');
67
+ var Menu = require('./components/Menu/Menu.js');
68
+ var MenuItem = require('./components/Menu/MenuItem.js');
67
69
  var index$8 = require('./components/MenuButton/index.js');
68
70
  var Modal = require('./components/Modal/Modal.js');
69
71
  var ModalWrapper = require('./components/ModalWrapper/ModalWrapper.js');
@@ -216,8 +218,6 @@ var TableToolbarContent = require('./components/DataTable/TableToolbarContent.js
216
218
  var TableToolbarSearch = require('./components/DataTable/TableToolbarSearch.js');
217
219
  var TableToolbarMenu = require('./components/DataTable/TableToolbarMenu.js');
218
220
  var FilterableMultiSelect = require('./components/MultiSelect/FilterableMultiSelect.js');
219
- var Menu = require('./components/Menu/Menu.js');
220
- var MenuItem = require('./components/Menu/MenuItem.js');
221
221
  var MultiSelect = require('./components/MultiSelect/MultiSelect.js');
222
222
  var Pagination$1 = require('./components/Pagination/Pagination.js');
223
223
  var PaginationNav = require('./components/PaginationNav/PaginationNav.js');
@@ -287,6 +287,12 @@ exports.InlineLoading = InlineLoading["default"];
287
287
  exports.Link = Link["default"];
288
288
  exports.ListItem = ListItem["default"];
289
289
  exports.Loading = Loading["default"];
290
+ exports.Menu = Menu.Menu;
291
+ exports.MenuItem = MenuItem.MenuItem;
292
+ exports.MenuItemDivider = MenuItem.MenuItemDivider;
293
+ exports.MenuItemGroup = MenuItem.MenuItemGroup;
294
+ exports.MenuItemRadioGroup = MenuItem.MenuItemRadioGroup;
295
+ exports.MenuItemSelectable = MenuItem.MenuItemSelectable;
290
296
  exports.MenuButton = index$8.MenuButton;
291
297
  exports.Modal = Modal["default"];
292
298
  exports.ModalWrapper = ModalWrapper["default"];
@@ -394,6 +400,7 @@ exports.unstable_useFeatureFlags = index.useFeatureFlags;
394
400
  exports.Heading = index$d.Heading;
395
401
  exports.Section = index$d.Section;
396
402
  exports.IconButton = index$e.IconButton;
403
+ exports.IconButtonKinds = index$e.IconButtonKinds;
397
404
  exports.Layer = index$f.Layer;
398
405
  exports.useLayer = index$f.useLayer;
399
406
  exports.unstable_Layout = index$1.Layout;
@@ -474,12 +481,6 @@ exports.TableToolbarContent = TableToolbarContent["default"];
474
481
  exports.TableToolbarSearch = TableToolbarSearch["default"];
475
482
  exports.TableToolbarMenu = TableToolbarMenu["default"];
476
483
  exports.FilterableMultiSelect = FilterableMultiSelect["default"];
477
- exports.Menu = Menu.Menu;
478
- exports.MenuItem = MenuItem.MenuItem;
479
- exports.MenuItemDivider = MenuItem.MenuItemDivider;
480
- exports.MenuItemGroup = MenuItem.MenuItemGroup;
481
- exports.MenuItemRadioGroup = MenuItem.MenuItemRadioGroup;
482
- exports.MenuItemSelectable = MenuItem.MenuItemSelectable;
483
484
  exports.MultiSelect = MultiSelect["default"];
484
485
  exports.Pagination = Pagination$1["default"];
485
486
  exports.PaginationNav = PaginationNav["default"];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/react",
3
3
  "description": "React components for the Carbon Design System",
4
- "version": "1.47.0",
4
+ "version": "1.48.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -49,13 +49,13 @@
49
49
  "dependencies": {
50
50
  "@babel/runtime": "^7.18.3",
51
51
  "@carbon/feature-flags": "^0.16.0",
52
- "@carbon/icons-react": "^11.33.0",
52
+ "@carbon/icons-react": "^11.34.0",
53
53
  "@carbon/layout": "^11.20.0",
54
- "@carbon/styles": "^1.47.0",
54
+ "@carbon/styles": "^1.48.0",
55
55
  "@ibm/telemetry-js": "^1.1.0",
56
- "classnames": "2.5.0",
56
+ "classnames": "2.5.1",
57
57
  "copy-to-clipboard": "^3.3.1",
58
- "downshift": "8.2.4",
58
+ "downshift": "8.3.1",
59
59
  "flatpickr": "4.6.9",
60
60
  "invariant": "^2.2.3",
61
61
  "lodash.debounce": "^4.0.8",
@@ -79,7 +79,7 @@
79
79
  "@babel/preset-react": "^7.22.3",
80
80
  "@babel/preset-typescript": "^7.21.5",
81
81
  "@carbon/test-utils": "^10.30.0",
82
- "@carbon/themes": "^11.28.0",
82
+ "@carbon/themes": "^11.29.0",
83
83
  "@rollup/plugin-babel": "^6.0.0",
84
84
  "@rollup/plugin-commonjs": "^25.0.0",
85
85
  "@rollup/plugin-node-resolve": "^15.0.0",
@@ -139,5 +139,5 @@
139
139
  "**/*.scss",
140
140
  "**/*.css"
141
141
  ],
142
- "gitHead": "978a93a33268170634ff6e4c20565a62cc220774"
142
+ "gitHead": "6d133d4f920b7c01f6ea2221938a339c14a85b42"
143
143
  }