@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
@@ -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;
@@ -7,16 +7,20 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default, { useState } from 'react';
10
+ import React__default, { useRef, 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 { isEllipsisActive } from './isEllipsisActive.js';
19
+ import { Text } from '../Text/Text.js';
15
20
 
16
21
  const getInstanceId = setupGetInstanceId();
17
22
  const SelectableTag = _ref => {
18
23
  let {
19
- children,
20
24
  className,
21
25
  disabled,
22
26
  id,
@@ -24,14 +28,21 @@ const SelectableTag = _ref => {
24
28
  selected = false,
25
29
  slug,
26
30
  size,
31
+ text,
27
32
  ...other
28
33
  } = _ref;
29
34
  const prefix = usePrefix();
35
+ const tagRef = useRef();
30
36
  const tagId = id || `tag-${getInstanceId()}`;
31
37
  const [selectedTag, setSelectedTag] = useState(selected);
32
38
  const tagClasses = cx(`${prefix}--tag--selectable`, className, {
33
39
  [`${prefix}--tag--selectable-selected`]: selectedTag
34
40
  });
41
+ const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
42
+ useLayoutEffect(() => {
43
+ const newElement = tagRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
44
+ setIsEllipsisApplied(isEllipsisActive(newElement));
45
+ }, [prefix, tagRef]);
35
46
  let normalizedSlug;
36
47
  if (slug && slug['type']?.displayName === 'Slug') {
37
48
  normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
@@ -39,6 +50,7 @@ const SelectableTag = _ref => {
39
50
  kind: 'inline'
40
51
  });
41
52
  }
53
+ const tooltipClasses = cx(`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
42
54
 
43
55
  // Removing onClick from the spread operator
44
56
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -46,7 +58,29 @@ const SelectableTag = _ref => {
46
58
  onClick,
47
59
  ...otherProps
48
60
  } = other;
61
+ if (isEllipsisApplied) {
62
+ return /*#__PURE__*/React__default.createElement(Tooltip, {
63
+ label: text,
64
+ align: "bottom",
65
+ className: tooltipClasses,
66
+ leaveDelayMs: 0,
67
+ onMouseEnter: () => false
68
+ }, /*#__PURE__*/React__default.createElement(Tag, _extends({
69
+ ref: tagRef,
70
+ slug: slug,
71
+ size: size,
72
+ renderIcon: renderIcon,
73
+ disabled: disabled,
74
+ className: tagClasses,
75
+ id: tagId,
76
+ onClick: () => setSelectedTag(!selectedTag)
77
+ }, otherProps), /*#__PURE__*/React__default.createElement(Text, {
78
+ title: text,
79
+ className: `${prefix}--tag__label`
80
+ }, text), normalizedSlug));
81
+ }
49
82
  return /*#__PURE__*/React__default.createElement(Tag, _extends({
83
+ ref: tagRef,
50
84
  slug: slug,
51
85
  size: size,
52
86
  renderIcon: renderIcon,
@@ -54,15 +88,12 @@ const SelectableTag = _ref => {
54
88
  className: tagClasses,
55
89
  id: tagId,
56
90
  onClick: () => setSelectedTag(!selectedTag)
57
- }, otherProps), /*#__PURE__*/React__default.createElement("div", {
58
- className: `${prefix}--interactive--tag-children`
59
- }, children, normalizedSlug));
91
+ }, otherProps), normalizedSlug, /*#__PURE__*/React__default.createElement(Text, {
92
+ title: text,
93
+ className: `${prefix}--tag__label`
94
+ }, text));
60
95
  };
61
96
  SelectableTag.propTypes = {
62
- /**
63
- * Provide content to be rendered inside of a `SelectableTag`
64
- */
65
- children: PropTypes.node,
66
97
  /**
67
98
  * Provide a custom className that is applied to the containing <span>
68
99
  */
@@ -92,7 +123,11 @@ SelectableTag.propTypes = {
92
123
  /**
93
124
  * **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
94
125
  */
95
- slug: PropTypes.node
126
+ slug: PropTypes.node,
127
+ /**
128
+ * Provide text to be rendered inside of a the tag.
129
+ */
130
+ text: PropTypes.string
96
131
  };
97
132
 
98
133
  export { SelectableTag as default };
@@ -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, { ReactNode } from 'react';
9
8
  import { PolymorphicProps } from '../../types/common';
10
9
  export declare const TYPES: {
@@ -40,7 +39,7 @@ export interface TagBaseProps {
40
39
  */
41
40
  disabled?: boolean;
42
41
  /**
43
- * @deprecated This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.
42
+ * @deprecated The `filter` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.
44
43
  */
45
44
  filter?: boolean;
46
45
  /**
@@ -48,7 +47,7 @@ export interface TagBaseProps {
48
47
  */
49
48
  id?: string;
50
49
  /**
51
- * @deprecated This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.
50
+ * @deprecated The `onClose` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.
52
51
  */
53
52
  onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
54
53
  /**
@@ -66,7 +65,7 @@ export interface TagBaseProps {
66
65
  */
67
66
  slug?: ReactNode;
68
67
  /**
69
- * @deprecated This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.
68
+ * @deprecated The `title` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.
70
69
  */
71
70
  title?: string;
72
71
  /**
@@ -75,61 +74,6 @@ export interface TagBaseProps {
75
74
  type?: keyof typeof TYPES;
76
75
  }
77
76
  export type TagProps<T extends React.ElementType> = PolymorphicProps<T, TagBaseProps>;
78
- declare const Tag: {
79
- <T extends React.ElementType<any>>({ children, className, id, type, filter, renderIcon: CustomIconElement, title, disabled, onClose, size, as: BaseComponent, slug, ...other }: TagProps<T>): import("react/jsx-runtime").JSX.Element;
80
- propTypes: {
81
- /**
82
- * Provide an alternative tag or component to use instead of the default
83
- * wrapping element
84
- */
85
- as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
86
- /**
87
- * Provide content to be rendered inside of a `Tag`
88
- */
89
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
90
- /**
91
- * Provide a custom className that is applied to the containing <span>
92
- */
93
- className: PropTypes.Requireable<string>;
94
- /**
95
- * Specify if the `Tag` is disabled
96
- */
97
- disabled: PropTypes.Requireable<boolean>;
98
- /**
99
- * Determine if `Tag` is a filter/chip
100
- */
101
- filter: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
102
- /**
103
- * Specify the id for the tag.
104
- */
105
- id: PropTypes.Requireable<string>;
106
- /**
107
- * Click handler for filter tag close button.
108
- */
109
- onClose: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
110
- /**
111
- * Optional prop to render a custom icon.
112
- * Can be a React component class
113
- */
114
- renderIcon: PropTypes.Requireable<object>;
115
- /**
116
- * Specify the size of the Tag. Currently supports either `sm`,
117
- * `md` (default) or `lg` sizes.
118
- */
119
- size: PropTypes.Requireable<string>;
120
- /**
121
- * **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
122
- */
123
- slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
124
- /**
125
- * Text to show on clear filters
126
- */
127
- title: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
128
- /**
129
- * Specify the type of the `Tag`
130
- */
131
- type: PropTypes.Requireable<string>;
132
- };
133
- };
77
+ declare const Tag: React.ForwardRefExoticComponent<Omit<TagProps<React.ElementType<any>>, "ref"> & React.RefAttributes<HTMLElement | undefined>>;
134
78
  export declare const types: string[];
135
79
  export default Tag;
@@ -7,13 +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 from 'react';
10
+ import React__default, { useRef, useState, useLayoutEffect } from 'react';
11
11
  import cx from 'classnames';
12
12
  import { Close } from '@carbon/icons-react';
13
13
  import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
14
14
  import { usePrefix } from '../../internal/usePrefix.js';
15
15
  import '../Text/index.js';
16
16
  import deprecate from '../../prop-types/deprecate.js';
17
+ import { DefinitionTooltip } from '../Tooltip/DefinitionTooltip.js';
18
+ import '../Tooltip/Tooltip.js';
19
+ import { isEllipsisActive } from './isEllipsisActive.js';
20
+ import { useMergeRefs } from '@floating-ui/react';
17
21
  import { Text } from '../Text/Text.js';
18
22
 
19
23
  var _Close;
@@ -37,7 +41,7 @@ const SIZES = {
37
41
  md: 'md',
38
42
  lg: 'lg'
39
43
  };
40
- const Tag = _ref => {
44
+ const Tag = /*#__PURE__*/React__default.forwardRef(function Tag(_ref, forwardRef) {
41
45
  let {
42
46
  children,
43
47
  className,
@@ -57,7 +61,14 @@ const Tag = _ref => {
57
61
  ...other
58
62
  } = _ref;
59
63
  const prefix = usePrefix();
64
+ const tagRef = useRef();
65
+ const ref = useMergeRefs([forwardRef, tagRef]);
60
66
  const tagId = id || `tag-${getInstanceId()}`;
67
+ const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
68
+ useLayoutEffect(() => {
69
+ const newElement = tagRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
70
+ setIsEllipsisApplied(isEllipsisActive(newElement));
71
+ }, [prefix, tagRef]);
61
72
  const conditions = [`${prefix}--tag--selectable`, `${prefix}--tag--filter`, `${prefix}--tag--operational`];
62
73
  const isInteractiveTag = conditions.some(el => className?.includes(el));
63
74
  const tagClasses = cx(`${prefix}--tag`, className, {
@@ -67,7 +78,7 @@ const Tag = _ref => {
67
78
  // TODO: V12 - Remove this class
68
79
  [`${prefix}--layout--size-${size}`]: size,
69
80
  [`${prefix}--tag--${type}`]: type,
70
- [`${prefix}--tag--interactive`]: other.onClick && !isInteractiveTag
81
+ [`${prefix}--tag--interactive`]: other.onClick && !isInteractiveTag && isEllipsisApplied
71
82
  });
72
83
  const typeText = type !== undefined && type in Object.keys(TYPES) ? TYPES[type] : '';
73
84
  const handleClose = event => {
@@ -93,8 +104,8 @@ const Tag = _ref => {
93
104
  }, other), CustomIconElement && size !== 'sm' ? /*#__PURE__*/React__default.createElement("div", {
94
105
  className: `${prefix}--tag__custom-icon`
95
106
  }, /*#__PURE__*/React__default.createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default.createElement(Text, {
96
- className: `${prefix}--tag__label`,
97
- title: typeof children === 'string' ? children : undefined
107
+ title: typeof children === 'string' ? children : undefined,
108
+ className: `${prefix}--tag__label`
98
109
  }, children !== null && children !== undefined ? children : typeText), normalizedSlug, /*#__PURE__*/React__default.createElement("button", {
99
110
  type: "button",
100
111
  className: `${prefix}--tag__close-icon`,
@@ -105,14 +116,29 @@ const Tag = _ref => {
105
116
  }, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null))));
106
117
  }
107
118
  const ComponentTag = BaseComponent ?? (other.onClick || className?.includes(`${prefix}--tag--operational`) ? 'button' : 'div');
119
+ const labelClasses = cx({
120
+ [`${prefix}--tag__label`]: !isInteractiveTag,
121
+ [`${prefix}--tag--${type}`]: type && !isInteractiveTag
122
+ });
108
123
  return /*#__PURE__*/React__default.createElement(ComponentTag, _extends({
124
+ ref: ref,
109
125
  disabled: disabled,
110
126
  className: tagClasses,
111
127
  id: tagId
112
128
  }, other), CustomIconElement && size !== 'sm' ? /*#__PURE__*/React__default.createElement("div", {
113
129
  className: `${prefix}--tag__custom-icon`
114
- }, /*#__PURE__*/React__default.createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default.createElement(Text, null, children !== null && children !== undefined ? children : typeText), normalizedSlug);
115
- };
130
+ }, /*#__PURE__*/React__default.createElement(CustomIconElement, null)) : '', isEllipsisApplied && !isInteractiveTag ? /*#__PURE__*/React__default.createElement(DefinitionTooltip, {
131
+ openOnHover: false,
132
+ definition: children !== null && children !== undefined ? children : typeText,
133
+ className: `${prefix}--definition--tooltip--tag`
134
+ }, /*#__PURE__*/React__default.createElement(Text, {
135
+ title: children !== null && children !== undefined ? children : typeText,
136
+ className: labelClasses
137
+ }, children !== null && children !== undefined ? children : typeText)) : /*#__PURE__*/React__default.createElement(Text, {
138
+ title: children !== null && children !== undefined ? children : typeText,
139
+ className: labelClasses
140
+ }, children !== null && children !== undefined ? children : typeText), normalizedSlug);
141
+ });
116
142
  Tag.propTypes = {
117
143
  /**
118
144
  * Provide an alternative tag or component to use instead of the default
@@ -134,7 +160,7 @@ Tag.propTypes = {
134
160
  /**
135
161
  * Determine if `Tag` is a filter/chip
136
162
  */
137
- filter: deprecate(PropTypes.bool, 'This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
163
+ filter: deprecate(PropTypes.bool, 'The `filter` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
138
164
  /**
139
165
  * Specify the id for the tag.
140
166
  */
@@ -142,7 +168,7 @@ Tag.propTypes = {
142
168
  /**
143
169
  * Click handler for filter tag close button.
144
170
  */
145
- onClose: deprecate(PropTypes.func, 'This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
171
+ onClose: deprecate(PropTypes.func, 'The `onClose` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
146
172
  /**
147
173
  * Optional prop to render a custom icon.
148
174
  * Can be a React component class
@@ -160,7 +186,7 @@ Tag.propTypes = {
160
186
  /**
161
187
  * Text to show on clear filters
162
188
  */
163
- title: deprecate(PropTypes.string, 'This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
189
+ title: deprecate(PropTypes.string, 'The `title` prop has been deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
164
190
  /**
165
191
  * Specify the type of the `Tag`
166
192
  */
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
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
+ export declare const isEllipsisActive: (element: any) => boolean;
@@ -0,0 +1,15 @@
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
+ const isEllipsisActive = element => {
9
+ if (element) {
10
+ return element?.offsetWidth < element?.scrollWidth;
11
+ }
12
+ return false;
13
+ };
14
+
15
+ export { isEllipsisActive };
@@ -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 TextArea from './TextArea';
7
+ import TextArea, { type TextAreaProps } from './TextArea';
8
8
  export { default as TextAreaSkeleton } from './TextArea.Skeleton';
9
9
  export default TextArea;
10
- export { TextArea };
10
+ export { TextArea, type TextAreaProps };
@@ -1,4 +1,6 @@
1
- import TextInput from './TextInput';
1
+ import TextInput, { type TextInputProps } from './TextInput';
2
+ import { type TextInputSkeletonProps } from './TextInput.Skeleton';
2
3
  export { default as TextInputSkeleton } from './TextInput.Skeleton';
3
4
  export default TextInput;
4
- export { TextInput };
5
+ export { type TextInputSkeletonProps };
6
+ export { TextInput, type TextInputProps };
@@ -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 TileGroup from './TileGroup';
7
+ import TileGroup, { type TileGroupProps } from './TileGroup';
8
8
  export default TileGroup;
9
- export { TileGroup };
9
+ export { TileGroup, type TileGroupProps };
@@ -37,18 +37,22 @@ function Tooltip(_ref) {
37
37
  const tooltipRef = useRef(null);
38
38
  const [open, setOpen] = useDelayedState(defaultOpen);
39
39
  const [isDragging, setIsDragging] = useState(false);
40
+ const [focusByMouse, setFocusByMouse] = useState(false);
40
41
  const [isPointerIntersecting, setIsPointerIntersecting] = useState(false);
41
42
  const id = useId('tooltip');
42
43
  const prefix = usePrefix();
43
44
  const child = React__default.Children.only(children);
44
45
  const triggerProps = {
45
- onFocus: () => setOpen(true),
46
- onBlur: () => setOpen(false),
46
+ onFocus: () => !focusByMouse && setOpen(true),
47
+ onBlur: () => {
48
+ setOpen(false);
49
+ setFocusByMouse(false);
50
+ },
47
51
  onClick: () => closeOnActivation && setOpen(false),
48
52
  // This should be placed on the trigger in case the element is disabled
49
53
  onMouseEnter,
50
54
  onMouseLeave,
51
- onMouseDown: onDragStart,
55
+ onMouseDown,
52
56
  onMouseMove: onMouseMove,
53
57
  onTouchStart: onDragStart
54
58
  };
@@ -80,8 +84,15 @@ function Tooltip(_ref) {
80
84
  }
81
85
  }
82
86
  function onMouseEnter() {
83
- setIsPointerIntersecting(true);
84
- setOpen(true, enterDelayMs);
87
+ // Interactive Tags should not support onMouseEnter
88
+ if (!rest?.onMouseEnter) {
89
+ setIsPointerIntersecting(true);
90
+ setOpen(true, enterDelayMs);
91
+ }
92
+ }
93
+ function onMouseDown() {
94
+ setFocusByMouse(true);
95
+ onDragStart();
85
96
  }
86
97
  function onMouseLeave() {
87
98
  setIsPointerIntersecting(false);
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { DefinitionTooltip } from './DefinitionTooltip';
8
- import { Tooltip } from './Tooltip';
9
- export { DefinitionTooltip, Tooltip };
8
+ import { Tooltip, type TooltipProps } from './Tooltip';
9
+ export { DefinitionTooltip, Tooltip, type TooltipProps };
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import { type ComponentProps } from 'react';
9
- interface UnorderedListProps extends ComponentProps<'ul'> {
9
+ export interface UnorderedListProps extends ComponentProps<'ul'> {
10
10
  nested?: boolean | undefined;
11
11
  isExpressive?: boolean | undefined;
12
12
  }
@@ -5,3 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  export { default, default as UnorderedList } from './UnorderedList';
8
+ export { type UnorderedListProps } from './UnorderedList';
@@ -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 };