@carbon/react 1.51.1 → 1.52.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 (72) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +832 -785
  2. package/es/components/ComposedModal/ComposedModal.js +3 -1
  3. package/es/components/DataTable/TableActionList.d.ts +8 -0
  4. package/es/components/DataTable/TableActionList.js +1 -2
  5. package/es/components/DataTable/TableHead.d.ts +2 -2
  6. package/es/components/DataTable/TableToolbarContent.d.ts +1 -12
  7. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  8. package/es/components/Link/Link.d.ts +5 -10
  9. package/es/components/Link/Link.js +1 -2
  10. package/es/components/Menu/Menu.d.ts +6 -6
  11. package/es/components/Menu/Menu.js +7 -3
  12. package/es/components/Menu/MenuContext.d.ts +14 -6
  13. package/es/components/Menu/MenuContext.js +3 -3
  14. package/es/components/Menu/MenuItem.d.ts +22 -31
  15. package/es/components/Menu/MenuItem.js +25 -13
  16. package/es/components/MenuButton/index.d.ts +43 -0
  17. package/es/components/MenuButton/index.js +15 -10
  18. package/es/components/Modal/Modal.js +2 -1
  19. package/es/components/Notification/Notification.d.ts +17 -1
  20. package/es/components/Notification/Notification.js +24 -9
  21. package/es/components/Toggletip/index.d.ts +1 -1
  22. package/es/components/Toggletip/index.js +4 -3
  23. package/es/components/TreeView/TreeNode.js +46 -24
  24. package/es/components/TreeView/TreeView.js +40 -13
  25. package/es/components/UIShell/Header.d.ts +24 -0
  26. package/es/components/UIShell/Header.js +1 -2
  27. package/es/components/UIShell/HeaderGlobalAction.d.ts +50 -0
  28. package/es/components/UIShell/HeaderGlobalAction.js +1 -2
  29. package/es/components/UIShell/HeaderGlobalBar.d.ts +11 -0
  30. package/es/components/UIShell/HeaderGlobalBar.js +2 -1
  31. package/es/components/UIShell/SideNavLink.d.ts +57 -0
  32. package/es/components/UIShell/SideNavLink.js +4 -4
  33. package/es/internal/useAttachedMenu.d.ts +45 -0
  34. package/es/internal/useAttachedMenu.js +1 -7
  35. package/es/tools/wrapComponent.d.ts +20 -0
  36. package/es/tools/wrapComponent.js +3 -4
  37. package/lib/components/ComposedModal/ComposedModal.js +3 -1
  38. package/lib/components/DataTable/TableActionList.d.ts +8 -0
  39. package/lib/components/DataTable/TableActionList.js +1 -2
  40. package/lib/components/DataTable/TableHead.d.ts +2 -2
  41. package/lib/components/DataTable/TableToolbarContent.d.ts +1 -12
  42. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  43. package/lib/components/Link/Link.d.ts +5 -10
  44. package/lib/components/Link/Link.js +1 -2
  45. package/lib/components/Menu/Menu.d.ts +6 -6
  46. package/lib/components/Menu/Menu.js +6 -2
  47. package/lib/components/Menu/MenuContext.d.ts +14 -6
  48. package/lib/components/Menu/MenuContext.js +2 -6
  49. package/lib/components/Menu/MenuItem.d.ts +22 -31
  50. package/lib/components/Menu/MenuItem.js +24 -12
  51. package/lib/components/MenuButton/index.d.ts +43 -0
  52. package/lib/components/MenuButton/index.js +14 -9
  53. package/lib/components/Modal/Modal.js +2 -1
  54. package/lib/components/Notification/Notification.d.ts +17 -1
  55. package/lib/components/Notification/Notification.js +24 -9
  56. package/lib/components/Toggletip/index.d.ts +1 -1
  57. package/lib/components/Toggletip/index.js +4 -3
  58. package/lib/components/TreeView/TreeNode.js +46 -24
  59. package/lib/components/TreeView/TreeView.js +40 -13
  60. package/lib/components/UIShell/Header.d.ts +24 -0
  61. package/lib/components/UIShell/Header.js +1 -2
  62. package/lib/components/UIShell/HeaderGlobalAction.d.ts +50 -0
  63. package/lib/components/UIShell/HeaderGlobalAction.js +1 -2
  64. package/lib/components/UIShell/HeaderGlobalBar.d.ts +11 -0
  65. package/lib/components/UIShell/HeaderGlobalBar.js +2 -1
  66. package/lib/components/UIShell/SideNavLink.d.ts +57 -0
  67. package/lib/components/UIShell/SideNavLink.js +3 -3
  68. package/lib/internal/useAttachedMenu.d.ts +45 -0
  69. package/lib/internal/useAttachedMenu.js +1 -7
  70. package/lib/tools/wrapComponent.d.ts +20 -0
  71. package/lib/tools/wrapComponent.js +5 -6
  72. package/package.json +8 -8
@@ -35,7 +35,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
35
35
  var _CaretLeft, _CaretRight;
36
36
  const hoverIntentDelay = 150; // in ms
37
37
 
38
- const MenuItem = /*#__PURE__*/React__default["default"].forwardRef(function MenuItem(_ref, forwardRef) {
38
+ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(_ref, forwardRef) {
39
39
  let {
40
40
  children,
41
41
  className,
@@ -55,7 +55,7 @@ const MenuItem = /*#__PURE__*/React__default["default"].forwardRef(function Menu
55
55
  x: -1,
56
56
  y: -1
57
57
  });
58
- const [isRtl, setRtl] = React.useState(false);
58
+ const [rtl, setRtl] = React.useState(false);
59
59
  const hasChildren = Boolean(children);
60
60
  const [submenuOpen, setSubmenuOpen] = React.useState(false);
61
61
  const hoverIntentTimeout = React.useRef(null);
@@ -80,7 +80,7 @@ const MenuItem = /*#__PURE__*/React__default["default"].forwardRef(function Menu
80
80
  width,
81
81
  height
82
82
  } = menuItem.current.getBoundingClientRect();
83
- if (isRtl) {
83
+ if (rtl) {
84
84
  setBoundaries({
85
85
  x: [-x, x - width],
86
86
  y: [y, y + height]
@@ -148,7 +148,7 @@ const MenuItem = /*#__PURE__*/React__default["default"].forwardRef(function Menu
148
148
  // eslint-disable-next-line react-hooks/exhaustive-deps
149
149
  }, []);
150
150
 
151
- // Set RTL based on document direction or `LayoutDirection`
151
+ // Set RTL based on the document direction or `LayoutDirection`
152
152
  const {
153
153
  direction
154
154
  } = useLayoutDirection.useLayoutDirection();
@@ -162,6 +162,7 @@ const MenuItem = /*#__PURE__*/React__default["default"].forwardRef(function Menu
162
162
  const iconsAllowed = context.state.mode === 'basic' || rest.role === 'menuitemcheckbox' || rest.role === 'menuitemradio';
163
163
  React.useEffect(() => {
164
164
  if (iconsAllowed && IconElement && !context.state.hasIcons) {
165
+ // @ts-ignore - TODO: Should we be passing payload?
165
166
  context.dispatch({
166
167
  type: 'enableIcons'
167
168
  });
@@ -173,8 +174,8 @@ const MenuItem = /*#__PURE__*/React__default["default"].forwardRef(function Menu
173
174
  ref: ref,
174
175
  className: classNames,
175
176
  tabIndex: -1,
176
- "aria-disabled": isDisabled,
177
- "aria-haspopup": hasChildren || undefined,
177
+ "aria-disabled": isDisabled ?? undefined,
178
+ "aria-haspopup": hasChildren ?? undefined,
178
179
  "aria-expanded": hasChildren ? submenuOpen : undefined,
179
180
  onClick: handleClick,
180
181
  onMouseEnter: hasChildren ? handleMouseEnter : undefined,
@@ -190,7 +191,7 @@ const MenuItem = /*#__PURE__*/React__default["default"].forwardRef(function Menu
190
191
  className: `${prefix}--menu-item__shortcut`
191
192
  }, shortcut), hasChildren && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
192
193
  className: `${prefix}--menu-item__shortcut`
193
- }, isRtl ? _CaretLeft || (_CaretLeft = /*#__PURE__*/React__default["default"].createElement(iconsReact.CaretLeft, null)) : _CaretRight || (_CaretRight = /*#__PURE__*/React__default["default"].createElement(iconsReact.CaretRight, null))), /*#__PURE__*/React__default["default"].createElement(Menu.Menu, {
194
+ }, rtl ? _CaretLeft || (_CaretLeft = /*#__PURE__*/React__default["default"].createElement(iconsReact.CaretLeft, null)) : _CaretRight || (_CaretRight = /*#__PURE__*/React__default["default"].createElement(iconsReact.CaretRight, null))), /*#__PURE__*/React__default["default"].createElement(Menu.Menu, {
194
195
  label: label,
195
196
  open: submenuOpen,
196
197
  onClose: () => {
@@ -225,17 +226,20 @@ MenuItem.propTypes = {
225
226
  /**
226
227
  * Provide an optional function to be called when the MenuItem is clicked.
227
228
  */
229
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
228
230
  onClick: PropTypes__default["default"].func,
229
231
  /**
230
232
  * Only applicable if the parent menu is in `basic` mode. Sets the menu item's icon.
231
233
  */
234
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
232
235
  renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
233
236
  /**
234
237
  * Provide a shortcut for the action of this MenuItem. Note that the component will only render it as a hint but not actually register the shortcut.
235
238
  */
239
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
236
240
  shortcut: PropTypes__default["default"].string
237
241
  };
238
- const MenuItemSelectable = /*#__PURE__*/React__default["default"].forwardRef(function MenuItemSelectable(_ref2, forwardRef) {
242
+ const MenuItemSelectable = /*#__PURE__*/React.forwardRef(function MenuItemSelectable(_ref2, forwardRef) {
239
243
  let {
240
244
  className,
241
245
  defaultSelected,
@@ -262,6 +266,7 @@ const MenuItemSelectable = /*#__PURE__*/React__default["default"].forwardRef(fun
262
266
  }
263
267
  React.useEffect(() => {
264
268
  if (!context.state.hasIcons) {
269
+ // @ts-ignore - TODO: Should we be passing payload?
265
270
  context.dispatch({
266
271
  type: 'enableIcons'
267
272
  });
@@ -286,6 +291,7 @@ MenuItemSelectable.propTypes = {
286
291
  /**
287
292
  * Specify whether the option should be selected by default.
288
293
  */
294
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
289
295
  defaultSelected: PropTypes__default["default"].bool,
290
296
  /**
291
297
  * A required label titling this option.
@@ -294,13 +300,15 @@ MenuItemSelectable.propTypes = {
294
300
  /**
295
301
  * Provide an optional function to be called when the selection state changes.
296
302
  */
303
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
297
304
  onChange: PropTypes__default["default"].func,
298
305
  /**
299
306
  * Pass a bool to props.selected to control the state of this option.
300
307
  */
308
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
301
309
  selected: PropTypes__default["default"].bool
302
310
  };
303
- const MenuItemGroup = /*#__PURE__*/React__default["default"].forwardRef(function MenuItemGroup(_ref3, forwardRef) {
311
+ const MenuItemGroup = /*#__PURE__*/React.forwardRef(function MenuItemGroup(_ref3, forwardRef) {
304
312
  let {
305
313
  children,
306
314
  className,
@@ -333,7 +341,7 @@ MenuItemGroup.propTypes = {
333
341
  label: PropTypes__default["default"].string.isRequired
334
342
  };
335
343
  const defaultItemToString = item => item.toString();
336
- const MenuItemRadioGroup = /*#__PURE__*/React__default["default"].forwardRef(function MenuItemRadioGroup(_ref4, forwardRef) {
344
+ const MenuItemRadioGroup = /*#__PURE__*/React.forwardRef(function MenuItemRadioGroup(_ref4, forwardRef) {
337
345
  let {
338
346
  className,
339
347
  defaultSelectedItem,
@@ -362,6 +370,7 @@ const MenuItemRadioGroup = /*#__PURE__*/React__default["default"].forwardRef(fun
362
370
  }
363
371
  React.useEffect(() => {
364
372
  if (!context.state.hasIcons) {
373
+ // @ts-ignore - TODO: Should we be passing payload?
365
374
  context.dispatch({
366
375
  type: 'enableIcons'
367
376
  });
@@ -375,7 +384,7 @@ const MenuItemRadioGroup = /*#__PURE__*/React__default["default"].forwardRef(fun
375
384
  }, /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({}, rest, {
376
385
  role: "group",
377
386
  "aria-label": label
378
- }), items?.map((item, i) => /*#__PURE__*/React__default["default"].createElement(MenuItem, {
387
+ }), items.map((item, i) => /*#__PURE__*/React__default["default"].createElement(MenuItem, {
379
388
  key: i,
380
389
  label: itemToString(item),
381
390
  role: "menuitemradio",
@@ -398,10 +407,12 @@ MenuItemRadioGroup.propTypes = {
398
407
  /**
399
408
  * Provide a function to convert an item to the string that will be rendered. Defaults to item.toString().
400
409
  */
410
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
401
411
  itemToString: PropTypes__default["default"].func,
402
412
  /**
403
413
  * Provide the options for this radio group. Can be of any type, as long as you provide an appropriate props.itemToString function.
404
414
  */
415
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
405
416
  items: PropTypes__default["default"].array,
406
417
  /**
407
418
  * A required label titling this radio group.
@@ -410,13 +421,14 @@ MenuItemRadioGroup.propTypes = {
410
421
  /**
411
422
  * Provide an optional function to be called when the selection changes.
412
423
  */
424
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
413
425
  onChange: PropTypes__default["default"].func,
414
426
  /**
415
427
  * Provide props.selectedItem to control the state of this radio group. Must match the type of props.items.
416
428
  */
417
429
  selectedItem: PropTypes__default["default"].any
418
430
  };
419
- const MenuItemDivider = /*#__PURE__*/React__default["default"].forwardRef(function MenuItemDivider(_ref5, forwardRef) {
431
+ const MenuItemDivider = /*#__PURE__*/React.forwardRef(function MenuItemDivider(_ref5, forwardRef) {
420
432
  let {
421
433
  className,
422
434
  ...rest
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright IBM Corp. 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, { ComponentProps, ReactNode } from 'react';
8
+ export interface MenuButtonProps extends ComponentProps<'div'> {
9
+ /**
10
+ * A collection of MenuItems to be rendered as actions for this MenuButton.
11
+ */
12
+ children?: ReactNode;
13
+ /**
14
+ * Additional CSS class names.
15
+ */
16
+ className?: string;
17
+ /**
18
+ * Specify whether the MenuButton should be disabled, or not.
19
+ */
20
+ disabled?: boolean;
21
+ /**
22
+ * Specify the type of button to be used as the base for the trigger button.
23
+ */
24
+ kind?: 'primary' | 'tertiary' | 'ghost';
25
+ /**
26
+ * Provide the label to be rendered on the trigger button.
27
+ */
28
+ label: string;
29
+ /**
30
+ * Experimental property. Specify how the menu should align with the button element
31
+ */
32
+ menuAlignment: 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end';
33
+ /**
34
+ * Specify the size of the button and menu.
35
+ */
36
+ size?: 'sm' | 'md' | 'lg';
37
+ /**
38
+ * Specify the tabIndex of the button.
39
+ */
40
+ tabIndex?: number;
41
+ }
42
+ declare const MenuButton: React.ForwardRefExoticComponent<Omit<MenuButtonProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
43
+ export { MenuButton };
@@ -32,7 +32,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
32
32
  const spacing = 0; // top and bottom spacing between the button and the menu. in px
33
33
  const validButtonKinds = ['primary', 'tertiary', 'ghost'];
34
34
  const defaultButtonKind = 'primary';
35
- const MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function MenuButton(_ref, forwardRef) {
35
+ const MenuButton = /*#__PURE__*/React.forwardRef(function MenuButton(_ref, forwardRef) {
36
36
  let {
37
37
  children,
38
38
  className,
@@ -68,10 +68,12 @@ const MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function Me
68
68
  }
69
69
  }
70
70
  function handleOpen() {
71
- menuRef.current.style.inlineSize = `${width}px`;
72
- menuRef.current.style.minInlineSize = `${width}px`;
73
- if (menuAlignment !== 'bottom' && menuAlignment !== 'top') {
74
- menuRef.current.style.inlineSize = `fit-content`;
71
+ if (menuRef.current) {
72
+ menuRef.current.style.inlineSize = `${width}px`;
73
+ menuRef.current.style.minInlineSize = `${width}px`;
74
+ if (menuAlignment !== 'bottom' && menuAlignment !== 'top') {
75
+ menuRef.current.style.inlineSize = `fit-content`;
76
+ }
75
77
  }
76
78
  }
77
79
  const containerClasses = cx__default["default"](`${prefix}--menu-button__container`, className);
@@ -79,23 +81,22 @@ const MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function Me
79
81
  [`${prefix}--menu-button__trigger--open`]: open
80
82
  });
81
83
  const menuClasses = cx__default["default"](`${prefix}--menu-button__${menuAlignment}`);
82
- const buttonKind = validButtonKinds.includes(kind) ? kind : defaultButtonKind;
83
84
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
84
85
  ref: ref,
85
- "aria-owns": open ? id : null,
86
+ "aria-owns": open ? id : undefined,
86
87
  className: containerClasses
87
88
  }), /*#__PURE__*/React__default["default"].createElement(Button["default"], {
88
89
  className: triggerClasses,
89
90
  size: size,
90
91
  tabIndex: tabIndex,
91
- kind: buttonKind,
92
+ kind: kind,
92
93
  renderIcon: iconsReact.ChevronDown,
93
94
  disabled: disabled,
94
95
  "aria-haspopup": true,
95
96
  "aria-expanded": open,
96
97
  onClick: handleClick,
97
98
  onMouseDown: handleMousedown,
98
- "aria-controls": open ? id : null
99
+ "aria-controls": open ? id : undefined
99
100
  }, label), /*#__PURE__*/React__default["default"].createElement(Menu.Menu, {
100
101
  containerRef: triggerRef,
101
102
  menuAlignment: menuAlignment,
@@ -128,6 +129,7 @@ MenuButton.propTypes = {
128
129
  /**
129
130
  * Specify the type of button to be used as the base for the trigger button.
130
131
  */
132
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
131
133
  kind: PropTypes__default["default"].oneOf(validButtonKinds),
132
134
  /**
133
135
  * Provide the label to be renderd on the trigger button.
@@ -136,14 +138,17 @@ MenuButton.propTypes = {
136
138
  /**
137
139
  * Experimental property. Specify how the menu should align with the button element
138
140
  */
141
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
139
142
  menuAlignment: PropTypes__default["default"].oneOf(['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end']),
140
143
  /**
141
144
  * Specify the size of the button and menu.
142
145
  */
146
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
143
147
  size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
144
148
  /**
145
149
  * Specify the tabIndex of the button.
146
150
  */
151
+ // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
147
152
  tabIndex: PropTypes__default["default"].number
148
153
  };
149
154
 
@@ -97,6 +97,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
97
97
  return !onSecondarySubmit && element === secondaryButton.current || element.classList.contains(modalCloseButtonClass);
98
98
  }
99
99
  function handleKeyDown(evt) {
100
+ evt.stopPropagation();
100
101
  if (open) {
101
102
  if (match.match(evt, keys.Escape)) {
102
103
  onRequestClose(evt);
@@ -108,6 +109,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
108
109
  }
109
110
  function handleMousedown(evt) {
110
111
  const target = evt.target;
112
+ evt.stopPropagation();
111
113
  if (innerModal.current && !innerModal.current.contains(target) && !wrapFocus.elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && !preventCloseOnClickOutside) {
112
114
  onRequestClose(evt);
113
115
  }
@@ -239,7 +241,6 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
239
241
  className: modalCloseButtonClass,
240
242
  label: closeButtonLabel,
241
243
  onClick: onRequestClose,
242
- title: closeButtonLabel,
243
244
  "aria-label": closeButtonLabel,
244
245
  align: "left",
245
246
  ref: button
@@ -518,6 +518,10 @@ export declare namespace ActionableNotification {
518
518
  * ==================
519
519
  */
520
520
  export interface StaticNotificationProps extends HTMLAttributes<HTMLDivElement> {
521
+ /**
522
+ * Pass in the action button label that will be rendered within the ActionableNotification.
523
+ */
524
+ actionButtonLabel?: string;
521
525
  /**
522
526
  * Specify the content
523
527
  */
@@ -534,6 +538,10 @@ export interface StaticNotificationProps extends HTMLAttributes<HTMLDivElement>
534
538
  * Specify whether you are using the low contrast variant of the StaticNotification.
535
539
  */
536
540
  lowContrast?: boolean;
541
+ /**
542
+ * Provide a function that is called when the action is clicked
543
+ */
544
+ onActionButtonClick?(): void;
537
545
  /**
538
546
  * Provide a description for "status" icon that can be read by screen readers
539
547
  */
@@ -551,9 +559,13 @@ export interface StaticNotificationProps extends HTMLAttributes<HTMLDivElement>
551
559
  */
552
560
  titleId?: string;
553
561
  }
554
- export declare function StaticNotification({ children, title, titleId, subtitle, statusIconDescription, className, kind, lowContrast, ...rest }: StaticNotificationProps): import("react/jsx-runtime").JSX.Element;
562
+ export declare function StaticNotification({ actionButtonLabel, children, onActionButtonClick, title, titleId, subtitle, statusIconDescription, className, kind, lowContrast, ...rest }: StaticNotificationProps): import("react/jsx-runtime").JSX.Element;
555
563
  export declare namespace StaticNotification {
556
564
  var propTypes: {
565
+ /**
566
+ * Pass in the action button label that will be rendered within the ActionableNotification.
567
+ */
568
+ actionButtonLabel: PropTypes.Requireable<string>;
557
569
  /**
558
570
  * Specify the content
559
571
  */
@@ -570,6 +582,10 @@ export declare namespace StaticNotification {
570
582
  * Specify whether you are using the low contrast variant of the StaticNotification.
571
583
  */
572
584
  lowContrast: PropTypes.Requireable<boolean>;
585
+ /**
586
+ * Provide a function that is called when the action is clicked
587
+ */
588
+ onActionButtonClick: PropTypes.Requireable<(...args: any[]) => any>;
573
589
  /**
574
590
  * Provide a description for "status" icon that can be read by screen readers
575
591
  */
@@ -695,7 +695,9 @@ ActionableNotification.propTypes = {
695
695
 
696
696
  function StaticNotification(_ref8) {
697
697
  let {
698
+ actionButtonLabel,
698
699
  children,
700
+ onActionButtonClick,
699
701
  title,
700
702
  titleId,
701
703
  subtitle,
@@ -707,10 +709,10 @@ function StaticNotification(_ref8) {
707
709
  } = _ref8;
708
710
  const prefix = usePrefix.usePrefix();
709
711
  const containerClassName = cx__default["default"](className, {
710
- [`${prefix}--inline-notification`]: true,
711
- [`${prefix}--inline-notification--low-contrast`]: lowContrast,
712
- [`${prefix}--inline-notification--${kind}`]: kind,
713
- [`${prefix}--inline-notification--hide-close-button`]: true
712
+ [`${prefix}--actionable-notification`]: true,
713
+ [`${prefix}--actionable-notification--low-contrast`]: lowContrast,
714
+ [`${prefix}--actionable-notification--${kind}`]: kind,
715
+ [`${prefix}--actionable-notification--hide-close-button`]: true
714
716
  });
715
717
  const ref = React.useRef(null);
716
718
  useNoInteractiveChildren.useInteractiveChildrenNeedDescription(ref, `interactive child node(s) should have an \`aria-describedby\` property with a value matching the value of \`titleId\``);
@@ -719,23 +721,32 @@ function StaticNotification(_ref8) {
719
721
  }, rest, {
720
722
  className: containerClassName
721
723
  }), /*#__PURE__*/React__default["default"].createElement("div", {
722
- className: `${prefix}--inline-notification__details`
724
+ className: `${prefix}--actionable-notification__details`
723
725
  }, /*#__PURE__*/React__default["default"].createElement(NotificationIcon, {
724
726
  notificationType: "inline",
725
727
  kind: kind,
726
728
  iconDescription: statusIconDescription || `${kind} icon`
727
729
  }), /*#__PURE__*/React__default["default"].createElement("div", {
728
- className: `${prefix}--inline-notification__text-wrapper`
730
+ className: `${prefix}--actionable-notification__text-wrapper`
729
731
  }, title && /*#__PURE__*/React__default["default"].createElement(Text.Text, {
730
732
  as: "div",
731
733
  id: titleId,
732
- className: `${prefix}--inline-notification__title`
734
+ className: `${prefix}--actionable-notification__title`
733
735
  }, title), subtitle && /*#__PURE__*/React__default["default"].createElement(Text.Text, {
734
736
  as: "div",
735
- className: `${prefix}--inline-notification__subtitle`
736
- }, subtitle), children)));
737
+ className: `${prefix}--actionable-notification__subtitle`
738
+ }, subtitle), children)), /*#__PURE__*/React__default["default"].createElement("div", {
739
+ className: `${prefix}--actionable-notification__button-wrapper`
740
+ }, actionButtonLabel && /*#__PURE__*/React__default["default"].createElement(NotificationActionButton, {
741
+ onClick: onActionButtonClick,
742
+ inline: true
743
+ }, actionButtonLabel)));
737
744
  }
738
745
  StaticNotification.propTypes = {
746
+ /**
747
+ * Pass in the action button label that will be rendered within the ActionableNotification.
748
+ */
749
+ actionButtonLabel: PropTypes__default["default"].string,
739
750
  /**
740
751
  * Specify the content
741
752
  */
@@ -752,6 +763,10 @@ StaticNotification.propTypes = {
752
763
  * Specify whether you are using the low contrast variant of the StaticNotification.
753
764
  */
754
765
  lowContrast: PropTypes__default["default"].bool,
766
+ /**
767
+ * Provide a function that is called when the action is clicked
768
+ */
769
+ onActionButtonClick: PropTypes__default["default"].func,
755
770
  /**
756
771
  * Provide a description for "status" icon that can be read by screen readers
757
772
  */
@@ -47,7 +47,7 @@ interface ToggletipProps<E extends ElementType> {
47
47
  * is responsible for coordinating between interactions with the button and the
48
48
  * visibility of the content
49
49
  */
50
- export declare function Toggletip<E extends ElementType = 'span'>({ align, as, autoAlign, className: customClassName, children, defaultOpen, }: ToggletipProps<E>): import("react/jsx-runtime").JSX.Element;
50
+ export declare function Toggletip<E extends ElementType = 'span'>({ align, as, autoAlign, className: customClassName, children, defaultOpen, ...rest }: ToggletipProps<E>): import("react/jsx-runtime").JSX.Element;
51
51
  export declare namespace Toggletip {
52
52
  var propTypes: {
53
53
  /**
@@ -76,7 +76,8 @@ function Toggletip(_ref2) {
76
76
  autoAlign,
77
77
  className: customClassName,
78
78
  children,
79
- defaultOpen = false
79
+ defaultOpen = false,
80
+ ...rest
80
81
  } = _ref2;
81
82
  const ref = React.useRef(null);
82
83
  const [open, setOpen] = React.useState(defaultOpen);
@@ -138,7 +139,7 @@ function Toggletip(_ref2) {
138
139
  });
139
140
  return /*#__PURE__*/React__default["default"].createElement(ToggletipContext.Provider, {
140
141
  value: value
141
- }, /*#__PURE__*/React__default["default"].createElement(index.Popover, {
142
+ }, /*#__PURE__*/React__default["default"].createElement(index.Popover, _rollupPluginBabelHelpers["extends"]({
142
143
  align: align,
143
144
  as: as,
144
145
  caret: true,
@@ -150,7 +151,7 @@ function Toggletip(_ref2) {
150
151
  onBlur: handleBlur,
151
152
  ref: ref,
152
153
  autoAlign: autoAlign
153
- }, children));
154
+ }, rest), children));
154
155
  }
155
156
  Toggletip.propTypes = {
156
157
  /**
@@ -16,6 +16,8 @@ var iconsReact = require('@carbon/icons-react');
16
16
  var cx = require('classnames');
17
17
  var uniqueId = require('../../tools/uniqueId.js');
18
18
  var usePrefix = require('../../internal/usePrefix.js');
19
+ var useControllableState = require('../../internal/useControllableState.js');
20
+ var index = require('../FeatureFlags/index.js');
19
21
  var match = require('../../internal/keyboard/match.js');
20
22
  var keys = require('../../internal/keyboard/keys.js');
21
23
 
@@ -34,6 +36,7 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
34
36
  disabled,
35
37
  id: nodeId,
36
38
  isExpanded,
39
+ defaultIsExpanded,
37
40
  label,
38
41
  onNodeFocusEvent,
39
42
  onSelect: onNodeSelect,
@@ -44,10 +47,17 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
44
47
  value,
45
48
  ...rest
46
49
  } = _ref;
50
+ const enableTreeviewControllable = index.useFeatureFlag('enable-treeview-controllable');
47
51
  const {
48
52
  current: id
49
53
  } = React.useRef(nodeId || uniqueId["default"]());
50
- const [expanded, setExpanded] = React.useState(isExpanded);
54
+ const controllableExpandedState = useControllableState.useControllableState({
55
+ value: isExpanded,
56
+ onChange: onToggle,
57
+ defaultValue: defaultIsExpanded
58
+ });
59
+ const uncontrollableExpandedState = React.useState(isExpanded);
60
+ const [expanded, setExpanded] = enableTreeviewControllable ? controllableExpandedState : uncontrollableExpandedState;
51
61
  const currentNode = React.useRef(null);
52
62
  const currentNodeLabel = React.useRef(null);
53
63
  const prefix = usePrefix.usePrefix();
@@ -83,12 +93,14 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
83
93
 
84
94
  // Prevent the node from being selected
85
95
  event.stopPropagation();
86
- onToggle?.(event, {
87
- id,
88
- isExpanded: !expanded,
89
- label,
90
- value
91
- });
96
+ if (!enableTreeviewControllable) {
97
+ onToggle?.(event, {
98
+ id,
99
+ isExpanded: !expanded,
100
+ label,
101
+ value
102
+ });
103
+ }
92
104
  setExpanded(!expanded);
93
105
  }
94
106
  function handleClick(event) {
@@ -125,12 +137,14 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
125
137
  return findParentTreeNode(node.parentNode);
126
138
  };
127
139
  if (children && expanded) {
128
- onToggle?.(event, {
129
- id,
130
- isExpanded: false,
131
- label,
132
- value
133
- });
140
+ if (!enableTreeviewControllable) {
141
+ onToggle?.(event, {
142
+ id,
143
+ isExpanded: false,
144
+ label,
145
+ value
146
+ });
147
+ }
134
148
  setExpanded(false);
135
149
  } else {
136
150
  /**
@@ -148,12 +162,14 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
148
162
  */
149
163
  currentNode.current.lastChild.firstChild.focus();
150
164
  } else {
151
- onToggle?.(event, {
152
- id,
153
- isExpanded: true,
154
- label,
155
- value
156
- });
165
+ if (!enableTreeviewControllable) {
166
+ onToggle?.(event, {
167
+ id,
168
+ isExpanded: true,
169
+ label,
170
+ value
171
+ });
172
+ }
157
173
  setExpanded(true);
158
174
  }
159
175
  }
@@ -204,10 +220,11 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
204
220
  currentNodeLabel.current.style.marginInlineStart = `-${calcOffset()}rem`;
205
221
  currentNodeLabel.current.style.paddingInlineStart = `${calcOffset()}rem`;
206
222
  }
207
-
208
- // sync props and state
209
- setExpanded(isExpanded);
210
- }, [children, depth, Icon, isExpanded]);
223
+ if (!enableTreeviewControllable) {
224
+ // sync props and state
225
+ setExpanded(isExpanded);
226
+ }
227
+ }, [children, depth, Icon, isExpanded, enableTreeviewControllable, setExpanded]);
211
228
  const treeNodeProps = {
212
229
  ...rest,
213
230
  ['aria-current']: isActive || null,
@@ -270,7 +287,12 @@ TreeNode.propTypes = {
270
287
  */
271
288
  className: PropTypes__default["default"].string,
272
289
  /**
273
- * * **Note:** this is controlled by the parent TreeView component, do not set manually.
290
+ * **[Experimental]** The default expansion state of the node.
291
+ * *This is only supported with the `enable-treeview-controllable` feature flag!*
292
+ */
293
+ defaultIsExpanded: PropTypes__default["default"].bool,
294
+ /**
295
+ * **Note:** this is controlled by the parent TreeView component, do not set manually.
274
296
  * TreeNode depth to determine spacing
275
297
  */
276
298
  depth: PropTypes__default["default"].number,