@patternfly/react-core 4.243.1 → 4.244.0
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 +16 -0
- package/dist/esm/components/Alert/Alert.d.ts +41 -34
- package/dist/esm/components/Alert/Alert.d.ts.map +1 -1
- package/dist/esm/components/Alert/Alert.js.map +1 -1
- package/dist/esm/components/Alert/AlertActionCloseButton.d.ts +8 -5
- package/dist/esm/components/Alert/AlertActionCloseButton.d.ts.map +1 -1
- package/dist/esm/components/Alert/AlertActionCloseButton.js.map +1 -1
- package/dist/esm/components/Alert/AlertActionLink.d.ts +5 -2
- package/dist/esm/components/Alert/AlertActionLink.d.ts.map +1 -1
- package/dist/esm/components/Alert/AlertActionLink.js.map +1 -1
- package/dist/esm/components/Alert/AlertIcon.d.ts +4 -4
- package/dist/esm/components/Alert/AlertIcon.d.ts.map +1 -1
- package/dist/esm/components/Alert/AlertToggleExpandButton.d.ts +5 -5
- package/dist/esm/components/Alert/AlertToggleExpandButton.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts +34 -28
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js +1 -0
- package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.d.ts +43 -36
- package/dist/esm/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts +34 -24
- package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
- package/dist/esm/components/ExpandableSection/ExpandableSection.js.map +1 -1
- package/dist/esm/components/ExpandableSection/ExpandableSectionToggle.d.ts +10 -5
- package/dist/esm/components/ExpandableSection/ExpandableSectionToggle.d.ts.map +1 -1
- package/dist/esm/components/ExpandableSection/ExpandableSectionToggle.js.map +1 -1
- package/dist/esm/components/FileUpload/FileUpload.d.ts +53 -47
- package/dist/esm/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/esm/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/esm/components/FileUpload/FileUploadField.d.ts +51 -46
- package/dist/esm/components/FileUpload/FileUploadField.d.ts.map +1 -1
- package/dist/esm/components/FileUpload/FileUploadField.js.map +1 -1
- package/dist/esm/components/Modal/Modal.d.ts +57 -48
- package/dist/esm/components/Modal/Modal.d.ts.map +1 -1
- package/dist/esm/components/Modal/Modal.js.map +1 -1
- package/dist/esm/components/Modal/ModalBox.d.ts +12 -12
- package/dist/esm/components/Modal/ModalBox.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxBody.d.ts +2 -2
- package/dist/esm/components/Modal/ModalBoxBody.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxCloseButton.d.ts +2 -2
- package/dist/esm/components/Modal/ModalBoxCloseButton.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxDescription.d.ts +3 -3
- package/dist/esm/components/Modal/ModalBoxDescription.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxFooter.d.ts +2 -2
- package/dist/esm/components/Modal/ModalBoxFooter.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxHeader.d.ts +3 -3
- package/dist/esm/components/Modal/ModalBoxHeader.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxTitle.d.ts +8 -9
- package/dist/esm/components/Modal/ModalBoxTitle.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxTitle.js.map +1 -1
- package/dist/esm/components/Modal/ModalContent.d.ts +56 -48
- package/dist/esm/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalContent.js.map +1 -1
- package/dist/esm/components/NotificationBadge/NotificationBadge.d.ts +17 -13
- package/dist/esm/components/NotificationBadge/NotificationBadge.d.ts.map +1 -1
- package/dist/esm/components/NotificationBadge/NotificationBadge.js +3 -3
- package/dist/esm/components/NotificationBadge/NotificationBadge.js.map +1 -1
- package/dist/esm/components/Pagination/Navigation.d.ts +33 -33
- package/dist/esm/components/Pagination/Navigation.d.ts.map +1 -1
- package/dist/esm/components/Pagination/OptionsToggle.d.ts +27 -26
- package/dist/esm/components/Pagination/OptionsToggle.d.ts.map +1 -1
- package/dist/esm/components/Pagination/OptionsToggle.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.d.ts +76 -65
- package/dist/esm/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js +1 -1
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts +22 -18
- package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
- package/dist/esm/components/Pagination/PaginationOptionsMenu.js.map +1 -1
- package/dist/esm/components/Pagination/ToggleTemplate.d.ts +3 -0
- package/dist/esm/components/Pagination/ToggleTemplate.d.ts.map +1 -1
- package/dist/esm/components/Pagination/ToggleTemplate.js.map +1 -1
- package/dist/esm/components/Popover/Popover.d.ts +88 -73
- package/dist/esm/components/Popover/Popover.d.ts.map +1 -1
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts +27 -26
- package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
- package/dist/esm/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.d.ts +71 -60
- package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/Slider/Slider.d.ts +45 -39
- package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
- package/dist/esm/components/Slider/Slider.js.map +1 -1
- package/dist/esm/components/Slider/SliderStep.d.ts +10 -10
- package/dist/esm/components/Slider/SliderStep.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeView.d.ts +65 -53
- package/dist/esm/components/TreeView/TreeView.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeView.js.map +1 -1
- package/dist/esm/components/TreeView/TreeViewList.d.ts +4 -4
- package/dist/esm/components/TreeView/TreeViewList.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeViewListItem.d.ts +46 -39
- package/dist/esm/components/TreeView/TreeViewListItem.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeViewListItem.js.map +1 -1
- package/dist/esm/components/TreeView/TreeViewRoot.d.ts +4 -4
- package/dist/esm/components/TreeView/TreeViewRoot.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeViewSearch.d.ts +11 -8
- package/dist/esm/components/TreeView/TreeViewSearch.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeViewSearch.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.js +8 -8
- package/dist/esm/helpers/Popper/Popper.js.map +1 -1
- package/dist/js/components/Alert/Alert.d.ts +41 -34
- package/dist/js/components/Alert/Alert.d.ts.map +1 -1
- package/dist/js/components/Alert/Alert.js.map +1 -1
- package/dist/js/components/Alert/AlertActionCloseButton.d.ts +8 -5
- package/dist/js/components/Alert/AlertActionCloseButton.d.ts.map +1 -1
- package/dist/js/components/Alert/AlertActionCloseButton.js.map +1 -1
- package/dist/js/components/Alert/AlertActionLink.d.ts +5 -2
- package/dist/js/components/Alert/AlertActionLink.d.ts.map +1 -1
- package/dist/js/components/Alert/AlertActionLink.js.map +1 -1
- package/dist/js/components/Alert/AlertIcon.d.ts +4 -4
- package/dist/js/components/Alert/AlertIcon.d.ts.map +1 -1
- package/dist/js/components/Alert/AlertToggleExpandButton.d.ts +5 -5
- package/dist/js/components/Alert/AlertToggleExpandButton.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts +34 -28
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js +1 -0
- package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.d.ts +43 -36
- package/dist/js/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSection.d.ts +34 -24
- package/dist/js/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSection.js.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSectionToggle.d.ts +10 -5
- package/dist/js/components/ExpandableSection/ExpandableSectionToggle.d.ts.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSectionToggle.js.map +1 -1
- package/dist/js/components/FileUpload/FileUpload.d.ts +53 -47
- package/dist/js/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/js/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/js/components/FileUpload/FileUploadField.d.ts +51 -46
- package/dist/js/components/FileUpload/FileUploadField.d.ts.map +1 -1
- package/dist/js/components/FileUpload/FileUploadField.js.map +1 -1
- package/dist/js/components/Modal/Modal.d.ts +57 -48
- package/dist/js/components/Modal/Modal.d.ts.map +1 -1
- package/dist/js/components/Modal/Modal.js.map +1 -1
- package/dist/js/components/Modal/ModalBox.d.ts +12 -12
- package/dist/js/components/Modal/ModalBox.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxBody.d.ts +2 -2
- package/dist/js/components/Modal/ModalBoxBody.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxCloseButton.d.ts +2 -2
- package/dist/js/components/Modal/ModalBoxCloseButton.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxDescription.d.ts +3 -3
- package/dist/js/components/Modal/ModalBoxDescription.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxFooter.d.ts +2 -2
- package/dist/js/components/Modal/ModalBoxFooter.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxHeader.d.ts +3 -3
- package/dist/js/components/Modal/ModalBoxHeader.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxTitle.d.ts +8 -9
- package/dist/js/components/Modal/ModalBoxTitle.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxTitle.js.map +1 -1
- package/dist/js/components/Modal/ModalContent.d.ts +56 -48
- package/dist/js/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalContent.js.map +1 -1
- package/dist/js/components/NotificationBadge/NotificationBadge.d.ts +17 -13
- package/dist/js/components/NotificationBadge/NotificationBadge.d.ts.map +1 -1
- package/dist/js/components/NotificationBadge/NotificationBadge.js +3 -3
- package/dist/js/components/NotificationBadge/NotificationBadge.js.map +1 -1
- package/dist/js/components/Pagination/Navigation.d.ts +33 -33
- package/dist/js/components/Pagination/Navigation.d.ts.map +1 -1
- package/dist/js/components/Pagination/OptionsToggle.d.ts +27 -26
- package/dist/js/components/Pagination/OptionsToggle.d.ts.map +1 -1
- package/dist/js/components/Pagination/OptionsToggle.js.map +1 -1
- package/dist/js/components/Pagination/Pagination.d.ts +76 -65
- package/dist/js/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/js/components/Pagination/Pagination.js +1 -1
- package/dist/js/components/Pagination/Pagination.js.map +1 -1
- package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts +22 -18
- package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
- package/dist/js/components/Pagination/PaginationOptionsMenu.js.map +1 -1
- package/dist/js/components/Pagination/ToggleTemplate.d.ts +3 -0
- package/dist/js/components/Pagination/ToggleTemplate.d.ts.map +1 -1
- package/dist/js/components/Pagination/ToggleTemplate.js.map +1 -1
- package/dist/js/components/Popover/Popover.d.ts +88 -73
- package/dist/js/components/Popover/Popover.d.ts.map +1 -1
- package/dist/js/components/Popover/Popover.js.map +1 -1
- package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts +27 -26
- package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
- package/dist/js/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.d.ts +71 -60
- package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/js/components/Slider/Slider.d.ts +45 -39
- package/dist/js/components/Slider/Slider.d.ts.map +1 -1
- package/dist/js/components/Slider/Slider.js.map +1 -1
- package/dist/js/components/Slider/SliderStep.d.ts +10 -10
- package/dist/js/components/Slider/SliderStep.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeView.d.ts +65 -53
- package/dist/js/components/TreeView/TreeView.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeView.js.map +1 -1
- package/dist/js/components/TreeView/TreeViewList.d.ts +4 -4
- package/dist/js/components/TreeView/TreeViewList.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeViewListItem.d.ts +46 -39
- package/dist/js/components/TreeView/TreeViewListItem.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeViewListItem.js.map +1 -1
- package/dist/js/components/TreeView/TreeViewRoot.d.ts +4 -4
- package/dist/js/components/TreeView/TreeViewRoot.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeViewSearch.d.ts +11 -8
- package/dist/js/components/TreeView/TreeViewSearch.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeViewSearch.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.js +8 -8
- package/dist/js/helpers/Popper/Popper.js.map +1 -1
- package/dist/umd/react-core.min.css +3634 -3634
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +2 -2
- package/src/components/Alert/Alert.tsx +42 -34
- package/src/components/Alert/AlertActionCloseButton.tsx +9 -5
- package/src/components/Alert/AlertActionLink.tsx +6 -2
- package/src/components/Alert/AlertIcon.tsx +4 -4
- package/src/components/Alert/AlertToggleExpandButton.tsx +5 -5
- package/src/components/Badge/__tests__/Badge.test.tsx +45 -8
- package/src/components/Badge/__tests__/__snapshots__/Badge.test.tsx.snap +2 -12
- package/src/components/CalendarMonth/CalendarMonth.tsx +36 -28
- package/src/components/DatePicker/DatePicker.tsx +45 -36
- package/src/components/ExpandableSection/ExpandableSection.tsx +35 -24
- package/src/components/ExpandableSection/ExpandableSectionToggle.tsx +11 -5
- package/src/components/FileUpload/FileUpload.tsx +56 -49
- package/src/components/FileUpload/FileUploadField.tsx +56 -50
- package/src/components/Modal/Modal.tsx +57 -48
- package/src/components/Modal/ModalBox.tsx +12 -12
- package/src/components/Modal/ModalBoxBody.tsx +2 -2
- package/src/components/Modal/ModalBoxCloseButton.tsx +2 -2
- package/src/components/Modal/ModalBoxDescription.tsx +3 -3
- package/src/components/Modal/ModalBoxFooter.tsx +2 -2
- package/src/components/Modal/ModalBoxHeader.tsx +3 -3
- package/src/components/Modal/ModalBoxTitle.tsx +8 -9
- package/src/components/Modal/ModalContent.tsx +56 -48
- package/src/components/Modal/examples/Modal.md +1 -3
- package/src/components/NotificationBadge/NotificationBadge.tsx +22 -15
- package/src/components/NotificationBadge/__tests__/NotificationBadge.test.tsx +25 -1
- package/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap +5 -0
- package/src/components/NotificationBadge/examples/NotificationBadge.md +16 -3
- package/src/components/NotificationBadge/examples/NotificationBadgeBasic.tsx +26 -13
- package/src/components/NotificationBadge/examples/NotificationBadgeWithCount.tsx +28 -18
- package/src/components/Pagination/Navigation.tsx +33 -33
- package/src/components/Pagination/OptionsToggle.tsx +27 -26
- package/src/components/Pagination/Pagination.tsx +79 -65
- package/src/components/Pagination/PaginationOptionsMenu.tsx +22 -18
- package/src/components/Pagination/ToggleTemplate.tsx +4 -0
- package/src/components/Popover/Popover.tsx +89 -73
- package/src/components/SearchInput/AdvancedSearchMenu.tsx +29 -28
- package/src/components/SearchInput/SearchInput.tsx +76 -62
- package/src/components/Slider/Slider.tsx +47 -41
- package/src/components/Slider/SliderStep.tsx +10 -10
- package/src/components/TreeView/TreeView.tsx +67 -53
- package/src/components/TreeView/TreeViewList.tsx +4 -4
- package/src/components/TreeView/TreeViewListItem.tsx +46 -39
- package/src/components/TreeView/TreeViewRoot.tsx +4 -4
- package/src/components/TreeView/TreeViewSearch.tsx +12 -8
- package/src/demos/Masthead.md +9 -193
- package/src/demos/NotificationDrawer/NotificationDrawer.md +2 -0
- package/src/demos/examples/Masthead/MastheadWithUtilitiesAndUserDropdownMenu.tsx +305 -0
- package/src/helpers/Popper/Popper.tsx +8 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.244.0",
|
|
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",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^16.8 || ^17 || ^18",
|
|
71
71
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "38e7a38cfcbb11b376302e90c1ac9df3a3f00711"
|
|
74
74
|
}
|
|
@@ -18,40 +18,50 @@ export enum AlertVariant {
|
|
|
18
18
|
default = 'default'
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/** The main alert component. */
|
|
22
|
+
|
|
21
23
|
export interface AlertProps extends Omit<React.HTMLProps<HTMLDivElement>, 'action' | 'title'>, OUIAProps {
|
|
22
|
-
/**
|
|
23
|
-
variant?: 'success' | 'danger' | 'warning' | 'info' | 'default';
|
|
24
|
-
/** Flag to indicate if the alert is inline */
|
|
25
|
-
isInline?: boolean;
|
|
26
|
-
/** Flag to indicate if the alert is plain */
|
|
27
|
-
isPlain?: boolean;
|
|
28
|
-
/** Title of the alert */
|
|
29
|
-
title: React.ReactNode;
|
|
30
|
-
/** Sets the heading level to use for the alert title. Default is h4. */
|
|
31
|
-
titleHeadingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
32
|
-
/** Close button; use the alertActionCloseButton component */
|
|
24
|
+
/** Close button; use the alert action close button component. */
|
|
33
25
|
actionClose?: React.ReactNode;
|
|
34
|
-
/** Action links; use a single
|
|
26
|
+
/** Action links; use a single alert action link component or multiple wrapped in an array
|
|
27
|
+
* or React.Fragment.
|
|
28
|
+
*/
|
|
35
29
|
actionLinks?: React.ReactNode;
|
|
36
|
-
/**
|
|
30
|
+
/** Adds accessible text to the alert. */
|
|
31
|
+
'aria-label'?: string;
|
|
32
|
+
/** Content rendered inside the alert. */
|
|
37
33
|
children?: React.ReactNode;
|
|
38
|
-
/** Additional classes
|
|
34
|
+
/** Additional classes to add to the alert. */
|
|
39
35
|
className?: string;
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
/** Flag
|
|
36
|
+
/** Set a custom icon to the alert. If not set the icon is set according to the variant. */
|
|
37
|
+
customIcon?: React.ReactNode;
|
|
38
|
+
/** Uniquely identifies the alert. */
|
|
39
|
+
id?: string;
|
|
40
|
+
/** Flag indicating that the alert is expandable. */
|
|
41
|
+
isExpandable?: boolean;
|
|
42
|
+
/** Flag to indicate if the alert is inline. */
|
|
43
|
+
isInline?: boolean;
|
|
44
|
+
/** Flag to indicate if the alert is in a live region. */
|
|
45
45
|
isLiveRegion?: boolean;
|
|
46
|
-
/**
|
|
46
|
+
/** Flag to indicate if the alert is plain. */
|
|
47
|
+
isPlain?: boolean;
|
|
48
|
+
/** Function to be executed on alert timeout. Relevant when the timeout prop is set. */
|
|
49
|
+
onTimeout?: () => void;
|
|
50
|
+
/** If set to true, the timeout is 8000 milliseconds. If a number is provided, alert will
|
|
51
|
+
* be dismissed after that amount of time in milliseconds.
|
|
52
|
+
*/
|
|
47
53
|
timeout?: number | boolean;
|
|
48
|
-
/** If the user hovers over the alert and `timeout` expires, this is how long to wait
|
|
54
|
+
/** If the user hovers over the alert and `timeout` expires, this is how long to wait
|
|
55
|
+
* before finally dismissing the alert.
|
|
56
|
+
*/
|
|
49
57
|
timeoutAnimation?: number;
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
/**
|
|
58
|
+
/** Title of the alert. */
|
|
59
|
+
title: React.ReactNode;
|
|
60
|
+
/** Sets the heading level to use for the alert title. Default is h4. */
|
|
61
|
+
titleHeadingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
62
|
+
/** Adds accessible text to the alert toggle. */
|
|
63
|
+
toggleAriaLabel?: string;
|
|
64
|
+
/** Position of the tooltip which is displayed if text is truncated. */
|
|
55
65
|
tooltipPosition?:
|
|
56
66
|
| TooltipPosition
|
|
57
67
|
| 'auto'
|
|
@@ -67,14 +77,12 @@ export interface AlertProps extends Omit<React.HTMLProps<HTMLDivElement>, 'actio
|
|
|
67
77
|
| 'left-end'
|
|
68
78
|
| 'right-start'
|
|
69
79
|
| 'right-end';
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
/** Uniquely identifies the alert */
|
|
77
|
-
id?: string;
|
|
80
|
+
/** Truncate title to number of lines. */
|
|
81
|
+
truncateTitle?: number;
|
|
82
|
+
/** Adds alert variant styles. */
|
|
83
|
+
variant?: 'success' | 'danger' | 'warning' | 'info' | 'default';
|
|
84
|
+
/** Variant label text for screen readers. */
|
|
85
|
+
variantLabel?: string;
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
export const Alert: React.FunctionComponent<AlertProps> = ({
|
|
@@ -3,14 +3,18 @@ import { Button, ButtonVariant, ButtonProps } from '../Button';
|
|
|
3
3
|
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
4
4
|
import { AlertContext } from './AlertContext';
|
|
5
5
|
|
|
6
|
+
/** Renders a close button for a dismissable alert when this sub-component is passed into
|
|
7
|
+
* the alert's actionClose property.
|
|
8
|
+
*/
|
|
9
|
+
|
|
6
10
|
export interface AlertActionCloseButtonProps extends ButtonProps {
|
|
7
|
-
/**
|
|
11
|
+
/** Accessible label for the close button */
|
|
12
|
+
'aria-label'?: string;
|
|
13
|
+
/** Additional classes added to the alert action close button. */
|
|
8
14
|
className?: string;
|
|
9
|
-
/** A callback for when the close button is clicked */
|
|
15
|
+
/** A callback for when the close button is clicked. */
|
|
10
16
|
onClose?: () => void;
|
|
11
|
-
/**
|
|
12
|
-
'aria-label'?: string;
|
|
13
|
-
/** Variant Label for the Close button */
|
|
17
|
+
/** Variant Label for the close button. */
|
|
14
18
|
variantLabel?: string;
|
|
15
19
|
}
|
|
16
20
|
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Button, ButtonVariant, ButtonProps } from '../Button';
|
|
3
3
|
|
|
4
|
+
/** Renders buttons styled as links beneath the alert title and description when this sub-component
|
|
5
|
+
* is passed into the alert's actionLinks property.
|
|
6
|
+
*/
|
|
7
|
+
|
|
4
8
|
export interface AlertActionLinkProps extends ButtonProps {
|
|
5
|
-
/** Content rendered inside the
|
|
9
|
+
/** Content rendered inside the alert action link. */
|
|
6
10
|
children?: string;
|
|
7
|
-
/** Additional classes added to the
|
|
11
|
+
/** Additional classes added to the alert action link. */
|
|
8
12
|
className?: string;
|
|
9
13
|
}
|
|
10
14
|
|
|
@@ -16,12 +16,12 @@ export const variantIcons = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export interface AlertIconProps extends React.HTMLProps<HTMLDivElement> {
|
|
19
|
-
/**
|
|
20
|
-
variant: 'success' | 'danger' | 'warning' | 'info' | 'default';
|
|
21
|
-
/** className */
|
|
19
|
+
/** Additional class names added to the alert icon. */
|
|
22
20
|
className?: string;
|
|
23
|
-
/** A custom icon. If not set the icon is set according to the variant */
|
|
21
|
+
/** A custom icon. If not set the icon is set according to the variant. */
|
|
24
22
|
customIcon?: React.ReactNode;
|
|
23
|
+
/** Variant of the alert icon. */
|
|
24
|
+
variant: 'success' | 'danger' | 'warning' | 'info' | 'default';
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const AlertIcon = ({ variant, customIcon, className = '', ...props }: AlertIconProps) => {
|
|
@@ -6,13 +6,13 @@ import { css } from '@patternfly/react-styles';
|
|
|
6
6
|
import styles from '@patternfly/react-styles/css/components/Alert/alert';
|
|
7
7
|
|
|
8
8
|
export interface AlertToggleExpandButtonProps extends ButtonProps {
|
|
9
|
-
/**
|
|
9
|
+
/** Accessible label for the toggle button. */
|
|
10
10
|
'aria-label'?: string;
|
|
11
|
-
/**
|
|
12
|
-
onToggleExpand?: () => void;
|
|
13
|
-
/** Flag to indicate if the content is expanded */
|
|
11
|
+
/** Flag to indicate if the content is expanded. */
|
|
14
12
|
isExpanded?: boolean;
|
|
15
|
-
/**
|
|
13
|
+
/** A callback for when the toggle button is clicked. */
|
|
14
|
+
onToggleExpand?: () => void;
|
|
15
|
+
/** Variant label for the toggle button. */
|
|
16
16
|
variantLabel?: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -1,10 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
1
3
|
import { Badge } from '../Badge';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
|
|
5
|
+
test('Renders without children', () => {
|
|
6
|
+
render(
|
|
7
|
+
<div data-testid="badge">
|
|
8
|
+
<Badge />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
expect(screen.getByTestId('badge').firstChild).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Renders children', () => {
|
|
15
|
+
render(<Badge>Test</Badge>);
|
|
16
|
+
expect(screen.getByText('Test')).toBeVisible();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('Renders with class name pf-c-badge', () => {
|
|
20
|
+
render(<Badge>Test</Badge>);
|
|
21
|
+
expect(screen.getByText('Test')).toHaveClass('pf-c-badge');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('Renders with class name pf-m-unread by default', () => {
|
|
25
|
+
render(<Badge>Test</Badge>);
|
|
26
|
+
expect(screen.getByText('Test')).toHaveClass('pf-m-unread');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('Renders with class name pf-m-read when isRead prop is true', () => {
|
|
30
|
+
render(<Badge isRead={true}>Test</Badge>);
|
|
31
|
+
expect(screen.getByText('Test')).toHaveClass('pf-m-read');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('Renders with custom class name when className prop is provided', () => {
|
|
35
|
+
render(<Badge className="custom-class">Test</Badge>);
|
|
36
|
+
expect(screen.getByText('Test')).toHaveClass('custom-class');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('Renders with inherited element props spread to the component', () => {
|
|
40
|
+
render(<Badge aria-label="Test label">Test</Badge>);
|
|
41
|
+
expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Matches the snapshot', () => {
|
|
45
|
+
const { asFragment } = render(<Badge>Test</Badge>);
|
|
46
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
47
|
});
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Matches the snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<span
|
|
6
6
|
class="pf-c-badge pf-m-unread"
|
|
7
7
|
>
|
|
8
|
-
|
|
9
|
-
</span>
|
|
10
|
-
</DocumentFragment>
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
exports[`true Badge 1`] = `
|
|
14
|
-
<DocumentFragment>
|
|
15
|
-
<span
|
|
16
|
-
class="pf-c-badge pf-m-read"
|
|
17
|
-
>
|
|
18
|
-
read Badge
|
|
8
|
+
Test
|
|
19
9
|
</span>
|
|
20
10
|
</DocumentFragment>
|
|
21
11
|
`;
|
|
@@ -19,49 +19,55 @@ export enum Weekday {
|
|
|
19
19
|
Saturday
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/** Additional properties that extend from and can be passed to the main component. These
|
|
23
|
+
* properties allow customizing the calendar formatting and aria-labels.
|
|
24
|
+
*/
|
|
25
|
+
|
|
22
26
|
export interface CalendarFormat {
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
/** How to format
|
|
26
|
-
weekdayFormat?: (date: Date) => React.ReactNode;
|
|
27
|
-
/** How to format days in header for screen readers */
|
|
28
|
-
longWeekdayFormat?: (date: Date) => React.ReactNode;
|
|
29
|
-
/** How to format days in buttons in table cells */
|
|
27
|
+
/** Accessible label for the date cells. */
|
|
28
|
+
cellAriaLabel?: (date: Date) => string;
|
|
29
|
+
/** How to format days in buttons in table cells. */
|
|
30
30
|
dayFormat?: (date: Date) => React.ReactNode;
|
|
31
|
-
/** If using the default formatters which locale to use. Undefined defaults to current locale.
|
|
31
|
+
/** If using the default formatters which locale to use. Undefined defaults to current locale.
|
|
32
|
+
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation
|
|
33
|
+
*/
|
|
32
34
|
locale?: string;
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
/**
|
|
35
|
+
/** How to format days in header for screen readers. */
|
|
36
|
+
longWeekdayFormat?: (date: Date) => React.ReactNode;
|
|
37
|
+
/** How to format months in month select. */
|
|
38
|
+
monthFormat?: (date: Date) => React.ReactNode;
|
|
39
|
+
/** Accessible label for the previous month button. */
|
|
38
40
|
prevMonthAriaLabel?: string;
|
|
39
|
-
/**
|
|
41
|
+
/** Accessible label for the next month button. */
|
|
40
42
|
nextMonthAriaLabel?: string;
|
|
41
|
-
/**
|
|
43
|
+
/** Which date to start range styles from. */
|
|
44
|
+
rangeStart?: Date;
|
|
45
|
+
/** How to format week days in header. */
|
|
46
|
+
weekdayFormat?: (date: Date) => React.ReactNode;
|
|
47
|
+
/** Day of week that starts the week. 0 is Sunday, 6 is Saturday. */
|
|
48
|
+
weekStart?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | Weekday;
|
|
49
|
+
/** Accessible label for the year input. */
|
|
42
50
|
yearInputAriaLabel?: string;
|
|
43
|
-
/** Aria-label for the date cells */
|
|
44
|
-
cellAriaLabel?: (date: Date) => string;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
export interface CalendarProps extends CalendarFormat, Omit<React.HTMLProps<HTMLDivElement>, 'onChange'> {
|
|
48
|
-
/**
|
|
49
|
-
date?: Date;
|
|
50
|
-
/** Callback when date is selected */
|
|
51
|
-
onChange?: (date: Date) => void;
|
|
52
|
-
/** Functions that returns if a date is valid and selectable */
|
|
53
|
-
validators?: ((date: Date) => boolean)[];
|
|
54
|
-
/** Classname to add to outer div */
|
|
54
|
+
/** Additional classes to add to the outer div of the calendar month. */
|
|
55
55
|
className?: string;
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
/** Flag to set browser focus on the passed date **/
|
|
56
|
+
/** Month/year to base other dates around. */
|
|
57
|
+
date?: Date;
|
|
58
|
+
/** Flag to set browser focus on the passed date. **/
|
|
59
59
|
isDateFocused?: boolean;
|
|
60
|
-
/** Callback when
|
|
60
|
+
/** Callback when date is selected. */
|
|
61
|
+
onChange?: (date: Date) => void;
|
|
62
|
+
/** Callback when month or year is changed. */
|
|
61
63
|
onMonthChange?: (
|
|
62
64
|
newDate?: Date,
|
|
63
65
|
event?: React.MouseEvent | React.ChangeEvent | React.FormEvent<HTMLInputElement>
|
|
64
66
|
) => void;
|
|
67
|
+
/** @hide Internal prop to allow pressing escape in select menu to not close popover. */
|
|
68
|
+
onSelectToggle?: (open: boolean) => void;
|
|
69
|
+
/** Functions that returns if a date is valid and selectable. */
|
|
70
|
+
validators?: ((date: Date) => boolean)[];
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
// Must be numeric given current header design
|
|
@@ -107,6 +113,8 @@ export const isValidDate = (date: Date) => Boolean(date && !isNaN(date as any));
|
|
|
107
113
|
|
|
108
114
|
const today = new Date();
|
|
109
115
|
|
|
116
|
+
/** The main calendar month component. */
|
|
117
|
+
|
|
110
118
|
export const CalendarMonth = ({
|
|
111
119
|
date: dateProp,
|
|
112
120
|
locale = undefined,
|
|
@@ -10,58 +10,67 @@ import { CalendarMonth, CalendarFormat, isValidDate } from '../CalendarMonth';
|
|
|
10
10
|
import { useImperativeHandle } from 'react';
|
|
11
11
|
import { KeyTypes } from '../../helpers';
|
|
12
12
|
|
|
13
|
+
/** The main date picker component. */
|
|
14
|
+
|
|
13
15
|
export interface DatePickerProps
|
|
14
16
|
extends CalendarFormat,
|
|
15
17
|
Omit<React.HTMLProps<HTMLInputElement>, 'onChange' | 'onFocus' | 'onBlur' | 'disabled' | 'ref'> {
|
|
16
|
-
/** Additional classes added to the date time picker. */
|
|
17
|
-
className?: string;
|
|
18
|
-
/** Accessible label for the date picker */
|
|
19
|
-
'aria-label'?: string;
|
|
20
|
-
/** How to format the date in the TextInput */
|
|
21
|
-
dateFormat?: (date: Date) => string;
|
|
22
|
-
/** How to format the date in the TextInput */
|
|
23
|
-
dateParse?: (value: string) => Date;
|
|
24
|
-
/** Flag indicating the date picker is disabled*/
|
|
25
|
-
isDisabled?: boolean;
|
|
26
|
-
/** String to display in the empty date picker field as a hint for the expected date format */
|
|
27
|
-
placeholder?: string;
|
|
28
|
-
/** Value of TextInput */
|
|
29
|
-
value?: string;
|
|
30
|
-
/** Error message to display when the TextInput cannot be parsed. */
|
|
31
|
-
invalidFormatText?: string;
|
|
32
|
-
/** Callback called every time the input value changes */
|
|
33
|
-
onChange?: (value: string, date?: Date) => void;
|
|
34
|
-
/** Callback called every time the input loses focus */
|
|
35
|
-
onBlur?: (value: string, date?: Date) => void;
|
|
36
|
-
/** Text for label */
|
|
37
|
-
helperText?: React.ReactNode;
|
|
38
|
-
/** Aria label for the button to open the date picker */
|
|
39
|
-
buttonAriaLabel?: string;
|
|
40
18
|
/** The container to append the menu to. Defaults to 'parent'.
|
|
41
19
|
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
42
20
|
* Some examples:
|
|
43
|
-
* menuAppendTo={() => document.body}
|
|
21
|
+
* menuAppendTo={() => document.body};
|
|
44
22
|
* menuAppendTo={document.getElementById('target')}
|
|
45
23
|
*/
|
|
46
24
|
appendTo?: HTMLElement | ((ref?: HTMLElement) => HTMLElement) | 'parent';
|
|
47
|
-
/**
|
|
25
|
+
/** Accessible label for the date picker. */
|
|
26
|
+
'aria-label'?: string;
|
|
27
|
+
/** Accessible label for the button to open the date picker. */
|
|
28
|
+
buttonAriaLabel?: string;
|
|
29
|
+
/** Additional classes added to the date picker. */
|
|
30
|
+
className?: string;
|
|
31
|
+
/** How to format the date in the text input. */
|
|
32
|
+
dateFormat?: (date: Date) => string;
|
|
33
|
+
/** How to format the date in the text input. */
|
|
34
|
+
dateParse?: (value: string) => Date;
|
|
35
|
+
/** Helper text to display alongside the date picker. */
|
|
36
|
+
helperText?: React.ReactNode;
|
|
37
|
+
/** Additional props for the text input. */
|
|
38
|
+
inputProps?: TextInputProps;
|
|
39
|
+
/** Flag indicating the date picker is disabled. */
|
|
40
|
+
isDisabled?: boolean;
|
|
41
|
+
/** Error message to display when the text input cannot be parsed. */
|
|
42
|
+
invalidFormatText?: string;
|
|
43
|
+
/** Callback called every time the text input loses focus. */
|
|
44
|
+
onBlur?: (value: string, date?: Date) => void;
|
|
45
|
+
/** Callback called every time the text input value changes. */
|
|
46
|
+
onChange?: (value: string, date?: Date) => void;
|
|
47
|
+
/** String to display in the empty text input as a hint for the expected date format. */
|
|
48
|
+
placeholder?: string;
|
|
49
|
+
/** Props to pass to the popover that contains the calendar month component. */
|
|
48
50
|
popoverProps?: Partial<Omit<PopoverProps, 'appendTo'>>;
|
|
49
|
-
/** Functions that returns an error message if a date is invalid */
|
|
51
|
+
/** Functions that returns an error message if a date is invalid. */
|
|
50
52
|
validators?: ((date: Date) => string)[];
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
+
/** Value of the text input. */
|
|
54
|
+
value?: string;
|
|
53
55
|
}
|
|
54
56
|
|
|
57
|
+
/** Allows finer control over the calendar's open state when a React ref is passed into the
|
|
58
|
+
* date picker component. Accessed via ref.current[property], e.g. ref.current.toggleCalendar().
|
|
59
|
+
*/
|
|
60
|
+
|
|
55
61
|
export interface DatePickerRef {
|
|
56
|
-
/**
|
|
62
|
+
/** Current calendar open status. */
|
|
63
|
+
isCalendarOpen: boolean;
|
|
64
|
+
/** Sets the calendar open status. */
|
|
57
65
|
setCalendarOpen: (isOpen: boolean) => void;
|
|
58
|
-
/** Toggles the calendar open status. If no parameters are passed, the calendar will simply
|
|
59
|
-
*
|
|
60
|
-
* If the
|
|
61
|
-
*
|
|
66
|
+
/** Toggles the calendar open status. If no parameters are passed, the calendar will simply
|
|
67
|
+
* toggle its open status.
|
|
68
|
+
* If the isOpen parameter is passed, that will set the calendar open status to the value
|
|
69
|
+
* of the isOpen parameter.
|
|
70
|
+
* If the eventKey parameter is set to 'Escape', that will invoke the date pickers
|
|
71
|
+
* onEscapePress event to toggle the correct control appropriately.
|
|
72
|
+
*/
|
|
62
73
|
toggleCalendar: (isOpen?: boolean, eventKey?: string) => void;
|
|
63
|
-
/** Current calendar open status */
|
|
64
|
-
isCalendarOpen: boolean;
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
export const yyyyMMddFormat = (date: Date) =>
|
|
@@ -10,42 +10,53 @@ export enum ExpandableSectionVariant {
|
|
|
10
10
|
truncate = 'truncate'
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/** The main expandable section component. */
|
|
14
|
+
|
|
13
15
|
export interface ExpandableSectionProps extends React.HTMLProps<HTMLDivElement> {
|
|
14
16
|
/** Content rendered inside the expandable section. */
|
|
15
17
|
children?: React.ReactNode;
|
|
16
18
|
/** Additional classes added to the expandable section. */
|
|
17
19
|
className?: string;
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
toggleText?: string;
|
|
22
|
-
/** Text that appears in the attached toggle when expanded (will override toggleText if both are specified; used for uncontrolled expandable with dynamic toggle text) */
|
|
23
|
-
toggleTextExpanded?: string;
|
|
24
|
-
/** Text that appears in the attached toggle when collapsed (will override toggleText if both are specified; used for uncontrolled expandable with dynamic toggle text) */
|
|
25
|
-
toggleTextCollapsed?: string;
|
|
26
|
-
/** React node that appears in the attached toggle in place of toggle text */
|
|
27
|
-
toggleContent?: React.ReactNode;
|
|
28
|
-
/** Callback function to toggle the expandable section. Detached expandable sections should use the onToggle property of the expandable section toggle sub-component. */
|
|
29
|
-
onToggle?: (isExpanded: boolean) => void;
|
|
30
|
-
/** Forces active state */
|
|
31
|
-
isActive?: boolean;
|
|
32
|
-
/** Indicates the expandable section has a detached toggle */
|
|
33
|
-
isDetached?: boolean;
|
|
34
|
-
/** ID of the content of the expandable section */
|
|
20
|
+
/** Id of the content of the expandable section. When passing in the isDetached property, this
|
|
21
|
+
* property's value should match the contenId property of the expandable section toggle sub-component.
|
|
22
|
+
*/
|
|
35
23
|
contentId?: string;
|
|
36
|
-
/** Display size variant. Set to large for disclosure styling. */
|
|
24
|
+
/** Display size variant. Set to "large" for disclosure styling. */
|
|
37
25
|
displaySize?: 'default' | 'large';
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
/**
|
|
26
|
+
/** Forces active state. */
|
|
27
|
+
isActive?: boolean;
|
|
28
|
+
/** Indicates the expandable section has a detached toggle. */
|
|
29
|
+
isDetached?: boolean;
|
|
30
|
+
/** Flag to indicate if the content is expanded. */
|
|
31
|
+
isExpanded?: boolean;
|
|
32
|
+
/** Flag to indicate if the content is indented. */
|
|
41
33
|
isIndented?: boolean;
|
|
34
|
+
/** Flag to indicate the width of the component is limited. Set to "true" for disclosure styling. */
|
|
35
|
+
isWidthLimited?: boolean;
|
|
36
|
+
/** Callback function to toggle the expandable section. Detached expandable sections should
|
|
37
|
+
* use the onToggle property of the expandable section toggle sub-component.
|
|
38
|
+
*/
|
|
39
|
+
onToggle?: (isExpanded: boolean) => void;
|
|
40
|
+
/** React node that appears in the attached toggle in place of the toggleText property. */
|
|
41
|
+
toggleContent?: React.ReactNode;
|
|
42
|
+
/** Text that appears in the attached toggle. */
|
|
43
|
+
toggleText?: string;
|
|
44
|
+
/** Text that appears in the attached toggle when collapsed (will override toggleText if
|
|
45
|
+
* both are specified; used for uncontrolled expandable with dynamic toggle text).
|
|
46
|
+
*/
|
|
47
|
+
toggleTextCollapsed?: string;
|
|
48
|
+
/** Text that appears in the attached toggle when expanded (will override toggleText if
|
|
49
|
+
* both are specified; used for uncontrolled expandable with dynamic toggle text).
|
|
50
|
+
*/
|
|
51
|
+
toggleTextExpanded?: string;
|
|
52
|
+
/** @beta Truncates the expandable content to the specified number of lines when using the
|
|
53
|
+
* "truncate" variant.
|
|
54
|
+
*/
|
|
55
|
+
truncateMaxLines?: number;
|
|
42
56
|
/** @beta Determines the variant of the expandable section. When passing in "truncate" as the
|
|
43
57
|
* variant, the expandable content will be truncated after 3 lines by default.
|
|
44
58
|
*/
|
|
45
59
|
variant?: 'default' | 'truncate';
|
|
46
|
-
/** @beta Truncates the expandable content to the specified number of lines when using the
|
|
47
|
-
* "truncate" variant. */
|
|
48
|
-
truncateMaxLines?: number;
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
interface ExpandableSectionState {
|
|
@@ -3,21 +3,27 @@ import styles from '@patternfly/react-styles/css/components/ExpandableSection/ex
|
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
5
5
|
|
|
6
|
+
/** Acts as the toggle sub-component when the main expandable section component has the isDetached
|
|
7
|
+
* property passed in. Allows for more custom control over the expandable section's toggle.
|
|
8
|
+
*/
|
|
9
|
+
|
|
6
10
|
export interface ExpandableSectionToggleProps extends React.HTMLProps<HTMLDivElement> {
|
|
7
11
|
/** Content rendered inside the expandable toggle. */
|
|
8
12
|
children?: React.ReactNode;
|
|
9
13
|
/** Additional classes added to the expandable toggle. */
|
|
10
14
|
className?: string;
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
onToggle?: (isExpanded: boolean) => void;
|
|
15
|
-
/** ID of the toggle's respective expandable section content. */
|
|
15
|
+
/** Id of the toggle's respective expandable section content. The value passed into this
|
|
16
|
+
* property should match the contentId property of the main expandable section component.
|
|
17
|
+
*/
|
|
16
18
|
contentId?: string;
|
|
17
19
|
/** Direction the toggle arrow should point when the expandable section is expanded. */
|
|
18
20
|
direction?: 'up' | 'down';
|
|
19
21
|
/** @beta Flag to determine toggle styling when the expandable content is truncated. */
|
|
20
22
|
hasTruncatedContent?: boolean;
|
|
23
|
+
/** Flag indicating if the expandable section is expanded. */
|
|
24
|
+
isExpanded?: boolean;
|
|
25
|
+
/** Callback function to toggle the expandable content. */
|
|
26
|
+
onToggle?: (isExpanded: boolean) => void;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
export const ExpandableSectionToggle: React.FunctionComponent<ExpandableSectionToggleProps> = ({
|