"use client"; import * as React from "react"; import { cn } from "./lib/utils"; export interface CountryOption { code: string; name: string; flag: string; } export const COUNTRIES: CountryOption[] = [ { code: "TR", name: "Turkey", flag: "🇹🇷" }, { code: "US", name: "ABD", flag: "🇺🇸" }, { code: "GB", name: "United Kingdom", flag: "🇬🇧" }, { code: "DE", name: "Almanya", flag: "🇩🇪" }, { code: "FR", name: "Fransa", flag: "🇫🇷" }, { code: "JP", name: "Japonya", flag: "🇯🇵" }, { code: "BR", name: "Brezilya", flag: "🇧🇷" }, { code: "IN", name: "Hindistan", flag: "🇮🇳" }, ]; export interface CountrySelectProps extends Omit, "onChange"> { value?: string; defaultValue?: string; onValueChange?: (code: string) => void; } /** Country selector dropdown with national flag icons. */ export function CountrySelect({ value, defaultValue, onValueChange, className, ...props }: CountrySelectProps) { const [internal, setInternal] = React.useState(defaultValue ?? "TR"); const [open, setOpen] = React.useState(false); const active = COUNTRIES.find((c) => c.code === (value ?? internal)) ?? COUNTRIES[0]; return (
{open && ( <>
setOpen(false)} aria-hidden="true" />
    {COUNTRIES.map((c) => (
  • ))}
)}
); }