@elliemae/ds-wizard 3.21.2 → 3.22.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 +26 -39
- package/dist/cjs/WizardStep.js.map +2 -2
- package/dist/cjs/WizardSteps.js +15 -14
- package/dist/cjs/WizardSteps.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +73 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/styled.js +145 -0
- package/dist/cjs/styled.js.map +7 -0
- package/dist/cjs/useWizard.js +2 -3
- package/dist/cjs/useWizard.js.map +2 -2
- package/dist/esm/WizardStep.js +27 -40
- package/dist/esm/WizardStep.js.map +2 -2
- package/dist/esm/WizardSteps.js +21 -15
- package/dist/esm/WizardSteps.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +43 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/styled.js +115 -0
- package/dist/esm/styled.js.map +7 -0
- package/dist/esm/useWizard.js +2 -3
- package/dist/esm/useWizard.js.map +2 -2
- package/dist/types/WizardStep.d.ts +3 -21
- package/dist/types/WizardSteps.d.ts +12 -0
- package/dist/types/react-desc-prop-types.d.ts +43 -0
- package/dist/types/tests/axe-core.test.d.ts +1 -0
- package/dist/types/useWizard.d.ts +6 -4
- package/package.json +5 -5
- package/dist/cjs/blockNames.js +0 -40
- package/dist/cjs/blockNames.js.map +0 -7
- package/dist/esm/blockNames.js +0 -10
- package/dist/esm/blockNames.js.map +0 -7
- package/dist/types/blockNames.d.ts +0 -3
package/dist/cjs/WizardStep.js
CHANGED
|
@@ -35,58 +35,45 @@ module.exports = __toCommonJS(WizardStep_exports);
|
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
37
|
var import_react = require("react");
|
|
38
|
-
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
39
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
40
38
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
const
|
|
44
|
-
active,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const Label = (0, import_ds_classnames.aggregatedClasses)("span")(import_blockNames.indicatorItemBlockName, "label");
|
|
49
|
-
const Bullet = (0, import_ds_classnames.aggregatedClasses)("div")(import_blockNames.indicatorItemBlockName, "bullet");
|
|
50
|
-
const BulletWrapper = (0, import_ds_classnames.aggregatedClasses)("div")(import_blockNames.indicatorItemBlockName, "bullet-wrapper");
|
|
51
|
-
const WizardStep = ({
|
|
52
|
-
label = "",
|
|
53
|
-
icon = null,
|
|
54
|
-
iconCompleted = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.Checkmark, {}),
|
|
55
|
-
iconActive = null,
|
|
56
|
-
active = false,
|
|
57
|
-
completed = false,
|
|
58
|
-
index = 0
|
|
59
|
-
}) => {
|
|
39
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
40
|
+
var import_styled = require("./styled.js");
|
|
41
|
+
const WizardStep = (props) => {
|
|
42
|
+
const { label, icon, iconCompleted, iconActive, active, completed, index } = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(
|
|
43
|
+
props,
|
|
44
|
+
import_react_desc_prop_types.defaultStepProps
|
|
45
|
+
);
|
|
60
46
|
const currentIcon = (0, import_react.useMemo)(() => {
|
|
61
|
-
if (active)
|
|
47
|
+
if (active && iconActive)
|
|
62
48
|
return iconActive;
|
|
63
|
-
if (completed)
|
|
49
|
+
if (completed && iconCompleted)
|
|
64
50
|
return iconCompleted;
|
|
65
51
|
return icon;
|
|
66
|
-
}, [active, completed, icon, iconActive, iconCompleted])
|
|
52
|
+
}, [active, completed, icon, iconActive, iconCompleted]);
|
|
67
53
|
const iconWithOptions = (0, import_react.useMemo)(
|
|
68
54
|
() => (0, import_react.isValidElement)(currentIcon) ? (0, import_react.cloneElement)(currentIcon, {
|
|
69
|
-
color:
|
|
55
|
+
color: currentIcon?.props?.color ?? [
|
|
56
|
+
"brand-primary",
|
|
57
|
+
completed ? "600" : "500"
|
|
58
|
+
]
|
|
70
59
|
}) : currentIcon || index + 1,
|
|
71
60
|
[completed, currentIcon, index]
|
|
72
61
|
);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
const itemClassName = (0, import_react.useMemo)(() => {
|
|
63
|
+
let className = "em-ds-wizard-steps-indicator-step em-ds-wizard-steps-indicator-step--default";
|
|
64
|
+
if (active)
|
|
65
|
+
className += " em-ds-wizard-steps-indicator-step--active";
|
|
66
|
+
if (completed)
|
|
67
|
+
className += " em-ds-wizard-steps-indicator-step--completed";
|
|
68
|
+
return className;
|
|
69
|
+
}, [active, completed]);
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledItem, { className: itemClassName, active, completed, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledWrapper, { className: "em-ds-wizard-steps-indicator-step-wrapper", children: [
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledBulletWrapper, { className: "em-ds-wizard-steps-indicator-step__bullet-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledBullet, { className: "em-ds-wizard-steps-indicator-step__bullet", children: iconWithOptions }) }),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledLabel, { className: "em-ds-wizard-steps-indicator-step__label", children: label })
|
|
76
73
|
] }) });
|
|
77
74
|
};
|
|
78
|
-
const wizzardStepProps = {
|
|
79
|
-
label: import_ds_props_helpers.PropTypes.string.description("Step label"),
|
|
80
|
-
icon: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.element, import_ds_props_helpers.PropTypes.string]).description("Default icon or number"),
|
|
81
|
-
iconCompleted: import_ds_props_helpers.PropTypes.element.description("Icon when the step is completed").defaultValue(import_ds_icons.Checkmark),
|
|
82
|
-
iconActive: import_ds_props_helpers.PropTypes.element.description("Icon when the step is active"),
|
|
83
|
-
active: import_ds_props_helpers.PropTypes.bool.description("Whether the step is active or not").defaultValue(false),
|
|
84
|
-
completed: import_ds_props_helpers.PropTypes.bool.description("Whether the step is completed or not").defaultValue(false),
|
|
85
|
-
index: import_ds_props_helpers.PropTypes.number.description("Current item index")
|
|
86
|
-
};
|
|
87
|
-
WizardStep.propTypes = wizzardStepProps;
|
|
88
75
|
WizardStep.displayName = "WizardStep";
|
|
89
76
|
const WizzardStepWithSchema = (0, import_ds_props_helpers.describe)(WizardStep);
|
|
90
|
-
WizzardStepWithSchema.propTypes =
|
|
77
|
+
WizzardStepWithSchema.propTypes = import_react_desc_prop_types.DSWizardStepPropsTypesSchema;
|
|
91
78
|
var WizardStep_default = WizardStep;
|
|
92
79
|
//# sourceMappingURL=WizardStep.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/WizardStep.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { cloneElement, useMemo, isValidElement } from 'react';\nimport { describe, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { DSWizardStepPropsTypesSchema, defaultStepProps, type DSWizardT } from './react-desc-prop-types.js';\nimport { StyledBullet, StyledBulletWrapper, StyledItem, StyledLabel, StyledWrapper } from './styled.js';\n\nconst WizardStep = (props: DSWizardT.StepProps) => {\n const { label, icon, iconCompleted, iconActive, active, completed, index } = useMemoMergePropsWithDefault(\n props,\n defaultStepProps,\n );\n\n const currentIcon = useMemo(() => {\n if (active && iconActive) return iconActive;\n if (completed && iconCompleted) return iconCompleted;\n return icon;\n }, [active, completed, icon, iconActive, iconCompleted]);\n\n const iconWithOptions = useMemo(\n () =>\n isValidElement<{ color: [string, string] }>(currentIcon)\n ? cloneElement(currentIcon, {\n color: ((currentIcon?.props as Record<string, unknown>)?.color as [string, string]) ?? [\n 'brand-primary',\n completed ? '600' : '500',\n ],\n })\n : currentIcon || index + 1,\n [completed, currentIcon, index],\n );\n\n const itemClassName = useMemo(() => {\n let className = 'em-ds-wizard-steps-indicator-step em-ds-wizard-steps-indicator-step--default';\n if (active) className += ' em-ds-wizard-steps-indicator-step--active';\n if (completed) className += ' em-ds-wizard-steps-indicator-step--completed';\n return className;\n }, [active, completed]);\n\n return (\n <StyledItem className={itemClassName} active={active} completed={completed}>\n <StyledWrapper className=\"em-ds-wizard-steps-indicator-step-wrapper\">\n <StyledBulletWrapper className=\"em-ds-wizard-steps-indicator-step__bullet-wrapper\">\n <StyledBullet className=\"em-ds-wizard-steps-indicator-step__bullet\">{iconWithOptions}</StyledBullet>\n </StyledBulletWrapper>\n <StyledLabel className=\"em-ds-wizard-steps-indicator-step__label\">{label}</StyledLabel>\n </StyledWrapper>\n </StyledItem>\n );\n};\n\nWizardStep.displayName = 'WizardStep';\nconst WizzardStepWithSchema = describe(WizardStep);\nWizzardStepWithSchema.propTypes = DSWizardStepPropsTypesSchema;\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;ADuCjB;AAvCN,mBAA6D;AAC7D,8BAAuD;AACvD,mCAA+E;AAC/E,oBAA0F;AAE1F,MAAM,aAAa,CAAC,UAA+B;AACjD,QAAM,EAAE,OAAO,MAAM,eAAe,YAAY,QAAQ,WAAW,MAAM,QAAI;AAAA,IAC3E;AAAA,IACA;AAAA,EACF;AAEA,QAAM,kBAAc,sBAAQ,MAAM;AAChC,QAAI,UAAU;AAAY,aAAO;AACjC,QAAI,aAAa;AAAe,aAAO;AACvC,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,WAAW,MAAM,YAAY,aAAa,CAAC;AAEvD,QAAM,sBAAkB;AAAA,IACtB,UACE,6BAA4C,WAAW,QACnD,2BAAa,aAAa;AAAA,MACxB,OAAS,aAAa,OAAmC,SAA8B;AAAA,QACrF;AAAA,QACA,YAAY,QAAQ;AAAA,MACtB;AAAA,IACF,CAAC,IACD,eAAe,QAAQ;AAAA,IAC7B,CAAC,WAAW,aAAa,KAAK;AAAA,EAChC;AAEA,QAAM,oBAAgB,sBAAQ,MAAM;AAClC,QAAI,YAAY;AAChB,QAAI;AAAQ,mBAAa;AACzB,QAAI;AAAW,mBAAa;AAC5B,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,SAAS,CAAC;AAEtB,SACE,4CAAC,4BAAW,WAAW,eAAe,QAAgB,WACpD,uDAAC,+BAAc,WAAU,6CACvB;AAAA,gDAAC,qCAAoB,WAAU,qDAC7B,sDAAC,8BAAa,WAAU,6CAA6C,2BAAgB,GACvF;AAAA,IACA,4CAAC,6BAAY,WAAU,4CAA4C,iBAAM;AAAA,KAC3E,GACF;AAEJ;AAEA,WAAW,cAAc;AACzB,MAAM,4BAAwB,kCAAS,UAAU;AACjD,sBAAsB,YAAY;AAGlC,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/WizardSteps.js
CHANGED
|
@@ -36,30 +36,31 @@ var React = __toESM(require("react"));
|
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
37
|
var import_react = __toESM(require("react"));
|
|
38
38
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
39
|
-
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
40
39
|
var import_WizardStep = __toESM(require("./WizardStep.js"));
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
const WizardSteps = (
|
|
40
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
41
|
+
var import_styled = require("./styled.js");
|
|
42
|
+
const WizardSteps = (props) => {
|
|
43
|
+
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
|
|
44
|
+
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefault);
|
|
45
|
+
const globalAttributes = (0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefault);
|
|
46
|
+
const { children, steps, current } = propsWithDefault;
|
|
44
47
|
const items = (0, import_react.useMemo)(() => {
|
|
45
|
-
const mergeStepProps = (
|
|
48
|
+
const mergeStepProps = (index) => ({
|
|
46
49
|
index,
|
|
47
50
|
active: current === index,
|
|
48
51
|
completed: index < current
|
|
49
52
|
});
|
|
50
|
-
return steps ? steps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_WizardStep.default, { ...step, ...mergeStepProps(
|
|
53
|
+
return steps ? steps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_WizardStep.default, { ...step, ...mergeStepProps(index) }, index)) : import_react.default.Children.map(children, (item, index) => {
|
|
54
|
+
if (item === void 0)
|
|
55
|
+
return null;
|
|
56
|
+
return (0, import_react.cloneElement)(item, mergeStepProps(index));
|
|
57
|
+
});
|
|
51
58
|
}, [current, children, steps]);
|
|
52
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledStepsWrapper, { className: "em-ds-wizard-steps-indicator", ...xstyledProps, ...globalAttributes, children: items });
|
|
53
60
|
};
|
|
54
61
|
WizardSteps.Item = import_WizardStep.default;
|
|
55
|
-
const wizzardProps = {
|
|
56
|
-
current: import_ds_props_helpers.PropTypes.number.description("Current active state index").defaultValue(0),
|
|
57
|
-
steps: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.shape({})).description("Array of steps objects").defaultValue([]).isRequired,
|
|
58
|
-
children: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.instanceOf(import_WizardStep.default)).description("List of WizardStep components")
|
|
59
|
-
};
|
|
60
|
-
WizardSteps.propTypes = wizzardProps;
|
|
61
62
|
WizardSteps.displayName = "WizardSteps";
|
|
62
63
|
const WizzardWithSchema = (0, import_ds_props_helpers.describe)(WizardSteps);
|
|
63
|
-
WizzardWithSchema.propTypes =
|
|
64
|
+
WizzardWithSchema.propTypes = import_react_desc_prop_types.DSWizardPropTypesSchema;
|
|
64
65
|
var WizardSteps_default = WizardSteps;
|
|
65
66
|
//# sourceMappingURL=WizardSteps.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/WizardSteps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { cloneElement, useMemo } from 'react';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n} from '@elliemae/ds-props-helpers';\nimport WizardStep from './WizardStep.js';\nimport { DSWizardPropTypesSchema, defaultProps, type DSWizardT } from './react-desc-prop-types.js';\nimport { StyledStepsWrapper } from './styled.js';\n\nconst WizardSteps = (props: DSWizardT.Props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSWizardT.InternalProps>(props, defaultProps);\n\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n\n const globalAttributes = useGetGlobalAttributes(propsWithDefault);\n\n const { children, steps, current } = propsWithDefault;\n\n const items = useMemo(() => {\n const mergeStepProps = (index: number) => ({\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(index)} />)\n : React.Children.map(children, (item, index) => {\n if (item === undefined) return null;\n return cloneElement(item, mergeStepProps(index));\n });\n }, [current, children, steps]);\n\n return (\n <StyledStepsWrapper className=\"em-ds-wizard-steps-indicator\" {...xstyledProps} {...globalAttributes}>\n {items}\n </StyledStepsWrapper>\n );\n};\n\nWizardSteps.Item = WizardStep;\n\nWizardSteps.displayName = 'WizardSteps';\nconst WizzardWithSchema = describe(WizardSteps);\nWizzardWithSchema.propTypes = DSWizardPropTypesSchema;\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;AD4BY;AA5BnC,mBAA6C;AAC7C,8BAKO;AACP,wBAAuB;AACvB,mCAAsE;AACtE,oBAAmC;AAEnC,MAAM,cAAc,CAAC,UAA2B;AAC9C,QAAM,uBAAmB,sDAAsD,OAAO,yCAAY;AAElG,QAAM,mBAAe,4CAAmB,gBAAgB;AAExD,QAAM,uBAAmB,gDAAuB,gBAAgB;AAEhE,QAAM,EAAE,UAAU,OAAO,QAAQ,IAAI;AAErC,QAAM,YAAQ,sBAAQ,MAAM;AAC1B,UAAM,iBAAiB,CAAC,WAAmB;AAAA,MACzC;AAAA,MACA,QAAQ,YAAY;AAAA,MACpB,WAAW,QAAQ;AAAA,IACrB;AAEA,WAAO,QACH,MAAM,IAAI,CAAC,MAAM,UAAU,4CAAC,kBAAAA,SAAA,EAAwB,GAAG,MAAO,GAAG,eAAe,KAAK,KAAzC,KAA4C,CAAE,IAC1F,aAAAC,QAAM,SAAS,IAAI,UAAU,CAAC,MAAM,UAAU;AAC5C,UAAI,SAAS;AAAW,eAAO;AAC/B,iBAAO,2BAAa,MAAM,eAAe,KAAK,CAAC;AAAA,IACjD,CAAC;AAAA,EACP,GAAG,CAAC,SAAS,UAAU,KAAK,CAAC;AAE7B,SACE,4CAAC,oCAAmB,WAAU,gCAAgC,GAAG,cAAe,GAAG,kBAChF,iBACH;AAEJ;AAEA,YAAY,OAAO,kBAAAD;AAEnB,YAAY,cAAc;AAC1B,MAAM,wBAAoB,kCAAS,WAAW;AAC9C,kBAAkB,YAAY;AAG9B,IAAO,sBAAQ;",
|
|
6
6
|
"names": ["WizardStep", "React"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var react_desc_prop_types_exports = {};
|
|
30
|
+
__export(react_desc_prop_types_exports, {
|
|
31
|
+
DSWizardPropTypes: () => DSWizardPropTypes,
|
|
32
|
+
DSWizardPropTypesSchema: () => DSWizardPropTypesSchema,
|
|
33
|
+
DSWizardStepPropsTypes: () => DSWizardStepPropsTypes,
|
|
34
|
+
DSWizardStepPropsTypesSchema: () => DSWizardStepPropsTypesSchema,
|
|
35
|
+
defaultProps: () => defaultProps,
|
|
36
|
+
defaultStepProps: () => defaultStepProps
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
39
|
+
var React = __toESM(require("react"));
|
|
40
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
42
|
+
var import_ds_icons = require("@elliemae/ds-icons");
|
|
43
|
+
const defaultProps = {
|
|
44
|
+
current: 0
|
|
45
|
+
};
|
|
46
|
+
const defaultStepProps = {
|
|
47
|
+
label: "",
|
|
48
|
+
icon: null,
|
|
49
|
+
iconCompleted: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.Checkmark, {}),
|
|
50
|
+
iconActive: null,
|
|
51
|
+
active: false,
|
|
52
|
+
completed: false,
|
|
53
|
+
index: 0
|
|
54
|
+
};
|
|
55
|
+
const DSWizardPropTypes = {
|
|
56
|
+
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
57
|
+
...import_ds_props_helpers.xstyledPropTypes,
|
|
58
|
+
current: import_ds_props_helpers.PropTypes.number.description("Current active state index").defaultValue(0),
|
|
59
|
+
steps: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.shape({})).description("Array of steps objects"),
|
|
60
|
+
children: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.node).description("List of WizardStep components")
|
|
61
|
+
};
|
|
62
|
+
const DSWizardPropTypesSchema = DSWizardPropTypes;
|
|
63
|
+
const DSWizardStepPropsTypes = {
|
|
64
|
+
label: import_ds_props_helpers.PropTypes.string.description("Step label"),
|
|
65
|
+
icon: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.element, import_ds_props_helpers.PropTypes.string]).description("Default icon or number"),
|
|
66
|
+
iconCompleted: import_ds_props_helpers.PropTypes.element.description("Icon when the step is completed").defaultValue("Checkmark"),
|
|
67
|
+
iconActive: import_ds_props_helpers.PropTypes.element.description("Icon when the step is active"),
|
|
68
|
+
active: import_ds_props_helpers.PropTypes.bool.description("Whether the step is active or not").defaultValue(false),
|
|
69
|
+
completed: import_ds_props_helpers.PropTypes.bool.description("Whether the step is completed or not").defaultValue(false),
|
|
70
|
+
index: import_ds_props_helpers.PropTypes.number.description("Current item index")
|
|
71
|
+
};
|
|
72
|
+
const DSWizardStepPropsTypesSchema = DSWizardStepPropsTypes;
|
|
73
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react-desc-prop-types.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport React from 'react';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport type { WeakValidationMap } from 'react';\n\nexport declare namespace DSWizardT {\n export interface WizardStep {\n content: React.ComponentType;\n }\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n current: number;\n }\n\n export interface OptionalProps {\n steps?: WizardStep[];\n children?: React.ReactElement[];\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLDivElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLDivElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface StepProps {\n label?: string;\n icon?: React.ReactNode;\n iconCompleted?: React.ReactNode;\n iconActive?: React.ReactNode;\n active?: boolean;\n completed?: boolean;\n index?: number;\n }\n}\n\nexport const defaultProps: DSWizardT.DefaultProps = {\n current: 0,\n};\n\nexport const defaultStepProps: Required<DSWizardT.StepProps> = {\n label: '',\n icon: null,\n iconCompleted: <Checkmark />,\n iconActive: null,\n active: false,\n completed: false,\n index: 0,\n};\n\nexport const DSWizardPropTypes: DSPropTypesSchema<DSWizardT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n current: PropTypes.number.description('Current active state index').defaultValue(0),\n steps: PropTypes.arrayOf(PropTypes.shape({})).description('Array of steps objects'),\n children: PropTypes.arrayOf(PropTypes.node).description('List of WizardStep components'),\n};\n\nexport const DSWizardPropTypesSchema = DSWizardPropTypes as unknown as WeakValidationMap<DSWizardT.Props>;\n\nexport const DSWizardStepPropsTypes = {\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\nexport const DSWizardStepPropsTypesSchema = DSWizardStepPropsTypes as unknown as WeakValidationMap<DSWizardT.StepProps>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD6DN;AA1DjB,8BAAuE;AACvE,sBAA0B;AAkDnB,MAAM,eAAuC;AAAA,EAClD,SAAS;AACX;AAEO,MAAM,mBAAkD;AAAA,EAC7D,OAAO;AAAA,EACP,MAAM;AAAA,EACN,eAAe,4CAAC,6BAAU;AAAA,EAC1B,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AACT;AAEO,MAAM,oBAAwD;AAAA,EACnE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,SAAS,kCAAU,OAAO,YAAY,4BAA4B,EAAE,aAAa,CAAC;AAAA,EAClF,OAAO,kCAAU,QAAQ,kCAAU,MAAM,CAAC,CAAC,CAAC,EAAE,YAAY,wBAAwB;AAAA,EAClF,UAAU,kCAAU,QAAQ,kCAAU,IAAI,EAAE,YAAY,+BAA+B;AACzF;AAEO,MAAM,0BAA0B;AAEhC,MAAM,yBAAyB;AAAA,EACpC,OAAO,kCAAU,OAAO,YAAY,YAAY;AAAA,EAChD,MAAM,kCAAU,UAAU,CAAC,kCAAU,SAAS,kCAAU,MAAM,CAAC,EAAE,YAAY,wBAAwB;AAAA,EACrG,eAAe,kCAAU,QAAQ,YAAY,iCAAiC,EAAE,aAAa,WAAW;AAAA,EACxG,YAAY,kCAAU,QAAQ,YAAY,8BAA8B;AAAA,EACxE,QAAQ,kCAAU,KAAK,YAAY,mCAAmC,EAAE,aAAa,KAAK;AAAA,EAC1F,WAAW,kCAAU,KAAK,YAAY,sCAAsC,EAAE,aAAa,KAAK;AAAA,EAChG,OAAO,kCAAU,OAAO,YAAY,oBAAoB;AAC1D;AAEO,MAAM,+BAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var styled_exports = {};
|
|
30
|
+
__export(styled_exports, {
|
|
31
|
+
StyledBullet: () => StyledBullet,
|
|
32
|
+
StyledBulletWrapper: () => StyledBulletWrapper,
|
|
33
|
+
StyledItem: () => StyledItem,
|
|
34
|
+
StyledLabel: () => StyledLabel,
|
|
35
|
+
StyledStepsWrapper: () => StyledStepsWrapper,
|
|
36
|
+
StyledWrapper: () => StyledWrapper
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(styled_exports);
|
|
39
|
+
var React = __toESM(require("react"));
|
|
40
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
41
|
+
const StyledWrapper = import_ds_system.styled.div`
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
width: 100%;
|
|
46
|
+
`;
|
|
47
|
+
const StyledLabel = import_ds_system.styled.span`
|
|
48
|
+
font-size: 1.0769rem;
|
|
49
|
+
line-height: normal;
|
|
50
|
+
font-weight: 400;
|
|
51
|
+
color: neutral-500;
|
|
52
|
+
transition: all 200ms cubic-bezier(0.36, 0, 1, 1);
|
|
53
|
+
text-align: center;
|
|
54
|
+
width: 100%;
|
|
55
|
+
max-height: 36px;
|
|
56
|
+
`;
|
|
57
|
+
const StyledBulletWrapper = import_ds_system.styled.div`
|
|
58
|
+
display: flex;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
position: relative;
|
|
61
|
+
width: 100%;
|
|
62
|
+
`;
|
|
63
|
+
const StyledBullet = import_ds_system.styled.div`
|
|
64
|
+
margin: space(xs);
|
|
65
|
+
width: 2.46154rem;
|
|
66
|
+
height: 2.46154rem;
|
|
67
|
+
border-radius: 50%;
|
|
68
|
+
font-size: font-size(600);
|
|
69
|
+
border: 1px solid #cbcfd7;
|
|
70
|
+
color: brand-600;
|
|
71
|
+
position: relative;
|
|
72
|
+
transition: all 200ms cubic-bezier(0.36, 0, 1, 1);
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
align-items: center;
|
|
76
|
+
`;
|
|
77
|
+
const StyledItem = import_ds_system.styled.div`
|
|
78
|
+
display: flex;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
flex: 1 1 0px;
|
|
81
|
+
min-width: 96px;
|
|
82
|
+
max-width: 144px;
|
|
83
|
+
margin: 0 8px;
|
|
84
|
+
|
|
85
|
+
&:not(:last-child) {
|
|
86
|
+
${StyledBulletWrapper}::after {
|
|
87
|
+
margin: 0 5px;
|
|
88
|
+
position: absolute;
|
|
89
|
+
top: 50%;
|
|
90
|
+
left: calc(62%);
|
|
91
|
+
display: block;
|
|
92
|
+
width: 80%;
|
|
93
|
+
content: '';
|
|
94
|
+
transition: all 300ms cubic-bezier(0.36, 0, 1, 1);
|
|
95
|
+
height: 1px;
|
|
96
|
+
background-image: linear-gradient(to right, #cbcfd7 40%, rgba(255, 255, 255, 0) 0%);
|
|
97
|
+
background-position: top;
|
|
98
|
+
background-size: 3px 1px;
|
|
99
|
+
background-repeat: repeat-x;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
${({ active, theme }) => {
|
|
104
|
+
if (!active)
|
|
105
|
+
return "";
|
|
106
|
+
return `
|
|
107
|
+
${StyledBullet} {
|
|
108
|
+
border-color: ${import_ds_system.th.color("brand-700")({ theme })};
|
|
109
|
+
color: ${import_ds_system.th.color("brand-700")({ theme })};
|
|
110
|
+
font-weight: bold;
|
|
111
|
+
border-width: 1.5px;
|
|
112
|
+
}
|
|
113
|
+
${StyledLabel} {
|
|
114
|
+
color: ${import_ds_system.th.color("brand-700")({ theme })};
|
|
115
|
+
font-weight: bold;
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
}}
|
|
119
|
+
|
|
120
|
+
${({ completed, theme }) => {
|
|
121
|
+
if (!completed)
|
|
122
|
+
return "";
|
|
123
|
+
return `
|
|
124
|
+
${StyledBullet} {
|
|
125
|
+
border-color: ${import_ds_system.th.color("brand-600")({ theme })};
|
|
126
|
+
}
|
|
127
|
+
${StyledLabel} {
|
|
128
|
+
color: ${import_ds_system.th.color("neutral-800")({ theme })};
|
|
129
|
+
}
|
|
130
|
+
&:not(:last-child) {
|
|
131
|
+
${StyledBulletWrapper}::after {
|
|
132
|
+
background: ${import_ds_system.th.color("brand-700")({ theme })};
|
|
133
|
+
background-size: initial;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
137
|
+
}}
|
|
138
|
+
`;
|
|
139
|
+
const StyledStepsWrapper = import_ds_system.styled.div`
|
|
140
|
+
display: flex;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
${import_ds_system.xStyledCommonProps}
|
|
144
|
+
`;
|
|
145
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/styled.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { styled, th, xStyledCommonProps } from '@elliemae/ds-system';\n\nexport const StyledWrapper = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n`;\nexport const StyledLabel = styled.span`\n font-size: 1.0769rem;\n line-height: normal;\n font-weight: 400;\n color: neutral-500;\n transition: all 200ms cubic-bezier(0.36, 0, 1, 1);\n text-align: center;\n width: 100%;\n max-height: 36px;\n`;\nexport const StyledBulletWrapper = styled.div`\n display: flex;\n justify-content: center;\n position: relative;\n width: 100%;\n`;\nexport const StyledBullet = styled.div`\n margin: space(xs);\n width: 2.46154rem;\n height: 2.46154rem;\n border-radius: 50%;\n font-size: font-size(600);\n border: 1px solid #cbcfd7;\n color: brand-600;\n position: relative;\n transition: all 200ms cubic-bezier(0.36, 0, 1, 1);\n display: flex;\n justify-content: center;\n align-items: center;\n`;\nexport const StyledItem = styled.div<{ active: boolean; completed: boolean }>`\n display: flex;\n justify-content: center;\n flex: 1 1 0px;\n min-width: 96px;\n max-width: 144px;\n margin: 0 8px;\n\n &:not(:last-child) {\n ${StyledBulletWrapper}::after {\n margin: 0 5px;\n position: absolute;\n top: 50%;\n left: calc(62%);\n display: block;\n width: 80%;\n content: '';\n transition: all 300ms cubic-bezier(0.36, 0, 1, 1);\n height: 1px;\n background-image: linear-gradient(to right, #cbcfd7 40%, rgba(255, 255, 255, 0) 0%);\n background-position: top;\n background-size: 3px 1px;\n background-repeat: repeat-x;\n }\n }\n\n ${({ active, theme }) => {\n if (!active) return '';\n return `\n ${StyledBullet} {\n border-color: ${th.color('brand-700')({ theme })};\n color: ${th.color('brand-700')({ theme })};\n font-weight: bold;\n border-width: 1.5px;\n }\n ${StyledLabel} {\n color: ${th.color('brand-700')({ theme })};\n font-weight: bold;\n }\n `;\n }}\n\n ${({ completed, theme }) => {\n if (!completed) return '';\n return `\n ${StyledBullet} {\n border-color: ${th.color('brand-600')({ theme })};\n }\n ${StyledLabel} {\n color: ${th.color('neutral-800')({ theme })};\n }\n &:not(:last-child) {\n ${StyledBulletWrapper}::after {\n background: ${th.color('brand-700')({ theme })};\n background-size: initial;\n }\n }\n `;\n }}\n`;\n\nexport const StyledStepsWrapper = styled.div`\n display: flex;\n justify-content: center;\n overflow: hidden;\n ${xStyledCommonProps}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA+C;AAExC,MAAM,gBAAgB,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAM7B,MAAM,cAAc,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU3B,MAAM,sBAAsB,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAMnC,MAAM,eAAe,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAc5B,MAAM,aAAa,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAS3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAiBF,CAAC,EAAE,QAAQ,MAAM,MAAM;AACvB,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO;AAAA,MACL;AAAA,sBACgB,oBAAG,MAAM,WAAW,EAAE,EAAE,MAAM,CAAC;AAAA,eACtC,oBAAG,MAAM,WAAW,EAAE,EAAE,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA,MAIxC;AAAA,eACS,oBAAG,MAAM,WAAW,EAAE,EAAE,MAAM,CAAC;AAAA;AAAA;AAAA;AAI5C;AAAA;AAAA,IAEE,CAAC,EAAE,WAAW,MAAM,MAAM;AAC1B,MAAI,CAAC;AAAW,WAAO;AACvB,SAAO;AAAA,QACH;AAAA,wBACgB,oBAAG,MAAM,WAAW,EAAE,EAAE,MAAM,CAAC;AAAA;AAAA,QAE/C;AAAA,iBACS,oBAAG,MAAM,aAAa,EAAE,EAAE,MAAM,CAAC;AAAA;AAAA;AAAA,UAGxC;AAAA,wBACc,oBAAG,MAAM,WAAW,EAAE,EAAE,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAKrD;AAAA;AAGK,MAAM,qBAAqB,wBAAO;AAAA;AAAA;AAAA;AAAA,IAIrC;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/useWizard.js
CHANGED
|
@@ -33,10 +33,9 @@ __export(useWizard_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(useWizard_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_react = require("react");
|
|
36
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
37
36
|
const checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;
|
|
38
37
|
const checkCanPrevious = (prevIndex) => prevIndex - 1 >= 0;
|
|
39
|
-
const noop = (
|
|
38
|
+
const noop = () => null;
|
|
40
39
|
function useWizard({
|
|
41
40
|
steps: wizardSteps,
|
|
42
41
|
current,
|
|
@@ -67,7 +66,7 @@ function useWizard({
|
|
|
67
66
|
previous: handlePrevious,
|
|
68
67
|
canNext: checkCanNext(currentStep, wizardSteps),
|
|
69
68
|
canPrevious: checkCanPrevious(currentStep),
|
|
70
|
-
WizardCurrentContent:
|
|
69
|
+
WizardCurrentContent: wizardSteps[currentStep]?.content
|
|
71
70
|
};
|
|
72
71
|
}
|
|
73
72
|
//# 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 { useEffect, useCallback, useState } from 'react';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAiD;
|
|
4
|
+
"sourcesContent": ["import { useEffect, useCallback, useState } from 'react';\nimport type { DSWizardT } from './react-desc-prop-types.js';\n\nconst checkCanNext = (prevIndex: number, array: DSWizardT.WizardStep[]): boolean => array.length > prevIndex + 1;\nconst checkCanPrevious = (prevIndex: number): boolean => prevIndex - 1 >= 0;\n\nconst noop = () => null;\n\ninterface WizardConfig<T extends DSWizardT.WizardStep> {\n steps: T[];\n current?: number;\n onNext?: (currentStep: number) => void;\n onPrevious?: (currentStep: number) => void;\n initial?: number;\n}\n\nexport default function useWizard<T extends DSWizardT.WizardStep>({\n steps: wizardSteps,\n current,\n onNext = noop,\n onPrevious = noop,\n initial = 0,\n}: WizardConfig<T>) {\n const [currentStep, setCurrentStep] = useState(initial);\n\n useEffect(() => {\n if (typeof current !== 'undefined') setCurrentStep(current);\n }, [current]);\n\n const handleNext = useCallback(() => {\n if (checkCanNext(currentStep, wizardSteps)) {\n onNext(currentStep);\n setCurrentStep(currentStep + 1);\n }\n }, [currentStep, wizardSteps, onNext]);\n\n const handlePrevious = useCallback(() => {\n if (checkCanPrevious(currentStep)) {\n onPrevious(currentStep);\n setCurrentStep(currentStep - 1);\n }\n }, [currentStep, onPrevious]);\n\n return {\n current: currentStep,\n next: handleNext,\n previous: handlePrevious,\n canNext: checkCanNext(currentStep, wizardSteps),\n canPrevious: checkCanPrevious(currentStep),\n WizardCurrentContent: wizardSteps[currentStep]?.content,\n };\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAiD;AAGjD,MAAM,eAAe,CAAC,WAAmB,UAA2C,MAAM,SAAS,YAAY;AAC/G,MAAM,mBAAmB,CAAC,cAA+B,YAAY,KAAK;AAE1E,MAAM,OAAO,MAAM;AAUJ,SAAR,UAA2D;AAAA,EAChE,OAAO;AAAA,EACP;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU;AACZ,GAAoB;AAClB,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,OAAO;AAEtD,8BAAU,MAAM;AACd,QAAI,OAAO,YAAY;AAAa,qBAAe,OAAO;AAAA,EAC5D,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,iBAAa,0BAAY,MAAM;AACnC,QAAI,aAAa,aAAa,WAAW,GAAG;AAC1C,aAAO,WAAW;AAClB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,GAAG,CAAC,aAAa,aAAa,MAAM,CAAC;AAErC,QAAM,qBAAiB,0BAAY,MAAM;AACvC,QAAI,iBAAiB,WAAW,GAAG;AACjC,iBAAW,WAAW;AACtB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,GAAG,CAAC,aAAa,UAAU,CAAC;AAE5B,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS,aAAa,aAAa,WAAW;AAAA,IAC9C,aAAa,iBAAiB,WAAW;AAAA,IACzC,sBAAsB,YAAY,WAAW,GAAG;AAAA,EAClD;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/WizardStep.js
CHANGED
|
@@ -1,59 +1,46 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cloneElement, useMemo, isValidElement } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}));
|
|
13
|
-
const Wrapper = aggregatedClasses("div")(`${indicatorItemBlockName}-wrapper`);
|
|
14
|
-
const Label = aggregatedClasses("span")(indicatorItemBlockName, "label");
|
|
15
|
-
const Bullet = aggregatedClasses("div")(indicatorItemBlockName, "bullet");
|
|
16
|
-
const BulletWrapper = aggregatedClasses("div")(indicatorItemBlockName, "bullet-wrapper");
|
|
17
|
-
const WizardStep = ({
|
|
18
|
-
label = "",
|
|
19
|
-
icon = null,
|
|
20
|
-
iconCompleted = /* @__PURE__ */ jsx(Checkmark, {}),
|
|
21
|
-
iconActive = null,
|
|
22
|
-
active = false,
|
|
23
|
-
completed = false,
|
|
24
|
-
index = 0
|
|
25
|
-
}) => {
|
|
4
|
+
import { describe, useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
|
|
5
|
+
import { DSWizardStepPropsTypesSchema, defaultStepProps } from "./react-desc-prop-types.js";
|
|
6
|
+
import { StyledBullet, StyledBulletWrapper, StyledItem, StyledLabel, StyledWrapper } from "./styled.js";
|
|
7
|
+
const WizardStep = (props) => {
|
|
8
|
+
const { label, icon, iconCompleted, iconActive, active, completed, index } = useMemoMergePropsWithDefault(
|
|
9
|
+
props,
|
|
10
|
+
defaultStepProps
|
|
11
|
+
);
|
|
26
12
|
const currentIcon = useMemo(() => {
|
|
27
|
-
if (active)
|
|
13
|
+
if (active && iconActive)
|
|
28
14
|
return iconActive;
|
|
29
|
-
if (completed)
|
|
15
|
+
if (completed && iconCompleted)
|
|
30
16
|
return iconCompleted;
|
|
31
17
|
return icon;
|
|
32
|
-
}, [active, completed, icon, iconActive, iconCompleted])
|
|
18
|
+
}, [active, completed, icon, iconActive, iconCompleted]);
|
|
33
19
|
const iconWithOptions = useMemo(
|
|
34
20
|
() => isValidElement(currentIcon) ? cloneElement(currentIcon, {
|
|
35
|
-
color:
|
|
21
|
+
color: currentIcon?.props?.color ?? [
|
|
22
|
+
"brand-primary",
|
|
23
|
+
completed ? "600" : "500"
|
|
24
|
+
]
|
|
36
25
|
}) : currentIcon || index + 1,
|
|
37
26
|
[completed, currentIcon, index]
|
|
38
27
|
);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
const itemClassName = useMemo(() => {
|
|
29
|
+
let className = "em-ds-wizard-steps-indicator-step em-ds-wizard-steps-indicator-step--default";
|
|
30
|
+
if (active)
|
|
31
|
+
className += " em-ds-wizard-steps-indicator-step--active";
|
|
32
|
+
if (completed)
|
|
33
|
+
className += " em-ds-wizard-steps-indicator-step--completed";
|
|
34
|
+
return className;
|
|
35
|
+
}, [active, completed]);
|
|
36
|
+
return /* @__PURE__ */ jsx(StyledItem, { className: itemClassName, active, completed, children: /* @__PURE__ */ jsxs(StyledWrapper, { className: "em-ds-wizard-steps-indicator-step-wrapper", children: [
|
|
37
|
+
/* @__PURE__ */ jsx(StyledBulletWrapper, { className: "em-ds-wizard-steps-indicator-step__bullet-wrapper", children: /* @__PURE__ */ jsx(StyledBullet, { className: "em-ds-wizard-steps-indicator-step__bullet", children: iconWithOptions }) }),
|
|
38
|
+
/* @__PURE__ */ jsx(StyledLabel, { className: "em-ds-wizard-steps-indicator-step__label", children: label })
|
|
42
39
|
] }) });
|
|
43
40
|
};
|
|
44
|
-
const wizzardStepProps = {
|
|
45
|
-
label: PropTypes.string.description("Step label"),
|
|
46
|
-
icon: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).description("Default icon or number"),
|
|
47
|
-
iconCompleted: PropTypes.element.description("Icon when the step is completed").defaultValue(Checkmark),
|
|
48
|
-
iconActive: PropTypes.element.description("Icon when the step is active"),
|
|
49
|
-
active: PropTypes.bool.description("Whether the step is active or not").defaultValue(false),
|
|
50
|
-
completed: PropTypes.bool.description("Whether the step is completed or not").defaultValue(false),
|
|
51
|
-
index: PropTypes.number.description("Current item index")
|
|
52
|
-
};
|
|
53
|
-
WizardStep.propTypes = wizzardStepProps;
|
|
54
41
|
WizardStep.displayName = "WizardStep";
|
|
55
42
|
const WizzardStepWithSchema = describe(WizardStep);
|
|
56
|
-
WizzardStepWithSchema.propTypes =
|
|
43
|
+
WizzardStepWithSchema.propTypes = DSWizardStepPropsTypesSchema;
|
|
57
44
|
var WizardStep_default = WizardStep;
|
|
58
45
|
export {
|
|
59
46
|
WizzardStepWithSchema,
|
|
@@ -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", "
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { cloneElement, useMemo, isValidElement } from 'react';\nimport { describe, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { DSWizardStepPropsTypesSchema, defaultStepProps, type DSWizardT } from './react-desc-prop-types.js';\nimport { StyledBullet, StyledBulletWrapper, StyledItem, StyledLabel, StyledWrapper } from './styled.js';\n\nconst WizardStep = (props: DSWizardT.StepProps) => {\n const { label, icon, iconCompleted, iconActive, active, completed, index } = useMemoMergePropsWithDefault(\n props,\n defaultStepProps,\n );\n\n const currentIcon = useMemo(() => {\n if (active && iconActive) return iconActive;\n if (completed && iconCompleted) return iconCompleted;\n return icon;\n }, [active, completed, icon, iconActive, iconCompleted]);\n\n const iconWithOptions = useMemo(\n () =>\n isValidElement<{ color: [string, string] }>(currentIcon)\n ? cloneElement(currentIcon, {\n color: ((currentIcon?.props as Record<string, unknown>)?.color as [string, string]) ?? [\n 'brand-primary',\n completed ? '600' : '500',\n ],\n })\n : currentIcon || index + 1,\n [completed, currentIcon, index],\n );\n\n const itemClassName = useMemo(() => {\n let className = 'em-ds-wizard-steps-indicator-step em-ds-wizard-steps-indicator-step--default';\n if (active) className += ' em-ds-wizard-steps-indicator-step--active';\n if (completed) className += ' em-ds-wizard-steps-indicator-step--completed';\n return className;\n }, [active, completed]);\n\n return (\n <StyledItem className={itemClassName} active={active} completed={completed}>\n <StyledWrapper className=\"em-ds-wizard-steps-indicator-step-wrapper\">\n <StyledBulletWrapper className=\"em-ds-wizard-steps-indicator-step__bullet-wrapper\">\n <StyledBullet className=\"em-ds-wizard-steps-indicator-step__bullet\">{iconWithOptions}</StyledBullet>\n </StyledBulletWrapper>\n <StyledLabel className=\"em-ds-wizard-steps-indicator-step__label\">{label}</StyledLabel>\n </StyledWrapper>\n </StyledItem>\n );\n};\n\nWizardStep.displayName = 'WizardStep';\nconst WizzardStepWithSchema = describe(WizardStep);\nWizzardStepWithSchema.propTypes = DSWizardStepPropsTypesSchema;\n\nexport { WizzardStepWithSchema };\nexport default WizardStep;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACuCjB,SAEI,KAFJ;AAvCN,SAAgB,cAAc,SAAS,sBAAsB;AAC7D,SAAS,UAAU,oCAAoC;AACvD,SAAS,8BAA8B,wBAAwC;AAC/E,SAAS,cAAc,qBAAqB,YAAY,aAAa,qBAAqB;AAE1F,MAAM,aAAa,CAAC,UAA+B;AACjD,QAAM,EAAE,OAAO,MAAM,eAAe,YAAY,QAAQ,WAAW,MAAM,IAAI;AAAA,IAC3E;AAAA,IACA;AAAA,EACF;AAEA,QAAM,cAAc,QAAQ,MAAM;AAChC,QAAI,UAAU;AAAY,aAAO;AACjC,QAAI,aAAa;AAAe,aAAO;AACvC,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,WAAW,MAAM,YAAY,aAAa,CAAC;AAEvD,QAAM,kBAAkB;AAAA,IACtB,MACE,eAA4C,WAAW,IACnD,aAAa,aAAa;AAAA,MACxB,OAAS,aAAa,OAAmC,SAA8B;AAAA,QACrF;AAAA,QACA,YAAY,QAAQ;AAAA,MACtB;AAAA,IACF,CAAC,IACD,eAAe,QAAQ;AAAA,IAC7B,CAAC,WAAW,aAAa,KAAK;AAAA,EAChC;AAEA,QAAM,gBAAgB,QAAQ,MAAM;AAClC,QAAI,YAAY;AAChB,QAAI;AAAQ,mBAAa;AACzB,QAAI;AAAW,mBAAa;AAC5B,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,SAAS,CAAC;AAEtB,SACE,oBAAC,cAAW,WAAW,eAAe,QAAgB,WACpD,+BAAC,iBAAc,WAAU,6CACvB;AAAA,wBAAC,uBAAoB,WAAU,qDAC7B,8BAAC,gBAAa,WAAU,6CAA6C,2BAAgB,GACvF;AAAA,IACA,oBAAC,eAAY,WAAU,4CAA4C,iBAAM;AAAA,KAC3E,GACF;AAEJ;AAEA,WAAW,cAAc;AACzB,MAAM,wBAAwB,SAAS,UAAU;AACjD,sBAAsB,YAAY;AAGlC,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/WizardSteps.js
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import React2, { cloneElement, useMemo } from "react";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
describe,
|
|
6
|
+
useGetGlobalAttributes,
|
|
7
|
+
useGetXstyledProps,
|
|
8
|
+
useMemoMergePropsWithDefault
|
|
9
|
+
} from "@elliemae/ds-props-helpers";
|
|
6
10
|
import WizardStep from "./WizardStep.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const WizardSteps = (
|
|
11
|
+
import { DSWizardPropTypesSchema, defaultProps } from "./react-desc-prop-types.js";
|
|
12
|
+
import { StyledStepsWrapper } from "./styled.js";
|
|
13
|
+
const WizardSteps = (props) => {
|
|
14
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
15
|
+
const xstyledProps = useGetXstyledProps(propsWithDefault);
|
|
16
|
+
const globalAttributes = useGetGlobalAttributes(propsWithDefault);
|
|
17
|
+
const { children, steps, current } = propsWithDefault;
|
|
10
18
|
const items = useMemo(() => {
|
|
11
|
-
const mergeStepProps = (
|
|
19
|
+
const mergeStepProps = (index) => ({
|
|
12
20
|
index,
|
|
13
21
|
active: current === index,
|
|
14
22
|
completed: index < current
|
|
15
23
|
});
|
|
16
|
-
return steps ? steps.map((step, index) => /* @__PURE__ */ jsx(WizardStep, { ...step, ...mergeStepProps(
|
|
24
|
+
return steps ? steps.map((step, index) => /* @__PURE__ */ jsx(WizardStep, { ...step, ...mergeStepProps(index) }, index)) : React2.Children.map(children, (item, index) => {
|
|
25
|
+
if (item === void 0)
|
|
26
|
+
return null;
|
|
27
|
+
return cloneElement(item, mergeStepProps(index));
|
|
28
|
+
});
|
|
17
29
|
}, [current, children, steps]);
|
|
18
|
-
return /* @__PURE__ */ jsx(
|
|
30
|
+
return /* @__PURE__ */ jsx(StyledStepsWrapper, { className: "em-ds-wizard-steps-indicator", ...xstyledProps, ...globalAttributes, children: items });
|
|
19
31
|
};
|
|
20
32
|
WizardSteps.Item = WizardStep;
|
|
21
|
-
const wizzardProps = {
|
|
22
|
-
current: PropTypes.number.description("Current active state index").defaultValue(0),
|
|
23
|
-
steps: PropTypes.arrayOf(PropTypes.shape({})).description("Array of steps objects").defaultValue([]).isRequired,
|
|
24
|
-
children: PropTypes.arrayOf(PropTypes.instanceOf(WizardStep)).description("List of WizardStep components")
|
|
25
|
-
};
|
|
26
|
-
WizardSteps.propTypes = wizzardProps;
|
|
27
33
|
WizardSteps.displayName = "WizardSteps";
|
|
28
34
|
const WizzardWithSchema = describe(WizardSteps);
|
|
29
|
-
WizzardWithSchema.propTypes =
|
|
35
|
+
WizzardWithSchema.propTypes = DSWizardPropTypesSchema;
|
|
30
36
|
var WizardSteps_default = WizardSteps;
|
|
31
37
|
export {
|
|
32
38
|
WizzardWithSchema,
|
|
@@ -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", "
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { cloneElement, useMemo } from 'react';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n} from '@elliemae/ds-props-helpers';\nimport WizardStep from './WizardStep.js';\nimport { DSWizardPropTypesSchema, defaultProps, type DSWizardT } from './react-desc-prop-types.js';\nimport { StyledStepsWrapper } from './styled.js';\n\nconst WizardSteps = (props: DSWizardT.Props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSWizardT.InternalProps>(props, defaultProps);\n\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n\n const globalAttributes = useGetGlobalAttributes(propsWithDefault);\n\n const { children, steps, current } = propsWithDefault;\n\n const items = useMemo(() => {\n const mergeStepProps = (index: number) => ({\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(index)} />)\n : React.Children.map(children, (item, index) => {\n if (item === undefined) return null;\n return cloneElement(item, mergeStepProps(index));\n });\n }, [current, children, steps]);\n\n return (\n <StyledStepsWrapper className=\"em-ds-wizard-steps-indicator\" {...xstyledProps} {...globalAttributes}>\n {items}\n </StyledStepsWrapper>\n );\n};\n\nWizardSteps.Item = WizardStep;\n\nWizardSteps.displayName = 'WizardSteps';\nconst WizzardWithSchema = describe(WizardSteps);\nWizzardWithSchema.propTypes = DSWizardPropTypesSchema;\n\nexport { WizzardWithSchema };\nexport default WizardSteps;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC4BY;AA5BnC,OAAOA,UAAS,cAAc,eAAe;AAC7C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,gBAAgB;AACvB,SAAS,yBAAyB,oBAAoC;AACtE,SAAS,0BAA0B;AAEnC,MAAM,cAAc,CAAC,UAA2B;AAC9C,QAAM,mBAAmB,6BAAsD,OAAO,YAAY;AAElG,QAAM,eAAe,mBAAmB,gBAAgB;AAExD,QAAM,mBAAmB,uBAAuB,gBAAgB;AAEhE,QAAM,EAAE,UAAU,OAAO,QAAQ,IAAI;AAErC,QAAM,QAAQ,QAAQ,MAAM;AAC1B,UAAM,iBAAiB,CAAC,WAAmB;AAAA,MACzC;AAAA,MACA,QAAQ,YAAY;AAAA,MACpB,WAAW,QAAQ;AAAA,IACrB;AAEA,WAAO,QACH,MAAM,IAAI,CAAC,MAAM,UAAU,oBAAC,cAAwB,GAAG,MAAO,GAAG,eAAe,KAAK,KAAzC,KAA4C,CAAE,IAC1FA,OAAM,SAAS,IAAI,UAAU,CAAC,MAAM,UAAU;AAC5C,UAAI,SAAS;AAAW,eAAO;AAC/B,aAAO,aAAa,MAAM,eAAe,KAAK,CAAC;AAAA,IACjD,CAAC;AAAA,EACP,GAAG,CAAC,SAAS,UAAU,KAAK,CAAC;AAE7B,SACE,oBAAC,sBAAmB,WAAU,gCAAgC,GAAG,cAAe,GAAG,kBAChF,iBACH;AAEJ;AAEA,YAAY,OAAO;AAEnB,YAAY,cAAc;AAC1B,MAAM,oBAAoB,SAAS,WAAW;AAC9C,kBAAkB,YAAY;AAG9B,IAAO,sBAAQ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from "@elliemae/ds-props-helpers";
|
|
4
|
+
import { Checkmark } from "@elliemae/ds-icons";
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
current: 0
|
|
7
|
+
};
|
|
8
|
+
const defaultStepProps = {
|
|
9
|
+
label: "",
|
|
10
|
+
icon: null,
|
|
11
|
+
iconCompleted: /* @__PURE__ */ jsx(Checkmark, {}),
|
|
12
|
+
iconActive: null,
|
|
13
|
+
active: false,
|
|
14
|
+
completed: false,
|
|
15
|
+
index: 0
|
|
16
|
+
};
|
|
17
|
+
const DSWizardPropTypes = {
|
|
18
|
+
...globalAttributesPropTypes,
|
|
19
|
+
...xstyledPropTypes,
|
|
20
|
+
current: PropTypes.number.description("Current active state index").defaultValue(0),
|
|
21
|
+
steps: PropTypes.arrayOf(PropTypes.shape({})).description("Array of steps objects"),
|
|
22
|
+
children: PropTypes.arrayOf(PropTypes.node).description("List of WizardStep components")
|
|
23
|
+
};
|
|
24
|
+
const DSWizardPropTypesSchema = DSWizardPropTypes;
|
|
25
|
+
const DSWizardStepPropsTypes = {
|
|
26
|
+
label: PropTypes.string.description("Step label"),
|
|
27
|
+
icon: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).description("Default icon or number"),
|
|
28
|
+
iconCompleted: PropTypes.element.description("Icon when the step is completed").defaultValue("Checkmark"),
|
|
29
|
+
iconActive: PropTypes.element.description("Icon when the step is active"),
|
|
30
|
+
active: PropTypes.bool.description("Whether the step is active or not").defaultValue(false),
|
|
31
|
+
completed: PropTypes.bool.description("Whether the step is completed or not").defaultValue(false),
|
|
32
|
+
index: PropTypes.number.description("Current item index")
|
|
33
|
+
};
|
|
34
|
+
const DSWizardStepPropsTypesSchema = DSWizardStepPropsTypes;
|
|
35
|
+
export {
|
|
36
|
+
DSWizardPropTypes,
|
|
37
|
+
DSWizardPropTypesSchema,
|
|
38
|
+
DSWizardStepPropsTypes,
|
|
39
|
+
DSWizardStepPropsTypesSchema,
|
|
40
|
+
defaultProps,
|
|
41
|
+
defaultStepProps
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport React from 'react';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport { Checkmark } from '@elliemae/ds-icons';\nimport type { WeakValidationMap } from 'react';\n\nexport declare namespace DSWizardT {\n export interface WizardStep {\n content: React.ComponentType;\n }\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n current: number;\n }\n\n export interface OptionalProps {\n steps?: WizardStep[];\n children?: React.ReactElement[];\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLDivElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLDivElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface StepProps {\n label?: string;\n icon?: React.ReactNode;\n iconCompleted?: React.ReactNode;\n iconActive?: React.ReactNode;\n active?: boolean;\n completed?: boolean;\n index?: number;\n }\n}\n\nexport const defaultProps: DSWizardT.DefaultProps = {\n current: 0,\n};\n\nexport const defaultStepProps: Required<DSWizardT.StepProps> = {\n label: '',\n icon: null,\n iconCompleted: <Checkmark />,\n iconActive: null,\n active: false,\n completed: false,\n index: 0,\n};\n\nexport const DSWizardPropTypes: DSPropTypesSchema<DSWizardT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n current: PropTypes.number.description('Current active state index').defaultValue(0),\n steps: PropTypes.arrayOf(PropTypes.shape({})).description('Array of steps objects'),\n children: PropTypes.arrayOf(PropTypes.node).description('List of WizardStep components'),\n};\n\nexport const DSWizardPropTypesSchema = DSWizardPropTypes as unknown as WeakValidationMap<DSWizardT.Props>;\n\nexport const DSWizardStepPropsTypes = {\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\nexport const DSWizardStepPropsTypesSchema = DSWizardStepPropsTypes as unknown as WeakValidationMap<DSWizardT.StepProps>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC6DN;AA1DjB,SAAS,WAAW,2BAA2B,wBAAwB;AACvE,SAAS,iBAAiB;AAkDnB,MAAM,eAAuC;AAAA,EAClD,SAAS;AACX;AAEO,MAAM,mBAAkD;AAAA,EAC7D,OAAO;AAAA,EACP,MAAM;AAAA,EACN,eAAe,oBAAC,aAAU;AAAA,EAC1B,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AACT;AAEO,MAAM,oBAAwD;AAAA,EACnE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,SAAS,UAAU,OAAO,YAAY,4BAA4B,EAAE,aAAa,CAAC;AAAA,EAClF,OAAO,UAAU,QAAQ,UAAU,MAAM,CAAC,CAAC,CAAC,EAAE,YAAY,wBAAwB;AAAA,EAClF,UAAU,UAAU,QAAQ,UAAU,IAAI,EAAE,YAAY,+BAA+B;AACzF;AAEO,MAAM,0BAA0B;AAEhC,MAAM,yBAAyB;AAAA,EACpC,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,WAAW;AAAA,EACxG,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;AAEO,MAAM,+BAA+B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { styled, th, xStyledCommonProps } from "@elliemae/ds-system";
|
|
3
|
+
const StyledWrapper = styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
align-items: center;
|
|
7
|
+
width: 100%;
|
|
8
|
+
`;
|
|
9
|
+
const StyledLabel = styled.span`
|
|
10
|
+
font-size: 1.0769rem;
|
|
11
|
+
line-height: normal;
|
|
12
|
+
font-weight: 400;
|
|
13
|
+
color: neutral-500;
|
|
14
|
+
transition: all 200ms cubic-bezier(0.36, 0, 1, 1);
|
|
15
|
+
text-align: center;
|
|
16
|
+
width: 100%;
|
|
17
|
+
max-height: 36px;
|
|
18
|
+
`;
|
|
19
|
+
const StyledBulletWrapper = styled.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
position: relative;
|
|
23
|
+
width: 100%;
|
|
24
|
+
`;
|
|
25
|
+
const StyledBullet = styled.div`
|
|
26
|
+
margin: space(xs);
|
|
27
|
+
width: 2.46154rem;
|
|
28
|
+
height: 2.46154rem;
|
|
29
|
+
border-radius: 50%;
|
|
30
|
+
font-size: font-size(600);
|
|
31
|
+
border: 1px solid #cbcfd7;
|
|
32
|
+
color: brand-600;
|
|
33
|
+
position: relative;
|
|
34
|
+
transition: all 200ms cubic-bezier(0.36, 0, 1, 1);
|
|
35
|
+
display: flex;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
align-items: center;
|
|
38
|
+
`;
|
|
39
|
+
const StyledItem = styled.div`
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
flex: 1 1 0px;
|
|
43
|
+
min-width: 96px;
|
|
44
|
+
max-width: 144px;
|
|
45
|
+
margin: 0 8px;
|
|
46
|
+
|
|
47
|
+
&:not(:last-child) {
|
|
48
|
+
${StyledBulletWrapper}::after {
|
|
49
|
+
margin: 0 5px;
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: 50%;
|
|
52
|
+
left: calc(62%);
|
|
53
|
+
display: block;
|
|
54
|
+
width: 80%;
|
|
55
|
+
content: '';
|
|
56
|
+
transition: all 300ms cubic-bezier(0.36, 0, 1, 1);
|
|
57
|
+
height: 1px;
|
|
58
|
+
background-image: linear-gradient(to right, #cbcfd7 40%, rgba(255, 255, 255, 0) 0%);
|
|
59
|
+
background-position: top;
|
|
60
|
+
background-size: 3px 1px;
|
|
61
|
+
background-repeat: repeat-x;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
${({ active, theme }) => {
|
|
66
|
+
if (!active)
|
|
67
|
+
return "";
|
|
68
|
+
return `
|
|
69
|
+
${StyledBullet} {
|
|
70
|
+
border-color: ${th.color("brand-700")({ theme })};
|
|
71
|
+
color: ${th.color("brand-700")({ theme })};
|
|
72
|
+
font-weight: bold;
|
|
73
|
+
border-width: 1.5px;
|
|
74
|
+
}
|
|
75
|
+
${StyledLabel} {
|
|
76
|
+
color: ${th.color("brand-700")({ theme })};
|
|
77
|
+
font-weight: bold;
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
}}
|
|
81
|
+
|
|
82
|
+
${({ completed, theme }) => {
|
|
83
|
+
if (!completed)
|
|
84
|
+
return "";
|
|
85
|
+
return `
|
|
86
|
+
${StyledBullet} {
|
|
87
|
+
border-color: ${th.color("brand-600")({ theme })};
|
|
88
|
+
}
|
|
89
|
+
${StyledLabel} {
|
|
90
|
+
color: ${th.color("neutral-800")({ theme })};
|
|
91
|
+
}
|
|
92
|
+
&:not(:last-child) {
|
|
93
|
+
${StyledBulletWrapper}::after {
|
|
94
|
+
background: ${th.color("brand-700")({ theme })};
|
|
95
|
+
background-size: initial;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
}}
|
|
100
|
+
`;
|
|
101
|
+
const StyledStepsWrapper = styled.div`
|
|
102
|
+
display: flex;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
${xStyledCommonProps}
|
|
106
|
+
`;
|
|
107
|
+
export {
|
|
108
|
+
StyledBullet,
|
|
109
|
+
StyledBulletWrapper,
|
|
110
|
+
StyledItem,
|
|
111
|
+
StyledLabel,
|
|
112
|
+
StyledStepsWrapper,
|
|
113
|
+
StyledWrapper
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, th, xStyledCommonProps } from '@elliemae/ds-system';\n\nexport const StyledWrapper = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n`;\nexport const StyledLabel = styled.span`\n font-size: 1.0769rem;\n line-height: normal;\n font-weight: 400;\n color: neutral-500;\n transition: all 200ms cubic-bezier(0.36, 0, 1, 1);\n text-align: center;\n width: 100%;\n max-height: 36px;\n`;\nexport const StyledBulletWrapper = styled.div`\n display: flex;\n justify-content: center;\n position: relative;\n width: 100%;\n`;\nexport const StyledBullet = styled.div`\n margin: space(xs);\n width: 2.46154rem;\n height: 2.46154rem;\n border-radius: 50%;\n font-size: font-size(600);\n border: 1px solid #cbcfd7;\n color: brand-600;\n position: relative;\n transition: all 200ms cubic-bezier(0.36, 0, 1, 1);\n display: flex;\n justify-content: center;\n align-items: center;\n`;\nexport const StyledItem = styled.div<{ active: boolean; completed: boolean }>`\n display: flex;\n justify-content: center;\n flex: 1 1 0px;\n min-width: 96px;\n max-width: 144px;\n margin: 0 8px;\n\n &:not(:last-child) {\n ${StyledBulletWrapper}::after {\n margin: 0 5px;\n position: absolute;\n top: 50%;\n left: calc(62%);\n display: block;\n width: 80%;\n content: '';\n transition: all 300ms cubic-bezier(0.36, 0, 1, 1);\n height: 1px;\n background-image: linear-gradient(to right, #cbcfd7 40%, rgba(255, 255, 255, 0) 0%);\n background-position: top;\n background-size: 3px 1px;\n background-repeat: repeat-x;\n }\n }\n\n ${({ active, theme }) => {\n if (!active) return '';\n return `\n ${StyledBullet} {\n border-color: ${th.color('brand-700')({ theme })};\n color: ${th.color('brand-700')({ theme })};\n font-weight: bold;\n border-width: 1.5px;\n }\n ${StyledLabel} {\n color: ${th.color('brand-700')({ theme })};\n font-weight: bold;\n }\n `;\n }}\n\n ${({ completed, theme }) => {\n if (!completed) return '';\n return `\n ${StyledBullet} {\n border-color: ${th.color('brand-600')({ theme })};\n }\n ${StyledLabel} {\n color: ${th.color('neutral-800')({ theme })};\n }\n &:not(:last-child) {\n ${StyledBulletWrapper}::after {\n background: ${th.color('brand-700')({ theme })};\n background-size: initial;\n }\n }\n `;\n }}\n`;\n\nexport const StyledStepsWrapper = styled.div`\n display: flex;\n justify-content: center;\n overflow: hidden;\n ${xStyledCommonProps}\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,IAAI,0BAA0B;AAExC,MAAM,gBAAgB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAM7B,MAAM,cAAc,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU3B,MAAM,sBAAsB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAMnC,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAc5B,MAAM,aAAa,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAS3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAiBF,CAAC,EAAE,QAAQ,MAAM,MAAM;AACvB,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO;AAAA,MACL;AAAA,sBACgB,GAAG,MAAM,WAAW,EAAE,EAAE,MAAM,CAAC;AAAA,eACtC,GAAG,MAAM,WAAW,EAAE,EAAE,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA,MAIxC;AAAA,eACS,GAAG,MAAM,WAAW,EAAE,EAAE,MAAM,CAAC;AAAA;AAAA;AAAA;AAI5C;AAAA;AAAA,IAEE,CAAC,EAAE,WAAW,MAAM,MAAM;AAC1B,MAAI,CAAC;AAAW,WAAO;AACvB,SAAO;AAAA,QACH;AAAA,wBACgB,GAAG,MAAM,WAAW,EAAE,EAAE,MAAM,CAAC;AAAA;AAAA,QAE/C;AAAA,iBACS,GAAG,MAAM,aAAa,EAAE,EAAE,MAAM,CAAC;AAAA;AAAA;AAAA,UAGxC;AAAA,wBACc,GAAG,MAAM,WAAW,EAAE,EAAE,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAKrD;AAAA;AAGK,MAAM,qBAAqB,OAAO;AAAA;AAAA;AAAA;AAAA,IAIrC;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/useWizard.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useEffect, useCallback, useState } from "react";
|
|
3
|
-
import { get } from "@elliemae/ds-utilities";
|
|
4
3
|
const checkCanNext = (prevIndex, array) => array.length > prevIndex + 1;
|
|
5
4
|
const checkCanPrevious = (prevIndex) => prevIndex - 1 >= 0;
|
|
6
|
-
const noop = (
|
|
5
|
+
const noop = () => null;
|
|
7
6
|
function useWizard({
|
|
8
7
|
steps: wizardSteps,
|
|
9
8
|
current,
|
|
@@ -34,7 +33,7 @@ function useWizard({
|
|
|
34
33
|
previous: handlePrevious,
|
|
35
34
|
canNext: checkCanNext(currentStep, wizardSteps),
|
|
36
35
|
canPrevious: checkCanPrevious(currentStep),
|
|
37
|
-
WizardCurrentContent:
|
|
36
|
+
WizardCurrentContent: wizardSteps[currentStep]?.content
|
|
38
37
|
};
|
|
39
38
|
}
|
|
40
39
|
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 { useEffect, useCallback, useState } from 'react';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,WAAW,aAAa,gBAAgB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useEffect, useCallback, useState } from 'react';\nimport type { DSWizardT } from './react-desc-prop-types.js';\n\nconst checkCanNext = (prevIndex: number, array: DSWizardT.WizardStep[]): boolean => array.length > prevIndex + 1;\nconst checkCanPrevious = (prevIndex: number): boolean => prevIndex - 1 >= 0;\n\nconst noop = () => null;\n\ninterface WizardConfig<T extends DSWizardT.WizardStep> {\n steps: T[];\n current?: number;\n onNext?: (currentStep: number) => void;\n onPrevious?: (currentStep: number) => void;\n initial?: number;\n}\n\nexport default function useWizard<T extends DSWizardT.WizardStep>({\n steps: wizardSteps,\n current,\n onNext = noop,\n onPrevious = noop,\n initial = 0,\n}: WizardConfig<T>) {\n const [currentStep, setCurrentStep] = useState(initial);\n\n useEffect(() => {\n if (typeof current !== 'undefined') setCurrentStep(current);\n }, [current]);\n\n const handleNext = useCallback(() => {\n if (checkCanNext(currentStep, wizardSteps)) {\n onNext(currentStep);\n setCurrentStep(currentStep + 1);\n }\n }, [currentStep, wizardSteps, onNext]);\n\n const handlePrevious = useCallback(() => {\n if (checkCanPrevious(currentStep)) {\n onPrevious(currentStep);\n setCurrentStep(currentStep - 1);\n }\n }, [currentStep, onPrevious]);\n\n return {\n current: currentStep,\n next: handleNext,\n previous: handlePrevious,\n canNext: checkCanNext(currentStep, wizardSteps),\n canPrevious: checkCanPrevious(currentStep),\n WizardCurrentContent: wizardSteps[currentStep]?.content,\n };\n}\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,WAAW,aAAa,gBAAgB;AAGjD,MAAM,eAAe,CAAC,WAAmB,UAA2C,MAAM,SAAS,YAAY;AAC/G,MAAM,mBAAmB,CAAC,cAA+B,YAAY,KAAK;AAE1E,MAAM,OAAO,MAAM;AAUJ,SAAR,UAA2D;AAAA,EAChE,OAAO;AAAA,EACP;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU;AACZ,GAAoB;AAClB,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,OAAO;AAEtD,YAAU,MAAM;AACd,QAAI,OAAO,YAAY;AAAa,qBAAe,OAAO;AAAA,EAC5D,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,aAAa,YAAY,MAAM;AACnC,QAAI,aAAa,aAAa,WAAW,GAAG;AAC1C,aAAO,WAAW;AAClB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,GAAG,CAAC,aAAa,aAAa,MAAM,CAAC;AAErC,QAAM,iBAAiB,YAAY,MAAM;AACvC,QAAI,iBAAiB,WAAW,GAAG;AACjC,iBAAW,WAAW;AACtB,qBAAe,cAAc,CAAC;AAAA,IAChC;AAAA,EACF,GAAG,CAAC,aAAa,UAAU,CAAC;AAE5B,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS,aAAa,aAAa,WAAW;AAAA,IAC9C,aAAa,iBAAiB,WAAW;AAAA,IACzC,sBAAsB,YAAY,WAAW,GAAG;AAAA,EAClD;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
interface WizardStepProps {
|
|
3
|
-
label?: string;
|
|
4
|
-
icon?: React.ReactNode;
|
|
5
|
-
iconCompleted?: React.ReactNode;
|
|
6
|
-
iconActive?: React.ReactNode;
|
|
7
|
-
active?: boolean;
|
|
8
|
-
completed?: boolean;
|
|
9
|
-
index?: number;
|
|
10
|
-
}
|
|
1
|
+
import { type DSWizardT } from './react-desc-prop-types.js';
|
|
11
2
|
declare const WizardStep: {
|
|
12
|
-
(
|
|
13
|
-
propTypes: {
|
|
14
|
-
label: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
|
15
|
-
icon: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
|
16
|
-
iconCompleted: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
|
17
|
-
iconActive: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
|
18
|
-
active: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
|
19
|
-
completed: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
|
20
|
-
index: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
|
21
|
-
};
|
|
3
|
+
(props: DSWizardT.StepProps): import("react/jsx-runtime.js").JSX.Element;
|
|
22
4
|
displayName: string;
|
|
23
5
|
};
|
|
24
|
-
declare const WizzardStepWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<
|
|
6
|
+
declare const WizzardStepWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSWizardT.StepProps>;
|
|
25
7
|
export { WizzardStepWithSchema };
|
|
26
8
|
export default WizardStep;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type DSWizardT } from './react-desc-prop-types.js';
|
|
2
|
+
declare const WizardSteps: {
|
|
3
|
+
(props: DSWizardT.Props): import("react/jsx-runtime.js").JSX.Element;
|
|
4
|
+
Item: {
|
|
5
|
+
(props: DSWizardT.StepProps): import("react/jsx-runtime.js").JSX.Element;
|
|
6
|
+
displayName: string;
|
|
7
|
+
};
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
declare const WizzardWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSWizardT.Props>;
|
|
11
|
+
export { WizzardWithSchema };
|
|
12
|
+
export default WizardSteps;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';
|
|
3
|
+
export declare namespace DSWizardT {
|
|
4
|
+
interface WizardStep {
|
|
5
|
+
content: React.ComponentType;
|
|
6
|
+
}
|
|
7
|
+
interface RequiredProps {
|
|
8
|
+
}
|
|
9
|
+
interface DefaultProps {
|
|
10
|
+
current: number;
|
|
11
|
+
}
|
|
12
|
+
interface OptionalProps {
|
|
13
|
+
steps?: WizardStep[];
|
|
14
|
+
children?: React.ReactElement[];
|
|
15
|
+
}
|
|
16
|
+
interface Props extends Partial<DefaultProps>, OptionalProps, Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps>, XstyledProps, RequiredProps {
|
|
17
|
+
}
|
|
18
|
+
interface InternalProps extends DefaultProps, OptionalProps, Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps>, XstyledProps, RequiredProps {
|
|
19
|
+
}
|
|
20
|
+
interface StepProps {
|
|
21
|
+
label?: string;
|
|
22
|
+
icon?: React.ReactNode;
|
|
23
|
+
iconCompleted?: React.ReactNode;
|
|
24
|
+
iconActive?: React.ReactNode;
|
|
25
|
+
active?: boolean;
|
|
26
|
+
completed?: boolean;
|
|
27
|
+
index?: number;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export declare const defaultProps: DSWizardT.DefaultProps;
|
|
31
|
+
export declare const defaultStepProps: Required<DSWizardT.StepProps>;
|
|
32
|
+
export declare const DSWizardPropTypes: DSPropTypesSchema<DSWizardT.Props>;
|
|
33
|
+
export declare const DSWizardPropTypesSchema: React.WeakValidationMap<DSWizardT.Props>;
|
|
34
|
+
export declare const DSWizardStepPropsTypes: {
|
|
35
|
+
label: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
|
36
|
+
icon: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
|
37
|
+
iconCompleted: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
|
38
|
+
iconActive: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
|
39
|
+
active: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
|
40
|
+
completed: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
|
41
|
+
index: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
|
|
42
|
+
};
|
|
43
|
+
export declare const DSWizardStepPropsTypesSchema: React.WeakValidationMap<DSWizardT.StepProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { DSWizardT } from './react-desc-prop-types.js';
|
|
3
|
+
interface WizardConfig<T extends DSWizardT.WizardStep> {
|
|
4
|
+
steps: T[];
|
|
3
5
|
current?: number;
|
|
4
6
|
onNext?: (currentStep: number) => void;
|
|
5
7
|
onPrevious?: (currentStep: number) => void;
|
|
6
8
|
initial?: number;
|
|
7
9
|
}
|
|
8
|
-
export default function useWizard({ steps: wizardSteps, current, onNext, onPrevious, initial, }: WizardConfig): {
|
|
10
|
+
export default function useWizard<T extends DSWizardT.WizardStep>({ steps: wizardSteps, current, onNext, onPrevious, initial, }: WizardConfig<T>): {
|
|
9
11
|
current: number;
|
|
10
12
|
next: () => void;
|
|
11
13
|
previous: () => void;
|
|
12
14
|
canNext: boolean;
|
|
13
15
|
canPrevious: boolean;
|
|
14
|
-
WizardCurrentContent:
|
|
16
|
+
WizardCurrentContent: import("react").ComponentType<{}>;
|
|
15
17
|
};
|
|
16
18
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-wizard",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.22.0-next.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Wizard",
|
|
6
6
|
"files": [
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"indent": 4
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@elliemae/ds-classnames": "3.
|
|
59
|
-
"@elliemae/ds-props-helpers": "3.
|
|
60
|
-
"@elliemae/ds-
|
|
61
|
-
"@elliemae/ds-
|
|
58
|
+
"@elliemae/ds-classnames": "3.22.0-next.1",
|
|
59
|
+
"@elliemae/ds-props-helpers": "3.22.0-next.1",
|
|
60
|
+
"@elliemae/ds-utilities": "3.22.0-next.1",
|
|
61
|
+
"@elliemae/ds-icons": "3.22.0-next.1"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"lodash": "^4.17.21",
|
package/dist/cjs/blockNames.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var blockNames_exports = {};
|
|
30
|
-
__export(blockNames_exports, {
|
|
31
|
-
indicatorBlockName: () => indicatorBlockName,
|
|
32
|
-
indicatorItemBlockName: () => indicatorItemBlockName,
|
|
33
|
-
wizardBlockName: () => wizardBlockName
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(blockNames_exports);
|
|
36
|
-
var React = __toESM(require("react"));
|
|
37
|
-
const wizardBlockName = "wizard";
|
|
38
|
-
const indicatorBlockName = `${wizardBlockName}-steps-indicator`;
|
|
39
|
-
const indicatorItemBlockName = `${indicatorBlockName}-step`;
|
|
40
|
-
//# sourceMappingURL=blockNames.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/blockNames.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export const wizardBlockName = 'wizard';\nexport const indicatorBlockName = `${wizardBlockName}-steps-indicator`;\nexport const indicatorItemBlockName = `${indicatorBlockName}-step`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,kBAAkB;AACxB,MAAM,qBAAqB,GAAG;AAC9B,MAAM,yBAAyB,GAAG;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/blockNames.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
const wizardBlockName = "wizard";
|
|
3
|
-
const indicatorBlockName = `${wizardBlockName}-steps-indicator`;
|
|
4
|
-
const indicatorItemBlockName = `${indicatorBlockName}-step`;
|
|
5
|
-
export {
|
|
6
|
-
indicatorBlockName,
|
|
7
|
-
indicatorItemBlockName,
|
|
8
|
-
wizardBlockName
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=blockNames.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/blockNames.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const wizardBlockName = 'wizard';\nexport const indicatorBlockName = `${wizardBlockName}-steps-indicator`;\nexport const indicatorItemBlockName = `${indicatorBlockName}-step`;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,kBAAkB;AACxB,MAAM,qBAAqB,GAAG;AAC9B,MAAM,yBAAyB,GAAG;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|