@carbon/react 1.53.1 → 1.54.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 +981 -1068
- package/es/components/Button/Button.d.ts +1 -1
- package/es/components/Button/Button.js +13 -89
- package/es/components/Button/ButtonBase.d.ts +10 -0
- package/es/components/Button/ButtonBase.js +110 -0
- package/es/components/CodeSnippet/CodeSnippet.js +1 -0
- package/es/components/ComboBox/ComboBox.js +13 -4
- package/es/components/ComboButton/index.js +1 -1
- package/es/components/ComposedModal/ComposedModal.js +19 -10
- package/es/components/DataTable/DataTable.js +1 -1
- package/es/components/DataTable/TableBatchAction.d.ts +1 -1
- package/es/components/DataTable/TableToolbarMenu.d.ts +5 -1
- package/es/components/DataTable/TableToolbarMenu.js +7 -0
- package/es/components/DatePicker/DatePicker.d.ts +4 -0
- package/es/components/DatePicker/DatePicker.js +37 -0
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IconButton/index.js +3 -4
- package/es/components/ListBox/ListBox.d.ts +8 -0
- package/es/components/ListBox/ListBox.js +15 -3
- package/es/components/Loading/Loading.d.ts +1 -1
- package/es/components/Menu/Menu.js +2 -0
- package/es/components/Modal/Modal.js +14 -5
- package/es/components/ModalWrapper/ModalWrapper.d.ts +1 -1
- package/es/components/Notification/Notification.js +18 -6
- package/es/components/Pagination/Pagination.Skeleton.d.ts +25 -0
- package/es/components/Pagination/Pagination.d.ts +102 -0
- package/es/components/Pagination/Pagination.js +13 -14
- package/es/components/Pagination/index.d.ts +10 -0
- package/es/components/Popover/index.d.ts +1 -1
- package/es/components/Popover/index.js +175 -108
- package/es/components/RadioTile/RadioTile.d.ts +55 -0
- package/es/components/RadioTile/RadioTile.js +17 -17
- package/es/components/RadioTile/index.d.ts +10 -0
- package/es/components/Slider/Slider.Skeleton.js +6 -2
- package/es/components/Slug/index.js +23 -2
- package/es/components/Stack/HStack.d.ts +10 -0
- package/es/components/Stack/HStack.js +23 -0
- package/es/components/Stack/Stack.d.ts +1 -1
- package/es/components/Stack/Stack.js +2 -2
- package/es/components/Stack/VStack.d.ts +10 -0
- package/es/components/Stack/{index.js → VStack.js} +1 -8
- package/es/components/Stack/index.d.ts +3 -6
- package/es/components/StructuredList/StructuredList.d.ts +8 -0
- package/es/components/StructuredList/StructuredList.js +28 -10
- package/es/components/TileGroup/TileGroup.js +30 -24
- package/es/components/Toggletip/index.d.ts +1 -18
- package/es/components/Toggletip/index.js +27 -4
- package/es/components/Tooltip/Tooltip.js +23 -5
- package/es/feature-flags.js +2 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +5 -4
- package/es/internal/FloatingMenu.js +26 -5
- package/es/internal/environment.js +5 -1
- package/es/internal/keyboard/navigation.js +6 -2
- package/es/internal/useOutsideClick.js +31 -0
- package/es/internal/wrapFocus.js +51 -1
- package/es/tools/createPropAdapter.js +40 -0
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/Button.js +13 -90
- package/lib/components/Button/ButtonBase.d.ts +10 -0
- package/lib/components/Button/ButtonBase.js +119 -0
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -0
- package/lib/components/ComboBox/ComboBox.js +13 -4
- package/lib/components/ComboButton/index.js +1 -1
- package/lib/components/ComposedModal/ComposedModal.js +17 -8
- package/lib/components/DataTable/DataTable.js +1 -1
- package/lib/components/DataTable/TableBatchAction.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarMenu.d.ts +5 -1
- package/lib/components/DataTable/TableToolbarMenu.js +7 -0
- package/lib/components/DatePicker/DatePicker.d.ts +4 -0
- package/lib/components/DatePicker/DatePicker.js +37 -0
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/IconButton/index.js +3 -4
- package/lib/components/ListBox/ListBox.d.ts +8 -0
- package/lib/components/ListBox/ListBox.js +15 -3
- package/lib/components/Loading/Loading.d.ts +1 -1
- package/lib/components/Menu/Menu.js +2 -0
- package/lib/components/Modal/Modal.js +14 -5
- package/lib/components/ModalWrapper/ModalWrapper.d.ts +1 -1
- package/lib/components/Notification/Notification.js +15 -3
- package/lib/components/Pagination/Pagination.Skeleton.d.ts +25 -0
- package/lib/components/Pagination/Pagination.d.ts +102 -0
- package/lib/components/Pagination/Pagination.js +13 -14
- package/lib/components/Pagination/index.d.ts +10 -0
- package/lib/components/Popover/index.d.ts +1 -1
- package/lib/components/Popover/index.js +174 -107
- package/lib/components/RadioTile/RadioTile.d.ts +55 -0
- package/lib/components/RadioTile/RadioTile.js +17 -17
- package/lib/components/RadioTile/index.d.ts +10 -0
- package/lib/components/Slider/Slider.Skeleton.js +5 -1
- package/lib/components/Slug/index.js +23 -2
- package/lib/components/Stack/HStack.d.ts +10 -0
- package/lib/components/Stack/HStack.js +31 -0
- package/lib/components/Stack/Stack.d.ts +1 -1
- package/lib/components/Stack/Stack.js +3 -3
- package/lib/components/Stack/VStack.d.ts +10 -0
- package/lib/components/Stack/{index.js → VStack.js} +0 -8
- package/lib/components/Stack/index.d.ts +3 -6
- package/lib/components/StructuredList/StructuredList.d.ts +8 -0
- package/lib/components/StructuredList/StructuredList.js +27 -9
- package/lib/components/TileGroup/TileGroup.js +30 -24
- package/lib/components/Toggletip/index.d.ts +1 -18
- package/lib/components/Toggletip/index.js +27 -4
- package/lib/components/Tooltip/Tooltip.js +23 -5
- package/lib/feature-flags.js +2 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +15 -14
- package/lib/internal/FloatingMenu.js +44 -4
- package/lib/internal/environment.js +5 -1
- package/lib/internal/keyboard/navigation.js +6 -2
- package/lib/internal/useOutsideClick.js +35 -0
- package/lib/internal/wrapFocus.js +51 -0
- package/lib/tools/createPropAdapter.js +44 -0
- package/package.json +9 -7
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
var findLast = require('lodash.findlast');
|
|
13
|
+
var React = require('react');
|
|
13
14
|
var navigation = require('./keyboard/navigation.js');
|
|
15
|
+
var tabbable = require('tabbable');
|
|
14
16
|
|
|
15
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
18
|
|
|
@@ -68,5 +70,54 @@ function wrapFocus(_ref) {
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Ensures the focus is kept in the given `containerNode`, implementing "focus-wrap" behavior.
|
|
75
|
+
* Note: This must be called *before* focus moves using onKeyDown or similar.
|
|
76
|
+
* @param {object} options The options.
|
|
77
|
+
* @param {Node|null} options.containerNode
|
|
78
|
+
* @param {EventTarget} options.currentActiveNode The DOM node that has focus.
|
|
79
|
+
* @param {KeyboardEvent} options.event The DOM event
|
|
80
|
+
*/
|
|
81
|
+
function wrapFocusWithoutSentinels(_ref2) {
|
|
82
|
+
let {
|
|
83
|
+
containerNode,
|
|
84
|
+
currentActiveNode,
|
|
85
|
+
event
|
|
86
|
+
} = _ref2;
|
|
87
|
+
if (['blur', 'focusout', 'focusin', 'focus'].includes(event.type) && process.env.NODE_ENV !== "production") {
|
|
88
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
89
|
+
React.useEffect(() => {
|
|
90
|
+
throw new Error(`Error: wrapFocusWithoutSentinels(...) called in unsupported ${event.type} event.\n\nCall wrapFocusWithoutSentinels(...) from onKeyDown instead.`);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// The reason we're using tabbable is because it returns the tabbable
|
|
95
|
+
// items *in tab order*, whereas using our `selectorTabbable` only
|
|
96
|
+
// returns in DOM order
|
|
97
|
+
const tabbables = tabbable.tabbable(containerNode);
|
|
98
|
+
const firstTabbable = tabbables[0];
|
|
99
|
+
const lastTabbable = tabbables[tabbables.length - 1];
|
|
100
|
+
|
|
101
|
+
// console.log(`---------------------------------`);
|
|
102
|
+
// console.log(containerNode);
|
|
103
|
+
// console.log(tabbables);
|
|
104
|
+
// console.log(firstTabbable);
|
|
105
|
+
// console.log(lastTabbable);
|
|
106
|
+
// console.log(currentActiveNode);
|
|
107
|
+
|
|
108
|
+
// The shift key is used to determine if focus is moving forwards or backwards
|
|
109
|
+
if (currentActiveNode === lastTabbable && !event.shiftKey) {
|
|
110
|
+
// Cancel the current movement of focus because we're going to place it ourselves
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
firstTabbable.focus();
|
|
113
|
+
}
|
|
114
|
+
if (currentActiveNode === firstTabbable && event.shiftKey) {
|
|
115
|
+
// Cancel the current movement of focus because we're going to place it ourselves
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
lastTabbable.focus();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
71
121
|
exports["default"] = wrapFocus;
|
|
72
122
|
exports.elementOrParentIsFloatingMenu = elementOrParentIsFloatingMenu;
|
|
123
|
+
exports.wrapFocusWithoutSentinels = wrapFocusWithoutSentinels;
|
|
@@ -0,0 +1,44 @@
|
|
|
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;
|
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.54.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -48,14 +48,15 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@babel/runtime": "^7.18.3",
|
|
51
|
-
"@carbon/feature-flags": "^0.
|
|
52
|
-
"@carbon/icons-react": "^11.
|
|
51
|
+
"@carbon/feature-flags": "^0.19.0",
|
|
52
|
+
"@carbon/icons-react": "^11.39.0",
|
|
53
53
|
"@carbon/layout": "^11.21.0",
|
|
54
|
-
"@carbon/styles": "^1.
|
|
54
|
+
"@carbon/styles": "^1.54.0",
|
|
55
|
+
"@floating-ui/react": "^0.25.4",
|
|
55
56
|
"@ibm/telemetry-js": "^1.2.1",
|
|
56
57
|
"classnames": "2.5.1",
|
|
57
58
|
"copy-to-clipboard": "^3.3.1",
|
|
58
|
-
"downshift": "8.
|
|
59
|
+
"downshift": "8.5.0",
|
|
59
60
|
"flatpickr": "4.6.13",
|
|
60
61
|
"invariant": "^2.2.3",
|
|
61
62
|
"lodash.debounce": "^4.0.8",
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
"lodash.throttle": "^4.1.1",
|
|
66
67
|
"prop-types": "^15.7.2",
|
|
67
68
|
"react-is": "^18.2.0",
|
|
69
|
+
"tabbable": "^6.2.0",
|
|
68
70
|
"use-resize-observer": "^6.0.0",
|
|
69
71
|
"wicg-inert": "^3.1.1",
|
|
70
72
|
"window-or-global": "^1.0.1"
|
|
@@ -79,7 +81,7 @@
|
|
|
79
81
|
"@babel/preset-react": "^7.22.3",
|
|
80
82
|
"@babel/preset-typescript": "^7.21.5",
|
|
81
83
|
"@carbon/test-utils": "^10.30.0",
|
|
82
|
-
"@carbon/themes": "^11.
|
|
84
|
+
"@carbon/themes": "^11.34.0",
|
|
83
85
|
"@rollup/plugin-babel": "^6.0.0",
|
|
84
86
|
"@rollup/plugin-commonjs": "^25.0.0",
|
|
85
87
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
@@ -139,5 +141,5 @@
|
|
|
139
141
|
"**/*.scss",
|
|
140
142
|
"**/*.css"
|
|
141
143
|
],
|
|
142
|
-
"gitHead": "
|
|
144
|
+
"gitHead": "4bdd6802dd612af764ef76162141333d35bd84f4"
|
|
143
145
|
}
|