@carbon/react 1.53.1 → 1.54.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 +1009 -1096
- 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 +1 -1
- 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/Modal/Modal.js +14 -5
- 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/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/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/index.d.ts +1 -0
- package/es/index.js +5 -4
- package/es/internal/FloatingMenu.js +26 -5
- package/es/internal/wrapFocus.js +51 -1
- package/es/tools/createPropAdapter.js +40 -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 +1 -1
- 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/Modal/Modal.js +14 -5
- 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/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/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/index.d.ts +1 -0
- package/lib/index.js +15 -14
- package/lib/internal/FloatingMenu.js +44 -4
- package/lib/internal/wrapFocus.js +51 -0
- package/lib/tools/createPropAdapter.js +44 -0
- package/package.json +9 -7
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
declare const HStack: ForwardRefReturn<ReactNode>;
|
|
11
|
-
declare const VStack: ForwardRefReturn<ReactNode>;
|
|
12
|
-
export { HStack, Stack, VStack };
|
|
7
|
+
export { HStack } from './HStack';
|
|
8
|
+
export { VStack } from './VStack';
|
|
9
|
+
export { Stack, type StackProps } from './Stack';
|
|
@@ -13,7 +13,6 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var RadioTile = require('../RadioTile/RadioTile.js');
|
|
16
|
-
var warning = require('../../internal/warning.js');
|
|
17
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
17
|
var noopFn = require('../../internal/noopFn.js');
|
|
19
18
|
|
|
@@ -45,28 +44,35 @@ const TileGroup = props => {
|
|
|
45
44
|
setSelected(valueSelected);
|
|
46
45
|
setPrevValueSelected(valueSelected);
|
|
47
46
|
}
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
47
|
+
const getRadioTilesWithWrappers = children => {
|
|
48
|
+
const traverseAndModifyChildren = children => {
|
|
49
|
+
return React__default["default"].Children.map(children, child => {
|
|
50
|
+
// If RadioTile found, return it with necessary props
|
|
51
|
+
if (child.type === RadioTile["default"]) {
|
|
52
|
+
const {
|
|
53
|
+
value,
|
|
54
|
+
...otherProps
|
|
55
|
+
} = child.props;
|
|
56
|
+
return /*#__PURE__*/React__default["default"].createElement(RadioTile["default"], _rollupPluginBabelHelpers["extends"]({}, otherProps, {
|
|
57
|
+
name: name,
|
|
58
|
+
key: value,
|
|
59
|
+
value: value,
|
|
60
|
+
onChange: handleChange,
|
|
61
|
+
checked: value === selected
|
|
62
|
+
}));
|
|
63
|
+
} else if (child.props && child.props.children) {
|
|
64
|
+
// If the child is not RadioTile and has children, recheck the children
|
|
65
|
+
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
66
|
+
...child.props,
|
|
67
|
+
children: traverseAndModifyChildren(child.props.children)
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
// If the child is neither a RadioTile nor has children, return it as is
|
|
71
|
+
return child;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, traverseAndModifyChildren(children));
|
|
70
76
|
};
|
|
71
77
|
const handleChange = (newSelection, value, evt) => {
|
|
72
78
|
if (newSelection !== selected) {
|
|
@@ -84,7 +90,7 @@ const TileGroup = props => {
|
|
|
84
90
|
return /*#__PURE__*/React__default["default"].createElement("fieldset", {
|
|
85
91
|
className: className ?? `${prefix}--tile-group`,
|
|
86
92
|
disabled: disabled
|
|
87
|
-
}, renderLegend(legend), /*#__PURE__*/React__default["default"].createElement("div", null,
|
|
93
|
+
}, renderLegend(legend), /*#__PURE__*/React__default["default"].createElement("div", null, getRadioTilesWithWrappers(children)));
|
|
88
94
|
};
|
|
89
95
|
TileGroup.propTypes = {
|
|
90
96
|
/**
|
|
@@ -89,24 +89,7 @@ export type ToggleTipButtonProps<T extends React.ElementType> = PolymorphicProps
|
|
|
89
89
|
* `ToggletipButton` controls the visibility of the Toggletip through mouse
|
|
90
90
|
* clicks and keyboard interactions.
|
|
91
91
|
*/
|
|
92
|
-
export declare
|
|
93
|
-
export declare namespace ToggletipButton {
|
|
94
|
-
var propTypes: {
|
|
95
|
-
/**
|
|
96
|
-
* Custom children to be rendered as the content of the label
|
|
97
|
-
*/
|
|
98
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
99
|
-
/**
|
|
100
|
-
* Provide a custom class name to be added to the outermost node in the
|
|
101
|
-
* component
|
|
102
|
-
*/
|
|
103
|
-
className: PropTypes.Requireable<string>;
|
|
104
|
-
/**
|
|
105
|
-
* Provide an accessible label for this button
|
|
106
|
-
*/
|
|
107
|
-
label: PropTypes.Requireable<string>;
|
|
108
|
-
};
|
|
109
|
-
}
|
|
92
|
+
export declare const ToggletipButton: React.ForwardRefExoticComponent<Omit<ToggleTipButtonProps<React.ElementType<any>>, "ref"> & React.RefAttributes<unknown>>;
|
|
110
93
|
interface ToggletipContentProps {
|
|
111
94
|
children?: ReactNode;
|
|
112
95
|
className?: string | undefined;
|
|
@@ -160,7 +160,28 @@ Toggletip.propTypes = {
|
|
|
160
160
|
/**
|
|
161
161
|
* Specify how the toggletip should align with the button
|
|
162
162
|
*/
|
|
163
|
-
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
163
|
+
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
164
|
+
// deprecated use top-start instead
|
|
165
|
+
'top-right',
|
|
166
|
+
// deprecated use top-end instead
|
|
167
|
+
|
|
168
|
+
'bottom', 'bottom-left',
|
|
169
|
+
// deprecated use bottom-start instead
|
|
170
|
+
'bottom-right',
|
|
171
|
+
// deprecated use bottom-end instead
|
|
172
|
+
|
|
173
|
+
'left', 'left-bottom',
|
|
174
|
+
// deprecated use left-end instead
|
|
175
|
+
'left-top',
|
|
176
|
+
// deprecated use left-start instead
|
|
177
|
+
|
|
178
|
+
'right', 'right-bottom',
|
|
179
|
+
// deprecated use right-end instead
|
|
180
|
+
'right-top',
|
|
181
|
+
// deprecated use right-start instead
|
|
182
|
+
|
|
183
|
+
// new values to match floating-ui
|
|
184
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
164
185
|
/**
|
|
165
186
|
* Provide a custom element or component to render the top-level node for the
|
|
166
187
|
* component.
|
|
@@ -188,7 +209,7 @@ Toggletip.propTypes = {
|
|
|
188
209
|
* `ToggletipButton` controls the visibility of the Toggletip through mouse
|
|
189
210
|
* clicks and keyboard interactions.
|
|
190
211
|
*/
|
|
191
|
-
function ToggletipButton(_ref3) {
|
|
212
|
+
const ToggletipButton = /*#__PURE__*/React__default["default"].forwardRef(function ToggletipButton(_ref3, ref) {
|
|
192
213
|
let {
|
|
193
214
|
children,
|
|
194
215
|
className: customClassName,
|
|
@@ -208,9 +229,10 @@ function ToggletipButton(_ref3) {
|
|
|
208
229
|
return /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({}, toggletip?.buttonProps, {
|
|
209
230
|
"aria-label": label,
|
|
210
231
|
type: "button",
|
|
211
|
-
className: className
|
|
232
|
+
className: className,
|
|
233
|
+
ref: ref
|
|
212
234
|
}, rest), children);
|
|
213
|
-
}
|
|
235
|
+
});
|
|
214
236
|
ToggletipButton.propTypes = {
|
|
215
237
|
/**
|
|
216
238
|
* Custom children to be rendered as the content of the label
|
|
@@ -226,6 +248,7 @@ ToggletipButton.propTypes = {
|
|
|
226
248
|
*/
|
|
227
249
|
label: PropTypes__default["default"].string
|
|
228
250
|
};
|
|
251
|
+
ToggletipButton.displayName = 'ToggletipButton';
|
|
229
252
|
/**
|
|
230
253
|
* `ToggletipContent` is a wrapper around `PopoverContent`. It places the
|
|
231
254
|
* `children` passed in as a prop inside of `PopoverContent` so that they will
|
|
@@ -44,7 +44,6 @@ function Tooltip(_ref) {
|
|
|
44
44
|
closeOnActivation = false,
|
|
45
45
|
...rest
|
|
46
46
|
} = _ref;
|
|
47
|
-
const containerRef = React.useRef(null);
|
|
48
47
|
const tooltipRef = React.useRef(null);
|
|
49
48
|
const [open, setOpen] = useDelayedState.useDelayedState(defaultOpen);
|
|
50
49
|
const [isDragging, setIsDragging] = React.useState(false);
|
|
@@ -140,8 +139,7 @@ function Tooltip(_ref) {
|
|
|
140
139
|
highContrast: true,
|
|
141
140
|
onKeyDown: onKeyDown,
|
|
142
141
|
onMouseLeave: onMouseLeave,
|
|
143
|
-
open: open
|
|
144
|
-
ref: containerRef
|
|
142
|
+
open: open
|
|
145
143
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
146
144
|
className: `${prefix}--tooltip-trigger__wrapper`
|
|
147
145
|
}, child !== undefined ? /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
@@ -151,7 +149,6 @@ function Tooltip(_ref) {
|
|
|
151
149
|
"aria-hidden": open ? 'false' : 'true',
|
|
152
150
|
className: `${prefix}--tooltip-content`,
|
|
153
151
|
id: id,
|
|
154
|
-
ref: tooltipRef,
|
|
155
152
|
role: "tooltip"
|
|
156
153
|
}, label || description));
|
|
157
154
|
}
|
|
@@ -159,7 +156,28 @@ Tooltip.propTypes = {
|
|
|
159
156
|
/**
|
|
160
157
|
* Specify how the trigger should align with the tooltip
|
|
161
158
|
*/
|
|
162
|
-
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
159
|
+
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
160
|
+
// deprecated use top-start instead
|
|
161
|
+
'top-right',
|
|
162
|
+
// deprecated use top-end instead
|
|
163
|
+
|
|
164
|
+
'bottom', 'bottom-left',
|
|
165
|
+
// deprecated use bottom-start instead
|
|
166
|
+
'bottom-right',
|
|
167
|
+
// deprecated use bottom-end instead
|
|
168
|
+
|
|
169
|
+
'left', 'left-bottom',
|
|
170
|
+
// deprecated use left-end instead
|
|
171
|
+
'left-top',
|
|
172
|
+
// deprecated use left-start instead
|
|
173
|
+
|
|
174
|
+
'right', 'right-bottom',
|
|
175
|
+
// deprecated use right-end instead
|
|
176
|
+
'right-top',
|
|
177
|
+
// deprecated use right-start instead
|
|
178
|
+
|
|
179
|
+
// new values to match floating-ui
|
|
180
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
163
181
|
/**
|
|
164
182
|
* Pass in the child to which the tooltip will be applied
|
|
165
183
|
*/
|
package/lib/index.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ export * from './components/SkeletonIcon';
|
|
|
74
74
|
export * from './components/SkeletonPlaceholder';
|
|
75
75
|
export * from './components/SkeletonText';
|
|
76
76
|
export * from './components/Slider';
|
|
77
|
+
export * from './components/Stack';
|
|
77
78
|
export * from './components/StructuredList';
|
|
78
79
|
export * from './components/Switch';
|
|
79
80
|
export * from './components/Tab';
|
package/lib/index.js
CHANGED
|
@@ -77,6 +77,7 @@ var NumberInput = require('./components/NumberInput/NumberInput.js');
|
|
|
77
77
|
var OrderedList = require('./components/OrderedList/OrderedList.js');
|
|
78
78
|
var index$9 = require('./components/OverflowMenu/index.js');
|
|
79
79
|
var OverflowMenuItem = require('./components/OverflowMenuItem/OverflowMenuItem.js');
|
|
80
|
+
var Pagination$1 = require('./components/Pagination/Pagination.js');
|
|
80
81
|
var Pagination_Skeleton = require('./components/Pagination/Pagination.Skeleton.js');
|
|
81
82
|
var PaginationNav = require('./components/PaginationNav/PaginationNav.js');
|
|
82
83
|
var PrimaryButton = require('./components/PrimaryButton/PrimaryButton.js');
|
|
@@ -85,6 +86,7 @@ var ProgressIndicator = require('./components/ProgressIndicator/ProgressIndicato
|
|
|
85
86
|
var RadioButton = require('./components/RadioButton/RadioButton.js');
|
|
86
87
|
var RadioButton_Skeleton = require('./components/RadioButton/RadioButton.Skeleton.js');
|
|
87
88
|
var RadioButtonGroup = require('./components/RadioButtonGroup/RadioButtonGroup.js');
|
|
89
|
+
var RadioTile = require('./components/RadioTile/RadioTile.js');
|
|
88
90
|
var Search = require('./components/Search/Search.js');
|
|
89
91
|
var Search_Skeleton = require('./components/Search/Search.Skeleton.js');
|
|
90
92
|
var SecondaryButton = require('./components/SecondaryButton/SecondaryButton.js');
|
|
@@ -96,6 +98,9 @@ var SkeletonIcon = require('./components/SkeletonIcon/SkeletonIcon.js');
|
|
|
96
98
|
var SkeletonPlaceholder = require('./components/SkeletonPlaceholder/SkeletonPlaceholder.js');
|
|
97
99
|
var SkeletonText = require('./components/SkeletonText/SkeletonText.js');
|
|
98
100
|
var index$a = require('./components/Slider/index.js');
|
|
101
|
+
var HStack = require('./components/Stack/HStack.js');
|
|
102
|
+
var VStack = require('./components/Stack/VStack.js');
|
|
103
|
+
var Stack = require('./components/Stack/Stack.js');
|
|
99
104
|
var StructuredList = require('./components/StructuredList/StructuredList.js');
|
|
100
105
|
var StructuredList_Skeleton = require('./components/StructuredList/StructuredList.Skeleton.js');
|
|
101
106
|
var Switch = require('./components/Switch/Switch.js');
|
|
@@ -158,11 +163,10 @@ var index$3 = require('./components/Slug/index.js');
|
|
|
158
163
|
var AiSkeletonPlaceholder = require('./components/AiSkeleton/AiSkeletonPlaceholder.js');
|
|
159
164
|
var AiSkeletonIcon = require('./components/AiSkeleton/AiSkeletonIcon.js');
|
|
160
165
|
var AiSkeletonText = require('./components/AiSkeleton/AiSkeletonText.js');
|
|
161
|
-
var index$h = require('./components/Stack/index.js');
|
|
162
166
|
var DefinitionTooltip = require('./components/Tooltip/DefinitionTooltip.js');
|
|
163
167
|
var Tooltip = require('./components/Tooltip/Tooltip.js');
|
|
164
168
|
require('./components/Text/index.js');
|
|
165
|
-
var index$
|
|
169
|
+
var index$h = require('./components/Theme/index.js');
|
|
166
170
|
var usePrefix = require('./internal/usePrefix.js');
|
|
167
171
|
var useIdPrefix = require('./internal/useIdPrefix.js');
|
|
168
172
|
var FluidDatePicker_Skeleton = require('./components/FluidDatePicker/FluidDatePicker.Skeleton.js');
|
|
@@ -225,12 +229,9 @@ var TableToolbarSearch = require('./components/DataTable/TableToolbarSearch.js')
|
|
|
225
229
|
var TableToolbarMenu = require('./components/DataTable/TableToolbarMenu.js');
|
|
226
230
|
var FilterableMultiSelect = require('./components/MultiSelect/FilterableMultiSelect.js');
|
|
227
231
|
var MultiSelect = require('./components/MultiSelect/MultiSelect.js');
|
|
228
|
-
var Pagination$1 = require('./components/Pagination/Pagination.js');
|
|
229
232
|
var ControlledPasswordInput = require('./components/TextInput/ControlledPasswordInput.js');
|
|
230
233
|
var PasswordInput = require('./components/TextInput/PasswordInput.js');
|
|
231
|
-
var RadioTile = require('./components/RadioTile/RadioTile.js');
|
|
232
234
|
var TreeNode = require('./components/TreeView/TreeNode.js');
|
|
233
|
-
var Stack = require('./components/Stack/Stack.js');
|
|
234
235
|
|
|
235
236
|
|
|
236
237
|
|
|
@@ -314,6 +315,7 @@ exports.NumberInput = NumberInput.NumberInput;
|
|
|
314
315
|
exports.OrderedList = OrderedList["default"];
|
|
315
316
|
exports.OverflowMenu = index$9["default"];
|
|
316
317
|
exports.OverflowMenuItem = OverflowMenuItem["default"];
|
|
318
|
+
exports.Pagination = Pagination$1["default"];
|
|
317
319
|
exports.PaginationSkeleton = Pagination_Skeleton["default"];
|
|
318
320
|
exports.PaginationNav = PaginationNav["default"];
|
|
319
321
|
exports.PrimaryButton = PrimaryButton["default"];
|
|
@@ -323,6 +325,7 @@ exports.ProgressStep = ProgressIndicator.ProgressStep;
|
|
|
323
325
|
exports.RadioButton = RadioButton["default"];
|
|
324
326
|
exports.RadioButtonSkeleton = RadioButton_Skeleton["default"];
|
|
325
327
|
exports.RadioButtonGroup = RadioButtonGroup["default"];
|
|
328
|
+
exports.RadioTile = RadioTile["default"];
|
|
326
329
|
exports.Search = Search["default"];
|
|
327
330
|
exports.SearchSkeleton = Search_Skeleton["default"];
|
|
328
331
|
exports.SecondaryButton = SecondaryButton["default"];
|
|
@@ -334,6 +337,9 @@ exports.SkeletonIcon = SkeletonIcon["default"];
|
|
|
334
337
|
exports.SkeletonPlaceholder = SkeletonPlaceholder["default"];
|
|
335
338
|
exports.SkeletonText = SkeletonText["default"];
|
|
336
339
|
exports.Slider = index$a["default"];
|
|
340
|
+
exports.HStack = HStack.HStack;
|
|
341
|
+
exports.VStack = VStack.VStack;
|
|
342
|
+
exports.Stack = Stack.Stack;
|
|
337
343
|
exports.StructuredListBody = StructuredList.StructuredListBody;
|
|
338
344
|
exports.StructuredListCell = StructuredList.StructuredListCell;
|
|
339
345
|
exports.StructuredListHead = StructuredList.StructuredListHead;
|
|
@@ -422,14 +428,12 @@ exports.unstable__SlugContent = index$3.SlugContent;
|
|
|
422
428
|
exports.unstable__AiSkeletonPlaceholder = AiSkeletonPlaceholder["default"];
|
|
423
429
|
exports.unstable__AiSkeletonIcon = AiSkeletonIcon["default"];
|
|
424
430
|
exports.unstable__AiSkeletonText = AiSkeletonText["default"];
|
|
425
|
-
exports.HStack = index$h.HStack;
|
|
426
|
-
exports.VStack = index$h.VStack;
|
|
427
431
|
exports.DefinitionTooltip = DefinitionTooltip.DefinitionTooltip;
|
|
428
432
|
exports.Tooltip = Tooltip.Tooltip;
|
|
429
|
-
exports.GlobalTheme = index$
|
|
430
|
-
exports.Theme = index$
|
|
431
|
-
exports.ThemeContext = index$
|
|
432
|
-
exports.useTheme = index$
|
|
433
|
+
exports.GlobalTheme = index$h.GlobalTheme;
|
|
434
|
+
exports.Theme = index$h.Theme;
|
|
435
|
+
exports.ThemeContext = index$h.ThemeContext;
|
|
436
|
+
exports.useTheme = index$h.useTheme;
|
|
433
437
|
exports.PrefixContext = usePrefix.PrefixContext;
|
|
434
438
|
exports.usePrefix = usePrefix.usePrefix;
|
|
435
439
|
exports.useIdPrefix = useIdPrefix.useIdPrefix;
|
|
@@ -493,9 +497,6 @@ exports.TableToolbarSearch = TableToolbarSearch["default"];
|
|
|
493
497
|
exports.TableToolbarMenu = TableToolbarMenu["default"];
|
|
494
498
|
exports.FilterableMultiSelect = FilterableMultiSelect["default"];
|
|
495
499
|
exports.MultiSelect = MultiSelect["default"];
|
|
496
|
-
exports.Pagination = Pagination$1["default"];
|
|
497
500
|
exports.ControlledPasswordInput = ControlledPasswordInput["default"];
|
|
498
501
|
exports.PasswordInput = PasswordInput["default"];
|
|
499
|
-
exports.RadioTile = RadioTile["default"];
|
|
500
502
|
exports.TreeNode = TreeNode["default"];
|
|
501
|
-
exports.Stack = Stack.Stack;
|
|
@@ -19,13 +19,35 @@ var navigation = require('./keyboard/navigation.js');
|
|
|
19
19
|
var warning = require('./warning.js');
|
|
20
20
|
var wrapFocus = require('./wrapFocus.js');
|
|
21
21
|
var usePrefix = require('./usePrefix.js');
|
|
22
|
+
var FeatureFlags = require('@carbon/feature-flags');
|
|
23
|
+
var match = require('./keyboard/match.js');
|
|
24
|
+
var keys = require('./keyboard/keys.js');
|
|
22
25
|
|
|
23
26
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
27
|
|
|
28
|
+
function _interopNamespace(e) {
|
|
29
|
+
if (e && e.__esModule) return e;
|
|
30
|
+
var n = Object.create(null);
|
|
31
|
+
if (e) {
|
|
32
|
+
Object.keys(e).forEach(function (k) {
|
|
33
|
+
if (k !== 'default') {
|
|
34
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
35
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return e[k]; }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
n["default"] = e;
|
|
43
|
+
return Object.freeze(n);
|
|
44
|
+
}
|
|
45
|
+
|
|
25
46
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
26
47
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
27
48
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
28
49
|
var window__default = /*#__PURE__*/_interopDefaultLegacy(window);
|
|
50
|
+
var FeatureFlags__namespace = /*#__PURE__*/_interopNamespace(FeatureFlags);
|
|
29
51
|
|
|
30
52
|
/**
|
|
31
53
|
* The structure for the position of floating menu.
|
|
@@ -359,6 +381,19 @@ class FloatingMenu extends React__default["default"].Component {
|
|
|
359
381
|
});
|
|
360
382
|
}
|
|
361
383
|
});
|
|
384
|
+
/**
|
|
385
|
+
* Keydown handler for when focus wrap behavior is enabled
|
|
386
|
+
* @param {Event} event
|
|
387
|
+
*/
|
|
388
|
+
_rollupPluginBabelHelpers.defineProperty(this, "handleKeyDown", event => {
|
|
389
|
+
if (match.match(event, keys.Tab) && this._menuBody) {
|
|
390
|
+
wrapFocus.wrapFocusWithoutSentinels({
|
|
391
|
+
containerNode: this._menuBody,
|
|
392
|
+
currentActiveNode: event.target,
|
|
393
|
+
event
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
});
|
|
362
397
|
}
|
|
363
398
|
componentWillUnmount() {
|
|
364
399
|
this.hResize.release();
|
|
@@ -387,19 +422,24 @@ class FloatingMenu extends React__default["default"].Component {
|
|
|
387
422
|
const {
|
|
388
423
|
context: prefix
|
|
389
424
|
} = this;
|
|
425
|
+
const focusTrapWithoutSentinels = FeatureFlags__namespace.enabled('enable-experimental-focus-wrap-without-sentinels');
|
|
390
426
|
if (typeof document !== 'undefined') {
|
|
391
427
|
const {
|
|
392
428
|
focusTrap,
|
|
393
429
|
target
|
|
394
430
|
} = this.props;
|
|
395
|
-
return /*#__PURE__*/ReactDOM__default["default"].createPortal(
|
|
396
|
-
|
|
397
|
-
|
|
431
|
+
return /*#__PURE__*/ReactDOM__default["default"].createPortal(
|
|
432
|
+
/*#__PURE__*/
|
|
433
|
+
//eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
434
|
+
React__default["default"].createElement("div", {
|
|
435
|
+
onBlur: focusTrap && !focusTrapWithoutSentinels ? this.handleBlur : () => {},
|
|
436
|
+
onKeyDown: focusTrapWithoutSentinels ? this.handleKeyDown : () => {}
|
|
437
|
+
}, !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
398
438
|
ref: this.startSentinel,
|
|
399
439
|
tabIndex: "0",
|
|
400
440
|
role: "link",
|
|
401
441
|
className: `${prefix}--visually-hidden`
|
|
402
|
-
}, "Focus sentinel"), this._getChildrenWithProps(), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
442
|
+
}, "Focus sentinel"), this._getChildrenWithProps(), !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
403
443
|
ref: this.endSentinel,
|
|
404
444
|
tabIndex: "0",
|
|
405
445
|
role: "link",
|
|
@@ -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-rc.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-rc.0",
|
|
52
|
+
"@carbon/icons-react": "^11.39.0-rc.0",
|
|
53
53
|
"@carbon/layout": "^11.21.0",
|
|
54
|
-
"@carbon/styles": "^1.
|
|
54
|
+
"@carbon/styles": "^1.54.0-rc.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-rc.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": "4e0c7c56e1217ff9b73042006e4ea1d12a39e769"
|
|
143
145
|
}
|