/* eslint-disable @typescript-eslint/no-explicit-any */ import React, { useEffect, useState } from "react"; import Select from "react-select"; import CreatableSelect from "react-select/creatable"; // Add CreatableSelect import // Define the Option type interface Option { id: string; name: string; code?: string | number; } interface SelectFieldProps { options: Option[]; value: Option | null; onChange: (option: Option | null) => void; errors?: string; placeholder?: string; isMulti?: boolean; isClearable?: boolean; isSearchable?: boolean; onInputChange?: (inputValue: string) => void; className?: string; width?: string; icon?: React.ReactNode; isCreatable?: boolean; stringAdd?: boolean; name?: string; title?: string; /** * Determines how the select field is used in different contexts. * * - `0`: Default usage (general dropdown) * - `1`: Used for adding address section */ usageType?: number; page?: string; label?: string; } const SelectField: React.FC = ({ options, value, onChange, errors, placeholder = "Select...", isMulti = false, isClearable = true, isSearchable = true, onInputChange, className, width = "", icon, isCreatable = false, stringAdd = false, usageType = 0, title = "", page = "", label = "", // name = "" }) => { const [inputValue, setInputValue] = useState(""); const [localOptions, setLocalOptions] = useState(options); const [selectedValues, setSelectedValues] = useState