@spartan-ng/brain 0.0.1-alpha.608 → 0.0.1-alpha.609

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,7 +1,9 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { InjectionToken, Type, ExistingProvider } from '@angular/core';
2
+ import { InputSignal, ModelSignal, Signal, InjectionToken, Type, ExistingProvider, ValueProvider } from '@angular/core';
3
3
  import { Highlightable, ActiveDescendantKeyManager } from '@angular/cdk/a11y';
4
4
  import { BooleanInput } from '@angular/cdk/coercion';
5
+ import { ControlValueAccessor } from '@angular/forms';
6
+ import { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';
5
7
 
6
8
  declare class BrnAutocompleteItem<T> implements Highlightable {
7
9
  private static _id;
@@ -13,101 +15,261 @@ declare class BrnAutocompleteItem<T> implements Highlightable {
13
15
  readonly id: _angular_core.InputSignal<string>;
14
16
  /** The value this item represents. */
15
17
  readonly value: _angular_core.InputSignal<T>;
16
- /** Whether the item is disabled. */
17
18
  readonly _disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
18
19
  /** Expose disabled as a value - used by the Highlightable interface */
19
20
  get disabled(): boolean;
20
21
  /** Whether the item is selected. */
21
- protected readonly _active: _angular_core.WritableSignal<boolean>;
22
- /** Emits when the item is selected. */
23
- readonly selected: _angular_core.OutputEmitterRef<void>;
24
- /** @internal Get the display value */
25
- getLabel(): string;
26
- /** @internal */
22
+ readonly active: _angular_core.Signal<boolean>;
23
+ protected readonly _highlighted: _angular_core.WritableSignal<boolean>;
27
24
  setActiveStyles(): void;
28
- /** @internal */
29
25
  setInactiveStyles(): void;
30
- protected onClick(): void;
26
+ getLabel(): string;
27
+ protected select(): void;
31
28
  protected activate(): void;
32
29
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteItem<any>, never>;
33
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteItem<any>, "button[brnAutocompleteItem]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": true; "isSignal": true; }; "_disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "selected": "selected"; }, never, never, true, never>;
30
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteItem<any>, "[brnAutocompleteItem]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": true; "isSignal": true; }; "_disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
34
31
  }
35
32
 
36
- declare class BrnAutocomplete<T> {
37
- private static _id;
33
+ interface BrnAutocompleteBase<T> {
34
+ itemToString: InputSignal<AutocompleteItemToString<T> | undefined>;
35
+ search: ModelSignal<string>;
36
+ disabled: Signal<boolean>;
37
+ disabledState: Signal<boolean>;
38
+ keyManager: ActiveDescendantKeyManager<BrnAutocompleteItem<T>>;
39
+ value: ModelSignal<T | null> | ModelSignal<string | null>;
40
+ visibleItems: Signal<boolean>;
41
+ isExpanded: Signal<boolean>;
42
+ searchInputWrapperWidth: Signal<number | null>;
43
+ updateSearch: (value: string) => void;
44
+ isSelected: (itemValue: T) => boolean;
45
+ select: (itemValue: T) => void;
46
+ open: () => void;
47
+ resetValue: () => void;
48
+ /** Select the active item with Enter key. */
49
+ selectActiveItem: () => void;
50
+ }
51
+ declare const BrnAutocompleteBaseToken: InjectionToken<BrnAutocompleteBase<unknown>>;
52
+ declare function provideBrnAutocompleteBase<T>(autocomplete: Type<BrnAutocompleteBase<T>>): ExistingProvider;
53
+ declare function injectBrnAutocompleteBase<T>(): BrnAutocompleteBase<T>;
54
+ type AutocompleteItemEqualToValue<T> = (itemValue: T, selectedValue: T | null) => boolean;
55
+ type AutocompleteItemToString<T> = (itemValue: T) => string;
56
+ interface BrnAutocompleteConfig<T> {
57
+ isItemEqualToValue: AutocompleteItemEqualToValue<T>;
58
+ itemToString?: AutocompleteItemToString<T>;
59
+ }
60
+ declare function provideBrnAutocompleteConfig<T>(config: Partial<BrnAutocompleteConfig<T>>): ValueProvider;
61
+ declare function injectBrnAutocompleteConfig<T>(): BrnAutocompleteConfig<T>;
62
+
63
+ declare const BRN_AUTOCOMPLETE_VALUE_ACCESSOR: {
64
+ provide: _angular_core.InjectionToken<readonly ControlValueAccessor[]>;
65
+ useExisting: _angular_core.Type<any>;
66
+ multi: boolean;
67
+ };
68
+ declare class BrnAutocomplete<T> implements BrnAutocompleteBase<T>, ControlValueAccessor {
38
69
  private readonly _injector;
39
- /** The id of the autocomplete */
40
- readonly id: _angular_core.InputSignal<string>;
41
- /** when the selection has changed */
42
- readonly valueChange: _angular_core.OutputEmitterRef<T>;
43
- /** when the selection has been cleared */
44
- readonly selectionCleared: _angular_core.OutputEmitterRef<void>;
70
+ private readonly _config;
45
71
  /** Access the popover if present */
46
72
  private readonly _brnPopover;
47
- /** @internal The focus strategy when opening */
48
- private readonly _focus;
73
+ /** Whether the autocomplete is disabled */
74
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
75
+ protected readonly _disabled: _angular_core.WritableSignal<boolean>;
76
+ /** @internal The disabled state as a readonly signal */
77
+ readonly disabledState: _angular_core.Signal<boolean>;
78
+ /** A function to compare an item with the selected value. */
79
+ readonly isItemEqualToValue: _angular_core.InputSignal<AutocompleteItemEqualToValue<T>>;
80
+ /** A function to convert an item to a string for display. */
81
+ readonly itemToString: _angular_core.InputSignal<AutocompleteItemToString<T> | undefined>;
82
+ /** The selected value of the autocomplete. */
83
+ readonly value: _angular_core.ModelSignal<T | null>;
84
+ /** The current search query. */
85
+ readonly search: _angular_core.ModelSignal<string>;
86
+ private readonly _searchInputWrapper;
87
+ /** @internal The width of the search input wrapper */
88
+ readonly searchInputWrapperWidth: _angular_core.Signal<number | null>;
49
89
  /** @internal Access all the items within the autocomplete */
50
90
  readonly items: _angular_core.Signal<readonly BrnAutocompleteItem<T>[]>;
91
+ /** Determine if the autocomplete has any visible items */
92
+ readonly visibleItems: _angular_core.Signal<boolean>;
51
93
  /** @internal The key manager for managing active descendant */
52
94
  readonly keyManager: ActiveDescendantKeyManager<BrnAutocompleteItem<T>>;
53
95
  /** @internal Whether the autocomplete is expanded */
54
96
  readonly isExpanded: _angular_core.Signal<boolean>;
97
+ protected _onChange?: ChangeFn<T | null>;
98
+ protected _onTouched?: TouchFn;
55
99
  constructor();
56
- protected selectActiveItem(): void;
57
- open(focus?: 'first' | 'last'): void;
100
+ updateSearch(value: string): void;
101
+ isSelected(itemValue: T): boolean;
102
+ select(itemValue: T): void;
103
+ /** Select the active item with Enter key. */
104
+ selectActiveItem(): void;
105
+ resetValue(): void;
106
+ open(): void;
58
107
  close(): void;
59
108
  toggle(): void;
109
+ /** CONTROL VALUE ACCESSOR */
110
+ writeValue(value: T | null): void;
111
+ registerOnChange(fn: ChangeFn<T | null>): void;
112
+ registerOnTouched(fn: TouchFn): void;
113
+ setDisabledState(isDisabled: boolean): void;
60
114
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocomplete<any>, never>;
61
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocomplete<any>, "[brnAutocomplete]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "selectionCleared": "selectionCleared"; }, ["items"], never, true, never>;
115
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocomplete<any>, "[brnAutocomplete]", never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "isItemEqualToValue": { "alias": "isItemEqualToValue"; "required": false; "isSignal": true; }; "itemToString": { "alias": "itemToString"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "search": { "alias": "search"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "search": "searchChange"; }, ["_searchInputWrapper", "items"], never, true, never>;
62
116
  }
63
117
 
64
- declare class BrnAutocompleteEmpty {
118
+ declare class BrnAutocompleteAnchor {
119
+ private readonly _host;
120
+ private readonly _brnDialog;
121
+ constructor();
122
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteAnchor, never>;
123
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteAnchor, "[brnAutocompleteAnchor]", never, {}, {}, never, never, true, never>;
124
+ }
125
+
126
+ declare class BrnAutocompleteClear {
127
+ private readonly _autocomplete;
128
+ private readonly _renderer;
65
129
  private readonly _templateRef;
66
130
  private readonly _viewContainerRef;
67
- private readonly _autocomplete;
68
- /** Determine if the autocomplete has any items */
69
- private readonly _visible;
131
+ /** Determine if the combobox has a value */
132
+ private readonly _hasValue;
70
133
  constructor();
134
+ clear(): void;
135
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteClear, never>;
136
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteClear, "[brnAutocompleteClear]", never, {}, {}, never, never, true, never>;
137
+ }
138
+
139
+ declare class BrnAutocompleteContent {
140
+ private readonly _autocomplete;
141
+ /** Determine if the autocomplete has any visible items */
142
+ protected readonly _visibleItems: _angular_core.Signal<boolean>;
143
+ protected readonly _autocompleteWidth: _angular_core.Signal<number | null>;
144
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteContent, never>;
145
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteContent, "[brnAutocompleteContent]", never, {}, {}, never, never, true, never>;
146
+ }
147
+
148
+ declare class BrnAutocompleteEmpty {
71
149
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteEmpty, never>;
72
150
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteEmpty, "[brnAutocompleteEmpty]", never, {}, {}, never, never, true, never>;
73
151
  }
74
152
 
75
153
  declare class BrnAutocompleteGroup {
154
+ /** Get the items in the group */
155
+ private readonly _items;
156
+ /** Determine if there are any visible items in the group */
157
+ protected readonly _visible: _angular_core.Signal<boolean>;
158
+ /** Get the label associated with the group */
159
+ private readonly _label;
160
+ protected readonly _labelledBy: _angular_core.Signal<string | null>;
161
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteGroup, never>;
162
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteGroup, "[brnAutocompleteGroup]", never, {}, {}, ["_items", "_label"], never, true, never>;
163
+ }
164
+
165
+ declare class BrnAutocompleteInput<T> {
76
166
  private static _id;
77
- /** The id of the autocomplete list */
167
+ private readonly _el;
168
+ private readonly _autocomplete;
169
+ /** The id of the autocomplete input */
78
170
  readonly id: _angular_core.InputSignal<string>;
79
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteGroup, never>;
80
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteGroup, "[brnAutocompleteGroup]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
171
+ readonly disabled: _angular_core.Signal<boolean>;
172
+ /** Whether the autocomplete panel is expanded */
173
+ protected readonly _isExpanded: _angular_core.Signal<boolean>;
174
+ constructor();
175
+ protected onInput(event: Event): void;
176
+ protected onKeyDown(event: KeyboardEvent): void;
177
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteInput<any>, never>;
178
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteInput<any>, "input[brnAutocompleteInput]", ["brnAutocompleteInput"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
179
+ }
180
+
181
+ declare class BrnAutocompleteInputWrapper {
182
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteInputWrapper, never>;
183
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteInputWrapper, "[brnAutocompleteInputWrapper]", never, {}, {}, never, never, true, never>;
184
+ }
185
+
186
+ declare class BrnAutocompleteLabel {
187
+ private static _id;
188
+ /** The id of the autocomplete label */
189
+ readonly id: _angular_core.InputSignal<string>;
190
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteLabel, never>;
191
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteLabel, "[brnAutocompleteLabel]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
81
192
  }
82
193
 
83
194
  declare class BrnAutocompleteList {
84
195
  private static _id;
85
- /** The id of the command list */
196
+ private readonly _autocomplete;
197
+ /** Determine if the autocomplete has any visible items */
198
+ protected readonly _visibleItems: _angular_core.Signal<boolean>;
199
+ /** The id of the autocomplete list */
86
200
  readonly id: _angular_core.InputSignal<string>;
87
201
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteList, never>;
88
202
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteList, "[brnAutocompleteList]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
89
203
  }
90
204
 
91
- declare class BrnAutocompleteSearchInput {
92
- private readonly _autocomplete;
93
- /** Whether the autocomplete panel is expanded */
94
- protected readonly _isExpanded: _angular_core.Signal<boolean>;
95
- /** The id of the active option */
96
- protected readonly _activeDescendant: _angular_core.WritableSignal<string | undefined>;
205
+ declare const BRN_AUTOCOMPLETE_SEARCH_VALUE_ACCESSOR: {
206
+ provide: _angular_core.InjectionToken<readonly ControlValueAccessor[]>;
207
+ useExisting: _angular_core.Type<any>;
208
+ multi: boolean;
209
+ };
210
+ declare class BrnAutocompleteSearch<T> implements BrnAutocompleteBase<T>, ControlValueAccessor {
211
+ private readonly _injector;
212
+ private readonly _config;
213
+ /** Access the popover if present */
214
+ private readonly _brnPopover;
215
+ /** Whether the autocomplete is disabled */
216
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
217
+ protected readonly _disabled: _angular_core.WritableSignal<boolean>;
218
+ /** @internal The disabled state as a readonly signal */
219
+ readonly disabledState: _angular_core.Signal<boolean>;
220
+ /** A function to convert an item to a string for display. */
221
+ readonly itemToString: _angular_core.InputSignal<AutocompleteItemToString<T> | undefined>;
222
+ /** The selected value of the autocomplete. */
223
+ readonly value: _angular_core.ModelSignal<string | null>;
224
+ /** The current search query. */
225
+ readonly search: _angular_core.ModelSignal<string>;
226
+ private readonly _searchInputWrapper;
227
+ /** @internal The width of the search input wrapper */
228
+ readonly searchInputWrapperWidth: _angular_core.Signal<number | null>;
229
+ /** @internal Access all the items within the autocomplete */
230
+ readonly items: _angular_core.Signal<readonly BrnAutocompleteItem<T>[]>;
231
+ /** Determine if the autocomplete has any visible items */
232
+ readonly visibleItems: _angular_core.Signal<boolean>;
233
+ /** @internal The key manager for managing active descendant */
234
+ readonly keyManager: ActiveDescendantKeyManager<BrnAutocompleteItem<T>>;
235
+ /** @internal Whether the autocomplete is expanded */
236
+ readonly isExpanded: _angular_core.Signal<boolean>;
237
+ protected _onChange?: ChangeFn<string | null>;
238
+ protected _onTouched?: TouchFn;
97
239
  constructor();
98
- /** Listen for keydown events */
99
- protected onKeyDown(event: KeyboardEvent): void;
100
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteSearchInput, never>;
101
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteSearchInput, "input[brnAutocompleteSearchInput]", never, {}, {}, never, never, true, never>;
240
+ updateSearch(value: string): void;
241
+ isSelected(itemValue: T): boolean;
242
+ select(itemValue: T): void;
243
+ /** Select the active item with Enter key. */
244
+ selectActiveItem(): void;
245
+ resetValue(): void;
246
+ open(): void;
247
+ close(): void;
248
+ toggle(): void;
249
+ /** CONTROL VALUE ACCESSOR */
250
+ writeValue(value: string | null): void;
251
+ registerOnChange(fn: ChangeFn<string | null>): void;
252
+ registerOnTouched(fn: TouchFn): void;
253
+ setDisabledState(isDisabled: boolean): void;
254
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteSearch<any>, never>;
255
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteSearch<any>, "[brnAutocomplete]", never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "itemToString": { "alias": "itemToString"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "search": { "alias": "search"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "search": "searchChange"; }, ["_searchInputWrapper", "items"], never, true, never>;
256
+ }
257
+
258
+ declare class BrnAutocompleteSeparator {
259
+ readonly orientation: _angular_core.InputSignal<"vertical" | "horizontal">;
260
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteSeparator, never>;
261
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteSeparator, "[brnAutocompleteSeparator]", never, { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
262
+ }
263
+
264
+ declare class BrnAutocompleteStatus {
265
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnAutocompleteStatus, never>;
266
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnAutocompleteStatus, "[brnAutocompleteStatus]", never, {}, {}, never, never, true, never>;
102
267
  }
103
268
 
104
269
  declare const BrnAutocompleteItemToken: InjectionToken<BrnAutocompleteItem<unknown>>;
105
270
  declare function provideBrnAutocompleteItem<T>(autocomplete: Type<BrnAutocompleteItem<T>>): ExistingProvider;
106
271
 
107
- declare const BrnAutocompleteToken: InjectionToken<BrnAutocomplete<unknown>>;
108
- declare function provideBrnAutocomplete<T>(autocomplete: Type<BrnAutocomplete<T>>): ExistingProvider;
109
- declare function injectBrnAutocomplete<T>(): BrnAutocomplete<T>;
110
-
111
- declare const BrnAutocompleteImports: readonly [typeof BrnAutocomplete, typeof BrnAutocompleteEmpty, typeof BrnAutocompleteGroup, typeof BrnAutocompleteItem, typeof BrnAutocompleteList, typeof BrnAutocompleteSearchInput];
272
+ declare const BrnAutocompleteImports: readonly [typeof BrnAutocomplete, typeof BrnAutocompleteAnchor, typeof BrnAutocompleteClear, typeof BrnAutocompleteContent, typeof BrnAutocompleteEmpty, typeof BrnAutocompleteGroup, typeof BrnAutocompleteInput, typeof BrnAutocompleteInputWrapper, typeof BrnAutocompleteItem, typeof BrnAutocompleteLabel, typeof BrnAutocompleteList, typeof BrnAutocompleteSearch, typeof BrnAutocompleteSeparator, typeof BrnAutocompleteStatus];
112
273
 
113
- export { BrnAutocomplete, BrnAutocompleteEmpty, BrnAutocompleteGroup, BrnAutocompleteImports, BrnAutocompleteItem, BrnAutocompleteItemToken, BrnAutocompleteList, BrnAutocompleteSearchInput, BrnAutocompleteToken, injectBrnAutocomplete, provideBrnAutocomplete, provideBrnAutocompleteItem };
274
+ export { BRN_AUTOCOMPLETE_SEARCH_VALUE_ACCESSOR, BRN_AUTOCOMPLETE_VALUE_ACCESSOR, BrnAutocomplete, BrnAutocompleteAnchor, BrnAutocompleteBaseToken, BrnAutocompleteClear, BrnAutocompleteContent, BrnAutocompleteEmpty, BrnAutocompleteGroup, BrnAutocompleteImports, BrnAutocompleteInput, BrnAutocompleteInputWrapper, BrnAutocompleteItem, BrnAutocompleteItemToken, BrnAutocompleteLabel, BrnAutocompleteList, BrnAutocompleteSearch, BrnAutocompleteSeparator, BrnAutocompleteStatus, injectBrnAutocompleteBase, injectBrnAutocompleteConfig, provideBrnAutocompleteBase, provideBrnAutocompleteConfig, provideBrnAutocompleteItem };
275
+ export type { AutocompleteItemEqualToValue, AutocompleteItemToString, BrnAutocompleteBase, BrnAutocompleteConfig };