@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
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
DropdownItem,
|
|
6
6
|
EmptyState,
|
|
7
7
|
EmptyStateBody,
|
|
8
|
+
EmptyStateHeader,
|
|
8
9
|
EmptyStateIcon,
|
|
9
10
|
KebabToggle,
|
|
10
11
|
NotificationBadge,
|
|
@@ -20,7 +21,6 @@ import {
|
|
|
20
21
|
PageSectionVariants,
|
|
21
22
|
TextContent,
|
|
22
23
|
Text,
|
|
23
|
-
Title,
|
|
24
24
|
DropdownPosition,
|
|
25
25
|
EmptyStateVariant,
|
|
26
26
|
NumberInput,
|
|
@@ -69,13 +69,13 @@ export const AlertGroupToastWithNotificationDrawer: React.FunctionComponent = ()
|
|
|
69
69
|
const key = getUniqueId();
|
|
70
70
|
const timestamp = getTimeCreated();
|
|
71
71
|
|
|
72
|
-
setNotifications(prevNotifications => [
|
|
72
|
+
setNotifications((prevNotifications) => [
|
|
73
73
|
{ title, srTitle, variant, key, timestamp, description, isNotificationRead: false },
|
|
74
74
|
...prevNotifications
|
|
75
75
|
]);
|
|
76
76
|
|
|
77
77
|
if (!isDrawerExpanded) {
|
|
78
|
-
setAlerts(prevAlerts => [
|
|
78
|
+
setAlerts((prevAlerts) => [
|
|
79
79
|
<Alert
|
|
80
80
|
variant={variant}
|
|
81
81
|
title={title}
|
|
@@ -96,7 +96,7 @@ export const AlertGroupToastWithNotificationDrawer: React.FunctionComponent = ()
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
const removeNotification = (key: React.Key) => {
|
|
99
|
-
setNotifications(prevNotifications => prevNotifications.filter(notification => notification.key !== key));
|
|
99
|
+
setNotifications((prevNotifications) => prevNotifications.filter((notification) => notification.key !== key));
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
const removeAllNotifications = () => {
|
|
@@ -104,28 +104,29 @@ export const AlertGroupToastWithNotificationDrawer: React.FunctionComponent = ()
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
const isNotificationRead = (key: React.Key) =>
|
|
107
|
-
notifications.find(notification => notification.key === key)?.isNotificationRead;
|
|
107
|
+
notifications.find((notification) => notification.key === key)?.isNotificationRead;
|
|
108
108
|
|
|
109
109
|
const markNotificationRead = (key: React.Key) => {
|
|
110
|
-
setNotifications(prevNotifications =>
|
|
111
|
-
prevNotifications.map(notification =>
|
|
110
|
+
setNotifications((prevNotifications) =>
|
|
111
|
+
prevNotifications.map((notification) =>
|
|
112
112
|
notification.key === key ? { ...notification, isNotificationRead: true } : notification
|
|
113
113
|
)
|
|
114
114
|
);
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
const markAllNotificationsRead = () => {
|
|
118
|
-
setNotifications(prevNotifications =>
|
|
119
|
-
prevNotifications.map(notification => ({ ...notification, isNotificationRead: true }))
|
|
118
|
+
setNotifications((prevNotifications) =>
|
|
119
|
+
prevNotifications.map((notification) => ({ ...notification, isNotificationRead: true }))
|
|
120
120
|
);
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
const getUnreadNotificationsNumber = () =>
|
|
124
|
-
notifications.filter(notification => notification.isNotificationRead === false).length;
|
|
124
|
+
notifications.filter((notification) => notification.isNotificationRead === false).length;
|
|
125
125
|
|
|
126
126
|
const containsUnreadAlertNotification = () =>
|
|
127
|
-
notifications.filter(
|
|
128
|
-
.
|
|
127
|
+
notifications.filter(
|
|
128
|
+
(notification) => notification.isNotificationRead === false && notification.variant === 'danger'
|
|
129
|
+
).length > 0;
|
|
129
130
|
|
|
130
131
|
const getNotificationBadgeVariant = () => {
|
|
131
132
|
if (getUnreadNotificationsNumber() === 0) {
|
|
@@ -176,7 +177,7 @@ export const AlertGroupToastWithNotificationDrawer: React.FunctionComponent = ()
|
|
|
176
177
|
};
|
|
177
178
|
|
|
178
179
|
const removeAlert = (key: React.Key) => {
|
|
179
|
-
setAlerts(prevAlerts => prevAlerts.filter(alert => alert.props.id !== key.toString()));
|
|
180
|
+
setAlerts((prevAlerts) => prevAlerts.filter((alert) => alert.props.id !== key.toString()));
|
|
180
181
|
};
|
|
181
182
|
|
|
182
183
|
const removeAllAlerts = () => {
|
|
@@ -281,10 +282,11 @@ export const AlertGroupToastWithNotificationDrawer: React.FunctionComponent = ()
|
|
|
281
282
|
)}
|
|
282
283
|
{notifications.length === 0 && (
|
|
283
284
|
<EmptyState variant={EmptyStateVariant.full}>
|
|
284
|
-
<
|
|
285
|
-
|
|
286
|
-
No notifications found
|
|
287
|
-
|
|
285
|
+
<EmptyStateHeader
|
|
286
|
+
headingLevel="h2"
|
|
287
|
+
titleText="No notifications found"
|
|
288
|
+
icon={<EmptyStateIcon icon={SearchIcon} />}
|
|
289
|
+
/>
|
|
288
290
|
<EmptyStateBody>There are currently no notifications.</EmptyStateBody>
|
|
289
291
|
</EmptyState>
|
|
290
292
|
)}
|
|
@@ -62,14 +62,18 @@ export interface PopperProps {
|
|
|
62
62
|
* Passing this prop will remove the wrapper div element from the popper.
|
|
63
63
|
*/
|
|
64
64
|
popperRef?: HTMLElement | (() => HTMLElement) | React.RefObject<any>;
|
|
65
|
-
/** True to set the width of the popper element to the trigger element's width */
|
|
66
|
-
popperMatchesTriggerWidth?: boolean;
|
|
67
65
|
/** popper direction */
|
|
68
66
|
direction?: 'up' | 'down';
|
|
69
67
|
/** popper position */
|
|
70
68
|
position?: 'right' | 'left' | 'center';
|
|
71
69
|
/** Instead of direction and position can set the placement of the popper */
|
|
72
70
|
placement?: Placement;
|
|
71
|
+
/** Custsom width of the popper. If the value is "trigger", it will set the width to the trigger element's width */
|
|
72
|
+
width?: string | 'trigger';
|
|
73
|
+
/** Minimum width of the popper. If the value is "trigger", it will set the min width to the trigger element's width */
|
|
74
|
+
minWidth?: string | 'trigger';
|
|
75
|
+
/** Maximum width of the popper. If the value is "trigger", it will set the max width to the trigger element's width */
|
|
76
|
+
maxWidth?: string | 'trigger';
|
|
73
77
|
/** The container to append the popper to. Defaults to 'inline'. */
|
|
74
78
|
appendTo?: HTMLElement | (() => HTMLElement) | 'inline';
|
|
75
79
|
/** z-index of the popper element */
|
|
@@ -147,10 +151,12 @@ export interface PopperProps {
|
|
|
147
151
|
export const Popper: React.FunctionComponent<PopperProps> = ({
|
|
148
152
|
trigger,
|
|
149
153
|
popper,
|
|
150
|
-
popperMatchesTriggerWidth = true,
|
|
151
154
|
direction = 'down',
|
|
152
155
|
position = 'left',
|
|
153
156
|
placement,
|
|
157
|
+
width,
|
|
158
|
+
minWidth = 'trigger',
|
|
159
|
+
maxWidth,
|
|
154
160
|
appendTo = 'inline',
|
|
155
161
|
zIndex = 9999,
|
|
156
162
|
isVisible = true,
|
|
@@ -279,21 +285,44 @@ export const Popper: React.FunctionComponent<PopperProps> = ({
|
|
|
279
285
|
() => getOppositePlacement(getPlacement()),
|
|
280
286
|
[direction, position, placement]
|
|
281
287
|
);
|
|
282
|
-
|
|
288
|
+
|
|
289
|
+
const widthMods: Modifier<'widthMods', {}> = React.useMemo(
|
|
283
290
|
() => ({
|
|
284
|
-
name: '
|
|
285
|
-
enabled:
|
|
291
|
+
name: 'widthMods',
|
|
292
|
+
enabled: width !== undefined || minWidth !== undefined || maxWidth !== undefined,
|
|
286
293
|
phase: 'beforeWrite',
|
|
287
294
|
requires: ['computeStyles'],
|
|
288
295
|
fn: ({ state }) => {
|
|
289
|
-
|
|
296
|
+
const triggerWidth = state.rects.reference.width;
|
|
297
|
+
if (width) {
|
|
298
|
+
state.styles.popper.width = width === 'trigger' ? `${triggerWidth}px` : width;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (minWidth) {
|
|
302
|
+
state.styles.popper.minWidth = minWidth === 'trigger' ? `${triggerWidth}px` : minWidth;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (maxWidth) {
|
|
306
|
+
state.styles.popper.maxWidth = maxWidth === 'trigger' ? `${triggerWidth}px` : maxWidth;
|
|
307
|
+
}
|
|
290
308
|
},
|
|
291
309
|
effect: ({ state }) => {
|
|
292
|
-
|
|
310
|
+
const triggerWidth = (state.elements.reference as HTMLElement).offsetWidth;
|
|
311
|
+
if (width) {
|
|
312
|
+
state.elements.popper.style.width = width === 'trigger' ? `${triggerWidth}px` : width;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (minWidth) {
|
|
316
|
+
state.elements.popper.style.minWidth = minWidth === 'trigger' ? `${triggerWidth}px` : minWidth;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (maxWidth) {
|
|
320
|
+
state.elements.popper.style.maxWidth = maxWidth === 'trigger' ? `${triggerWidth}px` : maxWidth;
|
|
321
|
+
}
|
|
293
322
|
return () => {};
|
|
294
323
|
}
|
|
295
324
|
}),
|
|
296
|
-
[
|
|
325
|
+
[width, minWidth, maxWidth]
|
|
297
326
|
);
|
|
298
327
|
|
|
299
328
|
const {
|
|
@@ -326,7 +355,7 @@ export const Popper: React.FunctionComponent<PopperProps> = ({
|
|
|
326
355
|
fallbackPlacements: flipBehavior === 'flip' ? [getOppositePlacementMemo] : flipBehavior
|
|
327
356
|
}
|
|
328
357
|
},
|
|
329
|
-
|
|
358
|
+
widthMods
|
|
330
359
|
]
|
|
331
360
|
});
|
|
332
361
|
|
|
@@ -22,8 +22,6 @@ export interface DropdownProps extends MenuProps, OUIAProps {
|
|
|
22
22
|
isPlain?: boolean;
|
|
23
23
|
/** Indicates if the menu should be scrollable. */
|
|
24
24
|
isScrollable?: boolean;
|
|
25
|
-
/** Min width of the menu. */
|
|
26
|
-
minWidth?: string;
|
|
27
25
|
/** @hide Forwarded ref */
|
|
28
26
|
innerRef?: React.Ref<any>;
|
|
29
27
|
/** Value to overwrite the randomly generated data-ouia-component-id.*/
|
|
@@ -33,7 +31,7 @@ export interface DropdownProps extends MenuProps, OUIAProps {
|
|
|
33
31
|
/** z-index of the dropdown menu */
|
|
34
32
|
zIndex?: number;
|
|
35
33
|
/** Additional properties to pass to the Popper */
|
|
36
|
-
popperProps?: PopperProps
|
|
34
|
+
popperProps?: Partial<PopperProps>;
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
const DropdownBase: React.FunctionComponent<DropdownProps> = ({
|
|
@@ -45,7 +43,6 @@ const DropdownBase: React.FunctionComponent<DropdownProps> = ({
|
|
|
45
43
|
onOpenChange,
|
|
46
44
|
isPlain,
|
|
47
45
|
isScrollable,
|
|
48
|
-
minWidth,
|
|
49
46
|
innerRef,
|
|
50
47
|
ouiaId,
|
|
51
48
|
ouiaSafe = true,
|
|
@@ -106,11 +103,6 @@ const DropdownBase: React.FunctionComponent<DropdownProps> = ({
|
|
|
106
103
|
onSelect={(event, itemId) => onSelect && onSelect(event, itemId)}
|
|
107
104
|
isPlain={isPlain}
|
|
108
105
|
isScrollable={isScrollable}
|
|
109
|
-
{...(minWidth && {
|
|
110
|
-
style: {
|
|
111
|
-
'--pf-c-menu--MinWidth': minWidth
|
|
112
|
-
} as React.CSSProperties
|
|
113
|
-
})}
|
|
114
106
|
{...props}
|
|
115
107
|
>
|
|
116
108
|
<MenuContent>{children}</MenuContent>
|
|
@@ -14,7 +14,7 @@ const dropdownChildren = <div>Dropdown children</div>;
|
|
|
14
14
|
test('renders dropdown', () => {
|
|
15
15
|
render(
|
|
16
16
|
<div data-testid="dropdown">
|
|
17
|
-
<Dropdown toggle={toggleRef => toggle(toggleRef)}>{dropdownChildren}</Dropdown>
|
|
17
|
+
<Dropdown toggle={(toggleRef) => toggle(toggleRef)}>{dropdownChildren}</Dropdown>
|
|
18
18
|
</div>
|
|
19
19
|
);
|
|
20
20
|
|
|
@@ -22,20 +22,20 @@ test('renders dropdown', () => {
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
test('passes children', () => {
|
|
25
|
-
render(<Dropdown toggle={toggleRef => toggle(toggleRef)}>{dropdownChildren}</Dropdown>);
|
|
25
|
+
render(<Dropdown toggle={(toggleRef) => toggle(toggleRef)}>{dropdownChildren}</Dropdown>);
|
|
26
26
|
|
|
27
27
|
expect(screen.getByText('Dropdown children')).toBeVisible();
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
test('renders passed toggle element', () => {
|
|
31
|
-
render(<Dropdown toggle={toggleRef => toggle(toggleRef)}>{dropdownChildren}</Dropdown>);
|
|
31
|
+
render(<Dropdown toggle={(toggleRef) => toggle(toggleRef)}>{dropdownChildren}</Dropdown>);
|
|
32
32
|
|
|
33
33
|
expect(screen.getByRole('button', { name: 'Dropdown' })).toBeVisible();
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
test('passes no class name by default', () => {
|
|
37
37
|
render(
|
|
38
|
-
<Dropdown isOpen={true} toggle={toggleRef => toggle(toggleRef)}>
|
|
38
|
+
<Dropdown isOpen={true} toggle={(toggleRef) => toggle(toggleRef)}>
|
|
39
39
|
{dropdownChildren}
|
|
40
40
|
</Dropdown>
|
|
41
41
|
);
|
|
@@ -45,7 +45,7 @@ test('passes no class name by default', () => {
|
|
|
45
45
|
|
|
46
46
|
test('passes custom class name', () => {
|
|
47
47
|
render(
|
|
48
|
-
<Dropdown className="custom-class" isOpen={true} toggle={toggleRef => toggle(toggleRef)}>
|
|
48
|
+
<Dropdown className="custom-class" isOpen={true} toggle={(toggleRef) => toggle(toggleRef)}>
|
|
49
49
|
{dropdownChildren}
|
|
50
50
|
</Dropdown>
|
|
51
51
|
);
|
|
@@ -55,7 +55,7 @@ test('passes custom class name', () => {
|
|
|
55
55
|
|
|
56
56
|
test('does not pass isPlain to Menu by default', () => {
|
|
57
57
|
render(
|
|
58
|
-
<Dropdown isOpen={true} toggle={toggleRef => toggle(toggleRef)}>
|
|
58
|
+
<Dropdown isOpen={true} toggle={(toggleRef) => toggle(toggleRef)}>
|
|
59
59
|
{dropdownChildren}
|
|
60
60
|
</Dropdown>
|
|
61
61
|
);
|
|
@@ -65,7 +65,7 @@ test('does not pass isPlain to Menu by default', () => {
|
|
|
65
65
|
|
|
66
66
|
test('passes isPlain to Menu', () => {
|
|
67
67
|
render(
|
|
68
|
-
<Dropdown isPlain isOpen={true} toggle={toggleRef => toggle(toggleRef)}>
|
|
68
|
+
<Dropdown isPlain isOpen={true} toggle={(toggleRef) => toggle(toggleRef)}>
|
|
69
69
|
{dropdownChildren}
|
|
70
70
|
</Dropdown>
|
|
71
71
|
);
|
|
@@ -75,7 +75,7 @@ test('passes isPlain to Menu', () => {
|
|
|
75
75
|
|
|
76
76
|
test('does not pass isScrollable to Menu by default', () => {
|
|
77
77
|
render(
|
|
78
|
-
<Dropdown isOpen={true} toggle={toggleRef => toggle(toggleRef)}>
|
|
78
|
+
<Dropdown isOpen={true} toggle={(toggleRef) => toggle(toggleRef)}>
|
|
79
79
|
{dropdownChildren}
|
|
80
80
|
</Dropdown>
|
|
81
81
|
);
|
|
@@ -85,7 +85,7 @@ test('does not pass isScrollable to Menu by default', () => {
|
|
|
85
85
|
|
|
86
86
|
test('passes isScrollable to Menu', () => {
|
|
87
87
|
render(
|
|
88
|
-
<Dropdown isScrollable isOpen={true} toggle={toggleRef => toggle(toggleRef)}>
|
|
88
|
+
<Dropdown isScrollable isOpen={true} toggle={(toggleRef) => toggle(toggleRef)}>
|
|
89
89
|
{dropdownChildren}
|
|
90
90
|
</Dropdown>
|
|
91
91
|
);
|
|
@@ -93,35 +93,15 @@ test('passes isScrollable to Menu', () => {
|
|
|
93
93
|
expect(screen.getByText('isScrollable: true')).toBeVisible();
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
test('does not pass minWidth to Menu by default', () => {
|
|
97
|
-
render(
|
|
98
|
-
<Dropdown isOpen={true} toggle={toggleRef => toggle(toggleRef)}>
|
|
99
|
-
{dropdownChildren}
|
|
100
|
-
</Dropdown>
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
expect(screen.getByText('minWidth: undefined')).toBeVisible();
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
test('passes minWidth to Menu', () => {
|
|
107
|
-
render(
|
|
108
|
-
<Dropdown minWidth="100px" isOpen={true} toggle={toggleRef => toggle(toggleRef)}>
|
|
109
|
-
{dropdownChildren}
|
|
110
|
-
</Dropdown>
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
expect(screen.getByText('minWidth: 100px')).toBeVisible();
|
|
114
|
-
});
|
|
115
|
-
|
|
116
96
|
test('passes default zIndex to popper', () => {
|
|
117
|
-
render(<Dropdown toggle={toggleRef => toggle(toggleRef)}>{dropdownChildren}</Dropdown>);
|
|
97
|
+
render(<Dropdown toggle={(toggleRef) => toggle(toggleRef)}>{dropdownChildren}</Dropdown>);
|
|
118
98
|
|
|
119
99
|
expect(screen.getByText('zIndex: 9999')).toBeVisible();
|
|
120
100
|
});
|
|
121
101
|
|
|
122
102
|
test('passes zIndex to popper', () => {
|
|
123
103
|
render(
|
|
124
|
-
<Dropdown zIndex={100} toggle={toggleRef => toggle(toggleRef)}>
|
|
104
|
+
<Dropdown zIndex={100} toggle={(toggleRef) => toggle(toggleRef)}>
|
|
125
105
|
{dropdownChildren}
|
|
126
106
|
</Dropdown>
|
|
127
107
|
);
|
|
@@ -130,14 +110,14 @@ test('passes zIndex to popper', () => {
|
|
|
130
110
|
});
|
|
131
111
|
|
|
132
112
|
test('does not pass isOpen to popper by default', () => {
|
|
133
|
-
render(<Dropdown toggle={toggleRef => toggle(toggleRef)}>{dropdownChildren}</Dropdown>);
|
|
113
|
+
render(<Dropdown toggle={(toggleRef) => toggle(toggleRef)}>{dropdownChildren}</Dropdown>);
|
|
134
114
|
|
|
135
115
|
expect(screen.getByText('isOpen: undefined')).toBeVisible();
|
|
136
116
|
});
|
|
137
117
|
|
|
138
118
|
test('passes isOpen to popper', () => {
|
|
139
119
|
render(
|
|
140
|
-
<Dropdown isOpen toggle={toggleRef => toggle(toggleRef)}>
|
|
120
|
+
<Dropdown isOpen toggle={(toggleRef) => toggle(toggleRef)}>
|
|
141
121
|
{dropdownChildren}
|
|
142
122
|
</Dropdown>
|
|
143
123
|
);
|
|
@@ -154,7 +134,7 @@ test('passes onSelect callback', async () => {
|
|
|
154
134
|
|
|
155
135
|
const onSelect = jest.fn();
|
|
156
136
|
render(
|
|
157
|
-
<Dropdown onSelect={onSelect} toggle={toggleRef => toggle(toggleRef)}>
|
|
137
|
+
<Dropdown onSelect={onSelect} toggle={(toggleRef) => toggle(toggleRef)}>
|
|
158
138
|
{dropdownChildren}
|
|
159
139
|
</Dropdown>
|
|
160
140
|
);
|
|
@@ -170,7 +150,7 @@ test('onOpenChange is called when passed and user clicks outside of dropdown', a
|
|
|
170
150
|
const onOpenChange = jest.fn();
|
|
171
151
|
|
|
172
152
|
render(
|
|
173
|
-
<Dropdown isOpen={true} onOpenChange={onOpenChange} toggle={toggleRef => toggle(toggleRef)}>
|
|
153
|
+
<Dropdown isOpen={true} onOpenChange={onOpenChange} toggle={(toggleRef) => toggle(toggleRef)}>
|
|
174
154
|
{dropdownChildren}
|
|
175
155
|
</Dropdown>
|
|
176
156
|
);
|
|
@@ -187,7 +167,7 @@ test('onOpenChange is called when passed and user presses tab key', async () =>
|
|
|
187
167
|
const onOpenChange = jest.fn();
|
|
188
168
|
|
|
189
169
|
render(
|
|
190
|
-
<Dropdown isOpen={true} onOpenChange={onOpenChange} toggle={toggleRef => toggle(toggleRef)}>
|
|
170
|
+
<Dropdown isOpen={true} onOpenChange={onOpenChange} toggle={(toggleRef) => toggle(toggleRef)}>
|
|
191
171
|
{dropdownChildren}
|
|
192
172
|
</Dropdown>
|
|
193
173
|
);
|
|
@@ -205,7 +185,7 @@ test('onOpenChange is called when passed and user presses esc key', async () =>
|
|
|
205
185
|
const onOpenChange = jest.fn();
|
|
206
186
|
|
|
207
187
|
render(
|
|
208
|
-
<Dropdown isOpen={true} onOpenChange={onOpenChange} toggle={toggleRef => toggle(toggleRef)}>
|
|
188
|
+
<Dropdown isOpen={true} onOpenChange={onOpenChange} toggle={(toggleRef) => toggle(toggleRef)}>
|
|
209
189
|
{dropdownChildren}
|
|
210
190
|
</Dropdown>
|
|
211
191
|
);
|
|
@@ -226,7 +206,7 @@ test('match snapshot', () => {
|
|
|
226
206
|
isScrollable
|
|
227
207
|
isPlain
|
|
228
208
|
className={'customClass'}
|
|
229
|
-
toggle={toggleRef => toggle(toggleRef)}
|
|
209
|
+
toggle={(toggleRef) => toggle(toggleRef)}
|
|
230
210
|
>
|
|
231
211
|
{dropdownChildren}
|
|
232
212
|
</Dropdown>
|
|
@@ -19,9 +19,8 @@ export const DropdownWithDescriptions: React.FunctionComponent = () => {
|
|
|
19
19
|
<Dropdown
|
|
20
20
|
isOpen={isOpen}
|
|
21
21
|
onSelect={onSelect}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
toggle={toggleRef => (
|
|
22
|
+
onOpenChange={(isOpen) => setIsOpen(isOpen)}
|
|
23
|
+
toggle={(toggleRef) => (
|
|
25
24
|
<MenuToggle ref={toggleRef} isFullWidth onClick={onToggleClick} isExpanded={isOpen}>
|
|
26
25
|
Dropdown
|
|
27
26
|
</MenuToggle>
|
|
@@ -36,7 +35,7 @@ export const DropdownWithDescriptions: React.FunctionComponent = () => {
|
|
|
36
35
|
key="action"
|
|
37
36
|
description="This is a very long description that describes the menu item"
|
|
38
37
|
to="#default-link2"
|
|
39
|
-
onClick={ev => ev.preventDefault()}
|
|
38
|
+
onClick={(ev) => ev.preventDefault()}
|
|
40
39
|
>
|
|
41
40
|
Action
|
|
42
41
|
</DropdownItem>
|
|
@@ -20,9 +20,8 @@ export const DropdownWithKebab: React.FunctionComponent = () => {
|
|
|
20
20
|
<Dropdown
|
|
21
21
|
isOpen={isOpen}
|
|
22
22
|
onSelect={onSelect}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
toggle={toggleRef => (
|
|
23
|
+
onOpenChange={(isOpen) => setIsOpen(isOpen)}
|
|
24
|
+
toggle={(toggleRef) => (
|
|
26
25
|
<MenuToggle
|
|
27
26
|
ref={toggleRef}
|
|
28
27
|
aria-label="kebab dropdown toggle"
|
|
@@ -38,7 +37,7 @@ export const DropdownWithKebab: React.FunctionComponent = () => {
|
|
|
38
37
|
<DropdownItem itemId={0} key="link">
|
|
39
38
|
Link
|
|
40
39
|
</DropdownItem>
|
|
41
|
-
<DropdownItem itemId={1} key="action" to="#default-link2" onClick={ev => ev.preventDefault()}>
|
|
40
|
+
<DropdownItem itemId={1} key="action" to="#default-link2" onClick={(ev) => ev.preventDefault()}>
|
|
42
41
|
Action
|
|
43
42
|
</DropdownItem>
|
|
44
43
|
<DropdownItem itemId={2} isDisabled key="disabled link">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
import { Menu, MenuContent, MenuProps } from '../../../components/Menu';
|
|
4
|
-
import { Popper } from '../../../helpers/Popper/Popper';
|
|
4
|
+
import { Popper, PopperProps } from '../../../helpers/Popper/Popper';
|
|
5
5
|
import { getOUIAProps, OUIAProps, getDefaultOUIAId } from '../../../helpers';
|
|
6
6
|
|
|
7
7
|
export interface SelectProps extends MenuProps, OUIAProps {
|
|
@@ -22,14 +22,14 @@ export interface SelectProps extends MenuProps, OUIAProps {
|
|
|
22
22
|
onOpenChange?: (isOpen: boolean) => void;
|
|
23
23
|
/** Indicates if the select should be without the outer box-shadow */
|
|
24
24
|
isPlain?: boolean;
|
|
25
|
-
/** Minimum width of the select menu */
|
|
26
|
-
minWidth?: string;
|
|
27
25
|
/** @hide Forwarded ref */
|
|
28
26
|
innerRef?: React.Ref<HTMLDivElement>;
|
|
29
27
|
/** z-index of the select menu */
|
|
30
28
|
zIndex?: number;
|
|
31
29
|
/** @beta Determines the accessible role of the select. For a checkbox select pass in "menu". */
|
|
32
30
|
role?: string;
|
|
31
|
+
/** Additional properties to pass to the popper */
|
|
32
|
+
popperProps?: Partial<PopperProps>;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const SelectBase: React.FunctionComponent<SelectProps & OUIAProps> = ({
|
|
@@ -41,10 +41,10 @@ const SelectBase: React.FunctionComponent<SelectProps & OUIAProps> = ({
|
|
|
41
41
|
toggle,
|
|
42
42
|
onOpenChange,
|
|
43
43
|
isPlain,
|
|
44
|
-
minWidth,
|
|
45
44
|
innerRef,
|
|
46
45
|
zIndex = 9999,
|
|
47
46
|
role = 'listbox',
|
|
47
|
+
popperProps,
|
|
48
48
|
...props
|
|
49
49
|
}: SelectProps & OUIAProps) => {
|
|
50
50
|
const localMenuRef = React.useRef<HTMLDivElement>();
|
|
@@ -100,11 +100,6 @@ const SelectBase: React.FunctionComponent<SelectProps & OUIAProps> = ({
|
|
|
100
100
|
onSelect={(event, itemId) => onSelect && onSelect(event, itemId)}
|
|
101
101
|
isPlain={isPlain}
|
|
102
102
|
selected={selected}
|
|
103
|
-
{...(minWidth && {
|
|
104
|
-
style: {
|
|
105
|
-
'--pf-c-menu--MinWidth': minWidth
|
|
106
|
-
} as React.CSSProperties
|
|
107
|
-
})}
|
|
108
103
|
{...getOUIAProps(
|
|
109
104
|
Select.displayName,
|
|
110
105
|
props.ouiaId !== undefined ? props.ouiaId : getDefaultOUIAId(Select.displayName),
|
|
@@ -125,6 +120,7 @@ const SelectBase: React.FunctionComponent<SelectProps & OUIAProps> = ({
|
|
|
125
120
|
appendTo={containerRef.current || undefined}
|
|
126
121
|
isVisible={isOpen}
|
|
127
122
|
zIndex={zIndex}
|
|
123
|
+
{...popperProps}
|
|
128
124
|
/>
|
|
129
125
|
</div>
|
|
130
126
|
);
|
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
Button,
|
|
5
5
|
Alert,
|
|
6
6
|
EmptyState,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
EmptyStateHeader,
|
|
8
|
+
EmptyStateFooter,
|
|
9
9
|
EmptyStateBody,
|
|
10
|
+
EmptyStateActions,
|
|
11
|
+
EmptyStateIcon,
|
|
10
12
|
Progress,
|
|
11
|
-
EmptyStateSecondaryActions,
|
|
12
13
|
Form,
|
|
13
14
|
FormGroup,
|
|
14
15
|
TextInput
|
|
@@ -25,7 +26,7 @@ const ValidationProgress: React.FunctionComponent<ValidationProgressProps> = ({
|
|
|
25
26
|
|
|
26
27
|
const tick = React.useCallback(() => {
|
|
27
28
|
if (percentValidated < 100) {
|
|
28
|
-
setPercentValidated(prevValue => prevValue + 20);
|
|
29
|
+
setPercentValidated((prevValue) => prevValue + 20);
|
|
29
30
|
}
|
|
30
31
|
}, [percentValidated]);
|
|
31
32
|
|
|
@@ -39,11 +40,12 @@ const ValidationProgress: React.FunctionComponent<ValidationProgressProps> = ({
|
|
|
39
40
|
|
|
40
41
|
return (
|
|
41
42
|
<div className="pf-l-bullseye">
|
|
42
|
-
<EmptyState variant="
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
{percentValidated === 100 ? 'Validation complete' : 'Validating credentials'}
|
|
46
|
-
|
|
43
|
+
<EmptyState variant="lg">
|
|
44
|
+
<EmptyStateHeader
|
|
45
|
+
headingLevel="h4"
|
|
46
|
+
titleText={percentValidated === 100 ? 'Validation complete' : 'Validating credentials'}
|
|
47
|
+
icon={<EmptyStateIcon icon={CogsIcon} />}
|
|
48
|
+
/>
|
|
47
49
|
<EmptyStateBody>
|
|
48
50
|
<Progress value={percentValidated} measureLocation="outside" aria-label="Wizard validation progress" />
|
|
49
51
|
</EmptyStateBody>
|
|
@@ -51,11 +53,13 @@ const ValidationProgress: React.FunctionComponent<ValidationProgressProps> = ({
|
|
|
51
53
|
Description can be used to further elaborate on the validation step, or give the user a better idea of how
|
|
52
54
|
long the process will take.
|
|
53
55
|
</EmptyStateBody>
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
<EmptyStateFooter>
|
|
57
|
+
<EmptyStateActions>
|
|
58
|
+
<Button isDisabled={percentValidated !== 100} onClick={onClose}>
|
|
59
|
+
Log to console
|
|
60
|
+
</Button>
|
|
61
|
+
</EmptyStateActions>
|
|
62
|
+
</EmptyStateFooter>
|
|
59
63
|
</EmptyState>
|
|
60
64
|
</div>
|
|
61
65
|
);
|
|
@@ -173,7 +177,7 @@ export const WizardValidateOnButtonPress: React.FunctionComponent = () => {
|
|
|
173
177
|
)}
|
|
174
178
|
<SampleForm
|
|
175
179
|
value={ageValue}
|
|
176
|
-
setValue={value => setAgeValue(value)}
|
|
180
|
+
setValue={(value) => setAgeValue(value)}
|
|
177
181
|
isValid={!hasErrorOnSubmit || isFirstStepValid}
|
|
178
182
|
setIsValid={setIsFirstStepValid}
|
|
179
183
|
/>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
EmptyState,
|
|
4
|
-
|
|
4
|
+
EmptyStateHeader,
|
|
5
|
+
EmptyStateFooter,
|
|
5
6
|
EmptyStateBody,
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
EmptyStateActions,
|
|
8
|
+
EmptyStateIcon,
|
|
8
9
|
Progress,
|
|
9
10
|
Button
|
|
10
11
|
} from '@patternfly/react-core';
|
|
@@ -20,7 +21,7 @@ const ValidationProgress: React.FunctionComponent<ValidationProgressProps> = ({
|
|
|
20
21
|
|
|
21
22
|
const tick = React.useCallback(() => {
|
|
22
23
|
if (percentValidated < 100) {
|
|
23
|
-
setPercentValidated(prevValue => prevValue + 20);
|
|
24
|
+
setPercentValidated((prevValue) => prevValue + 20);
|
|
24
25
|
}
|
|
25
26
|
}, [percentValidated]);
|
|
26
27
|
|
|
@@ -34,11 +35,12 @@ const ValidationProgress: React.FunctionComponent<ValidationProgressProps> = ({
|
|
|
34
35
|
|
|
35
36
|
return (
|
|
36
37
|
<div className="pf-l-bullseye">
|
|
37
|
-
<EmptyState variant="
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
{percentValidated === 100 ? 'Validation complete' : 'Validating credentials'}
|
|
41
|
-
|
|
38
|
+
<EmptyState variant="lg">
|
|
39
|
+
<EmptyStateHeader
|
|
40
|
+
headingLevel="h4"
|
|
41
|
+
titleText={percentValidated === 100 ? 'Validation complete' : 'Validating credentials'}
|
|
42
|
+
icon={<EmptyStateIcon icon={CogsIcon} />}
|
|
43
|
+
/>
|
|
42
44
|
<EmptyStateBody>
|
|
43
45
|
<Progress value={percentValidated} measureLocation="outside" aria-label="Wizard validation progress" />
|
|
44
46
|
</EmptyStateBody>
|
|
@@ -46,11 +48,13 @@ const ValidationProgress: React.FunctionComponent<ValidationProgressProps> = ({
|
|
|
46
48
|
Description can be used to further elaborate on the validation step, or give the user a better idea of how
|
|
47
49
|
long the process will take.
|
|
48
50
|
</EmptyStateBody>
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
<EmptyStateFooter>
|
|
52
|
+
<EmptyStateActions>
|
|
53
|
+
<Button isDisabled={percentValidated !== 100} onClick={onClose}>
|
|
54
|
+
Log to console
|
|
55
|
+
</Button>
|
|
56
|
+
</EmptyStateActions>
|
|
57
|
+
</EmptyStateFooter>
|
|
54
58
|
</EmptyState>
|
|
55
59
|
</div>
|
|
56
60
|
);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface EmptyStatePrimaryProps extends React.HTMLProps<HTMLDivElement> {
|
|
3
|
-
/** Additional classes added to the EmptyStatePrimary */
|
|
4
|
-
className?: string;
|
|
5
|
-
/** Content rendered inside the EmptyStatePrimary */
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export declare const EmptyStatePrimary: React.FunctionComponent<EmptyStatePrimaryProps>;
|
|
9
|
-
//# sourceMappingURL=EmptyStatePrimary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyStatePrimary.d.ts","sourceRoot":"","sources":["../../../../src/components/EmptyState/EmptyStatePrimary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,sBAAuB,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IAC7E,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,CAAC,sBAAsB,CAQ7E,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { __rest } from "tslib";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { css } from '@patternfly/react-styles';
|
|
4
|
-
export const EmptyStatePrimary = (_a) => {
|
|
5
|
-
var { children, className = '' } = _a, props = __rest(_a, ["children", "className"]);
|
|
6
|
-
return (React.createElement("div", Object.assign({ className: css(className) }, props), children));
|
|
7
|
-
};
|
|
8
|
-
EmptyStatePrimary.displayName = 'EmptyStatePrimary';
|
|
9
|
-
//# sourceMappingURL=EmptyStatePrimary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyStatePrimary.js","sourceRoot":"","sources":["../../../../src/components/EmptyState/EmptyStatePrimary.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAS/C,MAAM,CAAC,MAAM,iBAAiB,GAAoD,CAAC,EAI1D,EAAE,EAAE;QAJsD,EACjF,QAAQ,EACR,SAAS,GAAG,EAAE,OAES,EADpB,KAAK,cAHyE,yBAIlF,CADS;IACoB,OAAA,CAC5B,2CAAK,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,IAAM,KAAK,GACtC,QAAQ,CACL,CACP,CAAA;CAAA,CAAC;AACF,iBAAiB,CAAC,WAAW,GAAG,mBAAmB,CAAC"}
|