@carbon/react 1.24.0-rc.0 → 1.25.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 (151) hide show
  1. package/es/components/CodeSnippet/CodeSnippet.js +13 -115
  2. package/es/components/ComboBox/ComboBox.d.ts +6 -0
  3. package/es/components/ComboBox/ComboBox.js +19 -172
  4. package/es/components/ComboButton/index.js +164 -0
  5. package/es/components/ComposedModal/ComposedModal.js +1 -2
  6. package/es/components/DataTable/TableToolbar.d.ts +19 -0
  7. package/es/components/DataTable/TableToolbar.js +1 -1
  8. package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
  9. package/es/components/DataTable/TableToolbarContent.d.ts +21 -0
  10. package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
  11. package/es/components/DataTable/TableToolbarMenu.js +3 -3
  12. package/es/components/DataTable/tools/sorting.js +2 -1
  13. package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  14. package/es/components/Dropdown/Dropdown.d.ts +6 -0
  15. package/es/components/Dropdown/Dropdown.js +8 -145
  16. package/es/components/FileUploader/FileUploader.js +1 -1
  17. package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
  18. package/es/components/FileUploader/FileUploaderItem.js +2 -1
  19. package/es/components/FileUploader/Filename.js +8 -2
  20. package/es/components/FluidTextArea/FluidTextArea.js +12 -1
  21. package/es/components/IconButton/index.js +1 -0
  22. package/es/components/ListBox/ListBoxMenuItem.d.ts +2 -2
  23. package/es/components/ListBox/ListBoxSelection.js +4 -23
  24. package/es/components/ListBox/next/ListBoxSelection.js +2 -23
  25. package/es/components/Menu/Menu.js +50 -33
  26. package/es/components/Menu/MenuContext.js +3 -6
  27. package/es/components/Menu/MenuItem.js +1 -0
  28. package/es/components/MenuButton/index.js +127 -0
  29. package/es/components/Modal/Modal.js +4 -3
  30. package/es/components/MultiSelect/FilterableMultiSelect.js +31 -137
  31. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  32. package/es/components/MultiSelect/MultiSelect.js +48 -26
  33. package/es/components/Notification/Notification.js +27 -264
  34. package/es/components/OverflowMenu/OverflowMenu.js +13 -139
  35. package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  36. package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  37. package/es/components/OverflowMenuV2/index.js +15 -51
  38. package/es/components/Popover/index.d.ts +55 -0
  39. package/es/components/Popover/index.js +61 -29
  40. package/es/components/RadioButtonGroup/RadioButtonGroup.js +7 -4
  41. package/es/components/RadioTile/RadioTile.js +6 -6
  42. package/es/components/Select/Select.d.ts +89 -0
  43. package/es/components/SelectItem/SelectItem.d.ts +62 -0
  44. package/es/components/SelectItem/SelectItem.js +2 -4
  45. package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  46. package/es/components/SkeletonText/SkeletonText.js +1 -1
  47. package/es/components/Slider/Slider.Skeleton.d.ts +2 -2
  48. package/es/components/Slider/Slider.d.ts +355 -0
  49. package/es/components/Slider/Slider.js +63 -35
  50. package/es/components/StructuredList/StructuredList.js +10 -38
  51. package/es/components/Tabs/Tabs.js +3 -1
  52. package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  53. package/es/components/TextArea/TextArea.Skeleton.js +5 -5
  54. package/es/components/TextArea/TextArea.d.ts +9 -2
  55. package/es/components/TextArea/TextArea.js +31 -8
  56. package/es/components/TextArea/index.js +1 -0
  57. package/es/components/TextInput/TextInput.d.ts +106 -0
  58. package/es/components/TextInput/TextInput.js +3 -2
  59. package/es/components/Toggle/Toggle.js +8 -19
  60. package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  61. package/es/components/Tooltip/DefinitionTooltip.js +2 -2
  62. package/es/components/Tooltip/Tooltip.d.ts +117 -0
  63. package/es/components/Tooltip/Tooltip.js +6 -4
  64. package/es/components/Tooltip/index.d.ts +9 -0
  65. package/es/index.d.ts +2 -0
  66. package/es/index.js +5 -3
  67. package/es/internal/ClickListener.js +1 -2
  68. package/es/internal/keyboard/match.js +1 -1
  69. package/es/internal/useAttachedMenu.js +85 -0
  70. package/es/internal/useDelayedState.d.ts +19 -0
  71. package/es/internal/useDelayedState.js +7 -3
  72. package/es/internal/useId.js +1 -1
  73. package/es/internal/useMergedRefs.d.ts +13 -0
  74. package/es/internal/useMergedRefs.js +2 -5
  75. package/es/internal/useNormalizedInputProps.js +1 -0
  76. package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
  77. package/lib/components/ComboBox/ComboBox.d.ts +6 -0
  78. package/lib/components/ComboBox/ComboBox.js +18 -171
  79. package/lib/components/ComboButton/index.js +174 -0
  80. package/lib/components/ComposedModal/ComposedModal.js +1 -2
  81. package/lib/components/DataTable/TableToolbar.d.ts +19 -0
  82. package/lib/components/DataTable/TableToolbar.js +1 -1
  83. package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
  84. package/lib/components/DataTable/TableToolbarContent.d.ts +21 -0
  85. package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
  86. package/lib/components/DataTable/TableToolbarMenu.js +3 -3
  87. package/lib/components/DataTable/tools/sorting.js +2 -1
  88. package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  89. package/lib/components/Dropdown/Dropdown.d.ts +6 -0
  90. package/lib/components/Dropdown/Dropdown.js +7 -144
  91. package/lib/components/FileUploader/FileUploader.js +1 -1
  92. package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
  93. package/lib/components/FileUploader/FileUploaderItem.js +2 -1
  94. package/lib/components/FileUploader/Filename.js +8 -2
  95. package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
  96. package/lib/components/IconButton/index.js +1 -0
  97. package/lib/components/ListBox/ListBoxMenuItem.d.ts +2 -2
  98. package/lib/components/ListBox/ListBoxSelection.js +4 -23
  99. package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
  100. package/lib/components/Menu/Menu.js +50 -33
  101. package/lib/components/Menu/MenuContext.js +3 -6
  102. package/lib/components/Menu/MenuItem.js +1 -0
  103. package/lib/components/MenuButton/index.js +137 -0
  104. package/lib/components/Modal/Modal.js +4 -3
  105. package/lib/components/MultiSelect/FilterableMultiSelect.js +29 -135
  106. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  107. package/lib/components/MultiSelect/MultiSelect.js +47 -25
  108. package/lib/components/Notification/Notification.js +27 -264
  109. package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
  110. package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  111. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  112. package/lib/components/OverflowMenuV2/index.js +13 -49
  113. package/lib/components/Popover/index.d.ts +55 -0
  114. package/lib/components/Popover/index.js +61 -29
  115. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +6 -3
  116. package/lib/components/RadioTile/RadioTile.js +6 -6
  117. package/lib/components/Select/Select.d.ts +89 -0
  118. package/lib/components/SelectItem/SelectItem.d.ts +62 -0
  119. package/lib/components/SelectItem/SelectItem.js +1 -3
  120. package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  121. package/lib/components/SkeletonText/SkeletonText.js +1 -1
  122. package/lib/components/Slider/Slider.Skeleton.d.ts +2 -2
  123. package/lib/components/Slider/Slider.d.ts +355 -0
  124. package/lib/components/Slider/Slider.js +62 -34
  125. package/lib/components/StructuredList/StructuredList.js +10 -38
  126. package/lib/components/Tabs/Tabs.js +3 -1
  127. package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  128. package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
  129. package/lib/components/TextArea/TextArea.d.ts +9 -2
  130. package/lib/components/TextArea/TextArea.js +30 -7
  131. package/lib/components/TextArea/index.js +2 -0
  132. package/lib/components/TextInput/TextInput.d.ts +106 -0
  133. package/lib/components/TextInput/TextInput.js +3 -2
  134. package/lib/components/Toggle/Toggle.js +8 -19
  135. package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  136. package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
  137. package/lib/components/Tooltip/Tooltip.d.ts +117 -0
  138. package/lib/components/Tooltip/Tooltip.js +6 -4
  139. package/lib/components/Tooltip/index.d.ts +9 -0
  140. package/lib/index.d.ts +2 -0
  141. package/lib/index.js +50 -46
  142. package/lib/internal/ClickListener.js +1 -2
  143. package/lib/internal/keyboard/match.js +1 -1
  144. package/lib/internal/useAttachedMenu.js +89 -0
  145. package/lib/internal/useDelayedState.d.ts +19 -0
  146. package/lib/internal/useDelayedState.js +7 -3
  147. package/lib/internal/useId.js +1 -1
  148. package/lib/internal/useMergedRefs.d.ts +13 -0
  149. package/lib/internal/useMergedRefs.js +2 -5
  150. package/lib/internal/useNormalizedInputProps.js +1 -0
  151. package/package.json +10 -10
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass, objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { defineProperty as _defineProperty, inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, assertThisInitialized as _assertThisInitialized, createClass as _createClass, objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { PureComponent } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
@@ -59,6 +59,16 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
59
59
  isValid: true
60
60
  });
61
61
 
62
+ _defineProperty(_assertThisInitialized(_this), "thumbRef", void 0);
63
+
64
+ _defineProperty(_assertThisInitialized(_this), "filledTrackRef", void 0);
65
+
66
+ _defineProperty(_assertThisInitialized(_this), "element", null);
67
+
68
+ _defineProperty(_assertThisInitialized(_this), "inputId", '');
69
+
70
+ _defineProperty(_assertThisInitialized(_this), "track", void 0);
71
+
62
72
  _defineProperty(_assertThisInitialized(_this), "onDragStart", function (evt) {
63
73
  // Do nothing if component is disabled
64
74
  if (_this.props.disabled || _this.props.readOnly) {
@@ -67,11 +77,15 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
67
77
 
68
78
 
69
79
  DRAG_STOP_EVENT_TYPES.forEach(function (element) {
70
- _this.element.ownerDocument.addEventListener(element, _this.onDragStop);
80
+ var _this$element;
81
+
82
+ (_this$element = _this.element) === null || _this$element === void 0 ? void 0 : _this$element.ownerDocument.addEventListener(element, _this.onDragStop);
71
83
  }); // Register drag handlers
72
84
 
73
85
  DRAG_EVENT_TYPES.forEach(function (element) {
74
- _this.element.ownerDocument.addEventListener(element, _this.onDrag);
86
+ var _this$element2;
87
+
88
+ (_this$element2 = _this.element) === null || _this$element2 === void 0 ? void 0 : _this$element2.ownerDocument.addEventListener(element, _this.onDrag);
75
89
  }); // Perform first recalculation since we probably didn't click exactly in the
76
90
  // middle of the thumb
77
91
 
@@ -86,11 +100,15 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
86
100
 
87
101
 
88
102
  DRAG_STOP_EVENT_TYPES.forEach(function (element) {
89
- _this.element.ownerDocument.removeEventListener(element, _this.onDragStop);
103
+ var _this$element3;
104
+
105
+ (_this$element3 = _this.element) === null || _this$element3 === void 0 ? void 0 : _this$element3.ownerDocument.removeEventListener(element, _this.onDragStop);
90
106
  }); // Remove drag handlers
91
107
 
92
108
  DRAG_EVENT_TYPES.forEach(function (element) {
93
- _this.element.ownerDocument.removeEventListener(element, _this.onDrag);
109
+ var _this$element4;
110
+
111
+ (_this$element4 = _this.element) === null || _this$element4 === void 0 ? void 0 : _this$element4.ownerDocument.removeEventListener(element, _this.onDrag);
94
112
  }); // Set needsOnRelease flag so event fires on next update
95
113
 
96
114
  _this.setState({
@@ -135,18 +153,23 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
135
153
  }));
136
154
 
137
155
  _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (evt) {
156
+ var _this$props$step3, _this$props$step4, _this$props$step5, _this$props$step6;
157
+
138
158
  // Do nothing if component is disabled or we don't have a valid event
139
159
  if (_this.props.disabled || _this.props.readOnly || !('which' in evt)) {
140
160
  return;
141
161
  }
142
162
 
143
- var which = Number.parseInt(evt.which);
144
163
  var delta = 0;
145
164
 
146
- if (matches(which, [ArrowDown, ArrowLeft])) {
147
- delta = -_this.props.step;
148
- } else if (matches(which, [ArrowUp, ArrowRight])) {
149
- delta = _this.props.step;
165
+ if (matches(evt.which, [ArrowDown, ArrowLeft])) {
166
+ var _this$props$step;
167
+
168
+ delta = -((_this$props$step = _this.props.step) !== null && _this$props$step !== void 0 ? _this$props$step : Slider.defaultProps.step);
169
+ } else if (matches(evt.which, [ArrowUp, ArrowRight])) {
170
+ var _this$props$step2;
171
+
172
+ delta = (_this$props$step2 = _this.props.step) !== null && _this$props$step2 !== void 0 ? _this$props$step2 : Slider.defaultProps.step;
150
173
  } else {
151
174
  // Ignore keys we don't want to handle
152
175
  return;
@@ -155,15 +178,15 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
155
178
 
156
179
  if (evt.shiftKey) {
157
180
  var stepMultiplier = _this.props.stepMultiplier;
158
- delta *= stepMultiplier;
181
+ delta *= stepMultiplier !== null && stepMultiplier !== void 0 ? stepMultiplier : Slider.defaultProps.stepMultiplier;
159
182
  }
160
183
 
161
- Math.floor(_this.state.value / _this.props.step) * _this.props.step;
184
+ Math.floor(_this.state.value / ((_this$props$step3 = _this.props.step) !== null && _this$props$step3 !== void 0 ? _this$props$step3 : Slider.defaultProps.step)) * ((_this$props$step4 = _this.props.step) !== null && _this$props$step4 !== void 0 ? _this$props$step4 : Slider.defaultProps.step);
162
185
 
163
186
  var _this$calcValue2 = _this.calcValue({
164
187
  // Ensures custom value from `<input>` won't cause skipping next stepping point with right arrow key,
165
188
  // e.g. Typing 51 in `<input>`, moving focus onto the thumb and the hitting right arrow key should yield 52 instead of 54
166
- value: (delta > 0 ? Math.floor(_this.state.value / _this.props.step) * _this.props.step : _this.state.value) + delta
189
+ value: (delta > 0 ? Math.floor(_this.state.value / ((_this$props$step5 = _this.props.step) !== null && _this$props$step5 !== void 0 ? _this$props$step5 : Slider.defaultProps.step)) * ((_this$props$step6 = _this.props.step) !== null && _this$props$step6 !== void 0 ? _this$props$step6 : Slider.defaultProps.step) : _this.state.value) + delta
167
190
  }),
168
191
  value = _this$calcValue2.value,
169
192
  left = _this$calcValue2.left;
@@ -197,11 +220,11 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
197
220
  value: targetValue,
198
221
  useRawValue: true
199
222
  }),
200
- value = _this$calcValue3.value,
223
+ _value = _this$calcValue3.value,
201
224
  left = _this$calcValue3.left;
202
225
 
203
226
  _this.setState({
204
- value: value,
227
+ value: _value,
205
228
  left: left
206
229
  });
207
230
  }
@@ -229,18 +252,16 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
229
252
  });
230
253
 
231
254
  _defineProperty(_assertThisInitialized(_this), "calcValue", function (_ref) {
232
- var _ref$clientX = _ref.clientX,
233
- clientX = _ref$clientX === void 0 ? null : _ref$clientX,
234
- _ref$value = _ref.value,
235
- value = _ref$value === void 0 ? null : _ref$value,
255
+ var _this$element5, _this$element5$getBou, _this$props$step7, _this$props$step8;
256
+
257
+ var clientX = _ref.clientX,
258
+ value = _ref.value,
236
259
  _ref$useRawValue = _ref.useRawValue,
237
260
  useRawValue = _ref$useRawValue === void 0 ? false : _ref$useRawValue;
238
261
  var range = _this.props.max - _this.props.min;
239
-
240
- var boundingRect = _this.element.getBoundingClientRect();
241
-
242
- var totalSteps = range / _this.props.step;
243
- var width = boundingRect.right - boundingRect.left; // Enforce a minimum width of at least 1 for calculations
262
+ var boundingRect = (_this$element5 = _this.element) === null || _this$element5 === void 0 ? void 0 : (_this$element5$getBou = _this$element5.getBoundingClientRect) === null || _this$element5$getBou === void 0 ? void 0 : _this$element5$getBou.call(_this$element5);
263
+ var totalSteps = range / ((_this$props$step7 = _this.props.step) !== null && _this$props$step7 !== void 0 ? _this$props$step7 : Slider.defaultProps.step);
264
+ var width = boundingRect ? boundingRect.right - boundingRect.left : 0; // Enforce a minimum width of at least 1 for calculations
244
265
 
245
266
  if (width <= 0) {
246
267
  width = 1;
@@ -251,7 +272,9 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
251
272
  var leftPercent;
252
273
 
253
274
  if (clientX != null) {
254
- var leftOffset = clientX - boundingRect.left;
275
+ var _boundingRect$left;
276
+
277
+ var leftOffset = clientX - ((_boundingRect$left = boundingRect === null || boundingRect === void 0 ? void 0 : boundingRect.left) !== null && _boundingRect$left !== void 0 ? _boundingRect$left : 0);
255
278
  leftPercent = leftOffset / width;
256
279
  } else {
257
280
  if (value == null) {
@@ -270,7 +293,7 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
270
293
  };
271
294
  }
272
295
 
273
- var steppedValue = Math.round(leftPercent * totalSteps) * _this.props.step;
296
+ var steppedValue = Math.round(leftPercent * totalSteps) * ((_this$props$step8 = _this.props.step) !== null && _this$props$step8 !== void 0 ? _this$props$step8 : Slider.defaultProps.step);
274
297
 
275
298
  var steppedPercent = _this.clamp(steppedValue / range, 0, 1);
276
299
 
@@ -297,11 +320,11 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
297
320
  var _this$calcValue4 = this.calcValue({
298
321
  useRawValue: true
299
322
  }),
300
- value = _this$calcValue4.value,
323
+ _value2 = _this$calcValue4.value,
301
324
  left = _this$calcValue4.left;
302
325
 
303
326
  this.setState({
304
- value: value,
327
+ value: _value2,
305
328
  left: left
306
329
  });
307
330
  }
@@ -320,10 +343,15 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
320
343
  value: function componentDidUpdate(prevProps, prevState) {
321
344
  // Fire onChange event handler if present, if there's a usable value, and
322
345
  // if the value is different from the last one
323
- this.thumbRef.current.style.left = "".concat(this.state.left, "%");
324
- this.filledTrackRef.current.style.transform = "translate(0%, -50%) scaleX(".concat(this.state.left / 100, ")");
346
+ if (this.thumbRef.current) {
347
+ this.thumbRef.current.style.left = "".concat(this.state.left, "%");
348
+ }
349
+
350
+ if (this.filledTrackRef.current) {
351
+ this.filledTrackRef.current.style.transform = "translate(0%, -50%) scaleX(".concat(this.state.left / 100, ")");
352
+ }
325
353
 
326
- if (this.state.value !== '' && prevState.value !== this.state.value && typeof this.props.onChange === 'function') {
354
+ if (prevState.value !== this.state.value && typeof this.props.onChange === 'function') {
327
355
  this.props.onChange({
328
356
  value: this.state.value
329
357
  });
@@ -468,8 +496,8 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
468
496
  name: name,
469
497
  className: inputClasses,
470
498
  value: value,
471
- "aria-labelledby": !ariaLabelInput ? labelId : null,
472
- "aria-label": ariaLabelInput ? ariaLabelInput : null,
499
+ "aria-labelledby": !ariaLabelInput ? labelId : undefined,
500
+ "aria-label": ariaLabelInput ? ariaLabelInput : undefined,
473
501
  disabled: disabled,
474
502
  required: required,
475
503
  min: min,
@@ -477,9 +505,9 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
477
505
  step: step,
478
506
  onChange: _this2.onChange,
479
507
  onBlur: _this2.onBlur,
480
- onKeyUp: _this2.onInputKeyUp,
508
+ onKeyUp: _this2.props.onInputKeyUp,
481
509
  "data-invalid": isValid ? null : true,
482
- "aria-invalid": isValid ? null : true,
510
+ "aria-invalid": isValid ? undefined : true,
483
511
  readOnly: readOnly
484
512
  })));
485
513
  });
@@ -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,
@@ -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,6 +21,7 @@ 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
 
@@ -377,7 +379,7 @@ TabList.propTypes = {
377
379
  /**
378
380
  * Specify whether or not to use the light component variant
379
381
  */
380
- light: PropTypes.bool,
382
+ 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
383
 
382
384
  /**
383
385
  * Provide the props that describe the right overflow button
@@ -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,106 @@
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, { ReactNode } from 'react';
8
+ type ExcludedAttributes = 'defaultValue' | 'id' | 'size' | 'value';
9
+ export interface TextInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
10
+ /**
11
+ * Specify an optional className to be applied to the `<input>` node
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Optionally provide the default value of the `<input>`
16
+ */
17
+ defaultValue?: string | number;
18
+ /**
19
+ * Specify whether the `<input>` should be disabled
20
+ */
21
+ disabled?: boolean;
22
+ /**
23
+ * Specify whether to display the character counter
24
+ */
25
+ enableCounter?: boolean;
26
+ /**
27
+ * Provide text that is used alongside the control label for additional help
28
+ */
29
+ helperText?: ReactNode;
30
+ /**
31
+ * Specify whether you want the underlying label to be visually hidden
32
+ */
33
+ hideLabel?: boolean;
34
+ /**
35
+ * Specify a custom `id` for the `<input>`
36
+ */
37
+ id: string;
38
+ /**
39
+ * `true` to use the inline version.
40
+ */
41
+ inline?: boolean;
42
+ /**
43
+ * Specify whether the control is currently invalid
44
+ */
45
+ invalid?: boolean;
46
+ /**
47
+ * Provide the text that is displayed when the control is in an invalid state
48
+ */
49
+ invalidText?: ReactNode;
50
+ /**
51
+ * Provide the text that will be read by a screen reader when visiting this
52
+ * control
53
+ */
54
+ labelText: ReactNode;
55
+ /**
56
+ * `true` to use the light version. For use on $ui-01 backgrounds only.
57
+ * Don't use this to make tile background color same as container background color.
58
+ * 'The `light` prop for `TextInput` has ' +
59
+ 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'
60
+ */
61
+ light?: boolean;
62
+ /**
63
+ * Max character count allowed for the input. This is needed in order for enableCounter to display
64
+ */
65
+ maxCount?: number;
66
+ /**
67
+ * Optionally provide an `onChange` handler that is called whenever `<input>`
68
+ * is updated
69
+ */
70
+ onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
71
+ /**
72
+ * Optionally provide an `onClick` handler that is called whenever the
73
+ * `<input>` is clicked
74
+ */
75
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
76
+ /**
77
+ * Specify the placeholder attribute for the `<input>`
78
+ */
79
+ placeholder?: string;
80
+ /**
81
+ * Whether the input should be read-only
82
+ */
83
+ readOnly?: boolean;
84
+ /**
85
+ * Specify the size of the Text Input. Currently supports the following:
86
+ */
87
+ size?: 'sm' | 'md' | 'lg' | 'xl';
88
+ /**
89
+ * Specify the type of the `<input>`
90
+ */
91
+ type?: string;
92
+ /**
93
+ * Specify the value of the `<input>`
94
+ */
95
+ value?: string | number | undefined;
96
+ /**
97
+ * Specify whether the control is currently in warning state
98
+ */
99
+ warn?: boolean;
100
+ /**
101
+ * Provide the text that is displayed when the control is in warning state
102
+ */
103
+ warnText?: ReactNode;
104
+ }
105
+ declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<unknown>>;
106
+ export default TextInput;
@@ -61,7 +61,7 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
61
61
  var defaultValue = rest.defaultValue,
62
62
  value = rest.value;
63
63
 
64
- var _useState = useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length) || (value === null || value === void 0 ? void 0 : value.length) || 0),
64
+ var _useState = useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString().length) || (value === null || value === void 0 ? void 0 : value.toString().length) || 0),
65
65
  _useState2 = _slicedToArray(_useState, 2),
66
66
  textCount = _useState2[0],
67
67
  setTextCount = _useState2[1];
@@ -139,6 +139,7 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
139
139
  isFluid = _useContext.isFluid;
140
140
 
141
141
  var ariaAnnouncement = useAnnouncer(textCount, maxCount);
142
+ var Icon = normalizedProps.icon;
142
143
  return /*#__PURE__*/React__default.createElement("div", {
143
144
  className: inputWrapperClasses
144
145
  }, !inline ? labelWrapper : /*#__PURE__*/React__default.createElement("div", {
@@ -148,7 +149,7 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
148
149
  }, /*#__PURE__*/React__default.createElement("div", {
149
150
  className: fieldWrapperClasses,
150
151
  "data-invalid": normalizedProps.invalid || null
151
- }, normalizedProps.icon && /*#__PURE__*/React__default.createElement(normalizedProps.icon, {
152
+ }, Icon && /*#__PURE__*/React__default.createElement(Icon, {
152
153
  className: iconClasses
153
154
  }), input, /*#__PURE__*/React__default.createElement("span", {
154
155
  className: "".concat(prefix, "--text-input__counter-alert"),