@elliemae/ds-wizard 3.12.0-next.0 → 3.12.0-next.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/dist/cjs/WizardStep.js +3 -3
- package/dist/cjs/WizardStep.js.map +2 -2
- package/dist/cjs/WizardSteps.js +4 -9
- package/dist/cjs/WizardSteps.js.map +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/useWizard.js +3 -15
- package/dist/cjs/useWizard.js.map +2 -2
- package/dist/esm/WizardStep.js +3 -3
- package/dist/esm/WizardStep.js.map +2 -2
- package/dist/esm/WizardSteps.js +4 -9
- package/dist/esm/WizardSteps.js.map +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/useWizard.js +3 -15
- package/dist/esm/useWizard.js.map +2 -2
- package/package.json +4 -4
package/dist/cjs/WizardStep.js
CHANGED
|
@@ -43,7 +43,7 @@ const Wrapper = (0, import_ds_classnames.aggregatedClasses)("div")(`${import_blo
|
|
|
43
43
|
const Label = (0, import_ds_classnames.aggregatedClasses)("span")(import_blockNames.indicatorItemBlockName, "label");
|
|
44
44
|
const Bullet = (0, import_ds_classnames.aggregatedClasses)("div")(import_blockNames.indicatorItemBlockName, "bullet");
|
|
45
45
|
const BulletWrapper = (0, import_ds_classnames.aggregatedClasses)("div")(import_blockNames.indicatorItemBlockName, "bullet-wrapper");
|
|
46
|
-
|
|
46
|
+
const WizardStep = ({
|
|
47
47
|
label = "",
|
|
48
48
|
icon = null,
|
|
49
49
|
iconCompleted = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.Checkmark, {}),
|
|
@@ -51,7 +51,7 @@ function WizardStep({
|
|
|
51
51
|
active = false,
|
|
52
52
|
completed = false,
|
|
53
53
|
index = 0
|
|
54
|
-
}) {
|
|
54
|
+
}) => {
|
|
55
55
|
const currentIcon = (0, import_react.useMemo)(() => {
|
|
56
56
|
if (active)
|
|
57
57
|
return iconActive;
|
|
@@ -80,7 +80,7 @@ function WizardStep({
|
|
|
80
80
|
]
|
|
81
81
|
})
|
|
82
82
|
});
|
|
83
|
-
}
|
|
83
|
+
};
|
|
84
84
|
const wizzardStepProps = {
|
|
85
85
|
label: import_ds_utilities.PropTypes.string.description("Step label"),
|
|
86
86
|
icon: import_ds_utilities.PropTypes.oneOfType([import_ds_utilities.PropTypes.element, import_ds_utilities.PropTypes.string]).description("Default icon or number"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/WizardStep.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable indent */\nimport React, { cloneElement, useMemo, isValidElement } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { describe, PropTypes, get } from '@elliemae/ds-utilities';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport { indicatorItemBlockName } from './blockNames';\n\nconst Item = aggregatedClasses('div')(`${indicatorItemBlockName}`, null, ({ active, completed }) => ({\n active,\n completed,\n}));\nconst Wrapper = aggregatedClasses('div')(`${indicatorItemBlockName}-wrapper`);\nconst Label = aggregatedClasses('span')(indicatorItemBlockName, 'label');\nconst Bullet = aggregatedClasses('div')(indicatorItemBlockName, 'bullet');\nconst BulletWrapper = aggregatedClasses('div')(indicatorItemBlockName, 'bullet-wrapper');\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBL;AAlBlB,mBAA6D;AAC7D,2BAAkC;AAClC,0BAAyC;AACzC,sBAA0B;AAC1B,wBAAuC;AAEvC,MAAM,WAAO,wCAAkB,KAAK,EAAE,GAAG,4CAA0B,MAAM,CAAC,EAAE,QAAQ,UAAU,OAAO;AAAA,EACnG;AAAA,EACA;AACF,EAAE;AACF,MAAM,cAAU,wCAAkB,KAAK,EAAE,GAAG,kDAAgC;AAC5E,MAAM,YAAQ,wCAAkB,MAAM,EAAE,0CAAwB,OAAO;AACvE,MAAM,aAAS,wCAAkB,KAAK,EAAE,0CAAwB,QAAQ;AACxE,MAAM,oBAAgB,wCAAkB,KAAK,EAAE,0CAAwB,gBAAgB;AAEvF,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable indent */\nimport React, { cloneElement, useMemo, isValidElement } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { describe, PropTypes, get } from '@elliemae/ds-utilities';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport { indicatorItemBlockName } from './blockNames';\n\nconst Item = aggregatedClasses('div')(`${indicatorItemBlockName}`, null, ({ active, completed }) => ({\n active,\n completed,\n}));\nconst Wrapper = aggregatedClasses('div')(`${indicatorItemBlockName}-wrapper`);\nconst Label = aggregatedClasses('span')(indicatorItemBlockName, 'label');\nconst Bullet = aggregatedClasses('div')(indicatorItemBlockName, 'bullet');\nconst BulletWrapper = aggregatedClasses('div')(indicatorItemBlockName, 'bullet-wrapper');\n\nconst WizardStep = ({\n label = '',\n icon = null,\n iconCompleted = <Checkmark />,\n iconActive = null,\n active = false,\n completed = false,\n index = 0,\n}) => {\n const currentIcon =\n useMemo(() => {\n if (active) return iconActive;\n if (completed) return iconCompleted;\n return icon;\n }, [active, completed]) || icon;\n\n const iconWithOptions = useMemo(\n () =>\n isValidElement(currentIcon)\n ? cloneElement(currentIcon, {\n color: get(currentIcon, ['props', 'color']) || ['brand-primary', completed ? 600 : 500],\n })\n : currentIcon || index + 1,\n [currentIcon],\n );\n\n return (\n <Item classProps={{ active, completed }}>\n <Wrapper>\n <BulletWrapper>\n <Bullet>{iconWithOptions}</Bullet>\n </BulletWrapper>\n <Label>{label}</Label>\n </Wrapper>\n </Item>\n );\n};\n\nconst wizzardStepProps = {\n label: PropTypes.string.description('Step label'),\n icon: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).description('Default icon or number'),\n iconCompleted: PropTypes.element.description('Icon when the step is completed').defaultValue(Checkmark),\n iconActive: PropTypes.element.description('Icon when the step is active'),\n active: PropTypes.bool.description('Whether the step is active or not').defaultValue(false),\n completed: PropTypes.bool.description('Whether the step is completed or not').defaultValue(false),\n index: PropTypes.number.description('Current item index'),\n};\n\nWizardStep.propTypes = wizzardStepProps;\nWizardStep.displayName = 'WizardStep';\nconst WizzardStepWithSchema = describe(WizardStep);\nWizzardStepWithSchema.propTypes = wizzardStepProps;\n\nexport { WizzardStepWithSchema };\nexport default WizardStep;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBL;AAlBlB,mBAA6D;AAC7D,2BAAkC;AAClC,0BAAyC;AACzC,sBAA0B;AAC1B,wBAAuC;AAEvC,MAAM,WAAO,wCAAkB,KAAK,EAAE,GAAG,4CAA0B,MAAM,CAAC,EAAE,QAAQ,UAAU,OAAO;AAAA,EACnG;AAAA,EACA;AACF,EAAE;AACF,MAAM,cAAU,wCAAkB,KAAK,EAAE,GAAG,kDAAgC;AAC5E,MAAM,YAAQ,wCAAkB,MAAM,EAAE,0CAAwB,OAAO;AACvE,MAAM,aAAS,wCAAkB,KAAK,EAAE,0CAAwB,QAAQ;AACxE,MAAM,oBAAgB,wCAAkB,KAAK,EAAE,0CAAwB,gBAAgB;AAEvF,MAAM,aAAa,CAAC;AAAA,EAClB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB,4CAAC,6BAAU;AAAA,EAC3B,aAAa;AAAA,EACb,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AACV,MAAM;AACJ,QAAM,kBACJ,sBAAQ,MAAM;AACZ,QAAI;AAAQ,aAAO;AACnB,QAAI;AAAW,aAAO;AACtB,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,SAAS,CAAC,KAAK;AAE7B,QAAM,sBAAkB;AAAA,IACtB,UACE,6BAAe,WAAW,QACtB,2BAAa,aAAa;AAAA,MACxB,WAAO,yBAAI,aAAa,CAAC,SAAS,OAAO,CAAC,KAAK,CAAC,iBAAiB,YAAY,MAAM,GAAG;AAAA,IACxF,CAAC,IACD,eAAe,QAAQ;AAAA,IAC7B,CAAC,WAAW;AAAA,EACd;AAEA,SACE,4CAAC;AAAA,IAAK,YAAY,EAAE,QAAQ,UAAU;AAAA,IACpC,uDAAC;AAAA,MACC;AAAA,oDAAC;AAAA,UACC,sDAAC;AAAA,YAAQ;AAAA,WAAgB;AAAA,SAC3B;AAAA,QACA,4CAAC;AAAA,UAAO;AAAA,SAAM;AAAA;AAAA,KAChB;AAAA,GACF;AAEJ;AAEA,MAAM,mBAAmB;AAAA,EACvB,OAAO,8BAAU,OAAO,YAAY,YAAY;AAAA,EAChD,MAAM,8BAAU,UAAU,CAAC,8BAAU,SAAS,8BAAU,MAAM,CAAC,EAAE,YAAY,wBAAwB;AAAA,EACrG,eAAe,8BAAU,QAAQ,YAAY,iCAAiC,EAAE,aAAa,yBAAS;AAAA,EACtG,YAAY,8BAAU,QAAQ,YAAY,8BAA8B;AAAA,EACxE,QAAQ,8BAAU,KAAK,YAAY,mCAAmC,EAAE,aAAa,KAAK;AAAA,EAC1F,WAAW,8BAAU,KAAK,YAAY,sCAAsC,EAAE,aAAa,KAAK;AAAA,EAChG,OAAO,8BAAU,OAAO,YAAY,oBAAoB;AAC1D;AAEA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,4BAAwB,8BAAS,UAAU;AACjD,sBAAsB,YAAY;AAGlC,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/WizardSteps.js
CHANGED
|
@@ -36,7 +36,7 @@ var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
|
36
36
|
var import_WizardStep = __toESM(require("./WizardStep"));
|
|
37
37
|
var import_blockNames = require("./blockNames");
|
|
38
38
|
const StepsWrapper = (0, import_ds_classnames.aggregatedClasses)("div")(import_blockNames.indicatorBlockName);
|
|
39
|
-
|
|
39
|
+
const WizardSteps = ({ current = 0, steps, children, ...otherProps }) => {
|
|
40
40
|
const items = (0, import_react.useMemo)(() => {
|
|
41
41
|
const mergeStepProps = (step, index) => ({
|
|
42
42
|
index,
|
|
@@ -46,23 +46,18 @@ function WizardSteps({ current = 0, steps, children, ...otherProps }) {
|
|
|
46
46
|
return steps ? steps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_WizardStep.default, {
|
|
47
47
|
...step,
|
|
48
48
|
...mergeStepProps(step, index)
|
|
49
|
-
}, index)) : import_react.default.Children.map(
|
|
50
|
-
children,
|
|
51
|
-
(item, index) => (0, import_react.cloneElement)(item, mergeStepProps(item, index))
|
|
52
|
-
);
|
|
49
|
+
}, index)) : import_react.default.Children.map(children, (item, index) => (0, import_react.cloneElement)(item, mergeStepProps(item, index)));
|
|
53
50
|
}, [current, children]);
|
|
54
51
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StepsWrapper, {
|
|
55
52
|
...otherProps,
|
|
56
53
|
children: items
|
|
57
54
|
});
|
|
58
|
-
}
|
|
55
|
+
};
|
|
59
56
|
WizardSteps.Item = import_WizardStep.default;
|
|
60
57
|
const wizzardProps = {
|
|
61
58
|
current: import_ds_utilities.PropTypes.number.description("Current active state index").defaultValue(0),
|
|
62
59
|
steps: import_ds_utilities.PropTypes.arrayOf(import_ds_utilities.PropTypes.shape({})).description("Array of steps objects").defaultValue([]).isRequired,
|
|
63
|
-
children: import_ds_utilities.PropTypes.arrayOf(import_ds_utilities.PropTypes.instanceOf(import_WizardStep.default)).description(
|
|
64
|
-
"List of WizardStep components"
|
|
65
|
-
)
|
|
60
|
+
children: import_ds_utilities.PropTypes.arrayOf(import_ds_utilities.PropTypes.instanceOf(import_WizardStep.default)).description("List of WizardStep components")
|
|
66
61
|
};
|
|
67
62
|
WizardSteps.propTypes = wizzardProps;
|
|
68
63
|
WizardSteps.displayName = "WizardSteps";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/WizardSteps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable indent */\n/* eslint-disable react/no-array-index-key */\nimport React, { cloneElement, useMemo } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport WizardStep from './WizardStep';\nimport { indicatorBlockName } from './blockNames';\n\nconst StepsWrapper = aggregatedClasses('div')(indicatorBlockName);\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable indent */\n/* eslint-disable react/no-array-index-key */\nimport React, { cloneElement, useMemo } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport WizardStep from './WizardStep';\nimport { indicatorBlockName } from './blockNames';\n\nconst StepsWrapper = aggregatedClasses('div')(indicatorBlockName);\n\nconst WizardSteps = ({ current = 0, steps, children, ...otherProps }) => {\n const items = useMemo(() => {\n const mergeStepProps = (step, index) => ({\n index,\n active: current === index,\n completed: index < current,\n });\n\n return steps\n ? steps.map((step, index) => <WizardStep key={index} {...step} {...mergeStepProps(step, index)} />)\n : React.Children.map(children, (item, index) => cloneElement(item, mergeStepProps(item, index)));\n }, [current, children]);\n\n return <StepsWrapper {...otherProps}>{items}</StepsWrapper>;\n};\n\nWizardSteps.Item = WizardStep;\n\nconst wizzardProps = {\n current: PropTypes.number.description('Current active state index').defaultValue(0),\n steps: PropTypes.arrayOf(PropTypes.shape({})).description('Array of steps objects').defaultValue([]).isRequired,\n children: PropTypes.arrayOf(PropTypes.instanceOf(WizardStep)).description('List of WizardStep components'),\n};\n\nWizardSteps.propTypes = wizzardProps;\nWizardSteps.displayName = 'WizardSteps';\nconst WizzardWithSchema = describe(WizardSteps);\nWizzardWithSchema.propTypes = wizzardProps;\n\nexport { WizzardWithSchema };\nexport default WizardSteps;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBY;AAjBnC,mBAA6C;AAC7C,0BAAoC;AACpC,2BAAkC;AAClC,wBAAuB;AACvB,wBAAmC;AAEnC,MAAM,mBAAe,wCAAkB,KAAK,EAAE,oCAAkB;AAEhE,MAAM,cAAc,CAAC,EAAE,UAAU,GAAG,OAAO,aAAa,WAAW,MAAM;AACvE,QAAM,YAAQ,sBAAQ,MAAM;AAC1B,UAAM,iBAAiB,CAAC,MAAM,WAAW;AAAA,MACvC;AAAA,MACA,QAAQ,YAAY;AAAA,MACpB,WAAW,QAAQ;AAAA,IACrB;AAEA,WAAO,QACH,MAAM,IAAI,CAAC,MAAM,UAAU,4CAAC,kBAAAA,SAAA;AAAA,MAAwB,GAAG;AAAA,MAAO,GAAG,eAAe,MAAM,KAAK;AAAA,OAA/C,KAAkD,CAAE,IAChG,aAAAC,QAAM,SAAS,IAAI,UAAU,CAAC,MAAM,cAAU,2BAAa,MAAM,eAAe,MAAM,KAAK,CAAC,CAAC;AAAA,EACnG,GAAG,CAAC,SAAS,QAAQ,CAAC;AAEtB,SAAO,4CAAC;AAAA,IAAc,GAAG;AAAA,IAAa;AAAA,GAAM;AAC9C;AAEA,YAAY,OAAO,kBAAAD;AAEnB,MAAM,eAAe;AAAA,EACnB,SAAS,8BAAU,OAAO,YAAY,4BAA4B,EAAE,aAAa,CAAC;AAAA,EAClF,OAAO,8BAAU,QAAQ,8BAAU,MAAM,CAAC,CAAC,CAAC,EAAE,YAAY,wBAAwB,EAAE,aAAa,CAAC,CAAC,EAAE;AAAA,EACrG,UAAU,8BAAU,QAAQ,8BAAU,WAAW,kBAAAA,OAAU,CAAC,EAAE,YAAY,+BAA+B;AAC3G;AAEA,YAAY,YAAY;AACxB,YAAY,cAAc;AAC1B,MAAM,wBAAoB,8BAAS,WAAW;AAC9C,kBAAkB,YAAY;AAG9B,IAAO,sBAAQ;",
|
|
6
6
|
"names": ["WizardStep", "React"]
|
|
7
7
|
}
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import WizardStepsIndicator, { WizzardWithSchema } from './WizardSteps';\nimport WizardStep, { WizzardStepWithSchema } from './WizardStep';\nimport useWizard from './useWizard';\n\nexport {
|
|
4
|
+
"sourcesContent": ["import WizardStepsIndicator, { WizzardWithSchema } from './WizardSteps';\nimport WizardStep, { WizzardStepWithSchema } from './WizardStep';\nimport useWizard from './useWizard';\n\nexport { useWizard, WizardStepsIndicator, WizardStep, WizzardWithSchema, WizzardStepWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,sCAAAA;AAAA,EAAA,+CAAAC;AAAA,EAAA;AAAA;AAAA,oCAAAC;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAAwD;AACxD,wBAAkD;AAClD,uBAAsB;",
|
|
6
6
|
"names": ["WizardStep", "WizardStepsIndicator", "useWizard"]
|
|
7
7
|
}
|
package/dist/cjs/useWizard.js
CHANGED
|
@@ -33,16 +33,8 @@ var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
|
33
33
|
const checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;
|
|
34
34
|
const checkCanPrevious = (prevIndex) => prevIndex - 1 >= 0;
|
|
35
35
|
const noop = () => null;
|
|
36
|
-
function useWizard({
|
|
37
|
-
|
|
38
|
-
current,
|
|
39
|
-
onNext = noop,
|
|
40
|
-
onPrevious = noop,
|
|
41
|
-
initial = 0
|
|
42
|
-
}) {
|
|
43
|
-
const [currentStep, setCurrentStep] = (0, import_ds_utilities.useDerivedStateFromProps)(
|
|
44
|
-
current || initial
|
|
45
|
-
);
|
|
36
|
+
function useWizard({ steps: wizardSteps, current, onNext = noop, onPrevious = noop, initial = 0 }) {
|
|
37
|
+
const [currentStep, setCurrentStep] = (0, import_ds_utilities.useDerivedStateFromProps)(current || initial);
|
|
46
38
|
const handleNext = (0, import_react.useCallback)(() => {
|
|
47
39
|
if (checkCanNext(currentStep, wizardSteps)) {
|
|
48
40
|
onNext(currentStep);
|
|
@@ -61,11 +53,7 @@ function useWizard({
|
|
|
61
53
|
previous: handlePrevious,
|
|
62
54
|
canNext: checkCanNext(currentStep, wizardSteps),
|
|
63
55
|
canPrevious: checkCanPrevious(currentStep),
|
|
64
|
-
WizardCurrentContent: (0, import_ds_utilities.get)(
|
|
65
|
-
wizardSteps,
|
|
66
|
-
[currentStep, "content"],
|
|
67
|
-
() => null
|
|
68
|
-
)
|
|
56
|
+
WizardCurrentContent: (0, import_ds_utilities.get)(wizardSteps, [currentStep, "content"], () => null)
|
|
69
57
|
};
|
|
70
58
|
}
|
|
71
59
|
//# sourceMappingURL=useWizard.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useWizard.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useCallback } from 'react';\nimport { get, useDerivedStateFromProps } from '@elliemae/ds-utilities';\n\nconst checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;\nconst checkCanPrevious = prevIndex => prevIndex - 1 >= 0;\n\nconst noop = () => null;\n\nexport default function useWizard({
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4B;AAC5B,0BAA8C;AAE9C,MAAM,eAAe,CAAC,WAAW,UAAU,MAAM,SAAS,YAAY;AACtE,MAAM,mBAAmB,
|
|
4
|
+
"sourcesContent": ["import { useCallback } from 'react';\nimport { get, useDerivedStateFromProps } from '@elliemae/ds-utilities';\n\nconst checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;\nconst checkCanPrevious = (prevIndex) => prevIndex - 1 >= 0;\n\nconst noop = () => null;\n\nexport default function useWizard({ steps: wizardSteps, current, onNext = noop, onPrevious = noop, initial = 0 }) {\n const [currentStep, setCurrentStep] = useDerivedStateFromProps(current || initial);\n\n const handleNext = useCallback(() => {\n if (checkCanNext(currentStep, wizardSteps)) {\n onNext(currentStep);\n setCurrentStep(currentStep + 1);\n }\n });\n\n const handlePrevious = useCallback(() => {\n if (checkCanPrevious(currentStep)) {\n onPrevious(currentStep);\n setCurrentStep(currentStep - 1);\n }\n });\n\n return {\n current: currentStep,\n next: handleNext,\n previous: handlePrevious,\n canNext: checkCanNext(currentStep, wizardSteps),\n canPrevious: checkCanPrevious(currentStep),\n WizardCurrentContent: get(wizardSteps, [currentStep, 'content'], () => null),\n };\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4B;AAC5B,0BAA8C;AAE9C,MAAM,eAAe,CAAC,WAAW,UAAU,MAAM,SAAS,YAAY;AACtE,MAAM,mBAAmB,CAAC,cAAc,YAAY,KAAK;AAEzD,MAAM,OAAO,MAAM;AAEJ,SAAR,UAA2B,EAAE,OAAO,aAAa,SAAS,SAAS,MAAM,aAAa,MAAM,UAAU,EAAE,GAAG;AAChH,QAAM,CAAC,aAAa,cAAc,QAAI,8CAAyB,WAAW,OAAO;AAEjF,QAAM,iBAAa,0BAAY,MAAM;AACnC,QAAI,aAAa,aAAa,WAAW,GAAG;AAC1C,aAAO,WAAW;AAClB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,CAAC;AAED,QAAM,qBAAiB,0BAAY,MAAM;AACvC,QAAI,iBAAiB,WAAW,GAAG;AACjC,iBAAW,WAAW;AACtB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS,aAAa,aAAa,WAAW;AAAA,IAC9C,aAAa,iBAAiB,WAAW;AAAA,IACzC,0BAAsB,yBAAI,aAAa,CAAC,aAAa,SAAS,GAAG,MAAM,IAAI;AAAA,EAC7E;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/WizardStep.js
CHANGED
|
@@ -13,7 +13,7 @@ const Wrapper = aggregatedClasses("div")(`${indicatorItemBlockName}-wrapper`);
|
|
|
13
13
|
const Label = aggregatedClasses("span")(indicatorItemBlockName, "label");
|
|
14
14
|
const Bullet = aggregatedClasses("div")(indicatorItemBlockName, "bullet");
|
|
15
15
|
const BulletWrapper = aggregatedClasses("div")(indicatorItemBlockName, "bullet-wrapper");
|
|
16
|
-
|
|
16
|
+
const WizardStep = ({
|
|
17
17
|
label = "",
|
|
18
18
|
icon = null,
|
|
19
19
|
iconCompleted = /* @__PURE__ */ jsx(Checkmark, {}),
|
|
@@ -21,7 +21,7 @@ function WizardStep({
|
|
|
21
21
|
active = false,
|
|
22
22
|
completed = false,
|
|
23
23
|
index = 0
|
|
24
|
-
}) {
|
|
24
|
+
}) => {
|
|
25
25
|
const currentIcon = useMemo(() => {
|
|
26
26
|
if (active)
|
|
27
27
|
return iconActive;
|
|
@@ -50,7 +50,7 @@ function WizardStep({
|
|
|
50
50
|
]
|
|
51
51
|
})
|
|
52
52
|
});
|
|
53
|
-
}
|
|
53
|
+
};
|
|
54
54
|
const wizzardStepProps = {
|
|
55
55
|
label: PropTypes.string.description("Step label"),
|
|
56
56
|
icon: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).description("Default icon or number"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/WizardStep.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\nimport React, { cloneElement, useMemo, isValidElement } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { describe, PropTypes, get } from '@elliemae/ds-utilities';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport { indicatorItemBlockName } from './blockNames';\n\nconst Item = aggregatedClasses('div')(`${indicatorItemBlockName}`, null, ({ active, completed }) => ({\n active,\n completed,\n}));\nconst Wrapper = aggregatedClasses('div')(`${indicatorItemBlockName}-wrapper`);\nconst Label = aggregatedClasses('span')(indicatorItemBlockName, 'label');\nconst Bullet = aggregatedClasses('div')(indicatorItemBlockName, 'bullet');\nconst BulletWrapper = aggregatedClasses('div')(indicatorItemBlockName, 'bullet-wrapper');\n\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACmBL,cAyBZ,YAzBY;AAlBlB,SAAgB,cAAc,SAAS,sBAAsB;AAC7D,SAAS,yBAAyB;AAClC,SAAS,UAAU,WAAW,WAAW;AACzC,SAAS,iBAAiB;AAC1B,SAAS,8BAA8B;AAEvC,MAAM,OAAO,kBAAkB,KAAK,EAAE,GAAG,0BAA0B,MAAM,CAAC,EAAE,QAAQ,UAAU,OAAO;AAAA,EACnG;AAAA,EACA;AACF,EAAE;AACF,MAAM,UAAU,kBAAkB,KAAK,EAAE,GAAG,gCAAgC;AAC5E,MAAM,QAAQ,kBAAkB,MAAM,EAAE,wBAAwB,OAAO;AACvE,MAAM,SAAS,kBAAkB,KAAK,EAAE,wBAAwB,QAAQ;AACxE,MAAM,gBAAgB,kBAAkB,KAAK,EAAE,wBAAwB,gBAAgB;AAEvF,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\nimport React, { cloneElement, useMemo, isValidElement } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { describe, PropTypes, get } from '@elliemae/ds-utilities';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport { indicatorItemBlockName } from './blockNames';\n\nconst Item = aggregatedClasses('div')(`${indicatorItemBlockName}`, null, ({ active, completed }) => ({\n active,\n completed,\n}));\nconst Wrapper = aggregatedClasses('div')(`${indicatorItemBlockName}-wrapper`);\nconst Label = aggregatedClasses('span')(indicatorItemBlockName, 'label');\nconst Bullet = aggregatedClasses('div')(indicatorItemBlockName, 'bullet');\nconst BulletWrapper = aggregatedClasses('div')(indicatorItemBlockName, 'bullet-wrapper');\n\nconst WizardStep = ({\n label = '',\n icon = null,\n iconCompleted = <Checkmark />,\n iconActive = null,\n active = false,\n completed = false,\n index = 0,\n}) => {\n const currentIcon =\n useMemo(() => {\n if (active) return iconActive;\n if (completed) return iconCompleted;\n return icon;\n }, [active, completed]) || icon;\n\n const iconWithOptions = useMemo(\n () =>\n isValidElement(currentIcon)\n ? cloneElement(currentIcon, {\n color: get(currentIcon, ['props', 'color']) || ['brand-primary', completed ? 600 : 500],\n })\n : currentIcon || index + 1,\n [currentIcon],\n );\n\n return (\n <Item classProps={{ active, completed }}>\n <Wrapper>\n <BulletWrapper>\n <Bullet>{iconWithOptions}</Bullet>\n </BulletWrapper>\n <Label>{label}</Label>\n </Wrapper>\n </Item>\n );\n};\n\nconst wizzardStepProps = {\n label: PropTypes.string.description('Step label'),\n icon: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).description('Default icon or number'),\n iconCompleted: PropTypes.element.description('Icon when the step is completed').defaultValue(Checkmark),\n iconActive: PropTypes.element.description('Icon when the step is active'),\n active: PropTypes.bool.description('Whether the step is active or not').defaultValue(false),\n completed: PropTypes.bool.description('Whether the step is completed or not').defaultValue(false),\n index: PropTypes.number.description('Current item index'),\n};\n\nWizardStep.propTypes = wizzardStepProps;\nWizardStep.displayName = 'WizardStep';\nconst WizzardStepWithSchema = describe(WizardStep);\nWizzardStepWithSchema.propTypes = wizzardStepProps;\n\nexport { WizzardStepWithSchema };\nexport default WizardStep;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACmBL,cAyBZ,YAzBY;AAlBlB,SAAgB,cAAc,SAAS,sBAAsB;AAC7D,SAAS,yBAAyB;AAClC,SAAS,UAAU,WAAW,WAAW;AACzC,SAAS,iBAAiB;AAC1B,SAAS,8BAA8B;AAEvC,MAAM,OAAO,kBAAkB,KAAK,EAAE,GAAG,0BAA0B,MAAM,CAAC,EAAE,QAAQ,UAAU,OAAO;AAAA,EACnG;AAAA,EACA;AACF,EAAE;AACF,MAAM,UAAU,kBAAkB,KAAK,EAAE,GAAG,gCAAgC;AAC5E,MAAM,QAAQ,kBAAkB,MAAM,EAAE,wBAAwB,OAAO;AACvE,MAAM,SAAS,kBAAkB,KAAK,EAAE,wBAAwB,QAAQ;AACxE,MAAM,gBAAgB,kBAAkB,KAAK,EAAE,wBAAwB,gBAAgB;AAEvF,MAAM,aAAa,CAAC;AAAA,EAClB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB,oBAAC,aAAU;AAAA,EAC3B,aAAa;AAAA,EACb,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AACV,MAAM;AACJ,QAAM,cACJ,QAAQ,MAAM;AACZ,QAAI;AAAQ,aAAO;AACnB,QAAI;AAAW,aAAO;AACtB,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,SAAS,CAAC,KAAK;AAE7B,QAAM,kBAAkB;AAAA,IACtB,MACE,eAAe,WAAW,IACtB,aAAa,aAAa;AAAA,MACxB,OAAO,IAAI,aAAa,CAAC,SAAS,OAAO,CAAC,KAAK,CAAC,iBAAiB,YAAY,MAAM,GAAG;AAAA,IACxF,CAAC,IACD,eAAe,QAAQ;AAAA,IAC7B,CAAC,WAAW;AAAA,EACd;AAEA,SACE,oBAAC;AAAA,IAAK,YAAY,EAAE,QAAQ,UAAU;AAAA,IACpC,+BAAC;AAAA,MACC;AAAA,4BAAC;AAAA,UACC,8BAAC;AAAA,YAAQ;AAAA,WAAgB;AAAA,SAC3B;AAAA,QACA,oBAAC;AAAA,UAAO;AAAA,SAAM;AAAA;AAAA,KAChB;AAAA,GACF;AAEJ;AAEA,MAAM,mBAAmB;AAAA,EACvB,OAAO,UAAU,OAAO,YAAY,YAAY;AAAA,EAChD,MAAM,UAAU,UAAU,CAAC,UAAU,SAAS,UAAU,MAAM,CAAC,EAAE,YAAY,wBAAwB;AAAA,EACrG,eAAe,UAAU,QAAQ,YAAY,iCAAiC,EAAE,aAAa,SAAS;AAAA,EACtG,YAAY,UAAU,QAAQ,YAAY,8BAA8B;AAAA,EACxE,QAAQ,UAAU,KAAK,YAAY,mCAAmC,EAAE,aAAa,KAAK;AAAA,EAC1F,WAAW,UAAU,KAAK,YAAY,sCAAsC,EAAE,aAAa,KAAK;AAAA,EAChG,OAAO,UAAU,OAAO,YAAY,oBAAoB;AAC1D;AAEA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,wBAAwB,SAAS,UAAU;AACjD,sBAAsB,YAAY;AAGlC,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/WizardSteps.js
CHANGED
|
@@ -6,7 +6,7 @@ import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
|
6
6
|
import WizardStep from "./WizardStep";
|
|
7
7
|
import { indicatorBlockName } from "./blockNames";
|
|
8
8
|
const StepsWrapper = aggregatedClasses("div")(indicatorBlockName);
|
|
9
|
-
|
|
9
|
+
const WizardSteps = ({ current = 0, steps, children, ...otherProps }) => {
|
|
10
10
|
const items = useMemo(() => {
|
|
11
11
|
const mergeStepProps = (step, index) => ({
|
|
12
12
|
index,
|
|
@@ -16,23 +16,18 @@ function WizardSteps({ current = 0, steps, children, ...otherProps }) {
|
|
|
16
16
|
return steps ? steps.map((step, index) => /* @__PURE__ */ jsx(WizardStep, {
|
|
17
17
|
...step,
|
|
18
18
|
...mergeStepProps(step, index)
|
|
19
|
-
}, index)) : React2.Children.map(
|
|
20
|
-
children,
|
|
21
|
-
(item, index) => cloneElement(item, mergeStepProps(item, index))
|
|
22
|
-
);
|
|
19
|
+
}, index)) : React2.Children.map(children, (item, index) => cloneElement(item, mergeStepProps(item, index)));
|
|
23
20
|
}, [current, children]);
|
|
24
21
|
return /* @__PURE__ */ jsx(StepsWrapper, {
|
|
25
22
|
...otherProps,
|
|
26
23
|
children: items
|
|
27
24
|
});
|
|
28
|
-
}
|
|
25
|
+
};
|
|
29
26
|
WizardSteps.Item = WizardStep;
|
|
30
27
|
const wizzardProps = {
|
|
31
28
|
current: PropTypes.number.description("Current active state index").defaultValue(0),
|
|
32
29
|
steps: PropTypes.arrayOf(PropTypes.shape({})).description("Array of steps objects").defaultValue([]).isRequired,
|
|
33
|
-
children: PropTypes.arrayOf(PropTypes.instanceOf(WizardStep)).description(
|
|
34
|
-
"List of WizardStep components"
|
|
35
|
-
)
|
|
30
|
+
children: PropTypes.arrayOf(PropTypes.instanceOf(WizardStep)).description("List of WizardStep components")
|
|
36
31
|
};
|
|
37
32
|
WizardSteps.propTypes = wizzardProps;
|
|
38
33
|
WizardSteps.displayName = "WizardSteps";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/WizardSteps.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\n/* eslint-disable react/no-array-index-key */\nimport React, { cloneElement, useMemo } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport WizardStep from './WizardStep';\nimport { indicatorBlockName } from './blockNames';\n\nconst StepsWrapper = aggregatedClasses('div')(indicatorBlockName);\n\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\n/* eslint-disable react/no-array-index-key */\nimport React, { cloneElement, useMemo } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport WizardStep from './WizardStep';\nimport { indicatorBlockName } from './blockNames';\n\nconst StepsWrapper = aggregatedClasses('div')(indicatorBlockName);\n\nconst WizardSteps = ({ current = 0, steps, children, ...otherProps }) => {\n const items = useMemo(() => {\n const mergeStepProps = (step, index) => ({\n index,\n active: current === index,\n completed: index < current,\n });\n\n return steps\n ? steps.map((step, index) => <WizardStep key={index} {...step} {...mergeStepProps(step, index)} />)\n : React.Children.map(children, (item, index) => cloneElement(item, mergeStepProps(item, index)));\n }, [current, children]);\n\n return <StepsWrapper {...otherProps}>{items}</StepsWrapper>;\n};\n\nWizardSteps.Item = WizardStep;\n\nconst wizzardProps = {\n current: PropTypes.number.description('Current active state index').defaultValue(0),\n steps: PropTypes.arrayOf(PropTypes.shape({})).description('Array of steps objects').defaultValue([]).isRequired,\n children: PropTypes.arrayOf(PropTypes.instanceOf(WizardStep)).description('List of WizardStep components'),\n};\n\nWizardSteps.propTypes = wizzardProps;\nWizardSteps.displayName = 'WizardSteps';\nconst WizzardWithSchema = describe(WizardSteps);\nWizzardWithSchema.propTypes = wizzardProps;\n\nexport { WizzardWithSchema };\nexport default WizardSteps;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACmBY;AAjBnC,OAAOA,UAAS,cAAc,eAAe;AAC7C,SAAS,UAAU,iBAAiB;AACpC,SAAS,yBAAyB;AAClC,OAAO,gBAAgB;AACvB,SAAS,0BAA0B;AAEnC,MAAM,eAAe,kBAAkB,KAAK,EAAE,kBAAkB;AAEhE,MAAM,cAAc,CAAC,EAAE,UAAU,GAAG,OAAO,aAAa,WAAW,MAAM;AACvE,QAAM,QAAQ,QAAQ,MAAM;AAC1B,UAAM,iBAAiB,CAAC,MAAM,WAAW;AAAA,MACvC;AAAA,MACA,QAAQ,YAAY;AAAA,MACpB,WAAW,QAAQ;AAAA,IACrB;AAEA,WAAO,QACH,MAAM,IAAI,CAAC,MAAM,UAAU,oBAAC;AAAA,MAAwB,GAAG;AAAA,MAAO,GAAG,eAAe,MAAM,KAAK;AAAA,OAA/C,KAAkD,CAAE,IAChGA,OAAM,SAAS,IAAI,UAAU,CAAC,MAAM,UAAU,aAAa,MAAM,eAAe,MAAM,KAAK,CAAC,CAAC;AAAA,EACnG,GAAG,CAAC,SAAS,QAAQ,CAAC;AAEtB,SAAO,oBAAC;AAAA,IAAc,GAAG;AAAA,IAAa;AAAA,GAAM;AAC9C;AAEA,YAAY,OAAO;AAEnB,MAAM,eAAe;AAAA,EACnB,SAAS,UAAU,OAAO,YAAY,4BAA4B,EAAE,aAAa,CAAC;AAAA,EAClF,OAAO,UAAU,QAAQ,UAAU,MAAM,CAAC,CAAC,CAAC,EAAE,YAAY,wBAAwB,EAAE,aAAa,CAAC,CAAC,EAAE;AAAA,EACrG,UAAU,UAAU,QAAQ,UAAU,WAAW,UAAU,CAAC,EAAE,YAAY,+BAA+B;AAC3G;AAEA,YAAY,YAAY;AACxB,YAAY,cAAc;AAC1B,MAAM,oBAAoB,SAAS,WAAW;AAC9C,kBAAkB,YAAY;AAG9B,IAAO,sBAAQ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import WizardStepsIndicator, { WizzardWithSchema } from './WizardSteps';\nimport WizardStep, { WizzardStepWithSchema } from './WizardStep';\nimport useWizard from './useWizard';\n\nexport {
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import WizardStepsIndicator, { WizzardWithSchema } from './WizardSteps';\nimport WizardStep, { WizzardStepWithSchema } from './WizardStep';\nimport useWizard from './useWizard';\n\nexport { useWizard, WizardStepsIndicator, WizardStep, WizzardWithSchema, WizzardStepWithSchema };\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAO,wBAAwB,yBAAyB;AACxD,OAAO,cAAc,6BAA6B;AAClD,OAAO,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/useWizard.js
CHANGED
|
@@ -4,16 +4,8 @@ import { get, useDerivedStateFromProps } from "@elliemae/ds-utilities";
|
|
|
4
4
|
const checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;
|
|
5
5
|
const checkCanPrevious = (prevIndex) => prevIndex - 1 >= 0;
|
|
6
6
|
const noop = () => null;
|
|
7
|
-
function useWizard({
|
|
8
|
-
|
|
9
|
-
current,
|
|
10
|
-
onNext = noop,
|
|
11
|
-
onPrevious = noop,
|
|
12
|
-
initial = 0
|
|
13
|
-
}) {
|
|
14
|
-
const [currentStep, setCurrentStep] = useDerivedStateFromProps(
|
|
15
|
-
current || initial
|
|
16
|
-
);
|
|
7
|
+
function useWizard({ steps: wizardSteps, current, onNext = noop, onPrevious = noop, initial = 0 }) {
|
|
8
|
+
const [currentStep, setCurrentStep] = useDerivedStateFromProps(current || initial);
|
|
17
9
|
const handleNext = useCallback(() => {
|
|
18
10
|
if (checkCanNext(currentStep, wizardSteps)) {
|
|
19
11
|
onNext(currentStep);
|
|
@@ -32,11 +24,7 @@ function useWizard({
|
|
|
32
24
|
previous: handlePrevious,
|
|
33
25
|
canNext: checkCanNext(currentStep, wizardSteps),
|
|
34
26
|
canPrevious: checkCanPrevious(currentStep),
|
|
35
|
-
WizardCurrentContent: get(
|
|
36
|
-
wizardSteps,
|
|
37
|
-
[currentStep, "content"],
|
|
38
|
-
() => null
|
|
39
|
-
)
|
|
27
|
+
WizardCurrentContent: get(wizardSteps, [currentStep, "content"], () => null)
|
|
40
28
|
};
|
|
41
29
|
}
|
|
42
30
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/useWizard.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback } from 'react';\nimport { get, useDerivedStateFromProps } from '@elliemae/ds-utilities';\n\nconst checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;\nconst checkCanPrevious = prevIndex => prevIndex - 1 >= 0;\n\nconst noop = () => null;\n\nexport default function useWizard({
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,mBAAmB;AAC5B,SAAS,KAAK,gCAAgC;AAE9C,MAAM,eAAe,CAAC,WAAW,UAAU,MAAM,SAAS,YAAY;AACtE,MAAM,mBAAmB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback } from 'react';\nimport { get, useDerivedStateFromProps } from '@elliemae/ds-utilities';\n\nconst checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;\nconst checkCanPrevious = (prevIndex) => prevIndex - 1 >= 0;\n\nconst noop = () => null;\n\nexport default function useWizard({ steps: wizardSteps, current, onNext = noop, onPrevious = noop, initial = 0 }) {\n const [currentStep, setCurrentStep] = useDerivedStateFromProps(current || initial);\n\n const handleNext = useCallback(() => {\n if (checkCanNext(currentStep, wizardSteps)) {\n onNext(currentStep);\n setCurrentStep(currentStep + 1);\n }\n });\n\n const handlePrevious = useCallback(() => {\n if (checkCanPrevious(currentStep)) {\n onPrevious(currentStep);\n setCurrentStep(currentStep - 1);\n }\n });\n\n return {\n current: currentStep,\n next: handleNext,\n previous: handlePrevious,\n canNext: checkCanNext(currentStep, wizardSteps),\n canPrevious: checkCanPrevious(currentStep),\n WizardCurrentContent: get(wizardSteps, [currentStep, 'content'], () => null),\n };\n}\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,mBAAmB;AAC5B,SAAS,KAAK,gCAAgC;AAE9C,MAAM,eAAe,CAAC,WAAW,UAAU,MAAM,SAAS,YAAY;AACtE,MAAM,mBAAmB,CAAC,cAAc,YAAY,KAAK;AAEzD,MAAM,OAAO,MAAM;AAEJ,SAAR,UAA2B,EAAE,OAAO,aAAa,SAAS,SAAS,MAAM,aAAa,MAAM,UAAU,EAAE,GAAG;AAChH,QAAM,CAAC,aAAa,cAAc,IAAI,yBAAyB,WAAW,OAAO;AAEjF,QAAM,aAAa,YAAY,MAAM;AACnC,QAAI,aAAa,aAAa,WAAW,GAAG;AAC1C,aAAO,WAAW;AAClB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,CAAC;AAED,QAAM,iBAAiB,YAAY,MAAM;AACvC,QAAI,iBAAiB,WAAW,GAAG;AACjC,iBAAW,WAAW;AACtB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS,aAAa,aAAa,WAAW;AAAA,IAC9C,aAAa,iBAAiB,WAAW;AAAA,IACzC,sBAAsB,IAAI,aAAa,CAAC,aAAa,SAAS,GAAG,MAAM,IAAI;AAAA,EAC7E;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-wizard",
|
|
3
|
-
"version": "3.12.0-next.
|
|
3
|
+
"version": "3.12.0-next.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Wizard",
|
|
6
6
|
"files": [
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"indent": 4
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@elliemae/ds-classnames": "3.12.0-next.
|
|
59
|
-
"@elliemae/ds-icons": "3.12.0-next.
|
|
60
|
-
"@elliemae/ds-utilities": "3.12.0-next.
|
|
58
|
+
"@elliemae/ds-classnames": "3.12.0-next.1",
|
|
59
|
+
"@elliemae/ds-icons": "3.12.0-next.1",
|
|
60
|
+
"@elliemae/ds-utilities": "3.12.0-next.1"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"lodash": "^4.17.21",
|