@alfalab/core-components-steps 1.6.1 → 1.6.2

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/Component.js CHANGED
@@ -11,33 +11,32 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
11
11
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
12
12
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
13
13
 
14
- var styles = {"component":"steps__component_1n1l2","vertical":"steps__vertical_1n1l2"};
14
+ var styles = {"component":"steps__component_7b4f4","vertical":"steps__vertical_7b4f4"};
15
15
  require('./index.css')
16
16
 
17
17
  var Steps = function (_a) {
18
18
  var _b;
19
19
  var className = _a.className, children = _a.children, _c = _a.defaultActiveStep, defaultActiveStep = _c === void 0 ? 1 : _c, activeStepProp = _a.activeStep, _d = _a.isMarkCompletedSteps, isMarkCompletedSteps = _d === void 0 ? true : _d, _e = _a.isVerticalAlign, isVerticalAlign = _e === void 0 ? false : _e, _f = _a.ordered, ordered = _f === void 0 ? true : _f, _g = _a.interactive, interactive = _g === void 0 ? true : _g, _h = _a.fullWidth, fullWidth = _h === void 0 ? false : _h, _j = _a.minSpaceBetweenSteps, minSpaceBetweenSteps = _j === void 0 ? 24 : _j, checkIsStepDisabled = _a.checkIsStepDisabled, checkIsStepError = _a.checkIsStepError, checkIsStepWarning = _a.checkIsStepWarning, checkIsStepWaiting = _a.checkIsStepWaiting, checkIsStepPositive = _a.checkIsStepPositive, checkIsStepCustom = _a.checkIsStepCustom, onChange = _a.onChange, dataTestId = _a.dataTestId;
20
- var _k = React.useState(activeStepProp || defaultActiveStep), activeStep = _k[0], setActiveStep = _k[1];
20
+ var uncontrolled = activeStepProp === undefined;
21
+ var _k = React.useState(defaultActiveStep), activeStep = _k[0], setActiveStep = _k[1];
21
22
  var stepsLength = React__default.default.Children.count(children);
22
- React.useEffect(function () {
23
- if (activeStepProp) {
24
- setActiveStep(activeStepProp);
25
- }
26
- }, [activeStepProp]);
27
23
  var handleStepClick = function (stepNumber) {
28
- setActiveStep(stepNumber);
24
+ if (uncontrolled) {
25
+ setActiveStep(stepNumber);
26
+ }
29
27
  if (onChange) {
30
28
  onChange(stepNumber);
31
29
  }
32
30
  };
33
31
  if (!stepsLength)
34
32
  return null;
33
+ var visibleActiveStep = uncontrolled ? activeStep : activeStepProp;
35
34
  return (React__default.default.createElement("div", { className: cn__default.default(className, styles.component, (_b = {},
36
35
  _b[styles.vertical] = isVerticalAlign,
37
36
  _b)), "data-test-id": dataTestId }, React__default.default.Children.map(children, function (step, index) {
38
37
  var stepNumber = index + 1;
39
- var isSelected = stepNumber === activeStep;
40
- var isStepCompleted = isMarkCompletedSteps && stepNumber < activeStep;
38
+ var isSelected = stepNumber === visibleActiveStep;
39
+ var isStepCompleted = isMarkCompletedSteps && stepNumber < visibleActiveStep;
41
40
  var disabled = checkIsStepDisabled ? checkIsStepDisabled(stepNumber) : false;
42
41
  var isPositive = checkIsStepPositive ? checkIsStepPositive(stepNumber) : false;
43
42
  var isError = checkIsStepError ? checkIsStepError(stepNumber) : false;
@@ -16,7 +16,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
16
16
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
17
17
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
18
18
 
19
- var styles = {"step":"steps__step_1ohj2","vertical":"steps__vertical_1ohj2","interactive":"steps__interactive_1ohj2","disabled":"steps__disabled_1ohj2","text":"steps__text_1ohj2","indicator":"steps__indicator_1ohj2","option":"steps__option_1ohj2","dash":"steps__dash_1ohj2","size-16":"steps__size-16_1ohj2","size-8":"steps__size-8_1ohj2","completed":"steps__completed_1ohj2","focused":"steps__focused_1ohj2","selected":"steps__selected_1ohj2","checkbox":"steps__checkbox_1ohj2","dot":"steps__dot_1ohj2","error":"steps__error_1ohj2","unordered":"steps__unordered_1ohj2","completedIndicator":"steps__completedIndicator_1ohj2","fullWidth":"steps__fullWidth_1ohj2"};
19
+ var styles = {"step":"steps__step_x2lwq","vertical":"steps__vertical_x2lwq","interactive":"steps__interactive_x2lwq","disabled":"steps__disabled_x2lwq","text":"steps__text_x2lwq","indicator":"steps__indicator_x2lwq","option":"steps__option_x2lwq","dash":"steps__dash_x2lwq","size-16":"steps__size-16_x2lwq","size-8":"steps__size-8_x2lwq","completed":"steps__completed_x2lwq","focused":"steps__focused_x2lwq","selected":"steps__selected_x2lwq","checkbox":"steps__checkbox_x2lwq","dot":"steps__dot_x2lwq","error":"steps__error_x2lwq","unordered":"steps__unordered_x2lwq","completedIndicator":"steps__completedIndicator_x2lwq","fullWidth":"steps__fullWidth_x2lwq"};
20
20
  require('./index.css')
21
21
 
22
22
  var SIZE_TO_CLASSNAME_MAP = {
@@ -1,4 +1,4 @@
1
- /* hash: 1hf3o */
1
+ /* hash: hzyxv */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #2288fa;
@@ -30,26 +30,26 @@
30
30
  } :root {
31
31
  --steps-option-svg-color: var(--color-light-status-positive);
32
32
  --steps-dash-border: 2px solid var(--color-light-status-positive);
33
- } .steps__step_1ohj2 {
33
+ } .steps__step_x2lwq {
34
34
  display: flex;
35
35
  outline: none
36
- } .steps__step_1ohj2:not(.steps__vertical_1ohj2) {
36
+ } .steps__step_x2lwq:not(.steps__vertical_x2lwq) {
37
37
  align-items: center;
38
- } .steps__step_1ohj2.steps__interactive_1ohj2:not(.steps__disabled_1ohj2):hover {
38
+ } .steps__step_x2lwq.steps__interactive_x2lwq:not(.steps__disabled_x2lwq):hover {
39
39
  cursor: pointer;
40
- } .steps__step_1ohj2.steps__disabled_1ohj2:hover .steps__text_1ohj2 {
40
+ } .steps__step_x2lwq.steps__disabled_x2lwq:hover .steps__text_x2lwq {
41
41
  background: unset;
42
- } .steps__step_1ohj2.steps__disabled_1ohj2 .steps__indicator_1ohj2 {
42
+ } .steps__step_x2lwq.steps__disabled_x2lwq .steps__indicator_x2lwq {
43
43
  cursor: unset;
44
- } .steps__indicator_1ohj2 {
44
+ } .steps__indicator_x2lwq {
45
45
  cursor: pointer;
46
46
  display: flex;
47
47
  align-items: center;
48
48
  margin-right: var(--gap-2xs)
49
- } .steps__indicator_1ohj2.steps__vertical_1ohj2 {
49
+ } .steps__indicator_x2lwq.steps__vertical_x2lwq {
50
50
  flex-direction: column;
51
51
  margin-right: var(--gap-xs);
52
- } .steps__option_1ohj2 {
52
+ } .steps__option_x2lwq {
53
53
  font-size: 14px;
54
54
  line-height: 20px;
55
55
  font-weight: 700;
@@ -62,33 +62,33 @@
62
62
  min-width: 24px;
63
63
  height: 24px;
64
64
  border-radius: var(--border-radius-circle)
65
- } .steps__option_1ohj2.steps__vertical_1ohj2 {
65
+ } .steps__option_x2lwq.steps__vertical_x2lwq {
66
66
  margin-top: var(--gap-xs);
67
- } .steps__dash_1ohj2 {
67
+ } .steps__dash_x2lwq {
68
68
  flex: 1 1 auto;
69
69
  min-width: 24px;
70
70
  border-top: 2px solid var(--color-light-neutral-translucent-300);
71
71
  margin-right: var(--gap-xs)
72
- } .steps__dash_1ohj2.steps__size-16_1ohj2 {
72
+ } .steps__dash_x2lwq.steps__size-16_x2lwq {
73
73
  min-width: 16px;
74
- } .steps__dash_1ohj2.steps__size-8_1ohj2 {
74
+ } .steps__dash_x2lwq.steps__size-8_x2lwq {
75
75
  min-width: 8px;
76
- } .steps__dash_1ohj2.steps__completed_1ohj2 {
76
+ } .steps__dash_x2lwq.steps__completed_x2lwq {
77
77
  border-top: var(--steps-dash-border);
78
- } .steps__dash_1ohj2.steps__vertical_1ohj2 {
78
+ } .steps__dash_x2lwq.steps__vertical_x2lwq {
79
79
  min-width: unset;
80
80
  min-height: 24px;
81
81
  margin-right: 0;
82
82
  margin-top: var(--gap-xs);
83
83
  border-left: 2px solid var(--color-light-neutral-translucent-300);
84
84
  border-top: none
85
- } .steps__dash_1ohj2.steps__vertical_1ohj2.steps__size-16_1ohj2 {
85
+ } .steps__dash_x2lwq.steps__vertical_x2lwq.steps__size-16_x2lwq {
86
86
  min-height: 16px;
87
- } .steps__dash_1ohj2.steps__vertical_1ohj2.steps__size-8_1ohj2 {
87
+ } .steps__dash_x2lwq.steps__vertical_x2lwq.steps__size-8_x2lwq {
88
88
  min-height: 8px;
89
- } .steps__dash_1ohj2.steps__completed_1ohj2.steps__vertical_1ohj2 {
89
+ } .steps__dash_x2lwq.steps__completed_x2lwq.steps__vertical_x2lwq {
90
90
  border-left: var(--steps-dash-border);
91
- } .steps__text_1ohj2 {
91
+ } .steps__text_x2lwq {
92
92
  font-size: 16px;
93
93
  line-height: 24px;
94
94
  font-weight: 400;
@@ -98,19 +98,19 @@
98
98
  color: var(--color-light-text-primary);
99
99
  border-radius: var(--gap-xs);
100
100
  height: min-content
101
- } .steps__text_1ohj2.steps__interactive_1ohj2:not(.steps__disabled_1ohj2):hover {
101
+ } .steps__text_x2lwq.steps__interactive_x2lwq:not(.steps__disabled_x2lwq):hover {
102
102
  background: var(--color-light-transparent-default-hover);
103
- } .steps__text_1ohj2.steps__interactive_1ohj2:not(.steps__disabled_1ohj2):active {
103
+ } .steps__text_x2lwq.steps__interactive_x2lwq:not(.steps__disabled_x2lwq):active {
104
104
  background: var(--color-light-transparent-default-press);
105
- } .steps__focused_1ohj2 {
105
+ } .steps__focused_x2lwq {
106
106
  outline: var(--gap-3xs) solid var(--focus-color);
107
107
  outline-offset: var(--gap-3xs);
108
- } .steps__selected_1ohj2 .steps__text_1ohj2 {
108
+ } .steps__selected_x2lwq .steps__text_x2lwq {
109
109
  color: var(--color-light-text-primary);
110
- } .steps__selected_1ohj2 .steps__option_1ohj2 {
110
+ } .steps__selected_x2lwq .steps__option_x2lwq {
111
111
  color: var(--color-light-text-primary-inverted);
112
112
  background: var(--color-light-neutral-translucent-1300);
113
- } .steps__checkbox_1ohj2 {
113
+ } .steps__checkbox_x2lwq {
114
114
  display: flex;
115
115
  justify-content: center;
116
116
  align-items: center;
@@ -118,20 +118,20 @@
118
118
  width: 20px;
119
119
  height: 20px;
120
120
  border: 2px solid var(--color-light-neutral-translucent-300);
121
- } .steps__dot_1ohj2 {
121
+ } .steps__dot_x2lwq {
122
122
  width: 10px;
123
123
  height: 10px;
124
124
  border-radius: var(--border-radius-circle);
125
125
  background: var(--color-light-neutral-translucent-300);
126
- } .steps__selected_1ohj2 .steps__checkbox_1ohj2 {
126
+ } .steps__selected_x2lwq .steps__checkbox_x2lwq {
127
127
  border: 2px solid var(--color-light-neutral-translucent-1300)
128
- } .steps__selected_1ohj2 .steps__checkbox_1ohj2 .steps__dot_1ohj2 {
128
+ } .steps__selected_x2lwq .steps__checkbox_x2lwq .steps__dot_x2lwq {
129
129
  background: var(--color-light-neutral-translucent-1300);
130
- } .steps__option_1ohj2:not(.steps__error_1ohj2).steps__unordered_1ohj2 {
130
+ } .steps__option_x2lwq:not(.steps__error_x2lwq).steps__unordered_x2lwq {
131
131
  background: unset;
132
- } .steps__completedIndicator_1ohj2 > [class*='positive'] {
132
+ } .steps__completedIndicator_x2lwq > [class*='positive'] {
133
133
  color: var(--steps-option-svg-color);
134
134
  background-color: var(--steps-option-svg-color);
135
- } .steps__fullWidth_1ohj2 {
135
+ } .steps__fullWidth_x2lwq {
136
136
  width: 100%;
137
137
  }
@@ -11,7 +11,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
11
11
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
12
12
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
13
13
 
14
- var styles = {"component":"steps__component_1akb5"};
14
+ var styles = {"component":"steps__component_j5e09"};
15
15
  require('./index.css')
16
16
 
17
17
  var StepIndicator = function (_a) {
@@ -1,4 +1,4 @@
1
- /* hash: 1w3kq */
2
- .steps__component_1akb5 {
1
+ /* hash: wog03 */
2
+ .steps__component_j5e09 {
3
3
  padding: 0;
4
4
  }
package/cssm/Component.js CHANGED
@@ -16,27 +16,26 @@ var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
16
16
  var Steps = function (_a) {
17
17
  var _b;
18
18
  var className = _a.className, children = _a.children, _c = _a.defaultActiveStep, defaultActiveStep = _c === void 0 ? 1 : _c, activeStepProp = _a.activeStep, _d = _a.isMarkCompletedSteps, isMarkCompletedSteps = _d === void 0 ? true : _d, _e = _a.isVerticalAlign, isVerticalAlign = _e === void 0 ? false : _e, _f = _a.ordered, ordered = _f === void 0 ? true : _f, _g = _a.interactive, interactive = _g === void 0 ? true : _g, _h = _a.fullWidth, fullWidth = _h === void 0 ? false : _h, _j = _a.minSpaceBetweenSteps, minSpaceBetweenSteps = _j === void 0 ? 24 : _j, checkIsStepDisabled = _a.checkIsStepDisabled, checkIsStepError = _a.checkIsStepError, checkIsStepWarning = _a.checkIsStepWarning, checkIsStepWaiting = _a.checkIsStepWaiting, checkIsStepPositive = _a.checkIsStepPositive, checkIsStepCustom = _a.checkIsStepCustom, onChange = _a.onChange, dataTestId = _a.dataTestId;
19
- var _k = React.useState(activeStepProp || defaultActiveStep), activeStep = _k[0], setActiveStep = _k[1];
19
+ var uncontrolled = activeStepProp === undefined;
20
+ var _k = React.useState(defaultActiveStep), activeStep = _k[0], setActiveStep = _k[1];
20
21
  var stepsLength = React__default.default.Children.count(children);
21
- React.useEffect(function () {
22
- if (activeStepProp) {
23
- setActiveStep(activeStepProp);
24
- }
25
- }, [activeStepProp]);
26
22
  var handleStepClick = function (stepNumber) {
27
- setActiveStep(stepNumber);
23
+ if (uncontrolled) {
24
+ setActiveStep(stepNumber);
25
+ }
28
26
  if (onChange) {
29
27
  onChange(stepNumber);
30
28
  }
31
29
  };
32
30
  if (!stepsLength)
33
31
  return null;
32
+ var visibleActiveStep = uncontrolled ? activeStep : activeStepProp;
34
33
  return (React__default.default.createElement("div", { className: cn__default.default(className, styles__default.default.component, (_b = {},
35
34
  _b[styles__default.default.vertical] = isVerticalAlign,
36
35
  _b)), "data-test-id": dataTestId }, React__default.default.Children.map(children, function (step, index) {
37
36
  var stepNumber = index + 1;
38
- var isSelected = stepNumber === activeStep;
39
- var isStepCompleted = isMarkCompletedSteps && stepNumber < activeStep;
37
+ var isSelected = stepNumber === visibleActiveStep;
38
+ var isStepCompleted = isMarkCompletedSteps && stepNumber < visibleActiveStep;
40
39
  var disabled = checkIsStepDisabled ? checkIsStepDisabled(stepNumber) : false;
41
40
  var isPositive = checkIsStepPositive ? checkIsStepPositive(stepNumber) : false;
42
41
  var isError = checkIsStepError ? checkIsStepError(stepNumber) : false;
package/esm/Component.js CHANGED
@@ -1,34 +1,33 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { useState } from 'react';
2
2
  import cn from 'classnames';
3
3
  import { Step } from './components/step/Component.js';
4
4
 
5
- var styles = {"component":"steps__component_1n1l2","vertical":"steps__vertical_1n1l2"};
5
+ var styles = {"component":"steps__component_7b4f4","vertical":"steps__vertical_7b4f4"};
6
6
  require('./index.css')
7
7
 
8
8
  var Steps = function (_a) {
9
9
  var _b;
10
10
  var className = _a.className, children = _a.children, _c = _a.defaultActiveStep, defaultActiveStep = _c === void 0 ? 1 : _c, activeStepProp = _a.activeStep, _d = _a.isMarkCompletedSteps, isMarkCompletedSteps = _d === void 0 ? true : _d, _e = _a.isVerticalAlign, isVerticalAlign = _e === void 0 ? false : _e, _f = _a.ordered, ordered = _f === void 0 ? true : _f, _g = _a.interactive, interactive = _g === void 0 ? true : _g, _h = _a.fullWidth, fullWidth = _h === void 0 ? false : _h, _j = _a.minSpaceBetweenSteps, minSpaceBetweenSteps = _j === void 0 ? 24 : _j, checkIsStepDisabled = _a.checkIsStepDisabled, checkIsStepError = _a.checkIsStepError, checkIsStepWarning = _a.checkIsStepWarning, checkIsStepWaiting = _a.checkIsStepWaiting, checkIsStepPositive = _a.checkIsStepPositive, checkIsStepCustom = _a.checkIsStepCustom, onChange = _a.onChange, dataTestId = _a.dataTestId;
11
- var _k = useState(activeStepProp || defaultActiveStep), activeStep = _k[0], setActiveStep = _k[1];
11
+ var uncontrolled = activeStepProp === undefined;
12
+ var _k = useState(defaultActiveStep), activeStep = _k[0], setActiveStep = _k[1];
12
13
  var stepsLength = React.Children.count(children);
13
- useEffect(function () {
14
- if (activeStepProp) {
15
- setActiveStep(activeStepProp);
16
- }
17
- }, [activeStepProp]);
18
14
  var handleStepClick = function (stepNumber) {
19
- setActiveStep(stepNumber);
15
+ if (uncontrolled) {
16
+ setActiveStep(stepNumber);
17
+ }
20
18
  if (onChange) {
21
19
  onChange(stepNumber);
22
20
  }
23
21
  };
24
22
  if (!stepsLength)
25
23
  return null;
24
+ var visibleActiveStep = uncontrolled ? activeStep : activeStepProp;
26
25
  return (React.createElement("div", { className: cn(className, styles.component, (_b = {},
27
26
  _b[styles.vertical] = isVerticalAlign,
28
27
  _b)), "data-test-id": dataTestId }, React.Children.map(children, function (step, index) {
29
28
  var stepNumber = index + 1;
30
- var isSelected = stepNumber === activeStep;
31
- var isStepCompleted = isMarkCompletedSteps && stepNumber < activeStep;
29
+ var isSelected = stepNumber === visibleActiveStep;
30
+ var isStepCompleted = isMarkCompletedSteps && stepNumber < visibleActiveStep;
32
31
  var disabled = checkIsStepDisabled ? checkIsStepDisabled(stepNumber) : false;
33
32
  var isPositive = checkIsStepPositive ? checkIsStepPositive(stepNumber) : false;
34
33
  var isError = checkIsStepError ? checkIsStepError(stepNumber) : false;
@@ -7,7 +7,7 @@ import { ClockMIcon } from '@alfalab/icons-glyph/ClockMIcon';
7
7
  import { ExclamationCircleMIcon } from '@alfalab/icons-glyph/ExclamationCircleMIcon';
8
8
  import { StepIndicator } from '../step-indicator/Component.js';
9
9
 
10
- var styles = {"step":"steps__step_1ohj2","vertical":"steps__vertical_1ohj2","interactive":"steps__interactive_1ohj2","disabled":"steps__disabled_1ohj2","text":"steps__text_1ohj2","indicator":"steps__indicator_1ohj2","option":"steps__option_1ohj2","dash":"steps__dash_1ohj2","size-16":"steps__size-16_1ohj2","size-8":"steps__size-8_1ohj2","completed":"steps__completed_1ohj2","focused":"steps__focused_1ohj2","selected":"steps__selected_1ohj2","checkbox":"steps__checkbox_1ohj2","dot":"steps__dot_1ohj2","error":"steps__error_1ohj2","unordered":"steps__unordered_1ohj2","completedIndicator":"steps__completedIndicator_1ohj2","fullWidth":"steps__fullWidth_1ohj2"};
10
+ var styles = {"step":"steps__step_x2lwq","vertical":"steps__vertical_x2lwq","interactive":"steps__interactive_x2lwq","disabled":"steps__disabled_x2lwq","text":"steps__text_x2lwq","indicator":"steps__indicator_x2lwq","option":"steps__option_x2lwq","dash":"steps__dash_x2lwq","size-16":"steps__size-16_x2lwq","size-8":"steps__size-8_x2lwq","completed":"steps__completed_x2lwq","focused":"steps__focused_x2lwq","selected":"steps__selected_x2lwq","checkbox":"steps__checkbox_x2lwq","dot":"steps__dot_x2lwq","error":"steps__error_x2lwq","unordered":"steps__unordered_x2lwq","completedIndicator":"steps__completedIndicator_x2lwq","fullWidth":"steps__fullWidth_x2lwq"};
11
11
  require('./index.css')
12
12
 
13
13
  var SIZE_TO_CLASSNAME_MAP = {
@@ -1,4 +1,4 @@
1
- /* hash: 1hf3o */
1
+ /* hash: hzyxv */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #2288fa;
@@ -30,26 +30,26 @@
30
30
  } :root {
31
31
  --steps-option-svg-color: var(--color-light-status-positive);
32
32
  --steps-dash-border: 2px solid var(--color-light-status-positive);
33
- } .steps__step_1ohj2 {
33
+ } .steps__step_x2lwq {
34
34
  display: flex;
35
35
  outline: none
36
- } .steps__step_1ohj2:not(.steps__vertical_1ohj2) {
36
+ } .steps__step_x2lwq:not(.steps__vertical_x2lwq) {
37
37
  align-items: center;
38
- } .steps__step_1ohj2.steps__interactive_1ohj2:not(.steps__disabled_1ohj2):hover {
38
+ } .steps__step_x2lwq.steps__interactive_x2lwq:not(.steps__disabled_x2lwq):hover {
39
39
  cursor: pointer;
40
- } .steps__step_1ohj2.steps__disabled_1ohj2:hover .steps__text_1ohj2 {
40
+ } .steps__step_x2lwq.steps__disabled_x2lwq:hover .steps__text_x2lwq {
41
41
  background: unset;
42
- } .steps__step_1ohj2.steps__disabled_1ohj2 .steps__indicator_1ohj2 {
42
+ } .steps__step_x2lwq.steps__disabled_x2lwq .steps__indicator_x2lwq {
43
43
  cursor: unset;
44
- } .steps__indicator_1ohj2 {
44
+ } .steps__indicator_x2lwq {
45
45
  cursor: pointer;
46
46
  display: flex;
47
47
  align-items: center;
48
48
  margin-right: var(--gap-2xs)
49
- } .steps__indicator_1ohj2.steps__vertical_1ohj2 {
49
+ } .steps__indicator_x2lwq.steps__vertical_x2lwq {
50
50
  flex-direction: column;
51
51
  margin-right: var(--gap-xs);
52
- } .steps__option_1ohj2 {
52
+ } .steps__option_x2lwq {
53
53
  font-size: 14px;
54
54
  line-height: 20px;
55
55
  font-weight: 700;
@@ -62,33 +62,33 @@
62
62
  min-width: 24px;
63
63
  height: 24px;
64
64
  border-radius: var(--border-radius-circle)
65
- } .steps__option_1ohj2.steps__vertical_1ohj2 {
65
+ } .steps__option_x2lwq.steps__vertical_x2lwq {
66
66
  margin-top: var(--gap-xs);
67
- } .steps__dash_1ohj2 {
67
+ } .steps__dash_x2lwq {
68
68
  flex: 1 1 auto;
69
69
  min-width: 24px;
70
70
  border-top: 2px solid var(--color-light-neutral-translucent-300);
71
71
  margin-right: var(--gap-xs)
72
- } .steps__dash_1ohj2.steps__size-16_1ohj2 {
72
+ } .steps__dash_x2lwq.steps__size-16_x2lwq {
73
73
  min-width: 16px;
74
- } .steps__dash_1ohj2.steps__size-8_1ohj2 {
74
+ } .steps__dash_x2lwq.steps__size-8_x2lwq {
75
75
  min-width: 8px;
76
- } .steps__dash_1ohj2.steps__completed_1ohj2 {
76
+ } .steps__dash_x2lwq.steps__completed_x2lwq {
77
77
  border-top: var(--steps-dash-border);
78
- } .steps__dash_1ohj2.steps__vertical_1ohj2 {
78
+ } .steps__dash_x2lwq.steps__vertical_x2lwq {
79
79
  min-width: unset;
80
80
  min-height: 24px;
81
81
  margin-right: 0;
82
82
  margin-top: var(--gap-xs);
83
83
  border-left: 2px solid var(--color-light-neutral-translucent-300);
84
84
  border-top: none
85
- } .steps__dash_1ohj2.steps__vertical_1ohj2.steps__size-16_1ohj2 {
85
+ } .steps__dash_x2lwq.steps__vertical_x2lwq.steps__size-16_x2lwq {
86
86
  min-height: 16px;
87
- } .steps__dash_1ohj2.steps__vertical_1ohj2.steps__size-8_1ohj2 {
87
+ } .steps__dash_x2lwq.steps__vertical_x2lwq.steps__size-8_x2lwq {
88
88
  min-height: 8px;
89
- } .steps__dash_1ohj2.steps__completed_1ohj2.steps__vertical_1ohj2 {
89
+ } .steps__dash_x2lwq.steps__completed_x2lwq.steps__vertical_x2lwq {
90
90
  border-left: var(--steps-dash-border);
91
- } .steps__text_1ohj2 {
91
+ } .steps__text_x2lwq {
92
92
  font-size: 16px;
93
93
  line-height: 24px;
94
94
  font-weight: 400;
@@ -98,19 +98,19 @@
98
98
  color: var(--color-light-text-primary);
99
99
  border-radius: var(--gap-xs);
100
100
  height: min-content
101
- } .steps__text_1ohj2.steps__interactive_1ohj2:not(.steps__disabled_1ohj2):hover {
101
+ } .steps__text_x2lwq.steps__interactive_x2lwq:not(.steps__disabled_x2lwq):hover {
102
102
  background: var(--color-light-transparent-default-hover);
103
- } .steps__text_1ohj2.steps__interactive_1ohj2:not(.steps__disabled_1ohj2):active {
103
+ } .steps__text_x2lwq.steps__interactive_x2lwq:not(.steps__disabled_x2lwq):active {
104
104
  background: var(--color-light-transparent-default-press);
105
- } .steps__focused_1ohj2 {
105
+ } .steps__focused_x2lwq {
106
106
  outline: var(--gap-3xs) solid var(--focus-color);
107
107
  outline-offset: var(--gap-3xs);
108
- } .steps__selected_1ohj2 .steps__text_1ohj2 {
108
+ } .steps__selected_x2lwq .steps__text_x2lwq {
109
109
  color: var(--color-light-text-primary);
110
- } .steps__selected_1ohj2 .steps__option_1ohj2 {
110
+ } .steps__selected_x2lwq .steps__option_x2lwq {
111
111
  color: var(--color-light-text-primary-inverted);
112
112
  background: var(--color-light-neutral-translucent-1300);
113
- } .steps__checkbox_1ohj2 {
113
+ } .steps__checkbox_x2lwq {
114
114
  display: flex;
115
115
  justify-content: center;
116
116
  align-items: center;
@@ -118,20 +118,20 @@
118
118
  width: 20px;
119
119
  height: 20px;
120
120
  border: 2px solid var(--color-light-neutral-translucent-300);
121
- } .steps__dot_1ohj2 {
121
+ } .steps__dot_x2lwq {
122
122
  width: 10px;
123
123
  height: 10px;
124
124
  border-radius: var(--border-radius-circle);
125
125
  background: var(--color-light-neutral-translucent-300);
126
- } .steps__selected_1ohj2 .steps__checkbox_1ohj2 {
126
+ } .steps__selected_x2lwq .steps__checkbox_x2lwq {
127
127
  border: 2px solid var(--color-light-neutral-translucent-1300)
128
- } .steps__selected_1ohj2 .steps__checkbox_1ohj2 .steps__dot_1ohj2 {
128
+ } .steps__selected_x2lwq .steps__checkbox_x2lwq .steps__dot_x2lwq {
129
129
  background: var(--color-light-neutral-translucent-1300);
130
- } .steps__option_1ohj2:not(.steps__error_1ohj2).steps__unordered_1ohj2 {
130
+ } .steps__option_x2lwq:not(.steps__error_x2lwq).steps__unordered_x2lwq {
131
131
  background: unset;
132
- } .steps__completedIndicator_1ohj2 > [class*='positive'] {
132
+ } .steps__completedIndicator_x2lwq > [class*='positive'] {
133
133
  color: var(--steps-option-svg-color);
134
134
  background-color: var(--steps-option-svg-color);
135
- } .steps__fullWidth_1ohj2 {
135
+ } .steps__fullWidth_x2lwq {
136
136
  width: 100%;
137
137
  }
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import cn from 'classnames';
3
3
  import { Badge } from '@alfalab/core-components-badge/esm';
4
4
 
5
- var styles = {"component":"steps__component_1akb5"};
5
+ var styles = {"component":"steps__component_j5e09"};
6
6
  require('./index.css')
7
7
 
8
8
  var StepIndicator = function (_a) {
@@ -1,4 +1,4 @@
1
- /* hash: 1w3kq */
2
- .steps__component_1akb5 {
1
+ /* hash: wog03 */
2
+ .steps__component_j5e09 {
3
3
  padding: 0;
4
4
  }
package/esm/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: 4o5j9 */
1
+ /* hash: 15d60 */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
4
4
  } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -14,11 +14,11 @@
14
14
  } :root {
15
15
  } :root {
16
16
  } :root {
17
- } .steps__component_1n1l2 {
17
+ } .steps__component_7b4f4 {
18
18
  display: flex;
19
19
  align-items: center;
20
20
  flex-direction: row
21
- } .steps__component_1n1l2.steps__vertical_1n1l2 {
21
+ } .steps__component_7b4f4.steps__vertical_7b4f4 {
22
22
  flex-direction: column;
23
23
  align-items: flex-start;
24
24
  }
package/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: 4o5j9 */
1
+ /* hash: 15d60 */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
4
4
  } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -14,11 +14,11 @@
14
14
  } :root {
15
15
  } :root {
16
16
  } :root {
17
- } .steps__component_1n1l2 {
17
+ } .steps__component_7b4f4 {
18
18
  display: flex;
19
19
  align-items: center;
20
20
  flex-direction: row
21
- } .steps__component_1n1l2.steps__vertical_1n1l2 {
21
+ } .steps__component_7b4f4.steps__vertical_7b4f4 {
22
22
  flex-direction: column;
23
23
  align-items: flex-start;
24
24
  }
@@ -1,32 +1,31 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { useState } from 'react';
2
2
  import cn from 'classnames';
3
3
  import { Step } from './components/step/Component.js';
4
4
 
5
- const styles = {"component":"steps__component_1n1l2","vertical":"steps__vertical_1n1l2"};
5
+ const styles = {"component":"steps__component_7b4f4","vertical":"steps__vertical_7b4f4"};
6
6
  require('./index.css')
7
7
 
8
8
  const Steps = ({ className, children, defaultActiveStep = 1, activeStep: activeStepProp, isMarkCompletedSteps = true, isVerticalAlign = false, ordered = true, interactive = true, fullWidth = false, minSpaceBetweenSteps = 24, checkIsStepDisabled, checkIsStepError, checkIsStepWarning, checkIsStepWaiting, checkIsStepPositive, checkIsStepCustom, onChange, dataTestId, }) => {
9
- const [activeStep, setActiveStep] = useState(activeStepProp || defaultActiveStep);
9
+ const uncontrolled = activeStepProp === undefined;
10
+ const [activeStep, setActiveStep] = useState(defaultActiveStep);
10
11
  const stepsLength = React.Children.count(children);
11
- useEffect(() => {
12
- if (activeStepProp) {
13
- setActiveStep(activeStepProp);
14
- }
15
- }, [activeStepProp]);
16
12
  const handleStepClick = (stepNumber) => {
17
- setActiveStep(stepNumber);
13
+ if (uncontrolled) {
14
+ setActiveStep(stepNumber);
15
+ }
18
16
  if (onChange) {
19
17
  onChange(stepNumber);
20
18
  }
21
19
  };
22
20
  if (!stepsLength)
23
21
  return null;
22
+ const visibleActiveStep = uncontrolled ? activeStep : activeStepProp;
24
23
  return (React.createElement("div", { className: cn(className, styles.component, {
25
24
  [styles.vertical]: isVerticalAlign,
26
25
  }), "data-test-id": dataTestId }, React.Children.map(children, (step, index) => {
27
26
  const stepNumber = index + 1;
28
- const isSelected = stepNumber === activeStep;
29
- const isStepCompleted = isMarkCompletedSteps && stepNumber < activeStep;
27
+ const isSelected = stepNumber === visibleActiveStep;
28
+ const isStepCompleted = isMarkCompletedSteps && stepNumber < visibleActiveStep;
30
29
  const disabled = checkIsStepDisabled ? checkIsStepDisabled(stepNumber) : false;
31
30
  const isPositive = checkIsStepPositive ? checkIsStepPositive(stepNumber) : false;
32
31
  const isError = checkIsStepError ? checkIsStepError(stepNumber) : false;
@@ -6,7 +6,7 @@ import { ClockMIcon } from '@alfalab/icons-glyph/ClockMIcon';
6
6
  import { ExclamationCircleMIcon } from '@alfalab/icons-glyph/ExclamationCircleMIcon';
7
7
  import { StepIndicator } from '../step-indicator/Component.js';
8
8
 
9
- const styles = {"step":"steps__step_1ohj2","vertical":"steps__vertical_1ohj2","interactive":"steps__interactive_1ohj2","disabled":"steps__disabled_1ohj2","text":"steps__text_1ohj2","indicator":"steps__indicator_1ohj2","option":"steps__option_1ohj2","dash":"steps__dash_1ohj2","size-16":"steps__size-16_1ohj2","size-8":"steps__size-8_1ohj2","completed":"steps__completed_1ohj2","focused":"steps__focused_1ohj2","selected":"steps__selected_1ohj2","checkbox":"steps__checkbox_1ohj2","dot":"steps__dot_1ohj2","error":"steps__error_1ohj2","unordered":"steps__unordered_1ohj2","completedIndicator":"steps__completedIndicator_1ohj2","fullWidth":"steps__fullWidth_1ohj2"};
9
+ const styles = {"step":"steps__step_x2lwq","vertical":"steps__vertical_x2lwq","interactive":"steps__interactive_x2lwq","disabled":"steps__disabled_x2lwq","text":"steps__text_x2lwq","indicator":"steps__indicator_x2lwq","option":"steps__option_x2lwq","dash":"steps__dash_x2lwq","size-16":"steps__size-16_x2lwq","size-8":"steps__size-8_x2lwq","completed":"steps__completed_x2lwq","focused":"steps__focused_x2lwq","selected":"steps__selected_x2lwq","checkbox":"steps__checkbox_x2lwq","dot":"steps__dot_x2lwq","error":"steps__error_x2lwq","unordered":"steps__unordered_x2lwq","completedIndicator":"steps__completedIndicator_x2lwq","fullWidth":"steps__fullWidth_x2lwq"};
10
10
  require('./index.css')
11
11
 
12
12
  const SIZE_TO_CLASSNAME_MAP = {
@@ -1,4 +1,4 @@
1
- /* hash: 1hf3o */
1
+ /* hash: hzyxv */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #2288fa;
@@ -30,26 +30,26 @@
30
30
  } :root {
31
31
  --steps-option-svg-color: var(--color-light-status-positive);
32
32
  --steps-dash-border: 2px solid var(--color-light-status-positive);
33
- } .steps__step_1ohj2 {
33
+ } .steps__step_x2lwq {
34
34
  display: flex;
35
35
  outline: none
36
- } .steps__step_1ohj2:not(.steps__vertical_1ohj2) {
36
+ } .steps__step_x2lwq:not(.steps__vertical_x2lwq) {
37
37
  align-items: center;
38
- } .steps__step_1ohj2.steps__interactive_1ohj2:not(.steps__disabled_1ohj2):hover {
38
+ } .steps__step_x2lwq.steps__interactive_x2lwq:not(.steps__disabled_x2lwq):hover {
39
39
  cursor: pointer;
40
- } .steps__step_1ohj2.steps__disabled_1ohj2:hover .steps__text_1ohj2 {
40
+ } .steps__step_x2lwq.steps__disabled_x2lwq:hover .steps__text_x2lwq {
41
41
  background: unset;
42
- } .steps__step_1ohj2.steps__disabled_1ohj2 .steps__indicator_1ohj2 {
42
+ } .steps__step_x2lwq.steps__disabled_x2lwq .steps__indicator_x2lwq {
43
43
  cursor: unset;
44
- } .steps__indicator_1ohj2 {
44
+ } .steps__indicator_x2lwq {
45
45
  cursor: pointer;
46
46
  display: flex;
47
47
  align-items: center;
48
48
  margin-right: var(--gap-2xs)
49
- } .steps__indicator_1ohj2.steps__vertical_1ohj2 {
49
+ } .steps__indicator_x2lwq.steps__vertical_x2lwq {
50
50
  flex-direction: column;
51
51
  margin-right: var(--gap-xs);
52
- } .steps__option_1ohj2 {
52
+ } .steps__option_x2lwq {
53
53
  font-size: 14px;
54
54
  line-height: 20px;
55
55
  font-weight: 700;
@@ -62,33 +62,33 @@
62
62
  min-width: 24px;
63
63
  height: 24px;
64
64
  border-radius: var(--border-radius-circle)
65
- } .steps__option_1ohj2.steps__vertical_1ohj2 {
65
+ } .steps__option_x2lwq.steps__vertical_x2lwq {
66
66
  margin-top: var(--gap-xs);
67
- } .steps__dash_1ohj2 {
67
+ } .steps__dash_x2lwq {
68
68
  flex: 1 1 auto;
69
69
  min-width: 24px;
70
70
  border-top: 2px solid var(--color-light-neutral-translucent-300);
71
71
  margin-right: var(--gap-xs)
72
- } .steps__dash_1ohj2.steps__size-16_1ohj2 {
72
+ } .steps__dash_x2lwq.steps__size-16_x2lwq {
73
73
  min-width: 16px;
74
- } .steps__dash_1ohj2.steps__size-8_1ohj2 {
74
+ } .steps__dash_x2lwq.steps__size-8_x2lwq {
75
75
  min-width: 8px;
76
- } .steps__dash_1ohj2.steps__completed_1ohj2 {
76
+ } .steps__dash_x2lwq.steps__completed_x2lwq {
77
77
  border-top: var(--steps-dash-border);
78
- } .steps__dash_1ohj2.steps__vertical_1ohj2 {
78
+ } .steps__dash_x2lwq.steps__vertical_x2lwq {
79
79
  min-width: unset;
80
80
  min-height: 24px;
81
81
  margin-right: 0;
82
82
  margin-top: var(--gap-xs);
83
83
  border-left: 2px solid var(--color-light-neutral-translucent-300);
84
84
  border-top: none
85
- } .steps__dash_1ohj2.steps__vertical_1ohj2.steps__size-16_1ohj2 {
85
+ } .steps__dash_x2lwq.steps__vertical_x2lwq.steps__size-16_x2lwq {
86
86
  min-height: 16px;
87
- } .steps__dash_1ohj2.steps__vertical_1ohj2.steps__size-8_1ohj2 {
87
+ } .steps__dash_x2lwq.steps__vertical_x2lwq.steps__size-8_x2lwq {
88
88
  min-height: 8px;
89
- } .steps__dash_1ohj2.steps__completed_1ohj2.steps__vertical_1ohj2 {
89
+ } .steps__dash_x2lwq.steps__completed_x2lwq.steps__vertical_x2lwq {
90
90
  border-left: var(--steps-dash-border);
91
- } .steps__text_1ohj2 {
91
+ } .steps__text_x2lwq {
92
92
  font-size: 16px;
93
93
  line-height: 24px;
94
94
  font-weight: 400;
@@ -98,19 +98,19 @@
98
98
  color: var(--color-light-text-primary);
99
99
  border-radius: var(--gap-xs);
100
100
  height: min-content
101
- } .steps__text_1ohj2.steps__interactive_1ohj2:not(.steps__disabled_1ohj2):hover {
101
+ } .steps__text_x2lwq.steps__interactive_x2lwq:not(.steps__disabled_x2lwq):hover {
102
102
  background: var(--color-light-transparent-default-hover);
103
- } .steps__text_1ohj2.steps__interactive_1ohj2:not(.steps__disabled_1ohj2):active {
103
+ } .steps__text_x2lwq.steps__interactive_x2lwq:not(.steps__disabled_x2lwq):active {
104
104
  background: var(--color-light-transparent-default-press);
105
- } .steps__focused_1ohj2 {
105
+ } .steps__focused_x2lwq {
106
106
  outline: var(--gap-3xs) solid var(--focus-color);
107
107
  outline-offset: var(--gap-3xs);
108
- } .steps__selected_1ohj2 .steps__text_1ohj2 {
108
+ } .steps__selected_x2lwq .steps__text_x2lwq {
109
109
  color: var(--color-light-text-primary);
110
- } .steps__selected_1ohj2 .steps__option_1ohj2 {
110
+ } .steps__selected_x2lwq .steps__option_x2lwq {
111
111
  color: var(--color-light-text-primary-inverted);
112
112
  background: var(--color-light-neutral-translucent-1300);
113
- } .steps__checkbox_1ohj2 {
113
+ } .steps__checkbox_x2lwq {
114
114
  display: flex;
115
115
  justify-content: center;
116
116
  align-items: center;
@@ -118,20 +118,20 @@
118
118
  width: 20px;
119
119
  height: 20px;
120
120
  border: 2px solid var(--color-light-neutral-translucent-300);
121
- } .steps__dot_1ohj2 {
121
+ } .steps__dot_x2lwq {
122
122
  width: 10px;
123
123
  height: 10px;
124
124
  border-radius: var(--border-radius-circle);
125
125
  background: var(--color-light-neutral-translucent-300);
126
- } .steps__selected_1ohj2 .steps__checkbox_1ohj2 {
126
+ } .steps__selected_x2lwq .steps__checkbox_x2lwq {
127
127
  border: 2px solid var(--color-light-neutral-translucent-1300)
128
- } .steps__selected_1ohj2 .steps__checkbox_1ohj2 .steps__dot_1ohj2 {
128
+ } .steps__selected_x2lwq .steps__checkbox_x2lwq .steps__dot_x2lwq {
129
129
  background: var(--color-light-neutral-translucent-1300);
130
- } .steps__option_1ohj2:not(.steps__error_1ohj2).steps__unordered_1ohj2 {
130
+ } .steps__option_x2lwq:not(.steps__error_x2lwq).steps__unordered_x2lwq {
131
131
  background: unset;
132
- } .steps__completedIndicator_1ohj2 > [class*='positive'] {
132
+ } .steps__completedIndicator_x2lwq > [class*='positive'] {
133
133
  color: var(--steps-option-svg-color);
134
134
  background-color: var(--steps-option-svg-color);
135
- } .steps__fullWidth_1ohj2 {
135
+ } .steps__fullWidth_x2lwq {
136
136
  width: 100%;
137
137
  }
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import cn from 'classnames';
3
3
  import { Badge } from '@alfalab/core-components-badge/modern';
4
4
 
5
- const styles = {"component":"steps__component_1akb5"};
5
+ const styles = {"component":"steps__component_j5e09"};
6
6
  require('./index.css')
7
7
 
8
8
  const StepIndicator = ({ content, iconColor, className }) => (React.createElement(Badge, { size: 'l', view: 'icon', iconColor: iconColor, className: cn(styles.component, className), content: content }));
@@ -1,4 +1,4 @@
1
- /* hash: 1w3kq */
2
- .steps__component_1akb5 {
1
+ /* hash: wog03 */
2
+ .steps__component_j5e09 {
3
3
  padding: 0;
4
4
  }
package/modern/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: 4o5j9 */
1
+ /* hash: 15d60 */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
4
4
  } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -14,11 +14,11 @@
14
14
  } :root {
15
15
  } :root {
16
16
  } :root {
17
- } .steps__component_1n1l2 {
17
+ } .steps__component_7b4f4 {
18
18
  display: flex;
19
19
  align-items: center;
20
20
  flex-direction: row
21
- } .steps__component_1n1l2.steps__vertical_1n1l2 {
21
+ } .steps__component_7b4f4.steps__vertical_7b4f4 {
22
22
  flex-direction: column;
23
23
  align-items: flex-start;
24
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-steps",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
package/src/Component.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React, { ReactNode, useEffect, useState } from 'react';
1
+ import React, { ReactNode, useState } from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
4
  import { Step } from './components/step';
@@ -137,18 +137,15 @@ export const Steps: React.FC<StepsProps> = ({
137
137
  onChange,
138
138
  dataTestId,
139
139
  }) => {
140
- const [activeStep, setActiveStep] = useState(activeStepProp || defaultActiveStep);
140
+ const uncontrolled = activeStepProp === undefined;
141
+ const [activeStep, setActiveStep] = useState(defaultActiveStep);
141
142
 
142
143
  const stepsLength = React.Children.count(children);
143
144
 
144
- useEffect(() => {
145
- if (activeStepProp) {
146
- setActiveStep(activeStepProp);
147
- }
148
- }, [activeStepProp]);
149
-
150
145
  const handleStepClick = (stepNumber: number) => {
151
- setActiveStep(stepNumber);
146
+ if (uncontrolled) {
147
+ setActiveStep(stepNumber);
148
+ }
152
149
 
153
150
  if (onChange) {
154
151
  onChange(stepNumber);
@@ -157,6 +154,8 @@ export const Steps: React.FC<StepsProps> = ({
157
154
 
158
155
  if (!stepsLength) return null;
159
156
 
157
+ const visibleActiveStep = uncontrolled ? activeStep : activeStepProp;
158
+
160
159
  return (
161
160
  <div
162
161
  className={cn(className, styles.component, {
@@ -166,8 +165,8 @@ export const Steps: React.FC<StepsProps> = ({
166
165
  >
167
166
  {React.Children.map(children, (step, index) => {
168
167
  const stepNumber = index + 1;
169
- const isSelected = stepNumber === activeStep;
170
- const isStepCompleted = isMarkCompletedSteps && stepNumber < activeStep;
168
+ const isSelected = stepNumber === visibleActiveStep;
169
+ const isStepCompleted = isMarkCompletedSteps && stepNumber < visibleActiveStep;
171
170
  const disabled = checkIsStepDisabled ? checkIsStepDisabled(stepNumber) : false;
172
171
  const isPositive = checkIsStepPositive ? checkIsStepPositive(stepNumber) : false;
173
172
  const isError = checkIsStepError ? checkIsStepError(stepNumber) : false;