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

Sync with v5 branch #363

Merged
merged 71 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
896f26c
chore(deps-dev): bump @types/aria-query from 5.0.1 to 5.0.4
dependabot[bot] Aug 27, 2024
ff1a1c6
chore(deps-dev): bump @types/json-schema from 7.0.12 to 7.0.15
dependabot[bot] Aug 27, 2024
962ece7
chore(deps-dev): bump semver from 5.7.1 to 5.7.2
dependabot[bot] Aug 27, 2024
68092db
chore(deps-dev): bump @types/node from 18.16.16 to 18.19.48
dependabot[bot] Sep 3, 2024
9dfa7d6
chore(deps-dev): bump dns-packet from 5.6.0 to 5.6.1
dependabot[bot] Sep 3, 2024
f1f1b80
chore(deps-dev): bump @swc/types from 0.1.9 to 0.1.12
dependabot[bot] Sep 3, 2024
8d833ed
chore(deps-dev): bump browserslist from 4.23.1 to 4.23.3
dependabot[bot] Sep 3, 2024
f8d7939
chore(deps-dev): bump @types/yargs from 17.0.24 to 17.0.33
dependabot[bot] Sep 3, 2024
091e17b
chore(deps-dev): bump @typescript-eslint/eslint-plugin
dependabot[bot] Sep 3, 2024
4b967d3
chore(deps-dev): bump postcss-modules-local-by-default
dependabot[bot] Sep 3, 2024
aa82ef5
chore(deps-dev): bump escalade from 3.1.2 to 3.2.0
dependabot[bot] Sep 3, 2024
5de9902
chore(deps-dev): bump @babel/helper-create-class-features-plugin
dependabot[bot] Sep 3, 2024
2ee53c1
chore(deps-dev): bump astring from 1.8.6 to 1.9.0
dependabot[bot] Sep 10, 2024
9504869
chore(deps-dev): bump @types/connect from 3.4.35 to 3.4.38
dependabot[bot] Sep 10, 2024
201559f
chore(deps-dev): bump @types/send from 0.17.1 to 0.17.4
dependabot[bot] Sep 10, 2024
159f9dd
chore(deps-dev): bump surge from 0.23.1 to 0.24.6
dependabot[bot] Sep 10, 2024
265370e
chore(deps-dev): bump @types/node from 18.19.48 to 18.19.50
dependabot[bot] Sep 10, 2024
06f8edd
chore(deps-dev): bump spdx-exceptions from 2.3.0 to 2.5.0
dependabot[bot] Sep 10, 2024
af2d526
chore(deps-dev): bump eslint-plugin-prettier from 5.1.3 to 5.2.1
dependabot[bot] Sep 10, 2024
e087f40
chore(deps-dev): bump @types/express-serve-static-core
dependabot[bot] Sep 10, 2024
2ac6e96
chore(deps-dev): bump spdx-license-ids from 3.0.18 to 3.0.20
dependabot[bot] Sep 10, 2024
f6d01cd
chore(deps-dev): bump @types/yargs-parser from 21.0.0 to 21.0.3
dependabot[bot] Sep 10, 2024
921d608
chore(deps-dev): bump @babel/helpers from 7.24.8 to 7.25.6
dependabot[bot] Sep 17, 2024
16a20ef
chore(deps-dev): bump @babel/plugin-transform-classes
dependabot[bot] Sep 17, 2024
7c16c3f
chore(deps-dev): bump @types/prop-types from 15.7.5 to 15.7.13
dependabot[bot] Sep 17, 2024
337060f
chore(deps-dev): bump eslint-config-prettier from 8.6.0 to 8.10.0
dependabot[bot] Sep 17, 2024
97f9ed6
chore(deps-dev): bump ignore from 5.3.1 to 5.3.2
dependabot[bot] Sep 17, 2024
d08fecc
chore(deps-dev): bump dayjs from 1.11.11 to 1.11.13
dependabot[bot] Sep 17, 2024
da53a58
chore(deps-dev): bump core-js-compat from 3.37.1 to 3.38.1
dependabot[bot] Sep 17, 2024
707bc6e
chore(deps-dev): bump aws4 from 1.12.0 to 1.13.2
dependabot[bot] Sep 17, 2024
7b13a17
chore(deps-dev): bump @types/mdast from 3.0.11 to 3.0.15
dependabot[bot] Sep 17, 2024
12eeff7
chore(deps-dev): bump react-router from 6.24.0 to 6.26.2
dependabot[bot] Sep 17, 2024
4b53823
fix: Updated github actions for v5 migration.
Sep 18, 2024
6949872
fix(ContentHeader): Fix ContentHeader link component
fhlavac Sep 18, 2024
f6dc8f6
fix(README): Update README.md (#351)
fhlavac Sep 20, 2024
a441bae
Make SkeletonTable modular (#352)
fhlavac Sep 26, 2024
08accd6
fix(BulkSelect): Fix BulkSelect being checked when there are no rows …
fhlavac Sep 26, 2024
40b3735
fix: updated broken snapshot tests.
dlabaj Oct 3, 2024
68af931
fix(readme): Test commit to trigger release
fhlavac Oct 4, 2024
b3d23c2
fix: Update README.md
dlabaj Oct 4, 2024
771d3c9
chore: Update release.config.js
dlabaj Oct 4, 2024
289a90b
fix: updated release config
dlabaj Oct 4, 2024
a132ded
fix: try and squash all commits after 5.4.0 into one
nicolethoen Oct 7, 2024
f300ce6
fix: try changing range format on branch config
nicolethoen Oct 7, 2024
93a01d5
fix: update release config
nicolethoen Oct 8, 2024
be68bae
fix: try removing range and force only patches instead
nicolethoen Oct 8, 2024
43fc6df
fix: linting error
nicolethoen Oct 8, 2024
8a01d2e
fix: Update release.config.js
nicolethoen Oct 8, 2024
1e45ad2
fix: remove range - hope it works
nicolethoen Oct 8, 2024
4db1b23
fix: linting
nicolethoen Oct 8, 2024
eba9ffc
feat: set up branch for releasing alphas
nicolethoen Jun 17, 2024
4d49e4e
Update to PatternFly 6 (#145)
fhlavac Jun 17, 2024
f2a9107
Update to the latest PF versions (#224)
fhlavac Jul 30, 2024
6616466
fix(v6): Fix generated files
fhlavac Aug 1, 2024
5ee2d88
fix: Update README.md
dlabaj Aug 6, 2024
bbaf198
fix(pf6): Rebase to the latest main (#259)
fhlavac Aug 16, 2024
e9f65f1
Rebase to latest main (#274)
fhlavac Aug 19, 2024
2668065
Rebase to the latest main (#277)
fhlavac Aug 20, 2024
a89a13b
fix(pf6): Update lockfile
fhlavac Aug 20, 2024
35d8214
fix(v6): Update PF versions
fhlavac Aug 20, 2024
dc69200
fix(deps): Update dependencies
fhlavac Aug 20, 2024
6630a7e
fix: Update README.md
dlabaj Aug 21, 2024
70f83d4
fix(nav): Resolve build warnings
fhlavac Sep 12, 2024
32ddfa4
Fixed issue with fetch.
dlabaj Sep 20, 2024
e3a2458
RHCLOUD-34195 Ansible logo updates (#354)
aferd Sep 24, 2024
29aff36
feat(ver): update to rc versions (#357)
kmcfaul Oct 4, 2024
e598b3e
fix(rebase): Update PF6 version
fhlavac Oct 9, 2024
f81d360
fix(v6): Update to v6
fhlavac Oct 9, 2024
13f1ca0
fix(v6): Fix multi content card layout
fhlavac Oct 9, 2024
f985a17
fix(v6): Update snapshots
fhlavac Oct 9, 2024
4bb1379
fix(v6): Fix ouiaIds
fhlavac Oct 9, 2024
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
1 change: 0 additions & 1 deletion .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
pull_request:
branches:
- main
- v4
- v5
jobs:
call-build-lint-test-workflow:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main
- v4
- v5
jobs:
call-build-lint-test-workflow:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# PatternFly React Component Groups

This repo contains a set of opinionated react component groups used to standardize functionality and look and feel across products. The components are based on PatternFly with some additional functionality.
This repo contains a set of opinionated react component groups used to standardize functionality and look and feel across products. The components are based on PatternFly with some additional functionality.

### Migration from [RedHatInsights/frontend-components](https://github.com/RedHatInsights/frontend-components) to [patternfly/react-component-groups](https://github.com/patternfly/react-component-groups)
Please see the [migration guide](./migration.md)

---
---
## Contribution guide

### Before adding a new component:
Expand Down Expand Up @@ -68,7 +68,7 @@ src
### Component's API rules:
- prop names comply with PatternFly components naming standards (`variant`, `onClick`, `position`, etc.)
- the API is maximally simplified and all props are provided with a description
- it is built on the top of existing PatternFly types without prop omitting
- it is built on top of existing PatternFly types without prop omitting
- it is well documented using the PatternFly documentation (`/packages/module/patternfly-docs/content/extensions/component-groups/examples/MyComponent/MyComponent.md`) with examples of all possible use cases (`packages/module/patternfly-docs/content/extensions/component-groups/examples/MyComponent/MyComponent[...]Example.tsx`)
- do not unnecessarily use external libraries in your component - rather, delegate the necessary logic to the component's user using the component's API

Expand Down
16 changes: 8 additions & 8 deletions cypress/component/MultiContentCard.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ export const MultiContentCardExample: React.FunctionComponent = () => {
</CardBody>
<CardFooter>
<Content>
<Button variant="link" isInline>
<Button icon={<Icon className="pf-v6-u-ml-sm" isInline>
<ArrowRightIcon />
</Icon>} variant="link" isInline>
Learn more
<Icon className="pf-v6-u-ml-sm" isInline>
<ArrowRightIcon />
</Icon>

</Button>
</Content>
</CardFooter>
Expand All @@ -88,11 +88,11 @@ export const MultiContentCardExample: React.FunctionComponent = () => {
</CardBody>
<CardFooter>
<Content>
<Button variant="link" isInline>
<Button icon={<Icon className="pf-v6-u-ml-sm" isInline>
<ArrowRightIcon />
</Icon>} variant="link" isInline>
Learn more
<Icon className="pf-v6-u-ml-sm" isInline>
<ArrowRightIcon />
</Icon>

</Button>
</Content>
</CardFooter>
Expand Down
76 changes: 76 additions & 0 deletions cypress/component/ResponsiveActions.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React from 'react';
import { ResponsiveActions } from '@patternfly/react-component-groups/dist/dynamic/ResponsiveActions';
import { ResponsiveAction } from '@patternfly/react-component-groups/dist/dynamic/ResponsiveAction';

describe('ResponsiveActions', () => {
beforeEach(() => {
cy.viewport(1280, 2000);
})

it('renders persistent, pinned, and overflow actions', () => {
cy.mount(
<ResponsiveActions breakpoint="lg">
<ResponsiveAction isPersistent>
Persistent action
</ResponsiveAction>
<ResponsiveAction isPinned variant='secondary'>
Pinned action
</ResponsiveAction>
<ResponsiveAction>
Overflow action
</ResponsiveAction>
</ResponsiveActions>
);

cy.get('[data-ouia-component-id="ResponsiveActions-action-0"]').should('be.visible');
cy.get('[data-ouia-component-id="ResponsiveActions-action-1"]').should('be.visible');
cy.get('[data-ouia-component-id="ResponsiveActions-action-2"]').should('not.exist');

cy.get('[data-ouia-component-id="ResponsiveActions-menu-dropdown-toggle"]').click();
cy.get('[data-ouia-component-id="ResponsiveActions-action-2"]').should('be.visible');
});

it('handles click events on actions', () => {
const onClickSpy = cy.spy().as('actionClickSpy');

cy.mount(
<ResponsiveActions breakpoint="lg">
<ResponsiveAction isPersistent onClick={onClickSpy}>
Persistent action
</ResponsiveAction>
<ResponsiveAction isPinned variant='secondary' onClick={onClickSpy}>
Pinned action
</ResponsiveAction>
<ResponsiveAction onClick={onClickSpy}>
Overflow action
</ResponsiveAction>
</ResponsiveActions>
);

cy.get('[data-ouia-component-id="ResponsiveActions-action-0"]').click();
cy.get('@actionClickSpy').should('have.been.calledOnce');

cy.get('[data-ouia-component-id="ResponsiveActions-action-1"]').click();
cy.get('@actionClickSpy').should('have.been.calledTwice');

cy.get('[data-ouia-component-id="ResponsiveActions-menu-dropdown-toggle"]').click();
cy.get('[data-ouia-component-id="ResponsiveActions-action-2"]').click();
cy.get('@actionClickSpy').should('have.been.calledThrice');
});

it('renders no persistent or pinned actions without flags', () => {
cy.mount(
<ResponsiveActions breakpoint="lg">
<ResponsiveAction>
Overflow action
</ResponsiveAction>
</ResponsiveActions>
);

cy.get('[data-ouia-component-id="menu-persistent-content"]').should('not.exist');
cy.get('[data-ouia-component-id="menu-pinned-content"]').should('not.exist');

cy.get('[data-ouia-component-id="ResponsiveActions-menu-dropdown-toggle"]').click();
cy.contains('Overflow action').should('be.visible');
});
});
45 changes: 26 additions & 19 deletions cypress/component/SkeletonTable.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,66 +1,73 @@
import React from 'react';
import { RowSelectVariant, Th } from '@patternfly/react-table';
import SkeletonTable from '../../packages/module/dist/dynamic/SkeletonTable';
import { RowSelectVariant } from '@patternfly/react-table';
import SkeletonTable from '@patternfly/react-component-groups/dist/dynamic/SkeletonTable';

describe('SkeletonTable', () => {
beforeEach(() => {
cy.viewport(1600, 800);
});

it('renders SkeletonTable', () => {
const SkeletonTableExample = <SkeletonTable rows={10} columns={[ 'first', 'second' ]} />;
const SkeletonTableExample = <SkeletonTable rowsCount={10} columns={[ 'First', 'Second' ]} />;
cy.mount(SkeletonTableExample);
cy.get('table').should('exist');
cy.get('table thead tr').should('have.text', 'firstsecond');
cy.get('table thead tr th').eq(0).should('have.text', 'First');
cy.get('table thead tr th').eq(1).should('have.text', 'Second');
});

it ('can be used without passing columns', () => {
const SkeletonTableExample = <SkeletonTable rows={10} numberOfColumns={2} />;
const SkeletonTableExample = <SkeletonTable rowsCount={10} columnsCount={2} />;
cy.mount(SkeletonTableExample);
cy.get('table').should('exist');
cy.get('table thead tr').should('have.text', '');
});

it('contains checkboxes when passed isSelectable', () => {
const SkeletonTableExample = <SkeletonTable rows={10} columns={[ 'first', 'second' ]} isSelectable />;
const SkeletonTableExample = <SkeletonTable rowsCount={10} columns={[ 'First', 'Second' ]} isSelectable />;
cy.mount(SkeletonTableExample);
cy.get('table').should('exist');
cy.get('table thead tr').should('have.text', 'firstsecond');
cy.get('table thead tr th').eq(0).should('have.text', 'Data selection table header cell');
cy.get('table thead tr th').eq(1).should('have.text', 'First');
cy.get('table thead tr th').eq(2).should('have.text', 'Second');
cy.get('input[type="checkbox"]').should('have.length', 10);
});

it('is expandable when passed isExpandable', () => {
const SkeletonTableExample = <SkeletonTable rows={10} columns={[ 'first', 'second' ]} isExpandable />;
const SkeletonTableExample = <SkeletonTable rowsCount={10} columns={[ 'First', 'Second' ]} isExpandable />;
cy.mount(SkeletonTableExample);
cy.get('table').should('exist');
cy.get('table thead tr').should('have.text', 'firstsecond');
cy.get('table thead tr th').eq(0).should('have.text', 'Data expansion table header cell');
cy.get('table thead tr th').eq(1).should('have.text', 'First');
cy.get('table thead tr th').eq(2).should('have.text', 'Second');
cy.get('.pf-v6-c-table__toggle-icon').should('have.length', 10);
});

it('can be passed a selectVariant to render radio buttons', () => {
const SkeletonTableExample = <SkeletonTable rows={10} columns={[ 'first', 'second' ]} isSelectable selectVariant={RowSelectVariant.radio} />;
const SkeletonTableExample = <SkeletonTable rowsCount={10} columns={[ 'First', 'Second' ]} isSelectable selectVariant={RowSelectVariant.radio} />;
cy.mount(SkeletonTableExample);
cy.get('table').should('exist');
cy.get('table thead tr').should('have.text', 'firstsecond');
cy.get('table thead tr th').eq(0).should('have.text', 'Data selection table header cell');
cy.get('table thead tr th').eq(1).should('have.text', 'First');
cy.get('table thead tr th').eq(2).should('have.text', 'Second');
cy.get('input[type="radio"]').should('have.length', 10);
});

it('can be passed custom columns', () => {
it('can be passed custom columns props', () => {
const SkeletonTableExample = (
<SkeletonTable
rows={10}
columns={[
<Th key="1" sort={{ columnIndex: 0, sortBy: { index: 0, direction: 'asc' } }}>
first
</Th>,
<Th key="2">second</Th>,
<Th key="3">third</Th>
columns={[
{ cell: 'first', props: { sort: { columnIndex: 0, sortBy: { index: 0, direction: 'asc' } } } },
{ cell: 'second' },
{ cell: 'third' }
]}
/>
);
cy.mount(SkeletonTableExample);
cy.get('table').should('exist');
cy.get('table thead tr').should('have.text', 'firstsecondthird');
cy.get('table thead tr th').eq(0).should('have.text', 'first');
cy.get('table thead tr th').eq(1).should('have.text', 'second');
cy.get('table thead tr th').eq(2).should('have.text', 'third');
cy.get('.pf-v6-c-table__sort-indicator').eq(0).find('path').should(
'have.attr',
'd',
Expand Down
30 changes: 30 additions & 0 deletions cypress/component/SkeletonTableBody.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { RowSelectVariant } from '@patternfly/react-table';
import SkeletonTableBody from '@patternfly/react-component-groups/dist/dynamic/SkeletonTableBody';

describe('SkeletonTableBody', () => {
beforeEach(() => {
cy.viewport(1600, 800);
});

it('renders SkeletonTableBody', () => {
const SkeletonTableExample = <SkeletonTableBody rowsCount={10} columnsCount={2} />;
cy.mount(SkeletonTableExample);
cy.get('div[class="pf-v5-c-skeleton"]').should('have.length', 20);
});

it('contains checkboxes when passed isSelectable', () => {
cy.mount(<SkeletonTableBody rowsCount={10} columnsCount={2} isSelectable />);
cy.get('input[type="checkbox"]').should('have.length', 10);
});

it('is expandable when passed isExpandable', () => {
cy.mount(<SkeletonTableBody rowsCount={10} columnsCount={2} isExpandable />);
cy.get('.pf-v5-c-table__toggle-icon').should('have.length', 10);
});

it('can be passed a selectVariant to render radio buttons', () => {
cy.mount(<SkeletonTableBody rowsCount={10} columnsCount={2} isSelectable selectVariant={RowSelectVariant.radio} />);
cy.get('input[type="radio"]').should('have.length', 10);
});
});
89 changes: 89 additions & 0 deletions cypress/component/SkeletonTableHead.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import React from 'react';
import { Table } from '@patternfly/react-table';
import { SkeletonTableHead } from '@patternfly/react-component-groups/dist/dynamic/SkeletonTableHead';

describe('SkeletonTableHead', () => {
beforeEach(() => {
cy.viewport(1600, 800);
});

it('renders SkeletonTable with custom columns', () => {
const SkeletonTableExample = (
<Table>
<SkeletonTableHead columns={[ 'First', 'Second' ]} />
</Table>
);
cy.mount(SkeletonTableExample);
cy.get('table thead tr th').eq(0).should('have.text', 'First');
cy.get('table thead tr th').eq(1).should('have.text', 'Second');
});

it('renders SkeletonTable with column count but no custom columns', () => {
const SkeletonTableExample = (
<Table>
<SkeletonTableHead columnsCount={2} />
</Table>
);
cy.mount(SkeletonTableExample);
cy.get('table thead tr th').should('have.length', 2);
cy.get('table thead tr th').each((th) => {
cy.wrap(th).find('.pf-v5-c-skeleton').should('exist');
});
});

it('renders SkeletonTable with selectable column', () => {
const SkeletonTableExample = (
<Table>
<SkeletonTableHead columns={[ 'First' ]} isSelectable />
</Table>
);
cy.mount(SkeletonTableExample);
cy.get('table thead tr th').should('have.length', 2);
cy.get('table thead tr th').eq(0).should('have.text', 'Data selection table header cell');
});

it('renders SkeletonTable with expandable column', () => {
const SkeletonTableExample = (
<Table>
<SkeletonTableHead columns={[ 'First' ]} isExpandable />
</Table>
);
cy.mount(SkeletonTableExample);
cy.get('table thead tr th').should('have.length', 2);
cy.get('table thead tr th').eq(0).should('have.text', 'Data expansion table header cell');
});

it('renders SkeletonTable with selectable and expandable columns', () => {
const SkeletonTableExample = (
<Table>
<SkeletonTableHead columns={[ 'First', 'Second' ]} isSelectable isExpandable />
</Table>
);
cy.mount(SkeletonTableExample);
cy.get('table thead tr th').should('have.length', 4);
});

it('renders SkeletonTable with custom ouiaId', () => {
const customOuiaId = 'CustomOuia';
const SkeletonTableExample = (
<Table>
<SkeletonTableHead columns={[ 'First', 'Second' ]} ouiaId={customOuiaId} />
</Table>
);
cy.mount(SkeletonTableExample);
cy.get('thead').should('have.attr', 'data-ouia-component-id', `${customOuiaId}-thead`);
cy.get('th').each((th, index) => {
cy.wrap(th).should('have.attr', 'data-ouia-component-id', `${customOuiaId}-th-${index}`);
});
});

it('handles no columns and no columnsCount', () => {
const SkeletonTableExample = (
<Table>
<SkeletonTableHead />
</Table>
);
cy.mount(SkeletonTableExample);
cy.get('table thead tr th').should('have.length', 1);
});
});
Loading
Loading