@agorapulse/ui-components 22.7.3 → 22.8.1-beta.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.
@@ -3,35 +3,24 @@ import { TemplateRef } from '@angular/core';
3
3
  import * as _floating_ui_utils from '@floating-ui/utils';
4
4
  import { BadgeColor } from '@agorapulse/ui-components/badge';
5
5
  import { DropdownOverlay } from '@agorapulse/ui-components/dropdown-base';
6
+ import { I18nOf } from '@agorapulse/ui-components/i18n';
6
7
  import { agorapulseSymbol, SymbolColor } from '@agorapulse/ui-symbol';
7
8
 
8
9
  interface ActionDropdownItem {
9
10
  /** Unique identifier for the item */
10
11
  name?: string;
11
- /** Display text for the item */
12
- label?: string;
13
- /** Secondary text displayed below the label */
14
- description?: string;
15
- /** Text displayed in a badge next to the item */
16
- badgeLabel?: string;
17
12
  /** Color of the badge displayed next to the item */
18
13
  badgeColor?: BadgeColor;
19
14
  /** Whether to show a feature lock icon */
20
15
  featureLockEnabled?: boolean;
21
16
  /** Whether to apply red styling for destructive actions */
22
17
  redModeEnabled?: boolean;
23
- /** Tooltip text displayed when hovering over the item */
24
- itemTooltipText?: string;
25
18
  /** Icon symbol identifier displayed at the start of the item */
26
19
  startSymbolId?: agorapulseSymbol;
27
20
  /** Color theme for the start symbol */
28
21
  startSymbolColor?: SymbolColor;
29
- /** Tooltip text for the start symbol */
30
- startSymbolTooltipText?: string;
31
22
  /** Icon symbol identifier displayed at the end of the item */
32
23
  endSymbolId?: agorapulseSymbol;
33
- /** Tooltip text for the end symbol */
34
- endSymbolTooltipText?: string;
35
24
  /** Whether the item is disabled and non-interactive */
36
25
  disabled?: boolean;
37
26
  /** Whether to add a divider before this item */
@@ -40,6 +29,11 @@ interface ActionDropdownItem {
40
29
  id?: string;
41
30
  /** Optional data-track attribute for analytics tracking */
42
31
  dataTrack?: string;
32
+ /**
33
+ * Texts of the item: `label` is required; `description` below it, `badge` next to it, `tooltip` on the item,
34
+ * `startSymbolTooltip` / `endSymbolTooltip` on its symbols.
35
+ */
36
+ i18n: I18nOf<'label', 'description' | 'badge' | 'tooltip' | 'startSymbolTooltip' | 'endSymbolTooltip'>;
43
37
  }
44
38
  /**
45
39
  * A dropdown component that displays a list of actionable items with support for icons,
@@ -48,6 +42,7 @@ interface ActionDropdownItem {
48
42
  */
49
43
  declare class ActionDropdownComponent implements DropdownOverlay {
50
44
  private readonly symbolRegistry;
45
+ private readonly resolveTexts;
51
46
  private readonly panel;
52
47
  trigger: _angular_core.Signal<TemplateRef<unknown> | undefined>;
53
48
  /** Array of items to display in the dropdown menu */
@@ -64,6 +59,20 @@ declare class ActionDropdownComponent implements DropdownOverlay {
64
59
  closed: _angular_core.OutputEmitterRef<void>;
65
60
  /** Emits when a dropdown item is clicked */
66
61
  itemClick: _angular_core.OutputEmitterRef<ActionDropdownItem>;
62
+ protected readonly rows: _angular_core.Signal<{
63
+ item: ActionDropdownItem;
64
+ texts: {
65
+ readonly label: string | undefined;
66
+ readonly description: string | undefined;
67
+ readonly badge: string | undefined;
68
+ readonly tooltip: string | undefined;
69
+ readonly startSymbolTooltip: string | undefined;
70
+ readonly endSymbolTooltip: string | undefined;
71
+ };
72
+ }[]>;
73
+ protected readonly texts: _angular_core.Signal<{
74
+ readonly ariaLabel: string;
75
+ }>;
67
76
  private readonly menuItems;
68
77
  /** Mirrors the key manager's active index, so the roving tabindex can be bound. */
69
78
  protected readonly activeIndex: _angular_core.WritableSignal<number>;
@@ -2,6 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { InjectionToken, PipeTransform, Signal, Provider } from '@angular/core';
3
3
 
4
4
  declare const DEFAULT_TEXTS: Readonly<{
5
+ readonly 'ui-components.action-dropdown.aria-label': "Action dropdown";
5
6
  readonly 'ui-components.filters.trigger': "Filters";
6
7
  readonly 'ui-components.filters.aria-label': "Filters";
7
8
  readonly 'ui-components.filters.apply': "Apply filters";
@@ -13,8 +14,16 @@ declare const DEFAULT_TEXTS: Readonly<{
13
14
  readonly 'ui-components.filters.update-existing-preset': "Update existing preset";
14
15
  readonly 'ui-components.filters.date-range-placeholder': "Select date range";
15
16
  readonly 'ui-components.search.placeholder': "Search";
17
+ readonly 'ui-components.search.no-results': "No results found";
18
+ readonly 'ui-components.search.results': "{{count}} results";
16
19
  readonly 'ui-components.select.only': "Only";
17
20
  readonly 'ui-components.select.placeholder': "Select an option";
21
+ readonly 'ui-components.selection.label': "Selection";
22
+ readonly 'ui-components.selection.selected-section': "Selected";
23
+ readonly 'ui-components.selection.options-section': "Options";
24
+ readonly 'ui-components.selection.select-all': "Select all";
25
+ readonly 'ui-components.selection.select-all-count': "({{selected}} of {{total}})";
26
+ readonly 'ui-components.split-button.toggle': "Toggle";
18
27
  }>;
19
28
  /**
20
29
  * A key of the DS default texts, the only keys a component may fall back to.
@@ -2,13 +2,12 @@ import * as _angular_core from '@angular/core';
2
2
  import { OnDestroy, TemplateRef } from '@angular/core';
3
3
  import * as _floating_ui_utils from '@floating-ui/utils';
4
4
  import { DropdownOverlay } from '@agorapulse/ui-components/dropdown-base';
5
+ import { I18nOf } from '@agorapulse/ui-components/i18n';
5
6
  import { InputSearchComponent } from '@agorapulse/ui-components/input-search';
6
7
 
7
8
  interface SelectionDropdownItem {
8
9
  /** Unique HTML ID for the item */
9
10
  htmlId: string;
10
- /** Display text for the item */
11
- text: string;
12
11
  /** Whether the item is selected */
13
12
  selected: boolean;
14
13
  /** Whether the item is displayed in a mixed/indeterminate state. Takes visual precedence over `selected`. */
@@ -19,10 +18,6 @@ interface SelectionDropdownItem {
19
18
  avatarUrl?: string;
20
19
  /** Symbol ID to display */
21
20
  symbolId?: string;
22
- /** Tooltip text displayed when item is disabled */
23
- disabledTooltip?: string;
24
- /** Text displayed in a badge next to the item */
25
- badgeText?: string;
26
21
  /** Whether the feature is locked */
27
22
  isFeatureLocked?: boolean;
28
23
  /** Whether avatar should be rounded */
@@ -31,28 +26,49 @@ interface SelectionDropdownItem {
31
26
  network?: any;
32
27
  /** Symbol color */
33
28
  symbolColor?: string;
34
- /** Symbol tooltip text */
35
- symbolTooltipText?: string;
36
- /** Group label - items with the same groupLabel will be grouped together */
37
- groupLabel?: string;
38
29
  dataTrack?: string;
30
+ /**
31
+ * Texts of the item: `label` is required; `disabledTooltip` shows on a disabled item, `badge` next to the label,
32
+ * `symbolTooltip` on the symbol. Items whose `group` resolves to the same text are grouped together.
33
+ */
34
+ i18n: I18nOf<'label', 'disabledTooltip' | 'badge' | 'symbolTooltip' | 'group'>;
39
35
  }
40
36
  /**
41
- * One rendered row in the unselected zone: either a standalone item or a group
42
- * holding the items that belong to it (in first-encounter order).
37
+ * Texts of `ap-selection-dropdown`, all optional. `results` receives `count`, `selectAllCount` receives `selected`
38
+ * and `total`; an empty `selectAllCount` hides the count. The dialog is named by `ariaLabel`, else `title`.
39
+ *
40
+ * @example
41
+ * const i18n: SelectionDropdownI18n = { title: 'inbox.labels.title', searchPlaceholder: 'inbox.labels.search' };
42
+ */
43
+ type SelectionDropdownI18n = I18nOf<never, 'title' | 'ariaLabel' | 'headerButton' | 'footerButton' | 'searchPlaceholder' | 'noResults' | 'results' | 'selectedSection' | 'optionsSection' | 'selectAll' | 'selectAllCount'>;
44
+ type ItemTexts = {
45
+ label: string;
46
+ disabledTooltip?: string;
47
+ badge?: string;
48
+ symbolTooltip?: string;
49
+ group?: string;
50
+ };
51
+ /** An item with its texts resolved in the current language: what the panel renders, searches and groups. */
52
+ type Row = {
53
+ item: SelectionDropdownItem;
54
+ texts: ItemTexts;
55
+ };
56
+ /**
57
+ * One rendered entry: either a standalone row or a group
58
+ * holding the rows that belong to it (in first-encounter order).
43
59
  */
44
60
  type RenderEntry = {
45
61
  kind: 'item';
46
- item: SelectionDropdownItem;
62
+ row: Row;
47
63
  } | {
48
64
  kind: 'group';
49
65
  label: string;
50
- items: SelectionDropdownItem[];
66
+ rows: Row[];
51
67
  };
52
68
  /** A run of consecutive ungrouped items, or a group. Each becomes one listbox of its own. */
53
69
  type RenderRun = {
54
70
  kind: 'items';
55
- items: SelectionDropdownItem[];
71
+ rows: Row[];
56
72
  } | Extract<RenderEntry, {
57
73
  kind: 'group';
58
74
  }>;
@@ -67,12 +83,21 @@ declare class SelectionDropdownComponent implements DropdownOverlay, OnDestroy {
67
83
  /** Mirrors the key manager's active index, so the roving tabindex can be bound. */
68
84
  protected readonly activeIndex: _angular_core.WritableSignal<number>;
69
85
  private readonly injector;
70
- /** Names the dialog. Falls back to the visible title, then to a generic label rather than none. */
71
- readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
72
- /** Names the listbox holding what is already selected. */
73
- readonly selectedSectionText: _angular_core.InputSignal<string>;
74
- /** Names a listbox of ungrouped options when the dropdown has no title. */
75
- readonly optionsSectionText: _angular_core.InputSignal<string>;
86
+ private readonly t;
87
+ private readonly resolveTexts;
88
+ /** Texts of the dropdown, keys or `raw()` texts; see {@link SelectionDropdownI18n}. */
89
+ readonly i18n: _angular_core.InputSignal<SelectionDropdownI18n>;
90
+ protected readonly texts: _angular_core.Signal<{
91
+ readonly title: string | undefined;
92
+ readonly ariaLabel: string | undefined;
93
+ readonly headerButton: string | undefined;
94
+ readonly footerButton: string | undefined;
95
+ readonly searchPlaceholder: string;
96
+ readonly noResults: string;
97
+ readonly selectedSection: string;
98
+ readonly optionsSection: string;
99
+ readonly selectAll: string;
100
+ }>;
76
101
  protected readonly panelLabel: _angular_core.Signal<string>;
77
102
  protected readonly listboxId: string;
78
103
  private keyManager;
@@ -88,28 +113,12 @@ declare class SelectionDropdownComponent implements DropdownOverlay, OnDestroy {
88
113
  selectionMode: _angular_core.InputSignal<SelectionDropdownMode>;
89
114
  /** Shows the search field. Ignored in `multiple` mode, which always searches. */
90
115
  searchEnabled: _angular_core.InputSignal<boolean>;
91
- /** Title to display in the header */
92
- title: _angular_core.InputSignal<string | undefined>;
93
- /** Text for the footer button */
94
- footerButtonText: _angular_core.InputSignal<string | undefined>;
95
116
  /** Symbol ID for the footer button */
96
117
  footerButtonSymbolId: _angular_core.InputSignal<string | undefined>;
97
- /** Text for the header button */
98
- headerButtonText: _angular_core.InputSignal<string | undefined>;
99
118
  /** Symbol ID for the header button */
100
119
  headerButtonSymbolId: _angular_core.InputSignal<string | undefined>;
101
120
  /** Adds a "Select all" row above the options, acting on every visible option across groups. Multiple mode only. */
102
121
  selectAllEnabled: _angular_core.InputSignal<boolean>;
103
- /** Label of the "Select all" row */
104
- selectAllText: _angular_core.InputSignal<string>;
105
- /** Count after the "Select all" label. `{selected}` and `{total}` are replaced; empty hides it. */
106
- selectAllCountText: _angular_core.InputSignal<string>;
107
- /** Placeholder text for the search input */
108
- searchPlaceholderText: _angular_core.InputSignal<string>;
109
- /** Text to display when no search results are found */
110
- noSearchResultsText: _angular_core.InputSignal<string>;
111
- /** Announced once a search settles. `{count}` is replaced by how many options matched. */
112
- searchResultsText: _angular_core.InputSignal<string>;
113
122
  /** Whether to show a backdrop that closes the dropdown when clicked */
114
123
  showBackdrop: _angular_core.InputSignal<boolean>;
115
124
  /** Whether the dropdown is disabled and cannot be opened */
@@ -151,11 +160,16 @@ declare class SelectionDropdownComponent implements DropdownOverlay, OnDestroy {
151
160
  protected readonly headerVisible: _angular_core.Signal<boolean>;
152
161
  private readonly internalItems;
153
162
  protected readonly filteredItems: _angular_core.WritableSignal<SelectionDropdownItem[]>;
163
+ private readonly filteredRows;
164
+ private readonly searchResultCount;
154
165
  /** What the live region holds. Empty outside a search: the list is on screen, unchanged. */
155
- protected readonly resultsAnnouncement: _angular_core.WritableSignal<string>;
166
+ protected readonly resultsAnnouncement: _angular_core.Signal<string>;
156
167
  protected readonly initiallySelectedItems: _angular_core.WritableSignal<SelectionDropdownItem[]>;
157
- protected readonly selectedItems: _angular_core.Signal<SelectionDropdownItem[]>;
158
- protected readonly unselectedItems: _angular_core.Signal<SelectionDropdownItem[]>;
168
+ protected readonly selectedRows: _angular_core.Signal<{
169
+ item: SelectionDropdownItem;
170
+ texts: ItemTexts;
171
+ }[]>;
172
+ private readonly unselectedRows;
159
173
  /** Multiple mode's unselected zone, grouped. */
160
174
  protected readonly displayEntries: _angular_core.Signal<RenderEntry[]>;
161
175
  /** Single mode has no selected zone: the picked option stays in its group. */
@@ -224,6 +238,8 @@ declare class SelectionDropdownComponent implements DropdownOverlay, OnDestroy {
224
238
  /** Handles group toggle events, selecting/deselecting all items within the group */
225
239
  onGroupToggle(groupLabel: string, checked: boolean): void;
226
240
  onSelectAllToggle(checked: boolean): void;
241
+ /** Read in a reactive context, the texts follow language changes. */
242
+ private itemTexts;
227
243
  /** Stable track key for a render entry (item or group). */
228
244
  protected entryKey(entry: RenderEntry): string;
229
245
  /**
@@ -234,7 +250,7 @@ declare class SelectionDropdownComponent implements DropdownOverlay, OnDestroy {
234
250
  /** Updates the filtered items based on search term */
235
251
  private updateFilteredItems;
236
252
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SelectionDropdownComponent, never>;
237
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SelectionDropdownComponent, "ap-selection-dropdown", never, { "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "selectedSectionText": { "alias": "selectedSectionText"; "required": false; "isSignal": true; }; "optionsSectionText": { "alias": "optionsSectionText"; "required": false; "isSignal": true; }; "headerButtonId": { "alias": "headerButtonId"; "required": false; "isSignal": true; }; "footerButtonId": { "alias": "footerButtonId"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "searchEnabled": { "alias": "searchEnabled"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "footerButtonText": { "alias": "footerButtonText"; "required": false; "isSignal": true; }; "footerButtonSymbolId": { "alias": "footerButtonSymbolId"; "required": false; "isSignal": true; }; "headerButtonText": { "alias": "headerButtonText"; "required": false; "isSignal": true; }; "headerButtonSymbolId": { "alias": "headerButtonSymbolId"; "required": false; "isSignal": true; }; "selectAllEnabled": { "alias": "selectAllEnabled"; "required": false; "isSignal": true; }; "selectAllText": { "alias": "selectAllText"; "required": false; "isSignal": true; }; "selectAllCountText": { "alias": "selectAllCountText"; "required": false; "isSignal": true; }; "searchPlaceholderText": { "alias": "searchPlaceholderText"; "required": false; "isSignal": true; }; "noSearchResultsText": { "alias": "noSearchResultsText"; "required": false; "isSignal": true; }; "searchResultsText": { "alias": "searchResultsText"; "required": false; "isSignal": true; }; "showBackdrop": { "alias": "showBackdrop"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "placement": { "alias": "placement"; "required": false; "isSignal": true; }; "panelWidth": { "alias": "panelWidth"; "required": false; "isSignal": true; }; "searchTerm": { "alias": "searchTerm"; "required": false; "isSignal": true; }; }, { "opened": "opened"; "closed": "closed"; "selectionChange": "selectionChange"; "footerButtonClick": "footerButtonClick"; "headerButtonClick": "headerButtonClick"; "searchInputChange": "searchInputChange"; "searchTerm": "searchTermChange"; }, ["trigger"], never, true, never>;
253
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SelectionDropdownComponent, "ap-selection-dropdown", never, { "i18n": { "alias": "i18n"; "required": false; "isSignal": true; }; "headerButtonId": { "alias": "headerButtonId"; "required": false; "isSignal": true; }; "footerButtonId": { "alias": "footerButtonId"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "searchEnabled": { "alias": "searchEnabled"; "required": false; "isSignal": true; }; "footerButtonSymbolId": { "alias": "footerButtonSymbolId"; "required": false; "isSignal": true; }; "headerButtonSymbolId": { "alias": "headerButtonSymbolId"; "required": false; "isSignal": true; }; "selectAllEnabled": { "alias": "selectAllEnabled"; "required": false; "isSignal": true; }; "showBackdrop": { "alias": "showBackdrop"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "placement": { "alias": "placement"; "required": false; "isSignal": true; }; "panelWidth": { "alias": "panelWidth"; "required": false; "isSignal": true; }; "searchTerm": { "alias": "searchTerm"; "required": false; "isSignal": true; }; }, { "opened": "opened"; "closed": "closed"; "selectionChange": "selectionChange"; "footerButtonClick": "footerButtonClick"; "headerButtonClick": "headerButtonClick"; "searchInputChange": "searchInputChange"; "searchTerm": "searchTermChange"; }, ["trigger"], never, true, never>;
238
254
  }
239
255
 
240
256
  /**
@@ -256,4 +272,4 @@ declare class SelectionDropdownTriggerDirective {
256
272
  }
257
273
 
258
274
  export { SelectionDropdownComponent, SelectionDropdownTriggerDirective };
259
- export type { SelectionDropdownItem };
275
+ export type { SelectionDropdownI18n, SelectionDropdownItem };
@@ -13,6 +13,7 @@ type SplitButtonConfig = {
13
13
  declare class SplitButtonComponent implements AfterViewInit {
14
14
  private symbolRegistry;
15
15
  readonly baseButtonDirective: BaseButtonDirective;
16
+ private readonly resolveTexts;
16
17
  disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
17
18
  config: _angular_core.InputSignal<SplitButtonConfig>;
18
19
  actionDropdownTrigger: _angular_core.InputSignal<ActionDropdownComponent | undefined>;
@@ -32,6 +33,9 @@ declare class SplitButtonComponent implements AfterViewInit {
32
33
  buttonElement: _angular_core.Signal<ElementRef<HTMLButtonElement>>;
33
34
  splitButtonElement: _angular_core.Signal<ElementRef<HTMLButtonElement>>;
34
35
  symbolComponent: _angular_core.Signal<SymbolComponent | undefined>;
36
+ protected readonly texts: _angular_core.Signal<{
37
+ readonly toggle: string;
38
+ }>;
35
39
  id: string;
36
40
  menuOpen: boolean;
37
41
  constructor();
Binary file