@@ -59,7 +59,7 @@ var Wizard = function Wizard(_ref) {
5959 var children = _ref . children ,
6060 className = _ref . className ,
6161 confirmClose = _ref . confirmClose ,
62- FormState = _ref . FormState ,
62+ formState = _ref . formState ,
6363 isWizardOpen = _ref . isWizardOpen ,
6464 onWizardResolve = _ref . onWizardResolve ,
6565 onWizardSubmit = _ref . onWizardSubmit ,
@@ -79,11 +79,6 @@ var Wizard = function Wizard(_ref) {
7979 var totalSteps = ( 0 , _react . useMemo ) ( function ( ) {
8080 return _react . default . Children . count ( children ) - 1 || 0 ;
8181 } , [ children ] ) ;
82- var hasSteps = ( 0 , _react . useMemo ) ( function ( ) {
83- return stepsConfig . some ( function ( step ) {
84- return step . id ;
85- } ) ;
86- } , [ stepsConfig ] ) ;
8782 var isLastStep = ( 0 , _react . useMemo ) ( function ( ) {
8883 return activeStepNumber === totalSteps ;
8984 } , [ activeStepNumber , totalSteps ] ) ;
@@ -95,7 +90,7 @@ var Wizard = function Wizard(_ref) {
9590 } ;
9691 } ) ) || [ ] ;
9792 } , [ stepsConfig ] ) ;
98- var wizardClasses = ( 0 , _classnames . default ) ( 'wizard-form' , className , hasSteps && 'wizard-form__with-steps' ) ;
93+ var wizardClasses = ( 0 , _classnames . default ) ( 'wizard-form' , className ) ;
9994
10095 var goToNextStep = function goToNextStep ( ) {
10196 setActiveStepNumber ( function ( prevStep ) {
@@ -114,7 +109,7 @@ var Wizard = function Wizard(_ref) {
114109 } ;
115110
116111 var handleOnClose = function handleOnClose ( ) {
117- if ( confirmClose && FormState && FormState . dirty ) {
112+ if ( confirmClose && formState && formState . dirty ) {
118113 ( 0 , _common . openPopUp ) ( _ConfirmDialog . default , {
119114 cancelButton : {
120115 label : 'Cancel' ,
@@ -134,52 +129,38 @@ var Wizard = function Wizard(_ref) {
134129 } ;
135130
136131 var handleSubmit = function handleSubmit ( ) {
137- FormState . handleSubmit ( ) ;
132+ formState . handleSubmit ( ) ;
138133
139- if ( FormState . valid ) {
134+ if ( formState . valid ) {
140135 if ( isLastStep ) {
141- onWizardSubmit ( FormState . values ) ;
136+ onWizardSubmit ( formState . values ) ;
142137 } else {
143138 goToNextStep ( ) ;
144139 }
145140 }
146141 } ;
147142
148143 var getDefaultActions = function getDefaultActions ( ) {
149- if ( hasSteps ) {
150- return [ /*#__PURE__*/ ( 0 , _jsxRuntime . jsx ) ( _Button . default , {
151- onClick : goToPreviousStep ,
152- disabled : activeStepNumber === 0 ,
153- label : "Back" ,
154- type : "button"
155- } ) , /*#__PURE__*/ ( 0 , _jsxRuntime . jsx ) ( _Button . default , {
156- onClick : handleSubmit ,
157- disabled : FormState . submitting || FormState . invalid && FormState . submitFailed ,
158- label : isLastStep ? submitButtonLabel : 'Next' ,
159- type : "button" ,
160- variant : _constants . SECONDARY_BUTTON
161- } ) ] ;
162- } else {
163- return [ /*#__PURE__*/ ( 0 , _jsxRuntime . jsx ) ( _Button . default , {
164- onClick : handleOnClose ,
165- label : "Cancel" ,
166- type : "button"
167- } ) , /*#__PURE__*/ ( 0 , _jsxRuntime . jsx ) ( _Button . default , {
168- onClick : handleSubmit ,
169- disabled : FormState . submitting || FormState . invalid && FormState . submitFailed ,
170- label : submitButtonLabel ,
171- type : "button" ,
172- variant : _constants . SECONDARY_BUTTON
173- } ) ] ;
174- }
144+ return [ /*#__PURE__*/ ( 0 , _jsxRuntime . jsx ) ( _Button . default , {
145+ onClick : goToPreviousStep ,
146+ disabled : activeStepNumber === 0 ,
147+ label : "Back" ,
148+ type : "button"
149+ } ) , /*#__PURE__*/ ( 0 , _jsxRuntime . jsx ) ( _Button . default , {
150+ onClick : handleSubmit ,
151+ disabled : formState . submitting || formState . invalid && formState . submitFailed ,
152+ label : isLastStep ? submitButtonLabel : 'Next' ,
153+ type : "button" ,
154+ variant : _constants . SECONDARY_BUTTON
155+ } ) ] ;
175156 } ;
176157
177158 var renderModalActions = function renderModalActions ( ) {
178159 var _stepsConfig$activeSt ;
179160
180161 if ( ( _stepsConfig$activeSt = stepsConfig [ activeStepNumber ] ) !== null && _stepsConfig$activeSt !== void 0 && _stepsConfig$activeSt . getActions ) {
181162 return stepsConfig [ activeStepNumber ] . getActions ( {
182- FormState : FormState ,
163+ formState : formState ,
183164 goToNextStep : goToNextStep ,
184165 goToPreviousStep : goToPreviousStep ,
185166 handleOnClose : handleOnClose ,
@@ -199,7 +180,7 @@ var Wizard = function Wizard(_ref) {
199180 show : isWizardOpen ,
200181 size : size ,
201182 title : title ,
202- children : [ hasSteps && /*#__PURE__*/ ( 0 , _jsxRuntime . jsx ) ( _WizardSteps . default , {
183+ children : [ /*#__PURE__*/ ( 0 , _jsxRuntime . jsx ) ( _WizardSteps . default , {
203184 activeStepNumber : activeStepNumber ,
204185 jumpToStep : jumpToStep ,
205186 steps : stepsMenu
@@ -220,10 +201,10 @@ Wizard.defaultProps = {
220201Wizard . propsTypes = {
221202 className : _propTypes . default . string ,
222203 confirmClose : _propTypes . default . bool ,
223- FormState : _propTypes . default . object . isRequired ,
224- isOpen : _propTypes . default . bool . isRequired ,
225- onResolve : _propTypes . default . func . isRequired ,
226- onSubmit : _propTypes . default . func . isRequired ,
204+ formState : _propTypes . default . object . isRequired ,
205+ isWizardOpen : _propTypes . default . bool . isRequired ,
206+ onWizardResolve : _propTypes . default . func . isRequired ,
207+ onWizardSubmit : _propTypes . default . func . isRequired ,
227208 size : _types . MODAL_SIZES ,
228209 title : _propTypes . default . string . isRequired ,
229210 stepsConfig : _types . WIZARD_STEPS_CONFIG ,
0 commit comments