@carbon/react 1.57.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 (156) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1106 -990
  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/Button.js +2 -2
  5. package/es/components/Button/index.d.ts +2 -1
  6. package/es/components/Checkbox/Checkbox.d.ts +6 -7
  7. package/es/components/ComboBox/ComboBox.d.ts +4 -5
  8. package/es/components/ComboBox/ComboBox.js +268 -261
  9. package/es/components/ComposedModal/ComposedModal.d.ts +1 -2
  10. package/es/components/DataTable/TableHeader.d.ts +4 -5
  11. package/es/components/DataTable/TableSlugRow.d.ts +3 -2
  12. package/es/components/DatePicker/DatePicker.d.ts +4 -5
  13. package/es/components/Dropdown/Dropdown.d.ts +6 -7
  14. package/es/components/Dropdown/index.d.ts +2 -2
  15. package/es/components/FormLabel/index.d.ts +2 -2
  16. package/es/components/Grid/Column.d.ts +2 -2
  17. package/es/components/Grid/GridTypes.d.ts +1 -2
  18. package/es/components/Grid/index.d.ts +3 -1
  19. package/es/components/IconButton/index.d.ts +3 -4
  20. package/es/components/InlineLoading/index.d.ts +2 -2
  21. package/es/components/ListBox/next/ListBoxTrigger.js +1 -0
  22. package/es/components/Loading/index.d.ts +2 -2
  23. package/es/components/Menu/Menu.js +1 -1
  24. package/es/components/Menu/MenuItem.js +13 -2
  25. package/es/components/Modal/Modal.d.ts +8 -9
  26. package/es/components/Modal/index.d.ts +2 -2
  27. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -2
  28. package/es/components/MultiSelect/MultiSelect.d.ts +10 -9
  29. package/es/components/Notification/Notification.d.ts +2 -2
  30. package/es/components/NumberInput/NumberInput.d.ts +12 -2
  31. package/es/components/NumberInput/NumberInput.js +2 -2
  32. package/es/components/NumberInput/index.d.ts +1 -1
  33. package/es/components/OverflowMenu/OverflowMenu.d.ts +10 -6
  34. package/es/components/OverflowMenu/index.d.ts +13 -0
  35. package/es/components/PasswordInput/index.d.ts +3 -0
  36. package/es/components/Popover/index.d.ts +8 -2
  37. package/es/components/Popover/index.js +26 -1
  38. package/es/components/ProgressBar/ProgressBar.d.ts +1 -1
  39. package/es/components/ProgressBar/index.d.ts +2 -2
  40. package/es/components/ProgressIndicator/ProgressIndicator.d.ts +2 -2
  41. package/es/components/ProgressIndicator/index.d.ts +2 -0
  42. package/es/components/RadioButton/RadioButton.d.ts +3 -4
  43. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +7 -8
  44. package/es/components/Select/Select.d.ts +1 -2
  45. package/es/components/Slider/Slider.d.ts +5 -5
  46. package/es/components/Slider/Slider.js +1 -1
  47. package/es/components/StructuredList/index.d.ts +2 -0
  48. package/es/components/Switch/Switch.d.ts +1 -1
  49. package/es/components/Switch/index.d.ts +2 -2
  50. package/es/components/Tab/index.d.ts +2 -1
  51. package/es/components/Tag/DismissibleTag.d.ts +12 -12
  52. package/es/components/Tag/DismissibleTag.js +34 -9
  53. package/es/components/Tag/OperationalTag.d.ts +12 -12
  54. package/es/components/Tag/OperationalTag.js +45 -9
  55. package/es/components/Tag/SelectableTag.d.ts +12 -12
  56. package/es/components/Tag/SelectableTag.js +46 -10
  57. package/es/components/Tag/Tag.d.ts +3 -3
  58. package/es/components/Tag/Tag.js +31 -5
  59. package/es/components/TextArea/TextArea.d.ts +6 -7
  60. package/es/components/TextArea/index.d.ts +2 -2
  61. package/es/components/TextInput/PasswordInput.d.ts +5 -6
  62. package/es/components/TextInput/PasswordInput.js +2 -2
  63. package/es/components/TextInput/TextInput.d.ts +1 -2
  64. package/es/components/TextInput/index.d.ts +4 -2
  65. package/es/components/Theme/index.d.ts +1 -0
  66. package/es/components/Theme/index.js +8 -2
  67. package/es/components/Tile/Tile.d.ts +3 -4
  68. package/es/components/TileGroup/TileGroup.d.ts +3 -2
  69. package/es/components/TileGroup/index.d.ts +9 -0
  70. package/es/components/Toggle/Toggle.js +1 -1
  71. package/es/components/Tooltip/DefinitionTooltip.js +1 -1
  72. package/es/components/Tooltip/Tooltip.js +16 -5
  73. package/es/components/Tooltip/index.d.ts +2 -2
  74. package/es/components/UnorderedList/UnorderedList.d.ts +1 -1
  75. package/es/components/UnorderedList/index.d.ts +1 -0
  76. package/es/index.js +4 -4
  77. package/es/prop-types/deprecateValuesWithin.js +35 -0
  78. package/lib/components/Accordion/Accordion.d.ts +1 -1
  79. package/lib/components/Accordion/index.d.ts +2 -2
  80. package/lib/components/Button/Button.js +2 -2
  81. package/lib/components/Button/index.d.ts +2 -1
  82. package/lib/components/Checkbox/Checkbox.d.ts +6 -7
  83. package/lib/components/ComboBox/ComboBox.d.ts +4 -5
  84. package/lib/components/ComboBox/ComboBox.js +267 -261
  85. package/lib/components/ComposedModal/ComposedModal.d.ts +1 -2
  86. package/lib/components/DataTable/TableHeader.d.ts +4 -5
  87. package/lib/components/DataTable/TableSlugRow.d.ts +3 -2
  88. package/lib/components/DatePicker/DatePicker.d.ts +4 -5
  89. package/lib/components/Dropdown/Dropdown.d.ts +6 -7
  90. package/lib/components/Dropdown/index.d.ts +2 -2
  91. package/lib/components/FormLabel/index.d.ts +2 -2
  92. package/lib/components/Grid/Column.d.ts +2 -2
  93. package/lib/components/Grid/GridTypes.d.ts +1 -2
  94. package/lib/components/Grid/index.d.ts +3 -1
  95. package/lib/components/IconButton/index.d.ts +3 -4
  96. package/lib/components/InlineLoading/index.d.ts +2 -2
  97. package/lib/components/ListBox/next/ListBoxTrigger.js +1 -0
  98. package/lib/components/Loading/index.d.ts +2 -2
  99. package/lib/components/Menu/Menu.js +1 -1
  100. package/lib/components/Menu/MenuItem.js +13 -2
  101. package/lib/components/Modal/Modal.d.ts +8 -9
  102. package/lib/components/Modal/index.d.ts +2 -2
  103. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -2
  104. package/lib/components/MultiSelect/MultiSelect.d.ts +10 -9
  105. package/lib/components/Notification/Notification.d.ts +2 -2
  106. package/lib/components/NumberInput/NumberInput.d.ts +12 -2
  107. package/lib/components/NumberInput/NumberInput.js +2 -2
  108. package/lib/components/NumberInput/index.d.ts +1 -1
  109. package/lib/components/OverflowMenu/OverflowMenu.d.ts +10 -6
  110. package/lib/components/OverflowMenu/index.d.ts +13 -0
  111. package/lib/components/PasswordInput/index.d.ts +3 -0
  112. package/lib/components/Popover/index.d.ts +8 -2
  113. package/lib/components/Popover/index.js +26 -1
  114. package/lib/components/ProgressBar/ProgressBar.d.ts +1 -1
  115. package/lib/components/ProgressBar/index.d.ts +2 -2
  116. package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +2 -2
  117. package/lib/components/ProgressIndicator/index.d.ts +2 -0
  118. package/lib/components/RadioButton/RadioButton.d.ts +3 -4
  119. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +7 -8
  120. package/lib/components/Select/Select.d.ts +1 -2
  121. package/lib/components/Slider/Slider.d.ts +5 -5
  122. package/lib/components/Slider/Slider.js +1 -1
  123. package/lib/components/StructuredList/index.d.ts +2 -0
  124. package/lib/components/Switch/Switch.d.ts +1 -1
  125. package/lib/components/Switch/index.d.ts +2 -2
  126. package/lib/components/Tab/index.d.ts +2 -1
  127. package/lib/components/Tag/DismissibleTag.d.ts +12 -12
  128. package/lib/components/Tag/DismissibleTag.js +33 -8
  129. package/lib/components/Tag/OperationalTag.d.ts +12 -12
  130. package/lib/components/Tag/OperationalTag.js +44 -8
  131. package/lib/components/Tag/SelectableTag.d.ts +12 -12
  132. package/lib/components/Tag/SelectableTag.js +45 -9
  133. package/lib/components/Tag/Tag.d.ts +3 -3
  134. package/lib/components/Tag/Tag.js +30 -4
  135. package/lib/components/TextArea/TextArea.d.ts +6 -7
  136. package/lib/components/TextArea/index.d.ts +2 -2
  137. package/lib/components/TextInput/PasswordInput.d.ts +5 -6
  138. package/lib/components/TextInput/PasswordInput.js +2 -2
  139. package/lib/components/TextInput/TextInput.d.ts +1 -2
  140. package/lib/components/TextInput/index.d.ts +4 -2
  141. package/lib/components/Theme/index.d.ts +1 -0
  142. package/lib/components/Theme/index.js +8 -1
  143. package/lib/components/Tile/Tile.d.ts +3 -4
  144. package/lib/components/TileGroup/TileGroup.d.ts +3 -2
  145. package/lib/components/TileGroup/index.d.ts +9 -0
  146. package/lib/components/Toggle/Toggle.js +1 -1
  147. package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
  148. package/lib/components/Tooltip/Tooltip.js +16 -5
  149. package/lib/components/Tooltip/index.d.ts +2 -2
  150. package/lib/components/UnorderedList/UnorderedList.d.ts +1 -1
  151. package/lib/components/UnorderedList/index.d.ts +1 -0
  152. package/lib/index.js +30 -29
  153. package/lib/prop-types/deprecateValuesWithin.js +39 -0
  154. package/package.json +6 -6
  155. package/es/components/TileGroup/index.js +0 -13
  156. package/lib/components/TileGroup/index.js +0 -18
@@ -16,6 +16,10 @@ 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 Text = require('../Text/Text.js');
19
23
 
20
24
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
25
 
@@ -26,7 +30,6 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
26
30
  const getInstanceId = setupGetInstanceId["default"]();
27
31
  const SelectableTag = _ref => {
28
32
  let {
29
- children,
30
33
  className,
31
34
  disabled,
32
35
  id,
@@ -34,6 +37,7 @@ const SelectableTag = _ref => {
34
37
  selected = false,
35
38
  slug,
36
39
  size,
40
+ text,
37
41
  ...other
38
42
  } = _ref;
39
43
  const prefix = usePrefix.usePrefix();
@@ -42,6 +46,16 @@ const SelectableTag = _ref => {
42
46
  const tagClasses = cx__default["default"](`${prefix}--tag--selectable`, className, {
43
47
  [`${prefix}--tag--selectable-selected`]: selectedTag
44
48
  });
49
+ const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
50
+ const isEllipsisActive = element => {
51
+ setIsEllipsisApplied(element.offsetWidth < element.scrollWidth);
52
+ return element.offsetWidth < element.scrollWidth;
53
+ };
54
+ React.useLayoutEffect(() => {
55
+ const elementTagId = document.querySelector(`#${tagId}`);
56
+ const newElement = elementTagId?.getElementsByClassName(`${prefix}--tag__label`)[0];
57
+ isEllipsisActive(newElement);
58
+ }, [prefix, tagId]);
45
59
  let normalizedSlug;
46
60
  if (slug && slug['type']?.displayName === 'Slug') {
47
61
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
@@ -49,6 +63,7 @@ const SelectableTag = _ref => {
49
63
  kind: 'inline'
50
64
  });
51
65
  }
66
+ const tooltipClasses = cx__default["default"](`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
52
67
 
53
68
  // Removing onClick from the spread operator
54
69
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -56,6 +71,26 @@ const SelectableTag = _ref => {
56
71
  onClick,
57
72
  ...otherProps
58
73
  } = other;
74
+ if (isEllipsisApplied) {
75
+ return /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
76
+ label: text,
77
+ align: "bottom",
78
+ className: tooltipClasses,
79
+ leaveDelayMs: 0,
80
+ onMouseEnter: false
81
+ }, /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
82
+ slug: slug,
83
+ size: size,
84
+ renderIcon: renderIcon,
85
+ disabled: disabled,
86
+ className: tagClasses,
87
+ id: tagId,
88
+ onClick: () => setSelectedTag(!selectedTag)
89
+ }, otherProps), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
90
+ title: text,
91
+ className: `${prefix}--tag__label`
92
+ }, text), normalizedSlug));
93
+ }
59
94
  return /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
60
95
  slug: slug,
61
96
  size: size,
@@ -64,15 +99,12 @@ const SelectableTag = _ref => {
64
99
  className: tagClasses,
65
100
  id: tagId,
66
101
  onClick: () => setSelectedTag(!selectedTag)
67
- }, otherProps), /*#__PURE__*/React__default["default"].createElement("div", {
68
- className: `${prefix}--interactive--tag-children`
69
- }, children, normalizedSlug));
102
+ }, otherProps), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
103
+ title: text,
104
+ className: `${prefix}--tag__label`
105
+ }, text));
70
106
  };
71
107
  SelectableTag.propTypes = {
72
- /**
73
- * Provide content to be rendered inside of a `SelectableTag`
74
- */
75
- children: PropTypes__default["default"].node,
76
108
  /**
77
109
  * Provide a custom className that is applied to the containing <span>
78
110
  */
@@ -102,7 +134,11 @@ SelectableTag.propTypes = {
102
134
  /**
103
135
  * **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
104
136
  */
105
- slug: PropTypes__default["default"].node
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
106
142
  };
107
143
 
108
144
  exports["default"] = SelectableTag;
@@ -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 PropTypes, { ReactNodeLike } from 'prop-types';
8
- import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import React, { ReactNode } from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
10
  export declare const TYPES: {
11
11
  red: string;
@@ -64,7 +64,7 @@ export interface TagBaseProps {
64
64
  /**
65
65
  * **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
66
66
  */
67
- slug?: ReactNodeLike;
67
+ slug?: ReactNode;
68
68
  /**
69
69
  * @deprecated This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.
70
70
  */
@@ -18,6 +18,8 @@ var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
18
18
  var usePrefix = require('../../internal/usePrefix.js');
19
19
  require('../Text/index.js');
20
20
  var deprecate = require('../../prop-types/deprecate.js');
21
+ var DefinitionTooltip = require('../Tooltip/DefinitionTooltip.js');
22
+ require('../Tooltip/Tooltip.js');
21
23
  var Text = require('../Text/Text.js');
22
24
 
23
25
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -68,6 +70,16 @@ const Tag = _ref => {
68
70
  } = _ref;
69
71
  const prefix = usePrefix.usePrefix();
70
72
  const tagId = id || `tag-${getInstanceId()}`;
73
+ const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
74
+ const isEllipsisActive = element => {
75
+ setIsEllipsisApplied(element.offsetWidth < element.scrollWidth);
76
+ return element.offsetWidth < element.scrollWidth;
77
+ };
78
+ React.useLayoutEffect(() => {
79
+ const elementTagId = document.querySelector(`#${tagId}`);
80
+ const newElement = elementTagId?.getElementsByClassName(`${prefix}--tag__label`)[0];
81
+ isEllipsisActive(newElement);
82
+ }, [prefix, tagId]);
71
83
  const conditions = [`${prefix}--tag--selectable`, `${prefix}--tag--filter`, `${prefix}--tag--operational`];
72
84
  const isInteractiveTag = conditions.some(el => className?.includes(el));
73
85
  const tagClasses = cx__default["default"](`${prefix}--tag`, className, {
@@ -77,7 +89,7 @@ const Tag = _ref => {
77
89
  // TODO: V12 - Remove this class
78
90
  [`${prefix}--layout--size-${size}`]: size,
79
91
  [`${prefix}--tag--${type}`]: type,
80
- [`${prefix}--tag--interactive`]: other.onClick && !isInteractiveTag
92
+ [`${prefix}--tag--interactive`]: other.onClick && !isInteractiveTag && isEllipsisApplied
81
93
  });
82
94
  const typeText = type !== undefined && type in Object.keys(TYPES) ? TYPES[type] : '';
83
95
  const handleClose = event => {
@@ -103,8 +115,8 @@ const Tag = _ref => {
103
115
  }, other), CustomIconElement && size !== 'sm' ? /*#__PURE__*/React__default["default"].createElement("div", {
104
116
  className: `${prefix}--tag__custom-icon`
105
117
  }, /*#__PURE__*/React__default["default"].createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default["default"].createElement(Text.Text, {
106
- className: `${prefix}--tag__label`,
107
- title: typeof children === 'string' ? children : undefined
118
+ title: typeof children === 'string' ? children : undefined,
119
+ className: `${prefix}--tag__label`
108
120
  }, children !== null && children !== undefined ? children : typeText), normalizedSlug, /*#__PURE__*/React__default["default"].createElement("button", {
109
121
  type: "button",
110
122
  className: `${prefix}--tag__close-icon`,
@@ -115,13 +127,27 @@ const Tag = _ref => {
115
127
  }, _Close || (_Close = /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, null))));
116
128
  }
117
129
  const ComponentTag = BaseComponent ?? (other.onClick || className?.includes(`${prefix}--tag--operational`) ? 'button' : 'div');
130
+ const labelClasses = cx__default["default"]({
131
+ [`${prefix}--tag__label`]: !isInteractiveTag,
132
+ [`${prefix}--tag--${type}`]: type && !isInteractiveTag
133
+ });
118
134
  return /*#__PURE__*/React__default["default"].createElement(ComponentTag, _rollupPluginBabelHelpers["extends"]({
119
135
  disabled: disabled,
120
136
  className: tagClasses,
121
137
  id: tagId
122
138
  }, other), CustomIconElement && size !== 'sm' ? /*#__PURE__*/React__default["default"].createElement("div", {
123
139
  className: `${prefix}--tag__custom-icon`
124
- }, /*#__PURE__*/React__default["default"].createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default["default"].createElement(Text.Text, null, children !== null && children !== undefined ? children : typeText), normalizedSlug);
140
+ }, /*#__PURE__*/React__default["default"].createElement(CustomIconElement, null)) : '', isEllipsisApplied && !isInteractiveTag ? /*#__PURE__*/React__default["default"].createElement(DefinitionTooltip.DefinitionTooltip, {
141
+ openOnHover: false,
142
+ definition: children !== null && children !== undefined ? children : typeText,
143
+ className: `${prefix}--definition--tooltip--tag`
144
+ }, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
145
+ title: children !== null && children !== undefined ? children : typeText,
146
+ className: labelClasses
147
+ }, children !== null && children !== undefined ? children : typeText)) : /*#__PURE__*/React__default["default"].createElement(Text.Text, {
148
+ title: children !== null && children !== undefined ? children : typeText,
149
+ className: labelClasses
150
+ }, children !== null && children !== undefined ? children : typeText), normalizedSlug);
125
151
  };
126
152
  Tag.propTypes = {
127
153
  /**
@@ -4,8 +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 { ReactNodeLike } from 'prop-types';
8
- import React from 'react';
7
+ import React, { ReactNode } from 'react';
9
8
  export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaElement> {
10
9
  /**
11
10
  * Provide a custom className that is applied directly to the underlying
@@ -31,7 +30,7 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
31
30
  /**
32
31
  * Provide text that is used alongside the control label for additional help
33
32
  */
34
- helperText?: ReactNodeLike;
33
+ helperText?: ReactNode;
35
34
  /**
36
35
  * Specify whether you want the underlying label to be visually hidden
37
36
  */
@@ -47,12 +46,12 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
47
46
  /**
48
47
  * Provide the text that is displayed when the control is in an invalid state
49
48
  */
50
- invalidText?: ReactNodeLike;
49
+ invalidText?: ReactNode;
51
50
  /**
52
51
  * Provide the text that will be read by a screen reader when visiting this
53
52
  * control
54
53
  */
55
- labelText: ReactNodeLike;
54
+ labelText: ReactNode;
56
55
  /**
57
56
  * @deprecated
58
57
  * `true` to use the light version. For use on $ui-01 backgrounds only.
@@ -93,7 +92,7 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
93
92
  /**
94
93
  * **Experimental**: Provide a `Slug` component to be rendered inside the `TextArea` component
95
94
  */
96
- slug?: ReactNodeLike;
95
+ slug?: ReactNode;
97
96
  /**
98
97
  * Provide the current value of the `<textarea>`
99
98
  */
@@ -105,7 +104,7 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
105
104
  /**
106
105
  * Provide the text that is displayed when the control is in warning state
107
106
  */
108
- warnText?: ReactNodeLike;
107
+ warnText?: ReactNode;
109
108
  /**
110
109
  * Specify the method used for calculating the counter number
111
110
  */
@@ -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,5 +1,4 @@
1
- import React, { InputHTMLAttributes } from 'react';
2
- import { ReactNodeLike } from 'prop-types';
1
+ import React, { InputHTMLAttributes, ReactNode } from 'react';
3
2
  type ExcludedAttributes = 'size';
4
3
  export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
5
4
  /**
@@ -21,7 +20,7 @@ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputEl
21
20
  /**
22
21
  * Provide text that is used alongside the control label for additional help
23
22
  */
24
- helperText?: ReactNodeLike;
23
+ helperText?: ReactNode;
25
24
  /**
26
25
  * Specify whether or not the underlying label is visually hidden
27
26
  */
@@ -45,11 +44,11 @@ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputEl
45
44
  /**
46
45
  * Provide the text that is displayed when the control is in an invalid state
47
46
  */
48
- invalidText?: ReactNodeLike;
47
+ invalidText?: ReactNode;
49
48
  /**
50
49
  * Provide the text that will be read by a screen reader when visiting this control
51
50
  */
52
- labelText: ReactNodeLike;
51
+ labelText: ReactNode;
53
52
  /**
54
53
  * @deprecated The `light` prop for `PasswordInput` has been deprecated in favor of the new `Layer` component. It will be removed in the next major release.
55
54
  * `true` to use the light version. For use on $ui-01 backgrounds only.
@@ -119,7 +118,7 @@ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputEl
119
118
  /**
120
119
  * Provide the text that is displayed when the control is in warning state
121
120
  */
122
- warnText?: ReactNodeLike;
121
+ warnText?: ReactNode;
123
122
  }
124
123
  declare const PasswordInput: React.ForwardRefExoticComponent<PasswordInputProps & React.RefAttributes<unknown>>;
125
124
  export default PasswordInput;
@@ -149,10 +149,10 @@ const PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function
149
149
  align = tooltipPosition;
150
150
  }
151
151
  if (tooltipAlignment === 'end') {
152
- align = `${tooltipPosition}-right`;
152
+ align = `${tooltipPosition}-end`;
153
153
  }
154
154
  if (tooltipAlignment === 'start') {
155
- align = `${tooltipPosition}-left`;
155
+ align = `${tooltipPosition}-start`;
156
156
  }
157
157
  }
158
158
  if (tooltipPosition === 'right' || tooltipPosition === 'left') {
@@ -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 { ReactNodeLike } from 'prop-types';
8
7
  import React, { ReactNode } from 'react';
9
8
  type ExcludedAttributes = 'defaultValue' | 'id' | 'size' | 'value';
10
9
  export interface TextInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
@@ -89,7 +88,7 @@ export interface TextInputProps extends Omit<React.InputHTMLAttributes<HTMLInput
89
88
  /**
90
89
  * **Experimental**: Provide a `Slug` component to be rendered inside the `TextInput` component
91
90
  */
92
- slug?: ReactNodeLike;
91
+ slug?: ReactNode;
93
92
  /**
94
93
  * Specify the type of the `<input>`
95
94
  */
@@ -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 };
@@ -49,4 +49,5 @@ export declare namespace Theme {
49
49
  * Get access to the current theme
50
50
  */
51
51
  export declare function useTheme(): GlobalThemeProps;
52
+ export declare function usePrefersDarkScheme(): boolean;
52
53
  export {};
@@ -15,6 +15,7 @@ var PropTypes = require('prop-types');
15
15
  var React = require('react');
16
16
  var usePrefix = require('../../internal/usePrefix.js');
17
17
  var LayerContext = require('../Layer/LayerContext.js');
18
+ var useMatchMedia = require('../../internal/useMatchMedia.js');
18
19
 
19
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
21
 
@@ -72,8 +73,10 @@ function Theme(_ref2) {
72
73
  [`${prefix}--layer-one`]: true
73
74
  });
74
75
  const value = React__default["default"].useMemo(() => {
76
+ const isDark = theme && ['g90', 'g100'].includes(theme);
75
77
  return {
76
- theme
78
+ theme,
79
+ isDark
77
80
  };
78
81
  }, [theme]);
79
82
  const BaseComponentAsAny = BaseComponent;
@@ -112,8 +115,12 @@ Theme.propTypes = {
112
115
  function useTheme() {
113
116
  return React__default["default"].useContext(ThemeContext);
114
117
  }
118
+ function usePrefersDarkScheme() {
119
+ return useMatchMedia.useMatchMedia('(prefers-color-scheme: dark)');
120
+ }
115
121
 
116
122
  exports.GlobalTheme = GlobalTheme;
117
123
  exports.Theme = Theme;
118
124
  exports.ThemeContext = ThemeContext;
125
+ exports.usePrefersDarkScheme = usePrefersDarkScheme;
119
126
  exports.useTheme = useTheme;
@@ -1,5 +1,4 @@
1
1
  import React, { type ReactNode, type MouseEvent, type KeyboardEvent, type HTMLAttributes, type ChangeEvent, type ComponentType } from 'react';
2
- import { ReactNodeLike } from 'prop-types';
3
2
  export interface TileProps extends HTMLAttributes<HTMLDivElement> {
4
3
  children?: ReactNode;
5
4
  className?: string;
@@ -13,7 +12,7 @@ export interface TileProps extends HTMLAttributes<HTMLDivElement> {
13
12
  /**
14
13
  * **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
15
14
  */
16
- slug?: ReactNodeLike;
15
+ slug?: ReactNode;
17
16
  }
18
17
  export declare const Tile: React.ForwardRefExoticComponent<TileProps & React.RefAttributes<HTMLDivElement>>;
19
18
  export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
@@ -104,7 +103,7 @@ export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
104
103
  /**
105
104
  * **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
106
105
  */
107
- slug?: ReactNodeLike;
106
+ slug?: ReactNode;
108
107
  /**
109
108
  * Specify the tab index of the wrapper element
110
109
  */
@@ -149,7 +148,7 @@ export interface ExpandableTileProps extends HTMLAttributes<HTMLDivElement> {
149
148
  /**
150
149
  * **Experimental**: Provide a `Slug` component to be rendered inside the `ExpandableTile` component
151
150
  */
152
- slug?: ReactNodeLike;
151
+ slug?: ReactNode;
153
152
  /**
154
153
  * The `tabindex` attribute.
155
154
  */
@@ -4,14 +4,15 @@
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, { ReactNodeLike } from 'prop-types';
7
+ import PropTypes from 'prop-types';
8
+ import { ReactNode } from 'react';
8
9
  import { ReactAttr } from '../../types/common';
9
10
  type ExcludedAttributes = 'onChange';
10
11
  export interface TileGroupProps extends Omit<ReactAttr<HTMLFieldSetElement>, ExcludedAttributes> {
11
12
  /**
12
13
  * Provide a collection of <RadioTile> components to render in the group
13
14
  */
14
- children?: ReactNodeLike;
15
+ children?: ReactNode;
15
16
  /**
16
17
  * Provide an optional className to be applied to the container node
17
18
  */
@@ -0,0 +1,9 @@
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 TileGroup, { type TileGroupProps } from './TileGroup';
8
+ export default TileGroup;
9
+ export { TileGroup, type TileGroupProps };
@@ -99,7 +99,7 @@ function Toggle(_ref) {
99
99
  role: "switch",
100
100
  type: "button",
101
101
  "aria-checked": checked,
102
- "aria-labelledby": ariaLabelledby ?? labelId,
102
+ "aria-labelledby": ariaLabelledby ?? (labelText ? labelId : undefined),
103
103
  disabled: disabled,
104
104
  onClick: handleClick
105
105
  })), /*#__PURE__*/React__default["default"].createElement(LabelComponent, {
@@ -28,7 +28,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
28
28
 
29
29
  const DefinitionTooltip = _ref => {
30
30
  let {
31
- align = 'bottom-left',
31
+ align = 'bottom-start',
32
32
  className,
33
33
  children,
34
34
  definition,
@@ -47,18 +47,22 @@ function Tooltip(_ref) {
47
47
  const tooltipRef = React.useRef(null);
48
48
  const [open, setOpen] = useDelayedState.useDelayedState(defaultOpen);
49
49
  const [isDragging, setIsDragging] = React.useState(false);
50
+ const [focusByMouse, setFocusByMouse] = React.useState(false);
50
51
  const [isPointerIntersecting, setIsPointerIntersecting] = React.useState(false);
51
52
  const id = useId.useId('tooltip');
52
53
  const prefix = usePrefix.usePrefix();
53
54
  const child = React__default["default"].Children.only(children);
54
55
  const triggerProps = {
55
- onFocus: () => setOpen(true),
56
- onBlur: () => setOpen(false),
56
+ onFocus: () => !focusByMouse && setOpen(true),
57
+ onBlur: () => {
58
+ setOpen(false);
59
+ setFocusByMouse(false);
60
+ },
57
61
  onClick: () => closeOnActivation && setOpen(false),
58
62
  // This should be placed on the trigger in case the element is disabled
59
63
  onMouseEnter,
60
64
  onMouseLeave,
61
- onMouseDown: onDragStart,
65
+ onMouseDown,
62
66
  onMouseMove: onMouseMove,
63
67
  onTouchStart: onDragStart
64
68
  };
@@ -90,8 +94,15 @@ function Tooltip(_ref) {
90
94
  }
91
95
  }
92
96
  function onMouseEnter() {
93
- setIsPointerIntersecting(true);
94
- setOpen(true, enterDelayMs);
97
+ // Interactive Tags should not support onMouseEnter
98
+ if (!rest?.onMouseEnter?.()) {
99
+ setIsPointerIntersecting(true);
100
+ setOpen(true, enterDelayMs);
101
+ }
102
+ }
103
+ function onMouseDown() {
104
+ setFocusByMouse(true);
105
+ onDragStart();
95
106
  }
96
107
  function onMouseLeave() {
97
108
  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';