@patternfly/react-core 5.0.0-alpha.32 → 5.0.0-alpha.34

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 (276) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/components/Dropdown/Dropdown.d.ts +2 -0
  3. package/components/Dropdown/Dropdown.d.ts.map +1 -1
  4. package/components/Dropdown/Dropdown.js +3 -3
  5. package/components/Dropdown/Dropdown.js.map +1 -1
  6. package/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
  7. package/components/Dropdown/DropdownWithContext.js +2 -2
  8. package/components/Dropdown/DropdownWithContext.js.map +1 -1
  9. package/components/EmptyState/EmptyState.d.ts +6 -6
  10. package/components/EmptyState/EmptyState.d.ts.map +1 -1
  11. package/components/EmptyState/EmptyState.js +4 -4
  12. package/components/EmptyState/EmptyState.js.map +1 -1
  13. package/components/EmptyState/EmptyStateActions.d.ts +9 -0
  14. package/components/EmptyState/EmptyStateActions.d.ts.map +1 -0
  15. package/components/EmptyState/EmptyStateActions.js +10 -0
  16. package/components/EmptyState/EmptyStateActions.js.map +1 -0
  17. package/components/EmptyState/EmptyStateBody.d.ts +2 -2
  18. package/components/EmptyState/EmptyStateBody.d.ts.map +1 -1
  19. package/components/EmptyState/EmptyStateBody.js +1 -1
  20. package/components/EmptyState/EmptyStateBody.js.map +1 -1
  21. package/components/EmptyState/EmptyStateFooter.d.ts +9 -0
  22. package/components/EmptyState/EmptyStateFooter.d.ts.map +1 -0
  23. package/components/EmptyState/EmptyStateFooter.js +10 -0
  24. package/components/EmptyState/EmptyStateFooter.js.map +1 -0
  25. package/components/EmptyState/EmptyStateHeader.d.ts +18 -0
  26. package/components/EmptyState/EmptyStateHeader.d.ts.map +1 -0
  27. package/components/EmptyState/EmptyStateHeader.js +14 -0
  28. package/components/EmptyState/EmptyStateHeader.js.map +1 -0
  29. package/components/EmptyState/EmptyStateIcon.d.ts +3 -9
  30. package/components/EmptyState/EmptyStateIcon.d.ts.map +1 -1
  31. package/components/EmptyState/EmptyStateIcon.js +6 -4
  32. package/components/EmptyState/EmptyStateIcon.js.map +1 -1
  33. package/components/EmptyState/index.d.ts +4 -3
  34. package/components/EmptyState/index.d.ts.map +1 -1
  35. package/components/EmptyState/index.js +4 -3
  36. package/components/EmptyState/index.js.map +1 -1
  37. package/components/Pagination/PaginationOptionsMenu.d.ts +2 -0
  38. package/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
  39. package/components/Pagination/PaginationOptionsMenu.js +2 -2
  40. package/components/Pagination/PaginationOptionsMenu.js.map +1 -1
  41. package/components/Popover/Popover.js +1 -1
  42. package/components/Popover/Popover.js.map +1 -1
  43. package/components/Tabs/OverflowTab.js +1 -1
  44. package/components/Tabs/OverflowTab.js.map +1 -1
  45. package/components/Tooltip/Tooltip.d.ts +2 -0
  46. package/components/Tooltip/Tooltip.d.ts.map +1 -1
  47. package/components/Tooltip/Tooltip.js +3 -3
  48. package/components/Tooltip/Tooltip.js.map +1 -1
  49. package/dist/esm/components/Dropdown/Dropdown.d.ts +2 -0
  50. package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
  51. package/dist/esm/components/Dropdown/Dropdown.js +3 -3
  52. package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
  53. package/dist/esm/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
  54. package/dist/esm/components/Dropdown/DropdownWithContext.js +2 -2
  55. package/dist/esm/components/Dropdown/DropdownWithContext.js.map +1 -1
  56. package/dist/esm/components/EmptyState/EmptyState.d.ts +6 -6
  57. package/dist/esm/components/EmptyState/EmptyState.d.ts.map +1 -1
  58. package/dist/esm/components/EmptyState/EmptyState.js +4 -4
  59. package/dist/esm/components/EmptyState/EmptyState.js.map +1 -1
  60. package/dist/esm/components/EmptyState/EmptyStateActions.d.ts +9 -0
  61. package/dist/esm/components/EmptyState/EmptyStateActions.d.ts.map +1 -0
  62. package/dist/esm/components/EmptyState/EmptyStateActions.js +10 -0
  63. package/dist/esm/components/EmptyState/EmptyStateActions.js.map +1 -0
  64. package/dist/esm/components/EmptyState/EmptyStateBody.d.ts +2 -2
  65. package/dist/esm/components/EmptyState/EmptyStateBody.d.ts.map +1 -1
  66. package/dist/esm/components/EmptyState/EmptyStateBody.js +1 -1
  67. package/dist/esm/components/EmptyState/EmptyStateBody.js.map +1 -1
  68. package/dist/esm/components/EmptyState/EmptyStateFooter.d.ts +9 -0
  69. package/dist/esm/components/EmptyState/EmptyStateFooter.d.ts.map +1 -0
  70. package/dist/esm/components/EmptyState/EmptyStateFooter.js +10 -0
  71. package/dist/esm/components/EmptyState/EmptyStateFooter.js.map +1 -0
  72. package/dist/esm/components/EmptyState/EmptyStateHeader.d.ts +18 -0
  73. package/dist/esm/components/EmptyState/EmptyStateHeader.d.ts.map +1 -0
  74. package/dist/esm/components/EmptyState/EmptyStateHeader.js +14 -0
  75. package/dist/esm/components/EmptyState/EmptyStateHeader.js.map +1 -0
  76. package/dist/esm/components/EmptyState/EmptyStateIcon.d.ts +3 -9
  77. package/dist/esm/components/EmptyState/EmptyStateIcon.d.ts.map +1 -1
  78. package/dist/esm/components/EmptyState/EmptyStateIcon.js +6 -4
  79. package/dist/esm/components/EmptyState/EmptyStateIcon.js.map +1 -1
  80. package/dist/esm/components/EmptyState/index.d.ts +4 -3
  81. package/dist/esm/components/EmptyState/index.d.ts.map +1 -1
  82. package/dist/esm/components/EmptyState/index.js +4 -3
  83. package/dist/esm/components/EmptyState/index.js.map +1 -1
  84. package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts +2 -0
  85. package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
  86. package/dist/esm/components/Pagination/PaginationOptionsMenu.js +2 -2
  87. package/dist/esm/components/Pagination/PaginationOptionsMenu.js.map +1 -1
  88. package/dist/esm/components/Popover/Popover.js +1 -1
  89. package/dist/esm/components/Popover/Popover.js.map +1 -1
  90. package/dist/esm/components/Tabs/OverflowTab.js +1 -1
  91. package/dist/esm/components/Tabs/OverflowTab.js.map +1 -1
  92. package/dist/esm/components/Tooltip/Tooltip.d.ts +2 -0
  93. package/dist/esm/components/Tooltip/Tooltip.d.ts.map +1 -1
  94. package/dist/esm/components/Tooltip/Tooltip.js +3 -3
  95. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  96. package/dist/esm/helpers/Popper/Popper.d.ts +6 -2
  97. package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
  98. package/dist/esm/helpers/Popper/Popper.js +26 -8
  99. package/dist/esm/helpers/Popper/Popper.js.map +1 -1
  100. package/dist/esm/next/components/Dropdown/Dropdown.d.ts +1 -3
  101. package/dist/esm/next/components/Dropdown/Dropdown.d.ts.map +1 -1
  102. package/dist/esm/next/components/Dropdown/Dropdown.js +2 -6
  103. package/dist/esm/next/components/Dropdown/Dropdown.js.map +1 -1
  104. package/dist/esm/next/components/Select/Select.d.ts +3 -2
  105. package/dist/esm/next/components/Select/Select.d.ts.map +1 -1
  106. package/dist/esm/next/components/Select/Select.js +3 -7
  107. package/dist/esm/next/components/Select/Select.js.map +1 -1
  108. package/dist/js/components/Dropdown/Dropdown.d.ts +2 -0
  109. package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
  110. package/dist/js/components/Dropdown/Dropdown.js +3 -3
  111. package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
  112. package/dist/js/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
  113. package/dist/js/components/Dropdown/DropdownWithContext.js +2 -2
  114. package/dist/js/components/Dropdown/DropdownWithContext.js.map +1 -1
  115. package/dist/js/components/EmptyState/EmptyState.d.ts +6 -6
  116. package/dist/js/components/EmptyState/EmptyState.d.ts.map +1 -1
  117. package/dist/js/components/EmptyState/EmptyState.js +4 -4
  118. package/dist/js/components/EmptyState/EmptyState.js.map +1 -1
  119. package/dist/js/components/EmptyState/EmptyStateActions.d.ts +9 -0
  120. package/dist/js/components/EmptyState/EmptyStateActions.d.ts.map +1 -0
  121. package/dist/js/components/EmptyState/EmptyStateActions.js +14 -0
  122. package/dist/js/components/EmptyState/EmptyStateActions.js.map +1 -0
  123. package/dist/js/components/EmptyState/EmptyStateBody.d.ts +2 -2
  124. package/dist/js/components/EmptyState/EmptyStateBody.d.ts.map +1 -1
  125. package/dist/js/components/EmptyState/EmptyStateBody.js +1 -1
  126. package/dist/js/components/EmptyState/EmptyStateBody.js.map +1 -1
  127. package/dist/js/components/EmptyState/EmptyStateFooter.d.ts +9 -0
  128. package/dist/js/components/EmptyState/EmptyStateFooter.d.ts.map +1 -0
  129. package/dist/js/components/EmptyState/EmptyStateFooter.js +14 -0
  130. package/dist/js/components/EmptyState/EmptyStateFooter.js.map +1 -0
  131. package/dist/js/components/EmptyState/EmptyStateHeader.d.ts +18 -0
  132. package/dist/js/components/EmptyState/EmptyStateHeader.d.ts.map +1 -0
  133. package/dist/js/components/EmptyState/EmptyStateHeader.js +18 -0
  134. package/dist/js/components/EmptyState/EmptyStateHeader.js.map +1 -0
  135. package/dist/js/components/EmptyState/EmptyStateIcon.d.ts +3 -9
  136. package/dist/js/components/EmptyState/EmptyStateIcon.d.ts.map +1 -1
  137. package/dist/js/components/EmptyState/EmptyStateIcon.js +6 -4
  138. package/dist/js/components/EmptyState/EmptyStateIcon.js.map +1 -1
  139. package/dist/js/components/EmptyState/index.d.ts +4 -3
  140. package/dist/js/components/EmptyState/index.d.ts.map +1 -1
  141. package/dist/js/components/EmptyState/index.js +4 -3
  142. package/dist/js/components/EmptyState/index.js.map +1 -1
  143. package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts +2 -0
  144. package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
  145. package/dist/js/components/Pagination/PaginationOptionsMenu.js +2 -2
  146. package/dist/js/components/Pagination/PaginationOptionsMenu.js.map +1 -1
  147. package/dist/js/components/Popover/Popover.js +1 -1
  148. package/dist/js/components/Popover/Popover.js.map +1 -1
  149. package/dist/js/components/Tabs/OverflowTab.js +1 -1
  150. package/dist/js/components/Tabs/OverflowTab.js.map +1 -1
  151. package/dist/js/components/Tooltip/Tooltip.d.ts +2 -0
  152. package/dist/js/components/Tooltip/Tooltip.d.ts.map +1 -1
  153. package/dist/js/components/Tooltip/Tooltip.js +3 -3
  154. package/dist/js/components/Tooltip/Tooltip.js.map +1 -1
  155. package/dist/js/helpers/Popper/Popper.d.ts +6 -2
  156. package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
  157. package/dist/js/helpers/Popper/Popper.js +26 -8
  158. package/dist/js/helpers/Popper/Popper.js.map +1 -1
  159. package/dist/js/next/components/Dropdown/Dropdown.d.ts +1 -3
  160. package/dist/js/next/components/Dropdown/Dropdown.d.ts.map +1 -1
  161. package/dist/js/next/components/Dropdown/Dropdown.js +2 -6
  162. package/dist/js/next/components/Dropdown/Dropdown.js.map +1 -1
  163. package/dist/js/next/components/Select/Select.d.ts +3 -2
  164. package/dist/js/next/components/Select/Select.d.ts.map +1 -1
  165. package/dist/js/next/components/Select/Select.js +3 -7
  166. package/dist/js/next/components/Select/Select.js.map +1 -1
  167. package/dist/umd/react-core.min.js +2 -2
  168. package/helpers/Popper/Popper.d.ts +6 -2
  169. package/helpers/Popper/Popper.d.ts.map +1 -1
  170. package/helpers/Popper/Popper.js +26 -8
  171. package/helpers/Popper/Popper.js.map +1 -1
  172. package/next/components/Dropdown/Dropdown.d.ts +1 -3
  173. package/next/components/Dropdown/Dropdown.d.ts.map +1 -1
  174. package/next/components/Dropdown/Dropdown.js +2 -6
  175. package/next/components/Dropdown/Dropdown.js.map +1 -1
  176. package/next/components/Select/Select.d.ts +3 -2
  177. package/next/components/Select/Select.d.ts.map +1 -1
  178. package/next/components/Select/Select.js +3 -7
  179. package/next/components/Select/Select.js.map +1 -1
  180. package/package.json +2 -2
  181. package/src/components/Dropdown/Dropdown.tsx +5 -1
  182. package/src/components/Dropdown/DropdownWithContext.tsx +2 -1
  183. package/src/components/DualListSelector/examples/DualListSelectorComposable.tsx +32 -30
  184. package/src/components/DualListSelector/examples/DualListSelectorComposableTree.tsx +38 -34
  185. package/src/components/EmptyState/EmptyState.tsx +9 -9
  186. package/src/components/EmptyState/EmptyStateActions.tsx +21 -0
  187. package/src/components/EmptyState/EmptyStateBody.tsx +3 -3
  188. package/src/components/EmptyState/EmptyStateFooter.tsx +21 -0
  189. package/src/components/EmptyState/EmptyStateHeader.tsx +42 -0
  190. package/src/components/EmptyState/EmptyStateIcon.tsx +15 -18
  191. package/src/components/EmptyState/__tests__/EmptyState.test.tsx +53 -60
  192. package/src/components/EmptyState/__tests__/Generated/{EmptyStatePrimary.test.tsx → EmptyStateActions.test.tsx} +3 -3
  193. package/src/components/EmptyState/__tests__/Generated/EmptyStateIcon.test.tsx +3 -6
  194. package/src/components/EmptyState/__tests__/Generated/__snapshots__/{EmptyStateSecondaryActions.test.tsx.snap → EmptyStateActions.test.tsx.snap} +2 -2
  195. package/src/components/EmptyState/__tests__/Generated/__snapshots__/EmptyStateIcon.test.tsx.snap +41 -22
  196. package/src/components/EmptyState/__tests__/__snapshots__/EmptyState.test.tsx.snap +115 -56
  197. package/src/components/EmptyState/examples/EmptyState.md +7 -3
  198. package/src/components/EmptyState/examples/EmptyStateBasic.tsx +20 -18
  199. package/src/components/EmptyState/examples/EmptyStateCustomIconColor.tsx +17 -0
  200. package/src/components/EmptyState/examples/EmptyStateExtraLarge.tsx +20 -18
  201. package/src/components/EmptyState/examples/EmptyStateExtraSmall.tsx +16 -15
  202. package/src/components/EmptyState/examples/EmptyStateLarge.tsx +21 -19
  203. package/src/components/EmptyState/examples/EmptyStateNoMatchFound.tsx +15 -8
  204. package/src/components/EmptyState/examples/EmptyStateSmall.tsx +21 -19
  205. package/src/components/EmptyState/examples/EmptyStateSpinner.tsx +2 -5
  206. package/src/components/EmptyState/index.ts +4 -3
  207. package/src/components/LabelGroup/examples/LabelGroupEditableAddDropdown.tsx +1 -8
  208. package/src/components/LabelGroup/examples/LabelGroupEditableAddModal.tsx +0 -2
  209. package/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap +1 -1
  210. package/src/components/NotificationDrawer/examples/NotificationDrawerGroups.tsx +15 -11
  211. package/src/components/NotificationDrawer/examples/NotificationDrawerLightweight.tsx +14 -10
  212. package/src/components/Pagination/PaginationOptionsMenu.tsx +4 -1
  213. package/src/components/Popover/Popover.tsx +1 -1
  214. package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +1 -1
  215. package/src/components/Tabs/OverflowTab.tsx +1 -1
  216. package/src/components/Tabs/__tests__/OverflowTab.test.tsx +12 -20
  217. package/src/components/Tabs/__tests__/__snapshots__/OverflowTab.test.tsx.snap +0 -6
  218. package/src/components/Tooltip/Tooltip.tsx +4 -1
  219. package/src/components/Wizard/examples/Wizard.md +1 -1
  220. package/src/components/Wizard/examples/WizardFinished.tsx +18 -14
  221. package/src/components/Wizard/examples/WizardValidateOnButtonPress.tsx +20 -16
  222. package/src/demos/Card/Card.md +13 -8
  223. package/src/demos/ComposableMenu/examples/ComposableActionsMenu.tsx +1 -15
  224. package/src/demos/ComposableMenu/examples/ComposableApplicationLauncher.tsx +1 -10
  225. package/src/demos/ComposableMenu/examples/ComposableContextSelector.tsx +2 -21
  226. package/src/demos/ComposableMenu/examples/ComposableDateSelect.tsx +1 -10
  227. package/src/demos/ComposableMenu/examples/ComposableDrilldownMenu.tsx +1 -15
  228. package/src/demos/ComposableMenu/examples/ComposableDropdwnVariants.tsx +1 -8
  229. package/src/demos/ComposableMenu/examples/ComposableFlyout.tsx +1 -10
  230. package/src/demos/ComposableMenu/examples/ComposableTreeViewMenu.tsx +1 -10
  231. package/src/demos/Filters/FilterDemos.md +4 -2
  232. package/src/demos/Filters/examples/FilterAttributeSearch.tsx +20 -21
  233. package/src/demos/Filters/examples/FilterCheckboxSelect.tsx +0 -1
  234. package/src/demos/Filters/examples/FilterFaceted.tsx +19 -20
  235. package/src/demos/Filters/examples/FilterMixedSelectGroup.tsx +19 -20
  236. package/src/demos/Filters/examples/FilterSameSelectGroup.tsx +19 -20
  237. package/src/demos/Filters/examples/FilterSearchInput.tsx +18 -19
  238. package/src/demos/Filters/examples/FilterSingleSelect.tsx +0 -1
  239. package/src/demos/NotificationDrawer/NotificationDrawer.md +52 -39
  240. package/src/demos/examples/AlertGroup/AlertGroupToastWithNotificationDrawer.tsx +19 -17
  241. package/src/helpers/Popper/Popper.tsx +39 -10
  242. package/src/next/components/Dropdown/Dropdown.tsx +1 -9
  243. package/src/next/components/Dropdown/__tests__/Dropdown.test.tsx +18 -38
  244. package/src/next/components/Dropdown/examples/DropdownWithDescriptions.tsx +3 -4
  245. package/src/next/components/Dropdown/examples/DropdownWithKebabToggle.tsx +3 -4
  246. package/src/next/components/Select/Select.tsx +5 -9
  247. package/src/next/components/Wizard/examples/WizardValidateOnButtonPress.tsx +19 -15
  248. package/src/next/components/Wizard/examples/WizardWithSubmitProgress.tsx +18 -14
  249. package/components/EmptyState/EmptyStatePrimary.d.ts +0 -9
  250. package/components/EmptyState/EmptyStatePrimary.d.ts.map +0 -1
  251. package/components/EmptyState/EmptyStatePrimary.js +0 -9
  252. package/components/EmptyState/EmptyStatePrimary.js.map +0 -1
  253. package/components/EmptyState/EmptyStateSecondaryActions.d.ts +0 -9
  254. package/components/EmptyState/EmptyStateSecondaryActions.d.ts.map +0 -1
  255. package/components/EmptyState/EmptyStateSecondaryActions.js +0 -9
  256. package/components/EmptyState/EmptyStateSecondaryActions.js.map +0 -1
  257. package/dist/esm/components/EmptyState/EmptyStatePrimary.d.ts +0 -9
  258. package/dist/esm/components/EmptyState/EmptyStatePrimary.d.ts.map +0 -1
  259. package/dist/esm/components/EmptyState/EmptyStatePrimary.js +0 -9
  260. package/dist/esm/components/EmptyState/EmptyStatePrimary.js.map +0 -1
  261. package/dist/esm/components/EmptyState/EmptyStateSecondaryActions.d.ts +0 -9
  262. package/dist/esm/components/EmptyState/EmptyStateSecondaryActions.d.ts.map +0 -1
  263. package/dist/esm/components/EmptyState/EmptyStateSecondaryActions.js +0 -9
  264. package/dist/esm/components/EmptyState/EmptyStateSecondaryActions.js.map +0 -1
  265. package/dist/js/components/EmptyState/EmptyStatePrimary.d.ts +0 -9
  266. package/dist/js/components/EmptyState/EmptyStatePrimary.d.ts.map +0 -1
  267. package/dist/js/components/EmptyState/EmptyStatePrimary.js +0 -13
  268. package/dist/js/components/EmptyState/EmptyStatePrimary.js.map +0 -1
  269. package/dist/js/components/EmptyState/EmptyStateSecondaryActions.d.ts +0 -9
  270. package/dist/js/components/EmptyState/EmptyStateSecondaryActions.d.ts.map +0 -1
  271. package/dist/js/components/EmptyState/EmptyStateSecondaryActions.js +0 -13
  272. package/dist/js/components/EmptyState/EmptyStateSecondaryActions.js.map +0 -1
  273. package/src/components/EmptyState/EmptyStatePrimary.tsx +0 -20
  274. package/src/components/EmptyState/EmptyStateSecondaryActions.tsx +0 -18
  275. package/src/components/EmptyState/__tests__/Generated/EmptyStateSecondaryActions.test.tsx +0 -13
  276. package/src/components/EmptyState/__tests__/Generated/__snapshots__/EmptyStatePrimary.test.tsx.snap +0 -13
@@ -8,13 +8,14 @@ import {
8
8
  DualListSelectorTree,
9
9
  DualListSelectorTreeItemData,
10
10
  SearchInput,
11
- Title,
12
11
  Button,
13
12
  EmptyState,
14
13
  EmptyStateVariant,
15
- EmptyStateIcon,
14
+ EmptyStateHeader,
15
+ EmptyStateFooter,
16
16
  EmptyStateBody,
17
- EmptyStatePrimary
17
+ EmptyStateActions,
18
+ EmptyStateIcon
18
19
  } from '@patternfly/react-core';
19
20
  import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-left-icon';
20
21
  import AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon';
@@ -48,7 +49,7 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
48
49
  }
49
50
  textById[node.id] = node.text;
50
51
  if (node.children) {
51
- node.children.forEach(child => {
52
+ node.children.forEach((child) => {
52
53
  textById = { ...textById, ...buildTextById(child) };
53
54
  });
54
55
  }
@@ -61,7 +62,7 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
61
62
  return [node.id];
62
63
  } else {
63
64
  let childrenIds: string[] = [];
64
- node.children.forEach(child => {
65
+ node.children.forEach((child) => {
65
66
  childrenIds = [...childrenIds, ...getDescendantLeafIds(child)];
66
67
  });
67
68
  return childrenIds;
@@ -74,7 +75,7 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
74
75
  if (!node.children || !node.children.length) {
75
76
  leavesById[node.id] = [node.id];
76
77
  } else {
77
- node.children.forEach(child => {
78
+ node.children.forEach((child) => {
78
79
  leavesById[node.id] = getDescendantLeafIds(node);
79
80
  leavesById = { ...leavesById, ...getLeavesById(child) };
80
81
  });
@@ -87,7 +88,7 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
87
88
  let leavesById = {};
88
89
  let allLeaves: string[] = [];
89
90
  let nodeTexts = {};
90
- data.forEach(foodNode => {
91
+ data.forEach((foodNode) => {
91
92
  nodeTexts = { ...nodeTexts, ...buildTextById(foodNode) };
92
93
  leavesById = { ...leavesById, ...getLeavesById(foodNode) };
93
94
  allLeaves = [...allLeaves, ...getDescendantLeafIds(foodNode)];
@@ -101,17 +102,17 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
101
102
 
102
103
  const moveChecked = (toChosen: boolean) => {
103
104
  setChosenLeafIds(
104
- prevChosenIds =>
105
+ (prevChosenIds) =>
105
106
  toChosen
106
107
  ? [...prevChosenIds, ...checkedLeafIds] // add checked ids to chosen list
107
- : [...prevChosenIds.filter(x => !checkedLeafIds.includes(x))] // remove checked ids from chosen list
108
+ : [...prevChosenIds.filter((x) => !checkedLeafIds.includes(x))] // remove checked ids from chosen list
108
109
  );
109
110
 
110
111
  // uncheck checked ids that just moved
111
- setCheckedLeafIds(prevChecked =>
112
+ setCheckedLeafIds((prevChecked) =>
112
113
  toChosen
113
- ? [...prevChecked.filter(x => chosenLeafIds.includes(x))]
114
- : [...prevChecked.filter(x => !chosenLeafIds.includes(x))]
114
+ ? [...prevChecked.filter((x) => chosenLeafIds.includes(x))]
115
+ : [...prevChecked.filter((x) => !chosenLeafIds.includes(x))]
115
116
  );
116
117
  };
117
118
 
@@ -125,11 +126,11 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
125
126
 
126
127
  const areAllDescendantsSelected = (node: FoodNode, isChosen: boolean) =>
127
128
  memoizedLeavesById[node.id].every(
128
- id => checkedLeafIds.includes(id) && (isChosen ? chosenLeafIds.includes(id) : !chosenLeafIds.includes(id))
129
+ (id) => checkedLeafIds.includes(id) && (isChosen ? chosenLeafIds.includes(id) : !chosenLeafIds.includes(id))
129
130
  );
130
131
  const areSomeDescendantsSelected = (node: FoodNode, isChosen: boolean) =>
131
132
  memoizedLeavesById[node.id].some(
132
- id => checkedLeafIds.includes(id) && (isChosen ? chosenLeafIds.includes(id) : !chosenLeafIds.includes(id))
133
+ (id) => checkedLeafIds.includes(id) && (isChosen ? chosenLeafIds.includes(id) : !chosenLeafIds.includes(id))
133
134
  );
134
135
 
135
136
  const isNodeChecked = (node: FoodNode, isChosen: boolean) => {
@@ -148,7 +149,7 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
148
149
  node: DualListSelectorTreeItemData,
149
150
  isChosen: boolean
150
151
  ) => {
151
- const nodeIdsToCheck = memoizedLeavesById[node.id].filter(id =>
152
+ const nodeIdsToCheck = memoizedLeavesById[node.id].filter((id) =>
152
153
  isChosen
153
154
  ? chosenLeafIds.includes(id) && !hiddenChosen.includes(id)
154
155
  : !chosenLeafIds.includes(id) && !hiddenAvailable.includes(id)
@@ -158,15 +159,15 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
158
159
  } else {
159
160
  hiddenAvailable = [];
160
161
  }
161
- setCheckedLeafIds(prevChecked => {
162
- const otherCheckedNodeNames = prevChecked.filter(id => !nodeIdsToCheck.includes(id));
162
+ setCheckedLeafIds((prevChecked) => {
163
+ const otherCheckedNodeNames = prevChecked.filter((id) => !nodeIdsToCheck.includes(id));
163
164
  return !isChecked ? otherCheckedNodeNames : [...otherCheckedNodeNames, ...nodeIdsToCheck];
164
165
  });
165
166
  };
166
167
 
167
168
  // builds a search input - used in each dual list selector pane
168
169
  const buildSearchInput = (isChosen: boolean) => {
169
- const onChange = value => (isChosen ? setChosenFilter(value) : setAvailableFilter(value));
170
+ const onChange = (value) => (isChosen ? setChosenFilter(value) : setAvailableFilter(value));
170
171
 
171
172
  return (
172
173
  <SearchInput
@@ -192,11 +193,11 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
192
193
  const filterValue = isChosen ? chosenFilter : availableFilter;
193
194
  const descendentLeafIds = memoizedLeavesById[node.id];
194
195
  const descendentsOnThisPane = isChosen
195
- ? descendentLeafIds.filter(id => chosenLeafIds.includes(id))
196
- : descendentLeafIds.filter(id => !chosenLeafIds.includes(id));
196
+ ? descendentLeafIds.filter((id) => chosenLeafIds.includes(id))
197
+ : descendentLeafIds.filter((id) => !chosenLeafIds.includes(id));
197
198
 
198
199
  const hasMatchingChildren =
199
- filterValue && descendentsOnThisPane.some(id => memoizedNodeText[id].includes(filterValue));
200
+ filterValue && descendentsOnThisPane.some((id) => memoizedNodeText[id].includes(filterValue));
200
201
  const isFilterMatch = filterValue && node.text.includes(filterValue) && descendentsOnThisPane.length > 0;
201
202
 
202
203
  // A node is displayed if either of the following is true:
@@ -243,7 +244,7 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
243
244
  const buildPane = (isChosen: boolean): React.ReactNode => {
244
245
  const options: DualListSelectorTreeItemData[] = buildOptions(isChosen, data, false);
245
246
  const numOptions = isChosen ? chosenLeafIds.length : memoizedAllLeaves.length - chosenLeafIds.length;
246
- const numSelected = checkedLeafIds.filter(id =>
247
+ const numSelected = checkedLeafIds.filter((id) =>
247
248
  isChosen ? chosenLeafIds.includes(id) : !chosenLeafIds.includes(id)
248
249
  ).length;
249
250
  const status = `${numSelected} of ${numOptions} options selected`;
@@ -257,17 +258,20 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
257
258
  listMinHeight="300px"
258
259
  >
259
260
  {filterApplied && options.length === 0 && (
260
- <EmptyState variant={EmptyStateVariant.small}>
261
- <EmptyStateIcon icon={SearchIcon} />
262
- <Title headingLevel="h4" size="md">
263
- No results found
264
- </Title>
261
+ <EmptyState variant={EmptyStateVariant.sm}>
262
+ <EmptyStateHeader
263
+ headingLevel="h4"
264
+ titleText="No results found"
265
+ icon={<EmptyStateIcon icon={SearchIcon} />}
266
+ />
265
267
  <EmptyStateBody>No results match the filter criteria. Clear all filters and try again.</EmptyStateBody>
266
- <EmptyStatePrimary>
267
- <Button variant="link" onClick={() => (isChosen ? setChosenFilter('') : setAvailableFilter(''))}>
268
- Clear all filters
269
- </Button>
270
- </EmptyStatePrimary>
268
+ <EmptyStateFooter>
269
+ <EmptyStateActions>
270
+ <Button variant="link" onClick={() => (isChosen ? setChosenFilter('') : setAvailableFilter(''))}>
271
+ Clear all filters
272
+ </Button>
273
+ </EmptyStateActions>
274
+ </EmptyStateFooter>
271
275
  </EmptyState>
272
276
  )}
273
277
  {options.length > 0 && (
@@ -287,7 +291,7 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
287
291
  {buildPane(false)}
288
292
  <DualListSelectorControlsWrapper>
289
293
  <DualListSelectorControl
290
- isDisabled={!checkedLeafIds.filter(x => !chosenLeafIds.includes(x)).length}
294
+ isDisabled={!checkedLeafIds.filter((x) => !chosenLeafIds.includes(x)).length}
291
295
  onClick={() => moveChecked(true)}
292
296
  aria-label="Add selected"
293
297
  >
@@ -309,7 +313,7 @@ export const DualListSelectorComposableTree: React.FunctionComponent<ExampleProp
309
313
  </DualListSelectorControl>
310
314
  <DualListSelectorControl
311
315
  onClick={() => moveChecked(false)}
312
- isDisabled={!checkedLeafIds.filter(x => !!chosenLeafIds.includes(x)).length}
316
+ isDisabled={!checkedLeafIds.filter((x) => !!chosenLeafIds.includes(x)).length}
313
317
  aria-label="Remove selected"
314
318
  >
315
319
  <AngleLeftIcon />
@@ -4,26 +4,26 @@ import styles from '@patternfly/react-styles/css/components/EmptyState/empty-sta
4
4
 
5
5
  export enum EmptyStateVariant {
6
6
  'xs' = 'xs',
7
- small = 'small',
8
- large = 'large',
7
+ sm = 'sm',
8
+ lg = 'lg',
9
9
  'xl' = 'xl',
10
10
  full = 'full'
11
11
  }
12
12
 
13
13
  export interface EmptyStateProps extends React.HTMLProps<HTMLDivElement> {
14
- /** Additional classes added to the EmptyState */
14
+ /** Additional classes added to the empty state */
15
15
  className?: string;
16
- /** Content rendered inside the EmptyState */
16
+ /** Content rendered inside the empty state */
17
17
  children: React.ReactNode;
18
- /** Modifies EmptyState max-width */
19
- variant?: 'xs' | 'small' | 'large' | 'xl' | 'full';
18
+ /** Modifies empty state max-width and sizes of icon, title and body */
19
+ variant?: 'xs' | 'sm' | 'lg' | 'xl' | 'full';
20
20
  /** Cause component to consume the available height of its container */
21
21
  isFullHeight?: boolean;
22
22
  }
23
23
 
24
24
  export const EmptyState: React.FunctionComponent<EmptyStateProps> = ({
25
25
  children,
26
- className = '',
26
+ className,
27
27
  variant = EmptyStateVariant.full,
28
28
  isFullHeight,
29
29
  ...props
@@ -32,8 +32,8 @@ export const EmptyState: React.FunctionComponent<EmptyStateProps> = ({
32
32
  className={css(
33
33
  styles.emptyState,
34
34
  variant === 'xs' && styles.modifiers.xs,
35
- variant === 'small' && styles.modifiers.sm,
36
- variant === 'large' && styles.modifiers.lg,
35
+ variant === 'sm' && styles.modifiers.sm,
36
+ variant === 'lg' && styles.modifiers.lg,
37
37
  variant === 'xl' && styles.modifiers.xl,
38
38
  isFullHeight && styles.modifiers.fullHeight,
39
39
  className
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { css } from '@patternfly/react-styles';
3
+ import styles from "@patternfly/react-styles/css/components/EmptyState/empty-state";
4
+
5
+ export interface EmptyStateActionsProps extends React.HTMLProps<HTMLDivElement> {
6
+ /** Content rendered inside the empty state actions */
7
+ children?: React.ReactNode;
8
+ /** Additional classes added to the empty state actions */
9
+ className?: string;
10
+ }
11
+
12
+ export const EmptyStateActions: React.FunctionComponent<EmptyStateActionsProps> = ({
13
+ children,
14
+ className,
15
+ ...props
16
+ }: EmptyStateActionsProps) => (
17
+ <div className={css(styles.emptyStateActions, className)} {...props}>
18
+ {children}
19
+ </div>
20
+ );
21
+ EmptyStateActions.displayName = 'EmptyStateActions';
@@ -3,15 +3,15 @@ import { css } from '@patternfly/react-styles';
3
3
  import styles from '@patternfly/react-styles/css/components/EmptyState/empty-state';
4
4
 
5
5
  export interface EmptyStateBodyProps extends React.HTMLProps<HTMLDivElement> {
6
- /** Content rendered inside the EmptyState */
6
+ /** Content rendered inside the empty state body */
7
7
  children?: React.ReactNode;
8
- /** Additional classes added to the EmptyState */
8
+ /** Additional classes added to the empty state body */
9
9
  className?: string;
10
10
  }
11
11
 
12
12
  export const EmptyStateBody: React.FunctionComponent<EmptyStateBodyProps> = ({
13
13
  children,
14
- className = '',
14
+ className,
15
15
  ...props
16
16
  }: EmptyStateBodyProps) => (
17
17
  <div className={css(styles.emptyStateBody, className)} {...props}>
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { css } from '@patternfly/react-styles';
3
+ import styles from '@patternfly/react-styles/css/components/EmptyState/empty-state';
4
+
5
+ export interface EmptyStateFooterProps extends React.HTMLProps<HTMLDivElement> {
6
+ /** Content rendered inside the empty state footer */
7
+ children?: React.ReactNode;
8
+ /** Additional classes added to the empty state footer */
9
+ className?: string;
10
+ }
11
+
12
+ export const EmptyStateFooter: React.FunctionComponent<EmptyStateFooterProps> = ({
13
+ children,
14
+ className,
15
+ ...props
16
+ }: EmptyStateFooterProps) => (
17
+ <div className={css(styles.emptyStateFooter, className)} {...props}>
18
+ {children}
19
+ </div>
20
+ );
21
+ EmptyStateFooter.displayName = 'EmptyStateFooter';
@@ -0,0 +1,42 @@
1
+ import * as React from 'react';
2
+ import { css } from '@patternfly/react-styles';
3
+ import styles from '@patternfly/react-styles/css/components/EmptyState/empty-state';
4
+ import { EmptyStateIconProps } from './EmptyStateIcon';
5
+
6
+ export interface EmptyStateHeaderProps extends React.HTMLProps<HTMLDivElement> {
7
+ /** Content rendered inside the empty state header, either in addition to or instead of the titleText prop */
8
+ children?: React.ReactNode;
9
+ /** Additional classes added to the empty state header */
10
+ className?: string;
11
+ /** Additional classes added to the title inside empty state header */
12
+ titleClassName?: string;
13
+ /** Text of the title inside empty state header, will be wrapped in headingLevel */
14
+ titleText?: React.ReactNode;
15
+ /** Empty state icon element to be rendered */
16
+ icon?: React.ReactElement<EmptyStateIconProps>;
17
+ /** The heading level to use, default is h1 */
18
+ headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
19
+ }
20
+
21
+ export const EmptyStateHeader: React.FunctionComponent<EmptyStateHeaderProps> = ({
22
+ children,
23
+ className,
24
+ titleClassName,
25
+ titleText,
26
+ headingLevel: HeadingLevel = 'h1',
27
+ icon,
28
+ ...props
29
+ }: EmptyStateHeaderProps) => (
30
+ <div className={css('pf-c-empty-state__header', className)} {...props}>
31
+ {icon}
32
+ {(titleText || children) && (
33
+ <div className={css('pf-c-empty-state__title')}>
34
+ {titleText && (
35
+ <HeadingLevel className={css(styles.emptyStateTitleText, titleClassName)}>{titleText}</HeadingLevel>
36
+ )}
37
+ {children}
38
+ </div>
39
+ )}
40
+ </div>
41
+ );
42
+ EmptyStateHeader.displayName = 'EmptyStateHeader';
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { css } from '@patternfly/react-styles';
3
3
  import styles from '@patternfly/react-styles/css/components/EmptyState/empty-state';
4
+ import { Spinner } from '../Spinner';
4
5
 
5
6
  export interface IconProps extends Omit<React.HTMLProps<SVGElement>, 'size'> {
6
7
  /** Changes the color of the icon. */
@@ -8,31 +9,27 @@ export interface IconProps extends Omit<React.HTMLProps<SVGElement>, 'size'> {
8
9
  }
9
10
 
10
11
  export interface EmptyStateIconProps extends IconProps {
11
- /** Additional classes added to the EmptyState */
12
+ /** Additional classes added to the empty state icon */
12
13
  className?: string;
13
- /** Icon component to be rendered inside the EmptyState on icon variant
14
- * Usually a CheckCircleIcon, ExclamationCircleIcon, LockIcon, PlusCircleIcon, RocketIcon
15
- * SearchIcon, or WrenchIcon */
16
- icon?: React.ComponentType<any>;
17
- /** Component to be rendered inside the EmptyState on container variant */
18
- component?: React.ComponentType<any>;
19
- /** Adds empty state icon variant styles */
20
- variant?: 'icon' | 'container';
14
+ /** Icon component to be rendered. Can also be a spinner component */
15
+ icon: React.ComponentType<any>;
21
16
  }
22
17
 
18
+ const isSpinner = (icon: React.ReactElement<any>) => icon.type === Spinner;
19
+
23
20
  export const EmptyStateIcon: React.FunctionComponent<EmptyStateIconProps> = ({
24
- className = '',
21
+ className,
25
22
  icon: IconComponent,
26
- component: AnyComponent,
27
- variant = 'icon',
23
+ color,
28
24
  ...props
29
25
  }: EmptyStateIconProps) => {
30
- const classNames = css(styles.emptyStateIcon, className);
31
- return variant === 'icon' ? (
32
- <IconComponent className={classNames} {...props} aria-hidden="true" />
33
- ) : (
34
- <div className={classNames}>
35
- <AnyComponent />
26
+ const iconIsSpinner = isSpinner(<IconComponent />);
27
+ return (
28
+ <div
29
+ className={css(styles.emptyStateIcon)}
30
+ {...(color && !iconIsSpinner && { style: { ['--pf-c-empty-state__icon--Color']: color } as React.CSSProperties })}
31
+ >
32
+ <IconComponent className={className} aria-hidden={!iconIsSpinner} {...props} />
36
33
  </div>
37
34
  );
38
35
  };
@@ -3,30 +3,33 @@ import React from 'react';
3
3
  import { render, screen } from '@testing-library/react';
4
4
 
5
5
  import AddressBookIcon from '@patternfly/react-icons/dist/esm/icons/address-book-icon';
6
+
6
7
  import { EmptyState, EmptyStateVariant } from '../EmptyState';
7
8
  import { EmptyStateBody } from '../EmptyStateBody';
8
- import { EmptyStateSecondaryActions } from '../EmptyStateSecondaryActions';
9
- import { EmptyStateIcon } from '../EmptyStateIcon';
10
- import { EmptyStatePrimary } from '../EmptyStatePrimary';
9
+ import { EmptyStateActions } from '../EmptyStateActions';
11
10
  import { Button } from '../../Button';
12
- import { Title, TitleSizes } from '../../Title';
11
+ import { EmptyStateHeader } from '../EmptyStateHeader';
12
+ import { EmptyStateFooter } from '../EmptyStateFooter';
13
+ import { EmptyStateIcon } from '../../../../dist/esm';
13
14
 
14
15
  describe('EmptyState', () => {
15
16
  test('Main', () => {
16
17
  const { asFragment } = render(
17
18
  <EmptyState>
18
- <Title headingLevel="h5" size="lg">
19
- HTTP Proxies
20
- </Title>
19
+ <EmptyStateHeader titleText="HTTP Proxies" />
21
20
  <EmptyStateBody>
22
21
  Defining HTTP Proxies that exist on your network allows you to perform various actions through those proxies.
23
22
  </EmptyStateBody>
24
- <Button variant="primary">New HTTP Proxy</Button>
25
- <EmptyStateSecondaryActions>
26
- <Button variant="link" aria-label="learn more action">
27
- Learn more about this in the documentation.
28
- </Button>
29
- </EmptyStateSecondaryActions>
23
+ <EmptyStateFooter>
24
+ <EmptyStateActions>
25
+ <Button variant="primary">New HTTP Proxy</Button>
26
+ </EmptyStateActions>
27
+ <EmptyStateActions>
28
+ <Button variant="link" aria-label="learn more action">
29
+ Learn more about this in the documentation.
30
+ </Button>
31
+ </EmptyStateActions>
32
+ </EmptyStateFooter>
30
33
  </EmptyState>
31
34
  );
32
35
  expect(asFragment()).toMatchSnapshot();
@@ -34,10 +37,8 @@ describe('EmptyState', () => {
34
37
 
35
38
  test('Main variant large', () => {
36
39
  const { asFragment } = render(
37
- <EmptyState variant={EmptyStateVariant.large}>
38
- <Title headingLevel="h3" size={TitleSizes.md}>
39
- EmptyState large
40
- </Title>
40
+ <EmptyState variant={EmptyStateVariant.lg}>
41
+ <EmptyStateHeader titleText="EmptyState large" />
41
42
  </EmptyState>
42
43
  );
43
44
  expect(asFragment()).toMatchSnapshot();
@@ -45,10 +46,8 @@ describe('EmptyState', () => {
45
46
 
46
47
  test('Main variant small', () => {
47
48
  const { asFragment } = render(
48
- <EmptyState variant={EmptyStateVariant.small}>
49
- <Title headingLevel="h3" size={TitleSizes.md}>
50
- EmptyState small
51
- </Title>
49
+ <EmptyState variant={EmptyStateVariant.sm}>
50
+ <EmptyStateHeader titleText="EmptyState small" />
52
51
  </EmptyState>
53
52
  );
54
53
  expect(asFragment()).toMatchSnapshot();
@@ -57,9 +56,7 @@ describe('EmptyState', () => {
57
56
  test('Main variant xs', () => {
58
57
  const { asFragment } = render(
59
58
  <EmptyState variant={EmptyStateVariant.xs}>
60
- <Title headingLevel="h3" size={TitleSizes.md}>
61
- EmptyState small
62
- </Title>
59
+ <EmptyStateHeader titleText="EmptyState extra small" />
63
60
  </EmptyState>
64
61
  );
65
62
  expect(asFragment()).toMatchSnapshot();
@@ -70,51 +67,47 @@ describe('EmptyState', () => {
70
67
  expect(screen.getByTestId('body-test-id')).toHaveClass('custom-empty-state-body pf-c-empty-state__body');
71
68
  });
72
69
 
73
- // TODO: update this with issue #8555
74
- xtest('Secondary Action', () => {
75
- render(<EmptyStateSecondaryActions className="custom-empty-state-secondary" data-testid="actions-test-id" />);
76
- expect(screen.getByTestId('actions-test-id')).toHaveClass(
77
- 'pf-c-empty-state__secondary'
70
+ test('Actions', () => {
71
+ render(<EmptyStateActions className="custom-empty-state-secondary" data-testid="actions-test-id" />);
72
+ expect(screen.getByTestId('actions-test-id')).toHaveClass('pf-c-empty-state__actions');
73
+ });
74
+
75
+ test('Full height', () => {
76
+ const { asFragment } = render(
77
+ <EmptyState isFullHeight variant={EmptyStateVariant.lg}>
78
+ <EmptyStateHeader titleText="EmptyState large" />
79
+ </EmptyState>
78
80
  );
81
+ expect(asFragment()).toMatchSnapshot();
79
82
  });
80
83
 
81
- test('Icon', () => {
82
- render(<EmptyStateIcon icon={AddressBookIcon} data-testid="icon-test-id" />);
83
- expect(screen.getByTestId('icon-test-id')).toHaveClass('pf-c-empty-state__icon');
84
+ test('Header with icon', () => {
85
+ const { asFragment } = render(<EmptyStateHeader icon={<EmptyStateIcon icon={AddressBookIcon} />} />);
86
+ expect(asFragment()).toMatchSnapshot();
84
87
  });
85
88
 
86
- test('Wrap icon in a div', () => {
87
- const { container } = render(
88
- <EmptyStateIcon
89
- variant="container"
90
- component={AddressBookIcon}
91
- className="custom-empty-state-icon"
92
- id="empty-state-icon-id"
93
- />
94
- );
89
+ test('Header with title text renders heading level 1 by default', () => {
90
+ render(<EmptyStateHeader titleText="Empty state" />);
91
+ expect(screen.getByRole('heading', { level: 1, name: 'Empty state' })).toHaveClass('pf-c-empty-state__title-text');
92
+ });
95
93
 
96
- expect(container.querySelector('div')).toHaveClass('pf-c-empty-state__icon custom-empty-state-icon');
97
- expect(container.querySelector('svg')).toBeInTheDocument();
94
+ test('Header renders custom class passed via titleClassName', () => {
95
+ render(<EmptyStateHeader titleText="Empty state" titleClassName={'testTitleClassName'} />);
96
+ expect(screen.getByRole('heading', { level: 1, name: 'Empty state' })).toHaveClass('testTitleClassName');
98
97
  });
99
98
 
100
- // TODO: update this with issue #8555
101
- xtest('Primary div', () => {
102
- render(
103
- <EmptyStatePrimary data-testid="primary-test-id">
104
- <Button variant="link">Link</Button>
105
- </EmptyStatePrimary>
106
- );
107
- expect(screen.getByTestId('primary-test-id')).toHaveClass('pf-c-empty-state__primary');
99
+ test('Header renders the title as other heading levels when one is passed using headingLevel', () => {
100
+ render(<EmptyStateHeader titleText="Empty state" headingLevel="h3" />);
101
+ expect(screen.getByRole('heading', { level: 3, name: 'Empty state' })).toHaveClass('pf-c-empty-state__title-text');
108
102
  });
109
103
 
110
- test('Full height', () => {
111
- const { asFragment } = render(
112
- <EmptyState isFullHeight variant={EmptyStateVariant.large}>
113
- <Title headingLevel="h3" size={TitleSizes.md}>
114
- EmptyState large
115
- </Title>
116
- </EmptyState>
117
- );
118
- expect(asFragment()).toMatchSnapshot();
104
+ test('Headers render children', () => {
105
+ render(<EmptyStateHeader>Title text</EmptyStateHeader>);
106
+ expect(screen.getByText('Title text')).toBeVisible();
107
+ });
108
+
109
+ test('Footer', () => {
110
+ render(<EmptyStateFooter className="custom-empty-state-footer" data-testid="actions-test-id" />);
111
+ expect(screen.getByTestId('actions-test-id')).toHaveClass('custom-empty-state-footer');
119
112
  });
120
113
  });
@@ -3,11 +3,11 @@
3
3
  */
4
4
  import * as React from 'react';
5
5
  import { render } from '@testing-library/react';
6
- import { EmptyStatePrimary } from '../../EmptyStatePrimary';
6
+ import { EmptyStateActions } from '../../EmptyStateActions';
7
7
  // any missing imports can usually be resolved by adding them here
8
8
  import {} from '../..';
9
9
 
10
- it('EmptyStatePrimary should match snapshot (auto-generated)', () => {
11
- const { asFragment } = render(<EmptyStatePrimary className={"''"} children={<div>ReactNode</div>} />);
10
+ it('EmptyStateActions should match snapshot (auto-generated)', () => {
11
+ const { asFragment } = render(<EmptyStateActions children={<>ReactNode</>} className={"''"} />);
12
12
  expect(asFragment()).toMatchSnapshot();
13
13
  });
@@ -6,7 +6,8 @@ import { render } from '@testing-library/react';
6
6
  import { UserIcon } from '@patternfly/react-icons';
7
7
  import { EmptyStateIcon } from '../../EmptyStateIcon';
8
8
  // any missing imports can usually be resolved by adding them here
9
- import {} from '../..';
9
+ import { Spinner } from '../../../Spinner/Spinner';
10
+
10
11
  it('EmptyStateIcon should match snapshot (auto-generated)', () => {
11
12
  const { asFragment } = render(
12
13
  <EmptyStateIcon
@@ -14,8 +15,6 @@ it('EmptyStateIcon should match snapshot (auto-generated)', () => {
14
15
  title={'string'}
15
16
  className={"''"}
16
17
  icon={UserIcon}
17
- component={null}
18
- variant={'icon'}
19
18
  />
20
19
  );
21
20
  expect(asFragment()).toMatchSnapshot();
@@ -27,9 +26,7 @@ it('EmptyStateIcon should match snapshot for variant container', () => {
27
26
  color={'string'}
28
27
  title={'string'}
29
28
  className={"''"}
30
- icon={null}
31
- component={() => <div>Component</div>}
32
- variant={'container'}
29
+ icon={Spinner}
33
30
  />
34
31
  );
35
32
  expect(asFragment()).toMatchSnapshot();
@@ -1,9 +1,9 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`EmptyStateSecondaryActions should match snapshot (auto-generated) 1`] = `
3
+ exports[`EmptyStateActions should match snapshot (auto-generated) 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
- class="''"
6
+ class="pf-c-empty-state__actions ''"
7
7
  >
8
8
  ReactNode
9
9
  </div>