@carbon/react 1.58.0-rc.0 → 1.58.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 (80) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1114 -957
  2. package/es/components/Accordion/Accordion.d.ts +1 -1
  3. package/es/components/Accordion/index.d.ts +2 -2
  4. package/es/components/Button/index.d.ts +2 -1
  5. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  6. package/es/components/Dropdown/index.d.ts +2 -2
  7. package/es/components/FormLabel/index.d.ts +2 -2
  8. package/es/components/Grid/Column.d.ts +2 -2
  9. package/es/components/Grid/GridTypes.d.ts +1 -2
  10. package/es/components/Grid/index.d.ts +3 -1
  11. package/es/components/InlineLoading/index.d.ts +2 -2
  12. package/es/components/Loading/index.d.ts +2 -2
  13. package/es/components/Modal/index.d.ts +2 -2
  14. package/es/components/NumberInput/NumberInput.d.ts +11 -0
  15. package/es/components/NumberInput/NumberInput.js +2 -2
  16. package/es/components/NumberInput/index.d.ts +1 -1
  17. package/es/components/OverflowMenu/OverflowMenu.d.ts +10 -6
  18. package/es/components/OverflowMenu/index.d.ts +13 -0
  19. package/es/components/ProgressBar/ProgressBar.d.ts +1 -1
  20. package/es/components/ProgressBar/index.d.ts +2 -2
  21. package/es/components/ProgressIndicator/ProgressIndicator.d.ts +2 -2
  22. package/es/components/ProgressIndicator/index.d.ts +2 -0
  23. package/es/components/StructuredList/index.d.ts +2 -0
  24. package/es/components/Switch/Switch.d.ts +1 -1
  25. package/es/components/Switch/index.d.ts +2 -2
  26. package/es/components/Tab/index.d.ts +2 -1
  27. package/es/components/Tag/DismissibleTag.d.ts +9 -9
  28. package/es/components/Tag/DismissibleTag.js +34 -9
  29. package/es/components/Tag/OperationalTag.d.ts +9 -9
  30. package/es/components/Tag/OperationalTag.js +45 -9
  31. package/es/components/Tag/SelectableTag.d.ts +9 -9
  32. package/es/components/Tag/SelectableTag.js +46 -10
  33. package/es/components/Tag/Tag.js +31 -5
  34. package/es/components/TextArea/index.d.ts +2 -2
  35. package/es/components/TextInput/index.d.ts +4 -2
  36. package/es/components/TileGroup/index.d.ts +2 -2
  37. package/es/components/Tooltip/Tooltip.js +16 -5
  38. package/es/components/Tooltip/index.d.ts +2 -2
  39. package/es/components/UnorderedList/UnorderedList.d.ts +1 -1
  40. package/es/components/UnorderedList/index.d.ts +1 -0
  41. package/lib/components/Accordion/Accordion.d.ts +1 -1
  42. package/lib/components/Accordion/index.d.ts +2 -2
  43. package/lib/components/Button/index.d.ts +2 -1
  44. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  45. package/lib/components/Dropdown/index.d.ts +2 -2
  46. package/lib/components/FormLabel/index.d.ts +2 -2
  47. package/lib/components/Grid/Column.d.ts +2 -2
  48. package/lib/components/Grid/GridTypes.d.ts +1 -2
  49. package/lib/components/Grid/index.d.ts +3 -1
  50. package/lib/components/InlineLoading/index.d.ts +2 -2
  51. package/lib/components/Loading/index.d.ts +2 -2
  52. package/lib/components/Modal/index.d.ts +2 -2
  53. package/lib/components/NumberInput/NumberInput.d.ts +11 -0
  54. package/lib/components/NumberInput/NumberInput.js +2 -2
  55. package/lib/components/NumberInput/index.d.ts +1 -1
  56. package/lib/components/OverflowMenu/OverflowMenu.d.ts +10 -6
  57. package/lib/components/OverflowMenu/index.d.ts +13 -0
  58. package/lib/components/ProgressBar/ProgressBar.d.ts +1 -1
  59. package/lib/components/ProgressBar/index.d.ts +2 -2
  60. package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +2 -2
  61. package/lib/components/ProgressIndicator/index.d.ts +2 -0
  62. package/lib/components/StructuredList/index.d.ts +2 -0
  63. package/lib/components/Switch/Switch.d.ts +1 -1
  64. package/lib/components/Switch/index.d.ts +2 -2
  65. package/lib/components/Tab/index.d.ts +2 -1
  66. package/lib/components/Tag/DismissibleTag.d.ts +9 -9
  67. package/lib/components/Tag/DismissibleTag.js +33 -8
  68. package/lib/components/Tag/OperationalTag.d.ts +9 -9
  69. package/lib/components/Tag/OperationalTag.js +44 -8
  70. package/lib/components/Tag/SelectableTag.d.ts +9 -9
  71. package/lib/components/Tag/SelectableTag.js +45 -9
  72. package/lib/components/Tag/Tag.js +30 -4
  73. package/lib/components/TextArea/index.d.ts +2 -2
  74. package/lib/components/TextInput/index.d.ts +4 -2
  75. package/lib/components/TileGroup/index.d.ts +2 -2
  76. package/lib/components/Tooltip/Tooltip.js +16 -5
  77. package/lib/components/Tooltip/index.d.ts +2 -2
  78. package/lib/components/UnorderedList/UnorderedList.d.ts +1 -1
  79. package/lib/components/UnorderedList/index.d.ts +1 -0
  80. package/package.json +5 -5
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import { PropsWithChildren } from 'react';
9
- interface AccordionProps {
9
+ export interface AccordionProps {
10
10
  /**
11
11
  * Specify the alignment of the accordion heading
12
12
  * title and chevron. Defaults to `end`.
@@ -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 Accordion from './Accordion';
7
+ import Accordion, { type AccordionProps } from './Accordion';
8
8
  export default Accordion;
9
- export { Accordion };
9
+ export { Accordion, type AccordionProps };
10
10
  export { default as AccordionItem } from './AccordionItem';
11
11
  export { default as AccordionSkeleton } from './Accordion.Skeleton';
@@ -5,7 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import Button from './Button';
8
+ import { type ButtonProps } from './Button';
8
9
  export default Button;
9
- export { Button };
10
+ export { Button, type ButtonProps };
10
11
  export * from './Button';
11
12
  export { default as ButtonSkeleton } from './Button.Skeleton';
@@ -138,7 +138,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
138
138
  }
139
139
  export type DropdownTranslationKey = ListBoxMenuIconTranslationKey;
140
140
  type DropdownComponentProps<ItemType> = React.PropsWithoutRef<React.PropsWithChildren<DropdownProps<ItemType>> & React.RefAttributes<HTMLButtonElement>>;
141
- interface DropdownComponent {
141
+ export interface DropdownComponent {
142
142
  <ItemType>(props: DropdownComponentProps<ItemType>): React.ReactElement | null;
143
143
  }
144
144
  declare const _default: DropdownComponent;
@@ -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 Dropdown, { type DropdownTranslationKey, type OnChangeData } from './Dropdown';
7
+ import Dropdown, { type DropdownTranslationKey, type OnChangeData, type DropdownProps } from './Dropdown';
8
8
  export type { DropdownTranslationKey, OnChangeData };
9
- export { Dropdown };
9
+ export { Dropdown, type DropdownProps };
10
10
  export { default as DropdownSkeleton } from './Dropdown.Skeleton';
11
11
  export default Dropdown;
@@ -4,6 +4,6 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import FormLabel from './FormLabel';
7
+ import FormLabel, { type FormLabelProps } from './FormLabel';
8
8
  export default FormLabel;
9
- export { FormLabel };
9
+ export { FormLabel, type FormLabelProps };
@@ -8,14 +8,14 @@ import React from 'react';
8
8
  import { PolymorphicProps } from '../../types/common';
9
9
  type ColumnSpanPercent = '25%' | '50%' | '75%' | '100%';
10
10
  type ColumnSpanSimple = boolean | number | ColumnSpanPercent;
11
- interface ColumnSpanObject {
11
+ export interface ColumnSpanObject {
12
12
  span?: ColumnSpanSimple;
13
13
  offset?: number;
14
14
  start?: number;
15
15
  end?: number;
16
16
  }
17
17
  export type ColumnSpan = ColumnSpanSimple | ColumnSpanObject;
18
- interface ColumnBaseProps {
18
+ export interface ColumnBaseProps {
19
19
  /**
20
20
  * Pass in content that will be rendered within the `Column`
21
21
  */
@@ -6,7 +6,7 @@
6
6
  */
7
7
  /// <reference types="react" />
8
8
  import { PolymorphicProps } from '../../types/common';
9
- interface GridBaseProps {
9
+ export interface GridBaseProps {
10
10
  /**
11
11
  * Pass in content that will be rendered within the `Grid`
12
12
  */
@@ -34,4 +34,3 @@ export type GridProps<T extends React.ElementType> = PolymorphicProps<T, GridBas
34
34
  export interface GridComponent {
35
35
  <T extends React.ElementType>(props: GridProps<T>, context?: any): React.ReactElement<any, any> | null;
36
36
  }
37
- export {};
@@ -4,9 +4,11 @@
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 GridProps } from './GridTypes';
8
+ export { type GridProps };
7
9
  export { FlexGrid } from './FlexGrid';
8
10
  export { Grid } from './Grid';
9
11
  export { default as Row } from './Row';
10
- export { default as Column } from './Column';
12
+ export { default as Column, type ColumnProps } from './Column';
11
13
  export { ColumnHang } from './ColumnHang';
12
14
  export { GridSettings } from './GridContext';
@@ -4,6 +4,6 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import InlineLoading from './InlineLoading';
7
+ import InlineLoading, { type InlineLoadingProps } from './InlineLoading';
8
8
  export default InlineLoading;
9
- export { InlineLoading };
9
+ export { InlineLoading, type InlineLoadingProps };
@@ -4,6 +4,6 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import Loading from './Loading';
7
+ import Loading, { type LoadingProps } from './Loading';
8
8
  export default Loading;
9
- export { Loading };
9
+ export { Loading, type LoadingProps };
@@ -4,6 +4,6 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import Modal from './Modal';
7
+ import Modal, { type ModalProps } from './Modal';
8
8
  export default Modal;
9
- export { Modal };
9
+ export { Modal, type ModalProps };
@@ -133,4 +133,15 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
133
133
  warnText?: ReactNode;
134
134
  }
135
135
  declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
136
+ export interface Label {
137
+ disabled?: boolean;
138
+ hideLabel?: boolean;
139
+ id?: string;
140
+ label?: ReactNode;
141
+ }
142
+ export interface HelperTextProps {
143
+ id?: string;
144
+ description?: ReactNode;
145
+ disabled?: boolean;
146
+ }
136
147
  export { NumberInput };
@@ -387,7 +387,7 @@ NumberInput.propTypes = {
387
387
  */
388
388
  warnText: PropTypes.node
389
389
  };
390
- function Label(_ref) {
390
+ const Label = _ref => {
391
391
  let {
392
392
  disabled,
393
393
  id,
@@ -408,7 +408,7 @@ function Label(_ref) {
408
408
  }, label);
409
409
  }
410
410
  return null;
411
- }
411
+ };
412
412
  Label.propTypes = {
413
413
  disabled: PropTypes.bool,
414
414
  hideLabel: PropTypes.bool,
@@ -5,4 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  export { default as NumberInputSkeleton } from './NumberInput.Skeleton';
8
- export { NumberInput } from './NumberInput';
8
+ export { NumberInput, type NumberInputProps } from './NumberInput';
@@ -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, { ComponentType } from 'react';
9
9
  /**
10
10
  * @param {Element} menuBody The menu body with the menu arrow.
11
11
  * @param {string} direction The floating menu direction.
@@ -17,14 +17,18 @@ export declare const getMenuOffset: (menuBody: any, direction: any, trigger: any
17
17
  top: number;
18
18
  } | undefined;
19
19
  interface Offset {
20
- top: number;
21
- left: number;
20
+ top?: number | null | undefined;
21
+ left?: number | null | undefined;
22
22
  }
23
- interface OverflowMenuProps {
23
+ type IconProps = {
24
+ className?: string;
25
+ 'aria-label'?: string;
26
+ };
27
+ export interface OverflowMenuProps {
24
28
  /**
25
29
  * Specify a label to be read by screen readers on the container node
26
30
  */
27
- ['aria-label']: string;
31
+ ['aria-label']?: string;
28
32
  /**
29
33
  * Deprecated, please use `aria-label` instead.
30
34
  * Specify a label to be read by screen readers on the container note.
@@ -99,7 +103,7 @@ interface OverflowMenuProps {
99
103
  /**
100
104
  * Function called to override icon rendering.
101
105
  */
102
- renderIcon?: React.ElementType;
106
+ renderIcon?: ComponentType<IconProps>;
103
107
  /**
104
108
  * Specify a CSS selector that matches the DOM element that should
105
109
  * be focused when the OverflowMenu opens
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { type OverflowMenuProps } from './OverflowMenu';
8
+ declare function OverflowMenu(props: any): import("react/jsx-runtime").JSX.Element;
9
+ declare namespace OverflowMenu {
10
+ var displayName: string;
11
+ }
12
+ export default OverflowMenu;
13
+ export { OverflowMenu, type OverflowMenuProps };
@@ -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 ProgressBarProps {
8
+ export interface ProgressBarProps {
9
9
  /**
10
10
  * Additional CSS class names.
11
11
  */
@@ -4,6 +4,6 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import ProgressBar from './ProgressBar';
7
+ import ProgressBar, { type ProgressBarProps } from './ProgressBar';
8
8
  export default ProgressBar;
9
- export { ProgressBar };
9
+ export { ProgressBar, type ProgressBarProps };
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import React from 'react';
9
- interface ProgressIndicatorProps extends Omit<React.HTMLAttributes<HTMLUListElement>, 'onChange'> {
9
+ export interface ProgressIndicatorProps extends Omit<React.HTMLAttributes<HTMLUListElement>, 'onChange'> {
10
10
  /**
11
11
  * Provide `<ProgressStep>` components to be rendered in the
12
12
  * `<ProgressIndicator>`
@@ -63,7 +63,7 @@ declare namespace ProgressIndicator {
63
63
  vertical: PropTypes.Requireable<boolean>;
64
64
  };
65
65
  }
66
- interface ProgressStepProps {
66
+ export interface ProgressStepProps {
67
67
  /**
68
68
  * Provide an optional className to be applied to the containing `<li>` node
69
69
  */
@@ -4,5 +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 { type ProgressIndicatorProps, type ProgressStepProps } from './ProgressIndicator';
7
8
  export { default as ProgressIndicatorSkeleton } from './ProgressIndicator.Skeleton';
8
9
  export * from './ProgressIndicator';
10
+ export { type ProgressIndicatorProps, type ProgressStepProps };
@@ -4,5 +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 { type StructuredListWrapperProps } from './StructuredList';
7
8
  export * from './StructuredList';
8
9
  export { default as StructuredListSkeleton, type StructuredListSkeletonProps, } from './StructuredList.Skeleton';
10
+ export { type StructuredListWrapperProps };
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { ButtonHTMLAttributes, ReactNode } from 'react';
8
- interface SwitchEventHandlersParams {
8
+ export interface SwitchEventHandlersParams {
9
9
  index?: number;
10
10
  name?: string | number;
11
11
  text?: string;
@@ -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 Switch from './Switch';
7
+ import Switch, { type SwitchProps } from './Switch';
8
8
  import IconSwitch from './IconSwitch';
9
9
  export default Switch;
10
- export { Switch, IconSwitch };
10
+ export { Switch, IconSwitch, type SwitchProps };
@@ -5,5 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { Tab } from '../Tabs/Tabs';
8
+ import { type TabProps } from '../Tabs/Tabs';
8
9
  export default Tab;
9
- export { Tab };
10
+ export { Tab, type TabProps };
@@ -9,10 +9,6 @@ import React, { ReactNode } from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
10
  import { SIZES, TYPES } from './Tag';
11
11
  export interface DismissibleTagBaseProps {
12
- /**
13
- * Provide content to be rendered inside of a `DismissibleTag`
14
- */
15
- children?: React.ReactNode;
16
12
  /**
17
13
  * Provide a custom className that is applied to the containing <span>
18
14
  */
@@ -43,6 +39,10 @@ export interface DismissibleTagBaseProps {
43
39
  * **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
44
40
  */
45
41
  slug?: ReactNode;
42
+ /**
43
+ * Provide text to be rendered inside of a the tag.
44
+ */
45
+ text?: string;
46
46
  /**
47
47
  * Text to show on clear filters
48
48
  */
@@ -54,12 +54,8 @@ export interface DismissibleTagBaseProps {
54
54
  }
55
55
  export type DismissibleTagProps<T extends React.ElementType> = PolymorphicProps<T, DismissibleTagBaseProps>;
56
56
  declare const DismissibleTag: {
57
- <T extends React.ElementType<any>>({ children, className, disabled, id, renderIcon, title, onClose, slug, size, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
57
+ <T extends React.ElementType<any>>({ className, disabled, id, renderIcon, title, onClose, slug, size, text, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
58
58
  propTypes: {
59
- /**
60
- * Provide content to be rendered inside of a `DismissibleTag`
61
- */
62
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
63
59
  /**
64
60
  * Provide a custom className that is applied to the containing <span>
65
61
  */
@@ -90,6 +86,10 @@ declare const DismissibleTag: {
90
86
  * **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
91
87
  */
92
88
  slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
89
+ /**
90
+ * Provide text to be rendered inside of a the tag.
91
+ */
92
+ text: PropTypes.Requireable<string>;
93
93
  /**
94
94
  * Text to show on clear filters
95
95
  */
@@ -7,32 +7,46 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default from 'react';
10
+ import React__default, { useState, useLayoutEffect } from 'react';
11
11
  import cx from 'classnames';
12
12
  import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import Tag, { SIZES, TYPES } from './Tag.js';
15
15
  import { Close } from '@carbon/icons-react';
16
+ import '../Tooltip/DefinitionTooltip.js';
17
+ import { Tooltip } from '../Tooltip/Tooltip.js';
18
+ import '../Text/index.js';
19
+ import { Text } from '../Text/Text.js';
16
20
 
17
21
  var _Close;
18
22
  const getInstanceId = setupGetInstanceId();
19
23
  const DismissibleTag = _ref => {
20
24
  let {
21
- children,
22
25
  className,
23
26
  disabled,
24
27
  id,
25
28
  renderIcon,
26
- title = 'Clear filter',
29
+ title = 'Dismiss',
27
30
  onClose,
28
31
  slug,
29
32
  size,
33
+ text,
30
34
  type,
31
35
  ...other
32
36
  } = _ref;
33
37
  const prefix = usePrefix();
34
38
  const tagId = id || `tag-${getInstanceId()}`;
35
39
  const tagClasses = cx(`${prefix}--tag--filter`, className);
40
+ const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
41
+ const isEllipsisActive = element => {
42
+ setIsEllipsisApplied(element.offsetWidth < element.scrollWidth);
43
+ return element.offsetWidth < element.scrollWidth;
44
+ };
45
+ useLayoutEffect(() => {
46
+ const elementTagId = document.querySelector(`#${tagId}`);
47
+ const newElement = elementTagId?.getElementsByClassName(`${prefix}--tag__label`)[0];
48
+ isEllipsisActive(newElement);
49
+ }, [prefix, tagId]);
36
50
  const handleClose = event => {
37
51
  if (onClose) {
38
52
  event.stopPropagation();
@@ -46,6 +60,7 @@ const DismissibleTag = _ref => {
46
60
  kind: 'inline'
47
61
  });
48
62
  }
63
+ const tooltipClasses = cx(`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
49
64
 
50
65
  // Removing onClick from the spread operator
51
66
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -53,6 +68,7 @@ const DismissibleTag = _ref => {
53
68
  onClick,
54
69
  ...otherProps
55
70
  } = other;
71
+ const dismissLabel = `Dismiss "${text}"`;
56
72
  return /*#__PURE__*/React__default.createElement(Tag, _extends({
57
73
  type: type,
58
74
  size: size,
@@ -62,20 +78,25 @@ const DismissibleTag = _ref => {
62
78
  id: tagId
63
79
  }, otherProps), /*#__PURE__*/React__default.createElement("div", {
64
80
  className: `${prefix}--interactive--tag-children`
65
- }, children, normalizedSlug, /*#__PURE__*/React__default.createElement("button", {
81
+ }, /*#__PURE__*/React__default.createElement(Text, {
82
+ title: text,
83
+ className: `${prefix}--tag__label`
84
+ }, text), /*#__PURE__*/React__default.createElement(Tooltip, {
85
+ label: isEllipsisApplied ? dismissLabel : title,
86
+ align: "bottom",
87
+ className: tooltipClasses,
88
+ leaveDelayMs: 0,
89
+ closeOnActivation: true
90
+ }, /*#__PURE__*/React__default.createElement("button", {
66
91
  type: "button",
67
92
  className: `${prefix}--tag__close-icon`,
68
93
  onClick: handleClose,
69
94
  disabled: disabled,
70
95
  "aria-label": title,
71
96
  title: title
72
- }, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null)))));
97
+ }, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null)))), normalizedSlug));
73
98
  };
74
99
  DismissibleTag.propTypes = {
75
- /**
76
- * Provide content to be rendered inside of a `DismissibleTag`
77
- */
78
- children: PropTypes.node,
79
100
  /**
80
101
  * Provide a custom className that is applied to the containing <span>
81
102
  */
@@ -106,6 +127,10 @@ DismissibleTag.propTypes = {
106
127
  * **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
107
128
  */
108
129
  slug: PropTypes.node,
130
+ /**
131
+ * Provide text to be rendered inside of a the tag.
132
+ */
133
+ text: PropTypes.string,
109
134
  /**
110
135
  * Text to show on clear filters
111
136
  */
@@ -21,10 +21,6 @@ declare const TYPES: {
21
21
  'warm-gray': string;
22
22
  };
23
23
  export interface OperationalTagBaseProps {
24
- /**
25
- * Provide content to be rendered inside of a `OperationalTag`
26
- */
27
- children?: React.ReactNode;
28
24
  /**
29
25
  * Provide a custom className that is applied to the containing <span>
30
26
  */
@@ -52,6 +48,10 @@ export interface OperationalTagBaseProps {
52
48
  * **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
53
49
  */
54
50
  slug?: ReactNode;
51
+ /**
52
+ * Provide text to be rendered inside of a the tag.
53
+ */
54
+ text?: string;
55
55
  /**
56
56
  * Specify the type of the `Tag`
57
57
  */
@@ -59,12 +59,8 @@ export interface OperationalTagBaseProps {
59
59
  }
60
60
  export type OperationalTagProps<T extends React.ElementType> = PolymorphicProps<T, OperationalTagBaseProps>;
61
61
  declare const OperationalTag: {
62
- <T extends React.ElementType<any>>({ children, className, disabled, id, renderIcon, slug, size, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
62
+ <T extends React.ElementType<any>>({ className, disabled, id, renderIcon, slug, size, text, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
63
63
  propTypes: {
64
- /**
65
- * Provide content to be rendered inside of a `OperationalTag`
66
- */
67
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
68
64
  /**
69
65
  * Provide a custom className that is applied to the containing <span>
70
66
  */
@@ -91,6 +87,10 @@ declare const OperationalTag: {
91
87
  * **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
92
88
  */
93
89
  slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
90
+ /**
91
+ * Provide text to be rendered inside of a the tag.
92
+ */
93
+ text: PropTypes.Requireable<string>;
94
94
  /**
95
95
  * Specify the type of the `Tag`
96
96
  */
@@ -7,11 +7,15 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default from 'react';
10
+ import React__default, { useState, useLayoutEffect } from 'react';
11
11
  import cx from 'classnames';
12
12
  import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import Tag, { SIZES } from './Tag.js';
15
+ import '../Tooltip/DefinitionTooltip.js';
16
+ import { Tooltip } from '../Tooltip/Tooltip.js';
17
+ import '../Text/index.js';
18
+ import { Text } from '../Text/Text.js';
15
19
 
16
20
  const getInstanceId = setupGetInstanceId();
17
21
  const TYPES = {
@@ -28,19 +32,29 @@ const TYPES = {
28
32
  };
29
33
  const OperationalTag = _ref => {
30
34
  let {
31
- children,
32
35
  className,
33
36
  disabled,
34
37
  id,
35
38
  renderIcon,
36
39
  slug,
37
40
  size,
41
+ text,
38
42
  type = 'gray',
39
43
  ...other
40
44
  } = _ref;
41
45
  const prefix = usePrefix();
42
46
  const tagId = id || `tag-${getInstanceId()}`;
43
47
  const tagClasses = cx(`${prefix}--tag--operational`, className);
48
+ const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
49
+ const isEllipsisActive = element => {
50
+ setIsEllipsisApplied(element.offsetWidth < element.scrollWidth);
51
+ return element.offsetWidth < element.scrollWidth;
52
+ };
53
+ useLayoutEffect(() => {
54
+ const elementTagId = document.querySelector(`#${tagId}`);
55
+ const newElement = elementTagId?.getElementsByClassName(`${prefix}--tag__label`)[0];
56
+ isEllipsisActive(newElement);
57
+ }, [prefix, tagId]);
44
58
  let normalizedSlug;
45
59
  if (slug && slug['type']?.displayName === 'Slug') {
46
60
  normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
@@ -48,6 +62,27 @@ const OperationalTag = _ref => {
48
62
  kind: 'inline'
49
63
  });
50
64
  }
65
+ const tooltipClasses = cx(`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
66
+ if (isEllipsisApplied) {
67
+ return /*#__PURE__*/React__default.createElement(Tooltip, {
68
+ label: text,
69
+ align: "bottom",
70
+ className: tooltipClasses,
71
+ leaveDelayMs: 0,
72
+ onMouseEnter: false,
73
+ closeOnActivation: true
74
+ }, /*#__PURE__*/React__default.createElement(Tag, _extends({
75
+ type: type,
76
+ size: size,
77
+ renderIcon: renderIcon,
78
+ disabled: disabled,
79
+ className: tagClasses,
80
+ id: tagId
81
+ }, other), /*#__PURE__*/React__default.createElement(Text, {
82
+ title: text,
83
+ className: `${prefix}--tag__label`
84
+ }, text), normalizedSlug));
85
+ }
51
86
  return /*#__PURE__*/React__default.createElement(Tag, _extends({
52
87
  type: type,
53
88
  size: size,
@@ -55,15 +90,12 @@ const OperationalTag = _ref => {
55
90
  disabled: disabled,
56
91
  className: tagClasses,
57
92
  id: tagId
58
- }, other), /*#__PURE__*/React__default.createElement("div", {
59
- className: `${prefix}--interactive--tag-children`
60
- }, children, normalizedSlug));
93
+ }, other), normalizedSlug, /*#__PURE__*/React__default.createElement(Text, {
94
+ title: text,
95
+ className: `${prefix}--tag__label`
96
+ }, text));
61
97
  };
62
98
  OperationalTag.propTypes = {
63
- /**
64
- * Provide content to be rendered inside of a `OperationalTag`
65
- */
66
- children: PropTypes.node,
67
99
  /**
68
100
  * Provide a custom className that is applied to the containing <span>
69
101
  */
@@ -90,6 +122,10 @@ OperationalTag.propTypes = {
90
122
  * **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
91
123
  */
92
124
  slug: PropTypes.node,
125
+ /**
126
+ * Provide text to be rendered inside of a the tag.
127
+ */
128
+ text: PropTypes.string,
93
129
  /**
94
130
  * Specify the type of the `Tag`
95
131
  */