@patternfly/react-table 5.0.0-alpha.37 → 5.0.0-alpha.39

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": "5.0.0-alpha.37",
3
+ "version": "5.0.0-alpha.39",
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",
@@ -39,7 +39,7 @@
39
39
  "subpaths": "node scripts/copySubpaths.js"
40
40
  },
41
41
  "dependencies": {
42
- "@patternfly/react-core": "^5.0.0-alpha.37",
42
+ "@patternfly/react-core": "^5.0.0-alpha.39",
43
43
  "@patternfly/react-icons": "^5.0.0-alpha.5",
44
44
  "@patternfly/react-styles": "^5.0.0-alpha.4",
45
45
  "@patternfly/react-tokens": "^5.0.0-alpha.4",
@@ -54,5 +54,5 @@
54
54
  "react": "^17 || ^18",
55
55
  "react-dom": "^17 || ^18"
56
56
  },
57
- "gitHead": "67f588da8b7b8858729deeb6472e63b88da4d3cc"
57
+ "gitHead": "628b8d06a7a1438eb2f6908ff559fe90ac9e973a"
58
58
  }
@@ -53,9 +53,12 @@ import FolderIcon from '@patternfly/react-icons/dist/esm/icons/folder-icon';
53
53
  import FolderOpenIcon from '@patternfly/react-icons/dist/esm/icons/folder-open-icon';
54
54
  import SortAmountDownIcon from '@patternfly/react-icons/dist/esm/icons/sort-amount-down-icon';
55
55
  import BlueprintIcon from '@patternfly/react-icons/dist/esm/icons/blueprint-icon';
56
+ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
56
57
 
57
58
  import { css } from '@patternfly/react-styles';
58
59
  import styles from '@patternfly/react-styles/css/components/Table/table';
60
+ import { Dropdown as DropdownNext, DropdownList } from '@patternfly/react-core/next';
61
+
59
62
 
60
63
  ## TableComposable examples
61
64
 
@@ -8,10 +8,11 @@ import {
8
8
  OverflowMenuGroup,
9
9
  OverflowMenuItem,
10
10
  OverflowMenuDropdownItem,
11
- Dropdown,
12
- KebabToggle
11
+ MenuToggle
13
12
  } from '@patternfly/react-core';
14
13
  import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
14
+ import { Dropdown as DropdownNext, DropdownList } from '@patternfly/react-core/next';
15
+ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
15
16
 
16
17
  interface Repository {
17
18
  name: string;
@@ -43,13 +44,13 @@ export const ComposableTableActions: React.FunctionComponent = () => {
43
44
  };
44
45
 
45
46
  const dropdownItems = [
46
- <OverflowMenuDropdownItem key="item1" isShared>
47
+ <OverflowMenuDropdownItem itemId={0} key="item1" isShared>
47
48
  Pimary
48
49
  </OverflowMenuDropdownItem>,
49
- <OverflowMenuDropdownItem key="item2" isShared>
50
+ <OverflowMenuDropdownItem itemId={1} key="item2" isShared>
50
51
  Secondary
51
52
  </OverflowMenuDropdownItem>,
52
- <OverflowMenuDropdownItem key="item3" isShared>
53
+ <OverflowMenuDropdownItem itemId={2} key="item3" isShared>
53
54
  Tertiary
54
55
  </OverflowMenuDropdownItem>
55
56
  ];
@@ -68,7 +69,7 @@ export const ComposableTableActions: React.FunctionComponent = () => {
68
69
  </Tr>
69
70
  </Thead>
70
71
  <Tbody>
71
- {repos.map(repo => (
72
+ {repos.map((repo) => (
72
73
  <Tr key={repo.name}>
73
74
  <Td dataLabel={columnNames.name}>{repo.name}</Td>
74
75
  <Td dataLabel={columnNames.branches}>{repo.branches}</Td>
@@ -91,22 +92,30 @@ export const ComposableTableActions: React.FunctionComponent = () => {
91
92
  </OverflowMenuGroup>
92
93
  </OverflowMenuContent>
93
94
  <OverflowMenuControl>
94
- <Dropdown
95
- position="right"
95
+ <DropdownNext
96
96
  onSelect={() =>
97
- setRepos(repos.map(r => (r.name !== repo.name ? r : { ...r, isMenuOpen: !r.isMenuOpen })))
97
+ setRepos(repos.map((r) => (r.name !== repo.name ? r : { ...r, isMenuOpen: !r.isMenuOpen })))
98
98
  }
99
- toggle={
100
- <KebabToggle
101
- onToggle={(_event, open) =>
102
- setRepos(repos.map(r => (r.name !== repo.name ? r : { ...r, isMenuOpen: open })))
99
+ toggle={(toggleRef) => (
100
+ <MenuToggle
101
+ ref={toggleRef}
102
+ variant="plain"
103
+ aria-label="Table actions overflow menu"
104
+ onClick={() =>
105
+ setRepos(repos.map((r) => (r.name !== repo.name ? r : { ...r, isMenuOpen: !r.isMenuOpen })))
103
106
  }
104
- />
105
- }
107
+ isExpanded={repo.isMenuOpen}
108
+ >
109
+ <EllipsisVIcon />
110
+ </MenuToggle>
111
+ )}
106
112
  isOpen={repo.isMenuOpen}
107
- isPlain
108
- dropdownItems={dropdownItems}
109
- />
113
+ onOpenChange={(isOpen) =>
114
+ setRepos(repos.map((r) => (r.name !== repo.name ? r : { ...r, isMenuOpen: isOpen })))
115
+ }
116
+ >
117
+ <DropdownList>{dropdownItems}</DropdownList>
118
+ </DropdownNext>
110
119
  </OverflowMenuControl>
111
120
  </OverflowMenu>
112
121
  </Td>
@@ -3,14 +3,7 @@ import { TableComposable, Thead, Tr, Th, Tbody, Td, ThProps } from '@patternfly/
3
3
  import {
4
4
  Toolbar,
5
5
  ToolbarContent,
6
- ToolbarItem,
7
- OptionsMenu,
8
- OptionsMenuItemGroup,
9
- OptionsMenuItem,
10
- OptionsMenuSeparator,
11
- OptionsMenuToggle
12
6
  } from '@patternfly/react-core';
13
- import SortAmountDownIcon from '@patternfly/react-icons/dist/esm/icons/sort-amount-down-icon';
14
7
 
15
8
  interface Repository {
16
9
  name: string;
@@ -45,7 +38,7 @@ export const ComposableTableSortableCustom: React.FunctionComponent = () => {
45
38
  const [activeSortDirection, setActiveSortDirection] = React.useState<'asc' | 'desc' | null>(null);
46
39
 
47
40
  // Sort dropdown expansion
48
- const [isSortDropdownOpen, setIsSortDropdownOpen] = React.useState(false);
41
+ // const [isSortDropdownOpen, setIsSortDropdownOpen] = React.useState(false);
49
42
 
50
43
  // Since OnSort specifies sorted columns by index, we need sortable values for our object by column index.
51
44
  // This example is trivial since our data objects just contain strings, but if the data was more complex
@@ -94,7 +87,7 @@ export const ComposableTableSortableCustom: React.FunctionComponent = () => {
94
87
  <React.Fragment>
95
88
  <Toolbar id="toolbar">
96
89
  <ToolbarContent>
97
- <ToolbarItem>
90
+ {/* <ToolbarItem> TODO: replace with select after #8073
98
91
  <OptionsMenu
99
92
  id="options-menu-multiple-options-example"
100
93
  menuItems={[
@@ -143,7 +136,7 @@ export const ComposableTableSortableCustom: React.FunctionComponent = () => {
143
136
  isPlain
144
137
  isGrouped
145
138
  />
146
- </ToolbarItem>
139
+ </ToolbarItem> */}
147
140
  </ToolbarContent>
148
141
  </Toolbar>
149
142
  <TableComposable aria-label="Sortable table custom toolbar">
@@ -3,14 +3,7 @@ import { TableProps, sortable, info, Table, TableBody, TableHeader } from '@patt
3
3
  import {
4
4
  Toolbar,
5
5
  ToolbarContent,
6
- ToolbarItem,
7
- OptionsMenu,
8
- OptionsMenuItemGroup,
9
- OptionsMenuItem,
10
- OptionsMenuSeparator,
11
- OptionsMenuToggle
12
6
  } from '@patternfly/react-core';
13
- import SortAmountDownIcon from '@patternfly/react-icons/dist/esm/icons/sort-amount-down-icon';
14
7
 
15
8
  interface Repository {
16
9
  name: string;
@@ -28,13 +21,13 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
28
21
  { name: 'p', branches: 'two', prs: 'b', workspaces: 'four', lastCommit: 'five' }
29
22
  ];
30
23
 
31
- const columnNames = {
32
- name: 'Repositories',
33
- branches: 'Branches',
34
- prs: 'Pull requests',
35
- workspaces: 'Workspaces',
36
- lastCommit: 'Last commit'
37
- };
24
+ // const columnNames = {
25
+ // name: 'Repositories',
26
+ // branches: 'Branches',
27
+ // prs: 'Pull requests',
28
+ // workspaces: 'Workspaces',
29
+ // lastCommit: 'Last commit'
30
+ // };
38
31
 
39
32
  // Index of the currently sorted column
40
33
  // Note: if you intend to make columns reorderable, you may instead want to use a non-numeric key
@@ -45,7 +38,7 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
45
38
  const [activeSortDirection, setActiveSortDirection] = React.useState<'asc' | 'desc' | null>(null);
46
39
 
47
40
  // Sort dropdown expansion
48
- const [isSortDropdownOpen, setIsSortDropdownOpen] = React.useState(false);
41
+ // const [isSortDropdownOpen, setIsSortDropdownOpen] = React.useState(false);
49
42
 
50
43
  // Since OnSort specifies sorted columns by index, we need sortable values for our object by column index.
51
44
  // This example is trivial since our data objects just contain strings, but if the data was more complex
@@ -116,7 +109,7 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
116
109
  <React.Fragment>
117
110
  <Toolbar id="toolbar">
118
111
  <ToolbarContent>
119
- <ToolbarItem>
112
+ {/* <ToolbarItem> TODO: replace with select after #8073
120
113
  <OptionsMenu
121
114
  id="options-menu-multiple-options-example"
122
115
  menuItems={[
@@ -165,7 +158,7 @@ export const LegacyTableSortableCustom: React.FunctionComponent = () => {
165
158
  isPlain
166
159
  isGrouped
167
160
  />
168
- </ToolbarItem>
161
+ </ToolbarItem> */}
169
162
  </ToolbarContent>
170
163
  </Toolbar>
171
164
  <Table
@@ -345,8 +345,6 @@ import {
345
345
  OverflowMenu,
346
346
  OverflowMenuGroup,
347
347
  OverflowMenuItem,
348
- OptionsMenu,
349
- OptionsMenuToggle,
350
348
  Pagination,
351
349
  PaginationVariant,
352
350
  Text,
@@ -1005,7 +1003,7 @@ class ColumnManagementAction extends React.Component {
1005
1003
  }
1006
1004
  />
1007
1005
  </OverflowMenuItem>
1008
- <OverflowMenuItem>
1006
+ {/*<OverflowMenuItem> TODO: replace with select after #8073
1009
1007
  <OptionsMenu
1010
1008
  id="page-layout-table-draggable-column-management-action-toolbar-top-options-menu-toggle"
1011
1009
  isPlain
@@ -1018,7 +1016,7 @@ class ColumnManagementAction extends React.Component {
1018
1016
  />
1019
1017
  }
1020
1018
  />
1021
- </OverflowMenuItem>
1019
+ </OverflowMenuItem> */}
1022
1020
  <OverflowMenuGroup groupType="button" isPersistent>
1023
1021
  <OverflowMenuItem>
1024
1022
  <Button variant="primary">Action</Button>
@@ -401,7 +401,7 @@ export const ColumnManagementAction = () => {
401
401
  }
402
402
  />
403
403
  </OverflowMenuItem>
404
- <OverflowMenuItem>
404
+ {/* <OverflowMenuItem> TODO: replace with select after #8073
405
405
  <OptionsMenu
406
406
  id="page-layout-table-column-management-action-toolbar-top-options-menu-toggle"
407
407
  isPlain
@@ -414,7 +414,7 @@ export const ColumnManagementAction = () => {
414
414
  />
415
415
  }
416
416
  />
417
- </OverflowMenuItem>
417
+ </OverflowMenuItem> */}
418
418
  <OverflowMenuGroup groupType="button" isPersistent>
419
419
  <OverflowMenuItem>
420
420
  <Button variant="primary">Action</Button>
@@ -8,16 +8,11 @@ import {
8
8
  ToolbarContent,
9
9
  ToolbarGroup,
10
10
  ToolbarItem,
11
- OptionsMenu,
12
- OptionsMenuToggle,
13
11
  Pagination,
14
12
  Text,
15
13
  TextContent,
16
14
  Dropdown,
17
15
  KebabToggle,
18
- OptionsMenuItem,
19
- OptionsMenuSeparator,
20
- OptionsMenuItemGroup,
21
16
  OverflowMenu,
22
17
  OverflowMenuContent,
23
18
  OverflowMenuControl,
@@ -28,7 +23,6 @@ import {
28
23
  } from '@patternfly/react-core';
29
24
  import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
30
25
  import { rows, columns } from '../../examples/Data.jsx';
31
- import SortAmountDownIcon from '@patternfly/react-icons/dist/esm/icons/sort-amount-down-icon';
32
26
  import CloneIcon from '@patternfly/react-icons/dist/esm/icons/clone-icon';
33
27
  import EditIcon from '@patternfly/react-icons/dist/esm/icons/edit-icon';
34
28
  import SyncIcon from '@patternfly/react-icons/dist/esm/icons/sync-icon';
@@ -129,7 +123,7 @@ export const ComposableTableSortable = () => {
129
123
  const tableToolbar = (
130
124
  <Toolbar id="sortable-toolbar">
131
125
  <ToolbarContent>
132
- <ToolbarItem visibility={{ md: 'hidden' }}>
126
+ {/* <ToolbarItem visibility={{ md: 'hidden' }}> TODO: replace with select after #8073
133
127
  <OptionsMenu
134
128
  id="options-menu-multiple-options-example"
135
129
  menuItems={[
@@ -179,7 +173,7 @@ export const ComposableTableSortable = () => {
179
173
  menuAppendTo="parent"
180
174
  isFlipEnabled
181
175
  />
182
- </ToolbarItem>
176
+ </ToolbarItem> */}
183
177
  <OverflowMenu breakpoint="lg">
184
178
  <OverflowMenuContent isPersistent>
185
179
  <OverflowMenuGroup isPersistent groupType="button">