@mailstep/design-system 0.6.73-beta.3 → 0.6.73-beta.5

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.73-beta.3",
3
+ "version": "0.6.73-beta.5",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -4,7 +4,7 @@ import { StepItem } from './components/StepItem';
4
4
  import { Container, ItemsWrapper } from './styles';
5
5
  export var Stepper = function (_a) {
6
6
  var items = _a.items, activeStep = _a.activeStep, hasStepNumbering = _a.hasStepNumbering, handleChangeStep = _a.handleChangeStep, handleGoToNextStep = _a.handleGoToNextStep, isLoading = _a.isLoading;
7
- var Component = useMemo(function () { return items[activeStep].component; }, [items, activeStep]);
7
+ var Component = useMemo(function () { var _a; return (_a = items[activeStep]) === null || _a === void 0 ? void 0 : _a.component; }, [items, activeStep]);
8
8
  useEffect(function () {
9
9
  var _a;
10
10
  if (!!activeStep && !((_a = items[activeStep - 1]) === null || _a === void 0 ? void 0 : _a.completed)) {
@@ -14,7 +14,7 @@ export var Stepper = function (_a) {
14
14
  if (!(items === null || items === void 0 ? void 0 : items.length))
15
15
  return null;
16
16
  return (_jsxs(Container, { children: [_jsx(ItemsWrapper, { total: items.length, hasComponent: !!Component, children: items.map(function (_a, index) {
17
- var title = _a.title, disabled = _a.disabled, completed = _a.completed, icon = _a.icon;
18
- return (_jsx(StepItem, { onClick: handleChangeStep === null || handleChangeStep === void 0 ? void 0 : handleChangeStep(index), title: title, index: index, total: items.length, activeStep: activeStep, disabled: disabled, completed: completed, hasStepNumbering: hasStepNumbering, icon: icon }, title));
17
+ var title = _a.title, disabled = _a.disabled, visible = _a.visible, completed = _a.completed, icon = _a.icon;
18
+ return (_jsx(StepItem, { onClick: handleChangeStep === null || handleChangeStep === void 0 ? void 0 : handleChangeStep(index), title: title, index: index, total: items.length, activeStep: activeStep, disabled: disabled, visible: visible, completed: completed, hasStepNumbering: hasStepNumbering, icon: icon }, title));
19
19
  }) }), Component && _jsx(Component, { handleGoToNextStep: handleGoToNextStep, isLoading: isLoading })] }));
20
20
  };
@@ -5,6 +5,7 @@ type StepItemProps = {
5
5
  index: number;
6
6
  activeStep: number;
7
7
  disabled?: boolean;
8
+ visible?: boolean;
8
9
  completed?: boolean;
9
10
  icon?: string;
10
11
  hasStepNumbering?: boolean;
@@ -6,8 +6,8 @@ import { x } from '@xstyled/styled-components';
6
6
  import isBoolean from 'lodash/isBoolean';
7
7
  import { Line, StepItemContainer, ContentWrapper } from './styles';
8
8
  export var StepItem = function (_a) {
9
- var title = _a.title, index = _a.index, disabled = _a.disabled, activeStep = _a.activeStep, completed = _a.completed, icon = _a.icon, _b = _a.hasStepNumbering, hasStepNumbering = _b === void 0 ? true : _b, total = _a.total, onClick = _a.onClick;
9
+ var title = _a.title, index = _a.index, disabled = _a.disabled, activeStep = _a.activeStep, completed = _a.completed, icon = _a.icon, _b = _a.hasStepNumbering, hasStepNumbering = _b === void 0 ? true : _b, _c = _a.visible, visible = _c === void 0 ? true : _c, total = _a.total, onClick = _a.onClick;
10
10
  var isActiveStep = index === activeStep;
11
11
  var isCompletedStep = isBoolean(completed) ? completed : index < activeStep;
12
- return (_jsxs(StepItemContainer, { onClick: !disabled && isCompletedStep ? onClick : undefined, isActiveStep: isActiveStep, isDisabled: disabled, total: total, children: [_jsx(Line, { isActiveStep: isActiveStep, isCompletedStep: isCompletedStep }), _jsxs(ContentWrapper, { children: [_jsx(StepCircle, { icon: isCompletedStep ? 'check' : icon, isCompleted: isCompletedStep, isActiveStep: isActiveStep, children: index + 1 }), _jsxs(x.div, { alignSelf: "center", children: [hasStepNumbering && (_jsx(x.span, { textTransform: "uppercase", children: _jsxs(H7, { color: isCompletedStep ? 'red1' : 'gray1', variant: "semiBold", mt: 0, mb: "4px", children: [_jsx(Trans, { id: "step", message: "Step" }), ": ", index + 1] }) })), _jsx(Paragraph2, { variant: "medium", children: title })] })] })] }));
12
+ return (_jsxs(StepItemContainer, { onClick: !disabled && isCompletedStep ? onClick : undefined, isActiveStep: isActiveStep, isDisabled: disabled, isVisible: visible, total: total, children: [_jsx(Line, { isActiveStep: isActiveStep, isCompletedStep: isCompletedStep }), _jsxs(ContentWrapper, { children: [_jsx(StepCircle, { icon: isCompletedStep ? 'check' : icon, isCompleted: isCompletedStep, isActiveStep: isActiveStep, children: index + 1 }), _jsxs(x.div, { alignSelf: "center", children: [hasStepNumbering && (_jsx(x.span, { textTransform: "uppercase", children: _jsxs(H7, { color: isCompletedStep ? 'red1' : 'gray1', variant: "semiBold", mt: 0, mb: "4px", children: [_jsx(Trans, { id: "step", message: "Step" }), ": ", index + 1] }) })), _jsx(Paragraph2, { variant: "medium", children: title })] })] })] }));
13
13
  };
@@ -1,6 +1,7 @@
1
1
  export declare const StepItemContainer: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
2
2
  isActiveStep: boolean;
3
3
  isDisabled?: boolean | undefined;
4
+ isVisible?: boolean | undefined;
4
5
  total: number;
5
6
  onClick?: (() => void) | undefined;
6
7
  }, never>;
@@ -14,12 +14,15 @@ var responsiveCss = css(templateObject_1 || (templateObject_1 = __makeTemplateOb
14
14
  var total = _a.total;
15
15
  return total * 240;
16
16
  }, StepCircleContainer);
17
- export var StepItemContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 10px;\n width: 240px;\n padding: 24px;\n background-color: ", ";\n cursor: ", ";\n ", "\n"], ["\n border-radius: 10px;\n width: 240px;\n padding: 24px;\n background-color: ", ";\n cursor: ", ";\n ", "\n"])), function (_a) {
17
+ export var StepItemContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 10px;\n width: 240px;\n padding: 24px;\n background-color: ", ";\n cursor: ", ";\n display: ", ";\n ", "\n"], ["\n border-radius: 10px;\n width: 240px;\n padding: 24px;\n background-color: ", ";\n cursor: ", ";\n display: ", ";\n ", "\n"])), function (_a) {
18
18
  var isActiveStep = _a.isActiveStep;
19
19
  return (isActiveStep ? th.color('bgLightGray1') : 'transparent');
20
20
  }, function (_a) {
21
21
  var isDisabled = _a.isDisabled, onClick = _a.onClick;
22
22
  return (isDisabled ? 'not-allowed' : onClick ? 'pointer' : 'auto');
23
+ }, function (_a) {
24
+ var isVisible = _a.isVisible;
25
+ return (isVisible ? 'block' : 'none');
23
26
  }, responsiveCss);
24
27
  export var Line = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: 4px;\n border-radius: 8px;\n width: 100%;\n background-color: ", ";\n margin-bottom: 16px;\n"], ["\n height: 4px;\n border-radius: 8px;\n width: 100%;\n background-color: ", ";\n margin-bottom: 16px;\n"])), function (_a) {
25
28
  var isActiveStep = _a.isActiveStep, isCompletedStep = _a.isCompletedStep;
@@ -52,7 +52,7 @@ var iconItems = [
52
52
  },
53
53
  {
54
54
  title: 'Processed in stock',
55
- icon: 'boxRamp'
55
+ icon: 'boxRamp',
56
56
  },
57
57
  {
58
58
  title: 'Log Processed in stock',
@@ -16,5 +16,6 @@ export type StepperItem = {
16
16
  icon?: string;
17
17
  completed?: boolean;
18
18
  disabled?: boolean;
19
+ visible?: boolean;
19
20
  component?: FC<StepperPassedDownProps>;
20
21
  };