@@ -16,20 +16,21 @@ export function FormSwitch(component: FormComponentModel, form: UseFormReturn<Fi
1616 const asCardClasses = generateTWClassesForAllViewports ( component , "asCard" ) ;
1717
1818 return (
19- < div
19+ < FormLabel
2020 key = { component . id }
21- className = { cn ( asCardClasses , "flex justify-between items-center space-x-2 w-full" ) }
21+ className = { cn ( asCardClasses , "flex justify-between items-center space-x-2 w-full has-[[data-state=checked]]:border-primary" ) }
22+ htmlFor = { component . getField ( "attributes.id" ) }
2223 >
2324 < div className = "grid gap-1.5 leading-none" >
24- < FormLabel htmlFor = { component . getField ( "attributes.id" ) } >
25+ < FormLabel >
2526 { component . getField ( "label" ) }
2627 </ FormLabel >
2728 < p className = "text-sm text-muted-foreground" >
2829 { component . getField ( "label_description" ) }
2930 </ p >
3031 </ div >
3132 < Switch id = { component . getField ( "attributes.id" ) } { ...field } checked = { field . value } onCheckedChange = { field . onChange } />
32- </ div >
33+ </ FormLabel >
3334 ) ;
3435}
3536
@@ -42,20 +43,21 @@ export function getReactCode(component: FormComponentModel): ReactCode {
4243 const asCardClasses = generateTWClassesForAllViewports ( component , "asCard" ) ;
4344 return {
4445 code : `
45- <div
46+ <FormLabel
4647 key="${ component . id } "
47- className="${ escapeHtml ( cn ( asCardClasses , "flex justify-between items-center space-x-2 w-full" ) ) } "
48+ className="${ escapeHtml ( cn ( asCardClasses , "w-full flex justify-between items-center space-x-2 has-[[data-state=checked]]:border-primary" ) ) } "
49+ htmlFor="${ escapeHtml ( component . getField ( "attributes.id" ) ) } "
4850 >
4951 <div className="grid gap-1.5 leading-none">
50- <FormLabel htmlFor=" ${ escapeHtml ( component . getField ( "attributes.id" ) ) } " >
52+ <FormLabel>
5153 ${ escapeHtml ( component . getField ( "label" ) ) }
5254 </FormLabel>
5355 <p className="text-sm text-muted-foreground">
5456 ${ escapeHtml ( component . getField ( "label_description" ) ) }
5557 </p>
5658 </div>
5759 <Switch id="${ escapeHtml ( component . getField ( "attributes.id" ) ) } " {...field} checked={field.value} onCheckedChange={field.onChange} />
58- </div >
60+ </FormLabel >
5961 ` ,
6062 dependencies : {
6163 "@/components/ui/switch" : [ "Switch" ] ,
@@ -69,7 +71,7 @@ export const SwitchDesignProperties: DesignPropertiesViews = {
6971 base : null ,
7072 grid : < GridGroup /> ,
7173 html : < HtmlGroup /> ,
72- label : < LabelGroup whitelist = { [ "label" , "label_description" , "labelPosition" ] } /> ,
74+ label : < LabelGroup whitelist = { [ "label" , "label_description" ] } /> ,
7375 input : < InputGroup whitelist = { [ "description" , "asCard" , "checked" ] } /> ,
7476 options : null ,
7577 button : null ,
0 commit comments