@carbon/react 1.41.2 → 1.42.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 (53) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +682 -614
  2. package/es/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +25 -0
  3. package/es/components/Breadcrumb/Breadcrumb.d.ts +24 -0
  4. package/es/components/Breadcrumb/Breadcrumb.js +1 -2
  5. package/es/components/Breadcrumb/BreadcrumbItem.d.ts +25 -0
  6. package/es/components/Breadcrumb/BreadcrumbItem.js +8 -7
  7. package/es/components/ComboBox/ComboBox.d.ts +7 -1
  8. package/es/components/ComboBox/ComboBox.js +30 -2
  9. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
  10. package/es/components/DataTable/TableBatchAction.d.ts +46 -0
  11. package/es/components/DataTable/TableBatchAction.js +1 -2
  12. package/es/components/DataTable/TableExpandRow.d.ts +2 -46
  13. package/es/components/DataTable/TableExpandRow.js +6 -2
  14. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  15. package/es/components/Tabs/Tabs.js +1 -2
  16. package/es/components/TreeView/TreeNode.js +7 -4
  17. package/es/components/UIShell/HeaderMenu.js +2 -2
  18. package/es/components/UIShell/SideNav.d.ts +1 -1
  19. package/es/components/UIShell/SideNavFooter.d.ts +52 -0
  20. package/es/components/UIShell/SideNavFooter.js +0 -1
  21. package/es/components/UIShell/SideNavItem.d.ts +24 -0
  22. package/es/components/UIShell/SideNavItem.js +2 -2
  23. package/es/components/UIShell/SideNavMenu.js +4 -5
  24. package/es/components/UIShell/SideNavMenuItem.d.ts +25 -0
  25. package/es/components/UIShell/SideNavMenuItem.js +1 -2
  26. package/es/index.js +1 -1
  27. package/icons/index.d.ts +7 -0
  28. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +25 -0
  29. package/lib/components/Breadcrumb/Breadcrumb.d.ts +24 -0
  30. package/lib/components/Breadcrumb/Breadcrumb.js +1 -2
  31. package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +25 -0
  32. package/lib/components/Breadcrumb/BreadcrumbItem.js +8 -7
  33. package/lib/components/ComboBox/ComboBox.d.ts +7 -1
  34. package/lib/components/ComboBox/ComboBox.js +30 -2
  35. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
  36. package/lib/components/DataTable/TableBatchAction.d.ts +46 -0
  37. package/lib/components/DataTable/TableBatchAction.js +1 -2
  38. package/lib/components/DataTable/TableExpandRow.d.ts +2 -46
  39. package/lib/components/DataTable/TableExpandRow.js +6 -2
  40. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  41. package/lib/components/Tabs/Tabs.js +1 -2
  42. package/lib/components/TreeView/TreeNode.js +7 -4
  43. package/lib/components/UIShell/HeaderMenu.js +2 -2
  44. package/lib/components/UIShell/SideNav.d.ts +1 -1
  45. package/lib/components/UIShell/SideNavFooter.d.ts +52 -0
  46. package/lib/components/UIShell/SideNavFooter.js +0 -1
  47. package/lib/components/UIShell/SideNavItem.d.ts +24 -0
  48. package/lib/components/UIShell/SideNavItem.js +2 -2
  49. package/lib/components/UIShell/SideNavMenu.js +4 -5
  50. package/lib/components/UIShell/SideNavMenuItem.d.ts +25 -0
  51. package/lib/components/UIShell/SideNavMenuItem.js +1 -2
  52. package/lib/index.js +2 -2
  53. package/package.json +8 -7
@@ -0,0 +1,25 @@
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, { HTMLAttributes } from 'react';
8
+ interface SideNavMenuItemProps extends HTMLAttributes<HTMLElement> {
9
+ /**
10
+ * Specify the children to be rendered inside of the `SideNavMenuItem`
11
+ */
12
+ children?: React.ReactNode;
13
+ /**
14
+ * Provide an optional class to be applied to the containing node
15
+ */
16
+ className?: string;
17
+ /**
18
+ * Optionally specify whether the link is "active". An active link is one that
19
+ * has an href that is the same as the current page. Can also pass in
20
+ * `aria-current="page"`, as well.
21
+ */
22
+ isActive?: boolean;
23
+ }
24
+ declare const SideNavMenuItem: React.ForwardRefExoticComponent<SideNavMenuItemProps & React.RefAttributes<HTMLElement>>;
25
+ export default SideNavMenuItem;
@@ -50,6 +50,5 @@ SideNavMenuItem.propTypes = {
50
50
  */
51
51
  isActive: PropTypes.bool
52
52
  };
53
- var SideNavMenuItem$1 = SideNavMenuItem;
54
53
 
55
- export { SideNavMenuItem$1 as default };
54
+ export { SideNavMenuItem as default };
package/es/index.js CHANGED
@@ -161,7 +161,6 @@ export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.
161
161
  export { default as ProgressIndicatorSkeleton } from './components/ProgressIndicator/ProgressIndicator.Skeleton.js';
162
162
  export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
163
163
  export { default as TextInput } from './components/TextInput/TextInput.js';
164
- export { default as TreeNode } from './components/TreeView/TreeNode.js';
165
164
  export { default as TreeView } from './components/TreeView/TreeView.js';
166
165
  export { default as ProgressBar } from './components/ProgressBar/ProgressBar.js';
167
166
  export { default as unstable__FluidComboBox } from './components/FluidComboBox/FluidComboBox.js';
@@ -219,4 +218,5 @@ export { default as SkeletonIcon } from './components/SkeletonIcon/SkeletonIcon.
219
218
  export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
220
219
  export { default as Switch } from './components/Switch/Switch.js';
221
220
  export { default as IconSwitch } from './components/Switch/IconSwitch.js';
221
+ export { default as TreeNode } from './components/TreeView/TreeNode.js';
222
222
  export { Stack } from './components/Stack/Stack.js';
@@ -0,0 +1,7 @@
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
+ export * from '@carbon/icons-react';
@@ -0,0 +1,25 @@
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 PropTypes from 'prop-types';
8
+ import React from 'react';
9
+ export interface BreadcrumbSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ /**
11
+ * Specify an optional className to add.
12
+ */
13
+ className?: string;
14
+ }
15
+ declare function BreadcrumbSkeleton({ className, ...rest }: BreadcrumbSkeletonProps): JSX.Element;
16
+ declare namespace BreadcrumbSkeleton {
17
+ var propTypes: {
18
+ /**
19
+ * Specify an optional className to add.
20
+ */
21
+ className: PropTypes.Requireable<string>;
22
+ };
23
+ }
24
+ export default BreadcrumbSkeleton;
25
+ export { BreadcrumbSkeleton };
@@ -0,0 +1,24 @@
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 from 'react';
8
+ import { ForwardRefReturn } from '../../types/common';
9
+ export interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
10
+ /**
11
+ * Specify the label for the breadcrumb container
12
+ */
13
+ 'aria-label'?: string;
14
+ /**
15
+ * Specify an optional className to be applied to the container node
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Optional prop to omit the trailing slash for the breadcrumbs
20
+ */
21
+ noTrailingSlash?: boolean;
22
+ }
23
+ declare const Breadcrumb: ForwardRefReturn<HTMLElement, BreadcrumbProps>;
24
+ export default Breadcrumb;
@@ -61,6 +61,5 @@ Breadcrumb.propTypes = {
61
61
  */
62
62
  noTrailingSlash: PropTypes__default["default"].bool
63
63
  };
64
- var Breadcrumb$1 = Breadcrumb;
65
64
 
66
- exports["default"] = Breadcrumb$1;
65
+ exports["default"] = Breadcrumb;
@@ -0,0 +1,25 @@
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, { AriaAttributes } from 'react';
8
+ import { ForwardRefReturn } from '../../types/common';
9
+ export interface BreadcrumbItemProps extends React.HTMLAttributes<HTMLLIElement> {
10
+ 'aria-current'?: AriaAttributes['aria-current'];
11
+ /**
12
+ * Specify an optional className to be applied to the container node
13
+ */
14
+ className?: string;
15
+ /**
16
+ * Optional string representing the link location for the BreadcrumbItem
17
+ */
18
+ href?: string;
19
+ /**
20
+ * Provide if this breadcrumb item represents the current page
21
+ */
22
+ isCurrentPage?: boolean;
23
+ }
24
+ declare const BreadcrumbItem: ForwardRefReturn<HTMLLIElement, BreadcrumbItemProps>;
25
+ export default BreadcrumbItem;
@@ -29,7 +29,7 @@ const BreadcrumbItem = /*#__PURE__*/React__default["default"].forwardRef(functio
29
29
  let {
30
30
  'aria-current': ariaCurrent,
31
31
  children,
32
- className: customClassName,
32
+ className: customClassName = '',
33
33
  href,
34
34
  isCurrentPage,
35
35
  ...rest
@@ -42,13 +42,14 @@ const BreadcrumbItem = /*#__PURE__*/React__default["default"].forwardRef(functio
42
42
  [`${prefix}--breadcrumb-item--current`]: isCurrentPage && ariaCurrent !== 'page',
43
43
  [customClassName]: !!customClassName
44
44
  });
45
- if (children.type && children.type.displayName !== undefined && children.type.displayName.includes('OverflowMenu')) {
45
+ const child = children;
46
+ if (child.type && child.type.displayName !== undefined && child.type.displayName.includes('OverflowMenu')) {
46
47
  const horizontalOverflowIcon = /*#__PURE__*/React__default["default"].createElement(iconsReact.OverflowMenuHorizontal, {
47
48
  className: `${prefix}--overflow-menu__icon`
48
49
  });
49
50
  return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({
50
51
  className: className
51
- }, rest), /*#__PURE__*/React__default["default"].cloneElement(children, {
52
+ }, rest), /*#__PURE__*/React__default["default"].cloneElement(child, {
52
53
  menuOptionsClass: `${prefix}--breadcrumb-menu-options`,
53
54
  menuOffset: {
54
55
  top: 10,
@@ -71,13 +72,14 @@ const BreadcrumbItem = /*#__PURE__*/React__default["default"].forwardRef(functio
71
72
  return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({
72
73
  className: className,
73
74
  ref: ref
74
- }, rest), /*#__PURE__*/React__default["default"].cloneElement(children, {
75
+ }, rest), /*#__PURE__*/React__default["default"].cloneElement(child, {
75
76
  'aria-current': ariaCurrent,
76
- className: cx__default["default"](`${prefix}--link`, children.props.className)
77
+ className: cx__default["default"](`${prefix}--link`, child.props.className)
77
78
  }));
78
79
  });
79
80
  BreadcrumbItem.displayName = 'BreadcrumbItem';
80
81
  BreadcrumbItem.propTypes = {
82
+ // @ts-expect-error - v12 TODO: BREAKING: This should match AriaAttributes['aria-current']
81
83
  'aria-current': PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].bool]),
82
84
  /**
83
85
  * Pass in content that will be inside of the BreadcrumbItem
@@ -96,6 +98,5 @@ BreadcrumbItem.propTypes = {
96
98
  */
97
99
  isCurrentPage: PropTypes__default["default"].bool
98
100
  };
99
- var BreadcrumbItem$1 = BreadcrumbItem;
100
101
 
101
- exports["default"] = BreadcrumbItem$1;
102
+ exports["default"] = BreadcrumbItem;
@@ -9,10 +9,16 @@ import { type ComponentProps, type ReactNode, type ComponentType, type ReactElem
9
9
  import { ListBoxSize } from '../ListBox';
10
10
  type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
11
11
  interface OnChangeData<ItemType> {
12
- selectedItem: ItemType | null;
12
+ selectedItem: ItemType | null | undefined;
13
+ inputValue?: string | null;
13
14
  }
14
15
  type ItemToStringHandler<ItemType> = (item: ItemType | null) => string;
15
16
  export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
17
+ /**
18
+ * Specify whether or not the ComboBox should allow a value that is
19
+ * not in the list to be entered in the input
20
+ */
21
+ allowCustomValue?: boolean;
16
22
  /**
17
23
  * Specify a label to be read by screen readers on the container node
18
24
  * 'aria-label' of the ListBox component.
@@ -43,7 +43,8 @@ const {
43
43
  keyDownEscape,
44
44
  clickButton,
45
45
  blurButton,
46
- changeInput
46
+ changeInput,
47
+ blurInput
47
48
  } = Downshift__default["default"].stateChangeTypes;
48
49
  const defaultItemToString = item => {
49
50
  if (typeof item === 'string') {
@@ -121,6 +122,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
121
122
  translateWithId,
122
123
  warn,
123
124
  warnText,
125
+ allowCustomValue = false,
124
126
  ...rest
125
127
  } = props;
126
128
  const prefix = usePrefix.usePrefix();
@@ -215,6 +217,17 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
215
217
  case changeInput:
216
218
  updateHighlightedIndex(getHighlightedIndex(changes));
217
219
  break;
220
+ case blurInput:
221
+ if (allowCustomValue) {
222
+ setInputValue(inputValue);
223
+ if (onChange) {
224
+ onChange({
225
+ selectedItem,
226
+ inputValue
227
+ });
228
+ }
229
+ }
230
+ break;
218
231
  }
219
232
  };
220
233
  const handleToggleClick = isOpen => event => {
@@ -313,8 +326,18 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
313
326
  if (match.match(event, keys.Space)) {
314
327
  event.stopPropagation();
315
328
  }
316
- if (match.match(event, keys.Enter) && !inputValue) {
329
+ if (match.match(event, keys.Enter) && (!inputValue || allowCustomValue)) {
317
330
  toggleMenu();
331
+
332
+ // Since `onChange` does not normally fire when the menu is closed, we should
333
+ // manually fire it when `allowCustomValue` is provided, the menu is closing,
334
+ // and there is a value.
335
+ if (allowCustomValue && isOpen && inputValue) {
336
+ onChange({
337
+ selectedItem,
338
+ inputValue
339
+ });
340
+ }
318
341
  }
319
342
  if (match.match(event, keys.Escape) && inputValue) {
320
343
  if (event.target === textInput.current && isOpen) {
@@ -422,6 +445,11 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
422
445
  });
423
446
  ComboBox.displayName = 'ComboBox';
424
447
  ComboBox.propTypes = {
448
+ /**
449
+ * Specify whether or not the ComboBox should allow a value that is
450
+ * not in the list to be entered in the input
451
+ */
452
+ allowCustomValue: PropTypes__default["default"].bool,
425
453
  /**
426
454
  * 'aria-label' of the ListBox component.
427
455
  * Specify a label to be read by screen readers on the container node
@@ -40,7 +40,7 @@ export interface ContentSwitcherProps extends Omit<HTMLAttributes<HTMLElement>,
40
40
  /**
41
41
  * Choose whether or not to automatically change selection on focus
42
42
  */
43
- selectionMode: 'automatic' | 'manual';
43
+ selectionMode?: 'automatic' | 'manual';
44
44
  /**
45
45
  * Specify the size of the Content Switcher. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
46
46
  */
@@ -0,0 +1,46 @@
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 PropTypes from 'prop-types';
8
+ import React from 'react';
9
+ export interface TableBatchActionProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
10
+ /**
11
+ * Specify if the button is an icon-only button
12
+ */
13
+ hasIconOnly?: boolean;
14
+ /**
15
+ * If specifying the `renderIcon` prop, provide a description for that icon that can
16
+ * be read by screen readers
17
+ */
18
+ iconDescription?: string;
19
+ /**
20
+ * Optional function to render your own icon in the underlying button
21
+ */
22
+ renderIcon?: React.ElementType;
23
+ }
24
+ declare const TableBatchAction: {
25
+ ({ renderIcon, iconDescription, ...props }: {
26
+ [x: string]: any;
27
+ renderIcon?: import("@carbon/icons-react/lib/CarbonIcon").CarbonIconType | undefined;
28
+ iconDescription?: string | undefined;
29
+ }): JSX.Element;
30
+ propTypes: {
31
+ /**
32
+ * Specify if the button is an icon-only button
33
+ */
34
+ hasIconOnly: PropTypes.Requireable<boolean>;
35
+ /**
36
+ * If specifying the `renderIcon` prop, provide a description for that icon that can
37
+ * be read by screen readers
38
+ */
39
+ iconDescription: (props: any) => Error | undefined;
40
+ /**
41
+ * Optional function to render your own icon in the underlying button
42
+ */
43
+ renderIcon: PropTypes.Requireable<object>;
44
+ };
45
+ };
46
+ export default TableBatchAction;
@@ -52,6 +52,5 @@ TableBatchAction.propTypes = {
52
52
  */
53
53
  renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object])
54
54
  };
55
- var TableBatchAction$1 = TableBatchAction;
56
55
 
57
- exports["default"] = TableBatchAction$1;
56
+ exports["default"] = TableBatchAction;
@@ -4,8 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import PropTypes from 'prop-types';
8
- import { MouseEventHandler, PropsWithChildren } from 'react';
7
+ import React, { MouseEventHandler, PropsWithChildren } from 'react';
9
8
  import { TableRowProps } from './TableRow';
10
9
  interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
11
10
  /**
@@ -41,48 +40,5 @@ interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
41
40
  */
42
41
  onExpand: MouseEventHandler<HTMLButtonElement>;
43
42
  }
44
- declare const TableExpandRow: {
45
- ({ ["aria-controls"]: ariaControls, ["aria-label"]: ariaLabel, ariaLabel: deprecatedAriaLabel, className: rowClassName, children, isExpanded, onExpand, expandIconDescription, isSelected, expandHeader, ...rest }: TableExpandRowProps): JSX.Element;
46
- propTypes: {
47
- /**
48
- * Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandRow
49
- * TODO: make this required in v12
50
- */
51
- "aria-controls": PropTypes.Requireable<string>;
52
- /**
53
- * Specify the string read by a voice reader when the expand trigger is
54
- * focused
55
- */
56
- "aria-label": PropTypes.Requireable<string>;
57
- /**
58
- * Deprecated, please use `aria-label` instead.
59
- * Specify the string read by a voice reader when the expand trigger is
60
- * focused
61
- */
62
- ariaLabel: PropTypes.Requireable<string>;
63
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
64
- className: PropTypes.Requireable<string>;
65
- /**
66
- * The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43
67
- */
68
- expandHeader: PropTypes.Requireable<string>;
69
- /**
70
- * The description of the chevron right icon, to be put in its SVG `<title>` element.
71
- */
72
- expandIconDescription: PropTypes.Requireable<string>;
73
- /**
74
- * Specify whether this row is expanded or not. This helps coordinate data
75
- * attributes so that `TableExpandRow` and `TableExpandedRow` work together
76
- */
77
- isExpanded: PropTypes.Validator<boolean>;
78
- /**
79
- * Specify if the row is selected
80
- */
81
- isSelected: PropTypes.Requireable<boolean>;
82
- /**
83
- * Hook for when a listener initiates a request to expand the given row
84
- */
85
- onExpand: PropTypes.Validator<(...args: any[]) => any>;
86
- };
87
- };
43
+ declare const TableExpandRow: React.ForwardRefExoticComponent<TableExpandRowProps & React.RefAttributes<HTMLTableCellElement>>;
88
44
  export default TableExpandRow;
@@ -23,7 +23,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
23
23
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
24
24
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
25
25
 
26
- const TableExpandRow = _ref => {
26
+ const TableExpandRow = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
27
27
  let {
28
28
  ['aria-controls']: ariaControls,
29
29
  ['aria-label']: ariaLabel,
@@ -45,6 +45,7 @@ const TableExpandRow = _ref => {
45
45
  }, rowClassName);
46
46
  const previousValue = isExpanded ? 'collapsed' : undefined;
47
47
  return /*#__PURE__*/React__default["default"].createElement("tr", _rollupPluginBabelHelpers["extends"]({}, rest, {
48
+ ref: ref,
48
49
  className: className,
49
50
  "data-parent-row": true
50
51
  }), /*#__PURE__*/React__default["default"].createElement(TableCell["default"], {
@@ -63,17 +64,19 @@ const TableExpandRow = _ref => {
63
64
  className: `${prefix}--table-expand__svg`,
64
65
  "aria-label": expandIconDescription
65
66
  }))), children);
66
- };
67
+ });
67
68
  TableExpandRow.propTypes = {
68
69
  /**
69
70
  * Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandRow
70
71
  * TODO: make this required in v12
71
72
  */
73
+ /**@ts-ignore*/
72
74
  ['aria-controls']: PropTypes__default["default"].string,
73
75
  /**
74
76
  * Specify the string read by a voice reader when the expand trigger is
75
77
  * focused
76
78
  */
79
+ /**@ts-ignore*/
77
80
  ['aria-label']: PropTypes__default["default"].string,
78
81
  /**
79
82
  * Deprecated, please use `aria-label` instead.
@@ -105,5 +108,6 @@ TableExpandRow.propTypes = {
105
108
  */
106
109
  onExpand: PropTypes__default["default"].func.isRequired
107
110
  };
111
+ TableExpandRow.displayName = 'TableExpandRow';
108
112
 
109
113
  exports["default"] = TableExpandRow;
@@ -101,7 +101,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
101
101
  * An optional callback to render the currently selected item as a react element instead of only
102
102
  * as a string.
103
103
  */
104
- renderSelectedItem?(item: ItemType): string;
104
+ renderSelectedItem?(item: ItemType): React.JSXElementConstructor<ItemType> | null;
105
105
  /**
106
106
  * In the case you want to control the dropdown selection entirely.
107
107
  */
@@ -598,8 +598,7 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(_ref5, forwardRef) {
598
598
  }, /*#__PURE__*/React__default["default"].createElement(Icon, {
599
599
  size: 16
600
600
  })), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
601
- className: `${prefix}--tabs__nav-item-label`,
602
- title: children
601
+ className: `${prefix}--tabs__nav-item-label`
603
602
  }, children), /*#__PURE__*/React__default["default"].createElement("div", {
604
603
  className: cx__default["default"](`${prefix}--tabs__nav-item--icon`, {
605
604
  [`${prefix}--visually-hidden`]: !hasIcon
@@ -25,7 +25,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
25
25
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
26
26
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
27
27
 
28
- function TreeNode(_ref) {
28
+ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
29
29
  let {
30
30
  active,
31
31
  children,
@@ -230,7 +230,8 @@ function TreeNode(_ref) {
230
230
  /*#__PURE__*/
231
231
  // eslint-disable-next-line jsx-a11y/role-supports-aria-props
232
232
  React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({}, treeNodeProps, {
233
- "aria-expanded": !!expanded
233
+ "aria-expanded": !!expanded,
234
+ ref: ref
234
235
  }), /*#__PURE__*/React__default["default"].createElement("div", {
235
236
  className: `${prefix}--tree-node__label`,
236
237
  ref: currentNodeLabel
@@ -249,7 +250,7 @@ function TreeNode(_ref) {
249
250
  className: `${prefix}--tree-node__children`
250
251
  }, nodesWithProps))
251
252
  );
252
- }
253
+ });
253
254
  TreeNode.propTypes = {
254
255
  /**
255
256
  * The value of the active node in the tree
@@ -309,5 +310,7 @@ TreeNode.propTypes = {
309
310
  */
310
311
  value: PropTypes__default["default"].string
311
312
  };
313
+ TreeNode.displayName = 'TreeNode';
314
+ var TreeNode$1 = TreeNode;
312
315
 
313
- exports["default"] = TreeNode;
316
+ exports["default"] = TreeNode$1;
@@ -158,7 +158,7 @@ class HeaderMenu extends React__default["default"].Component {
158
158
  onKeyDown,
159
159
  ...rest
160
160
  } = this.props;
161
- const hasActiveChildren = React__default["default"].Children.toArray(children).some(child => child.props.isActive || child.props.isCurrentPage);
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));
162
162
  const accessibilityLabel = {
163
163
  'aria-label': ariaLabel,
164
164
  'aria-labelledby': ariaLabelledBy
@@ -173,7 +173,7 @@ class HeaderMenu extends React__default["default"].Component {
173
173
  [`${prefix}--header__menu-title`]: true,
174
174
  // We set the current class only if `isActive` is passed in and we do
175
175
  // not have an `aria-current="page"` set for the breadcrumb item
176
- [`${prefix}--header__menu-item--current`]: isActivePage || hasActiveChildren && !this.state.expanded
176
+ [`${prefix}--header__menu-item--current`]: isActivePage || hasActiveDescendant(children) && !this.state.expanded
177
177
  });
178
178
 
179
179
  // Notes on eslint comments and based on the examples in:
@@ -25,5 +25,5 @@ interface SideNavContextData {
25
25
  isRail?: boolean | undefined;
26
26
  }
27
27
  export declare const SideNavContext: React.Context<SideNavContextData>;
28
- declare const SideNav: React.ForwardRefExoticComponent<Pick<SideNavProps, "children" | "slot" | "style" | "title" | "className" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "onToggle" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "onAnimationEnd" | "onKeyDown" | "tabIndex" | "color" | "lang" | "role" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "expanded" | "enterDelayMs" | "defaultExpanded" | "addFocusListeners" | "isChildOfHeader" | "isFixedNav" | "isRail" | "isPersistent" | "addMouseListeners" | "onOverlayClick" | "onSideNavBlur" | "inert"> & React.RefAttributes<HTMLElement>>;
28
+ declare const SideNav: React.ForwardRefExoticComponent<Pick<SideNavProps, "children" | "slot" | "style" | "title" | "className" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "onToggle" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "onAnimationEnd" | "onKeyDown" | "tabIndex" | "color" | "lang" | "role" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "expanded" | "enterDelayMs" | "defaultExpanded" | "inert" | "addFocusListeners" | "isChildOfHeader" | "isFixedNav" | "isRail" | "isPersistent" | "addMouseListeners" | "onOverlayClick" | "onSideNavBlur"> & React.RefAttributes<HTMLElement>>;
29
29
  export default SideNav;
@@ -0,0 +1,52 @@
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 from 'react';
8
+ import PropTypes from 'prop-types';
9
+ export interface SideNavFooterProps {
10
+ /**
11
+ * Provide text to be read to screen readers and shown as a tooltip when
12
+ * interacting with the toggle button in the footer
13
+ */
14
+ assistiveText: string;
15
+ className?: string;
16
+ /**
17
+ * Specify whether the side navigation is expanded or collapsed
18
+ */
19
+ expanded: boolean;
20
+ /**
21
+ * Provide a function that is called when the toggle button is interacted
22
+ * with. Useful for controlling the expansion state of the side navigation.
23
+ */
24
+ onToggle: (event: React.MouseEvent<HTMLButtonElement>) => void;
25
+ }
26
+ /**
27
+ * SideNavFooter is used for rendering the button at the bottom of the side
28
+ * navigation that is a part of the UI Shell. It is responsible for handling the
29
+ * user interaction to expand or collapse the side navigation.
30
+ */
31
+ declare function SideNavFooter({ assistiveText, className: customClassName, expanded, onToggle, }: SideNavFooterProps): JSX.Element;
32
+ declare namespace SideNavFooter {
33
+ var displayName: string;
34
+ var propTypes: {
35
+ /**
36
+ * Provide text to be read to screen readers and shown as a tooltip when
37
+ * interacting with the toggle button in the footer
38
+ */
39
+ assistiveText: PropTypes.Requireable<string>;
40
+ className: PropTypes.Requireable<string>;
41
+ /**
42
+ * Specify whether the side navigation is expanded or collapsed
43
+ */
44
+ expanded: PropTypes.Validator<boolean>;
45
+ /**
46
+ * Provide a function that is called when the toggle button is interacted
47
+ * with. Useful for controlling the expansion state of the side navigation.
48
+ */
49
+ onToggle: PropTypes.Validator<(...args: any[]) => any>;
50
+ };
51
+ }
52
+ export default SideNavFooter;
@@ -22,7 +22,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
22
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
23
23
 
24
24
  var _Close, _ChevronRight;
25
-
26
25
  /**
27
26
  * SideNavFooter is used for rendering the button at the bottom of the side
28
27
  * navigation that is a part of the UI Shell. It is responsible for handling the