@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
|
@@ -17,12 +17,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
17
17
|
|
|
18
18
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
19
|
|
|
20
|
-
const HStack = /*#__PURE__*/React__default["default"].forwardRef(function HStack(props, ref) {
|
|
21
|
-
return /*#__PURE__*/React__default["default"].createElement(Stack.Stack, _rollupPluginBabelHelpers["extends"]({}, props, {
|
|
22
|
-
ref: ref,
|
|
23
|
-
orientation: "horizontal"
|
|
24
|
-
}));
|
|
25
|
-
});
|
|
26
20
|
const VStack = /*#__PURE__*/React__default["default"].forwardRef(function VStack(props, ref) {
|
|
27
21
|
return /*#__PURE__*/React__default["default"].createElement(Stack.Stack, _rollupPluginBabelHelpers["extends"]({}, props, {
|
|
28
22
|
ref: ref,
|
|
@@ -30,6 +24,4 @@ const VStack = /*#__PURE__*/React__default["default"].forwardRef(function VStack
|
|
|
30
24
|
}));
|
|
31
25
|
});
|
|
32
26
|
|
|
33
|
-
exports.Stack = Stack.Stack;
|
|
34
|
-
exports.HStack = HStack;
|
|
35
27
|
exports.VStack = VStack;
|
|
@@ -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';
|
|
@@ -144,6 +144,10 @@ export interface StructuredListRowProps extends DivAttrs {
|
|
|
144
144
|
* Provide a handler that is invoked on the key down event for the control
|
|
145
145
|
*/
|
|
146
146
|
onKeyDown?(event: KeyboardEvent): void;
|
|
147
|
+
/**
|
|
148
|
+
* Mark if this row should be selectable
|
|
149
|
+
*/
|
|
150
|
+
selection?: boolean;
|
|
147
151
|
}
|
|
148
152
|
export declare function StructuredListRow(props: StructuredListRowProps): import("react/jsx-runtime").JSX.Element;
|
|
149
153
|
export declare namespace StructuredListRow {
|
|
@@ -172,6 +176,10 @@ export declare namespace StructuredListRow {
|
|
|
172
176
|
* Provide a handler that is invoked on the key down event for the control,
|
|
173
177
|
*/
|
|
174
178
|
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
179
|
+
/**
|
|
180
|
+
* Mark if this row should be selectable
|
|
181
|
+
*/
|
|
182
|
+
selection: PropTypes.Requireable<boolean>;
|
|
175
183
|
};
|
|
176
184
|
}
|
|
177
185
|
export interface StructuredListInputProps extends DivAttrs {
|
|
@@ -17,6 +17,8 @@ var useId = require('../../internal/useId.js');
|
|
|
17
17
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
19
|
require('../Text/index.js');
|
|
20
|
+
var iconsReact = require('@carbon/icons-react');
|
|
21
|
+
var useOutsideClick = require('../../internal/useOutsideClick.js');
|
|
20
22
|
var Text = require('../Text/Text.js');
|
|
21
23
|
|
|
22
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -25,6 +27,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
25
27
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
26
28
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
27
29
|
|
|
30
|
+
var _StructuredListCell, _RadioButtonChecked, _RadioButton;
|
|
28
31
|
const GridSelectedRowStateContext = /*#__PURE__*/React__default["default"].createContext(null);
|
|
29
32
|
const GridSelectedRowDispatchContext = /*#__PURE__*/React__default["default"].createContext(null);
|
|
30
33
|
function StructuredListWrapper(props) {
|
|
@@ -147,6 +150,7 @@ function StructuredListRow(props) {
|
|
|
147
150
|
className,
|
|
148
151
|
head,
|
|
149
152
|
onClick,
|
|
153
|
+
selection,
|
|
150
154
|
...other
|
|
151
155
|
} = props;
|
|
152
156
|
const [hasFocusWithin, setHasFocusWithin] = React.useState(false);
|
|
@@ -159,25 +163,35 @@ function StructuredListRow(props) {
|
|
|
159
163
|
};
|
|
160
164
|
const classes = cx__default["default"](`${prefix}--structured-list-row`, {
|
|
161
165
|
[`${prefix}--structured-list-row--header-row`]: head,
|
|
162
|
-
[`${prefix}--structured-list-row--focused-within`]: hasFocusWithin,
|
|
166
|
+
[`${prefix}--structured-list-row--focused-within`]: hasFocusWithin && !selection || hasFocusWithin && selection && (selectedRow === id || selectedRow === null),
|
|
167
|
+
// Ensure focus on the first item when navigating through Tab keys and no row is selected (selectedRow === null)
|
|
163
168
|
[`${prefix}--structured-list-row--selected`]: selectedRow === id
|
|
164
169
|
}, className);
|
|
170
|
+
const itemRef = React.useRef(null);
|
|
171
|
+
const handleClick = () => {
|
|
172
|
+
setHasFocusWithin(false);
|
|
173
|
+
};
|
|
174
|
+
useOutsideClick.useOutsideClick(itemRef, handleClick);
|
|
165
175
|
return head ? /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
166
176
|
role: "row"
|
|
167
177
|
}, other, {
|
|
168
|
-
className: classes
|
|
169
|
-
|
|
170
|
-
|
|
178
|
+
className: classes
|
|
179
|
+
}), selection && (_StructuredListCell || (_StructuredListCell = /*#__PURE__*/React__default["default"].createElement(StructuredListCell, {
|
|
180
|
+
head: true
|
|
181
|
+
}))), children) :
|
|
171
182
|
/*#__PURE__*/
|
|
172
183
|
// eslint-disable-next-line jsx-a11y/interactive-supports-focus
|
|
173
|
-
React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
174
|
-
"aria-busy": "true"
|
|
175
|
-
}, other, {
|
|
184
|
+
React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, other, {
|
|
176
185
|
role: "row",
|
|
177
186
|
className: classes,
|
|
187
|
+
ref: itemRef,
|
|
178
188
|
onClick: event => {
|
|
179
189
|
setSelectedRow?.(id);
|
|
180
190
|
onClick && onClick(event);
|
|
191
|
+
if (selection) {
|
|
192
|
+
// focus items only when selection is enabled
|
|
193
|
+
setHasFocusWithin(true);
|
|
194
|
+
}
|
|
181
195
|
},
|
|
182
196
|
onFocus: () => {
|
|
183
197
|
setHasFocusWithin(true);
|
|
@@ -188,7 +202,7 @@ function StructuredListRow(props) {
|
|
|
188
202
|
onKeyDown: onKeyDown
|
|
189
203
|
}), /*#__PURE__*/React__default["default"].createElement(GridRowContext.Provider, {
|
|
190
204
|
value: value
|
|
191
|
-
}, children));
|
|
205
|
+
}, selection && /*#__PURE__*/React__default["default"].createElement(StructuredListCell, null, selectedRow === id ? _RadioButtonChecked || (_RadioButtonChecked = /*#__PURE__*/React__default["default"].createElement(iconsReact.RadioButtonChecked, null)) : _RadioButton || (_RadioButton = /*#__PURE__*/React__default["default"].createElement(iconsReact.RadioButton, null))), children));
|
|
192
206
|
}
|
|
193
207
|
StructuredListRow.propTypes = {
|
|
194
208
|
/**
|
|
@@ -214,7 +228,11 @@ StructuredListRow.propTypes = {
|
|
|
214
228
|
/**
|
|
215
229
|
* Provide a handler that is invoked on the key down event for the control,
|
|
216
230
|
*/
|
|
217
|
-
onKeyDown: PropTypes__default["default"].func
|
|
231
|
+
onKeyDown: PropTypes__default["default"].func,
|
|
232
|
+
/**
|
|
233
|
+
* Mark if this row should be selectable
|
|
234
|
+
*/
|
|
235
|
+
selection: PropTypes__default["default"].bool
|
|
218
236
|
};
|
|
219
237
|
function StructuredListInput(props) {
|
|
220
238
|
const defaultId = useId.useId('structureListInput');
|
|
@@ -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/feature-flags.js
CHANGED
|
@@ -34,5 +34,6 @@ FeatureFlags__namespace.merge({
|
|
|
34
34
|
'enable-css-grid': true,
|
|
35
35
|
'enable-v11-release': true,
|
|
36
36
|
'enable-experimental-tile-contrast': false,
|
|
37
|
-
'enable-v12-tile-radio-icons': false
|
|
37
|
+
'enable-v12-tile-radio-icons': false,
|
|
38
|
+
'enable-v12-structured-list-visible-icons': false
|
|
38
39
|
});
|
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",
|
|
@@ -14,6 +14,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
14
14
|
*
|
|
15
15
|
* @see https://github.com/facebook/fbjs/blob/4d1751311d3f67af2dcce2e40df8512a23c7b9c6/packages/fbjs/src/core/ExecutionEnvironment.js#L12
|
|
16
16
|
*/
|
|
17
|
-
const canUseDOM = !!(typeof window !== 'undefined' &&
|
|
17
|
+
const canUseDOM = !!(typeof window !== 'undefined' &&
|
|
18
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
19
|
+
window.document &&
|
|
20
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
21
|
+
window.document.createElement);
|
|
18
22
|
|
|
19
23
|
exports.canUseDOM = canUseDOM;
|
|
@@ -43,7 +43,9 @@ const getNextIndex = (key, index, arrayLength) => {
|
|
|
43
43
|
*/
|
|
44
44
|
const DOCUMENT_POSITION_BROAD_PRECEDING =
|
|
45
45
|
// Checks `typeof Node` for `react-docgen`
|
|
46
|
-
typeof Node !== 'undefined' &&
|
|
46
|
+
typeof Node !== 'undefined' &&
|
|
47
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
48
|
+
Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_CONTAINS;
|
|
47
49
|
|
|
48
50
|
/**
|
|
49
51
|
* A flag `node.compareDocumentPosition(target)` returns,
|
|
@@ -51,7 +53,9 @@ typeof Node !== 'undefined' && Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_
|
|
|
51
53
|
*/
|
|
52
54
|
const DOCUMENT_POSITION_BROAD_FOLLOWING =
|
|
53
55
|
// Checks `typeof Node` for `react-docgen`
|
|
54
|
-
typeof Node !== 'undefined' &&
|
|
56
|
+
typeof Node !== 'undefined' &&
|
|
57
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
58
|
+
Node.DOCUMENT_POSITION_FOLLOWING | Node.DOCUMENT_POSITION_CONTAINED_BY;
|
|
55
59
|
|
|
56
60
|
/**
|
|
57
61
|
* CSS selector that selects major nodes that are sequential-focusable.
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
var React = require('react');
|
|
13
|
+
var useEvent = require('./useEvent.js');
|
|
14
|
+
var environment = require('./environment.js');
|
|
15
|
+
|
|
16
|
+
function useOutsideClick(ref, callback) {
|
|
17
|
+
const savedCallback = React.useRef(callback);
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
savedCallback.current = callback;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// We conditionally guard the `useEvent` hook for SSR. `canUseDOM` can be
|
|
23
|
+
// treated as a constant as it will be false when executed in a Node.js
|
|
24
|
+
// environment and true when executed in the browser
|
|
25
|
+
if (environment.canUseDOM) {
|
|
26
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
27
|
+
useEvent.useEvent(window, 'click', event => {
|
|
28
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
29
|
+
savedCallback.current(event);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
exports.useOutsideClick = useOutsideClick;
|