Debian Codegraph @

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

raw
1 import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2 import { Fragment } from 'react';
3 import { css } from '@patternfly/react-styles';
4 import styles from '@patternfly/react-styles/css/components/Wizard/wizard.mjs';
5 import RhMicronsCaretRightIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-right-icon';
6 import RhMicronsCaretDownIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-down-icon';
7 import { WizardBody } from './WizardBody';
8 export const WizardToggle = ({ isNavOpen, onNavToggle, nav, steps, activeStep, children, hasNoBodyPadding = false, 'aria-label': ariaLabel = 'Wizard Toggle', mainAriaLabelledBy = null, mainAriaLabel = null, isInPage = true, hasDrawer, isDrawerExpanded, onExpandDrawer }) => {
9 let activeStepIndex;
10 let activeStepName;
11 let activeStepSubName;
12 for (let i = 0; i < steps.length; i++) {
13 if ((activeStep.id && steps[i].id === activeStep.id) || steps[i].name === activeStep.name) {
14 activeStepIndex = i + 1;
15 activeStepName = steps[i].name;
16 break;
17 }
18 else if (steps[i].steps) {
19 for (const step of steps[i].steps) {
20 if ((activeStep.id && step.id === activeStep.id) || step.name === activeStep.name) {
21 activeStepIndex = i + 1;
22 activeStepName = steps[i].name;
23 activeStepSubName = step.name;
24 break;
25 }
26 }
27 }
28 }
29 return (_jsxs(Fragment, { children: [_jsxs("button", { onClick: () => onNavToggle(!isNavOpen), className: css(styles.wizardToggle, isNavOpen && 'pf-m-expanded'), "aria-label": ariaLabel, "aria-expanded": isNavOpen, children: [_jsxs("span", { className: css(styles.wizardToggleList), children: [_jsxs("span", { className: css(styles.wizardToggleListItem), children: [_jsx("span", { className: css(styles.wizardToggleNum), children: activeStepIndex }), " ", activeStepName, activeStepSubName && (_jsx("span", { className: css(styles.wizardToggleSeparator), children: _jsx(RhMicronsCaretRightIcon, {}) }))] }), activeStepSubName && _jsx("span", { className: css(styles.wizardToggleListItem), children: activeStepSubName })] }), _jsx("span", { className: css(styles.wizardToggleIcon), children: _jsx(RhMicronsCaretDownIcon, {}) })] }), _jsxs("div", { className: css(styles.wizardOuterWrap), children: [_jsxs("div", { className: css(styles.wizardInnerWrap), children: [nav(isNavOpen), _jsxs(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] })] }));
30 };
31 WizardToggle.displayName = 'WizardToggle';
32 //# sourceMappingURL=WizardToggle.js.map