@carbon/react 1.70.0 → 1.71.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 (160) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +972 -947
  2. package/es/components/AILabel/index.js +15 -15
  3. package/es/components/Checkbox/Checkbox.d.ts +5 -0
  4. package/es/components/Checkbox/Checkbox.js +16 -7
  5. package/es/components/CheckboxGroup/CheckboxGroup.d.ts +5 -0
  6. package/es/components/CheckboxGroup/CheckboxGroup.js +16 -7
  7. package/es/components/CodeSnippet/CodeSnippet.d.ts +5 -2
  8. package/es/components/CodeSnippet/CodeSnippet.js +40 -1
  9. package/es/components/ComboBox/ComboBox.d.ts +1 -1
  10. package/es/components/ComboBox/ComboBox.js +19 -22
  11. package/es/components/ComboButton/index.js +40 -1
  12. package/es/components/ComposedModal/ComposedModal.d.ts +5 -0
  13. package/es/components/ComposedModal/ComposedModal.js +16 -10
  14. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +2 -2
  15. package/es/components/ContentSwitcher/ContentSwitcher.js +1 -1
  16. package/es/components/Copy/Copy.d.ts +5 -2
  17. package/es/components/Copy/Copy.js +40 -1
  18. package/es/components/CopyButton/CopyButton.d.ts +5 -2
  19. package/es/components/CopyButton/CopyButton.js +40 -1
  20. package/es/components/DataTable/TableSelectRow.js +14 -6
  21. package/es/components/DataTable/TableToolbarSearch.js +1 -1
  22. package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +1 -1
  23. package/es/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
  24. package/es/components/DatePickerInput/DatePickerInput.d.ts +6 -1
  25. package/es/components/DatePickerInput/DatePickerInput.js +16 -10
  26. package/es/components/Dropdown/Dropdown.d.ts +5 -0
  27. package/es/components/Dropdown/Dropdown.js +132 -92
  28. package/es/components/FeatureFlags/index.js +1 -2
  29. package/es/components/FluidNumberInput/FluidNumberInput.d.ts +4 -0
  30. package/es/components/FluidSelect/FluidSelect.d.ts +4 -0
  31. package/es/components/FluidSelect/FluidSelect.js +5 -1
  32. package/es/components/FluidTextArea/FluidTextArea.d.ts +4 -0
  33. package/es/components/FluidTextArea/FluidTextArea.js +5 -1
  34. package/es/components/FluidTextInput/FluidPasswordInput.d.ts +4 -0
  35. package/es/components/FluidTextInput/FluidPasswordInput.js +5 -1
  36. package/es/components/FluidTextInput/FluidTextInput.d.ts +4 -0
  37. package/es/components/FluidTextInput/FluidTextInput.js +5 -1
  38. package/es/components/FluidTimePicker/FluidTimePicker.d.ts +4 -0
  39. package/es/components/FluidTimePicker/FluidTimePicker.js +23 -7
  40. package/es/components/IconButton/index.d.ts +4 -1
  41. package/es/components/IconButton/index.js +40 -1
  42. package/es/components/InlineCheckbox/InlineCheckbox.d.ts +50 -0
  43. package/es/components/InlineCheckbox/InlineCheckbox.js +3 -6
  44. package/es/components/InlineCheckbox/index.d.ts +9 -0
  45. package/es/components/LayoutDirection/LayoutDirection.d.ts +44 -0
  46. package/es/components/LayoutDirection/LayoutDirectionContext.d.ts +10 -0
  47. package/es/components/LayoutDirection/useLayoutDirection.d.ts +12 -0
  48. package/es/components/Menu/MenuItem.js +0 -3
  49. package/es/components/Modal/Modal.d.ts +5 -0
  50. package/es/components/Modal/Modal.js +16 -10
  51. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  52. package/es/components/MultiSelect/FilterableMultiSelect.js +1 -2
  53. package/es/components/MultiSelect/MultiSelect.js +1 -1
  54. package/es/components/Notification/Notification.d.ts +9 -2
  55. package/es/components/Notification/Notification.js +16 -2
  56. package/es/components/NumberInput/NumberInput.d.ts +5 -0
  57. package/es/components/NumberInput/NumberInput.js +17 -9
  58. package/es/components/OverflowMenu/next/index.js +40 -1
  59. package/es/components/Pagination/Pagination.js +1 -1
  60. package/es/components/PaginationNav/PaginationNav.d.ts +1 -1
  61. package/es/components/PaginationNav/PaginationNav.js +22 -5
  62. package/es/components/RadioButton/RadioButton.d.ts +5 -0
  63. package/es/components/RadioButton/RadioButton.js +16 -7
  64. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +5 -0
  65. package/es/components/RadioButtonGroup/RadioButtonGroup.js +16 -7
  66. package/es/components/RadioTile/RadioTile.d.ts +5 -0
  67. package/es/components/RadioTile/RadioTile.js +17 -8
  68. package/es/components/Tabs/Tabs.js +46 -29
  69. package/es/components/Tag/DismissibleTag.d.ts +11 -2
  70. package/es/components/Tag/DismissibleTag.js +13 -5
  71. package/es/components/Tag/Tag.d.ts +5 -0
  72. package/es/components/Tag/Tag.js +14 -7
  73. package/es/components/TextArea/TextArea.d.ts +5 -0
  74. package/es/components/TextArea/TextArea.js +15 -7
  75. package/es/components/TextInput/TextInput.d.ts +5 -0
  76. package/es/components/TextInput/TextInput.js +15 -7
  77. package/es/components/Tile/Tile.d.ts +21 -1
  78. package/es/components/Tile/Tile.js +68 -48
  79. package/es/components/UIShell/SideNavMenuItem.d.ts +5 -1
  80. package/es/components/UIShell/SideNavMenuItem.js +7 -2
  81. package/lib/components/AILabel/index.js +15 -15
  82. package/lib/components/Checkbox/Checkbox.d.ts +5 -0
  83. package/lib/components/Checkbox/Checkbox.js +16 -7
  84. package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +5 -0
  85. package/lib/components/CheckboxGroup/CheckboxGroup.js +16 -7
  86. package/lib/components/CodeSnippet/CodeSnippet.d.ts +5 -2
  87. package/lib/components/CodeSnippet/CodeSnippet.js +40 -1
  88. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  89. package/lib/components/ComboBox/ComboBox.js +19 -22
  90. package/lib/components/ComboButton/index.js +40 -1
  91. package/lib/components/ComposedModal/ComposedModal.d.ts +5 -0
  92. package/lib/components/ComposedModal/ComposedModal.js +16 -10
  93. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +2 -2
  94. package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
  95. package/lib/components/Copy/Copy.d.ts +5 -2
  96. package/lib/components/Copy/Copy.js +40 -1
  97. package/lib/components/CopyButton/CopyButton.d.ts +5 -2
  98. package/lib/components/CopyButton/CopyButton.js +40 -1
  99. package/lib/components/DataTable/TableSelectRow.js +14 -6
  100. package/lib/components/DataTable/TableToolbarSearch.js +1 -1
  101. package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +1 -1
  102. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
  103. package/lib/components/DatePickerInput/DatePickerInput.d.ts +6 -1
  104. package/lib/components/DatePickerInput/DatePickerInput.js +16 -10
  105. package/lib/components/Dropdown/Dropdown.d.ts +5 -0
  106. package/lib/components/Dropdown/Dropdown.js +131 -91
  107. package/lib/components/FeatureFlags/index.js +1 -2
  108. package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -0
  109. package/lib/components/FluidSelect/FluidSelect.d.ts +4 -0
  110. package/lib/components/FluidSelect/FluidSelect.js +5 -1
  111. package/lib/components/FluidTextArea/FluidTextArea.d.ts +4 -0
  112. package/lib/components/FluidTextArea/FluidTextArea.js +5 -1
  113. package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +4 -0
  114. package/lib/components/FluidTextInput/FluidPasswordInput.js +5 -1
  115. package/lib/components/FluidTextInput/FluidTextInput.d.ts +4 -0
  116. package/lib/components/FluidTextInput/FluidTextInput.js +5 -1
  117. package/lib/components/FluidTimePicker/FluidTimePicker.d.ts +4 -0
  118. package/lib/components/FluidTimePicker/FluidTimePicker.js +23 -7
  119. package/lib/components/IconButton/index.d.ts +4 -1
  120. package/lib/components/IconButton/index.js +40 -1
  121. package/lib/components/InlineCheckbox/InlineCheckbox.d.ts +50 -0
  122. package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -6
  123. package/lib/components/InlineCheckbox/index.d.ts +9 -0
  124. package/lib/components/LayoutDirection/LayoutDirection.d.ts +44 -0
  125. package/lib/components/LayoutDirection/LayoutDirectionContext.d.ts +10 -0
  126. package/lib/components/LayoutDirection/useLayoutDirection.d.ts +12 -0
  127. package/lib/components/Menu/MenuItem.js +0 -3
  128. package/lib/components/Modal/Modal.d.ts +5 -0
  129. package/lib/components/Modal/Modal.js +16 -10
  130. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  131. package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -2
  132. package/lib/components/MultiSelect/MultiSelect.js +1 -1
  133. package/lib/components/Notification/Notification.d.ts +9 -2
  134. package/lib/components/Notification/Notification.js +16 -2
  135. package/lib/components/NumberInput/NumberInput.d.ts +5 -0
  136. package/lib/components/NumberInput/NumberInput.js +17 -9
  137. package/lib/components/OverflowMenu/next/index.js +40 -1
  138. package/lib/components/Pagination/Pagination.js +1 -1
  139. package/lib/components/PaginationNav/PaginationNav.d.ts +1 -1
  140. package/lib/components/PaginationNav/PaginationNav.js +22 -5
  141. package/lib/components/RadioButton/RadioButton.d.ts +5 -0
  142. package/lib/components/RadioButton/RadioButton.js +16 -7
  143. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +5 -0
  144. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +16 -7
  145. package/lib/components/RadioTile/RadioTile.d.ts +5 -0
  146. package/lib/components/RadioTile/RadioTile.js +17 -8
  147. package/lib/components/Tabs/Tabs.js +46 -29
  148. package/lib/components/Tag/DismissibleTag.d.ts +11 -2
  149. package/lib/components/Tag/DismissibleTag.js +13 -5
  150. package/lib/components/Tag/Tag.d.ts +5 -0
  151. package/lib/components/Tag/Tag.js +14 -7
  152. package/lib/components/TextArea/TextArea.d.ts +5 -0
  153. package/lib/components/TextArea/TextArea.js +15 -7
  154. package/lib/components/TextInput/TextInput.d.ts +5 -0
  155. package/lib/components/TextInput/TextInput.js +15 -7
  156. package/lib/components/Tile/Tile.d.ts +21 -1
  157. package/lib/components/Tile/Tile.js +67 -47
  158. package/lib/components/UIShell/SideNavMenuItem.d.ts +5 -1
  159. package/lib/components/UIShell/SideNavMenuItem.js +7 -2
  160. package/package.json +5 -5
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import React__default, { useState, useRef, useEffect } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
- import { CheckboxCheckedFilled, Checkbox, ChevronDown, ArrowRight, Error } from '@carbon/icons-react';
12
+ import { AiLabel, CheckboxCheckedFilled, Checkbox, ChevronDown, ArrowRight, Error } from '@carbon/icons-react';
13
13
  import Link from '../Link/Link.js';
14
14
  import deprecate from '../../prop-types/deprecate.js';
15
15
  import { composeEventHandlers } from '../../tools/events.js';
@@ -24,11 +24,12 @@ import { Text } from '../Text/Text.js';
24
24
  import { matches } from '../../internal/keyboard/match.js';
25
25
  import { Enter, Space } from '../../internal/keyboard/keys.js';
26
26
 
27
- var _rect, _path, _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
27
+ var _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
28
28
  const Tile = /*#__PURE__*/React__default.forwardRef(function Tile(_ref, ref) {
29
29
  let {
30
30
  children,
31
31
  className,
32
+ decorator,
32
33
  light = false,
33
34
  slug,
34
35
  hasRoundedCorners = false,
@@ -38,12 +39,16 @@ const Tile = /*#__PURE__*/React__default.forwardRef(function Tile(_ref, ref) {
38
39
  const tileClasses = cx(`${prefix}--tile`, {
39
40
  [`${prefix}--tile--light`]: light,
40
41
  [`${prefix}--tile--slug`]: slug,
41
- [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
42
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners,
43
+ [`${prefix}--tile--decorator`]: decorator,
44
+ [`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
42
45
  }, className);
43
46
  return /*#__PURE__*/React__default.createElement("div", _extends({
44
47
  className: tileClasses,
45
48
  ref: ref
46
- }, rest), children, slug);
49
+ }, rest), children, slug, decorator && /*#__PURE__*/React__default.createElement("div", {
50
+ className: `${prefix}--tile--inner-decorator`
51
+ }, decorator));
47
52
  });
48
53
  Tile.displayName = 'Tile';
49
54
  Tile.propTypes = {
@@ -55,6 +60,10 @@ Tile.propTypes = {
55
60
  * The CSS class names.
56
61
  */
57
62
  className: PropTypes.string,
63
+ /**
64
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `Tile` component
65
+ */
66
+ decorator: PropTypes.node,
58
67
  /**
59
68
  * **Experimental**: Specify if the `Tile` component should be rendered with rounded corners. Only valid
60
69
  * when `slug` prop is present
@@ -70,13 +79,14 @@ Tile.propTypes = {
70
79
  /**
71
80
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Tile` component
72
81
  */
73
- slug: PropTypes.node
82
+ slug: deprecate(PropTypes.node, 'The `slug` prop for `Tile` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.')
74
83
  };
75
84
  const ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableTile(_ref2, ref) {
76
85
  let {
77
86
  children,
78
87
  className,
79
88
  clicked = false,
89
+ decorator,
80
90
  disabled,
81
91
  href,
82
92
  light,
@@ -92,7 +102,9 @@ const ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableT
92
102
  [`${prefix}--tile--is-clicked`]: clicked,
93
103
  [`${prefix}--tile--light`]: light,
94
104
  [`${prefix}--tile--slug`]: slug,
95
- [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
105
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners,
106
+ [`${prefix}--tile--decorator`]: decorator,
107
+ [`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
96
108
  }, className);
97
109
  const [isSelected, setIsSelected] = useState(clicked);
98
110
  function handleOnClick(evt) {
@@ -107,25 +119,6 @@ const ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableT
107
119
  }
108
120
  onKeyDown(evt);
109
121
  }
110
-
111
- // To Do: Replace with an an icon from `@carbon/react`
112
- // since the hollow slug in `ClickableTile` is not interactive
113
- const hollowSlugIcon = /*#__PURE__*/React__default.createElement("svg", {
114
- className: `${prefix}--tile--slug-icon`,
115
- width: "24",
116
- height: "24",
117
- viewBox: "0 0 24 24",
118
- fill: "none",
119
- xmlns: "http://www.w3.org/2000/svg"
120
- }, _rect || (_rect = /*#__PURE__*/React__default.createElement("rect", {
121
- x: "0.5",
122
- y: "0.5",
123
- width: "23",
124
- height: "23"
125
- })), _path || (_path = /*#__PURE__*/React__default.createElement("path", {
126
- d: "M13.2436 16H11.5996L10.9276 13.864H7.95164L7.29164 16H5.68364L8.49164 7.624H10.4596L13.2436 16ZM10.5436 12.508L9.46364 9.064H9.40364L8.33564 12.508H10.5436ZM17.9341 16H14.1301V14.728H15.2341V8.896H14.1301V7.624H17.9341V8.896H16.8181V14.728H17.9341V16Z",
127
- fill: "#161616"
128
- })));
129
122
  const v12DefaultIcons = useFeatureFlag('enable-v12-tile-default-icons');
130
123
  if (v12DefaultIcons) {
131
124
  if (!Icon) {
@@ -147,9 +140,14 @@ const ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableT
147
140
  onKeyDown: handleOnKeyDown,
148
141
  ref: ref,
149
142
  disabled: disabled
150
- }, rest), slug ? /*#__PURE__*/React__default.createElement("div", {
143
+ }, rest), slug || decorator ? /*#__PURE__*/React__default.createElement("div", {
151
144
  className: `${prefix}--tile-content`
152
- }, children) : children, slug && hollowSlugIcon, Icon && /*#__PURE__*/React__default.createElement(Icon, {
145
+ }, children) : children, (slug === true || decorator === true) && /*#__PURE__*/React__default.createElement(AiLabel, {
146
+ size: "24",
147
+ className: `${prefix}--tile--ai-label-icon`
148
+ }), /*#__PURE__*/React__default.isValidElement(decorator) && /*#__PURE__*/React__default.createElement("div", {
149
+ className: `${prefix}--tile--inner-decorator`
150
+ }, decorator), Icon && /*#__PURE__*/React__default.createElement(Icon, {
153
151
  className: iconClasses,
154
152
  "aria-hidden": "true"
155
153
  }));
@@ -168,6 +166,10 @@ ClickableTile.propTypes = {
168
166
  * Boolean for whether a tile has been clicked.
169
167
  */
170
168
  clicked: PropTypes.bool,
169
+ /**
170
+ * **Experimental**: Provide a `decorator` component or set the boolean to True for an AILabel icon to be rendered inside the `ClickableTile` component
171
+ */
172
+ decorator: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
171
173
  /**
172
174
  * Specify whether the ClickableTile should be disabled
173
175
  */
@@ -209,6 +211,7 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
209
211
  let {
210
212
  children,
211
213
  className,
214
+ decorator,
212
215
  disabled,
213
216
  id,
214
217
  light,
@@ -232,14 +235,16 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
232
235
  [`${prefix}--tile--light`]: light,
233
236
  [`${prefix}--tile--disabled`]: disabled,
234
237
  [`${prefix}--tile--slug`]: slug,
235
- [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
238
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners,
239
+ [`${prefix}--tile--decorator`]: decorator,
240
+ [`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
236
241
  }, className);
237
242
 
238
243
  // TODO: rename to handleClick when handleClick prop is deprecated
239
244
  function handleOnClick(evt) {
240
245
  evt.preventDefault();
241
246
  evt?.persist?.();
242
- if (slug && slugRef.current && slugRef.current.contains(evt.target)) {
247
+ if (normalizedDecorator && decoratorRef.current && decoratorRef.current.contains(evt.target)) {
243
248
  return;
244
249
  }
245
250
  setIsSelected(!isSelected);
@@ -266,13 +271,13 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
266
271
  setPrevSelected(selected);
267
272
  }
268
273
 
269
- // Slug is always size `xs`
270
- const slugRef = useRef(null);
271
- let normalizedSlug;
272
- if (slug && slug['type']?.displayName === 'AILabel') {
273
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
274
+ // AILabel is always size `xs`
275
+ const decoratorRef = useRef(null);
276
+ let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
277
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
278
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
274
279
  size: 'xs',
275
- ref: slugRef
280
+ ref: decoratorRef
276
281
  });
277
282
  }
278
283
  return (
@@ -297,12 +302,18 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
297
302
  as: "label",
298
303
  htmlFor: id,
299
304
  className: `${prefix}--tile-content`
300
- }, children), normalizedSlug)
305
+ }, children), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
306
+ className: `${prefix}--tile--inner-decorator`
307
+ }, normalizedDecorator) : '')
301
308
  );
302
309
  });
303
310
  SelectableTile.propTypes = {
304
311
  children: PropTypes.node,
305
312
  className: PropTypes.string,
313
+ /**
314
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `SelectableTile` component
315
+ */
316
+ decorator: PropTypes.node,
306
317
  /**
307
318
  * Specify whether the SelectableTile should be disabled
308
319
  */
@@ -325,7 +336,7 @@ SelectableTile.propTypes = {
325
336
  * The `name` of the `<input>`.
326
337
  * @deprecated
327
338
  */
328
- name: PropTypes.string,
339
+ name: deprecate(PropTypes.string, 'The `name` property is no longer used. It will be removed in the next major release.'),
329
340
  /**
330
341
  * The empty handler of the `<input>`.
331
342
  */
@@ -345,7 +356,7 @@ SelectableTile.propTypes = {
345
356
  /**
346
357
  * **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
347
358
  */
348
- slug: PropTypes.node,
359
+ slug: deprecate(PropTypes.node, 'The `slug` prop for `SelectableTile` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
349
360
  /**
350
361
  * Specify the tab index of the wrapper element
351
362
  */
@@ -358,13 +369,14 @@ SelectableTile.propTypes = {
358
369
  * The value of the `<input>`.
359
370
  * @deprecated
360
371
  */
361
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
372
+ value: deprecate(PropTypes.oneOfType([PropTypes.string, PropTypes.number]), 'The `value` property is no longer used. It will be removed in the next major release.`')
362
373
  };
363
374
  const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function ExpandableTile(_ref4, forwardRef) {
364
375
  let {
365
376
  tabIndex = 0,
366
377
  className,
367
378
  children,
379
+ decorator,
368
380
  expanded = false,
369
381
  tileMaxHeight = 0,
370
382
  // eslint-disable-line
@@ -439,7 +451,9 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
439
451
  [`${prefix}--tile--is-expanded`]: isExpanded,
440
452
  [`${prefix}--tile--light`]: light,
441
453
  [`${prefix}--tile--slug`]: slug,
442
- [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
454
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners,
455
+ [`${prefix}--tile--decorator`]: decorator,
456
+ [`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
443
457
  }, className);
444
458
  const chevronInteractiveClassNames = cx(`${prefix}--tile__chevron`, `${prefix}--tile__chevron--interactive`);
445
459
  const childrenAsArray = getChildren();
@@ -466,10 +480,10 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
466
480
 
467
481
  // Interactive elements or elements that are given a role should be treated
468
482
  // the same because elements with a role can not be rendered inside a `button`
469
- if (!getInteractiveContent(belowTheFold.current) && !getRoleContent(belowTheFold.current) && !getInteractiveContent(aboveTheFold.current) && !getRoleContent(aboveTheFold.current) && !slug) {
483
+ if (!getInteractiveContent(belowTheFold.current) && !getRoleContent(belowTheFold.current) && !getInteractiveContent(aboveTheFold.current) && !getRoleContent(aboveTheFold.current) && !(slug || decorator)) {
470
484
  setInteractive(false);
471
485
  }
472
- }, [slug]);
486
+ }, [slug, decorator]);
473
487
  useIsomorphicEffect(() => {
474
488
  if (!tile.current) {
475
489
  return;
@@ -493,10 +507,10 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
493
507
  }, []);
494
508
  const belowTheFoldId = useId('expandable-tile-interactive');
495
509
 
496
- // Slug is always size `xs`
497
- let normalizedSlug;
498
- if (slug && slug['type']?.displayName === 'AILabel') {
499
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
510
+ // AILabel is always size `xs`
511
+ let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
512
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
513
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
500
514
  size: 'xs'
501
515
  });
502
516
  }
@@ -506,7 +520,9 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
506
520
  className: interactiveClassNames
507
521
  }, rest), /*#__PURE__*/React__default.createElement("div", {
508
522
  ref: tileContent
509
- }, normalizedSlug, /*#__PURE__*/React__default.createElement("div", {
523
+ }, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
524
+ className: `${prefix}--tile--inner-decorator`
525
+ }, normalizedDecorator) : '', /*#__PURE__*/React__default.createElement("div", {
510
526
  ref: aboveTheFold,
511
527
  className: `${prefix}--tile-content`
512
528
  }, childrenAsArray[0]), /*#__PURE__*/React__default.createElement("button", {
@@ -549,6 +565,10 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
549
565
  ExpandableTile.propTypes = {
550
566
  children: PropTypes.node,
551
567
  className: PropTypes.string,
568
+ /**
569
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `ExpandableTile` component
570
+ */
571
+ decorator: PropTypes.node,
552
572
  /**
553
573
  * `true` if the tile is expanded.
554
574
  */
@@ -578,7 +598,7 @@ ExpandableTile.propTypes = {
578
598
  /**
579
599
  * **Experimental**: Provide a `Slug` component to be rendered inside the `ExpandableTile` component
580
600
  */
581
- slug: PropTypes.node,
601
+ slug: deprecate(PropTypes.node, 'The `slug` prop for `ExpandableTile` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
582
602
  /**
583
603
  * The `tabindex` attribute.
584
604
  */
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { ComponentProps } from 'react';
7
+ import React, { ElementType, ComponentProps } from 'react';
8
8
  import Link from './Link';
9
9
  interface SideNavMenuItemProps extends ComponentProps<typeof Link> {
10
10
  /**
@@ -25,6 +25,10 @@ interface SideNavMenuItemProps extends ComponentProps<typeof Link> {
25
25
  * Optionally provide an href for the underlying li`
26
26
  */
27
27
  href?: string;
28
+ /**
29
+ * Optional component to render instead of default Link
30
+ */
31
+ as?: ElementType;
28
32
  }
29
33
  declare const SideNavMenuItem: React.ForwardRefExoticComponent<Omit<SideNavMenuItemProps, "ref"> & React.RefAttributes<HTMLElement>>;
30
34
  export default SideNavMenuItem;
@@ -18,6 +18,7 @@ const SideNavMenuItem = /*#__PURE__*/React__default.forwardRef(function SideNavM
18
18
  const {
19
19
  children,
20
20
  className: customClassName,
21
+ as: Component = Link,
21
22
  isActive,
22
23
  ...rest
23
24
  } = props;
@@ -28,7 +29,7 @@ const SideNavMenuItem = /*#__PURE__*/React__default.forwardRef(function SideNavM
28
29
  });
29
30
  return /*#__PURE__*/React__default.createElement("li", {
30
31
  className: className
31
- }, /*#__PURE__*/React__default.createElement(Link, _extends({}, rest, {
32
+ }, /*#__PURE__*/React__default.createElement(Component, _extends({}, rest, {
32
33
  className: linkClassName,
33
34
  ref: ref
34
35
  }), /*#__PURE__*/React__default.createElement(SideNavLinkText, null, children)));
@@ -52,7 +53,11 @@ SideNavMenuItem.propTypes = {
52
53
  * has an href that is the same as the current page. Can also pass in
53
54
  * `aria-current="page"`, as well.
54
55
  */
55
- isActive: PropTypes.bool
56
+ isActive: PropTypes.bool,
57
+ /**
58
+ * Optional component to render instead of default Link
59
+ */
60
+ as: PropTypes.elementType
56
61
  };
57
62
 
58
63
  export { SideNavMenuItem as default };
@@ -41,8 +41,8 @@ const AILabelContent = /*#__PURE__*/React__default["default"].forwardRef(functio
41
41
  item.type?.displayName === 'AILabelActions';
42
42
  });
43
43
  const aiLabelContentClasses = cx__default["default"](className, {
44
- [`${prefix}--slug-content`]: true,
45
- [`${prefix}--slug-content--with-actions`]: hasAILabelActions
44
+ [`${prefix}--ai-label-content`]: true,
45
+ [`${prefix}--ai-label-content--with-actions`]: hasAILabelActions
46
46
  });
47
47
  return /*#__PURE__*/React__default["default"].createElement(index.ToggletipContent, {
48
48
  className: aiLabelContentClasses
@@ -51,11 +51,11 @@ const AILabelContent = /*#__PURE__*/React__default["default"].forwardRef(functio
51
51
  AILabelContent.displayName = 'AILabelContent';
52
52
  AILabelContent.propTypes = {
53
53
  /**
54
- * Specify the content you want rendered inside the slug ToggleTip
54
+ * Specify the content you want rendered inside the AILabel ToggleTip
55
55
  */
56
56
  children: PropTypes__default["default"].node,
57
57
  /**
58
- * Specify an optional className to be added to the AI slug callout
58
+ * Specify an optional className to be added to the AILabel callout
59
59
  */
60
60
  className: PropTypes__default["default"].string
61
61
  };
@@ -67,7 +67,7 @@ const AILabelActions = /*#__PURE__*/React__default["default"].forwardRef(functio
67
67
  } = _ref2;
68
68
  const prefix = usePrefix.usePrefix();
69
69
  const aiLabelActionsClasses = cx__default["default"](className, {
70
- [`${prefix}--slug-actions`]: true
70
+ [`${prefix}--ai-label-actions`]: true
71
71
  });
72
72
  return /*#__PURE__*/React__default["default"].createElement(index.ToggletipActions, {
73
73
  className: aiLabelActionsClasses
@@ -76,11 +76,11 @@ const AILabelActions = /*#__PURE__*/React__default["default"].forwardRef(functio
76
76
  AILabelActions.displayName = 'AILabelActions';
77
77
  AILabelActions.propTypes = {
78
78
  /**
79
- * Specify the content you want rendered inside the slug callout toolbar
79
+ * Specify the content you want rendered inside the AILabel callout toolbar
80
80
  */
81
81
  children: PropTypes__default["default"].node,
82
82
  /**
83
- * Specify an optional className to be added to the AI slug toolbar
83
+ * Specify an optional className to be added to the AILabel toolbar
84
84
  */
85
85
  className: PropTypes__default["default"].string
86
86
  };
@@ -114,14 +114,14 @@ const AILabel = /*#__PURE__*/React__default["default"].forwardRef(function AILab
114
114
  const prefix = usePrefix.usePrefix();
115
115
  const id = useId.useId('AILabel');
116
116
  const aiLabelClasses = cx__default["default"](className, {
117
- [`${prefix}--slug`]: true,
118
- [`${prefix}--slug--revert`]: revertActive
117
+ [`${prefix}--ai-label`]: true,
118
+ [`${prefix}--ai-label--revert`]: revertActive
119
119
  });
120
120
  const aiLabelButtonClasses = cx__default["default"]({
121
- [`${prefix}--slug__button`]: true,
122
- [`${prefix}--slug__button--${size}`]: size,
123
- [`${prefix}--slug__button--${kind}`]: kind,
124
- [`${prefix}--slug__button--inline-with-content`]: kind === 'inline' && (aiTextLabel || textLabel)
121
+ [`${prefix}--ai-label__button`]: true,
122
+ [`${prefix}--ai-label__button--${size}`]: size,
123
+ [`${prefix}--ai-label__button--${kind}`]: kind,
124
+ [`${prefix}--ai-label__button--inline-with-content`]: kind === 'inline' && (aiTextLabel || textLabel)
125
125
  });
126
126
  const handleOnRevertClick = evt => {
127
127
  if (onRevertClick) {
@@ -145,9 +145,9 @@ const AILabel = /*#__PURE__*/React__default["default"].forwardRef(function AILab
145
145
  className: aiLabelButtonClasses,
146
146
  label: ariaLabelText
147
147
  }, /*#__PURE__*/React__default["default"].createElement("span", {
148
- className: `${prefix}--slug__text`
148
+ className: `${prefix}--ai-label__text`
149
149
  }, aiText), kind === 'inline' && (aiTextLabel || textLabel) && /*#__PURE__*/React__default["default"].createElement("span", {
150
- className: `${prefix}--slug__additional-text`
150
+ className: `${prefix}--ai-label__additional-text`
151
151
  }, aiTextLabel || textLabel)), children));
152
152
  });
153
153
  AILabel.displayName = 'AILabel';
@@ -16,6 +16,10 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
16
16
  * exposing to the user
17
17
  */
18
18
  labelText: NonNullable<ReactNode>;
19
+ /**
20
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `Checkbox` component
21
+ */
22
+ decorator?: ReactNode;
19
23
  /**
20
24
  * Specify whether the underlying input should be checked by default
21
25
  */
@@ -45,6 +49,7 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
45
49
  */
46
50
  invalidText?: ReactNode;
47
51
  /**
52
+ * @deprecated please use decorator instead.
48
53
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
49
54
  */
50
55
  slug?: ReactNode;
@@ -14,6 +14,7 @@ var PropTypes = require('prop-types');
14
14
  var React = require('react');
15
15
  var cx = require('classnames');
16
16
  require('../Text/index.js');
17
+ var deprecate = require('../../prop-types/deprecate.js');
17
18
  var usePrefix = require('../../internal/usePrefix.js');
18
19
  var iconsReact = require('@carbon/icons-react');
19
20
  var useId = require('../../internal/useId.js');
@@ -29,6 +30,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
29
30
  const Checkbox = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
30
31
  let {
31
32
  className,
33
+ decorator,
32
34
  helperText,
33
35
  id,
34
36
  labelText,
@@ -58,15 +60,16 @@ const Checkbox = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
58
60
  [`${prefix}--checkbox-wrapper--readonly`]: readOnly,
59
61
  [`${prefix}--checkbox-wrapper--invalid`]: !readOnly && invalid,
60
62
  [`${prefix}--checkbox-wrapper--warning`]: showWarning,
61
- [`${prefix}--checkbox-wrapper--slug`]: slug
63
+ [`${prefix}--checkbox-wrapper--slug`]: slug,
64
+ [`${prefix}--checkbox-wrapper--decorator`]: decorator
62
65
  });
63
66
  const innerLabelClasses = cx__default["default"](`${prefix}--checkbox-label-text`, {
64
67
  [`${prefix}--visually-hidden`]: hideLabel
65
68
  });
66
- let normalizedSlug;
67
- if (slug && /*#__PURE__*/React__default["default"].isValidElement(slug)) {
68
- const size = slug.props?.['kind'] === 'inline' ? 'md' : 'mini';
69
- normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
69
+ let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
70
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
71
+ const size = normalizedDecorator.props?.['kind'] === 'inline' ? 'md' : 'mini';
72
+ normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
70
73
  size
71
74
  });
72
75
  }
@@ -115,7 +118,9 @@ const Checkbox = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
115
118
  title: title
116
119
  }, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
117
120
  className: innerLabelClasses
118
- }, labelText, normalizedSlug)), /*#__PURE__*/React__default["default"].createElement("div", {
121
+ }, labelText, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
122
+ className: `${prefix}--checkbox-wrapper-inner--decorator`
123
+ }, normalizedDecorator) : '')), /*#__PURE__*/React__default["default"].createElement("div", {
119
124
  className: `${prefix}--checkbox__validation-msg`
120
125
  }, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
121
126
  className: `${prefix}--checkbox__invalid-icon`
@@ -136,6 +141,10 @@ Checkbox.propTypes = {
136
141
  * Specify an optional className to be applied to the <label> node
137
142
  */
138
143
  className: PropTypes__default["default"].string,
144
+ /**
145
+ * **Experimental**: Provide a decorator component to be rendered inside the `Checkbox` component
146
+ */
147
+ decorator: PropTypes__default["default"].node,
139
148
  /**
140
149
  * Specify whether the underlying input should be checked by default
141
150
  */
@@ -186,7 +195,7 @@ Checkbox.propTypes = {
186
195
  /**
187
196
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
188
197
  */
189
- slug: PropTypes__default["default"].node,
198
+ slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
190
199
  /**
191
200
  * Specify a title for the <label> node for the Checkbox
192
201
  */
@@ -8,6 +8,7 @@ import React, { ReactNode } from 'react';
8
8
  export interface CheckboxGroupProps {
9
9
  children?: ReactNode;
10
10
  className?: string;
11
+ decorator?: ReactNode;
11
12
  helperText?: ReactNode;
12
13
  invalid?: boolean;
13
14
  invalidText?: ReactNode;
@@ -15,6 +16,10 @@ export interface CheckboxGroupProps {
15
16
  orientation?: 'horizontal' | 'vertical';
16
17
  legendText: ReactNode;
17
18
  readOnly?: boolean;
19
+ /**
20
+ * * @deprecated please use decorator instead.
21
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
22
+ */
18
23
  slug?: ReactNode;
19
24
  warn?: boolean;
20
25
  warnText?: ReactNode;
@@ -13,6 +13,7 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
13
13
  var PropTypes = require('prop-types');
14
14
  var React = require('react');
15
15
  var cx = require('classnames');
16
+ var deprecate = require('../../prop-types/deprecate.js');
16
17
  var usePrefix = require('../../internal/usePrefix.js');
17
18
  var iconsReact = require('@carbon/icons-react');
18
19
  var useId = require('../../internal/useId.js');
@@ -27,6 +28,7 @@ const CheckboxGroup = _ref => {
27
28
  let {
28
29
  children,
29
30
  className,
31
+ decorator,
30
32
  helperText,
31
33
  invalid,
32
34
  invalidText,
@@ -53,13 +55,14 @@ const CheckboxGroup = _ref => {
53
55
  [`${prefix}--checkbox-group--readonly`]: readOnly,
54
56
  [`${prefix}--checkbox-group--invalid`]: !readOnly && invalid,
55
57
  [`${prefix}--checkbox-group--warning`]: showWarning,
56
- [`${prefix}--checkbox-group--slug`]: slug
58
+ [`${prefix}--checkbox-group--slug`]: slug,
59
+ [`${prefix}--checkbox-group--decorator`]: decorator
57
60
  });
58
61
 
59
- // Slug is always size `mini`
60
- let normalizedSlug;
61
- if (/*#__PURE__*/React__default["default"].isValidElement(slug) && slug['type']?.displayName === 'AILabel') {
62
- normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
62
+ // AILabel always size `mini`
63
+ let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
64
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
65
+ normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
63
66
  size: 'mini',
64
67
  kind: 'default'
65
68
  });
@@ -73,7 +76,9 @@ const CheckboxGroup = _ref => {
73
76
  }, rest), /*#__PURE__*/React__default["default"].createElement("legend", {
74
77
  className: `${prefix}--label`,
75
78
  id: legendId || rest['aria-labelledby']
76
- }, legendText, normalizedSlug), children, /*#__PURE__*/React__default["default"].createElement("div", {
79
+ }, legendText, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
80
+ className: `${prefix}--checkbox-group-inner--decorator`
81
+ }, normalizedDecorator) : ''), children, /*#__PURE__*/React__default["default"].createElement("div", {
77
82
  className: `${prefix}--checkbox-group__validation-msg`
78
83
  }, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
79
84
  className: `${prefix}--checkbox__invalid-icon`
@@ -94,6 +99,10 @@ CheckboxGroup.propTypes = {
94
99
  * Provide a custom className to be applied to the containing <fieldset> node
95
100
  */
96
101
  className: PropTypes__default["default"].string,
102
+ /**
103
+ * **Experimental**: Provide a decorator component to be rendered inside the `CheckboxGroup` component
104
+ */
105
+ decorator: PropTypes__default["default"].node,
97
106
  /**
98
107
  * Provide text for the form group for additional help
99
108
  */
@@ -126,7 +135,7 @@ CheckboxGroup.propTypes = {
126
135
  /**
127
136
  * **Experimental**: Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
128
137
  */
129
- slug: PropTypes__default["default"].node,
138
+ slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
130
139
  /**
131
140
  * Specify whether the form group is currently in warning state
132
141
  */
@@ -6,11 +6,14 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import { PropsWithChildren } from 'react';
9
+ export type DeprecatedCodeSnippetAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
10
+ export type NewCodeSnippetAlignmnet = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
11
+ export type CodeSnippetAlignment = DeprecatedCodeSnippetAlignment | NewCodeSnippetAlignmnet;
9
12
  export interface CodeSnippetProps {
10
13
  /**
11
14
  * Specify how the trigger should align with the tooltip
12
15
  */
13
- align?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
16
+ align?: CodeSnippetAlignment;
14
17
  /**
15
18
  * **Experimental**: Will attempt to automatically align the tooltip
16
19
  */
@@ -106,7 +109,7 @@ declare namespace CodeSnippet {
106
109
  /**
107
110
  * Specify how the trigger should align with the tooltip
108
111
  */
109
- align: PropTypes.Requireable<string>;
112
+ align: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
110
113
  /**
111
114
  * Specify a label to be read by screen readers on the containing textbox
112
115
  * node