Debian Codegraph @

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

raw
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.WizardToggle = 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 react_styles_1 = require("@patternfly/react-styles");
8 const wizard_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/Wizard/wizard"));
9 const rh_microns_caret_right_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/rh-microns-caret-right-icon'));
10 const rh_microns_caret_down_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/rh-microns-caret-down-icon'));
11 const WizardBody_1 = require("./WizardBody");
12 const WizardToggle = ({ isNavOpen, onNavToggle, nav, steps, activeStep, children, hasNoBodyPadding = false, 'aria-label': ariaLabel = 'Wizard Toggle', mainAriaLabelledBy = null, mainAriaLabel = null, isInPage = true, hasDrawer, isDrawerExpanded, onExpandDrawer }) => {
13 let activeStepIndex;
14 let activeStepName;
15 let activeStepSubName;
16 for (let i = 0; i < steps.length; i++) {
17 if ((activeStep.id && steps[i].id === activeStep.id) || steps[i].name === activeStep.name) {
18 activeStepIndex = i + 1;
19 activeStepName = steps[i].name;
20 break;
21 }
22 else if (steps[i].steps) {
23 for (const step of steps[i].steps) {
24 if ((activeStep.id && step.id === activeStep.id) || step.name === activeStep.name) {
25 activeStepIndex = i + 1;
26 activeStepName = steps[i].name;
27 activeStepSubName = step.name;
28 break;
29 }
30 }
31 }
32 }
33 return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => onNavToggle(!isNavOpen), className: (0, react_styles_1.css)(wizard_1.default.wizardToggle, isNavOpen && 'pf-m-expanded'), "aria-label": ariaLabel, "aria-expanded": isNavOpen, children: [(0, jsx_runtime_1.jsxs)("span", { className: (0, react_styles_1.css)(wizard_1.default.wizardToggleList), children: [(0, jsx_runtime_1.jsxs)("span", { className: (0, react_styles_1.css)(wizard_1.default.wizardToggleListItem), children: [(0, jsx_runtime_1.jsx)("span", { className: (0, react_styles_1.css)(wizard_1.default.wizardToggleNum), children: activeStepIndex }), " ", activeStepName, activeStepSubName && ((0, jsx_runtime_1.jsx)("span", { className: (0, react_styles_1.css)(wizard_1.default.wizardToggleSeparator), children: (0, jsx_runtime_1.jsx)(rh_microns_caret_right_icon_1.default, {}) }))] }), activeStepSubName && (0, jsx_runtime_1.jsx)("span", { className: (0, react_styles_1.css)(wizard_1.default.wizardToggleListItem), children: activeStepSubName })] }), (0, jsx_runtime_1.jsx)("span", { className: (0, react_styles_1.css)(wizard_1.default.wizardToggleIcon), children: (0, jsx_runtime_1.jsx)(rh_microns_caret_down_icon_1.default, {}) })] }), (0, jsx_runtime_1.jsxs)("div", { className: (0, react_styles_1.css)(wizard_1.default.wizardOuterWrap), children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, react_styles_1.css)(wizard_1.default.wizardInnerWrap), children: [nav(isNavOpen), (0, jsx_runtime_1.jsxs)(WizardBody_1.WizardBody, { mainComponent: isInPage ? 'div' : 'main', "aria-label": mainAriaLabel, "aria-labelledby": mainAriaLabelledBy, hasNoBodyPadding: hasNoBodyPadding, activeStep: activeStep, isDrawerExpanded: isDrawerExpanded, onExpandDrawer: onExpandDrawer, hasDrawer: hasDrawer, children: [hasDrawer && !isDrawerExpanded && activeStep.drawerToggleButton, activeStep.component] })] }), children] })] }));
34 };
35 exports.WizardToggle = WizardToggle;
36 exports.WizardToggle.displayName = 'WizardToggle';
37 //# sourceMappingURL=WizardToggle.js.map