@carbon/react 1.38.0 → 1.39.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 (44) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1225 -759
  2. package/es/components/CodeSnippet/CodeSnippet.js +7 -0
  3. package/es/components/ComboBox/ComboBox.d.ts +30 -27
  4. package/es/components/ComboBox/ComboBox.js +23 -24
  5. package/es/components/Copy/Copy.js +6 -1
  6. package/es/components/CopyButton/CopyButton.js +6 -0
  7. package/es/components/FileUploader/FileUploader.js +1 -1
  8. package/es/components/Grid/index.d.ts +1 -0
  9. package/es/components/Link/Link.d.ts +1 -1
  10. package/es/components/Link/index.d.ts +2 -2
  11. package/es/components/Popover/index.d.ts +9 -5
  12. package/es/components/Popover/index.js +2 -3
  13. package/es/components/UIShell/HeaderContainer.d.ts +1 -1
  14. package/es/components/UIShell/HeaderMenuButton.d.ts +4 -2
  15. package/es/components/UIShell/HeaderMenuItem.d.ts +1 -1
  16. package/es/components/UIShell/HeaderName.d.ts +1 -1
  17. package/es/components/UIShell/HeaderNavigation.d.ts +2 -5
  18. package/es/components/UIShell/HeaderSideNavItems.d.ts +1 -1
  19. package/es/components/UIShell/SideNav.d.ts +1 -1
  20. package/es/components/UIShell/SkipToContent.d.ts +1 -1
  21. package/es/components/UIShell/index.d.ts +8 -8
  22. package/es/index.js +1 -0
  23. package/lib/components/CodeSnippet/CodeSnippet.js +7 -0
  24. package/lib/components/ComboBox/ComboBox.d.ts +30 -27
  25. package/lib/components/ComboBox/ComboBox.js +22 -23
  26. package/lib/components/Copy/Copy.js +6 -1
  27. package/lib/components/CopyButton/CopyButton.js +6 -0
  28. package/lib/components/FileUploader/FileUploader.js +1 -1
  29. package/lib/components/Grid/index.d.ts +1 -0
  30. package/lib/components/Link/Link.d.ts +1 -1
  31. package/lib/components/Link/index.d.ts +2 -2
  32. package/lib/components/Popover/index.d.ts +9 -5
  33. package/lib/components/Popover/index.js +2 -3
  34. package/lib/components/UIShell/HeaderContainer.d.ts +1 -1
  35. package/lib/components/UIShell/HeaderMenuButton.d.ts +4 -2
  36. package/lib/components/UIShell/HeaderMenuItem.d.ts +1 -1
  37. package/lib/components/UIShell/HeaderName.d.ts +1 -1
  38. package/lib/components/UIShell/HeaderNavigation.d.ts +2 -5
  39. package/lib/components/UIShell/HeaderSideNavItems.d.ts +1 -1
  40. package/lib/components/UIShell/SideNav.d.ts +1 -1
  41. package/lib/components/UIShell/SkipToContent.d.ts +1 -1
  42. package/lib/components/UIShell/index.d.ts +8 -8
  43. package/lib/index.js +2 -0
  44. package/package.json +4 -5
@@ -27,6 +27,7 @@ const defaultMinCollapsedNumberOfRows = 3;
27
27
  const defaultMinExpandedNumberOfRows = 16;
28
28
  function CodeSnippet(_ref) {
29
29
  let {
30
+ align = 'bottom',
30
31
  className,
31
32
  type,
32
33
  children,
@@ -146,6 +147,7 @@ function CodeSnippet(_ref) {
146
147
  }, children));
147
148
  }
148
149
  return /*#__PURE__*/React__default.createElement(Copy, _extends({}, rest, {
150
+ align: align,
149
151
  onClick: handleCopyClick,
150
152
  "aria-label": deprecatedAriaLabel || ariaLabel,
151
153
  "aria-describedby": uid,
@@ -200,6 +202,7 @@ function CodeSnippet(_ref) {
200
202
  }), hasRightOverflow && type !== 'multi' && /*#__PURE__*/React__default.createElement("div", {
201
203
  className: `${prefix}--snippet__overflow-indicator--right`
202
204
  }), !hideCopyButton && /*#__PURE__*/React__default.createElement(CopyButton, {
205
+ align: align,
203
206
  size: type === 'multi' ? 'sm' : 'md',
204
207
  disabled: disabled,
205
208
  onClick: handleCopyClick,
@@ -221,6 +224,10 @@ function CodeSnippet(_ref) {
221
224
  })));
222
225
  }
223
226
  CodeSnippet.propTypes = {
227
+ /**
228
+ * Specify how the trigger should align with the tooltip
229
+ */
230
+ align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
224
231
  /**
225
232
  * Specify a label to be read by screen readers on the containing <textbox>
226
233
  * node
@@ -5,11 +5,14 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import Downshift from 'downshift';
8
- import { ReactNodeLike } from 'prop-types';
9
- import React from 'react';
8
+ import { type ComponentProps, type ReactNode, type ComponentType, type ReactElement, type RefAttributes, type PropsWithChildren, type PropsWithoutRef, type InputHTMLAttributes, type MouseEvent } from 'react';
10
9
  import { ListBoxType, ListBoxSize } from '../ListBox';
11
10
  type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
12
- export interface ComboBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
11
+ interface OnChangeData<ItemType> {
12
+ selectedItem: ItemType | null;
13
+ }
14
+ type ItemToStringHandler<ItemType> = (item: ItemType | null) => string;
15
+ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
13
16
  /**
14
17
  * Specify a label to be read by screen readers on the container node
15
18
  * 'aria-label' of the ListBox component.
@@ -35,12 +38,12 @@ export interface ComboBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
35
38
  /**
36
39
  * Additional props passed to Downshift
37
40
  */
38
- downshiftProps?: React.ComponentProps<typeof Downshift>;
41
+ downshiftProps?: ComponentProps<typeof Downshift<ItemType>>;
39
42
  /**
40
43
  * Provide helper text that is used alongside the control label for
41
44
  * additional help
42
45
  */
43
- helperText?: string;
46
+ helperText?: ReactNode;
44
47
  /**
45
48
  * Specify a custom `id` for the input
46
49
  */
@@ -49,7 +52,7 @@ export interface ComboBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
49
52
  * Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
50
53
  * from their collection that are pre-selected
51
54
  */
52
- initialSelectedItem?: object | string | number;
55
+ initialSelectedItem?: ItemType;
53
56
  /**
54
57
  * Specify if the currently selected value is invalid.
55
58
  */
@@ -57,23 +60,23 @@ export interface ComboBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
57
60
  /**
58
61
  * Message which is displayed if the value is invalid.
59
62
  */
60
- invalidText?: ReactNodeLike;
63
+ invalidText?: ReactNode;
61
64
  /**
62
65
  * Optional function to render items as custom components instead of strings.
63
66
  * Defaults to null and is overridden by a getter
64
67
  */
65
- itemToElement?: React.ComponentType | null;
68
+ itemToElement?: ComponentType<ItemType> | null;
66
69
  /**
67
70
  * Helper function passed to downshift that allows the library to render a
68
71
  * given item to a string label. By default, it extracts the `label` field
69
72
  * from a given item to serve as the item label in the list
70
73
  */
71
- itemToString?: (item: unknown) => string;
74
+ itemToString?: ItemToStringHandler<ItemType>;
72
75
  /**
73
76
  * We try to stay as generic as possible here to allow individuals to pass
74
77
  * in a collection of whatever kind of data structure they prefer
75
78
  */
76
- items: (object | string | number)[];
79
+ items: ItemType[];
77
80
  /**
78
81
  * @deprecated
79
82
  * should use "light theme" (white background)?
@@ -85,9 +88,7 @@ export interface ComboBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
85
88
  * `({ selectedItem }) => void`
86
89
  // * @param {{ selectedItem }}
87
90
  */
88
- onChange: (data: {
89
- selectedItem: any;
90
- }) => void;
91
+ onChange: (data: OnChangeData<ItemType>) => void;
91
92
  /**
92
93
  * Callback function to notify consumer when the text input changes.
93
94
  * This provides support to change available items based on the text.
@@ -95,18 +96,12 @@ export interface ComboBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
95
96
  * @param {string} inputText
96
97
  */
97
98
  onInputChange?: (inputText: string) => void;
98
- /**
99
- * Helper function passed to Downshift that allows the user to observe internal
100
- * state changes
101
- * `(changes, stateAndHelpers) => void`
102
- */
103
- onStateChange?: (changes: object, stateAndHelpers: object) => void;
104
99
  /**
105
100
  * Callback function that fires when the combobox menu toggle is clicked
106
101
  * `(evt) => void`
107
102
  * @param {MouseEvent} event
108
103
  */
109
- onToggleClick?: (evt: MouseEvent) => void;
104
+ onToggleClick?: (evt: MouseEvent<HTMLButtonElement>) => void;
110
105
  /**
111
106
  * Used to provide a placeholder text node before a user enters any input.
112
107
  * This is only present if the control has no items selected
@@ -119,13 +114,17 @@ export interface ComboBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
119
114
  /**
120
115
  * For full control of the selection
121
116
  */
122
- selectedItem?: object | string | number;
117
+ selectedItem?: ItemType | null;
123
118
  /**
124
119
  * Specify your own filtering logic by passing in a `shouldFilterItem`
125
120
  * function that takes in the current input and an item and passes back
126
121
  * whether or not the item should be filtered.
127
122
  */
128
- shouldFilterItem?: (input: any) => boolean;
123
+ shouldFilterItem?: (input: {
124
+ item: ItemType;
125
+ itemToString?: ItemToStringHandler<ItemType>;
126
+ inputValue: string | null;
127
+ }) => boolean;
129
128
  /**
130
129
  * Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
131
130
  */
@@ -134,12 +133,12 @@ export interface ComboBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
134
133
  * Provide text to be used in a `<label>` element that is tied to the
135
134
  * combobox via ARIA attributes.
136
135
  */
137
- titleText?: ReactNodeLike;
136
+ titleText?: ReactNode;
138
137
  /**
139
138
  * Specify a custom translation function that takes in a message identifier
140
139
  * and returns the localized string for the message
141
140
  */
142
- translateWithId?: (id: any) => string;
141
+ translateWithId?: (id: string) => string;
143
142
  /**
144
143
  * Currently supports either the default type, or an inline variant
145
144
  */
@@ -151,7 +150,11 @@ export interface ComboBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
151
150
  /**
152
151
  * Provide the text that is displayed when the control is in warning state
153
152
  */
154
- warnText?: ReactNodeLike;
153
+ warnText?: ReactNode;
154
+ }
155
+ type ComboboxComponentProps<ItemType> = PropsWithoutRef<PropsWithChildren<ComboBoxProps<ItemType>> & RefAttributes<HTMLInputElement>>;
156
+ interface ComboBoxComponent {
157
+ <ItemType>(props: ComboboxComponentProps<ItemType>): ReactElement | null;
155
158
  }
156
- declare const ComboBox: React.ForwardRefExoticComponent<ComboBoxProps & React.RefAttributes<unknown>>;
157
- export default ComboBox;
159
+ declare const _default: ComboBoxComponent;
160
+ export default _default;
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import cx from 'classnames';
10
10
  import Downshift from 'downshift';
11
11
  import PropTypes from 'prop-types';
12
- import React__default, { useContext, useRef, useState, useEffect } from 'react';
12
+ import React__default, { forwardRef, useContext, useRef, useState, useEffect } from 'react';
13
13
  import '../Text/index.js';
14
14
  import { WarningFilled, WarningAltFilled, Checkmark } from '@carbon/icons-react';
15
15
  import ListBox from '../ListBox/index.js';
@@ -38,7 +38,13 @@ const defaultItemToString = item => {
38
38
  if (typeof item === 'string') {
39
39
  return item;
40
40
  }
41
- return item && item.label;
41
+ if (typeof item === 'number') {
42
+ return `${item}`;
43
+ }
44
+ if (item !== null && typeof item === 'object' && 'label' in item && typeof item['label'] === 'string') {
45
+ return item['label'];
46
+ }
47
+ return '';
42
48
  };
43
49
  const defaultShouldFilterItem = () => true;
44
50
  const getInputValue = _ref => {
@@ -74,10 +80,10 @@ const findHighlightedIndex = (_ref2, inputValue) => {
74
80
  return -1;
75
81
  };
76
82
  const getInstanceId = setupGetInstanceId();
77
- const ComboBox = /*#__PURE__*/React__default.forwardRef((props, ref) => {
83
+ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
78
84
  var _Text;
79
85
  const {
80
- ['aria-label']: ariaLabel,
86
+ ['aria-label']: ariaLabel = 'Choose an item',
81
87
  ariaLabel: deprecatedAriaLabel,
82
88
  className: containerClassName,
83
89
  direction,
@@ -90,7 +96,7 @@ const ComboBox = /*#__PURE__*/React__default.forwardRef((props, ref) => {
90
96
  invalidText,
91
97
  items,
92
98
  itemToElement,
93
- itemToString,
99
+ itemToString = defaultItemToString,
94
100
  light,
95
101
  onChange,
96
102
  onInputChange,
@@ -98,14 +104,13 @@ const ComboBox = /*#__PURE__*/React__default.forwardRef((props, ref) => {
98
104
  placeholder,
99
105
  readOnly,
100
106
  selectedItem,
101
- shouldFilterItem,
107
+ shouldFilterItem = defaultShouldFilterItem,
102
108
  size,
103
109
  titleText,
104
110
  translateWithId,
105
111
  type: _type,
106
112
  warn,
107
113
  warnText,
108
- onStateChange: _onStateChange,
109
114
  ...rest
110
115
  } = props;
111
116
  const prefix = usePrefix();
@@ -168,7 +173,7 @@ const ComboBox = /*#__PURE__*/React__default.forwardRef((props, ref) => {
168
173
  const {
169
174
  inputValue
170
175
  } = changes;
171
- const filteredItems = filterItems(items, itemToString, inputValue);
176
+ const filteredItems = filterItems(items, itemToString, inputValue || null);
172
177
  const indexToHighlight = findHighlightedIndex({
173
178
  ...props,
174
179
  items: filteredItems
@@ -176,7 +181,7 @@ const ComboBox = /*#__PURE__*/React__default.forwardRef((props, ref) => {
176
181
  setHighlightedIndex(indexToHighlight);
177
182
  return indexToHighlight;
178
183
  }
179
- return highlightedIndex;
184
+ return highlightedIndex || 0;
180
185
  };
181
186
  const handleOnStateChange = (changes, _ref3) => {
182
187
  let {
@@ -351,7 +356,7 @@ const ComboBox = /*#__PURE__*/React__default.forwardRef((props, ref) => {
351
356
  disabled: disabled,
352
357
  className: inputClasses,
353
358
  type: "text",
354
- tabIndex: "0",
359
+ tabIndex: 0,
355
360
  "aria-autocomplete": "list",
356
361
  "aria-expanded": rootProps['aria-expanded'],
357
362
  "aria-haspopup": "listbox",
@@ -378,24 +383,24 @@ const ComboBox = /*#__PURE__*/React__default.forwardRef((props, ref) => {
378
383
  }))), /*#__PURE__*/React__default.createElement(ListBox.Menu, getMenuProps({
379
384
  'aria-label': deprecatedAriaLabel || ariaLabel
380
385
  }), isOpen ? filterItems(items, itemToString, inputValue).map((item, index) => {
386
+ const isObject = item !== null && typeof item === 'object';
387
+ const title = isObject && 'text' in item && itemToElement ? item.text?.toString() : itemToString(item);
388
+ const disabled = isObject && 'disabled' in item ? !!item.disabled : undefined;
381
389
  const itemProps = getItemProps({
382
390
  item,
383
391
  index,
384
392
  ['aria-current']: selectedItem === item ? 'true' : 'false',
385
393
  ['aria-selected']: highlightedIndex === index ? 'true' : 'false',
386
- disabled: item.disabled
394
+ disabled
387
395
  });
388
396
  return /*#__PURE__*/React__default.createElement(ListBox.MenuItem, _extends({
389
397
  key: itemProps.id,
390
398
  isActive: selectedItem === item,
391
399
  isHighlighted: highlightedIndex === index,
392
- title: itemToElement ? item.text : itemToString ? itemToString(item) : undefined
393
- }, itemProps), itemToElement ?
394
- /*#__PURE__*/
395
- // @ts-ignore
396
- React__default.createElement(ItemToElement, _extends({
400
+ title: title
401
+ }, itemProps), ItemToElement ? /*#__PURE__*/React__default.createElement(ItemToElement, _extends({
397
402
  key: itemProps.id
398
- }, item)) : itemToString ? itemToString(item) : defaultItemToString(item), selectedItem === item && /*#__PURE__*/React__default.createElement(Checkmark, {
403
+ }, item)) : itemToString(item), selectedItem === item && /*#__PURE__*/React__default.createElement(Checkmark, {
399
404
  className: `${prefix}--list-box__menu-item__selected-icon`
400
405
  }));
401
406
  }) : null)), helperText && !invalid && !warn && !isFluid && (_Text || (_Text = /*#__PURE__*/React__default.createElement(Text, {
@@ -439,7 +444,7 @@ ComboBox.propTypes = {
439
444
  * Provide helper text that is used alongside the control label for
440
445
  * additional help
441
446
  */
442
- helperText: PropTypes.string,
447
+ helperText: PropTypes.node,
443
448
  /**
444
449
  * Specify a custom `id` for the input
445
450
  */
@@ -491,12 +496,6 @@ ComboBox.propTypes = {
491
496
  * @param {string} inputText
492
497
  */
493
498
  onInputChange: PropTypes.func,
494
- /**
495
- * Helper function passed to Downshift that allows the user to observe internal
496
- * state changes
497
- * `(changes, stateAndHelpers) => void`
498
- */
499
- onStateChange: PropTypes.func,
500
499
  /**
501
500
  * Callback function that fires when the combobox menu toggle is clicked
502
501
  * `(evt) => void`
@@ -16,6 +16,7 @@ import { IconButton } from '../IconButton/index.js';
16
16
 
17
17
  function Copy(_ref) {
18
18
  let {
19
+ align = 'bottom',
19
20
  children,
20
21
  className,
21
22
  feedback,
@@ -49,7 +50,7 @@ function Copy(_ref) {
49
50
  const initialLabel = other['aria-label'] ?? '';
50
51
  return /*#__PURE__*/React__default.createElement(IconButton, _extends({
51
52
  closeOnActivation: false,
52
- align: "bottom",
53
+ align: align,
53
54
  className: classNames,
54
55
  label: animation ? feedback : initialLabel,
55
56
  onClick: composeEventHandlers([onClick, handleClick]),
@@ -59,6 +60,10 @@ function Copy(_ref) {
59
60
  }), children);
60
61
  }
61
62
  Copy.propTypes = {
63
+ /**
64
+ * Specify how the trigger should align with the tooltip
65
+ */
66
+ align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
62
67
  /**
63
68
  * Pass in content to be rendered in the underlying `<button>`
64
69
  */
@@ -16,6 +16,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
16
16
 
17
17
  function CopyButton(_ref) {
18
18
  let {
19
+ align = 'bottom',
19
20
  iconDescription,
20
21
  className,
21
22
  ...other
@@ -27,6 +28,7 @@ function CopyButton(_ref) {
27
28
  max: 'lg'
28
29
  }
29
30
  }, /*#__PURE__*/React__default.createElement(Copy, _extends({
31
+ align: align,
30
32
  className: cx(className, `${prefix}--copy-btn`),
31
33
  "aria-label": iconDescription
32
34
  }, other), /*#__PURE__*/React__default.createElement(Copy$1, {
@@ -34,6 +36,10 @@ function CopyButton(_ref) {
34
36
  })));
35
37
  }
36
38
  CopyButton.propTypes = {
39
+ /**
40
+ * Specify how the trigger should align with the tooltip
41
+ */
42
+ align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
37
43
  /**
38
44
  * Specify an optional className to be applied to the underlying `<button>`
39
45
  */
@@ -28,7 +28,7 @@ class FileUploader extends React__default.Component {
28
28
  evt.stopPropagation();
29
29
  const filenames = Array.prototype.map.call(evt.target.files, file => file.name);
30
30
  this.setState({
31
- filenames: this.props.multiple ? this.state.filenames.concat(filenames) : filenames
31
+ filenames: this.props.multiple ? [...new Set([...this.state.filenames, ...filenames])] : filenames
32
32
  });
33
33
  if (this.props.onChange) {
34
34
  this.props.onChange(evt);
@@ -9,3 +9,4 @@ export { Grid } from './Grid';
9
9
  export { default as Row } from './Row';
10
10
  export { default as Column } from './Column';
11
11
  export { ColumnHang } from './ColumnHang';
12
+ export { GridSettings } from './GridContext';
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { AnchorHTMLAttributes, AriaAttributes, ComponentType, HTMLAttributeAnchorTarget } from 'react';
8
- interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
8
+ export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
9
9
  /**
10
10
  * @description Indicates the element that represents the
11
11
  * current item within a container or set of related
@@ -4,6 +4,6 @@
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 Link from './Link';
7
+ import Link, { type LinkProps } from './Link';
8
8
  export default Link;
9
- export { Link };
9
+ export { Link, type LinkProps };
@@ -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 WeakValidationMap, type ElementType } from 'react';
7
+ import React, { type ForwardedRef, type WeakValidationMap, type ElementType } from 'react';
8
8
  import { type PolymorphicProps } from '../../types/common';
9
9
  export type PopoverAlignment = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'left-bottom' | 'left-top' | 'right' | 'right-bottom' | 'right-top';
10
10
  interface PopoverBaseProps {
@@ -52,10 +52,14 @@ interface PopoverBaseProps {
52
52
  open: boolean;
53
53
  }
54
54
  export type PopoverProps<E extends ElementType> = PolymorphicProps<E, PopoverBaseProps>;
55
- export declare const Popover: (<E extends React.ElementType<any> = "span">(props: PopoverProps<E>) => JSX.Element) & {
56
- displayName?: string | undefined;
57
- propTypes?: WeakValidationMap<PopoverProps<any>> | undefined;
58
- };
55
+ export interface PopoverComponent {
56
+ <E extends ElementType = 'span'>(props: PopoverProps<E> & {
57
+ forwardRef?: ForwardedRef<ElementType>;
58
+ }): JSX.Element | null;
59
+ displayName?: string;
60
+ propTypes?: WeakValidationMap<PopoverProps<any>>;
61
+ }
62
+ export declare const Popover: PopoverComponent;
59
63
  export type PopoverContentProps = React.HTMLAttributes<HTMLSpanElement>;
60
64
  export declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLSpanElement>>;
61
65
  export {};
@@ -19,7 +19,7 @@ const PopoverContext = /*#__PURE__*/React__default.createContext({
19
19
  current: null
20
20
  }
21
21
  });
22
- function PopoverRenderFunction(_ref, forwardRef) {
22
+ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFunction(_ref, forwardRef) {
23
23
  let {
24
24
  isTabTip,
25
25
  align = isTabTip ? 'bottom-left' : 'bottom',
@@ -179,8 +179,7 @@ function PopoverRenderFunction(_ref, forwardRef) {
179
179
  className: className,
180
180
  ref: ref
181
181
  }), isTabTip ? mappedChildren : children));
182
- }
183
- const Popover = /*#__PURE__*/React__default.forwardRef(PopoverRenderFunction);
182
+ });
184
183
 
185
184
  // Note: this displayName is temporarily set so that Storybook ArgTable
186
185
  // correctly displays the name of this component
@@ -10,7 +10,7 @@ interface HeaderContainerRenderProps {
10
10
  isSideNavExpanded: boolean;
11
11
  onClickSideNavExpand: () => void;
12
12
  }
13
- interface HeaderContainerProps {
13
+ export interface HeaderContainerProps {
14
14
  isSideNavExpanded?: boolean;
15
15
  render: React.ComponentType<HeaderContainerRenderProps>;
16
16
  }
@@ -7,7 +7,7 @@
7
7
  import { type ComponentProps } from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  type HeaderMenuButtonBaseProps = Omit<ComponentProps<'button'>, 'title' | 'type'>;
10
- interface HeaderMenuButtonProps extends HeaderMenuButtonBaseProps {
10
+ export interface HeaderMenuButtonProps extends HeaderMenuButtonBaseProps {
11
11
  'aria-label'?: string;
12
12
  'aria-labelledby'?: string;
13
13
  className?: string;
@@ -74,7 +74,9 @@ declare namespace HeaderMenuButton {
74
74
  fill(value: string, start?: number | undefined, end?: number | undefined): [key: string];
75
75
  copyWithin(target: number, start: number, end?: number | undefined): [key: string];
76
76
  entries(): IterableIterator<[number, string]>;
77
- keys(): IterableIterator<number>;
77
+ keys(): IterableIterator<number>; /**
78
+ * Specify whether the menu button is collapsible.
79
+ */
78
80
  values(): IterableIterator<string>;
79
81
  includes(searchElement: string, fromIndex?: number | undefined): boolean;
80
82
  flatMap<U_3, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U_3 | readonly U_3[], thisArg?: This | undefined): U_3[];
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { type ComponentProps, type ForwardedRef, type ReactNode, ElementType, WeakValidationMap } from 'react';
8
8
  import { LinkProps } from './Link';
9
- type HeaderMenuItemProps<E extends ElementType> = LinkProps<E> & {
9
+ export type HeaderMenuItemProps<E extends ElementType> = LinkProps<E> & {
10
10
  className?: string | undefined;
11
11
  isActive?: boolean | undefined;
12
12
  isCurrentPage?: boolean | undefined;
@@ -7,7 +7,7 @@
7
7
  import { type ElementType } from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import { type LinkProps } from './Link';
10
- type HeaderNameProps<E extends ElementType> = LinkProps<E> & {
10
+ export type HeaderNameProps<E extends ElementType> = LinkProps<E> & {
11
11
  prefix?: string | undefined;
12
12
  };
13
13
  declare function HeaderName<E extends ElementType = 'a'>({ children, className: customClassName, prefix, ...rest }: HeaderNameProps<E>): JSX.Element;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { type ComponentProps } from 'react';
8
8
  import PropTypes from 'prop-types';
9
- type HeaderNavigationProps = ComponentProps<'nav'>;
9
+ export type HeaderNavigationProps = ComponentProps<'nav'>;
10
10
  declare function HeaderNavigation({ 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, children, className: customClassName, ...rest }: HeaderNavigationProps): JSX.Element;
11
11
  declare namespace HeaderNavigation {
12
12
  var propTypes: {
@@ -61,10 +61,7 @@ declare namespace HeaderNavigation {
61
61
  includes(searchElement: string, fromIndex?: number | undefined): boolean;
62
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
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
- */
64
+ at(index: number): string | undefined;
68
65
  [Symbol.iterator](): IterableIterator<string>;
69
66
  [Symbol.unscopables](): {
70
67
  copyWithin: boolean;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { type ReactNode } from 'react';
8
8
  import PropTypes from 'prop-types';
9
- interface HeaderSideNavItemsProps {
9
+ export interface HeaderSideNavItemsProps {
10
10
  className?: string | undefined;
11
11
  children?: ReactNode;
12
12
  hasDivider?: boolean | undefined;
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { type ComponentProps, type FocusEvent, type KeyboardEvent, type MouseEventHandler } from 'react';
8
- interface SideNavProps extends ComponentProps<'nav'> {
8
+ export interface SideNavProps extends ComponentProps<'nav'> {
9
9
  expanded?: boolean | undefined;
10
10
  defaultExpanded?: boolean | undefined;
11
11
  isChildOfHeader?: boolean | undefined;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { ComponentProps } from 'react';
8
8
  import PropTypes from 'prop-types';
9
- type SkipToContentProps = Omit<ComponentProps<'a'>, 'children'> & {
9
+ export type SkipToContentProps = Omit<ComponentProps<'a'>, 'children'> & {
10
10
  children?: string | undefined;
11
11
  };
12
12
  declare function SkipToContent({ children, className: customClassName, href, tabIndex, ...rest }: SkipToContentProps): JSX.Element;
@@ -6,21 +6,21 @@
6
6
  */
7
7
  export { default as Content } from './Content';
8
8
  export { default as Header } from './Header';
9
- export { default as HeaderContainer } from './HeaderContainer';
9
+ export { default as HeaderContainer, type HeaderContainerProps, } from './HeaderContainer';
10
10
  export { default as HeaderGlobalAction } from './HeaderGlobalAction';
11
11
  export { default as HeaderGlobalBar } from './HeaderGlobalBar';
12
12
  export { default as HeaderMenu } from './HeaderMenu';
13
- export { default as HeaderMenuButton } from './HeaderMenuButton';
14
- export { default as HeaderMenuItem } from './HeaderMenuItem';
15
- export { default as HeaderName } from './HeaderName';
16
- export { default as HeaderNavigation } from './HeaderNavigation';
13
+ export { default as HeaderMenuButton, type HeaderMenuButtonProps, } from './HeaderMenuButton';
14
+ export { default as HeaderMenuItem, type HeaderMenuItemProps, } from './HeaderMenuItem';
15
+ export { default as HeaderName, type HeaderNameProps } from './HeaderName';
16
+ export { default as HeaderNavigation, type HeaderNavigationProps, } from './HeaderNavigation';
17
17
  export { default as HeaderPanel } from './HeaderPanel';
18
- export { default as HeaderSideNavItems } from './HeaderSideNavItems';
18
+ export { default as HeaderSideNavItems, type HeaderSideNavItemsProps, } from './HeaderSideNavItems';
19
19
  export { default as Switcher } from './Switcher';
20
20
  export { default as SwitcherItem } from './SwitcherItem';
21
21
  export { default as SwitcherDivider } from './SwitcherDivider';
22
- export { default as SkipToContent } from './SkipToContent';
23
- export { default as SideNav } from './SideNav';
22
+ export { default as SkipToContent, type SkipToContentProps, } from './SkipToContent';
23
+ export { default as SideNav, type SideNavProps } from './SideNav';
24
24
  export { default as SideNavDetails } from './SideNavDetails';
25
25
  export { default as SideNavDivider } from './SideNavDivider';
26
26
  export { default as SideNavFooter } from './SideNavFooter';
package/es/index.js CHANGED
@@ -50,6 +50,7 @@ export { Grid } from './components/Grid/Grid.js';
50
50
  export { default as Row } from './components/Grid/Row.js';
51
51
  export { default as Column } from './components/Grid/Column.js';
52
52
  export { ColumnHang } from './components/Grid/ColumnHang.js';
53
+ export { GridSettings } from './components/Grid/GridContext.js';
53
54
  export { default as IconSkeleton } from './components/Icon/Icon.Skeleton.js';
54
55
  export { IdPrefix } from './components/IdPrefix/index.js';
55
56
  export { default as Link } from './components/Link/Link.js';
@@ -39,6 +39,7 @@ const defaultMinCollapsedNumberOfRows = 3;
39
39
  const defaultMinExpandedNumberOfRows = 16;
40
40
  function CodeSnippet(_ref) {
41
41
  let {
42
+ align = 'bottom',
42
43
  className,
43
44
  type,
44
45
  children,
@@ -158,6 +159,7 @@ function CodeSnippet(_ref) {
158
159
  }, children));
159
160
  }
160
161
  return /*#__PURE__*/React__default["default"].createElement(Copy["default"], _rollupPluginBabelHelpers["extends"]({}, rest, {
162
+ align: align,
161
163
  onClick: handleCopyClick,
162
164
  "aria-label": deprecatedAriaLabel || ariaLabel,
163
165
  "aria-describedby": uid,
@@ -212,6 +214,7 @@ function CodeSnippet(_ref) {
212
214
  }), hasRightOverflow && type !== 'multi' && /*#__PURE__*/React__default["default"].createElement("div", {
213
215
  className: `${prefix}--snippet__overflow-indicator--right`
214
216
  }), !hideCopyButton && /*#__PURE__*/React__default["default"].createElement(CopyButton["default"], {
217
+ align: align,
215
218
  size: type === 'multi' ? 'sm' : 'md',
216
219
  disabled: disabled,
217
220
  onClick: handleCopyClick,
@@ -233,6 +236,10 @@ function CodeSnippet(_ref) {
233
236
  })));
234
237
  }
235
238
  CodeSnippet.propTypes = {
239
+ /**
240
+ * Specify how the trigger should align with the tooltip
241
+ */
242
+ align: PropTypes__default["default"].oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
236
243
  /**
237
244
  * Specify a label to be read by screen readers on the containing <textbox>
238
245
  * node