@carbon/react 1.77.0 → 1.78.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 (126) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +945 -858
  2. package/es/components/Accordion/AccordionItem.js +1 -1
  3. package/es/components/BadgeIndicator/index.d.ts +23 -0
  4. package/es/components/BadgeIndicator/index.js +45 -0
  5. package/es/components/Breadcrumb/Breadcrumb.d.ts +5 -0
  6. package/es/components/Breadcrumb/Breadcrumb.js +8 -2
  7. package/es/components/Button/Button.d.ts +9 -0
  8. package/es/components/Button/Button.js +13 -0
  9. package/es/components/ComboBox/ComboBox.js +13 -9
  10. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  11. package/es/components/Dropdown/Dropdown.js +3 -2
  12. package/es/components/FileUploader/FileUploader.js +1 -1
  13. package/es/components/FileUploader/FileUploaderItem.js +1 -1
  14. package/es/components/IconButton/index.d.ts +7 -1
  15. package/es/components/IconButton/index.js +18 -2
  16. package/es/components/IconIndicator/index.d.ts +1 -1
  17. package/es/components/InlineLoading/InlineLoading.js +2 -5
  18. package/es/components/Menu/MenuItem.js +1 -1
  19. package/es/components/Modal/Modal.d.ts +3 -3
  20. package/es/components/Modal/Modal.js +9 -3
  21. package/es/components/Modal/next/index.d.ts +1 -5
  22. package/es/components/MultiSelect/MultiSelect.js +3 -2
  23. package/es/components/MultiSelect/MultiSelectPropTypes.d.ts +5 -2
  24. package/es/components/MultiSelect/tools/sorting.js +8 -7
  25. package/es/components/Notification/Notification.js +1 -1
  26. package/es/components/NumberInput/NumberInput.js +12 -12
  27. package/es/components/OverflowMenu/OverflowMenu.d.ts +8 -20
  28. package/es/components/OverflowMenu/OverflowMenu.js +7 -9
  29. package/es/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
  30. package/es/components/ProgressIndicator/ProgressIndicator.js +1 -1
  31. package/es/components/RadioTile/RadioTile.js +1 -1
  32. package/es/components/Select/Select.js +11 -2
  33. package/es/components/ShapeIndicator/index.d.ts +29 -0
  34. package/es/components/ShapeIndicator/index.js +92 -0
  35. package/es/components/Tabs/Tabs.d.ts +6 -4
  36. package/es/components/Tabs/Tabs.js +27 -8
  37. package/es/components/Tag/OperationalTag.d.ts +1 -36
  38. package/es/components/Tag/OperationalTag.js +7 -5
  39. package/es/components/Text/Text.d.ts +11 -9
  40. package/es/components/Text/Text.js +6 -6
  41. package/es/components/Text/TextDirection.d.ts +7 -9
  42. package/es/components/Text/TextDirection.js +5 -2
  43. package/es/components/Text/TextDirectionContext.d.ts +14 -0
  44. package/es/components/Text/TextDirectionContext.js +6 -2
  45. package/es/components/Text/createTextComponent.d.ts +5 -5
  46. package/es/components/Text/createTextComponent.js +5 -4
  47. package/es/components/Text/index.d.ts +6 -7
  48. package/es/components/Text/index.js +3 -2
  49. package/es/components/Tile/Tile.d.ts +6 -0
  50. package/es/components/Tile/Tile.js +5 -9
  51. package/es/components/Toggletip/index.d.ts +3 -2
  52. package/es/components/Tooltip/DefinitionTooltip.d.ts +4 -0
  53. package/es/components/Tooltip/DefinitionTooltip.js +7 -1
  54. package/es/components/Tooltip/Tooltip.d.ts +5 -66
  55. package/es/components/Tooltip/Tooltip.js +26 -26
  56. package/es/components/UIShell/HeaderGlobalAction.d.ts +9 -0
  57. package/es/components/UIShell/HeaderGlobalAction.js +16 -1
  58. package/es/index.d.ts +4 -1
  59. package/es/index.js +2 -1
  60. package/es/internal/FloatingMenu.d.ts +83 -0
  61. package/es/internal/FloatingMenu.js +216 -408
  62. package/es/internal/wrapFocus.js +1 -1
  63. package/lib/components/Accordion/AccordionItem.js +1 -1
  64. package/lib/components/BadgeIndicator/index.d.ts +23 -0
  65. package/lib/components/BadgeIndicator/index.js +56 -0
  66. package/lib/components/Breadcrumb/Breadcrumb.d.ts +5 -0
  67. package/lib/components/Breadcrumb/Breadcrumb.js +8 -2
  68. package/lib/components/Button/Button.d.ts +9 -0
  69. package/lib/components/Button/Button.js +13 -0
  70. package/lib/components/ComboBox/ComboBox.js +13 -9
  71. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  72. package/lib/components/Dropdown/Dropdown.js +2 -1
  73. package/lib/components/FileUploader/FileUploader.js +1 -1
  74. package/lib/components/FileUploader/FileUploaderItem.js +1 -1
  75. package/lib/components/IconButton/index.d.ts +7 -1
  76. package/lib/components/IconButton/index.js +18 -2
  77. package/lib/components/IconIndicator/index.d.ts +1 -1
  78. package/lib/components/InlineLoading/InlineLoading.js +2 -5
  79. package/lib/components/Menu/MenuItem.js +1 -1
  80. package/lib/components/Modal/Modal.d.ts +3 -3
  81. package/lib/components/Modal/Modal.js +9 -3
  82. package/lib/components/Modal/next/index.d.ts +1 -5
  83. package/lib/components/MultiSelect/MultiSelect.js +2 -1
  84. package/lib/components/MultiSelect/MultiSelectPropTypes.d.ts +5 -2
  85. package/lib/components/MultiSelect/tools/sorting.js +8 -7
  86. package/lib/components/Notification/Notification.js +1 -1
  87. package/lib/components/NumberInput/NumberInput.js +12 -12
  88. package/lib/components/OverflowMenu/OverflowMenu.d.ts +8 -20
  89. package/lib/components/OverflowMenu/OverflowMenu.js +7 -9
  90. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
  91. package/lib/components/ProgressIndicator/ProgressIndicator.js +1 -1
  92. package/lib/components/RadioTile/RadioTile.js +1 -1
  93. package/lib/components/Select/Select.js +11 -2
  94. package/lib/components/ShapeIndicator/index.d.ts +29 -0
  95. package/lib/components/ShapeIndicator/index.js +104 -0
  96. package/lib/components/Tabs/Tabs.d.ts +6 -4
  97. package/lib/components/Tabs/Tabs.js +42 -23
  98. package/lib/components/Tag/OperationalTag.d.ts +1 -36
  99. package/lib/components/Tag/OperationalTag.js +6 -4
  100. package/lib/components/Text/Text.d.ts +11 -9
  101. package/lib/components/Text/Text.js +5 -5
  102. package/lib/components/Text/TextDirection.d.ts +7 -9
  103. package/lib/components/Text/TextDirection.js +5 -2
  104. package/lib/components/Text/TextDirectionContext.d.ts +14 -0
  105. package/lib/components/Text/TextDirectionContext.js +6 -2
  106. package/lib/components/Text/createTextComponent.d.ts +5 -5
  107. package/lib/components/Text/createTextComponent.js +5 -4
  108. package/lib/components/Text/index.d.ts +6 -7
  109. package/lib/components/Text/index.js +4 -3
  110. package/lib/components/Tile/Tile.d.ts +6 -0
  111. package/lib/components/Tile/Tile.js +5 -9
  112. package/lib/components/Toggletip/index.d.ts +3 -2
  113. package/lib/components/Tooltip/DefinitionTooltip.d.ts +4 -0
  114. package/lib/components/Tooltip/DefinitionTooltip.js +7 -1
  115. package/lib/components/Tooltip/Tooltip.d.ts +5 -66
  116. package/lib/components/Tooltip/Tooltip.js +26 -26
  117. package/lib/components/UIShell/HeaderGlobalAction.d.ts +9 -0
  118. package/lib/components/UIShell/HeaderGlobalAction.js +16 -1
  119. package/lib/index.d.ts +4 -1
  120. package/lib/index.js +42 -40
  121. package/lib/internal/FloatingMenu.d.ts +83 -0
  122. package/lib/internal/FloatingMenu.js +216 -409
  123. package/lib/internal/wrapFocus.js +1 -1
  124. package/package.json +5 -5
  125. package/scss/components/badge-indicator/_badge-indicator.scss +9 -0
  126. package/scss/components/badge-indicator/_index.scss +9 -0
@@ -1,25 +1,13 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
3
3
  *
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 { type MenuDirection, type MenuOffset } from '../../internal/FloatingMenu';
7
8
  import React, { ComponentType } from 'react';
8
9
  import PropTypes from 'prop-types';
9
- /**
10
- * @param {Element} menuBody The menu body with the menu arrow.
11
- * @param {string} direction The floating menu direction.
12
- * @returns {FloatingMenu~offset} The adjustment of the floating menu position, upon the position of the menu arrow.
13
- * @private
14
- */
15
- export declare const getMenuOffset: (menuBody: any, direction: any, trigger: any, flip: any) => {
16
- left: number;
17
- top: number;
18
- } | undefined;
19
- interface Offset {
20
- top?: number | null | undefined;
21
- left?: number | null | undefined;
22
- }
10
+ export declare const getMenuOffset: MenuOffset;
23
11
  type IconProps = {
24
12
  className?: string;
25
13
  'aria-label'?: string;
@@ -46,7 +34,7 @@ export interface OverflowMenuProps {
46
34
  /**
47
35
  * The menu direction.
48
36
  */
49
- direction?: string;
37
+ direction?: MenuDirection;
50
38
  /**
51
39
  * `true` if the menu alignment should be flipped.
52
40
  */
@@ -75,11 +63,11 @@ export interface OverflowMenuProps {
75
63
  /**
76
64
  * The adjustment in position applied to the floating menu.
77
65
  */
78
- menuOffset?: Offset | (() => void);
66
+ menuOffset?: MenuOffset;
79
67
  /**
80
68
  * The adjustment in position applied to the floating menu.
81
69
  */
82
- menuOffsetFlip?: Offset | (() => void);
70
+ menuOffsetFlip?: MenuOffset;
83
71
  /**
84
72
  * The class to apply to the menu options
85
73
  */
@@ -246,10 +234,10 @@ declare class OverflowMenu extends React.Component<OverflowMenuProps, OverflowMe
246
234
  _hBlurTimeout: any;
247
235
  /**
248
236
  * The element ref of the tooltip's trigger button.
249
- * @type {React.RefObject<Element>}
237
+ * @type {React.RefObject<HTMLElement>}
250
238
  * @private
251
239
  */
252
- _triggerRef: React.RefObject<unknown>;
240
+ _triggerRef: React.RefObject<HTMLElement>;
253
241
  componentDidUpdate(_: any, prevState: any): void;
254
242
  componentDidMount(): void;
255
243
  static getDerivedStateFromProps({ open }: {
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import FloatingMenu, { DIRECTION_TOP, DIRECTION_BOTTOM } from '../../internal/FloatingMenu.js';
9
+ import { FloatingMenu, DIRECTION_TOP, DIRECTION_BOTTOM } from '../../internal/FloatingMenu.js';
10
10
  import React__default from 'react';
11
11
  import ClickListener from '../../internal/ClickListener.js';
12
12
  import { IconButton } from '../IconButton/index.js';
@@ -53,13 +53,6 @@ const triggerButtonPositionFactors = {
53
53
  [DIRECTION_TOP]: -2,
54
54
  [DIRECTION_BOTTOM]: -1
55
55
  };
56
-
57
- /**
58
- * @param {Element} menuBody The menu body with the menu arrow.
59
- * @param {string} direction The floating menu direction.
60
- * @returns {FloatingMenu~offset} The adjustment of the floating menu position, upon the position of the menu arrow.
61
- * @private
62
- */
63
56
  const getMenuOffset = (menuBody, direction, trigger, flip) => {
64
57
  const triggerButtonPositionProp = triggerButtonPositionProps[direction];
65
58
  const triggerButtonPositionFactor = triggerButtonPositionFactors[direction];
@@ -81,6 +74,11 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
81
74
  top: 0
82
75
  };
83
76
  }
77
+ default:
78
+ return {
79
+ left: 0,
80
+ top: 0
81
+ };
84
82
  }
85
83
  };
86
84
  class OverflowMenu extends React__default.Component {
@@ -106,7 +104,7 @@ class OverflowMenu extends React__default.Component {
106
104
  _defineProperty(this, "_hBlurTimeout", void 0);
107
105
  /**
108
106
  * The element ref of the tooltip's trigger button.
109
- * @type {React.RefObject<Element>}
107
+ * @type {React.RefObject<HTMLElement>}
110
108
  * @private
111
109
  */
112
110
  _defineProperty(this, "_triggerRef", /*#__PURE__*/React__default.createRef());
@@ -12,8 +12,8 @@ import React__default from 'react';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
13
  import { warning } from '../../internal/warning.js';
14
14
  import '../Text/index.js';
15
- import { Text } from '../Text/Text.js';
16
15
  import { match } from '../../internal/keyboard/match.js';
16
+ import { Text } from '../Text/Text.js';
17
17
  import { ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
18
18
 
19
19
  const OverflowMenuItem = /*#__PURE__*/React__default.forwardRef(function OverflowMenuItem(_ref, ref) {
@@ -12,8 +12,8 @@ import React__default, { useState } from 'react';
12
12
  import { Warning, Incomplete, CheckmarkOutline, CircleDash } from '@carbon/icons-react';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import '../Text/index.js';
15
- import { Text } from '../Text/Text.js';
16
15
  import { matches } from '../../internal/keyboard/match.js';
16
+ import { Text } from '../Text/Text.js';
17
17
  import { Enter, Space } from '../../internal/keyboard/keys.js';
18
18
 
19
19
  const defaultTranslations = {
@@ -16,8 +16,8 @@ import deprecate from '../../prop-types/deprecate.js';
16
16
  import { noopFn } from '../../internal/noopFn.js';
17
17
  import '../Text/index.js';
18
18
  import { useFeatureFlag } from '../FeatureFlags/index.js';
19
- import { Text } from '../Text/Text.js';
20
19
  import { matches } from '../../internal/keyboard/match.js';
20
+ import { Text } from '../Text/Text.js';
21
21
  import { Enter, Space } from '../../internal/keyboard/keys.js';
22
22
 
23
23
  var _RadioButtonChecked, _RadioButton, _CheckmarkFilled;
@@ -49,8 +49,16 @@ const Select = /*#__PURE__*/React__default.forwardRef(function Select(_ref, ref)
49
49
  isFluid
50
50
  } = useContext(FormContext);
51
51
  const [isFocused, setIsFocused] = useState(false);
52
- const [title, setTitle] = useState('');
53
52
  const selectInstanceId = useId();
53
+ // Convert children to an array of valid elements once using type narrowing
54
+ const validChildren = React__default.Children.toArray(children).filter(child => /*#__PURE__*/React__default.isValidElement(child));
55
+
56
+ // Find the default option based on the specified defaultValue
57
+ const defaultOption = validChildren.find(child => child.props?.value === other?.defaultValue);
58
+
59
+ // Use the default option's text if available; otherwise, fallback to the first option's text
60
+ const initialTitle = defaultOption?.props?.text || validChildren[0]?.props?.text || '';
61
+ const [title, setTitle] = useState(initialTitle);
54
62
  const selectClasses = cx({
55
63
  [`${prefix}--select`]: true,
56
64
  [`${prefix}--select--inline`]: inline,
@@ -105,7 +113,8 @@ const Select = /*#__PURE__*/React__default.forwardRef(function Select(_ref, ref)
105
113
  setIsFocused(evt.type === 'focus' ? true : false);
106
114
  };
107
115
  const handleChange = evt => {
108
- setTitle(evt?.target?.value);
116
+ const selectedOption = evt?.target?.options[evt.target.selectedIndex];
117
+ setTitle(selectedOption?.text);
109
118
  };
110
119
  const readOnlyEventHandlers = {
111
120
  onMouseDown: evt => {
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025, 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ export declare const ShapeIndicatorKinds: string[];
9
+ export type ShapeIndicatorKind = (typeof ShapeIndicatorKinds)[number];
10
+ export interface ShapeIndicatorProps {
11
+ /**
12
+ * Specify an optional className to add.
13
+ */
14
+ className?: string;
15
+ /**
16
+ * Specify the kind of shape to be used
17
+ */
18
+ kind: ShapeIndicatorKind;
19
+ /**
20
+ * Label next to the shape
21
+ */
22
+ label: string;
23
+ /**
24
+ * Specify the text size of the Shape Indicator. Defaults to 12.
25
+ */
26
+ textSize?: 12 | 14;
27
+ }
28
+ export declare const ShapeIndicator: React.ForwardRefExoticComponent<ShapeIndicatorProps & React.RefAttributes<HTMLDivElement>>;
29
+ export default ShapeIndicator;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import PropTypes from 'prop-types';
10
+ import React__default from 'react';
11
+ import cx from 'classnames';
12
+ import { usePrefix } from '../../internal/usePrefix.js';
13
+ import { Critical, CriticalSeverity, Caution, DiamondFill, LowSeverity, CircleFill, CircleStroke } from '@carbon/icons-react';
14
+
15
+ var _path;
16
+ const ShapeIndicatorKinds = ['failed', 'critical', 'high', 'medium', 'low', 'cautious', 'undefined', 'stable', 'informative', 'incomplete', 'draft'];
17
+
18
+ // TODO: update to import '@carbon/icons-react'
19
+ const incompleteIcon = props => /*#__PURE__*/React__default.createElement("svg", _extends({
20
+ xmlns: "http://www.w3.org/2000/svg",
21
+ width: 16,
22
+ height: 16,
23
+ fill: "none",
24
+ "aria-hidden": "true"
25
+ }, props), /*#__PURE__*/React__default.createElement("path", {
26
+ fill: "#fff",
27
+ fillOpacity: 0.01,
28
+ d: "M0 0h16v16H0z",
29
+ style: {
30
+ mixBlendMode: 'multiply'
31
+ }
32
+ }), _path || (_path = /*#__PURE__*/React__default.createElement("path", {
33
+ fill: "#161616",
34
+ d: "M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Zm0 2a4.004 4.004 0 0 1 4 4H4a4.004 4.004 0 0 1 4-4Z"
35
+ })));
36
+ const shapeTypes = {
37
+ failed: Critical,
38
+ critical: CriticalSeverity,
39
+ high: Caution,
40
+ medium: DiamondFill,
41
+ low: LowSeverity,
42
+ cautious: Caution,
43
+ undefined: DiamondFill,
44
+ stable: CircleFill,
45
+ informative: LowSeverity,
46
+ incomplete: incompleteIcon,
47
+ draft: CircleStroke
48
+ };
49
+ const ShapeIndicator = /*#__PURE__*/React__default.forwardRef(function ShapeIndicatorContent(_ref, ref) {
50
+ let {
51
+ className: customClassName,
52
+ kind,
53
+ label,
54
+ textSize = 12,
55
+ ...rest
56
+ } = _ref;
57
+ const prefix = usePrefix();
58
+ const classNames = cx(`${prefix}--shape-indicator`, customClassName, {
59
+ [`${prefix}--shape-indicator--14`]: textSize == 14
60
+ });
61
+ const ShapeForKind = shapeTypes[kind];
62
+ if (!ShapeForKind) {
63
+ return null;
64
+ }
65
+ return /*#__PURE__*/React__default.createElement("div", {
66
+ className: classNames,
67
+ ref: ref
68
+ }, /*#__PURE__*/React__default.createElement(ShapeForKind, {
69
+ size: 16,
70
+ className: `${prefix}--shape-indicator--${kind}`
71
+ }), label);
72
+ });
73
+ ShapeIndicator.propTypes = {
74
+ /**
75
+ * Specify an optional className to add.
76
+ */
77
+ className: PropTypes.string,
78
+ /**
79
+ * Specify the kind of the Shape Indicator
80
+ */
81
+ kind: PropTypes.oneOf(ShapeIndicatorKinds).isRequired,
82
+ /**
83
+ * Label next to the shape.
84
+ */
85
+ label: PropTypes.string.isRequired,
86
+ /**
87
+ * Specify the text size of the Shape Indicator. Defaults to 12.
88
+ */
89
+ textSize: PropTypes.oneOf([12, 14])
90
+ };
91
+
92
+ export { ShapeIndicator, ShapeIndicatorKinds, ShapeIndicator as default };
@@ -353,10 +353,11 @@ export interface TabProps extends HTMLAttributes<HTMLElement> {
353
353
  secondaryLabel?: string;
354
354
  }
355
355
  declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLElement>>;
356
- /**
357
- * IconTab
358
- */
359
356
  export interface IconTabProps extends DivAttributes {
357
+ /**
358
+ * **Experimental**: Display an empty dot badge on the Tab.
359
+ */
360
+ badgeIndicator?: boolean;
360
361
  /**
361
362
  * Provide an icon to be rendered inside `IconTab` as the visual label for Tab.
362
363
  */
@@ -377,7 +378,8 @@ export interface IconTabProps extends DivAttributes {
377
378
  * Provide the label to be rendered inside the Tooltip. The label will use
378
379
  * `aria-labelledby` and will fully describe the child node that is provided.
379
380
  * This means that if you have text in the child node it will not be
380
- * announced to the screen reader.
381
+ * announced to the screen reader. If using the badgeIndicator then provide a
382
+ * label with describing that there is a new notification.
381
383
  */
382
384
  label: ReactNode;
383
385
  /**
@@ -10,7 +10,7 @@ import { ChevronLeft, ChevronRight, Close } from '@carbon/icons-react';
10
10
  import { breakpoints } from '@carbon/layout';
11
11
  import cx from 'classnames';
12
12
  import PropTypes from 'prop-types';
13
- import React__default, { useState, useRef, useCallback, useEffect, forwardRef } from 'react';
13
+ import React__default, { useState, useRef, useCallback, useEffect, forwardRef, createContext, useMemo } from 'react';
14
14
  import '../Grid/FlexGrid.js';
15
15
  import { Grid as GridAsGridComponent } from '../Grid/Grid.js';
16
16
  import '../Grid/Row.js';
@@ -32,12 +32,13 @@ import deprecate from '../../prop-types/deprecate.js';
32
32
  import { useEvent } from '../../internal/useEvent.js';
33
33
  import { useMatchMedia } from '../../internal/useMatchMedia.js';
34
34
  import '../Text/index.js';
35
+ import { BadgeIndicator } from '../BadgeIndicator/index.js';
35
36
  import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
36
- import { Text } from '../Text/Text.js';
37
37
  import { matches, match } from '../../internal/keyboard/match.js';
38
+ import { Text } from '../Text/Text.js';
38
39
  import { ArrowRight, ArrowLeft, Home, End, ArrowDown, ArrowUp, Delete } from '../../internal/keyboard/keys.js';
39
40
 
40
- var _ChevronLeft, _ChevronRight;
41
+ var _ChevronLeft, _ChevronRight, _BadgeIndicator;
41
42
  const verticalTabHeight = 64;
42
43
 
43
44
  // Used to manage the overall state of the Tabs
@@ -798,6 +799,9 @@ const Tab = /*#__PURE__*/forwardRef(function Tab(_ref10, forwardRef) {
798
799
  hasSecondaryLabel,
799
800
  contained
800
801
  } = React__default.useContext(TabContext);
802
+ const {
803
+ badgeIndicator
804
+ } = React__default.useContext(IconTabContext) || {};
801
805
  const dismissIconRef = useRef(null);
802
806
  const tabRef = useRef(null);
803
807
  const ref = useMergedRefs([forwardRef, tabRef]);
@@ -975,7 +979,7 @@ const Tab = /*#__PURE__*/forwardRef(function Tab(_ref10, forwardRef) {
975
979
  as: "div",
976
980
  className: `${prefix}--tabs__nav-item-secondary-label`,
977
981
  title: secondaryLabel
978
- }, secondaryLabel)), DismissIcon);
982
+ }, secondaryLabel), !disabled && badgeIndicator && (_BadgeIndicator || (_BadgeIndicator = /*#__PURE__*/React__default.createElement(BadgeIndicator, null)))), DismissIcon);
979
983
  });
980
984
  Tab.propTypes = {
981
985
  /**
@@ -1026,8 +1030,10 @@ Tab.propTypes = {
1026
1030
  * IconTab
1027
1031
  */
1028
1032
 
1033
+ const IconTabContext = /*#__PURE__*/createContext(false);
1029
1034
  const IconTab = /*#__PURE__*/React__default.forwardRef(function IconTab(_ref11, ref) {
1030
1035
  let {
1036
+ badgeIndicator,
1031
1037
  children,
1032
1038
  className: customClassName,
1033
1039
  defaultOpen = false,
@@ -1037,8 +1043,16 @@ const IconTab = /*#__PURE__*/React__default.forwardRef(function IconTab(_ref11,
1037
1043
  ...rest
1038
1044
  } = _ref11;
1039
1045
  const prefix = usePrefix();
1040
- const classNames = cx(`${prefix}--tabs__nav-item--icon-only`, customClassName);
1041
- return /*#__PURE__*/React__default.createElement(Tooltip, {
1046
+ const value = useMemo(() => ({
1047
+ badgeIndicator
1048
+ }), [badgeIndicator]);
1049
+ const hasSize20 = /*#__PURE__*/React__default.isValidElement(children) && children.props?.size === 20;
1050
+ const classNames = cx(`${prefix}--tabs__nav-item--icon-only`, customClassName, {
1051
+ [`${prefix}--tabs__nav-item--icon-only__20`]: hasSize20
1052
+ });
1053
+ return /*#__PURE__*/React__default.createElement(IconTabContext.Provider, {
1054
+ value: value
1055
+ }, /*#__PURE__*/React__default.createElement(Tooltip, {
1042
1056
  align: "bottom",
1043
1057
  defaultOpen: defaultOpen,
1044
1058
  className: `${prefix}--icon-tooltip`,
@@ -1048,9 +1062,13 @@ const IconTab = /*#__PURE__*/React__default.forwardRef(function IconTab(_ref11,
1048
1062
  }, /*#__PURE__*/React__default.createElement(Tab, _extends({
1049
1063
  className: classNames,
1050
1064
  ref: ref
1051
- }, rest), children));
1065
+ }, rest), children)));
1052
1066
  });
1053
1067
  IconTab.propTypes = {
1068
+ /**
1069
+ * **Experimental**: Display an empty dot badge on the Tab.
1070
+ */
1071
+ badgeIndicator: PropTypes.bool,
1054
1072
  /**
1055
1073
  * Provide an icon to be rendered inside `IconTab` as the visual label for Tab.
1056
1074
  */
@@ -1071,7 +1089,8 @@ IconTab.propTypes = {
1071
1089
  * Provide the label to be rendered inside the Tooltip. The label will use
1072
1090
  * `aria-labelledby` and will fully describe the child node that is provided.
1073
1091
  * This means that if you have text in the child node it will not be
1074
- * announced to the screen reader.
1092
+ * announced to the screen reader. If using the badgeIndicator then provide a
1093
+ * label with describing that there is a new notification.
1075
1094
  */
1076
1095
  label: PropTypes.node.isRequired,
1077
1096
  /**
@@ -4,7 +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 PropTypes from 'prop-types';
8
7
  import React, { MouseEventHandler } from 'react';
9
8
  import { PolymorphicProps } from '../../types/common';
10
9
  import { SIZES } from './Tag';
@@ -54,40 +53,6 @@ export interface OperationalTagBaseProps {
54
53
  type?: keyof typeof TYPES;
55
54
  }
56
55
  export type OperationalTagProps<T extends React.ElementType> = PolymorphicProps<T, OperationalTagBaseProps>;
57
- declare const OperationalTag: {
58
- <T extends React.ElementType>({ className, disabled, id, renderIcon, size, text, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
59
- propTypes: {
60
- /**
61
- * Provide a custom className that is applied to the containing <span>
62
- */
63
- className: PropTypes.Requireable<string>;
64
- /**
65
- * Specify if the `OperationalTag` is disabled
66
- */
67
- disabled: PropTypes.Requireable<boolean>;
68
- /**
69
- * Specify the id for the tag.
70
- */
71
- id: PropTypes.Requireable<string>;
72
- /**
73
- * Optional prop to render a custom icon.
74
- * Can be a React component class
75
- */
76
- renderIcon: PropTypes.Requireable<object>;
77
- /**
78
- * Specify the size of the Tag. Currently supports either `sm`,
79
- * `md` (default) or `lg` sizes.
80
- */
81
- size: PropTypes.Requireable<string>;
82
- /**
83
- * Provide text to be rendered inside of a the tag.
84
- */
85
- text: PropTypes.Requireable<string>;
86
- /**
87
- * Specify the type of the `Tag`
88
- */
89
- type: PropTypes.Requireable<string>;
90
- };
91
- };
56
+ declare const OperationalTag: React.ForwardRefExoticComponent<Omit<OperationalTagProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLLIElement>>;
92
57
  export declare const types: string[];
93
58
  export default OperationalTag;
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default, { useRef, useState, useLayoutEffect } from 'react';
10
+ import React__default, { forwardRef, useRef, useState, useLayoutEffect } from 'react';
11
11
  import cx from 'classnames';
12
12
  import { useId } from '../../internal/useId.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
@@ -16,6 +16,7 @@ import '../Tooltip/DefinitionTooltip.js';
16
16
  import { Tooltip } from '../Tooltip/Tooltip.js';
17
17
  import '../Text/index.js';
18
18
  import { isEllipsisActive } from './isEllipsisActive.js';
19
+ import mergeRefs from '../../tools/mergeRefs.js';
19
20
  import { Text } from '../Text/Text.js';
20
21
 
21
22
  const TYPES = {
@@ -30,7 +31,7 @@ const TYPES = {
30
31
  'cool-gray': 'Cool-Gray',
31
32
  'warm-gray': 'Warm-Gray'
32
33
  };
33
- const OperationalTag = _ref => {
34
+ const OperationalTag = /*#__PURE__*/forwardRef((_ref, forwardRef) => {
34
35
  let {
35
36
  className,
36
37
  disabled,
@@ -51,6 +52,7 @@ const OperationalTag = _ref => {
51
52
  setIsEllipsisApplied(isEllipsisActive(newElement));
52
53
  }, [prefix, tagRef]);
53
54
  const tooltipClasses = cx(`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
55
+ const combinedRef = mergeRefs(tagRef, forwardRef);
54
56
  if (isEllipsisApplied) {
55
57
  return /*#__PURE__*/React__default.createElement(Tooltip, {
56
58
  label: text,
@@ -60,7 +62,7 @@ const OperationalTag = _ref => {
60
62
  onMouseEnter: () => false,
61
63
  closeOnActivation: true
62
64
  }, /*#__PURE__*/React__default.createElement(Tag, _extends({
63
- ref: tagRef,
65
+ ref: combinedRef,
64
66
  type: type,
65
67
  size: size,
66
68
  renderIcon: renderIcon,
@@ -73,7 +75,7 @@ const OperationalTag = _ref => {
73
75
  }, text)));
74
76
  }
75
77
  return /*#__PURE__*/React__default.createElement(Tag, _extends({
76
- ref: tagRef,
78
+ ref: combinedRef,
77
79
  type: type,
78
80
  size: size,
79
81
  renderIcon: renderIcon,
@@ -84,7 +86,7 @@ const OperationalTag = _ref => {
84
86
  title: text,
85
87
  className: `${prefix}--tag__label`
86
88
  }, text));
87
- };
89
+ });
88
90
  OperationalTag.propTypes = {
89
91
  /**
90
92
  * Provide a custom className that is applied to the containing <span>
@@ -1,17 +1,19 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
3
3
  *
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, { ReactNode } from 'react';
8
- import { TextDir } from './TextDirection';
9
- import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
7
+ import { type ElementType, type ReactElement, type ReactNode } from 'react';
8
+ import { PolymorphicComponentPropWithRef, PolymorphicRef } from '../../internal/PolymorphicProps';
9
+ import { type TextDir } from '.';
10
10
  export interface TextBaseProps {
11
- dir?: TextDir | undefined;
11
+ dir?: TextDir;
12
12
  children?: ReactNode;
13
13
  }
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;
17
- export { Text };
14
+ export type TextProps<T extends ElementType> = PolymorphicComponentPropWithRef<T, TextBaseProps>;
15
+ type TextComponent = <T extends ElementType = 'span'>(props: TextProps<T> & {
16
+ ref?: PolymorphicRef<T>;
17
+ }) => ReactElement | null;
18
+ export declare const Text: TextComponent;
19
+ export {};
@@ -7,17 +7,17 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default, { useContext } from 'react';
10
+ import React__default, { forwardRef, useContext, Children } from 'react';
11
+ import './index.js';
11
12
  import { TextDirectionContext } from './TextDirectionContext.js';
12
13
 
13
- const Text = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
14
+ const Text = /*#__PURE__*/forwardRef((_ref, ref) => {
14
15
  let {
15
16
  as,
16
17
  children,
17
18
  dir = 'auto',
18
19
  ...rest
19
20
  } = _ref;
20
- // TODO: Update with context typing once its been converted to TS
21
21
  const context = useContext(TextDirectionContext);
22
22
  const textProps = {};
23
23
  const BaseComponent = as ?? 'span';
@@ -69,11 +69,11 @@ Text.propTypes = {
69
69
  */
70
70
  dir: PropTypes.oneOf(['ltr', 'rtl', 'auto'])
71
71
  };
72
- function getTextFromChildren(children) {
72
+ const getTextFromChildren = children => {
73
73
  if (typeof children === 'string') {
74
74
  return children;
75
75
  }
76
- const text = React__default.Children.map(children, child => {
76
+ const text = Children.map(children, child => {
77
77
  if (typeof child === 'string') {
78
78
  return child;
79
79
  }
@@ -85,6 +85,6 @@ function getTextFromChildren(children) {
85
85
  return text[0];
86
86
  }
87
87
  return text;
88
- }
88
+ };
89
89
 
90
90
  export { Text };
@@ -1,21 +1,20 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
3
3
  *
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
7
  import PropTypes from 'prop-types';
8
8
  import { ReactNode } from 'react';
9
- export type TextDir = 'ltr' | 'rtl' | 'auto' | string;
10
- export type GetTextDirection = (text: string | string[] | undefined) => TextDir;
9
+ import { type GetTextDirection, type TextDir } from '.';
11
10
  export interface TextDirectionProps {
12
- children: ReactNode | undefined;
11
+ children: ReactNode;
13
12
  dir?: TextDir;
14
13
  getTextDirection?: GetTextDirection;
15
14
  }
16
- declare function TextDirection({ children, dir, getTextDirection, }: TextDirectionProps): import("react/jsx-runtime").JSX.Element;
17
- declare namespace TextDirection {
18
- var propTypes: {
15
+ export declare const TextDirection: {
16
+ ({ children, dir, getTextDirection, }: TextDirectionProps): import("react/jsx-runtime").JSX.Element;
17
+ propTypes: {
19
18
  /**
20
19
  * Provide children to be rendered inside of this component
21
20
  */
@@ -31,5 +30,4 @@ declare namespace TextDirection {
31
30
  */
32
31
  getTextDirection: PropTypes.Requireable<(...args: any[]) => any>;
33
32
  };
34
- }
35
- export { TextDirection };
33
+ };
@@ -7,9 +7,10 @@
7
7
 
8
8
  import PropTypes from 'prop-types';
9
9
  import React__default, { useRef, useMemo, useEffect } from 'react';
10
+ import './index.js';
10
11
  import { TextDirectionContext } from './TextDirectionContext.js';
11
12
 
12
- function TextDirection(_ref) {
13
+ const TextDirection = _ref => {
13
14
  let {
14
15
  children,
15
16
  dir = 'auto',
@@ -24,11 +25,13 @@ function TextDirection(_ref) {
24
25
  }, [dir]);
25
26
  useEffect(() => {
26
27
  savedCallback.current = getTextDirection;
28
+ // TODO: Is this `useEffect` supposed to have a dependency on
29
+ // `getTextDirection`?
27
30
  });
28
31
  return /*#__PURE__*/React__default.createElement(TextDirectionContext.Provider, {
29
32
  value: value
30
33
  }, children);
31
- }
34
+ };
32
35
  TextDirection.propTypes = {
33
36
  /**
34
37
  * Provide children to be rendered inside of this component