@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.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +784 -784
- package/es/components/AILabel/index.d.ts +1 -1
- package/es/components/AILabel/index.js +2 -9
- package/es/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/es/components/Breadcrumb/Breadcrumb.js +4 -4
- package/es/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
- package/es/components/Breadcrumb/BreadcrumbItem.js +5 -4
- package/es/components/Button/Button.js +2 -10
- package/es/components/ButtonSet/ButtonSet.d.ts +2 -3
- package/es/components/ButtonSet/ButtonSet.js +4 -4
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +3 -19
- package/es/components/ComboBox/ComboBox.d.ts +1 -1
- package/es/components/ComboBox/ComboBox.js +54 -32
- package/es/components/ComboButton/index.d.ts +1 -1
- package/es/components/ComboButton/index.js +2 -18
- package/es/components/ComposedModal/ComposedModal.js +5 -3
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/Copy/Copy.js +2 -18
- package/es/components/CopyButton/CopyButton.d.ts +1 -1
- package/es/components/CopyButton/CopyButton.js +2 -18
- package/es/components/DataTable/DataTable.d.ts +7 -12
- package/es/components/DataTable/DataTable.js +0 -5
- package/es/components/DataTable/TableCell.js +28 -4
- package/es/components/DataTable/TableToolbarAction.d.ts +2 -4
- package/es/components/DataTable/TableToolbarAction.js +5 -4
- package/es/components/DataTable/tools/cells.d.ts +13 -0
- package/es/components/DataTable/tools/cells.js +3 -6
- package/es/components/DataTable/tools/filter.d.ts +26 -0
- package/es/components/DataTable/tools/filter.js +8 -17
- package/es/components/DataTable/tools/sorting.d.ts +42 -0
- package/es/components/DataTable/tools/sorting.js +24 -53
- package/es/components/DatePicker/DatePicker.d.ts +1 -1
- package/es/components/DatePicker/DatePicker.js +19 -19
- package/es/components/Dialog/index.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
- package/es/components/Dropdown/Dropdown.Skeleton.js +2 -2
- package/es/components/Dropdown/Dropdown.d.ts +7 -6
- package/es/components/Dropdown/Dropdown.js +13 -9
- package/es/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +1 -1
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +5 -6
- package/es/components/FluidDropdown/FluidDropdown.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.d.ts +3 -6
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IconButton/index.js +2 -18
- package/es/components/ListBox/ListBox.d.ts +4 -5
- package/es/components/ListBox/ListBox.js +8 -7
- package/es/components/ListBox/ListBoxMenu.d.ts +4 -4
- package/es/components/ListBox/ListBoxMenu.js +4 -2
- package/es/components/ListBox/ListBoxMenuItem.d.ts +9 -8
- package/es/components/ListBox/ListBoxPropTypes.d.ts +3 -3
- package/es/components/ListBox/ListBoxPropTypes.js +3 -3
- package/es/components/ListBox/index.d.ts +7 -5
- package/es/components/ListBox/index.js +1 -1
- package/es/components/Menu/Menu.js +9 -14
- package/es/components/Menu/MenuItem.js +15 -4
- package/es/components/Modal/Modal.js +9 -9
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +3 -2
- package/es/components/MultiSelect/MultiSelect.d.ts +8 -2
- package/es/components/MultiSelect/MultiSelect.js +7 -4
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +2 -21
- package/es/components/OverflowMenu/index.d.ts +1 -1
- package/es/components/OverflowMenu/index.js +2 -3
- package/es/components/OverflowMenu/next/index.js +2 -18
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +5 -4
- package/es/components/PageHeader/PageHeader.d.ts +160 -8
- package/es/components/PageHeader/PageHeader.js +155 -21
- package/es/components/PageHeader/index.d.ts +2 -2
- package/es/components/PageHeader/index.js +1 -1
- package/es/components/Popover/index.js +4 -21
- package/es/components/Search/Search.d.ts +2 -5
- package/es/components/Search/Search.js +24 -8
- package/es/components/Stack/HStack.d.ts +2 -3
- package/es/components/Stack/HStack.js +4 -7
- package/es/components/Stack/Stack.d.ts +3 -4
- package/es/components/Stack/Stack.js +3 -6
- package/es/components/Stack/VStack.d.ts +2 -3
- package/es/components/Stack/VStack.js +3 -2
- package/es/components/Stack/index.d.ts +4 -4
- package/es/components/TextArea/TextArea.js +3 -5
- package/es/components/TimePicker/TimePicker.d.ts +3 -4
- package/es/components/TimePicker/TimePicker.js +5 -4
- package/es/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
- package/es/components/TimePickerSelect/TimePickerSelect.js +5 -4
- package/es/components/TreeView/TreeNode.js +13 -1
- package/es/components/TreeView/TreeView.js +1 -1
- package/es/index.js +1 -1
- package/es/internal/FloatingMenu.js +9 -5
- package/es/internal/environment.js +7 -0
- package/es/internal/keyboard/navigation.d.ts +0 -10
- package/es/internal/keyboard/navigation.js +1 -13
- package/es/internal/useId.js +1 -1
- package/es/internal/useNoInteractiveChildren.js +7 -0
- package/es/internal/useOutsideClick.js +3 -0
- package/es/internal/wrapFocus.d.ts +49 -0
- package/es/internal/wrapFocus.js +64 -51
- package/es/tools/events.d.ts +17 -0
- package/es/tools/events.js +10 -13
- package/es/tools/mapPopoverAlign.d.ts +15 -0
- package/es/tools/mapPopoverAlign.js +28 -0
- package/es/tools/uniqueId.d.ts +7 -0
- package/es/tools/uniqueId.js +3 -3
- package/es/types/common.d.ts +0 -2
- package/lib/components/AILabel/index.d.ts +1 -1
- package/lib/components/AILabel/index.js +2 -9
- package/lib/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/lib/components/Breadcrumb/Breadcrumb.js +3 -3
- package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
- package/lib/components/Breadcrumb/BreadcrumbItem.js +4 -3
- package/lib/components/Button/Button.js +1 -9
- package/lib/components/ButtonSet/ButtonSet.d.ts +2 -3
- package/lib/components/ButtonSet/ButtonSet.js +3 -3
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +3 -19
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.js +53 -31
- package/lib/components/ComboButton/index.d.ts +1 -1
- package/lib/components/ComboButton/index.js +2 -18
- package/lib/components/ComposedModal/ComposedModal.js +5 -3
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/Copy/Copy.js +2 -18
- package/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/lib/components/CopyButton/CopyButton.js +2 -18
- package/lib/components/DataTable/DataTable.d.ts +7 -12
- package/lib/components/DataTable/DataTable.js +0 -5
- package/lib/components/DataTable/TableCell.js +28 -3
- package/lib/components/DataTable/TableToolbarAction.d.ts +2 -4
- package/lib/components/DataTable/TableToolbarAction.js +4 -3
- package/lib/components/DataTable/tools/cells.d.ts +13 -0
- package/lib/components/DataTable/tools/cells.js +3 -6
- package/lib/components/DataTable/tools/filter.d.ts +26 -0
- package/lib/components/DataTable/tools/filter.js +8 -17
- package/lib/components/DataTable/tools/sorting.d.ts +42 -0
- package/lib/components/DataTable/tools/sorting.js +23 -53
- package/lib/components/DatePicker/DatePicker.d.ts +1 -1
- package/lib/components/DatePicker/DatePicker.js +19 -19
- package/lib/components/Dialog/index.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
- package/lib/components/Dropdown/Dropdown.Skeleton.js +1 -1
- package/lib/components/Dropdown/Dropdown.d.ts +7 -6
- package/lib/components/Dropdown/Dropdown.js +12 -8
- package/lib/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +1 -1
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +4 -5
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.d.ts +3 -6
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/IconButton/index.js +2 -18
- package/lib/components/ListBox/ListBox.d.ts +4 -5
- package/lib/components/ListBox/ListBox.js +7 -6
- package/lib/components/ListBox/ListBoxMenu.d.ts +4 -4
- package/lib/components/ListBox/ListBoxMenu.js +3 -1
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +9 -8
- package/lib/components/ListBox/ListBoxPropTypes.d.ts +3 -3
- package/lib/components/ListBox/ListBoxPropTypes.js +4 -4
- package/lib/components/ListBox/index.d.ts +7 -5
- package/lib/components/ListBox/index.js +2 -2
- package/lib/components/Menu/Menu.js +9 -14
- package/lib/components/Menu/MenuItem.js +15 -4
- package/lib/components/Modal/Modal.js +9 -9
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -1
- package/lib/components/MultiSelect/MultiSelect.d.ts +8 -2
- package/lib/components/MultiSelect/MultiSelect.js +6 -3
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -21
- package/lib/components/OverflowMenu/index.d.ts +1 -1
- package/lib/components/OverflowMenu/index.js +2 -3
- package/lib/components/OverflowMenu/next/index.js +2 -18
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +4 -3
- package/lib/components/PageHeader/PageHeader.d.ts +160 -8
- package/lib/components/PageHeader/PageHeader.js +159 -19
- package/lib/components/PageHeader/index.d.ts +2 -2
- package/lib/components/PageHeader/index.js +6 -0
- package/lib/components/Popover/index.js +4 -21
- package/lib/components/Search/Search.d.ts +2 -5
- package/lib/components/Search/Search.js +24 -8
- package/lib/components/Stack/HStack.d.ts +2 -3
- package/lib/components/Stack/HStack.js +3 -6
- package/lib/components/Stack/Stack.d.ts +3 -4
- package/lib/components/Stack/Stack.js +2 -5
- package/lib/components/Stack/VStack.d.ts +2 -3
- package/lib/components/Stack/VStack.js +2 -1
- package/lib/components/Stack/index.d.ts +4 -4
- package/lib/components/TextArea/TextArea.js +2 -4
- package/lib/components/TimePicker/TimePicker.d.ts +3 -4
- package/lib/components/TimePicker/TimePicker.js +4 -3
- package/lib/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
- package/lib/components/TimePickerSelect/TimePickerSelect.js +4 -3
- package/lib/components/TreeView/TreeNode.js +13 -1
- package/lib/components/TreeView/TreeView.js +1 -1
- package/lib/index.js +2 -2
- package/lib/internal/FloatingMenu.js +9 -5
- package/lib/internal/environment.js +7 -0
- package/lib/internal/keyboard/navigation.d.ts +0 -10
- package/lib/internal/keyboard/navigation.js +0 -14
- package/lib/internal/useNoInteractiveChildren.js +7 -0
- package/lib/internal/useOutsideClick.js +3 -0
- package/lib/internal/wrapFocus.d.ts +49 -0
- package/lib/internal/wrapFocus.js +66 -53
- package/lib/tools/events.d.ts +17 -0
- package/lib/tools/events.js +10 -13
- package/lib/tools/mapPopoverAlign.d.ts +15 -0
- package/lib/tools/mapPopoverAlign.js +32 -0
- package/lib/tools/uniqueId.d.ts +7 -0
- package/lib/tools/uniqueId.js +3 -3
- package/lib/types/common.d.ts +0 -2
- package/package.json +9 -9
- package/telemetry.yml +3 -1
- package/es/tools/createPropAdapter.js +0 -40
- 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
|
-
*
|
|
18
|
-
*
|
|
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
|
-
|
|
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 = [
|
|
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
|
|
31
|
-
*
|
|
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
|
-
|
|
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 &
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
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 &
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
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
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
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
|
-
|
|
96
|
+
const wrapFocusWithoutSentinels = _ref4 => {
|
|
77
97
|
let {
|
|
78
98
|
containerNode,
|
|
79
99
|
currentActiveNode,
|
|
80
100
|
event
|
|
81
|
-
} =
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
//
|
|
90
|
-
//
|
|
91
|
-
//
|
|
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
|
-
//
|
|
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;
|
package/lib/tools/events.js
CHANGED
|
@@ -9,28 +9,25 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
-
// @ts-check
|
|
13
|
-
|
|
14
12
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
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
|
|
21
|
-
* @returns
|
|
18
|
+
* @param handlers - An array of event handler functions.
|
|
19
|
+
* @returns A composite event handler.
|
|
22
20
|
*/
|
|
23
|
-
const composeEventHandlers =
|
|
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 (
|
|
25
|
+
for (const handler of handlers) {
|
|
28
26
|
if (event.defaultPrevented) {
|
|
29
27
|
break;
|
|
30
28
|
}
|
|
31
|
-
|
|
32
|
-
|
|
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;
|
package/lib/tools/uniqueId.js
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
let lastId = 0;
|
|
13
|
-
function
|
|
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
|
|
19
|
+
exports.uniqueId = uniqueId;
|
package/lib/types/common.d.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
57
|
-
"@carbon/layout": "^11.
|
|
58
|
-
"@carbon/styles": "^1.
|
|
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
|
|
83
|
-
"@carbon/themes": "^11.
|
|
84
|
-
"@figma/code-connect": "^1.2
|
|
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": "
|
|
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
|
-
|
|
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;
|