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.
Files changed (32) hide show
  1. package/css/carbon-addons-iot-react.css +479 -130
  2. package/css/carbon-addons-iot-react.css.map +1 -1
  3. package/es/node_modules/@carbon/feature-flags/es/index.js +44 -2
  4. package/es/node_modules/@carbon/react/es/components/FeatureFlags/index.js +4 -1
  5. package/es/node_modules/@carbon/react/es/components/IconButton/index.js +5 -3
  6. package/es/node_modules/@carbon/react/es/components/OverflowMenu/OverflowMenu.js +7 -6
  7. package/es/node_modules/@carbon/react/es/components/Popover/index.js +36 -9
  8. package/es/node_modules/@carbon/react/es/components/Tooltip/Tooltip.js +30 -23
  9. package/es/node_modules/@carbon/react/es/internal/FloatingMenu.js +10 -2
  10. package/es/node_modules/@carbon/react/es/internal/useMergedRefs.js +1 -0
  11. package/es/node_modules/@carbon/react/es/internal/useNoInteractiveChildren.js +3 -0
  12. package/es/node_modules/@carbon/react/es/internal/useOutsideClick.js +1 -0
  13. package/es/node_modules/@carbon/react/es/internal/warning.js +1 -0
  14. package/es/node_modules/@carbon/react/es/prop-types/deprecateValuesWithin.js +6 -6
  15. package/es/node_modules/@carbon/react/es/tools/mergeRefs.js +16 -12
  16. package/lib/css/carbon-addons-iot-react.css +479 -130
  17. package/lib/css/carbon-addons-iot-react.css.map +1 -1
  18. package/lib/node_modules/@carbon/feature-flags/es/index.js +44 -2
  19. package/lib/node_modules/@carbon/react/es/components/FeatureFlags/index.js +4 -1
  20. package/lib/node_modules/@carbon/react/es/components/IconButton/index.js +5 -3
  21. package/lib/node_modules/@carbon/react/es/components/OverflowMenu/OverflowMenu.js +7 -6
  22. package/lib/node_modules/@carbon/react/es/components/Popover/index.js +36 -9
  23. package/lib/node_modules/@carbon/react/es/components/Tooltip/Tooltip.js +30 -23
  24. package/lib/node_modules/@carbon/react/es/internal/FloatingMenu.js +10 -2
  25. package/lib/node_modules/@carbon/react/es/internal/useMergedRefs.js +1 -0
  26. package/lib/node_modules/@carbon/react/es/internal/useNoInteractiveChildren.js +3 -0
  27. package/lib/node_modules/@carbon/react/es/internal/useOutsideClick.js +1 -0
  28. package/lib/node_modules/@carbon/react/es/internal/warning.js +1 -0
  29. package/lib/node_modules/@carbon/react/es/prop-types/deprecateValuesWithin.js +6 -6
  30. package/lib/node_modules/@carbon/react/es/tools/mergeRefs.js +16 -12
  31. package/package.json +3 -3
  32. package/umd/carbon-addons-iot-react.js +158 -58
@@ -45,6 +45,15 @@ try {
45
45
  } else {
46
46
  enabled$1.enableExperimentalTileContrast = false;
47
47
  }
48
+ if (process.env.CARBON_ENABLE_TILE_CONTRAST) {
49
+ if (process.env.CARBON_ENABLE_TILE_CONTRAST === 'true') {
50
+ enabled$1.enableTileContrast = true;
51
+ } else {
52
+ enabled$1.enableTileContrast = false;
53
+ }
54
+ } else {
55
+ enabled$1.enableTileContrast = false;
56
+ }
48
57
  if (process.env.CARBON_ENABLE_V12_TILE_DEFAULT_ICONS) {
49
58
  if (process.env.CARBON_ENABLE_V12_TILE_DEFAULT_ICONS === 'true') {
50
59
  enabled$1.enableV12TileDefaultIcons = true;
@@ -99,6 +108,15 @@ try {
99
108
  } else {
100
109
  enabled$1.enableExperimentalFocusWrapWithoutSentinels = false;
101
110
  }
111
+ if (process.env.CARBON_ENABLE_FOCUS_WRAP_WITHOUT_SENTINELS) {
112
+ if (process.env.CARBON_ENABLE_FOCUS_WRAP_WITHOUT_SENTINELS === 'true') {
113
+ enabled$1.enableFocusWrapWithoutSentinels = true;
114
+ } else {
115
+ enabled$1.enableFocusWrapWithoutSentinels = false;
116
+ }
117
+ } else {
118
+ enabled$1.enableFocusWrapWithoutSentinels = false;
119
+ }
102
120
  if (process.env.CARBON_ENABLE_DIALOG_ELEMENT) {
103
121
  if (process.env.CARBON_ENABLE_DIALOG_ELEMENT === 'true') {
104
122
  enabled$1.enableDialogElement = true;
@@ -135,21 +153,33 @@ try {
135
153
  } else {
136
154
  enabled$1.enableEnhancedFileUploader = false;
137
155
  }
156
+ if (process.env.CARBON_ENABLE_PRESENCE) {
157
+ if (process.env.CARBON_ENABLE_PRESENCE === 'true') {
158
+ enabled$1.enablePresence = true;
159
+ } else {
160
+ enabled$1.enablePresence = false;
161
+ }
162
+ } else {
163
+ enabled$1.enablePresence = false;
164
+ }
138
165
  } catch (error) {
139
166
  enabled$1.enableCssCustomProperties = false;
140
167
  enabled$1.enableCssGrid = false;
141
168
  enabled$1.enableV11Release = true;
142
169
  enabled$1.enableExperimentalTileContrast = false;
170
+ enabled$1.enableTileContrast = false;
143
171
  enabled$1.enableV12TileDefaultIcons = false;
144
172
  enabled$1.enableV12TileRadioIcons = false;
145
173
  enabled$1.enableV12Overflowmenu = false;
146
174
  enabled$1.enableTreeviewControllable = false;
147
175
  enabled$1.enableV12StructuredListVisibleIcons = false;
148
176
  enabled$1.enableExperimentalFocusWrapWithoutSentinels = false;
177
+ enabled$1.enableFocusWrapWithoutSentinels = false;
149
178
  enabled$1.enableDialogElement = false;
150
179
  enabled$1.enableV12DynamicFloatingStyles = false;
151
180
  enabled$1.enableV12ToggleReducedLabelSpacing = false;
152
181
  enabled$1.enableEnhancedFileUploader = false;
182
+ enabled$1.enablePresence = false;
153
183
  }
154
184
  var featureFlagInfo = [{
155
185
  name: "enable-css-custom-properties",
@@ -165,8 +195,12 @@ var featureFlagInfo = [{
165
195
  enabled: enabled$1.enableV11Release
166
196
  }, {
167
197
  name: "enable-experimental-tile-contrast",
168
- description: "Enable the experimental tile improved contrast styles\n",
198
+ description: "Deprecated, use enable-tile-contrast instead\n",
169
199
  enabled: enabled$1.enableExperimentalTileContrast
200
+ }, {
201
+ name: "enable-tile-contrast",
202
+ description: "Enable the experimental tile improved contrast styles\n",
203
+ enabled: enabled$1.enableTileContrast
170
204
  }, {
171
205
  name: "enable-v12-tile-default-icons",
172
206
  description: "Enable rendering of default icons in the tile components\n",
@@ -189,8 +223,12 @@ var featureFlagInfo = [{
189
223
  enabled: enabled$1.enableV12StructuredListVisibleIcons
190
224
  }, {
191
225
  name: "enable-experimental-focus-wrap-without-sentinels",
192
- description: "Enable the new focus wrap behavior that doesn't use sentinel nodes\n",
226
+ description: "Deprecated, use enable-focus-wrap-without-sentinels instead\n",
193
227
  enabled: enabled$1.enableExperimentalFocusWrapWithoutSentinels
228
+ }, {
229
+ name: "enable-focus-wrap-without-sentinels",
230
+ description: "Enable the new focus wrap behavior that doesn't use sentinel nodes\n",
231
+ enabled: enabled$1.enableFocusWrapWithoutSentinels
194
232
  }, {
195
233
  name: "enable-dialog-element",
196
234
  description: "Enable components to utilize the native dialog element\n",
@@ -207,6 +245,10 @@ var featureFlagInfo = [{
207
245
  name: "enable-enhanced-file-uploader",
208
246
  description: "Enable enhanced functionality for the FileUploader component, including richer callback data and expanded trigger events for onChange and onDelete.\n",
209
247
  enabled: enabled$1.enableEnhancedFileUploader
248
+ }, {
249
+ name: "enable-presence",
250
+ description: "Enable components to remain unmounted in closed state and mount in open state.\n",
251
+ enabled: enabled$1.enablePresence
210
252
  }];
211
253
 
212
254
  function _arrayLikeToArray(r, a) {
@@ -17,6 +17,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
17
17
  */
18
18
 
19
19
 
20
+ // TODO: Can this variable be deleted now? It isn't used anywhere.
20
21
  /**
21
22
  * Our FeatureFlagContext is used alongside the FeatureFlags component to enable
22
23
  * or disable feature flags in a given React tree
@@ -33,9 +34,11 @@ const FeatureFlagContext = /*#__PURE__*/React.createContext(index.FeatureFlags);
33
34
  enableV12Overflowmenu: PropTypes__default.default.bool,
34
35
  enableTreeviewControllable: PropTypes__default.default.bool,
35
36
  enableExperimentalFocusWrapWithoutSentinels: PropTypes__default.default.bool,
37
+ enableFocusWrapWithoutSentinels: PropTypes__default.default.bool,
36
38
  enableDialogElement: PropTypes__default.default.bool,
37
39
  enableV12DynamicFloatingStyles: PropTypes__default.default.bool,
38
- enableEnhancedFileUploader: PropTypes__default.default.bool
40
+ enableEnhancedFileUploader: PropTypes__default.default.bool,
41
+ enablePresence: PropTypes__default.default.bool
39
42
  });
40
43
 
41
44
  /**
@@ -27,7 +27,8 @@ var classnames__default = /*#__PURE__*/_interopDefault(classnames);
27
27
 
28
28
 
29
29
  const IconButtonKinds = ['primary', 'secondary', 'ghost', 'tertiary'];
30
- const IconButton = /*#__PURE__*/React__default.default.forwardRef(function IconButton({
30
+ // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
31
+ const IconButton = /*#__PURE__*/React__default.default.forwardRef(({
31
32
  align,
32
33
  autoAlign = false,
33
34
  badgeCount,
@@ -46,12 +47,13 @@ const IconButton = /*#__PURE__*/React__default.default.forwardRef(function IconB
46
47
  size,
47
48
  isSelected,
48
49
  ...rest
49
- }, ref) {
50
+ }, ref) => {
50
51
  const prefix = usePrefix.usePrefix();
51
52
  const tooltipClasses = classnames__default.default(wrapperClasses, `${prefix}--icon-tooltip`, {
52
53
  [`${prefix}--icon-tooltip--disabled`]: disabled
53
54
  });
54
55
  if (badgeCount && (kind !== 'ghost' || size !== 'lg')) {
56
+ // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
55
57
  console.warn("The prop BadgeCount must be used with hasIconOnly=true, kind='ghost' and size='lg'");
56
58
  }
57
59
  const badgeId = useId.useId('badge-indicator');
@@ -84,7 +86,7 @@ IconButton.propTypes = {
84
86
  /**
85
87
  * Specify how the trigger should align with the tooltip
86
88
  */
87
- align: deprecateValuesWithin(PropTypes__default.default.oneOf(['top', 'top-left',
89
+ align: deprecateValuesWithin.deprecateValuesWithin(PropTypes__default.default.oneOf(['top', 'top-left',
88
90
  // deprecated use top-start instead
89
91
  'top-right',
90
92
  // deprecated use top-end instead
@@ -77,6 +77,7 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
77
77
  {
78
78
  !(triggerButtonPositionProp && triggerButtonPositionFactor) ? invariant(false, '[OverflowMenu] wrong floating menu direction: `%s`', direction) : void 0;
79
79
  }
80
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
80
81
  const {
81
82
  offsetWidth: menuWidth,
82
83
  offsetHeight: menuHeight
@@ -99,6 +100,7 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
99
100
  };
100
101
  }
101
102
  };
103
+ // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
102
104
  const OverflowMenu = /*#__PURE__*/React.forwardRef(({
103
105
  align,
104
106
  ['aria-label']: ariaLabel = null,
@@ -180,8 +182,7 @@ const OverflowMenu = /*#__PURE__*/React.forwardRef(({
180
182
  if (onCloseMenu) {
181
183
  onCloseMenu();
182
184
  }
183
- onClose();
184
- }, [onClose]);
185
+ }, []);
185
186
  const closeMenuAndFocus = React.useCallback(() => {
186
187
  const wasClicked = click;
187
188
  const wasOpen = open;
@@ -326,7 +327,7 @@ const OverflowMenu = /*#__PURE__*/React.forwardRef(({
326
327
  }, /*#__PURE__*/React.cloneElement(menuBody, {
327
328
  'data-floating-menu-direction': direction
328
329
  }));
329
- const combinedRef = innerRef ? mergeRefs(triggerRef, innerRef, ref) : mergeRefs(triggerRef, ref);
330
+ const combinedRef = innerRef ? mergeRefs.mergeRefs(triggerRef, innerRef, ref) : mergeRefs.mergeRefs(triggerRef, ref);
330
331
  return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, /*#__PURE__*/React__default.default.createElement("span", {
331
332
  className: `${prefix}--overflow-menu__wrapper`,
332
333
  "aria-owns": open ? menuBodyId : undefined,
@@ -353,7 +354,7 @@ OverflowMenu.propTypes = {
353
354
  /**
354
355
  * Specify how the trigger should align with the tooltip
355
356
  */
356
- align: deprecateValuesWithin(PropTypes__default.default.oneOf(['top', 'top-left',
357
+ align: deprecateValuesWithin.deprecateValuesWithin(PropTypes__default.default.oneOf(['top', 'top-left',
357
358
  // deprecated use top-start instead
358
359
  'top-right',
359
360
  // deprecated use top-end instead
@@ -473,9 +474,9 @@ OverflowMenu.propTypes = {
473
474
  */
474
475
  selectorPrimaryFocus: PropTypes__default.default.string,
475
476
  /**
476
- * Specify the size of the OverflowMenu. Currently supports either `sm`, `md` (default) or `lg` as an option.
477
+ * Specify the size of the OverflowMenu. Currently supports either `xs`, `sm`, `md` (default) or `lg` as an option.
477
478
  */
478
- size: PropTypes__default.default.oneOf(['sm', 'md', 'lg'])
479
+ size: PropTypes__default.default.oneOf(['xs', 'sm', 'md', 'lg'])
479
480
  };
480
481
 
481
482
  exports.OverflowMenu = OverflowMenu;
@@ -50,17 +50,21 @@ const Popover = /*#__PURE__*/React__default.default.forwardRef(function PopoverR
50
50
  as: BaseComponent = 'span',
51
51
  autoAlign = false,
52
52
  autoAlignBoundary,
53
+ backgroundToken = 'layer',
53
54
  caret = isTabTip ? false : true,
54
55
  className: customClassName,
55
56
  children,
57
+ border = false,
56
58
  dropShadow = true,
57
59
  highContrast = false,
58
60
  onRequestClose,
59
61
  open,
60
62
  alignmentAxisOffset,
61
63
  ...rest
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
62
65
  },
63
66
  //this is a workaround, have to come back and fix this.
67
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
64
68
  forwardRef) {
65
69
  const prefix = usePrefix.usePrefix();
66
70
  const floating = React.useRef(null);
@@ -72,8 +76,12 @@ forwardRef) {
72
76
  // The `Popover` should close whenever it and its children loses focus
73
77
  useEvent.useEvent(popover, 'focusout', event => {
74
78
  const relatedTarget = event.relatedTarget;
75
-
76
- // No relatedTarget, focus moved to nowhere, so close the popover
79
+ if (isTabTip) {
80
+ if (relatedTarget && !popover.current?.contains(relatedTarget)) {
81
+ onRequestClose?.();
82
+ }
83
+ return;
84
+ }
77
85
  if (!relatedTarget) {
78
86
  onRequestClose?.();
79
87
  return;
@@ -98,7 +106,12 @@ forwardRef) {
98
106
  // needs to be placed 1px further outside the popover content. To do so,
99
107
  // we look to see if any of the children has a className containing "slug"
100
108
  const initialCaretHeight = React__default.default.Children.toArray(children).some(x => {
101
- return x?.props?.className?.includes('slug') || x?.props?.className?.includes('ai-label');
109
+ return (
110
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
111
+ x?.props?.className?.includes('slug') ||
112
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
113
+ x?.props?.className?.includes('ai-label')
114
+ );
102
115
  }) ? 7 : 6;
103
116
  // These defaults match the defaults defined in packages/styles/scss/components/popover/_popover.scss
104
117
  const popoverDimensions = React.useRef({
@@ -149,7 +162,8 @@ forwardRef) {
149
162
  fallbackAxisSideDirection: 'start',
150
163
  boundary: autoAlignBoundary
151
164
  }), floatingUi_reactDom.arrow({
152
- element: caretRef
165
+ element: caretRef,
166
+ padding: 16
153
167
  }), autoAlign && floatingUi_reactDom.hide()],
154
168
  whileElementsMounted: floatingUi_dom.autoUpdate
155
169
  } : {}
@@ -210,13 +224,16 @@ forwardRef) {
210
224
  [`${prefix}--popover-container`]: true,
211
225
  [`${prefix}--popover--caret`]: caret,
212
226
  [`${prefix}--popover--drop-shadow`]: dropShadow,
227
+ [`${prefix}--popover--border`]: border,
213
228
  [`${prefix}--popover--high-contrast`]: highContrast,
214
229
  [`${prefix}--popover--open`]: open,
215
230
  [`${prefix}--popover--auto-align ${prefix}--autoalign`]: enableFloatingStyles,
216
231
  [`${prefix}--popover--${currentAlignment}`]: true,
217
- [`${prefix}--popover--tab-tip`]: isTabTip
232
+ [`${prefix}--popover--tab-tip`]: isTabTip,
233
+ [`${prefix}--popover--background-token__background`]: backgroundToken === 'background' && !highContrast
218
234
  }, customClassName);
219
235
  const mappedChildren = React__default.default.Children.map(children, child => {
236
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
220
237
  const item = child;
221
238
  const displayName = item?.type?.displayName;
222
239
 
@@ -231,9 +248,13 @@ forwardRef) {
231
248
  const isTriggerComponent = enableFloatingStyles && displayName && ['ToggletipButton'].includes(displayName);
232
249
  const isAllowedTriggerComponent = enableFloatingStyles && !['ToggletipContent', 'PopoverContent'].includes(displayName);
233
250
  if (/*#__PURE__*/React__default.default.isValidElement(item) && (isTriggerElement || isTriggerComponent || isAllowedTriggerComponent)) {
251
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
234
252
  const className = item?.props?.className;
253
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
235
254
  const ref = (item?.props).ref;
236
255
  const tabTipClasses = classnames__default.default(`${prefix}--popover--tab-tip__button`, className);
256
+
257
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
237
258
  return /*#__PURE__*/React__default.default.cloneElement(item, {
238
259
  className: isTabTip && item?.type === 'button' ? tabTipClasses : className || '',
239
260
  // With cloneElement, if you pass a `ref`, it overrides the original ref.
@@ -283,7 +304,7 @@ Popover.propTypes = {
283
304
  /**
284
305
  * Specify how the popover should align with the trigger element
285
306
  */
286
- align: deprecateValuesWithin(PropTypes__default.default.oneOf(['top', 'top-left',
307
+ align: deprecateValuesWithin.deprecateValuesWithin(PropTypes__default.default.oneOf(['top', 'top-left',
287
308
  // deprecated use top-start instead
288
309
  'top-right',
289
310
  // deprecated use top-end instead
@@ -321,6 +342,10 @@ Popover.propTypes = {
321
342
  * @see https://github.com/carbon-design-system/carbon/issues/18714
322
343
  */
323
344
  autoAlign: PropTypes__default.default.bool,
345
+ /**
346
+ * Specify the background token to use. Default is 'layer'.
347
+ */
348
+ backgroundToken: PropTypes__default.default.oneOf(['layer', 'background']),
324
349
  /**
325
350
  * 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.
326
351
  */
@@ -334,6 +359,10 @@ Popover.propTypes = {
334
359
  * Specify whether a caret should be rendered
335
360
  */
336
361
  caret: PropTypes__default.default.bool,
362
+ /**
363
+ * Specify whether a border should be rendered on the popover
364
+ */
365
+ border: PropTypes__default.default.bool,
337
366
  /**
338
367
  * Provide elements to be rendered inside of the component
339
368
  */
@@ -365,9 +394,7 @@ Popover.propTypes = {
365
394
  */
366
395
  open: PropTypes__default.default.bool.isRequired
367
396
  };
368
- function PopoverContentRenderFunction(
369
- // eslint-disable-next-line react/prop-types
370
- {
397
+ function PopoverContentRenderFunction({
371
398
  className,
372
399
  children,
373
400
  ...rest
@@ -31,6 +31,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
31
31
  * Event types that trigger a "drag" to stop.
32
32
  */
33
33
  const DRAG_STOP_EVENT_TYPES = new Set(['mouseup', 'touchend', 'touchcancel']);
34
+ // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
34
35
  const Tooltip = /*#__PURE__*/React__default.default.forwardRef(({
35
36
  as,
36
37
  align = 'top',
@@ -77,6 +78,8 @@ const Tooltip = /*#__PURE__*/React__default.default.forwardRef(({
77
78
  'aria-labelledby': labelledBy,
78
79
  'aria-describedby': describedBy
79
80
  };
81
+
82
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
80
83
  function getChildEventHandlers(childProps) {
81
84
  const eventHandlerFunctions = Object.keys(triggerProps).filter(prop => prop.startsWith('on'));
82
85
  const eventHandlers = {};
@@ -163,29 +166,33 @@ const Tooltip = /*#__PURE__*/React__default.default.forwardRef(({
163
166
  });
164
167
  };
165
168
  }, [isDragging, onDragStop]);
166
- return /*#__PURE__*/React__default.default.createElement(index.Popover, _rollupPluginBabelHelpers.extends({
167
- as: as,
168
- ref: ref
169
- }, rest, {
170
- align: align,
171
- className: classnames__default.default(`${prefix}--tooltip`, customClassName),
172
- dropShadow: dropShadow,
173
- highContrast: highContrast,
174
- onKeyDown: onKeyDown,
175
- onMouseLeave: onMouseLeave,
176
- open: open
177
- }), /*#__PURE__*/React__default.default.createElement("div", {
178
- className: `${prefix}--tooltip-trigger__wrapper`
179
- }, typeof child !== 'undefined' ? /*#__PURE__*/React__default.default.cloneElement(child, {
180
- ...triggerProps,
181
- ...getChildEventHandlers(child.props)
182
- }) : null), /*#__PURE__*/React__default.default.createElement(index.PopoverContent, {
183
- "aria-hidden": open ? 'false' : 'true',
184
- className: `${prefix}--tooltip-content`,
185
- id: id,
186
- onMouseEnter: onMouseEnter,
187
- role: "tooltip"
188
- }, label || description));
169
+ return (
170
+ /*#__PURE__*/
171
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
172
+ React__default.default.createElement(index.Popover, _rollupPluginBabelHelpers.extends({
173
+ as: as,
174
+ ref: ref
175
+ }, rest, {
176
+ align: align,
177
+ className: classnames__default.default(`${prefix}--tooltip`, customClassName),
178
+ dropShadow: dropShadow,
179
+ highContrast: highContrast,
180
+ onKeyDown: onKeyDown,
181
+ onMouseLeave: onMouseLeave,
182
+ open: open
183
+ }), /*#__PURE__*/React__default.default.createElement("div", {
184
+ className: `${prefix}--tooltip-trigger__wrapper`
185
+ }, typeof child !== 'undefined' ? /*#__PURE__*/React__default.default.cloneElement(child, {
186
+ ...triggerProps,
187
+ ...getChildEventHandlers(child.props)
188
+ }) : null), /*#__PURE__*/React__default.default.createElement(index.PopoverContent, {
189
+ "aria-hidden": open ? 'false' : 'true',
190
+ className: `${prefix}--tooltip-content`,
191
+ id: id,
192
+ onMouseEnter: onMouseEnter,
193
+ role: "tooltip"
194
+ }, label || description))
195
+ );
189
196
  });
190
197
  Tooltip.propTypes = {
191
198
  /**
@@ -206,6 +206,7 @@ const FloatingMenu = ({
206
206
  }
207
207
  placeInProgressRef.current = false;
208
208
  }
209
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
209
210
  }, [floatingPosition, onPlace]);
210
211
 
211
212
  // Attach a resize listener.
@@ -216,11 +217,13 @@ const FloatingMenu = ({
216
217
  return () => {
217
218
  resizeHandler.remove();
218
219
  };
220
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
219
221
  }, [triggerRef, menuOffset, menuDirection, flipped, target, updateOrientation]);
220
222
 
221
223
  // Update menu position when key props change.
222
224
  React.useEffect(() => {
223
225
  updateMenuPosition();
226
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
224
227
  }, [menuOffset, menuDirection, flipped, triggerRef, target, updateOrientation]);
225
228
 
226
229
  /**
@@ -279,10 +282,15 @@ const FloatingMenu = ({
279
282
  });
280
283
  }
281
284
  };
282
- const focusTrapWithoutSentinels = index$1.enabled('enable-experimental-focus-wrap-without-sentinels');
285
+ const deprecatedFlag = index$1.enabled('enable-experimental-focus-wrap-without-sentinels');
286
+ const focusTrapWithoutSentinelsFlag = index$1.enabled('enable-focus-wrap-without-sentinels');
287
+ const focusTrapWithoutSentinels = deprecatedFlag || focusTrapWithoutSentinelsFlag;
283
288
  if (typeof document !== 'undefined') {
284
289
  const portalTarget = target ? target() : document.body;
285
- return /*#__PURE__*/ReactDOM__default.default.createPortal(/*#__PURE__*/React__default.default.createElement("div", {
290
+ return /*#__PURE__*/ReactDOM__default.default.createPortal(
291
+ /*#__PURE__*/
292
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- https://github.com/carbon-design-system/carbon/issues/20452
293
+ React__default.default.createElement("div", {
286
294
  onBlur: focusTrap && !focusTrapWithoutSentinels ? handleBlur : undefined,
287
295
  onKeyDown: focusTrapWithoutSentinels ? handleKeyDown : undefined
288
296
  }, !focusTrapWithoutSentinels && /*#__PURE__*/React__default.default.createElement("span", {
@@ -19,6 +19,7 @@ var React = require('react');
19
19
  * node, assigns that node to every ref in the array.
20
20
  */
21
21
  const useMergedRefs = refs => {
22
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
22
23
  const memoizedRefs = React.useMemo(() => refs, refs);
23
24
  return React.useCallback(node => {
24
25
  memoizedRefs.forEach(ref => {
@@ -17,13 +17,16 @@ const useNoInteractiveChildren = (ref, message = 'component should have no inter
17
17
  /*
18
18
  // eslint-disable-next-line react-hooks/rules-of-hooks
19
19
  */
20
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
20
21
  React.useEffect(() => {
21
22
  const node = ref.current ? getInteractiveContent(ref.current) : false;
22
23
  if (node) {
23
24
  const errorMessage = `Error: ${message}.\n\nInstead found: ${node.outerHTML}`;
25
+ // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
24
26
  console.error(errorMessage);
25
27
  throw new Error(errorMessage);
26
28
  }
29
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
27
30
  }, []);
28
31
  }
29
32
  };
@@ -26,6 +26,7 @@ const useOutsideClick = (ref, callback) => {
26
26
  /*
27
27
  // eslint-disable-next-line react-hooks/rules-of-hooks
28
28
  */
29
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
29
30
  useEvent.useWindowEvent('click', event => {
30
31
  const {
31
32
  target
@@ -23,6 +23,7 @@ const warning = (condition, message) => {
23
23
  throw new Error('`warning(condition, message)` requires a warning ' + 'format argument');
24
24
  }
25
25
  if (!condition) {
26
+ // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
26
27
  console.warn('Warning: ' + message);
27
28
  }
28
29
  } ;
@@ -11,10 +11,10 @@ var warning = require('../internal/warning.js');
11
11
 
12
12
 
13
13
  const didWarnAboutDeprecation = {};
14
- function deprecateValuesWithin(propType, allowedValues, propMappingFunction) {
15
- return function checker(props, propName, componentName, ...rest) {
16
- if (props[propName] === undefined) {
17
- return;
14
+ const deprecateValuesWithin = (propType, allowedValues, propMappingFunction) => {
15
+ return (props, propName, componentName, ...rest) => {
16
+ if (typeof props[propName] === 'undefined') {
17
+ return null;
18
18
  }
19
19
  if (!didWarnAboutDeprecation[componentName] || !didWarnAboutDeprecation[componentName][propName]) {
20
20
  didWarnAboutDeprecation[componentName] = {
@@ -30,6 +30,6 @@ function deprecateValuesWithin(propType, allowedValues, propMappingFunction) {
30
30
  }
31
31
  return propType(props, propName, componentName, ...rest);
32
32
  };
33
- }
33
+ };
34
34
 
35
- module.exports = deprecateValuesWithin;
35
+ exports.deprecateValuesWithin = deprecateValuesWithin;
@@ -8,18 +8,22 @@
8
8
  */
9
9
 
10
10
  /**
11
- * @param {...Ref<Element>} refs List of React refs to merge.
12
- * @returns {Ref<Element>} Merged React ref.
11
+ * @param refs Refs to merge.
12
+ * @returns Merged ref.
13
13
  */
14
- const mergeRefs = (...refs) => el => {
15
- refs.forEach(ref => {
16
- // https://github.com/facebook/react/issues/13029#issuecomment-410002316
17
- if (typeof ref === 'function') {
18
- ref(el);
19
- } else if (Object(ref) === ref) {
20
- ref.current = el;
21
- }
22
- });
14
+ const mergeRefs = (...refs) => {
15
+ return value => {
16
+ refs.forEach(ref => {
17
+ if (!ref) return;
18
+
19
+ // https://github.com/facebook/react/issues/13029#issuecomment-410002316
20
+ if (typeof ref === 'function') {
21
+ ref(value);
22
+ } else if (typeof ref === 'object' && 'current' in ref) {
23
+ ref.current = value;
24
+ }
25
+ });
26
+ };
23
27
  };
24
28
 
25
- module.exports = mergeRefs;
29
+ exports.mergeRefs = mergeRefs;
package/package.json CHANGED
@@ -179,7 +179,7 @@
179
179
  "@carbon/icons-react": "^11.53.0",
180
180
  "@carbon/layout": "^11.28.0",
181
181
  "@carbon/pictograms-react": "^11.69.0",
182
- "@carbon/react": "1.89.0",
182
+ "@carbon/react": "1.94.2",
183
183
  "@carbon/telemetry": "^0.1.0",
184
184
  "@carbon/themes": "^11.43.0",
185
185
  "@codemirror/lang-css": "^6.3.0",
@@ -344,11 +344,11 @@
344
344
  "whatwg-fetch": "^3.0.0"
345
345
  },
346
346
  "sideEffects": false,
347
- "version": "4.2.0",
347
+ "version": "4.2.2",
348
348
  "resolutions": {
349
349
  "chokidar": "3.3.1",
350
350
  "react-grid-layout": "1.2.2",
351
351
  "got": "11.8.5"
352
352
  },
353
- "gitHead": "da36a3cb7283b9b61f4fb183f3bd70b6ee1f8aba"
353
+ "gitHead": "fc9e74b31f067f2c6e0c2d5fdbbcb9b266acbbc7"
354
354
  }