@carbon/react 1.33.2 → 1.34.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 (43) hide show
  1. package/es/components/Button/Button.d.ts +1 -1
  2. package/es/components/ComposedModal/ComposedModal.js +13 -14
  3. package/es/components/DataTable/DataTable.d.ts +541 -0
  4. package/es/components/DataTable/DataTable.js +35 -14
  5. package/es/components/DataTable/index.d.ts +2 -2
  6. package/es/components/DataTable/state/sortStates.d.ts +13 -0
  7. package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +17 -16
  8. package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  9. package/es/components/ExpandableSearch/ExpandableSearch.js +16 -8
  10. package/es/components/InlineCheckbox/InlineCheckbox.js +3 -2
  11. package/es/components/OverflowMenu/OverflowMenu.js +2 -2
  12. package/es/components/Search/Search.d.ts +2 -2
  13. package/es/components/Search/Search.js +25 -4
  14. package/es/components/Tabs/Tabs.js +2 -0
  15. package/es/components/Tag/Tag.js +9 -2
  16. package/es/components/TextArea/TextArea.js +1 -0
  17. package/es/components/Toggle/Toggle.d.ts +8 -8
  18. package/es/components/UIShell/HeaderMenuButton.d.ts +57 -0
  19. package/es/components/UIShell/HeaderMenuButton.js +4 -0
  20. package/es/components/UIShell/HeaderNavigation.d.ts +56 -0
  21. package/es/prop-types/isRequiredOneOf.js +2 -2
  22. package/lib/components/Button/Button.d.ts +1 -1
  23. package/lib/components/ComposedModal/ComposedModal.js +13 -14
  24. package/lib/components/DataTable/DataTable.d.ts +541 -0
  25. package/lib/components/DataTable/DataTable.js +39 -18
  26. package/lib/components/DataTable/index.d.ts +2 -2
  27. package/lib/components/DataTable/state/sortStates.d.ts +13 -0
  28. package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +17 -16
  29. package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  30. package/lib/components/ExpandableSearch/ExpandableSearch.js +16 -8
  31. package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -2
  32. package/lib/components/OverflowMenu/OverflowMenu.js +2 -2
  33. package/lib/components/Search/Search.d.ts +2 -2
  34. package/lib/components/Search/Search.js +24 -3
  35. package/lib/components/Tabs/Tabs.js +2 -0
  36. package/lib/components/Tag/Tag.js +9 -2
  37. package/lib/components/TextArea/TextArea.js +1 -0
  38. package/lib/components/Toggle/Toggle.d.ts +8 -8
  39. package/lib/components/UIShell/HeaderMenuButton.d.ts +57 -0
  40. package/lib/components/UIShell/HeaderMenuButton.js +4 -0
  41. package/lib/components/UIShell/HeaderNavigation.d.ts +56 -0
  42. package/lib/prop-types/isRequiredOneOf.js +2 -2
  43. package/package.json +6 -6
@@ -4,7 +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 DataTable from './DataTable';
7
+ import DataTable, { type DataTableCell, type DataTableHeader, type DataTableRow, type DataTableProps, type DataTableRenderProps, type DataTableSize } from './DataTable';
8
8
  import Table from './Table';
9
9
  import TableActionList from './TableActionList';
10
10
  import TableBatchAction from './TableBatchAction';
@@ -25,5 +25,5 @@ import TableToolbarAction from './TableToolbarAction';
25
25
  import TableToolbarContent from './TableToolbarContent';
26
26
  import TableToolbarSearch from './TableToolbarSearch';
27
27
  import TableToolbarMenu from './TableToolbarMenu';
28
- export { DataTable, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
28
+ export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
29
29
  export default DataTable;
@@ -0,0 +1,13 @@
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 type DataTableSortState = 'NONE' | 'DESC' | 'ASC';
8
+ /**
9
+ * We currently support the following sorting states for DataTable headers,
10
+ * namely: `NONE` for no sorting being applied, and then `DESC` and `ASC` for
11
+ * the corresponding direction of the sorting order.
12
+ */
13
+ export declare const sortStates: Record<DataTableSortState, DataTableSortState>;
@@ -5,46 +5,47 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- export interface DataTableSkeletonProps {
8
+ import { TableHTMLAttributes } from 'react';
9
+ export interface DataTableSkeletonHeader {
9
10
  /**
10
- * Specify an optional className to add.
11
+ * Optionally specify header label
11
12
  */
12
- className?: string;
13
+ header?: string;
14
+ /**
15
+ * Optionally specify header key
16
+ */
17
+ key?: string;
18
+ }
19
+ export interface DataTableSkeletonProps extends TableHTMLAttributes<HTMLTableElement> {
13
20
  /**
14
21
  * Specify the number of columns that you want to render in the skeleton state
15
22
  */
16
- columnCount: number;
23
+ columnCount?: number;
17
24
  /**
18
25
  * Optionally specify whether you want the Skeleton to be rendered as a
19
26
  * compact DataTable
20
27
  */
21
- compact: boolean;
28
+ compact?: boolean;
22
29
  /**
23
30
  * Optionally specify the displayed headers
24
31
  */
25
- headers?: [{
26
- header: string;
27
- key: string;
28
- }] | {
29
- header: string;
30
- key: string;
31
- };
32
+ headers?: DataTableSkeletonHeader[];
32
33
  /**
33
34
  * Specify the number of rows that you want to render in the skeleton state
34
35
  */
35
- rowCount: number;
36
+ rowCount?: number;
36
37
  /**
37
38
  * Specify if the table header should be rendered as part of the skeleton.
38
39
  */
39
- showHeader: boolean;
40
+ showHeader?: boolean;
40
41
  /**
41
42
  * Specify if the table toolbar should be rendered as part of the skeleton.
42
43
  */
43
- showToolbar: boolean;
44
+ showToolbar?: boolean;
44
45
  /**
45
46
  * Optionally specify whether you want the DataTable to be zebra striped
46
47
  */
47
- zebra: boolean;
48
+ zebra?: boolean;
48
49
  }
49
50
  declare const DataTableSkeleton: {
50
51
  ({ headers, rowCount, columnCount, zebra, compact, className, showHeader, showToolbar, ...rest }: {
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import { type SearchProps } from '../Search';
9
- declare function ExpandableSearch({ onBlur, onChange, onExpand, onFocus, defaultValue, isExpanded, ...props }: SearchProps): JSX.Element;
9
+ declare function ExpandableSearch({ onBlur, onChange, onExpand, onKeyDown, defaultValue, isExpanded, ...props }: SearchProps): JSX.Element;
10
10
  declare namespace ExpandableSearch {
11
11
  var propTypes: React.WeakValidationMap<SearchProps & React.RefAttributes<HTMLInputElement>> | undefined;
12
12
  var displayName: string;
@@ -12,13 +12,15 @@ import Search from '../Search/Search.js';
12
12
  import '../Search/Search.Skeleton.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import { composeEventHandlers } from '../../tools/events.js';
15
+ import { match } from '../../internal/keyboard/match.js';
16
+ import { Escape } from '../../internal/keyboard/keys.js';
15
17
 
16
18
  function ExpandableSearch(_ref) {
17
19
  let {
18
20
  onBlur,
19
21
  onChange,
20
22
  onExpand,
21
- onFocus,
23
+ onKeyDown,
22
24
  defaultValue,
23
25
  isExpanded,
24
26
  ...props
@@ -27,11 +29,6 @@ function ExpandableSearch(_ref) {
27
29
  const [hasContent, setHasContent] = useState(defaultValue ? true : false);
28
30
  const searchRef = useRef(null);
29
31
  const prefix = usePrefix();
30
- function handleFocus() {
31
- if (!expanded) {
32
- setExpanded(true);
33
- }
34
- }
35
32
  function handleBlur(evt) {
36
33
  const relatedTargetIsAllowed = evt.relatedTarget && evt.relatedTarget.classList.contains(`${prefix}--search-close`);
37
34
  if (expanded && !relatedTargetIsAllowed && !hasContent) {
@@ -42,8 +39,19 @@ function ExpandableSearch(_ref) {
42
39
  setHasContent(evt.target.value !== '');
43
40
  }
44
41
  function handleExpand() {
42
+ setExpanded(true);
45
43
  searchRef.current?.focus?.();
46
44
  }
45
+ function handleKeyDown(evt) {
46
+ if (expanded && match(evt, Escape)) {
47
+ evt.stopPropagation();
48
+
49
+ // escape key only clears if the input is empty, otherwise it clears the input
50
+ if (!evt.target?.value) {
51
+ setExpanded(false);
52
+ }
53
+ }
54
+ }
47
55
  const classes = cx(`${prefix}--search--expandable`, {
48
56
  [`${prefix}--search--expanded`]: expanded
49
57
  }, props.className);
@@ -52,10 +60,10 @@ function ExpandableSearch(_ref) {
52
60
  isExpanded: expanded,
53
61
  ref: searchRef,
54
62
  className: classes,
55
- onFocus: composeEventHandlers([onFocus, handleFocus]),
56
63
  onBlur: composeEventHandlers([onBlur, handleBlur]),
57
64
  onChange: composeEventHandlers([onChange, handleChange]),
58
- onExpand: composeEventHandlers([onExpand, handleExpand])
65
+ onExpand: composeEventHandlers([onExpand, handleExpand]),
66
+ onKeyDown: composeEventHandlers([onKeyDown, handleKeyDown])
59
67
  }));
60
68
  }
61
69
  ExpandableSearch.propTypes = Search.propTypes;
@@ -59,12 +59,13 @@ const InlineCheckbox = /*#__PURE__*/React__default.forwardRef(function InlineChe
59
59
  React__default.createElement("label", {
60
60
  htmlFor: id,
61
61
  className: `${prefix}--checkbox-label`,
62
- "aria-label": deprecatedAriaLabel || ariaLabel,
63
62
  title: title,
64
63
  onClick: evt => {
65
64
  evt.stopPropagation();
66
65
  }
67
- }));
66
+ }, /*#__PURE__*/React__default.createElement("span", {
67
+ className: `${prefix}--visually-hidden`
68
+ }, deprecatedAriaLabel || ariaLabel)));
68
69
  });
69
70
  InlineCheckbox.propTypes = {
70
71
  /**
@@ -37,7 +37,7 @@ const on = function (element) {
37
37
 
38
38
  /**
39
39
  * The CSS property names of the arrow keyed by the floating menu direction.
40
- * @type {Object<string, string>}
40
+ * @type {[key: string]: string}
41
41
  */
42
42
  const triggerButtonPositionProps = {
43
43
  [DIRECTION_TOP]: 'bottom',
@@ -46,7 +46,7 @@ const triggerButtonPositionProps = {
46
46
 
47
47
  /**
48
48
  * Determines how the position of arrow should affect the floating menu position.
49
- * @type {Object<string, number>}
49
+ * @type {[key: string]: number}
50
50
  */
51
51
  const triggerButtonPositionFactors = {
52
52
  [DIRECTION_TOP]: -2,
@@ -4,7 +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 React, { type HTMLAttributes, type ReactNode, type ComponentType, type FunctionComponent } from 'react';
7
+ import React, { type HTMLAttributes, type ReactNode, type KeyboardEvent, type ComponentType, type FunctionComponent, type MouseEvent } from 'react';
8
8
  type InputPropsBase = Omit<HTMLAttributes<HTMLInputElement>, 'onChange'>;
9
9
  export interface SearchProps extends InputPropsBase {
10
10
  /**
@@ -54,7 +54,7 @@ export interface SearchProps extends InputPropsBase {
54
54
  /**
55
55
  * Optional callback called when the magnifier icon is clicked in ExpandableSearch.
56
56
  */
57
- onExpand?(): void;
57
+ onExpand?(e: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>): void;
58
58
  /**
59
59
  * Provide an optional placeholder text for the Search.
60
60
  * Note: if the label and placeholder differ,
@@ -19,7 +19,7 @@ import deprecate from '../../prop-types/deprecate.js';
19
19
  import '../FluidForm/FluidForm.js';
20
20
  import { FormContext } from '../FluidForm/FormContext.js';
21
21
  import { match } from '../../internal/keyboard/match.js';
22
- import { Escape } from '../../internal/keyboard/keys.js';
22
+ import { Escape, Enter, Space } from '../../internal/keyboard/keys.js';
23
23
 
24
24
  var _Close;
25
25
  const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwardRef) {
@@ -53,6 +53,7 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
53
53
  } = useContext(FormContext);
54
54
  const inputRef = useRef(null);
55
55
  const ref = useMergedRefs([forwardRef, inputRef]);
56
+ const expandButtonRef = useRef(null);
56
57
  const inputId = useId('search-input');
57
58
  const uniqueId = id || inputId;
58
59
  const searchId = `${uniqueId}-search`;
@@ -97,7 +98,21 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
97
98
  function handleKeyDown(event) {
98
99
  if (match(event, Escape)) {
99
100
  event.stopPropagation();
100
- clearInput();
101
+ if (inputRef.current?.value) {
102
+ clearInput();
103
+ }
104
+ // ExpandableSearch closes on escape when isExpanded, focus search activation button
105
+ else if (onExpand && isExpanded) {
106
+ expandButtonRef.current?.focus();
107
+ }
108
+ }
109
+ }
110
+ function handleExpandButtonKeyDown(event) {
111
+ if (match(event, Enter) || match(event, Space)) {
112
+ event.stopPropagation();
113
+ if (onExpand) {
114
+ onExpand(event);
115
+ }
101
116
  }
102
117
  }
103
118
  return /*#__PURE__*/React__default.createElement("div", {
@@ -108,7 +123,12 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
108
123
  "aria-labelledby": onExpand ? uniqueId : undefined,
109
124
  role: onExpand ? 'button' : undefined,
110
125
  className: `${prefix}--search-magnifier`,
111
- onClick: onExpand
126
+ onClick: onExpand,
127
+ onKeyDown: handleExpandButtonKeyDown,
128
+ tabIndex: onExpand && !isExpanded ? 1 : -1,
129
+ ref: expandButtonRef,
130
+ "aria-expanded": onExpand && isExpanded ? true : undefined,
131
+ "aria-controls": onExpand ? uniqueId : undefined
112
132
  }, /*#__PURE__*/React__default.createElement(CustomSearchIcon, {
113
133
  icon: renderIcon
114
134
  })), /*#__PURE__*/React__default.createElement("label", {
@@ -127,7 +147,8 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
127
147
  onKeyDown: composeEventHandlers([onKeyDown, handleKeyDown]),
128
148
  placeholder: placeholder,
129
149
  type: type,
130
- value: value
150
+ value: value,
151
+ tabIndex: onExpand && !isExpanded ? -1 : undefined
131
152
  })), /*#__PURE__*/React__default.createElement("button", {
132
153
  "aria-label": closeButtonLabelText,
133
154
  className: clearClasses,
@@ -194,6 +194,8 @@ function TabList(_ref2) {
194
194
  [`${prefix}--tabs--light`]: light,
195
195
  [`${prefix}--tabs__icon--default`]: iconSize === 'default',
196
196
  [`${prefix}--tabs__icon--lg`]: iconSize === 'lg',
197
+ // TODO: V12 - Remove this class
198
+ [`${prefix}--layout--size-lg`]: iconSize === 'lg',
197
199
  [`${prefix}--tabs--tall`]: hasSecondaryLabelTabs,
198
200
  [`${prefix}--tabs--full-width`]: distributeWidth
199
201
  }, customClassName);
@@ -41,6 +41,7 @@ const Tag = _ref => {
41
41
  disabled,
42
42
  onClose,
43
43
  size,
44
+ as: BaseComponent,
44
45
  ...other
45
46
  } = _ref;
46
47
  const prefix = usePrefix();
@@ -61,7 +62,8 @@ const Tag = _ref => {
61
62
  }
62
63
  };
63
64
  if (filter) {
64
- return /*#__PURE__*/React__default.createElement("div", _extends({
65
+ const ComponentTag = BaseComponent ?? 'div';
66
+ return /*#__PURE__*/React__default.createElement(ComponentTag, _extends({
65
67
  className: tagClasses,
66
68
  id: tagId
67
69
  }, other), /*#__PURE__*/React__default.createElement("span", {
@@ -76,7 +78,7 @@ const Tag = _ref => {
76
78
  title: title
77
79
  }, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null))));
78
80
  }
79
- const ComponentTag = other.onClick ? 'button' : 'div';
81
+ const ComponentTag = BaseComponent ?? (other.onClick ? 'button' : 'div');
80
82
  return /*#__PURE__*/React__default.createElement(ComponentTag, _extends({
81
83
  disabled: ComponentTag === 'button' ? disabled : null,
82
84
  className: tagClasses,
@@ -88,6 +90,11 @@ const Tag = _ref => {
88
90
  }, children !== null && children !== undefined ? children : TYPES[type]));
89
91
  };
90
92
  Tag.propTypes = {
93
+ /**
94
+ * Provide an alternative tag or component to use instead of the default
95
+ * wrapping element
96
+ */
97
+ as: PropTypes.elementType,
91
98
  /**
92
99
  * Provide content to be rendered inside of a <Tag>
93
100
  */
@@ -59,6 +59,7 @@ const TextArea = /*#__PURE__*/React__default.forwardRef((props, forwardRef) => {
59
59
  id,
60
60
  onChange: evt => {
61
61
  if (!other.disabled && onChange) {
62
+ evt.persist();
62
63
  // delay textCount assignation to give the textarea element value time to catch up if is a controlled input
63
64
  setTimeout(() => {
64
65
  setTextCount(evt.target?.value?.length);
@@ -19,18 +19,18 @@ export interface ToggleProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonE
19
19
  /**
20
20
  * Specify the label for the "off" position
21
21
  */
22
- labelA?: string | undefined;
22
+ labelA?: string;
23
23
  /**
24
24
  * Specify the label for the "on" position
25
25
  */
26
- labelB?: string | undefined;
26
+ labelB?: string;
27
27
  /**
28
28
  * Provide the text that will be read by a screen reader when visiting this
29
29
  * control. This should be provided unless 'aria-labelledby' is set instead
30
30
  * or you use an external <label> element with its "for" attribute set to the
31
31
  * toggle's id.
32
32
  */
33
- labelText?: string | undefined;
33
+ labelText?: string;
34
34
  /**
35
35
  * If true, the side labels (props.labelA and props.labelB) will be replaced by
36
36
  * props.labelText (if passed), so that the toggle doesn't render a top label.
@@ -39,7 +39,7 @@ export interface ToggleProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonE
39
39
  /**
40
40
  * Provide an event listener that is called when the control is toggled
41
41
  */
42
- onClick: MouseEventHandler<HTMLDivElement> | KeyboardEventHandler<HTMLDivElement> | undefined;
42
+ onClick?: MouseEventHandler<HTMLDivElement> | KeyboardEventHandler<HTMLDivElement>;
43
43
  /**
44
44
  * Provide an event listener that is called when the control is toggled
45
45
  */
@@ -47,19 +47,19 @@ export interface ToggleProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonE
47
47
  /**
48
48
  * Specify the size of the Toggle. Currently only supports 'sm' or 'md' (default)
49
49
  */
50
- size?: 'sm' | 'md' | undefined;
50
+ size?: 'sm' | 'md';
51
51
  /**
52
52
  * Whether the toggle should be read-only
53
53
  */
54
- readOnly?: boolean | undefined;
54
+ readOnly?: boolean;
55
55
  /**
56
56
  * Specify whether the toggle should be on by default
57
57
  */
58
- defaultToggled?: boolean | undefined;
58
+ defaultToggled?: boolean;
59
59
  /**
60
60
  * Specify whether the control is toggled
61
61
  */
62
- toggled?: boolean | undefined;
62
+ toggled?: boolean;
63
63
  }
64
64
  export declare function Toggle({ 'aria-labelledby': ariaLabelledby, className, defaultToggled, disabled, hideLabel, id, labelA, labelB, labelText, onClick, onToggle, readOnly, size, toggled, ...other }: ToggleProps): JSX.Element;
65
65
  export declare namespace Toggle {
@@ -28,11 +28,68 @@ declare namespace HeaderMenuButton {
28
28
  * Specify whether the menu button is "active".
29
29
  */
30
30
  isActive: PropTypes.Requireable<boolean>;
31
+ /**
32
+ * Specify whether the menu button is collapsible.
33
+ */
34
+ isCollapsible: PropTypes.Requireable<boolean>;
31
35
  /**
32
36
  * Optionally provide an onClick handler that is called when the underlying
33
37
  * button fires it's onclick event
34
38
  */
35
39
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
40
+ 0: string;
41
+ length: 1;
42
+ toString(): string;
43
+ toLocaleString(): string;
44
+ pop(): string | undefined;
45
+ push(...items: string[]): number;
46
+ concat(...items: ConcatArray<string>[]): string[];
47
+ concat(...items: (string | ConcatArray<string>)[]): string[];
48
+ join(separator?: string | undefined): string;
49
+ reverse(): string[];
50
+ shift(): string | undefined;
51
+ slice(start?: number | undefined, end?: number | undefined): string[];
52
+ sort(compareFn?: ((a: string, b: string) => number) | undefined): [key: string];
53
+ splice(start: number, deleteCount?: number | undefined): string[];
54
+ splice(start: number, deleteCount: number, ...items: string[]): string[];
55
+ unshift(...items: string[]): number;
56
+ indexOf(searchElement: string, fromIndex?: number | undefined): number;
57
+ lastIndexOf(searchElement: string, fromIndex?: number | undefined): number;
58
+ every<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
59
+ every(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
60
+ some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
61
+ forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void;
62
+ map<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any): U[];
63
+ filter<S_1 extends string>(predicate: (value: string, index: number, array: string[]) => value is S_1, thisArg?: any): S_1[];
64
+ filter(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
65
+ reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
66
+ reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
67
+ reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: string, currentIndex: number, array: string[]) => U_1, initialValue: U_1): U_1;
68
+ reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
69
+ reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
70
+ reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: string, currentIndex: number, array: string[]) => U_2, initialValue: U_2): U_2;
71
+ find<S_2 extends string>(predicate: (this: void, value: string, index: number, obj: string[]) => value is S_2, thisArg?: any): S_2 | undefined;
72
+ find(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
73
+ findIndex(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): number;
74
+ fill(value: string, start?: number | undefined, end?: number | undefined): [key: string];
75
+ copyWithin(target: number, start: number, end?: number | undefined): [key: string];
76
+ entries(): IterableIterator<[number, string]>;
77
+ keys(): IterableIterator<number>;
78
+ values(): IterableIterator<string>;
79
+ includes(searchElement: string, fromIndex?: number | undefined): boolean;
80
+ flatMap<U_3, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U_3 | readonly U_3[], thisArg?: This | undefined): U_3[];
81
+ flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
82
+ at(index: number): string | undefined;
83
+ [Symbol.iterator](): IterableIterator<string>;
84
+ [Symbol.unscopables](): {
85
+ copyWithin: boolean;
86
+ entries: boolean;
87
+ fill: boolean;
88
+ find: boolean;
89
+ findIndex: boolean;
90
+ keys: boolean;
91
+ values: boolean;
92
+ };
36
93
  };
37
94
  }
38
95
  export default HeaderMenuButton;
@@ -64,6 +64,10 @@ HeaderMenuButton.propTypes = {
64
64
  * Specify whether the menu button is "active".
65
65
  */
66
66
  isActive: PropTypes.bool,
67
+ /**
68
+ * Specify whether the menu button is collapsible.
69
+ */
70
+ isCollapsible: PropTypes.bool,
67
71
  /**
68
72
  * Optionally provide an onClick handler that is called when the underlying
69
73
  * button fires it's onclick event
@@ -19,6 +19,62 @@ declare namespace HeaderNavigation {
19
19
  * Optionally provide a custom class to apply to the underlying <nav> node
20
20
  */
21
21
  className: PropTypes.Requireable<string>;
22
+ 0: string;
23
+ length: 1;
24
+ toString(): string;
25
+ toLocaleString(): string;
26
+ pop(): string | undefined;
27
+ push(...items: string[]): number;
28
+ concat(...items: ConcatArray<string>[]): string[];
29
+ concat(...items: (string | ConcatArray<string>)[]): string[];
30
+ join(separator?: string | undefined): string;
31
+ reverse(): string[];
32
+ shift(): string | undefined;
33
+ slice(start?: number | undefined, end?: number | undefined): string[];
34
+ sort(compareFn?: ((a: string, b: string) => number) | undefined): [key: string];
35
+ splice(start: number, deleteCount?: number | undefined): string[];
36
+ splice(start: number, deleteCount: number, ...items: string[]): string[];
37
+ unshift(...items: string[]): number;
38
+ indexOf(searchElement: string, fromIndex?: number | undefined): number;
39
+ lastIndexOf(searchElement: string, fromIndex?: number | undefined): number;
40
+ every<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
41
+ every(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
42
+ some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
43
+ forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void;
44
+ map<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any): U[];
45
+ filter<S_1 extends string>(predicate: (value: string, index: number, array: string[]) => value is S_1, thisArg?: any): S_1[];
46
+ filter(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
47
+ reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
48
+ reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
49
+ reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: string, currentIndex: number, array: string[]) => U_1, initialValue: U_1): U_1;
50
+ reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
51
+ reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
52
+ reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: string, currentIndex: number, array: string[]) => U_2, initialValue: U_2): U_2;
53
+ find<S_2 extends string>(predicate: (this: void, value: string, index: number, obj: string[]) => value is S_2, thisArg?: any): S_2 | undefined;
54
+ find(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
55
+ findIndex(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): number;
56
+ fill(value: string, start?: number | undefined, end?: number | undefined): [key: string];
57
+ copyWithin(target: number, start: number, end?: number | undefined): [key: string];
58
+ entries(): IterableIterator<[number, string]>;
59
+ keys(): IterableIterator<number>;
60
+ values(): IterableIterator<string>;
61
+ includes(searchElement: string, fromIndex?: number | undefined): boolean;
62
+ flatMap<U_3, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U_3 | readonly U_3[], thisArg?: This | undefined): U_3[];
63
+ flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
64
+ at(index: number): string | undefined; /**
65
+ * Provide valid children of HeaderNavigation, for example `HeaderMenuItem`
66
+ * or `HeaderMenu`
67
+ */
68
+ [Symbol.iterator](): IterableIterator<string>;
69
+ [Symbol.unscopables](): {
70
+ copyWithin: boolean;
71
+ entries: boolean;
72
+ fill: boolean;
73
+ find: boolean;
74
+ findIndex: boolean;
75
+ keys: boolean;
76
+ values: boolean;
77
+ };
22
78
  };
23
79
  }
24
80
  export default HeaderNavigation;
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  /**
9
- * @param {Object<string, Function>} propTypes The list of type checkers, keyed by prop names.
10
- * @returns {Object<string, Function>}
9
+ * @param {[key: string]: Function)} propTypes The list of type checkers, keyed by prop names.
10
+ * @returns {[key: string]: Function}
11
11
  * The new prop type checkers that checks if one of the given props exist,
12
12
  * in addition to the original type checkings.
13
13
  */
@@ -33,7 +33,7 @@ interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
33
33
  */
34
34
  iconDescription?: string;
35
35
  /**
36
- * Specify whether the Button is expressive, or not
36
+ * Specify whether the Button is expressive, or not. Only applies to the large/default button size.
37
37
  */
38
38
  isExpressive?: boolean;
39
39
  /**
@@ -187,25 +187,24 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
187
187
  }
188
188
  });
189
189
  React.useEffect(() => {
190
+ const initialFocus = focusContainerElement => {
191
+ const containerElement = focusContainerElement || innerModal.current;
192
+ const primaryFocusElement = containerElement ? containerElement.querySelector(selectorPrimaryFocus) : null;
193
+ if (primaryFocusElement) {
194
+ return primaryFocusElement;
195
+ }
196
+ return button && button.current;
197
+ };
190
198
  const focusButton = focusContainerElement => {
191
- if (focusContainerElement) {
192
- const primaryFocusElement = focusContainerElement.querySelector(selectorPrimaryFocus);
193
- if (primaryFocusElement) {
194
- primaryFocusElement.focus();
195
- return;
196
- }
197
- if (button.current) {
198
- button.current.focus();
199
- }
199
+ const target = initialFocus(focusContainerElement);
200
+ if (target) {
201
+ target.focus();
200
202
  }
201
203
  };
202
- if (!open) {
203
- return;
204
- }
205
- if (innerModal.current) {
204
+ if (open && isOpen) {
206
205
  focusButton(innerModal.current);
207
206
  }
208
- }, [open, selectorPrimaryFocus]);
207
+ }, [open, selectorPrimaryFocus, isOpen]);
209
208
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
210
209
  role: "presentation",
211
210
  ref: ref,