@@ -33,6 +33,7 @@ type AutoFormFieldWrapperProps = {
3333 property : BlockProperty ;
3434 hideDescription ?: boolean ;
3535 placeBeforeLabelText ?: boolean ;
36+ labelPlacement ?: 'top' | 'left' ;
3637 disabled : boolean ;
3738 field : ControllerRenderProps ;
3839 inputName : string ;
@@ -129,8 +130,31 @@ const FormLabelButton = ({
129130 return null ;
130131} ;
131132
133+ type LabelContentProps = {
134+ property : BlockProperty ;
135+ placeBeforeLabelText : boolean ;
136+ dynamicViewToggled : boolean ;
137+ children : React . ReactNode ;
138+ } ;
139+
140+ const LabelContent = ( {
141+ property,
142+ placeBeforeLabelText,
143+ dynamicViewToggled,
144+ children,
145+ } : LabelContentProps ) => {
146+ return (
147+ < FormLabel className = "flex items-center gap-1" >
148+ { placeBeforeLabelText && ! dynamicViewToggled && children }
149+ < span > { t ( property . displayName ) } </ span >
150+ { property . required && < span className = "text-destructive" > *</ span > }
151+ </ FormLabel >
152+ ) ;
153+ } ;
154+
132155const AutoFormFieldWrapper = ( {
133156 placeBeforeLabelText = false ,
157+ labelPlacement = 'top' ,
134158 children,
135159 hideDescription,
136160 allowDynamicValues,
@@ -238,11 +262,19 @@ const AutoFormFieldWrapper = ({
238262
239263 return (
240264 < FormItem className = "flex flex-col gap-1" >
241- < FormLabel className = "flex items-center gap-1" >
242- { placeBeforeLabelText && ! dynamicViewToggled && children }
243- < span > { t ( property . displayName ) } </ span >
244- { property . required && < span className = "text-destructive" > *</ span > }
245- < span className = "grow" > </ span >
265+ < div className = "flex items-center justify-between" >
266+ < div >
267+ { labelPlacement === 'top' && (
268+ < LabelContent
269+ property = { property }
270+ placeBeforeLabelText = { placeBeforeLabelText }
271+ dynamicViewToggled = { dynamicViewToggled }
272+ >
273+ { children }
274+ </ LabelContent >
275+ ) }
276+ </ div >
277+
246278 < FormLabelButton
247279 property = { property }
248280 allowDynamicValues = { allowDynamicValues }
@@ -251,16 +283,34 @@ const AutoFormFieldWrapper = ({
251283 handleDynamicValueChange = { handleChange }
252284 onGenerateWithAIClick = { onGenerateWithAIClick }
253285 />
254- </ FormLabel >
286+ </ div >
287+
288+ < div className = "flex items-center gap-6" >
289+ { labelPlacement === 'left' && (
290+ < div className = "shrink-0" >
291+ < LabelContent
292+ property = { property }
293+ placeBeforeLabelText = { placeBeforeLabelText }
294+ dynamicViewToggled = { dynamicViewToggled }
295+ >
296+ { children }
297+ </ LabelContent >
298+ </ div >
299+ ) }
300+ < div className = "flex-1 min-w-0 overflow-visible" >
301+ { dynamicViewToggled && (
302+ < TextInputWithMentions
303+ disabled = { disabled }
304+ onChange = { field . onChange }
305+ initialValue = { field . value ?? null }
306+ > </ TextInputWithMentions >
307+ ) }
308+ { ! placeBeforeLabelText && ! dynamicViewToggled && (
309+ < div > { children } </ div >
310+ ) }
311+ </ div >
312+ </ div >
255313
256- { dynamicViewToggled && (
257- < TextInputWithMentions
258- disabled = { disabled }
259- onChange = { field . onChange }
260- initialValue = { field . value ?? null }
261- > </ TextInputWithMentions >
262- ) }
263- { ! placeBeforeLabelText && ! dynamicViewToggled && < div > { children } </ div > }
264314 { property . description && ! hideDescription && (
265315 < ReadMoreDescription text = { t ( property . description ) } />
266316 ) }
0 commit comments