@patternfly/react-table 6.3.1 → 6.4.0-prerelease.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +115 -1
  2. package/components/package.json +1 -1
  3. package/deprecated/package.json +1 -1
  4. package/dist/dynamic/components/Table/package.json +1 -1
  5. package/dist/dynamic/components/Table/utils/decorators/package.json +1 -1
  6. package/dist/dynamic/components/Table/utils/package.json +1 -1
  7. package/dist/dynamic/deprecated/components/Table/base/package.json +1 -1
  8. package/dist/dynamic/deprecated/components/Table/package.json +1 -1
  9. package/dist/dynamic/deprecated/components/package.json +1 -1
  10. package/dist/esm/components/Table/FavoritesCell.d.ts.map +1 -1
  11. package/dist/esm/components/Table/FavoritesCell.js +1 -2
  12. package/dist/esm/components/Table/FavoritesCell.js.map +1 -1
  13. package/dist/esm/components/Table/SortColumn.d.ts.map +1 -1
  14. package/dist/esm/components/Table/SortColumn.js +2 -2
  15. package/dist/esm/components/Table/SortColumn.js.map +1 -1
  16. package/dist/esm/components/Table/Table.d.ts.map +1 -1
  17. package/dist/esm/components/Table/Table.js +3 -1
  18. package/dist/esm/components/Table/Table.js.map +1 -1
  19. package/dist/esm/components/Table/Th.d.ts +2 -0
  20. package/dist/esm/components/Table/Th.d.ts.map +1 -1
  21. package/dist/esm/components/Table/Th.js +5 -5
  22. package/dist/esm/components/Table/Th.js.map +1 -1
  23. package/dist/js/components/Table/FavoritesCell.d.ts.map +1 -1
  24. package/dist/js/components/Table/FavoritesCell.js +1 -2
  25. package/dist/js/components/Table/FavoritesCell.js.map +1 -1
  26. package/dist/js/components/Table/SortColumn.d.ts.map +1 -1
  27. package/dist/js/components/Table/SortColumn.js +2 -2
  28. package/dist/js/components/Table/SortColumn.js.map +1 -1
  29. package/dist/js/components/Table/Table.d.ts.map +1 -1
  30. package/dist/js/components/Table/Table.js +3 -1
  31. package/dist/js/components/Table/Table.js.map +1 -1
  32. package/dist/js/components/Table/Th.d.ts +2 -0
  33. package/dist/js/components/Table/Th.d.ts.map +1 -1
  34. package/dist/js/components/Table/Th.js +4 -4
  35. package/dist/js/components/Table/Th.js.map +1 -1
  36. package/dist/umd/assets/{output-FhBAGHMm.css → output-D2xECikI.css} +5342 -5247
  37. package/dist/umd/react-table.min.js +3 -3
  38. package/package.json +6 -6
  39. package/src/components/Table/FavoritesCell.tsx +2 -2
  40. package/src/components/Table/SortColumn.tsx +2 -2
  41. package/src/components/Table/Table.tsx +3 -1
  42. package/src/components/Table/Th.tsx +4 -0
  43. package/src/components/Table/__tests__/Table.test.tsx +28 -0
  44. package/src/components/Table/__tests__/Th.test.tsx +26 -0
  45. package/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +1 -1
  46. package/src/demos/examples/TableCompact.tsx +36 -39
  47. package/src/demos/examples/TableEmptyStateDefault.tsx +34 -37
  48. package/src/demos/examples/TableEmptyStateError.tsx +30 -32
  49. package/src/demos/examples/TableEmptyStateLoading.tsx +21 -23
  50. package/src/demos/examples/TableExpandCollapseAll.tsx +48 -50
  51. package/src/demos/examples/TableSortableResponsive.tsx +82 -85
  52. package/src/demos/examples/TableStaticBottomPagination.tsx +28 -31
  53. package/src/demos/examples/TableStickyFirstColumn.tsx +81 -89
  54. package/src/demos/examples/TableStickyHeader.tsx +32 -34
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-table",
3
- "version": "6.3.1",
3
+ "version": "6.4.0-prerelease.2",
4
4
  "description": "This library provides a set of React table components for use with the PatternFly 4",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -40,10 +40,10 @@
40
40
  "subpaths": "node ../../scripts/exportSubpaths.mjs --config subpaths.config.json"
41
41
  },
42
42
  "dependencies": {
43
- "@patternfly/react-core": "^6.3.1",
44
- "@patternfly/react-icons": "^6.3.1",
45
- "@patternfly/react-styles": "^6.3.1",
46
- "@patternfly/react-tokens": "^6.3.1",
43
+ "@patternfly/react-core": "^6.4.0-prerelease.1",
44
+ "@patternfly/react-icons": "^6.4.0-prerelease.1",
45
+ "@patternfly/react-styles": "^6.4.0-prerelease.1",
46
+ "@patternfly/react-tokens": "^6.4.0-prerelease.1",
47
47
  "lodash": "^4.17.21",
48
48
  "tslib": "^2.8.1"
49
49
  },
@@ -51,5 +51,5 @@
51
51
  "react": "^17 || ^18 || ^19",
52
52
  "react-dom": "^17 || ^18 || ^19"
53
53
  },
54
- "gitHead": "08775efb8b882f3b2b6cf7b7221f41154875415b"
54
+ "gitHead": "263c48569fb00a9db5bed9ea471e46ef0773887d"
55
55
  }
@@ -1,4 +1,3 @@
1
- import StarIcon from '@patternfly/react-icons/dist/esm/icons/star-icon';
2
1
  import { Button } from '@patternfly/react-core/dist/esm/components/Button';
3
2
 
4
3
  export interface FavoritesCellProps {
@@ -30,9 +29,10 @@ export const FavoritesCell: React.FunctionComponent<FavoritesCellProps> = ({
30
29
  type="button"
31
30
  aria-label={isFavorited ? 'Starred' : 'Not starred'}
32
31
  onClick={onFavorite}
32
+ isFavorite
33
+ isFavorited={isFavorited}
33
34
  {...ariaProps}
34
35
  {...props}
35
- icon={<StarIcon />}
36
36
  />
37
37
  );
38
38
  };
@@ -2,7 +2,6 @@ import { useState } from 'react';
2
2
  import LongArrowAltUpIcon from '@patternfly/react-icons/dist/esm/icons/long-arrow-alt-up-icon';
3
3
  import LongArrowAltDownIcon from '@patternfly/react-icons/dist/esm/icons/long-arrow-alt-down-icon';
4
4
  import ArrowsAltVIcon from '@patternfly/react-icons/dist/esm/icons/arrows-alt-v-icon';
5
- import StarIcon from '@patternfly/react-icons/dist/esm/icons/star-icon';
6
5
  import { css } from '@patternfly/react-styles';
7
6
  import styles from '@patternfly/react-styles/css/components/Table/table';
8
7
  import { TableText } from './TableText';
@@ -50,10 +49,11 @@ export const SortColumn: React.FunctionComponent<SortColumnProps> = ({
50
49
  }
51
50
 
52
51
  if (favoriteButtonProps) {
52
+ const { favorited, ...rest } = favoriteButtonProps;
53
53
  return (
54
54
  <ActionList isIconList>
55
55
  <ActionListItem>
56
- <Button variant="plain" icon={<StarIcon />} {...favoriteButtonProps} />
56
+ <Button variant="plain" isFavorite isFavorited={favorited} {...rest} />
57
57
  </ActionListItem>
58
58
  <ActionListItem>
59
59
  <Button
@@ -8,6 +8,7 @@ import { IVisibility } from './utils/decorators/classNames';
8
8
  import { handleArrows, setTabIndex } from '@patternfly/react-core/dist/esm/helpers/KeyboardHandler';
9
9
  import { KeyTypes } from '@patternfly/react-core/dist/esm/helpers/constants';
10
10
  import { useOUIAProps, OUIAProps } from '@patternfly/react-core/dist/esm/helpers/OUIA/ouia';
11
+ import { useHasAnimations } from '@patternfly/react-core/dist/esm/helpers';
11
12
  import { TableGridBreakpoint, TableVariant } from './TableTypes';
12
13
 
13
14
  export interface BaseCellProps {
@@ -103,13 +104,14 @@ const TableBase: React.FunctionComponent<TableProps> = ({
103
104
  isNested = false,
104
105
  isStriped = false,
105
106
  isExpandable = false,
106
- hasAnimations = false,
107
+ hasAnimations: hasAnimationsProp,
107
108
  hasNoInset = false,
108
109
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
109
110
  nestedHeaderColumnSpans,
110
111
  selectableRowCaptionText,
111
112
  ...props
112
113
  }: TableProps) => {
114
+ const hasAnimations = useHasAnimations(hasAnimationsProp);
113
115
  const ref = useRef(null);
114
116
  const tableRef = innerRef || ref;
115
117
 
@@ -65,6 +65,8 @@ export interface ThProps
65
65
  * content, such as a "select all" checkbox or "expand all" toggle.
66
66
  */
67
67
  'aria-label'?: string;
68
+ /** @hide Beta prop, internal use only. Additional content to render in the column header, appended to the end of the header content. */
69
+ additionalContent?: React.ReactNode;
68
70
  }
69
71
 
70
72
  const ThBase: React.FunctionComponent<ThProps> = ({
@@ -94,6 +96,7 @@ const ThBase: React.FunctionComponent<ThProps> = ({
94
96
  isSubheader = false,
95
97
  screenReaderText,
96
98
  'aria-label': ariaLabel,
99
+ additionalContent,
97
100
  ...props
98
101
  }: ThProps) => {
99
102
  const { variant } = useContext(TableContext);
@@ -241,6 +244,7 @@ const ThBase: React.FunctionComponent<ThProps> = ({
241
244
  >
242
245
  {transformedChildren ||
243
246
  (screenReaderText && <span className={accessibilityStyles.screenReader}>{screenReaderText}</span>)}
247
+ {additionalContent && additionalContent}
244
248
  </MergedComponent>
245
249
  );
246
250
 
@@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react';
2
2
  import { Table } from '../Table';
3
3
  import { Td } from '../Td';
4
4
  import { Th } from '../Th';
5
+ import { AnimationsProvider, useAnimationsConfig, useHasAnimations } from '@patternfly/react-core/dist/esm/helpers';
5
6
  import styles from '@patternfly/react-styles/css/components/Table/table';
6
7
 
7
8
  test('Renders without children', () => {
@@ -57,6 +58,33 @@ test(`Renders with class ${styles.modifiers.animateExpand} hasAnimations is true
57
58
  expect(screen.getByRole('grid', { name: 'Test table' })).toHaveClass(styles.modifiers.animateExpand);
58
59
  });
59
60
 
61
+ // Animation context tests for expandable tables
62
+ test('respects AnimationsProvider context when no local hasAnimations prop for expandable table', () => {
63
+ render(
64
+ <AnimationsProvider config={{ hasAnimations: true }}>
65
+ <Table isExpandable aria-label="Test table" />
66
+ </AnimationsProvider>
67
+ );
68
+
69
+ expect(screen.getByRole('grid', { name: 'Test table' })).toHaveClass(styles.modifiers.animateExpand);
70
+ });
71
+
72
+ test('local hasAnimations prop takes precedence over context for expandable table', () => {
73
+ render(
74
+ <AnimationsProvider config={{ hasAnimations: true }}>
75
+ <Table isExpandable hasAnimations={false} aria-label="Test table" />
76
+ </AnimationsProvider>
77
+ );
78
+
79
+ expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.animateExpand);
80
+ });
81
+
82
+ test('works without AnimationsProvider (backward compatibility) for expandable table', () => {
83
+ render(<Table isExpandable aria-label="Test table" />);
84
+
85
+ expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.animateExpand);
86
+ });
87
+
60
88
  test('Matches snapshot without children', () => {
61
89
  const { asFragment } = render(<Table />);
62
90
 
@@ -28,3 +28,29 @@ test('Renders with screen reader text when screenReaderText is passed in', () =>
28
28
 
29
29
  expect(screen.getByRole('columnheader')).toHaveTextContent('Test');
30
30
  });
31
+
32
+ test('Does not render with additional content by default', () => {
33
+ render(<Th />);
34
+
35
+ expect(screen.getByRole('columnheader')).toBeEmptyDOMElement();
36
+ });
37
+
38
+ test('Render with additional content when additionalContent is passed in', () => {
39
+ render(<Th additionalContent={<div>Extra</div>}>Test</Th>);
40
+
41
+ expect(screen.getByRole('columnheader')).toHaveTextContent('Extra');
42
+ });
43
+
44
+ test('Additional content renders after children when additionalContent is passed in', () => {
45
+ render(
46
+ <Th additionalContent={<div>Extra</div>}>
47
+ <div>Test</div>
48
+ </Th>
49
+ );
50
+
51
+ const th = screen.getByRole('columnheader');
52
+ const thChildren = th.children;
53
+
54
+ expect(thChildren.item(0)?.textContent).toEqual('Test');
55
+ expect(thChildren.item(1)?.textContent).toEqual('Extra');
56
+ });
@@ -4,7 +4,7 @@ exports[`Matches snapshot without children 1`] = `
4
4
  <DocumentFragment>
5
5
  <table
6
6
  class="pf-v6-c-table pf-m-grid-md"
7
- data-ouia-component-id="OUIA-Generated-Table-9"
7
+ data-ouia-component-id="OUIA-Generated-Table-12"
8
8
  data-ouia-component-type="PF6/Table"
9
9
  data-ouia-safe="true"
10
10
  role="grid"
@@ -1,7 +1,6 @@
1
1
  import { Fragment, useState } from 'react';
2
2
  import {
3
3
  Button,
4
- Card,
5
4
  MenuToggle,
6
5
  MenuToggleElement,
7
6
  Pagination,
@@ -130,45 +129,43 @@ export const TableCompact: React.FunctionComponent = () => {
130
129
  <Fragment>
131
130
  <DashboardWrapper hasPageTemplateTitle>
132
131
  <PageSection isFilled aria-label="Compact table data">
133
- <Card>
134
- {tableToolbar}
135
- <Table variant="compact" aria-label="Compact Table">
136
- <Thead>
137
- <Tr>
138
- <Th key={0}>{columns[0]}</Th>
139
- <Th key={1}>{columns[1]}</Th>
140
- <Th key={2}>{columns[2]}</Th>
141
- <Th key={3}>{columns[3]}</Th>
142
- <Th key={4}>{columns[4]}</Th>
143
- <Th key={5}>{columns[5]}</Th>
144
- <Th key={6}>{columns[6]}</Th>
145
- <Th key={7} width={10}>
146
- {columns[7]}
147
- </Th>
132
+ {tableToolbar}
133
+ <Table variant="compact" aria-label="Compact Table">
134
+ <Thead>
135
+ <Tr>
136
+ <Th key={0}>{columns[0]}</Th>
137
+ <Th key={1}>{columns[1]}</Th>
138
+ <Th key={2}>{columns[2]}</Th>
139
+ <Th key={3}>{columns[3]}</Th>
140
+ <Th key={4}>{columns[4]}</Th>
141
+ <Th key={5}>{columns[5]}</Th>
142
+ <Th key={6}>{columns[6]}</Th>
143
+ <Th key={7} width={10}>
144
+ {columns[7]}
145
+ </Th>
146
+ </Tr>
147
+ </Thead>
148
+ <Tbody>
149
+ {paginatedRows.map((row, rowIndex) => (
150
+ <Tr key={rowIndex}>
151
+ <>
152
+ <Td dataLabel={columns[0]}>{row.name}</Td>
153
+ <Td dataLabel={columns[1]}>{row.threads}</Td>
154
+ <Td dataLabel={columns[2]}>{row.applications}</Td>
155
+ <Td dataLabel={columns[3]}>{row.workspaces}</Td>
156
+ <Td dataLabel={columns[4]}>{renderLabel(row.status)}</Td>
157
+ <Td dataLabel={columns[5]}>{row.location}</Td>
158
+ <Td dataLabel={columns[6]}>{row.lastModified}</Td>
159
+ <Td dataLabel={columns[7]} modifier="truncate">
160
+ <TableText>
161
+ <a href="#">{row.url}</a>
162
+ </TableText>
163
+ </Td>
164
+ </>
148
165
  </Tr>
149
- </Thead>
150
- <Tbody>
151
- {paginatedRows.map((row, rowIndex) => (
152
- <Tr key={rowIndex}>
153
- <>
154
- <Td dataLabel={columns[0]}>{row.name}</Td>
155
- <Td dataLabel={columns[1]}>{row.threads}</Td>
156
- <Td dataLabel={columns[2]}>{row.applications}</Td>
157
- <Td dataLabel={columns[3]}>{row.workspaces}</Td>
158
- <Td dataLabel={columns[4]}>{renderLabel(row.status)}</Td>
159
- <Td dataLabel={columns[5]}>{row.location}</Td>
160
- <Td dataLabel={columns[6]}>{row.lastModified}</Td>
161
- <Td dataLabel={columns[7]} modifier="truncate">
162
- <TableText>
163
- <a href="#">{row.url}</a>
164
- </TableText>
165
- </Td>
166
- </>
167
- </Tr>
168
- ))}
169
- </Tbody>
170
- </Table>
171
- </Card>
166
+ ))}
167
+ </Tbody>
168
+ </Table>
172
169
  </PageSection>
173
170
  </DashboardWrapper>
174
171
  </Fragment>
@@ -2,7 +2,6 @@ import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
2
2
  import {
3
3
  Bullseye,
4
4
  Button,
5
- Card,
6
5
  EmptyState,
7
6
  EmptyStateVariant,
8
7
  EmptyStateBody,
@@ -16,42 +15,40 @@ import { DashboardWrapper } from '@patternfly/react-table/dist/esm/demos/Dashboa
16
15
  export const TableEmptyStateDefault: React.FunctionComponent = () => (
17
16
  <DashboardWrapper hasPageTemplateTitle>
18
17
  <PageSection padding={{ default: 'noPadding', xl: 'padding' }} aria-label="Empty state table data">
19
- <Card component="div">
20
- <Table aria-label="Empty state table">
21
- <Thead>
22
- <Tr>
23
- <Th>Repositories</Th>
24
- <Th>Branches</Th>
25
- <Th>Pull requests</Th>
26
- <Th>Workspaces</Th>
27
- <Th>Last commit</Th>
28
- </Tr>
29
- </Thead>
30
- <Tbody>
31
- <Tr>
32
- <Td colSpan={8}>
33
- <Bullseye>
34
- <EmptyState
35
- titleText="No results found"
36
- icon={SearchIcon}
37
- headingLevel="h2"
38
- variant={EmptyStateVariant.sm}
39
- >
40
- <EmptyStateBody>
41
- No results match this filter criteria. Clear all filters and try again.
42
- </EmptyStateBody>
43
- <EmptyStateFooter>
44
- <EmptyStateActions>
45
- <Button variant="link">Clear all filters</Button>
46
- </EmptyStateActions>
47
- </EmptyStateFooter>
48
- </EmptyState>
49
- </Bullseye>
50
- </Td>
51
- </Tr>
52
- </Tbody>
53
- </Table>
54
- </Card>
18
+ <Table aria-label="Empty state table">
19
+ <Thead>
20
+ <Tr>
21
+ <Th>Repositories</Th>
22
+ <Th>Branches</Th>
23
+ <Th>Pull requests</Th>
24
+ <Th>Workspaces</Th>
25
+ <Th>Last commit</Th>
26
+ </Tr>
27
+ </Thead>
28
+ <Tbody>
29
+ <Tr>
30
+ <Td colSpan={8}>
31
+ <Bullseye>
32
+ <EmptyState
33
+ titleText="No results found"
34
+ icon={SearchIcon}
35
+ headingLevel="h2"
36
+ variant={EmptyStateVariant.sm}
37
+ >
38
+ <EmptyStateBody>
39
+ No results match this filter criteria. Clear all filters and try again.
40
+ </EmptyStateBody>
41
+ <EmptyStateFooter>
42
+ <EmptyStateActions>
43
+ <Button variant="link">Clear all filters</Button>
44
+ </EmptyStateActions>
45
+ </EmptyStateFooter>
46
+ </EmptyState>
47
+ </Bullseye>
48
+ </Td>
49
+ </Tr>
50
+ </Tbody>
51
+ </Table>
55
52
  </PageSection>
56
53
  </DashboardWrapper>
57
54
  );
@@ -1,42 +1,40 @@
1
1
  import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
2
- import { Bullseye, Card, EmptyState, EmptyStateVariant, EmptyStateBody, PageSection } from '@patternfly/react-core';
2
+ import { Bullseye, EmptyState, EmptyStateVariant, EmptyStateBody, PageSection } from '@patternfly/react-core';
3
3
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
4
4
  import { DashboardWrapper } from '@patternfly/react-table/dist/esm/demos/DashboardWrapper';
5
5
 
6
6
  export const TableEmptyStateError: React.FunctionComponent = () => (
7
7
  <DashboardWrapper hasPageTemplateTitle>
8
8
  <PageSection padding={{ default: 'noPadding', xl: 'padding' }} aria-label="Empty state table with error">
9
- <Card component="div">
10
- <Table aria-label="Loading table demo">
11
- <Thead>
12
- <Tr>
13
- <Th>Repositories</Th>
14
- <Th>Branches</Th>
15
- <Th>Pull requests</Th>
16
- <Th>Workspaces</Th>
17
- <Th>Last commit</Th>
18
- </Tr>
19
- </Thead>
20
- <Tbody>
21
- <Tr>
22
- <Td colSpan={8}>
23
- <Bullseye>
24
- <EmptyState
25
- icon={ExclamationCircleIcon}
26
- titleText="Unable to connect"
27
- headingLevel="h2"
28
- variant={EmptyStateVariant.sm}
29
- >
30
- <EmptyStateBody>
31
- There was an error retrieving data. Check your connection and reload the page.
32
- </EmptyStateBody>
33
- </EmptyState>
34
- </Bullseye>
35
- </Td>
36
- </Tr>
37
- </Tbody>
38
- </Table>
39
- </Card>
9
+ <Table aria-label="Loading table demo">
10
+ <Thead>
11
+ <Tr>
12
+ <Th>Repositories</Th>
13
+ <Th>Branches</Th>
14
+ <Th>Pull requests</Th>
15
+ <Th>Workspaces</Th>
16
+ <Th>Last commit</Th>
17
+ </Tr>
18
+ </Thead>
19
+ <Tbody>
20
+ <Tr>
21
+ <Td colSpan={8}>
22
+ <Bullseye>
23
+ <EmptyState
24
+ icon={ExclamationCircleIcon}
25
+ titleText="Unable to connect"
26
+ headingLevel="h2"
27
+ variant={EmptyStateVariant.sm}
28
+ >
29
+ <EmptyStateBody>
30
+ There was an error retrieving data. Check your connection and reload the page.
31
+ </EmptyStateBody>
32
+ </EmptyState>
33
+ </Bullseye>
34
+ </Td>
35
+ </Tr>
36
+ </Tbody>
37
+ </Table>
40
38
  </PageSection>
41
39
  </DashboardWrapper>
42
40
  );
@@ -1,32 +1,30 @@
1
1
  import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
2
- import { Bullseye, Card, EmptyState, PageSection, Spinner } from '@patternfly/react-core';
2
+ import { Bullseye, EmptyState, PageSection, Spinner } from '@patternfly/react-core';
3
3
  import { DashboardWrapper } from '@patternfly/react-table/dist/esm/demos/DashboardWrapper';
4
4
 
5
5
  export const TableEmptyStateLoading: React.FunctionComponent = () => (
6
6
  <DashboardWrapper hasPageTemplateTitle>
7
7
  <PageSection padding={{ default: 'noPadding', xl: 'padding' }} aria-label="Empty state table loading">
8
- <Card component="div">
9
- <Table aria-label="Loading table demo">
10
- <Thead>
11
- <Tr>
12
- <Th>Repositories</Th>
13
- <Th>Branches</Th>
14
- <Th>Pull requests</Th>
15
- <Th>Workspaces</Th>
16
- <Th>Last commit</Th>
17
- </Tr>
18
- </Thead>
19
- <Tbody>
20
- <Tr>
21
- <Td colSpan={8}>
22
- <Bullseye>
23
- <EmptyState titleText="Loading" icon={Spinner} headingLevel="h2" />
24
- </Bullseye>
25
- </Td>
26
- </Tr>
27
- </Tbody>
28
- </Table>
29
- </Card>
8
+ <Table aria-label="Loading table demo">
9
+ <Thead>
10
+ <Tr>
11
+ <Th>Repositories</Th>
12
+ <Th>Branches</Th>
13
+ <Th>Pull requests</Th>
14
+ <Th>Workspaces</Th>
15
+ <Th>Last commit</Th>
16
+ </Tr>
17
+ </Thead>
18
+ <Tbody>
19
+ <Tr>
20
+ <Td colSpan={8}>
21
+ <Bullseye>
22
+ <EmptyState titleText="Loading" icon={Spinner} headingLevel="h2" />
23
+ </Bullseye>
24
+ </Td>
25
+ </Tr>
26
+ </Tbody>
27
+ </Table>
30
28
  </PageSection>
31
29
  </DashboardWrapper>
32
30
  );
@@ -1,5 +1,5 @@
1
1
  import { Fragment, ReactNode, useEffect, useState } from 'react';
2
- import { Card, Content, Label, PageSection } from '@patternfly/react-core';
2
+ import { Content, Label, PageSection } from '@patternfly/react-core';
3
3
  import { Table, Thead, Tbody, Tr, Th, Td, ExpandableRowContent } from '@patternfly/react-table';
4
4
  import { DashboardWrapper } from '@patternfly/react-table/dist/esm/demos/DashboardWrapper';
5
5
 
@@ -155,56 +155,54 @@ export const TableExpandCollapseAll: React.FunctionComponent = () => {
155
155
  }}
156
156
  aria-label="Collapsible table data"
157
157
  >
158
- <Card component="div">
159
- <Table isExpandable hasAnimations aria-label="Collapsible table">
160
- <Thead>
161
- <Tr>
162
- <Th
163
- expand={{
164
- areAllExpanded: !areAllExpanded,
165
- collapseAllAriaLabel,
166
- onToggle: onCollapseAll
167
- }}
168
- aria-label="Row expansion"
169
- />
170
- {expandableColumns.map((column) => (
171
- <Th key={column}>{column}</Th>
172
- ))}
173
- </Tr>
174
- </Thead>
158
+ <Table isExpandable hasAnimations aria-label="Collapsible table">
159
+ <Thead>
160
+ <Tr>
161
+ <Th
162
+ expand={{
163
+ areAllExpanded: !areAllExpanded,
164
+ collapseAllAriaLabel,
165
+ onToggle: onCollapseAll
166
+ }}
167
+ aria-label="Row expansion"
168
+ />
169
+ {expandableColumns.map((column) => (
170
+ <Th key={column}>{column}</Th>
171
+ ))}
172
+ </Tr>
173
+ </Thead>
175
174
 
176
- {serverData.map((server, serverIndex) => (
177
- <Tbody key={server.name} isExpanded={isServerExpanded(server)}>
178
- <Tr isContentExpanded={isServerExpanded(server)}>
179
- <Td
180
- expand={
181
- server.details
182
- ? {
183
- rowIndex: serverIndex,
184
- isExpanded: isServerExpanded(server),
185
- onToggle: () => setServerExpanded(server, !isServerExpanded(server))
186
- }
187
- : undefined
188
- }
189
- >
190
- <ExpandableRowContent>{server.details}</ExpandableRowContent>
191
- </Td>
192
- <Td>{server?.name}</Td>
193
- <Td>{server?.threads}</Td>
194
- <Td>{server?.applications}</Td>
195
- <Td>{server?.workspaces}</Td>
196
- <Td>{server?.status?.title}</Td>
197
- </Tr>
198
- <Tr isExpanded={isServerExpanded(server)}>
199
- <Td></Td>
200
- <Td colSpan={expandableColumns.length}>
201
- <ExpandableRowContent>{server?.details}</ExpandableRowContent>
202
- </Td>
203
- </Tr>
204
- </Tbody>
205
- ))}
206
- </Table>
207
- </Card>
175
+ {serverData.map((server, serverIndex) => (
176
+ <Tbody key={server.name} isExpanded={isServerExpanded(server)}>
177
+ <Tr isContentExpanded={isServerExpanded(server)}>
178
+ <Td
179
+ expand={
180
+ server.details
181
+ ? {
182
+ rowIndex: serverIndex,
183
+ isExpanded: isServerExpanded(server),
184
+ onToggle: () => setServerExpanded(server, !isServerExpanded(server))
185
+ }
186
+ : undefined
187
+ }
188
+ >
189
+ <ExpandableRowContent>{server.details}</ExpandableRowContent>
190
+ </Td>
191
+ <Td>{server?.name}</Td>
192
+ <Td>{server?.threads}</Td>
193
+ <Td>{server?.applications}</Td>
194
+ <Td>{server?.workspaces}</Td>
195
+ <Td>{server?.status?.title}</Td>
196
+ </Tr>
197
+ <Tr isExpanded={isServerExpanded(server)}>
198
+ <Td></Td>
199
+ <Td colSpan={expandableColumns.length}>
200
+ <ExpandableRowContent>{server?.details}</ExpandableRowContent>
201
+ </Td>
202
+ </Tr>
203
+ </Tbody>
204
+ ))}
205
+ </Table>
208
206
  </PageSection>
209
207
  </DashboardWrapper>
210
208
  </Fragment>