@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.
- package/CHANGELOG.md +18 -0
- package/components/Dropdown/Dropdown.d.ts +2 -0
- package/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/components/Dropdown/Dropdown.js +3 -3
- package/components/Dropdown/Dropdown.js.map +1 -1
- package/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
- package/components/Dropdown/DropdownWithContext.js +2 -2
- package/components/Dropdown/DropdownWithContext.js.map +1 -1
- package/components/EmptyState/EmptyState.d.ts +6 -6
- package/components/EmptyState/EmptyState.d.ts.map +1 -1
- package/components/EmptyState/EmptyState.js +4 -4
- package/components/EmptyState/EmptyState.js.map +1 -1
- package/components/EmptyState/EmptyStateActions.d.ts +9 -0
- package/components/EmptyState/EmptyStateActions.d.ts.map +1 -0
- package/components/EmptyState/EmptyStateActions.js +10 -0
- package/components/EmptyState/EmptyStateActions.js.map +1 -0
- package/components/EmptyState/EmptyStateBody.d.ts +2 -2
- package/components/EmptyState/EmptyStateBody.d.ts.map +1 -1
- package/components/EmptyState/EmptyStateBody.js +1 -1
- package/components/EmptyState/EmptyStateBody.js.map +1 -1
- package/components/EmptyState/EmptyStateFooter.d.ts +9 -0
- package/components/EmptyState/EmptyStateFooter.d.ts.map +1 -0
- package/components/EmptyState/EmptyStateFooter.js +10 -0
- package/components/EmptyState/EmptyStateFooter.js.map +1 -0
- package/components/EmptyState/EmptyStateHeader.d.ts +18 -0
- package/components/EmptyState/EmptyStateHeader.d.ts.map +1 -0
- package/components/EmptyState/EmptyStateHeader.js +14 -0
- package/components/EmptyState/EmptyStateHeader.js.map +1 -0
- package/components/EmptyState/EmptyStateIcon.d.ts +3 -9
- package/components/EmptyState/EmptyStateIcon.d.ts.map +1 -1
- package/components/EmptyState/EmptyStateIcon.js +6 -4
- package/components/EmptyState/EmptyStateIcon.js.map +1 -1
- package/components/EmptyState/index.d.ts +4 -3
- package/components/EmptyState/index.d.ts.map +1 -1
- package/components/EmptyState/index.js +4 -3
- package/components/EmptyState/index.js.map +1 -1
- package/components/Pagination/PaginationOptionsMenu.d.ts +2 -0
- package/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
- package/components/Pagination/PaginationOptionsMenu.js +2 -2
- package/components/Pagination/PaginationOptionsMenu.js.map +1 -1
- package/components/Popover/Popover.js +1 -1
- package/components/Popover/Popover.js.map +1 -1
- package/components/Tabs/OverflowTab.js +1 -1
- package/components/Tabs/OverflowTab.js.map +1 -1
- package/components/Tooltip/Tooltip.d.ts +2 -0
- package/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/components/Tooltip/Tooltip.js +3 -3
- package/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.d.ts +2 -0
- package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js +3 -3
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/DropdownWithContext.js +2 -2
- package/dist/esm/components/Dropdown/DropdownWithContext.js.map +1 -1
- package/dist/esm/components/EmptyState/EmptyState.d.ts +6 -6
- package/dist/esm/components/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/esm/components/EmptyState/EmptyState.js +4 -4
- package/dist/esm/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/esm/components/EmptyState/EmptyStateActions.d.ts +9 -0
- package/dist/esm/components/EmptyState/EmptyStateActions.d.ts.map +1 -0
- package/dist/esm/components/EmptyState/EmptyStateActions.js +10 -0
- package/dist/esm/components/EmptyState/EmptyStateActions.js.map +1 -0
- package/dist/esm/components/EmptyState/EmptyStateBody.d.ts +2 -2
- package/dist/esm/components/EmptyState/EmptyStateBody.d.ts.map +1 -1
- package/dist/esm/components/EmptyState/EmptyStateBody.js +1 -1
- package/dist/esm/components/EmptyState/EmptyStateBody.js.map +1 -1
- package/dist/esm/components/EmptyState/EmptyStateFooter.d.ts +9 -0
- package/dist/esm/components/EmptyState/EmptyStateFooter.d.ts.map +1 -0
- package/dist/esm/components/EmptyState/EmptyStateFooter.js +10 -0
- package/dist/esm/components/EmptyState/EmptyStateFooter.js.map +1 -0
- package/dist/esm/components/EmptyState/EmptyStateHeader.d.ts +18 -0
- package/dist/esm/components/EmptyState/EmptyStateHeader.d.ts.map +1 -0
- package/dist/esm/components/EmptyState/EmptyStateHeader.js +14 -0
- package/dist/esm/components/EmptyState/EmptyStateHeader.js.map +1 -0
- package/dist/esm/components/EmptyState/EmptyStateIcon.d.ts +3 -9
- package/dist/esm/components/EmptyState/EmptyStateIcon.d.ts.map +1 -1
- package/dist/esm/components/EmptyState/EmptyStateIcon.js +6 -4
- package/dist/esm/components/EmptyState/EmptyStateIcon.js.map +1 -1
- package/dist/esm/components/EmptyState/index.d.ts +4 -3
- package/dist/esm/components/EmptyState/index.d.ts.map +1 -1
- package/dist/esm/components/EmptyState/index.js +4 -3
- package/dist/esm/components/EmptyState/index.js.map +1 -1
- package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts +2 -0
- package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
- package/dist/esm/components/Pagination/PaginationOptionsMenu.js +2 -2
- package/dist/esm/components/Pagination/PaginationOptionsMenu.js.map +1 -1
- package/dist/esm/components/Popover/Popover.js +1 -1
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/Tabs/OverflowTab.js +1 -1
- package/dist/esm/components/Tabs/OverflowTab.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.d.ts +2 -0
- package/dist/esm/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +3 -3
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.d.ts +6 -2
- package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/helpers/Popper/Popper.js +26 -8
- package/dist/esm/helpers/Popper/Popper.js.map +1 -1
- package/dist/esm/next/components/Dropdown/Dropdown.d.ts +1 -3
- package/dist/esm/next/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/next/components/Dropdown/Dropdown.js +2 -6
- package/dist/esm/next/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/next/components/Select/Select.d.ts +3 -2
- package/dist/esm/next/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/next/components/Select/Select.js +3 -7
- package/dist/esm/next/components/Select/Select.js.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.d.ts +2 -0
- package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.js +3 -3
- package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/js/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
- package/dist/js/components/Dropdown/DropdownWithContext.js +2 -2
- package/dist/js/components/Dropdown/DropdownWithContext.js.map +1 -1
- package/dist/js/components/EmptyState/EmptyState.d.ts +6 -6
- package/dist/js/components/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/js/components/EmptyState/EmptyState.js +4 -4
- package/dist/js/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/js/components/EmptyState/EmptyStateActions.d.ts +9 -0
- package/dist/js/components/EmptyState/EmptyStateActions.d.ts.map +1 -0
- package/dist/js/components/EmptyState/EmptyStateActions.js +14 -0
- package/dist/js/components/EmptyState/EmptyStateActions.js.map +1 -0
- package/dist/js/components/EmptyState/EmptyStateBody.d.ts +2 -2
- package/dist/js/components/EmptyState/EmptyStateBody.d.ts.map +1 -1
- package/dist/js/components/EmptyState/EmptyStateBody.js +1 -1
- package/dist/js/components/EmptyState/EmptyStateBody.js.map +1 -1
- package/dist/js/components/EmptyState/EmptyStateFooter.d.ts +9 -0
- package/dist/js/components/EmptyState/EmptyStateFooter.d.ts.map +1 -0
- package/dist/js/components/EmptyState/EmptyStateFooter.js +14 -0
- package/dist/js/components/EmptyState/EmptyStateFooter.js.map +1 -0
- package/dist/js/components/EmptyState/EmptyStateHeader.d.ts +18 -0
- package/dist/js/components/EmptyState/EmptyStateHeader.d.ts.map +1 -0
- package/dist/js/components/EmptyState/EmptyStateHeader.js +18 -0
- package/dist/js/components/EmptyState/EmptyStateHeader.js.map +1 -0
- package/dist/js/components/EmptyState/EmptyStateIcon.d.ts +3 -9
- package/dist/js/components/EmptyState/EmptyStateIcon.d.ts.map +1 -1
- package/dist/js/components/EmptyState/EmptyStateIcon.js +6 -4
- package/dist/js/components/EmptyState/EmptyStateIcon.js.map +1 -1
- package/dist/js/components/EmptyState/index.d.ts +4 -3
- package/dist/js/components/EmptyState/index.d.ts.map +1 -1
- package/dist/js/components/EmptyState/index.js +4 -3
- package/dist/js/components/EmptyState/index.js.map +1 -1
- package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts +2 -0
- package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
- package/dist/js/components/Pagination/PaginationOptionsMenu.js +2 -2
- package/dist/js/components/Pagination/PaginationOptionsMenu.js.map +1 -1
- package/dist/js/components/Popover/Popover.js +1 -1
- package/dist/js/components/Popover/Popover.js.map +1 -1
- package/dist/js/components/Tabs/OverflowTab.js +1 -1
- package/dist/js/components/Tabs/OverflowTab.js.map +1 -1
- package/dist/js/components/Tooltip/Tooltip.d.ts +2 -0
- package/dist/js/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/js/components/Tooltip/Tooltip.js +3 -3
- package/dist/js/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.d.ts +6 -2
- package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/js/helpers/Popper/Popper.js +26 -8
- package/dist/js/helpers/Popper/Popper.js.map +1 -1
- package/dist/js/next/components/Dropdown/Dropdown.d.ts +1 -3
- package/dist/js/next/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/next/components/Dropdown/Dropdown.js +2 -6
- package/dist/js/next/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/js/next/components/Select/Select.d.ts +3 -2
- package/dist/js/next/components/Select/Select.d.ts.map +1 -1
- package/dist/js/next/components/Select/Select.js +3 -7
- package/dist/js/next/components/Select/Select.js.map +1 -1
- package/dist/umd/react-core.min.js +2 -2
- package/helpers/Popper/Popper.d.ts +6 -2
- package/helpers/Popper/Popper.d.ts.map +1 -1
- package/helpers/Popper/Popper.js +26 -8
- package/helpers/Popper/Popper.js.map +1 -1
- package/next/components/Dropdown/Dropdown.d.ts +1 -3
- package/next/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/next/components/Dropdown/Dropdown.js +2 -6
- package/next/components/Dropdown/Dropdown.js.map +1 -1
- package/next/components/Select/Select.d.ts +3 -2
- package/next/components/Select/Select.d.ts.map +1 -1
- package/next/components/Select/Select.js +3 -7
- package/next/components/Select/Select.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Dropdown/Dropdown.tsx +5 -1
- package/src/components/Dropdown/DropdownWithContext.tsx +2 -1
- package/src/components/DualListSelector/examples/DualListSelectorComposable.tsx +32 -30
- package/src/components/DualListSelector/examples/DualListSelectorComposableTree.tsx +38 -34
- package/src/components/EmptyState/EmptyState.tsx +9 -9
- package/src/components/EmptyState/EmptyStateActions.tsx +21 -0
- package/src/components/EmptyState/EmptyStateBody.tsx +3 -3
- package/src/components/EmptyState/EmptyStateFooter.tsx +21 -0
- package/src/components/EmptyState/EmptyStateHeader.tsx +42 -0
- package/src/components/EmptyState/EmptyStateIcon.tsx +15 -18
- package/src/components/EmptyState/__tests__/EmptyState.test.tsx +53 -60
- package/src/components/EmptyState/__tests__/Generated/{EmptyStatePrimary.test.tsx → EmptyStateActions.test.tsx} +3 -3
- package/src/components/EmptyState/__tests__/Generated/EmptyStateIcon.test.tsx +3 -6
- package/src/components/EmptyState/__tests__/Generated/__snapshots__/{EmptyStateSecondaryActions.test.tsx.snap → EmptyStateActions.test.tsx.snap} +2 -2
- package/src/components/EmptyState/__tests__/Generated/__snapshots__/EmptyStateIcon.test.tsx.snap +41 -22
- package/src/components/EmptyState/__tests__/__snapshots__/EmptyState.test.tsx.snap +115 -56
- package/src/components/EmptyState/examples/EmptyState.md +7 -3
- package/src/components/EmptyState/examples/EmptyStateBasic.tsx +20 -18
- package/src/components/EmptyState/examples/EmptyStateCustomIconColor.tsx +17 -0
- package/src/components/EmptyState/examples/EmptyStateExtraLarge.tsx +20 -18
- package/src/components/EmptyState/examples/EmptyStateExtraSmall.tsx +16 -15
- package/src/components/EmptyState/examples/EmptyStateLarge.tsx +21 -19
- package/src/components/EmptyState/examples/EmptyStateNoMatchFound.tsx +15 -8
- package/src/components/EmptyState/examples/EmptyStateSmall.tsx +21 -19
- package/src/components/EmptyState/examples/EmptyStateSpinner.tsx +2 -5
- package/src/components/EmptyState/index.ts +4 -3
- package/src/components/LabelGroup/examples/LabelGroupEditableAddDropdown.tsx +1 -8
- package/src/components/LabelGroup/examples/LabelGroupEditableAddModal.tsx +0 -2
- package/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap +1 -1
- package/src/components/NotificationDrawer/examples/NotificationDrawerGroups.tsx +15 -11
- package/src/components/NotificationDrawer/examples/NotificationDrawerLightweight.tsx +14 -10
- package/src/components/Pagination/PaginationOptionsMenu.tsx +4 -1
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +1 -1
- package/src/components/Tabs/OverflowTab.tsx +1 -1
- package/src/components/Tabs/__tests__/OverflowTab.test.tsx +12 -20
- package/src/components/Tabs/__tests__/__snapshots__/OverflowTab.test.tsx.snap +0 -6
- package/src/components/Tooltip/Tooltip.tsx +4 -1
- package/src/components/Wizard/examples/Wizard.md +1 -1
- package/src/components/Wizard/examples/WizardFinished.tsx +18 -14
- package/src/components/Wizard/examples/WizardValidateOnButtonPress.tsx +20 -16
- package/src/demos/Card/Card.md +13 -8
- package/src/demos/ComposableMenu/examples/ComposableActionsMenu.tsx +1 -15
- package/src/demos/ComposableMenu/examples/ComposableApplicationLauncher.tsx +1 -10
- package/src/demos/ComposableMenu/examples/ComposableContextSelector.tsx +2 -21
- package/src/demos/ComposableMenu/examples/ComposableDateSelect.tsx +1 -10
- package/src/demos/ComposableMenu/examples/ComposableDrilldownMenu.tsx +1 -15
- package/src/demos/ComposableMenu/examples/ComposableDropdwnVariants.tsx +1 -8
- package/src/demos/ComposableMenu/examples/ComposableFlyout.tsx +1 -10
- package/src/demos/ComposableMenu/examples/ComposableTreeViewMenu.tsx +1 -10
- package/src/demos/Filters/FilterDemos.md +4 -2
- package/src/demos/Filters/examples/FilterAttributeSearch.tsx +20 -21
- package/src/demos/Filters/examples/FilterCheckboxSelect.tsx +0 -1
- package/src/demos/Filters/examples/FilterFaceted.tsx +19 -20
- package/src/demos/Filters/examples/FilterMixedSelectGroup.tsx +19 -20
- package/src/demos/Filters/examples/FilterSameSelectGroup.tsx +19 -20
- package/src/demos/Filters/examples/FilterSearchInput.tsx +18 -19
- package/src/demos/Filters/examples/FilterSingleSelect.tsx +0 -1
- package/src/demos/NotificationDrawer/NotificationDrawer.md +52 -39
- package/src/demos/examples/AlertGroup/AlertGroupToastWithNotificationDrawer.tsx +19 -17
- package/src/helpers/Popper/Popper.tsx +39 -10
- package/src/next/components/Dropdown/Dropdown.tsx +1 -9
- package/src/next/components/Dropdown/__tests__/Dropdown.test.tsx +18 -38
- package/src/next/components/Dropdown/examples/DropdownWithDescriptions.tsx +3 -4
- package/src/next/components/Dropdown/examples/DropdownWithKebabToggle.tsx +3 -4
- package/src/next/components/Select/Select.tsx +5 -9
- package/src/next/components/Wizard/examples/WizardValidateOnButtonPress.tsx +19 -15
- package/src/next/components/Wizard/examples/WizardWithSubmitProgress.tsx +18 -14
- package/components/EmptyState/EmptyStatePrimary.d.ts +0 -9
- package/components/EmptyState/EmptyStatePrimary.d.ts.map +0 -1
- package/components/EmptyState/EmptyStatePrimary.js +0 -9
- package/components/EmptyState/EmptyStatePrimary.js.map +0 -1
- package/components/EmptyState/EmptyStateSecondaryActions.d.ts +0 -9
- package/components/EmptyState/EmptyStateSecondaryActions.d.ts.map +0 -1
- package/components/EmptyState/EmptyStateSecondaryActions.js +0 -9
- package/components/EmptyState/EmptyStateSecondaryActions.js.map +0 -1
- package/dist/esm/components/EmptyState/EmptyStatePrimary.d.ts +0 -9
- package/dist/esm/components/EmptyState/EmptyStatePrimary.d.ts.map +0 -1
- package/dist/esm/components/EmptyState/EmptyStatePrimary.js +0 -9
- package/dist/esm/components/EmptyState/EmptyStatePrimary.js.map +0 -1
- package/dist/esm/components/EmptyState/EmptyStateSecondaryActions.d.ts +0 -9
- package/dist/esm/components/EmptyState/EmptyStateSecondaryActions.d.ts.map +0 -1
- package/dist/esm/components/EmptyState/EmptyStateSecondaryActions.js +0 -9
- package/dist/esm/components/EmptyState/EmptyStateSecondaryActions.js.map +0 -1
- package/dist/js/components/EmptyState/EmptyStatePrimary.d.ts +0 -9
- package/dist/js/components/EmptyState/EmptyStatePrimary.d.ts.map +0 -1
- package/dist/js/components/EmptyState/EmptyStatePrimary.js +0 -13
- package/dist/js/components/EmptyState/EmptyStatePrimary.js.map +0 -1
- package/dist/js/components/EmptyState/EmptyStateSecondaryActions.d.ts +0 -9
- package/dist/js/components/EmptyState/EmptyStateSecondaryActions.d.ts.map +0 -1
- package/dist/js/components/EmptyState/EmptyStateSecondaryActions.js +0 -13
- package/dist/js/components/EmptyState/EmptyStateSecondaryActions.js.map +0 -1
- package/src/components/EmptyState/EmptyStatePrimary.tsx +0 -20
- package/src/components/EmptyState/EmptyStateSecondaryActions.tsx +0 -18
- package/src/components/EmptyState/__tests__/Generated/EmptyStateSecondaryActions.test.tsx +0 -13
- 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
|
-
|
|
14
|
+
EmptyStateHeader,
|
|
15
|
+
EmptyStateFooter,
|
|
16
16
|
EmptyStateBody,
|
|
17
|
-
|
|
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.
|
|
261
|
-
<
|
|
262
|
-
|
|
263
|
-
No results found
|
|
264
|
-
|
|
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
|
-
<
|
|
267
|
-
<
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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
|
-
|
|
8
|
-
|
|
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
|
|
14
|
+
/** Additional classes added to the empty state */
|
|
15
15
|
className?: string;
|
|
16
|
-
/** Content rendered inside the
|
|
16
|
+
/** Content rendered inside the empty state */
|
|
17
17
|
children: React.ReactNode;
|
|
18
|
-
/** Modifies
|
|
19
|
-
variant?: 'xs' | '
|
|
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 === '
|
|
36
|
-
variant === '
|
|
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
|
|
6
|
+
/** Content rendered inside the empty state body */
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
-
/** Additional classes added to the
|
|
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
|
|
12
|
+
/** Additional classes added to the empty state icon */
|
|
12
13
|
className?: string;
|
|
13
|
-
/** Icon component to be rendered
|
|
14
|
-
|
|
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
|
-
|
|
27
|
-
variant = 'icon',
|
|
23
|
+
color,
|
|
28
24
|
...props
|
|
29
25
|
}: EmptyStateIconProps) => {
|
|
30
|
-
const
|
|
31
|
-
return
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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 {
|
|
9
|
-
import { EmptyStateIcon } from '../EmptyStateIcon';
|
|
10
|
-
import { EmptyStatePrimary } from '../EmptyStatePrimary';
|
|
9
|
+
import { EmptyStateActions } from '../EmptyStateActions';
|
|
11
10
|
import { Button } from '../../Button';
|
|
12
|
-
import {
|
|
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
|
-
<
|
|
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
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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.
|
|
38
|
-
<
|
|
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.
|
|
49
|
-
<
|
|
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
|
-
<
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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('
|
|
82
|
-
render(<EmptyStateIcon icon={AddressBookIcon}
|
|
83
|
-
expect(
|
|
84
|
+
test('Header with icon', () => {
|
|
85
|
+
const { asFragment } = render(<EmptyStateHeader icon={<EmptyStateIcon icon={AddressBookIcon} />} />);
|
|
86
|
+
expect(asFragment()).toMatchSnapshot();
|
|
84
87
|
});
|
|
85
88
|
|
|
86
|
-
test('
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
97
|
-
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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('
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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 {
|
|
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('
|
|
11
|
-
const { asFragment } = render(<
|
|
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={
|
|
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[`
|
|
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>
|