@patternfly/react-core 4.276.4 → 4.276.6
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 +16 -0
- package/components/Alert/Alert.d.ts +3 -1
- package/components/Alert/Alert.d.ts.map +1 -1
- package/components/Alert/Alert.js +13 -8
- package/components/Alert/Alert.js.map +1 -1
- package/dist/esm/components/Alert/Alert.d.ts +3 -1
- package/dist/esm/components/Alert/Alert.d.ts.map +1 -1
- package/dist/esm/components/Alert/Alert.js +13 -8
- package/dist/esm/components/Alert/Alert.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardContext.d.ts +1 -1
- package/dist/esm/next/components/Wizard/WizardContext.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardContext.js +3 -3
- package/dist/esm/next/components/Wizard/WizardContext.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardStep.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardStep.js +16 -3
- package/dist/esm/next/components/Wizard/WizardStep.js.map +1 -1
- package/dist/esm/next/components/Wizard/hooks/index.d.ts +0 -1
- package/dist/esm/next/components/Wizard/hooks/index.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/hooks/index.js +0 -1
- package/dist/esm/next/components/Wizard/hooks/index.js.map +1 -1
- package/dist/js/components/Alert/Alert.d.ts +3 -1
- package/dist/js/components/Alert/Alert.d.ts.map +1 -1
- package/dist/js/components/Alert/Alert.js +13 -8
- package/dist/js/components/Alert/Alert.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardContext.d.ts +1 -1
- package/dist/js/next/components/Wizard/WizardContext.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardContext.js +3 -3
- package/dist/js/next/components/Wizard/WizardContext.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardStep.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardStep.js +16 -3
- package/dist/js/next/components/Wizard/WizardStep.js.map +1 -1
- package/dist/js/next/components/Wizard/hooks/index.d.ts +0 -1
- package/dist/js/next/components/Wizard/hooks/index.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/hooks/index.js +1 -3
- package/dist/js/next/components/Wizard/hooks/index.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/next/components/Wizard/WizardContext.d.ts +1 -1
- package/next/components/Wizard/WizardContext.d.ts.map +1 -1
- package/next/components/Wizard/WizardContext.js +3 -3
- package/next/components/Wizard/WizardContext.js.map +1 -1
- package/next/components/Wizard/WizardStep.d.ts.map +1 -1
- package/next/components/Wizard/WizardStep.js +16 -3
- package/next/components/Wizard/WizardStep.js.map +1 -1
- package/next/components/Wizard/hooks/index.d.ts +0 -1
- package/next/components/Wizard/hooks/index.d.ts.map +1 -1
- package/next/components/Wizard/hooks/index.js +0 -1
- package/next/components/Wizard/hooks/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Alert/Alert.tsx +21 -10
- package/src/components/Alert/examples/Alert.md +7 -4
- package/src/next/components/Wizard/WizardContext.tsx +12 -4
- package/src/next/components/Wizard/WizardStep.tsx +16 -4
- package/src/next/components/Wizard/hooks/index.ts +0 -1
- package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.d.ts +0 -9
- package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.d.ts.map +0 -1
- package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.js +0 -33
- package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.js.map +0 -1
- package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.d.ts +0 -9
- package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.d.ts.map +0 -1
- package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.js +0 -38
- package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.js.map +0 -1
- package/next/components/Wizard/hooks/useGetMergedSteps.d.ts +0 -9
- package/next/components/Wizard/hooks/useGetMergedSteps.d.ts.map +0 -1
- package/next/components/Wizard/hooks/useGetMergedSteps.js +0 -33
- package/next/components/Wizard/hooks/useGetMergedSteps.js.map +0 -1
- package/src/next/components/Wizard/hooks/useGetMergedSteps.tsx +0 -45
|
@@ -35,7 +35,7 @@ export interface WizardContextProviderProps {
|
|
|
35
35
|
children: React.ReactElement;
|
|
36
36
|
onNext(event: React.MouseEvent<HTMLButtonElement>, steps: WizardStepType[]): void;
|
|
37
37
|
onBack(event: React.MouseEvent<HTMLButtonElement>, steps: WizardStepType[]): void;
|
|
38
|
-
onClose(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
38
|
+
onClose?(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
39
39
|
goToStepById(steps: WizardStepType[], id: number | string): void;
|
|
40
40
|
goToStepByName(steps: WizardStepType[], name: string): void;
|
|
41
41
|
goToStepByIndex(event: React.MouseEvent<HTMLButtonElement> | React.MouseEvent<HTMLAnchorElement>, steps: WizardStepType[], index: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardContext.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAyC,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"WizardContext.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAyC,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAElG,OAAO,EAAgB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,WAAW,kBAAkB;IACjC,oBAAoB;IACpB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,mBAAmB;IACnB,UAAU,EAAE,cAAc,CAAC;IAC3B,qBAAqB;IACrB,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC;IAC3B,uBAA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IAClF,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;IAC3D,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACjE,cAAc,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5D,eAAe,CACb,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAChF,KAAK,EAAE,cAAc,EAAE,EACvB,KAAK,EAAE,MAAM,GACZ,IAAI,CAAC;CACT;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CA8FrF,CAAC;AAIF,eAAO,MAAM,gBAAgB,0BAAwC,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { isCustomWizardFooter, isWizardSubStep } from './types';
|
|
3
3
|
import { getActiveStep } from './utils';
|
|
4
|
-
import { useGetMergedSteps } from './hooks';
|
|
5
4
|
import { WizardFooter } from './WizardFooter';
|
|
6
5
|
export const WizardContext = React.createContext({});
|
|
7
6
|
export const WizardContextProvider = ({ steps: initialSteps, footer: initialFooter, activeStepIndex, children, onNext, onBack, onClose, goToStepById, goToStepByName, goToStepByIndex }) => {
|
|
8
7
|
const [currentSteps, setCurrentSteps] = React.useState(initialSteps);
|
|
9
8
|
const [currentFooter, setCurrentFooter] = React.useState(typeof initialFooter !== 'function' ? initialFooter : undefined);
|
|
10
|
-
|
|
9
|
+
// Combined initial and current state steps
|
|
10
|
+
const steps = React.useMemo(() => currentSteps.map((currentStepProps, index) => (Object.assign(Object.assign({}, currentStepProps), initialSteps[index]))), [initialSteps, currentSteps]);
|
|
11
11
|
const activeStep = React.useMemo(() => getActiveStep(steps, activeStepIndex), [activeStepIndex, steps]);
|
|
12
|
-
const close = React.useCallback(() => onClose(null), [onClose]);
|
|
12
|
+
const close = React.useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose(null), [onClose]);
|
|
13
13
|
const goToNextStep = React.useCallback(() => onNext(null, steps), [onNext, steps]);
|
|
14
14
|
const goToPrevStep = React.useCallback(() => onBack(null, steps), [onBack, steps]);
|
|
15
15
|
const footer = React.useMemo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardContext.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAoC,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"WizardContext.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAoC,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AA6BjE,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,EAAwB,CAAC,CAAC;AAmB3E,MAAM,CAAC,MAAM,qBAAqB,GAAwD,CAAC,EACzF,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,aAAa,EACrB,eAAe,EACf,QAAQ,EACR,MAAM,EACN,MAAM,EACN,OAAO,EACP,YAAY,EACZ,cAAc,EACd,eAAe,EAChB,EAAE,EAAE;IACH,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;I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,0GAA0G;IAC1G,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;IAClE,iCAAiC;IACjC,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,EAAE,CAAC;IAC9C,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,+FAA+F;IAC/F,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACzD,gEAAgE;IAChE,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC7B,mFAAmF;IACnF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,UAAU;+CAA8C,eAAe;;CAkCnF,CAAC"}
|
|
@@ -6,12 +6,25 @@ export const WizardStep = (_a) => {
|
|
|
6
6
|
var { children, steps: _subSteps } = _a, props = __rest(_a, ["children", "steps"]);
|
|
7
7
|
const { activeStep, setStep } = useWizardContext();
|
|
8
8
|
const { id, name, body, isDisabled, isHidden, navItem, footer, status } = props;
|
|
9
|
+
const isParentStep = isWizardParentStep(activeStep);
|
|
9
10
|
// Update step in context when props change or when the step is active has yet to be marked as visited.
|
|
10
11
|
React.useEffect(() => {
|
|
11
|
-
const shouldUpdateIsVisited = !isWizardParentStep(activeStep) && id === (activeStep === null || activeStep === void 0 ? void 0 : activeStep.id) && !(activeStep === null || activeStep === void 0 ? void 0 : activeStep.isVisited);
|
|
12
12
|
setStep(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id,
|
|
13
|
-
name }, (body && { body })), (isDisabled && { isDisabled })), (isHidden && { isHidden })), (navItem && { navItem })), (footer && { footer })), (status && { status })), (
|
|
14
|
-
}, [
|
|
13
|
+
name }, (body && { body })), (isDisabled && { isDisabled })), (isHidden && { isHidden })), (navItem && { navItem })), (footer && { footer })), (status && { status })), (!isParentStep && id === (activeStep === null || activeStep === void 0 ? void 0 : activeStep.id) && !(activeStep === null || activeStep === void 0 ? void 0 : activeStep.isVisited) && { isVisited: true })));
|
|
14
|
+
}, [
|
|
15
|
+
body,
|
|
16
|
+
footer,
|
|
17
|
+
id,
|
|
18
|
+
isDisabled,
|
|
19
|
+
isHidden,
|
|
20
|
+
name,
|
|
21
|
+
navItem,
|
|
22
|
+
status,
|
|
23
|
+
isParentStep,
|
|
24
|
+
setStep,
|
|
25
|
+
activeStep === null || activeStep === void 0 ? void 0 : activeStep.id,
|
|
26
|
+
activeStep === null || activeStep === void 0 ? void 0 : activeStep.isVisited
|
|
27
|
+
]);
|
|
15
28
|
return React.createElement(React.Fragment, null, children);
|
|
16
29
|
};
|
|
17
30
|
WizardStep.displayName = 'WizardStep';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardStep.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardStep.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAqB,MAAM,SAAS,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAgCnD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAyD,EAAE,EAAE;QAA7D,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,OAA6B,EAAxB,KAAK,cAAtC,qBAAwC,CAAF;IAC/D,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACnD,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;
|
|
1
|
+
{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C;IACL,CAAC,EAAE;QACD,IAAI;QACJ,MAAM;QACN,EAAE;QACF,UAAU;QACV,QAAQ;QACR,IAAI;QACJ,OAAO;QACP,MAAM;QACN,YAAY;QACZ,OAAO;QACP,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,EAAE;QACd,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS;KACtB,CAAC,CAAC;IAEH,OAAO,0CAAG,QAAQ,CAAI,CAAC;AACzB,CAAC,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.276.
|
|
3
|
+
"version": "4.276.6",
|
|
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": "^16.8 || ^17 || ^18",
|
|
72
72
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "e2d787cd453afc07405d7f5f10eb6b64a215b064"
|
|
75
75
|
}
|
|
@@ -57,8 +57,10 @@ export interface AlertProps extends Omit<React.HTMLProps<HTMLDivElement>, 'actio
|
|
|
57
57
|
timeoutAnimation?: number;
|
|
58
58
|
/** Title of the alert. */
|
|
59
59
|
title: React.ReactNode;
|
|
60
|
-
/** Sets the heading level to use for the alert title. Default is h4. */
|
|
60
|
+
/** @deprecated Sets the heading level to use for the alert title. Default is h4. */
|
|
61
61
|
titleHeadingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
62
|
+
/** Sets the element to use as the alert title. Default is h4. */
|
|
63
|
+
component?: keyof JSX.IntrinsicElements;
|
|
62
64
|
/** Adds accessible text to the alert toggle. */
|
|
63
65
|
toggleAriaLabel?: string;
|
|
64
66
|
/** Position of the tooltip which is displayed if text is truncated. */
|
|
@@ -99,7 +101,8 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
|
|
|
99
101
|
actionClose,
|
|
100
102
|
actionLinks,
|
|
101
103
|
title,
|
|
102
|
-
titleHeadingLevel
|
|
104
|
+
titleHeadingLevel,
|
|
105
|
+
component = 'h4',
|
|
103
106
|
children = '',
|
|
104
107
|
className = '',
|
|
105
108
|
ouiaId,
|
|
@@ -126,6 +129,14 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
|
|
|
126
129
|
);
|
|
127
130
|
|
|
128
131
|
const titleRef = React.useRef(null);
|
|
132
|
+
const TitleComponent = (titleHeadingLevel || component) as any;
|
|
133
|
+
if (titleHeadingLevel !== undefined) {
|
|
134
|
+
// eslint-disable-next-line no-console
|
|
135
|
+
console.warn(
|
|
136
|
+
'Alert: titleHeadingLevel is deprecated, please use the newer component prop instead to set the alert title element.'
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
129
140
|
const divRef = React.useRef<HTMLDivElement>();
|
|
130
141
|
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
|
|
131
142
|
React.useEffect(() => {
|
|
@@ -145,12 +156,12 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
|
|
|
145
156
|
const [containsFocus, setContainsFocus] = useState<boolean | undefined>();
|
|
146
157
|
const dismissed = timedOut && timedOutAnimation && !isMouseOver && !containsFocus;
|
|
147
158
|
React.useEffect(() => {
|
|
148
|
-
|
|
149
|
-
if (
|
|
150
|
-
const timer = setTimeout(() => setTimedOut(true),
|
|
159
|
+
const calculatedTimeout = timeout === true ? 8000 : Number(timeout);
|
|
160
|
+
if (calculatedTimeout > 0) {
|
|
161
|
+
const timer = setTimeout(() => setTimedOut(true), calculatedTimeout);
|
|
151
162
|
return () => clearTimeout(timer);
|
|
152
163
|
}
|
|
153
|
-
}, []);
|
|
164
|
+
}, [timeout]);
|
|
154
165
|
React.useEffect(() => {
|
|
155
166
|
const onDocumentFocus = () => {
|
|
156
167
|
if (divRef.current) {
|
|
@@ -172,10 +183,10 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
|
|
|
172
183
|
const timer = setTimeout(() => setTimedOutAnimation(true), timeoutAnimation);
|
|
173
184
|
return () => clearTimeout(timer);
|
|
174
185
|
}
|
|
175
|
-
}, [containsFocus, isMouseOver]);
|
|
186
|
+
}, [containsFocus, isMouseOver, timeoutAnimation]);
|
|
176
187
|
React.useEffect(() => {
|
|
177
188
|
dismissed && onTimeout();
|
|
178
|
-
}, [dismissed]);
|
|
189
|
+
}, [dismissed, onTimeout]);
|
|
179
190
|
|
|
180
191
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
181
192
|
const onToggleExpand = () => {
|
|
@@ -197,13 +208,13 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
|
|
|
197
208
|
return null;
|
|
198
209
|
}
|
|
199
210
|
const Title = (
|
|
200
|
-
<
|
|
211
|
+
<TitleComponent
|
|
201
212
|
{...(isTooltipVisible && { tabIndex: 0 })}
|
|
202
213
|
ref={titleRef}
|
|
203
214
|
className={css(styles.alertTitle, truncateTitle && styles.modifiers.truncate)}
|
|
204
215
|
>
|
|
205
216
|
{getHeadingContent}
|
|
206
|
-
</
|
|
217
|
+
</TitleComponent>
|
|
207
218
|
);
|
|
208
219
|
|
|
209
220
|
return (
|
|
@@ -50,8 +50,9 @@ PatternFly supports several properties and variations that can be used to add ex
|
|
|
50
50
|
|
|
51
51
|
* As demonstrated in the 3rd and 4th variations below, use the `actionClose` property to add an `<AlertActionCloseButton>` component, which can be used to manage and customize alert dismissals. `actionClose` can be used with or without the presence of `actionLinks`.
|
|
52
52
|
|
|
53
|
-
* As demonstrated in the 5th and 6th variations below, use the `
|
|
54
|
-
|
|
53
|
+
* As demonstrated in the 5th and 6th variations below, use the `component` property to set the element for an alert title.
|
|
54
|
+
* If the `description` prop is not passed in, then the `component` prop should be set to a non-heading element such as a `span` or `div`.
|
|
55
|
+
* If the `description` prop is passed in, then the `component` prop should be a heading element. Headings should be ordered by their level and heading levels should not be skipped. For example, a heading of an `h2` level should not be followed directly by an `h4`.
|
|
55
56
|
```ts
|
|
56
57
|
import React from 'react';
|
|
57
58
|
import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
|
|
@@ -88,8 +89,10 @@ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/reac
|
|
|
88
89
|
}
|
|
89
90
|
/>
|
|
90
91
|
<Alert variant="success" title="Success alert title" actionClose={<AlertActionCloseButton onClose={() => alert('Clicked the close button')} />} />
|
|
91
|
-
<Alert variant="success" title="
|
|
92
|
-
<Alert variant="success" title="h6 Success alert title"
|
|
92
|
+
<Alert variant="success" title="div success alert title" component="div" />
|
|
93
|
+
<Alert variant="success" title="h6 Success alert title" component="h6" >
|
|
94
|
+
<p>Short alert description</p>
|
|
95
|
+
</Alert>
|
|
93
96
|
</React.Fragment>
|
|
94
97
|
```
|
|
95
98
|
### Alert timeout
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { isCustomWizardFooter, isWizardSubStep, WizardStepType, WizardFooterType } from './types';
|
|
4
4
|
import { getActiveStep } from './utils';
|
|
5
|
-
import { useGetMergedSteps } from './hooks';
|
|
6
5
|
import { WizardFooter, WizardFooterProps } from './WizardFooter';
|
|
7
6
|
|
|
8
7
|
export interface WizardContextProps {
|
|
@@ -41,7 +40,7 @@ export interface WizardContextProviderProps {
|
|
|
41
40
|
children: React.ReactElement;
|
|
42
41
|
onNext(event: React.MouseEvent<HTMLButtonElement>, steps: WizardStepType[]): void;
|
|
43
42
|
onBack(event: React.MouseEvent<HTMLButtonElement>, steps: WizardStepType[]): void;
|
|
44
|
-
onClose(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
43
|
+
onClose?(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
45
44
|
goToStepById(steps: WizardStepType[], id: number | string): void;
|
|
46
45
|
goToStepByName(steps: WizardStepType[], name: string): void;
|
|
47
46
|
goToStepByIndex(
|
|
@@ -67,10 +66,19 @@ export const WizardContextProvider: React.FunctionComponent<WizardContextProvide
|
|
|
67
66
|
const [currentFooter, setCurrentFooter] = React.useState(
|
|
68
67
|
typeof initialFooter !== 'function' ? initialFooter : undefined
|
|
69
68
|
);
|
|
70
|
-
|
|
69
|
+
|
|
70
|
+
// Combined initial and current state steps
|
|
71
|
+
const steps = React.useMemo(
|
|
72
|
+
() =>
|
|
73
|
+
currentSteps.map((currentStepProps, index) => ({
|
|
74
|
+
...currentStepProps,
|
|
75
|
+
...initialSteps[index]
|
|
76
|
+
})),
|
|
77
|
+
[initialSteps, currentSteps]
|
|
78
|
+
);
|
|
71
79
|
const activeStep = React.useMemo(() => getActiveStep(steps, activeStepIndex), [activeStepIndex, steps]);
|
|
72
80
|
|
|
73
|
-
const close = React.useCallback(() => onClose(null), [onClose]);
|
|
81
|
+
const close = React.useCallback(() => onClose?.(null), [onClose]);
|
|
74
82
|
const goToNextStep = React.useCallback(() => onNext(null, steps), [onNext, steps]);
|
|
75
83
|
const goToPrevStep = React.useCallback(() => onBack(null, steps), [onBack, steps]);
|
|
76
84
|
|
|
@@ -37,11 +37,10 @@ export interface WizardStepProps {
|
|
|
37
37
|
export const WizardStep = ({ children, steps: _subSteps, ...props }: WizardStepProps) => {
|
|
38
38
|
const { activeStep, setStep } = useWizardContext();
|
|
39
39
|
const { id, name, body, isDisabled, isHidden, navItem, footer, status } = props;
|
|
40
|
+
const isParentStep = isWizardParentStep(activeStep);
|
|
40
41
|
|
|
41
42
|
// Update step in context when props change or when the step is active has yet to be marked as visited.
|
|
42
43
|
React.useEffect(() => {
|
|
43
|
-
const shouldUpdateIsVisited = !isWizardParentStep(activeStep) && id === activeStep?.id && !activeStep?.isVisited;
|
|
44
|
-
|
|
45
44
|
setStep({
|
|
46
45
|
id,
|
|
47
46
|
name,
|
|
@@ -51,9 +50,22 @@ export const WizardStep = ({ children, steps: _subSteps, ...props }: WizardStepP
|
|
|
51
50
|
...(navItem && { navItem }),
|
|
52
51
|
...(footer && { footer }),
|
|
53
52
|
...(status && { status }),
|
|
54
|
-
...(
|
|
53
|
+
...(!isParentStep && id === activeStep?.id && !activeStep?.isVisited && { isVisited: true })
|
|
55
54
|
});
|
|
56
|
-
}, [
|
|
55
|
+
}, [
|
|
56
|
+
body,
|
|
57
|
+
footer,
|
|
58
|
+
id,
|
|
59
|
+
isDisabled,
|
|
60
|
+
isHidden,
|
|
61
|
+
name,
|
|
62
|
+
navItem,
|
|
63
|
+
status,
|
|
64
|
+
isParentStep,
|
|
65
|
+
setStep,
|
|
66
|
+
activeStep?.id,
|
|
67
|
+
activeStep?.isVisited
|
|
68
|
+
]);
|
|
57
69
|
|
|
58
70
|
return <>{children}</>;
|
|
59
71
|
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { WizardStepType } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Get stable ref of combined initial (prop provided) and current (context stored) steps.
|
|
4
|
-
* @param initialSteps
|
|
5
|
-
* @param currentSteps
|
|
6
|
-
* @returns WizardStepType[]
|
|
7
|
-
*/
|
|
8
|
-
export declare const useGetMergedSteps: (initialSteps: WizardStepType[], currentSteps: WizardStepType[]) => WizardStepType[];
|
|
9
|
-
//# sourceMappingURL=useGetMergedSteps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetMergedSteps.d.ts","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/useGetMergedSteps.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,iBAAkB,cAAc,EAAE,gBAAgB,cAAc,EAAE,KAAG,cAAc,EAkChH,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import isEqual from 'fast-deep-equal';
|
|
3
|
-
/**
|
|
4
|
-
* Get stable ref of combined initial (prop provided) and current (context stored) steps.
|
|
5
|
-
* @param initialSteps
|
|
6
|
-
* @param currentSteps
|
|
7
|
-
* @returns WizardStepType[]
|
|
8
|
-
*/
|
|
9
|
-
export const useGetMergedSteps = (initialSteps, currentSteps) => {
|
|
10
|
-
const initialStepsRef = React.useRef(initialSteps);
|
|
11
|
-
const currentStepsRef = React.useRef(currentSteps);
|
|
12
|
-
// Check each value within the array of initialSteps (props) and currentSteps (context).
|
|
13
|
-
// If any value changes for either of these, update the reference.
|
|
14
|
-
if (!isEqual(initialStepsRef.current, initialSteps)) {
|
|
15
|
-
initialStepsRef.current = initialSteps;
|
|
16
|
-
}
|
|
17
|
-
if (!isEqual(currentStepsRef.current, currentSteps)) {
|
|
18
|
-
currentStepsRef.current = currentSteps;
|
|
19
|
-
}
|
|
20
|
-
// Combine both initial and current steps, where prop provided values
|
|
21
|
-
// take precedence over what's stored in context.
|
|
22
|
-
const mergedSteps = React.useMemo(() => initialSteps.reduce((acc, initialStepProps, index) => {
|
|
23
|
-
const currentStepProps = currentSteps[index];
|
|
24
|
-
if (initialStepProps.id === currentStepProps.id) {
|
|
25
|
-
acc.push(Object.assign(Object.assign({}, currentStepProps), initialStepProps));
|
|
26
|
-
}
|
|
27
|
-
return acc;
|
|
28
|
-
}, []),
|
|
29
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
-
[initialStepsRef.current, currentStepsRef.current]);
|
|
31
|
-
return mergedSteps;
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=useGetMergedSteps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetMergedSteps.js","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/useGetMergedSteps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,iBAAiB,CAAC;AAGtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,YAA8B,EAAE,YAA8B,EAAoB,EAAE;IACpH,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACnD,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEnD,wFAAwF;IACxF,kEAAkE;IAClE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE;QACnD,eAAe,CAAC,OAAO,GAAG,YAAY,CAAC;KACxC;IACD,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE;QACnD,eAAe,CAAC,OAAO,GAAG,YAAY,CAAC;KACxC;IAED,qEAAqE;IACrE,iDAAiD;IACjD,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAC/B,GAAG,EAAE,CACH,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,EAAE;QACnD,MAAM,gBAAgB,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAE7C,IAAI,gBAAgB,CAAC,EAAE,KAAK,gBAAgB,CAAC,EAAE,EAAE;YAC/C,GAAG,CAAC,IAAI,iCACH,gBAAgB,GAChB,gBAAgB,EACnB,CAAC;SACJ;QAED,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC;IACR,uDAAuD;IACvD,CAAC,eAAe,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CACnD,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { WizardStepType } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Get stable ref of combined initial (prop provided) and current (context stored) steps.
|
|
4
|
-
* @param initialSteps
|
|
5
|
-
* @param currentSteps
|
|
6
|
-
* @returns WizardStepType[]
|
|
7
|
-
*/
|
|
8
|
-
export declare const useGetMergedSteps: (initialSteps: WizardStepType[], currentSteps: WizardStepType[]) => WizardStepType[];
|
|
9
|
-
//# sourceMappingURL=useGetMergedSteps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetMergedSteps.d.ts","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/useGetMergedSteps.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,iBAAkB,cAAc,EAAE,gBAAgB,cAAc,EAAE,KAAG,cAAc,EAkChH,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useGetMergedSteps = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const fast_deep_equal_1 = tslib_1.__importDefault(require("fast-deep-equal"));
|
|
7
|
-
/**
|
|
8
|
-
* Get stable ref of combined initial (prop provided) and current (context stored) steps.
|
|
9
|
-
* @param initialSteps
|
|
10
|
-
* @param currentSteps
|
|
11
|
-
* @returns WizardStepType[]
|
|
12
|
-
*/
|
|
13
|
-
const useGetMergedSteps = (initialSteps, currentSteps) => {
|
|
14
|
-
const initialStepsRef = react_1.default.useRef(initialSteps);
|
|
15
|
-
const currentStepsRef = react_1.default.useRef(currentSteps);
|
|
16
|
-
// Check each value within the array of initialSteps (props) and currentSteps (context).
|
|
17
|
-
// If any value changes for either of these, update the reference.
|
|
18
|
-
if (!(0, fast_deep_equal_1.default)(initialStepsRef.current, initialSteps)) {
|
|
19
|
-
initialStepsRef.current = initialSteps;
|
|
20
|
-
}
|
|
21
|
-
if (!(0, fast_deep_equal_1.default)(currentStepsRef.current, currentSteps)) {
|
|
22
|
-
currentStepsRef.current = currentSteps;
|
|
23
|
-
}
|
|
24
|
-
// Combine both initial and current steps, where prop provided values
|
|
25
|
-
// take precedence over what's stored in context.
|
|
26
|
-
const mergedSteps = react_1.default.useMemo(() => initialSteps.reduce((acc, initialStepProps, index) => {
|
|
27
|
-
const currentStepProps = currentSteps[index];
|
|
28
|
-
if (initialStepProps.id === currentStepProps.id) {
|
|
29
|
-
acc.push(Object.assign(Object.assign({}, currentStepProps), initialStepProps));
|
|
30
|
-
}
|
|
31
|
-
return acc;
|
|
32
|
-
}, []),
|
|
33
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
-
[initialStepsRef.current, currentStepsRef.current]);
|
|
35
|
-
return mergedSteps;
|
|
36
|
-
};
|
|
37
|
-
exports.useGetMergedSteps = useGetMergedSteps;
|
|
38
|
-
//# sourceMappingURL=useGetMergedSteps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetMergedSteps.js","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/useGetM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initial (prop provided) and current (context stored) steps.
|
|
4
|
-
* @param initialSteps
|
|
5
|
-
* @param currentSteps
|
|
6
|
-
* @returns WizardStepType[]
|
|
7
|
-
*/
|
|
8
|
-
export declare const useGetMergedSteps: (initialSteps: WizardStepType[], currentSteps: WizardStepType[]) => WizardStepType[];
|
|
9
|
-
//# sourceMappingURL=useGetMergedSteps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetMergedSteps.d.ts","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/useGetMergedSteps.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,iBAAkB,cAAc,EAAE,gBAAgB,cAAc,EAAE,KAAG,cAAc,EAkChH,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import isEqual from 'fast-deep-equal';
|
|
3
|
-
/**
|
|
4
|
-
* Get stable ref of combined initial (prop provided) and current (context stored) steps.
|
|
5
|
-
* @param initialSteps
|
|
6
|
-
* @param currentSteps
|
|
7
|
-
* @returns WizardStepType[]
|
|
8
|
-
*/
|
|
9
|
-
export const useGetMergedSteps = (initialSteps, currentSteps) => {
|
|
10
|
-
const initialStepsRef = React.useRef(initialSteps);
|
|
11
|
-
const currentStepsRef = React.useRef(currentSteps);
|
|
12
|
-
// Check each value within the array of initialSteps (props) and currentSteps (context).
|
|
13
|
-
// If any value changes for either of these, update the reference.
|
|
14
|
-
if (!isEqual(initialStepsRef.current, initialSteps)) {
|
|
15
|
-
initialStepsRef.current = initialSteps;
|
|
16
|
-
}
|
|
17
|
-
if (!isEqual(currentStepsRef.current, currentSteps)) {
|
|
18
|
-
currentStepsRef.current = currentSteps;
|
|
19
|
-
}
|
|
20
|
-
// Combine both initial and current steps, where prop provided values
|
|
21
|
-
// take precedence over what's stored in context.
|
|
22
|
-
const mergedSteps = React.useMemo(() => initialSteps.reduce((acc, initialStepProps, index) => {
|
|
23
|
-
const currentStepProps = currentSteps[index];
|
|
24
|
-
if (initialStepProps.id === currentStepProps.id) {
|
|
25
|
-
acc.push(Object.assign(Object.assign({}, currentStepProps), initialStepProps));
|
|
26
|
-
}
|
|
27
|
-
return acc;
|
|
28
|
-
}, []),
|
|
29
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
-
[initialStepsRef.current, currentStepsRef.current]);
|
|
31
|
-
return mergedSteps;
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=useGetMergedSteps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGetMergedSteps.js","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/useGetMergedSteps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,iBAAiB,CAAC;AAGtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,YAA8B,EAAE,YAA8B,EAAoB,EAAE;IACpH,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACnD,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEnD,wFAAwF;IACxF,kEAAkE;IAClE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE;QACnD,eAAe,CAAC,OAAO,GAAG,YAAY,CAAC;KACxC;IACD,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE;QACnD,eAAe,CAAC,OAAO,GAAG,YAAY,CAAC;KACxC;IAED,qEAAqE;IACrE,iDAAiD;IACjD,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAC/B,GAAG,EAAE,CACH,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,EAAE;QACnD,MAAM,gBAAgB,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAE7C,IAAI,gBAAgB,CAAC,EAAE,KAAK,gBAAgB,CAAC,EAAE,EAAE;YAC/C,GAAG,CAAC,IAAI,iCACH,gBAAgB,GAChB,gBAAgB,EACnB,CAAC;SACJ;QAED,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC;IACR,uDAAuD;IACvD,CAAC,eAAe,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CACnD,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import isEqual from 'fast-deep-equal';
|
|
3
|
-
import { WizardStepType } from '../types';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get stable ref of combined initial (prop provided) and current (context stored) steps.
|
|
7
|
-
* @param initialSteps
|
|
8
|
-
* @param currentSteps
|
|
9
|
-
* @returns WizardStepType[]
|
|
10
|
-
*/
|
|
11
|
-
export const useGetMergedSteps = (initialSteps: WizardStepType[], currentSteps: WizardStepType[]): WizardStepType[] => {
|
|
12
|
-
const initialStepsRef = React.useRef(initialSteps);
|
|
13
|
-
const currentStepsRef = React.useRef(currentSteps);
|
|
14
|
-
|
|
15
|
-
// Check each value within the array of initialSteps (props) and currentSteps (context).
|
|
16
|
-
// If any value changes for either of these, update the reference.
|
|
17
|
-
if (!isEqual(initialStepsRef.current, initialSteps)) {
|
|
18
|
-
initialStepsRef.current = initialSteps;
|
|
19
|
-
}
|
|
20
|
-
if (!isEqual(currentStepsRef.current, currentSteps)) {
|
|
21
|
-
currentStepsRef.current = currentSteps;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Combine both initial and current steps, where prop provided values
|
|
25
|
-
// take precedence over what's stored in context.
|
|
26
|
-
const mergedSteps = React.useMemo(
|
|
27
|
-
() =>
|
|
28
|
-
initialSteps.reduce((acc, initialStepProps, index) => {
|
|
29
|
-
const currentStepProps = currentSteps[index];
|
|
30
|
-
|
|
31
|
-
if (initialStepProps.id === currentStepProps.id) {
|
|
32
|
-
acc.push({
|
|
33
|
-
...currentStepProps,
|
|
34
|
-
...initialStepProps
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return acc;
|
|
39
|
-
}, []),
|
|
40
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
|
-
[initialStepsRef.current, currentStepsRef.current]
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
return mergedSteps;
|
|
45
|
-
};
|