@mailstep/design-system 0.6.62-beta.2 → 0.6.62
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/package.json
CHANGED
|
@@ -3,12 +3,12 @@ import { useMemo } from 'react';
|
|
|
3
3
|
import { StepItem } from './components/StepItem';
|
|
4
4
|
import { Container, ItemsWrapper } from './styles';
|
|
5
5
|
export var Stepper = function (_a) {
|
|
6
|
-
var items = _a.items, activeStep = _a.activeStep, handleChangeStep = _a.handleChangeStep, handleGoToNextStep = _a.handleGoToNextStep;
|
|
6
|
+
var items = _a.items, activeStep = _a.activeStep, handleChangeStep = _a.handleChangeStep, handleGoToNextStep = _a.handleGoToNextStep, isLoading = _a.isLoading;
|
|
7
7
|
if (!(items === null || items === void 0 ? void 0 : items.length))
|
|
8
8
|
return null;
|
|
9
9
|
var Component = useMemo(function () { return items[activeStep].component; }, [items, activeStep]);
|
|
10
10
|
return (_jsxs(Container, { children: [_jsx(ItemsWrapper, { children: items.map(function (_a, index) {
|
|
11
11
|
var title = _a.title, disabled = _a.disabled, completed = _a.completed;
|
|
12
12
|
return (_jsx(StepItem, { onClick: handleChangeStep(index), title: title, index: index, activeStep: activeStep, disabled: disabled, completed: completed }, title));
|
|
13
|
-
}) }), _jsx(Component, { handleGoToNextStep: handleGoToNextStep })] }));
|
|
13
|
+
}) }), _jsx(Component, { handleGoToNextStep: handleGoToNextStep, isLoading: isLoading })] }));
|
|
14
14
|
};
|
|
@@ -9,7 +9,13 @@ export var useStepper = function (_a) {
|
|
|
9
9
|
}, []);
|
|
10
10
|
var handleGoToNextStep = useCallback(function () {
|
|
11
11
|
if (activeStep + 1 === totalSteps) {
|
|
12
|
-
|
|
12
|
+
if (handleFinish) {
|
|
13
|
+
handleFinish().then(function () {
|
|
14
|
+
handleReset();
|
|
15
|
+
setSuccess(true);
|
|
16
|
+
});
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
13
19
|
handleReset();
|
|
14
20
|
setSuccess(true);
|
|
15
21
|
return;
|
|
@@ -4,9 +4,11 @@ export type StepperProps = {
|
|
|
4
4
|
activeStep: number;
|
|
5
5
|
handleChangeStep: (step: number) => () => void;
|
|
6
6
|
handleGoToNextStep: () => void;
|
|
7
|
+
isLoading?: boolean;
|
|
7
8
|
};
|
|
8
9
|
export type StepperPassedDownProps = {
|
|
9
10
|
handleGoToNextStep: () => void;
|
|
11
|
+
isLoading?: boolean;
|
|
10
12
|
};
|
|
11
13
|
export type StepperItem = {
|
|
12
14
|
title: string;
|
package/ui/index.es.js
CHANGED
|
@@ -52080,18 +52080,19 @@ const zSe = /* @__PURE__ */ Ra(HSe), GSe = q.div`
|
|
|
52080
52080
|
items: e,
|
|
52081
52081
|
activeStep: t,
|
|
52082
52082
|
handleChangeStep: r,
|
|
52083
|
-
handleGoToNextStep: n
|
|
52083
|
+
handleGoToNextStep: n,
|
|
52084
|
+
isLoading: i
|
|
52084
52085
|
}) => {
|
|
52085
52086
|
if (!(e != null && e.length))
|
|
52086
52087
|
return null;
|
|
52087
|
-
const
|
|
52088
|
+
const o = Xe(() => e[t].component, [e, t]);
|
|
52088
52089
|
return /* @__PURE__ */ g.jsxs(XSe, { children: [
|
|
52089
52090
|
/* @__PURE__ */ g.jsx(JSe, { children: e.map(({
|
|
52090
|
-
title:
|
|
52091
|
-
disabled:
|
|
52092
|
-
completed:
|
|
52093
|
-
},
|
|
52094
|
-
/* @__PURE__ */ g.jsx(
|
|
52091
|
+
title: l,
|
|
52092
|
+
disabled: c,
|
|
52093
|
+
completed: u
|
|
52094
|
+
}, f) => /* @__PURE__ */ g.jsx(YSe, { onClick: r(f), title: l, index: f, activeStep: t, disabled: c, completed: u }, l)) }),
|
|
52095
|
+
/* @__PURE__ */ g.jsx(o, { handleGoToNextStep: n, isLoading: i })
|
|
52095
52096
|
] });
|
|
52096
52097
|
}, Tke = ({
|
|
52097
52098
|
totalSteps: e,
|
|
@@ -52101,7 +52102,13 @@ const zSe = /* @__PURE__ */ Ra(HSe), GSe = q.div`
|
|
|
52101
52102
|
n(0), o(!1);
|
|
52102
52103
|
}, []), c = Ce(() => {
|
|
52103
52104
|
if (r + 1 === e) {
|
|
52104
|
-
|
|
52105
|
+
if (t) {
|
|
52106
|
+
t().then(() => {
|
|
52107
|
+
l(), o(!0);
|
|
52108
|
+
});
|
|
52109
|
+
return;
|
|
52110
|
+
}
|
|
52111
|
+
l(), o(!0);
|
|
52105
52112
|
return;
|
|
52106
52113
|
}
|
|
52107
52114
|
n(r + 1);
|
package/ui/index.umd.js
CHANGED
|
@@ -3933,7 +3933,7 @@ ${ee.current.stack}
|
|
|
3933
3933
|
`,GEe=q.div`
|
|
3934
3934
|
display: flex;
|
|
3935
3935
|
margin-bottom: 36px;
|
|
3936
|
-
`,_Ee=({items:e,activeStep:t,handleChangeStep:r,handleGoToNextStep:n})=>{if(!(e!=null&&e.length))return null;const
|
|
3936
|
+
`,_Ee=({items:e,activeStep:t,handleChangeStep:r,handleGoToNextStep:n,isLoading:i})=>{if(!(e!=null&&e.length))return null;const o=I.useMemo(()=>e[t].component,[e,t]);return g.jsxs(zEe,{children:[g.jsx(GEe,{children:e.map(({title:l,disabled:u,completed:c},f)=>g.jsx(HEe,{onClick:r(f),title:l,index:f,activeStep:t,disabled:u,completed:c},l))}),g.jsx(o,{handleGoToNextStep:n,isLoading:i})]})},UEe=({totalSteps:e,handleFinish:t})=>{const[r,n]=I.useState(0),[i,o]=I.useState(!1),l=I.useCallback(()=>{n(0),o(!1)},[]),u=I.useCallback(()=>{if(r+1===e){if(t){t().then(()=>{l(),o(!0)});return}l(),o(!0);return}n(r+1)},[r,e,l]),c=I.useCallback(f=>()=>{n(f)},[]);return{activeStep:r,handleChangeStep:c,handleGoToNextStep:u,isSuccess:i,handleReset:l}},ZEe=q(rt.div)`
|
|
3937
3937
|
margin-right: 1em;
|
|
3938
3938
|
`,YEe=q.div`
|
|
3939
3939
|
display: flex;
|