@carbon/react 1.74.0 → 1.75.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 (172) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +757 -757
  2. package/es/components/AILabel/index.d.ts +1 -2
  3. package/es/components/AILabel/index.js +1 -1
  4. package/es/components/AISkeleton/AISkeletonIcon.d.ts +1 -1
  5. package/es/components/AISkeleton/AISkeletonText.d.ts +1 -1
  6. package/es/components/Accordion/Accordion.Skeleton.d.ts +1 -1
  7. package/es/components/Accordion/AccordionItem.d.ts +2 -2
  8. package/es/components/AspectRatio/AspectRatio.d.ts +1 -1
  9. package/es/components/Button/Button.d.ts +3 -3
  10. package/es/components/Button/Button.js +1 -1
  11. package/es/components/ClassPrefix/index.d.ts +1 -1
  12. package/es/components/ComboBox/ComboBox.d.ts +4 -4
  13. package/es/components/ComboBox/ComboBox.js +0 -1
  14. package/es/components/ComboButton/index.d.ts +1 -1
  15. package/es/components/ComposedModal/ModalFooter.d.ts +1 -2
  16. package/es/components/ComposedModal/ModalFooter.js +2 -2
  17. package/es/components/ComposedModal/ModalHeader.d.ts +1 -2
  18. package/es/components/ContainedList/ContainedList.d.ts +1 -1
  19. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +2 -3
  20. package/es/components/ContextMenu/useContextMenu.d.ts +1 -1
  21. package/es/components/Copy/Copy.d.ts +1 -1
  22. package/es/components/DataTable/TableCell.d.ts +1 -1
  23. package/es/components/DataTable/TableExpandHeader.d.ts +3 -3
  24. package/es/components/DataTable/TableExpandRow.d.ts +1 -1
  25. package/es/components/DataTable/TableExpandedRow.d.ts +1 -1
  26. package/es/components/DataTable/TableHeader.d.ts +1 -1
  27. package/es/components/DataTable/TableSelectAll.d.ts +1 -1
  28. package/es/components/Dropdown/Dropdown.js +11 -3
  29. package/es/components/ErrorBoundary/ErrorBoundary.d.ts +2 -3
  30. package/es/components/FeatureFlags/index.d.ts +1 -1
  31. package/es/components/FileUploader/FileUploader.d.ts +8 -7
  32. package/es/components/FileUploader/FileUploader.js +9 -2
  33. package/es/components/Form/Form.d.ts +1 -1
  34. package/es/components/FormItem/FormItem.d.ts +1 -1
  35. package/es/components/Heading/index.d.ts +1 -1
  36. package/es/components/IconButton/index.d.ts +1 -1
  37. package/es/components/IdPrefix/index.d.ts +1 -1
  38. package/es/components/Layer/index.d.ts +1 -2
  39. package/es/components/LayoutDirection/LayoutDirection.d.ts +1 -1
  40. package/es/components/Link/Link.d.ts +5 -4
  41. package/es/components/Link/Link.js +1 -1
  42. package/es/components/ListItem/ListItem.d.ts +1 -1
  43. package/es/components/Menu/Menu.d.ts +1 -1
  44. package/es/components/Modal/Modal.js +1 -1
  45. package/es/components/ModalWrapper/ModalWrapper.d.ts +1 -1
  46. package/es/components/MultiSelect/FilterableMultiSelect.js +4 -1
  47. package/es/components/MultiSelect/MultiSelect.js +10 -1
  48. package/es/components/OrderedList/OrderedList.d.ts +1 -1
  49. package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
  50. package/es/components/PaginationNav/PaginationNav.d.ts +52 -1
  51. package/es/components/Popover/index.d.ts +6 -2
  52. package/es/components/Portal/index.d.ts +1 -1
  53. package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.d.ts +1 -1
  54. package/es/components/SkeletonIcon/SkeletonIcon.d.ts +1 -1
  55. package/es/components/SkeletonText/SkeletonText.d.ts +1 -1
  56. package/es/components/Tabs/Tabs.d.ts +2 -2
  57. package/es/components/Tabs/Tabs.js +1 -1
  58. package/es/components/Tag/DismissibleTag.js +1 -1
  59. package/es/components/Tag/OperationalTag.js +1 -1
  60. package/es/components/Tag/SelectableTag.d.ts +2 -2
  61. package/es/components/Tag/SelectableTag.js +1 -1
  62. package/es/components/Tag/Tag.d.ts +7 -3
  63. package/es/components/Tag/Tag.js +1 -1
  64. package/es/components/Text/Text.d.ts +6 -4
  65. package/es/components/Text/Text.js +1 -1
  66. package/es/components/Theme/index.d.ts +1 -1
  67. package/es/components/Toggle/Toggle.Skeleton.d.ts +1 -1
  68. package/es/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +1 -1
  69. package/es/components/Toggletip/index.d.ts +4 -4
  70. package/es/components/UIShell/Content.d.ts +1 -1
  71. package/es/components/UIShell/Header.d.ts +1 -1
  72. package/es/components/UIShell/HeaderGlobalAction.d.ts +1 -1
  73. package/es/components/UIShell/HeaderMenu.d.ts +1 -1
  74. package/es/components/UIShell/HeaderPanel.d.ts +1 -1
  75. package/es/components/UIShell/SideNavHeader.d.ts +1 -1
  76. package/es/components/UIShell/SideNavIcon.d.ts +1 -1
  77. package/es/components/UIShell/SideNavItem.d.ts +1 -1
  78. package/es/components/UIShell/SideNavItems.d.ts +1 -1
  79. package/es/components/UIShell/SideNavMenu.d.ts +1 -1
  80. package/es/components/UIShell/SideNavMenuItem.d.ts +1 -1
  81. package/es/components/UIShell/SideNavSwitcher.d.ts +1 -1
  82. package/es/components/UIShell/Switcher.d.ts +1 -1
  83. package/es/components/UIShell/SwitcherDivider.d.ts +1 -1
  84. package/es/components/UIShell/SwitcherItem.d.ts +4 -4
  85. package/es/index.d.ts +239 -0
  86. package/es/internal/PolymorphicProps.d.ts +11 -0
  87. package/lib/components/AILabel/index.d.ts +1 -2
  88. package/lib/components/AILabel/index.js +1 -1
  89. package/lib/components/AISkeleton/AISkeletonIcon.d.ts +1 -1
  90. package/lib/components/AISkeleton/AISkeletonText.d.ts +1 -1
  91. package/lib/components/Accordion/Accordion.Skeleton.d.ts +1 -1
  92. package/lib/components/Accordion/AccordionItem.d.ts +2 -2
  93. package/lib/components/AspectRatio/AspectRatio.d.ts +1 -1
  94. package/lib/components/Button/Button.d.ts +3 -3
  95. package/lib/components/Button/Button.js +1 -1
  96. package/lib/components/ClassPrefix/index.d.ts +1 -1
  97. package/lib/components/ComboBox/ComboBox.d.ts +4 -4
  98. package/lib/components/ComboBox/ComboBox.js +0 -1
  99. package/lib/components/ComboButton/index.d.ts +1 -1
  100. package/lib/components/ComposedModal/ModalFooter.d.ts +1 -2
  101. package/lib/components/ComposedModal/ModalFooter.js +2 -2
  102. package/lib/components/ComposedModal/ModalHeader.d.ts +1 -2
  103. package/lib/components/ContainedList/ContainedList.d.ts +1 -1
  104. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +2 -3
  105. package/lib/components/ContextMenu/useContextMenu.d.ts +1 -1
  106. package/lib/components/Copy/Copy.d.ts +1 -1
  107. package/lib/components/DataTable/TableCell.d.ts +1 -1
  108. package/lib/components/DataTable/TableExpandHeader.d.ts +3 -3
  109. package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
  110. package/lib/components/DataTable/TableExpandedRow.d.ts +1 -1
  111. package/lib/components/DataTable/TableHeader.d.ts +1 -1
  112. package/lib/components/DataTable/TableSelectAll.d.ts +1 -1
  113. package/lib/components/Dropdown/Dropdown.js +11 -3
  114. package/lib/components/ErrorBoundary/ErrorBoundary.d.ts +2 -3
  115. package/lib/components/FeatureFlags/index.d.ts +1 -1
  116. package/lib/components/FileUploader/FileUploader.d.ts +8 -7
  117. package/lib/components/FileUploader/FileUploader.js +9 -2
  118. package/lib/components/Form/Form.d.ts +1 -1
  119. package/lib/components/FormItem/FormItem.d.ts +1 -1
  120. package/lib/components/Heading/index.d.ts +1 -1
  121. package/lib/components/IconButton/index.d.ts +1 -1
  122. package/lib/components/IdPrefix/index.d.ts +1 -1
  123. package/lib/components/Layer/index.d.ts +1 -2
  124. package/lib/components/LayoutDirection/LayoutDirection.d.ts +1 -1
  125. package/lib/components/Link/Link.d.ts +5 -4
  126. package/lib/components/Link/Link.js +1 -1
  127. package/lib/components/ListItem/ListItem.d.ts +1 -1
  128. package/lib/components/Menu/Menu.d.ts +1 -1
  129. package/lib/components/Modal/Modal.js +1 -1
  130. package/lib/components/ModalWrapper/ModalWrapper.d.ts +1 -1
  131. package/lib/components/MultiSelect/FilterableMultiSelect.js +4 -1
  132. package/lib/components/MultiSelect/MultiSelect.js +10 -1
  133. package/lib/components/OrderedList/OrderedList.d.ts +1 -1
  134. package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
  135. package/lib/components/PaginationNav/PaginationNav.d.ts +52 -1
  136. package/lib/components/Popover/index.d.ts +6 -2
  137. package/lib/components/Portal/index.d.ts +1 -1
  138. package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.d.ts +1 -1
  139. package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +1 -1
  140. package/lib/components/SkeletonText/SkeletonText.d.ts +1 -1
  141. package/lib/components/Tabs/Tabs.d.ts +2 -2
  142. package/lib/components/Tabs/Tabs.js +1 -1
  143. package/lib/components/Tag/DismissibleTag.js +1 -1
  144. package/lib/components/Tag/OperationalTag.js +1 -1
  145. package/lib/components/Tag/SelectableTag.d.ts +2 -2
  146. package/lib/components/Tag/SelectableTag.js +1 -1
  147. package/lib/components/Tag/Tag.d.ts +7 -3
  148. package/lib/components/Tag/Tag.js +1 -1
  149. package/lib/components/Text/Text.d.ts +6 -4
  150. package/lib/components/Text/Text.js +1 -1
  151. package/lib/components/Theme/index.d.ts +1 -1
  152. package/lib/components/Toggle/Toggle.Skeleton.d.ts +1 -1
  153. package/lib/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +1 -1
  154. package/lib/components/Toggletip/index.d.ts +4 -4
  155. package/lib/components/UIShell/Content.d.ts +1 -1
  156. package/lib/components/UIShell/Header.d.ts +1 -1
  157. package/lib/components/UIShell/HeaderGlobalAction.d.ts +1 -1
  158. package/lib/components/UIShell/HeaderMenu.d.ts +1 -1
  159. package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
  160. package/lib/components/UIShell/SideNavHeader.d.ts +1 -1
  161. package/lib/components/UIShell/SideNavIcon.d.ts +1 -1
  162. package/lib/components/UIShell/SideNavItem.d.ts +1 -1
  163. package/lib/components/UIShell/SideNavItems.d.ts +1 -1
  164. package/lib/components/UIShell/SideNavMenu.d.ts +1 -1
  165. package/lib/components/UIShell/SideNavMenuItem.d.ts +1 -1
  166. package/lib/components/UIShell/SideNavSwitcher.d.ts +1 -1
  167. package/lib/components/UIShell/Switcher.d.ts +1 -1
  168. package/lib/components/UIShell/SwitcherDivider.d.ts +1 -1
  169. package/lib/components/UIShell/SwitcherItem.d.ts +4 -4
  170. package/lib/index.d.ts +239 -0
  171. package/lib/internal/PolymorphicProps.d.ts +11 -0
  172. package/package.json +5 -4
@@ -228,6 +228,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
228
228
  [`${prefix}--dropdown--invalid`]: invalid,
229
229
  [`${prefix}--dropdown--warning`]: showWarning,
230
230
  [`${prefix}--dropdown--open`]: isOpen,
231
+ [`${prefix}--dropdown--focus`]: isFocused,
231
232
  [`${prefix}--dropdown--inline`]: inline,
232
233
  [`${prefix}--dropdown--disabled`]: disabled,
233
234
  [`${prefix}--dropdown--light`]: light,
@@ -249,7 +250,6 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
249
250
  [`${prefix}--dropdown__wrapper--inline--invalid`]: inline && invalid,
250
251
  [`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
251
252
  [`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
252
- [`${prefix}--list-box__wrapper--fluid--focus`]: isFluid && isFocused && !isOpen,
253
253
  [`${prefix}--list-box__wrapper--slug`]: slug,
254
254
  [`${prefix}--list-box__wrapper--decorator`]: decorator
255
255
  });
@@ -265,7 +265,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
265
265
  className: helperClasses
266
266
  }, helperText) : null;
267
267
  const handleFocus = evt => {
268
- setIsFocused(evt.type === 'focus' ? true : false);
268
+ setIsFocused(evt.type === 'focus' && !selectedItem ? true : false);
269
269
  };
270
270
  const mergedRef = mergeRefs["default"](toggleButtonProps.ref, ref);
271
271
  const [currTimer, setCurrTimer] = React.useState();
@@ -282,7 +282,15 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
282
282
  setIsTyping(false);
283
283
  }, 3000));
284
284
  }
285
- if (toggleButtonProps.onKeyDown) {
285
+ if (['ArrowDown'].includes(evt.key)) {
286
+ setIsFocused(false);
287
+ }
288
+ if (['Enter'].includes(evt.key) && !selectedItem && !isOpen) {
289
+ setIsFocused(true);
290
+ }
291
+
292
+ // For Dropdowns the arrow up key is only allowed if the Dropdown is open
293
+ if (toggleButtonProps.onKeyDown && (evt.key !== 'ArrowUp' || isOpen && evt.key === 'ArrowUp')) {
286
294
  toggleButtonProps.onKeyDown(evt);
287
295
  }
288
296
  }, [isTyping, currTimer, toggleButtonProps]);
@@ -24,11 +24,11 @@ import { ErrorBoundaryContext } from './ErrorBoundaryContext';
24
24
  * Reference:
25
25
  * https://reactjs.org/docs/error-boundaries.html#introducing-error-boundaries
26
26
  */
27
- interface ErrorBoundaryProps {
27
+ export interface ErrorBoundaryProps {
28
28
  children?: ReactNode;
29
29
  fallback?: ReactNode;
30
30
  }
31
- interface ErrorBoundaryState {
31
+ export interface ErrorBoundaryState {
32
32
  hasError: boolean;
33
33
  }
34
34
  export default class ErrorBoundary extends React.Component<ErrorBoundaryProps> {
@@ -44,4 +44,3 @@ export default class ErrorBoundary extends React.Component<ErrorBoundaryProps> {
44
44
  componentDidUpdate(prevProps: ErrorBoundaryProps): void;
45
45
  render(): React.ReactNode;
46
46
  }
47
- export {};
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import React, { ReactNode } from 'react';
9
- interface FeatureFlagsProps {
9
+ export interface FeatureFlagsProps {
10
10
  children?: ReactNode;
11
11
  flags?: Record<string, boolean>;
12
12
  enableV12TileDefaultIcons?: boolean;
@@ -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 { ReactElement } from 'react';
7
+ import React from 'react';
8
8
  import { ReactAttr } from '../../types/common';
9
9
  export interface FileUploaderProps extends ReactAttr<HTMLSpanElement> {
10
10
  /**
@@ -73,10 +73,11 @@ export interface FileUploaderProps extends ReactAttr<HTMLSpanElement> {
73
73
  */
74
74
  size?: 'sm' | 'small' | 'md' | 'field' | 'lg';
75
75
  }
76
- declare const FileUploader: {
77
- <ItemType>(props: FileUploaderProps): ReactElement;
78
- propTypes?: any;
79
- contextTypes?: any;
80
- defaultProps?: any;
81
- };
76
+ export interface FileUploaderHandle {
77
+ /**
78
+ * Clear internal state
79
+ */
80
+ clearFiles: () => void;
81
+ }
82
+ declare const FileUploader: React.ForwardRefExoticComponent<FileUploaderProps & React.RefAttributes<FileUploaderHandle>>;
82
83
  export default FileUploader;
@@ -15,7 +15,7 @@ var PropTypes = require('prop-types');
15
15
  var React = require('react');
16
16
  var Filename = require('./Filename.js');
17
17
  var FileUploaderButton = require('./FileUploaderButton.js');
18
- var types = require('../../prop-types/types.js');
18
+ var Button = require('../Button/Button.js');
19
19
  var usePrefix = require('../../internal/usePrefix.js');
20
20
  require('../Text/index.js');
21
21
  var useId = require('../../internal/useId.js');
@@ -82,6 +82,13 @@ const FileUploader = /*#__PURE__*/React__default["default"].forwardRef((_ref, re
82
82
  onClick?.(evt);
83
83
  }
84
84
  };
85
+ React.useImperativeHandle(ref, () => ({
86
+ clearFiles() {
87
+ updateState({
88
+ fileNames: []
89
+ });
90
+ }
91
+ }));
85
92
  const uploaderButton = /*#__PURE__*/React__default["default"].createRef();
86
93
  const classes = cx__default["default"]({
87
94
  [`${prefix}--form-item`]: true,
@@ -153,7 +160,7 @@ FileUploader.propTypes = {
153
160
  /**
154
161
  * Specify the type of the `<FileUploaderButton>`
155
162
  */
156
- buttonKind: PropTypes__default["default"].oneOf(types.ButtonKinds),
163
+ buttonKind: PropTypes__default["default"].oneOf(Button.ButtonKinds),
157
164
  /**
158
165
  * Provide the label text to be read by screen readers when interacting with
159
166
  * the `<FileUploaderButton>`
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import { type ComponentProps } from 'react';
9
- type FormProps = ComponentProps<'form'>;
9
+ export type FormProps = ComponentProps<'form'>;
10
10
  declare function Form({ className, children, ...other }: FormProps): import("react/jsx-runtime").JSX.Element;
11
11
  declare namespace Form {
12
12
  var propTypes: {
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import React from 'react';
9
- type FormItemProps = {
9
+ export type FormItemProps = {
10
10
  /**
11
11
  * Provide content to be rendered in the form item
12
12
  */
@@ -10,7 +10,7 @@ type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
10
10
  type SectionBaseProps = {
11
11
  level?: HeadingLevel;
12
12
  };
13
- type SectionProps<E extends ElementType> = PolymorphicProps<E, SectionBaseProps>;
13
+ export type SectionProps<E extends ElementType> = PolymorphicProps<E, SectionBaseProps>;
14
14
  export declare const Section: React.ForwardRefExoticComponent<Omit<SectionProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
15
15
  export declare const Heading: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
16
16
  export {};
@@ -11,7 +11,7 @@ export type IconButtonKind = (typeof IconButtonKinds)[number];
11
11
  export type DeprecatedIconButtonAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
12
12
  export type NewIconButtonAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
13
13
  export type IconButtonAlignment = DeprecatedIconButtonAlignment | NewIconButtonAlignment;
14
- interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
14
+ export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
15
15
  /**
16
16
  * Specify how the trigger should align with the tooltip
17
17
  */
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import { PropsWithChildren, ReactNode } from 'react';
9
- type IdPrefixProps = {
9
+ export type IdPrefixProps = {
10
10
  children?: ReactNode;
11
11
  /**
12
12
  * The value used to prefix the auto-generated id placed on some DOM elements
@@ -15,7 +15,7 @@ import { PolymorphicProps } from '../../types/common';
15
15
  export declare function useLayer(): {
16
16
  level: 0 | 1 | 2;
17
17
  };
18
- interface LayerBaseProps {
18
+ export interface LayerBaseProps {
19
19
  /**
20
20
  * Provide child elements to be rendered inside of `Theme`
21
21
  */
@@ -35,4 +35,3 @@ export interface LayerComponent {
35
35
  <T extends React.ElementType>(props: LayerProps<T>, context?: any): React.ReactElement<any, any> | null;
36
36
  }
37
37
  export declare const Layer: LayerComponent;
38
- export {};
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
8
8
  import { ElementType, ReactNode } from 'react';
9
9
  import { LayoutDirectionContext } from './LayoutDirectionContext';
10
10
  type Direction = 'ltr' | 'rtl';
11
- interface LayoutDirectionProps {
11
+ export interface LayoutDirectionProps {
12
12
  /**
13
13
  * Customize the element type used to render the outermost node
14
14
  */
@@ -4,8 +4,8 @@
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, { AnchorHTMLAttributes, AriaAttributes, ComponentType, ElementType, HTMLAttributeAnchorTarget } from 'react';
8
- import { PolymorphicProps } from '../../types/common';
7
+ import React, { AnchorHTMLAttributes, AriaAttributes, ComponentType, HTMLAttributeAnchorTarget } from 'react';
8
+ import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
9
9
  export interface LinkBaseProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
10
10
  /**
11
11
  * @description Indicates the element that represents the
@@ -48,6 +48,7 @@ export interface LinkBaseProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
48
48
  */
49
49
  visited?: boolean;
50
50
  }
51
- export type LinkProps<E extends ElementType> = PolymorphicProps<E, LinkBaseProps>;
52
- declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
51
+ export type LinkProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, LinkBaseProps>;
52
+ type LinkComponent = <T extends React.ElementType = 'a'>(props: LinkProps<T>) => React.ReactElement | any;
53
+ declare const Link: LinkComponent;
53
54
  export default Link;
@@ -21,7 +21,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
21
21
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
22
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
 
24
- const Link = /*#__PURE__*/React__default["default"].forwardRef(function Link(_ref, ref) {
24
+ const Link = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
25
25
  let {
26
26
  as: BaseComponent,
27
27
  children,
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import { type ComponentProps } from 'react';
9
- type ListItemProps = ComponentProps<'li'>;
9
+ export type ListItemProps = Omit<ComponentProps<'li'>, 'ref'>;
10
10
  declare function ListItem({ className, children, ...other }: ListItemProps): import("react/jsx-runtime").JSX.Element;
11
11
  declare namespace ListItem {
12
12
  var propTypes: {
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { ReactNode, RefObject } from 'react';
8
- interface MenuProps extends React.HTMLAttributes<HTMLUListElement> {
8
+ export interface MenuProps extends React.HTMLAttributes<HTMLUListElement> {
9
9
  /**
10
10
  * The ref of the containing element, used for positioning and alignment of the menu
11
11
  */
@@ -81,7 +81,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
81
81
  } = _ref;
82
82
  const prefix = usePrefix.usePrefix();
83
83
  const button = React.useRef(null);
84
- const secondaryButton = React.useRef();
84
+ const secondaryButton = React.useRef(null);
85
85
  const contentRef = React.useRef(null);
86
86
  const innerModal = React.useRef(null);
87
87
  const startTrap = React.useRef(null);
@@ -7,7 +7,7 @@
7
7
  import PropTypes from 'prop-types';
8
8
  import React, { ReactNode } from 'react';
9
9
  import { ButtonKinds } from '../Button';
10
- interface ModalWrapperProps {
10
+ export interface ModalWrapperProps {
11
11
  buttonTriggerClassName?: string;
12
12
  buttonTriggerText?: ReactNode;
13
13
  children?: ReactNode;
@@ -209,7 +209,6 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
209
209
  [`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
210
210
  [`${prefix}--list-box--up`]: direction === 'top',
211
211
  [`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
212
- [`${prefix}--list-box__wrapper--fluid--focus`]: isFluid && isFocused,
213
212
  [`${prefix}--list-box__wrapper--slug`]: slug,
214
213
  [`${prefix}--list-box__wrapper--decorator`]: decorator,
215
214
  [`${prefix}--autoalign`]: autoAlign
@@ -356,6 +355,10 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
356
355
  case InputKeyDownArrowDown:
357
356
  if (InputKeyDownArrowDown === type && !isOpen) {
358
357
  setIsOpen(true);
358
+ return {
359
+ ...changes,
360
+ highlightedIndex: 0
361
+ };
359
362
  }
360
363
  if (highlightedIndex > -1) {
361
364
  const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
@@ -242,6 +242,16 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
242
242
  setItemsCleared(false);
243
243
  setIsOpenWrapper(true);
244
244
  }
245
+ if (match.match(e, keys.ArrowDown) && selectedItems.length === 0) {
246
+ setInputFocused(false);
247
+ setIsFocused(false);
248
+ }
249
+ if (match.match(e, keys.Escape) && isOpen) {
250
+ setInputFocused(true);
251
+ }
252
+ if (match.match(e, keys.Enter) && isOpen) {
253
+ setInputFocused(true);
254
+ }
245
255
  }
246
256
  }
247
257
  });
@@ -273,7 +283,6 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
273
283
  [`${prefix}--multi-select__wrapper--inline--invalid`]: inline && invalid,
274
284
  [`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
275
285
  [`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
276
- [`${prefix}--list-box__wrapper--fluid--focus`]: !isOpen && isFluid && isFocused,
277
286
  [`${prefix}--list-box__wrapper--slug`]: slug,
278
287
  [`${prefix}--list-box__wrapper--decorator`]: decorator
279
288
  });
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import { type ComponentProps } from 'react';
9
- interface OrderedListProps extends ComponentProps<'ol'> {
9
+ export interface OrderedListProps extends ComponentProps<'ol'> {
10
10
  nested?: boolean | undefined;
11
11
  native?: boolean | undefined;
12
12
  isExpressive?: boolean | undefined;
@@ -118,7 +118,7 @@ export interface OverflowMenuProps {
118
118
  */
119
119
  innerRef?: React.Ref<any>;
120
120
  }
121
- interface OverflowMenuState {
121
+ export interface OverflowMenuState {
122
122
  open: boolean;
123
123
  prevOpen?: boolean;
124
124
  hasMountedTrigger: boolean;
@@ -17,7 +17,58 @@ declare const translationIds: {
17
17
  * Message ids that will be passed to translateWithId().
18
18
  */
19
19
  type TranslationKey = keyof typeof translationIds;
20
- interface PaginationNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'>, TranslateWithId<TranslationKey> {
20
+ export interface DirectionButtonProps {
21
+ /**
22
+ * The direction this button represents ("forward" or "backward").
23
+ */
24
+ direction?: 'forward' | 'backward';
25
+ /**
26
+ * Whether or not the button should be disabled.
27
+ */
28
+ disabled?: boolean;
29
+ /**
30
+ * The label shown in the button's tooltip.
31
+ */
32
+ label?: string;
33
+ /**
34
+ * The callback function called when the button is clicked.
35
+ */
36
+ onClick?: React.MouseEventHandler;
37
+ }
38
+ export interface PaginationItemProps extends TranslateWithId<'carbon.pagination-nav.item' | 'carbon.pagination-nav.active'> {
39
+ /**
40
+ * Whether or not this is the currently active page.
41
+ */
42
+ isActive?: boolean;
43
+ /**
44
+ * The callback function called when the item is clicked.
45
+ */
46
+ onClick?: React.MouseEventHandler;
47
+ /**
48
+ * The page number this item represents.
49
+ */
50
+ page?: number;
51
+ }
52
+ export interface PaginationOverflowProps extends TranslateWithId<'carbon.pagination-nav.item' | 'carbon.pagination-nav.active'> {
53
+ /**
54
+ * How many items to display in this overflow.
55
+ */
56
+ count?: number;
57
+ /**
58
+ * From which index on this overflow should start displaying pages.
59
+ */
60
+ fromIndex?: number;
61
+ /**
62
+ * The callback function called when the user selects a page from the overflow.
63
+ */
64
+ onSelect?: (id: number) => void;
65
+ /**
66
+ * If true, the '...' pagination overflow will not render page links between the first and last rendered buttons.
67
+ * Set this to true if you are having performance problems with large data sets.
68
+ */
69
+ disableOverflow?: boolean;
70
+ }
71
+ export interface PaginationNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'>, TranslateWithId<TranslationKey> {
21
72
  /**
22
73
  * Additional CSS class names.
23
74
  */
@@ -7,6 +7,11 @@
7
7
  import React, { type ForwardedRef, type WeakValidationMap, type ElementType } from 'react';
8
8
  import { type PolymorphicProps } from '../../types/common';
9
9
  import { type Boundary } from '@floating-ui/react';
10
+ export interface PopoverContext {
11
+ setFloating: React.Ref<HTMLSpanElement>;
12
+ caretRef: React.Ref<HTMLSpanElement>;
13
+ autoAlign: boolean | null;
14
+ }
10
15
  /**
11
16
  * Deprecated popover alignment values.
12
17
  * @deprecated Use NewPopoverAlignment instead.
@@ -14,7 +19,7 @@ import { type Boundary } from '@floating-ui/react';
14
19
  export type DeprecatedPopoverAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
15
20
  export type NewPopoverAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
16
21
  export type PopoverAlignment = DeprecatedPopoverAlignment | NewPopoverAlignment;
17
- interface PopoverBaseProps {
22
+ export interface PopoverBaseProps {
18
23
  /**
19
24
  * Specify how the popover should align with the trigger element.
20
25
  */
@@ -73,4 +78,3 @@ export interface PopoverComponent {
73
78
  export declare const Popover: PopoverComponent;
74
79
  export type PopoverContentProps = React.HTMLAttributes<HTMLSpanElement>;
75
80
  export declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLSpanElement>>;
76
- export {};
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { ReactNode } from 'react';
8
- interface PortalProps {
8
+ export interface PortalProps {
9
9
  /**
10
10
  * Specify the children elements to be rendered inside of the <Portal>
11
11
  */
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- interface ProgressIndicatorSkeletonProps {
8
+ export interface ProgressIndicatorSkeletonProps {
9
9
  /**
10
10
  * Specify an optional className to add.
11
11
  */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- interface SkeletonIconProps {
2
+ export interface SkeletonIconProps {
3
3
  /**
4
4
  * Specify an optional className to add.
5
5
  */
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- interface SkeletonTextProps {
8
+ export interface SkeletonTextProps {
9
9
  /**
10
10
  * Specify an optional className to be applied to the container node.
11
11
  */
@@ -147,7 +147,7 @@ export interface TabListProps extends DivAttributes {
147
147
  * Provide an accessible label to be read when a user interacts with this
148
148
  * component
149
149
  */
150
- 'aria-label': string;
150
+ 'aria-label'?: string;
151
151
  /**
152
152
  * Provide child elements to be rendered inside `ContentTabs`.
153
153
  * These elements should render a `ContentTab`
@@ -205,7 +205,7 @@ declare namespace TabList {
205
205
  * Provide an accessible label to be read when a user interacts with this
206
206
  * component
207
207
  */
208
- 'aria-label': PropTypes.Validator<string>;
208
+ 'aria-label': PropTypes.Requireable<string>;
209
209
  /**
210
210
  * Provide child elements to be rendered inside `ContentTabs`.
211
211
  * These elements should render a `ContentTab`
@@ -531,7 +531,7 @@ TabList.propTypes = {
531
531
  * Provide an accessible label to be read when a user interacts with this
532
532
  * component
533
533
  */
534
- 'aria-label': PropTypes__default["default"].string.isRequired,
534
+ 'aria-label': PropTypes__default["default"].string,
535
535
  /**
536
536
  * Provide child elements to be rendered inside `ContentTabs`.
537
537
  * These elements should render a `ContentTab`
@@ -48,7 +48,7 @@ const DismissibleTag = _ref => {
48
48
  ...other
49
49
  } = _ref;
50
50
  const prefix = usePrefix.usePrefix();
51
- const tagLabelRef = React.useRef();
51
+ const tagLabelRef = React.useRef(null);
52
52
  const tagId = id || `tag-${useId.useId()}`;
53
53
  const tagClasses = cx__default["default"](`${prefix}--tag--filter`, className);
54
54
  const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
@@ -52,7 +52,7 @@ const OperationalTag = _ref => {
52
52
  ...other
53
53
  } = _ref;
54
54
  const prefix = usePrefix.usePrefix();
55
- const tagRef = React.useRef();
55
+ const tagRef = React.useRef(null);
56
56
  const tagId = id || `tag-${useId.useId()}`;
57
57
  const tagClasses = cx__default["default"](`${prefix}--tag--operational`, className);
58
58
  const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- import React from 'react';
8
+ import React, { MouseEvent } from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
10
  import { SIZES } from './Tag';
11
11
  export interface SelectableTagBaseProps {
@@ -33,7 +33,7 @@ export interface SelectableTagBaseProps {
33
33
  /**
34
34
  * Provide an optional function to be called when the tag is clicked.
35
35
  */
36
- onClick?: (e: Event) => void;
36
+ onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
37
37
  /**
38
38
  * Specify the state of the selectable tag.
39
39
  */
@@ -42,7 +42,7 @@ const SelectableTag = _ref => {
42
42
  ...other
43
43
  } = _ref;
44
44
  const prefix = usePrefix.usePrefix();
45
- const tagRef = React.useRef();
45
+ const tagRef = React.useRef(null);
46
46
  const tagId = id || `tag-${useId.useId()}`;
47
47
  const [selectedTag, setSelectedTag] = React.useState(selected);
48
48
  const tagClasses = cx__default["default"](`${prefix}--tag--selectable`, className, {
@@ -5,7 +5,10 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { ReactNode } from 'react';
8
- import { PolymorphicProps } from '../../types/common';
8
+ import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
9
+ import { SelectableTagBaseProps } from './SelectableTag';
10
+ import { OperationalTagBaseProps } from './OperationalTag';
11
+ import { DismissibleTagBaseProps } from './DismissibleTag';
9
12
  export declare const TYPES: {
10
13
  red: string;
11
14
  magenta: string;
@@ -78,7 +81,8 @@ export interface TagBaseProps {
78
81
  */
79
82
  type?: keyof typeof TYPES;
80
83
  }
81
- export type TagProps<T extends React.ElementType> = PolymorphicProps<T, TagBaseProps>;
82
- declare const Tag: React.ForwardRefExoticComponent<Omit<TagProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLElement | undefined>>;
84
+ export type TagProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, TagBaseProps>;
85
+ type TagComponent = <T extends React.ElementType = 'div'>(props: TagProps<T> | OperationalTagBaseProps | SelectableTagBaseProps | DismissibleTagBaseProps) => React.ReactElement | any;
86
+ declare const Tag: TagComponent;
83
87
  export declare const types: string[];
84
88
  export default Tag;
@@ -50,7 +50,7 @@ const SIZES = {
50
50
  md: 'md',
51
51
  lg: 'lg'
52
52
  };
53
- const Tag = /*#__PURE__*/React__default["default"].forwardRef(function Tag(_ref, forwardRef) {
53
+ const Tag = /*#__PURE__*/React__default["default"].forwardRef((_ref, forwardRef) => {
54
54
  let {
55
55
  children,
56
56
  className,
@@ -4,12 +4,14 @@
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 from 'react';
8
- import { PolymorphicProps } from '../../types/common';
7
+ import React, { ReactNode } from 'react';
9
8
  import { TextDir } from './TextDirection';
9
+ import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
10
10
  export interface TextBaseProps {
11
11
  dir?: TextDir | undefined;
12
+ children?: ReactNode;
12
13
  }
13
- export type TextProps<T extends React.ElementType> = PolymorphicProps<T, TextBaseProps>;
14
- declare const Text: React.ForwardRefExoticComponent<Omit<TextProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLElement>>;
14
+ export type TextProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, TextBaseProps>;
15
+ type TextComponent = <T extends React.ElementType = 'span'>(props: TextProps<T>) => React.ReactElement | any;
16
+ declare const Text: TextComponent;
15
17
  export { Text };
@@ -19,7 +19,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
19
19
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
20
20
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
21
 
22
- const Text = /*#__PURE__*/React__default["default"].forwardRef(function Text(_ref, ref) {
22
+ const Text = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
23
23
  let {
24
24
  as,
25
25
  children,
@@ -7,7 +7,7 @@
7
7
  import PropTypes from 'prop-types';
8
8
  import React, { ElementType } from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
- interface GlobalThemeProps {
10
+ export interface GlobalThemeProps {
11
11
  theme?: 'white' | 'g10' | 'g90' | 'g100';
12
12
  children?: React.ReactNode;
13
13
  }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
- interface ToggleSkeletonProps {
8
+ export interface ToggleSkeletonProps {
9
9
  'aria-label'?: string;
10
10
  className?: string;
11
11
  }