@carbon/react 1.41.2 → 1.42.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 (61) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +2194 -1863
  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/FluidMultiSelect/FluidMultiSelect.js +72 -9
  16. package/es/components/Notification/Notification.js +48 -6
  17. package/es/components/Tabs/Tabs.js +1 -2
  18. package/es/components/TreeView/TreeNode.js +7 -4
  19. package/es/components/UIShell/HeaderMenu.js +2 -2
  20. package/es/components/UIShell/SideNav.d.ts +1 -1
  21. package/es/components/UIShell/SideNavFooter.d.ts +52 -0
  22. package/es/components/UIShell/SideNavFooter.js +0 -1
  23. package/es/components/UIShell/SideNavItem.d.ts +24 -0
  24. package/es/components/UIShell/SideNavItem.js +2 -2
  25. package/es/components/UIShell/SideNavItems.d.ts +25 -0
  26. package/es/components/UIShell/SideNavItems.js +9 -7
  27. package/es/components/UIShell/SideNavMenu.js +4 -5
  28. package/es/components/UIShell/SideNavMenuItem.d.ts +25 -0
  29. package/es/components/UIShell/SideNavMenuItem.js +1 -2
  30. package/es/index.js +1 -1
  31. package/icons/index.d.ts +7 -0
  32. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +25 -0
  33. package/lib/components/Breadcrumb/Breadcrumb.d.ts +24 -0
  34. package/lib/components/Breadcrumb/Breadcrumb.js +1 -2
  35. package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +25 -0
  36. package/lib/components/Breadcrumb/BreadcrumbItem.js +8 -7
  37. package/lib/components/ComboBox/ComboBox.d.ts +7 -1
  38. package/lib/components/ComboBox/ComboBox.js +30 -2
  39. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
  40. package/lib/components/DataTable/TableBatchAction.d.ts +46 -0
  41. package/lib/components/DataTable/TableBatchAction.js +1 -2
  42. package/lib/components/DataTable/TableExpandRow.d.ts +2 -46
  43. package/lib/components/DataTable/TableExpandRow.js +6 -2
  44. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  45. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +72 -9
  46. package/lib/components/Notification/Notification.js +48 -6
  47. package/lib/components/Tabs/Tabs.js +1 -2
  48. package/lib/components/TreeView/TreeNode.js +7 -4
  49. package/lib/components/UIShell/HeaderMenu.js +2 -2
  50. package/lib/components/UIShell/SideNav.d.ts +1 -1
  51. package/lib/components/UIShell/SideNavFooter.d.ts +52 -0
  52. package/lib/components/UIShell/SideNavFooter.js +0 -1
  53. package/lib/components/UIShell/SideNavItem.d.ts +24 -0
  54. package/lib/components/UIShell/SideNavItem.js +2 -2
  55. package/lib/components/UIShell/SideNavItems.d.ts +25 -0
  56. package/lib/components/UIShell/SideNavItems.js +9 -7
  57. package/lib/components/UIShell/SideNavMenu.js +4 -5
  58. package/lib/components/UIShell/SideNavMenuItem.d.ts +25 -0
  59. package/lib/components/UIShell/SideNavMenuItem.js +1 -2
  60. package/lib/index.js +2 -2
  61. 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 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;
@@ -51,6 +51,5 @@ Breadcrumb.propTypes = {
51
51
  */
52
52
  noTrailingSlash: PropTypes.bool
53
53
  };
54
- var Breadcrumb$1 = Breadcrumb;
55
54
 
56
- export { Breadcrumb$1 as default };
55
+ export { Breadcrumb as default };
@@ -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;
@@ -19,7 +19,7 @@ const BreadcrumbItem = /*#__PURE__*/React__default.forwardRef(function Breadcrum
19
19
  let {
20
20
  'aria-current': ariaCurrent,
21
21
  children,
22
- className: customClassName,
22
+ className: customClassName = '',
23
23
  href,
24
24
  isCurrentPage,
25
25
  ...rest
@@ -32,13 +32,14 @@ const BreadcrumbItem = /*#__PURE__*/React__default.forwardRef(function Breadcrum
32
32
  [`${prefix}--breadcrumb-item--current`]: isCurrentPage && ariaCurrent !== 'page',
33
33
  [customClassName]: !!customClassName
34
34
  });
35
- if (children.type && children.type.displayName !== undefined && children.type.displayName.includes('OverflowMenu')) {
35
+ const child = children;
36
+ if (child.type && child.type.displayName !== undefined && child.type.displayName.includes('OverflowMenu')) {
36
37
  const horizontalOverflowIcon = /*#__PURE__*/React__default.createElement(OverflowMenuHorizontal, {
37
38
  className: `${prefix}--overflow-menu__icon`
38
39
  });
39
40
  return /*#__PURE__*/React__default.createElement("li", _extends({
40
41
  className: className
41
- }, rest), /*#__PURE__*/React__default.cloneElement(children, {
42
+ }, rest), /*#__PURE__*/React__default.cloneElement(child, {
42
43
  menuOptionsClass: `${prefix}--breadcrumb-menu-options`,
43
44
  menuOffset: {
44
45
  top: 10,
@@ -61,13 +62,14 @@ const BreadcrumbItem = /*#__PURE__*/React__default.forwardRef(function Breadcrum
61
62
  return /*#__PURE__*/React__default.createElement("li", _extends({
62
63
  className: className,
63
64
  ref: ref
64
- }, rest), /*#__PURE__*/React__default.cloneElement(children, {
65
+ }, rest), /*#__PURE__*/React__default.cloneElement(child, {
65
66
  'aria-current': ariaCurrent,
66
- className: cx(`${prefix}--link`, children.props.className)
67
+ className: cx(`${prefix}--link`, child.props.className)
67
68
  }));
68
69
  });
69
70
  BreadcrumbItem.displayName = 'BreadcrumbItem';
70
71
  BreadcrumbItem.propTypes = {
72
+ // @ts-expect-error - v12 TODO: BREAKING: This should match AriaAttributes['aria-current']
71
73
  'aria-current': PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
72
74
  /**
73
75
  * Pass in content that will be inside of the BreadcrumbItem
@@ -86,6 +88,5 @@ BreadcrumbItem.propTypes = {
86
88
  */
87
89
  isCurrentPage: PropTypes.bool
88
90
  };
89
- var BreadcrumbItem$1 = BreadcrumbItem;
90
91
 
91
- export { BreadcrumbItem$1 as default };
92
+ export { BreadcrumbItem as default };
@@ -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.
@@ -32,7 +32,8 @@ const {
32
32
  keyDownEscape,
33
33
  clickButton,
34
34
  blurButton,
35
- changeInput
35
+ changeInput,
36
+ blurInput
36
37
  } = Downshift.stateChangeTypes;
37
38
  const defaultItemToString = item => {
38
39
  if (typeof item === 'string') {
@@ -110,6 +111,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
110
111
  translateWithId,
111
112
  warn,
112
113
  warnText,
114
+ allowCustomValue = false,
113
115
  ...rest
114
116
  } = props;
115
117
  const prefix = usePrefix();
@@ -204,6 +206,17 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
204
206
  case changeInput:
205
207
  updateHighlightedIndex(getHighlightedIndex(changes));
206
208
  break;
209
+ case blurInput:
210
+ if (allowCustomValue) {
211
+ setInputValue(inputValue);
212
+ if (onChange) {
213
+ onChange({
214
+ selectedItem,
215
+ inputValue
216
+ });
217
+ }
218
+ }
219
+ break;
207
220
  }
208
221
  };
209
222
  const handleToggleClick = isOpen => event => {
@@ -302,8 +315,18 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
302
315
  if (match(event, Space)) {
303
316
  event.stopPropagation();
304
317
  }
305
- if (match(event, Enter) && !inputValue) {
318
+ if (match(event, Enter) && (!inputValue || allowCustomValue)) {
306
319
  toggleMenu();
320
+
321
+ // Since `onChange` does not normally fire when the menu is closed, we should
322
+ // manually fire it when `allowCustomValue` is provided, the menu is closing,
323
+ // and there is a value.
324
+ if (allowCustomValue && isOpen && inputValue) {
325
+ onChange({
326
+ selectedItem,
327
+ inputValue
328
+ });
329
+ }
307
330
  }
308
331
  if (match(event, Escape) && inputValue) {
309
332
  if (event.target === textInput.current && isOpen) {
@@ -411,6 +434,11 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
411
434
  });
412
435
  ComboBox.displayName = 'ComboBox';
413
436
  ComboBox.propTypes = {
437
+ /**
438
+ * Specify whether or not the ComboBox should allow a value that is
439
+ * not in the list to be entered in the input
440
+ */
441
+ allowCustomValue: PropTypes.bool,
414
442
  /**
415
443
  * 'aria-label' of the ListBox component.
416
444
  * 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;
@@ -43,6 +43,5 @@ TableBatchAction.propTypes = {
43
43
  */
44
44
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
45
45
  };
46
- var TableBatchAction$1 = TableBatchAction;
47
46
 
48
- export { TableBatchAction$1 as default };
47
+ export { TableBatchAction as default };
@@ -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;
@@ -13,7 +13,7 @@ import { ChevronRight } from '@carbon/icons-react';
13
13
  import TableCell from './TableCell.js';
14
14
  import { usePrefix } from '../../internal/usePrefix.js';
15
15
 
16
- const TableExpandRow = _ref => {
16
+ const TableExpandRow = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
17
17
  let {
18
18
  ['aria-controls']: ariaControls,
19
19
  ['aria-label']: ariaLabel,
@@ -35,6 +35,7 @@ const TableExpandRow = _ref => {
35
35
  }, rowClassName);
36
36
  const previousValue = isExpanded ? 'collapsed' : undefined;
37
37
  return /*#__PURE__*/React__default.createElement("tr", _extends({}, rest, {
38
+ ref: ref,
38
39
  className: className,
39
40
  "data-parent-row": true
40
41
  }), /*#__PURE__*/React__default.createElement(TableCell, {
@@ -53,17 +54,19 @@ const TableExpandRow = _ref => {
53
54
  className: `${prefix}--table-expand__svg`,
54
55
  "aria-label": expandIconDescription
55
56
  }))), children);
56
- };
57
+ });
57
58
  TableExpandRow.propTypes = {
58
59
  /**
59
60
  * Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandRow
60
61
  * TODO: make this required in v12
61
62
  */
63
+ /**@ts-ignore*/
62
64
  ['aria-controls']: PropTypes.string,
63
65
  /**
64
66
  * Specify the string read by a voice reader when the expand trigger is
65
67
  * focused
66
68
  */
69
+ /**@ts-ignore*/
67
70
  ['aria-label']: PropTypes.string,
68
71
  /**
69
72
  * Deprecated, please use `aria-label` instead.
@@ -95,5 +98,6 @@ TableExpandRow.propTypes = {
95
98
  */
96
99
  onExpand: PropTypes.func.isRequired
97
100
  };
101
+ TableExpandRow.displayName = 'TableExpandRow';
98
102
 
99
103
  export { TableExpandRow as default };
@@ -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
  */
@@ -44,22 +44,39 @@ FluidMultiSelect.propTypes = {
44
44
  */
45
45
  className: PropTypes.string,
46
46
  /**
47
- * Specify the direction of the dropdown. Can be either top or bottom.
47
+ * Specify the text that should be read for screen readers that describes total items selected
48
+ */
49
+ clearSelectionDescription: PropTypes.string,
50
+ /**
51
+ * Specify the text that should be read for screen readers to clear selection.
52
+ */
53
+ clearSelectionText: PropTypes.string,
54
+ /**
55
+ * Provide a compare function that is used to determine the ordering of
56
+ * options. See 'sortItems' for more control.
57
+ */
58
+ compareItems: PropTypes.func,
59
+ /**
60
+ * Specify the direction of the multiselect dropdown. Can be either top or bottom.
48
61
  */
49
62
  direction: PropTypes.oneOf(['top', 'bottom']),
50
63
  /**
51
64
  * Specify whether the `<input>` should be disabled
52
65
  */
53
66
  disabled: PropTypes.bool,
67
+ /**
68
+ * Additional props passed to Downshift
69
+ */
70
+ downshiftProps: PropTypes.object,
54
71
  /**
55
72
  * Specify a custom `id` for the `<input>`
56
73
  */
57
74
  id: PropTypes.string.isRequired,
58
75
  /**
59
- * Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
60
- * from their collection that are pre-selected
76
+ * Allow users to pass in arbitrary items from their collection that are
77
+ * pre-selected
61
78
  */
62
- initialSelectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
79
+ initialSelectedItems: PropTypes.array,
63
80
  /**
64
81
  * Specify if the currently selected value is invalid.
65
82
  */
@@ -97,20 +114,62 @@ FluidMultiSelect.propTypes = {
97
114
  * this field is for
98
115
  */
99
116
  label: PropTypes.node.isRequired,
117
+ /**
118
+ * Specify the locale of the control. Used for the default `compareItems`
119
+ * used for sorting the list of items in the control.
120
+ */
121
+ locale: PropTypes.string,
100
122
  /**
101
123
  * `onChange` is a utility for this controlled component to communicate to a
102
124
  * consuming component what kind of internal state changes are occurring.
103
125
  */
104
126
  onChange: PropTypes.func,
105
127
  /**
106
- * An optional callback to render the currently selected item as a react element instead of only
107
- * as a string.
128
+ * **Filterable variant only** - `onInputValueChange` is a utility for this controlled component to communicate to
129
+ * the currently typed input.
108
130
  */
109
- renderSelectedItem: PropTypes.func,
131
+ onInputValueChange: PropTypes.func,
110
132
  /**
111
- * In the case you want to control the dropdown selection entirely.
133
+ * `onMenuChange` is a utility for this controlled component to communicate to a
134
+ * consuming component that the menu was open(`true`)/closed(`false`).
112
135
  */
113
- selectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
136
+ onMenuChange: PropTypes.func,
137
+ /**
138
+ * Whether or not the Multiselect is readonly
139
+ */
140
+ readOnly: PropTypes.bool,
141
+ /**
142
+ * For full control of the selected items
143
+ */
144
+ selectedItems: PropTypes.array,
145
+ /**
146
+ * Specify feedback (mode) of the selection.
147
+ * `top`: selected item jumps to top
148
+ * `fixed`: selected item stays at it's position
149
+ * `top-after-reopen`: selected item jump to top after reopen dropdown
150
+ */
151
+ selectionFeedback: PropTypes.oneOf(['top', 'fixed', 'top-after-reopen']),
152
+ /**
153
+ * Provide a method that sorts all options in the control. Overriding this
154
+ * prop means that you also have to handle the sort logic for selected versus
155
+ * un-selected items. If you just want to control ordering, consider the
156
+ * `compareItems` prop instead.
157
+ *
158
+ * The return value should be a number whose sign indicates the relative order
159
+ * of the two elements: negative if a is less than b, positive if a is greater
160
+ * than b, and zero if they are equal.
161
+ *
162
+ * sortItems :
163
+ * (items: Array<Item>, {
164
+ * selectedItems: Array<Item>,
165
+ * itemToString: Item => string,
166
+ * compareItems: (itemA: string, itemB: string, {
167
+ * locale: string
168
+ * }) => number,
169
+ * locale: string,
170
+ * }) => Array<Item>
171
+ */
172
+ sortItems: PropTypes.func,
114
173
  /**
115
174
  * Provide the title text that will be read by a screen reader when
116
175
  * visiting this control
@@ -120,6 +179,10 @@ FluidMultiSelect.propTypes = {
120
179
  * Callback function for translating ListBoxMenuIcon SVG title
121
180
  */
122
181
  translateWithId: PropTypes.func,
182
+ /**
183
+ * Specify title to show title on hover
184
+ */
185
+ useTitleInItem: PropTypes.bool,
123
186
  /**
124
187
  * Specify whether the control is currently in warning state
125
188
  */
@@ -19,6 +19,7 @@ import { useNoInteractiveChildren } from '../../internal/useNoInteractiveChildre
19
19
  import { usePrefix } from '../../internal/usePrefix.js';
20
20
  import { useId } from '../../internal/useId.js';
21
21
  import { noopFn } from '../../internal/noopFn.js';
22
+ import wrapFocus from '../../internal/wrapFocus.js';
22
23
  import { Text } from '../Text/Text.js';
23
24
  import { matches } from '../../internal/keyboard/match.js';
24
25
  import { Escape } from '../../internal/keyboard/keys.js';
@@ -506,12 +507,40 @@ function ActionableNotification(_ref6) {
506
507
  [`${prefix}--actionable-notification--${kind}`]: kind,
507
508
  [`${prefix}--actionable-notification--hide-close-button`]: hideCloseButton
508
509
  });
510
+ const innerModal = useRef(null);
511
+ const startTrap = useRef(null);
512
+ const endTrap = useRef(null);
509
513
  const ref = useRef(null);
510
514
  useIsomorphicEffect(() => {
511
- if (ref.current && hasFocus) {
512
- ref.current.focus();
515
+ if (hasFocus) {
516
+ const button = document.querySelector('button.cds--actionable-notification__action-button');
517
+ button?.focus();
513
518
  }
514
519
  });
520
+ function handleBlur(_ref7) {
521
+ let {
522
+ target: oldActiveNode,
523
+ relatedTarget: currentActiveNode
524
+ } = _ref7;
525
+ if (isOpen && currentActiveNode && oldActiveNode) {
526
+ const {
527
+ current: bodyNode
528
+ } = innerModal;
529
+ const {
530
+ current: startTrapNode
531
+ } = startTrap;
532
+ const {
533
+ current: endTrapNode
534
+ } = endTrap;
535
+ wrapFocus({
536
+ bodyNode,
537
+ startTrapNode,
538
+ endTrapNode,
539
+ currentActiveNode,
540
+ oldActiveNode
541
+ });
542
+ }
543
+ }
515
544
  const handleClose = evt => {
516
545
  if (!onClose || onClose(evt) !== false) {
517
546
  setIsOpen(false);
@@ -529,8 +558,14 @@ function ActionableNotification(_ref6) {
529
558
  ref: ref,
530
559
  role: role,
531
560
  className: containerClassName,
532
- "aria-labelledby": title ? id : subtitleId
533
- }), /*#__PURE__*/React__default.createElement("div", {
561
+ "aria-labelledby": title ? id : subtitleId,
562
+ onBlur: handleBlur
563
+ }), /*#__PURE__*/React__default.createElement("span", {
564
+ ref: startTrap,
565
+ tabIndex: 0,
566
+ role: "link",
567
+ className: `${prefix}--visually-hidden`
568
+ }, "Focus sentinel"), /*#__PURE__*/React__default.createElement("div", {
534
569
  className: `${prefix}--actionable-notification__details`
535
570
  }, /*#__PURE__*/React__default.createElement(NotificationIcon, {
536
571
  notificationType: inline ? 'inline' : 'toast',
@@ -548,14 +583,21 @@ function ActionableNotification(_ref6) {
548
583
  as: "div",
549
584
  className: `${prefix}--actionable-notification__subtitle`,
550
585
  id: subtitleId
551
- }, subtitle), children))), actionButtonLabel && /*#__PURE__*/React__default.createElement(NotificationActionButton, {
586
+ }, subtitle), children))), /*#__PURE__*/React__default.createElement("div", {
587
+ ref: innerModal
588
+ }, actionButtonLabel && /*#__PURE__*/React__default.createElement(NotificationActionButton, {
552
589
  onClick: onActionButtonClick,
553
590
  inline: inline
554
591
  }, actionButtonLabel), !hideCloseButton && /*#__PURE__*/React__default.createElement(NotificationButton, {
555
592
  "aria-label": deprecatedAriaLabel || ariaLabel,
556
593
  notificationType: "actionable",
557
594
  onClick: handleCloseButtonClick
558
- }));
595
+ })), /*#__PURE__*/React__default.createElement("span", {
596
+ ref: endTrap,
597
+ tabIndex: 0,
598
+ role: "link",
599
+ className: `${prefix}--visually-hidden`
600
+ }, "Focus sentinel"));
559
601
  }
560
602
  ActionableNotification.propTypes = {
561
603
  /**
@@ -587,8 +587,7 @@ const Tab = /*#__PURE__*/forwardRef(function Tab(_ref5, forwardRef) {
587
587
  }, /*#__PURE__*/React__default.createElement(Icon, {
588
588
  size: 16
589
589
  })), /*#__PURE__*/React__default.createElement(Text, {
590
- className: `${prefix}--tabs__nav-item-label`,
591
- title: children
590
+ className: `${prefix}--tabs__nav-item-label`
592
591
  }, children), /*#__PURE__*/React__default.createElement("div", {
593
592
  className: cx(`${prefix}--tabs__nav-item--icon`, {
594
593
  [`${prefix}--visually-hidden`]: !hasIcon
@@ -15,7 +15,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
15
15
  import { matches, match } from '../../internal/keyboard/match.js';
16
16
  import { ArrowLeft, ArrowRight, Enter, Space } from '../../internal/keyboard/keys.js';
17
17
 
18
- function TreeNode(_ref) {
18
+ const TreeNode = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
19
19
  let {
20
20
  active,
21
21
  children,
@@ -220,7 +220,8 @@ function TreeNode(_ref) {
220
220
  /*#__PURE__*/
221
221
  // eslint-disable-next-line jsx-a11y/role-supports-aria-props
222
222
  React__default.createElement("li", _extends({}, treeNodeProps, {
223
- "aria-expanded": !!expanded
223
+ "aria-expanded": !!expanded,
224
+ ref: ref
224
225
  }), /*#__PURE__*/React__default.createElement("div", {
225
226
  className: `${prefix}--tree-node__label`,
226
227
  ref: currentNodeLabel
@@ -239,7 +240,7 @@ function TreeNode(_ref) {
239
240
  className: `${prefix}--tree-node__children`
240
241
  }, nodesWithProps))
241
242
  );
242
- }
243
+ });
243
244
  TreeNode.propTypes = {
244
245
  /**
245
246
  * The value of the active node in the tree
@@ -299,5 +300,7 @@ TreeNode.propTypes = {
299
300
  */
300
301
  value: PropTypes.string
301
302
  };
303
+ TreeNode.displayName = 'TreeNode';
304
+ var TreeNode$1 = TreeNode;
302
305
 
303
- export { TreeNode as default };
306
+ export { TreeNode$1 as default };