@carbon/react 1.96.0 → 1.97.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.
@@ -531,6 +531,10 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
531
531
  }
532
532
  }
533
533
  });
534
+
535
+ // Keep the dropdown highlight in sync with either the controlled value or
536
+ // Downshift's own selection when uncontrolled.
537
+ const menuSelectedItem = typeof selectedItemProp !== 'undefined' ? selectedItemProp : selectedItem;
534
538
  useEffect(() => {
535
539
  // Used to expose the downshift actions to consumers for use with downshiftProps
536
540
  // An odd pattern, here we mutate the value stored in the ref provided from the consumer.
@@ -758,13 +762,13 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
758
762
  } = itemProps;
759
763
  return /*#__PURE__*/React.createElement(ListBox.MenuItem, _extends({
760
764
  key: itemProps.id,
761
- isActive: isEqual(selectedItem, item),
765
+ isActive: isEqual(menuSelectedItem, item),
762
766
  isHighlighted: highlightedIndex === index,
763
767
  title: title,
764
768
  disabled: disabled
765
769
  }, modifiedItemProps), ItemToElement ? /*#__PURE__*/React.createElement(ItemToElement, _extends({
766
770
  key: itemProps.id
767
- }, item)) : itemToString(item), isEqual(selectedItem, item) && /*#__PURE__*/React.createElement(Checkmark, {
771
+ }, item)) : itemToString(item), isEqual(menuSelectedItem, item) && /*#__PURE__*/React.createElement(Checkmark, {
768
772
  className: `${prefix}--list-box__menu-item__selected-icon`
769
773
  }));
770
774
  }) : null)), helperText && !invalid && !warn && !isFluid && /*#__PURE__*/React.createElement(Text, {
@@ -206,7 +206,7 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
206
206
  // behavior by explicitly setting preventCloseOnClickOutside to false,
207
207
  // rather than just leaving it undefined.
208
208
  !isPassive && preventCloseOnClickOutside === false;
209
- if (shouldCloseOnOutsideClick && target instanceof Node && !elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target) && !innerModal.current.contains(mouseDownTarget)) {
209
+ if (shouldCloseOnOutsideClick && target instanceof Node && !elementOrParentIsFloatingMenu(target, selectorsFloatingMenus, prefix) && innerModal.current && !innerModal.current.contains(target) && !innerModal.current.contains(mouseDownTarget)) {
210
210
  closeModal(evt);
211
211
  }
212
212
  }
@@ -230,7 +230,8 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
230
230
  endTrapNode: endSentinelNode,
231
231
  currentActiveNode,
232
232
  oldActiveNode,
233
- selectorsFloatingMenus: selectorsFloatingMenus?.filter(Boolean)
233
+ selectorsFloatingMenus: selectorsFloatingMenus?.filter(Boolean),
234
+ prefix
234
235
  });
235
236
  }
236
237
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -62,7 +62,7 @@ const DataTableSkeleton = ({
62
62
  }, rest), /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, columnsArray.map(i => /*#__PURE__*/React.createElement("th", {
63
63
  key: i
64
64
  }, headers ? /*#__PURE__*/React.createElement("div", {
65
- className: "cds--table-header-label"
65
+ className: `${prefix}--table-header-label`
66
66
  }, headers[i]?.header) : _span2 || (_span2 = /*#__PURE__*/React.createElement("span", null)))))), /*#__PURE__*/React.createElement("tbody", null, rows)));
67
67
  };
68
68
  DataTableSkeleton.propTypes = {
@@ -167,7 +167,7 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
167
167
  // behavior by explicitly setting preventCloseOnClickOutside to false,
168
168
  // rather than just leaving it undefined.
169
169
  !passiveModal && preventCloseOnClickOutside === false;
170
- if (shouldCloseOnOutsideClick && target instanceof Node && !elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target)) {
170
+ if (shouldCloseOnOutsideClick && target instanceof Node && !elementOrParentIsFloatingMenu(target, selectorsFloatingMenus, prefix) && innerModal.current && !innerModal.current.contains(target)) {
171
171
  onRequestClose(evt);
172
172
  }
173
173
  }
@@ -194,7 +194,8 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
194
194
  endTrapNode,
195
195
  currentActiveNode,
196
196
  oldActiveNode,
197
- selectorsFloatingMenus
197
+ selectorsFloatingMenus,
198
+ prefix
198
199
  });
199
200
  if (wrapFocusTimeout.current) {
200
201
  clearTimeout(wrapFocusTimeout.current);
@@ -509,7 +509,7 @@ function ActionableNotification({
509
509
  const focusTrapWithoutSentinels = focusTrapWithoutSentinelsFlag || deprecatedFlag;
510
510
  useIsomorphicEffect(() => {
511
511
  if (hasFocus && role === 'alertdialog') {
512
- const button = document.querySelector('button.cds--actionable-notification__action-button');
512
+ const button = document.querySelector(`button.${prefix}--actionable-notification__action-button`);
513
513
  button?.focus();
514
514
  }
515
515
  });
@@ -532,7 +532,8 @@ function ActionableNotification({
532
532
  startTrapNode,
533
533
  endTrapNode,
534
534
  currentActiveNode,
535
- oldActiveNode
535
+ oldActiveNode,
536
+ prefix
536
537
  });
537
538
  }
538
539
  }
@@ -116,8 +116,8 @@ forwardRef) {
116
116
  // If a value is not set via a custom property, provide a default value that matches the
117
117
  // default values defined in the sass style file
118
118
  const getStyle = window.getComputedStyle(popover.current, null);
119
- const offsetProperty = getStyle.getPropertyValue('--cds-popover-offset');
120
- const caretProperty = getStyle.getPropertyValue('--cds-popover-caret-height');
119
+ const offsetProperty = getStyle.getPropertyValue(`--${prefix}-popover-offset`);
120
+ const caretProperty = getStyle.getPropertyValue(`--${prefix}-popover-caret-height`);
121
121
 
122
122
  // Handle if the property values are in px or rem.
123
123
  // We want to store just the base number value without a unit suffix
@@ -69,5 +69,5 @@ export interface RadioTileProps {
69
69
  */
70
70
  required?: boolean;
71
71
  }
72
- declare const RadioTile: React.ForwardRefExoticComponent<RadioTileProps & React.RefAttributes<HTMLInputElement>>;
72
+ declare const RadioTile: React.ForwardRefExoticComponent<RadioTileProps & React.AriaAttributes & React.RefAttributes<HTMLInputElement>>;
73
73
  export default RadioTile;
@@ -51,6 +51,11 @@ const RadioTile = /*#__PURE__*/React.forwardRef(({
51
51
  [`${prefix}--tile--decorator`]: decorator,
52
52
  [`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
53
53
  });
54
+ const {
55
+ 'aria-describedby': ariaDescribedBy,
56
+ 'aria-labelledby': ariaLabelledBy,
57
+ ...labelProps
58
+ } = rest;
54
59
  const v12TileRadioIcons = useFeatureFlag('enable-v12-tile-radio-icons');
55
60
  function icon() {
56
61
  if (v12TileRadioIcons) {
@@ -79,7 +84,7 @@ const RadioTile = /*#__PURE__*/React.forwardRef(({
79
84
  const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
80
85
  size: 'xs'
81
86
  }) : candidate;
82
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
87
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", _extends({
83
88
  checked: checked,
84
89
  className: `${prefix}--tile-input`,
85
90
  disabled: disabled,
@@ -89,10 +94,15 @@ const RadioTile = /*#__PURE__*/React.forwardRef(({
89
94
  onKeyDown: !disabled ? handleOnKeyDown : undefined,
90
95
  tabIndex: !disabled ? tabIndex : undefined,
91
96
  type: "radio",
92
- value: value,
97
+ value: value
98
+ }, ariaDescribedBy && {
99
+ 'aria-describedby': ariaDescribedBy
100
+ }, ariaLabelledBy && {
101
+ 'aria-labelledby': ariaLabelledBy
102
+ }, {
93
103
  ref: ref,
94
104
  required: required
95
- }), /*#__PURE__*/React.createElement("label", _extends({}, rest, {
105
+ })), /*#__PURE__*/React.createElement("label", _extends({}, labelProps, {
96
106
  htmlFor: inputId,
97
107
  className: className
98
108
  }), /*#__PURE__*/React.createElement("span", {
@@ -36,6 +36,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
36
36
  closeOnActivation = false,
37
37
  dropShadow = false,
38
38
  highContrast = true,
39
+ // TODO: remove in v12, highContrast should not be configurable
39
40
  ...rest
40
41
  }, ref) => {
41
42
  const tooltipRef = useRef(null);
@@ -167,7 +168,8 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
167
168
  align: align,
168
169
  className: cx(`${prefix}--tooltip`, customClassName),
169
170
  dropShadow: dropShadow,
170
- highContrast: highContrast,
171
+ highContrast: highContrast // TODO: v12 hard-set highContrast to true
172
+ ,
171
173
  onKeyDown: onKeyDown,
172
174
  onMouseLeave: onMouseLeave,
173
175
  open: open
@@ -250,6 +252,8 @@ Tooltip.propTypes = {
250
252
  * Render the component using the high-contrast theme
251
253
  */
252
254
  highContrast: PropTypes.bool,
255
+ // TODO: remove in v12, highContrast should not be configurable
256
+
253
257
  /**
254
258
  * Provide the label to be rendered inside of the Tooltip. The label will use
255
259
  * `aria-labelledby` and will fully describe the child node that is provided.
@@ -257,7 +257,8 @@ const FloatingMenu = ({
257
257
  startTrapNode: startSentinelRef.current,
258
258
  endTrapNode: endSentinelRef.current,
259
259
  currentActiveNode: relatedTarget,
260
- oldActiveNode: target
260
+ oldActiveNode: target,
261
+ prefix
261
262
  });
262
263
  }
263
264
  };
@@ -14,12 +14,12 @@
14
14
  * @returns {boolean} Whether the node or one of its ancestors is in a floating
15
15
  * menu.
16
16
  */
17
- export declare const elementOrParentIsFloatingMenu: (node: Node, selectorsFloatingMenus?: string[]) => boolean;
17
+ export declare const elementOrParentIsFloatingMenu: (node: Node, selectorsFloatingMenus?: string[], prefix?: string) => boolean;
18
18
  /**
19
19
  * Ensures the focus is kept within the given container by implementing
20
20
  * "focus-wrap" behavior.
21
21
  */
22
- export declare const wrapFocus: ({ bodyNode, startTrapNode, endTrapNode, currentActiveNode, oldActiveNode, selectorsFloatingMenus, }: {
22
+ export declare const wrapFocus: ({ bodyNode, startTrapNode, endTrapNode, currentActiveNode, oldActiveNode, selectorsFloatingMenus, prefix, }: {
23
23
  /** The DOM node of the container. */
24
24
  bodyNode: HTMLElement | null;
25
25
  /** The start sentinel node for focus trapping. */
@@ -32,6 +32,8 @@ export declare const wrapFocus: ({ bodyNode, startTrapNode, endTrapNode, current
32
32
  oldActiveNode: HTMLElement;
33
33
  /** CSS selectors for floating menus. */
34
34
  selectorsFloatingMenus?: string[];
35
+ /** Classname prefix for Carbon selectors. */
36
+ prefix?: string;
35
37
  }) => void;
36
38
  /**
37
39
  * Ensures the focus is kept in the given container, implementing "focus-wrap"
@@ -30,9 +30,9 @@ const DOCUMENT_POSITION_BROAD_FOLLOWING = typeof Node !== 'undefined' ? Node.DOC
30
30
  * @returns {boolean} Whether the node or one of its ancestors is in a floating
31
31
  * menu.
32
32
  */
33
- const elementOrParentIsFloatingMenu = (node, selectorsFloatingMenus = []) => {
33
+ const elementOrParentIsFloatingMenu = (node, selectorsFloatingMenus = [], prefix = 'cds') => {
34
34
  if (node instanceof Element && typeof node.closest === 'function') {
35
- const allSelectorsFloatingMenus = ['.cds--overflow-menu-options', '.cds--tooltip', '.flatpickr-calendar', ...selectorsFloatingMenus];
35
+ const allSelectorsFloatingMenus = [`.${prefix}--overflow-menu-options`, `.${prefix}--tooltip`, '.flatpickr-calendar', ...selectorsFloatingMenus];
36
36
  return allSelectorsFloatingMenus.some(selector => !!node.closest(selector));
37
37
  }
38
38
  return false;
@@ -48,9 +48,10 @@ const wrapFocus = ({
48
48
  endTrapNode,
49
49
  currentActiveNode,
50
50
  oldActiveNode,
51
- selectorsFloatingMenus
51
+ selectorsFloatingMenus,
52
+ prefix = 'cds'
52
53
  }) => {
53
- if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus)) {
54
+ if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus, prefix)) {
54
55
  const comparisonResult = oldActiveNode.compareDocumentPosition(currentActiveNode);
55
56
  if (currentActiveNode === startTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_PRECEDING) {
56
57
  const tabbableElement = Array.from(bodyNode.querySelectorAll(selectorTabbable)).reverse().find(({
@@ -535,6 +535,10 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
535
535
  }
536
536
  }
537
537
  });
538
+
539
+ // Keep the dropdown highlight in sync with either the controlled value or
540
+ // Downshift's own selection when uncontrolled.
541
+ const menuSelectedItem = typeof selectedItemProp !== 'undefined' ? selectedItemProp : selectedItem;
538
542
  React.useEffect(() => {
539
543
  // Used to expose the downshift actions to consumers for use with downshiftProps
540
544
  // An odd pattern, here we mutate the value stored in the ref provided from the consumer.
@@ -762,13 +766,13 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
762
766
  } = itemProps;
763
767
  return /*#__PURE__*/React.createElement(index$2.default.MenuItem, _rollupPluginBabelHelpers.extends({
764
768
  key: itemProps.id,
765
- isActive: isEqual(selectedItem, item),
769
+ isActive: isEqual(menuSelectedItem, item),
766
770
  isHighlighted: highlightedIndex === index,
767
771
  title: title,
768
772
  disabled: disabled
769
773
  }, modifiedItemProps), ItemToElement ? /*#__PURE__*/React.createElement(ItemToElement, _rollupPluginBabelHelpers.extends({
770
774
  key: itemProps.id
771
- }, item)) : itemToString(item), isEqual(selectedItem, item) && /*#__PURE__*/React.createElement(iconsReact.Checkmark, {
775
+ }, item)) : itemToString(item), isEqual(menuSelectedItem, item) && /*#__PURE__*/React.createElement(iconsReact.Checkmark, {
772
776
  className: `${prefix}--list-box__menu-item__selected-icon`
773
777
  }));
774
778
  }) : null)), helperText && !invalid && !warn && !isFluid && /*#__PURE__*/React.createElement(Text.Text, {
@@ -210,7 +210,7 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
210
210
  // behavior by explicitly setting preventCloseOnClickOutside to false,
211
211
  // rather than just leaving it undefined.
212
212
  !isPassive && preventCloseOnClickOutside === false;
213
- if (shouldCloseOnOutsideClick && target instanceof Node && !wrapFocus.elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target) && !innerModal.current.contains(mouseDownTarget)) {
213
+ if (shouldCloseOnOutsideClick && target instanceof Node && !wrapFocus.elementOrParentIsFloatingMenu(target, selectorsFloatingMenus, prefix) && innerModal.current && !innerModal.current.contains(target) && !innerModal.current.contains(mouseDownTarget)) {
214
214
  closeModal(evt);
215
215
  }
216
216
  }
@@ -234,7 +234,8 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
234
234
  endTrapNode: endSentinelNode,
235
235
  currentActiveNode,
236
236
  oldActiveNode,
237
- selectorsFloatingMenus: selectorsFloatingMenus?.filter(Boolean)
237
+ selectorsFloatingMenus: selectorsFloatingMenus?.filter(Boolean),
238
+ prefix
238
239
  });
239
240
  }
240
241
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -66,7 +66,7 @@ const DataTableSkeleton = ({
66
66
  }, rest), /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, columnsArray.map(i => /*#__PURE__*/React.createElement("th", {
67
67
  key: i
68
68
  }, headers ? /*#__PURE__*/React.createElement("div", {
69
- className: "cds--table-header-label"
69
+ className: `${prefix}--table-header-label`
70
70
  }, headers[i]?.header) : _span2 || (_span2 = /*#__PURE__*/React.createElement("span", null)))))), /*#__PURE__*/React.createElement("tbody", null, rows)));
71
71
  };
72
72
  DataTableSkeleton.propTypes = {
@@ -171,7 +171,7 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
171
171
  // behavior by explicitly setting preventCloseOnClickOutside to false,
172
172
  // rather than just leaving it undefined.
173
173
  !passiveModal && preventCloseOnClickOutside === false;
174
- if (shouldCloseOnOutsideClick && target instanceof Node && !wrapFocus.elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target)) {
174
+ if (shouldCloseOnOutsideClick && target instanceof Node && !wrapFocus.elementOrParentIsFloatingMenu(target, selectorsFloatingMenus, prefix) && innerModal.current && !innerModal.current.contains(target)) {
175
175
  onRequestClose(evt);
176
176
  }
177
177
  }
@@ -198,7 +198,8 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
198
198
  endTrapNode,
199
199
  currentActiveNode,
200
200
  oldActiveNode,
201
- selectorsFloatingMenus
201
+ selectorsFloatingMenus,
202
+ prefix
202
203
  });
203
204
  if (wrapFocusTimeout.current) {
204
205
  clearTimeout(wrapFocusTimeout.current);
@@ -511,7 +511,7 @@ function ActionableNotification({
511
511
  const focusTrapWithoutSentinels = focusTrapWithoutSentinelsFlag || deprecatedFlag;
512
512
  useIsomorphicEffect.default(() => {
513
513
  if (hasFocus && role === 'alertdialog') {
514
- const button = document.querySelector('button.cds--actionable-notification__action-button');
514
+ const button = document.querySelector(`button.${prefix}--actionable-notification__action-button`);
515
515
  button?.focus();
516
516
  }
517
517
  });
@@ -534,7 +534,8 @@ function ActionableNotification({
534
534
  startTrapNode,
535
535
  endTrapNode,
536
536
  currentActiveNode,
537
- oldActiveNode
537
+ oldActiveNode,
538
+ prefix
538
539
  });
539
540
  }
540
541
  }
@@ -118,8 +118,8 @@ forwardRef) {
118
118
  // If a value is not set via a custom property, provide a default value that matches the
119
119
  // default values defined in the sass style file
120
120
  const getStyle = window.getComputedStyle(popover.current, null);
121
- const offsetProperty = getStyle.getPropertyValue('--cds-popover-offset');
122
- const caretProperty = getStyle.getPropertyValue('--cds-popover-caret-height');
121
+ const offsetProperty = getStyle.getPropertyValue(`--${prefix}-popover-offset`);
122
+ const caretProperty = getStyle.getPropertyValue(`--${prefix}-popover-caret-height`);
123
123
 
124
124
  // Handle if the property values are in px or rem.
125
125
  // We want to store just the base number value without a unit suffix
@@ -69,5 +69,5 @@ export interface RadioTileProps {
69
69
  */
70
70
  required?: boolean;
71
71
  }
72
- declare const RadioTile: React.ForwardRefExoticComponent<RadioTileProps & React.RefAttributes<HTMLInputElement>>;
72
+ declare const RadioTile: React.ForwardRefExoticComponent<RadioTileProps & React.AriaAttributes & React.RefAttributes<HTMLInputElement>>;
73
73
  export default RadioTile;
@@ -55,6 +55,11 @@ const RadioTile = /*#__PURE__*/React.forwardRef(({
55
55
  [`${prefix}--tile--decorator`]: decorator,
56
56
  [`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
57
57
  });
58
+ const {
59
+ 'aria-describedby': ariaDescribedBy,
60
+ 'aria-labelledby': ariaLabelledBy,
61
+ ...labelProps
62
+ } = rest;
58
63
  const v12TileRadioIcons = index.useFeatureFlag('enable-v12-tile-radio-icons');
59
64
  function icon() {
60
65
  if (v12TileRadioIcons) {
@@ -83,7 +88,7 @@ const RadioTile = /*#__PURE__*/React.forwardRef(({
83
88
  const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
84
89
  size: 'xs'
85
90
  }) : candidate;
86
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
91
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", _rollupPluginBabelHelpers.extends({
87
92
  checked: checked,
88
93
  className: `${prefix}--tile-input`,
89
94
  disabled: disabled,
@@ -93,10 +98,15 @@ const RadioTile = /*#__PURE__*/React.forwardRef(({
93
98
  onKeyDown: !disabled ? handleOnKeyDown : undefined,
94
99
  tabIndex: !disabled ? tabIndex : undefined,
95
100
  type: "radio",
96
- value: value,
101
+ value: value
102
+ }, ariaDescribedBy && {
103
+ 'aria-describedby': ariaDescribedBy
104
+ }, ariaLabelledBy && {
105
+ 'aria-labelledby': ariaLabelledBy
106
+ }, {
97
107
  ref: ref,
98
108
  required: required
99
- }), /*#__PURE__*/React.createElement("label", _rollupPluginBabelHelpers.extends({}, rest, {
109
+ })), /*#__PURE__*/React.createElement("label", _rollupPluginBabelHelpers.extends({}, labelProps, {
100
110
  htmlFor: inputId,
101
111
  className: className
102
112
  }), /*#__PURE__*/React.createElement("span", {
@@ -38,6 +38,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
38
38
  closeOnActivation = false,
39
39
  dropShadow = false,
40
40
  highContrast = true,
41
+ // TODO: remove in v12, highContrast should not be configurable
41
42
  ...rest
42
43
  }, ref) => {
43
44
  const tooltipRef = React.useRef(null);
@@ -169,7 +170,8 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
169
170
  align: align,
170
171
  className: cx(`${prefix}--tooltip`, customClassName),
171
172
  dropShadow: dropShadow,
172
- highContrast: highContrast,
173
+ highContrast: highContrast // TODO: v12 hard-set highContrast to true
174
+ ,
173
175
  onKeyDown: onKeyDown,
174
176
  onMouseLeave: onMouseLeave,
175
177
  open: open
@@ -252,6 +254,8 @@ Tooltip.propTypes = {
252
254
  * Render the component using the high-contrast theme
253
255
  */
254
256
  highContrast: PropTypes.bool,
257
+ // TODO: remove in v12, highContrast should not be configurable
258
+
255
259
  /**
256
260
  * Provide the label to be rendered inside of the Tooltip. The label will use
257
261
  * `aria-labelledby` and will fully describe the child node that is provided.
@@ -278,7 +278,8 @@ const FloatingMenu = ({
278
278
  startTrapNode: startSentinelRef.current,
279
279
  endTrapNode: endSentinelRef.current,
280
280
  currentActiveNode: relatedTarget,
281
- oldActiveNode: target
281
+ oldActiveNode: target,
282
+ prefix
282
283
  });
283
284
  }
284
285
  };
@@ -14,12 +14,12 @@
14
14
  * @returns {boolean} Whether the node or one of its ancestors is in a floating
15
15
  * menu.
16
16
  */
17
- export declare const elementOrParentIsFloatingMenu: (node: Node, selectorsFloatingMenus?: string[]) => boolean;
17
+ export declare const elementOrParentIsFloatingMenu: (node: Node, selectorsFloatingMenus?: string[], prefix?: string) => boolean;
18
18
  /**
19
19
  * Ensures the focus is kept within the given container by implementing
20
20
  * "focus-wrap" behavior.
21
21
  */
22
- export declare const wrapFocus: ({ bodyNode, startTrapNode, endTrapNode, currentActiveNode, oldActiveNode, selectorsFloatingMenus, }: {
22
+ export declare const wrapFocus: ({ bodyNode, startTrapNode, endTrapNode, currentActiveNode, oldActiveNode, selectorsFloatingMenus, prefix, }: {
23
23
  /** The DOM node of the container. */
24
24
  bodyNode: HTMLElement | null;
25
25
  /** The start sentinel node for focus trapping. */
@@ -32,6 +32,8 @@ export declare const wrapFocus: ({ bodyNode, startTrapNode, endTrapNode, current
32
32
  oldActiveNode: HTMLElement;
33
33
  /** CSS selectors for floating menus. */
34
34
  selectorsFloatingMenus?: string[];
35
+ /** Classname prefix for Carbon selectors. */
36
+ prefix?: string;
35
37
  }) => void;
36
38
  /**
37
39
  * Ensures the focus is kept in the given container, implementing "focus-wrap"
@@ -32,9 +32,9 @@ const DOCUMENT_POSITION_BROAD_FOLLOWING = typeof Node !== 'undefined' ? Node.DOC
32
32
  * @returns {boolean} Whether the node or one of its ancestors is in a floating
33
33
  * menu.
34
34
  */
35
- const elementOrParentIsFloatingMenu = (node, selectorsFloatingMenus = []) => {
35
+ const elementOrParentIsFloatingMenu = (node, selectorsFloatingMenus = [], prefix = 'cds') => {
36
36
  if (node instanceof Element && typeof node.closest === 'function') {
37
- const allSelectorsFloatingMenus = ['.cds--overflow-menu-options', '.cds--tooltip', '.flatpickr-calendar', ...selectorsFloatingMenus];
37
+ const allSelectorsFloatingMenus = [`.${prefix}--overflow-menu-options`, `.${prefix}--tooltip`, '.flatpickr-calendar', ...selectorsFloatingMenus];
38
38
  return allSelectorsFloatingMenus.some(selector => !!node.closest(selector));
39
39
  }
40
40
  return false;
@@ -50,9 +50,10 @@ const wrapFocus = ({
50
50
  endTrapNode,
51
51
  currentActiveNode,
52
52
  oldActiveNode,
53
- selectorsFloatingMenus
53
+ selectorsFloatingMenus,
54
+ prefix = 'cds'
54
55
  }) => {
55
- if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus)) {
56
+ if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus, prefix)) {
56
57
  const comparisonResult = oldActiveNode.compareDocumentPosition(currentActiveNode);
57
58
  if (currentActiveNode === startTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_PRECEDING) {
58
59
  const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).reverse().find(({
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.96.0",
4
+ "version": "1.97.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -52,11 +52,11 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@babel/runtime": "^7.27.3",
55
- "@carbon/feature-flags": "0.32.0",
56
- "@carbon/icons-react": "^11.70.0",
57
- "@carbon/layout": "^11.43.0",
58
- "@carbon/styles": "^1.95.0",
59
- "@carbon/utilities": "^0.12.0",
55
+ "@carbon/feature-flags": ">=0.32.0",
56
+ "@carbon/icons-react": "^11.71.0",
57
+ "@carbon/layout": "^11.44.0",
58
+ "@carbon/styles": "^1.96.0",
59
+ "@carbon/utilities": "^0.13.0",
60
60
  "@floating-ui/react": "^0.27.4",
61
61
  "@ibm/telemetry-js": "^1.5.0",
62
62
  "classnames": "2.5.1",
@@ -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.38.0",
83
- "@carbon/themes": "^11.63.0",
83
+ "@carbon/themes": "^11.64.0",
84
84
  "@figma/code-connect": "^1.3.5",
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": "d2ccae94e5aa3defcce07cc9ea90058fda6c9705"
142
+ "gitHead": "4a42de3036ca693bf2c6477e917824982fafd7af"
143
143
  }