@alfadocs/ui-kit-debug 0.75.0 → 0.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/_chunks/{address-fields-COyjgqxA.js → address-fields-7k59FnJ6.js} +2 -2
  2. package/dist/_chunks/{address-fields-COyjgqxA.js.map → address-fields-7k59FnJ6.js.map} +1 -1
  3. package/dist/_chunks/{booking-B1Qkcl3c.js → booking-CLmeXtGv.js} +2 -2
  4. package/dist/_chunks/{booking-B1Qkcl3c.js.map → booking-CLmeXtGv.js.map} +1 -1
  5. package/dist/_chunks/{country-select-DYHDLEjG.js → country-select-BN9nedAp.js} +2 -2
  6. package/dist/_chunks/{country-select-DYHDLEjG.js.map → country-select-BN9nedAp.js.map} +1 -1
  7. package/dist/_chunks/document-preview-nwfulDEs.js +290 -0
  8. package/dist/_chunks/document-preview-nwfulDEs.js.map +1 -0
  9. package/dist/_chunks/{file-manager-UF8dkQF1.js → file-manager-DfTG7bxx.js} +394 -399
  10. package/dist/_chunks/file-manager-DfTG7bxx.js.map +1 -0
  11. package/dist/_chunks/flag-Cnmivlrl.js +641 -0
  12. package/dist/_chunks/{flag-DZ6V7-hU.js.map → flag-Cnmivlrl.js.map} +1 -1
  13. package/dist/_chunks/{header-settings-4cwQzeFc.js → header-settings-DMfdx0Vq.js} +2 -2
  14. package/dist/_chunks/{header-settings-4cwQzeFc.js.map → header-settings-DMfdx0Vq.js.map} +1 -1
  15. package/dist/_chunks/{locale-picker-GNF3lo8K.js → locale-picker-EyvPrwDc.js} +2 -2
  16. package/dist/_chunks/{locale-picker-GNF3lo8K.js.map → locale-picker-EyvPrwDc.js.map} +1 -1
  17. package/dist/_chunks/{marketplace-app-shell-D_1tF4La.js → marketplace-app-shell-Bxq1PYAj.js} +2 -2
  18. package/dist/_chunks/{marketplace-app-shell-D_1tF4La.js.map → marketplace-app-shell-Bxq1PYAj.js.map} +1 -1
  19. package/dist/_chunks/{patient-details-DP4wKyq4.js → patient-details-zy76MRh7.js} +3 -3
  20. package/dist/_chunks/{patient-details-DP4wKyq4.js.map → patient-details-zy76MRh7.js.map} +1 -1
  21. package/dist/_chunks/periodontal-chart-CYBhr9vc.js +1305 -0
  22. package/dist/_chunks/periodontal-chart-CYBhr9vc.js.map +1 -0
  23. package/dist/_chunks/{phone-input-dtnrvnZf.js → phone-input-D00ZBAm-.js} +2 -2
  24. package/dist/_chunks/{phone-input-dtnrvnZf.js.map → phone-input-D00ZBAm-.js.map} +1 -1
  25. package/dist/agent-catalog.json +149 -1
  26. package/dist/agent-i18n/en.json +2 -0
  27. package/dist/components/address-fields/index.js +1 -1
  28. package/dist/components/booking/index.js +1 -1
  29. package/dist/components/country-select/index.js +1 -1
  30. package/dist/components/document-preview/document-preview.d.ts +35 -2
  31. package/dist/components/document-preview/document-preview.d.ts.map +1 -1
  32. package/dist/components/document-preview/index.d.ts +1 -1
  33. package/dist/components/document-preview/index.d.ts.map +1 -1
  34. package/dist/components/document-preview/index.js +1 -1
  35. package/dist/components/file-manager/file-manager.d.ts.map +1 -1
  36. package/dist/components/file-manager/index.js +1 -1
  37. package/dist/components/file-manager/list-view.d.ts.map +1 -1
  38. package/dist/components/flag/flag.d.ts.map +1 -1
  39. package/dist/components/flag/index.js +1 -1
  40. package/dist/components/header-settings/index.js +1 -1
  41. package/dist/components/locale-picker/index.js +1 -1
  42. package/dist/components/patient-details/index.js +1 -1
  43. package/dist/components/periodontal-chart/index.d.ts +2 -2
  44. package/dist/components/periodontal-chart/index.d.ts.map +1 -1
  45. package/dist/components/periodontal-chart/index.js +8 -7
  46. package/dist/components/periodontal-chart/periodontal-chart-data.d.ts +45 -0
  47. package/dist/components/periodontal-chart/periodontal-chart-data.d.ts.map +1 -1
  48. package/dist/components/periodontal-chart/periodontal-chart.agent.d.ts.map +1 -1
  49. package/dist/components/periodontal-chart/periodontal-chart.d.ts +3 -1
  50. package/dist/components/periodontal-chart/periodontal-chart.d.ts.map +1 -1
  51. package/dist/components/phone-input/index.js +1 -1
  52. package/dist/i18n/locales/ar.d.ts +8 -1
  53. package/dist/i18n/locales/ar.d.ts.map +1 -1
  54. package/dist/i18n/locales/ar.js +8 -1
  55. package/dist/i18n/locales/ar.js.map +1 -1
  56. package/dist/i18n/locales/de.d.ts +8 -1
  57. package/dist/i18n/locales/de.d.ts.map +1 -1
  58. package/dist/i18n/locales/de.js +8 -1
  59. package/dist/i18n/locales/de.js.map +1 -1
  60. package/dist/i18n/locales/el.d.ts +8 -1
  61. package/dist/i18n/locales/el.d.ts.map +1 -1
  62. package/dist/i18n/locales/el.js +8 -1
  63. package/dist/i18n/locales/el.js.map +1 -1
  64. package/dist/i18n/locales/en.d.ts +8 -1
  65. package/dist/i18n/locales/en.d.ts.map +1 -1
  66. package/dist/i18n/locales/en.js +8 -1
  67. package/dist/i18n/locales/en.js.map +1 -1
  68. package/dist/i18n/locales/es.d.ts +8 -1
  69. package/dist/i18n/locales/es.d.ts.map +1 -1
  70. package/dist/i18n/locales/es.js +8 -1
  71. package/dist/i18n/locales/es.js.map +1 -1
  72. package/dist/i18n/locales/fr.d.ts +8 -1
  73. package/dist/i18n/locales/fr.d.ts.map +1 -1
  74. package/dist/i18n/locales/fr.js +8 -1
  75. package/dist/i18n/locales/fr.js.map +1 -1
  76. package/dist/i18n/locales/hi.d.ts +8 -1
  77. package/dist/i18n/locales/hi.d.ts.map +1 -1
  78. package/dist/i18n/locales/hi.js +8 -1
  79. package/dist/i18n/locales/hi.js.map +1 -1
  80. package/dist/i18n/locales/it.d.ts +8 -1
  81. package/dist/i18n/locales/it.d.ts.map +1 -1
  82. package/dist/i18n/locales/it.js +8 -1
  83. package/dist/i18n/locales/it.js.map +1 -1
  84. package/dist/i18n/locales/ja.d.ts +8 -1
  85. package/dist/i18n/locales/ja.d.ts.map +1 -1
  86. package/dist/i18n/locales/ja.js +8 -1
  87. package/dist/i18n/locales/ja.js.map +1 -1
  88. package/dist/i18n/locales/nl.d.ts +8 -1
  89. package/dist/i18n/locales/nl.d.ts.map +1 -1
  90. package/dist/i18n/locales/nl.js +8 -1
  91. package/dist/i18n/locales/nl.js.map +1 -1
  92. package/dist/i18n/locales/pl.d.ts +8 -1
  93. package/dist/i18n/locales/pl.d.ts.map +1 -1
  94. package/dist/i18n/locales/pl.js +8 -1
  95. package/dist/i18n/locales/pl.js.map +1 -1
  96. package/dist/i18n/locales/pt.d.ts +8 -1
  97. package/dist/i18n/locales/pt.d.ts.map +1 -1
  98. package/dist/i18n/locales/pt.js +8 -1
  99. package/dist/i18n/locales/pt.js.map +1 -1
  100. package/dist/i18n/locales/ro.d.ts +8 -1
  101. package/dist/i18n/locales/ro.d.ts.map +1 -1
  102. package/dist/i18n/locales/ro.js +8 -1
  103. package/dist/i18n/locales/ro.js.map +1 -1
  104. package/dist/i18n/locales/ru.d.ts +8 -1
  105. package/dist/i18n/locales/ru.d.ts.map +1 -1
  106. package/dist/i18n/locales/ru.js +8 -1
  107. package/dist/i18n/locales/ru.js.map +1 -1
  108. package/dist/i18n/locales/sq.d.ts +8 -1
  109. package/dist/i18n/locales/sq.d.ts.map +1 -1
  110. package/dist/i18n/locales/sq.js +8 -1
  111. package/dist/i18n/locales/sq.js.map +1 -1
  112. package/dist/i18n/locales/sv.d.ts +8 -1
  113. package/dist/i18n/locales/sv.d.ts.map +1 -1
  114. package/dist/i18n/locales/sv.js +8 -1
  115. package/dist/i18n/locales/sv.js.map +1 -1
  116. package/dist/i18n/locales/tr.d.ts +8 -1
  117. package/dist/i18n/locales/tr.d.ts.map +1 -1
  118. package/dist/i18n/locales/tr.js +8 -1
  119. package/dist/i18n/locales/tr.js.map +1 -1
  120. package/dist/i18n/locales/zh.d.ts +8 -1
  121. package/dist/i18n/locales/zh.d.ts.map +1 -1
  122. package/dist/i18n/locales/zh.js +8 -1
  123. package/dist/i18n/locales/zh.js.map +1 -1
  124. package/dist/index.js +217 -216
  125. package/dist/locales/ar.json +8 -1
  126. package/dist/locales/de.json +8 -1
  127. package/dist/locales/el.json +8 -1
  128. package/dist/locales/en.json +8 -1
  129. package/dist/locales/es.json +8 -1
  130. package/dist/locales/fr.json +8 -1
  131. package/dist/locales/hi.json +8 -1
  132. package/dist/locales/it.json +8 -1
  133. package/dist/locales/ja.json +8 -1
  134. package/dist/locales/nl.json +8 -1
  135. package/dist/locales/pl.json +8 -1
  136. package/dist/locales/pt.json +8 -1
  137. package/dist/locales/ro.json +8 -1
  138. package/dist/locales/ru.json +8 -1
  139. package/dist/locales/sq.json +8 -1
  140. package/dist/locales/sv.json +8 -1
  141. package/dist/locales/tr.json +8 -1
  142. package/dist/locales/zh.json +8 -1
  143. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  144. package/dist/tokens.css +2 -1
  145. package/package.json +1 -1
  146. package/dist/_chunks/document-preview-CGSM_au9.js +0 -181
  147. package/dist/_chunks/document-preview-CGSM_au9.js.map +0 -1
  148. package/dist/_chunks/file-manager-UF8dkQF1.js.map +0 -1
  149. package/dist/_chunks/flag-DZ6V7-hU.js +0 -637
  150. package/dist/_chunks/periodontal-chart-D8hOFmde.js +0 -1173
  151. package/dist/_chunks/periodontal-chart-D8hOFmde.js.map +0 -1
@@ -6,7 +6,7 @@ import { I as o } from "./icon-button-C_kbcd7I.js";
6
6
  import { I as N } from "./icon-button-group-C_lqXTAj.js";
7
7
  import { D as r } from "./dropdown-menu-DU-Hrf33.js";
8
8
  import { S as j } from "./switch-OILsBLWo.js";
9
- import { c as y, a as H, L as R } from "./locale-picker-GNF3lo8K.js";
9
+ import { c as y, a as H, L as R } from "./locale-picker-EyvPrwDc.js";
10
10
  import { u as P } from "./use-locale-BkCIHujH.js";
11
11
  import { u as _ } from "./use-theme-CAuo6EYT.js";
12
12
  import { u as O } from "./registry-DvAUVLHh.js";
@@ -281,4 +281,4 @@ W.displayName = "HeaderSettings";
281
281
  export {
282
282
  W as H
283
283
  };
284
- //# sourceMappingURL=header-settings-4cwQzeFc.js.map
284
+ //# sourceMappingURL=header-settings-DMfdx0Vq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"header-settings-4cwQzeFc.js","sources":["../../src/components/header-settings/header-settings.agent.ts","../../src/components/header-settings/header-settings.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — HeaderSettings. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { HeaderSettingsHandle } from './header-settings';\n\nexport const headerSettingsAgent: AgentAdapter<HeaderSettingsHandle> = {\n id: 'header-settings',\n // Each setter persists a single preference value (locale / theme /\n // accessibility) — `set_value` semantics, not an ephemeral view switch.\n capabilities: ['set_value'],\n state: {},\n actions: {\n set_locale: {\n safety: 'write',\n argsType: '{ locale: string }',\n argsSchema: {\n type: 'object',\n properties: {\n locale: {\n type: 'string',\n description:\n 'IETF language tag (e.g. \"en\", \"it\", \"ar\"). Unknown tags are silently dropped.',\n },\n },\n required: ['locale'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.headerSettings.actions.setLocale',\n description: 'Switch the active locale to the given IETF tag.',\n examples: [{ args: { locale: 'it' }, note: 'Switch to Italian.' }],\n invoke: (handle, args: { locale: string }) => {\n // Validation happens inside the handle so the agent surface\n // accepts arbitrary tags and silently drops unknown ones.\n handle.setLocale(args.locale);\n },\n },\n set_theme: {\n safety: 'write',\n argsType: '{ theme: \"light\" | \"dark\" | \"system\" }',\n argsSchema: {\n type: 'object',\n properties: { theme: { enum: ['light', 'dark', 'system'] } },\n required: ['theme'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.headerSettings.actions.setTheme',\n description: 'Switch the theme preference.',\n examples: [\n { args: { theme: 'dark' }, note: 'Switch to the dark theme.' },\n ],\n invoke: (handle, args: { theme: 'light' | 'dark' | 'system' }) => {\n handle.setTheme(args.theme);\n },\n },\n set_accessibility: {\n safety: 'write',\n argsType: '{ accessibility: \"default\" | \"accessible\" }',\n argsSchema: {\n type: 'object',\n properties: { accessibility: { enum: ['default', 'accessible'] } },\n required: ['accessibility'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.headerSettings.actions.setAccessibility',\n description: 'Switch the accessibility preference.',\n examples: [\n {\n args: { accessibility: 'accessible' },\n note: 'Enable the AAA-accessible profile.',\n },\n ],\n invoke: (handle, args: { accessibility: 'default' | 'accessible' }) => {\n handle.setAccessibility(args.accessibility);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'header-settings',\n description: 'Marks the HeaderSettings wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop (forwarded via HTMLAttributes).',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n type HTMLAttributes,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Monitor, Moon, Settings, Sun } from 'lucide-react';\nimport { IconButton } from '../button/icon-button';\nimport { IconButtonGroup } from '../icon-button-group/icon-button-group';\nimport { DropdownMenu } from '../dropdown-menu/dropdown-menu';\nimport { Switch } from '../switch/switch';\nimport {\n LocalePicker,\n LOCALE_STORAGE_KEY,\n} from '../locale-picker/locale-picker';\nimport {\n useTheme,\n type AccessibilityPreference,\n type ThemePreference,\n} from '../../hooks';\nimport { useLocale } from '../../hooks/use-locale';\nimport { LOCALE_META, type Locale } from '../../i18n/locale-meta';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { headerSettingsAgent } from './header-settings.agent';\n\nfunction safeWriteStorage(key: string, value: string): void {\n if (typeof window === 'undefined') return;\n try {\n window.localStorage.setItem(key, value);\n } catch {\n /* Storage can throw in private mode — silent-fail per use-theme.ts. */\n }\n}\n\nfunction applyDocumentAttrs(locale: Locale): void {\n if (typeof document === 'undefined') return;\n const root = document.documentElement;\n root.lang = locale;\n root.dir = LOCALE_META[locale].dir;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst wrapperVariants = cva('ds:inline-flex ds:items-center', {\n variants: {\n align: {\n start: '',\n end: '',\n },\n },\n defaultVariants: { align: 'end' },\n});\n\nconst dropdownContentClasses = [\n 'ds:w-[20rem] ds:p-[var(--spacing-xs)]',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-border',\n 'ds:bg-background ds:text-foreground ds:shadow-[var(--shadow-lg)]',\n].join(' ');\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface HeaderSettingsProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>,\n VariantProps<typeof wrapperVariants> {\n /** Anchor side for the dropdown. Defaults to `end` (matches LTR + RTL). */\n align?: 'start' | 'end';\n /**\n * Size of the cog trigger only. Forwards to the underlying\n * `IconButton`. Defaults to `md` to preserve the existing visual.\n * Use `sm` when composing alongside other `<Button size=\"sm\">`\n * actions in a header row — keeps the visual rhythm consistent.\n *\n * The internal dropdown chrome (Appearance toggle group, locale\n * picker, accessibility switch) stays at kit defaults regardless\n * — this prop only sizes the trigger.\n */\n size?: 'sm' | 'md' | 'lg';\n /** Disable the trigger entirely. */\n disabled?: boolean;\n}\n\nexport interface HeaderSettingsHandle {\n /**\n * Switch the active locale. Widened to `string` (vs. `Locale`) so\n * agent surfaces with untyped inputs can call through without\n * extra casting — invalid tags no-op silently.\n */\n setLocale: (next: string) => void;\n setTheme: (next: ThemePreference) => void;\n setAccessibility: (next: AccessibilityPreference) => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* HeaderSettings */\n/* */\n/* Single button → single DropdownMenu surface. Inside the menu, the */\n/* \"Language\" section embeds `LocalePicker.SearchList` (the kit's */\n/* searchable list without its own trigger / popover) and the */\n/* \"Appearance\" section mirrors `ThemeToggle`'s menu-variant internals */\n/* using `DropdownMenu.RadioGroup` + `CheckboxItem`. Both sections */\n/* read/write the same hooks (`useLocale`, `useTheme`) that the */\n/* standalone components use, so there's no state duplication. */\n/* ------------------------------------------------------------------ */\n\nexport const HeaderSettings = forwardRef<HTMLDivElement, HeaderSettingsProps>(\n (props, ref) => {\n const {\n align = 'end',\n size = 'md',\n disabled = false,\n className,\n id,\n ...rest\n } = props as HeaderSettingsProps & { id?: string };\n\n const { t } = useTranslation();\n const theme = useTheme();\n const { setLocale: setLocaleI18n } = useLocale();\n\n const forwardedRef = useRef<HTMLDivElement | null>(null);\n useImperativeHandle(ref, () => forwardedRef.current as HTMLDivElement, []);\n\n // Same side-effect chain as LocalePicker's internal helper:\n // i18next.changeLanguage → document.dir/lang → persist.\n // Inlined here (rather than exported from locale-picker) because\n // it's three small calls; the LocalePicker.SearchList component\n // continues to own its own copy for inline use, and both apply\n // the same persistence key (`alfadocs-ui.locale`) so a write from\n // either path is visible to the other on next mount.\n const setLocaleWithPersistence = useCallback(\n (next: Locale) => {\n void setLocaleI18n(next);\n applyDocumentAttrs(next);\n safeWriteStorage(LOCALE_STORAGE_KEY, next);\n },\n [setLocaleI18n],\n );\n const setLocaleRef = useRef(setLocaleWithPersistence);\n setLocaleRef.current = setLocaleWithPersistence;\n\n const themeRef = useRef(theme);\n themeRef.current = theme;\n const agentHandle = useMemo<HeaderSettingsHandle>(\n () => ({\n setLocale: (next: string) => {\n // Mirrors LocalePicker's gating — silently drop unknown tags\n // rather than crash mid-cascade. `LOCALES_WITH_BUNDLES` is\n // re-imported via the LOCALE_META keys so this file doesn't\n // need the resources module on the build-agent-catalog path.\n if (Object.prototype.hasOwnProperty.call(LOCALE_META, next)) {\n setLocaleRef.current(next as Locale);\n }\n },\n setTheme: (next) => themeRef.current.setTheme(next),\n setAccessibility: (next) => themeRef.current.setAccessibility(next),\n }),\n [],\n );\n useAgentRegistration(headerSettingsAgent, agentHandle, id);\n\n const accessibleChecked = theme.accessibility === 'accessible';\n\n return (\n <div\n ref={forwardedRef}\n data-component=\"header-settings\"\n data-component-id={id}\n className={wrapperVariants({ align, className })}\n {...rest}\n >\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <IconButton\n size={size}\n disabled={disabled}\n icon={<Settings aria-hidden />}\n aria-label={t('navigation.headerSettings.trigger')}\n />\n </DropdownMenu.Trigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content\n align={align}\n sideOffset={8}\n className={dropdownContentClasses}\n // Search input inside the menu owns its own keyboard\n // capture (cmdk). Stop Radix Menu's typeahead from\n // intercepting letters typed into the search field —\n // `onKeyDownCapture` runs before the menu's listener.\n onKeyDownCapture={(event) => {\n const target = event.target as HTMLElement | null;\n if (\n target?.tagName === 'INPUT' &&\n // Always allow Escape so the menu can close.\n event.key !== 'Escape'\n ) {\n event.stopPropagation();\n }\n }}\n >\n <DropdownMenu.Label>\n {t('navigation.headerSettings.language.label')}\n </DropdownMenu.Label>\n {/* Render the kit's compact LocalePicker (its own\n Popover trigger + content). Clicking the trigger\n opens a nested popover containing the full\n searchable list — the HeaderSettings menu stays\n open behind it so the user can return to Appearance\n / Accessibility without re-opening.\n\n Wrapped in `role=\"group\"` so the menu's\n `aria-required-children` rule sees a permitted child\n role (the LocalePicker compact button alone would\n appear as a raw button child of `role=\"menu\"`). */}\n <div\n role=\"group\"\n aria-label={t('navigation.headerSettings.language.label')}\n className={[\n 'ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-xs)]',\n // Stretch the compact LocalePicker to the full menu\n // width so it reads as a single row affordance (not\n // a centred pill). The picker's root is\n // inline-flex; the `*:` child selector + `flex-1`\n // gives it `flex: 1 1 0%` once it's a child of the\n // flex container we make this div into.\n 'ds:flex ds:[&>*]:flex-1',\n ].join(' ')}\n >\n {/* `popoverSide=\"end\"` opens the nested search popover\n as a side-flyout (inline-end, RTL-aware) rather\n than below the compact row — without this the\n nested popover stacks under the trigger inside the\n outer DropdownMenu and the two surfaces visually\n merge. Radix Popover auto-flips to the opposite\n side if there's no viewport room. */}\n <LocalePicker variant=\"compact\" popoverSide=\"end\" />\n </div>\n\n <DropdownMenu.Separator />\n\n <DropdownMenu.Label>\n {t('navigation.headerSettings.appearance.label')}\n </DropdownMenu.Label>\n {/* Horizontal segmented toggle (mirrors ThemeToggle's\n `split` variant) instead of stacked radio rows — uses\n fewer rows of menu real estate and reads as a single\n control. `role=\"radiogroup\"` keeps the screen-reader\n semantics correct, and the group is wrapped in\n `role=\"group\"` for the same reason the language\n search-list wrapper is — the menu's\n aria-required-children doesn't permit raw IconButtons\n as direct menu descendants. */}\n <div\n role=\"group\"\n aria-label={t('navigation.headerSettings.appearance.label')}\n className=\"ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-xs)]\"\n >\n <IconButtonGroup\n role=\"radiogroup\"\n mode=\"toggle-single\"\n size=\"sm\"\n aria-label={t('navigation.headerSettings.appearance.label')}\n value={theme.theme}\n onValueChange={(next) =>\n theme.setTheme(next as ThemePreference)\n }\n >\n <IconButton\n icon={<Sun aria-hidden />}\n aria-label={t('navigation.headerSettings.appearance.light')}\n value=\"light\"\n />\n <IconButton\n icon={<Moon aria-hidden />}\n aria-label={t('navigation.headerSettings.appearance.dark')}\n value=\"dark\"\n />\n <IconButton\n icon={<Monitor aria-hidden />}\n aria-label={t(\n 'navigation.headerSettings.appearance.system',\n )}\n value=\"system\"\n />\n </IconButtonGroup>\n </div>\n\n <DropdownMenu.Separator />\n\n {/* Accessible-mode toggle uses the kit's Switch primitive\n for a clearer visual affordance than a checkbox tick.\n Rendered inside a `presentation` row (not a\n DropdownMenu.CheckboxItem) — the Switch is focusable\n via Tab while the menu is open, so keyboard users\n still reach it; arrow keys keep moving between the\n three theme radios above without falling into the\n switch's roving collection.\n\n When the switch flips, `setAccessibility` writes\n through useTheme (the same store the standalone\n ThemeToggle uses) so document.documentElement gets\n the `theme-accessible` class instantly — including\n swapping `--font-sans` to Lexend for Latin scripts\n (see src/tokens/index.css). */}\n {/* `role=\"group\"` so the menu's `aria-required-children`\n (which only permits menuitem* / group / separator /\n menu inside `role=\"menu\"`) is satisfied — the Switch's\n `role=\"switch\"` would be a forbidden direct child of\n the menu. `aria-label` names the group so SR users\n hear \"Accessibility toggle, group\". */}\n <div\n role=\"group\"\n aria-label={t(\n 'navigation.headerSettings.appearance.accessible',\n )}\n className=\"ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-sm)]\"\n >\n <Switch\n label={t('navigation.headerSettings.appearance.accessible')}\n labelSide=\"start\"\n size=\"sm\"\n checked={accessibleChecked}\n onCheckedChange={(next) =>\n theme.setAccessibility(next ? 'accessible' : 'default')\n }\n />\n </div>\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n </div>\n );\n },\n);\n\nHeaderSettings.displayName = 'HeaderSettings';\n"],"names":["headerSettingsAgent","handle","args","safeWriteStorage","key","value","applyDocumentAttrs","locale","root","LOCALE_META","wrapperVariants","cva","dropdownContentClasses","HeaderSettings","forwardRef","props","ref","align","size","disabled","className","id","rest","t","useTranslation","theme","useTheme","setLocaleI18n","useLocale","forwardedRef","useRef","useImperativeHandle","setLocaleWithPersistence","useCallback","next","LOCALE_STORAGE_KEY","setLocaleRef","themeRef","agentHandle","useMemo","useAgentRegistration","accessibleChecked","jsx","jsxs","DropdownMenu","IconButton","Settings","event","target","LocalePicker","IconButtonGroup","Sun","Moon","Monitor","Switch"],"mappings":";;;;;;;;;;;;;;;AAOO,MAAMA,IAA0D;AAAA,EACrE,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO,CAAA;AAAA,EACP,SAAS;AAAA,IACP,YAAY;AAAA,MACV,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,QAAQ;AAAA,YACN,MAAM;AAAA,YACN,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,QAEF,UAAU,CAAC,QAAQ;AAAA,MAAA;AAAA,MAErB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,QAAQ,MAAM,sBAAsB;AAAA,MACjE,QAAQ,CAACC,GAAQC,MA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AAA,0BAER,gBAAAmB;AAAA,4BAACG;AAAA,4BAAA;AAAA,8BACC,MAAM,gBAAAH,EAACW,GAAA,EAAQ,eAAW,GAAA,CAAC;AAAA,8BAC3B,cAAY9B;AAAA,gCACV;AAAA,8BAAA;AAAA,8BAEF,OAAM;AAAA,4BAAA;AAAA,0BAAA;AAAA,wBACR;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACF;AAAA,gBAAA;AAAA,gBAGF,gBAAAmB,EAACE,EAAa,WAAb,EAAuB;AAAA,gBAuBxB,gBAAAF;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,MAAK;AAAA,oBACL,cAAYnB;AAAA,sBACV;AAAA,oBAAA;AAAA,oBAEF,WAAU;AAAA,oBAEV,UAAA,gBAAAmB;AAAA,sBAACY;AAAA,sBAAA;AAAA,wBACC,OAAO/B,EAAE,iDAAiD;AAAA,wBAC1D,WAAU;AAAA,wBACV,MAAK;AAAA,wBACL,SAASkB;AAAA,wBACT,iBAAiB,CAACP,MAChBT,EAAM,iBAAiBS,IAAO,eAAe,SAAS;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBAE1D;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAAA,EACF,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEArB,EAAe,cAAc;"}
1
+ {"version":3,"file":"header-settings-DMfdx0Vq.js","sources":["../../src/components/header-settings/header-settings.agent.ts","../../src/components/header-settings/header-settings.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — HeaderSettings. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { HeaderSettingsHandle } from './header-settings';\n\nexport const headerSettingsAgent: AgentAdapter<HeaderSettingsHandle> = {\n id: 'header-settings',\n // Each setter persists a single preference value (locale / theme /\n // accessibility) — `set_value` semantics, not an ephemeral view switch.\n capabilities: ['set_value'],\n state: {},\n actions: {\n set_locale: {\n safety: 'write',\n argsType: '{ locale: string }',\n argsSchema: {\n type: 'object',\n properties: {\n locale: {\n type: 'string',\n description:\n 'IETF language tag (e.g. \"en\", \"it\", \"ar\"). Unknown tags are silently dropped.',\n },\n },\n required: ['locale'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.headerSettings.actions.setLocale',\n description: 'Switch the active locale to the given IETF tag.',\n examples: [{ args: { locale: 'it' }, note: 'Switch to Italian.' }],\n invoke: (handle, args: { locale: string }) => {\n // Validation happens inside the handle so the agent surface\n // accepts arbitrary tags and silently drops unknown ones.\n handle.setLocale(args.locale);\n },\n },\n set_theme: {\n safety: 'write',\n argsType: '{ theme: \"light\" | \"dark\" | \"system\" }',\n argsSchema: {\n type: 'object',\n properties: { theme: { enum: ['light', 'dark', 'system'] } },\n required: ['theme'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.headerSettings.actions.setTheme',\n description: 'Switch the theme preference.',\n examples: [\n { args: { theme: 'dark' }, note: 'Switch to the dark theme.' },\n ],\n invoke: (handle, args: { theme: 'light' | 'dark' | 'system' }) => {\n handle.setTheme(args.theme);\n },\n },\n set_accessibility: {\n safety: 'write',\n argsType: '{ accessibility: \"default\" | \"accessible\" }',\n argsSchema: {\n type: 'object',\n properties: { accessibility: { enum: ['default', 'accessible'] } },\n required: ['accessibility'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.headerSettings.actions.setAccessibility',\n description: 'Switch the accessibility preference.',\n examples: [\n {\n args: { accessibility: 'accessible' },\n note: 'Enable the AAA-accessible profile.',\n },\n ],\n invoke: (handle, args: { accessibility: 'default' | 'accessible' }) => {\n handle.setAccessibility(args.accessibility);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'header-settings',\n description: 'Marks the HeaderSettings wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop (forwarded via HTMLAttributes).',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n type HTMLAttributes,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Monitor, Moon, Settings, Sun } from 'lucide-react';\nimport { IconButton } from '../button/icon-button';\nimport { IconButtonGroup } from '../icon-button-group/icon-button-group';\nimport { DropdownMenu } from '../dropdown-menu/dropdown-menu';\nimport { Switch } from '../switch/switch';\nimport {\n LocalePicker,\n LOCALE_STORAGE_KEY,\n} from '../locale-picker/locale-picker';\nimport {\n useTheme,\n type AccessibilityPreference,\n type ThemePreference,\n} from '../../hooks';\nimport { useLocale } from '../../hooks/use-locale';\nimport { LOCALE_META, type Locale } from '../../i18n/locale-meta';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { headerSettingsAgent } from './header-settings.agent';\n\nfunction safeWriteStorage(key: string, value: string): void {\n if (typeof window === 'undefined') return;\n try {\n window.localStorage.setItem(key, value);\n } catch {\n /* Storage can throw in private mode — silent-fail per use-theme.ts. */\n }\n}\n\nfunction applyDocumentAttrs(locale: Locale): void {\n if (typeof document === 'undefined') return;\n const root = document.documentElement;\n root.lang = locale;\n root.dir = LOCALE_META[locale].dir;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst wrapperVariants = cva('ds:inline-flex ds:items-center', {\n variants: {\n align: {\n start: '',\n end: '',\n },\n },\n defaultVariants: { align: 'end' },\n});\n\nconst dropdownContentClasses = [\n 'ds:w-[20rem] ds:p-[var(--spacing-xs)]',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-border',\n 'ds:bg-background ds:text-foreground ds:shadow-[var(--shadow-lg)]',\n].join(' ');\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface HeaderSettingsProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>,\n VariantProps<typeof wrapperVariants> {\n /** Anchor side for the dropdown. Defaults to `end` (matches LTR + RTL). */\n align?: 'start' | 'end';\n /**\n * Size of the cog trigger only. Forwards to the underlying\n * `IconButton`. Defaults to `md` to preserve the existing visual.\n * Use `sm` when composing alongside other `<Button size=\"sm\">`\n * actions in a header row — keeps the visual rhythm consistent.\n *\n * The internal dropdown chrome (Appearance toggle group, locale\n * picker, accessibility switch) stays at kit defaults regardless\n * — this prop only sizes the trigger.\n */\n size?: 'sm' | 'md' | 'lg';\n /** Disable the trigger entirely. */\n disabled?: boolean;\n}\n\nexport interface HeaderSettingsHandle {\n /**\n * Switch the active locale. Widened to `string` (vs. `Locale`) so\n * agent surfaces with untyped inputs can call through without\n * extra casting — invalid tags no-op silently.\n */\n setLocale: (next: string) => void;\n setTheme: (next: ThemePreference) => void;\n setAccessibility: (next: AccessibilityPreference) => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* HeaderSettings */\n/* */\n/* Single button → single DropdownMenu surface. Inside the menu, the */\n/* \"Language\" section embeds `LocalePicker.SearchList` (the kit's */\n/* searchable list without its own trigger / popover) and the */\n/* \"Appearance\" section mirrors `ThemeToggle`'s menu-variant internals */\n/* using `DropdownMenu.RadioGroup` + `CheckboxItem`. Both sections */\n/* read/write the same hooks (`useLocale`, `useTheme`) that the */\n/* standalone components use, so there's no state duplication. */\n/* ------------------------------------------------------------------ */\n\nexport const HeaderSettings = forwardRef<HTMLDivElement, HeaderSettingsProps>(\n (props, ref) => {\n const {\n align = 'end',\n size = 'md',\n disabled = false,\n className,\n id,\n ...rest\n } = props as HeaderSettingsProps & { id?: string };\n\n const { t } = useTranslation();\n const theme = useTheme();\n const { setLocale: setLocaleI18n } = useLocale();\n\n const forwardedRef = useRef<HTMLDivElement | null>(null);\n useImperativeHandle(ref, () => forwardedRef.current as HTMLDivElement, []);\n\n // Same side-effect chain as LocalePicker's internal helper:\n // i18next.changeLanguage → document.dir/lang → persist.\n // Inlined here (rather than exported from locale-picker) because\n // it's three small calls; the LocalePicker.SearchList component\n // continues to own its own copy for inline use, and both apply\n // the same persistence key (`alfadocs-ui.locale`) so a write from\n // either path is visible to the other on next mount.\n const setLocaleWithPersistence = useCallback(\n (next: Locale) => {\n void setLocaleI18n(next);\n applyDocumentAttrs(next);\n safeWriteStorage(LOCALE_STORAGE_KEY, next);\n },\n [setLocaleI18n],\n );\n const setLocaleRef = useRef(setLocaleWithPersistence);\n setLocaleRef.current = setLocaleWithPersistence;\n\n const themeRef = useRef(theme);\n themeRef.current = theme;\n const agentHandle = useMemo<HeaderSettingsHandle>(\n () => ({\n setLocale: (next: string) => {\n // Mirrors LocalePicker's gating — silently drop unknown tags\n // rather than crash mid-cascade. `LOCALES_WITH_BUNDLES` is\n // re-imported via the LOCALE_META keys so this file doesn't\n // need the resources module on the build-agent-catalog path.\n if (Object.prototype.hasOwnProperty.call(LOCALE_META, next)) {\n setLocaleRef.current(next as Locale);\n }\n },\n setTheme: (next) => themeRef.current.setTheme(next),\n setAccessibility: (next) => themeRef.current.setAccessibility(next),\n }),\n [],\n );\n useAgentRegistration(headerSettingsAgent, agentHandle, id);\n\n const accessibleChecked = theme.accessibility === 'accessible';\n\n return (\n <div\n ref={forwardedRef}\n data-component=\"header-settings\"\n data-component-id={id}\n className={wrapperVariants({ align, className })}\n {...rest}\n >\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <IconButton\n size={size}\n disabled={disabled}\n icon={<Settings aria-hidden />}\n aria-label={t('navigation.headerSettings.trigger')}\n />\n </DropdownMenu.Trigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content\n align={align}\n sideOffset={8}\n className={dropdownContentClasses}\n // Search input inside the menu owns its own keyboard\n // capture (cmdk). Stop Radix Menu's typeahead from\n // intercepting letters typed into the search field —\n // `onKeyDownCapture` runs before the menu's listener.\n onKeyDownCapture={(event) => {\n const target = event.target as HTMLElement | null;\n if (\n target?.tagName === 'INPUT' &&\n // Always allow Escape so the menu can close.\n event.key !== 'Escape'\n ) {\n event.stopPropagation();\n }\n }}\n >\n <DropdownMenu.Label>\n {t('navigation.headerSettings.language.label')}\n </DropdownMenu.Label>\n {/* Render the kit's compact LocalePicker (its own\n Popover trigger + content). Clicking the trigger\n opens a nested popover containing the full\n searchable list — the HeaderSettings menu stays\n open behind it so the user can return to Appearance\n / Accessibility without re-opening.\n\n Wrapped in `role=\"group\"` so the menu's\n `aria-required-children` rule sees a permitted child\n role (the LocalePicker compact button alone would\n appear as a raw button child of `role=\"menu\"`). */}\n <div\n role=\"group\"\n aria-label={t('navigation.headerSettings.language.label')}\n className={[\n 'ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-xs)]',\n // Stretch the compact LocalePicker to the full menu\n // width so it reads as a single row affordance (not\n // a centred pill). The picker's root is\n // inline-flex; the `*:` child selector + `flex-1`\n // gives it `flex: 1 1 0%` once it's a child of the\n // flex container we make this div into.\n 'ds:flex ds:[&>*]:flex-1',\n ].join(' ')}\n >\n {/* `popoverSide=\"end\"` opens the nested search popover\n as a side-flyout (inline-end, RTL-aware) rather\n than below the compact row — without this the\n nested popover stacks under the trigger inside the\n outer DropdownMenu and the two surfaces visually\n merge. Radix Popover auto-flips to the opposite\n side if there's no viewport room. */}\n <LocalePicker variant=\"compact\" popoverSide=\"end\" />\n </div>\n\n <DropdownMenu.Separator />\n\n <DropdownMenu.Label>\n {t('navigation.headerSettings.appearance.label')}\n </DropdownMenu.Label>\n {/* Horizontal segmented toggle (mirrors ThemeToggle's\n `split` variant) instead of stacked radio rows — uses\n fewer rows of menu real estate and reads as a single\n control. `role=\"radiogroup\"` keeps the screen-reader\n semantics correct, and the group is wrapped in\n `role=\"group\"` for the same reason the language\n search-list wrapper is — the menu's\n aria-required-children doesn't permit raw IconButtons\n as direct menu descendants. */}\n <div\n role=\"group\"\n aria-label={t('navigation.headerSettings.appearance.label')}\n className=\"ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-xs)]\"\n >\n <IconButtonGroup\n role=\"radiogroup\"\n mode=\"toggle-single\"\n size=\"sm\"\n aria-label={t('navigation.headerSettings.appearance.label')}\n value={theme.theme}\n onValueChange={(next) =>\n theme.setTheme(next as ThemePreference)\n }\n >\n <IconButton\n icon={<Sun aria-hidden />}\n aria-label={t('navigation.headerSettings.appearance.light')}\n value=\"light\"\n />\n <IconButton\n icon={<Moon aria-hidden />}\n aria-label={t('navigation.headerSettings.appearance.dark')}\n value=\"dark\"\n />\n <IconButton\n icon={<Monitor aria-hidden />}\n aria-label={t(\n 'navigation.headerSettings.appearance.system',\n )}\n value=\"system\"\n />\n </IconButtonGroup>\n </div>\n\n <DropdownMenu.Separator />\n\n {/* Accessible-mode toggle uses the kit's Switch primitive\n for a clearer visual affordance than a checkbox tick.\n Rendered inside a `presentation` row (not a\n DropdownMenu.CheckboxItem) — the Switch is focusable\n via Tab while the menu is open, so keyboard users\n still reach it; arrow keys keep moving between the\n three theme radios above without falling into the\n switch's roving collection.\n\n When the switch flips, `setAccessibility` writes\n through useTheme (the same store the standalone\n ThemeToggle uses) so document.documentElement gets\n the `theme-accessible` class instantly — including\n swapping `--font-sans` to Lexend for Latin scripts\n (see src/tokens/index.css). */}\n {/* `role=\"group\"` so the menu's `aria-required-children`\n (which only permits menuitem* / group / separator /\n menu inside `role=\"menu\"`) is satisfied — the Switch's\n `role=\"switch\"` would be a forbidden direct child of\n the menu. `aria-label` names the group so SR users\n hear \"Accessibility toggle, group\". */}\n <div\n role=\"group\"\n aria-label={t(\n 'navigation.headerSettings.appearance.accessible',\n )}\n className=\"ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-sm)]\"\n >\n <Switch\n label={t('navigation.headerSettings.appearance.accessible')}\n labelSide=\"start\"\n size=\"sm\"\n checked={accessibleChecked}\n onCheckedChange={(next) =>\n theme.setAccessibility(next ? 'accessible' : 'default')\n }\n />\n </div>\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n </div>\n );\n },\n);\n\nHeaderSettings.displayName = 'HeaderSettings';\n"],"names":["headerSettingsAgent","handle","args","safeWriteStorage","key","value","applyDocumentAttrs","locale","root","LOCALE_META","wrapperVariants","cva","dropdownContentClasses","HeaderSettings","forwardRef","props","ref","align","size","disabled","className","id","rest","t","useTranslation","theme","useTheme","setLocaleI18n","useLocale","forwardedRef","useRef","useImperativeHandle","setLocaleWithPersistence","useCallback","next","LOCALE_STORAGE_KEY","setLocaleRef","themeRef","agentHandle","useMemo","useAgentRegistration","accessibleChecked","jsx","jsxs","DropdownMenu","IconButton","Settings","event","target","LocalePicker","IconButtonGroup","Sun","Moon","Monitor","Switch"],"mappings":";;;;;;;;;;;;;;;AAOO,MAAMA,IAA0D;AAAA,EACrE,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO,CAAA;AAAA,EACP,SAAS;AAAA,IACP,YAAY;AAAA,MACV,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,QAAQ;AAAA,YACN,MAAM;AAAA,YACN,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,QAEF,UAAU,CAAC,QAAQ;AAAA,MAAA;AAAA,MAErB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,QAAQ,MAAM,sBAAsB;AAAA,MACjE,QAAQ,CAACC,GAAQC,MAA6B;AAG5C,QAAAD,EAAO,UAAUC,EAAK,MAAM;AAAA,MAC9B;AAAA,IAAA;AAAA,IAEF,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,SAAS,QAAQ,QAAQ,IAAE;AAAA,QACzD,UAAU,CAAC,OAAO;AAAA,MAAA;AAAA,MAEpB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,UAAU;AAAA,QACR,EAAE,MAAM,EAAE,OAAO,OAAA,GAAU,MAAM,4BA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B;AAAA,sBACV;AAAA,oBAAA;AAAA,oBAEF,WAAU;AAAA,oBAEV,UAAA,gBAAAmB;AAAA,sBAACY;AAAA,sBAAA;AAAA,wBACC,OAAO/B,EAAE,iDAAiD;AAAA,wBAC1D,WAAU;AAAA,wBACV,MAAK;AAAA,wBACL,SAASkB;AAAA,wBACT,iBAAiB,CAACP,MAChBT,EAAM,iBAAiBS,IAAO,eAAe,SAAS;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBAE1D;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAAA,EACF,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEArB,EAAe,cAAc;"}
@@ -5,7 +5,7 @@ import { useTranslation as T } from "react-i18next";
5
5
  import { _ as y, R as ee } from "./index-4xgbg-sn.js";
6
6
  import { I as ae } from "./icon-button-C_kbcd7I.js";
7
7
  import { P as C } from "./popover-Cc0a69sw.js";
8
- import { h as A, a as _ } from "./flag-DZ6V7-hU.js";
8
+ import { h as A, a as _ } from "./flag-Cnmivlrl.js";
9
9
  import { c as se, a as te, d as re } from "./input-surface-xyERuLU_.js";
10
10
  import { LOCALES_WITH_BUNDLES as j } from "../i18n/config.js";
11
11
  import { u as oe } from "./use-locale-BkCIHujH.js";
@@ -736,4 +736,4 @@ export {
736
736
  I as b,
737
737
  k as c
738
738
  };
739
- //# sourceMappingURL=locale-picker-GNF3lo8K.js.map
739
+ //# sourceMappingURL=locale-picker-EyvPrwDc.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"locale-picker-GNF3lo8K.js","sources":["../../src/i18n/locale-meta.ts","../../src/components/locale-picker/locale-picker.agent.ts","../../src/components/locale-picker/locale-picker.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Locale metadata registry. */\n/* */\n/* Single source of truth for human-facing locale information — native */\n/* name, English name, flag emoji, and writing direction. Consumed by */\n/* LocalePicker / HeaderSettings to render the language switcher. */\n/* */\n/* Keys must match `LOCALES_WITH_BUNDLES` from `./resources` 1:1; the */\n/* `locale-meta.test.ts` parity check fails the build if a code is */\n/* added to one and not the other. */\n/* */\n/* Flag emojis use the Regional Indicator pair convention — a few of */\n/* the codes are language tags rather than country tags (en, ar, hi); */\n/* the flag chosen is the \"default-region\" the kit ships marketing */\n/* surfaces in. Consumers that need a different region flag (e.g. */\n/* British vs. American English) can override via `LOCALE_META[code]`. */\n/* -------------------------------------------------------------------- */\n\nimport { LOCALES_WITH_BUNDLES } from './resources';\n\n/** Reading direction. Mirrors the shape of `hooks/use-locale.ts#LocaleDir`. */\nexport type LocaleDir = 'ltr' | 'rtl';\n\n/** IETF locale tag from the kit's bundled set. */\nexport type Locale = (typeof LOCALES_WITH_BUNDLES)[number];\n\nexport interface LocaleMetaEntry {\n /** IETF locale tag (matches the key in `LOCALES_WITH_BUNDLES`). */\n code: Locale;\n /** Endonym — the locale's name in its own language (\"Italiano\", \"العربية\"). */\n nativeName: string;\n /** Exonym — the locale's name in English (\"Italian\", \"Arabic\"). */\n englishName: string;\n /**\n * ISO 3166-1 alpha-2 country code for the default-region flag. Feed\n * to the kit's `<Flag country={…} />` component to render the actual\n * flag SVG (NOT the emoji glyph — those don't paint on Windows and\n * lose fidelity at hero sizes). A few language tags here aren't tied\n * to a single country (en, ar, hi); we pick the AlfaDocs default\n * marketing region — consumers needing a different region flag\n * override at the call site.\n */\n countryCode: string;\n /**\n * Regional-indicator flag emoji. Retained as a fallback for non-DOM\n * contexts (terminal logs, plain-text exports) and the rare consumer\n * surface that can't mount the kit's `Flag` component. UI surfaces\n * should always reach for `countryCode` + `<Flag />` instead.\n */\n flag: string;\n /** Reading direction. */\n dir: LocaleDir;\n}\n\n/**\n * Canonical metadata for every locale shipped in `LOCALES_WITH_BUNDLES`.\n * Order matches the bundled-locales array so iteration is stable.\n */\nexport const LOCALE_META: Record<Locale, LocaleMetaEntry> = {\n en: {\n code: 'en',\n nativeName: 'English',\n englishName: 'English',\n countryCode: 'GB',\n flag: '🇬🇧',\n dir: 'ltr',\n },\n it: {\n code: 'it',\n nativeName: 'Italiano',\n englishName: 'Italian',\n countryCode: 'IT',\n flag: '🇮🇹',\n dir: 'ltr',\n },\n de: {\n code: 'de',\n nativeName: 'Deutsch',\n englishName: 'German',\n countryCode: 'DE',\n flag: '🇩🇪',\n dir: 'ltr',\n },\n ar: {\n code: 'ar',\n nativeName: 'العربية',\n englishName: 'Arabic',\n countryCode: 'SA',\n flag: '🇸🇦',\n dir: 'rtl',\n },\n fr: {\n code: 'fr',\n nativeName: 'Français',\n englishName: 'French',\n countryCode: 'FR',\n flag: '🇫🇷',\n dir: 'ltr',\n },\n es: {\n code: 'es',\n nativeName: 'Español',\n englishName: 'Spanish',\n countryCode: 'ES',\n flag: '🇪🇸',\n dir: 'ltr',\n },\n pt: {\n code: 'pt',\n nativeName: 'Português',\n englishName: 'Portuguese',\n countryCode: 'PT',\n flag: '🇵🇹',\n dir: 'ltr',\n },\n nl: {\n code: 'nl',\n nativeName: 'Nederlands',\n englishName: 'Dutch',\n countryCode: 'NL',\n flag: '🇳🇱',\n dir: 'ltr',\n },\n ro: {\n code: 'ro',\n nativeName: 'Română',\n englishName: 'Romanian',\n countryCode: 'RO',\n flag: '🇷🇴',\n dir: 'ltr',\n },\n sq: {\n code: 'sq',\n nativeName: 'Shqip',\n englishName: 'Albanian',\n countryCode: 'AL',\n flag: '🇦🇱',\n dir: 'ltr',\n },\n tr: {\n code: 'tr',\n nativeName: 'Türkçe',\n englishName: 'Turkish',\n countryCode: 'TR',\n flag: '🇹🇷',\n dir: 'ltr',\n },\n pl: {\n code: 'pl',\n nativeName: 'Polski',\n englishName: 'Polish',\n countryCode: 'PL',\n flag: '🇵🇱',\n dir: 'ltr',\n },\n sv: {\n code: 'sv',\n nativeName: 'Svenska',\n englishName: 'Swedish',\n countryCode: 'SE',\n flag: '🇸🇪',\n dir: 'ltr',\n },\n ru: {\n code: 'ru',\n nativeName: 'Русский',\n englishName: 'Russian',\n countryCode: 'RU',\n flag: '🇷🇺',\n dir: 'ltr',\n },\n el: {\n code: 'el',\n nativeName: 'Ελληνικά',\n englishName: 'Greek',\n countryCode: 'GR',\n flag: '🇬🇷',\n dir: 'ltr',\n },\n ja: {\n code: 'ja',\n nativeName: '日本語',\n englishName: 'Japanese',\n countryCode: 'JP',\n flag: '🇯🇵',\n dir: 'ltr',\n },\n zh: {\n code: 'zh',\n nativeName: '中文',\n englishName: 'Chinese',\n countryCode: 'CN',\n flag: '🇨🇳',\n dir: 'ltr',\n },\n hi: {\n code: 'hi',\n nativeName: 'हिन्दी',\n englishName: 'Hindi',\n countryCode: 'IN',\n flag: '🇮🇳',\n dir: 'ltr',\n },\n};\n\n/**\n * Canonical (i18n-parity) order — used when consumers need the same\n * sequence as `LOCALES_WITH_BUNDLES` (e.g. generating fixtures or\n * snapshot keys). Pickers / menus should use `LOCALE_LIST` instead,\n * which sorts alphabetically.\n */\nexport const LOCALE_LIST_CANONICAL: readonly LocaleMetaEntry[] =\n LOCALES_WITH_BUNDLES.map((code) => LOCALE_META[code]);\n\n/**\n * Picker-facing list — sorted alphabetically by English name so the\n * order is deterministic and language-independent. End users searching\n * by native name use the picker's input box to filter; the visible\n * order doesn't depend on the active locale's collation.\n *\n * \"System Default\" (the OS-driven fallback) is rendered separately at\n * the top of `LocalePicker.SearchList` — not in this list — so the\n * alphabetical order here applies to the 18 explicit locale rows only.\n */\nexport const LOCALE_LIST: readonly LocaleMetaEntry[] = [\n ...LOCALES_WITH_BUNDLES.map((code) => LOCALE_META[code]),\n].sort((a, b) => a.englishName.localeCompare(b.englishName, 'en'));\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — LocalePicker. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { LocalePickerHandle } from './locale-picker';\n\nexport const localePickerAgent: AgentAdapter<LocalePickerHandle> = {\n id: 'locale-picker',\n // Persists a single locale choice via the handle's `setLocale` → set_value.\n capabilities: ['set_value'],\n state: {},\n actions: {\n set_locale: {\n safety: 'write',\n argsType: '{ locale: string }',\n argsSchema: {\n type: 'object',\n properties: {\n locale: {\n type: 'string',\n description:\n 'IETF language tag (e.g. \"en\", \"it\"). Unsupported tags are a no-op.',\n },\n },\n required: ['locale'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.localePicker.actions.setLocale',\n description: 'Switch the active locale to the given IETF tag.',\n invoke: (handle, args: { locale: string }) => {\n // The handle's own implementation gates against\n // `LOCALES_WITH_BUNDLES`, so a tag the kit doesn't ship is a\n // no-op rather than a runtime crash.\n handle.setLocale(args.locale);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'locale-picker',\n description: 'Marks the LocalePicker wrapper.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type Ref,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Check, Globe, Monitor } from 'lucide-react';\nimport { Command, defaultFilter } from 'cmdk';\nimport { IconButton } from '../button/icon-button';\nimport { Popover } from '../popover/popover';\nimport { Flag, hasFlag } from '../flag/flag';\nimport {\n INPUT_SURFACE_CHROME,\n INPUT_SURFACE_HEIGHT,\n INPUT_SURFACE_PADDING_X,\n} from '../_shared/input-surface';\nimport { LOCALE_LIST, LOCALE_META, type Locale } from '../../i18n/locale-meta';\nimport { LOCALES_WITH_BUNDLES } from '../../i18n/config';\nimport { useLocale } from '../../hooks/use-locale';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { localePickerAgent } from './locale-picker.agent';\n\n/* ------------------------------------------------------------------ */\n/* Persistence + browser-locale detection */\n/* */\n/* The first mount of a LocalePicker after a fresh page load runs a */\n/* one-shot detection: if no locale has ever been persisted, read */\n/* navigator.language, normalise to the base tag (`it-IT` → `it`), */\n/* and adopt it if the kit ships a matching bundle. Fall back to */\n/* `en` if not. Result is persisted so a subsequent page load */\n/* respects the user choice without re-detecting. */\n/* */\n/* Module-level flag — the detection must fire once per app */\n/* lifecycle, not once per LocalePicker instance, since HeaderSettings */\n/* + a standalone picker can both be mounted simultaneously. */\n/* ------------------------------------------------------------------ */\n\nexport const LOCALE_STORAGE_KEY = 'alfadocs-ui.locale';\n\n/**\n * Sentinel value (and Combobox-row key) for \"follow the browser /\n * OS locale\". Mirrors the ThemeToggle's `'system'` preference: the\n * picker doesn't store a concrete locale code; the runtime resolves\n * to `navigator.language` on each mount.\n */\nexport const LOCALE_SYSTEM_DEFAULT = 'system' as const;\nexport type LocalePreference = Locale | typeof LOCALE_SYSTEM_DEFAULT;\n\nlet detectionFired = false;\n\nfunction isSupportedLocale(value: unknown): value is Locale {\n return (\n typeof value === 'string' &&\n (LOCALES_WITH_BUNDLES as readonly string[]).includes(value)\n );\n}\n\nfunction safeReadStorage(key: string): string | null {\n if (typeof window === 'undefined') return null;\n try {\n return window.localStorage.getItem(key);\n } catch {\n return null;\n }\n}\n\nfunction safeWriteStorage(key: string, value: string): void {\n if (typeof window === 'undefined') return;\n try {\n window.localStorage.setItem(key, value);\n } catch {\n /* Storage can throw in private mode / when quota is exceeded — the\n in-memory state is the source of truth. Same silent-fail shape\n as use-theme.ts. */\n }\n}\n\nfunction detectBrowserLocale(): Locale {\n if (typeof navigator === 'undefined') return 'en';\n const raw = navigator.language;\n if (!raw) return 'en';\n const base = raw.toLowerCase().split('-')[0];\n return isSupportedLocale(base) ? base : 'en';\n}\n\nfunction applyDocumentAttrs(locale: Locale): void {\n if (typeof document === 'undefined') return;\n const root = document.documentElement;\n root.lang = locale;\n root.dir = LOCALE_META[locale].dir;\n}\n\n/* ------------------------------------------------------------------ */\n/* Shared state hook */\n/* */\n/* Centralises the setLocale wrapper so both the standalone picker */\n/* and the inline `LocalePicker.SearchList` share one source of truth: */\n/* 1. delegate to `useLocale().setLocale` (the i18next change) */\n/* 2. set `document.documentElement.dir` + `lang` */\n/* 3. persist to localStorage at `alfadocs-ui.locale` */\n/* ------------------------------------------------------------------ */\n\ninterface LocalePickerState {\n /** Resolved locale actually applied to the page (always concrete). */\n locale: Locale;\n /**\n * True when the resolved locale came from `navigator.language`\n * rather than an explicit user choice (i.e. no localStorage entry).\n * Used to mark the \"System Default\" row as the active selection\n * until the user picks a specific locale.\n */\n isSystemDefault: boolean;\n /**\n * Switch to a specific locale (persists) OR back to the System\n * Default (clears the localStorage entry and re-detects).\n */\n setLocale: (next: LocalePreference) => void;\n}\n\nfunction safeRemoveStorage(key: string): void {\n if (typeof window === 'undefined') return;\n try {\n window.localStorage.removeItem(key);\n } catch {\n /* private mode etc. — silent fail per the rest of the file. */\n }\n}\n\nfunction useLocalePickerState(): LocalePickerState {\n const { locale: rawLocale, setLocale: setLocaleI18n } = useLocale();\n const [isSystemDefault, setIsSystemDefault] = useState<boolean>(\n () => safeReadStorage(LOCALE_STORAGE_KEY) === null,\n );\n\n // Coerce the i18next-reported locale to the supported set so consumers\n // never see an un-bundled tag (e.g. when the host app pre-loads\n // `en-US` before the kit's resources land).\n const locale: Locale = isSupportedLocale(rawLocale) ? rawLocale : 'en';\n\n const setLocale = useCallback(\n (next: LocalePreference) => {\n if (next === LOCALE_SYSTEM_DEFAULT) {\n // Clear persistence + re-resolve to navigator.language.\n safeRemoveStorage(LOCALE_STORAGE_KEY);\n const detected = detectBrowserLocale();\n void setLocaleI18n(detected);\n applyDocumentAttrs(detected);\n setIsSystemDefault(true);\n return;\n }\n if (!isSupportedLocale(next)) return;\n void setLocaleI18n(next);\n applyDocumentAttrs(next);\n safeWriteStorage(LOCALE_STORAGE_KEY, next);\n setIsSystemDefault(false);\n },\n [setLocaleI18n],\n );\n\n // One-shot detection on first LocalePicker mount per app lifecycle.\n useEffect(() => {\n if (detectionFired) return;\n detectionFired = true;\n const stored = safeReadStorage(LOCALE_STORAGE_KEY);\n if (isSupportedLocale(stored)) {\n // User-chosen value persists — keep i18next + document in sync.\n if (stored !== rawLocale) void setLocaleI18n(stored);\n applyDocumentAttrs(stored);\n return;\n }\n // No stored value → we're in System Default mode. Detect, apply,\n // but do NOT persist (so the System Default selection stays\n // sticky across reloads until the user explicitly chooses).\n const detected = detectBrowserLocale();\n void setLocaleI18n(detected);\n applyDocumentAttrs(detected);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- intentional one-shot detection\n }, []);\n\n return { locale, isSystemDefault, setLocale };\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst wrapperVariants = cva('ds:inline-flex ds:items-center', {\n variants: {\n variant: {\n icon: '',\n compact: '',\n },\n },\n defaultVariants: { variant: 'icon' },\n});\n\nconst compactTriggerClasses = [\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-sm)]',\n 'ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]',\n 'ds:bg-transparent ds:text-foreground',\n 'ds:hover:bg-muted',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:disabled:opacity-50 ds:disabled:cursor-not-allowed',\n 'type-body-sm',\n].join(' ');\n\nconst popoverContentClasses = [\n 'ds:w-[18rem] ds:rounded-[var(--radius-md)]',\n 'ds:bg-background ds:text-foreground ds:border ds:border-border',\n 'ds:shadow-[var(--shadow-lg)]',\n 'ds:overflow-hidden',\n].join(' ');\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type LocalePickerVariant = 'icon' | 'compact';\n\nexport interface LocalePickerProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>,\n VariantProps<typeof wrapperVariants> {\n variant?: LocalePickerVariant;\n /**\n * Controlled escape hatch — when omitted the picker reads/writes\n * `useLocale()` directly so a bare `<LocalePicker />` works with no\n * wiring. Pass both to opt into controlled mode.\n */\n value?: Locale;\n onValueChange?: (next: LocalePreference) => void;\n /** Disable interaction (greys out the trigger). */\n disabled?: boolean;\n /** Mark as busy (kept open / focusable but read-only). */\n loading?: boolean;\n /**\n * Side the search popover opens onto, relative to the trigger.\n * Defaults to `bottom` (standard dropdown). Use `end` (inline-end —\n * right in LTR, left in RTL) when nesting the LocalePicker inside\n * another popover/menu so the search surface flies out to the side\n * rather than stacking below.\n */\n popoverSide?: 'top' | 'bottom' | 'start' | 'end';\n}\n\n/**\n * Curated imperative handle for agent / external automation. The\n * `setLocale` parameter is widened to `string` (rather than the\n * narrower `Locale`) so untyped agent inputs don't have to thread the\n * `LOCALES_WITH_BUNDLES` constraint at the call site — the\n * implementation validates internally and no-ops on an unsupported\n * tag.\n */\nexport interface LocalePickerHandle {\n setLocale: (next: string) => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* LocalePicker.SearchList — the inline searchable list */\n/* */\n/* HeaderSettings renders this directly inside its DropdownMenu so the */\n/* same UX is reused without nesting another popover. Standalone the */\n/* root component renders this same widget inside a Popover. */\n/* ------------------------------------------------------------------ */\n\nexport interface LocalePickerSearchListProps {\n /**\n * Active selection. Either a `Locale` code or the\n * `LOCALE_SYSTEM_DEFAULT` sentinel (when the user hasn't made an\n * explicit choice and the kit is following `navigator.language`).\n * Defaults to the shared store.\n */\n value?: LocalePreference;\n /**\n * Fires after a successful selection. Accepts a concrete `Locale`\n * or `LOCALE_SYSTEM_DEFAULT` (when the user picks the \"System\n * Default\" row at the top of the list).\n *\n * Defaults to the shared setter (delegates to useLocale, persists\n * or clears storage, updates document.dir/lang).\n */\n onValueChange?: (next: LocalePreference) => void;\n /** Optional id for the search input (axe `aria-labelledby` chain). */\n inputId?: string;\n /** Disable the input + list interactions. */\n disabled?: boolean;\n /** Mark as busy (read-only). */\n loading?: boolean;\n className?: string;\n}\n\nconst searchListVariants = cva('ds:flex ds:flex-col', {\n variants: {\n loading: {\n true: 'ds:opacity-60 ds:pointer-events-none',\n false: '',\n },\n },\n defaultVariants: { loading: false },\n});\n\nexport const LocalePickerSearchList = forwardRef<\n HTMLDivElement,\n LocalePickerSearchListProps\n>(\n (\n {\n value: valueProp,\n onValueChange,\n inputId: inputIdProp,\n disabled = false,\n loading = false,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const store = useLocalePickerState();\n // Resolved-to-render-with: which locale name to display for\n // \"System Default ({{nativeName}})\". Always a concrete Locale.\n const resolvedLocale = store.locale;\n // Selection-state: the picker's current value is either an\n // explicit Locale or the System Default sentinel.\n const currentSelection: LocalePreference =\n valueProp ??\n (store.isSystemDefault ? LOCALE_SYSTEM_DEFAULT : store.locale);\n const generatedId = useId();\n const inputId = inputIdProp ?? `${generatedId}-search`;\n const [search, setSearch] = useState('');\n\n const handleSelect = useCallback(\n (code: string) => {\n if (disabled || loading) return;\n if (code === LOCALE_SYSTEM_DEFAULT) {\n if (onValueChange) {\n onValueChange(LOCALE_SYSTEM_DEFAULT);\n } else {\n store.setLocale(LOCALE_SYSTEM_DEFAULT);\n }\n return;\n }\n if (!isSupportedLocale(code)) return;\n if (onValueChange) {\n onValueChange(code);\n } else {\n store.setLocale(code);\n }\n },\n [disabled, loading, onValueChange, store],\n );\n\n return (\n <div\n ref={ref}\n className={[searchListVariants({ loading }), className]\n .filter(Boolean)\n .join(' ')}\n data-component=\"locale-picker-search-list\"\n >\n <Command\n label={t('navigation.localePicker.commandLabel')}\n // Defer to cmdk's defaultFilter — it ranks against both the\n // Item's `value` (the locale code) and `keywords` (the\n // native + English names), which is exactly the haystack we\n // want users to be able to match against. The Item's `value`\n // alone wouldn't surface \"jap\" → 日本語 because the code is\n // `ja`; the keyword \"Japanese\" handles that match.\n filter={defaultFilter}\n shouldFilter\n >\n {/* Input chrome borrows the kit's standard INPUT_SURFACE\n tokens (same as Combobox / Autocomplete) so the search\n field reads as a first-class kit input rather than a\n one-off list header. The wrapper carries the border /\n padding / focus-within ring; the inner Command.Input\n keeps its outline-less peer styling. */}\n <div\n className={[\n INPUT_SURFACE_CHROME,\n INPUT_SURFACE_HEIGHT.sm,\n INPUT_SURFACE_PADDING_X.sm,\n 'ds:flex ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:m-[var(--spacing-xs)]',\n ].join(' ')}\n >\n <Globe\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-muted-foreground ds:shrink-0\"\n />\n <Command.Input\n id={inputId}\n value={search}\n onValueChange={setSearch}\n placeholder={t('navigation.localePicker.searchPlaceholder')}\n aria-label={t('navigation.localePicker.searchLabel')}\n disabled={disabled || loading}\n className={[\n 'ds:peer ds:flex-1 ds:bg-transparent ds:border-0 ds:outline-none',\n 'ds:placeholder:text-muted-foreground ds:text-foreground',\n 'ds:text-[length:var(--font-size-sm)]',\n ].join(' ')}\n />\n </div>\n <Command.List\n className={[\n 'ds:max-h-[18rem] ds:overflow-y-auto',\n 'ds:p-[var(--spacing-xs)]',\n ].join(' ')}\n >\n <Command.Empty\n className={[\n 'ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-sm)]',\n 'type-body-sm ds:text-muted-foreground',\n ].join(' ')}\n >\n {t('navigation.localePicker.empty')}\n </Command.Empty>\n\n {/* \"System Default\" — always the first row. Selected when\n the user hasn't picked an explicit locale; selecting it\n clears the localStorage entry and re-resolves to\n navigator.language. Mirrors the `'system'` value in\n ThemeToggle. */}\n {(() => {\n const isSystemSelected =\n currentSelection === LOCALE_SYSTEM_DEFAULT;\n const resolvedEntry = LOCALE_META[resolvedLocale];\n return (\n <Command.Item\n key={LOCALE_SYSTEM_DEFAULT}\n value={LOCALE_SYSTEM_DEFAULT}\n keywords={[\n 'system',\n 'default',\n 'auto',\n 'browser',\n resolvedEntry.nativeName,\n resolvedEntry.englishName,\n ]}\n disabled={disabled || loading}\n onSelect={handleSelect}\n className={[\n 'ds:relative ds:flex ds:cursor-pointer ds:select-none',\n 'ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]',\n 'ds:text-foreground ds:outline-none',\n 'ds:data-[highlighted]:bg-muted',\n 'ds:aria-selected:bg-muted',\n 'ds:aria-disabled:opacity-50 ds:aria-disabled:cursor-not-allowed',\n ].join(' ')}\n aria-selected={isSystemSelected || undefined}\n data-current={isSystemSelected ? 'true' : undefined}\n >\n <Monitor\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-muted-foreground ds:shrink-0\"\n />\n <span className=\"ds:flex-1 ds:min-w-0 ds:truncate type-body-sm\">\n {t('navigation.localePicker.systemDefault', {\n locale: resolvedEntry.nativeName,\n })}\n </span>\n {isSystemSelected ? (\n <Check\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-primary ds:shrink-0\"\n />\n ) : null}\n {isSystemSelected ? (\n <span className=\"ds:sr-only\">\n {t('navigation.localePicker.currentSelection')}\n </span>\n ) : null}\n </Command.Item>\n );\n })()}\n\n {LOCALE_LIST.map((entry) => {\n const isSelected = currentSelection === entry.code;\n return (\n <Command.Item\n key={entry.code}\n value={entry.code}\n keywords={[entry.nativeName, entry.englishName]}\n disabled={disabled || loading}\n onSelect={handleSelect}\n className={[\n 'ds:relative ds:flex ds:cursor-pointer ds:select-none',\n 'ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]',\n 'ds:text-foreground ds:outline-none',\n 'ds:data-[highlighted]:bg-muted',\n 'ds:aria-selected:bg-muted',\n 'ds:aria-disabled:opacity-50 ds:aria-disabled:cursor-not-allowed',\n ].join(' ')}\n aria-selected={isSelected || undefined}\n data-current={isSelected ? 'true' : undefined}\n // `lang` on the row triggers font-cascade selection\n // so Arabic / Japanese / Devanagari / Greek glyphs\n // paint via the Noto Sans family. Intentionally\n // omits `dir` — the row layout follows the picker\n // surface's direction (LTR menu = LTR row, RTL menu\n // = RTL row). Setting `dir=\"rtl\"` per Arabic row\n // would flip just THAT row inside an LTR menu, which\n // breaks the visual rhythm with neighbouring rows.\n // Arabic text within the row still renders RTL at\n // the character level (script-driven) regardless.\n lang={entry.code}\n >\n {hasFlag(entry.countryCode) ? (\n <Flag\n country={entry.countryCode}\n size=\"sm\"\n shape=\"rectangle\"\n rounded=\"sm\"\n className=\"ds:shrink-0\"\n />\n ) : (\n /* hasFlag fallback: render the emoji glyph only\n when the kit doesn't ship an SVG for this\n country code. All 18 bundled locales currently\n have SVG flags, so this is dead code on the\n canonical set — kept for resilience when\n consumers extend the registry. */\n <span\n aria-hidden=\"true\"\n className=\"ds:text-base ds:shrink-0\"\n >\n {entry.flag}\n </span>\n )}\n <span className=\"ds:flex-1 ds:min-w-0 ds:truncate type-body-sm\">\n {entry.nativeName}\n </span>\n {isSelected ? (\n <Check\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-primary ds:shrink-0\"\n />\n ) : null}\n {isSelected ? (\n <span className=\"ds:sr-only\">\n {t('navigation.localePicker.currentSelection')}\n </span>\n ) : null}\n </Command.Item>\n );\n })}\n </Command.List>\n </Command>\n </div>\n );\n },\n);\nLocalePickerSearchList.displayName = 'LocalePicker.SearchList';\n\n/* ------------------------------------------------------------------ */\n/* LocalePicker root — icon + compact trigger variants */\n/* ------------------------------------------------------------------ */\n\ninterface VariantRenderProps {\n state: LocalePickerState;\n rest: HTMLAttributes<HTMLDivElement>;\n forwardedRef: Ref<HTMLDivElement>;\n className?: string;\n disabled: boolean;\n loading: boolean;\n popoverSide: 'top' | 'bottom' | 'start' | 'end';\n}\n\nfunction IconTrigger({\n state,\n rest,\n forwardedRef,\n className,\n disabled,\n loading,\n popoverSide,\n}: VariantRenderProps) {\n const { t } = useTranslation();\n const entry = LOCALE_META[state.locale];\n return (\n <div\n ref={forwardedRef}\n data-component=\"locale-picker\"\n data-component-id={rest.id}\n className={wrapperVariants({ variant: 'icon', className })}\n {...rest}\n >\n <Popover.Root>\n <Popover.Trigger asChild>\n <IconButton\n disabled={disabled || loading}\n icon={\n <span className=\"ds:relative ds:inline-flex ds:items-center ds:justify-center\">\n <Globe aria-hidden className=\"ds:size-5\" />\n {hasFlag(entry.countryCode) ? (\n <Flag\n country={entry.countryCode}\n size=\"sm\"\n shape=\"rectangle\"\n rounded=\"sm\"\n className={[\n // Corner chip overlaying the globe glyph.\n // `outline` paints a thin background-coloured\n // ring around the flag so it reads as a chip\n // rather than blending into the globe edge.\n 'ds:absolute ds:bottom-[-3px] ds:end-[-5px]',\n 'ds:outline ds:outline-2 ds:outline-background',\n // Scale down to chip size — Flag's sm tile is\n // larger than the original emoji glyph.\n 'ds:scale-75 ds:origin-bottom-end',\n ].join(' ')}\n />\n ) : null}\n </span>\n }\n aria-label={t('navigation.localePicker.trigger', {\n locale: entry.nativeName,\n })}\n />\n </Popover.Trigger>\n <Popover.Content\n side={popoverSide}\n align=\"start\"\n sideOffset={8}\n className={popoverContentClasses}\n aria-label={t('navigation.localePicker.popupLabel')}\n >\n <LocalePickerSearchList\n value={state.locale}\n onValueChange={state.setLocale}\n disabled={disabled}\n loading={loading}\n />\n </Popover.Content>\n </Popover.Root>\n </div>\n );\n}\n\nfunction CompactTrigger({\n state,\n rest,\n forwardedRef,\n className,\n disabled,\n loading,\n popoverSide,\n}: VariantRenderProps) {\n const { t } = useTranslation();\n const entry = LOCALE_META[state.locale];\n return (\n <div\n ref={forwardedRef}\n data-component=\"locale-picker\"\n data-component-id={rest.id}\n className={wrapperVariants({ variant: 'compact', className })}\n {...rest}\n >\n <Popover.Root>\n <Popover.Trigger asChild>\n <button\n type=\"button\"\n disabled={disabled || loading}\n className={compactTriggerClasses}\n aria-label={t('navigation.localePicker.trigger', {\n locale: entry.nativeName,\n })}\n >\n {hasFlag(entry.countryCode) ? (\n <Flag\n country={entry.countryCode}\n size=\"sm\"\n shape=\"rectangle\"\n rounded=\"sm\"\n className=\"ds:shrink-0\"\n />\n ) : (\n <Globe aria-hidden className=\"ds:size-4 ds:shrink-0\" />\n )}\n <span\n className=\"ds:flex-1 ds:truncate type-body-sm\"\n lang={entry.code}\n >\n {entry.nativeName}\n </span>\n </button>\n </Popover.Trigger>\n <Popover.Content\n side={popoverSide}\n align=\"start\"\n sideOffset={8}\n className={popoverContentClasses}\n aria-label={t('navigation.localePicker.popupLabel')}\n >\n <LocalePickerSearchList\n value={state.locale}\n onValueChange={state.setLocale}\n disabled={disabled}\n loading={loading}\n />\n </Popover.Content>\n </Popover.Root>\n </div>\n );\n}\n\nconst LocalePickerRoot = forwardRef<HTMLDivElement, LocalePickerProps>(\n (props, ref) => {\n const {\n variant = 'icon',\n value,\n onValueChange,\n disabled = false,\n loading = false,\n popoverSide = 'bottom',\n className,\n id,\n ...rest\n } = props as LocalePickerProps & { id?: string };\n\n const store = useLocalePickerState();\n const resolvedLocale = value ?? store.locale;\n\n // Controlled overlay: when a consumer passes `onValueChange`, route\n // selections to them instead of the shared store. Document attrs +\n // localStorage are still updated so the picker behaves consistently\n // either way.\n const setLocale = useCallback(\n (next: LocalePreference) => {\n if (onValueChange) {\n onValueChange(next);\n // Side-effects in controlled mode: still write through to\n // the persistence + document attrs so the rest of the page\n // re-renders even though we're routing state to the consumer.\n if (next === LOCALE_SYSTEM_DEFAULT) {\n safeRemoveStorage(LOCALE_STORAGE_KEY);\n const detected = detectBrowserLocale();\n applyDocumentAttrs(detected);\n } else if (isSupportedLocale(next)) {\n applyDocumentAttrs(next);\n safeWriteStorage(LOCALE_STORAGE_KEY, next);\n }\n return;\n }\n store.setLocale(next);\n },\n [onValueChange, store],\n );\n\n const state: LocalePickerState = useMemo(\n () => ({\n locale: resolvedLocale,\n isSystemDefault: store.isSystemDefault,\n setLocale,\n }),\n [resolvedLocale, store.isSystemDefault, setLocale],\n );\n\n const forwardedRef = useRef<HTMLDivElement | null>(null);\n useImperativeHandle(ref, () => forwardedRef.current as HTMLDivElement, []);\n\n const stateRef = useRef(state);\n stateRef.current = state;\n const agentHandle = useMemo<LocalePickerHandle>(\n () => ({\n setLocale: (next: string) => {\n if (isSupportedLocale(next)) {\n stateRef.current.setLocale(next);\n }\n },\n }),\n [],\n );\n useAgentRegistration(localePickerAgent, agentHandle, id);\n\n if (variant === 'compact') {\n return (\n <CompactTrigger\n state={state}\n rest={rest}\n forwardedRef={forwardedRef}\n className={className}\n disabled={disabled}\n loading={loading}\n popoverSide={popoverSide}\n />\n );\n }\n return (\n <IconTrigger\n state={state}\n rest={rest}\n forwardedRef={forwardedRef}\n className={className}\n disabled={disabled}\n loading={loading}\n popoverSide={popoverSide}\n />\n );\n },\n);\nLocalePickerRoot.displayName = 'LocalePicker';\n\nexport const LocalePicker = Object.assign(LocalePickerRoot, {\n SearchList: LocalePickerSearchList,\n});\n"],"names":["LOCALE_META","LOCALES_WITH_BUNDLES","code","LOCALE_LIST","a","b","localePickerAgent","handle","args","LOCALE_STORAGE_KEY","LOCALE_SYSTEM_DEFAULT","detectionFired","isSupportedLocale","value","safeReadStorage","key","safeWriteStorage","detectBrowserLocale","raw","base","applyDocumentAttrs","locale","root","safeRemoveStorage","useLocalePickerState","rawLocale","setLocaleI18n","useLocale","isSystemDefault","setIsSystemDefault","useState","setLocale","useCallback","next","detected","useEffect","stored","wrapperVariants","cva","compactTriggerClasses","popoverContentClasses","searchListVariants","LocalePickerSearchList","forwardRef","valueProp","onValueChange","inputIdProp","disabled","loading","className","ref","t","useTranslation","store","resolvedLocale","currentSelection","generatedId","useId","inputId","search","setSearch","handleSelect","jsx","jsxs","Command","defaultFilter","INPUT_SURFACE_CHROME","INPUT_SURFACE_HEIGHT","INPUT_SURFACE_PADDING_X","Globe","isSystemSelected","resolvedEntry","Monitor","Check","entry","isSelected","hasFlag","Flag","IconTrigger","state","rest","forwardedRef","popoverSide","Popover","IconButton","CompactTrigger","LocalePickerRoot","props","variant","id","useMemo","useRef","useImperativeHandle","stateRef","agentHandle","useAgentRegist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AAAA,MAAA;AAAA,MAEF,CAAA;AAAA,IAAC;AAIH,WAFA8D,GAAqBzF,IAAmBwF,GAAaL,CAAE,GAEnDD,MAAY,YAEZ,gBAAA1B;AAAA,MAACuB;AAAA,MAAA;AAAA,QACC,OAAAN;AAAA,QACA,MAAAC;AAAA,QACA,cAAAC;AAAA,QACA,WAAAhC;AAAA,QACA,UAAAF;AAAA,QACA,SAAAC;AAAA,QACA,aAAAkC;AAAA,MAAA;AAAA,IAAA,IAKJ,gBAAApB;AAAA,MAACgB;AAAA,MAAA;AAAA,QACC,OAAAC;AAAA,QACA,MAAAC;AAAA,QACA,cAAAC;AAAA,QACA,WAAAhC;AAAA,QACA,UAAAF;AAAA,QACA,SAAAC;AAAA,QACA,aAAAkC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AACAI,EAAiB,cAAc;AAExB,MAAMU,KAAe,OAAO,OAAOV,GAAkB;AAAA,EAC1D,YAAY5C;AACd,CAAC;"}
1
+ {"version":3,"file":"locale-picker-EyvPrwDc.js","sources":["../../src/i18n/locale-meta.ts","../../src/components/locale-picker/locale-picker.agent.ts","../../src/components/locale-picker/locale-picker.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Locale metadata registry. */\n/* */\n/* Single source of truth for human-facing locale information — native */\n/* name, English name, flag emoji, and writing direction. Consumed by */\n/* LocalePicker / HeaderSettings to render the language switcher. */\n/* */\n/* Keys must match `LOCALES_WITH_BUNDLES` from `./resources` 1:1; the */\n/* `locale-meta.test.ts` parity check fails the build if a code is */\n/* added to one and not the other. */\n/* */\n/* Flag emojis use the Regional Indicator pair convention — a few of */\n/* the codes are language tags rather than country tags (en, ar, hi); */\n/* the flag chosen is the \"default-region\" the kit ships marketing */\n/* surfaces in. Consumers that need a different region flag (e.g. */\n/* British vs. American English) can override via `LOCALE_META[code]`. */\n/* -------------------------------------------------------------------- */\n\nimport { LOCALES_WITH_BUNDLES } from './resources';\n\n/** Reading direction. Mirrors the shape of `hooks/use-locale.ts#LocaleDir`. */\nexport type LocaleDir = 'ltr' | 'rtl';\n\n/** IETF locale tag from the kit's bundled set. */\nexport type Locale = (typeof LOCALES_WITH_BUNDLES)[number];\n\nexport interface LocaleMetaEntry {\n /** IETF locale tag (matches the key in `LOCALES_WITH_BUNDLES`). */\n code: Locale;\n /** Endonym — the locale's name in its own language (\"Italiano\", \"العربية\"). */\n nativeName: string;\n /** Exonym — the locale's name in English (\"Italian\", \"Arabic\"). */\n englishName: string;\n /**\n * ISO 3166-1 alpha-2 country code for the default-region flag. Feed\n * to the kit's `<Flag country={…} />` component to render the actual\n * flag SVG (NOT the emoji glyph — those don't paint on Windows and\n * lose fidelity at hero sizes). A few language tags here aren't tied\n * to a single country (en, ar, hi); we pick the AlfaDocs default\n * marketing region — consumers needing a different region flag\n * override at the call site.\n */\n countryCode: string;\n /**\n * Regional-indicator flag emoji. Retained as a fallback for non-DOM\n * contexts (terminal logs, plain-text exports) and the rare consumer\n * surface that can't mount the kit's `Flag` component. UI surfaces\n * should always reach for `countryCode` + `<Flag />` instead.\n */\n flag: string;\n /** Reading direction. */\n dir: LocaleDir;\n}\n\n/**\n * Canonical metadata for every locale shipped in `LOCALES_WITH_BUNDLES`.\n * Order matches the bundled-locales array so iteration is stable.\n */\nexport const LOCALE_META: Record<Locale, LocaleMetaEntry> = {\n en: {\n code: 'en',\n nativeName: 'English',\n englishName: 'English',\n countryCode: 'GB',\n flag: '🇬🇧',\n dir: 'ltr',\n },\n it: {\n code: 'it',\n nativeName: 'Italiano',\n englishName: 'Italian',\n countryCode: 'IT',\n flag: '🇮🇹',\n dir: 'ltr',\n },\n de: {\n code: 'de',\n nativeName: 'Deutsch',\n englishName: 'German',\n countryCode: 'DE',\n flag: '🇩🇪',\n dir: 'ltr',\n },\n ar: {\n code: 'ar',\n nativeName: 'العربية',\n englishName: 'Arabic',\n countryCode: 'SA',\n flag: '🇸🇦',\n dir: 'rtl',\n },\n fr: {\n code: 'fr',\n nativeName: 'Français',\n englishName: 'French',\n countryCode: 'FR',\n flag: '🇫🇷',\n dir: 'ltr',\n },\n es: {\n code: 'es',\n nativeName: 'Español',\n englishName: 'Spanish',\n countryCode: 'ES',\n flag: '🇪🇸',\n dir: 'ltr',\n },\n pt: {\n code: 'pt',\n nativeName: 'Português',\n englishName: 'Portuguese',\n countryCode: 'PT',\n flag: '🇵🇹',\n dir: 'ltr',\n },\n nl: {\n code: 'nl',\n nativeName: 'Nederlands',\n englishName: 'Dutch',\n countryCode: 'NL',\n flag: '🇳🇱',\n dir: 'ltr',\n },\n ro: {\n code: 'ro',\n nativeName: 'Română',\n englishName: 'Romanian',\n countryCode: 'RO',\n flag: '🇷🇴',\n dir: 'ltr',\n },\n sq: {\n code: 'sq',\n nativeName: 'Shqip',\n englishName: 'Albanian',\n countryCode: 'AL',\n flag: '🇦🇱',\n dir: 'ltr',\n },\n tr: {\n code: 'tr',\n nativeName: 'Türkçe',\n englishName: 'Turkish',\n countryCode: 'TR',\n flag: '🇹🇷',\n dir: 'ltr',\n },\n pl: {\n code: 'pl',\n nativeName: 'Polski',\n englishName: 'Polish',\n countryCode: 'PL',\n flag: '🇵🇱',\n dir: 'ltr',\n },\n sv: {\n code: 'sv',\n nativeName: 'Svenska',\n englishName: 'Swedish',\n countryCode: 'SE',\n flag: '🇸🇪',\n dir: 'ltr',\n },\n ru: {\n code: 'ru',\n nativeName: 'Русский',\n englishName: 'Russian',\n countryCode: 'RU',\n flag: '🇷🇺',\n dir: 'ltr',\n },\n el: {\n code: 'el',\n nativeName: 'Ελληνικά',\n englishName: 'Greek',\n countryCode: 'GR',\n flag: '🇬🇷',\n dir: 'ltr',\n },\n ja: {\n code: 'ja',\n nativeName: '日本語',\n englishName: 'Japanese',\n countryCode: 'JP',\n flag: '🇯🇵',\n dir: 'ltr',\n },\n zh: {\n code: 'zh',\n nativeName: '中文',\n englishName: 'Chinese',\n countryCode: 'CN',\n flag: '🇨🇳',\n dir: 'ltr',\n },\n hi: {\n code: 'hi',\n nativeName: 'हिन्दी',\n englishName: 'Hindi',\n countryCode: 'IN',\n flag: '🇮🇳',\n dir: 'ltr',\n },\n};\n\n/**\n * Canonical (i18n-parity) order — used when consumers need the same\n * sequence as `LOCALES_WITH_BUNDLES` (e.g. generating fixtures or\n * snapshot keys). Pickers / menus should use `LOCALE_LIST` instead,\n * which sorts alphabetically.\n */\nexport const LOCALE_LIST_CANONICAL: readonly LocaleMetaEntry[] =\n LOCALES_WITH_BUNDLES.map((code) => LOCALE_META[code]);\n\n/**\n * Picker-facing list — sorted alphabetically by English name so the\n * order is deterministic and language-independent. End users searching\n * by native name use the picker's input box to filter; the visible\n * order doesn't depend on the active locale's collation.\n *\n * \"System Default\" (the OS-driven fallback) is rendered separately at\n * the top of `LocalePicker.SearchList` — not in this list — so the\n * alphabetical order here applies to the 18 explicit locale rows only.\n */\nexport const LOCALE_LIST: readonly LocaleMetaEntry[] = [\n ...LOCALES_WITH_BUNDLES.map((code) => LOCALE_META[code]),\n].sort((a, b) => a.englishName.localeCompare(b.englishName, 'en'));\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — LocalePicker. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { LocalePickerHandle } from './locale-picker';\n\nexport const localePickerAgent: AgentAdapter<LocalePickerHandle> = {\n id: 'locale-picker',\n // Persists a single locale choice via the handle's `setLocale` → set_value.\n capabilities: ['set_value'],\n state: {},\n actions: {\n set_locale: {\n safety: 'write',\n argsType: '{ locale: string }',\n argsSchema: {\n type: 'object',\n properties: {\n locale: {\n type: 'string',\n description:\n 'IETF language tag (e.g. \"en\", \"it\"). Unsupported tags are a no-op.',\n },\n },\n required: ['locale'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.localePicker.actions.setLocale',\n description: 'Switch the active locale to the given IETF tag.',\n invoke: (handle, args: { locale: string }) => {\n // The handle's own implementation gates against\n // `LOCALES_WITH_BUNDLES`, so a tag the kit doesn't ship is a\n // no-op rather than a runtime crash.\n handle.setLocale(args.locale);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'locale-picker',\n description: 'Marks the LocalePicker wrapper.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type Ref,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Check, Globe, Monitor } from 'lucide-react';\nimport { Command, defaultFilter } from 'cmdk';\nimport { IconButton } from '../button/icon-button';\nimport { Popover } from '../popover/popover';\nimport { Flag, hasFlag } from '../flag/flag';\nimport {\n INPUT_SURFACE_CHROME,\n INPUT_SURFACE_HEIGHT,\n INPUT_SURFACE_PADDING_X,\n} from '../_shared/input-surface';\nimport { LOCALE_LIST, LOCALE_META, type Locale } from '../../i18n/locale-meta';\nimport { LOCALES_WITH_BUNDLES } from '../../i18n/config';\nimport { useLocale } from '../../hooks/use-locale';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { localePickerAgent } from './locale-picker.agent';\n\n/* ------------------------------------------------------------------ */\n/* Persistence + browser-locale detection */\n/* */\n/* The first mount of a LocalePicker after a fresh page load runs a */\n/* one-shot detection: if no locale has ever been persisted, read */\n/* navigator.language, normalise to the base tag (`it-IT` → `it`), */\n/* and adopt it if the kit ships a matching bundle. Fall back to */\n/* `en` if not. Result is persisted so a subsequent page load */\n/* respects the user choice without re-detecting. */\n/* */\n/* Module-level flag — the detection must fire once per app */\n/* lifecycle, not once per LocalePicker instance, since HeaderSettings */\n/* + a standalone picker can both be mounted simultaneously. */\n/* ------------------------------------------------------------------ */\n\nexport const LOCALE_STORAGE_KEY = 'alfadocs-ui.locale';\n\n/**\n * Sentinel value (and Combobox-row key) for \"follow the browser /\n * OS locale\". Mirrors the ThemeToggle's `'system'` preference: the\n * picker doesn't store a concrete locale code; the runtime resolves\n * to `navigator.language` on each mount.\n */\nexport const LOCALE_SYSTEM_DEFAULT = 'system' as const;\nexport type LocalePreference = Locale | typeof LOCALE_SYSTEM_DEFAULT;\n\nlet detectionFired = false;\n\nfunction isSupportedLocale(value: unknown): value is Locale {\n return (\n typeof value === 'string' &&\n (LOCALES_WITH_BUNDLES as readonly string[]).includes(value)\n );\n}\n\nfunction safeReadStorage(key: string): string | null {\n if (typeof window === 'undefined') return null;\n try {\n return window.localStorage.getItem(key);\n } catch {\n return null;\n }\n}\n\nfunction safeWriteStorage(key: string, value: string): void {\n if (typeof window === 'undefined') return;\n try {\n window.localStorage.setItem(key, value);\n } catch {\n /* Storage can throw in private mode / when quota is exceeded — the\n in-memory state is the source of truth. Same silent-fail shape\n as use-theme.ts. */\n }\n}\n\nfunction detectBrowserLocale(): Locale {\n if (typeof navigator === 'undefined') return 'en';\n const raw = navigator.language;\n if (!raw) return 'en';\n const base = raw.toLowerCase().split('-')[0];\n return isSupportedLocale(base) ? base : 'en';\n}\n\nfunction applyDocumentAttrs(locale: Locale): void {\n if (typeof document === 'undefined') return;\n const root = document.documentElement;\n root.lang = locale;\n root.dir = LOCALE_META[locale].dir;\n}\n\n/* ------------------------------------------------------------------ */\n/* Shared state hook */\n/* */\n/* Centralises the setLocale wrapper so both the standalone picker */\n/* and the inline `LocalePicker.SearchList` share one source of truth: */\n/* 1. delegate to `useLocale().setLocale` (the i18next change) */\n/* 2. set `document.documentElement.dir` + `lang` */\n/* 3. persist to localStorage at `alfadocs-ui.locale` */\n/* ------------------------------------------------------------------ */\n\ninterface LocalePickerState {\n /** Resolved locale actually applied to the page (always concrete). */\n locale: Locale;\n /**\n * True when the resolved locale came from `navigator.language`\n * rather than an explicit user choice (i.e. no localStorage entry).\n * Used to mark the \"System Default\" row as the active selection\n * until the user picks a specific locale.\n */\n isSystemDefault: boolean;\n /**\n * Switch to a specific locale (persists) OR back to the System\n * Default (clears the localStorage entry and re-detects).\n */\n setLocale: (next: LocalePreference) => void;\n}\n\nfunction safeRemoveStorage(key: string): void {\n if (typeof window === 'undefined') return;\n try {\n window.localStorage.removeItem(key);\n } catch {\n /* private mode etc. — silent fail per the rest of the file. */\n }\n}\n\nfunction useLocalePickerState(): LocalePickerState {\n const { locale: rawLocale, setLocale: setLocaleI18n } = useLocale();\n const [isSystemDefault, setIsSystemDefault] = useState<boolean>(\n () => safeReadStorage(LOCALE_STORAGE_KEY) === null,\n );\n\n // Coerce the i18next-reported locale to the supported set so consumers\n // never see an un-bundled tag (e.g. when the host app pre-loads\n // `en-US` before the kit's resources land).\n const locale: Locale = isSupportedLocale(rawLocale) ? rawLocale : 'en';\n\n const setLocale = useCallback(\n (next: LocalePreference) => {\n if (next === LOCALE_SYSTEM_DEFAULT) {\n // Clear persistence + re-resolve to navigator.language.\n safeRemoveStorage(LOCALE_STORAGE_KEY);\n const detected = detectBrowserLocale();\n void setLocaleI18n(detected);\n applyDocumentAttrs(detected);\n setIsSystemDefault(true);\n return;\n }\n if (!isSupportedLocale(next)) return;\n void setLocaleI18n(next);\n applyDocumentAttrs(next);\n safeWriteStorage(LOCALE_STORAGE_KEY, next);\n setIsSystemDefault(false);\n },\n [setLocaleI18n],\n );\n\n // One-shot detection on first LocalePicker mount per app lifecycle.\n useEffect(() => {\n if (detectionFired) return;\n detectionFired = true;\n const stored = safeReadStorage(LOCALE_STORAGE_KEY);\n if (isSupportedLocale(stored)) {\n // User-chosen value persists — keep i18next + document in sync.\n if (stored !== rawLocale) void setLocaleI18n(stored);\n applyDocumentAttrs(stored);\n return;\n }\n // No stored value → we're in System Default mode. Detect, apply,\n // but do NOT persist (so the System Default selection stays\n // sticky across reloads until the user explicitly chooses).\n const detected = detectBrowserLocale();\n void setLocaleI18n(detected);\n applyDocumentAttrs(detected);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- intentional one-shot detection\n }, []);\n\n return { locale, isSystemDefault, setLocale };\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst wrapperVariants = cva('ds:inline-flex ds:items-center', {\n variants: {\n variant: {\n icon: '',\n compact: '',\n },\n },\n defaultVariants: { variant: 'icon' },\n});\n\nconst compactTriggerClasses = [\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-sm)]',\n 'ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]',\n 'ds:bg-transparent ds:text-foreground',\n 'ds:hover:bg-muted',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:disabled:opacity-50 ds:disabled:cursor-not-allowed',\n 'type-body-sm',\n].join(' ');\n\nconst popoverContentClasses = [\n 'ds:w-[18rem] ds:rounded-[var(--radius-md)]',\n 'ds:bg-background ds:text-foreground ds:border ds:border-border',\n 'ds:shadow-[var(--shadow-lg)]',\n 'ds:overflow-hidden',\n].join(' ');\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type LocalePickerVariant = 'icon' | 'compact';\n\nexport interface LocalePickerProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>,\n VariantProps<typeof wrapperVariants> {\n variant?: LocalePickerVariant;\n /**\n * Controlled escape hatch — when omitted the picker reads/writes\n * `useLocale()` directly so a bare `<LocalePicker />` works with no\n * wiring. Pass both to opt into controlled mode.\n */\n value?: Locale;\n onValueChange?: (next: LocalePreference) => void;\n /** Disable interaction (greys out the trigger). */\n disabled?: boolean;\n /** Mark as busy (kept open / focusable but read-only). */\n loading?: boolean;\n /**\n * Side the search popover opens onto, relative to the trigger.\n * Defaults to `bottom` (standard dropdown). Use `end` (inline-end —\n * right in LTR, left in RTL) when nesting the LocalePicker inside\n * another popover/menu so the search surface flies out to the side\n * rather than stacking below.\n */\n popoverSide?: 'top' | 'bottom' | 'start' | 'end';\n}\n\n/**\n * Curated imperative handle for agent / external automation. The\n * `setLocale` parameter is widened to `string` (rather than the\n * narrower `Locale`) so untyped agent inputs don't have to thread the\n * `LOCALES_WITH_BUNDLES` constraint at the call site — the\n * implementation validates internally and no-ops on an unsupported\n * tag.\n */\nexport interface LocalePickerHandle {\n setLocale: (next: string) => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* LocalePicker.SearchList — the inline searchable list */\n/* */\n/* HeaderSettings renders this directly inside its DropdownMenu so the */\n/* same UX is reused without nesting another popover. Standalone the */\n/* root component renders this same widget inside a Popover. */\n/* ------------------------------------------------------------------ */\n\nexport interface LocalePickerSearchListProps {\n /**\n * Active selection. Either a `Locale` code or the\n * `LOCALE_SYSTEM_DEFAULT` sentinel (when the user hasn't made an\n * explicit choice and the kit is following `navigator.language`).\n * Defaults to the shared store.\n */\n value?: LocalePreference;\n /**\n * Fires after a successful selection. Accepts a concrete `Locale`\n * or `LOCALE_SYSTEM_DEFAULT` (when the user picks the \"System\n * Default\" row at the top of the list).\n *\n * Defaults to the shared setter (delegates to useLocale, persists\n * or clears storage, updates document.dir/lang).\n */\n onValueChange?: (next: LocalePreference) => void;\n /** Optional id for the search input (axe `aria-labelledby` chain). */\n inputId?: string;\n /** Disable the input + list interactions. */\n disabled?: boolean;\n /** Mark as busy (read-only). */\n loading?: boolean;\n className?: string;\n}\n\nconst searchListVariants = cva('ds:flex ds:flex-col', {\n variants: {\n loading: {\n true: 'ds:opacity-60 ds:pointer-events-none',\n false: '',\n },\n },\n defaultVariants: { loading: false },\n});\n\nexport const LocalePickerSearchList = forwardRef<\n HTMLDivElement,\n LocalePickerSearchListProps\n>(\n (\n {\n value: valueProp,\n onValueChange,\n inputId: inputIdProp,\n disabled = false,\n loading = false,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const store = useLocalePickerState();\n // Resolved-to-render-with: which locale name to display for\n // \"System Default ({{nativeName}})\". Always a concrete Locale.\n const resolvedLocale = store.locale;\n // Selection-state: the picker's current value is either an\n // explicit Locale or the System Default sentinel.\n const currentSelection: LocalePreference =\n valueProp ??\n (store.isSystemDefault ? LOCALE_SYSTEM_DEFAULT : store.locale);\n const generatedId = useId();\n const inputId = inputIdProp ?? `${generatedId}-search`;\n const [search, setSearch] = useState('');\n\n const handleSelect = useCallback(\n (code: string) => {\n if (disabled || loading) return;\n if (code === LOCALE_SYSTEM_DEFAULT) {\n if (onValueChange) {\n onValueChange(LOCALE_SYSTEM_DEFAULT);\n } else {\n store.setLocale(LOCALE_SYSTEM_DEFAULT);\n }\n return;\n }\n if (!isSupportedLocale(code)) return;\n if (onValueChange) {\n onValueChange(code);\n } else {\n store.setLocale(code);\n }\n },\n [disabled, loading, onValueChange, store],\n );\n\n return (\n <div\n ref={ref}\n className={[searchListVariants({ loading }), className]\n .filter(Boolean)\n .join(' ')}\n data-component=\"locale-picker-search-list\"\n >\n <Command\n label={t('navigation.localePicker.commandLabel')}\n // Defer to cmdk's defaultFilter — it ranks against both the\n // Item's `value` (the locale code) and `keywords` (the\n // native + English names), which is exactly the haystack we\n // want users to be able to match against. The Item's `value`\n // alone wouldn't surface \"jap\" → 日本語 because the code is\n // `ja`; the keyword \"Japanese\" handles that match.\n filter={defaultFilter}\n shouldFilter\n >\n {/* Input chrome borrows the kit's standard INPUT_SURFACE\n tokens (same as Combobox / Autocomplete) so the search\n field reads as a first-class kit input rather than a\n one-off list header. The wrapper carries the border /\n padding / focus-within ring; the inner Command.Input\n keeps its outline-less peer styling. */}\n <div\n className={[\n INPUT_SURFACE_CHROME,\n INPUT_SURFACE_HEIGHT.sm,\n INPUT_SURFACE_PADDING_X.sm,\n 'ds:flex ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:m-[var(--spacing-xs)]',\n ].join(' ')}\n >\n <Globe\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-muted-foreground ds:shrink-0\"\n />\n <Command.Input\n id={inputId}\n value={search}\n onValueChange={setSearch}\n placeholder={t('navigation.localePicker.searchPlaceholder')}\n aria-label={t('navigation.localePicker.searchLabel')}\n disabled={disabled || loading}\n className={[\n 'ds:peer ds:flex-1 ds:bg-transparent ds:border-0 ds:outline-none',\n 'ds:placeholder:text-muted-foreground ds:text-foreground',\n 'ds:text-[length:var(--font-size-sm)]',\n ].join(' ')}\n />\n </div>\n <Command.List\n className={[\n 'ds:max-h-[18rem] ds:overflow-y-auto',\n 'ds:p-[var(--spacing-xs)]',\n ].join(' ')}\n >\n <Command.Empty\n className={[\n 'ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-sm)]',\n 'type-body-sm ds:text-muted-foreground',\n ].join(' ')}\n >\n {t('navigation.localePicker.empty')}\n </Command.Empty>\n\n {/* \"System Default\" — always the first row. Selected when\n the user hasn't picked an explicit locale; selecting it\n clears the localStorage entry and re-resolves to\n navigator.language. Mirrors the `'system'` value in\n ThemeToggle. */}\n {(() => {\n const isSystemSelected =\n currentSelection === LOCALE_SYSTEM_DEFAULT;\n const resolvedEntry = LOCALE_META[resolvedLocale];\n return (\n <Command.Item\n key={LOCALE_SYSTEM_DEFAULT}\n value={LOCALE_SYSTEM_DEFAULT}\n keywords={[\n 'system',\n 'default',\n 'auto',\n 'browser',\n resolvedEntry.nativeName,\n resolvedEntry.englishName,\n ]}\n disabled={disabled || loading}\n onSelect={handleSelect}\n className={[\n 'ds:relative ds:flex ds:cursor-pointer ds:select-none',\n 'ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]',\n 'ds:text-foreground ds:outline-none',\n 'ds:data-[highlighted]:bg-muted',\n 'ds:aria-selected:bg-muted',\n 'ds:aria-disabled:opacity-50 ds:aria-disabled:cursor-not-allowed',\n ].join(' ')}\n aria-selected={isSystemSelected || undefined}\n data-current={isSystemSelected ? 'true' : undefined}\n >\n <Monitor\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-muted-foreground ds:shrink-0\"\n />\n <span className=\"ds:flex-1 ds:min-w-0 ds:truncate type-body-sm\">\n {t('navigation.localePicker.systemDefault', {\n locale: resolvedEntry.nativeName,\n })}\n </span>\n {isSystemSelected ? (\n <Check\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-primary ds:shrink-0\"\n />\n ) : null}\n {isSystemSelected ? (\n <span className=\"ds:sr-only\">\n {t('navigation.localePicker.currentSelection')}\n </span>\n ) : null}\n </Command.Item>\n );\n })()}\n\n {LOCALE_LIST.map((entry) => {\n const isSelected = currentSelection === entry.code;\n return (\n <Command.Item\n key={entry.code}\n value={entry.code}\n keywords={[entry.nativeName, entry.englishName]}\n disabled={disabled || loading}\n onSelect={handleSelect}\n className={[\n 'ds:relative ds:flex ds:cursor-pointer ds:select-none',\n 'ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]',\n 'ds:text-foreground ds:outline-none',\n 'ds:data-[highlighted]:bg-muted',\n 'ds:aria-selected:bg-muted',\n 'ds:aria-disabled:opacity-50 ds:aria-disabled:cursor-not-allowed',\n ].join(' ')}\n aria-selected={isSelected || undefined}\n data-current={isSelected ? 'true' : undefined}\n // `lang` on the row triggers font-cascade selection\n // so Arabic / Japanese / Devanagari / Greek glyphs\n // paint via the Noto Sans family. Intentionally\n // omits `dir` — the row layout follows the picker\n // surface's direction (LTR menu = LTR row, RTL menu\n // = RTL row). Setting `dir=\"rtl\"` per Arabic row\n // would flip just THAT row inside an LTR menu, which\n // breaks the visual rhythm with neighbouring rows.\n // Arabic text within the row still renders RTL at\n // the character level (script-driven) regardless.\n lang={entry.code}\n >\n {hasFlag(entry.countryCode) ? (\n <Flag\n country={entry.countryCode}\n size=\"sm\"\n shape=\"rectangle\"\n rounded=\"sm\"\n className=\"ds:shrink-0\"\n />\n ) : (\n /* hasFlag fallback: render the emoji glyph only\n when the kit doesn't ship an SVG for this\n country code. All 18 bundled locales currently\n have SVG flags, so this is dead code on the\n canonical set — kept for resilience when\n consumers extend the registry. */\n <span\n aria-hidden=\"true\"\n className=\"ds:text-base ds:shrink-0\"\n >\n {entry.flag}\n </span>\n )}\n <span className=\"ds:flex-1 ds:min-w-0 ds:truncate type-body-sm\">\n {entry.nativeName}\n </span>\n {isSelected ? (\n <Check\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-primary ds:shrink-0\"\n />\n ) : null}\n {isSelected ? (\n <span className=\"ds:sr-only\">\n {t('navigation.localePicker.currentSelection')}\n </span>\n ) : null}\n </Command.Item>\n );\n })}\n </Command.List>\n </Command>\n </div>\n );\n },\n);\nLocalePickerSearchList.displayName = 'LocalePicker.SearchList';\n\n/* ------------------------------------------------------------------ */\n/* LocalePicker root — icon + compact trigger variants */\n/* ------------------------------------------------------------------ */\n\ninterface VariantRenderProps {\n state: LocalePickerState;\n rest: HTMLAttributes<HTMLDivElement>;\n forwardedRef: Ref<HTMLDivElement>;\n className?: string;\n disabled: boolean;\n loading: boolean;\n popoverSide: 'top' | 'bottom' | 'start' | 'end';\n}\n\nfunction IconTrigger({\n state,\n rest,\n forwardedRef,\n className,\n disabled,\n loading,\n popoverSide,\n}: VariantRenderProps) {\n const { t } = useTranslation();\n const entry = LOCALE_META[state.locale];\n return (\n <div\n ref={forwardedRef}\n data-component=\"locale-picker\"\n data-component-id={rest.id}\n className={wrapperVariants({ variant: 'icon', className })}\n {...rest}\n >\n <Popover.Root>\n <Popover.Trigger asChild>\n <IconButton\n disabled={disabled || loading}\n icon={\n <span className=\"ds:relative ds:inline-flex ds:items-center ds:justify-center\">\n <Globe aria-hidden className=\"ds:size-5\" />\n {hasFlag(entry.countryCode) ? (\n <Flag\n country={entry.countryCode}\n size=\"sm\"\n shape=\"rectangle\"\n rounded=\"sm\"\n className={[\n // Corner chip overlaying the globe glyph.\n // `outline` paints a thin background-coloured\n // ring around the flag so it reads as a chip\n // rather than blending into the globe edge.\n 'ds:absolute ds:bottom-[-3px] ds:end-[-5px]',\n 'ds:outline ds:outline-2 ds:outline-background',\n // Scale down to chip size — Flag's sm tile is\n // larger than the original emoji glyph.\n 'ds:scale-75 ds:origin-bottom-end',\n ].join(' ')}\n />\n ) : null}\n </span>\n }\n aria-label={t('navigation.localePicker.trigger', {\n locale: entry.nativeName,\n })}\n />\n </Popover.Trigger>\n <Popover.Content\n side={popoverSide}\n align=\"start\"\n sideOffset={8}\n className={popoverContentClasses}\n aria-label={t('navigation.localePicker.popupLabel')}\n >\n <LocalePickerSearchList\n value={state.locale}\n onValueChange={state.setLocale}\n disabled={disabled}\n loading={loading}\n />\n </Popover.Content>\n </Popover.Root>\n </div>\n );\n}\n\nfunction CompactTrigger({\n state,\n rest,\n forwardedRef,\n className,\n disabled,\n loading,\n popoverSide,\n}: VariantRenderProps) {\n const { t } = useTranslation();\n const entry = LOCALE_META[state.locale];\n return (\n <div\n ref={forwardedRef}\n data-component=\"locale-picker\"\n data-component-id={rest.id}\n className={wrapperVariants({ variant: 'compact', className })}\n {...rest}\n >\n <Popover.Root>\n <Popover.Trigger asChild>\n <button\n type=\"button\"\n disabled={disabled || loading}\n className={compactTriggerClasses}\n aria-label={t('navigation.localePicker.trigger', {\n locale: entry.nativeName,\n })}\n >\n {hasFlag(entry.countryCode) ? (\n <Flag\n country={entry.countryCode}\n size=\"sm\"\n shape=\"rectangle\"\n rounded=\"sm\"\n className=\"ds:shrink-0\"\n />\n ) : (\n <Globe aria-hidden className=\"ds:size-4 ds:shrink-0\" />\n )}\n <span\n className=\"ds:flex-1 ds:truncate type-body-sm\"\n lang={entry.code}\n >\n {entry.nativeName}\n </span>\n </button>\n </Popover.Trigger>\n <Popover.Content\n side={popoverSide}\n align=\"start\"\n sideOffset={8}\n className={popoverContentClasses}\n aria-label={t('navigation.localePicker.popupLabel')}\n >\n <LocalePickerSearchList\n value={state.locale}\n onValueChange={state.setLocale}\n disabled={disabled}\n loading={loading}\n />\n </Popover.Content>\n </Popover.Root>\n </div>\n );\n}\n\nconst LocalePickerRoot = forwardRef<HTMLDivElement, LocalePickerProps>(\n (props, ref) => {\n const {\n variant = 'icon',\n value,\n onValueChange,\n disabled = false,\n loading = false,\n popoverSide = 'bottom',\n className,\n id,\n ...rest\n } = props as LocalePickerProps & { id?: string };\n\n const store = useLocalePickerState();\n const resolvedLocale = value ?? store.locale;\n\n // Controlled overlay: when a consumer passes `onValueChange`, route\n // selections to them instead of the shared store. Document attrs +\n // localStorage are still updated so the picker behaves consistently\n // either way.\n const setLocale = useCallback(\n (next: LocalePreference) => {\n if (onValueChange) {\n onValueChange(next);\n // Side-effects in controlled mode: still write through to\n // the persistence + document attrs so the rest of the page\n // re-renders even though we're routing state to the consumer.\n if (next === LOCALE_SYSTEM_DEFAULT) {\n safeRemoveStorage(LOCALE_STORAGE_KEY);\n const detected = detectBrowserLocale();\n applyDocumentAttrs(detected);\n } else if (isSupportedLocale(next)) {\n applyDocumentAttrs(next);\n safeWriteStorage(LOCALE_STORAGE_KEY, next);\n }\n return;\n }\n store.setLocale(next);\n },\n [onValueChange, store],\n );\n\n const state: LocalePickerState = useMemo(\n () => ({\n locale: resolvedLocale,\n isSystemDefault: store.isSystemDefault,\n setLocale,\n }),\n [resolvedLocale, store.isSystemDefault, setLocale],\n );\n\n const forwardedRef = useRef<HTMLDivElement | null>(null);\n useImperativeHandle(ref, () => forwardedRef.current as HTMLDivElement, []);\n\n const stateRef = useRef(state);\n stateRef.current = state;\n const agentHandle = useMemo<LocalePickerHandle>(\n () => ({\n setLocale: (next: string) => {\n if (isSupportedLocale(next)) {\n stateRef.current.setLocale(next);\n }\n },\n }),\n [],\n );\n useAgentRegistration(localePickerAgent, agentHandle, id);\n\n if (variant === 'compact') {\n return (\n <CompactTrigger\n state={state}\n rest={rest}\n forwardedRef={forwardedRef}\n className={className}\n disabled={disabled}\n loading={loading}\n popoverSide={popoverSide}\n />\n );\n }\n return (\n <IconTrigger\n state={state}\n rest={rest}\n forwardedRef={forwardedRef}\n className={className}\n disabled={disabled}\n loading={loading}\n popoverSide={popoverSide}\n />\n );\n },\n);\nLocalePickerRoot.displayName = 'LocalePicker';\n\nexport const LocalePicker = Object.assign(LocalePickerRoot, {\n SearchList: LocalePickerSearchList,\n});\n"],"names":["LOCALE_META","LOCALES_WITH_BUNDLES","code","LOCALE_LIST","a","b","localePickerAgent","handle","args","LOCALE_STORAGE_KEY","LOCALE_SYSTEM_DEFAULT","detectionFired","isSupportedLocale","value","safeReadStorage","key","safeWriteStorage","detectBrowserLocale","raw","base","applyDocumentAttrs","locale","root","safeRemoveStorage","useLocalePickerState","rawLocale","setLocaleI18n","useLocale","isSystemDefault","setIsSystemDefault","useState","setLocale","useCallback","next","detected","useEffect","stored","wrapperVariants","cva","compactTriggerClasses","popoverContentClasses","searchListVariants","LocalePickerSearchList","forwardRef","valueProp","onValueChange","inputIdProp","disabled","loading","className","ref","t","useTranslation","store","resolvedLocale","currentSelection","generatedId","useId","inputId","search","setSearch","handleSelect","jsx","jsxs","Command","defaultFilter","INPUT_SURFACE_CHROME","INPUT_SURFACE_HEIGHT","INPUT_SURFACE_PADDING_X","Globe","isSystemSelected","resolvedEntry","Monitor","Check","entry","isSelected","hasFlag","Flag","IconTrigger","state","rest","forwardedRef","popoverSide","Popover","IconButton","CompactTrigger","LocalePickerRoot","props","variant","id","useMemo","useRef","useImperativeHandle","stateRef","agentHandle","useAgentRegistration","LocalePicker"],"mappings":";;;;;;;;;;;;;;;AA0DO,MAAMA,IAA+C;AAAA,EAC1D,IAAI;AAAA,IACF,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,aAAa;AAAA,IACb,MAAM;AAAA,IACN,KAAK;AAAA,EAAA;AAAA,EAEP,IAAI;AAAA,IACF,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,aAAa;AAAA,IACb,MAAM;AAAA,IACN,KAAK;AAAA,EAAA;AAAA,EAEP,IAAI;AAAA,IACF,MAA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;AAAA,QACA,MAAAC;AAAA,QACA,cAAAC;AAAA,QACA,WAAAhC;AAAA,QACA,UAAAF;AAAA,QACA,SAAAC;AAAA,QACA,aAAAkC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AACAI,EAAiB,cAAc;AAExB,MAAMU,KAAe,OAAO,OAAOV,GAAkB;AAAA,EAC1D,YAAY5C;AACd,CAAC;"}
@@ -9,7 +9,7 @@ import { C as w } from "./card-DPmk26CL.js";
9
9
  import { D as m } from "./dropdown-menu-DU-Hrf33.js";
10
10
  import { T as F } from "./tab-bar-Axhk6xzx.js";
11
11
  import { a as S, H as q, g as G, f as A, e as J, c as K, d as Q } from "./header-CjwasYnn.js";
12
- import { H as U } from "./header-settings-4cwQzeFc.js";
12
+ import { H as U } from "./header-settings-DMfdx0Vq.js";
13
13
  import { S as X } from "./sign-in-with-alfadocs-button-UlYefZpI.js";
14
14
  import { S as Y, a as Z, j as _, k as aa, i as ea, h as z } from "./sidebar-C0PbwJBc.js";
15
15
  import { T as sa } from "./theme-root-BOO73p5t.js";
@@ -510,4 +510,4 @@ export {
510
510
  va as M,
511
511
  g as P
512
512
  };
513
- //# sourceMappingURL=marketplace-app-shell-D_1tF4La.js.map
513
+ //# sourceMappingURL=marketplace-app-shell-Bxq1PYAj.js.map