import React, { ReactNode } from 'react'; interface LocaleConfig { name: string; code: string; flag?: string; } /** * What happens after the locale cookie is written. * * - `"reload"` — full `window.location.reload()` (default, pre-0.5 behaviour). * - `"none"` — nothing; you re-render yourself. * - a function — called with the selected code. Use it to hand control to the * router, e.g. `reloadStrategy={() => router.refresh()}` in the App Router. */ type ReloadStrategy = "reload" | "none" | ((code: string) => void); /** * Attributes written with the locale cookie. Every field is optional; the * defaults reproduce the pre-0.6 cookie exactly. */ interface CookieOptions { /** Lifetime in seconds. Defaults to `31536000` (one year). */ maxAge?: number; /** Defaults to `"/"`. */ path?: string; /** * Share the cookie across subdomains, e.g. `".example.com"`. Omitted by * default, which scopes the cookie to the current host. */ domain?: string; /** Defaults to `"Lax"`. */ sameSite?: "Lax" | "Strict" | "None"; /** * Adds the `Secure` attribute. Defaults to `false`, except when `sameSite` * is `"None"` — browsers reject `SameSite=None` without `Secure`, so it is * added automatically in that case. */ secure?: boolean; } interface LanguageSelectorProps { locales: LocaleConfig[]; defaultLocale: string; /** * Locale to render on the server and during hydration, before the cookie is * read on the client. Pass the cookie value you already read server-side * (`cookies().get("NEXT_LOCALE")?.value`) to render the correct locale with * no flash. Falls back to `defaultLocale`. */ initialLocale?: string; isDropdown?: boolean; cookieName?: string; /** Attributes for the written cookie: `maxAge`, `path`, `domain`, `sameSite`, `secure`. */ cookieOptions?: CookieOptions; className?: string; itemClassName?: string; /** * Accessible name for the control — applied to the `