@@ -20,7 +20,8 @@ const StepInfo: (props: IStepInfoProps) => JSX.Element = ({
20
20
styles,
21
21
nodeRef,
22
22
prevConnectorClassName,
23
- nextConnectorClassName
23
+ nextConnectorClassName,
24
+ steps
24
25
} : IStepInfoProps ) => (
25
26
< div
26
27
id = "stepper-step"
@@ -33,29 +34,35 @@ const StepInfo: (props: IStepInfoProps) => JSX.Element = ({
33
34
}
34
35
>
35
36
{ ! isInlineLabelsAndSteps && (
36
- < div className = { getLabelStyle ( orientation , labelPosition ) } >
37
+ < div className = { getLabelStyle ( orientation , labelPosition ) } onClick = { ( ) : void => onStepClick && onStepClick ( step , index ) } >
37
38
< div
38
39
className = "label"
39
40
id = { `step-label-${ index } ` }
40
41
style = { {
41
42
...( getStyles ( styles , Elements . LabelTitle , step , index ) || { } ) ,
42
43
...( index === currentStepIndex &&
43
- ( getStyles ( styles , Elements . ActiveLabelTitle , step , index ) || { } ) )
44
+ ( getStyles ( styles , Elements . ActiveLabelTitle , step , index ) ||
45
+ { } ) )
44
46
} }
45
47
>
46
48
{ step . stepLabel }
47
49
</ div >
48
- { ( showDescriptionsForAllSteps || index === currentStepIndex ) &&
49
- orientation === ORIENTATION . HORIZONTAL &&
50
+ { step . stepDescription && ( showDescriptionsForAllSteps || index === currentStepIndex ) &&
51
+ orientation !== ORIENTATION . VERTICAL &&
50
52
labelPosition === LABEL_POSITION . TOP && (
51
53
< div
52
54
className = "description"
53
55
id = { `step-horizontal-top-description-${ index } ` }
54
56
style = { {
55
57
...( currentStepIndex === index
56
- ? getStyles ( styles , Elements . ActiveLabelDescription , step , index ) ||
57
- { }
58
- : getStyles ( styles , Elements . LabelDescription , step , index ) || { } )
58
+ ? getStyles (
59
+ styles ,
60
+ Elements . ActiveLabelDescription ,
61
+ step ,
62
+ index
63
+ ) || { }
64
+ : getStyles ( styles , Elements . LabelDescription , step , index ) ||
65
+ { } )
59
66
} }
60
67
>
61
68
{ step . stepDescription }
@@ -67,9 +74,10 @@ const StepInfo: (props: IStepInfoProps) => JSX.Element = ({
67
74
< div
68
75
className = { prevConnectorClassName }
69
76
style = { {
70
- ...( currentStepIndex >= index
77
+ ...( steps [ index - 1 ] ?. completed
71
78
? getStyles ( styles , Elements . LineSeparator , step , index ) || { }
72
- : getStyles ( styles , Elements . InactiveLineSeparator , step , index ) || { } )
79
+ : getStyles ( styles , Elements . InactiveLineSeparator , step , index ) ||
80
+ { } )
73
81
} }
74
82
/>
75
83
< div
@@ -83,9 +91,7 @@ const StepInfo: (props: IStepInfoProps) => JSX.Element = ({
83
91
step = { step }
84
92
index = { index }
85
93
currentStepIndex = { currentStepIndex }
86
- handleStepClick = { ( ) : void =>
87
- onStepClick && onStepClick ( step , index )
88
- }
94
+ handleStepClick = { ( ) : void => onStepClick && onStepClick ( step , index ) }
89
95
showCursor = { ! ! onStepClick }
90
96
renderNode = { renderNode }
91
97
getStyles = { ( element : Elements ) : object =>
@@ -101,22 +107,28 @@ const StepInfo: (props: IStepInfoProps) => JSX.Element = ({
101
107
: ""
102
108
} `}
103
109
>
104
- < div className = { `label ${ isVertical && "verticalStepperInlineLabel" } ` } id = { `step-inline-label-${ index } ` }
110
+ < div
111
+ className = { `label ${ isVertical && "verticalStepperInlineLabel" } ` }
112
+ id = { `step-inline-label-${ index } ` }
105
113
style = { {
106
114
...( getStyles ( styles , Elements . LabelTitle , step , index ) || { } ) ,
107
115
...( index === currentStepIndex &&
108
- ( getStyles ( styles , Elements . ActiveLabelTitle , step , index ) || { } ) )
109
- } } >
116
+ ( getStyles ( styles , Elements . ActiveLabelTitle , step , index ) ||
117
+ { } ) )
118
+ } }
119
+ onClick = { ( ) : void => onStepClick && onStepClick ( step , index ) }
120
+ >
110
121
{ step . stepLabel }
111
122
</ div >
112
123
</ div >
113
124
) }
114
125
< div
115
126
className = { nextConnectorClassName }
116
127
style = { {
117
- ...( currentStepIndex > index
128
+ ...( step . completed
118
129
? getStyles ( styles , Elements . LineSeparator , step , index ) || { }
119
- : getStyles ( styles , Elements . InactiveLineSeparator , step , index ) || { } )
130
+ : getStyles ( styles , Elements . InactiveLineSeparator , step , index ) ||
131
+ { } )
120
132
} }
121
133
/>
122
134
</ div >
0 commit comments