@patternfly/react-core 6.4.0 → 6.4.1-prerelease.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/CHANGELOG.md +16 -0
  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/AnimationsProvider/AnimationsProvider/package.json +1 -1
  91. package/dist/dynamic/helpers/AnimationsProvider/package.json +1 -1
  92. package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
  93. package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
  94. package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
  95. package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
  96. package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
  97. package/dist/dynamic/helpers/constants/package.json +1 -1
  98. package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
  99. package/dist/dynamic/helpers/fileUtils/package.json +1 -1
  100. package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
  101. package/dist/dynamic/helpers/package.json +1 -1
  102. package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
  103. package/dist/dynamic/helpers/typeUtils/package.json +1 -1
  104. package/dist/dynamic/helpers/useInterval/package.json +1 -1
  105. package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
  106. package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
  107. package/dist/dynamic/helpers/util/package.json +1 -1
  108. package/dist/dynamic/layouts/Bullseye/package.json +1 -1
  109. package/dist/dynamic/layouts/Flex/package.json +1 -1
  110. package/dist/dynamic/layouts/Gallery/package.json +1 -1
  111. package/dist/dynamic/layouts/Grid/package.json +1 -1
  112. package/dist/dynamic/layouts/Level/package.json +1 -1
  113. package/dist/dynamic/layouts/Split/package.json +1 -1
  114. package/dist/dynamic/layouts/Stack/package.json +1 -1
  115. package/dist/dynamic/styles/package.json +1 -1
  116. package/dist/esm/components/Checkbox/Checkbox.d.ts +3 -0
  117. package/dist/esm/components/Checkbox/Checkbox.d.ts.map +1 -1
  118. package/dist/esm/components/Checkbox/Checkbox.js +14 -4
  119. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  120. package/dist/esm/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
  121. package/dist/esm/components/Drawer/DrawerPanelContent.js +2 -4
  122. package/dist/esm/components/Drawer/DrawerPanelContent.js.map +1 -1
  123. package/dist/esm/components/Modal/Modal.d.ts +2 -0
  124. package/dist/esm/components/Modal/Modal.d.ts.map +1 -1
  125. package/dist/esm/components/Modal/Modal.js.map +1 -1
  126. package/dist/esm/components/Modal/ModalContent.d.ts +2 -0
  127. package/dist/esm/components/Modal/ModalContent.d.ts.map +1 -1
  128. package/dist/esm/components/Modal/ModalContent.js +2 -2
  129. package/dist/esm/components/Modal/ModalContent.js.map +1 -1
  130. package/dist/esm/components/Progress/ProgressContainer.js +2 -2
  131. package/dist/esm/components/Progress/ProgressContainer.js.map +1 -1
  132. package/dist/esm/components/Radio/Radio.d.ts +3 -0
  133. package/dist/esm/components/Radio/Radio.d.ts.map +1 -1
  134. package/dist/esm/components/Radio/Radio.js +15 -5
  135. package/dist/esm/components/Radio/Radio.js.map +1 -1
  136. package/dist/esm/components/Wizard/WizardNavItem.d.ts +1 -1
  137. package/dist/esm/components/Wizard/WizardNavItem.d.ts.map +1 -1
  138. package/dist/esm/components/Wizard/WizardNavItem.js +2 -1
  139. package/dist/esm/components/Wizard/WizardNavItem.js.map +1 -1
  140. package/dist/esm/components/Wizard/WizardStep.d.ts +1 -1
  141. package/dist/esm/components/Wizard/WizardStep.d.ts.map +1 -1
  142. package/dist/esm/components/Wizard/types.d.ts +3 -2
  143. package/dist/esm/components/Wizard/types.d.ts.map +1 -1
  144. package/dist/esm/components/Wizard/types.js +1 -0
  145. package/dist/esm/components/Wizard/types.js.map +1 -1
  146. package/dist/esm/helpers/FocusTrap/FocusTrap.d.ts +2 -0
  147. package/dist/esm/helpers/FocusTrap/FocusTrap.d.ts.map +1 -1
  148. package/dist/esm/helpers/FocusTrap/FocusTrap.js.map +1 -1
  149. package/dist/js/components/Checkbox/Checkbox.d.ts +3 -0
  150. package/dist/js/components/Checkbox/Checkbox.d.ts.map +1 -1
  151. package/dist/js/components/Checkbox/Checkbox.js +14 -4
  152. package/dist/js/components/Checkbox/Checkbox.js.map +1 -1
  153. package/dist/js/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
  154. package/dist/js/components/Drawer/DrawerPanelContent.js +2 -4
  155. package/dist/js/components/Drawer/DrawerPanelContent.js.map +1 -1
  156. package/dist/js/components/Modal/Modal.d.ts +2 -0
  157. package/dist/js/components/Modal/Modal.d.ts.map +1 -1
  158. package/dist/js/components/Modal/Modal.js.map +1 -1
  159. package/dist/js/components/Modal/ModalContent.d.ts +2 -0
  160. package/dist/js/components/Modal/ModalContent.d.ts.map +1 -1
  161. package/dist/js/components/Modal/ModalContent.js +2 -2
  162. package/dist/js/components/Modal/ModalContent.js.map +1 -1
  163. package/dist/js/components/Progress/ProgressContainer.js +2 -2
  164. package/dist/js/components/Progress/ProgressContainer.js.map +1 -1
  165. package/dist/js/components/Radio/Radio.d.ts +3 -0
  166. package/dist/js/components/Radio/Radio.d.ts.map +1 -1
  167. package/dist/js/components/Radio/Radio.js +15 -5
  168. package/dist/js/components/Radio/Radio.js.map +1 -1
  169. package/dist/js/components/Wizard/WizardNavItem.d.ts +1 -1
  170. package/dist/js/components/Wizard/WizardNavItem.d.ts.map +1 -1
  171. package/dist/js/components/Wizard/WizardNavItem.js +2 -1
  172. package/dist/js/components/Wizard/WizardNavItem.js.map +1 -1
  173. package/dist/js/components/Wizard/WizardStep.d.ts +1 -1
  174. package/dist/js/components/Wizard/WizardStep.d.ts.map +1 -1
  175. package/dist/js/components/Wizard/types.d.ts +3 -2
  176. package/dist/js/components/Wizard/types.d.ts.map +1 -1
  177. package/dist/js/components/Wizard/types.js +1 -0
  178. package/dist/js/components/Wizard/types.js.map +1 -1
  179. package/dist/js/helpers/FocusTrap/FocusTrap.d.ts +2 -0
  180. package/dist/js/helpers/FocusTrap/FocusTrap.d.ts.map +1 -1
  181. package/dist/js/helpers/FocusTrap/FocusTrap.js.map +1 -1
  182. package/dist/umd/assets/{output-DH8J4Va1.css → output-POOr9zB4.css} +20855 -20855
  183. package/dist/umd/react-core.min.js +1 -1
  184. package/helpers/package.json +1 -1
  185. package/layouts/package.json +1 -1
  186. package/next/package.json +1 -1
  187. package/package.json +2 -2
  188. package/src/components/Checkbox/Checkbox.tsx +21 -2
  189. package/src/components/Checkbox/__tests__/Checkbox.test.tsx +34 -0
  190. package/src/components/Drawer/DrawerPanelContent.tsx +5 -3
  191. package/src/components/Drawer/__tests__/DrawerPanelContent.test.tsx +37 -0
  192. package/src/components/Modal/Modal.tsx +2 -0
  193. package/src/components/Modal/ModalContent.tsx +4 -0
  194. package/src/components/Modal/__tests__/Modal.test.tsx +9 -0
  195. package/src/components/Modal/__tests__/ModalContent.test.tsx +17 -1
  196. package/src/components/Modal/examples/Modal.md +14 -5
  197. package/src/components/Modal/examples/ModalWithDropdown.tsx +34 -7
  198. package/src/components/Progress/ProgressContainer.tsx +2 -2
  199. package/src/components/Progress/__tests__/Generated/__snapshots__/ProgressContainer.test.tsx.snap +1 -1
  200. package/src/components/Progress/__tests__/__snapshots__/Progress.test.tsx.snap +1 -1
  201. package/src/components/Radio/Radio.tsx +21 -3
  202. package/src/components/Radio/__tests__/Radio.test.tsx +44 -0
  203. package/src/components/Tabs/__tests__/Tabs.test.tsx +109 -1
  204. package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +2 -2
  205. package/src/components/Tabs/examples/Tabs.md +38 -4
  206. package/src/components/Tabs/examples/TabsSeparateContent.tsx +3 -2
  207. package/src/components/Wizard/WizardNavItem.tsx +5 -2
  208. package/src/components/Wizard/WizardStep.tsx +1 -1
  209. package/src/components/Wizard/__tests__/WizardNavItem.test.tsx +6 -0
  210. package/src/components/Wizard/__tests__/WizardStep.test.tsx +2 -0
  211. package/src/components/Wizard/examples/WizardStepStatus.tsx +28 -7
  212. package/src/components/Wizard/types.tsx +3 -2
  213. package/src/demos/SearchInput/SearchInput.md +2 -487
  214. package/src/demos/SearchInput/examples/SearchInputAdvancedComposable.tsx +322 -0
  215. package/src/demos/SearchInput/examples/SearchInputAutocomplete.tsx +165 -0
  216. package/src/helpers/FocusTrap/FocusTrap.tsx +2 -0
  217. package/src/helpers/FocusTrap/__tests__/FocusTrap.test.tsx +17 -0
  218. package/src/helpers/FocusTrap/__tests__/Generated/FocusTrap.test.tsx +3 -3
  219. package/src/helpers/OUIA/OUIA.md +2 -10
  220. package/src/helpers/OUIA/examples/OuiaExample.tsx +11 -0
  221. package/src/layouts/Bullseye/examples/Bullseye.md +1 -5
  222. package/src/layouts/Bullseye/examples/BullseyeBasic.tsx +7 -0
  223. package/src/layouts/Flex/examples/Flex.md +17 -209
  224. package/src/layouts/Flex/examples/FlexAdjustingWidth.tsx +18 -0
  225. package/src/layouts/Flex/examples/FlexBasic.tsx +11 -0
  226. package/src/layouts/Flex/examples/FlexCanGrow.tsx +18 -0
  227. package/src/layouts/Flex/examples/FlexColumnGap.tsx +16 -0
  228. package/src/layouts/Flex/examples/FlexColumnLayout.tsx +9 -0
  229. package/src/layouts/Flex/examples/FlexColumnWidths.tsx +18 -0
  230. package/src/layouts/Flex/examples/FlexDefaultLayout.tsx +11 -0
  231. package/src/layouts/Flex/examples/FlexGap.tsx +16 -0
  232. package/src/layouts/Flex/examples/FlexIndividuallySpaced.tsx +14 -0
  233. package/src/layouts/Flex/examples/FlexInline.tsx +11 -0
  234. package/src/layouts/Flex/examples/FlexNestedItems.tsx +15 -0
  235. package/src/layouts/Flex/examples/FlexNesting.tsx +15 -0
  236. package/src/layouts/Flex/examples/FlexNestingInColumns.tsx +15 -0
  237. package/src/layouts/Flex/examples/FlexRowGap.tsx +16 -0
  238. package/src/layouts/Flex/examples/FlexSpacingNone.tsx +11 -0
  239. package/src/layouts/Flex/examples/FlexSpacingXl.tsx +11 -0
  240. package/src/layouts/Flex/examples/FlexStackingElements.tsx +18 -0
  241. package/src/layouts/Level/examples/Level.md +3 -15
  242. package/src/layouts/Level/examples/LevelBasic.tsx +9 -0
  243. package/src/layouts/Level/examples/LevelWithGutters.tsx +9 -0
  244. package/src/layouts/Split/examples/Split.md +4 -34
  245. package/src/layouts/Split/examples/SplitBasic.tsx +9 -0
  246. package/src/layouts/Split/examples/SplitWithGutter.tsx +9 -0
  247. package/src/layouts/Split/examples/SplitWrappable.tsx +20 -0
@@ -1,15 +1,83 @@
1
1
  import { render, screen, act } from '@testing-library/react';
2
2
  import userEvent from '@testing-library/user-event';
3
- import { Tabs } from '../Tabs';
3
+ import { Tabs, TabsProps } from '../Tabs';
4
4
  import styles from '@patternfly/react-styles/css/components/Tabs/tabs';
5
5
  import { Tab } from '../Tab';
6
6
  import { TabTitleText } from '../TabTitleText';
7
7
  import { TabTitleIcon } from '../TabTitleIcon';
8
8
  import { TabContent } from '../TabContent';
9
9
  import { TabContentBody } from '../TabContentBody';
10
+ import { createRef } from 'react';
10
11
 
11
12
  jest.mock('../../../helpers/GenerateId/GenerateId');
12
13
 
14
+ const renderSeparateTabs = (props?: Pick<TabsProps, 'activeKey' | 'defaultActiveKey'>) => {
15
+ const contentRef1 = createRef<HTMLElement>();
16
+ const contentRef2 = createRef<HTMLElement>();
17
+ const contentRef3 = createRef<HTMLElement>();
18
+
19
+ let calculatedActiveKey;
20
+ if (props?.defaultActiveKey) {
21
+ calculatedActiveKey = props?.defaultActiveKey;
22
+ } else {
23
+ calculatedActiveKey = props?.activeKey;
24
+ }
25
+
26
+ return (
27
+ <>
28
+ <Tabs id="separateTabs" {...props}>
29
+ <Tab
30
+ eventKey={0}
31
+ title={<TabTitleText>Tab item 1</TabTitleText>}
32
+ tabContentId="refTab1Section"
33
+ tabContentRef={contentRef1}
34
+ />
35
+ <Tab
36
+ eventKey={1}
37
+ title={<TabTitleText>Tab item 2</TabTitleText>}
38
+ tabContentId="refTab2Section"
39
+ tabContentRef={contentRef2}
40
+ />
41
+ <Tab
42
+ eventKey={2}
43
+ title={<TabTitleText>Tab item 3</TabTitleText>}
44
+ tabContentId="refTab3Section"
45
+ tabContentRef={contentRef3}
46
+ />
47
+ </Tabs>
48
+ <div>
49
+ <TabContent
50
+ eventKey={0}
51
+ id="refTab1Section"
52
+ ref={contentRef1}
53
+ aria-label="Tab item 1"
54
+ hidden={calculatedActiveKey !== 0}
55
+ >
56
+ Tab 1 section
57
+ </TabContent>
58
+ <TabContent
59
+ eventKey={1}
60
+ id="refTab2Section"
61
+ ref={contentRef2}
62
+ aria-label="Tab item 2"
63
+ hidden={calculatedActiveKey !== 1}
64
+ >
65
+ <TabContentBody>Tab 2 section</TabContentBody>
66
+ </TabContent>
67
+ <TabContent
68
+ eventKey={2}
69
+ id="refTab3Section"
70
+ ref={contentRef3}
71
+ aria-label="Tab item 3"
72
+ hidden={calculatedActiveKey !== 2}
73
+ >
74
+ <TabContentBody hasPadding>Tab 3 section with padding </TabContentBody>
75
+ </TabContent>
76
+ </div>
77
+ </>
78
+ );
79
+ };
80
+
13
81
  test(`Renders with classes ${styles.tabs} and ${styles.modifiers.animateCurrent} by default`, () => {
14
82
  render(
15
83
  <Tabs role="region">
@@ -429,6 +497,46 @@ test('should render tabs with separate content', () => {
429
497
  expect(asFragment()).toMatchSnapshot();
430
498
  });
431
499
 
500
+ test('should render correct tab content for uncontrolled tabs with separate content', () => {
501
+ render(renderSeparateTabs({ defaultActiveKey: 1 }));
502
+
503
+ expect(screen.getByText(/Tab 1 section/i)).not.toBeVisible();
504
+ expect(screen.getByText(/Tab 2 section/i)).toBeVisible();
505
+ expect(screen.getByText(/Tab 3 section with padding/i)).not.toBeVisible();
506
+ });
507
+
508
+ test('should correctly advance tab content for uncontrolled tabs with separate content', async () => {
509
+ render(renderSeparateTabs({ defaultActiveKey: 1 }));
510
+
511
+ userEvent.setup();
512
+ expect(screen.getByText(/Tab 1 section/i)).not.toBeVisible();
513
+ expect(screen.getByText(/Tab 2 section/i)).toBeVisible();
514
+ expect(screen.getByText(/Tab 3 section with padding/i)).not.toBeVisible();
515
+ await userEvent.click(screen.getByRole('tab', { name: /Tab item 1/i }));
516
+ expect(screen.getByText(/Tab 1 section/i)).toBeVisible();
517
+ expect(screen.getByText(/Tab 2 section/i)).not.toBeVisible();
518
+ });
519
+
520
+ test('should render correct tab content for controlled tabs with separate content', () => {
521
+ render(renderSeparateTabs({ activeKey: 1 }));
522
+
523
+ expect(screen.getByText(/Tab 1 section/i)).not.toBeVisible();
524
+ expect(screen.getByText(/Tab 2 section/i)).toBeVisible();
525
+ expect(screen.getByText(/Tab 3 section with padding/i)).not.toBeVisible();
526
+ });
527
+
528
+ test('should correctly advance tab content for controlled tabs with separate content', async () => {
529
+ render(renderSeparateTabs({ activeKey: 1 }));
530
+
531
+ userEvent.setup();
532
+ expect(screen.getByText(/Tab 1 section/i)).not.toBeVisible();
533
+ expect(screen.getByText(/Tab 2 section/i)).toBeVisible();
534
+ expect(screen.getByText(/Tab 3 section with padding/i)).not.toBeVisible();
535
+ await userEvent.click(screen.getByRole('tab', { name: /Tab item 1/i }));
536
+ expect(screen.getByText(/Tab 1 section/i)).toBeVisible();
537
+ expect(screen.getByText(/Tab 2 section/i)).not.toBeVisible();
538
+ });
539
+
432
540
  test('should render box tabs of secondary variant', () => {
433
541
  const { asFragment } = render(
434
542
  <Tabs id="boxSecondaryVariantTabs" isBox variant="secondary">
@@ -281,7 +281,7 @@ exports[`should render box tabs of secondary variant 1`] = `
281
281
  <DocumentFragment>
282
282
  <div
283
283
  class="pf-v6-c-tabs pf-m-animate-current pf-m-box pf-m-secondary pf-m-initializing-accent"
284
- data-ouia-component-id="OUIA-Generated-Tabs-20"
284
+ data-ouia-component-id="OUIA-Generated-Tabs-24"
285
285
  data-ouia-component-type="PF6/Tabs"
286
286
  data-ouia-safe="true"
287
287
  id="boxSecondaryVariantTabs"
@@ -1228,7 +1228,7 @@ exports[`should render tabs with no bottom border 1`] = `
1228
1228
  <DocumentFragment>
1229
1229
  <div
1230
1230
  class="pf-v6-c-tabs pf-m-animate-current pf-m-no-border-bottom pf-m-initializing-accent"
1231
- data-ouia-component-id="OUIA-Generated-Tabs-21"
1231
+ data-ouia-component-id="OUIA-Generated-Tabs-25"
1232
1232
  data-ouia-component-type="PF6/Tabs"
1233
1233
  data-ouia-safe="true"
1234
1234
  id="noBottomBorderTabs"
@@ -2,7 +2,18 @@
2
2
  id: Tabs
3
3
  section: components
4
4
  cssPrefix: pf-v6-c-tabs
5
- propComponents: ['Tabs', 'Tab', 'TabContent', 'TabContentBody', 'TabTitleText', 'TabTitleIcon', 'HorizontalOverflowObject', 'TabAction', 'PopperOptions']
5
+ propComponents:
6
+ [
7
+ 'Tabs',
8
+ 'Tab',
9
+ 'TabContent',
10
+ 'TabContentBody',
11
+ 'TabTitleText',
12
+ 'TabTitleIcon',
13
+ 'HorizontalOverflowObject',
14
+ 'TabAction',
15
+ 'PopperOptions'
16
+ ]
6
17
  ouia: true
7
18
  ---
8
19
 
@@ -35,6 +46,7 @@ Tabs can be styled as 'default' or 'boxed':
35
46
  - Boxed tabs are outlined to emphasize the area that a tab spans. To preview boxed tabs in the following examples, select the 'isBox' checkbox, which sets the `isBox` property to true.
36
47
 
37
48
  ```ts file="./TabsDefault.tsx"
49
+
38
50
  ```
39
51
 
40
52
  ### Boxed secondary tabs
@@ -44,6 +56,7 @@ To change the background color of boxed tabs or the tab content, use the `varian
44
56
  Toggle the tab color by selecting the 'Tabs secondary variant' checkbox in the following example.
45
57
 
46
58
  ```ts file="./TabsBoxSecondary.tsx"
59
+
47
60
  ```
48
61
 
49
62
  ### Vertical tabs
@@ -53,6 +66,7 @@ Vertical tabs are placed on the left-hand side of a page or container and may ap
53
66
  To style tabs vertically, use the `isVertical` property.
54
67
 
55
68
  ```ts file="./TabsVertical.tsx"
69
+
56
70
  ```
57
71
 
58
72
  ### Vertical expandable tabs
@@ -64,6 +78,7 @@ Expandable tabs can be enabled at different breakpoints. The following example p
64
78
  To flag vertical tabs when they're expanded, use the `isExpanded` property.
65
79
 
66
80
  ```ts file="./TabsVerticalExpandable.tsx"
81
+
67
82
  ```
68
83
 
69
84
  ### Vertical expandable uncontrolled
@@ -71,6 +86,7 @@ To flag vertical tabs when they're expanded, use the `isExpanded` property.
71
86
  To flag the default expanded state for uncontrolled tabs, use the `defaultIsExpanded` property.
72
87
 
73
88
  ```ts file="./TabsVerticalExpandableUncontrolled.tsx"
89
+
74
90
  ```
75
91
 
76
92
  ### Default overflow tabs
@@ -78,6 +94,7 @@ To flag the default expanded state for uncontrolled tabs, use the `defaultIsExpa
78
94
  By default, overflow is applied when there are too many tabs for the width of the container they are in. This overflow can be navigated by side-scrolling within the tabs section, or by selecting the left and right arrows.
79
95
 
80
96
  ```ts file="./TabsDefaultOverflow.tsx"
97
+
81
98
  ```
82
99
 
83
100
  ### Horizontal overflow tabs
@@ -89,6 +106,7 @@ To enable horizontal overflow, use the `isOverflowHorizontal` property.
89
106
  In the following example, select the 'Show overflowing tab count' checkbox to add a count of overflow items to the final “more” tab.
90
107
 
91
108
  ```ts file="./TabsHorizontalOverflow.tsx"
109
+
92
110
  ```
93
111
 
94
112
  ### With tooltip react ref
@@ -98,14 +116,15 @@ When using a React ref to link a tooltip to a tab component via the `reference`
98
116
  The tooltip should also have the `id` property passed in. The value of `id` should be passed into the tab's `aria-describedby` property. This ensures a tooltip used with a React ref will be announced by the JAWS and NVDA screen readers.
99
117
 
100
118
  ```ts file="./TabsTooltipReactRef.tsx"
119
+
101
120
  ```
102
121
 
103
122
  ### Uncontrolled tabs
104
123
 
105
124
  To allow the `<Tabs>` component to manage setting the active tab and displaying correct content itself, use uncontrolled tabs, as shown in the following example.
106
125
 
107
-
108
126
  ```ts file="./TabsUncontrolled.tsx"
127
+
109
128
  ```
110
129
 
111
130
  ### With adjusted inset
@@ -113,6 +132,7 @@ To allow the `<Tabs>` component to manage setting the active tab and displaying
113
132
  To adjust the inset of tabs and visually separate them more, use the `inset` property. You can set the inset to "insetNone", "insetSm", "insetMd", "insetLg", "insetXl", or "inset2xl" at "default", "sm", "md", "lg, "xl, and "2xl" breakpoints.
114
133
 
115
134
  ```ts file="./TabsInset.tsx"
135
+
116
136
  ```
117
137
 
118
138
  ### With page insets
@@ -120,6 +140,7 @@ To adjust the inset of tabs and visually separate them more, use the `inset` pro
120
140
  To adjust the left padding of tabs, use the `usePageInsets` property. This property aligns the tabs padding with the default padding of the page section, which makes it easier to align tabs with page section content.
121
141
 
122
142
  ```ts file="./TabsPageInsets.tsx"
143
+
123
144
  ```
124
145
 
125
146
  ### With icons and text
@@ -129,6 +150,7 @@ You can render different content in the `title` property of a tab to add icons a
129
150
  To add an icon to a tab, pass a `<TabTitleIcon>` component that contains the icon of your choice into the `title`. To use an icon alongside styled text, keep the text in the `<TabTitleText>` component.
130
151
 
131
152
  ```ts file="./TabsIconAndText.tsx"
153
+
132
154
  ```
133
155
 
134
156
  ### Subtabs
@@ -138,6 +160,7 @@ Use subtabs within other components, like modals. Subtabs have less visually pro
138
160
  To apply subtab styling to tabs, use the `isSubtab` property.
139
161
 
140
162
  ```ts file="./TabsSubtabs.tsx"
163
+
141
164
  ```
142
165
 
143
166
  ### Filled tabs with icons
@@ -145,6 +168,7 @@ To apply subtab styling to tabs, use the `isSubtab` property.
145
168
  To allow tabs to fill the available width of the page section, use the `isFilled` property.
146
169
 
147
170
  ```ts file="./TabsFilledWithIcons.tsx"
171
+
148
172
  ```
149
173
 
150
174
  ### Tabs linked to nav elements
@@ -154,6 +178,7 @@ To let tabs link to nav elements, pass `{TabsComponent.nav}` into the `component
154
178
  Nav tabs should use the `href` property to link the tab to the URL of another page or page section. A tab with an `href` will render as an `<a>` instead of a `<button>`.
155
179
 
156
180
  ```ts file="./TabsNav.tsx"
181
+
157
182
  ```
158
183
 
159
184
  ### Subtabs linked to nav elements
@@ -161,13 +186,15 @@ Nav tabs should use the `href` property to link the tab to the URL of another pa
161
186
  Subtabs can also link to nav elements.
162
187
 
163
188
  ```ts file="./TabsNavSubtab.tsx"
189
+
164
190
  ```
165
191
 
166
192
  ### With separate content
167
193
 
168
- If a `<TabContent>` component is defined outside of a `<Tabs>` component, use the `tabContentRef` and `tabContentId` properties
194
+ If a `<TabContent>` component is defined outside of a `<Tabs>` component, use the `tabContentRef` and `tabContentId` properties. The `hidden` property is used on `TabContent` to set the initial visible content.
169
195
 
170
196
  ```ts file="./TabsSeparateContent.tsx"
197
+
171
198
  ```
172
199
 
173
200
  ### With tab content with body and padding
@@ -175,6 +202,7 @@ If a `<TabContent>` component is defined outside of a `<Tabs>` component, use th
175
202
  To add a content body to a `<TabContent>` component, pass a `<TabContentBody>`. To add padding to the body section, use the `hasPadding` property.
176
203
 
177
204
  ```ts file="./TabsContentWithBodyPadding.tsx"
205
+
178
206
  ```
179
207
 
180
208
  ### Children mounting on click
@@ -184,6 +212,7 @@ To mount tab children (add to the DOM) when a tab is clicked, use the `mountOnEn
184
212
  Note that this property does not create the tab children until the tab is clicked, so they are not preloaded into the DOM.
185
213
 
186
214
  ```ts file="./TabsChildrenMounting.tsx"
215
+
187
216
  ```
188
217
 
189
218
  ### Unmounting invisible children
@@ -191,15 +220,17 @@ Note that this property does not create the tab children until the tab is clicke
191
220
  To unmount tab children (remove from the DOM) when they are no longer visible, use the `unmountOnExit` property.
192
221
 
193
222
  ```ts file="./TabsUnmountingInvisibleChildren.tsx"
223
+
194
224
  ```
195
225
 
196
226
  ### Toggled tab content
197
227
 
198
- You may control tabs from outside of the tabs component. For example, select the "Hide tab 2" button below to make "Tab item 2" invisible.
228
+ You may control tabs from outside of the tabs component. For example, select the "Hide tab 2" button below to make "Tab item 2" invisible.
199
229
 
200
230
  The tab its content should only be mounted when the tab is visible.
201
231
 
202
232
  ```ts file="./TabsToggledSeparateContent.tsx"
233
+
203
234
  ```
204
235
 
205
236
  ### Dynamic tabs
@@ -207,6 +238,7 @@ The tab its content should only be mounted when the tab is visible.
207
238
  To enable closeable tabs, pass the `onClose` property to the `<Tabs>` component. To enable a button that adds new tabs, pass the `onAdd` property to `<Tabs>`.
208
239
 
209
240
  ```ts file="./TabsDynamic.tsx"
241
+
210
242
  ```
211
243
 
212
244
  ### With help action popover
@@ -216,6 +248,7 @@ You may add a help action to a tab to provide users with additional context in a
216
248
  To render an action beside the tab content, use the `actions` property of a `<Tab>`. Pass a popover and a `<TabsAction>` component into the `actions` property.
217
249
 
218
250
  ```ts file="./TabsHelp.tsx"
251
+
219
252
  ```
220
253
 
221
254
  ### With help and close actions
@@ -225,4 +258,5 @@ To add multiple actions to a tab, create a `<TabAction>` component for each acti
225
258
  The following example passes in both help popover and close actions.
226
259
 
227
260
  ```ts file="./TabsHelpAndClose.tsx"
261
+
228
262
  ```
@@ -48,6 +48,7 @@ export const TabsSeparateContent: React.FunctionComponent = () => {
48
48
  id="refTab1Section"
49
49
  ref={contentRef1}
50
50
  aria-label="This is content for the first separate content tab"
51
+ hidden={activeTabKey !== 0}
51
52
  >
52
53
  Tab 1 section
53
54
  </TabContent>
@@ -56,7 +57,7 @@ export const TabsSeparateContent: React.FunctionComponent = () => {
56
57
  id="refTab2Section"
57
58
  ref={contentRef2}
58
59
  aria-label="This is content for the second separate content tab"
59
- hidden
60
+ hidden={activeTabKey !== 1}
60
61
  >
61
62
  Tab 2 section
62
63
  </TabContent>
@@ -65,7 +66,7 @@ export const TabsSeparateContent: React.FunctionComponent = () => {
65
66
  id="refTab3Section"
66
67
  ref={contentRef3}
67
68
  aria-label="This is content for the third separate content tab"
68
- hidden
69
+ hidden={activeTabKey !== 2}
69
70
  >
70
71
  Tab 3 section
71
72
  </TabContent>
@@ -4,6 +4,7 @@ import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
4
4
  import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
5
5
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
6
6
  import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
7
+ import ExclamationTriangleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-triangle-icon';
7
8
 
8
9
  import { OUIAProps, useOUIAProps } from '../../helpers';
9
10
  import { WizardNavItemStatus } from './types';
@@ -38,7 +39,7 @@ export interface WizardNavItemProps
38
39
  /** The id for the navigation item */
39
40
  id?: string | number;
40
41
  /** Used to determine the icon displayed next to content. Default has no icon. */
41
- status?: 'default' | 'error' | 'success';
42
+ status?: 'default' | 'error' | 'success' | 'warning';
42
43
  }
43
44
 
44
45
  export const WizardNavItem = ({
@@ -97,7 +98,8 @@ export const WizardNavItem = ({
97
98
  isCurrent && styles.modifiers.current,
98
99
  isDisabled && styles.modifiers.disabled,
99
100
  status === WizardNavItemStatus.Error && styles.modifiers.danger,
100
- status === WizardNavItemStatus.Success && styles.modifiers.success
101
+ status === WizardNavItemStatus.Success && styles.modifiers.success,
102
+ status === WizardNavItemStatus.Warning && styles.modifiers.warning
101
103
  )}
102
104
  aria-disabled={isDisabled ? true : null}
103
105
  aria-current={isCurrent && !children ? 'step' : false}
@@ -110,6 +112,7 @@ export const WizardNavItem = ({
110
112
  <span className={css(styles.wizardNavLinkStatusIcon)}>
111
113
  {status === WizardNavItemStatus.Error && <ExclamationCircleIcon />}
112
114
  {status === WizardNavItemStatus.Success && <CheckCircleIcon />}
115
+ {status === WizardNavItemStatus.Warning && <ExclamationTriangleIcon />}
113
116
  </span>
114
117
  </>
115
118
  )}
@@ -28,7 +28,7 @@ export interface WizardStepProps {
28
28
  /** Replaces the step's footer. The step's footer takes precedence over the wizard's footer. */
29
29
  footer?: React.ReactElement<any> | Partial<WizardFooterProps>;
30
30
  /** Used to determine icon next to the step's navigation item */
31
- status?: 'default' | 'error' | 'success';
31
+ status?: 'default' | 'error' | 'success' | 'warning';
32
32
  /** Flag to determine whether parent steps can expand or not. Defaults to false. */
33
33
  isExpandable?: boolean;
34
34
  }
@@ -63,3 +63,9 @@ test(`Renders screen reader text and success icon when status is success`, () =>
63
63
  expect(screen.getByRole('button')).toHaveClass(styles.modifiers.success);
64
64
  expect(screen.getByText(', success')).toBeInTheDocument();
65
65
  });
66
+
67
+ test(`Renders screen reader text and warning icon when status is warning`, () => {
68
+ render(<WizardNavItem status="warning" />);
69
+ expect(screen.getByRole('button')).toHaveClass(styles.modifiers.warning);
70
+ expect(screen.getByText(', warning')).toBeInTheDocument();
71
+ });
@@ -70,4 +70,6 @@ test('updates "status" in context when the value changes', () => {
70
70
  expect(setStep).toHaveBeenCalledWith({ ...testStepProps, status: 'error', isVisited: true });
71
71
  render(<WizardStep {...testStep} status="success" />);
72
72
  expect(setStep).toHaveBeenCalledWith({ ...testStepProps, status: 'success', isVisited: true });
73
+ render(<WizardStep {...testStep} status="warning" />);
74
+ expect(setStep).toHaveBeenCalledWith({ ...testStepProps, status: 'warning', isVisited: true });
73
75
  });
@@ -6,8 +6,10 @@ interface SomeContextProps {
6
6
  setErrorMessage(error: string | undefined): void;
7
7
  successMessage: string | undefined;
8
8
  setSuccessMessage(error: string | undefined): void;
9
+ warningMessage: string | undefined;
10
+ setWarningMessage(error: string | undefined): void;
9
11
  }
10
- type SomeContextRenderProps = Pick<SomeContextProps, 'successMessage', 'errorMessage'>;
12
+ type SomeContextRenderProps = Pick<SomeContextProps, 'successMessage', 'errorMessage', 'warningMessage'>;
11
13
  interface SomeContextProviderProps {
12
14
  children: (context: SomeContextRenderProps) => React.ReactElement<any>;
13
15
  }
@@ -17,16 +19,20 @@ const SomeContext: React.Context<SomeContextProps> = createContext({} as SomeCon
17
19
  const SomeContextProvider = ({ children }: SomeContextProviderProps) => {
18
20
  const [errorMessage, setErrorMessage] = useState<string>();
19
21
  const [successMessage, setSuccessMessage] = useState<string>();
22
+ const [warningMessage, setWarningMessage] = useState<string>();
20
23
 
21
24
  return (
22
- <SomeContext.Provider value={{ errorMessage, setErrorMessage, successMessage, setSuccessMessage }}>
23
- {children({ errorMessage, successMessage })}
25
+ <SomeContext.Provider
26
+ value={{ errorMessage, setErrorMessage, successMessage, setSuccessMessage, warningMessage, setWarningMessage }}
27
+ >
28
+ {children({ errorMessage, successMessage, warningMessage })}
24
29
  </SomeContext.Provider>
25
30
  );
26
31
  };
27
32
 
28
33
  const StepContentWithAction = () => {
29
- const { errorMessage, setErrorMessage, successMessage, setSuccessMessage } = useContext(SomeContext);
34
+ const { errorMessage, setErrorMessage, successMessage, setSuccessMessage, warningMessage, setWarningMessage } =
35
+ useContext(SomeContext);
30
36
 
31
37
  return (
32
38
  <>
@@ -35,7 +41,8 @@ const StepContentWithAction = () => {
35
41
  isChecked={!!errorMessage}
36
42
  onChange={(_event, checked) => {
37
43
  setErrorMessage(checked ? 'Some error message' : undefined);
38
- setSuccessMessage(!checked ? 'Some error message' : undefined);
44
+ setSuccessMessage(checked ? undefined : successMessage);
45
+ setWarningMessage(checked ? undefined : warningMessage);
39
46
  }}
40
47
  id="toggle-error-checkbox"
41
48
  name="Toggle Status"
@@ -45,23 +52,37 @@ const StepContentWithAction = () => {
45
52
  isChecked={!!successMessage}
46
53
  onChange={(_event, checked) => {
47
54
  setSuccessMessage(checked ? 'Some success message' : undefined);
48
- setErrorMessage(!checked ? 'Some success message' : undefined);
55
+ setErrorMessage(checked ? undefined : errorMessage);
56
+ setWarningMessage(checked ? undefined : warningMessage);
49
57
  }}
50
58
  id="toggle-success-checkbox"
51
59
  name="Toggle Status"
52
60
  />
61
+ <Radio
62
+ label="Give step 1 a warning status"
63
+ isChecked={!!warningMessage}
64
+ onChange={(_event, checked) => {
65
+ setWarningMessage(checked ? 'Some warning message' : undefined);
66
+ setErrorMessage(checked ? undefined : errorMessage);
67
+ setSuccessMessage(checked ? undefined : successMessage);
68
+ }}
69
+ id="toggle-warning-checkbox"
70
+ name="Toggle Status"
71
+ />
53
72
  </>
54
73
  );
55
74
  };
56
75
 
57
76
  export const WizardStepStatus: React.FunctionComponent = () => (
58
77
  <SomeContextProvider>
59
- {({ errorMessage, successMessage }) => {
78
+ {({ errorMessage, successMessage, warningMessage }) => {
60
79
  let status = 'default';
61
80
  if (errorMessage) {
62
81
  status = 'error';
63
82
  } else if (successMessage) {
64
83
  status = 'success';
84
+ } else if (warningMessage) {
85
+ status = 'warning';
65
86
  }
66
87
  return (
67
88
  <Wizard height={400} title="Step status wizard">
@@ -23,13 +23,14 @@ export interface WizardBasicStep {
23
23
  /** Replaces the step's footer. The step's footer takes precedence over the wizard's footer. */
24
24
  footer?: React.ReactElement<any> | Partial<WizardFooterProps>;
25
25
  /** Used to determine icon next to the step's navItem */
26
- status?: 'default' | 'error' | 'success';
26
+ status?: 'default' | 'error' | 'success' | 'warning';
27
27
  }
28
28
 
29
29
  export enum WizardNavItemStatus {
30
30
  Default = 'default',
31
31
  Error = 'error',
32
- Success = 'success'
32
+ Success = 'success',
33
+ Warning = 'warning'
33
34
  }
34
35
 
35
36
  /** Type for customizing a button (next, back or cancel) in a Wizard footer. It omits some props which either have a default value or are passed directly via WizardFooterProps. */