@@ -104,7 +104,7 @@ FormControls.defaultProps = {
104104 buttonOrder : [ 'submit' , 'reset' , 'cancel' ]
105105} ;
106106
107- const formTemplate = ( {
107+ const FormTemplate = ( {
108108 FormWrapper,
109109 Title,
110110 Description,
@@ -113,17 +113,19 @@ const formTemplate = ({
113113 formWrapperProps,
114114 showFormControls = true ,
115115 disableSubmit = [ ] ,
116- onStateUpdate,
117- ...options
118- } ) => ( { schema : { title, description, label } , formFields } ) => {
116+ ...rest
117+ } ) => {
118+ const {
119+ schema : { title, description, label } ,
120+ formFields
121+ } = rest ;
119122 const { onReset, onCancel, getState, handleSubmit } = useFormApi ( ) ;
120123
121124 return (
122125 < FormWrapper onSubmit = { handleSubmit } { ...formWrapperProps } >
123126 { ( title || label ) && < Title > { title || label } </ Title > }
124127 { description && < Description > { description } </ Description > }
125128 { formFields }
126- { onStateUpdate && < FormSpy onChange = { onStateUpdate } /> }
127129 { showFormControls && (
128130 < FormSpy >
129131 { ( formSpyProps ) => (
@@ -135,7 +137,7 @@ const formTemplate = ({
135137 onCancel = { onCancel }
136138 disableSubmit = { isDisabled ( disableSubmit , getState ) }
137139 formSpyProps = { formSpyProps }
138- { ...options }
140+ { ...rest }
139141 />
140142 ) }
141143 </ FormSpy >
@@ -144,4 +146,20 @@ const formTemplate = ({
144146 ) ;
145147} ;
146148
147- export default formTemplate ;
149+ FormTemplate . propTypes = {
150+ FormWrapper : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . func , PropTypes . element ] ) . isRequired ,
151+ Title : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . func , PropTypes . element ] ) . isRequired ,
152+ Description : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . func , PropTypes . element ] ) . isRequired ,
153+ Button : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . func , PropTypes . element ] ) . isRequired ,
154+ ButtonGroup : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . func , PropTypes . element ] ) . isRequired ,
155+ formWrapperProps : PropTypes . object ,
156+ showFormControls : PropTypes . bool ,
157+ disableSubmit : PropTypes . arrayOf ( PropTypes . string )
158+ } ;
159+
160+ FormTemplate . defaultProps = {
161+ showFormControls : true ,
162+ disableSubmit : [ ]
163+ } ;
164+
165+ export default FormTemplate ;
0 commit comments