@patternfly/react-core 5.4.0-prerelease.5 → 5.4.0-prerelease.7
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/Chip/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/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/DragDrop/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/Text/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/Tile/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/ApplicationLauncher/package.json +1 -1
- package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
- package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
- package/dist/dynamic/deprecated/components/Select/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/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/favorites/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/next/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/next/components/Modal/package.json +1 -1
- package/dist/dynamic/next/components/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/esm/components/Wizard/Wizard.d.ts +5 -1
- package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/components/Wizard/Wizard.js +9 -2
- package/dist/esm/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/components/Wizard/WizardBody.js +8 -9
- package/dist/esm/components/Wizard/WizardBody.js.map +1 -1
- package/dist/esm/components/Wizard/WizardContext.d.ts +8 -0
- package/dist/esm/components/Wizard/WizardContext.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardContext.js +4 -2
- package/dist/esm/components/Wizard/WizardContext.js.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.js +10 -17
- package/dist/esm/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/js/components/Wizard/Wizard.d.ts +5 -1
- package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/js/components/Wizard/Wizard.js +9 -2
- package/dist/js/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/components/Wizard/WizardBody.js +8 -9
- package/dist/js/components/Wizard/WizardBody.js.map +1 -1
- package/dist/js/components/Wizard/WizardContext.d.ts +8 -0
- package/dist/js/components/Wizard/WizardContext.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardContext.js +4 -2
- package/dist/js/components/Wizard/WizardContext.js.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.js +10 -17
- package/dist/js/components/Wizard/WizardNavItem.js.map +1 -1
- 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/Wizard/Wizard.tsx +15 -0
- package/src/components/Wizard/WizardBody.tsx +9 -9
- package/src/components/Wizard/WizardContext.tsx +14 -2
- package/src/components/Wizard/WizardNavItem.tsx +7 -21
- package/src/components/Wizard/__tests__/Wizard.test.tsx +4 -4
- package/src/components/Wizard/examples/Wizard.md +29 -1
- package/src/components/Wizard/examples/WizardFocusOnNextBack.tsx +16 -0
- package/src/components/Wizard/examples/WizardWithCustomFooter.tsx +3 -3
- package/src/deprecated/components/ApplicationLauncher/examples/ApplicationLauncher.md +1 -0
package/helpers/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"5.4.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"5.4.0-prerelease.6","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"5.4.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"5.4.0-prerelease.6","private":true}
|
package/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"5.4.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"5.4.0-prerelease.6","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "5.4.0-prerelease.
|
|
3
|
+
"version": "5.4.0-prerelease.7",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"react": "^17 || ^18",
|
|
72
72
|
"react-dom": "^17 || ^18"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "9c36240480406b0a7bd85cc6e1f6572e57c13193"
|
|
75
75
|
}
|
|
@@ -55,6 +55,10 @@ export interface WizardProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
55
55
|
onSave?: (event: React.MouseEvent<HTMLButtonElement>) => void | Promise<void>;
|
|
56
56
|
/** Callback function to close the wizard */
|
|
57
57
|
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
58
|
+
/** @beta Flag indicating whether the wizard content should be focused after the onNext or onBack callbacks
|
|
59
|
+
* are called.
|
|
60
|
+
*/
|
|
61
|
+
shouldFocusContent?: boolean;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
export const Wizard = ({
|
|
@@ -72,11 +76,13 @@ export const Wizard = ({
|
|
|
72
76
|
onStepChange,
|
|
73
77
|
onSave,
|
|
74
78
|
onClose,
|
|
79
|
+
shouldFocusContent = false,
|
|
75
80
|
...wrapperProps
|
|
76
81
|
}: WizardProps) => {
|
|
77
82
|
const [activeStepIndex, setActiveStepIndex] = React.useState(startIndex);
|
|
78
83
|
const initialSteps = buildSteps(children);
|
|
79
84
|
const firstStepRef = React.useRef(initialSteps[startIndex - 1]);
|
|
85
|
+
const wrapperRef = React.useRef(null);
|
|
80
86
|
|
|
81
87
|
// When the startIndex maps to a parent step, focus on the first sub-step
|
|
82
88
|
React.useEffect(() => {
|
|
@@ -85,6 +91,11 @@ export const Wizard = ({
|
|
|
85
91
|
}
|
|
86
92
|
}, [startIndex]);
|
|
87
93
|
|
|
94
|
+
const focusMainContentElement = () =>
|
|
95
|
+
setTimeout(() => {
|
|
96
|
+
wrapperRef?.current?.focus && wrapperRef.current.focus();
|
|
97
|
+
}, 0);
|
|
98
|
+
|
|
88
99
|
const goToNextStep = (event: React.MouseEvent<HTMLButtonElement>, steps: WizardStepType[] = initialSteps) => {
|
|
89
100
|
const newStep = steps.find((step) => step.index > activeStepIndex && isStepEnabled(steps, step));
|
|
90
101
|
|
|
@@ -94,6 +105,7 @@ export const Wizard = ({
|
|
|
94
105
|
|
|
95
106
|
setActiveStepIndex(newStep?.index);
|
|
96
107
|
onStepChange?.(event, newStep, steps[activeStepIndex - 1], WizardStepChangeScope.Next);
|
|
108
|
+
shouldFocusContent && focusMainContentElement();
|
|
97
109
|
};
|
|
98
110
|
|
|
99
111
|
const goToPrevStep = (event: React.MouseEvent<HTMLButtonElement>, steps: WizardStepType[] = initialSteps) => {
|
|
@@ -103,6 +115,7 @@ export const Wizard = ({
|
|
|
103
115
|
|
|
104
116
|
setActiveStepIndex(newStep?.index);
|
|
105
117
|
onStepChange?.(event, newStep, steps[activeStepIndex - 1], WizardStepChangeScope.Back);
|
|
118
|
+
shouldFocusContent && focusMainContentElement();
|
|
106
119
|
};
|
|
107
120
|
|
|
108
121
|
const goToStepByIndex = (
|
|
@@ -157,6 +170,8 @@ export const Wizard = ({
|
|
|
157
170
|
goToStepById={goToStepById}
|
|
158
171
|
goToStepByName={goToStepByName}
|
|
159
172
|
goToStepByIndex={goToStepByIndex}
|
|
173
|
+
shouldFocusContent={shouldFocusContent}
|
|
174
|
+
mainWrapperRef={wrapperRef}
|
|
160
175
|
>
|
|
161
176
|
<div
|
|
162
177
|
className={css(styles.wizard, className)}
|
|
@@ -36,15 +36,14 @@ export const WizardBody = ({
|
|
|
36
36
|
}: WizardBodyProps) => {
|
|
37
37
|
const [hasScrollbar, setHasScrollbar] = React.useState(false);
|
|
38
38
|
const [previousWidth, setPreviousWidth] = React.useState<number | undefined>(undefined);
|
|
39
|
-
const wrapperRef = React.useRef(null);
|
|
40
39
|
const WrapperComponent = component;
|
|
41
|
-
const { activeStep } = React.useContext(WizardContext);
|
|
40
|
+
const { activeStep, shouldFocusContent, mainWrapperRef } = React.useContext(WizardContext);
|
|
42
41
|
const defaultAriaLabel = ariaLabel || `${activeStep?.name} content`;
|
|
43
42
|
|
|
44
43
|
React.useEffect(() => {
|
|
45
44
|
const resize = () => {
|
|
46
|
-
if (
|
|
47
|
-
const { offsetWidth, offsetHeight, scrollHeight } =
|
|
45
|
+
if (mainWrapperRef?.current) {
|
|
46
|
+
const { offsetWidth, offsetHeight, scrollHeight } = mainWrapperRef.current;
|
|
48
47
|
|
|
49
48
|
if (previousWidth !== offsetWidth) {
|
|
50
49
|
setPreviousWidth(offsetWidth);
|
|
@@ -56,12 +55,12 @@ export const WizardBody = ({
|
|
|
56
55
|
const handleResizeWithDelay = debounce(resize, 250);
|
|
57
56
|
let observer = () => {};
|
|
58
57
|
|
|
59
|
-
if (
|
|
60
|
-
observer = getResizeObserver(
|
|
61
|
-
const { offsetHeight, scrollHeight } =
|
|
58
|
+
if (mainWrapperRef?.current) {
|
|
59
|
+
observer = getResizeObserver(mainWrapperRef.current, handleResizeWithDelay);
|
|
60
|
+
const { offsetHeight, scrollHeight } = mainWrapperRef.current;
|
|
62
61
|
|
|
63
62
|
setHasScrollbar(offsetHeight < scrollHeight);
|
|
64
|
-
setPreviousWidth((
|
|
63
|
+
setPreviousWidth((mainWrapperRef.current as HTMLElement).offsetWidth);
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
return () => {
|
|
@@ -71,7 +70,8 @@ export const WizardBody = ({
|
|
|
71
70
|
|
|
72
71
|
return (
|
|
73
72
|
<WrapperComponent
|
|
74
|
-
ref={
|
|
73
|
+
ref={mainWrapperRef}
|
|
74
|
+
{...(shouldFocusContent && { tabIndex: -1 })}
|
|
75
75
|
{...(component === 'div' && hasScrollbar && { role: 'region' })}
|
|
76
76
|
{...(hasScrollbar && { 'aria-label': defaultAriaLabel, 'aria-labelledby': ariaLabelledBy, tabIndex: 0 })}
|
|
77
77
|
className={css(styles.wizardMain)}
|
|
@@ -28,6 +28,12 @@ export interface WizardContextProps {
|
|
|
28
28
|
getStep: (stepId: number | string) => WizardStepType;
|
|
29
29
|
/** Set step by ID */
|
|
30
30
|
setStep: (step: Pick<WizardStepType, 'id'> & Partial<WizardStepType>) => void;
|
|
31
|
+
/** Flag indicating whether the wizard content should be focused after the onNext or onBack callbacks
|
|
32
|
+
* are called.
|
|
33
|
+
*/
|
|
34
|
+
shouldFocusContent: boolean;
|
|
35
|
+
/** Ref for main wizard content element. */
|
|
36
|
+
mainWrapperRef: React.RefObject<HTMLElement>;
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
export const WizardContext = React.createContext({} as WizardContextProps);
|
|
@@ -47,6 +53,8 @@ export interface WizardContextProviderProps {
|
|
|
47
53
|
steps: WizardStepType[],
|
|
48
54
|
index: number
|
|
49
55
|
): void;
|
|
56
|
+
shouldFocusContent: boolean;
|
|
57
|
+
mainWrapperRef: React.RefObject<HTMLElement>;
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
export const WizardContextProvider: React.FunctionComponent<WizardContextProviderProps> = ({
|
|
@@ -59,7 +67,9 @@ export const WizardContextProvider: React.FunctionComponent<WizardContextProvide
|
|
|
59
67
|
onClose,
|
|
60
68
|
goToStepById,
|
|
61
69
|
goToStepByName,
|
|
62
|
-
goToStepByIndex
|
|
70
|
+
goToStepByIndex,
|
|
71
|
+
shouldFocusContent,
|
|
72
|
+
mainWrapperRef
|
|
63
73
|
}) => {
|
|
64
74
|
const [currentSteps, setCurrentSteps] = React.useState<WizardStepType[]>(initialSteps);
|
|
65
75
|
const [currentFooter, setCurrentFooter] = React.useState<WizardFooterType>();
|
|
@@ -139,7 +149,9 @@ export const WizardContextProvider: React.FunctionComponent<WizardContextProvide
|
|
|
139
149
|
goToStepByIndex: React.useCallback(
|
|
140
150
|
(index: number) => goToStepByIndex(null, steps, index),
|
|
141
151
|
[goToStepByIndex, steps]
|
|
142
|
-
)
|
|
152
|
+
),
|
|
153
|
+
shouldFocusContent,
|
|
154
|
+
mainWrapperRef
|
|
143
155
|
}}
|
|
144
156
|
>
|
|
145
157
|
{children}
|
|
@@ -44,6 +44,7 @@ export const WizardNavItem = ({
|
|
|
44
44
|
content = '',
|
|
45
45
|
isCurrent = false,
|
|
46
46
|
isDisabled = false,
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
47
48
|
isVisited = false,
|
|
48
49
|
stepIndex,
|
|
49
50
|
onClick,
|
|
@@ -68,23 +69,6 @@ export const WizardNavItem = ({
|
|
|
68
69
|
console.error('WizardNavItem: When using an anchor, please provide an href');
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
const ariaLabel = React.useMemo(() => {
|
|
72
|
-
if (status === WizardNavItemStatus.Error || (isVisited && !isCurrent)) {
|
|
73
|
-
let label = content.toString();
|
|
74
|
-
|
|
75
|
-
if (status === WizardNavItemStatus.Error) {
|
|
76
|
-
label += `, ${status}`;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// No need to signify step is visited if current
|
|
80
|
-
if (isVisited && !isCurrent) {
|
|
81
|
-
label += ', visited';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return label;
|
|
85
|
-
}
|
|
86
|
-
}, [content, isCurrent, isVisited, status]);
|
|
87
|
-
|
|
88
72
|
return (
|
|
89
73
|
<li
|
|
90
74
|
className={css(
|
|
@@ -110,7 +94,6 @@ export const WizardNavItem = ({
|
|
|
110
94
|
aria-disabled={isDisabled ? true : null}
|
|
111
95
|
aria-current={isCurrent && !children ? 'step' : false}
|
|
112
96
|
{...(isExpandable && { 'aria-expanded': isExpanded })}
|
|
113
|
-
{...(ariaLabel && { 'aria-label': ariaLabel })}
|
|
114
97
|
{...ouiaProps}
|
|
115
98
|
>
|
|
116
99
|
{isExpandable ? (
|
|
@@ -127,9 +110,12 @@ export const WizardNavItem = ({
|
|
|
127
110
|
{content}
|
|
128
111
|
{/* TODO, patternfly/patternfly#5142 */}
|
|
129
112
|
{status === WizardNavItemStatus.Error && (
|
|
130
|
-
|
|
131
|
-
<
|
|
132
|
-
|
|
113
|
+
<>
|
|
114
|
+
<span className="pf-v5-screen-reader">, {status}</span>
|
|
115
|
+
<span style={{ marginLeft: globalSpacerSm.var }}>
|
|
116
|
+
<ExclamationCircleIcon color={globalDangerColor100.var} />
|
|
117
|
+
</span>
|
|
118
|
+
</>
|
|
133
119
|
)}
|
|
134
120
|
</>
|
|
135
121
|
)}
|
|
@@ -411,7 +411,7 @@ test('incrementally shows/hides steps based on the activeStep when isProgressive
|
|
|
411
411
|
await user.click(nextButton);
|
|
412
412
|
expect(
|
|
413
413
|
screen.getByRole('button', {
|
|
414
|
-
name: 'Test step 1
|
|
414
|
+
name: 'Test step 1'
|
|
415
415
|
})
|
|
416
416
|
).toBeVisible();
|
|
417
417
|
expect(
|
|
@@ -429,12 +429,12 @@ test('incrementally shows/hides steps based on the activeStep when isProgressive
|
|
|
429
429
|
await user.click(nextButton);
|
|
430
430
|
expect(
|
|
431
431
|
screen.getByRole('button', {
|
|
432
|
-
name: 'Test step 1
|
|
432
|
+
name: 'Test step 1'
|
|
433
433
|
})
|
|
434
434
|
).toBeVisible();
|
|
435
435
|
expect(
|
|
436
436
|
screen.getByRole('button', {
|
|
437
|
-
name: 'Test step 2
|
|
437
|
+
name: 'Test step 2'
|
|
438
438
|
})
|
|
439
439
|
).toBeVisible();
|
|
440
440
|
expect(
|
|
@@ -447,7 +447,7 @@ test('incrementally shows/hides steps based on the activeStep when isProgressive
|
|
|
447
447
|
await user.click(backButton);
|
|
448
448
|
expect(
|
|
449
449
|
screen.getByRole('button', {
|
|
450
|
-
name: 'Test step 1
|
|
450
|
+
name: 'Test step 1'
|
|
451
451
|
})
|
|
452
452
|
).toBeVisible();
|
|
453
453
|
expect(
|
|
@@ -16,7 +16,7 @@ propComponents:
|
|
|
16
16
|
'WizardContextProps',
|
|
17
17
|
'WizardBasicStep',
|
|
18
18
|
'WizardParentStep',
|
|
19
|
-
'WizardSubStep'
|
|
19
|
+
'WizardSubStep'
|
|
20
20
|
]
|
|
21
21
|
---
|
|
22
22
|
|
|
@@ -57,91 +57,119 @@ import layout from '@patternfly/react-styles/css/layouts/Bullseye/bullseye';
|
|
|
57
57
|
### Basic
|
|
58
58
|
|
|
59
59
|
```ts file="./WizardBasic.tsx"
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Focus content on next/back
|
|
64
|
+
|
|
65
|
+
To focus the main content element of the `Wizard`, pass in the `shouldFocusContent` property. It is recommended that this is passed in so that users can navigate through a `WizardStep` content in order.
|
|
66
|
+
|
|
67
|
+
If a `WizardStep` is passed a `body={null}` property, you must manually handle focus.
|
|
68
|
+
|
|
69
|
+
```ts file="./WizardFocusOnNextBack.tsx"
|
|
70
|
+
|
|
60
71
|
```
|
|
61
72
|
|
|
62
73
|
### Basic with disabled steps
|
|
63
74
|
|
|
64
75
|
```ts file="./WizardBasicDisabledSteps.tsx"
|
|
76
|
+
|
|
65
77
|
```
|
|
66
78
|
|
|
67
79
|
### Anchors for nav items
|
|
68
80
|
|
|
69
81
|
```ts file="./WizardWithNavAnchors.tsx"
|
|
82
|
+
|
|
70
83
|
```
|
|
71
84
|
|
|
72
85
|
### Incrementally enabled steps
|
|
73
86
|
|
|
74
87
|
```ts file="./WizardStepVisitRequired.tsx"
|
|
88
|
+
|
|
75
89
|
```
|
|
76
90
|
|
|
77
91
|
### Expandable steps
|
|
78
92
|
|
|
79
93
|
```ts file="./WizardExpandableSteps.tsx"
|
|
94
|
+
|
|
80
95
|
```
|
|
81
96
|
|
|
82
97
|
### Progress after submission
|
|
83
98
|
|
|
84
99
|
```ts file="./WizardWithSubmitProgress.tsx"
|
|
100
|
+
|
|
85
101
|
```
|
|
86
102
|
|
|
87
103
|
### Enabled on form validation
|
|
88
104
|
|
|
89
105
|
```ts file="./WizardEnabledOnFormValidation.tsx"
|
|
106
|
+
|
|
90
107
|
```
|
|
91
108
|
|
|
92
109
|
### Validate on button press
|
|
93
110
|
|
|
94
111
|
```ts file="./WizardValidateOnButtonPress.tsx"
|
|
112
|
+
|
|
95
113
|
```
|
|
96
114
|
|
|
97
115
|
### Progressive steps
|
|
98
116
|
|
|
99
117
|
```ts file="./WizardProgressiveSteps.tsx"
|
|
118
|
+
|
|
100
119
|
```
|
|
101
120
|
|
|
102
121
|
### Get current step
|
|
103
122
|
|
|
104
123
|
```ts file="./WizardGetCurrentStep.tsx"
|
|
124
|
+
|
|
105
125
|
```
|
|
106
126
|
|
|
107
127
|
### Within modal
|
|
108
128
|
|
|
109
129
|
```ts file="./WizardWithinModal.tsx"
|
|
130
|
+
|
|
110
131
|
```
|
|
111
132
|
|
|
112
133
|
### Step drawer content
|
|
113
134
|
|
|
114
135
|
```ts file="./WizardStepDrawerContent.tsx"
|
|
136
|
+
|
|
115
137
|
```
|
|
116
138
|
|
|
117
139
|
### Custom navigation
|
|
118
140
|
|
|
119
141
|
```ts file="./WizardWithCustomNav.tsx"
|
|
142
|
+
|
|
120
143
|
```
|
|
121
144
|
|
|
122
145
|
### Header
|
|
123
146
|
|
|
124
147
|
```ts file="./WizardWithHeader.tsx"
|
|
148
|
+
|
|
125
149
|
```
|
|
126
150
|
|
|
127
151
|
### Custom footer
|
|
128
152
|
|
|
129
153
|
```ts file="./WizardWithCustomFooter.tsx"
|
|
154
|
+
|
|
130
155
|
```
|
|
131
156
|
|
|
132
157
|
### Custom navigation item
|
|
133
158
|
|
|
134
159
|
```ts file="./WizardWithCustomNavItem.tsx"
|
|
160
|
+
|
|
135
161
|
```
|
|
136
162
|
|
|
137
163
|
### Toggle step visibility
|
|
138
164
|
|
|
139
165
|
```ts file="./WizardToggleStepVisibility.tsx"
|
|
166
|
+
|
|
140
167
|
```
|
|
141
168
|
|
|
142
169
|
### Step error status
|
|
143
170
|
|
|
144
171
|
```ts file="./WizardStepErrorStatus.tsx"
|
|
172
|
+
|
|
145
173
|
```
|
|
146
174
|
|
|
147
175
|
## Hooks
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Wizard, WizardStep } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const WizardFocusOnNextBack: React.FunctionComponent = () => (
|
|
5
|
+
<Wizard shouldFocusContent title="Wizard that focuses content on next or back click">
|
|
6
|
+
<WizardStep name="Step 1" id="wizard-focus-first-step">
|
|
7
|
+
Step 1 content
|
|
8
|
+
</WizardStep>
|
|
9
|
+
<WizardStep name="Step 2" id="wizard-focus-second-step">
|
|
10
|
+
Step 2 content
|
|
11
|
+
</WizardStep>
|
|
12
|
+
<WizardStep name="Review" id="wizard-focus-review-step" footer={{ nextButtonText: 'Finish' }}>
|
|
13
|
+
Review step content
|
|
14
|
+
</WizardStep>
|
|
15
|
+
</Wizard>
|
|
16
|
+
);
|
|
@@ -40,12 +40,12 @@ const CustomStepTwoFooter = () => {
|
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<WizardFooterWrapper>
|
|
43
|
-
<Button variant="primary" onClick={onNext} isLoading={isLoading} isDisabled={isLoading}>
|
|
44
|
-
Async Next
|
|
45
|
-
</Button>
|
|
46
43
|
<Button variant="secondary" onClick={goToPrevStep} isDisabled={isLoading}>
|
|
47
44
|
Back
|
|
48
45
|
</Button>
|
|
46
|
+
<Button variant="primary" onClick={onNext} isLoading={isLoading} isDisabled={isLoading}>
|
|
47
|
+
Async Next
|
|
48
|
+
</Button>
|
|
49
49
|
<Button variant="link" onClick={close} isDisabled={isLoading}>
|
|
50
50
|
Cancel
|
|
51
51
|
</Button>
|
|
@@ -12,6 +12,7 @@ import { DropdownDirection, DropdownPosition } from '@patternfly/react-core/depr
|
|
|
12
12
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
13
13
|
import { Link } from '@reach/router';
|
|
14
14
|
import pfLogoSm from '@patternfly/react-core/src/demos/assets/pf-logo-small.svg';
|
|
15
|
+
import c_app_launcher__menu_item_Color from '@patternfly/react-tokens/dist/esm/c_app_launcher__menu_item_Color';
|
|
15
16
|
|
|
16
17
|
Note: Application launcher is built on dropdown, for extended API go to [dropdown](/components/menus/dropdown) documentation.
|
|
17
18
|
To add a tooltip, use the `tooltip` prop and optionally add more tooltip props by using `tooltipProps`. For more tooltip information go to [tooltip](/components/tooltip).
|