'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Globe, Check, ChevronDown } from 'lucide-react';
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
import { useLocale } from './LocaleProvider.js';
export function LocaleSwitcher() {
    const { activeLocale, setLocale, locales } = useLocale();
    if (locales.length < 2)
        return null;
    const activeLabel = locales.find((l) => l.code === activeLocale)?.label ?? activeLocale;
    return (_jsxs(DropdownMenu.Root, { children: [_jsx(DropdownMenu.Trigger, { asChild: true, children: _jsxs("button", { className: "flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-[var(--accent)]", "aria-label": "Switch locale", children: [_jsx(Globe, { className: "h-4 w-4 text-[var(--muted-foreground)]" }), _jsx("span", { className: "hidden text-sm font-medium text-[var(--foreground)] sm:inline", children: activeLabel }), _jsx(ChevronDown, { className: "h-3 w-3 text-[var(--muted-foreground)]" })] }) }), _jsx(DropdownMenu.Portal, { children: _jsx(DropdownMenu.Content, { className: "z-50 min-w-[160px] rounded-lg border border-[var(--border)] bg-[var(--popover)] p-1 text-[var(--popover-foreground)] shadow-lg", align: "end", sideOffset: 5, children: locales.map((locale) => (_jsxs(DropdownMenu.Item, { onSelect: () => setLocale(locale.code), className: "flex cursor-pointer items-center justify-between gap-2 rounded px-3 py-2 text-sm outline-none hover:bg-[var(--accent)]", children: [_jsx("span", { children: locale.label }), locale.code === activeLocale && _jsx(Check, { className: "h-4 w-4 text-[var(--primary)]" })] }, locale.code))) }) })] }));
}
//# sourceMappingURL=LocaleSwitcher.js.map