import { Badge, DropdownButton, DropdownMenu, Label } from '#components'; import { FieldGroup } from '../FieldGroup/FieldGroup.tsx'; import type { SetFieldProps } from './SetField.tsx'; export type SetFieldSelectProps = SetFieldProps & { onCheckedChange: (option: T, isChecked: boolean) => void; }; export const SetFieldSelect = ({ description, disabled, error, label, name, onCheckedChange, options, readOnly, value }: SetFieldSelectProps) => { return value ? ( {value.size ? (
{Array.from(value).map((option) => ( {options[option]} ))}
) : null}
{Object.keys(options).map((option) => { const checked = value.has(option as T); return ( { event.preventDefault(); onCheckedChange(option as T, value.has(option as T)); }} > {options[option as T]} ); })}
) : null; };