@@ -20,7 +20,8 @@ const StepInfo: (props: IStepInfoProps) => JSX.Element = ({
2020 styles,
2121 nodeRef,
2222 prevConnectorClassName,
23- nextConnectorClassName
23+ nextConnectorClassName,
24+ steps
2425} : IStepInfoProps ) => (
2526 < div
2627 id = "stepper-step"
@@ -33,29 +34,35 @@ const StepInfo: (props: IStepInfoProps) => JSX.Element = ({
3334 }
3435 >
3536 { ! isInlineLabelsAndSteps && (
36- < div className = { getLabelStyle ( orientation , labelPosition ) } >
37+ < div className = { getLabelStyle ( orientation , labelPosition ) } onClick = { ( ) : void => onStepClick && onStepClick ( step , index ) } >
3738 < div
3839 className = "label"
3940 id = { `step-label-${ index } ` }
4041 style = { {
4142 ...( getStyles ( styles , Elements . LabelTitle , step , index ) || { } ) ,
4243 ...( index === currentStepIndex &&
43- ( getStyles ( styles , Elements . ActiveLabelTitle , step , index ) || { } ) )
44+ ( getStyles ( styles , Elements . ActiveLabelTitle , step , index ) ||
45+ { } ) )
4446 } }
4547 >
4648 { step . stepLabel }
4749 </ div >
48- { ( showDescriptionsForAllSteps || index === currentStepIndex ) &&
49- orientation === ORIENTATION . HORIZONTAL &&
50+ { step . stepDescription && ( showDescriptionsForAllSteps || index === currentStepIndex ) &&
51+ orientation !== ORIENTATION . VERTICAL &&
5052 labelPosition === LABEL_POSITION . TOP && (
5153 < div
5254 className = "description"
5355 id = { `step-horizontal-top-description-${ index } ` }
5456 style = { {
5557 ...( 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+ { } )
5966 } }
6067 >
6168 { step . stepDescription }
@@ -67,9 +74,10 @@ const StepInfo: (props: IStepInfoProps) => JSX.Element = ({
6774 < div
6875 className = { prevConnectorClassName }
6976 style = { {
70- ...( currentStepIndex >= index
77+ ...( steps [ index - 1 ] ?. completed
7178 ? getStyles ( styles , Elements . LineSeparator , step , index ) || { }
72- : getStyles ( styles , Elements . InactiveLineSeparator , step , index ) || { } )
79+ : getStyles ( styles , Elements . InactiveLineSeparator , step , index ) ||
80+ { } )
7381 } }
7482 />
7583 < div
@@ -83,9 +91,7 @@ const StepInfo: (props: IStepInfoProps) => JSX.Element = ({
8391 step = { step }
8492 index = { index }
8593 currentStepIndex = { currentStepIndex }
86- handleStepClick = { ( ) : void =>
87- onStepClick && onStepClick ( step , index )
88- }
94+ handleStepClick = { ( ) : void => onStepClick && onStepClick ( step , index ) }
8995 showCursor = { ! ! onStepClick }
9096 renderNode = { renderNode }
9197 getStyles = { ( element : Elements ) : object =>
@@ -101,22 +107,28 @@ const StepInfo: (props: IStepInfoProps) => JSX.Element = ({
101107 : ""
102108 } `}
103109 >
104- < div className = { `label ${ isVertical && "verticalStepperInlineLabel" } ` } id = { `step-inline-label-${ index } ` }
110+ < div
111+ className = { `label ${ isVertical && "verticalStepperInlineLabel" } ` }
112+ id = { `step-inline-label-${ index } ` }
105113 style = { {
106114 ...( getStyles ( styles , Elements . LabelTitle , step , index ) || { } ) ,
107115 ...( 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+ >
110121 { step . stepLabel }
111122 </ div >
112123 </ div >
113124 ) }
114125 < div
115126 className = { nextConnectorClassName }
116127 style = { {
117- ...( currentStepIndex > index
128+ ...( step . completed
118129 ? getStyles ( styles , Elements . LineSeparator , step , index ) || { }
119- : getStyles ( styles , Elements . InactiveLineSeparator , step , index ) || { } )
130+ : getStyles ( styles , Elements . InactiveLineSeparator , step , index ) ||
131+ { } )
120132 } }
121133 />
122134 </ div >
0 commit comments