@patternfly/react-table 5.0.0-alpha.5 → 5.0.0-alpha.51

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 (244) hide show
  1. package/CHANGELOG.md +596 -0
  2. package/components/index.d.ts +3 -0
  3. package/components/index.d.ts.map +1 -0
  4. package/components/index.js +3 -0
  5. package/components/index.js.map +1 -0
  6. package/deprecated/index.d.ts +2 -0
  7. package/deprecated/index.d.ts.map +1 -0
  8. package/deprecated/index.js +2 -0
  9. package/deprecated/index.js.map +1 -0
  10. package/dist/esm/components/Table/ActionsColumn.d.ts +13 -25
  11. package/dist/esm/components/Table/ActionsColumn.d.ts.map +1 -1
  12. package/dist/esm/components/Table/ActionsColumn.js +52 -59
  13. package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
  14. package/dist/esm/components/Table/EditableSelectInputCell.d.ts +1 -1
  15. package/dist/esm/components/Table/EditableSelectInputCell.d.ts.map +1 -1
  16. package/dist/esm/components/Table/Table.d.ts +8 -0
  17. package/dist/esm/components/Table/Table.d.ts.map +1 -1
  18. package/dist/esm/components/Table/Table.js +7 -5
  19. package/dist/esm/components/Table/Table.js.map +1 -1
  20. package/dist/esm/components/Table/TableText.d.ts.map +1 -1
  21. package/dist/esm/components/Table/TableText.js +3 -2
  22. package/dist/esm/components/Table/TableText.js.map +1 -1
  23. package/dist/esm/components/Table/TableTypes.d.ts +8 -2
  24. package/dist/esm/components/Table/TableTypes.d.ts.map +1 -1
  25. package/dist/esm/components/Table/TableTypes.js.map +1 -1
  26. package/dist/esm/components/Table/base/provider.d.ts +5 -5
  27. package/dist/esm/components/Table/base/types.d.ts +16 -7
  28. package/dist/esm/components/Table/base/types.d.ts.map +1 -1
  29. package/dist/esm/components/Table/base/types.js.map +1 -1
  30. package/dist/esm/components/Table/utils/decorators/cellActions.d.ts.map +1 -1
  31. package/dist/esm/components/Table/utils/decorators/cellActions.js +2 -2
  32. package/dist/esm/components/Table/utils/decorators/cellActions.js.map +1 -1
  33. package/dist/esm/components/Table/utils/decorators/headerCol.js.map +1 -1
  34. package/dist/esm/components/Table/utils/decorators/treeRow.js +1 -1
  35. package/dist/esm/components/Table/utils/decorators/treeRow.js.map +1 -1
  36. package/dist/esm/components/TableComposable/TableComposable.d.ts +3 -3
  37. package/dist/esm/components/TableComposable/TableComposable.d.ts.map +1 -1
  38. package/dist/esm/components/TableComposable/Tbody.d.ts +1 -1
  39. package/dist/esm/components/TableComposable/Tbody.d.ts.map +1 -1
  40. package/dist/esm/components/TableComposable/Td.d.ts +2 -2
  41. package/dist/esm/components/TableComposable/Td.d.ts.map +1 -1
  42. package/dist/esm/components/TableComposable/Td.js +5 -2
  43. package/dist/esm/components/TableComposable/Td.js.map +1 -1
  44. package/dist/esm/components/TableComposable/Th.d.ts +1 -1
  45. package/dist/esm/components/TableComposable/Th.d.ts.map +1 -1
  46. package/dist/esm/components/TableComposable/Th.js +4 -2
  47. package/dist/esm/components/TableComposable/Th.js.map +1 -1
  48. package/dist/esm/components/TableComposable/Thead.d.ts +1 -1
  49. package/dist/esm/components/TableComposable/Thead.d.ts.map +1 -1
  50. package/dist/esm/components/TableComposable/Tr.d.ts +2 -2
  51. package/dist/esm/components/TableComposable/Tr.d.ts.map +1 -1
  52. package/dist/esm/deprecated/components/Table/index.d.ts +2 -0
  53. package/dist/esm/deprecated/components/Table/index.d.ts.map +1 -0
  54. package/dist/esm/deprecated/components/Table/index.js +2 -0
  55. package/dist/esm/deprecated/components/Table/index.js.map +1 -0
  56. package/dist/js/components/Table/ActionsColumn.d.ts +13 -25
  57. package/dist/js/components/Table/ActionsColumn.d.ts.map +1 -1
  58. package/dist/js/components/Table/ActionsColumn.js +52 -60
  59. package/dist/js/components/Table/ActionsColumn.js.map +1 -1
  60. package/dist/js/components/Table/Body.js +1 -1
  61. package/dist/js/components/Table/Body.js.map +1 -1
  62. package/dist/js/components/Table/BodyWrapper.js +1 -1
  63. package/dist/js/components/Table/BodyWrapper.js.map +1 -1
  64. package/dist/js/components/Table/CollapseColumn.js +2 -2
  65. package/dist/js/components/Table/CollapseColumn.js.map +1 -1
  66. package/dist/js/components/Table/DraggableRowWrapper.js +1 -1
  67. package/dist/js/components/Table/DraggableRowWrapper.js.map +1 -1
  68. package/dist/js/components/Table/EditColumn.js +4 -4
  69. package/dist/js/components/Table/EditColumn.js.map +1 -1
  70. package/dist/js/components/Table/EditableSelectInputCell.d.ts +1 -1
  71. package/dist/js/components/Table/EditableSelectInputCell.d.ts.map +1 -1
  72. package/dist/js/components/Table/EditableSelectInputCell.js +1 -1
  73. package/dist/js/components/Table/EditableSelectInputCell.js.map +1 -1
  74. package/dist/js/components/Table/EditableTextCell.js +1 -1
  75. package/dist/js/components/Table/EditableTextCell.js.map +1 -1
  76. package/dist/js/components/Table/ExpandableRowContent.js +1 -1
  77. package/dist/js/components/Table/ExpandableRowContent.js.map +1 -1
  78. package/dist/js/components/Table/HeaderCellInfoWrapper.js +2 -2
  79. package/dist/js/components/Table/HeaderCellInfoWrapper.js.map +1 -1
  80. package/dist/js/components/Table/RowWrapper.js +2 -2
  81. package/dist/js/components/Table/RowWrapper.js.map +1 -1
  82. package/dist/js/components/Table/SortColumn.js +3 -3
  83. package/dist/js/components/Table/SortColumn.js.map +1 -1
  84. package/dist/js/components/Table/Table.d.ts +8 -0
  85. package/dist/js/components/Table/Table.d.ts.map +1 -1
  86. package/dist/js/components/Table/Table.js +12 -10
  87. package/dist/js/components/Table/Table.js.map +1 -1
  88. package/dist/js/components/Table/TableText.d.ts.map +1 -1
  89. package/dist/js/components/Table/TableText.js +3 -2
  90. package/dist/js/components/Table/TableText.js.map +1 -1
  91. package/dist/js/components/Table/TableTypes.d.ts +8 -2
  92. package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
  93. package/dist/js/components/Table/TableTypes.js +1 -2
  94. package/dist/js/components/Table/TableTypes.js.map +1 -1
  95. package/dist/js/components/Table/TreeRowWrapper.js +1 -1
  96. package/dist/js/components/Table/TreeRowWrapper.js.map +1 -1
  97. package/dist/js/components/Table/base/body-row.js +4 -4
  98. package/dist/js/components/Table/base/body-row.js.map +1 -1
  99. package/dist/js/components/Table/base/body.js +2 -2
  100. package/dist/js/components/Table/base/body.js.map +1 -1
  101. package/dist/js/components/Table/base/columns-are-equal.js +1 -1
  102. package/dist/js/components/Table/base/columns-are-equal.js.map +1 -1
  103. package/dist/js/components/Table/base/evaluate-transforms.js +1 -1
  104. package/dist/js/components/Table/base/evaluate-transforms.js.map +1 -1
  105. package/dist/js/components/Table/base/header-row.js +5 -5
  106. package/dist/js/components/Table/base/header-row.js.map +1 -1
  107. package/dist/js/components/Table/base/merge-props.js +3 -3
  108. package/dist/js/components/Table/base/merge-props.js.map +1 -1
  109. package/dist/js/components/Table/base/provider.d.ts +5 -5
  110. package/dist/js/components/Table/base/types.d.ts +16 -7
  111. package/dist/js/components/Table/base/types.d.ts.map +1 -1
  112. package/dist/js/components/Table/base/types.js +1 -0
  113. package/dist/js/components/Table/base/types.js.map +1 -1
  114. package/dist/js/components/Table/utils/decorators/cellActions.d.ts.map +1 -1
  115. package/dist/js/components/Table/utils/decorators/cellActions.js +3 -3
  116. package/dist/js/components/Table/utils/decorators/cellActions.js.map +1 -1
  117. package/dist/js/components/Table/utils/decorators/cellWidth.js +1 -1
  118. package/dist/js/components/Table/utils/decorators/cellWidth.js.map +1 -1
  119. package/dist/js/components/Table/utils/decorators/classNames.js +1 -1
  120. package/dist/js/components/Table/utils/decorators/classNames.js.map +1 -1
  121. package/dist/js/components/Table/utils/decorators/collapsible.js +2 -2
  122. package/dist/js/components/Table/utils/decorators/collapsible.js.map +1 -1
  123. package/dist/js/components/Table/utils/decorators/compoundExpand.js +2 -2
  124. package/dist/js/components/Table/utils/decorators/compoundExpand.js.map +1 -1
  125. package/dist/js/components/Table/utils/decorators/favoritable.js +1 -1
  126. package/dist/js/components/Table/utils/decorators/favoritable.js.map +1 -1
  127. package/dist/js/components/Table/utils/decorators/headerCol.js.map +1 -1
  128. package/dist/js/components/Table/utils/decorators/selectable.js +1 -1
  129. package/dist/js/components/Table/utils/decorators/selectable.js.map +1 -1
  130. package/dist/js/components/Table/utils/decorators/sortable.js +2 -2
  131. package/dist/js/components/Table/utils/decorators/sortable.js.map +1 -1
  132. package/dist/js/components/Table/utils/decorators/treeRow.js +9 -9
  133. package/dist/js/components/Table/utils/decorators/treeRow.js.map +1 -1
  134. package/dist/js/components/Table/utils/headerUtils.js +4 -4
  135. package/dist/js/components/Table/utils/headerUtils.js.map +1 -1
  136. package/dist/js/components/Table/utils/utils.js +1 -1
  137. package/dist/js/components/Table/utils/utils.js.map +1 -1
  138. package/dist/js/components/TableComposable/InnerScrollContainer.js +1 -1
  139. package/dist/js/components/TableComposable/InnerScrollContainer.js.map +1 -1
  140. package/dist/js/components/TableComposable/OuterScrollContainer.js +1 -1
  141. package/dist/js/components/TableComposable/OuterScrollContainer.js.map +1 -1
  142. package/dist/js/components/TableComposable/TableComposable.d.ts +3 -3
  143. package/dist/js/components/TableComposable/TableComposable.d.ts.map +1 -1
  144. package/dist/js/components/TableComposable/TableComposable.js +6 -6
  145. package/dist/js/components/TableComposable/TableComposable.js.map +1 -1
  146. package/dist/js/components/TableComposable/Tbody.d.ts +1 -1
  147. package/dist/js/components/TableComposable/Tbody.d.ts.map +1 -1
  148. package/dist/js/components/TableComposable/Tbody.js +1 -1
  149. package/dist/js/components/TableComposable/Tbody.js.map +1 -1
  150. package/dist/js/components/TableComposable/Td.d.ts +2 -2
  151. package/dist/js/components/TableComposable/Td.d.ts.map +1 -1
  152. package/dist/js/components/TableComposable/Td.js +15 -12
  153. package/dist/js/components/TableComposable/Td.js.map +1 -1
  154. package/dist/js/components/TableComposable/Th.d.ts +1 -1
  155. package/dist/js/components/TableComposable/Th.d.ts.map +1 -1
  156. package/dist/js/components/TableComposable/Th.js +12 -10
  157. package/dist/js/components/TableComposable/Th.js.map +1 -1
  158. package/dist/js/components/TableComposable/Thead.d.ts +1 -1
  159. package/dist/js/components/TableComposable/Thead.d.ts.map +1 -1
  160. package/dist/js/components/TableComposable/Thead.js +1 -1
  161. package/dist/js/components/TableComposable/Thead.js.map +1 -1
  162. package/dist/js/components/TableComposable/Tr.d.ts +2 -2
  163. package/dist/js/components/TableComposable/Tr.d.ts.map +1 -1
  164. package/dist/js/components/TableComposable/Tr.js +2 -2
  165. package/dist/js/components/TableComposable/Tr.js.map +1 -1
  166. package/dist/js/deprecated/components/Table/index.d.ts +2 -0
  167. package/dist/js/deprecated/components/Table/index.d.ts.map +1 -0
  168. package/dist/js/deprecated/components/Table/index.js +5 -0
  169. package/dist/js/deprecated/components/Table/index.js.map +1 -0
  170. package/dist/umd/react-table.min.js +5 -49
  171. package/package.json +10 -10
  172. package/scripts/createSubpaths.js +32 -0
  173. package/src/components/Table/ActionsColumn.tsx +110 -98
  174. package/src/components/Table/EditableSelectInputCell.tsx +1 -1
  175. package/src/components/Table/Table.tsx +15 -7
  176. package/src/components/Table/TableText.tsx +3 -1
  177. package/src/components/Table/TableTypes.tsx +8 -5
  178. package/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +38 -95
  179. package/src/components/Table/base/types.tsx +11 -9
  180. package/src/components/Table/utils/decorators/cellActions.tsx +2 -3
  181. package/src/components/Table/utils/decorators/headerCol.tsx +1 -1
  182. package/src/components/Table/utils/decorators/treeRow.tsx +1 -1
  183. package/src/components/Table/utils/transformers.test.tsx +3 -3
  184. package/src/components/TableComposable/TableComposable.tsx +2 -2
  185. package/src/components/TableComposable/Tbody.tsx +1 -1
  186. package/src/components/TableComposable/Td.tsx +7 -4
  187. package/src/components/TableComposable/Th.tsx +4 -3
  188. package/src/components/TableComposable/Thead.tsx +1 -1
  189. package/src/components/TableComposable/Tr.tsx +1 -1
  190. package/src/components/TableComposable/examples/{ComposableTable.md → Table.md} +70 -76
  191. package/src/components/TableComposable/examples/{ComposableTableActions.tsx → TableActions.tsx} +6 -6
  192. package/src/components/TableComposable/examples/{ComposableTableActionsOverflow.tsx → TableActionsOverflow.tsx} +27 -17
  193. package/src/components/TableComposable/examples/{ComposableTableBasic.tsx → TableBasic.tsx} +2 -2
  194. package/src/components/TableComposable/examples/{ComposableTableCellWidth.tsx → TableCellWidth.tsx} +1 -1
  195. package/src/components/TableComposable/examples/{ComposableTableCompoundExpandable.tsx → TableCompoundExpandable.tsx} +2 -2
  196. package/src/components/TableComposable/examples/{ComposableTableControllingText.tsx → TableControllingText.tsx} +1 -1
  197. package/src/components/TableComposable/examples/{ComposableTableDraggable.tsx → TableDraggable.tsx} +1 -1
  198. package/src/components/TableComposable/examples/{ComposableTableEmptyState.tsx → TableEmptyState.tsx} +16 -9
  199. package/src/components/TableComposable/examples/{ComposableTableExpandable.tsx → TableExpandable.tsx} +2 -2
  200. package/src/components/TableComposable/examples/{ComposableTableFavoritable.tsx → TableFavoritable.tsx} +3 -3
  201. package/src/components/TableComposable/examples/{ComposableTableHoverable.tsx → TableHoverable.tsx} +1 -1
  202. package/src/components/TableComposable/examples/{ComposableTableMisc.tsx → TableMisc.tsx} +1 -1
  203. package/src/components/TableComposable/examples/{ComposableTableMultipleStickyColumns.tsx → TableMultipleStickyColumns.tsx} +1 -1
  204. package/src/components/TableComposable/examples/{ComposableTableNestedExpandable.tsx → TableNestedExpandable.tsx} +1 -1
  205. package/src/components/TableComposable/examples/{ComposableTableNestedHeaders.tsx → TableNestedHeaders.tsx} +1 -1
  206. package/src/components/TableComposable/examples/{ComposableTableNestedStickyHeader.tsx → TableNestedStickyHeader.tsx} +1 -1
  207. package/src/components/TableComposable/examples/{ComposableTableNestedTableExpandable.tsx → TableNestedTableExpandable.tsx} +1 -1
  208. package/src/components/TableComposable/examples/{ComposableTableSelectable.tsx → TableSelectable.tsx} +1 -1
  209. package/src/components/TableComposable/examples/{ComposableTableSelectableRadio.tsx → TableSelectableRadio.tsx} +1 -1
  210. package/src/components/TableComposable/examples/{ComposableTableSortable.tsx → TableSortable.tsx} +1 -1
  211. package/src/components/TableComposable/examples/{ComposableTableSortableCustom.tsx → TableSortableCustom.tsx} +4 -11
  212. package/src/components/TableComposable/examples/{ComposableTableStickyColumn.tsx → TableStickyColumn.tsx} +1 -1
  213. package/src/components/TableComposable/examples/{ComposableTableStickyColumnsAndHeader.tsx → TableStickyColumnsAndHeader.tsx} +1 -1
  214. package/src/components/TableComposable/examples/{ComposableTableStriped.tsx → TableStriped.tsx} +1 -1
  215. package/src/components/TableComposable/examples/{ComposableTableStripedExpandable.tsx → TableStripedExpandable.tsx} +2 -2
  216. package/src/components/TableComposable/examples/{ComposableTableStripedMultipleTbody.tsx → TableStripedMultipleTbody.tsx} +1 -1
  217. package/src/components/TableComposable/examples/{ComposableTableStripedTr.tsx → TableStripedTr.tsx} +1 -1
  218. package/src/components/TableComposable/examples/{ComposableTableTextModifiers.tsx → TableTextModifiers.tsx} +1 -1
  219. package/src/components/TableComposable/examples/{ComposableTableTree.tsx → TableTree.tsx} +13 -3
  220. package/src/{components → deprecated/components}/Table/examples/LegacyTableActions.tsx +5 -5
  221. package/src/{components → deprecated/components}/Table/examples/LegacyTableEmptyState.tsx +15 -8
  222. package/src/{components → deprecated/components}/Table/examples/LegacyTableExpandable.tsx +1 -1
  223. package/src/{components → deprecated/components}/Table/examples/LegacyTableFavoritable.tsx +1 -1
  224. package/src/{components → deprecated/components}/Table/examples/LegacyTableSelectable.tsx +1 -1
  225. package/src/{components → deprecated/components}/Table/examples/LegacyTableSortableCustom.tsx +10 -17
  226. package/src/{components → deprecated/components}/Table/examples/LegacyTableStripedExpandable.tsx +1 -1
  227. package/src/{components → deprecated/components}/Table/examples/Table.md +4 -8
  228. package/src/deprecated/components/Table/index.ts +1 -0
  229. package/src/docs/demos/Table.md +137 -122
  230. package/src/docs/demos/table-demos/ColumnManagement.jsx +14 -12
  231. package/src/docs/demos/table-demos/SortableResponsive.jsx +23 -18
  232. package/scripts/copySubpaths.js +0 -12
  233. /package/src/{components → deprecated/components}/Table/examples/LegacyTableBasic.tsx +0 -0
  234. /package/src/{components → deprecated/components}/Table/examples/LegacyTableCellWidth.tsx +0 -0
  235. /package/src/{components → deprecated/components}/Table/examples/LegacyTableCompoundExpandable.tsx +0 -0
  236. /package/src/{components → deprecated/components}/Table/examples/LegacyTableControllingText.tsx +0 -0
  237. /package/src/{components → deprecated/components}/Table/examples/LegacyTableHoverable.tsx +0 -0
  238. /package/src/{components → deprecated/components}/Table/examples/LegacyTableMisc.tsx +0 -0
  239. /package/src/{components → deprecated/components}/Table/examples/LegacyTableSelectableRadio.tsx +0 -0
  240. /package/src/{components → deprecated/components}/Table/examples/LegacyTableSortable.tsx +0 -0
  241. /package/src/{components → deprecated/components}/Table/examples/LegacyTableStriped.tsx +0 -0
  242. /package/src/{components → deprecated/components}/Table/examples/LegacyTableStripedCustomTr.tsx +0 -0
  243. /package/src/{components → deprecated/components}/Table/examples/LegacyTableTextModifiers.tsx +0 -0
  244. /package/src/{components → deprecated/components}/Table/examples/LegacyTableTree.tsx +0 -0
@@ -16,6 +16,7 @@ propComponents:
16
16
  'TdSelectType',
17
17
  'ThSelectType',
18
18
  'TdTreeRowType',
19
+ 'ActionsColumn',
19
20
  'IActions',
20
21
  'TdCompoundExpandType',
21
22
  'TdFavoritesType',
@@ -30,22 +31,18 @@ propComponents:
30
31
  'ThSortType',
31
32
  'ISortBy',
32
33
  'InnerScrollContainer',
33
- 'OuterScrollContainer',
34
+ 'OuterScrollContainer'
34
35
  ]
35
36
  ouia: true
36
37
  ---
37
38
 
38
- # Table Composable
39
+ # Table
39
40
 
40
41
  Note: Table lives in its own package at [@patternfly/react-table](https://www.npmjs.com/package/@patternfly/react-table)!
41
42
 
42
- PatternFly has two implementations of a React table.
43
+ The `TableComposable` component takes an explicit and declarative approach, and its implementation closely mirrors that of an HTML table.
43
44
 
44
- The first is the newer `TableComposable` component. It takes a more explicit and declarative approach, and its implementation more closely mirrors that of an HTML table. Generally, updates and new feature requests are implemented in the `TableComposable`.
45
-
46
- The second is the original `Table` component. It is configuration based and takes a less declarative and more implicit approach about laying out the table structure, such as the rows and cells within it. The documentation for the older table implementation can be found under the [React legacy](/components/table/react-legacy) tab.
47
-
48
- **For most common use cases, we recommend using `TableComposable`. Both implementations are supported and fully maintained.**
45
+ The documentation for the deprecated table implementation can be found under the [React deprecated](/components/table/react-deprecated) tab. It is configuration based and takes a less declarative and more implicit approach to laying out the table structure, such as the rows and cells within it.
49
46
 
50
47
  import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
51
48
  import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
@@ -56,13 +53,14 @@ import FolderIcon from '@patternfly/react-icons/dist/esm/icons/folder-icon';
56
53
  import FolderOpenIcon from '@patternfly/react-icons/dist/esm/icons/folder-open-icon';
57
54
  import SortAmountDownIcon from '@patternfly/react-icons/dist/esm/icons/sort-amount-down-icon';
58
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';
59
57
 
60
58
  import { css } from '@patternfly/react-styles';
61
59
  import styles from '@patternfly/react-styles/css/components/Table/table';
62
60
 
63
- ## TableComposable examples
61
+ ## Table examples
64
62
 
65
- The `TableComposable` component differs from the regular `Table` component, in that it allows you to compose the table by nesting the relevant `Thead`, `Tbody`, `Tr`, `Th` and `Td` components within it. For a less declarative and more implicit approach, use the `Table` component instead.
63
+ This `TableComposable` component differs from the deprecated `Table` component, in that it allows you to compose the table by nesting the relevant `Thead`, `Tbody`, `Tr`, `Th` and `Td` components within it. For a less declarative and more implicit approach, use the `Table` component instead.
66
64
 
67
65
  Some general notes:
68
66
 
@@ -70,12 +68,12 @@ Some general notes:
70
68
  - If you want a table caption, simply place a `<Caption>My caption</Caption>` as the first child within a `TableComposable`.
71
69
  - You can set the `TableComposable` variant to `compact`
72
70
 
73
- ### Composable: Basic
71
+ ### Basic
74
72
 
75
- ```ts file="ComposableTableBasic.tsx"
73
+ ```ts file="TableBasic.tsx"
76
74
  ```
77
75
 
78
- ### Composable: Custom row wrapper, header tooltips & popovers
76
+ ### Custom row wrapper, header tooltips & popovers
79
77
 
80
78
  - If you add the `noWrap` prop to `Thead`, it won't wrap it if there is no space
81
79
  - You can add the `textCenter` prop to `Th` or `Td` to center the contents
@@ -83,10 +81,10 @@ Some general notes:
83
81
 
84
82
  To add a header tooltip or popover to `Th`, pass a `ThInfoType` object via the `info` prop.
85
83
 
86
- ```ts file="ComposableTableMisc.tsx"
84
+ ```ts file="TableMisc.tsx"
87
85
  ```
88
86
 
89
- ### Composable: Sortable & wrapping headers
87
+ ### Sortable & wrapping headers
90
88
 
91
89
  To make a column sortable, pass a `ThSortType` object via the `sort` prop on a column's `Th`.
92
90
 
@@ -104,17 +102,17 @@ type OnSort = (
104
102
 
105
103
  The built in display for sorting is not fully responsive, as the column headers will be displayed per row when the screen size is small. To see a full page demo of a responsive sortable table, utilizing a toolbar item to control sorting for small screens, view the `Sortable - responsive` demo in the `React demos` tab.
106
104
 
107
- ```ts file="ComposableTableSortable.tsx"
105
+ ```ts file="TableSortable.tsx"
108
106
  ```
109
107
 
110
- ### Composable: Sortable - custom control
108
+ ### Sortable - custom control
111
109
 
112
110
  Sorting a table may also be controlled manually with a toolbar control. To see a full page demo of a responsive table, view the `Sortable - responsive` demo in the `React demos` tab.
113
111
 
114
- ```ts file="ComposableTableSortableCustom.tsx"
112
+ ```ts file="TableSortableCustom.tsx"
115
113
  ```
116
114
 
117
- ### Composable: Selectable with checkbox
115
+ ### Selectable with checkbox
118
116
 
119
117
  To make a row selectable, the table needs a selection column.
120
118
  The selection column is just another column, but with selection specific props added.
@@ -141,40 +139,42 @@ type OnSelect = (
141
139
  **Note:** This example has a `shift + select` feature where holding shift while
142
140
  checking checkboxes will check intermediate rows' checkboxes.
143
141
 
144
- ```ts file="ComposableTableSelectable.tsx"
142
+ ```ts file="TableSelectable.tsx"
145
143
  ```
146
144
 
147
- ### Composable: Selectable radio input
145
+ ### Selectable radio input
148
146
 
149
147
  Similarly to the selectable example above, the radio buttons use the first column. The first header cell is empty, and each body row's first cell has radio button props.
150
148
 
151
- ```ts file="ComposableTableSelectableRadio.tsx"
149
+ ```ts file="TableSelectableRadio.tsx"
152
150
  ```
153
151
 
154
- ### Composable: Row click handler, hoverable & selected rows
152
+ ### Row click handler, hoverable & selected rows
155
153
 
156
154
  This selectable rows feature is intended for use when a table is used to present a list of objects in a Primary-detail view.
157
155
 
158
- ```ts file="ComposableTableHoverable.tsx"
156
+ ```ts file="TableHoverable.tsx"
159
157
  ```
160
158
 
161
- ### Composable: Actions
159
+ ### Actions
162
160
 
163
161
  This example demonstrates adding actions as the last column. The header's last cell is an empty cell, and each body row's last cell is an action cell.
164
162
 
165
163
  To make a cell an action cell, render an `ActionsColumn` component inside a row's last `Td` and pass an array of `IAction` objects via the `items` prop of `ActionsColumn`.
166
164
 
167
- ```ts file="ComposableTableActions.tsx"
165
+ If actions menus are getting clipped by other items on the page, such as sticky columns or rows, the `ActionsColumn` can be passed a `menuAppendTo` prop to adjust where the actions menu is appended.
166
+
167
+ ```ts file="TableActions.tsx"
168
168
  ```
169
169
 
170
- ### Composable: Actions Overflow
170
+ ### Actions Overflow
171
171
 
172
172
  Useing an `OverflowMenu` in the actions column, allowing the actions to condense into a dropdown if necessary for space.
173
173
 
174
- ```ts file="ComposableTableActionsOverflow.tsx"
174
+ ```ts file="TableActionsOverflow.tsx"
175
175
  ```
176
176
 
177
- ### Composable: Expandable
177
+ ### Expandable
178
178
 
179
179
  To make a parent/child row pair expandable:
180
180
 
@@ -196,10 +196,10 @@ type OnCollapse = (
196
196
 
197
197
  Note: Table column widths will respond automatically when toggling expanded rows. To retain column widths between expanded and collapsed states, column header and/or data cell widths must be set.
198
198
 
199
- ```ts file="ComposableTableExpandable.tsx"
199
+ ```ts file="TableExpandable.tsx"
200
200
  ```
201
201
 
202
- ### Composable: Compound expandable
202
+ ### Compound expandable
203
203
 
204
204
  To make a parent/child row pair compound expandable:
205
205
 
@@ -220,32 +220,30 @@ export type OnExpand = (
220
220
  ) => void;
221
221
  ```
222
222
 
223
- ```ts file="ComposableTableCompoundExpandable.tsx"
223
+ ```ts file="TableCompoundExpandable.tsx"
224
224
  ```
225
225
 
226
- ### Composable: Cell width, breakpoint modifiers
226
+ ### Cell width, breakpoint modifiers
227
227
 
228
- ```ts file="ComposableTableCellWidth.tsx"
228
+ ```ts file="TableCellWidth.tsx"
229
229
  ```
230
230
 
231
- ### Composable: Controlling text
231
+ ### Controlling text
232
232
 
233
- ```ts file="ComposableTableControllingText.tsx"
233
+ ```ts file="TableControllingText.tsx"
234
234
  ```
235
235
 
236
- #### TODO: distinguish between the use cases for modifier on Td vs on TableText?
236
+ ### Modifiers with table text
237
237
 
238
- ### Composable: Modifiers with table text
239
-
240
- ```ts file="ComposableTableTextModifiers.tsx"
238
+ ```ts file="TableTextModifiers.tsx"
241
239
  ```
242
240
 
243
- ### Composable: Empty state
241
+ ### Empty state
244
242
 
245
- ```ts file="ComposableTableEmptyState.tsx"
243
+ ```ts file="TableEmptyState.tsx"
246
244
  ```
247
245
 
248
- ### Composable: Favoritable (implemented with sortable)
246
+ ### Favoritable (implemented with sortable)
249
247
 
250
248
  To make a row favoritable, the table needs a favoritable column.
251
249
  Pass a `TdFavoritesType` object via the `favorites` prop on each rows's first `Td` in the favoritable column.
@@ -264,10 +262,10 @@ type OnFavorite = (
264
262
 
265
263
  To make a favoritable column sortable, pass a `ThSortType` object to the favoritable column's `Th` with `isFavorites` set to true.
266
264
 
267
- ```ts file="ComposableTableFavoritable.tsx"
265
+ ```ts file="TableFavoritable.tsx"
268
266
  ```
269
267
 
270
- ### Composable: Tree table
268
+ ### Tree table
271
269
 
272
270
  To enable a tree table:
273
271
 
@@ -297,23 +295,23 @@ Note: If this table is going to be tested using axe-core, the tests will flag th
297
295
  aria-posinset, and aria-setsize as violations. This is an intentional choice at this time so that
298
296
  the voice over technologies will recognize the flat table structure as a tree.
299
297
 
300
- ```ts file="ComposableTableTree.tsx"
298
+ ```ts file="TableTree.tsx"
301
299
  ```
302
300
 
303
- ### Composable: Draggable row table
301
+ ### Draggable row table
304
302
 
305
303
  To make a row draggable:
306
304
 
307
305
  1. The table needs a draggable column.
308
306
  2. Each draggable `Tr` needs to be passed `draggable`, `onDrop`, `onDragEnd`, and `onDragStart` props.
309
307
  3. The `Tbody` needs `onDragOver`, `onDrop`, and `onDragLeave` props.
310
- 4. While the user is dragging a row, the `` class needs to be applied to `TableComposable`.
308
+ 4. While the user is dragging a row, the `pf-m-drag-over` class needs to be applied to `TableComposable`.
311
309
  5. The draggable `Td` in each row needs a `TdDraggableType` object passed to its `draggable` prop.
312
310
 
313
- ```ts isBeta file="ComposableTableDraggable.tsx"
311
+ ```ts isBeta file="TableDraggable.tsx"
314
312
  ```
315
313
 
316
- ## Sticky table modifiers
314
+ ### Sticky table modifiers
317
315
 
318
316
  To make certain columns and the header sticky, the table must be wrapped in a combination of `OuterScrollContainer` and `InnerScrollContainer`. For sticky columns, only `InnerScrollContainer` is required. For sticky headers, and sticky headers with sticky columns, both containers are required to ensure the sticky behavior behaves correctly.
319
317
 
@@ -325,28 +323,28 @@ There are a few ways this can be handled:
325
323
  - Use the `menuAppendTo` prop in non-composable react components with menus to append the menu to an element outside of the table (e.g., the table's parent element) so that the menu has a higher stacking context than - and can appear on top of - sticky headers/columns as well as appear outside of any scrollable content in the table.
326
324
  - In the case where the menu is outside of the table (e.g., above the table in a toolbar, or below the table and the menu expands up), assign the entire table a lower `z-index` than the `z-index` of the menu. This creates a lower stacking context for the entire table compared to the menu, while preserving the stacking context of the elements inside of the table.
327
325
 
328
- ### Composable: Sticky column
326
+ ### Sticky column
329
327
 
330
328
  To make a column sticky, wrap `TableComposable` with `InnerScrollContainer` and add the following properties to the `Th` or `Td` that should be sticky: `isStickyColumn` and `hasRightBorder`. To prevent the default text wrapping behavior and allow horizontal scrolling, all `Th` or `Td` cells should also have the `modifier="nowrap"` property. To set the minimum width of the sticky column, use the `stickyMinWidth` property.
331
329
 
332
- ```ts file="ComposableTableStickyColumn.tsx"
330
+ ```ts file="TableStickyColumn.tsx"
333
331
  ```
334
332
 
335
- ### Composable: Multiple sticky columns
333
+ ### Multiple sticky columns
336
334
 
337
335
  To make multiple columns sticky, wrap `TableComposable` with `InnerScrollContainer` and add `isStickyColumn` to all columns that should be sticky. The rightmost column should also have the `hasRightBorder` property, and each sticky column after the first must define a `stickyLeftOffset` property that equals the combined width of the previous sticky columns - set by `stickyMinWidth`. To prevent the default text wrapping behavior and allow horizontal scrolling, all `Th` or `Td` cells should also have the `modifier="nowrap"` property.
338
336
 
339
- ```ts file="ComposableTableMultipleStickyColumns.tsx"
337
+ ```ts file="TableMultipleStickyColumns.tsx"
340
338
  ```
341
339
 
342
- ### Composable: Sticky columns and header
340
+ ### Sticky columns and header
343
341
 
344
342
  To maintain proper sticky behavior across sticky columns and header, `TableComposable` must be wrapped with `OuterScrollContainer` and `InnerScrollContainer`.
345
343
 
346
- ```ts file="ComposableTableStickyColumnsAndHeader.tsx"
344
+ ```ts file="TableStickyColumnsAndHeader.tsx"
347
345
  ```
348
346
 
349
- ## Nested column headers
347
+ ### Nested column headers
350
348
 
351
349
  To make a nested column header:
352
350
 
@@ -359,52 +357,48 @@ The first `Tr` represents the top level of columns, and each must pass either `r
359
357
 
360
358
  The second `Tr` represents the second level of sub columns. The `Th` in this row each should pass `isSubHeader`, and the last sub column of a column should also pass `hasRightBorder`.
361
359
 
362
- ### Composable: Nested column headers
363
-
364
- ```ts file="ComposableTableNestedHeaders.tsx"
360
+ ```ts file="TableNestedHeaders.tsx"
365
361
  ```
366
362
 
367
- ### Composable: Nested column headers and expandable rows
363
+ ### Nested column headers and expandable rows
368
364
 
369
- ```ts file="ComposableTableNestedExpandable.tsx"
365
+ ```ts file="TableNestedExpandable.tsx"
370
366
  ```
371
367
 
372
- ### Composable: Expandable with nested table
368
+ ### Expandable with nested table
373
369
 
374
- ```ts file="ComposableTableNestedTableExpandable.tsx"
370
+ ```ts file="TableNestedTableExpandable.tsx"
375
371
  ```
376
372
 
377
- ### Composable: Nested sticky header
373
+ ### Nested sticky header
378
374
 
379
- ```ts file="ComposableTableNestedStickyHeader.tsx"
375
+ ```ts file="TableNestedStickyHeader.tsx"
380
376
  ```
381
377
 
382
- ## Striped
383
-
384
- ### Composable: Striped
378
+ ### Striped
385
379
 
386
380
  To apply striping to a basic table, add the `isStriped` property to `TableComposable`.
387
381
 
388
- ```ts file="ComposableTableStriped.tsx"
382
+ ```ts file="TableStriped.tsx"
389
383
  ```
390
384
 
391
- ### Composable: Striped expandable
385
+ ### Striped expandable
392
386
 
393
387
  To apply striping to an expandable table, add the `isStriped` and `isExpandable` properties to `TableComposable`.
394
388
 
395
- ```ts file="ComposableTableStripedExpandable.tsx"
389
+ ```ts file="TableStripedExpandable.tsx"
396
390
  ```
397
391
 
398
- ### Composable: Striped multiple tobdy
392
+ ### Striped multiple tobdy
399
393
 
400
394
  When there are multiple `Tbody` components within a table, a more granular application of striping may be controlled by adding either the `isEvenStriped` or `isOddStriped` properties to `Tbody`. These properties will stripe even or odd rows within that `Tbody` respectively.
401
395
 
402
- ```ts file="ComposableTableStripedMultipleTbody.tsx"
396
+ ```ts file="TableStripedMultipleTbody.tsx"
403
397
  ```
404
398
 
405
- ### Composable: Striped tr
399
+ ### Striped tr
406
400
 
407
401
  To manually control striping, add the `isStriped` property to each desired `Tr`. This replaces adding the `isStriped` property to `TableComposable`.
408
402
 
409
- ```ts file="ComposableTableStripedTr.tsx"
403
+ ```ts file="TableStripedTr.tsx"
410
404
  ```
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-console */
2
2
  import React from 'react';
3
- import { Button, DropdownToggle, ToggleGroup, ToggleGroupItem, ToggleGroupItemProps } from '@patternfly/react-core';
3
+ import { Button, MenuToggle, ToggleGroup, ToggleGroupItem, ToggleGroupItemProps } from '@patternfly/react-core';
4
4
  import {
5
5
  TableComposable,
6
6
  TableText,
@@ -25,7 +25,7 @@ interface Repository {
25
25
 
26
26
  type ExampleType = 'defaultToggle' | 'customToggle';
27
27
 
28
- export const ComposableTableActions: React.FunctionComponent = () => {
28
+ export const TableActions: React.FunctionComponent = () => {
29
29
  // In real usage, this data would come from some external source like an API via props.
30
30
  const repositories: Repository[] = [
31
31
  { name: 'one', branches: 'two', prs: 'a', workspaces: 'four', lastCommit: 'five', singleAction: 'Start' },
@@ -44,7 +44,7 @@ export const ComposableTableActions: React.FunctionComponent = () => {
44
44
  singleAction: 'Single action'
45
45
  };
46
46
 
47
- // This state is just for the ToggleGroup in this example and isn't necessary for TableComposable usage.
47
+ // This state is just for the ToggleGroup in this example and isn't necessary for Table usage.
48
48
  const [exampleChoice, setExampleChoice] = React.useState<ExampleType>('defaultToggle');
49
49
  const onExampleTypeChange: ToggleGroupItemProps['onChange'] = (_isSelected, event) => {
50
50
  const id = event.currentTarget.id;
@@ -52,9 +52,9 @@ export const ComposableTableActions: React.FunctionComponent = () => {
52
52
  };
53
53
 
54
54
  const customActionsToggle = (props: CustomActionsToggleProps) => (
55
- <DropdownToggle onToggle={props.onToggle} isDisabled={props.isDisabled}>
55
+ <MenuToggle ref={props.toggleRef} onClick={props.onToggle} isDisabled={props.isDisabled}>
56
56
  Actions
57
- </DropdownToggle>
57
+ </MenuToggle>
58
58
  );
59
59
 
60
60
  const defaultActions = (repo: Repository): IAction[] => [
@@ -130,7 +130,7 @@ export const ComposableTableActions: React.FunctionComponent = () => {
130
130
  if (repo.name === '5') {
131
131
  rowActions = lastRowActions(repo);
132
132
  }
133
- let singleActionButton = null;
133
+ let singleActionButton: React.ReactNode = null;
134
134
  if (repo.singleAction !== '') {
135
135
  singleActionButton = (
136
136
  <TableText>
@@ -8,10 +8,12 @@ import {
8
8
  OverflowMenuGroup,
9
9
  OverflowMenuItem,
10
10
  OverflowMenuDropdownItem,
11
+ MenuToggle,
11
12
  Dropdown,
12
- KebabToggle
13
+ DropdownList
13
14
  } from '@patternfly/react-core';
14
15
  import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
16
+ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
15
17
 
16
18
  interface Repository {
17
19
  name: string;
@@ -22,7 +24,7 @@ interface Repository {
22
24
  isMenuOpen: boolean;
23
25
  }
24
26
 
25
- export const ComposableTableActions: React.FunctionComponent = () => {
27
+ export const TableActions: React.FunctionComponent = () => {
26
28
  // In real usage, this data would come from some external source like an API via props.
27
29
  const repositories: Repository[] = [
28
30
  { name: 'one', branches: 'two', prs: 'a', workspaces: 'four', lastCommit: 'five', isMenuOpen: false },
@@ -43,13 +45,13 @@ export const ComposableTableActions: React.FunctionComponent = () => {
43
45
  };
44
46
 
45
47
  const dropdownItems = [
46
- <OverflowMenuDropdownItem key="item1" isShared>
48
+ <OverflowMenuDropdownItem itemId={0} key="item1" isShared>
47
49
  Pimary
48
50
  </OverflowMenuDropdownItem>,
49
- <OverflowMenuDropdownItem key="item2" isShared>
51
+ <OverflowMenuDropdownItem itemId={1} key="item2" isShared>
50
52
  Secondary
51
53
  </OverflowMenuDropdownItem>,
52
- <OverflowMenuDropdownItem key="item3" isShared>
54
+ <OverflowMenuDropdownItem itemId={2} key="item3" isShared>
53
55
  Tertiary
54
56
  </OverflowMenuDropdownItem>
55
57
  ];
@@ -68,7 +70,7 @@ export const ComposableTableActions: React.FunctionComponent = () => {
68
70
  </Tr>
69
71
  </Thead>
70
72
  <Tbody>
71
- {repos.map(repo => (
73
+ {repos.map((repo) => (
72
74
  <Tr key={repo.name}>
73
75
  <Td dataLabel={columnNames.name}>{repo.name}</Td>
74
76
  <Td dataLabel={columnNames.branches}>{repo.branches}</Td>
@@ -92,21 +94,29 @@ export const ComposableTableActions: React.FunctionComponent = () => {
92
94
  </OverflowMenuContent>
93
95
  <OverflowMenuControl>
94
96
  <Dropdown
95
- position="right"
96
97
  onSelect={() =>
97
- setRepos(repos.map(r => (r.name !== repo.name ? r : { ...r, isMenuOpen: !r.isMenuOpen })))
98
+ setRepos(repos.map((r) => (r.name !== repo.name ? r : { ...r, isMenuOpen: !r.isMenuOpen })))
98
99
  }
99
- toggle={
100
- <KebabToggle
101
- onToggle={open =>
102
- setRepos(repos.map(r => (r.name !== repo.name ? r : { ...r, isMenuOpen: open })))
100
+ toggle={(toggleRef) => (
101
+ <MenuToggle
102
+ ref={toggleRef}
103
+ variant="plain"
104
+ aria-label="Table actions overflow menu"
105
+ onClick={() =>
106
+ setRepos(repos.map((r) => (r.name !== repo.name ? r : { ...r, isMenuOpen: !r.isMenuOpen })))
103
107
  }
104
- />
105
- }
108
+ isExpanded={repo.isMenuOpen}
109
+ >
110
+ <EllipsisVIcon />
111
+ </MenuToggle>
112
+ )}
106
113
  isOpen={repo.isMenuOpen}
107
- isPlain
108
- dropdownItems={dropdownItems}
109
- />
114
+ onOpenChange={(isOpen) =>
115
+ setRepos(repos.map((r) => (r.name !== repo.name ? r : { ...r, isMenuOpen: isOpen })))
116
+ }
117
+ >
118
+ <DropdownList>{dropdownItems}</DropdownList>
119
+ </Dropdown>
110
120
  </OverflowMenuControl>
111
121
  </OverflowMenu>
112
122
  </Td>
@@ -12,7 +12,7 @@ interface Repository {
12
12
 
13
13
  type ExampleType = 'default' | 'compact' | 'compactBorderless';
14
14
 
15
- export const ComposableTableBasic: React.FunctionComponent = () => {
15
+ export const TableBasic: React.FunctionComponent = () => {
16
16
  // In real usage, this data would come from some external source like an API via props.
17
17
  const repositories: Repository[] = [
18
18
  { name: 'one', branches: 'two', prs: 'three', workspaces: 'four', lastCommit: 'five' },
@@ -28,7 +28,7 @@ export const ComposableTableBasic: React.FunctionComponent = () => {
28
28
  lastCommit: 'Last commit'
29
29
  };
30
30
 
31
- // This state is just for the ToggleGroup in this example and isn't necessary for TableComposable usage.
31
+ // This state is just for the ToggleGroup in this example and isn't necessary for Table usage.
32
32
  const [exampleChoice, setExampleChoice] = React.useState<ExampleType>('default');
33
33
  const onExampleTypeChange: ToggleGroupItemProps['onChange'] = (_isSelected, event) => {
34
34
  const id = event.currentTarget.id;
@@ -9,7 +9,7 @@ interface Repository {
9
9
  lastCommit: string;
10
10
  }
11
11
 
12
- export const ComposableTableCellWidth: React.FunctionComponent = () => {
12
+ export const TableCellWidth: React.FunctionComponent = () => {
13
13
  // In real usage, this data would come from some external source like an API via props.
14
14
  const repositories: Repository[] = [
15
15
  { name: 'one', branches: 'two', prs: 'three', workspaces: 'four', lastCommit: 'five' },
@@ -13,7 +13,7 @@ interface Repository {
13
13
  lastCommit: string;
14
14
  }
15
15
 
16
- export const ComposableTableCompoundExpandable: React.FunctionComponent = () => {
16
+ export const TableCompoundExpandable: React.FunctionComponent = () => {
17
17
  // In real usage, this data would come from some external source like an API via props.
18
18
  const repositories: Repository[] = [
19
19
  { name: 'siemur/test-space', branches: 10, prs: 4, workspaces: 4, lastCommit: '20 minutes' },
@@ -52,7 +52,7 @@ export const ComposableTableCompoundExpandable: React.FunctionComponent = () =>
52
52
  ): TdProps['compoundExpand'] => ({
53
53
  isExpanded: expandedCells[repo.name] === columnKey,
54
54
  onToggle: () => setCellExpanded(repo, columnKey, expandedCells[repo.name] !== columnKey),
55
- expandId: 'composable-compound-expandable-example',
55
+ expandId: 'compound-expandable-example',
56
56
  rowIndex,
57
57
  columnIndex
58
58
  });
@@ -12,7 +12,7 @@ const columnNames = {
12
12
  nowrap: 'No wrap'
13
13
  };
14
14
 
15
- export const ComposableTableControllingText: React.FunctionComponent = () => (
15
+ export const TableControllingText: React.FunctionComponent = () => (
16
16
  <TableComposable aria-label="Controlling text">
17
17
  <Thead>
18
18
  <Tr>
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { TableComposable, Thead, Tbody, Tr, Th, Td, TbodyProps, TrProps } from '@patternfly/react-table';
3
3
  import styles from '@patternfly/react-styles/css/components/Table/table';
4
4
 
5
- export const ComposableTableDraggable: React.FunctionComponent = () => {
5
+ export const TableDraggable: React.FunctionComponent = () => {
6
6
  const [draggedItemId, setDraggedItemId] = React.useState<string | null>(null);
7
7
  const [draggingToItemIndex, setDraggingToItemIndex] = React.useState<number | null>(null);
8
8
  const [isDragging, setIsDragging] = React.useState(false);
@@ -5,16 +5,18 @@ import {
5
5
  EmptyState,
6
6
  EmptyStateVariant,
7
7
  EmptyStateIcon,
8
- Title,
9
8
  EmptyStateBody,
10
- Button
9
+ Button,
10
+ EmptyStateHeader,
11
+ EmptyStateFooter,
12
+ EmptyStateActions
11
13
  } from '@patternfly/react-core';
12
14
  import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
13
15
 
14
16
  // This example has been simplified to focus on the empty state. In real usage,
15
17
  // you may want to derive your rows from typed underlying data and minimal state. See other examples.
16
18
 
17
- export const ComposableTableEmptyState: React.FunctionComponent = () => (
19
+ export const TableEmptyState: React.FunctionComponent = () => (
18
20
  <TableComposable aria-label="Empty state table">
19
21
  <Thead>
20
22
  <Tr>
@@ -29,13 +31,18 @@ export const ComposableTableEmptyState: React.FunctionComponent = () => (
29
31
  <Tr>
30
32
  <Td colSpan={8}>
31
33
  <Bullseye>
32
- <EmptyState variant={EmptyStateVariant.small}>
33
- <EmptyStateIcon icon={SearchIcon} />
34
- <Title headingLevel="h2" size="lg">
35
- No results found
36
- </Title>
34
+ <EmptyState variant={EmptyStateVariant.sm}>
35
+ <EmptyStateHeader
36
+ icon={<EmptyStateIcon icon={SearchIcon} />}
37
+ titleText="No results found"
38
+ headingLevel="h2"
39
+ />
37
40
  <EmptyStateBody>Clear all filters and try again.</EmptyStateBody>
38
- <Button variant="link">Clear all filters</Button>
41
+ <EmptyStateFooter>
42
+ <EmptyStateActions>
43
+ <Button variant="link">Clear all filters</Button>
44
+ </EmptyStateActions>
45
+ </EmptyStateFooter>
39
46
  </EmptyState>
40
47
  </Bullseye>
41
48
  </Td>
@@ -17,7 +17,7 @@ interface Repository {
17
17
  }
18
18
 
19
19
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
20
- export const ComposableTableExpandable: React.FunctionComponent = () => {
20
+ export const TableExpandable: React.FunctionComponent = () => {
21
21
  // In real usage, this data would come from some external source like an API via props.
22
22
  const repositories: Repository[] = [
23
23
  { name: 'one', branches: 'two', prs: 'a', workspaces: 'four', lastCommit: 'five' },
@@ -112,7 +112,7 @@ export const ComposableTableExpandable: React.FunctionComponent = () => {
112
112
  <Checkbox
113
113
  label="Compact"
114
114
  isChecked={isExampleCompact}
115
- onChange={checked => setIsExampleCompact(checked)}
115
+ onChange={(_event, checked) => setIsExampleCompact(checked)}
116
116
  aria-label="toggle compact variation"
117
117
  id="toggle-compact"
118
118
  name="toggle-compact"
@@ -9,7 +9,7 @@ interface Repository {
9
9
  lastCommit: string;
10
10
  }
11
11
 
12
- export const ComposableTableFavoritable: React.FunctionComponent = () => {
12
+ export const TableFavoritable: React.FunctionComponent = () => {
13
13
  // In real usage, this data would come from some external source like an API via props.
14
14
  const repositories: Repository[] = [
15
15
  { name: 'one', branches: 'two', prs: 'a', workspaces: 'four', lastCommit: 'five' },
@@ -33,7 +33,7 @@ export const ComposableTableFavoritable: React.FunctionComponent = () => {
33
33
  // Sort direction of the currently sorted column
34
34
  const [activeSortDirection, setActiveSortDirection] = React.useState<'asc' | 'desc' | null>(null);
35
35
 
36
- // Favorite state is similar to selection state, see Composable: Selectable with checkbox.
36
+ // Favorite state is similar to selection state, see Selectable with checkbox.
37
37
  const [favoriteRepoNames, setFavoriteRepoNames] = React.useState<string[]>([]);
38
38
  const setRepoFavorited = (repo: Repository, isFavoriting = true) =>
39
39
  setFavoriteRepoNames(prevFavorites => {
@@ -44,7 +44,7 @@ export const ComposableTableFavoritable: React.FunctionComponent = () => {
44
44
 
45
45
  // Since OnSort specifies sorted columns by index, we need sortable values for our object by column index.
46
46
  // In this example we only deal with booleans here because we only sort on the favorites column.
47
- // For more complex sorting, see Composable: Sortable.
47
+ // For more complex sorting, see Sortable.
48
48
  // Note: We also memoize the sortable values with useCallback to prevent rows jumping around when you change
49
49
  // the favorites while sorting on that column. Only updating the sort state will reorder the rows.
50
50
  const getSortableRowValues = React.useCallback((repo: Repository): boolean[] => [isRepoFavorited(repo)], [