@pedidopago/ui 1.2.2 → 1.2.3

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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { IStepsProps } from './types';
3
- declare const Steps: ({ current, steps, activeColor, fullWidth, isReducedSteps, }: IStepsProps) => JSX.Element;
3
+ declare const Steps: ({ current, steps, activeColor, fullWidth, isReducedSteps, enableCurrentStepChecked, }: IStepsProps) => JSX.Element;
4
4
  export default Steps;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Steps/index.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,QAAA,MAAM,KAAK,gEAMR,WAAW,gBAkFb,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Steps/index.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,QAAA,MAAM,KAAK,0FAOR,WAAW,gBAgGb,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -40,19 +40,14 @@ var Steps = function Steps(_ref) {
40
40
  activeColor = _ref$activeColor === void 0 ? 'primary' : _ref$activeColor,
41
41
  fullWidth = _ref.fullWidth,
42
42
  _ref$isReducedSteps = _ref.isReducedSteps,
43
- isReducedSteps = _ref$isReducedSteps === void 0 ? false : _ref$isReducedSteps;
43
+ isReducedSteps = _ref$isReducedSteps === void 0 ? false : _ref$isReducedSteps,
44
+ enableCurrentStepChecked = _ref.enableCurrentStepChecked;
44
45
 
45
46
  var _useState = (0, _react.useState)(false),
46
47
  _useState2 = _slicedToArray(_useState, 2),
47
48
  isMobile = _useState2[0],
48
49
  setIsMobile = _useState2[1];
49
50
 
50
- var checkWindowSize = function checkWindowSize() {
51
- setIsMobile(window.innerWidth < 500);
52
- };
53
-
54
- window.addEventListener('resize', checkWindowSize);
55
-
56
51
  var getStepIconPosition = function getStepIconPosition(index) {
57
52
  if (index === 0 && index < steps.length - 1) {
58
53
  return _utils.STEP_POSITION.INITIAL_BEFORE_UNSELECTED;
@@ -75,6 +70,16 @@ var Steps = function Steps(_ref) {
75
70
  return index === steps.length - 1 || index === current - 1 && index < steps.length - 1;
76
71
  };
77
72
 
73
+ var checkWindowSize = function checkWindowSize() {
74
+ setIsMobile(window.innerWidth < 500);
75
+ };
76
+
77
+ (0, _react.useEffect)(function () {
78
+ window.addEventListener('resize', checkWindowSize);
79
+ return function () {
80
+ window.removeEventListener('resize', checkWindowSize);
81
+ };
82
+ }, []);
78
83
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StepsContainer, {
79
84
  fullWidth: fullWidth,
80
85
  isReducedSteps: isReducedSteps,
@@ -105,19 +110,19 @@ var Steps = function Steps(_ref) {
105
110
  id: "simple-step-".concat(index + 1),
106
111
  tabIndex: index + 1 === current ? 0 : -1,
107
112
  isCurrent: current === index + 1,
108
- isFinished: current > index + 1,
109
113
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.StepsItemsDetailsContainer, {
110
114
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StepsCircle, {
111
115
  activeColor: activeColor,
112
116
  isCurrent: current === index + 1,
113
- isFinished: current > index + 1,
114
- children: current > index + 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
117
+ isFinished: current > index + 1 || enableCurrentStepChecked && current === index + 1,
118
+ children: current > index + 1 || enableCurrentStepChecked && current === index + 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
115
119
  name: "check"
116
120
  }) : index + 1
117
121
  }), current === index + 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StepsItemText, {
122
+ isDisabled: enableCurrentStepChecked,
118
123
  children: step
119
124
  })]
120
- }), current === index + 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StepsSeparator, {})]
125
+ }), current === index + 1 && current < steps.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StepsSeparator, {})]
121
126
  }, index);
122
127
  })
123
128
  });
@@ -23,7 +23,6 @@ export declare const StepsItemContainer: import("@emotion/styled").StyledCompone
23
23
  as?: import("react").ElementType<any> | undefined;
24
24
  } & {
25
25
  isCurrent: boolean;
26
- isFinished: boolean;
27
26
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
28
27
  export declare const ReducedStepsContainer: import("@emotion/styled").StyledComponent<{
29
28
  theme?: import("@emotion/react").Theme | undefined;
@@ -42,5 +41,6 @@ export declare const StepsItemText: import("@emotion/styled").StyledComponent<{
42
41
  as?: import("react").ElementType<any> | undefined;
43
42
  } & {
44
43
  isReducedSteps?: boolean | undefined;
44
+ isDisabled?: boolean | undefined;
45
45
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, {}>;
46
46
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Steps/styles.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,cAAc;;;;;;yGAa1B,CAAC;AAEF,eAAO,MAAM,WAAW;;;;iBACT,SAAS,GAAG,WAAW,GAAG,UAAU;;;yGAiDlD,CAAC;AAEF,eAAO,MAAM,cAAc;;;yGAI1B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;eAClB,OAAO;gBACN,OAAO;yGAWpB,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;yGAajC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;yGAIvC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;yGAItC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;iHAWzB,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Steps/styles.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,cAAc;;;;;;yGAc1B,CAAC;AAEF,eAAO,MAAM,WAAW;;;;iBACT,SAAS,GAAG,WAAW,GAAG,UAAU;;;yGAiDlD,CAAC;AAEF,eAAO,MAAM,cAAc;;;yGAK1B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;eAClB,OAAO;yGAWnB,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;yGAajC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;yGAIvC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;yGAItC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;iHAkCzB,CAAC"}
@@ -13,15 +13,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
13
 
14
14
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
15
15
 
16
- var StepsContainer = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n gap: ", ";\n\n ", ";\n width: 100%;\n @media only screen and (max-width: 500px) {\n flex-direction: ", ";\n }\n"])), function (_ref) {
16
+ var StepsContainer = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n gap: ", ";\n flex-direction: ", ";\n\n ", ";\n\n @media only screen and (min-width: 500px) {\n flex-direction: row;\n }\n"])), function (_ref) {
17
17
  var isReducedSteps = _ref.isReducedSteps;
18
18
  return isReducedSteps ? '0' : '12px';
19
19
  }, function (_ref2) {
20
- var fullWidth = _ref2.fullWidth;
21
- return fullWidth ? "width: 100%;" : "width: 356px";
22
- }, function (_ref3) {
23
- var isReducedSteps = _ref3.isReducedSteps;
20
+ var isReducedSteps = _ref2.isReducedSteps;
24
21
  return isReducedSteps ? 'column' : 'row';
22
+ }, function (_ref3) {
23
+ var fullWidth = _ref3.fullWidth;
24
+ return fullWidth ? "width: 100%;" : "width: fit-content;";
25
25
  });
26
26
 
27
27
  exports.StepsContainer = StepsContainer;
@@ -39,7 +39,7 @@ var StepsCircle = _styled.default.div(_templateObject2 || (_templateObject2 = _t
39
39
 
40
40
  exports.StepsCircle = StepsCircle;
41
41
 
42
- var StepsSeparator = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 2px;\n width: 100%;\n background-color: ", ";\n"])), function (_ref6) {
42
+ var StepsSeparator = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 2px;\n width: 100%;\n min-width: 40px;\n background-color: ", ";\n"])), function (_ref6) {
43
43
  var theme = _ref6.theme;
44
44
  return theme.colors.neutral.neutral1;
45
45
  });
@@ -64,9 +64,21 @@ var StepsItemsDetailsContainer = _styled.default.div(_templateObject7 || (_templ
64
64
 
65
65
  exports.StepsItemsDetailsContainer = StepsItemsDetailsContainer;
66
66
 
67
- var StepsItemText = _styled.default.h3(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-family: inherit;\n font-weight: 600;\n font-size: 1.25rem;\n color: ", ";\n @media only screen and (max-width: 500px) {\n ", ";\n }\n"])), function (_ref7) {
68
- var theme = _ref7.theme;
69
- return theme.colorMode === 'light' ? theme.colors.neutral.black : theme.colors.neutral.white;
67
+ var StepsItemText = _styled.default.h3(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-family: inherit;\n font-weight: 600;\n font-size: 1.25rem;\n white-space: nowrap;\n\n ", "\n\n @media only screen and (max-width: 500px) {\n ", ";\n }\n"])), function (_ref7) {
68
+ var isDisabled = _ref7.isDisabled,
69
+ theme = _ref7.theme;
70
+
71
+ if (isDisabled) {
72
+ return "\n color: ".concat({
73
+ light: theme.colors.tertiary.hover,
74
+ dark: theme.colors.neutral.neutral4
75
+ }[theme.colorMode], ";\n ");
76
+ }
77
+
78
+ return "\n color: ".concat({
79
+ light: theme.colors.neutral.black,
80
+ dark: theme.colors.neutral.white
81
+ }[theme.colorMode], ";\n ");
70
82
  }, function (_ref8) {
71
83
  var isReducedSteps = _ref8.isReducedSteps;
72
84
  return isReducedSteps ? "width: 100%;" : "";
@@ -4,6 +4,7 @@ export declare type IStepsProps = {
4
4
  activeColor?: 'primary' | 'secondary' | 'tertiary';
5
5
  fullWidth?: boolean;
6
6
  isReducedSteps?: boolean;
7
+ enableCurrentStepChecked?: boolean;
7
8
  };
8
9
  export declare type IStepIcon = {
9
10
  isSelectedStep: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Steps/types.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,oBAAY,SAAS,GAAG;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;CACnD,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Steps/types.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC;AAEF,oBAAY,SAAS,GAAG;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;CACnD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pedidopago/ui",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Quick build beatiful Pedido Pago apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",