@acorex/components 22.1.0-next.1 → 22.1.0-next.2

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.
@@ -18,15 +18,23 @@ interface AXComboBoxItem {
18
18
  text: string;
19
19
  value: string | number;
20
20
  }
21
+ /**
22
+ * The combo box model value: a scalar (or `null`) in single-select mode,
23
+ * or an array of scalars in multi-select mode.
24
+ */
25
+ type AXComboBoxValue = string | number | (string | number)[] | null;
21
26
 
22
27
  /**
23
- * A minimal combo box for selecting a single value from a list of items.
28
+ * A minimal combo box for selecting one or more values from a list of items.
24
29
  *
25
30
  * Built on top of the `@angular/aria/combobox` directives, it supports two behaviors:
26
31
  * - `searchable="true"` (default): an input with typeahead filtering (matches `id`).
27
32
  * - `searchable="false"`: a select-like, non-editable trigger (same input; typing blocked without
28
33
  * Combobox `readonly`, so Tab focus and keyboard open/select keep working).
29
34
  *
35
+ * With `multiple="true"`, selected values are shown as chips in the trigger and the popup stays
36
+ * open while toggling items (same interaction model as `ax-lookup` multi-select).
37
+ *
30
38
  * With `adaptivityEnabled` (default `true`), the list opens as a bottom actionsheet on small
31
39
  * screens instead of an anchored dropdown — the same alternate presentation as `ax-select-box`.
32
40
  *
@@ -36,7 +44,7 @@ interface AXComboBoxItem {
36
44
  *
37
45
  * @category Components
38
46
  */
39
- declare class AXComboBoxComponent extends NXComponent implements FormValueControl<string | number | null> {
47
+ declare class AXComboBoxComponent extends NXComponent implements FormValueControl<AXComboBoxValue> {
40
48
  #private;
41
49
  /**
42
50
  * The list of items the user can select from.
@@ -48,6 +56,11 @@ declare class AXComboBoxComponent extends NXComponent implements FormValueContro
48
56
  * or is a select-like, non-editable trigger (`false`).
49
57
  */
50
58
  searchable: _angular_core.InputSignal<boolean>;
59
+ /**
60
+ * When `true`, multiple items can be selected. Selected values are shown as chips and the
61
+ * popup stays open while toggling. The model value is an array (`[]` when empty).
62
+ */
63
+ multiple: _angular_core.InputSignal<boolean>;
51
64
  /**
52
65
  * When `true` (default), the popup list uses the alternate actionsheet presentation on small
53
66
  * screens (`SM`). When `false`, the list always opens as an anchored dropdown.
@@ -65,6 +78,11 @@ declare class AXComboBoxComponent extends NXComponent implements FormValueContro
65
78
  * The placeholder text shown when no value is selected.
66
79
  */
67
80
  placeholder: _angular_core.InputSignal<string>;
81
+ /**
82
+ * Placeholder for the trigger search input when items are already selected (multi-select).
83
+ * Falls back to `placeholder` when the selection is empty.
84
+ */
85
+ searchPlaceholder: _angular_core.InputSignal<string>;
68
86
  /**
69
87
  * Custom template rendered when the filtered list has no items.
70
88
  * When omitted, a default "no result found" message is shown.
@@ -80,6 +98,7 @@ declare class AXComboBoxComponent extends NXComponent implements FormValueContro
80
98
  * Context: `{ $implicit: AXComboBoxItem }`.
81
99
  * When `searchable` is true, the template is shown while the popup is closed and the input
82
100
  * still reflects the selected text; typing/opening falls back to the plain input.
101
+ * In multi-select mode, the template replaces the chip text for each selected item.
83
102
  */
84
103
  selectedTemplate: _angular_core.InputSignal<TemplateRef<unknown>>;
85
104
  /**
@@ -95,14 +114,14 @@ declare class AXComboBoxComponent extends NXComponent implements FormValueContro
95
114
  */
96
115
  look: _angular_core.ModelSignal<AXStyleLookType>;
97
116
  /**
98
- * The selected item's `value`. Supports `[(value)]`, `[(ngModel)]`, and signal forms
99
- * via {@link FormValueControl}.
117
+ * The selected item `value`(s). Scalar (or `null`) in single mode; an array in multi mode.
118
+ * Supports `[(value)]`, `[(ngModel)]`, and signal forms via {@link FormValueControl}.
100
119
  */
101
- readonly value: _angular_core.ModelSignal<string | number>;
120
+ readonly value: _angular_core.ModelSignal<AXComboBoxValue>;
102
121
  /**
103
122
  * Emitted when the selected value changes.
104
123
  */
105
- onValueChanged: _angular_core.OutputEmitterRef<AXValueChangedEvent<string | number>>;
124
+ onValueChanged: _angular_core.OutputEmitterRef<AXValueChangedEvent<AXComboBoxValue>>;
106
125
  /**
107
126
  * Emitted when the trigger receives focus.
108
127
  */
@@ -131,15 +150,26 @@ declare class AXComboBoxComponent extends NXComponent implements FormValueContro
131
150
  protected expanded: _angular_core.WritableSignal<boolean>;
132
151
  /** Whether the list is currently shown as a bottom actionsheet (small screens + adaptivity). */
133
152
  protected isActionsheetStyle: _angular_core.WritableSignal<boolean>;
134
- /** The item whose `value` matches the current model value. */
153
+ /** The current selection normalized to an array of submitted values. */
154
+ protected selectedValues: _angular_core.Signal<(string | number)[]>;
155
+ /** Whether there is at least one selected value. */
156
+ protected hasSelection: _angular_core.Signal<boolean>;
157
+ /** Resolved selected items for the current model value(s). */
158
+ protected selectedItems: _angular_core.Signal<AXComboBoxItem[]>;
159
+ /** The item whose `value` matches the current model value (single-select). */
135
160
  protected selectedItem: _angular_core.Signal<AXComboBoxItem>;
136
- /** Display text shown in the trigger / used as the searchable input baseline. */
161
+ /** Display text shown in the trigger / used as the searchable input baseline (single-select). */
137
162
  protected displayText: _angular_core.Signal<string>;
138
- /** The text typed in the searchable input. Resets to the selected item's text. */
163
+ /**
164
+ * The text typed in the searchable input.
165
+ * Multi-select starts empty; single mode syncs from the selected display text.
166
+ */
139
167
  protected searchText: _angular_core.WritableSignal<string>;
140
168
  /** Whether the trigger should render `selectedTemplate` instead of the plain input text. */
141
169
  protected showSelectedTemplate: _angular_core.Signal<boolean>;
142
- /** The listbox selection (item ids), kept in sync with the selected value. */
170
+ /** Placeholder for the editable trigger search input in multi-select. */
171
+ protected triggerSearchPlaceholder: _angular_core.Signal<string>;
172
+ /** The listbox selection (item ids), kept in sync with the selected value(s). */
143
173
  protected selection: _angular_core.WritableSignal<string[]>;
144
174
  /** Items filtered by typed query against `id` when the combo box is searchable. */
145
175
  protected filteredItems: _angular_core.Signal<AXComboBoxItem[]>;
@@ -149,13 +179,16 @@ declare class AXComboBoxComponent extends NXComponent implements FormValueContro
149
179
  constructor();
150
180
  /** Stable unique key for `@for` — avoids NG0955 when `id` is missing or duplicated. */
151
181
  protected trackItemKey(index: number, item: AXComboBoxItem): string;
182
+ /** Whether the given item is currently selected. */
183
+ protected isItemSelected(item: AXComboBoxItem): boolean;
152
184
  /**
153
185
  * Opens (searchable) or toggles (non-searchable) the popup on trigger click.
154
186
  */
155
187
  protected onTriggerClick(): void;
156
188
  /**
157
- * Non-searchable keyboard: open with Enter/Space when collapsed; commit with Space when expanded.
158
- * (Aria relays Enter for editable inputs, but not Space.)
189
+ * Keyboard handling on the trigger:
190
+ * - Non-searchable: open with Enter/Space when collapsed; commit with Space when expanded.
191
+ * - Multi-select: Backspace removes the last chip when the search input is empty.
159
192
  */
160
193
  protected onTriggerKeydown(event: KeyboardEvent): void;
161
194
  /** Blocks typing in non-searchable mode without Combobox `readonly` (keeps Tab/keyboard working). */
@@ -165,8 +198,12 @@ declare class AXComboBoxComponent extends NXComponent implements FormValueContro
165
198
  */
166
199
  protected onPopoverClosed(): void;
167
200
  /**
168
- * Clears the selected value (sets it to `null`) and closes the popup.
169
- * Used by projected `ax-clear-button`.
201
+ * Removes a single chip from the multi selection.
202
+ */
203
+ protected removeChip(event: Event, item: AXComboBoxItem): void;
204
+ /**
205
+ * Clears the selected value(s) and closes the popup.
206
+ * Sets `null` in single mode and `[]` in multi mode. Used by projected `ax-clear-button`.
170
207
  *
171
208
  * @param isUserInteraction - Whether the clear was triggered by the user.
172
209
  */
@@ -180,10 +217,12 @@ declare class AXComboBoxComponent extends NXComponent implements FormValueContro
180
217
  */
181
218
  closeAll(): void;
182
219
  /**
183
- * Commits the highlighted (active) or clicked list item as the component value and closes the popup.
220
+ * Commits the highlighted (active) or clicked list item as the component value.
184
221
  *
185
222
  * With `selectionMode="explicit"`, arrow keys only move the active item; Enter/Space must resolve
186
223
  * that option. Clicks resolve from the event target so we do not depend on listener order vs ngListbox.
224
+ *
225
+ * In multi-select mode the item is toggled and the popup stays open.
187
226
  */
188
227
  protected commit(event?: Event): void;
189
228
  /** Forwards native focus from the trigger input. */
@@ -191,7 +230,7 @@ declare class AXComboBoxComponent extends NXComponent implements FormValueContro
191
230
  /** Forwards native blur from the trigger input. */
192
231
  protected emitOnBlur(e: FocusEvent): void;
193
232
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXComboBoxComponent, never>;
194
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXComboBoxComponent, "ax-combo-box", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; "adaptivityEnabled": { "alias": "adaptivityEnabled"; "required": false; "isSignal": true; }; "caption": { "alias": "caption"; "required": false; "isSignal": true; }; "alternate": { "alias": "alternate"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "emptyTemplate": { "alias": "emptyTemplate"; "required": false; "isSignal": true; }; "itemTemplate": { "alias": "itemTemplate"; "required": false; "isSignal": true; }; "selectedTemplate": { "alias": "selectedTemplate"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "look": { "alias": "look"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "look": "lookChange"; "value": "valueChange"; "onValueChanged": "onValueChanged"; "onFocus": "onFocus"; "onBlur": "onBlur"; "onItemClick": "onItemClick"; "onItemSelected": "onItemSelected"; "onOpened": "onOpened"; "onClosed": "onClosed"; }, never, ["ax-prefix", "ax-clear-button", "ax-suffix", "ax-header", "ax-footer"], true, never>;
233
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXComboBoxComponent, "ax-combo-box", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "adaptivityEnabled": { "alias": "adaptivityEnabled"; "required": false; "isSignal": true; }; "caption": { "alias": "caption"; "required": false; "isSignal": true; }; "alternate": { "alias": "alternate"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; "emptyTemplate": { "alias": "emptyTemplate"; "required": false; "isSignal": true; }; "itemTemplate": { "alias": "itemTemplate"; "required": false; "isSignal": true; }; "selectedTemplate": { "alias": "selectedTemplate"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "look": { "alias": "look"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "look": "lookChange"; "value": "valueChange"; "onValueChanged": "onValueChanged"; "onFocus": "onFocus"; "onBlur": "onBlur"; "onItemClick": "onItemClick"; "onItemSelected": "onItemSelected"; "onOpened": "onOpened"; "onClosed": "onClosed"; }, never, ["ax-prefix", "ax-clear-button", "ax-suffix", "ax-header", "ax-footer"], true, never>;
195
234
  }
196
235
 
197
236
  declare class AXComboBoxModule {
@@ -201,4 +240,4 @@ declare class AXComboBoxModule {
201
240
  }
202
241
 
203
242
  export { AXComboBoxComponent, AXComboBoxModule };
204
- export type { AXComboBoxItem };
243
+ export type { AXComboBoxItem, AXComboBoxValue };
@@ -12,7 +12,7 @@ import { Observable } from 'rxjs';
12
12
  import * as i1 from '@angular/common';
13
13
  import * as i3 from '@angular/forms';
14
14
  import * as i4 from '@acorex/components/check-box';
15
- import * as i5 from '@acorex/components/badge';
15
+ import * as i5 from '@acorex/components/tag';
16
16
  import * as i6 from '@acorex/components/decorators';
17
17
  import * as i7 from '@acorex/core/translation';
18
18
  import * as i8 from '@acorex/components/popover';
@@ -197,7 +197,7 @@ declare class AXSelectBoxComponent extends AXSelectBoxComponent_base implements
197
197
  */
198
198
  declare class AXSelectBoxModule {
199
199
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXSelectBoxModule, never>;
200
- static ɵmod: _angular_core.ɵɵNgModuleDeclaration<AXSelectBoxModule, never, [typeof i1.CommonModule, typeof i2.AXCommonModule, typeof i3.FormsModule, typeof i4.AXCheckBoxModule, typeof i5.AXBadgeModule, typeof i6.AXDecoratorModule, typeof i7.AXTranslationModule, typeof i8.AXPopoverModule, typeof i9.AXLoadingModule, typeof i10.A11yModule, typeof i11.AXTextBoxModule, typeof i12.AXDropdownModule, typeof i13.AXListModule, typeof AXSelectBoxComponent], [typeof AXSelectBoxComponent]>;
200
+ static ɵmod: _angular_core.ɵɵNgModuleDeclaration<AXSelectBoxModule, never, [typeof i1.CommonModule, typeof i2.AXCommonModule, typeof i3.FormsModule, typeof i4.AXCheckBoxModule, typeof i5.AXTagModule, typeof i6.AXDecoratorModule, typeof i7.AXTranslationModule, typeof i8.AXPopoverModule, typeof i9.AXLoadingModule, typeof i10.A11yModule, typeof i11.AXTextBoxModule, typeof i12.AXDropdownModule, typeof i13.AXListModule, typeof AXSelectBoxComponent], [typeof AXSelectBoxComponent]>;
201
201
  static ɵinj: _angular_core.ɵɵInjectorDeclaration<AXSelectBoxModule>;
202
202
  }
203
203