/* eslint-disable @typescript-eslint/no-explicit-any */ 'use client'; import { useState } from 'react'; import { Control, Controller, FieldError } from 'react-hook-form'; import { Popover, PopoverContent, PopoverTrigger, } from '@/components/ui/popover'; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from '@/components/ui/command'; import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { Check, ChevronsUpDown } from 'lucide-react'; import { cn } from '@/lib/utils'; import countryList from 'react-select-country-list'; type CountrySelectProps = { name: string; label: string; control: Control; error?: FieldError; required?: boolean; }; const CountrySelect = ({ value, onChange, }: { value: string; onChange: (value: string) => void; }) => { const [open, setOpen] = useState(false); // Get country options with flags const countries = countryList().getData(); // Helper function to get flag emoji const getFlagEmoji = (countryCode: string) => { const codePoints = countryCode .toUpperCase() .split('') .map((char) => 127397 + char.charCodeAt(0)); return String.fromCodePoint(...codePoints); }; return ( No country found. {countries.map((country) => ( { onChange(country.value); setOpen(false); }} className='country-select-item' > {getFlagEmoji(country.value)} {country.label} ))} ); }; export const CountrySelectField = ({ name, label, control, error, required = false, }: CountrySelectProps) => { return (
( )} /> {error &&

{error.message}

}

Helps us show market data and news relevant to you.

); };