@carbon/react 1.38.0-rc.0 → 1.38.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.
@@ -261,7 +261,7 @@ class DataTable extends React__default.Component {
261
261
  checked: row.isSelected,
262
262
  onSelect: composeEventHandlers([_this.handleOnSelectRow(row.id), onClick]),
263
263
  id: `${_this.getTablePrefix()}__select-row-${row.id}`,
264
- name: `select-row-${row.id}`,
264
+ name: `select-row`,
265
265
  ariaLabel: t(translationKey),
266
266
  disabled: row.disabled,
267
267
  radio: _this.props.radio || null
@@ -14,10 +14,11 @@ import { usePrefix } from '../../internal/usePrefix.js';
14
14
  function useIsTruncated(ref) {
15
15
  const [isTruncated, setIsTruncated] = useState(false);
16
16
  useEffect(() => {
17
+ const element = ref.current;
17
18
  const {
18
19
  offsetWidth,
19
20
  scrollWidth
20
- } = ref.current;
21
+ } = element.lastElementChild?.lastElementChild || element;
21
22
  setIsTruncated(offsetWidth < scrollWidth);
22
23
  }, [ref, setIsTruncated]);
23
24
  return isTruncated;
@@ -510,6 +510,7 @@ function ActionableNotification(_ref6) {
510
510
  const [isOpen, setIsOpen] = useState(true);
511
511
  const prefix = usePrefix();
512
512
  const id = useId('actionable-notification');
513
+ const subtitleId = useId('actionable-notification-subtitle');
513
514
  const containerClassName = cx(className, {
514
515
  [`${prefix}--actionable-notification`]: true,
515
516
  [`${prefix}--actionable-notification--toast`]: !inline,
@@ -540,7 +541,7 @@ function ActionableNotification(_ref6) {
540
541
  ref: ref,
541
542
  role: role,
542
543
  className: containerClassName,
543
- "aria-labelledby": title ? id : undefined
544
+ "aria-labelledby": title ? id : subtitleId
544
545
  }), /*#__PURE__*/React__default.createElement("div", {
545
546
  className: `${prefix}--actionable-notification__details`
546
547
  }, /*#__PURE__*/React__default.createElement(NotificationIcon, {
@@ -555,7 +556,8 @@ function ActionableNotification(_ref6) {
555
556
  className: `${prefix}--actionable-notification__title`,
556
557
  id: id
557
558
  }, title), subtitle && /*#__PURE__*/React__default.createElement("div", {
558
- className: `${prefix}--actionable-notification__subtitle`
559
+ className: `${prefix}--actionable-notification__subtitle`,
560
+ id: subtitleId
559
561
  }, subtitle), children))), actionButtonLabel && /*#__PURE__*/React__default.createElement(NotificationActionButton, {
560
562
  onClick: onActionButtonClick,
561
563
  inline: inline
@@ -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 React, { type ComponentProps, type ReactNode, ElementType } from 'react';
7
+ import { type ComponentProps, type ForwardedRef, type ReactNode, ElementType, WeakValidationMap } from 'react';
8
8
  import { LinkProps } from './Link';
9
9
  type HeaderMenuItemProps<E extends ElementType> = LinkProps<E> & {
10
10
  className?: string | undefined;
@@ -15,8 +15,12 @@ type HeaderMenuItemProps<E extends ElementType> = LinkProps<E> & {
15
15
  role?: ComponentProps<'li'>['role'];
16
16
  tabIndex?: number | undefined;
17
17
  };
18
- declare const HeaderMenuItem: (<E extends React.ElementType<any> = "a">(props: HeaderMenuItemProps<E>) => JSX.Element) & {
19
- displayName?: string | undefined;
20
- propTypes?: React.WeakValidationMap<HeaderMenuItemProps<any>> | undefined;
21
- };
18
+ export interface HeaderMenuItemComponent {
19
+ <E extends ElementType = 'a'>(props: HeaderMenuItemProps<E> & {
20
+ ref?: ForwardedRef<ElementType>;
21
+ }): JSX.Element | null;
22
+ displayName?: string;
23
+ propTypes?: WeakValidationMap<HeaderMenuItemProps<any>>;
24
+ }
25
+ declare const HeaderMenuItem: HeaderMenuItemComponent;
22
26
  export default HeaderMenuItem;
@@ -13,7 +13,7 @@ import Link, { LinkPropTypes } from './Link.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import deprecate from '../../prop-types/deprecate.js';
15
15
 
16
- function HeaderMenuItemRenderFunction(_ref, ref) {
16
+ const HeaderMenuItem = /*#__PURE__*/forwardRef(function HeaderMenuItemRenderFunction(_ref, ref) {
17
17
  let {
18
18
  className,
19
19
  isActive,
@@ -45,8 +45,7 @@ function HeaderMenuItemRenderFunction(_ref, ref) {
45
45
  }), /*#__PURE__*/React__default.createElement("span", {
46
46
  className: `${prefix}--text-truncate--end`
47
47
  }, children)));
48
- }
49
- const HeaderMenuItem = /*#__PURE__*/forwardRef(HeaderMenuItemRenderFunction);
48
+ });
50
49
  HeaderMenuItem.displayName = 'HeaderMenuItem';
51
50
  HeaderMenuItem.propTypes = {
52
51
  /**
@@ -271,7 +271,7 @@ class DataTable extends React__default["default"].Component {
271
271
  checked: row.isSelected,
272
272
  onSelect: events.composeEventHandlers([_this.handleOnSelectRow(row.id), onClick]),
273
273
  id: `${_this.getTablePrefix()}__select-row-${row.id}`,
274
- name: `select-row-${row.id}`,
274
+ name: `select-row`,
275
275
  ariaLabel: t(translationKey),
276
276
  disabled: row.disabled,
277
277
  radio: _this.props.radio || null
@@ -24,10 +24,11 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
24
24
  function useIsTruncated(ref) {
25
25
  const [isTruncated, setIsTruncated] = React.useState(false);
26
26
  React.useEffect(() => {
27
+ const element = ref.current;
27
28
  const {
28
29
  offsetWidth,
29
30
  scrollWidth
30
- } = ref.current;
31
+ } = element.lastElementChild?.lastElementChild || element;
31
32
  setIsTruncated(offsetWidth < scrollWidth);
32
33
  }, [ref, setIsTruncated]);
33
34
  return isTruncated;
@@ -520,6 +520,7 @@ function ActionableNotification(_ref6) {
520
520
  const [isOpen, setIsOpen] = React.useState(true);
521
521
  const prefix = usePrefix.usePrefix();
522
522
  const id = useId.useId('actionable-notification');
523
+ const subtitleId = useId.useId('actionable-notification-subtitle');
523
524
  const containerClassName = cx__default["default"](className, {
524
525
  [`${prefix}--actionable-notification`]: true,
525
526
  [`${prefix}--actionable-notification--toast`]: !inline,
@@ -550,7 +551,7 @@ function ActionableNotification(_ref6) {
550
551
  ref: ref,
551
552
  role: role,
552
553
  className: containerClassName,
553
- "aria-labelledby": title ? id : undefined
554
+ "aria-labelledby": title ? id : subtitleId
554
555
  }), /*#__PURE__*/React__default["default"].createElement("div", {
555
556
  className: `${prefix}--actionable-notification__details`
556
557
  }, /*#__PURE__*/React__default["default"].createElement(NotificationIcon, {
@@ -565,7 +566,8 @@ function ActionableNotification(_ref6) {
565
566
  className: `${prefix}--actionable-notification__title`,
566
567
  id: id
567
568
  }, title), subtitle && /*#__PURE__*/React__default["default"].createElement("div", {
568
- className: `${prefix}--actionable-notification__subtitle`
569
+ className: `${prefix}--actionable-notification__subtitle`,
570
+ id: subtitleId
569
571
  }, subtitle), children))), actionButtonLabel && /*#__PURE__*/React__default["default"].createElement(NotificationActionButton, {
570
572
  onClick: onActionButtonClick,
571
573
  inline: inline
@@ -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 React, { type ComponentProps, type ReactNode, ElementType } from 'react';
7
+ import { type ComponentProps, type ForwardedRef, type ReactNode, ElementType, WeakValidationMap } from 'react';
8
8
  import { LinkProps } from './Link';
9
9
  type HeaderMenuItemProps<E extends ElementType> = LinkProps<E> & {
10
10
  className?: string | undefined;
@@ -15,8 +15,12 @@ type HeaderMenuItemProps<E extends ElementType> = LinkProps<E> & {
15
15
  role?: ComponentProps<'li'>['role'];
16
16
  tabIndex?: number | undefined;
17
17
  };
18
- declare const HeaderMenuItem: (<E extends React.ElementType<any> = "a">(props: HeaderMenuItemProps<E>) => JSX.Element) & {
19
- displayName?: string | undefined;
20
- propTypes?: React.WeakValidationMap<HeaderMenuItemProps<any>> | undefined;
21
- };
18
+ export interface HeaderMenuItemComponent {
19
+ <E extends ElementType = 'a'>(props: HeaderMenuItemProps<E> & {
20
+ ref?: ForwardedRef<ElementType>;
21
+ }): JSX.Element | null;
22
+ displayName?: string;
23
+ propTypes?: WeakValidationMap<HeaderMenuItemProps<any>>;
24
+ }
25
+ declare const HeaderMenuItem: HeaderMenuItemComponent;
22
26
  export default HeaderMenuItem;
@@ -23,7 +23,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
23
23
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
24
24
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
25
25
 
26
- function HeaderMenuItemRenderFunction(_ref, ref) {
26
+ const HeaderMenuItem = /*#__PURE__*/React.forwardRef(function HeaderMenuItemRenderFunction(_ref, ref) {
27
27
  let {
28
28
  className,
29
29
  isActive,
@@ -55,8 +55,7 @@ function HeaderMenuItemRenderFunction(_ref, ref) {
55
55
  }), /*#__PURE__*/React__default["default"].createElement("span", {
56
56
  className: `${prefix}--text-truncate--end`
57
57
  }, children)));
58
- }
59
- const HeaderMenuItem = /*#__PURE__*/React.forwardRef(HeaderMenuItemRenderFunction);
58
+ });
60
59
  HeaderMenuItem.displayName = 'HeaderMenuItem';
61
60
  HeaderMenuItem.propTypes = {
62
61
  /**
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.38.0-rc.0",
4
+ "version": "1.38.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -47,9 +47,9 @@
47
47
  "dependencies": {
48
48
  "@babel/runtime": "^7.18.3",
49
49
  "@carbon/feature-flags": "^0.16.0",
50
- "@carbon/icons-react": "^11.27.0-rc.0",
50
+ "@carbon/icons-react": "^11.27.0",
51
51
  "@carbon/layout": "^11.19.0",
52
- "@carbon/styles": "^1.38.0-rc.0",
52
+ "@carbon/styles": "^1.38.0",
53
53
  "@carbon/telemetry": "0.1.0",
54
54
  "classnames": "2.3.2",
55
55
  "copy-to-clipboard": "^3.3.1",
@@ -77,7 +77,7 @@
77
77
  "@babel/preset-react": "^7.22.3",
78
78
  "@babel/preset-typescript": "^7.21.5",
79
79
  "@carbon/test-utils": "^10.30.0",
80
- "@carbon/themes": "^11.25.0-rc.0",
80
+ "@carbon/themes": "^11.25.0",
81
81
  "@rollup/plugin-babel": "^6.0.0",
82
82
  "@rollup/plugin-commonjs": "^25.0.0",
83
83
  "@rollup/plugin-node-resolve": "^15.0.0",
@@ -139,5 +139,5 @@
139
139
  "**/*.scss",
140
140
  "**/*.css"
141
141
  ],
142
- "gitHead": "0a2c591ac9ac56286ab465334be3e1322d4c86cb"
142
+ "gitHead": "33f414ff39064f1c432898ab8204b89b7b02cfb4"
143
143
  }