@nanahoshi/mona-ui 0.24.6 → 0.24.8

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 (78) hide show
  1. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  2. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +14 -4
  3. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  4. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1 -1
  5. package/fesm2022/nanahoshi-mona-ui-filter.mjs +233 -231
  6. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-CD_ODHpU.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DdyHnUIr.mjs} +24 -12
  7. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-B6gq7Hu3.mjs +208 -0
  8. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DdUY3I7P.mjs +1100 -0
  9. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-Sa1aAtJ-.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-DG8Bu4Dy.mjs} +34 -21
  10. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BvUM9nPt.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CVqpbMcb.mjs} +2565 -928
  11. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  12. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +79 -11
  13. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +20 -4
  14. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +335 -45
  15. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +565 -197
  16. package/fesm2022/nanahoshi-mona-ui-internal.mjs +28 -2
  17. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +598 -208
  18. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +193 -74
  19. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +58 -11
  20. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +62 -11
  21. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +62 -11
  22. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +69 -11
  23. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +58 -11
  24. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +62 -11
  25. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +58 -11
  26. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +58 -11
  27. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +62 -11
  28. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +78 -11
  29. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +58 -11
  30. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +58 -11
  31. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +58 -11
  32. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1 -1
  33. package/fesm2022/nanahoshi-mona-ui-pager.mjs +367 -463
  34. package/fesm2022/nanahoshi-mona-ui-query.mjs +317 -122
  35. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +205 -140
  36. package/i18n/catalogs/en-US.messages.json +64 -17
  37. package/locales/ar-sa/ar-sa.messages.json +58 -11
  38. package/locales/de-de/de-de.messages.json +58 -11
  39. package/locales/es-es/es-es.messages.json +58 -11
  40. package/locales/fr-fr/fr-fr.messages.json +58 -11
  41. package/locales/id-id/id-id.messages.json +58 -11
  42. package/locales/it-it/it-it.messages.json +58 -11
  43. package/locales/ja-jp/ja-jp.messages.json +58 -11
  44. package/locales/ko-kr/ko-kr.messages.json +58 -11
  45. package/locales/pt-br/pt-br.messages.json +58 -11
  46. package/locales/ru-ru/ru-ru.messages.json +58 -11
  47. package/locales/tr-tr/tr-tr.messages.json +58 -11
  48. package/locales/zh-cn/zh-cn.messages.json +58 -11
  49. package/locales/zh-tw/zh-tw.messages.json +58 -11
  50. package/package.json +1 -1
  51. package/types/nanahoshi-mona-ui-check-box.d.ts +11 -1
  52. package/types/nanahoshi-mona-ui-filter.d.ts +54 -32
  53. package/types/nanahoshi-mona-ui-grid.d.ts +359 -110
  54. package/types/nanahoshi-mona-ui-i18n.d.ts +97 -6
  55. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +14 -2
  56. package/types/nanahoshi-mona-ui-internal-list.d.ts +89 -10
  57. package/types/nanahoshi-mona-ui-internal-tree.d.ts +155 -40
  58. package/types/nanahoshi-mona-ui-internal.d.ts +10 -2
  59. package/types/nanahoshi-mona-ui-list-box.d.ts +148 -47
  60. package/types/nanahoshi-mona-ui-list-view.d.ts +111 -21
  61. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +53 -6
  62. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +53 -6
  63. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +53 -6
  64. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +53 -6
  65. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +53 -6
  66. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +53 -6
  67. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +53 -6
  68. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +53 -6
  69. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +53 -6
  70. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +53 -6
  71. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +53 -6
  72. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +53 -6
  73. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +53 -6
  74. package/types/nanahoshi-mona-ui-pager.d.ts +159 -76
  75. package/types/nanahoshi-mona-ui-query.d.ts +45 -14
  76. package/types/nanahoshi-mona-ui-tree-view.d.ts +84 -40
  77. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-0jN7I1jo.mjs +0 -176
  78. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BI_iE7pl.mjs +0 -946
@@ -1,7 +1,7 @@
1
1
  import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf } from '@angular/cdk/scrolling';
2
2
  import { NgTemplateOutlet } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Directive, computed, signal, linkedSignal, Injectable, inject, input, ElementRef, Component, DestroyRef, viewChild, contentChild, TemplateRef, output, effect, untracked, afterNextRender } from '@angular/core';
4
+ import { Directive, computed, signal, inject, linkedSignal, Injectable, input, ElementRef, Component, DestroyRef, viewChild, contentChild, TemplateRef, booleanAttribute, output, effect, untracked, afterRenderEffect, afterNextRender, InjectionToken } from '@angular/core';
5
5
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
6
  import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
7
7
  import { createElementControlId, isTypeaheadKey, setupTypeahead } from '@nanahoshi/mona-ui/internal';
@@ -18,7 +18,9 @@ import { CheckboxDirective } from '@nanahoshi/mona-ui/check-box';
18
18
  // Edit the JSON file and run `npm run generate:locale-catalogs`.
19
19
  const LIST_DEFAULT_MESSAGES = {
20
20
  filterList: "Filter list",
21
- noData: "No data"
21
+ loading: "Loading",
22
+ noData: "No data",
23
+ pagerLabel: (list) => `${list} pagination`
22
24
  };
23
25
 
24
26
  class ListFooterTemplateDirective {
@@ -75,17 +77,62 @@ class ListItem {
75
77
  }
76
78
  }
77
79
 
80
+ /**
81
+ * Finds the item typeahead moves to: the next matching item after the active one, wrapping around. With
82
+ * `keepActive` (a buffer longer than one character), an active item that still matches stays active, so typing
83
+ * "ap" on Apple doesn't move on to Apricot.
84
+ */
78
85
  const cycleThroughMatchedItems = (items, activeItem, // highlighted or selected item
79
- predicate) => {
86
+ predicate, keepActive = false) => {
80
87
  const matchedItems = Array.from(items).filter(predicate);
81
88
  if (matchedItems.length === 0) {
82
89
  return null;
83
90
  }
84
91
  const currentIndex = activeItem ? matchedItems.indexOf(activeItem) : -1;
92
+ if (keepActive && currentIndex !== -1) {
93
+ return matchedItems[currentIndex];
94
+ }
85
95
  const nextIndex = (currentIndex + 1) % matchedItems.length;
86
96
  return matchedItems[nextIndex];
87
97
  };
88
98
 
99
+ /**
100
+ * Turns a group value into the key items are grouped by. Dates, and other objects whose `valueOf()` is a primitive,
101
+ * group by that primitive, so two `Date` objects for the same moment form one group. `null`, `undefined`, `NaN` and
102
+ * invalid dates join the empty group (`""`). Other objects group by identity.
103
+ */
104
+ function toGroupKey(value) {
105
+ if (value == null) {
106
+ return "";
107
+ }
108
+ if (typeof value === "number") {
109
+ return Number.isNaN(value) ? "" : value;
110
+ }
111
+ if (typeof value !== "object") {
112
+ return value;
113
+ }
114
+ const primitive = value.valueOf();
115
+ if (primitive === value || (typeof primitive === "object" && primitive !== null)) {
116
+ return value;
117
+ }
118
+ return typeof primitive === "number" && Number.isNaN(primitive) ? "" : primitive;
119
+ }
120
+ /**
121
+ * Formats a group value for its header: dates and numbers with the given locale, everything else with `String`.
122
+ */
123
+ function formatGroupHeader(value, formatters) {
124
+ if (value == null) {
125
+ return "";
126
+ }
127
+ if (value instanceof Date) {
128
+ return Number.isNaN(value.getTime()) ? "" : formatters.date.format(value);
129
+ }
130
+ if (typeof value === "number") {
131
+ return Number.isNaN(value) ? "" : formatters.number.format(value);
132
+ }
133
+ return String(value);
134
+ }
135
+
89
136
  class ListService {
90
137
  constructor() {
91
138
  this.#arrangedItems = computed(() => {
@@ -107,7 +154,8 @@ class ListService {
107
154
  enumerable = enumerable.orderBy(item => this.getOrderKey(item));
108
155
  }
109
156
  }
110
- let groupedEnumerable = enumerable.groupBy(item => this.getGroupField(item));
157
+ // Dates group by their time, so equal dates share a group and header order is chronological.
158
+ let groupedEnumerable = enumerable.groupBy(item => toGroupKey(this.getGroupField(item)));
111
159
  if (groupableOptions.headerOrder) {
112
160
  if (groupableOptions.headerOrder === "desc") {
113
161
  groupedEnumerable = groupedEnumerable.orderByDescending(g => g.key);
@@ -116,12 +164,30 @@ class ListService {
116
164
  groupedEnumerable = groupedEnumerable.orderBy(g => g.key);
117
165
  }
118
166
  }
167
+ const localeId = this.#i18n.localeId();
168
+ const formatters = {
169
+ date: new Intl.DateTimeFormat(localeId, { dateStyle: "medium" }),
170
+ number: new Intl.NumberFormat(localeId, { useGrouping: false })
171
+ };
119
172
  const previousHeaders = this.#groupHeaders;
120
173
  const headers = new Map();
121
174
  const items = groupedEnumerable
122
175
  .selectMany(g => {
123
- const header = previousHeaders.get(g.key) ??
124
- new ListItem({ data: g.key, header: String(g.key ?? ""), isHeader: true });
176
+ // The header carries the first item's group value (a Date stays a Date for the header template).
177
+ const value = this.getGroupField(g.source.first());
178
+ const text = groupableOptions.headerText
179
+ ? groupableOptions.headerText(value)
180
+ : formatGroupHeader(value, formatters);
181
+ const previous = previousHeaders.get(g.key);
182
+ const header = previous && previous.header === text && previous.data === value
183
+ ? previous
184
+ : // A header carries its group's value in place of a data item.
185
+ new ListItem({
186
+ data: value,
187
+ header: text,
188
+ isHeader: true,
189
+ uid: previous?.uid
190
+ });
125
191
  headers.set(g.key, header);
126
192
  return g.source.prepend(header);
127
193
  })
@@ -132,6 +198,7 @@ class ListService {
132
198
  ...(ngDevMode ? [{ debugName: "#arrangedItems" }] : /* istanbul ignore next */ []));
133
199
  this.#data = signal(ImmutableList.create(), /* @ts-ignore */
134
200
  ...(ngDevMode ? [{ debugName: "#data" }] : /* istanbul ignore next */ []));
201
+ this.#i18n = inject(MonaI18nService);
135
202
  /**
136
203
  * First list item for each selection key, so key lookups are O(1) instead of a scan per key.
137
204
  */
@@ -209,16 +276,21 @@ class ListService {
209
276
  }, /* @ts-ignore */
210
277
  ...(ngDevMode ? [{ debugName: "filterableOptions" }] : /* istanbul ignore next */ []));
211
278
  this.focus$ = new Subject();
279
+ /**
280
+ * The option that holds the list's Tab stop: the highlighted one, else the last selected one, else the first
281
+ * enabled one. Only shown items count, so a selection on another page doesn't take the Tab stop away.
282
+ */
212
283
  this.focusableItem = computed(() => {
284
+ const viewItems = this.viewItems();
213
285
  const highlighted = this.highlightedItem();
214
- if (highlighted) {
286
+ if (highlighted && viewItems.contains(highlighted)) {
215
287
  return highlighted;
216
288
  }
217
- const selected = this.selectedListItems().lastOrDefault();
289
+ const selected = this.selectedListItems().lastOrDefault(item => viewItems.contains(item));
218
290
  if (selected) {
219
291
  return selected;
220
292
  }
221
- return this.viewItems().firstOrDefault(i => !i.isHeader && !this.isDisabled(i));
293
+ return viewItems.firstOrDefault(i => !i.isHeader && !this.isDisabled(i));
222
294
  }, /* @ts-ignore */
223
295
  ...(ngDevMode ? [{ debugName: "focusableItem" }] : /* istanbul ignore next */ []));
224
296
  this.groupBy = signal(null, /* @ts-ignore */
@@ -293,6 +365,12 @@ class ListService {
293
365
  visiblePages: 5
294
366
  }, /* @ts-ignore */
295
367
  ...(ngDevMode ? [{ debugName: "pageableOptions" }] : /* istanbul ignore next */ []));
368
+ /**
369
+ * `"listbox"` for options to choose from; `"list"` for items that are only shown, as `listitem`s without
370
+ * selection state.
371
+ */
372
+ this.role = signal("listbox", /* @ts-ignore */
373
+ ...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
296
374
  this.scrollToItem$ = new ReplaySubject(1);
297
375
  this.selectableOptions = signal({
298
376
  checkboxes: false,
@@ -339,6 +417,7 @@ class ListService {
339
417
  }
340
418
  #arrangedItems;
341
419
  #data;
420
+ #i18n;
342
421
  /**
343
422
  * First list item for each selection key, so key lookups are O(1) instead of a scan per key.
344
423
  */
@@ -366,7 +445,8 @@ class ListService {
366
445
  this.highlightedItem.set(null);
367
446
  }
368
447
  /**
369
- * Finds the next item whose text starts with the typeahead buffer, starting after the active item.
448
+ * Finds the next item whose text starts with the typeahead buffer, starting after the active item; once the
449
+ * buffer holds more than one character, an active item that still matches stays.
370
450
  * Group headers and disabled items are never matched.
371
451
  */
372
452
  cycleThroughMatchedItems(buffer) {
@@ -377,7 +457,7 @@ class ListService {
377
457
  return false;
378
458
  }
379
459
  return this.getItemText(item).toLowerCase().startsWith(prefix);
380
- });
460
+ }, prefix.length > 1);
381
461
  }
382
462
  deselectItems(item) {
383
463
  const keys = from(item)
@@ -462,15 +542,18 @@ class ListService {
462
542
  }
463
543
  return candidates.firstOrDefault(i => this.filterItem(i, text));
464
544
  }
465
- isDisabled(item) {
466
- if (item.isHeader) {
467
- return false;
468
- }
545
+ /**
546
+ * Whether a data item is disabled by `disabledBy`, whether or not it is in the list.
547
+ */
548
+ isDataItemDisabled(dataItem) {
469
549
  const disabledBy = this.disabledBy();
470
550
  if (typeof disabledBy === "string") {
471
- return item.data?.[disabledBy] ?? false;
551
+ return disabledBy !== "" && Boolean(dataItem?.[disabledBy]);
472
552
  }
473
- return disabledBy(item.data);
553
+ return disabledBy(dataItem);
554
+ }
555
+ isDisabled(item) {
556
+ return !item.isHeader && this.isDataItemDisabled(item.data);
474
557
  }
475
558
  isFilteringEnabled() {
476
559
  const filterableOptions = this.filterableOptions();
@@ -907,12 +990,13 @@ const listGroupHeaderTextThemeVariants = cva(`select-none text-muted-foreground`
907
990
  }
908
991
  });
909
992
  const listItemBaseThemeVariants = cva(`flex h-full w-full items-center gap-2`);
910
- const listItemContentThemeVariants = cva(`relative flex cursor-default select-none items-center px-3 py-1 text-foreground outline-none`, {
993
+ // Focus and the active option share the grid's ring: solid 2px, inset, at full strength.
994
+ const listItemContentThemeVariants = cva(`relative flex cursor-default select-none items-center px-3 py-1 text-foreground outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-focus-indicator`, {
911
995
  variants: {
912
996
  checkboxes: { true: "gap-2", false: "" },
913
997
  selectable: { true: "hover:bg-hover focus:bg-hover", false: "" },
914
998
  highlighted: {
915
- true: "bg-hover text-foreground inset-ring-1 inset-ring-focus-indicator/35",
999
+ true: "bg-hover text-foreground inset-ring-2 inset-ring-focus-indicator",
916
1000
  false: ""
917
1001
  },
918
1002
  selected: { true: "bg-(--color-selected) text-(--color-selected-foreground)", false: "" },
@@ -936,7 +1020,7 @@ const listItemContentThemeVariants = cva(`relative flex cursor-default select-no
936
1020
  highlighted: true,
937
1021
  selected: true,
938
1022
  checkboxes: false,
939
- class: "bg-(--color-selected) text-(--color-selected-foreground) inset-ring-1 inset-ring-focus-indicator/35 hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground) focus:bg-(--color-selected-focus) focus:text-(--color-selected-focus-foreground)"
1023
+ class: "bg-(--color-selected) text-(--color-selected-foreground) inset-ring-2 inset-ring-focus-indicator hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground) focus:bg-(--color-selected-focus) focus:text-(--color-selected-focus-foreground)"
940
1024
  },
941
1025
  { selected: true, checkboxes: true, class: "bg-transparent text-foreground" }
942
1026
  ]
@@ -948,10 +1032,16 @@ class ListItemDirective {
948
1032
  this.#listService = inject((ListService));
949
1033
  this.disabled = computed(() => this.#listService.isDisabled(this.item()), /* @ts-ignore */
950
1034
  ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
951
- this.groupHeaderUid = computed(() => this.#listService.getGroupHeaderUid(this.item()), /* @ts-ignore */
1035
+ /**
1036
+ * Without virtual scrolling, items sit inside a group labelled by its header. A virtual list stays flat, so each
1037
+ * item points at its header instead.
1038
+ */
1039
+ this.groupHeaderUid = computed(() => this.#listService.virtualScrollOptions().enabled ? this.#listService.getGroupHeaderUid(this.item()) : null, /* @ts-ignore */
952
1040
  ...(ngDevMode ? [{ debugName: "groupHeaderUid" }] : /* istanbul ignore next */ []));
953
1041
  this.highlighted = computed(() => this.#listService.isHighlighted(this.item()), /* @ts-ignore */
954
1042
  ...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
1043
+ this.isOption = computed(() => this.#listService.role() === "listbox", /* @ts-ignore */
1044
+ ...(ngDevMode ? [{ debugName: "isOption" }] : /* istanbul ignore next */ []));
955
1045
  this.position = computed(() => {
956
1046
  const positionInfo = this.#listService.getItemPosition(this.item());
957
1047
  return positionInfo?.position ?? null;
@@ -989,7 +1079,7 @@ class ListItemDirective {
989
1079
  .subscribe(() => this.#listService.itemFocusOut$.next(this.item()));
990
1080
  }
991
1081
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
992
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: ListItemDirective, isStandalone: true, selector: "li[monaListItem]", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.aria-describedby": "groupHeaderUid()", "attr.aria-disabled": "disabled()", "attr.aria-posinset": "position()", "attr.aria-selected": "selected()", "attr.aria-setsize": "setSize()", "attr.data-disabled": "disabled()", "attr.data-highlighted": "highlighted()", "attr.data-selected": "selected()", "attr.role": "'option'", "attr.tabindex": "rovingTabIndex()", "class": "textClasses()" } }, ngImport: i0 }); }
1082
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: ListItemDirective, isStandalone: true, selector: "li[monaListItem]", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.aria-describedby": "groupHeaderUid()", "attr.aria-disabled": "isOption() ? disabled() : null", "attr.aria-posinset": "position()", "attr.aria-selected": "isOption() ? selected() : null", "attr.aria-setsize": "setSize()", "attr.data-disabled": "disabled()", "attr.data-highlighted": "highlighted()", "attr.data-selected": "selected()", "attr.role": "isOption() ? 'option' : 'listitem'", "attr.tabindex": "rovingTabIndex()", "class": "textClasses()" } }, ngImport: i0 }); }
993
1083
  }
994
1084
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListItemDirective, decorators: [{
995
1085
  type: Directive,
@@ -997,14 +1087,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
997
1087
  selector: "li[monaListItem]",
998
1088
  host: {
999
1089
  "[attr.aria-describedby]": "groupHeaderUid()",
1000
- "[attr.aria-disabled]": "disabled()",
1090
+ "[attr.aria-disabled]": "isOption() ? disabled() : null",
1001
1091
  "[attr.aria-posinset]": "position()",
1002
- "[attr.aria-selected]": "selected()",
1092
+ "[attr.aria-selected]": "isOption() ? selected() : null",
1003
1093
  "[attr.aria-setsize]": "setSize()",
1004
1094
  "[attr.data-disabled]": "disabled()",
1005
1095
  "[attr.data-highlighted]": "highlighted()",
1006
1096
  "[attr.data-selected]": "selected()",
1007
- "[attr.role]": "'option'",
1097
+ "[attr.role]": "isOption() ? 'option' : 'listitem'",
1008
1098
  "[attr.tabindex]": "rovingTabIndex()",
1009
1099
  "[class]": "textClasses()"
1010
1100
  }
@@ -1059,6 +1149,8 @@ class ListItemComponent {
1059
1149
  ...(ngDevMode ? [{ debugName: "checkboxes" }] : /* istanbul ignore next */ []));
1060
1150
  this.dataItem = computed(() => this.item()?.data ?? null, /* @ts-ignore */
1061
1151
  ...(ngDevMode ? [{ debugName: "dataItem" }] : /* istanbul ignore next */ []));
1152
+ this.isHeader = computed(() => this.item()?.isHeader ?? false, /* @ts-ignore */
1153
+ ...(ngDevMode ? [{ debugName: "isHeader" }] : /* istanbul ignore next */ []));
1062
1154
  this.itemChecked = computed(() => this.listService.isSelected(this.item()), /* @ts-ignore */
1063
1155
  ...(ngDevMode ? [{ debugName: "itemChecked" }] : /* istanbul ignore next */ []));
1064
1156
  this.itemText = computed(() => {
@@ -1072,8 +1164,6 @@ class ListItemComponent {
1072
1164
  return this.listService.getItemText(item);
1073
1165
  }, /* @ts-ignore */
1074
1166
  ...(ngDevMode ? [{ debugName: "itemText" }] : /* istanbul ignore next */ []));
1075
- this.isHeader = computed(() => this.item()?.isHeader ?? false, /* @ts-ignore */
1076
- ...(ngDevMode ? [{ debugName: "isHeader" }] : /* istanbul ignore next */ []));
1077
1167
  this.listService = inject(ListService);
1078
1168
  this.textClasses = computed(() => {
1079
1169
  const isHeader = this.isHeader();
@@ -1105,15 +1195,25 @@ class ListComponent {
1105
1195
  #generatedListId;
1106
1196
  #hostElementRef;
1107
1197
  #i18n;
1198
+ /** The rows a virtual list has drawn, so the Tab stop never lands on an option that isn't in the DOM. */
1199
+ #renderedRange;
1108
1200
  #typeaheadKey$;
1201
+ /** The option that had focus, kept so focus can move to a neighbour when that option is removed. */
1202
+ #focusedOption;
1109
1203
  constructor() {
1110
1204
  this.#destroyRef = inject(DestroyRef);
1111
1205
  this.#generatedListId = createElementControlId();
1112
1206
  this.#hostElementRef = inject(ElementRef);
1113
1207
  this.#i18n = inject(MonaI18nService);
1208
+ /** The rows a virtual list has drawn, so the Tab stop never lands on an option that isn't in the DOM. */
1209
+ this.#renderedRange = signal(null, /* @ts-ignore */
1210
+ ...(ngDevMode ? [{ debugName: "#renderedRange" }] : /* istanbul ignore next */ []));
1114
1211
  this.#typeaheadKey$ = new Subject();
1212
+ /** The option that had focus, kept so focus can move to a neighbour when that option is removed. */
1213
+ this.#focusedOption = null;
1115
1214
  this.filterInput = viewChild(FilterInputComponent, /* @ts-ignore */
1116
1215
  ...(ngDevMode ? [{ debugName: "filterInput" }] : /* istanbul ignore next */ []));
1216
+ this.filterInputElement = viewChild(FilterInputComponent, { ...(ngDevMode ? { debugName: "filterInputElement" } : /* istanbul ignore next */ {}), read: ElementRef });
1117
1217
  /**
1118
1218
  * Id of the highlighted option, used as `aria-activedescendant` by the filter input.
1119
1219
  */
@@ -1132,6 +1232,9 @@ class ListComponent {
1132
1232
  */
1133
1233
  this.effectiveListId = computed(() => this.listId() || this.#generatedListId, /* @ts-ignore */
1134
1234
  ...(ngDevMode ? [{ debugName: "effectiveListId" }] : /* istanbul ignore next */ []));
1235
+ /** The empty list element covers the "No data" content and shows the focus ring when it has focus. */
1236
+ this.emptyListClasses = computed(() => twMerge(this.innerListClasses(), "absolute inset-0 focus-visible:inset-ring-2 focus-visible:inset-ring-focus-indicator"), /* @ts-ignore */
1237
+ ...(ngDevMode ? [{ debugName: "emptyListClasses" }] : /* istanbul ignore next */ []));
1135
1238
  this.footerTemplate = contentChild(ListFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
1136
1239
  this.groupHeaderClasses = computed(() => {
1137
1240
  const listItemClass = this.listItemClass();
@@ -1142,7 +1245,23 @@ class ListComponent {
1142
1245
  ...(ngDevMode ? [{ debugName: "groupHeaderClasses" }] : /* istanbul ignore next */ []));
1143
1246
  this.groupHeaderTemplate = contentChild(ListGroupHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "groupHeaderTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
1144
1247
  this.headerTemplate = contentChild(ListHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "headerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
1145
- this.hostTabIndex = computed(() => (this.listService.focusableItem() ? -1 : 0), /* @ts-ignore */
1248
+ /**
1249
+ * The host takes the Tab stop when no option can: every option is disabled, or a virtual list's focusable option
1250
+ * is scrolled out of the drawn rows. Focusing the host then moves focus to that option.
1251
+ */
1252
+ this.hostTabIndex = computed(() => {
1253
+ const item = this.listService.focusableItem();
1254
+ if (!item) {
1255
+ // An empty list element is its own Tab stop.
1256
+ return this.listService.viewItems().isEmpty() ? -1 : 0;
1257
+ }
1258
+ if (!this.listService.virtualScrollOptions().enabled) {
1259
+ return -1;
1260
+ }
1261
+ const range = this.#renderedRange();
1262
+ const index = this.listService.viewItems().toArray().indexOf(item);
1263
+ return range && index >= range.start && index < range.end ? -1 : 0;
1264
+ }, /* @ts-ignore */
1146
1265
  ...(ngDevMode ? [{ debugName: "hostTabIndex" }] : /* istanbul ignore next */ []));
1147
1266
  this.innerListClasses = computed(() => {
1148
1267
  const classes = listInnerListThemeVariants();
@@ -1197,7 +1316,27 @@ class ListComponent {
1197
1316
  }, /* @ts-ignore */
1198
1317
  ...(ngDevMode ? [{ debugName: "listWidth" }] : /* istanbul ignore next */ []));
1199
1318
  this.messages = this.#i18n.componentMessages("list", LIST_DEFAULT_MESSAGES);
1319
+ /** Id of the "No data" content, which describes an empty list. */
1320
+ this.noDataId = `${this.#generatedListId}-no-data`;
1200
1321
  this.noDataTemplate = contentChild(ListNoDataTemplateDirective, { ...(ngDevMode ? { debugName: "noDataTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
1322
+ /**
1323
+ * The shown items split at group headers: a section without a header holds ungrouped items.
1324
+ */
1325
+ this.viewSections = computed(() => {
1326
+ const sections = [];
1327
+ for (const item of this.listService.viewItems()) {
1328
+ if (item.isHeader) {
1329
+ sections.push({ header: item, items: [], key: item.uid });
1330
+ continue;
1331
+ }
1332
+ if (sections.length === 0) {
1333
+ sections.push({ header: null, items: [], key: "" });
1334
+ }
1335
+ sections[sections.length - 1].items.push(item);
1336
+ }
1337
+ return sections;
1338
+ }, /* @ts-ignore */
1339
+ ...(ngDevMode ? [{ debugName: "viewSections" }] : /* istanbul ignore next */ []));
1201
1340
  this.viewportHeight = computed(() => {
1202
1341
  const listHeight = this.listHeight();
1203
1342
  if (listHeight) {
@@ -1221,12 +1360,28 @@ class ListComponent {
1221
1360
  */
1222
1361
  this.ariaLabel = input("", /* @ts-ignore */
1223
1362
  ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
1363
+ /**
1364
+ * @description Id of the element that names the list, as an alternative to `ariaLabel`.
1365
+ * @default ""
1366
+ */
1367
+ this.ariaLabelledBy = input("", /* @ts-ignore */
1368
+ ...(ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []));
1369
+ /**
1370
+ * @description Marks the list as loading (`aria-busy`).
1371
+ * @default false
1372
+ */
1373
+ this.busy = input(false, { ...(ngDevMode ? { debugName: "busy" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1224
1374
  this.data = input(null, /* @ts-ignore */
1225
1375
  ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
1226
1376
  this.focusOnMount = input(true, /* @ts-ignore */
1227
1377
  ...(ngDevMode ? [{ debugName: "focusOnMount" }] : /* istanbul ignore next */ []));
1228
1378
  this.height = input(undefined, /* @ts-ignore */
1229
1379
  ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
1380
+ /**
1381
+ * @description Emitted when the user activates an enabled item by clicking it or pressing Enter on it, whether or
1382
+ * not the list is selectable.
1383
+ */
1384
+ this.itemActivate = output();
1230
1385
  this.itemSelect = output();
1231
1386
  this.listClass = input("", /* @ts-ignore */
1232
1387
  ...(ngDevMode ? [{ debugName: "listClass" }] : /* istanbul ignore next */ []));
@@ -1236,6 +1391,12 @@ class ListComponent {
1236
1391
  ...(ngDevMode ? [{ debugName: "listItemClass" }] : /* istanbul ignore next */ []));
1237
1392
  this.listItemStyle = input({}, /* @ts-ignore */
1238
1393
  ...(ngDevMode ? [{ debugName: "listItemStyle" }] : /* istanbul ignore next */ []));
1394
+ /**
1395
+ * @description `"listbox"` for options to choose from, `"list"` for items that are only shown.
1396
+ * @default "listbox"
1397
+ */
1398
+ this.listRole = input("listbox", /* @ts-ignore */
1399
+ ...(ngDevMode ? [{ debugName: "listRole" }] : /* istanbul ignore next */ []));
1239
1400
  this.listStyle = input({}, /* @ts-ignore */
1240
1401
  ...(ngDevMode ? [{ debugName: "listStyle" }] : /* istanbul ignore next */ []));
1241
1402
  this.maxHeight = input(/* @ts-ignore */
@@ -1264,6 +1425,25 @@ class ListComponent {
1264
1425
  }
1265
1426
  });
1266
1427
  });
1428
+ effect(() => {
1429
+ const listRole = this.listRole();
1430
+ untracked(() => this.listService.role.set(listRole));
1431
+ });
1432
+ effect(onCleanup => {
1433
+ const viewport = this.virtualScrollViewport();
1434
+ if (!viewport) {
1435
+ this.#renderedRange.set(null);
1436
+ return;
1437
+ }
1438
+ const subscription = viewport.renderedRangeStream.subscribe(range => this.#renderedRange.set(range));
1439
+ onCleanup(() => subscription.unsubscribe());
1440
+ });
1441
+ afterRenderEffect({
1442
+ write: () => {
1443
+ this.listService.viewItems();
1444
+ untracked(() => this.restoreFocusAfterRemoval());
1445
+ }
1446
+ });
1267
1447
  afterNextRender({
1268
1448
  read: () => this.setInitialSelectionOrFocus()
1269
1449
  });
@@ -1279,6 +1459,9 @@ class ListComponent {
1279
1459
  }
1280
1460
  onListItemClick(item) {
1281
1461
  this.toggleItem(item);
1462
+ if (!item.isHeader && !this.listService.isDisabled(item)) {
1463
+ this.itemActivate.emit(item);
1464
+ }
1282
1465
  }
1283
1466
  trackByUid(_, item) {
1284
1467
  return item.uid;
@@ -1287,14 +1470,22 @@ class ListComponent {
1287
1470
  const nextItem = this.listService.cycleThroughMatchedItems(buffer);
1288
1471
  if (nextItem) {
1289
1472
  const navigationMode = this.listService.navigableOptions().mode;
1473
+ const selectableOptions = this.listService.selectableOptions();
1290
1474
  this.listService.highlightedItem.set(nextItem);
1291
- if (navigationMode === "select" && this.listService.selectableOptions().enabled) {
1475
+ // In multiple mode typeahead only moves focus, as the arrow keys do: selecting would toggle the match.
1476
+ if (navigationMode === "select" && selectableOptions.enabled && selectableOptions.mode !== "multiple") {
1292
1477
  this.selectItem(nextItem);
1293
1478
  this.itemSelect.emit({ item: nextItem, source: { via: "keyboard", key: buffer } });
1294
1479
  }
1295
1480
  this.scrollToItem(nextItem, true, "instant");
1296
1481
  }
1297
1482
  }
1483
+ /** Focuses the list element of an empty list, which names the list and is described by "No data". */
1484
+ focusEmptyList() {
1485
+ const id = this.effectiveListId();
1486
+ const list = Array.from(this.#hostElementRef.nativeElement.querySelectorAll("ul")).find(element => element.id === id);
1487
+ list?.focus({ preventScroll: true });
1488
+ }
1298
1489
  focusToItem(item) {
1299
1490
  if (this.listService.navigableOptions().enabled) {
1300
1491
  this.listService.highlightedItem.set(item);
@@ -1382,6 +1573,79 @@ class ListComponent {
1382
1573
  }
1383
1574
  }
1384
1575
  }
1576
+ /**
1577
+ * Whether a key event is meant for the list: from the host, the list element, one of this list's own options or
1578
+ * its filter input. Keys typed into controls in header, footer or item templates (or in a nested list) are left
1579
+ * to those controls.
1580
+ */
1581
+ isListKeyTarget(event) {
1582
+ const host = this.#hostElementRef.nativeElement;
1583
+ const target = event.target;
1584
+ if (!(target instanceof HTMLElement) || target === host) {
1585
+ return true;
1586
+ }
1587
+ if (this.filterInputElement()?.nativeElement.contains(target)) {
1588
+ return true;
1589
+ }
1590
+ const ownElement = target.closest("mona-list") === host;
1591
+ return ownElement && (target.hasAttribute("data-uid") || target.id === this.effectiveListId());
1592
+ }
1593
+ rememberFocusedOption(target) {
1594
+ if (!(target instanceof HTMLElement) || target.closest("mona-list") !== this.#hostElementRef.nativeElement) {
1595
+ return;
1596
+ }
1597
+ const uid = target.getAttribute("data-uid");
1598
+ if (uid == null) {
1599
+ return;
1600
+ }
1601
+ const options = this.listService
1602
+ .viewItems()
1603
+ .where(i => !i.isHeader)
1604
+ .toArray();
1605
+ const index = options.findIndex(i => i.uid === uid);
1606
+ this.#focusedOption = index < 0 ? null : { index, uid };
1607
+ // The focused option is where arrow keys continue from, whether it got focus by Tab, click or script.
1608
+ if (index >= 0 &&
1609
+ this.listService.navigableOptions().enabled &&
1610
+ this.listService.highlightedItem() !== options[index]) {
1611
+ this.listService.highlightedItem.set(options[index]);
1612
+ }
1613
+ }
1614
+ /**
1615
+ * When the option that had focus is removed from the data, focus would fall to the page. Move it to the option
1616
+ * now at the same position, or the last one.
1617
+ */
1618
+ restoreFocusAfterRemoval() {
1619
+ const focused = this.#focusedOption;
1620
+ if (!focused) {
1621
+ return;
1622
+ }
1623
+ const options = this.listService
1624
+ .viewItems()
1625
+ .where(i => !i.isHeader)
1626
+ .toArray();
1627
+ if (options.some(i => i.uid === focused.uid)) {
1628
+ return;
1629
+ }
1630
+ const activeElement = document.activeElement;
1631
+ if (activeElement &&
1632
+ activeElement !== document.body &&
1633
+ this.#hostElementRef.nativeElement.contains(activeElement)) {
1634
+ return;
1635
+ }
1636
+ if (activeElement && activeElement !== document.body) {
1637
+ this.#focusedOption = null;
1638
+ return;
1639
+ }
1640
+ const enabled = options.filter(i => !this.listService.isDisabled(i));
1641
+ const next = enabled[Math.min(focused.index, enabled.length - 1)];
1642
+ if (!next) {
1643
+ this.#focusedOption = null;
1644
+ this.#hostElementRef.nativeElement.focus();
1645
+ return;
1646
+ }
1647
+ this.focusToItem(next);
1648
+ }
1385
1649
  scrollToItem(item, focus, behavior = "auto") {
1386
1650
  const element = this.#hostElementRef.nativeElement.querySelector(`[data-uid="${item.uid}"]`);
1387
1651
  if (element) {
@@ -1408,7 +1672,8 @@ class ListComponent {
1408
1672
  selectItem(item) {
1409
1673
  const selectedItems = this.listService.selectedListItems();
1410
1674
  const options = this.listService.selectableOptions();
1411
- if (!options.enabled) {
1675
+ // A disabled item can't be selected, whether it is clicked, typed to or activated with Enter.
1676
+ if (!options.enabled || this.listService.isDisabled(item)) {
1412
1677
  return;
1413
1678
  }
1414
1679
  if ((options.mode === "single" && !selectedItems.contains(item)) ||
@@ -1439,24 +1704,24 @@ class ListComponent {
1439
1704
  }
1440
1705
  setKeyboardEvents() {
1441
1706
  fromEvent(this.#hostElementRef.nativeElement, "keydown")
1442
- .pipe(takeUntilDestroyed(this.#destroyRef), filter(event => event.key === "Enter"), tap(event => event.preventDefault()))
1707
+ .pipe(takeUntilDestroyed(this.#destroyRef), filter(event => event.key === "Enter" && !event.isComposing && this.isListKeyTarget(event)), tap(event => event.preventDefault()))
1443
1708
  .subscribe((event) => {
1444
1709
  const highlightedItem = this.listService.highlightedItem();
1445
1710
  const selectedItem = this.listService.selectedListItems().firstOrDefault();
1446
1711
  const source = { via: "keyboard", key: event.key };
1447
- if (highlightedItem) {
1448
- this.selectItem(highlightedItem);
1449
- this.itemSelect.emit({ item: highlightedItem, source });
1450
- }
1451
- else if (selectedItem) {
1452
- this.selectItem(selectedItem);
1453
- this.itemSelect.emit({ item: selectedItem, source });
1712
+ const item = highlightedItem ?? selectedItem;
1713
+ if (item) {
1714
+ this.selectItem(item);
1715
+ this.itemSelect.emit({ item, source });
1716
+ if (!item.isHeader && !this.listService.isDisabled(item)) {
1717
+ this.itemActivate.emit(item);
1718
+ }
1454
1719
  }
1455
1720
  });
1456
1721
  }
1457
1722
  setNavigationEvents() {
1458
1723
  fromEvent(this.#hostElementRef.nativeElement, "keydown")
1459
- .pipe(takeUntilDestroyed(this.#destroyRef), filter(() => this.listService.navigableOptions().enabled))
1724
+ .pipe(takeUntilDestroyed(this.#destroyRef), filter(event => this.listService.navigableOptions().enabled && this.isListKeyTarget(event)))
1460
1725
  .subscribe(event => {
1461
1726
  if (this.handleMultipleSelectionKeys(event)) {
1462
1727
  event.preventDefault();
@@ -1467,7 +1732,8 @@ class ListComponent {
1467
1732
  this.#typeaheadKey$.next(event.key);
1468
1733
  return;
1469
1734
  }
1470
- if (getListNavigationDirection(event.key) == null) {
1735
+ // Alt+Arrow is left to the page and to components built on the list (the list box moves items with it).
1736
+ if (getListNavigationDirection(event.key) == null || event.altKey) {
1471
1737
  return;
1472
1738
  }
1473
1739
  event.preventDefault();
@@ -1493,8 +1759,23 @@ class ListComponent {
1493
1759
  if (previous && this.#hostElementRef.nativeElement.contains(previous)) {
1494
1760
  return;
1495
1761
  }
1496
- this.setInitialSelectionOrFocus();
1762
+ if (this.listService.viewItems().isEmpty()) {
1763
+ this.focusEmptyList();
1764
+ return;
1765
+ }
1766
+ if (this.focusOnMount()) {
1767
+ this.setInitialSelectionOrFocus();
1768
+ return;
1769
+ }
1770
+ // The host only holds the Tab stop while its option isn't drawn; hand focus on to that option.
1771
+ const item = this.listService.focusableItem();
1772
+ if (item) {
1773
+ this.focusToItem(item);
1774
+ }
1497
1775
  });
1776
+ fromEvent(this.#hostElementRef.nativeElement, "focusin")
1777
+ .pipe(takeUntilDestroyed(this.#destroyRef))
1778
+ .subscribe(event => this.rememberFocusedOption(event.target));
1498
1779
  fromEvent(this.#hostElementRef.nativeElement, "focusout")
1499
1780
  .pipe(takeUntilDestroyed(this.#destroyRef))
1500
1781
  .subscribe(event => {
@@ -1502,6 +1783,7 @@ class ListComponent {
1502
1783
  if (next && this.#hostElementRef.nativeElement.contains(next)) {
1503
1784
  return;
1504
1785
  }
1786
+ this.#focusedOption = null;
1505
1787
  this.listService.highlightedItem.set(null);
1506
1788
  });
1507
1789
  }
@@ -1519,7 +1801,7 @@ class ListComponent {
1519
1801
  this.itemSelect.emit({ item, source: { via: "mouse" } });
1520
1802
  }
1521
1803
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1522
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ListComponent, isStandalone: true, selector: "mona-list", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, focusOnMount: { classPropertyName: "focusOnMount", publicName: "focusOnMount", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, listClass: { classPropertyName: "listClass", publicName: "listClass", isSignal: true, isRequired: false, transformFunction: null }, listId: { classPropertyName: "listId", publicName: "listId", isSignal: true, isRequired: false, transformFunction: null }, listItemClass: { classPropertyName: "listItemClass", publicName: "listItemClass", isSignal: true, isRequired: false, transformFunction: null }, listItemStyle: { classPropertyName: "listItemStyle", publicName: "listItemStyle", isSignal: true, isRequired: false, transformFunction: null }, listStyle: { classPropertyName: "listStyle", publicName: "listStyle", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect" }, host: { properties: { "attr.tabindex": "hostTabIndex()", "class": "classes()", "style.height": "listHeight()", "style.max-height": "listMaxHeight()", "style.max-width": "listMaxWidth()", "style.width": "listWidth()" } }, queries: [{ propertyName: "footerTemplate", first: true, predicate: ListFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ListGroupHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ListHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: ListItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: ListNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "filterInput", first: true, predicate: FilterInputComponent, descendants: true, isSignal: true }, { propertyName: "virtualScrollViewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }], ngImport: i0, template: "@if (headerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n}\n@if (listService.filterableOptions().enabled && listService.filterInputVisible()) {\n <div class=\"p-2\">\n <mona-filter-input\n [filter]=\"listService.filterText()\"\n [debounce]=\"listService.filterableOptions().debounce\"\n [placeholder]=\"listService.filterPlaceholder()\"\n [ariaLabel]=\"messages().filterList\"\n [controls]=\"effectiveListId()\"\n [activeDescendant]=\"activeDescendant()\"\n [size]=\"size()\"\n (filterChange)=\"onFilterChange($event)\"></mona-filter-input>\n </div>\n}\n@if (listService.virtualScrollOptions().enabled) {\n @if (listService.viewItems().length !== 0) {\n <cdk-virtual-scroll-viewport\n [itemSize]=\"listService.virtualScrollOptions().height\"\n [style.height]=\"viewportHeight()\">\n <ul\n [class]=\"innerListClasses()\"\n [style]=\"listStyle()\"\n [tabIndex]=\"-1\"\n [id]=\"effectiveListId()\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-multiselectable]=\"listService.selectableOptions().mode === 'multiple' || null\">\n <ng-container *cdkVirtualFor=\"let item of listService.viewItems(); trackBy: trackByUid\">\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-container>\n </ul>\n </cdk-virtual-scroll-viewport>\n } @else if (noDataTemplate()) {\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n } @else {\n <mona-placeholder\n [text]=\"messages().noData\"\n class=\"w-full h-full flex items-center justify-center\"></mona-placeholder>\n }\n} @else {\n @if (listService.viewItems().length !== 0) {\n <ul\n [class]=\"innerListClasses()\"\n [style]=\"listStyle()\"\n [tabIndex]=\"-1\"\n [id]=\"effectiveListId()\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-multiselectable]=\"listService.selectableOptions().mode === 'multiple' || null\">\n @for (item of listService.viewItems(); track item.uid) {\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </ul>\n } @else if (noDataTemplate()) {\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n } @else {\n <mona-placeholder\n [text]=\"messages().noData\"\n class=\"w-full h-full flex items-center justify-center\"></mona-placeholder>\n }\n}\n@if (footerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n}\n\n<ng-template #listItemTemplate let-item>\n @if (item.isHeader) {\n <li [class]=\"groupHeaderClasses()\" [style]=\"listItemStyle()\" [id]=\"item.uid\" role=\"presentation\">\n <mona-list-item [item]=\"item\" [template]=\"groupHeaderTemplate()\"></mona-list-item>\n </li>\n } @else {\n <li\n [class]=\"listItemClass()\"\n [class.px-0.5]=\"true\"\n [style]=\"listItemStyle()\"\n [id]=\"item.uid\"\n [attr.data-uid]=\"item.uid\"\n (click)=\"onListItemClick(item)\"\n monaListItem\n [item]=\"item\">\n <mona-list-item [item]=\"item\" [template]=\"itemTemplate()\"></mona-list-item>\n </li>\n }\n</ng-template>\n", dependencies: [{ kind: "component", type: FilterInputComponent, selector: "mona-filter-input", inputs: ["activeDescendant", "ariaLabel", "controls", "debounce", "filter", "placeholder", "size"], outputs: ["filterChange", "inputBlur", "inputFocus"] }, { kind: "component", type: ListItemComponent, selector: "mona-list-item", inputs: ["item", "template"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ListItemDirective, selector: "li[monaListItem]", inputs: ["item"] }, { kind: "component", type: PlaceholderComponent, selector: "mona-placeholder", inputs: ["text", "class"] }, { kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }] }); }
1804
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ListComponent, isStandalone: true, selector: "mona-list", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "ariaLabelledBy", isSignal: true, isRequired: false, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, focusOnMount: { classPropertyName: "focusOnMount", publicName: "focusOnMount", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, listClass: { classPropertyName: "listClass", publicName: "listClass", isSignal: true, isRequired: false, transformFunction: null }, listId: { classPropertyName: "listId", publicName: "listId", isSignal: true, isRequired: false, transformFunction: null }, listItemClass: { classPropertyName: "listItemClass", publicName: "listItemClass", isSignal: true, isRequired: false, transformFunction: null }, listItemStyle: { classPropertyName: "listItemStyle", publicName: "listItemStyle", isSignal: true, isRequired: false, transformFunction: null }, listRole: { classPropertyName: "listRole", publicName: "listRole", isSignal: true, isRequired: false, transformFunction: null }, listStyle: { classPropertyName: "listStyle", publicName: "listStyle", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemActivate: "itemActivate", itemSelect: "itemSelect" }, host: { properties: { "attr.tabindex": "hostTabIndex()", "class": "classes()", "style.height": "listHeight()", "style.max-height": "listMaxHeight()", "style.max-width": "listMaxWidth()", "style.width": "listWidth()" } }, queries: [{ propertyName: "footerTemplate", first: true, predicate: ListFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ListGroupHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ListHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: ListItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: ListNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "filterInput", first: true, predicate: FilterInputComponent, descendants: true, isSignal: true }, { propertyName: "filterInputElement", first: true, predicate: FilterInputComponent, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "virtualScrollViewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }], ngImport: i0, template: "@if (headerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n}\n@if (listService.filterableOptions().enabled && listService.filterInputVisible()) {\n <div class=\"p-2\">\n <mona-filter-input\n [filter]=\"listService.filterText()\"\n [debounce]=\"listService.filterableOptions().debounce\"\n [placeholder]=\"listService.filterPlaceholder()\"\n [ariaLabel]=\"messages().filterList\"\n [controls]=\"effectiveListId()\"\n [activeDescendant]=\"activeDescendant()\"\n [size]=\"size()\"\n (filterChange)=\"onFilterChange($event)\"></mona-filter-input>\n </div>\n}\n@let listRole = listService.role();\n@let isListbox = listRole === \"listbox\";\n@if (listService.virtualScrollOptions().enabled) {\n @if (listService.viewItems().length !== 0) {\n <cdk-virtual-scroll-viewport\n [itemSize]=\"listService.virtualScrollOptions().height\"\n [style.height]=\"viewportHeight()\">\n <ul\n [class]=\"innerListClasses()\"\n [style]=\"listStyle()\"\n [tabIndex]=\"-1\"\n [id]=\"effectiveListId()\"\n [attr.role]=\"listRole\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-busy]=\"busy() || null\"\n [attr.aria-multiselectable]=\"\n (isListbox && listService.selectableOptions().mode === 'multiple') || null\n \">\n <ng-container *cdkVirtualFor=\"let item of listService.viewItems(); trackBy: trackByUid\">\n @if (item.isHeader) {\n <li\n [class]=\"groupHeaderClasses()\"\n [style]=\"listItemStyle()\"\n [id]=\"item.uid\"\n role=\"presentation\">\n <mona-list-item [item]=\"item\" [template]=\"groupHeaderTemplate()\"></mona-list-item>\n </li>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </ng-container>\n </ul>\n </cdk-virtual-scroll-viewport>\n } @else {\n <ng-container [ngTemplateOutlet]=\"emptyListTemplate\"></ng-container>\n }\n} @else {\n @if (listService.viewItems().length !== 0) {\n <ul\n [class]=\"innerListClasses()\"\n [style]=\"listStyle()\"\n [tabIndex]=\"-1\"\n [id]=\"effectiveListId()\"\n [attr.role]=\"listRole\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-busy]=\"busy() || null\"\n [attr.aria-multiselectable]=\"(isListbox && listService.selectableOptions().mode === 'multiple') || null\">\n @for (section of viewSections(); track section.key) {\n @if (section.header; as header) {\n @if (isListbox) {\n <!-- A group of options, named by its header. -->\n <li role=\"none\" class=\"m-0 list-none p-0\">\n <ul role=\"group\" [attr.aria-labelledby]=\"header.uid\" class=\"m-0 list-none p-0\">\n <li\n [class]=\"groupHeaderClasses()\"\n [style]=\"listItemStyle()\"\n [id]=\"header.uid\"\n role=\"presentation\">\n <mona-list-item [item]=\"header\" [template]=\"groupHeaderTemplate()\"></mona-list-item>\n </li>\n @for (item of section.items; track item.uid) {\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </ul>\n </li>\n } @else {\n <!-- A nested list, named by its header. -->\n <li class=\"m-0 list-none p-0\">\n <div [class]=\"groupHeaderClasses()\" [style]=\"listItemStyle()\" [id]=\"header.uid\">\n <mona-list-item [item]=\"header\" [template]=\"groupHeaderTemplate()\"></mona-list-item>\n </div>\n <ul role=\"list\" [attr.aria-labelledby]=\"header.uid\" class=\"m-0 list-none p-0\">\n @for (item of section.items; track item.uid) {\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </ul>\n </li>\n }\n } @else {\n @for (item of section.items; track item.uid) {\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n }\n }\n </ul>\n } @else {\n <ng-container [ngTemplateOutlet]=\"emptyListTemplate\"></ng-container>\n }\n}\n@if (footerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n}\n\n<!-- An empty list keeps its named list element, so it stays in the accessibility tree, described by \"No data\". -->\n<ng-template #emptyListTemplate>\n <!-- The empty list element lies over the \"No data\" content, so that content keeps its place and the ring frames it. -->\n <div class=\"relative w-full h-full\">\n @if (noDataTemplate()) {\n <div [id]=\"noDataId\" class=\"contents\">\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </div>\n } @else {\n <mona-placeholder\n [id]=\"noDataId\"\n [text]=\"messages().noData\"\n class=\"w-full h-full flex items-center justify-center\"></mona-placeholder>\n }\n <ul\n [class]=\"emptyListClasses()\"\n [style]=\"listStyle()\"\n [tabIndex]=\"0\"\n [id]=\"effectiveListId()\"\n [attr.role]=\"listService.role()\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-busy]=\"busy() || null\"\n [attr.aria-describedby]=\"noDataId\"></ul>\n </div>\n</ng-template>\n\n<ng-template #listItemTemplate let-item>\n <li\n [class]=\"listItemClass()\"\n [class.px-0.5]=\"true\"\n [style]=\"listItemStyle()\"\n [id]=\"item.uid\"\n [attr.data-uid]=\"item.uid\"\n (click)=\"onListItemClick(item)\"\n monaListItem\n [item]=\"item\">\n <mona-list-item [item]=\"item\" [template]=\"itemTemplate()\"></mona-list-item>\n </li>\n</ng-template>\n", dependencies: [{ kind: "component", type: FilterInputComponent, selector: "mona-filter-input", inputs: ["activeDescendant", "ariaControls", "ariaLabel", "autoFocus", "controls", "debounce", "filter", "placeholder", "size"], outputs: ["filterChange", "inputBlur", "inputFocus"] }, { kind: "component", type: ListItemComponent, selector: "mona-list-item", inputs: ["item", "template"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ListItemDirective, selector: "li[monaListItem]", inputs: ["item"] }, { kind: "component", type: PlaceholderComponent, selector: "mona-placeholder", inputs: ["text", "class"] }, { kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }] }); }
1523
1805
  }
1524
1806
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListComponent, decorators: [{
1525
1807
  type: Component,
@@ -1539,8 +1821,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
1539
1821
  "[style.max-height]": "listMaxHeight()",
1540
1822
  "[style.max-width]": "listMaxWidth()",
1541
1823
  "[style.width]": "listWidth()"
1542
- }, template: "@if (headerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n}\n@if (listService.filterableOptions().enabled && listService.filterInputVisible()) {\n <div class=\"p-2\">\n <mona-filter-input\n [filter]=\"listService.filterText()\"\n [debounce]=\"listService.filterableOptions().debounce\"\n [placeholder]=\"listService.filterPlaceholder()\"\n [ariaLabel]=\"messages().filterList\"\n [controls]=\"effectiveListId()\"\n [activeDescendant]=\"activeDescendant()\"\n [size]=\"size()\"\n (filterChange)=\"onFilterChange($event)\"></mona-filter-input>\n </div>\n}\n@if (listService.virtualScrollOptions().enabled) {\n @if (listService.viewItems().length !== 0) {\n <cdk-virtual-scroll-viewport\n [itemSize]=\"listService.virtualScrollOptions().height\"\n [style.height]=\"viewportHeight()\">\n <ul\n [class]=\"innerListClasses()\"\n [style]=\"listStyle()\"\n [tabIndex]=\"-1\"\n [id]=\"effectiveListId()\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-multiselectable]=\"listService.selectableOptions().mode === 'multiple' || null\">\n <ng-container *cdkVirtualFor=\"let item of listService.viewItems(); trackBy: trackByUid\">\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-container>\n </ul>\n </cdk-virtual-scroll-viewport>\n } @else if (noDataTemplate()) {\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n } @else {\n <mona-placeholder\n [text]=\"messages().noData\"\n class=\"w-full h-full flex items-center justify-center\"></mona-placeholder>\n }\n} @else {\n @if (listService.viewItems().length !== 0) {\n <ul\n [class]=\"innerListClasses()\"\n [style]=\"listStyle()\"\n [tabIndex]=\"-1\"\n [id]=\"effectiveListId()\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-multiselectable]=\"listService.selectableOptions().mode === 'multiple' || null\">\n @for (item of listService.viewItems(); track item.uid) {\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </ul>\n } @else if (noDataTemplate()) {\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n } @else {\n <mona-placeholder\n [text]=\"messages().noData\"\n class=\"w-full h-full flex items-center justify-center\"></mona-placeholder>\n }\n}\n@if (footerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n}\n\n<ng-template #listItemTemplate let-item>\n @if (item.isHeader) {\n <li [class]=\"groupHeaderClasses()\" [style]=\"listItemStyle()\" [id]=\"item.uid\" role=\"presentation\">\n <mona-list-item [item]=\"item\" [template]=\"groupHeaderTemplate()\"></mona-list-item>\n </li>\n } @else {\n <li\n [class]=\"listItemClass()\"\n [class.px-0.5]=\"true\"\n [style]=\"listItemStyle()\"\n [id]=\"item.uid\"\n [attr.data-uid]=\"item.uid\"\n (click)=\"onListItemClick(item)\"\n monaListItem\n [item]=\"item\">\n <mona-list-item [item]=\"item\" [template]=\"itemTemplate()\"></mona-list-item>\n </li>\n }\n</ng-template>\n" }]
1543
- }], ctorParameters: () => [], propDecorators: { filterInput: [{ type: i0.ViewChild, args: [i0.forwardRef(() => FilterInputComponent), { isSignal: true }] }], footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupHeaderTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListGroupHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], noDataTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListNoDataTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], virtualScrollViewport: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkVirtualScrollViewport), { isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], focusOnMount: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusOnMount", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], itemSelect: [{ type: i0.Output, args: ["itemSelect"] }], listClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "listClass", required: false }] }], listId: [{ type: i0.Input, args: [{ isSignal: true, alias: "listId", required: false }] }], listItemClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "listItemClass", required: false }] }], listItemStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "listItemStyle", required: false }] }], listStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "listStyle", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], textField: [{ type: i0.Input, args: [{ isSignal: true, alias: "textField", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
1824
+ }, template: "@if (headerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n}\n@if (listService.filterableOptions().enabled && listService.filterInputVisible()) {\n <div class=\"p-2\">\n <mona-filter-input\n [filter]=\"listService.filterText()\"\n [debounce]=\"listService.filterableOptions().debounce\"\n [placeholder]=\"listService.filterPlaceholder()\"\n [ariaLabel]=\"messages().filterList\"\n [controls]=\"effectiveListId()\"\n [activeDescendant]=\"activeDescendant()\"\n [size]=\"size()\"\n (filterChange)=\"onFilterChange($event)\"></mona-filter-input>\n </div>\n}\n@let listRole = listService.role();\n@let isListbox = listRole === \"listbox\";\n@if (listService.virtualScrollOptions().enabled) {\n @if (listService.viewItems().length !== 0) {\n <cdk-virtual-scroll-viewport\n [itemSize]=\"listService.virtualScrollOptions().height\"\n [style.height]=\"viewportHeight()\">\n <ul\n [class]=\"innerListClasses()\"\n [style]=\"listStyle()\"\n [tabIndex]=\"-1\"\n [id]=\"effectiveListId()\"\n [attr.role]=\"listRole\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-busy]=\"busy() || null\"\n [attr.aria-multiselectable]=\"\n (isListbox && listService.selectableOptions().mode === 'multiple') || null\n \">\n <ng-container *cdkVirtualFor=\"let item of listService.viewItems(); trackBy: trackByUid\">\n @if (item.isHeader) {\n <li\n [class]=\"groupHeaderClasses()\"\n [style]=\"listItemStyle()\"\n [id]=\"item.uid\"\n role=\"presentation\">\n <mona-list-item [item]=\"item\" [template]=\"groupHeaderTemplate()\"></mona-list-item>\n </li>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </ng-container>\n </ul>\n </cdk-virtual-scroll-viewport>\n } @else {\n <ng-container [ngTemplateOutlet]=\"emptyListTemplate\"></ng-container>\n }\n} @else {\n @if (listService.viewItems().length !== 0) {\n <ul\n [class]=\"innerListClasses()\"\n [style]=\"listStyle()\"\n [tabIndex]=\"-1\"\n [id]=\"effectiveListId()\"\n [attr.role]=\"listRole\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-busy]=\"busy() || null\"\n [attr.aria-multiselectable]=\"(isListbox && listService.selectableOptions().mode === 'multiple') || null\">\n @for (section of viewSections(); track section.key) {\n @if (section.header; as header) {\n @if (isListbox) {\n <!-- A group of options, named by its header. -->\n <li role=\"none\" class=\"m-0 list-none p-0\">\n <ul role=\"group\" [attr.aria-labelledby]=\"header.uid\" class=\"m-0 list-none p-0\">\n <li\n [class]=\"groupHeaderClasses()\"\n [style]=\"listItemStyle()\"\n [id]=\"header.uid\"\n role=\"presentation\">\n <mona-list-item [item]=\"header\" [template]=\"groupHeaderTemplate()\"></mona-list-item>\n </li>\n @for (item of section.items; track item.uid) {\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </ul>\n </li>\n } @else {\n <!-- A nested list, named by its header. -->\n <li class=\"m-0 list-none p-0\">\n <div [class]=\"groupHeaderClasses()\" [style]=\"listItemStyle()\" [id]=\"header.uid\">\n <mona-list-item [item]=\"header\" [template]=\"groupHeaderTemplate()\"></mona-list-item>\n </div>\n <ul role=\"list\" [attr.aria-labelledby]=\"header.uid\" class=\"m-0 list-none p-0\">\n @for (item of section.items; track item.uid) {\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </ul>\n </li>\n }\n } @else {\n @for (item of section.items; track item.uid) {\n <ng-container\n [ngTemplateOutlet]=\"listItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n }\n }\n </ul>\n } @else {\n <ng-container [ngTemplateOutlet]=\"emptyListTemplate\"></ng-container>\n }\n}\n@if (footerTemplate()) {\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n}\n\n<!-- An empty list keeps its named list element, so it stays in the accessibility tree, described by \"No data\". -->\n<ng-template #emptyListTemplate>\n <!-- The empty list element lies over the \"No data\" content, so that content keeps its place and the ring frames it. -->\n <div class=\"relative w-full h-full\">\n @if (noDataTemplate()) {\n <div [id]=\"noDataId\" class=\"contents\">\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </div>\n } @else {\n <mona-placeholder\n [id]=\"noDataId\"\n [text]=\"messages().noData\"\n class=\"w-full h-full flex items-center justify-center\"></mona-placeholder>\n }\n <ul\n [class]=\"emptyListClasses()\"\n [style]=\"listStyle()\"\n [tabIndex]=\"0\"\n [id]=\"effectiveListId()\"\n [attr.role]=\"listService.role()\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-busy]=\"busy() || null\"\n [attr.aria-describedby]=\"noDataId\"></ul>\n </div>\n</ng-template>\n\n<ng-template #listItemTemplate let-item>\n <li\n [class]=\"listItemClass()\"\n [class.px-0.5]=\"true\"\n [style]=\"listItemStyle()\"\n [id]=\"item.uid\"\n [attr.data-uid]=\"item.uid\"\n (click)=\"onListItemClick(item)\"\n monaListItem\n [item]=\"item\">\n <mona-list-item [item]=\"item\" [template]=\"itemTemplate()\"></mona-list-item>\n </li>\n</ng-template>\n" }]
1825
+ }], ctorParameters: () => [], propDecorators: { filterInput: [{ type: i0.ViewChild, args: [i0.forwardRef(() => FilterInputComponent), { isSignal: true }] }], filterInputElement: [{ type: i0.ViewChild, args: [i0.forwardRef(() => FilterInputComponent), { ...{ read: ElementRef }, isSignal: true }] }], footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupHeaderTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListGroupHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], noDataTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListNoDataTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], virtualScrollViewport: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkVirtualScrollViewport), { isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledBy", required: false }] }], busy: [{ type: i0.Input, args: [{ isSignal: true, alias: "busy", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], focusOnMount: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusOnMount", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], itemActivate: [{ type: i0.Output, args: ["itemActivate"] }], itemSelect: [{ type: i0.Output, args: ["itemSelect"] }], listClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "listClass", required: false }] }], listId: [{ type: i0.Input, args: [{ isSignal: true, alias: "listId", required: false }] }], listItemClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "listItemClass", required: false }] }], listItemStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "listItemStyle", required: false }] }], listRole: [{ type: i0.Input, args: [{ isSignal: true, alias: "listRole", required: false }] }], listStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "listStyle", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], textField: [{ type: i0.Input, args: [{ isSignal: true, alias: "textField", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
1826
+
1827
+ /**
1828
+ * Lets a component that wraps a `mona-list-view` in its own template share its `ListService` with that list view.
1829
+ * Provide it in `viewProviders` (`{ provide: LIST_VIEW_HOST_LIST_SERVICE, useExisting: ListService }`), so only the
1830
+ * component's own list view sees it, never a list view placed in content the component projects or renders from a
1831
+ * consumer's template. Without it, every list view has its own service.
1832
+ */
1833
+ const LIST_VIEW_HOST_LIST_SERVICE = new InjectionToken("LIST_VIEW_HOST_LIST_SERVICE");
1544
1834
 
1545
1835
  /*
1546
1836
  * Public API Surface of @nanahoshi/mona-ui/list
@@ -1550,5 +1840,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
1550
1840
  * Generated bundle index. Do not edit.
1551
1841
  */
1552
1842
 
1553
- export { LIST_DEFAULT_MESSAGES, ListComponent, ListFooterTemplateDirective, ListGroupHeaderTemplateDirective, ListHeaderTemplateDirective, ListItem, ListItemTemplateDirective, ListNoDataTemplateDirective, ListService };
1843
+ export { LIST_DEFAULT_MESSAGES, LIST_VIEW_HOST_LIST_SERVICE, ListComponent, ListFooterTemplateDirective, ListGroupHeaderTemplateDirective, ListHeaderTemplateDirective, ListItem, ListItemTemplateDirective, ListNoDataTemplateDirective, ListService };
1554
1844
  //# sourceMappingURL=nanahoshi-mona-ui-internal-list.mjs.map