diff --git a/packages/ibm-products/CHANGELOG.md b/packages/ibm-products/CHANGELOG.md index 79e9407835..cad83a1d5b 100644 --- a/packages/ibm-products/CHANGELOG.md +++ b/packages/ibm-products/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.56.1-rc.0](https://github.com/carbon-design-system/ibm-products/compare/@carbon/ibm-products@2.56.0...@carbon/ibm-products@2.56.1-rc.0) (2024-12-18) + + +### Bug Fixes + +* **EmptyState:** added useId handling for older react version ([#6620](https://github.com/carbon-design-system/ibm-products/issues/6620)) ([45af420](https://github.com/carbon-design-system/ibm-products/commit/45af4204487b79754b6ee9c950c23119e2684a99)) + + + + + # [2.56.0](https://github.com/carbon-design-system/ibm-products/compare/@carbon/ibm-products@2.56.0-rc.0...@carbon/ibm-products@2.56.0) (2024-12-18) **Note:** Version bump only for package @carbon/ibm-products diff --git a/packages/ibm-products/package.json b/packages/ibm-products/package.json index f9c8ea92dd..2ac50eeff2 100644 --- a/packages/ibm-products/package.json +++ b/packages/ibm-products/package.json @@ -1,7 +1,7 @@ { "name": "@carbon/ibm-products", "description": "Carbon for IBM Products", - "version": "2.56.0", + "version": "2.56.1-rc.0", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.js", diff --git a/packages/ibm-products/src/components/EmptyStates/assets/ErrorIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/ErrorIllustration.js index ebe58b6587..099556deec 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/ErrorIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/ErrorIllustration.js @@ -6,12 +6,13 @@ */ // Import portions of React that are needed. -import React, { useId } from 'react'; +import React from 'react'; // Other standard imports. import PropTypes from 'prop-types'; import cx from 'classnames'; import { pkg } from '../../../settings'; +import { useId } from '../../../global/js/utils/useId'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; diff --git a/packages/ibm-products/src/components/EmptyStates/assets/NoDataIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/NoDataIllustration.js index fa736070b2..af6da233ab 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/NoDataIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/NoDataIllustration.js @@ -6,12 +6,13 @@ */ // Import portions of React that are needed. -import React, { useId } from 'react'; +import React from 'react'; // Other standard imports. import PropTypes from 'prop-types'; import cx from 'classnames'; import { pkg } from '../../../settings'; +import { useId } from '../../../global/js/utils/useId'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; diff --git a/packages/ibm-products/src/components/EmptyStates/assets/NoTagsIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/NoTagsIllustration.js index 65aede2eca..f88b77e2c2 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/NoTagsIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/NoTagsIllustration.js @@ -6,12 +6,13 @@ */ // Import portions of React that are needed. -import React, { useId } from 'react'; +import React from 'react'; // Other standard imports. import PropTypes from 'prop-types'; import cx from 'classnames'; import { pkg } from '../../../settings'; +import { useId } from '../../../global/js/utils/useId'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; diff --git a/packages/ibm-products/src/components/EmptyStates/assets/NotFoundIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/NotFoundIllustration.js index a12f64ef98..00b7106e56 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/NotFoundIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/NotFoundIllustration.js @@ -6,12 +6,13 @@ */ // Import portions of React that are needed. -import React, { useId } from 'react'; +import React from 'react'; // Other standard imports. import PropTypes from 'prop-types'; import cx from 'classnames'; import { pkg } from '../../../settings'; +import { useId } from '../../../global/js/utils/useId'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; diff --git a/packages/ibm-products/src/components/EmptyStates/assets/NotificationsIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/NotificationsIllustration.js index b7284f5cf4..a8f2c0b44a 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/NotificationsIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/NotificationsIllustration.js @@ -6,12 +6,13 @@ */ // Import portions of React that are needed. -import React, { useId } from 'react'; +import React from 'react'; // Other standard imports. import PropTypes from 'prop-types'; import cx from 'classnames'; import { pkg } from '../../../settings'; +import { useId } from '../../../global/js/utils/useId'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; diff --git a/packages/ibm-products/src/components/EmptyStates/assets/UnauthorizedIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/UnauthorizedIllustration.js index 67a3d407a2..ea8945180a 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/UnauthorizedIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/UnauthorizedIllustration.js @@ -6,12 +6,13 @@ */ // Import portions of React that are needed. -import React, { useId } from 'react'; +import React from 'react'; // Other standard imports. import PropTypes from 'prop-types'; import cx from 'classnames'; import { pkg } from '../../../settings'; +import { useId } from '../../../global/js/utils/useId'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; diff --git a/packages/ibm-products/src/global/js/utils/useId.js b/packages/ibm-products/src/global/js/utils/useId.js new file mode 100644 index 0000000000..5d60e9b7af --- /dev/null +++ b/packages/ibm-products/src/global/js/utils/useId.js @@ -0,0 +1,21 @@ +// +// Copyright IBM Corp. 2021, 2024 +// +// This source code is licensed under the Apache-2.0 license found in the +// LICENSE file in the root directory of this source tree. +// + +import React from 'react'; +import uuidv4 from './uuidv4'; + +// This tricks bundlers so they can't statically analyze this and produce +// compilation warnings/errors. +// https://github.com/webpack/webpack/issues/14814 +// https://github.com/mui/material-ui/issues/41190 +const _React = { ...React }; + +/** + * Uses React 18's built-in `useId()` when available, or falls back to + * using uuidv4 otherwise + */ +export const useId = _React.useId ? _React.useId : uuidv4;