@patternfly/react-core 4.248.0 → 4.250.0
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 +28 -0
- package/dist/esm/components/Icon/Icon.d.ts +25 -0
- package/dist/esm/components/Icon/Icon.d.ts.map +1 -0
- package/dist/esm/components/Icon/Icon.js +14 -0
- package/dist/esm/components/Icon/Icon.js.map +1 -0
- package/dist/esm/components/Icon/index.d.ts +2 -0
- package/dist/esm/components/Icon/index.d.ts.map +1 -0
- package/dist/esm/components/Icon/index.js +2 -0
- package/dist/esm/components/Icon/index.js.map +1 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/next/components/Select/Select.d.ts +28 -0
- package/dist/esm/next/components/Select/Select.d.ts.map +1 -0
- package/dist/esm/next/components/Select/Select.js +62 -0
- package/dist/esm/next/components/Select/Select.js.map +1 -0
- package/dist/esm/next/components/Select/SelectGroup.d.ts +12 -0
- package/dist/esm/next/components/Select/SelectGroup.d.ts.map +1 -0
- package/dist/esm/next/components/Select/SelectGroup.js +10 -0
- package/dist/esm/next/components/Select/SelectGroup.js.map +1 -0
- package/dist/esm/next/components/Select/SelectList.d.ts +10 -0
- package/dist/esm/next/components/Select/SelectList.d.ts.map +1 -0
- package/dist/esm/next/components/Select/SelectList.js +10 -0
- package/dist/esm/next/components/Select/SelectList.js.map +1 -0
- package/dist/esm/next/components/Select/SelectOption.d.ts +20 -0
- package/dist/esm/next/components/Select/SelectOption.d.ts.map +1 -0
- package/dist/esm/next/components/Select/SelectOption.js +10 -0
- package/dist/esm/next/components/Select/SelectOption.js.map +1 -0
- package/dist/esm/next/components/Select/index.d.ts +5 -0
- package/dist/esm/next/components/Select/index.d.ts.map +1 -0
- package/dist/esm/next/components/Select/index.js +5 -0
- package/dist/esm/next/components/Select/index.js.map +1 -0
- package/dist/esm/next/components/Wizard/Wizard.d.ts +9 -7
- package/dist/esm/next/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/Wizard.js +62 -48
- package/dist/esm/next/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardBody.d.ts +2 -2
- package/dist/esm/next/components/Wizard/WizardBody.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardBody.js +1 -1
- package/dist/esm/next/components/Wizard/WizardBody.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardContext.d.ts +21 -20
- package/dist/esm/next/components/Wizard/WizardContext.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardContext.js +63 -32
- package/dist/esm/next/components/Wizard/WizardContext.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardFooter.d.ts +20 -6
- package/dist/esm/next/components/Wizard/WizardFooter.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardFooter.js +13 -4
- package/dist/esm/next/components/Wizard/WizardFooter.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardHeader.d.ts +1 -1
- package/dist/esm/next/components/Wizard/WizardHeader.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardHeader.js +2 -2
- package/dist/esm/next/components/Wizard/WizardHeader.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardNav.d.ts +5 -5
- package/dist/esm/next/components/Wizard/WizardNav.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardNav.js +3 -4
- package/dist/esm/next/components/Wizard/WizardNav.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardNavInternal.d.ts +14 -0
- package/dist/esm/next/components/Wizard/WizardNavInternal.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/WizardNavInternal.js +49 -0
- package/dist/esm/next/components/Wizard/WizardNavInternal.js.map +1 -0
- package/dist/esm/next/components/Wizard/WizardNavItem.d.ts +12 -8
- package/dist/esm/next/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardNavItem.js +23 -12
- package/dist/esm/next/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardStep.d.ts +22 -6
- package/dist/esm/next/components/Wizard/WizardStep.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardStep.js +20 -1
- package/dist/esm/next/components/Wizard/WizardStep.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardToggle.d.ts +9 -15
- package/dist/esm/next/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardToggle.js +15 -50
- package/dist/esm/next/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/esm/next/components/Wizard/hooks/useWizardFooter.d.ts +2 -2
- package/dist/esm/next/components/Wizard/hooks/useWizardFooter.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/hooks/useWizardFooter.js +3 -3
- package/dist/esm/next/components/Wizard/hooks/useWizardFooter.js.map +1 -1
- package/dist/esm/next/components/Wizard/types.d.ts +37 -46
- package/dist/esm/next/components/Wizard/types.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/types.js +10 -2
- package/dist/esm/next/components/Wizard/types.js.map +1 -1
- package/dist/esm/next/components/Wizard/utils.d.ts +4 -5
- package/dist/esm/next/components/Wizard/utils.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/utils.js +20 -13
- package/dist/esm/next/components/Wizard/utils.js.map +1 -1
- package/dist/esm/next/components/index.d.ts +2 -1
- package/dist/esm/next/components/index.d.ts.map +1 -1
- package/dist/esm/next/components/index.js +2 -1
- package/dist/esm/next/components/index.js.map +1 -1
- package/dist/js/components/Icon/Icon.d.ts +25 -0
- package/dist/js/components/Icon/Icon.d.ts.map +1 -0
- package/dist/js/components/Icon/Icon.js +18 -0
- package/dist/js/components/Icon/Icon.js.map +1 -0
- package/dist/js/components/Icon/index.d.ts +2 -0
- package/dist/js/components/Icon/index.d.ts.map +1 -0
- package/dist/js/components/Icon/index.js +5 -0
- package/dist/js/components/Icon/index.js.map +1 -0
- package/dist/js/components/index.d.ts +1 -0
- package/dist/js/components/index.d.ts.map +1 -1
- package/dist/js/components/index.js +1 -0
- package/dist/js/components/index.js.map +1 -1
- package/dist/js/next/components/Select/Select.d.ts +28 -0
- package/dist/js/next/components/Select/Select.d.ts.map +1 -0
- package/dist/js/next/components/Select/Select.js +65 -0
- package/dist/js/next/components/Select/Select.js.map +1 -0
- package/dist/js/next/components/Select/SelectGroup.d.ts +12 -0
- package/dist/js/next/components/Select/SelectGroup.d.ts.map +1 -0
- package/dist/js/next/components/Select/SelectGroup.js +14 -0
- package/dist/js/next/components/Select/SelectGroup.js.map +1 -0
- package/dist/js/next/components/Select/SelectList.d.ts +10 -0
- package/dist/js/next/components/Select/SelectList.d.ts.map +1 -0
- package/dist/js/next/components/Select/SelectList.js +14 -0
- package/dist/js/next/components/Select/SelectList.js.map +1 -0
- package/dist/js/next/components/Select/SelectOption.d.ts +20 -0
- package/dist/js/next/components/Select/SelectOption.d.ts.map +1 -0
- package/dist/js/next/components/Select/SelectOption.js +14 -0
- package/dist/js/next/components/Select/SelectOption.js.map +1 -0
- package/dist/js/next/components/Select/index.d.ts +5 -0
- package/dist/js/next/components/Select/index.d.ts.map +1 -0
- package/dist/js/next/components/Select/index.js +8 -0
- package/dist/js/next/components/Select/index.js.map +1 -0
- package/dist/js/next/components/Wizard/Wizard.d.ts +9 -7
- package/dist/js/next/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/Wizard.js +59 -45
- package/dist/js/next/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardBody.d.ts +2 -2
- package/dist/js/next/components/Wizard/WizardBody.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardBody.js +1 -1
- package/dist/js/next/components/Wizard/WizardBody.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardContext.d.ts +21 -20
- package/dist/js/next/components/Wizard/WizardContext.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardContext.js +61 -30
- package/dist/js/next/components/Wizard/WizardContext.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardFooter.d.ts +20 -6
- package/dist/js/next/components/Wizard/WizardFooter.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardFooter.js +15 -6
- package/dist/js/next/components/Wizard/WizardFooter.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardHeader.d.ts +1 -1
- package/dist/js/next/components/Wizard/WizardHeader.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardHeader.js +2 -2
- package/dist/js/next/components/Wizard/WizardHeader.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardNav.d.ts +5 -5
- package/dist/js/next/components/Wizard/WizardNav.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardNav.js +3 -4
- package/dist/js/next/components/Wizard/WizardNav.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardNavInternal.d.ts +14 -0
- package/dist/js/next/components/Wizard/WizardNavInternal.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/WizardNavInternal.js +54 -0
- package/dist/js/next/components/Wizard/WizardNavInternal.js.map +1 -0
- package/dist/js/next/components/Wizard/WizardNavItem.d.ts +12 -8
- package/dist/js/next/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardNavItem.js +23 -12
- package/dist/js/next/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardStep.d.ts +22 -6
- package/dist/js/next/components/Wizard/WizardStep.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardStep.js +20 -1
- package/dist/js/next/components/Wizard/WizardStep.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardToggle.d.ts +9 -15
- package/dist/js/next/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardToggle.js +15 -51
- package/dist/js/next/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/js/next/components/Wizard/hooks/useWizardFooter.d.ts +2 -2
- package/dist/js/next/components/Wizard/hooks/useWizardFooter.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/hooks/useWizardFooter.js +3 -3
- package/dist/js/next/components/Wizard/hooks/useWizardFooter.js.map +1 -1
- package/dist/js/next/components/Wizard/types.d.ts +37 -46
- package/dist/js/next/components/Wizard/types.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/types.js +12 -3
- package/dist/js/next/components/Wizard/types.js.map +1 -1
- package/dist/js/next/components/Wizard/utils.d.ts +4 -5
- package/dist/js/next/components/Wizard/utils.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/utils.js +24 -15
- package/dist/js/next/components/Wizard/utils.js.map +1 -1
- package/dist/js/next/components/index.d.ts +2 -1
- package/dist/js/next/components/index.d.ts.map +1 -1
- package/dist/js/next/components/index.js +2 -1
- package/dist/js/next/components/index.js.map +1 -1
- package/dist/umd/react-core.min.css +337 -200
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Icon/Icon.tsx +66 -0
- package/src/components/Icon/__tests__/Icon.test.tsx +196 -0
- package/src/components/Icon/__tests__/__snapshots__/Icon.test.tsx.snap +82 -0
- package/src/components/Icon/examples/Icon.md +61 -0
- package/src/components/Icon/examples/IconBasic.tsx +23 -0
- package/src/components/Icon/examples/IconContentSizes.tsx +20 -0
- package/src/components/Icon/examples/IconCustomProgress.tsx +24 -0
- package/src/components/Icon/examples/IconInline.tsx +62 -0
- package/src/components/Icon/examples/IconProgress.tsx +24 -0
- package/src/components/Icon/examples/IconSizes.tsx +20 -0
- package/src/components/Icon/examples/IconStatus.tsx +27 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/index.ts +1 -0
- package/src/next/components/Select/Select.tsx +129 -0
- package/src/next/components/Select/SelectGroup.tsx +24 -0
- package/src/next/components/Select/SelectList.tsx +21 -0
- package/src/next/components/Select/SelectOption.tsx +31 -0
- package/src/next/components/Select/examples/Select.md +37 -0
- package/src/next/components/Select/examples/SelectBasic.tsx +54 -0
- package/src/next/components/Select/examples/SelectCheckbox.tsx +67 -0
- package/src/next/components/Select/examples/SelectGrouped.tsx +63 -0
- package/src/next/components/Select/examples/SelectMultiTypeahead.tsx +195 -0
- package/src/next/components/Select/examples/SelectTypeahead.tsx +191 -0
- package/src/next/components/Select/index.ts +4 -0
- package/src/next/components/Wizard/Wizard.tsx +107 -64
- package/src/next/components/Wizard/WizardBody.tsx +4 -4
- package/src/next/components/Wizard/WizardContext.tsx +117 -65
- package/src/next/components/Wizard/WizardFooter.tsx +39 -17
- package/src/next/components/Wizard/WizardHeader.tsx +6 -3
- package/src/next/components/Wizard/WizardNav.tsx +9 -10
- package/src/next/components/Wizard/WizardNavInternal.tsx +137 -0
- package/src/next/components/Wizard/WizardNavItem.tsx +47 -20
- package/src/next/components/Wizard/WizardStep.tsx +52 -7
- package/src/next/components/Wizard/WizardToggle.tsx +24 -142
- package/src/next/components/Wizard/__tests__/Wizard.test.tsx +10 -13
- package/src/next/components/Wizard/__tests__/WizardBody.test.tsx +3 -3
- package/src/next/components/Wizard/__tests__/WizardFooter.test.tsx +11 -14
- package/src/next/components/Wizard/__tests__/WizardStep.test.tsx +100 -0
- package/src/next/components/Wizard/__tests__/WizardToggle.test.tsx +4 -4
- package/src/next/components/Wizard/examples/Wizard.md +40 -15
- package/src/next/components/Wizard/examples/WizardBasic.tsx +2 -2
- package/src/next/components/Wizard/examples/WizardCustomNav.tsx +4 -4
- package/src/next/components/Wizard/examples/WizardKitchenSink.tsx +126 -60
- package/src/next/components/Wizard/hooks/__tests__/useWizardFooter.test.tsx +23 -34
- package/src/next/components/Wizard/hooks/useWizardFooter.tsx +5 -5
- package/src/next/components/Wizard/types.tsx +59 -53
- package/src/next/components/Wizard/utils.ts +25 -16
- package/src/next/components/index.ts +2 -1
|
@@ -5,10 +5,9 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const wizard_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/Wizard/wizard"));
|
|
7
7
|
const react_styles_1 = require("@patternfly/react-styles");
|
|
8
|
-
const WizardNav = ({ children, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, isExpanded = false,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return innerList;
|
|
8
|
+
const WizardNav = ({ children, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, isExpanded = false, isInnerList = false }) => {
|
|
9
|
+
if (isInnerList) {
|
|
10
|
+
return React.createElement("ol", { className: react_styles_1.css(wizard_1.default.wizardNavList) }, children);
|
|
12
11
|
}
|
|
13
12
|
return (React.createElement("nav", { className: react_styles_1.css(wizard_1.default.wizardNav, isExpanded && wizard_1.default.modifiers.expanded), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy },
|
|
14
13
|
React.createElement("ol", { className: react_styles_1.css(wizard_1.default.wizardNavList) }, children)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardNav.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardNav.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,2GAA2E;AAC3E,2DAA+C;AAexC,MAAM,SAAS,GAA4C,CAAC,EACjE,QAAQ,EACR,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,UAAU,GAAG,KAAK,EAClB,
|
|
1
|
+
{"version":3,"file":"WizardNav.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardNav.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,2GAA2E;AAC3E,2DAA+C;AAexC,MAAM,SAAS,GAA4C,CAAC,EACjE,QAAQ,EACR,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,KAAK,EACJ,EAAE,EAAE;IACnB,IAAI,WAAW,EAAE;QACf,OAAO,4BAAI,SAAS,EAAE,kBAAG,CAAC,gBAAM,CAAC,aAAa,CAAC,IAAG,QAAQ,CAAM,CAAC;KAClE;IAED,OAAO,CACL,6BACE,SAAS,EAAE,kBAAG,CAAC,gBAAM,CAAC,SAAS,EAAE,UAAU,IAAI,gBAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,gBAC7D,SAAS,qBACJ,cAAc;QAE/B,4BAAI,SAAS,EAAE,kBAAG,CAAC,gBAAM,CAAC,aAAa,CAAC,IAAG,QAAQ,CAAM,CACrD,CACP,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,SAAS,aAoBpB;AAEF,iBAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WizardProps } from './Wizard';
|
|
3
|
+
import { WizardNavProps } from './WizardNav';
|
|
4
|
+
/**
|
|
5
|
+
* Hosts deafult wizard navigation logic by utilizing the wizard's context and WizardNav/WizardNavItem.
|
|
6
|
+
* This component is not exposed to consumers.
|
|
7
|
+
*/
|
|
8
|
+
interface WizardNavInternalProps extends Pick<WizardProps, 'isStepVisitRequired'> {
|
|
9
|
+
nav: Partial<WizardNavProps>;
|
|
10
|
+
isNavExpanded: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const WizardNavInternal: ({ nav, isStepVisitRequired, isNavExpanded }: WizardNavInternalProps) => JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=WizardNavInternal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardNavInternal.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardNavInternal.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAa,cAAc,EAAE,MAAM,aAAa,CAAC;AAGxD;;;GAGG;AAEH,UAAU,sBAAuB,SAAQ,IAAI,CAAC,WAAW,EAAE,qBAAqB,CAAC;IAC/E,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,gDAAiD,sBAAsB,gBAsHpG,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WizardNavInternal = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
const WizardContext_1 = require("./WizardContext");
|
|
8
|
+
const WizardNav_1 = require("./WizardNav");
|
|
9
|
+
const WizardNavItem_1 = require("./WizardNavItem");
|
|
10
|
+
const WizardNavInternal = ({ nav, isStepVisitRequired, isNavExpanded }) => {
|
|
11
|
+
const { currentStep, steps, goToStepByIndex } = WizardContext_1.useWizardContext();
|
|
12
|
+
const wizardNavProps = Object.assign({ isExpanded: isNavExpanded, 'aria-label': (nav === null || nav === void 0 ? void 0 : nav['aria-label']) || 'Wizard steps' }, ((nav === null || nav === void 0 ? void 0 : nav['aria-labelledby']) && {
|
|
13
|
+
'aria-labelledby': nav['aria-labelledby']
|
|
14
|
+
}));
|
|
15
|
+
return (react_1.default.createElement(WizardNav_1.WizardNav, Object.assign({}, wizardNavProps), steps.map((step, index) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const stepIndex = index + 1;
|
|
18
|
+
const customStepNavItem = types_1.isCustomWizardNavItem(step.navItem) && (react_1.default.createElement(react_1.default.Fragment, { key: step.id }, typeof step.navItem === 'function'
|
|
19
|
+
? step.navItem(step, currentStep, steps, goToStepByIndex)
|
|
20
|
+
: step.navItem));
|
|
21
|
+
if (types_1.isWizardParentStep(step) && !step.isHidden) {
|
|
22
|
+
let firstSubStepIndex;
|
|
23
|
+
let hasActiveChild = false;
|
|
24
|
+
const subNavItems = (_a = step.subStepIds) === null || _a === void 0 ? void 0 : _a.map((subStepId, subStepIndex) => {
|
|
25
|
+
const subStep = steps.find(step => step.id === subStepId);
|
|
26
|
+
const subStepOrderIndex = steps.indexOf(subStep) + 1;
|
|
27
|
+
const customSubStepNavItem = types_1.isCustomWizardNavItem(subStep.navItem) && (react_1.default.createElement(react_1.default.Fragment, { key: subStep.id }, typeof subStep.navItem === 'function'
|
|
28
|
+
? subStep.navItem(subStep, currentStep, steps, goToStepByIndex)
|
|
29
|
+
: subStep.navItem));
|
|
30
|
+
// Don't render the sub-step navigation item if the hidden property is enabled
|
|
31
|
+
if (subStep.isHidden) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// Store the first sub-step index so that when its parent is clicked, the first sub-step is focused
|
|
35
|
+
if (subStepIndex === 0) {
|
|
36
|
+
firstSubStepIndex = subStepOrderIndex;
|
|
37
|
+
}
|
|
38
|
+
// When a sub-step is active, use this flag to set the parent step as active (isCurrent)
|
|
39
|
+
if ((currentStep === null || currentStep === void 0 ? void 0 : currentStep.id) === subStep.id) {
|
|
40
|
+
hasActiveChild = true;
|
|
41
|
+
}
|
|
42
|
+
return (customSubStepNavItem || (react_1.default.createElement(WizardNavItem_1.WizardNavItem, Object.assign({ key: subStep.id, id: subStep.id, content: subStep.name, isCurrent: (currentStep === null || currentStep === void 0 ? void 0 : currentStep.id) === subStep.id, isDisabled: subStep.isDisabled || (isStepVisitRequired && !subStep.isVisited), isVisited: subStep.isVisited, stepIndex: subStepOrderIndex, onNavItemClick: goToStepByIndex, status: subStep.status }, subStep.navItem))));
|
|
43
|
+
});
|
|
44
|
+
const hasEnabledChildren = react_1.default.Children.toArray(subNavItems).some(child => react_1.default.isValidElement(child) && !child.props.isDisabled);
|
|
45
|
+
return (customStepNavItem || (react_1.default.createElement(WizardNavItem_1.WizardNavItem, Object.assign({ key: step.id, id: step.id, content: step.name, isExpandable: true, isCurrent: hasActiveChild, isDisabled: !hasEnabledChildren, isVisited: step.isVisited, stepIndex: firstSubStepIndex, onNavItemClick: goToStepByIndex, status: step.status }, step.navItem),
|
|
46
|
+
react_1.default.createElement(WizardNav_1.WizardNav, Object.assign({}, wizardNavProps, { isInnerList: true }), subNavItems))));
|
|
47
|
+
}
|
|
48
|
+
if (types_1.isWizardBasicStep(step) && !step.isHidden) {
|
|
49
|
+
return (customStepNavItem || (react_1.default.createElement(WizardNavItem_1.WizardNavItem, Object.assign({ key: step.id, id: step.id, content: step.name, isCurrent: (currentStep === null || currentStep === void 0 ? void 0 : currentStep.id) === step.id, isDisabled: step.isDisabled || (isStepVisitRequired && !step.isVisited), isVisited: step.isVisited, stepIndex: stepIndex, onNavItemClick: goToStepByIndex, status: step.status }, step.navItem))));
|
|
50
|
+
}
|
|
51
|
+
})));
|
|
52
|
+
};
|
|
53
|
+
exports.WizardNavInternal = WizardNavInternal;
|
|
54
|
+
//# sourceMappingURL=WizardNavInternal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardNavInternal.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardNavInternal.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,mCAAuF;AAEvF,mDAAmD;AACnD,2CAAwD;AACxD,mDAAgD;AAYzC,MAAM,iBAAiB,GAAG,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,aAAa,EAA0B,EAAE,EAAE;IACvG,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,gCAAgB,EAAE,CAAC;IAEnE,MAAM,cAAc,mBAClB,UAAU,EAAE,aAAa,EACzB,YAAY,EAAE,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAG,YAAY,CAAC,KAAI,cAAc,IAChD,CAAC,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAG,iBAAiB,CAAC,KAAI;QAC9B,iBAAiB,EAAE,GAAG,CAAC,iBAAiB,CAAC;KAC1C,CAAC,CACH,CAAC;IAEF,OAAO,CACL,8BAAC,qBAAS,oBAA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AE,IAAI,EAClB,SAAS,EAAE,cAAc,EACzB,UAAU,EAAE,CAAC,kBAAkB,EAC/B,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,SAAS,EAAE,iBAAiB,EAC5B,cAAc,EAAE,eAAe,EAC/B,MAAM,EAAE,IAAI,CAAC,MAAM,IACf,IAAI,CAAC,OAAO;gBAEhB,8BAAC,qBAAS,oBAAK,cAAc,IAAE,WAAW,WACvC,WAAW,CACF,CACE,CACjB,CACF,CAAC;SACH;QAED,IAAI,yBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAC7C,OAAO,CACL,iBAAiB,IAAI,CACnB,8BAAC,6BAAa,kBACZ,GAAG,EAAE,IAAI,CAAC,EAAE,EACZ,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,OAAO,EAAE,IAAI,CAAC,IAAI,EAClB,SAAS,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,EAAE,MAAK,IAAI,CAAC,EAAE,EACtC,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,CAAC,mBAAmB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EACvE,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,eAAe,EAC/B,MAAM,EAAE,IAAI,CAAC,MAAM,IACf,IAAI,CAAC,OAAO,EAChB,CACH,CACF,CAAC;SACH;IACH,CAAC,CAAC,CACQ,CACb,CAAC;AACJ,CAAC,CAAC;AAtHW,QAAA,iBAAiB,qBAsH5B"}
|
|
@@ -2,24 +2,28 @@ import * as React from 'react';
|
|
|
2
2
|
export interface WizardNavItemProps {
|
|
3
3
|
/** Can nest a WizardNav component for substeps */
|
|
4
4
|
children?: React.ReactNode;
|
|
5
|
-
/** The content to display in the
|
|
5
|
+
/** The content to display in the navigation item */
|
|
6
6
|
content?: React.ReactNode;
|
|
7
|
-
/** Whether the
|
|
7
|
+
/** Whether the navigation item is the currently active item */
|
|
8
8
|
isCurrent?: boolean;
|
|
9
|
-
/** Whether the
|
|
9
|
+
/** Whether the navigation item is disabled */
|
|
10
10
|
isDisabled?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
|
|
11
|
+
/** Whether the navigation item has been visited */
|
|
12
|
+
isVisited?: boolean;
|
|
13
|
+
/** The step index passed into the onNavItemClick callback */
|
|
14
|
+
stepIndex: number;
|
|
15
|
+
/** Callback for when the navigation item is clicked */
|
|
16
|
+
onNavItemClick?: (stepIndex: number) => any;
|
|
15
17
|
/** Component used to render WizardNavItem */
|
|
16
18
|
navItemComponent?: 'button' | 'a';
|
|
17
19
|
/** An optional url to use for when using an anchor component */
|
|
18
20
|
href?: string;
|
|
19
21
|
/** Flag indicating that this NavItem has child steps and is expandable */
|
|
20
22
|
isExpandable?: boolean;
|
|
21
|
-
/** The id for the
|
|
23
|
+
/** The id for the navigation item */
|
|
22
24
|
id?: string | number;
|
|
25
|
+
/** Used to determine the icon displayed next to content. Default has no icon. */
|
|
26
|
+
status?: 'default' | 'error';
|
|
23
27
|
}
|
|
24
28
|
export declare const WizardNavItem: React.FunctionComponent<WizardNavItemProps>;
|
|
25
29
|
//# sourceMappingURL=WizardNavItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardNavItem.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardNavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"WizardNavItem.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardNavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,WAAW,kBAAkB;IACjC,kDAAkD;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,oDAAoD;IACpD,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,GAAG,CAAC;IAC5C,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,QAAQ,GAAG,GAAG,CAAC;IAClC,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qCAAqC;IACrC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,iFAAiF;IACjF,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,CA8FrE,CAAC"}
|
|
@@ -6,8 +6,10 @@ const React = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const react_styles_1 = require("@patternfly/react-styles");
|
|
7
7
|
const wizard_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/Wizard/wizard"));
|
|
8
8
|
const angle_right_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/angle-right-icon'));
|
|
9
|
+
const exclamation_circle_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/exclamation-circle-icon'));
|
|
10
|
+
const types_1 = require("./types");
|
|
9
11
|
const WizardNavItem = (_a) => {
|
|
10
|
-
var { children = null, content = '', isCurrent = false, isDisabled = false,
|
|
12
|
+
var { children = null, content = '', isCurrent = false, isDisabled = false, isVisited = false, stepIndex, onNavItemClick = () => undefined, navItemComponent = 'button', href = null, isExpandable = false, id, status = 'default' } = _a, rest = tslib_1.__rest(_a, ["children", "content", "isCurrent", "isDisabled", "isVisited", "stepIndex", "onNavItemClick", "navItemComponent", "href", "isExpandable", "id", "status"]);
|
|
11
13
|
const NavItemComponent = navItemComponent;
|
|
12
14
|
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
13
15
|
React.useEffect(() => {
|
|
@@ -17,22 +19,31 @@ const WizardNavItem = (_a) => {
|
|
|
17
19
|
// eslint-disable-next-line no-console
|
|
18
20
|
console.error('WizardNavItem: When using an anchor, please provide an href');
|
|
19
21
|
}
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const ariaLabel = React.useMemo(() => {
|
|
23
|
+
if (status === types_1.WizardNavItemStatus.Error || (isVisited && !isCurrent)) {
|
|
24
|
+
let label = content.toString();
|
|
25
|
+
if (status === types_1.WizardNavItemStatus.Error) {
|
|
26
|
+
label += `, ${status}`;
|
|
27
|
+
}
|
|
28
|
+
// No need to signify step is visited if current
|
|
29
|
+
if (isVisited && !isCurrent) {
|
|
30
|
+
label += ', visited';
|
|
31
|
+
}
|
|
32
|
+
return label;
|
|
33
|
+
}
|
|
34
|
+
}, [content, isCurrent, isVisited, status]);
|
|
27
35
|
return (React.createElement("li", { className: react_styles_1.css(wizard_1.default.wizardNavItem, isExpandable && wizard_1.default.modifiers.expandable, isExpandable && isExpanded && wizard_1.default.modifiers.expanded) },
|
|
28
|
-
React.createElement(NavItemComponent, Object.assign({}, rest, (navItemComponent === 'a' ?
|
|
36
|
+
React.createElement(NavItemComponent, Object.assign({}, rest, (navItemComponent === 'a' ? { tabIndex: isDisabled ? -1 : undefined, href } : { disabled: isDisabled }), (id && { id: id.toString() }), { onClick: e => {
|
|
29
37
|
e.preventDefault();
|
|
30
|
-
isExpandable ? setIsExpanded(!isExpanded || isCurrent) : onNavItemClick(
|
|
31
|
-
}, className: react_styles_1.css(wizard_1.default.wizardNavLink, isCurrent && wizard_1.default.modifiers.current, isDisabled && wizard_1.default.modifiers.disabled), "aria-disabled": isDisabled ? true : null, "aria-current": isCurrent && !children ? 'step' : false }, (isExpandable && { 'aria-expanded': isExpanded })), isExpandable ? (React.createElement(React.Fragment, null,
|
|
38
|
+
isExpandable ? setIsExpanded(!isExpanded || isCurrent) : onNavItemClick(stepIndex);
|
|
39
|
+
}, className: react_styles_1.css(wizard_1.default.wizardNavLink, isCurrent && wizard_1.default.modifiers.current, isDisabled && wizard_1.default.modifiers.disabled), "aria-disabled": isDisabled ? true : null, "aria-current": isCurrent && !children ? 'step' : false }, (isExpandable && { 'aria-expanded': isExpanded }), (ariaLabel && { 'aria-label': ariaLabel })), isExpandable ? (React.createElement(React.Fragment, null,
|
|
32
40
|
React.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardNavLinkText) }, content),
|
|
33
41
|
React.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardNavLinkToggle) },
|
|
34
42
|
React.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardNavLinkToggleIcon) },
|
|
35
|
-
React.createElement(angle_right_icon_1.default, null))))) : (
|
|
43
|
+
React.createElement(angle_right_icon_1.default, null))))) : (React.createElement(React.Fragment, null,
|
|
44
|
+
content,
|
|
45
|
+
status === types_1.WizardNavItemStatus.Error && (React.createElement("span", { style: { marginLeft: 'var(--pf-global--spacer--sm)' } },
|
|
46
|
+
React.createElement(exclamation_circle_icon_1.default, { color: "var(--pf-global--danger-color--100)" })))))),
|
|
36
47
|
children));
|
|
37
48
|
};
|
|
38
49
|
exports.WizardNavItem = WizardNavItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardNavItem.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardNavItem.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;
|
|
1
|
+
{"version":3,"file":"WizardNavItem.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardNavItem.tsx"],"names":[],"mapp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,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC,EACjD,CAAC,SAAS,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,GAE7C,YAAY,CAAC,CAAC,CAAC,CACd;YACE,8BAAM,SAAS,EAAE,kBAAG,CAAC,gBAAM,CAAC,iBAAiB,CAAC,IAAG,OAAO,CAAQ;YAChE,8BAAM,SAAS,EAAE,kBAAG,CAAC,gBAAM,CAAC,mBAAmB,CAAC;gBAC9C,8BAAM,SAAS,EAAE,kBAAG,CAAC,gBAAM,CAAC,uBAAuB,CAAC;oBAClD,oBAAC,0BAAc,OAAG,CACb,CACF,CACN,CACJ,CAAC,CAAC,CAAC,CACF;YACG,OAAO;YAEP,MAAM,KAAK,2BAAmB,CAAC,KAAK,IAAI,CACvC,8BAAM,KAAK,EAAE,EAAE,UAAU,EAAE,8BAA8B,EAAE;gBACzD,oBAAC,iCAAqB,IAAC,KAAK,EAAC,qCAAqC,GAAG,CAChE,CACR,CACA,CACJ,CACgB;QAClB,QAAQ,CACN,CACN,CAAC;AACJ,CAAC,CAAC;AA9FW,QAAA,aAAa,iBA8FxB;AAEF,qBAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { WizardNavItemType } from './types';
|
|
3
3
|
import { WizardBodyProps } from './WizardBody';
|
|
4
|
+
import { WizardFooterProps } from './WizardFooter';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
-
* Also acts as a wrapper for content, with an optional inclusion of WizardBody.
|
|
6
|
+
* The primary child component for Wizard. Step props are used for the list of steps managed in context.
|
|
7
7
|
*/
|
|
8
|
-
export interface WizardStepProps
|
|
8
|
+
export interface WizardStepProps {
|
|
9
|
+
/** Name of the step's navigation item */
|
|
10
|
+
name: React.ReactNode;
|
|
11
|
+
/** Unique identifier */
|
|
12
|
+
id: string | number;
|
|
9
13
|
/** Optional for when the step is used as a parent to sub-steps */
|
|
10
14
|
children?: React.ReactNode;
|
|
11
15
|
/** Props for WizardBody that wraps content by default. Can be set to null for exclusion of WizardBody. */
|
|
12
|
-
body?: Omit<WizardBodyProps, 'children'> | null;
|
|
16
|
+
body?: Omit<Omit<WizardBodyProps, 'children'>, 'children'> | null;
|
|
13
17
|
/** Optional list of sub-steps */
|
|
14
18
|
steps?: React.ReactElement<WizardStepProps>[];
|
|
19
|
+
/** Flag to disable the step's navigation item */
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
/** Flag to represent whether the step has been visited (navigated to) */
|
|
22
|
+
isVisited?: boolean;
|
|
23
|
+
/** Flag to determine whether the step is hidden */
|
|
24
|
+
isHidden?: boolean;
|
|
25
|
+
/** Replaces the step's navigation item or its properties. */
|
|
26
|
+
navItem?: WizardNavItemType;
|
|
27
|
+
/** Replaces the step's footer. The step's footer takes precedance over the wizard's footer. */
|
|
28
|
+
footer?: React.ReactElement | Partial<WizardFooterProps>;
|
|
29
|
+
/** Used to determine icon next to the step's navigation item */
|
|
30
|
+
status?: 'default' | 'error';
|
|
15
31
|
}
|
|
16
32
|
export declare const WizardStep: {
|
|
17
|
-
({ body,
|
|
33
|
+
({ children, body, id, footer, isHidden, isDisabled, navItem, status }: WizardStepProps): JSX.Element;
|
|
18
34
|
displayName: string;
|
|
19
35
|
};
|
|
20
36
|
//# sourceMappingURL=WizardStep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardStep.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardStep.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"WizardStep.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardStep.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAc,eAAe,EAAE,MAAM,cAAc,CAAC;AAG3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;GAEG;AAEH,MAAM,WAAW,eAAe;IAC9B,yCAAyC;IACzC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,wBAAwB;IACxB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,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,yEAAyE;IACzE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,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;CAC9B;AAED,eAAO,MAAM,UAAU;4EAA2E,eAAe;;CA4BhH,CAAC"}
|
|
@@ -4,7 +4,26 @@ exports.WizardStep = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const WizardBody_1 = require("./WizardBody");
|
|
7
|
-
const
|
|
7
|
+
const useWizardFooter_1 = require("./hooks/useWizardFooter");
|
|
8
|
+
const WizardContext_1 = require("./WizardContext");
|
|
9
|
+
const WizardStep = ({ children, body, id, footer, isHidden, isDisabled, navItem, status }) => {
|
|
10
|
+
const { currentStep, setStep, toggleStep } = WizardContext_1.useWizardContext();
|
|
11
|
+
useWizardFooter_1.useWizardFooter(footer, id);
|
|
12
|
+
// Update the controlled step when a change is detected with select properties
|
|
13
|
+
react_1.default.useEffect(() => {
|
|
14
|
+
if ((currentStep === null || currentStep === void 0 ? void 0 : currentStep.id) === id && (isDisabled || navItem || status || !(currentStep === null || currentStep === void 0 ? void 0 : currentStep.isVisited))) {
|
|
15
|
+
setStep(Object.assign(Object.assign(Object.assign(Object.assign({ id }, (isDisabled && { isDisabled })), (navItem && { navItem })), (status && { status })), (!(currentStep === null || currentStep === void 0 ? void 0 : currentStep.isVisited) && { isVisited: true })));
|
|
16
|
+
}
|
|
17
|
+
}, [id, setStep, currentStep === null || currentStep === void 0 ? void 0 : currentStep.id, isDisabled, navItem, status, currentStep === null || currentStep === void 0 ? void 0 : currentStep.isVisited]);
|
|
18
|
+
// Toggle visibility when the isHidden flag updates.
|
|
19
|
+
// Wizard's hasUnmountedSteps prop must be set to false for visibility changes to take effect.
|
|
20
|
+
react_1.default.useEffect(() => {
|
|
21
|
+
if (isHidden !== undefined) {
|
|
22
|
+
toggleStep(id, isHidden);
|
|
23
|
+
}
|
|
24
|
+
}, [toggleStep, id, isHidden]);
|
|
25
|
+
return body || body === undefined ? react_1.default.createElement(WizardBody_1.WizardBody, Object.assign({}, body), children) : react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
26
|
+
};
|
|
8
27
|
exports.WizardStep = WizardStep;
|
|
9
28
|
exports.WizardStep.displayName = 'WizardStep';
|
|
10
29
|
//# sourceMappingURL=WizardStep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardStep.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardStep.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAG1B,6CAA2D;
|
|
1
|
+
{"version":3,"file":"WizardStep.js","sourceRoot":"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I,QAAQ,KAAK,SAAS,EAAE;YAC1B,UAAU,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;SAC1B;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE/B,OAAO,IAAI,IAAI,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,8BAAC,uBAAU,oBAAK,IAAI,GAAG,QAAQ,CAAc,CAAC,CAAC,CAAC,8DAAG,QAAQ,CAAI,CAAC;AACtG,CAAC,CAAC;AA5BW,QAAA,UAAU,cA4BrB;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -1,35 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WizardNavProps } from '../Wizard';
|
|
3
|
-
import { WizardControlStep
|
|
3
|
+
import { WizardControlStep } from './types';
|
|
4
4
|
/**
|
|
5
|
-
* Used to toggle between step content, including the body and footer. This is also where the
|
|
5
|
+
* Used to toggle between step content, including the body and footer. This is also where the navigation and its expandability is controlled.
|
|
6
6
|
*/
|
|
7
7
|
export interface WizardToggleProps {
|
|
8
8
|
/** List of steps and/or sub-steps */
|
|
9
9
|
steps: WizardControlStep[];
|
|
10
|
-
/** The
|
|
11
|
-
|
|
10
|
+
/** The current step */
|
|
11
|
+
currentStep: WizardControlStep;
|
|
12
12
|
/** Wizard footer */
|
|
13
13
|
footer: React.ReactElement;
|
|
14
|
-
/** Wizard
|
|
14
|
+
/** Wizard navigation */
|
|
15
15
|
nav: React.ReactElement<WizardNavProps>;
|
|
16
16
|
/** The expandable dropdown button's aria-label */
|
|
17
17
|
'aria-label'?: string;
|
|
18
18
|
/** Flag to unmount inactive steps instead of hiding. Defaults to true */
|
|
19
|
-
|
|
20
|
-
/** Flag to determine whether the dropdown
|
|
19
|
+
hasUnmountedSteps?: boolean;
|
|
20
|
+
/** Flag to determine whether the dropdown navigation is expanded */
|
|
21
21
|
isNavExpanded?: boolean;
|
|
22
|
-
/** Callback to expand or collapse the dropdown
|
|
22
|
+
/** Callback to expand or collapse the dropdown navigation */
|
|
23
23
|
toggleNavExpanded?: () => void;
|
|
24
24
|
}
|
|
25
25
|
export declare const WizardToggle: {
|
|
26
|
-
({ steps,
|
|
26
|
+
({ steps, currentStep, footer, nav, isNavExpanded, toggleNavExpanded, hasUnmountedSteps, "aria-label": ariaLabel }: WizardToggleProps): JSX.Element;
|
|
27
27
|
displayName: string;
|
|
28
28
|
};
|
|
29
|
-
interface WizardToggleInternalProps extends Pick<WizardToggleProps, 'unmountInactiveSteps'> {
|
|
30
|
-
/** Custom WizardNav or callback used to create a default WizardNav */
|
|
31
|
-
nav?: DefaultWizardNavProps | CustomWizardNavFunction;
|
|
32
|
-
}
|
|
33
|
-
export declare const WizardToggleInternal: ({ nav, unmountInactiveSteps }: WizardToggleInternalProps) => JSX.Element;
|
|
34
|
-
export {};
|
|
35
29
|
//# sourceMappingURL=WizardToggle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardToggle.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,
|
|
1
|
+
{"version":3,"file":"WizardToggle.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAmB,MAAM,SAAS,CAAC;AAE7D;;GAEG;AAEH,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,uBAAuB;IACvB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,oBAAoB;IACpB,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC;IAC3B,wBAAwB;IACxB,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IACxC,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oEAAoE;IACpE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,6DAA6D;IAC7D,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,YAAY;wHAStB,iBAAiB;;CAwEnB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.WizardToggle = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const react_styles_1 = require("@patternfly/react-styles");
|
|
@@ -8,17 +8,17 @@ const wizard_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/c
|
|
|
8
8
|
const angle_right_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/angle-right-icon'));
|
|
9
9
|
const caret_down_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/caret-down-icon'));
|
|
10
10
|
const constants_1 = require("../../../helpers/constants");
|
|
11
|
-
const Wizard_1 = require("../Wizard");
|
|
12
11
|
const types_1 = require("./types");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
12
|
+
const WizardToggle = ({ steps, currentStep, footer, nav, isNavExpanded, toggleNavExpanded, hasUnmountedSteps = true, 'aria-label': ariaLabel = 'Wizard toggle' }) => {
|
|
13
|
+
const isActiveSubStep = types_1.isWizardSubStep(currentStep);
|
|
14
|
+
const nonSubSteps = steps.filter(step => !types_1.isWizardSubStep(step));
|
|
15
|
+
const wizardToggleIndex = nonSubSteps.indexOf(types_1.isWizardSubStep(currentStep) ? steps.find(step => step.id === currentStep.parentId) : currentStep) + 1;
|
|
16
16
|
const handleKeyClicks = react_1.default.useCallback((event) => {
|
|
17
17
|
if (isNavExpanded && event.key === constants_1.KeyTypes.Escape) {
|
|
18
18
|
toggleNavExpanded();
|
|
19
19
|
}
|
|
20
20
|
}, [isNavExpanded, toggleNavExpanded]);
|
|
21
|
-
// Open/close collapsable
|
|
21
|
+
// Open/close collapsable navigation on keydown event
|
|
22
22
|
react_1.default.useEffect(() => {
|
|
23
23
|
const target = typeof document !== 'undefined' ? document.body : null;
|
|
24
24
|
target === null || target === void 0 ? void 0 : target.addEventListener('keydown', handleKeyClicks, false);
|
|
@@ -26,11 +26,11 @@ const WizardToggle = ({ steps, activeStep, footer, nav, isNavExpanded, toggleNav
|
|
|
26
26
|
target === null || target === void 0 ? void 0 : target.removeEventListener('keydown', handleKeyClicks, false);
|
|
27
27
|
};
|
|
28
28
|
}, [handleKeyClicks]);
|
|
29
|
-
// Only render the
|
|
30
|
-
const bodyContent =
|
|
31
|
-
?
|
|
29
|
+
// Only render the current step when hasUnmountedSteps is true
|
|
30
|
+
const bodyContent = hasUnmountedSteps
|
|
31
|
+
? currentStep === null || currentStep === void 0 ? void 0 : currentStep.component
|
|
32
32
|
: steps.map(step => {
|
|
33
|
-
if ((
|
|
33
|
+
if ((currentStep === null || currentStep === void 0 ? void 0 : currentStep.name) === step.name) {
|
|
34
34
|
return step.component;
|
|
35
35
|
}
|
|
36
36
|
return (react_1.default.createElement("div", { key: step.id, style: { display: 'none' } }, step.component));
|
|
@@ -38,10 +38,12 @@ const WizardToggle = ({ steps, activeStep, footer, nav, isNavExpanded, toggleNav
|
|
|
38
38
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
39
39
|
react_1.default.createElement("button", { onClick: toggleNavExpanded, className: react_styles_1.css(wizard_1.default.wizardToggle, isNavExpanded && 'pf-m-expanded'), "aria-label": ariaLabel, "aria-expanded": isNavExpanded },
|
|
40
40
|
react_1.default.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardToggleList) },
|
|
41
|
-
react_1.default.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardToggleListItem) },
|
|
42
|
-
|
|
41
|
+
react_1.default.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardToggleListItem) },
|
|
42
|
+
react_1.default.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardToggleNum) }, wizardToggleIndex),
|
|
43
|
+
" ", currentStep === null || currentStep === void 0 ? void 0 :
|
|
44
|
+
currentStep.name,
|
|
43
45
|
isActiveSubStep && react_1.default.createElement(angle_right_icon_1.default, { className: react_styles_1.css(wizard_1.default.wizardToggleSeparator), "aria-hidden": "true" })),
|
|
44
|
-
isActiveSubStep && react_1.default.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardToggleListItem) },
|
|
46
|
+
isActiveSubStep && react_1.default.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardToggleListItem) }, currentStep === null || currentStep === void 0 ? void 0 : currentStep.name)),
|
|
45
47
|
react_1.default.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardToggleIcon) },
|
|
46
48
|
react_1.default.createElement(caret_down_icon_1.default, { "aria-hidden": "true" }))),
|
|
47
49
|
react_1.default.createElement("div", { className: react_styles_1.css(wizard_1.default.wizardOuterWrap) },
|
|
@@ -51,43 +53,5 @@ const WizardToggle = ({ steps, activeStep, footer, nav, isNavExpanded, toggleNav
|
|
|
51
53
|
footer)));
|
|
52
54
|
};
|
|
53
55
|
exports.WizardToggle = WizardToggle;
|
|
54
|
-
const WizardToggleInternal = ({ nav, unmountInactiveSteps }) => {
|
|
55
|
-
const [isNavExpanded, setIsNavExpanded] = react_1.default.useState(false);
|
|
56
|
-
const { activeStep, steps, footer, goToStepByIndex } = WizardContext_1.useWizardContext();
|
|
57
|
-
const wizardNav = react_1.default.useMemo(() => {
|
|
58
|
-
if (types_1.isCustomWizardNav(nav)) {
|
|
59
|
-
return nav(isNavExpanded, steps, activeStep, goToStepByIndex);
|
|
60
|
-
}
|
|
61
|
-
const navProps = Object.assign({ isExpanded: isNavExpanded, 'aria-label': (nav === null || nav === void 0 ? void 0 : nav.ariaLabel) || 'Wizard nav' }, ((nav === null || nav === void 0 ? void 0 : nav.ariaLabelledBy) && { 'aria-labelledby': nav === null || nav === void 0 ? void 0 : nav.ariaLabelledBy }));
|
|
62
|
-
return (react_1.default.createElement(Wizard_1.WizardNav, Object.assign({}, navProps), steps.map((step, index) => {
|
|
63
|
-
var _a;
|
|
64
|
-
const stepIndex = index + 1;
|
|
65
|
-
const stepNavItem = step.navItem && react_1.default.createElement(react_1.default.Fragment, { key: step.id }, step.navItem);
|
|
66
|
-
if (types_1.isWizardParentStep(step)) {
|
|
67
|
-
let firstSubStepIndex;
|
|
68
|
-
let hasActiveChild = false;
|
|
69
|
-
const subNavItems = (_a = step.subStepIds) === null || _a === void 0 ? void 0 : _a.map((subStepId, index) => {
|
|
70
|
-
const subStep = steps.find(step => step.id === subStepId);
|
|
71
|
-
const subStepIndex = steps.indexOf(subStep) + 1;
|
|
72
|
-
if (index === 0) {
|
|
73
|
-
firstSubStepIndex = subStepIndex;
|
|
74
|
-
}
|
|
75
|
-
if ((activeStep === null || activeStep === void 0 ? void 0 : activeStep.id) === subStep.id) {
|
|
76
|
-
hasActiveChild = true;
|
|
77
|
-
}
|
|
78
|
-
return subStep.navItem ? (react_1.default.createElement(react_1.default.Fragment, { key: subStep.id }, subStep.navItem)) : (react_1.default.createElement(Wizard_1.WizardNavItem, { key: subStep.id, id: subStep.id, content: subStep.name, isCurrent: (activeStep === null || activeStep === void 0 ? void 0 : activeStep.id) === subStep.id, isDisabled: subStep.isDisabled || ((nav === null || nav === void 0 ? void 0 : nav.forceStepVisit) && !subStep.visited), step: subStepIndex, onNavItemClick: goToStepByIndex }));
|
|
79
|
-
});
|
|
80
|
-
const hasEnabledChildren = react_1.default.Children.toArray(subNavItems).some(child => react_1.default.isValidElement(child) && !child.props.isDisabled);
|
|
81
|
-
return (stepNavItem || (react_1.default.createElement(Wizard_1.WizardNavItem, { key: step.id, id: step.id, content: step.name, isExpandable: nav === null || nav === void 0 ? void 0 : nav.isExpandable, isCurrent: hasActiveChild, isDisabled: !hasEnabledChildren, step: firstSubStepIndex, onNavItemClick: goToStepByIndex },
|
|
82
|
-
react_1.default.createElement(Wizard_1.WizardNav, Object.assign({}, navProps, { returnList: true }), subNavItems))));
|
|
83
|
-
}
|
|
84
|
-
if (types_1.isWizardBasicStep(step)) {
|
|
85
|
-
return (stepNavItem || (react_1.default.createElement(Wizard_1.WizardNavItem, { key: step.id, id: step.id, content: step.name, isCurrent: (activeStep === null || activeStep === void 0 ? void 0 : activeStep.id) === step.id, isDisabled: step.isDisabled || ((nav === null || nav === void 0 ? void 0 : nav.forceStepVisit) && !step.visited), step: stepIndex, onNavItemClick: goToStepByIndex })));
|
|
86
|
-
}
|
|
87
|
-
})));
|
|
88
|
-
}, [activeStep, goToStepByIndex, isNavExpanded, nav, steps]);
|
|
89
|
-
return (react_1.default.createElement(exports.WizardToggle, { nav: wizardNav, footer: footer, steps: steps, activeStep: activeStep, isNavExpanded: isNavExpanded, toggleNavExpanded: () => setIsNavExpanded(prevIsExpanded => !prevIsExpanded), unmountInactiveSteps: unmountInactiveSteps }));
|
|
90
|
-
};
|
|
91
|
-
exports.WizardToggleInternal = WizardToggleInternal;
|
|
92
56
|
exports.WizardToggle.displayName = 'WizardToggle';
|
|
93
57
|
//# sourceMappingURL=WizardToggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardToggle.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardToggle.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,2DAA+C;AAC/C,2GAA2E;AAC3E,sHAAqF;AACrF,oHAAmF;AAEnF,0DAAsD;
|
|
1
|
+
{"version":3,"file":"WizardToggle.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/WizardToggle.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,2DAA+C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oB,CAAC,IAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,CAAQ,CAC5F;YAEP,wCAAM,SAAS,EAAE,kBAAG,CAAC,gBAAM,CAAC,gBAAgB,CAAC;gBAC3C,8BAAC,yBAAa,mBAAa,MAAM,GAAG,CAC/B,CACA;QACT,uCAAK,SAAS,EAAE,kBAAG,CAAC,gBAAM,CAAC,eAAe,CAAC;YACzC,uCAAK,SAAS,EAAE,kBAAG,CAAC,gBAAM,CAAC,eAAe,CAAC;gBACxC,GAAG;gBACH,WAAW,CACR;YAEL,MAAM,CACH,CACL,CACJ,CAAC;AACJ,CAAC,CAAC;AAjFW,QAAA,YAAY,gBAiFvB;AAEF,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { WizardFooterProps } from '../WizardFooter';
|
|
3
3
|
/**
|
|
4
4
|
* Set a unique footer for the wizard. stepId is only required if inactive steps are hidden instead of unmounted.
|
|
5
5
|
* @param footer
|
|
6
6
|
* @param stepId
|
|
7
7
|
*/
|
|
8
|
-
export declare const useWizardFooter: (footer:
|
|
8
|
+
export declare const useWizardFooter: (footer: React.ReactElement | Partial<WizardFooterProps>, stepId?: string | number) => void;
|
|
9
9
|
//# sourceMappingURL=useWizardFooter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWizardFooter.d.ts","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/useWizardFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useWizardFooter.d.ts","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/useWizardFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAAY,MAAM,YAAY,GAAG,QAAQ,iBAAiB,CAAC,WAAW,MAAM,GAAG,MAAM,SAahH,CAAC"}
|
|
@@ -10,16 +10,16 @@ const WizardContext_1 = require("../WizardContext");
|
|
|
10
10
|
* @param stepId
|
|
11
11
|
*/
|
|
12
12
|
const useWizardFooter = (footer, stepId) => {
|
|
13
|
-
const {
|
|
13
|
+
const { currentStep, setFooter } = WizardContext_1.useWizardContext();
|
|
14
14
|
react_1.default.useEffect(() => {
|
|
15
|
-
if (!stepId ||
|
|
15
|
+
if (footer && (!stepId || (currentStep === null || currentStep === void 0 ? void 0 : currentStep.id) === stepId)) {
|
|
16
16
|
setFooter(footer);
|
|
17
17
|
// Reset the footer on unmount.
|
|
18
18
|
return () => {
|
|
19
19
|
setFooter(null);
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
}, [
|
|
22
|
+
}, [currentStep, footer, setFooter, stepId]);
|
|
23
23
|
};
|
|
24
24
|
exports.useWizardFooter = useWizardFooter;
|
|
25
25
|
//# sourceMappingURL=useWizardFooter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWizardFooter.js","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/useWizardFooter.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;
|
|
1
|
+
{"version":3,"file":"useWizardFooter.js","sourceRoot":"","sources":["../../../../../../src/next/components/Wizard/hooks/useWizardFooter.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,oDAAoD;AAGpD;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,MAAuD,EAAE,MAAwB,EAAE,EAAE;IACnH,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,gCAAgB,EAAE,CAAC;IAEtD,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,MAAM,IAAI,CAAC,CAAC,MAAM,IAAI,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,EAAE,MAAK,MAAM,CAAC,EAAE;YACrD,SAAS,CAAC,MAAM,CAAC,CAAC;YAElB,+BAA+B;YAC/B,OAAO,GAAG,EAAE;gBACV,SAAS,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAbW,QAAA,eAAe,mBAa1B"}
|