@alfadocs/ui-kit-debug 1.19.0 → 1.20.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 (68) hide show
  1. package/dist/_chunks/{anamnesis-summary-rows-CRWO8x8g.js → anamnesis-summary-rows-BPSQhxnZ.js} +2 -2
  2. package/dist/_chunks/{anamnesis-summary-rows-CRWO8x8g.js.map → anamnesis-summary-rows-BPSQhxnZ.js.map} +1 -1
  3. package/dist/_chunks/{balance-badge-cell-DNjHODfP.js → balance-badge-cell-BlvFil5p.js} +2 -2
  4. package/dist/_chunks/{balance-badge-cell-DNjHODfP.js.map → balance-badge-cell-BlvFil5p.js.map} +1 -1
  5. package/dist/_chunks/{calendar-workspace-BAouFiA5.js → calendar-workspace-D6kipuvT.js} +85 -71
  6. package/dist/_chunks/{calendar-workspace-BAouFiA5.js.map → calendar-workspace-D6kipuvT.js.map} +1 -1
  7. package/dist/_chunks/{care-plan-card-D-FMfDKH.js → care-plan-card-CQVboTn1.js} +2 -2
  8. package/dist/_chunks/{care-plan-card-D-FMfDKH.js.map → care-plan-card-CQVboTn1.js.map} +1 -1
  9. package/dist/_chunks/{care-plan-entry-card-Bvw_9T-d.js → care-plan-entry-card-jxHkzez5.js} +2 -2
  10. package/dist/_chunks/{care-plan-entry-card-Bvw_9T-d.js.map → care-plan-entry-card-jxHkzez5.js.map} +1 -1
  11. package/dist/_chunks/{data-table-DC5rO3Ty.js → data-table-D7nA8OGL.js} +2 -2
  12. package/dist/_chunks/{data-table-DC5rO3Ty.js.map → data-table-D7nA8OGL.js.map} +1 -1
  13. package/dist/_chunks/{data-table-tabs-D24qj89A.js → data-table-tabs-DVIFkqx_.js} +2 -2
  14. package/dist/_chunks/{data-table-tabs-D24qj89A.js.map → data-table-tabs-DVIFkqx_.js.map} +1 -1
  15. package/dist/_chunks/{field-value-D-vkX9uL.js → field-value-BetdWMA2.js} +2 -2
  16. package/dist/_chunks/{field-value-D-vkX9uL.js.map → field-value-BetdWMA2.js.map} +1 -1
  17. package/dist/_chunks/{file-manager-spc3_khe.js → file-manager-Bsc8-MQQ.js} +2 -2
  18. package/dist/_chunks/{file-manager-spc3_khe.js.map → file-manager-Bsc8-MQQ.js.map} +1 -1
  19. package/dist/_chunks/{header-settings-J-ZCAfir.js → header-settings-DvjZNMhD.js} +2 -2
  20. package/dist/_chunks/{header-settings-J-ZCAfir.js.map → header-settings-DvjZNMhD.js.map} +1 -1
  21. package/dist/_chunks/{icon-picker-ChzpCnZ-.js → icon-picker-DOa89vn3.js} +2 -2
  22. package/dist/_chunks/{icon-picker-ChzpCnZ-.js.map → icon-picker-DOa89vn3.js.map} +1 -1
  23. package/dist/_chunks/{info-tip-C119cwQl.js → info-tip-CADik6WN.js} +2 -2
  24. package/dist/_chunks/{info-tip-C119cwQl.js.map → info-tip-CADik6WN.js.map} +1 -1
  25. package/dist/_chunks/{locale-picker-BvbVjDQ-.js → locale-picker-CwFtqSkt.js} +2 -2
  26. package/dist/_chunks/{locale-picker-BvbVjDQ-.js.map → locale-picker-CwFtqSkt.js.map} +1 -1
  27. package/dist/_chunks/{marketplace-app-shell-DDQXQ8hX.js → marketplace-app-shell-C4AjQmvz.js} +2 -2
  28. package/dist/_chunks/{marketplace-app-shell-DDQXQ8hX.js.map → marketplace-app-shell-C4AjQmvz.js.map} +1 -1
  29. package/dist/_chunks/{notes-panel-DYAtlq_i.js → notes-panel-CTNpsByN.js} +2 -2
  30. package/dist/_chunks/{notes-panel-DYAtlq_i.js.map → notes-panel-CTNpsByN.js.map} +1 -1
  31. package/dist/_chunks/{patient-details-BfzvFnxQ.js → patient-details-1QDA-XOO.js} +2 -2
  32. package/dist/_chunks/{patient-details-BfzvFnxQ.js.map → patient-details-1QDA-XOO.js.map} +1 -1
  33. package/dist/_chunks/{patient-summary-card-D5Vfa321.js → patient-summary-card-C9WBwct-.js} +2 -2
  34. package/dist/_chunks/{patient-summary-card-D5Vfa321.js.map → patient-summary-card-C9WBwct-.js.map} +1 -1
  35. package/dist/_chunks/{popover-Cqcjx-Ny.js → popover-DP6WCVwm.js} +2 -2
  36. package/dist/_chunks/{popover-Cqcjx-Ny.js.map → popover-DP6WCVwm.js.map} +1 -1
  37. package/dist/_chunks/{rich-text-editor-DtbcA6s1.js → rich-text-editor-lSCiE0Zz.js} +2 -2
  38. package/dist/_chunks/{rich-text-editor-DtbcA6s1.js.map → rich-text-editor-lSCiE0Zz.js.map} +1 -1
  39. package/dist/_chunks/{signature-request-CUe903hj.js → signature-request-CwlAmVLw.js} +2 -2
  40. package/dist/_chunks/{signature-request-CUe903hj.js.map → signature-request-CwlAmVLw.js.map} +1 -1
  41. package/dist/_chunks/{tooth-scheme-2IsmbE6w.js → tooth-scheme-C9jssOmy.js} +2 -2
  42. package/dist/_chunks/{tooth-scheme-2IsmbE6w.js.map → tooth-scheme-C9jssOmy.js.map} +1 -1
  43. package/dist/agent-catalog.json +1 -1
  44. package/dist/components/care-plan-card/index.js +1 -1
  45. package/dist/components/care-plan-entry-card/index.js +1 -1
  46. package/dist/components/data-table/index.js +1 -1
  47. package/dist/components/data-table-tabs/index.js +1 -1
  48. package/dist/components/file-manager/index.js +1 -1
  49. package/dist/components/header-settings/index.js +1 -1
  50. package/dist/components/icon-picker/index.js +1 -1
  51. package/dist/components/info-tip/index.js +1 -1
  52. package/dist/components/locale-picker/index.js +1 -1
  53. package/dist/components/notes-panel/index.js +1 -1
  54. package/dist/components/patient-details/index.js +1 -1
  55. package/dist/components/patient-summary-card/index.js +1 -1
  56. package/dist/components/patient-table/index.js +1 -1
  57. package/dist/components/popover/index.js +1 -1
  58. package/dist/components/popover/popover.d.ts +1 -1
  59. package/dist/components/popover/popover.d.ts.map +1 -1
  60. package/dist/components/rich-text-editor/index.js +1 -1
  61. package/dist/components/tooth-scheme/index.js +1 -1
  62. package/dist/index.js +18 -18
  63. package/dist/patterns/anamnesis/index.js +1 -1
  64. package/dist/patterns/calendar/calendar.surface.d.ts.map +1 -1
  65. package/dist/patterns/calendar/index.js +1 -1
  66. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  67. package/dist/patterns/signature-request/index.js +1 -1
  68. package/package.json +1 -1
@@ -6,7 +6,7 @@ import { I as l } from "./icon-button-DA2CAGHZ.js";
6
6
  import { I as M } from "./icon-button-group-VCCod3Hz.js";
7
7
  import { D as r } from "./dropdown-menu-DU-Hrf33.js";
8
8
  import { S as N } from "./switch-OILsBLWo.js";
9
- import { c as S, a as j, L as H } from "./locale-picker-BvbVjDQ-.js";
9
+ import { c as S, a as j, L as H } from "./locale-picker-CwFtqSkt.js";
10
10
  import { u as O } from "./use-locale-BkCIHujH.js";
11
11
  import { u as P } from "./use-theme-CAuo6EYT.js";
12
12
  import { u as V } from "./registry-DvAUVLHh.js";
@@ -332,4 +332,4 @@ J.displayName = "HeaderSettings";
332
332
  export {
333
333
  J as H
334
334
  };
335
- //# sourceMappingURL=header-settings-J-ZCAfir.js.map
335
+ //# sourceMappingURL=header-settings-DvjZNMhD.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"header-settings-J-ZCAfir.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 // Read-back for all three setters. None of these preferences is\n // recoverable from the DOM — `useTheme` resolves preference + OS into\n // a single applied class, so `theme: 'system'` and `theme: 'light'`\n // both paint `.theme-light` — and `set_locale` swallows unknown tags.\n // Without these slots an agent cannot distinguish \"switched to\n // Italian\" from \"the tag was dropped on the floor\". All four are UI\n // preferences: no PHI, no patient-identifiable data (§7).\n state: {\n locale: {\n type: 'string',\n descriptionKey: 'ui.agent.headerSettings.state.locale',\n description:\n 'Active IETF language tag (e.g. \"en\", \"it\", \"ar\"). Read after `set_locale` to confirm the switch landed — an unknown tag is silently dropped and leaves this unchanged.',\n read: (handle) => handle.getLocale(),\n },\n theme: {\n type: \"'light' | 'dark' | 'system'\",\n descriptionKey: 'ui.agent.headerSettings.state.theme',\n description:\n \"Stored base-theme preference. `'system'` means no override is set and the OS decides — read `resolvedTheme` for what is actually painted.\",\n read: (handle) => handle.getTheme(),\n },\n accessibility: {\n type: \"'default' | 'accessible' | 'system'\",\n descriptionKey: 'ui.agent.headerSettings.state.accessibility',\n description:\n \"Stored AAA-contrast preference. `'system'` means no override is set and `prefers-contrast` decides.\",\n read: (handle) => handle.getAccessibility(),\n },\n resolvedTheme: {\n type: \"'light' | 'dark' | 'light-accessible' | 'dark-accessible'\",\n descriptionKey: 'ui.agent.headerSettings.state.resolvedTheme',\n description:\n 'The theme actually applied to the document once preference and OS signals resolve. This is what makes a `set_theme(\"system\")` or `set_accessibility(\"system\")` write verifiable.',\n read: (handle) => handle.getResolvedTheme(),\n },\n },\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:\n 'Switch the active locale to the given IETF tag. Unknown tags are silently dropped — read the `locale` state slot afterwards to confirm.',\n errors: [\n 'Silently ignored when the tag names a locale the kit ships no bundle for — `locale` is unchanged.',\n ],\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:\n 'Switch the theme preference. Verify with the `theme` slot (the stored preference) and `resolvedTheme` (what is actually painted).',\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\" | \"system\" }',\n argsSchema: {\n type: 'object',\n properties: {\n accessibility: {\n enum: ['default', 'accessible', 'system'],\n description:\n \"`'system'` clears the override and follows `prefers-contrast`.\",\n },\n },\n required: ['accessibility'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.headerSettings.actions.setAccessibility',\n description:\n 'Switch the accessibility preference. Verify with the `accessibility` slot (the stored preference) and `resolvedTheme` (what is actually painted).',\n examples: [\n {\n args: { accessibility: 'accessible' },\n note: 'Enable the AAA-accessible profile.',\n },\n ],\n invoke: (\n handle,\n args: { accessibility: 'default' | 'accessible' | 'system' },\n ) => {\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 ResolvedTheme,\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 /* ---- read-back for the three setters above -------------------- */\n /** Active IETF language tag, as i18next resolved it. */\n getLocale: () => string;\n /** Stored base-theme preference (`'system'` when no override is set). */\n getTheme: () => ThemePreference;\n /** Stored AAA-contrast preference (`'system'` when no override is set). */\n getAccessibility: () => AccessibilityPreference;\n /**\n * The theme actually painted once preference + OS signals resolve.\n * `theme: 'system'` and `theme: 'light'` both render `.theme-light`,\n * so this is what makes a `setTheme('system')` write verifiable.\n */\n getResolvedTheme: () => ResolvedTheme;\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 { locale, 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 // Assigned during render (not in an effect) so an agent reading the\n // slot immediately after `set_locale` sees the settled value rather\n // than the pre-commit one.\n const localeRef = useRef(locale);\n localeRef.current = locale;\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 // Read-back. None of the three preferences is recoverable from\n // the DOM: `useTheme` resolves preference + OS into one applied\n // class, so `theme: 'system'` and `theme: 'light'` both paint\n // `.theme-light`. Without these an agent cannot tell a switch\n // that landed from one that was dropped.\n getLocale: () => localeRef.current,\n getTheme: () => themeRef.current.theme,\n getAccessibility: () => themeRef.current.accessibility,\n getResolvedTheme: () => themeRef.current.resolvedTheme,\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","localeRef","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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ1B,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,eAAe;AAAA,MACb,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAW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,EAAuB;AAAA,gBAuBxB,gBAAAF;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,MAAK;AAAA,oBACL,cAAYpB;AAAA,sBACV;AAAA,oBAAA;AAAA,oBAEF,WAAU;AAAA,oBAEV,UAAA,gBAAAoB;AAAA,sBAACY;AAAA,sBAAA;AAAA,wBACC,OAAOhC,EAAE,iDAAiD;AAAA,wBAC1D,WAAU;AAAA,wBACV,MAAK;AAAA,wBACL,SAASmB;AAAA,wBACT,iBAAiB,CAACR,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-DvjZNMhD.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 // Read-back for all three setters. None of these preferences is\n // recoverable from the DOM — `useTheme` resolves preference + OS into\n // a single applied class, so `theme: 'system'` and `theme: 'light'`\n // both paint `.theme-light` — and `set_locale` swallows unknown tags.\n // Without these slots an agent cannot distinguish \"switched to\n // Italian\" from \"the tag was dropped on the floor\". All four are UI\n // preferences: no PHI, no patient-identifiable data (§7).\n state: {\n locale: {\n type: 'string',\n descriptionKey: 'ui.agent.headerSettings.state.locale',\n description:\n 'Active IETF language tag (e.g. \"en\", \"it\", \"ar\"). Read after `set_locale` to confirm the switch landed — an unknown tag is silently dropped and leaves this unchanged.',\n read: (handle) => handle.getLocale(),\n },\n theme: {\n type: \"'light' | 'dark' | 'system'\",\n descriptionKey: 'ui.agent.headerSettings.state.theme',\n description:\n \"Stored base-theme preference. `'system'` means no override is set and the OS decides — read `resolvedTheme` for what is actually painted.\",\n read: (handle) => handle.getTheme(),\n },\n accessibility: {\n type: \"'default' | 'accessible' | 'system'\",\n descriptionKey: 'ui.agent.headerSettings.state.accessibility',\n description:\n \"Stored AAA-contrast preference. `'system'` means no override is set and `prefers-contrast` decides.\",\n read: (handle) => handle.getAccessibility(),\n },\n resolvedTheme: {\n type: \"'light' | 'dark' | 'light-accessible' | 'dark-accessible'\",\n descriptionKey: 'ui.agent.headerSettings.state.resolvedTheme',\n description:\n 'The theme actually applied to the document once preference and OS signals resolve. This is what makes a `set_theme(\"system\")` or `set_accessibility(\"system\")` write verifiable.',\n read: (handle) => handle.getResolvedTheme(),\n },\n },\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:\n 'Switch the active locale to the given IETF tag. Unknown tags are silently dropped — read the `locale` state slot afterwards to confirm.',\n errors: [\n 'Silently ignored when the tag names a locale the kit ships no bundle for — `locale` is unchanged.',\n ],\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:\n 'Switch the theme preference. Verify with the `theme` slot (the stored preference) and `resolvedTheme` (what is actually painted).',\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\" | \"system\" }',\n argsSchema: {\n type: 'object',\n properties: {\n accessibility: {\n enum: ['default', 'accessible', 'system'],\n description:\n \"`'system'` clears the override and follows `prefers-contrast`.\",\n },\n },\n required: ['accessibility'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.headerSettings.actions.setAccessibility',\n description:\n 'Switch the accessibility preference. Verify with the `accessibility` slot (the stored preference) and `resolvedTheme` (what is actually painted).',\n examples: [\n {\n args: { accessibility: 'accessible' },\n note: 'Enable the AAA-accessible profile.',\n },\n ],\n invoke: (\n handle,\n args: { accessibility: 'default' | 'accessible' | 'system' },\n ) => {\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 ResolvedTheme,\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 /* ---- read-back for the three setters above -------------------- */\n /** Active IETF language tag, as i18next resolved it. */\n getLocale: () => string;\n /** Stored base-theme preference (`'system'` when no override is set). */\n getTheme: () => ThemePreference;\n /** Stored AAA-contrast preference (`'system'` when no override is set). */\n getAccessibility: () => AccessibilityPreference;\n /**\n * The theme actually painted once preference + OS signals resolve.\n * `theme: 'system'` and `theme: 'light'` both render `.theme-light`,\n * so this is what makes a `setTheme('system')` write verifiable.\n */\n getResolvedTheme: () => ResolvedTheme;\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 { locale, 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 // Assigned during render (not in an effect) so an agent reading the\n // slot immediately after `set_locale` sees the settled value rather\n // than the pre-commit one.\n const localeRef = useRef(locale);\n localeRef.current = locale;\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 // Read-back. None of the three preferences is recoverable from\n // the DOM: `useTheme` resolves preference + OS into one applied\n // class, so `theme: 'system'` and `theme: 'light'` both paint\n // `.theme-light`. Without these an agent cannot tell a switch\n // that landed from one that was dropped.\n getLocale: () => localeRef.current,\n getTheme: () => themeRef.current.theme,\n getAccessibility: () => themeRef.current.accessibility,\n getResolvedTheme: () => themeRef.current.resolvedTheme,\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","localeRef","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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ1B,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,eAAe;AAAA,MACb,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,iBAAA;AAAA,IAAiB;AAAA,IAE5C,eAAe;AAAA,MACb,MAAM;AAAA,MACN,gBAAgB;AAAA,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AAYpB;AAAA,sBACV;AAAA,oBAAA;AAAA,oBAEF,WAAU;AAAA,oBAEV,UAAA,gBAAAoB;AAAA,sBAACY;AAAA,sBAAA;AAAA,wBACC,OAAOhC,EAAE,iDAAiD;AAAA,wBAC1D,WAAU;AAAA,wBACV,MAAK;AAAA,wBACL,SAASmB;AAAA,wBACT,iBAAiB,CAACR,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;"}
@@ -2,7 +2,7 @@ import { jsxs as N, jsx as r } from "react/jsx-runtime";
2
2
  import { forwardRef as H, useState as y, useRef as h, useCallback as v, useMemo as b } from "react";
3
3
  import { c as M } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as F } from "react-i18next";
5
- import { P as k } from "./popover-Cqcjx-Ny.js";
5
+ import { P as k } from "./popover-DP6WCVwm.js";
6
6
  import { B as D } from "./button-nJaPh_HC.js";
7
7
  import { T as E } from "./text-input-CUvCb6ST.js";
8
8
  import { u as G } from "./registry-DvAUVLHh.js";
@@ -269,4 +269,4 @@ export {
269
269
  X as I,
270
270
  U as i
271
271
  };
272
- //# sourceMappingURL=icon-picker-ChzpCnZ-.js.map
272
+ //# sourceMappingURL=icon-picker-DOa89vn3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"icon-picker-ChzpCnZ-.js","sources":["../../src/components/icon-picker/icon-picker.agent.ts","../../src/components/icon-picker/icon-picker.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — IconPicker. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { IconPickerHandle } from './icon-picker';\n\nexport const iconPickerAgent: AgentAdapter<IconPickerHandle> = {\n id: 'icon-picker',\n capabilities: ['pick', 'filter', 'open', 'close'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.iconPicker.state.value',\n description:\n 'Id of the currently selected icon, or an empty string when nothing is picked.',\n read: (handle) => handle.getValue(),\n },\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.iconPicker.state.isOpen',\n description: 'True when the picker popover is currently open.',\n read: (handle) => handle.isOpen(),\n },\n query: {\n type: 'string',\n descriptionKey: 'ui.agent.iconPicker.state.query',\n description: 'Current search query filtering the icon grid by label.',\n read: (handle) => handle.getQuery(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Id of an icon in the supplied `icons` set.',\n },\n },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.iconPicker.actions.setValue',\n description: 'Select the icon with the given id.',\n examples: [{ args: { id: 'star' }, note: 'Pick the \"star\" icon.' }],\n invoke: (handle, args: { id: string }) => {\n handle.setValue(args.id);\n },\n },\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.iconPicker.actions.open',\n description: 'Open the picker popover.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.iconPicker.actions.close',\n description: 'Close the picker popover.',\n invoke: (handle) => {\n handle.close();\n },\n },\n filter: {\n safety: 'write',\n argsType: '{ query: string }',\n argsSchema: {\n type: 'object',\n properties: {\n query: {\n type: 'string',\n description:\n 'Case-insensitive substring matched against icon labels.',\n },\n },\n required: ['query'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.iconPicker.actions.filter',\n description: 'Filter the icon grid to labels containing the query.',\n examples: [\n {\n args: { query: 'star' },\n note: 'Show icons whose label contains \"star\".',\n },\n ],\n invoke: (handle, args: { query: string }) => {\n handle.setQuery(args.query);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'icon-picker',\n description: 'Marks the IconPicker trigger button.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type ReactNode,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Search } from 'lucide-react';\nimport { Popover } from '../popover';\nimport { Button } from '../button/button';\nimport { TextInput } from '../text-input/text-input';\nimport { useAgentRegistration } from '../../agent';\nimport { iconPickerAgent } from './icon-picker.agent';\n\n/** One selectable glyph. `label` is the accessible name (consumer-localised);\n * `node` is the rendered lucide/SVG element. */\nexport interface IconPickerIcon {\n id: string;\n label: string;\n node: ReactNode;\n}\n\n/** Agent-readiness curated handle for IconPicker. */\nexport interface IconPickerHandle {\n getValue: () => string;\n setValue: (id: string) => void;\n isOpen: () => boolean;\n open: () => void;\n close: () => void;\n getQuery: () => string;\n setQuery: (query: string) => void;\n}\n\nexport interface IconPickerProps {\n /** The glyph set. `label` is each glyph's accessible name. */\n icons: IconPickerIcon[];\n /** Controlled selected icon id. Pair with onChange. */\n value?: string;\n /** Uncontrolled initial selected icon id. */\n defaultValue?: string;\n /** Fires with the chosen icon id when a glyph is picked. */\n onChange?: (id: string) => void;\n /** Shown on the trigger when nothing is selected. */\n placeholder?: ReactNode;\n disabled?: boolean;\n id?: string;\n className?: string;\n /** Trigger accessible name. Defaults to the bundled `iconPicker.trigger`. */\n 'aria-label'?: string;\n}\n\n// Selectable glyph cell. The only variant is selection state — selected cells\n// take a tokenised highlight (primary border + muted fill); `aria-pressed`\n// carries the state non-visually so it never reads by colour alone.\nconst optionVariants = cva(\n [\n 'ds:relative ds:inline-flex ds:items-center ds:justify-center',\n 'ds:size-[var(--min-target-size)] ds:rounded-[var(--radius-sm)]',\n 'ds:border ds:text-foreground ds:bg-transparent',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:hover:bg-muted/10',\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:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:[&_svg]:size-5',\n ].join(' '),\n {\n variants: {\n selected: {\n true: 'ds:border-primary ds:bg-muted',\n false: 'ds:border-transparent',\n },\n },\n defaultVariants: { selected: false },\n },\n);\n\nexport const IconPicker = forwardRef<HTMLButtonElement, IconPickerProps>(\n function IconPicker(\n {\n icons,\n value,\n defaultValue,\n onChange,\n placeholder,\n disabled,\n id,\n className,\n 'aria-label': ariaLabel,\n },\n ref,\n ) {\n const { t } = useTranslation();\n\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState<string>(\n defaultValue ?? '',\n );\n const currentValue = isControlled ? (value ?? '') : internalValue;\n\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n\n // Live snapshots for the synchronous agent handle.\n const currentValueRef = useRef(currentValue);\n currentValueRef.current = currentValue;\n const openRef = useRef(open);\n openRef.current = open;\n const queryRef = useRef(query);\n queryRef.current = query;\n\n const handleOpenChange = useCallback((next: boolean) => {\n setOpen(next);\n // Reset the filter when the popover closes so the next open starts fresh.\n if (!next) setQuery('');\n }, []);\n\n const setValueImperative = useCallback(\n (iconId: string) => {\n if (!isControlled) setInternalValue(iconId);\n onChange?.(iconId);\n },\n [isControlled, onChange],\n );\n\n const handleSelect = useCallback(\n (iconId: string) => {\n setValueImperative(iconId);\n handleOpenChange(false);\n },\n [setValueImperative, handleOpenChange],\n );\n\n const agentHandle = useMemo<IconPickerHandle>(\n () => ({\n getValue: () => currentValueRef.current,\n setValue: (iconId) => setValueImperative(iconId),\n isOpen: () => openRef.current,\n open: () => handleOpenChange(true),\n close: () => handleOpenChange(false),\n getQuery: () => queryRef.current,\n setQuery: (next) => setQuery(next),\n }),\n [setValueImperative, handleOpenChange],\n );\n useAgentRegistration(iconPickerAgent, agentHandle, id);\n\n const selectedIcon = useMemo(\n () => icons.find((icon) => icon.id === currentValue),\n [icons, currentValue],\n );\n\n const normalisedQuery = query.trim().toLowerCase();\n const filtered = useMemo(\n () =>\n normalisedQuery\n ? icons.filter((icon) =>\n icon.label.toLowerCase().includes(normalisedQuery),\n )\n : icons,\n [icons, normalisedQuery],\n );\n\n const triggerLabel = ariaLabel ?? t('iconPicker.trigger');\n const resolvedPlaceholder = placeholder ?? t('iconPicker.trigger');\n\n return (\n <Popover.Root open={open} onOpenChange={handleOpenChange} id={id}>\n <Popover.Trigger asChild>\n <Button\n ref={ref}\n type=\"button\"\n intent=\"outline\"\n disabled={disabled}\n aria-label={triggerLabel}\n className={className}\n data-component=\"icon-picker\"\n data-component-id={id}\n >\n {selectedIcon ? (\n <span\n aria-hidden=\"true\"\n className=\"ds:inline-flex ds:items-center ds:justify-center ds:[&_svg]:size-5\"\n >\n {selectedIcon.node}\n </span>\n ) : (\n <span className=\"ds:inline-flex ds:items-center ds:text-muted-foreground\">\n {resolvedPlaceholder}\n </span>\n )}\n </Button>\n </Popover.Trigger>\n\n <Popover.Content\n align=\"start\"\n showArrow={false}\n aria-label={triggerLabel}\n className=\"ds:w-72\"\n >\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <TextInput\n size=\"sm\"\n value={query}\n onChange={(event: ChangeEvent<HTMLInputElement>) =>\n setQuery(event.target.value)\n }\n placeholder={t('iconPicker.search')}\n aria-label={t('iconPicker.search')}\n startAdornment={<Search />}\n clearable\n onClear={() => setQuery('')}\n autoComplete=\"off\"\n />\n\n {filtered.length === 0 ? (\n <p\n role=\"status\"\n className=\"type-body-sm ds:text-muted-foreground ds:text-center ds:py-[var(--spacing-sm)]\"\n >\n {t('iconPicker.noResults')}\n </p>\n ) : (\n <div\n role=\"group\"\n aria-label={triggerLabel}\n className=\"ds:grid ds:grid-cols-5 ds:gap-[var(--spacing-xs)] ds:max-h-64 ds:overflow-y-auto\"\n >\n {filtered.map((icon) => {\n const selected = icon.id === currentValue;\n return (\n <button\n key={icon.id}\n type=\"button\"\n aria-label={icon.label}\n aria-pressed={selected}\n onClick={() => handleSelect(icon.id)}\n className={optionVariants({ selected })}\n >\n <span aria-hidden=\"true\" className=\"ds:inline-flex\">\n {icon.node}\n </span>\n </button>\n );\n })}\n </div>\n )}\n </div>\n </Popover.Content>\n </Popover.Root>\n );\n },\n);\n\nIconPicker.displayName = 'IconPicker';\n\nexport { optionVariants as iconPickerOptionVariants };\n"],"names":["iconPickerAgent","handle","args","optionVariants","cva","IconPicker","forwardRef","icons","value","defaultValue","onChange","placeholder","disabled","id","className","ariaLabel","ref","t","useTranslation","isControlled","internalValue","setInternalValue","useState","currentValue","open","setOpen","query","setQuery","currentValueRef","useRef","openRef","queryRef","handleOpenChange","useCallback","next","setValueImperative","iconId","handleSelect","agentHandle","useMemo","useAgentRegistration","selectedIcon","icon","normalisedQuery","filtered","triggerLabel","resolvedPlaceholder","Popover","jsx","Button","jsxs","TextInput","event","Search","selected"],"mappings":";;;;;;;;;AASO,MAAMA,IAAkD;AAAA,EAC7D,IAAI;AAAA,EACJ,cAAc,CAAC,QAAQ,UAAU,QAAQ,OAAO;AAAA,EAChD,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,OAAA;AAAA,IAAO;AAAA,IAElC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,EACpC;AAAA,EAEF,SAAS;AAAA,IACP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YAAE,sBAAsB;AAAA,cAAA;AAAA,YAAA,IAG3B,gBAAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,cAAYH;AAAA,gBACZ,WAAU;AAAA,gBAET,UAAAD,EAAS,IAAI,CAACF,MAAS;AACtB,wBAAMY,IAAWZ,EAAK,OAAOnB;AAC7B,yBACE,gBAAAyB;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBAEC,MAAK;AAAA,sBACL,cAAYN,EAAK;AAAA,sBACjB,gBAAcY;AAAA,sBACd,SAAS,MAAMjB,EAAaK,EAAK,EAAE;AAAA,sBACnC,WAAWvC,EAAe,EAAE,UAAAmD,GAAU;AAAA,sBAEtC,4BAAC,QAAA,EAAK,eAAY,QAAO,WAAU,kBAChC,YAAK,KAAA,CACR;AAAA,oBAAA;AAAA,oBATKZ,EAAK;AAAA,kBAAA;AAAA,gBAYhB,CAAC;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,GACF;AAAA,EAEJ;AACF;AAEArC,EAAW,cAAc;"}
1
+ {"version":3,"file":"icon-picker-DOa89vn3.js","sources":["../../src/components/icon-picker/icon-picker.agent.ts","../../src/components/icon-picker/icon-picker.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — IconPicker. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { IconPickerHandle } from './icon-picker';\n\nexport const iconPickerAgent: AgentAdapter<IconPickerHandle> = {\n id: 'icon-picker',\n capabilities: ['pick', 'filter', 'open', 'close'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.iconPicker.state.value',\n description:\n 'Id of the currently selected icon, or an empty string when nothing is picked.',\n read: (handle) => handle.getValue(),\n },\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.iconPicker.state.isOpen',\n description: 'True when the picker popover is currently open.',\n read: (handle) => handle.isOpen(),\n },\n query: {\n type: 'string',\n descriptionKey: 'ui.agent.iconPicker.state.query',\n description: 'Current search query filtering the icon grid by label.',\n read: (handle) => handle.getQuery(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Id of an icon in the supplied `icons` set.',\n },\n },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.iconPicker.actions.setValue',\n description: 'Select the icon with the given id.',\n examples: [{ args: { id: 'star' }, note: 'Pick the \"star\" icon.' }],\n invoke: (handle, args: { id: string }) => {\n handle.setValue(args.id);\n },\n },\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.iconPicker.actions.open',\n description: 'Open the picker popover.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.iconPicker.actions.close',\n description: 'Close the picker popover.',\n invoke: (handle) => {\n handle.close();\n },\n },\n filter: {\n safety: 'write',\n argsType: '{ query: string }',\n argsSchema: {\n type: 'object',\n properties: {\n query: {\n type: 'string',\n description:\n 'Case-insensitive substring matched against icon labels.',\n },\n },\n required: ['query'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.iconPicker.actions.filter',\n description: 'Filter the icon grid to labels containing the query.',\n examples: [\n {\n args: { query: 'star' },\n note: 'Show icons whose label contains \"star\".',\n },\n ],\n invoke: (handle, args: { query: string }) => {\n handle.setQuery(args.query);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'icon-picker',\n description: 'Marks the IconPicker trigger button.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type ReactNode,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Search } from 'lucide-react';\nimport { Popover } from '../popover';\nimport { Button } from '../button/button';\nimport { TextInput } from '../text-input/text-input';\nimport { useAgentRegistration } from '../../agent';\nimport { iconPickerAgent } from './icon-picker.agent';\n\n/** One selectable glyph. `label` is the accessible name (consumer-localised);\n * `node` is the rendered lucide/SVG element. */\nexport interface IconPickerIcon {\n id: string;\n label: string;\n node: ReactNode;\n}\n\n/** Agent-readiness curated handle for IconPicker. */\nexport interface IconPickerHandle {\n getValue: () => string;\n setValue: (id: string) => void;\n isOpen: () => boolean;\n open: () => void;\n close: () => void;\n getQuery: () => string;\n setQuery: (query: string) => void;\n}\n\nexport interface IconPickerProps {\n /** The glyph set. `label` is each glyph's accessible name. */\n icons: IconPickerIcon[];\n /** Controlled selected icon id. Pair with onChange. */\n value?: string;\n /** Uncontrolled initial selected icon id. */\n defaultValue?: string;\n /** Fires with the chosen icon id when a glyph is picked. */\n onChange?: (id: string) => void;\n /** Shown on the trigger when nothing is selected. */\n placeholder?: ReactNode;\n disabled?: boolean;\n id?: string;\n className?: string;\n /** Trigger accessible name. Defaults to the bundled `iconPicker.trigger`. */\n 'aria-label'?: string;\n}\n\n// Selectable glyph cell. The only variant is selection state — selected cells\n// take a tokenised highlight (primary border + muted fill); `aria-pressed`\n// carries the state non-visually so it never reads by colour alone.\nconst optionVariants = cva(\n [\n 'ds:relative ds:inline-flex ds:items-center ds:justify-center',\n 'ds:size-[var(--min-target-size)] ds:rounded-[var(--radius-sm)]',\n 'ds:border ds:text-foreground ds:bg-transparent',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:hover:bg-muted/10',\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:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:[&_svg]:size-5',\n ].join(' '),\n {\n variants: {\n selected: {\n true: 'ds:border-primary ds:bg-muted',\n false: 'ds:border-transparent',\n },\n },\n defaultVariants: { selected: false },\n },\n);\n\nexport const IconPicker = forwardRef<HTMLButtonElement, IconPickerProps>(\n function IconPicker(\n {\n icons,\n value,\n defaultValue,\n onChange,\n placeholder,\n disabled,\n id,\n className,\n 'aria-label': ariaLabel,\n },\n ref,\n ) {\n const { t } = useTranslation();\n\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState<string>(\n defaultValue ?? '',\n );\n const currentValue = isControlled ? (value ?? '') : internalValue;\n\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n\n // Live snapshots for the synchronous agent handle.\n const currentValueRef = useRef(currentValue);\n currentValueRef.current = currentValue;\n const openRef = useRef(open);\n openRef.current = open;\n const queryRef = useRef(query);\n queryRef.current = query;\n\n const handleOpenChange = useCallback((next: boolean) => {\n setOpen(next);\n // Reset the filter when the popover closes so the next open starts fresh.\n if (!next) setQuery('');\n }, []);\n\n const setValueImperative = useCallback(\n (iconId: string) => {\n if (!isControlled) setInternalValue(iconId);\n onChange?.(iconId);\n },\n [isControlled, onChange],\n );\n\n const handleSelect = useCallback(\n (iconId: string) => {\n setValueImperative(iconId);\n handleOpenChange(false);\n },\n [setValueImperative, handleOpenChange],\n );\n\n const agentHandle = useMemo<IconPickerHandle>(\n () => ({\n getValue: () => currentValueRef.current,\n setValue: (iconId) => setValueImperative(iconId),\n isOpen: () => openRef.current,\n open: () => handleOpenChange(true),\n close: () => handleOpenChange(false),\n getQuery: () => queryRef.current,\n setQuery: (next) => setQuery(next),\n }),\n [setValueImperative, handleOpenChange],\n );\n useAgentRegistration(iconPickerAgent, agentHandle, id);\n\n const selectedIcon = useMemo(\n () => icons.find((icon) => icon.id === currentValue),\n [icons, currentValue],\n );\n\n const normalisedQuery = query.trim().toLowerCase();\n const filtered = useMemo(\n () =>\n normalisedQuery\n ? icons.filter((icon) =>\n icon.label.toLowerCase().includes(normalisedQuery),\n )\n : icons,\n [icons, normalisedQuery],\n );\n\n const triggerLabel = ariaLabel ?? t('iconPicker.trigger');\n const resolvedPlaceholder = placeholder ?? t('iconPicker.trigger');\n\n return (\n <Popover.Root open={open} onOpenChange={handleOpenChange} id={id}>\n <Popover.Trigger asChild>\n <Button\n ref={ref}\n type=\"button\"\n intent=\"outline\"\n disabled={disabled}\n aria-label={triggerLabel}\n className={className}\n data-component=\"icon-picker\"\n data-component-id={id}\n >\n {selectedIcon ? (\n <span\n aria-hidden=\"true\"\n className=\"ds:inline-flex ds:items-center ds:justify-center ds:[&_svg]:size-5\"\n >\n {selectedIcon.node}\n </span>\n ) : (\n <span className=\"ds:inline-flex ds:items-center ds:text-muted-foreground\">\n {resolvedPlaceholder}\n </span>\n )}\n </Button>\n </Popover.Trigger>\n\n <Popover.Content\n align=\"start\"\n showArrow={false}\n aria-label={triggerLabel}\n className=\"ds:w-72\"\n >\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <TextInput\n size=\"sm\"\n value={query}\n onChange={(event: ChangeEvent<HTMLInputElement>) =>\n setQuery(event.target.value)\n }\n placeholder={t('iconPicker.search')}\n aria-label={t('iconPicker.search')}\n startAdornment={<Search />}\n clearable\n onClear={() => setQuery('')}\n autoComplete=\"off\"\n />\n\n {filtered.length === 0 ? (\n <p\n role=\"status\"\n className=\"type-body-sm ds:text-muted-foreground ds:text-center ds:py-[var(--spacing-sm)]\"\n >\n {t('iconPicker.noResults')}\n </p>\n ) : (\n <div\n role=\"group\"\n aria-label={triggerLabel}\n className=\"ds:grid ds:grid-cols-5 ds:gap-[var(--spacing-xs)] ds:max-h-64 ds:overflow-y-auto\"\n >\n {filtered.map((icon) => {\n const selected = icon.id === currentValue;\n return (\n <button\n key={icon.id}\n type=\"button\"\n aria-label={icon.label}\n aria-pressed={selected}\n onClick={() => handleSelect(icon.id)}\n className={optionVariants({ selected })}\n >\n <span aria-hidden=\"true\" className=\"ds:inline-flex\">\n {icon.node}\n </span>\n </button>\n );\n })}\n </div>\n )}\n </div>\n </Popover.Content>\n </Popover.Root>\n );\n },\n);\n\nIconPicker.displayName = 'IconPicker';\n\nexport { optionVariants as iconPickerOptionVariants };\n"],"names":["iconPickerAgent","handle","args","optionVariants","cva","IconPicker","forwardRef","icons","value","defaultValue","onChange","placeholder","disabled","id","className","ariaLabel","ref","t","useTranslation","isControlled","internalValue","setInternalValue","useState","currentValue","open","setOpen","query","setQuery","currentValueRef","useRef","openRef","queryRef","handleOpenChange","useCallback","next","setValueImperative","iconId","handleSelect","agentHandle","useMemo","useAgentRegistration","selectedIcon","icon","normalisedQuery","filtered","triggerLabel","resolvedPlaceholder","Popover","jsx","Button","jsxs","TextInput","event","Search","selected"],"mappings":";;;;;;;;;AASO,MAAMA,IAAkD;AAAA,EAC7D,IAAI;AAAA,EACJ,cAAc,CAAC,QAAQ,UAAU,QAAQ,OAAO;AAAA,EAChD,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,OAAA;AAAA,IAAO;AAAA,IAElC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,EACpC;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,IAAI;AAAA,YACF,MAAM;AAAA,YACN,aAAa;AAAA,UAAA;AAAA,QACf;AAAA,QAEF,UAAU,CAAC,IAAI;AAAA,MAAA;AAAA,MAEjB,YAAY;AAAA,MACZ,gBAAgB;A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C;AAAA,oBAAA;AAAA,sBAEC,MAAK;AAAA,sBACL,cAAYN,EAAK;AAAA,sBACjB,gBAAcY;AAAA,sBACd,SAAS,MAAMjB,EAAaK,EAAK,EAAE;AAAA,sBACnC,WAAWvC,EAAe,EAAE,UAAAmD,GAAU;AAAA,sBAEtC,4BAAC,QAAA,EAAK,eAAY,QAAO,WAAU,kBAChC,YAAK,KAAA,CACR;AAAA,oBAAA;AAAA,oBATKZ,EAAK;AAAA,kBAAA;AAAA,gBAYhB,CAAC;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,GACF;AAAA,EAEJ;AACF;AAEArC,EAAW,cAAc;"}
@@ -2,7 +2,7 @@ import { jsxs as u, jsx as i } from "react/jsx-runtime";
2
2
  import { forwardRef as I, useState as O, useRef as m, useEffect as k, useMemo as z } from "react";
3
3
  import { c as C } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as D } from "react-i18next";
5
- import { P as o } from "./popover-Cqcjx-Ny.js";
5
+ import { P as o } from "./popover-DP6WCVwm.js";
6
6
  import { u as P } from "./registry-DvAUVLHh.js";
7
7
  import { I as A } from "./info-CGn22peZ.js";
8
8
  const R = {
@@ -163,4 +163,4 @@ export {
163
163
  j as I,
164
164
  R as i
165
165
  };
166
- //# sourceMappingURL=info-tip-C119cwQl.js.map
166
+ //# sourceMappingURL=info-tip-CADik6WN.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"info-tip-C119cwQl.js","sources":["../../src/components/info-tip/info-tip.agent.ts","../../src/components/info-tip/info-tip.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { InfoTipHandle } from './info-tip';\n\nexport const infoTipAgent: AgentAdapter<InfoTipHandle> = {\n id: 'info-tip',\n capabilities: ['open', 'close'],\n state: {\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.infoTip.state.isOpen',\n description: 'True when the info tip card is currently open.',\n read: (handle) => handle.getIsOpen(),\n },\n },\n actions: {\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.infoTip.actions.open',\n description: 'Open the info tip card.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.infoTip.actions.close',\n description: 'Close the info tip card.',\n invoke: (handle) => {\n handle.close();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'info-tip',\n description: 'Marks the InfoTip trigger button.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop on InfoTip.',\n },\n },\n};\n","import {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Info } from 'lucide-react';\nimport { Popover } from '../popover';\nimport { useAgentRegistration } from '../../agent';\nimport { infoTipAgent } from './info-tip.agent';\n\n/* -------------------------------------------------------------------- */\n/* Trigger — a small circular, branded affordance: card surface inside */\n/* the circle, accent ring + accent \"i\" glyph, and a soft drop shadow. */\n/* The accent alias is safe here: `--accent` resolves to magenta-700 in */\n/* light mode (the AA-safe interactive step) and the dark accent on dark */\n/* surfaces — never reference a raw magenta ramp step. */\n/* -------------------------------------------------------------------- */\n\nconst infoTipTriggerVariants = cva(\n [\n 'ds:relative ds:inline-flex ds:shrink-0 ds:items-center ds:justify-center',\n 'ds:rounded-[var(--radius-full)]',\n 'ds:bg-[var(--card)]',\n 'ds:text-[var(--accent)]',\n // Single ring: the Lucide Info glyph draws its own accent circle, so the\n // trigger carries NO CSS border of its own (a border would read as a\n // second, concentric ring). The white circle comes from `bg-card` showing\n // through the glyph, lifted by the drop shadow.\n 'ds:shadow-[var(--shadow-sm)]',\n 'ds:cursor-pointer',\n 'ds:transition-[color,box-shadow] ds:motion-reduce:transition-none',\n 'ds:hover:text-[var(--accent-hover)] ds:hover:shadow-[var(--shadow-md)]',\n 'ds:data-[state=open]:text-[var(--accent-hover)] ds:data-[state=open]:shadow-[var(--shadow-md)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n ].join(' '),\n {\n variants: {\n size: {\n // Both diameters sit below `--min-target-size` (44/48px), so each\n // re-uses IconButton's invisible `::before` hit-area expansion to a\n // full touch target on touch / small screens. From the `sm:`\n // breakpoint up the pointer is precise, so the expansion relaxes —\n // but the interactive target must never fall below WCAG 2.5.8's 24px:\n // • md (24px visual) already meets the 24px floor, so its `::before`\n // is hidden on desktop and the 24px circle IS the target.\n // • sm (20px visual) would fall to 20px if hidden — below the floor\n // — so instead of hiding, its `::before` shrinks to a persistent\n // `--spacing-lg` (24px) minimum that holds on desktop too.\n sm: 'ds:w-5 ds:h-5 ds:before:absolute ds:before:inset-x-[calc((var(--min-target-size)-100%)/-2)] ds:before:inset-y-[calc((var(--min-target-size)-100%)/-2)] ds:before:content-[\"\"] ds:sm:before:inset-x-[calc((var(--spacing-lg)-100%)/-2)] ds:sm:before:inset-y-[calc((var(--spacing-lg)-100%)/-2)]',\n md: 'ds:w-6 ds:h-6 ds:before:absolute ds:before:inset-x-[calc((var(--min-target-size)-100%)/-2)] ds:before:inset-y-[calc((var(--min-target-size)-100%)/-2)] ds:before:content-[\"\"] ds:sm:before:hidden',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n },\n);\n\n// Curated agent-readiness handle — see info-tip.agent.ts.\nexport interface InfoTipHandle {\n getIsOpen: () => boolean;\n open: () => void;\n close: () => void;\n}\n\nexport interface InfoTipProps {\n /** Body of the tip — explanatory text shown in the floating card. */\n content: ReactNode;\n /** Optional heading rendered above the body. */\n heading?: ReactNode;\n /**\n * Trigger diameter. Also maps the floating card width:\n * `sm` → `--popover-size-sm`, `md` → `--popover-size-md`.\n */\n size?: 'sm' | 'md';\n /** Logical side the card opens on. Default `'top'`. */\n side?: 'start' | 'top' | 'end' | 'bottom';\n /** Alignment along the side axis. Default `'center'`. */\n align?: 'start' | 'center' | 'end';\n /**\n * Accessible name for the trigger. Defaults to the translated\n * \"More information\" chrome string.\n */\n 'aria-label'?: string;\n /**\n * Opaque instance id — emitted as `data-component-id` on the trigger and\n * used to register the instance with the host agent registry.\n */\n id?: string;\n /** Extra classes merged onto the trigger button. */\n className?: string;\n}\n\n/**\n * InfoTip — a deliberate, branded \"more information\" affordance: a small\n * circular trigger that reveals an explanatory card on hover **and** click\n * (click also serves touch devices). Composes the kit Popover in\n * `openOn=\"hover-or-click\"` mode — hover intent, keyboard focus, Escape and\n * focus-return are all handled by the Popover/Radix layer.\n */\nexport const InfoTip = forwardRef<HTMLButtonElement, InfoTipProps>(\n (\n {\n content,\n heading,\n size = 'md',\n side = 'top',\n align = 'center',\n 'aria-label': ariaLabelProp,\n id,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n\n // Agent handle.\n const openRef = useRef(open);\n useEffect(() => {\n openRef.current = open;\n }, [open]);\n\n const agentHandle = useMemo<InfoTipHandle>(\n () => ({\n getIsOpen: () => openRef.current,\n open: () => setOpen(true),\n close: () => setOpen(false),\n }),\n [],\n );\n useAgentRegistration(infoTipAgent, agentHandle, id);\n\n // Press bookkeeping. In hover-or-click mode the Popover opens as soon as\n // the trigger receives focus — which happens on pointerdown, BEFORE the\n // click event that Radix uses to toggle. Without intervention every\n // click/tap on a closed tip opens it (focus) and instantly toggles it\n // closed again (click). So each press (pointerdown, or Enter/Space)\n // snapshots the open state and the click handler consumes it: if the\n // press itself opened the card, swallow Radix's toggle so the card stays\n // open; if it was already open, let the toggle close it.\n //\n // `null` means \"no press recorded for this click\" — an orphan click\n // (programmatic .click(), or assistive tech dispatching click with no\n // pointer/key event). Those must fall through to Radix's default toggle\n // rather than read a stale snapshot, so the guard treats `null` as\n // \"don't suppress\" and every click clears the snapshot back to `null`.\n const pressStateRef = useRef<boolean | null>(null);\n const handlePressStart = () => {\n pressStateRef.current = openRef.current;\n };\n\n const ariaLabel =\n ariaLabelProp ?? t('infoTip.triggerLabel', 'More information');\n\n return (\n <Popover openOn=\"hover-or-click\" open={open} onOpenChange={setOpen}>\n <Popover.Trigger\n ref={ref}\n aria-label={ariaLabel}\n className={infoTipTriggerVariants({ size, className })}\n data-component=\"info-tip\"\n data-component-id={id}\n onPointerDown={handlePressStart}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handlePressStart();\n }\n }}\n onClick={(event) => {\n // Consume this click's press snapshot. A genuine pointer/keyboard\n // press recorded `false`/`true` on press-start; an orphan click\n // with no preceding pointerdown/keydown finds `null` and is left\n // to Radix's default toggle.\n const wasOpenAtPressStart = pressStateRef.current;\n pressStateRef.current = null;\n if (wasOpenAtPressStart === false && openRef.current) {\n // This press opened the card via focus — keep it open and\n // skip Radix's click toggle.\n event.preventDefault();\n }\n }}\n >\n <Info\n aria-hidden=\"true\"\n // Fills the circle so the glyph's own ring IS the trigger's\n // visible edge and the drop shadow hugs it.\n className={size === 'sm' ? 'ds:size-5' : 'ds:size-6'}\n />\n </Popover.Trigger>\n <Popover.Content\n side={side}\n align={align}\n size={size === 'sm' ? 'sm' : 'md'}\n // The card is a Radix `role=\"dialog\"` surface, which axe requires\n // to have an accessible name (aria-dialog-name). With a heading,\n // Popover wires aria-labelledby; without one, fall back to the\n // trigger's label.\n aria-label={heading == null ? ariaLabel : undefined}\n // Toggletip focus contract: the card is explanatory text, never\n // interactive, so focus stays on the trigger for the whole\n // open/close cycle. Preventing the open move also keeps Escape\n // reliable — if Radix pulled focus into the card, closing would\n // refocus the trigger and re-fire the hover-mode focus handler,\n // reopening the card it just closed. Preventing the close move\n // keeps an unhover-close from stealing focus mid-task.\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n >\n {heading != null && <Popover.Heading>{heading}</Popover.Heading>}\n <Popover.Description>{content}</Popover.Description>\n </Popover.Content>\n </Popover>\n );\n },\n);\n\nInfoTip.displayName = 'InfoTip';\n"],"names":["infoTipAgent","handle","infoTipTriggerVariants","cva","InfoTip","forwardRef","content","heading","size","side","align","ariaLabelProp","id","className","ref","t","useTranslation","open","setOpen","useState","openRef","useRef","useEffect","agentHandle","useMemo","useAgentRegistration","pressStateRef","handlePressStart","ariaLabel","Popover","jsx","event","wasOpenAtPressStart","Info","jsxs"],"mappings":";;;;;;;AAGO,MAAMA,IAA4C;AAAA,EACvD,IAAI;AAAA,EACJ,cAAc,CAAC,QAAQ,OAAO;AAAA,EAC9B,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,EACrC;AAAA,EAEF,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ,CAACA,MAAW;AAClB,QAAAA,EAAO,KAAA;AAAA,MACT;AAAA,IAAA;AAAA,IAEF,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ,CAACA,MAAW;AAClB,QAAAA,EAAO,MAAA;AAAA,MACT;AAAA,IAAA;AAAA,EACF;AAAA,EAEF,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GCvBMC,IAAyBC;AAAA,EAC7B;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA;AAAA,IACA;AAAA,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AAQ;AAAA,QAAR;AAAA,UACC,KAAAf;AAAA,UACA,cAAYc;AAAA,UACZ,WAAW1B,EAAuB,EAAE,MAAAM,GAAM,WAAAK,GAAW;AAAA,UACrD,kBAAe;AAAA,UACf,qBAAmBD;AAAA,UACnB,eAAee;AAAA,UACf,WAAW,CAACI,MAAU;AACpB,aAAIA,EAAM,QAAQ,WAAWA,EAAM,QAAQ,QACzCJ,EAAA;AAAA,UAEJ;AAAA,UACA,SAAS,CAACI,MAAU;AAKlB,kBAAMC,IAAsBN,EAAc;AAC1C,YAAAA,EAAc,UAAU,MACpBM,MAAwB,MAASZ,EAAQ,WAG3CW,EAAM,eAAA;AAAA,UAEV;AAAA,UAEA,UAAA,gBAAAD;AAAA,YAACG;AAAA,YAAA;AAAA,cACC,eAAY;AAAA,cAGZ,WAAWzB,MAAS,OAAO,cAAc;AAAA,YAAA;AAAA,UAAA;AAAA,QAC3C;AAAA,MAAA;AAAA,MAEF,gBAAA0B;AAAA,QAACL,EAAQ;AAAA,QAAR;AAAA,UACC,MAAApB;AAAA,UACA,OAAAC;AAAA,UACA,MAAMF,MAAS,OAAO,OAAO;AAAA,UAK7B,cAAYD,KAAW,OAAOqB,IAAY;AAAA,UAQ1C,iBAAiB,CAACG,MAAUA,EAAM,eAAA;AAAA,UAClC,kBAAkB,CAACA,MAAUA,EAAM,eAAA;AAAA,UAElC,UAAA;AAAA,YAAAxB,KAAW,QAAQ,gBAAAuB,EAACD,EAAQ,SAAR,EAAiB,UAAAtB,GAAQ;AAAA,YAC9C,gBAAAuB,EAACD,EAAQ,aAAR,EAAqB,UAAAvB,EAAA,CAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAChC,GACF;AAAA,EAEJ;AACF;AAEAF,EAAQ,cAAc;"}
1
+ {"version":3,"file":"info-tip-CADik6WN.js","sources":["../../src/components/info-tip/info-tip.agent.ts","../../src/components/info-tip/info-tip.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { InfoTipHandle } from './info-tip';\n\nexport const infoTipAgent: AgentAdapter<InfoTipHandle> = {\n id: 'info-tip',\n capabilities: ['open', 'close'],\n state: {\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.infoTip.state.isOpen',\n description: 'True when the info tip card is currently open.',\n read: (handle) => handle.getIsOpen(),\n },\n },\n actions: {\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.infoTip.actions.open',\n description: 'Open the info tip card.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.infoTip.actions.close',\n description: 'Close the info tip card.',\n invoke: (handle) => {\n handle.close();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'info-tip',\n description: 'Marks the InfoTip trigger button.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop on InfoTip.',\n },\n },\n};\n","import {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Info } from 'lucide-react';\nimport { Popover } from '../popover';\nimport { useAgentRegistration } from '../../agent';\nimport { infoTipAgent } from './info-tip.agent';\n\n/* -------------------------------------------------------------------- */\n/* Trigger — a small circular, branded affordance: card surface inside */\n/* the circle, accent ring + accent \"i\" glyph, and a soft drop shadow. */\n/* The accent alias is safe here: `--accent` resolves to magenta-700 in */\n/* light mode (the AA-safe interactive step) and the dark accent on dark */\n/* surfaces — never reference a raw magenta ramp step. */\n/* -------------------------------------------------------------------- */\n\nconst infoTipTriggerVariants = cva(\n [\n 'ds:relative ds:inline-flex ds:shrink-0 ds:items-center ds:justify-center',\n 'ds:rounded-[var(--radius-full)]',\n 'ds:bg-[var(--card)]',\n 'ds:text-[var(--accent)]',\n // Single ring: the Lucide Info glyph draws its own accent circle, so the\n // trigger carries NO CSS border of its own (a border would read as a\n // second, concentric ring). The white circle comes from `bg-card` showing\n // through the glyph, lifted by the drop shadow.\n 'ds:shadow-[var(--shadow-sm)]',\n 'ds:cursor-pointer',\n 'ds:transition-[color,box-shadow] ds:motion-reduce:transition-none',\n 'ds:hover:text-[var(--accent-hover)] ds:hover:shadow-[var(--shadow-md)]',\n 'ds:data-[state=open]:text-[var(--accent-hover)] ds:data-[state=open]:shadow-[var(--shadow-md)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n ].join(' '),\n {\n variants: {\n size: {\n // Both diameters sit below `--min-target-size` (44/48px), so each\n // re-uses IconButton's invisible `::before` hit-area expansion to a\n // full touch target on touch / small screens. From the `sm:`\n // breakpoint up the pointer is precise, so the expansion relaxes —\n // but the interactive target must never fall below WCAG 2.5.8's 24px:\n // • md (24px visual) already meets the 24px floor, so its `::before`\n // is hidden on desktop and the 24px circle IS the target.\n // • sm (20px visual) would fall to 20px if hidden — below the floor\n // — so instead of hiding, its `::before` shrinks to a persistent\n // `--spacing-lg` (24px) minimum that holds on desktop too.\n sm: 'ds:w-5 ds:h-5 ds:before:absolute ds:before:inset-x-[calc((var(--min-target-size)-100%)/-2)] ds:before:inset-y-[calc((var(--min-target-size)-100%)/-2)] ds:before:content-[\"\"] ds:sm:before:inset-x-[calc((var(--spacing-lg)-100%)/-2)] ds:sm:before:inset-y-[calc((var(--spacing-lg)-100%)/-2)]',\n md: 'ds:w-6 ds:h-6 ds:before:absolute ds:before:inset-x-[calc((var(--min-target-size)-100%)/-2)] ds:before:inset-y-[calc((var(--min-target-size)-100%)/-2)] ds:before:content-[\"\"] ds:sm:before:hidden',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n },\n);\n\n// Curated agent-readiness handle — see info-tip.agent.ts.\nexport interface InfoTipHandle {\n getIsOpen: () => boolean;\n open: () => void;\n close: () => void;\n}\n\nexport interface InfoTipProps {\n /** Body of the tip — explanatory text shown in the floating card. */\n content: ReactNode;\n /** Optional heading rendered above the body. */\n heading?: ReactNode;\n /**\n * Trigger diameter. Also maps the floating card width:\n * `sm` → `--popover-size-sm`, `md` → `--popover-size-md`.\n */\n size?: 'sm' | 'md';\n /** Logical side the card opens on. Default `'top'`. */\n side?: 'start' | 'top' | 'end' | 'bottom';\n /** Alignment along the side axis. Default `'center'`. */\n align?: 'start' | 'center' | 'end';\n /**\n * Accessible name for the trigger. Defaults to the translated\n * \"More information\" chrome string.\n */\n 'aria-label'?: string;\n /**\n * Opaque instance id — emitted as `data-component-id` on the trigger and\n * used to register the instance with the host agent registry.\n */\n id?: string;\n /** Extra classes merged onto the trigger button. */\n className?: string;\n}\n\n/**\n * InfoTip — a deliberate, branded \"more information\" affordance: a small\n * circular trigger that reveals an explanatory card on hover **and** click\n * (click also serves touch devices). Composes the kit Popover in\n * `openOn=\"hover-or-click\"` mode — hover intent, keyboard focus, Escape and\n * focus-return are all handled by the Popover/Radix layer.\n */\nexport const InfoTip = forwardRef<HTMLButtonElement, InfoTipProps>(\n (\n {\n content,\n heading,\n size = 'md',\n side = 'top',\n align = 'center',\n 'aria-label': ariaLabelProp,\n id,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n\n // Agent handle.\n const openRef = useRef(open);\n useEffect(() => {\n openRef.current = open;\n }, [open]);\n\n const agentHandle = useMemo<InfoTipHandle>(\n () => ({\n getIsOpen: () => openRef.current,\n open: () => setOpen(true),\n close: () => setOpen(false),\n }),\n [],\n );\n useAgentRegistration(infoTipAgent, agentHandle, id);\n\n // Press bookkeeping. In hover-or-click mode the Popover opens as soon as\n // the trigger receives focus — which happens on pointerdown, BEFORE the\n // click event that Radix uses to toggle. Without intervention every\n // click/tap on a closed tip opens it (focus) and instantly toggles it\n // closed again (click). So each press (pointerdown, or Enter/Space)\n // snapshots the open state and the click handler consumes it: if the\n // press itself opened the card, swallow Radix's toggle so the card stays\n // open; if it was already open, let the toggle close it.\n //\n // `null` means \"no press recorded for this click\" — an orphan click\n // (programmatic .click(), or assistive tech dispatching click with no\n // pointer/key event). Those must fall through to Radix's default toggle\n // rather than read a stale snapshot, so the guard treats `null` as\n // \"don't suppress\" and every click clears the snapshot back to `null`.\n const pressStateRef = useRef<boolean | null>(null);\n const handlePressStart = () => {\n pressStateRef.current = openRef.current;\n };\n\n const ariaLabel =\n ariaLabelProp ?? t('infoTip.triggerLabel', 'More information');\n\n return (\n <Popover openOn=\"hover-or-click\" open={open} onOpenChange={setOpen}>\n <Popover.Trigger\n ref={ref}\n aria-label={ariaLabel}\n className={infoTipTriggerVariants({ size, className })}\n data-component=\"info-tip\"\n data-component-id={id}\n onPointerDown={handlePressStart}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handlePressStart();\n }\n }}\n onClick={(event) => {\n // Consume this click's press snapshot. A genuine pointer/keyboard\n // press recorded `false`/`true` on press-start; an orphan click\n // with no preceding pointerdown/keydown finds `null` and is left\n // to Radix's default toggle.\n const wasOpenAtPressStart = pressStateRef.current;\n pressStateRef.current = null;\n if (wasOpenAtPressStart === false && openRef.current) {\n // This press opened the card via focus — keep it open and\n // skip Radix's click toggle.\n event.preventDefault();\n }\n }}\n >\n <Info\n aria-hidden=\"true\"\n // Fills the circle so the glyph's own ring IS the trigger's\n // visible edge and the drop shadow hugs it.\n className={size === 'sm' ? 'ds:size-5' : 'ds:size-6'}\n />\n </Popover.Trigger>\n <Popover.Content\n side={side}\n align={align}\n size={size === 'sm' ? 'sm' : 'md'}\n // The card is a Radix `role=\"dialog\"` surface, which axe requires\n // to have an accessible name (aria-dialog-name). With a heading,\n // Popover wires aria-labelledby; without one, fall back to the\n // trigger's label.\n aria-label={heading == null ? ariaLabel : undefined}\n // Toggletip focus contract: the card is explanatory text, never\n // interactive, so focus stays on the trigger for the whole\n // open/close cycle. Preventing the open move also keeps Escape\n // reliable — if Radix pulled focus into the card, closing would\n // refocus the trigger and re-fire the hover-mode focus handler,\n // reopening the card it just closed. Preventing the close move\n // keeps an unhover-close from stealing focus mid-task.\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n >\n {heading != null && <Popover.Heading>{heading}</Popover.Heading>}\n <Popover.Description>{content}</Popover.Description>\n </Popover.Content>\n </Popover>\n );\n },\n);\n\nInfoTip.displayName = 'InfoTip';\n"],"names":["infoTipAgent","handle","infoTipTriggerVariants","cva","InfoTip","forwardRef","content","heading","size","side","align","ariaLabelProp","id","className","ref","t","useTranslation","open","setOpen","useState","openRef","useRef","useEffect","agentHandle","useMemo","useAgentRegistration","pressStateRef","handlePressStart","ariaLabel","Popover","jsx","event","wasOpenAtPressStart","Info","jsxs"],"mappings":";;;;;;;AAGO,MAAMA,IAA4C;AAAA,EACvD,IAAI;AAAA,EACJ,cAAc,CAAC,QAAQ,OAAO;AAAA,EAC9B,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,EACrC;AAAA,EAEF,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ,CAACA,MAAW;AAClB,QAAAA,EAAO,KAAA;AAAA,MACT;AAAA,IAAA;AAAA,IAEF,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ,CAACA,MAAW;AAClB,QAAAA,EAAO,MAAA;AAAA,MACT;AAAA,IAAA;AAAA,EACF;AAAA,EAEF,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf,YAAY;AAAA,MACV,M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,MAAA;AAAA,IAChC,GACF;AAAA,EAEJ;AACF;AAEAF,EAAQ,cAAc;"}
@@ -4,7 +4,7 @@ import { c as q } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as A } from "react-i18next";
5
5
  import { _ as y, R as oe } from "./index-4xgbg-sn.js";
6
6
  import { I as te } from "./icon-button-DA2CAGHZ.js";
7
- import { P as L } from "./popover-Cqcjx-Ny.js";
7
+ import { P as L } from "./popover-DP6WCVwm.js";
8
8
  import { F as ne, f as ie, s as J, _ as re, a as le, b as ce, c as de, d as ue, e as ge, g as me, h as _e, i as fe, j as ve, k as pe, l as he, m as ye, n as be, o as Ne, p as Le, q as xe, r as Ce, t as Se, u as ke, v as we, w as Ee, x as Pe, y as Re, z as Ie, A as Te, B as Ae, C as De, D as je, E as Fe, G as Oe, H as ze, I as Ue, J as Ge, K as Me, L as He } from "./flag-view-udarpAot.js";
9
9
  import { c as Be, a as qe, d as Je } from "./input-surface-xyERuLU_.js";
10
10
  import { LOCALES_WITH_BUNDLES as D } from "../i18n/config.js";
@@ -828,4 +828,4 @@ export {
828
828
  P as b,
829
829
  x as c
830
830
  };
831
- //# sourceMappingURL=locale-picker-BvbVjDQ-.js.map
831
+ //# sourceMappingURL=locale-picker-CwFtqSkt.js.map