@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
@@ -17,7 +17,7 @@ import { useId } from '../../internal/useId.js';
17
17
 
18
18
  var _excluded = ["as", "children", "className", "dangerDescription", "disabled", "hasIconOnly", "href", "iconDescription", "isExpressive", "isSelected", "kind", "onBlur", "onClick", "onFocus", "onMouseEnter", "onMouseLeave", "renderIcon", "size", "tabIndex", "tooltipAlignment", "tooltipPosition", "type"];
19
19
  var Button = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
20
- var _classNames;
20
+ var _classNames, _rest$ariaPressed;
21
21
 
22
22
  var as = _ref.as,
23
23
  children = _ref.children,
@@ -82,7 +82,7 @@ var Button = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
82
82
  disabled: disabled,
83
83
  type: type,
84
84
  'aria-describedby': dangerButtonVariants.includes(kind) ? assistiveId : null,
85
- 'aria-pressed': hasIconOnly && kind === 'ghost' ? isSelected : null
85
+ 'aria-pressed': (_rest$ariaPressed = rest['aria-pressed']) !== null && _rest$ariaPressed !== void 0 ? _rest$ariaPressed : hasIconOnly && kind === 'ghost' ? isSelected : null
86
86
  };
87
87
  var anchorProps = {
88
88
  href: href
@@ -19,7 +19,9 @@ import copy from 'copy-to-clipboard';
19
19
  import deprecate from '../../prop-types/deprecate.js';
20
20
  import { usePrefix } from '../../internal/usePrefix.js';
21
21
 
22
- var _excluded = ["className", "type", "children", "disabled", "feedback", "feedbackTimeout", "onClick", "ariaLabel", "copyText", "copyButtonDescription", "light", "showMoreText", "showLessText", "hideCopyButton", "wrapText", "maxCollapsedNumberOfRows", "maxExpandedNumberOfRows", "minCollapsedNumberOfRows", "minExpandedNumberOfRows"];
22
+ var _CodeSnippet$propType, _CodeSnippet$defaultP;
23
+
24
+ var _excluded = ["className", "type", "children", "disabled", "feedback", "feedbackTimeout", "onClick", "aria-label", "ariaLabel", "copyText", "copyButtonDescription", "light", "showMoreText", "showLessText", "hideCopyButton", "wrapText", "maxCollapsedNumberOfRows", "maxExpandedNumberOfRows", "minCollapsedNumberOfRows", "minExpandedNumberOfRows"];
23
25
  var rowHeightInPixels = 16;
24
26
  var defaultMaxCollapsedNumberOfRows = 15;
25
27
  var defaultMaxExpandedNumberOfRows = 0;
@@ -36,7 +38,8 @@ function CodeSnippet(_ref) {
36
38
  feedback = _ref.feedback,
37
39
  feedbackTimeout = _ref.feedbackTimeout,
38
40
  onClick = _ref.onClick,
39
- ariaLabel = _ref.ariaLabel,
41
+ ariaLabel = _ref['aria-label'],
42
+ deprecatedAriaLabel = _ref.ariaLabel,
40
43
  copyText = _ref.copyText,
41
44
  copyButtonDescription = _ref.copyButtonDescription,
42
45
  light = _ref.light,
@@ -171,7 +174,7 @@ function CodeSnippet(_ref) {
171
174
 
172
175
  return /*#__PURE__*/React__default.createElement(Copy, _extends({}, rest, {
173
176
  onClick: handleCopyClick,
174
- "aria-label": ariaLabel,
177
+ "aria-label": deprecatedAriaLabel || ariaLabel,
175
178
  "aria-describedby": uid,
176
179
  className: codeSnippetClasses,
177
180
  feedback: feedback,
@@ -214,10 +217,12 @@ function CodeSnippet(_ref) {
214
217
  className: codeSnippetClasses
215
218
  }), /*#__PURE__*/React__default.createElement("div", _extends({
216
219
  ref: codeContainerRef,
217
- role: type === 'single' ? 'textbox' : null,
218
- tabIndex: type === 'single' && !disabled ? 0 : null,
220
+ role: type === 'single' || type === 'multi' ? 'textbox' : null,
221
+ tabIndex: (type === 'single' || type === 'multi') && !disabled ? 0 : null,
219
222
  className: "".concat(prefix, "--snippet-container"),
220
- "aria-label": ariaLabel || 'code-snippet',
223
+ "aria-label": deprecatedAriaLabel || ariaLabel || 'code-snippet',
224
+ "aria-readonly": type === 'single' || type === 'multi' ? true : null,
225
+ "aria-multiline": type === 'multi' ? true : null,
221
226
  onScroll: type === 'single' && handleScroll || null
222
227
  }, containerStyle), /*#__PURE__*/React__default.createElement("pre", {
223
228
  ref: codeContentRef,
@@ -251,114 +256,7 @@ function CodeSnippet(_ref) {
251
256
  })));
252
257
  }
253
258
 
254
- CodeSnippet.propTypes = {
255
- /**
256
- * Specify a label to be read by screen readers on the containing <textbox>
257
- * node
258
- */
259
- ariaLabel: PropTypes.string,
260
-
261
- /**
262
- * Provide the content of your CodeSnippet as a node or string
263
- */
264
- children: PropTypes.node,
265
-
266
- /**
267
- * Specify an optional className to be applied to the container node
268
- */
269
- className: PropTypes.string,
270
-
271
- /**
272
- * Specify the description for the Copy Button
273
- */
274
- copyButtonDescription: PropTypes.string,
275
-
276
- /**
277
- * Optional text to copy. If not specified, the `children` node's `innerText`
278
- * will be used as the copy value.
279
- */
280
- copyText: PropTypes.string,
281
-
282
- /**
283
- * Specify whether or not the CodeSnippet should be disabled
284
- */
285
- disabled: PropTypes.bool,
286
-
287
- /**
288
- * Specify the string displayed when the snippet is copied
289
- */
290
- feedback: PropTypes.string,
291
-
292
- /**
293
- * Specify the time it takes for the feedback message to timeout
294
- */
295
- feedbackTimeout: PropTypes.number,
296
-
297
- /**
298
- * Specify whether or not a copy button should be used/rendered.
299
- */
300
- hideCopyButton: PropTypes.bool,
301
-
302
- /**
303
- * Specify whether you are using the light variant of the Code Snippet,
304
- * typically used for inline snippet to display an alternate color
305
- */
306
- light: deprecate(PropTypes.bool, 'The `light` prop for `CodeSnippet` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
307
-
308
- /**
309
- * Specify the maximum number of rows to be shown when in collapsed view
310
- */
311
- maxCollapsedNumberOfRows: PropTypes.number,
312
-
313
- /**
314
- * Specify the maximum number of rows to be shown when in expanded view
315
- */
316
- maxExpandedNumberOfRows: PropTypes.number,
317
-
318
- /**
319
- * Specify the minimum number of rows to be shown when in collapsed view
320
- */
321
- minCollapsedNumberOfRows: PropTypes.number,
322
-
323
- /**
324
- * Specify the minimum number of rows to be shown when in expanded view
325
- */
326
- minExpandedNumberOfRows: PropTypes.number,
327
-
328
- /**
329
- * An optional handler to listen to the `onClick` even fired by the Copy
330
- * Button
331
- */
332
- onClick: PropTypes.func,
333
-
334
- /**
335
- * Specify a string that is displayed when the Code Snippet has been
336
- * interacted with to show more lines
337
- */
338
- showLessText: PropTypes.string,
339
-
340
- /**
341
- * Specify a string that is displayed when the Code Snippet text is more
342
- * than 15 lines
343
- */
344
- showMoreText: PropTypes.string,
345
-
346
- /**
347
- * Provide the type of Code Snippet
348
- */
349
- type: PropTypes.oneOf(['single', 'inline', 'multi']),
350
-
351
- /**
352
- * Specify whether or not to wrap the text.
353
- */
354
- wrapText: PropTypes.bool
355
- };
356
- CodeSnippet.defaultProps = {
357
- ariaLabel: 'Copy to clipboard',
358
- type: 'single',
359
- showMoreText: 'Show more',
360
- showLessText: 'Show less',
361
- wrapText: false
362
- };
259
+ CodeSnippet.propTypes = (_CodeSnippet$propType = {}, _defineProperty(_CodeSnippet$propType, 'aria-label', PropTypes.string), _defineProperty(_CodeSnippet$propType, "ariaLabel", deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.')), _defineProperty(_CodeSnippet$propType, "children", PropTypes.node), _defineProperty(_CodeSnippet$propType, "className", PropTypes.string), _defineProperty(_CodeSnippet$propType, "copyButtonDescription", PropTypes.string), _defineProperty(_CodeSnippet$propType, "copyText", PropTypes.string), _defineProperty(_CodeSnippet$propType, "disabled", PropTypes.bool), _defineProperty(_CodeSnippet$propType, "feedback", PropTypes.string), _defineProperty(_CodeSnippet$propType, "feedbackTimeout", PropTypes.number), _defineProperty(_CodeSnippet$propType, "hideCopyButton", PropTypes.bool), _defineProperty(_CodeSnippet$propType, "light", deprecate(PropTypes.bool, 'The `light` prop for `CodeSnippet` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.')), _defineProperty(_CodeSnippet$propType, "maxCollapsedNumberOfRows", PropTypes.number), _defineProperty(_CodeSnippet$propType, "maxExpandedNumberOfRows", PropTypes.number), _defineProperty(_CodeSnippet$propType, "minCollapsedNumberOfRows", PropTypes.number), _defineProperty(_CodeSnippet$propType, "minExpandedNumberOfRows", PropTypes.number), _defineProperty(_CodeSnippet$propType, "onClick", PropTypes.func), _defineProperty(_CodeSnippet$propType, "showLessText", PropTypes.string), _defineProperty(_CodeSnippet$propType, "showMoreText", PropTypes.string), _defineProperty(_CodeSnippet$propType, "type", PropTypes.oneOf(['single', 'inline', 'multi'])), _defineProperty(_CodeSnippet$propType, "wrapText", PropTypes.bool), _CodeSnippet$propType);
260
+ CodeSnippet.defaultProps = (_CodeSnippet$defaultP = {}, _defineProperty(_CodeSnippet$defaultP, 'aria-label', 'Copy to clipboard'), _defineProperty(_CodeSnippet$defaultP, "type", 'single'), _defineProperty(_CodeSnippet$defaultP, "showMoreText", 'Show more'), _defineProperty(_CodeSnippet$defaultP, "showLessText", 'Show less'), _defineProperty(_CodeSnippet$defaultP, "wrapText", false), _CodeSnippet$defaultP);
363
261
 
364
262
  export { CodeSnippet as default };
@@ -11,6 +11,12 @@ import { ListBoxType, ListBoxSize } from '../ListBox';
11
11
  type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
12
12
  export interface ComboBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
13
13
  /**
14
+ * Specify a label to be read by screen readers on the container node
15
+ * 'aria-label' of the ListBox component.
16
+ */
17
+ ['aria-label']?: string;
18
+ /**
19
+ * @deprecated please use `aria-label` instead.
14
20
  * 'aria-label' of the ListBox component.
15
21
  */
16
22
  ariaLabel?: string;
@@ -25,9 +25,11 @@ import { Text } from '../Text/Text.js';
25
25
  import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
26
26
  import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
27
27
  import { ListBoxSize, ListBoxType } from '../ListBox/ListBoxPropTypes.js';
28
- import { Space, Enter } from '../../internal/keyboard/keys.js';
28
+ import { Space, Enter, Escape } from '../../internal/keyboard/keys.js';
29
29
 
30
- var _excluded = ["ariaLabel", "className", "direction", "disabled", "downshiftProps", "helperText", "id", "initialSelectedItem", "invalid", "invalidText", "items", "itemToElement", "itemToString", "light", "onChange", "onInputChange", "onToggleClick", "placeholder", "readOnly", "selectedItem", "shouldFilterItem", "size", "titleText", "translateWithId", "type", "warn", "warnText", "onStateChange"];
30
+ var _ComboBox$propTypes, _ComboBox$defaultProp;
31
+
32
+ var _excluded = ["aria-label", "ariaLabel", "className", "direction", "disabled", "downshiftProps", "helperText", "id", "initialSelectedItem", "invalid", "invalidText", "items", "itemToElement", "itemToString", "light", "onChange", "onInputChange", "onToggleClick", "placeholder", "readOnly", "selectedItem", "shouldFilterItem", "size", "titleText", "translateWithId", "type", "warn", "warnText", "onStateChange"];
31
33
 
32
34
  var defaultItemToString = function defaultItemToString(item) {
33
35
  if (typeof item === 'string') {
@@ -84,7 +86,8 @@ var getInstanceId = setupGetInstanceId();
84
86
  var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
85
87
  var _cx, _ref4, _cx4, _Text;
86
88
 
87
- var ariaLabel = props.ariaLabel,
89
+ var ariaLabel = props['aria-label'],
90
+ deprecatedAriaLabel = props.ariaLabel,
88
91
  containerClassName = props.className,
89
92
  direction = props.direction,
90
93
  disabled = props.disabled,
@@ -304,6 +307,14 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
304
307
  if (match(event, Enter) && !inputValue) {
305
308
  toggleMenu();
306
309
  }
310
+
311
+ if (match(event, Escape) && inputValue) {
312
+ if (event.target === textInput.current && isOpen) {
313
+ toggleMenu();
314
+ event.preventDownshiftDefault = true;
315
+ event.persist();
316
+ }
317
+ }
307
318
  }
308
319
  });
309
320
 
@@ -366,7 +377,7 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
366
377
  isOpen: isOpen,
367
378
  translateWithId: translateWithId
368
379
  }))), /*#__PURE__*/React__default.createElement(ListBox.Menu, getMenuProps({
369
- 'aria-label': ariaLabel
380
+ 'aria-label': deprecatedAriaLabel || ariaLabel
370
381
  }), isOpen ? filterItems(items, itemToString, inputValue).map(function (item, index) {
371
382
  var _getItemProps;
372
383
 
@@ -395,178 +406,14 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
395
406
  });
396
407
  });
397
408
  ComboBox.displayName = 'ComboBox';
398
- ComboBox.propTypes = {
399
- /**
400
- * 'aria-label' of the ListBox component.
401
- */
402
- ariaLabel: PropTypes.string,
403
-
404
- /**
405
- * An optional className to add to the container node
406
- */
407
- className: PropTypes.string,
408
-
409
- /**
410
- * Specify the direction of the combobox dropdown. Can be either top or bottom.
411
- */
412
- direction: PropTypes.oneOf(['top', 'bottom']),
413
-
414
- /**
415
- * Specify if the control should be disabled, or not
416
- */
417
- disabled: PropTypes.bool,
418
-
419
- /**
420
- * Additional props passed to Downshift
421
- */
422
- // @ts-ignore
423
- downshiftProps: PropTypes.shape(Downshift.propTypes),
424
-
425
- /**
426
- * Provide helper text that is used alongside the control label for
427
- * additional help
428
- */
429
- helperText: PropTypes.string,
430
-
431
- /**
432
- * Specify a custom `id` for the input
433
- */
434
- id: PropTypes.string.isRequired,
435
-
436
- /**
437
- * Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
438
- * from their collection that are pre-selected
439
- */
440
- initialSelectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
441
-
442
- /**
443
- * Specify if the currently selected value is invalid.
444
- */
445
- invalid: PropTypes.bool,
446
-
447
- /**
448
- * Message which is displayed if the value is invalid.
449
- */
450
- invalidText: PropTypes.node,
451
-
452
- /**
453
- * Optional function to render items as custom components instead of strings.
454
- * Defaults to null and is overridden by a getter
455
- */
456
- itemToElement: PropTypes.func,
457
-
458
- /**
459
- * Helper function passed to downshift that allows the library to render a
460
- * given item to a string label. By default, it extracts the `label` field
461
- * from a given item to serve as the item label in the list
462
- */
463
- itemToString: PropTypes.func,
464
-
465
- /**
466
- * We try to stay as generic as possible here to allow individuals to pass
467
- * in a collection of whatever kind of data structure they prefer
468
- */
469
- items: PropTypes.array.isRequired,
470
-
471
- /**
472
- * should use "light theme" (white background)?
473
- */
474
- light: deprecate(PropTypes.bool, 'The `light` prop for `Combobox` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
475
-
476
- /**
477
- * `onChange` is a utility for this controlled component to communicate to a
478
- * consuming component when a specific dropdown item is selected.
479
- * `({ selectedItem }) => void`
480
- * @param {{ selectedItem }}
481
- */
482
- onChange: PropTypes.func.isRequired,
483
-
484
- /**
485
- * Callback function to notify consumer when the text input changes.
486
- * This provides support to change available items based on the text.
487
- * `(inputText) => void`
488
- * @param {string} inputText
489
- */
490
- onInputChange: PropTypes.func,
491
-
492
- /**
493
- * Helper function passed to Downshift that allows the user to observe internal
494
- * state changes
495
- * `(changes, stateAndHelpers) => void`
496
- */
497
- onStateChange: PropTypes.func,
498
-
499
- /**
500
- * Callback function that fires when the combobox menu toggle is clicked
501
- * `(evt) => void`
502
- * @param {MouseEvent} event
503
- */
504
- onToggleClick: PropTypes.func,
505
-
506
- /**
507
- * Used to provide a placeholder text node before a user enters any input.
508
- * This is only present if the control has no items selected
509
- */
510
- placeholder: PropTypes.string,
511
-
512
- /**
513
- * Is the ComboBox readonly?
514
- */
515
- readOnly: PropTypes.bool,
516
-
517
- /**
518
- * For full control of the selection
519
- */
520
- selectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
521
-
522
- /**
523
- * Specify your own filtering logic by passing in a `shouldFilterItem`
524
- * function that takes in the current input and an item and passes back
525
- * whether or not the item should be filtered.
526
- */
527
- shouldFilterItem: PropTypes.func,
528
-
529
- /**
530
- * Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
531
- */
532
- size: ListBoxSize,
533
-
534
- /**
535
- * Provide text to be used in a `<label>` element that is tied to the
536
- * combobox via ARIA attributes.
537
- */
538
- titleText: PropTypes.node,
539
-
540
- /**
541
- * Specify a custom translation function that takes in a message identifier
542
- * and returns the localized string for the message
543
- */
544
- translateWithId: PropTypes.func,
545
-
546
- /**
547
- * Currently supports either the default type, or an inline variant
548
- */
549
- type: ListBoxType,
550
-
551
- /**
552
- * Specify whether the control is currently in warning state
553
- */
554
- warn: PropTypes.bool,
555
-
556
- /**
557
- * Provide the text that is displayed when the control is in warning state
558
- */
559
- warnText: PropTypes.node
560
- };
561
- ComboBox.defaultProps = {
409
+ ComboBox.propTypes = (_ComboBox$propTypes = {}, _defineProperty(_ComboBox$propTypes, 'aria-label', PropTypes.string), _defineProperty(_ComboBox$propTypes, "ariaLabel", deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.')), _defineProperty(_ComboBox$propTypes, "className", PropTypes.string), _defineProperty(_ComboBox$propTypes, "direction", PropTypes.oneOf(['top', 'bottom'])), _defineProperty(_ComboBox$propTypes, "disabled", PropTypes.bool), _defineProperty(_ComboBox$propTypes, "downshiftProps", PropTypes.shape(Downshift.propTypes)), _defineProperty(_ComboBox$propTypes, "helperText", PropTypes.string), _defineProperty(_ComboBox$propTypes, "id", PropTypes.string.isRequired), _defineProperty(_ComboBox$propTypes, "initialSelectedItem", PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number])), _defineProperty(_ComboBox$propTypes, "invalid", PropTypes.bool), _defineProperty(_ComboBox$propTypes, "invalidText", PropTypes.node), _defineProperty(_ComboBox$propTypes, "itemToElement", PropTypes.func), _defineProperty(_ComboBox$propTypes, "itemToString", PropTypes.func), _defineProperty(_ComboBox$propTypes, "items", PropTypes.array.isRequired), _defineProperty(_ComboBox$propTypes, "light", deprecate(PropTypes.bool, 'The `light` prop for `Combobox` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.')), _defineProperty(_ComboBox$propTypes, "onChange", PropTypes.func.isRequired), _defineProperty(_ComboBox$propTypes, "onInputChange", PropTypes.func), _defineProperty(_ComboBox$propTypes, "onStateChange", PropTypes.func), _defineProperty(_ComboBox$propTypes, "onToggleClick", PropTypes.func), _defineProperty(_ComboBox$propTypes, "placeholder", PropTypes.string), _defineProperty(_ComboBox$propTypes, "readOnly", PropTypes.bool), _defineProperty(_ComboBox$propTypes, "selectedItem", PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number])), _defineProperty(_ComboBox$propTypes, "shouldFilterItem", PropTypes.func), _defineProperty(_ComboBox$propTypes, "size", ListBoxSize), _defineProperty(_ComboBox$propTypes, "titleText", PropTypes.node), _defineProperty(_ComboBox$propTypes, "translateWithId", PropTypes.func), _defineProperty(_ComboBox$propTypes, "type", ListBoxType), _defineProperty(_ComboBox$propTypes, "warn", PropTypes.bool), _defineProperty(_ComboBox$propTypes, "warnText", PropTypes.node), _ComboBox$propTypes);
410
+ ComboBox.defaultProps = (_ComboBox$defaultProp = {
562
411
  disabled: false,
563
412
  itemToString: defaultItemToString,
564
413
  itemToElement: null,
565
414
  shouldFilterItem: defaultShouldFilterItem,
566
- type: 'default',
567
- ariaLabel: 'Choose an item',
568
- direction: 'bottom'
569
- };
415
+ type: 'default'
416
+ }, _defineProperty(_ComboBox$defaultProp, 'aria-label', 'Choose an item'), _defineProperty(_ComboBox$defaultProp, "direction", 'bottom'), _ComboBox$defaultProp);
570
417
  var ComboBox$1 = ComboBox;
571
418
 
572
419
  export { ComboBox$1 as default };
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useRef, useState } from 'react';
10
+ import PropTypes from 'prop-types';
11
+ import cx from 'classnames';
12
+ import { ChevronDown } from '@carbon/icons-react';
13
+ import Button from '../Button/Button.js';
14
+ import { IconButton } from '../IconButton/index.js';
15
+ import { Menu } from '../Menu/Menu.js';
16
+ import { useAttachedMenu } from '../../internal/useAttachedMenu.js';
17
+ import { useId } from '../../internal/useId.js';
18
+ import { useMergedRefs } from '../../internal/useMergedRefs.js';
19
+ import { usePrefix } from '../../internal/usePrefix.js';
20
+
21
+ var _ChevronDown;
22
+
23
+ var _excluded = ["children", "className", "disabled", "label", "onClick", "size", "tooltipAlign", "translateWithId"];
24
+ var spacing = 4; // top and bottom spacing between the button and the menu. in px
25
+
26
+ var defaultTranslations = {
27
+ 'carbon.combo-button.additional-actions': 'Additional actions'
28
+ };
29
+
30
+ function defaultTranslateWithId(messageId) {
31
+ return defaultTranslations[messageId];
32
+ }
33
+
34
+ var ComboButton = /*#__PURE__*/React__default.forwardRef(function ComboButton(_ref, forwardRef) {
35
+ var children = _ref.children,
36
+ className = _ref.className,
37
+ disabled = _ref.disabled,
38
+ label = _ref.label,
39
+ onClick = _ref.onClick,
40
+ _ref$size = _ref.size,
41
+ size = _ref$size === void 0 ? 'lg' : _ref$size,
42
+ tooltipAlign = _ref.tooltipAlign,
43
+ _ref$translateWithId = _ref.translateWithId,
44
+ t = _ref$translateWithId === void 0 ? defaultTranslateWithId : _ref$translateWithId,
45
+ rest = _objectWithoutProperties(_ref, _excluded);
46
+
47
+ var id = useId('combobutton');
48
+ var prefix = usePrefix();
49
+ var containerRef = useRef(null);
50
+ var menuRef = useRef(null);
51
+ var ref = useMergedRefs([forwardRef, containerRef]);
52
+
53
+ var _useState = useState(0),
54
+ _useState2 = _slicedToArray(_useState, 2),
55
+ width = _useState2[0],
56
+ setWidth = _useState2[1];
57
+
58
+ var _useAttachedMenu = useAttachedMenu(containerRef),
59
+ open = _useAttachedMenu.open,
60
+ x = _useAttachedMenu.x,
61
+ y = _useAttachedMenu.y,
62
+ hookOnClick = _useAttachedMenu.handleClick,
63
+ handleTriggerMousedown = _useAttachedMenu.handleMousedown,
64
+ handleClose = _useAttachedMenu.handleClose;
65
+
66
+ function handleTriggerClick() {
67
+ if (containerRef.current) {
68
+ var _containerRef$current = containerRef.current.getBoundingClientRect(),
69
+ w = _containerRef$current.width;
70
+
71
+ setWidth(w);
72
+ hookOnClick();
73
+ }
74
+ }
75
+
76
+ function handlePrimaryActionClick(e) {
77
+ if (onClick) {
78
+ onClick(e);
79
+ }
80
+ }
81
+
82
+ function handleOpen() {
83
+ menuRef.current.style.width = "".concat(width, "px");
84
+ }
85
+
86
+ var containerClasses = cx("".concat(prefix, "--combo-button__container"), "".concat(prefix, "--combo-button__container--").concat(size), _defineProperty({}, "".concat(prefix, "--combo-button__container--open"), open), className);
87
+ var primaryActionClasses = cx("".concat(prefix, "--combo-button__primary-action"));
88
+ var triggerClasses = cx("".concat(prefix, "--combo-button__trigger"));
89
+ return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
90
+ className: containerClasses,
91
+ ref: ref
92
+ }), /*#__PURE__*/React__default.createElement("div", {
93
+ className: primaryActionClasses
94
+ }, /*#__PURE__*/React__default.createElement(Button, {
95
+ size: size,
96
+ disabled: disabled,
97
+ onClick: handlePrimaryActionClick
98
+ }, label)), /*#__PURE__*/React__default.createElement(IconButton, {
99
+ className: triggerClasses,
100
+ label: t('carbon.combo-button.additional-actions'),
101
+ size: size,
102
+ disabled: disabled,
103
+ align: tooltipAlign,
104
+ "aria-haspopup": true,
105
+ "aria-expanded": open,
106
+ onClick: handleTriggerClick,
107
+ onMouseDown: handleTriggerMousedown,
108
+ "aria-owns": open ? id : null
109
+ }, _ChevronDown || (_ChevronDown = /*#__PURE__*/React__default.createElement(ChevronDown, null))), /*#__PURE__*/React__default.createElement(Menu, {
110
+ ref: menuRef,
111
+ id: id,
112
+ label: t('carbon.combo-button.additional-actions'),
113
+ size: size,
114
+ open: open,
115
+ onClose: handleClose,
116
+ onOpen: handleOpen,
117
+ x: x,
118
+ y: [y[0] - spacing, y[1] + spacing]
119
+ }, children));
120
+ });
121
+ ComboButton.propTypes = {
122
+ /**
123
+ * A collection of MenuItems to be rendered as additional actions for this ComboButton.
124
+ */
125
+ children: PropTypes.node.isRequired,
126
+
127
+ /**
128
+ * Additional CSS class names.
129
+ */
130
+ className: PropTypes.string,
131
+
132
+ /**
133
+ * Specify whether the ComboButton should be disabled, or not.
134
+ */
135
+ disabled: PropTypes.bool,
136
+
137
+ /**
138
+ * Provide the label to be renderd on the primary action button.
139
+ */
140
+ label: PropTypes.string.isRequired,
141
+
142
+ /**
143
+ * Provide an optional function to be called when the primary action element is clicked.
144
+ */
145
+ onClick: PropTypes.func,
146
+
147
+ /**
148
+ * Specify the size of the buttons and menu.
149
+ */
150
+ size: PropTypes.oneOf(['sm', 'md', 'lg']),
151
+
152
+ /**
153
+ * Specify how the trigger tooltip should be aligned.
154
+ */
155
+ tooltipAlign: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
156
+
157
+ /**
158
+ * Optional method that takes in a message id and returns an
159
+ * internationalized string.
160
+ */
161
+ translateWithId: PropTypes.func
162
+ };
163
+
164
+ export { ComboButton };
@@ -196,8 +196,7 @@ var ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedModa
196
196
  onBlur: handleBlur,
197
197
  onMouseDown: handleMousedown,
198
198
  onKeyDown: handleKeyDown,
199
- className: modalClass,
200
- tabIndex: "-1"
199
+ className: modalClass
201
200
  }), /*#__PURE__*/React__default.createElement("div", {
202
201
  className: containerClass,
203
202
  role: "dialog",
@@ -0,0 +1,74 @@
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 { PropsWithChildren } from 'react';
8
+ import PropTypes from 'prop-types';
9
+ interface TableProps {
10
+ className?: string;
11
+ /**
12
+ * `false` If true, will apply sorting styles
13
+ */
14
+ isSortable?: boolean;
15
+ /**
16
+ * Specify whether the overflow menu (if it exists) should be shown always, or only on hover
17
+ */
18
+ overflowMenuOnHover?: boolean;
19
+ /**
20
+ * Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
21
+ */
22
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
23
+ /**
24
+ * `false` If true, will keep the header sticky (only data rows will scroll)
25
+ */
26
+ stickyHeader?: boolean;
27
+ /**
28
+ * `false` If true, will use a width of 'auto' instead of 100%
29
+ */
30
+ useStaticWidth?: boolean;
31
+ /**
32
+ * `true` to add useZebraStyles striping.
33
+ */
34
+ useZebraStyles?: boolean;
35
+ }
36
+ export declare const Table: {
37
+ ({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, ...other }: PropsWithChildren<TableProps>): JSX.Element;
38
+ propTypes: {
39
+ /**
40
+ * Pass in the children that will be rendered within the Table
41
+ */
42
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
43
+ className: PropTypes.Requireable<string>;
44
+ /**
45
+ * `false` If true, will apply sorting styles
46
+ */
47
+ isSortable: PropTypes.Requireable<boolean>;
48
+ /**
49
+ * Specify whether the overflow menu (if it exists) should be shown always, or only on hover
50
+ */
51
+ overflowMenuOnHover: PropTypes.Requireable<boolean>;
52
+ /**
53
+ * Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
54
+ */
55
+ size: PropTypes.Requireable<string>;
56
+ /**
57
+ * `false` If true, will keep the header sticky (only data rows will scroll)
58
+ */
59
+ stickyHeader: PropTypes.Requireable<boolean>;
60
+ /**
61
+ * `false` If true, will use a width of 'auto' instead of 100%
62
+ */
63
+ useStaticWidth: PropTypes.Requireable<boolean>;
64
+ /**
65
+ * `true` to add useZebraStyles striping.
66
+ */
67
+ useZebraStyles: PropTypes.Requireable<boolean>;
68
+ };
69
+ defaultProps: {
70
+ isSortable: boolean;
71
+ overflowMenuOnHover: boolean;
72
+ };
73
+ };
74
+ export default Table;