@carbon/react 1.87.1 → 1.88.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 +851 -851
- package/es/components/AILabel/index.d.ts +4 -3
- package/es/components/AILabel/index.js +3 -1
- package/es/components/Button/Button.js +3 -1
- package/es/components/CodeSnippet/CodeSnippet.d.ts +9 -5
- package/es/components/CodeSnippet/CodeSnippet.js +3 -1
- package/es/components/ComboBox/ComboBox.d.ts +2 -1
- package/es/components/ComboBox/ComboBox.js +2 -1
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +1 -6
- package/es/components/Copy/Copy.d.ts +9 -5
- package/es/components/Copy/Copy.js +3 -1
- package/es/components/CopyButton/CopyButton.d.ts +9 -5
- package/es/components/CopyButton/CopyButton.js +3 -1
- package/es/components/Dropdown/Dropdown.d.ts +4 -1
- package/es/components/Dropdown/Dropdown.js +4 -1
- package/es/components/FileUploader/FileUploaderButton.js +6 -3
- package/es/components/IconButton/index.d.ts +6 -4
- package/es/components/IconButton/index.js +3 -4
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +5 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +101 -22
- package/es/components/MultiSelect/MultiSelect.d.ts +2 -1
- package/es/components/MultiSelect/MultiSelect.js +2 -1
- package/es/components/Notification/Notification.d.ts +9 -1
- package/es/components/Notification/Notification.js +9 -1
- package/es/components/NumberInput/NumberInput.d.ts +4 -0
- package/es/components/NumberInput/NumberInput.js +12 -7
- package/es/components/OverflowMenu/next/index.d.ts +6 -2
- package/es/components/OverflowMenu/next/index.js +4 -1
- package/es/components/Popover/index.d.ts +4 -1
- package/es/components/Popover/index.js +12 -2
- package/es/components/Switch/IconSwitch.d.ts +44 -2
- package/es/components/Switch/IconSwitch.js +34 -27
- package/es/components/Switch/Switch.js +1 -0
- package/es/components/Toggletip/index.d.ts +4 -1
- package/es/components/Toggletip/index.js +4 -1
- package/es/components/Tooltip/DefinitionTooltip.d.ts +4 -2
- package/es/components/Tooltip/DefinitionTooltip.js +3 -1
- package/es/components/Tooltip/Tooltip.d.ts +0 -3
- package/es/components/Tooltip/Tooltip.js +2 -10
- package/es/components/TreeView/TreeNode.d.ts +4 -2
- package/es/components/TreeView/TreeNode.js +2 -1
- package/es/components/UIShell/HeaderPanel.js +1 -1
- package/es/internal/Selection.d.ts +1 -0
- package/es/internal/Selection.js +10 -0
- package/lib/components/AILabel/index.d.ts +4 -3
- package/lib/components/AILabel/index.js +3 -1
- package/lib/components/Button/Button.js +3 -1
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +9 -5
- package/lib/components/CodeSnippet/CodeSnippet.js +3 -1
- package/lib/components/ComboBox/ComboBox.d.ts +2 -1
- package/lib/components/ComboBox/ComboBox.js +2 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +1 -6
- package/lib/components/Copy/Copy.d.ts +9 -5
- package/lib/components/Copy/Copy.js +3 -1
- package/lib/components/CopyButton/CopyButton.d.ts +9 -5
- package/lib/components/CopyButton/CopyButton.js +3 -1
- package/lib/components/Dropdown/Dropdown.d.ts +4 -1
- package/lib/components/Dropdown/Dropdown.js +4 -1
- package/lib/components/FileUploader/FileUploaderButton.js +6 -3
- package/lib/components/IconButton/index.d.ts +6 -4
- package/lib/components/IconButton/index.js +3 -4
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +5 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +100 -21
- package/lib/components/MultiSelect/MultiSelect.d.ts +2 -1
- package/lib/components/MultiSelect/MultiSelect.js +2 -1
- package/lib/components/Notification/Notification.d.ts +9 -1
- package/lib/components/Notification/Notification.js +9 -1
- package/lib/components/NumberInput/NumberInput.d.ts +4 -0
- package/lib/components/NumberInput/NumberInput.js +12 -7
- package/lib/components/OverflowMenu/next/index.d.ts +6 -2
- package/lib/components/OverflowMenu/next/index.js +4 -1
- package/lib/components/Popover/index.d.ts +4 -1
- package/lib/components/Popover/index.js +12 -2
- package/lib/components/Switch/IconSwitch.d.ts +44 -2
- package/lib/components/Switch/IconSwitch.js +35 -28
- package/lib/components/Switch/Switch.js +1 -0
- package/lib/components/Toggletip/index.d.ts +4 -1
- package/lib/components/Toggletip/index.js +4 -1
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +4 -2
- package/lib/components/Tooltip/DefinitionTooltip.js +3 -1
- package/lib/components/Tooltip/Tooltip.d.ts +0 -3
- package/lib/components/Tooltip/Tooltip.js +2 -10
- package/lib/components/TreeView/TreeNode.d.ts +4 -2
- package/lib/components/TreeView/TreeNode.js +2 -1
- package/lib/components/UIShell/HeaderPanel.js +2 -2
- package/lib/internal/Selection.d.ts +1 -0
- package/lib/internal/Selection.js +10 -0
- package/package.json +7 -7
- package/telemetry.yml +2 -9
|
@@ -64,7 +64,14 @@ forwardRef) {
|
|
|
64
64
|
// The `Popover` should close whenever it and its children loses focus
|
|
65
65
|
useEvent.useEvent(popover, 'focusout', event => {
|
|
66
66
|
const relatedTarget = event.relatedTarget;
|
|
67
|
-
if (!
|
|
67
|
+
if (!relatedTarget) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const isOutsideMainContainer = !popover.current?.contains(relatedTarget);
|
|
71
|
+
const isOutsideFloating = enableFloatingStyles && refs.floating.current ? !refs.floating.current.contains(relatedTarget) : true;
|
|
72
|
+
|
|
73
|
+
// Only close if focus moved outside both containers
|
|
74
|
+
if (isOutsideMainContainer && isOutsideFloating) {
|
|
68
75
|
onRequestClose?.();
|
|
69
76
|
}
|
|
70
77
|
});
|
|
@@ -293,7 +300,10 @@ Popover.propTypes = {
|
|
|
293
300
|
*/
|
|
294
301
|
as: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
295
302
|
/**
|
|
296
|
-
* Will auto-align the popover on first render if it is not visible. This prop
|
|
303
|
+
* Will auto-align the popover on first render if it is not visible. This prop
|
|
304
|
+
* is currently experimental and is subject to future changes. Requires
|
|
305
|
+
* React v17+
|
|
306
|
+
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
297
307
|
*/
|
|
298
308
|
autoAlign: PropTypes.bool,
|
|
299
309
|
/**
|
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
*/
|
|
3
7
|
import React from 'react';
|
|
8
|
+
import { type IconButtonProps } from '../IconButton';
|
|
9
|
+
import type { SwitchEventHandlersParams } from './Switch';
|
|
10
|
+
interface IconSwitchProps extends Omit<IconButtonProps, 'onClick' | 'onKeyDown' | 'label' | 'name'> {
|
|
11
|
+
/**
|
|
12
|
+
* The index of the `IconSwitch`.
|
|
13
|
+
*
|
|
14
|
+
* Reserved for usage in `ContentSwitcher`.
|
|
15
|
+
*/
|
|
16
|
+
index?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The name of the `IconSwitch`.
|
|
19
|
+
*/
|
|
20
|
+
name?: string | number;
|
|
21
|
+
/**
|
|
22
|
+
* A handler that is invoked when a user clicks on the control.
|
|
23
|
+
*
|
|
24
|
+
* Reserved for usage in `ContentSwitcher`.
|
|
25
|
+
*/
|
|
26
|
+
onClick?: (params: SwitchEventHandlersParams) => void;
|
|
27
|
+
/**
|
|
28
|
+
* A handler that is invoked on the key down event for the control.
|
|
29
|
+
*
|
|
30
|
+
* Reserved for usage in `ContentSwitcher`.
|
|
31
|
+
*/
|
|
32
|
+
onKeyDown?: (params: SwitchEventHandlersParams) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the `IconSwitch` is selected.
|
|
35
|
+
*
|
|
36
|
+
* Reserved for usage in `ContentSwitcher`.
|
|
37
|
+
*/
|
|
38
|
+
selected?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* `Tooltip` text.
|
|
41
|
+
*/
|
|
42
|
+
text?: string;
|
|
43
|
+
}
|
|
44
|
+
declare const IconSwitch: React.ForwardRefExoticComponent<IconSwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
45
|
+
export default IconSwitch;
|
|
@@ -15,9 +15,10 @@ var React = require('react');
|
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var index = require('../IconButton/index.js');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
+
var noopFn = require('../../internal/noopFn.js');
|
|
18
19
|
|
|
19
|
-
const
|
|
20
|
-
const IconSwitch =
|
|
20
|
+
const frFn = React.forwardRef;
|
|
21
|
+
const IconSwitch = frFn((props, ref) => {
|
|
21
22
|
const {
|
|
22
23
|
align,
|
|
23
24
|
children,
|
|
@@ -27,8 +28,8 @@ const IconSwitch = /*#__PURE__*/React.forwardRef(function Switch(props, tabRef)
|
|
|
27
28
|
index: index$1,
|
|
28
29
|
leaveDelayMs = 0,
|
|
29
30
|
name,
|
|
30
|
-
onClick = noopFn,
|
|
31
|
-
onKeyDown = noopFn,
|
|
31
|
+
onClick = noopFn.noopFn,
|
|
32
|
+
onKeyDown = noopFn.noopFn,
|
|
32
33
|
selected = false,
|
|
33
34
|
size,
|
|
34
35
|
text,
|
|
@@ -36,8 +37,8 @@ const IconSwitch = /*#__PURE__*/React.forwardRef(function Switch(props, tabRef)
|
|
|
36
37
|
} = props;
|
|
37
38
|
const prefix = usePrefix.usePrefix();
|
|
38
39
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
39
|
-
const handleClick =
|
|
40
|
-
|
|
40
|
+
const handleClick = event => {
|
|
41
|
+
event.preventDefault();
|
|
41
42
|
onClick({
|
|
42
43
|
index: index$1,
|
|
43
44
|
name,
|
|
@@ -45,6 +46,7 @@ const IconSwitch = /*#__PURE__*/React.forwardRef(function Switch(props, tabRef)
|
|
|
45
46
|
});
|
|
46
47
|
};
|
|
47
48
|
const handleKeyDown = event => {
|
|
49
|
+
// TODO: `which` was deprecated years ago. When can its usage be deleted?
|
|
48
50
|
const key = event.key || event.which;
|
|
49
51
|
onKeyDown({
|
|
50
52
|
index: index$1,
|
|
@@ -66,20 +68,10 @@ const IconSwitch = /*#__PURE__*/React.forwardRef(function Switch(props, tabRef)
|
|
|
66
68
|
[`${prefix}--content-switcher-popover--selected`]: selected,
|
|
67
69
|
[`${prefix}--content-switcher-popover--disabled`]: disabled
|
|
68
70
|
});
|
|
69
|
-
const commonProps = {
|
|
70
|
-
onClick: handleClick,
|
|
71
|
-
onKeyDown: handleKeyDown,
|
|
72
|
-
className: classes,
|
|
73
|
-
disabled,
|
|
74
|
-
align,
|
|
75
|
-
enterDelayMs,
|
|
76
|
-
leaveDelayMs,
|
|
77
|
-
size
|
|
78
|
-
};
|
|
79
71
|
return /*#__PURE__*/React.createElement(index.IconButton, _rollupPluginBabelHelpers.extends({
|
|
80
72
|
label: text,
|
|
81
73
|
type: "button",
|
|
82
|
-
ref:
|
|
74
|
+
ref: ref,
|
|
83
75
|
role: "tab",
|
|
84
76
|
tabIndex: selected || isHovered ? 0 : -1,
|
|
85
77
|
onMouseEnter: handleMouseEnter,
|
|
@@ -89,7 +81,16 @@ const IconSwitch = /*#__PURE__*/React.forwardRef(function Switch(props, tabRef)
|
|
|
89
81
|
"aria-selected": selected,
|
|
90
82
|
"aria-label": text,
|
|
91
83
|
wrapperClasses: iconButtonClasses
|
|
92
|
-
}, other,
|
|
84
|
+
}, other, {
|
|
85
|
+
align: align,
|
|
86
|
+
className: classes,
|
|
87
|
+
disabled: disabled,
|
|
88
|
+
enterDelayMs: enterDelayMs,
|
|
89
|
+
leaveDelayMs: leaveDelayMs,
|
|
90
|
+
onClick: handleClick,
|
|
91
|
+
onKeyDown: handleKeyDown,
|
|
92
|
+
size: size
|
|
93
|
+
}), children);
|
|
93
94
|
});
|
|
94
95
|
IconSwitch.displayName = 'IconSwitch';
|
|
95
96
|
IconSwitch.propTypes = {
|
|
@@ -98,15 +99,15 @@ IconSwitch.propTypes = {
|
|
|
98
99
|
*/
|
|
99
100
|
align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
|
|
100
101
|
/**
|
|
101
|
-
*
|
|
102
|
+
* Children to be rendered inside of the `IconSwitch`.
|
|
102
103
|
*/
|
|
103
104
|
children: PropTypes.node,
|
|
104
105
|
/**
|
|
105
|
-
* Specify an optional className to be added to your
|
|
106
|
+
* Specify an optional className to be added to your `IconSwitch`.
|
|
106
107
|
*/
|
|
107
108
|
className: PropTypes.string,
|
|
108
109
|
/**
|
|
109
|
-
*
|
|
110
|
+
* Whether the `IconSwitch` should be disabled.
|
|
110
111
|
*/
|
|
111
112
|
disabled: PropTypes.bool,
|
|
112
113
|
/**
|
|
@@ -114,8 +115,9 @@ IconSwitch.propTypes = {
|
|
|
114
115
|
*/
|
|
115
116
|
enterDelayMs: PropTypes.number,
|
|
116
117
|
/**
|
|
117
|
-
* The index of
|
|
118
|
-
*
|
|
118
|
+
* The index of the `IconSwitch`.
|
|
119
|
+
*
|
|
120
|
+
* Reserved for usage in `ContentSwitcher`.
|
|
119
121
|
*/
|
|
120
122
|
index: PropTypes.number,
|
|
121
123
|
/**
|
|
@@ -123,29 +125,34 @@ IconSwitch.propTypes = {
|
|
|
123
125
|
*/
|
|
124
126
|
leaveDelayMs: PropTypes.number,
|
|
125
127
|
/**
|
|
126
|
-
*
|
|
128
|
+
* The name of the `IconSwitch`.
|
|
127
129
|
*/
|
|
128
130
|
name: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
129
131
|
/**
|
|
130
132
|
* A handler that is invoked when a user clicks on the control.
|
|
131
|
-
*
|
|
133
|
+
*
|
|
134
|
+
* Reserved for usage in `ContentSwitcher`.
|
|
132
135
|
*/
|
|
133
136
|
onClick: PropTypes.func,
|
|
134
137
|
/**
|
|
135
138
|
* A handler that is invoked on the key down event for the control.
|
|
136
|
-
*
|
|
139
|
+
*
|
|
140
|
+
* Reserved for usage in `ContentSwitcher`.
|
|
137
141
|
*/
|
|
138
142
|
onKeyDown: PropTypes.func,
|
|
139
143
|
/**
|
|
140
|
-
* Whether
|
|
144
|
+
* Whether the `IconSwitch` is selected.
|
|
145
|
+
*
|
|
146
|
+
* Reserved for usage in `ContentSwitcher`.
|
|
141
147
|
*/
|
|
142
148
|
selected: PropTypes.bool,
|
|
149
|
+
// TODO: Icon only variant of what? Isn't the `IconSwitch` always icon only?
|
|
143
150
|
/**
|
|
144
151
|
* Passed in from `ContentSwitcher` to render icon-only variant
|
|
145
152
|
*/
|
|
146
153
|
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
147
154
|
/**
|
|
148
|
-
*
|
|
155
|
+
* `Tooltip` text.
|
|
149
156
|
*/
|
|
150
157
|
text: PropTypes.string
|
|
151
158
|
};
|
|
@@ -39,6 +39,7 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(props, tabRef) {
|
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
const handleKeyDown = event => {
|
|
42
|
+
// TODO: `which` was deprecated years ago. When can its usage be deleted?
|
|
42
43
|
const key = event.key || event.which;
|
|
43
44
|
onKeyDown?.({
|
|
44
45
|
index,
|
|
@@ -67,7 +67,10 @@ export declare namespace Toggletip {
|
|
|
67
67
|
*/
|
|
68
68
|
as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
|
|
69
69
|
/**
|
|
70
|
-
* Will auto-align the popover on first render if it is not visible. This prop
|
|
70
|
+
* Will auto-align the popover on first render if it is not visible. This prop
|
|
71
|
+
* is currently experimental and is subject to future changes. Requires
|
|
72
|
+
* React v17+
|
|
73
|
+
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
71
74
|
*/
|
|
72
75
|
autoAlign: PropTypes.Requireable<boolean>;
|
|
73
76
|
/**
|
|
@@ -187,7 +187,10 @@ Toggletip.propTypes = {
|
|
|
187
187
|
*/
|
|
188
188
|
as: PropTypes.elementType,
|
|
189
189
|
/**
|
|
190
|
-
* Will auto-align the popover on first render if it is not visible. This prop
|
|
190
|
+
* Will auto-align the popover on first render if it is not visible. This prop
|
|
191
|
+
* is currently experimental and is subject to future changes. Requires
|
|
192
|
+
* React v17+
|
|
193
|
+
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
191
194
|
*/
|
|
192
195
|
autoAlign: PropTypes.bool,
|
|
193
196
|
/**
|
|
@@ -12,13 +12,15 @@ export interface DefinitionTooltipProps extends Omit<React.ButtonHTMLAttributes<
|
|
|
12
12
|
*/
|
|
13
13
|
align?: PopoverAlignment;
|
|
14
14
|
/**
|
|
15
|
-
* Will auto-align Definition Tooltip. This prop is currently experimental
|
|
15
|
+
* Will auto-align Definition Tooltip. This prop is currently experimental
|
|
16
|
+
* and is subject to future changes. Requires React v17+
|
|
17
|
+
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
16
18
|
*/
|
|
17
19
|
autoAlign?: boolean;
|
|
18
20
|
/**
|
|
19
21
|
* The `children` prop will be used as the value that is being defined
|
|
20
22
|
*/
|
|
21
|
-
children
|
|
23
|
+
children: React.ReactNode;
|
|
22
24
|
/**
|
|
23
25
|
* Specify an optional className to be applied to the container node
|
|
24
26
|
*/
|
|
@@ -103,7 +103,9 @@ DefinitionTooltip.propTypes = {
|
|
|
103
103
|
// new values to match floating-ui
|
|
104
104
|
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
105
105
|
/**
|
|
106
|
-
* Will auto-align the popover. This prop is currently experimental and is
|
|
106
|
+
* Will auto-align the popover. This prop is currently experimental and is
|
|
107
|
+
* subject to future changes. Requires React v17+
|
|
108
|
+
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
107
109
|
*/
|
|
108
110
|
autoAlign: PropTypes.bool,
|
|
109
111
|
/**
|
|
@@ -54,9 +54,6 @@ interface TooltipBaseProps {
|
|
|
54
54
|
/**
|
|
55
55
|
* Provide the label to be rendered inside of the Tooltip. The label will use
|
|
56
56
|
* `aria-labelledby` and will fully describe the child node that is provided.
|
|
57
|
-
* If the child already has an `aria-label`, the tooltip will not apply
|
|
58
|
-
* `aria-labelledby`. If the child has its own `aria-labelledby`, that value
|
|
59
|
-
* will be kept. Otherwise, the tooltip will use its own ID to label the child.
|
|
60
57
|
* This means that if you have text in the child node, that it will not be
|
|
61
58
|
* announced to the screen reader.
|
|
62
59
|
*
|
|
@@ -48,20 +48,12 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
48
48
|
const prefix = usePrefix.usePrefix();
|
|
49
49
|
const child = React.Children.only(children);
|
|
50
50
|
const {
|
|
51
|
-
'aria-label': ariaLabel,
|
|
52
51
|
'aria-labelledby': ariaLabelledBy,
|
|
53
52
|
'aria-describedby': ariaDescribedBy
|
|
54
53
|
} = child?.props ?? {};
|
|
55
54
|
const hasLabel = !!label;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
// An `aria-label` takes precedence over `aria-describedby`, but when it's
|
|
59
|
-
// needed and the user doesn't specify one, the fallback `id` is used.
|
|
60
|
-
const labelledBy = hasAriaLabel ? undefined : hasLabel ? ariaLabelledBy ?? id : undefined;
|
|
61
|
-
|
|
62
|
-
// If `aria-label` is present, use any provided `aria-describedby`.
|
|
63
|
-
// If not, fallback to child's `aria-describedby` or the tooltip `id` if needed.
|
|
64
|
-
const describedBy = hasAriaLabel ? ariaDescribedBy : ariaDescribedBy ?? (!hasLabel && !ariaLabelledBy ? id : undefined);
|
|
55
|
+
const labelledBy = ariaLabelledBy ?? (hasLabel ? id : undefined);
|
|
56
|
+
const describedBy = ariaDescribedBy ?? (!hasLabel ? id : undefined);
|
|
65
57
|
const triggerProps = {
|
|
66
58
|
onFocus: () => !focusByMouse && setOpen(true),
|
|
67
59
|
onBlur: () => {
|
|
@@ -88,7 +88,8 @@ export type TreeNodeProps = {
|
|
|
88
88
|
/**
|
|
89
89
|
* **Experimental**: Will attempt to automatically align the floating
|
|
90
90
|
* element to avoid collisions with the viewport and being clipped by
|
|
91
|
-
* ancestor elements.
|
|
91
|
+
* ancestor elements. Requires React v17+
|
|
92
|
+
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
92
93
|
*/
|
|
93
94
|
autoAlign?: boolean;
|
|
94
95
|
} & Omit<React.LiHTMLAttributes<HTMLElement>, 'onSelect'>;
|
|
@@ -173,7 +174,8 @@ declare const TreeNode: React.ForwardRefExoticComponent<{
|
|
|
173
174
|
/**
|
|
174
175
|
* **Experimental**: Will attempt to automatically align the floating
|
|
175
176
|
* element to avoid collisions with the viewport and being clipped by
|
|
176
|
-
* ancestor elements.
|
|
177
|
+
* ancestor elements. Requires React v17+
|
|
178
|
+
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
177
179
|
*/
|
|
178
180
|
autoAlign?: boolean;
|
|
179
181
|
} & Omit<React.LiHTMLAttributes<HTMLElement>, "onSelect"> & React.RefAttributes<HTMLElement>>;
|
|
@@ -494,7 +494,8 @@ TreeNode.propTypes = {
|
|
|
494
494
|
/**
|
|
495
495
|
* **Experimental**: Will attempt to automatically align the floating
|
|
496
496
|
* element to avoid collisions with the viewport and being clipped by
|
|
497
|
-
* ancestor elements.
|
|
497
|
+
* ancestor elements. Requires React v17+
|
|
498
|
+
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
498
499
|
*/
|
|
499
500
|
autoAlign: PropTypes.bool
|
|
500
501
|
};
|
|
@@ -19,14 +19,14 @@ var match = require('../../internal/keyboard/match.js');
|
|
|
19
19
|
var useEvent = require('../../internal/useEvent.js');
|
|
20
20
|
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
21
21
|
var Switcher = require('./Switcher.js');
|
|
22
|
+
var noopFn = require('../../internal/noopFn.js');
|
|
22
23
|
|
|
23
|
-
const noopFn = () => {};
|
|
24
24
|
const HeaderPanel = /*#__PURE__*/React.forwardRef(function HeaderPanel({
|
|
25
25
|
children,
|
|
26
26
|
className: customClassName,
|
|
27
27
|
expanded,
|
|
28
28
|
addFocusListeners = true,
|
|
29
|
-
onHeaderPanelFocus = noopFn,
|
|
29
|
+
onHeaderPanelFocus = noopFn.noopFn,
|
|
30
30
|
href,
|
|
31
31
|
...rest
|
|
32
32
|
}, ref) {
|
|
@@ -18,6 +18,7 @@ interface UseSelectionProps<ItemType> {
|
|
|
18
18
|
export declare const useSelection: <ItemType>({ disabled, onChange, initialSelectedItems, selectedItems: controlledItems, selectAll, filteredItems, }: UseSelectionProps<ItemType>) => {
|
|
19
19
|
clearSelection: () => void;
|
|
20
20
|
onItemChange: (item: ItemType) => void;
|
|
21
|
+
toggleAll: (items: ItemType[]) => void;
|
|
21
22
|
selectedItems: ItemType[];
|
|
22
23
|
};
|
|
23
24
|
interface SelectionRenderProps<ItemType> {
|
|
@@ -92,6 +92,15 @@ const useSelection = ({
|
|
|
92
92
|
selectedItems: []
|
|
93
93
|
});
|
|
94
94
|
}, [disabled, isControlled]);
|
|
95
|
+
const toggleAll = React.useCallback(items => {
|
|
96
|
+
callOnChangeHandler({
|
|
97
|
+
isControlled,
|
|
98
|
+
isMounted: isMounted.current,
|
|
99
|
+
onChangeHandlerControlled: savedOnChange.current,
|
|
100
|
+
onChangeHandlerUncontrolled: setUncontrolledItems,
|
|
101
|
+
selectedItems: items
|
|
102
|
+
});
|
|
103
|
+
}, [isControlled]);
|
|
95
104
|
React.useEffect(() => {
|
|
96
105
|
savedOnChange.current = onChange;
|
|
97
106
|
}, [onChange]);
|
|
@@ -111,6 +120,7 @@ const useSelection = ({
|
|
|
111
120
|
return {
|
|
112
121
|
clearSelection,
|
|
113
122
|
onItemChange,
|
|
123
|
+
toggleAll,
|
|
114
124
|
selectedItems
|
|
115
125
|
};
|
|
116
126
|
};
|
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.88.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@babel/runtime": "^7.27.3",
|
|
55
|
-
"@carbon/feature-flags": "^0.
|
|
56
|
-
"@carbon/icons-react": "^11.
|
|
57
|
-
"@carbon/layout": "^11.
|
|
58
|
-
"@carbon/styles": "^1.
|
|
55
|
+
"@carbon/feature-flags": "^0.29.0",
|
|
56
|
+
"@carbon/icons-react": "^11.64.0",
|
|
57
|
+
"@carbon/layout": "^11.38.0",
|
|
58
|
+
"@carbon/styles": "^1.87.0",
|
|
59
59
|
"@carbon/utilities": "^0.7.0",
|
|
60
60
|
"@floating-ui/react": "^0.27.4",
|
|
61
61
|
"@ibm/telemetry-js": "^1.5.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@babel/preset-react": "^7.27.1",
|
|
81
81
|
"@babel/preset-typescript": "^7.27.1",
|
|
82
82
|
"@carbon/test-utils": "^10.36.0",
|
|
83
|
-
"@carbon/themes": "^11.
|
|
83
|
+
"@carbon/themes": "^11.57.0",
|
|
84
84
|
"@figma/code-connect": "^1.3.2",
|
|
85
85
|
"@rollup/plugin-babel": "^6.0.0",
|
|
86
86
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
@@ -139,5 +139,5 @@
|
|
|
139
139
|
"**/*.scss",
|
|
140
140
|
"**/*.css"
|
|
141
141
|
],
|
|
142
|
-
"gitHead": "
|
|
142
|
+
"gitHead": "6568a3389c2a82348c693b167b511dea66b7b269"
|
|
143
143
|
}
|
package/telemetry.yml
CHANGED
|
@@ -26,6 +26,7 @@ collect:
|
|
|
26
26
|
- autoAlign
|
|
27
27
|
- autoComplete
|
|
28
28
|
- buttonKind
|
|
29
|
+
- caption
|
|
29
30
|
- checked
|
|
30
31
|
- children
|
|
31
32
|
- className
|
|
@@ -450,6 +451,7 @@ collect:
|
|
|
450
451
|
- notificationType
|
|
451
452
|
# NumberInput
|
|
452
453
|
- hideSteppers
|
|
454
|
+
- stepStartValue
|
|
453
455
|
# OrderedList
|
|
454
456
|
- native
|
|
455
457
|
# OverflowMenuItem
|
|
@@ -601,7 +603,6 @@ collect:
|
|
|
601
603
|
- warning
|
|
602
604
|
- warningText
|
|
603
605
|
# ToastNotification
|
|
604
|
-
- caption
|
|
605
606
|
- timeout
|
|
606
607
|
# Toggle
|
|
607
608
|
- defaultToggled
|
|
@@ -850,17 +851,9 @@ collect:
|
|
|
850
851
|
- g90
|
|
851
852
|
- white
|
|
852
853
|
# General - tooltipAlignment
|
|
853
|
-
- bottom
|
|
854
|
-
- bottom-left
|
|
855
|
-
- bottom-right
|
|
856
854
|
- center
|
|
857
855
|
- end
|
|
858
|
-
- left
|
|
859
|
-
- right
|
|
860
856
|
- start
|
|
861
|
-
- top
|
|
862
|
-
- top-left
|
|
863
|
-
- top-right
|
|
864
857
|
# General - tooltipPosition
|
|
865
858
|
- bottom
|
|
866
859
|
- left
|