/* eslint-disable @typescript-eslint/no-explicit-any */ // components/SelectField.tsx import React from "react"; import { useField, useFormikContext } from "formik"; import Select from "react-select"; interface OptionType { id: string | number; label: string; } interface Props { label: string; name: string; placeholder?: string; options: OptionType[]; disabled?: boolean; required?: boolean; } const SelectField: React.FC = ({ label, name, placeholder, options, disabled = false, required = false }) => { const [field, meta] = useField(name); const { setFieldValue, setFieldTouched } = useFormikContext(); const isError = meta.touched && meta.error; const reactSelectOptions = options.map((opt) => ({ value: opt.id, label: opt.label, })); const selectedOption = reactSelectOptions.find((opt) => opt.value == (field?.value || field)) || null; return (