Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for swatch-1537, clean up for swatch-1689 PF5 update #1196

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5748,6 +5748,8 @@ Render an empty table.
<tr>
<td>props</td><td><code>object</code></td>
</tr><tr>
<td>props.ariaLabel</td><td><code>string</code></td>
</tr><tr>
<td>props.icon</td><td><code>React.ReactNode</code> | <code>function</code></td>
</tr><tr>
<td>props.message</td><td><code>React.ReactNode</code></td>
Expand Down
2 changes: 1 addition & 1 deletion src/components/chart/chartIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

exports[`TableEmpty Component should have fallback checks for certain props: fallback display 1`] = `
<EmptyTable>
<table />
<table
aria-label={null}
/>
<EmptyState
variant="small"
>
Expand All @@ -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`] = `
<EmptyTable>
<table />
<table
aria-label={null}
/>
<EmptyState
variant="small"
>
Expand Down
11 changes: 7 additions & 4 deletions src/components/table/tableEmpty.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ 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
* @param {React.ReactNode} props.title
* @param {string} props.variant
* @returns {React.ReactNode}
*/
const TableEmpty = ({ icon, message, tableHeading, title, variant, ...props }) => (
const TableEmpty = ({ ariaLabel, icon, message, tableHeading, title, variant, ...props }) => (
<PlatformEmptyTableWrapper>
<table {...props} />
<table aria-label={ariaLabel} {...props} />
<EmptyState variant={variant}>
{icon && <EmptyStateIcon icon={icon} />}
<Title headingLevel={tableHeading} size="lg">
Expand All @@ -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,
Expand All @@ -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
Expand Down