From 54df882b88a0631bbb5a989072bb233a22b3f2b2 Mon Sep 17 00:00:00 2001 From: CD Cabrera Date: Thu, 21 Sep 2023 15:11:03 -0400 Subject: [PATCH 1/2] fix(tableEmpty): sw-1537 aria-label attribute format (#1196) --- src/components/README.md | 2 ++ .../__tests__/__snapshots__/tableEmpty.test.js.snap | 8 ++++++-- src/components/table/tableEmpty.js | 11 +++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/README.md b/src/components/README.md index 1a73408fd..e52af1d44 100644 --- a/src/components/README.md +++ b/src/components/README.md @@ -5748,6 +5748,8 @@ Render an empty table. propsobject + props.ariaLabelstring + props.iconReact.ReactNode | function props.messageReact.ReactNode diff --git a/src/components/table/__tests__/__snapshots__/tableEmpty.test.js.snap b/src/components/table/__tests__/__snapshots__/tableEmpty.test.js.snap index 2015b0e84..f93b485eb 100644 --- a/src/components/table/__tests__/__snapshots__/tableEmpty.test.js.snap +++ b/src/components/table/__tests__/__snapshots__/tableEmpty.test.js.snap @@ -2,7 +2,9 @@ exports[`TableEmpty Component should have fallback checks for certain props: fallback display 1`] = ` - +
@@ -24,7 +26,9 @@ exports[`TableEmpty Component should have fallback checks for certain props: fal exports[`TableEmpty Component should render a basic component: basic 1`] = ` -
+
diff --git a/src/components/table/tableEmpty.js b/src/components/table/tableEmpty.js index c2d318d41..a7e50735d 100644 --- a/src/components/table/tableEmpty.js +++ b/src/components/table/tableEmpty.js @@ -13,6 +13,7 @@ import { EmptyTable as PlatformEmptyTableWrapper } from '@redhat-cloud-services/ * Render an empty table. * * @param {object} props + * @param {string} props.ariaLabel * @param {React.ReactNode|Function} props.icon * @param {React.ReactNode} props.message * @param {string} props.tableHeading @@ -20,9 +21,9 @@ import { EmptyTable as PlatformEmptyTableWrapper } from '@redhat-cloud-services/ * @param {string} props.variant * @returns {React.ReactNode} */ -const TableEmpty = ({ icon, message, tableHeading, title, variant, ...props }) => ( +const TableEmpty = ({ ariaLabel, icon, message, tableHeading, title, variant, ...props }) => ( -
+
{icon && } @@ -37,9 +38,10 @@ const TableEmpty = ({ icon, message, tableHeading, title, variant, ...props }) = * Prop types. * * @type {{icon: React.ReactNode|Function, variant: string, message: React.ReactNode, title: React.ReactNode, - * tableHeading: string}} + * tableHeading: string, ariaLabel: string}} */ TableEmpty.propTypes = { + ariaLabel: PropTypes.string, icon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), message: PropTypes.node.isRequired, tableHeading: PropTypes.string, @@ -50,9 +52,10 @@ TableEmpty.propTypes = { /** * Default props. * - * @type {{icon: null, variant: EmptyStateVariant.small, tableHeading: string}} + * @type {{icon: null, variant: EmptyStateVariant.small, tableHeading: string, ariaLabel: null}} */ TableEmpty.defaultProps = { + ariaLabel: null, icon: SearchIcon, tableHeading: 'h2', variant: EmptyStateVariant.small From 8676c9147088308b61515dbac148563cce239eff Mon Sep 17 00:00:00 2001 From: CD Cabrera <cabrera.code@gmail.com> Date: Thu, 21 Sep 2023 15:06:35 -0400 Subject: [PATCH 2/2] fix(chartIcon): sw-1689 size prop type warning (#1196) --- src/components/chart/chartIcon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/chart/chartIcon.js b/src/components/chart/chartIcon.js index f2e9c6e8e..43ad9f6e7 100644 --- a/src/components/chart/chartIcon.js +++ b/src/components/chart/chartIcon.js @@ -118,7 +118,7 @@ const ChartIcon = ({ fill, symbol, size, title, ...props }) => { */ ChartIcon.propTypes = { fill: PropTypes.string, - size: PropTypes.oneOf([...Object.keys(IconSize)]), + size: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([...Object.keys(IconSize)])]), symbol: PropTypes.oneOf(['dash', 'eye', 'eyeSlash', 'infinity', 'square', 'threshold']), title: PropTypes.string };