@carbon/react 1.74.0 → 1.75.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 +794 -794
  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 +14 -13
@@ -197,7 +197,6 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
197
197
  [`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
198
198
  [`${prefix}--list-box--up`]: direction === 'top',
199
199
  [`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
200
- [`${prefix}--list-box__wrapper--fluid--focus`]: isFluid && isFocused,
201
200
  [`${prefix}--list-box__wrapper--slug`]: slug,
202
201
  [`${prefix}--list-box__wrapper--decorator`]: decorator,
203
202
  [`${prefix}--autoalign`]: autoAlign
@@ -344,6 +343,10 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
344
343
  case InputKeyDownArrowDown:
345
344
  if (InputKeyDownArrowDown === type && !isOpen) {
346
345
  setIsOpen(true);
346
+ return {
347
+ ...changes,
348
+ highlightedIndex: 0
349
+ };
347
350
  }
348
351
  if (highlightedIndex > -1) {
349
352
  const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
@@ -231,6 +231,16 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
231
231
  setItemsCleared(false);
232
232
  setIsOpenWrapper(true);
233
233
  }
234
+ if (match(e, ArrowDown) && selectedItems.length === 0) {
235
+ setInputFocused(false);
236
+ setIsFocused(false);
237
+ }
238
+ if (match(e, Escape) && isOpen) {
239
+ setInputFocused(true);
240
+ }
241
+ if (match(e, Enter) && isOpen) {
242
+ setInputFocused(true);
243
+ }
234
244
  }
235
245
  }
236
246
  });
@@ -262,7 +272,6 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
262
272
  [`${prefix}--multi-select__wrapper--inline--invalid`]: inline && invalid,
263
273
  [`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
264
274
  [`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
265
- [`${prefix}--list-box__wrapper--fluid--focus`]: !isOpen && isFluid && isFocused,
266
275
  [`${prefix}--list-box__wrapper--slug`]: slug,
267
276
  [`${prefix}--list-box__wrapper--decorator`]: decorator
268
277
  });
@@ -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`
@@ -521,7 +521,7 @@ TabList.propTypes = {
521
521
  * Provide an accessible label to be read when a user interacts with this
522
522
  * component
523
523
  */
524
- 'aria-label': PropTypes.string.isRequired,
524
+ 'aria-label': PropTypes.string,
525
525
  /**
526
526
  * Provide child elements to be rendered inside `ContentTabs`.
527
527
  * These elements should render a `ContentTab`
@@ -38,7 +38,7 @@ const DismissibleTag = _ref => {
38
38
  ...other
39
39
  } = _ref;
40
40
  const prefix = usePrefix();
41
- const tagLabelRef = useRef();
41
+ const tagLabelRef = useRef(null);
42
42
  const tagId = id || `tag-${useId()}`;
43
43
  const tagClasses = cx(`${prefix}--tag--filter`, className);
44
44
  const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
@@ -42,7 +42,7 @@ const OperationalTag = _ref => {
42
42
  ...other
43
43
  } = _ref;
44
44
  const prefix = usePrefix();
45
- const tagRef = useRef();
45
+ const tagRef = useRef(null);
46
46
  const tagId = id || `tag-${useId()}`;
47
47
  const tagClasses = cx(`${prefix}--tag--operational`, className);
48
48
  const [isEllipsisApplied, setIsEllipsisApplied] = 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
  */
@@ -32,7 +32,7 @@ const SelectableTag = _ref => {
32
32
  ...other
33
33
  } = _ref;
34
34
  const prefix = usePrefix();
35
- const tagRef = useRef();
35
+ const tagRef = useRef(null);
36
36
  const tagId = id || `tag-${useId()}`;
37
37
  const [selectedTag, setSelectedTag] = useState(selected);
38
38
  const tagClasses = cx(`${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;
@@ -40,7 +40,7 @@ const SIZES = {
40
40
  md: 'md',
41
41
  lg: 'lg'
42
42
  };
43
- const Tag = /*#__PURE__*/React__default.forwardRef(function Tag(_ref, forwardRef) {
43
+ const Tag = /*#__PURE__*/React__default.forwardRef((_ref, forwardRef) => {
44
44
  let {
45
45
  children,
46
46
  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 };
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
10
10
  import React__default, { useContext } from 'react';
11
11
  import { TextDirectionContext } from './TextDirectionContext.js';
12
12
 
13
- const Text = /*#__PURE__*/React__default.forwardRef(function Text(_ref, ref) {
13
+ const Text = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
14
14
  let {
15
15
  as,
16
16
  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
  }
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import React from 'react';
9
- interface ToggleSmallSkeletonProps {
9
+ export interface ToggleSmallSkeletonProps {
10
10
  ['aria-label']: string;
11
11
  /**
12
12
  * Specify an optional className to add to the form item wrapper.
@@ -35,7 +35,7 @@ export declare namespace ToggletipLabel {
35
35
  className: PropTypes.Requireable<string>;
36
36
  };
37
37
  }
38
- interface ToggletipProps<E extends ElementType> {
38
+ export interface ToggletipProps<E extends ElementType> {
39
39
  align?: PopoverAlignment;
40
40
  alignmentAxisOffset?: number;
41
41
  as?: E;
@@ -84,7 +84,7 @@ export declare namespace Toggletip {
84
84
  defaultOpen: PropTypes.Requireable<boolean>;
85
85
  };
86
86
  }
87
- interface ToggletipButtonBaseProps {
87
+ export interface ToggletipButtonBaseProps {
88
88
  children?: ReactNode;
89
89
  className?: string;
90
90
  label?: string;
@@ -95,7 +95,7 @@ export type ToggleTipButtonProps<T extends React.ElementType> = PolymorphicProps
95
95
  * clicks and keyboard interactions.
96
96
  */
97
97
  export declare const ToggletipButton: React.ForwardRefExoticComponent<Omit<ToggleTipButtonProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
98
- interface ToggletipContentProps {
98
+ export interface ToggletipContentProps {
99
99
  children?: ReactNode;
100
100
  className?: string;
101
101
  }
@@ -106,7 +106,7 @@ interface ToggletipContentProps {
106
106
  */
107
107
  declare const ToggletipContent: React.ForwardRefExoticComponent<ToggletipContentProps & React.RefAttributes<HTMLDivElement>>;
108
108
  export { ToggletipContent };
109
- interface ToggleTipActionsProps {
109
+ export interface ToggleTipActionsProps {
110
110
  children?: ReactNode;
111
111
  className?: string;
112
112
  }
@@ -82,7 +82,7 @@ declare const Content: {
82
82
  "aria-colindextext"?: string | undefined;
83
83
  "aria-colspan"?: number | undefined;
84
84
  "aria-controls"?: string | undefined;
85
- "aria-current"?: boolean | "true" | "false" | "time" | "date" | "step" | "page" | "location" | undefined;
85
+ "aria-current"?: boolean | "true" | "false" | "time" | "step" | "date" | "page" | "location" | undefined;
86
86
  "aria-describedby"?: string | undefined;
87
87
  "aria-description"?: string | undefined;
88
88
  "aria-details"?: string | undefined;
@@ -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 HeaderProps {
8
+ export interface HeaderProps {
9
9
  children?: ReactNode;
10
10
  /**
11
11
  * Required props for the accessibility label of the header
@@ -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 HeaderGlobalActionProps {
8
+ export interface HeaderGlobalActionProps {
9
9
  /**
10
10
  * Required props for the accessibility label of the button
11
11
  */
@@ -12,7 +12,7 @@ import PropTypes from 'prop-types';
12
12
  * with managing focus. It also passes along refs to each child so that it can
13
13
  * help manage focus state of its children.
14
14
  */
15
- interface HeaderMenuProps {
15
+ export interface HeaderMenuProps {
16
16
  /**
17
17
  * Required props for the accessibility label of the menu
18
18
  */
@@ -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 HeaderPanelProps {
8
+ export interface HeaderPanelProps {
9
9
  /**
10
10
  * Specify whether focus and blur listeners are added. They are by default.
11
11
  */
@@ -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 SideNavHeaderProps {
8
+ export interface SideNavHeaderProps {
9
9
  /**
10
10
  * The child nodes to be rendered
11
11
  */
@@ -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 SideNavIconProps {
8
+ export interface SideNavIconProps {
9
9
  /**
10
10
  * Provide a single icon as the child to `SideNavIcon` to render in the
11
11
  * container
@@ -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 SideNavItemProps {
8
+ export interface SideNavItemProps {
9
9
  /**
10
10
  * Provide a single icon as the child to `SideNavItem` to render in the
11
11
  * container
@@ -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 SideNavItemsProps {
8
+ export interface SideNavItemsProps {
9
9
  /**
10
10
  * Provide a single icon as the child to `SideNavIcon` to render in the
11
11
  * container
@@ -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 SideNavMenuProps {
8
+ export interface SideNavMenuProps {
9
9
  /**
10
10
  * An optional CSS class to apply to the component.
11
11
  */
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import React, { ElementType, ComponentProps } from 'react';
8
8
  import Link from './Link';
9
- interface SideNavMenuItemProps extends ComponentProps<typeof Link> {
9
+ export interface SideNavMenuItemProps extends ComponentProps<typeof Link> {
10
10
  /**
11
11
  * Specify the children to be rendered inside of the `SideNavMenuItem`
12
12
  */
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { type ChangeEventHandler } from 'react';
8
- interface SideNavSwitcherProps {
8
+ export interface SideNavSwitcherProps {
9
9
  /**
10
10
  * Provide an optional class to be applied to the containing node
11
11
  */
@@ -11,7 +11,7 @@
11
11
  * LICENSE file in the root directory of this source tree.
12
12
  */
13
13
  import React, { ReactNode } from 'react';
14
- interface BaseSwitcherProps {
14
+ export interface BaseSwitcherProps {
15
15
  /**
16
16
  * expects to receive <SwitcherItem />
17
17
  */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- interface SwitcherDividerProps {
2
+ export interface SwitcherDividerProps {
3
3
  /**
4
4
  * Optionally provide a custom class to apply to the underlying `<li>` node
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributeAnchorTarget } from 'react';
2
- interface BaseSwitcherItemProps {
2
+ export interface BaseSwitcherItemProps {
3
3
  /**
4
4
  * Specify the text content for the link
5
5
  */
@@ -52,14 +52,14 @@ interface BaseSwitcherItemProps {
52
52
  */
53
53
  rel?: string;
54
54
  }
55
- interface SwitcherItemWithAriaLabel extends BaseSwitcherItemProps {
55
+ export interface SwitcherItemWithAriaLabel extends BaseSwitcherItemProps {
56
56
  'aria-label': string;
57
57
  'aria-labelledby'?: never;
58
58
  }
59
- interface SwitcherItemWithAriaLabelledBy extends BaseSwitcherItemProps {
59
+ export interface SwitcherItemWithAriaLabelledBy extends BaseSwitcherItemProps {
60
60
  'aria-label'?: never;
61
61
  'aria-labelledby': string;
62
62
  }
63
- type SwitcherItemProps = SwitcherItemWithAriaLabel | SwitcherItemWithAriaLabelledBy;
63
+ export type SwitcherItemProps = SwitcherItemWithAriaLabel | SwitcherItemWithAriaLabelledBy;
64
64
  declare const SwitcherItem: React.ForwardRefExoticComponent<SwitcherItemProps & React.RefAttributes<React.ElementType<any, keyof React.JSX.IntrinsicElements>>>;
65
65
  export default SwitcherItem;