@carbon/react 1.70.0-rc.0 → 1.71.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 (132) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +756 -756
  2. package/es/components/AILabel/index.js +15 -15
  3. package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
  4. package/es/components/CodeSnippet/CodeSnippet.d.ts +5 -2
  5. package/es/components/CodeSnippet/CodeSnippet.js +40 -1
  6. package/es/components/ComboBox/ComboBox.js +28 -23
  7. package/es/components/ComboButton/index.js +40 -1
  8. package/es/components/ComposedModal/ComposedModal.js +6 -2
  9. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +2 -2
  10. package/es/components/ContentSwitcher/ContentSwitcher.js +1 -1
  11. package/es/components/Copy/Copy.d.ts +5 -2
  12. package/es/components/Copy/Copy.js +40 -1
  13. package/es/components/CopyButton/CopyButton.d.ts +5 -2
  14. package/es/components/CopyButton/CopyButton.js +40 -1
  15. package/es/components/DataTable/Table.d.ts +9 -1
  16. package/es/components/DataTable/Table.js +7 -2
  17. package/es/components/DataTable/TableSelectRow.js +14 -6
  18. package/es/components/DataTable/TableToolbarSearch.js +1 -1
  19. package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +1 -1
  20. package/es/components/DatePicker/DatePicker.js +0 -8
  21. package/es/components/DatePicker/plugins/appendToPlugin.js +2 -2
  22. package/es/components/DatePicker/plugins/fixEventsPlugin.js +4 -4
  23. package/es/components/DatePicker/plugins/rangePlugin.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/IconButton/index.d.ts +4 -1
  30. package/es/components/IconButton/index.js +40 -1
  31. package/es/components/InlineCheckbox/InlineCheckbox.d.ts +50 -0
  32. package/es/components/InlineCheckbox/InlineCheckbox.js +3 -6
  33. package/es/components/InlineCheckbox/index.d.ts +9 -0
  34. package/es/components/LayoutDirection/LayoutDirection.d.ts +44 -0
  35. package/es/components/LayoutDirection/LayoutDirectionContext.d.ts +10 -0
  36. package/es/components/LayoutDirection/useLayoutDirection.d.ts +12 -0
  37. package/es/components/Menu/MenuItem.js +0 -3
  38. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  39. package/es/components/MultiSelect/FilterableMultiSelect.js +1 -2
  40. package/es/components/MultiSelect/MultiSelect.js +1 -1
  41. package/es/components/Notification/Notification.d.ts +9 -2
  42. package/es/components/Notification/Notification.js +16 -2
  43. package/es/components/NumberInput/NumberInput.d.ts +5 -0
  44. package/es/components/NumberInput/NumberInput.js +17 -9
  45. package/es/components/OverflowMenu/OverflowMenu.js +1 -1
  46. package/es/components/OverflowMenu/next/index.js +40 -1
  47. package/es/components/Pagination/Pagination.js +2 -2
  48. package/es/components/Pagination/experimental/PageSelector.js +1 -1
  49. package/es/components/PaginationNav/PaginationNav.d.ts +1 -1
  50. package/es/components/PaginationNav/PaginationNav.js +10 -5
  51. package/es/components/Popover/index.js +2 -2
  52. package/es/components/SkeletonText/SkeletonText.js +1 -1
  53. package/es/components/Tabs/Tabs.js +46 -29
  54. package/es/components/TextArea/TextArea.d.ts +5 -0
  55. package/es/components/TextArea/TextArea.js +15 -7
  56. package/es/components/TextInput/TextInput.d.ts +5 -0
  57. package/es/components/TextInput/TextInput.js +15 -7
  58. package/es/components/TreeView/TreeNode.js +1 -1
  59. package/es/components/TreeView/TreeView.js +1 -1
  60. package/es/components/UIShell/HeaderMenu.js +1 -1
  61. package/es/components/UIShell/SideNav.js +1 -1
  62. package/es/components/UIShell/SideNavItems.js +1 -1
  63. package/es/components/UIShell/SideNavMenu.js +1 -1
  64. package/es/components/UIShell/SideNavMenuItem.d.ts +5 -1
  65. package/es/components/UIShell/SideNavMenuItem.js +7 -2
  66. package/es/components/UIShell/Switcher.js +1 -1
  67. package/lib/components/AILabel/index.js +15 -15
  68. package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
  69. package/lib/components/CodeSnippet/CodeSnippet.d.ts +5 -2
  70. package/lib/components/CodeSnippet/CodeSnippet.js +40 -1
  71. package/lib/components/ComboBox/ComboBox.js +29 -23
  72. package/lib/components/ComboButton/index.js +40 -1
  73. package/lib/components/ComposedModal/ComposedModal.js +6 -2
  74. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +2 -2
  75. package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
  76. package/lib/components/Copy/Copy.d.ts +5 -2
  77. package/lib/components/Copy/Copy.js +40 -1
  78. package/lib/components/CopyButton/CopyButton.d.ts +5 -2
  79. package/lib/components/CopyButton/CopyButton.js +40 -1
  80. package/lib/components/DataTable/Table.d.ts +9 -1
  81. package/lib/components/DataTable/Table.js +7 -2
  82. package/lib/components/DataTable/TableSelectRow.js +14 -6
  83. package/lib/components/DataTable/TableToolbarSearch.js +1 -1
  84. package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +1 -1
  85. package/lib/components/DatePicker/DatePicker.js +0 -8
  86. package/lib/components/DatePicker/plugins/appendToPlugin.js +2 -2
  87. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +4 -4
  88. package/lib/components/DatePicker/plugins/rangePlugin.js +2 -2
  89. package/lib/components/DatePickerInput/DatePickerInput.d.ts +6 -1
  90. package/lib/components/DatePickerInput/DatePickerInput.js +16 -10
  91. package/lib/components/Dropdown/Dropdown.d.ts +5 -0
  92. package/lib/components/Dropdown/Dropdown.js +131 -91
  93. package/lib/components/FeatureFlags/index.js +1 -2
  94. package/lib/components/IconButton/index.d.ts +4 -1
  95. package/lib/components/IconButton/index.js +40 -1
  96. package/lib/components/InlineCheckbox/InlineCheckbox.d.ts +50 -0
  97. package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -6
  98. package/lib/components/InlineCheckbox/index.d.ts +9 -0
  99. package/lib/components/LayoutDirection/LayoutDirection.d.ts +44 -0
  100. package/lib/components/LayoutDirection/LayoutDirectionContext.d.ts +10 -0
  101. package/lib/components/LayoutDirection/useLayoutDirection.d.ts +12 -0
  102. package/lib/components/Menu/MenuItem.js +0 -3
  103. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  104. package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -2
  105. package/lib/components/MultiSelect/MultiSelect.js +1 -1
  106. package/lib/components/Notification/Notification.d.ts +9 -2
  107. package/lib/components/Notification/Notification.js +16 -2
  108. package/lib/components/NumberInput/NumberInput.d.ts +5 -0
  109. package/lib/components/NumberInput/NumberInput.js +17 -9
  110. package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
  111. package/lib/components/OverflowMenu/next/index.js +40 -1
  112. package/lib/components/Pagination/Pagination.js +2 -2
  113. package/lib/components/Pagination/experimental/PageSelector.js +1 -1
  114. package/lib/components/PaginationNav/PaginationNav.d.ts +1 -1
  115. package/lib/components/PaginationNav/PaginationNav.js +10 -5
  116. package/lib/components/Popover/index.js +2 -2
  117. package/lib/components/SkeletonText/SkeletonText.js +1 -1
  118. package/lib/components/Tabs/Tabs.js +46 -29
  119. package/lib/components/TextArea/TextArea.d.ts +5 -0
  120. package/lib/components/TextArea/TextArea.js +15 -7
  121. package/lib/components/TextInput/TextInput.d.ts +5 -0
  122. package/lib/components/TextInput/TextInput.js +15 -7
  123. package/lib/components/TreeView/TreeNode.js +1 -1
  124. package/lib/components/TreeView/TreeView.js +1 -1
  125. package/lib/components/UIShell/HeaderMenu.js +1 -1
  126. package/lib/components/UIShell/SideNav.js +1 -1
  127. package/lib/components/UIShell/SideNavItems.js +1 -1
  128. package/lib/components/UIShell/SideNavMenu.js +1 -1
  129. package/lib/components/UIShell/SideNavMenuItem.d.ts +5 -1
  130. package/lib/components/UIShell/SideNavMenuItem.js +7 -2
  131. package/lib/components/UIShell/Switcher.js +1 -1
  132. package/package.json +5 -5
@@ -31,8 +31,8 @@ const AILabelContent = /*#__PURE__*/React__default.forwardRef(function AILabelCo
31
31
  item.type?.displayName === 'AILabelActions';
32
32
  });
33
33
  const aiLabelContentClasses = cx(className, {
34
- [`${prefix}--slug-content`]: true,
35
- [`${prefix}--slug-content--with-actions`]: hasAILabelActions
34
+ [`${prefix}--ai-label-content`]: true,
35
+ [`${prefix}--ai-label-content--with-actions`]: hasAILabelActions
36
36
  });
37
37
  return /*#__PURE__*/React__default.createElement(ToggletipContent, {
38
38
  className: aiLabelContentClasses
@@ -41,11 +41,11 @@ const AILabelContent = /*#__PURE__*/React__default.forwardRef(function AILabelCo
41
41
  AILabelContent.displayName = 'AILabelContent';
42
42
  AILabelContent.propTypes = {
43
43
  /**
44
- * Specify the content you want rendered inside the slug ToggleTip
44
+ * Specify the content you want rendered inside the AILabel ToggleTip
45
45
  */
46
46
  children: PropTypes.node,
47
47
  /**
48
- * Specify an optional className to be added to the AI slug callout
48
+ * Specify an optional className to be added to the AILabel callout
49
49
  */
50
50
  className: PropTypes.string
51
51
  };
@@ -57,7 +57,7 @@ const AILabelActions = /*#__PURE__*/React__default.forwardRef(function AILabelAc
57
57
  } = _ref2;
58
58
  const prefix = usePrefix();
59
59
  const aiLabelActionsClasses = cx(className, {
60
- [`${prefix}--slug-actions`]: true
60
+ [`${prefix}--ai-label-actions`]: true
61
61
  });
62
62
  return /*#__PURE__*/React__default.createElement(ToggletipActions, {
63
63
  className: aiLabelActionsClasses
@@ -66,11 +66,11 @@ const AILabelActions = /*#__PURE__*/React__default.forwardRef(function AILabelAc
66
66
  AILabelActions.displayName = 'AILabelActions';
67
67
  AILabelActions.propTypes = {
68
68
  /**
69
- * Specify the content you want rendered inside the slug callout toolbar
69
+ * Specify the content you want rendered inside the AILabel callout toolbar
70
70
  */
71
71
  children: PropTypes.node,
72
72
  /**
73
- * Specify an optional className to be added to the AI slug toolbar
73
+ * Specify an optional className to be added to the AILabel toolbar
74
74
  */
75
75
  className: PropTypes.string
76
76
  };
@@ -104,14 +104,14 @@ const AILabel = /*#__PURE__*/React__default.forwardRef(function AILabel(_ref3, r
104
104
  const prefix = usePrefix();
105
105
  const id = useId('AILabel');
106
106
  const aiLabelClasses = cx(className, {
107
- [`${prefix}--slug`]: true,
108
- [`${prefix}--slug--revert`]: revertActive
107
+ [`${prefix}--ai-label`]: true,
108
+ [`${prefix}--ai-label--revert`]: revertActive
109
109
  });
110
110
  const aiLabelButtonClasses = cx({
111
- [`${prefix}--slug__button`]: true,
112
- [`${prefix}--slug__button--${size}`]: size,
113
- [`${prefix}--slug__button--${kind}`]: kind,
114
- [`${prefix}--slug__button--inline-with-content`]: kind === 'inline' && (aiTextLabel || textLabel)
111
+ [`${prefix}--ai-label__button`]: true,
112
+ [`${prefix}--ai-label__button--${size}`]: size,
113
+ [`${prefix}--ai-label__button--${kind}`]: kind,
114
+ [`${prefix}--ai-label__button--inline-with-content`]: kind === 'inline' && (aiTextLabel || textLabel)
115
115
  });
116
116
  const handleOnRevertClick = evt => {
117
117
  if (onRevertClick) {
@@ -135,9 +135,9 @@ const AILabel = /*#__PURE__*/React__default.forwardRef(function AILabel(_ref3, r
135
135
  className: aiLabelButtonClasses,
136
136
  label: ariaLabelText
137
137
  }, /*#__PURE__*/React__default.createElement("span", {
138
- className: `${prefix}--slug__text`
138
+ className: `${prefix}--ai-label__text`
139
139
  }, aiText), kind === 'inline' && (aiTextLabel || textLabel) && /*#__PURE__*/React__default.createElement("span", {
140
- className: `${prefix}--slug__additional-text`
140
+ className: `${prefix}--ai-label__additional-text`
141
141
  }, aiTextLabel || textLabel)), children));
142
142
  });
143
143
  AILabel.displayName = 'AILabel';
@@ -48,7 +48,7 @@ const CheckboxGroup = _ref => {
48
48
 
49
49
  // Slug is always size `mini`
50
50
  let normalizedSlug;
51
- if ( /*#__PURE__*/React__default.isValidElement(slug) && slug['type']?.displayName === 'AILabel') {
51
+ if (/*#__PURE__*/React__default.isValidElement(slug) && slug['type']?.displayName === 'AILabel') {
52
52
  normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
53
53
  size: 'mini',
54
54
  kind: 'default'
@@ -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
@@ -19,12 +19,26 @@ import uniqueId from '../../tools/uniqueId.js';
19
19
  import copy from 'copy-to-clipboard';
20
20
  import deprecate from '../../prop-types/deprecate.js';
21
21
  import { usePrefix } from '../../internal/usePrefix.js';
22
+ import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
22
23
 
23
24
  const rowHeightInPixels = 16;
24
25
  const defaultMaxCollapsedNumberOfRows = 15;
25
26
  const defaultMaxExpandedNumberOfRows = 0;
26
27
  const defaultMinCollapsedNumberOfRows = 3;
27
28
  const defaultMinExpandedNumberOfRows = 16;
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 CodeSnippet(_ref) {
29
43
  let {
30
44
  align = 'bottom',
@@ -232,7 +246,32 @@ CodeSnippet.propTypes = {
232
246
  /**
233
247
  * Specify how the trigger should align with the tooltip
234
248
  */
235
- align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
249
+ align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
250
+ // deprecated use top-start instead
251
+ 'top-right',
252
+ // deprecated use top-end instead
253
+
254
+ 'bottom', 'bottom-left',
255
+ // deprecated use bottom-start instead
256
+ 'bottom-right',
257
+ // deprecated use bottom-end instead
258
+
259
+ 'left', 'left-bottom',
260
+ // deprecated use left-end instead
261
+ 'left-top',
262
+ // deprecated use left-start instead
263
+
264
+ 'right', 'right-bottom',
265
+ // deprecated use right-end instead
266
+ 'right-top',
267
+ // deprecated use right-start instead
268
+
269
+ // new values to match floating-ui
270
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
271
+ //allowed prop values
272
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
273
+ //optional mapper function
274
+ propMappingFunction),
236
275
  /**
237
276
  * Specify a label to be read by screen readers on the containing textbox
238
277
  * node
@@ -12,6 +12,7 @@ import PropTypes from 'prop-types';
12
12
  import React__default, { forwardRef, useRef, useEffect, useState, useContext, useCallback, useMemo } from 'react';
13
13
  import '../Text/index.js';
14
14
  import { WarningFilled, WarningAltFilled, Checkmark } from '@carbon/icons-react';
15
+ import isEqual from 'react-fast-compare';
15
16
  import ListBox from '../ListBox/index.js';
16
17
  import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
17
18
  import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
@@ -225,11 +226,14 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
225
226
  selectedItem: selectedItemProp,
226
227
  prevSelectedItem: prevSelectedItemProp.current
227
228
  });
228
- setInputValue(currentInputValue);
229
- onChange({
230
- selectedItem: selectedItemProp,
231
- inputValue: currentInputValue
232
- });
229
+ // selectedItem has been updated externally, need to update state and call onChange
230
+ if (inputValue !== currentInputValue) {
231
+ setInputValue(currentInputValue);
232
+ onChange({
233
+ selectedItem: selectedItemProp,
234
+ inputValue: currentInputValue
235
+ });
236
+ }
233
237
  prevSelectedItemProp.current = selectedItemProp;
234
238
  }
235
239
  }, [selectedItemProp]);
@@ -430,27 +434,12 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
430
434
  } = _ref4;
431
435
  const normalizedInput = inputValue || '';
432
436
  setInputValue(normalizedInput);
433
- if (selectedItemProp && !inputValue) {
434
- // ensure onChange is called when selectedItem is cleared
435
- onChange({
436
- selectedItem,
437
- inputValue: normalizedInput
438
- });
439
- }
440
437
  setHighlightedIndex(indexToHighlight(normalizedInput));
441
438
  },
442
- onSelectedItemChange(_ref5) {
443
- let {
444
- selectedItem
445
- } = _ref5;
446
- onChange({
447
- selectedItem
448
- });
449
- },
450
- onHighlightedIndexChange: _ref6 => {
439
+ onHighlightedIndexChange: _ref5 => {
451
440
  let {
452
441
  highlightedIndex
453
- } = _ref6;
442
+ } = _ref5;
454
443
  if (highlightedIndex > -1 && typeof window !== undefined) {
455
444
  const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
456
445
  const highlightedItem = itemArray[highlightedIndex];
@@ -462,11 +451,27 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
462
451
  }
463
452
  }
464
453
  },
454
+ onStateChange: _ref6 => {
455
+ let {
456
+ type,
457
+ selectedItem: newSelectedItem
458
+ } = _ref6;
459
+ if (type === '__item_click__' && !isEqual(selectedItemProp, newSelectedItem)) {
460
+ onChange({
461
+ selectedItem: newSelectedItem
462
+ });
463
+ }
464
+ if (type === '__function_select_item__' || type === '__input_keydown_enter__') {
465
+ onChange({
466
+ selectedItem: newSelectedItem
467
+ });
468
+ }
469
+ },
465
470
  initialSelectedItem: initialSelectedItem,
466
471
  inputId: id,
467
472
  stateReducer,
468
473
  isItemDisabled(item, _index) {
469
- return item.disabled;
474
+ return item?.disabled;
470
475
  },
471
476
  ...downshiftProps
472
477
  });
@@ -22,6 +22,7 @@ import { flip, size, useFloating, autoUpdate } from '@floating-ui/react';
22
22
  import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
23
23
  import { useFeatureFlag } from '../FeatureFlags/index.js';
24
24
  import mergeRefs from '../../tools/mergeRefs.js';
25
+ import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
25
26
 
26
27
  var _ChevronDown;
27
28
  const defaultTranslations = {
@@ -32,6 +33,19 @@ const defaultTranslations = {
32
33
  * Message ids that will be passed to translateWithId().
33
34
  */
34
35
 
36
+ const propMappingFunction = deprecatedValue => {
37
+ const mapping = {
38
+ 'top-left': 'top-start',
39
+ 'top-right': 'top-end',
40
+ 'bottom-left': 'bottom-start',
41
+ 'bottom-right': 'bottom-end',
42
+ 'left-bottom': 'left-end',
43
+ 'left-top': 'left-start',
44
+ 'right-bottom': 'right-end',
45
+ 'right-top': 'right-start'
46
+ };
47
+ return mapping[deprecatedValue];
48
+ };
35
49
  function defaultTranslateWithId(messageId) {
36
50
  return defaultTranslations[messageId];
37
51
  }
@@ -191,7 +205,32 @@ ComboButton.propTypes = {
191
205
  /**
192
206
  * Specify how the trigger tooltip should be aligned.
193
207
  */
194
- tooltipAlignment: PropTypes.oneOf(['top', 'top-left', 'top-start', 'top-right', 'top-end', 'bottom', 'bottom-left', 'bottom-start', 'bottom-right', 'bottom-end', 'left', 'right']),
208
+ tooltipAlignment: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
209
+ // deprecated use top-start instead
210
+ 'top-right',
211
+ // deprecated use top-end instead
212
+
213
+ 'bottom', 'bottom-left',
214
+ // deprecated use bottom-start instead
215
+ 'bottom-right',
216
+ // deprecated use bottom-end instead
217
+
218
+ 'left', 'left-bottom',
219
+ // deprecated use left-end instead
220
+ 'left-top',
221
+ // deprecated use left-start instead
222
+
223
+ 'right', 'right-bottom',
224
+ // deprecated use right-end instead
225
+ 'right-top',
226
+ // deprecated use right-start instead
227
+
228
+ // new values to match floating-ui
229
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
230
+ //allowed prop values
231
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
232
+ //optional mapper function
233
+ propMappingFunction),
195
234
  /**
196
235
  * Optional method that takes in a message id and returns an
197
236
  * internationalized string.
@@ -210,7 +210,8 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
210
210
  const el = child;
211
211
  return /*#__PURE__*/React__default.cloneElement(el, {
212
212
  closeModal,
213
- inputref: button
213
+ inputref: button,
214
+ danger
214
215
  });
215
216
  }
216
217
  default:
@@ -227,7 +228,7 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
227
228
  useEffect(() => {
228
229
  const initialFocus = focusContainerElement => {
229
230
  const containerElement = focusContainerElement || innerModal.current;
230
- const primaryFocusElement = containerElement ? containerElement.querySelector(selectorPrimaryFocus) : null;
231
+ const primaryFocusElement = containerElement ? containerElement.querySelector(danger ? `.${prefix}--btn--secondary` : selectorPrimaryFocus) : null;
231
232
  if (primaryFocusElement) {
232
233
  return primaryFocusElement;
233
234
  }
@@ -235,8 +236,11 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
235
236
  };
236
237
  const focusButton = focusContainerElement => {
237
238
  const target = initialFocus(focusContainerElement);
239
+ const closeButton = focusContainerElement.querySelector(`.${prefix}--modal-close`);
238
240
  if (target) {
239
241
  target.focus();
242
+ } else if (!target && closeButton) {
243
+ closeButton?.focus();
240
244
  }
241
245
  };
242
246
  if (open && isOpen) {
@@ -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
  /**
@@ -163,7 +163,7 @@ _defineProperty(ContentSwitcher, "propTypes", {
163
163
  */
164
164
  selectedIndex: PropTypes.number,
165
165
  /**
166
- * Choose whether or not to automatically change selection on focus
166
+ * Choose whether or not to automatically change selection on focus when left/right arrow pressed. Defaults to 'automatic'
167
167
  */
168
168
  selectionMode: PropTypes.oneOf(['automatic', 'manual']),
169
169
  /**
@@ -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
  */
@@ -14,7 +14,21 @@ import { composeEventHandlers } from '../../tools/events.js';
14
14
  import { usePrefix } from '../../internal/usePrefix.js';
15
15
  import { IconButton } from '../IconButton/index.js';
16
16
  import { noopFn } from '../../internal/noopFn.js';
17
+ import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
17
18
 
19
+ const propMappingFunction = deprecatedValue => {
20
+ const mapping = {
21
+ 'top-left': 'top-start',
22
+ 'top-right': 'top-end',
23
+ 'bottom-left': 'bottom-start',
24
+ 'bottom-right': 'bottom-end',
25
+ 'left-bottom': 'left-end',
26
+ 'left-top': 'left-start',
27
+ 'right-bottom': 'right-end',
28
+ 'right-top': 'right-start'
29
+ };
30
+ return mapping[deprecatedValue];
31
+ };
18
32
  function Copy(_ref) {
19
33
  let {
20
34
  align = 'bottom',
@@ -66,7 +80,32 @@ Copy.propTypes = {
66
80
  /**
67
81
  * Specify how the trigger should align with the tooltip
68
82
  */
69
- align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
83
+ align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
84
+ // deprecated use top-start instead
85
+ 'top-right',
86
+ // deprecated use top-end instead
87
+
88
+ 'bottom', 'bottom-left',
89
+ // deprecated use bottom-start instead
90
+ 'bottom-right',
91
+ // deprecated use bottom-end instead
92
+
93
+ 'left', 'left-bottom',
94
+ // deprecated use left-end instead
95
+ 'left-top',
96
+ // deprecated use left-start instead
97
+
98
+ 'right', 'right-bottom',
99
+ // deprecated use right-end instead
100
+ 'right-top',
101
+ // deprecated use right-start instead
102
+
103
+ // new values to match floating-ui
104
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
105
+ //allowed prop values
106
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
107
+ //optional mapper function
108
+ propMappingFunction),
70
109
  /**
71
110
  * **Experimental**: Will attempt to automatically align the tooltip
72
111
  */
@@ -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
  */
@@ -14,7 +14,21 @@ import Copy from '../Copy/Copy.js';
14
14
  import { LayoutConstraint } from '../Layout/index.js';
15
15
  import { usePrefix } from '../../internal/usePrefix.js';
16
16
  import { noopFn } from '../../internal/noopFn.js';
17
+ import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
17
18
 
19
+ const propMappingFunction = deprecatedValue => {
20
+ const mapping = {
21
+ 'top-left': 'top-start',
22
+ 'top-right': 'top-end',
23
+ 'bottom-left': 'bottom-start',
24
+ 'bottom-right': 'bottom-end',
25
+ 'left-bottom': 'left-end',
26
+ 'left-top': 'left-start',
27
+ 'right-bottom': 'right-end',
28
+ 'right-top': 'right-start'
29
+ };
30
+ return mapping[deprecatedValue];
31
+ };
18
32
  function CopyButton(_ref) {
19
33
  let {
20
34
  align = 'bottom',
@@ -48,7 +62,32 @@ CopyButton.propTypes = {
48
62
  /**
49
63
  * Specify how the trigger should align with the tooltip
50
64
  */
51
- align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
65
+ align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
66
+ // deprecated use top-start instead
67
+ 'top-right',
68
+ // deprecated use top-end instead
69
+
70
+ 'bottom', 'bottom-left',
71
+ // deprecated use bottom-start instead
72
+ 'bottom-right',
73
+ // deprecated use bottom-end instead
74
+
75
+ 'left', 'left-bottom',
76
+ // deprecated use left-end instead
77
+ 'left-top',
78
+ // deprecated use left-start instead
79
+
80
+ 'right', 'right-bottom',
81
+ // deprecated use right-end instead
82
+ 'right-top',
83
+ // deprecated use right-start instead
84
+
85
+ // new values to match floating-ui
86
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
87
+ //allowed prop values
88
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
89
+ //optional mapper function
90
+ propMappingFunction),
52
91
  /**
53
92
  * **Experimental**: Will attempt to automatically align the tooltip
54
93
  */
@@ -33,9 +33,13 @@ interface TableProps {
33
33
  * `true` to add useZebraStyles striping.
34
34
  */
35
35
  useZebraStyles?: boolean;
36
+ /**
37
+ * Specify the table tabIndex
38
+ */
39
+ tabIndex?: number;
36
40
  }
37
41
  export declare const Table: {
38
- ({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, ...other }: PropsWithChildren<TableProps>): import("react/jsx-runtime").JSX.Element;
42
+ ({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, tabIndex, ...other }: PropsWithChildren<TableProps>): import("react/jsx-runtime").JSX.Element;
39
43
  propTypes: {
40
44
  /**
41
45
  * Pass in the children that will be rendered within the Table
@@ -70,6 +74,10 @@ export declare const Table: {
70
74
  * `true` to add useZebraStyles striping.
71
75
  */
72
76
  useZebraStyles: PropTypes.Requireable<boolean>;
77
+ /**
78
+ * Specify the table tabIndex
79
+ */
80
+ tabIndex: PropTypes.Requireable<number>;
73
81
  };
74
82
  };
75
83
  export default Table;
@@ -54,6 +54,7 @@ const Table = _ref => {
54
54
  stickyHeader,
55
55
  overflowMenuOnHover = true,
56
56
  experimentalAutoAlign = false,
57
+ tabIndex,
57
58
  ...other
58
59
  } = _ref;
59
60
  const {
@@ -129,7 +130,7 @@ const Table = _ref => {
129
130
  className: `${prefix}--data-table-content`
130
131
  // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
131
132
  ,
132
- tabIndex: isScrollable ? 0 : undefined
133
+ tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
133
134
  }, /*#__PURE__*/React__default.createElement("table", _extends({
134
135
  "aria-labelledby": titleId,
135
136
  "aria-describedby": descriptionId
@@ -174,7 +175,11 @@ Table.propTypes = {
174
175
  /**
175
176
  * `true` to add useZebraStyles striping.
176
177
  */
177
- useZebraStyles: PropTypes.bool
178
+ useZebraStyles: PropTypes.bool,
179
+ /**
180
+ * Specify the table tabIndex
181
+ */
182
+ tabIndex: PropTypes.number
178
183
  };
179
184
 
180
185
  export { Table, Table as default };
@@ -30,15 +30,21 @@ const TableSelectRow = _ref => {
30
30
  } = _ref;
31
31
  const prefix = usePrefix();
32
32
  const uniqueNameId = useId();
33
+ const handleRadioChange = onChange ? (value, name, event) => {
34
+ // Convert the radio value to boolean for consistency
35
+ onChange(!!value, name || '', event);
36
+ } : undefined;
37
+ const handleCheckboxChange = onChange ? (checked, name, event) => {
38
+ onChange(checked, name, event);
39
+ } : undefined;
33
40
  const selectionInputProps = {
34
41
  id,
35
42
  name: name ? name : uniqueNameId,
36
43
  onClick: onSelect,
37
- onChange,
38
44
  checked,
39
45
  disabled
40
46
  };
41
- const InlineInputComponent = radio ? RadioButton : InlineCheckbox;
47
+ const labelValue = ariaLabel || deprecatedAriaLabel || '';
42
48
  const tableSelectRowClasses = cx(`${prefix}--table-column-checkbox`, {
43
49
  ...(className && {
44
50
  [className]: true
@@ -48,11 +54,13 @@ const TableSelectRow = _ref => {
48
54
  return /*#__PURE__*/React__default.createElement("td", {
49
55
  className: tableSelectRowClasses,
50
56
  "aria-live": "off"
51
- }, /*#__PURE__*/React__default.createElement(InlineInputComponent, _extends({}, selectionInputProps, radio && {
52
- labelText: ariaLabel || deprecatedAriaLabel,
57
+ }, radio ? /*#__PURE__*/React__default.createElement(RadioButton, _extends({}, selectionInputProps, {
58
+ labelText: labelValue,
59
+ onChange: handleRadioChange,
53
60
  hideLabel: true
54
- }, !radio && {
55
- 'aria-label': ariaLabel || deprecatedAriaLabel
61
+ })) : /*#__PURE__*/React__default.createElement(InlineCheckbox, _extends({}, selectionInputProps, {
62
+ "aria-label": labelValue,
63
+ onChange: handleCheckboxChange
56
64
  })));
57
65
  };
58
66
  TableSelectRow.propTypes = {
@@ -92,7 +92,7 @@ const TableToolbarSearch = _ref => {
92
92
  const onChange = e => {
93
93
  setValue(e.target.value);
94
94
  if (onChangeProp) {
95
- onChangeProp(e);
95
+ onChangeProp(e, e.target.value);
96
96
  }
97
97
  };
98
98
  const handleOnFocus = event => handleExpand(event, true);