@carbon/react 1.24.0 → 1.26.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/es/components/Button/Button.js +2 -2
  2. package/es/components/CodeSnippet/CodeSnippet.js +13 -115
  3. package/es/components/ComboBox/ComboBox.d.ts +6 -0
  4. package/es/components/ComboBox/ComboBox.js +19 -172
  5. package/es/components/ComboButton/index.js +164 -0
  6. package/es/components/ComposedModal/ComposedModal.js +1 -2
  7. package/es/components/DataTable/Table.d.ts +74 -0
  8. package/es/components/DataTable/Table.js +4 -2
  9. package/es/components/DataTable/TableCell.d.ts +10 -0
  10. package/es/components/DataTable/TableContext.d.ts +13 -0
  11. package/es/components/DataTable/TableContext.js +2 -2
  12. package/es/components/DataTable/TableExpandRow.d.ts +67 -0
  13. package/es/components/DataTable/TableExpandedRow.d.ts +32 -0
  14. package/es/components/DataTable/TableHead.d.ts +10 -0
  15. package/es/components/DataTable/TableHeader.d.ts +64 -0
  16. package/es/components/DataTable/TableHeader.js +23 -28
  17. package/es/components/DataTable/TableRow.d.ts +32 -0
  18. package/es/components/DataTable/TableSelectAll.js +1 -1
  19. package/es/components/DataTable/TableSelectRow.js +1 -3
  20. package/es/components/DataTable/TableToolbar.d.ts +19 -0
  21. package/es/components/DataTable/TableToolbar.js +1 -1
  22. package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
  23. package/es/components/DataTable/TableToolbarContent.d.ts +19 -0
  24. package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
  25. package/es/components/DataTable/TableToolbarMenu.js +3 -3
  26. package/es/components/DataTable/TableToolbarSearch.js +1 -0
  27. package/es/components/DataTable/tools/sorting.js +2 -1
  28. package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  29. package/es/components/Dropdown/Dropdown.d.ts +6 -0
  30. package/es/components/Dropdown/Dropdown.js +8 -145
  31. package/es/components/ExpandableSearch/ExpandableSearch.js +1 -0
  32. package/es/components/FileUploader/FileUploader.js +1 -1
  33. package/es/components/FileUploader/FileUploaderButton.js +2 -0
  34. package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
  35. package/es/components/FileUploader/FileUploaderItem.js +2 -1
  36. package/es/components/FileUploader/Filename.js +8 -2
  37. package/es/components/FluidTextArea/FluidTextArea.js +12 -1
  38. package/es/components/IconButton/index.js +1 -0
  39. package/es/components/InlineCheckbox/InlineCheckbox.js +7 -53
  40. package/es/components/ListBox/ListBoxSelection.js +4 -23
  41. package/es/components/ListBox/next/ListBoxSelection.js +2 -23
  42. package/es/components/Menu/Menu.js +50 -29
  43. package/es/components/Menu/MenuItem.js +1 -0
  44. package/es/components/MenuButton/index.js +127 -0
  45. package/es/components/Modal/Modal.js +4 -3
  46. package/es/components/MultiSelect/FilterableMultiSelect.js +46 -144
  47. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  48. package/es/components/MultiSelect/MultiSelect.js +48 -28
  49. package/es/components/Notification/Notification.js +27 -264
  50. package/es/components/NumberInput/NumberInput.js +9 -1
  51. package/es/components/OverflowMenu/OverflowMenu.js +13 -139
  52. package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  53. package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  54. package/es/components/OverflowMenuV2/index.js +15 -51
  55. package/es/components/Popover/index.d.ts +5 -1
  56. package/es/components/Popover/index.js +37 -9
  57. package/es/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
  58. package/es/components/RadioButton/RadioButton.Skeleton.js +3 -3
  59. package/es/components/RadioButton/RadioButton.d.ts +64 -0
  60. package/es/components/RadioButton/RadioButton.js +19 -17
  61. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
  62. package/es/components/RadioButtonGroup/RadioButtonGroup.js +88 -26
  63. package/es/components/RadioTile/RadioTile.js +6 -6
  64. package/es/components/Search/Search.Skeleton.d.ts +36 -0
  65. package/es/components/Search/Search.js +3 -2
  66. package/es/components/Search/index.js +1 -0
  67. package/es/components/Select/Select.d.ts +89 -0
  68. package/es/components/SelectItem/SelectItem.d.ts +62 -0
  69. package/es/components/SelectItem/SelectItem.js +2 -4
  70. package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  71. package/es/components/SkeletonText/SkeletonText.js +1 -1
  72. package/es/components/StructuredList/StructuredList.js +11 -39
  73. package/es/components/Tabs/Tabs.js +29 -6
  74. package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  75. package/es/components/TextArea/TextArea.Skeleton.js +5 -5
  76. package/es/components/TextArea/TextArea.d.ts +9 -2
  77. package/es/components/TextArea/TextArea.js +31 -8
  78. package/es/components/TextArea/index.js +1 -0
  79. package/es/components/TextInput/TextInput.Skeleton.d.ts +33 -0
  80. package/es/components/TextInput/index.js +1 -0
  81. package/es/components/Tile/Tile.js +15 -8
  82. package/es/components/Toggle/Toggle.js +8 -19
  83. package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  84. package/es/components/Tooltip/DefinitionTooltip.js +2 -2
  85. package/es/components/Tooltip/Tooltip.d.ts +117 -0
  86. package/es/components/Tooltip/Tooltip.js +6 -4
  87. package/es/components/Tooltip/index.d.ts +9 -0
  88. package/es/components/UIShell/HeaderMenu.js +13 -4
  89. package/es/components/UIShell/HeaderMenuItem.js +17 -4
  90. package/es/index.d.ts +2 -0
  91. package/es/index.js +5 -3
  92. package/es/internal/ClickListener.js +1 -2
  93. package/es/internal/keyboard/match.js +1 -1
  94. package/es/internal/useAttachedMenu.js +85 -0
  95. package/es/internal/useDelayedState.d.ts +19 -0
  96. package/es/internal/useDelayedState.js +7 -3
  97. package/es/internal/useId.js +1 -1
  98. package/es/tools/wrapComponent.js +9 -0
  99. package/lib/components/Button/Button.js +2 -2
  100. package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
  101. package/lib/components/ComboBox/ComboBox.d.ts +6 -0
  102. package/lib/components/ComboBox/ComboBox.js +18 -171
  103. package/lib/components/ComboButton/index.js +174 -0
  104. package/lib/components/ComposedModal/ComposedModal.js +1 -2
  105. package/lib/components/DataTable/Table.d.ts +74 -0
  106. package/lib/components/DataTable/Table.js +4 -2
  107. package/lib/components/DataTable/TableCell.d.ts +10 -0
  108. package/lib/components/DataTable/TableContext.d.ts +13 -0
  109. package/lib/components/DataTable/TableContext.js +2 -2
  110. package/lib/components/DataTable/TableExpandRow.d.ts +67 -0
  111. package/lib/components/DataTable/TableExpandedRow.d.ts +32 -0
  112. package/lib/components/DataTable/TableHead.d.ts +10 -0
  113. package/lib/components/DataTable/TableHeader.d.ts +64 -0
  114. package/lib/components/DataTable/TableHeader.js +23 -28
  115. package/lib/components/DataTable/TableRow.d.ts +32 -0
  116. package/lib/components/DataTable/TableSelectAll.js +1 -1
  117. package/lib/components/DataTable/TableSelectRow.js +1 -3
  118. package/lib/components/DataTable/TableToolbar.d.ts +19 -0
  119. package/lib/components/DataTable/TableToolbar.js +1 -1
  120. package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
  121. package/lib/components/DataTable/TableToolbarContent.d.ts +19 -0
  122. package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
  123. package/lib/components/DataTable/TableToolbarMenu.js +3 -3
  124. package/lib/components/DataTable/TableToolbarSearch.js +1 -0
  125. package/lib/components/DataTable/tools/sorting.js +2 -1
  126. package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  127. package/lib/components/Dropdown/Dropdown.d.ts +6 -0
  128. package/lib/components/Dropdown/Dropdown.js +7 -144
  129. package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -0
  130. package/lib/components/FileUploader/FileUploader.js +1 -1
  131. package/lib/components/FileUploader/FileUploaderButton.js +2 -0
  132. package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
  133. package/lib/components/FileUploader/FileUploaderItem.js +2 -1
  134. package/lib/components/FileUploader/Filename.js +8 -2
  135. package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
  136. package/lib/components/IconButton/index.js +1 -0
  137. package/lib/components/InlineCheckbox/InlineCheckbox.js +7 -53
  138. package/lib/components/ListBox/ListBoxSelection.js +4 -23
  139. package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
  140. package/lib/components/Menu/Menu.js +50 -29
  141. package/lib/components/Menu/MenuItem.js +1 -0
  142. package/lib/components/MenuButton/index.js +137 -0
  143. package/lib/components/Modal/Modal.js +4 -3
  144. package/lib/components/MultiSelect/FilterableMultiSelect.js +43 -141
  145. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  146. package/lib/components/MultiSelect/MultiSelect.js +47 -27
  147. package/lib/components/Notification/Notification.js +27 -264
  148. package/lib/components/NumberInput/NumberInput.js +9 -1
  149. package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
  150. package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  151. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  152. package/lib/components/OverflowMenuV2/index.js +13 -49
  153. package/lib/components/Popover/index.d.ts +5 -1
  154. package/lib/components/Popover/index.js +37 -9
  155. package/lib/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
  156. package/lib/components/RadioButton/RadioButton.Skeleton.js +3 -3
  157. package/lib/components/RadioButton/RadioButton.d.ts +64 -0
  158. package/lib/components/RadioButton/RadioButton.js +18 -16
  159. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
  160. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +86 -24
  161. package/lib/components/RadioTile/RadioTile.js +6 -6
  162. package/lib/components/Search/Search.Skeleton.d.ts +36 -0
  163. package/lib/components/Search/Search.js +3 -2
  164. package/lib/components/Search/index.js +2 -0
  165. package/lib/components/Select/Select.d.ts +89 -0
  166. package/lib/components/SelectItem/SelectItem.d.ts +62 -0
  167. package/lib/components/SelectItem/SelectItem.js +1 -3
  168. package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  169. package/lib/components/SkeletonText/SkeletonText.js +1 -1
  170. package/lib/components/StructuredList/StructuredList.js +11 -39
  171. package/lib/components/Tabs/Tabs.js +29 -6
  172. package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  173. package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
  174. package/lib/components/TextArea/TextArea.d.ts +9 -2
  175. package/lib/components/TextArea/TextArea.js +30 -7
  176. package/lib/components/TextArea/index.js +2 -0
  177. package/lib/components/TextInput/TextInput.Skeleton.d.ts +33 -0
  178. package/lib/components/TextInput/index.js +2 -0
  179. package/lib/components/Tile/Tile.js +15 -8
  180. package/lib/components/Toggle/Toggle.js +8 -19
  181. package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  182. package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
  183. package/lib/components/Tooltip/Tooltip.d.ts +117 -0
  184. package/lib/components/Tooltip/Tooltip.js +6 -4
  185. package/lib/components/Tooltip/index.d.ts +9 -0
  186. package/lib/components/UIShell/HeaderMenu.js +13 -4
  187. package/lib/components/UIShell/HeaderMenuItem.js +17 -4
  188. package/lib/index.d.ts +2 -0
  189. package/lib/index.js +50 -46
  190. package/lib/internal/ClickListener.js +1 -2
  191. package/lib/internal/keyboard/match.js +1 -1
  192. package/lib/internal/useAttachedMenu.js +89 -0
  193. package/lib/internal/useDelayedState.d.ts +19 -0
  194. package/lib/internal/useDelayedState.js +7 -3
  195. package/lib/internal/useId.js +1 -1
  196. package/lib/tools/wrapComponent.js +9 -0
  197. package/package.json +3 -3
@@ -46,7 +46,7 @@ var SkeletonText = function SkeletonText(_ref) {
46
46
  useIsomorphicEffect(function () {
47
47
  refs.current.map(function (item, j) {
48
48
  var randomPercentWidth = getRandomInt(0, 75, j) + 'px';
49
- var randomPxWidth = getRandomInt(widthNum - 75, widthNum, j) + 'px';
49
+ var randomPxWidth = getRandomInt(Math.max(widthNum - 75, 0), widthNum, j) + 'px';
50
50
 
51
51
  if (item) {
52
52
  if (widthPercent && paragraph) {
@@ -13,7 +13,9 @@ import { useId } from '../../internal/useId.js';
13
13
  import deprecate from '../../prop-types/deprecate.js';
14
14
  import { usePrefix } from '../../internal/usePrefix.js';
15
15
 
16
- var _excluded = ["children", "selection", "className", "ariaLabel", "isCondensed", "isFlush"],
16
+ var _StructuredListWrappe;
17
+
18
+ var _excluded = ["children", "selection", "className", "aria-label", "ariaLabel", "isCondensed", "isFlush"],
17
19
  _excluded2 = ["children", "className"],
18
20
  _excluded3 = ["children", "className"],
19
21
  _excluded4 = ["onKeyDown", "children", "className", "head"],
@@ -27,7 +29,8 @@ function StructuredListWrapper(props) {
27
29
  var children = props.children,
28
30
  selection = props.selection,
29
31
  className = props.className,
30
- ariaLabel = props.ariaLabel,
32
+ ariaLabel = props['aria-label'],
33
+ deprecatedAriaLabel = props.ariaLabel,
31
34
  isCondensed = props.isCondensed,
32
35
  isFlush = props.isFlush,
33
36
  other = _objectWithoutProperties(props, _excluded);
@@ -48,46 +51,15 @@ function StructuredListWrapper(props) {
48
51
  role: "table",
49
52
  className: classes
50
53
  }, other, {
51
- "aria-label": ariaLabel
54
+ "aria-label": deprecatedAriaLabel || ariaLabel
52
55
  }), children)));
53
56
  }
54
- StructuredListWrapper.propTypes = {
55
- /**
56
- * Specify a label to be read by screen readers on the container node
57
- */
58
- ariaLabel: PropTypes.string,
59
-
60
- /**
61
- * Provide the contents of your StructuredListWrapper
62
- */
63
- children: PropTypes.node,
64
-
65
- /**
66
- * Specify an optional className to be applied to the container node
67
- */
68
- className: PropTypes.string,
69
-
70
- /**
71
- * Specify if structured list is condensed, default is false
72
- */
73
- isCondensed: PropTypes.bool,
74
-
75
- /**
76
- * Specify if structured list is flush, default is false
77
- */
78
- isFlush: PropTypes.bool,
79
-
80
- /**
81
- * Specify whether your StructuredListWrapper should have selections
82
- */
83
- selection: PropTypes.bool
84
- };
85
- StructuredListWrapper.defaultProps = {
57
+ StructuredListWrapper.propTypes = (_StructuredListWrappe = {}, _defineProperty(_StructuredListWrappe, 'aria-label', PropTypes.string), _defineProperty(_StructuredListWrappe, "ariaLabel", deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.')), _defineProperty(_StructuredListWrappe, "children", PropTypes.node), _defineProperty(_StructuredListWrappe, "className", PropTypes.string), _defineProperty(_StructuredListWrappe, "isCondensed", PropTypes.bool), _defineProperty(_StructuredListWrappe, "isFlush", PropTypes.bool), _defineProperty(_StructuredListWrappe, "selection", PropTypes.bool), _StructuredListWrappe);
58
+ StructuredListWrapper.defaultProps = _defineProperty({
86
59
  selection: false,
87
60
  isCondensed: false,
88
- isFlush: false,
89
- ariaLabel: 'Structured list section'
90
- };
61
+ isFlush: false
62
+ }, 'aria-label', 'Structured list section');
91
63
  function StructuredListHead(props) {
92
64
  var children = props.children,
93
65
  className = props.className,
@@ -274,7 +246,7 @@ StructuredListInput.propTypes = {
274
246
  /**
275
247
  * Provide an optional hook that is called each time the input is updated
276
248
  */
277
- onChange: deprecate(PropTypes.func, "\nThe prop `onChange` will be removed in the next major version of Carbon."),
249
+ onChange: PropTypes.func,
278
250
 
279
251
  /**
280
252
  * Provide a `title` for the input
@@ -11,6 +11,7 @@ import cx from 'classnames';
11
11
  import debounce from 'lodash.debounce';
12
12
  import PropTypes from 'prop-types';
13
13
  import React__default, { useState, useRef, useCallback, useEffect } from 'react';
14
+ import '../Tooltip/DefinitionTooltip.js';
14
15
  import { Tooltip } from '../Tooltip/Tooltip.js';
15
16
  import { useControllableState } from '../../internal/useControllableState.js';
16
17
  import { useEffectOnce } from '../../internal/useEffectOnce.js';
@@ -20,13 +21,14 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
20
21
  import { getInteractiveContent } from '../../internal/useNoInteractiveChildren.js';
21
22
  import { usePrefix } from '../../internal/usePrefix.js';
22
23
  import { usePressable } from './usePressable.js';
24
+ import deprecate from '../../prop-types/deprecate.js';
23
25
  import { matches, match } from '../../internal/keyboard/match.js';
24
26
  import { ArrowRight, ArrowLeft, Home, End } from '../../internal/keyboard/keys.js';
25
27
 
26
28
  var _ChevronLeft, _ChevronRight;
27
29
 
28
30
  var _excluded = ["activation", "aria-label", "children", "className", "contained", "iconSize", "leftOverflowButtonProps", "light", "rightOverflowButtonProps", "scrollDebounceWait", "scrollIntoView"],
29
- _excluded2 = ["as", "children", "className", "disabled", "onClick", "onKeyDown"],
31
+ _excluded2 = ["as", "children", "className", "disabled", "onClick", "onKeyDown", "secondaryLabel", "hasSecondaryLabel"],
30
32
  _excluded3 = ["children", "className", "defaultOpen", "enterDelayMs", "leaveDelayMs", "label"],
31
33
  _excluded4 = ["children", "className"];
32
34
 
@@ -164,7 +166,10 @@ function TabList(_ref2) {
164
166
  scrollLeft = _useState6[0],
165
167
  setScrollLeft = _useState6[1];
166
168
 
167
- var className = cx("".concat(prefix, "--tabs"), customClassName, (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--tabs--contained"), contained), _defineProperty(_cx, "".concat(prefix, "--tabs--light"), light), _defineProperty(_cx, "".concat(prefix, "--tabs__icon--default"), iconSize === 'default'), _defineProperty(_cx, "".concat(prefix, "--tabs__icon--lg"), iconSize === 'lg'), _cx)); // Previous Button
169
+ var hasSecondaryLabelTabs = contained && !!React__default.Children.toArray(children).filter(function (child) {
170
+ return child.props.secondaryLabel;
171
+ }).length;
172
+ var className = cx("".concat(prefix, "--tabs"), customClassName, (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--tabs--contained"), contained), _defineProperty(_cx, "".concat(prefix, "--tabs--light"), light), _defineProperty(_cx, "".concat(prefix, "--tabs__icon--default"), iconSize === 'default'), _defineProperty(_cx, "".concat(prefix, "--tabs__icon--lg"), iconSize === 'lg'), _defineProperty(_cx, "".concat(prefix, "--tabs--tall"), hasSecondaryLabelTabs), _cx)); // Previous Button
168
173
  // VISIBLE IF:
169
174
  // SCROLLABLE
170
175
  // AND SCROLL_LEFT > 0
@@ -324,7 +329,8 @@ function TabList(_ref2) {
324
329
  }, /*#__PURE__*/React__default.cloneElement(child, {
325
330
  ref: function ref(node) {
326
331
  tabs.current[index] = node;
327
- }
332
+ },
333
+ hasSecondaryLabel: hasSecondaryLabelTabs
328
334
  }));
329
335
  })), /*#__PURE__*/React__default.createElement("button", _extends({
330
336
  "aria-hidden": "true",
@@ -377,7 +383,7 @@ TabList.propTypes = {
377
383
  /**
378
384
  * Specify whether or not to use the light component variant
379
385
  */
380
- light: PropTypes.bool,
386
+ light: deprecate(PropTypes.bool, 'The `light` prop for `TabList` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
381
387
 
382
388
  /**
383
389
  * Provide the props that describe the right overflow button
@@ -449,6 +455,8 @@ var Tab = /*#__PURE__*/React__default.forwardRef(function Tab(_ref5, ref) {
449
455
  disabled = _ref5.disabled,
450
456
  _onClick = _ref5.onClick,
451
457
  onKeyDown = _ref5.onKeyDown,
458
+ secondaryLabel = _ref5.secondaryLabel,
459
+ hasSecondaryLabel = _ref5.hasSecondaryLabel,
452
460
  rest = _objectWithoutProperties(_ref5, _excluded2);
453
461
 
454
462
  var prefix = usePrefix();
@@ -485,7 +493,11 @@ var Tab = /*#__PURE__*/React__default.forwardRef(function Tab(_ref5, ref) {
485
493
  onKeyDown: onKeyDown,
486
494
  tabIndex: selectedIndex === index ? '0' : '-1',
487
495
  type: "button"
488
- }), children);
496
+ }), /*#__PURE__*/React__default.createElement("span", {
497
+ className: "".concat(prefix, "--tabs__nav-item-label")
498
+ }, children), hasSecondaryLabel && /*#__PURE__*/React__default.createElement("div", {
499
+ className: "".concat(prefix, "--tabs__nav-item-secondary-label")
500
+ }, secondaryLabel));
489
501
  });
490
502
  Tab.propTypes = {
491
503
  /**
@@ -508,6 +520,11 @@ Tab.propTypes = {
508
520
  */
509
521
  disabled: PropTypes.bool,
510
522
 
523
+ /*
524
+ * Internal use only, determines wether a tab should render as a secondary label tab
525
+ **/
526
+ hasSecondaryLabel: PropTypes.bool,
527
+
511
528
  /**
512
529
  * Provide a handler that is invoked when a user clicks on the control
513
530
  */
@@ -523,7 +540,13 @@ Tab.propTypes = {
523
540
  * Useful for using Tab along with react-router or other client
524
541
  * side router libraries.
525
542
  **/
526
- renderButton: PropTypes.func
543
+ renderButton: PropTypes.func,
544
+
545
+ /*
546
+ * An optional label to render under the primary tab label.
547
+ /* This prop is only useful for conained tabs
548
+ **/
549
+ secondaryLabel: PropTypes.string
527
550
  };
528
551
  var IconTab = /*#__PURE__*/React__default.forwardRef(function IconTab(_ref6, ref) {
529
552
  var children = _ref6.children,
@@ -0,0 +1,33 @@
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 PropTypes from 'prop-types';
8
+ import React from 'react';
9
+ export interface TextAreaSkeletonProps extends React.InputHTMLAttributes<HTMLDivElement> {
10
+ /**
11
+ * Specify an optional className to add to the form item wrapper.
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Specify whether the label should be hidden, or not
16
+ */
17
+ hideLabel?: boolean;
18
+ }
19
+ declare const TextAreaSkeleton: {
20
+ (props: TextAreaSkeletonProps): JSX.Element;
21
+ propTypes: {
22
+ /**
23
+ * Specify an optional className to add to the form item wrapper.
24
+ */
25
+ className: PropTypes.Requireable<string>;
26
+ /**
27
+ * Specify whether the label should be hidden, or not
28
+ */
29
+ hideLabel: PropTypes.Requireable<boolean>;
30
+ };
31
+ };
32
+ export default TextAreaSkeleton;
33
+ export { TextAreaSkeleton };
@@ -11,12 +11,12 @@ import React__default from 'react';
11
11
  import cx from 'classnames';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
13
 
14
- var _excluded = ["hideLabel", "className"];
14
+ var _excluded = ["className", "hideLabel"];
15
15
 
16
- var TextAreaSkeleton = function TextAreaSkeleton(_ref) {
17
- var hideLabel = _ref.hideLabel,
18
- className = _ref.className,
19
- rest = _objectWithoutProperties(_ref, _excluded);
16
+ var TextAreaSkeleton = function TextAreaSkeleton(props) {
17
+ var className = props.className,
18
+ hideLabel = props.hideLabel,
19
+ rest = _objectWithoutProperties(props, _excluded);
20
20
 
21
21
  var prefix = usePrefix();
22
22
  return /*#__PURE__*/React__default.createElement("div", _extends({
@@ -6,8 +6,7 @@
6
6
  */
7
7
  import { ReactNodeLike } from 'prop-types';
8
8
  import React from 'react';
9
- type ExcludedAttributes = '';
10
- export interface TextAreaProps extends Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, ExcludedAttributes> {
9
+ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaElement> {
11
10
  /**
12
11
  * Provide a custom className that is applied directly to the underlying
13
12
  * `<textarea>` node
@@ -90,6 +89,14 @@ export interface TextAreaProps extends Omit<React.InputHTMLAttributes<HTMLTextAr
90
89
  * Provide the current value of the `<textarea>`
91
90
  */
92
91
  value?: string | number;
92
+ /**
93
+ * Specify whether the control is currently in warning state
94
+ */
95
+ warn?: boolean;
96
+ /**
97
+ * Provide the text that is displayed when the control is in warning state
98
+ */
99
+ warnText?: ReactNodeLike;
93
100
  }
94
101
  declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<unknown>>;
95
102
  export default TextArea;
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
10
10
  import React__default, { useContext, useState, useRef } from 'react';
11
11
  import cx from 'classnames';
12
12
  import deprecate from '../../prop-types/deprecate.js';
13
- import { WarningFilled } from '@carbon/icons-react';
13
+ import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
14
14
  import { useFeatureFlag } from '../FeatureFlags/index.js';
15
15
  import { usePrefix } from '../../internal/usePrefix.js';
16
16
  import '../FluidForm/FluidForm.js';
@@ -19,9 +19,9 @@ import { useAnnouncer } from '../../internal/useAnnouncer.js';
19
19
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
20
20
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
21
21
 
22
- var _excluded = ["className", "id", "labelText", "hideLabel", "onChange", "onClick", "invalid", "invalidText", "helperText", "light", "placeholder", "enableCounter", "maxCount"];
22
+ var _excluded = ["className", "id", "labelText", "hideLabel", "onChange", "onClick", "invalid", "invalidText", "helperText", "light", "placeholder", "enableCounter", "maxCount", "warn", "warnText"];
23
23
  var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRef) {
24
- var _classNames, _classNames4;
24
+ var _classNames, _classNames4, _classNames5;
25
25
 
26
26
  var className = props.className,
27
27
  id = props.id,
@@ -36,6 +36,9 @@ var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRe
36
36
  placeholder = props.placeholder,
37
37
  enableCounter = props.enableCounter,
38
38
  maxCount = props.maxCount,
39
+ _props$warn = props.warn,
40
+ warn = _props$warn === void 0 ? false : _props$warn,
41
+ warnText = props.warnText,
39
42
  other = _objectWithoutProperties(props, _excluded);
40
43
 
41
44
  var prefix = usePrefix();
@@ -97,7 +100,13 @@ var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRe
97
100
  }, invalidText, isFluid && /*#__PURE__*/React__default.createElement(WarningFilled, {
98
101
  className: "".concat(prefix, "--text-area__invalid-icon")
99
102
  })) : null;
100
- var textareaClasses = cx("".concat(prefix, "--text-area"), [enabled ? null : className], (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--text-area--light"), light), _defineProperty(_classNames4, "".concat(prefix, "--text-area--invalid"), invalid), _classNames4));
103
+ var warning = warn ? /*#__PURE__*/React__default.createElement("div", {
104
+ role: "alert",
105
+ className: "".concat(prefix, "--form-requirement")
106
+ }, warnText, isFluid && /*#__PURE__*/React__default.createElement(WarningAltFilled, {
107
+ className: "".concat(prefix, "--text-area__invalid-icon ").concat(prefix, "--text-area__invalid-icon--warning")
108
+ })) : null;
109
+ var textareaClasses = cx("".concat(prefix, "--text-area"), [enabled ? null : className], (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--text-area--light"), light), _defineProperty(_classNames4, "".concat(prefix, "--text-area--invalid"), invalid), _defineProperty(_classNames4, "".concat(prefix, "--text-area--warn"), warn), _classNames4));
101
110
  var textareaRef = useRef(null);
102
111
  var ref = useMergedRefs([forwardRef, textareaRef]);
103
112
  useIsomorphicEffect(function () {
@@ -122,16 +131,18 @@ var TextArea = /*#__PURE__*/React__default.forwardRef(function (props, forwardRe
122
131
  }, /*#__PURE__*/React__default.createElement("div", {
123
132
  className: "".concat(prefix, "--text-area__label-wrapper")
124
133
  }, label, counter), /*#__PURE__*/React__default.createElement("div", {
125
- className: cx("".concat(prefix, "--text-area__wrapper"), _defineProperty({}, "".concat(prefix, "--text-area__wrapper--readonly"), other.readOnly)),
134
+ className: cx("".concat(prefix, "--text-area__wrapper"), (_classNames5 = {}, _defineProperty(_classNames5, "".concat(prefix, "--text-area__wrapper--readonly"), other.readOnly), _defineProperty(_classNames5, "".concat(prefix, "--text-area__wrapper--warn"), warn), _classNames5)),
126
135
  "data-invalid": invalid || null
127
136
  }, invalid && !isFluid && /*#__PURE__*/React__default.createElement(WarningFilled, {
128
137
  className: "".concat(prefix, "--text-area__invalid-icon")
138
+ }), warn && !invalid && !isFluid && /*#__PURE__*/React__default.createElement(WarningAltFilled, {
139
+ className: "".concat(prefix, "--text-area__invalid-icon ").concat(prefix, "--text-area__invalid-icon--warning")
129
140
  }), input, /*#__PURE__*/React__default.createElement("span", {
130
141
  className: "".concat(prefix, "--text-area__counter-alert"),
131
142
  role: "alert"
132
143
  }, ariaAnnouncement), isFluid && /*#__PURE__*/React__default.createElement("hr", {
133
144
  className: "".concat(prefix, "--text-area__divider")
134
- }), isFluid && invalid ? error : null), invalid && !isFluid ? error : helper);
145
+ }), isFluid && invalid ? error : null, isFluid && warn && !invalid ? warning : null), !invalid && !warn && !isFluid ? helper : null, invalid && !isFluid ? error : null, warn && !invalid && !isFluid ? warning : null);
135
146
  });
136
147
  TextArea.displayName = 'TextArea';
137
148
  TextArea.propTypes = {
@@ -233,7 +244,17 @@ TextArea.propTypes = {
233
244
  /**
234
245
  * Provide the current value of the `<textarea>`
235
246
  */
236
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
247
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
248
+
249
+ /**
250
+ * Specify whether the control is currently in warning state
251
+ */
252
+ warn: PropTypes.bool,
253
+
254
+ /**
255
+ * Provide the text that is displayed when the control is in warning state
256
+ */
257
+ warnText: PropTypes.node
237
258
  };
238
259
  TextArea.defaultProps = {
239
260
  disabled: false,
@@ -245,7 +266,9 @@ TextArea.defaultProps = {
245
266
  invalidText: '',
246
267
  helperText: '',
247
268
  enableCounter: false,
248
- maxCount: undefined
269
+ maxCount: undefined,
270
+ warn: false,
271
+ warnText: ''
249
272
  };
250
273
  var TextArea$1 = TextArea;
251
274
 
@@ -7,3 +7,4 @@
7
7
 
8
8
  import TextArea from './TextArea.js';
9
9
  export { default as TextArea, default } from './TextArea.js';
10
+ export { default as TextAreaSkeleton } from './TextArea.Skeleton.js';
@@ -0,0 +1,33 @@
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 PropTypes from 'prop-types';
8
+ import React from 'react';
9
+ export interface TextInputSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ /**
11
+ * Specify an optional className to add to the form item wrapper.
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Specify whether the label should be hidden or not.
16
+ */
17
+ hideLabel?: boolean;
18
+ }
19
+ declare const TextInputSkeleton: {
20
+ ({ hideLabel, className, ...rest }: TextInputSkeletonProps): JSX.Element;
21
+ propTypes: {
22
+ /**
23
+ * Specify an optional className to add to the form item wrapper.
24
+ */
25
+ className: PropTypes.Requireable<string>;
26
+ /**
27
+ * Specify whether the label should be hidden, or not
28
+ */
29
+ hideLabel: PropTypes.Requireable<boolean>;
30
+ };
31
+ };
32
+ export default TextInputSkeleton;
33
+ export { TextInputSkeleton };
@@ -10,6 +10,7 @@ import ControlledPasswordInput from './ControlledPasswordInput.js';
10
10
  import PasswordInput from './PasswordInput.js';
11
11
  import TextInput from './TextInput.js';
12
12
  export { default as TextInput, default } from './TextInput.js';
13
+ export { default as TextInputSkeleton } from './TextInput.Skeleton.js';
13
14
 
14
15
  TextInput.ControlledPasswordInput = ControlledPasswordInput;
15
16
  TextInput.PasswordInput = PasswordInput;
@@ -22,7 +22,7 @@ import { Enter, Space } from '../../internal/keyboard/keys.js';
22
22
  var _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
23
23
 
24
24
  var _excluded = ["children", "className", "light"],
25
- _excluded2 = ["children", "className", "clicked", "href", "light", "onClick", "onKeyDown"],
25
+ _excluded2 = ["children", "className", "clicked", "disabled", "href", "light", "onClick", "onKeyDown"],
26
26
  _excluded3 = ["children", "className", "disabled", "id", "light", "name", "onClick", "onChange", "onKeyDown", "selected", "tabIndex", "title", "value"],
27
27
  _excluded4 = ["tabIndex", "className", "children", "expanded", "tileMaxHeight", "tilePadding", "onClick", "onKeyUp", "tileCollapsedIconText", "tileExpandedIconText", "tileCollapsedLabel", "tileExpandedLabel", "light"];
28
28
  var Tile = /*#__PURE__*/React__default.forwardRef(function Tile(_ref, ref) {
@@ -64,6 +64,7 @@ var ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableTil
64
64
  className = _ref2.className,
65
65
  _ref2$clicked = _ref2.clicked,
66
66
  clicked = _ref2$clicked === void 0 ? false : _ref2$clicked,
67
+ disabled = _ref2.disabled,
67
68
  href = _ref2.href,
68
69
  light = _ref2.light,
69
70
  _ref2$onClick = _ref2.onClick,
@@ -101,9 +102,10 @@ var ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableTil
101
102
  return /*#__PURE__*/React__default.createElement(Link, _extends({
102
103
  className: classes,
103
104
  href: href,
104
- onClick: handleOnClick,
105
+ onClick: !disabled ? handleOnClick : null,
105
106
  onKeyDown: handleOnKeyDown,
106
- ref: ref
107
+ ref: ref,
108
+ disabled: disabled
107
109
  }, rest), children);
108
110
  });
109
111
  ClickableTile.displayName = 'ClickableTile';
@@ -123,6 +125,11 @@ ClickableTile.propTypes = {
123
125
  */
124
126
  clicked: PropTypes.bool,
125
127
 
128
+ /**
129
+ * Specify whether the ClickableTile should be disabled
130
+ */
131
+ disabled: PropTypes.bool,
132
+
126
133
  /**
127
134
  * The href for the link.
128
135
  */
@@ -359,7 +366,7 @@ function ExpandableTile(_ref4) {
359
366
  isExpanded = _useState18[0],
360
367
  setIsExpanded = _useState18[1];
361
368
 
362
- var _useState19 = useState(false),
369
+ var _useState19 = useState(true),
363
370
  _useState20 = _slicedToArray(_useState19, 2),
364
371
  interactive = _useState20[0],
365
372
  setInteractive = _useState20[1];
@@ -429,11 +436,11 @@ function ExpandableTile(_ref4) {
429
436
  setIsTilePadding(paddingTop + paddingBottom);
430
437
  }, [isTileMaxHeight]);
431
438
  useIsomorphicEffect(function () {
432
- if (getInteractiveContent(belowTheFold.current)) {
433
- setInteractive(true);
439
+ if (!getInteractiveContent(belowTheFold.current)) {
440
+ setInteractive(false);
434
441
  return;
435
- } else if (getInteractiveContent(aboveTheFold.current)) {
436
- setInteractive(true);
442
+ } else if (!getInteractiveContent(aboveTheFold.current)) {
443
+ setInteractive(false);
437
444
  }
438
445
  }, []);
439
446
  useIsomorphicEffect(function () {
@@ -64,8 +64,8 @@ function Toggle(_ref) {
64
64
 
65
65
  var isSm = size === 'sm';
66
66
  var sideLabel = hideLabel ? labelText : checked ? labelB : labelA;
67
- var renderSideLabel = !(hideLabel && ariaLabelledby);
68
- var LabelComponent = ariaLabelledby ? 'div' : 'label';
67
+ var renderSideLabel = !(hideLabel && !labelText);
68
+ var LabelComponent = labelText ? 'label' : 'div';
69
69
  var wrapperClasses = cx("".concat(prefix, "--toggle"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--toggle--disabled"), disabled), _defineProperty(_classNames, "".concat(prefix, "--toggle--readonly"), readOnly), _classNames), className);
70
70
  var labelTextClasses = cx("".concat(prefix, "--toggle__label-text"), _defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLabel));
71
71
  var appearanceClasses = cx("".concat(prefix, "--toggle__appearance"), _defineProperty({}, "".concat(prefix, "--toggle__appearance--sm"), isSm));
@@ -75,7 +75,7 @@ function Toggle(_ref) {
75
75
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
76
76
  React__default.createElement("div", {
77
77
  className: wrapperClasses,
78
- onClick: ariaLabelledby ? function (e) {
78
+ onClick: !labelText ? function (e) {
79
79
  // the underlying <button> can only be activated by keyboard as it is visually hidden;
80
80
  // therefore, if this event's target is the <button>, it had to be triggered by
81
81
  // the keyboard event which already calls handleClick. if we wouldn't catch this, the
@@ -141,10 +141,7 @@ Toggle.propTypes = {
141
141
 
142
142
  /**
143
143
  * If true, the side labels (props.labelA and props.labelB) will be replaced by
144
- * props.labelText, so that the toggle doesn't render a top label. In order to fully
145
- * hide any labels, you can use props['aria-labelledby'] to refer to another element
146
- * that labels the toggle. props.labelText would no longer be required in that case
147
- * and can therefore be omitted.
144
+ * props.labelText (if passed), so that the toggle doesn't render a top label.
148
145
  */
149
146
  hideLabel: PropTypes.bool,
150
147
 
@@ -165,19 +162,11 @@ Toggle.propTypes = {
165
162
 
166
163
  /**
167
164
  * Provide the text that will be read by a screen reader when visiting this
168
- * control. This is required unless 'aria-labelledby' is provided instead
165
+ * control. This should be provided unless 'aria-labelledby' is set instead
166
+ * or you use an external <label> element with its "for" attribute set to the
167
+ * toggle's id.
169
168
  */
170
- labelText: function labelText(props) {
171
- if (!props['aria-labelledby'] && !props.labelText) {
172
- return new Error('labelText property is required if no aria-labelledby is provided.');
173
- }
174
-
175
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
176
- rest[_key - 1] = arguments[_key];
177
- }
178
-
179
- return PropTypes.node.apply(PropTypes, [props].concat(rest));
180
- },
169
+ labelText: PropTypes.string,
181
170
 
182
171
  /**
183
172
  * Provide an event listener that is called when the control is clicked
@@ -0,0 +1,52 @@
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 React from 'react';
8
+ import { PopoverAlignment } from '../Popover';
9
+ export interface DefinitionTooltipProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'id' | 'classname' | 'children' | 'type'> {
10
+ /**
11
+ * Specify how the trigger should align with the tooltip
12
+ */
13
+ align?: PopoverAlignment;
14
+ /**
15
+ * The `children` prop will be used as the value that is being defined
16
+ */
17
+ children?: React.ReactNode;
18
+ /**
19
+ * Specify an optional className to be applied to the container node
20
+ */
21
+ className?: string;
22
+ /**
23
+ * Specify whether the tooltip should be open when it first renders
24
+ */
25
+ defaultOpen?: boolean;
26
+ /**
27
+ * The `definition` prop is used as the content inside of the tooltip that
28
+ * appears when a user interacts with the element rendered by the `children`
29
+ * prop
30
+ */
31
+ definition: React.ReactNode;
32
+ /**
33
+ * Provide a value that will be assigned as the id of the tooltip
34
+ */
35
+ id?: string;
36
+ /**
37
+ * Specifies whether or not the `DefinitionTooltip` should open on hover or not
38
+ */
39
+ openOnHover?: boolean;
40
+ /**
41
+ * @deprecated [Deprecated in v11] Please use the `definition` prop instead.
42
+ *
43
+ * Provide the text that will be displayed in the tooltip when it is rendered.
44
+ */
45
+ tooltipText?: React.ReactNode;
46
+ /**
47
+ * The CSS class name of the trigger element
48
+ */
49
+ triggerClassName?: string;
50
+ }
51
+ declare const DefinitionTooltip: React.FC<DefinitionTooltipProps>;
52
+ export { DefinitionTooltip };
@@ -18,7 +18,7 @@ import { Escape } from '../../internal/keyboard/keys.js';
18
18
 
19
19
  var _excluded = ["align", "className", "children", "definition", "defaultOpen", "id", "openOnHover", "tooltipText", "triggerClassName"];
20
20
 
21
- function DefinitionTooltip(_ref) {
21
+ var DefinitionTooltip = function DefinitionTooltip(_ref) {
22
22
  var _ref$align = _ref.align,
23
23
  align = _ref$align === void 0 ? 'bottom-left' : _ref$align,
24
24
  className = _ref.className,
@@ -75,7 +75,7 @@ function DefinitionTooltip(_ref) {
75
75
  className: "".concat(prefix, "--definition-tooltip"),
76
76
  id: tooltipId
77
77
  }, tooltipText !== null && tooltipText !== void 0 ? tooltipText : definition));
78
- }
78
+ };
79
79
 
80
80
  DefinitionTooltip.propTypes = {
81
81
  /**