@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
@@ -23,6 +23,7 @@ var uniqueId = require('../../tools/uniqueId.js');
23
23
  var copy = require('copy-to-clipboard');
24
24
  var deprecate = require('../../prop-types/deprecate.js');
25
25
  var usePrefix = require('../../internal/usePrefix.js');
26
+ var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
26
27
 
27
28
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
28
29
 
@@ -37,6 +38,19 @@ const defaultMaxCollapsedNumberOfRows = 15;
37
38
  const defaultMaxExpandedNumberOfRows = 0;
38
39
  const defaultMinCollapsedNumberOfRows = 3;
39
40
  const defaultMinExpandedNumberOfRows = 16;
41
+ const propMappingFunction = deprecatedValue => {
42
+ const mapping = {
43
+ 'top-left': 'top-start',
44
+ 'top-right': 'top-end',
45
+ 'bottom-left': 'bottom-start',
46
+ 'bottom-right': 'bottom-end',
47
+ 'left-bottom': 'left-end',
48
+ 'left-top': 'left-start',
49
+ 'right-bottom': 'right-end',
50
+ 'right-top': 'right-start'
51
+ };
52
+ return mapping[deprecatedValue];
53
+ };
40
54
  function CodeSnippet(_ref) {
41
55
  let {
42
56
  align = 'bottom',
@@ -244,7 +258,32 @@ CodeSnippet.propTypes = {
244
258
  /**
245
259
  * Specify how the trigger should align with the tooltip
246
260
  */
247
- align: PropTypes__default["default"].oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
261
+ align: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
262
+ // deprecated use top-start instead
263
+ 'top-right',
264
+ // deprecated use top-end instead
265
+
266
+ 'bottom', 'bottom-left',
267
+ // deprecated use bottom-start instead
268
+ 'bottom-right',
269
+ // deprecated use bottom-end instead
270
+
271
+ 'left', 'left-bottom',
272
+ // deprecated use left-end instead
273
+ 'left-top',
274
+ // deprecated use left-start instead
275
+
276
+ 'right', 'right-bottom',
277
+ // deprecated use right-end instead
278
+ 'right-top',
279
+ // deprecated use right-start instead
280
+
281
+ // new values to match floating-ui
282
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
283
+ //allowed prop values
284
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
285
+ //optional mapper function
286
+ propMappingFunction),
248
287
  /**
249
288
  * Specify a label to be read by screen readers on the containing textbox
250
289
  * node
@@ -147,7 +147,7 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
147
147
  */
148
148
  placeholder?: string;
149
149
  /**
150
- * Is the ComboBox readonly?
150
+ * Whether or not the component is read-only
151
151
  */
152
152
  readOnly?: boolean;
153
153
  /**
@@ -237,7 +237,6 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
237
237
  selectedItem: selectedItemProp,
238
238
  prevSelectedItem: prevSelectedItemProp.current
239
239
  });
240
-
241
240
  // selectedItem has been updated externally, need to update state and call onChange
242
241
  if (inputValue !== currentInputValue) {
243
242
  setInputValue(currentInputValue);
@@ -446,30 +445,12 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
446
445
  } = _ref4;
447
446
  const normalizedInput = inputValue || '';
448
447
  setInputValue(normalizedInput);
449
- if (selectedItemProp && !inputValue) {
450
- // ensure onChange is called when selectedItem is cleared
451
- onChange({
452
- selectedItem,
453
- inputValue: normalizedInput
454
- });
455
- }
456
448
  setHighlightedIndex(indexToHighlight(normalizedInput));
457
449
  },
458
- onSelectedItemChange(_ref5) {
459
- let {
460
- selectedItem
461
- } = _ref5;
462
- // only call onChange if new selection is updated from previous
463
- if (!isEqual__default["default"](selectedItem, selectedItemProp)) {
464
- onChange({
465
- selectedItem
466
- });
467
- }
468
- },
469
- onHighlightedIndexChange: _ref6 => {
450
+ onHighlightedIndexChange: _ref5 => {
470
451
  let {
471
452
  highlightedIndex
472
- } = _ref6;
453
+ } = _ref5;
473
454
  if (highlightedIndex > -1 && typeof window !== undefined) {
474
455
  const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
475
456
  const highlightedItem = itemArray[highlightedIndex];
@@ -481,11 +462,27 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
481
462
  }
482
463
  }
483
464
  },
465
+ onStateChange: _ref6 => {
466
+ let {
467
+ type,
468
+ selectedItem: newSelectedItem
469
+ } = _ref6;
470
+ if (type === '__item_click__' && !isEqual__default["default"](selectedItemProp, newSelectedItem)) {
471
+ onChange({
472
+ selectedItem: newSelectedItem
473
+ });
474
+ }
475
+ if (type === '__function_select_item__' || type === '__input_keydown_enter__') {
476
+ onChange({
477
+ selectedItem: newSelectedItem
478
+ });
479
+ }
480
+ },
484
481
  initialSelectedItem: initialSelectedItem,
485
482
  inputId: id,
486
483
  stateReducer,
487
484
  isItemDisabled(item, _index) {
488
- return item.disabled;
485
+ return item?.disabled;
489
486
  },
490
487
  ...downshiftProps
491
488
  });
@@ -26,6 +26,7 @@ var react = require('@floating-ui/react');
26
26
  var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js');
27
27
  var index = require('../FeatureFlags/index.js');
28
28
  var mergeRefs = require('../../tools/mergeRefs.js');
29
+ var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
29
30
 
30
31
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
31
32
 
@@ -42,6 +43,19 @@ const defaultTranslations = {
42
43
  * Message ids that will be passed to translateWithId().
43
44
  */
44
45
 
46
+ const propMappingFunction = deprecatedValue => {
47
+ const mapping = {
48
+ 'top-left': 'top-start',
49
+ 'top-right': 'top-end',
50
+ 'bottom-left': 'bottom-start',
51
+ 'bottom-right': 'bottom-end',
52
+ 'left-bottom': 'left-end',
53
+ 'left-top': 'left-start',
54
+ 'right-bottom': 'right-end',
55
+ 'right-top': 'right-start'
56
+ };
57
+ return mapping[deprecatedValue];
58
+ };
45
59
  function defaultTranslateWithId(messageId) {
46
60
  return defaultTranslations[messageId];
47
61
  }
@@ -201,7 +215,32 @@ ComboButton.propTypes = {
201
215
  /**
202
216
  * Specify how the trigger tooltip should be aligned.
203
217
  */
204
- tooltipAlignment: PropTypes__default["default"].oneOf(['top', 'top-left', 'top-start', 'top-right', 'top-end', 'bottom', 'bottom-left', 'bottom-start', 'bottom-right', 'bottom-end', 'left', 'right']),
218
+ tooltipAlignment: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
219
+ // deprecated use top-start instead
220
+ 'top-right',
221
+ // deprecated use top-end instead
222
+
223
+ 'bottom', 'bottom-left',
224
+ // deprecated use bottom-start instead
225
+ 'bottom-right',
226
+ // deprecated use bottom-end instead
227
+
228
+ 'left', 'left-bottom',
229
+ // deprecated use left-end instead
230
+ 'left-top',
231
+ // deprecated use left-start instead
232
+
233
+ 'right', 'right-bottom',
234
+ // deprecated use right-end instead
235
+ 'right-top',
236
+ // deprecated use right-start instead
237
+
238
+ // new values to match floating-ui
239
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
240
+ //allowed prop values
241
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
242
+ //optional mapper function
243
+ propMappingFunction),
205
244
  /**
206
245
  * Optional method that takes in a message id and returns an
207
246
  * internationalized string.
@@ -39,6 +39,10 @@ export interface ComposedModalProps extends HTMLAttributes<HTMLDivElement> {
39
39
  * Note that this prop is not applied if you render primary/danger button by yourself
40
40
  */
41
41
  danger?: boolean;
42
+ /**
43
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `ComposedModal` component
44
+ */
45
+ decorator?: ReactNode;
42
46
  /**
43
47
  * Specify whether the Modal content should have any inner padding.
44
48
  */
@@ -70,6 +74,7 @@ export interface ComposedModalProps extends HTMLAttributes<HTMLDivElement> {
70
74
  selectorsFloatingMenus?: string[];
71
75
  size?: 'xs' | 'sm' | 'md' | 'lg';
72
76
  /**
77
+ * @deprecated please use `decorator` instead.
73
78
  * **Experimental**: Provide a `Slug` component to be rendered inside the `ComposedModal` component
74
79
  */
75
80
  slug?: ReactNode;
@@ -26,6 +26,7 @@ var wrapFocus = require('../../internal/wrapFocus.js');
26
26
  var usePrefix = require('../../internal/usePrefix.js');
27
27
  var index$1 = require('../FeatureFlags/index.js');
28
28
  var events = require('../../tools/events.js');
29
+ var deprecate = require('../../prop-types/deprecate.js');
29
30
  var match = require('../../internal/keyboard/match.js');
30
31
  var keys = require('../../internal/keyboard/keys.js');
31
32
 
@@ -109,6 +110,7 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
109
110
  className: customClassName,
110
111
  containerClassName,
111
112
  danger,
113
+ decorator,
112
114
  isFullWidth,
113
115
  onClose,
114
116
  onKeyDown,
@@ -200,7 +202,8 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
200
202
  const modalClass = cx__default["default"](`${prefix}--modal`, {
201
203
  'is-visible': isOpen,
202
204
  [`${prefix}--modal--danger`]: danger,
203
- [`${prefix}--modal--slug`]: slug
205
+ [`${prefix}--modal--slug`]: slug,
206
+ [`${prefix}--modal--decorator`]: decorator
204
207
  }, customClassName);
205
208
  const containerClass = cx__default["default"](`${prefix}--modal-container`, size && `${prefix}--modal-container--${size}`, isFullWidth && `${prefix}--modal-container--full-width`, containerClassName);
206
209
 
@@ -259,10 +262,10 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
259
262
  }
260
263
  }, [open, selectorPrimaryFocus, isOpen]);
261
264
 
262
- // Slug is always size `sm`
263
- let normalizedSlug;
264
- if (slug && slug['type']?.displayName === 'AILabel') {
265
- normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
265
+ // AILabel is always size `sm`
266
+ let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
267
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
268
+ normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
266
269
  size: 'sm'
267
270
  });
268
271
  }
@@ -288,7 +291,9 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
288
291
  }, "Focus sentinel"), /*#__PURE__*/React__default["default"].createElement("div", {
289
292
  ref: innerModal,
290
293
  className: `${prefix}--modal-container-body`
291
- }, normalizedSlug, childrenWithProps), !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("button", {
294
+ }, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
295
+ className: `${prefix}--modal--inner__decorator`
296
+ }, normalizedDecorator) : '', childrenWithProps), !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("button", {
292
297
  type: "button",
293
298
  ref: endSentinel,
294
299
  className: `${prefix}--visually-hidden`
@@ -320,6 +325,10 @@ ComposedModal.propTypes = {
320
325
  * Note that this prop is not applied if you render primary/danger button by yourself
321
326
  */
322
327
  danger: PropTypes__default["default"].bool,
328
+ /**
329
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `ComposedModal` component
330
+ */
331
+ decorator: PropTypes__default["default"].node,
323
332
  /**
324
333
  * Specify whether the Modal content should have any inner padding.
325
334
  */
@@ -359,10 +368,7 @@ ComposedModal.propTypes = {
359
368
  * Specify the size variant.
360
369
  */
361
370
  size: PropTypes__default["default"].oneOf(['xs', 'sm', 'md', 'lg']),
362
- /**
363
- * **Experimental**: Provide a `Slug` component to be rendered inside the `ComposedModal` component
364
- */
365
- slug: PropTypes__default["default"].node
371
+ slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop for `ComposedModal` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.')
366
372
  };
367
373
 
368
374
  exports.ModalBody = ModalBody;
@@ -38,7 +38,7 @@ export interface ContentSwitcherProps extends Omit<HTMLAttributes<HTMLElement>,
38
38
  */
39
39
  selectedIndex: number;
40
40
  /**
41
- * Choose whether or not to automatically change selection on focus
41
+ * Choose whether or not to automatically change selection on focus when left/right arrow pressed. Defaults to 'automatic'
42
42
  */
43
43
  selectionMode?: 'automatic' | 'manual';
44
44
  /**
@@ -82,7 +82,7 @@ export default class ContentSwitcher extends React.Component<ContentSwitcherProp
82
82
  */
83
83
  selectedIndex: PropTypes.Requireable<number>;
84
84
  /**
85
- * Choose whether or not to automatically change selection on focus
85
+ * Choose whether or not to automatically change selection on focus when left/right arrow pressed. Defaults to 'automatic'
86
86
  */
87
87
  selectionMode: PropTypes.Requireable<string>;
88
88
  /**
@@ -173,7 +173,7 @@ _rollupPluginBabelHelpers.defineProperty(ContentSwitcher, "propTypes", {
173
173
  */
174
174
  selectedIndex: PropTypes__default["default"].number,
175
175
  /**
176
- * Choose whether or not to automatically change selection on focus
176
+ * Choose whether or not to automatically change selection on focus when left/right arrow pressed. Defaults to 'automatic'
177
177
  */
178
178
  selectionMode: PropTypes__default["default"].oneOf(['automatic', 'manual']),
179
179
  /**
@@ -6,11 +6,14 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import React, { AnimationEventHandler, MouseEventHandler, PropsWithChildren } from 'react';
9
+ export type DeprecatedCopyAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
10
+ export type NewCopyAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
11
+ export type CopyAlignment = DeprecatedCopyAlignment | NewCopyAlignment;
9
12
  interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
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?: CopyAlignment;
14
17
  /**
15
18
  * **Experimental**: Will attempt to automatically align the tooltip
16
19
  */
@@ -45,7 +48,7 @@ declare namespace Copy {
45
48
  /**
46
49
  * Specify how the trigger should align with the tooltip
47
50
  */
48
- align: PropTypes.Requireable<string>;
51
+ align: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
49
52
  /**
50
53
  * **Experimental**: Will attempt to automatically align the tooltip
51
54
  */
@@ -18,6 +18,7 @@ var events = require('../../tools/events.js');
18
18
  var usePrefix = require('../../internal/usePrefix.js');
19
19
  var index = require('../IconButton/index.js');
20
20
  var noopFn = require('../../internal/noopFn.js');
21
+ var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
21
22
 
22
23
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
23
24
 
@@ -26,6 +27,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
27
  var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
27
28
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
28
29
 
30
+ const propMappingFunction = deprecatedValue => {
31
+ const mapping = {
32
+ 'top-left': 'top-start',
33
+ 'top-right': 'top-end',
34
+ 'bottom-left': 'bottom-start',
35
+ 'bottom-right': 'bottom-end',
36
+ 'left-bottom': 'left-end',
37
+ 'left-top': 'left-start',
38
+ 'right-bottom': 'right-end',
39
+ 'right-top': 'right-start'
40
+ };
41
+ return mapping[deprecatedValue];
42
+ };
29
43
  function Copy(_ref) {
30
44
  let {
31
45
  align = 'bottom',
@@ -77,7 +91,32 @@ Copy.propTypes = {
77
91
  /**
78
92
  * Specify how the trigger should align with the tooltip
79
93
  */
80
- align: PropTypes__default["default"].oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
94
+ align: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
95
+ // deprecated use top-start instead
96
+ 'top-right',
97
+ // deprecated use top-end instead
98
+
99
+ 'bottom', 'bottom-left',
100
+ // deprecated use bottom-start instead
101
+ 'bottom-right',
102
+ // deprecated use bottom-end instead
103
+
104
+ 'left', 'left-bottom',
105
+ // deprecated use left-end instead
106
+ 'left-top',
107
+ // deprecated use left-start instead
108
+
109
+ 'right', 'right-bottom',
110
+ // deprecated use right-end instead
111
+ 'right-top',
112
+ // deprecated use right-start instead
113
+
114
+ // new values to match floating-ui
115
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
116
+ //allowed prop values
117
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
118
+ //optional mapper function
119
+ propMappingFunction),
81
120
  /**
82
121
  * **Experimental**: Will attempt to automatically align the tooltip
83
122
  */
@@ -7,11 +7,14 @@
7
7
  import PropTypes from 'prop-types';
8
8
  import { MouseEventHandler } from 'react';
9
9
  import { ButtonProps } from '../Button';
10
+ export type DeprecatedCopyButtonAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
11
+ export type NewCopyButtonAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
12
+ export type CopyButtonAlignment = DeprecatedCopyButtonAlignment | NewCopyButtonAlignment;
10
13
  export interface CopyButtonProps extends ButtonProps<'button'> {
11
14
  /**
12
15
  * Specify how the trigger should align with the tooltip
13
16
  */
14
- align?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
17
+ align?: CopyButtonAlignment;
15
18
  /**
16
19
  * **Experimental**: Will attempt to automatically align the tooltip
17
20
  */
@@ -46,7 +49,7 @@ declare namespace CopyButton {
46
49
  /**
47
50
  * Specify how the trigger should align with the tooltip
48
51
  */
49
- align: PropTypes.Requireable<string>;
52
+ align: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
50
53
  /**
51
54
  * **Experimental**: Will attempt to automatically align the tooltip
52
55
  */
@@ -18,6 +18,7 @@ var Copy = require('../Copy/Copy.js');
18
18
  var index = require('../Layout/index.js');
19
19
  var usePrefix = require('../../internal/usePrefix.js');
20
20
  var noopFn = require('../../internal/noopFn.js');
21
+ var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
21
22
 
22
23
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
23
24
 
@@ -25,6 +26,19 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
25
26
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
27
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
27
28
 
29
+ const propMappingFunction = deprecatedValue => {
30
+ const mapping = {
31
+ 'top-left': 'top-start',
32
+ 'top-right': 'top-end',
33
+ 'bottom-left': 'bottom-start',
34
+ 'bottom-right': 'bottom-end',
35
+ 'left-bottom': 'left-end',
36
+ 'left-top': 'left-start',
37
+ 'right-bottom': 'right-end',
38
+ 'right-top': 'right-start'
39
+ };
40
+ return mapping[deprecatedValue];
41
+ };
28
42
  function CopyButton(_ref) {
29
43
  let {
30
44
  align = 'bottom',
@@ -58,7 +72,32 @@ CopyButton.propTypes = {
58
72
  /**
59
73
  * Specify how the trigger should align with the tooltip
60
74
  */
61
- align: PropTypes__default["default"].oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
75
+ align: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
76
+ // deprecated use top-start instead
77
+ 'top-right',
78
+ // deprecated use top-end instead
79
+
80
+ 'bottom', 'bottom-left',
81
+ // deprecated use bottom-start instead
82
+ 'bottom-right',
83
+ // deprecated use bottom-end instead
84
+
85
+ 'left', 'left-bottom',
86
+ // deprecated use left-end instead
87
+ 'left-top',
88
+ // deprecated use left-start instead
89
+
90
+ 'right', 'right-bottom',
91
+ // deprecated use right-end instead
92
+ 'right-top',
93
+ // deprecated use right-start instead
94
+
95
+ // new values to match floating-ui
96
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
97
+ //allowed prop values
98
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
99
+ //optional mapper function
100
+ propMappingFunction),
62
101
  /**
63
102
  * **Experimental**: Will attempt to automatically align the tooltip
64
103
  */
@@ -40,15 +40,21 @@ const TableSelectRow = _ref => {
40
40
  } = _ref;
41
41
  const prefix = usePrefix.usePrefix();
42
42
  const uniqueNameId = useId.useId();
43
+ const handleRadioChange = onChange ? (value, name, event) => {
44
+ // Convert the radio value to boolean for consistency
45
+ onChange(!!value, name || '', event);
46
+ } : undefined;
47
+ const handleCheckboxChange = onChange ? (checked, name, event) => {
48
+ onChange(checked, name, event);
49
+ } : undefined;
43
50
  const selectionInputProps = {
44
51
  id,
45
52
  name: name ? name : uniqueNameId,
46
53
  onClick: onSelect,
47
- onChange,
48
54
  checked,
49
55
  disabled
50
56
  };
51
- const InlineInputComponent = radio ? RadioButton["default"] : InlineCheckbox["default"];
57
+ const labelValue = ariaLabel || deprecatedAriaLabel || '';
52
58
  const tableSelectRowClasses = cx__default["default"](`${prefix}--table-column-checkbox`, {
53
59
  ...(className && {
54
60
  [className]: true
@@ -58,11 +64,13 @@ const TableSelectRow = _ref => {
58
64
  return /*#__PURE__*/React__default["default"].createElement("td", {
59
65
  className: tableSelectRowClasses,
60
66
  "aria-live": "off"
61
- }, /*#__PURE__*/React__default["default"].createElement(InlineInputComponent, _rollupPluginBabelHelpers["extends"]({}, selectionInputProps, radio && {
62
- labelText: ariaLabel || deprecatedAriaLabel,
67
+ }, radio ? /*#__PURE__*/React__default["default"].createElement(RadioButton["default"], _rollupPluginBabelHelpers["extends"]({}, selectionInputProps, {
68
+ labelText: labelValue,
69
+ onChange: handleRadioChange,
63
70
  hideLabel: true
64
- }, !radio && {
65
- 'aria-label': ariaLabel || deprecatedAriaLabel
71
+ })) : /*#__PURE__*/React__default["default"].createElement(InlineCheckbox["default"], _rollupPluginBabelHelpers["extends"]({}, selectionInputProps, {
72
+ "aria-label": labelValue,
73
+ onChange: handleCheckboxChange
66
74
  })));
67
75
  };
68
76
  TableSelectRow.propTypes = {
@@ -102,7 +102,7 @@ const TableToolbarSearch = _ref => {
102
102
  const onChange = e => {
103
103
  setValue(e.target.value);
104
104
  if (onChangeProp) {
105
- onChangeProp(e);
105
+ onChangeProp(e, e.target.value);
106
106
  }
107
107
  };
108
108
  const handleOnFocus = event => handleExpand(event, true);
@@ -13,7 +13,7 @@ interface TableToolbarFilterProps {
13
13
  /**
14
14
  * Provide an optional hook that is called each time the input is updated
15
15
  */
16
- onChange?: (event: '' | ChangeEvent<HTMLInputElement>, value?: string) => void;
16
+ onChange?: (event: '' | ChangeEvent<HTMLInputElement>) => void;
17
17
  /**
18
18
  * Provide an function that is called when the apply button is clicked
19
19
  */
@@ -80,7 +80,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
80
80
  if (inputTo === target && fp.selectedDates[1]) {
81
81
  // Using getTime() enables the ability to more readily compare the date currently
82
82
  // selected in the calendar and the date currently in the value of the input
83
- const withoutTime = date => date.setHours(0, 0, 0, 0);
83
+ const withoutTime = date => date?.setHours(0, 0, 0, 0);
84
84
  const selectedToDate = withoutTime(new Date(fp.selectedDates[1]));
85
85
  const currentValueToDate = withoutTime(parseDateWithFormat(inputTo.value));
86
86
 
@@ -92,7 +92,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
92
92
  fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
93
93
  }
94
94
  }
95
- const isValidDate = date => date.toString() !== 'Invalid Date';
95
+ const isValidDate = date => date?.toString() !== 'Invalid Date';
96
96
  // save end date in calendar inmediately after it's been written down
97
97
  if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
98
98
  if (isValidDate(parseDateWithFormat(inputTo.value))) {
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { ReactElementLike, ReactNodeArray } from 'prop-types';
8
- import React from 'react';
8
+ import React, { ReactNode } from 'react';
9
9
  import { ReactAttr } from '../../types/common';
10
10
  type ExcludedAttributes = 'value' | 'onChange' | 'locale' | 'children';
11
11
  export type ReactNodeLike = ReactElementLike | ReactNodeArray | string | number | boolean | null | undefined;
@@ -19,6 +19,10 @@ export interface DatePickerInputProps extends Omit<ReactAttr<HTMLInputElement>,
19
19
  * * `range` - With calendar dropdown and a date range.
20
20
  */
21
21
  datePickerType?: 'simple' | 'single' | 'range';
22
+ /**
23
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `DatePickerInput` component
24
+ */
25
+ decorator?: ReactNode;
22
26
  /**
23
27
  * Specify whether or not the input should be disabled
24
28
  */
@@ -77,6 +81,7 @@ export interface DatePickerInputProps extends Omit<ReactAttr<HTMLInputElement>,
77
81
  */
78
82
  size?: 'sm' | 'md' | 'lg';
79
83
  /**
84
+ * @deprecated please use decorator instead.
80
85
  * **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
81
86
  */
82
87
  slug?: ReactNodeLike;