@patternfly/react-core 5.0.0-alpha.79 → 5.0.0-alpha.80
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 +10 -0
- package/dist/esm/components/AboutModal/package.json +1 -1
- package/dist/esm/components/Accordion/package.json +1 -1
- package/dist/esm/components/ActionList/package.json +1 -1
- package/dist/esm/components/Alert/Alert.d.ts +2 -2
- package/dist/esm/components/Alert/Alert.d.ts.map +1 -1
- package/dist/esm/components/Alert/Alert.js +2 -2
- package/dist/esm/components/Alert/Alert.js.map +1 -1
- package/dist/esm/components/Alert/AlertIcon.d.ts +2 -2
- package/dist/esm/components/Alert/AlertIcon.d.ts.map +1 -1
- package/dist/esm/components/Alert/AlertIcon.js +1 -1
- package/dist/esm/components/Alert/AlertIcon.js.map +1 -1
- package/dist/esm/components/Alert/package.json +1 -1
- package/dist/esm/components/Avatar/package.json +1 -1
- package/dist/esm/components/BackToTop/package.json +1 -1
- package/dist/esm/components/Backdrop/package.json +1 -1
- package/dist/esm/components/BackgroundImage/package.json +1 -1
- package/dist/esm/components/Badge/package.json +1 -1
- package/dist/esm/components/Banner/package.json +1 -1
- package/dist/esm/components/Brand/package.json +1 -1
- package/dist/esm/components/Breadcrumb/package.json +1 -1
- package/dist/esm/components/Button/package.json +1 -1
- package/dist/esm/components/CalendarMonth/package.json +1 -1
- package/dist/esm/components/Card/package.json +1 -1
- package/dist/esm/components/Checkbox/package.json +1 -1
- package/dist/esm/components/Chip/package.json +1 -1
- package/dist/esm/components/ChipGroup/package.json +1 -1
- package/dist/esm/components/ClipboardCopy/package.json +1 -1
- package/dist/esm/components/CodeBlock/package.json +1 -1
- package/dist/esm/components/DataList/package.json +1 -1
- package/dist/esm/components/DatePicker/package.json +1 -1
- package/dist/esm/components/DescriptionList/package.json +1 -1
- package/dist/esm/components/Divider/package.json +1 -1
- package/dist/esm/components/DragDrop/package.json +1 -1
- package/dist/esm/components/Drawer/package.json +1 -1
- package/dist/esm/components/Dropdown/package.json +1 -1
- package/dist/esm/components/DualListSelector/package.json +1 -1
- package/dist/esm/components/EmptyState/package.json +1 -1
- package/dist/esm/components/ExpandableSection/package.json +1 -1
- package/dist/esm/components/FileUpload/package.json +1 -1
- package/dist/esm/components/Form/package.json +1 -1
- package/dist/esm/components/FormSelect/package.json +1 -1
- package/dist/esm/components/HelperText/package.json +1 -1
- package/dist/esm/components/Hint/package.json +1 -1
- package/dist/esm/components/Icon/package.json +1 -1
- package/dist/esm/components/InputGroup/package.json +1 -1
- package/dist/esm/components/JumpLinks/package.json +1 -1
- package/dist/esm/components/Label/package.json +1 -1
- package/dist/esm/components/LabelGroup/package.json +1 -1
- package/dist/esm/components/List/package.json +1 -1
- package/dist/esm/components/LoginPage/package.json +1 -1
- package/dist/esm/components/Masthead/package.json +1 -1
- package/dist/esm/components/Menu/package.json +1 -1
- package/dist/esm/components/MenuToggle/package.json +1 -1
- package/dist/esm/components/Modal/Modal.d.ts +1 -1
- package/dist/esm/components/Modal/Modal.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxTitle.d.ts +1 -1
- package/dist/esm/components/Modal/ModalBoxTitle.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxTitle.js +2 -2
- package/dist/esm/components/Modal/ModalBoxTitle.js.map +1 -1
- package/dist/esm/components/Modal/ModalContent.d.ts +1 -1
- package/dist/esm/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalContent.js +1 -2
- package/dist/esm/components/Modal/ModalContent.js.map +1 -1
- package/dist/esm/components/Modal/package.json +1 -1
- package/dist/esm/components/MultipleFileUpload/package.json +1 -1
- package/dist/esm/components/Nav/package.json +1 -1
- package/dist/esm/components/NotificationBadge/package.json +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItem.js +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItem.js.map +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts +2 -2
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts.map +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.js +2 -2
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.js.map +1 -1
- package/dist/esm/components/NotificationDrawer/package.json +1 -1
- package/dist/esm/components/NumberInput/package.json +1 -1
- package/dist/esm/components/OverflowMenu/package.json +1 -1
- package/dist/esm/components/Page/package.json +1 -1
- package/dist/esm/components/Pagination/package.json +1 -1
- package/dist/esm/components/Panel/package.json +1 -1
- package/dist/esm/components/Popover/Popover.d.ts +1 -1
- package/dist/esm/components/Popover/Popover.d.ts.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/Popover/PopoverHeader.d.ts +1 -1
- package/dist/esm/components/Popover/PopoverHeader.d.ts.map +1 -1
- package/dist/esm/components/Popover/package.json +1 -1
- package/dist/esm/components/Progress/package.json +1 -1
- package/dist/esm/components/ProgressStepper/package.json +1 -1
- package/dist/esm/components/Radio/package.json +1 -1
- package/dist/esm/components/SearchInput/package.json +1 -1
- package/dist/esm/components/Select/package.json +1 -1
- package/dist/esm/components/Sidebar/package.json +1 -1
- package/dist/esm/components/SimpleList/package.json +1 -1
- package/dist/esm/components/Skeleton/package.json +1 -1
- package/dist/esm/components/SkipToContent/package.json +1 -1
- package/dist/esm/components/Slider/package.json +1 -1
- package/dist/esm/components/Spinner/package.json +1 -1
- package/dist/esm/components/Switch/package.json +1 -1
- package/dist/esm/components/Tabs/package.json +1 -1
- package/dist/esm/components/Text/package.json +1 -1
- package/dist/esm/components/TextArea/package.json +1 -1
- package/dist/esm/components/TextInput/package.json +1 -1
- package/dist/esm/components/TextInputGroup/package.json +1 -1
- package/dist/esm/components/Tile/package.json +1 -1
- package/dist/esm/components/TimePicker/package.json +1 -1
- package/dist/esm/components/Timestamp/package.json +1 -1
- package/dist/esm/components/Title/package.json +1 -1
- package/dist/esm/components/ToggleGroup/package.json +1 -1
- package/dist/esm/components/Toolbar/package.json +1 -1
- package/dist/esm/components/Tooltip/package.json +1 -1
- package/dist/esm/components/TreeView/package.json +1 -1
- package/dist/esm/components/Truncate/package.json +1 -1
- package/dist/esm/components/Wizard/hooks/package.json +1 -1
- package/dist/esm/components/Wizard/package.json +1 -1
- package/dist/esm/components/package.json +1 -1
- package/dist/esm/deprecated/components/ApplicationLauncher/package.json +1 -1
- package/dist/esm/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/esm/deprecated/components/Dropdown/package.json +1 -1
- package/dist/esm/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/esm/deprecated/components/PageHeader/package.json +1 -1
- package/dist/esm/deprecated/components/Select/package.json +1 -1
- package/dist/esm/deprecated/components/Wizard/package.json +1 -1
- package/dist/esm/deprecated/components/package.json +1 -1
- package/dist/esm/deprecated/package.json +1 -1
- package/dist/esm/helpers/Popper/thirdparty/popper-core/package.json +1 -1
- package/dist/esm/helpers/package.json +1 -1
- package/dist/esm/layouts/Bullseye/package.json +1 -1
- package/dist/esm/layouts/Flex/package.json +1 -1
- package/dist/esm/layouts/Gallery/package.json +1 -1
- package/dist/esm/layouts/Grid/package.json +1 -1
- package/dist/esm/layouts/Level/package.json +1 -1
- package/dist/esm/layouts/Split/package.json +1 -1
- package/dist/esm/layouts/Stack/package.json +1 -1
- package/dist/esm/layouts/package.json +1 -1
- package/dist/esm/next/components/package.json +1 -1
- package/dist/esm/next/package.json +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/js/components/AboutModal/package.json +1 -1
- package/dist/js/components/Accordion/package.json +1 -1
- package/dist/js/components/ActionList/package.json +1 -1
- package/dist/js/components/Alert/Alert.d.ts +2 -2
- package/dist/js/components/Alert/Alert.d.ts.map +1 -1
- package/dist/js/components/Alert/Alert.js +2 -2
- package/dist/js/components/Alert/Alert.js.map +1 -1
- package/dist/js/components/Alert/AlertIcon.d.ts +2 -2
- package/dist/js/components/Alert/AlertIcon.d.ts.map +1 -1
- package/dist/js/components/Alert/AlertIcon.js +1 -1
- package/dist/js/components/Alert/AlertIcon.js.map +1 -1
- package/dist/js/components/Alert/package.json +1 -1
- package/dist/js/components/Avatar/package.json +1 -1
- package/dist/js/components/BackToTop/package.json +1 -1
- package/dist/js/components/Backdrop/package.json +1 -1
- package/dist/js/components/BackgroundImage/package.json +1 -1
- package/dist/js/components/Badge/package.json +1 -1
- package/dist/js/components/Banner/package.json +1 -1
- package/dist/js/components/Brand/package.json +1 -1
- package/dist/js/components/Breadcrumb/package.json +1 -1
- package/dist/js/components/Button/package.json +1 -1
- package/dist/js/components/CalendarMonth/package.json +1 -1
- package/dist/js/components/Card/package.json +1 -1
- package/dist/js/components/Checkbox/package.json +1 -1
- package/dist/js/components/Chip/package.json +1 -1
- package/dist/js/components/ChipGroup/package.json +1 -1
- package/dist/js/components/ClipboardCopy/package.json +1 -1
- package/dist/js/components/CodeBlock/package.json +1 -1
- package/dist/js/components/DataList/package.json +1 -1
- package/dist/js/components/DatePicker/package.json +1 -1
- package/dist/js/components/DescriptionList/package.json +1 -1
- package/dist/js/components/Divider/package.json +1 -1
- package/dist/js/components/DragDrop/package.json +1 -1
- package/dist/js/components/Drawer/package.json +1 -1
- package/dist/js/components/Dropdown/package.json +1 -1
- package/dist/js/components/DualListSelector/package.json +1 -1
- package/dist/js/components/EmptyState/package.json +1 -1
- package/dist/js/components/ExpandableSection/package.json +1 -1
- package/dist/js/components/FileUpload/package.json +1 -1
- package/dist/js/components/Form/package.json +1 -1
- package/dist/js/components/FormSelect/package.json +1 -1
- package/dist/js/components/HelperText/package.json +1 -1
- package/dist/js/components/Hint/package.json +1 -1
- package/dist/js/components/Icon/package.json +1 -1
- package/dist/js/components/InputGroup/package.json +1 -1
- package/dist/js/components/JumpLinks/package.json +1 -1
- package/dist/js/components/Label/package.json +1 -1
- package/dist/js/components/LabelGroup/package.json +1 -1
- package/dist/js/components/List/package.json +1 -1
- package/dist/js/components/LoginPage/package.json +1 -1
- package/dist/js/components/Masthead/package.json +1 -1
- package/dist/js/components/Menu/package.json +1 -1
- package/dist/js/components/MenuToggle/package.json +1 -1
- package/dist/js/components/Modal/Modal.d.ts +1 -1
- package/dist/js/components/Modal/Modal.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxTitle.d.ts +1 -1
- package/dist/js/components/Modal/ModalBoxTitle.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxTitle.js +2 -2
- package/dist/js/components/Modal/ModalBoxTitle.js.map +1 -1
- package/dist/js/components/Modal/ModalContent.d.ts +1 -1
- package/dist/js/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalContent.js +1 -2
- package/dist/js/components/Modal/ModalContent.js.map +1 -1
- package/dist/js/components/Modal/package.json +1 -1
- package/dist/js/components/MultipleFileUpload/package.json +1 -1
- package/dist/js/components/Nav/package.json +1 -1
- package/dist/js/components/NotificationBadge/package.json +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItem.js +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItem.js.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts +2 -2
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItemHeader.js +2 -2
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItemHeader.js.map +1 -1
- package/dist/js/components/NotificationDrawer/package.json +1 -1
- package/dist/js/components/NumberInput/package.json +1 -1
- package/dist/js/components/OverflowMenu/package.json +1 -1
- package/dist/js/components/Page/package.json +1 -1
- package/dist/js/components/Pagination/package.json +1 -1
- package/dist/js/components/Panel/package.json +1 -1
- package/dist/js/components/Popover/Popover.d.ts +1 -1
- package/dist/js/components/Popover/Popover.d.ts.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/Popover/PopoverHeader.d.ts +1 -1
- package/dist/js/components/Popover/PopoverHeader.d.ts.map +1 -1
- package/dist/js/components/Popover/package.json +1 -1
- package/dist/js/components/Progress/package.json +1 -1
- package/dist/js/components/ProgressStepper/package.json +1 -1
- package/dist/js/components/Radio/package.json +1 -1
- package/dist/js/components/SearchInput/package.json +1 -1
- package/dist/js/components/Select/package.json +1 -1
- package/dist/js/components/Sidebar/package.json +1 -1
- package/dist/js/components/SimpleList/package.json +1 -1
- package/dist/js/components/Skeleton/package.json +1 -1
- package/dist/js/components/SkipToContent/package.json +1 -1
- package/dist/js/components/Slider/package.json +1 -1
- package/dist/js/components/Spinner/package.json +1 -1
- package/dist/js/components/Switch/package.json +1 -1
- package/dist/js/components/Tabs/package.json +1 -1
- package/dist/js/components/Text/package.json +1 -1
- package/dist/js/components/TextArea/package.json +1 -1
- package/dist/js/components/TextInput/package.json +1 -1
- package/dist/js/components/TextInputGroup/package.json +1 -1
- package/dist/js/components/Tile/package.json +1 -1
- package/dist/js/components/TimePicker/package.json +1 -1
- package/dist/js/components/Timestamp/package.json +1 -1
- package/dist/js/components/Title/package.json +1 -1
- package/dist/js/components/ToggleGroup/package.json +1 -1
- package/dist/js/components/Toolbar/package.json +1 -1
- package/dist/js/components/Tooltip/package.json +1 -1
- package/dist/js/components/TreeView/package.json +1 -1
- package/dist/js/components/Truncate/package.json +1 -1
- package/dist/js/components/Wizard/hooks/package.json +1 -1
- package/dist/js/components/Wizard/package.json +1 -1
- package/dist/js/components/package.json +1 -1
- package/dist/js/deprecated/components/ApplicationLauncher/package.json +1 -1
- package/dist/js/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/js/deprecated/components/Dropdown/package.json +1 -1
- package/dist/js/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/js/deprecated/components/PageHeader/package.json +1 -1
- package/dist/js/deprecated/components/Select/package.json +1 -1
- package/dist/js/deprecated/components/Wizard/package.json +1 -1
- package/dist/js/deprecated/components/package.json +1 -1
- package/dist/js/deprecated/package.json +1 -1
- package/dist/js/helpers/Popper/thirdparty/popper-core/package.json +1 -1
- package/dist/js/helpers/package.json +1 -1
- package/dist/js/layouts/Bullseye/package.json +1 -1
- package/dist/js/layouts/Flex/package.json +1 -1
- package/dist/js/layouts/Gallery/package.json +1 -1
- package/dist/js/layouts/Grid/package.json +1 -1
- package/dist/js/layouts/Level/package.json +1 -1
- package/dist/js/layouts/Split/package.json +1 -1
- package/dist/js/layouts/Stack/package.json +1 -1
- package/dist/js/layouts/package.json +1 -1
- package/dist/js/next/components/package.json +1 -1
- package/dist/js/next/package.json +1 -1
- package/dist/js/package.json +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +3 -3
- package/src/components/Alert/Alert.tsx +4 -4
- package/src/components/Alert/AlertIcon.tsx +2 -2
- package/src/components/Alert/__tests__/Alert.test.tsx +11 -11
- package/src/components/Alert/__tests__/AlertIcon.test.tsx +11 -10
- package/src/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +3 -3
- package/src/components/Alert/examples/Alert.md +5 -5
- package/src/components/EmptyState/__tests__/Generated/__snapshots__/EmptyStateIcon.test.tsx.snap +1 -1
- package/src/components/EmptyState/__tests__/__snapshots__/EmptyState.test.tsx.snap +1 -0
- package/src/components/Icon/__tests__/Icon.test.tsx +10 -10
- package/src/components/Modal/Modal.tsx +1 -1
- package/src/components/Modal/ModalBoxTitle.tsx +3 -3
- package/src/components/Modal/ModalContent.tsx +2 -6
- package/src/components/Modal/__tests__/ModalBoxTitle.test.tsx +2 -2
- package/src/components/Modal/__tests__/__snapshots__/ModalBoxTitle.test.tsx.snap +10 -10
- package/src/components/Modal/examples/Modal.md +1 -1
- package/src/components/NotificationDrawer/NotificationDrawerListItem.tsx +1 -1
- package/src/components/NotificationDrawer/NotificationDrawerListItemHeader.tsx +3 -3
- package/src/components/Popover/Popover.tsx +2 -2
- package/src/components/Popover/PopoverHeader.tsx +1 -1
- package/src/components/Popover/examples/PopoverAlert.tsx +4 -4
- package/src/deprecated/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.80",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"subpaths": "node scripts/createSubpaths.js"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@patternfly/react-icons": "^5.0.0-alpha.
|
|
49
|
+
"@patternfly/react-icons": "^5.0.0-alpha.12",
|
|
50
50
|
"@patternfly/react-styles": "^5.0.0-alpha.8",
|
|
51
51
|
"@patternfly/react-tokens": "^5.0.0-alpha.7",
|
|
52
52
|
"focus-trap": "7.4.0",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"react": "^17 || ^18",
|
|
72
72
|
"react-dom": "^17 || ^18"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "b550566ea35ea90c25974d5d3d2f987badb5b397"
|
|
75
75
|
}
|
|
@@ -15,7 +15,7 @@ export enum AlertVariant {
|
|
|
15
15
|
danger = 'danger',
|
|
16
16
|
warning = 'warning',
|
|
17
17
|
info = 'info',
|
|
18
|
-
|
|
18
|
+
custom = 'custom'
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/** The main alert component. */
|
|
@@ -78,7 +78,7 @@ export interface AlertProps extends Omit<React.HTMLProps<HTMLDivElement>, 'actio
|
|
|
78
78
|
/** Truncate title to number of lines. */
|
|
79
79
|
truncateTitle?: number;
|
|
80
80
|
/** Adds alert variant styles. */
|
|
81
|
-
variant?: 'success' | 'danger' | 'warning' | 'info' | '
|
|
81
|
+
variant?: 'success' | 'danger' | 'warning' | 'info' | 'custom';
|
|
82
82
|
/** Variant label text for screen readers. */
|
|
83
83
|
variantLabel?: string;
|
|
84
84
|
/** Value to overwrite the randomly generated data-ouia-component-id.*/
|
|
@@ -88,7 +88,7 @@ export interface AlertProps extends Omit<React.HTMLProps<HTMLDivElement>, 'actio
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
export const Alert: React.FunctionComponent<AlertProps> = ({
|
|
91
|
-
variant = AlertVariant.
|
|
91
|
+
variant = AlertVariant.custom,
|
|
92
92
|
isInline = false,
|
|
93
93
|
isPlain = false,
|
|
94
94
|
isLiveRegion = false,
|
|
@@ -214,7 +214,7 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
|
|
|
214
214
|
isPlain && styles.modifiers.plain,
|
|
215
215
|
isExpandable && styles.modifiers.expandable,
|
|
216
216
|
isExpanded && styles.modifiers.expanded,
|
|
217
|
-
styles.modifiers[variant
|
|
217
|
+
styles.modifiers[variant],
|
|
218
218
|
className
|
|
219
219
|
)}
|
|
220
220
|
{...ouiaProps}
|
|
@@ -12,7 +12,7 @@ export const variantIcons = {
|
|
|
12
12
|
danger: ExclamationCircleIcon,
|
|
13
13
|
warning: ExclamationTriangleIcon,
|
|
14
14
|
info: InfoCircleIcon,
|
|
15
|
-
|
|
15
|
+
custom: BellIcon
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export interface AlertIconProps extends React.HTMLProps<HTMLDivElement> {
|
|
@@ -21,7 +21,7 @@ export interface AlertIconProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
21
21
|
/** A custom icon. If not set the icon is set according to the variant. */
|
|
22
22
|
customIcon?: React.ReactNode;
|
|
23
23
|
/** Variant of the alert icon. */
|
|
24
|
-
variant: 'success' | 'danger' | 'warning' | 'info' | '
|
|
24
|
+
variant: 'success' | 'danger' | 'warning' | 'info' | 'custom';
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const AlertIcon = ({ variant, customIcon, className = '', ...props }: AlertIconProps) => {
|
|
@@ -45,15 +45,15 @@ test('Renders with class pf-c-alert on the containing div', () => {
|
|
|
45
45
|
|
|
46
46
|
test('Renders with class pf-c-alert__title on the div containing the title', () => {
|
|
47
47
|
render(<Alert title="Some title">Some alert</Alert>);
|
|
48
|
-
expect(screen.getByRole('heading', { name: '
|
|
48
|
+
expect(screen.getByRole('heading', { name: 'Custom alert: Some title' })).toHaveClass('pf-c-alert__title');
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
test('Renders with
|
|
51
|
+
test('Renders with Custom hidden text of "Custom alert:"', () => {
|
|
52
52
|
render(<Alert title="Some title">Some alert</Alert>);
|
|
53
|
-
expect(screen.getByText('
|
|
53
|
+
expect(screen.getByText('Custom alert:')).toBeInTheDocument();
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
['success', 'danger', 'warning', 'info'].forEach(variant => {
|
|
56
|
+
['success', 'danger', 'warning', 'info'].forEach((variant) => {
|
|
57
57
|
test(`Does not render with class pf-m-${variant} by default`, () => {
|
|
58
58
|
render(
|
|
59
59
|
<Alert title="Some title" data-testid="Alert-test-id">
|
|
@@ -176,7 +176,7 @@ test('Renders the title', () => {
|
|
|
176
176
|
test('Renders the title as an h4 by default', () => {
|
|
177
177
|
render(<Alert title="Some title">Some alert</Alert>);
|
|
178
178
|
|
|
179
|
-
expect(screen.getByRole('heading', { level: 4, name: '
|
|
179
|
+
expect(screen.getByRole('heading', { level: 4, name: 'Custom alert: Some title' })).toBeVisible();
|
|
180
180
|
});
|
|
181
181
|
|
|
182
182
|
test('Renders the title as other heading levels when one is passed using component', () => {
|
|
@@ -186,7 +186,7 @@ test('Renders the title as other heading levels when one is passed using compone
|
|
|
186
186
|
</Alert>
|
|
187
187
|
);
|
|
188
188
|
|
|
189
|
-
expect(screen.getByRole('heading', { level: 1, name: '
|
|
189
|
+
expect(screen.getByRole('heading', { level: 1, name: 'Custom alert: Some title' })).toBeVisible();
|
|
190
190
|
});
|
|
191
191
|
|
|
192
192
|
test('Renders the element passed via the actionClose prop', () => {
|
|
@@ -378,7 +378,7 @@ test('Removes the alert after a custom time when timeout is passed with a number
|
|
|
378
378
|
|
|
379
379
|
test('Does not remove the alert on timeout if the user is focused on the alert', async () => {
|
|
380
380
|
const user = userEvent.setup({
|
|
381
|
-
advanceTimers: delay => jest.advanceTimersByTime(delay)
|
|
381
|
+
advanceTimers: (delay) => jest.advanceTimersByTime(delay)
|
|
382
382
|
});
|
|
383
383
|
jest.useFakeTimers();
|
|
384
384
|
|
|
@@ -402,7 +402,7 @@ test('Does not remove the alert on timeout if the user is focused on the alert',
|
|
|
402
402
|
|
|
403
403
|
test('Does not remove the alert on timeout if the user is hovered over the alert', async () => {
|
|
404
404
|
const user = userEvent.setup({
|
|
405
|
-
advanceTimers: delay => jest.advanceTimersByTime(delay)
|
|
405
|
+
advanceTimers: (delay) => jest.advanceTimersByTime(delay)
|
|
406
406
|
});
|
|
407
407
|
jest.useFakeTimers();
|
|
408
408
|
|
|
@@ -426,7 +426,7 @@ test('Does not remove the alert on timeout if the user is hovered over the alert
|
|
|
426
426
|
|
|
427
427
|
test('Removes the alert after the user removes focus from the alert and 3000ms have passed', async () => {
|
|
428
428
|
const user = userEvent.setup({
|
|
429
|
-
advanceTimers: delay => jest.advanceTimersByTime(delay)
|
|
429
|
+
advanceTimers: (delay) => jest.advanceTimersByTime(delay)
|
|
430
430
|
});
|
|
431
431
|
jest.useFakeTimers();
|
|
432
432
|
|
|
@@ -459,7 +459,7 @@ test('Removes the alert after the user removes focus from the alert and 3000ms h
|
|
|
459
459
|
|
|
460
460
|
test('Removes the alert after the user removes hover from the alert and 3000ms have passed', async () => {
|
|
461
461
|
const user = userEvent.setup({
|
|
462
|
-
advanceTimers: delay => jest.advanceTimersByTime(delay)
|
|
462
|
+
advanceTimers: (delay) => jest.advanceTimersByTime(delay)
|
|
463
463
|
});
|
|
464
464
|
jest.useFakeTimers();
|
|
465
465
|
|
|
@@ -492,7 +492,7 @@ test('Removes the alert after the user removes hover from the alert and 3000ms h
|
|
|
492
492
|
|
|
493
493
|
test('Removes the alert after the user removes hover from the alert and timeoutAnimation time has passed', async () => {
|
|
494
494
|
const user = userEvent.setup({
|
|
495
|
-
advanceTimers: delay => jest.advanceTimersByTime(delay)
|
|
495
|
+
advanceTimers: (delay) => jest.advanceTimersByTime(delay)
|
|
496
496
|
});
|
|
497
497
|
jest.useFakeTimers();
|
|
498
498
|
|
|
@@ -5,8 +5,9 @@ import { AlertIcon } from '../AlertIcon';
|
|
|
5
5
|
|
|
6
6
|
jest.mock('@patternfly/react-icons/dist/esm/icons/check-circle-icon', () => () => 'Check circle icon mock');
|
|
7
7
|
jest.mock('@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon', () => () => 'Exclamation circle icon mock');
|
|
8
|
-
jest.mock(
|
|
9
|
-
'
|
|
8
|
+
jest.mock(
|
|
9
|
+
'@patternfly/react-icons/dist/esm/icons/exclamation-triangle-icon',
|
|
10
|
+
() => () => 'Exclamation triangle icon mock'
|
|
10
11
|
);
|
|
11
12
|
jest.mock('@patternfly/react-icons/dist/esm/icons/info-circle-icon', () => () => 'Info circle icon mock');
|
|
12
13
|
jest.mock('@patternfly/react-icons/dist/esm/icons/bell-icon', () => () => 'Bell icon mock');
|
|
@@ -14,15 +15,15 @@ jest.mock('@patternfly/react-icons/dist/esm/icons/bell-icon', () => () => 'Bell
|
|
|
14
15
|
test('Renders without children', () => {
|
|
15
16
|
render(
|
|
16
17
|
<div data-testid="container">
|
|
17
|
-
<AlertIcon variant="
|
|
18
|
+
<AlertIcon variant="custom" />
|
|
18
19
|
</div>
|
|
19
20
|
);
|
|
20
21
|
|
|
21
22
|
expect(screen.getByTestId('container').firstChild).toBeVisible();
|
|
22
23
|
});
|
|
23
24
|
|
|
24
|
-
test('Renders with the bell icon when variant =
|
|
25
|
-
render(<AlertIcon variant="
|
|
25
|
+
test('Renders with the bell icon when variant = custom', () => {
|
|
26
|
+
render(<AlertIcon variant="custom" />);
|
|
26
27
|
|
|
27
28
|
expect(screen.getByText('Bell icon mock')).toBeVisible();
|
|
28
29
|
});
|
|
@@ -52,32 +53,32 @@ test('Renders with the info circle icon when variant = info', () => {
|
|
|
52
53
|
});
|
|
53
54
|
|
|
54
55
|
test('Renders with custom class names provided via prop', () => {
|
|
55
|
-
render(<AlertIcon variant="
|
|
56
|
+
render(<AlertIcon variant="custom" className="test-class" />);
|
|
56
57
|
|
|
57
58
|
expect(screen.getByText('Bell icon mock')).toHaveClass('test-class');
|
|
58
59
|
});
|
|
59
60
|
|
|
60
61
|
test('Renders with the passed custom icon when one is passed rather than the icon determined by the passed variant', () => {
|
|
61
|
-
render(<AlertIcon variant="
|
|
62
|
+
render(<AlertIcon variant="custom" customIcon="Custom icon" />);
|
|
62
63
|
|
|
63
64
|
expect(screen.queryByText('Bell icon mock')).not.toBeInTheDocument();
|
|
64
65
|
expect(screen.getByText('Custom icon')).toBeVisible();
|
|
65
66
|
});
|
|
66
67
|
|
|
67
68
|
test('Renders the icon inside class pf-c-alert__icon', () => {
|
|
68
|
-
render(<AlertIcon variant="
|
|
69
|
+
render(<AlertIcon variant="custom" />);
|
|
69
70
|
|
|
70
71
|
expect(screen.getByText('Bell icon mock')).toHaveClass('pf-c-alert__icon');
|
|
71
72
|
});
|
|
72
73
|
|
|
73
74
|
test('Renders with inherited element props spread to the component', () => {
|
|
74
|
-
render(<AlertIcon variant="
|
|
75
|
+
render(<AlertIcon variant="custom" aria-label="Test label" />);
|
|
75
76
|
|
|
76
77
|
expect(screen.getByText('Bell icon mock')).toHaveAccessibleName('Test label');
|
|
77
78
|
});
|
|
78
79
|
|
|
79
80
|
test('Matches snapshot', () => {
|
|
80
|
-
const { asFragment } = render(<AlertIcon variant="
|
|
81
|
+
const { asFragment } = render(<AlertIcon variant="custom" />);
|
|
81
82
|
|
|
82
83
|
expect(asFragment()).toMatchSnapshot();
|
|
83
84
|
});
|
|
@@ -6,7 +6,7 @@ exports[`Matches snapshot 1`] = `
|
|
|
6
6
|
aria-atomic="false"
|
|
7
7
|
aria-label="Toast alert label"
|
|
8
8
|
aria-live="polite"
|
|
9
|
-
class="pf-c-alert"
|
|
9
|
+
class="pf-c-alert pf-m-custom"
|
|
10
10
|
data-ouia-component-id="ouia-id"
|
|
11
11
|
data-ouia-component-type="PF4/Alert"
|
|
12
12
|
data-ouia-safe="true"
|
|
@@ -16,7 +16,7 @@ exports[`Matches snapshot 1`] = `
|
|
|
16
16
|
custom icon:
|
|
17
17
|
</p>
|
|
18
18
|
<p>
|
|
19
|
-
variant:
|
|
19
|
+
variant: custom
|
|
20
20
|
</p>
|
|
21
21
|
</div>
|
|
22
22
|
<h4
|
|
@@ -25,7 +25,7 @@ exports[`Matches snapshot 1`] = `
|
|
|
25
25
|
<span
|
|
26
26
|
class="pf-u-screen-reader"
|
|
27
27
|
>
|
|
28
|
-
|
|
28
|
+
Custom alert:
|
|
29
29
|
</span>
|
|
30
30
|
Some title
|
|
31
31
|
</h4>
|
|
@@ -17,11 +17,11 @@ import LaptopIcon from '@patternfly/react-icons/dist/esm/icons/laptop-icon';
|
|
|
17
17
|
|
|
18
18
|
### Alert variants
|
|
19
19
|
|
|
20
|
-
PatternFly supports several alert variants for different scenarios. Each variant has an associated status icon, background, and alert title coded to communicate the severity of an alert. Use the `variant` property to apply the following styling options. If no `variant` is specified, then the variant will be set to "
|
|
20
|
+
PatternFly supports several alert variants for different scenarios. Each variant has an associated status icon, background, and alert title coded to communicate the severity of an alert. Use the `variant` property to apply the following styling options. If no `variant` is specified, then the variant will be set to "custom".
|
|
21
21
|
|
|
22
22
|
| Variant | Description |
|
|
23
23
|
|---|---|
|
|
24
|
-
|
|
|
24
|
+
| Custom | Use for generic messages that should have a custom color set by the associated CSS variable. Should be used when the message has no associated severity. |
|
|
25
25
|
| Info | Use for general informational messages |
|
|
26
26
|
| Success | Use to indicate that a task or process has been completed successfully |
|
|
27
27
|
| Warning | Use to indicate that a non-critical error has occurred|
|
|
@@ -32,7 +32,7 @@ import React from 'react';
|
|
|
32
32
|
import { Alert } from '@patternfly/react-core';
|
|
33
33
|
|
|
34
34
|
<React.Fragment>
|
|
35
|
-
<Alert title="
|
|
35
|
+
<Alert title="Custom alert title" ouiaId="CustomAlert" />
|
|
36
36
|
<Alert variant="info" title="Info alert title" ouiaId="InfoAlert" />
|
|
37
37
|
<Alert variant="success" title="Success alert title" ouiaId="SuccessAlert" />
|
|
38
38
|
<Alert variant="warning" title="Warning alert title" ouiaId="WarningAlert" />
|
|
@@ -229,7 +229,7 @@ Use inline alerts to display an alert inline with content. All alert variants ma
|
|
|
229
229
|
import React from 'react';
|
|
230
230
|
import { Alert } from '@patternfly/react-core';
|
|
231
231
|
<React.Fragment>
|
|
232
|
-
<Alert variant="
|
|
232
|
+
<Alert variant="custom" isInline title="Custom inline alert title" />
|
|
233
233
|
<Alert variant="info" isInline title="Info inline alert title" />
|
|
234
234
|
<Alert variant="success" isInline title="Success inline alert title" />
|
|
235
235
|
<Alert variant="warning" isInline title="Warning inline alert title" />
|
|
@@ -294,7 +294,7 @@ Use the `isPlain` property to make any inline alert plain. Plain styling removes
|
|
|
294
294
|
import React from 'react';
|
|
295
295
|
import { Alert } from '@patternfly/react-core';
|
|
296
296
|
<React.Fragment>
|
|
297
|
-
<Alert variant="
|
|
297
|
+
<Alert variant="custom" isInline isPlain title="Custom inline alert title" />
|
|
298
298
|
<Alert variant="info" isInline isPlain title="Info inline alert title" />
|
|
299
299
|
<Alert variant="success" isInline isPlain title="Success inline alert title" />
|
|
300
300
|
<Alert variant="warning" isInline isPlain title="Warning inline alert title" />
|
|
@@ -40,7 +40,7 @@ test('sets additional custom class successfully', () => {
|
|
|
40
40
|
expect(iconContainer).toHaveClass('test');
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
Object.values(['sm', 'md', 'lg', 'xl']).forEach(size => {
|
|
43
|
+
Object.values(['sm', 'md', 'lg', 'xl']).forEach((size) => {
|
|
44
44
|
test(`sets icon size modifier successfully - ${size}`, () => {
|
|
45
45
|
render(
|
|
46
46
|
<Icon iconSize={size as 'sm' | 'md' | 'lg' | 'xl'} title={`content-${size}-icon`}>
|
|
@@ -60,10 +60,10 @@ test('check icon without iconSize', () => {
|
|
|
60
60
|
</Icon>
|
|
61
61
|
);
|
|
62
62
|
const iconContainer = screen.getByTitle('no-icon-size').querySelector('.pf-c-icon__content');
|
|
63
|
-
expect(Array.from(iconContainer?.classList || []).some(c => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
63
|
+
expect(Array.from(iconContainer?.classList || []).some((c) => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
Object.values(['sm', 'md', 'lg', 'xl']).forEach(size => {
|
|
66
|
+
Object.values(['sm', 'md', 'lg', 'xl']).forEach((size) => {
|
|
67
67
|
test(`sets progress icon size modifier successfully - ${size}`, () => {
|
|
68
68
|
render(
|
|
69
69
|
<Icon isInProgress progressIconSize={size as 'sm' | 'md' | 'lg' | 'xl'} title={`progress-content-${size}-icon`}>
|
|
@@ -83,10 +83,10 @@ test('check icon without progress icon size', () => {
|
|
|
83
83
|
</Icon>
|
|
84
84
|
);
|
|
85
85
|
const iconContainer = screen.getByTitle('no-progress-icon-size').querySelector('.pf-c-icon__progress');
|
|
86
|
-
expect(Array.from(iconContainer?.classList || []).some(c => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
86
|
+
expect(Array.from(iconContainer?.classList || []).some((c) => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
Object.values(['sm', 'md', 'lg', 'xl']).forEach(size => {
|
|
89
|
+
Object.values(['sm', 'md', 'lg', 'xl']).forEach((size) => {
|
|
90
90
|
test(`sets size modifier successfully - ${size}`, () => {
|
|
91
91
|
render(
|
|
92
92
|
<Icon size={size as 'sm' | 'md' | 'lg' | 'xl'} title={`${size}-icon`}>
|
|
@@ -106,10 +106,10 @@ test('check icon without size', () => {
|
|
|
106
106
|
</Icon>
|
|
107
107
|
);
|
|
108
108
|
const iconContainer = screen.getByTitle('no-size');
|
|
109
|
-
expect(Array.from(iconContainer?.classList || []).some(c => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
109
|
+
expect(Array.from(iconContainer?.classList || []).some((c) => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
Object.values(['custom', 'info', 'success', 'warning', 'danger']).forEach(status => {
|
|
112
|
+
Object.values(['custom', 'info', 'success', 'warning', 'danger']).forEach((status) => {
|
|
113
113
|
test(`sets status modifier successfully - ${status}`, () => {
|
|
114
114
|
render(
|
|
115
115
|
<Icon status={status as 'custom' | 'info' | 'success' | 'warning' | 'danger'} title={`${status}-icon`}>
|
|
@@ -129,7 +129,7 @@ test('check icon without status', () => {
|
|
|
129
129
|
</Icon>
|
|
130
130
|
);
|
|
131
131
|
const iconContent = screen.getByTitle('no-status').querySelector('.pf-c-icon__content');
|
|
132
|
-
expect(Array.from(iconContent?.classList || []).some(c => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
132
|
+
expect(Array.from(iconContent?.classList || []).some((c) => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
test('sets isInline successfully', () => {
|
|
@@ -150,7 +150,7 @@ test('check icon without isInline', () => {
|
|
|
150
150
|
</Icon>
|
|
151
151
|
);
|
|
152
152
|
const iconContainer = screen.getByTitle('no-inline');
|
|
153
|
-
expect(Array.from(iconContainer?.classList || []).some(c => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
153
|
+
expect(Array.from(iconContainer?.classList || []).some((c) => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
154
154
|
});
|
|
155
155
|
|
|
156
156
|
test('sets isInProgress successfully', () => {
|
|
@@ -173,7 +173,7 @@ test('check icon without isInProgress', () => {
|
|
|
173
173
|
</Icon>
|
|
174
174
|
);
|
|
175
175
|
const iconContainer = screen.getByTitle('no-in-progress');
|
|
176
|
-
expect(Array.from(iconContainer?.classList || []).some(c => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
176
|
+
expect(Array.from(iconContainer?.classList || []).some((c) => /pf-m-*/.test(c))); // Check no modifier classes have been added
|
|
177
177
|
});
|
|
178
178
|
|
|
179
179
|
test('sets default progres aria-label successfully', () => {
|
|
@@ -65,7 +65,7 @@ export interface ModalProps extends React.HTMLProps<HTMLDivElement>, OUIAProps {
|
|
|
65
65
|
/** Optional alert icon (or other) to show before the title of the modal header. When the
|
|
66
66
|
* predefined alert types are used the default styling will be automatically applied.
|
|
67
67
|
*/
|
|
68
|
-
titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | '
|
|
68
|
+
titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | 'custom' | React.ComponentType<any>;
|
|
69
69
|
/** Optional title label text for screen readers. */
|
|
70
70
|
titleLabel?: string;
|
|
71
71
|
/** Variant of the modal. */
|
|
@@ -12,7 +12,7 @@ import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
|
12
12
|
import { useIsomorphicLayoutEffect } from '../../helpers';
|
|
13
13
|
|
|
14
14
|
export const isVariantIcon = (icon: any): icon is string =>
|
|
15
|
-
['success', 'danger', 'warning', 'info', '
|
|
15
|
+
['success', 'danger', 'warning', 'info', 'custom'].includes(icon as string);
|
|
16
16
|
|
|
17
17
|
export interface ModalBoxTitleProps {
|
|
18
18
|
/** Additional classes added to the modal box title. */
|
|
@@ -23,7 +23,7 @@ export interface ModalBoxTitleProps {
|
|
|
23
23
|
title: React.ReactNode;
|
|
24
24
|
/** Optional alert icon (or other) to show before the title. When the predefined alert types
|
|
25
25
|
* are used the default styling will be automatically applied. */
|
|
26
|
-
titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | '
|
|
26
|
+
titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | 'custom' | React.ComponentType<any>;
|
|
27
27
|
/** Optional title label text for screen readers. */
|
|
28
28
|
titleLabel?: string;
|
|
29
29
|
}
|
|
@@ -44,7 +44,7 @@ export const ModalBoxTitle: React.FunctionComponent<ModalBoxTitleProps> = ({
|
|
|
44
44
|
danger: <ExclamationCircleIcon />,
|
|
45
45
|
warning: <ExclamationTriangleIcon />,
|
|
46
46
|
info: <InfoCircleIcon />,
|
|
47
|
-
|
|
47
|
+
custom: <BellIcon />
|
|
48
48
|
};
|
|
49
49
|
const CustomIcon = !isVariantIcon(titleIconVariant) && titleIconVariant;
|
|
50
50
|
|
|
@@ -72,7 +72,7 @@ export interface ModalContentProps extends OUIAProps {
|
|
|
72
72
|
/** Optional alert icon (or other) to show before the title of the modal header. When the
|
|
73
73
|
* predefined alert types are used the default styling will be automatically applied.
|
|
74
74
|
*/
|
|
75
|
-
titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | '
|
|
75
|
+
titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | 'custom' | React.ComponentType<any>;
|
|
76
76
|
/** Optional title label text for screen readers. */
|
|
77
77
|
titleLabel?: string;
|
|
78
78
|
/** Variant of the modal. */
|
|
@@ -174,11 +174,7 @@ export const ModalContent: React.FunctionComponent<ModalContentProps> = ({
|
|
|
174
174
|
<ModalBox
|
|
175
175
|
id={boxId}
|
|
176
176
|
style={boxStyle}
|
|
177
|
-
className={css(
|
|
178
|
-
className,
|
|
179
|
-
isVariantIcon(titleIconVariant) &&
|
|
180
|
-
modalStyles.modifiers[titleIconVariant as 'success' | 'warning' | 'info' | 'danger' | 'custom']
|
|
181
|
-
)}
|
|
177
|
+
className={css(className, isVariantIcon(titleIconVariant) && modalStyles.modifiers[titleIconVariant])}
|
|
182
178
|
variant={variant}
|
|
183
179
|
position={position}
|
|
184
180
|
positionOffset={positionOffset}
|
|
@@ -31,9 +31,9 @@ test('ModalBoxTitle danger variant', () => {
|
|
|
31
31
|
expect(asFragment()).toMatchSnapshot();
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
test('ModalBoxTitle
|
|
34
|
+
test('ModalBoxTitle custom variant', () => {
|
|
35
35
|
const { asFragment } = render(
|
|
36
|
-
<ModalBoxTitle title="Test Modal Box warning" id="boxId" titleIconVariant="
|
|
36
|
+
<ModalBoxTitle title="Test Modal Box warning" id="boxId" titleIconVariant="custom">
|
|
37
37
|
content
|
|
38
38
|
</ModalBoxTitle>
|
|
39
39
|
);
|
|
@@ -65,7 +65,7 @@ exports[`ModalBoxTitle custom icon variant 1`] = `
|
|
|
65
65
|
</DocumentFragment>
|
|
66
66
|
`;
|
|
67
67
|
|
|
68
|
-
exports[`ModalBoxTitle
|
|
68
|
+
exports[`ModalBoxTitle custom variant 1`] = `
|
|
69
69
|
<DocumentFragment>
|
|
70
70
|
<h1
|
|
71
71
|
class="pf-c-modal-box__title pf-m-icon"
|
|
@@ -79,28 +79,28 @@ exports[`ModalBoxTitle danger variant 1`] = `
|
|
|
79
79
|
class="pf-svg"
|
|
80
80
|
fill="currentColor"
|
|
81
81
|
role="img"
|
|
82
|
-
viewBox="0 0
|
|
82
|
+
viewBox="0 0 896 1024"
|
|
83
83
|
>
|
|
84
84
|
<path
|
|
85
|
-
d="
|
|
85
|
+
d="M448,0 C465.333333,0 480.333333,6.33333333 493,19 C505.666667,31.6666667 512,46.6666667 512,64 L512,106 L514.23,106.45 C587.89,121.39 648.48,157.24 696,214 C744,271.333333 768,338.666667 768,416 C768,500 780,568.666667 804,622 C818.666667,652.666667 841.333333,684 872,716 C873.773676,718.829136 875.780658,721.505113 878,724 C890,737.333333 896,752.333333 896,769 C896,785.666667 890,800.333333 878,813 C866,825.666667 850.666667,832 832,832 L63.3,832 C44.9533333,831.84 29.8533333,825.506667 18,813 C6,800.333333 0,785.666667 0,769 C0,752.333333 6,737.333333 18,724 L24,716 L25.06,714.9 C55.1933333,683.28 77.5066667,652.313333 92,622 C116,568.666667 128,500 128,416 C128,338.666667 152,271.333333 200,214 C248,156.666667 309.333333,120.666667 384,106 L384,63.31 C384.166667,46.27 390.5,31.5 403,19 C415.666667,6.33333333 430.666667,0 448,0 Z M576,896 L576,897.08 C575.74,932.6 563.073333,962.573333 538,987 C512.666667,1011.66667 482.666667,1024 448,1024 C413.333333,1024 383.333333,1011.66667 358,987 C332.666667,962.333333 320,932 320,896 L576,896 Z"
|
|
86
86
|
/>
|
|
87
87
|
</svg>
|
|
88
88
|
</span>
|
|
89
89
|
<span
|
|
90
90
|
class="pf-u-screen-reader"
|
|
91
91
|
>
|
|
92
|
-
|
|
92
|
+
Custom alert:
|
|
93
93
|
</span>
|
|
94
94
|
<span
|
|
95
95
|
class="pf-c-modal-box__title-text"
|
|
96
96
|
>
|
|
97
|
-
Test Modal Box
|
|
97
|
+
Test Modal Box warning
|
|
98
98
|
</span>
|
|
99
99
|
</h1>
|
|
100
100
|
</DocumentFragment>
|
|
101
101
|
`;
|
|
102
102
|
|
|
103
|
-
exports[`ModalBoxTitle
|
|
103
|
+
exports[`ModalBoxTitle danger variant 1`] = `
|
|
104
104
|
<DocumentFragment>
|
|
105
105
|
<h1
|
|
106
106
|
class="pf-c-modal-box__title pf-m-icon"
|
|
@@ -114,22 +114,22 @@ exports[`ModalBoxTitle default variant 1`] = `
|
|
|
114
114
|
class="pf-svg"
|
|
115
115
|
fill="currentColor"
|
|
116
116
|
role="img"
|
|
117
|
-
viewBox="0 0
|
|
117
|
+
viewBox="0 0 512 512"
|
|
118
118
|
>
|
|
119
119
|
<path
|
|
120
|
-
d="
|
|
120
|
+
d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"
|
|
121
121
|
/>
|
|
122
122
|
</svg>
|
|
123
123
|
</span>
|
|
124
124
|
<span
|
|
125
125
|
class="pf-u-screen-reader"
|
|
126
126
|
>
|
|
127
|
-
|
|
127
|
+
Danger alert:
|
|
128
128
|
</span>
|
|
129
129
|
<span
|
|
130
130
|
class="pf-c-modal-box__title-text"
|
|
131
131
|
>
|
|
132
|
-
Test Modal Box
|
|
132
|
+
Test Modal Box danger
|
|
133
133
|
</span>
|
|
134
134
|
</h1>
|
|
135
135
|
</DocumentFragment>
|
|
@@ -102,7 +102,7 @@ To exclusively present information in a modal, remove the `header` and/or `foote
|
|
|
102
102
|
|
|
103
103
|
### Title icon
|
|
104
104
|
|
|
105
|
-
To add an icon before a modal’s title, use the `titleIconVariant`, which can be set to one of the predefined variants -- "success", "danger", "warning", "info", and "
|
|
105
|
+
To add an icon before a modal’s title, use the `titleIconVariant`, which can be set to one of the predefined variants -- "success", "danger", "warning", "info", and "custom" -- or to an imported custom icon. The following example uses a "warning" variant.
|
|
106
106
|
|
|
107
107
|
```ts file="./ModalTitleIcon.tsx"
|
|
108
108
|
|
|
@@ -18,7 +18,7 @@ export const variantIcons = {
|
|
|
18
18
|
danger: ExclamationCircleIcon,
|
|
19
19
|
warning: ExclamationTriangleIcon,
|
|
20
20
|
info: InfoCircleIcon,
|
|
21
|
-
|
|
21
|
+
custom: BellIcon
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
export interface NotificationDrawerListItemHeaderProps extends React.HTMLProps<HTMLDivElement> {
|
|
@@ -33,7 +33,7 @@ export interface NotificationDrawerListItemHeaderProps extends React.HTMLProps<H
|
|
|
33
33
|
/** Notification drawer list item title */
|
|
34
34
|
title: string;
|
|
35
35
|
/** Variant indicates the severity level */
|
|
36
|
-
variant?: 'success' | 'danger' | 'warning' | 'info' | '
|
|
36
|
+
variant?: 'success' | 'danger' | 'warning' | 'info' | 'custom';
|
|
37
37
|
/** Truncate title to number of lines */
|
|
38
38
|
truncateTitle?: number;
|
|
39
39
|
/** Position of the tooltip which is displayed if text is truncated */
|
|
@@ -62,7 +62,7 @@ export const NotificationDrawerListItemHeader: React.FunctionComponent<Notificat
|
|
|
62
62
|
icon = null,
|
|
63
63
|
srTitle,
|
|
64
64
|
title,
|
|
65
|
-
variant = '
|
|
65
|
+
variant = 'custom',
|
|
66
66
|
truncateTitle = 0,
|
|
67
67
|
tooltipPosition,
|
|
68
68
|
headingLevel: HeadingLevel = 'h2',
|
|
@@ -45,7 +45,7 @@ export interface PopoverProps {
|
|
|
45
45
|
/** Severity variants for an alert popover. This modifies the color of the header to
|
|
46
46
|
* match the severity.
|
|
47
47
|
*/
|
|
48
|
-
alertSeverityVariant?: '
|
|
48
|
+
alertSeverityVariant?: 'custom' | 'info' | 'warning' | 'success' | 'danger';
|
|
49
49
|
/** The duration of the CSS fade transition animation. */
|
|
50
50
|
animationDuration?: number;
|
|
51
51
|
/** The element to append the popover to. Defaults to "inline". */
|
|
@@ -210,7 +210,7 @@ export interface PopoverProps {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
const alertStyle = {
|
|
213
|
-
|
|
213
|
+
custom: styles.modifiers.custom,
|
|
214
214
|
info: styles.modifiers.info,
|
|
215
215
|
success: styles.modifiers.success,
|
|
216
216
|
warning: styles.modifiers.warning,
|
|
@@ -14,7 +14,7 @@ export interface PopoverHeaderProps extends Omit<React.HTMLProps<HTMLHeadingElem
|
|
|
14
14
|
/** Heading level of the header title */
|
|
15
15
|
titleHeadingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
16
16
|
/** Severity variants for an alert popover. This modifies the color of the header to match the severity. */
|
|
17
|
-
alertSeverityVariant?: '
|
|
17
|
+
alertSeverityVariant?: 'custom' | 'info' | 'warning' | 'success' | 'danger';
|
|
18
18
|
/** Id of the header */
|
|
19
19
|
id?: string;
|
|
20
20
|
/** Text announced by screen reader when alert severity variant is set to indicate severity level */
|