@carbon/react 1.75.0-rc.0 → 1.76.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.
@@ -600,9 +600,9 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
600
600
  // Since `onChange` does not normally fire when the menu is closed, we should
601
601
  // manually fire it when `allowCustomValue` is provided, the menu is closing,
602
602
  // and there is a value.
603
- if (allowCustomValue && isOpen && inputValue) {
603
+ if (allowCustomValue && isOpen && inputValue && highlightedIndex === -1) {
604
604
  onChange({
605
- selectedItem,
605
+ selectedItem: null,
606
606
  inputValue
607
607
  });
608
608
  }
@@ -4,7 +4,7 @@
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.
6
6
  */
7
- import PropTypes from 'prop-types';
7
+ import React from 'react';
8
8
  import { ReactAttr } from '../../types/common';
9
9
  export interface TableRowProps extends ReactAttr<HTMLTableRowElement> {
10
10
  /**
@@ -16,17 +16,5 @@ export interface TableRowProps extends ReactAttr<HTMLTableRowElement> {
16
16
  */
17
17
  isSelected?: boolean;
18
18
  }
19
- declare const TableRow: {
20
- (props: TableRowProps): import("react/jsx-runtime").JSX.Element;
21
- propTypes: {
22
- /**
23
- * Specify an optional className to be applied to the container node
24
- */
25
- className: PropTypes.Requireable<string>;
26
- /**
27
- * Specify if the row is selected
28
- */
29
- isSelected: PropTypes.Requireable<boolean>;
30
- };
31
- };
19
+ declare const TableRow: React.ForwardRefExoticComponent<TableRowProps & React.RefAttributes<HTMLTableCellElement>>;
32
20
  export default TableRow;
@@ -5,12 +5,13 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
9
  import React__default from 'react';
9
10
  import PropTypes from 'prop-types';
10
11
  import cx from 'classnames';
11
12
  import { usePrefix } from '../../internal/usePrefix.js';
12
13
 
13
- const TableRow = props => {
14
+ const TableRow = /*#__PURE__*/React__default.forwardRef((props, ref) => {
14
15
  const prefix = usePrefix();
15
16
  let rowHasAILabel;
16
17
  if (props?.children) {
@@ -40,8 +41,10 @@ const TableRow = props => {
40
41
  if (className) {
41
42
  cleanProps.className = className;
42
43
  }
43
- return /*#__PURE__*/React__default.createElement("tr", cleanProps);
44
- };
44
+ return /*#__PURE__*/React__default.createElement("tr", _extends({
45
+ ref: ref
46
+ }, cleanProps));
47
+ });
45
48
  TableRow.propTypes = {
46
49
  /**
47
50
  * Specify an optional className to be applied to the container node
@@ -419,8 +419,10 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
419
419
  */
420
420
  onCloseButtonClick?(event: MouseEvent): void;
421
421
  /**
422
- * By default, this value is "alertdialog". You can also provide an alternate
423
- * role if it makes sense from from an accessibility perspective.
422
+ * Provide an accessible role to be used. Defaults to `alertdialog`. Any other
423
+ * value will disable the wrapping of focus. To remain accessible, additional
424
+ * work is required. See the storybook docs for more info:
425
+ * https://react.carbondesignsystem.com/?path=/docs/components-notifications-actionable--overview#using-the-role-prop
424
426
  */
425
427
  role?: string;
426
428
  /**
@@ -494,8 +496,10 @@ export declare namespace ActionableNotification {
494
496
  */
495
497
  onCloseButtonClick: PropTypes.Requireable<(...args: any[]) => any>;
496
498
  /**
497
- * By default, this value is "alertdialog". You can also provide an alternate
498
- * role if it makes sense from the accessibility-side.
499
+ * Provide an accessible role to be used. Defaults to `alertdialog`. Any other
500
+ * value will disable the wrapping of focus. To remain accessible, additional
501
+ * work is required. See the storybook docs for more info:
502
+ * https://react.carbondesignsystem.com/?path=/docs/components-notifications-actionable--overview#using-the-role-prop
499
503
  */
500
504
  role: PropTypes.Requireable<string>;
501
505
  /**
@@ -514,7 +514,7 @@ function ActionableNotification(_ref6) {
514
514
  const ref = useRef(null);
515
515
  const focusTrapWithoutSentinels = useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
516
516
  useIsomorphicEffect(() => {
517
- if (hasFocus) {
517
+ if (hasFocus && role === 'alertdialog') {
518
518
  const button = document.querySelector('button.cds--actionable-notification__action-button');
519
519
  button?.focus();
520
520
  }
@@ -524,7 +524,7 @@ function ActionableNotification(_ref6) {
524
524
  target: oldActiveNode,
525
525
  relatedTarget: currentActiveNode
526
526
  } = _ref7;
527
- if (isOpen && currentActiveNode && oldActiveNode) {
527
+ if (isOpen && currentActiveNode && oldActiveNode && role === 'alertdialog') {
528
528
  const {
529
529
  current: bodyNode
530
530
  } = innerModal;
@@ -544,7 +544,7 @@ function ActionableNotification(_ref6) {
544
544
  }
545
545
  }
546
546
  function handleKeyDown(event) {
547
- if (isOpen && match(event, Tab) && ref.current) {
547
+ if (isOpen && match(event, Tab) && ref.current && role === 'alertdialog') {
548
548
  wrapFocusWithoutSentinels({
549
549
  containerNode: ref.current,
550
550
  currentActiveNode: event.target,
@@ -671,8 +671,10 @@ ActionableNotification.propTypes = {
671
671
  */
672
672
  onCloseButtonClick: PropTypes.func,
673
673
  /**
674
- * By default, this value is "alertdialog". You can also provide an alternate
675
- * role if it makes sense from the accessibility-side.
674
+ * Provide an accessible role to be used. Defaults to `alertdialog`. Any other
675
+ * value will disable the wrapping of focus. To remain accessible, additional
676
+ * work is required. See the storybook docs for more info:
677
+ * https://react.carbondesignsystem.com/?path=/docs/components-notifications-actionable--overview#using-the-role-prop
676
678
  */
677
679
  role: PropTypes.string,
678
680
  /**
@@ -4,9 +4,9 @@
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.
6
6
  */
7
- import React, { type ForwardedRef, type WeakValidationMap, type ElementType } from 'react';
8
- import { type PolymorphicProps } from '../../types/common';
7
+ import React, { type WeakValidationMap } from 'react';
9
8
  import { type Boundary } from '@floating-ui/react';
9
+ import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
10
10
  export interface PopoverContext {
11
11
  setFloating: React.Ref<HTMLSpanElement>;
12
12
  caretRef: React.Ref<HTMLSpanElement>;
@@ -67,14 +67,11 @@ export interface PopoverBaseProps {
67
67
  */
68
68
  open: boolean;
69
69
  }
70
- export type PopoverProps<E extends ElementType> = PolymorphicProps<E, PopoverBaseProps>;
71
- export interface PopoverComponent {
72
- <E extends ElementType = 'span'>(props: PopoverProps<E> & {
73
- forwardRef?: ForwardedRef<ElementType>;
74
- }): JSX.Element | null;
70
+ export type PopoverProps<E extends React.ElementType> = PolymorphicComponentPropWithRef<E, PopoverBaseProps>;
71
+ export type PopoverComponent = <E extends React.ElementType = 'span'>(props: PopoverProps<E>) => React.ReactElement | any;
72
+ export declare const Popover: PopoverComponent & {
75
73
  displayName?: string;
76
74
  propTypes?: WeakValidationMap<PopoverProps<any>>;
77
- }
78
- export declare const Popover: PopoverComponent;
75
+ };
79
76
  export type PopoverContentProps = React.HTMLAttributes<HTMLSpanElement>;
80
77
  export declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLSpanElement>>;
@@ -260,7 +260,8 @@ const ToggletipContent = /*#__PURE__*/React__default.forwardRef(function Togglet
260
260
  return /*#__PURE__*/React__default.createElement(PopoverContent, _extends({
261
261
  className: customClassName
262
262
  }, toggletip?.contentProps, {
263
- ref: ref
263
+ ref: ref,
264
+ "aria-live": "polite"
264
265
  }), /*#__PURE__*/React__default.createElement("div", {
265
266
  className: `${prefix}--toggletip-content`
266
267
  }, children));
@@ -611,9 +611,9 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
611
611
  // Since `onChange` does not normally fire when the menu is closed, we should
612
612
  // manually fire it when `allowCustomValue` is provided, the menu is closing,
613
613
  // and there is a value.
614
- if (allowCustomValue && isOpen && inputValue) {
614
+ if (allowCustomValue && isOpen && inputValue && highlightedIndex === -1) {
615
615
  onChange({
616
- selectedItem,
616
+ selectedItem: null,
617
617
  inputValue
618
618
  });
619
619
  }
@@ -4,7 +4,7 @@
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.
6
6
  */
7
- import PropTypes from 'prop-types';
7
+ import React from 'react';
8
8
  import { ReactAttr } from '../../types/common';
9
9
  export interface TableRowProps extends ReactAttr<HTMLTableRowElement> {
10
10
  /**
@@ -16,17 +16,5 @@ export interface TableRowProps extends ReactAttr<HTMLTableRowElement> {
16
16
  */
17
17
  isSelected?: boolean;
18
18
  }
19
- declare const TableRow: {
20
- (props: TableRowProps): import("react/jsx-runtime").JSX.Element;
21
- propTypes: {
22
- /**
23
- * Specify an optional className to be applied to the container node
24
- */
25
- className: PropTypes.Requireable<string>;
26
- /**
27
- * Specify if the row is selected
28
- */
29
- isSelected: PropTypes.Requireable<boolean>;
30
- };
31
- };
19
+ declare const TableRow: React.ForwardRefExoticComponent<TableRowProps & React.RefAttributes<HTMLTableCellElement>>;
32
20
  export default TableRow;
@@ -9,6 +9,7 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
12
13
  var React = require('react');
13
14
  var PropTypes = require('prop-types');
14
15
  var cx = require('classnames');
@@ -20,7 +21,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
20
21
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
21
22
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
22
23
 
23
- const TableRow = props => {
24
+ const TableRow = /*#__PURE__*/React__default["default"].forwardRef((props, ref) => {
24
25
  const prefix = usePrefix.usePrefix();
25
26
  let rowHasAILabel;
26
27
  if (props?.children) {
@@ -50,8 +51,10 @@ const TableRow = props => {
50
51
  if (className) {
51
52
  cleanProps.className = className;
52
53
  }
53
- return /*#__PURE__*/React__default["default"].createElement("tr", cleanProps);
54
- };
54
+ return /*#__PURE__*/React__default["default"].createElement("tr", _rollupPluginBabelHelpers["extends"]({
55
+ ref: ref
56
+ }, cleanProps));
57
+ });
55
58
  TableRow.propTypes = {
56
59
  /**
57
60
  * Specify an optional className to be applied to the container node
@@ -419,8 +419,10 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
419
419
  */
420
420
  onCloseButtonClick?(event: MouseEvent): void;
421
421
  /**
422
- * By default, this value is "alertdialog". You can also provide an alternate
423
- * role if it makes sense from from an accessibility perspective.
422
+ * Provide an accessible role to be used. Defaults to `alertdialog`. Any other
423
+ * value will disable the wrapping of focus. To remain accessible, additional
424
+ * work is required. See the storybook docs for more info:
425
+ * https://react.carbondesignsystem.com/?path=/docs/components-notifications-actionable--overview#using-the-role-prop
424
426
  */
425
427
  role?: string;
426
428
  /**
@@ -494,8 +496,10 @@ export declare namespace ActionableNotification {
494
496
  */
495
497
  onCloseButtonClick: PropTypes.Requireable<(...args: any[]) => any>;
496
498
  /**
497
- * By default, this value is "alertdialog". You can also provide an alternate
498
- * role if it makes sense from the accessibility-side.
499
+ * Provide an accessible role to be used. Defaults to `alertdialog`. Any other
500
+ * value will disable the wrapping of focus. To remain accessible, additional
501
+ * work is required. See the storybook docs for more info:
502
+ * https://react.carbondesignsystem.com/?path=/docs/components-notifications-actionable--overview#using-the-role-prop
499
503
  */
500
504
  role: PropTypes.Requireable<string>;
501
505
  /**
@@ -524,7 +524,7 @@ function ActionableNotification(_ref6) {
524
524
  const ref = React.useRef(null);
525
525
  const focusTrapWithoutSentinels = index.useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
526
526
  useIsomorphicEffect["default"](() => {
527
- if (hasFocus) {
527
+ if (hasFocus && role === 'alertdialog') {
528
528
  const button = document.querySelector('button.cds--actionable-notification__action-button');
529
529
  button?.focus();
530
530
  }
@@ -534,7 +534,7 @@ function ActionableNotification(_ref6) {
534
534
  target: oldActiveNode,
535
535
  relatedTarget: currentActiveNode
536
536
  } = _ref7;
537
- if (isOpen && currentActiveNode && oldActiveNode) {
537
+ if (isOpen && currentActiveNode && oldActiveNode && role === 'alertdialog') {
538
538
  const {
539
539
  current: bodyNode
540
540
  } = innerModal;
@@ -554,7 +554,7 @@ function ActionableNotification(_ref6) {
554
554
  }
555
555
  }
556
556
  function handleKeyDown(event) {
557
- if (isOpen && match.match(event, keys.Tab) && ref.current) {
557
+ if (isOpen && match.match(event, keys.Tab) && ref.current && role === 'alertdialog') {
558
558
  wrapFocus.wrapFocusWithoutSentinels({
559
559
  containerNode: ref.current,
560
560
  currentActiveNode: event.target,
@@ -681,8 +681,10 @@ ActionableNotification.propTypes = {
681
681
  */
682
682
  onCloseButtonClick: PropTypes__default["default"].func,
683
683
  /**
684
- * By default, this value is "alertdialog". You can also provide an alternate
685
- * role if it makes sense from the accessibility-side.
684
+ * Provide an accessible role to be used. Defaults to `alertdialog`. Any other
685
+ * value will disable the wrapping of focus. To remain accessible, additional
686
+ * work is required. See the storybook docs for more info:
687
+ * https://react.carbondesignsystem.com/?path=/docs/components-notifications-actionable--overview#using-the-role-prop
686
688
  */
687
689
  role: PropTypes__default["default"].string,
688
690
  /**
@@ -4,9 +4,9 @@
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.
6
6
  */
7
- import React, { type ForwardedRef, type WeakValidationMap, type ElementType } from 'react';
8
- import { type PolymorphicProps } from '../../types/common';
7
+ import React, { type WeakValidationMap } from 'react';
9
8
  import { type Boundary } from '@floating-ui/react';
9
+ import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
10
10
  export interface PopoverContext {
11
11
  setFloating: React.Ref<HTMLSpanElement>;
12
12
  caretRef: React.Ref<HTMLSpanElement>;
@@ -67,14 +67,11 @@ export interface PopoverBaseProps {
67
67
  */
68
68
  open: boolean;
69
69
  }
70
- export type PopoverProps<E extends ElementType> = PolymorphicProps<E, PopoverBaseProps>;
71
- export interface PopoverComponent {
72
- <E extends ElementType = 'span'>(props: PopoverProps<E> & {
73
- forwardRef?: ForwardedRef<ElementType>;
74
- }): JSX.Element | null;
70
+ export type PopoverProps<E extends React.ElementType> = PolymorphicComponentPropWithRef<E, PopoverBaseProps>;
71
+ export type PopoverComponent = <E extends React.ElementType = 'span'>(props: PopoverProps<E>) => React.ReactElement | any;
72
+ export declare const Popover: PopoverComponent & {
75
73
  displayName?: string;
76
74
  propTypes?: WeakValidationMap<PopoverProps<any>>;
77
- }
78
- export declare const Popover: PopoverComponent;
75
+ };
79
76
  export type PopoverContentProps = React.HTMLAttributes<HTMLSpanElement>;
80
77
  export declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLSpanElement>>;
@@ -270,7 +270,8 @@ const ToggletipContent = /*#__PURE__*/React__default["default"].forwardRef(funct
270
270
  return /*#__PURE__*/React__default["default"].createElement(index.PopoverContent, _rollupPluginBabelHelpers["extends"]({
271
271
  className: customClassName
272
272
  }, toggletip?.contentProps, {
273
- ref: ref
273
+ ref: ref,
274
+ "aria-live": "polite"
274
275
  }), /*#__PURE__*/React__default["default"].createElement("div", {
275
276
  className: `${prefix}--toggletip-content`
276
277
  }, children));
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.75.0-rc.0",
4
+ "version": "1.76.0-rc.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -44,16 +44,16 @@
44
44
  "telemetry:config": "npx -y @ibm/telemetry-js-config-generator generate --id fd89d12b-6a39-48b4-adf4-30c94dc0dddd --endpoint https://www-api.ibm.com/ibm-telemetry/v1/metrics --files ./src/components/**/*.(tsx|js|jsx)"
45
45
  },
46
46
  "peerDependencies": {
47
- "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
48
- "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0",
47
+ "react": "^16.8.6 || ^17.0.1 || ^18.2.0 || ^19.0.0",
48
+ "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0 || ^19.0.0",
49
49
  "sass": "^1.33.0"
50
50
  },
51
51
  "dependencies": {
52
52
  "@babel/runtime": "^7.24.7",
53
53
  "@carbon/feature-flags": "^0.24.0",
54
- "@carbon/icons-react": "^11.54.0-rc.0",
55
- "@carbon/layout": "^11.28.0",
56
- "@carbon/styles": "^1.74.0-rc.0",
54
+ "@carbon/icons-react": "^11.55.0-rc.0",
55
+ "@carbon/layout": "^11.29.0",
56
+ "@carbon/styles": "^1.75.0-rc.0",
57
57
  "@floating-ui/react": "^0.26.0",
58
58
  "@ibm/telemetry-js": "^1.5.0",
59
59
  "classnames": "2.5.1",
@@ -64,7 +64,7 @@
64
64
  "invariant": "^2.2.3",
65
65
  "prop-types": "^15.7.2",
66
66
  "react-fast-compare": "^3.2.2",
67
- "react-is": "^18.2.0",
67
+ "react-is": "^18.3.1",
68
68
  "tabbable": "^6.2.0",
69
69
  "use-resize-observer": "^6.0.0",
70
70
  "window-or-global": "^1.0.1"
@@ -78,8 +78,8 @@
78
78
  "@babel/preset-env": "^7.24.7",
79
79
  "@babel/preset-react": "^7.24.7",
80
80
  "@babel/preset-typescript": "^7.24.7",
81
- "@carbon/test-utils": "^10.34.0",
82
- "@carbon/themes": "^11.45.0",
81
+ "@carbon/test-utils": "^10.35.0",
82
+ "@carbon/themes": "^11.46.0",
83
83
  "@figma/code-connect": "^1.2.4",
84
84
  "@rollup/plugin-babel": "^6.0.0",
85
85
  "@rollup/plugin-commonjs": "^28.0.0",
@@ -98,7 +98,7 @@
98
98
  "@storybook/react": "^8.4.7",
99
99
  "@storybook/react-webpack5": "^8.4.7",
100
100
  "@storybook/theming": "^8.4.7",
101
- "@types/react-is": "~18.3.0",
101
+ "@types/react-is": "~18.3.1",
102
102
  "autoprefixer": "^10.4.0",
103
103
  "babel-loader": "^9.0.0",
104
104
  "babel-plugin-dev-expression": "^0.2.3",
@@ -117,8 +117,8 @@
117
117
  "prettier2": "npm:prettier@2",
118
118
  "process": "^0.11.10",
119
119
  "prop-types": "^15.7.2",
120
- "react": "^18.2.0",
121
- "react-dom": "^18.2.0",
120
+ "react": "^18.3.1",
121
+ "react-dom": "^18.3.1",
122
122
  "remark-gfm": "^4.0.0",
123
123
  "requestanimationframe": "^0.0.23",
124
124
  "rimraf": "^6.0.0",
@@ -145,5 +145,5 @@
145
145
  "**/*.scss",
146
146
  "**/*.css"
147
147
  ],
148
- "gitHead": "9ec628547954e438748a23862612f20418e07373"
148
+ "gitHead": "9cf96c5f68ef9216d1c73a5dfb7bdb3bd007b0c1"
149
149
  }