@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
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { typeof as _typeof, objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { defineProperty as _defineProperty, typeof as _typeof, objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, slicedToArray as _slicedToArray, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useContext, useState, useRef } from 'react';
10
10
  import { useSelect } from 'downshift';
11
11
  import cx from 'classnames';
@@ -20,7 +20,9 @@ import '../FluidForm/FluidForm.js';
20
20
  import { FormContext } from '../FluidForm/FormContext.js';
21
21
  import { ListBoxSize, ListBoxType } from '../ListBox/ListBoxPropTypes.js';
22
22
 
23
- var _excluded = ["className", "disabled", "direction", "items", "label", "ariaLabel", "itemToString", "itemToElement", "renderSelectedItem", "type", "size", "onChange", "id", "titleText", "hideLabel", "helperText", "translateWithId", "light", "invalid", "invalidText", "warn", "warnText", "initialSelectedItem", "selectedItem", "downshiftProps", "readOnly"];
23
+ var _Dropdown$propTypes;
24
+
25
+ var _excluded = ["className", "disabled", "direction", "items", "label", "aria-label", "ariaLabel", "itemToString", "itemToElement", "renderSelectedItem", "type", "size", "onChange", "id", "titleText", "hideLabel", "helperText", "translateWithId", "light", "invalid", "invalidText", "warn", "warnText", "initialSelectedItem", "selectedItem", "downshiftProps", "readOnly"];
24
26
 
25
27
  var defaultItemToString = function defaultItemToString(item) {
26
28
  if (typeof item === 'string') {
@@ -46,7 +48,8 @@ var Dropdown = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
46
48
  direction = _ref.direction,
47
49
  items = _ref.items,
48
50
  label = _ref.label,
49
- ariaLabel = _ref.ariaLabel,
51
+ ariaLabel = _ref['aria-label'],
52
+ deprecatedAriaLabel = _ref.ariaLabel,
50
53
  _ref$itemToString = _ref.itemToString,
51
54
  itemToString = _ref$itemToString === void 0 ? defaultItemToString : _ref$itemToString,
52
55
  itemToElement = _ref.itemToElement,
@@ -161,7 +164,7 @@ var Dropdown = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
161
164
  }, getLabelProps()), titleText), /*#__PURE__*/React__default.createElement(ListBox, {
162
165
  onFocus: handleFocus,
163
166
  onBlur: handleFocus,
164
- "aria-label": ariaLabel,
167
+ "aria-label": deprecatedAriaLabel || ariaLabel,
165
168
  size: size,
166
169
  className: className,
167
170
  invalid: invalid,
@@ -214,147 +217,7 @@ var Dropdown = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
214
217
  }))), !inline && !invalid && !warn && helper);
215
218
  });
216
219
  Dropdown.displayName = 'Dropdown';
217
- Dropdown.propTypes = {
218
- /**
219
- * 'aria-label' of the ListBox component.
220
- */
221
- ariaLabel: PropTypes.string,
222
-
223
- /**
224
- * Provide a custom className to be applied on the bx--dropdown node
225
- */
226
- className: PropTypes.string,
227
-
228
- /**
229
- * Specify the direction of the dropdown. Can be either top or bottom.
230
- */
231
- direction: PropTypes.oneOf(['top', 'bottom']),
232
-
233
- /**
234
- * Disable the control
235
- */
236
- disabled: PropTypes.bool,
237
-
238
- /**
239
- * Additional props passed to Downshift
240
- */
241
- downshiftProps: PropTypes.object,
242
-
243
- /**
244
- * Provide helper text that is used alongside the control label for
245
- * additional help
246
- */
247
- helperText: PropTypes.node,
248
-
249
- /**
250
- * Specify whether the title text should be hidden or not
251
- */
252
- hideLabel: PropTypes.bool,
253
-
254
- /**
255
- * Specify a custom `id`
256
- */
257
- id: PropTypes.string.isRequired,
258
-
259
- /**
260
- * Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
261
- * from their collection that are pre-selected
262
- */
263
- initialSelectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
264
-
265
- /**
266
- * Specify if the currently selected value is invalid.
267
- */
268
- invalid: PropTypes.bool,
269
-
270
- /**
271
- * Message which is displayed if the value is invalid.
272
- */
273
- invalidText: PropTypes.node,
274
-
275
- /**
276
- * Function to render items as custom components instead of strings.
277
- * Defaults to null and is overridden by a getter
278
- */
279
- itemToElement: PropTypes.func,
280
-
281
- /**
282
- * Helper function passed to downshift that allows the library to render a
283
- * given item to a string label. By default, it extracts the `label` field
284
- * from a given item to serve as the item label in the list.
285
- */
286
- itemToString: PropTypes.func,
287
-
288
- /**
289
- * We try to stay as generic as possible here to allow individuals to pass
290
- * in a collection of whatever kind of data structure they prefer
291
- */
292
- items: PropTypes.array.isRequired,
293
-
294
- /**
295
- * Generic `label` that will be used as the textual representation of what
296
- * this field is for
297
- */
298
- label: PropTypes.node.isRequired,
299
-
300
- /**
301
- * `true` to use the light version.
302
- */
303
- light: deprecate(PropTypes.bool, 'The `light` prop for `Dropdown` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
304
-
305
- /**
306
- * `onChange` is a utility for this controlled component to communicate to a
307
- * consuming component what kind of internal state changes are occurring.
308
- */
309
- onChange: PropTypes.func,
310
-
311
- /**
312
- * Whether or not the Dropdown is readonly
313
- */
314
- readOnly: PropTypes.bool,
315
-
316
- /**
317
- * An optional callback to render the currently selected item as a react element instead of only
318
- * as a string.
319
- */
320
- renderSelectedItem: PropTypes.func,
321
-
322
- /**
323
- * In the case you want to control the dropdown selection entirely.
324
- */
325
- selectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
326
-
327
- /**
328
- * Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
329
- */
330
- size: ListBoxSize,
331
-
332
- /**
333
- * Provide the title text that will be read by a screen reader when
334
- * visiting this control
335
- */
336
- titleText: PropTypes.node.isRequired,
337
-
338
- /**
339
- * Callback function for translating ListBoxMenuIcon SVG title
340
- */
341
- translateWithId: PropTypes.func,
342
-
343
- /**
344
- * The dropdown type, `default` or `inline`
345
- */
346
- type: ListBoxType,
347
-
348
- /**
349
- * Specify whether the control is currently in warning state
350
- */
351
- warn: PropTypes.bool,
352
-
353
- /**
354
- * Provide the text that is displayed when the control is in warning state
355
- */
356
- warnText: PropTypes.node
357
- };
220
+ Dropdown.propTypes = (_Dropdown$propTypes = {}, _defineProperty(_Dropdown$propTypes, 'aria-label', PropTypes.string), _defineProperty(_Dropdown$propTypes, "ariaLabel", deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.')), _defineProperty(_Dropdown$propTypes, "className", PropTypes.string), _defineProperty(_Dropdown$propTypes, "direction", PropTypes.oneOf(['top', 'bottom'])), _defineProperty(_Dropdown$propTypes, "disabled", PropTypes.bool), _defineProperty(_Dropdown$propTypes, "downshiftProps", PropTypes.object), _defineProperty(_Dropdown$propTypes, "helperText", PropTypes.node), _defineProperty(_Dropdown$propTypes, "hideLabel", PropTypes.bool), _defineProperty(_Dropdown$propTypes, "id", PropTypes.string.isRequired), _defineProperty(_Dropdown$propTypes, "initialSelectedItem", PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number])), _defineProperty(_Dropdown$propTypes, "invalid", PropTypes.bool), _defineProperty(_Dropdown$propTypes, "invalidText", PropTypes.node), _defineProperty(_Dropdown$propTypes, "itemToElement", PropTypes.func), _defineProperty(_Dropdown$propTypes, "itemToString", PropTypes.func), _defineProperty(_Dropdown$propTypes, "items", PropTypes.array.isRequired), _defineProperty(_Dropdown$propTypes, "label", PropTypes.node.isRequired), _defineProperty(_Dropdown$propTypes, "light", deprecate(PropTypes.bool, 'The `light` prop for `Dropdown` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.')), _defineProperty(_Dropdown$propTypes, "onChange", PropTypes.func), _defineProperty(_Dropdown$propTypes, "readOnly", PropTypes.bool), _defineProperty(_Dropdown$propTypes, "renderSelectedItem", PropTypes.func), _defineProperty(_Dropdown$propTypes, "selectedItem", PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number])), _defineProperty(_Dropdown$propTypes, "size", ListBoxSize), _defineProperty(_Dropdown$propTypes, "titleText", PropTypes.node.isRequired), _defineProperty(_Dropdown$propTypes, "translateWithId", PropTypes.func), _defineProperty(_Dropdown$propTypes, "type", ListBoxType), _defineProperty(_Dropdown$propTypes, "warn", PropTypes.bool), _defineProperty(_Dropdown$propTypes, "warnText", PropTypes.node), _Dropdown$propTypes);
358
221
  Dropdown.defaultProps = {
359
222
  disabled: false,
360
223
  type: 'default',
@@ -9,6 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _
9
9
  import React__default, { useState, useRef } from 'react';
10
10
  import cx from 'classnames';
11
11
  import Search from '../Search/Search.js';
12
+ import '../Search/Search.Skeleton.js';
12
13
  import { usePrefix } from '../../internal/usePrefix.js';
13
14
  import { composeEventHandlers } from '../../tools/events.js';
14
15
 
@@ -158,8 +158,8 @@ var FileUploader = /*#__PURE__*/function (_React$Component) {
158
158
  }, name), /*#__PURE__*/React__default.createElement("span", {
159
159
  className: "".concat(prefix, "--file__state-container")
160
160
  }, /*#__PURE__*/React__default.createElement(Filename, {
161
+ name: name,
161
162
  iconDescription: iconDescription,
162
- "aria-describedby": name,
163
163
  status: filenameStatus,
164
164
  onKeyDown: function onKeyDown(evt) {
165
165
  if (matches(evt, [Enter, Space])) {
@@ -70,11 +70,13 @@ function FileUploaderButton(_ref) {
70
70
 
71
71
  function onClick(event) {
72
72
  event.target.value = null;
73
+ inputNode.current.value = '';
73
74
  inputNode.current.click();
74
75
  }
75
76
 
76
77
  function onKeyDown(event) {
77
78
  if (matches(event, [Enter, Space])) {
79
+ inputNode.current.value = '';
78
80
  inputNode.current.click();
79
81
  }
80
82
  }
@@ -11,13 +11,15 @@ import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
12
  import uniqueId from '../../tools/uniqueId.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
+ import { composeEventHandlers } from '../../tools/events.js';
15
+ import deprecate from '../../prop-types/deprecate.js';
14
16
  import { matches } from '../../internal/keyboard/match.js';
15
17
  import { Enter, Space } from '../../internal/keyboard/keys.js';
16
18
 
17
- var _excluded = ["accept", "className", "id", "disabled", "labelText", "multiple", "name", "onAddFiles", "pattern", "role", "tabIndex", "innerRef"];
19
+ var _excluded = ["accept", "className", "id", "disabled", "labelText", "multiple", "name", "onAddFiles", "onClick", "pattern", "innerRef"];
18
20
 
19
21
  function FileUploaderDropContainer(_ref) {
20
- var _classNames2;
22
+ var _classNames;
21
23
 
22
24
  var accept = _ref.accept,
23
25
  className = _ref.className,
@@ -27,9 +29,8 @@ function FileUploaderDropContainer(_ref) {
27
29
  multiple = _ref.multiple,
28
30
  name = _ref.name,
29
31
  onAddFiles = _ref.onAddFiles,
32
+ onClick = _ref.onClick,
30
33
  pattern = _ref.pattern,
31
- role = _ref.role,
32
- tabIndex = _ref.tabIndex,
33
34
  innerRef = _ref.innerRef,
34
35
  rest = _objectWithoutProperties(_ref, _excluded);
35
36
 
@@ -44,8 +45,7 @@ function FileUploaderDropContainer(_ref) {
44
45
  isActive = _useState2[0],
45
46
  setActive = _useState2[1];
46
47
 
47
- var labelClasses = cx("".concat(prefix, "--file-browse-btn"), _defineProperty({}, "".concat(prefix, "--file-browse-btn--disabled"), disabled));
48
- var dropareaClasses = cx("".concat(prefix, "--file__drop-container"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefix, "--file__drop-container--drag-over"), isActive), _defineProperty(_classNames2, className, className), _classNames2));
48
+ var dropareaClasses = cx("".concat(prefix, "--file__drop-container"), "".concat(prefix, "--file-browse-btn"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--file__drop-container--drag-over"), isActive), _defineProperty(_classNames, "".concat(prefix, "--file-browse-btn--disabled"), disabled), _defineProperty(_classNames, className, className), _classNames));
49
49
  /**
50
50
  * Filters the array of added files based on file type restrictions
51
51
  * @param {Event} event - Event object, used to get the list of files added
@@ -90,6 +90,12 @@ function FileUploaderDropContainer(_ref) {
90
90
  });
91
91
  }
92
92
 
93
+ var handleClick = function handleClick() {
94
+ if (!disabled) {
95
+ inputRef.current.click();
96
+ }
97
+ };
98
+
93
99
  return /*#__PURE__*/React__default.createElement("div", {
94
100
  className: "".concat(prefix, "--file"),
95
101
  onDragOver: function onDragOver(evt) {
@@ -125,20 +131,21 @@ function FileUploaderDropContainer(_ref) {
125
131
  setActive(false);
126
132
  handleChange(evt);
127
133
  }
128
- }, /*#__PURE__*/React__default.createElement("label", _extends({
134
+ }, /*#__PURE__*/React__default.createElement("button", _extends({
135
+ type: "button",
136
+ className: dropareaClasses,
129
137
  ref: innerRef,
130
- className: labelClasses,
131
- htmlFor: uid,
132
- tabIndex: tabIndex || 0,
133
138
  onKeyDown: function onKeyDown(evt) {
134
139
  if (matches(evt, [Enter, Space])) {
140
+ evt.preventDefault();
135
141
  inputRef.current.click();
136
142
  }
137
- }
138
- }, rest), /*#__PURE__*/React__default.createElement("div", {
139
- className: dropareaClasses,
140
- role: role || 'button'
141
- }, labelText)), /*#__PURE__*/React__default.createElement("input", {
143
+ },
144
+ onClick: composeEventHandlers([onClick, handleClick])
145
+ }, rest), labelText), /*#__PURE__*/React__default.createElement("label", {
146
+ htmlFor: uid,
147
+ className: "".concat(prefix, "--visually-hidden")
148
+ }, labelText), /*#__PURE__*/React__default.createElement("input", {
142
149
  type: "file",
143
150
  id: uid,
144
151
  className: "".concat(prefix, "--file-input"),
@@ -198,6 +205,12 @@ FileUploaderDropContainer.propTypes = {
198
205
  */
199
206
  onAddFiles: PropTypes.func,
200
207
 
208
+ /**
209
+ * Provide an optional function to be called when the button element
210
+ * is clicked
211
+ */
212
+ onClick: PropTypes.func,
213
+
201
214
  /**
202
215
  * Provide a custom regex pattern for the acceptedTypes
203
216
  */
@@ -206,15 +219,14 @@ FileUploaderDropContainer.propTypes = {
206
219
  /**
207
220
  * Provide an accessibility role for the `<FileUploaderButton>`
208
221
  */
209
- role: PropTypes.string,
222
+ role: deprecate(PropTypes.number, 'The `role` prop for `FileUploaderButton` has ' + 'been deprecated since it now renders a button element by default, and has an implicit role of button.'),
210
223
 
211
224
  /**
212
225
  * Provide a custom tabIndex value for the `<FileUploaderButton>`
213
226
  */
214
- tabIndex: PropTypes.number
227
+ tabIndex: deprecate(PropTypes.number, 'The `tabIndex` prop for `FileUploaderButton` has ' + 'been deprecated since it now renders a button element by default.')
215
228
  };
216
229
  FileUploaderDropContainer.defaultProps = {
217
- tabIndex: 0,
218
230
  labelText: 'Add file',
219
231
  multiple: false,
220
232
  onAddFiles: function onAddFiles() {},
@@ -47,13 +47,14 @@ function FileUploaderItem(_ref) {
47
47
  }, name), /*#__PURE__*/React__default.createElement("span", {
48
48
  className: "".concat(prefix, "--file__state-container")
49
49
  }, /*#__PURE__*/React__default.createElement(Filename, {
50
+ name: name,
50
51
  iconDescription: iconDescription,
51
- "aria-describedby": name,
52
52
  status: status,
53
53
  invalid: invalid,
54
54
  onKeyDown: function onKeyDown(evt) {
55
55
  if (matches(evt, [Enter, Space])) {
56
56
  if (status === 'edit') {
57
+ evt.preventDefault();
57
58
  onDelete(evt, {
58
59
  uuid: id
59
60
  });
@@ -14,12 +14,13 @@ import { usePrefix } from '../../internal/usePrefix.js';
14
14
 
15
15
  var _Close;
16
16
 
17
- var _excluded = ["iconDescription", "status", "invalid"];
17
+ var _excluded = ["iconDescription", "status", "invalid", "name"];
18
18
 
19
19
  function Filename(_ref) {
20
20
  var iconDescription = _ref.iconDescription,
21
21
  status = _ref.status,
22
22
  invalid = _ref.invalid,
23
+ name = _ref.name,
23
24
  rest = _objectWithoutProperties(_ref, _excluded);
24
25
 
25
26
  var prefix = usePrefix();
@@ -36,7 +37,7 @@ function Filename(_ref) {
36
37
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, invalid && /*#__PURE__*/React__default.createElement(WarningFilled, {
37
38
  className: "".concat(prefix, "--file-invalid")
38
39
  }), /*#__PURE__*/React__default.createElement("button", _extends({
39
- "aria-label": iconDescription,
40
+ "aria-label": "".concat(iconDescription, " - ").concat(name),
40
41
  className: "".concat(prefix, "--file-close"),
41
42
  type: "button"
42
43
  }, rest), _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null))));
@@ -65,6 +66,11 @@ Filename.propTypes = {
65
66
  */
66
67
  invalid: PropTypes.bool,
67
68
 
69
+ /**
70
+ * Name of the uploaded file
71
+ */
72
+ name: PropTypes.string,
73
+
68
74
  /**
69
75
  * Status of the file upload
70
76
  */
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
10
10
  import React__default from 'react';
11
11
  import cx from 'classnames';
12
12
  import TextArea from '../TextArea/TextArea.js';
13
+ import '../TextArea/TextArea.Skeleton.js';
13
14
  import deprecate from '../../prop-types/deprecate.js';
14
15
  import { usePrefix } from '../../internal/usePrefix.js';
15
16
  import { FormContext } from '../FluidForm/FormContext.js';
@@ -125,7 +126,17 @@ FluidTextArea.propTypes = {
125
126
  /**
126
127
  * Provide the current value of the `<textarea>`
127
128
  */
128
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
129
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
130
+
131
+ /**
132
+ * Specify whether the control is currently in warning state
133
+ */
134
+ warn: PropTypes.bool,
135
+
136
+ /**
137
+ * Provide the text that is displayed when the control is in warning state
138
+ */
139
+ warnText: PropTypes.node
129
140
  };
130
141
 
131
142
  export { FluidTextArea as default };
@@ -9,6 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, extends as _extend
9
9
  import PropTypes from 'prop-types';
10
10
  import React__default from 'react';
11
11
  import Button from '../Button/Button.js';
12
+ import '../Tooltip/DefinitionTooltip.js';
12
13
  import { Tooltip } from '../Tooltip/Tooltip.js';
13
14
  import { usePrefix } from '../../internal/usePrefix.js';
14
15
  import cx from 'classnames';
@@ -5,15 +5,19 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ import { defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
9
  import PropTypes from 'prop-types';
9
10
  import React__default, { useRef, useEffect } from 'react';
11
+ import deprecate from '../../prop-types/deprecate.js';
10
12
  import { usePrefix } from '../../internal/usePrefix.js';
11
13
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
12
14
 
15
+ var _InlineCheckbox$propT;
13
16
  /** @type any */
14
17
 
15
18
  var InlineCheckbox = /*#__PURE__*/React__default.forwardRef(function InlineCheckbox(props, forwardRef) {
16
- var ariaLabel = props.ariaLabel,
19
+ var ariaLabel = props['aria-label'],
20
+ deprecatedAriaLabel = props.ariaLabel,
17
21
  _props$checked = props.checked,
18
22
  checked = _props$checked === void 0 ? false : _props$checked,
19
23
  disabled = props.disabled,
@@ -60,64 +64,14 @@ var InlineCheckbox = /*#__PURE__*/React__default.forwardRef(function InlineCheck
60
64
  React__default.createElement("label", {
61
65
  htmlFor: id,
62
66
  className: "".concat(prefix, "--checkbox-label"),
63
- "aria-label": ariaLabel,
67
+ "aria-label": deprecatedAriaLabel || ariaLabel,
64
68
  title: title,
65
69
  onClick: function onClick(evt) {
66
70
  evt.stopPropagation();
67
71
  }
68
72
  }));
69
73
  });
70
- InlineCheckbox.propTypes = {
71
- /**
72
- * Specify the label for the control
73
- */
74
- ariaLabel: PropTypes.string.isRequired,
75
-
76
- /**
77
- * Specify whether the underlying control is checked, or not
78
- */
79
- checked: PropTypes.bool,
80
-
81
- /**
82
- * Specify whether the underlying input control should be disabled
83
- */
84
- disabled: PropTypes.bool,
85
-
86
- /**
87
- * Provide an `id` for the underlying input control
88
- */
89
- id: PropTypes.string.isRequired,
90
-
91
- /**
92
- * Specify whether the control is in an indterminate state
93
- */
94
- indeterminate: PropTypes.bool,
95
-
96
- /**
97
- * Provide a `name` for the underlying input control
98
- */
99
- name: PropTypes.string.isRequired,
100
-
101
- /**
102
- * Provide an optional hook that is called each time the input is updated
103
- */
104
- onChange: PropTypes.func,
105
-
106
- /**
107
- * Provide a handler that is invoked when a user clicks on the control
108
- */
109
- onClick: PropTypes.func,
110
-
111
- /**
112
- * Provide a handler that is invoked on the key down event for the control
113
- */
114
- onKeyDown: PropTypes.func,
115
-
116
- /**
117
- * Provide an optional tooltip for the InlineCheckbox
118
- */
119
- title: PropTypes.string
120
- };
74
+ InlineCheckbox.propTypes = (_InlineCheckbox$propT = {}, _defineProperty(_InlineCheckbox$propT, 'aria-label', PropTypes.string.isRequired), _defineProperty(_InlineCheckbox$propT, "ariaLabel", deprecate(PropTypes.string.isRequired, 'The `ariaLabel` prop has been deprecated in favor of `aria-label`. This prop will be removed in the next major release.')), _defineProperty(_InlineCheckbox$propT, "checked", PropTypes.bool), _defineProperty(_InlineCheckbox$propT, "disabled", PropTypes.bool), _defineProperty(_InlineCheckbox$propT, "id", PropTypes.string.isRequired), _defineProperty(_InlineCheckbox$propT, "indeterminate", PropTypes.bool), _defineProperty(_InlineCheckbox$propT, "name", PropTypes.string.isRequired), _defineProperty(_InlineCheckbox$propT, "onChange", PropTypes.func), _defineProperty(_InlineCheckbox$propT, "onClick", PropTypes.func), _defineProperty(_InlineCheckbox$propT, "onKeyDown", PropTypes.func), _defineProperty(_InlineCheckbox$propT, "title", PropTypes.string), _InlineCheckbox$propT);
121
75
  var InlineCheckbox$1 = InlineCheckbox;
122
76
 
123
77
  export { InlineCheckbox$1 as default };
@@ -11,8 +11,6 @@ import React__default from 'react';
11
11
  import PropTypes from 'prop-types';
12
12
  import { Close } from '@carbon/icons-react';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
- import { match } from '../../internal/keyboard/match.js';
15
- import { Enter } from '../../internal/keyboard/keys.js';
16
14
 
17
15
  var _Close, _Close2, _defaultTranslations;
18
16
 
@@ -47,25 +45,10 @@ var ListBoxSelection = function ListBoxSelection(_ref) {
47
45
  }
48
46
  };
49
47
 
50
- var handleOnKeyDown = function handleOnKeyDown(event) {
51
- event.stopPropagation();
52
-
53
- if (disabled || readOnly) {
54
- return;
55
- } // When a user hits ENTER, we'll clear the selection
56
-
57
-
58
- if (match(event.code, Enter)) {
59
- clearSelection(event);
60
-
61
- if (onClearSelection) {
62
- onClearSelection(event);
63
- }
64
- }
65
- };
66
-
67
48
  var description = selectionCount ? t('clear.all') : t('clear.selection');
68
49
  var tagClasses = cx("".concat(prefix, "--tag"), "".concat(prefix, "--tag--filter"), "".concat(prefix, "--tag--high-contrast"), _defineProperty({}, "".concat(prefix, "--tag--disabled"), disabled));
50
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
51
+
69
52
  return selectionCount ? /*#__PURE__*/React__default.createElement("div", {
70
53
  className: tagClasses
71
54
  }, /*#__PURE__*/React__default.createElement("span", {
@@ -73,19 +56,17 @@ var ListBoxSelection = function ListBoxSelection(_ref) {
73
56
  title: "".concat(selectionCount)
74
57
  }, selectionCount), /*#__PURE__*/React__default.createElement("div", {
75
58
  role: "button",
76
- tabIndex: disabled ? -1 : 0,
59
+ tabIndex: -1,
77
60
  className: "".concat(prefix, "--tag__close-icon"),
78
61
  onClick: handleOnClick,
79
- onKeyDown: handleOnKeyDown,
80
62
  "aria-label": t('clear.all'),
81
63
  title: description,
82
64
  "aria-disabled": readOnly ? true : undefined
83
65
  }, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null)))) : /*#__PURE__*/React__default.createElement("div", {
84
66
  role: "button",
85
67
  className: className,
86
- tabIndex: disabled ? -1 : 0,
68
+ tabIndex: -1,
87
69
  onClick: handleOnClick,
88
- onKeyDown: handleOnKeyDown,
89
70
  "aria-label": description,
90
71
  title: description
91
72
  }, selectionCount, _Close2 || (_Close2 = /*#__PURE__*/React__default.createElement(Close, null)));
@@ -11,8 +11,6 @@ import React__default from 'react';
11
11
  import PropTypes from 'prop-types';
12
12
  import { Close } from '@carbon/icons-react';
13
13
  import { usePrefix } from '../../../internal/usePrefix.js';
14
- import { match } from '../../../internal/keyboard/match.js';
15
- import { Enter } from '../../../internal/keyboard/keys.js';
16
14
 
17
15
  var _Close, _Close2, _defaultTranslations;
18
16
 
@@ -52,23 +50,6 @@ function ListBoxSelection(_ref) {
52
50
  }
53
51
  }
54
52
 
55
- function onKeyDown(event) {
56
- event.stopPropagation();
57
-
58
- if (disabled) {
59
- return;
60
- } // When a user hits ENTER, we'll clear the selection
61
-
62
-
63
- if (match(event, Enter)) {
64
- clearSelection(event);
65
-
66
- if (onClearSelection) {
67
- onClearSelection(event);
68
- }
69
- }
70
- }
71
-
72
53
  if (selectionCount) {
73
54
  return /*#__PURE__*/React__default.createElement("div", {
74
55
  className: tagClasses
@@ -80,8 +61,7 @@ function ListBoxSelection(_ref) {
80
61
  className: "".concat(prefix, "--tag__close-icon"),
81
62
  disabled: disabled,
82
63
  onClick: onClick,
83
- onKeyDown: onKeyDown,
84
- tabIndex: disabled ? -1 : 0,
64
+ tabIndex: -1,
85
65
  title: description,
86
66
  type: "button"
87
67
  }, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null))));
@@ -92,8 +72,7 @@ function ListBoxSelection(_ref) {
92
72
  className: className,
93
73
  disabled: disabled,
94
74
  onClick: onClick,
95
- onKeyDown: onKeyDown,
96
- tabIndex: disabled ? -1 : 0,
75
+ tabIndex: -1,
97
76
  title: description,
98
77
  type: "button"
99
78
  }), _Close2 || (_Close2 = /*#__PURE__*/React__default.createElement(Close, null)));