@nanahoshi/mona-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +25 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
  3. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
  4. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
  5. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
  6. package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
  7. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
  8. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
  9. package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
  10. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
  11. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
  12. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
  13. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
  14. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
  15. package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
  16. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
  17. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
  18. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
  19. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
  20. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
  21. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
  22. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
  23. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
  24. package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
  25. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
  26. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
  28. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
  29. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
  30. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
  31. package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
  32. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
  33. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
  34. package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
  35. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
  36. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
  39. package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
  40. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
  41. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
  42. package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
  43. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
  44. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
  45. package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
  46. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
  47. package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
  48. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
  49. package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
  50. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
  51. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
  52. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
  53. package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
  54. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
  55. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
  56. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
  57. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
  58. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
  59. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
  60. package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
  61. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
  62. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
  63. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
  64. package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
  65. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
  66. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
  67. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
  68. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
  69. package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
  70. package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
  71. package/package.json +289 -0
  72. package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
  73. package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
  74. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
  75. package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
  76. package/types/nanahoshi-mona-ui-button.d.ts +111 -0
  77. package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
  78. package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
  79. package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
  80. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
  81. package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
  82. package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
  83. package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
  84. package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
  85. package/types/nanahoshi-mona-ui-common.d.ts +386 -0
  86. package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
  87. package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
  88. package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
  89. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
  90. package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
  91. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
  92. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
  93. package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
  94. package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
  95. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
  96. package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
  97. package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
  98. package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
  99. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
  100. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
  101. package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
  102. package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
  103. package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
  104. package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
  105. package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
  106. package/types/nanahoshi-mona-ui-list.d.ts +1 -0
  107. package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
  108. package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
  109. package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
  110. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
  111. package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
  112. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
  113. package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
  114. package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
  115. package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
  116. package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
  117. package/types/nanahoshi-mona-ui-query.d.ts +89 -0
  118. package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
  119. package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
  120. package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
  121. package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
  122. package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
  123. package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
  124. package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
  125. package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
  126. package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
  127. package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
  128. package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
  129. package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
  130. package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
  131. package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
  132. package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
  133. package/types/nanahoshi-mona-ui-window.d.ts +295 -0
  134. package/types/nanahoshi-mona-ui.d.ts +2 -0
@@ -0,0 +1,630 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { Directive, inject, DestroyRef, ElementRef, computed, contentChild, TemplateRef, output, input, signal, effect, untracked, afterNextRender, Component } from '@angular/core';
4
+ import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
+ import { LucideChevronUp, LucideChevronDown, LucideChevronLeft, LucideChevronRight, LucideChevronsLeft, LucideChevronsRight, LucideX, LucideTrash2 } from '@lucide/angular';
6
+ import { ButtonDirective } from '@nanahoshi/mona-ui/button';
7
+ import { PreventableEvent, ContainsPipe } from '@nanahoshi/mona-ui/common';
8
+ import { ListService } from '@nanahoshi/mona-ui/internal/list';
9
+ import { ListViewComponent, ListViewSelectableDirective, ListViewItemTemplateDirective, ListViewNavigableDirective, ListViewNoDataTemplateDirective, ListViewFooterTemplateDirective, ListViewHeaderTemplateDirective } from '@nanahoshi/mona-ui/list-view';
10
+ import { ThemeService } from '@nanahoshi/mona-ui/theme';
11
+ import { ImmutableList } from '@mirei/ts-collections';
12
+ import { Subject, ReplaySubject, sample, delay, filter, tap, scan, startWith, switchMap } from 'rxjs';
13
+ import { cva } from 'class-variance-authority';
14
+
15
+ class ListBoxFooterTemplateDirective {
16
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxFooterTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
17
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ListBoxFooterTemplateDirective, isStandalone: true, selector: "ng-template[monaListBoxFooterTemplate]", ngImport: i0 }); }
18
+ }
19
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxFooterTemplateDirective, decorators: [{
20
+ type: Directive,
21
+ args: [{
22
+ selector: "ng-template[monaListBoxFooterTemplate]"
23
+ }]
24
+ }] });
25
+
26
+ class ListBoxHeaderTemplateDirective {
27
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxHeaderTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
28
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ListBoxHeaderTemplateDirective, isStandalone: true, selector: "ng-template[monaListBoxHeaderTemplate]", ngImport: i0 }); }
29
+ }
30
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxHeaderTemplateDirective, decorators: [{
31
+ type: Directive,
32
+ args: [{
33
+ selector: "ng-template[monaListBoxHeaderTemplate]"
34
+ }]
35
+ }] });
36
+
37
+ class ListBoxItemTemplateDirective {
38
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxItemTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
39
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ListBoxItemTemplateDirective, isStandalone: true, selector: "ng-template[monaListBoxItemTemplate]", ngImport: i0 }); }
40
+ }
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxItemTemplateDirective, decorators: [{
42
+ type: Directive,
43
+ args: [{
44
+ selector: "ng-template[monaListBoxItemTemplate]"
45
+ }]
46
+ }] });
47
+
48
+ class ListBoxNoDataTemplateDirective {
49
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxNoDataTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
50
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ListBoxNoDataTemplateDirective, isStandalone: true, selector: "ng-template[monaListBoxNoDataTemplate]", ngImport: i0 }); }
51
+ }
52
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxNoDataTemplateDirective, decorators: [{
53
+ type: Directive,
54
+ args: [{
55
+ selector: "ng-template[monaListBoxNoDataTemplate]"
56
+ }]
57
+ }] });
58
+
59
+ class ListBoxClearEvent extends PreventableEvent {
60
+ #action = "clear";
61
+ #selectedItems;
62
+ constructor(selectedItems, originalEvent) {
63
+ super("listBoxClear", originalEvent);
64
+ this.#selectedItems = [...selectedItems];
65
+ }
66
+ get action() {
67
+ return this.#action;
68
+ }
69
+ get selectedItems() {
70
+ return this.#selectedItems;
71
+ }
72
+ }
73
+
74
+ class ListBoxMoveEvent extends PreventableEvent {
75
+ #action;
76
+ #newIndex;
77
+ #oldIndex;
78
+ #selectedIndices;
79
+ #selectedItems;
80
+ constructor(action, selectedItems, selectedIndices, oldIndex, newIndex, originalEvent) {
81
+ super("listBoxMove", originalEvent);
82
+ this.#action = action;
83
+ this.#newIndex = newIndex;
84
+ this.#oldIndex = oldIndex;
85
+ this.#selectedIndices = Array.from(selectedIndices);
86
+ this.#selectedItems = Array.from(selectedItems);
87
+ }
88
+ get action() {
89
+ return this.#action;
90
+ }
91
+ get newIndex() {
92
+ return this.#newIndex;
93
+ }
94
+ get oldIndex() {
95
+ return this.#oldIndex;
96
+ }
97
+ get selectedIndices() {
98
+ return this.#selectedIndices;
99
+ }
100
+ get selectedItems() {
101
+ return this.#selectedItems;
102
+ }
103
+ }
104
+
105
+ class ListBoxRemoveEvent extends PreventableEvent {
106
+ #action = "remove";
107
+ #selectedItems;
108
+ constructor(selectedItems, originalEvent) {
109
+ super("listBoxRemove", originalEvent);
110
+ this.#selectedItems = [...selectedItems];
111
+ }
112
+ get action() {
113
+ return this.#action;
114
+ }
115
+ get selectedItems() {
116
+ return this.#selectedItems;
117
+ }
118
+ }
119
+
120
+ class ListBoxTransferEvent extends PreventableEvent {
121
+ #action;
122
+ #selectedItems;
123
+ constructor(action, selectedItems, originalEvent) {
124
+ super("listBoxTransfer", originalEvent);
125
+ this.#action = action;
126
+ this.#selectedItems = Array.from(selectedItems);
127
+ }
128
+ get action() {
129
+ return this.#action;
130
+ }
131
+ get selectedItems() {
132
+ return this.#selectedItems;
133
+ }
134
+ }
135
+
136
+ const listBoxBaseVariants = cva(`
137
+ flex gap-1
138
+ [&_mona-list-view]:w-full
139
+ `, {
140
+ variants: {
141
+ direction: {
142
+ horizontal: "flex-row",
143
+ vertical: "flex-col"
144
+ },
145
+ reversed: {
146
+ true: "",
147
+ false: ""
148
+ },
149
+ rounded: {
150
+ small: "rounded-sm",
151
+ medium: "rounded-md",
152
+ large: "rounded-lg",
153
+ none: "rounded-none"
154
+ },
155
+ size: {
156
+ small: "text-sm",
157
+ medium: "text-base",
158
+ large: "text-lg"
159
+ }
160
+ },
161
+ compoundVariants: [
162
+ {
163
+ direction: "horizontal",
164
+ reversed: true,
165
+ class: "flex-row-reverse"
166
+ },
167
+ {
168
+ direction: "vertical",
169
+ reversed: true,
170
+ class: "flex-col-reverse"
171
+ }
172
+ ]
173
+ });
174
+ const listBoxToolbarVariants = cva(`
175
+ flex gap-1
176
+ items-center justify-center
177
+ `, {
178
+ variants: {
179
+ direction: {
180
+ horizontal: "flex-row",
181
+ vertical: "flex-col"
182
+ }
183
+ }
184
+ });
185
+
186
+ const listBoxBaseThemeVariants = (theme) => {
187
+ switch (theme) {
188
+ case "mona":
189
+ return listBoxBaseVariants;
190
+ default:
191
+ return listBoxBaseVariants;
192
+ }
193
+ };
194
+ const listBoxToolbarThemeVariants = (theme) => {
195
+ switch (theme) {
196
+ case "mona":
197
+ return listBoxToolbarVariants;
198
+ default:
199
+ return listBoxToolbarVariants;
200
+ }
201
+ };
202
+
203
+ class ListBoxComponent {
204
+ #dataStateChange$;
205
+ #destroyRef;
206
+ #hostElementRef;
207
+ #listService;
208
+ #notifySelectionChange$;
209
+ #themeService;
210
+ constructor() {
211
+ this.#dataStateChange$ = new Subject();
212
+ this.#destroyRef = inject(DestroyRef);
213
+ this.#hostElementRef = inject(ElementRef);
214
+ this.#listService = inject(ListService);
215
+ this.#notifySelectionChange$ = new ReplaySubject(1);
216
+ this.#themeService = inject(ThemeService);
217
+ /**
218
+ * The list box (`this` or the connected list box) that currently holds the selection; falling back to `this`
219
+ * when neither side has a selection. Used by actions that make sense to run on `this` even with no selection
220
+ * (e.g., "transfer all"). For actions that require a real selection to proceed, use {@link getSelectedListBox} instead.
221
+ */
222
+ this.activeListBox = computed(() => {
223
+ const selectedItems = this.selectedItems();
224
+ if (selectedItems.any()) {
225
+ return this;
226
+ }
227
+ const connectedList = this.connectedList();
228
+ if (connectedList?.selectedItems().any()) {
229
+ return connectedList;
230
+ }
231
+ return this;
232
+ }, /* @ts-ignore */
233
+ ...(ngDevMode ? [{ debugName: "activeListBox" }] : /* istanbul ignore next */ []));
234
+ this.baseClasses = computed(() => {
235
+ const theme = this.#themeService.theme();
236
+ const rounded = this.rounded();
237
+ const size = this.size();
238
+ const toolbarOptions = this.toolbarOptions();
239
+ const position = toolbarOptions?.position ?? "right";
240
+ const direction = position === "left" || position === "right" ? "horizontal" : "vertical";
241
+ const reversed = position === "left" || position === "top";
242
+ return listBoxBaseThemeVariants(theme)({ direction, reversed, rounded, size });
243
+ }, /* @ts-ignore */
244
+ ...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
245
+ this.footerTemplate = contentChild(ListBoxFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
246
+ this.headerTemplate = contentChild(ListBoxHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "headerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
247
+ this.itemTemplate = contentChild(ListBoxItemTemplateDirective, { ...(ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
248
+ this.listHeight = computed(() => {
249
+ const height = this.height();
250
+ return typeof height === "number" ? `${height}px` : height;
251
+ }, /* @ts-ignore */
252
+ ...(ngDevMode ? [{ debugName: "listHeight" }] : /* istanbul ignore next */ []));
253
+ this.listWidth = computed(() => {
254
+ const width = this.width();
255
+ return typeof width === "number" ? `${width}px` : width;
256
+ }, /* @ts-ignore */
257
+ ...(ngDevMode ? [{ debugName: "listWidth" }] : /* istanbul ignore next */ []));
258
+ this.noDataTemplate = contentChild(ListBoxNoDataTemplateDirective, { ...(ngDevMode ? { debugName: "noDataTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
259
+ this.selectableOptions = computed(() => {
260
+ const enabled = true;
261
+ const mode = this.selectionMode();
262
+ if (mode === "multiple") {
263
+ return { enabled, mode };
264
+ }
265
+ return { enabled, mode, toggleable: this.singleSelectionToggleable() };
266
+ }, /* @ts-ignore */
267
+ ...(ngDevMode ? [{ debugName: "selectableOptions" }] : /* istanbul ignore next */ []));
268
+ this.toolbarClasses = computed(() => {
269
+ const theme = this.#themeService.theme();
270
+ const toolbarOptions = this.toolbarOptions();
271
+ const position = toolbarOptions?.position ?? "right";
272
+ const direction = position === "left" || position === "right" ? "vertical" : "horizontal";
273
+ return listBoxToolbarThemeVariants(theme)({ direction });
274
+ }, /* @ts-ignore */
275
+ ...(ngDevMode ? [{ debugName: "toolbarClasses" }] : /* istanbul ignore next */ []));
276
+ this.toolbarOptions = computed(() => {
277
+ const toolbar = this.toolbar();
278
+ if (typeof toolbar === "boolean") {
279
+ return toolbar ? this.getDefaultToolbarOptions() : null;
280
+ }
281
+ return this.updateToolbarOptions(toolbar);
282
+ }, /* @ts-ignore */
283
+ ...(ngDevMode ? [{ debugName: "toolbarOptions" }] : /* istanbul ignore next */ []));
284
+ /**
285
+ * @description Emitted when a toolbar action button is clicked, carrying the action's details.
286
+ */
287
+ this.actionClick = output();
288
+ /**
289
+ * @description Accessible name for the list box's `listbox` element. Describe what the list represents,
290
+ * which matters in particular when connecting two list boxes.
291
+ * @default ""
292
+ */
293
+ this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
294
+ /**
295
+ * @description The other list box to transfer items to and from using the toolbar actions.
296
+ * @default null
297
+ */
298
+ this.connectedList = input(null, /* @ts-ignore */
299
+ ...(ngDevMode ? [{ debugName: "connectedList" }] : /* istanbul ignore next */ []));
300
+ /**
301
+ * @description Sets the height of the component.
302
+ * @default 100%
303
+ */
304
+ this.height = input("100%", /* @ts-ignore */
305
+ ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
306
+ /**
307
+ * @description Collection of items to render.
308
+ * @default []
309
+ */
310
+ this.items = input([], /* @ts-ignore */
311
+ ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
312
+ this.listBoxItems = signal(ImmutableList.create(), /* @ts-ignore */
313
+ ...(ngDevMode ? [{ debugName: "listBoxItems" }] : /* istanbul ignore next */ []));
314
+ /**
315
+ * @description Border-radius preset applied to the component.
316
+ * @default medium
317
+ */
318
+ this.rounded = input("medium", /* @ts-ignore */
319
+ ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
320
+ /**
321
+ * @description Property name or accessor used to derive the key from a data item, used to identify selected items.
322
+ * @default ""
323
+ */
324
+ this.selectBy = input("", /* @ts-ignore */
325
+ ...(ngDevMode ? [{ debugName: "selectBy" }] : /* istanbul ignore next */ []));
326
+ /**
327
+ * @description Keys of the currently selected items.
328
+ * @default []
329
+ */
330
+ this.selectedKeys = input([], /* @ts-ignore */
331
+ ...(ngDevMode ? [{ debugName: "selectedKeys" }] : /* istanbul ignore next */ []));
332
+ /**
333
+ * @description Emitted with the updated keys whenever the selection changes.
334
+ */
335
+ this.selectedKeysChange = output();
336
+ /**
337
+ * @description Emitted with the selected and deselected items whenever the selection changes.
338
+ */
339
+ this.selectionChange = output();
340
+ this.selectedItems = computed(() => {
341
+ const listItems = this.#listService.selectedListItems();
342
+ return listItems.select(item => item.data).toImmutableSet();
343
+ }, /* @ts-ignore */
344
+ ...(ngDevMode ? [{ debugName: "selectedItems" }] : /* istanbul ignore next */ []));
345
+ this.selectedItems$ = toObservable(this.selectedItems);
346
+ /**
347
+ * @description Allows multiple items to be selected simultaneously when set to `"multiple"`.
348
+ * @default single
349
+ */
350
+ this.selectionMode = input("single", /* @ts-ignore */
351
+ ...(ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []));
352
+ /**
353
+ * @description Allows an already-selected item to be deselected by clicking it again while `selectionMode`
354
+ * is `"single"`. Has no effect when `selectionMode` is `"multiple"`.
355
+ * @default true
356
+ */
357
+ this.singleSelectionToggleable = input(true, /* @ts-ignore */
358
+ ...(ngDevMode ? [{ debugName: "singleSelectionToggleable" }] : /* istanbul ignore next */ []));
359
+ /**
360
+ * @description Size preset controlling the component's dimensions.
361
+ * @default medium
362
+ */
363
+ this.size = input("medium", /* @ts-ignore */
364
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
365
+ /**
366
+ * @description Property name or accessor used to derive the display text from a data item.
367
+ * @default ""
368
+ */
369
+ this.textField = input("", /* @ts-ignore */
370
+ ...(ngDevMode ? [{ debugName: "textField" }] : /* istanbul ignore next */ []));
371
+ /**
372
+ * @description Shows the action toolbar. Pass `false` to hide it entirely, or an options object to customize
373
+ * which actions are shown and where the toolbar is positioned.
374
+ * @default true
375
+ */
376
+ this.toolbar = input(true, /* @ts-ignore */
377
+ ...(ngDevMode ? [{ debugName: "toolbar" }] : /* istanbul ignore next */ []));
378
+ /**
379
+ * @description Sets the width of the component.
380
+ * @default 100%
381
+ */
382
+ this.width = input("100%", /* @ts-ignore */
383
+ ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
384
+ effect(() => {
385
+ const items = this.items();
386
+ untracked(() => this.listBoxItems.set(ImmutableList.create(items)));
387
+ });
388
+ effect(onCleanup => {
389
+ const connectedList = this.connectedList();
390
+ if (!connectedList) {
391
+ return;
392
+ }
393
+ const subscription = connectedList.selectionChange.subscribe(() => {
394
+ untracked(() => this.clearSelections());
395
+ });
396
+ onCleanup(() => subscription.unsubscribe());
397
+ });
398
+ afterNextRender({
399
+ read: () => this.setSubscriptions()
400
+ });
401
+ }
402
+ /**
403
+ * @description Clears the current selection without emitting `selectionChange`. Call {@link notifySelectionChange}
404
+ * afterward if the resulting selection change should be emitted.
405
+ */
406
+ clearSelections() {
407
+ this.#listService.clearSelections();
408
+ }
409
+ /**
410
+ * @description Emits `selectionChange` for any selection changes made since the last notification
411
+ * (e.g., after programmatically calling {@link clearSelections}).
412
+ */
413
+ notifySelectionChange() {
414
+ this.#notifySelectionChange$.next(true);
415
+ }
416
+ onClearClick(event) {
417
+ const listBox = this.activeListBox();
418
+ if (!listBox) {
419
+ return;
420
+ }
421
+ const selectedItems = listBox.selectedItems();
422
+ if (selectedItems.none()) {
423
+ return;
424
+ }
425
+ const clearEvent = new ListBoxClearEvent(selectedItems, event);
426
+ listBox.actionClick.emit(clearEvent);
427
+ if (!clearEvent.isDefaultPrevented()) {
428
+ listBox.clearSelections();
429
+ listBox.notifySelectionChange();
430
+ this.connectedList()?.clearSelections();
431
+ this.connectedList()?.notifySelectionChange();
432
+ }
433
+ }
434
+ onMoveClick(direction, event) {
435
+ const activeListBox = this.getSelectedListBox();
436
+ if (!activeListBox) {
437
+ return;
438
+ }
439
+ const selectedItems = activeListBox.selectedItems();
440
+ if (selectedItems.none()) {
441
+ const moveEvent = new ListBoxMoveEvent(direction, [], [], -1, -1, event);
442
+ activeListBox.actionClick.emit(moveEvent);
443
+ return;
444
+ }
445
+ const listBoxItems = activeListBox.listBoxItems();
446
+ const startIndex = listBoxItems.indexOf(selectedItems.elementAt(0));
447
+ const endIndex = listBoxItems.indexOf(selectedItems.elementAt(selectedItems.length - 1));
448
+ let newMoveIndex;
449
+ if (direction === "moveDown") {
450
+ if (endIndex >= listBoxItems.length - 1) {
451
+ return;
452
+ }
453
+ newMoveIndex = endIndex + 1;
454
+ }
455
+ else {
456
+ if (startIndex <= 0) {
457
+ return;
458
+ }
459
+ newMoveIndex = startIndex - 1;
460
+ }
461
+ const selectedIndices = selectedItems.select(item => listBoxItems.indexOf(item)).toArray();
462
+ const moveEvent = new ListBoxMoveEvent(direction, selectedItems, selectedIndices, startIndex, newMoveIndex, event);
463
+ activeListBox.actionClick.emit(moveEvent);
464
+ if (!moveEvent.isDefaultPrevented()) {
465
+ activeListBox.scrollToSelectedItem();
466
+ }
467
+ }
468
+ onRemoveClick(event) {
469
+ const listBox = this.activeListBox();
470
+ if (!listBox) {
471
+ return;
472
+ }
473
+ const selectedItems = listBox.selectedItems();
474
+ if (selectedItems.none()) {
475
+ return;
476
+ }
477
+ const removeEvent = new ListBoxRemoveEvent(selectedItems, event);
478
+ listBox.actionClick.emit(removeEvent);
479
+ if (!removeEvent.isDefaultPrevented()) {
480
+ listBox.scrollToSelectedItem();
481
+ this.#dataStateChange$.next();
482
+ }
483
+ }
484
+ onSelectedKeysChange(keys) {
485
+ this.selectedKeysChange.emit(keys);
486
+ this.connectedList()?.clearSelections();
487
+ this.#notifySelectionChange$.next(true);
488
+ }
489
+ onTransferClick(action, event) {
490
+ const connectedList = this.connectedList();
491
+ if (!connectedList) {
492
+ return;
493
+ }
494
+ const sourceList = this.activeListBox();
495
+ const targetList = this.activeListBox() === connectedList ? this : connectedList;
496
+ if (!sourceList || !targetList) {
497
+ return;
498
+ }
499
+ const selectedItems = sourceList.selectedItems();
500
+ const transferEvent = new ListBoxTransferEvent(action, selectedItems, event);
501
+ if (action === "transferFrom" || action === "transferAllFrom") {
502
+ connectedList.actionClick.emit(transferEvent);
503
+ }
504
+ else {
505
+ sourceList.actionClick.emit(transferEvent);
506
+ }
507
+ if (!transferEvent.isDefaultPrevented()) {
508
+ sourceList.clearSelections();
509
+ targetList.clearSelections();
510
+ targetList.scrollToSelectedItem();
511
+ this.#dataStateChange$.next();
512
+ }
513
+ }
514
+ createSelectedChangeNotifier() {
515
+ return this.selectedItems$.pipe(sample(this.#notifySelectionChange$.pipe(delay(0), filter(e => e), tap(() => this.#notifySelectionChange$.next(false)))), scan((previous, current) => {
516
+ const selectedItems = current.where(i => !previous.contains(i)).toArray();
517
+ const deselectedItems = previous.where(i => !current.contains(i)).toArray();
518
+ if (selectedItems.length > 0 || deselectedItems.length > 0) {
519
+ this.activeListBox()?.selectionChange.emit({ selectedItems, deselectedItems });
520
+ }
521
+ return current;
522
+ }, this.selectedItems()));
523
+ }
524
+ /**
525
+ * The list box (`this` or the connected list box, recursively) that currently has a real selection
526
+ * or `null` if neither side has one. Unlike {@link activeListBox}, this does not fall back to `this`,
527
+ * since move actions need to know an actual selected index to operate on.
528
+ */
529
+ getSelectedListBox() {
530
+ if (this.selectedItems().any()) {
531
+ return this;
532
+ }
533
+ if (this.connectedList() != null) {
534
+ return this.connectedList().getSelectedListBox();
535
+ }
536
+ return null;
537
+ }
538
+ getDefaultToolbarOptions() {
539
+ return {
540
+ actions: [
541
+ "clear",
542
+ "moveDown",
543
+ "moveUp",
544
+ "remove",
545
+ "transferAllFrom",
546
+ "transferAllTo",
547
+ "transferFrom",
548
+ "transferTo"
549
+ ],
550
+ position: "right"
551
+ };
552
+ }
553
+ scrollToSelectedItem() {
554
+ const selectedItemElement = this.#hostElementRef.nativeElement.querySelector("[data-selected='true']");
555
+ if (selectedItemElement) {
556
+ selectedItemElement.scrollIntoView({ behavior: "auto", block: "center" });
557
+ }
558
+ }
559
+ setSubscriptions() {
560
+ this.#dataStateChange$
561
+ .pipe(takeUntilDestroyed(this.#destroyRef), startWith(null), switchMap(() => this.createSelectedChangeNotifier()))
562
+ .subscribe();
563
+ }
564
+ updateToolbarOptions(options) {
565
+ if (typeof options === "boolean") {
566
+ return options ? this.getDefaultToolbarOptions() : null;
567
+ }
568
+ const position = options.position ?? "right";
569
+ let actions;
570
+ if (options.actions && options.actions.length > 0) {
571
+ actions = options.actions;
572
+ }
573
+ else if (options.actions && options.actions.length === 0) {
574
+ actions = [];
575
+ }
576
+ else {
577
+ actions = [
578
+ "clear",
579
+ "moveDown",
580
+ "moveUp",
581
+ "remove",
582
+ "transferAllFrom",
583
+ "transferAllTo",
584
+ "transferFrom",
585
+ "transferTo"
586
+ ];
587
+ }
588
+ return { actions, position };
589
+ }
590
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
591
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ListBoxComponent, isStandalone: true, selector: "mona-list-box", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, connectedList: { classPropertyName: "connectedList", publicName: "connectedList", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selectBy: { classPropertyName: "selectBy", publicName: "selectBy", isSignal: true, isRequired: false, transformFunction: null }, selectedKeys: { classPropertyName: "selectedKeys", publicName: "selectedKeys", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, singleSelectionToggleable: { classPropertyName: "singleSelectionToggleable", publicName: "singleSelectionToggleable", 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 }, toolbar: { classPropertyName: "toolbar", publicName: "toolbar", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { actionClick: "actionClick", selectedKeysChange: "selectedKeysChange", selectionChange: "selectionChange" }, host: { properties: { "class": "baseClasses()", "style.height": "listHeight()", "style.width": "listWidth()" } }, providers: [ListService], queries: [{ propertyName: "footerTemplate", first: true, predicate: ListBoxFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ListBoxHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: ListBoxItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: ListBoxNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<mona-list-view\r\n [ariaLabel]=\"ariaLabel()\"\r\n [items]=\"listBoxItems()\"\r\n [height]=\"'100%'\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n [textField]=\"textField()\"\r\n [width]=\"'100%'\"\r\n [monaListViewNavigable]=\"{ enabled: true, mode: 'select' }\"\r\n [monaListViewSelectable]=\"selectableOptions()\"\r\n [selectBy]=\"selectBy()\"\r\n [selectedKeys]=\"selectedKeys()\"\r\n (selectedKeysChange)=\"onSelectedKeysChange($event)\">\r\n @if (footerTemplate()) {\r\n <ng-template monaListViewFooterTemplate>\r\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (headerTemplate()) {\r\n <ng-template monaListViewHeaderTemplate>\r\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (itemTemplate()) {\r\n <ng-template monaListViewItemTemplate let-dataItem>\r\n <ng-container\r\n [ngTemplateOutlet]=\"itemTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (noDataTemplate()) {\r\n <ng-template monaListViewNoDataTemplate>\r\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n</mona-list-view>\r\n\r\n@let options = toolbarOptions() ?? null;\r\n@let connectedListBox = connectedList();\r\n@let hasSelectedItems = selectedItems().length > 0;\r\n@let connectedListHasSelectedItems = connectedListBox && connectedListBox.selectedItems().length > 0;\r\n@let connectedListItems = connectedListBox?.listBoxItems() ?? [];\r\n@if (options !== null && connectedListBox !== null) {\r\n <div [class]=\"toolbarClasses()\">\r\n @if (options.actions | monaContains: \"moveUp\") {\r\n <button\r\n monaButton\r\n (click)=\"onMoveClick('moveUp', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Move Up\"\r\n aria-label=\"Move Up\"\r\n [disabled]=\"!hasSelectedItems && !connectedListHasSelectedItems\">\r\n <svg lucideChevronUp [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"moveDown\") {\r\n <button\r\n monaButton\r\n (click)=\"onMoveClick('moveDown', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Move Down\"\r\n aria-label=\"Move Down\"\r\n [disabled]=\"!hasSelectedItems && !connectedListHasSelectedItems\">\r\n <svg lucideChevronDown [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"transferFrom\") {\r\n <button\r\n monaButton\r\n (click)=\"onTransferClick('transferFrom', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Transfer From\"\r\n aria-label=\"Transfer From\"\r\n [disabled]=\"!connectedListHasSelectedItems\">\r\n <svg lucideChevronLeft [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"transferTo\") {\r\n <button\r\n monaButton\r\n (click)=\"onTransferClick('transferTo', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Transfer To\"\r\n aria-label=\"Transfer To\"\r\n [disabled]=\"!hasSelectedItems\">\r\n <svg lucideChevronRight [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"transferAllFrom\") {\r\n <button\r\n monaButton\r\n (click)=\"onTransferClick('transferAllFrom', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Transfer All From\"\r\n aria-label=\"Transfer All From\"\r\n [disabled]=\"!connectedListBox || connectedListItems.length === 0\">\r\n <svg lucideChevronsLeft [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"transferAllTo\") {\r\n <button\r\n monaButton\r\n (click)=\"onTransferClick('transferAllTo', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Transfer All To\"\r\n aria-label=\"Transfer All To\"\r\n [disabled]=\"listBoxItems().length === 0\">\r\n <svg lucideChevronsRight [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"clear\") {\r\n <button\r\n monaButton\r\n (click)=\"onClearClick($event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Clear Selection\"\r\n aria-label=\"Clear Selection\"\r\n [disabled]=\"!hasSelectedItems && !connectedListHasSelectedItems\">\r\n <svg lucideX [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"remove\") {\r\n <button\r\n monaButton\r\n (click)=\"onRemoveClick($event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Remove\"\r\n aria-label=\"Remove\"\r\n [disabled]=\"!hasSelectedItems && !connectedListHasSelectedItems\">\r\n <svg lucideTrash2 [size]=\"14\"></svg>\r\n </button>\r\n }\r\n </div>\r\n}\r\n", dependencies: [{ kind: "component", type: ListViewComponent, selector: "mona-list-view", inputs: ["aria-label", "height", "listClass", "listItemClass", "listItemStyle", "listStyle", "items", "maxHeight", "maxWidth", "rounded", "size", "textField", "class", "width"], outputs: ["scrollBottom"] }, { kind: "directive", type: ListViewSelectableDirective, selector: "mona-list-view[monaListViewSelectable]", inputs: ["monaListViewSelectable", "selectBy", "selectedKeys"], outputs: ["selectedKeysChange"] }, { kind: "directive", type: ListViewItemTemplateDirective, selector: "ng-template[monaListViewItemTemplate]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "directive", type: ListViewNavigableDirective, selector: "mona-list-view[monaListViewNavigable]", inputs: ["monaListViewNavigable"] }, { kind: "directive", type: ListViewNoDataTemplateDirective, selector: "ng-template[monaListViewNoDataTemplate]" }, { kind: "directive", type: ListViewFooterTemplateDirective, selector: "ng-template[monaListViewFooterTemplate]" }, { kind: "directive", type: ListViewHeaderTemplateDirective, selector: "ng-template[monaListViewHeaderTemplate]" }, { kind: "component", type: LucideChevronUp, selector: "svg[lucideChevronUp]" }, { kind: "component", type: LucideChevronDown, selector: "svg[lucideChevronDown]" }, { kind: "component", type: LucideChevronLeft, selector: "svg[lucideChevronLeft]" }, { kind: "component", type: LucideChevronRight, selector: "svg[lucideChevronRight]" }, { kind: "component", type: LucideChevronsLeft, selector: "svg[lucideChevronsLeft]" }, { kind: "component", type: LucideChevronsRight, selector: "svg[lucideChevronsRight]" }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }, { kind: "component", type: LucideTrash2, selector: "svg[lucideTrash2]" }, { kind: "pipe", type: ContainsPipe, name: "monaContains" }] }); }
592
+ }
593
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ListBoxComponent, decorators: [{
594
+ type: Component,
595
+ args: [{ selector: "mona-list-box", providers: [ListService], imports: [
596
+ ListViewComponent,
597
+ ListViewSelectableDirective,
598
+ ListViewItemTemplateDirective,
599
+ NgTemplateOutlet,
600
+ ButtonDirective,
601
+ ContainsPipe,
602
+ ListViewNavigableDirective,
603
+ ListViewNoDataTemplateDirective,
604
+ ListViewFooterTemplateDirective,
605
+ ListViewHeaderTemplateDirective,
606
+ LucideChevronUp,
607
+ LucideChevronDown,
608
+ LucideChevronLeft,
609
+ LucideChevronRight,
610
+ LucideChevronsLeft,
611
+ LucideChevronsRight,
612
+ LucideX,
613
+ LucideTrash2
614
+ ], host: {
615
+ "[class]": "baseClasses()",
616
+ "[style.height]": "listHeight()",
617
+ "[style.width]": "listWidth()"
618
+ }, template: "<mona-list-view\r\n [ariaLabel]=\"ariaLabel()\"\r\n [items]=\"listBoxItems()\"\r\n [height]=\"'100%'\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n [textField]=\"textField()\"\r\n [width]=\"'100%'\"\r\n [monaListViewNavigable]=\"{ enabled: true, mode: 'select' }\"\r\n [monaListViewSelectable]=\"selectableOptions()\"\r\n [selectBy]=\"selectBy()\"\r\n [selectedKeys]=\"selectedKeys()\"\r\n (selectedKeysChange)=\"onSelectedKeysChange($event)\">\r\n @if (footerTemplate()) {\r\n <ng-template monaListViewFooterTemplate>\r\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (headerTemplate()) {\r\n <ng-template monaListViewHeaderTemplate>\r\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (itemTemplate()) {\r\n <ng-template monaListViewItemTemplate let-dataItem>\r\n <ng-container\r\n [ngTemplateOutlet]=\"itemTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (noDataTemplate()) {\r\n <ng-template monaListViewNoDataTemplate>\r\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n</mona-list-view>\r\n\r\n@let options = toolbarOptions() ?? null;\r\n@let connectedListBox = connectedList();\r\n@let hasSelectedItems = selectedItems().length > 0;\r\n@let connectedListHasSelectedItems = connectedListBox && connectedListBox.selectedItems().length > 0;\r\n@let connectedListItems = connectedListBox?.listBoxItems() ?? [];\r\n@if (options !== null && connectedListBox !== null) {\r\n <div [class]=\"toolbarClasses()\">\r\n @if (options.actions | monaContains: \"moveUp\") {\r\n <button\r\n monaButton\r\n (click)=\"onMoveClick('moveUp', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Move Up\"\r\n aria-label=\"Move Up\"\r\n [disabled]=\"!hasSelectedItems && !connectedListHasSelectedItems\">\r\n <svg lucideChevronUp [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"moveDown\") {\r\n <button\r\n monaButton\r\n (click)=\"onMoveClick('moveDown', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Move Down\"\r\n aria-label=\"Move Down\"\r\n [disabled]=\"!hasSelectedItems && !connectedListHasSelectedItems\">\r\n <svg lucideChevronDown [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"transferFrom\") {\r\n <button\r\n monaButton\r\n (click)=\"onTransferClick('transferFrom', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Transfer From\"\r\n aria-label=\"Transfer From\"\r\n [disabled]=\"!connectedListHasSelectedItems\">\r\n <svg lucideChevronLeft [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"transferTo\") {\r\n <button\r\n monaButton\r\n (click)=\"onTransferClick('transferTo', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Transfer To\"\r\n aria-label=\"Transfer To\"\r\n [disabled]=\"!hasSelectedItems\">\r\n <svg lucideChevronRight [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"transferAllFrom\") {\r\n <button\r\n monaButton\r\n (click)=\"onTransferClick('transferAllFrom', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Transfer All From\"\r\n aria-label=\"Transfer All From\"\r\n [disabled]=\"!connectedListBox || connectedListItems.length === 0\">\r\n <svg lucideChevronsLeft [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"transferAllTo\") {\r\n <button\r\n monaButton\r\n (click)=\"onTransferClick('transferAllTo', $event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Transfer All To\"\r\n aria-label=\"Transfer All To\"\r\n [disabled]=\"listBoxItems().length === 0\">\r\n <svg lucideChevronsRight [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"clear\") {\r\n <button\r\n monaButton\r\n (click)=\"onClearClick($event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Clear Selection\"\r\n aria-label=\"Clear Selection\"\r\n [disabled]=\"!hasSelectedItems && !connectedListHasSelectedItems\">\r\n <svg lucideX [size]=\"16\"></svg>\r\n </button>\r\n }\r\n @if (options.actions | monaContains: \"remove\") {\r\n <button\r\n monaButton\r\n (click)=\"onRemoveClick($event)\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n title=\"Remove\"\r\n aria-label=\"Remove\"\r\n [disabled]=\"!hasSelectedItems && !connectedListHasSelectedItems\">\r\n <svg lucideTrash2 [size]=\"14\"></svg>\r\n </button>\r\n }\r\n </div>\r\n}\r\n" }]
619
+ }], ctorParameters: () => [], propDecorators: { footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListBoxFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListBoxHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListBoxItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], noDataTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ListBoxNoDataTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], actionClick: [{ type: i0.Output, args: ["actionClick"] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], connectedList: [{ type: i0.Input, args: [{ isSignal: true, alias: "connectedList", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], selectBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectBy", required: false }] }], selectedKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedKeys", required: false }] }], selectedKeysChange: [{ type: i0.Output, args: ["selectedKeysChange"] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], singleSelectionToggleable: [{ type: i0.Input, args: [{ isSignal: true, alias: "singleSelectionToggleable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], textField: [{ type: i0.Input, args: [{ isSignal: true, alias: "textField", required: false }] }], toolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolbar", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
620
+
621
+ /*
622
+ * Public API Surface of @nanahoshi/mona-ui/list-box
623
+ */
624
+
625
+ /**
626
+ * Generated bundle index. Do not edit.
627
+ */
628
+
629
+ export { ListBoxClearEvent, ListBoxComponent, ListBoxFooterTemplateDirective, ListBoxHeaderTemplateDirective, ListBoxItemTemplateDirective, ListBoxMoveEvent, ListBoxNoDataTemplateDirective, ListBoxRemoveEvent, ListBoxTransferEvent };
630
+ //# sourceMappingURL=nanahoshi-mona-ui-list-box.mjs.map