@mintplayer/ng-bootstrap 22.24.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.
Files changed (25) hide show
  1. package/fesm2022/mintplayer-ng-bootstrap-a11y.mjs +27 -48
  2. package/fesm2022/mintplayer-ng-bootstrap-a11y.mjs.map +1 -1
  3. package/fesm2022/mintplayer-ng-bootstrap-badge.mjs +11 -1
  4. package/fesm2022/mintplayer-ng-bootstrap-badge.mjs.map +1 -1
  5. package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs +0 -1
  6. package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs.map +1 -1
  7. package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs +7 -19
  8. package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs.map +1 -1
  9. package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs +6 -160
  10. package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs.map +1 -1
  11. package/fesm2022/mintplayer-ng-bootstrap-machine.mjs +102 -0
  12. package/fesm2022/mintplayer-ng-bootstrap-machine.mjs.map +1 -0
  13. package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs +1 -1
  14. package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs.map +1 -1
  15. package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs +250 -103
  16. package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs.map +1 -1
  17. package/machine/package.json +4 -0
  18. package/package.json +7 -2
  19. package/types/mintplayer-ng-bootstrap-a11y.d.ts +23 -34
  20. package/types/mintplayer-ng-bootstrap-code-snippet.d.ts +0 -1
  21. package/types/mintplayer-ng-bootstrap-datatable.d.ts +7 -0
  22. package/types/mintplayer-ng-bootstrap-dropdown-menu.d.ts +6 -18
  23. package/types/mintplayer-ng-bootstrap-dropdown.d.ts +2 -48
  24. package/types/mintplayer-ng-bootstrap-machine.d.ts +54 -0
  25. package/types/mintplayer-ng-bootstrap-typeahead.d.ts +141 -32
@@ -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 };