@patternfly/react-core 6.4.0 → 6.4.1-prerelease.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/Content/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
- package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/AnimationsProvider/AnimationsProvider/package.json +1 -1
- package/dist/dynamic/helpers/AnimationsProvider/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/esm/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/esm/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/esm/components/Checkbox/Checkbox.js +14 -4
- package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
- package/dist/esm/components/Drawer/DrawerPanelContent.js +2 -4
- package/dist/esm/components/Drawer/DrawerPanelContent.js.map +1 -1
- package/dist/esm/components/Progress/ProgressContainer.js +2 -2
- package/dist/esm/components/Progress/ProgressContainer.js.map +1 -1
- package/dist/esm/components/Radio/Radio.d.ts +3 -0
- package/dist/esm/components/Radio/Radio.d.ts.map +1 -1
- package/dist/esm/components/Radio/Radio.js +15 -5
- package/dist/esm/components/Radio/Radio.js.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.d.ts +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.js +2 -1
- package/dist/esm/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/esm/components/Wizard/WizardStep.d.ts +1 -1
- package/dist/esm/components/Wizard/WizardStep.d.ts.map +1 -1
- package/dist/esm/components/Wizard/types.d.ts +3 -2
- package/dist/esm/components/Wizard/types.d.ts.map +1 -1
- package/dist/esm/components/Wizard/types.js +1 -0
- package/dist/esm/components/Wizard/types.js.map +1 -1
- package/dist/js/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/js/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/js/components/Checkbox/Checkbox.js +14 -4
- package/dist/js/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/js/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
- package/dist/js/components/Drawer/DrawerPanelContent.js +2 -4
- package/dist/js/components/Drawer/DrawerPanelContent.js.map +1 -1
- package/dist/js/components/Progress/ProgressContainer.js +2 -2
- package/dist/js/components/Progress/ProgressContainer.js.map +1 -1
- package/dist/js/components/Radio/Radio.d.ts +3 -0
- package/dist/js/components/Radio/Radio.d.ts.map +1 -1
- package/dist/js/components/Radio/Radio.js +15 -5
- package/dist/js/components/Radio/Radio.js.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.d.ts +1 -1
- package/dist/js/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.js +2 -1
- package/dist/js/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/js/components/Wizard/WizardStep.d.ts +1 -1
- package/dist/js/components/Wizard/WizardStep.d.ts.map +1 -1
- package/dist/js/components/Wizard/types.d.ts +3 -2
- package/dist/js/components/Wizard/types.d.ts.map +1 -1
- package/dist/js/components/Wizard/types.js +1 -0
- package/dist/js/components/Wizard/types.js.map +1 -1
- package/dist/umd/assets/{output-DH8J4Va1.css → output-CSllYx5z.css} +19866 -19866
- package/dist/umd/react-core.min.js +1 -1
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/components/Checkbox/Checkbox.tsx +21 -2
- package/src/components/Checkbox/__tests__/Checkbox.test.tsx +34 -0
- package/src/components/Drawer/DrawerPanelContent.tsx +5 -3
- package/src/components/Drawer/__tests__/DrawerPanelContent.test.tsx +37 -0
- package/src/components/Progress/ProgressContainer.tsx +2 -2
- package/src/components/Progress/__tests__/Generated/__snapshots__/ProgressContainer.test.tsx.snap +1 -1
- package/src/components/Progress/__tests__/__snapshots__/Progress.test.tsx.snap +1 -1
- package/src/components/Radio/Radio.tsx +21 -3
- package/src/components/Radio/__tests__/Radio.test.tsx +44 -0
- package/src/components/Tabs/__tests__/Tabs.test.tsx +109 -1
- package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +2 -2
- package/src/components/Tabs/examples/Tabs.md +38 -4
- package/src/components/Tabs/examples/TabsSeparateContent.tsx +3 -2
- package/src/components/Wizard/WizardNavItem.tsx +5 -2
- package/src/components/Wizard/WizardStep.tsx +1 -1
- package/src/components/Wizard/__tests__/WizardNavItem.test.tsx +6 -0
- package/src/components/Wizard/__tests__/WizardStep.test.tsx +2 -0
- package/src/components/Wizard/examples/WizardStepStatus.tsx +28 -7
- package/src/components/Wizard/types.tsx +3 -2
|
@@ -2,7 +2,18 @@
|
|
|
2
2
|
id: Tabs
|
|
3
3
|
section: components
|
|
4
4
|
cssPrefix: pf-v6-c-tabs
|
|
5
|
-
propComponents:
|
|
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
|
|
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
|
|
23
|
-
{
|
|
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 } =
|
|
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(
|
|
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(
|
|
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. */
|