@nanahoshi/mona-ui 0.27.2 → 0.28.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 (208) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/popup.md +1 -1
  3. package/docs/api/theme.md +2 -2
  4. package/docs/chart.md +14 -0
  5. package/docs/editor.md +2 -0
  6. package/docs/installation.md +147 -15
  7. package/docs/introduction.md +37 -15
  8. package/docs/theming-built-in-themes.md +67 -0
  9. package/docs/theming-custom-colors.md +274 -0
  10. package/docs/theming-custom-themes.md +168 -0
  11. package/docs/theming.md +164 -248
  12. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  13. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  14. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  15. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  16. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  17. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2070 -1573
  18. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  19. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  20. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  21. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  22. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  23. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  24. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  25. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  26. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  27. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  28. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  29. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  30. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  31. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  32. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  33. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  34. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  35. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  37. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  38. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  39. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  40. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  41. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  42. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  49. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  50. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  51. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  52. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  53. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  54. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  55. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  56. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  57. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  58. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  59. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  60. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  61. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  62. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  63. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  65. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  66. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  67. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  68. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  70. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  71. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  72. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  73. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  74. package/fesm2022/nanahoshi-mona-ui-locales.mjs +59 -77
  75. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  76. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  77. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  78. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  79. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  80. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  81. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  82. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  83. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  84. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  85. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  86. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  87. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  88. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  89. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  90. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  91. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  92. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  93. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  94. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  95. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  96. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  97. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  98. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  99. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  100. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  101. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  102. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  103. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  104. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  105. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  106. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  107. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  108. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  109. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  110. package/llms.txt +6 -2
  111. package/package.json +62 -23
  112. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  113. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  114. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  115. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  116. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  117. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  118. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  119. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  120. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  121. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  122. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  123. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  124. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  125. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  126. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  127. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  128. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  129. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  130. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  131. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  132. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  133. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  134. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  135. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  136. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  137. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  138. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  139. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  140. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  141. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  142. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  143. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  144. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  145. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  146. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  147. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  148. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  149. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  150. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  151. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  152. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  153. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  154. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  155. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  156. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  157. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  158. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  159. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  168. package/types/nanahoshi-mona-ui-locales.d.ts +17 -19
  169. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  170. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  171. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  172. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  173. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  174. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  175. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  176. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  177. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  178. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  179. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  180. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  181. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  182. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  183. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  184. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  185. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  186. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  187. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  188. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  189. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  190. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  191. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  192. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  193. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  194. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  195. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  196. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  197. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  198. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  199. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  200. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  201. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  202. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  203. package/types/nanahoshi-mona-ui.d.ts +1 -2
  204. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  205. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  206. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  207. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  208. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,98 +1,66 @@
1
- import * as i0 from '@angular/core';
2
- import { isSignal, inject, DestroyRef, DOCUMENT, ElementRef, computed, signal, afterNextRender, effect, untracked, Component, contentChild, contentChildren, input, output, model, forwardRef, TemplateRef, Directive } from '@angular/core';
3
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
- import { PreventableEvent, classInputToClass } from '@nanahoshi/mona-ui/common';
5
- import { createElementControlId, themeOverlaySurfaceClasses, isNavigationKey, isTypeaheadKey, setupTypeahead, rxTimeout, toCssValue } from '@nanahoshi/mona-ui/internal';
6
- import { PopupDataInjectionToken, PopupService } from '@nanahoshi/mona-ui/popup';
7
- import { select, selectMany, any } from '@mirei/ts-collections';
8
- import { Subject, take, fromEvent, tap, takeUntil, filter } from 'rxjs';
9
- import { PopupMenuItemClickEvent, PopupMenuGroupTemplateToken, PopupMenuIconTemplateToken, PopupMenuToken, PopupMenuShortcutTemplateToken, PopupMenuTextTemplateToken, preparePopupMenuItems, PopupMenuOrigin, PopupMenuItemType, PopupMenuRadioItemToken, PopupMenuTemplateOrigin, PopupMenuTemplateType } from '@nanahoshi/mona-ui/internal/popup-menu';
10
- export { PopupMenuItemClickEvent } from '@nanahoshi/mona-ui/internal/popup-menu';
11
- import { NgTemplateOutlet } from '@angular/common';
12
- import { LucideChevronRight, LucideCheck } from '@lucide/angular';
13
- import { injectComponentDirection } from '@nanahoshi/mona-ui/i18n';
14
- import { twMerge } from 'tailwind-merge';
15
- import { cva } from 'class-variance-authority';
16
-
17
- class PopupMenuCloseEvent extends PreventableEvent {
18
- constructor(originalEvent) {
19
- super("popupMenuCloseEvent", originalEvent?.originalEvent);
20
- }
21
- }
22
-
23
- const convertToMenuItem = (item) => {
24
- return {
25
- checkable: item.checkable,
26
- checked: item.checked ? item.checked() : false,
27
- disabled: item.disabled,
28
- group: typeof item.group === "string" ? item.group || undefined : item.group.description || undefined,
29
- items: select(item.items, i => convertToMenuItem(i)).toArray(),
30
- label: item.label,
31
- separator: item.separator,
32
- value: item.value?.()
33
- };
1
+ import * as i0 from "@angular/core";
2
+ import { Component, DOCUMENT, DestroyRef, Directive, ElementRef, TemplateRef, afterNextRender, computed, contentChild, contentChildren, effect, forwardRef, inject, input, isSignal, model, output, signal, untracked } from "@angular/core";
3
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
4
+ import { PreventableEvent, classInputToClass } from "@nanahoshi/mona-ui/common";
5
+ import { createElementControlId, isNavigationKey, isTypeaheadKey, rxTimeout, setupTypeahead, themeOverlaySurfaceClasses, toCssValue } from "@nanahoshi/mona-ui/internal";
6
+ import { PopupDataInjectionToken, PopupService } from "@nanahoshi/mona-ui/popup";
7
+ import { any, select, selectMany } from "@mirei/ts-collections";
8
+ import { Subject, filter, fromEvent, take, takeUntil, tap } from "rxjs";
9
+ import { PopupMenuGroupTemplateToken, PopupMenuIconTemplateToken, PopupMenuItemClickEvent, PopupMenuItemClickEvent as PopupMenuItemClickEvent$1, PopupMenuItemType, PopupMenuOrigin, PopupMenuRadioItemToken, PopupMenuShortcutTemplateToken, PopupMenuTemplateOrigin, PopupMenuTemplateType, PopupMenuTextTemplateToken, PopupMenuToken, preparePopupMenuItems } from "@nanahoshi/mona-ui/internal/popup-menu";
10
+ import { NgTemplateOutlet } from "@angular/common";
11
+ import { LucideCheck, LucideChevronRight } from "@lucide/angular";
12
+ import { injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
13
+ import { twMerge } from "tailwind-merge";
14
+ import { cva } from "class-variance-authority";
15
+ var PopupMenuCloseEvent = class extends PreventableEvent {
16
+ constructor(originalEvent) {
17
+ super("popupMenuCloseEvent", originalEvent?.originalEvent);
18
+ }
34
19
  };
35
- /**
36
- * Groups consecutive items that share a group key, keeping the items' order. Items with the same key that aren't
37
- * next to each other form separate groups.
38
- */
39
20
  const groupPopupMenuItems = (items) => {
40
- const groups = [];
41
- for (const item of items) {
42
- const last = groups.at(-1);
43
- if (last && last.key === item.group) {
44
- last.items.push(item);
45
- }
46
- else {
47
- groups.push({ items: [item], key: item.group });
48
- }
49
- }
50
- return groups.map(group => {
51
- const title = typeof group.key === "string" ? group.key : (group.key.description ?? "");
52
- return { items: group.items, key: group.key, labelId: title ? createElementControlId() : "", title };
53
- });
21
+ const groups = [];
22
+ for (const item of items) {
23
+ const last = groups.at(-1);
24
+ if (last && last.key === item.group) last.items.push(item);
25
+ else groups.push({
26
+ items: [item],
27
+ key: item.group
28
+ });
29
+ }
30
+ return groups.map((group) => {
31
+ const title = typeof group.key === "string" ? group.key : group.key.description ?? "";
32
+ return {
33
+ items: group.items,
34
+ key: group.key,
35
+ labelId: title ? createElementControlId() : "",
36
+ title
37
+ };
38
+ });
54
39
  };
55
- /**
56
- * Whether the item's checked state is held by the menu (a checkable `MenuItem` from the `items` input), so the
57
- * menu toggles it when the item is activated.
58
- */
59
40
  const isMenuOwnedCheckState = (item) => {
60
- return item.checkable === true && isSignal(item.checked) && "set" in item.checked;
41
+ return item.checkable === true && isSignal(item.checked) && "set" in item.checked;
61
42
  };
62
-
63
- const popupMenuBaseThemeVariants = cva(`h-full w-full overflow-hidden`, {
64
- variants: {
65
- rounded: {
66
- small: "rounded-sm",
67
- medium: "rounded-md",
68
- large: "rounded-lg",
69
- none: "rounded-none"
70
- }
71
- }
72
- });
43
+ const popupMenuBaseThemeVariants = cva(`h-full w-full overflow-hidden`, { variants: { rounded: {
44
+ small: "rounded-sm",
45
+ medium: "rounded-md",
46
+ large: "rounded-lg",
47
+ none: "rounded-none"
48
+ } } });
73
49
  const popupMenuContainerThemeVariants = cva(`
74
50
  flex flex-col p-1
75
51
  ${themeOverlaySurfaceClasses} text-foreground
76
52
  border border-border shadow-(--shadow-overlay) outline-none focus-visible:outline-hidden
77
- `, {
78
- variants: {
79
- rounded: {
80
- small: "rounded-sm",
81
- medium: "rounded-md",
82
- large: "rounded-lg",
83
- none: "rounded-none"
84
- }
85
- }
86
- });
87
- const popupMenuGroupHeaderThemeVariants = cva(`inline-flex w-full select-none px-2 py-1 font-bold text-muted-foreground`, {
88
- variants: {
89
- size: {
90
- small: "text-xs",
91
- medium: "text-sm",
92
- large: "text-base"
93
- }
94
- }
95
- });
53
+ `, { variants: { rounded: {
54
+ small: "rounded-sm",
55
+ medium: "rounded-md",
56
+ large: "rounded-lg",
57
+ none: "rounded-none"
58
+ } } });
59
+ const popupMenuGroupHeaderThemeVariants = cva(`inline-flex w-full select-none px-2 py-1 font-bold text-muted-foreground`, { variants: { size: {
60
+ small: "text-xs",
61
+ medium: "text-sm",
62
+ large: "text-base"
63
+ } } });
96
64
  const popupMenuIconContainerThemeVariants = cva(`absolute start-2 flex items-center justify-center`);
97
65
  const popupMenuItemThemeVariants = cva(`
98
66
  relative flex cursor-pointer select-none items-center gap-2 py-1 pe-2 ps-8
@@ -105,1614 +73,2275 @@ const popupMenuItemThemeVariants = cva(`
105
73
  data-[active='true']:bg-[var(--mona-menu-item-hover-background,var(--color-hover))]
106
74
  data-[active='true']:text-foreground
107
75
  data-[active='true']:data-[disabled='true']:text-disabled-foreground
108
- `, {
109
- variants: {
110
- rounded: {
111
- small: "rounded-sm",
112
- medium: "rounded-md",
113
- large: "rounded-lg",
114
- none: "rounded-none"
115
- },
116
- size: {
117
- small: "text-xs",
118
- medium: "text-sm",
119
- large: "text-base"
120
- }
121
- }
122
- });
76
+ `, { variants: {
77
+ rounded: {
78
+ small: "rounded-sm",
79
+ medium: "rounded-md",
80
+ large: "rounded-lg",
81
+ none: "rounded-none"
82
+ },
83
+ size: {
84
+ small: "text-xs",
85
+ medium: "text-sm",
86
+ large: "text-base"
87
+ }
88
+ } });
123
89
  const popupMenuLinkThemeVariants = cva(`flex items-center justify-center`);
124
-
125
- /**
126
- * How long the pointer can cross other items, while a submenu is open, before that submenu closes. It gives the
127
- * pointer time to travel diagonally from a parent item to its submenu.
128
- */
129
90
  const SUBMENU_SWITCH_DELAY = 250;
130
- class PopupMenuListComponent {
131
- #childCloseRequest$;
132
- #destroyRef;
133
- #direction;
134
- #document;
135
- #host;
136
- // Disabled items stay in the arrow-key order (they can't be activated), as the APG menu pattern asks.
137
- #navigationItems;
138
- #openSubmenuItem;
139
- #parentConfig;
140
- #popupService;
141
- #submenuId;
142
- #typeaheadKey$;
143
- #childClose$;
144
- #closing;
145
- #hoverTimer;
146
- constructor() {
147
- this.#childCloseRequest$ = new Subject();
148
- this.#destroyRef = inject(DestroyRef);
149
- this.#direction = injectComponentDirection();
150
- this.#document = inject(DOCUMENT);
151
- this.#host = inject((ElementRef));
152
- // Disabled items stay in the arrow-key order (they can't be activated), as the APG menu pattern asks.
153
- this.#navigationItems = computed(() => {
154
- const items = this.#parentConfig.items();
155
- return selectMany(items, i => i.items)
156
- .where(i => !i.separator)
157
- .toImmutableSet();
158
- }, /* @ts-ignore */
159
- ...(ngDevMode ? [{ debugName: "#navigationItems" }] : /* istanbul ignore next */ []));
160
- this.#openSubmenuItem = signal(null, /* @ts-ignore */
161
- ...(ngDevMode ? [{ debugName: "#openSubmenuItem" }] : /* istanbul ignore next */ []));
162
- this.#parentConfig = inject(PopupDataInjectionToken);
163
- this.#popupService = inject(PopupService);
164
- this.#submenuId = signal(null, /* @ts-ignore */
165
- ...(ngDevMode ? [{ debugName: "#submenuId" }] : /* istanbul ignore next */ []));
166
- this.#typeaheadKey$ = new Subject();
167
- this.#childClose$ = null;
168
- this.#closing = false;
169
- this.activeMenuItem = signal(null, /* @ts-ignore */
170
- ...(ngDevMode ? [{ debugName: "activeMenuItem" }] : /* istanbul ignore next */ []));
171
- this.ariaLabel = this.#parentConfig.ariaLabel || null;
172
- this.baseClasses = computed(() => {
173
- const rounded = this.#parentConfig.rounded();
174
- return popupMenuBaseThemeVariants({ rounded });
175
- }, /* @ts-ignore */
176
- ...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
177
- this.containerClasses = computed(() => {
178
- const rounded = this.#parentConfig.rounded();
179
- return popupMenuContainerThemeVariants({ rounded });
180
- }, /* @ts-ignore */
181
- ...(ngDevMode ? [{ debugName: "containerClasses" }] : /* istanbul ignore next */ []));
182
- this.groupHeaderClasses = computed(() => {
183
- const size = this.#parentConfig.size();
184
- return popupMenuGroupHeaderThemeVariants({ size });
185
- }, /* @ts-ignore */
186
- ...(ngDevMode ? [{ debugName: "groupHeaderClasses" }] : /* istanbul ignore next */ []));
187
- this.iconAreaVisible = computed(() => {
188
- const items = this.#parentConfig.items();
189
- const hasIconsOrSelectable = selectMany(items, i => i.items).any(i => i.iconTemplate?.() != null || i.checkable === true || i.radio === true);
190
- return hasIconsOrSelectable || !!this.#parentConfig.popupIconTemplate?.();
191
- }, /* @ts-ignore */
192
- ...(ngDevMode ? [{ debugName: "iconAreaVisible" }] : /* istanbul ignore next */ []));
193
- this.iconContainerClasses = computed(() => {
194
- return popupMenuIconContainerThemeVariants();
195
- }, /* @ts-ignore */
196
- ...(ngDevMode ? [{ debugName: "iconContainerClasses" }] : /* istanbul ignore next */ []));
197
- this.isRtl = computed(() => this.#direction() === "rtl", /* @ts-ignore */
198
- ...(ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []));
199
- this.labelledBy = this.ariaLabel ? null : this.#parentConfig.labelledBy;
200
- this.linkContainerClasses = computed(() => {
201
- return popupMenuLinkThemeVariants();
202
- }, /* @ts-ignore */
203
- ...(ngDevMode ? [{ debugName: "linkContainerClasses" }] : /* istanbul ignore next */ []));
204
- this.menuId = computed(() => this.#parentConfig.menuId, /* @ts-ignore */
205
- ...(ngDevMode ? [{ debugName: "menuId" }] : /* istanbul ignore next */ []));
206
- this.menuItemClasses = computed(() => {
207
- const rounded = this.#parentConfig.rounded();
208
- const size = this.#parentConfig.size();
209
- const hasIcon = this.iconAreaVisible();
210
- const variantClasses = popupMenuItemThemeVariants({ rounded, size });
211
- const iconClasses = hasIcon ? "ps-8" : "ps-2";
212
- return twMerge(variantClasses, iconClasses);
213
- }, /* @ts-ignore */
214
- ...(ngDevMode ? [{ debugName: "menuItemClasses" }] : /* istanbul ignore next */ []));
215
- this.menuItems = computed(() => this.#parentConfig.items(), /* @ts-ignore */
216
- ...(ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []));
217
- this.openSubmenuItem = this.#openSubmenuItem.asReadonly();
218
- this.popupGroupTemplate = computed(() => this.#parentConfig.popupGroupTemplate?.() ?? null, /* @ts-ignore */
219
- ...(ngDevMode ? [{ debugName: "popupGroupTemplate" }] : /* istanbul ignore next */ []));
220
- this.popupIconTemplate = computed(() => this.#parentConfig.popupIconTemplate?.() ?? null, /* @ts-ignore */
221
- ...(ngDevMode ? [{ debugName: "popupIconTemplate" }] : /* istanbul ignore next */ []));
222
- this.popupShortcutTemplate = computed(() => this.#parentConfig.popupShortcutTemplate?.() ?? null, /* @ts-ignore */
223
- ...(ngDevMode ? [{ debugName: "popupShortcutTemplate" }] : /* istanbul ignore next */ []));
224
- this.popupTextTemplate = computed(() => this.#parentConfig.popupTextTemplate?.(), /* @ts-ignore */
225
- ...(ngDevMode ? [{ debugName: "popupTextTemplate" }] : /* istanbul ignore next */ []));
226
- this.submenuId = this.#submenuId.asReadonly();
227
- this.popupRef = null;
228
- afterNextRender({
229
- // Moving focus and the highlight writes to the page, so this is the write phase.
230
- write: () => {
231
- const config = this.#parentConfig;
232
- // A submenu opened by the pointer leaves focus in its parent menu.
233
- if (config.isRoot || config.viaKeyboardNavigation) {
234
- this.#menuElement()?.focus();
235
- }
236
- if (config.isRoot && config.initialFocus) {
237
- if (config.initialFocus === "last") {
238
- this.handleEndKey();
239
- }
240
- else {
241
- this.focusFirstItem();
242
- }
243
- }
244
- else if (!config.isRoot && config.viaKeyboardNavigation) {
245
- const item = this.focusFirstItem();
246
- const isRtl = this.isRtl();
247
- this.notifyNavigation(item, isRtl ? "left" : "right");
248
- }
249
- }
250
- });
251
- // Items can change while the menu is open: keep the highlight and the open submenu on the same items.
252
- effect(() => {
253
- const items = this.#navigationItems();
254
- untracked(() => {
255
- const active = this.activeMenuItem();
256
- if (active && !items.any(i => i === active)) {
257
- this.activeMenuItem.set(items.firstOrDefault(i => i.uid === active.uid) ?? null);
258
- }
259
- const open = this.#openSubmenuItem();
260
- if (open && !items.any(i => i === open)) {
261
- const current = items.firstOrDefault(i => i.uid === open.uid);
262
- if (current && current.items.length > 0) {
263
- this.#openSubmenuItem.set(current);
264
- }
265
- else {
266
- this.closePopup();
267
- }
268
- }
269
- });
270
- });
271
- this.#destroyRef.onDestroy(() => {
272
- clearTimeout(this.#hoverTimer);
273
- this.#closing = true;
274
- this.closePopup();
275
- });
276
- }
277
- ngOnInit() {
278
- this.setSubscriptions();
279
- }
280
- #menuElement() {
281
- return this.#host.nativeElement.firstElementChild;
282
- }
283
- asItems(items) {
284
- return items;
285
- }
286
- onFocusOut(event) {
287
- const next = event.relatedTarget;
288
- // Focus that leaves every menu of the chain closes it. Focus moving between the menus doesn't, and nor does
289
- // focus going nowhere (the window losing focus).
290
- if (next instanceof Element && !next.closest("mona-popup-menu-list")) {
291
- this.#parentConfig.closeMenu({ focusLeftTo: next });
292
- }
293
- }
294
- onHostPointerEnter() {
295
- this.#parentConfig.submenuPointerEnter?.();
296
- }
297
- onItemClick(event, item) {
298
- if (item.disabled) {
299
- return;
300
- }
301
- if (item.items.length > 0) {
302
- // An item with a submenu opens it; only leaf items are activated. A click with no pointer behind it
303
- // (assistive technology) opens the submenu as the keyboard does.
304
- this.openSubmenuFromClick(item, event.currentTarget, event.detail === 0);
305
- return;
306
- }
307
- const popupMenuItemClickEvent = new PopupMenuItemClickEvent(item, event);
308
- item.click$?.next(popupMenuItemClickEvent);
309
- if (popupMenuItemClickEvent.isDefaultPrevented()) {
310
- return;
311
- }
312
- this.#parentConfig.menuItemClick$.next(popupMenuItemClickEvent);
313
- }
314
- onItemPointerEnter(event, item) {
315
- clearTimeout(this.#hoverTimer);
316
- const open = this.#openSubmenuItem();
317
- if (open === item) {
318
- this.activeMenuItem.set(item);
319
- return;
320
- }
321
- const target = event.currentTarget;
322
- const hover = () => {
323
- this.closePopup();
324
- if (item.items.length > 0 && !item.disabled) {
325
- this.activeMenuItem.set(item);
326
- this.createSubmenu(target, false, item);
327
- }
328
- else {
329
- this.activeMenuItem.set(null);
330
- }
331
- };
332
- if (open) {
333
- // Wait before switching, so the pointer can cross other items on its way into the open submenu.
334
- this.#hoverTimer = setTimeout(hover, SUBMENU_SWITCH_DELAY);
335
- }
336
- else {
337
- hover();
338
- }
339
- }
340
- closePopup() {
341
- const ref = this.popupRef;
342
- this.popupRef = null;
343
- this.#openSubmenuItem.set(null);
344
- this.#submenuId.set(null);
345
- const childClose$ = this.#childClose$;
346
- this.#childClose$ = null;
347
- childClose$?.next();
348
- if (ref) {
349
- this.reclaimFocus();
350
- ref.close();
351
- }
352
- }
353
- closeSubmenu() {
354
- this.#parentConfig.childCloseRequest$?.next();
355
- }
356
- createSubmenu(target, viaKeyboard, item) {
357
- // One submenu at a time: a submenu that is open (for this item or another) closes first.
358
- this.closePopup();
359
- const uid = item.uid;
360
- const close$ = new Subject();
361
- const menuId = createElementControlId(this.#parentConfig.level + 1);
362
- const data = {
363
- childCloseRequest$: this.#childCloseRequest$,
364
- closeMenu: this.#parentConfig.closeMenu,
365
- isRoot: false,
366
- items: computed(() => groupPopupMenuItems(this.findItem(uid)?.items ?? [])),
367
- labelledBy: uid,
368
- level: this.#parentConfig.level + 1,
369
- menuId,
370
- menuItemClick$: this.#parentConfig.menuItemClick$,
371
- minWidth: this.#parentConfig.minWidth,
372
- navigate$: this.#parentConfig.navigate$,
373
- parentClose$: close$,
374
- popupGroupTemplate: this.#parentConfig.popupGroupTemplate,
375
- popupIconTemplate: this.#parentConfig.popupIconTemplate,
376
- popupShortcutTemplate: this.#parentConfig.popupShortcutTemplate,
377
- popupTextTemplate: this.#parentConfig.popupTextTemplate,
378
- rounded: this.#parentConfig.rounded,
379
- size: this.#parentConfig.size,
380
- submenuPointerEnter: () => this.onSubmenuPointerEnter(),
381
- viaKeyboardNavigation: viaKeyboard,
382
- width: this.#parentConfig.width
383
- };
384
- const ref = this.#popupService.create({
385
- anchor: target,
386
- anchorConnectionPoint: "topright",
387
- closeOnScroll: true,
388
- content: PopupMenuListComponent,
389
- data,
390
- minWidth: this.#parentConfig.minWidth?.() ?? undefined,
391
- popupConnectionPoint: "topleft",
392
- restoreFocus: false,
393
- width: this.#parentConfig.width?.() ?? undefined
394
- });
395
- this.popupRef = ref;
396
- this.#childClose$ = close$;
397
- this.#openSubmenuItem.set(item);
398
- this.#submenuId.set(menuId);
399
- ref.closed.pipe(take(1)).subscribe(() => {
400
- close$.complete();
401
- // Closed by the popup itself (Escape, scroll); a submenu closed or replaced from here is done already.
402
- if (this.popupRef !== ref) {
403
- return;
404
- }
405
- this.popupRef = null;
406
- this.#childClose$ = null;
407
- this.#openSubmenuItem.set(null);
408
- this.#submenuId.set(null);
409
- if (!this.#closing) {
410
- this.#menuElement()?.focus();
411
- }
412
- if (!viaKeyboard) {
413
- this.activeMenuItem.set(null);
414
- }
415
- });
416
- }
417
- cycleThroughMatchedItems(buffer) {
418
- const matchedItems = this.#navigationItems()
419
- .where(i => i.label.toLowerCase().startsWith(buffer))
420
- .toArray();
421
- const activeMenuItem = this.activeMenuItem();
422
- if (matchedItems.length === 0) {
423
- return;
424
- }
425
- if (matchedItems.length === 1) {
426
- this.activeMenuItem.set(matchedItems[0]);
427
- return;
428
- }
429
- if (matchedItems.length > 1) {
430
- const currentIndex = activeMenuItem ? matchedItems.indexOf(activeMenuItem) : -1;
431
- const nextIndex = (currentIndex + 1) % matchedItems.length;
432
- this.activeMenuItem.set(matchedItems[nextIndex]);
433
- }
434
- }
435
- findItem(uid) {
436
- return this.#navigationItems().firstOrDefault(i => i.uid === uid) ?? null;
437
- }
438
- focusFirstItem() {
439
- const firstItem = this.#navigationItems().firstOrDefault();
440
- if (firstItem) {
441
- this.activeMenuItem.set(firstItem);
442
- }
443
- return firstItem;
444
- }
445
- handleArrowDownKey() {
446
- if (!this.activeMenuItem()) {
447
- const firstItem = this.#navigationItems().firstOrDefault();
448
- if (firstItem) {
449
- this.activeMenuItem.set(firstItem);
450
- }
451
- return firstItem;
452
- }
453
- const nextItems = this.#navigationItems().skipWhile(i => i !== this.activeMenuItem());
454
- const nextItem = nextItems.skip(1).firstOrDefault();
455
- if (nextItem) {
456
- this.activeMenuItem.set(nextItem);
457
- return nextItem;
458
- }
459
- const firstItem = this.#navigationItems().firstOrDefault();
460
- if (firstItem) {
461
- this.activeMenuItem.set(firstItem);
462
- }
463
- return firstItem;
464
- }
465
- handleArrowUpKey() {
466
- if (!this.activeMenuItem()) {
467
- const lastItem = this.#navigationItems().lastOrDefault();
468
- if (lastItem) {
469
- this.activeMenuItem.set(lastItem);
470
- }
471
- return lastItem;
472
- }
473
- const items = this.#navigationItems().takeWhile(i => i !== this.activeMenuItem());
474
- const previousItem = items.lastOrDefault();
475
- if (previousItem) {
476
- this.activeMenuItem.set(previousItem);
477
- return previousItem;
478
- }
479
- const lastItem = this.#navigationItems().lastOrDefault();
480
- if (lastItem) {
481
- this.activeMenuItem.set(lastItem);
482
- }
483
- return lastItem;
484
- }
485
- handleEndKey() {
486
- const lastItem = this.#navigationItems().lastOrDefault();
487
- if (lastItem) {
488
- this.activeMenuItem.set(lastItem);
489
- }
490
- }
491
- handleEnterKey() {
492
- const activeItem = this.activeMenuItem();
493
- if (activeItem?.disabled) {
494
- return;
495
- }
496
- if (activeItem && activeItem.items.length > 0) {
497
- const target = this.#host.nativeElement.querySelector('[data-active="true"]');
498
- if (target) {
499
- this.createSubmenu(target, true, activeItem);
500
- }
501
- }
502
- else if (activeItem) {
503
- const syntheticEvent = new MouseEvent("click", {
504
- bubbles: true,
505
- cancelable: true,
506
- composed: true
507
- });
508
- this.onItemClick(syntheticEvent, activeItem);
509
- }
510
- }
511
- handleEscapeKey() {
512
- this.closePopup();
513
- }
514
- handleHomeKey() {
515
- const firstItem = this.#navigationItems().firstOrDefault();
516
- if (firstItem) {
517
- this.activeMenuItem.set(firstItem);
518
- }
519
- }
520
- handleNavigationKey(event) {
521
- const isRtl = this.isRtl();
522
- const openKey = isRtl ? "ArrowLeft" : "ArrowRight";
523
- const closeKey = isRtl ? "ArrowRight" : "ArrowLeft";
524
- const forwardDir = isRtl ? "left" : "right";
525
- const backwardDir = isRtl ? "right" : "left";
526
- let item = null;
527
- if (event.key === "ArrowDown") {
528
- item = this.handleArrowDownKey();
529
- this.notifyNavigation(item, "down");
530
- }
531
- else if (event.key === closeKey) {
532
- this.closeSubmenu();
533
- if (this.#parentConfig.level === 0) {
534
- this.notifyNavigation(null, backwardDir);
535
- }
536
- }
537
- else if (event.key === openKey) {
538
- const result = this.openSubmenu();
539
- if (!result.hasChild) {
540
- this.notifyNavigation(item, forwardDir);
541
- }
542
- }
543
- else if (event.key === "ArrowUp") {
544
- item = this.handleArrowUpKey();
545
- this.notifyNavigation(item, "up");
546
- }
547
- else if (event.key === "End") {
548
- this.handleEndKey();
549
- }
550
- else if (event.key === "Enter" || event.key === " ") {
551
- event.preventDefault();
552
- this.handleEnterKey();
553
- }
554
- else if (event.key === "Escape") {
555
- this.handleEscapeKey();
556
- }
557
- else if (event.key === "Home") {
558
- this.handleHomeKey();
559
- }
560
- }
561
- handleTypeaheadKey(event) {
562
- this.#typeaheadKey$.next(event.key);
563
- }
564
- notifyNavigation(item, direction) {
565
- this.#parentConfig.navigate$.next({
566
- direction,
567
- item,
568
- level: this.#parentConfig.level
569
- });
570
- }
571
- onSubmenuPointerEnter() {
572
- // The pointer reached the open submenu: keep it, and its parent item highlighted.
573
- clearTimeout(this.#hoverTimer);
574
- const open = this.#openSubmenuItem();
575
- if (open) {
576
- this.activeMenuItem.set(open);
577
- }
578
- }
579
- openSubmenu() {
580
- const activeItem = this.activeMenuItem();
581
- if (!activeItem || activeItem.disabled) {
582
- return { item: null, hasChild: false };
583
- }
584
- const target = this.#host.nativeElement.querySelector('[data-active="true"]');
585
- if (target && activeItem.items.length > 0) {
586
- this.createSubmenu(target, true, activeItem);
587
- return { item: activeItem, hasChild: true };
588
- }
589
- if (activeItem && activeItem.items.length > 0) {
590
- return { item: activeItem, hasChild: true };
591
- }
592
- return { item: null, hasChild: false };
593
- }
594
- openSubmenuFromClick(item, target, viaKeyboard) {
595
- if (!target || (this.popupRef && this.#openSubmenuItem() === item)) {
596
- return;
597
- }
598
- this.activeMenuItem.set(item);
599
- this.createSubmenu(target, viaKeyboard, item);
600
- }
601
- reclaimFocus() {
602
- // Focus inside the closing submenu (or deeper) comes back to this menu.
603
- if (this.#closing) {
604
- return;
605
- }
606
- const active = this.#document.activeElement;
607
- if (active && !this.#host.nativeElement.contains(active) && active.closest("mona-popup-menu-list")) {
608
- this.#menuElement()?.focus();
609
- }
610
- }
611
- setKeyboardEvents() {
612
- const element = this.#menuElement();
613
- if (!element) {
614
- return;
615
- }
616
- fromEvent(element, "keydown")
617
- .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => {
618
- if (e.key === "Tab") {
619
- // Tab closes every menu and moves on from the trigger, as the APG menu button asks.
620
- this.#parentConfig.closeMenu({ tab: true });
621
- }
622
- else if (isNavigationKey(e.key)) {
623
- e.preventDefault();
624
- this.#typeaheadKey$.next("");
625
- this.handleNavigationKey(e);
626
- }
627
- else if (isTypeaheadKey(e.key, e)) {
628
- e.preventDefault();
629
- this.handleTypeaheadKey(e);
630
- }
631
- }))
632
- .subscribe();
633
- }
634
- setPopupCloseSubscription() {
635
- this.#parentConfig.parentClose$
636
- .pipe(takeUntilDestroyed(this.#destroyRef), tap(() => {
637
- this.#closing = true;
638
- this.closePopup();
639
- }))
640
- .subscribe();
641
- this.#childCloseRequest$
642
- .pipe(takeUntilDestroyed(this.#destroyRef), tap(() => {
643
- const activeItem = this.activeMenuItem();
644
- const isRtl = this.isRtl();
645
- this.notifyNavigation(activeItem, isRtl ? "right" : "left");
646
- this.closePopup();
647
- }))
648
- .subscribe();
649
- }
650
- setSubscriptions() {
651
- this.setKeyboardEvents();
652
- this.setPopupCloseSubscription();
653
- this.setTypeaheadSubscription();
654
- }
655
- setTypeaheadSubscription() {
656
- setupTypeahead(this.#typeaheadKey$)
657
- .pipe(takeUntilDestroyed(this.#destroyRef))
658
- .subscribe(buffer => this.cycleThroughMatchedItems(buffer));
659
- }
660
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
661
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PopupMenuListComponent, isStandalone: true, selector: "mona-popup-menu-list", host: { listeners: { "focusout": "onFocusOut($event)", "pointerenter": "onHostPointerEnter()" }, properties: { "class": "baseClasses()" } }, ngImport: i0, template: "<div\n role=\"menu\"\n [attr.tabindex]=\"0\"\n [attr.aria-orientation]=\"'vertical'\"\n [attr.aria-activedescendant]=\"activeMenuItem()?.uid\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"labelledBy\"\n [attr.id]=\"menuId()\"\n [class]=\"containerClasses()\">\n @for (group of menuItems(); track $index) {\n @if (group.title) {\n @let groupTemplate = group.items[0]?.groupTemplate?.() ?? popupGroupTemplate() ?? null;\n <div role=\"group\" [attr.aria-labelledby]=\"group.labelId\">\n <div [id]=\"group.labelId\" role=\"presentation\" [class]=\"groupHeaderClasses()\">\n @if (groupTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.title }\"></ng-container>\n } @else {\n <span>{{ group.title }}</span>\n }\n </div>\n <ng-container\n [ngTemplateOutlet]=\"itemsTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.items }\"></ng-container>\n </div>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"itemsTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.items }\"></ng-container>\n }\n }\n</div>\n\n<ng-template #itemsTemplate let-items>\n @for (item of asItems(items); track $index) {\n @if (item.separator) {\n <div role=\"separator\" class=\"bg-border my-1 h-px\"></div>\n } @else {\n @let iconTemplate = item.iconTemplate?.() ?? popupIconTemplate() ?? null;\n @let shortcutTemplate = item.shortcutTemplate?.() ?? popupShortcutTemplate() ?? null;\n @let textTemplate = item.textTemplate?.() ?? popupTextTemplate() ?? null;\n <div\n [attr.role]=\"item.checkable ? 'menuitemcheckbox' : item.radio ? 'menuitemradio' : 'menuitem'\"\n [attr.aria-checked]=\"item.checkable ? !!item.checked?.() : item.radio ? !!item.selected?.() : null\"\n [id]=\"item.uid\"\n (pointerenter)=\"onItemPointerEnter($event, item)\"\n (click)=\"onItemClick($event, item)\"\n [attr.data-active]=\"item === activeMenuItem()\"\n [attr.aria-disabled]=\"item.disabled\"\n [attr.aria-expanded]=\"item.items.length > 0 ? item === openSubmenuItem() : null\"\n [attr.aria-controls]=\"item === openSubmenuItem() ? submenuId() : null\"\n [attr.aria-haspopup]=\"item.items.length > 0 ? 'menu' : null\"\n [attr.aria-label]=\"textTemplate ? null : item.label || null\"\n [attr.data-disabled]=\"item.disabled\"\n [class]=\"menuItemClasses()\">\n @if (iconAreaVisible()) {\n <div [class]=\"iconContainerClasses()\">\n @if (!item.checkable && !item.radio) {\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n } @else if (item.checkable) {\n @if (item.checked?.()) {\n <svg lucideCheck [size]=\"14\"></svg>\n }\n } @else if (item.radio) {\n @if (item.selected?.()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-circle size-2 fill-current\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n </svg>\n }\n }\n </div>\n }\n <div class=\"flex-1\">\n @if (textTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"textTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n } @else {\n {{ item.label }}\n }\n </div>\n @if (item.items.length > 0) {\n @if (!item.checkable) {\n <div [class]=\"linkContainerClasses()\">\n <svg lucideChevronRight [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n </div>\n }\n } @else if (shortcutTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"shortcutTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </div>\n }\n }\n</ng-template>\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]" }] }); }
662
- }
663
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuListComponent, decorators: [{
664
- type: Component,
665
- args: [{ selector: "mona-popup-menu-list", imports: [NgTemplateOutlet, LucideChevronRight, LucideCheck], host: {
666
- "[class]": "baseClasses()",
667
- "(focusout)": "onFocusOut($event)",
668
- "(pointerenter)": "onHostPointerEnter()"
669
- }, template: "<div\n role=\"menu\"\n [attr.tabindex]=\"0\"\n [attr.aria-orientation]=\"'vertical'\"\n [attr.aria-activedescendant]=\"activeMenuItem()?.uid\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"labelledBy\"\n [attr.id]=\"menuId()\"\n [class]=\"containerClasses()\">\n @for (group of menuItems(); track $index) {\n @if (group.title) {\n @let groupTemplate = group.items[0]?.groupTemplate?.() ?? popupGroupTemplate() ?? null;\n <div role=\"group\" [attr.aria-labelledby]=\"group.labelId\">\n <div [id]=\"group.labelId\" role=\"presentation\" [class]=\"groupHeaderClasses()\">\n @if (groupTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.title }\"></ng-container>\n } @else {\n <span>{{ group.title }}</span>\n }\n </div>\n <ng-container\n [ngTemplateOutlet]=\"itemsTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.items }\"></ng-container>\n </div>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"itemsTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.items }\"></ng-container>\n }\n }\n</div>\n\n<ng-template #itemsTemplate let-items>\n @for (item of asItems(items); track $index) {\n @if (item.separator) {\n <div role=\"separator\" class=\"bg-border my-1 h-px\"></div>\n } @else {\n @let iconTemplate = item.iconTemplate?.() ?? popupIconTemplate() ?? null;\n @let shortcutTemplate = item.shortcutTemplate?.() ?? popupShortcutTemplate() ?? null;\n @let textTemplate = item.textTemplate?.() ?? popupTextTemplate() ?? null;\n <div\n [attr.role]=\"item.checkable ? 'menuitemcheckbox' : item.radio ? 'menuitemradio' : 'menuitem'\"\n [attr.aria-checked]=\"item.checkable ? !!item.checked?.() : item.radio ? !!item.selected?.() : null\"\n [id]=\"item.uid\"\n (pointerenter)=\"onItemPointerEnter($event, item)\"\n (click)=\"onItemClick($event, item)\"\n [attr.data-active]=\"item === activeMenuItem()\"\n [attr.aria-disabled]=\"item.disabled\"\n [attr.aria-expanded]=\"item.items.length > 0 ? item === openSubmenuItem() : null\"\n [attr.aria-controls]=\"item === openSubmenuItem() ? submenuId() : null\"\n [attr.aria-haspopup]=\"item.items.length > 0 ? 'menu' : null\"\n [attr.aria-label]=\"textTemplate ? null : item.label || null\"\n [attr.data-disabled]=\"item.disabled\"\n [class]=\"menuItemClasses()\">\n @if (iconAreaVisible()) {\n <div [class]=\"iconContainerClasses()\">\n @if (!item.checkable && !item.radio) {\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n } @else if (item.checkable) {\n @if (item.checked?.()) {\n <svg lucideCheck [size]=\"14\"></svg>\n }\n } @else if (item.radio) {\n @if (item.selected?.()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-circle size-2 fill-current\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n </svg>\n }\n }\n </div>\n }\n <div class=\"flex-1\">\n @if (textTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"textTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n } @else {\n {{ item.label }}\n }\n </div>\n @if (item.items.length > 0) {\n @if (!item.checkable) {\n <div [class]=\"linkContainerClasses()\">\n <svg lucideChevronRight [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n </div>\n }\n } @else if (shortcutTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"shortcutTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </div>\n }\n }\n</ng-template>\n" }]
670
- }], ctorParameters: () => [] });
671
-
672
- /** Context menu events that a menu opened for, so menus on ancestor targets leave them alone. */
673
- const handledContextMenuEvents = new WeakSet();
674
- class PopupMenuComponent {
675
- #destroyRef;
676
- #document;
677
- #menuItemClick$;
678
- #navigate$;
679
- #popupService;
680
- #destroyed;
681
- #open;
682
- #pendingInitialFocus;
683
- #suppressNextTrustedContextMenu;
684
- #triggerSubscription;
685
- constructor() {
686
- this.#destroyRef = inject(DestroyRef);
687
- this.#document = inject(DOCUMENT);
688
- this.#menuItemClick$ = new Subject();
689
- this.#navigate$ = new Subject();
690
- this.#popupService = inject(PopupService);
691
- this.#destroyed = false;
692
- this.#open = null;
693
- this.#pendingInitialFocus = null;
694
- this.#suppressNextTrustedContextMenu = false;
695
- this.#triggerSubscription = null;
696
- this.groupTemplateConfig = contentChild(PopupMenuGroupTemplateToken, { ...(ngDevMode ? { debugName: "groupTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
697
- this.iconTemplateConfig = contentChild(PopupMenuIconTemplateToken, { ...(ngDevMode ? { debugName: "iconTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
698
- this.nestedComponents = contentChildren(PopupMenuToken, { ...(ngDevMode ? { debugName: "nestedComponents" } : /* istanbul ignore next */ {}), descendants: false });
699
- this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, { ...(ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
700
- this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, { ...(ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
701
- this.menuItems = computed(() => {
702
- const inputItems = this.items();
703
- if (any(inputItems)) {
704
- const items = select(inputItems, i => Object.hasOwn(i, "uid") ? i : preparePopupMenuItems([i])[0]);
705
- return groupPopupMenuItems(items);
706
- }
707
- const items = this.nestedComponents().flatMap(i => i.getPopupMenuItem());
708
- return groupPopupMenuItems(items);
709
- }, /* @ts-ignore */
710
- ...(ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []));
711
- /**
712
- * @description The element to position the menu against, when it isn't the `target`.
713
- * Ignored when `openAtPointer` is set.
714
- */
715
- this.anchor = input(/* @ts-ignore */
716
- ...(ngDevMode ? [undefined, { debugName: "anchor" }] : /* istanbul ignore next */ []));
717
- /**
718
- * @description The point on the anchor that the menu attaches to.
719
- * Ignored when `openAtPointer` is set.
720
- */
721
- this.anchorConnectionPoint = input(/* @ts-ignore */
722
- ...(ngDevMode ? [undefined, { debugName: "anchorConnectionPoint" }] : /* istanbul ignore next */ []));
723
- /**
724
- * @description The accessible name of the root menu. Takes precedence over `aria-labelledby`.
725
- */
726
- this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
727
- /**
728
- * @description The ids of the elements that name the root menu. When neither this nor `aria-label` is set, the
729
- * menu is named by the target element if it has an id.
730
- */
731
- this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
732
- /**
733
- * @description The event that is emitted when the popup menu is closed.
734
- */
735
- // eslint-disable-next-line @angular-eslint/no-output-native -- renaming the output would break existing (close) bindings
736
- this.close = output();
737
- /**
738
- * @description The items to render in the popup menu.
739
- * If provided, it will override the menu items defined by projected menu item components.
740
- */
741
- this.items = input([], /* @ts-ignore */
742
- ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
743
- /**
744
- * @description The event that is emitted when a menu item is clicked.
745
- */
746
- this.menuClick = output();
747
- /**
748
- * @description The id of the popup menu's root element.
749
- */
750
- this.menuId = input("", { ...(ngDevMode ? { debugName: "menuId" } : /* istanbul ignore next */ {}), alias: "id" });
751
- /**
752
- * @description Sets the minimum width of the popup menu.
753
- * This will be applied to the root menu and all submenus.
754
- */
755
- this.minWidth = input(/* @ts-ignore */
756
- ...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
757
- /**
758
- * @description Emitted when an arrow key moves through the menu, or tries to leave it.
759
- */
760
- this.navigate = output();
761
- /**
762
- * @description The distance between the menu and its anchor.
763
- */
764
- this.offset = input(/* @ts-ignore */
765
- ...(ngDevMode ? [undefined, { debugName: "offset" }] : /* istanbul ignore next */ []));
766
- /**
767
- * @description The event that is emitted when the popup menu is opened.
768
- */
769
- this.open = output();
770
- /**
771
- * @description Opens the menu where the pointer is, instead of against the `anchor` or `target`. Opened from the
772
- * keyboard, it opens at the center of the target.
773
- */
774
- this.openAtPointer = input(false, /* @ts-ignore */
775
- ...(ngDevMode ? [{ debugName: "openAtPointer" }] : /* istanbul ignore next */ []));
776
- /**
777
- * @description The point on the menu that attaches to the anchor.
778
- * Ignored when `openAtPointer` is set.
779
- */
780
- this.popupConnectionPoint = input(/* @ts-ignore */
781
- ...(ngDevMode ? [undefined, { debugName: "popupConnectionPoint" }] : /* istanbul ignore next */ []));
782
- /**
783
- * @description Sets the border radius of the popup menu.
784
- * This will be applied to the root menu and all submenus.
785
- */
786
- this.rounded = input("medium", /* @ts-ignore */
787
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
788
- /**
789
- * @description Sets the size of the popup menu.
790
- * This will be applied to the root menu and all submenus.
791
- */
792
- this.size = input("medium", /* @ts-ignore */
793
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
794
- /**
795
- * @description The element that opens the menu. The menu is positioned against it unless `anchor` is set.
796
- */
797
- this.target = input.required(/* @ts-ignore */
798
- ...(ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []));
799
- /**
800
- * @description What opens the menu: a click on the target, a right-click on it, or `"none"` to open it only
801
- * through `openMenu()`.
802
- */
803
- this.trigger = input("click", /* @ts-ignore */
804
- ...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
805
- /**
806
- * @description Extra classes for the menu's popup.
807
- */
808
- this.userClass = input(undefined, { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class",
809
- transform: value => classInputToClass(value) });
810
- /**
811
- * @description Sets the width of the popup menu.
812
- * This will be applied to the root menu and all submenus.
813
- */
814
- this.width = input(/* @ts-ignore */
815
- ...(ngDevMode ? [undefined, { debugName: "width" }] : /* istanbul ignore next */ []));
816
- this.setMenuItemClickSubscription();
817
- this.setNavigationSubscription();
818
- // Listen on the current target for the current trigger, and move the listener when either changes.
819
- effect(() => {
820
- const target = this.#element(this.target());
821
- const trigger = this.trigger();
822
- untracked(() => {
823
- this.#triggerSubscription?.unsubscribe();
824
- this.#triggerSubscription = target ? this.setTriggerSubscription(target, trigger) : null;
825
- });
826
- });
827
- this.#destroyRef.onDestroy(() => {
828
- this.#destroyed = true;
829
- this.#triggerSubscription?.unsubscribe();
830
- const open = this.#open;
831
- if (open) {
832
- open.restoreFocus = false;
833
- open.ref?.close();
834
- }
835
- });
836
- }
837
- /**
838
- * @description Keeps focus where it is when the open menu closes, instead of returning it to the element that
839
- * had it before the menu opened. Used when another menu takes over, as in a menubar.
840
- */
841
- clearFocusRestoration() {
842
- if (this.#open) {
843
- this.#open.restoreFocus = false;
844
- }
845
- }
846
- /**
847
- * @description Closes the menu. Focus returns to the element that had it before the menu opened, unless focus
848
- * has already moved elsewhere.
849
- */
850
- closeMenu() {
851
- this.#open?.ref?.close();
852
- }
853
- /**
854
- * @description Opens the menu, as if the target had been clicked.
855
- * @param viaContextMenuKey Whether the menu opens from the ContextMenu key or Shift+F10.
856
- */
857
- openMenu(viaContextMenuKey = false) {
858
- const targetElement = this.#element(this.target());
859
- if (!targetElement) {
860
- return;
861
- }
862
- const center = targetElement.getBoundingClientRect();
863
- // Create a fake event to pass the center of the target element as the mouse position.
864
- // This is useful when openAtPointer is true, but we want to open the menu via keyboard
865
- // or some other non-mouse event.
866
- if (viaContextMenuKey) {
867
- const contextMenuEvent = new MouseEvent("contextmenu", {
868
- bubbles: true,
869
- cancelable: true,
870
- clientX: center.left + center.width / 2,
871
- clientY: center.top + center.height / 2,
872
- button: -1
873
- });
874
- const ownerDocument = targetElement.ownerDocument;
875
- const suppressNativeContextMenu = (nativeEvent) => {
876
- if (nativeEvent.isTrusted) {
877
- nativeEvent.preventDefault();
878
- ownerDocument.removeEventListener("contextmenu", suppressNativeContextMenu, { capture: true });
879
- }
880
- };
881
- this.#suppressNextTrustedContextMenu = true;
882
- ownerDocument.addEventListener("contextmenu", suppressNativeContextMenu, { capture: true });
883
- targetElement.dispatchEvent(contextMenuEvent);
884
- rxTimeout(this.#destroyRef, () => {
885
- this.#suppressNextTrustedContextMenu = false;
886
- ownerDocument.removeEventListener("contextmenu", suppressNativeContextMenu, { capture: true });
887
- }, 500);
888
- return;
889
- }
890
- const event = new MouseEvent(this.trigger(), { bubbles: true, cancelable: true });
891
- targetElement.dispatchEvent(event);
892
- }
893
- /**
894
- * @description Opens the menu as the keyboard does, with its first (or last) item highlighted.
895
- * @param viaContextMenuKey Whether the menu opens from the ContextMenu key or Shift+F10.
896
- * @param focus The item to highlight: "first" (ArrowDown, Enter, Space) or "last" (ArrowUp).
897
- */
898
- openMenuViaKeyboard(viaContextMenuKey = false, focus = "first") {
899
- this.#pendingInitialFocus = focus;
900
- this.openMenu(viaContextMenuKey);
901
- this.#pendingInitialFocus = null;
902
- }
903
- /**
904
- * @deprecated Focus now returns to the element that had it before the menu opened after every close.
905
- */
906
- setRestoreFocusForKeyboard() {
907
- if (this.#open) {
908
- this.#open.restoreFocus = true;
909
- }
910
- }
911
- #element(value) {
912
- const element = value instanceof ElementRef ? value.nativeElement : value;
913
- return element instanceof HTMLElement ? element : null;
914
- }
915
- closeFromList(state, options) {
916
- if (this.#open !== state || !state.ref) {
917
- return;
918
- }
919
- if (options.focusLeftTo) {
920
- // Focus moved out of the menus. A move to the trigger is the trigger's own business (it toggles).
921
- const target = this.#element(this.target());
922
- const anchor = this.#element(this.anchor());
923
- if (target?.contains(options.focusLeftTo) || anchor?.contains(options.focusLeftTo)) {
924
- return;
925
- }
926
- state.restoreFocus = false;
927
- }
928
- if (options.tab) {
929
- // Tab leaves the menu as it would leave the trigger: focus the trigger now, before the browser moves
930
- // focus on from it.
931
- state.restoreFocus = false;
932
- state.returnFocusTo?.focus();
933
- }
934
- state.ref.close();
935
- }
936
- createMenu(event, state) {
937
- const anchor = this.getPopupAnchor(event);
938
- const anchorConnectionPoint = this.openAtPointer() ? undefined : this.anchorConnectionPoint();
939
- const targetId = this.#element(this.target())?.id ?? "";
940
- const data = {
941
- ariaLabel: this.ariaLabel(),
942
- closeMenu: options => this.closeFromList(state, options),
943
- initialFocus: this.#pendingInitialFocus,
944
- isRoot: true,
945
- items: this.menuItems,
946
- labelledBy: this.ariaLabelledBy() || targetId || null,
947
- level: 0,
948
- menuId: this.menuId(),
949
- menuItemClick$: this.#menuItemClick$,
950
- minWidth: computed(() => toCssValue(this.minWidth()) ?? null),
951
- navigate$: this.#navigate$,
952
- parentClose$: state.close$,
953
- popupGroupTemplate: computed(() => this.groupTemplateConfig()?.template ?? null),
954
- popupIconTemplate: computed(() => this.iconTemplateConfig()?.template ?? null),
955
- popupShortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
956
- popupTextTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
957
- rounded: computed(() => this.rounded()),
958
- size: computed(() => this.size()),
959
- width: computed(() => toCssValue(this.width()) ?? null)
960
- };
961
- return this.#popupService.create({
962
- anchor,
963
- anchorConnectionPoint,
964
- closeOnScroll: true,
965
- content: PopupMenuListComponent,
966
- data,
967
- minWidth: toCssValue(this.minWidth()),
968
- offset: this.offset(),
969
- popupClass: this.userClass(),
970
- popupConnectionPoint: this.openAtPointer() ? undefined : this.popupConnectionPoint(),
971
- restoreFocus: false,
972
- width: toCssValue(this.width())
973
- });
974
- }
975
- getPopupAnchor(event) {
976
- const anchorElement = this.anchor();
977
- const targetElement = this.target();
978
- const targetInput = anchorElement ?? targetElement;
979
- const atPointer = this.openAtPointer();
980
- const actualTargetElement = targetInput instanceof ElementRef ? targetInput.nativeElement : targetInput;
981
- let anchor;
982
- if (atPointer) {
983
- if (event.button < 0) {
984
- const rect = actualTargetElement.getBoundingClientRect();
985
- anchor = { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
986
- }
987
- else {
988
- anchor = { x: event.x, y: event.y };
989
- }
990
- }
991
- else {
992
- anchor = actualTargetElement;
993
- }
994
- return anchor;
995
- }
996
- openFor(event, targetElement) {
997
- const opener = this.#document.activeElement;
998
- const hasOpener = !!opener && opener !== this.#document.body;
999
- // Focus in another menu (a menubar moving to the next menu) leaves with that menu, so it can't come back there.
1000
- const openerInMenu = hasOpener && !!opener.closest("mona-popup-menu-list");
1001
- const targetFocusable = targetElement.tabIndex >= 0 || (openerInMenu && targetElement.hasAttribute("tabindex"));
1002
- // A menu opened from the keyboard goes back to the element the keys came from (a split button's main button).
1003
- const viaKeyboard = this.#pendingInitialFocus !== null;
1004
- let returnFocusTo = null;
1005
- if (hasOpener && !openerInMenu && (viaKeyboard || targetElement.contains(opener))) {
1006
- returnFocusTo = opener;
1007
- }
1008
- else if (targetFocusable) {
1009
- returnFocusTo = targetElement;
1010
- }
1011
- else if (hasOpener && !openerInMenu) {
1012
- returnFocusTo = opener;
1013
- }
1014
- const state = { close$: new Subject(), ref: null, restoreFocus: true, returnFocusTo };
1015
- const ref = this.createMenu(event, state);
1016
- state.ref = ref;
1017
- this.#open = state;
1018
- this.open.emit();
1019
- ref.beforeClose.pipe(takeUntil(ref.closed)).subscribe(e => {
1020
- // A menu closed because its component is destroyed has no one left to tell.
1021
- if (this.#destroyed) {
1022
- return;
1023
- }
1024
- const popupCloseEvent = e.result;
1025
- const closeEvent = new PopupMenuCloseEvent(popupCloseEvent);
1026
- this.close.emit(closeEvent);
1027
- if (closeEvent.isDefaultPrevented()) {
1028
- e.preventDefault();
1029
- }
1030
- });
1031
- ref.closeStart.pipe(take(1)).subscribe(() => {
1032
- state.close$.next();
1033
- // A menu that is closing is closed for the trigger: the next trigger opens a new one.
1034
- if (this.#open === state) {
1035
- this.#open = null;
1036
- }
1037
- });
1038
- ref.closed.pipe(take(1)).subscribe(() => {
1039
- state.close$.complete();
1040
- if (this.#open === state) {
1041
- this.#open = null;
1042
- }
1043
- // Return focus unless another menu opened meanwhile, or focus has moved on.
1044
- if (state.restoreFocus && this.#open === null) {
1045
- this.restoreFocus(state.returnFocusTo);
1046
- }
1047
- });
1048
- }
1049
- restoreFocus(element) {
1050
- if (!element || !element.isConnected) {
1051
- return;
1052
- }
1053
- const active = this.#document.activeElement;
1054
- if (active && active !== this.#document.body && !active.closest("mona-popup-menu-list")) {
1055
- return;
1056
- }
1057
- element.focus();
1058
- }
1059
- setMenuItemClickSubscription() {
1060
- this.#menuItemClick$
1061
- .pipe(takeUntilDestroyed(this.#destroyRef), tap(event => {
1062
- this.menuClick.emit(event);
1063
- if (event.isDefaultPrevented()) {
1064
- return;
1065
- }
1066
- const item = event.item;
1067
- if (isMenuOwnedCheckState(item)) {
1068
- item.checked.set(event.checked === true);
1069
- }
1070
- this.closeMenu();
1071
- }))
1072
- .subscribe();
1073
- }
1074
- setNavigationSubscription() {
1075
- this.#navigate$
1076
- .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => this.navigate.emit(e)))
1077
- .subscribe();
1078
- }
1079
- setTriggerSubscription(targetElement, trigger) {
1080
- return fromEvent(targetElement, trigger)
1081
- .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => e.preventDefault()))
1082
- .subscribe(e => {
1083
- if (e.isTrusted && this.#suppressNextTrustedContextMenu) {
1084
- this.#suppressNextTrustedContextMenu = false;
1085
- return;
1086
- }
1087
- // A context menu on a nested target already opened for this event.
1088
- if (trigger === "contextmenu" && handledContextMenuEvents.has(e)) {
1089
- return;
1090
- }
1091
- const open = this.#open;
1092
- if (open) {
1093
- if (trigger !== "contextmenu" && !this.openAtPointer()) {
1094
- // The trigger toggles the menu.
1095
- open.ref?.close();
1096
- return;
1097
- }
1098
- // A context menu opens again at the new point; focus stays with the new menu.
1099
- open.restoreFocus = false;
1100
- open.ref?.close();
1101
- this.#open = null;
1102
- }
1103
- if (trigger === "contextmenu") {
1104
- handledContextMenuEvents.add(e);
1105
- }
1106
- this.openFor(e, targetElement);
1107
- });
1108
- }
1109
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1110
- 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 }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", 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 }, openAtPointer: { classPropertyName: "openAtPointer", publicName: "openAtPointer", isSignal: true, isRequired: false, transformFunction: null }, popupConnectionPoint: { classPropertyName: "popupConnectionPoint", publicName: "popupConnectionPoint", 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 }, userClass: { classPropertyName: "userClass", publicName: "class", 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" }, host: { properties: { "attr.aria-label": "null", "attr.aria-labelledby": "null" } }, 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 }); }
1111
- }
1112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuComponent, decorators: [{
1113
- type: Component,
1114
- args: [{
1115
- selector: "mona-popup-menu",
1116
- template: "",
1117
- host: {
1118
- // The name goes to the menu when it opens. The host has no role, which may not carry one.
1119
- "[attr.aria-label]": "null",
1120
- "[attr.aria-labelledby]": "null"
1121
- }
1122
- }]
1123
- }], ctorParameters: () => [], propDecorators: { groupTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuGroupTemplateToken), { ...{
1124
- descendants: false
1125
- }, isSignal: true }] }], iconTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuIconTemplateToken), { ...{
1126
- descendants: false
1127
- }, isSignal: true }] }], nestedComponents: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PopupMenuToken), { ...{ descendants: false }, isSignal: true }] }], shortcutTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), { ...{
1128
- descendants: false
1129
- }, isSignal: true }] }], textTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuTextTemplateToken), { ...{
1130
- descendants: false
1131
- }, isSignal: true }] }], anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchor", required: false }] }], anchorConnectionPoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchorConnectionPoint", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", 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"] }], openAtPointer: [{ type: i0.Input, args: [{ isSignal: true, alias: "openAtPointer", required: false }] }], popupConnectionPoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupConnectionPoint", 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 }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
1132
-
1133
- class PopupMenuCheckboxItemComponent {
1134
- constructor() {
1135
- this.#click$ = new Subject();
1136
- this.#destroyRef = inject(DestroyRef);
1137
- // One id per item for its lifetime, so the menu keeps track of it when the items are rebuilt.
1138
- this.#uid = createElementControlId();
1139
- this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, { ...(ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1140
- this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, { ...(ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1141
- /**
1142
- * @description The checked state of the menu item. Activating the item toggles it (unless its `menuClick` is
1143
- * prevented) and emits `checkedChange`, so it works with or without a two-way binding.
1144
- */
1145
- this.checked = model(false, /* @ts-ignore */
1146
- ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
1147
- /**
1148
- * @description Sets the disabled state of the menu item.
1149
- */
1150
- this.disabled = input(false, /* @ts-ignore */
1151
- ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1152
- /**
1153
- * @description The text of the menu item.
1154
- */
1155
- this.label = input("", /* @ts-ignore */
1156
- ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1157
- /**
1158
- * @description The click event of the menu item.
1159
- * Emits when the menu item is selected by keyboard or mouse.
1160
- */
1161
- this.menuClick = output();
1162
- this.origin = PopupMenuOrigin.Popup;
1163
- this.type = PopupMenuItemType.CheckboxMenuItem;
1164
- /**
1165
- * @description A value that identifies the item. It's the `value` of the item's `menuClick` events.
1166
- */
1167
- this.value = input(/* @ts-ignore */
1168
- ...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
1169
- }
1170
- #click$;
1171
- #destroyRef;
1172
- // One id per item for its lifetime, so the menu keeps track of it when the items are rebuilt.
1173
- #uid;
1174
- getPopupMenuItem() {
1175
- return [
1176
- {
1177
- checkable: true,
1178
- checked: computed(() => this.checked()),
1179
- click$: this.#click$,
1180
- disabled: this.disabled(),
1181
- group: Symbol(),
1182
- groupTemplate: null,
1183
- iconTemplate: null,
1184
- items: [],
1185
- label: this.label(),
1186
- shortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
1187
- textTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
1188
- uid: this.#uid,
1189
- value: computed(() => this.value())
1190
- }
1191
- ];
1192
- }
1193
- ngOnInit() {
1194
- this.setSubscriptions();
1195
- }
1196
- setSubscriptions() {
1197
- this.#click$
1198
- .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => {
1199
- this.menuClick.emit(e);
1200
- if (!e.isDefaultPrevented()) {
1201
- this.checked.set(e.checked === true);
1202
- }
1203
- }))
1204
- .subscribe();
1205
- }
1206
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuCheckboxItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1207
- 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 }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", menuClick: "menuClick" }, providers: [
1208
- {
1209
- provide: PopupMenuToken,
1210
- useExisting: forwardRef(() => PopupMenuCheckboxItemComponent)
1211
- }
1212
- ], queries: [{ propertyName: "shortcutTemplateConfig", first: true, predicate: PopupMenuShortcutTemplateToken, isSignal: true }, { propertyName: "textTemplateConfig", first: true, predicate: PopupMenuTextTemplateToken, isSignal: true }], ngImport: i0, template: "", isInline: true }); }
1213
- }
1214
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuCheckboxItemComponent, decorators: [{
1215
- type: Component,
1216
- args: [{
1217
- selector: "mona-popup-menu-checkbox-item",
1218
- template: "",
1219
- providers: [
1220
- {
1221
- provide: PopupMenuToken,
1222
- useExisting: forwardRef(() => PopupMenuCheckboxItemComponent)
1223
- }
1224
- ]
1225
- }]
1226
- }], propDecorators: { shortcutTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), { ...{
1227
- descendants: false
1228
- }, isSignal: true }] }], textTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuTextTemplateToken), { ...{
1229
- descendants: false
1230
- }, isSignal: true }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { 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"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
1231
-
1232
- class PopupMenuItemComponent {
1233
- constructor() {
1234
- this.#click$ = new Subject();
1235
- this.#destroyRef = inject(DestroyRef);
1236
- // One id per item for its lifetime, so the menu keeps track of it when the items are rebuilt.
1237
- this.#uid = createElementControlId();
1238
- this.iconTemplateConfig = contentChild(PopupMenuIconTemplateToken, { ...(ngDevMode ? { debugName: "iconTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1239
- this.items = contentChildren(PopupMenuToken, { ...(ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {}), descendants: false });
1240
- this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, { ...(ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1241
- this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, { ...(ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1242
- /**
1243
- * @description Sets the disabled state of the menu item.
1244
- */
1245
- this.disabled = input(false, /* @ts-ignore */
1246
- ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1247
- /**
1248
- * @description The text of the menu item.
1249
- */
1250
- this.label = input("", /* @ts-ignore */
1251
- ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1252
- /**
1253
- * @description The click event of the menu item.
1254
- * Emits when the menu item is selected by keyboard or mouse.
1255
- */
1256
- this.menuClick = output();
1257
- this.origin = PopupMenuOrigin.Popup;
1258
- this.type = PopupMenuItemType.MenuItem;
1259
- /**
1260
- * @description A value that identifies the item. It's the `value` of the item's `menuClick` events, so
1261
- * handlers don't depend on the label's text.
1262
- */
1263
- this.value = input(/* @ts-ignore */
1264
- ...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
1265
- }
1266
- #click$;
1267
- #destroyRef;
1268
- // One id per item for its lifetime, so the menu keeps track of it when the items are rebuilt.
1269
- #uid;
1270
- getPopupMenuItem() {
1271
- return [
1272
- {
1273
- click$: this.#click$,
1274
- disabled: this.disabled(),
1275
- group: Symbol(),
1276
- groupTemplate: null,
1277
- iconTemplate: computed(() => this.iconTemplateConfig()?.template ?? null),
1278
- items: selectMany(this.items().map(item => item.getPopupMenuItem()), i => i).toArray(),
1279
- label: this.label(),
1280
- shortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
1281
- textTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
1282
- uid: this.#uid,
1283
- value: computed(() => this.value())
1284
- }
1285
- ];
1286
- }
1287
- ngOnInit() {
1288
- this.setSubscriptions();
1289
- }
1290
- setSubscriptions() {
1291
- this.#click$
1292
- .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => this.menuClick.emit(e)))
1293
- .subscribe();
1294
- }
1295
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1296
- 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 }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { menuClick: "menuClick" }, providers: [
1297
- {
1298
- provide: PopupMenuToken,
1299
- useExisting: forwardRef(() => PopupMenuItemComponent)
1300
- }
1301
- ], 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 }); }
1302
- }
1303
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuItemComponent, decorators: [{
1304
- type: Component,
1305
- args: [{
1306
- selector: "mona-popup-menu-item",
1307
- template: "",
1308
- providers: [
1309
- {
1310
- provide: PopupMenuToken,
1311
- useExisting: forwardRef(() => PopupMenuItemComponent)
1312
- }
1313
- ]
1314
- }]
1315
- }], propDecorators: { iconTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuIconTemplateToken), { ...{
1316
- descendants: false
1317
- }, isSignal: true }] }], items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PopupMenuToken), { ...{ descendants: false }, isSignal: true }] }], shortcutTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), { ...{
1318
- descendants: false
1319
- }, isSignal: true }] }], textTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuTextTemplateToken), { ...{
1320
- descendants: false
1321
- }, 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: false }] }] } });
1322
-
1323
- class PopupMenuGroupComponent {
1324
- constructor() {
1325
- // One key per group: consecutive items with it form the group, and its description is the title.
1326
- this.#groupKey = computed(() => Symbol(this.title() ?? ""), /* @ts-ignore */
1327
- ...(ngDevMode ? [{ debugName: "#groupKey" }] : /* istanbul ignore next */ []));
1328
- this.groupTemplateConfig = contentChild(PopupMenuGroupTemplateToken, { ...(ngDevMode ? { debugName: "groupTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1329
- this.items = contentChildren(PopupMenuToken, { ...(ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {}), descendants: false });
1330
- this.origin = PopupMenuOrigin.Popup;
1331
- /**
1332
- * @description Sets the title of the menu group.
1333
- */
1334
- this.title = input(/* @ts-ignore */
1335
- ...(ngDevMode ? [undefined, { debugName: "title" }] : /* istanbul ignore next */ []));
1336
- this.type = PopupMenuItemType.MenuGroup;
1337
- }
1338
- // One key per group: consecutive items with it form the group, and its description is the title.
1339
- #groupKey;
1340
- getPopupMenuItem() {
1341
- const group = this.#groupKey();
1342
- const menuItems = this.items().map(i => i.getPopupMenuItem().map(item => ({
1343
- ...item,
1344
- group,
1345
- groupTemplate: computed(() => this.groupTemplateConfig()?.template ?? null)
1346
- })));
1347
- return selectMany(menuItems, i => i).toArray();
1348
- }
1349
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1350
- 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: false, transformFunction: null } }, providers: [
1351
- {
1352
- provide: PopupMenuToken,
1353
- useExisting: forwardRef(() => PopupMenuGroupComponent)
1354
- }
1355
- ], queries: [{ propertyName: "groupTemplateConfig", first: true, predicate: PopupMenuGroupTemplateToken, isSignal: true }, { propertyName: "items", predicate: PopupMenuToken, isSignal: true }], ngImport: i0, template: ``, isInline: true }); }
1356
- }
1357
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuGroupComponent, decorators: [{
1358
- type: Component,
1359
- args: [{
1360
- selector: "mona-popup-menu-group",
1361
- template: ``,
1362
- providers: [
1363
- {
1364
- provide: PopupMenuToken,
1365
- useExisting: forwardRef(() => PopupMenuGroupComponent)
1366
- }
1367
- ]
1368
- }]
1369
- }], propDecorators: { groupTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuGroupTemplateToken), { ...{
1370
- descendants: false
1371
- }, isSignal: true }] }], items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PopupMenuToken), { ...{ descendants: false }, isSignal: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }] } });
1372
-
1373
- class PopupMenuRadioGroupComponent {
1374
- constructor() {
1375
- this.#click$ = new Subject();
1376
- this.#destroyRef = inject(DestroyRef);
1377
- // One key per group: consecutive items with it form the group, and its description is the title.
1378
- this.#groupKey = computed(() => Symbol(this.title()), /* @ts-ignore */
1379
- ...(ngDevMode ? [{ debugName: "#groupKey" }] : /* istanbul ignore next */ []));
1380
- // The radio items' own click subjects, so their `menuClick` runs before the group selects.
1381
- this.#itemClicks = new WeakMap();
1382
- this.groupTemplateConfig = contentChild(PopupMenuGroupTemplateToken, { ...(ngDevMode ? { debugName: "groupTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1383
- this.items = contentChildren(PopupMenuRadioItemToken, { ...(ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {}), descendants: false });
1384
- this.origin = PopupMenuOrigin.Popup;
1385
- /**
1386
- * @description The title of the radio group.
1387
- */
1388
- this.title = input("", /* @ts-ignore */
1389
- ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
1390
- this.type = PopupMenuItemType.RadioGroup;
1391
- /**
1392
- * @description The value of the selected radio item.
1393
- */
1394
- this.value = model("", /* @ts-ignore */
1395
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
1396
- }
1397
- #click$;
1398
- #destroyRef;
1399
- // One key per group: consecutive items with it form the group, and its description is the title.
1400
- #groupKey;
1401
- // The radio items' own click subjects, so their `menuClick` runs before the group selects.
1402
- #itemClicks;
1403
- getPopupMenuItem() {
1404
- const group = this.#groupKey();
1405
- const menuItems = this.items().map(i => i.getPopupMenuItem().map(item => {
1406
- const groupItem = {
1407
- ...item,
1408
- click$: this.#click$,
1409
- group,
1410
- groupTemplate: computed(() => this.groupTemplateConfig()?.template ?? null),
1411
- radio: true,
1412
- selected: computed(() => item.value?.() === this.value())
1413
- };
1414
- if (item.click$) {
1415
- this.#itemClicks.set(groupItem, item.click$);
1416
- }
1417
- return groupItem;
1418
- }));
1419
- return selectMany(menuItems, i => i).toArray();
1420
- }
1421
- ngOnInit() {
1422
- this.setSubscription();
1423
- }
1424
- setSubscription() {
1425
- this.#click$
1426
- .pipe(takeUntilDestroyed(this.#destroyRef), filter(e => e.item.radio == true), tap(event => {
1427
- this.#itemClicks.get(event.item)?.next(event);
1428
- if (event.isDefaultPrevented()) {
1429
- return;
1430
- }
1431
- const value = event.item.value?.();
1432
- if (typeof value === "string") {
1433
- this.value.set(value);
1434
- }
1435
- }))
1436
- .subscribe();
1437
- }
1438
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuRadioGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1439
- 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: [
1440
- {
1441
- provide: PopupMenuToken,
1442
- useExisting: forwardRef(() => PopupMenuRadioGroupComponent)
1443
- }
1444
- ], queries: [{ propertyName: "groupTemplateConfig", first: true, predicate: PopupMenuGroupTemplateToken, isSignal: true }, { propertyName: "items", predicate: PopupMenuRadioItemToken, isSignal: true }], ngImport: i0, template: "", isInline: true }); }
1445
- }
1446
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuRadioGroupComponent, decorators: [{
1447
- type: Component,
1448
- args: [{
1449
- selector: "mona-popup-menu-radio-group",
1450
- template: "",
1451
- providers: [
1452
- {
1453
- provide: PopupMenuToken,
1454
- useExisting: forwardRef(() => PopupMenuRadioGroupComponent)
1455
- }
1456
- ]
1457
- }]
1458
- }], propDecorators: { groupTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuGroupTemplateToken), { ...{
1459
- descendants: false
1460
- }, 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"] }] } });
1461
-
1462
- class PopupMenuRadioItemComponent {
1463
- constructor() {
1464
- this.#click$ = new Subject();
1465
- this.#destroyRef = inject(DestroyRef);
1466
- // One id per item for its lifetime, so the menu keeps track of it when the items are rebuilt.
1467
- this.#uid = createElementControlId();
1468
- this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, { ...(ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1469
- this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, { ...(ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {}), descendants: false });
1470
- /**
1471
- * @description Sets the disabled state of the menu item.
1472
- */
1473
- this.disabled = input(false, /* @ts-ignore */
1474
- ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1475
- /**
1476
- * @description The text of the menu item.
1477
- */
1478
- this.label = input("", /* @ts-ignore */
1479
- ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1480
- /**
1481
- * @description The click event of the menu item.
1482
- * Emits when the menu item is selected by keyboard or mouse, before the radio group selects it. Preventing it
1483
- * keeps the group's value and the menu open.
1484
- */
1485
- this.menuClick = output();
1486
- this.origin = PopupMenuOrigin.Popup;
1487
- this.type = PopupMenuItemType.RadioItem;
1488
- /**
1489
- * @description The value of the radio item.
1490
- */
1491
- this.value = input.required(/* @ts-ignore */
1492
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
1493
- }
1494
- #click$;
1495
- #destroyRef;
1496
- // One id per item for its lifetime, so the menu keeps track of it when the items are rebuilt.
1497
- #uid;
1498
- getPopupMenuItem() {
1499
- return [
1500
- {
1501
- click$: this.#click$,
1502
- disabled: this.disabled(),
1503
- group: Symbol(),
1504
- groupTemplate: null,
1505
- iconTemplate: null,
1506
- items: [],
1507
- label: this.label(),
1508
- radio: true,
1509
- shortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
1510
- textTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
1511
- uid: this.#uid,
1512
- value: computed(() => this.value())
1513
- }
1514
- ];
1515
- }
1516
- ngOnInit() {
1517
- this.setSubscription();
1518
- }
1519
- setSubscription() {
1520
- this.#click$
1521
- .pipe(takeUntilDestroyed(this.#destroyRef), tap(e => this.menuClick.emit(e)))
1522
- .subscribe();
1523
- }
1524
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuRadioItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1525
- 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: [
1526
- {
1527
- provide: PopupMenuToken,
1528
- useExisting: forwardRef(() => PopupMenuRadioItemComponent)
1529
- },
1530
- {
1531
- provide: PopupMenuRadioItemToken,
1532
- useExisting: forwardRef(() => PopupMenuRadioItemComponent)
1533
- }
1534
- ], queries: [{ propertyName: "shortcutTemplateConfig", first: true, predicate: PopupMenuShortcutTemplateToken, isSignal: true }, { propertyName: "textTemplateConfig", first: true, predicate: PopupMenuTextTemplateToken, isSignal: true }], ngImport: i0, template: "", isInline: true }); }
1535
- }
1536
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuRadioItemComponent, decorators: [{
1537
- type: Component,
1538
- args: [{
1539
- selector: "mona-popup-menu-radio-item",
1540
- template: "",
1541
- providers: [
1542
- {
1543
- provide: PopupMenuToken,
1544
- useExisting: forwardRef(() => PopupMenuRadioItemComponent)
1545
- },
1546
- {
1547
- provide: PopupMenuRadioItemToken,
1548
- useExisting: forwardRef(() => PopupMenuRadioItemComponent)
1549
- }
1550
- ]
1551
- }]
1552
- }], propDecorators: { shortcutTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), { ...{
1553
- descendants: false
1554
- }, isSignal: true }] }], textTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuTextTemplateToken), { ...{
1555
- descendants: false
1556
- }, 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 }] }] } });
1557
-
1558
- class PopupMenuSeparatorComponent {
1559
- constructor() {
1560
- this.origin = PopupMenuOrigin.Popup;
1561
- this.type = PopupMenuItemType.Separator;
1562
- }
1563
- getPopupMenuItem() {
1564
- return [
1565
- {
1566
- disabled: true,
1567
- group: Symbol(),
1568
- groupTemplate: null,
1569
- iconTemplate: null,
1570
- items: [],
1571
- label: "",
1572
- separator: true,
1573
- shortcutTemplate: null,
1574
- textTemplate: null,
1575
- uid: ""
1576
- }
1577
- ];
1578
- }
1579
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuSeparatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1580
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: PopupMenuSeparatorComponent, isStandalone: true, selector: "mona-popup-menu-separator", providers: [
1581
- {
1582
- provide: PopupMenuToken,
1583
- useExisting: forwardRef(() => PopupMenuSeparatorComponent)
1584
- }
1585
- ], ngImport: i0, template: "", isInline: true }); }
1586
- }
1587
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuSeparatorComponent, decorators: [{
1588
- type: Component,
1589
- args: [{
1590
- selector: "mona-popup-menu-separator",
1591
- template: "",
1592
- providers: [
1593
- {
1594
- provide: PopupMenuToken,
1595
- useExisting: forwardRef(() => PopupMenuSeparatorComponent)
1596
- }
1597
- ]
1598
- }]
1599
- }] });
1600
-
1601
- class PopupMenuGroupTemplateDirective {
1602
- constructor() {
1603
- this.origin = PopupMenuTemplateOrigin.Popup;
1604
- this.template = inject(TemplateRef);
1605
- this.type = PopupMenuTemplateType.Group;
1606
- }
1607
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuGroupTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1608
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PopupMenuGroupTemplateDirective, isStandalone: true, selector: "ng-template[monaPopupMenuGroupTemplate]", providers: [
1609
- {
1610
- provide: PopupMenuGroupTemplateToken,
1611
- useExisting: forwardRef(() => PopupMenuGroupTemplateDirective)
1612
- }
1613
- ], ngImport: i0 }); }
1614
- }
1615
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuGroupTemplateDirective, decorators: [{
1616
- type: Directive,
1617
- args: [{
1618
- selector: "ng-template[monaPopupMenuGroupTemplate]",
1619
- providers: [
1620
- {
1621
- provide: PopupMenuGroupTemplateToken,
1622
- useExisting: forwardRef(() => PopupMenuGroupTemplateDirective)
1623
- }
1624
- ]
1625
- }]
1626
- }] });
1627
-
1628
- class PopupMenuIconTemplateDirective {
1629
- constructor() {
1630
- this.origin = PopupMenuTemplateOrigin.Popup;
1631
- this.template = inject(TemplateRef);
1632
- this.type = PopupMenuTemplateType.Icon;
1633
- }
1634
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuIconTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1635
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PopupMenuIconTemplateDirective, isStandalone: true, selector: "ng-template[monaPopupMenuIconTemplate]", providers: [
1636
- {
1637
- provide: PopupMenuIconTemplateToken,
1638
- useExisting: forwardRef(() => PopupMenuIconTemplateDirective)
1639
- }
1640
- ], ngImport: i0 }); }
1641
- }
1642
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuIconTemplateDirective, decorators: [{
1643
- type: Directive,
1644
- args: [{
1645
- selector: "ng-template[monaPopupMenuIconTemplate]",
1646
- providers: [
1647
- {
1648
- provide: PopupMenuIconTemplateToken,
1649
- useExisting: forwardRef(() => PopupMenuIconTemplateDirective)
1650
- }
1651
- ]
1652
- }]
1653
- }] });
1654
-
1655
- class PopupMenuShortcutTemplateDirective {
1656
- constructor() {
1657
- this.origin = PopupMenuTemplateOrigin.Popup;
1658
- this.template = inject(TemplateRef);
1659
- this.type = PopupMenuTemplateType.Shortcut;
1660
- }
1661
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuShortcutTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1662
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PopupMenuShortcutTemplateDirective, isStandalone: true, selector: "ng-template[monaPopupMenuShortcutTemplate]", providers: [
1663
- {
1664
- provide: PopupMenuShortcutTemplateToken,
1665
- useExisting: forwardRef(() => PopupMenuShortcutTemplateDirective)
1666
- }
1667
- ], ngImport: i0 }); }
1668
- }
1669
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuShortcutTemplateDirective, decorators: [{
1670
- type: Directive,
1671
- args: [{
1672
- selector: "ng-template[monaPopupMenuShortcutTemplate]",
1673
- providers: [
1674
- {
1675
- provide: PopupMenuShortcutTemplateToken,
1676
- useExisting: forwardRef(() => PopupMenuShortcutTemplateDirective)
1677
- }
1678
- ]
1679
- }]
1680
- }] });
1681
-
1682
- class PopupMenuTextTemplateDirective {
1683
- constructor() {
1684
- this.origin = PopupMenuTemplateOrigin.Popup;
1685
- this.template = inject(TemplateRef);
1686
- this.type = PopupMenuTemplateType.Text;
1687
- }
1688
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuTextTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1689
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: PopupMenuTextTemplateDirective, isStandalone: true, selector: "ng-template[monaPopupMenuTextTemplate]", providers: [
1690
- {
1691
- provide: PopupMenuTextTemplateToken,
1692
- useExisting: forwardRef(() => PopupMenuTextTemplateDirective)
1693
- }
1694
- ], ngImport: i0 }); }
1695
- }
1696
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuTextTemplateDirective, decorators: [{
1697
- type: Directive,
1698
- args: [{
1699
- selector: "ng-template[monaPopupMenuTextTemplate]",
1700
- providers: [
1701
- {
1702
- provide: PopupMenuTextTemplateToken,
1703
- useExisting: forwardRef(() => PopupMenuTextTemplateDirective)
1704
- }
1705
- ]
1706
- }]
1707
- }] });
1708
-
1709
- /*
1710
- * Public API Surface of @nanahoshi/mona-ui/popup-menu
1711
- */
1712
-
1713
- /**
1714
- * Generated bundle index. Do not edit.
1715
- */
91
+ var PopupMenuListComponent = class PopupMenuListComponent {
92
+ #childCloseRequest$;
93
+ #destroyRef;
94
+ #direction;
95
+ #document;
96
+ #host;
97
+ #navigationItems;
98
+ #openSubmenuItem;
99
+ #parentConfig;
100
+ #popupService;
101
+ #submenuId;
102
+ #typeaheadKey$;
103
+ #childClose$;
104
+ #closing;
105
+ #hoverTimer;
106
+ constructor() {
107
+ this.#childCloseRequest$ = new Subject();
108
+ this.#destroyRef = inject(DestroyRef);
109
+ this.#direction = injectComponentDirection();
110
+ this.#document = inject(DOCUMENT);
111
+ this.#host = inject(ElementRef);
112
+ this.#navigationItems = computed(() => {
113
+ const items = this.#parentConfig.items();
114
+ return selectMany(items, (i) => i.items).where((i) => !i.separator).toImmutableSet();
115
+ }, ...ngDevMode ? [{ debugName: "#navigationItems" }] : /* istanbul ignore next */ []);
116
+ this.#openSubmenuItem = signal(null, ...ngDevMode ? [{ debugName: "#openSubmenuItem" }] : /* istanbul ignore next */ []);
117
+ this.#parentConfig = inject(PopupDataInjectionToken);
118
+ this.#popupService = inject(PopupService);
119
+ this.#submenuId = signal(null, ...ngDevMode ? [{ debugName: "#submenuId" }] : /* istanbul ignore next */ []);
120
+ this.#typeaheadKey$ = new Subject();
121
+ this.#childClose$ = null;
122
+ this.#closing = false;
123
+ this.activeMenuItem = signal(null, ...ngDevMode ? [{ debugName: "activeMenuItem" }] : /* istanbul ignore next */ []);
124
+ this.ariaLabel = this.#parentConfig.ariaLabel || null;
125
+ this.baseClasses = computed(() => {
126
+ const rounded = this.#parentConfig.rounded();
127
+ return popupMenuBaseThemeVariants({ rounded });
128
+ }, ...ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []);
129
+ this.containerClasses = computed(() => {
130
+ const rounded = this.#parentConfig.rounded();
131
+ return popupMenuContainerThemeVariants({ rounded });
132
+ }, ...ngDevMode ? [{ debugName: "containerClasses" }] : /* istanbul ignore next */ []);
133
+ this.groupHeaderClasses = computed(() => {
134
+ const size = this.#parentConfig.size();
135
+ return popupMenuGroupHeaderThemeVariants({ size });
136
+ }, ...ngDevMode ? [{ debugName: "groupHeaderClasses" }] : /* istanbul ignore next */ []);
137
+ this.iconAreaVisible = computed(() => {
138
+ const items = this.#parentConfig.items();
139
+ return selectMany(items, (i) => i.items).any((i) => i.iconTemplate?.() != null || i.checkable === true || i.radio === true) || !!this.#parentConfig.popupIconTemplate?.();
140
+ }, ...ngDevMode ? [{ debugName: "iconAreaVisible" }] : /* istanbul ignore next */ []);
141
+ this.iconContainerClasses = computed(() => {
142
+ return popupMenuIconContainerThemeVariants();
143
+ }, ...ngDevMode ? [{ debugName: "iconContainerClasses" }] : /* istanbul ignore next */ []);
144
+ this.isRtl = computed(() => this.#direction() === "rtl", ...ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []);
145
+ this.labelledBy = this.ariaLabel ? null : this.#parentConfig.labelledBy;
146
+ this.linkContainerClasses = computed(() => {
147
+ return popupMenuLinkThemeVariants();
148
+ }, ...ngDevMode ? [{ debugName: "linkContainerClasses" }] : /* istanbul ignore next */ []);
149
+ this.menuId = computed(() => this.#parentConfig.menuId, ...ngDevMode ? [{ debugName: "menuId" }] : /* istanbul ignore next */ []);
150
+ this.menuItemClasses = computed(() => {
151
+ const rounded = this.#parentConfig.rounded();
152
+ const size = this.#parentConfig.size();
153
+ const hasIcon = this.iconAreaVisible();
154
+ const variantClasses = popupMenuItemThemeVariants({
155
+ rounded,
156
+ size
157
+ });
158
+ return twMerge(variantClasses, hasIcon ? "ps-8" : "ps-2");
159
+ }, ...ngDevMode ? [{ debugName: "menuItemClasses" }] : /* istanbul ignore next */ []);
160
+ this.menuItems = computed(() => this.#parentConfig.items(), ...ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []);
161
+ this.openSubmenuItem = this.#openSubmenuItem.asReadonly();
162
+ this.popupGroupTemplate = computed(() => this.#parentConfig.popupGroupTemplate?.() ?? null, ...ngDevMode ? [{ debugName: "popupGroupTemplate" }] : /* istanbul ignore next */ []);
163
+ this.popupIconTemplate = computed(() => this.#parentConfig.popupIconTemplate?.() ?? null, ...ngDevMode ? [{ debugName: "popupIconTemplate" }] : /* istanbul ignore next */ []);
164
+ this.popupShortcutTemplate = computed(() => this.#parentConfig.popupShortcutTemplate?.() ?? null, ...ngDevMode ? [{ debugName: "popupShortcutTemplate" }] : /* istanbul ignore next */ []);
165
+ this.popupTextTemplate = computed(() => this.#parentConfig.popupTextTemplate?.(), ...ngDevMode ? [{ debugName: "popupTextTemplate" }] : /* istanbul ignore next */ []);
166
+ this.submenuId = this.#submenuId.asReadonly();
167
+ this.popupRef = null;
168
+ afterNextRender({ write: () => {
169
+ const config = this.#parentConfig;
170
+ if (config.isRoot || config.viaKeyboardNavigation) this.#menuElement()?.focus();
171
+ if (config.isRoot && config.initialFocus) {
172
+ if (config.initialFocus === "last") this.handleEndKey();
173
+ else this.focusFirstItem();
174
+ } else if (!config.isRoot && config.viaKeyboardNavigation) {
175
+ const item = this.focusFirstItem();
176
+ const isRtl = this.isRtl();
177
+ this.notifyNavigation(item, isRtl ? "left" : "right");
178
+ }
179
+ } });
180
+ effect(() => {
181
+ const items = this.#navigationItems();
182
+ untracked(() => {
183
+ const active = this.activeMenuItem();
184
+ if (active && !items.any((i) => i === active)) this.activeMenuItem.set(items.firstOrDefault((i) => i.uid === active.uid) ?? null);
185
+ const open = this.#openSubmenuItem();
186
+ if (open && !items.any((i) => i === open)) {
187
+ const current = items.firstOrDefault((i) => i.uid === open.uid);
188
+ if (current && current.items.length > 0) this.#openSubmenuItem.set(current);
189
+ else this.closePopup();
190
+ }
191
+ });
192
+ });
193
+ this.#destroyRef.onDestroy(() => {
194
+ clearTimeout(this.#hoverTimer);
195
+ this.#closing = true;
196
+ this.closePopup();
197
+ });
198
+ }
199
+ ngOnInit() {
200
+ this.setSubscriptions();
201
+ }
202
+ #menuElement() {
203
+ return this.#host.nativeElement.firstElementChild;
204
+ }
205
+ asItems(items) {
206
+ return items;
207
+ }
208
+ onFocusOut(event) {
209
+ const next = event.relatedTarget;
210
+ if (next instanceof Element && !next.closest("mona-popup-menu-list")) this.#parentConfig.closeMenu({ focusLeftTo: next });
211
+ }
212
+ onHostPointerEnter() {
213
+ this.#parentConfig.submenuPointerEnter?.();
214
+ }
215
+ onItemClick(event, item) {
216
+ if (item.disabled) return;
217
+ if (item.items.length > 0) {
218
+ this.openSubmenuFromClick(item, event.currentTarget, event.detail === 0);
219
+ return;
220
+ }
221
+ const popupMenuItemClickEvent = new PopupMenuItemClickEvent$1(item, event);
222
+ item.click$?.next(popupMenuItemClickEvent);
223
+ if (popupMenuItemClickEvent.isDefaultPrevented()) return;
224
+ this.#parentConfig.menuItemClick$.next(popupMenuItemClickEvent);
225
+ }
226
+ onItemPointerEnter(event, item) {
227
+ clearTimeout(this.#hoverTimer);
228
+ const open = this.#openSubmenuItem();
229
+ if (open === item) {
230
+ this.activeMenuItem.set(item);
231
+ return;
232
+ }
233
+ const target = event.currentTarget;
234
+ const hover = () => {
235
+ this.closePopup();
236
+ if (item.items.length > 0 && !item.disabled) {
237
+ this.activeMenuItem.set(item);
238
+ this.createSubmenu(target, false, item);
239
+ } else this.activeMenuItem.set(null);
240
+ };
241
+ if (open) this.#hoverTimer = setTimeout(hover, SUBMENU_SWITCH_DELAY);
242
+ else hover();
243
+ }
244
+ closePopup() {
245
+ const ref = this.popupRef;
246
+ this.popupRef = null;
247
+ this.#openSubmenuItem.set(null);
248
+ this.#submenuId.set(null);
249
+ const childClose$ = this.#childClose$;
250
+ this.#childClose$ = null;
251
+ childClose$?.next();
252
+ if (ref) {
253
+ this.reclaimFocus();
254
+ ref.close();
255
+ }
256
+ }
257
+ closeSubmenu() {
258
+ this.#parentConfig.childCloseRequest$?.next();
259
+ }
260
+ createSubmenu(target, viaKeyboard, item) {
261
+ this.closePopup();
262
+ const uid = item.uid;
263
+ const close$ = new Subject();
264
+ const menuId = createElementControlId(this.#parentConfig.level + 1);
265
+ const data = {
266
+ childCloseRequest$: this.#childCloseRequest$,
267
+ closeMenu: this.#parentConfig.closeMenu,
268
+ isRoot: false,
269
+ items: computed(() => groupPopupMenuItems(this.findItem(uid)?.items ?? [])),
270
+ labelledBy: uid,
271
+ level: this.#parentConfig.level + 1,
272
+ menuId,
273
+ menuItemClick$: this.#parentConfig.menuItemClick$,
274
+ minWidth: this.#parentConfig.minWidth,
275
+ navigate$: this.#parentConfig.navigate$,
276
+ parentClose$: close$,
277
+ popupGroupTemplate: this.#parentConfig.popupGroupTemplate,
278
+ popupIconTemplate: this.#parentConfig.popupIconTemplate,
279
+ popupShortcutTemplate: this.#parentConfig.popupShortcutTemplate,
280
+ popupTextTemplate: this.#parentConfig.popupTextTemplate,
281
+ rounded: this.#parentConfig.rounded,
282
+ size: this.#parentConfig.size,
283
+ submenuPointerEnter: () => this.onSubmenuPointerEnter(),
284
+ viaKeyboardNavigation: viaKeyboard,
285
+ width: this.#parentConfig.width
286
+ };
287
+ const ref = this.#popupService.create({
288
+ anchor: target,
289
+ anchorConnectionPoint: "topright",
290
+ closeOnScroll: true,
291
+ content: PopupMenuListComponent,
292
+ data,
293
+ minWidth: this.#parentConfig.minWidth?.() ?? void 0,
294
+ popupConnectionPoint: "topleft",
295
+ restoreFocus: false,
296
+ width: this.#parentConfig.width?.() ?? void 0
297
+ });
298
+ this.popupRef = ref;
299
+ this.#childClose$ = close$;
300
+ this.#openSubmenuItem.set(item);
301
+ this.#submenuId.set(menuId);
302
+ ref.closed.pipe(take(1)).subscribe(() => {
303
+ close$.complete();
304
+ if (this.popupRef !== ref) return;
305
+ this.popupRef = null;
306
+ this.#childClose$ = null;
307
+ this.#openSubmenuItem.set(null);
308
+ this.#submenuId.set(null);
309
+ if (!this.#closing) this.#menuElement()?.focus();
310
+ if (!viaKeyboard) this.activeMenuItem.set(null);
311
+ });
312
+ }
313
+ cycleThroughMatchedItems(buffer) {
314
+ const matchedItems = this.#navigationItems().where((i) => i.label.toLowerCase().startsWith(buffer)).toArray();
315
+ const activeMenuItem = this.activeMenuItem();
316
+ if (matchedItems.length === 0) return;
317
+ if (matchedItems.length === 1) {
318
+ this.activeMenuItem.set(matchedItems[0]);
319
+ return;
320
+ }
321
+ if (matchedItems.length > 1) {
322
+ const nextIndex = ((activeMenuItem ? matchedItems.indexOf(activeMenuItem) : -1) + 1) % matchedItems.length;
323
+ this.activeMenuItem.set(matchedItems[nextIndex]);
324
+ }
325
+ }
326
+ findItem(uid) {
327
+ return this.#navigationItems().firstOrDefault((i) => i.uid === uid) ?? null;
328
+ }
329
+ focusFirstItem() {
330
+ const firstItem = this.#navigationItems().firstOrDefault();
331
+ if (firstItem) this.activeMenuItem.set(firstItem);
332
+ return firstItem;
333
+ }
334
+ handleArrowDownKey() {
335
+ if (!this.activeMenuItem()) {
336
+ const firstItem = this.#navigationItems().firstOrDefault();
337
+ if (firstItem) this.activeMenuItem.set(firstItem);
338
+ return firstItem;
339
+ }
340
+ const nextItem = this.#navigationItems().skipWhile((i) => i !== this.activeMenuItem()).skip(1).firstOrDefault();
341
+ if (nextItem) {
342
+ this.activeMenuItem.set(nextItem);
343
+ return nextItem;
344
+ }
345
+ const firstItem = this.#navigationItems().firstOrDefault();
346
+ if (firstItem) this.activeMenuItem.set(firstItem);
347
+ return firstItem;
348
+ }
349
+ handleArrowUpKey() {
350
+ if (!this.activeMenuItem()) {
351
+ const lastItem = this.#navigationItems().lastOrDefault();
352
+ if (lastItem) this.activeMenuItem.set(lastItem);
353
+ return lastItem;
354
+ }
355
+ const previousItem = this.#navigationItems().takeWhile((i) => i !== this.activeMenuItem()).lastOrDefault();
356
+ if (previousItem) {
357
+ this.activeMenuItem.set(previousItem);
358
+ return previousItem;
359
+ }
360
+ const lastItem = this.#navigationItems().lastOrDefault();
361
+ if (lastItem) this.activeMenuItem.set(lastItem);
362
+ return lastItem;
363
+ }
364
+ handleEndKey() {
365
+ const lastItem = this.#navigationItems().lastOrDefault();
366
+ if (lastItem) this.activeMenuItem.set(lastItem);
367
+ }
368
+ handleEnterKey() {
369
+ const activeItem = this.activeMenuItem();
370
+ if (activeItem?.disabled) return;
371
+ if (activeItem && activeItem.items.length > 0) {
372
+ const target = this.#host.nativeElement.querySelector("[data-active=\"true\"]");
373
+ if (target) this.createSubmenu(target, true, activeItem);
374
+ } else if (activeItem) {
375
+ const syntheticEvent = new MouseEvent("click", {
376
+ bubbles: true,
377
+ cancelable: true,
378
+ composed: true
379
+ });
380
+ this.onItemClick(syntheticEvent, activeItem);
381
+ }
382
+ }
383
+ handleEscapeKey() {
384
+ this.closePopup();
385
+ }
386
+ handleHomeKey() {
387
+ const firstItem = this.#navigationItems().firstOrDefault();
388
+ if (firstItem) this.activeMenuItem.set(firstItem);
389
+ }
390
+ handleNavigationKey(event) {
391
+ const isRtl = this.isRtl();
392
+ const openKey = isRtl ? "ArrowLeft" : "ArrowRight";
393
+ const closeKey = isRtl ? "ArrowRight" : "ArrowLeft";
394
+ const forwardDir = isRtl ? "left" : "right";
395
+ const backwardDir = isRtl ? "right" : "left";
396
+ let item = null;
397
+ if (event.key === "ArrowDown") {
398
+ item = this.handleArrowDownKey();
399
+ this.notifyNavigation(item, "down");
400
+ } else if (event.key === closeKey) {
401
+ this.closeSubmenu();
402
+ if (this.#parentConfig.level === 0) this.notifyNavigation(null, backwardDir);
403
+ } else if (event.key === openKey) {
404
+ if (!this.openSubmenu().hasChild) this.notifyNavigation(item, forwardDir);
405
+ } else if (event.key === "ArrowUp") {
406
+ item = this.handleArrowUpKey();
407
+ this.notifyNavigation(item, "up");
408
+ } else if (event.key === "End") this.handleEndKey();
409
+ else if (event.key === "Enter" || event.key === " ") {
410
+ event.preventDefault();
411
+ this.handleEnterKey();
412
+ } else if (event.key === "Escape") this.handleEscapeKey();
413
+ else if (event.key === "Home") this.handleHomeKey();
414
+ }
415
+ handleTypeaheadKey(event) {
416
+ this.#typeaheadKey$.next(event.key);
417
+ }
418
+ notifyNavigation(item, direction) {
419
+ this.#parentConfig.navigate$.next({
420
+ direction,
421
+ item,
422
+ level: this.#parentConfig.level
423
+ });
424
+ }
425
+ onSubmenuPointerEnter() {
426
+ clearTimeout(this.#hoverTimer);
427
+ const open = this.#openSubmenuItem();
428
+ if (open) this.activeMenuItem.set(open);
429
+ }
430
+ openSubmenu() {
431
+ const activeItem = this.activeMenuItem();
432
+ if (!activeItem || activeItem.disabled) return {
433
+ item: null,
434
+ hasChild: false
435
+ };
436
+ const target = this.#host.nativeElement.querySelector("[data-active=\"true\"]");
437
+ if (target && activeItem.items.length > 0) {
438
+ this.createSubmenu(target, true, activeItem);
439
+ return {
440
+ item: activeItem,
441
+ hasChild: true
442
+ };
443
+ }
444
+ if (activeItem && activeItem.items.length > 0) return {
445
+ item: activeItem,
446
+ hasChild: true
447
+ };
448
+ return {
449
+ item: null,
450
+ hasChild: false
451
+ };
452
+ }
453
+ openSubmenuFromClick(item, target, viaKeyboard) {
454
+ if (!target || this.popupRef && this.#openSubmenuItem() === item) return;
455
+ this.activeMenuItem.set(item);
456
+ this.createSubmenu(target, viaKeyboard, item);
457
+ }
458
+ reclaimFocus() {
459
+ if (this.#closing) return;
460
+ const active = this.#document.activeElement;
461
+ if (active && !this.#host.nativeElement.contains(active) && active.closest("mona-popup-menu-list")) this.#menuElement()?.focus();
462
+ }
463
+ setKeyboardEvents() {
464
+ const element = this.#menuElement();
465
+ if (!element) return;
466
+ fromEvent(element, "keydown").pipe(takeUntilDestroyed(this.#destroyRef), tap((e) => {
467
+ if (e.key === "Tab") this.#parentConfig.closeMenu({ tab: true });
468
+ else if (isNavigationKey(e.key)) {
469
+ e.preventDefault();
470
+ this.#typeaheadKey$.next("");
471
+ this.handleNavigationKey(e);
472
+ } else if (isTypeaheadKey(e.key, e)) {
473
+ e.preventDefault();
474
+ this.handleTypeaheadKey(e);
475
+ }
476
+ })).subscribe();
477
+ }
478
+ setPopupCloseSubscription() {
479
+ this.#parentConfig.parentClose$.pipe(takeUntilDestroyed(this.#destroyRef), tap(() => {
480
+ this.#closing = true;
481
+ this.closePopup();
482
+ })).subscribe();
483
+ this.#childCloseRequest$.pipe(takeUntilDestroyed(this.#destroyRef), tap(() => {
484
+ const activeItem = this.activeMenuItem();
485
+ const isRtl = this.isRtl();
486
+ this.notifyNavigation(activeItem, isRtl ? "right" : "left");
487
+ this.closePopup();
488
+ })).subscribe();
489
+ }
490
+ setSubscriptions() {
491
+ this.setKeyboardEvents();
492
+ this.setPopupCloseSubscription();
493
+ this.setTypeaheadSubscription();
494
+ }
495
+ setTypeaheadSubscription() {
496
+ setupTypeahead(this.#typeaheadKey$).pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((buffer) => this.cycleThroughMatchedItems(buffer));
497
+ }
498
+ static {
499
+ this.ɵfac = i0.ɵɵngDeclareFactory({
500
+ minVersion: "12.0.0",
501
+ version: "22.2.6",
502
+ ngImport: i0,
503
+ type: PopupMenuListComponent,
504
+ deps: [],
505
+ target: i0.ɵɵFactoryTarget.Component
506
+ });
507
+ }
508
+ static {
509
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
510
+ minVersion: "17.0.0",
511
+ version: "22.2.6",
512
+ type: PopupMenuListComponent,
513
+ isStandalone: true,
514
+ selector: "mona-popup-menu-list",
515
+ host: {
516
+ listeners: {
517
+ "focusout": "onFocusOut($event)",
518
+ "pointerenter": "onHostPointerEnter()"
519
+ },
520
+ properties: { "class": "baseClasses()" }
521
+ },
522
+ ngImport: i0,
523
+ template: "<div\n role=\"menu\"\n [attr.tabindex]=\"0\"\n [attr.aria-orientation]=\"'vertical'\"\n [attr.aria-activedescendant]=\"activeMenuItem()?.uid\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"labelledBy\"\n [attr.id]=\"menuId()\"\n [class]=\"containerClasses()\">\n @for (group of menuItems(); track $index) {\n @if (group.title) {\n @let groupTemplate = group.items[0]?.groupTemplate?.() ?? popupGroupTemplate() ?? null;\n <div role=\"group\" [attr.aria-labelledby]=\"group.labelId\">\n <div [id]=\"group.labelId\" role=\"presentation\" [class]=\"groupHeaderClasses()\">\n @if (groupTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.title }\"></ng-container>\n } @else {\n <span>{{ group.title }}</span>\n }\n </div>\n <ng-container\n [ngTemplateOutlet]=\"itemsTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.items }\"></ng-container>\n </div>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"itemsTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.items }\"></ng-container>\n }\n }\n</div>\n\n<ng-template #itemsTemplate let-items>\n @for (item of asItems(items); track $index) {\n @if (item.separator) {\n <div role=\"separator\" class=\"bg-border my-1 h-px\"></div>\n } @else {\n @let iconTemplate = item.iconTemplate?.() ?? popupIconTemplate() ?? null;\n @let shortcutTemplate = item.shortcutTemplate?.() ?? popupShortcutTemplate() ?? null;\n @let textTemplate = item.textTemplate?.() ?? popupTextTemplate() ?? null;\n <div\n [attr.role]=\"item.checkable ? 'menuitemcheckbox' : item.radio ? 'menuitemradio' : 'menuitem'\"\n [attr.aria-checked]=\"item.checkable ? !!item.checked?.() : item.radio ? !!item.selected?.() : null\"\n [id]=\"item.uid\"\n (pointerenter)=\"onItemPointerEnter($event, item)\"\n (click)=\"onItemClick($event, item)\"\n [attr.data-active]=\"item === activeMenuItem()\"\n [attr.aria-disabled]=\"item.disabled\"\n [attr.aria-expanded]=\"item.items.length > 0 ? item === openSubmenuItem() : null\"\n [attr.aria-controls]=\"item === openSubmenuItem() ? submenuId() : null\"\n [attr.aria-haspopup]=\"item.items.length > 0 ? 'menu' : null\"\n [attr.aria-label]=\"textTemplate ? null : item.label || null\"\n [attr.data-disabled]=\"item.disabled\"\n [class]=\"menuItemClasses()\">\n @if (iconAreaVisible()) {\n <div [class]=\"iconContainerClasses()\">\n @if (!item.checkable && !item.radio) {\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n } @else if (item.checkable) {\n @if (item.checked?.()) {\n <svg lucideCheck [size]=\"14\"></svg>\n }\n } @else if (item.radio) {\n @if (item.selected?.()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-circle size-2 fill-current\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n </svg>\n }\n }\n </div>\n }\n <div class=\"flex-1\">\n @if (textTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"textTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n } @else {\n {{ item.label }}\n }\n </div>\n @if (item.items.length > 0) {\n @if (!item.checkable) {\n <div [class]=\"linkContainerClasses()\">\n <svg lucideChevronRight [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n </div>\n }\n } @else if (shortcutTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"shortcutTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </div>\n }\n }\n</ng-template>\n",
524
+ dependencies: [
525
+ {
526
+ kind: "directive",
527
+ type: NgTemplateOutlet,
528
+ selector: "[ngTemplateOutlet]",
529
+ inputs: [
530
+ "ngTemplateOutletContext",
531
+ "ngTemplateOutlet",
532
+ "ngTemplateOutletInjector"
533
+ ]
534
+ },
535
+ {
536
+ kind: "component",
537
+ type: LucideChevronRight,
538
+ selector: "svg[lucideChevronRight]"
539
+ },
540
+ {
541
+ kind: "component",
542
+ type: LucideCheck,
543
+ selector: "svg[lucideCheck]"
544
+ }
545
+ ]
546
+ });
547
+ }
548
+ };
549
+ i0.ɵɵngDeclareClassMetadata({
550
+ minVersion: "12.0.0",
551
+ version: "22.2.6",
552
+ ngImport: i0,
553
+ type: PopupMenuListComponent,
554
+ decorators: [{
555
+ type: Component,
556
+ args: [{
557
+ selector: "mona-popup-menu-list",
558
+ imports: [
559
+ NgTemplateOutlet,
560
+ LucideChevronRight,
561
+ LucideCheck
562
+ ],
563
+ host: {
564
+ "[class]": "baseClasses()",
565
+ "(focusout)": "onFocusOut($event)",
566
+ "(pointerenter)": "onHostPointerEnter()"
567
+ },
568
+ template: "<div\n role=\"menu\"\n [attr.tabindex]=\"0\"\n [attr.aria-orientation]=\"'vertical'\"\n [attr.aria-activedescendant]=\"activeMenuItem()?.uid\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"labelledBy\"\n [attr.id]=\"menuId()\"\n [class]=\"containerClasses()\">\n @for (group of menuItems(); track $index) {\n @if (group.title) {\n @let groupTemplate = group.items[0]?.groupTemplate?.() ?? popupGroupTemplate() ?? null;\n <div role=\"group\" [attr.aria-labelledby]=\"group.labelId\">\n <div [id]=\"group.labelId\" role=\"presentation\" [class]=\"groupHeaderClasses()\">\n @if (groupTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.title }\"></ng-container>\n } @else {\n <span>{{ group.title }}</span>\n }\n </div>\n <ng-container\n [ngTemplateOutlet]=\"itemsTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.items }\"></ng-container>\n </div>\n } @else {\n <ng-container\n [ngTemplateOutlet]=\"itemsTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.items }\"></ng-container>\n }\n }\n</div>\n\n<ng-template #itemsTemplate let-items>\n @for (item of asItems(items); track $index) {\n @if (item.separator) {\n <div role=\"separator\" class=\"bg-border my-1 h-px\"></div>\n } @else {\n @let iconTemplate = item.iconTemplate?.() ?? popupIconTemplate() ?? null;\n @let shortcutTemplate = item.shortcutTemplate?.() ?? popupShortcutTemplate() ?? null;\n @let textTemplate = item.textTemplate?.() ?? popupTextTemplate() ?? null;\n <div\n [attr.role]=\"item.checkable ? 'menuitemcheckbox' : item.radio ? 'menuitemradio' : 'menuitem'\"\n [attr.aria-checked]=\"item.checkable ? !!item.checked?.() : item.radio ? !!item.selected?.() : null\"\n [id]=\"item.uid\"\n (pointerenter)=\"onItemPointerEnter($event, item)\"\n (click)=\"onItemClick($event, item)\"\n [attr.data-active]=\"item === activeMenuItem()\"\n [attr.aria-disabled]=\"item.disabled\"\n [attr.aria-expanded]=\"item.items.length > 0 ? item === openSubmenuItem() : null\"\n [attr.aria-controls]=\"item === openSubmenuItem() ? submenuId() : null\"\n [attr.aria-haspopup]=\"item.items.length > 0 ? 'menu' : null\"\n [attr.aria-label]=\"textTemplate ? null : item.label || null\"\n [attr.data-disabled]=\"item.disabled\"\n [class]=\"menuItemClasses()\">\n @if (iconAreaVisible()) {\n <div [class]=\"iconContainerClasses()\">\n @if (!item.checkable && !item.radio) {\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n } @else if (item.checkable) {\n @if (item.checked?.()) {\n <svg lucideCheck [size]=\"14\"></svg>\n }\n } @else if (item.radio) {\n @if (item.selected?.()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-circle size-2 fill-current\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n </svg>\n }\n }\n </div>\n }\n <div class=\"flex-1\">\n @if (textTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"textTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n } @else {\n {{ item.label }}\n }\n </div>\n @if (item.items.length > 0) {\n @if (!item.checkable) {\n <div [class]=\"linkContainerClasses()\">\n <svg lucideChevronRight [size]=\"16\" class=\"rtl:rotate-180\"></svg>\n </div>\n }\n } @else if (shortcutTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"shortcutTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n }\n </div>\n }\n }\n</ng-template>\n"
569
+ }]
570
+ }],
571
+ ctorParameters: () => []
572
+ });
573
+ const handledContextMenuEvents = /* @__PURE__ */ new WeakSet();
574
+ var PopupMenuComponent = class PopupMenuComponent {
575
+ #destroyRef;
576
+ #document;
577
+ #menuItemClick$;
578
+ #navigate$;
579
+ #popupService;
580
+ #destroyed;
581
+ #open;
582
+ #pendingInitialFocus;
583
+ #suppressNextTrustedContextMenu;
584
+ #triggerSubscription;
585
+ constructor() {
586
+ this.#destroyRef = inject(DestroyRef);
587
+ this.#document = inject(DOCUMENT);
588
+ this.#menuItemClick$ = new Subject();
589
+ this.#navigate$ = new Subject();
590
+ this.#popupService = inject(PopupService);
591
+ this.#destroyed = false;
592
+ this.#open = null;
593
+ this.#pendingInitialFocus = null;
594
+ this.#suppressNextTrustedContextMenu = false;
595
+ this.#triggerSubscription = null;
596
+ this.groupTemplateConfig = contentChild(PopupMenuGroupTemplateToken, {
597
+ ...ngDevMode ? { debugName: "groupTemplateConfig" } : /* istanbul ignore next */ {},
598
+ descendants: false
599
+ });
600
+ this.iconTemplateConfig = contentChild(PopupMenuIconTemplateToken, {
601
+ ...ngDevMode ? { debugName: "iconTemplateConfig" } : /* istanbul ignore next */ {},
602
+ descendants: false
603
+ });
604
+ this.nestedComponents = contentChildren(PopupMenuToken, {
605
+ ...ngDevMode ? { debugName: "nestedComponents" } : /* istanbul ignore next */ {},
606
+ descendants: false
607
+ });
608
+ this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, {
609
+ ...ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {},
610
+ descendants: false
611
+ });
612
+ this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, {
613
+ ...ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {},
614
+ descendants: false
615
+ });
616
+ this.menuItems = computed(() => {
617
+ const inputItems = this.items();
618
+ if (any(inputItems)) {
619
+ const items = select(inputItems, (i) => Object.hasOwn(i, "uid") ? i : preparePopupMenuItems([i])[0]);
620
+ return groupPopupMenuItems(items);
621
+ }
622
+ const items = this.nestedComponents().flatMap((i) => i.getPopupMenuItem());
623
+ return groupPopupMenuItems(items);
624
+ }, ...ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []);
625
+ this.anchor = input(...ngDevMode ? [void 0, { debugName: "anchor" }] : /* istanbul ignore next */ []);
626
+ this.anchorConnectionPoint = input(...ngDevMode ? [void 0, { debugName: "anchorConnectionPoint" }] : /* istanbul ignore next */ []);
627
+ this.ariaLabel = input("", {
628
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
629
+ alias: "aria-label"
630
+ });
631
+ this.ariaLabelledBy = input("", {
632
+ ...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
633
+ alias: "aria-labelledby"
634
+ });
635
+ this.close = output();
636
+ this.items = input([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
637
+ this.menuClick = output();
638
+ this.menuId = input("", {
639
+ ...ngDevMode ? { debugName: "menuId" } : /* istanbul ignore next */ {},
640
+ alias: "id"
641
+ });
642
+ this.minWidth = input(...ngDevMode ? [void 0, { debugName: "minWidth" }] : /* istanbul ignore next */ []);
643
+ this.navigate = output();
644
+ this.offset = input(...ngDevMode ? [void 0, { debugName: "offset" }] : /* istanbul ignore next */ []);
645
+ this.open = output();
646
+ this.openAtPointer = input(false, ...ngDevMode ? [{ debugName: "openAtPointer" }] : /* istanbul ignore next */ []);
647
+ this.popupConnectionPoint = input(...ngDevMode ? [void 0, { debugName: "popupConnectionPoint" }] : /* istanbul ignore next */ []);
648
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
649
+ this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
650
+ this.target = input.required(...ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []);
651
+ this.trigger = input("click", ...ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []);
652
+ this.userClass = input(void 0, {
653
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
654
+ alias: "class",
655
+ transform: (value) => classInputToClass(value)
656
+ });
657
+ this.width = input(...ngDevMode ? [void 0, { debugName: "width" }] : /* istanbul ignore next */ []);
658
+ this.setMenuItemClickSubscription();
659
+ this.setNavigationSubscription();
660
+ effect(() => {
661
+ const target = this.#element(this.target());
662
+ const trigger = this.trigger();
663
+ untracked(() => {
664
+ this.#triggerSubscription?.unsubscribe();
665
+ this.#triggerSubscription = target ? this.setTriggerSubscription(target, trigger) : null;
666
+ });
667
+ });
668
+ this.#destroyRef.onDestroy(() => {
669
+ this.#destroyed = true;
670
+ this.#triggerSubscription?.unsubscribe();
671
+ const open = this.#open;
672
+ if (open) {
673
+ open.restoreFocus = false;
674
+ open.ref?.close();
675
+ }
676
+ });
677
+ }
678
+ clearFocusRestoration() {
679
+ if (this.#open) this.#open.restoreFocus = false;
680
+ }
681
+ closeMenu() {
682
+ this.#open?.ref?.close();
683
+ }
684
+ openMenu(viaContextMenuKey = false) {
685
+ const targetElement = this.#element(this.target());
686
+ if (!targetElement) return;
687
+ const center = targetElement.getBoundingClientRect();
688
+ if (viaContextMenuKey) {
689
+ const contextMenuEvent = new MouseEvent("contextmenu", {
690
+ bubbles: true,
691
+ cancelable: true,
692
+ clientX: center.left + center.width / 2,
693
+ clientY: center.top + center.height / 2,
694
+ button: -1
695
+ });
696
+ const ownerDocument = targetElement.ownerDocument;
697
+ const suppressNativeContextMenu = (nativeEvent) => {
698
+ if (nativeEvent.isTrusted) {
699
+ nativeEvent.preventDefault();
700
+ ownerDocument.removeEventListener("contextmenu", suppressNativeContextMenu, { capture: true });
701
+ }
702
+ };
703
+ this.#suppressNextTrustedContextMenu = true;
704
+ ownerDocument.addEventListener("contextmenu", suppressNativeContextMenu, { capture: true });
705
+ targetElement.dispatchEvent(contextMenuEvent);
706
+ rxTimeout(this.#destroyRef, () => {
707
+ this.#suppressNextTrustedContextMenu = false;
708
+ ownerDocument.removeEventListener("contextmenu", suppressNativeContextMenu, { capture: true });
709
+ }, 500);
710
+ return;
711
+ }
712
+ const event = new MouseEvent(this.trigger(), {
713
+ bubbles: true,
714
+ cancelable: true
715
+ });
716
+ targetElement.dispatchEvent(event);
717
+ }
718
+ openMenuViaKeyboard(viaContextMenuKey = false, focus = "first") {
719
+ this.#pendingInitialFocus = focus;
720
+ this.openMenu(viaContextMenuKey);
721
+ this.#pendingInitialFocus = null;
722
+ }
723
+ setRestoreFocusForKeyboard() {
724
+ if (this.#open) this.#open.restoreFocus = true;
725
+ }
726
+ #element(value) {
727
+ const element = value instanceof ElementRef ? value.nativeElement : value;
728
+ return element instanceof HTMLElement ? element : null;
729
+ }
730
+ closeFromList(state, options) {
731
+ if (this.#open !== state || !state.ref) return;
732
+ if (options.focusLeftTo) {
733
+ const target = this.#element(this.target());
734
+ const anchor = this.#element(this.anchor());
735
+ if (target?.contains(options.focusLeftTo) || anchor?.contains(options.focusLeftTo)) return;
736
+ state.restoreFocus = false;
737
+ }
738
+ if (options.tab) {
739
+ state.restoreFocus = false;
740
+ state.returnFocusTo?.focus();
741
+ }
742
+ state.ref.close();
743
+ }
744
+ createMenu(event, state) {
745
+ const anchor = this.getPopupAnchor(event);
746
+ const anchorConnectionPoint = this.openAtPointer() ? void 0 : this.anchorConnectionPoint();
747
+ const targetId = this.#element(this.target())?.id ?? "";
748
+ const data = {
749
+ ariaLabel: this.ariaLabel(),
750
+ closeMenu: (options) => this.closeFromList(state, options),
751
+ initialFocus: this.#pendingInitialFocus,
752
+ isRoot: true,
753
+ items: this.menuItems,
754
+ labelledBy: this.ariaLabelledBy() || targetId || null,
755
+ level: 0,
756
+ menuId: this.menuId(),
757
+ menuItemClick$: this.#menuItemClick$,
758
+ minWidth: computed(() => toCssValue(this.minWidth()) ?? null),
759
+ navigate$: this.#navigate$,
760
+ parentClose$: state.close$,
761
+ popupGroupTemplate: computed(() => this.groupTemplateConfig()?.template ?? null),
762
+ popupIconTemplate: computed(() => this.iconTemplateConfig()?.template ?? null),
763
+ popupShortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
764
+ popupTextTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
765
+ rounded: computed(() => this.rounded()),
766
+ size: computed(() => this.size()),
767
+ width: computed(() => toCssValue(this.width()) ?? null)
768
+ };
769
+ return this.#popupService.create({
770
+ anchor,
771
+ anchorConnectionPoint,
772
+ closeOnScroll: true,
773
+ content: PopupMenuListComponent,
774
+ data,
775
+ minWidth: toCssValue(this.minWidth()),
776
+ offset: this.offset(),
777
+ popupClass: this.userClass(),
778
+ popupConnectionPoint: this.openAtPointer() ? void 0 : this.popupConnectionPoint(),
779
+ restoreFocus: false,
780
+ width: toCssValue(this.width())
781
+ });
782
+ }
783
+ getPopupAnchor(event) {
784
+ const anchorElement = this.anchor();
785
+ const targetElement = this.target();
786
+ const targetInput = anchorElement ?? targetElement;
787
+ const atPointer = this.openAtPointer();
788
+ const actualTargetElement = targetInput instanceof ElementRef ? targetInput.nativeElement : targetInput;
789
+ let anchor;
790
+ if (atPointer) {
791
+ if (event.button < 0) {
792
+ const rect = actualTargetElement.getBoundingClientRect();
793
+ anchor = {
794
+ x: rect.left + rect.width / 2,
795
+ y: rect.top + rect.height / 2
796
+ };
797
+ } else anchor = {
798
+ x: event.x,
799
+ y: event.y
800
+ };
801
+ } else anchor = actualTargetElement;
802
+ return anchor;
803
+ }
804
+ openFor(event, targetElement) {
805
+ const opener = this.#document.activeElement;
806
+ const hasOpener = !!opener && opener !== this.#document.body;
807
+ const openerInMenu = hasOpener && !!opener.closest("mona-popup-menu-list");
808
+ const targetFocusable = targetElement.tabIndex >= 0 || openerInMenu && targetElement.hasAttribute("tabindex");
809
+ const viaKeyboard = this.#pendingInitialFocus !== null;
810
+ let returnFocusTo = null;
811
+ if (hasOpener && !openerInMenu && (viaKeyboard || targetElement.contains(opener))) returnFocusTo = opener;
812
+ else if (targetFocusable) returnFocusTo = targetElement;
813
+ else if (hasOpener && !openerInMenu) returnFocusTo = opener;
814
+ const state = {
815
+ close$: new Subject(),
816
+ ref: null,
817
+ restoreFocus: true,
818
+ returnFocusTo
819
+ };
820
+ const ref = this.createMenu(event, state);
821
+ state.ref = ref;
822
+ this.#open = state;
823
+ this.open.emit();
824
+ ref.beforeClose.pipe(takeUntil(ref.closed)).subscribe((e) => {
825
+ if (this.#destroyed) return;
826
+ const popupCloseEvent = e.result;
827
+ const closeEvent = new PopupMenuCloseEvent(popupCloseEvent);
828
+ this.close.emit(closeEvent);
829
+ if (closeEvent.isDefaultPrevented()) e.preventDefault();
830
+ });
831
+ ref.closeStart.pipe(take(1)).subscribe(() => {
832
+ state.close$.next();
833
+ if (this.#open === state) this.#open = null;
834
+ });
835
+ ref.closed.pipe(take(1)).subscribe(() => {
836
+ state.close$.complete();
837
+ if (this.#open === state) this.#open = null;
838
+ if (state.restoreFocus && this.#open === null) this.restoreFocus(state.returnFocusTo);
839
+ });
840
+ }
841
+ restoreFocus(element) {
842
+ if (!element || !element.isConnected) return;
843
+ const active = this.#document.activeElement;
844
+ if (active && active !== this.#document.body && !active.closest("mona-popup-menu-list")) return;
845
+ element.focus();
846
+ }
847
+ setMenuItemClickSubscription() {
848
+ this.#menuItemClick$.pipe(takeUntilDestroyed(this.#destroyRef), tap((event) => {
849
+ this.menuClick.emit(event);
850
+ if (event.isDefaultPrevented()) return;
851
+ const item = event.item;
852
+ if (isMenuOwnedCheckState(item)) item.checked.set(event.checked === true);
853
+ this.closeMenu();
854
+ })).subscribe();
855
+ }
856
+ setNavigationSubscription() {
857
+ this.#navigate$.pipe(takeUntilDestroyed(this.#destroyRef), tap((e) => this.navigate.emit(e))).subscribe();
858
+ }
859
+ setTriggerSubscription(targetElement, trigger) {
860
+ return fromEvent(targetElement, trigger).pipe(takeUntilDestroyed(this.#destroyRef), tap((e) => e.preventDefault())).subscribe((e) => {
861
+ if (e.isTrusted && this.#suppressNextTrustedContextMenu) {
862
+ this.#suppressNextTrustedContextMenu = false;
863
+ return;
864
+ }
865
+ if (trigger === "contextmenu" && handledContextMenuEvents.has(e)) return;
866
+ const open = this.#open;
867
+ if (open) {
868
+ if (trigger !== "contextmenu" && !this.openAtPointer()) {
869
+ open.ref?.close();
870
+ return;
871
+ }
872
+ open.restoreFocus = false;
873
+ open.ref?.close();
874
+ this.#open = null;
875
+ }
876
+ if (trigger === "contextmenu") handledContextMenuEvents.add(e);
877
+ this.openFor(e, targetElement);
878
+ });
879
+ }
880
+ static {
881
+ this.ɵfac = i0.ɵɵngDeclareFactory({
882
+ minVersion: "12.0.0",
883
+ version: "22.2.6",
884
+ ngImport: i0,
885
+ type: PopupMenuComponent,
886
+ deps: [],
887
+ target: i0.ɵɵFactoryTarget.Component
888
+ });
889
+ }
890
+ static {
891
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
892
+ minVersion: "17.2.0",
893
+ version: "22.2.6",
894
+ type: PopupMenuComponent,
895
+ isStandalone: true,
896
+ selector: "mona-popup-menu",
897
+ inputs: {
898
+ anchor: {
899
+ classPropertyName: "anchor",
900
+ publicName: "anchor",
901
+ isSignal: true,
902
+ isRequired: false,
903
+ transformFunction: null
904
+ },
905
+ anchorConnectionPoint: {
906
+ classPropertyName: "anchorConnectionPoint",
907
+ publicName: "anchorConnectionPoint",
908
+ isSignal: true,
909
+ isRequired: false,
910
+ transformFunction: null
911
+ },
912
+ ariaLabel: {
913
+ classPropertyName: "ariaLabel",
914
+ publicName: "aria-label",
915
+ isSignal: true,
916
+ isRequired: false,
917
+ transformFunction: null
918
+ },
919
+ ariaLabelledBy: {
920
+ classPropertyName: "ariaLabelledBy",
921
+ publicName: "aria-labelledby",
922
+ isSignal: true,
923
+ isRequired: false,
924
+ transformFunction: null
925
+ },
926
+ items: {
927
+ classPropertyName: "items",
928
+ publicName: "items",
929
+ isSignal: true,
930
+ isRequired: false,
931
+ transformFunction: null
932
+ },
933
+ menuId: {
934
+ classPropertyName: "menuId",
935
+ publicName: "id",
936
+ isSignal: true,
937
+ isRequired: false,
938
+ transformFunction: null
939
+ },
940
+ minWidth: {
941
+ classPropertyName: "minWidth",
942
+ publicName: "minWidth",
943
+ isSignal: true,
944
+ isRequired: false,
945
+ transformFunction: null
946
+ },
947
+ offset: {
948
+ classPropertyName: "offset",
949
+ publicName: "offset",
950
+ isSignal: true,
951
+ isRequired: false,
952
+ transformFunction: null
953
+ },
954
+ openAtPointer: {
955
+ classPropertyName: "openAtPointer",
956
+ publicName: "openAtPointer",
957
+ isSignal: true,
958
+ isRequired: false,
959
+ transformFunction: null
960
+ },
961
+ popupConnectionPoint: {
962
+ classPropertyName: "popupConnectionPoint",
963
+ publicName: "popupConnectionPoint",
964
+ isSignal: true,
965
+ isRequired: false,
966
+ transformFunction: null
967
+ },
968
+ rounded: {
969
+ classPropertyName: "rounded",
970
+ publicName: "rounded",
971
+ isSignal: true,
972
+ isRequired: false,
973
+ transformFunction: null
974
+ },
975
+ size: {
976
+ classPropertyName: "size",
977
+ publicName: "size",
978
+ isSignal: true,
979
+ isRequired: false,
980
+ transformFunction: null
981
+ },
982
+ target: {
983
+ classPropertyName: "target",
984
+ publicName: "target",
985
+ isSignal: true,
986
+ isRequired: true,
987
+ transformFunction: null
988
+ },
989
+ trigger: {
990
+ classPropertyName: "trigger",
991
+ publicName: "trigger",
992
+ isSignal: true,
993
+ isRequired: false,
994
+ transformFunction: null
995
+ },
996
+ userClass: {
997
+ classPropertyName: "userClass",
998
+ publicName: "class",
999
+ isSignal: true,
1000
+ isRequired: false,
1001
+ transformFunction: null
1002
+ },
1003
+ width: {
1004
+ classPropertyName: "width",
1005
+ publicName: "width",
1006
+ isSignal: true,
1007
+ isRequired: false,
1008
+ transformFunction: null
1009
+ }
1010
+ },
1011
+ outputs: {
1012
+ close: "close",
1013
+ menuClick: "menuClick",
1014
+ navigate: "navigate",
1015
+ open: "open"
1016
+ },
1017
+ host: { properties: {
1018
+ "attr.aria-label": "null",
1019
+ "attr.aria-labelledby": "null"
1020
+ } },
1021
+ queries: [
1022
+ {
1023
+ propertyName: "groupTemplateConfig",
1024
+ first: true,
1025
+ predicate: PopupMenuGroupTemplateToken,
1026
+ isSignal: true
1027
+ },
1028
+ {
1029
+ propertyName: "iconTemplateConfig",
1030
+ first: true,
1031
+ predicate: PopupMenuIconTemplateToken,
1032
+ isSignal: true
1033
+ },
1034
+ {
1035
+ propertyName: "nestedComponents",
1036
+ predicate: PopupMenuToken,
1037
+ isSignal: true
1038
+ },
1039
+ {
1040
+ propertyName: "shortcutTemplateConfig",
1041
+ first: true,
1042
+ predicate: PopupMenuShortcutTemplateToken,
1043
+ isSignal: true
1044
+ },
1045
+ {
1046
+ propertyName: "textTemplateConfig",
1047
+ first: true,
1048
+ predicate: PopupMenuTextTemplateToken,
1049
+ isSignal: true
1050
+ }
1051
+ ],
1052
+ ngImport: i0,
1053
+ template: "",
1054
+ isInline: true
1055
+ });
1056
+ }
1057
+ };
1058
+ i0.ɵɵngDeclareClassMetadata({
1059
+ minVersion: "12.0.0",
1060
+ version: "22.2.6",
1061
+ ngImport: i0,
1062
+ type: PopupMenuComponent,
1063
+ decorators: [{
1064
+ type: Component,
1065
+ args: [{
1066
+ selector: "mona-popup-menu",
1067
+ template: "",
1068
+ host: {
1069
+ "[attr.aria-label]": "null",
1070
+ "[attr.aria-labelledby]": "null"
1071
+ }
1072
+ }]
1073
+ }],
1074
+ ctorParameters: () => [],
1075
+ propDecorators: {
1076
+ groupTemplateConfig: [{
1077
+ type: i0.ContentChild,
1078
+ args: [i0.forwardRef(() => PopupMenuGroupTemplateToken), {
1079
+ descendants: false,
1080
+ isSignal: true
1081
+ }]
1082
+ }],
1083
+ iconTemplateConfig: [{
1084
+ type: i0.ContentChild,
1085
+ args: [i0.forwardRef(() => PopupMenuIconTemplateToken), {
1086
+ descendants: false,
1087
+ isSignal: true
1088
+ }]
1089
+ }],
1090
+ nestedComponents: [{
1091
+ type: i0.ContentChildren,
1092
+ args: [i0.forwardRef(() => PopupMenuToken), {
1093
+ descendants: false,
1094
+ isSignal: true
1095
+ }]
1096
+ }],
1097
+ shortcutTemplateConfig: [{
1098
+ type: i0.ContentChild,
1099
+ args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), {
1100
+ descendants: false,
1101
+ isSignal: true
1102
+ }]
1103
+ }],
1104
+ textTemplateConfig: [{
1105
+ type: i0.ContentChild,
1106
+ args: [i0.forwardRef(() => PopupMenuTextTemplateToken), {
1107
+ descendants: false,
1108
+ isSignal: true
1109
+ }]
1110
+ }],
1111
+ anchor: [{
1112
+ type: i0.Input,
1113
+ args: [{
1114
+ isSignal: true,
1115
+ alias: "anchor",
1116
+ required: false
1117
+ }]
1118
+ }],
1119
+ anchorConnectionPoint: [{
1120
+ type: i0.Input,
1121
+ args: [{
1122
+ isSignal: true,
1123
+ alias: "anchorConnectionPoint",
1124
+ required: false
1125
+ }]
1126
+ }],
1127
+ ariaLabel: [{
1128
+ type: i0.Input,
1129
+ args: [{
1130
+ isSignal: true,
1131
+ alias: "aria-label",
1132
+ required: false
1133
+ }]
1134
+ }],
1135
+ ariaLabelledBy: [{
1136
+ type: i0.Input,
1137
+ args: [{
1138
+ isSignal: true,
1139
+ alias: "aria-labelledby",
1140
+ required: false
1141
+ }]
1142
+ }],
1143
+ close: [{
1144
+ type: i0.Output,
1145
+ args: ["close"]
1146
+ }],
1147
+ items: [{
1148
+ type: i0.Input,
1149
+ args: [{
1150
+ isSignal: true,
1151
+ alias: "items",
1152
+ required: false
1153
+ }]
1154
+ }],
1155
+ menuClick: [{
1156
+ type: i0.Output,
1157
+ args: ["menuClick"]
1158
+ }],
1159
+ menuId: [{
1160
+ type: i0.Input,
1161
+ args: [{
1162
+ isSignal: true,
1163
+ alias: "id",
1164
+ required: false
1165
+ }]
1166
+ }],
1167
+ minWidth: [{
1168
+ type: i0.Input,
1169
+ args: [{
1170
+ isSignal: true,
1171
+ alias: "minWidth",
1172
+ required: false
1173
+ }]
1174
+ }],
1175
+ navigate: [{
1176
+ type: i0.Output,
1177
+ args: ["navigate"]
1178
+ }],
1179
+ offset: [{
1180
+ type: i0.Input,
1181
+ args: [{
1182
+ isSignal: true,
1183
+ alias: "offset",
1184
+ required: false
1185
+ }]
1186
+ }],
1187
+ open: [{
1188
+ type: i0.Output,
1189
+ args: ["open"]
1190
+ }],
1191
+ openAtPointer: [{
1192
+ type: i0.Input,
1193
+ args: [{
1194
+ isSignal: true,
1195
+ alias: "openAtPointer",
1196
+ required: false
1197
+ }]
1198
+ }],
1199
+ popupConnectionPoint: [{
1200
+ type: i0.Input,
1201
+ args: [{
1202
+ isSignal: true,
1203
+ alias: "popupConnectionPoint",
1204
+ required: false
1205
+ }]
1206
+ }],
1207
+ rounded: [{
1208
+ type: i0.Input,
1209
+ args: [{
1210
+ isSignal: true,
1211
+ alias: "rounded",
1212
+ required: false
1213
+ }]
1214
+ }],
1215
+ size: [{
1216
+ type: i0.Input,
1217
+ args: [{
1218
+ isSignal: true,
1219
+ alias: "size",
1220
+ required: false
1221
+ }]
1222
+ }],
1223
+ target: [{
1224
+ type: i0.Input,
1225
+ args: [{
1226
+ isSignal: true,
1227
+ alias: "target",
1228
+ required: true
1229
+ }]
1230
+ }],
1231
+ trigger: [{
1232
+ type: i0.Input,
1233
+ args: [{
1234
+ isSignal: true,
1235
+ alias: "trigger",
1236
+ required: false
1237
+ }]
1238
+ }],
1239
+ userClass: [{
1240
+ type: i0.Input,
1241
+ args: [{
1242
+ isSignal: true,
1243
+ alias: "class",
1244
+ required: false
1245
+ }]
1246
+ }],
1247
+ width: [{
1248
+ type: i0.Input,
1249
+ args: [{
1250
+ isSignal: true,
1251
+ alias: "width",
1252
+ required: false
1253
+ }]
1254
+ }]
1255
+ }
1256
+ });
1257
+ var PopupMenuCheckboxItemComponent = class PopupMenuCheckboxItemComponent {
1258
+ constructor() {
1259
+ this.#click$ = new Subject();
1260
+ this.#destroyRef = inject(DestroyRef);
1261
+ this.#uid = createElementControlId();
1262
+ this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, {
1263
+ ...ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {},
1264
+ descendants: false
1265
+ });
1266
+ this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, {
1267
+ ...ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {},
1268
+ descendants: false
1269
+ });
1270
+ this.checked = model(false, ...ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []);
1271
+ this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
1272
+ this.label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
1273
+ this.menuClick = output();
1274
+ this.origin = PopupMenuOrigin.Popup;
1275
+ this.type = PopupMenuItemType.CheckboxMenuItem;
1276
+ this.value = input(...ngDevMode ? [void 0, { debugName: "value" }] : /* istanbul ignore next */ []);
1277
+ }
1278
+ #click$;
1279
+ #destroyRef;
1280
+ #uid;
1281
+ getPopupMenuItem() {
1282
+ return [{
1283
+ checkable: true,
1284
+ checked: computed(() => this.checked()),
1285
+ click$: this.#click$,
1286
+ disabled: this.disabled(),
1287
+ group: Symbol(),
1288
+ groupTemplate: null,
1289
+ iconTemplate: null,
1290
+ items: [],
1291
+ label: this.label(),
1292
+ shortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
1293
+ textTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
1294
+ uid: this.#uid,
1295
+ value: computed(() => this.value())
1296
+ }];
1297
+ }
1298
+ ngOnInit() {
1299
+ this.setSubscriptions();
1300
+ }
1301
+ setSubscriptions() {
1302
+ this.#click$.pipe(takeUntilDestroyed(this.#destroyRef), tap((e) => {
1303
+ this.menuClick.emit(e);
1304
+ if (!e.isDefaultPrevented()) this.checked.set(e.checked === true);
1305
+ })).subscribe();
1306
+ }
1307
+ static {
1308
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1309
+ minVersion: "12.0.0",
1310
+ version: "22.2.6",
1311
+ ngImport: i0,
1312
+ type: PopupMenuCheckboxItemComponent,
1313
+ deps: [],
1314
+ target: i0.ɵɵFactoryTarget.Component
1315
+ });
1316
+ }
1317
+ static {
1318
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1319
+ minVersion: "17.2.0",
1320
+ version: "22.2.6",
1321
+ type: PopupMenuCheckboxItemComponent,
1322
+ isStandalone: true,
1323
+ selector: "mona-popup-menu-checkbox-item",
1324
+ inputs: {
1325
+ checked: {
1326
+ classPropertyName: "checked",
1327
+ publicName: "checked",
1328
+ isSignal: true,
1329
+ isRequired: false,
1330
+ transformFunction: null
1331
+ },
1332
+ disabled: {
1333
+ classPropertyName: "disabled",
1334
+ publicName: "disabled",
1335
+ isSignal: true,
1336
+ isRequired: false,
1337
+ transformFunction: null
1338
+ },
1339
+ label: {
1340
+ classPropertyName: "label",
1341
+ publicName: "label",
1342
+ isSignal: true,
1343
+ isRequired: false,
1344
+ transformFunction: null
1345
+ },
1346
+ value: {
1347
+ classPropertyName: "value",
1348
+ publicName: "value",
1349
+ isSignal: true,
1350
+ isRequired: false,
1351
+ transformFunction: null
1352
+ }
1353
+ },
1354
+ outputs: {
1355
+ checked: "checkedChange",
1356
+ menuClick: "menuClick"
1357
+ },
1358
+ providers: [{
1359
+ provide: PopupMenuToken,
1360
+ useExisting: forwardRef(() => PopupMenuCheckboxItemComponent)
1361
+ }],
1362
+ queries: [{
1363
+ propertyName: "shortcutTemplateConfig",
1364
+ first: true,
1365
+ predicate: PopupMenuShortcutTemplateToken,
1366
+ isSignal: true
1367
+ }, {
1368
+ propertyName: "textTemplateConfig",
1369
+ first: true,
1370
+ predicate: PopupMenuTextTemplateToken,
1371
+ isSignal: true
1372
+ }],
1373
+ ngImport: i0,
1374
+ template: "",
1375
+ isInline: true
1376
+ });
1377
+ }
1378
+ };
1379
+ i0.ɵɵngDeclareClassMetadata({
1380
+ minVersion: "12.0.0",
1381
+ version: "22.2.6",
1382
+ ngImport: i0,
1383
+ type: PopupMenuCheckboxItemComponent,
1384
+ decorators: [{
1385
+ type: Component,
1386
+ args: [{
1387
+ selector: "mona-popup-menu-checkbox-item",
1388
+ template: "",
1389
+ providers: [{
1390
+ provide: PopupMenuToken,
1391
+ useExisting: forwardRef(() => PopupMenuCheckboxItemComponent)
1392
+ }]
1393
+ }]
1394
+ }],
1395
+ propDecorators: {
1396
+ shortcutTemplateConfig: [{
1397
+ type: i0.ContentChild,
1398
+ args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), {
1399
+ descendants: false,
1400
+ isSignal: true
1401
+ }]
1402
+ }],
1403
+ textTemplateConfig: [{
1404
+ type: i0.ContentChild,
1405
+ args: [i0.forwardRef(() => PopupMenuTextTemplateToken), {
1406
+ descendants: false,
1407
+ isSignal: true
1408
+ }]
1409
+ }],
1410
+ checked: [{
1411
+ type: i0.Input,
1412
+ args: [{
1413
+ isSignal: true,
1414
+ alias: "checked",
1415
+ required: false
1416
+ }]
1417
+ }, {
1418
+ type: i0.Output,
1419
+ args: ["checkedChange"]
1420
+ }],
1421
+ disabled: [{
1422
+ type: i0.Input,
1423
+ args: [{
1424
+ isSignal: true,
1425
+ alias: "disabled",
1426
+ required: false
1427
+ }]
1428
+ }],
1429
+ label: [{
1430
+ type: i0.Input,
1431
+ args: [{
1432
+ isSignal: true,
1433
+ alias: "label",
1434
+ required: false
1435
+ }]
1436
+ }],
1437
+ menuClick: [{
1438
+ type: i0.Output,
1439
+ args: ["menuClick"]
1440
+ }],
1441
+ value: [{
1442
+ type: i0.Input,
1443
+ args: [{
1444
+ isSignal: true,
1445
+ alias: "value",
1446
+ required: false
1447
+ }]
1448
+ }]
1449
+ }
1450
+ });
1451
+ var PopupMenuItemComponent = class PopupMenuItemComponent {
1452
+ constructor() {
1453
+ this.#click$ = new Subject();
1454
+ this.#destroyRef = inject(DestroyRef);
1455
+ this.#uid = createElementControlId();
1456
+ this.iconTemplateConfig = contentChild(PopupMenuIconTemplateToken, {
1457
+ ...ngDevMode ? { debugName: "iconTemplateConfig" } : /* istanbul ignore next */ {},
1458
+ descendants: false
1459
+ });
1460
+ this.items = contentChildren(PopupMenuToken, {
1461
+ ...ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {},
1462
+ descendants: false
1463
+ });
1464
+ this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, {
1465
+ ...ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {},
1466
+ descendants: false
1467
+ });
1468
+ this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, {
1469
+ ...ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {},
1470
+ descendants: false
1471
+ });
1472
+ this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
1473
+ this.label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
1474
+ this.menuClick = output();
1475
+ this.origin = PopupMenuOrigin.Popup;
1476
+ this.type = PopupMenuItemType.MenuItem;
1477
+ this.value = input(...ngDevMode ? [void 0, { debugName: "value" }] : /* istanbul ignore next */ []);
1478
+ }
1479
+ #click$;
1480
+ #destroyRef;
1481
+ #uid;
1482
+ getPopupMenuItem() {
1483
+ return [{
1484
+ click$: this.#click$,
1485
+ disabled: this.disabled(),
1486
+ group: Symbol(),
1487
+ groupTemplate: null,
1488
+ iconTemplate: computed(() => this.iconTemplateConfig()?.template ?? null),
1489
+ items: selectMany(this.items().map((item) => item.getPopupMenuItem()), (i) => i).toArray(),
1490
+ label: this.label(),
1491
+ shortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
1492
+ textTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
1493
+ uid: this.#uid,
1494
+ value: computed(() => this.value())
1495
+ }];
1496
+ }
1497
+ ngOnInit() {
1498
+ this.setSubscriptions();
1499
+ }
1500
+ setSubscriptions() {
1501
+ this.#click$.pipe(takeUntilDestroyed(this.#destroyRef), tap((e) => this.menuClick.emit(e))).subscribe();
1502
+ }
1503
+ static {
1504
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1505
+ minVersion: "12.0.0",
1506
+ version: "22.2.6",
1507
+ ngImport: i0,
1508
+ type: PopupMenuItemComponent,
1509
+ deps: [],
1510
+ target: i0.ɵɵFactoryTarget.Component
1511
+ });
1512
+ }
1513
+ static {
1514
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1515
+ minVersion: "17.2.0",
1516
+ version: "22.2.6",
1517
+ type: PopupMenuItemComponent,
1518
+ isStandalone: true,
1519
+ selector: "mona-popup-menu-item",
1520
+ inputs: {
1521
+ disabled: {
1522
+ classPropertyName: "disabled",
1523
+ publicName: "disabled",
1524
+ isSignal: true,
1525
+ isRequired: false,
1526
+ transformFunction: null
1527
+ },
1528
+ label: {
1529
+ classPropertyName: "label",
1530
+ publicName: "label",
1531
+ isSignal: true,
1532
+ isRequired: false,
1533
+ transformFunction: null
1534
+ },
1535
+ value: {
1536
+ classPropertyName: "value",
1537
+ publicName: "value",
1538
+ isSignal: true,
1539
+ isRequired: false,
1540
+ transformFunction: null
1541
+ }
1542
+ },
1543
+ outputs: { menuClick: "menuClick" },
1544
+ providers: [{
1545
+ provide: PopupMenuToken,
1546
+ useExisting: forwardRef(() => PopupMenuItemComponent)
1547
+ }],
1548
+ queries: [
1549
+ {
1550
+ propertyName: "iconTemplateConfig",
1551
+ first: true,
1552
+ predicate: PopupMenuIconTemplateToken,
1553
+ isSignal: true
1554
+ },
1555
+ {
1556
+ propertyName: "items",
1557
+ predicate: PopupMenuToken,
1558
+ isSignal: true
1559
+ },
1560
+ {
1561
+ propertyName: "shortcutTemplateConfig",
1562
+ first: true,
1563
+ predicate: PopupMenuShortcutTemplateToken,
1564
+ isSignal: true
1565
+ },
1566
+ {
1567
+ propertyName: "textTemplateConfig",
1568
+ first: true,
1569
+ predicate: PopupMenuTextTemplateToken,
1570
+ isSignal: true
1571
+ }
1572
+ ],
1573
+ ngImport: i0,
1574
+ template: "",
1575
+ isInline: true
1576
+ });
1577
+ }
1578
+ };
1579
+ i0.ɵɵngDeclareClassMetadata({
1580
+ minVersion: "12.0.0",
1581
+ version: "22.2.6",
1582
+ ngImport: i0,
1583
+ type: PopupMenuItemComponent,
1584
+ decorators: [{
1585
+ type: Component,
1586
+ args: [{
1587
+ selector: "mona-popup-menu-item",
1588
+ template: "",
1589
+ providers: [{
1590
+ provide: PopupMenuToken,
1591
+ useExisting: forwardRef(() => PopupMenuItemComponent)
1592
+ }]
1593
+ }]
1594
+ }],
1595
+ propDecorators: {
1596
+ iconTemplateConfig: [{
1597
+ type: i0.ContentChild,
1598
+ args: [i0.forwardRef(() => PopupMenuIconTemplateToken), {
1599
+ descendants: false,
1600
+ isSignal: true
1601
+ }]
1602
+ }],
1603
+ items: [{
1604
+ type: i0.ContentChildren,
1605
+ args: [i0.forwardRef(() => PopupMenuToken), {
1606
+ descendants: false,
1607
+ isSignal: true
1608
+ }]
1609
+ }],
1610
+ shortcutTemplateConfig: [{
1611
+ type: i0.ContentChild,
1612
+ args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), {
1613
+ descendants: false,
1614
+ isSignal: true
1615
+ }]
1616
+ }],
1617
+ textTemplateConfig: [{
1618
+ type: i0.ContentChild,
1619
+ args: [i0.forwardRef(() => PopupMenuTextTemplateToken), {
1620
+ descendants: false,
1621
+ isSignal: true
1622
+ }]
1623
+ }],
1624
+ disabled: [{
1625
+ type: i0.Input,
1626
+ args: [{
1627
+ isSignal: true,
1628
+ alias: "disabled",
1629
+ required: false
1630
+ }]
1631
+ }],
1632
+ label: [{
1633
+ type: i0.Input,
1634
+ args: [{
1635
+ isSignal: true,
1636
+ alias: "label",
1637
+ required: false
1638
+ }]
1639
+ }],
1640
+ menuClick: [{
1641
+ type: i0.Output,
1642
+ args: ["menuClick"]
1643
+ }],
1644
+ value: [{
1645
+ type: i0.Input,
1646
+ args: [{
1647
+ isSignal: true,
1648
+ alias: "value",
1649
+ required: false
1650
+ }]
1651
+ }]
1652
+ }
1653
+ });
1654
+ var PopupMenuGroupComponent = class PopupMenuGroupComponent {
1655
+ constructor() {
1656
+ this.#groupKey = computed(() => Symbol(this.title() ?? ""), ...ngDevMode ? [{ debugName: "#groupKey" }] : /* istanbul ignore next */ []);
1657
+ this.groupTemplateConfig = contentChild(PopupMenuGroupTemplateToken, {
1658
+ ...ngDevMode ? { debugName: "groupTemplateConfig" } : /* istanbul ignore next */ {},
1659
+ descendants: false
1660
+ });
1661
+ this.items = contentChildren(PopupMenuToken, {
1662
+ ...ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {},
1663
+ descendants: false
1664
+ });
1665
+ this.origin = PopupMenuOrigin.Popup;
1666
+ this.title = input(...ngDevMode ? [void 0, { debugName: "title" }] : /* istanbul ignore next */ []);
1667
+ this.type = PopupMenuItemType.MenuGroup;
1668
+ }
1669
+ #groupKey;
1670
+ getPopupMenuItem() {
1671
+ const group = this.#groupKey();
1672
+ const menuItems = this.items().map((i) => i.getPopupMenuItem().map((item) => ({
1673
+ ...item,
1674
+ group,
1675
+ groupTemplate: computed(() => this.groupTemplateConfig()?.template ?? null)
1676
+ })));
1677
+ return selectMany(menuItems, (i) => i).toArray();
1678
+ }
1679
+ static {
1680
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1681
+ minVersion: "12.0.0",
1682
+ version: "22.2.6",
1683
+ ngImport: i0,
1684
+ type: PopupMenuGroupComponent,
1685
+ deps: [],
1686
+ target: i0.ɵɵFactoryTarget.Component
1687
+ });
1688
+ }
1689
+ static {
1690
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1691
+ minVersion: "17.2.0",
1692
+ version: "22.2.6",
1693
+ type: PopupMenuGroupComponent,
1694
+ isStandalone: true,
1695
+ selector: "mona-popup-menu-group",
1696
+ inputs: { title: {
1697
+ classPropertyName: "title",
1698
+ publicName: "title",
1699
+ isSignal: true,
1700
+ isRequired: false,
1701
+ transformFunction: null
1702
+ } },
1703
+ providers: [{
1704
+ provide: PopupMenuToken,
1705
+ useExisting: forwardRef(() => PopupMenuGroupComponent)
1706
+ }],
1707
+ queries: [{
1708
+ propertyName: "groupTemplateConfig",
1709
+ first: true,
1710
+ predicate: PopupMenuGroupTemplateToken,
1711
+ isSignal: true
1712
+ }, {
1713
+ propertyName: "items",
1714
+ predicate: PopupMenuToken,
1715
+ isSignal: true
1716
+ }],
1717
+ ngImport: i0,
1718
+ template: ``,
1719
+ isInline: true
1720
+ });
1721
+ }
1722
+ };
1723
+ i0.ɵɵngDeclareClassMetadata({
1724
+ minVersion: "12.0.0",
1725
+ version: "22.2.6",
1726
+ ngImport: i0,
1727
+ type: PopupMenuGroupComponent,
1728
+ decorators: [{
1729
+ type: Component,
1730
+ args: [{
1731
+ selector: "mona-popup-menu-group",
1732
+ template: ``,
1733
+ providers: [{
1734
+ provide: PopupMenuToken,
1735
+ useExisting: forwardRef(() => PopupMenuGroupComponent)
1736
+ }]
1737
+ }]
1738
+ }],
1739
+ propDecorators: {
1740
+ groupTemplateConfig: [{
1741
+ type: i0.ContentChild,
1742
+ args: [i0.forwardRef(() => PopupMenuGroupTemplateToken), {
1743
+ descendants: false,
1744
+ isSignal: true
1745
+ }]
1746
+ }],
1747
+ items: [{
1748
+ type: i0.ContentChildren,
1749
+ args: [i0.forwardRef(() => PopupMenuToken), {
1750
+ descendants: false,
1751
+ isSignal: true
1752
+ }]
1753
+ }],
1754
+ title: [{
1755
+ type: i0.Input,
1756
+ args: [{
1757
+ isSignal: true,
1758
+ alias: "title",
1759
+ required: false
1760
+ }]
1761
+ }]
1762
+ }
1763
+ });
1764
+ var PopupMenuRadioGroupComponent = class PopupMenuRadioGroupComponent {
1765
+ constructor() {
1766
+ this.#click$ = new Subject();
1767
+ this.#destroyRef = inject(DestroyRef);
1768
+ this.#groupKey = computed(() => Symbol(this.title()), ...ngDevMode ? [{ debugName: "#groupKey" }] : /* istanbul ignore next */ []);
1769
+ this.#itemClicks = /* @__PURE__ */ new WeakMap();
1770
+ this.groupTemplateConfig = contentChild(PopupMenuGroupTemplateToken, {
1771
+ ...ngDevMode ? { debugName: "groupTemplateConfig" } : /* istanbul ignore next */ {},
1772
+ descendants: false
1773
+ });
1774
+ this.items = contentChildren(PopupMenuRadioItemToken, {
1775
+ ...ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {},
1776
+ descendants: false
1777
+ });
1778
+ this.origin = PopupMenuOrigin.Popup;
1779
+ this.title = input("", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
1780
+ this.type = PopupMenuItemType.RadioGroup;
1781
+ this.value = model("", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
1782
+ }
1783
+ #click$;
1784
+ #destroyRef;
1785
+ #groupKey;
1786
+ #itemClicks;
1787
+ getPopupMenuItem() {
1788
+ const group = this.#groupKey();
1789
+ const menuItems = this.items().map((i) => i.getPopupMenuItem().map((item) => {
1790
+ const groupItem = {
1791
+ ...item,
1792
+ click$: this.#click$,
1793
+ group,
1794
+ groupTemplate: computed(() => this.groupTemplateConfig()?.template ?? null),
1795
+ radio: true,
1796
+ selected: computed(() => item.value?.() === this.value())
1797
+ };
1798
+ if (item.click$) this.#itemClicks.set(groupItem, item.click$);
1799
+ return groupItem;
1800
+ }));
1801
+ return selectMany(menuItems, (i) => i).toArray();
1802
+ }
1803
+ ngOnInit() {
1804
+ this.setSubscription();
1805
+ }
1806
+ setSubscription() {
1807
+ this.#click$.pipe(takeUntilDestroyed(this.#destroyRef), filter((e) => e.item.radio == true), tap((event) => {
1808
+ this.#itemClicks.get(event.item)?.next(event);
1809
+ if (event.isDefaultPrevented()) return;
1810
+ const value = event.item.value?.();
1811
+ if (typeof value === "string") this.value.set(value);
1812
+ })).subscribe();
1813
+ }
1814
+ static {
1815
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1816
+ minVersion: "12.0.0",
1817
+ version: "22.2.6",
1818
+ ngImport: i0,
1819
+ type: PopupMenuRadioGroupComponent,
1820
+ deps: [],
1821
+ target: i0.ɵɵFactoryTarget.Component
1822
+ });
1823
+ }
1824
+ static {
1825
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1826
+ minVersion: "17.2.0",
1827
+ version: "22.2.6",
1828
+ type: PopupMenuRadioGroupComponent,
1829
+ isStandalone: true,
1830
+ selector: "mona-popup-menu-radio-group",
1831
+ inputs: {
1832
+ title: {
1833
+ classPropertyName: "title",
1834
+ publicName: "title",
1835
+ isSignal: true,
1836
+ isRequired: false,
1837
+ transformFunction: null
1838
+ },
1839
+ value: {
1840
+ classPropertyName: "value",
1841
+ publicName: "value",
1842
+ isSignal: true,
1843
+ isRequired: false,
1844
+ transformFunction: null
1845
+ }
1846
+ },
1847
+ outputs: { value: "valueChange" },
1848
+ providers: [{
1849
+ provide: PopupMenuToken,
1850
+ useExisting: forwardRef(() => PopupMenuRadioGroupComponent)
1851
+ }],
1852
+ queries: [{
1853
+ propertyName: "groupTemplateConfig",
1854
+ first: true,
1855
+ predicate: PopupMenuGroupTemplateToken,
1856
+ isSignal: true
1857
+ }, {
1858
+ propertyName: "items",
1859
+ predicate: PopupMenuRadioItemToken,
1860
+ isSignal: true
1861
+ }],
1862
+ ngImport: i0,
1863
+ template: "",
1864
+ isInline: true
1865
+ });
1866
+ }
1867
+ };
1868
+ i0.ɵɵngDeclareClassMetadata({
1869
+ minVersion: "12.0.0",
1870
+ version: "22.2.6",
1871
+ ngImport: i0,
1872
+ type: PopupMenuRadioGroupComponent,
1873
+ decorators: [{
1874
+ type: Component,
1875
+ args: [{
1876
+ selector: "mona-popup-menu-radio-group",
1877
+ template: "",
1878
+ providers: [{
1879
+ provide: PopupMenuToken,
1880
+ useExisting: forwardRef(() => PopupMenuRadioGroupComponent)
1881
+ }]
1882
+ }]
1883
+ }],
1884
+ propDecorators: {
1885
+ groupTemplateConfig: [{
1886
+ type: i0.ContentChild,
1887
+ args: [i0.forwardRef(() => PopupMenuGroupTemplateToken), {
1888
+ descendants: false,
1889
+ isSignal: true
1890
+ }]
1891
+ }],
1892
+ items: [{
1893
+ type: i0.ContentChildren,
1894
+ args: [i0.forwardRef(() => PopupMenuRadioItemToken), {
1895
+ descendants: false,
1896
+ isSignal: true
1897
+ }]
1898
+ }],
1899
+ title: [{
1900
+ type: i0.Input,
1901
+ args: [{
1902
+ isSignal: true,
1903
+ alias: "title",
1904
+ required: false
1905
+ }]
1906
+ }],
1907
+ value: [{
1908
+ type: i0.Input,
1909
+ args: [{
1910
+ isSignal: true,
1911
+ alias: "value",
1912
+ required: false
1913
+ }]
1914
+ }, {
1915
+ type: i0.Output,
1916
+ args: ["valueChange"]
1917
+ }]
1918
+ }
1919
+ });
1920
+ var PopupMenuRadioItemComponent = class PopupMenuRadioItemComponent {
1921
+ constructor() {
1922
+ this.#click$ = new Subject();
1923
+ this.#destroyRef = inject(DestroyRef);
1924
+ this.#uid = createElementControlId();
1925
+ this.shortcutTemplateConfig = contentChild(PopupMenuShortcutTemplateToken, {
1926
+ ...ngDevMode ? { debugName: "shortcutTemplateConfig" } : /* istanbul ignore next */ {},
1927
+ descendants: false
1928
+ });
1929
+ this.textTemplateConfig = contentChild(PopupMenuTextTemplateToken, {
1930
+ ...ngDevMode ? { debugName: "textTemplateConfig" } : /* istanbul ignore next */ {},
1931
+ descendants: false
1932
+ });
1933
+ this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
1934
+ this.label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
1935
+ this.menuClick = output();
1936
+ this.origin = PopupMenuOrigin.Popup;
1937
+ this.type = PopupMenuItemType.RadioItem;
1938
+ this.value = input.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
1939
+ }
1940
+ #click$;
1941
+ #destroyRef;
1942
+ #uid;
1943
+ getPopupMenuItem() {
1944
+ return [{
1945
+ click$: this.#click$,
1946
+ disabled: this.disabled(),
1947
+ group: Symbol(),
1948
+ groupTemplate: null,
1949
+ iconTemplate: null,
1950
+ items: [],
1951
+ label: this.label(),
1952
+ radio: true,
1953
+ shortcutTemplate: computed(() => this.shortcutTemplateConfig()?.template ?? null),
1954
+ textTemplate: computed(() => this.textTemplateConfig()?.template ?? null),
1955
+ uid: this.#uid,
1956
+ value: computed(() => this.value())
1957
+ }];
1958
+ }
1959
+ ngOnInit() {
1960
+ this.setSubscription();
1961
+ }
1962
+ setSubscription() {
1963
+ this.#click$.pipe(takeUntilDestroyed(this.#destroyRef), tap((e) => this.menuClick.emit(e))).subscribe();
1964
+ }
1965
+ static {
1966
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1967
+ minVersion: "12.0.0",
1968
+ version: "22.2.6",
1969
+ ngImport: i0,
1970
+ type: PopupMenuRadioItemComponent,
1971
+ deps: [],
1972
+ target: i0.ɵɵFactoryTarget.Component
1973
+ });
1974
+ }
1975
+ static {
1976
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1977
+ minVersion: "17.2.0",
1978
+ version: "22.2.6",
1979
+ type: PopupMenuRadioItemComponent,
1980
+ isStandalone: true,
1981
+ selector: "mona-popup-menu-radio-item",
1982
+ inputs: {
1983
+ disabled: {
1984
+ classPropertyName: "disabled",
1985
+ publicName: "disabled",
1986
+ isSignal: true,
1987
+ isRequired: false,
1988
+ transformFunction: null
1989
+ },
1990
+ label: {
1991
+ classPropertyName: "label",
1992
+ publicName: "label",
1993
+ isSignal: true,
1994
+ isRequired: false,
1995
+ transformFunction: null
1996
+ },
1997
+ value: {
1998
+ classPropertyName: "value",
1999
+ publicName: "value",
2000
+ isSignal: true,
2001
+ isRequired: true,
2002
+ transformFunction: null
2003
+ }
2004
+ },
2005
+ outputs: { menuClick: "menuClick" },
2006
+ providers: [{
2007
+ provide: PopupMenuToken,
2008
+ useExisting: forwardRef(() => PopupMenuRadioItemComponent)
2009
+ }, {
2010
+ provide: PopupMenuRadioItemToken,
2011
+ useExisting: forwardRef(() => PopupMenuRadioItemComponent)
2012
+ }],
2013
+ queries: [{
2014
+ propertyName: "shortcutTemplateConfig",
2015
+ first: true,
2016
+ predicate: PopupMenuShortcutTemplateToken,
2017
+ isSignal: true
2018
+ }, {
2019
+ propertyName: "textTemplateConfig",
2020
+ first: true,
2021
+ predicate: PopupMenuTextTemplateToken,
2022
+ isSignal: true
2023
+ }],
2024
+ ngImport: i0,
2025
+ template: "",
2026
+ isInline: true
2027
+ });
2028
+ }
2029
+ };
2030
+ i0.ɵɵngDeclareClassMetadata({
2031
+ minVersion: "12.0.0",
2032
+ version: "22.2.6",
2033
+ ngImport: i0,
2034
+ type: PopupMenuRadioItemComponent,
2035
+ decorators: [{
2036
+ type: Component,
2037
+ args: [{
2038
+ selector: "mona-popup-menu-radio-item",
2039
+ template: "",
2040
+ providers: [{
2041
+ provide: PopupMenuToken,
2042
+ useExisting: forwardRef(() => PopupMenuRadioItemComponent)
2043
+ }, {
2044
+ provide: PopupMenuRadioItemToken,
2045
+ useExisting: forwardRef(() => PopupMenuRadioItemComponent)
2046
+ }]
2047
+ }]
2048
+ }],
2049
+ propDecorators: {
2050
+ shortcutTemplateConfig: [{
2051
+ type: i0.ContentChild,
2052
+ args: [i0.forwardRef(() => PopupMenuShortcutTemplateToken), {
2053
+ descendants: false,
2054
+ isSignal: true
2055
+ }]
2056
+ }],
2057
+ textTemplateConfig: [{
2058
+ type: i0.ContentChild,
2059
+ args: [i0.forwardRef(() => PopupMenuTextTemplateToken), {
2060
+ descendants: false,
2061
+ isSignal: true
2062
+ }]
2063
+ }],
2064
+ disabled: [{
2065
+ type: i0.Input,
2066
+ args: [{
2067
+ isSignal: true,
2068
+ alias: "disabled",
2069
+ required: false
2070
+ }]
2071
+ }],
2072
+ label: [{
2073
+ type: i0.Input,
2074
+ args: [{
2075
+ isSignal: true,
2076
+ alias: "label",
2077
+ required: false
2078
+ }]
2079
+ }],
2080
+ menuClick: [{
2081
+ type: i0.Output,
2082
+ args: ["menuClick"]
2083
+ }],
2084
+ value: [{
2085
+ type: i0.Input,
2086
+ args: [{
2087
+ isSignal: true,
2088
+ alias: "value",
2089
+ required: true
2090
+ }]
2091
+ }]
2092
+ }
2093
+ });
2094
+ var PopupMenuSeparatorComponent = class PopupMenuSeparatorComponent {
2095
+ constructor() {
2096
+ this.origin = PopupMenuOrigin.Popup;
2097
+ this.type = PopupMenuItemType.Separator;
2098
+ }
2099
+ getPopupMenuItem() {
2100
+ return [{
2101
+ disabled: true,
2102
+ group: Symbol(),
2103
+ groupTemplate: null,
2104
+ iconTemplate: null,
2105
+ items: [],
2106
+ label: "",
2107
+ separator: true,
2108
+ shortcutTemplate: null,
2109
+ textTemplate: null,
2110
+ uid: ""
2111
+ }];
2112
+ }
2113
+ static {
2114
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2115
+ minVersion: "12.0.0",
2116
+ version: "22.2.6",
2117
+ ngImport: i0,
2118
+ type: PopupMenuSeparatorComponent,
2119
+ deps: [],
2120
+ target: i0.ɵɵFactoryTarget.Component
2121
+ });
2122
+ }
2123
+ static {
2124
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
2125
+ minVersion: "14.0.0",
2126
+ version: "22.2.6",
2127
+ type: PopupMenuSeparatorComponent,
2128
+ isStandalone: true,
2129
+ selector: "mona-popup-menu-separator",
2130
+ providers: [{
2131
+ provide: PopupMenuToken,
2132
+ useExisting: forwardRef(() => PopupMenuSeparatorComponent)
2133
+ }],
2134
+ ngImport: i0,
2135
+ template: "",
2136
+ isInline: true
2137
+ });
2138
+ }
2139
+ };
2140
+ i0.ɵɵngDeclareClassMetadata({
2141
+ minVersion: "12.0.0",
2142
+ version: "22.2.6",
2143
+ ngImport: i0,
2144
+ type: PopupMenuSeparatorComponent,
2145
+ decorators: [{
2146
+ type: Component,
2147
+ args: [{
2148
+ selector: "mona-popup-menu-separator",
2149
+ template: "",
2150
+ providers: [{
2151
+ provide: PopupMenuToken,
2152
+ useExisting: forwardRef(() => PopupMenuSeparatorComponent)
2153
+ }]
2154
+ }]
2155
+ }]
2156
+ });
2157
+ var PopupMenuGroupTemplateDirective = class PopupMenuGroupTemplateDirective {
2158
+ constructor() {
2159
+ this.origin = PopupMenuTemplateOrigin.Popup;
2160
+ this.template = inject(TemplateRef);
2161
+ this.type = PopupMenuTemplateType.Group;
2162
+ }
2163
+ static {
2164
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2165
+ minVersion: "12.0.0",
2166
+ version: "22.2.6",
2167
+ ngImport: i0,
2168
+ type: PopupMenuGroupTemplateDirective,
2169
+ deps: [],
2170
+ target: i0.ɵɵFactoryTarget.Directive
2171
+ });
2172
+ }
2173
+ static {
2174
+ this.ɵdir = i0.ɵɵngDeclareDirective({
2175
+ minVersion: "14.0.0",
2176
+ version: "22.2.6",
2177
+ type: PopupMenuGroupTemplateDirective,
2178
+ isStandalone: true,
2179
+ selector: "ng-template[monaPopupMenuGroupTemplate]",
2180
+ providers: [{
2181
+ provide: PopupMenuGroupTemplateToken,
2182
+ useExisting: forwardRef(() => PopupMenuGroupTemplateDirective)
2183
+ }],
2184
+ ngImport: i0
2185
+ });
2186
+ }
2187
+ };
2188
+ i0.ɵɵngDeclareClassMetadata({
2189
+ minVersion: "12.0.0",
2190
+ version: "22.2.6",
2191
+ ngImport: i0,
2192
+ type: PopupMenuGroupTemplateDirective,
2193
+ decorators: [{
2194
+ type: Directive,
2195
+ args: [{
2196
+ selector: "ng-template[monaPopupMenuGroupTemplate]",
2197
+ providers: [{
2198
+ provide: PopupMenuGroupTemplateToken,
2199
+ useExisting: forwardRef(() => PopupMenuGroupTemplateDirective)
2200
+ }]
2201
+ }]
2202
+ }]
2203
+ });
2204
+ var PopupMenuIconTemplateDirective = class PopupMenuIconTemplateDirective {
2205
+ constructor() {
2206
+ this.origin = PopupMenuTemplateOrigin.Popup;
2207
+ this.template = inject(TemplateRef);
2208
+ this.type = PopupMenuTemplateType.Icon;
2209
+ }
2210
+ static {
2211
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2212
+ minVersion: "12.0.0",
2213
+ version: "22.2.6",
2214
+ ngImport: i0,
2215
+ type: PopupMenuIconTemplateDirective,
2216
+ deps: [],
2217
+ target: i0.ɵɵFactoryTarget.Directive
2218
+ });
2219
+ }
2220
+ static {
2221
+ this.ɵdir = i0.ɵɵngDeclareDirective({
2222
+ minVersion: "14.0.0",
2223
+ version: "22.2.6",
2224
+ type: PopupMenuIconTemplateDirective,
2225
+ isStandalone: true,
2226
+ selector: "ng-template[monaPopupMenuIconTemplate]",
2227
+ providers: [{
2228
+ provide: PopupMenuIconTemplateToken,
2229
+ useExisting: forwardRef(() => PopupMenuIconTemplateDirective)
2230
+ }],
2231
+ ngImport: i0
2232
+ });
2233
+ }
2234
+ };
2235
+ i0.ɵɵngDeclareClassMetadata({
2236
+ minVersion: "12.0.0",
2237
+ version: "22.2.6",
2238
+ ngImport: i0,
2239
+ type: PopupMenuIconTemplateDirective,
2240
+ decorators: [{
2241
+ type: Directive,
2242
+ args: [{
2243
+ selector: "ng-template[monaPopupMenuIconTemplate]",
2244
+ providers: [{
2245
+ provide: PopupMenuIconTemplateToken,
2246
+ useExisting: forwardRef(() => PopupMenuIconTemplateDirective)
2247
+ }]
2248
+ }]
2249
+ }]
2250
+ });
2251
+ var PopupMenuShortcutTemplateDirective = class PopupMenuShortcutTemplateDirective {
2252
+ constructor() {
2253
+ this.origin = PopupMenuTemplateOrigin.Popup;
2254
+ this.template = inject(TemplateRef);
2255
+ this.type = PopupMenuTemplateType.Shortcut;
2256
+ }
2257
+ static {
2258
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2259
+ minVersion: "12.0.0",
2260
+ version: "22.2.6",
2261
+ ngImport: i0,
2262
+ type: PopupMenuShortcutTemplateDirective,
2263
+ deps: [],
2264
+ target: i0.ɵɵFactoryTarget.Directive
2265
+ });
2266
+ }
2267
+ static {
2268
+ this.ɵdir = i0.ɵɵngDeclareDirective({
2269
+ minVersion: "14.0.0",
2270
+ version: "22.2.6",
2271
+ type: PopupMenuShortcutTemplateDirective,
2272
+ isStandalone: true,
2273
+ selector: "ng-template[monaPopupMenuShortcutTemplate]",
2274
+ providers: [{
2275
+ provide: PopupMenuShortcutTemplateToken,
2276
+ useExisting: forwardRef(() => PopupMenuShortcutTemplateDirective)
2277
+ }],
2278
+ ngImport: i0
2279
+ });
2280
+ }
2281
+ };
2282
+ i0.ɵɵngDeclareClassMetadata({
2283
+ minVersion: "12.0.0",
2284
+ version: "22.2.6",
2285
+ ngImport: i0,
2286
+ type: PopupMenuShortcutTemplateDirective,
2287
+ decorators: [{
2288
+ type: Directive,
2289
+ args: [{
2290
+ selector: "ng-template[monaPopupMenuShortcutTemplate]",
2291
+ providers: [{
2292
+ provide: PopupMenuShortcutTemplateToken,
2293
+ useExisting: forwardRef(() => PopupMenuShortcutTemplateDirective)
2294
+ }]
2295
+ }]
2296
+ }]
2297
+ });
2298
+ var PopupMenuTextTemplateDirective = class PopupMenuTextTemplateDirective {
2299
+ constructor() {
2300
+ this.origin = PopupMenuTemplateOrigin.Popup;
2301
+ this.template = inject(TemplateRef);
2302
+ this.type = PopupMenuTemplateType.Text;
2303
+ }
2304
+ static {
2305
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2306
+ minVersion: "12.0.0",
2307
+ version: "22.2.6",
2308
+ ngImport: i0,
2309
+ type: PopupMenuTextTemplateDirective,
2310
+ deps: [],
2311
+ target: i0.ɵɵFactoryTarget.Directive
2312
+ });
2313
+ }
2314
+ static {
2315
+ this.ɵdir = i0.ɵɵngDeclareDirective({
2316
+ minVersion: "14.0.0",
2317
+ version: "22.2.6",
2318
+ type: PopupMenuTextTemplateDirective,
2319
+ isStandalone: true,
2320
+ selector: "ng-template[monaPopupMenuTextTemplate]",
2321
+ providers: [{
2322
+ provide: PopupMenuTextTemplateToken,
2323
+ useExisting: forwardRef(() => PopupMenuTextTemplateDirective)
2324
+ }],
2325
+ ngImport: i0
2326
+ });
2327
+ }
2328
+ };
2329
+ i0.ɵɵngDeclareClassMetadata({
2330
+ minVersion: "12.0.0",
2331
+ version: "22.2.6",
2332
+ ngImport: i0,
2333
+ type: PopupMenuTextTemplateDirective,
2334
+ decorators: [{
2335
+ type: Directive,
2336
+ args: [{
2337
+ selector: "ng-template[monaPopupMenuTextTemplate]",
2338
+ providers: [{
2339
+ provide: PopupMenuTextTemplateToken,
2340
+ useExisting: forwardRef(() => PopupMenuTextTemplateDirective)
2341
+ }]
2342
+ }]
2343
+ }]
2344
+ });
2345
+ export { PopupMenuCheckboxItemComponent, PopupMenuCloseEvent, PopupMenuComponent, PopupMenuGroupComponent, PopupMenuGroupTemplateDirective, PopupMenuIconTemplateDirective, PopupMenuItemClickEvent, PopupMenuItemComponent, PopupMenuRadioGroupComponent, PopupMenuRadioItemComponent, PopupMenuSeparatorComponent, PopupMenuShortcutTemplateDirective, PopupMenuTextTemplateDirective };
1716
2346
 
1717
- export { PopupMenuCheckboxItemComponent, PopupMenuCloseEvent, PopupMenuComponent, PopupMenuGroupComponent, PopupMenuGroupTemplateDirective, PopupMenuIconTemplateDirective, PopupMenuItemComponent, PopupMenuRadioGroupComponent, PopupMenuRadioItemComponent, PopupMenuSeparatorComponent, PopupMenuShortcutTemplateDirective, PopupMenuTextTemplateDirective };
1718
- //# sourceMappingURL=nanahoshi-mona-ui-popup-menu.mjs.map
2347
+ //# sourceMappingURL=nanahoshi-mona-ui-popup-menu.mjs.map