@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.
Files changed (254) hide show
  1. package/CHANGELOG.md +16 -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.map +1 -1
  22. package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts +34 -24
  23. package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
  24. package/dist/esm/components/ExpandableSection/ExpandableSection.js.map +1 -1
  25. package/dist/esm/components/ExpandableSection/ExpandableSectionToggle.d.ts +10 -5
  26. package/dist/esm/components/ExpandableSection/ExpandableSectionToggle.d.ts.map +1 -1
  27. package/dist/esm/components/ExpandableSection/ExpandableSectionToggle.js.map +1 -1
  28. package/dist/esm/components/FileUpload/FileUpload.d.ts +53 -47
  29. package/dist/esm/components/FileUpload/FileUpload.d.ts.map +1 -1
  30. package/dist/esm/components/FileUpload/FileUpload.js.map +1 -1
  31. package/dist/esm/components/FileUpload/FileUploadField.d.ts +51 -46
  32. package/dist/esm/components/FileUpload/FileUploadField.d.ts.map +1 -1
  33. package/dist/esm/components/FileUpload/FileUploadField.js.map +1 -1
  34. package/dist/esm/components/Modal/Modal.d.ts +57 -48
  35. package/dist/esm/components/Modal/Modal.d.ts.map +1 -1
  36. package/dist/esm/components/Modal/Modal.js.map +1 -1
  37. package/dist/esm/components/Modal/ModalBox.d.ts +12 -12
  38. package/dist/esm/components/Modal/ModalBox.d.ts.map +1 -1
  39. package/dist/esm/components/Modal/ModalBoxBody.d.ts +2 -2
  40. package/dist/esm/components/Modal/ModalBoxBody.d.ts.map +1 -1
  41. package/dist/esm/components/Modal/ModalBoxCloseButton.d.ts +2 -2
  42. package/dist/esm/components/Modal/ModalBoxCloseButton.d.ts.map +1 -1
  43. package/dist/esm/components/Modal/ModalBoxDescription.d.ts +3 -3
  44. package/dist/esm/components/Modal/ModalBoxDescription.d.ts.map +1 -1
  45. package/dist/esm/components/Modal/ModalBoxFooter.d.ts +2 -2
  46. package/dist/esm/components/Modal/ModalBoxFooter.d.ts.map +1 -1
  47. package/dist/esm/components/Modal/ModalBoxHeader.d.ts +3 -3
  48. package/dist/esm/components/Modal/ModalBoxHeader.d.ts.map +1 -1
  49. package/dist/esm/components/Modal/ModalBoxTitle.d.ts +8 -9
  50. package/dist/esm/components/Modal/ModalBoxTitle.d.ts.map +1 -1
  51. package/dist/esm/components/Modal/ModalBoxTitle.js.map +1 -1
  52. package/dist/esm/components/Modal/ModalContent.d.ts +56 -48
  53. package/dist/esm/components/Modal/ModalContent.d.ts.map +1 -1
  54. package/dist/esm/components/Modal/ModalContent.js.map +1 -1
  55. package/dist/esm/components/NotificationBadge/NotificationBadge.d.ts +17 -13
  56. package/dist/esm/components/NotificationBadge/NotificationBadge.d.ts.map +1 -1
  57. package/dist/esm/components/NotificationBadge/NotificationBadge.js +3 -3
  58. package/dist/esm/components/NotificationBadge/NotificationBadge.js.map +1 -1
  59. package/dist/esm/components/Pagination/Navigation.d.ts +33 -33
  60. package/dist/esm/components/Pagination/Navigation.d.ts.map +1 -1
  61. package/dist/esm/components/Pagination/OptionsToggle.d.ts +27 -26
  62. package/dist/esm/components/Pagination/OptionsToggle.d.ts.map +1 -1
  63. package/dist/esm/components/Pagination/OptionsToggle.js.map +1 -1
  64. package/dist/esm/components/Pagination/Pagination.d.ts +76 -65
  65. package/dist/esm/components/Pagination/Pagination.d.ts.map +1 -1
  66. package/dist/esm/components/Pagination/Pagination.js +1 -1
  67. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  68. package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts +22 -18
  69. package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
  70. package/dist/esm/components/Pagination/PaginationOptionsMenu.js.map +1 -1
  71. package/dist/esm/components/Pagination/ToggleTemplate.d.ts +3 -0
  72. package/dist/esm/components/Pagination/ToggleTemplate.d.ts.map +1 -1
  73. package/dist/esm/components/Pagination/ToggleTemplate.js.map +1 -1
  74. package/dist/esm/components/Popover/Popover.d.ts +88 -73
  75. package/dist/esm/components/Popover/Popover.d.ts.map +1 -1
  76. package/dist/esm/components/Popover/Popover.js.map +1 -1
  77. package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts +27 -26
  78. package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  79. package/dist/esm/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  80. package/dist/esm/components/SearchInput/SearchInput.d.ts +71 -60
  81. package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
  82. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  83. package/dist/esm/components/Slider/Slider.d.ts +45 -39
  84. package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
  85. package/dist/esm/components/Slider/Slider.js.map +1 -1
  86. package/dist/esm/components/Slider/SliderStep.d.ts +10 -10
  87. package/dist/esm/components/Slider/SliderStep.d.ts.map +1 -1
  88. package/dist/esm/components/TreeView/TreeView.d.ts +65 -53
  89. package/dist/esm/components/TreeView/TreeView.d.ts.map +1 -1
  90. package/dist/esm/components/TreeView/TreeView.js.map +1 -1
  91. package/dist/esm/components/TreeView/TreeViewList.d.ts +4 -4
  92. package/dist/esm/components/TreeView/TreeViewList.d.ts.map +1 -1
  93. package/dist/esm/components/TreeView/TreeViewListItem.d.ts +46 -39
  94. package/dist/esm/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  95. package/dist/esm/components/TreeView/TreeViewListItem.js.map +1 -1
  96. package/dist/esm/components/TreeView/TreeViewRoot.d.ts +4 -4
  97. package/dist/esm/components/TreeView/TreeViewRoot.d.ts.map +1 -1
  98. package/dist/esm/components/TreeView/TreeViewSearch.d.ts +11 -8
  99. package/dist/esm/components/TreeView/TreeViewSearch.d.ts.map +1 -1
  100. package/dist/esm/components/TreeView/TreeViewSearch.js.map +1 -1
  101. package/dist/esm/helpers/Popper/Popper.js +8 -8
  102. package/dist/esm/helpers/Popper/Popper.js.map +1 -1
  103. package/dist/js/components/Alert/Alert.d.ts +41 -34
  104. package/dist/js/components/Alert/Alert.d.ts.map +1 -1
  105. package/dist/js/components/Alert/Alert.js.map +1 -1
  106. package/dist/js/components/Alert/AlertActionCloseButton.d.ts +8 -5
  107. package/dist/js/components/Alert/AlertActionCloseButton.d.ts.map +1 -1
  108. package/dist/js/components/Alert/AlertActionCloseButton.js.map +1 -1
  109. package/dist/js/components/Alert/AlertActionLink.d.ts +5 -2
  110. package/dist/js/components/Alert/AlertActionLink.d.ts.map +1 -1
  111. package/dist/js/components/Alert/AlertActionLink.js.map +1 -1
  112. package/dist/js/components/Alert/AlertIcon.d.ts +4 -4
  113. package/dist/js/components/Alert/AlertIcon.d.ts.map +1 -1
  114. package/dist/js/components/Alert/AlertToggleExpandButton.d.ts +5 -5
  115. package/dist/js/components/Alert/AlertToggleExpandButton.d.ts.map +1 -1
  116. package/dist/js/components/CalendarMonth/CalendarMonth.d.ts +34 -28
  117. package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
  118. package/dist/js/components/CalendarMonth/CalendarMonth.js +1 -0
  119. package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
  120. package/dist/js/components/DatePicker/DatePicker.d.ts +43 -36
  121. package/dist/js/components/DatePicker/DatePicker.d.ts.map +1 -1
  122. package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
  123. package/dist/js/components/ExpandableSection/ExpandableSection.d.ts +34 -24
  124. package/dist/js/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
  125. package/dist/js/components/ExpandableSection/ExpandableSection.js.map +1 -1
  126. package/dist/js/components/ExpandableSection/ExpandableSectionToggle.d.ts +10 -5
  127. package/dist/js/components/ExpandableSection/ExpandableSectionToggle.d.ts.map +1 -1
  128. package/dist/js/components/ExpandableSection/ExpandableSectionToggle.js.map +1 -1
  129. package/dist/js/components/FileUpload/FileUpload.d.ts +53 -47
  130. package/dist/js/components/FileUpload/FileUpload.d.ts.map +1 -1
  131. package/dist/js/components/FileUpload/FileUpload.js.map +1 -1
  132. package/dist/js/components/FileUpload/FileUploadField.d.ts +51 -46
  133. package/dist/js/components/FileUpload/FileUploadField.d.ts.map +1 -1
  134. package/dist/js/components/FileUpload/FileUploadField.js.map +1 -1
  135. package/dist/js/components/Modal/Modal.d.ts +57 -48
  136. package/dist/js/components/Modal/Modal.d.ts.map +1 -1
  137. package/dist/js/components/Modal/Modal.js.map +1 -1
  138. package/dist/js/components/Modal/ModalBox.d.ts +12 -12
  139. package/dist/js/components/Modal/ModalBox.d.ts.map +1 -1
  140. package/dist/js/components/Modal/ModalBoxBody.d.ts +2 -2
  141. package/dist/js/components/Modal/ModalBoxBody.d.ts.map +1 -1
  142. package/dist/js/components/Modal/ModalBoxCloseButton.d.ts +2 -2
  143. package/dist/js/components/Modal/ModalBoxCloseButton.d.ts.map +1 -1
  144. package/dist/js/components/Modal/ModalBoxDescription.d.ts +3 -3
  145. package/dist/js/components/Modal/ModalBoxDescription.d.ts.map +1 -1
  146. package/dist/js/components/Modal/ModalBoxFooter.d.ts +2 -2
  147. package/dist/js/components/Modal/ModalBoxFooter.d.ts.map +1 -1
  148. package/dist/js/components/Modal/ModalBoxHeader.d.ts +3 -3
  149. package/dist/js/components/Modal/ModalBoxHeader.d.ts.map +1 -1
  150. package/dist/js/components/Modal/ModalBoxTitle.d.ts +8 -9
  151. package/dist/js/components/Modal/ModalBoxTitle.d.ts.map +1 -1
  152. package/dist/js/components/Modal/ModalBoxTitle.js.map +1 -1
  153. package/dist/js/components/Modal/ModalContent.d.ts +56 -48
  154. package/dist/js/components/Modal/ModalContent.d.ts.map +1 -1
  155. package/dist/js/components/Modal/ModalContent.js.map +1 -1
  156. package/dist/js/components/NotificationBadge/NotificationBadge.d.ts +17 -13
  157. package/dist/js/components/NotificationBadge/NotificationBadge.d.ts.map +1 -1
  158. package/dist/js/components/NotificationBadge/NotificationBadge.js +3 -3
  159. package/dist/js/components/NotificationBadge/NotificationBadge.js.map +1 -1
  160. package/dist/js/components/Pagination/Navigation.d.ts +33 -33
  161. package/dist/js/components/Pagination/Navigation.d.ts.map +1 -1
  162. package/dist/js/components/Pagination/OptionsToggle.d.ts +27 -26
  163. package/dist/js/components/Pagination/OptionsToggle.d.ts.map +1 -1
  164. package/dist/js/components/Pagination/OptionsToggle.js.map +1 -1
  165. package/dist/js/components/Pagination/Pagination.d.ts +76 -65
  166. package/dist/js/components/Pagination/Pagination.d.ts.map +1 -1
  167. package/dist/js/components/Pagination/Pagination.js +1 -1
  168. package/dist/js/components/Pagination/Pagination.js.map +1 -1
  169. package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts +22 -18
  170. package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
  171. package/dist/js/components/Pagination/PaginationOptionsMenu.js.map +1 -1
  172. package/dist/js/components/Pagination/ToggleTemplate.d.ts +3 -0
  173. package/dist/js/components/Pagination/ToggleTemplate.d.ts.map +1 -1
  174. package/dist/js/components/Pagination/ToggleTemplate.js.map +1 -1
  175. package/dist/js/components/Popover/Popover.d.ts +88 -73
  176. package/dist/js/components/Popover/Popover.d.ts.map +1 -1
  177. package/dist/js/components/Popover/Popover.js.map +1 -1
  178. package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts +27 -26
  179. package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  180. package/dist/js/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  181. package/dist/js/components/SearchInput/SearchInput.d.ts +71 -60
  182. package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
  183. package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
  184. package/dist/js/components/Slider/Slider.d.ts +45 -39
  185. package/dist/js/components/Slider/Slider.d.ts.map +1 -1
  186. package/dist/js/components/Slider/Slider.js.map +1 -1
  187. package/dist/js/components/Slider/SliderStep.d.ts +10 -10
  188. package/dist/js/components/Slider/SliderStep.d.ts.map +1 -1
  189. package/dist/js/components/TreeView/TreeView.d.ts +65 -53
  190. package/dist/js/components/TreeView/TreeView.d.ts.map +1 -1
  191. package/dist/js/components/TreeView/TreeView.js.map +1 -1
  192. package/dist/js/components/TreeView/TreeViewList.d.ts +4 -4
  193. package/dist/js/components/TreeView/TreeViewList.d.ts.map +1 -1
  194. package/dist/js/components/TreeView/TreeViewListItem.d.ts +46 -39
  195. package/dist/js/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  196. package/dist/js/components/TreeView/TreeViewListItem.js.map +1 -1
  197. package/dist/js/components/TreeView/TreeViewRoot.d.ts +4 -4
  198. package/dist/js/components/TreeView/TreeViewRoot.d.ts.map +1 -1
  199. package/dist/js/components/TreeView/TreeViewSearch.d.ts +11 -8
  200. package/dist/js/components/TreeView/TreeViewSearch.d.ts.map +1 -1
  201. package/dist/js/components/TreeView/TreeViewSearch.js.map +1 -1
  202. package/dist/js/helpers/Popper/Popper.js +8 -8
  203. package/dist/js/helpers/Popper/Popper.js.map +1 -1
  204. package/dist/umd/react-core.min.css +3634 -3634
  205. package/dist/umd/react-core.min.js +2 -2
  206. package/package.json +2 -2
  207. package/src/components/Alert/Alert.tsx +42 -34
  208. package/src/components/Alert/AlertActionCloseButton.tsx +9 -5
  209. package/src/components/Alert/AlertActionLink.tsx +6 -2
  210. package/src/components/Alert/AlertIcon.tsx +4 -4
  211. package/src/components/Alert/AlertToggleExpandButton.tsx +5 -5
  212. package/src/components/Badge/__tests__/Badge.test.tsx +45 -8
  213. package/src/components/Badge/__tests__/__snapshots__/Badge.test.tsx.snap +2 -12
  214. package/src/components/CalendarMonth/CalendarMonth.tsx +36 -28
  215. package/src/components/DatePicker/DatePicker.tsx +45 -36
  216. package/src/components/ExpandableSection/ExpandableSection.tsx +35 -24
  217. package/src/components/ExpandableSection/ExpandableSectionToggle.tsx +11 -5
  218. package/src/components/FileUpload/FileUpload.tsx +56 -49
  219. package/src/components/FileUpload/FileUploadField.tsx +56 -50
  220. package/src/components/Modal/Modal.tsx +57 -48
  221. package/src/components/Modal/ModalBox.tsx +12 -12
  222. package/src/components/Modal/ModalBoxBody.tsx +2 -2
  223. package/src/components/Modal/ModalBoxCloseButton.tsx +2 -2
  224. package/src/components/Modal/ModalBoxDescription.tsx +3 -3
  225. package/src/components/Modal/ModalBoxFooter.tsx +2 -2
  226. package/src/components/Modal/ModalBoxHeader.tsx +3 -3
  227. package/src/components/Modal/ModalBoxTitle.tsx +8 -9
  228. package/src/components/Modal/ModalContent.tsx +56 -48
  229. package/src/components/Modal/examples/Modal.md +1 -3
  230. package/src/components/NotificationBadge/NotificationBadge.tsx +22 -15
  231. package/src/components/NotificationBadge/__tests__/NotificationBadge.test.tsx +25 -1
  232. package/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap +5 -0
  233. package/src/components/NotificationBadge/examples/NotificationBadge.md +16 -3
  234. package/src/components/NotificationBadge/examples/NotificationBadgeBasic.tsx +26 -13
  235. package/src/components/NotificationBadge/examples/NotificationBadgeWithCount.tsx +28 -18
  236. package/src/components/Pagination/Navigation.tsx +33 -33
  237. package/src/components/Pagination/OptionsToggle.tsx +27 -26
  238. package/src/components/Pagination/Pagination.tsx +79 -65
  239. package/src/components/Pagination/PaginationOptionsMenu.tsx +22 -18
  240. package/src/components/Pagination/ToggleTemplate.tsx +4 -0
  241. package/src/components/Popover/Popover.tsx +89 -73
  242. package/src/components/SearchInput/AdvancedSearchMenu.tsx +29 -28
  243. package/src/components/SearchInput/SearchInput.tsx +76 -62
  244. package/src/components/Slider/Slider.tsx +47 -41
  245. package/src/components/Slider/SliderStep.tsx +10 -10
  246. package/src/components/TreeView/TreeView.tsx +67 -53
  247. package/src/components/TreeView/TreeViewList.tsx +4 -4
  248. package/src/components/TreeView/TreeViewListItem.tsx +46 -39
  249. package/src/components/TreeView/TreeViewRoot.tsx +4 -4
  250. package/src/components/TreeView/TreeViewSearch.tsx +12 -8
  251. package/src/demos/Masthead.md +9 -193
  252. package/src/demos/NotificationDrawer/NotificationDrawer.md +2 -0
  253. package/src/demos/examples/Masthead/MastheadWithUtilitiesAndUserDropdownMenu.tsx +305 -0
  254. package/src/helpers/Popper/Popper.tsx +8 -8
@@ -8,22 +8,48 @@ interface DropzoneInputPropsWithRef extends DropzoneInputProps {
8
8
  ref: React.RefCallback<HTMLInputElement>; // Working around an issue in react-dropzone 9.0.0's types. Should not be necessary in later versions.
9
9
  }
10
10
 
11
+ /** The main file upload component with drag and drop functionality built in by default. */
12
+
11
13
  export interface FileUploadProps
12
14
  extends Omit<
13
15
  FileUploadFieldProps,
14
16
  'children' | 'onBrowseButtonClick' | 'onClearButtonClick' | 'isDragActive' | 'containerRef'
15
17
  > {
16
- /** Unique id for the TextArea, also used to generate ids for accessible labels. */
17
- id: string;
18
- /** What type of file. Determines what is is passed to `onChange` and expected by `value`
19
- * (a string for 'text' and 'dataURL', or a File object otherwise. */
20
- type?: 'text' | 'dataURL';
21
- /** Value of the file's contents
22
- * (string if text file, File object otherwise) */
23
- value?: string | File;
18
+ /** Flag to allow editing of a text file's contents after it is selected from disk. */
19
+ allowEditingUploadedText?: boolean;
20
+ /** Aria-label for the text area. */
21
+ 'aria-label'?: string;
22
+ /** Text for the browse button. */
23
+ browseButtonText?: string;
24
+ /** Additional children to render after (or instead of) the file preview. */
25
+ children?: React.ReactNode;
26
+ /** Additional classes added to the file upload container element. */
27
+ className?: string;
28
+ /** Text for the clear button. */
29
+ clearButtonText?: string;
24
30
  /** Value to be shown in the read-only filename field. */
25
31
  filename?: string;
26
- /** @deprecated A callback for when the file contents change. Please instead use onFileInputChange, onTextChange, onDataChange, onClearClick individually. */
32
+ /** Aria-label for the read-only filename field. */
33
+ filenameAriaLabel?: string;
34
+ /** Placeholder string to display in the empty filename field. */
35
+ filenamePlaceholder?: string;
36
+ /** Flag to hide the built-in preview of the file (where available). If true, you can use
37
+ * the children property to render an alternate preview.
38
+ */
39
+ hideDefaultPreview?: boolean;
40
+ /** Unique id for the text area. Also used to generate ids for accessible labels. */
41
+ id: string;
42
+ /** Flag to show if the field is disabled. */
43
+ isDisabled?: boolean;
44
+ /** Flag to show if a file is being loaded. */
45
+ isLoading?: boolean;
46
+ /** Flag to show if the field is read only. */
47
+ isReadOnly?: boolean;
48
+ /** Flag to show if the field is required. */
49
+ isRequired?: boolean;
50
+ /** @deprecated A callback for when the file contents changes. Please instead use
51
+ * onFileInputChange, onTextChange, onDataChange, and onClearClick individually.
52
+ */
27
53
  onChange?: (
28
54
  value: string | File,
29
55
  filename: string,
@@ -32,61 +58,42 @@ export interface FileUploadProps
32
58
  | React.DragEvent<HTMLElement> // User dragged/dropped a file
33
59
  | React.ChangeEvent<HTMLElement> // User typed in the TextArea
34
60
  ) => void;
61
+ /** Callback for clicking on the file upload field text area. By default, prevents a click
62
+ * in the text area from opening file dialog.
63
+ */
64
+ onClick?: (event: React.MouseEvent) => void;
35
65
  /** Change event emitted from the hidden \<input type="file" \> field associated with the component */
36
66
  onFileInputChange?: (event: React.ChangeEvent<HTMLInputElement> | React.DragEvent<HTMLElement>, file: File) => void;
37
- /** Callback for clicking on the FileUploadField text area. By default, prevents a click in the text area from opening file dialog. */
38
- onClick?: (event: React.MouseEvent) => void;
39
- /** Additional classes added to the FileUpload container element. */
40
- className?: string;
41
- /** Flag to show if the field is disabled. */
42
- isDisabled?: boolean;
43
- /** Flag to show if the field is read only. */
44
- isReadOnly?: boolean;
45
- /** Flag to show if a file is being loaded. */
46
- isLoading?: boolean;
47
- /** Aria-valuetext for the loading spinner */
67
+ /** Aria-valuetext for the loading spinner. */
48
68
  spinnerAriaValueText?: string;
49
- /** Flag to show if the field is required. */
50
- isRequired?: boolean;
69
+ /** What type of file. Determines what is passed to the onChange property and what is
70
+ * expected by the value property (a string for 'text' and 'dataURL', or a File object otherwise.
71
+ */
72
+ type?: 'text' | 'dataURL';
51
73
  /** Value to indicate if the field is modified to show that validation state.
52
74
  * If set to success, field will be modified to indicate valid state.
53
- * If set to error, field will be modified to indicate error state.
75
+ * If set to error, field will be modified to indicate error state.
54
76
  */
55
77
  validated?: 'success' | 'error' | 'default';
56
- /** Aria-label for the TextArea. */
57
- 'aria-label'?: string;
58
- /** Placeholder string to display in the empty filename field */
59
- filenamePlaceholder?: string;
60
- /** Aria-label for the read-only filename field */
61
- filenameAriaLabel?: string;
62
- /** Text for the Browse button */
63
- browseButtonText?: string;
64
- /** Text for the Clear button */
65
- clearButtonText?: string;
66
- /** Flag to hide the built-in preview of the file (where available).
67
- * If true, you can use children to render an alternate preview. */
68
- hideDefaultPreview?: boolean;
69
- /** Flag to allow editing of a text file's contents after it is selected from disk */
70
- allowEditingUploadedText?: boolean;
71
- /** Additional children to render after (or instead of) the file preview. */
72
- children?: React.ReactNode;
78
+ /** Value of the file's contents (string if text file, File object otherwise). */
79
+ value?: string | File;
73
80
 
74
81
  // Props available in FileUpload but not FileUploadField:
75
82
 
76
- /** A callback for when a selected file starts loading */
77
- onReadStarted?: (fileHandle: File) => void;
78
- /** A callback for when a selected file finishes loading */
79
- onReadFinished?: (fileHandle: File) => void;
80
- /** A callback for when the FileReader API fails */
81
- onReadFailed?: (error: DOMException, fileHandle: File) => void;
82
83
  /** Optional extra props to customize react-dropzone. */
83
84
  dropzoneProps?: DropzoneProps;
84
- /** Clear button was clicked */
85
+ /** Clear button was clicked. */
85
86
  onClearClick?: React.MouseEventHandler<HTMLButtonElement>;
86
- /** Text area text changed */
87
- onTextChange?: (text: string) => void;
88
87
  /** On data changed - if type='text' or type='dataURL' and file was loaded it will call this method */
89
88
  onDataChange?: (data: string) => void;
89
+ /** A callback for when the FileReader API fails. */
90
+ onReadFailed?: (error: DOMException, fileHandle: File) => void;
91
+ /** A callback for when a selected file finishes loading. */
92
+ onReadFinished?: (fileHandle: File) => void;
93
+ /** A callback for when a selected file starts loading. */
94
+ onReadStarted?: (fileHandle: File) => void;
95
+ /** Text area text changed. */
96
+ onTextChange?: (text: string) => void;
90
97
  }
91
98
 
92
99
  export const FileUpload: React.FunctionComponent<FileUploadProps> = ({
@@ -8,18 +8,46 @@ import { TextArea, TextAreResizeOrientation } from '../TextArea';
8
8
  import { Spinner, spinnerSize } from '../Spinner';
9
9
  import { fileReaderType } from '../../helpers/fileUtils';
10
10
 
11
+ /** A more customizable file upload component for implementing custom logic. Drag and drop
12
+ * functionality is not built in by default.
13
+ */
14
+
11
15
  export interface FileUploadFieldProps extends Omit<React.HTMLProps<HTMLDivElement>, 'value' | 'onChange'> {
12
- /** Unique id for the TextArea, also used to generate ids for accessible labels */
13
- id: string;
14
- /** What type of file. Determines what is is expected by `value`
15
- * (a string for 'text' and 'dataURL', or a File object otherwise). */
16
- type?: 'text' | 'dataURL';
17
- /** Value of the file's contents
18
- * (string if text file, File object otherwise) */
19
- value?: string | File;
16
+ /** Flag to allow editing of a text file's contents after it is selected from disk. */
17
+ allowEditingUploadedText?: boolean;
18
+ /** Aria-label for the text area. */
19
+ 'aria-label'?: string;
20
+ /** Text for the browse button. */
21
+ browseButtonText?: string;
22
+ /** Additional children to render after (or instead of) the file preview. */
23
+ children?: React.ReactNode;
24
+ /** Additional classes added to the file upload field container element. */
25
+ className?: string;
26
+ /** Text for the clear button. */
27
+ clearButtonText?: string;
20
28
  /** Value to be shown in the read-only filename field. */
21
29
  filename?: string;
22
- /** A callback for when the TextArea value changes. */
30
+ /** Aria-label for the read-only filename field. */
31
+ filenameAriaLabel?: string;
32
+ /** Placeholder string to display in the empty filename field. */
33
+ filenamePlaceholder?: string;
34
+ /** Flag to hide the built-in preview of the file (where available). If true, you can use
35
+ * the children property to render an alternate preview.
36
+ */
37
+ hideDefaultPreview?: boolean;
38
+ /** Unique id for the text area. Also used to generate ids for accessible labels. */
39
+ id: string;
40
+ /** Flag to disable the clear button. */
41
+ isClearButtonDisabled?: boolean;
42
+ /** Flag to show if the field is disabled. */
43
+ isDisabled?: boolean;
44
+ /** Flag to show if a file is being loaded. */
45
+ isLoading?: boolean;
46
+ /** Flag to show if the field is read only. */
47
+ isReadOnly?: boolean;
48
+ /** Flag to show if the field is required. */
49
+ isRequired?: boolean;
50
+ /** A callback for when the text area value changes. */
23
51
  onChange?: (
24
52
  value: string,
25
53
  filename: string,
@@ -27,60 +55,38 @@ export interface FileUploadFieldProps extends Omit<React.HTMLProps<HTMLDivElemen
27
55
  | React.ChangeEvent<HTMLTextAreaElement> // User typed in the TextArea
28
56
  | React.MouseEvent<HTMLButtonElement, MouseEvent> // User clicked Clear button
29
57
  ) => void;
30
- /** Additional classes added to the FileUploadField container element. */
31
- className?: string;
32
- /** Flag to show if the field is disabled. */
33
- isDisabled?: boolean;
34
- /** Flag to show if the field is read only. */
35
- isReadOnly?: boolean;
36
- /** Flag to show if a file is being loaded. */
37
- isLoading?: boolean;
38
- /** Aria-valuetext for the loading spinner */
58
+ /** Aria-valuetext for the loading spinner. */
39
59
  spinnerAriaValueText?: string;
40
- /** Flag to show if the field is required. */
41
- isRequired?: boolean;
60
+ /** What type of file. Determines what is is expected by the value property (a string for
61
+ * 'text' and 'dataURL', or a File object otherwise).
62
+ */
63
+ type?: 'text' | 'dataURL';
42
64
  /** Value to indicate if the field is modified to show that validation state.
43
65
  * If set to success, field will be modified to indicate valid state.
44
66
  * If set to error, field will be modified to indicate error state.
45
67
  */
46
68
  validated?: 'success' | 'error' | 'default';
47
- /** Aria-label for the TextArea. */
48
- 'aria-label'?: string;
49
- /** Placeholder string to display in the empty filename field */
50
- filenamePlaceholder?: string;
51
- /** Aria-label for the read-only filename field */
52
- filenameAriaLabel?: string;
53
- /** Text for the Browse button */
54
- browseButtonText?: string;
55
- /** Text for the Clear button */
56
- clearButtonText?: string;
57
- /** Flag to disable the Clear button */
58
- isClearButtonDisabled?: boolean;
59
- /** Flag to hide the built-in preview of the file (where available).
60
- * If true, you can use children to render an alternate preview. */
61
- hideDefaultPreview?: boolean;
62
- /** Flag to allow editing of a text file's contents after it is selected from disk */
63
- allowEditingUploadedText?: boolean;
64
- /** Additional children to render after (or instead of) the file preview. */
65
- children?: React.ReactNode;
69
+ /** Value of the file's contents (string if text file, File object otherwise). */
70
+ value?: string | File;
66
71
 
67
72
  // Props available in FileUploadField but not FileUpload:
68
73
 
69
- /** A callback for when the Browse button is clicked. */
74
+ /** A reference object to attach to the file upload field container element. */
75
+ containerRef?: React.Ref<HTMLDivElement>;
76
+ /** Flag to show if a file is being dragged over the file upload field. */
77
+ isDragActive?: boolean;
78
+ /** A callback for when the browse button is clicked. */
70
79
  onBrowseButtonClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
71
- /** A callback for when the Clear button is clicked. */
80
+ /** A callback for when the clear button is clicked. */
72
81
  onClearButtonClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
73
- /** A callback from when the text area is clicked. Can also be set via the onClick property of FileUpload. */
82
+ /** Callback for when focus is lost on the text area field. */
83
+ onTextAreaBlur?: (event?: any) => void;
84
+ /** A callback for when the text area is clicked. Can also be set via the onClick property
85
+ * of the file upload component. */
74
86
  onTextAreaClick?: (event: React.MouseEvent<HTMLTextAreaElement, MouseEvent>) => void;
75
- /** Flag to show if a file is being dragged over the field */
76
- isDragActive?: boolean;
77
- /** A reference object to attach to the FileUploadField container element. */
78
- containerRef?: React.Ref<HTMLDivElement>;
79
- /** Text area text changed */
87
+ /** Text area text changed. */
80
88
  onTextChange?: (text: string) => void;
81
- /** Callback for when focus is lost on the text area field */
82
- onTextAreaBlur?: (event?: any) => void;
83
- /** Placeholder string to display in the empty text area field */
89
+ /** Placeholder string to display in the empty text area field. */
84
90
  textAreaPlaceholder?: string;
85
91
  }
86
92
 
@@ -7,62 +7,71 @@ import { ModalContent } from './ModalContent';
7
7
  import { OUIAProps, getDefaultOUIAId } from '../../helpers';
8
8
 
9
9
  export interface ModalProps extends React.HTMLProps<HTMLDivElement>, OUIAProps {
10
- /** Content rendered inside the Modal. */
10
+ /** Action buttons to add to the standard modal footer. Ignored if the footer property
11
+ * is passed in.
12
+ */
13
+ actions?: any;
14
+ /** The parent container to append the modal to. Defaults to "document.body". */
15
+ appendTo?: HTMLElement | (() => HTMLElement);
16
+ /** Id to use for the modal box descriptor. */
17
+ 'aria-describedby'?: string;
18
+ /** Accessible descriptor of the modal. */
19
+ 'aria-label'?: string;
20
+ /** Id to use for the modal box label. */
21
+ 'aria-labelledby'?: string;
22
+ /** Accessible label applied to the modal box body. This should be used to communicate
23
+ * important information about the modal box body div element if needed, such as that it
24
+ * is scrollable.
25
+ */
26
+ bodyAriaLabel?: string;
27
+ /** Accessible role applied to the modal box body. This will default to "region" if the
28
+ * bodyAriaLabel property is passed in. Set to a more appropriate role as applicable
29
+ * based on the modal content and context.
30
+ */
31
+ bodyAriaRole?: string;
32
+ /** Content rendered inside the modal. */
11
33
  children: React.ReactNode;
12
- /** Additional classes added to the Modal */
34
+ /** Additional classes added to the modal. */
13
35
  className?: string;
14
- /** Flag to show the modal */
15
- isOpen?: boolean;
16
- /** Complex header (more than just text), supersedes title for header content */
36
+ /** Description of the modal. */
37
+ description?: React.ReactNode;
38
+ /** Flag to disable focus trap. */
39
+ disableFocusTrap?: boolean;
40
+ /** Custom footer. */
41
+ footer?: React.ReactNode;
42
+ /** Flag indicating if modal content should be placed in a modal box body wrapper. */
43
+ hasNoBodyWrapper?: boolean;
44
+ /** Complex header (more than just text), supersedes the title property for header content. */
17
45
  header?: React.ReactNode;
18
- /** Optional help section for the Modal Header */
46
+ /** Optional help section for the modal header. */
19
47
  help?: React.ReactNode;
20
- /** Simple text content of the Modal Header, also used for aria-label on the body */
48
+ /** An id to use for the modal box container. */
49
+ id?: string;
50
+ /** Flag to show the modal. */
51
+ isOpen?: boolean;
52
+ /** A callback for when the close button is clicked. */
53
+ onClose?: () => void;
54
+ /** Modal handles pressing of the escape key and closes the modal. If you want to handle
55
+ * this yourself you can use this callback function. */
56
+ onEscapePress?: (event: KeyboardEvent) => void;
57
+ /** Alternate position of the modal. */
58
+ position?: 'top';
59
+ /** Offset from alternate position. Can be any valid CSS length/percentage. */
60
+ positionOffset?: string;
61
+ /** Flag to show the close button in the header area of the modal. */
62
+ showClose?: boolean;
63
+ /** Simple text content of the modal header. Also used for the aria-label on the body. */
21
64
  title?: string;
22
- /** Optional alert icon (or other) to show before the title of the Modal Header
23
- * When the predefined alert types are used the default styling
24
- * will be automatically applied */
65
+ /** Optional alert icon (or other) to show before the title of the modal header. When the
66
+ * predefined alert types are used the default styling will be automatically applied.
67
+ */
25
68
  titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | 'default' | React.ComponentType<any>;
26
- /** Optional title label text for screen readers */
69
+ /** Optional title label text for screen readers. */
27
70
  titleLabel?: string;
28
- /** Id to use for Modal Box label */
29
- 'aria-labelledby'?: string;
30
- /** Accessible descriptor of modal */
31
- 'aria-label'?: string;
32
- /** Id to use for Modal Box descriptor */
33
- 'aria-describedby'?: string;
34
- /** Accessible label applied to the modal box body. This should be used to communicate important information about the modal box body div if needed, such as that it is scrollable */
35
- bodyAriaLabel?: string;
36
- /** Accessible role applied to the modal box body. This will default to region if a body aria label is applied. Set to a more appropriate role as applicable based on the modal content and context */
37
- bodyAriaRole?: string;
38
- /** Flag to show the close button in the header area of the modal */
39
- showClose?: boolean;
40
- /** Custom footer */
41
- footer?: React.ReactNode;
42
- /** Action buttons to add to the standard Modal Footer, ignored if `footer` is given */
43
- actions?: any;
44
- /** A callback for when the close button is clicked */
45
- onClose?: () => void;
46
- /** Default width of the Modal. */
47
- width?: number | string;
48
- /** The parent container to append the modal to. Defaults to document.body */
49
- appendTo?: HTMLElement | (() => HTMLElement);
50
- /** Flag to disable focus trap */
51
- disableFocusTrap?: boolean;
52
- /** Description of the modal */
53
- description?: React.ReactNode;
54
- /** Variant of the modal */
71
+ /** Variant of the modal. */
55
72
  variant?: 'small' | 'medium' | 'large' | 'default';
56
- /** Alternate position of the modal */
57
- position?: 'top';
58
- /** Offset from alternate position. Can be any valid CSS length/percentage */
59
- positionOffset?: string;
60
- /** Flag indicating if modal content should be placed in a modal box body wrapper */
61
- hasNoBodyWrapper?: boolean;
62
- /** An ID to use for the ModalBox container */
63
- id?: string;
64
- /** Modal handles pressing of the Escape key and closes the modal. If you want to handle this yourself you can use this callback function */
65
- onEscapePress?: (event: KeyboardEvent) => void;
73
+ /** Default width of the modal. */
74
+ width?: number | string;
66
75
  }
67
76
 
68
77
  export enum ModalVariant {
@@ -4,22 +4,22 @@ import styles from '@patternfly/react-styles/css/components/ModalBox/modal-box';
4
4
  import topSpacer from '@patternfly/react-tokens/dist/esm/c_modal_box_m_align_top_spacer';
5
5
 
6
6
  export interface ModalBoxProps extends React.HTMLProps<HTMLDivElement> {
7
- /** Content rendered inside the ModalBox. */
7
+ /** Id to use for the modal box description. */
8
+ 'aria-describedby': string;
9
+ /** Accessible descriptor of the modal. */
10
+ 'aria-label'?: string;
11
+ /** Id to use for the modal box label. */
12
+ 'aria-labelledby'?: string;
13
+ /** Content rendered inside the modal box. */
8
14
  children: React.ReactNode;
9
- /** Additional classes added to the ModalBox */
15
+ /** Additional classes added to the modal box. */
10
16
  className?: string;
11
- /** Variant of the modal */
12
- variant?: 'small' | 'medium' | 'large' | 'default';
13
- /** Alternate position of the modal */
17
+ /** Alternate position of the modal. */
14
18
  position?: 'top';
15
- /** Offset from alternate position. Can be any valid CSS length/percentage */
19
+ /** Offset from alternate position. Can be any valid CSS length/percentage. */
16
20
  positionOffset?: string;
17
- /** Id to use for Modal Box label */
18
- 'aria-labelledby'?: string;
19
- /** Accessible descriptor of modal */
20
- 'aria-label'?: string;
21
- /** Id to use for Modal Box description */
22
- 'aria-describedby': string;
21
+ /** Variant of the modal. */
22
+ variant?: 'small' | 'medium' | 'large' | 'default';
23
23
  }
24
24
 
25
25
  export const ModalBox: React.FunctionComponent<ModalBoxProps> = ({
@@ -3,9 +3,9 @@ import { css } from '@patternfly/react-styles';
3
3
  import styles from '@patternfly/react-styles/css/components/ModalBox/modal-box';
4
4
 
5
5
  export interface ModalBoxBodyProps extends React.HTMLProps<HTMLDivElement> {
6
- /** Content rendered inside the ModalBoxBody */
6
+ /** Content rendered inside the modal box body. */
7
7
  children?: React.ReactNode;
8
- /** Additional classes added to the ModalBoxBody */
8
+ /** Additional classes added to the modal box body. */
9
9
  className?: string;
10
10
  }
11
11
 
@@ -4,9 +4,9 @@ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
4
4
  import { OUIAProps } from '../../helpers';
5
5
 
6
6
  export interface ModalBoxCloseButtonProps extends OUIAProps {
7
- /** Additional classes added to the close button */
7
+ /** Additional classes added to the close button. */
8
8
  className?: string;
9
- /** A callback for when the close button is clicked */
9
+ /** A callback for when the close button is clicked. */
10
10
  onClose?: () => void;
11
11
  }
12
12
 
@@ -3,11 +3,11 @@ import { css } from '@patternfly/react-styles';
3
3
  import styles from '@patternfly/react-styles/css/components/ModalBox/modal-box';
4
4
 
5
5
  export interface ModalBoxDescriptionProps {
6
- /** Content rendered inside the description */
6
+ /** Content rendered inside the description. */
7
7
  children?: React.ReactNode;
8
- /** Additional classes added to the description */
8
+ /** Additional classes added to the description. */
9
9
  className?: string;
10
- /** ID of the description */
10
+ /** Id of the description. */
11
11
  id?: string;
12
12
  }
13
13
 
@@ -3,9 +3,9 @@ import { css } from '@patternfly/react-styles';
3
3
  import styles from '@patternfly/react-styles/css/components/ModalBox/modal-box';
4
4
 
5
5
  export interface ModalBoxFooterProps {
6
- /** Content rendered inside the Footer */
6
+ /** Content rendered inside the modal box footer. */
7
7
  children?: React.ReactNode;
8
- /** Additional classes added to the Footer */
8
+ /** Additional classes added to the modal box footer. */
9
9
  className?: string;
10
10
  }
11
11
 
@@ -3,11 +3,11 @@ import { css } from '@patternfly/react-styles';
3
3
  import styles from '@patternfly/react-styles/css/components/ModalBox/modal-box';
4
4
 
5
5
  export interface ModalBoxHeaderProps {
6
- /** Content rendered inside the Header */
6
+ /** Content rendered inside the modal box header. */
7
7
  children?: React.ReactNode;
8
- /** Additional classes added to the button */
8
+ /** Additional classes added to the modal box header. */
9
9
  className?: string;
10
- /** Optional help section for the Modal Header */
10
+ /** Optional help section for the modal box header. */
11
11
  help?: React.ReactNode;
12
12
  }
13
13
 
@@ -15,18 +15,17 @@ export const isVariantIcon = (icon: any): icon is string =>
15
15
  ['success', 'danger', 'warning', 'info', 'default'].includes(icon as string);
16
16
 
17
17
  export interface ModalBoxTitleProps {
18
- /** Content rendered inside the modal box header title. */
18
+ /** Additional classes added to the modal box title. */
19
+ className?: string;
20
+ /** Id of the modal box title. */
21
+ id: string;
22
+ /** Content rendered inside the modal box title. */
19
23
  title: React.ReactNode;
20
- /** Optional alert icon (or other) to show before the title of the Modal Header
21
- * When the predefined alert types are used the default styling
22
- * will be automatically applied */
24
+ /** Optional alert icon (or other) to show before the title. When the predefined alert types
25
+ * are used the default styling will be automatically applied. */
23
26
  titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | 'default' | React.ComponentType<any>;
24
- /** Optional title label text for screen readers */
27
+ /** Optional title label text for screen readers. */
25
28
  titleLabel?: string;
26
- /** Additional classes added to the modal box header title. */
27
- className?: string;
28
- /** id of the modal box header title. */
29
- id: string;
30
29
  }
31
30
 
32
31
  export const ModalBoxTitle: React.FunctionComponent<ModalBoxTitleProps> = ({