@carbon/react 1.96.0 → 1.97.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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, {
@@ -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.
@@ -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, {
@@ -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.
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-rc.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -55,7 +55,7 @@
55
55
  "@carbon/feature-flags": "0.32.0",
56
56
  "@carbon/icons-react": "^11.70.0",
57
57
  "@carbon/layout": "^11.43.0",
58
- "@carbon/styles": "^1.95.0",
58
+ "@carbon/styles": "^1.96.0-rc.0",
59
59
  "@carbon/utilities": "^0.12.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.38.0",
83
- "@carbon/themes": "^11.63.0",
83
+ "@carbon/themes": "^11.64.0-rc.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": "87ff7d321ab5e0f7147383b2a71f43936b7e34c1"
143
143
  }