"use client"; import { Checkbox, Label, ScrollArea } from "../../../../shadcnui"; import { SectionHeader } from "../../../../components/typography"; import { FeatureInterface } from "../../data"; type FormFeaturesProps = { form: any; name?: string; features: FeatureInterface[]; featureField?: string; }; export function FormFeatures({ form, name, features, featureField = "featureIds" }: FormFeaturesProps) { const selectedFeatures: string[] = form.watch(featureField); const toggleFeature = (feature: FeatureInterface, checked: boolean) => { let newFeatureIds = [...selectedFeatures]; if (checked) { if (!newFeatureIds.includes(feature.id)) { newFeatureIds.push(feature.id); } } else { newFeatureIds = newFeatureIds.filter((id) => id !== feature.id); } form.setValue(featureField, newFeatureIds); }; const isFeatureChecked = (feature: FeatureInterface) => selectedFeatures.includes(feature.id); return (