@patternfly/react-table 5.0.0-alpha.91 → 5.0.0-alpha.93

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 (44) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/components/package.json +1 -1
  3. package/deprecated/package.json +1 -1
  4. package/dist/esm/components/Table/Td.js +3 -3
  5. package/dist/esm/components/Table/Td.js.map +1 -1
  6. package/dist/esm/components/Table/Th.js +1 -1
  7. package/dist/esm/components/Table/Th.js.map +1 -1
  8. package/dist/esm/components/Table/utils/decorators/treeRow.d.ts.map +1 -1
  9. package/dist/esm/components/Table/utils/decorators/treeRow.js +5 -5
  10. package/dist/esm/components/Table/utils/decorators/treeRow.js.map +1 -1
  11. package/dist/js/components/Table/Td.js +3 -3
  12. package/dist/js/components/Table/Td.js.map +1 -1
  13. package/dist/js/components/Table/Th.js +1 -1
  14. package/dist/js/components/Table/Th.js.map +1 -1
  15. package/dist/js/components/Table/package.json +1 -1
  16. package/dist/js/components/Table/utils/decorators/package.json +1 -1
  17. package/dist/js/components/Table/utils/decorators/treeRow.d.ts.map +1 -1
  18. package/dist/js/components/Table/utils/decorators/treeRow.js +5 -5
  19. package/dist/js/components/Table/utils/decorators/treeRow.js.map +1 -1
  20. package/dist/js/components/Table/utils/package.json +1 -1
  21. package/dist/js/components/package.json +1 -1
  22. package/dist/js/deprecated/components/Table/base/package.json +1 -1
  23. package/dist/js/deprecated/components/Table/package.json +1 -1
  24. package/dist/js/deprecated/components/package.json +1 -1
  25. package/dist/js/deprecated/package.json +1 -1
  26. package/dist/js/package.json +1 -1
  27. package/dist/umd/react-table.min.js +2 -2
  28. package/package.json +6 -6
  29. package/src/components/Table/Td.tsx +5 -5
  30. package/src/components/Table/Th.tsx +3 -3
  31. package/src/components/Table/__tests__/__snapshots__/RowWrapper.test.tsx.snap +1 -1
  32. package/src/components/Table/examples/TableCompoundExpandable.tsx +1 -1
  33. package/src/components/Table/examples/TableMisc.tsx +1 -1
  34. package/src/components/Table/examples/TableNestedHeaders.tsx +4 -4
  35. package/src/components/Table/examples/TableNestedStickyHeader.tsx +4 -4
  36. package/src/components/Table/utils/__snapshots__/transformers.test.tsx.snap +2 -2
  37. package/src/components/Table/utils/decorators/treeRow.tsx +85 -87
  38. package/src/components/Table/utils/transformers.test.tsx +7 -7
  39. package/src/deprecated/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +300 -300
  40. package/src/deprecated/components/Table/examples/LegacyTableCompoundExpandable.tsx +4 -4
  41. package/src/deprecated/components/Table/examples/LegacyTableMisc.tsx +2 -2
  42. package/src/deprecated/components/Table/examples/LegacyTableSelectable.tsx +6 -6
  43. package/src/docs/demos/Table.md +28 -22
  44. package/src/docs/demos/table-demos/CompoundExpansion.jsx +17 -22
@@ -65,7 +65,7 @@ export const LegacyTableCompoundExpandable: React.FunctionComponent = () => {
65
65
  }
66
66
  ];
67
67
  const rows: TableProps['rows'] = [];
68
- repositories.forEach(repo => {
68
+ repositories.forEach((repo) => {
69
69
  const expandedCellKey = expandedCells[repo.name];
70
70
  const isRowExpanded = !!expandedCellKey;
71
71
  rows.push({
@@ -117,7 +117,7 @@ export const LegacyTableCompoundExpandable: React.FunctionComponent = () => {
117
117
  cells: [
118
118
  {
119
119
  title: (
120
- <div className="pf-u-m-md" id={`compound-expansion-table-${repo.name}-1`}>
120
+ <div className="pf-v5-u-m-md" id={`compound-expansion-table-${repo.name}-1`}>
121
121
  Expanded content for {repo.name}: Branches goes here!
122
122
  </div>
123
123
  ),
@@ -132,7 +132,7 @@ export const LegacyTableCompoundExpandable: React.FunctionComponent = () => {
132
132
  cells: [
133
133
  {
134
134
  title: (
135
- <div className="pf-u-m-md" id={`compound-expansion-table-${repo.name}-2`}>
135
+ <div className="pf-v5-u-m-md" id={`compound-expansion-table-${repo.name}-2`}>
136
136
  Expanded content for {repo.name}: Pull requests goes here!
137
137
  </div>
138
138
  ),
@@ -147,7 +147,7 @@ export const LegacyTableCompoundExpandable: React.FunctionComponent = () => {
147
147
  cells: [
148
148
  {
149
149
  title: (
150
- <div className="pf-u-m-md" id={`compound-expansion-table-${repo.name}-3`}>
150
+ <div className="pf-v5-u-m-md" id={`compound-expansion-table-${repo.name}-3`}>
151
151
  Expanded content for {repo.name}: Workspaces goes here!
152
152
  </div>
153
153
  ),
@@ -19,7 +19,7 @@ export const LegacyTableMisc: React.FunctionComponent = () => {
19
19
  ];
20
20
 
21
21
  const columns: TableProps['cells'] = ['Repositories', 'Branches', 'Pull requests', 'Workspaces', 'Last commit'];
22
- const rows: TableProps['rows'] = repositories.map(repo => [
22
+ const rows: TableProps['rows'] = repositories.map((repo) => [
23
23
  repo.name,
24
24
  repo.branches || '',
25
25
  repo.prs || '',
@@ -30,7 +30,7 @@ export const LegacyTableMisc: React.FunctionComponent = () => {
30
30
  const customRowWrapper: TableProps['rowWrapper'] = ({ trRef, className, rowProps, row: _row, ...props }) => {
31
31
  const isOddRow = rowProps ? !!((rowProps.rowIndex + 1) % 2) : true;
32
32
  const customStyle = {
33
- borderLeft: '3px solid var(--pf-global--primary-color--100)'
33
+ borderLeft: '3px solid var(--pf-v5-global--primary-color--100)'
34
34
  };
35
35
  return (
36
36
  <tr
@@ -29,12 +29,12 @@ export const LegacyTableSelectable: React.FunctionComponent = () => {
29
29
  // This is to prevent state from being based on row order index in case we later add sorting.
30
30
  const [selectedRepoNames, setSelectedRepoNames] = React.useState<string[]>([]);
31
31
  const setRepoSelected = (repo: Repository, isSelecting = true) =>
32
- setSelectedRepoNames(prevSelected => {
33
- const otherSelectedRepoNames = prevSelected.filter(r => r !== repo.name);
32
+ setSelectedRepoNames((prevSelected) => {
33
+ const otherSelectedRepoNames = prevSelected.filter((r) => r !== repo.name);
34
34
  return isSelecting && isRepoSelectable(repo) ? [...otherSelectedRepoNames, repo.name] : otherSelectedRepoNames;
35
35
  });
36
36
  const selectAllRepos = (isSelecting = true) =>
37
- setSelectedRepoNames(isSelecting ? selectableRepos.map(r => r.name) : []);
37
+ setSelectedRepoNames(isSelecting ? selectableRepos.map((r) => r.name) : []);
38
38
  const isRepoSelected = (repo: Repository) => selectedRepoNames.includes(repo.name);
39
39
 
40
40
  const [canSelectAll, setCanSelectAll] = React.useState(true);
@@ -51,7 +51,7 @@ export const LegacyTableSelectable: React.FunctionComponent = () => {
51
51
  numberSelected > 0
52
52
  ? Array.from(new Array(numberSelected + 1), (_x, i) => i + recentSelectedRowIndex)
53
53
  : Array.from(new Array(Math.abs(numberSelected) + 1), (_x, i) => i + rowIndex);
54
- intermediateIndexes.forEach(index => setRepoSelected(repositories[index], isSelecting));
54
+ intermediateIndexes.forEach((index) => setRepoSelected(repositories[index], isSelecting));
55
55
  } else {
56
56
  setRepoSelected(repo, isSelecting);
57
57
  }
@@ -86,7 +86,7 @@ export const LegacyTableSelectable: React.FunctionComponent = () => {
86
86
  'Workspaces',
87
87
  'Last commit'
88
88
  ];
89
- const rows: TableProps['rows'] = repositories.map(repo => ({
89
+ const rows: TableProps['rows'] = repositories.map((repo) => ({
90
90
  cells: [repo.name, repo.branches, repo.prs, repo.workspaces, repo.lastCommit],
91
91
  selected: isRepoSelected(repo),
92
92
  disableSelection: !isRepoSelectable(repo)
@@ -96,7 +96,7 @@ export const LegacyTableSelectable: React.FunctionComponent = () => {
96
96
  <div>
97
97
  <Checkbox
98
98
  label="Can select all"
99
- className="pf-u-mb-lg"
99
+ className="pf-v5-u-mb-lg"
100
100
  isChecked={canSelectAll}
101
101
  onChange={(_event, checked) => setCanSelectAll(checked)}
102
102
  aria-label="toggle select all checkbox"
@@ -296,7 +296,7 @@ class BulkSelectTableDemo extends React.Component {
296
296
  )}
297
297
 
298
298
  {loading && (
299
- <div className="pf-l-bullseye">
299
+ <div className="pf-v5-l-bullseye">
300
300
  <Title headingLevel="h2" size="3xl">
301
301
  Please wait while loading data
302
302
  </Title>
@@ -999,10 +999,14 @@ class ColumnManagementAction extends React.Component {
999
999
  <ToolbarItem variant="overflow-menu">
1000
1000
  <OverflowMenu breakpoint="md">
1001
1001
  <OverflowMenuItem isPersistent>
1002
- <MenuToggle><FilterIcon /> Name</MenuToggle>
1002
+ <MenuToggle>
1003
+ <FilterIcon /> Name
1004
+ </MenuToggle>
1003
1005
  </OverflowMenuItem>
1004
- <OverflowMenuItem>
1005
- <MenuToggle variant="plain" aria-label="Sort columns"><SortAmountDownIcon aria-hidden="true" /></MenuToggle>
1006
+ <OverflowMenuItem>
1007
+ <MenuToggle variant="plain" aria-label="Sort columns">
1008
+ <SortAmountDownIcon aria-hidden="true" />
1009
+ </MenuToggle>
1006
1010
  </OverflowMenuItem>
1007
1011
  <OverflowMenuGroup groupType="button" isPersistent>
1008
1012
  <OverflowMenuItem>
@@ -1294,41 +1298,41 @@ class FilterTableDemo extends React.Component {
1294
1298
  ];
1295
1299
 
1296
1300
  const statusMenuItems = [
1297
- <SelectOption
1298
- hasCheckbox
1299
- key="statusRunning"
1300
- itemId="Running"
1301
+ <SelectOption
1302
+ hasCheckbox
1303
+ key="statusRunning"
1304
+ itemId="Running"
1301
1305
  isSelected={filters.status.includes("Running")}
1302
1306
  >
1303
1307
  Running
1304
1308
  </SelectOption>,
1305
- <SelectOption
1306
- hasCheckbox
1307
- key="statusStopped"
1309
+ <SelectOption
1310
+ hasCheckbox
1311
+ key="statusStopped"
1308
1312
  itemId="Stopped"
1309
1313
  isSelected={filters.status.includes("Stopped")}
1310
1314
  >
1311
1315
  Stopped
1312
1316
  </SelectOption>,
1313
- <SelectOption
1314
- hasCheckbox
1315
- key="statusDown"
1317
+ <SelectOption
1318
+ hasCheckbox
1319
+ key="statusDown"
1316
1320
  itemId="Down"
1317
1321
  isSelected={filters.status.includes("Down")}
1318
1322
  >
1319
1323
  Down
1320
1324
  </SelectOption>,
1321
- <SelectOption
1322
- hasCheckbox
1323
- key="statusDegraded"
1325
+ <SelectOption
1326
+ hasCheckbox
1327
+ key="statusDegraded"
1324
1328
  itemId="Degraded"
1325
1329
  isSelected={filters.status.includes("Degraded")}
1326
1330
  >
1327
1331
  Degraded
1328
1332
  </SelectOption>,
1329
- <SelectOption
1330
- hasCheckbox
1331
- key="statusMaint"
1333
+ <SelectOption
1334
+ hasCheckbox
1335
+ key="statusMaint"
1332
1336
  itemId="Needs Maintainence"
1333
1337
  isSelected={filters.status.includes("Needs Maintainence")}
1334
1338
  >
@@ -1429,7 +1433,7 @@ class FilterTableDemo extends React.Component {
1429
1433
  <Toolbar id="toolbar-with-chip-groups" clearAllFilters={this.onDelete} collapseListedFiltersBreakpoint="xl">
1430
1434
  <ToolbarContent>
1431
1435
  <ToolbarToggleGroup toggleIcon={<FilterIcon />} breakpoint="xl">
1432
- <ToolbarGroup
1436
+ <ToolbarGroup
1433
1437
  variant="filter-group"
1434
1438
  style={{
1435
1439
  lineHeight: '22px',
@@ -1770,7 +1774,9 @@ export const TableEmptyState: React.FunctionComponent = () => (
1770
1774
  titleText="No results found"
1771
1775
  headingLevel="h2"
1772
1776
  />
1773
- <EmptyStateBody>No results match this filter criteria. Clear all filters and try again.</EmptyStateBody>
1777
+ <EmptyStateBody>
1778
+ No results match this filter criteria. Clear all filters and try again.
1779
+ </EmptyStateBody>
1774
1780
  <EmptyStateFooter>
1775
1781
  <EmptyStateActions>
1776
1782
  <Button variant="link">Clear all filters</Button>
@@ -1,14 +1,5 @@
1
1
  import React from 'react';
2
- import {
3
- ActionsColumn,
4
- Table,
5
- Thead,
6
- Tr,
7
- Th,
8
- Tbody,
9
- Td,
10
- ExpandableRowContent
11
- } from '@patternfly/react-table';
2
+ import { ActionsColumn, Table, Thead, Tr, Th, Tbody, Td, ExpandableRowContent } from '@patternfly/react-table';
12
3
  import {
13
4
  Button,
14
5
  Card,
@@ -62,7 +53,7 @@ export const CompoundExpandable = () => {
62
53
  </Tr>
63
54
  </Thead>
64
55
  <Tbody>
65
- {items.map(item => (
56
+ {items.map((item) => (
66
57
  <Tr key={item.name}>
67
58
  <Td dataLabel={columnNames.description}>{item.description}</Td>
68
59
  <Td dataLabel={columnNames.date}>{item.date}</Td>
@@ -98,23 +89,27 @@ export const CompoundExpandable = () => {
98
89
  id="select-example"
99
90
  aria-label="Select Input"
100
91
  toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
101
- <MenuToggle
102
- ref={toggleRef}
103
- onClick={() => setIsSelectOpen(!isSelectOpen)}
104
- isExpanded={isSelectOpen}
105
- >
92
+ <MenuToggle ref={toggleRef} onClick={() => setIsSelectOpen(!isSelectOpen)} isExpanded={isSelectOpen}>
106
93
  <FilterIcon /> Status
107
94
  </MenuToggle>
108
95
  )}
109
96
  isOpen={isSelectOpen}
110
- onOpenChange={isOpen => setIsSelectOpen(isOpen)}
97
+ onOpenChange={(isOpen) => setIsSelectOpen(isOpen)}
111
98
  onSelect={() => setIsSelectOpen(!isSelectOpen)}
112
99
  >
113
100
  {[
114
- <SelectOption key={0} itemId="Debug">Debug</SelectOption>,
115
- <SelectOption key={1} itemId="Info">Info</SelectOption>,
116
- <SelectOption key={2} itemId="Warn">Warn</SelectOption>,
117
- <SelectOption key={3} itemId="Error">Error</SelectOption>
101
+ <SelectOption key={0} itemId="Debug">
102
+ Debug
103
+ </SelectOption>,
104
+ <SelectOption key={1} itemId="Info">
105
+ Info
106
+ </SelectOption>,
107
+ <SelectOption key={2} itemId="Warn">
108
+ Warn
109
+ </SelectOption>,
110
+ <SelectOption key={3} itemId="Error">
111
+ Error
112
+ </SelectOption>
118
113
  ]}
119
114
  </Select>
120
115
  </ToolbarItem>
@@ -253,7 +248,7 @@ export const CompoundExpandable = () => {
253
248
  <NestedItemsTable />
254
249
  ) : (
255
250
  <ExpandableRowContent>
256
- <div className="pf-u-m-md">
251
+ <div className="pf-v5-u-m-md">
257
252
  Expanded content for {repo.name}: {expandedCellKey} goes here!
258
253
  </div>
259
254
  </ExpandableRowContent>