@mailstep/design-system 0.6.62-beta.1 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailstep/design-system",
3
- "version": "0.6.62-beta.1",
3
+ "version": "0.6.62",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -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
  };
@@ -3,5 +3,5 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
3
3
  return cooked;
4
4
  };
5
5
  import styled, { th } from '@xstyled/styled-components';
6
- export var CheckedCircleContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-radius: 50%;\n border: 8px solid ", ";\n color: ", ";\n height: 36px;\n width: 36px;\n display: flex;\n justify-content: center;\n align-items: center;\n"], ["\n border-radius: 50%;\n border: 8px solid ", ";\n color: ", ";\n height: 36px;\n width: 36px;\n display: flex;\n justify-content: center;\n align-items: center;\n"])), th.color('red1'), th.color('red1'));
6
+ export var CheckedCircleContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-radius: 50%;\n border: 8px solid ", ";\n color: ", ";\n height: 36px;\n width: 36px;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: white;\n"], ["\n border-radius: 50%;\n border: 8px solid ", ";\n color: ", ";\n height: 36px;\n width: 36px;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: white;\n"])), th.color('red1'), th.color('red1'));
7
7
  var templateObject_1;
@@ -1,5 +1,6 @@
1
1
  type Props = {
2
2
  totalSteps: number;
3
+ handleFinish?: () => Promise<void>;
3
4
  };
4
5
  type HookType = (props: Props) => {
5
6
  activeStep: number;
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useState } from 'react';
2
2
  export var useStepper = function (_a) {
3
- var totalSteps = _a.totalSteps;
3
+ var totalSteps = _a.totalSteps, handleFinish = _a.handleFinish;
4
4
  var _b = useState(0), activeStep = _b[0], setActiveStep = _b[1];
5
5
  var _c = useState(false), isSuccess = _c[0], setSuccess = _c[1];
6
6
  var handleReset = useCallback(function () {
@@ -9,6 +9,13 @@ export var useStepper = function (_a) {
9
9
  }, []);
10
10
  var handleGoToNextStep = useCallback(function () {
11
11
  if (activeStep + 1 === totalSteps) {
12
+ if (handleFinish) {
13
+ handleFinish().then(function () {
14
+ handleReset();
15
+ setSuccess(true);
16
+ });
17
+ return;
18
+ }
12
19
  handleReset();
13
20
  setSuccess(true);
14
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;