carbon-addons-iot-react 4.2.0 → 4.2.2
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/css/carbon-addons-iot-react.css +479 -130
- package/css/carbon-addons-iot-react.css.map +1 -1
- package/es/node_modules/@carbon/feature-flags/es/index.js +44 -2
- package/es/node_modules/@carbon/react/es/components/FeatureFlags/index.js +4 -1
- package/es/node_modules/@carbon/react/es/components/IconButton/index.js +5 -3
- package/es/node_modules/@carbon/react/es/components/OverflowMenu/OverflowMenu.js +7 -6
- package/es/node_modules/@carbon/react/es/components/Popover/index.js +36 -9
- package/es/node_modules/@carbon/react/es/components/Tooltip/Tooltip.js +30 -23
- package/es/node_modules/@carbon/react/es/internal/FloatingMenu.js +10 -2
- package/es/node_modules/@carbon/react/es/internal/useMergedRefs.js +1 -0
- package/es/node_modules/@carbon/react/es/internal/useNoInteractiveChildren.js +3 -0
- package/es/node_modules/@carbon/react/es/internal/useOutsideClick.js +1 -0
- package/es/node_modules/@carbon/react/es/internal/warning.js +1 -0
- package/es/node_modules/@carbon/react/es/prop-types/deprecateValuesWithin.js +6 -6
- package/es/node_modules/@carbon/react/es/tools/mergeRefs.js +16 -12
- package/lib/css/carbon-addons-iot-react.css +479 -130
- package/lib/css/carbon-addons-iot-react.css.map +1 -1
- package/lib/node_modules/@carbon/feature-flags/es/index.js +44 -2
- package/lib/node_modules/@carbon/react/es/components/FeatureFlags/index.js +4 -1
- package/lib/node_modules/@carbon/react/es/components/IconButton/index.js +5 -3
- package/lib/node_modules/@carbon/react/es/components/OverflowMenu/OverflowMenu.js +7 -6
- package/lib/node_modules/@carbon/react/es/components/Popover/index.js +36 -9
- package/lib/node_modules/@carbon/react/es/components/Tooltip/Tooltip.js +30 -23
- package/lib/node_modules/@carbon/react/es/internal/FloatingMenu.js +10 -2
- package/lib/node_modules/@carbon/react/es/internal/useMergedRefs.js +1 -0
- package/lib/node_modules/@carbon/react/es/internal/useNoInteractiveChildren.js +3 -0
- package/lib/node_modules/@carbon/react/es/internal/useOutsideClick.js +1 -0
- package/lib/node_modules/@carbon/react/es/internal/warning.js +1 -0
- package/lib/node_modules/@carbon/react/es/prop-types/deprecateValuesWithin.js +6 -6
- package/lib/node_modules/@carbon/react/es/tools/mergeRefs.js +16 -12
- package/package.json +3 -3
- package/umd/carbon-addons-iot-react.js +158 -58
|
@@ -43,6 +43,15 @@ try {
|
|
|
43
43
|
} else {
|
|
44
44
|
enabled$1.enableExperimentalTileContrast = false;
|
|
45
45
|
}
|
|
46
|
+
if (process.env.CARBON_ENABLE_TILE_CONTRAST) {
|
|
47
|
+
if (process.env.CARBON_ENABLE_TILE_CONTRAST === 'true') {
|
|
48
|
+
enabled$1.enableTileContrast = true;
|
|
49
|
+
} else {
|
|
50
|
+
enabled$1.enableTileContrast = false;
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
enabled$1.enableTileContrast = false;
|
|
54
|
+
}
|
|
46
55
|
if (process.env.CARBON_ENABLE_V12_TILE_DEFAULT_ICONS) {
|
|
47
56
|
if (process.env.CARBON_ENABLE_V12_TILE_DEFAULT_ICONS === 'true') {
|
|
48
57
|
enabled$1.enableV12TileDefaultIcons = true;
|
|
@@ -97,6 +106,15 @@ try {
|
|
|
97
106
|
} else {
|
|
98
107
|
enabled$1.enableExperimentalFocusWrapWithoutSentinels = false;
|
|
99
108
|
}
|
|
109
|
+
if (process.env.CARBON_ENABLE_FOCUS_WRAP_WITHOUT_SENTINELS) {
|
|
110
|
+
if (process.env.CARBON_ENABLE_FOCUS_WRAP_WITHOUT_SENTINELS === 'true') {
|
|
111
|
+
enabled$1.enableFocusWrapWithoutSentinels = true;
|
|
112
|
+
} else {
|
|
113
|
+
enabled$1.enableFocusWrapWithoutSentinels = false;
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
enabled$1.enableFocusWrapWithoutSentinels = false;
|
|
117
|
+
}
|
|
100
118
|
if (process.env.CARBON_ENABLE_DIALOG_ELEMENT) {
|
|
101
119
|
if (process.env.CARBON_ENABLE_DIALOG_ELEMENT === 'true') {
|
|
102
120
|
enabled$1.enableDialogElement = true;
|
|
@@ -133,21 +151,33 @@ try {
|
|
|
133
151
|
} else {
|
|
134
152
|
enabled$1.enableEnhancedFileUploader = false;
|
|
135
153
|
}
|
|
154
|
+
if (process.env.CARBON_ENABLE_PRESENCE) {
|
|
155
|
+
if (process.env.CARBON_ENABLE_PRESENCE === 'true') {
|
|
156
|
+
enabled$1.enablePresence = true;
|
|
157
|
+
} else {
|
|
158
|
+
enabled$1.enablePresence = false;
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
enabled$1.enablePresence = false;
|
|
162
|
+
}
|
|
136
163
|
} catch (error) {
|
|
137
164
|
enabled$1.enableCssCustomProperties = false;
|
|
138
165
|
enabled$1.enableCssGrid = false;
|
|
139
166
|
enabled$1.enableV11Release = true;
|
|
140
167
|
enabled$1.enableExperimentalTileContrast = false;
|
|
168
|
+
enabled$1.enableTileContrast = false;
|
|
141
169
|
enabled$1.enableV12TileDefaultIcons = false;
|
|
142
170
|
enabled$1.enableV12TileRadioIcons = false;
|
|
143
171
|
enabled$1.enableV12Overflowmenu = false;
|
|
144
172
|
enabled$1.enableTreeviewControllable = false;
|
|
145
173
|
enabled$1.enableV12StructuredListVisibleIcons = false;
|
|
146
174
|
enabled$1.enableExperimentalFocusWrapWithoutSentinels = false;
|
|
175
|
+
enabled$1.enableFocusWrapWithoutSentinels = false;
|
|
147
176
|
enabled$1.enableDialogElement = false;
|
|
148
177
|
enabled$1.enableV12DynamicFloatingStyles = false;
|
|
149
178
|
enabled$1.enableV12ToggleReducedLabelSpacing = false;
|
|
150
179
|
enabled$1.enableEnhancedFileUploader = false;
|
|
180
|
+
enabled$1.enablePresence = false;
|
|
151
181
|
}
|
|
152
182
|
var featureFlagInfo = [{
|
|
153
183
|
name: "enable-css-custom-properties",
|
|
@@ -163,8 +193,12 @@ var featureFlagInfo = [{
|
|
|
163
193
|
enabled: enabled$1.enableV11Release
|
|
164
194
|
}, {
|
|
165
195
|
name: "enable-experimental-tile-contrast",
|
|
166
|
-
description: "
|
|
196
|
+
description: "Deprecated, use enable-tile-contrast instead\n",
|
|
167
197
|
enabled: enabled$1.enableExperimentalTileContrast
|
|
198
|
+
}, {
|
|
199
|
+
name: "enable-tile-contrast",
|
|
200
|
+
description: "Enable the experimental tile improved contrast styles\n",
|
|
201
|
+
enabled: enabled$1.enableTileContrast
|
|
168
202
|
}, {
|
|
169
203
|
name: "enable-v12-tile-default-icons",
|
|
170
204
|
description: "Enable rendering of default icons in the tile components\n",
|
|
@@ -187,8 +221,12 @@ var featureFlagInfo = [{
|
|
|
187
221
|
enabled: enabled$1.enableV12StructuredListVisibleIcons
|
|
188
222
|
}, {
|
|
189
223
|
name: "enable-experimental-focus-wrap-without-sentinels",
|
|
190
|
-
description: "
|
|
224
|
+
description: "Deprecated, use enable-focus-wrap-without-sentinels instead\n",
|
|
191
225
|
enabled: enabled$1.enableExperimentalFocusWrapWithoutSentinels
|
|
226
|
+
}, {
|
|
227
|
+
name: "enable-focus-wrap-without-sentinels",
|
|
228
|
+
description: "Enable the new focus wrap behavior that doesn't use sentinel nodes\n",
|
|
229
|
+
enabled: enabled$1.enableFocusWrapWithoutSentinels
|
|
192
230
|
}, {
|
|
193
231
|
name: "enable-dialog-element",
|
|
194
232
|
description: "Enable components to utilize the native dialog element\n",
|
|
@@ -205,6 +243,10 @@ var featureFlagInfo = [{
|
|
|
205
243
|
name: "enable-enhanced-file-uploader",
|
|
206
244
|
description: "Enable enhanced functionality for the FileUploader component, including richer callback data and expanded trigger events for onChange and onDelete.\n",
|
|
207
245
|
enabled: enabled$1.enableEnhancedFileUploader
|
|
246
|
+
}, {
|
|
247
|
+
name: "enable-presence",
|
|
248
|
+
description: "Enable components to remain unmounted in closed state and mount in open state.\n",
|
|
249
|
+
enabled: enabled$1.enablePresence
|
|
208
250
|
}];
|
|
209
251
|
|
|
210
252
|
function _arrayLikeToArray(r, a) {
|
|
@@ -11,6 +11,7 @@ import { deprecate } from '../../prop-types/deprecate.js';
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
// TODO: Can this variable be deleted now? It isn't used anywhere.
|
|
14
15
|
/**
|
|
15
16
|
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
|
16
17
|
* or disable feature flags in a given React tree
|
|
@@ -27,9 +28,11 @@ const FeatureFlagContext = /*#__PURE__*/createContext(FeatureFlags);
|
|
|
27
28
|
enableV12Overflowmenu: PropTypes.bool,
|
|
28
29
|
enableTreeviewControllable: PropTypes.bool,
|
|
29
30
|
enableExperimentalFocusWrapWithoutSentinels: PropTypes.bool,
|
|
31
|
+
enableFocusWrapWithoutSentinels: PropTypes.bool,
|
|
30
32
|
enableDialogElement: PropTypes.bool,
|
|
31
33
|
enableV12DynamicFloatingStyles: PropTypes.bool,
|
|
32
|
-
enableEnhancedFileUploader: PropTypes.bool
|
|
34
|
+
enableEnhancedFileUploader: PropTypes.bool,
|
|
35
|
+
enablePresence: PropTypes.bool
|
|
33
36
|
});
|
|
34
37
|
|
|
35
38
|
/**
|
|
@@ -6,7 +6,7 @@ import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
|
6
6
|
import { useId } from '../../internal/useId.js';
|
|
7
7
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
8
8
|
import ButtonBase from '../Button/ButtonBase.js';
|
|
9
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
9
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
10
10
|
import { BadgeIndicator } from '../BadgeIndicator/index.js';
|
|
11
11
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
12
12
|
|
|
@@ -19,7 +19,8 @@ import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
const IconButtonKinds = ['primary', 'secondary', 'ghost', 'tertiary'];
|
|
22
|
-
|
|
22
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
23
|
+
const IconButton = /*#__PURE__*/React__default.forwardRef(({
|
|
23
24
|
align,
|
|
24
25
|
autoAlign = false,
|
|
25
26
|
badgeCount,
|
|
@@ -38,12 +39,13 @@ const IconButton = /*#__PURE__*/React__default.forwardRef(function IconButton({
|
|
|
38
39
|
size,
|
|
39
40
|
isSelected,
|
|
40
41
|
...rest
|
|
41
|
-
}, ref) {
|
|
42
|
+
}, ref) => {
|
|
42
43
|
const prefix = usePrefix();
|
|
43
44
|
const tooltipClasses = classnames(wrapperClasses, `${prefix}--icon-tooltip`, {
|
|
44
45
|
[`${prefix}--icon-tooltip--disabled`]: disabled
|
|
45
46
|
});
|
|
46
47
|
if (badgeCount && (kind !== 'ghost' || size !== 'lg')) {
|
|
48
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
47
49
|
console.warn("The prop BadgeCount must be used with hasIconOnly=true, kind='ghost' and size='lg'");
|
|
48
50
|
}
|
|
49
51
|
const badgeId = useId('badge-indicator');
|
|
@@ -10,11 +10,11 @@ import { matches } from '../../internal/keyboard/match.js';
|
|
|
10
10
|
import { noopFn } from '../../internal/noopFn.js';
|
|
11
11
|
import { PrefixContext } from '../../internal/usePrefix.js';
|
|
12
12
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
13
|
-
import mergeRefs from '../../tools/mergeRefs.js';
|
|
13
|
+
import { mergeRefs } from '../../tools/mergeRefs.js';
|
|
14
14
|
import { setupGetInstanceId } from '../../tools/setupGetInstanceId.js';
|
|
15
15
|
import { IconButton } from '../IconButton/index.js';
|
|
16
16
|
import { useOutsideClick } from '../../internal/useOutsideClick.js';
|
|
17
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
17
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
18
18
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -67,6 +67,7 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
67
67
|
{
|
|
68
68
|
!(triggerButtonPositionProp && triggerButtonPositionFactor) ? invariant_1(false, '[OverflowMenu] wrong floating menu direction: `%s`', direction) : void 0;
|
|
69
69
|
}
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
70
71
|
const {
|
|
71
72
|
offsetWidth: menuWidth,
|
|
72
73
|
offsetHeight: menuHeight
|
|
@@ -89,6 +90,7 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
92
|
};
|
|
93
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
92
94
|
const OverflowMenu = /*#__PURE__*/forwardRef(({
|
|
93
95
|
align,
|
|
94
96
|
['aria-label']: ariaLabel = null,
|
|
@@ -170,8 +172,7 @@ const OverflowMenu = /*#__PURE__*/forwardRef(({
|
|
|
170
172
|
if (onCloseMenu) {
|
|
171
173
|
onCloseMenu();
|
|
172
174
|
}
|
|
173
|
-
|
|
174
|
-
}, [onClose]);
|
|
175
|
+
}, []);
|
|
175
176
|
const closeMenuAndFocus = useCallback(() => {
|
|
176
177
|
const wasClicked = click;
|
|
177
178
|
const wasOpen = open;
|
|
@@ -463,9 +464,9 @@ OverflowMenu.propTypes = {
|
|
|
463
464
|
*/
|
|
464
465
|
selectorPrimaryFocus: PropTypes.string,
|
|
465
466
|
/**
|
|
466
|
-
* Specify the size of the OverflowMenu. Currently supports either `sm`, `md` (default) or `lg` as an option.
|
|
467
|
+
* Specify the size of the OverflowMenu. Currently supports either `xs`, `sm`, `md` (default) or `lg` as an option.
|
|
467
468
|
*/
|
|
468
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg'])
|
|
469
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg'])
|
|
469
470
|
};
|
|
470
471
|
|
|
471
472
|
export { OverflowMenu, OverflowMenu as default, getMenuOffset };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
4
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
5
5
|
import React__default, { useRef, useMemo, useEffect } from 'react';
|
|
6
6
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
7
7
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
@@ -42,17 +42,21 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
|
|
|
42
42
|
as: BaseComponent = 'span',
|
|
43
43
|
autoAlign = false,
|
|
44
44
|
autoAlignBoundary,
|
|
45
|
+
backgroundToken = 'layer',
|
|
45
46
|
caret = isTabTip ? false : true,
|
|
46
47
|
className: customClassName,
|
|
47
48
|
children,
|
|
49
|
+
border = false,
|
|
48
50
|
dropShadow = true,
|
|
49
51
|
highContrast = false,
|
|
50
52
|
onRequestClose,
|
|
51
53
|
open,
|
|
52
54
|
alignmentAxisOffset,
|
|
53
55
|
...rest
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
54
57
|
},
|
|
55
58
|
//this is a workaround, have to come back and fix this.
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
56
60
|
forwardRef) {
|
|
57
61
|
const prefix = usePrefix();
|
|
58
62
|
const floating = useRef(null);
|
|
@@ -64,8 +68,12 @@ forwardRef) {
|
|
|
64
68
|
// The `Popover` should close whenever it and its children loses focus
|
|
65
69
|
useEvent(popover, 'focusout', event => {
|
|
66
70
|
const relatedTarget = event.relatedTarget;
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
if (isTabTip) {
|
|
72
|
+
if (relatedTarget && !popover.current?.contains(relatedTarget)) {
|
|
73
|
+
onRequestClose?.();
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
69
77
|
if (!relatedTarget) {
|
|
70
78
|
onRequestClose?.();
|
|
71
79
|
return;
|
|
@@ -90,7 +98,12 @@ forwardRef) {
|
|
|
90
98
|
// needs to be placed 1px further outside the popover content. To do so,
|
|
91
99
|
// we look to see if any of the children has a className containing "slug"
|
|
92
100
|
const initialCaretHeight = React__default.Children.toArray(children).some(x => {
|
|
93
|
-
return
|
|
101
|
+
return (
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
103
|
+
x?.props?.className?.includes('slug') ||
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
105
|
+
x?.props?.className?.includes('ai-label')
|
|
106
|
+
);
|
|
94
107
|
}) ? 7 : 6;
|
|
95
108
|
// These defaults match the defaults defined in packages/styles/scss/components/popover/_popover.scss
|
|
96
109
|
const popoverDimensions = useRef({
|
|
@@ -141,7 +154,8 @@ forwardRef) {
|
|
|
141
154
|
fallbackAxisSideDirection: 'start',
|
|
142
155
|
boundary: autoAlignBoundary
|
|
143
156
|
}), arrow({
|
|
144
|
-
element: caretRef
|
|
157
|
+
element: caretRef,
|
|
158
|
+
padding: 16
|
|
145
159
|
}), autoAlign && hide()],
|
|
146
160
|
whileElementsMounted: autoUpdate
|
|
147
161
|
} : {}
|
|
@@ -202,13 +216,16 @@ forwardRef) {
|
|
|
202
216
|
[`${prefix}--popover-container`]: true,
|
|
203
217
|
[`${prefix}--popover--caret`]: caret,
|
|
204
218
|
[`${prefix}--popover--drop-shadow`]: dropShadow,
|
|
219
|
+
[`${prefix}--popover--border`]: border,
|
|
205
220
|
[`${prefix}--popover--high-contrast`]: highContrast,
|
|
206
221
|
[`${prefix}--popover--open`]: open,
|
|
207
222
|
[`${prefix}--popover--auto-align ${prefix}--autoalign`]: enableFloatingStyles,
|
|
208
223
|
[`${prefix}--popover--${currentAlignment}`]: true,
|
|
209
|
-
[`${prefix}--popover--tab-tip`]: isTabTip
|
|
224
|
+
[`${prefix}--popover--tab-tip`]: isTabTip,
|
|
225
|
+
[`${prefix}--popover--background-token__background`]: backgroundToken === 'background' && !highContrast
|
|
210
226
|
}, customClassName);
|
|
211
227
|
const mappedChildren = React__default.Children.map(children, child => {
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
212
229
|
const item = child;
|
|
213
230
|
const displayName = item?.type?.displayName;
|
|
214
231
|
|
|
@@ -223,9 +240,13 @@ forwardRef) {
|
|
|
223
240
|
const isTriggerComponent = enableFloatingStyles && displayName && ['ToggletipButton'].includes(displayName);
|
|
224
241
|
const isAllowedTriggerComponent = enableFloatingStyles && !['ToggletipContent', 'PopoverContent'].includes(displayName);
|
|
225
242
|
if (/*#__PURE__*/React__default.isValidElement(item) && (isTriggerElement || isTriggerComponent || isAllowedTriggerComponent)) {
|
|
243
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
226
244
|
const className = item?.props?.className;
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
227
246
|
const ref = (item?.props).ref;
|
|
228
247
|
const tabTipClasses = classnames(`${prefix}--popover--tab-tip__button`, className);
|
|
248
|
+
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
229
250
|
return /*#__PURE__*/React__default.cloneElement(item, {
|
|
230
251
|
className: isTabTip && item?.type === 'button' ? tabTipClasses : className || '',
|
|
231
252
|
// With cloneElement, if you pass a `ref`, it overrides the original ref.
|
|
@@ -313,6 +334,10 @@ Popover.propTypes = {
|
|
|
313
334
|
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
314
335
|
*/
|
|
315
336
|
autoAlign: PropTypes.bool,
|
|
337
|
+
/**
|
|
338
|
+
* Specify the background token to use. Default is 'layer'.
|
|
339
|
+
*/
|
|
340
|
+
backgroundToken: PropTypes.oneOf(['layer', 'background']),
|
|
316
341
|
/**
|
|
317
342
|
* Specify a bounding element to be used for autoAlign calculations. The viewport is used by default. This prop is currently experimental and is subject to future changes.
|
|
318
343
|
*/
|
|
@@ -326,6 +351,10 @@ Popover.propTypes = {
|
|
|
326
351
|
* Specify whether a caret should be rendered
|
|
327
352
|
*/
|
|
328
353
|
caret: PropTypes.bool,
|
|
354
|
+
/**
|
|
355
|
+
* Specify whether a border should be rendered on the popover
|
|
356
|
+
*/
|
|
357
|
+
border: PropTypes.bool,
|
|
329
358
|
/**
|
|
330
359
|
* Provide elements to be rendered inside of the component
|
|
331
360
|
*/
|
|
@@ -357,9 +386,7 @@ Popover.propTypes = {
|
|
|
357
386
|
*/
|
|
358
387
|
open: PropTypes.bool.isRequired
|
|
359
388
|
};
|
|
360
|
-
function PopoverContentRenderFunction(
|
|
361
|
-
// eslint-disable-next-line react/prop-types
|
|
362
|
-
{
|
|
389
|
+
function PopoverContentRenderFunction({
|
|
363
390
|
className,
|
|
364
391
|
children,
|
|
365
392
|
...rest
|
|
@@ -23,6 +23,7 @@ import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
|
23
23
|
* Event types that trigger a "drag" to stop.
|
|
24
24
|
*/
|
|
25
25
|
const DRAG_STOP_EVENT_TYPES = new Set(['mouseup', 'touchend', 'touchcancel']);
|
|
26
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
26
27
|
const Tooltip = /*#__PURE__*/React__default.forwardRef(({
|
|
27
28
|
as,
|
|
28
29
|
align = 'top',
|
|
@@ -69,6 +70,8 @@ const Tooltip = /*#__PURE__*/React__default.forwardRef(({
|
|
|
69
70
|
'aria-labelledby': labelledBy,
|
|
70
71
|
'aria-describedby': describedBy
|
|
71
72
|
};
|
|
73
|
+
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
72
75
|
function getChildEventHandlers(childProps) {
|
|
73
76
|
const eventHandlerFunctions = Object.keys(triggerProps).filter(prop => prop.startsWith('on'));
|
|
74
77
|
const eventHandlers = {};
|
|
@@ -155,29 +158,33 @@ const Tooltip = /*#__PURE__*/React__default.forwardRef(({
|
|
|
155
158
|
});
|
|
156
159
|
};
|
|
157
160
|
}, [isDragging, onDragStop]);
|
|
158
|
-
return
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
161
|
+
return (
|
|
162
|
+
/*#__PURE__*/
|
|
163
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
164
|
+
React__default.createElement(Popover, _extends({
|
|
165
|
+
as: as,
|
|
166
|
+
ref: ref
|
|
167
|
+
}, rest, {
|
|
168
|
+
align: align,
|
|
169
|
+
className: classnames(`${prefix}--tooltip`, customClassName),
|
|
170
|
+
dropShadow: dropShadow,
|
|
171
|
+
highContrast: highContrast,
|
|
172
|
+
onKeyDown: onKeyDown,
|
|
173
|
+
onMouseLeave: onMouseLeave,
|
|
174
|
+
open: open
|
|
175
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
176
|
+
className: `${prefix}--tooltip-trigger__wrapper`
|
|
177
|
+
}, typeof child !== 'undefined' ? /*#__PURE__*/React__default.cloneElement(child, {
|
|
178
|
+
...triggerProps,
|
|
179
|
+
...getChildEventHandlers(child.props)
|
|
180
|
+
}) : null), /*#__PURE__*/React__default.createElement(PopoverContent, {
|
|
181
|
+
"aria-hidden": open ? 'false' : 'true',
|
|
182
|
+
className: `${prefix}--tooltip-content`,
|
|
183
|
+
id: id,
|
|
184
|
+
onMouseEnter: onMouseEnter,
|
|
185
|
+
role: "tooltip"
|
|
186
|
+
}, label || description))
|
|
187
|
+
);
|
|
181
188
|
});
|
|
182
189
|
Tooltip.propTypes = {
|
|
183
190
|
/**
|
|
@@ -199,6 +199,7 @@ const FloatingMenu = ({
|
|
|
199
199
|
}
|
|
200
200
|
placeInProgressRef.current = false;
|
|
201
201
|
}
|
|
202
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
202
203
|
}, [floatingPosition, onPlace]);
|
|
203
204
|
|
|
204
205
|
// Attach a resize listener.
|
|
@@ -209,11 +210,13 @@ const FloatingMenu = ({
|
|
|
209
210
|
return () => {
|
|
210
211
|
resizeHandler.remove();
|
|
211
212
|
};
|
|
213
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
212
214
|
}, [triggerRef, menuOffset, menuDirection, flipped, target, updateOrientation]);
|
|
213
215
|
|
|
214
216
|
// Update menu position when key props change.
|
|
215
217
|
useEffect(() => {
|
|
216
218
|
updateMenuPosition();
|
|
219
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
217
220
|
}, [menuOffset, menuDirection, flipped, triggerRef, target, updateOrientation]);
|
|
218
221
|
|
|
219
222
|
/**
|
|
@@ -272,10 +275,15 @@ const FloatingMenu = ({
|
|
|
272
275
|
});
|
|
273
276
|
}
|
|
274
277
|
};
|
|
275
|
-
const
|
|
278
|
+
const deprecatedFlag = enabled('enable-experimental-focus-wrap-without-sentinels');
|
|
279
|
+
const focusTrapWithoutSentinelsFlag = enabled('enable-focus-wrap-without-sentinels');
|
|
280
|
+
const focusTrapWithoutSentinels = deprecatedFlag || focusTrapWithoutSentinelsFlag;
|
|
276
281
|
if (typeof document !== 'undefined') {
|
|
277
282
|
const portalTarget = target ? target() : document.body;
|
|
278
|
-
return /*#__PURE__*/ReactDOM__default.createPortal(
|
|
283
|
+
return /*#__PURE__*/ReactDOM__default.createPortal(
|
|
284
|
+
/*#__PURE__*/
|
|
285
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
286
|
+
React__default.createElement("div", {
|
|
279
287
|
onBlur: focusTrap && !focusTrapWithoutSentinels ? handleBlur : undefined,
|
|
280
288
|
onKeyDown: focusTrapWithoutSentinels ? handleKeyDown : undefined
|
|
281
289
|
}, !focusTrapWithoutSentinels && /*#__PURE__*/React__default.createElement("span", {
|
|
@@ -17,6 +17,7 @@ import { useMemo, useCallback } from 'react';
|
|
|
17
17
|
* node, assigns that node to every ref in the array.
|
|
18
18
|
*/
|
|
19
19
|
const useMergedRefs = refs => {
|
|
20
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
20
21
|
const memoizedRefs = useMemo(() => refs, refs);
|
|
21
22
|
return useCallback(node => {
|
|
22
23
|
memoizedRefs.forEach(ref => {
|
|
@@ -15,13 +15,16 @@ const useNoInteractiveChildren = (ref, message = 'component should have no inter
|
|
|
15
15
|
/*
|
|
16
16
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
17
17
|
*/
|
|
18
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
18
19
|
useEffect(() => {
|
|
19
20
|
const node = ref.current ? getInteractiveContent(ref.current) : false;
|
|
20
21
|
if (node) {
|
|
21
22
|
const errorMessage = `Error: ${message}.\n\nInstead found: ${node.outerHTML}`;
|
|
23
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
22
24
|
console.error(errorMessage);
|
|
23
25
|
throw new Error(errorMessage);
|
|
24
26
|
}
|
|
27
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
25
28
|
}, []);
|
|
26
29
|
}
|
|
27
30
|
};
|
|
@@ -24,6 +24,7 @@ const useOutsideClick = (ref, callback) => {
|
|
|
24
24
|
/*
|
|
25
25
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
26
26
|
*/
|
|
27
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
27
28
|
useWindowEvent('click', event => {
|
|
28
29
|
const {
|
|
29
30
|
target
|
|
@@ -21,6 +21,7 @@ const warning = (condition, message) => {
|
|
|
21
21
|
throw new Error('`warning(condition, message)` requires a warning ' + 'format argument');
|
|
22
22
|
}
|
|
23
23
|
if (!condition) {
|
|
24
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
24
25
|
console.warn('Warning: ' + message);
|
|
25
26
|
}
|
|
26
27
|
} ;
|
|
@@ -9,10 +9,10 @@ import { warning } from '../internal/warning.js';
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
const didWarnAboutDeprecation = {};
|
|
12
|
-
|
|
13
|
-
return
|
|
14
|
-
if (props[propName] === undefined) {
|
|
15
|
-
return;
|
|
12
|
+
const deprecateValuesWithin = (propType, allowedValues, propMappingFunction) => {
|
|
13
|
+
return (props, propName, componentName, ...rest) => {
|
|
14
|
+
if (typeof props[propName] === 'undefined') {
|
|
15
|
+
return null;
|
|
16
16
|
}
|
|
17
17
|
if (!didWarnAboutDeprecation[componentName] || !didWarnAboutDeprecation[componentName][propName]) {
|
|
18
18
|
didWarnAboutDeprecation[componentName] = {
|
|
@@ -28,6 +28,6 @@ function deprecateValuesWithin(propType, allowedValues, propMappingFunction) {
|
|
|
28
28
|
}
|
|
29
29
|
return propType(props, propName, componentName, ...rest);
|
|
30
30
|
};
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
32
|
|
|
33
|
-
export { deprecateValuesWithin
|
|
33
|
+
export { deprecateValuesWithin };
|
|
@@ -6,18 +6,22 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @param
|
|
10
|
-
* @returns
|
|
9
|
+
* @param refs Refs to merge.
|
|
10
|
+
* @returns Merged ref.
|
|
11
11
|
*/
|
|
12
|
-
const mergeRefs = (...refs) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ref
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
const mergeRefs = (...refs) => {
|
|
13
|
+
return value => {
|
|
14
|
+
refs.forEach(ref => {
|
|
15
|
+
if (!ref) return;
|
|
16
|
+
|
|
17
|
+
// https://github.com/facebook/react/issues/13029#issuecomment-410002316
|
|
18
|
+
if (typeof ref === 'function') {
|
|
19
|
+
ref(value);
|
|
20
|
+
} else if (typeof ref === 'object' && 'current' in ref) {
|
|
21
|
+
ref.current = value;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
21
25
|
};
|
|
22
26
|
|
|
23
|
-
export { mergeRefs
|
|
27
|
+
export { mergeRefs };
|