@patternfly/react-core 4.234.3 → 4.235.1
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 +27 -0
- package/dist/esm/next/components/Wizard/Wizard.d.ts +40 -0
- package/dist/esm/next/components/Wizard/Wizard.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/Wizard.js +86 -0
- package/dist/esm/next/components/Wizard/Wizard.js.map +1 -0
- package/dist/esm/next/components/Wizard/WizardBody.d.ts +20 -0
- package/dist/esm/next/components/Wizard/WizardBody.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/WizardBody.js +7 -0
- package/dist/esm/next/components/Wizard/WizardBody.js.map +1 -0
- package/dist/esm/next/components/Wizard/WizardContext.d.ts +49 -0
- package/dist/esm/next/components/Wizard/WizardContext.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/WizardContext.js +34 -0
- package/dist/esm/next/components/Wizard/WizardContext.js.map +1 -0
- package/dist/esm/next/components/Wizard/WizardFooter.d.ts +28 -0
- package/dist/esm/next/components/Wizard/WizardFooter.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/WizardFooter.js +11 -0
- package/dist/esm/next/components/Wizard/WizardFooter.js.map +1 -0
- package/dist/esm/next/components/Wizard/WizardHeader.d.ts +21 -0
- package/dist/esm/next/components/Wizard/WizardHeader.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/WizardHeader.js +13 -0
- package/dist/esm/next/components/Wizard/WizardHeader.js.map +1 -0
- package/dist/esm/next/components/Wizard/WizardNav.d.ts +15 -0
- package/dist/esm/next/components/Wizard/WizardNav.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/WizardNav.js +13 -0
- package/dist/esm/next/components/Wizard/WizardNav.js.map +1 -0
- package/dist/esm/next/components/Wizard/WizardNavItem.d.ts +25 -0
- package/dist/esm/next/components/Wizard/WizardNavItem.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/WizardNavItem.js +33 -0
- package/dist/esm/next/components/Wizard/WizardNavItem.js.map +1 -0
- package/dist/esm/next/components/Wizard/WizardStep.d.ts +20 -0
- package/dist/esm/next/components/Wizard/WizardStep.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/WizardStep.js +5 -0
- package/dist/esm/next/components/Wizard/WizardStep.js.map +1 -0
- package/dist/esm/next/components/Wizard/WizardToggle.d.ts +26 -0
- package/dist/esm/next/components/Wizard/WizardToggle.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/WizardToggle.js +81 -0
- package/dist/esm/next/components/Wizard/WizardToggle.js.map +1 -0
- package/dist/esm/next/components/Wizard/hooks/index.d.ts +2 -0
- package/dist/esm/next/components/Wizard/hooks/index.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/hooks/index.js +2 -0
- package/dist/esm/next/components/Wizard/hooks/index.js.map +1 -0
- package/dist/esm/next/components/Wizard/hooks/useWizardFooter.d.ts +8 -0
- package/dist/esm/next/components/Wizard/hooks/useWizardFooter.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/hooks/useWizardFooter.js +20 -0
- package/dist/esm/next/components/Wizard/hooks/useWizardFooter.js.map +1 -0
- package/dist/esm/next/components/Wizard/index.d.ts +12 -0
- package/dist/esm/next/components/Wizard/index.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/index.js +12 -0
- package/dist/esm/next/components/Wizard/index.js.map +1 -0
- package/dist/esm/next/components/Wizard/types.d.ts +69 -0
- package/dist/esm/next/components/Wizard/types.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/types.js +20 -0
- package/dist/esm/next/components/Wizard/types.js.map +1 -0
- package/dist/esm/next/components/Wizard/utils.d.ts +15 -0
- package/dist/esm/next/components/Wizard/utils.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/utils.js +35 -0
- package/dist/esm/next/components/Wizard/utils.js.map +1 -0
- package/dist/esm/next/components/index.d.ts +1 -1
- package/dist/esm/next/components/index.d.ts.map +1 -1
- package/dist/esm/next/components/index.js +1 -1
- package/dist/esm/next/components/index.js.map +1 -1
- package/dist/js/next/components/Wizard/Wizard.d.ts +40 -0
- package/dist/js/next/components/Wizard/Wizard.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/Wizard.js +90 -0
- package/dist/js/next/components/Wizard/Wizard.js.map +1 -0
- package/dist/js/next/components/Wizard/WizardBody.d.ts +20 -0
- package/dist/js/next/components/Wizard/WizardBody.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/WizardBody.js +12 -0
- package/dist/js/next/components/Wizard/WizardBody.js.map +1 -0
- package/dist/js/next/components/Wizard/WizardContext.d.ts +49 -0
- package/dist/js/next/components/Wizard/WizardContext.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/WizardContext.js +40 -0
- package/dist/js/next/components/Wizard/WizardContext.js.map +1 -0
- package/dist/js/next/components/Wizard/WizardFooter.d.ts +28 -0
- package/dist/js/next/components/Wizard/WizardFooter.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/WizardFooter.js +16 -0
- package/dist/js/next/components/Wizard/WizardFooter.js.map +1 -0
- package/dist/js/next/components/Wizard/WizardHeader.d.ts +21 -0
- package/dist/js/next/components/Wizard/WizardHeader.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/WizardHeader.js +18 -0
- package/dist/js/next/components/Wizard/WizardHeader.js.map +1 -0
- package/dist/js/next/components/Wizard/WizardNav.d.ts +15 -0
- package/dist/js/next/components/Wizard/WizardNav.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/WizardNav.js +18 -0
- package/dist/js/next/components/Wizard/WizardNav.js.map +1 -0
- package/dist/js/next/components/Wizard/WizardNavItem.d.ts +25 -0
- package/dist/js/next/components/Wizard/WizardNavItem.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/WizardNavItem.js +37 -0
- package/dist/js/next/components/Wizard/WizardNavItem.js.map +1 -0
- package/dist/js/next/components/Wizard/WizardStep.d.ts +20 -0
- package/dist/js/next/components/Wizard/WizardStep.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/WizardStep.js +10 -0
- package/dist/js/next/components/Wizard/WizardStep.js.map +1 -0
- package/dist/js/next/components/Wizard/WizardToggle.d.ts +26 -0
- package/dist/js/next/components/Wizard/WizardToggle.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/WizardToggle.js +86 -0
- package/dist/js/next/components/Wizard/WizardToggle.js.map +1 -0
- package/dist/js/next/components/Wizard/hooks/index.d.ts +2 -0
- package/dist/js/next/components/Wizard/hooks/index.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/hooks/index.js +6 -0
- package/dist/js/next/components/Wizard/hooks/index.js.map +1 -0
- package/dist/js/next/components/Wizard/hooks/useWizardFooter.d.ts +8 -0
- package/dist/js/next/components/Wizard/hooks/useWizardFooter.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/hooks/useWizardFooter.js +25 -0
- package/dist/js/next/components/Wizard/hooks/useWizardFooter.js.map +1 -0
- package/dist/js/next/components/Wizard/index.d.ts +12 -0
- package/dist/js/next/components/Wizard/index.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/index.js +17 -0
- package/dist/js/next/components/Wizard/index.js.map +1 -0
- package/dist/js/next/components/Wizard/types.d.ts +69 -0
- package/dist/js/next/components/Wizard/types.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/types.js +29 -0
- package/dist/js/next/components/Wizard/types.js.map +1 -0
- package/dist/js/next/components/Wizard/utils.d.ts +15 -0
- package/dist/js/next/components/Wizard/utils.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/utils.js +41 -0
- package/dist/js/next/components/Wizard/utils.js.map +1 -0
- package/dist/js/next/components/index.d.ts +1 -1
- package/dist/js/next/components/index.d.ts.map +1 -1
- package/dist/js/next/components/index.js +1 -1
- package/dist/js/next/components/index.js.map +1 -1
- package/dist/umd/react-core.css +230 -230
- package/dist/umd/react-core.min.css +734 -734
- package/package.json +5 -5
- package/src/components/Card/examples/Card.md +67 -38
- package/src/components/Wizard/examples/Wizard.md +21 -4
- package/src/demos/CardDemos.md +4 -0
- package/src/next/components/Wizard/Wizard.tsx +184 -0
- package/src/next/components/Wizard/WizardBody.tsx +34 -0
- package/src/next/components/Wizard/WizardContext.tsx +104 -0
- package/src/next/components/Wizard/WizardFooter.tsx +63 -0
- package/src/next/components/Wizard/WizardHeader.tsx +53 -0
- package/src/next/components/Wizard/WizardNav.tsx +41 -0
- package/src/next/components/Wizard/WizardNavItem.tsx +103 -0
- package/src/next/components/Wizard/WizardStep.tsx +23 -0
- package/src/next/components/Wizard/WizardToggle.tsx +209 -0
- package/src/next/components/Wizard/__tests__/Wizard.test.tsx +298 -0
- package/src/next/components/Wizard/examples/Wizard.md +125 -0
- package/src/next/components/Wizard/examples/WizardBasic.tsx +22 -0
- package/src/next/components/Wizard/examples/WizardCustomNav.tsx +46 -0
- package/src/next/components/Wizard/examples/WizardKitchenSink.tsx +170 -0
- package/src/next/components/Wizard/hooks/index.ts +1 -0
- package/src/next/components/Wizard/hooks/useWizardFooter.tsx +22 -0
- package/src/next/components/Wizard/index.ts +11 -0
- package/src/next/components/Wizard/types.tsx +101 -0
- package/src/next/components/Wizard/utils.ts +47 -0
- package/src/next/components/index.ts +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WizardNavProps, WizardNavItemProps } from '../Wizard';
|
|
3
|
+
/** Type used to define 'basic' steps, or in other words, steps that are neither parents or children of parents. */
|
|
4
|
+
export interface WizardBasicStep {
|
|
5
|
+
/** Name of the step's nav item */
|
|
6
|
+
name: React.ReactNode;
|
|
7
|
+
/** Unique identifier */
|
|
8
|
+
id: string | number;
|
|
9
|
+
/** Flag to disable the step's nav item */
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
/** Flag to represent whether the step has been visited (navigated to) */
|
|
12
|
+
visited?: boolean;
|
|
13
|
+
/** Content shown when the step's nav item is selected. When treated as a parent step, only sub-step content will be shown. */
|
|
14
|
+
component?: React.ReactElement;
|
|
15
|
+
/** (Unused if nav is controlled) Custom WizardNavItem */
|
|
16
|
+
navItem?: React.ReactElement<WizardNavItemProps>;
|
|
17
|
+
/** (Unused if footer is controlled) Can change the Next button text. If nextButtonText is also set for the Wizard, this step specific one overrides it. */
|
|
18
|
+
nextButtonText?: React.ReactNode;
|
|
19
|
+
/** (Unused if footer is controlled) The condition needed to disable the Next button */
|
|
20
|
+
disableNext?: boolean;
|
|
21
|
+
/** (Unused if footer is controlled) True to hide the Cancel button */
|
|
22
|
+
hideCancelButton?: boolean;
|
|
23
|
+
/** (Unused if footer is controlled) True to hide the Back button */
|
|
24
|
+
hideBackButton?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Type used to define parent steps. */
|
|
27
|
+
export interface WizardParentStep extends WizardBasicStep {
|
|
28
|
+
/** Nested step IDs */
|
|
29
|
+
subStepIds: string[];
|
|
30
|
+
}
|
|
31
|
+
/** Type used to define sub-steps. */
|
|
32
|
+
export interface WizardSubStep extends WizardBasicStep {
|
|
33
|
+
/** Unique identifier of the parent step */
|
|
34
|
+
parentId: string | number;
|
|
35
|
+
}
|
|
36
|
+
/** Used to customize aspects of the Wizard's default navigation. */
|
|
37
|
+
export interface DefaultWizardNavProps {
|
|
38
|
+
/** Flag indicating nav items with sub steps are expandable */
|
|
39
|
+
isExpandable?: boolean;
|
|
40
|
+
/** Aria-label for the Nav */
|
|
41
|
+
ariaLabel?: string;
|
|
42
|
+
/** Sets aria-labelledby on nav element */
|
|
43
|
+
ariaLabelledBy?: string;
|
|
44
|
+
/** Disable step nav items until they are visited */
|
|
45
|
+
forceStepVisit?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** Used to customize aspects of the Wizard's default footer. */
|
|
48
|
+
export interface DefaultWizardFooterProps {
|
|
49
|
+
/** The Next button text */
|
|
50
|
+
nextButtonText?: React.ReactNode;
|
|
51
|
+
/** The Back button text */
|
|
52
|
+
backButtonText?: React.ReactNode;
|
|
53
|
+
/** The Cancel button text */
|
|
54
|
+
cancelButtonText?: React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
/** Encompasses all step type variants that are internally controlled by the Wizard. */
|
|
57
|
+
export declare type WizardControlStep = WizardBasicStep | WizardParentStep | WizardSubStep;
|
|
58
|
+
/** Callback for the Wizard's 'onNext', 'onBack', and 'onNavByIndex' properties. */
|
|
59
|
+
export declare type WizardNavStepFunction = (currentStep: WizardNavStepData, previousStep: WizardNavStepData) => void;
|
|
60
|
+
/** Data returned for either parameter of WizardNavStepFunction. */
|
|
61
|
+
export declare type WizardNavStepData = Pick<WizardControlStep, 'id' | 'name'>;
|
|
62
|
+
/** Callback for the Wizard's 'nav' property. Returns element which replaces the Wizard's default navigation. */
|
|
63
|
+
export declare type CustomWizardNavFunction = (isOpen: boolean, steps: WizardControlStep[], activeStep: WizardControlStep, goToStepByIndex: (index: number) => void) => React.ReactElement<WizardNavProps>;
|
|
64
|
+
export declare function isCustomWizardNav(nav: DefaultWizardNavProps | CustomWizardNavFunction): nav is CustomWizardNavFunction;
|
|
65
|
+
export declare function isCustomWizardFooter(footer: DefaultWizardFooterProps | React.ReactElement): footer is React.ReactElement;
|
|
66
|
+
export declare function isWizardBasicStep(step: WizardControlStep): step is WizardBasicStep;
|
|
67
|
+
export declare function isWizardSubStep(step: WizardControlStep): step is WizardSubStep;
|
|
68
|
+
export declare function isWizardParentStep(step: WizardControlStep): step is WizardParentStep;
|
|
69
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/types.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isWizardParentStep = exports.isWizardSubStep = exports.isWizardBasicStep = exports.isCustomWizardFooter = exports.isCustomWizardNav = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
function isCustomWizardNav(nav) {
|
|
7
|
+
return typeof nav === 'function';
|
|
8
|
+
}
|
|
9
|
+
exports.isCustomWizardNav = isCustomWizardNav;
|
|
10
|
+
function isCustomWizardFooter(footer) {
|
|
11
|
+
return react_1.default.isValidElement(footer);
|
|
12
|
+
}
|
|
13
|
+
exports.isCustomWizardFooter = isCustomWizardFooter;
|
|
14
|
+
function isWizardBasicStep(step) {
|
|
15
|
+
var _a;
|
|
16
|
+
return ((_a = step) === null || _a === void 0 ? void 0 : _a.subStepIds) === undefined && !isWizardSubStep(step);
|
|
17
|
+
}
|
|
18
|
+
exports.isWizardBasicStep = isWizardBasicStep;
|
|
19
|
+
function isWizardSubStep(step) {
|
|
20
|
+
var _a;
|
|
21
|
+
return ((_a = step) === null || _a === void 0 ? void 0 : _a.parentId) !== undefined;
|
|
22
|
+
}
|
|
23
|
+
exports.isWizardSubStep = isWizardSubStep;
|
|
24
|
+
function isWizardParentStep(step) {
|
|
25
|
+
var _a;
|
|
26
|
+
return ((_a = step) === null || _a === void 0 ? void 0 : _a.subStepIds) !== undefined;
|
|
27
|
+
}
|
|
28
|
+
exports.isWizardParentStep = isWizardParentStep;
|
|
29
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/types.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AA8E1B,SAAgB,iBAAiB,CAC/B,GAAoD;IAEpD,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC;AACnC,CAAC;AAJD,8CAIC;AAED,SAAgB,oBAAoB,CAClC,MAAqD;IAErD,OAAO,eAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC;AAJD,oDAIC;AAED,SAAgB,iBAAiB,CAAC,IAAuB;;IACvD,OAAO,CAAA,MAAC,IAAyB,0CAAE,UAAU,MAAK,SAAS,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACxF,CAAC;AAFD,8CAEC;AAED,SAAgB,eAAe,CAAC,IAAuB;;IACrD,OAAO,CAAA,MAAC,IAAsB,0CAAE,QAAQ,MAAK,SAAS,CAAC;AACzD,CAAC;AAFD,0CAEC;AAED,SAAgB,kBAAkB,CAAC,IAAuB;;IACxD,OAAO,CAAA,MAAC,IAAyB,0CAAE,UAAU,MAAK,SAAS,CAAC;AAC9D,CAAC;AAFD,gDAEC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WizardControlStep, WizardNavStepData } from './types';
|
|
3
|
+
import { WizardStepProps } from './WizardStep';
|
|
4
|
+
/**
|
|
5
|
+
* Accumulate list of step & sub-step props pulled from child components
|
|
6
|
+
* @param children
|
|
7
|
+
* @returns WizardControlStep[]
|
|
8
|
+
*/
|
|
9
|
+
export declare const buildSteps: (children: React.ReactElement<WizardStepProps> | React.ReactElement<WizardStepProps>[]) => WizardControlStep[];
|
|
10
|
+
export declare const normalizeNavStep: ({ id, name }: WizardNavStepData) => {
|
|
11
|
+
id: string | number;
|
|
12
|
+
name: React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const getActiveStep: (steps: WizardControlStep[], currentStepIndex: number) => WizardControlStep;
|
|
15
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAc,eAAe,EAAE,MAAM,cAAc,CAAC;AAM3D;;;;GAIG;AACH,eAAO,MAAM,UAAU,aAAc,MAAM,YAAY,CAAC,eAAe,CAAC,GAAG,MAAM,YAAY,CAAC,eAAe,CAAC,EAAE,wBA4BxG,CAAC;AAET,eAAO,MAAM,gBAAgB,iBAAkB,iBAAiB;;;CAAmB,CAAC;AACpF,eAAO,MAAM,aAAa,UAAW,iBAAiB,EAAE,oBAAoB,MAAM,sBACxB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getActiveStep = exports.normalizeNavStep = exports.buildSteps = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const WizardStep_1 = require("./WizardStep");
|
|
7
|
+
function hasWizardStepProps(props) {
|
|
8
|
+
return props.name !== undefined && props.id !== undefined && props.children !== undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Accumulate list of step & sub-step props pulled from child components
|
|
12
|
+
* @param children
|
|
13
|
+
* @returns WizardControlStep[]
|
|
14
|
+
*/
|
|
15
|
+
const buildSteps = (children) => react_1.default.Children.toArray(children).reduce((acc, child) => {
|
|
16
|
+
if (react_1.default.isValidElement(child)) {
|
|
17
|
+
if (child.type === WizardStep_1.WizardStep || hasWizardStepProps(child.props)) {
|
|
18
|
+
// Omit "children" and use the whole "child" (WizardStep) for the component prop. Sub-steps will do the same.
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
|
+
const _a = child.props, { steps: subSteps, id, children } = _a, stepProps = tslib_1.__rest(_a, ["steps", "id", "children"]);
|
|
21
|
+
acc.push(Object.assign(Object.assign({ id, component: child }, stepProps), (subSteps && {
|
|
22
|
+
subStepIds: subSteps === null || subSteps === void 0 ? void 0 : subSteps.map(subStep => {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
+
const _a = subStep.props, { children } = _a, subStepProps = tslib_1.__rest(_a, ["children"]);
|
|
25
|
+
acc.push(Object.assign(Object.assign({}, subStepProps), { component: subStep, parentId: id }));
|
|
26
|
+
return subStep.props.id;
|
|
27
|
+
})
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
throw new Error('Wizard only accepts children of type WizardStep');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return acc;
|
|
35
|
+
}, []);
|
|
36
|
+
exports.buildSteps = buildSteps;
|
|
37
|
+
const normalizeNavStep = ({ id, name }) => ({ id, name });
|
|
38
|
+
exports.normalizeNavStep = normalizeNavStep;
|
|
39
|
+
const getActiveStep = (steps, currentStepIndex) => steps.find((_, index) => index + 1 === currentStepIndex);
|
|
40
|
+
exports.getActiveStep = getActiveStep;
|
|
41
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/next/components/Wizard/utils.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAG1B,6CAA2D;AAE3D,SAAS,kBAAkB,CAAC,KAA4B;IACtD,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC;AAC5F,CAAC;AAED;;;;GAIG;AACI,MAAM,UAAU,GAAG,CAAC,QAAqF,EAAE,EAAE,CAClH,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,GAAwB,EAAE,KAAK,EAAE,EAAE;IAC1E,IAAI,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;QAC/B,IAAI,KAAK,CAAC,IAAI,KAAK,uBAAU,IAAI,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAChE,6GAA6G;YAC7G,6DAA6D;YAC7D,MAAM,KAAkD,KAAK,CAAC,KAAwB,EAAhF,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,OAAiD,EAA5C,SAAS,sBAA7C,2BAA+C,CAAiC,CAAC;YAEvF,GAAG,CAAC,IAAI,+BACN,EAAE,EACF,SAAS,EAAE,KAAK,IACb,SAAS,GACT,CAAC,QAAQ,IAAI;gBACd,UAAU,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,CAAC,OAAO,CAAC,EAAE;oBAClC,6DAA6D;oBAC7D,MAAM,KAAgC,OAAO,CAAC,KAAK,EAA7C,EAAE,QAAQ,OAAmC,EAA9B,YAAY,sBAA3B,YAA6B,CAAgB,CAAC;oBACpD,GAAG,CAAC,IAAI,iCAAM,YAAY,KAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,IAAG,CAAC;oBAEhE,OAAO,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC1B,CAAC,CAAC;aACH,CAAC,EACF,CAAC;SACJ;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACpE;KACF;IAED,OAAO,GAAG,CAAC;AACb,CAAC,EAAE,EAAE,CAAC,CAAC;AA5BI,QAAA,UAAU,cA4Bd;AAEF,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAqB,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAAvE,QAAA,gBAAgB,oBAAuD;AAC7E,MAAM,aAAa,GAAG,CAAC,KAA0B,EAAE,gBAAwB,EAAE,EAAE,CACpF,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,KAAK,gBAAgB,CAAC,CAAC;AAD9C,QAAA,aAAa,iBACiC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './';
|
|
1
|
+
export * from './Wizard';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/next/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/next/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/next/components/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/next/components/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB"}
|