@patternfly/react-table 6.5.0-prerelease.4 → 6.5.0-prerelease.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-table",
3
- "version": "6.5.0-prerelease.4",
3
+ "version": "6.5.0-prerelease.5",
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,7 +40,7 @@
40
40
  "subpaths": "node ../../scripts/exportSubpaths.mjs --config subpaths.config.json"
41
41
  },
42
42
  "dependencies": {
43
- "@patternfly/react-core": "^6.5.0-prerelease.4",
43
+ "@patternfly/react-core": "^6.5.0-prerelease.5",
44
44
  "@patternfly/react-icons": "^6.5.0-prerelease.2",
45
45
  "@patternfly/react-styles": "^6.5.0-prerelease.2",
46
46
  "@patternfly/react-tokens": "^6.5.0-prerelease.2",
@@ -51,5 +51,5 @@
51
51
  "react": "^17 || ^18 || ^19",
52
52
  "react-dom": "^17 || ^18 || ^19"
53
53
  },
54
- "gitHead": "912729437db337b5e576adbe8d06bdf2bc04b189"
54
+ "gitHead": "0f921f1c919501506e043b7c8b2febc71644b15a"
55
55
  }
@@ -48,6 +48,8 @@ export interface TableProps extends React.HTMLProps<HTMLTableElement>, OUIAProps
48
48
  gridBreakPoint?: '' | 'grid' | 'grid-md' | 'grid-lg' | 'grid-xl' | 'grid-2xl';
49
49
  /** A valid WAI-ARIA role to be applied to the table element */
50
50
  role?: string;
51
+ /** @beta Flag indicating if the table should have plain styling with a transparent background */
52
+ isPlain?: boolean;
51
53
  /** If set to true, the table header sticks to the top of its container */
52
54
  isStickyHeader?: boolean;
53
55
  /** @hide Forwarded ref */
@@ -94,6 +96,7 @@ const TableBase: React.FunctionComponent<TableProps> = ({
94
96
  variant,
95
97
  borders = true,
96
98
  isStickyHeader = false,
99
+ isPlain = false,
97
100
  gridBreakPoint = TableGridBreakpoint.gridMd,
98
101
  'aria-label': ariaLabel,
99
102
  role = 'grid',
@@ -222,6 +225,7 @@ const TableBase: React.FunctionComponent<TableProps> = ({
222
225
  isTreeTable && stylesTreeView.modifiers.treeView,
223
226
  isStriped && styles.modifiers.striped,
224
227
  isExpandable && styles.modifiers.expandable,
228
+ isPlain && styles.modifiers.plain,
225
229
  hasNoInset && stylesTreeView.modifiers.noInset,
226
230
  isNested && 'pf-m-nested',
227
231
  hasAnimations && styles.modifiers.animateExpand
@@ -78,7 +78,10 @@ Some general notes:
78
78
  ```ts file="TableBasic.tsx"
79
79
 
80
80
  ```
81
+ ### Table Plain
82
+ ``` file="TablePlain.tsx"
81
83
 
84
+ ```
82
85
  ### Custom row wrapper, header tooltips & popovers
83
86
 
84
87
  - If you add the `noWrap` prop to `Thead`, it won't wrap it if there is no space
@@ -0,0 +1,52 @@
1
+ import { Table, Caption, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
2
+
3
+ interface Repository {
4
+ name: string;
5
+ branches: string | null;
6
+ prs: string | null;
7
+ workspaces: string;
8
+ lastCommit: string;
9
+ }
10
+
11
+ export const TablePlain: React.FunctionComponent = () => {
12
+ // In real usage, this data would come from some external source like an API via props.
13
+ const repositories: Repository[] = [
14
+ { name: 'one', branches: 'two', prs: 'three', workspaces: 'four', lastCommit: 'five' },
15
+ { name: 'one - 2', branches: null, prs: null, workspaces: 'four - 2', lastCommit: 'five - 2' },
16
+ { name: 'one - 3', branches: 'two - 3', prs: 'three - 3', workspaces: 'four - 3', lastCommit: 'five - 3' }
17
+ ];
18
+
19
+ const columnNames = {
20
+ name: 'Repositories',
21
+ branches: 'Branches',
22
+ prs: 'Pull requests',
23
+ workspaces: 'Workspaces',
24
+ lastCommit: 'Last commit'
25
+ };
26
+
27
+ return (
28
+ <Table aria-label="Plain table" isPlain={true}>
29
+ <Caption>Simple table with plain styling using composable components</Caption>
30
+ <Thead>
31
+ <Tr>
32
+ <Th>{columnNames.name}</Th>
33
+ <Th>{columnNames.branches}</Th>
34
+ <Th>{columnNames.prs}</Th>
35
+ <Th>{columnNames.workspaces}</Th>
36
+ <Th>{columnNames.lastCommit}</Th>
37
+ </Tr>
38
+ </Thead>
39
+ <Tbody>
40
+ {repositories.map((repo) => (
41
+ <Tr key={repo.name}>
42
+ <Td dataLabel={columnNames.name}>{repo.name}</Td>
43
+ <Td dataLabel={columnNames.branches}>{repo.branches}</Td>
44
+ <Td dataLabel={columnNames.prs}>{repo.prs}</Td>
45
+ <Td dataLabel={columnNames.workspaces}>{repo.workspaces}</Td>
46
+ <Td dataLabel={columnNames.lastCommit}>{repo.lastCommit}</Td>
47
+ </Tr>
48
+ ))}
49
+ </Tbody>
50
+ </Table>
51
+ );
52
+ };