@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,1559 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, signal, computed, inject, DestroyRef, ElementRef, afterNextRender, Component, contentChild, contentChildren, input, output, afterRenderEffect, ChangeDetectionStrategy, linkedSignal, forwardRef, model, TemplateRef, Directive } from '@angular/core';
3
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
+ import { createElementControlId, isNavigationKey, isTypeaheadKey, setupTypeahead, toCssValue, rxTimeout } from '@nanahoshi/mona-ui/internal';
5
+ import { PopupDataInjectionToken, PopupService } from '@nanahoshi/mona-ui/popup';
6
+ import { forEach, select, groupBy, selectMany, any } from '@mirei/ts-collections';
7
+ import { Subject, take, tap, fromEvent, takeUntil, filter, switchMap } from 'rxjs';
8
+ import { PreventableEvent } from '@nanahoshi/mona-ui/common';
9
+ import { v4 } from 'uuid';
10
+ import { NgTemplateOutlet } from '@angular/common';
11
+ import { LucideChevronRight, LucideCheck } from '@lucide/angular';
12
+ import { ThemeService } from '@nanahoshi/mona-ui/theme';
13
+ import { twMerge } from 'tailwind-merge';
14
+ import { cva } from 'class-variance-authority';
15
+
16
+ class PopupMenuCloseEvent extends PreventableEvent {
17
+ constructor(originalEvent) {
18
+ super("popupMenuCloseEvent", originalEvent?.originalEvent);
19
+ }
20
+ }
21
+
22
+ const PopupMenuToken = new InjectionToken("MONA_POPUP_MENU");
23
+ const PopupMenuRadioItemToken = new InjectionToken("MONA_POPUP_MENU_RADIO_ITEM");
24
+ const PopupMenuGroupTemplateToken = new InjectionToken("MONA_POPUP_MENU_GROUP_TEMPLATE");
25
+ const PopupMenuIconTemplateToken = new InjectionToken("MONA_POPUP_MENU_ICON_TEMPLATE");
26
+ const PopupMenuShortcutTemplateToken = new InjectionToken("MONA_POPUP_MENU_SHORTCUT_TEMPLATE");
27
+ const PopupMenuTextTemplateToken = new InjectionToken("MONA_POPUP_MENU_TEXT_TEMPLATE");
28
+ var PopupMenuOrigin;
29
+ (function (PopupMenuOrigin) {
30
+ PopupMenuOrigin[PopupMenuOrigin["Popup"] = 1] = "Popup";
31
+ PopupMenuOrigin[PopupMenuOrigin["ContextMenu"] = 2] = "ContextMenu";
32
+ PopupMenuOrigin[PopupMenuOrigin["DropdownButton"] = 3] = "DropdownButton";
33
+ PopupMenuOrigin[PopupMenuOrigin["SplitButton"] = 4] = "SplitButton";
34
+ PopupMenuOrigin[PopupMenuOrigin["MenubarMenu"] = 5] = "MenubarMenu";
35
+ })(PopupMenuOrigin || (PopupMenuOrigin = {}));
36
+ var PopupMenuItemType;
37
+ (function (PopupMenuItemType) {
38
+ PopupMenuItemType[PopupMenuItemType["CheckboxMenuItem"] = 1] = "CheckboxMenuItem";
39
+ PopupMenuItemType[PopupMenuItemType["MenuItem"] = 2] = "MenuItem";
40
+ PopupMenuItemType[PopupMenuItemType["MenuGroup"] = 3] = "MenuGroup";
41
+ PopupMenuItemType[PopupMenuItemType["RadioGroup"] = 4] = "RadioGroup";
42
+ PopupMenuItemType[PopupMenuItemType["RadioItem"] = 5] = "RadioItem";
43
+ PopupMenuItemType[PopupMenuItemType["Separator"] = 6] = "Separator";
44
+ })(PopupMenuItemType || (PopupMenuItemType = {}));
45
+ var PopupMenuTemplateOrigin;
46
+ (function (PopupMenuTemplateOrigin) {
47
+ PopupMenuTemplateOrigin[PopupMenuTemplateOrigin["Popup"] = 1] = "Popup";
48
+ PopupMenuTemplateOrigin[PopupMenuTemplateOrigin["ContextMenu"] = 2] = "ContextMenu";
49
+ PopupMenuTemplateOrigin[PopupMenuTemplateOrigin["DropdownButton"] = 3] = "DropdownButton";
50
+ PopupMenuTemplateOrigin[PopupMenuTemplateOrigin["SplitButton"] = 4] = "SplitButton";
51
+ PopupMenuTemplateOrigin[PopupMenuTemplateOrigin["MenubarMenu"] = 5] = "MenubarMenu";
52
+ })(PopupMenuTemplateOrigin || (PopupMenuTemplateOrigin = {}));
53
+ var PopupMenuTemplateType;
54
+ (function (PopupMenuTemplateType) {
55
+ PopupMenuTemplateType[PopupMenuTemplateType["Group"] = 1] = "Group";
56
+ PopupMenuTemplateType[PopupMenuTemplateType["Icon"] = 2] = "Icon";
57
+ PopupMenuTemplateType[PopupMenuTemplateType["Shortcut"] = 3] = "Shortcut";
58
+ PopupMenuTemplateType[PopupMenuTemplateType["Text"] = 4] = "Text";
59
+ })(PopupMenuTemplateType || (PopupMenuTemplateType = {}));
60
+
61
+ const itemTypeMap = {
62
+ [PopupMenuItemType.CheckboxMenuItem]: "checkbox",
63
+ [PopupMenuItemType.MenuGroup]: "group",
64
+ [PopupMenuItemType.MenuItem]: "item",
65
+ [PopupMenuItemType.RadioGroup]: "radio-group",
66
+ [PopupMenuItemType.RadioItem]: "radio",
67
+ [PopupMenuItemType.Separator]: "separator"
68
+ };
69
+ const templateItemTypeMap = {
70
+ [PopupMenuTemplateType.Group]: "group",
71
+ [PopupMenuTemplateType.Icon]: "icon",
72
+ [PopupMenuTemplateType.Shortcut]: "shortcut",
73
+ [PopupMenuTemplateType.Text]: "text"
74
+ };
75
+ const ensurePopupComponentTypes = (params) => {
76
+ forEach(params.components, item => {
77
+ if (item.origin !== params.origin) {
78
+ const type = item.type;
79
+ const expectedItemType = itemTypeMap[type];
80
+ const expectedComponentType = params.componentTypeMap[type];
81
+ throw new Error(`${params.prefix}: The ${expectedItemType} must be defined with ${expectedComponentType}.`);
82
+ }
83
+ });
84
+ };
85
+ const ensurePopupTemplateTypes = (params) => {
86
+ forEach(params.templates, item => {
87
+ if (item.origin !== params.origin) {
88
+ const type = item.type;
89
+ const expectedTemplateType = params.templateTypeMap[type];
90
+ throw new Error(`${params.prefix}: The ${templateItemTypeMap[type]} template must be defined with ${expectedTemplateType}.`);
91
+ }
92
+ });
93
+ };
94
+ const preparePopupMenuItems = (items) => {
95
+ return select(items, item => {
96
+ const popupItem = {
97
+ checkable: item.checkable ?? false,
98
+ checked: signal(item.checked ?? false),
99
+ click$: new Subject(),
100
+ disabled: item.disabled ?? false,
101
+ group: item.group ?? "",
102
+ groupTemplate: null,
103
+ iconTemplate: null,
104
+ items: preparePopupMenuItems(item.items ?? []),
105
+ label: item.label ?? "",
106
+ separator: item.separator ?? false,
107
+ shortcutTemplate: null,
108
+ textTemplate: null,
109
+ uid: v4()
110
+ };
111
+ return popupItem;
112
+ }).toArray();
113
+ };
114
+ const convertToMenuItem = (item) => {
115
+ return {
116
+ checkable: item.checkable,
117
+ checked: item.checked ? item.checked() : false,
118
+ disabled: item.disabled,
119
+ group: item.group ? String(item.group) : undefined,
120
+ items: select(item.items, i => convertToMenuItem(i)).toArray(),
121
+ label: item.label,
122
+ separator: item.separator
123
+ };
124
+ };
125
+
126
+ class PopupMenuItemClickEvent extends PreventableEvent {
127
+ #item;
128
+ constructor(item, originalEvent) {
129
+ super("popupMenuItemClick", originalEvent);
130
+ this.#item = item;
131
+ }
132
+ get item() {
133
+ return this.#item;
134
+ }
135
+ }
136
+
137
+ const popupMenuBaseVariants = cva(`w-full h-full overflow-hidden`, {
138
+ variants: {
139
+ rounded: {
140
+ small: "rounded-sm",
141
+ medium: "rounded-md",
142
+ large: "rounded-lg",
143
+ none: "rounded-none"
144
+ }
145
+ }
146
+ });
147
+ const popupMenuContainerVariants = cva(`
148
+ flex flex-col
149
+ bg-background text-foreground
150
+ border border-border
151
+ outline-none
152
+ p-1 shadow-md
153
+ `, {
154
+ variants: {
155
+ rounded: {
156
+ small: "rounded-sm",
157
+ medium: "rounded-md",
158
+ large: "rounded-lg",
159
+ none: "rounded-none"
160
+ }
161
+ }
162
+ });
163
+ const popupMenuGroupHeaderVariants = cva(`font-bold inline-flex select-none px-2 py-1 w-full`, {
164
+ variants: {
165
+ size: {
166
+ small: "text-xs",
167
+ medium: "text-sm",
168
+ large: "text-md"
169
+ }
170
+ }
171
+ });
172
+ const popupMenuIconContainerVariants = cva(`absolute left-2 flex items-center justify-center`);
173
+ const popupMenuItemVariants = cva(`
174
+ relative flex gap-2
175
+ cursor-pointer select-none items-center pl-8 pr-2 py-1
176
+ outline-none
177
+
178
+ hover:bg-hover
179
+ hover:text-hover-foreground
180
+
181
+ focus-within:bg-accent
182
+ focus-within:text-accent-foreground
183
+ focus-within:outline-none
184
+
185
+ data-[disabled='true']:pointer-events-none
186
+ data-[disabled='true']:cursor-not-allowed
187
+ data-[disabled='true']:opacity-50
188
+
189
+ data-[active='true']:bg-hover
190
+ data-[active='true']:text-hover-foreground
191
+ `, {
192
+ variants: {
193
+ rounded: {
194
+ small: "rounded-sm",
195
+ medium: "rounded-md",
196
+ large: "rounded-lg",
197
+ none: "rounded-none"
198
+ },
199
+ size: {
200
+ small: "text-xs",
201
+ medium: "text-sm",
202
+ large: "text-md"
203
+ }
204
+ }
205
+ });
206
+ const popupMenuLinkVariants = cva(`flex items-center justify-center`);
207
+
208
+ const popupMenuBaseThemeVariants = (theme) => {
209
+ switch (theme) {
210
+ case "mona":
211
+ return popupMenuBaseVariants;
212
+ default:
213
+ return popupMenuBaseVariants;
214
+ }
215
+ };
216
+ const popupMenuContainerThemeVariants = (theme) => {
217
+ switch (theme) {
218
+ case "mona":
219
+ return popupMenuContainerVariants;
220
+ default:
221
+ return popupMenuContainerVariants;
222
+ }
223
+ };
224
+ const popupMenuGroupHeaderThemeVariants = (theme) => {
225
+ switch (theme) {
226
+ case "mona":
227
+ return popupMenuGroupHeaderVariants;
228
+ default:
229
+ return popupMenuGroupHeaderVariants;
230
+ }
231
+ };
232
+ const popupMenuIconContainerThemeVariants = (theme) => {
233
+ switch (theme) {
234
+ case "mona":
235
+ return popupMenuIconContainerVariants;
236
+ default:
237
+ return popupMenuIconContainerVariants;
238
+ }
239
+ };
240
+ const popupMenuItemThemeVariants = (theme) => {
241
+ switch (theme) {
242
+ case "mona":
243
+ return popupMenuItemVariants;
244
+ default:
245
+ return popupMenuItemVariants;
246
+ }
247
+ };
248
+ const popupMenuLinkThemeVariants = (theme) => {
249
+ switch (theme) {
250
+ case "mona":
251
+ return popupMenuLinkVariants;
252
+ default:
253
+ return popupMenuLinkVariants;
254
+ }
255
+ };
256
+
257
+ class PopupMenuListComponent {
258
+ #childCloseRequest$;
259
+ #childMenuItems;
260
+ #close$;
261
+ #config;
262
+ #destroyRef;
263
+ #host;
264
+ #navigationItems;
265
+ #parentConfig;
266
+ #popupService;
267
+ #themeService;
268
+ #typeaheadKey$;
269
+ #viaKeyboardNavigation;
270
+ constructor() {
271
+ this.#childCloseRequest$ = new Subject();
272
+ this.#childMenuItems = computed(() => {
273
+ const activeMenuItem = this.activeMenuItem();
274
+ if (activeMenuItem) {
275
+ return groupBy(activeMenuItem.items, item => item.group).toArray();
276
+ }
277
+ return [];
278
+ }, /* @ts-ignore */
279
+ ...(ngDevMode ? [{ debugName: "#childMenuItems" }] : /* istanbul ignore next */ []));
280
+ this.#close$ = new Subject();
281
+ this.#config = computed(() => {
282
+ const data = {
283
+ childCloseRequest$: this.#childCloseRequest$,
284
+ isRoot: false,
285
+ items: this.#childMenuItems(),
286
+ level: this.#parentConfig.level + 1,
287
+ menuId: createElementControlId(this.#parentConfig.level + 1),
288
+ menuItemClick$: this.#parentConfig.menuItemClick$,
289
+ minWidth: this.#parentConfig.minWidth,
290
+ navigate$: this.#parentConfig.navigate$,
291
+ parentClose$: this.#close$,
292
+ popupGroupTemplate: this.#parentConfig.popupGroupTemplate,
293
+ popupIconTemplate: this.#parentConfig.popupIconTemplate,
294
+ popupShortcutTemplate: this.#parentConfig.popupShortcutTemplate,
295
+ popupTextTemplate: this.#parentConfig.popupTextTemplate,
296
+ rounded: this.#parentConfig.rounded,
297
+ size: this.#parentConfig.size,
298
+ viaKeyboardNavigation: this.#viaKeyboardNavigation(),
299
+ width: this.#parentConfig.width
300
+ };
301
+ return data;
302
+ }, /* @ts-ignore */
303
+ ...(ngDevMode ? [{ debugName: "#config" }] : /* istanbul ignore next */ []));
304
+ this.#destroyRef = inject(DestroyRef);
305
+ this.#host = inject((ElementRef));
306
+ this.#navigationItems = computed(() => {
307
+ const items = this.#parentConfig.items;
308
+ return selectMany(items, i => i.source)
309
+ .where(i => !i.separator && !i.disabled)
310
+ .toImmutableSet();
311
+ }, /* @ts-ignore */
312
+ ...(ngDevMode ? [{ debugName: "#navigationItems" }] : /* istanbul ignore next */ []));
313
+ this.#parentConfig = inject(PopupDataInjectionToken);
314
+ this.#popupService = inject(PopupService);
315
+ this.#themeService = inject(ThemeService);
316
+ this.#typeaheadKey$ = new Subject();
317
+ this.#viaKeyboardNavigation = signal(false, /* @ts-ignore */
318
+ ...(ngDevMode ? [{ debugName: "#viaKeyboardNavigation" }] : /* istanbul ignore next */ []));
319
+ this.activeMenuItem = signal(null, /* @ts-ignore */
320
+ ...(ngDevMode ? [{ debugName: "activeMenuItem" }] : /* istanbul ignore next */ []));
321
+ this.baseClasses = computed(() => {
322
+ const theme = this.#themeService.theme();
323
+ const rounded = this.#parentConfig.rounded();
324
+ return popupMenuBaseThemeVariants(theme)({ rounded });
325
+ }, /* @ts-ignore */
326
+ ...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
327
+ this.containerClasses = computed(() => {
328
+ const theme = this.#themeService.theme();
329
+ const rounded = this.#parentConfig.rounded();
330
+ return popupMenuContainerThemeVariants(theme)({ rounded });
331
+ }, /* @ts-ignore */
332
+ ...(ngDevMode ? [{ debugName: "containerClasses" }] : /* istanbul ignore next */ []));
333
+ this.groupHeaderClasses = computed(() => {
334
+ const theme = this.#themeService.theme();
335
+ const size = this.#parentConfig.size();
336
+ const hasIcon = this.iconAreaVisible();
337
+ const variantClasses = popupMenuGroupHeaderThemeVariants(theme)({ size });
338
+ const iconClasses = hasIcon ? "pl-8" : "pl-2";
339
+ return twMerge(variantClasses, iconClasses);
340
+ }, /* @ts-ignore */
341
+ ...(ngDevMode ? [{ debugName: "groupHeaderClasses" }] : /* istanbul ignore next */ []));
342
+ this.iconAreaVisible = computed(() => {
343
+ const items = this.#parentConfig.items;
344
+ const hasIconsOrSelectable = selectMany(items, i => i.source).any(i => i.iconTemplate?.() != null || i.checkable === true || i.radio === true);
345
+ return hasIconsOrSelectable || !!this.#parentConfig.popupIconTemplate?.();
346
+ }, /* @ts-ignore */
347
+ ...(ngDevMode ? [{ debugName: "iconAreaVisible" }] : /* istanbul ignore next */ []));
348
+ this.iconContainerClasses = computed(() => {
349
+ const theme = this.#themeService.theme();
350
+ return popupMenuIconContainerThemeVariants(theme)();
351
+ }, /* @ts-ignore */
352
+ ...(ngDevMode ? [{ debugName: "iconContainerClasses" }] : /* istanbul ignore next */ []));
353
+ this.linkContainerClasses = computed(() => {
354
+ const theme = this.#themeService.theme();
355
+ return popupMenuLinkThemeVariants(theme)();
356
+ }, /* @ts-ignore */
357
+ ...(ngDevMode ? [{ debugName: "linkContainerClasses" }] : /* istanbul ignore next */ []));
358
+ this.menuId = computed(() => this.#parentConfig.menuId, /* @ts-ignore */
359
+ ...(ngDevMode ? [{ debugName: "menuId" }] : /* istanbul ignore next */ []));
360
+ this.menuItemClasses = computed(() => {
361
+ const theme = this.#themeService.theme();
362
+ const rounded = this.#parentConfig.rounded();
363
+ const size = this.#parentConfig.size();
364
+ const hasIcon = this.iconAreaVisible();
365
+ const variantClasses = popupMenuItemThemeVariants(theme)({ rounded, size });
366
+ const iconClasses = hasIcon ? "pl-8" : "pl-2";
367
+ return twMerge(variantClasses, iconClasses);
368
+ }, /* @ts-ignore */
369
+ ...(ngDevMode ? [{ debugName: "menuItemClasses" }] : /* istanbul ignore next */ []));
370
+ this.menuItems = computed(() => this.#parentConfig.items, /* @ts-ignore */
371
+ ...(ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []));
372
+ this.pointerEnter$ = new Subject();
373
+ this.pointerLeave$ = new Subject();
374
+ this.popupGroupTemplate = computed(() => this.#parentConfig.popupGroupTemplate?.() ?? null, /* @ts-ignore */
375
+ ...(ngDevMode ? [{ debugName: "popupGroupTemplate" }] : /* istanbul ignore next */ []));
376
+ this.popupIconTemplate = computed(() => this.#parentConfig.popupIconTemplate?.() ?? null, /* @ts-ignore */
377
+ ...(ngDevMode ? [{ debugName: "popupIconTemplate" }] : /* istanbul ignore next */ []));
378
+ this.popupShortcutTemplate = computed(() => this.#parentConfig.popupShortcutTemplate?.() ?? null, /* @ts-ignore */
379
+ ...(ngDevMode ? [{ debugName: "popupShortcutTemplate" }] : /* istanbul ignore next */ []));
380
+ this.popupTextTemplate = computed(() => this.#parentConfig.popupTextTemplate?.(), /* @ts-ignore */
381
+ ...(ngDevMode ? [{ debugName: "popupTextTemplate" }] : /* istanbul ignore next */ []));
382
+ this.popupRef = null;
383
+ afterNextRender({
384
+ read: () => {
385
+ this.#host.nativeElement.firstElementChild?.focus();
386
+ if (!this.#parentConfig.isRoot && this.#parentConfig.viaKeyboardNavigation) {
387
+ const item = this.focusFirstItem();
388
+ this.notifyNavigation(item, "right");
389
+ }
390
+ }
391
+ });
392
+ }
393
+ ngOnInit() {
394
+ this.setSubscriptions();
395
+ }
396
+ onItemClick(event, item) {
397
+ const popupMenuItemClickEvent = new PopupMenuItemClickEvent(item, event);
398
+ item.click$?.next(popupMenuItemClickEvent);
399
+ if (popupMenuItemClickEvent.isDefaultPrevented()) {
400
+ return;
401
+ }
402
+ this.#parentConfig.menuItemClick$.next(popupMenuItemClickEvent);
403
+ }
404
+ createSubmenu(target, viaKeyboard) {
405
+ this.#viaKeyboardNavigation.set(viaKeyboard);
406
+ const minWidth = this.#parentConfig.minWidth?.() ?? undefined;
407
+ const width = this.#parentConfig.width?.() ?? undefined;
408
+ this.popupRef = this.#popupService.create({
409
+ anchor: target,
410
+ anchorConnectionPoint: "topright",
411
+ closeOnScroll: true,
412
+ content: PopupMenuListComponent,
413
+ data: this.#config(),
414
+ minWidth,
415
+ popupConnectionPoint: "topleft",
416
+ restoreFocus: false,
417
+ width
418
+ });
419
+ return this.popupRef.closed.pipe(take(1), tap(() => {
420
+ this.popupRef = null;
421
+ this.#host.nativeElement.firstElementChild?.focus();
422
+ this.#close$.next();
423
+ if (!viaKeyboard) {
424
+ this.activeMenuItem.set(null);
425
+ }
426
+ }));
427
+ }
428
+ cycleThroughMatchedItems(buffer) {
429
+ const matchedItems = this.#navigationItems()
430
+ .where(i => i.label.toLowerCase().startsWith(buffer))
431
+ .toArray();
432
+ const activeMenuItem = this.activeMenuItem();
433
+ if (matchedItems.length === 0) {
434
+ this.activeMenuItem.set(null);
435
+ return;
436
+ }
437
+ if (matchedItems.length === 1) {
438
+ this.activeMenuItem.set(matchedItems[0]);
439
+ return;
440
+ }
441
+ if (matchedItems.length > 1) {
442
+ const currentIndex = activeMenuItem ? matchedItems.indexOf(activeMenuItem) : -1;
443
+ const nextIndex = (currentIndex + 1) % matchedItems.length;
444
+ this.activeMenuItem.set(matchedItems[nextIndex]);
445
+ }
446
+ }
447
+ focusFirstItem() {
448
+ const firstItem = this.#navigationItems().firstOrDefault();
449
+ if (firstItem) {
450
+ this.activeMenuItem.set(firstItem);
451
+ }
452
+ return firstItem;
453
+ }
454
+ handleArrowDownKey() {
455
+ if (!this.activeMenuItem()) {
456
+ const firstItem = this.#navigationItems().firstOrDefault();
457
+ if (firstItem) {
458
+ this.activeMenuItem.set(firstItem);
459
+ }
460
+ return firstItem;
461
+ }
462
+ const nextItems = this.#navigationItems().skipWhile(i => i !== this.activeMenuItem());
463
+ const nextItem = nextItems.skip(1).firstOrDefault();
464
+ if (nextItem) {
465
+ this.activeMenuItem.set(nextItem);
466
+ return nextItem;
467
+ }
468
+ const firstItem = this.#navigationItems().firstOrDefault();
469
+ if (firstItem) {
470
+ this.activeMenuItem.set(firstItem);
471
+ }
472
+ return firstItem;
473
+ }
474
+ handleArrowLeftKey() {
475
+ this.#parentConfig.childCloseRequest$?.next();
476
+ }
477
+ handleArrowRightKey() {
478
+ const activeItem = this.activeMenuItem();
479
+ if (!activeItem) {
480
+ return { item: null, hasChild: false };
481
+ }
482
+ const target = this.#host.nativeElement.querySelector('[data-active="true"]');
483
+ if (target && activeItem.items.length > 0) {
484
+ this.createSubmenu(target, true).subscribe();
485
+ return { item: activeItem, hasChild: true };
486
+ }
487
+ if (activeItem && activeItem.items.length > 0) {
488
+ return { item: activeItem, hasChild: true };
489
+ }
490
+ return { item: null, hasChild: false };
491
+ }
492
+ handleArrowUpKey() {
493
+ if (!this.activeMenuItem()) {
494
+ const lastItem = this.#navigationItems().lastOrDefault();
495
+ if (lastItem) {
496
+ this.activeMenuItem.set(lastItem);
497
+ }
498
+ return lastItem;
499
+ }
500
+ const items = this.#navigationItems().takeWhile(i => i !== this.activeMenuItem());
501
+ const previousItem = items.lastOrDefault();
502
+ if (previousItem) {
503
+ this.activeMenuItem.set(previousItem);
504
+ return previousItem;
505
+ }
506
+ const lastItem = this.#navigationItems().lastOrDefault();
507
+ if (lastItem) {
508
+ this.activeMenuItem.set(lastItem);
509
+ }
510
+ return lastItem;
511
+ }
512
+ handleEndKey() {
513
+ const lastItem = this.#navigationItems().lastOrDefault();
514
+ if (lastItem) {
515
+ this.activeMenuItem.set(lastItem);
516
+ }
517
+ }
518
+ handleEnterKey() {
519
+ const activeItem = this.activeMenuItem();
520
+ if (activeItem && activeItem.items.length > 0) {
521
+ const target = this.#host.nativeElement.querySelector('[data-active="true"]');
522
+ if (target) {
523
+ this.createSubmenu(target, true).subscribe();
524
+ }
525
+ }
526
+ else if (activeItem) {
527
+ const syntheticEvent = new MouseEvent("click", {
528
+ bubbles: true,
529
+ cancelable: true,
530
+ composed: true
531
+ });
532
+ this.onItemClick(syntheticEvent, activeItem);
533
+ }
534
+ }
535
+ handleEscapeKey() {
536
+ if (this.popupRef) {
537
+ this.popupRef.close();
538
+ this.popupRef = null;
539
+ }
540
+ }
541
+ handleHomeKey() {
542
+ const firstItem = this.#navigationItems().firstOrDefault();
543
+ if (firstItem) {
544
+ this.activeMenuItem.set(firstItem);
545
+ }
546
+ }
547
+ handleNavigationKey(event) {
548
+ let item = null;
549
+ if (event.key === "ArrowDown") {
550
+ item = this.handleArrowDownKey();
551
+ this.notifyNavigation(item, "down");
552
+ }
553
+ else if (event.key === "ArrowLeft") {
554
+ this.handleArrowLeftKey();
555
+ if (this.#parentConfig.level === 0) {
556
+ this.notifyNavigation(null, "left");
557
+ }
558
+ }
559
+ else if (event.key === "ArrowRight") {
560
+ const result = this.handleArrowRightKey();
561
+ if (!result.hasChild) {
562
+ this.notifyNavigation(item, "right");
563
+ }
564
+ }
565
+ else if (event.key === "ArrowUp") {
566
+ item = this.handleArrowUpKey();
567
+ this.notifyNavigation(item, "up");
568
+ }
569
+ else if (event.key === "End") {
570
+ this.handleEndKey();
571
+ }
572
+ else if (event.key === "Enter" || event.key === " ") {
573
+ event.preventDefault();
574
+ this.handleEnterKey();
575
+ }
576
+ else if (event.key === "Escape") {
577
+ this.handleEscapeKey();
578
+ }
579
+ else if (event.key === "Home") {
580
+ this.handleHomeKey();
581
+ }
582
+ }
583
+ handleTypeaheadKey(event) {
584
+ this.#typeaheadKey$.next(event.key);
585
+ }
586
+ notifyNavigation(item, direction) {
587
+ this.#parentConfig.navigate$.next({
588
+ direction,
589
+ item,
590
+ level: this.#parentConfig.level
591
+ });
592
+ }
593
+ setKeyboardEvents() {
594
+ const element = this.#host.nativeElement.firstElementChild;
595
+ fromEvent(element, "keydown")
596
+ .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => {
597
+ if (isNavigationKey(e.key)) {
598
+ e.preventDefault();
599
+ this.#typeaheadKey$.next("");
600
+ this.handleNavigationKey(e);
601
+ }
602
+ else if (isTypeaheadKey(e.key)) {
603
+ e.preventDefault();
604
+ this.handleTypeaheadKey(e);
605
+ }
606
+ }))
607
+ .subscribe();
608
+ }
609
+ setPopupCloseSubscription() {
610
+ this.#parentConfig.parentClose$
611
+ .pipe(takeUntilDestroyed(this.#destroyRef), tap(() => {
612
+ if (this.popupRef) {
613
+ this.popupRef.close();
614
+ this.popupRef = null;
615
+ }
616
+ }))
617
+ .subscribe();
618
+ this.#childCloseRequest$
619
+ .pipe(takeUntilDestroyed(this.#destroyRef), tap(() => {
620
+ const activeItem = this.activeMenuItem();
621
+ this.notifyNavigation(activeItem, "left");
622
+ if (this.popupRef) {
623
+ this.popupRef.close();
624
+ this.popupRef = null;
625
+ }
626
+ }))
627
+ .subscribe();
628
+ }
629
+ setPointerSubscriptions() {
630
+ this.pointerEnter$
631
+ .pipe(takeUntilDestroyed(this.#destroyRef), takeUntil(this.#parentConfig.parentClose$), filter(e => e.item !== this.activeMenuItem()), tap(e => {
632
+ this.popupRef?.close();
633
+ if (e.item.items.length === 0) {
634
+ this.activeMenuItem.set(null);
635
+ }
636
+ }), filter(e => e.item.items.length > 0), switchMap(e => {
637
+ this.activeMenuItem.set(e.item);
638
+ return this.createSubmenu(e.event.currentTarget, false);
639
+ }))
640
+ .subscribe();
641
+ this.pointerLeave$
642
+ .pipe(takeUntilDestroyed(this.#destroyRef), takeUntil(this.pointerEnter$))
643
+ .subscribe(() => this.popupRef?.close());
644
+ }
645
+ setSubscriptions() {
646
+ this.setKeyboardEvents();
647
+ this.setPointerSubscriptions();
648
+ this.setPopupCloseSubscription();
649
+ this.setTypeaheadSubscription();
650
+ }
651
+ setTypeaheadSubscription() {
652
+ setupTypeahead(this.#typeaheadKey$)
653
+ .pipe(takeUntilDestroyed(this.#destroyRef))
654
+ .subscribe(buffer => this.cycleThroughMatchedItems(buffer));
655
+ }
656
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
657
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PopupMenuListComponent, isStandalone: true, selector: "mona-popup-menu-list", host: { properties: { "class": "baseClasses()" } }, ngImport: i0, template: "<div\r\n role=\"menu\"\r\n [attr.tabindex]=\"0\"\r\n [attr.aria-orientation]=\"'vertical'\"\r\n [attr.aria-activedescendant]=\"activeMenuItem()?.uid\"\r\n [attr.id]=\"menuId()\"\r\n [class]=\"containerClasses()\">\r\n @for (group of menuItems(); track $index) {\r\n @if (typeof group.key === \"string\") {\r\n @let groupTemplate = group.first().groupTemplate?.() ?? popupGroupTemplate() ?? null;\r\n <div role=\"group\" [attr.aria-labelledby]=\"`${group.key}-${$index}`\" [class]=\"groupHeaderClasses()\">\r\n <div [id]=\"`${group.key}-${$index}`\" role=\"presentation\">\r\n @if (groupTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"groupTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.key }\"></ng-container>\r\n } @else {\r\n <span>{{ group.key }}</span>\r\n }\r\n </div>\r\n </div>\r\n }\r\n @for (item of group.source; track $index) {\r\n @if (item.separator) {\r\n <div role=\"separator\" class=\"bg-border my-1 h-px\"></div>\r\n } @else {\r\n @let iconTemplate = item.iconTemplate?.() ?? popupIconTemplate() ?? null;\r\n @let shortcutTemplate = item.shortcutTemplate?.() ?? popupShortcutTemplate() ?? null;\r\n @let textTemplate = item.textTemplate?.() ?? popupTextTemplate() ?? null;\r\n <div\r\n role=\"menuitem\"\r\n [id]=\"item.uid\"\r\n (pointerenter)=\"pointerEnter$.next({ event: $event, item: item })\"\r\n (pointerleave)=\"pointerLeave$.next({ event: $event, item: item })\"\r\n (click)=\"onItemClick($event, item)\"\r\n [attr.data-active]=\"item === activeMenuItem()\"\r\n [attr.aria-disabled]=\"item.disabled\"\r\n [attr.aria-expanded]=\"item.items.length > 0 && item === activeMenuItem() && !!popupRef\"\r\n [attr.aria-haspopup]=\"item.items.length > 0 ? 'menu' : null\"\r\n [attr.aria-label]=\"item.label || null\"\r\n [attr.data-disabled]=\"item.disabled\"\r\n [class]=\"menuItemClasses()\">\r\n @if (iconAreaVisible()) {\r\n <div [class]=\"iconContainerClasses()\">\r\n @if (!item.checkable && !item.radio) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"iconTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\r\n } @else if (item.checkable) {\r\n @if (item.checked?.()) {\r\n <svg lucideCheck [size]=\"14\"></svg>\r\n }\r\n } @else if (item.radio) {\r\n @if (item.selected?.()) {\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n class=\"lucide lucide-circle size-2 fill-current\">\r\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\r\n </svg>\r\n }\r\n }\r\n </div>\r\n }\r\n <div class=\"flex-1\">\r\n @if (textTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"textTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\r\n } @else {\r\n {{ item.label }}\r\n }\r\n </div>\r\n @if (item.items.length > 0) {\r\n @if (!item.checkable) {\r\n <div [class]=\"linkContainerClasses()\">\r\n <svg lucideChevronRight [size]=\"16\"></svg>\r\n </div>\r\n }\r\n } @else if (shortcutTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"shortcutTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\r\n }\r\n </div>\r\n }\r\n }\r\n }\r\n</div>\r\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideChevronRight, selector: "svg[lucideChevronRight]" }, { kind: "component", type: LucideCheck, selector: "svg[lucideCheck]" }] }); }
658
+ }
659
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuListComponent, decorators: [{
660
+ type: Component,
661
+ args: [{ selector: "mona-popup-menu-list", imports: [NgTemplateOutlet, LucideChevronRight, LucideCheck], host: {
662
+ "[class]": "baseClasses()"
663
+ }, template: "<div\r\n role=\"menu\"\r\n [attr.tabindex]=\"0\"\r\n [attr.aria-orientation]=\"'vertical'\"\r\n [attr.aria-activedescendant]=\"activeMenuItem()?.uid\"\r\n [attr.id]=\"menuId()\"\r\n [class]=\"containerClasses()\">\r\n @for (group of menuItems(); track $index) {\r\n @if (typeof group.key === \"string\") {\r\n @let groupTemplate = group.first().groupTemplate?.() ?? popupGroupTemplate() ?? null;\r\n <div role=\"group\" [attr.aria-labelledby]=\"`${group.key}-${$index}`\" [class]=\"groupHeaderClasses()\">\r\n <div [id]=\"`${group.key}-${$index}`\" role=\"presentation\">\r\n @if (groupTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"groupTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.key }\"></ng-container>\r\n } @else {\r\n <span>{{ group.key }}</span>\r\n }\r\n </div>\r\n </div>\r\n }\r\n @for (item of group.source; track $index) {\r\n @if (item.separator) {\r\n <div role=\"separator\" class=\"bg-border my-1 h-px\"></div>\r\n } @else {\r\n @let iconTemplate = item.iconTemplate?.() ?? popupIconTemplate() ?? null;\r\n @let shortcutTemplate = item.shortcutTemplate?.() ?? popupShortcutTemplate() ?? null;\r\n @let textTemplate = item.textTemplate?.() ?? popupTextTemplate() ?? null;\r\n <div\r\n role=\"menuitem\"\r\n [id]=\"item.uid\"\r\n (pointerenter)=\"pointerEnter$.next({ event: $event, item: item })\"\r\n (pointerleave)=\"pointerLeave$.next({ event: $event, item: item })\"\r\n (click)=\"onItemClick($event, item)\"\r\n [attr.data-active]=\"item === activeMenuItem()\"\r\n [attr.aria-disabled]=\"item.disabled\"\r\n [attr.aria-expanded]=\"item.items.length > 0 && item === activeMenuItem() && !!popupRef\"\r\n [attr.aria-haspopup]=\"item.items.length > 0 ? 'menu' : null\"\r\n [attr.aria-label]=\"item.label || null\"\r\n [attr.data-disabled]=\"item.disabled\"\r\n [class]=\"menuItemClasses()\">\r\n @if (iconAreaVisible()) {\r\n <div [class]=\"iconContainerClasses()\">\r\n @if (!item.checkable && !item.radio) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"iconTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\r\n } @else if (item.checkable) {\r\n @if (item.checked?.()) {\r\n <svg lucideCheck [size]=\"14\"></svg>\r\n }\r\n } @else if (item.radio) {\r\n @if (item.selected?.()) {\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n class=\"lucide lucide-circle size-2 fill-current\">\r\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\r\n </svg>\r\n }\r\n }\r\n </div>\r\n }\r\n <div class=\"flex-1\">\r\n @if (textTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"textTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\r\n } @else {\r\n {{ item.label }}\r\n }\r\n </div>\r\n @if (item.items.length > 0) {\r\n @if (!item.checkable) {\r\n <div [class]=\"linkContainerClasses()\">\r\n <svg lucideChevronRight [size]=\"16\"></svg>\r\n </div>\r\n }\r\n } @else if (shortcutTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"shortcutTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\r\n }\r\n </div>\r\n }\r\n }\r\n }\r\n</div>\r\n" }]
664
+ }], ctorParameters: () => [] });
665
+
666
+ class PopupMenuComponent {
667
+ #close$;
668
+ #destroyRef;
669
+ #menuItemClick$;
670
+ #navigate$;
671
+ #popupMenuListConfig;
672
+ #popupService;
673
+ #triggerSubscription;
674
+ #shouldRestoreFocus;
675
+ #suppressNextTrustedContextMenu;
676
+ constructor() {
677
+ this.#close$ = new Subject();
678
+ this.#destroyRef = inject(DestroyRef);
679
+ this.#menuItemClick$ = new Subject();
680
+ this.#navigate$ = new Subject();
681
+ this.#popupMenuListConfig = computed(() => {
682
+ const data = {
683
+ isRoot: true,
684
+ items: this.menuItems(),
685
+ level: 0,
686
+ menuId: this.menuId(),
687
+ menuItemClick$: this.#menuItemClick$,
688
+ minWidth: computed(() => toCssValue(this.minWidth()) ?? null),
689
+ navigate$: this.#navigate$,
690
+ parentClose$: this.#close$,
691
+ popupGroupTemplate: computed(() => this.groupTemplateConfig()?.template ?? null),
692
+ popupIconTemplate: computed(() => this.iconTemplateConfig()?.template ?? null),
693
+ popupShortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
694
+ popupTextTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
695
+ rounded: computed(() => this.rounded()),
696
+ size: computed(() => this.size()),
697
+ width: computed(() => toCssValue(this.width()) ?? null)
698
+ };
699
+ return data;
700
+ }, /* @ts-ignore */
701
+ ...(ngDevMode ? [{ debugName: "#popupMenuListConfig" }] : /* istanbul ignore next */ []));
702
+ this.#popupService = inject(PopupService);
703
+ this.#triggerSubscription = null;
704
+ this.#shouldRestoreFocus = false;
705
+ this.#suppressNextTrustedContextMenu = false;
706
+ this.groupTemplateConfig = contentChild(PopupMenuGroupTemplateToken, { ...(ngDevMode ? { debugName: "groupTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
707
+ this.iconTemplateConfig = contentChild(PopupMenuIconTemplateToken, { ...(ngDevMode ? { debugName: "iconTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
708
+ this.nestedComponents = contentChildren(PopupMenuToken, { ...(ngDevMode ? { debugName: "nestedComponents" } : /* istanbul ignore next */ {}), descendants: false });
709
+ this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, { ...(ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
710
+ this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, { ...(ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
711
+ this.menuItems = computed(() => {
712
+ const inputItems = this.items();
713
+ if (any(inputItems)) {
714
+ const items = select(inputItems, i => Object.hasOwn(i, "uid") ? i : preparePopupMenuItems([i])[0]);
715
+ return groupBy(items, i => i.group).toImmutableSet();
716
+ }
717
+ const items = this.nestedComponents().flatMap(i => i.getPopupMenuItem());
718
+ return groupBy(items, i => i.group).toImmutableSet();
719
+ }, /* @ts-ignore */
720
+ ...(ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []));
721
+ this.popupRef = null;
722
+ /**
723
+ * @description The anchor element that the context menu will be anchored to.
724
+ * Only applicable when `precise` is set to `false`.
725
+ */
726
+ this.anchor = input(/* @ts-ignore */
727
+ ...(ngDevMode ? [undefined, { debugName: "anchor" }] : /* istanbul ignore next */ []));
728
+ /**
729
+ * @description The anchor connection point of the popup menu.
730
+ * Only applicable when `precise` is set to `false`.
731
+ */
732
+ this.anchorConnectionPoint = input(/* @ts-ignore */
733
+ ...(ngDevMode ? [undefined, { debugName: "anchorConnectionPoint" }] : /* istanbul ignore next */ []));
734
+ /**
735
+ * @description The event that is emitted when the popup menu is closed.
736
+ */
737
+ this.close = output();
738
+ /**
739
+ * @description The items to render in the popup menu.
740
+ * If provided, it will override the menu items defined by projected menu item components.
741
+ */
742
+ this.items = input([], /* @ts-ignore */
743
+ ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
744
+ /**
745
+ * @description The event that is emitted when a menu item is clicked.
746
+ */
747
+ this.menuClick = output();
748
+ /**
749
+ * @description The id of the popup menu's root element.
750
+ */
751
+ this.menuId = input("", { ...(ngDevMode ? { debugName: "menuId" } : /* istanbul ignore next */ {}), alias: "id" });
752
+ /**
753
+ * @description Sets the minimum width of the popup menu.
754
+ * This will be applied to the root menu and all submenus.
755
+ */
756
+ this.minWidth = input(/* @ts-ignore */
757
+ ...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
758
+ /**
759
+ * @description The event that is emitted when the popup menu is navigated.
760
+ * This is used to handle keyboard navigation within the popup menu.
761
+ */
762
+ this.navigate = output();
763
+ /**
764
+ * @description The offset of the popup menu from the anchor element.
765
+ */
766
+ this.offset = input(/* @ts-ignore */
767
+ ...(ngDevMode ? [undefined, { debugName: "offset" }] : /* istanbul ignore next */ []));
768
+ /**
769
+ * @description The event that is emitted when the popup menu is opened.
770
+ */
771
+ this.open = output();
772
+ /**
773
+ * @description The connection point of the popup element to which the anchor will be connected.
774
+ * Only applicable when `precise` is set to `false`.
775
+ */
776
+ this.popupConnectionPoint = input(/* @ts-ignore */
777
+ ...(ngDevMode ? [undefined, { debugName: "popupConnectionPoint" }] : /* istanbul ignore next */ []));
778
+ /**
779
+ * @description Whether the context menu should be opened with precise positioning.
780
+ * If true, the context menu will be positioned at the mouse cursor position.
781
+ * If false, it will be positioned at the target element. If an anchor is provided, it will be anchored to that element.
782
+ */
783
+ this.precise = input(false, /* @ts-ignore */
784
+ ...(ngDevMode ? [{ debugName: "precise" }] : /* istanbul ignore next */ []));
785
+ /**
786
+ * @description Sets the border radius of the popup menu.
787
+ * This will be applied to the root menu and all submenus.
788
+ */
789
+ this.rounded = input("medium", /* @ts-ignore */
790
+ ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
791
+ /**
792
+ * @description Sets the size of the popup menu.
793
+ * This will be applied to the root menu and all submenus.
794
+ */
795
+ this.size = input("medium", /* @ts-ignore */
796
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
797
+ /**
798
+ * @description The target element that will be used to trigger the popup menu.
799
+ */
800
+ this.target = input.required(/* @ts-ignore */
801
+ ...(ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []));
802
+ /**
803
+ * @description The event that triggers the popup menu.
804
+ */
805
+ this.trigger = input("click", /* @ts-ignore */
806
+ ...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
807
+ /**
808
+ * @description Sets the width of the popup menu.
809
+ * This will be applied to the root menu and all submenus.
810
+ */
811
+ this.width = input(/* @ts-ignore */
812
+ ...(ngDevMode ? [undefined, { debugName: "width" }] : /* istanbul ignore next */ []));
813
+ afterNextRender({
814
+ read: () => this.setSubscriptions()
815
+ });
816
+ afterRenderEffect({
817
+ read: () => {
818
+ rxTimeout(this.#destroyRef, () => {
819
+ this.anchor();
820
+ this.target();
821
+ this.trigger();
822
+ if (this.#triggerSubscription) {
823
+ this.#triggerSubscription.unsubscribe();
824
+ this.#triggerSubscription = null;
825
+ }
826
+ this.setTriggerSubscription();
827
+ });
828
+ }
829
+ });
830
+ }
831
+ clearFocusRestoration() {
832
+ this.#shouldRestoreFocus = false;
833
+ }
834
+ closeMenu() {
835
+ if (this.popupRef) {
836
+ this.popupRef.close();
837
+ this.popupRef = null;
838
+ }
839
+ }
840
+ openMenu(viaContextMenuKey) {
841
+ const target = this.target();
842
+ const targetElement = target instanceof ElementRef ? target.nativeElement : target;
843
+ if (!targetElement) {
844
+ return;
845
+ }
846
+ const center = targetElement.getBoundingClientRect();
847
+ // Create a fake event to pass the center of the target element as the mouse position.
848
+ // This is useful when precise is true, but we want to open the menu via keyboard
849
+ // or some other non-mouse event.
850
+ if (viaContextMenuKey) {
851
+ const contextMenuEvent = new MouseEvent("contextmenu", {
852
+ bubbles: true,
853
+ cancelable: true,
854
+ clientX: center.left + center.width / 2,
855
+ clientY: center.top + center.height / 2,
856
+ button: -1
857
+ });
858
+ const ownerDocument = targetElement.ownerDocument;
859
+ const suppressNativeContextMenu = (nativeEvent) => {
860
+ if (nativeEvent.isTrusted) {
861
+ nativeEvent.preventDefault();
862
+ ownerDocument.removeEventListener("contextmenu", suppressNativeContextMenu, { capture: true });
863
+ }
864
+ };
865
+ this.#suppressNextTrustedContextMenu = true;
866
+ ownerDocument.addEventListener("contextmenu", suppressNativeContextMenu, { capture: true });
867
+ targetElement.dispatchEvent(contextMenuEvent);
868
+ rxTimeout(this.#destroyRef, () => {
869
+ this.#suppressNextTrustedContextMenu = false;
870
+ ownerDocument.removeEventListener("contextmenu", suppressNativeContextMenu, { capture: true });
871
+ }, 500);
872
+ return;
873
+ }
874
+ const event = new MouseEvent(this.trigger(), { bubbles: true, cancelable: true });
875
+ targetElement.dispatchEvent(event);
876
+ }
877
+ openMenuViaKeyboard(viaContextMenuKey = false) {
878
+ this.#shouldRestoreFocus = true;
879
+ this.openMenu(viaContextMenuKey);
880
+ }
881
+ setRestoreFocusForKeyboard() {
882
+ this.#shouldRestoreFocus = true;
883
+ }
884
+ createMenu(event) {
885
+ const anchor = this.getPopupAnchor(event);
886
+ const anchorConnectionPoint = this.precise() ? undefined : this.anchorConnectionPoint();
887
+ const closeOnScroll = true;
888
+ const content = PopupMenuListComponent;
889
+ const data = this.#popupMenuListConfig();
890
+ const minWidth = toCssValue(this.minWidth());
891
+ const offset = this.offset();
892
+ const popupConnectionPoint = this.precise() ? undefined : this.popupConnectionPoint();
893
+ const width = toCssValue(this.width());
894
+ const popupRef = this.#popupService.create({
895
+ anchor,
896
+ anchorConnectionPoint,
897
+ closeOnScroll,
898
+ content,
899
+ data,
900
+ minWidth,
901
+ offset,
902
+ popupConnectionPoint,
903
+ restoreFocus: false,
904
+ width
905
+ });
906
+ popupRef.closeStart.pipe(take(1)).subscribe(() => this.#close$.next());
907
+ return popupRef;
908
+ }
909
+ getPopupAnchor(event) {
910
+ const anchorElement = this.anchor();
911
+ const targetElement = this.target();
912
+ const targetInput = anchorElement ?? targetElement;
913
+ const precise = this.precise();
914
+ const actualTargetElement = targetInput instanceof ElementRef ? targetInput.nativeElement : targetInput;
915
+ let anchor;
916
+ if (precise) {
917
+ if (event.button < 0) {
918
+ const rect = actualTargetElement.getBoundingClientRect();
919
+ anchor = { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
920
+ }
921
+ else {
922
+ anchor = { x: event.x, y: event.y };
923
+ }
924
+ }
925
+ else {
926
+ anchor = actualTargetElement;
927
+ }
928
+ return anchor;
929
+ }
930
+ setMenuItemClickSubscription() {
931
+ this.#menuItemClick$
932
+ .pipe(takeUntilDestroyed(this.#destroyRef), tap(event => {
933
+ this.menuClick.emit(event);
934
+ if (event.isDefaultPrevented()) {
935
+ return;
936
+ }
937
+ this.popupRef?.close();
938
+ }))
939
+ .subscribe();
940
+ }
941
+ setNavigationSubscription() {
942
+ this.#navigate$
943
+ .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => this.navigate.emit(e)))
944
+ .subscribe();
945
+ }
946
+ setSubscriptions() {
947
+ this.setMenuItemClickSubscription();
948
+ this.setNavigationSubscription();
949
+ this.setTriggerSubscription();
950
+ }
951
+ setTriggerSubscription() {
952
+ const element = this.target();
953
+ const trigger = this.trigger();
954
+ const targetElement = element instanceof ElementRef ? element.nativeElement : element;
955
+ this.#triggerSubscription = fromEvent(targetElement, trigger)
956
+ .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => e.preventDefault()))
957
+ .subscribe(e => {
958
+ if (e.isTrusted && this.#suppressNextTrustedContextMenu) {
959
+ this.#suppressNextTrustedContextMenu = false;
960
+ return;
961
+ }
962
+ if (this.popupRef) {
963
+ this.popupRef.close();
964
+ this.popupRef = null;
965
+ return;
966
+ }
967
+ this.popupRef = this.createMenu(e);
968
+ this.open.emit();
969
+ this.popupRef.beforeClose.pipe(takeUntil(this.popupRef.closed)).subscribe(e => {
970
+ const popupCloseEvent = e.result;
971
+ const closeEvent = new PopupMenuCloseEvent(popupCloseEvent);
972
+ this.close.emit(closeEvent);
973
+ if (closeEvent.isDefaultPrevented()) {
974
+ e.preventDefault();
975
+ return;
976
+ }
977
+ });
978
+ this.popupRef.closed.pipe(take(1)).subscribe(() => {
979
+ if (this.#shouldRestoreFocus) {
980
+ const target = this.target();
981
+ const targetElement = target instanceof ElementRef ? target.nativeElement : target;
982
+ if (targetElement && "focus" in targetElement) {
983
+ targetElement.focus();
984
+ }
985
+ }
986
+ this.popupRef = null;
987
+ this.#close$.next();
988
+ this.#shouldRestoreFocus = false;
989
+ });
990
+ });
991
+ }
992
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
993
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: PopupMenuComponent, isStandalone: true, selector: "mona-popup-menu", inputs: { anchor: { classPropertyName: "anchor", publicName: "anchor", isSignal: true, isRequired: false, transformFunction: null }, anchorConnectionPoint: { classPropertyName: "anchorConnectionPoint", publicName: "anchorConnectionPoint", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, menuId: { classPropertyName: "menuId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, popupConnectionPoint: { classPropertyName: "popupConnectionPoint", publicName: "popupConnectionPoint", isSignal: true, isRequired: false, transformFunction: null }, precise: { classPropertyName: "precise", publicName: "precise", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: true, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", menuClick: "menuClick", navigate: "navigate", open: "open" }, queries: [{ propertyName: "groupTemplateConfig", first: true, predicate: PopupMenuGroupTemplateToken, isSignal: true }, { propertyName: "iconTemplateConfig", first: true, predicate: PopupMenuIconTemplateToken, isSignal: true }, { propertyName: "nestedComponents", predicate: PopupMenuToken, isSignal: true }, { propertyName: "shortcutTemplateConfig", first: true, predicate: PopupMenuShortcutTemplateToken, isSignal: true }, { propertyName: "textTemplateConfig", first: true, predicate: PopupMenuTextTemplateToken, isSignal: true }], ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
994
+ }
995
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuComponent, decorators: [{
996
+ type: Component,
997
+ args: [{
998
+ selector: "mona-popup-menu",
999
+ template: "",
1000
+ changeDetection: ChangeDetectionStrategy.OnPush
1001
+ }]
1002
+ }], ctorParameters: () => [], propDecorators: { groupTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuGroupTemplateToken), { ...{
1003
+ descendants: false
1004
+ }, isSignal: true }] }], iconTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuIconTemplateToken), { ...{
1005
+ descendants: false
1006
+ }, isSignal: true }] }], nestedComponents: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PopupMenuToken), { ...{ descendants: false }, isSignal: true }] }], shortcutTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), { ...{
1007
+ descendants: false
1008
+ }, isSignal: true }] }], textTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuTextTemplateToken), { ...{
1009
+ descendants: false
1010
+ }, isSignal: true }] }], anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchor", required: false }] }], anchorConnectionPoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchorConnectionPoint", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], menuClick: [{ type: i0.Output, args: ["menuClick"] }], menuId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], navigate: [{ type: i0.Output, args: ["navigate"] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], open: [{ type: i0.Output, args: ["open"] }], popupConnectionPoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupConnectionPoint", required: false }] }], precise: [{ type: i0.Input, args: [{ isSignal: true, alias: "precise", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: true }] }], trigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "trigger", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
1011
+
1012
+ class PopupMenuCheckboxItemComponent {
1013
+ constructor() {
1014
+ this.#checked = linkedSignal(() => this.checked(), /* @ts-ignore */
1015
+ ...(ngDevMode ? [{ debugName: "#checked" }] : /* istanbul ignore next */ []));
1016
+ this.#click$ = new Subject();
1017
+ this.#destroyRef = inject(DestroyRef);
1018
+ this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, { ...(ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1019
+ this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, { ...(ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1020
+ /**
1021
+ * @description Sets the checked state of the menu item.
1022
+ */
1023
+ this.checked = input(false, /* @ts-ignore */
1024
+ ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
1025
+ /**
1026
+ * @description Emits when the checked state of the menu item changes.
1027
+ */
1028
+ this.checkedChange = output();
1029
+ /**
1030
+ * @description Sets the disabled state of the menu item.
1031
+ */
1032
+ this.disabled = input(false, /* @ts-ignore */
1033
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1034
+ /**
1035
+ * @description The text of the menu item.
1036
+ */
1037
+ this.label = input("", /* @ts-ignore */
1038
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1039
+ /**
1040
+ * @description The click event of the menu item.
1041
+ * Emits when the menu item is selected by keyboard or mouse.
1042
+ */
1043
+ this.menuClick = output();
1044
+ this.origin = PopupMenuOrigin.Popup;
1045
+ this.type = PopupMenuItemType.CheckboxMenuItem;
1046
+ }
1047
+ #checked;
1048
+ #click$;
1049
+ #destroyRef;
1050
+ getPopupMenuItem() {
1051
+ return [
1052
+ {
1053
+ checkable: true,
1054
+ checked: computed(() => this.#checked()),
1055
+ click$: this.#click$,
1056
+ disabled: this.disabled(),
1057
+ group: Symbol(),
1058
+ groupTemplate: null,
1059
+ iconTemplate: null,
1060
+ items: [],
1061
+ label: this.label(),
1062
+ shortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
1063
+ textTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
1064
+ uid: v4()
1065
+ }
1066
+ ];
1067
+ }
1068
+ ngOnInit() {
1069
+ this.setSubscriptions();
1070
+ }
1071
+ setSubscriptions() {
1072
+ this.#click$
1073
+ .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => {
1074
+ this.menuClick.emit(e);
1075
+ if (!e.isDefaultPrevented()) {
1076
+ this.checkedChange.emit(!this.#checked());
1077
+ }
1078
+ }))
1079
+ .subscribe();
1080
+ }
1081
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuCheckboxItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1082
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: PopupMenuCheckboxItemComponent, isStandalone: true, selector: "mona-popup-menu-checkbox-item", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange", menuClick: "menuClick" }, providers: [
1083
+ {
1084
+ provide: PopupMenuToken,
1085
+ useExisting: forwardRef(() => PopupMenuCheckboxItemComponent)
1086
+ }
1087
+ ], queries: [{ propertyName: "shortcutTemplateConfig", first: true, predicate: PopupMenuShortcutTemplateToken, isSignal: true }, { propertyName: "textTemplateConfig", first: true, predicate: PopupMenuTextTemplateToken, isSignal: true }], ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1088
+ }
1089
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuCheckboxItemComponent, decorators: [{
1090
+ type: Component,
1091
+ args: [{
1092
+ selector: "mona-popup-menu-checkbox-item",
1093
+ template: "",
1094
+ changeDetection: ChangeDetectionStrategy.OnPush,
1095
+ providers: [
1096
+ {
1097
+ provide: PopupMenuToken,
1098
+ useExisting: forwardRef(() => PopupMenuCheckboxItemComponent)
1099
+ }
1100
+ ]
1101
+ }]
1102
+ }], propDecorators: { shortcutTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), { ...{
1103
+ descendants: false
1104
+ }, isSignal: true }] }], textTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuTextTemplateToken), { ...{
1105
+ descendants: false
1106
+ }, isSignal: true }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], checkedChange: [{ type: i0.Output, args: ["checkedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], menuClick: [{ type: i0.Output, args: ["menuClick"] }] } });
1107
+
1108
+ class PopupMenuItemComponent {
1109
+ constructor() {
1110
+ this.#click$ = new Subject();
1111
+ this.#destroyRef = inject(DestroyRef);
1112
+ this.iconTemplateConfig = contentChild(PopupMenuIconTemplateToken, { ...(ngDevMode ? { debugName: "iconTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1113
+ this.items = contentChildren(PopupMenuToken, { ...(ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {}), descendants: false });
1114
+ this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, { ...(ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1115
+ this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, { ...(ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1116
+ /**
1117
+ * @description Sets the disabled state of the menu item.
1118
+ */
1119
+ this.disabled = input(false, /* @ts-ignore */
1120
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1121
+ /**
1122
+ * @description The text of the menu item.
1123
+ */
1124
+ this.label = input("", /* @ts-ignore */
1125
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1126
+ /**
1127
+ * @description The click event of the menu item.
1128
+ * Emits when the menu item is selected by keyboard or mouse.
1129
+ */
1130
+ this.menuClick = output();
1131
+ this.origin = PopupMenuOrigin.Popup;
1132
+ this.type = PopupMenuItemType.MenuItem;
1133
+ }
1134
+ #click$;
1135
+ #destroyRef;
1136
+ getPopupMenuItem() {
1137
+ return [
1138
+ {
1139
+ click$: this.#click$,
1140
+ disabled: this.disabled(),
1141
+ group: Symbol(),
1142
+ groupTemplate: null,
1143
+ iconTemplate: computed(() => this.iconTemplateConfig()?.template ?? null),
1144
+ items: selectMany(this.items().map(item => item.getPopupMenuItem()), i => i).toArray(),
1145
+ label: this.label(),
1146
+ shortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
1147
+ textTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
1148
+ uid: v4()
1149
+ }
1150
+ ];
1151
+ }
1152
+ ngOnInit() {
1153
+ this.setSubscriptions();
1154
+ }
1155
+ setSubscriptions() {
1156
+ this.#click$
1157
+ .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => this.menuClick.emit(e)))
1158
+ .subscribe();
1159
+ }
1160
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1161
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: PopupMenuItemComponent, isStandalone: true, selector: "mona-popup-menu-item", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { menuClick: "menuClick" }, providers: [
1162
+ {
1163
+ provide: PopupMenuToken,
1164
+ useExisting: forwardRef(() => PopupMenuItemComponent)
1165
+ }
1166
+ ], queries: [{ propertyName: "iconTemplateConfig", first: true, predicate: PopupMenuIconTemplateToken, isSignal: true }, { propertyName: "items", predicate: PopupMenuToken, isSignal: true }, { propertyName: "shortcutTemplateConfig", first: true, predicate: PopupMenuShortcutTemplateToken, isSignal: true }, { propertyName: "textTemplateConfig", first: true, predicate: PopupMenuTextTemplateToken, isSignal: true }], ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1167
+ }
1168
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuItemComponent, decorators: [{
1169
+ type: Component,
1170
+ args: [{
1171
+ selector: "mona-popup-menu-item",
1172
+ template: "",
1173
+ changeDetection: ChangeDetectionStrategy.OnPush,
1174
+ providers: [
1175
+ {
1176
+ provide: PopupMenuToken,
1177
+ useExisting: forwardRef(() => PopupMenuItemComponent)
1178
+ }
1179
+ ]
1180
+ }]
1181
+ }], propDecorators: { iconTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuIconTemplateToken), { ...{
1182
+ descendants: false
1183
+ }, isSignal: true }] }], items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PopupMenuToken), { ...{ descendants: false }, isSignal: true }] }], shortcutTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), { ...{
1184
+ descendants: false
1185
+ }, isSignal: true }] }], textTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuTextTemplateToken), { ...{
1186
+ descendants: false
1187
+ }, isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], menuClick: [{ type: i0.Output, args: ["menuClick"] }] } });
1188
+
1189
+ class PopupMenuGroupComponent {
1190
+ constructor() {
1191
+ this.groupTemplateConfig = contentChild(PopupMenuGroupTemplateToken, { ...(ngDevMode ? { debugName: "groupTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1192
+ this.items = contentChildren(PopupMenuToken, { ...(ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {}), descendants: false });
1193
+ this.origin = PopupMenuOrigin.Popup;
1194
+ /**
1195
+ * @description Sets the title of the menu group.
1196
+ */
1197
+ this.title = input.required(/* @ts-ignore */
1198
+ ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
1199
+ this.type = PopupMenuItemType.MenuGroup;
1200
+ }
1201
+ getPopupMenuItem() {
1202
+ const menuItems = this.items().map(i => i.getPopupMenuItem().map(item => ({
1203
+ ...item,
1204
+ group: this.title(),
1205
+ groupTemplate: computed(() => this.groupTemplateConfig()?.template ?? null)
1206
+ })));
1207
+ return selectMany(menuItems, i => i).toArray();
1208
+ }
1209
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1210
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: PopupMenuGroupComponent, isStandalone: true, selector: "mona-popup-menu-group", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null } }, providers: [
1211
+ {
1212
+ provide: PopupMenuToken,
1213
+ useExisting: forwardRef(() => PopupMenuGroupComponent)
1214
+ }
1215
+ ], queries: [{ propertyName: "groupTemplateConfig", first: true, predicate: PopupMenuGroupTemplateToken, isSignal: true }, { propertyName: "items", predicate: PopupMenuToken, isSignal: true }], ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1216
+ }
1217
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuGroupComponent, decorators: [{
1218
+ type: Component,
1219
+ args: [{
1220
+ selector: "mona-popup-menu-group",
1221
+ template: ``,
1222
+ changeDetection: ChangeDetectionStrategy.OnPush,
1223
+ providers: [
1224
+ {
1225
+ provide: PopupMenuToken,
1226
+ useExisting: forwardRef(() => PopupMenuGroupComponent)
1227
+ }
1228
+ ]
1229
+ }]
1230
+ }], propDecorators: { groupTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuGroupTemplateToken), { ...{
1231
+ descendants: false
1232
+ }, isSignal: true }] }], items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PopupMenuToken), { ...{ descendants: false }, isSignal: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }] } });
1233
+
1234
+ class PopupMenuRadioGroupComponent {
1235
+ constructor() {
1236
+ this.#click$ = new Subject();
1237
+ this.#destroyRef = inject(DestroyRef);
1238
+ this.groupTemplateConfig = contentChild(PopupMenuGroupTemplateToken, { ...(ngDevMode ? { debugName: "groupTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1239
+ this.items = contentChildren(PopupMenuRadioItemToken, { ...(ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {}), descendants: false });
1240
+ this.origin = PopupMenuOrigin.Popup;
1241
+ /**
1242
+ * @description The title of the radio group.
1243
+ */
1244
+ this.title = input("", /* @ts-ignore */
1245
+ ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
1246
+ this.type = PopupMenuItemType.RadioGroup;
1247
+ /**
1248
+ * @description The value of the selected radio item.
1249
+ */
1250
+ this.value = model("", /* @ts-ignore */
1251
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
1252
+ }
1253
+ #click$;
1254
+ #destroyRef;
1255
+ getPopupMenuItem() {
1256
+ const menuItems = this.items().map(i => i.getPopupMenuItem().map(item => ({
1257
+ ...item,
1258
+ click$: this.#click$,
1259
+ group: this.title() || Symbol(),
1260
+ groupTemplate: computed(() => this.groupTemplateConfig()?.template ?? null),
1261
+ radio: true,
1262
+ selected: computed(() => item.value?.() === this.value())
1263
+ })));
1264
+ return selectMany(menuItems, i => i).toArray();
1265
+ }
1266
+ ngOnInit() {
1267
+ this.setSubscription();
1268
+ }
1269
+ setSubscription() {
1270
+ this.#click$
1271
+ .pipe(takeUntilDestroyed(this.#destroyRef), filter(e => e.item.radio == true), tap(event => {
1272
+ if (event.isDefaultPrevented()) {
1273
+ return;
1274
+ }
1275
+ const value = event.item.value?.();
1276
+ if (value != null) {
1277
+ this.value.set(value);
1278
+ }
1279
+ }))
1280
+ .subscribe();
1281
+ }
1282
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuRadioGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1283
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: PopupMenuRadioGroupComponent, isStandalone: true, selector: "mona-popup-menu-radio-group", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [
1284
+ {
1285
+ provide: PopupMenuToken,
1286
+ useExisting: forwardRef(() => PopupMenuRadioGroupComponent)
1287
+ }
1288
+ ], queries: [{ propertyName: "groupTemplateConfig", first: true, predicate: PopupMenuGroupTemplateToken, isSignal: true }, { propertyName: "items", predicate: PopupMenuRadioItemToken, isSignal: true }], ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1289
+ }
1290
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuRadioGroupComponent, decorators: [{
1291
+ type: Component,
1292
+ args: [{
1293
+ selector: "mona-popup-menu-radio-group",
1294
+ template: "",
1295
+ changeDetection: ChangeDetectionStrategy.OnPush,
1296
+ providers: [
1297
+ {
1298
+ provide: PopupMenuToken,
1299
+ useExisting: forwardRef(() => PopupMenuRadioGroupComponent)
1300
+ }
1301
+ ]
1302
+ }]
1303
+ }], propDecorators: { groupTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuGroupTemplateToken), { ...{
1304
+ descendants: false
1305
+ }, isSignal: true }] }], items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PopupMenuRadioItemToken), { ...{ descendants: false }, isSignal: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
1306
+
1307
+ class PopupMenuRadioItemComponent {
1308
+ constructor() {
1309
+ this.#click$ = new Subject();
1310
+ this.#destroyRef = inject(DestroyRef);
1311
+ this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, { ...(ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1312
+ this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, { ...(ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1313
+ /**
1314
+ * @description Sets the disabled state of the menu item.
1315
+ */
1316
+ this.disabled = input(false, /* @ts-ignore */
1317
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1318
+ /**
1319
+ * @description The text of the menu item.
1320
+ */
1321
+ this.label = input("", /* @ts-ignore */
1322
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1323
+ /**
1324
+ * @description The click event of the menu item.
1325
+ * Emits when the menu item is selected by keyboard or mouse.
1326
+ */
1327
+ this.menuClick = output();
1328
+ this.origin = PopupMenuOrigin.Popup;
1329
+ this.type = PopupMenuItemType.RadioItem;
1330
+ /**
1331
+ * @description The value of the radio item.
1332
+ */
1333
+ this.value = input.required(/* @ts-ignore */
1334
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
1335
+ }
1336
+ #click$;
1337
+ #destroyRef;
1338
+ getPopupMenuItem() {
1339
+ return [
1340
+ {
1341
+ disabled: this.disabled(),
1342
+ group: Symbol(),
1343
+ groupTemplate: null,
1344
+ iconTemplate: null,
1345
+ items: [],
1346
+ label: this.label(),
1347
+ radio: true,
1348
+ shortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
1349
+ textTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
1350
+ uid: v4(),
1351
+ value: computed(() => this.value())
1352
+ }
1353
+ ];
1354
+ }
1355
+ ngOnInit() {
1356
+ this.setSubscription();
1357
+ }
1358
+ setSubscription() {
1359
+ this.#click$
1360
+ .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => this.menuClick.emit(e)))
1361
+ .subscribe();
1362
+ }
1363
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuRadioItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1364
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: PopupMenuRadioItemComponent, isStandalone: true, selector: "mona-popup-menu-radio-item", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { menuClick: "menuClick" }, providers: [
1365
+ {
1366
+ provide: PopupMenuToken,
1367
+ useExisting: forwardRef(() => PopupMenuRadioItemComponent)
1368
+ },
1369
+ {
1370
+ provide: PopupMenuRadioItemToken,
1371
+ useExisting: forwardRef(() => PopupMenuRadioItemComponent)
1372
+ }
1373
+ ], queries: [{ propertyName: "shortcutTemplateConfig", first: true, predicate: PopupMenuShortcutTemplateToken, isSignal: true }, { propertyName: "textTemplateConfig", first: true, predicate: PopupMenuTextTemplateToken, isSignal: true }], ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1374
+ }
1375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuRadioItemComponent, decorators: [{
1376
+ type: Component,
1377
+ args: [{
1378
+ selector: "mona-popup-menu-radio-item",
1379
+ template: "",
1380
+ changeDetection: ChangeDetectionStrategy.OnPush,
1381
+ providers: [
1382
+ {
1383
+ provide: PopupMenuToken,
1384
+ useExisting: forwardRef(() => PopupMenuRadioItemComponent)
1385
+ },
1386
+ {
1387
+ provide: PopupMenuRadioItemToken,
1388
+ useExisting: forwardRef(() => PopupMenuRadioItemComponent)
1389
+ }
1390
+ ]
1391
+ }]
1392
+ }], propDecorators: { shortcutTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), { ...{
1393
+ descendants: false
1394
+ }, isSignal: true }] }], textTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuTextTemplateToken), { ...{
1395
+ descendants: false
1396
+ }, isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], menuClick: [{ type: i0.Output, args: ["menuClick"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
1397
+
1398
+ class PopupMenuSeparatorComponent {
1399
+ constructor() {
1400
+ this.origin = PopupMenuOrigin.Popup;
1401
+ this.type = PopupMenuItemType.Separator;
1402
+ }
1403
+ getPopupMenuItem() {
1404
+ return [
1405
+ {
1406
+ disabled: true,
1407
+ group: Symbol(),
1408
+ groupTemplate: null,
1409
+ iconTemplate: null,
1410
+ items: [],
1411
+ label: "",
1412
+ separator: true,
1413
+ shortcutTemplate: null,
1414
+ textTemplate: null,
1415
+ uid: ""
1416
+ }
1417
+ ];
1418
+ }
1419
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuSeparatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1420
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: PopupMenuSeparatorComponent, isStandalone: true, selector: "mona-popup-menu-separator", providers: [
1421
+ {
1422
+ provide: PopupMenuToken,
1423
+ useExisting: forwardRef(() => PopupMenuSeparatorComponent)
1424
+ }
1425
+ ], ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1426
+ }
1427
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuSeparatorComponent, decorators: [{
1428
+ type: Component,
1429
+ args: [{
1430
+ selector: "mona-popup-menu-separator",
1431
+ template: "",
1432
+ changeDetection: ChangeDetectionStrategy.OnPush,
1433
+ providers: [
1434
+ {
1435
+ provide: PopupMenuToken,
1436
+ useExisting: forwardRef(() => PopupMenuSeparatorComponent)
1437
+ }
1438
+ ]
1439
+ }]
1440
+ }] });
1441
+
1442
+ class PopupMenuGroupTemplateDirective {
1443
+ constructor() {
1444
+ this.origin = PopupMenuTemplateOrigin.Popup;
1445
+ this.template = inject(TemplateRef);
1446
+ this.type = PopupMenuTemplateType.Group;
1447
+ }
1448
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuGroupTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1449
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PopupMenuGroupTemplateDirective, isStandalone: true, selector: "ng-template[monaPopupMenuGroupTemplate]", providers: [
1450
+ {
1451
+ provide: PopupMenuGroupTemplateToken,
1452
+ useExisting: forwardRef(() => PopupMenuGroupTemplateDirective)
1453
+ }
1454
+ ], ngImport: i0 }); }
1455
+ }
1456
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuGroupTemplateDirective, decorators: [{
1457
+ type: Directive,
1458
+ args: [{
1459
+ selector: "ng-template[monaPopupMenuGroupTemplate]",
1460
+ providers: [
1461
+ {
1462
+ provide: PopupMenuGroupTemplateToken,
1463
+ useExisting: forwardRef(() => PopupMenuGroupTemplateDirective)
1464
+ }
1465
+ ]
1466
+ }]
1467
+ }] });
1468
+
1469
+ class PopupMenuIconTemplateDirective {
1470
+ constructor() {
1471
+ this.origin = PopupMenuTemplateOrigin.Popup;
1472
+ this.template = inject(TemplateRef);
1473
+ this.type = PopupMenuTemplateType.Icon;
1474
+ }
1475
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuIconTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1476
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PopupMenuIconTemplateDirective, isStandalone: true, selector: "ng-template[monaPopupMenuIconTemplate]", providers: [
1477
+ {
1478
+ provide: PopupMenuIconTemplateToken,
1479
+ useExisting: forwardRef(() => PopupMenuIconTemplateDirective)
1480
+ }
1481
+ ], ngImport: i0 }); }
1482
+ }
1483
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuIconTemplateDirective, decorators: [{
1484
+ type: Directive,
1485
+ args: [{
1486
+ selector: "ng-template[monaPopupMenuIconTemplate]",
1487
+ providers: [
1488
+ {
1489
+ provide: PopupMenuIconTemplateToken,
1490
+ useExisting: forwardRef(() => PopupMenuIconTemplateDirective)
1491
+ }
1492
+ ]
1493
+ }]
1494
+ }] });
1495
+
1496
+ class PopupMenuShortcutTemplateDirective {
1497
+ constructor() {
1498
+ this.origin = PopupMenuTemplateOrigin.Popup;
1499
+ this.template = inject(TemplateRef);
1500
+ this.type = PopupMenuTemplateType.Shortcut;
1501
+ }
1502
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuShortcutTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1503
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PopupMenuShortcutTemplateDirective, isStandalone: true, selector: "ng-template[monaPopupMenuShortcutTemplate]", providers: [
1504
+ {
1505
+ provide: PopupMenuShortcutTemplateToken,
1506
+ useExisting: forwardRef(() => PopupMenuShortcutTemplateDirective)
1507
+ }
1508
+ ], ngImport: i0 }); }
1509
+ }
1510
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuShortcutTemplateDirective, decorators: [{
1511
+ type: Directive,
1512
+ args: [{
1513
+ selector: "ng-template[monaPopupMenuShortcutTemplate]",
1514
+ providers: [
1515
+ {
1516
+ provide: PopupMenuShortcutTemplateToken,
1517
+ useExisting: forwardRef(() => PopupMenuShortcutTemplateDirective)
1518
+ }
1519
+ ]
1520
+ }]
1521
+ }] });
1522
+
1523
+ class PopupMenuTextTemplateDirective {
1524
+ constructor() {
1525
+ this.origin = PopupMenuTemplateOrigin.Popup;
1526
+ this.template = inject(TemplateRef);
1527
+ this.type = PopupMenuTemplateType.Text;
1528
+ }
1529
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuTextTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1530
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PopupMenuTextTemplateDirective, isStandalone: true, selector: "ng-template[monaPopupMenuTextTemplate]", providers: [
1531
+ {
1532
+ provide: PopupMenuTextTemplateToken,
1533
+ useExisting: forwardRef(() => PopupMenuTextTemplateDirective)
1534
+ }
1535
+ ], ngImport: i0 }); }
1536
+ }
1537
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuTextTemplateDirective, decorators: [{
1538
+ type: Directive,
1539
+ args: [{
1540
+ selector: "ng-template[monaPopupMenuTextTemplate]",
1541
+ providers: [
1542
+ {
1543
+ provide: PopupMenuTextTemplateToken,
1544
+ useExisting: forwardRef(() => PopupMenuTextTemplateDirective)
1545
+ }
1546
+ ]
1547
+ }]
1548
+ }] });
1549
+
1550
+ /*
1551
+ * Public API Surface of @nanahoshi/mona-ui/popup-menu
1552
+ */
1553
+
1554
+ /**
1555
+ * Generated bundle index. Do not edit.
1556
+ */
1557
+
1558
+ export { PopupMenuCheckboxItemComponent, PopupMenuCloseEvent, PopupMenuComponent, PopupMenuGroupComponent, PopupMenuGroupTemplateDirective, PopupMenuGroupTemplateToken, PopupMenuIconTemplateDirective, PopupMenuIconTemplateToken, PopupMenuItemClickEvent, PopupMenuItemComponent, PopupMenuItemType, PopupMenuOrigin, PopupMenuRadioGroupComponent, PopupMenuRadioItemComponent, PopupMenuRadioItemToken, PopupMenuSeparatorComponent, PopupMenuShortcutTemplateDirective, PopupMenuShortcutTemplateToken, PopupMenuTemplateOrigin, PopupMenuTemplateType, PopupMenuTextTemplateDirective, PopupMenuTextTemplateToken, PopupMenuToken, ensurePopupComponentTypes, ensurePopupTemplateTypes, preparePopupMenuItems };
1559
+ //# sourceMappingURL=nanahoshi-mona-ui-popup-menu.mjs.map