Debian Codegraph @

node/@patternfly/react-core/dist/js/components/Wizard/WizardStep.js

raw
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.WizardStep = void 0;
4 const tslib_1 = require("tslib");
5 const jsx_runtime_1 = require("react/jsx-runtime");
6 const react_1 = require("react");
7 const types_1 = require("./types");
8 const WizardContext_1 = require("./WizardContext");
9 const WizardStep = (_a) => {
10 var { children, steps: _subSteps } = _a, props = tslib_1.__rest(_a, ["children", "steps"]);
11 const { activeStep, setStep } = (0, WizardContext_1.useWizardContext)();
12 const { id, name, body, isDisabled, isHidden, navItem, footer, status } = props;
13 const isParentStep = (0, types_1.isWizardParentStep)(activeStep);
14 // Update step in context when props change or when the step is active has yet to be marked as visited.
15 (0, react_1.useEffect)(() => {
16 setStep(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id,
17 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 })));
18 }, [
19 body,
20 footer,
21 id,
22 isDisabled,
23 isHidden,
24 name,
25 navItem,
26 status,
27 isParentStep,
28 setStep,
29 activeStep === null || activeStep === void 0 ? void 0 : activeStep.id,
30 activeStep === null || activeStep === void 0 ? void 0 : activeStep.isVisited
31 ]);
32 return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
33 };
34 exports.WizardStep = WizardStep;
35 exports.WizardStep.displayName = 'WizardStep';
36 //# sourceMappingURL=WizardStep.js.map