@carbon/react 1.58.1 → 1.59.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 +1344 -1092
- package/es/components/Accordion/Accordion.Skeleton.d.ts +6 -1
- package/es/components/Accordion/Accordion.Skeleton.js +3 -1
- package/es/components/Accordion/Accordion.d.ts +11 -1
- package/es/components/Accordion/Accordion.js +8 -1
- package/es/components/CheckboxGroup/CheckboxGroup.js +7 -0
- package/es/components/ComboButton/index.d.ts +2 -1
- package/es/components/ComboButton/index.js +51 -31
- package/es/components/ContainedList/index.js +4 -0
- package/es/components/ListBox/ListBoxMenuItem.js +1 -1
- package/es/components/RadioTile/RadioTile.d.ts +9 -0
- package/es/components/RadioTile/RadioTile.js +24 -3
- package/es/components/Tooltip/Tooltip.js +41 -21
- package/es/components/UIShell/Content.d.ts +3 -3
- package/es/components/UIShell/SwitcherItem.d.ts +5 -1
- package/es/components/UIShell/SwitcherItem.js +7 -1
- package/lib/components/Accordion/Accordion.Skeleton.d.ts +6 -1
- package/lib/components/Accordion/Accordion.Skeleton.js +3 -1
- package/lib/components/Accordion/Accordion.d.ts +11 -1
- package/lib/components/Accordion/Accordion.js +8 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +7 -0
- package/lib/components/ComboButton/index.d.ts +2 -1
- package/lib/components/ComboButton/index.js +45 -25
- package/lib/components/ContainedList/index.js +4 -0
- package/lib/components/ListBox/ListBoxMenuItem.js +1 -1
- package/lib/components/RadioTile/RadioTile.d.ts +9 -0
- package/lib/components/RadioTile/RadioTile.js +24 -3
- package/lib/components/Tooltip/Tooltip.js +41 -21
- package/lib/components/UIShell/Content.d.ts +3 -3
- package/lib/components/UIShell/SwitcherItem.d.ts +5 -1
- package/lib/components/UIShell/SwitcherItem.js +7 -1
- package/package.json +3 -3
|
@@ -29,6 +29,7 @@ function Accordion(_ref) {
|
|
|
29
29
|
className: customClassName,
|
|
30
30
|
disabled = false,
|
|
31
31
|
isFlush = false,
|
|
32
|
+
ordered = false,
|
|
32
33
|
size,
|
|
33
34
|
...rest
|
|
34
35
|
} = _ref;
|
|
@@ -40,9 +41,10 @@ function Accordion(_ref) {
|
|
|
40
41
|
[`${prefix}--layout--size-${size}`]: size,
|
|
41
42
|
[`${prefix}--accordion--flush`]: isFlush && align !== 'start'
|
|
42
43
|
});
|
|
44
|
+
const ListTag = ordered ? 'ol' : 'ul';
|
|
43
45
|
return /*#__PURE__*/React__default["default"].createElement(AccordionProvider.AccordionProvider, {
|
|
44
46
|
disabled: disabled
|
|
45
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
47
|
+
}, /*#__PURE__*/React__default["default"].createElement(ListTag, _rollupPluginBabelHelpers["extends"]({
|
|
46
48
|
className: className
|
|
47
49
|
}, rest), children));
|
|
48
50
|
}
|
|
@@ -67,6 +69,11 @@ Accordion.propTypes = {
|
|
|
67
69
|
* Specify whether Accordion text should be flush, default is false, does not work with align="start"
|
|
68
70
|
*/
|
|
69
71
|
isFlush: PropTypes__default["default"].bool,
|
|
72
|
+
/**
|
|
73
|
+
* Specify if the Accordion should be an ordered list,
|
|
74
|
+
* default is `false`
|
|
75
|
+
*/
|
|
76
|
+
ordered: PropTypes__default["default"].bool,
|
|
70
77
|
/**
|
|
71
78
|
* Specify the size of the Accordion. Currently supports the following:
|
|
72
79
|
*/
|
|
@@ -37,6 +37,7 @@ function CheckboxGroup(_ref) {
|
|
|
37
37
|
warn,
|
|
38
38
|
warnText,
|
|
39
39
|
slug,
|
|
40
|
+
orientation = 'vertical',
|
|
40
41
|
...rest
|
|
41
42
|
} = _ref;
|
|
42
43
|
const prefix = usePrefix.usePrefix();
|
|
@@ -49,6 +50,7 @@ function CheckboxGroup(_ref) {
|
|
|
49
50
|
className: `${prefix}--form__helper-text`
|
|
50
51
|
}, helperText) : null;
|
|
51
52
|
const fieldsetClasses = cx__default["default"](`${prefix}--checkbox-group`, className, {
|
|
53
|
+
[`${prefix}--checkbox-group--${orientation}`]: orientation === 'horizontal',
|
|
52
54
|
[`${prefix}--checkbox-group--readonly`]: readOnly,
|
|
53
55
|
[`${prefix}--checkbox-group--invalid`]: !readOnly && invalid,
|
|
54
56
|
[`${prefix}--checkbox-group--warning`]: showWarning,
|
|
@@ -68,6 +70,7 @@ function CheckboxGroup(_ref) {
|
|
|
68
70
|
"data-invalid": invalid ? true : undefined,
|
|
69
71
|
"aria-labelledby": rest['aria-labelledby'] || legendId,
|
|
70
72
|
"aria-readonly": readOnly,
|
|
73
|
+
orientation: "vertical",
|
|
71
74
|
"aria-describedby": !invalid && !warn && helper ? helperId : undefined
|
|
72
75
|
}, rest), /*#__PURE__*/React__default["default"].createElement("legend", {
|
|
73
76
|
className: `${prefix}--label`,
|
|
@@ -114,6 +117,10 @@ CheckboxGroup.propTypes = {
|
|
|
114
117
|
* Provide the text to be rendered inside of the fieldset <legend>
|
|
115
118
|
*/
|
|
116
119
|
legendText: PropTypes__default["default"].node.isRequired,
|
|
120
|
+
/**
|
|
121
|
+
* Provide the orientation for how the checkbox should be displayed
|
|
122
|
+
*/
|
|
123
|
+
orientation: PropTypes__default["default"].oneOf(['horizontal', 'vertical']),
|
|
117
124
|
/**
|
|
118
125
|
* Whether the CheckboxGroup should be read-only
|
|
119
126
|
*/
|
|
@@ -8,6 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import { IconButton } from '../IconButton';
|
|
9
9
|
import Button from '../Button';
|
|
10
10
|
import { Menu } from '../Menu';
|
|
11
|
+
export type MenuAlignment = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end';
|
|
11
12
|
interface ComboButtonProps {
|
|
12
13
|
/**
|
|
13
14
|
* A collection of `MenuItems` to be rendered as additional actions for this `ComboButton`.
|
|
@@ -28,7 +29,7 @@ interface ComboButtonProps {
|
|
|
28
29
|
/**
|
|
29
30
|
* Experimental property. Specify how the menu should align with the button element
|
|
30
31
|
*/
|
|
31
|
-
menuAlignment?:
|
|
32
|
+
menuAlignment?: MenuAlignment;
|
|
32
33
|
/**
|
|
33
34
|
* Provide an optional function to be called when the primary action element is clicked.
|
|
34
35
|
*/
|
|
@@ -21,8 +21,9 @@ var Menu = require('../Menu/Menu.js');
|
|
|
21
21
|
require('../Menu/MenuItem.js');
|
|
22
22
|
var useAttachedMenu = require('../../internal/useAttachedMenu.js');
|
|
23
23
|
var useId = require('../../internal/useId.js');
|
|
24
|
-
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
25
24
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
25
|
+
var react = require('@floating-ui/react');
|
|
26
|
+
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
26
27
|
|
|
27
28
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
29
|
|
|
@@ -31,7 +32,6 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
31
32
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
32
33
|
|
|
33
34
|
var _ChevronDown;
|
|
34
|
-
const spacing = 0; // top and bottom spacing between the button and the menu. in px
|
|
35
35
|
const defaultTranslations = {
|
|
36
36
|
'carbon.combo-button.additional-actions': 'Additional actions'
|
|
37
37
|
};
|
|
@@ -54,23 +54,54 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
|
|
|
54
54
|
const id = useId.useId('combobutton');
|
|
55
55
|
const prefix = usePrefix.usePrefix();
|
|
56
56
|
const containerRef = React.useRef(null);
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const middlewares = [react.flip({
|
|
58
|
+
crossAxis: false
|
|
59
|
+
})];
|
|
60
|
+
if (menuAlignment === 'bottom' || menuAlignment === 'top') {
|
|
61
|
+
middlewares.push(react.size({
|
|
62
|
+
apply(_ref2) {
|
|
63
|
+
let {
|
|
64
|
+
rects,
|
|
65
|
+
elements
|
|
66
|
+
} = _ref2;
|
|
67
|
+
Object.assign(elements.floating.style, {
|
|
68
|
+
width: `${rects.reference.width}px`
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
const {
|
|
74
|
+
refs,
|
|
75
|
+
floatingStyles,
|
|
76
|
+
placement,
|
|
77
|
+
middlewareData
|
|
78
|
+
} = react.useFloating({
|
|
79
|
+
placement: menuAlignment,
|
|
80
|
+
// The floating element is positioned relative to its nearest
|
|
81
|
+
// containing block (usually the viewport). It will in many cases also
|
|
82
|
+
// “break” the floating element out of a clipping ancestor.
|
|
83
|
+
// https://floating-ui.com/docs/misc#clipping
|
|
84
|
+
strategy: 'fixed',
|
|
85
|
+
// Middleware order matters, arrow should be last
|
|
86
|
+
middleware: middlewares,
|
|
87
|
+
whileElementsMounted: react.autoUpdate
|
|
88
|
+
});
|
|
89
|
+
const ref = mergeRefs["default"](forwardRef, containerRef, refs.setReference);
|
|
60
90
|
const {
|
|
61
91
|
open,
|
|
62
|
-
x,
|
|
63
|
-
y,
|
|
64
92
|
handleClick: hookOnClick,
|
|
65
93
|
handleMousedown: handleTriggerMousedown,
|
|
66
94
|
handleClose
|
|
67
95
|
} = useAttachedMenu.useAttachedMenu(containerRef);
|
|
96
|
+
React.useLayoutEffect(() => {
|
|
97
|
+
Object.keys(floatingStyles).forEach(style => {
|
|
98
|
+
if (refs.floating.current) {
|
|
99
|
+
refs.floating.current.style[style] = floatingStyles[style];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}, [floatingStyles, refs.floating, middlewareData, placement, open]);
|
|
68
103
|
function handleTriggerClick() {
|
|
69
104
|
if (containerRef.current) {
|
|
70
|
-
const {
|
|
71
|
-
width: w
|
|
72
|
-
} = containerRef.current.getBoundingClientRect();
|
|
73
|
-
setWidth(w);
|
|
74
105
|
hookOnClick();
|
|
75
106
|
}
|
|
76
107
|
}
|
|
@@ -79,15 +110,6 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
|
|
|
79
110
|
onClick(e);
|
|
80
111
|
}
|
|
81
112
|
}
|
|
82
|
-
function handleOpen() {
|
|
83
|
-
if (menuRef.current) {
|
|
84
|
-
menuRef.current.style.inlineSize = `${width}px`;
|
|
85
|
-
menuRef.current.style.minInlineSize = `${width}px`;
|
|
86
|
-
if (menuAlignment !== 'bottom' && menuAlignment !== 'top') {
|
|
87
|
-
menuRef.current.style.inlineSize = `fit-content`;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
113
|
const containerClasses = cx__default["default"](`${prefix}--combo-button__container`, `${prefix}--combo-button__container--${size}`, {
|
|
92
114
|
[`${prefix}--combo-button__container--open`]: open
|
|
93
115
|
}, className);
|
|
@@ -106,6 +128,7 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
|
|
|
106
128
|
disabled: disabled,
|
|
107
129
|
onClick: handlePrimaryActionClick
|
|
108
130
|
}, label)), /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
131
|
+
ref: refs.setReference,
|
|
109
132
|
className: triggerClasses,
|
|
110
133
|
label: t('carbon.combo-button.additional-actions'),
|
|
111
134
|
size: size,
|
|
@@ -120,16 +143,13 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
|
|
|
120
143
|
containerRef: containerRef,
|
|
121
144
|
menuAlignment: menuAlignment,
|
|
122
145
|
className: menuClasses,
|
|
123
|
-
ref:
|
|
146
|
+
ref: refs.setFloating,
|
|
124
147
|
id: id,
|
|
125
148
|
label: t('carbon.combo-button.additional-actions'),
|
|
126
149
|
mode: "basic",
|
|
127
150
|
size: size,
|
|
128
151
|
open: open,
|
|
129
|
-
onClose: handleClose
|
|
130
|
-
onOpen: handleOpen,
|
|
131
|
-
x: x,
|
|
132
|
-
y: [y[0] - spacing, y[1] + spacing]
|
|
152
|
+
onClose: handleClose
|
|
133
153
|
}, children));
|
|
134
154
|
});
|
|
135
155
|
ComboButton.propTypes = {
|
|
@@ -9,10 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
+
var deprecateFieldOnObject = require('../../internal/deprecateFieldOnObject.js');
|
|
12
13
|
var ContainedList = require('./ContainedList.js');
|
|
13
14
|
var ContainedListItem = require('./ContainedListItem/ContainedListItem.js');
|
|
14
15
|
|
|
15
16
|
ContainedList["default"].ContainedListItem = ContainedListItem["default"];
|
|
17
|
+
if (process.env.NODE_ENV !== "production") {
|
|
18
|
+
deprecateFieldOnObject.deprecateFieldOnObject(ContainedList["default"], 'ContainedListItem', ContainedListItem["default"]);
|
|
19
|
+
}
|
|
16
20
|
|
|
17
21
|
exports.ContainedList = ContainedList["default"];
|
|
18
22
|
exports["default"] = ContainedList["default"];
|
|
@@ -22,6 +22,11 @@ export interface RadioTileProps {
|
|
|
22
22
|
* Specify whether the `RadioTile` should be disabled.
|
|
23
23
|
*/
|
|
24
24
|
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* **Experimental**: Specify if the `ExpandableTile` component should be rendered with rounded corners.
|
|
27
|
+
* Only valid when `slug` prop is present
|
|
28
|
+
*/
|
|
29
|
+
hasRoundedCorners?: boolean;
|
|
25
30
|
/**
|
|
26
31
|
* Provide a unique id for the underlying `<input>`.
|
|
27
32
|
*/
|
|
@@ -42,6 +47,10 @@ export interface RadioTileProps {
|
|
|
42
47
|
* the underlying `<input>` changes.
|
|
43
48
|
*/
|
|
44
49
|
onChange?: (value: string | number, name: string | undefined, event: React.ChangeEvent<HTMLInputElement> | React.KeyboardEvent<HTMLInputElement>) => void;
|
|
50
|
+
/**
|
|
51
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
|
|
52
|
+
*/
|
|
53
|
+
slug?: React.ReactNode;
|
|
45
54
|
/**
|
|
46
55
|
* Specify the tab index of the underlying `<input>`.
|
|
47
56
|
*/
|
|
@@ -43,15 +43,19 @@ const RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function Rad
|
|
|
43
43
|
id,
|
|
44
44
|
onChange = noopFn.noopFn,
|
|
45
45
|
tabIndex = 0,
|
|
46
|
+
hasRoundedCorners,
|
|
47
|
+
slug,
|
|
46
48
|
required,
|
|
47
49
|
...rest
|
|
48
50
|
} = _ref;
|
|
49
51
|
const prefix = usePrefix.usePrefix();
|
|
50
52
|
const inputId = useId.useFallbackId(id);
|
|
51
|
-
const className = cx__default["default"](customClassName, `${prefix}--tile`, `${prefix}--tile--selectable`, {
|
|
53
|
+
const className = cx__default["default"](customClassName, `${prefix}--tile`, `${prefix}--tile--selectable`, `${prefix}--tile--radio`, {
|
|
52
54
|
[`${prefix}--tile--is-selected`]: checked,
|
|
53
55
|
[`${prefix}--tile--light`]: light,
|
|
54
|
-
[`${prefix}--tile--disabled`]: disabled
|
|
56
|
+
[`${prefix}--tile--disabled`]: disabled,
|
|
57
|
+
[`${prefix}--tile--slug`]: slug,
|
|
58
|
+
[`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
|
|
55
59
|
});
|
|
56
60
|
const v12TileRadioIcons = index.useFeatureFlag('enable-v12-tile-radio-icons');
|
|
57
61
|
function icon() {
|
|
@@ -74,6 +78,14 @@ const RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function Rad
|
|
|
74
78
|
onChange(value, name, evt);
|
|
75
79
|
}
|
|
76
80
|
}
|
|
81
|
+
|
|
82
|
+
// Slug is always size `xs`
|
|
83
|
+
let normalizedSlug;
|
|
84
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
85
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
86
|
+
size: 'xs'
|
|
87
|
+
});
|
|
88
|
+
}
|
|
77
89
|
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
78
90
|
checked: checked,
|
|
79
91
|
className: `${prefix}--tile-input`,
|
|
@@ -94,7 +106,7 @@ const RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function Rad
|
|
|
94
106
|
className: `${prefix}--tile__checkmark`
|
|
95
107
|
}, icon()), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
96
108
|
className: `${prefix}--tile-content`
|
|
97
|
-
}, children)));
|
|
109
|
+
}, children), normalizedSlug));
|
|
98
110
|
});
|
|
99
111
|
RadioTile.displayName = 'RadioTile';
|
|
100
112
|
RadioTile.propTypes = {
|
|
@@ -114,6 +126,11 @@ RadioTile.propTypes = {
|
|
|
114
126
|
* Specify whether the `RadioTile` should be disabled.
|
|
115
127
|
*/
|
|
116
128
|
disabled: PropTypes__default["default"].bool,
|
|
129
|
+
/**
|
|
130
|
+
* Specify if the `ExpandableTile` component should be rendered with rounded corners.
|
|
131
|
+
* Only valid when `slug` prop is present
|
|
132
|
+
*/
|
|
133
|
+
hasRoundedCorners: PropTypes__default["default"].bool,
|
|
117
134
|
/**
|
|
118
135
|
* Provide a unique id for the underlying `<input>`.
|
|
119
136
|
*/
|
|
@@ -136,6 +153,10 @@ RadioTile.propTypes = {
|
|
|
136
153
|
* `true` to specify if the control is required.
|
|
137
154
|
*/
|
|
138
155
|
required: PropTypes__default["default"].bool,
|
|
156
|
+
/**
|
|
157
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
|
|
158
|
+
*/
|
|
159
|
+
slug: PropTypes__default["default"].node,
|
|
139
160
|
/**
|
|
140
161
|
* Specify the tab index of the underlying `<input>`.
|
|
141
162
|
*/
|
|
@@ -18,6 +18,7 @@ var useDelayedState = require('../../internal/useDelayedState.js');
|
|
|
18
18
|
var useId = require('../../internal/useId.js');
|
|
19
19
|
var useNoInteractiveChildren = require('../../internal/useNoInteractiveChildren.js');
|
|
20
20
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
21
|
+
var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
21
22
|
var match = require('../../internal/keyboard/match.js');
|
|
22
23
|
var keys = require('../../internal/keyboard/keys.js');
|
|
23
24
|
|
|
@@ -84,7 +85,7 @@ function Tooltip(_ref) {
|
|
|
84
85
|
} else {
|
|
85
86
|
triggerProps['aria-describedby'] = id;
|
|
86
87
|
}
|
|
87
|
-
|
|
88
|
+
const onKeyDown = React.useCallback(event => {
|
|
88
89
|
if (open && match.match(event, keys.Escape)) {
|
|
89
90
|
event.stopPropagation();
|
|
90
91
|
setOpen(false);
|
|
@@ -92,7 +93,21 @@ function Tooltip(_ref) {
|
|
|
92
93
|
if (open && closeOnActivation && (match.match(event, keys.Enter) || match.match(event, keys.Space))) {
|
|
93
94
|
setOpen(false);
|
|
94
95
|
}
|
|
95
|
-
}
|
|
96
|
+
}, [closeOnActivation, open, setOpen]);
|
|
97
|
+
useIsomorphicEffect["default"](() => {
|
|
98
|
+
if (!open) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
function handleKeyDown(event) {
|
|
102
|
+
if (match.match(event, keys.Escape)) {
|
|
103
|
+
onKeyDown(event);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
107
|
+
return () => {
|
|
108
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
109
|
+
};
|
|
110
|
+
}, [open, onKeyDown]);
|
|
96
111
|
function onMouseEnter() {
|
|
97
112
|
// Interactive Tags should not support onMouseEnter
|
|
98
113
|
if (!rest?.onMouseEnter) {
|
|
@@ -143,25 +158,30 @@ function Tooltip(_ref) {
|
|
|
143
158
|
});
|
|
144
159
|
};
|
|
145
160
|
}, [isDragging, onDragStop]);
|
|
146
|
-
return
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
return (
|
|
162
|
+
/*#__PURE__*/
|
|
163
|
+
// @ts-ignore-error Popover throws a TS error everytime is imported
|
|
164
|
+
React__default["default"].createElement(index.Popover, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
165
|
+
align: align,
|
|
166
|
+
className: cx__default["default"](`${prefix}--tooltip`, customClassName),
|
|
167
|
+
dropShadow: false,
|
|
168
|
+
highContrast: true,
|
|
169
|
+
onKeyDown: onKeyDown,
|
|
170
|
+
onMouseLeave: onMouseLeave,
|
|
171
|
+
open: open
|
|
172
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
173
|
+
className: `${prefix}--tooltip-trigger__wrapper`
|
|
174
|
+
}, child !== undefined ? /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
175
|
+
...triggerProps,
|
|
176
|
+
...getChildEventHandlers(child.props)
|
|
177
|
+
}) : null), /*#__PURE__*/React__default["default"].createElement(index.PopoverContent, {
|
|
178
|
+
"aria-hidden": open ? 'false' : 'true',
|
|
179
|
+
className: `${prefix}--tooltip-content`,
|
|
180
|
+
id: id,
|
|
181
|
+
onMouseEnter: onMouseEnter,
|
|
182
|
+
role: "tooltip"
|
|
183
|
+
}, label || description))
|
|
184
|
+
);
|
|
165
185
|
}
|
|
166
186
|
Tooltip.propTypes = {
|
|
167
187
|
/**
|
|
@@ -29,7 +29,7 @@ declare const Content: {
|
|
|
29
29
|
suppressHydrationWarning?: boolean | undefined;
|
|
30
30
|
accessKey?: string | undefined;
|
|
31
31
|
autoFocus?: boolean | undefined;
|
|
32
|
-
contentEditable?:
|
|
32
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
|
|
33
33
|
contextMenu?: string | undefined;
|
|
34
34
|
dir?: string | undefined;
|
|
35
35
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
@@ -43,7 +43,7 @@ declare const Content: {
|
|
|
43
43
|
style?: React.CSSProperties | undefined;
|
|
44
44
|
tabIndex?: number | undefined;
|
|
45
45
|
title?: string | undefined;
|
|
46
|
-
translate?: "
|
|
46
|
+
translate?: "yes" | "no" | undefined;
|
|
47
47
|
radioGroup?: string | undefined;
|
|
48
48
|
role?: React.AriaRole | undefined;
|
|
49
49
|
about?: string | undefined;
|
|
@@ -93,7 +93,7 @@ declare const Content: {
|
|
|
93
93
|
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
94
94
|
"aria-flowto"?: string | undefined;
|
|
95
95
|
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
96
|
-
"aria-haspopup"?: boolean | "dialog" | "menu" | "
|
|
96
|
+
"aria-haspopup"?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
|
|
97
97
|
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
98
98
|
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
99
99
|
"aria-keyshortcuts"?: string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { HTMLAttributeAnchorTarget } from 'react';
|
|
2
2
|
interface BaseSwitcherItemProps {
|
|
3
3
|
/**
|
|
4
4
|
* Specify the text content for the link
|
|
@@ -43,6 +43,10 @@ interface BaseSwitcherItemProps {
|
|
|
43
43
|
* Optionally provide an href for the underlying li`
|
|
44
44
|
*/
|
|
45
45
|
href?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Specify where to open the link.
|
|
48
|
+
*/
|
|
49
|
+
target?: HTMLAttributeAnchorTarget;
|
|
46
50
|
}
|
|
47
51
|
interface SwitcherItemWithAriaLabel extends BaseSwitcherItemProps {
|
|
48
52
|
'aria-label': string;
|
|
@@ -38,6 +38,7 @@ const SwitcherItem = /*#__PURE__*/React.forwardRef(function SwitcherItem(props,
|
|
|
38
38
|
handleSwitcherItemFocus,
|
|
39
39
|
onKeyDown = () => {},
|
|
40
40
|
href,
|
|
41
|
+
target,
|
|
41
42
|
...rest
|
|
42
43
|
} = props;
|
|
43
44
|
const prefix = usePrefix.usePrefix();
|
|
@@ -75,6 +76,7 @@ const SwitcherItem = /*#__PURE__*/React.forwardRef(function SwitcherItem(props,
|
|
|
75
76
|
onKeyDown(evt);
|
|
76
77
|
},
|
|
77
78
|
href: href,
|
|
79
|
+
target: target,
|
|
78
80
|
ref: forwardRef
|
|
79
81
|
}, rest, {
|
|
80
82
|
className: linkClassName,
|
|
@@ -115,7 +117,11 @@ SwitcherItem.propTypes = {
|
|
|
115
117
|
/**
|
|
116
118
|
* Specify the tab index of the Link
|
|
117
119
|
*/
|
|
118
|
-
tabIndex: PropTypes__default["default"].number
|
|
120
|
+
tabIndex: PropTypes__default["default"].number,
|
|
121
|
+
/**
|
|
122
|
+
* Specify where to open the link.
|
|
123
|
+
*/
|
|
124
|
+
target: PropTypes__default["default"].string
|
|
119
125
|
};
|
|
120
126
|
|
|
121
127
|
exports["default"] = SwitcherItem;
|
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.59.0-rc.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@carbon/feature-flags": "^0.20.0",
|
|
52
52
|
"@carbon/icons-react": "^11.42.0",
|
|
53
53
|
"@carbon/layout": "^11.22.0",
|
|
54
|
-
"@carbon/styles": "^1.
|
|
54
|
+
"@carbon/styles": "^1.59.0-rc.0",
|
|
55
55
|
"@floating-ui/react": "^0.26.0",
|
|
56
56
|
"@ibm/telemetry-js": "^1.5.0",
|
|
57
57
|
"classnames": "2.5.1",
|
|
@@ -141,5 +141,5 @@
|
|
|
141
141
|
"**/*.scss",
|
|
142
142
|
"**/*.css"
|
|
143
143
|
],
|
|
144
|
-
"gitHead": "
|
|
144
|
+
"gitHead": "6269fa19f0ce2930b21a2fda05974a597126ec6b"
|
|
145
145
|
}
|