@carbon/react 1.81.0-rc.0 → 1.82.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 (222) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +784 -784
  2. package/es/components/AILabel/index.d.ts +1 -1
  3. package/es/components/AILabel/index.js +2 -9
  4. package/es/components/Breadcrumb/Breadcrumb.d.ts +2 -3
  5. package/es/components/Breadcrumb/Breadcrumb.js +4 -4
  6. package/es/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
  7. package/es/components/Breadcrumb/BreadcrumbItem.js +5 -4
  8. package/es/components/Button/Button.js +2 -10
  9. package/es/components/ButtonSet/ButtonSet.d.ts +2 -3
  10. package/es/components/ButtonSet/ButtonSet.js +4 -4
  11. package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  12. package/es/components/CodeSnippet/CodeSnippet.js +3 -19
  13. package/es/components/ComboBox/ComboBox.d.ts +1 -1
  14. package/es/components/ComboBox/ComboBox.js +54 -32
  15. package/es/components/ComboButton/index.d.ts +1 -1
  16. package/es/components/ComboButton/index.js +2 -18
  17. package/es/components/ComposedModal/ComposedModal.js +5 -3
  18. package/es/components/Copy/Copy.d.ts +1 -1
  19. package/es/components/Copy/Copy.js +2 -18
  20. package/es/components/CopyButton/CopyButton.d.ts +1 -1
  21. package/es/components/CopyButton/CopyButton.js +2 -18
  22. package/es/components/DataTable/DataTable.d.ts +7 -12
  23. package/es/components/DataTable/DataTable.js +0 -5
  24. package/es/components/DataTable/TableCell.js +28 -4
  25. package/es/components/DataTable/TableToolbarAction.d.ts +2 -4
  26. package/es/components/DataTable/TableToolbarAction.js +5 -4
  27. package/es/components/DataTable/tools/cells.d.ts +13 -0
  28. package/es/components/DataTable/tools/cells.js +3 -6
  29. package/es/components/DataTable/tools/filter.d.ts +26 -0
  30. package/es/components/DataTable/tools/filter.js +8 -17
  31. package/es/components/DataTable/tools/sorting.d.ts +42 -0
  32. package/es/components/DataTable/tools/sorting.js +24 -53
  33. package/es/components/DatePicker/DatePicker.d.ts +1 -1
  34. package/es/components/DatePicker/DatePicker.js +19 -19
  35. package/es/components/Dialog/index.d.ts +1 -1
  36. package/es/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
  37. package/es/components/Dropdown/Dropdown.Skeleton.js +2 -2
  38. package/es/components/Dropdown/Dropdown.d.ts +7 -6
  39. package/es/components/Dropdown/Dropdown.js +13 -9
  40. package/es/components/FileUploader/FileUploaderButton.d.ts +1 -1
  41. package/es/components/FileUploader/FileUploaderButton.js +1 -1
  42. package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
  43. package/es/components/FileUploader/FileUploaderItem.js +1 -1
  44. package/es/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
  45. package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +5 -6
  46. package/es/components/FluidDropdown/FluidDropdown.d.ts +1 -1
  47. package/es/components/FluidSearch/FluidSearch.d.ts +3 -6
  48. package/es/components/IconButton/index.d.ts +1 -1
  49. package/es/components/IconButton/index.js +2 -18
  50. package/es/components/ListBox/ListBox.d.ts +4 -5
  51. package/es/components/ListBox/ListBox.js +8 -7
  52. package/es/components/ListBox/ListBoxMenu.d.ts +4 -4
  53. package/es/components/ListBox/ListBoxMenu.js +4 -2
  54. package/es/components/ListBox/ListBoxMenuItem.d.ts +9 -8
  55. package/es/components/ListBox/ListBoxPropTypes.d.ts +3 -3
  56. package/es/components/ListBox/ListBoxPropTypes.js +3 -3
  57. package/es/components/ListBox/index.d.ts +7 -5
  58. package/es/components/ListBox/index.js +1 -1
  59. package/es/components/Menu/Menu.js +9 -14
  60. package/es/components/Menu/MenuItem.js +15 -4
  61. package/es/components/Modal/Modal.js +9 -9
  62. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
  63. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -2
  64. package/es/components/MultiSelect/MultiSelect.d.ts +8 -2
  65. package/es/components/MultiSelect/MultiSelect.js +7 -4
  66. package/es/components/Notification/Notification.js +1 -1
  67. package/es/components/OverflowMenu/OverflowMenu.js +2 -21
  68. package/es/components/OverflowMenu/index.d.ts +1 -1
  69. package/es/components/OverflowMenu/index.js +2 -3
  70. package/es/components/OverflowMenu/next/index.js +2 -18
  71. package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
  72. package/es/components/OverflowMenuItem/OverflowMenuItem.js +5 -4
  73. package/es/components/PageHeader/PageHeader.d.ts +160 -8
  74. package/es/components/PageHeader/PageHeader.js +155 -21
  75. package/es/components/PageHeader/index.d.ts +2 -2
  76. package/es/components/PageHeader/index.js +1 -1
  77. package/es/components/Popover/index.js +4 -21
  78. package/es/components/Search/Search.d.ts +2 -5
  79. package/es/components/Search/Search.js +24 -8
  80. package/es/components/Stack/HStack.d.ts +2 -3
  81. package/es/components/Stack/HStack.js +4 -7
  82. package/es/components/Stack/Stack.d.ts +3 -4
  83. package/es/components/Stack/Stack.js +3 -6
  84. package/es/components/Stack/VStack.d.ts +2 -3
  85. package/es/components/Stack/VStack.js +3 -2
  86. package/es/components/Stack/index.d.ts +4 -4
  87. package/es/components/TextArea/TextArea.js +3 -5
  88. package/es/components/TimePicker/TimePicker.d.ts +3 -4
  89. package/es/components/TimePicker/TimePicker.js +5 -4
  90. package/es/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
  91. package/es/components/TimePickerSelect/TimePickerSelect.js +5 -4
  92. package/es/components/TreeView/TreeNode.js +13 -1
  93. package/es/components/TreeView/TreeView.js +1 -1
  94. package/es/index.js +1 -1
  95. package/es/internal/FloatingMenu.js +9 -5
  96. package/es/internal/environment.js +7 -0
  97. package/es/internal/keyboard/navigation.d.ts +0 -10
  98. package/es/internal/keyboard/navigation.js +1 -13
  99. package/es/internal/useId.js +1 -1
  100. package/es/internal/useNoInteractiveChildren.js +7 -0
  101. package/es/internal/useOutsideClick.js +3 -0
  102. package/es/internal/wrapFocus.d.ts +49 -0
  103. package/es/internal/wrapFocus.js +64 -51
  104. package/es/tools/events.d.ts +17 -0
  105. package/es/tools/events.js +10 -13
  106. package/es/tools/mapPopoverAlign.d.ts +15 -0
  107. package/es/tools/mapPopoverAlign.js +28 -0
  108. package/es/tools/uniqueId.d.ts +7 -0
  109. package/es/tools/uniqueId.js +3 -3
  110. package/es/types/common.d.ts +0 -2
  111. package/lib/components/AILabel/index.d.ts +1 -1
  112. package/lib/components/AILabel/index.js +2 -9
  113. package/lib/components/Breadcrumb/Breadcrumb.d.ts +2 -3
  114. package/lib/components/Breadcrumb/Breadcrumb.js +3 -3
  115. package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
  116. package/lib/components/Breadcrumb/BreadcrumbItem.js +4 -3
  117. package/lib/components/Button/Button.js +1 -9
  118. package/lib/components/ButtonSet/ButtonSet.d.ts +2 -3
  119. package/lib/components/ButtonSet/ButtonSet.js +3 -3
  120. package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  121. package/lib/components/CodeSnippet/CodeSnippet.js +3 -19
  122. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  123. package/lib/components/ComboBox/ComboBox.js +53 -31
  124. package/lib/components/ComboButton/index.d.ts +1 -1
  125. package/lib/components/ComboButton/index.js +2 -18
  126. package/lib/components/ComposedModal/ComposedModal.js +5 -3
  127. package/lib/components/Copy/Copy.d.ts +1 -1
  128. package/lib/components/Copy/Copy.js +2 -18
  129. package/lib/components/CopyButton/CopyButton.d.ts +1 -1
  130. package/lib/components/CopyButton/CopyButton.js +2 -18
  131. package/lib/components/DataTable/DataTable.d.ts +7 -12
  132. package/lib/components/DataTable/DataTable.js +0 -5
  133. package/lib/components/DataTable/TableCell.js +28 -3
  134. package/lib/components/DataTable/TableToolbarAction.d.ts +2 -4
  135. package/lib/components/DataTable/TableToolbarAction.js +4 -3
  136. package/lib/components/DataTable/tools/cells.d.ts +13 -0
  137. package/lib/components/DataTable/tools/cells.js +3 -6
  138. package/lib/components/DataTable/tools/filter.d.ts +26 -0
  139. package/lib/components/DataTable/tools/filter.js +8 -17
  140. package/lib/components/DataTable/tools/sorting.d.ts +42 -0
  141. package/lib/components/DataTable/tools/sorting.js +23 -53
  142. package/lib/components/DatePicker/DatePicker.d.ts +1 -1
  143. package/lib/components/DatePicker/DatePicker.js +19 -19
  144. package/lib/components/Dialog/index.d.ts +1 -1
  145. package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
  146. package/lib/components/Dropdown/Dropdown.Skeleton.js +1 -1
  147. package/lib/components/Dropdown/Dropdown.d.ts +7 -6
  148. package/lib/components/Dropdown/Dropdown.js +12 -8
  149. package/lib/components/FileUploader/FileUploaderButton.d.ts +1 -1
  150. package/lib/components/FileUploader/FileUploaderButton.js +1 -1
  151. package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
  152. package/lib/components/FileUploader/FileUploaderItem.js +1 -1
  153. package/lib/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
  154. package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +4 -5
  155. package/lib/components/FluidDropdown/FluidDropdown.d.ts +1 -1
  156. package/lib/components/FluidSearch/FluidSearch.d.ts +3 -6
  157. package/lib/components/IconButton/index.d.ts +1 -1
  158. package/lib/components/IconButton/index.js +2 -18
  159. package/lib/components/ListBox/ListBox.d.ts +4 -5
  160. package/lib/components/ListBox/ListBox.js +7 -6
  161. package/lib/components/ListBox/ListBoxMenu.d.ts +4 -4
  162. package/lib/components/ListBox/ListBoxMenu.js +3 -1
  163. package/lib/components/ListBox/ListBoxMenuItem.d.ts +9 -8
  164. package/lib/components/ListBox/ListBoxPropTypes.d.ts +3 -3
  165. package/lib/components/ListBox/ListBoxPropTypes.js +4 -4
  166. package/lib/components/ListBox/index.d.ts +7 -5
  167. package/lib/components/ListBox/index.js +2 -2
  168. package/lib/components/Menu/Menu.js +9 -14
  169. package/lib/components/Menu/MenuItem.js +15 -4
  170. package/lib/components/Modal/Modal.js +9 -9
  171. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
  172. package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -1
  173. package/lib/components/MultiSelect/MultiSelect.d.ts +8 -2
  174. package/lib/components/MultiSelect/MultiSelect.js +6 -3
  175. package/lib/components/Notification/Notification.js +1 -1
  176. package/lib/components/OverflowMenu/OverflowMenu.js +2 -21
  177. package/lib/components/OverflowMenu/index.d.ts +1 -1
  178. package/lib/components/OverflowMenu/index.js +2 -3
  179. package/lib/components/OverflowMenu/next/index.js +2 -18
  180. package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
  181. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +4 -3
  182. package/lib/components/PageHeader/PageHeader.d.ts +160 -8
  183. package/lib/components/PageHeader/PageHeader.js +159 -19
  184. package/lib/components/PageHeader/index.d.ts +2 -2
  185. package/lib/components/PageHeader/index.js +6 -0
  186. package/lib/components/Popover/index.js +4 -21
  187. package/lib/components/Search/Search.d.ts +2 -5
  188. package/lib/components/Search/Search.js +24 -8
  189. package/lib/components/Stack/HStack.d.ts +2 -3
  190. package/lib/components/Stack/HStack.js +3 -6
  191. package/lib/components/Stack/Stack.d.ts +3 -4
  192. package/lib/components/Stack/Stack.js +2 -5
  193. package/lib/components/Stack/VStack.d.ts +2 -3
  194. package/lib/components/Stack/VStack.js +2 -1
  195. package/lib/components/Stack/index.d.ts +4 -4
  196. package/lib/components/TextArea/TextArea.js +2 -4
  197. package/lib/components/TimePicker/TimePicker.d.ts +3 -4
  198. package/lib/components/TimePicker/TimePicker.js +4 -3
  199. package/lib/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
  200. package/lib/components/TimePickerSelect/TimePickerSelect.js +4 -3
  201. package/lib/components/TreeView/TreeNode.js +13 -1
  202. package/lib/components/TreeView/TreeView.js +1 -1
  203. package/lib/index.js +2 -2
  204. package/lib/internal/FloatingMenu.js +9 -5
  205. package/lib/internal/environment.js +7 -0
  206. package/lib/internal/keyboard/navigation.d.ts +0 -10
  207. package/lib/internal/keyboard/navigation.js +0 -14
  208. package/lib/internal/useNoInteractiveChildren.js +7 -0
  209. package/lib/internal/useOutsideClick.js +3 -0
  210. package/lib/internal/wrapFocus.d.ts +49 -0
  211. package/lib/internal/wrapFocus.js +66 -53
  212. package/lib/tools/events.d.ts +17 -0
  213. package/lib/tools/events.js +10 -13
  214. package/lib/tools/mapPopoverAlign.d.ts +15 -0
  215. package/lib/tools/mapPopoverAlign.js +32 -0
  216. package/lib/tools/uniqueId.d.ts +7 -0
  217. package/lib/tools/uniqueId.js +3 -3
  218. package/lib/types/common.d.ts +0 -2
  219. package/package.json +9 -9
  220. package/telemetry.yml +3 -1
  221. package/es/tools/createPropAdapter.js +0 -40
  222. package/lib/tools/createPropAdapter.js +0 -44
@@ -10,33 +10,45 @@
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  var React = require('react');
13
- var navigation = require('./keyboard/navigation.js');
14
13
  var tabbable = require('tabbable');
14
+ var navigation = require('./keyboard/navigation.js');
15
15
 
16
16
  /**
17
- * @param {Node} node A DOM node.
18
- * @param {string[]} selectorsFloatingMenus The CSS selectors that matches floating menus.
19
- * @returns {boolean} `true` of the given `node` is in a floating menu.
17
+ * A flag `node.compareDocumentPosition(target)` returns that indicates
18
+ * `target` is located earlier than `node` in the document or `target` contains `node`.
20
19
  */
21
- function elementOrParentIsFloatingMenu(node) {
20
+ const DOCUMENT_POSITION_BROAD_PRECEDING = typeof Node !== 'undefined' ? Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_CONTAINS : 0;
21
+
22
+ /**
23
+ * A flag `node.compareDocumentPosition(target)` returns that indicates
24
+ * `target` is located later than `node` in the document or `node` contains `target`.
25
+ */
26
+ const DOCUMENT_POSITION_BROAD_FOLLOWING = typeof Node !== 'undefined' ? Node.DOCUMENT_POSITION_FOLLOWING | Node.DOCUMENT_POSITION_CONTAINED_BY : 0;
27
+
28
+ /**
29
+ * Checks whether the given node or one of its ancestors matches any of the
30
+ * specified floating menu selectors.
31
+ *
32
+ * @param {Node} node - A DOM node.
33
+ * @param {string[]} selectorsFloatingMenus - Additional CSS selectors that
34
+ * match floating menus.
35
+ * @returns {boolean} Whether the node or one of its ancestors is in a floating
36
+ * menu.
37
+ */
38
+ const elementOrParentIsFloatingMenu = function (node) {
22
39
  let selectorsFloatingMenus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
23
- if (node && typeof node.closest === 'function') {
24
- const allSelectorsFloatingMenus = [`.cds--overflow-menu-options`, `.cds--tooltip`, '.flatpickr-calendar', ...selectorsFloatingMenus];
25
- return allSelectorsFloatingMenus.some(selector => node.closest(selector));
40
+ if (node instanceof Element && typeof node.closest === 'function') {
41
+ const allSelectorsFloatingMenus = ['.cds--overflow-menu-options', '.cds--tooltip', '.flatpickr-calendar', ...selectorsFloatingMenus];
42
+ return allSelectorsFloatingMenus.some(selector => !!node.closest(selector));
26
43
  }
27
- }
44
+ return false;
45
+ };
28
46
 
29
47
  /**
30
- * Ensures the focus is kept in the given `modalNode`, implementing "focus-wrap" behavior.
31
- * @param {object} options The options.
32
- * @param {Node|null} options.bodyNode
33
- * @param {Node|null} options.startTrapNode The DOM node of the focus sentinel the is placed earlier next to `modalNode`.
34
- * @param {Node|null} options.endTrapNode The DOM node of the focus sentinel the is placed next to `modalNode`.
35
- * @param {Node} options.currentActiveNode The DOM node that has focus.
36
- * @param {Node} options.oldActiveNode The DOM node that previously had focus.
37
- * @param {string[]} [options.selectorsFloatingMenus] The CSS selectors that matches floating menus.
48
+ * Ensures the focus is kept within the given container by implementing
49
+ * "focus-wrap" behavior.
38
50
  */
39
- function wrapFocus(_ref) {
51
+ const wrapFocus = _ref => {
40
52
  let {
41
53
  bodyNode,
42
54
  startTrapNode,
@@ -47,60 +59,61 @@ function wrapFocus(_ref) {
47
59
  } = _ref;
48
60
  if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus)) {
49
61
  const comparisonResult = oldActiveNode.compareDocumentPosition(currentActiveNode);
50
- if (currentActiveNode === startTrapNode || comparisonResult & navigation.DOCUMENT_POSITION_BROAD_PRECEDING) {
51
- const tabbable = [...bodyNode.querySelectorAll(navigation.selectorTabbable)].reverse().find(elem => Boolean(elem.offsetParent));
52
- if (tabbable) {
53
- tabbable.focus();
62
+ if (currentActiveNode === startTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_PRECEDING) {
63
+ const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).reverse().find(_ref2 => {
64
+ let {
65
+ offsetParent
66
+ } = _ref2;
67
+ return Boolean(offsetParent);
68
+ });
69
+ if (tabbableElement) {
70
+ tabbableElement.focus();
54
71
  } else if (bodyNode !== oldActiveNode) {
55
72
  bodyNode.focus();
56
73
  }
57
- } else if (currentActiveNode === endTrapNode || comparisonResult & navigation.DOCUMENT_POSITION_BROAD_FOLLOWING) {
58
- const tabbable = Array.prototype.find.call(bodyNode.querySelectorAll(navigation.selectorTabbable), elem => Boolean(elem.offsetParent));
59
- if (tabbable) {
60
- tabbable.focus();
74
+ } else if (currentActiveNode === endTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_FOLLOWING) {
75
+ const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).find(_ref3 => {
76
+ let {
77
+ offsetParent
78
+ } = _ref3;
79
+ return Boolean(offsetParent);
80
+ });
81
+ if (tabbableElement) {
82
+ tabbableElement.focus();
61
83
  } else if (bodyNode !== oldActiveNode) {
62
84
  bodyNode.focus();
63
85
  }
64
86
  }
65
87
  }
66
- }
88
+ };
67
89
 
68
90
  /**
69
- * Ensures the focus is kept in the given `containerNode`, implementing "focus-wrap" behavior.
70
- * Note: This must be called *before* focus moves using onKeyDown or similar.
71
- * @param {object} options The options.
72
- * @param {Node|null} options.containerNode
73
- * @param {EventTarget} options.currentActiveNode The DOM node that has focus.
74
- * @param {React.KeyboardEvent} options.event The DOM event
91
+ * Ensures the focus is kept in the given container, implementing "focus-wrap"
92
+ * behavior.
93
+ *
94
+ * Note: This must be called *before* focus moves using `onKeyDown` or similar.
75
95
  */
76
- function wrapFocusWithoutSentinels(_ref2) {
96
+ const wrapFocusWithoutSentinels = _ref4 => {
77
97
  let {
78
98
  containerNode,
79
99
  currentActiveNode,
80
100
  event
81
- } = _ref2;
82
- if (['blur', 'focusout', 'focusin', 'focus'].includes(event.type) && process.env.NODE_ENV !== 'production') {
83
- // eslint-disable-next-line react-hooks/rules-of-hooks
84
- React.useEffect(() => {
101
+ } = _ref4;
102
+ if (!containerNode) return;
103
+ React.useEffect(() => {
104
+ if (['blur', 'focusout', 'focusin', 'focus'].includes(event.type) && process.env.NODE_ENV !== 'production') {
85
105
  throw new Error(`Error: wrapFocusWithoutSentinels(...) called in unsupported ${event.type} event.\n\nCall wrapFocusWithoutSentinels(...) from onKeyDown instead.`);
86
- });
87
- }
106
+ }
107
+ }, []);
88
108
 
89
- // The reason we're using tabbable is because it returns the tabbable
90
- // items *in tab order*, whereas using our `selectorTabbable` only
91
- // returns in DOM order
109
+ // Use `tabbable` to get the focusable elements in tab order.
110
+ // `selectorTabbable` returns elements in DOM order which is why it's not
111
+ // used.
92
112
  const tabbables = tabbable.tabbable(containerNode);
93
113
  const firstTabbable = tabbables[0];
94
114
  const lastTabbable = tabbables[tabbables.length - 1];
95
115
 
96
- // console.log(`---------------------------------`);
97
- // console.log(containerNode);
98
- // console.log(tabbables);
99
- // console.log(firstTabbable);
100
- // console.log(lastTabbable);
101
- // console.log(currentActiveNode);
102
-
103
- // The shift key is used to determine if focus is moving forwards or backwards
116
+ // The shift key indicates if focus is moving forwards or backwards.
104
117
  if (currentActiveNode === lastTabbable && !event.shiftKey) {
105
118
  // Cancel the current movement of focus because we're going to place it ourselves
106
119
  event.preventDefault();
@@ -111,8 +124,8 @@ function wrapFocusWithoutSentinels(_ref2) {
111
124
  event.preventDefault();
112
125
  lastTabbable.focus();
113
126
  }
114
- }
127
+ };
115
128
 
116
- exports["default"] = wrapFocus;
117
129
  exports.elementOrParentIsFloatingMenu = elementOrParentIsFloatingMenu;
130
+ exports.wrapFocus = wrapFocus;
118
131
  exports.wrapFocusWithoutSentinels = wrapFocusWithoutSentinels;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import type { SyntheticEvent } from 'react';
8
+ /**
9
+ * Composes multiple event handler functions into a single event handler. The
10
+ * composed handler calls each provided function sequentially with the event and
11
+ * any additional arguments. If any handler calls `event.preventDefault()`,
12
+ * further handlers are skipped.
13
+ *
14
+ * @param handlers - An array of event handler functions.
15
+ * @returns A composite event handler.
16
+ */
17
+ export declare const composeEventHandlers: <E extends SyntheticEvent = SyntheticEvent<Element, Event>>(handlers: (((event: E, ...args: any[]) => void) | undefined)[]) => (event: E, ...args: any[]) => void;
@@ -9,28 +9,25 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
- // @ts-check
13
-
14
12
  /**
15
- * Generic utility to compose event handlers so that consumers can supply their
16
- * own event listeners on table components. The default heuristic here is to
17
- * iterate through the given functions until `preventDefault` is called on the
18
- * given event.
13
+ * Composes multiple event handler functions into a single event handler. The
14
+ * composed handler calls each provided function sequentially with the event and
15
+ * any additional arguments. If any handler calls `event.preventDefault()`,
16
+ * further handlers are skipped.
19
17
  *
20
- * @param {Array<Function|undefined>} fns array of functions to apply to the event
21
- * @returns {any}
18
+ * @param handlers - An array of event handler functions.
19
+ * @returns A composite event handler.
22
20
  */
23
- const composeEventHandlers = fns => function (event) {
21
+ const composeEventHandlers = handlers => function (event) {
24
22
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
25
23
  args[_key - 1] = arguments[_key];
26
24
  }
27
- for (let i = 0; i < fns.length; i++) {
25
+ for (const handler of handlers) {
28
26
  if (event.defaultPrevented) {
29
27
  break;
30
28
  }
31
- const fn = fns[i];
32
- if (typeof fn === 'function') {
33
- fn(event, ...args);
29
+ if (typeof handler === 'function') {
30
+ handler(event, ...args);
34
31
  }
35
32
  }
36
33
  };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import type { Placement } from '@floating-ui/react';
8
+ /**
9
+ * Maps popover alignment values to their corresponding replacement values.
10
+ *
11
+ * @param align - The original align value.
12
+ * @returns The new align value based on mapping or the original align if no
13
+ * mapping exists.
14
+ */
15
+ export declare const mapPopoverAlign: (align: string) => Placement;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ const popoverAlignMapping = {
13
+ 'top-left': 'top-start',
14
+ 'top-right': 'top-end',
15
+ 'bottom-left': 'bottom-start',
16
+ 'bottom-right': 'bottom-end',
17
+ 'left-bottom': 'left-end',
18
+ 'left-top': 'left-start',
19
+ 'right-bottom': 'right-end',
20
+ 'right-top': 'right-start'
21
+ };
22
+
23
+ /**
24
+ * Maps popover alignment values to their corresponding replacement values.
25
+ *
26
+ * @param align - The original align value.
27
+ * @returns The new align value based on mapping or the original align if no
28
+ * mapping exists.
29
+ */
30
+ const mapPopoverAlign = align => popoverAlignMapping[align] ?? align;
31
+
32
+ exports.mapPopoverAlign = mapPopoverAlign;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ export declare const uniqueId: (prefix?: string) => string;
@@ -10,10 +10,10 @@
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  let lastId = 0;
13
- function uniqueId() {
13
+ const uniqueId = function () {
14
14
  let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'id';
15
15
  lastId++;
16
16
  return `${prefix}${lastId}`;
17
- }
17
+ };
18
18
 
19
- exports["default"] = uniqueId;
19
+ exports.uniqueId = uniqueId;
@@ -6,8 +6,6 @@
6
6
  */
7
7
  import * as React from 'react';
8
8
  export type ReactAttr<T = HTMLElement> = React.HTMLAttributes<T>;
9
- export type ForwardRefProps<T, P = unknown> = React.PropsWithoutRef<React.PropsWithChildren<P>> & React.RefAttributes<T>;
10
- export type ForwardRefReturn<T, P = unknown> = React.ForwardRefExoticComponent<ForwardRefProps<T, P>>;
11
9
  /**
12
10
  * For "as" props. Creates an "as" property that supports native html tags such as 'span', 'a', 'button' as well as custom functional components
13
11
  * All native props for the supplied html tag/component are inferred as part of the base component props, allowing us to use props like `href` on an 'a' element etc
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/react",
3
3
  "description": "React components for the Carbon Design System",
4
- "version": "1.81.0-rc.0",
4
+ "version": "1.82.0-rc.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -53,9 +53,10 @@
53
53
  "dependencies": {
54
54
  "@babel/runtime": "^7.24.7",
55
55
  "@carbon/feature-flags": "^0.26.0",
56
- "@carbon/icons-react": "^11.59.0-rc.0",
57
- "@carbon/layout": "^11.33.0-rc.0",
58
- "@carbon/styles": "^1.80.0-rc.0",
56
+ "@carbon/icons-react": "^11.60.0-rc.0",
57
+ "@carbon/layout": "^11.34.0-rc.0",
58
+ "@carbon/styles": "^1.81.0-rc.0",
59
+ "@carbon/utilities": "^0.5.0",
59
60
  "@floating-ui/react": "^0.27.4",
60
61
  "@ibm/telemetry-js": "^1.5.0",
61
62
  "classnames": "2.5.1",
@@ -79,9 +80,9 @@
79
80
  "@babel/preset-env": "^7.24.7",
80
81
  "@babel/preset-react": "^7.24.7",
81
82
  "@babel/preset-typescript": "^7.24.7",
82
- "@carbon/test-utils": "^10.36.0-rc.0",
83
- "@carbon/themes": "^11.51.0-rc.0",
84
- "@figma/code-connect": "^1.2.4",
83
+ "@carbon/test-utils": "^10.36.0",
84
+ "@carbon/themes": "^11.52.0-rc.0",
85
+ "@figma/code-connect": "^1.3.2",
85
86
  "@rollup/plugin-babel": "^6.0.0",
86
87
  "@rollup/plugin-commonjs": "^28.0.0",
87
88
  "@rollup/plugin-node-resolve": "^15.0.0",
@@ -92,7 +93,6 @@
92
93
  "@storybook/addon-docs": "^8.4.7",
93
94
  "@storybook/addon-essentials": "^8.4.7",
94
95
  "@storybook/addon-links": "^8.4.7",
95
- "@storybook/addon-storysource": "^8.4.7",
96
96
  "@storybook/addon-webpack5-compiler-babel": "^3.0.3",
97
97
  "@storybook/blocks": "^8.4.7",
98
98
  "@storybook/manager-api": "^8.4.7",
@@ -147,5 +147,5 @@
147
147
  "**/*.scss",
148
148
  "**/*.css"
149
149
  ],
150
- "gitHead": "679420306589ea6cb50db59d208c7039020ebb4f"
150
+ "gitHead": "3b78e2acacf62b0a9e5425e5f3b43e6798cd209f"
151
151
  }
package/telemetry.yml CHANGED
@@ -172,6 +172,7 @@ collect:
172
172
  - orientation
173
173
  - overflowMenuOnHover
174
174
  - page
175
+ - pageActions
175
176
  - paragraph
176
177
  - passiveModal
177
178
  - pattern
@@ -457,7 +458,8 @@ collect:
457
458
  - wrapperClassName
458
459
  # PageHeaderContent
459
460
  - contextualActions
460
- - pageActions
461
+ # PageHeaderContentPageActions
462
+ - menuButtonLabel
461
463
  # PageSelector
462
464
  - currentPage
463
465
  - totalPages
@@ -1,40 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2023
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- /**
9
- * Create an adapter that converts an object of props with potentially deprecated
10
- * prop names to the replacement prop names in a newer version. Useful for guarding
11
- * against breaking changes when a prop has been renamed
12
- *
13
- * @param {Array} spec - an array of options which specify a text or regex
14
- * matcher alongside a replacement if there is a match
15
- * @returns {Function}
16
- */
17
- function mapPopoverAlignProp(align) {
18
- switch (align) {
19
- case 'top-left':
20
- return 'top-start';
21
- case 'top-right':
22
- return 'top-end';
23
- case 'bottom-left':
24
- return 'bottom-start';
25
- case 'bottom-right':
26
- return 'bottom-end';
27
- case 'left-bottom':
28
- return 'left-end';
29
- case 'left-top':
30
- return 'left-start';
31
- case 'right-bottom':
32
- return 'right-end';
33
- case 'right-top':
34
- return 'right-start';
35
- default:
36
- return align;
37
- }
38
- }
39
-
40
- export { mapPopoverAlignProp };
@@ -1,44 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2023
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- 'use strict';
9
-
10
- Object.defineProperty(exports, '__esModule', { value: true });
11
-
12
- /**
13
- * Create an adapter that converts an object of props with potentially deprecated
14
- * prop names to the replacement prop names in a newer version. Useful for guarding
15
- * against breaking changes when a prop has been renamed
16
- *
17
- * @param {Array} spec - an array of options which specify a text or regex
18
- * matcher alongside a replacement if there is a match
19
- * @returns {Function}
20
- */
21
- function mapPopoverAlignProp(align) {
22
- switch (align) {
23
- case 'top-left':
24
- return 'top-start';
25
- case 'top-right':
26
- return 'top-end';
27
- case 'bottom-left':
28
- return 'bottom-start';
29
- case 'bottom-right':
30
- return 'bottom-end';
31
- case 'left-bottom':
32
- return 'left-end';
33
- case 'left-top':
34
- return 'left-start';
35
- case 'right-bottom':
36
- return 'right-end';
37
- case 'right-top':
38
- return 'right-start';
39
- default:
40
- return align;
41
- }
42
- }
43
-
44
- exports.mapPopoverAlignProp = mapPopoverAlignProp;