@patternfly/react-core 5.0.0-alpha.108 → 5.0.0-alpha.109

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 (367) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/esm/components/AboutModal/package.json +1 -1
  3. package/dist/esm/components/Accordion/package.json +1 -1
  4. package/dist/esm/components/ActionList/package.json +1 -1
  5. package/dist/esm/components/Alert/package.json +1 -1
  6. package/dist/esm/components/Avatar/package.json +1 -1
  7. package/dist/esm/components/BackToTop/package.json +1 -1
  8. package/dist/esm/components/Backdrop/package.json +1 -1
  9. package/dist/esm/components/BackgroundImage/package.json +1 -1
  10. package/dist/esm/components/Badge/package.json +1 -1
  11. package/dist/esm/components/Banner/package.json +1 -1
  12. package/dist/esm/components/Brand/package.json +1 -1
  13. package/dist/esm/components/Breadcrumb/package.json +1 -1
  14. package/dist/esm/components/Button/package.json +1 -1
  15. package/dist/esm/components/CalendarMonth/package.json +1 -1
  16. package/dist/esm/components/Card/Card.d.ts +12 -5
  17. package/dist/esm/components/Card/Card.d.ts.map +1 -1
  18. package/dist/esm/components/Card/Card.js +17 -5
  19. package/dist/esm/components/Card/Card.js.map +1 -1
  20. package/dist/esm/components/Card/CardHeader.d.ts +30 -0
  21. package/dist/esm/components/Card/CardHeader.d.ts.map +1 -1
  22. package/dist/esm/components/Card/CardHeader.js +40 -5
  23. package/dist/esm/components/Card/CardHeader.js.map +1 -1
  24. package/dist/esm/components/Card/CardSelectableActions.d.ts +9 -0
  25. package/dist/esm/components/Card/CardSelectableActions.d.ts.map +1 -0
  26. package/dist/esm/components/Card/CardSelectableActions.js +10 -0
  27. package/dist/esm/components/Card/CardSelectableActions.js.map +1 -0
  28. package/dist/esm/components/Card/package.json +1 -1
  29. package/dist/esm/components/Checkbox/Checkbox.d.ts +2 -0
  30. package/dist/esm/components/Checkbox/Checkbox.d.ts.map +1 -1
  31. package/dist/esm/components/Checkbox/Checkbox.js +2 -2
  32. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  33. package/dist/esm/components/Checkbox/package.json +1 -1
  34. package/dist/esm/components/Chip/package.json +1 -1
  35. package/dist/esm/components/ClipboardCopy/ClipboardCopy.js +4 -4
  36. package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  37. package/dist/esm/components/ClipboardCopy/package.json +1 -1
  38. package/dist/esm/components/CodeBlock/package.json +1 -1
  39. package/dist/esm/components/DataList/package.json +1 -1
  40. package/dist/esm/components/DatePicker/package.json +1 -1
  41. package/dist/esm/components/DescriptionList/package.json +1 -1
  42. package/dist/esm/components/Divider/package.json +1 -1
  43. package/dist/esm/components/DragDrop/package.json +1 -1
  44. package/dist/esm/components/Drawer/package.json +1 -1
  45. package/dist/esm/components/Dropdown/package.json +1 -1
  46. package/dist/esm/components/DualListSelector/package.json +1 -1
  47. package/dist/esm/components/EmptyState/package.json +1 -1
  48. package/dist/esm/components/ExpandableSection/package.json +1 -1
  49. package/dist/esm/components/FileUpload/FileUploadField.js +2 -2
  50. package/dist/esm/components/FileUpload/FileUploadField.js.map +1 -1
  51. package/dist/esm/components/FileUpload/package.json +1 -1
  52. package/dist/esm/components/Form/package.json +1 -1
  53. package/dist/esm/components/FormControl/FormControlIcon.d.ts +16 -0
  54. package/dist/esm/components/FormControl/FormControlIcon.d.ts.map +1 -0
  55. package/dist/esm/components/FormControl/FormControlIcon.js +18 -0
  56. package/dist/esm/components/FormControl/FormControlIcon.js.map +1 -0
  57. package/dist/esm/components/FormSelect/FormSelect.d.ts +0 -2
  58. package/dist/esm/components/FormSelect/FormSelect.d.ts.map +1 -1
  59. package/dist/esm/components/FormSelect/FormSelect.js +9 -3
  60. package/dist/esm/components/FormSelect/FormSelect.js.map +1 -1
  61. package/dist/esm/components/FormSelect/package.json +1 -1
  62. package/dist/esm/components/HelperText/package.json +1 -1
  63. package/dist/esm/components/Hint/package.json +1 -1
  64. package/dist/esm/components/Icon/package.json +1 -1
  65. package/dist/esm/components/InputGroup/package.json +1 -1
  66. package/dist/esm/components/JumpLinks/package.json +1 -1
  67. package/dist/esm/components/Label/package.json +1 -1
  68. package/dist/esm/components/List/package.json +1 -1
  69. package/dist/esm/components/LoginPage/package.json +1 -1
  70. package/dist/esm/components/Masthead/package.json +1 -1
  71. package/dist/esm/components/Menu/package.json +1 -1
  72. package/dist/esm/components/MenuToggle/package.json +1 -1
  73. package/dist/esm/components/Modal/package.json +1 -1
  74. package/dist/esm/components/MultipleFileUpload/package.json +1 -1
  75. package/dist/esm/components/Nav/package.json +1 -1
  76. package/dist/esm/components/NotificationBadge/package.json +1 -1
  77. package/dist/esm/components/NotificationDrawer/package.json +1 -1
  78. package/dist/esm/components/NumberInput/package.json +1 -1
  79. package/dist/esm/components/OverflowMenu/package.json +1 -1
  80. package/dist/esm/components/Page/package.json +1 -1
  81. package/dist/esm/components/Pagination/package.json +1 -1
  82. package/dist/esm/components/Panel/package.json +1 -1
  83. package/dist/esm/components/Popover/package.json +1 -1
  84. package/dist/esm/components/Progress/package.json +1 -1
  85. package/dist/esm/components/ProgressStepper/package.json +1 -1
  86. package/dist/esm/components/Radio/Radio.d.ts +5 -1
  87. package/dist/esm/components/Radio/Radio.d.ts.map +1 -1
  88. package/dist/esm/components/Radio/Radio.js +3 -3
  89. package/dist/esm/components/Radio/Radio.js.map +1 -1
  90. package/dist/esm/components/Radio/package.json +1 -1
  91. package/dist/esm/components/SearchInput/package.json +1 -1
  92. package/dist/esm/components/Select/package.json +1 -1
  93. package/dist/esm/components/Sidebar/package.json +1 -1
  94. package/dist/esm/components/SimpleList/package.json +1 -1
  95. package/dist/esm/components/Skeleton/package.json +1 -1
  96. package/dist/esm/components/SkipToContent/package.json +1 -1
  97. package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
  98. package/dist/esm/components/Slider/Slider.js +1 -1
  99. package/dist/esm/components/Slider/Slider.js.map +1 -1
  100. package/dist/esm/components/Slider/package.json +1 -1
  101. package/dist/esm/components/Spinner/package.json +1 -1
  102. package/dist/esm/components/Switch/package.json +1 -1
  103. package/dist/esm/components/Tabs/package.json +1 -1
  104. package/dist/esm/components/Text/package.json +1 -1
  105. package/dist/esm/components/TextArea/TextArea.d.ts +0 -4
  106. package/dist/esm/components/TextArea/TextArea.d.ts.map +1 -1
  107. package/dist/esm/components/TextArea/TextArea.js +11 -7
  108. package/dist/esm/components/TextArea/TextArea.js.map +1 -1
  109. package/dist/esm/components/TextArea/package.json +1 -1
  110. package/dist/esm/components/TextInput/TextInput.d.ts +8 -11
  111. package/dist/esm/components/TextInput/TextInput.d.ts.map +1 -1
  112. package/dist/esm/components/TextInput/TextInput.js +10 -13
  113. package/dist/esm/components/TextInput/TextInput.js.map +1 -1
  114. package/dist/esm/components/TextInput/package.json +1 -1
  115. package/dist/esm/components/TextInputGroup/package.json +1 -1
  116. package/dist/esm/components/Tile/package.json +1 -1
  117. package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
  118. package/dist/esm/components/TimePicker/TimePicker.js +2 -2
  119. package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
  120. package/dist/esm/components/TimePicker/package.json +1 -1
  121. package/dist/esm/components/Timestamp/package.json +1 -1
  122. package/dist/esm/components/Title/package.json +1 -1
  123. package/dist/esm/components/ToggleGroup/package.json +1 -1
  124. package/dist/esm/components/Toolbar/package.json +1 -1
  125. package/dist/esm/components/Tooltip/package.json +1 -1
  126. package/dist/esm/components/TreeView/TreeViewSearch.d.ts.map +1 -1
  127. package/dist/esm/components/TreeView/TreeViewSearch.js +6 -1
  128. package/dist/esm/components/TreeView/TreeViewSearch.js.map +1 -1
  129. package/dist/esm/components/TreeView/package.json +1 -1
  130. package/dist/esm/components/Truncate/package.json +1 -1
  131. package/dist/esm/components/Wizard/hooks/package.json +1 -1
  132. package/dist/esm/components/Wizard/package.json +1 -1
  133. package/dist/esm/components/package.json +1 -1
  134. package/dist/esm/deprecated/components/ApplicationLauncher/package.json +1 -1
  135. package/dist/esm/deprecated/components/ContextSelector/package.json +1 -1
  136. package/dist/esm/deprecated/components/Dropdown/package.json +1 -1
  137. package/dist/esm/deprecated/components/OptionsMenu/package.json +1 -1
  138. package/dist/esm/deprecated/components/PageHeader/package.json +1 -1
  139. package/dist/esm/deprecated/components/Select/Select.d.ts.map +1 -1
  140. package/dist/esm/deprecated/components/Select/Select.js +16 -18
  141. package/dist/esm/deprecated/components/Select/Select.js.map +1 -1
  142. package/dist/esm/deprecated/components/Select/package.json +1 -1
  143. package/dist/esm/deprecated/components/Wizard/package.json +1 -1
  144. package/dist/esm/deprecated/components/package.json +1 -1
  145. package/dist/esm/deprecated/package.json +1 -1
  146. package/dist/esm/helpers/Popper/thirdparty/popper-core/package.json +1 -1
  147. package/dist/esm/helpers/package.json +1 -1
  148. package/dist/esm/layouts/Bullseye/package.json +1 -1
  149. package/dist/esm/layouts/Flex/package.json +1 -1
  150. package/dist/esm/layouts/Gallery/package.json +1 -1
  151. package/dist/esm/layouts/Grid/package.json +1 -1
  152. package/dist/esm/layouts/Level/package.json +1 -1
  153. package/dist/esm/layouts/Split/package.json +1 -1
  154. package/dist/esm/layouts/Stack/package.json +1 -1
  155. package/dist/esm/layouts/package.json +1 -1
  156. package/dist/esm/next/components/package.json +1 -1
  157. package/dist/esm/next/package.json +1 -1
  158. package/dist/esm/package.json +1 -1
  159. package/dist/js/components/AboutModal/package.json +1 -1
  160. package/dist/js/components/Accordion/package.json +1 -1
  161. package/dist/js/components/ActionList/package.json +1 -1
  162. package/dist/js/components/Alert/package.json +1 -1
  163. package/dist/js/components/Avatar/package.json +1 -1
  164. package/dist/js/components/BackToTop/package.json +1 -1
  165. package/dist/js/components/Backdrop/package.json +1 -1
  166. package/dist/js/components/BackgroundImage/package.json +1 -1
  167. package/dist/js/components/Badge/package.json +1 -1
  168. package/dist/js/components/Banner/package.json +1 -1
  169. package/dist/js/components/Brand/package.json +1 -1
  170. package/dist/js/components/Breadcrumb/package.json +1 -1
  171. package/dist/js/components/Button/package.json +1 -1
  172. package/dist/js/components/CalendarMonth/package.json +1 -1
  173. package/dist/js/components/Card/Card.d.ts +12 -5
  174. package/dist/js/components/Card/Card.d.ts.map +1 -1
  175. package/dist/js/components/Card/Card.js +17 -5
  176. package/dist/js/components/Card/Card.js.map +1 -1
  177. package/dist/js/components/Card/CardHeader.d.ts +30 -0
  178. package/dist/js/components/Card/CardHeader.d.ts.map +1 -1
  179. package/dist/js/components/Card/CardHeader.js +40 -5
  180. package/dist/js/components/Card/CardHeader.js.map +1 -1
  181. package/dist/js/components/Card/CardSelectableActions.d.ts +9 -0
  182. package/dist/js/components/Card/CardSelectableActions.d.ts.map +1 -0
  183. package/dist/js/components/Card/CardSelectableActions.js +14 -0
  184. package/dist/js/components/Card/CardSelectableActions.js.map +1 -0
  185. package/dist/js/components/Card/package.json +1 -1
  186. package/dist/js/components/Checkbox/Checkbox.d.ts +2 -0
  187. package/dist/js/components/Checkbox/Checkbox.d.ts.map +1 -1
  188. package/dist/js/components/Checkbox/Checkbox.js +2 -2
  189. package/dist/js/components/Checkbox/Checkbox.js.map +1 -1
  190. package/dist/js/components/Checkbox/package.json +1 -1
  191. package/dist/js/components/Chip/package.json +1 -1
  192. package/dist/js/components/ClipboardCopy/ClipboardCopy.js +4 -4
  193. package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  194. package/dist/js/components/ClipboardCopy/package.json +1 -1
  195. package/dist/js/components/CodeBlock/package.json +1 -1
  196. package/dist/js/components/DataList/package.json +1 -1
  197. package/dist/js/components/DatePicker/package.json +1 -1
  198. package/dist/js/components/DescriptionList/package.json +1 -1
  199. package/dist/js/components/Divider/package.json +1 -1
  200. package/dist/js/components/DragDrop/package.json +1 -1
  201. package/dist/js/components/Drawer/package.json +1 -1
  202. package/dist/js/components/Dropdown/package.json +1 -1
  203. package/dist/js/components/DualListSelector/package.json +1 -1
  204. package/dist/js/components/EmptyState/package.json +1 -1
  205. package/dist/js/components/ExpandableSection/package.json +1 -1
  206. package/dist/js/components/FileUpload/FileUploadField.js +2 -2
  207. package/dist/js/components/FileUpload/FileUploadField.js.map +1 -1
  208. package/dist/js/components/FileUpload/package.json +1 -1
  209. package/dist/js/components/Form/package.json +1 -1
  210. package/dist/js/components/FormControl/FormControlIcon.d.ts +16 -0
  211. package/dist/js/components/FormControl/FormControlIcon.d.ts.map +1 -0
  212. package/dist/js/components/FormControl/FormControlIcon.js +22 -0
  213. package/dist/js/components/FormControl/FormControlIcon.js.map +1 -0
  214. package/dist/js/components/FormSelect/FormSelect.d.ts +0 -2
  215. package/dist/js/components/FormSelect/FormSelect.d.ts.map +1 -1
  216. package/dist/js/components/FormSelect/FormSelect.js +9 -3
  217. package/dist/js/components/FormSelect/FormSelect.js.map +1 -1
  218. package/dist/js/components/FormSelect/package.json +1 -1
  219. package/dist/js/components/HelperText/package.json +1 -1
  220. package/dist/js/components/Hint/package.json +1 -1
  221. package/dist/js/components/Icon/package.json +1 -1
  222. package/dist/js/components/InputGroup/package.json +1 -1
  223. package/dist/js/components/JumpLinks/package.json +1 -1
  224. package/dist/js/components/Label/package.json +1 -1
  225. package/dist/js/components/List/package.json +1 -1
  226. package/dist/js/components/LoginPage/package.json +1 -1
  227. package/dist/js/components/Masthead/package.json +1 -1
  228. package/dist/js/components/Menu/package.json +1 -1
  229. package/dist/js/components/MenuToggle/package.json +1 -1
  230. package/dist/js/components/Modal/package.json +1 -1
  231. package/dist/js/components/MultipleFileUpload/package.json +1 -1
  232. package/dist/js/components/Nav/package.json +1 -1
  233. package/dist/js/components/NotificationBadge/package.json +1 -1
  234. package/dist/js/components/NotificationDrawer/package.json +1 -1
  235. package/dist/js/components/NumberInput/package.json +1 -1
  236. package/dist/js/components/OverflowMenu/package.json +1 -1
  237. package/dist/js/components/Page/package.json +1 -1
  238. package/dist/js/components/Pagination/package.json +1 -1
  239. package/dist/js/components/Panel/package.json +1 -1
  240. package/dist/js/components/Popover/package.json +1 -1
  241. package/dist/js/components/Progress/package.json +1 -1
  242. package/dist/js/components/ProgressStepper/package.json +1 -1
  243. package/dist/js/components/Radio/Radio.d.ts +5 -1
  244. package/dist/js/components/Radio/Radio.d.ts.map +1 -1
  245. package/dist/js/components/Radio/Radio.js +3 -3
  246. package/dist/js/components/Radio/Radio.js.map +1 -1
  247. package/dist/js/components/Radio/package.json +1 -1
  248. package/dist/js/components/SearchInput/package.json +1 -1
  249. package/dist/js/components/Select/package.json +1 -1
  250. package/dist/js/components/Sidebar/package.json +1 -1
  251. package/dist/js/components/SimpleList/package.json +1 -1
  252. package/dist/js/components/Skeleton/package.json +1 -1
  253. package/dist/js/components/SkipToContent/package.json +1 -1
  254. package/dist/js/components/Slider/Slider.d.ts.map +1 -1
  255. package/dist/js/components/Slider/Slider.js +1 -1
  256. package/dist/js/components/Slider/Slider.js.map +1 -1
  257. package/dist/js/components/Slider/package.json +1 -1
  258. package/dist/js/components/Spinner/package.json +1 -1
  259. package/dist/js/components/Switch/package.json +1 -1
  260. package/dist/js/components/Tabs/package.json +1 -1
  261. package/dist/js/components/Text/package.json +1 -1
  262. package/dist/js/components/TextArea/TextArea.d.ts +0 -4
  263. package/dist/js/components/TextArea/TextArea.d.ts.map +1 -1
  264. package/dist/js/components/TextArea/TextArea.js +11 -7
  265. package/dist/js/components/TextArea/TextArea.js.map +1 -1
  266. package/dist/js/components/TextArea/package.json +1 -1
  267. package/dist/js/components/TextInput/TextInput.d.ts +8 -11
  268. package/dist/js/components/TextInput/TextInput.d.ts.map +1 -1
  269. package/dist/js/components/TextInput/TextInput.js +10 -13
  270. package/dist/js/components/TextInput/TextInput.js.map +1 -1
  271. package/dist/js/components/TextInput/package.json +1 -1
  272. package/dist/js/components/TextInputGroup/package.json +1 -1
  273. package/dist/js/components/Tile/package.json +1 -1
  274. package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
  275. package/dist/js/components/TimePicker/TimePicker.js +2 -2
  276. package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
  277. package/dist/js/components/TimePicker/package.json +1 -1
  278. package/dist/js/components/Timestamp/package.json +1 -1
  279. package/dist/js/components/Title/package.json +1 -1
  280. package/dist/js/components/ToggleGroup/package.json +1 -1
  281. package/dist/js/components/Toolbar/package.json +1 -1
  282. package/dist/js/components/Tooltip/package.json +1 -1
  283. package/dist/js/components/TreeView/TreeViewSearch.d.ts.map +1 -1
  284. package/dist/js/components/TreeView/TreeViewSearch.js +6 -1
  285. package/dist/js/components/TreeView/TreeViewSearch.js.map +1 -1
  286. package/dist/js/components/TreeView/package.json +1 -1
  287. package/dist/js/components/Truncate/package.json +1 -1
  288. package/dist/js/components/Wizard/hooks/package.json +1 -1
  289. package/dist/js/components/Wizard/package.json +1 -1
  290. package/dist/js/components/package.json +1 -1
  291. package/dist/js/deprecated/components/ApplicationLauncher/package.json +1 -1
  292. package/dist/js/deprecated/components/ContextSelector/package.json +1 -1
  293. package/dist/js/deprecated/components/Dropdown/package.json +1 -1
  294. package/dist/js/deprecated/components/OptionsMenu/package.json +1 -1
  295. package/dist/js/deprecated/components/PageHeader/package.json +1 -1
  296. package/dist/js/deprecated/components/Select/Select.d.ts.map +1 -1
  297. package/dist/js/deprecated/components/Select/Select.js +16 -18
  298. package/dist/js/deprecated/components/Select/Select.js.map +1 -1
  299. package/dist/js/deprecated/components/Select/package.json +1 -1
  300. package/dist/js/deprecated/components/Wizard/package.json +1 -1
  301. package/dist/js/deprecated/components/package.json +1 -1
  302. package/dist/js/deprecated/package.json +1 -1
  303. package/dist/js/helpers/Popper/thirdparty/popper-core/package.json +1 -1
  304. package/dist/js/helpers/package.json +1 -1
  305. package/dist/js/layouts/Bullseye/package.json +1 -1
  306. package/dist/js/layouts/Flex/package.json +1 -1
  307. package/dist/js/layouts/Gallery/package.json +1 -1
  308. package/dist/js/layouts/Grid/package.json +1 -1
  309. package/dist/js/layouts/Level/package.json +1 -1
  310. package/dist/js/layouts/Split/package.json +1 -1
  311. package/dist/js/layouts/Stack/package.json +1 -1
  312. package/dist/js/layouts/package.json +1 -1
  313. package/dist/js/next/components/package.json +1 -1
  314. package/dist/js/next/package.json +1 -1
  315. package/dist/js/package.json +1 -1
  316. package/dist/umd/react-core.min.js +3 -3
  317. package/package.json +6 -6
  318. package/src/components/Card/Card.tsx +34 -9
  319. package/src/components/Card/CardHeader.tsx +94 -2
  320. package/src/components/Card/CardSelectableActions.tsx +21 -0
  321. package/src/components/Card/__tests__/Card.test.tsx +11 -7
  322. package/src/components/Card/__tests__/__snapshots__/CardHeader.test.tsx.snap +1 -3
  323. package/src/components/Card/examples/Card.md +59 -16
  324. package/src/components/Card/examples/CardClickable.tsx +54 -0
  325. package/src/components/Card/examples/CardClickableSelectable.tsx +94 -0
  326. package/src/components/Card/examples/{CardLegacySelectable.tsx → CardDeprecatedSelectable.tsx} +2 -0
  327. package/src/components/Card/examples/{CardSelectableA11yHighlight.tsx → CardDeprecatedSelectableA11yHighlight.tsx} +1 -1
  328. package/src/components/Card/examples/CardSelectable.tsx +60 -115
  329. package/src/components/Card/examples/CardSingleSelectable.tsx +52 -0
  330. package/src/components/Checkbox/Checkbox.tsx +5 -2
  331. package/src/components/ClipboardCopy/ClipboardCopy.tsx +4 -4
  332. package/src/components/ClipboardCopy/__tests__/Generated/__snapshots__/ClipboardCopy.test.tsx.snap +13 -10
  333. package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.test.tsx.snap +40 -31
  334. package/src/components/FileUpload/FileUploadField.tsx +1 -1
  335. package/src/components/FileUpload/__tests__/__snapshots__/FileUpload.test.tsx.snap +28 -22
  336. package/src/components/FileUpload/__tests__/__snapshots__/FileUploadField.test.tsx.snap +28 -22
  337. package/src/components/FormControl/FormControlIcon.tsx +31 -0
  338. package/src/components/FormSelect/FormSelect.tsx +26 -20
  339. package/src/components/FormSelect/__tests__/FormSelect.test.tsx +2 -2
  340. package/src/components/FormSelect/__tests__/__snapshots__/FormSelect.test.tsx.snap +421 -178
  341. package/src/components/FormSelect/examples/FormSelect.md +7 -6
  342. package/src/components/LoginPage/__tests__/__snapshots__/LoginForm.test.tsx.snap +84 -66
  343. package/src/components/NumberInput/__tests__/__snapshots__/NumberInput.test.tsx.snap +217 -133
  344. package/src/components/Radio/Radio.tsx +7 -2
  345. package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +36 -27
  346. package/src/components/Slider/Slider.tsx +0 -1
  347. package/src/components/Slider/_tests_/__snapshots__/Slider.test.tsx.snap +52 -40
  348. package/src/components/TextArea/TextArea.tsx +33 -26
  349. package/src/components/TextArea/__tests__/TextArea.test.tsx +6 -6
  350. package/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap +11 -8
  351. package/src/components/TextArea/examples/TextArea.md +8 -6
  352. package/src/components/TextInput/TextInput.tsx +43 -47
  353. package/src/components/TextInput/__tests__/TextInput.test.tsx +2 -2
  354. package/src/components/TextInput/__tests__/__snapshots__/TextInput.test.tsx.snap +130 -72
  355. package/src/components/TextInput/examples/TextInput.md +14 -5
  356. package/src/components/TextInput/examples/TextInputCustomIcon.tsx +30 -0
  357. package/src/components/TextInput/examples/TextInputCustomIconInvalid.tsx +20 -0
  358. package/src/components/TimePicker/TimePicker.tsx +2 -4
  359. package/src/components/TreeView/TreeViewSearch.tsx +9 -9
  360. package/src/components/TreeView/__tests__/__snapshots__/TreeView.test.tsx.snap +29 -7
  361. package/src/demos/examples/DateTimePicker/DateTimePicker.tsx +1 -1
  362. package/src/deprecated/components/Select/Select.tsx +21 -25
  363. package/src/deprecated/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +1 -2
  364. package/src/components/FormSelect/examples/FormSelectIconSpriteVariant.tsx +0 -63
  365. package/src/components/TextArea/examples/TextAreaIconSprite.tsx +0 -41
  366. package/src/components/TextInput/examples/TextInputIcon.tsx +0 -39
  367. package/src/components/TextInput/examples/TextInputIconSprite.tsx +0 -63
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "5.0.0-alpha.108",
3
+ "version": "5.0.0-alpha.109",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -46,15 +46,15 @@
46
46
  "subpaths": "node scripts/createSubpaths.js"
47
47
  },
48
48
  "dependencies": {
49
- "@patternfly/react-icons": "^5.0.0-alpha.15",
50
- "@patternfly/react-styles": "^5.0.0-alpha.11",
51
- "@patternfly/react-tokens": "^5.0.0-alpha.10",
49
+ "@patternfly/react-icons": "^5.0.0-alpha.16",
50
+ "@patternfly/react-styles": "^5.0.0-alpha.12",
51
+ "@patternfly/react-tokens": "^5.0.0-alpha.11",
52
52
  "focus-trap": "7.4.1",
53
53
  "react-dropzone": "^14.2.3",
54
54
  "tslib": "^2.5.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@patternfly/patternfly": "5.0.0-alpha.53",
57
+ "@patternfly/patternfly": "5.0.0-alpha.54",
58
58
  "@rollup/plugin-commonjs": "^25.0.0",
59
59
  "@rollup/plugin-node-resolve": "^15.0.2",
60
60
  "@rollup/plugin-replace": "^5.0.2",
@@ -71,5 +71,5 @@
71
71
  "react": "^17 || ^18",
72
72
  "react-dom": "^17 || ^18"
73
73
  },
74
- "gitHead": "c3fe2fb841eabc1aded749983b71c487fc9cdf0c"
74
+ "gitHead": "7f4932ede08af25736561cdeeeffcd110f225620"
75
75
  }
@@ -16,11 +16,15 @@ export interface CardProps extends React.HTMLProps<HTMLElement>, OUIAProps {
16
16
  isCompact?: boolean;
17
17
  /** Modifies the card to include selectable styling */
18
18
  isSelectable?: boolean;
19
- /** Specifies the card is selectable, and applies the new raised styling on hover and select */
19
+ /** @deprecated Specifies the card is selectable, and applies raised styling on hover and select */
20
20
  isSelectableRaised?: boolean;
21
21
  /** Modifies the card to include selected styling */
22
22
  isSelected?: boolean;
23
- /** Modifies a raised selectable card to have disabled styling */
23
+ /** Modifies the card to include clickable styling */
24
+ isClickable?: boolean;
25
+ /** Modifies a clickable or selectable card to have disabled styling. */
26
+ isDisabled?: boolean;
27
+ /** @deprecated Modifies a raised selectable card to have disabled styling */
24
28
  isDisabledRaised?: boolean;
25
29
  /** Modifies the card to include flat styling */
26
30
  isFlat?: boolean;
@@ -34,11 +38,11 @@ export interface CardProps extends React.HTMLProps<HTMLElement>, OUIAProps {
34
38
  isPlain?: boolean;
35
39
  /** Flag indicating if a card is expanded. Modifies the card to be expandable. */
36
40
  isExpanded?: boolean;
37
- /** Flag indicating that the card should render a hidden input to make it selectable */
41
+ /** @deprecated Flag indicating that the card should render a hidden input to make it selectable */
38
42
  hasSelectableInput?: boolean;
39
- /** Aria label to apply to the selectable input if one is rendered */
43
+ /** @deprecated Aria label to apply to the selectable input if one is rendered */
40
44
  selectableInputAriaLabel?: string;
41
- /** Callback that executes when the selectable input is changed */
45
+ /** @deprecated Callback that executes when the selectable input is changed */
42
46
  onSelectableInputChange?: (event: React.FormEvent<HTMLInputElement>, labelledBy: string) => void;
43
47
  /** Value to overwrite the randomly generated data-ouia-component-id.*/
44
48
  ouiaId?: number | string;
@@ -50,6 +54,9 @@ interface CardContextProps {
50
54
  cardId: string;
51
55
  registerTitleId: (id: string) => void;
52
56
  isExpanded: boolean;
57
+ isClickable: boolean;
58
+ isSelectable: boolean;
59
+ isDisabled: boolean;
53
60
  }
54
61
 
55
62
  interface AriaProps {
@@ -60,7 +67,10 @@ interface AriaProps {
60
67
  export const CardContext = React.createContext<Partial<CardContextProps>>({
61
68
  cardId: '',
62
69
  registerTitleId: () => {},
63
- isExpanded: false
70
+ isExpanded: false,
71
+ isClickable: false,
72
+ isSelectable: false,
73
+ isDisabled: false
64
74
  });
65
75
 
66
76
  export const Card: React.FunctionComponent<CardProps> = ({
@@ -70,6 +80,8 @@ export const Card: React.FunctionComponent<CardProps> = ({
70
80
  component = 'div',
71
81
  isCompact = false,
72
82
  isSelectable = false,
83
+ isClickable = false,
84
+ isDisabled = false,
73
85
  isSelectableRaised = false,
74
86
  isSelected = false,
75
87
  isDisabledRaised = false,
@@ -104,9 +116,18 @@ export const Card: React.FunctionComponent<CardProps> = ({
104
116
  if (isSelectableRaised) {
105
117
  return css(styles.modifiers.selectableRaised, isSelected && styles.modifiers.selectedRaised);
106
118
  }
119
+ if (isSelectable && isClickable) {
120
+ return css(styles.modifiers.selectable, styles.modifiers.clickable, isSelected && styles.modifiers.current);
121
+ }
122
+
107
123
  if (isSelectable) {
108
124
  return css(styles.modifiers.selectable, isSelected && styles.modifiers.selected);
109
125
  }
126
+
127
+ if (isClickable) {
128
+ return css(styles.modifiers.clickable, isSelected && styles.modifiers.selected);
129
+ }
130
+
110
131
  return '';
111
132
  };
112
133
 
@@ -136,7 +157,10 @@ export const Card: React.FunctionComponent<CardProps> = ({
136
157
  value={{
137
158
  cardId: id,
138
159
  registerTitleId,
139
- isExpanded
160
+ isExpanded,
161
+ isClickable,
162
+ isSelectable,
163
+ isDisabled
140
164
  }}
141
165
  >
142
166
  {hasSelectableInput && (
@@ -146,7 +170,7 @@ export const Card: React.FunctionComponent<CardProps> = ({
146
170
  {...ariaProps}
147
171
  type="checkbox"
148
172
  checked={isSelected}
149
- onChange={event => onSelectableInputChange(event, id)}
173
+ onChange={(event) => onSelectableInputChange(event, id)}
150
174
  disabled={isDisabledRaised}
151
175
  tabIndex={-1}
152
176
  />
@@ -163,9 +187,10 @@ export const Card: React.FunctionComponent<CardProps> = ({
163
187
  isFullHeight && styles.modifiers.fullHeight,
164
188
  isPlain && styles.modifiers.plain,
165
189
  getSelectableModifiers(),
190
+ isDisabled && styles.modifiers.disabled,
166
191
  className
167
192
  )}
168
- tabIndex={isSelectable || isSelectableRaised ? '0' : undefined}
193
+ tabIndex={isSelectableRaised ? '0' : undefined}
169
194
  {...props}
170
195
  {...ouiaProps}
171
196
  >
@@ -4,8 +4,11 @@ import styles from '@patternfly/react-styles/css/components/Card/card';
4
4
  import { CardContext } from './Card';
5
5
  import { CardHeaderMain } from './CardHeaderMain';
6
6
  import { CardActions } from './CardActions';
7
+ import { CardSelectableActions } from './CardSelectableActions';
7
8
  import { Button } from '../Button';
8
9
  import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
10
+ import { Radio } from '../Radio';
11
+ import { Checkbox } from '../Checkbox';
9
12
 
10
13
  export interface CardHeaderActionsObject {
11
14
  /** Actions of the card header */
@@ -16,6 +19,35 @@ export interface CardHeaderActionsObject {
16
19
  className?: string;
17
20
  }
18
21
 
22
+ export interface CardHeaderSelectableActionsObject {
23
+ /** Determines the type of input to be used for a selectable card. */
24
+ variant?: 'single' | 'multiple';
25
+ /** Flag indicating that the actions have no offset */
26
+ hasNoOffset?: boolean;
27
+ /** Additional classes added to the selectable actions wrapper */
28
+ className?: string;
29
+ /** ID passed to the selectable or clickable input */
30
+ selectableActionId: string;
31
+ /** Adds an accessible label to the selectable or clickable input */
32
+ selectableActionAriaLabel?: string;
33
+ /** Adds an accessible label to the selectable or clickable input by passing in a
34
+ * space separated list of id's.
35
+ */
36
+ selectableActionAriaLabelledby?: string;
37
+ /** Callback for when a selectable card input changes */
38
+ onChange?: (event: React.FormEvent<HTMLInputElement>, checked: boolean) => void;
39
+ /** Action to call when clickable card is clicked */
40
+ onClickAction?: (event: React.FormEvent<HTMLInputElement> | React.MouseEvent) => void;
41
+ /** Link to navigate to when clickable card is clicked */
42
+ to?: string;
43
+ /** Flag to indicate whether a clickable card's link should open in a new tab/window. */
44
+ isExternalLink?: boolean;
45
+ /** Name for the input element of a clickable or selectable card. */
46
+ name?: string;
47
+ /** Flag indicating whether the selectable card input is checked */
48
+ isChecked?: boolean;
49
+ }
50
+
19
51
  export interface CardHeaderProps extends React.HTMLProps<HTMLDivElement> {
20
52
  /** Content rendered inside the card header */
21
53
  children?: React.ReactNode;
@@ -23,6 +55,8 @@ export interface CardHeaderProps extends React.HTMLProps<HTMLDivElement> {
23
55
  className?: string;
24
56
  /** Actions of the card header */
25
57
  actions?: CardHeaderActionsObject;
58
+ /** Selectable actions of the card header */
59
+ selectableActions?: CardHeaderSelectableActionsObject;
26
60
  /** ID of the card header. */
27
61
  id?: string;
28
62
  /** Callback expandable card */
@@ -37,6 +71,7 @@ export const CardHeader: React.FunctionComponent<CardHeaderProps> = ({
37
71
  children,
38
72
  className,
39
73
  actions,
74
+ selectableActions,
40
75
  id,
41
76
  onExpand,
42
77
  toggleButtonProps,
@@ -44,7 +79,7 @@ export const CardHeader: React.FunctionComponent<CardHeaderProps> = ({
44
79
  ...props
45
80
  }: CardHeaderProps) => (
46
81
  <CardContext.Consumer>
47
- {({ cardId }) => {
82
+ {({ cardId, isClickable, isSelectable, isDisabled: isCardDisabled }) => {
48
83
  const cardHeaderToggle = (
49
84
  <div className={css(styles.cardHeaderToggle)}>
50
85
  <Button
@@ -62,6 +97,47 @@ export const CardHeader: React.FunctionComponent<CardHeaderProps> = ({
62
97
  </div>
63
98
  );
64
99
 
100
+ if (actions?.actions && !(isClickable && isSelectable)) {
101
+ // eslint-disable-next-line no-console
102
+ console.warn(
103
+ `${
104
+ isClickable ? 'Clickable' : 'Selectable'
105
+ } only cards should not contain any other actions. If you wish to include additional actions, use a clickable and selectable card.`
106
+ );
107
+ }
108
+
109
+ const handleActionClick = (event: React.FormEvent<HTMLInputElement> | React.MouseEvent) => {
110
+ if (isClickable) {
111
+ if (selectableActions?.onClickAction) {
112
+ selectableActions.onClickAction(event);
113
+ } else if (selectableActions?.to) {
114
+ window.open(selectableActions.to, selectableActions.isExternalLink ? '_blank' : '_self');
115
+ }
116
+ }
117
+ };
118
+
119
+ const getClickableSelectableProps = () => {
120
+ const baseProps = {
121
+ className: 'pf-m-standalone',
122
+ inputClassName: isClickable && !isSelectable && 'pf-v5-screen-reader',
123
+ label: <></>,
124
+ 'aria-label': selectableActions.selectableActionAriaLabel,
125
+ 'aria-labelledby': selectableActions.selectableActionAriaLabelledby,
126
+ id: selectableActions.selectableActionId,
127
+ name: selectableActions.name,
128
+ isDisabled: isCardDisabled
129
+ };
130
+
131
+ if (isClickable && !isSelectable) {
132
+ return { ...baseProps, onClick: handleActionClick };
133
+ }
134
+ if (isSelectable) {
135
+ return { ...baseProps, onChange: selectableActions.onChange, isChecked: selectableActions.isChecked };
136
+ }
137
+
138
+ return baseProps;
139
+ };
140
+
65
141
  return (
66
142
  <div
67
143
  className={css(styles.cardHeader, isToggleRightAligned && styles.modifiers.toggleRight, className)}
@@ -69,7 +145,23 @@ export const CardHeader: React.FunctionComponent<CardHeaderProps> = ({
69
145
  {...props}
70
146
  >
71
147
  {onExpand && !isToggleRightAligned && cardHeaderToggle}
72
- {actions && <CardActions className={actions?.className} hasNoOffset={actions?.hasNoOffset}> {actions.actions} </CardActions>}
148
+ {(actions || (selectableActions && (isClickable || isSelectable))) && (
149
+ <CardActions
150
+ className={actions?.className}
151
+ hasNoOffset={actions?.hasNoOffset || selectableActions?.hasNoOffset}
152
+ >
153
+ {actions?.actions}
154
+ {selectableActions && (isClickable || isSelectable) && (
155
+ <CardSelectableActions className={selectableActions?.className}>
156
+ {selectableActions?.variant === 'single' || (isClickable && !isSelectable) ? (
157
+ <Radio {...getClickableSelectableProps()} />
158
+ ) : (
159
+ <Checkbox {...getClickableSelectableProps()} />
160
+ )}
161
+ </CardSelectableActions>
162
+ )}
163
+ </CardActions>
164
+ )}
73
165
  {children && <CardHeaderMain>{children}</CardHeaderMain>}
74
166
  {onExpand && isToggleRightAligned && cardHeaderToggle}
75
167
  </div>
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { css } from '@patternfly/react-styles';
3
+ import styles from '@patternfly/react-styles/css/components/Card/card';
4
+
5
+ export interface CardActionsProps extends React.HTMLProps<HTMLDivElement> {
6
+ /** Content rendered inside the card action */
7
+ children?: React.ReactNode;
8
+ /** Additional classes added to the action */
9
+ className?: string;
10
+ }
11
+
12
+ export const CardSelectableActions: React.FunctionComponent<CardActionsProps> = ({
13
+ children,
14
+ className,
15
+ ...props
16
+ }: CardActionsProps) => (
17
+ <div className={css(styles.cardSelectableActions, className)} {...props}>
18
+ {children}
19
+ </div>
20
+ );
21
+ CardSelectableActions.displayName = 'CardSelectableActions';
@@ -33,7 +33,7 @@ describe('Card', () => {
33
33
  test('allows passing in a React Component as the component', () => {
34
34
  const Component = () => <div>im a div</div>;
35
35
 
36
- render(<Card component={(Component as unknown) as keyof JSX.IntrinsicElements} />);
36
+ render(<Card component={Component as unknown as keyof JSX.IntrinsicElements} />);
37
37
  expect(screen.getByText('im a div')).toBeInTheDocument();
38
38
  });
39
39
 
@@ -47,16 +47,18 @@ describe('Card', () => {
47
47
 
48
48
  const card = screen.getByText('selectable card');
49
49
  expect(card).toHaveClass('pf-m-selectable');
50
- expect(card).toHaveAttribute('tabindex', '0');
51
50
  });
52
51
 
53
52
  test('card with isSelectable and isSelected applied ', () => {
54
- render(<Card isSelectable isSelected>selected and selectable card</Card>);
53
+ render(
54
+ <Card isSelectable isSelected>
55
+ selected and selectable card
56
+ </Card>
57
+ );
55
58
 
56
59
  const card = screen.getByText('selected and selectable card');
57
60
  expect(card).toHaveClass('pf-m-selectable');
58
61
  expect(card).toHaveClass('pf-m-selected');
59
- expect(card).toHaveAttribute('tabindex', '0');
60
62
  });
61
63
 
62
64
  test('card with only isSelected applied - not change', () => {
@@ -81,7 +83,11 @@ describe('Card', () => {
81
83
  });
82
84
 
83
85
  test('card with isSelectableRaised and isSelected applied ', () => {
84
- render(<Card isSelected isSelectableRaised>raised selected card</Card>);
86
+ render(
87
+ <Card isSelected isSelectableRaised>
88
+ raised selected card
89
+ </Card>
90
+ );
85
91
 
86
92
  const card = screen.getByText('raised selected card');
87
93
  expect(card).toHaveClass('pf-m-selectable-raised');
@@ -154,7 +160,6 @@ describe('Card', () => {
154
160
  });
155
161
 
156
162
  test('card applies the supplied card title as the aria label of the hidden input', () => {
157
-
158
163
  // this component is used to mock the CardTitle's title registry behavior to keep this a pure unit test
159
164
  const MockCardTitle = ({ children }) => {
160
165
  const { registerTitleId } = React.useContext(CardContext);
@@ -179,7 +184,6 @@ describe('Card', () => {
179
184
  });
180
185
 
181
186
  test('card prioritizes selectableInputAriaLabel over card title labelling via card title', () => {
182
-
183
187
  // this component is used to mock the CardTitle's title registry behavior to keep this a pure unit test
184
188
  const MockCardTitle = ({ children }) => {
185
189
  const { registerTitleId } = React.useContext(CardContext);
@@ -7,9 +7,7 @@ exports[`CardHeader actions are rendered 1`] = `
7
7
  >
8
8
  <div
9
9
  class="pf-v5-c-card__actions"
10
- >
11
-
12
- </div>
10
+ />
13
11
  </div>
14
12
  </DocumentFragment>
15
13
  `;
@@ -3,7 +3,16 @@ id: Card
3
3
  section: components
4
4
  cssPrefix: pf-c-card
5
5
  propComponents:
6
- ['Card', 'CardHeader', 'CardHeaderActionsObject', 'CardTitle', 'CardBody', 'CardFooter', 'CardExpandableContent']
6
+ [
7
+ 'Card',
8
+ 'CardHeader',
9
+ 'CardHeaderActionsObject',
10
+ 'CardHeaderSelectableActionsObject',
11
+ 'CardTitle',
12
+ 'CardBody',
13
+ 'CardFooter',
14
+ 'CardExpandableContent'
15
+ ]
7
16
  ouia: true
8
17
  ---
9
18
 
@@ -31,14 +40,14 @@ Most modifiers can be used in combination with each other, except for `isCompact
31
40
 
32
41
  ```
33
42
 
34
- | Modifier | Description |
35
- | --- | --- |
36
- | isCompact | Modifies the card to include compact styling. Should not be used with isLarge. |
37
- | isFlat | Modifies the card to include flat styling. |
38
- | isRounded | Modifies the card to include rounded border styling. |
39
- | isLarge | Modifies the card to be large. Should not be used with isCompact. |
40
- | isFullHeight | Modifies the card so that it fills the total available height of its container. |
41
- | isPlain | Modifies the card to include plain styling, which removes the border and background. |
43
+ | Modifier | Description |
44
+ | ------------ | ------------------------------------------------------------------------------------ |
45
+ | isCompact | Modifies the card to include compact styling. Should not be used with isLarge. |
46
+ | isFlat | Modifies the card to include flat styling. |
47
+ | isRounded | Modifies the card to include rounded border styling. |
48
+ | isLarge | Modifies the card to be large. Should not be used with isCompact. |
49
+ | isFullHeight | Modifies the card so that it fills the total available height of its container. |
50
+ | isPlain | Modifies the card to include plain styling, which removes the border and background. |
42
51
 
43
52
  ### Header images and actions
44
53
 
@@ -98,23 +107,57 @@ A common use case of this is to set all but one body section to `isFilled={false
98
107
 
99
108
  ```
100
109
 
101
- ### Selectable cards
110
+ ### Selectable
102
111
 
103
- Selectable cards can only be selected one at a time, and are intended for use with [primary-detail layout](/demos/primary-detail).
112
+ A card can be selected by clicking anywhere within the card.
113
+
114
+ You must avoid rendering any other interactive content within the `<Card>` when it is meant to be selectable only. Refer to our [clickable and selectable example](#clickable-and-selectable-cards) if you need a card that is both selectable and has other interactive content.
104
115
 
105
116
  ```ts file='./CardSelectable.tsx'
106
117
 
107
118
  ```
108
119
 
109
- ### Legacy selectable cards
120
+ ### Single selectable
121
+
122
+ When a group of single selectable cards are related, you should pass the same `name` property to each card's `selectableActions` property.
123
+
124
+ ```ts file='./CardSingleSelectable.tsx'
125
+
126
+ ```
127
+
128
+ ### Clickable
129
+
130
+ A card can perform an action or navigate to a link by clicking anywhere within the card. You can also pass in the `isExternalLink` property to `selectableActions` if you want a clickable card's link to open in a new tab or window.
131
+
132
+ When a card is meant to be clickable only, you must avoid rendering any other interactive content within the `<Card>`, similar to selectable cards.
133
+
134
+ ```ts file='./CardClickable.tsx'
135
+
136
+ ```
137
+
138
+ ### Clickable and selectable
139
+
140
+ A card can be selectable and have additional interactive content by passing both the `isClickable` and `isSelectable` properties to `<Card>`. The following example shows how the "clickable" functionality can be rendered anywhere within a selectable card.
141
+
142
+ When passing interactive content to a clickable and selectable card that is disabled, you should also ensure the interactive content is disabled as well, if applicable.
143
+
144
+ ```ts file='./CardClickableSelectable.tsx'
145
+
146
+ ```
147
+
148
+ ### Selectable cards (deprecated)
110
149
 
111
- The following example shows a legacy implementation of selectable cards. This example uses the `isSelectable` property instead of `isSelectableRaised`, which is the current recommendation for implementation. `isSelectable` applies selectable styling, but does not apply raised styling on hover and selection as `isSelectableRaised` does.
150
+ The following example shows a deprecated implementation of selectable cards. This example uses the `isSelectable` property instead of `isSelectableRaised`, which is the current recommendation for implementation. `isSelectable` applies selectable styling, but does not apply raised styling on hover and selection as `isSelectableRaised` does.
112
151
 
113
- ```ts file='./CardLegacySelectable.tsx'
152
+ A `tabIndex={0}` is also manually passed to allow the card to be focused and clicked via keyboard.
153
+
154
+ ```ts file='./CardDeprecatedSelectable.tsx'
114
155
 
115
156
  ```
116
157
 
117
- ### Selectable card accessibility features
158
+ ### Selectable card accessibility features (deprecated)
159
+
160
+ Note: the following example uses deprecated properties. We recommend using the new `selectableActions` property for the `CardHeader` instead.
118
161
 
119
162
  The following cards demonstrate how the `hasSelectableInput` and `onSelectableInputChange` properties improve accessibility for selectable cards.
120
163
 
@@ -128,7 +171,7 @@ The second card does not set `hasSelectableInput` to true, so neither the input
128
171
 
129
172
  We recommend navigating this example using a screen reader to best understand both cards.
130
173
 
131
- ```ts file='./CardSelectableA11yHighlight.tsx'
174
+ ```ts file='./CardDeprecatedSelectableA11yHighlight.tsx'
132
175
 
133
176
  ```
134
177
 
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import { Card, CardHeader, CardTitle, CardBody } from '@patternfly/react-core';
3
+
4
+ export const CardClickable: React.FunctionComponent = () => {
5
+ const id1 = 'clickable-card-input-1';
6
+ const id2 = 'clickable-card-input-2';
7
+ const id3 = 'clickable-card-input-3';
8
+
9
+ return (
10
+ <React.Fragment>
11
+ <Card id="clickable-card-example-1" isClickable>
12
+ <CardHeader
13
+ selectableActions={{
14
+ // eslint-disable-next-line no-console
15
+ onClickAction: () => console.log(`${id1} clicked`),
16
+ selectableActionId: id1,
17
+ selectableActionAriaLabelledby: 'clickable-card-example-1',
18
+ name: 'clickable-card-example'
19
+ }}
20
+ >
21
+ <CardTitle>First card</CardTitle>
22
+ </CardHeader>
23
+ <CardBody>This card performs an action on click.</CardBody>
24
+ </Card>
25
+ <Card id="clickable-card-example-2" isClickable>
26
+ <CardHeader
27
+ selectableActions={{
28
+ to: '#',
29
+ selectableActionId: id2,
30
+ selectableActionAriaLabelledby: 'clickable-card-example-2',
31
+ name: 'clickable-card-example'
32
+ }}
33
+ >
34
+ <CardTitle>Second card</CardTitle>
35
+ </CardHeader>
36
+ <CardBody>This card can navigate to a link on click.</CardBody>
37
+ </Card>
38
+ <Card id="clickable-card-example-3" isClickable isDisabled>
39
+ <CardHeader
40
+ selectableActions={{
41
+ // eslint-disable-next-line no-console
42
+ onClickAction: () => console.log(`${id3} clicked`),
43
+ selectableActionId: id3,
44
+ selectableActionAriaLabelledby: 'clickable-card-example-3',
45
+ name: 'clickable-card-example'
46
+ }}
47
+ >
48
+ <CardTitle>Third card</CardTitle>
49
+ </CardHeader>
50
+ <CardBody>This card is clickable but disabled.</CardBody>
51
+ </Card>
52
+ </React.Fragment>
53
+ );
54
+ };
@@ -0,0 +1,94 @@
1
+ import React from 'react';
2
+ import { Card, CardHeader, CardTitle, CardBody, Button } from '@patternfly/react-core';
3
+
4
+ export const CardClickable: React.FunctionComponent = () => {
5
+ const [isChecked1, setIsChecked1] = React.useState(false);
6
+ const [isChecked2, setIsChecked2] = React.useState(false);
7
+ const [isChecked3, setIsChecked3] = React.useState(false);
8
+ const [isSelected1, setIsSelected1] = React.useState(false);
9
+
10
+ const id1 = 'clickable-selectable-card-input-1';
11
+ const id2 = 'clickable-selectable-card-input-2';
12
+ const id3 = 'clickable-selectable-card-input-3';
13
+
14
+ const onClick = () => {
15
+ setIsSelected1((prevState) => !prevState);
16
+ };
17
+
18
+ const onChange = (event: React.FormEvent<HTMLInputElement>, checked: boolean) => {
19
+ const name = event.currentTarget.name;
20
+
21
+ switch (name) {
22
+ case id1:
23
+ setIsChecked1(checked);
24
+ break;
25
+ case id2:
26
+ setIsChecked2(checked);
27
+ break;
28
+ case id3:
29
+ setIsChecked3(checked);
30
+ break;
31
+ }
32
+ };
33
+
34
+ return (
35
+ <React.Fragment>
36
+ <Card id="clickable-selectable-card-example-1" isClickable isSelectable isSelected={isSelected1}>
37
+ <CardHeader
38
+ selectableActions={{
39
+ selectableActionId: id1,
40
+ selectableActionAriaLabelledby: 'clickable-selectable-card-example-1',
41
+ name: id1,
42
+ isChecked: isChecked1,
43
+ onChange
44
+ }}
45
+ >
46
+ <CardTitle>
47
+ <Button variant="link" isInline onClick={onClick}>
48
+ First card
49
+ </Button>
50
+ </CardTitle>
51
+ </CardHeader>
52
+ <CardBody>This card performs an action upon clicking the card title and is selectable.</CardBody>
53
+ </Card>
54
+ <Card id="clickable-selectable-card-example-2" isClickable isSelectable>
55
+ <CardHeader
56
+ selectableActions={{
57
+ selectableActionId: id2,
58
+ selectableActionAriaLabelledby: 'clickable-selectable-card-example-2',
59
+ name: id2,
60
+ isChecked: isChecked2,
61
+ onChange
62
+ }}
63
+ >
64
+ <CardTitle>Second Card</CardTitle>
65
+ </CardHeader>
66
+ <CardBody>
67
+ This card is selectable and has a link in the card body that navigates to{' '}
68
+ <Button variant="link" isInline component="a" href="#">
69
+ Patternfly
70
+ </Button>
71
+ .
72
+ </CardBody>
73
+ </Card>
74
+ <Card id="clickable-selectable-card-example-3" isClickable isSelectable isDisabled>
75
+ <CardHeader
76
+ selectableActions={{
77
+ selectableActionId: id3,
78
+ selectableActionAriaLabelledby: 'clickable-selectable-card-example-3',
79
+ name: id3,
80
+ isChecked: isChecked3,
81
+ onChange
82
+ }}
83
+ >
84
+ <CardTitle>
85
+ <Button isDisabled variant="link" isInline component="a" href="https://www.patternfly.org/">
86
+ Third card
87
+ </Button>
88
+ </CardTitle>
89
+ </CardHeader>
90
+ <CardBody>This card is clickable and selectable, but disabled.</CardBody>
91
+ </Card>
92
+ </React.Fragment>
93
+ );
94
+ };
@@ -102,6 +102,7 @@ export const CardLegacySelectable: React.FunctionComponent = () => {
102
102
  isSelectable
103
103
  isSelected={selected === 'legacy-first-card'}
104
104
  hasSelectableInput
105
+ tabIndex={0}
105
106
  >
106
107
  <CardHeader actions={{ actions: headerActions }} />
107
108
  <CardTitle>First legacy selectable card</CardTitle>
@@ -116,6 +117,7 @@ export const CardLegacySelectable: React.FunctionComponent = () => {
116
117
  isSelectable
117
118
  isSelected={selected === 'legacy-second-card'}
118
119
  hasSelectableInput
120
+ tabIndex={0}
119
121
  >
120
122
  <CardTitle>Second legacy selectable card</CardTitle>
121
123
  <CardBody>This is a selectable card. Click me to select me. Click again to deselect me.</CardBody>