@carbon/react 1.53.0 → 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 +1016 -1062
- package/es/components/AiSkeleton/AiSkeletonIcon.js +39 -0
- package/es/components/AiSkeleton/AiSkeletonPlaceholder.js +37 -0
- package/es/components/AiSkeleton/AiSkeletonText.js +51 -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 +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 +24 -13
- 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 +2 -0
- package/es/index.js +8 -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/AiSkeleton/AiSkeletonIcon.js +49 -0
- package/lib/components/AiSkeleton/AiSkeletonPlaceholder.js +47 -0
- package/lib/components/AiSkeleton/AiSkeletonText.js +61 -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 +24 -13
- 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 +2 -0
- package/lib/index.js +21 -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
|
@@ -26,7 +26,6 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
26
26
|
children,
|
|
27
27
|
className: customClassName,
|
|
28
28
|
disabled,
|
|
29
|
-
// eslint-disable-next-line no-unused-vars
|
|
30
29
|
light,
|
|
31
30
|
checked,
|
|
32
31
|
name,
|
|
@@ -70,9 +69,9 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
70
69
|
disabled: disabled,
|
|
71
70
|
id: inputId,
|
|
72
71
|
name: name,
|
|
73
|
-
onChange: !disabled ? handleOnChange :
|
|
74
|
-
onKeyDown: !disabled ? handleOnKeyDown :
|
|
75
|
-
tabIndex: !disabled ? tabIndex :
|
|
72
|
+
onChange: !disabled ? handleOnChange : undefined,
|
|
73
|
+
onKeyDown: !disabled ? handleOnKeyDown : undefined,
|
|
74
|
+
tabIndex: !disabled ? tabIndex : undefined,
|
|
76
75
|
type: "radio",
|
|
77
76
|
value: value,
|
|
78
77
|
ref: ref
|
|
@@ -85,49 +84,50 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
85
84
|
className: `${prefix}--tile-content`
|
|
86
85
|
}, children)));
|
|
87
86
|
});
|
|
87
|
+
RadioTile.displayName = 'RadioTile';
|
|
88
88
|
RadioTile.propTypes = {
|
|
89
89
|
/**
|
|
90
|
-
*
|
|
90
|
+
* Specify whether the `RadioTile` should be checked.
|
|
91
91
|
*/
|
|
92
92
|
checked: PropTypes.bool,
|
|
93
93
|
/**
|
|
94
|
-
* The
|
|
94
|
+
* The `RadioTile` content.
|
|
95
95
|
*/
|
|
96
96
|
children: PropTypes.node,
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
98
|
+
* Provide an optional `className` to be applied to the underlying `<label>`.
|
|
99
99
|
*/
|
|
100
100
|
className: PropTypes.string,
|
|
101
101
|
/**
|
|
102
|
-
* Specify whether the RadioTile should be disabled
|
|
102
|
+
* Specify whether the `RadioTile` should be disabled.
|
|
103
103
|
*/
|
|
104
104
|
disabled: PropTypes.bool,
|
|
105
105
|
/**
|
|
106
|
-
*
|
|
106
|
+
* Provide a unique id for the underlying `<input>`.
|
|
107
107
|
*/
|
|
108
108
|
id: PropTypes.string,
|
|
109
109
|
/**
|
|
110
|
-
* `true` to use the light version. For use on
|
|
110
|
+
* `true` to use the light version. For use on `$layer-01` backgrounds only.
|
|
111
111
|
* Don't use this to make tile background color same as container background color.
|
|
112
112
|
*/
|
|
113
|
-
light: deprecate(PropTypes.bool, 'The `light` prop for `RadioTile` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be
|
|
113
|
+
light: deprecate(PropTypes.bool, 'The `light` prop for `RadioTile` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
114
114
|
/**
|
|
115
|
-
*
|
|
115
|
+
* Provide a `name` for the underlying `<input>`.
|
|
116
116
|
*/
|
|
117
117
|
name: PropTypes.string,
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
119
|
+
* Provide an optional `onChange` hook that is called each time the value of
|
|
120
|
+
* the underlying `<input>` changes.
|
|
120
121
|
*/
|
|
121
122
|
onChange: PropTypes.func,
|
|
122
123
|
/**
|
|
123
|
-
* Specify the tab index of the
|
|
124
|
+
* Specify the tab index of the underlying `<input>`.
|
|
124
125
|
*/
|
|
125
126
|
tabIndex: PropTypes.number,
|
|
126
127
|
/**
|
|
127
|
-
*
|
|
128
|
+
* Specify the value of the underlying `<input>`.
|
|
128
129
|
*/
|
|
129
130
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
|
|
130
131
|
};
|
|
131
|
-
var RadioTile$1 = RadioTile;
|
|
132
132
|
|
|
133
|
-
export { RadioTile
|
|
133
|
+
export { RadioTile as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
import RadioTile, { RadioTileProps } from './RadioTile';
|
|
8
|
+
export default RadioTile;
|
|
9
|
+
export { RadioTile };
|
|
10
|
+
export type { RadioTileProps };
|
|
@@ -76,7 +76,6 @@ const Slug = /*#__PURE__*/React__default.forwardRef(function Slug(_ref3, ref) {
|
|
|
76
76
|
autoAlign = true,
|
|
77
77
|
children,
|
|
78
78
|
className,
|
|
79
|
-
dotType,
|
|
80
79
|
kind = 'default',
|
|
81
80
|
onRevertClick,
|
|
82
81
|
revertActive,
|
|
@@ -89,11 +88,6 @@ const Slug = /*#__PURE__*/React__default.forwardRef(function Slug(_ref3, ref) {
|
|
|
89
88
|
const id = useId('slug');
|
|
90
89
|
const slugClasses = cx(className, {
|
|
91
90
|
[`${prefix}--slug`]: true,
|
|
92
|
-
[`${prefix}--slug--hollow`]: kind === 'hollow' || dotType === 'hollow',
|
|
93
|
-
// Need to come up with a better name; explainable?
|
|
94
|
-
// Need to be able to target the non-hollow variant another way
|
|
95
|
-
// other than using `:not` all over the styles
|
|
96
|
-
[`${prefix}--slug--enabled`]: kind !== 'hollow' && dotType !== 'hollow',
|
|
97
91
|
[`${prefix}--slug--revert`]: revertActive
|
|
98
92
|
});
|
|
99
93
|
const slugButtonClasses = cx({
|
|
@@ -142,9 +136,30 @@ Slug.propTypes = {
|
|
|
142
136
|
/**
|
|
143
137
|
* Specify how the popover should align with the button
|
|
144
138
|
*/
|
|
145
|
-
align: PropTypes.oneOf(['top', 'top-left',
|
|
139
|
+
align: PropTypes.oneOf(['top', 'top-left',
|
|
140
|
+
// deprecated use top-start instead
|
|
141
|
+
'top-right',
|
|
142
|
+
// deprecated use top-end instead
|
|
143
|
+
|
|
144
|
+
'bottom', 'bottom-left',
|
|
145
|
+
// deprecated use bottom-start instead
|
|
146
|
+
'bottom-right',
|
|
147
|
+
// deprecated use bottom-end instead
|
|
148
|
+
|
|
149
|
+
'left', 'left-bottom',
|
|
150
|
+
// deprecated use left-end instead
|
|
151
|
+
'left-top',
|
|
152
|
+
// deprecated use left-start instead
|
|
153
|
+
|
|
154
|
+
'right', 'right-bottom',
|
|
155
|
+
// deprecated use right-end instead
|
|
156
|
+
'right-top',
|
|
157
|
+
// deprecated use right-start instead
|
|
158
|
+
|
|
159
|
+
// new values to match floating-ui
|
|
160
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
146
161
|
/**
|
|
147
|
-
* Will auto-align the popover
|
|
162
|
+
* Will auto-align the popover. This prop is currently experimental and is subject to future changes.
|
|
148
163
|
*/
|
|
149
164
|
autoAlign: PropTypes.bool,
|
|
150
165
|
/**
|
|
@@ -155,14 +170,10 @@ Slug.propTypes = {
|
|
|
155
170
|
* Specify an optional className to be added to the AI slug
|
|
156
171
|
*/
|
|
157
172
|
className: PropTypes.string,
|
|
158
|
-
/**
|
|
159
|
-
* Specify the type of dot that should be rendered in front of the inline variant
|
|
160
|
-
*/
|
|
161
|
-
dotType: PropTypes.oneOf(['default', 'hollow']),
|
|
162
173
|
/**
|
|
163
174
|
* Specify the type of Slug, from the following list of types:
|
|
164
175
|
*/
|
|
165
|
-
kind: PropTypes.oneOf(['default', '
|
|
176
|
+
kind: PropTypes.oneOf(['default', 'inline']),
|
|
166
177
|
/**
|
|
167
178
|
* Callback function that fires when the revert button is clicked
|
|
168
179
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
import React from 'react';
|
|
8
|
+
import { StackProps } from './Stack';
|
|
9
|
+
declare const HStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<React.ReactNode>>;
|
|
10
|
+
export { HStack };
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import React__default from 'react';
|
|
10
|
+
import { Stack } from './Stack.js';
|
|
11
|
+
|
|
12
|
+
const HStack = /*#__PURE__*/React__default.forwardRef(function HStack(_ref, ref) {
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
...props
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/React__default.createElement(Stack, _extends({}, props, {
|
|
18
|
+
ref: ref,
|
|
19
|
+
orientation: "horizontal"
|
|
20
|
+
}), children);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { HStack };
|
|
@@ -10,7 +10,7 @@ import React from 'react';
|
|
|
10
10
|
* @type {Array<number>}
|
|
11
11
|
*/
|
|
12
12
|
declare const SPACING_STEPS: number[];
|
|
13
|
-
interface StackProps extends React.HTMLAttributes<HTMLElement> {
|
|
13
|
+
export interface StackProps extends React.HTMLAttributes<HTMLElement> {
|
|
14
14
|
/**
|
|
15
15
|
* Provide a custom element type to render as the outermost element in
|
|
16
16
|
* the Stack component. By default, this component will render a `div`.
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import
|
|
9
|
+
import React__default from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import
|
|
12
|
+
import { spacing } from '@carbon/layout';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
import React from 'react';
|
|
8
|
+
import { StackProps } from './Stack';
|
|
9
|
+
declare const VStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<React.ReactNode>>;
|
|
10
|
+
export { VStack };
|
|
@@ -8,14 +8,7 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import React__default from 'react';
|
|
10
10
|
import { Stack } from './Stack.js';
|
|
11
|
-
export { Stack } from './Stack.js';
|
|
12
11
|
|
|
13
|
-
const HStack = /*#__PURE__*/React__default.forwardRef(function HStack(props, ref) {
|
|
14
|
-
return /*#__PURE__*/React__default.createElement(Stack, _extends({}, props, {
|
|
15
|
-
ref: ref,
|
|
16
|
-
orientation: "horizontal"
|
|
17
|
-
}));
|
|
18
|
-
});
|
|
19
12
|
const VStack = /*#__PURE__*/React__default.forwardRef(function VStack(props, ref) {
|
|
20
13
|
return /*#__PURE__*/React__default.createElement(Stack, _extends({}, props, {
|
|
21
14
|
ref: ref,
|
|
@@ -23,4 +16,4 @@ const VStack = /*#__PURE__*/React__default.forwardRef(function VStack(props, ref
|
|
|
23
16
|
}));
|
|
24
17
|
});
|
|
25
18
|
|
|
26
|
-
export {
|
|
19
|
+
export { 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';
|
|
@@ -9,7 +9,6 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default, { useState } from 'react';
|
|
11
11
|
import RadioTile from '../RadioTile/RadioTile.js';
|
|
12
|
-
import { warning } from '../../internal/warning.js';
|
|
13
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
13
|
import { noopFn } from '../../internal/noopFn.js';
|
|
15
14
|
|
|
@@ -36,28 +35,35 @@ const TileGroup = props => {
|
|
|
36
35
|
setSelected(valueSelected);
|
|
37
36
|
setPrevValueSelected(valueSelected);
|
|
38
37
|
}
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
38
|
+
const getRadioTilesWithWrappers = children => {
|
|
39
|
+
const traverseAndModifyChildren = children => {
|
|
40
|
+
return React__default.Children.map(children, child => {
|
|
41
|
+
// If RadioTile found, return it with necessary props
|
|
42
|
+
if (child.type === RadioTile) {
|
|
43
|
+
const {
|
|
44
|
+
value,
|
|
45
|
+
...otherProps
|
|
46
|
+
} = child.props;
|
|
47
|
+
return /*#__PURE__*/React__default.createElement(RadioTile, _extends({}, otherProps, {
|
|
48
|
+
name: name,
|
|
49
|
+
key: value,
|
|
50
|
+
value: value,
|
|
51
|
+
onChange: handleChange,
|
|
52
|
+
checked: value === selected
|
|
53
|
+
}));
|
|
54
|
+
} else if (child.props && child.props.children) {
|
|
55
|
+
// If the child is not RadioTile and has children, recheck the children
|
|
56
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
57
|
+
...child.props,
|
|
58
|
+
children: traverseAndModifyChildren(child.props.children)
|
|
59
|
+
});
|
|
60
|
+
} else {
|
|
61
|
+
// If the child is neither a RadioTile nor has children, return it as is
|
|
62
|
+
return child;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, traverseAndModifyChildren(children));
|
|
61
67
|
};
|
|
62
68
|
const handleChange = (newSelection, value, evt) => {
|
|
63
69
|
if (newSelection !== selected) {
|
|
@@ -75,7 +81,7 @@ const TileGroup = props => {
|
|
|
75
81
|
return /*#__PURE__*/React__default.createElement("fieldset", {
|
|
76
82
|
className: className ?? `${prefix}--tile-group`,
|
|
77
83
|
disabled: disabled
|
|
78
|
-
}, renderLegend(legend), /*#__PURE__*/React__default.createElement("div", null,
|
|
84
|
+
}, renderLegend(legend), /*#__PURE__*/React__default.createElement("div", null, getRadioTilesWithWrappers(children)));
|
|
79
85
|
};
|
|
80
86
|
TileGroup.propTypes = {
|
|
81
87
|
/**
|
|
@@ -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;
|
|
@@ -150,7 +150,28 @@ Toggletip.propTypes = {
|
|
|
150
150
|
/**
|
|
151
151
|
* Specify how the toggletip should align with the button
|
|
152
152
|
*/
|
|
153
|
-
align: PropTypes.oneOf(['top', 'top-left',
|
|
153
|
+
align: PropTypes.oneOf(['top', 'top-left',
|
|
154
|
+
// deprecated use top-start instead
|
|
155
|
+
'top-right',
|
|
156
|
+
// deprecated use top-end instead
|
|
157
|
+
|
|
158
|
+
'bottom', 'bottom-left',
|
|
159
|
+
// deprecated use bottom-start instead
|
|
160
|
+
'bottom-right',
|
|
161
|
+
// deprecated use bottom-end instead
|
|
162
|
+
|
|
163
|
+
'left', 'left-bottom',
|
|
164
|
+
// deprecated use left-end instead
|
|
165
|
+
'left-top',
|
|
166
|
+
// deprecated use left-start instead
|
|
167
|
+
|
|
168
|
+
'right', 'right-bottom',
|
|
169
|
+
// deprecated use right-end instead
|
|
170
|
+
'right-top',
|
|
171
|
+
// deprecated use right-start instead
|
|
172
|
+
|
|
173
|
+
// new values to match floating-ui
|
|
174
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
154
175
|
/**
|
|
155
176
|
* Provide a custom element or component to render the top-level node for the
|
|
156
177
|
* component.
|
|
@@ -178,7 +199,7 @@ Toggletip.propTypes = {
|
|
|
178
199
|
* `ToggletipButton` controls the visibility of the Toggletip through mouse
|
|
179
200
|
* clicks and keyboard interactions.
|
|
180
201
|
*/
|
|
181
|
-
function ToggletipButton(_ref3) {
|
|
202
|
+
const ToggletipButton = /*#__PURE__*/React__default.forwardRef(function ToggletipButton(_ref3, ref) {
|
|
182
203
|
let {
|
|
183
204
|
children,
|
|
184
205
|
className: customClassName,
|
|
@@ -198,9 +219,10 @@ function ToggletipButton(_ref3) {
|
|
|
198
219
|
return /*#__PURE__*/React__default.createElement("button", _extends({}, toggletip?.buttonProps, {
|
|
199
220
|
"aria-label": label,
|
|
200
221
|
type: "button",
|
|
201
|
-
className: className
|
|
222
|
+
className: className,
|
|
223
|
+
ref: ref
|
|
202
224
|
}, rest), children);
|
|
203
|
-
}
|
|
225
|
+
});
|
|
204
226
|
ToggletipButton.propTypes = {
|
|
205
227
|
/**
|
|
206
228
|
* Custom children to be rendered as the content of the label
|
|
@@ -216,6 +238,7 @@ ToggletipButton.propTypes = {
|
|
|
216
238
|
*/
|
|
217
239
|
label: PropTypes.string
|
|
218
240
|
};
|
|
241
|
+
ToggletipButton.displayName = 'ToggletipButton';
|
|
219
242
|
/**
|
|
220
243
|
* `ToggletipContent` is a wrapper around `PopoverContent`. It places the
|
|
221
244
|
* `children` passed in as a prop inside of `PopoverContent` so that they will
|
|
@@ -34,7 +34,6 @@ function Tooltip(_ref) {
|
|
|
34
34
|
closeOnActivation = false,
|
|
35
35
|
...rest
|
|
36
36
|
} = _ref;
|
|
37
|
-
const containerRef = useRef(null);
|
|
38
37
|
const tooltipRef = useRef(null);
|
|
39
38
|
const [open, setOpen] = useDelayedState(defaultOpen);
|
|
40
39
|
const [isDragging, setIsDragging] = useState(false);
|
|
@@ -130,8 +129,7 @@ function Tooltip(_ref) {
|
|
|
130
129
|
highContrast: true,
|
|
131
130
|
onKeyDown: onKeyDown,
|
|
132
131
|
onMouseLeave: onMouseLeave,
|
|
133
|
-
open: open
|
|
134
|
-
ref: containerRef
|
|
132
|
+
open: open
|
|
135
133
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
136
134
|
className: `${prefix}--tooltip-trigger__wrapper`
|
|
137
135
|
}, child !== undefined ? /*#__PURE__*/React__default.cloneElement(child, {
|
|
@@ -141,7 +139,6 @@ function Tooltip(_ref) {
|
|
|
141
139
|
"aria-hidden": open ? 'false' : 'true',
|
|
142
140
|
className: `${prefix}--tooltip-content`,
|
|
143
141
|
id: id,
|
|
144
|
-
ref: tooltipRef,
|
|
145
142
|
role: "tooltip"
|
|
146
143
|
}, label || description));
|
|
147
144
|
}
|
|
@@ -149,7 +146,28 @@ Tooltip.propTypes = {
|
|
|
149
146
|
/**
|
|
150
147
|
* Specify how the trigger should align with the tooltip
|
|
151
148
|
*/
|
|
152
|
-
align: PropTypes.oneOf(['top', 'top-left',
|
|
149
|
+
align: PropTypes.oneOf(['top', 'top-left',
|
|
150
|
+
// deprecated use top-start instead
|
|
151
|
+
'top-right',
|
|
152
|
+
// deprecated use top-end instead
|
|
153
|
+
|
|
154
|
+
'bottom', 'bottom-left',
|
|
155
|
+
// deprecated use bottom-start instead
|
|
156
|
+
'bottom-right',
|
|
157
|
+
// deprecated use bottom-end instead
|
|
158
|
+
|
|
159
|
+
'left', 'left-bottom',
|
|
160
|
+
// deprecated use left-end instead
|
|
161
|
+
'left-top',
|
|
162
|
+
// deprecated use left-start instead
|
|
163
|
+
|
|
164
|
+
'right', 'right-bottom',
|
|
165
|
+
// deprecated use right-end instead
|
|
166
|
+
'right-top',
|
|
167
|
+
// deprecated use right-start instead
|
|
168
|
+
|
|
169
|
+
// new values to match floating-ui
|
|
170
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
153
171
|
/**
|
|
154
172
|
* Pass in the child to which the tooltip will be applied
|
|
155
173
|
*/
|
package/es/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';
|
|
@@ -116,6 +117,7 @@ export * from './components/Popover';
|
|
|
116
117
|
export * from './components/ProgressBar';
|
|
117
118
|
export { Slug as unstable__Slug, SlugContent as unstable__SlugContent, SlugActions as unstable__SlugActions, } from './components/Slug';
|
|
118
119
|
export { ChatButton as unstable__ChatButton, ChatButtonSkeleton as unstable__ChatButtonSkeleton, } from './components/ChatButton';
|
|
120
|
+
export { AiSkeletonText as unstable__AiSkeletonText, AiSkeletonIcon as unstable__AiSkeletonIcon, AiSkeletonPlaceholder as unstable__AiSkeletonPlaceholder, } from './components/AiSkeleton';
|
|
119
121
|
export * from './components/Stack';
|
|
120
122
|
export * from './components/Tooltip';
|
|
121
123
|
export { Text as unstable_Text, TextDirection as unstable_TextDirection, } from './components/Text';
|
package/es/index.js
CHANGED
|
@@ -73,6 +73,7 @@ export { NumberInput } from './components/NumberInput/NumberInput.js';
|
|
|
73
73
|
export { default as OrderedList } from './components/OrderedList/OrderedList.js';
|
|
74
74
|
export { default as OverflowMenu } from './components/OverflowMenu/index.js';
|
|
75
75
|
export { default as OverflowMenuItem } from './components/OverflowMenuItem/OverflowMenuItem.js';
|
|
76
|
+
export { default as Pagination } from './components/Pagination/Pagination.js';
|
|
76
77
|
export { default as PaginationSkeleton } from './components/Pagination/Pagination.Skeleton.js';
|
|
77
78
|
export { default as PaginationNav } from './components/PaginationNav/PaginationNav.js';
|
|
78
79
|
export { default as PrimaryButton } from './components/PrimaryButton/PrimaryButton.js';
|
|
@@ -81,6 +82,7 @@ export { ProgressIndicator, ProgressStep } from './components/ProgressIndicator/
|
|
|
81
82
|
export { default as RadioButton } from './components/RadioButton/RadioButton.js';
|
|
82
83
|
export { default as RadioButtonSkeleton } from './components/RadioButton/RadioButton.Skeleton.js';
|
|
83
84
|
export { default as RadioButtonGroup } from './components/RadioButtonGroup/RadioButtonGroup.js';
|
|
85
|
+
export { default as RadioTile } from './components/RadioTile/RadioTile.js';
|
|
84
86
|
export { default as Search } from './components/Search/Search.js';
|
|
85
87
|
export { default as SearchSkeleton } from './components/Search/Search.Skeleton.js';
|
|
86
88
|
export { default as SecondaryButton } from './components/SecondaryButton/SecondaryButton.js';
|
|
@@ -92,6 +94,9 @@ export { default as SkeletonIcon } from './components/SkeletonIcon/SkeletonIcon.
|
|
|
92
94
|
export { default as SkeletonPlaceholder } from './components/SkeletonPlaceholder/SkeletonPlaceholder.js';
|
|
93
95
|
export { default as SkeletonText } from './components/SkeletonText/SkeletonText.js';
|
|
94
96
|
export { default as Slider } from './components/Slider/index.js';
|
|
97
|
+
export { HStack } from './components/Stack/HStack.js';
|
|
98
|
+
export { VStack } from './components/Stack/VStack.js';
|
|
99
|
+
export { Stack } from './components/Stack/Stack.js';
|
|
95
100
|
export { StructuredListBody, StructuredListCell, StructuredListHead, StructuredListInput, StructuredListRow, StructuredListWrapper } from './components/StructuredList/StructuredList.js';
|
|
96
101
|
export { default as StructuredListSkeleton } from './components/StructuredList/StructuredList.Skeleton.js';
|
|
97
102
|
export { default as Switch } from './components/Switch/Switch.js';
|
|
@@ -151,7 +156,9 @@ export { OverflowMenuV2 as unstable_OverflowMenuV2 } from './components/Overflow
|
|
|
151
156
|
export { Popover, PopoverContent } from './components/Popover/index.js';
|
|
152
157
|
export { default as ProgressBar } from './components/ProgressBar/ProgressBar.js';
|
|
153
158
|
export { Slug as unstable__Slug, SlugActions as unstable__SlugActions, SlugContent as unstable__SlugContent } from './components/Slug/index.js';
|
|
154
|
-
export {
|
|
159
|
+
export { default as unstable__AiSkeletonPlaceholder } from './components/AiSkeleton/AiSkeletonPlaceholder.js';
|
|
160
|
+
export { default as unstable__AiSkeletonIcon } from './components/AiSkeleton/AiSkeletonIcon.js';
|
|
161
|
+
export { default as unstable__AiSkeletonText } from './components/AiSkeleton/AiSkeletonText.js';
|
|
155
162
|
export { DefinitionTooltip } from './components/Tooltip/DefinitionTooltip.js';
|
|
156
163
|
export { Tooltip } from './components/Tooltip/Tooltip.js';
|
|
157
164
|
import './components/Text/index.js';
|
|
@@ -218,9 +225,6 @@ export { default as TableToolbarSearch } from './components/DataTable/TableToolb
|
|
|
218
225
|
export { default as TableToolbarMenu } from './components/DataTable/TableToolbarMenu.js';
|
|
219
226
|
export { default as FilterableMultiSelect } from './components/MultiSelect/FilterableMultiSelect.js';
|
|
220
227
|
export { default as MultiSelect } from './components/MultiSelect/MultiSelect.js';
|
|
221
|
-
export { default as Pagination } from './components/Pagination/Pagination.js';
|
|
222
228
|
export { default as ControlledPasswordInput } from './components/TextInput/ControlledPasswordInput.js';
|
|
223
229
|
export { default as PasswordInput } from './components/TextInput/PasswordInput.js';
|
|
224
|
-
export { default as RadioTile } from './components/RadioTile/RadioTile.js';
|
|
225
230
|
export { default as TreeNode } from './components/TreeView/TreeNode.js';
|
|
226
|
-
export { Stack } from './components/Stack/Stack.js';
|
|
@@ -13,8 +13,11 @@ import window from 'window-or-global';
|
|
|
13
13
|
import OptimizedResize from './OptimizedResize.js';
|
|
14
14
|
import { selectorTabbable, selectorFocusable } from './keyboard/navigation.js';
|
|
15
15
|
import { warning } from './warning.js';
|
|
16
|
-
import wrapFocus from './wrapFocus.js';
|
|
16
|
+
import wrapFocus, { wrapFocusWithoutSentinels } from './wrapFocus.js';
|
|
17
17
|
import { PrefixContext } from './usePrefix.js';
|
|
18
|
+
import * as FeatureFlags from '@carbon/feature-flags';
|
|
19
|
+
import { match } from './keyboard/match.js';
|
|
20
|
+
import { Tab } from './keyboard/keys.js';
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* The structure for the position of floating menu.
|
|
@@ -348,6 +351,19 @@ class FloatingMenu extends React__default.Component {
|
|
|
348
351
|
});
|
|
349
352
|
}
|
|
350
353
|
});
|
|
354
|
+
/**
|
|
355
|
+
* Keydown handler for when focus wrap behavior is enabled
|
|
356
|
+
* @param {Event} event
|
|
357
|
+
*/
|
|
358
|
+
_defineProperty(this, "handleKeyDown", event => {
|
|
359
|
+
if (match(event, Tab) && this._menuBody) {
|
|
360
|
+
wrapFocusWithoutSentinels({
|
|
361
|
+
containerNode: this._menuBody,
|
|
362
|
+
currentActiveNode: event.target,
|
|
363
|
+
event
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
});
|
|
351
367
|
}
|
|
352
368
|
componentWillUnmount() {
|
|
353
369
|
this.hResize.release();
|
|
@@ -376,19 +392,24 @@ class FloatingMenu extends React__default.Component {
|
|
|
376
392
|
const {
|
|
377
393
|
context: prefix
|
|
378
394
|
} = this;
|
|
395
|
+
const focusTrapWithoutSentinels = FeatureFlags.enabled('enable-experimental-focus-wrap-without-sentinels');
|
|
379
396
|
if (typeof document !== 'undefined') {
|
|
380
397
|
const {
|
|
381
398
|
focusTrap,
|
|
382
399
|
target
|
|
383
400
|
} = this.props;
|
|
384
|
-
return /*#__PURE__*/ReactDOM.createPortal(
|
|
385
|
-
|
|
386
|
-
|
|
401
|
+
return /*#__PURE__*/ReactDOM.createPortal(
|
|
402
|
+
/*#__PURE__*/
|
|
403
|
+
//eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
404
|
+
React__default.createElement("div", {
|
|
405
|
+
onBlur: focusTrap && !focusTrapWithoutSentinels ? this.handleBlur : () => {},
|
|
406
|
+
onKeyDown: focusTrapWithoutSentinels ? this.handleKeyDown : () => {}
|
|
407
|
+
}, !focusTrapWithoutSentinels && /*#__PURE__*/React__default.createElement("span", {
|
|
387
408
|
ref: this.startSentinel,
|
|
388
409
|
tabIndex: "0",
|
|
389
410
|
role: "link",
|
|
390
411
|
className: `${prefix}--visually-hidden`
|
|
391
|
-
}, "Focus sentinel"), this._getChildrenWithProps(), /*#__PURE__*/React__default.createElement("span", {
|
|
412
|
+
}, "Focus sentinel"), this._getChildrenWithProps(), !focusTrapWithoutSentinels && /*#__PURE__*/React__default.createElement("span", {
|
|
392
413
|
ref: this.endSentinel,
|
|
393
414
|
tabIndex: "0",
|
|
394
415
|
role: "link",
|