@@ -98,17 +98,6 @@ export const makeAutoForm = <Elements extends ShadcnElements>({
98
98
< AutoFormInner
99
99
key = { componentKey }
100
100
{ ...( props as AutoFormProps < GivenOptions , SchemaT , ActionFunc > & Omit < Partial < FormProps > , "action" > & { findBy : any } ) }
101
- elements = { {
102
- Form,
103
- Input,
104
- Button,
105
- Alert,
106
- Skeleton,
107
- AlertTitle,
108
- AlertDescription,
109
- ShadcnAutoInput : AutoInput ,
110
- ShadcnAutoSubmit : AutoSubmit ,
111
- } }
112
101
/>
113
102
</ AutoFormFieldsFromChildComponentsProvider >
114
103
) ;
@@ -118,18 +107,13 @@ export const makeAutoForm = <Elements extends ShadcnElements>({
118
107
GivenOptions extends OptionsType ,
119
108
SchemaT ,
120
109
ActionFunc extends ActionFunction < GivenOptions , any , any , SchemaT , any >
121
- > (
122
- props : AutoFormProps < GivenOptions , SchemaT , ActionFunc > & {
123
- elements : ShadcnElements ;
124
- } & ComponentProps < any >
125
- ) {
110
+ > ( props : AutoFormProps < GivenOptions , SchemaT , ActionFunc > & ComponentProps < typeof Form > ) {
126
111
const {
127
112
record : _record ,
128
113
action,
129
114
findBy,
130
115
...rest
131
116
} = props as AutoFormProps < GivenOptions , SchemaT , ActionFunc > & Omit < Partial < FormProps > , "action" > & { findBy : any } ;
132
- const { Form, Skeleton, ShadcnAutoInput, ShadcnAutoSubmit } = props . elements ;
133
117
134
118
const {
135
119
metadata,
@@ -144,7 +128,7 @@ export const makeAutoForm = <Elements extends ShadcnElements>({
144
128
isLoading,
145
129
} = useAutoForm ( props ) ;
146
130
147
- const formTitle = props . title === undefined ? humanizeCamelCase ( action . operationName ) : props . title ;
131
+ const formTitle = "title" in props && props . title !== undefined ? props . title : humanizeCamelCase ( action . operationName ) ;
148
132
149
133
if ( props . successContent && isSubmitSuccessful ) {
150
134
return props . successContent ;
@@ -182,9 +166,9 @@ export const makeAutoForm = <Elements extends ShadcnElements>({
182
166
{ ! metadataError && (
183
167
< >
184
168
{ fields . map ( ( { metadata } ) => (
185
- < ShadcnAutoInput field = { metadata . apiIdentifier } key = { metadata . apiIdentifier } />
169
+ < AutoInput field = { metadata . apiIdentifier } key = { metadata . apiIdentifier } />
186
170
) ) }
187
- < ShadcnAutoSubmit > { props . submitLabel ?? "Submit" } </ ShadcnAutoSubmit >
171
+ < AutoSubmit > { "submitLabel" in props && props . submitLabel ? props . submitLabel : "Submit" } </ AutoSubmit >
188
172
</ >
189
173
) }
190
174
</ >
0 commit comments