@mintplayer/ng-bootstrap 22.25.0 → 22.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -106,14 +106,11 @@ declare class BsForwardAriaDirective implements OnInit {
106
106
  /**
107
107
  * One marker per focusable child of a `bsRovingFocus` container.
108
108
  *
109
- * - Mirrors the parent's mode into the host `tabindex` (0 if active in
110
- * `tabindex` mode, -1 otherwise).
111
- * - Toggles the `.bs-rovingfocus-active` class so SCSS can paint a focused-
112
- * look highlight on the active item — important in `activedescendant`
113
- * mode, where the item never receives `:focus` and the browser's focus
114
- * ring never paints.
115
- * - Auto-generates an `id` if the host doesn't already have one, so combobox
116
- * `aria-activedescendant` always has a stable target. Honours an
109
+ * - Sets the host `tabindex` (0 if active, -1 otherwise).
110
+ * - Toggles the `.bs-rovingfocus-active` class so SCSS can paint a highlight
111
+ * on the active item.
112
+ * - Auto-generates an `id` if the host doesn't already have one, so other
113
+ * ARIA references always have a stable target. Honours an
117
114
  * externally-supplied id when present.
118
115
  *
119
116
  * Consumers normally don't interact with this directive directly — they
@@ -127,13 +124,11 @@ declare class BsRovingFocusItemDirective {
127
124
  /**
128
125
  * The host element's id. Honoured if set externally (e.g. by a sibling
129
126
  * component's [attr.id] host binding); otherwise generated in afterNextRender
130
- * so combobox-style aria-activedescendant has a stable target.
127
+ * so an ARIA reference to the item has a stable target.
131
128
  *
132
- * Backed by a signal so parent computeds (like BsRovingFocusDirective's
133
- * activeDescendantId) re-run when the id is resolved post-mount. A plain
134
- * `nativeElement.id` getter would be silently cached during the first
135
- * computation and never re-read — leading to aria-activedescendant="" on
136
- * combobox inputs even after the items got real ids.
129
+ * Backed by a signal so a consumer computed that reads it re-runs when the id
130
+ * is resolved post-mount. A plain `nativeElement.id` getter would be silently
131
+ * cached during the first computation and never re-read.
137
132
  */
138
133
  private readonly _itemId;
139
134
  get itemId(): string;
@@ -147,33 +142,27 @@ declare class BsRovingFocusItemDirective {
147
142
  }
148
143
 
149
144
  type BsRovingFocusOrientation = 'vertical' | 'horizontal' | 'both';
150
- type BsRovingFocusMode = 'tabindex' | 'activedescendant';
151
145
  /**
152
- * APG roving-tabindex / active-descendant container.
146
+ * APG roving-tabindex container.
153
147
  *
154
- * Place on a list/menu/listbox; mark each focusable child with
148
+ * Place on a list/menu/tablist; mark each focusable child with
155
149
  * `bsRovingFocusItem`. Arrow keys, Home, and End move the active item; the
156
- * directive auto-handles disabled items, wrap-around, and orientation.
150
+ * directive auto-handles disabled items, wrap-around, and orientation. Only
151
+ * the active item has `tabindex="0"`; real DOM focus moves.
157
152
  *
158
- * Two modes:
159
- * - **`tabindex`** (default) — only the active item has `tabindex="0"`; real
160
- * DOM focus moves. Right for menus, treeviews, tablists.
161
- * - **`activedescendant`** — items keep `tabindex="-1"`; DOM focus stays on
162
- * an external owner (e.g. a combobox `<input>`) which mirrors the active
163
- * item's id via `aria-activedescendant`. Right for comboboxes/listboxes
164
- * where the user is also typing.
153
+ * The former `activedescendant` mode (focus parked on a combobox input) was
154
+ * removed with the typeahead's move to its headless core (#436 D10): the
155
+ * typeahead core owns that keyboard model, and nothing else used the mode.
165
156
  *
166
157
  * Consumers that need to react to the active item externally read
167
- * `activeIndex()` (signal) or `activeDescendantId()` (computed).
158
+ * `activeIndex()` (signal).
168
159
  */
169
160
  declare class BsRovingFocusDirective {
170
161
  private elementRef;
171
162
  readonly orientation: i0.InputSignal<BsRovingFocusOrientation>;
172
- readonly mode: i0.InputSignal<BsRovingFocusMode>;
173
163
  readonly wrap: i0.InputSignal<boolean>;
174
164
  readonly items: i0.Signal<readonly BsRovingFocusItemDirective[]>;
175
165
  readonly activeIndex: i0.WritableSignal<number>;
176
- readonly activeDescendantId: i0.Signal<string | null>;
177
166
  focusFirst(): void;
178
167
  focusLast(): void;
179
168
  next(): void;
@@ -185,18 +174,18 @@ declare class BsRovingFocusDirective {
185
174
  * @mintplayer/web-components/a11y — this directive and the WC RovingFocus
186
175
  * controller had independently identical copies that had ALREADY drifted
187
176
  * (wrap-vs-clamp default). One implementation, two adapters. The directive
188
- * keeps its own signals, discovery and activedescendant mode: those are
189
- * Angular/light-DOM concerns the WC controller rightly lacks.
177
+ * keeps its own signals and discovery: those are Angular/light-DOM concerns
178
+ * the WC controller rightly lacks.
190
179
  *
191
- * Public so consumers (e.g. BsComboboxDirective's TAB handling) can detect
192
- * edges without re-implementing the disabled-aware scan.
180
+ * Public so consumers can detect edges without re-implementing the
181
+ * disabled-aware scan.
193
182
  */
194
183
  firstEnabledIndex(): number;
195
184
  lastEnabledIndex(): number;
196
185
  private step;
197
186
  private moveTo;
198
187
  static ɵfac: i0.ɵɵFactoryDeclaration<BsRovingFocusDirective, never>;
199
- static ɵdir: i0.ɵɵDirectiveDeclaration<BsRovingFocusDirective, "[bsRovingFocus]", ["bsRovingFocus"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; }, {}, ["items"], never, true, never>;
188
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BsRovingFocusDirective, "[bsRovingFocus]", ["bsRovingFocus"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; }, {}, ["items"], never, true, never>;
200
189
  }
201
190
 
202
191
  type BsOverlayInitialFocus = HTMLElement | 'first' | 'self' | 'none';
@@ -345,4 +334,4 @@ declare class BsControlValidityDirective implements DoCheck {
345
334
  }
346
335
 
347
336
  export { BsControlValidityDirective, BsForwardAriaDirective, BsIdService, BsLiveAnnouncerService, BsOverlayFocusDirective, BsOverlayStackService, BsRovingFocusDirective, BsRovingFocusItemDirective };
348
- export type { BsOverlayInitialFocus, BsRovingFocusMode, BsRovingFocusOrientation };
337
+ export type { BsOverlayInitialFocus, BsRovingFocusOrientation };
@@ -42,7 +42,6 @@ declare class BsCodeSnippetComponent implements AfterViewInit {
42
42
  *
43
43
  * Angular's `output()` emits synchronously inside the DOM listener, so a
44
44
  * `preventDefault()` in the handler lands before `dispatchEvent` returns.
45
- * Same shape as `BsComboboxDirective`'s `activate`/`cancel`.
46
45
  */
47
46
  readonly lineActivate: _angular_core.OutputEmitterRef<CustomEvent<{
48
47
  line: number;
@@ -30,6 +30,13 @@ declare class DatatableSettings {
30
30
  */
31
31
  interface BsDatatableFetchRequest extends PaginationRequest {
32
32
  parentId?: unknown;
33
+ /**
34
+ * Aborts when the table invalidates its pages (sort, page size, a new
35
+ * `[fetch]`, `reload()`), so a superseded request stops instead of running to
36
+ * completion and being ignored. Hand it to `fetch`; for an `HttpClient`
37
+ * observable, unsubscribe on `signal.addEventListener('abort', …)`.
38
+ */
39
+ signal: AbortSignal;
33
40
  }
34
41
  type BsDatatableFetch<T> = (req: BsDatatableFetchRequest) => Promise<PaginationResponse<T>>;
35
42
 
@@ -1,13 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken } from '@angular/core';
3
- import { DropdownMode, DropdownSelectEventDetail } from '@mintplayer/web-components/dropdown-menu';
3
+ import { DropdownSelectEventDetail } from '@mintplayer/web-components/dropdown-menu';
4
4
 
5
5
  /**
6
6
  * `<bs-dropdown-menu>` — Angular wrapper around the `<mp-dropdown-menu>` web
7
7
  * component. This is the single dropdown-menu implementation: it is used
8
8
  * standalone (projected through `*bsDropdownMenu` by the `[bsDropdown]` trigger
9
- * stack), inside `<bs-navbar>`, and as the listbox panel for the combobox /
10
- * typeahead (`mode="listbox"`).
9
+ * stack) and inside `<bs-navbar>`. Menu only: the typeahead renders its own
10
+ * listbox from its headless core (#436).
11
11
  *
12
12
  * Keyboard navigation, roving tabindex, the ARIA roles and the theme-aware
13
13
  * styling all live in the WC (single source of UI truth). This wrapper bridges
@@ -19,20 +19,9 @@ import { DropdownMode, DropdownSelectEventDetail } from '@mintplayer/web-compone
19
19
  * Declarative Shadow DOM (see `injectMpDropdownDsd`), so it renders with JS off.
20
20
  *
21
21
  * This wrapper stays framework-agnostic of the `[bsDropdown]` trigger stack (it
22
- * lives in a sibling entry point). When projected as a combobox/listbox panel,
23
- * the consumer sets `mode="listbox"` and mirrors the trigger's `menuId`/
24
- * `popupRole` onto this host (`[attr.id]`/`[attr.role]`) via the exported
25
- * `bsDropdown` reference — the same directive the toggle and combobox read.
22
+ * lives in a sibling entry point).
26
23
  */
27
24
  declare class BsDropdownMenuComponent {
28
- /**
29
- * `menu` (default, roving-tabindex nav) | `listbox` (consumer manages focus).
30
- *
31
- * Aliased to `menuMode` so it never collides with the `mode` input of the
32
- * a11y `bsRovingFocus` directive when a combobox/listbox stacks both on this
33
- * one element (same reason `bsCombobox` aliases its `autocomplete`).
34
- */
35
- readonly mode: i0.InputSignal<DropdownMode>;
36
25
  /** Pixel cap on the menu height; scrolls beyond. */
37
26
  readonly maxHeight: i0.InputSignal<number | undefined>;
38
27
  /** Id of an external label, set as `aria-labelledby` on the WC's list. */
@@ -43,7 +32,7 @@ declare class BsDropdownMenuComponent {
43
32
  protected onSelect(event: Event): void;
44
33
  constructor();
45
34
  static ɵfac: i0.ɵɵFactoryDeclaration<BsDropdownMenuComponent, never>;
46
- static ɵcmp: i0.ɵɵComponentDeclaration<BsDropdownMenuComponent, "bs-dropdown-menu", never, { "mode": { "alias": "menuMode"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; }, { "select": "select"; }, never, ["*"], true, never>;
35
+ static ɵcmp: i0.ɵɵComponentDeclaration<BsDropdownMenuComponent, "bs-dropdown-menu", never, { "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; }, { "select": "select"; }, never, ["*"], true, never>;
47
36
  }
48
37
 
49
38
  /**
@@ -70,8 +59,7 @@ declare const BS_DROPDOWN_MENU_CONTEXT: InjectionToken<boolean>;
70
59
  * Usage: `<li bsDropdownItem><a routerLink="/x">Action</a></li>`.
71
60
  *
72
61
  * Inputs:
73
- * - `active` — Bootstrap `.active` appearance (also drives `aria-selected` in
74
- * a `listbox` menu).
62
+ * - `active` — Bootstrap `.active` appearance.
75
63
  * - `disabled` — non-interactive; removed from the menu's roving order.
76
64
  * - `value` — opaque value carried in the menu's `select` event detail;
77
65
  * written to the host `<li>` as its `dropdownValue` property, which the WC
@@ -42,7 +42,6 @@ declare class BsDropdownToggleDirective {
42
42
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BsDropdownToggleDirective, "[bsDropdownToggle]", never, {}, {}, never, never, true, never>;
43
43
  }
44
44
 
45
- type BsDropdownPopupRole = 'menu' | 'listbox';
46
45
  declare class BsDropdownDirective {
47
46
  elementRef: ElementRef<HTMLElement>;
48
47
  private bsDevelopment;
@@ -55,58 +54,13 @@ declare class BsDropdownDirective {
55
54
  closeOnClickOutside: _angular_core.InputSignal<boolean>;
56
55
  sameDropdownWidth: _angular_core.InputSignal<boolean>;
57
56
  isOpen: _angular_core.ModelSignal<boolean>;
58
- readonly popupRole: _angular_core.InputSignal<BsDropdownPopupRole>;
59
57
  /** Reactive id used for the menu's host id and for the toggle's aria-controls. Empty until afterNextRender resolves the host's static id (or generates one), so sibling host bindings on the wrapper element get a chance to land first. */
60
58
  private _menuId;
61
59
  readonly menuId: _angular_core.Signal<string>;
62
60
  constructor();
63
61
  onBlur(): void;
64
62
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BsDropdownDirective, never>;
65
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BsDropdownDirective, "[bsDropdown]", ["bsDropdown"], { "hasBackdrop": { "alias": "hasBackdrop"; "required": false; "isSignal": true; }; "sameWidth": { "alias": "sameWidth"; "required": false; "isSignal": true; }; "closeOnClickOutside": { "alias": "closeOnClickOutside"; "required": false; "isSignal": true; }; "sameDropdownWidth": { "alias": "sameDropdownWidth"; "required": false; "isSignal": true; }; "isOpen": { "alias": "isOpen"; "required": false; "isSignal": true; }; "popupRole": { "alias": "popupRole"; "required": false; "isSignal": true; }; }, { "isOpen": "isOpenChange"; }, ["menu", "toggle", "rovingFocus"], never, true, never>;
63
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BsDropdownDirective, "[bsDropdown]", ["bsDropdown"], { "hasBackdrop": { "alias": "hasBackdrop"; "required": false; "isSignal": true; }; "sameWidth": { "alias": "sameWidth"; "required": false; "isSignal": true; }; "closeOnClickOutside": { "alias": "closeOnClickOutside"; "required": false; "isSignal": true; }; "sameDropdownWidth": { "alias": "sameDropdownWidth"; "required": false; "isSignal": true; }; "isOpen": { "alias": "isOpen"; "required": false; "isSignal": true; }; }, { "isOpen": "isOpenChange"; }, ["menu", "toggle", "rovingFocus"], never, true, never>;
66
64
  }
67
65
 
68
- type BsComboboxAutocomplete = 'none' | 'list' | 'inline' | 'both';
69
- type BsComboboxNavigateDirection = 'next' | 'prev' | 'first' | 'last';
70
- /**
71
- * APG Combobox pattern — turns a plain `<input>` into a combobox that drives
72
- * an adjacent `bsDropdown` popup (typeahead, tree-select, etc.).
73
- *
74
- * The directive owns the input-side ARIA wiring:
75
- * - `role="combobox"` on the host
76
- * - `aria-expanded` / `aria-controls` derived from the parent dropdown
77
- * - `aria-activedescendant` mirroring the dropdown's `bsRovingFocus` active id
78
- * - `aria-autocomplete` (defaults to `"list"`)
79
- *
80
- * Keyboard model:
81
- * - **ArrowUp/Down/Home/End** — opens the popup if closed; once open,
82
- * forwards to the dropdown's `bsRovingFocus` (or emits a `navigate` event
83
- * if no roving-focus is found, so consumers can manage navigation manually).
84
- * - **Enter** — fires `activate` so the consumer can commit the highlighted
85
- * option. `stopImmediatePropagation` is called to keep sibling
86
- * `(keydown.enter)` listeners on the same input (e.g. "submit free-text
87
- * search") from also firing on the same Enter.
88
- * - **Escape** — closes the popup and fires `cancel`.
89
- * - **Tab** — hybrid behaviour: while the popup is open and a roving-focus
90
- * is present, Tab advances the active descendant; at the boundary, Tab
91
- * closes the popup and falls through to the browser's default tab order.
92
- */
93
- declare class BsComboboxDirective {
94
- private dropdown;
95
- /** Aliased to bsComboboxAutocomplete to avoid colliding with the host input's native HTML autocomplete attribute. */
96
- readonly autocomplete: _angular_core.InputSignal<BsComboboxAutocomplete>;
97
- /** Override the auto-derived activeDescendant. Defaults to dropdown.rovingFocus()'s id when present. */
98
- readonly activeDescendant: _angular_core.InputSignal<string | null>;
99
- readonly expanded: _angular_core.Signal<boolean>;
100
- readonly controls: _angular_core.Signal<string | null>;
101
- readonly resolvedActiveDescendant: _angular_core.Signal<string | null>;
102
- /** Fires only when no BsRovingFocus is found inside the parent dropdown — otherwise arrow keys are forwarded automatically. */
103
- readonly navigate: _angular_core.OutputEmitterRef<BsComboboxNavigateDirection>;
104
- readonly activate: _angular_core.OutputEmitterRef<KeyboardEvent>;
105
- readonly cancel: _angular_core.OutputEmitterRef<KeyboardEvent>;
106
- onKeydown(event: KeyboardEvent): void;
107
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<BsComboboxDirective, never>;
108
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BsComboboxDirective, "input[bsCombobox]", ["bsCombobox"], { "autocomplete": { "alias": "bsComboboxAutocomplete"; "required": false; "isSignal": true; }; "activeDescendant": { "alias": "activeDescendant"; "required": false; "isSignal": true; }; }, { "navigate": "navigate"; "activate": "activate"; "cancel": "cancel"; }, never, never, true, never>;
109
- }
110
-
111
- export { BsComboboxDirective, BsDropdownDirective, BsDropdownMenuDirective, BsDropdownToggleDirective };
112
- export type { BsComboboxAutocomplete, BsComboboxNavigateDirection, BsDropdownPopupRole };
66
+ export { BsDropdownDirective, BsDropdownMenuDirective, BsDropdownToggleDirective };
@@ -0,0 +1,54 @@
1
+ import * as i0 from '@angular/core';
2
+ import { DestroyRef, Signal } from '@angular/core';
3
+ import { Store } from '@mintplayer/ui-core/store';
4
+
5
+ /**
6
+ * Bridge a `@mintplayer/ui-core` store into Angular's reactivity: a read-only
7
+ * `Signal` of the store's snapshot, kept current by `subscribe` and released on
8
+ * the injection context's `DestroyRef`.
9
+ *
10
+ * The signal is set synchronously from the store's notification; Angular
11
+ * coalesces the resulting change detection, so a command that commits one
12
+ * snapshot costs one render (measured in `machine-signal.spec.ts`, spike S1).
13
+ */
14
+ declare function machineSignal<S extends object>(store: Store<S>, destroyRef?: DestroyRef): Signal<S>;
15
+
16
+ /** An attribute bag as a core's `connect()` returns it. `null`/`undefined`/`false` remove the attribute; `true` sets it empty. */
17
+ type PropBag = Record<string, string | number | boolean | null | undefined>;
18
+ /**
19
+ * Apply a core's attribute bag to the host element — the Angular stand-in for
20
+ * JSX/Lit/Vue attribute spread. The directive diffs the previous and next bag:
21
+ * a key that disappears is *removed* from the DOM (a stale
22
+ * `aria-activedescendant` would otherwise survive a close), and unchanged keys
23
+ * are not rewritten.
24
+ *
25
+ * Attributes are written through `Renderer2`, so they land in the server-
26
+ * rendered HTML and are re-applied identically after hydration (spike S2 in
27
+ * docs/prd/typeahead-wc-436.md). Consumers never see a bag: the front's own
28
+ * template binds `[mpProps]="api().input"` on its own nodes.
29
+ */
30
+ declare class MpPropsDirective {
31
+ readonly mpProps: i0.InputSignal<PropBag | null | undefined>;
32
+ private readonly element;
33
+ private readonly renderer;
34
+ private applied;
35
+ constructor();
36
+ private apply;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<MpPropsDirective, never>;
38
+ static ɵdir: i0.ɵɵDirectiveDeclaration<MpPropsDirective, "[mpProps]", never, { "mpProps": { "alias": "mpProps"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
39
+ }
40
+
41
+ /**
42
+ * Install a core's scoped stylesheet from an Angular front. In the browser it
43
+ * goes through the shared registry (`installLightStyles`: once per key,
44
+ * cross-bundle safe). On the server the registry cannot run, so the marker
45
+ * `<style data-mp-light-styles="<key>">` is written straight into the
46
+ * request's `DOCUMENT` head — the client registry then treats it as already
47
+ * installed. No string post-processing of the response is involved.
48
+ *
49
+ * Call from the component's constructor (an injection context).
50
+ */
51
+ declare function useScopedStyles(key: string, cssText: string): void;
52
+
53
+ export { MpPropsDirective, machineSignal, useScopedStyles };
54
+ export type { PropBag };
@@ -1,40 +1,149 @@
1
+ import * as _mintplayer_ui_core_typeahead from '@mintplayer/ui-core/typeahead';
2
+ import { TypeaheadRequest, TypeaheadMachine } from '@mintplayer/ui-core/typeahead';
3
+ export { TypeaheadLabels, TypeaheadProvider, TypeaheadRequest, inMemoryTypeaheadProvider } from '@mintplayer/ui-core/typeahead';
1
4
  import * as _angular_core from '@angular/core';
2
- import { ElementRef } from '@angular/core';
3
- import { BsRovingFocusDirective } from '@mintplayer/ng-bootstrap/a11y';
5
+ import { TemplateRef } from '@angular/core';
6
+ import { ControlValueAccessor } from '@angular/forms';
7
+ import { Observable } from 'rxjs';
4
8
 
5
- declare class BsTypeaheadComponent {
6
- private announcer;
7
- isOpen: _angular_core.ModelSignal<boolean>;
9
+ /** The context of a `*bsTypeaheadItem` template: the item and the current term (for highlighting). */
10
+ interface BsTypeaheadItemContext<T = unknown> {
11
+ $implicit: T;
12
+ term: string;
13
+ }
14
+ /**
15
+ * Renders one suggestion row. Declared inside `<bs-typeahead>`; absent, the
16
+ * row shows the item's text (`itemText`).
17
+ *
18
+ * ```html
19
+ * <bs-typeahead [provider]="streets">
20
+ * <ng-container *bsTypeaheadItem="let street; let term = term; of: streetList">
21
+ * {{ street.name }} <small>{{ street.municipality }}</small>
22
+ * </ng-container>
23
+ * </bs-typeahead>
24
+ * ```
25
+ *
26
+ * `of:` is optional and only carries the item type into the template (like
27
+ * `ngFor`'s `of`); pass any value of the item type or an array of it.
28
+ */
29
+ declare class BsTypeaheadItemDirective<T = unknown> {
30
+ readonly templateRef: TemplateRef<BsTypeaheadItemContext<T>>;
31
+ /** Type carrier only; never read at runtime. */
32
+ readonly bsTypeaheadItemOf: _angular_core.InputSignal<T | readonly T[] | null | undefined>;
33
+ static ngTemplateContextGuard<T>(_dir: BsTypeaheadItemDirective<T>, ctx: unknown): ctx is BsTypeaheadItemContext<T>;
34
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BsTypeaheadItemDirective<any>, never>;
35
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BsTypeaheadItemDirective<any>, "[bsTypeaheadItem]", never, { "bsTypeaheadItemOf": { "alias": "bsTypeaheadItemOf"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
36
+ }
37
+
38
+ /**
39
+ * An Angular provider may answer with a Promise or an Observable. An
40
+ * Observable is unsubscribed when `request.signal` aborts, which cancels an
41
+ * `HttpClient` request in flight.
42
+ */
43
+ type BsTypeaheadProvider<T> = (term: string, request: TypeaheadRequest) => Promise<readonly T[]> | Observable<readonly T[]>;
44
+ /**
45
+ * Typeahead: a text input with asynchronous suggestions and free text.
46
+ *
47
+ * The first component built on the headless-core architecture (#436): all
48
+ * behaviour lives in `TypeaheadMachine` (`@mintplayer/ui-core/typeahead`); this
49
+ * component renders its own Angular template from the machine's snapshot and
50
+ * applies the core's ARIA bags with `[mpProps]`. Because it is an Angular
51
+ * template, Angular SSR emits a real, named `<input>` that submits free text
52
+ * with JavaScript disabled, and hydration attaches to that same node.
53
+ *
54
+ * Value = the term (string). `selectedItem()` holds the last picked item until
55
+ * the text changes. Usable with `[(value)]`, `[(ngModel)]`, `formControlName`.
56
+ */
57
+ declare class BsTypeaheadComponent<T = unknown> implements ControlValueAccessor {
58
+ /** Supplies suggestions for a settled term; a newer term aborts the previous request. */
59
+ readonly provider: _angular_core.InputSignal<BsTypeaheadProvider<T> | null>;
60
+ /** Quiet time after the last keystroke, ms. 0 requests synchronously. */
61
+ readonly debounceMs: _angular_core.InputSignal<number>;
62
+ /** A trimmed term shorter than this closes the list without querying. */
63
+ readonly minLength: _angular_core.InputSignal<number>;
64
+ readonly disabled: _angular_core.InputSignal<boolean>;
65
+ /** The text a pick writes into the input. Default: `item.text`, else `String(item)`. */
66
+ readonly itemText: _angular_core.InputSignal<((item: T) => string) | undefined>;
67
+ /** Row identity for keyed rendering. Default: `itemText`. */
68
+ readonly itemKey: _angular_core.InputSignal<((item: T) => unknown) | undefined>;
69
+ /** Submitted with a native `<form>` under this name (also with JavaScript disabled). */
70
+ readonly name: _angular_core.InputSignal<string | null>;
71
+ /** Accessible name of the input. A host `aria-label` or `aria-labelledby` wins. */
72
+ readonly inputLabel: _angular_core.InputSignal<string | null>;
73
+ readonly loadingLabel: _angular_core.InputSignal<string | undefined>;
74
+ readonly noResultsLabel: _angular_core.InputSignal<string | undefined>;
75
+ /** Spoken once per settled request, e.g. `n => n + ' resultaten'`. */
76
+ readonly resultsLabel: _angular_core.InputSignal<((count: number) => string) | undefined>;
77
+ /** A persistent validation message, wired to the input with aria-errormessage. */
78
+ readonly errorText: _angular_core.InputSignal<string | null>;
79
+ /** The term. Two-way; also the ControlValueAccessor value. */
80
+ readonly value: _angular_core.ModelSignal<string>;
81
+ readonly select: _angular_core.OutputEmitterRef<T>;
82
+ readonly submitted: _angular_core.OutputEmitterRef<string>;
83
+ readonly opened: _angular_core.OutputEmitterRef<void>;
84
+ readonly closed: _angular_core.OutputEmitterRef<void>;
85
+ readonly loadError: _angular_core.OutputEmitterRef<unknown>;
86
+ readonly itemTemplate: _angular_core.Signal<BsTypeaheadItemDirective<T> | undefined>;
87
+ private readonly inputRef;
88
+ readonly id: string;
8
89
  /**
9
- * Accessible name for the text input. Optional — a consumer wrapping the
10
- * typeahead in bs-floating-label gets a real <label> association instead —
11
- * but without either the control is unnamed.
90
+ * Host transparency: a consumer's `aria-*`, `id` and `tabindex` on
91
+ * `<bs-typeahead>` land on the role-bearing input (`id` and `tabindex` are
92
+ * moved, so no duplicate id and no dead tab stop on the host). A consumer
93
+ * `role` is NOT forwarded: the input's role is `combobox` by contract. Read
94
+ * once, in the constructor, so the server render carries them too.
12
95
  */
13
- inputLabel: _angular_core.InputSignal<string | null>;
14
- suggestions: _angular_core.InputSignal<any[]>;
15
- isLoading: _angular_core.WritableSignal<boolean>;
16
- showNoSuggestions: _angular_core.Signal<boolean>;
17
- readonly textbox: _angular_core.Signal<ElementRef<HTMLInputElement>>;
18
- readonly rovingFocus: _angular_core.Signal<BsRovingFocusDirective | undefined>;
19
- searchterm: _angular_core.ModelSignal<string>;
20
- isLoadingText: _angular_core.InputSignal<string>;
21
- noSuggestionsText: _angular_core.InputSignal<string>;
22
- resultsAnnouncementSingular: _angular_core.InputSignal<string>;
23
- resultsAnnouncementPlural: _angular_core.InputSignal<(count: number) => string>;
24
- provideSuggestions: _angular_core.OutputEmitterRef<string>;
25
- suggestionSelected: _angular_core.OutputEmitterRef<any>;
26
- submitted: _angular_core.OutputEmitterRef<string>;
27
- private requestInFlight;
96
+ private readonly hostAria;
97
+ readonly machine: TypeaheadMachine<T>;
98
+ readonly state: _angular_core.Signal<_mintplayer_ui_core_typeahead.TypeaheadState<T>>;
99
+ readonly api: _angular_core.Signal<{
100
+ input: {
101
+ [x: string]: string | boolean | null;
102
+ };
103
+ root: _mintplayer_ui_core_typeahead.AttrBag;
104
+ listbox: _mintplayer_ui_core_typeahead.AttrBag;
105
+ status: {
106
+ attrs: _mintplayer_ui_core_typeahead.AttrBag;
107
+ text: string;
108
+ } | null;
109
+ option(index: number): _mintplayer_ui_core_typeahead.AttrBag;
110
+ live: {
111
+ attrs: _mintplayer_ui_core_typeahead.AttrBag;
112
+ text: string;
113
+ };
114
+ error: {
115
+ attrs: _mintplayer_ui_core_typeahead.AttrBag;
116
+ text: string;
117
+ } | null;
118
+ }>;
119
+ /** The last picked item, `null` once the text changes after the pick. */
120
+ readonly selectedItem: _angular_core.Signal<T | null>;
121
+ private readonly disabledByCva;
122
+ private onChange;
123
+ private onTouched;
28
124
  constructor();
29
- private announceResults;
30
- onProvideSuggestions(value: string): void;
31
- suggestionClicked(suggestion: any): void;
32
- onActivate(): void;
33
- onCancel(): void;
34
- onSubmit(event?: Event): void;
125
+ /**
126
+ * Text typed or pasted into the server-rendered input before hydration lives
127
+ * only in the DOM. Hydration's [value] binding would overwrite it with the
128
+ * empty term, and the replayed input event then reads the empty field, so it
129
+ * is lost. Read it here, while the host still holds the server DOM, and keep
130
+ * it as the term; once effects have configured the provider, re-enter it as a
131
+ * typed term so it notifies the model and queries.
132
+ */
133
+ private adoptPreHydrationText;
134
+ protected onInput(event: Event): void;
135
+ protected onKeydown(event: KeyboardEvent): void;
136
+ protected onBlur(): void;
137
+ protected trackItem: (index: number, item: T) => unknown;
138
+ /** Focus the input. */
35
139
  focus(): void;
36
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<BsTypeaheadComponent, never>;
37
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<BsTypeaheadComponent, "bs-typeahead", never, { "isOpen": { "alias": "isOpen"; "required": false; "isSignal": true; }; "inputLabel": { "alias": "inputLabel"; "required": false; "isSignal": true; }; "suggestions": { "alias": "suggestions"; "required": false; "isSignal": true; }; "searchterm": { "alias": "searchterm"; "required": false; "isSignal": true; }; "isLoadingText": { "alias": "isLoadingText"; "required": false; "isSignal": true; }; "noSuggestionsText": { "alias": "noSuggestionsText"; "required": false; "isSignal": true; }; "resultsAnnouncementSingular": { "alias": "resultsAnnouncementSingular"; "required": false; "isSignal": true; }; "resultsAnnouncementPlural": { "alias": "resultsAnnouncementPlural"; "required": false; "isSignal": true; }; }, { "isOpen": "isOpenChange"; "searchterm": "searchtermChange"; "provideSuggestions": "provideSuggestions"; "suggestionSelected": "suggestionSelected"; "submitted": "submitted"; }, never, never, true, never>;
140
+ writeValue(value: string | null): void;
141
+ registerOnChange(fn: (value: string) => void): void;
142
+ registerOnTouched(fn: () => void): void;
143
+ setDisabledState(isDisabled: boolean): void;
144
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BsTypeaheadComponent<any>, never>;
145
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<BsTypeaheadComponent<any>, "bs-typeahead", never, { "provider": { "alias": "provider"; "required": false; "isSignal": true; }; "debounceMs": { "alias": "debounceMs"; "required": false; "isSignal": true; }; "minLength": { "alias": "minLength"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "itemText": { "alias": "itemText"; "required": false; "isSignal": true; }; "itemKey": { "alias": "itemKey"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "inputLabel": { "alias": "inputLabel"; "required": false; "isSignal": true; }; "loadingLabel": { "alias": "loadingLabel"; "required": false; "isSignal": true; }; "noResultsLabel": { "alias": "noResultsLabel"; "required": false; "isSignal": true; }; "resultsLabel": { "alias": "resultsLabel"; "required": false; "isSignal": true; }; "errorText": { "alias": "errorText"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "select": "select"; "submitted": "submitted"; "opened": "opened"; "closed": "closed"; "loadError": "loadError"; }, ["itemTemplate"], never, true, never>;
38
146
  }
39
147
 
40
- export { BsTypeaheadComponent };
148
+ export { BsTypeaheadComponent, BsTypeaheadItemDirective };
149
+ export type { BsTypeaheadItemContext, BsTypeaheadProvider };