forty-cdk 0.41.0 → 0.41.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"forty-cdk-combobox.mjs","names":["FOR_COMBOBOX_DEFAULTS","FOR_COMBOBOX_DEFAULTS","FOR_COMBOBOX_DEFAULTS","FOR_COMBOBOX_DEFAULTS","FOR_COMBOBOX_DEFAULTS"],"sources":["../../../projects/forty-cdk/combobox/src/combobox-auto-highlight.ts","../../../projects/forty-cdk/combobox/src/combobox-context.ts","../../../projects/forty-cdk/combobox/src/combobox.ts","../../../projects/forty-cdk/combobox/src/combobox-off-window-merge.ts","../../../projects/forty-cdk/combobox/src/combobox-virtualized-navigator.ts","../../../projects/forty-cdk/combobox/src/combobox-virtualized.ts","../../../projects/forty-cdk/combobox/src/combobox-anchor.ts","../../../projects/forty-cdk/combobox/src/combobox-trigger.ts","../../../projects/forty-cdk/combobox/src/combobox-toggle.ts","../../../projects/forty-cdk/combobox/src/combobox-input.ts","../../../projects/forty-cdk/combobox/src/combobox-content.ts","../../../projects/forty-cdk/combobox/src/combobox-list.ts","../../../projects/forty-cdk/combobox/src/combobox-option.ts","../../../projects/forty-cdk/combobox/src/combobox-indicator.ts","../../../projects/forty-cdk/combobox/src/combobox-empty.ts","../../../projects/forty-cdk/combobox/src/combobox-action.ts","../../../projects/forty-cdk/combobox/src/combobox-status.ts","../../../projects/forty-cdk/combobox/src/combobox-clear.ts","../../../projects/forty-cdk/combobox/src/combobox-chips.ts","../../../projects/forty-cdk/combobox/src/combobox-chip.ts","../../../projects/forty-cdk/combobox/src/combobox-chip-remove.ts","../../../projects/forty-cdk/combobox/src/combobox-group.ts","../../../projects/forty-cdk/combobox/src/combobox-group-label.ts","../../../projects/forty-cdk/combobox/src/combobox-separator.ts","../../../projects/forty-cdk/combobox/src/combobox-host-directive.ts"],"sourcesContent":["import { linkedSignal, untracked, type WritableSignal } from '@angular/core';\n\nimport {\n firstEnabledHandle,\n isUnset,\n lastEnabledHandle,\n runVirtualizedNavigatorBridge,\n} from 'forty-cdk/core';\nimport type { ForComboboxInitialFocus, ForComboboxOptionHandle } from './combobox-context';\nimport type { ComboboxVirtualizedNavigator } from './combobox-virtualized-navigator';\n\n/**\n * Inputs for {@link resolveAutoHighlightSeed}. Mirror the tracked source of the\n * host's `#activeId` linkedSignal: the live registered options, the current\n * selection (for `initialFocus === 'selected'`), and the equality fn used to\n * match selected values to options.\n */\nexport interface AutoHighlightSeedInput<T> {\n /** Live registered options in DOM order. */\n readonly items: readonly ForComboboxOptionHandle<T>[];\n /** Where auto-highlight should land: first / last enabled, or the selection. */\n readonly initialFocus: ForComboboxInitialFocus;\n /** Current selection — only read when `initialFocus === 'selected'`. */\n readonly value: readonly T[];\n /** Identity comparison used to match a selected value to a registered option. */\n readonly equals: (a: T, b: T) => boolean;\n}\n\n/**\n * Reactive source for the host's `#activeId` linkedSignal. Each accessor reads\n * one of the host signals the activedescendant decision depends on.\n */\nexport interface ActiveIdSource<T> {\n /** Visible input text — a change drops the prior pointer (it may be filtered out). */\n readonly query: () => string;\n /** Whether the listbox is open. */\n readonly open: () => boolean;\n /** Whether auto-highlight is enabled. */\n readonly autoHighlight: () => boolean;\n /** `true` when the consumer set `totalCount()` (virtualized path). */\n readonly virtualized: () => boolean;\n /** Where auto-highlight should land. */\n readonly initialFocus: () => ForComboboxInitialFocus;\n /** Live registered options in DOM order. */\n readonly items: () => readonly ForComboboxOptionHandle<T>[];\n /** Current selection — only read for `initialFocus === 'selected'`. */\n readonly value: () => readonly T[];\n /** Identity comparison used to match a selected value to a registered option. */\n readonly equals: () => (a: T, b: T) => boolean;\n}\n\n/**\n * Builds the host's activedescendant pointer as a `linkedSignal`, so what should be highlighted\n * given `open` / `items` / `autoHighlight` is a pure derivation. The result stays writable for the\n * imperative moves that own their own scroll — arrow navigation, hover, multi-mode activation, and\n * the virtualized pending-nav resolution.\n *\n * The reset and seed rule, in order:\n *\n * - A `query` change drops the prior pointer, since the active option may have been filtered out.\n * - A pointer no longer matching a registered option is dropped, covering a list mutated without\n * touching `query`.\n * - A surviving valid pointer is preserved.\n * - Otherwise, when not virtualized, {@link resolveAutoHighlightSeed} seeds the first or last\n * enabled option while the listbox is open. The virtualized case returns `null` and is seeded\n * imperatively instead, because that seed orders by absolute `posInSet` and must lose to a\n * pending `(scrollToIndex)` resolution.\n */\nexport function createActiveIdSignal<T>(source: ActiveIdSource<T>): WritableSignal<string | null> {\n return linkedSignal<\n {\n query: string;\n open: boolean;\n autoHighlight: boolean;\n virtualized: boolean;\n initialFocus: ForComboboxInitialFocus;\n items: readonly ForComboboxOptionHandle<T>[];\n value: readonly T[];\n equals: (a: T, b: T) => boolean;\n },\n string | null\n >({\n source: () => ({\n query: source.query(),\n open: source.open(),\n autoHighlight: source.autoHighlight(),\n virtualized: source.virtualized(),\n initialFocus: source.initialFocus(),\n items: source.items(),\n value: source.value(),\n equals: source.equals(),\n }),\n computation: (\n { query, open, autoHighlight, virtualized, initialFocus, items, value, equals },\n prev,\n ) => {\n const queryChanged = prev !== undefined && prev.source.query !== query;\n let current = queryChanged ? null : (prev?.value ?? null);\n if (current !== null && !items.some((o) => o.id() === current)) {\n current = null;\n }\n if (current !== null) {\n return current;\n }\n if (virtualized || !autoHighlight || !open || items.length === 0) {\n return null;\n }\n return resolveAutoHighlightSeed({ items, initialFocus, value, equals });\n },\n });\n}\n\n/**\n * Resolve the auto-highlight seed for the **non-virtualized** combobox: the id\n * of the option `aria-activedescendant` should fall on when the listbox is open\n * and no pointer survives. Returns `null` when no enabled option qualifies (or\n * when a `'selected'` seed can't yet read its options — see `isUnset`).\n *\n * Pure over its inputs — no signal reads, no DOM access — so the host can call\n * it from inside its `#activeId` linkedSignal computation without leaking the\n * banned write-from-effect pattern. The virtualized branch seeds imperatively\n * via the navigator instead (it orders by absolute `posInSet` and must lose to\n * a pending `(scrollToIndex)` resolution).\n *\n * Internal — not re-exported from `combobox/index.ts` or `public-api.ts`.\n */\nexport function resolveAutoHighlightSeed<T>(input: AutoHighlightSeedInput<T>): string | null {\n const { items, initialFocus, value, equals } = input;\n if (initialFocus === 'selected') {\n const selected = findSelectedEnabled(items, value, equals);\n if (selected === NOT_READY) {\n return null;\n }\n if (selected) {\n return selected.id();\n }\n }\n const target = initialFocus === 'last' ? lastEnabledHandle(items) : firstEnabledHandle(items);\n return target?.id() ?? null;\n}\n\nconst NOT_READY = Symbol('forty-cdk/combobox:not-ready');\n\nfunction findSelectedEnabled<T>(\n items: readonly ForComboboxOptionHandle<T>[],\n values: readonly T[],\n equals: (a: T, b: T) => boolean,\n): ForComboboxOptionHandle<T> | null | typeof NOT_READY {\n if (values.length === 0) {\n return null;\n }\n for (const item of items) {\n if (item.disabled()) {\n continue;\n }\n const value = item.value();\n if (isUnset(value)) {\n return NOT_READY;\n }\n if (values.some((sel) => equals(value, sel))) {\n return item;\n }\n }\n return null;\n}\n\n/**\n * Collaborators the virtualized auto-highlight bridge reaches for. The host owns\n * the activedescendant (`getActiveId`); the bridge reads it through this\n * accessor so it can stay outside the directive.\n */\nexport interface AutoHighlightBridgeDeps<T> {\n /** The virtualization navigator, constructed on first use. */\n readonly requireNavigator: () => ComboboxVirtualizedNavigator<T>;\n /** Live registered options in DOM order. */\n readonly items: () => readonly ForComboboxOptionHandle<T>[];\n /** Whether the listbox is open. */\n readonly open: () => boolean;\n /** Whether auto-highlight is enabled. */\n readonly autoHighlight: () => boolean;\n /** `true` while `totalCount` is set. */\n readonly virtualized: () => boolean;\n /** Where auto-highlight should land. */\n readonly initialFocus: () => ForComboboxInitialFocus;\n /** Read the host's current activedescendant id (call inside `untracked`). */\n readonly getActiveId: () => string | null;\n}\n\n/**\n * The virtualized imperative tail of the auto-highlight flow, run from the\n * `[forComboboxVirtualized]` constructor `effect`. The activedescendant *decision* is a pure\n * derivation in {@link createActiveIdSignal}; this performs only the side effects that escape\n * the reactive graph, reacting to `items()`, `autoHighlight()` and `open()`.\n *\n * It resolves a pending `(scrollToIndex)` navigation: once the option for the requested\n * `posInSet` mounts, activedescendant is seeded to its id and scrolled into view. That write\n * takes precedence over the auto-highlight seed. The passive `seedFirstRenderedEnabled` then\n * points at the topmost or bottommost rendered enabled option without touching the consumer's\n * scroll position.\n *\n * The position map is pulled, through {@link runVirtualizedNavigatorBridge}, because its\n * sources are already tracked by this bridge's own `items()` read and priming it widens nothing.\n */\nexport function runAutoHighlightBridge<T>(deps: AutoHighlightBridgeDeps<T>): void {\n const items = deps.items();\n const open = deps.open();\n const autoHighlight = deps.autoHighlight();\n if (!deps.virtualized()) {\n return;\n }\n const navigator = deps.requireNavigator();\n const resolved = runVirtualizedNavigatorBridge({\n items: deps.items,\n virtualized: deps.virtualized,\n requireNavigator: () => navigator,\n });\n if (resolved) {\n return;\n }\n if (autoHighlight && open && untracked(() => deps.getActiveId()) === null && items.length > 0) {\n navigator.seedFirstRenderedEnabled(deps.initialFocus() === 'last' ? 'last' : 'first');\n }\n}\n\n/**\n * Collaborators {@link revealAutoHighlight} reaches for. The host owns the\n * activedescendant (`getActiveId`) and the last-scrolled-into-view id\n * (`getLastPositionedId` / `setLastPositionedId`).\n */\nexport interface AutoHighlightRevealDeps<T> {\n /** Live registered options in DOM order. */\n readonly items: () => readonly ForComboboxOptionHandle<T>[];\n /** Whether the listbox is open. */\n readonly open: () => boolean;\n /** `true` while `totalCount` is set, where the navigator owns the scroll. */\n readonly virtualized: () => boolean;\n /** Read the host's current activedescendant id (call inside `untracked`). */\n readonly getActiveId: () => string | null;\n /** Last id the bridge scrolled into view, to avoid re-scrolling on hover. */\n readonly getLastPositionedId: () => string | null;\n /** Persist the last id the bridge scrolled into view. */\n readonly setLastPositionedId: (id: string | null) => void;\n /** Scroll an option into view with the host's pointer-suppression window open. */\n readonly scrollIntoView: (host: HTMLElement) => void;\n}\n\n/**\n * The non-virtualized imperative tail of the auto-highlight flow, run from the host's\n * constructor `effect`: it scrolls the seeded option into view so a seed below the fold is\n * visible, matching `navigate()`, through the host's pointer-suppression window so an option the\n * scroll slides under a stationary cursor cannot take the seed over. The activedescendant is read\n * `untracked`, so scrolling never re-triggers the effect and hover never scrolls. The\n * initial-open scroll is re-applied by `ForCombobox.scrollActiveOptionIntoView` after the content\n * portals, since portaling resets `scrollTop`.\n *\n * The label cache is not pulled here: it tracks the selection, so every commit of `value` would\n * re-run this effect's scrolls.\n */\nexport function revealAutoHighlight<T>(deps: AutoHighlightRevealDeps<T>): void {\n const items = deps.items();\n const open = deps.open();\n if (deps.virtualized()) {\n return;\n }\n if (!open) {\n deps.setLastPositionedId(null);\n return;\n }\n const activeId = untracked(() => deps.getActiveId());\n if (activeId === null || activeId === deps.getLastPositionedId()) {\n return;\n }\n const active = items.find((o) => o.id() === activeId);\n if (active) {\n deps.scrollIntoView(active.host);\n }\n deps.setLastPositionedId(activeId);\n}\n","import { computed, inject, InjectionToken, type Signal } from '@angular/core';\nimport type { ReferenceElement } from '@floating-ui/dom';\n\nimport {\n assertRootContext,\n type CollectionHandle,\n type LabelCacheEntry,\n orphanContextError,\n RootedRegistry,\n type RootedHandle,\n unresolvedRootError,\n type Unset,\n type VetoableNativeEvent,\n type VirtualizedResume,\n type WritingDirection,\n} from 'forty-cdk/core';\nimport { type FloatingAlign, type FloatingSide } from 'forty-cdk/core-anchored';\nimport { type ForComboboxOpenHighlight } from 'forty-cdk/defaults';\nimport type { ComboboxVirtualizedNavigator } from './combobox-virtualized-navigator';\n\nexport { type ForComboboxOpenHighlight };\n\n/**\n * Why the combobox closed. Mirrors the menu / select vocabulary so consumers\n * can switch on the reason regardless of overlay flavor.\n */\nexport type ForComboboxCloseReason =\n 'escape' | 'pointerDownOutside' | 'focusOutside' | 'select' | 'tab' | 'programmatic';\n\n/**\n * Autocomplete mode applied to the input. Mirrors the\n * [WAI-ARIA combobox autocomplete property](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/#wai-ariaroles,states,andproperties).\n *\n * - `'none'`: input acts as a free-text query; no completion is performed.\n * - `'list'`: the listbox shows filtered options; the input value reflects\n * the user's typed query verbatim.\n * - `'inline'`: the rest of the first matching option is auto-completed\n * into the input as selected text; the listbox does not auto-open. Because\n * the popup never opens, the default `@if (open())` anatomy renders no\n * options and the label cache stays cold — inline completion only kicks in\n * after the options have rendered once (the popup was opened some other way,\n * e.g. ArrowDown / `openOnFocus`). Use `'both'` when a popup is acceptable.\n * - `'both'`: combines `'list'` and `'inline'` — listbox opens with the\n * filtered options *and* the first match auto-completes inline.\n */\nexport type ForComboboxAutocomplete = 'none' | 'list' | 'inline' | 'both';\n\n/**\n * Where the auto-highlight seed lands when the listbox opens. `'first'` / `'last'`\n * bias to the natural extreme (e.g. ArrowDown / ArrowUp on the trigger). `'selected'`\n * — used by the picker trigger's plain open — seeds the committed selection, falling\n * back to the first enabled option when there is no selection or it is filtered out.\n */\nexport type ForComboboxInitialFocus = 'first' | 'last' | 'selected';\n\nexport interface ForComboboxOptionHandle<T = unknown> extends CollectionHandle {\n /**\n * Narrowed from {@link CollectionHandle}'s `Node`: the root scrolls the\n * highlighted option into view.\n */\n readonly host: HTMLElement;\n readonly id: Signal<string>;\n /** The option's value, or {@link Unset} before its binding is written. */\n readonly value: Signal<T | Unset>;\n readonly label: Signal<string>;\n readonly disabled: Signal<boolean>;\n /**\n * Index in the consumer's source array. Required when virtualizing so the\n * directive can fold off-screen options into the snapshot keyed by\n * absolute position. Optional otherwise — when absent the snapshot falls\n * back to DOM order.\n */\n readonly posInSet?: Signal<number | null>;\n}\n\nexport interface ForComboboxChipHandle<T = unknown> extends CollectionHandle {\n /**\n * Narrowed from {@link CollectionHandle}'s `Node`: chip navigation moves DOM\n * focus between hosts.\n */\n readonly host: HTMLElement;\n /** The chip's value, or {@link Unset} before its binding is written. */\n readonly value: Signal<T | Unset>;\n}\n\n/**\n * A registered `[forComboboxAction]` — a non-selecting action affordance\n * (`role=\"button\"`) pinned inside the popup. Tracked in a collection separate\n * from options / chips so it never touches `value` / `options()` /\n * `aria-setsize`.\n */\nexport interface ForComboboxActionHandle extends CollectionHandle {\n /**\n * Narrowed from {@link CollectionHandle}'s `Node`: the action Tab ring moves\n * DOM focus onto the host.\n */\n readonly host: HTMLElement;\n readonly id: Signal<string>;\n readonly disabled: Signal<boolean>;\n}\n\n/**\n * Coordination contract owned by `[forCombobox]` — the surface a consumer\n * reads and drives. Advanced consumers inject the token to read the selection,\n * the query and the open state, and to move them through the root's guards\n * (`activate` / `removeValue` / `clear` / `openOverlay` / `closeOverlay`). The\n * wiring the library's own pieces read off the root is not part\n * of it.\n *\n * The value model is always an array — single mode (`multiple=false`,\n * default) keeps 0 or 1 element, multi mode keeps any number. This mirrors\n * `[forListbox]` / `[forSelect]` so consumers learn one selection contract\n * across the whole library.\n *\n * Generic over the option value type `T` (default `string`). When a\n * consumer binds object items the directive infers `T` from `[(value)]` and\n * the per-piece signatures specialize accordingly. Items are compared via\n * the consumer-provided `compareWith` and rendered as labels via\n * `itemToStringLabel`; the form's hidden inputs serialize via\n * `itemToFormValue`.\n */\nexport interface ForComboboxContext<T = unknown> {\n /**\n * The typed query, as a read-only signal. Mutate it through `clear` or the\n * root's `[(query)]` binding — a direct write would skip the\n * inline-completion / open-on-query side-effects.\n */\n readonly query: Signal<string>;\n /**\n * The current selection, as a read-only signal. Mutate it through the guarded\n * methods (`activate` / `removeValue` / `clear`) or the root's `[(value)]`\n * binding — a direct write would bypass the disabled / readonly guards.\n */\n readonly value: Signal<readonly T[]>;\n /**\n * Whether the listbox is open, as a read-only signal. Mutate it through\n * `toggle` / `openOverlay` / `closeOverlay` or the root's `[(open)]` binding.\n */\n readonly open: Signal<boolean>;\n\n readonly multiple: Signal<boolean>;\n /**\n * The combobox's effective disabled — its own `disabled` input OR'd with a\n * surrounding disabled `[forFieldset]`. Input, options, clear, and chip pieces\n * read this so a disabled combobox (or fieldset) is inert and exposes\n * `aria-disabled`.\n */\n readonly effectiveDisabled: Signal<boolean>;\n readonly readonly: Signal<boolean>;\n readonly required: Signal<boolean>;\n readonly invalid: Signal<boolean>;\n readonly pending: Signal<boolean>;\n readonly dir: Signal<WritingDirection>;\n\n /**\n * Registers the element the listbox is positioned against, instead of the\n * input. The declarative `[forComboboxAnchor]` covers the common case; call\n * this directly when the anchor element is only reachable imperatively — it\n * lives in an ancestor component's template, so a directive placed on it would\n * resolve DI outside this root. One anchor per `[forCombobox]`: a second one\n * warns in dev mode, and the most recently registered one is used.\n */\n registerAnchor(el: HTMLElement): void;\n /**\n * Unregisters the positioning anchor, restoring the input fallback.\n * Reference-based, so an anchor torn down inside `@if` unwinds cleanly.\n */\n unregisterAnchor(el: HTMLElement): void;\n\n readonly options: Signal<readonly ForComboboxOptionHandle<T>[]>;\n\n /**\n * Selected entries paired with their resolved label (from the option\n * cache) — convenient for rendering chips with `@for`. Falls back to\n * `itemToStringLabel(value)` when no matching option is registered.\n */\n readonly selected: Signal<readonly { value: T; label: string }[]>;\n\n /** Id of the currently active option (drives `aria-activedescendant` on the input). */\n readonly activeId: Signal<string | null>;\n\n /** True when `value` includes `v` per the active equality function. */\n isSelected(value: T): boolean;\n\n /**\n * Activate by handle. Single mode replaces + closes + commits label. Multi\n * mode toggles in/out + stays open + (when `commitOnSelect`) clears the\n * query so the user can search the next item. No-op on disabled / readonly.\n */\n activate(handle: ForComboboxOptionHandle<T>): void;\n\n /** Remove a value from `value()`. Used by chip-remove and Backspace heuristics. */\n removeValue(value: T): void;\n\n /**\n * Clear value and (optionally) query. Used by `[forComboboxClear]` and\n * by the Backspace-on-empty-input heuristic. The query is reset only\n * when `clearQuery` is true.\n */\n clear(clearQuery?: boolean): void;\n\n toggle(): void;\n openOverlay(initialFocus?: ForComboboxInitialFocus): void;\n closeOverlay(reason: ForComboboxCloseReason): void;\n}\n\n/**\n * The combobox's piece-coordination surface: everything the library's own\n * pieces read off the root that a consumer has no call to touch — the\n * positioning mirrors `[forComboboxContent]` feeds to floating-ui, the ids the\n * ARIA wiring points at, the element slots, the label caches behind chip and\n * inline-completion rendering, the navigation and activation cursors, and the\n * outside-interaction emit forwarders `injectOverlayShell` drives.\n *\n * **Not** part of {@link ForComboboxContext} and never exported\n * from `public-api.ts`: these are the members a refactor of the anatomy moves,\n * so freezing them at 1.0 would freeze the anatomy with them.\n */\nexport interface ComboboxPieceContext<T = unknown> {\n readonly autocompleteMode: Signal<ForComboboxAutocomplete>;\n readonly openOnFocus: Signal<boolean>;\n readonly openOnQuery: Signal<boolean>;\n readonly openHighlight: Signal<ForComboboxOpenHighlight>;\n readonly commitOnSelect: Signal<boolean>;\n readonly clearOnQueryChange: Signal<boolean>;\n\n readonly dismissible: Signal<boolean>;\n /**\n * Whether focus returns to the `[forComboboxTrigger]` on close (picker\n * anatomy). Ignored in the editable anatomy, where focus never left the\n * input. Default `true`.\n */\n readonly returnFocus: Signal<boolean>;\n readonly side: Signal<FloatingSide | undefined>;\n readonly align: Signal<FloatingAlign>;\n readonly sideOffset: Signal<number>;\n readonly alignOffset: Signal<number>;\n readonly avoidCollisions: Signal<boolean>;\n readonly collisionPadding: Signal<number>;\n readonly sticky: Signal<'partial' | 'always' | false>;\n readonly hideWhenDetached: Signal<boolean>;\n readonly clipUntilPositioned: Signal<boolean>;\n readonly loop: Signal<boolean>;\n\n readonly inputId: Signal<string>;\n readonly contentId: Signal<string>;\n /**\n * Id of the `[forComboboxList]` listbox surface (picker anatomy). The input's\n * `aria-controls` points here when a list is registered; without one it falls\n * back to {@link contentId} (the editable anatomy where content itself is the\n * listbox).\n */\n readonly listId: Signal<string>;\n /**\n * Id of the element carrying `role=\"listbox\"` — {@link listId} when a\n * `[forComboboxList]` is registered, otherwise {@link contentId}. The input\n * targets this with `aria-controls`.\n */\n readonly listboxId: Signal<string>;\n readonly ariaLabel: Signal<string | null>;\n\n /**\n * Element floating-ui anchors the listbox against. Prefers an optional\n * `[forComboboxAnchor]` when registered, otherwise falls back to the input.\n * Decoupled from `input` so the input keeps driving `aria-controls`,\n * `aria-activedescendant`, keyboard interaction, and its outside-pointer\n * exemption regardless of where the listbox paints.\n */\n readonly anchor: Signal<ReferenceElement | null>;\n readonly input: Signal<HTMLInputElement | null>;\n\n /**\n * The optional `[forComboboxTrigger]` button (picker anatomy). When present\n * it is the default positioning anchor (after an explicit `[forComboboxAnchor]`)\n * and the element focus returns to on close. `null` in the editable anatomy.\n */\n readonly trigger: Signal<HTMLElement | null>;\n readonly triggerId: Signal<string | null>;\n\n readonly content: Signal<HTMLElement | null>;\n\n /**\n * The registered `[forComboboxToggle]` and `[forComboboxClear]` buttons.\n * Exempt from the popup's outside-pointer dismissal and treated as inside by\n * the root's focus-out check, so a press on one acts instead of dismissing.\n */\n readonly fieldButtons: Signal<readonly HTMLElement[]>;\n\n /**\n * The optional `[forComboboxList]` listbox surface (picker anatomy). When\n * registered, `[forComboboxContent]` drops its `role=\"listbox\"` semantics —\n * becoming the `role=\"dialog\"` a trigger opens, or a neutral surface without\n * one; the list carries the listbox role and owns the options. `null` in the\n * editable anatomy.\n */\n readonly list: Signal<HTMLElement | null>;\n /** True when a `[forComboboxList]` is registered (picker anatomy). */\n readonly hasList: Signal<boolean>;\n\n /** Multi-mode chip collection. Order follows DOM (= `value()` order in practice). */\n readonly chips: Signal<readonly ForComboboxChipHandle<T>[]>;\n\n /**\n * Non-selecting action collection (`[forComboboxAction]`), kept separate from\n * `options` so an action never appears in `value()`, `aria-setsize`, or\n * `aria-posinset`. Order follows DOM.\n */\n readonly actions: Signal<readonly ForComboboxActionHandle[]>;\n /**\n * True when at least one registered action is enabled. Gates the input's\n * Tab-into-actions behavior: with no enabled action, Tab keeps its default\n * \"close the listbox and let Tab flow on\" semantics.\n */\n readonly hasEnabledActions: Signal<boolean>;\n /**\n * Move DOM focus within the input↔actions ring (model A). The ring is\n * `[input, ...enabledActions]` in DOM order and wraps in both directions, so\n * focus cycles among the input and the pinned actions without ever leaving\n * (or dismissing) the open popup — Escape / outside-pointer remain the way\n * out. `fromActionId === null` means the move originates from the input; pass\n * the action's own id when moving from an action. A stale or disabled\n * `fromActionId` (e.g. an action disabled while it held focus) is resolved\n * against the full action collection, stepping to the nearest enabled\n * neighbor in the requested direction rather than snapping to the input. The\n * ring omits the input slot when no `[forComboboxInput]` is registered, so\n * focus cycles among the enabled actions instead of stranding. No-op when no\n * action is enabled.\n */\n moveActionFocus(fromActionId: string | null, direction: 'next' | 'prev'): void;\n\n /** Compare two items for equality. Defaults to `===`; overridden for object values. */\n readonly compareWith: Signal<(a: T, b: T) => boolean>;\n /** Render an item as a string label. Drives chip labels and `commitOnSelect` writes into the input. */\n readonly itemToStringLabel: Signal<(item: T) => string>;\n /** Serialize an item for the hidden input's `value` attribute. */\n readonly itemToFormValue: Signal<(item: T) => string>;\n\n /**\n * Scroll the current activedescendant option into view. Called by\n * `[forComboboxContent]` from the positioner's first-resolved-position hook so\n * the open-time auto-highlight seed survives the content portal move (which\n * resets `scrollTop`) and lands after the surface is sized. No-op while\n * virtualizing.\n */\n scrollActiveOptionIntoView(): void;\n /**\n * Cached entries for the currently selected values, in selection order.\n * Consumed by the chip label resolution and the root's `selected` fallback,\n * both of which must keep resolving a selected value's label after its option\n * leaves the rendered set — including across a query rebuild that no longer\n * contains it. A selected value whose option was never observed is absent\n * rather than represented; the caller falls back to `itemToStringLabel`.\n */\n selectedEntries(): readonly { id: string; value: T; label: string; disabled: boolean }[];\n /**\n * Cached entries inline-autocomplete matches against in the input directive.\n * Non-virtualized: the most recent non-empty option window, so an option\n * removed from the source stops being offered as a completion. Virtualized:\n * that window overlaid with the navigator's position map, so completion still\n * matches options scrolled out of view. Entries carry `disabled` so completion\n * skips disabled options.\n */\n completionEntries(): readonly { id: string; value: T; label: string; disabled: boolean }[];\n\n /**\n * Total number of options in the consumer's source array. Used for\n * `aria-setsize` and for navigation past the visible window when\n * virtualizing. Falls back to `options().length` when undefined.\n */\n readonly totalCount: Signal<number | undefined>;\n\n /** True when `id` is the activedescendant. */\n isActive(id: string): boolean;\n\n /**\n * Reported by `[forComboboxOption]` on `pointermove`: moves the activedescendant\n * to the hovered option, unless a scroll-into-view opened the pointer-suppression\n * window just before.\n */\n highlightFromPointer(host: HTMLElement, id: string): void;\n\n /** Move the activedescendant to the first / last / next / prev enabled option. */\n navigate(direction: 'next' | 'prev' | 'first' | 'last'): void;\n /**\n * Activate the option currently marked as activedescendant, or, while virtualized, the option it\n * marked before scrolling out of the rendered window (Enter from the input). Returns `false` when\n * neither resolves to an enabled option.\n */\n activateActive(): boolean;\n /**\n * Open from ArrowDown (`'first'`) / ArrowUp (`'last'`) on the editable input:\n * seeds the selection under `openHighlight=\"selected\"` and the extreme otherwise,\n * so ArrowUp with nothing selected still lands on the last enabled option.\n */\n openFromExtreme(extreme: 'first' | 'last'): void;\n\n /** Set the typed query. Emits inline completion / openOnQuery side-effects via the input directive. */\n setQueryFromInput(query: string): void;\n /**\n * Set the query to an inline completion the user accepted. Applies the same\n * guards and `clearOnQueryChange` as {@link setQueryFromInput}, and never opens\n * the listbox, so a completion accepted on blur cannot reopen a popup the same\n * interaction dismissed.\n */\n acceptQueryFromInput(query: string): void;\n\n /** Where focus should land after the listbox opens. The input directive sets this before flipping `open`. */\n readonly initialFocus: Signal<ForComboboxInitialFocus>;\n\n /**\n * The reason of the most recent close (or `null` before any close / after a\n * fresh open). `[forComboboxContent]` reads this so a `'tab'` close skips the\n * return-focus move — Tab has already advanced focus and re-focusing the\n * trigger would steal it back. Only meaningful in the picker anatomy.\n */\n readonly lastCloseReason: Signal<ForComboboxCloseReason | null>;\n\n /**\n * Fires the `(autoFocusOnOpen)` output and returns whether the consumer\n * vetoed (called `preventDefault()`). The picker anatomy moves focus into the\n * input on open; a veto skips that imperative move. Editable anatomy never\n * calls this (focus never moves).\n */\n emitAutoFocusOnOpen(): boolean;\n /**\n * Fires the `(autoFocusOnClose)` output and returns whether the consumer\n * vetoed. The picker anatomy returns focus to the trigger on close; a veto\n * skips it.\n */\n emitAutoFocusOnClose(): boolean;\n\n /**\n * Escape is consumer-owned and routed through the input directive (focus\n * stays in the input), so it is invoked directly with the raw\n * `KeyboardEvent` rather than through the dismissible layer.\n */\n emitEscapeKeyDown(event: KeyboardEvent): void;\n /**\n * Outside-interaction emit forwarders. The specific and composite channels\n * observe the same veto, so `preventDefault()` from either one suppresses the\n * close that otherwise follows.\n */\n emitPointerDownOutside(veto: VetoableNativeEvent<PointerEvent>): void;\n emitFocusOutside(veto: VetoableNativeEvent<FocusEvent>): void;\n emitInteractOutside(veto: VetoableNativeEvent<PointerEvent | FocusEvent>): void;\n /** Implicit close requested by the shell after an un-vetoed outside interaction. */\n requestClose(reason: 'pointerDownOutside' | 'focusOutside'): void;\n}\n\n/**\n * DI token for the combobox's coordination surface, provided by `[forCombobox]`.\n * Publicly typed as the read surface {@link ForComboboxContext}, which is the whole of\n * what the token promises a consumer. The pieces read the same token at an internal type\n * that adds the registration protocol, so a wrapper re-providing it must alias it to the\n * root: `{ provide: FOR_COMBOBOX_CONTEXT, useExisting: MyCombobox }`, where `MyCombobox`\n * extends `ForCombobox`. A value that merely satisfies the declared type resolves too, and\n * is rejected in dev mode by the first piece to reach the protocol.\n *\n * `ForCombobox<T>`'s generic does NOT flow to this token: an `InjectionToken`\n * is a single runtime instance, so it is published at `ForComboboxContext<unknown>`.\n * `injectComboboxContext<T>()` re-applies `T` with an `as unknown as` cast, and\n * each piece (input, option, chip) relies on consumer discipline — the\n * `[forComboboxOption][value]` and the root `[(value)]` must be the same `T`.\n * There is no clean fix without abandoning the token pattern; the contract is\n * the consumer's to honor. Object identity is reconciled at runtime via\n * `compareWith`, which bounds the practical blast radius of a mismatch.\n */\nexport const FOR_COMBOBOX_CONTEXT = new InjectionToken<ForComboboxContext>('FOR_COMBOBOX_CONTEXT');\n\nexport interface ComboboxTriggerHandle extends RootedHandle<object> {\n readonly host: HTMLElement;\n readonly id: Signal<string>;\n}\n\nexport const COMBOBOX_TRIGGERS = new InjectionToken<RootedRegistry<object, ComboboxTriggerHandle>>(\n 'COMBOBOX_TRIGGERS',\n { providedIn: 'root', factory: () => new RootedRegistry() },\n);\n\n/**\n * The combobox's piece-registration protocol: how the input, the optional\n * anchor / list, the options, the chips and the actions wire\n * themselves into the `[forCombobox]` root, plus the two cursors the pieces set\n * (the activedescendant and the next open's initial-focus target).\n *\n * **Not** part of {@link ForComboboxContext} and never exported\n * from `public-api.ts`. It is the code most likely to be refactored, so a\n * consumer must not be able to name — let alone call — it.\n */\nexport interface ComboboxRegistrationContext<T = unknown> {\n /** Registers the `[forComboboxInput]` element. */\n registerInput(el: HTMLInputElement): void;\n /** Unregisters the input element. Reference-based. */\n unregisterInput(el: HTMLInputElement): void;\n /** Registers a `[forComboboxToggle]` or `[forComboboxClear]` button without switching the anatomy. */\n registerFieldButton(el: HTMLElement): void;\n /** Unregisters a toggle or clear button. Reference-based. */\n unregisterFieldButton(el: HTMLElement): void;\n /** Registers the `[forComboboxContent]` popup surface. */\n registerContent(el: HTMLElement): void;\n /** Unregisters the popup surface. Reference-based. */\n unregisterContent(el: HTMLElement): void;\n /** Registers the optional `[forComboboxList]` listbox surface (picker anatomy). */\n registerList(el: HTMLElement): void;\n /** Unregisters the listbox surface. Reference-based. */\n unregisterList(el: HTMLElement): void;\n /** Registers an option so it joins the navigable collection in DOM order. */\n registerOption(handle: ForComboboxOptionHandle<T>): void;\n /** Unregisters an option. Reference-based. */\n unregisterOption(handle: ForComboboxOptionHandle<T>): void;\n /** Registers a multi-mode chip. Order follows DOM. */\n registerChip(handle: ForComboboxChipHandle<T>): void;\n /** Unregisters a chip. Reference-based. */\n unregisterChip(handle: ForComboboxChipHandle<T>): void;\n /** Registers a non-selecting `[forComboboxAction]`, kept out of the option collection. */\n registerAction(handle: ForComboboxActionHandle): void;\n /** Unregisters an action. Reference-based. */\n unregisterAction(handle: ForComboboxActionHandle): void;\n /** Set where focus lands after the next open. The input directive calls it before flipping `open`. */\n setInitialFocus(target: ForComboboxInitialFocus): void;\n /**\n * Called by `[forComboboxVirtualized]` from its constructor. Hands the root the\n * virtualized focus model and returns the root state that model reads and\n * writes.\n */\n registerVirtualization(virtualization: ComboboxVirtualization): ComboboxVirtualizationHost;\n}\n\n/**\n * The virtualized focus model `[forComboboxVirtualized]` lends the root. The\n * root depends on this shape alone, so a combobox without the piece never\n * references the navigation engine.\n */\nexport interface ComboboxVirtualization<T = unknown> {\n /** Full source length, or `undefined` while the piece is present but unset. */\n readonly totalCount: Signal<number | undefined>;\n /** The position the root resumes from once its active option unmounts. */\n readonly resume: VirtualizedResume<T, LabelCacheEntry<T>>;\n /** The navigation engine, constructed on first use. */\n navigator(): ComboboxVirtualizedNavigator<T>;\n /**\n * The rendered window's completion entries merged with the ones the position\n * snapshot remembers from windows scrolled out of view.\n */\n completionEntries(liveWindow: readonly LabelCacheEntry<T>[]): readonly LabelCacheEntry<T>[];\n}\n\n/** The root state the virtualized focus model reads and writes. */\nexport interface ComboboxVirtualizationHost {\n /** Whether auto-highlight is enabled. */\n readonly autoHighlight: () => boolean;\n /** The active option's id. */\n getActiveId(): string | null;\n /** Move the active option, forgetting any retained resume position. */\n setActiveId(id: string | null): void;\n /** Scroll an option into view with the pointer-suppression window open. */\n scrollActiveIntoView(host: HTMLElement): void;\n}\n\n/**\n * The combobox's internal coordination surface: everything\n * {@link ForComboboxContext} publishes plus the {@link ComboboxPieceContext}\n * members and the {@link ComboboxRegistrationContext} protocol.\n *\n * Never exported from `public-api.ts`. It is the type the pieces read\n * {@link FOR_COMBOBOX_CONTEXT} at, so a consumer who injects that token gets the\n * read surface while the pieces get the wiring protocol. `ForCombobox` declares\n * the members neither interface publishes TS-`private`, which keeps them out of\n * the emitted `.d.ts` while `useExisting` still satisfies this contract at\n * runtime.\n */\nexport interface ComboboxContext<T = unknown>\n extends ForComboboxContext<T>, ComboboxPieceContext<T>, ComboboxRegistrationContext<T> {}\n\n/**\n * The constant half of both resolvers' {@link assertRootContext} calls, so the\n * injected and the explicit path state the same requirement.\n */\nconst ROOT_ASSERTION = {\n entryPoint: 'combobox',\n token: 'FOR_COMBOBOX_CONTEXT',\n root: '[forCombobox]',\n};\n\n/**\n * Resolve the surrounding combobox context, re-applying the caller's `T`. The\n * cast through `unknown` is unavoidable (see {@link FOR_COMBOBOX_CONTEXT}): the\n * token can't carry the per-instance generic, so `T` correctness is a\n * consumer-honored contract, not a compiler-enforced one.\n */\nexport function injectComboboxContext<T = unknown>(piece: string): ComboboxContext<T> {\n const ctx = inject(FOR_COMBOBOX_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-COMBOBOX-003',\n piece,\n root: '[forCombobox]',\n token: 'FOR_COMBOBOX_CONTEXT',\n });\n }\n const widened = ctx as unknown as ComboboxContext<T>;\n assertRootContext({\n ...ROOT_ASSERTION,\n piece,\n probe: () => widened.registerInput,\n });\n return widened;\n}\n\n/**\n * Resolves the trigger's root context: the explicit reference when the\n * `[forComboboxTrigger]` input carries one, the injected `FOR_COMBOBOX_CONTEXT`\n * otherwise. The orphan error only fires when neither resolves, on first read\n * of the returned signal. Must be called in an injection context.\n *\n * The explicit reference is a public `ForComboboxContext`, so it is widened back\n * to the internal surface: the runtime object is always the `[forCombobox]`\n * root, which owns the registration protocol the public interface omits. Both\n * paths are guarded, on read rather than at injection time, because the explicit\n * one only resolves inside the `computed`; the explicit widening predates the\n * one-token collapse\n * and was never checked either.\n */\nexport function injectComboboxTriggerContext<T = unknown>(\n explicitRoot: Signal<ForComboboxContext<T> | ''>,\n): {\n readonly root: Signal<ForComboboxContext<T> | ForComboboxContext | null>;\n readonly ctx: Signal<ComboboxContext<T>>;\n} {\n const injected = inject(FOR_COMBOBOX_CONTEXT, { optional: true });\n const root = computed(() => {\n const explicit = explicitRoot();\n return explicit === '' ? injected : explicit;\n });\n const ctx = computed(() => {\n const resolved = root();\n if (!resolved) {\n throw unresolvedRootError({\n code: 'FORCDK-COMBOBOX-004',\n trigger: '[forComboboxTrigger]',\n root: '[forCombobox]',\n token: 'FOR_COMBOBOX_CONTEXT',\n exportAs: 'forCombobox',\n });\n }\n const widened = resolved as unknown as ComboboxContext<T>;\n assertRootContext({\n ...ROOT_ASSERTION,\n piece: 'ForComboboxTrigger',\n probe: () => widened.registerInput,\n });\n return widened;\n });\n return { root, ctx };\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport {\n Collection,\n createPointerHighlight,\n defaultCompareWith,\n defaultItemToFormValue,\n injectFieldAnchor,\n injectHiddenInput,\n injectNativeFormResetToInitial,\n injectTextDirection,\n isUnset,\n LabelCache,\n type LabelCacheEntry,\n lookupByValue,\n nextEnabledHandle,\n selectionMembership,\n singleSelected,\n toggleInArray,\n type VetoableEvent,\n type VetoableNativeEvent,\n type WritingDirection,\n type Unset,\n} from 'forty-cdk/core';\nimport { warnIfOpenWithoutContent } from 'forty-cdk/core-overlay';\nimport {\n AnchoredFormValueControlBase,\n type AnchoredPositioningSeedDefaults,\n anchorSlot,\n injectIdentifiedSlot,\n OverlayController,\n} from 'forty-cdk/core-anchored';\nimport { createActiveIdSignal, revealAutoHighlight } from './combobox-auto-highlight';\nimport {\n COMBOBOX_TRIGGERS,\n FOR_COMBOBOX_CONTEXT,\n type ForComboboxActionHandle,\n type ForComboboxAutocomplete,\n type ForComboboxChipHandle,\n type ForComboboxCloseReason,\n type ForComboboxContext,\n type ForComboboxInitialFocus,\n type ForComboboxOpenHighlight,\n type ForComboboxOptionHandle,\n type ComboboxVirtualization,\n type ComboboxVirtualizationHost,\n} from './combobox-context';\nimport { FOR_COMBOBOX_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Headless implementation of the [WAI-ARIA combobox with listbox popup pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/).\n * Implements `FormValueControl<readonly T[]>` from `@angular/forms/signals`\n * for `[formField]` auto-wiring.\n *\n * Generic over the option value type `T` (default `string`). When the\n * consumer binds object items the directive infers `T` from `[(value)]`\n * and per-piece signatures (`[forComboboxOption][value]`,\n * `[forComboboxChip][value]`) specialize accordingly. Object identity is\n * resolved by the consumer-supplied `[compareWith]` and labels by\n * `[itemToStringLabel]`; the hidden inputs serialize via\n * `[itemToFormValue]` (defaults to `JSON.stringify` for non-strings).\n *\n * Selection is always modeled as `readonly T[]`:\n * - In single mode (`multiple=false`, default), the array has 0 or 1\n * element and option activation closes the listbox.\n * - In multi mode, option activation toggles in/out and the listbox stays\n * open. Selected entries are typically rendered as chips inside\n * `[forComboboxChips]` next to the input.\n *\n * The visible input (\"query\") and the form value are separate two-way\n * bindable models — the consumer keeps them in sync via filtering /\n * display logic, and the primitive only commits to `value` when an option\n * is explicitly activated.\n *\n * Filtering is **always** the consumer's responsibility — the primitive is\n * headless and doesn't filter the registered options. Render the filtered\n * subset with `@for` and the registry tracks them automatically.\n */\n@Directive({\n selector: '[forCombobox]',\n exportAs: 'forCombobox',\n host: {\n '[attr.data-state]': 'open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'effectiveDisabled() ? \"\" : null',\n '[attr.data-readonly]': 'readonly() ? \"\" : null',\n '[attr.dir]': 'dir()',\n '(focusout)': 'onFocusOut($event)',\n },\n providers: [{ provide: FOR_COMBOBOX_CONTEXT, useExisting: ForCombobox }],\n})\nexport class ForCombobox<T = string>\n extends AnchoredFormValueControlBase\n implements FormValueControl<readonly T[]>, ForComboboxContext<T>\n{\n readonly #defaults = inject(FOR_COMBOBOX_DEFAULTS);\n readonly #items = new Collection<ForComboboxOptionHandle<T>>();\n readonly #chips = new Collection<ForComboboxChipHandle<T>>();\n readonly #actions = new Collection<ForComboboxActionHandle>();\n\n protected readonly positioningDefaults: AnchoredPositioningSeedDefaults = this.#defaults;\n\n /**\n * Two-way bindable. Visible input text. The `model()` change emitter\n * (`(queryChange)`) fires only on internal mutations (option activation\n * commit, `clear()`, multi-mode select reset, picker-anatomy reset on\n * close, `restoreQueryOnClose`), never on consumer writes via `[(query)]`.\n */\n readonly query = model<string>('');\n\n /**\n * Two-way bindable. Selected option values. Single mode (`multiple=false`)\n * keeps 0 or 1 element; multi mode keeps any number. The `model()` change\n * emitter (`(valueChange)`) fires only on internal selection changes,\n * never on consumer writes via `[(value)]`.\n */\n readonly value = model<readonly T[]>([]);\n\n /**\n * Compare two items for equality. Defaults to `===`, which is the\n * correct identity for primitive `T` (e.g. strings, numbers). Override\n * when binding object items so the directive can locate selected /\n * removed entries by id (or any other stable key) instead of by\n * reference: `[compareWith]=\"(a, b) => a.id === b.id\"`.\n */\n readonly compareWith = input<(a: T, b: T) => boolean>(defaultCompareWith);\n\n /**\n * Render an item as a string label. Defaults to `String(item)`, which is\n * identity for strings. Drives the visible input text after activation\n * (when `commitOnSelect`) and the chip label fallback in multi mode.\n * Override when binding object items so the directive can fall back to\n * a meaningful label without relying on the option cache being warm:\n * `[itemToStringLabel]=\"(it) => it.name\"`.\n */\n readonly itemToStringLabel = input<(item: T) => string>((item) => String(item));\n\n /**\n * Serialize an item for the hidden input that participates in native\n * form submission. Defaults to identity for strings and to\n * `JSON.stringify` for non-string items so the primitive works out of\n * the box round-tripping objects. Override to emit a specific wire\n * format — typically a per-item id — when the backend expects that:\n * `[itemToFormValue]=\"(it) => it.id\"`.\n */\n readonly itemToFormValue = input<(item: T) => string>(defaultItemToFormValue);\n\n /**\n * Two-way bindable. Whether the listbox is currently shown. Internal\n * transitions: input typing (when `openOnQuery`), focus (when\n * `openOnFocus`), ArrowDown / ArrowUp, Escape, outside dismissal,\n * single-mode option activation.\n */\n readonly open = model<boolean>(false);\n\n /**\n * Whether several options can be selected. In multi mode activation toggles an option and the\n * listbox stays open; single mode keeps `value` at 0 or 1 element and closes on select.\n */\n readonly multiple = input(false, { transform: booleanAttribute });\n\n /**\n * Autocomplete mode applied to the input. Mirrors the\n * [WAI-ARIA `aria-autocomplete` property](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/#wai-ariaroles,states,andproperties)\n * and drives whether the listbox auto-opens on query and whether the\n * input gets inline-completed with the first match. Renamed from\n * `autocomplete` so consumers don't conflate it with the native HTML\n * `autocomplete` attribute (which the directive forces to `\"off\"`).\n *\n * Pure `'inline'` never opens the popup (per APG), so in the default\n * `@if (open())` anatomy no `[forComboboxOption]` renders and the label\n * cache starts cold — a first keystroke into a never-opened inline combobox\n * completes against nothing. Inline completion only works once the options\n * have rendered at least once (the user opened the popup via ArrowDown /\n * `openOnFocus`, warming the cache). Prefer `'both'` when a popup is\n * acceptable, or keep the options mounted, if completion must work from the\n * very first keystroke.\n */\n readonly autocompleteMode = input<ForComboboxAutocomplete>('list');\n\n /** Open the listbox when the input gains focus. Off by default — opening on query / arrow keys is the standard ecosystem behavior. */\n readonly openOnFocus = input(false, { transform: booleanAttribute });\n\n /** Open the listbox when the user starts typing. On by default. Only honored when `autocompleteMode` includes a listbox (`'list'` or `'both'`). */\n readonly openOnQuery = input(true, { transform: booleanAttribute });\n\n /**\n * Where the highlight lands when the editable anatomy opens from focus, click,\n * ArrowDown / ArrowUp, or `openOverlay()` called without an argument. `'selected'`\n * highlights the committed selection, falling back to the first enabled option\n * (ArrowUp: the last) when nothing is selected. Opening from a typed query always\n * highlights the first match, while the picker anatomy and a `[forComboboxToggle]`\n * press always open on the selection. With a `[forComboboxVirtualized]` setting `totalCount`, an open that would\n * land on the selection lands on the first rendered enabled option instead.\n * Defaults to the scope's `openHighlight` (`'first'` unless overridden via\n * `provideForComboboxDefaults`).\n */\n readonly openHighlight = input<ForComboboxOpenHighlight>(this.#defaults.openHighlight);\n\n /**\n * In single mode, copy the activated option's label into `query`. In\n * multi mode, instead **clear** the query so the user can search the\n * next item. On by default in both. Set `false` to leave `query`\n * untouched on activation in either mode.\n *\n * Governs the **editable anatomy** only. In the picker anatomy (a\n * `[forComboboxTrigger]` is registered) the in-panel input is a transient\n * filter, not the value display: the single-mode label copy is always\n * skipped and `query` resets to `''` on close regardless of this flag.\n */\n readonly commitOnSelect = input(true, { transform: booleanAttribute });\n\n /**\n * In single mode, restore the selected option's label into `query` whenever the\n * listbox closes without a pick (Escape, an outside press, Tab, a toggle press,\n * or `closeOverlay()`), and clear it when nothing is selected. A pick keeps the\n * `commitOnSelect` behavior. Ignored in multi mode and in the picker anatomy.\n * Defaults to the scope's `restoreQueryOnClose` (`false` unless overridden via\n * `provideForComboboxDefaults`).\n */\n readonly restoreQueryOnClose = input(this.#defaults.restoreQueryOnClose, {\n transform: booleanAttribute,\n });\n\n /** When the user edits the query, automatically clear the committed `value`. Off by default — most apps want the value preserved across query edits. Single-mode only. */\n readonly clearOnQueryChange = input(false, { transform: booleanAttribute });\n\n /**\n * Auto-highlight the first enabled option whenever the listbox is open\n * and no activedescendant is set (e.g. after the consumer's filter\n * removed the previously-active option). On by default. Set `false` for\n * \"user must arrow before anything is highlighted\" behavior.\n */\n readonly autoHighlight = input(true, { transform: booleanAttribute });\n\n /**\n * Writing direction. Drives chip-cluster keyboard navigation (ArrowLeft /\n * ArrowRight semantics swap in RTL so they follow the visual order, not DOM\n * order) and the default `align` of the listbox (anchors to the right edge\n * of the input in RTL). When unset (default `null`), the inherited ambient\n * direction is resolved from the nearest ancestor carrying a `dir` attribute\n * (or `<html dir>`), defaulting to `'ltr'`. An explicit `[dir]` always wins\n * and the resolved value is reflected to the host `dir` attribute.\n */\n readonly _dirInput = input<WritingDirection | null>(null, { alias: 'dir' });\n readonly dir = injectTextDirection(this._dirInput);\n\n /**\n * Whether arrow navigation wraps past the first / last enabled option. Default `true`.\n * The default is read from `provideForComboboxDefaults` for the surrounding\n * scope.\n */\n readonly loop = input(this.#defaults.loop, { transform: booleanAttribute });\n\n /** When true (default), Escape, pointer-down outside, and focus outside close the listbox. */\n readonly dismissible = input(true, { transform: booleanAttribute });\n\n /**\n * When true (default), focus returns to the `[forComboboxTrigger]` on close\n * in the picker anatomy. In the editable anatomy focus normally never leaves\n * the input, so this only gates the return to the input after a close that\n * unmounts the popup while focus is inside it, such as a `[forComboboxAction]`\n * whose `(activate)` closes it.\n */\n readonly returnFocus = input(true, { transform: booleanAttribute });\n\n /** Manual `aria-label` on the listbox (`[forComboboxList]`, or `[forComboboxContent]` in the editable anatomy) when the input isn't a meaningful name. */\n readonly ariaLabel = input<string | null>(null);\n\n readonly #virtualization = signal<ComboboxVirtualization<T> | null>(null);\n\n /**\n * Full source length while a `[forComboboxVirtualized]` virtualizes the\n * listbox, `undefined` otherwise.\n */\n private readonly totalCount = computed(() => this.#virtualization()?.totalCount());\n\n readonly #virtualized = computed(() => this.totalCount() !== undefined);\n\n /** Emitted before Escape closes the listbox. Call `preventDefault()` to keep it open. */\n readonly escapeKeyDown = output<VetoableNativeEvent<KeyboardEvent>>();\n\n /** Emitted before an outside pointer-down closes the listbox. Vetoable with `preventDefault()`. */\n readonly pointerDownOutside = output<VetoableNativeEvent<PointerEvent>>();\n\n /** Emitted before focus leaving the surface closes the listbox. Vetoable with `preventDefault()`. */\n readonly focusOutside = output<VetoableNativeEvent<FocusEvent>>();\n\n /**\n * Emitted alongside {@link pointerDownOutside} and {@link focusOutside} for consumers that do not\n * care which one occurred. A `preventDefault()` on either channel suppresses the close.\n */\n readonly interactOutside = output<VetoableNativeEvent<PointerEvent | FocusEvent>>();\n\n /**\n * _(picker anatomy only)_ Fires just before focus moves into the input on\n * open. Call `preventDefault()` on the emitted veto to skip the imperative\n * focus move. Only emitted when a `[forComboboxTrigger]` is registered — the\n * editable anatomy keeps focus in the input the whole time and has no move to\n * veto.\n */\n readonly autoFocusOnOpen = output<VetoableEvent>();\n\n /**\n * _(picker anatomy only)_ Fires just before focus returns to the trigger on\n * close. Call `preventDefault()` on the veto to suppress the return-focus.\n */\n readonly autoFocusOnClose = output<VetoableEvent>();\n\n readonly #inputSlot = injectIdentifiedSlot<HTMLInputElement>('for-combobox', 'input');\n readonly #triggers = inject(COMBOBOX_TRIGGERS).of(this);\n readonly #latestTrigger = computed(() => this.#triggers().at(-1) ?? null);\n\n /**\n * The open / close / dismiss machine, shared with the menu and listbox\n * overlays. The combobox supplies both element sides: the controller reports\n * the input's id as the trigger side — the `role=\"combobox\"` id lives there,\n * and `[forComboboxTrigger]` host-binds an id of its own that it hands over on\n * registration — so that slot mints nothing, while the content side is the\n * ordinary identified slot, minted here so `for-combobox-content` keeps\n * following the input's id and preceding the list's.\n */\n readonly #overlay = new OverlayController<ForComboboxInitialFocus, ForComboboxCloseReason>({\n idPrefix: 'for-combobox',\n createTrigger: () => ({\n id: this.#inputSlot.id,\n element: computed(() => this.#latestTrigger()?.host ?? null),\n }),\n defaultInitialFocus: 'first',\n disabled: this.effectiveDisabled,\n dismissible: this.dismissible,\n isOpen: () => this.open(),\n setOpen: (open) => this.open.set(open),\n emit: this,\n escapeReason: 'escape',\n programmaticReason: 'programmatic',\n onClose: (reason) => this.#resetAfterClose(reason),\n });\n\n readonly #listSlot = injectIdentifiedSlot('for-combobox', 'list');\n readonly #anchorSlot = anchorSlot({\n primitive: 'combobox',\n owner: '[forCombobox]',\n claimant: '[forComboboxAnchor]',\n });\n\n readonly inputId = this.#inputSlot.id;\n readonly contentId = this.#overlay.contentId;\n readonly listId = this.#listSlot.id;\n\n readonly input = this.#inputSlot.element;\n\n readonly trigger = this.#overlay.trigger;\n\n /**\n * Element floating-ui anchors the listbox against. Resolution order:\n * explicit `[forComboboxAnchor]` → the surrounding field's `[forFieldAnchor]`\n * → `[forComboboxTrigger]` (picker anatomy) → the input (editable anatomy\n * fallback, so existing comboboxes keep their behavior). Decoupled from\n * `input` so the input keeps driving `aria-controls`,\n * `aria-activedescendant`, keyboard interaction, and its dismissal\n * exemption regardless of where the listbox paints.\n */\n readonly anchor = this.#anchorSlot.resolve(injectFieldAnchor(), this.trigger, this.input);\n\n readonly content = this.#overlay.content;\n\n readonly #fieldButtons = signal<readonly HTMLElement[]>([]);\n private readonly fieldButtons = this.#fieldButtons.asReadonly();\n\n readonly list = this.#listSlot.element;\n /** True once a `[forComboboxList]` has registered (picker anatomy). */\n readonly hasList = computed(() => this.#listSlot.element() !== null);\n /**\n * Id of the element carrying `role=\"listbox\"`: the list when one is\n * registered (picker anatomy), otherwise the content surface (editable\n * anatomy). The input targets this with `aria-controls`.\n */\n readonly listboxId = computed(() => (this.hasList() ? this.listId() : this.contentId()));\n\n private readonly triggerId = computed(() => this.#latestTrigger()?.id() ?? null);\n\n readonly options = this.#items.items;\n readonly chips = this.#chips.items;\n readonly actions = this.#actions.items;\n readonly hasEnabledActions = computed(() => this.#actions.items().some((a) => !a.disabled()));\n\n private readonly initialFocus = this.#overlay.initialFocus;\n\n private readonly lastCloseReason = this.#overlay.lastCloseReason;\n\n /**\n * The activedescendant pointer. Built by {@link createActiveIdSignal} as a\n * `linkedSignal` so the highlight decision is a pure derivation, never a write\n * from an `effect`; it stays writable for the imperative moves that own their\n * own scroll (arrow / Home / End navigation, hover, multi-mode activation, and\n * the virtualized pending-nav resolution). The reset/seed rule lives with the\n * factory in `combobox-auto-highlight.ts`.\n */\n readonly #activeId = createActiveIdSignal<T>({\n query: this.query,\n open: this.open,\n autoHighlight: this.autoHighlight,\n virtualized: this.#virtualized,\n initialFocus: this.#overlay.initialFocus,\n items: this.#items.items,\n value: this.value,\n equals: this.compareWith,\n });\n readonly activeId = this.#activeId.asReadonly();\n\n #lastPositionedId: string | null = null;\n\n readonly #pointer = createPointerHighlight({\n items: () => this.#items.items(),\n activeDescendant: {\n active: () => true,\n claim: (id) => {\n if (!this.isActive(id)) {\n this.setActiveId(id);\n }\n },\n },\n });\n\n /**\n * Bounded option-label cache, shared with `[forSelect]` through\n * `forty-cdk/core`. Keeps `{ id, value, label, disabled }` tuples across\n * close/open in two projections: the selection-keyed one backs\n * {@link selected}'s chip labels (bounded by the selection, so a long-lived\n * remote-search combobox retains the labels of what is selected and nothing\n * else), and the last-window one backs {@link completionEntries} for inline\n * autocomplete. Off-window matching while virtualizing comes from the\n * navigator's position map instead — see {@link completionEntries}.\n */\n readonly #labelCache = new LabelCache<T>({\n items: this.#items.items,\n value: this.value,\n itemToFormValue: this.itemToFormValue,\n compareWith: this.compareWith,\n });\n\n /** The virtualized focus model; only reached while {@link #virtualized} holds. */\n #virtualModel(): ComboboxVirtualization<T> {\n return this.#virtualization()!;\n }\n\n #setActiveId(id: string | null): void {\n if (id !== null) {\n this.#virtualization()?.resume.clear();\n }\n this.#activeId.set(id);\n }\n\n private registerVirtualization(\n virtualization: ComboboxVirtualization,\n ): ComboboxVirtualizationHost {\n this.#virtualization.set(virtualization as unknown as ComboboxVirtualization<T>);\n return {\n autoHighlight: this.autoHighlight,\n getActiveId: () => this.#activeId(),\n setActiveId: (id) => this.#setActiveId(id),\n scrollActiveIntoView: (host) => this.#scrollActiveIntoView(host),\n };\n }\n\n readonly selected = computed<readonly { value: T; label: string }[]>(() => {\n const values = this.value();\n if (values.length === 0) {\n return [];\n }\n const cached = lookupByValue(this.selectedEntries(), (o) => o.value, this.compareWith());\n const toLabel = this.itemToStringLabel();\n return values.map((v) => {\n const opt = cached(v);\n if (opt) {\n return { value: v, label: opt.label };\n }\n return { value: v, label: toLabel(v) };\n });\n });\n\n /**\n * Read-only single-select convenience view of {@link value}. Returns the\n * sole selected item when exactly one is selected, otherwise `null` (empty\n * selection, or multiple selections in `multiple` mode). Lets single-select\n * consumers read `selectedItem()` instead of unwrapping `value()[0]`. The\n * array-backed `value` model remains the source of truth and the\n * `FormValueControl` contract; this is a derived accessor. Distinct from\n * {@link selected}, which pairs every selected value with its resolved\n * label for chip rendering.\n */\n readonly selectedItem = singleSelected(this.value);\n\n /**\n * The combobox's mounted entry point: the `role=\"combobox\"` input, or the\n * `[forComboboxTrigger]` while the input is unmounted — the picker anatomy\n * keeps its input inside the panel, so until it opens the trigger is the\n * only element a surrounding `[forField]` can label or focus.\n */\n readonly #entryPoint = computed(() => this.input() ?? this.trigger());\n\n protected override fieldLabelledElement(): HTMLElement | null {\n return this.#entryPoint();\n }\n\n protected override fieldActivationTarget(): HTMLElement | null {\n return this.trigger();\n }\n\n /**\n * Id a surrounding `[forField]` points its label `for` at. Tracks\n * {@link #entryPoint}: the input's id, or the trigger's own while the input\n * is unmounted — the field only stamps its own id on a target that has none,\n * so nominating `inputId()` there would leave the `for` resolving to no\n * element at all.\n */\n protected override fieldLabelledElementId(): string {\n if (this.input()) {\n return this.inputId();\n }\n return this.triggerId() ?? this.inputId();\n }\n\n /**\n * Move focus to the combobox's entry point, implementing\n * `FormValueControl.focus` from `@angular/forms/signals`. Without this override\n * Signal Forms would focus the host `[forCombobox]` wrapper — which carries no\n * focusable role — so focus-on-error would silently go nowhere. No-op when\n * disabled, or before either the input or a picker trigger has registered.\n */\n override focus(options?: FocusOptions): void {\n if (this.effectiveDisabled()) {\n return;\n }\n this.#entryPoint()?.focus(options);\n }\n\n constructor() {\n super();\n warnIfOpenWithoutContent({\n primitive: 'combobox',\n piece: '[forComboboxContent]',\n condition: 'combobox.open()',\n open: this.open,\n content: this.content,\n });\n injectHiddenInput<T>({\n name: this.name,\n values: this.value,\n serialize: (item) => this.itemToFormValue()(item),\n disabled: this.effectiveDisabled,\n });\n injectNativeFormResetToInitial(this.value);\n injectNativeFormResetToInitial(this.query);\n\n // @sanctioned-pull(label-cache-window): the option window exists only while\n // the listbox is open, and the closed-state fallback reading it has no\n // reader during that cycle.\n effect(() => {\n this.#labelCache.prime();\n });\n\n // The activedescendant decision is a pure derivation in `#activeId`; this\n // effect runs only its non-virtualized imperative tail, documented on\n // `revealAutoHighlight` in `combobox-auto-highlight.ts`.\n effect(() => {\n revealAutoHighlight<T>({\n items: this.#items.items,\n open: this.open,\n virtualized: this.#virtualized,\n getActiveId: () => this.#activeId(),\n getLastPositionedId: () => this.#lastPositionedId,\n setLastPositionedId: (id) => (this.#lastPositionedId = id),\n scrollIntoView: (host) => this.#scrollActiveIntoView(host),\n });\n });\n }\n\n private registerInput(el: HTMLInputElement): void {\n this.#inputSlot.register(el);\n }\n private unregisterInput(el: HTMLInputElement): void {\n this.#inputSlot.unregister(el);\n }\n\n /** See {@link ForComboboxContext.registerAnchor}. */\n registerAnchor(el: HTMLElement): void {\n this.#anchorSlot.register(el);\n }\n /** See {@link ForComboboxContext.unregisterAnchor}. */\n unregisterAnchor(el: HTMLElement): void {\n this.#anchorSlot.unregister(el);\n }\n\n private registerFieldButton(el: HTMLElement): void {\n this.#fieldButtons.update((list) => (list.includes(el) ? list : [...list, el]));\n }\n private unregisterFieldButton(el: HTMLElement): void {\n this.#fieldButtons.update((list) => list.filter((x) => x !== el));\n }\n\n private registerContent(el: HTMLElement): void {\n this.#overlay.registerContent(el);\n }\n private unregisterContent(el: HTMLElement): void {\n this.#overlay.unregisterContent(el);\n }\n\n private registerList(el: HTMLElement): void {\n this.#listSlot.register(el);\n }\n private unregisterList(el: HTMLElement): void {\n this.#listSlot.unregister(el);\n }\n\n private registerOption(handle: ForComboboxOptionHandle<T>): void {\n this.#items.register(handle);\n }\n private unregisterOption(handle: ForComboboxOptionHandle<T>): void {\n if (this.#virtualized() && this.open() && this.#activeId() === handle.id()) {\n this.#virtualModel().resume.retain(handle.posInSet?.() ?? null, handle.value());\n }\n this.#items.unregister(handle);\n }\n\n private registerChip(handle: ForComboboxChipHandle<T>): void {\n this.#chips.register(handle);\n }\n private unregisterChip(handle: ForComboboxChipHandle<T>): void {\n this.#chips.unregister(handle);\n }\n\n private registerAction(handle: ForComboboxActionHandle): void {\n this.#actions.register(handle);\n }\n private unregisterAction(handle: ForComboboxActionHandle): void {\n this.#actions.unregister(handle);\n }\n\n private moveActionFocus(fromActionId: string | null, direction: 'next' | 'prev'): void {\n const all = this.#actions.items();\n const inputEl = this.input();\n let sourceKey = -1;\n if (fromActionId !== null) {\n const idx = all.findIndex((a) => a.id() === fromActionId);\n if (idx !== -1) {\n sourceKey = idx;\n }\n }\n\n if (direction === 'next') {\n const after = this.#scanEnabledAction(all, sourceKey + 1, 1);\n if (after) {\n after.host.focus();\n return;\n }\n if (inputEl) {\n inputEl.focus();\n return;\n }\n this.#scanEnabledAction(all, 0, 1)?.host.focus();\n return;\n }\n\n const before = this.#scanEnabledAction(all, sourceKey - 1, -1);\n if (before) {\n before.host.focus();\n return;\n }\n if (inputEl && sourceKey > -1) {\n inputEl.focus();\n return;\n }\n const last = this.#scanEnabledAction(all, all.length - 1, -1);\n if (last) {\n last.host.focus();\n return;\n }\n inputEl?.focus();\n }\n\n #scanEnabledAction(\n actions: readonly ForComboboxActionHandle[],\n from: number,\n step: 1 | -1,\n ): ForComboboxActionHandle | null {\n for (let i = from; i >= 0 && i < actions.length; i += step) {\n const action = actions[i]!;\n if (!action.disabled()) {\n return action;\n }\n }\n return null;\n }\n\n readonly #isSelected = selectionMembership(this.value, this.compareWith);\n\n isSelected(v: T): boolean {\n return this.#isSelected()(v);\n }\n\n #setSingle(v: T): void {\n if (this.value().length === 1 && this.isSelected(v)) {\n return;\n }\n this.value.set([v]);\n }\n\n private isActive(id: string): boolean {\n return this.#activeId() === id;\n }\n\n private highlightFromPointer(host: HTMLElement, id: string): void {\n this.#pointer.claim(host, id);\n }\n\n activate(handle: ForComboboxOptionHandle<T>): void {\n if (handle.disabled()) {\n return;\n }\n this.#activateValue(handle.value(), handle.label(), handle.id());\n }\n\n #activateValue(v: T | Unset, label: string, id: string | null): void {\n if (this.effectiveDisabled() || this.readonly() || isUnset(v)) {\n return;\n }\n if (this.multiple()) {\n // Toggle in/out of the array. Stay open so the user can keep picking.\n this.value.set(toggleInArray(this.value(), v, this.compareWith()));\n if (this.commitOnSelect()) {\n // Reset query so the next typed prefix searches afresh.\n this.query.set('');\n this.#syncInputValue('');\n }\n if (id !== null) {\n this.#setActiveId(id);\n }\n return;\n }\n // Single mode: replace + close + commit label.\n this.#setSingle(v);\n if (this.commitOnSelect() && this.trigger() === null) {\n this.query.set(label);\n this.#syncInputValue(label);\n }\n this.closeOverlay('select');\n }\n\n /**\n * Imperatively align the visible `<input>` text with `query()` even\n * while the input has focus. The directive's reactive sync skips\n * focused syncs to avoid clobbering inline-autocomplete selection\n * during typing — but activation / clear writes happen *outside* the\n * typing flow and should be visible immediately.\n */\n #syncInputValue(value: string): void {\n const el = this.#inputSlot.element();\n if (el && el.value !== value) {\n el.value = value;\n }\n }\n\n removeValue(v: T): void {\n if (this.effectiveDisabled() || this.readonly()) {\n return;\n }\n const equals = this.compareWith();\n const current = this.value();\n if (!current.some((x) => equals(x, v))) {\n return;\n }\n this.value.set(current.filter((x) => !equals(x, v)));\n }\n\n private activateActive(): boolean {\n const id = this.#activeId();\n if (!id) {\n return this.#activateResumed();\n }\n const handle = this.#items.items().find((o) => o.id() === id);\n if (!handle || handle.disabled()) {\n return false;\n }\n this.activate(handle);\n return true;\n }\n\n #activateResumed(): boolean {\n const virtualization = this.#virtualization();\n if (virtualization === null) {\n return false;\n }\n const resumed = virtualization.resume.resolve();\n if (resumed === null || resumed.entry.disabled) {\n return false;\n }\n virtualization.navigator().seedActive(resumed.pos);\n this.#activateValue(resumed.entry.value, resumed.entry.label, null);\n return true;\n }\n\n private navigate(direction: 'next' | 'prev' | 'first' | 'last'): void {\n if (this.effectiveDisabled()) {\n return;\n }\n if (this.#virtualized()) {\n this.#virtualModel().navigator().navigate(direction);\n return;\n }\n const items = this.#items.items();\n if (items.length === 0) {\n return;\n }\n const currentId = this.#activeId();\n const currentIndex = currentId === null ? -1 : items.findIndex((o) => o.id() === currentId);\n\n // No activedescendant yet + arrow nav: jump to the natural extreme\n // (ArrowDown → first enabled, ArrowUp → last enabled).\n let action = direction;\n if (currentIndex < 0 && direction === 'next') {\n action = 'first';\n } else if (currentIndex < 0 && direction === 'prev') {\n action = 'last';\n }\n\n const target = nextEnabledHandle(items, currentIndex, action, { loop: this.loop() });\n if (target === null) {\n return;\n }\n this.#setActiveId(target.id());\n this.#scrollActiveIntoView(target.host);\n this.#lastPositionedId = target.id();\n }\n\n private setQueryFromInput(query: string): void {\n if (!this.#writeQueryFromInput(query)) {\n return;\n }\n const mode = this.autocompleteMode();\n const hasListbox = mode === 'list' || mode === 'both';\n if (this.openOnQuery() && hasListbox && query.length > 0 && !this.open()) {\n this.openOverlay('first');\n }\n }\n\n private acceptQueryFromInput(query: string): void {\n this.#writeQueryFromInput(query);\n }\n\n #writeQueryFromInput(query: string): boolean {\n if (this.effectiveDisabled() || this.readonly()) {\n return false;\n }\n this.query.set(query);\n this.#virtualization()?.resume.clear();\n if (this.clearOnQueryChange() && !this.multiple() && this.value().length > 0) {\n this.value.set([]);\n }\n return true;\n }\n\n private setActiveId(id: string | null): void {\n this.#setActiveId(id);\n this.#lastPositionedId = id;\n }\n\n #scrollActiveIntoView(host: HTMLElement): void {\n this.#pointer.suppress();\n host.scrollIntoView?.({ block: 'nearest' });\n }\n\n /**\n * Scroll the current activedescendant option into view. Driven from\n * `[forComboboxContent]`'s positioner first-resolved-position hook\n * (`onFirstPosition`) — the only moment both prerequisites hold: the content\n * has been portaled to `document.body` (which resets the scroll container's\n * `scrollTop` to 0, wiping the seed scroll the auto-highlight bridge applied\n * during change detection) and `@floating-ui/dom`'s `size` middleware has\n * constrained the surface to its `max-height` (so it is actually scrollable).\n *\n * Re-applies the scroll unconditionally — the bridge already recorded this id\n * as positioned, but the portal move invalidated the real scroll position, so\n * the usual \"already positioned\" guard must not short-circuit here. Fires once\n * per open (the positioner hook is per-open, not per-run, so a side flip while\n * open never re-fires it and yanks the user's scroll back), so a later hover\n * never scrolls. No-op while virtualizing: the navigator owns the virtualized\n * scroll and the indexed seed is intentionally passive.\n */\n private scrollActiveOptionIntoView(): void {\n if (this.#virtualized()) {\n return;\n }\n const id = this.#activeId();\n if (id === null) {\n return;\n }\n const active = this.#items.items().find((o) => o.id() === id);\n if (!active) {\n return;\n }\n this.#scrollActiveIntoView(active.host);\n this.#lastPositionedId = id;\n }\n\n private selectedEntries(): readonly { id: string; value: T; label: string; disabled: boolean }[] {\n return this.#labelCache.selectedEntries();\n }\n\n readonly #completionEntriesMemo = computed<readonly LabelCacheEntry<T>[]>(() => {\n const liveWindow = this.#labelCache.windowEntries();\n if (!this.#virtualized()) {\n return liveWindow;\n }\n return this.#virtualModel().completionEntries(liveWindow);\n });\n\n private completionEntries(): readonly {\n id: string;\n value: T;\n label: string;\n disabled: boolean;\n }[] {\n return this.#completionEntriesMemo();\n }\n\n clear(clearQuery: boolean = true): void {\n if (this.effectiveDisabled() || this.readonly()) {\n return;\n }\n this.value.set([]);\n if (clearQuery) {\n this.query.set('');\n this.#syncInputValue('');\n }\n this.#activeId.set(null);\n this.#virtualization()?.resume.clear();\n }\n\n private setInitialFocus(target: ForComboboxInitialFocus): void {\n this.#overlay.setInitialFocus(target);\n }\n\n toggle(): void {\n this.#overlay.toggle(this.trigger() !== null ? 'selected' : 'first');\n }\n\n /**\n * Opens the listbox, seeding where the auto-highlight lands. Without an\n * argument the seed follows `openHighlight`: the committed selection for\n * `'selected'`, the first enabled option otherwise. Idempotent: an open on a\n * listbox that is already open re-arms nothing, so an ArrowDown that finds the\n * surface mounted leaves the current activedescendant where the user\n * navigated it.\n */\n openOverlay(initialFocus?: ForComboboxInitialFocus): void {\n if (this.open()) {\n return;\n }\n this.#overlay.open(initialFocus ?? this.openHighlight());\n }\n\n private openFromExtreme(extreme: 'first' | 'last'): void {\n const seed =\n this.openHighlight() === 'selected' && (extreme === 'first' || this.value().length > 0)\n ? 'selected'\n : extreme;\n this.openOverlay(seed);\n }\n\n /**\n * Closes the listbox, recording `reason` as the {@link lastCloseReason} the\n * content reads. Idempotent, unlike the shared machine's own close: this is a\n * consumer-facing method, so a `closeOverlay` on an already-closed listbox must\n * not overwrite the previous reason (a `'tab'` close has to survive so the\n * content skips its return-focus) nor re-run the close side effects.\n */\n closeOverlay(reason: ForComboboxCloseReason): void {\n if (!this.open()) {\n return;\n }\n this.#overlay.close(reason);\n }\n\n /**\n * Close side effects, run after the open state flips: the activedescendant is\n * dropped, the virtualized navigator's pending move discarded, and — in the\n * picker anatomy, where the in-panel input is a transient filter rather than\n * the value display — the query reset. A single-select editable combobox with\n * `restoreQueryOnClose` instead restores the selected label on any close but a\n * pick.\n */\n #resetAfterClose(reason: ForComboboxCloseReason): void {\n this.#activeId.set(null);\n const virtualization = this.#virtualization();\n if (virtualization !== null) {\n virtualization.resume.clear();\n if (this.#virtualized()) {\n virtualization.navigator().resetPending();\n }\n }\n if (this.trigger() !== null) {\n this.query.set('');\n this.#syncInputValue('');\n return;\n }\n if (this.restoreQueryOnClose() && !this.multiple() && reason !== 'select') {\n const label = this.selected()[0]?.label ?? '';\n this.query.set(label);\n this.#syncInputValue(label);\n }\n }\n\n /** Fire `(autoFocusOnOpen)` and report whether the consumer vetoed the focus move. */\n private emitAutoFocusOnOpen(): boolean {\n return this.#overlay.emitAutoFocusOnOpen();\n }\n\n /** Fire `(autoFocusOnClose)` and report whether the consumer vetoed the return-focus. */\n private emitAutoFocusOnClose(): boolean {\n return this.#overlay.emitAutoFocusOnClose();\n }\n\n private emitEscapeKeyDown(event: KeyboardEvent): void {\n this.#overlay.emitEscapeKeyDown(event);\n }\n\n /**\n * Outside-interaction emit forwarders. The shared `#pendingOutsideVeto`\n * reuse between the specific outside channels and the composite\n * `interactOutside` lives in `injectOverlayShell`; these only fire the\n * matching output with the veto the shell built.\n */\n private emitPointerDownOutside(veto: VetoableNativeEvent<PointerEvent>): void {\n this.#overlay.emitPointerDownOutside(veto);\n }\n private emitFocusOutside(veto: VetoableNativeEvent<FocusEvent>): void {\n this.#overlay.emitFocusOutside(veto);\n }\n private emitInteractOutside(veto: VetoableNativeEvent<PointerEvent | FocusEvent>): void {\n this.#overlay.emitInteractOutside(veto);\n }\n\n /**\n * Implicit close requested by the shell after an un-vetoed outside\n * interaction. The shared machine's own open guard keeps a stale event from\n * clobbering the previous close reason.\n *\n * The touch mark sits **ahead** of that guard rather than on the\n * machine's `onDismiss` hook, which is where `[forSelect]` / `[forTimePicker]`\n * put theirs: an outside interaction is this control's blur, so it marks the\n * combobox touched exactly like {@link onFocusOut} does — whether or not the\n * listbox was still open when the shell's event arrived. Wiring the hook\n * instead would additionally mark touched on Escape, which leaves focus in the\n * input and therefore blurs nothing.\n */\n private requestClose(reason: 'pointerDownOutside' | 'focusOutside'): void {\n this.markTouched();\n this.#overlay.requestClose(reason);\n }\n\n private onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as HTMLElement | null;\n const inputEl = this.#inputSlot.element();\n const content = this.content();\n if (next) {\n if (inputEl && inputEl.contains(next)) {\n return;\n }\n if (content && content.contains(next)) {\n return;\n }\n // Focus moving to a chip (multi mode) is \"inside\" — chips are an\n // extension of the input area, not an outside boundary.\n const chips = this.#chips.items();\n for (const chip of chips) {\n if (chip.host.contains(next)) {\n return;\n }\n }\n if (this.#fieldButtons().some((button) => button.contains(next))) {\n return;\n }\n }\n this.markTouched();\n }\n}\n","import type { LabelCacheEntry } from 'forty-cdk/core';\n\n/**\n * Overlay the virtualized position snapshot onto the label cache's window\n * entries, so inline autocomplete keeps matching options scrolled out of view.\n *\n * The label cache holds one window at a time, while the navigator's position map\n * accumulates every position it has folded (bounded by `totalCount`, purged on a\n * dataset rebuild). Window entries take precedence — they are the freshest read —\n * and off-window entries follow, sorted by absolute position so a completion walk\n * meets them in list order. De-duplication is by serialized form value, not by\n * `id`: an option that unmounts and remounts under a new id but the same value is\n * one option.\n *\n * Pass an empty map (the non-virtualized case) to get `entries` back unchanged.\n *\n * Internal — not re-exported from `combobox/public-api.ts`.\n */\nexport function mergeOffWindowEntries<T>(\n entries: readonly LabelCacheEntry<T>[],\n indexed: ReadonlyMap<number, LabelCacheEntry<T>>,\n toFormValue: (item: T) => string,\n): readonly LabelCacheEntry<T>[] {\n if (indexed.size === 0) {\n return entries;\n }\n const seen = new Set(entries.map((entry) => toFormValue(entry.value)));\n const merged: LabelCacheEntry<T>[] = [...entries];\n for (const pos of [...indexed.keys()].sort((a, b) => a - b)) {\n const entry = indexed.get(pos)!;\n const key = toFormValue(entry.value);\n if (seen.has(key)) {\n continue;\n }\n seen.add(key);\n merged.push(entry);\n }\n return merged;\n}\n","import {\n isUnset,\n type LabelCacheEntry,\n VirtualizedNavigator,\n type VirtualizedNavigatorDeps,\n} from 'forty-cdk/core';\nimport type { ForComboboxOptionHandle } from './combobox-context';\n\n/** The shared navigation engine as `ForCombobox` parameterises it. */\nexport type ComboboxVirtualizedNavigator<T> = VirtualizedNavigator<\n ForComboboxOptionHandle<T>,\n LabelCacheEntry<T>\n>;\n\n/**\n * Wire the shared `forty-cdk/core` navigation engine to the combobox option\n * handle: `posInSet` is optional here (an option registered outside a virtualized\n * window carries none), the snapshot entry doubles as a label-cache entry so the\n * scrolled-out-of-view label fallback can read it, an option whose `[value]`\n * binding is not written yet is skipped this fold, and scroll-into-view is\n * routed through `scrollActiveIntoView` so the host's pointer-suppression window\n * opens first — a synthetic `pointermove` from the scroll must not hijack the\n * activedescendant.\n *\n * `deferFoldOnTotalTransition` is the combobox-only tunable: a `totalCount` flip\n * (a query / source rebuild) can fire while `items()` still holds the previous\n * window, so the snapshot empties without folding the stale entries and waits\n * for `items` to catch up.\n *\n * Internal — not re-exported from `combobox/index.ts` or `public-api.ts`.\n */\nexport function createComboboxVirtualizedNavigator<T>(\n deps: VirtualizedNavigatorDeps<ForComboboxOptionHandle<T>>,\n scrollActiveIntoView: (host: HTMLElement) => void,\n): ComboboxVirtualizedNavigator<T> {\n return new VirtualizedNavigator(\n deps,\n {\n posOf: (o) => o.posInSet?.() ?? null,\n idOf: (o) => o.id(),\n hostOf: (o) => o.host,\n isDisabled: (o) => o.disabled(),\n readEntry: (o) => {\n const id = o.id();\n const value = o.value();\n return isUnset(value) ? null : { id, value, label: o.label(), disabled: o.disabled() };\n },\n scrollIntoView: (host) => scrollActiveIntoView(host),\n },\n { deferFoldOnTotalTransition: true },\n );\n}\n","import { Directive, effect, input, numberAttribute, output } from '@angular/core';\n\nimport { type LabelCacheEntry, VirtualizedResume } from 'forty-cdk/core';\nimport { runAutoHighlightBridge } from './combobox-auto-highlight';\nimport { injectComboboxContext } from './combobox-context';\nimport { mergeOffWindowEntries } from './combobox-off-window-merge';\nimport {\n type ComboboxVirtualizedNavigator,\n createComboboxVirtualizedNavigator,\n} from './combobox-virtualized-navigator';\n\n/**\n * Opts a `[forCombobox]` into virtualized navigation, for a listbox whose\n * options the consumer's virtualizer mounts only while they are in view. Placed\n * on the `[forCombobox]` element itself. While `totalCount` is set, each\n * rendered option carries `aria-setsize` / `aria-posinset`, keyboard navigation\n * reaches options outside the rendered window through `(scrollToIndex)`, and\n * inline autocomplete matches options scrolled out of view.\n *\n * A combobox without this directive never bundles the virtualized navigation\n * engine.\n *\n * @example\n * ```html\n * <div forCombobox forComboboxVirtualized [totalCount]=\"items.length\"\n * [visibleRange]=\"range()\" (scrollToIndex)=\"virtualizer.scrollToIndex($event)\">\n * …\n * </div>\n * ```\n */\n@Directive({\n selector: '[forComboboxVirtualized]',\n exportAs: 'forComboboxVirtualized',\n})\nexport class ForComboboxVirtualized {\n readonly #ctx = injectComboboxContext('ForComboboxVirtualized');\n\n /**\n * Total number of options in the consumer's source array. Set when wiring\n * up a virtualized listbox (only the visible window is rendered) so the\n * combobox can reflect `aria-setsize` and walk the snapshot for\n * navigation past the rendered range. Leave unset (default `undefined`) and\n * the combobox falls back to `options().length` (the live registry).\n */\n readonly totalCount = input(undefined, {\n transform: (v: unknown): number | undefined => (v == null ? undefined : numberAttribute(v)),\n });\n\n /**\n * Inclusive-exclusive `[start, end)` range of options currently rendered\n * in the DOM. Used to translate \"move to absolute position N\" into either an\n * in-window highlight update or a request to the consumer to scroll N into\n * view (`(scrollToIndex)`). When `undefined` (default), navigation assumes\n * every option in the snapshot is rendered.\n */\n readonly visibleRange = input<readonly [number, number] | undefined>(undefined);\n\n /**\n * Tells the combobox the source dataset changed **without** a `totalCount`\n * transition — a same-length re-sort or refresh (e.g. sorting a 1000-row\n * list). Bind any value that changes on such a refresh (a version counter,\n * the array reference, a sort-key string); when it changes the position\n * snapshot rebuilds from empty so navigation never resolves against a stale\n * off-window entry. Leave unset (default) when the dataset only ever changes\n * length. Equivalent to calling {@link ForComboboxVirtualized.invalidateSnapshot}\n * imperatively.\n */\n readonly dataVersion = input<unknown>();\n\n /**\n * Emitted when keyboard navigation needs to land on an option whose\n * absolute index falls outside `visibleRange()`. Wire this to the\n * consumer's virtualizer (`scrollToIndex(idx)` on `@tanstack/virtual`,\n * `virtua`, etc.); once the option mounts, the combobox seeds\n * `aria-activedescendant` automatically.\n */\n readonly scrollToIndex = output<number>();\n\n #navigator: ComboboxVirtualizedNavigator<unknown> | null = null;\n\n readonly #resume = new VirtualizedResume<unknown, LabelCacheEntry<unknown>>({\n totalCount: this.totalCount,\n snapshotByPos: () => this.#requireNavigator().snapshotByPos(),\n compareWith: this.#ctx.compareWith,\n });\n\n readonly #host = this.#ctx.registerVirtualization({\n totalCount: this.totalCount,\n resume: this.#resume,\n navigator: () => this.#requireNavigator(),\n completionEntries: (liveWindow) =>\n mergeOffWindowEntries(\n liveWindow,\n this.#requireNavigator().snapshotByPos(),\n this.#ctx.itemToFormValue(),\n ),\n });\n\n constructor() {\n // The activedescendant decision is a pure derivation in the root's\n // `#activeId`; this effect runs only its virtualized imperative tail,\n // documented on `runAutoHighlightBridge` in `combobox-auto-highlight.ts`.\n // @sanctioned-pull(navigator-position-map): the rendered window is transient,\n // so a window nothing reads during is lost to the lazy fold.\n effect(() => {\n runAutoHighlightBridge({\n requireNavigator: () => this.#requireNavigator(),\n items: this.#ctx.options,\n open: this.#ctx.open,\n autoHighlight: this.#host.autoHighlight,\n virtualized: () => this.totalCount() !== undefined,\n initialFocus: this.#ctx.initialFocus,\n getActiveId: () => this.#host.getActiveId(),\n });\n });\n }\n\n /**\n * Force the position snapshot to rebuild from empty on the next fold,\n * discarding stale off-window entries. Call after a same-length dataset\n * refresh (a re-sort / reload that keeps `totalCount` unchanged) when you\n * cannot express the change through the reactive `[dataVersion]` input. No-op\n * while `totalCount` is unset.\n */\n invalidateSnapshot(): void {\n if (this.totalCount() === undefined) {\n return;\n }\n this.#requireNavigator().invalidateSnapshot();\n }\n\n #requireNavigator(): ComboboxVirtualizedNavigator<unknown> {\n return (this.#navigator ??= createComboboxVirtualizedNavigator(\n {\n items: this.#ctx.options,\n totalCount: this.totalCount,\n visibleRange: this.visibleRange,\n loop: this.#ctx.loop,\n getActiveId: () => this.#host.getActiveId(),\n setActiveId: (id) => this.#host.setActiveId(id),\n emitScrollToIndex: (idx) => this.scrollToIndex.emit(idx),\n getResumePos: () => this.#resume.pos(),\n dataVersion: this.dataVersion,\n },\n (host) => this.#host.scrollActiveIntoView(host),\n ));\n }\n}\n","import { Directive, ElementRef, inject } from '@angular/core';\n\nimport { registerHandle } from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * Optional positioning anchor. When present, `[forComboboxContent]` is\n * positioned against this element instead of `[forComboboxInput]` — useful\n * when the input lives inside a decorated field box (padding, prefix icon,\n * clear button, chip cluster) and the listbox should match the visible field\n * rather than the inner `<input>`.\n *\n * Only positioning changes: the input still owns `aria-controls`,\n * `aria-expanded`, `aria-activedescendant`, keyboard interaction, and its\n * exemption from outside-pointer dismissal. If no anchor is registered the\n * listbox falls back to anchoring against the input, so existing usages are\n * unaffected.\n *\n * It wins over a surrounding field's `[forFieldAnchor]`. One\n * `[forComboboxAnchor]` per `[forCombobox]`; a second one warns in dev mode.\n *\n * ```html\n * <div forCombobox [(value)]=\"v\" [(query)]=\"q\">\n * <div forComboboxAnchor class=\"field-box\">\n * <icon />\n * <input forComboboxInput />\n * <button class=\"clear\">×</button>\n * </div>\n * @if (open()) {\n * <div forComboboxContent>…</div>\n * }\n * </div>\n * ```\n */\n@Directive({\n selector: '[forComboboxAnchor]',\n exportAs: 'forComboboxAnchor',\n})\nexport class ForComboboxAnchor {\n readonly #ctx = injectComboboxContext('ForComboboxAnchor');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n constructor() {\n registerHandle(\n this.#host.nativeElement,\n (el) => this.#ctx.registerAnchor(el),\n (el) => this.#ctx.unregisterAnchor(el),\n );\n }\n}\n","import { computed, Directive, ElementRef, inject, input } from '@angular/core';\n\nimport { hostButtonType, hostId, reflectDisabled, registerHandle } from 'forty-cdk/core';\nimport {\n COMBOBOX_TRIGGERS,\n type ForComboboxContext,\n injectComboboxTriggerContext,\n} from './combobox-context';\n\n/**\n * Button that opens the listbox and keeps showing the committed selection\n * (label + icon) while the search input lives **inside** the panel — the\n * \"combobox with trigger\" / picker anatomy. Apply on\n * a real `<button>` so Space / Enter dispatch native click events that toggle\n * via `(click)`.\n *\n * Registering a trigger switches the combobox into the picker anatomy: it\n * becomes the default positioning anchor (after an explicit\n * `[forComboboxAnchor]`), focus moves into `[forComboboxInput]` on open and\n * returns to the trigger on close (the standard `(autoFocusOnOpen)` /\n * `(autoFocusOnClose)` vetoable hooks now fire), and `[forComboboxContent]`\n * expects an inner `[forComboboxList]` to carry the listbox role while the\n * content itself becomes a `role=\"dialog\"` named by this trigger.\n *\n * Wires `role=\"combobox\"`, `aria-haspopup=\"dialog\"`, `aria-expanded`, and\n * `aria-controls` (pointing to the dialog surface while open). A static `id`\n * on the host is kept; without one the trigger gets a generated id. Native\n * `disabled` reflects `effectiveDisabled` (single-purpose trigger). The\n * trigger is exempt from the popup's dismissible layer — clicks on it route\n * through `(click)` instead of racing an outside-pointer dismissal.\n *\n * It also reflects the root's form-control state (`aria-readonly` /\n * `aria-required` / `aria-invalid` / `aria-busy`, truthy-only) plus the\n * `data-readonly` styling hook, because a closed picker exposes no other\n * focusable element: the `[forComboboxInput]` that carries the same state is\n * mounted inside the panel. The `combobox` role is what supports those\n * properties, which the implicit `button` role does not. A `combobox` takes its\n * name from the author rather than from its content, so label it\n * (`aria-labelledby`, `aria-label`, or a surrounding `[forField]`).\n *\n * The trigger keeps the role while the dialog is open, alongside the\n * `role=\"combobox\"` input inside it. They are two widgets in two contexts: the\n * trigger is the collapsed control that owns the dialog popup, the input is\n * the search field that owns the listbox popup, and focus sits on only one of\n * them at a time. Dropping the role on open would change the trigger's\n * semantics under the user while the dialog it names is showing.\n *\n * The root is normally resolved via DI from the enclosing `[forCombobox]`.\n * When the trigger is declared inside an `ng-template` stamped into the root\n * (e.g. via `ngTemplateOutlet`), DI resolves at the template's declaration\n * site and misses the root — pass it explicitly through the selector input,\n * `routerLink`-style: `[forComboboxTrigger]=\"root\"` with `#root=\"forCombobox\"`.\n *\n * Keyboard:\n * - **Click / Enter / Space** — toggle (open moves focus into the input).\n * - **ArrowDown** — open with the committed selection highlighted, falling back\n * to the first enabled option.\n * - **ArrowUp** — open with the committed selection highlighted, falling back\n * to the last enabled option.\n */\n@Directive({\n selector: '[forComboboxTrigger]',\n exportAs: 'forComboboxTrigger',\n host: {\n '[attr.type]': 'buttonType()',\n role: 'combobox',\n '[id]': 'id()',\n '[attr.aria-haspopup]': '\"dialog\"',\n '[attr.aria-expanded]': 'ctx().open() ? \"true\" : \"false\"',\n '[attr.aria-controls]': 'ctx().open() ? ctx().contentId() : null',\n '[attr.aria-readonly]': 'ctx().readonly() ? \"true\" : null',\n '[attr.aria-required]': 'ctx().required() ? \"true\" : null',\n '[attr.aria-invalid]': 'ctx().invalid() ? \"true\" : null',\n '[attr.aria-busy]': 'ctx().pending() ? \"true\" : null',\n '[attr.data-state]': 'ctx().open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'ctx().effectiveDisabled() ? \"\" : null',\n '[attr.data-readonly]': 'ctx().readonly() ? \"\" : null',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForComboboxTrigger<T = unknown> {\n private readonly buttonType = hostButtonType();\n\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Optional explicit reference to the `[forCombobox]` root, named after the\n * selector `routerLink`-style. The bare valueless attribute keeps resolving\n * the enclosing root via DI; pass the root explicitly\n * (`[forComboboxTrigger]=\"root\"`, with `#root=\"forCombobox\"`) when the\n * trigger is declared in an `ng-template` stamped inside the root — DI\n * resolves at the template's declaration site, so the enclosing root is\n * invisible there. The empty string (what the valueless attribute yields) is\n * treated as unset.\n */\n readonly forComboboxTrigger = input<ForComboboxContext<T> | ''>('');\n\n readonly #resolved = injectComboboxTriggerContext<T>(this.forComboboxTrigger);\n private readonly ctx = this.#resolved.ctx;\n\n private readonly id = hostId('for-combobox-trigger');\n\n constructor() {\n const triggers = inject(COMBOBOX_TRIGGERS);\n registerHandle(\n { host: this.#host.nativeElement, id: this.id, root: this.#resolved.root },\n (handle) => triggers.add(handle),\n (handle) => triggers.remove(handle),\n );\n reflectDisabled(computed(() => this.ctx().effectiveDisabled()));\n }\n\n private onClick(): void {\n this.ctx().toggle();\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.ctx().effectiveDisabled()) {\n return;\n }\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.ctx().openOverlay('selected');\n return;\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.ctx().openOverlay(this.ctx().value().length > 0 ? 'selected' : 'last');\n }\n }\n}\n","import { Directive, ElementRef, inject, input } from '@angular/core';\n\nimport {\n hostAriaLabel,\n hostButtonType,\n preventPointerFocus,\n reflectDisabled,\n registerHandle,\n resolveTextInput,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\nimport { FOR_COMBOBOX_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Chevron button next to the editable anatomy's `[forComboboxInput]`, as in the\n * [APG editable combobox examples](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/).\n * Apply on a real `<button>`.\n *\n * A press closes an open listbox, or opens a closed one with the committed\n * selection highlighted (the first enabled option when nothing is selected)\n * and moves focus into the input. The press never takes focus itself, so an\n * input that already has focus keeps it and the combobox is not marked\n * touched. Unlike `[forComboboxTrigger]`, registering a toggle keeps the\n * editable anatomy: `commitOnSelect` still copies the picked label and `query`\n * survives a close.\n *\n * Out of the Tab sequence (`tabindex=\"-1\"`), since the input already owns the\n * keyboard. Wires `aria-expanded` and `aria-controls` (the listbox, while open),\n * an accessible name, and native `disabled` from the combobox's effective\n * disabled. Exempt from the popup's outside-pointer dismissal, like the input.\n */\n@Directive({\n selector: '[forComboboxToggle]',\n exportAs: 'forComboboxToggle',\n host: {\n '[attr.type]': 'buttonType()',\n tabindex: '-1',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.aria-expanded]': 'ctx.open() ? \"true\" : \"false\"',\n '[attr.aria-controls]': 'ctx.open() ? ctx.listboxId() : null',\n '[attr.data-state]': 'ctx.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'ctx.effectiveDisabled() ? \"\" : null',\n '(click)': 'onClick()',\n },\n})\nexport class ForComboboxToggle {\n private readonly buttonType = hostButtonType();\n\n private readonly ctx = injectComboboxContext('ForComboboxToggle');\n readonly #defaults = inject(FOR_COMBOBOX_DEFAULTS);\n\n /**\n * Accessible name for the toggle, exposed as `aria-label`. Defaults to the\n * scope's `toggleAriaLabel` (`'Show options'` unless overridden via\n * `provideForComboboxDefaults`); set `[ariaLabel]` to override per-instance,\n * or `null` to drop the attribute.\n */\n readonly ariaLabel = input<string | null>();\n\n private readonly resolvedAriaLabel = hostAriaLabel(\n () => resolveTextInput(this.ariaLabel(), this.#defaults.toggleAriaLabel) || null,\n );\n\n constructor() {\n registerHandle(\n inject<ElementRef<HTMLElement>>(ElementRef).nativeElement,\n (el) => this.ctx.registerFieldButton(el),\n (el) => this.ctx.unregisterFieldButton(el),\n );\n reflectDisabled(this.ctx.effectiveDisabled);\n preventPointerFocus();\n }\n\n private onClick(): void {\n if (this.ctx.effectiveDisabled()) {\n return;\n }\n if (this.ctx.open()) {\n this.ctx.closeOverlay('programmatic');\n return;\n }\n this.ctx.openOverlay('selected');\n this.ctx.input()?.focus();\n }\n}\n","import { computed, Directive, DOCUMENT, effect, ElementRef, inject } from '@angular/core';\n\nimport {\n foldTypeaheadText,\n injectNativeFormReset,\n isImeComposing,\n registerHandle,\n reflectDisabled,\n resolveActiveElement,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * The combobox `<input role=\"combobox\">`. Owns the visible text and all\n * keyboard interaction. Apply on a real `<input>` so the browser's native\n * caret / selection semantics drive inline-autocomplete and so the form\n * still behaves like a text field for screen readers.\n *\n * Wires `aria-haspopup=\"listbox\"`, `aria-expanded`, `aria-controls`,\n * `aria-autocomplete`, and `aria-activedescendant` (per APG combobox).\n * Focus stays on the input — arrow keys move the listbox's *active\n * descendant* via id reference, never moving DOM focus into the listbox.\n *\n * Keyboard:\n * - **ArrowDown / ArrowUp** — open + move activedescendant.\n * - **Home / End** (when open) — first / last enabled option. When closed they\n * move the caret, accepting a pending inline completion.\n * - **ArrowLeft / ArrowRight** — move the caret, accepting a pending inline\n * completion.\n * - **PageUp / PageDown** (when open) — first / last enabled option.\n * - **Enter** (when open) — activate the activedescendant. When no option is\n * activated, accept a pending inline completion.\n * - **Escape** (when open) — close (focus stays in input). On the\n * open→closed transition the input value is re-synced to `query()` even\n * while focused, so a consumer restoring the committed label from an\n * `(openChange)` handler renders without reaching for the DOM.\n * - **Tab** (when open) — with a pinned `[forComboboxAction]` registered, move\n * focus into the actions ring instead of closing (model A: focus cycles among\n * the input and the actions, popup stays open, Escape / outside-pointer\n * dismiss). With no action, close and let Tab flow to the next focusable — in\n * the picker anatomy (input inside the body-portaled panel) focus is moved to\n * the trigger first, so Tab advances from the trigger's position rather than\n * the end of the document.\n * - Printable keys: update `query` and (if `autocompleteMode` includes `'inline'`)\n * complete the rest of the first match in the input as selected text. The\n * completion stays out of `query` until it is accepted: by Tab, by Enter\n * when no option is activated, by a caret move that keeps the completed text\n * (ArrowLeft / ArrowRight, and Home / End while closed), by a click in the\n * input, or by blur. Typing replaces it, Backspace removes it, and Escape on\n * an open listbox restores the typed prefix.\n * - During IME composition every keydown is ignored, so the composition-confirm\n * Enter, the candidate-navigation arrows and the cancelling Escape reach the\n * IME instead of activating an option, moving the activedescendant or closing\n * the popup.\n */\n@Directive({\n selector: '[forComboboxInput]',\n exportAs: 'forComboboxInput',\n host: {\n type: 'text',\n role: 'combobox',\n autocomplete: 'off',\n autocorrect: 'off',\n spellcheck: 'false',\n '[id]': 'ctx.inputId()',\n '[attr.aria-haspopup]': '\"listbox\"',\n '[attr.aria-expanded]': 'ctx.open() ? \"true\" : \"false\"',\n '[attr.aria-controls]': 'ctx.open() ? ctx.listboxId() : null',\n '[attr.aria-autocomplete]': 'ariaAutocomplete()',\n '[attr.aria-activedescendant]': 'ctx.open() ? (ctx.activeId() ?? null) : null',\n '[attr.aria-readonly]': 'ctx.readonly() ? \"true\" : null',\n '[attr.aria-required]': 'ctx.required() ? \"true\" : null',\n '[attr.aria-invalid]': 'ctx.invalid() ? \"true\" : null',\n '[attr.aria-busy]': 'ctx.pending() ? \"true\" : null',\n '[attr.readonly]': 'ctx.readonly() ? \"\" : null',\n '[attr.data-state]': 'ctx.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'ctx.effectiveDisabled() ? \"\" : null',\n '(input)': 'onInput($event)',\n '(compositionstart)': 'onCompositionStart()',\n '(compositionend)': 'onCompositionEnd()',\n '(keydown)': 'onKeyDown($event)',\n '(focus)': 'onFocus()',\n '(blur)': 'onBlur()',\n '(click)': 'onClick()',\n },\n})\nexport class ForComboboxInput {\n // The input doesn't introspect the value type — it reads/writes the\n // query string and reads cached labels for inline autocomplete.\n private readonly ctx = injectComboboxContext<unknown>('ForComboboxInput');\n readonly #host = inject<ElementRef<HTMLInputElement>>(ElementRef);\n\n #composing = false;\n #completion: { readonly prefix: string; readonly label: string } | null = null;\n\n private readonly ariaAutocomplete = computed(() => this.ctx.autocompleteMode());\n\n constructor() {\n registerHandle(\n this.#host.nativeElement,\n (el) => this.ctx.registerInput(el),\n (el) => this.ctx.unregisterInput(el),\n );\n reflectDisabled(this.ctx.effectiveDisabled);\n injectNativeFormReset(() => this.#host.nativeElement);\n\n const doc = inject(DOCUMENT);\n\n // Sync DOM input.value to query() when the input doesn't currently have\n // focus (e.g. consumer set [(query)] programmatically, or option\n // activation copied the label into query via commitOnSelect). When the\n // input is focused the user is mid-edit; clobbering input.value would\n // jump the caret and break inline autocomplete state.\n //\n // The open→closed transition is the documented exception: the edit\n // session is over (Escape closes but keeps focus in the input, per APG),\n // so a consumer restoring the committed label — `query.set(label)` from an\n // `(openChange)` handler — must reach the DOM even while focused. The\n // caret-protection rationale no longer applies and a caret jump to the end\n // of the restored text is the expected outcome. `wasOpen` tracks the prior\n // open state to detect the edge; it's a plain transition latch, not derived\n // signal state.\n let wasOpen = this.ctx.open();\n effect(() => {\n const q = this.ctx.query();\n const closing = wasOpen && !this.ctx.open();\n wasOpen = this.ctx.open();\n\n const el = this.#host.nativeElement;\n if (el.value === q) {\n return;\n }\n if (resolveActiveElement(doc) !== el || closing) {\n el.value = q;\n }\n });\n }\n\n private onCompositionStart(): void {\n this.#composing = true;\n }\n\n private onCompositionEnd(): void {\n this.#composing = false;\n if (this.ctx.effectiveDisabled() || this.ctx.readonly()) {\n return;\n }\n this.#syncQuery(true, false);\n }\n\n private onInput(event: Event): void {\n if (this.ctx.effectiveDisabled() || this.ctx.readonly()) {\n return;\n }\n if (this.#composing) {\n return;\n }\n const inputEvent = event as InputEvent;\n const allowInline = !inputEvent.isComposing;\n const isDelete = (inputEvent.inputType ?? '').startsWith('delete');\n this.#syncQuery(allowInline, isDelete);\n }\n\n #syncQuery(allowInline: boolean, isDelete: boolean): void {\n const el = this.#host.nativeElement;\n this.#completion = null;\n\n // The \"user prefix\" is everything before the caret. After inline\n // autocomplete sets a selection on chars [prefixLen..end], typing replaces\n // the selection (caret lands right after the new char) so this still\n // captures the user's intent. On Backspace, the browser deletes the\n // selection without touching the prefix — re-completing here would mean\n // the user can never shorten the query, so we skip completion on delete.\n const caret = el.selectionStart ?? el.value.length;\n const prefix = el.value.slice(0, caret);\n\n const atEnd = caret === el.value.length;\n const mode = this.ctx.autocompleteMode();\n const inlineActive =\n allowInline &&\n !isDelete &&\n atEnd &&\n (mode === 'inline' || mode === 'both') &&\n prefix.length > 0;\n\n if (inlineActive) {\n this.ctx.setQueryFromInput(prefix);\n this.#applyInlineCompletion(prefix);\n } else {\n this.ctx.setQueryFromInput(el.value);\n }\n }\n\n #applyInlineCompletion(prefix: string): void {\n const folded = foldTypeaheadText(prefix);\n const label = this.#inlineCompletionLabel(folded);\n const el = this.#host.nativeElement;\n if (label === null || foldTypeaheadText(label) === folded) {\n // No completion to apply — strip any prior selection so the user's\n // prefix is plainly visible.\n if (el.value !== prefix) {\n el.value = prefix;\n }\n return;\n }\n // Use the option's full label as the visible text (preserving its case),\n // with chars [prefixLen..end] selected so the next keystroke replaces\n // the appended suggestion. Matches native browser autocomplete behavior.\n el.value = label;\n el.setSelectionRange(prefix.length, label.length);\n this.#completion = { prefix, label };\n }\n\n #acceptCompletion(): void {\n const completion = this.#completion;\n this.#completion = null;\n if (\n completion === null ||\n this.#host.nativeElement.value !== completion.label ||\n this.ctx.query() !== completion.prefix\n ) {\n return;\n }\n this.ctx.acceptQueryFromInput(completion.label);\n }\n\n #inlineCompletionLabel(folded: string): string | null {\n const options = this.ctx.options();\n if (options.length > 0) {\n const activeId = this.ctx.activeId();\n if (activeId !== null) {\n const active = options.find((o) => o.id() === activeId);\n if (active && !active.disabled() && foldTypeaheadText(active.label()).startsWith(folded)) {\n return active.label();\n }\n }\n for (const option of options) {\n if (!option.disabled() && foldTypeaheadText(option.label()).startsWith(folded)) {\n return option.label();\n }\n }\n if (this.ctx.totalCount() === undefined) {\n return null;\n }\n }\n const match = this.ctx\n .completionEntries()\n .find((o) => !o.disabled && foldTypeaheadText(o.label).startsWith(folded));\n return match ? match.label : null;\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (isImeComposing(event)) {\n return;\n }\n\n if (this.ctx.effectiveDisabled()) {\n return;\n }\n\n // Multi-mode Backspace heuristic: an empty input sends focus to the\n // last chip so a second Backspace there removes it. Skip when there's a\n // non-empty selection in the input (the user's mid-edit) — Backspace falls\n // through to the native delete-char handler.\n if (\n event.key === 'Backspace' &&\n this.ctx.multiple() &&\n this.#host.nativeElement.value === '' &&\n !this.ctx.readonly() &&\n !this.ctx.effectiveDisabled()\n ) {\n const chips = this.ctx.chips();\n const last = chips[chips.length - 1];\n if (last) {\n event.preventDefault();\n last.host.focus();\n return;\n }\n }\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (!this.ctx.open()) {\n // Open with the natural extreme as the auto-highlight bias —\n // navigate('next') won't fire here because items aren't registered\n // yet; the root's `activeId` linkedSignal seeds the activedescendant\n // once the options register.\n this.ctx.openFromExtreme('first');\n } else {\n this.ctx.navigate('next');\n }\n break;\n\n case 'ArrowUp':\n event.preventDefault();\n if (!this.ctx.open()) {\n this.ctx.openFromExtreme('last');\n } else {\n this.ctx.navigate('prev');\n }\n break;\n\n case 'Home':\n if (this.ctx.open()) {\n event.preventDefault();\n this.ctx.navigate('first');\n } else {\n this.#acceptCompletion();\n }\n break;\n\n case 'End':\n if (this.ctx.open()) {\n event.preventDefault();\n this.ctx.navigate('last');\n } else {\n this.#acceptCompletion();\n }\n break;\n\n case 'ArrowLeft':\n case 'ArrowRight':\n this.#acceptCompletion();\n break;\n\n case 'PageUp':\n if (this.ctx.open()) {\n event.preventDefault();\n this.ctx.navigate('first');\n }\n break;\n\n case 'PageDown':\n if (this.ctx.open()) {\n event.preventDefault();\n this.ctx.navigate('last');\n }\n break;\n\n case 'Enter':\n if (this.ctx.open() && this.ctx.activateActive()) {\n event.preventDefault();\n } else {\n this.#acceptCompletion();\n }\n break;\n\n case 'Escape':\n // Routed through emitEscapeKeyDown so the consumer's\n // (escapeKeyDown) output fires and can veto the close. We still\n // handle Escape inline (not via the dismissible layer) because\n // focus stays in the input — the Escape belongs to this input\n // and shouldn't bubble through nested layers before it sees it.\n if (this.ctx.open()) {\n event.preventDefault();\n event.stopPropagation();\n this.ctx.emitEscapeKeyDown(event);\n }\n break;\n\n case 'Tab':\n this.#acceptCompletion();\n if (this.ctx.open()) {\n if (this.ctx.hasEnabledActions()) {\n event.preventDefault();\n this.ctx.moveActionFocus(null, event.shiftKey ? 'prev' : 'next');\n } else {\n this.ctx.trigger()?.focus();\n this.ctx.closeOverlay('tab');\n }\n }\n break;\n }\n }\n\n private onFocus(): void {\n if (this.ctx.openOnFocus() && !this.ctx.open()) {\n this.ctx.openOverlay();\n }\n }\n\n private onBlur(): void {\n if (!this.#composing) {\n this.#acceptCompletion();\n }\n }\n\n private onClick(): void {\n this.#acceptCompletion();\n // A click on the input while focused mirrors the focus-open intent —\n // useful when the user closed via Escape and wants to re-open without\n // typing or reaching for the keyboard.\n if (this.ctx.openOnFocus() && !this.ctx.open()) {\n this.ctx.openOverlay();\n }\n }\n}\n","import { computed, Directive, ElementRef, inject } from '@angular/core';\n\nimport {\n composedContains,\n registerHandle,\n hostAriaLabel,\n hostLabelledBy,\n injectFieldLabelExemption,\n pressFocusesDescendant,\n preventPointerFocus,\n resolveActiveElement,\n FOR_FIELD_ANCHOR_CONTEXT,\n FOR_FIELD_CONTEXT,\n} from 'forty-cdk/core';\nimport { warnIfMountedWhileClosed } from 'forty-cdk/core-overlay';\nimport { injectOverlayShell, type OverlayShellConfig } from 'forty-cdk/core-anchored';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * The floating surface, portaled to `document.body` and positioned by\n * `@floating-ui/dom` against the anchor (explicit `[forComboboxAnchor]` →\n * `[forComboboxTrigger]` → input).\n *\n * Two anatomies. The **role split** is picked by whether an inner\n * `[forComboboxList]` is present:\n *\n * - **Editable (no list)** — content itself carries `role=\"listbox\"`,\n * `tabindex=\"-1\"`, `aria-multiselectable`, and the labelled role\n * (`aria-label` / `aria-labelledby`). The input's `aria-controls` points here.\n * - **Picker (list present)** — content drops the listbox semantics;\n * `[forComboboxList]` takes over the listbox role and owns the options, the\n * input lives inside the panel, and the input's `aria-controls` points to the\n * list. With a `[forComboboxTrigger]` registered the content is the\n * `role=\"dialog\"` the trigger's `aria-haspopup=\"dialog\"` announces, named by\n * the trigger through `aria-labelledby` (a static `aria-label` or\n * `aria-labelledby` on the host wins); without one it is a neutral surface.\n * `data-state`, positioning and dismissal behave identically in both.\n *\n * Mount/unmount of the visible content is the consumer's responsibility —\n * wrap with `@if (open())` so `animate.enter` / `animate.leave` fire on the\n * natural mount cycle. While mounted, the surface dismisses on pointer-down\n * outside / focus outside; the input, any `[forComboboxToggle]` or\n * `[forComboboxClear]` and (picker anatomy) the trigger are exempt from outside\n * checks.\n *\n * Focus:\n * - **Editable anatomy (no trigger)** — focus stays in the input across the\n * whole open lifecycle and active-option highlighting is\n * `aria-activedescendant`-driven, so the directive exposes no focus hooks. A\n * mouse press anywhere on the surface that lands on no focusable element of its\n * own (padding, a group label, an empty or status row) is cancelled, so it\n * neither focuses the surface nor blurs the input; text in the popup cannot be\n * selected with the mouse as a result. A press on an action still focuses it,\n * and a press on a consumer control takes focus wherever the browser puts it.\n * If focus reaches the surface programmatically, a fallback Escape channel\n * still closes the popup and returns focus to the input. A close that\n * unmounts the surface while focus is inside it (an `(activate)` handler that\n * closes the popup, a pick made while an action holds focus) also returns\n * focus to the input, gated by `[returnFocus]`; a close after focus already\n * left the surface moves nothing.\n * - **Picker anatomy (trigger present)** — on open, focus moves into the input\n * (the search field inside the panel); on close it returns to the trigger.\n * Both moves are vetoable via `(autoFocusOnOpen)` / `(autoFocusOnClose)` on\n * `[forCombobox]`, and the return is gated by `[returnFocus]`. The same press\n * rule applies to the surface and to `[forComboboxList]`, so focus stays on\n * the search input. Escape from the input is owned by the input directive; the\n * shell's fallback channel covers focus that reaches the surface or list\n * programmatically.\n *\n * The two splits are keyed independently — roles off the presence of a list,\n * focus off the presence of a trigger — and the trigger is re-checked at each\n * decision point, so one declared after this content, projected through\n * `<ng-content>`, or gated by a `@defer` still upgrades the surface. Initial\n * focus stays a mount-time decision: a trigger that arrives while the surface is\n * already open does not pull focus out of wherever the user left it, but it does\n * take over the return focus, `(autoFocusOnClose)` and the Escape fallback from\n * there on.\n *\n * A field boundary: a control inside it never registers with an ancestor\n * `[forField]`, and a `[forField]` inside it still wires its own control.\n */\n@Directive({\n selector: '[forComboboxContent]',\n exportAs: 'forComboboxContent',\n host: {\n '[attr.role]': 'role()',\n '[attr.tabindex]': 'hasList() ? null : \"-1\"',\n '[id]': 'ctx.contentId()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.aria-multiselectable]': 'hasList() ? null : (ctx.multiple() ? \"true\" : null)',\n '[attr.data-state]': 'ctx.open() ? \"open\" : \"closed\"',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'onFocusOut($event)',\n },\n providers: [\n { provide: FOR_FIELD_CONTEXT, useValue: null },\n { provide: FOR_FIELD_ANCHOR_CONTEXT, useValue: null },\n ],\n})\nexport class ForComboboxContent {\n private readonly ctx = injectComboboxContext('ForComboboxContent');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n #focusWithin = false;\n\n /** When a `[forComboboxList]` is registered the listbox semantics live there, not here. */\n private readonly hasList = this.ctx.hasList;\n\n readonly #isDialog = computed(() => this.hasList() && this.ctx.triggerId() !== null);\n\n private readonly role = computed(() =>\n this.#isDialog() ? 'dialog' : this.hasList() ? null : 'listbox',\n );\n\n private readonly resolvedAriaLabel = hostAriaLabel(() =>\n this.hasList() ? null : this.ctx.ariaLabel(),\n );\n\n private readonly labelledBy = hostLabelledBy(() => {\n if (this.resolvedAriaLabel()) {\n return null;\n }\n if (this.#isDialog()) {\n return this.ctx.triggerId();\n }\n return this.hasList() ? null : this.ctx.inputId();\n });\n\n constructor() {\n const ctx = this.ctx;\n const host = this.#host.nativeElement;\n registerHandle(\n host,\n (el) => ctx.registerContent(el),\n (el) => ctx.unregisterContent(el),\n );\n preventPointerFocus((event) => !pressFocusesDescendant(event, host));\n\n warnIfMountedWhileClosed({\n primitive: 'combobox',\n piece: '[forComboboxContent]',\n condition: 'combobox.open()',\n open: ctx.open,\n });\n\n // Both focus bundles are always handed to the shell; the anatomy gates them\n // from inside their own callbacks, which the shell runs after construction\n // (`initialFocus` in `afterNextRender`, `returnFocus` on destroy). So the\n // gate reads a fresh `trigger()` at each decision point instead of a\n // construction-time snapshot, and the editable anatomy still fires neither\n // hook.\n const hasTrigger = computed(() => ctx.trigger() !== null);\n\n const config: OverlayShellConfig = {\n positioner: {\n kind: 'floating',\n reference: ctx.anchor,\n open: ctx.open,\n side: ctx.side,\n align: ctx.align,\n sideOffset: ctx.sideOffset,\n alignOffset: ctx.alignOffset,\n avoidCollisions: ctx.avoidCollisions,\n collisionPadding: ctx.collisionPadding,\n sticky: ctx.sticky,\n hideWhenDetached: ctx.hideWhenDetached,\n clipUntilPositioned: ctx.clipUntilPositioned,\n onFirstPosition: () => ctx.scrollActiveOptionIntoView(),\n },\n dismiss: {\n dismissible: ctx.dismissible,\n requestClose: (reason) => ctx.requestClose(reason),\n emitEscapeKeyDown: (event) => {\n ctx.emitEscapeKeyDown(event);\n if (!hasTrigger() && !ctx.open()) {\n ctx.input()?.focus();\n }\n },\n emitPointerDownOutside: (veto) => ctx.emitPointerDownOutside(veto),\n emitFocusOutside: (veto) => ctx.emitFocusOutside(veto),\n emitInteractOutside: (veto) => ctx.emitInteractOutside(veto),\n // The input owns the visible focus and toggles via its own click /\n // focus handlers; the trigger (picker anatomy) toggles via its own\n // click handler, and a toggle or clear button acts on its own press.\n // Without exemption a pointer-down on any of them would race the\n // dismissal layer.\n exemptElements: injectFieldLabelExemption(() => {\n const els: Element[] = [];\n const input = ctx.input();\n if (input) els.push(input);\n const trigger = ctx.trigger();\n if (trigger) els.push(trigger);\n for (const chip of ctx.chips()) els.push(chip.host);\n els.push(...ctx.fieldButtons());\n return els;\n }),\n },\n // Picker anatomy: move focus into the input on open, return it to the\n // trigger on close. The editable anatomy moves focus only back to the\n // input, when a close unmounts the surface while it holds focus, and emits\n // neither hook.\n initialFocus: {\n move: () => {\n const input = ctx.input();\n if (input) {\n input.focus();\n return true;\n }\n return false;\n },\n veto: () => !hasTrigger() || ctx.emitAutoFocusOnOpen(),\n },\n returnFocus: {\n enabled: ctx.returnFocus,\n target: () => ctx.trigger() ?? ctx.input(),\n veto: () => hasTrigger() && ctx.emitAutoFocusOnClose(),\n // On Tab focus already landed where the user tabbed; re-focusing the\n // trigger would steal it back.\n skip: () => {\n if (!hasTrigger()) {\n return !this.#focusLeftWithSurface();\n }\n return ctx.lastCloseReason() === 'tab';\n },\n },\n };\n\n injectOverlayShell(config);\n }\n\n private onFocusIn(): void {\n this.#focusWithin = true;\n }\n\n private onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget;\n if (next instanceof Node && !composedContains(this.#host.nativeElement, next)) {\n this.#focusWithin = false;\n }\n }\n\n #focusLeftWithSurface(): boolean {\n if (!this.#focusWithin) {\n return false;\n }\n const host = this.#host.nativeElement;\n const doc = host.ownerDocument;\n const active = resolveActiveElement(doc);\n return active === null || active === doc.body || composedContains(host, active);\n }\n}\n","import { Directive, ElementRef, inject } from '@angular/core';\n\nimport {\n registerHandle,\n hostAriaLabel,\n hostLabelledBy,\n pressFocusesDescendant,\n preventPointerFocus,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * The `role=\"listbox\"` element of the picker anatomy. Nest it inside\n * `[forComboboxContent]` next to `[forComboboxInput]` so the popup surface can\n * hold a search field without violating `aria-required-owned-elements` (a\n * `listbox` may only own `option` / `group` children). The list owns the\n * options; `[forComboboxContent]` becomes the `role=\"dialog\"` a\n * `[forComboboxTrigger]` opens, or a neutral surface without one.\n *\n * ```html\n * <div forComboboxContent>\n * <input forComboboxInput />\n * <div forComboboxList>\n * @for (item of filtered(); track item.id) {\n * <div forComboboxOption [value]=\"item\">{{ item.label }}</div>\n * }\n * </div>\n * </div>\n * ```\n *\n * Carries `role=\"listbox\"`, `tabindex=\"-1\"` (focus stays in the input,\n * activedescendant-driven; a mouse press on the list that lands on no focusable\n * element of its own is cancelled so it never takes focus from the input),\n * `aria-multiselectable` in multi mode, and the labelled-role `aria-label` /\n * `aria-labelledby`. Its id is what the input's\n * `aria-controls` references in the picker anatomy.\n *\n * When no `[forComboboxList]` is present, `[forComboboxContent]` itself carries\n * the listbox semantics (the editable anatomy) — this part is additive and\n * non-breaking.\n */\n@Directive({\n selector: '[forComboboxList]',\n exportAs: 'forComboboxList',\n host: {\n role: 'listbox',\n tabindex: '-1',\n '[id]': 'ctx.listId()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.aria-multiselectable]': 'ctx.multiple() ? \"true\" : null',\n },\n})\nexport class ForComboboxList {\n private readonly ctx = injectComboboxContext('ForComboboxList');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n private readonly resolvedAriaLabel = hostAriaLabel(() => this.ctx.ariaLabel());\n\n private readonly labelledBy = hostLabelledBy(() =>\n this.resolvedAriaLabel() ? null : this.ctx.inputId(),\n );\n\n constructor() {\n const host = this.#host.nativeElement;\n registerHandle(\n host,\n (el) => this.ctx.registerList(el),\n (el) => this.ctx.unregisterList(el),\n );\n preventPointerFocus((event) => !pressFocusesDescendant(event, host));\n }\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n InjectionToken,\n input,\n type InputSignal,\n} from '@angular/core';\n\nimport {\n accessibleTextContent,\n assertInputBound,\n isUnset,\n registerHandle,\n hostId,\n injectPointerMove,\n preventPointerFocus,\n unsetInput,\n type Unset,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * Injection key the `[forComboboxIndicator]` uses to resolve its parent\n * option, decoupled from the concrete `ForComboboxOption` class.\n * `ForComboboxOption` provides itself under this token, so a design system\n * wrapping the option by subclassing re-points it at the subclass with a\n * single provider (`{ provide: FOR_COMBOBOX_OPTION, useExisting: MyComboboxOption }`)\n * and the indicator keeps resolving — see `docs/wrapping-form-primitives.md`.\n */\nexport const FOR_COMBOBOX_OPTION = new InjectionToken<ForComboboxOption>('FOR_COMBOBOX_OPTION');\n\n/**\n * One option inside a `[forComboboxContent]`. Apply on whatever element\n * fits the design — typically a `<div>` or `<li>`. Click activates:\n * single mode replaces `[(value)]` and closes the listbox; multi mode\n * toggles the value in/out and keeps the listbox open.\n *\n * Generic over the option value type `T` (default `string`). Inferred from\n * the `[value]` binding so consumers can pass either primitive ids or\n * full objects (`[value]=\"city\"` infers `T = City`); the parent\n * `[forCombobox]` must be parameterized over the same `T`.\n *\n * `aria-selected` reflects different things in single vs. multi:\n * - **Single mode**: the option that's the current activedescendant\n * (Enter would activate it). Matches APG select-only-combobox.\n * - **Multi mode**: every option currently in `value()` carries\n * `aria-selected=\"true\"` (multiple \"selected\" entries simultaneously).\n * Matches APG multi-select combobox.\n *\n * `data-state=\"checked\" | \"unchecked\"` always reflects membership in\n * `value()` regardless of mode, so consumers can paint a checkmark with\n * pure CSS in either mode. `data-highlighted` marks the option that is\n * the current activedescendant — shared across the\n * library's roving / activedescendant primitives.\n *\n * Hovering an option also makes it the activedescendant, mirroring native\n * menu / select behavior so mouse and keyboard intent stay synchronized.\n * Pressing one never moves DOM focus: the input keeps the keyboard, so typing\n * and arrow keys carry on after a click.\n */\n@Directive({\n selector: '[forComboboxOption]',\n exportAs: 'forComboboxOption',\n providers: [{ provide: FOR_COMBOBOX_OPTION, useExisting: ForComboboxOption }],\n host: {\n role: 'option',\n '[id]': 'id()',\n '[attr.aria-selected]': 'ariaSelected()',\n '[attr.aria-disabled]': 'effectiveDisabled() ? \"true\" : null',\n '[attr.aria-posinset]': 'ariaPosInSet()',\n '[attr.aria-setsize]': 'ariaSetSize()',\n '[attr.data-state]': 'selected() ? \"checked\" : \"unchecked\"',\n '[attr.data-highlighted]': 'highlighted() ? \"\" : null',\n '[attr.data-disabled]': 'effectiveDisabled() ? \"\" : null',\n '(click)': 'onClick()',\n },\n})\nexport class ForComboboxOption<T = string> {\n readonly #ctx = injectComboboxContext<T>('ForComboboxOption');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Stable identifier serialized into `[(value)]` and the hidden input.\n * Defaults to `string` for back-compat; bind an object to specialize\n * the parent `[forCombobox]` over a richer `T`. The parent's\n * `[compareWith]` decides how options are matched against the\n * committed selection.\n *\n * Mandatory — an unbound option throws in dev mode.\n */\n readonly value: InputSignal<T | Unset> = input(unsetInput<T>());\n\n /**\n * Visible label used by `[forComboboxInput]` for inline autocomplete\n * matching, by `commitOnSelect` to populate the input on selection,\n * and by typeahead / display utilities. When omitted: for string\n * `value` falls back to the trimmed `textContent` of the host element;\n * for object `value` falls back to the parent's `itemToStringLabel(value)`.\n */\n readonly label = input<string | null>(null);\n\n /**\n * Whether the option can be activated. A disabled option stays rendered and announced, and is\n * skipped by arrow navigation and typeahead.\n */\n readonly disabled = input(false, { transform: booleanAttribute });\n\n /**\n * Absolute index of this option in the consumer's source array. Required\n * when wiring up a virtualized listbox so navigation past the rendered\n * window can resolve indices to options (and emit `(scrollToIndex)` when\n * needed). Leave `null` for non-virtualized lists — the directive then\n * falls back to DOM order.\n */\n readonly posInSet = input<number | null>(null);\n\n readonly id = hostId('for-combobox-option');\n\n readonly selected = computed(() => {\n const value = this.value();\n return isUnset(value) ? false : this.#ctx.isSelected(value);\n });\n /** True when this option is the current activedescendant. Reflected as `data-highlighted`. */\n readonly highlighted = computed(() => this.#ctx.isActive(this.id()));\n readonly effectiveDisabled = computed(() => this.disabled() || this.#ctx.effectiveDisabled());\n\n private readonly ariaSelected = computed(() => {\n if (this.#ctx.multiple()) {\n return this.selected() ? 'true' : 'false';\n }\n return this.highlighted() ? 'true' : 'false';\n });\n\n /** Reflects `aria-posinset` (1-based) in the virtualized path; `null` otherwise. */\n private readonly ariaPosInSet = computed<string | null>(() => {\n if (this.#ctx.totalCount() === undefined) {\n return null;\n }\n const pos = this.posInSet();\n return pos === null ? null : String(pos + 1);\n });\n\n /** Reflects `aria-setsize` when the consumer wires up `[totalCount]`. */\n private readonly ariaSetSize = computed<string | null>(() => {\n const total = this.#ctx.totalCount();\n return total === undefined ? null : String(total);\n });\n\n readonly #effectiveLabel = computed(() => {\n const explicit = this.label();\n if (explicit !== null) {\n return explicit;\n }\n const v = this.value();\n if (isUnset(v)) {\n return '';\n }\n if (typeof v === 'string') {\n // String mode: the trimmed `textContent` is the canonical fallback,\n // identical to the pre-generic behaviour. Lets consumers omit\n // `[label]` and have it just work for projected text.\n return accessibleTextContent(this.#host.nativeElement).trim();\n }\n // Object mode: lean on the parent's `itemToStringLabel` so the\n // resolved label is consistent with chip rendering and `commitOnSelect`.\n return this.#ctx.itemToStringLabel()(v);\n });\n\n readonly #handle = {\n host: this.#host.nativeElement,\n id: this.id,\n value: this.value,\n label: this.#effectiveLabel,\n disabled: this.effectiveDisabled,\n posInSet: this.posInSet,\n };\n\n constructor() {\n assertInputBound(this.value, 'combobox', '[forComboboxOption]', 'value');\n registerHandle(\n this.#handle,\n (h) => this.#ctx.registerOption(h),\n (h) => this.#ctx.unregisterOption(h),\n );\n preventPointerFocus();\n injectPointerMove(() => this.onPointerMove());\n }\n\n private onClick(): void {\n if (this.effectiveDisabled() || this.#ctx.readonly()) {\n return;\n }\n this.#ctx.activate(this.#handle);\n }\n\n private onPointerMove(): void {\n if (this.effectiveDisabled()) {\n return;\n }\n this.#ctx.highlightFromPointer(this.#host.nativeElement, this.id());\n }\n}\n","import { Directive, inject } from '@angular/core';\n\nimport { orphanContextError } from 'forty-cdk/core';\n\nimport { FOR_COMBOBOX_OPTION, type ForComboboxOption } from './combobox-option';\n\n/**\n * Visibility helper inside a `[forComboboxOption]`. The directive flips a\n * `[hidden]` host binding so the consumer can keep the checkmark / icon\n * inline without extra `@if` glue:\n *\n * ```html\n * <div forComboboxOption value=\"apple\">\n * <span forComboboxIndicator>✓</span>\n * Apple\n * </div>\n * ```\n *\n * Reflects the parent option's `data-state` (`\"checked\" | \"unchecked\"`) so\n * the consumer can also style it from CSS. Visibility while unselected is\n * enforced with an inline `display: none` (which beats any author `display`\n * rule a consumer applies via a class) in addition to the `hidden` attribute\n * that removes it from the a11y tree.\n *\n * In multi mode the indicator follows membership in `value()`, matching the\n * option's own `data-state` semantics (a checkmark per selected option).\n */\n@Directive({\n selector: '[forComboboxIndicator]',\n exportAs: 'forComboboxIndicator',\n host: {\n 'aria-hidden': 'true',\n '[attr.data-state]': 'option.selected() ? \"checked\" : \"unchecked\"',\n '[hidden]': '!option.selected()',\n '[style.display]': 'option.selected() ? null : \"none\"',\n },\n})\nexport class ForComboboxIndicator {\n private readonly option = injectParentOption();\n}\n\nfunction injectParentOption(): ForComboboxOption {\n const option = inject(FOR_COMBOBOX_OPTION, { optional: true });\n if (!option) {\n throw orphanContextError({\n code: 'FORCDK-COMBOBOX-006',\n piece: 'ForComboboxIndicator',\n root: '[forComboboxOption]',\n token: 'FOR_COMBOBOX_OPTION',\n });\n }\n return option;\n}\n","import { computed, Directive } from '@angular/core';\n\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * Empty-state slot, shown when the listbox has no results: no registered\n * options, or a root `[totalCount]` of `0` when virtualizing, so a virtualized\n * listbox whose window has not rendered yet does not flash the message.\n * The directive hides the message when options exist so the consumer can\n * keep it inline in the template — no `@if` needed. Visibility is enforced\n * with an inline `display: none` (which beats any author `display` rule a\n * consumer applies via a class) in addition to the `hidden` attribute that\n * removes it from the a11y tree.\n *\n * Place it inside `[forComboboxContent]` but **outside** the\n * `[forComboboxList]` that owns the options: content carries `role=\"listbox\"`\n * in the editable anatomy, so wrapping the options in a `[forComboboxList]`\n * keeps this `role=\"status\"` region a sibling of the listbox rather than an\n * invalid listbox child.\n *\n * ```html\n * <div forComboboxContent>\n * <div forComboboxList>\n * @for (option of filtered(); track option.id) {\n * <div forComboboxOption [value]=\"option.id\">{{ option.label }}</div>\n * }\n * </div>\n * <div forComboboxEmpty>No matches.</div>\n * </div>\n * ```\n *\n * Carries `role=\"status\"` as its **single** live-region channel, so screen\n * readers announce the message when it appears — the role implies\n * `aria-live=\"polite\"` and `aria-atomic=\"true\"`, so the message is read whole\n * and neither attribute is emitted beside it. The role rather than the\n * attribute pair because this host self-hides and comes back with its message\n * already in the DOM, which is an insertion into the accessibility tree, and a\n * live *role* is what screen readers read reliably on insertion.\n */\n@Directive({\n selector: '[forComboboxEmpty]',\n exportAs: 'forComboboxEmpty',\n host: {\n role: 'status',\n '[hidden]': '!shouldShow()',\n '[style.display]': 'shouldShow() ? null : \"none\"',\n },\n})\nexport class ForComboboxEmpty {\n readonly #ctx = injectComboboxContext('ForComboboxEmpty');\n private readonly shouldShow = computed(\n () => (this.#ctx.totalCount() ?? this.#ctx.options().length) === 0,\n );\n}\n","import {\n afterNextRender,\n booleanAttribute,\n Directive,\n ElementRef,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport {\n focusAfterPress,\n fortyError,\n hostButtonType,\n hostId,\n isImeComposing,\n registerHandle,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * A non-selecting **action** affordance pinned inside a `[forComboboxContent]`\n * (or beside `[forComboboxList]` in the picker anatomy) — \"Create new…\",\n * \"Manage tags…\", \"Clear all\", etc. Apply on a `<button>` (or any element);\n * the directive carries `role=\"button\"` so it reads and behaves as an action,\n * never as one of the listbox's options. On a native `<button>` host it also\n * forces `type=\"button\"` — through a host binding, so a consumer `type=\"submit\"`\n * is overridden and activating the action never submits a surrounding `<form>`;\n * any other host element gets no `type` attribute, which is not valid there.\n *\n * Unlike `[forComboboxOption]`, an action:\n *\n * - does **not** register with the option / value collection, so it never\n * appears in `value()`, `aria-setsize`, or `aria-posinset`;\n * - emits an `(activate)` output on activation (click / Enter / Space) and\n * **never** mutates `[(value)]`;\n * - is reached by keyboard through Tab, not the option arrow navigation — see\n * the focus model below.\n *\n * **Focus & keyboard (model A).** While the popup is open, Tab / Shift+Tab\n * cycle DOM focus around the ring `[input, ...enabled actions]` (in DOM order,\n * wrapping both ways) **without dismissing** the popup, so a pinned action is\n * reachable in a bounded number of keypresses regardless of how long the option\n * list is (or whether it is virtualized). Escape and outside-pointer still\n * dismiss; on Escape from an action, focus returns to the input (editable\n * anatomy) or the `[forComboboxTrigger]` (picker anatomy). Options stay\n * arrow-navigated via `aria-activedescendant` — the two models never mix.\n *\n * Because the action lives inside the portaled `[forComboboxContent]`, it is\n * naturally \"inside\" the outside-pointer / outside-focus dismissal checks, just\n * like the input.\n *\n * The action must be a sibling of the listbox, never a child of it: in the\n * editable anatomy `[forComboboxContent]` carries `role=\"listbox\"`, which may\n * only own `option` / `group` children, so the options are wrapped in a\n * `[forComboboxList]` and the action sits beside it under the (now role-less)\n * content.\n *\n * ```html\n * <div forComboboxContent>\n * <button forComboboxAction (activate)=\"createNew(query())\">\n * Create \"{{ query() }}\"\n * </button>\n * <div forComboboxList>\n * @for (item of filtered(); track item.id) {\n * <div forComboboxOption [value]=\"item\">{{ item.name }}</div>\n * }\n * </div>\n * </div>\n * ```\n */\n@Directive({\n selector: '[forComboboxAction]',\n exportAs: 'forComboboxAction',\n host: {\n role: 'button',\n '[attr.type]': 'buttonType()',\n '[id]': 'id()',\n tabindex: '-1',\n '[attr.aria-disabled]': 'disabled() ? \"true\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n '[attr.data-highlighted]': 'focused() ? \"\" : null',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n '(focus)': 'focused.set(true)',\n '(blur)': 'focused.set(false)',\n },\n})\nexport class ForComboboxAction {\n private readonly buttonType = hostButtonType();\n\n readonly #ctx = injectComboboxContext('ForComboboxAction');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Disable the action. A disabled action drops out of the focus ring (Tab and\n * Shift+Tab skip it, and it keeps `tabindex=\"-1\"` so the native Tab order\n * never reaches it either), reflects `aria-disabled=\"true\"` +\n * `data-disabled=\"\"`, and ignores activation.\n */\n readonly disabled = input(false, { transform: booleanAttribute });\n\n /**\n * Fired on click / Enter / Space. Purely a side-effect hook — it **never**\n * mutates `[(value)]`, so the form model and `options()` are untouched. The\n * consumer decides what happens (create an item, open a dialog, …) and whether\n * to close the popup afterwards. In the editable anatomy, closing it from here\n * returns focus to the input unless the handler already moved focus out of\n * the popup; the picker anatomy returns it to the `[forComboboxTrigger]` as on\n * any close.\n */\n readonly activate = output<void>();\n\n /** Stable id for the host, used as the ring key. Adopts a consumer-set static `id`. */\n readonly id = hostId('for-combobox-action');\n\n /** True while the action holds DOM focus — reflected as `data-highlighted`. */\n private readonly focused = signal(false);\n\n readonly #handle = {\n host: this.#host.nativeElement,\n id: this.id,\n disabled: this.disabled,\n };\n\n constructor() {\n registerHandle(\n this.#handle,\n (h) => this.#ctx.registerAction(h),\n (h) => this.#ctx.unregisterAction(h),\n );\n\n afterNextRender(() => {\n if (!this.#ctx.hasList()) {\n throw fortyError({\n code: 'FORCDK-COMBOBOX-001',\n message:\n '[forComboboxAction] must sit inside a [forComboboxContent] that also contains a ' +\n '[forComboboxList].',\n cause:\n 'In the editable anatomy [forComboboxContent] carries role=\"listbox\", so a ' +\n 'role=\"button\" action placed directly inside it is an invalid listbox child ' +\n '(aria-required-owned).',\n fix: 'Wrap the options in a <div forComboboxList> so the action becomes a sibling of the listbox.',\n });\n }\n });\n }\n\n private onClick(): void {\n if (this.#isInert()) {\n return;\n }\n focusAfterPress(this.#host.nativeElement);\n this.activate.emit();\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n switch (event.key) {\n case 'Enter':\n case ' ':\n if (this.disabled()) {\n return;\n }\n event.preventDefault();\n if (!this.#isInert()) {\n this.activate.emit();\n }\n break;\n\n case 'Tab':\n if (!this.#ctx.open()) {\n return;\n }\n event.preventDefault();\n this.#ctx.moveActionFocus(this.id(), event.shiftKey ? 'prev' : 'next');\n break;\n\n case 'Escape':\n if (this.disabled() || isImeComposing(event)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.#ctx.emitEscapeKeyDown(event);\n if (!this.#ctx.open() && this.#ctx.trigger() === null) {\n this.#ctx.input()?.focus();\n }\n break;\n }\n }\n\n #isInert(): boolean {\n return this.disabled() || this.#ctx.effectiveDisabled();\n }\n}\n","import { computed, Directive } from '@angular/core';\n\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * Live-region slot for async-filtering feedback (loading, result count,\n * \"no matches\", error messages). Apply on a `<div>` inside the listbox or\n * next to the input. The directive sets `role=\"status\"` so messages projected\n * as content are announced to screen readers when they change.\n *\n * The role is the piece's **single** live-region channel — it already implies `aria-live=\"polite\"`\n * and `aria-atomic=\"true\"`, so neither attribute is emitted beside it.\n *\n * The directive is **content-driven** and picks no message of its own. Project whatever the\n * consumer wants and use the exposed `count` signal to interpolate the option count when relevant.\n *\n * Place it inside `[forComboboxContent]` but **outside** the `[forComboboxList]` that owns the\n * options: content carries `role=\"listbox\"` in the editable anatomy, so wrapping the options in a\n * list keeps this `role=\"status\"` region a sibling of the listbox rather than an invalid child.\n *\n * ```html\n * <div forCombobox [(query)]=\"query\" [(value)]=\"value\" [(open)]=\"open\">\n * <input forComboboxInput placeholder=\"Search…\" />\n * @if (open()) {\n * <div forComboboxContent>\n * <div forComboboxStatus #status=\"forComboboxStatus\">\n * @if (loading()) {\n * Searching…\n * } @else if (status.count() === 0) {\n * No matches.\n * } @else {\n * {{ status.count() }} results.\n * }\n * </div>\n * <div forComboboxList>\n * @for (it of filtered(); track it.id) {\n * <div forComboboxOption [value]=\"it.id\">{{ it.label }}</div>\n * }\n * </div>\n * </div>\n * }\n * </div>\n * ```\n *\n * For an empty-only slot that auto-hides when there are options, use\n * `[forComboboxEmpty]`. `[forComboboxStatus]` stays mounted regardless\n * so transitions like \"loading → 5 results\" are announced as a single\n * change to the same live region.\n */\n@Directive({\n selector: '[forComboboxStatus]',\n exportAs: 'forComboboxStatus',\n host: {\n role: 'status',\n },\n})\nexport class ForComboboxStatus {\n readonly #ctx = injectComboboxContext('ForComboboxStatus');\n\n /**\n * Number of results the listbox holds, for interpolating `{{ status.count() }}`\n * inside the live region: the root's `[totalCount]` when set, so a virtualized\n * listbox announces its full result count rather than its rendered window, and\n * the number of registered options otherwise.\n */\n readonly count = computed(() => this.#ctx.totalCount() ?? this.#ctx.options().length);\n}\n","import { computed, Directive, ElementRef, inject, input } from '@angular/core';\n\nimport {\n hostButtonType,\n hostAriaLabel,\n preventPointerFocus,\n reflectDisabled,\n registerHandle,\n resolveTextInput,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\nimport { FOR_COMBOBOX_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Optional clear button. Apply on a `<button type=\"button\">` so Space /\n * Enter dispatch a native click. Clicking calls `clear()` on the root,\n * which resets `[(value)]` and `[(query)]` and the activedescendant.\n *\n * Carries `aria-label` (default `'Clear'`, or the scope's `clearAriaLabel`\n * from `provideForComboboxDefaults`) so the icon-only button has an\n * accessible name; override per-instance via `[ariaLabel]`.\n *\n * The directive hides the button when there's nothing to clear (no value,\n * empty query) so the consumer can leave it inline in the template without\n * an extra `@if`. Visibility is enforced with an inline `display: none`\n * (which beats any author `display` rule a consumer applies via a class) in\n * addition to the `hidden` attribute that removes it from the a11y tree.\n *\n * The press never takes focus itself, so an input that already has focus keeps\n * it and the combobox is not marked touched. The button is exempt from the\n * listbox's outside-pointer dismissal, so clearing an open listbox leaves it\n * open.\n */\n@Directive({\n selector: '[forComboboxClear]',\n exportAs: 'forComboboxClear',\n host: {\n '[attr.type]': 'buttonType()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[hidden]': '!hasContent()',\n '[style.display]': 'hasContent() ? null : \"none\"',\n '[attr.tabindex]': '-1',\n '(click)': 'onClick()',\n },\n})\nexport class ForComboboxClear {\n private readonly buttonType = hostButtonType();\n\n private readonly ctx = injectComboboxContext('ForComboboxClear');\n readonly #defaults = inject(FOR_COMBOBOX_DEFAULTS);\n\n /**\n * Accessible name for the clear button, exposed as `aria-label`. Defaults\n * to the scope's `clearAriaLabel` (`'Clear'` unless overridden via\n * `provideForComboboxDefaults`); set `[ariaLabel]` to override per-instance,\n * or `null` to drop the attribute.\n */\n readonly ariaLabel = input<string | null>();\n\n private readonly resolvedAriaLabel = hostAriaLabel(\n () => resolveTextInput(this.ariaLabel(), this.#defaults.clearAriaLabel) || null,\n );\n\n private readonly hasContent = computed(\n () => this.ctx.value().length > 0 || this.ctx.query().length > 0,\n );\n\n /** Disabled when the combobox is disabled or read-only — the clear action is unavailable. */\n private readonly isDisabled = computed(() => this.ctx.effectiveDisabled() || this.ctx.readonly());\n\n constructor() {\n registerHandle(\n inject<ElementRef<HTMLElement>>(ElementRef).nativeElement,\n (el) => this.ctx.registerFieldButton(el),\n (el) => this.ctx.unregisterFieldButton(el),\n );\n reflectDisabled(this.isDisabled);\n preventPointerFocus();\n }\n\n private onClick(): void {\n if (this.isDisabled()) {\n return;\n }\n this.ctx.clear(true);\n // Restore focus to the input so the user can keep typing without\n // chasing the caret.\n this.ctx.input()?.focus();\n }\n}\n","import { Directive, inject, input } from '@angular/core';\n\nimport { hostAriaLabel, resolveTextInput } from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\nimport { FOR_COMBOBOX_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Multi-mode chips area. Wrap the chips and the `<input>` together so the\n * combobox visually presents a single editable region:\n *\n * ```html\n * <div forCombobox multiple [(value)]=\"tags\" [(query)]=\"query\" [(open)]=\"open\">\n * <div forComboboxChips>\n * @for (chip of selected(); track chip.value) {\n * <span forComboboxChip [value]=\"chip.value\">\n * {{ chip.label }}\n * <button forComboboxChipRemove></button>\n * </span>\n * }\n * <input forComboboxInput />\n * </div>\n * …\n * </div>\n * ```\n *\n * Carries `role=\"group\"` with `aria-label` (default `'Selected items'`,\n * override via `[ariaLabel]`) so screen readers announce the chip cluster as\n * a single unit. The directive itself doesn't manage focus or selection — the\n * chips and the input own that — but its presence groups them for\n * assistive tech.\n */\n@Directive({\n selector: '[forComboboxChips]',\n exportAs: 'forComboboxChips',\n host: {\n role: 'group',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n },\n})\nexport class ForComboboxChips {\n private readonly ctx = injectComboboxContext('ForComboboxChips');\n readonly #defaults = inject(FOR_COMBOBOX_DEFAULTS);\n\n /**\n * Accessible name for the chip cluster, exposed as `role=\"group\"`'s\n * `aria-label` so screen readers announce the selected chips as a single\n * unit. Defaults to the scope's `chipsAriaLabel` (`'Selected items'` unless\n * overridden via `provideForComboboxDefaults`); set `[ariaLabel]` to\n * override per-instance, or `null` to drop the attribute.\n */\n readonly ariaLabel = input<string | null>();\n\n private readonly resolvedAriaLabel = hostAriaLabel(\n () => resolveTextInput(this.ariaLabel(), this.#defaults.chipsAriaLabel) || null,\n );\n}\n","import { computed, Directive, ElementRef, inject, input, type InputSignal } from '@angular/core';\n\nimport {\n assertInputBound,\n isImeComposing,\n isUnset,\n registerHandle,\n unsetInput,\n type Unset,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * One chip representing a selected value in multi mode. Apply on a\n * `<span>` (or any inline-block element) inside `[forComboboxChips]`.\n * The chip is **out of the Tab cycle** (`tabindex=\"-1\"`) by design:\n * the user reaches it via the input's Backspace heuristic (Backspace on\n * an empty input focuses the last chip), then navigates between chips\n * with ArrowLeft / ArrowRight or removes them with Backspace / Delete.\n *\n * Keyboard while the chip has focus (LTR; the ArrowLeft/Right roles swap\n * in RTL so they always follow visual order):\n * - **ArrowLeft** — focus the previous chip; bounces if first.\n * - **ArrowRight** — focus the next chip; if at the last, focus the input.\n * - **Backspace / Delete** — remove this chip + focus the previous chip,\n * or the next chip when there is no previous one (so removing the first\n * chip lands on the new first chip), falling back to the input only when\n * the removed chip was the last one standing.\n * - **Escape** — dismiss the open popup via the consumer's `(escapeKeyDown)`\n * (a veto keeps it open), then return focus to the input; with the popup\n * already closed it simply returns focus to the input.\n *\n * Click on the chip body (excluding the remove button) just focuses the\n * chip — useful as an alternative to the Backspace path.\n */\n@Directive({\n selector: '[forComboboxChip]',\n exportAs: 'forComboboxChip',\n host: {\n tabindex: '-1',\n '[attr.data-value]': 'dataValue()',\n '[attr.data-disabled]': 'ctx.effectiveDisabled() ? \"\" : null',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForComboboxChip<T = string> {\n private readonly ctx = injectComboboxContext<T>('ForComboboxChip');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The value this chip represents — must match an entry in\n * `[forCombobox][(value)]` per the parent's `[compareWith]`.\n * Generic over `T` (default `string`); inferred from the binding\n * (`[value]=\"someObject\"` specializes `T`). Mandatory — a chip with no binding throws in dev\n * mode.\n */\n readonly value: InputSignal<T | Unset> = input(unsetInput<T>());\n\n /**\n * `data-value` reflection — for string `T` this is the value verbatim\n * (unchanged from the pre-generic behaviour); for object `T` it uses\n * the parent's `itemToFormValue` so the attribute carries the same\n * wire format as the hidden inputs (typically JSON or a per-item id).\n */\n private readonly dataValue = computed(() => {\n const v = this.value();\n if (isUnset(v)) {\n return null;\n }\n return typeof v === 'string' ? (v as string) : this.ctx.itemToFormValue()(v);\n });\n\n /** Resolved label of the underlying option, used by `[forComboboxChipRemove]` for its `aria-label`. */\n readonly label = computed(() => {\n const v = this.value();\n if (isUnset(v)) {\n return '';\n }\n const equals = this.ctx.compareWith();\n const cached = this.ctx.selectedEntries().find((o) => equals(o.value, v));\n if (cached) {\n return cached.label;\n }\n return this.ctx.itemToStringLabel()(v);\n });\n\n constructor() {\n assertInputBound(this.value, 'combobox', '[forComboboxChip]', 'value');\n const handle = {\n host: this.#host.nativeElement,\n value: this.value,\n };\n registerHandle(\n handle,\n (h) => this.ctx.registerChip(h),\n (h) => this.ctx.unregisterChip(h),\n );\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.ctx.effectiveDisabled() || this.ctx.readonly()) {\n return;\n }\n const chips = this.ctx.chips();\n const index = chips.findIndex((c) => c.host === this.#host.nativeElement);\n if (index < 0) {\n return;\n }\n\n // In RTL the chip cluster lays out right-to-left, so ArrowRight must\n // move to the visually-next chip (= DOM-previous) and ArrowLeft to the\n // visually-previous one (= DOM-next), with the input sitting at the\n // visual leftmost edge.\n const rtl = this.ctx.dir() === 'rtl';\n const prevKey = rtl ? 'ArrowRight' : 'ArrowLeft';\n const nextKey = rtl ? 'ArrowLeft' : 'ArrowRight';\n\n switch (event.key) {\n case prevKey: {\n event.preventDefault();\n const prev = chips[index - 1];\n if (prev) {\n prev.host.focus();\n }\n break;\n }\n case nextKey: {\n event.preventDefault();\n const next = chips[index + 1];\n if (next) {\n next.host.focus();\n } else {\n // At the last chip (visual edge in either direction) — hop to the input.\n this.ctx.input()?.focus();\n }\n break;\n }\n case 'Backspace':\n case 'Delete': {\n const v = this.value();\n if (isUnset(v)) {\n break;\n }\n event.preventDefault();\n const prev = chips[index - 1];\n const next = chips[index + 1];\n this.ctx.removeValue(v);\n // Keep focus inside the chip cluster whenever a neighbour survives the\n // removal: prefer the previous chip, otherwise the next one (which\n // slides into the freed slot — so removing the first chip lands on the\n // new first chip rather than ejecting the user to the input). Only drop\n // focus into the input when the removed chip was the last one standing,\n // so the user can keep typing without chasing the caret.\n if (prev) {\n prev.host.focus();\n } else if (next) {\n next.host.focus();\n } else {\n this.ctx.input()?.focus();\n }\n break;\n }\n case 'Escape': {\n if (isImeComposing(event)) {\n return;\n }\n event.preventDefault();\n if (this.ctx.open()) {\n event.stopPropagation();\n this.ctx.emitEscapeKeyDown(event);\n }\n if (!this.ctx.open() && this.ctx.trigger() === null) {\n this.ctx.input()?.focus();\n }\n break;\n }\n }\n }\n}\n","import { computed, Directive, inject } from '@angular/core';\n\nimport { hostButtonType, orphanContextError, reflectDisabled } from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\nimport { ForComboboxChip } from './combobox-chip';\nimport { FOR_COMBOBOX_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Remove button inside a `[forComboboxChip]`. Apply on a\n * `<button type=\"button\">` so click and Space / Enter (when focused) all\n * trigger the same removal flow. The button is out of the Tab cycle\n * (`tabindex=\"-1\"`) so the user navigates the chip cluster via the chip's\n * own ArrowLeft/Right + Backspace/Delete keys; this button exists for\n * mouse / touch users.\n *\n * The host carries a generated `aria-label` (`'Remove <chip label>'` by\n * default) built from the parent chip's resolved option label by the scope's\n * `chipRemoveLabel` builder — override it with\n * `provideForComboboxDefaults({ chipRemoveLabel })` to localize every chip\n * remove button in the scope. Because the name is computed per chip, the piece\n * exposes no per-instance `[ariaLabel]` input and does not adopt a static\n * `aria-label` attribute (one static value would name every chip identically).\n */\n@Directive({\n selector: '[forComboboxChipRemove]',\n exportAs: 'forComboboxChipRemove',\n host: {\n '[attr.type]': 'buttonType()',\n tabindex: '-1',\n '[attr.aria-label]': 'ariaLabel()',\n '(click)': 'onClick($event)',\n },\n})\nexport class ForComboboxChipRemove {\n private readonly buttonType = hostButtonType();\n\n // The value type is opaque to chip-remove: it just forwards whatever the\n // parent chip exposes back into `removeValue`. At runtime the chip and\n // the parent `[forCombobox]` share the same `T` because the consumer\n // binds them with the same value source.\n private readonly ctx = injectComboboxContext<unknown>('ForComboboxChipRemove');\n readonly #chip = inject<ForComboboxChip<unknown>>(ForComboboxChip, { optional: true });\n readonly #defaults = inject(FOR_COMBOBOX_DEFAULTS);\n\n /** Disabled when the combobox is disabled or read-only — chip removal is unavailable. */\n private readonly isDisabled = computed(() => this.ctx.effectiveDisabled() || this.ctx.readonly());\n\n constructor() {\n if (!this.#chip) {\n throw orphanContextError({\n code: 'FORCDK-COMBOBOX-002',\n piece: 'ForComboboxChipRemove',\n root: '[forComboboxChip]',\n token: 'ForComboboxChip',\n });\n }\n reflectDisabled(this.isDisabled);\n }\n\n private readonly ariaLabel = computed(() => this.#defaults.chipRemoveLabel(this.#chip!.label()));\n\n private onClick(event: MouseEvent): void {\n if (this.isDisabled()) {\n return;\n }\n // Don't let the click bubble up to the chip body — that would trigger\n // its keyboard-triggered handlers in some browsers via synthesized events.\n event.stopPropagation();\n this.ctx.removeValue(this.#chip!.value());\n // Restore focus to the input so the user can continue typing.\n this.ctx.input()?.focus();\n }\n}\n","import { Directive, signal } from '@angular/core';\n\nimport { hostLabelledBy } from 'forty-cdk/core';\n\n/**\n * Optional grouping wrapper inside a `[forComboboxContent]`. Renders\n * `role=\"group\"` and references the descendant `[forComboboxGroupLabel]`\n * (if any) via `aria-labelledby`. Options inside a group still register\n * with the root listbox normally, so keyboard navigation traverses across\n * groups in DOM order without special handling.\n */\n@Directive({\n selector: '[forComboboxGroup]',\n exportAs: 'forComboboxGroup',\n host: {\n role: 'group',\n },\n})\nexport class ForComboboxGroup {\n readonly #labelId = signal<string | null>(null);\n\n /** The id of the registered group label (or `null` if none). */\n readonly labelId = this.#labelId.asReadonly();\n\n private readonly labelledBy = hostLabelledBy(() => this.labelId());\n\n /** Called by `ForComboboxGroupLabel` on mount. */\n registerLabel(id: string): void {\n this.#labelId.set(id);\n }\n\n /** Called by `ForComboboxGroupLabel` on destroy. Idempotent. */\n unregisterLabel(id: string): void {\n if (this.#labelId() === id) {\n this.#labelId.set(null);\n }\n }\n}\n","import { Directive, inject } from '@angular/core';\n\nimport { orphanContextError, registerA11yName } from 'forty-cdk/core';\nimport { ForComboboxGroup } from './combobox-group';\n\n/**\n * Visible label for a `[forComboboxGroup]`. Generates a stable id and\n * registers with its parent group so the group's `aria-labelledby` points\n * at this element.\n */\n@Directive({\n selector: '[forComboboxGroupLabel]',\n exportAs: 'forComboboxGroupLabel',\n host: {\n '[id]': 'id',\n },\n})\nexport class ForComboboxGroupLabel {\n /** Stable host id used by the parent group's `aria-labelledby`. */\n readonly id: string;\n\n constructor() {\n const group = inject(ForComboboxGroup, { optional: true });\n if (!group) {\n throw orphanContextError({\n code: 'FORCDK-COMBOBOX-005',\n piece: 'ForComboboxGroupLabel',\n root: '[forComboboxGroup]',\n token: 'ForComboboxGroup',\n });\n }\n this.id = registerA11yName(group, 'for-combobox-group-label');\n }\n}\n","import { Directive, input } from '@angular/core';\n\n/**\n * Visual separator between options or groups inside a `[forComboboxContent]` or a\n * `[forComboboxList]`. Keyboard navigation skips it. It is always presentational\n * (`role=\"none\"`, no `aria-orientation`), because a `role=\"listbox\"` may own only\n * `option` and `group` children: wrap related options in a `[forComboboxGroup]` with a\n * group label when the split must be announced.\n */\n@Directive({\n selector: '[forComboboxSeparator]',\n exportAs: 'forComboboxSeparator',\n host: {\n role: 'none',\n '[attr.data-orientation]': 'orientation()',\n },\n})\nexport class ForComboboxSeparator {\n /**\n * Axis the separator divides along, reflected to `data-orientation` for styling.\n * `horizontal` (default) splits options stacked vertically, the common case in a\n * listbox; `vertical` splits options laid out horizontally.\n */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n}\n","/**\n * Exact public names of every `ForCombobox` input, its models included. Spread it into the\n * `inputs` array of a `hostDirectives` entry so a wrapper component re-exposes the\n * primitive's full surface — the Signal Forms members `[formField]` binds among them —\n * without hand-maintaining the list. Always spread into an inline object literal as shown\n * below: the literal is what keeps the entry statically analyzable for consumers compiling\n * against the published package. An anti-drift spec fails when this list no longer matches\n * the directive's actual API. See `docs/wrapping-form-primitives.md` for both supported\n * wrapping patterns.\n *\n * @example\n * ```ts\n * @Component({\n * selector: 'div[myCombobox]',\n * template: '',\n * hostDirectives: [\n * {\n * directive: ForCombobox,\n * inputs: [...FOR_COMBOBOX_HOST_DIRECTIVE_INPUTS],\n * outputs: [...FOR_COMBOBOX_HOST_DIRECTIVE_OUTPUTS],\n * },\n * ],\n * })\n * export class MyCombobox {}\n * ```\n */\nexport const FOR_COMBOBOX_HOST_DIRECTIVE_INPUTS = [\n 'query',\n 'value',\n 'open',\n 'align',\n 'alignOffset',\n 'ariaLabel',\n 'autoHighlight',\n 'autocompleteMode',\n 'avoidCollisions',\n 'clearOnQueryChange',\n 'clipUntilPositioned',\n 'collisionPadding',\n 'commitOnSelect',\n 'compareWith',\n 'dir',\n 'dirty',\n 'disabled',\n 'dismissible',\n 'errors',\n 'hideWhenDetached',\n 'invalid',\n 'itemToFormValue',\n 'itemToStringLabel',\n 'loop',\n 'multiple',\n 'name',\n 'openHighlight',\n 'openOnFocus',\n 'openOnQuery',\n 'pending',\n 'readonly',\n 'required',\n 'restoreQueryOnClose',\n 'returnFocus',\n 'side',\n 'sideOffset',\n 'sticky',\n 'touched',\n] as const;\n\n/**\n * Exact public names of every `ForCombobox` output, the Signal Forms `touch` output\n * included. Spread it into the `outputs` array of the same `hostDirectives` entry as\n * {@link FOR_COMBOBOX_HOST_DIRECTIVE_INPUTS}.\n */\nexport const FOR_COMBOBOX_HOST_DIRECTIVE_OUTPUTS = [\n 'queryChange',\n 'valueChange',\n 'openChange',\n 'escapeKeyDown',\n 'pointerDownOutside',\n 'focusOutside',\n 'interactOutside',\n 'autoFocusOnOpen',\n 'autoFocusOnClose',\n 'touchedChange',\n 'touch',\n] as const;\n\n/**\n * Exact public names of every `ForComboboxVirtualized` input. Spread it into the `inputs`\n * array of a second `hostDirectives` entry, beside the `ForCombobox` one, so a wrapper\n * component that virtualizes its options re-exposes the virtualization surface too.\n */\nexport const FOR_COMBOBOX_VIRTUALIZED_HOST_DIRECTIVE_INPUTS = [\n 'dataVersion',\n 'totalCount',\n 'visibleRange',\n] as const;\n\n/**\n * Exact public names of every `ForComboboxVirtualized` output. Spread it into the\n * `outputs` array of the same `hostDirectives` entry as\n * {@link FOR_COMBOBOX_VIRTUALIZED_HOST_DIRECTIVE_INPUTS}.\n */\nexport const FOR_COMBOBOX_VIRTUALIZED_HOST_DIRECTIVE_OUTPUTS = ['scrollToIndex'] as const;\n"],"mappings":";;;;;;AAoEA,SAAgB,qBAAwB,QAAyB;CAC/D,OAAO,aAYL;EACA,eAAe;GACb,OAAO,OAAO,MAAK;GACnB,MAAM,OAAO,KAAI;GACjB,eAAe,OAAO,cAAa;GACnC,aAAa,OAAO,YAAW;GAC/B,cAAc,OAAO,aAAY;GACjC,OAAO,OAAO,MAAK;GACnB,OAAO,OAAO,MAAK;GACnB,QAAQ,OAAO,OAAM;EACtB;EACD,cACE,EAAE,OAAO,MAAM,eAAe,aAAa,cAAc,OAAO,OAAO,UACvE,SACE;GAEF,IAAI,UADiB,SAAS,UAAa,KAAK,OAAO,UAAU,QACpC,OAAQ,MAAM,SAAS;GACpD,IAAI,YAAY,QAAQ,CAAC,MAAM,MAAM,MAAM,EAAE,GAAE,MAAO,OAAO,GAC3D,UAAU;GAEZ,IAAI,YAAY,MACd,OAAO;GAET,IAAI,eAAe,CAAC,iBAAiB,CAAC,QAAQ,MAAM,WAAW,GAC7D,OAAO;GAET,OAAO,yBAAyB;IAAE;IAAO;IAAc;IAAO;GAAM,CAAE;EACxE;CACD,CAAA;AACH;AAgBA,SAAgB,yBAA4B,O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AA;CAApB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAoB,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,aAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,OAAA;GAAA,YAAA,EAAA,yBAAA,gBAAA;EAAA;EAAA,UAAA,CAAA,sBAAA;EAAA,UAAA;CAAA,CAAA;;AAApB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EARhC,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM;IACJ,MAAM;IACN,2BAA2B;GAC5B;EACF,CAAA;;;;;;;;;;;ACUD,MAAa,qCAAqC;CAChD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACQ;AAOV,MAAa,sCAAsC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACQ;AAOV,MAAa,iDAAiD;CAC5D;CACA;CACA;AACQ;AAOV,MAAa,kDAAkD,CAAC,eAAe"}
1
+ {"version":3,"file":"forty-cdk-combobox.mjs","names":["FOR_COMBOBOX_DEFAULTS","FOR_COMBOBOX_DEFAULTS","FOR_COMBOBOX_DEFAULTS","FOR_COMBOBOX_DEFAULTS","FOR_COMBOBOX_DEFAULTS"],"sources":["../../../projects/forty-cdk/combobox/src/combobox-auto-highlight.ts","../../../projects/forty-cdk/combobox/src/combobox-context.ts","../../../projects/forty-cdk/combobox/src/combobox.ts","../../../projects/forty-cdk/combobox/src/combobox-off-window-merge.ts","../../../projects/forty-cdk/combobox/src/combobox-virtualized-navigator.ts","../../../projects/forty-cdk/combobox/src/combobox-virtualized.ts","../../../projects/forty-cdk/combobox/src/combobox-anchor.ts","../../../projects/forty-cdk/combobox/src/combobox-trigger.ts","../../../projects/forty-cdk/combobox/src/combobox-toggle.ts","../../../projects/forty-cdk/combobox/src/combobox-input.ts","../../../projects/forty-cdk/combobox/src/combobox-content.ts","../../../projects/forty-cdk/combobox/src/combobox-list.ts","../../../projects/forty-cdk/combobox/src/combobox-option.ts","../../../projects/forty-cdk/combobox/src/combobox-indicator.ts","../../../projects/forty-cdk/combobox/src/combobox-empty.ts","../../../projects/forty-cdk/combobox/src/combobox-action.ts","../../../projects/forty-cdk/combobox/src/combobox-status.ts","../../../projects/forty-cdk/combobox/src/combobox-clear.ts","../../../projects/forty-cdk/combobox/src/combobox-chips.ts","../../../projects/forty-cdk/combobox/src/combobox-chip.ts","../../../projects/forty-cdk/combobox/src/combobox-chip-remove.ts","../../../projects/forty-cdk/combobox/src/combobox-group.ts","../../../projects/forty-cdk/combobox/src/combobox-group-label.ts","../../../projects/forty-cdk/combobox/src/combobox-separator.ts","../../../projects/forty-cdk/combobox/src/combobox-host-directive.ts"],"sourcesContent":["import { linkedSignal, untracked, type WritableSignal } from '@angular/core';\n\nimport {\n firstEnabledHandle,\n isUnset,\n lastEnabledHandle,\n runVirtualizedNavigatorBridge,\n} from 'forty-cdk/core';\nimport type { ForComboboxInitialFocus, ForComboboxOptionHandle } from './combobox-context';\nimport type { ComboboxVirtualizedNavigator } from './combobox-virtualized-navigator';\n\n/**\n * Inputs for {@link resolveAutoHighlightSeed}. Mirror the tracked source of the\n * host's `#activeId` linkedSignal: the live registered options, the current\n * selection (for `initialFocus === 'selected'`), and the equality fn used to\n * match selected values to options.\n */\nexport interface AutoHighlightSeedInput<T> {\n /** Live registered options in DOM order. */\n readonly items: readonly ForComboboxOptionHandle<T>[];\n /** Where auto-highlight should land: first / last enabled, or the selection. */\n readonly initialFocus: ForComboboxInitialFocus;\n /** Current selection — only read when `initialFocus === 'selected'`. */\n readonly value: readonly T[];\n /** Identity comparison used to match a selected value to a registered option. */\n readonly equals: (a: T, b: T) => boolean;\n}\n\n/**\n * Reactive source for the host's `#activeId` linkedSignal. Each accessor reads\n * one of the host signals the activedescendant decision depends on.\n */\nexport interface ActiveIdSource<T> {\n /** Visible input text — a change drops the prior pointer (it may be filtered out). */\n readonly query: () => string;\n /** Whether the listbox is open. */\n readonly open: () => boolean;\n /** Whether auto-highlight is enabled. */\n readonly autoHighlight: () => boolean;\n /** `true` when the consumer set `totalCount()` (virtualized path). */\n readonly virtualized: () => boolean;\n /** Where auto-highlight should land. */\n readonly initialFocus: () => ForComboboxInitialFocus;\n /** Live registered options in DOM order. */\n readonly items: () => readonly ForComboboxOptionHandle<T>[];\n /** Current selection — only read for `initialFocus === 'selected'`. */\n readonly value: () => readonly T[];\n /** Identity comparison used to match a selected value to a registered option. */\n readonly equals: () => (a: T, b: T) => boolean;\n}\n\n/**\n * Builds the host's activedescendant pointer as a `linkedSignal`, so what should be highlighted\n * given `open` / `items` / `autoHighlight` is a pure derivation. The result stays writable for the\n * imperative moves that own their own scroll — arrow navigation, hover, multi-mode activation, and\n * the virtualized pending-nav resolution.\n *\n * The reset and seed rule, in order:\n *\n * - A `query` change drops the prior pointer, since the active option may have been filtered out.\n * - A pointer no longer matching a registered option is dropped, covering a list mutated without\n * touching `query`.\n * - A surviving valid pointer is preserved.\n * - Otherwise, when not virtualized, {@link resolveAutoHighlightSeed} seeds the first or last\n * enabled option while the listbox is open. The virtualized case returns `null` and is seeded\n * imperatively instead, because that seed orders by absolute `posInSet` and must lose to a\n * pending `(scrollToIndex)` resolution.\n */\nexport function createActiveIdSignal<T>(source: ActiveIdSource<T>): WritableSignal<string | null> {\n return linkedSignal<\n {\n query: string;\n open: boolean;\n autoHighlight: boolean;\n virtualized: boolean;\n initialFocus: ForComboboxInitialFocus;\n items: readonly ForComboboxOptionHandle<T>[];\n value: readonly T[];\n equals: (a: T, b: T) => boolean;\n },\n string | null\n >({\n source: () => ({\n query: source.query(),\n open: source.open(),\n autoHighlight: source.autoHighlight(),\n virtualized: source.virtualized(),\n initialFocus: source.initialFocus(),\n items: source.items(),\n value: source.value(),\n equals: source.equals(),\n }),\n computation: (\n { query, open, autoHighlight, virtualized, initialFocus, items, value, equals },\n prev,\n ) => {\n const queryChanged = prev !== undefined && prev.source.query !== query;\n let current = queryChanged ? null : (prev?.value ?? null);\n if (current !== null && !items.some((o) => o.id() === current)) {\n current = null;\n }\n if (current !== null) {\n return current;\n }\n if (virtualized || !autoHighlight || !open || items.length === 0) {\n return null;\n }\n return resolveAutoHighlightSeed({ items, initialFocus, value, equals });\n },\n });\n}\n\n/**\n * Resolve the auto-highlight seed for the **non-virtualized** combobox: the id\n * of the option `aria-activedescendant` should fall on when the listbox is open\n * and no pointer survives. Returns `null` when no enabled option qualifies (or\n * when a `'selected'` seed can't yet read its options — see `isUnset`).\n *\n * Pure over its inputs — no signal reads, no DOM access — so the host can call\n * it from inside its `#activeId` linkedSignal computation without leaking the\n * banned write-from-effect pattern. The virtualized branch seeds imperatively\n * via the navigator instead (it orders by absolute `posInSet` and must lose to\n * a pending `(scrollToIndex)` resolution).\n *\n * Internal — not re-exported from `combobox/index.ts` or `public-api.ts`.\n */\nexport function resolveAutoHighlightSeed<T>(input: AutoHighlightSeedInput<T>): string | null {\n const { items, initialFocus, value, equals } = input;\n if (initialFocus === 'selected') {\n const selected = findSelectedEnabled(items, value, equals);\n if (selected === NOT_READY) {\n return null;\n }\n if (selected) {\n return selected.id();\n }\n }\n const target = initialFocus === 'last' ? lastEnabledHandle(items) : firstEnabledHandle(items);\n return target?.id() ?? null;\n}\n\nconst NOT_READY = Symbol('forty-cdk/combobox:not-ready');\n\nfunction findSelectedEnabled<T>(\n items: readonly ForComboboxOptionHandle<T>[],\n values: readonly T[],\n equals: (a: T, b: T) => boolean,\n): ForComboboxOptionHandle<T> | null | typeof NOT_READY {\n if (values.length === 0) {\n return null;\n }\n for (const item of items) {\n if (item.disabled()) {\n continue;\n }\n const value = item.value();\n if (isUnset(value)) {\n return NOT_READY;\n }\n if (values.some((sel) => equals(value, sel))) {\n return item;\n }\n }\n return null;\n}\n\n/**\n * Collaborators the virtualized auto-highlight bridge reaches for. The host owns\n * the activedescendant (`getActiveId`); the bridge reads it through this\n * accessor so it can stay outside the directive.\n */\nexport interface AutoHighlightBridgeDeps<T> {\n /** The virtualization navigator, constructed on first use. */\n readonly requireNavigator: () => ComboboxVirtualizedNavigator<T>;\n /** Live registered options in DOM order. */\n readonly items: () => readonly ForComboboxOptionHandle<T>[];\n /** Whether the listbox is open. */\n readonly open: () => boolean;\n /** Whether auto-highlight is enabled. */\n readonly autoHighlight: () => boolean;\n /** `true` while `totalCount` is set. */\n readonly virtualized: () => boolean;\n /** Where auto-highlight should land. */\n readonly initialFocus: () => ForComboboxInitialFocus;\n /** Read the host's current activedescendant id (call inside `untracked`). */\n readonly getActiveId: () => string | null;\n}\n\n/**\n * The virtualized imperative tail of the auto-highlight flow, run from the\n * `[forComboboxVirtualized]` constructor `effect`. The activedescendant *decision* is a pure\n * derivation in {@link createActiveIdSignal}; this performs only the side effects that escape\n * the reactive graph, reacting to `items()`, `autoHighlight()` and `open()`.\n *\n * It resolves a pending `(scrollToIndex)` navigation: once the option for the requested\n * `posInSet` mounts, activedescendant is seeded to its id and scrolled into view. That write\n * takes precedence over the auto-highlight seed. The passive `seedFirstRenderedEnabled` then\n * points at the topmost or bottommost rendered enabled option without touching the consumer's\n * scroll position.\n *\n * The position map is pulled, through {@link runVirtualizedNavigatorBridge}, because its\n * sources are already tracked by this bridge's own `items()` read and priming it widens nothing.\n */\nexport function runAutoHighlightBridge<T>(deps: AutoHighlightBridgeDeps<T>): void {\n const items = deps.items();\n const open = deps.open();\n const autoHighlight = deps.autoHighlight();\n if (!deps.virtualized()) {\n return;\n }\n const navigator = deps.requireNavigator();\n const resolved = runVirtualizedNavigatorBridge({\n items: deps.items,\n virtualized: deps.virtualized,\n requireNavigator: () => navigator,\n });\n if (resolved) {\n return;\n }\n if (autoHighlight && open && untracked(() => deps.getActiveId()) === null && items.length > 0) {\n navigator.seedFirstRenderedEnabled(deps.initialFocus() === 'last' ? 'last' : 'first');\n }\n}\n\n/**\n * Collaborators {@link revealAutoHighlight} reaches for. The host owns the\n * activedescendant (`getActiveId`) and the last-scrolled-into-view id\n * (`getLastPositionedId` / `setLastPositionedId`).\n */\nexport interface AutoHighlightRevealDeps<T> {\n /** Live registered options in DOM order. */\n readonly items: () => readonly ForComboboxOptionHandle<T>[];\n /** Whether the listbox is open. */\n readonly open: () => boolean;\n /** `true` while `totalCount` is set, where the navigator owns the scroll. */\n readonly virtualized: () => boolean;\n /** Read the host's current activedescendant id (call inside `untracked`). */\n readonly getActiveId: () => string | null;\n /** Last id the bridge scrolled into view, to avoid re-scrolling on hover. */\n readonly getLastPositionedId: () => string | null;\n /** Persist the last id the bridge scrolled into view. */\n readonly setLastPositionedId: (id: string | null) => void;\n /** Scroll an option into view with the host's pointer-suppression window open. */\n readonly scrollIntoView: (host: HTMLElement) => void;\n}\n\n/**\n * The non-virtualized imperative tail of the auto-highlight flow, run from the host's\n * constructor `effect`: it scrolls the seeded option into view so a seed below the fold is\n * visible, matching `navigate()`, through the host's pointer-suppression window so an option the\n * scroll slides under a stationary cursor cannot take the seed over. The activedescendant is read\n * `untracked`, so scrolling never re-triggers the effect and hover never scrolls. The\n * initial-open scroll is re-applied by `ForCombobox.scrollActiveOptionIntoView` after the content\n * portals, since portaling resets `scrollTop`.\n *\n * The label cache is not pulled here: it tracks the selection, so every commit of `value` would\n * re-run this effect's scrolls.\n */\nexport function revealAutoHighlight<T>(deps: AutoHighlightRevealDeps<T>): void {\n const items = deps.items();\n const open = deps.open();\n if (deps.virtualized()) {\n return;\n }\n if (!open) {\n deps.setLastPositionedId(null);\n return;\n }\n const activeId = untracked(() => deps.getActiveId());\n if (activeId === null || activeId === deps.getLastPositionedId()) {\n return;\n }\n const active = items.find((o) => o.id() === activeId);\n if (active) {\n deps.scrollIntoView(active.host);\n }\n deps.setLastPositionedId(activeId);\n}\n","import { computed, inject, InjectionToken, type Signal } from '@angular/core';\nimport type { ReferenceElement } from '@floating-ui/dom';\n\nimport {\n assertRootContext,\n type CollectionHandle,\n type LabelCacheEntry,\n orphanContextError,\n RootedRegistry,\n type RootedHandle,\n unresolvedRootError,\n type Unset,\n type VetoableNativeEvent,\n type VirtualizedResume,\n type WritingDirection,\n} from 'forty-cdk/core';\nimport { type FloatingAlign, type FloatingSide } from 'forty-cdk/core-anchored';\nimport { type ForComboboxOpenHighlight } from 'forty-cdk/defaults';\nimport type { ComboboxVirtualizedNavigator } from './combobox-virtualized-navigator';\n\nexport { type ForComboboxOpenHighlight };\n\n/**\n * Why the combobox closed. Mirrors the menu / select vocabulary so consumers\n * can switch on the reason regardless of overlay flavor.\n */\nexport type ForComboboxCloseReason =\n 'escape' | 'pointerDownOutside' | 'focusOutside' | 'select' | 'tab' | 'programmatic';\n\n/**\n * Autocomplete mode applied to the input. Mirrors the\n * [WAI-ARIA combobox autocomplete property](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/#wai-ariaroles,states,andproperties).\n *\n * - `'none'`: input acts as a free-text query; no completion is performed.\n * - `'list'`: the listbox shows filtered options; the input value reflects\n * the user's typed query verbatim.\n * - `'inline'`: the rest of the first matching option is auto-completed\n * into the input as selected text; the listbox does not auto-open. Because\n * the popup never opens, the default `@if (open())` anatomy renders no\n * options and the label cache stays cold — inline completion only kicks in\n * after the options have rendered once (the popup was opened some other way,\n * e.g. ArrowDown / `openOnFocus`). Use `'both'` when a popup is acceptable.\n * - `'both'`: combines `'list'` and `'inline'` — listbox opens with the\n * filtered options *and* the first match auto-completes inline.\n */\nexport type ForComboboxAutocomplete = 'none' | 'list' | 'inline' | 'both';\n\n/**\n * Where the auto-highlight seed lands when the listbox opens. `'first'` / `'last'`\n * bias to the natural extreme (e.g. ArrowDown / ArrowUp on the trigger). `'selected'`\n * — used by the picker trigger's plain open — seeds the committed selection, falling\n * back to the first enabled option when there is no selection or it is filtered out.\n */\nexport type ForComboboxInitialFocus = 'first' | 'last' | 'selected';\n\nexport interface ForComboboxOptionHandle<T = unknown> extends CollectionHandle {\n /**\n * Narrowed from {@link CollectionHandle}'s `Node`: the root scrolls the\n * highlighted option into view.\n */\n readonly host: HTMLElement;\n readonly id: Signal<string>;\n /** The option's value, or {@link Unset} before its binding is written. */\n readonly value: Signal<T | Unset>;\n readonly label: Signal<string>;\n readonly disabled: Signal<boolean>;\n /**\n * Index in the consumer's source array. Required when virtualizing so the\n * directive can fold off-screen options into the snapshot keyed by\n * absolute position. Optional otherwise — when absent the snapshot falls\n * back to DOM order.\n */\n readonly posInSet?: Signal<number | null>;\n}\n\nexport interface ForComboboxChipHandle<T = unknown> extends CollectionHandle {\n /**\n * Narrowed from {@link CollectionHandle}'s `Node`: chip navigation moves DOM\n * focus between hosts.\n */\n readonly host: HTMLElement;\n /** The chip's value, or {@link Unset} before its binding is written. */\n readonly value: Signal<T | Unset>;\n}\n\n/**\n * A registered `[forComboboxAction]` — a non-selecting action affordance\n * (`role=\"button\"`) pinned inside the popup. Tracked in a collection separate\n * from options / chips so it never touches `value` / `options()` /\n * `aria-setsize`.\n */\nexport interface ForComboboxActionHandle extends CollectionHandle {\n /**\n * Narrowed from {@link CollectionHandle}'s `Node`: the action Tab ring moves\n * DOM focus onto the host.\n */\n readonly host: HTMLElement;\n readonly id: Signal<string>;\n readonly disabled: Signal<boolean>;\n}\n\n/**\n * Coordination contract owned by `[forCombobox]` — the surface a consumer\n * reads and drives. Advanced consumers inject the token to read the selection,\n * the query and the open state, and to move them through the root's guards\n * (`activate` / `removeValue` / `clear` / `openOverlay` / `closeOverlay`). The\n * wiring the library's own pieces read off the root is not part\n * of it.\n *\n * The value model is always an array — single mode (`multiple=false`,\n * default) keeps 0 or 1 element, multi mode keeps any number. This mirrors\n * `[forListbox]` / `[forSelect]` so consumers learn one selection contract\n * across the whole library.\n *\n * Generic over the option value type `T` (default `string`). When a\n * consumer binds object items the directive infers `T` from `[(value)]` and\n * the per-piece signatures specialize accordingly. Items are compared via\n * the consumer-provided `compareWith` and rendered as labels via\n * `itemToStringLabel`; the form's hidden inputs serialize via\n * `itemToFormValue`.\n */\nexport interface ForComboboxContext<T = unknown> {\n /**\n * The typed query, as a read-only signal. Mutate it through `clear` or the\n * root's `[(query)]` binding — a direct write would skip the\n * inline-completion / open-on-query side-effects.\n */\n readonly query: Signal<string>;\n /**\n * The current selection, as a read-only signal. Mutate it through the guarded\n * methods (`activate` / `removeValue` / `clear`) or the root's `[(value)]`\n * binding — a direct write would bypass the disabled / readonly guards.\n */\n readonly value: Signal<readonly T[]>;\n /**\n * Whether the listbox is open, as a read-only signal. Mutate it through\n * `toggle` / `openOverlay` / `closeOverlay` or the root's `[(open)]` binding.\n */\n readonly open: Signal<boolean>;\n\n readonly multiple: Signal<boolean>;\n /**\n * The combobox's effective disabled — its own `disabled` input OR'd with a\n * surrounding disabled `[forFieldset]`. Input, options, clear, and chip pieces\n * read this so a disabled combobox (or fieldset) is inert and exposes\n * `aria-disabled`.\n */\n readonly effectiveDisabled: Signal<boolean>;\n readonly readonly: Signal<boolean>;\n readonly required: Signal<boolean>;\n readonly invalid: Signal<boolean>;\n readonly pending: Signal<boolean>;\n readonly dir: Signal<WritingDirection>;\n\n /**\n * Registers the element the listbox is positioned against, instead of the\n * input. The declarative `[forComboboxAnchor]` covers the common case; call\n * this directly when the anchor element is only reachable imperatively — it\n * lives in an ancestor component's template, so a directive placed on it would\n * resolve DI outside this root. One anchor per `[forCombobox]`: a second one\n * warns in dev mode, and the most recently registered one is used.\n */\n registerAnchor(el: HTMLElement): void;\n /**\n * Unregisters the positioning anchor, restoring the input fallback.\n * Reference-based, so an anchor torn down inside `@if` unwinds cleanly.\n */\n unregisterAnchor(el: HTMLElement): void;\n\n readonly options: Signal<readonly ForComboboxOptionHandle<T>[]>;\n\n /**\n * Selected entries paired with their resolved label (from the option\n * cache) — convenient for rendering chips with `@for`. Falls back to\n * `itemToStringLabel(value)` when no matching option is registered.\n */\n readonly selected: Signal<readonly { value: T; label: string }[]>;\n\n /** Id of the currently active option (drives `aria-activedescendant` on the input). */\n readonly activeId: Signal<string | null>;\n\n /** True when `value` includes `v` per the active equality function. */\n isSelected(value: T): boolean;\n\n /**\n * Activate by handle. Single mode replaces + closes + commits label. Multi\n * mode toggles in/out + stays open + (when `commitOnSelect`) clears the\n * query so the user can search the next item. No-op on disabled / readonly.\n */\n activate(handle: ForComboboxOptionHandle<T>): void;\n\n /** Remove a value from `value()`. Used by chip-remove and Backspace heuristics. */\n removeValue(value: T): void;\n\n /**\n * Clear value and (optionally) query. Used by `[forComboboxClear]` and\n * by the Backspace-on-empty-input heuristic. The query is reset only\n * when `clearQuery` is true.\n */\n clear(clearQuery?: boolean): void;\n\n toggle(): void;\n openOverlay(initialFocus?: ForComboboxInitialFocus): void;\n closeOverlay(reason: ForComboboxCloseReason): void;\n}\n\n/**\n * The combobox's piece-coordination surface: everything the library's own\n * pieces read off the root that a consumer has no call to touch — the\n * positioning mirrors `[forComboboxContent]` feeds to floating-ui, the ids the\n * ARIA wiring points at, the element slots, the label caches behind chip and\n * inline-completion rendering, the navigation and activation cursors, and the\n * outside-interaction emit forwarders `injectOverlayShell` drives.\n *\n * **Not** part of {@link ForComboboxContext} and never exported\n * from `public-api.ts`: these are the members a refactor of the anatomy moves,\n * so freezing them at 1.0 would freeze the anatomy with them.\n */\nexport interface ComboboxPieceContext<T = unknown> {\n readonly autocompleteMode: Signal<ForComboboxAutocomplete>;\n readonly openOnFocus: Signal<boolean>;\n readonly openOnQuery: Signal<boolean>;\n readonly openHighlight: Signal<ForComboboxOpenHighlight>;\n readonly commitOnSelect: Signal<boolean>;\n readonly clearOnQueryChange: Signal<boolean>;\n\n readonly dismissible: Signal<boolean>;\n /**\n * Whether focus returns to the `[forComboboxTrigger]` on close (picker\n * anatomy). Ignored in the editable anatomy, where focus never left the\n * input. Default `true`.\n */\n readonly returnFocus: Signal<boolean>;\n readonly side: Signal<FloatingSide | undefined>;\n readonly align: Signal<FloatingAlign>;\n readonly sideOffset: Signal<number>;\n readonly alignOffset: Signal<number>;\n readonly avoidCollisions: Signal<boolean>;\n readonly collisionPadding: Signal<number>;\n readonly sticky: Signal<'partial' | 'always' | false>;\n readonly hideWhenDetached: Signal<boolean>;\n readonly clipUntilPositioned: Signal<boolean>;\n readonly loop: Signal<boolean>;\n\n readonly inputId: Signal<string>;\n readonly contentId: Signal<string>;\n /**\n * Id of the `[forComboboxList]` listbox surface (picker anatomy). The input's\n * `aria-controls` points here when a list is registered; without one it falls\n * back to {@link contentId} (the editable anatomy where content itself is the\n * listbox).\n */\n readonly listId: Signal<string>;\n /**\n * Id of the element carrying `role=\"listbox\"` — {@link listId} when a\n * `[forComboboxList]` is registered, otherwise {@link contentId}. The input\n * targets this with `aria-controls`.\n */\n readonly listboxId: Signal<string>;\n readonly ariaLabel: Signal<string | null>;\n\n /**\n * Element floating-ui anchors the listbox against. Prefers an optional\n * `[forComboboxAnchor]` when registered, otherwise falls back to the input.\n * Decoupled from `input` so the input keeps driving `aria-controls`,\n * `aria-activedescendant`, keyboard interaction, and its outside-pointer\n * exemption regardless of where the listbox paints.\n */\n readonly anchor: Signal<ReferenceElement | null>;\n readonly input: Signal<HTMLInputElement | null>;\n\n /**\n * The optional `[forComboboxTrigger]` button (picker anatomy). When present\n * it is the default positioning anchor (after an explicit `[forComboboxAnchor]`)\n * and the element focus returns to on close. `null` in the editable anatomy.\n */\n readonly trigger: Signal<HTMLElement | null>;\n readonly triggerId: Signal<string | null>;\n\n readonly content: Signal<HTMLElement | null>;\n\n /**\n * The registered `[forComboboxToggle]` and `[forComboboxClear]` buttons.\n * Exempt from the popup's outside-pointer dismissal and treated as inside by\n * the root's focus-out check, so a press on one acts instead of dismissing.\n */\n readonly fieldButtons: Signal<readonly HTMLElement[]>;\n\n /**\n * The optional `[forComboboxList]` listbox surface (picker anatomy). When\n * registered, `[forComboboxContent]` drops its `role=\"listbox\"` semantics —\n * becoming the `role=\"dialog\"` a trigger opens, or a neutral surface without\n * one; the list carries the listbox role and owns the options. `null` in the\n * editable anatomy.\n */\n readonly list: Signal<HTMLElement | null>;\n /** True when a `[forComboboxList]` is registered (picker anatomy). */\n readonly hasList: Signal<boolean>;\n\n /** Multi-mode chip collection. Order follows DOM (= `value()` order in practice). */\n readonly chips: Signal<readonly ForComboboxChipHandle<T>[]>;\n\n /**\n * Non-selecting action collection (`[forComboboxAction]`), kept separate from\n * `options` so an action never appears in `value()`, `aria-setsize`, or\n * `aria-posinset`. Order follows DOM.\n */\n readonly actions: Signal<readonly ForComboboxActionHandle[]>;\n /**\n * True when at least one registered action is enabled. Gates the input's\n * Tab-into-actions behavior: with no enabled action, Tab keeps its default\n * \"close the listbox and let Tab flow on\" semantics.\n */\n readonly hasEnabledActions: Signal<boolean>;\n /**\n * Move DOM focus within the input↔actions ring (model A). The ring is\n * `[input, ...enabledActions]` in DOM order and wraps in both directions, so\n * focus cycles among the input and the pinned actions without ever leaving\n * (or dismissing) the open popup — Escape / outside-pointer remain the way\n * out. `fromActionId === null` means the move originates from the input; pass\n * the action's own id when moving from an action. A stale or disabled\n * `fromActionId` (e.g. an action disabled while it held focus) is resolved\n * against the full action collection, stepping to the nearest enabled\n * neighbor in the requested direction rather than snapping to the input. The\n * ring omits the input slot when no `[forComboboxInput]` is registered, so\n * focus cycles among the enabled actions instead of stranding. No-op when no\n * action is enabled.\n */\n moveActionFocus(fromActionId: string | null, direction: 'next' | 'prev'): void;\n\n /** Compare two items for equality. Defaults to `===`; overridden for object values. */\n readonly compareWith: Signal<(a: T, b: T) => boolean>;\n /** Render an item as a string label. Drives chip labels and `commitOnSelect` writes into the input. */\n readonly itemToStringLabel: Signal<(item: T) => string>;\n /** Serialize an item for the hidden input's `value` attribute. */\n readonly itemToFormValue: Signal<(item: T) => string>;\n\n /**\n * Scroll the current activedescendant option into view. Called by\n * `[forComboboxContent]` from the positioner's first-resolved-position hook so\n * the open-time auto-highlight seed survives the content portal move (which\n * resets `scrollTop`) and lands after the surface is sized. No-op while\n * virtualizing.\n */\n scrollActiveOptionIntoView(): void;\n /**\n * Cached entries for the currently selected values, in selection order.\n * Consumed by the chip label resolution and the root's `selected` fallback,\n * both of which must keep resolving a selected value's label after its option\n * leaves the rendered set — including across a query rebuild that no longer\n * contains it. A selected value whose option was never observed is absent\n * rather than represented; the caller falls back to `itemToStringLabel`.\n */\n selectedEntries(): readonly { id: string; value: T; label: string; disabled: boolean }[];\n /**\n * Cached entries inline-autocomplete matches against in the input directive.\n * Non-virtualized: the most recent non-empty option window, so an option\n * removed from the source stops being offered as a completion. Virtualized:\n * that window overlaid with the navigator's position map, so completion still\n * matches options scrolled out of view. Entries carry `disabled` so completion\n * skips disabled options.\n */\n completionEntries(): readonly { id: string; value: T; label: string; disabled: boolean }[];\n\n /**\n * Total number of options in the consumer's source array. Used for\n * `aria-setsize` and for navigation past the visible window when\n * virtualizing. Falls back to `options().length` when undefined.\n */\n readonly totalCount: Signal<number | undefined>;\n\n /** True when `id` is the activedescendant. */\n isActive(id: string): boolean;\n\n /**\n * Reported by `[forComboboxOption]` on `pointermove`: moves the activedescendant\n * to the hovered option, unless a scroll-into-view opened the pointer-suppression\n * window just before.\n */\n highlightFromPointer(host: HTMLElement, id: string): void;\n\n /** Move the activedescendant to the first / last / next / prev enabled option. */\n navigate(direction: 'next' | 'prev' | 'first' | 'last'): void;\n /**\n * Activate the option currently marked as activedescendant, or, while virtualized, the option it\n * marked before scrolling out of the rendered window (Enter from the input). Returns `false` when\n * neither resolves to an enabled option.\n */\n activateActive(): boolean;\n /**\n * Open from ArrowDown (`'first'`) / ArrowUp (`'last'`) on the editable input:\n * seeds the selection under `openHighlight=\"selected\"` and the extreme otherwise,\n * so ArrowUp with nothing selected still lands on the last enabled option.\n */\n openFromExtreme(extreme: 'first' | 'last'): void;\n\n /** Set the typed query. Emits inline completion / openOnQuery side-effects via the input directive. */\n setQueryFromInput(query: string): void;\n /**\n * Set the query to an inline completion the user accepted. Applies the same\n * guards and `clearOnQueryChange` as {@link setQueryFromInput}, and never opens\n * the listbox, so a completion accepted on blur cannot reopen a popup the same\n * interaction dismissed.\n */\n acceptQueryFromInput(query: string): void;\n\n /** Where focus should land after the listbox opens. The input directive sets this before flipping `open`. */\n readonly initialFocus: Signal<ForComboboxInitialFocus>;\n\n /**\n * The reason of the most recent close (or `null` before any close / after a\n * fresh open). `[forComboboxContent]` reads this so a `'tab'` close skips the\n * return-focus move — Tab has already advanced focus and re-focusing the\n * trigger would steal it back. Only meaningful in the picker anatomy.\n */\n readonly lastCloseReason: Signal<ForComboboxCloseReason | null>;\n\n /**\n * Fires the `(autoFocusOnOpen)` output and returns whether the consumer\n * vetoed (called `preventDefault()`). The picker anatomy moves focus into the\n * input on open; a veto skips that imperative move. Editable anatomy never\n * calls this (focus never moves).\n */\n emitAutoFocusOnOpen(): boolean;\n /**\n * Fires the `(autoFocusOnClose)` output and returns whether the consumer\n * vetoed. The picker anatomy returns focus to the trigger on close; a veto\n * skips it.\n */\n emitAutoFocusOnClose(): boolean;\n\n /**\n * Escape is consumer-owned and routed through the input directive (focus\n * stays in the input), so it is invoked directly with the raw\n * `KeyboardEvent` rather than through the dismissible layer.\n */\n emitEscapeKeyDown(event: KeyboardEvent): void;\n /**\n * Outside-interaction emit forwarders. The specific and composite channels\n * observe the same veto, so `preventDefault()` from either one suppresses the\n * close that otherwise follows.\n */\n emitPointerDownOutside(veto: VetoableNativeEvent<PointerEvent>): void;\n emitFocusOutside(veto: VetoableNativeEvent<FocusEvent>): void;\n emitInteractOutside(veto: VetoableNativeEvent<PointerEvent | FocusEvent>): void;\n /** Implicit close requested by the shell after an un-vetoed outside interaction. */\n requestClose(reason: 'pointerDownOutside' | 'focusOutside'): void;\n}\n\n/**\n * DI token for the combobox's coordination surface, provided by `[forCombobox]`.\n * Publicly typed as the read surface {@link ForComboboxContext}, which is the whole of\n * what the token promises a consumer. The pieces read the same token at an internal type\n * that adds the registration protocol, so a wrapper re-providing it must alias it to the\n * root: `{ provide: FOR_COMBOBOX_CONTEXT, useExisting: MyCombobox }`, where `MyCombobox`\n * extends `ForCombobox`. A value that merely satisfies the declared type resolves too, and\n * is rejected in dev mode by the first piece to reach the protocol.\n *\n * `ForCombobox<T>`'s generic does NOT flow to this token: an `InjectionToken`\n * is a single runtime instance, so it is published at `ForComboboxContext<unknown>`.\n * `injectComboboxContext<T>()` re-applies `T` with an `as unknown as` cast, and\n * each piece (input, option, chip) relies on consumer discipline — the\n * `[forComboboxOption][value]` and the root `[(value)]` must be the same `T`.\n * There is no clean fix without abandoning the token pattern; the contract is\n * the consumer's to honor. Object identity is reconciled at runtime via\n * `compareWith`, which bounds the practical blast radius of a mismatch.\n */\nexport const FOR_COMBOBOX_CONTEXT = new InjectionToken<ForComboboxContext>('FOR_COMBOBOX_CONTEXT');\n\nexport interface ComboboxTriggerHandle extends RootedHandle<object> {\n readonly host: HTMLElement;\n readonly id: Signal<string>;\n}\n\nexport const COMBOBOX_TRIGGERS = new InjectionToken<RootedRegistry<object, ComboboxTriggerHandle>>(\n 'COMBOBOX_TRIGGERS',\n { providedIn: 'root', factory: () => new RootedRegistry() },\n);\n\n/**\n * The combobox's piece-registration protocol: how the input, the optional\n * anchor / list, the options, the chips and the actions wire\n * themselves into the `[forCombobox]` root, plus the two cursors the pieces set\n * (the activedescendant and the next open's initial-focus target).\n *\n * **Not** part of {@link ForComboboxContext} and never exported\n * from `public-api.ts`. It is the code most likely to be refactored, so a\n * consumer must not be able to name — let alone call — it.\n */\nexport interface ComboboxRegistrationContext<T = unknown> {\n /** Registers the `[forComboboxInput]` element. */\n registerInput(el: HTMLInputElement): void;\n /** Unregisters the input element. Reference-based. */\n unregisterInput(el: HTMLInputElement): void;\n /** Registers a `[forComboboxToggle]` or `[forComboboxClear]` button without switching the anatomy. */\n registerFieldButton(el: HTMLElement): void;\n /** Unregisters a toggle or clear button. Reference-based. */\n unregisterFieldButton(el: HTMLElement): void;\n /** Registers the `[forComboboxContent]` popup surface. */\n registerContent(el: HTMLElement): void;\n /** Unregisters the popup surface. Reference-based. */\n unregisterContent(el: HTMLElement): void;\n /** Registers the optional `[forComboboxList]` listbox surface (picker anatomy). */\n registerList(el: HTMLElement): void;\n /** Unregisters the listbox surface. Reference-based. */\n unregisterList(el: HTMLElement): void;\n /** Registers an option so it joins the navigable collection in DOM order. */\n registerOption(handle: ForComboboxOptionHandle<T>): void;\n /** Unregisters an option. Reference-based. */\n unregisterOption(handle: ForComboboxOptionHandle<T>): void;\n /** Registers a multi-mode chip. Order follows DOM. */\n registerChip(handle: ForComboboxChipHandle<T>): void;\n /** Unregisters a chip. Reference-based. */\n unregisterChip(handle: ForComboboxChipHandle<T>): void;\n /** Registers a non-selecting `[forComboboxAction]`, kept out of the option collection. */\n registerAction(handle: ForComboboxActionHandle): void;\n /** Unregisters an action. Reference-based. */\n unregisterAction(handle: ForComboboxActionHandle): void;\n /** Set where focus lands after the next open. The input directive calls it before flipping `open`. */\n setInitialFocus(target: ForComboboxInitialFocus): void;\n /**\n * Called by `[forComboboxVirtualized]` from its constructor. Hands the root the\n * virtualized focus model and returns the root state that model reads and\n * writes.\n */\n registerVirtualization(virtualization: ComboboxVirtualization): ComboboxVirtualizationHost;\n}\n\n/**\n * The virtualized focus model `[forComboboxVirtualized]` lends the root. The\n * root depends on this shape alone, so a combobox without the piece never\n * references the navigation engine.\n */\nexport interface ComboboxVirtualization<T = unknown> {\n /** Full source length, or `undefined` while the piece is present but unset. */\n readonly totalCount: Signal<number | undefined>;\n /** The position the root resumes from once its active option unmounts. */\n readonly resume: VirtualizedResume<T, LabelCacheEntry<T>>;\n /** The navigation engine, constructed on first use. */\n navigator(): ComboboxVirtualizedNavigator<T>;\n /**\n * The rendered window's completion entries merged with the ones the position\n * snapshot remembers from windows scrolled out of view.\n */\n completionEntries(liveWindow: readonly LabelCacheEntry<T>[]): readonly LabelCacheEntry<T>[];\n}\n\n/** The root state the virtualized focus model reads and writes. */\nexport interface ComboboxVirtualizationHost {\n /** Whether auto-highlight is enabled. */\n readonly autoHighlight: () => boolean;\n /** The active option's id. */\n getActiveId(): string | null;\n /** Move the active option, forgetting any retained resume position. */\n setActiveId(id: string | null): void;\n /** Scroll an option into view with the pointer-suppression window open. */\n scrollActiveIntoView(host: HTMLElement): void;\n}\n\n/**\n * The combobox's internal coordination surface: everything\n * {@link ForComboboxContext} publishes plus the {@link ComboboxPieceContext}\n * members and the {@link ComboboxRegistrationContext} protocol.\n *\n * Never exported from `public-api.ts`. It is the type the pieces read\n * {@link FOR_COMBOBOX_CONTEXT} at, so a consumer who injects that token gets the\n * read surface while the pieces get the wiring protocol. `ForCombobox` declares\n * the members neither interface publishes TS-`private`, which keeps them out of\n * the emitted `.d.ts` while `useExisting` still satisfies this contract at\n * runtime.\n */\nexport interface ComboboxContext<T = unknown>\n extends ForComboboxContext<T>, ComboboxPieceContext<T>, ComboboxRegistrationContext<T> {}\n\n/**\n * The constant half of both resolvers' {@link assertRootContext} calls, so the\n * injected and the explicit path state the same requirement.\n */\nconst ROOT_ASSERTION = {\n entryPoint: 'combobox',\n token: 'FOR_COMBOBOX_CONTEXT',\n root: '[forCombobox]',\n};\n\n/**\n * Resolve the surrounding combobox context, re-applying the caller's `T`. The\n * cast through `unknown` is unavoidable (see {@link FOR_COMBOBOX_CONTEXT}): the\n * token can't carry the per-instance generic, so `T` correctness is a\n * consumer-honored contract, not a compiler-enforced one.\n */\nexport function injectComboboxContext<T = unknown>(piece: string): ComboboxContext<T> {\n const ctx = inject(FOR_COMBOBOX_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-COMBOBOX-003',\n piece,\n root: '[forCombobox]',\n token: 'FOR_COMBOBOX_CONTEXT',\n });\n }\n const widened = ctx as unknown as ComboboxContext<T>;\n assertRootContext({\n ...ROOT_ASSERTION,\n piece,\n probe: () => widened.registerInput,\n });\n return widened;\n}\n\n/**\n * Resolves the trigger's root context: the explicit reference when the\n * `[forComboboxTrigger]` input carries one, the injected `FOR_COMBOBOX_CONTEXT`\n * otherwise. The orphan error only fires when neither resolves, on first read\n * of the returned signal. Must be called in an injection context.\n *\n * The explicit reference is a public `ForComboboxContext`, so it is widened back\n * to the internal surface: the runtime object is always the `[forCombobox]`\n * root, which owns the registration protocol the public interface omits. Both\n * paths are guarded, on read rather than at injection time, because the explicit\n * one only resolves inside the `computed`; the explicit widening predates the\n * one-token collapse\n * and was never checked either.\n */\nexport function injectComboboxTriggerContext<T = unknown>(\n explicitRoot: Signal<ForComboboxContext<T> | ''>,\n): {\n readonly root: Signal<ForComboboxContext<T> | ForComboboxContext | null>;\n readonly ctx: Signal<ComboboxContext<T>>;\n} {\n const injected = inject(FOR_COMBOBOX_CONTEXT, { optional: true });\n const root = computed(() => {\n const explicit = explicitRoot();\n return explicit === '' ? injected : explicit;\n });\n const ctx = computed(() => {\n const resolved = root();\n if (!resolved) {\n throw unresolvedRootError({\n code: 'FORCDK-COMBOBOX-004',\n trigger: '[forComboboxTrigger]',\n root: '[forCombobox]',\n token: 'FOR_COMBOBOX_CONTEXT',\n exportAs: 'forCombobox',\n });\n }\n const widened = resolved as unknown as ComboboxContext<T>;\n assertRootContext({\n ...ROOT_ASSERTION,\n piece: 'ForComboboxTrigger',\n probe: () => widened.registerInput,\n });\n return widened;\n });\n return { root, ctx };\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport {\n Collection,\n createPointerHighlight,\n defaultCompareWith,\n defaultItemToFormValue,\n injectFieldAnchor,\n injectHiddenInput,\n injectNativeFormResetToInitial,\n injectTextDirection,\n isUnset,\n LabelCache,\n type LabelCacheEntry,\n lookupByValue,\n nextEnabledHandle,\n selectionMembership,\n singleSelected,\n toggleInArray,\n type VetoableEvent,\n type VetoableNativeEvent,\n type WritingDirection,\n type Unset,\n} from 'forty-cdk/core';\nimport { warnIfOpenWithoutContent } from 'forty-cdk/core-overlay';\nimport {\n AnchoredFormValueControlBase,\n type AnchoredPositioningSeedDefaults,\n anchorSlot,\n injectIdentifiedSlot,\n OverlayController,\n} from 'forty-cdk/core-anchored';\nimport { createActiveIdSignal, revealAutoHighlight } from './combobox-auto-highlight';\nimport {\n COMBOBOX_TRIGGERS,\n FOR_COMBOBOX_CONTEXT,\n type ForComboboxActionHandle,\n type ForComboboxAutocomplete,\n type ForComboboxChipHandle,\n type ForComboboxCloseReason,\n type ForComboboxContext,\n type ForComboboxInitialFocus,\n type ForComboboxOpenHighlight,\n type ForComboboxOptionHandle,\n type ComboboxVirtualization,\n type ComboboxVirtualizationHost,\n} from './combobox-context';\nimport { FOR_COMBOBOX_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Headless implementation of the [WAI-ARIA combobox with listbox popup pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/).\n * Implements `FormValueControl<readonly T[]>` from `@angular/forms/signals`\n * for `[formField]` auto-wiring.\n *\n * Generic over the option value type `T` (default `string`). When the\n * consumer binds object items the directive infers `T` from `[(value)]`\n * and per-piece signatures (`[forComboboxOption][value]`,\n * `[forComboboxChip][value]`) specialize accordingly. Object identity is\n * resolved by the consumer-supplied `[compareWith]` and labels by\n * `[itemToStringLabel]`; the hidden inputs serialize via\n * `[itemToFormValue]` (defaults to `JSON.stringify` for non-strings).\n *\n * Selection is always modeled as `readonly T[]`:\n * - In single mode (`multiple=false`, default), the array has 0 or 1\n * element and option activation closes the listbox.\n * - In multi mode, option activation toggles in/out and the listbox stays\n * open. Selected entries are typically rendered as chips inside\n * `[forComboboxChips]` next to the input.\n *\n * The visible input (\"query\") and the form value are separate two-way\n * bindable models — the consumer keeps them in sync via filtering /\n * display logic, and the primitive only commits to `value` when an option\n * is explicitly activated.\n *\n * Filtering is **always** the consumer's responsibility — the primitive is\n * headless and doesn't filter the registered options. Render the filtered\n * subset with `@for` and the registry tracks them automatically.\n */\n@Directive({\n selector: '[forCombobox]',\n exportAs: 'forCombobox',\n host: {\n '[attr.data-state]': 'open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'effectiveDisabled() ? \"\" : null',\n '[attr.data-readonly]': 'readonly() ? \"\" : null',\n '[attr.dir]': 'dir()',\n '(focusout)': 'onFocusOut($event)',\n },\n providers: [{ provide: FOR_COMBOBOX_CONTEXT, useExisting: ForCombobox }],\n})\nexport class ForCombobox<T = string>\n extends AnchoredFormValueControlBase\n implements FormValueControl<readonly T[]>, ForComboboxContext<T>\n{\n readonly #defaults = inject(FOR_COMBOBOX_DEFAULTS);\n readonly #items = new Collection<ForComboboxOptionHandle<T>>();\n readonly #chips = new Collection<ForComboboxChipHandle<T>>();\n readonly #actions = new Collection<ForComboboxActionHandle>();\n\n protected readonly positioningDefaults: AnchoredPositioningSeedDefaults = this.#defaults;\n\n /**\n * Two-way bindable. Visible input text. The `model()` change emitter\n * (`(queryChange)`) fires only on internal mutations (option activation\n * commit, `clear()`, multi-mode select reset, picker-anatomy reset on\n * close, `restoreQueryOnClose`), never on consumer writes via `[(query)]`.\n */\n readonly query = model<string>('');\n\n /**\n * Two-way bindable. Selected option values. Single mode (`multiple=false`)\n * keeps 0 or 1 element; multi mode keeps any number. The `model()` change\n * emitter (`(valueChange)`) fires only on internal selection changes,\n * never on consumer writes via `[(value)]`.\n */\n readonly value = model<readonly T[]>([]);\n\n /**\n * Compare two items for equality. Defaults to `===`, which is the\n * correct identity for primitive `T` (e.g. strings, numbers). Override\n * when binding object items so the directive can locate selected /\n * removed entries by id (or any other stable key) instead of by\n * reference: `[compareWith]=\"(a, b) => a.id === b.id\"`.\n */\n readonly compareWith = input<(a: T, b: T) => boolean>(defaultCompareWith);\n\n /**\n * Render an item as a string label. Defaults to `String(item)`, which is\n * identity for strings. Drives the visible input text after activation\n * (when `commitOnSelect`) and the chip label fallback in multi mode.\n * Override when binding object items so the directive can fall back to\n * a meaningful label without relying on the option cache being warm:\n * `[itemToStringLabel]=\"(it) => it.name\"`.\n */\n readonly itemToStringLabel = input<(item: T) => string>((item) => String(item));\n\n /**\n * Serialize an item for the hidden input that participates in native\n * form submission. Defaults to identity for strings and to\n * `JSON.stringify` for non-string items so the primitive works out of\n * the box round-tripping objects. Override to emit a specific wire\n * format — typically a per-item id — when the backend expects that:\n * `[itemToFormValue]=\"(it) => it.id\"`.\n */\n readonly itemToFormValue = input<(item: T) => string>(defaultItemToFormValue);\n\n /**\n * Two-way bindable. Whether the listbox is currently shown. Internal\n * transitions: input typing (when `openOnQuery`), focus (when\n * `openOnFocus`), ArrowDown / ArrowUp, Escape, outside dismissal,\n * single-mode option activation.\n */\n readonly open = model<boolean>(false);\n\n /**\n * Whether several options can be selected. In multi mode activation toggles an option and the\n * listbox stays open; single mode keeps `value` at 0 or 1 element and closes on select.\n */\n readonly multiple = input(false, { transform: booleanAttribute });\n\n /**\n * Autocomplete mode applied to the input. Mirrors the\n * [WAI-ARIA `aria-autocomplete` property](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/#wai-ariaroles,states,andproperties)\n * and drives whether the listbox auto-opens on query and whether the\n * input gets inline-completed with the first match. Renamed from\n * `autocomplete` so consumers don't conflate it with the native HTML\n * `autocomplete` attribute (which the directive forces to `\"off\"`).\n *\n * Pure `'inline'` never opens the popup (per APG), so in the default\n * `@if (open())` anatomy no `[forComboboxOption]` renders and the label\n * cache starts cold — a first keystroke into a never-opened inline combobox\n * completes against nothing. Inline completion only works once the options\n * have rendered at least once (the user opened the popup via ArrowDown /\n * `openOnFocus`, warming the cache). Prefer `'both'` when a popup is\n * acceptable, or keep the options mounted, if completion must work from the\n * very first keystroke.\n */\n readonly autocompleteMode = input<ForComboboxAutocomplete>('list');\n\n /** Open the listbox when the input gains focus. Off by default — opening on query / arrow keys is the standard ecosystem behavior. */\n readonly openOnFocus = input(false, { transform: booleanAttribute });\n\n /** Open the listbox when the user starts typing. On by default. Only honored when `autocompleteMode` includes a listbox (`'list'` or `'both'`). */\n readonly openOnQuery = input(true, { transform: booleanAttribute });\n\n /**\n * Where the highlight lands when the editable anatomy opens from focus, click,\n * ArrowDown / ArrowUp, or `openOverlay()` called without an argument. `'selected'`\n * highlights the committed selection, falling back to the first enabled option\n * (ArrowUp: the last) when nothing is selected. Opening from a typed query always\n * highlights the first match, while the picker anatomy and a `[forComboboxToggle]`\n * press always open on the selection. With a `[forComboboxVirtualized]` setting `totalCount`, an open that would\n * land on the selection lands on the first rendered enabled option instead.\n * Defaults to the scope's `openHighlight` (`'first'` unless overridden via\n * `provideForComboboxDefaults`).\n */\n readonly openHighlight = input<ForComboboxOpenHighlight>(this.#defaults.openHighlight);\n\n /**\n * In single mode, copy the activated option's label into `query`. In\n * multi mode, instead **clear** the query so the user can search the\n * next item. On by default in both. Set `false` to leave `query`\n * untouched on activation in either mode.\n *\n * Governs the **editable anatomy** only. In the picker anatomy (a\n * `[forComboboxTrigger]` is registered) the in-panel input is a transient\n * filter, not the value display: the single-mode label copy is always\n * skipped and `query` resets to `''` on close regardless of this flag.\n */\n readonly commitOnSelect = input(true, { transform: booleanAttribute });\n\n /**\n * In single mode, restore the selected option's label into `query` whenever the\n * listbox closes without a pick (Escape, an outside press, Tab, a toggle press,\n * or `closeOverlay()`), and clear it when nothing is selected. A pick keeps the\n * `commitOnSelect` behavior. Ignored in multi mode and in the picker anatomy.\n * Defaults to the scope's `restoreQueryOnClose` (`false` unless overridden via\n * `provideForComboboxDefaults`).\n */\n readonly restoreQueryOnClose = input(this.#defaults.restoreQueryOnClose, {\n transform: booleanAttribute,\n });\n\n /** When the user edits the query, automatically clear the committed `value`. Off by default — most apps want the value preserved across query edits. Single-mode only. */\n readonly clearOnQueryChange = input(false, { transform: booleanAttribute });\n\n /**\n * Auto-highlight the first enabled option whenever the listbox is open\n * and no activedescendant is set (e.g. after the consumer's filter\n * removed the previously-active option). On by default. Set `false` for\n * \"user must arrow before anything is highlighted\" behavior.\n */\n readonly autoHighlight = input(true, { transform: booleanAttribute });\n\n /**\n * Writing direction. Drives chip-cluster keyboard navigation (ArrowLeft /\n * ArrowRight semantics swap in RTL so they follow the visual order, not DOM\n * order) and the default `align` of the listbox (anchors to the right edge\n * of the input in RTL). When unset (default `null`), the inherited ambient\n * direction is resolved from the nearest ancestor carrying a `dir` attribute\n * (or `<html dir>`), defaulting to `'ltr'`. An explicit `[dir]` always wins\n * and the resolved value is reflected to the host `dir` attribute.\n */\n readonly _dirInput = input<WritingDirection | null>(null, { alias: 'dir' });\n readonly dir = injectTextDirection(this._dirInput);\n\n /**\n * Whether arrow navigation wraps past the first / last enabled option. Default `true`.\n * The default is read from `provideForComboboxDefaults` for the surrounding\n * scope.\n */\n readonly loop = input(this.#defaults.loop, { transform: booleanAttribute });\n\n /** When true (default), Escape, pointer-down outside, and focus outside close the listbox. */\n readonly dismissible = input(true, { transform: booleanAttribute });\n\n /**\n * When true (default), focus returns to the `[forComboboxTrigger]` on close\n * in the picker anatomy. In the editable anatomy focus normally never leaves\n * the input, so this only gates the return to the input after a close that\n * unmounts the popup while focus is inside it, such as a `[forComboboxAction]`\n * whose `(activate)` closes it.\n */\n readonly returnFocus = input(true, { transform: booleanAttribute });\n\n /** Manual `aria-label` on the listbox (`[forComboboxList]`, or `[forComboboxContent]` in the editable anatomy) when the input isn't a meaningful name. */\n readonly ariaLabel = input<string | null>(null);\n\n readonly #virtualization = signal<ComboboxVirtualization<T> | null>(null);\n\n /**\n * Full source length while a `[forComboboxVirtualized]` virtualizes the\n * listbox, `undefined` otherwise.\n */\n private readonly totalCount = computed(() => this.#virtualization()?.totalCount());\n\n readonly #virtualized = computed(() => this.totalCount() !== undefined);\n\n /** Emitted before Escape closes the listbox. Call `preventDefault()` to keep it open. */\n readonly escapeKeyDown = output<VetoableNativeEvent<KeyboardEvent>>();\n\n /** Emitted before an outside pointer-down closes the listbox. Vetoable with `preventDefault()`. */\n readonly pointerDownOutside = output<VetoableNativeEvent<PointerEvent>>();\n\n /** Emitted before focus leaving the surface closes the listbox. Vetoable with `preventDefault()`. */\n readonly focusOutside = output<VetoableNativeEvent<FocusEvent>>();\n\n /**\n * Emitted alongside {@link pointerDownOutside} and {@link focusOutside} for consumers that do not\n * care which one occurred. A `preventDefault()` on either channel suppresses the close.\n */\n readonly interactOutside = output<VetoableNativeEvent<PointerEvent | FocusEvent>>();\n\n /**\n * _(picker anatomy only)_ Fires just before focus moves into the input on\n * open. Call `preventDefault()` on the emitted veto to skip the imperative\n * focus move. Only emitted when a `[forComboboxTrigger]` is registered — the\n * editable anatomy keeps focus in the input the whole time and has no move to\n * veto.\n */\n readonly autoFocusOnOpen = output<VetoableEvent>();\n\n /**\n * _(picker anatomy only)_ Fires just before focus returns to the trigger on\n * close. Call `preventDefault()` on the veto to suppress the return-focus.\n */\n readonly autoFocusOnClose = output<VetoableEvent>();\n\n readonly #inputSlot = injectIdentifiedSlot<HTMLInputElement>('for-combobox', 'input');\n readonly #triggers = inject(COMBOBOX_TRIGGERS).of(this);\n readonly #latestTrigger = computed(() => this.#triggers().at(-1) ?? null);\n\n /**\n * The open / close / dismiss machine, shared with the menu and listbox\n * overlays. The combobox supplies both element sides: the controller reports\n * the input's id as the trigger side — the `role=\"combobox\"` id lives there,\n * and `[forComboboxTrigger]` host-binds an id of its own that it hands over on\n * registration — so that slot mints nothing, while the content side is the\n * ordinary identified slot, minted here so `for-combobox-content` keeps\n * following the input's id and preceding the list's.\n */\n readonly #overlay = new OverlayController<ForComboboxInitialFocus, ForComboboxCloseReason>({\n idPrefix: 'for-combobox',\n createTrigger: () => ({\n id: this.#inputSlot.id,\n element: computed(() => this.#latestTrigger()?.host ?? null),\n }),\n defaultInitialFocus: 'first',\n disabled: this.effectiveDisabled,\n dismissible: this.dismissible,\n isOpen: () => this.open(),\n setOpen: (open) => this.open.set(open),\n emit: this,\n escapeReason: 'escape',\n programmaticReason: 'programmatic',\n onClose: (reason) => this.#resetAfterClose(reason),\n });\n\n readonly #listSlot = injectIdentifiedSlot('for-combobox', 'list');\n readonly #anchorSlot = anchorSlot({\n primitive: 'combobox',\n owner: '[forCombobox]',\n claimant: '[forComboboxAnchor]',\n });\n\n readonly inputId = this.#inputSlot.id;\n readonly contentId = this.#overlay.contentId;\n readonly listId = this.#listSlot.id;\n\n readonly input = this.#inputSlot.element;\n\n readonly trigger = this.#overlay.trigger;\n\n /**\n * Element floating-ui anchors the listbox against. Resolution order:\n * explicit `[forComboboxAnchor]` → the surrounding field's `[forFieldAnchor]`\n * → `[forComboboxTrigger]` (picker anatomy) → the input (editable anatomy\n * fallback, so existing comboboxes keep their behavior). Decoupled from\n * `input` so the input keeps driving `aria-controls`,\n * `aria-activedescendant`, keyboard interaction, and its dismissal\n * exemption regardless of where the listbox paints.\n */\n readonly anchor = this.#anchorSlot.resolve(injectFieldAnchor(), this.trigger, this.input);\n\n readonly content = this.#overlay.content;\n\n readonly #fieldButtons = signal<readonly HTMLElement[]>([]);\n private readonly fieldButtons = this.#fieldButtons.asReadonly();\n\n readonly list = this.#listSlot.element;\n /** True once a `[forComboboxList]` has registered (picker anatomy). */\n readonly hasList = computed(() => this.#listSlot.element() !== null);\n /**\n * Id of the element carrying `role=\"listbox\"`: the list when one is\n * registered (picker anatomy), otherwise the content surface (editable\n * anatomy). The input targets this with `aria-controls`.\n */\n readonly listboxId = computed(() => (this.hasList() ? this.listId() : this.contentId()));\n\n private readonly triggerId = computed(() => this.#latestTrigger()?.id() ?? null);\n\n readonly options = this.#items.items;\n readonly chips = this.#chips.items;\n readonly actions = this.#actions.items;\n readonly hasEnabledActions = computed(() => this.#actions.items().some((a) => !a.disabled()));\n\n private readonly initialFocus = this.#overlay.initialFocus;\n\n private readonly lastCloseReason = this.#overlay.lastCloseReason;\n\n /**\n * The activedescendant pointer. Built by {@link createActiveIdSignal} as a\n * `linkedSignal` so the highlight decision is a pure derivation, never a write\n * from an `effect`; it stays writable for the imperative moves that own their\n * own scroll (arrow / Home / End navigation, hover, multi-mode activation, and\n * the virtualized pending-nav resolution). The reset/seed rule lives with the\n * factory in `combobox-auto-highlight.ts`.\n */\n readonly #activeId = createActiveIdSignal<T>({\n query: this.query,\n open: this.open,\n autoHighlight: this.autoHighlight,\n virtualized: this.#virtualized,\n initialFocus: this.#overlay.initialFocus,\n items: this.#items.items,\n value: this.value,\n equals: this.compareWith,\n });\n readonly activeId = this.#activeId.asReadonly();\n\n #lastPositionedId: string | null = null;\n\n readonly #pointer = createPointerHighlight({\n items: () => this.#items.items(),\n activeDescendant: {\n active: () => true,\n claim: (id) => {\n if (!this.isActive(id)) {\n this.setActiveId(id);\n }\n },\n },\n });\n\n /**\n * Bounded option-label cache, shared with `[forSelect]` through\n * `forty-cdk/core`. Keeps `{ id, value, label, disabled }` tuples across\n * close/open in two projections: the selection-keyed one backs\n * {@link selected}'s chip labels (bounded by the selection, so a long-lived\n * remote-search combobox retains the labels of what is selected and nothing\n * else), and the last-window one backs {@link completionEntries} for inline\n * autocomplete. Off-window matching while virtualizing comes from the\n * navigator's position map instead — see {@link completionEntries}.\n */\n readonly #labelCache = new LabelCache<T>({\n items: this.#items.items,\n value: this.value,\n itemToFormValue: this.itemToFormValue,\n compareWith: this.compareWith,\n });\n\n /** The virtualized focus model; only reached while {@link #virtualized} holds. */\n #virtualModel(): ComboboxVirtualization<T> {\n return this.#virtualization()!;\n }\n\n #setActiveId(id: string | null): void {\n if (id !== null) {\n this.#virtualization()?.resume.clear();\n }\n this.#activeId.set(id);\n }\n\n private registerVirtualization(\n virtualization: ComboboxVirtualization,\n ): ComboboxVirtualizationHost {\n this.#virtualization.set(virtualization as unknown as ComboboxVirtualization<T>);\n return {\n autoHighlight: this.autoHighlight,\n getActiveId: () => this.#activeId(),\n setActiveId: (id) => this.#setActiveId(id),\n scrollActiveIntoView: (host) => this.#scrollActiveIntoView(host),\n };\n }\n\n readonly selected = computed<readonly { value: T; label: string }[]>(() => {\n const values = this.value();\n if (values.length === 0) {\n return [];\n }\n const cached = lookupByValue(this.selectedEntries(), (o) => o.value, this.compareWith());\n const toLabel = this.itemToStringLabel();\n return values.map((v) => {\n const opt = cached(v);\n if (opt) {\n return { value: v, label: opt.label };\n }\n return { value: v, label: toLabel(v) };\n });\n });\n\n /**\n * Read-only single-select convenience view of {@link value}. Returns the\n * sole selected item when exactly one is selected, otherwise `null` (empty\n * selection, or multiple selections in `multiple` mode). Lets single-select\n * consumers read `selectedItem()` instead of unwrapping `value()[0]`. The\n * array-backed `value` model remains the source of truth and the\n * `FormValueControl` contract; this is a derived accessor. Distinct from\n * {@link selected}, which pairs every selected value with its resolved\n * label for chip rendering.\n */\n readonly selectedItem = singleSelected(this.value);\n\n /**\n * The combobox's mounted entry point: the `role=\"combobox\"` input, or the\n * `[forComboboxTrigger]` while the input is unmounted — the picker anatomy\n * keeps its input inside the panel, so until it opens the trigger is the\n * only element a surrounding `[forField]` can label or focus.\n */\n readonly #entryPoint = computed(() => this.input() ?? this.trigger());\n\n protected override fieldLabelledElement(): HTMLElement | null {\n return this.#entryPoint();\n }\n\n protected override fieldActivationTarget(): HTMLElement | null {\n return this.trigger();\n }\n\n /**\n * Id a surrounding `[forField]` points its label `for` at. Tracks\n * {@link #entryPoint}: the input's id, or the trigger's own while the input\n * is unmounted — the field only stamps its own id on a target that has none,\n * so nominating `inputId()` there would leave the `for` resolving to no\n * element at all.\n */\n protected override fieldLabelledElementId(): string {\n if (this.input()) {\n return this.inputId();\n }\n return this.triggerId() ?? this.inputId();\n }\n\n /**\n * Move focus to the combobox's entry point, implementing\n * `FormValueControl.focus` from `@angular/forms/signals`. Without this override\n * Signal Forms would focus the host `[forCombobox]` wrapper — which carries no\n * focusable role — so focus-on-error would silently go nowhere. No-op when\n * disabled, or before either the input or a picker trigger has registered.\n */\n override focus(options?: FocusOptions): void {\n if (this.effectiveDisabled()) {\n return;\n }\n this.#entryPoint()?.focus(options);\n }\n\n constructor() {\n super();\n warnIfOpenWithoutContent({\n primitive: 'combobox',\n piece: '[forComboboxContent]',\n condition: 'combobox.open()',\n open: this.open,\n content: () => this.content() ?? this.list(),\n });\n injectHiddenInput<T>({\n name: this.name,\n values: this.value,\n serialize: (item) => this.itemToFormValue()(item),\n disabled: this.effectiveDisabled,\n });\n injectNativeFormResetToInitial(this.value);\n injectNativeFormResetToInitial(this.query);\n\n // @sanctioned-pull(label-cache-window): the option window exists only while\n // the listbox is open, and the closed-state fallback reading it has no\n // reader during that cycle.\n effect(() => {\n this.#labelCache.prime();\n });\n\n // The activedescendant decision is a pure derivation in `#activeId`; this\n // effect runs only its non-virtualized imperative tail, documented on\n // `revealAutoHighlight` in `combobox-auto-highlight.ts`.\n effect(() => {\n revealAutoHighlight<T>({\n items: this.#items.items,\n open: this.open,\n virtualized: this.#virtualized,\n getActiveId: () => this.#activeId(),\n getLastPositionedId: () => this.#lastPositionedId,\n setLastPositionedId: (id) => (this.#lastPositionedId = id),\n scrollIntoView: (host) => this.#scrollActiveIntoView(host),\n });\n });\n }\n\n private registerInput(el: HTMLInputElement): void {\n this.#inputSlot.register(el);\n }\n private unregisterInput(el: HTMLInputElement): void {\n this.#inputSlot.unregister(el);\n }\n\n /** See {@link ForComboboxContext.registerAnchor}. */\n registerAnchor(el: HTMLElement): void {\n this.#anchorSlot.register(el);\n }\n /** See {@link ForComboboxContext.unregisterAnchor}. */\n unregisterAnchor(el: HTMLElement): void {\n this.#anchorSlot.unregister(el);\n }\n\n private registerFieldButton(el: HTMLElement): void {\n this.#fieldButtons.update((list) => (list.includes(el) ? list : [...list, el]));\n }\n private unregisterFieldButton(el: HTMLElement): void {\n this.#fieldButtons.update((list) => list.filter((x) => x !== el));\n }\n\n private registerContent(el: HTMLElement): void {\n this.#overlay.registerContent(el);\n }\n private unregisterContent(el: HTMLElement): void {\n this.#overlay.unregisterContent(el);\n }\n\n private registerList(el: HTMLElement): void {\n this.#listSlot.register(el);\n }\n private unregisterList(el: HTMLElement): void {\n this.#listSlot.unregister(el);\n }\n\n private registerOption(handle: ForComboboxOptionHandle<T>): void {\n this.#items.register(handle);\n }\n private unregisterOption(handle: ForComboboxOptionHandle<T>): void {\n if (this.#virtualized() && this.open() && this.#activeId() === handle.id()) {\n this.#virtualModel().resume.retain(handle.posInSet?.() ?? null, handle.value());\n }\n this.#items.unregister(handle);\n }\n\n private registerChip(handle: ForComboboxChipHandle<T>): void {\n this.#chips.register(handle);\n }\n private unregisterChip(handle: ForComboboxChipHandle<T>): void {\n this.#chips.unregister(handle);\n }\n\n private registerAction(handle: ForComboboxActionHandle): void {\n this.#actions.register(handle);\n }\n private unregisterAction(handle: ForComboboxActionHandle): void {\n this.#actions.unregister(handle);\n }\n\n private moveActionFocus(fromActionId: string | null, direction: 'next' | 'prev'): void {\n const all = this.#actions.items();\n const inputEl = this.input();\n let sourceKey = -1;\n if (fromActionId !== null) {\n const idx = all.findIndex((a) => a.id() === fromActionId);\n if (idx !== -1) {\n sourceKey = idx;\n }\n }\n\n if (direction === 'next') {\n const after = this.#scanEnabledAction(all, sourceKey + 1, 1);\n if (after) {\n after.host.focus();\n return;\n }\n if (inputEl) {\n inputEl.focus();\n return;\n }\n this.#scanEnabledAction(all, 0, 1)?.host.focus();\n return;\n }\n\n const before = this.#scanEnabledAction(all, sourceKey - 1, -1);\n if (before) {\n before.host.focus();\n return;\n }\n if (inputEl && sourceKey > -1) {\n inputEl.focus();\n return;\n }\n const last = this.#scanEnabledAction(all, all.length - 1, -1);\n if (last) {\n last.host.focus();\n return;\n }\n inputEl?.focus();\n }\n\n #scanEnabledAction(\n actions: readonly ForComboboxActionHandle[],\n from: number,\n step: 1 | -1,\n ): ForComboboxActionHandle | null {\n for (let i = from; i >= 0 && i < actions.length; i += step) {\n const action = actions[i]!;\n if (!action.disabled()) {\n return action;\n }\n }\n return null;\n }\n\n readonly #isSelected = selectionMembership(this.value, this.compareWith);\n\n isSelected(v: T): boolean {\n return this.#isSelected()(v);\n }\n\n #setSingle(v: T): void {\n if (this.value().length === 1 && this.isSelected(v)) {\n return;\n }\n this.value.set([v]);\n }\n\n private isActive(id: string): boolean {\n return this.#activeId() === id;\n }\n\n private highlightFromPointer(host: HTMLElement, id: string): void {\n this.#pointer.claim(host, id);\n }\n\n activate(handle: ForComboboxOptionHandle<T>): void {\n if (handle.disabled()) {\n return;\n }\n this.#activateValue(handle.value(), handle.label(), handle.id());\n }\n\n #activateValue(v: T | Unset, label: string, id: string | null): void {\n if (this.effectiveDisabled() || this.readonly() || isUnset(v)) {\n return;\n }\n if (this.multiple()) {\n // Toggle in/out of the array. Stay open so the user can keep picking.\n this.value.set(toggleInArray(this.value(), v, this.compareWith()));\n if (this.commitOnSelect()) {\n // Reset query so the next typed prefix searches afresh.\n this.query.set('');\n this.#syncInputValue('');\n }\n if (id !== null) {\n this.#setActiveId(id);\n }\n return;\n }\n // Single mode: replace + close + commit label.\n this.#setSingle(v);\n if (this.commitOnSelect() && this.trigger() === null) {\n this.query.set(label);\n this.#syncInputValue(label);\n }\n this.closeOverlay('select');\n }\n\n /**\n * Imperatively align the visible `<input>` text with `query()` even\n * while the input has focus. The directive's reactive sync skips\n * focused syncs to avoid clobbering inline-autocomplete selection\n * during typing — but activation / clear writes happen *outside* the\n * typing flow and should be visible immediately.\n */\n #syncInputValue(value: string): void {\n const el = this.#inputSlot.element();\n if (el && el.value !== value) {\n el.value = value;\n }\n }\n\n removeValue(v: T): void {\n if (this.effectiveDisabled() || this.readonly()) {\n return;\n }\n const equals = this.compareWith();\n const current = this.value();\n if (!current.some((x) => equals(x, v))) {\n return;\n }\n this.value.set(current.filter((x) => !equals(x, v)));\n }\n\n private activateActive(): boolean {\n const id = this.#activeId();\n if (!id) {\n return this.#activateResumed();\n }\n const handle = this.#items.items().find((o) => o.id() === id);\n if (!handle || handle.disabled()) {\n return false;\n }\n this.activate(handle);\n return true;\n }\n\n #activateResumed(): boolean {\n const virtualization = this.#virtualization();\n if (virtualization === null) {\n return false;\n }\n const resumed = virtualization.resume.resolve();\n if (resumed === null || resumed.entry.disabled) {\n return false;\n }\n virtualization.navigator().seedActive(resumed.pos);\n this.#activateValue(resumed.entry.value, resumed.entry.label, null);\n return true;\n }\n\n private navigate(direction: 'next' | 'prev' | 'first' | 'last'): void {\n if (this.effectiveDisabled()) {\n return;\n }\n if (this.#virtualized()) {\n this.#virtualModel().navigator().navigate(direction);\n return;\n }\n const items = this.#items.items();\n if (items.length === 0) {\n return;\n }\n const currentId = this.#activeId();\n const currentIndex = currentId === null ? -1 : items.findIndex((o) => o.id() === currentId);\n\n // No activedescendant yet + arrow nav: jump to the natural extreme\n // (ArrowDown → first enabled, ArrowUp → last enabled).\n let action = direction;\n if (currentIndex < 0 && direction === 'next') {\n action = 'first';\n } else if (currentIndex < 0 && direction === 'prev') {\n action = 'last';\n }\n\n const target = nextEnabledHandle(items, currentIndex, action, { loop: this.loop() });\n if (target === null) {\n return;\n }\n this.#setActiveId(target.id());\n this.#scrollActiveIntoView(target.host);\n this.#lastPositionedId = target.id();\n }\n\n private setQueryFromInput(query: string): void {\n if (!this.#writeQueryFromInput(query)) {\n return;\n }\n const mode = this.autocompleteMode();\n const hasListbox = mode === 'list' || mode === 'both';\n if (this.openOnQuery() && hasListbox && query.length > 0 && !this.open()) {\n this.openOverlay('first');\n }\n }\n\n private acceptQueryFromInput(query: string): void {\n this.#writeQueryFromInput(query);\n }\n\n #writeQueryFromInput(query: string): boolean {\n if (this.effectiveDisabled() || this.readonly()) {\n return false;\n }\n this.query.set(query);\n this.#virtualization()?.resume.clear();\n if (this.clearOnQueryChange() && !this.multiple() && this.value().length > 0) {\n this.value.set([]);\n }\n return true;\n }\n\n private setActiveId(id: string | null): void {\n this.#setActiveId(id);\n this.#lastPositionedId = id;\n }\n\n #scrollActiveIntoView(host: HTMLElement): void {\n this.#pointer.suppress();\n host.scrollIntoView?.({ block: 'nearest' });\n }\n\n /**\n * Scroll the current activedescendant option into view. Driven from\n * `[forComboboxContent]`'s positioner first-resolved-position hook\n * (`onFirstPosition`) — the only moment both prerequisites hold: the content\n * has been portaled to `document.body` (which resets the scroll container's\n * `scrollTop` to 0, wiping the seed scroll the auto-highlight bridge applied\n * during change detection) and `@floating-ui/dom`'s `size` middleware has\n * constrained the surface to its `max-height` (so it is actually scrollable).\n *\n * Re-applies the scroll unconditionally — the bridge already recorded this id\n * as positioned, but the portal move invalidated the real scroll position, so\n * the usual \"already positioned\" guard must not short-circuit here. Fires once\n * per open (the positioner hook is per-open, not per-run, so a side flip while\n * open never re-fires it and yanks the user's scroll back), so a later hover\n * never scrolls. No-op while virtualizing: the navigator owns the virtualized\n * scroll and the indexed seed is intentionally passive.\n */\n private scrollActiveOptionIntoView(): void {\n if (this.#virtualized()) {\n return;\n }\n const id = this.#activeId();\n if (id === null) {\n return;\n }\n const active = this.#items.items().find((o) => o.id() === id);\n if (!active) {\n return;\n }\n this.#scrollActiveIntoView(active.host);\n this.#lastPositionedId = id;\n }\n\n private selectedEntries(): readonly { id: string; value: T; label: string; disabled: boolean }[] {\n return this.#labelCache.selectedEntries();\n }\n\n readonly #completionEntriesMemo = computed<readonly LabelCacheEntry<T>[]>(() => {\n const liveWindow = this.#labelCache.windowEntries();\n if (!this.#virtualized()) {\n return liveWindow;\n }\n return this.#virtualModel().completionEntries(liveWindow);\n });\n\n private completionEntries(): readonly {\n id: string;\n value: T;\n label: string;\n disabled: boolean;\n }[] {\n return this.#completionEntriesMemo();\n }\n\n clear(clearQuery: boolean = true): void {\n if (this.effectiveDisabled() || this.readonly()) {\n return;\n }\n this.value.set([]);\n if (clearQuery) {\n this.query.set('');\n this.#syncInputValue('');\n }\n this.#activeId.set(null);\n this.#virtualization()?.resume.clear();\n }\n\n private setInitialFocus(target: ForComboboxInitialFocus): void {\n this.#overlay.setInitialFocus(target);\n }\n\n toggle(): void {\n this.#overlay.toggle(this.trigger() !== null ? 'selected' : 'first');\n }\n\n /**\n * Opens the listbox, seeding where the auto-highlight lands. Without an\n * argument the seed follows `openHighlight`: the committed selection for\n * `'selected'`, the first enabled option otherwise. Idempotent: an open on a\n * listbox that is already open re-arms nothing, so an ArrowDown that finds the\n * surface mounted leaves the current activedescendant where the user\n * navigated it.\n */\n openOverlay(initialFocus?: ForComboboxInitialFocus): void {\n if (this.open()) {\n return;\n }\n this.#overlay.open(initialFocus ?? this.openHighlight());\n }\n\n private openFromExtreme(extreme: 'first' | 'last'): void {\n const seed =\n this.openHighlight() === 'selected' && (extreme === 'first' || this.value().length > 0)\n ? 'selected'\n : extreme;\n this.openOverlay(seed);\n }\n\n /**\n * Closes the listbox, recording `reason` as the {@link lastCloseReason} the\n * content reads. Idempotent, unlike the shared machine's own close: this is a\n * consumer-facing method, so a `closeOverlay` on an already-closed listbox must\n * not overwrite the previous reason (a `'tab'` close has to survive so the\n * content skips its return-focus) nor re-run the close side effects.\n */\n closeOverlay(reason: ForComboboxCloseReason): void {\n if (!this.open()) {\n return;\n }\n this.#overlay.close(reason);\n }\n\n /**\n * Close side effects, run after the open state flips: the activedescendant is\n * dropped, the virtualized navigator's pending move discarded, and — in the\n * picker anatomy, where the in-panel input is a transient filter rather than\n * the value display — the query reset. A single-select editable combobox with\n * `restoreQueryOnClose` instead restores the selected label on any close but a\n * pick.\n */\n #resetAfterClose(reason: ForComboboxCloseReason): void {\n this.#activeId.set(null);\n const virtualization = this.#virtualization();\n if (virtualization !== null) {\n virtualization.resume.clear();\n if (this.#virtualized()) {\n virtualization.navigator().resetPending();\n }\n }\n if (this.trigger() !== null) {\n this.query.set('');\n this.#syncInputValue('');\n return;\n }\n if (this.restoreQueryOnClose() && !this.multiple() && reason !== 'select') {\n const label = this.selected()[0]?.label ?? '';\n this.query.set(label);\n this.#syncInputValue(label);\n }\n }\n\n /** Fire `(autoFocusOnOpen)` and report whether the consumer vetoed the focus move. */\n private emitAutoFocusOnOpen(): boolean {\n return this.#overlay.emitAutoFocusOnOpen();\n }\n\n /** Fire `(autoFocusOnClose)` and report whether the consumer vetoed the return-focus. */\n private emitAutoFocusOnClose(): boolean {\n return this.#overlay.emitAutoFocusOnClose();\n }\n\n private emitEscapeKeyDown(event: KeyboardEvent): void {\n this.#overlay.emitEscapeKeyDown(event);\n }\n\n /**\n * Outside-interaction emit forwarders. The shared `#pendingOutsideVeto`\n * reuse between the specific outside channels and the composite\n * `interactOutside` lives in `injectOverlayShell`; these only fire the\n * matching output with the veto the shell built.\n */\n private emitPointerDownOutside(veto: VetoableNativeEvent<PointerEvent>): void {\n this.#overlay.emitPointerDownOutside(veto);\n }\n private emitFocusOutside(veto: VetoableNativeEvent<FocusEvent>): void {\n this.#overlay.emitFocusOutside(veto);\n }\n private emitInteractOutside(veto: VetoableNativeEvent<PointerEvent | FocusEvent>): void {\n this.#overlay.emitInteractOutside(veto);\n }\n\n /**\n * Implicit close requested by the shell after an un-vetoed outside\n * interaction. The shared machine's own open guard keeps a stale event from\n * clobbering the previous close reason.\n *\n * The touch mark sits **ahead** of that guard rather than on the\n * machine's `onDismiss` hook, which is where `[forSelect]` / `[forTimePicker]`\n * put theirs: an outside interaction is this control's blur, so it marks the\n * combobox touched exactly like {@link onFocusOut} does — whether or not the\n * listbox was still open when the shell's event arrived. Wiring the hook\n * instead would additionally mark touched on Escape, which leaves focus in the\n * input and therefore blurs nothing.\n */\n private requestClose(reason: 'pointerDownOutside' | 'focusOutside'): void {\n this.markTouched();\n this.#overlay.requestClose(reason);\n }\n\n private onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as HTMLElement | null;\n const inputEl = this.#inputSlot.element();\n const content = this.content();\n if (next) {\n if (inputEl && inputEl.contains(next)) {\n return;\n }\n if (content && content.contains(next)) {\n return;\n }\n // Focus moving to a chip (multi mode) is \"inside\" — chips are an\n // extension of the input area, not an outside boundary.\n const chips = this.#chips.items();\n for (const chip of chips) {\n if (chip.host.contains(next)) {\n return;\n }\n }\n if (this.#fieldButtons().some((button) => button.contains(next))) {\n return;\n }\n }\n this.markTouched();\n }\n}\n","import type { LabelCacheEntry } from 'forty-cdk/core';\n\n/**\n * Overlay the virtualized position snapshot onto the label cache's window\n * entries, so inline autocomplete keeps matching options scrolled out of view.\n *\n * The label cache holds one window at a time, while the navigator's position map\n * accumulates every position it has folded (bounded by `totalCount`, purged on a\n * dataset rebuild). Window entries take precedence — they are the freshest read —\n * and off-window entries follow, sorted by absolute position so a completion walk\n * meets them in list order. De-duplication is by serialized form value, not by\n * `id`: an option that unmounts and remounts under a new id but the same value is\n * one option.\n *\n * Pass an empty map (the non-virtualized case) to get `entries` back unchanged.\n *\n * Internal — not re-exported from `combobox/public-api.ts`.\n */\nexport function mergeOffWindowEntries<T>(\n entries: readonly LabelCacheEntry<T>[],\n indexed: ReadonlyMap<number, LabelCacheEntry<T>>,\n toFormValue: (item: T) => string,\n): readonly LabelCacheEntry<T>[] {\n if (indexed.size === 0) {\n return entries;\n }\n const seen = new Set(entries.map((entry) => toFormValue(entry.value)));\n const merged: LabelCacheEntry<T>[] = [...entries];\n for (const pos of [...indexed.keys()].sort((a, b) => a - b)) {\n const entry = indexed.get(pos)!;\n const key = toFormValue(entry.value);\n if (seen.has(key)) {\n continue;\n }\n seen.add(key);\n merged.push(entry);\n }\n return merged;\n}\n","import {\n isUnset,\n type LabelCacheEntry,\n VirtualizedNavigator,\n type VirtualizedNavigatorDeps,\n} from 'forty-cdk/core';\nimport type { ForComboboxOptionHandle } from './combobox-context';\n\n/** The shared navigation engine as `ForCombobox` parameterises it. */\nexport type ComboboxVirtualizedNavigator<T> = VirtualizedNavigator<\n ForComboboxOptionHandle<T>,\n LabelCacheEntry<T>\n>;\n\n/**\n * Wire the shared `forty-cdk/core` navigation engine to the combobox option\n * handle: `posInSet` is optional here (an option registered outside a virtualized\n * window carries none), the snapshot entry doubles as a label-cache entry so the\n * scrolled-out-of-view label fallback can read it, an option whose `[value]`\n * binding is not written yet is skipped this fold, and scroll-into-view is\n * routed through `scrollActiveIntoView` so the host's pointer-suppression window\n * opens first — a synthetic `pointermove` from the scroll must not hijack the\n * activedescendant.\n *\n * `deferFoldOnTotalTransition` is the combobox-only tunable: a `totalCount` flip\n * (a query / source rebuild) can fire while `items()` still holds the previous\n * window, so the snapshot empties without folding the stale entries and waits\n * for `items` to catch up.\n *\n * Internal — not re-exported from `combobox/index.ts` or `public-api.ts`.\n */\nexport function createComboboxVirtualizedNavigator<T>(\n deps: VirtualizedNavigatorDeps<ForComboboxOptionHandle<T>>,\n scrollActiveIntoView: (host: HTMLElement) => void,\n): ComboboxVirtualizedNavigator<T> {\n return new VirtualizedNavigator(\n deps,\n {\n posOf: (o) => o.posInSet?.() ?? null,\n idOf: (o) => o.id(),\n hostOf: (o) => o.host,\n isDisabled: (o) => o.disabled(),\n readEntry: (o) => {\n const id = o.id();\n const value = o.value();\n return isUnset(value) ? null : { id, value, label: o.label(), disabled: o.disabled() };\n },\n scrollIntoView: (host) => scrollActiveIntoView(host),\n },\n { deferFoldOnTotalTransition: true },\n );\n}\n","import { Directive, effect, input, numberAttribute, output } from '@angular/core';\n\nimport { type LabelCacheEntry, VirtualizedResume } from 'forty-cdk/core';\nimport { runAutoHighlightBridge } from './combobox-auto-highlight';\nimport { injectComboboxContext } from './combobox-context';\nimport { mergeOffWindowEntries } from './combobox-off-window-merge';\nimport {\n type ComboboxVirtualizedNavigator,\n createComboboxVirtualizedNavigator,\n} from './combobox-virtualized-navigator';\n\n/**\n * Opts a `[forCombobox]` into virtualized navigation, for a listbox whose\n * options the consumer's virtualizer mounts only while they are in view. Placed\n * on the `[forCombobox]` element itself. While `totalCount` is set, each\n * rendered option carries `aria-setsize` / `aria-posinset`, keyboard navigation\n * reaches options outside the rendered window through `(scrollToIndex)`, and\n * inline autocomplete matches options scrolled out of view.\n *\n * A combobox without this directive never bundles the virtualized navigation\n * engine.\n *\n * @example\n * ```html\n * <div forCombobox forComboboxVirtualized [totalCount]=\"items.length\"\n * [visibleRange]=\"range()\" (scrollToIndex)=\"virtualizer.scrollToIndex($event)\">\n * …\n * </div>\n * ```\n */\n@Directive({\n selector: '[forComboboxVirtualized]',\n exportAs: 'forComboboxVirtualized',\n})\nexport class ForComboboxVirtualized {\n readonly #ctx = injectComboboxContext('ForComboboxVirtualized');\n\n /**\n * Total number of options in the consumer's source array. Set when wiring\n * up a virtualized listbox (only the visible window is rendered) so the\n * combobox can reflect `aria-setsize` and walk the snapshot for\n * navigation past the rendered range. Leave unset (default `undefined`) and\n * the combobox falls back to `options().length` (the live registry).\n */\n readonly totalCount = input(undefined, {\n transform: (v: unknown): number | undefined => (v == null ? undefined : numberAttribute(v)),\n });\n\n /**\n * Inclusive-exclusive `[start, end)` range of options currently rendered\n * in the DOM. Used to translate \"move to absolute position N\" into either an\n * in-window highlight update or a request to the consumer to scroll N into\n * view (`(scrollToIndex)`). When `undefined` (default), navigation assumes\n * every option in the snapshot is rendered.\n */\n readonly visibleRange = input<readonly [number, number] | undefined>(undefined);\n\n /**\n * Tells the combobox the source dataset changed **without** a `totalCount`\n * transition — a same-length re-sort or refresh (e.g. sorting a 1000-row\n * list). Bind any value that changes on such a refresh (a version counter,\n * the array reference, a sort-key string); when it changes the position\n * snapshot rebuilds from empty so navigation never resolves against a stale\n * off-window entry. Leave unset (default) when the dataset only ever changes\n * length. Equivalent to calling {@link ForComboboxVirtualized.invalidateSnapshot}\n * imperatively.\n */\n readonly dataVersion = input<unknown>();\n\n /**\n * Emitted when keyboard navigation needs to land on an option whose\n * absolute index falls outside `visibleRange()`. Wire this to the\n * consumer's virtualizer (`scrollToIndex(idx)` on `@tanstack/virtual`,\n * `virtua`, etc.); once the option mounts, the combobox seeds\n * `aria-activedescendant` automatically.\n */\n readonly scrollToIndex = output<number>();\n\n #navigator: ComboboxVirtualizedNavigator<unknown> | null = null;\n\n readonly #resume = new VirtualizedResume<unknown, LabelCacheEntry<unknown>>({\n totalCount: this.totalCount,\n snapshotByPos: () => this.#requireNavigator().snapshotByPos(),\n compareWith: this.#ctx.compareWith,\n });\n\n readonly #host = this.#ctx.registerVirtualization({\n totalCount: this.totalCount,\n resume: this.#resume,\n navigator: () => this.#requireNavigator(),\n completionEntries: (liveWindow) =>\n mergeOffWindowEntries(\n liveWindow,\n this.#requireNavigator().snapshotByPos(),\n this.#ctx.itemToFormValue(),\n ),\n });\n\n constructor() {\n // The activedescendant decision is a pure derivation in the root's\n // `#activeId`; this effect runs only its virtualized imperative tail,\n // documented on `runAutoHighlightBridge` in `combobox-auto-highlight.ts`.\n // @sanctioned-pull(navigator-position-map): the rendered window is transient,\n // so a window nothing reads during is lost to the lazy fold.\n effect(() => {\n runAutoHighlightBridge({\n requireNavigator: () => this.#requireNavigator(),\n items: this.#ctx.options,\n open: this.#ctx.open,\n autoHighlight: this.#host.autoHighlight,\n virtualized: () => this.totalCount() !== undefined,\n initialFocus: this.#ctx.initialFocus,\n getActiveId: () => this.#host.getActiveId(),\n });\n });\n }\n\n /**\n * Force the position snapshot to rebuild from empty on the next fold,\n * discarding stale off-window entries. Call after a same-length dataset\n * refresh (a re-sort / reload that keeps `totalCount` unchanged) when you\n * cannot express the change through the reactive `[dataVersion]` input. No-op\n * while `totalCount` is unset.\n */\n invalidateSnapshot(): void {\n if (this.totalCount() === undefined) {\n return;\n }\n this.#requireNavigator().invalidateSnapshot();\n }\n\n #requireNavigator(): ComboboxVirtualizedNavigator<unknown> {\n return (this.#navigator ??= createComboboxVirtualizedNavigator(\n {\n items: this.#ctx.options,\n totalCount: this.totalCount,\n visibleRange: this.visibleRange,\n loop: this.#ctx.loop,\n getActiveId: () => this.#host.getActiveId(),\n setActiveId: (id) => this.#host.setActiveId(id),\n emitScrollToIndex: (idx) => this.scrollToIndex.emit(idx),\n getResumePos: () => this.#resume.pos(),\n dataVersion: this.dataVersion,\n },\n (host) => this.#host.scrollActiveIntoView(host),\n ));\n }\n}\n","import { Directive, ElementRef, inject } from '@angular/core';\n\nimport { registerHandle } from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * Optional positioning anchor. When present, `[forComboboxContent]` is\n * positioned against this element instead of `[forComboboxInput]` — useful\n * when the input lives inside a decorated field box (padding, prefix icon,\n * clear button, chip cluster) and the listbox should match the visible field\n * rather than the inner `<input>`.\n *\n * Only positioning changes: the input still owns `aria-controls`,\n * `aria-expanded`, `aria-activedescendant`, keyboard interaction, and its\n * exemption from outside-pointer dismissal. If no anchor is registered the\n * listbox falls back to anchoring against the input, so existing usages are\n * unaffected.\n *\n * It wins over a surrounding field's `[forFieldAnchor]`. One\n * `[forComboboxAnchor]` per `[forCombobox]`; a second one warns in dev mode.\n *\n * ```html\n * <div forCombobox [(value)]=\"v\" [(query)]=\"q\">\n * <div forComboboxAnchor class=\"field-box\">\n * <icon />\n * <input forComboboxInput />\n * <button class=\"clear\">×</button>\n * </div>\n * @if (open()) {\n * <div forComboboxContent>…</div>\n * }\n * </div>\n * ```\n */\n@Directive({\n selector: '[forComboboxAnchor]',\n exportAs: 'forComboboxAnchor',\n})\nexport class ForComboboxAnchor {\n readonly #ctx = injectComboboxContext('ForComboboxAnchor');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n constructor() {\n registerHandle(\n this.#host.nativeElement,\n (el) => this.#ctx.registerAnchor(el),\n (el) => this.#ctx.unregisterAnchor(el),\n );\n }\n}\n","import { computed, Directive, ElementRef, inject, input } from '@angular/core';\n\nimport { hostButtonType, hostId, reflectDisabled, registerHandle } from 'forty-cdk/core';\nimport {\n COMBOBOX_TRIGGERS,\n type ForComboboxContext,\n injectComboboxTriggerContext,\n} from './combobox-context';\n\n/**\n * Button that opens the listbox and keeps showing the committed selection\n * (label + icon) while the search input lives **inside** the panel — the\n * \"combobox with trigger\" / picker anatomy. Apply on\n * a real `<button>` so Space / Enter dispatch native click events that toggle\n * via `(click)`.\n *\n * Registering a trigger switches the combobox into the picker anatomy: it\n * becomes the default positioning anchor (after an explicit\n * `[forComboboxAnchor]`), focus moves into `[forComboboxInput]` on open and\n * returns to the trigger on close (the standard `(autoFocusOnOpen)` /\n * `(autoFocusOnClose)` vetoable hooks now fire), and `[forComboboxContent]`\n * expects an inner `[forComboboxList]` to carry the listbox role while the\n * content itself becomes a `role=\"dialog\"` named by this trigger.\n *\n * Wires `role=\"combobox\"`, `aria-haspopup=\"dialog\"`, `aria-expanded`, and\n * `aria-controls` (pointing to the dialog surface while open). A static `id`\n * on the host is kept; without one the trigger gets a generated id. Native\n * `disabled` reflects `effectiveDisabled` (single-purpose trigger). The\n * trigger is exempt from the popup's dismissible layer — clicks on it route\n * through `(click)` instead of racing an outside-pointer dismissal.\n *\n * It also reflects the root's form-control state (`aria-readonly` /\n * `aria-required` / `aria-invalid` / `aria-busy`, truthy-only) plus the\n * `data-readonly` styling hook, because a closed picker exposes no other\n * focusable element: the `[forComboboxInput]` that carries the same state is\n * mounted inside the panel. The `combobox` role is what supports those\n * properties, which the implicit `button` role does not. A `combobox` takes its\n * name from the author rather than from its content, so label it\n * (`aria-labelledby`, `aria-label`, or a surrounding `[forField]`).\n *\n * The trigger keeps the role while the dialog is open, alongside the\n * `role=\"combobox\"` input inside it. They are two widgets in two contexts: the\n * trigger is the collapsed control that owns the dialog popup, the input is\n * the search field that owns the listbox popup, and focus sits on only one of\n * them at a time. Dropping the role on open would change the trigger's\n * semantics under the user while the dialog it names is showing.\n *\n * The root is normally resolved via DI from the enclosing `[forCombobox]`.\n * When the trigger is declared inside an `ng-template` stamped into the root\n * (e.g. via `ngTemplateOutlet`), DI resolves at the template's declaration\n * site and misses the root — pass it explicitly through the selector input,\n * `routerLink`-style: `[forComboboxTrigger]=\"root\"` with `#root=\"forCombobox\"`.\n *\n * Keyboard:\n * - **Click / Enter / Space** — toggle (open moves focus into the input).\n * - **ArrowDown** — open with the committed selection highlighted, falling back\n * to the first enabled option.\n * - **ArrowUp** — open with the committed selection highlighted, falling back\n * to the last enabled option.\n */\n@Directive({\n selector: '[forComboboxTrigger]',\n exportAs: 'forComboboxTrigger',\n host: {\n '[attr.type]': 'buttonType()',\n role: 'combobox',\n '[id]': 'id()',\n '[attr.aria-haspopup]': '\"dialog\"',\n '[attr.aria-expanded]': 'ctx().open() ? \"true\" : \"false\"',\n '[attr.aria-controls]': 'ctx().open() ? ctx().contentId() : null',\n '[attr.aria-readonly]': 'ctx().readonly() ? \"true\" : null',\n '[attr.aria-required]': 'ctx().required() ? \"true\" : null',\n '[attr.aria-invalid]': 'ctx().invalid() ? \"true\" : null',\n '[attr.aria-busy]': 'ctx().pending() ? \"true\" : null',\n '[attr.data-state]': 'ctx().open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'ctx().effectiveDisabled() ? \"\" : null',\n '[attr.data-readonly]': 'ctx().readonly() ? \"\" : null',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForComboboxTrigger<T = unknown> {\n private readonly buttonType = hostButtonType();\n\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Optional explicit reference to the `[forCombobox]` root, named after the\n * selector `routerLink`-style. The bare valueless attribute keeps resolving\n * the enclosing root via DI; pass the root explicitly\n * (`[forComboboxTrigger]=\"root\"`, with `#root=\"forCombobox\"`) when the\n * trigger is declared in an `ng-template` stamped inside the root — DI\n * resolves at the template's declaration site, so the enclosing root is\n * invisible there. The empty string (what the valueless attribute yields) is\n * treated as unset.\n */\n readonly forComboboxTrigger = input<ForComboboxContext<T> | ''>('');\n\n readonly #resolved = injectComboboxTriggerContext<T>(this.forComboboxTrigger);\n private readonly ctx = this.#resolved.ctx;\n\n private readonly id = hostId('for-combobox-trigger');\n\n constructor() {\n const triggers = inject(COMBOBOX_TRIGGERS);\n registerHandle(\n { host: this.#host.nativeElement, id: this.id, root: this.#resolved.root },\n (handle) => triggers.add(handle),\n (handle) => triggers.remove(handle),\n );\n reflectDisabled(computed(() => this.ctx().effectiveDisabled()));\n }\n\n private onClick(): void {\n this.ctx().toggle();\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.ctx().effectiveDisabled()) {\n return;\n }\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.ctx().openOverlay('selected');\n return;\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.ctx().openOverlay(this.ctx().value().length > 0 ? 'selected' : 'last');\n }\n }\n}\n","import { Directive, ElementRef, inject, input } from '@angular/core';\n\nimport {\n hostAriaLabel,\n hostButtonType,\n preventPointerFocus,\n reflectDisabled,\n registerHandle,\n resolveTextInput,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\nimport { FOR_COMBOBOX_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Chevron button next to the editable anatomy's `[forComboboxInput]`, as in the\n * [APG editable combobox examples](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/).\n * Apply on a real `<button>`.\n *\n * A press closes an open listbox, or opens a closed one with the committed\n * selection highlighted (the first enabled option when nothing is selected)\n * and moves focus into the input. The press never takes focus itself, so an\n * input that already has focus keeps it and the combobox is not marked\n * touched. Unlike `[forComboboxTrigger]`, registering a toggle keeps the\n * editable anatomy: `commitOnSelect` still copies the picked label and `query`\n * survives a close.\n *\n * Out of the Tab sequence (`tabindex=\"-1\"`), since the input already owns the\n * keyboard. Wires `aria-expanded` and `aria-controls` (the listbox, while open),\n * an accessible name, and native `disabled` from the combobox's effective\n * disabled. Exempt from the popup's outside-pointer dismissal, like the input.\n */\n@Directive({\n selector: '[forComboboxToggle]',\n exportAs: 'forComboboxToggle',\n host: {\n '[attr.type]': 'buttonType()',\n tabindex: '-1',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.aria-expanded]': 'ctx.open() ? \"true\" : \"false\"',\n '[attr.aria-controls]': 'ctx.open() ? ctx.listboxId() : null',\n '[attr.data-state]': 'ctx.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'ctx.effectiveDisabled() ? \"\" : null',\n '(click)': 'onClick()',\n },\n})\nexport class ForComboboxToggle {\n private readonly buttonType = hostButtonType();\n\n private readonly ctx = injectComboboxContext('ForComboboxToggle');\n readonly #defaults = inject(FOR_COMBOBOX_DEFAULTS);\n\n /**\n * Accessible name for the toggle, exposed as `aria-label`. Defaults to the\n * scope's `toggleAriaLabel` (`'Show options'` unless overridden via\n * `provideForComboboxDefaults`); set `[ariaLabel]` to override per-instance,\n * or `null` to drop the attribute.\n */\n readonly ariaLabel = input<string | null>();\n\n private readonly resolvedAriaLabel = hostAriaLabel(\n () => resolveTextInput(this.ariaLabel(), this.#defaults.toggleAriaLabel) || null,\n );\n\n constructor() {\n registerHandle(\n inject<ElementRef<HTMLElement>>(ElementRef).nativeElement,\n (el) => this.ctx.registerFieldButton(el),\n (el) => this.ctx.unregisterFieldButton(el),\n );\n reflectDisabled(this.ctx.effectiveDisabled);\n preventPointerFocus();\n }\n\n private onClick(): void {\n if (this.ctx.effectiveDisabled()) {\n return;\n }\n if (this.ctx.open()) {\n this.ctx.closeOverlay('programmatic');\n return;\n }\n this.ctx.openOverlay('selected');\n this.ctx.input()?.focus();\n }\n}\n","import { computed, Directive, DOCUMENT, effect, ElementRef, inject } from '@angular/core';\n\nimport {\n foldTypeaheadText,\n injectNativeFormReset,\n isImeComposing,\n registerHandle,\n reflectDisabled,\n resolveActiveElement,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * The combobox `<input role=\"combobox\">`. Owns the visible text and all\n * keyboard interaction. Apply on a real `<input>` so the browser's native\n * caret / selection semantics drive inline-autocomplete and so the form\n * still behaves like a text field for screen readers.\n *\n * Wires `aria-haspopup=\"listbox\"`, `aria-expanded`, `aria-controls`,\n * `aria-autocomplete`, and `aria-activedescendant` (per APG combobox).\n * Focus stays on the input — arrow keys move the listbox's *active\n * descendant* via id reference, never moving DOM focus into the listbox.\n *\n * Keyboard:\n * - **ArrowDown / ArrowUp** — open + move activedescendant.\n * - **Home / End** (when open) — first / last enabled option. When closed they\n * move the caret, accepting a pending inline completion.\n * - **ArrowLeft / ArrowRight** — move the caret, accepting a pending inline\n * completion.\n * - **PageUp / PageDown** (when open) — first / last enabled option.\n * - **Enter** (when open) — activate the activedescendant. When no option is\n * activated, accept a pending inline completion.\n * - **Escape** (when open) — close (focus stays in input). On the\n * open→closed transition the input value is re-synced to `query()` even\n * while focused, so a consumer restoring the committed label from an\n * `(openChange)` handler renders without reaching for the DOM.\n * - **Tab** (when open) — with a pinned `[forComboboxAction]` registered, move\n * focus into the actions ring instead of closing (model A: focus cycles among\n * the input and the actions, popup stays open, Escape / outside-pointer\n * dismiss). With no action, close and let Tab flow to the next focusable — in\n * the picker anatomy (input inside the body-portaled panel) focus is moved to\n * the trigger first, so Tab advances from the trigger's position rather than\n * the end of the document.\n * - Printable keys: update `query` and (if `autocompleteMode` includes `'inline'`)\n * complete the rest of the first match in the input as selected text. The\n * completion stays out of `query` until it is accepted: by Tab, by Enter\n * when no option is activated, by a caret move that keeps the completed text\n * (ArrowLeft / ArrowRight, and Home / End while closed), by a click in the\n * input, or by blur. Typing replaces it, Backspace removes it, and Escape on\n * an open listbox restores the typed prefix.\n * - During IME composition every keydown is ignored, so the composition-confirm\n * Enter, the candidate-navigation arrows and the cancelling Escape reach the\n * IME instead of activating an option, moving the activedescendant or closing\n * the popup.\n */\n@Directive({\n selector: '[forComboboxInput]',\n exportAs: 'forComboboxInput',\n host: {\n type: 'text',\n role: 'combobox',\n autocomplete: 'off',\n autocorrect: 'off',\n spellcheck: 'false',\n '[id]': 'ctx.inputId()',\n '[attr.aria-haspopup]': '\"listbox\"',\n '[attr.aria-expanded]': 'ctx.open() ? \"true\" : \"false\"',\n '[attr.aria-controls]': 'ctx.open() ? ctx.listboxId() : null',\n '[attr.aria-autocomplete]': 'ariaAutocomplete()',\n '[attr.aria-activedescendant]': 'ctx.open() ? (ctx.activeId() ?? null) : null',\n '[attr.aria-readonly]': 'ctx.readonly() ? \"true\" : null',\n '[attr.aria-required]': 'ctx.required() ? \"true\" : null',\n '[attr.aria-invalid]': 'ctx.invalid() ? \"true\" : null',\n '[attr.aria-busy]': 'ctx.pending() ? \"true\" : null',\n '[attr.readonly]': 'ctx.readonly() ? \"\" : null',\n '[attr.data-state]': 'ctx.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'ctx.effectiveDisabled() ? \"\" : null',\n '(input)': 'onInput($event)',\n '(compositionstart)': 'onCompositionStart()',\n '(compositionend)': 'onCompositionEnd()',\n '(keydown)': 'onKeyDown($event)',\n '(focus)': 'onFocus()',\n '(blur)': 'onBlur()',\n '(click)': 'onClick()',\n },\n})\nexport class ForComboboxInput {\n // The input doesn't introspect the value type — it reads/writes the\n // query string and reads cached labels for inline autocomplete.\n private readonly ctx = injectComboboxContext<unknown>('ForComboboxInput');\n readonly #host = inject<ElementRef<HTMLInputElement>>(ElementRef);\n\n #composing = false;\n #completion: { readonly prefix: string; readonly label: string } | null = null;\n\n private readonly ariaAutocomplete = computed(() => this.ctx.autocompleteMode());\n\n constructor() {\n registerHandle(\n this.#host.nativeElement,\n (el) => this.ctx.registerInput(el),\n (el) => this.ctx.unregisterInput(el),\n );\n reflectDisabled(this.ctx.effectiveDisabled);\n injectNativeFormReset(() => this.#host.nativeElement);\n\n const doc = inject(DOCUMENT);\n\n // Sync DOM input.value to query() when the input doesn't currently have\n // focus (e.g. consumer set [(query)] programmatically, or option\n // activation copied the label into query via commitOnSelect). When the\n // input is focused the user is mid-edit; clobbering input.value would\n // jump the caret and break inline autocomplete state.\n //\n // The open→closed transition is the documented exception: the edit\n // session is over (Escape closes but keeps focus in the input, per APG),\n // so a consumer restoring the committed label — `query.set(label)` from an\n // `(openChange)` handler — must reach the DOM even while focused. The\n // caret-protection rationale no longer applies and a caret jump to the end\n // of the restored text is the expected outcome. `wasOpen` tracks the prior\n // open state to detect the edge; it's a plain transition latch, not derived\n // signal state.\n let wasOpen = this.ctx.open();\n effect(() => {\n const q = this.ctx.query();\n const closing = wasOpen && !this.ctx.open();\n wasOpen = this.ctx.open();\n\n const el = this.#host.nativeElement;\n if (el.value === q) {\n return;\n }\n if (resolveActiveElement(doc) !== el || closing) {\n el.value = q;\n }\n });\n }\n\n private onCompositionStart(): void {\n this.#composing = true;\n }\n\n private onCompositionEnd(): void {\n this.#composing = false;\n if (this.ctx.effectiveDisabled() || this.ctx.readonly()) {\n return;\n }\n this.#syncQuery(true, false);\n }\n\n private onInput(event: Event): void {\n if (this.ctx.effectiveDisabled() || this.ctx.readonly()) {\n return;\n }\n if (this.#composing) {\n return;\n }\n const inputEvent = event as InputEvent;\n const allowInline = !inputEvent.isComposing;\n const isDelete = (inputEvent.inputType ?? '').startsWith('delete');\n this.#syncQuery(allowInline, isDelete);\n }\n\n #syncQuery(allowInline: boolean, isDelete: boolean): void {\n const el = this.#host.nativeElement;\n this.#completion = null;\n\n // The \"user prefix\" is everything before the caret. After inline\n // autocomplete sets a selection on chars [prefixLen..end], typing replaces\n // the selection (caret lands right after the new char) so this still\n // captures the user's intent. On Backspace, the browser deletes the\n // selection without touching the prefix — re-completing here would mean\n // the user can never shorten the query, so we skip completion on delete.\n const caret = el.selectionStart ?? el.value.length;\n const prefix = el.value.slice(0, caret);\n\n const atEnd = caret === el.value.length;\n const mode = this.ctx.autocompleteMode();\n const inlineActive =\n allowInline &&\n !isDelete &&\n atEnd &&\n (mode === 'inline' || mode === 'both') &&\n prefix.length > 0;\n\n if (inlineActive) {\n this.ctx.setQueryFromInput(prefix);\n this.#applyInlineCompletion(prefix);\n } else {\n this.ctx.setQueryFromInput(el.value);\n }\n }\n\n #applyInlineCompletion(prefix: string): void {\n const folded = foldTypeaheadText(prefix);\n const label = this.#inlineCompletionLabel(folded);\n const el = this.#host.nativeElement;\n if (label === null || foldTypeaheadText(label) === folded) {\n // No completion to apply — strip any prior selection so the user's\n // prefix is plainly visible.\n if (el.value !== prefix) {\n el.value = prefix;\n }\n return;\n }\n // Use the option's full label as the visible text (preserving its case),\n // with chars [prefixLen..end] selected so the next keystroke replaces\n // the appended suggestion. Matches native browser autocomplete behavior.\n el.value = label;\n el.setSelectionRange(prefix.length, label.length);\n this.#completion = { prefix, label };\n }\n\n #acceptCompletion(): void {\n const completion = this.#completion;\n this.#completion = null;\n if (\n completion === null ||\n this.#host.nativeElement.value !== completion.label ||\n this.ctx.query() !== completion.prefix\n ) {\n return;\n }\n this.ctx.acceptQueryFromInput(completion.label);\n }\n\n #inlineCompletionLabel(folded: string): string | null {\n const options = this.ctx.options();\n if (options.length > 0) {\n const activeId = this.ctx.activeId();\n if (activeId !== null) {\n const active = options.find((o) => o.id() === activeId);\n if (active && !active.disabled() && foldTypeaheadText(active.label()).startsWith(folded)) {\n return active.label();\n }\n }\n for (const option of options) {\n if (!option.disabled() && foldTypeaheadText(option.label()).startsWith(folded)) {\n return option.label();\n }\n }\n if (this.ctx.totalCount() === undefined) {\n return null;\n }\n }\n const match = this.ctx\n .completionEntries()\n .find((o) => !o.disabled && foldTypeaheadText(o.label).startsWith(folded));\n return match ? match.label : null;\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (isImeComposing(event)) {\n return;\n }\n\n if (this.ctx.effectiveDisabled()) {\n return;\n }\n\n // Multi-mode Backspace heuristic: an empty input sends focus to the\n // last chip so a second Backspace there removes it. Skip when there's a\n // non-empty selection in the input (the user's mid-edit) — Backspace falls\n // through to the native delete-char handler.\n if (\n event.key === 'Backspace' &&\n this.ctx.multiple() &&\n this.#host.nativeElement.value === '' &&\n !this.ctx.readonly() &&\n !this.ctx.effectiveDisabled()\n ) {\n const chips = this.ctx.chips();\n const last = chips[chips.length - 1];\n if (last) {\n event.preventDefault();\n last.host.focus();\n return;\n }\n }\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (!this.ctx.open()) {\n // Open with the natural extreme as the auto-highlight bias —\n // navigate('next') won't fire here because items aren't registered\n // yet; the root's `activeId` linkedSignal seeds the activedescendant\n // once the options register.\n this.ctx.openFromExtreme('first');\n } else {\n this.ctx.navigate('next');\n }\n break;\n\n case 'ArrowUp':\n event.preventDefault();\n if (!this.ctx.open()) {\n this.ctx.openFromExtreme('last');\n } else {\n this.ctx.navigate('prev');\n }\n break;\n\n case 'Home':\n if (this.ctx.open()) {\n event.preventDefault();\n this.ctx.navigate('first');\n } else {\n this.#acceptCompletion();\n }\n break;\n\n case 'End':\n if (this.ctx.open()) {\n event.preventDefault();\n this.ctx.navigate('last');\n } else {\n this.#acceptCompletion();\n }\n break;\n\n case 'ArrowLeft':\n case 'ArrowRight':\n this.#acceptCompletion();\n break;\n\n case 'PageUp':\n if (this.ctx.open()) {\n event.preventDefault();\n this.ctx.navigate('first');\n }\n break;\n\n case 'PageDown':\n if (this.ctx.open()) {\n event.preventDefault();\n this.ctx.navigate('last');\n }\n break;\n\n case 'Enter':\n if (this.ctx.open() && this.ctx.activateActive()) {\n event.preventDefault();\n } else {\n this.#acceptCompletion();\n }\n break;\n\n case 'Escape':\n // Routed through emitEscapeKeyDown so the consumer's\n // (escapeKeyDown) output fires and can veto the close. We still\n // handle Escape inline (not via the dismissible layer) because\n // focus stays in the input — the Escape belongs to this input\n // and shouldn't bubble through nested layers before it sees it.\n if (this.ctx.open()) {\n event.preventDefault();\n event.stopPropagation();\n this.ctx.emitEscapeKeyDown(event);\n }\n break;\n\n case 'Tab':\n this.#acceptCompletion();\n if (this.ctx.open()) {\n if (this.ctx.hasEnabledActions()) {\n event.preventDefault();\n this.ctx.moveActionFocus(null, event.shiftKey ? 'prev' : 'next');\n } else {\n this.ctx.trigger()?.focus();\n this.ctx.closeOverlay('tab');\n }\n }\n break;\n }\n }\n\n private onFocus(): void {\n if (this.ctx.openOnFocus() && !this.ctx.open()) {\n this.ctx.openOverlay();\n }\n }\n\n private onBlur(): void {\n if (!this.#composing) {\n this.#acceptCompletion();\n }\n }\n\n private onClick(): void {\n this.#acceptCompletion();\n // A click on the input while focused mirrors the focus-open intent —\n // useful when the user closed via Escape and wants to re-open without\n // typing or reaching for the keyboard.\n if (this.ctx.openOnFocus() && !this.ctx.open()) {\n this.ctx.openOverlay();\n }\n }\n}\n","import { computed, Directive, ElementRef, inject } from '@angular/core';\n\nimport {\n composedContains,\n registerHandle,\n hostAriaLabel,\n hostLabelledBy,\n injectFieldLabelExemption,\n pressFocusesDescendant,\n preventPointerFocus,\n resolveActiveElement,\n FOR_FIELD_ANCHOR_CONTEXT,\n FOR_FIELD_CONTEXT,\n} from 'forty-cdk/core';\nimport { warnIfMountedWhileClosed } from 'forty-cdk/core-overlay';\nimport {\n floatingPositioner,\n injectOverlayShell,\n type OverlayShellConfig,\n} from 'forty-cdk/core-anchored';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * The floating surface, portaled to `document.body` and positioned by\n * `@floating-ui/dom` against the anchor (explicit `[forComboboxAnchor]` →\n * `[forComboboxTrigger]` → input).\n *\n * Two anatomies. The **role split** is picked by whether an inner\n * `[forComboboxList]` is present:\n *\n * - **Editable (no list)** — content itself carries `role=\"listbox\"`,\n * `tabindex=\"-1\"`, `aria-multiselectable`, and the labelled role\n * (`aria-label` / `aria-labelledby`). The input's `aria-controls` points here.\n * - **Picker (list present)** — content drops the listbox semantics;\n * `[forComboboxList]` takes over the listbox role and owns the options, the\n * input lives inside the panel, and the input's `aria-controls` points to the\n * list. With a `[forComboboxTrigger]` registered the content is the\n * `role=\"dialog\"` the trigger's `aria-haspopup=\"dialog\"` announces, named by\n * the trigger through `aria-labelledby` (a static `aria-label` or\n * `aria-labelledby` on the host wins); without one it is a neutral surface.\n * `data-state`, positioning and dismissal behave identically in both.\n *\n * Mount/unmount of the visible content is the consumer's responsibility —\n * wrap with `@if (open())` so `animate.enter` / `animate.leave` fire on the\n * natural mount cycle. While mounted, the surface dismisses on pointer-down\n * outside / focus outside; the input, any `[forComboboxToggle]` or\n * `[forComboboxClear]` and (picker anatomy) the trigger are exempt from outside\n * checks.\n *\n * Focus:\n * - **Editable anatomy (no trigger)** — focus stays in the input across the\n * whole open lifecycle and active-option highlighting is\n * `aria-activedescendant`-driven, so the directive exposes no focus hooks. A\n * mouse press anywhere on the surface that lands on no focusable element of its\n * own (padding, a group label, an empty or status row) is cancelled, so it\n * neither focuses the surface nor blurs the input; text in the popup cannot be\n * selected with the mouse as a result. A press on an action still focuses it,\n * and a press on a consumer control takes focus wherever the browser puts it.\n * If focus reaches the surface programmatically, a fallback Escape channel\n * still closes the popup and returns focus to the input. A close that\n * unmounts the surface while focus is inside it (an `(activate)` handler that\n * closes the popup, a pick made while an action holds focus) also returns\n * focus to the input, gated by `[returnFocus]`; a close after focus already\n * left the surface moves nothing.\n * - **Picker anatomy (trigger present)** — on open, focus moves into the input\n * (the search field inside the panel); on close it returns to the trigger.\n * Both moves are vetoable via `(autoFocusOnOpen)` / `(autoFocusOnClose)` on\n * `[forCombobox]`, and the return is gated by `[returnFocus]`. The same press\n * rule applies to the surface and to `[forComboboxList]`, so focus stays on\n * the search input. Escape from the input is owned by the input directive; the\n * shell's fallback channel covers focus that reaches the surface or list\n * programmatically.\n *\n * The two splits are keyed independently — roles off the presence of a list,\n * focus off the presence of a trigger — and the trigger is re-checked at each\n * decision point, so one declared after this content, projected through\n * `<ng-content>`, or gated by a `@defer` still upgrades the surface. Initial\n * focus stays a mount-time decision: a trigger that arrives while the surface is\n * already open does not pull focus out of wherever the user left it, but it does\n * take over the return focus, `(autoFocusOnClose)` and the Escape fallback from\n * there on.\n *\n * A field boundary: a control inside it never registers with an ancestor\n * `[forField]`, and a `[forField]` inside it still wires its own control.\n */\n@Directive({\n selector: '[forComboboxContent]',\n exportAs: 'forComboboxContent',\n host: {\n '[attr.role]': 'role()',\n '[attr.tabindex]': 'hasList() ? null : \"-1\"',\n '[id]': 'ctx.contentId()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.aria-multiselectable]': 'hasList() ? null : (ctx.multiple() ? \"true\" : null)',\n '[attr.data-state]': 'ctx.open() ? \"open\" : \"closed\"',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'onFocusOut($event)',\n },\n providers: [\n { provide: FOR_FIELD_CONTEXT, useValue: null },\n { provide: FOR_FIELD_ANCHOR_CONTEXT, useValue: null },\n ],\n})\nexport class ForComboboxContent {\n private readonly ctx = injectComboboxContext('ForComboboxContent');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n #focusWithin = false;\n\n /** When a `[forComboboxList]` is registered the listbox semantics live there, not here. */\n private readonly hasList = this.ctx.hasList;\n\n readonly #isDialog = computed(() => this.hasList() && this.ctx.triggerId() !== null);\n\n private readonly role = computed(() =>\n this.#isDialog() ? 'dialog' : this.hasList() ? null : 'listbox',\n );\n\n private readonly resolvedAriaLabel = hostAriaLabel(() =>\n this.hasList() ? null : this.ctx.ariaLabel(),\n );\n\n private readonly labelledBy = hostLabelledBy(() => {\n if (this.resolvedAriaLabel()) {\n return null;\n }\n if (this.#isDialog()) {\n return this.ctx.triggerId();\n }\n return this.hasList() ? null : this.ctx.inputId();\n });\n\n constructor() {\n const ctx = this.ctx;\n const host = this.#host.nativeElement;\n registerHandle(\n host,\n (el) => ctx.registerContent(el),\n (el) => ctx.unregisterContent(el),\n );\n preventPointerFocus((event) => !pressFocusesDescendant(event, host));\n\n warnIfMountedWhileClosed({\n primitive: 'combobox',\n piece: '[forComboboxContent]',\n condition: 'combobox.open()',\n open: ctx.open,\n });\n\n // Both focus bundles are always handed to the shell; the anatomy gates them\n // from inside their own callbacks, which the shell runs after construction\n // (`initialFocus` in `afterNextRender`, `returnFocus` on destroy). So the\n // gate reads a fresh `trigger()` at each decision point instead of a\n // construction-time snapshot, and the editable anatomy still fires neither\n // hook.\n const hasTrigger = computed(() => ctx.trigger() !== null);\n\n const config: OverlayShellConfig = {\n positioner: floatingPositioner({\n reference: ctx.anchor,\n open: ctx.open,\n side: ctx.side,\n align: ctx.align,\n sideOffset: ctx.sideOffset,\n alignOffset: ctx.alignOffset,\n avoidCollisions: ctx.avoidCollisions,\n collisionPadding: ctx.collisionPadding,\n sticky: ctx.sticky,\n hideWhenDetached: ctx.hideWhenDetached,\n clipUntilPositioned: ctx.clipUntilPositioned,\n onFirstPosition: () => ctx.scrollActiveOptionIntoView(),\n }),\n dismiss: {\n dismissible: ctx.dismissible,\n requestClose: (reason) => ctx.requestClose(reason),\n emitEscapeKeyDown: (event) => {\n ctx.emitEscapeKeyDown(event);\n if (!hasTrigger() && !ctx.open()) {\n ctx.input()?.focus();\n }\n },\n emitPointerDownOutside: (veto) => ctx.emitPointerDownOutside(veto),\n emitFocusOutside: (veto) => ctx.emitFocusOutside(veto),\n emitInteractOutside: (veto) => ctx.emitInteractOutside(veto),\n // The input owns the visible focus and toggles via its own click /\n // focus handlers; the trigger (picker anatomy) toggles via its own\n // click handler, and a toggle or clear button acts on its own press.\n // Without exemption a pointer-down on any of them would race the\n // dismissal layer.\n exemptElements: injectFieldLabelExemption(() => {\n const els: Element[] = [];\n const input = ctx.input();\n if (input) els.push(input);\n const trigger = ctx.trigger();\n if (trigger) els.push(trigger);\n for (const chip of ctx.chips()) els.push(chip.host);\n els.push(...ctx.fieldButtons());\n return els;\n }),\n },\n // Picker anatomy: move focus into the input on open, return it to the\n // trigger on close. The editable anatomy moves focus only back to the\n // input, when a close unmounts the surface while it holds focus, and emits\n // neither hook.\n initialFocus: {\n move: () => {\n const input = ctx.input();\n if (input) {\n input.focus();\n return true;\n }\n return false;\n },\n veto: () => !hasTrigger() || ctx.emitAutoFocusOnOpen(),\n },\n returnFocus: {\n enabled: ctx.returnFocus,\n target: () => ctx.trigger() ?? ctx.input(),\n veto: () => hasTrigger() && ctx.emitAutoFocusOnClose(),\n // On Tab focus already landed where the user tabbed; re-focusing the\n // trigger would steal it back.\n skip: () => {\n if (!hasTrigger()) {\n return !this.#focusLeftWithSurface();\n }\n return ctx.lastCloseReason() === 'tab';\n },\n },\n };\n\n injectOverlayShell(config);\n }\n\n private onFocusIn(): void {\n this.#focusWithin = true;\n }\n\n private onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget;\n if (next instanceof Node && !composedContains(this.#host.nativeElement, next)) {\n this.#focusWithin = false;\n }\n }\n\n #focusLeftWithSurface(): boolean {\n if (!this.#focusWithin) {\n return false;\n }\n const host = this.#host.nativeElement;\n const doc = host.ownerDocument;\n const active = resolveActiveElement(doc);\n return active === null || active === doc.body || composedContains(host, active);\n }\n}\n","import { Directive, ElementRef, inject } from '@angular/core';\n\nimport {\n registerHandle,\n hostAriaLabel,\n hostLabelledBy,\n pressFocusesDescendant,\n preventPointerFocus,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * The `role=\"listbox\"` element of the picker anatomy. Nest it inside\n * `[forComboboxContent]` next to `[forComboboxInput]` so the popup surface can\n * hold a search field without violating `aria-required-owned-elements` (a\n * `listbox` may only own `option` / `group` children). The list owns the\n * options; `[forComboboxContent]` becomes the `role=\"dialog\"` a\n * `[forComboboxTrigger]` opens, or a neutral surface without one.\n *\n * ```html\n * <div forComboboxContent>\n * <input forComboboxInput />\n * <div forComboboxList>\n * @for (item of filtered(); track item.id) {\n * <div forComboboxOption [value]=\"item\">{{ item.label }}</div>\n * }\n * </div>\n * </div>\n * ```\n *\n * Carries `role=\"listbox\"`, `tabindex=\"-1\"` (focus stays in the input,\n * activedescendant-driven; a mouse press on the list that lands on no focusable\n * element of its own is cancelled so it never takes focus from the input),\n * `aria-multiselectable` in multi mode, and the labelled-role `aria-label` /\n * `aria-labelledby`. Its id is what the input's\n * `aria-controls` references in the picker anatomy.\n *\n * When no `[forComboboxList]` is present, `[forComboboxContent]` itself carries\n * the listbox semantics (the editable anatomy) — this part is additive and\n * non-breaking.\n */\n@Directive({\n selector: '[forComboboxList]',\n exportAs: 'forComboboxList',\n host: {\n role: 'listbox',\n tabindex: '-1',\n '[id]': 'ctx.listId()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.aria-multiselectable]': 'ctx.multiple() ? \"true\" : null',\n },\n})\nexport class ForComboboxList {\n private readonly ctx = injectComboboxContext('ForComboboxList');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n private readonly resolvedAriaLabel = hostAriaLabel(() => this.ctx.ariaLabel());\n\n private readonly labelledBy = hostLabelledBy(() =>\n this.resolvedAriaLabel() ? null : this.ctx.inputId(),\n );\n\n constructor() {\n const host = this.#host.nativeElement;\n registerHandle(\n host,\n (el) => this.ctx.registerList(el),\n (el) => this.ctx.unregisterList(el),\n );\n preventPointerFocus((event) => !pressFocusesDescendant(event, host));\n }\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n InjectionToken,\n input,\n type InputSignal,\n} from '@angular/core';\n\nimport {\n accessibleTextContent,\n assertInputBound,\n isUnset,\n registerHandle,\n hostId,\n injectPointerMove,\n preventPointerFocus,\n unsetInput,\n type Unset,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * Injection key the `[forComboboxIndicator]` uses to resolve its parent\n * option, decoupled from the concrete `ForComboboxOption` class.\n * `ForComboboxOption` provides itself under this token, so a design system\n * wrapping the option by subclassing re-points it at the subclass with a\n * single provider (`{ provide: FOR_COMBOBOX_OPTION, useExisting: MyComboboxOption }`)\n * and the indicator keeps resolving — see `docs/wrapping-form-primitives.md`.\n */\nexport const FOR_COMBOBOX_OPTION = new InjectionToken<ForComboboxOption>('FOR_COMBOBOX_OPTION');\n\n/**\n * One option inside a `[forComboboxContent]`. Apply on whatever element\n * fits the design — typically a `<div>` or `<li>`. Click activates:\n * single mode replaces `[(value)]` and closes the listbox; multi mode\n * toggles the value in/out and keeps the listbox open.\n *\n * Generic over the option value type `T` (default `string`). Inferred from\n * the `[value]` binding so consumers can pass either primitive ids or\n * full objects (`[value]=\"city\"` infers `T = City`); the parent\n * `[forCombobox]` must be parameterized over the same `T`.\n *\n * `aria-selected` reflects different things in single vs. multi:\n * - **Single mode**: the option that's the current activedescendant\n * (Enter would activate it). Matches APG select-only-combobox.\n * - **Multi mode**: every option currently in `value()` carries\n * `aria-selected=\"true\"` (multiple \"selected\" entries simultaneously).\n * Matches APG multi-select combobox.\n *\n * `data-state=\"checked\" | \"unchecked\"` always reflects membership in\n * `value()` regardless of mode, so consumers can paint a checkmark with\n * pure CSS in either mode. `data-highlighted` marks the option that is\n * the current activedescendant — shared across the\n * library's roving / activedescendant primitives.\n *\n * Hovering an option also makes it the activedescendant, mirroring native\n * menu / select behavior so mouse and keyboard intent stay synchronized.\n * Pressing one never moves DOM focus: the input keeps the keyboard, so typing\n * and arrow keys carry on after a click.\n */\n@Directive({\n selector: '[forComboboxOption]',\n exportAs: 'forComboboxOption',\n providers: [{ provide: FOR_COMBOBOX_OPTION, useExisting: ForComboboxOption }],\n host: {\n role: 'option',\n '[id]': 'id()',\n '[attr.aria-selected]': 'ariaSelected()',\n '[attr.aria-disabled]': 'effectiveDisabled() ? \"true\" : null',\n '[attr.aria-posinset]': 'ariaPosInSet()',\n '[attr.aria-setsize]': 'ariaSetSize()',\n '[attr.data-state]': 'selected() ? \"checked\" : \"unchecked\"',\n '[attr.data-highlighted]': 'highlighted() ? \"\" : null',\n '[attr.data-disabled]': 'effectiveDisabled() ? \"\" : null',\n '(click)': 'onClick()',\n },\n})\nexport class ForComboboxOption<T = string> {\n readonly #ctx = injectComboboxContext<T>('ForComboboxOption');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Stable identifier serialized into `[(value)]` and the hidden input.\n * Defaults to `string` for back-compat; bind an object to specialize\n * the parent `[forCombobox]` over a richer `T`. The parent's\n * `[compareWith]` decides how options are matched against the\n * committed selection.\n *\n * Mandatory — an unbound option throws in dev mode.\n */\n readonly value: InputSignal<T | Unset> = input(unsetInput<T>());\n\n /**\n * Visible label used by `[forComboboxInput]` for inline autocomplete\n * matching, by `commitOnSelect` to populate the input on selection,\n * and by typeahead / display utilities. When omitted: for string\n * `value` falls back to the trimmed `textContent` of the host element;\n * for object `value` falls back to the parent's `itemToStringLabel(value)`.\n */\n readonly label = input<string | null>(null);\n\n /**\n * Whether the option can be activated. A disabled option stays rendered and announced, and is\n * skipped by arrow navigation and typeahead.\n */\n readonly disabled = input(false, { transform: booleanAttribute });\n\n /**\n * Absolute index of this option in the consumer's source array. Required\n * when wiring up a virtualized listbox so navigation past the rendered\n * window can resolve indices to options (and emit `(scrollToIndex)` when\n * needed). Leave `null` for non-virtualized lists — the directive then\n * falls back to DOM order.\n */\n readonly posInSet = input<number | null>(null);\n\n readonly id = hostId('for-combobox-option');\n\n readonly selected = computed(() => {\n const value = this.value();\n return isUnset(value) ? false : this.#ctx.isSelected(value);\n });\n /** True when this option is the current activedescendant. Reflected as `data-highlighted`. */\n readonly highlighted = computed(() => this.#ctx.isActive(this.id()));\n readonly effectiveDisabled = computed(() => this.disabled() || this.#ctx.effectiveDisabled());\n\n private readonly ariaSelected = computed(() => {\n if (this.#ctx.multiple()) {\n return this.selected() ? 'true' : 'false';\n }\n return this.highlighted() ? 'true' : 'false';\n });\n\n /** Reflects `aria-posinset` (1-based) in the virtualized path; `null` otherwise. */\n private readonly ariaPosInSet = computed<string | null>(() => {\n if (this.#ctx.totalCount() === undefined) {\n return null;\n }\n const pos = this.posInSet();\n return pos === null ? null : String(pos + 1);\n });\n\n /** Reflects `aria-setsize` when the consumer wires up `[totalCount]`. */\n private readonly ariaSetSize = computed<string | null>(() => {\n const total = this.#ctx.totalCount();\n return total === undefined ? null : String(total);\n });\n\n readonly #effectiveLabel = computed(() => {\n const explicit = this.label();\n if (explicit !== null) {\n return explicit;\n }\n const v = this.value();\n if (isUnset(v)) {\n return '';\n }\n if (typeof v === 'string') {\n // String mode: the trimmed `textContent` is the canonical fallback,\n // identical to the pre-generic behaviour. Lets consumers omit\n // `[label]` and have it just work for projected text.\n return accessibleTextContent(this.#host.nativeElement).trim();\n }\n // Object mode: lean on the parent's `itemToStringLabel` so the\n // resolved label is consistent with chip rendering and `commitOnSelect`.\n return this.#ctx.itemToStringLabel()(v);\n });\n\n readonly #handle = {\n host: this.#host.nativeElement,\n id: this.id,\n value: this.value,\n label: this.#effectiveLabel,\n disabled: this.effectiveDisabled,\n posInSet: this.posInSet,\n };\n\n constructor() {\n assertInputBound(this.value, 'combobox', '[forComboboxOption]', 'value');\n registerHandle(\n this.#handle,\n (h) => this.#ctx.registerOption(h),\n (h) => this.#ctx.unregisterOption(h),\n );\n preventPointerFocus();\n injectPointerMove(() => this.onPointerMove());\n }\n\n private onClick(): void {\n if (this.effectiveDisabled() || this.#ctx.readonly()) {\n return;\n }\n this.#ctx.activate(this.#handle);\n }\n\n private onPointerMove(): void {\n if (this.effectiveDisabled()) {\n return;\n }\n this.#ctx.highlightFromPointer(this.#host.nativeElement, this.id());\n }\n}\n","import { Directive, inject } from '@angular/core';\n\nimport { orphanContextError } from 'forty-cdk/core';\n\nimport { FOR_COMBOBOX_OPTION, type ForComboboxOption } from './combobox-option';\n\n/**\n * Visibility helper inside a `[forComboboxOption]`. The directive flips a\n * `[hidden]` host binding so the consumer can keep the checkmark / icon\n * inline without extra `@if` glue:\n *\n * ```html\n * <div forComboboxOption value=\"apple\">\n * <span forComboboxIndicator>✓</span>\n * Apple\n * </div>\n * ```\n *\n * Reflects the parent option's `data-state` (`\"checked\" | \"unchecked\"`) so\n * the consumer can also style it from CSS. Visibility while unselected is\n * enforced with an inline `display: none` (which beats any author `display`\n * rule a consumer applies via a class) in addition to the `hidden` attribute\n * that removes it from the a11y tree.\n *\n * In multi mode the indicator follows membership in `value()`, matching the\n * option's own `data-state` semantics (a checkmark per selected option).\n */\n@Directive({\n selector: '[forComboboxIndicator]',\n exportAs: 'forComboboxIndicator',\n host: {\n 'aria-hidden': 'true',\n '[attr.data-state]': 'option.selected() ? \"checked\" : \"unchecked\"',\n '[hidden]': '!option.selected()',\n '[style.display]': 'option.selected() ? null : \"none\"',\n },\n})\nexport class ForComboboxIndicator {\n private readonly option = injectParentOption();\n}\n\nfunction injectParentOption(): ForComboboxOption {\n const option = inject(FOR_COMBOBOX_OPTION, { optional: true });\n if (!option) {\n throw orphanContextError({\n code: 'FORCDK-COMBOBOX-006',\n piece: 'ForComboboxIndicator',\n root: '[forComboboxOption]',\n token: 'FOR_COMBOBOX_OPTION',\n });\n }\n return option;\n}\n","import { computed, Directive } from '@angular/core';\n\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * Empty-state slot, shown when the listbox has no results: no registered\n * options, or a root `[totalCount]` of `0` when virtualizing, so a virtualized\n * listbox whose window has not rendered yet does not flash the message.\n * The directive hides the message when options exist so the consumer can\n * keep it inline in the template — no `@if` needed. Visibility is enforced\n * with an inline `display: none` (which beats any author `display` rule a\n * consumer applies via a class) in addition to the `hidden` attribute that\n * removes it from the a11y tree.\n *\n * Place it inside `[forComboboxContent]` but **outside** the\n * `[forComboboxList]` that owns the options: content carries `role=\"listbox\"`\n * in the editable anatomy, so wrapping the options in a `[forComboboxList]`\n * keeps this `role=\"status\"` region a sibling of the listbox rather than an\n * invalid listbox child.\n *\n * ```html\n * <div forComboboxContent>\n * <div forComboboxList>\n * @for (option of filtered(); track option.id) {\n * <div forComboboxOption [value]=\"option.id\">{{ option.label }}</div>\n * }\n * </div>\n * <div forComboboxEmpty>No matches.</div>\n * </div>\n * ```\n *\n * Carries `role=\"status\"` as its **single** live-region channel, so screen\n * readers announce the message when it appears — the role implies\n * `aria-live=\"polite\"` and `aria-atomic=\"true\"`, so the message is read whole\n * and neither attribute is emitted beside it. The role rather than the\n * attribute pair because this host self-hides and comes back with its message\n * already in the DOM, which is an insertion into the accessibility tree, and a\n * live *role* is what screen readers read reliably on insertion.\n */\n@Directive({\n selector: '[forComboboxEmpty]',\n exportAs: 'forComboboxEmpty',\n host: {\n role: 'status',\n '[hidden]': '!shouldShow()',\n '[style.display]': 'shouldShow() ? null : \"none\"',\n },\n})\nexport class ForComboboxEmpty {\n readonly #ctx = injectComboboxContext('ForComboboxEmpty');\n private readonly shouldShow = computed(\n () => (this.#ctx.totalCount() ?? this.#ctx.options().length) === 0,\n );\n}\n","import {\n afterNextRender,\n booleanAttribute,\n Directive,\n ElementRef,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport {\n focusAfterPress,\n fortyError,\n hostButtonType,\n hostId,\n isImeComposing,\n registerHandle,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * A non-selecting **action** affordance pinned inside a `[forComboboxContent]`\n * (or beside `[forComboboxList]` in the picker anatomy) — \"Create new…\",\n * \"Manage tags…\", \"Clear all\", etc. Apply on a `<button>` (or any element);\n * the directive carries `role=\"button\"` so it reads and behaves as an action,\n * never as one of the listbox's options. On a native `<button>` host it also\n * forces `type=\"button\"` — through a host binding, so a consumer `type=\"submit\"`\n * is overridden and activating the action never submits a surrounding `<form>`;\n * any other host element gets no `type` attribute, which is not valid there.\n *\n * Unlike `[forComboboxOption]`, an action:\n *\n * - does **not** register with the option / value collection, so it never\n * appears in `value()`, `aria-setsize`, or `aria-posinset`;\n * - emits an `(activate)` output on activation (click / Enter / Space) and\n * **never** mutates `[(value)]`;\n * - is reached by keyboard through Tab, not the option arrow navigation — see\n * the focus model below.\n *\n * **Focus & keyboard (model A).** While the popup is open, Tab / Shift+Tab\n * cycle DOM focus around the ring `[input, ...enabled actions]` (in DOM order,\n * wrapping both ways) **without dismissing** the popup, so a pinned action is\n * reachable in a bounded number of keypresses regardless of how long the option\n * list is (or whether it is virtualized). Escape and outside-pointer still\n * dismiss; on Escape from an action, focus returns to the input (editable\n * anatomy) or the `[forComboboxTrigger]` (picker anatomy). Options stay\n * arrow-navigated via `aria-activedescendant` — the two models never mix.\n *\n * Because the action lives inside the portaled `[forComboboxContent]`, it is\n * naturally \"inside\" the outside-pointer / outside-focus dismissal checks, just\n * like the input.\n *\n * The action must be a sibling of the listbox, never a child of it: in the\n * editable anatomy `[forComboboxContent]` carries `role=\"listbox\"`, which may\n * only own `option` / `group` children, so the options are wrapped in a\n * `[forComboboxList]` and the action sits beside it under the (now role-less)\n * content.\n *\n * ```html\n * <div forComboboxContent>\n * <button forComboboxAction (activate)=\"createNew(query())\">\n * Create \"{{ query() }}\"\n * </button>\n * <div forComboboxList>\n * @for (item of filtered(); track item.id) {\n * <div forComboboxOption [value]=\"item\">{{ item.name }}</div>\n * }\n * </div>\n * </div>\n * ```\n */\n@Directive({\n selector: '[forComboboxAction]',\n exportAs: 'forComboboxAction',\n host: {\n role: 'button',\n '[attr.type]': 'buttonType()',\n '[id]': 'id()',\n tabindex: '-1',\n '[attr.aria-disabled]': 'disabled() ? \"true\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n '[attr.data-highlighted]': 'focused() ? \"\" : null',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n '(focus)': 'focused.set(true)',\n '(blur)': 'focused.set(false)',\n },\n})\nexport class ForComboboxAction {\n private readonly buttonType = hostButtonType();\n\n readonly #ctx = injectComboboxContext('ForComboboxAction');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Disable the action. A disabled action drops out of the focus ring (Tab and\n * Shift+Tab skip it, and it keeps `tabindex=\"-1\"` so the native Tab order\n * never reaches it either), reflects `aria-disabled=\"true\"` +\n * `data-disabled=\"\"`, and ignores activation.\n */\n readonly disabled = input(false, { transform: booleanAttribute });\n\n /**\n * Fired on click / Enter / Space. Purely a side-effect hook — it **never**\n * mutates `[(value)]`, so the form model and `options()` are untouched. The\n * consumer decides what happens (create an item, open a dialog, …) and whether\n * to close the popup afterwards. In the editable anatomy, closing it from here\n * returns focus to the input unless the handler already moved focus out of\n * the popup; the picker anatomy returns it to the `[forComboboxTrigger]` as on\n * any close.\n */\n readonly activate = output<void>();\n\n /** Stable id for the host, used as the ring key. Adopts a consumer-set static `id`. */\n readonly id = hostId('for-combobox-action');\n\n /** True while the action holds DOM focus — reflected as `data-highlighted`. */\n private readonly focused = signal(false);\n\n readonly #handle = {\n host: this.#host.nativeElement,\n id: this.id,\n disabled: this.disabled,\n };\n\n constructor() {\n registerHandle(\n this.#handle,\n (h) => this.#ctx.registerAction(h),\n (h) => this.#ctx.unregisterAction(h),\n );\n\n afterNextRender(() => {\n if (!this.#ctx.hasList()) {\n throw fortyError({\n code: 'FORCDK-COMBOBOX-001',\n message:\n '[forComboboxAction] must sit inside a [forComboboxContent] that also contains a ' +\n '[forComboboxList].',\n cause:\n 'In the editable anatomy [forComboboxContent] carries role=\"listbox\", so a ' +\n 'role=\"button\" action placed directly inside it is an invalid listbox child ' +\n '(aria-required-owned).',\n fix: 'Wrap the options in a <div forComboboxList> so the action becomes a sibling of the listbox.',\n });\n }\n });\n }\n\n private onClick(): void {\n if (this.#isInert()) {\n return;\n }\n focusAfterPress(this.#host.nativeElement);\n this.activate.emit();\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n switch (event.key) {\n case 'Enter':\n case ' ':\n if (this.disabled()) {\n return;\n }\n event.preventDefault();\n if (!this.#isInert()) {\n this.activate.emit();\n }\n break;\n\n case 'Tab':\n if (!this.#ctx.open()) {\n return;\n }\n event.preventDefault();\n this.#ctx.moveActionFocus(this.id(), event.shiftKey ? 'prev' : 'next');\n break;\n\n case 'Escape':\n if (this.disabled() || isImeComposing(event)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.#ctx.emitEscapeKeyDown(event);\n if (!this.#ctx.open() && this.#ctx.trigger() === null) {\n this.#ctx.input()?.focus();\n }\n break;\n }\n }\n\n #isInert(): boolean {\n return this.disabled() || this.#ctx.effectiveDisabled();\n }\n}\n","import { computed, Directive } from '@angular/core';\n\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * Live-region slot for async-filtering feedback (loading, result count,\n * \"no matches\", error messages). Apply on a `<div>` inside the listbox or\n * next to the input. The directive sets `role=\"status\"` so messages projected\n * as content are announced to screen readers when they change.\n *\n * The role is the piece's **single** live-region channel — it already implies `aria-live=\"polite\"`\n * and `aria-atomic=\"true\"`, so neither attribute is emitted beside it.\n *\n * The directive is **content-driven** and picks no message of its own. Project whatever the\n * consumer wants and use the exposed `count` signal to interpolate the option count when relevant.\n *\n * Place it inside `[forComboboxContent]` but **outside** the `[forComboboxList]` that owns the\n * options: content carries `role=\"listbox\"` in the editable anatomy, so wrapping the options in a\n * list keeps this `role=\"status\"` region a sibling of the listbox rather than an invalid child.\n *\n * ```html\n * <div forCombobox [(query)]=\"query\" [(value)]=\"value\" [(open)]=\"open\">\n * <input forComboboxInput placeholder=\"Search…\" />\n * @if (open()) {\n * <div forComboboxContent>\n * <div forComboboxStatus #status=\"forComboboxStatus\">\n * @if (loading()) {\n * Searching…\n * } @else if (status.count() === 0) {\n * No matches.\n * } @else {\n * {{ status.count() }} results.\n * }\n * </div>\n * <div forComboboxList>\n * @for (it of filtered(); track it.id) {\n * <div forComboboxOption [value]=\"it.id\">{{ it.label }}</div>\n * }\n * </div>\n * </div>\n * }\n * </div>\n * ```\n *\n * For an empty-only slot that auto-hides when there are options, use\n * `[forComboboxEmpty]`. `[forComboboxStatus]` stays mounted regardless\n * so transitions like \"loading → 5 results\" are announced as a single\n * change to the same live region.\n */\n@Directive({\n selector: '[forComboboxStatus]',\n exportAs: 'forComboboxStatus',\n host: {\n role: 'status',\n },\n})\nexport class ForComboboxStatus {\n readonly #ctx = injectComboboxContext('ForComboboxStatus');\n\n /**\n * Number of results the listbox holds, for interpolating `{{ status.count() }}`\n * inside the live region: the root's `[totalCount]` when set, so a virtualized\n * listbox announces its full result count rather than its rendered window, and\n * the number of registered options otherwise.\n */\n readonly count = computed(() => this.#ctx.totalCount() ?? this.#ctx.options().length);\n}\n","import { computed, Directive, ElementRef, inject, input } from '@angular/core';\n\nimport {\n hostButtonType,\n hostAriaLabel,\n preventPointerFocus,\n reflectDisabled,\n registerHandle,\n resolveTextInput,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\nimport { FOR_COMBOBOX_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Optional clear button. Apply on a `<button type=\"button\">` so Space /\n * Enter dispatch a native click. Clicking calls `clear()` on the root,\n * which resets `[(value)]` and `[(query)]` and the activedescendant.\n *\n * Carries `aria-label` (default `'Clear'`, or the scope's `clearAriaLabel`\n * from `provideForComboboxDefaults`) so the icon-only button has an\n * accessible name; override per-instance via `[ariaLabel]`.\n *\n * The directive hides the button when there's nothing to clear (no value,\n * empty query) so the consumer can leave it inline in the template without\n * an extra `@if`. Visibility is enforced with an inline `display: none`\n * (which beats any author `display` rule a consumer applies via a class) in\n * addition to the `hidden` attribute that removes it from the a11y tree.\n *\n * The press never takes focus itself, so an input that already has focus keeps\n * it and the combobox is not marked touched. The button is exempt from the\n * listbox's outside-pointer dismissal, so clearing an open listbox leaves it\n * open.\n */\n@Directive({\n selector: '[forComboboxClear]',\n exportAs: 'forComboboxClear',\n host: {\n '[attr.type]': 'buttonType()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[hidden]': '!hasContent()',\n '[style.display]': 'hasContent() ? null : \"none\"',\n '[attr.tabindex]': '-1',\n '(click)': 'onClick()',\n },\n})\nexport class ForComboboxClear {\n private readonly buttonType = hostButtonType();\n\n private readonly ctx = injectComboboxContext('ForComboboxClear');\n readonly #defaults = inject(FOR_COMBOBOX_DEFAULTS);\n\n /**\n * Accessible name for the clear button, exposed as `aria-label`. Defaults\n * to the scope's `clearAriaLabel` (`'Clear'` unless overridden via\n * `provideForComboboxDefaults`); set `[ariaLabel]` to override per-instance,\n * or `null` to drop the attribute.\n */\n readonly ariaLabel = input<string | null>();\n\n private readonly resolvedAriaLabel = hostAriaLabel(\n () => resolveTextInput(this.ariaLabel(), this.#defaults.clearAriaLabel) || null,\n );\n\n private readonly hasContent = computed(\n () => this.ctx.value().length > 0 || this.ctx.query().length > 0,\n );\n\n /** Disabled when the combobox is disabled or read-only — the clear action is unavailable. */\n private readonly isDisabled = computed(() => this.ctx.effectiveDisabled() || this.ctx.readonly());\n\n constructor() {\n registerHandle(\n inject<ElementRef<HTMLElement>>(ElementRef).nativeElement,\n (el) => this.ctx.registerFieldButton(el),\n (el) => this.ctx.unregisterFieldButton(el),\n );\n reflectDisabled(this.isDisabled);\n preventPointerFocus();\n }\n\n private onClick(): void {\n if (this.isDisabled()) {\n return;\n }\n this.ctx.clear(true);\n // Restore focus to the input so the user can keep typing without\n // chasing the caret.\n this.ctx.input()?.focus();\n }\n}\n","import { Directive, inject, input } from '@angular/core';\n\nimport { hostAriaLabel, resolveTextInput } from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\nimport { FOR_COMBOBOX_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Multi-mode chips area. Wrap the chips and the `<input>` together so the\n * combobox visually presents a single editable region:\n *\n * ```html\n * <div forCombobox multiple [(value)]=\"tags\" [(query)]=\"query\" [(open)]=\"open\">\n * <div forComboboxChips>\n * @for (chip of selected(); track chip.value) {\n * <span forComboboxChip [value]=\"chip.value\">\n * {{ chip.label }}\n * <button forComboboxChipRemove></button>\n * </span>\n * }\n * <input forComboboxInput />\n * </div>\n * …\n * </div>\n * ```\n *\n * Carries `role=\"group\"` with `aria-label` (default `'Selected items'`,\n * override via `[ariaLabel]`) so screen readers announce the chip cluster as\n * a single unit. The directive itself doesn't manage focus or selection — the\n * chips and the input own that — but its presence groups them for\n * assistive tech.\n */\n@Directive({\n selector: '[forComboboxChips]',\n exportAs: 'forComboboxChips',\n host: {\n role: 'group',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n },\n})\nexport class ForComboboxChips {\n private readonly ctx = injectComboboxContext('ForComboboxChips');\n readonly #defaults = inject(FOR_COMBOBOX_DEFAULTS);\n\n /**\n * Accessible name for the chip cluster, exposed as `role=\"group\"`'s\n * `aria-label` so screen readers announce the selected chips as a single\n * unit. Defaults to the scope's `chipsAriaLabel` (`'Selected items'` unless\n * overridden via `provideForComboboxDefaults`); set `[ariaLabel]` to\n * override per-instance, or `null` to drop the attribute.\n */\n readonly ariaLabel = input<string | null>();\n\n private readonly resolvedAriaLabel = hostAriaLabel(\n () => resolveTextInput(this.ariaLabel(), this.#defaults.chipsAriaLabel) || null,\n );\n}\n","import { computed, Directive, ElementRef, inject, input, type InputSignal } from '@angular/core';\n\nimport {\n assertInputBound,\n isImeComposing,\n isUnset,\n registerHandle,\n unsetInput,\n type Unset,\n} from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\n\n/**\n * One chip representing a selected value in multi mode. Apply on a\n * `<span>` (or any inline-block element) inside `[forComboboxChips]`.\n * The chip is **out of the Tab cycle** (`tabindex=\"-1\"`) by design:\n * the user reaches it via the input's Backspace heuristic (Backspace on\n * an empty input focuses the last chip), then navigates between chips\n * with ArrowLeft / ArrowRight or removes them with Backspace / Delete.\n *\n * Keyboard while the chip has focus (LTR; the ArrowLeft/Right roles swap\n * in RTL so they always follow visual order):\n * - **ArrowLeft** — focus the previous chip; bounces if first.\n * - **ArrowRight** — focus the next chip; if at the last, focus the input.\n * - **Backspace / Delete** — remove this chip + focus the previous chip,\n * or the next chip when there is no previous one (so removing the first\n * chip lands on the new first chip), falling back to the input only when\n * the removed chip was the last one standing.\n * - **Escape** — dismiss the open popup via the consumer's `(escapeKeyDown)`\n * (a veto keeps it open), then return focus to the input; with the popup\n * already closed it simply returns focus to the input.\n *\n * Click on the chip body (excluding the remove button) just focuses the\n * chip — useful as an alternative to the Backspace path.\n */\n@Directive({\n selector: '[forComboboxChip]',\n exportAs: 'forComboboxChip',\n host: {\n tabindex: '-1',\n '[attr.data-value]': 'dataValue()',\n '[attr.data-disabled]': 'ctx.effectiveDisabled() ? \"\" : null',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForComboboxChip<T = string> {\n private readonly ctx = injectComboboxContext<T>('ForComboboxChip');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The value this chip represents — must match an entry in\n * `[forCombobox][(value)]` per the parent's `[compareWith]`.\n * Generic over `T` (default `string`); inferred from the binding\n * (`[value]=\"someObject\"` specializes `T`). Mandatory — a chip with no binding throws in dev\n * mode.\n */\n readonly value: InputSignal<T | Unset> = input(unsetInput<T>());\n\n /**\n * `data-value` reflection — for string `T` this is the value verbatim\n * (unchanged from the pre-generic behaviour); for object `T` it uses\n * the parent's `itemToFormValue` so the attribute carries the same\n * wire format as the hidden inputs (typically JSON or a per-item id).\n */\n private readonly dataValue = computed(() => {\n const v = this.value();\n if (isUnset(v)) {\n return null;\n }\n return typeof v === 'string' ? (v as string) : this.ctx.itemToFormValue()(v);\n });\n\n /** Resolved label of the underlying option, used by `[forComboboxChipRemove]` for its `aria-label`. */\n readonly label = computed(() => {\n const v = this.value();\n if (isUnset(v)) {\n return '';\n }\n const equals = this.ctx.compareWith();\n const cached = this.ctx.selectedEntries().find((o) => equals(o.value, v));\n if (cached) {\n return cached.label;\n }\n return this.ctx.itemToStringLabel()(v);\n });\n\n constructor() {\n assertInputBound(this.value, 'combobox', '[forComboboxChip]', 'value');\n const handle = {\n host: this.#host.nativeElement,\n value: this.value,\n };\n registerHandle(\n handle,\n (h) => this.ctx.registerChip(h),\n (h) => this.ctx.unregisterChip(h),\n );\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.ctx.effectiveDisabled() || this.ctx.readonly()) {\n return;\n }\n const chips = this.ctx.chips();\n const index = chips.findIndex((c) => c.host === this.#host.nativeElement);\n if (index < 0) {\n return;\n }\n\n // In RTL the chip cluster lays out right-to-left, so ArrowRight must\n // move to the visually-next chip (= DOM-previous) and ArrowLeft to the\n // visually-previous one (= DOM-next), with the input sitting at the\n // visual leftmost edge.\n const rtl = this.ctx.dir() === 'rtl';\n const prevKey = rtl ? 'ArrowRight' : 'ArrowLeft';\n const nextKey = rtl ? 'ArrowLeft' : 'ArrowRight';\n\n switch (event.key) {\n case prevKey: {\n event.preventDefault();\n const prev = chips[index - 1];\n if (prev) {\n prev.host.focus();\n }\n break;\n }\n case nextKey: {\n event.preventDefault();\n const next = chips[index + 1];\n if (next) {\n next.host.focus();\n } else {\n // At the last chip (visual edge in either direction) — hop to the input.\n this.ctx.input()?.focus();\n }\n break;\n }\n case 'Backspace':\n case 'Delete': {\n const v = this.value();\n if (isUnset(v)) {\n break;\n }\n event.preventDefault();\n const prev = chips[index - 1];\n const next = chips[index + 1];\n this.ctx.removeValue(v);\n // Keep focus inside the chip cluster whenever a neighbour survives the\n // removal: prefer the previous chip, otherwise the next one (which\n // slides into the freed slot — so removing the first chip lands on the\n // new first chip rather than ejecting the user to the input). Only drop\n // focus into the input when the removed chip was the last one standing,\n // so the user can keep typing without chasing the caret.\n if (prev) {\n prev.host.focus();\n } else if (next) {\n next.host.focus();\n } else {\n this.ctx.input()?.focus();\n }\n break;\n }\n case 'Escape': {\n if (isImeComposing(event)) {\n return;\n }\n event.preventDefault();\n if (this.ctx.open()) {\n event.stopPropagation();\n this.ctx.emitEscapeKeyDown(event);\n }\n if (!this.ctx.open() && this.ctx.trigger() === null) {\n this.ctx.input()?.focus();\n }\n break;\n }\n }\n }\n}\n","import { computed, Directive, inject } from '@angular/core';\n\nimport { hostButtonType, orphanContextError, reflectDisabled } from 'forty-cdk/core';\nimport { injectComboboxContext } from './combobox-context';\nimport { ForComboboxChip } from './combobox-chip';\nimport { FOR_COMBOBOX_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Remove button inside a `[forComboboxChip]`. Apply on a\n * `<button type=\"button\">` so click and Space / Enter (when focused) all\n * trigger the same removal flow. The button is out of the Tab cycle\n * (`tabindex=\"-1\"`) so the user navigates the chip cluster via the chip's\n * own ArrowLeft/Right + Backspace/Delete keys; this button exists for\n * mouse / touch users.\n *\n * The host carries a generated `aria-label` (`'Remove <chip label>'` by\n * default) built from the parent chip's resolved option label by the scope's\n * `chipRemoveLabel` builder — override it with\n * `provideForComboboxDefaults({ chipRemoveLabel })` to localize every chip\n * remove button in the scope. Because the name is computed per chip, the piece\n * exposes no per-instance `[ariaLabel]` input and does not adopt a static\n * `aria-label` attribute (one static value would name every chip identically).\n */\n@Directive({\n selector: '[forComboboxChipRemove]',\n exportAs: 'forComboboxChipRemove',\n host: {\n '[attr.type]': 'buttonType()',\n tabindex: '-1',\n '[attr.aria-label]': 'ariaLabel()',\n '(click)': 'onClick($event)',\n },\n})\nexport class ForComboboxChipRemove {\n private readonly buttonType = hostButtonType();\n\n // The value type is opaque to chip-remove: it just forwards whatever the\n // parent chip exposes back into `removeValue`. At runtime the chip and\n // the parent `[forCombobox]` share the same `T` because the consumer\n // binds them with the same value source.\n private readonly ctx = injectComboboxContext<unknown>('ForComboboxChipRemove');\n readonly #chip = inject<ForComboboxChip<unknown>>(ForComboboxChip, { optional: true });\n readonly #defaults = inject(FOR_COMBOBOX_DEFAULTS);\n\n /** Disabled when the combobox is disabled or read-only — chip removal is unavailable. */\n private readonly isDisabled = computed(() => this.ctx.effectiveDisabled() || this.ctx.readonly());\n\n constructor() {\n if (!this.#chip) {\n throw orphanContextError({\n code: 'FORCDK-COMBOBOX-002',\n piece: 'ForComboboxChipRemove',\n root: '[forComboboxChip]',\n token: 'ForComboboxChip',\n });\n }\n reflectDisabled(this.isDisabled);\n }\n\n private readonly ariaLabel = computed(() => this.#defaults.chipRemoveLabel(this.#chip!.label()));\n\n private onClick(event: MouseEvent): void {\n if (this.isDisabled()) {\n return;\n }\n // Don't let the click bubble up to the chip body — that would trigger\n // its keyboard-triggered handlers in some browsers via synthesized events.\n event.stopPropagation();\n this.ctx.removeValue(this.#chip!.value());\n // Restore focus to the input so the user can continue typing.\n this.ctx.input()?.focus();\n }\n}\n","import { Directive, signal } from '@angular/core';\n\nimport { hostLabelledBy } from 'forty-cdk/core';\n\n/**\n * Optional grouping wrapper inside a `[forComboboxContent]`. Renders\n * `role=\"group\"` and references the descendant `[forComboboxGroupLabel]`\n * (if any) via `aria-labelledby`. Options inside a group still register\n * with the root listbox normally, so keyboard navigation traverses across\n * groups in DOM order without special handling.\n */\n@Directive({\n selector: '[forComboboxGroup]',\n exportAs: 'forComboboxGroup',\n host: {\n role: 'group',\n },\n})\nexport class ForComboboxGroup {\n readonly #labelId = signal<string | null>(null);\n\n /** The id of the registered group label (or `null` if none). */\n readonly labelId = this.#labelId.asReadonly();\n\n private readonly labelledBy = hostLabelledBy(() => this.labelId());\n\n /** Called by `ForComboboxGroupLabel` on mount. */\n registerLabel(id: string): void {\n this.#labelId.set(id);\n }\n\n /** Called by `ForComboboxGroupLabel` on destroy. Idempotent. */\n unregisterLabel(id: string): void {\n if (this.#labelId() === id) {\n this.#labelId.set(null);\n }\n }\n}\n","import { Directive, inject } from '@angular/core';\n\nimport { orphanContextError, registerA11yName } from 'forty-cdk/core';\nimport { ForComboboxGroup } from './combobox-group';\n\n/**\n * Visible label for a `[forComboboxGroup]`. Generates a stable id and\n * registers with its parent group so the group's `aria-labelledby` points\n * at this element.\n */\n@Directive({\n selector: '[forComboboxGroupLabel]',\n exportAs: 'forComboboxGroupLabel',\n host: {\n '[id]': 'id',\n },\n})\nexport class ForComboboxGroupLabel {\n /** Stable host id used by the parent group's `aria-labelledby`. */\n readonly id: string;\n\n constructor() {\n const group = inject(ForComboboxGroup, { optional: true });\n if (!group) {\n throw orphanContextError({\n code: 'FORCDK-COMBOBOX-005',\n piece: 'ForComboboxGroupLabel',\n root: '[forComboboxGroup]',\n token: 'ForComboboxGroup',\n });\n }\n this.id = registerA11yName(group, 'for-combobox-group-label');\n }\n}\n","import { Directive, input } from '@angular/core';\n\n/**\n * Visual separator between options or groups inside a `[forComboboxContent]` or a\n * `[forComboboxList]`. Keyboard navigation skips it. It is always presentational\n * (`role=\"none\"`, no `aria-orientation`), because a `role=\"listbox\"` may own only\n * `option` and `group` children: wrap related options in a `[forComboboxGroup]` with a\n * group label when the split must be announced.\n */\n@Directive({\n selector: '[forComboboxSeparator]',\n exportAs: 'forComboboxSeparator',\n host: {\n role: 'none',\n '[attr.data-orientation]': 'orientation()',\n },\n})\nexport class ForComboboxSeparator {\n /**\n * Axis the separator divides along, reflected to `data-orientation` for styling.\n * `horizontal` (default) splits options stacked vertically, the common case in a\n * listbox; `vertical` splits options laid out horizontally.\n */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n}\n","/**\n * Exact public names of every `ForCombobox` input, its models included. Spread it into the\n * `inputs` array of a `hostDirectives` entry so a wrapper component re-exposes the\n * primitive's full surface — the Signal Forms members `[formField]` binds among them —\n * without hand-maintaining the list. Always spread into an inline object literal as shown\n * below: the literal is what keeps the entry statically analyzable for consumers compiling\n * against the published package. An anti-drift spec fails when this list no longer matches\n * the directive's actual API. See `docs/wrapping-form-primitives.md` for both supported\n * wrapping patterns.\n *\n * @example\n * ```ts\n * @Component({\n * selector: 'div[myCombobox]',\n * template: '',\n * hostDirectives: [\n * {\n * directive: ForCombobox,\n * inputs: [...FOR_COMBOBOX_HOST_DIRECTIVE_INPUTS],\n * outputs: [...FOR_COMBOBOX_HOST_DIRECTIVE_OUTPUTS],\n * },\n * ],\n * })\n * export class MyCombobox {}\n * ```\n */\nexport const FOR_COMBOBOX_HOST_DIRECTIVE_INPUTS = [\n 'query',\n 'value',\n 'open',\n 'align',\n 'alignOffset',\n 'ariaLabel',\n 'autoHighlight',\n 'autocompleteMode',\n 'avoidCollisions',\n 'clearOnQueryChange',\n 'clipUntilPositioned',\n 'collisionPadding',\n 'commitOnSelect',\n 'compareWith',\n 'dir',\n 'dirty',\n 'disabled',\n 'dismissible',\n 'errors',\n 'hideWhenDetached',\n 'invalid',\n 'itemToFormValue',\n 'itemToStringLabel',\n 'loop',\n 'multiple',\n 'name',\n 'openHighlight',\n 'openOnFocus',\n 'openOnQuery',\n 'pending',\n 'readonly',\n 'required',\n 'restoreQueryOnClose',\n 'returnFocus',\n 'side',\n 'sideOffset',\n 'sticky',\n 'touched',\n] as const;\n\n/**\n * Exact public names of every `ForCombobox` output, the Signal Forms `touch` output\n * included. Spread it into the `outputs` array of the same `hostDirectives` entry as\n * {@link FOR_COMBOBOX_HOST_DIRECTIVE_INPUTS}.\n */\nexport const FOR_COMBOBOX_HOST_DIRECTIVE_OUTPUTS = [\n 'queryChange',\n 'valueChange',\n 'openChange',\n 'escapeKeyDown',\n 'pointerDownOutside',\n 'focusOutside',\n 'interactOutside',\n 'autoFocusOnOpen',\n 'autoFocusOnClose',\n 'touchedChange',\n 'touch',\n] as const;\n\n/**\n * Exact public names of every `ForComboboxVirtualized` input. Spread it into the `inputs`\n * array of a second `hostDirectives` entry, beside the `ForCombobox` one, so a wrapper\n * component that virtualizes its options re-exposes the virtualization surface too.\n */\nexport const FOR_COMBOBOX_VIRTUALIZED_HOST_DIRECTIVE_INPUTS = [\n 'dataVersion',\n 'totalCount',\n 'visibleRange',\n] as const;\n\n/**\n * Exact public names of every `ForComboboxVirtualized` output. Spread it into the\n * `outputs` array of the same `hostDirectives` entry as\n * {@link FOR_COMBOBOX_VIRTUALIZED_H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