diff --git a/packages/ibm-products/src/components/EmptyStates/EmptyState.test.js b/packages/ibm-products/src/components/EmptyStates/EmptyState.test.js index ef74849651..75762b9451 100644 --- a/packages/ibm-products/src/components/EmptyStates/EmptyState.test.js +++ b/packages/ibm-products/src/components/EmptyStates/EmptyState.test.js @@ -28,6 +28,7 @@ const { name } = EmptyState; const defaultProps = { title: 'Empty state title', subtitle: 'Empty state subtitle', + illustrationDescription: 'Test alt text', }; describe(name, () => { @@ -96,11 +97,7 @@ describe(name, () => { it('should render a custom illustration', async () => { const { container } = render( - + ); const customIllustrationElement = container.querySelector('img'); expect(customIllustrationElement).toBeTruthy(); @@ -258,7 +255,11 @@ describe(name, () => { it('should throw a custom prop type validation error when an illustration is used without an illustrationDescription prop', async () => expectError(required('illustrationDescription', 'EmptyState'), () => { render( - + ); })); }); diff --git a/packages/ibm-products/src/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js b/packages/ibm-products/src/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js index 67771d0df5..1004aa67d2 100644 --- a/packages/ibm-products/src/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +++ b/packages/ibm-products/src/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js @@ -35,6 +35,7 @@ export let ErrorEmptyState = React.forwardRef( action, className, illustrationPosition = defaults.position, + illustrationDescription, illustrationTheme, link, size = defaults.size, @@ -64,7 +65,7 @@ export let ErrorEmptyState = React.forwardRef( { diff --git a/packages/ibm-products/src/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js b/packages/ibm-products/src/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js index 9c4a7babc7..1a81b16b00 100644 --- a/packages/ibm-products/src/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +++ b/packages/ibm-products/src/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js @@ -36,6 +36,7 @@ export let NoDataEmptyState = React.forwardRef( className, illustrationPosition = defaults.position, illustrationTheme, + illustrationDescription, link, size = defaults.size, subtitle, @@ -62,9 +63,9 @@ export let NoDataEmptyState = React.forwardRef( {...getDevtoolsProps(componentName)} > { diff --git a/packages/ibm-products/src/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js b/packages/ibm-products/src/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js index d7e83337db..d950b5e55a 100644 --- a/packages/ibm-products/src/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +++ b/packages/ibm-products/src/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js @@ -36,6 +36,7 @@ export let NoTagsEmptyState = React.forwardRef( className, illustrationPosition = defaults.position, illustrationTheme, + illustrationDescription, link, size = defaults.size, subtitle, @@ -64,7 +65,7 @@ export let NoTagsEmptyState = React.forwardRef( { diff --git a/packages/ibm-products/src/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js b/packages/ibm-products/src/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js index 4816ddfdae..01039aa16a 100644 --- a/packages/ibm-products/src/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +++ b/packages/ibm-products/src/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js @@ -36,6 +36,7 @@ export let NotFoundEmptyState = React.forwardRef( className, illustrationPosition = defaults.position, illustrationTheme, + illustrationDescription, link, size = defaults.size, subtitle, @@ -64,7 +65,7 @@ export let NotFoundEmptyState = React.forwardRef( { @@ -81,7 +82,9 @@ export const withActionIconButton = prepareStory(Template, { action: { text: 'Create new', onClick: action('Clicked empty state action button'), - renderIcon: (props) => , + renderIcon: (props) => ( + + ), iconDescription: 'Add icon', }, }, diff --git a/packages/ibm-products/src/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js b/packages/ibm-products/src/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js index 9093a27eb8..d8a438d12d 100644 --- a/packages/ibm-products/src/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +++ b/packages/ibm-products/src/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js @@ -36,6 +36,7 @@ export let NotificationsEmptyState = React.forwardRef( className, illustrationPosition = defaults.position, illustrationTheme, + illustrationDescription, link, size = defaults.size, subtitle, @@ -64,7 +65,7 @@ export let NotificationsEmptyState = React.forwardRef( { diff --git a/packages/ibm-products/src/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js b/packages/ibm-products/src/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js index bee81ddec6..c9f207b786 100644 --- a/packages/ibm-products/src/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +++ b/packages/ibm-products/src/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js @@ -36,6 +36,7 @@ export let UnauthorizedEmptyState = React.forwardRef( className, illustrationPosition = defaults.position, illustrationTheme, + illustrationDescription, link, size = defaults.size, subtitle, @@ -64,7 +65,7 @@ export let UnauthorizedEmptyState = React.forwardRef( { diff --git a/packages/ibm-products/src/components/EmptyStates/assets/ErrorIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/ErrorIllustration.js index 9fa4145d72..e4e8aa686f 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/ErrorIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/ErrorIllustration.js @@ -17,7 +17,7 @@ import uuidv4 from '../../../global/js/utils/uuidv4'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; -export const ErrorIllustration = ({ theme, title, size, ...rest }) => { +export const ErrorIllustration = ({ theme, size, alt, ...rest }) => { const svgId = uuidv4(); return ( @@ -34,7 +34,7 @@ export const ErrorIllustration = ({ theme, title, size, ...rest }) => { ])} role="img" > - {title} + {alt} {theme === 'dark' ? ( <> @@ -193,5 +193,5 @@ export const ErrorIllustration = ({ theme, title, size, ...rest }) => { ErrorIllustration.propTypes = { size: PropTypes.oneOf(['lg', 'sm']), theme: PropTypes.oneOf(['light', 'dark']), - title: PropTypes.string, + alt: PropTypes.string.isRequired, }; diff --git a/packages/ibm-products/src/components/EmptyStates/assets/NoDataIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/NoDataIllustration.js index 4aa0e94b0c..36245a9c0f 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/NoDataIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/NoDataIllustration.js @@ -17,7 +17,7 @@ import uuidv4 from '../../../global/js/utils/uuidv4'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; -export const NoDataIllustration = ({ theme, title, size, ...rest }) => { +export const NoDataIllustration = ({ theme, size, alt, ...rest }) => { const svgId = uuidv4(); return ( @@ -34,7 +34,7 @@ export const NoDataIllustration = ({ theme, title, size, ...rest }) => { ])} role="img" > - {title} + {alt} {theme === 'dark' ? ( <> @@ -185,5 +185,5 @@ export const NoDataIllustration = ({ theme, title, size, ...rest }) => { NoDataIllustration.propTypes = { size: PropTypes.oneOf(['lg', 'sm']), theme: PropTypes.oneOf(['light', 'dark']), - title: PropTypes.string, + alt: PropTypes.string.isRequired, }; diff --git a/packages/ibm-products/src/components/EmptyStates/assets/NoTagsIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/NoTagsIllustration.js index 69347bf591..53a339c6e1 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/NoTagsIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/NoTagsIllustration.js @@ -17,7 +17,7 @@ import uuidv4 from '../../../global/js/utils/uuidv4'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; -export const NoTagsIllustration = ({ theme, title, size, ...rest }) => { +export const NoTagsIllustration = ({ theme, size, alt, ...rest }) => { const svgId = uuidv4(); return ( @@ -35,7 +35,7 @@ export const NoTagsIllustration = ({ theme, title, size, ...rest }) => { ])} role="img" > - {title} + {alt} {theme === 'dark' ? ( <> @@ -358,5 +358,5 @@ export const NoTagsIllustration = ({ theme, title, size, ...rest }) => { NoTagsIllustration.propTypes = { size: PropTypes.oneOf(['lg', 'sm']), theme: PropTypes.oneOf(['light', 'dark']), - title: PropTypes.string, + alt: PropTypes.string.isRequired, }; diff --git a/packages/ibm-products/src/components/EmptyStates/assets/NotFoundIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/NotFoundIllustration.js index 11c8044dad..427612c662 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/NotFoundIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/NotFoundIllustration.js @@ -17,7 +17,7 @@ import uuidv4 from '../../../global/js/utils/uuidv4'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; -export const NotFoundIllustration = ({ theme, title, size, ...rest }) => { +export const NotFoundIllustration = ({ theme, size, alt, ...rest }) => { const svgId = uuidv4(); return ( @@ -34,7 +34,7 @@ export const NotFoundIllustration = ({ theme, title, size, ...rest }) => { ])} role="img" > - {title} + {alt} {theme === 'dark' ? ( <> @@ -289,5 +289,5 @@ export const NotFoundIllustration = ({ theme, title, size, ...rest }) => { NotFoundIllustration.propTypes = { size: PropTypes.oneOf(['lg', 'sm']), theme: PropTypes.oneOf(['light', 'dark']), - title: PropTypes.string, + alt: PropTypes.string.isRequired, }; diff --git a/packages/ibm-products/src/components/EmptyStates/assets/NotificationsIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/NotificationsIllustration.js index 411780c763..f52289542a 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/NotificationsIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/NotificationsIllustration.js @@ -17,7 +17,7 @@ import uuidv4 from '../../../global/js/utils/uuidv4'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; -export const NotificationsIllustration = ({ theme, title, size, ...rest }) => { +export const NotificationsIllustration = ({ theme, size, alt, ...rest }) => { const svgId = uuidv4(); return ( @@ -34,7 +34,7 @@ export const NotificationsIllustration = ({ theme, title, size, ...rest }) => { ])} role="img" > - {title} + {alt} {theme === 'dark' ? ( <> @@ -289,5 +289,5 @@ export const NotificationsIllustration = ({ theme, title, size, ...rest }) => { NotificationsIllustration.propTypes = { size: PropTypes.oneOf(['lg', 'sm']), theme: PropTypes.oneOf(['light', 'dark']), - title: PropTypes.string, + alt: PropTypes.string.isRequired, }; diff --git a/packages/ibm-products/src/components/EmptyStates/assets/UnauthorizedIllustration.js b/packages/ibm-products/src/components/EmptyStates/assets/UnauthorizedIllustration.js index f650db832c..9f341076be 100644 --- a/packages/ibm-products/src/components/EmptyStates/assets/UnauthorizedIllustration.js +++ b/packages/ibm-products/src/components/EmptyStates/assets/UnauthorizedIllustration.js @@ -17,7 +17,7 @@ import uuidv4 from '../../../global/js/utils/uuidv4'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--empty-state`; -export const UnauthorizedIllustration = ({ theme, title, size, ...rest }) => { +export const UnauthorizedIllustration = ({ theme, size, alt, ...rest }) => { const svgId = uuidv4(); return ( @@ -35,7 +35,7 @@ export const UnauthorizedIllustration = ({ theme, title, size, ...rest }) => { ])} role="img" > - {title} + {alt} {theme === 'dark' ? ( <> @@ -268,5 +268,5 @@ export const UnauthorizedIllustration = ({ theme, title, size, ...rest }) => { UnauthorizedIllustration.propTypes = { size: PropTypes.oneOf(['lg', 'sm']), theme: PropTypes.oneOf(['light', 'dark']), - title: PropTypes.string, + alt: PropTypes.string.isRequired, };