@patternfly/react-core 4.243.1 → 4.244.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/esm/components/Alert/Alert.d.ts +41 -34
  3. package/dist/esm/components/Alert/Alert.d.ts.map +1 -1
  4. package/dist/esm/components/Alert/Alert.js.map +1 -1
  5. package/dist/esm/components/Alert/AlertActionCloseButton.d.ts +8 -5
  6. package/dist/esm/components/Alert/AlertActionCloseButton.d.ts.map +1 -1
  7. package/dist/esm/components/Alert/AlertActionCloseButton.js.map +1 -1
  8. package/dist/esm/components/Alert/AlertActionLink.d.ts +5 -2
  9. package/dist/esm/components/Alert/AlertActionLink.d.ts.map +1 -1
  10. package/dist/esm/components/Alert/AlertActionLink.js.map +1 -1
  11. package/dist/esm/components/Alert/AlertIcon.d.ts +4 -4
  12. package/dist/esm/components/Alert/AlertIcon.d.ts.map +1 -1
  13. package/dist/esm/components/Alert/AlertToggleExpandButton.d.ts +5 -5
  14. package/dist/esm/components/Alert/AlertToggleExpandButton.d.ts.map +1 -1
  15. package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts +34 -28
  16. package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
  17. package/dist/esm/components/CalendarMonth/CalendarMonth.js +1 -0
  18. package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
  19. package/dist/esm/components/DatePicker/DatePicker.d.ts +43 -36
  20. package/dist/esm/components/DatePicker/DatePicker.d.ts.map +1 -1
  21. package/dist/esm/components/DatePicker/DatePicker.js +4 -0
  22. package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
  23. package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts +34 -24
  24. package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
  25. package/dist/esm/components/ExpandableSection/ExpandableSection.js.map +1 -1
  26. package/dist/esm/components/ExpandableSection/ExpandableSectionToggle.d.ts +10 -5
  27. package/dist/esm/components/ExpandableSection/ExpandableSectionToggle.d.ts.map +1 -1
  28. package/dist/esm/components/ExpandableSection/ExpandableSectionToggle.js.map +1 -1
  29. package/dist/esm/components/FileUpload/FileUpload.d.ts +53 -47
  30. package/dist/esm/components/FileUpload/FileUpload.d.ts.map +1 -1
  31. package/dist/esm/components/FileUpload/FileUpload.js.map +1 -1
  32. package/dist/esm/components/FileUpload/FileUploadField.d.ts +51 -46
  33. package/dist/esm/components/FileUpload/FileUploadField.d.ts.map +1 -1
  34. package/dist/esm/components/FileUpload/FileUploadField.js.map +1 -1
  35. package/dist/esm/components/Modal/Modal.d.ts +57 -48
  36. package/dist/esm/components/Modal/Modal.d.ts.map +1 -1
  37. package/dist/esm/components/Modal/Modal.js.map +1 -1
  38. package/dist/esm/components/Modal/ModalBox.d.ts +12 -12
  39. package/dist/esm/components/Modal/ModalBox.d.ts.map +1 -1
  40. package/dist/esm/components/Modal/ModalBoxBody.d.ts +2 -2
  41. package/dist/esm/components/Modal/ModalBoxBody.d.ts.map +1 -1
  42. package/dist/esm/components/Modal/ModalBoxCloseButton.d.ts +2 -2
  43. package/dist/esm/components/Modal/ModalBoxCloseButton.d.ts.map +1 -1
  44. package/dist/esm/components/Modal/ModalBoxDescription.d.ts +3 -3
  45. package/dist/esm/components/Modal/ModalBoxDescription.d.ts.map +1 -1
  46. package/dist/esm/components/Modal/ModalBoxFooter.d.ts +2 -2
  47. package/dist/esm/components/Modal/ModalBoxFooter.d.ts.map +1 -1
  48. package/dist/esm/components/Modal/ModalBoxHeader.d.ts +3 -3
  49. package/dist/esm/components/Modal/ModalBoxHeader.d.ts.map +1 -1
  50. package/dist/esm/components/Modal/ModalBoxTitle.d.ts +8 -9
  51. package/dist/esm/components/Modal/ModalBoxTitle.d.ts.map +1 -1
  52. package/dist/esm/components/Modal/ModalBoxTitle.js.map +1 -1
  53. package/dist/esm/components/Modal/ModalContent.d.ts +56 -48
  54. package/dist/esm/components/Modal/ModalContent.d.ts.map +1 -1
  55. package/dist/esm/components/Modal/ModalContent.js.map +1 -1
  56. package/dist/esm/components/NotificationBadge/NotificationBadge.d.ts +17 -13
  57. package/dist/esm/components/NotificationBadge/NotificationBadge.d.ts.map +1 -1
  58. package/dist/esm/components/NotificationBadge/NotificationBadge.js +3 -3
  59. package/dist/esm/components/NotificationBadge/NotificationBadge.js.map +1 -1
  60. package/dist/esm/components/Pagination/Navigation.d.ts +33 -33
  61. package/dist/esm/components/Pagination/Navigation.d.ts.map +1 -1
  62. package/dist/esm/components/Pagination/OptionsToggle.d.ts +27 -26
  63. package/dist/esm/components/Pagination/OptionsToggle.d.ts.map +1 -1
  64. package/dist/esm/components/Pagination/OptionsToggle.js.map +1 -1
  65. package/dist/esm/components/Pagination/Pagination.d.ts +76 -65
  66. package/dist/esm/components/Pagination/Pagination.d.ts.map +1 -1
  67. package/dist/esm/components/Pagination/Pagination.js +1 -1
  68. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  69. package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts +22 -18
  70. package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
  71. package/dist/esm/components/Pagination/PaginationOptionsMenu.js.map +1 -1
  72. package/dist/esm/components/Pagination/ToggleTemplate.d.ts +3 -0
  73. package/dist/esm/components/Pagination/ToggleTemplate.d.ts.map +1 -1
  74. package/dist/esm/components/Pagination/ToggleTemplate.js.map +1 -1
  75. package/dist/esm/components/Popover/Popover.d.ts +88 -73
  76. package/dist/esm/components/Popover/Popover.d.ts.map +1 -1
  77. package/dist/esm/components/Popover/Popover.js.map +1 -1
  78. package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts +27 -26
  79. package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  80. package/dist/esm/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  81. package/dist/esm/components/SearchInput/SearchInput.d.ts +71 -60
  82. package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
  83. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  84. package/dist/esm/components/Select/Select.d.ts +2 -0
  85. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  86. package/dist/esm/components/Select/Select.js +4 -3
  87. package/dist/esm/components/Select/Select.js.map +1 -1
  88. package/dist/esm/components/Select/SelectToggle.d.ts +2 -0
  89. package/dist/esm/components/Select/SelectToggle.d.ts.map +1 -1
  90. package/dist/esm/components/Select/SelectToggle.js +3 -5
  91. package/dist/esm/components/Select/SelectToggle.js.map +1 -1
  92. package/dist/esm/components/Slider/Slider.d.ts +45 -39
  93. package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
  94. package/dist/esm/components/Slider/Slider.js.map +1 -1
  95. package/dist/esm/components/Slider/SliderStep.d.ts +10 -10
  96. package/dist/esm/components/Slider/SliderStep.d.ts.map +1 -1
  97. package/dist/esm/components/TreeView/TreeView.d.ts +65 -53
  98. package/dist/esm/components/TreeView/TreeView.d.ts.map +1 -1
  99. package/dist/esm/components/TreeView/TreeView.js.map +1 -1
  100. package/dist/esm/components/TreeView/TreeViewList.d.ts +4 -4
  101. package/dist/esm/components/TreeView/TreeViewList.d.ts.map +1 -1
  102. package/dist/esm/components/TreeView/TreeViewListItem.d.ts +46 -39
  103. package/dist/esm/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  104. package/dist/esm/components/TreeView/TreeViewListItem.js.map +1 -1
  105. package/dist/esm/components/TreeView/TreeViewRoot.d.ts +4 -4
  106. package/dist/esm/components/TreeView/TreeViewRoot.d.ts.map +1 -1
  107. package/dist/esm/components/TreeView/TreeViewSearch.d.ts +11 -8
  108. package/dist/esm/components/TreeView/TreeViewSearch.d.ts.map +1 -1
  109. package/dist/esm/components/TreeView/TreeViewSearch.js.map +1 -1
  110. package/dist/esm/helpers/Popper/Popper.js +8 -8
  111. package/dist/esm/helpers/Popper/Popper.js.map +1 -1
  112. package/dist/js/components/Alert/Alert.d.ts +41 -34
  113. package/dist/js/components/Alert/Alert.d.ts.map +1 -1
  114. package/dist/js/components/Alert/Alert.js.map +1 -1
  115. package/dist/js/components/Alert/AlertActionCloseButton.d.ts +8 -5
  116. package/dist/js/components/Alert/AlertActionCloseButton.d.ts.map +1 -1
  117. package/dist/js/components/Alert/AlertActionCloseButton.js.map +1 -1
  118. package/dist/js/components/Alert/AlertActionLink.d.ts +5 -2
  119. package/dist/js/components/Alert/AlertActionLink.d.ts.map +1 -1
  120. package/dist/js/components/Alert/AlertActionLink.js.map +1 -1
  121. package/dist/js/components/Alert/AlertIcon.d.ts +4 -4
  122. package/dist/js/components/Alert/AlertIcon.d.ts.map +1 -1
  123. package/dist/js/components/Alert/AlertToggleExpandButton.d.ts +5 -5
  124. package/dist/js/components/Alert/AlertToggleExpandButton.d.ts.map +1 -1
  125. package/dist/js/components/CalendarMonth/CalendarMonth.d.ts +34 -28
  126. package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
  127. package/dist/js/components/CalendarMonth/CalendarMonth.js +1 -0
  128. package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
  129. package/dist/js/components/DatePicker/DatePicker.d.ts +43 -36
  130. package/dist/js/components/DatePicker/DatePicker.d.ts.map +1 -1
  131. package/dist/js/components/DatePicker/DatePicker.js +4 -0
  132. package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
  133. package/dist/js/components/ExpandableSection/ExpandableSection.d.ts +34 -24
  134. package/dist/js/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
  135. package/dist/js/components/ExpandableSection/ExpandableSection.js.map +1 -1
  136. package/dist/js/components/ExpandableSection/ExpandableSectionToggle.d.ts +10 -5
  137. package/dist/js/components/ExpandableSection/ExpandableSectionToggle.d.ts.map +1 -1
  138. package/dist/js/components/ExpandableSection/ExpandableSectionToggle.js.map +1 -1
  139. package/dist/js/components/FileUpload/FileUpload.d.ts +53 -47
  140. package/dist/js/components/FileUpload/FileUpload.d.ts.map +1 -1
  141. package/dist/js/components/FileUpload/FileUpload.js.map +1 -1
  142. package/dist/js/components/FileUpload/FileUploadField.d.ts +51 -46
  143. package/dist/js/components/FileUpload/FileUploadField.d.ts.map +1 -1
  144. package/dist/js/components/FileUpload/FileUploadField.js.map +1 -1
  145. package/dist/js/components/Modal/Modal.d.ts +57 -48
  146. package/dist/js/components/Modal/Modal.d.ts.map +1 -1
  147. package/dist/js/components/Modal/Modal.js.map +1 -1
  148. package/dist/js/components/Modal/ModalBox.d.ts +12 -12
  149. package/dist/js/components/Modal/ModalBox.d.ts.map +1 -1
  150. package/dist/js/components/Modal/ModalBoxBody.d.ts +2 -2
  151. package/dist/js/components/Modal/ModalBoxBody.d.ts.map +1 -1
  152. package/dist/js/components/Modal/ModalBoxCloseButton.d.ts +2 -2
  153. package/dist/js/components/Modal/ModalBoxCloseButton.d.ts.map +1 -1
  154. package/dist/js/components/Modal/ModalBoxDescription.d.ts +3 -3
  155. package/dist/js/components/Modal/ModalBoxDescription.d.ts.map +1 -1
  156. package/dist/js/components/Modal/ModalBoxFooter.d.ts +2 -2
  157. package/dist/js/components/Modal/ModalBoxFooter.d.ts.map +1 -1
  158. package/dist/js/components/Modal/ModalBoxHeader.d.ts +3 -3
  159. package/dist/js/components/Modal/ModalBoxHeader.d.ts.map +1 -1
  160. package/dist/js/components/Modal/ModalBoxTitle.d.ts +8 -9
  161. package/dist/js/components/Modal/ModalBoxTitle.d.ts.map +1 -1
  162. package/dist/js/components/Modal/ModalBoxTitle.js.map +1 -1
  163. package/dist/js/components/Modal/ModalContent.d.ts +56 -48
  164. package/dist/js/components/Modal/ModalContent.d.ts.map +1 -1
  165. package/dist/js/components/Modal/ModalContent.js.map +1 -1
  166. package/dist/js/components/NotificationBadge/NotificationBadge.d.ts +17 -13
  167. package/dist/js/components/NotificationBadge/NotificationBadge.d.ts.map +1 -1
  168. package/dist/js/components/NotificationBadge/NotificationBadge.js +3 -3
  169. package/dist/js/components/NotificationBadge/NotificationBadge.js.map +1 -1
  170. package/dist/js/components/Pagination/Navigation.d.ts +33 -33
  171. package/dist/js/components/Pagination/Navigation.d.ts.map +1 -1
  172. package/dist/js/components/Pagination/OptionsToggle.d.ts +27 -26
  173. package/dist/js/components/Pagination/OptionsToggle.d.ts.map +1 -1
  174. package/dist/js/components/Pagination/OptionsToggle.js.map +1 -1
  175. package/dist/js/components/Pagination/Pagination.d.ts +76 -65
  176. package/dist/js/components/Pagination/Pagination.d.ts.map +1 -1
  177. package/dist/js/components/Pagination/Pagination.js +1 -1
  178. package/dist/js/components/Pagination/Pagination.js.map +1 -1
  179. package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts +22 -18
  180. package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
  181. package/dist/js/components/Pagination/PaginationOptionsMenu.js.map +1 -1
  182. package/dist/js/components/Pagination/ToggleTemplate.d.ts +3 -0
  183. package/dist/js/components/Pagination/ToggleTemplate.d.ts.map +1 -1
  184. package/dist/js/components/Pagination/ToggleTemplate.js.map +1 -1
  185. package/dist/js/components/Popover/Popover.d.ts +88 -73
  186. package/dist/js/components/Popover/Popover.d.ts.map +1 -1
  187. package/dist/js/components/Popover/Popover.js.map +1 -1
  188. package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts +27 -26
  189. package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  190. package/dist/js/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  191. package/dist/js/components/SearchInput/SearchInput.d.ts +71 -60
  192. package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
  193. package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
  194. package/dist/js/components/Select/Select.d.ts +2 -0
  195. package/dist/js/components/Select/Select.d.ts.map +1 -1
  196. package/dist/js/components/Select/Select.js +4 -3
  197. package/dist/js/components/Select/Select.js.map +1 -1
  198. package/dist/js/components/Select/SelectToggle.d.ts +2 -0
  199. package/dist/js/components/Select/SelectToggle.d.ts.map +1 -1
  200. package/dist/js/components/Select/SelectToggle.js +3 -5
  201. package/dist/js/components/Select/SelectToggle.js.map +1 -1
  202. package/dist/js/components/Slider/Slider.d.ts +45 -39
  203. package/dist/js/components/Slider/Slider.d.ts.map +1 -1
  204. package/dist/js/components/Slider/Slider.js.map +1 -1
  205. package/dist/js/components/Slider/SliderStep.d.ts +10 -10
  206. package/dist/js/components/Slider/SliderStep.d.ts.map +1 -1
  207. package/dist/js/components/TreeView/TreeView.d.ts +65 -53
  208. package/dist/js/components/TreeView/TreeView.d.ts.map +1 -1
  209. package/dist/js/components/TreeView/TreeView.js.map +1 -1
  210. package/dist/js/components/TreeView/TreeViewList.d.ts +4 -4
  211. package/dist/js/components/TreeView/TreeViewList.d.ts.map +1 -1
  212. package/dist/js/components/TreeView/TreeViewListItem.d.ts +46 -39
  213. package/dist/js/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  214. package/dist/js/components/TreeView/TreeViewListItem.js.map +1 -1
  215. package/dist/js/components/TreeView/TreeViewRoot.d.ts +4 -4
  216. package/dist/js/components/TreeView/TreeViewRoot.d.ts.map +1 -1
  217. package/dist/js/components/TreeView/TreeViewSearch.d.ts +11 -8
  218. package/dist/js/components/TreeView/TreeViewSearch.d.ts.map +1 -1
  219. package/dist/js/components/TreeView/TreeViewSearch.js.map +1 -1
  220. package/dist/js/helpers/Popper/Popper.js +8 -8
  221. package/dist/js/helpers/Popper/Popper.js.map +1 -1
  222. package/dist/umd/react-core.min.css +172 -172
  223. package/dist/umd/react-core.min.js +3 -3
  224. package/package.json +2 -2
  225. package/src/components/Alert/Alert.tsx +42 -34
  226. package/src/components/Alert/AlertActionCloseButton.tsx +9 -5
  227. package/src/components/Alert/AlertActionLink.tsx +6 -2
  228. package/src/components/Alert/AlertIcon.tsx +4 -4
  229. package/src/components/Alert/AlertToggleExpandButton.tsx +5 -5
  230. package/src/components/Badge/__tests__/Badge.test.tsx +45 -8
  231. package/src/components/Badge/__tests__/__snapshots__/Badge.test.tsx.snap +2 -12
  232. package/src/components/CalendarMonth/CalendarMonth.tsx +36 -28
  233. package/src/components/DatePicker/DatePicker.tsx +49 -36
  234. package/src/components/DatePicker/__tests__/DatePicker.test.tsx +21 -0
  235. package/src/components/ExpandableSection/ExpandableSection.tsx +35 -24
  236. package/src/components/ExpandableSection/ExpandableSectionToggle.tsx +11 -5
  237. package/src/components/FileUpload/FileUpload.tsx +56 -49
  238. package/src/components/FileUpload/FileUploadField.tsx +56 -50
  239. package/src/components/Modal/Modal.tsx +57 -48
  240. package/src/components/Modal/ModalBox.tsx +12 -12
  241. package/src/components/Modal/ModalBoxBody.tsx +2 -2
  242. package/src/components/Modal/ModalBoxCloseButton.tsx +2 -2
  243. package/src/components/Modal/ModalBoxDescription.tsx +3 -3
  244. package/src/components/Modal/ModalBoxFooter.tsx +2 -2
  245. package/src/components/Modal/ModalBoxHeader.tsx +3 -3
  246. package/src/components/Modal/ModalBoxTitle.tsx +8 -9
  247. package/src/components/Modal/ModalContent.tsx +56 -48
  248. package/src/components/Modal/examples/Modal.md +1 -3
  249. package/src/components/NotificationBadge/NotificationBadge.tsx +22 -15
  250. package/src/components/NotificationBadge/__tests__/NotificationBadge.test.tsx +25 -1
  251. package/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap +5 -0
  252. package/src/components/NotificationBadge/examples/NotificationBadge.md +16 -3
  253. package/src/components/NotificationBadge/examples/NotificationBadgeBasic.tsx +26 -13
  254. package/src/components/NotificationBadge/examples/NotificationBadgeWithCount.tsx +28 -18
  255. package/src/components/Pagination/Navigation.tsx +33 -33
  256. package/src/components/Pagination/OptionsToggle.tsx +27 -26
  257. package/src/components/Pagination/Pagination.tsx +79 -65
  258. package/src/components/Pagination/PaginationOptionsMenu.tsx +22 -18
  259. package/src/components/Pagination/ToggleTemplate.tsx +4 -0
  260. package/src/components/Popover/Popover.tsx +89 -73
  261. package/src/components/SearchInput/AdvancedSearchMenu.tsx +29 -28
  262. package/src/components/SearchInput/SearchInput.tsx +76 -62
  263. package/src/components/Select/Select.tsx +5 -0
  264. package/src/components/Select/SelectToggle.tsx +5 -4
  265. package/src/components/Slider/Slider.tsx +47 -41
  266. package/src/components/Slider/SliderStep.tsx +10 -10
  267. package/src/components/TreeView/TreeView.tsx +67 -53
  268. package/src/components/TreeView/TreeViewList.tsx +4 -4
  269. package/src/components/TreeView/TreeViewListItem.tsx +46 -39
  270. package/src/components/TreeView/TreeViewRoot.tsx +4 -4
  271. package/src/components/TreeView/TreeViewSearch.tsx +12 -8
  272. package/src/demos/Masthead.md +9 -193
  273. package/src/demos/NotificationDrawer/NotificationDrawer.md +2 -0
  274. package/src/demos/examples/Masthead/MastheadWithUtilitiesAndUserDropdownMenu.tsx +305 -0
  275. 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.243.1",
3
+ "version": "4.244.1",
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": "eb89462c9bbd1414e2da9f3b77601f965ba03bf2"
73
+ "gitHead": "a66b0277f021bed9693f19f2ee65d11193305e9d"
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
- /** Adds alert variant styles */
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 alertActionLink component or multiple wrapped in an array or React.Fragment */
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
- /** Content rendered inside the alert */
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 added to the alert */
34
+ /** Additional classes to add to the alert. */
39
35
  className?: string;
40
- /** Adds accessible text to the alert */
41
- 'aria-label'?: string;
42
- /** Variant label text for screen readers */
43
- variantLabel?: string;
44
- /** Flag to indicate if the alert is in a live region */
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
- /** If set to true, the timeout is 8000 milliseconds. If a number is provided, alert will be dismissed after that amount of time in milliseconds. */
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 before finally dismissing the alert */
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
- /** Function to be executed on alert timeout. Relevant when the timeout prop is set */
51
- onTimeout?: () => void;
52
- /** Truncate title to number of lines */
53
- truncateTitle?: number;
54
- /** Position of the tooltip which is displayed if text is truncated */
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
- /** Set a custom icon to the alert. If not set the icon is set according to the variant */
71
- customIcon?: React.ReactNode;
72
- /** Flag indicating that the alert is expandable */
73
- isExpandable?: boolean;
74
- /** Adds accessible text to the alert Toggle */
75
- toggleAriaLabel?: string;
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
- /** Additional classes added to the AlertActionCloseButton */
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
- /** Aria Label for the Close button */
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 AlertLinkAction */
9
+ /** Content rendered inside the alert action link. */
6
10
  children?: string;
7
- /** Additional classes added to the AlertActionLink */
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
- /** variant */
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
- /** Aria label for the toggle button */
9
+ /** Accessible label for the toggle button. */
10
10
  'aria-label'?: string;
11
- /** A callback for when the toggle button is clicked */
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
- /** Variant label for the toggle button */
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
- import React from 'react';
3
- import { render } from '@testing-library/react';
4
-
5
- Object.values([true, false]).forEach(isRead => {
6
- test(`${isRead} Badge`, () => {
7
- const { asFragment } = render(<Badge isRead={isRead}>{isRead ? 'read' : 'unread'} Badge</Badge>);
8
- expect(asFragment()).toMatchSnapshot();
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[`false Badge 1`] = `
3
+ exports[`Matches the snapshot 1`] = `
4
4
  <DocumentFragment>
5
5
  <span
6
6
  class="pf-c-badge pf-m-unread"
7
7
  >
8
- unread Badge
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
- /** How to format months in Select */
24
- monthFormat?: (date: Date) => React.ReactNode;
25
- /** How to format week days in header */
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. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation */
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
- /** Day of week that starts the week. 0 is Sunday, 6 is Saturday. */
34
- weekStart?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | Weekday;
35
- /** Which date to start range styles from */
36
- rangeStart?: Date;
37
- /** Aria-label for the previous month button */
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
- /** Aria-label for the next month button */
41
+ /** Accessible label for the next month button. */
40
42
  nextMonthAriaLabel?: string;
41
- /** Aria-label for the year input */
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
- /** Month/year to base other dates around */
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
- /** @hide Internal prop to allow pressing escape in select menu to not close popover */
57
- onSelectToggle?: (open: boolean) => void;
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 month or year is changed */
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
- /** Props to pass to the Popover */
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
- /** Additional props for input field */
52
- inputProps?: TextInputProps;
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
- /** Sets the calendar open status */
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 toggle its open status.
59
- * If the isOpen parameter is passed, that will set the calendar open status to the value of the isOpen parameter.
60
- * If the eventKey parameter is set to 'Escape', that will invoke the date pickers onEscapePress event to toggle the
61
- * correct control appropriately. */
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) =>
@@ -118,6 +127,10 @@ const DatePickerBase = (
118
127
 
119
128
  React.useEffect(() => {
120
129
  setPristine(!value);
130
+ const newValueDate = dateParse(value);
131
+ if (errorText && isValidDate(newValueDate)) {
132
+ setError(newValueDate);
133
+ }
121
134
  }, [value]);
122
135
 
123
136
  const setError = (date: Date) => {
@@ -24,6 +24,27 @@ test('Date picker with multiple validators does not show invalid icon on valid i
24
24
  await user.click(screen.getByRole('textbox'));
25
25
 
26
26
  await user.click(document.body);
27
+ expect(screen.getByRole('textbox')).not.toBeInvalid();
28
+ });
29
+
30
+ test('Error state can be cleared from outside', async () => {
31
+ const rangeValidator = (date: Date) => {
32
+ if (date < new Date('2020-03-17')) {
33
+ return 'error';
34
+ }
35
+ return '';
36
+ };
37
+
38
+ const user = userEvent.setup();
39
+
40
+ const { rerender } = render(<DatePicker value="2020-03-17" validators={[rangeValidator]} />);
41
+
42
+ await user.clear(screen.getByRole('textbox'));
43
+ await user.type(screen.getByRole('textbox'), '2020-03-16');
44
+
45
+ await user.click(document.body);
46
+
47
+ rerender(<DatePicker value="2020-03-18" validators={[rangeValidator]} />);
27
48
 
28
49
  expect(screen.getByRole('textbox')).not.toBeInvalid();
29
50
  });
@@ -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
- /** Flag to indicate if the content is expanded */
19
- isExpanded?: boolean;
20
- /** Text that appears in the attached toggle */
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
- /** Flag to indicate the width of the component is limited. Set to true for disclosure styling. */
39
- isWidthLimited?: boolean;
40
- /** Flag to indicate if the content is indented */
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
- /** Flag indicating if the expandable section is expanded. */
12
- isExpanded?: boolean;
13
- /** Callback function to toggle the expandable content. */
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> = ({