@patternfly/react-core 6.2.2 → 6.3.0-prerelease.10

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 (375) hide show
  1. package/CHANGELOG.md +73 -9
  2. package/components/package.json +1 -1
  3. package/deprecated/package.json +1 -1
  4. package/dist/dynamic/components/AboutModal/package.json +1 -1
  5. package/dist/dynamic/components/Accordion/package.json +1 -1
  6. package/dist/dynamic/components/ActionList/package.json +1 -1
  7. package/dist/dynamic/components/Alert/package.json +1 -1
  8. package/dist/dynamic/components/Avatar/package.json +1 -1
  9. package/dist/dynamic/components/BackToTop/package.json +1 -1
  10. package/dist/dynamic/components/Backdrop/package.json +1 -1
  11. package/dist/dynamic/components/BackgroundImage/package.json +1 -1
  12. package/dist/dynamic/components/Badge/package.json +1 -1
  13. package/dist/dynamic/components/Banner/package.json +1 -1
  14. package/dist/dynamic/components/Brand/package.json +1 -1
  15. package/dist/dynamic/components/Breadcrumb/package.json +1 -1
  16. package/dist/dynamic/components/Button/package.json +1 -1
  17. package/dist/dynamic/components/CalendarMonth/package.json +1 -1
  18. package/dist/dynamic/components/Card/package.json +1 -1
  19. package/dist/dynamic/components/Checkbox/package.json +1 -1
  20. package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
  21. package/dist/dynamic/components/CodeBlock/package.json +1 -1
  22. package/dist/dynamic/components/Content/package.json +1 -1
  23. package/dist/dynamic/components/DataList/package.json +1 -1
  24. package/dist/dynamic/components/DatePicker/package.json +1 -1
  25. package/dist/dynamic/components/DescriptionList/package.json +1 -1
  26. package/dist/dynamic/components/Divider/package.json +1 -1
  27. package/dist/dynamic/components/Drawer/package.json +1 -1
  28. package/dist/dynamic/components/Dropdown/package.json +1 -1
  29. package/dist/dynamic/components/DualListSelector/package.json +1 -1
  30. package/dist/dynamic/components/EmptyState/package.json +1 -1
  31. package/dist/dynamic/components/ExpandableSection/package.json +1 -1
  32. package/dist/dynamic/components/FileUpload/package.json +1 -1
  33. package/dist/dynamic/components/Form/package.json +1 -1
  34. package/dist/dynamic/components/FormSelect/package.json +1 -1
  35. package/dist/dynamic/components/HelperText/package.json +1 -1
  36. package/dist/dynamic/components/Hint/package.json +1 -1
  37. package/dist/dynamic/components/Icon/package.json +1 -1
  38. package/dist/dynamic/components/InputGroup/package.json +1 -1
  39. package/dist/dynamic/components/JumpLinks/package.json +1 -1
  40. package/dist/dynamic/components/Label/package.json +1 -1
  41. package/dist/dynamic/components/List/package.json +1 -1
  42. package/dist/dynamic/components/LoginPage/package.json +1 -1
  43. package/dist/dynamic/components/Masthead/package.json +1 -1
  44. package/dist/dynamic/components/Menu/package.json +1 -1
  45. package/dist/dynamic/components/MenuToggle/package.json +1 -1
  46. package/dist/dynamic/components/Modal/package.json +1 -1
  47. package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
  48. package/dist/dynamic/components/Nav/package.json +1 -1
  49. package/dist/dynamic/components/NotificationBadge/package.json +1 -1
  50. package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
  51. package/dist/dynamic/components/NumberInput/package.json +1 -1
  52. package/dist/dynamic/components/OverflowMenu/package.json +1 -1
  53. package/dist/dynamic/components/Page/package.json +1 -1
  54. package/dist/dynamic/components/Pagination/package.json +1 -1
  55. package/dist/dynamic/components/Panel/package.json +1 -1
  56. package/dist/dynamic/components/Popover/package.json +1 -1
  57. package/dist/dynamic/components/Progress/package.json +1 -1
  58. package/dist/dynamic/components/ProgressStepper/package.json +1 -1
  59. package/dist/dynamic/components/Radio/package.json +1 -1
  60. package/dist/dynamic/components/SearchInput/package.json +1 -1
  61. package/dist/dynamic/components/Select/package.json +1 -1
  62. package/dist/dynamic/components/Sidebar/package.json +1 -1
  63. package/dist/dynamic/components/SimpleList/package.json +1 -1
  64. package/dist/dynamic/components/Skeleton/package.json +1 -1
  65. package/dist/dynamic/components/SkipToContent/package.json +1 -1
  66. package/dist/dynamic/components/Slider/package.json +1 -1
  67. package/dist/dynamic/components/Spinner/package.json +1 -1
  68. package/dist/dynamic/components/Switch/package.json +1 -1
  69. package/dist/dynamic/components/Tabs/package.json +1 -1
  70. package/dist/dynamic/components/TextArea/package.json +1 -1
  71. package/dist/dynamic/components/TextInput/package.json +1 -1
  72. package/dist/dynamic/components/TextInputGroup/package.json +1 -1
  73. package/dist/dynamic/components/TimePicker/package.json +1 -1
  74. package/dist/dynamic/components/Timestamp/package.json +1 -1
  75. package/dist/dynamic/components/Title/package.json +1 -1
  76. package/dist/dynamic/components/ToggleGroup/package.json +1 -1
  77. package/dist/dynamic/components/Toolbar/package.json +1 -1
  78. package/dist/dynamic/components/Tooltip/package.json +1 -1
  79. package/dist/dynamic/components/TreeView/package.json +1 -1
  80. package/dist/dynamic/components/Truncate/package.json +1 -1
  81. package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
  82. package/dist/dynamic/components/Wizard/package.json +1 -1
  83. package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
  84. package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
  85. package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
  86. package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
  87. package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
  88. package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
  89. package/dist/dynamic/deprecated/components/package.json +1 -1
  90. package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
  91. package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
  92. package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
  93. package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
  94. package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
  95. package/dist/dynamic/helpers/constants/package.json +1 -1
  96. package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
  97. package/dist/dynamic/helpers/fileUtils/package.json +1 -1
  98. package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
  99. package/dist/dynamic/helpers/package.json +1 -1
  100. package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
  101. package/dist/dynamic/helpers/typeUtils/package.json +1 -1
  102. package/dist/dynamic/helpers/useInterval/package.json +1 -1
  103. package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
  104. package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
  105. package/dist/dynamic/helpers/util/package.json +1 -1
  106. package/dist/dynamic/layouts/Bullseye/package.json +1 -1
  107. package/dist/dynamic/layouts/Flex/package.json +1 -1
  108. package/dist/dynamic/layouts/Gallery/package.json +1 -1
  109. package/dist/dynamic/layouts/Grid/package.json +1 -1
  110. package/dist/dynamic/layouts/Level/package.json +1 -1
  111. package/dist/dynamic/layouts/Split/package.json +1 -1
  112. package/dist/dynamic/layouts/Stack/package.json +1 -1
  113. package/dist/dynamic/styles/package.json +1 -1
  114. package/dist/esm/components/Divider/Divider.d.ts +2 -0
  115. package/dist/esm/components/Divider/Divider.d.ts.map +1 -1
  116. package/dist/esm/components/Divider/Divider.js +2 -2
  117. package/dist/esm/components/Divider/Divider.js.map +1 -1
  118. package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts +1 -1
  119. package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
  120. package/dist/esm/components/ExpandableSection/ExpandableSectionToggle.d.ts +1 -1
  121. package/dist/esm/components/ExpandableSection/ExpandableSectionToggle.d.ts.map +1 -1
  122. package/dist/esm/components/Form/FormFieldGroup.d.ts +1 -1
  123. package/dist/esm/components/Form/FormFieldGroup.d.ts.map +1 -1
  124. package/dist/esm/components/Form/FormFieldGroupExpandable.d.ts +1 -1
  125. package/dist/esm/components/Form/FormFieldGroupExpandable.d.ts.map +1 -1
  126. package/dist/esm/components/Form/FormGroupLabelHelp.js +2 -2
  127. package/dist/esm/components/Form/FormGroupLabelHelp.js.map +1 -1
  128. package/dist/esm/components/Form/InternalFormFieldGroup.d.ts +1 -1
  129. package/dist/esm/components/Form/InternalFormFieldGroup.d.ts.map +1 -1
  130. package/dist/esm/components/List/List.d.ts.map +1 -1
  131. package/dist/esm/components/List/List.js +2 -2
  132. package/dist/esm/components/List/List.js.map +1 -1
  133. package/dist/esm/components/List/ListItem.d.ts +4 -2
  134. package/dist/esm/components/List/ListItem.d.ts.map +1 -1
  135. package/dist/esm/components/List/ListItem.js +2 -2
  136. package/dist/esm/components/List/ListItem.js.map +1 -1
  137. package/dist/esm/components/Nav/Nav.d.ts +1 -1
  138. package/dist/esm/components/Nav/Nav.d.ts.map +1 -1
  139. package/dist/esm/components/Nav/NavExpandable.d.ts.map +1 -1
  140. package/dist/esm/components/Nav/NavExpandable.js +1 -1
  141. package/dist/esm/components/Nav/NavExpandable.js.map +1 -1
  142. package/dist/esm/components/Nav/NavItemSeparator.d.ts.map +1 -1
  143. package/dist/esm/components/Nav/NavItemSeparator.js +2 -2
  144. package/dist/esm/components/Nav/NavItemSeparator.js.map +1 -1
  145. package/dist/esm/components/Progress/ProgressContainer.d.ts.map +1 -1
  146. package/dist/esm/components/Progress/ProgressContainer.js +12 -6
  147. package/dist/esm/components/Progress/ProgressContainer.js.map +1 -1
  148. package/dist/esm/components/Tabs/Tabs.d.ts +1 -1
  149. package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
  150. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  151. package/dist/esm/components/Toolbar/ToolbarGroup.d.ts +1 -1
  152. package/dist/esm/components/Toolbar/ToolbarGroup.d.ts.map +1 -1
  153. package/dist/esm/components/Toolbar/ToolbarItem.d.ts.map +1 -1
  154. package/dist/esm/components/Toolbar/ToolbarItem.js +4 -3
  155. package/dist/esm/components/Toolbar/ToolbarItem.js.map +1 -1
  156. package/dist/esm/components/TreeView/TreeViewListItem.d.ts +2 -2
  157. package/dist/esm/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  158. package/dist/esm/components/Truncate/Truncate.d.ts +11 -1
  159. package/dist/esm/components/Truncate/Truncate.d.ts.map +1 -1
  160. package/dist/esm/components/Truncate/Truncate.js +49 -10
  161. package/dist/esm/components/Truncate/Truncate.js.map +1 -1
  162. package/dist/esm/components/Wizard/WizardNavInternal.js.map +1 -1
  163. package/dist/js/components/Divider/Divider.d.ts +2 -0
  164. package/dist/js/components/Divider/Divider.d.ts.map +1 -1
  165. package/dist/js/components/Divider/Divider.js +2 -2
  166. package/dist/js/components/Divider/Divider.js.map +1 -1
  167. package/dist/js/components/ExpandableSection/ExpandableSection.d.ts +1 -1
  168. package/dist/js/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
  169. package/dist/js/components/ExpandableSection/ExpandableSectionToggle.d.ts +1 -1
  170. package/dist/js/components/ExpandableSection/ExpandableSectionToggle.d.ts.map +1 -1
  171. package/dist/js/components/Form/FormFieldGroup.d.ts +1 -1
  172. package/dist/js/components/Form/FormFieldGroup.d.ts.map +1 -1
  173. package/dist/js/components/Form/FormFieldGroupExpandable.d.ts +1 -1
  174. package/dist/js/components/Form/FormFieldGroupExpandable.d.ts.map +1 -1
  175. package/dist/js/components/Form/FormGroupLabelHelp.js +2 -2
  176. package/dist/js/components/Form/FormGroupLabelHelp.js.map +1 -1
  177. package/dist/js/components/Form/InternalFormFieldGroup.d.ts +1 -1
  178. package/dist/js/components/Form/InternalFormFieldGroup.d.ts.map +1 -1
  179. package/dist/js/components/List/List.d.ts.map +1 -1
  180. package/dist/js/components/List/List.js +2 -2
  181. package/dist/js/components/List/List.js.map +1 -1
  182. package/dist/js/components/List/ListItem.d.ts +4 -2
  183. package/dist/js/components/List/ListItem.d.ts.map +1 -1
  184. package/dist/js/components/List/ListItem.js +2 -2
  185. package/dist/js/components/List/ListItem.js.map +1 -1
  186. package/dist/js/components/Nav/Nav.d.ts +1 -1
  187. package/dist/js/components/Nav/Nav.d.ts.map +1 -1
  188. package/dist/js/components/Nav/NavExpandable.d.ts.map +1 -1
  189. package/dist/js/components/Nav/NavExpandable.js +1 -1
  190. package/dist/js/components/Nav/NavExpandable.js.map +1 -1
  191. package/dist/js/components/Nav/NavItemSeparator.d.ts.map +1 -1
  192. package/dist/js/components/Nav/NavItemSeparator.js +2 -2
  193. package/dist/js/components/Nav/NavItemSeparator.js.map +1 -1
  194. package/dist/js/components/Progress/ProgressContainer.d.ts.map +1 -1
  195. package/dist/js/components/Progress/ProgressContainer.js +10 -4
  196. package/dist/js/components/Progress/ProgressContainer.js.map +1 -1
  197. package/dist/js/components/Tabs/Tabs.d.ts +1 -1
  198. package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
  199. package/dist/js/components/Tabs/Tabs.js.map +1 -1
  200. package/dist/js/components/Toolbar/ToolbarGroup.d.ts +1 -1
  201. package/dist/js/components/Toolbar/ToolbarGroup.d.ts.map +1 -1
  202. package/dist/js/components/Toolbar/ToolbarItem.d.ts.map +1 -1
  203. package/dist/js/components/Toolbar/ToolbarItem.js +4 -3
  204. package/dist/js/components/Toolbar/ToolbarItem.js.map +1 -1
  205. package/dist/js/components/TreeView/TreeViewListItem.d.ts +2 -2
  206. package/dist/js/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  207. package/dist/js/components/Truncate/Truncate.d.ts +11 -1
  208. package/dist/js/components/Truncate/Truncate.d.ts.map +1 -1
  209. package/dist/js/components/Truncate/Truncate.js +48 -9
  210. package/dist/js/components/Truncate/Truncate.js.map +1 -1
  211. package/dist/js/components/Wizard/WizardNavInternal.js.map +1 -1
  212. package/dist/umd/assets/{output-AyA9e2xy.css → output-CuGIDyMV.css} +19664 -19577
  213. package/dist/umd/react-core.min.js +3 -3
  214. package/helpers/package.json +1 -1
  215. package/layouts/package.json +1 -1
  216. package/next/package.json +1 -1
  217. package/package.json +8 -8
  218. package/src/components/Alert/examples/Alert.md +0 -3
  219. package/src/components/Card/examples/Card.md +4 -0
  220. package/src/components/Card/examples/CardHeaderWraps.tsx +26 -0
  221. package/src/components/CodeBlock/examples/CodeBlockBasic.tsx +1 -1
  222. package/src/components/CodeBlock/examples/CodeBlockExpandable.tsx +10 -3
  223. package/src/components/DescriptionList/examples/DescriptionListAutoFitBasic.tsx +1 -1
  224. package/src/components/DescriptionList/examples/DescriptionListAutoFitMinWidthModified.tsx +5 -1
  225. package/src/components/DescriptionList/examples/DescriptionListAutoFitMinWidthResponsive.tsx +5 -1
  226. package/src/components/DescriptionList/examples/DescriptionListBasic.tsx +1 -1
  227. package/src/components/DescriptionList/examples/DescriptionListColumnFill.tsx +1 -1
  228. package/src/components/DescriptionList/examples/DescriptionListCompact.tsx +1 -1
  229. package/src/components/DescriptionList/examples/DescriptionListCompactHorizontal.tsx +1 -1
  230. package/src/components/DescriptionList/examples/DescriptionListDefaultAutoColumn.tsx +1 -1
  231. package/src/components/DescriptionList/examples/DescriptionListDefaultInlineGrid.tsx +1 -1
  232. package/src/components/DescriptionList/examples/DescriptionListDefaultResponsiveColumns.tsx +1 -1
  233. package/src/components/DescriptionList/examples/DescriptionListDefaultThreeColLg.tsx +1 -1
  234. package/src/components/DescriptionList/examples/DescriptionListDefaultTwoCol.tsx +1 -0
  235. package/src/components/DescriptionList/examples/DescriptionListDisplaySizeAndCardHorizontalTermWidth.tsx +7 -1
  236. package/src/components/DescriptionList/examples/DescriptionListDisplaySizeAndCardThreeColumn.tsx +5 -1
  237. package/src/components/DescriptionList/examples/DescriptionListFluidHorizontal.tsx +1 -1
  238. package/src/components/DescriptionList/examples/DescriptionListHorizontal.tsx +1 -1
  239. package/src/components/DescriptionList/examples/DescriptionListHorizontalAutoColumn.tsx +6 -1
  240. package/src/components/DescriptionList/examples/DescriptionListHorizontalCustomTermWidth.tsx +1 -0
  241. package/src/components/DescriptionList/examples/DescriptionListHorizontalResponsiveColumns.tsx +1 -1
  242. package/src/components/DescriptionList/examples/DescriptionListHorizontalThreeColLg.tsx +1 -1
  243. package/src/components/DescriptionList/examples/DescriptionListHorizontalTwoCol.tsx +1 -1
  244. package/src/components/DescriptionList/examples/DescriptionListIconsOnTerms.tsx +1 -1
  245. package/src/components/DescriptionList/examples/DescriptionListResponsiveHoriVertGroup.tsx +1 -0
  246. package/src/components/DescriptionList/examples/DescriptionListWithCard.tsx +1 -1
  247. package/src/components/DescriptionList/examples/DescriptionListWithLargeDisplaySize.tsx +1 -1
  248. package/src/components/DescriptionList/examples/DescriptionListWithLargeDisplaySizeAndCard.tsx +5 -1
  249. package/src/components/DescriptionList/examples/DescriptionListWithTermHelpText.tsx +1 -1
  250. package/src/components/Divider/Divider.tsx +4 -1
  251. package/src/components/Divider/__tests__/Divider.test.tsx +10 -0
  252. package/src/components/DualListSelector/examples/DualListSelectorBasicSearch.tsx +1 -0
  253. package/src/components/DualListSelector/examples/DualListSelectorComplexOptionsActions.tsx +1 -0
  254. package/src/components/DualListSelector/examples/DualListSelectorTree.tsx +1 -0
  255. package/src/components/ExpandableSection/ExpandableSection.tsx +1 -1
  256. package/src/components/ExpandableSection/ExpandableSectionToggle.tsx +1 -1
  257. package/src/components/Form/FormFieldGroup.tsx +1 -1
  258. package/src/components/Form/FormFieldGroupExpandable.tsx +1 -1
  259. package/src/components/Form/FormGroupLabelHelp.tsx +2 -2
  260. package/src/components/Form/InternalFormFieldGroup.tsx +1 -1
  261. package/src/components/List/List.tsx +3 -0
  262. package/src/components/List/ListItem.tsx +7 -4
  263. package/src/components/List/__tests__/List.test.tsx +97 -101
  264. package/src/components/List/__tests__/ListItem.test.tsx +51 -0
  265. package/src/components/List/__tests__/__snapshots__/List.test.tsx.snap +4 -261
  266. package/src/components/List/__tests__/__snapshots__/ListItem.test.tsx.snap +34 -0
  267. package/src/components/LoginPage/examples/LoginPageBasic.tsx +1 -1
  268. package/src/components/LoginPage/examples/LoginPageLanguageSelect.tsx +1 -1
  269. package/src/components/LoginPage/examples/LoginPageShowHidePassword.tsx +1 -1
  270. package/src/components/Nav/Nav.tsx +1 -1
  271. package/src/components/Nav/NavExpandable.tsx +6 -1
  272. package/src/components/Nav/NavItemSeparator.tsx +2 -1
  273. package/src/components/Nav/__tests__/Generated/__snapshots__/NavExpandable.test.tsx.snap +1 -0
  274. package/src/components/Nav/__tests__/NavExpandable.test.tsx +15 -0
  275. package/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap +3 -0
  276. package/src/components/Page/examples/Page.md +1 -1
  277. package/src/components/Page/examples/PageCenteredSection.tsx +3 -4
  278. package/src/components/Page/examples/PageGroupSection.tsx +9 -3
  279. package/src/components/Page/examples/PageHorizontalNav.tsx +9 -3
  280. package/src/components/Page/examples/PageMainSectionPadding.tsx +12 -4
  281. package/src/components/Page/examples/PageMainSectionVariations.tsx +6 -6
  282. package/src/components/Page/examples/PageMultipleSidebarBody.tsx +9 -3
  283. package/src/components/Page/examples/PageUncontrolledNav.tsx +9 -3
  284. package/src/components/Page/examples/PageVerticalNav.tsx +9 -3
  285. package/src/components/Page/examples/PageWithOrWithoutFill.tsx +8 -4
  286. package/src/components/Progress/ProgressContainer.tsx +23 -16
  287. package/src/components/Progress/examples/ProgressTitleOutsideOfProgressBar.tsx +1 -1
  288. package/src/components/SearchInput/examples/SearchInputAdvanced.tsx +1 -0
  289. package/src/components/SearchInput/examples/SearchInputBasic.tsx +1 -0
  290. package/src/components/SearchInput/examples/SearchInputFocusSearch.tsx +7 -1
  291. package/src/components/SearchInput/examples/SearchInputWithExpandable.tsx +1 -0
  292. package/src/components/SearchInput/examples/SearchInputWithNavigableOptions.tsx +1 -0
  293. package/src/components/SearchInput/examples/SearchInputWithResultCount.tsx +1 -0
  294. package/src/components/SearchInput/examples/SearchInputWithSubmitButton.tsx +1 -0
  295. package/src/components/Select/examples/Select.md +3 -26
  296. package/src/components/Skeleton/examples/SkeletonText.tsx +0 -1
  297. package/src/components/Tabs/Tabs.tsx +3 -1
  298. package/src/components/Toolbar/ToolbarGroup.tsx +1 -1
  299. package/src/components/Toolbar/ToolbarItem.tsx +11 -1
  300. package/src/components/TreeView/TreeViewListItem.tsx +2 -2
  301. package/src/components/TreeView/__tests__/TreeView.test.tsx +26 -1
  302. package/src/components/TreeView/__tests__/TreeViewList.test.tsx +46 -0
  303. package/src/components/TreeView/__tests__/TreeViewListItem.test.tsx +278 -156
  304. package/src/components/TreeView/__tests__/TreeViewSearch.test.tsx +12 -1
  305. package/src/components/TreeView/__tests__/__snapshots__/TreeView.test.tsx.snap +9 -0
  306. package/src/components/Truncate/Truncate.tsx +123 -32
  307. package/src/components/Truncate/__tests__/Truncate.test.tsx +75 -5
  308. package/src/components/Truncate/__tests__/__snapshots__/Truncate.test.tsx.snap +55 -15
  309. package/src/components/Truncate/examples/Truncate.md +32 -36
  310. package/src/components/Truncate/examples/TruncateCustomTooltipPosition.tsx +10 -0
  311. package/src/components/Truncate/examples/TruncateDefault.tsx +7 -0
  312. package/src/components/Truncate/examples/TruncateMaxChars.tsx +27 -0
  313. package/src/components/Truncate/examples/TruncateMiddle.tsx +11 -0
  314. package/src/components/Truncate/examples/TruncateStart.tsx +7 -0
  315. package/src/components/Wizard/WizardNavInternal.tsx +1 -1
  316. package/src/components/Wizard/examples/WizardGetCurrentStep.tsx +1 -1
  317. package/src/demos/Banner.md +6 -6
  318. package/src/demos/CardDemos.md +1 -1
  319. package/src/demos/CardView/examples/CardView.tsx +9 -4
  320. package/src/demos/DataList/examples/DataListActionable.tsx +5 -3
  321. package/src/demos/DataList/examples/DataListBasic.tsx +2 -2
  322. package/src/demos/DataList/examples/DataListExpandableControlInToolbar.tsx +2 -2
  323. package/src/demos/DataList/examples/DataListStaticBottomPagination.tsx +4 -2
  324. package/src/demos/DescriptionList/examples/DescriptionListBasic.tsx +5 -5
  325. package/src/demos/DescriptionList/examples/DescriptionListInDrawer.tsx +6 -4
  326. package/src/demos/JumpLinks.md +5 -5
  327. package/src/demos/NotificationDrawer/examples/NotificationDrawerBasic.tsx +3 -3
  328. package/src/demos/NotificationDrawer/examples/NotificationDrawerGrouped.tsx +3 -3
  329. package/src/demos/PasswordGenerator.md +1 -1
  330. package/src/demos/RTL/examples/PaginatedTable.jsx +2 -2
  331. package/src/demos/RTL/examples/PaginatedTable.tsx +2 -2
  332. package/src/demos/SearchInput/SearchInput.md +2 -0
  333. package/src/demos/Tabs.md +6 -6
  334. package/src/demos/examples/AlertGroup/AlertGroupToastWithNotificationDrawer.tsx +6 -6
  335. package/src/demos/examples/BackToTop/BackToTopNameDemo.tsx +2 -2
  336. package/src/demos/examples/Card/CardAggregateStatus.tsx +2 -6
  337. package/src/demos/examples/Card/CardDetails.tsx +4 -5
  338. package/src/demos/examples/Card/CardEventsView.tsx +3 -4
  339. package/src/demos/examples/Card/CardLogView.tsx +3 -4
  340. package/src/demos/examples/Card/CardStatus.tsx +0 -1
  341. package/src/demos/examples/Card/CardStatusTabbed.tsx +3 -3
  342. package/src/demos/examples/Card/CardUtilizationDemo3.tsx +0 -1
  343. package/src/demos/examples/Masthead/MastheadWithHorizontalNav.tsx +5 -3
  344. package/src/demos/examples/Masthead/MastheadWithUtilitiesAndUserDropdownMenu.tsx +3 -3
  345. package/src/demos/examples/Nav/NavDefault.tsx +3 -3
  346. package/src/demos/examples/Nav/NavDrilldown.tsx +1 -1
  347. package/src/demos/examples/Nav/NavExpandable.tsx +3 -3
  348. package/src/demos/examples/Nav/NavFlyout.tsx +9 -3
  349. package/src/demos/examples/Nav/NavGrouped.tsx +14 -6
  350. package/src/demos/examples/Nav/NavHorizontal.tsx +3 -3
  351. package/src/demos/examples/Nav/NavHorizontalWithSubnav.tsx +5 -5
  352. package/src/demos/examples/Nav/NavManual.tsx +3 -3
  353. package/src/demos/examples/Nav/NavWithSubnav.tsx +5 -5
  354. package/src/demos/examples/Page/PageContextSelector.tsx +5 -3
  355. package/src/demos/examples/Page/PageStickySectionBreadcrumb.tsx +3 -3
  356. package/src/demos/examples/Page/PageStickySectionGroup.tsx +3 -3
  357. package/src/demos/examples/Page/PageStickySectionGroupAlternate.tsx +3 -3
  358. package/src/demos/examples/PrimaryDetail/PrimaryDetailCardView.tsx +5 -4
  359. package/src/demos/examples/PrimaryDetail/PrimaryDetailContentPadding.tsx +3 -3
  360. package/src/demos/examples/PrimaryDetail/PrimaryDetailDataListInCard.tsx +3 -3
  361. package/src/demos/examples/PrimaryDetail/PrimaryDetailFullPage.tsx +3 -3
  362. package/src/demos/examples/PrimaryDetail/PrimaryDetailInlineModifier.tsx +3 -3
  363. package/src/demos/examples/PrimaryDetail/PrimaryDetailSimpleListInCard.tsx +3 -3
  364. package/src/demos/examples/Skeleton/SkeletonCard.tsx +5 -3
  365. package/src/demos/examples/Tabs/ModalTabs.tsx +3 -3
  366. package/src/demos/examples/Tabs/NestedTabs.tsx +2 -2
  367. package/src/demos/examples/Tabs/NestedUnindentedTabs.tsx +2 -2
  368. package/src/demos/examples/Tabs/TabsAndTable.tsx +3 -3
  369. package/src/demos/examples/Toolbar/ConsoleLogViewerToolbar.tsx +1 -1
  370. package/src/demos/examples/Wizard/InModal.tsx +1 -1
  371. package/src/demos/examples/Wizard/InPage.tsx +1 -1
  372. package/src/demos/examples/Wizard/InPageWithDrawer.tsx +3 -3
  373. package/src/demos/examples/Wizard/InPageWithDrawerInformationalStep.tsx +3 -3
  374. package/src/components/List/__tests__/Generated/ListItem.test.tsx +0 -12
  375. package/src/components/List/__tests__/Generated/__snapshots__/ListItem.test.tsx.snap +0 -13
@@ -32,6 +32,15 @@ exports[`Matches snapshot 1`] = `
32
32
  <p>
33
33
  TreeViewList toolbar: undefined
34
34
  </p>
35
+ <p>
36
+ TreeViewList aria-label: undefined
37
+ </p>
38
+ <p>
39
+ TreeViewList aria-labelledBy: undefined
40
+ </p>
41
+ <p>
42
+ TreeViewList isMultiSelectable: false
43
+ </p>
35
44
  <div
36
45
  data-testid="TreeViewList-children"
37
46
  >
@@ -22,8 +22,18 @@ export interface TruncateProps extends React.HTMLProps<HTMLSpanElement> {
22
22
  className?: string;
23
23
  /** Text to truncate */
24
24
  content: string;
25
- /** The number of characters displayed in the second half of the truncation */
25
+ /** The number of characters displayed in the second half of a middle truncation. This will be overridden by
26
+ * the maxCharsDisplayed prop.
27
+ */
26
28
  trailingNumChars?: number;
29
+ /** The maximum number of characters to display before truncating. This will always truncate content
30
+ * when its length exceeds the value passed to this prop, and container width/resizing will not affect truncation.
31
+ */
32
+ maxCharsDisplayed?: number;
33
+ /** The content to use to signify omission of characters when using the maxCharsDisplayed prop.
34
+ * By default this will render an ellipsis.
35
+ */
36
+ omissionContent?: string;
27
37
  /** Where the text will be truncated */
28
38
  position?: 'start' | 'middle' | 'end';
29
39
  /** Tooltip position */
@@ -49,13 +59,15 @@ export interface TruncateProps extends React.HTMLProps<HTMLSpanElement> {
49
59
  refToGetParent?: React.RefObject<any>;
50
60
  }
51
61
 
52
- const sliceContent = (str: string, slice: number) => [str.slice(0, str.length - slice), str.slice(-slice)];
62
+ const sliceTrailingContent = (str: string, slice: number) => [str.slice(0, str.length - slice), str.slice(-slice)];
53
63
 
54
64
  export const Truncate: React.FunctionComponent<TruncateProps> = ({
55
65
  className,
56
66
  position = 'end',
57
67
  tooltipPosition = 'top',
58
68
  trailingNumChars = 7,
69
+ maxCharsDisplayed,
70
+ omissionContent = '\u2026',
59
71
  content,
60
72
  refToGetParent,
61
73
  ...props
@@ -63,11 +75,17 @@ export const Truncate: React.FunctionComponent<TruncateProps> = ({
63
75
  const [isTruncated, setIsTruncated] = useState(true);
64
76
  const [parentElement, setParentElement] = useState<HTMLElement>(null);
65
77
  const [textElement, setTextElement] = useState<HTMLElement>(null);
78
+ const [shouldRenderByMaxChars, setShouldRenderByMaxChars] = useState(maxCharsDisplayed > 0);
66
79
 
67
80
  const textRef = useRef<HTMLElement>(null);
68
81
  const subParentRef = useRef<HTMLDivElement>(null);
69
82
  const observer = useRef(null);
70
83
 
84
+ if (maxCharsDisplayed <= 0) {
85
+ // eslint-disable-next-line no-console
86
+ console.warn('Truncate: the maxCharsDisplayed must be greater than 0, otherwise no content will be visible.');
87
+ }
88
+
71
89
  const getActualWidth = (element: Element) => {
72
90
  const computedStyle = getComputedStyle(element);
73
91
 
@@ -91,16 +109,13 @@ export const Truncate: React.FunctionComponent<TruncateProps> = ({
91
109
  setTextElement(textRef.current);
92
110
  }
93
111
 
94
- if (
95
- (refToGetParent?.current || (subParentRef?.current && subParentRef.current.parentElement.parentElement)) &&
96
- !parentElement
97
- ) {
98
- setParentElement(refToGetParent?.current.parentElement || subParentRef?.current.parentElement.parentElement);
112
+ if ((refToGetParent?.current || (subParentRef?.current && subParentRef.current.parentElement)) && !parentElement) {
113
+ setParentElement(refToGetParent?.current.parentElement || subParentRef?.current.parentElement);
99
114
  }
100
115
  }, [textRef, subParentRef, textElement, parentElement]);
101
116
 
102
117
  useEffect(() => {
103
- if (textElement && parentElement && !observer.current) {
118
+ if (textElement && parentElement && !observer.current && !shouldRenderByMaxChars) {
104
119
  const totalTextWidth = calculateTotalTextWidth(textElement, trailingNumChars, content);
105
120
  const textWidth = position === 'middle' ? totalTextWidth : textElement.scrollWidth;
106
121
 
@@ -115,40 +130,116 @@ export const Truncate: React.FunctionComponent<TruncateProps> = ({
115
130
  observer();
116
131
  };
117
132
  }
118
- }, [textElement, parentElement, trailingNumChars, content, position]);
133
+ }, [textElement, parentElement, trailingNumChars, content, position, shouldRenderByMaxChars]);
119
134
 
120
- const truncateBody = (
121
- <span ref={subParentRef} className={css(styles.truncate, className)} {...props}>
122
- {(position === TruncatePosition.end || position === TruncatePosition.start) && (
123
- <span ref={textRef} className={truncateStyles[position]}>
124
- {content}
125
- {position === TruncatePosition.start && <Fragment>&lrm;</Fragment>}
126
- </span>
127
- )}
128
- {position === TruncatePosition.middle && content.length - trailingNumChars > minWidthCharacters && (
129
- <Fragment>
130
- <span ref={textRef} className={styles.truncateStart}>
131
- {sliceContent(content, trailingNumChars)[0]}
135
+ useEffect(() => {
136
+ if (shouldRenderByMaxChars) {
137
+ setIsTruncated(content.length > maxCharsDisplayed);
138
+ }
139
+ }, [shouldRenderByMaxChars]);
140
+
141
+ useEffect(() => {
142
+ setShouldRenderByMaxChars(maxCharsDisplayed > 0);
143
+ }, [maxCharsDisplayed]);
144
+
145
+ const lrmEntity = <Fragment>&lrm;</Fragment>;
146
+ const isStartPosition = position === TruncatePosition.start;
147
+ const isEndPosition = position === TruncatePosition.end;
148
+
149
+ const renderResizeObserverContent = () => {
150
+ if (isEndPosition || isStartPosition) {
151
+ return (
152
+ <>
153
+ <span ref={textRef} className={truncateStyles[position]}>
154
+ {isStartPosition && lrmEntity}
155
+ {content}
156
+ {isStartPosition && lrmEntity}
132
157
  </span>
133
- <span className={styles.truncateEnd}>{sliceContent(content, trailingNumChars)[1]}</span>
134
- </Fragment>
135
- )}
136
- {position === TruncatePosition.middle && content.length - trailingNumChars <= minWidthCharacters && (
158
+ </>
159
+ );
160
+ }
161
+
162
+ const shouldSliceContent = content.length - trailingNumChars > minWidthCharacters;
163
+ return (
164
+ <>
137
165
  <Fragment>
138
166
  <span ref={textRef} className={styles.truncateStart}>
139
- {content}
167
+ {shouldSliceContent ? sliceTrailingContent(content, trailingNumChars)[0] : content}
140
168
  </span>
169
+ {shouldSliceContent && (
170
+ <span className={styles.truncateEnd}>{sliceTrailingContent(content, trailingNumChars)[1]}</span>
171
+ )}
141
172
  </Fragment>
142
- )}
173
+ </>
174
+ );
175
+ };
176
+
177
+ const renderMaxDisplayContent = () => {
178
+ const renderVisibleContent = (contentToRender: string) => (
179
+ <span className={`${styles.truncate}__text`}>{contentToRender}</span>
180
+ );
181
+ if (!isTruncated) {
182
+ return renderVisibleContent(content);
183
+ }
184
+
185
+ const omissionElement = (
186
+ <span className={`${styles.truncate}__omission`} aria-hidden="true">
187
+ {omissionContent}
188
+ </span>
189
+ );
190
+ const renderVisuallyHiddenContent = (contentToHide: string) => (
191
+ <span className="pf-v6-screen-reader">{contentToHide}</span>
192
+ );
193
+
194
+ if (position === TruncatePosition.start) {
195
+ return (
196
+ <>
197
+ {renderVisuallyHiddenContent(content.slice(0, maxCharsDisplayed * -1))}
198
+ {omissionElement}
199
+ {renderVisibleContent(content.slice(maxCharsDisplayed * -1))}
200
+ </>
201
+ );
202
+ }
203
+ if (isEndPosition) {
204
+ return (
205
+ <>
206
+ {renderVisibleContent(content.slice(0, maxCharsDisplayed))}
207
+ {omissionElement}
208
+ {renderVisuallyHiddenContent(content.slice(maxCharsDisplayed))}
209
+ </>
210
+ );
211
+ }
212
+
213
+ const trueMiddleStart = Math.floor(maxCharsDisplayed / 2);
214
+ const trueMiddleEnd = Math.ceil(maxCharsDisplayed / 2) * -1;
215
+ return (
216
+ <>
217
+ {renderVisibleContent(content.slice(0, trueMiddleStart))}
218
+ {omissionElement}
219
+ {renderVisuallyHiddenContent(content.slice(trueMiddleStart, trueMiddleEnd))}
220
+ {renderVisibleContent(content.slice(trueMiddleEnd))}
221
+ </>
222
+ );
223
+ };
224
+
225
+ const truncateBody = (
226
+ <span
227
+ ref={subParentRef}
228
+ className={css(styles.truncate, shouldRenderByMaxChars && styles.modifiers.fixed, className)}
229
+ {...(isTruncated && { tabIndex: 0 })}
230
+ {...props}
231
+ >
232
+ {!shouldRenderByMaxChars ? renderResizeObserverContent() : renderMaxDisplayContent()}
143
233
  </span>
144
234
  );
145
235
 
146
- return isTruncated ? (
147
- <Tooltip hidden={!isTruncated} position={tooltipPosition} content={content}>
236
+ return (
237
+ <>
238
+ {isTruncated && (
239
+ <Tooltip hidden={!isTruncated} position={tooltipPosition} content={content} triggerRef={subParentRef} />
240
+ )}
148
241
  {truncateBody}
149
- </Tooltip>
150
- ) : (
151
- truncateBody
242
+ </>
152
243
  );
153
244
  };
154
245
 
@@ -1,10 +1,10 @@
1
- import { render, screen } from '@testing-library/react';
2
- import { Truncate } from '../Truncate';
1
+ import { render, screen, within } from '@testing-library/react';
2
+ import { Truncate, TruncatePosition } from '../Truncate';
3
3
  import styles from '@patternfly/react-styles/css/components/Truncate/truncate';
4
4
  import '@testing-library/jest-dom';
5
5
 
6
6
  jest.mock('../../Tooltip', () => ({
7
- Tooltip: ({ content, position, children, ...props }) => (
7
+ Tooltip: ({ content, position, children, triggerRef, ...props }) => (
8
8
  <div data-testid="Tooltip-mock" {...props}>
9
9
  <div data-testid="Tooltip-mock-content-container">Test {content}</div>
10
10
  <p>{`position: ${position}`}</p>
@@ -24,7 +24,7 @@ test(`renders with class ${styles.truncate}`, () => {
24
24
 
25
25
  const test = screen.getByLabelText('test-id');
26
26
 
27
- expect(test).toHaveClass(styles.truncate);
27
+ expect(test).toHaveClass(styles.truncate, { exact: true });
28
28
  });
29
29
 
30
30
  test('renders with custom class name passed via prop', () => {
@@ -67,7 +67,9 @@ test('renders default truncation', () => {
67
67
  expect(asFragment()).toMatchSnapshot();
68
68
  });
69
69
 
70
- test('renders start truncation with &lrm; at end', () => {
70
+ // If this snapshot fails and the output text doesn't seem like it's changed, it most likely
71
+ // is due to the &lrm; HTML entity isn't rendering correctly.
72
+ test('renders start truncation with &lrm; at start and end', () => {
71
73
  const { asFragment } = render(
72
74
  <Truncate
73
75
  content={'Vestibulum interdum risus et enim faucibus, sit amet molestie est accumsan.'}
@@ -148,3 +150,71 @@ test('renders with inherited element props spread to the component', () => {
148
150
 
149
151
  expect(screen.getByTestId('test-id')).toHaveAccessibleName('labelling-id');
150
152
  });
153
+
154
+ describe('Truncation with maxCharsDisplayed', () => {
155
+ test(`Does not render with class ${styles.modifiers.fixed} when maxCharsDisplayed is 0`, () => {
156
+ render(<Truncate maxCharsDisplayed={0} data-testid="truncate-component" content="Test content" />);
157
+
158
+ expect(screen.getByTestId('truncate-component')).not.toHaveClass(styles.modifiers.fixed);
159
+ });
160
+
161
+ test(`Renders with class ${styles.modifiers.fixed} when maxCharsDisplayed is greater than 0`, () => {
162
+ render(<Truncate maxCharsDisplayed={1} data-testid="truncate-component" content="Test content" />);
163
+
164
+ expect(screen.getByTestId('truncate-component')).toHaveClass(styles.modifiers.fixed);
165
+ });
166
+
167
+ test('Renders with hidden truncated content at end by default when maxCharsDisplayed is passed', () => {
168
+ render(<Truncate content="Default end position content truncated" maxCharsDisplayed={6} />);
169
+
170
+ expect(screen.getByText('Defaul')).toHaveClass(`${styles.truncate}__text`, { exact: true });
171
+ expect(screen.getByText('t end position content truncated')).toHaveClass('pf-v6-screen-reader');
172
+ });
173
+
174
+ test('Renders with hidden truncated content at middle position when maxCharsDisplayed is passed and position="middle"', () => {
175
+ render(<Truncate position="middle" content="Middle position contents being truncated" maxCharsDisplayed={10} />);
176
+
177
+ expect(screen.getByText('Middl')).toHaveClass(`${styles.truncate}__text`, { exact: true });
178
+ expect(screen.getByText('e position contents being trun')).toHaveClass('pf-v6-screen-reader');
179
+ expect(screen.getByText('cated')).toHaveClass(`${styles.truncate}__text`, { exact: true });
180
+ });
181
+
182
+ test('Renders with hidden truncated content at start when maxCharsDisplayed is passed and position="start"', () => {
183
+ render(<Truncate position="start" content="Start position content truncated" maxCharsDisplayed={6} />);
184
+
185
+ expect(screen.getByText('Start position content tru')).toHaveClass('pf-v6-screen-reader');
186
+ expect(screen.getByText('ncated')).toHaveClass(`${styles.truncate}__text`, { exact: true });
187
+ });
188
+
189
+ test('Renders full content when maxCharsDisplayed exceeds the length of the content', () => {
190
+ render(<Truncate content="This full content is rendered" maxCharsDisplayed={90} />);
191
+
192
+ expect(screen.getByText('This full content is rendered')).toHaveClass(`${styles.truncate}__text`, { exact: true });
193
+ });
194
+
195
+ test('Renders ellipsis as omission content by default', () => {
196
+ render(<Truncate content="Test truncation content" maxCharsDisplayed={5} />);
197
+
198
+ expect(screen.getByText('\u2026')).toHaveClass(`${styles.truncate}__omission`, { exact: true });
199
+ expect(screen.getByText('\u2026')).toHaveAttribute('aria-hidden', 'true');
200
+ });
201
+
202
+ test('Renders custom omission content when omissionContent is passed', () => {
203
+ render(<Truncate omissionContent="---" content="Test truncation content" maxCharsDisplayed={5} />);
204
+
205
+ expect(screen.getByText('---')).toHaveClass(`${styles.truncate}__omission`, { exact: true });
206
+ expect(screen.getByText('---')).toHaveAttribute('aria-hidden', 'true');
207
+ });
208
+
209
+ test('Does not render omission content when maxCharsDisplayed exceeds the length of the content ', () => {
210
+ render(<Truncate content="Test truncation content" maxCharsDisplayed={99} />);
211
+
212
+ expect(screen.queryByText('\u2026')).not.toBeInTheDocument();
213
+ });
214
+
215
+ test('Matches snapshot with default position', () => {
216
+ const { asFragment } = render(<Truncate content="Test truncation content" maxCharsDisplayed={3} />);
217
+
218
+ expect(asFragment()).toMatchSnapshot();
219
+ });
220
+ });
@@ -1,5 +1,43 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`Truncation with maxCharsDisplayed Matches snapshot with default position 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ data-testid="Tooltip-mock"
7
+ >
8
+ <div
9
+ data-testid="Tooltip-mock-content-container"
10
+ >
11
+ Test Test truncation content
12
+ </div>
13
+ <p>
14
+ position: top
15
+ </p>
16
+ </div>
17
+ <span
18
+ class="pf-v6-c-truncate pf-m-fixed"
19
+ tabindex="0"
20
+ >
21
+ <span
22
+ class="pf-v6-c-truncate__text"
23
+ >
24
+ Tes
25
+ </span>
26
+ <span
27
+ aria-hidden="true"
28
+ class="pf-v6-c-truncate__omission"
29
+ >
30
+
31
+ </span>
32
+ <span
33
+ class="pf-v6-screen-reader"
34
+ >
35
+ t truncation content
36
+ </span>
37
+ </span>
38
+ </DocumentFragment>
39
+ `;
40
+
3
41
  exports[`renders default truncation 1`] = `
4
42
  <DocumentFragment>
5
43
  <div
@@ -13,20 +51,21 @@ exports[`renders default truncation 1`] = `
13
51
  <p>
14
52
  position: top
15
53
  </p>
54
+ </div>
55
+ <span
56
+ class="pf-v6-c-truncate"
57
+ tabindex="0"
58
+ >
16
59
  <span
17
- class="pf-v6-c-truncate"
60
+ class="pf-v6-c-truncate__start"
18
61
  >
19
- <span
20
- class="pf-v6-c-truncate__start"
21
- >
22
- Vestibulum interdum risus et enim faucibus, sit amet molestie est accumsan.
23
- </span>
62
+ Vestibulum interdum risus et enim faucibus, sit amet molestie est accumsan.
24
63
  </span>
25
- </div>
64
+ </span>
26
65
  </DocumentFragment>
27
66
  `;
28
67
 
29
- exports[`renders start truncation with &lrm; at end 1`] = `
68
+ exports[`renders start truncation with &lrm; at start and end 1`] = `
30
69
  <DocumentFragment>
31
70
  <div
32
71
  data-testid="Tooltip-mock"
@@ -39,15 +78,16 @@ exports[`renders start truncation with &lrm; at end 1`] = `
39
78
  <p>
40
79
  position: top
41
80
  </p>
81
+ </div>
82
+ <span
83
+ class="pf-v6-c-truncate"
84
+ tabindex="0"
85
+ >
42
86
  <span
43
- class="pf-v6-c-truncate"
87
+ class="pf-v6-c-truncate__end"
44
88
  >
45
- <span
46
- class="pf-v6-c-truncate__end"
47
- >
48
- Vestibulum interdum risus et enim faucibus, sit amet molestie est accumsan.‎
49
- </span>
89
+ ‎Vestibulum interdum risus et enim faucibus, sit amet molestie est accumsan.‎
50
90
  </span>
51
- </div>
91
+ </span>
52
92
  </DocumentFragment>
53
93
  `;
@@ -9,50 +9,46 @@ import './TruncateExamples.css';
9
9
 
10
10
  ## Examples
11
11
 
12
+ The default behavior of the `Truncate` component is to truncate based on whether the content can fit within the width of its parent container, and to prevent text from wrapping. The following examples that use this default behavior render the `<Truncate>` component inside a resizable container, allowing you to see how the parent container width affects the truncation.
13
+
12
14
  ### Default
13
- ```js
14
- import { Truncate } from '@patternfly/react-core';
15
-
16
- <div className="truncate-example-resize">
17
- <Truncate
18
- content={'Vestibulum interdum risus et enim faucibus, sit amet molestie est accumsan.'}
19
- />
20
- </div>
15
+
16
+ By default content will be truncated at its end when it cannot fit entirely inside its parent container.
17
+
18
+ ```ts file="./TruncateDefault.tsx"
19
+
21
20
  ```
22
21
 
23
22
  ### Middle
24
- ```js
25
- import { Truncate } from '@patternfly/react-core';
26
-
27
- <div className="truncate-example-resize">
28
- <Truncate
29
- content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'}
30
- trailingNumChars={10}
31
- position={'middle'}
32
- />
33
- </div>
23
+
24
+ When passing a `position` property with a value of "middle", the position of the truncation will change based on the parent container's width and the amount of `trailingNumChars` passed in. The `trailingNumChars` will always be displayed, while the rest of the content will be truncated based on the parent container width.
25
+
26
+ ```ts file="./TruncateMiddle.tsx"
27
+
34
28
  ```
35
29
 
36
30
  ### Start
37
- ```js
38
- import { Truncate } from '@patternfly/react-core';
39
-
40
- <div className="truncate-example-resize">
41
- <Truncate
42
- content={'Vestibulum interdum risus et enim faucibus, sit amet molestie est accumsan.'}
43
- position={'start'}
44
- />
45
- </div>
31
+
32
+ You can truncate content at its start by passing the `position` property with a value of "start". This can be useful if you have several strings to truncate that have similar text at the start, but unique text at the end that you want to have visible.
33
+
34
+ ```ts file="./TruncateStart.tsx"
35
+
46
36
  ```
47
37
 
48
- ### Default with tooltip at the bottom
49
- ```js
50
- import { Truncate } from '@patternfly/react-core';
38
+ ### With custom tooltip position
39
+
40
+ You can customize the position of the `<Tooltip>` that is rendered by passing in the `tooltipPosition` property. The following example overrides the default "top" position with a "bottom" position.
41
+
42
+ ```ts file="./TruncateCustomTooltipPosition.tsx"
43
+
44
+ ```
45
+
46
+ ### Based on max characters
47
+
48
+ Rather than observing container width, you can have truncation be based on a maximum amount of characters that should always be displayed via the `maxCharsDisplayed` property. While the content's parent container width will not have an affect on whether truncation occurs, it will affect whether the content wraps. This property must be set to a value larger than `0`, otherwise the component will fall back to observing container width.
49
+
50
+ Truncating based on a maximum amount of characters will truncate the content at the end by default. When the `position` property is set to "middle", the truncation will split the content as evenly as possible, providing a more "true middle" truncation.
51
+
52
+ ```ts file="./TruncateMaxChars.tsx"
51
53
 
52
- <div className="truncate-example-resize">
53
- <Truncate
54
- content={'Vestibulum interdum risus et enim faucibus, sit amet molestie est accumsan.'}
55
- tooltipPosition={'bottom'}
56
- />
57
- </div>
58
54
  ```
@@ -0,0 +1,10 @@
1
+ import { Truncate } from '@patternfly/react-core';
2
+
3
+ export const TruncateCustomTooltipPosition: React.FunctionComponent = () => (
4
+ <div className="truncate-example-resize">
5
+ <Truncate
6
+ content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'}
7
+ tooltipPosition={'bottom'}
8
+ />
9
+ </div>
10
+ );
@@ -0,0 +1,7 @@
1
+ import { Truncate } from '@patternfly/react-core';
2
+
3
+ export const TruncateDefault: React.FunctionComponent = () => (
4
+ <div className="truncate-example-resize">
5
+ <Truncate content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'} />
6
+ </div>
7
+ );
@@ -0,0 +1,27 @@
1
+ import { Truncate, TruncatePosition } from '@patternfly/react-core';
2
+
3
+ export const TruncateMaxChars: React.FunctionComponent = () => (
4
+ <>
5
+ <div>Truncated at end position:</div>
6
+ <Truncate
7
+ maxCharsDisplayed={15}
8
+ content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'}
9
+ />
10
+ <br />
11
+ <br />
12
+ <div>Truncated at middle position:</div>
13
+ <Truncate
14
+ maxCharsDisplayed={15}
15
+ position={TruncatePosition.middle}
16
+ content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'}
17
+ />
18
+ <br />
19
+ <br />
20
+ <div>Truncated at start position:</div>
21
+ <Truncate
22
+ maxCharsDisplayed={15}
23
+ position={TruncatePosition.start}
24
+ content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'}
25
+ />
26
+ </>
27
+ );
@@ -0,0 +1,11 @@
1
+ import { Truncate } from '@patternfly/react-core';
2
+
3
+ export const TruncateMiddle: React.FunctionComponent = () => (
4
+ <div className="truncate-example-resize">
5
+ <Truncate
6
+ content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'}
7
+ trailingNumChars={10}
8
+ position={'middle'}
9
+ />
10
+ </div>
11
+ );
@@ -0,0 +1,7 @@
1
+ import { Truncate } from '@patternfly/react-core';
2
+
3
+ export const TruncateStart: React.FunctionComponent = () => (
4
+ <div className="truncate-example-resize">
5
+ <Truncate content={'redhat_logo_black_and_white_reversed_simple_with_fedora_container.zip'} position={'start'} />
6
+ </div>
7
+ );
@@ -96,7 +96,7 @@ export const WizardNavInternal = ({
96
96
  }
97
97
  });
98
98
  const hasEnabledChildren = Children.toArray(subNavItems).some(
99
- (child) => isValidElement(child) && !child.props.isDisabled
99
+ (child) => isValidElement(child) && !(child.props as any).isDisabled
100
100
  );
101
101
 
102
102
  if (!isProgressive || (isProgressive && step.index <= activeStep.index)) {
@@ -10,7 +10,7 @@ import {
10
10
  } from '@patternfly/react-core';
11
11
 
12
12
  const CurrentStepDescriptionList = ({ currentStep }: { currentStep: WizardStepType | undefined }) => (
13
- <DescriptionList isHorizontal isCompact>
13
+ <DescriptionList isHorizontal isCompact aria-label={`${currentStep?.name} prop data`}>
14
14
  <DescriptionListGroup>
15
15
  <DescriptionListTerm>Index</DescriptionListTerm>
16
16
  <DescriptionListDescription>{currentStep?.index}</DescriptionListDescription>
@@ -39,16 +39,16 @@ class BannerDemo extends React.Component {
39
39
  return (
40
40
  <Fragment>
41
41
  <DashboardWrapper banner={banner} breadcrumb={null}>
42
- <PageSection>
42
+ <PageSection aria-labelledby="main-title">
43
43
  <Content>
44
- <h1>Main title</h1>
44
+ <h1 id="main-title">Main title</h1>
45
45
  <p>
46
46
  Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because <br />
47
47
  of it’s relative line height of 1.5.
48
48
  </p>
49
49
  </Content>
50
50
  </PageSection>
51
- <PageSection>
51
+ <PageSection aria-label='Cards gallery'>
52
52
  <Gallery hasGutter>
53
53
  {Array.from({ length: 30 }).map((_value, index) => (
54
54
  <GalleryItem key={index}>
@@ -112,9 +112,9 @@ class BannerDemo extends React.Component {
112
112
  </FlexItem>
113
113
  <FlexItem grow={{ default: 'grow' }} style={{ minHeight: 0 }}>
114
114
  <DashboardWrapper breadcrumb={null}>
115
- <PageSection>
115
+ <PageSection aria-labelledby="main-title">
116
116
  <Content>
117
- <h1>Main title</h1>
117
+ <h1 id='main-title'>Main title</h1>
118
118
  <p>
119
119
  Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because{' '}
120
120
  <br />
@@ -122,7 +122,7 @@ class BannerDemo extends React.Component {
122
122
  </p>
123
123
  </Content>
124
124
  </PageSection>
125
- <PageSection>
125
+ <PageSection aria-label='Cards gallery'>
126
126
  <Gallery hasGutter>
127
127
  {Array.from({ length: 30 }).map((_value, index) => (
128
128
  <GalleryItem key={index}>
@@ -14,7 +14,7 @@ import chart_color_yellow_100 from '@patternfly/react-tokens/dist/esm/chart_colo
14
14
  import chart_color_yellow_300 from '@patternfly/react-tokens/dist/esm/chart_color_yellow_300';
15
15
  import chart_color_orange_300 from '@patternfly/react-tokens/dist/esm/chart_color_orange_300';
16
16
  import chart_color_red_orange_400 from '@patternfly/react-tokens/dist/esm/chart_color_red_orange_400';
17
- import l_gallery_GridTemplateColumns_min from '@patternfly/react-tokens/dist/esm/l_gallery_GridTemplateColumns_min';
17
+ import cssGridTemplateColumnsMin from '@patternfly/react-tokens/dist/esm/l_gallery_GridTemplateColumns_min';
18
18
  import t_global_text_color_subtle from '@patternfly/react-tokens/dist/esm/t_global_text_color_subtle';
19
19
  import flex from '@patternfly/react-styles/css/utilities/Flex/flex';
20
20
  import text from '@patternfly/react-styles/css/utilities/Text/text';