@carbon/react 1.58.0-rc.0 → 1.58.1

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 (86) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +983 -920
  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 +32 -9
  29. package/es/components/Tag/OperationalTag.d.ts +9 -9
  30. package/es/components/Tag/OperationalTag.js +44 -9
  31. package/es/components/Tag/SelectableTag.d.ts +9 -9
  32. package/es/components/Tag/SelectableTag.js +45 -10
  33. package/es/components/Tag/Tag.d.ts +4 -60
  34. package/es/components/Tag/Tag.js +36 -10
  35. package/es/components/Tag/isEllipsisActive.d.ts +7 -0
  36. package/es/components/Tag/isEllipsisActive.js +15 -0
  37. package/es/components/TextArea/index.d.ts +2 -2
  38. package/es/components/TextInput/index.d.ts +4 -2
  39. package/es/components/TileGroup/index.d.ts +2 -2
  40. package/es/components/Tooltip/Tooltip.js +16 -5
  41. package/es/components/Tooltip/index.d.ts +2 -2
  42. package/es/components/UnorderedList/UnorderedList.d.ts +1 -1
  43. package/es/components/UnorderedList/index.d.ts +1 -0
  44. package/lib/components/Accordion/Accordion.d.ts +1 -1
  45. package/lib/components/Accordion/index.d.ts +2 -2
  46. package/lib/components/Button/index.d.ts +2 -1
  47. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  48. package/lib/components/Dropdown/index.d.ts +2 -2
  49. package/lib/components/FormLabel/index.d.ts +2 -2
  50. package/lib/components/Grid/Column.d.ts +2 -2
  51. package/lib/components/Grid/GridTypes.d.ts +1 -2
  52. package/lib/components/Grid/index.d.ts +3 -1
  53. package/lib/components/InlineLoading/index.d.ts +2 -2
  54. package/lib/components/Loading/index.d.ts +2 -2
  55. package/lib/components/Modal/index.d.ts +2 -2
  56. package/lib/components/NumberInput/NumberInput.d.ts +11 -0
  57. package/lib/components/NumberInput/NumberInput.js +2 -2
  58. package/lib/components/NumberInput/index.d.ts +1 -1
  59. package/lib/components/OverflowMenu/OverflowMenu.d.ts +10 -6
  60. package/lib/components/OverflowMenu/index.d.ts +13 -0
  61. package/lib/components/ProgressBar/ProgressBar.d.ts +1 -1
  62. package/lib/components/ProgressBar/index.d.ts +2 -2
  63. package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +2 -2
  64. package/lib/components/ProgressIndicator/index.d.ts +2 -0
  65. package/lib/components/StructuredList/index.d.ts +2 -0
  66. package/lib/components/Switch/Switch.d.ts +1 -1
  67. package/lib/components/Switch/index.d.ts +2 -2
  68. package/lib/components/Tab/index.d.ts +2 -1
  69. package/lib/components/Tag/DismissibleTag.d.ts +9 -9
  70. package/lib/components/Tag/DismissibleTag.js +31 -8
  71. package/lib/components/Tag/OperationalTag.d.ts +9 -9
  72. package/lib/components/Tag/OperationalTag.js +43 -8
  73. package/lib/components/Tag/SelectableTag.d.ts +9 -9
  74. package/lib/components/Tag/SelectableTag.js +44 -9
  75. package/lib/components/Tag/Tag.d.ts +4 -60
  76. package/lib/components/Tag/Tag.js +35 -9
  77. package/lib/components/Tag/isEllipsisActive.d.ts +7 -0
  78. package/lib/components/Tag/isEllipsisActive.js +19 -0
  79. package/lib/components/TextArea/index.d.ts +2 -2
  80. package/lib/components/TextInput/index.d.ts +4 -2
  81. package/lib/components/TileGroup/index.d.ts +2 -2
  82. package/lib/components/Tooltip/Tooltip.js +16 -5
  83. package/lib/components/Tooltip/index.d.ts +2 -2
  84. package/lib/components/UnorderedList/UnorderedList.d.ts +1 -1
  85. package/lib/components/UnorderedList/index.d.ts +1 -0
  86. package/package.json +5 -5
@@ -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 };
@@ -397,7 +397,7 @@ NumberInput.propTypes = {
397
397
  */
398
398
  warnText: PropTypes__default["default"].node
399
399
  };
400
- function Label(_ref) {
400
+ const Label = _ref => {
401
401
  let {
402
402
  disabled,
403
403
  id,
@@ -418,7 +418,7 @@ function Label(_ref) {
418
418
  }, label);
419
419
  }
420
420
  return null;
421
- }
421
+ };
422
422
  Label.propTypes = {
423
423
  disabled: PropTypes__default["default"].bool,
424
424
  hideLabel: PropTypes__default["default"].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
  */
@@ -17,6 +17,11 @@ var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
17
17
  var usePrefix = require('../../internal/usePrefix.js');
18
18
  var Tag = require('./Tag.js');
19
19
  var iconsReact = require('@carbon/icons-react');
20
+ require('../Tooltip/DefinitionTooltip.js');
21
+ var Tooltip = require('../Tooltip/Tooltip.js');
22
+ require('../Text/index.js');
23
+ var isEllipsisActive = require('./isEllipsisActive.js');
24
+ var Text = require('../Text/Text.js');
20
25
 
21
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
27
 
@@ -28,21 +33,27 @@ var _Close;
28
33
  const getInstanceId = setupGetInstanceId["default"]();
29
34
  const DismissibleTag = _ref => {
30
35
  let {
31
- children,
32
36
  className,
33
37
  disabled,
34
38
  id,
35
39
  renderIcon,
36
- title = 'Clear filter',
40
+ title = 'Dismiss',
37
41
  onClose,
38
42
  slug,
39
43
  size,
44
+ text,
40
45
  type,
41
46
  ...other
42
47
  } = _ref;
43
48
  const prefix = usePrefix.usePrefix();
49
+ const tagLabelRef = React.useRef();
44
50
  const tagId = id || `tag-${getInstanceId()}`;
45
51
  const tagClasses = cx__default["default"](`${prefix}--tag--filter`, className);
52
+ const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
53
+ React.useLayoutEffect(() => {
54
+ const newElement = tagLabelRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
55
+ setIsEllipsisApplied(isEllipsisActive.isEllipsisActive(newElement));
56
+ }, [prefix, tagLabelRef]);
46
57
  const handleClose = event => {
47
58
  if (onClose) {
48
59
  event.stopPropagation();
@@ -56,6 +67,7 @@ const DismissibleTag = _ref => {
56
67
  kind: 'inline'
57
68
  });
58
69
  }
70
+ const tooltipClasses = cx__default["default"](`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
59
71
 
60
72
  // Removing onClick from the spread operator
61
73
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -63,7 +75,9 @@ const DismissibleTag = _ref => {
63
75
  onClick,
64
76
  ...otherProps
65
77
  } = other;
78
+ const dismissLabel = `Dismiss "${text}"`;
66
79
  return /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
80
+ ref: tagLabelRef,
67
81
  type: type,
68
82
  size: size,
69
83
  renderIcon: renderIcon,
@@ -72,20 +86,25 @@ const DismissibleTag = _ref => {
72
86
  id: tagId
73
87
  }, otherProps), /*#__PURE__*/React__default["default"].createElement("div", {
74
88
  className: `${prefix}--interactive--tag-children`
75
- }, children, normalizedSlug, /*#__PURE__*/React__default["default"].createElement("button", {
89
+ }, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
90
+ title: text,
91
+ className: `${prefix}--tag__label`
92
+ }, text), /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
93
+ label: isEllipsisApplied ? dismissLabel : title,
94
+ align: "bottom",
95
+ className: tooltipClasses,
96
+ leaveDelayMs: 0,
97
+ closeOnActivation: true
98
+ }, /*#__PURE__*/React__default["default"].createElement("button", {
76
99
  type: "button",
77
100
  className: `${prefix}--tag__close-icon`,
78
101
  onClick: handleClose,
79
102
  disabled: disabled,
80
103
  "aria-label": title,
81
104
  title: title
82
- }, _Close || (_Close = /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, null)))));
105
+ }, _Close || (_Close = /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, null)))), normalizedSlug));
83
106
  };
84
107
  DismissibleTag.propTypes = {
85
- /**
86
- * Provide content to be rendered inside of a `DismissibleTag`
87
- */
88
- children: PropTypes__default["default"].node,
89
108
  /**
90
109
  * Provide a custom className that is applied to the containing <span>
91
110
  */
@@ -116,6 +135,10 @@ DismissibleTag.propTypes = {
116
135
  * **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
117
136
  */
118
137
  slug: PropTypes__default["default"].node,
138
+ /**
139
+ * Provide text to be rendered inside of a the tag.
140
+ */
141
+ text: PropTypes__default["default"].string,
119
142
  /**
120
143
  * Text to show on clear filters
121
144
  */
@@ -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
  */
@@ -16,6 +16,11 @@ var cx = require('classnames');
16
16
  var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
17
17
  var usePrefix = require('../../internal/usePrefix.js');
18
18
  var Tag = require('./Tag.js');
19
+ require('../Tooltip/DefinitionTooltip.js');
20
+ var Tooltip = require('../Tooltip/Tooltip.js');
21
+ require('../Text/index.js');
22
+ var isEllipsisActive = require('./isEllipsisActive.js');
23
+ var Text = require('../Text/Text.js');
19
24
 
20
25
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
26
 
@@ -38,19 +43,25 @@ const TYPES = {
38
43
  };
39
44
  const OperationalTag = _ref => {
40
45
  let {
41
- children,
42
46
  className,
43
47
  disabled,
44
48
  id,
45
49
  renderIcon,
46
50
  slug,
47
51
  size,
52
+ text,
48
53
  type = 'gray',
49
54
  ...other
50
55
  } = _ref;
51
56
  const prefix = usePrefix.usePrefix();
57
+ const tagRef = React.useRef();
52
58
  const tagId = id || `tag-${getInstanceId()}`;
53
59
  const tagClasses = cx__default["default"](`${prefix}--tag--operational`, className);
60
+ const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
61
+ React.useLayoutEffect(() => {
62
+ const newElement = tagRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
63
+ setIsEllipsisApplied(isEllipsisActive.isEllipsisActive(newElement));
64
+ }, [prefix, tagRef]);
54
65
  let normalizedSlug;
55
66
  if (slug && slug['type']?.displayName === 'Slug') {
56
67
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
@@ -58,22 +69,42 @@ const OperationalTag = _ref => {
58
69
  kind: 'inline'
59
70
  });
60
71
  }
72
+ const tooltipClasses = cx__default["default"](`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
73
+ if (isEllipsisApplied) {
74
+ return /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
75
+ label: text,
76
+ align: "bottom",
77
+ className: tooltipClasses,
78
+ leaveDelayMs: 0,
79
+ onMouseEnter: () => false,
80
+ closeOnActivation: true
81
+ }, /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
82
+ ref: tagRef,
83
+ type: type,
84
+ size: size,
85
+ renderIcon: renderIcon,
86
+ disabled: disabled,
87
+ className: tagClasses,
88
+ id: tagId
89
+ }, other), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
90
+ title: text,
91
+ className: `${prefix}--tag__label`
92
+ }, text), normalizedSlug));
93
+ }
61
94
  return /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
95
+ ref: tagRef,
62
96
  type: type,
63
97
  size: size,
64
98
  renderIcon: renderIcon,
65
99
  disabled: disabled,
66
100
  className: tagClasses,
67
101
  id: tagId
68
- }, other), /*#__PURE__*/React__default["default"].createElement("div", {
69
- className: `${prefix}--interactive--tag-children`
70
- }, children, normalizedSlug));
102
+ }, other), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
103
+ title: text,
104
+ className: `${prefix}--tag__label`
105
+ }, text));
71
106
  };
72
107
  OperationalTag.propTypes = {
73
- /**
74
- * Provide content to be rendered inside of a `OperationalTag`
75
- */
76
- children: PropTypes__default["default"].node,
77
108
  /**
78
109
  * Provide a custom className that is applied to the containing <span>
79
110
  */
@@ -100,6 +131,10 @@ OperationalTag.propTypes = {
100
131
  * **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
101
132
  */
102
133
  slug: PropTypes__default["default"].node,
134
+ /**
135
+ * Provide text to be rendered inside of a the tag.
136
+ */
137
+ text: PropTypes__default["default"].string,
103
138
  /**
104
139
  * Specify the type of the `Tag`
105
140
  */
@@ -9,10 +9,6 @@ import React, { ReactNode } from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
10
  import { SIZES } from './Tag';
11
11
  export interface SelectableTagBaseProps {
12
- /**
13
- * Provide content to be rendered inside of a `SelectableTag`
14
- */
15
- children?: React.ReactNode;
16
12
  /**
17
13
  * Provide a custom className that is applied to the containing <span>
18
14
  */
@@ -43,15 +39,15 @@ export interface SelectableTagBaseProps {
43
39
  * **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` 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
  export type SelectableTagProps<T extends React.ElementType> = PolymorphicProps<T, SelectableTagBaseProps>;
48
48
  declare const SelectableTag: {
49
- <T extends React.ElementType<any>>({ children, className, disabled, id, renderIcon, selected, slug, size, ...other }: SelectableTagProps<T>): import("react/jsx-runtime").JSX.Element;
49
+ <T extends React.ElementType<any>>({ className, disabled, id, renderIcon, selected, slug, size, text, ...other }: SelectableTagProps<T>): import("react/jsx-runtime").JSX.Element;
50
50
  propTypes: {
51
- /**
52
- * Provide content to be rendered inside of a `SelectableTag`
53
- */
54
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
55
51
  /**
56
52
  * Provide a custom className that is applied to the containing <span>
57
53
  */
@@ -82,6 +78,10 @@ declare const SelectableTag: {
82
78
  * **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
83
79
  */
84
80
  slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
81
+ /**
82
+ * Provide text to be rendered inside of a the tag.
83
+ */
84
+ text: PropTypes.Requireable<string>;
85
85
  };
86
86
  };
87
87
  export default SelectableTag;
@@ -16,6 +16,11 @@ var cx = require('classnames');
16
16
  var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
17
17
  var usePrefix = require('../../internal/usePrefix.js');
18
18
  var Tag = require('./Tag.js');
19
+ require('../Tooltip/DefinitionTooltip.js');
20
+ var Tooltip = require('../Tooltip/Tooltip.js');
21
+ require('../Text/index.js');
22
+ var isEllipsisActive = require('./isEllipsisActive.js');
23
+ var Text = require('../Text/Text.js');
19
24
 
20
25
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
26
 
@@ -26,7 +31,6 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
26
31
  const getInstanceId = setupGetInstanceId["default"]();
27
32
  const SelectableTag = _ref => {
28
33
  let {
29
- children,
30
34
  className,
31
35
  disabled,
32
36
  id,
@@ -34,14 +38,21 @@ const SelectableTag = _ref => {
34
38
  selected = false,
35
39
  slug,
36
40
  size,
41
+ text,
37
42
  ...other
38
43
  } = _ref;
39
44
  const prefix = usePrefix.usePrefix();
45
+ const tagRef = React.useRef();
40
46
  const tagId = id || `tag-${getInstanceId()}`;
41
47
  const [selectedTag, setSelectedTag] = React.useState(selected);
42
48
  const tagClasses = cx__default["default"](`${prefix}--tag--selectable`, className, {
43
49
  [`${prefix}--tag--selectable-selected`]: selectedTag
44
50
  });
51
+ const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
52
+ React.useLayoutEffect(() => {
53
+ const newElement = tagRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
54
+ setIsEllipsisApplied(isEllipsisActive.isEllipsisActive(newElement));
55
+ }, [prefix, tagRef]);
45
56
  let normalizedSlug;
46
57
  if (slug && slug['type']?.displayName === 'Slug') {
47
58
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
@@ -49,6 +60,7 @@ const SelectableTag = _ref => {
49
60
  kind: 'inline'
50
61
  });
51
62
  }
63
+ const tooltipClasses = cx__default["default"](`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
52
64
 
53
65
  // Removing onClick from the spread operator
54
66
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -56,7 +68,29 @@ const SelectableTag = _ref => {
56
68
  onClick,
57
69
  ...otherProps
58
70
  } = other;
71
+ if (isEllipsisApplied) {
72
+ return /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
73
+ label: text,
74
+ align: "bottom",
75
+ className: tooltipClasses,
76
+ leaveDelayMs: 0,
77
+ onMouseEnter: () => false
78
+ }, /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
79
+ ref: tagRef,
80
+ slug: slug,
81
+ size: size,
82
+ renderIcon: renderIcon,
83
+ disabled: disabled,
84
+ className: tagClasses,
85
+ id: tagId,
86
+ onClick: () => setSelectedTag(!selectedTag)
87
+ }, otherProps), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
88
+ title: text,
89
+ className: `${prefix}--tag__label`
90
+ }, text), normalizedSlug));
91
+ }
59
92
  return /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
93
+ ref: tagRef,
60
94
  slug: slug,
61
95
  size: size,
62
96
  renderIcon: renderIcon,
@@ -64,15 +98,12 @@ const SelectableTag = _ref => {
64
98
  className: tagClasses,
65
99
  id: tagId,
66
100
  onClick: () => setSelectedTag(!selectedTag)
67
- }, otherProps), /*#__PURE__*/React__default["default"].createElement("div", {
68
- className: `${prefix}--interactive--tag-children`
69
- }, children, normalizedSlug));
101
+ }, otherProps), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
102
+ title: text,
103
+ className: `${prefix}--tag__label`
104
+ }, text));
70
105
  };
71
106
  SelectableTag.propTypes = {
72
- /**
73
- * Provide content to be rendered inside of a `SelectableTag`
74
- */
75
- children: PropTypes__default["default"].node,
76
107
  /**
77
108
  * Provide a custom className that is applied to the containing <span>
78
109
  */
@@ -102,7 +133,11 @@ SelectableTag.propTypes = {
102
133
  /**
103
134
  * **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
104
135
  */
105
- slug: PropTypes__default["default"].node
136
+ slug: PropTypes__default["default"].node,
137
+ /**
138
+ * Provide text to be rendered inside of a the tag.
139
+ */
140
+ text: PropTypes__default["default"].string
106
141
  };
107
142
 
108
143
  exports["default"] = SelectableTag;