@raqm/ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE.md +28 -0
  4. package/README.md +125 -3
  5. package/combobox/README.md +17 -0
  6. package/fesm2022/raqm-ui-accordion.mjs +414 -0
  7. package/fesm2022/raqm-ui-accordion.mjs.map +1 -0
  8. package/fesm2022/raqm-ui-alert-dialog.mjs +457 -0
  9. package/fesm2022/raqm-ui-alert-dialog.mjs.map +1 -0
  10. package/fesm2022/raqm-ui-alert.mjs +195 -0
  11. package/fesm2022/raqm-ui-alert.mjs.map +1 -0
  12. package/fesm2022/raqm-ui-aspect-ratio.mjs +66 -0
  13. package/fesm2022/raqm-ui-aspect-ratio.mjs.map +1 -0
  14. package/fesm2022/raqm-ui-attachment.mjs +435 -0
  15. package/fesm2022/raqm-ui-attachment.mjs.map +1 -0
  16. package/fesm2022/raqm-ui-avatar.mjs +337 -0
  17. package/fesm2022/raqm-ui-avatar.mjs.map +1 -0
  18. package/fesm2022/raqm-ui-badge.mjs +68 -0
  19. package/fesm2022/raqm-ui-badge.mjs.map +1 -0
  20. package/fesm2022/raqm-ui-breadcrumb.mjs +309 -0
  21. package/fesm2022/raqm-ui-breadcrumb.mjs.map +1 -0
  22. package/fesm2022/raqm-ui-button-group.mjs +138 -0
  23. package/fesm2022/raqm-ui-button-group.mjs.map +1 -0
  24. package/fesm2022/raqm-ui-button.mjs +295 -0
  25. package/fesm2022/raqm-ui-button.mjs.map +1 -0
  26. package/fesm2022/raqm-ui-calendar.mjs +1394 -0
  27. package/fesm2022/raqm-ui-calendar.mjs.map +1 -0
  28. package/fesm2022/raqm-ui-card.mjs +331 -0
  29. package/fesm2022/raqm-ui-card.mjs.map +1 -0
  30. package/fesm2022/raqm-ui-carousel.mjs +410 -0
  31. package/fesm2022/raqm-ui-carousel.mjs.map +1 -0
  32. package/fesm2022/raqm-ui-checkbox.mjs +86 -0
  33. package/fesm2022/raqm-ui-checkbox.mjs.map +1 -0
  34. package/fesm2022/raqm-ui-collapsible.mjs +266 -0
  35. package/fesm2022/raqm-ui-collapsible.mjs.map +1 -0
  36. package/fesm2022/raqm-ui-combobox.mjs +1584 -0
  37. package/fesm2022/raqm-ui-combobox.mjs.map +1 -0
  38. package/fesm2022/raqm-ui-command.mjs +1210 -0
  39. package/fesm2022/raqm-ui-command.mjs.map +1 -0
  40. package/fesm2022/raqm-ui-context-menu.mjs +723 -0
  41. package/fesm2022/raqm-ui-context-menu.mjs.map +1 -0
  42. package/fesm2022/raqm-ui-dialog.mjs +1214 -0
  43. package/fesm2022/raqm-ui-dialog.mjs.map +1 -0
  44. package/fesm2022/raqm-ui-drawer.mjs +687 -0
  45. package/fesm2022/raqm-ui-drawer.mjs.map +1 -0
  46. package/fesm2022/raqm-ui-dropdown-menu.mjs +1168 -0
  47. package/fesm2022/raqm-ui-dropdown-menu.mjs.map +1 -0
  48. package/fesm2022/raqm-ui-empty.mjs +272 -0
  49. package/fesm2022/raqm-ui-empty.mjs.map +1 -0
  50. package/fesm2022/raqm-ui-field.mjs +517 -0
  51. package/fesm2022/raqm-ui-field.mjs.map +1 -0
  52. package/fesm2022/raqm-ui-hover-card.mjs +828 -0
  53. package/fesm2022/raqm-ui-hover-card.mjs.map +1 -0
  54. package/fesm2022/raqm-ui-input-group.mjs +270 -0
  55. package/fesm2022/raqm-ui-input-group.mjs.map +1 -0
  56. package/fesm2022/raqm-ui-input-otp.mjs +788 -0
  57. package/fesm2022/raqm-ui-input-otp.mjs.map +1 -0
  58. package/fesm2022/raqm-ui-input.mjs +73 -0
  59. package/fesm2022/raqm-ui-input.mjs.map +1 -0
  60. package/fesm2022/raqm-ui-item.mjs +495 -0
  61. package/fesm2022/raqm-ui-item.mjs.map +1 -0
  62. package/fesm2022/raqm-ui-kbd.mjs +80 -0
  63. package/fesm2022/raqm-ui-kbd.mjs.map +1 -0
  64. package/fesm2022/raqm-ui-label.mjs +44 -0
  65. package/fesm2022/raqm-ui-label.mjs.map +1 -0
  66. package/fesm2022/raqm-ui-menubar.mjs +536 -0
  67. package/fesm2022/raqm-ui-menubar.mjs.map +1 -0
  68. package/fesm2022/raqm-ui-native-select.mjs +131 -0
  69. package/fesm2022/raqm-ui-native-select.mjs.map +1 -0
  70. package/fesm2022/raqm-ui-navigation-menu.mjs +1399 -0
  71. package/fesm2022/raqm-ui-navigation-menu.mjs.map +1 -0
  72. package/fesm2022/raqm-ui-overlay-internal.mjs +185 -0
  73. package/fesm2022/raqm-ui-overlay-internal.mjs.map +1 -0
  74. package/fesm2022/raqm-ui-pagination.mjs +440 -0
  75. package/fesm2022/raqm-ui-pagination.mjs.map +1 -0
  76. package/fesm2022/raqm-ui-popover.mjs +1495 -0
  77. package/fesm2022/raqm-ui-popover.mjs.map +1 -0
  78. package/fesm2022/raqm-ui-progress.mjs +369 -0
  79. package/fesm2022/raqm-ui-progress.mjs.map +1 -0
  80. package/fesm2022/raqm-ui-questionnaire.mjs +1005 -0
  81. package/fesm2022/raqm-ui-questionnaire.mjs.map +1 -0
  82. package/fesm2022/raqm-ui-radio-group.mjs +151 -0
  83. package/fesm2022/raqm-ui-radio-group.mjs.map +1 -0
  84. package/fesm2022/raqm-ui-resizable.mjs +439 -0
  85. package/fesm2022/raqm-ui-resizable.mjs.map +1 -0
  86. package/fesm2022/raqm-ui-scroll-area.mjs +510 -0
  87. package/fesm2022/raqm-ui-scroll-area.mjs.map +1 -0
  88. package/fesm2022/raqm-ui-select.mjs +1073 -0
  89. package/fesm2022/raqm-ui-select.mjs.map +1 -0
  90. package/fesm2022/raqm-ui-separator.mjs +103 -0
  91. package/fesm2022/raqm-ui-separator.mjs.map +1 -0
  92. package/fesm2022/raqm-ui-sheet.mjs +411 -0
  93. package/fesm2022/raqm-ui-sheet.mjs.map +1 -0
  94. package/fesm2022/raqm-ui-sidebar.mjs +1784 -0
  95. package/fesm2022/raqm-ui-sidebar.mjs.map +1 -0
  96. package/fesm2022/raqm-ui-skeleton.mjs +50 -0
  97. package/fesm2022/raqm-ui-skeleton.mjs.map +1 -0
  98. package/fesm2022/raqm-ui-slider.mjs +609 -0
  99. package/fesm2022/raqm-ui-slider.mjs.map +1 -0
  100. package/fesm2022/raqm-ui-spinner.mjs +137 -0
  101. package/fesm2022/raqm-ui-spinner.mjs.map +1 -0
  102. package/fesm2022/raqm-ui-switch.mjs +109 -0
  103. package/fesm2022/raqm-ui-switch.mjs.map +1 -0
  104. package/fesm2022/raqm-ui-table.mjs +271 -0
  105. package/fesm2022/raqm-ui-table.mjs.map +1 -0
  106. package/fesm2022/raqm-ui-tabs.mjs +536 -0
  107. package/fesm2022/raqm-ui-tabs.mjs.map +1 -0
  108. package/fesm2022/raqm-ui-textarea.mjs +37 -0
  109. package/fesm2022/raqm-ui-textarea.mjs.map +1 -0
  110. package/fesm2022/raqm-ui-toast.mjs +918 -0
  111. package/fesm2022/raqm-ui-toast.mjs.map +1 -0
  112. package/fesm2022/raqm-ui-toggle-group.mjs +462 -0
  113. package/fesm2022/raqm-ui-toggle-group.mjs.map +1 -0
  114. package/fesm2022/raqm-ui-toggle.mjs +158 -0
  115. package/fesm2022/raqm-ui-toggle.mjs.map +1 -0
  116. package/fesm2022/raqm-ui-tooltip.mjs +1226 -0
  117. package/fesm2022/raqm-ui-tooltip.mjs.map +1 -0
  118. package/fesm2022/raqm-ui.mjs +50 -0
  119. package/input-otp/README.md +12 -0
  120. package/package.json +275 -3
  121. package/styles/theme.css +4322 -0
  122. package/types/raqm-ui-accordion.d.ts +124 -0
  123. package/types/raqm-ui-alert-dialog.d.ts +81 -0
  124. package/types/raqm-ui-alert.d.ts +29 -0
  125. package/types/raqm-ui-aspect-ratio.d.ts +13 -0
  126. package/types/raqm-ui-attachment.d.ts +72 -0
  127. package/types/raqm-ui-avatar.d.ts +67 -0
  128. package/types/raqm-ui-badge.d.ts +20 -0
  129. package/types/raqm-ui-breadcrumb.d.ts +35 -0
  130. package/types/raqm-ui-button-group.d.ts +27 -0
  131. package/types/raqm-ui-button.d.ts +80 -0
  132. package/types/raqm-ui-calendar.d.ts +359 -0
  133. package/types/raqm-ui-card.d.ts +34 -0
  134. package/types/raqm-ui-carousel.d.ts +81 -0
  135. package/types/raqm-ui-checkbox.d.ts +24 -0
  136. package/types/raqm-ui-collapsible.d.ts +72 -0
  137. package/types/raqm-ui-combobox.d.ts +405 -0
  138. package/types/raqm-ui-command.d.ts +256 -0
  139. package/types/raqm-ui-context-menu.d.ts +196 -0
  140. package/types/raqm-ui-dialog.d.ts +232 -0
  141. package/types/raqm-ui-drawer.d.ts +121 -0
  142. package/types/raqm-ui-dropdown-menu.d.ts +319 -0
  143. package/types/raqm-ui-empty.d.ts +35 -0
  144. package/types/raqm-ui-field.d.ts +88 -0
  145. package/types/raqm-ui-hover-card.d.ts +139 -0
  146. package/types/raqm-ui-input-group.d.ts +45 -0
  147. package/types/raqm-ui-input-otp.d.ts +197 -0
  148. package/types/raqm-ui-input.d.ts +16 -0
  149. package/types/raqm-ui-item.d.ts +71 -0
  150. package/types/raqm-ui-kbd.d.ts +12 -0
  151. package/types/raqm-ui-label.d.ts +6 -0
  152. package/types/raqm-ui-menubar.d.ts +159 -0
  153. package/types/raqm-ui-native-select.d.ts +23 -0
  154. package/types/raqm-ui-navigation-menu.d.ts +230 -0
  155. package/types/raqm-ui-overlay-internal.d.ts +5 -0
  156. package/types/raqm-ui-pagination.d.ts +84 -0
  157. package/types/raqm-ui-popover.d.ts +235 -0
  158. package/types/raqm-ui-progress.d.ts +79 -0
  159. package/types/raqm-ui-questionnaire.d.ts +217 -0
  160. package/types/raqm-ui-radio-group.d.ts +48 -0
  161. package/types/raqm-ui-resizable.d.ts +98 -0
  162. package/types/raqm-ui-scroll-area.d.ts +132 -0
  163. package/types/raqm-ui-select.d.ts +205 -0
  164. package/types/raqm-ui-separator.d.ts +21 -0
  165. package/types/raqm-ui-sheet.d.ts +79 -0
  166. package/types/raqm-ui-sidebar.d.ts +285 -0
  167. package/types/raqm-ui-skeleton.d.ts +6 -0
  168. package/types/raqm-ui-slider.d.ts +129 -0
  169. package/types/raqm-ui-spinner.d.ts +32 -0
  170. package/types/raqm-ui-switch.d.ts +32 -0
  171. package/types/raqm-ui-table.d.ts +36 -0
  172. package/types/raqm-ui-tabs.d.ts +154 -0
  173. package/types/raqm-ui-textarea.d.ts +6 -0
  174. package/types/raqm-ui-toast.d.ts +190 -0
  175. package/types/raqm-ui-toggle-group.d.ts +167 -0
  176. package/types/raqm-ui-toggle.d.ts +42 -0
  177. package/types/raqm-ui-tooltip.d.ts +207 -0
  178. package/types/raqm-ui.d.ts +50 -0
@@ -0,0 +1,1399 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, InjectionToken, Injector, TemplateRef, ViewContainerRef, afterNextRender, booleanAttribute, computed, contentChild, effect, inject, input, isDevMode, model, signal, untracked, viewChild } from "@angular/core";
3
+ import { NgTemplateOutlet } from "@angular/common";
4
+ import { Directionality } from "@angular/cdk/bidi";
5
+ import { Overlay } from "@angular/cdk/overlay";
6
+ import { containsOwnedOverlay, registerOverlayOwnership } from "@raqm/ui/overlay-internal";
7
+ import { FocusKeyManager } from "@angular/cdk/a11y";
8
+ import { TemplatePortal } from "@angular/cdk/portal";
9
+ const RAQM_NAVIGATION_MENU = new InjectionToken("RaqmNavigationMenu");
10
+ const PANE_GLIDE_CLASS = "raqm-navigation-menu-overlay-pane--glide";
11
+ const PANE_GLIDE_LEFT_CLASS = "raqm-navigation-menu-overlay-pane--x-left";
12
+ const PANE_GLIDE_RIGHT_CLASS = "raqm-navigation-menu-overlay-pane--x-right";
13
+ const POPUP_MEASURE_CLASS = "raqm-navigation-menu-popup--measure";
14
+ function prefersReducedMotion() {
15
+ return typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
16
+ }
17
+ function isVisible(element) {
18
+ return element.getClientRects().length > 0;
19
+ }
20
+ var RaqmNavigationMenuDismissal = class {
21
+ host;
22
+ openTimer;
23
+ closeTimer;
24
+ documentPointerDown = (event) => {
25
+ if (this.host.open() && !this.isInsideRootOrOverlay(event.target)) this.host.closeFromUser();
26
+ };
27
+ documentFocusOut = (event) => {
28
+ const target = event.target;
29
+ const overlay = this.host.pane();
30
+ if (target && !this.host.root.contains(target) && !overlay?.contains(target) && this.isInsideRootOrOverlay(target)) this.maybeCloseOnFocusOut(event);
31
+ };
32
+ documentPointerOver = (event) => {
33
+ if (event.pointerType !== "touch" && this.isInsideRootOrOverlay(event.target)) this.cancelHoverClose();
34
+ };
35
+ documentPointerOut = (event) => {
36
+ const overlay = this.host.pane();
37
+ const target = event.target;
38
+ if (event.pointerType !== "touch" && target && !this.host.root.contains(target) && !overlay?.contains(target) && this.isInsideRootOrOverlay(target) && !this.isInsideRootOrOverlay(event.relatedTarget)) this.scheduleHoverClose();
39
+ };
40
+ constructor(host) {
41
+ this.host = host;
42
+ }
43
+ attach() {
44
+ const document = this.host.root.ownerDocument;
45
+ document.addEventListener("pointerdown", this.documentPointerDown, true);
46
+ document.addEventListener("focusout", this.documentFocusOut, true);
47
+ document.addEventListener("pointerover", this.documentPointerOver, true);
48
+ document.addEventListener("pointerout", this.documentPointerOut, true);
49
+ }
50
+ detach() {
51
+ const document = this.host.root.ownerDocument;
52
+ document.removeEventListener("pointerdown", this.documentPointerDown, true);
53
+ document.removeEventListener("focusout", this.documentFocusOut, true);
54
+ document.removeEventListener("pointerover", this.documentPointerOver, true);
55
+ document.removeEventListener("pointerout", this.documentPointerOut, true);
56
+ }
57
+ scheduleHoverOpen(ref) {
58
+ if (ref.disabled || ref.triggerValue === null) return;
59
+ this.cancelHoverClose();
60
+ if (this.host.open()) {
61
+ this.cancelHoverOpen();
62
+ this.host.openFromTrigger(ref, "none");
63
+ return;
64
+ }
65
+ this.cancelHoverOpen();
66
+ this.openTimer = setTimeout(() => {
67
+ this.openTimer = void 0;
68
+ this.host.openFromTrigger(ref, "none");
69
+ }, 50);
70
+ }
71
+ cancelHoverOpen() {
72
+ if (this.openTimer !== void 0) {
73
+ clearTimeout(this.openTimer);
74
+ this.openTimer = void 0;
75
+ }
76
+ }
77
+ scheduleHoverClose() {
78
+ this.cancelHoverOpen();
79
+ this.cancelHoverClose();
80
+ if (!this.host.open()) return;
81
+ this.closeTimer = setTimeout(() => {
82
+ this.closeTimer = void 0;
83
+ this.host.closeFromUser();
84
+ }, 50);
85
+ }
86
+ cancelHoverClose() {
87
+ if (this.closeTimer !== void 0) {
88
+ clearTimeout(this.closeTimer);
89
+ this.closeTimer = void 0;
90
+ }
91
+ }
92
+ onPanelPointerEnter() {
93
+ this.cancelHoverClose();
94
+ }
95
+ onPanelPointerLeave(event) {
96
+ if (event.pointerType === "touch" || this.isInsideRootOrOverlay(event.relatedTarget)) return;
97
+ this.scheduleHoverClose();
98
+ }
99
+ maybeCloseOnFocusOut(event) {
100
+ const next = event.relatedTarget;
101
+ if (this.isInsideRootOrOverlay(next)) return;
102
+ if (!this.host.open()) return;
103
+ const target = event.target;
104
+ const targetInPanel = !!target && this.host.pane()?.contains(target) === true;
105
+ queueMicrotask(() => {
106
+ if (!this.host.open()) return;
107
+ if (targetInPanel && target && !target.isConnected) return;
108
+ if (this.isInsideRootOrOverlay(this.host.root.ownerDocument.activeElement)) return;
109
+ this.host.setUserValue(null);
110
+ });
111
+ }
112
+ isInsideRootOrOverlay(node) {
113
+ if (!node) return false;
114
+ const overlay = this.host.pane();
115
+ return containsOwnedOverlay(this.host.root, node) || (overlay ? containsOwnedOverlay(overlay, node) : false);
116
+ }
117
+ isInsideDetachedOverlay(node) {
118
+ return !!node && !this.host.root.contains(node) && this.isInsideRootOrOverlay(node);
119
+ }
120
+ };
121
+ function connectNavigationMenuEffects(host) {
122
+ effect(() => {
123
+ const next = host.activeEntry();
124
+ untracked(() => host.syncOverlay(next));
125
+ });
126
+ effect(() => {
127
+ const dir = host.resolvedDir();
128
+ untracked(() => host.setKeyManagerDirection(dir));
129
+ });
130
+ effect(() => {
131
+ const align = host.align();
132
+ untracked(() => host.realignOpenPanel(align));
133
+ });
134
+ }
135
+ let nextNavigationMenuId = 0;
136
+ var RaqmNavigationMenuItems = class {
137
+ host;
138
+ topLevelItems = signal([], ...ngDevMode ? [{ debugName: "topLevelItems" }] : /* istanbul ignore next */ []);
139
+ panelLinkElements = signal([], ...ngDevMode ? [{ debugName: "panelLinkElements" }] : /* istanbul ignore next */ []);
140
+ panelRootId = `raqm-navigation-menu-panel-${++nextNavigationMenuId}`;
141
+ activeEntry = computed(() => {
142
+ const value = this.host.value();
143
+ if (value === null) return null;
144
+ return this.topLevelItems().find((item) => item.triggerValue === value) ?? null;
145
+ }, ...ngDevMode ? [{ debugName: "activeEntry" }] : /* istanbul ignore next */ []);
146
+ open = computed(() => this.activeEntry() !== null, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
147
+ activeValue = computed(() => this.activeEntry()?.triggerValue ?? null, ...ngDevMode ? [{ debugName: "activeValue" }] : /* istanbul ignore next */ []);
148
+ constructor(host) {
149
+ this.host = host;
150
+ }
151
+ registerTopLevel(ref) {
152
+ if (isDevMode() && ref.triggerValue !== null) {
153
+ if (ref.triggerValue.trim() === "") console.error("[raqm-navigation-menu] A trigger `value` must be a non-empty string.");
154
+ else if (this.topLevelItems().some((item) => item.triggerValue === ref.triggerValue)) console.error(`[raqm-navigation-menu] Duplicate trigger value "${ref.triggerValue}"; trigger values must be unique.`);
155
+ }
156
+ this.topLevelItems.update((items) => [...items, ref]);
157
+ }
158
+ unregisterTopLevel(ref) {
159
+ this.topLevelItems.update((items) => items.filter((item) => item !== ref));
160
+ }
161
+ registerPanelLink(element) {
162
+ this.panelLinkElements.update((elements) => [...elements, element]);
163
+ }
164
+ unregisterPanelLink(element) {
165
+ this.panelLinkElements.update((elements) => elements.filter((item) => item !== element));
166
+ }
167
+ };
168
+ var RaqmNavigationMenuKeyboard = class {
169
+ state;
170
+ host;
171
+ keyManager;
172
+ constructor(state, host) {
173
+ this.state = state;
174
+ this.host = host;
175
+ }
176
+ init(items, injector, direction) {
177
+ this.keyManager = new FocusKeyManager(items, injector).withWrap(false).withHorizontalOrientation(direction === "rtl" ? "rtl" : "ltr").withVerticalOrientation(false).skipPredicate((item) => item.disabled || !isVisible(item.element));
178
+ }
179
+ setDirection(direction) {
180
+ this.keyManager?.withHorizontalOrientation(direction === "rtl" ? "rtl" : "ltr");
181
+ }
182
+ destroy() {
183
+ this.keyManager?.destroy();
184
+ this.keyManager = void 0;
185
+ }
186
+ moveFocusAcrossTopLevel(event, ref) {
187
+ if (!this.keyManager) return;
188
+ this.keyManager.updateActiveItem(ref);
189
+ this.keyManager.onKeydown(event);
190
+ }
191
+ handleTopLevelTab(event, ref) {
192
+ if (event.shiftKey || !this.host.open()) return;
193
+ const focusable = this.host.topLevelItems().filter((item) => !item.disabled && isVisible(item.element));
194
+ const isLast = focusable[focusable.length - 1] === ref;
195
+ if (this.host.activeEntry() === ref || isLast) {
196
+ event.preventDefault();
197
+ this.focusContent("first");
198
+ }
199
+ }
200
+ handlePanelTab(event, element) {
201
+ const links = this.openPanelLinks();
202
+ const index = links.indexOf(element);
203
+ if (index === -1) return;
204
+ if (event.shiftKey) {
205
+ if (index === 0) {
206
+ event.preventDefault();
207
+ this.host.activeEntry()?.element.focus();
208
+ }
209
+ return;
210
+ }
211
+ if (index === links.length - 1) {
212
+ event.preventDefault();
213
+ const next = this.nextTabbableAfter(this.host.root);
214
+ if (next) next.focus();
215
+ else this.host.closeFromUser();
216
+ }
217
+ }
218
+ focusContent(focus) {
219
+ if (!this.host.open()) return;
220
+ const links = this.openPanelLinks();
221
+ if (links.length === 0) return;
222
+ (focus === "first" ? links[0] : links[links.length - 1]).focus();
223
+ }
224
+ onFocusIn(event) {
225
+ const target = event.target;
226
+ if (!target) return;
227
+ const item = this.host.topLevelItems().find((candidate) => candidate.element === target || candidate.element.contains(target));
228
+ if (item) this.keyManager?.updateActiveItem(item);
229
+ }
230
+ applyPendingFocus() {
231
+ const kind = this.state.pendingFocus;
232
+ this.state.pendingFocus = null;
233
+ if (kind === null) return;
234
+ this.focusContent(kind);
235
+ const overlay = this.host.pane();
236
+ if (overlay && !overlay.contains(document.activeElement)) queueMicrotask(() => this.focusContent(kind));
237
+ }
238
+ openPanelLinks() {
239
+ const overlay = this.host.pane();
240
+ if (!overlay) return [];
241
+ return this.host.panelLinkElements().filter((element) => {
242
+ if (!overlay.contains(element) || !isVisible(element)) return false;
243
+ const content = element.closest(".raqm-navigation-menu-content");
244
+ return content !== null && !content.hasAttribute("inert");
245
+ });
246
+ }
247
+ nextTabbableAfter(root) {
248
+ const candidates = Array.from(document.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])")).filter((element) => isVisible(element) && element.closest("[inert]") === null && !this.host.isInsideRootOrOverlay(element));
249
+ for (const candidate of candidates) {
250
+ const position = root.compareDocumentPosition(candidate);
251
+ if (position & Node.DOCUMENT_POSITION_FOLLOWING && !(position & Node.DOCUMENT_POSITION_CONTAINED_BY)) return candidate;
252
+ }
253
+ return null;
254
+ }
255
+ };
256
+ var RaqmNavigationMenuOverlay = class {
257
+ overlay;
258
+ viewContainerRef;
259
+ state;
260
+ items;
261
+ position;
262
+ pane;
263
+ dismissal;
264
+ keyboard;
265
+ host;
266
+ overlayRef;
267
+ positionStrategy;
268
+ keydownSubscription;
269
+ detachSubscription;
270
+ releaseOwnership;
271
+ switchTimer;
272
+ disposeTimer;
273
+ pendingDisposeOverlay;
274
+ constructor(overlay, viewContainerRef, state, items, position, pane, dismissal, keyboard, host) {
275
+ this.overlay = overlay;
276
+ this.viewContainerRef = viewContainerRef;
277
+ this.state = state;
278
+ this.items = items;
279
+ this.position = position;
280
+ this.pane = pane;
281
+ this.dismissal = dismissal;
282
+ this.keyboard = keyboard;
283
+ this.host = host;
284
+ }
285
+ get ref() {
286
+ return this.overlayRef;
287
+ }
288
+ get element() {
289
+ return this.overlayRef?.overlayElement;
290
+ }
291
+ syncOverlay(next) {
292
+ if (next === this.state.currentRef) return;
293
+ const previous = this.state.currentRef;
294
+ if (next === null) {
295
+ this.state.currentRef = null;
296
+ this.beginClose();
297
+ return;
298
+ }
299
+ if (previous === null) {
300
+ this.state.currentRef = next;
301
+ this.beginOpen(next);
302
+ return;
303
+ }
304
+ this.beginSwitch(previous, next);
305
+ this.state.currentRef = next;
306
+ }
307
+ realignOpenPanel(align) {
308
+ if (this.overlayRef && this.state.currentRef) {
309
+ const strategy = this.position.buildStrategy(this.state.currentRef.element);
310
+ this.positionStrategy = strategy;
311
+ this.overlayRef.updatePositionStrategy(strategy);
312
+ }
313
+ }
314
+ destroy() {
315
+ this.removeDocumentListeners();
316
+ this.keyboard.destroy();
317
+ this.dismissal.cancelHoverOpen();
318
+ this.dismissal.cancelHoverClose();
319
+ this.cancelSwitch();
320
+ this.pane.cancelPaneTransaction();
321
+ this.pane.releaseResizeObserver();
322
+ this.position.releaseSideWatch();
323
+ this.keydownSubscription?.unsubscribe();
324
+ this.keydownSubscription = void 0;
325
+ this.detachSubscription?.unsubscribe();
326
+ this.detachSubscription = void 0;
327
+ const overlayRef = this.overlayRef;
328
+ this.overlayRef = void 0;
329
+ this.positionStrategy = void 0;
330
+ overlayRef?.dispose();
331
+ this.flushPendingDispose();
332
+ }
333
+ removeDocumentListeners() {
334
+ this.dismissal.detach();
335
+ this.releaseOwnership?.();
336
+ this.releaseOwnership = void 0;
337
+ }
338
+ beginOpen(entry) {
339
+ this.flushPendingDispose();
340
+ this.cancelSwitch();
341
+ this.pane.cancelPaneTransaction();
342
+ const direction = this.host.direction();
343
+ this.state.overlayDir.set(direction);
344
+ this.state.activationDirection.set(null);
345
+ this.state.closing.set(false);
346
+ this.state.side.set("bottom");
347
+ this.state.panelId.set(this.items.panelRootId);
348
+ this.state.previousTemplate.set(null);
349
+ this.state.currentTemplate.set(entry.content());
350
+ const strategy = this.position.buildStrategy(entry.element);
351
+ this.positionStrategy = strategy;
352
+ const config = {
353
+ positionStrategy: strategy,
354
+ hasBackdrop: false,
355
+ scrollStrategy: this.overlay.scrollStrategies.reposition(),
356
+ panelClass: "raqm-navigation-menu-overlay-pane",
357
+ disposeOnNavigation: true,
358
+ direction
359
+ };
360
+ const overlayRef = this.overlay.create(config);
361
+ this.overlayRef = overlayRef;
362
+ this.releaseOwnership = registerOverlayOwnership(entry.element, overlayRef);
363
+ this.dismissal.attach();
364
+ this.position.watchSide(strategy);
365
+ this.keydownSubscription = overlayRef.keydownEvents().subscribe((event) => this.handleOverlayKeydown(event));
366
+ this.detachSubscription = overlayRef.detachments().subscribe(() => this.handleDetached());
367
+ overlayRef.attach(new TemplatePortal(this.host.panelTemplate(), this.viewContainerRef));
368
+ this.pane.attachResizeObserver(entry.element);
369
+ this.keyboard.applyPendingFocus();
370
+ }
371
+ beginSwitch(previous, next) {
372
+ const overlayRef = this.overlayRef;
373
+ if (!overlayRef) {
374
+ this.beginOpen(next);
375
+ return;
376
+ }
377
+ this.releaseOwnership?.();
378
+ this.releaseOwnership = registerOverlayOwnership(next.element, overlayRef);
379
+ this.cancelSwitch();
380
+ this.dismissal.cancelHoverClose();
381
+ const previousSide = this.state.side();
382
+ const previousBlockSize = this.pane.currentPopupBlockSize(overlayRef);
383
+ this.pane.cancelPaneTransaction();
384
+ this.state.activationDirection.set(this.directionBetween(previous, next));
385
+ this.pane.restartEnteringSlide();
386
+ this.state.previousTemplate.set(this.state.currentTemplate());
387
+ this.state.currentTemplate.set(next.content());
388
+ this.state.panelId.set(this.items.panelRootId);
389
+ this.position.releaseSideWatch();
390
+ const strategy = this.position.buildStrategy(next.element);
391
+ this.positionStrategy = strategy;
392
+ const pane = overlayRef.overlayElement;
393
+ this.position.armPaneGlideAxes(pane);
394
+ overlayRef.updatePositionStrategy(strategy);
395
+ this.position.watchSide(strategy);
396
+ this.pane.attachResizeObserver(next.element);
397
+ this.pane.schedulePlacement(previousSide, previousBlockSize, () => {
398
+ if (this.state.pendingFocus !== null) this.keyboard.applyPendingFocus();
399
+ });
400
+ if (prefersReducedMotion()) {
401
+ this.state.previousTemplate.set(null);
402
+ this.position.disarmPaneGlideAxes(pane);
403
+ return;
404
+ }
405
+ this.switchTimer = setTimeout(() => {
406
+ this.switchTimer = void 0;
407
+ this.state.previousTemplate.set(null);
408
+ this.position.disarmPaneGlideAxes(overlayRef.overlayElement);
409
+ }, 350);
410
+ }
411
+ beginClose() {
412
+ this.removeDocumentListeners();
413
+ this.cancelSwitch();
414
+ this.pane.cancelPaneTransaction();
415
+ this.dismissal.cancelHoverOpen();
416
+ this.dismissal.cancelHoverClose();
417
+ this.state.previousTemplate.set(null);
418
+ this.state.panelId.set(null);
419
+ const overlayRef = this.overlayRef;
420
+ this.overlayRef = void 0;
421
+ this.positionStrategy = void 0;
422
+ this.position.releaseSideWatch();
423
+ this.keydownSubscription?.unsubscribe();
424
+ this.keydownSubscription = void 0;
425
+ this.detachSubscription?.unsubscribe();
426
+ this.detachSubscription = void 0;
427
+ this.pane.releaseResizeObserver();
428
+ if (!overlayRef) {
429
+ this.state.currentTemplate.set(null);
430
+ return;
431
+ }
432
+ overlayRef.overlayElement.setAttribute("inert", "");
433
+ overlayRef.overlayElement.style.pointerEvents = "none";
434
+ if (prefersReducedMotion()) {
435
+ this.state.currentTemplate.set(null);
436
+ overlayRef.dispose();
437
+ return;
438
+ }
439
+ this.state.closing.set(true);
440
+ this.pendingDisposeOverlay = overlayRef;
441
+ this.disposeTimer = setTimeout(() => {
442
+ this.disposeTimer = void 0;
443
+ this.pendingDisposeOverlay = void 0;
444
+ this.state.closing.set(false);
445
+ this.state.currentTemplate.set(null);
446
+ overlayRef.dispose();
447
+ }, 150);
448
+ }
449
+ flushPendingDispose() {
450
+ if (this.disposeTimer !== void 0) {
451
+ clearTimeout(this.disposeTimer);
452
+ this.disposeTimer = void 0;
453
+ }
454
+ const overlayRef = this.pendingDisposeOverlay;
455
+ this.pendingDisposeOverlay = void 0;
456
+ this.state.closing.set(false);
457
+ overlayRef?.dispose();
458
+ }
459
+ handleDetached() {
460
+ this.removeDocumentListeners();
461
+ this.position.releaseSideWatch();
462
+ this.keydownSubscription?.unsubscribe();
463
+ this.keydownSubscription = void 0;
464
+ this.detachSubscription?.unsubscribe();
465
+ this.detachSubscription = void 0;
466
+ this.pane.releaseResizeObserver();
467
+ this.cancelSwitch();
468
+ this.pane.cancelPaneTransaction();
469
+ this.overlayRef = void 0;
470
+ this.positionStrategy = void 0;
471
+ this.state.currentTemplate.set(null);
472
+ this.state.previousTemplate.set(null);
473
+ this.state.panelId.set(null);
474
+ this.state.closing.set(false);
475
+ this.state.currentRef = null;
476
+ }
477
+ handleOverlayKeydown(event) {
478
+ const overlay = this.overlayRef?.overlayElement;
479
+ if (event.key !== "Escape" || !this.items.open() || !overlay || !overlay.contains(event.target)) return;
480
+ event.preventDefault();
481
+ const trigger = this.items.activeEntry()?.element;
482
+ this.host.closeFromUser();
483
+ trigger?.focus();
484
+ }
485
+ cancelSwitch() {
486
+ if (this.switchTimer !== void 0) {
487
+ clearTimeout(this.switchTimer);
488
+ this.switchTimer = void 0;
489
+ }
490
+ }
491
+ directionBetween(previous, next) {
492
+ const previousRect = previous.element.getBoundingClientRect();
493
+ return next.element.getBoundingClientRect().left > previousRect.left ? "right" : "left";
494
+ }
495
+ };
496
+ var RaqmNavigationMenuPane = class {
497
+ injector;
498
+ host;
499
+ resizeObserver;
500
+ paneTransactionRef;
501
+ paneTransactionGeneration = 0;
502
+ paneSizeFrame;
503
+ panePinnedPopup;
504
+ constructor(injector, host) {
505
+ this.injector = injector;
506
+ this.host = host;
507
+ }
508
+ schedulePlacement(previousSide, previousBlockSize, afterPlacement) {
509
+ const generation = ++this.paneTransactionGeneration;
510
+ this.paneTransactionRef = afterNextRender(() => {
511
+ this.paneTransactionRef = void 0;
512
+ if (generation !== this.paneTransactionGeneration) return;
513
+ this.applySwitchPlacement(previousSide, previousBlockSize, generation);
514
+ afterPlacement();
515
+ }, { injector: this.injector });
516
+ }
517
+ applySwitchPlacement(previousSide, previousBlockSize, generation) {
518
+ const popup = (this.host.overlay()?.overlayElement)?.querySelector(".raqm-navigation-menu-popup");
519
+ if (!popup) {
520
+ this.host.overlay()?.updatePosition();
521
+ return;
522
+ }
523
+ popup.classList.add(POPUP_MEASURE_CLASS);
524
+ this.syncPopupBlockSize();
525
+ this.host.overlay()?.updatePosition();
526
+ const finalBlockSize = popup.style.getPropertyValue("--raqm-navigation-menu-popup-block-size");
527
+ popup.classList.remove(POPUP_MEASURE_CLASS);
528
+ if (finalBlockSize === "") {
529
+ popup.style.removeProperty("block-size");
530
+ popup.style.removeProperty("transition");
531
+ return;
532
+ }
533
+ if (this.host.side() === previousSide && previousBlockSize !== "" && !prefersReducedMotion()) {
534
+ this.cancelPaneSizeFrame();
535
+ popup.style.transition = "none";
536
+ popup.style.blockSize = previousBlockSize;
537
+ this.panePinnedPopup = popup;
538
+ if (typeof requestAnimationFrame === "function") this.paneSizeFrame = requestAnimationFrame(() => {
539
+ this.paneSizeFrame = void 0;
540
+ if (generation !== this.paneTransactionGeneration) return;
541
+ this.releasePanePin();
542
+ });
543
+ else this.releasePanePin();
544
+ return;
545
+ }
546
+ popup.style.removeProperty("block-size");
547
+ popup.style.removeProperty("transition");
548
+ }
549
+ currentPopupBlockSize(overlayRef) {
550
+ const popup = overlayRef.overlayElement.querySelector(".raqm-navigation-menu-popup");
551
+ if (!popup || popup.offsetHeight === 0) return "";
552
+ return `${popup.offsetHeight}px`;
553
+ }
554
+ restartEnteringSlide() {
555
+ const entering = this.host.overlay()?.overlayElement?.querySelector(".raqm-navigation-menu-content--entering");
556
+ if (!entering) return;
557
+ entering.style.animation = "none";
558
+ entering.offsetWidth;
559
+ entering.style.animation = "";
560
+ }
561
+ attachResizeObserver(anchor) {
562
+ this.releaseResizeObserver();
563
+ if (typeof ResizeObserver === "undefined") return;
564
+ this.resizeObserver = new ResizeObserver(() => {
565
+ this.syncPopupBlockSize();
566
+ this.host.overlay()?.updatePosition();
567
+ });
568
+ this.resizeObserver.observe(anchor);
569
+ const overlay = this.host.overlay()?.overlayElement;
570
+ const popup = overlay?.querySelector(".raqm-navigation-menu-popup");
571
+ if (popup) this.resizeObserver.observe(popup);
572
+ const content = overlay?.querySelector(".raqm-navigation-menu-content--entering");
573
+ if (content) this.resizeObserver.observe(content);
574
+ }
575
+ syncPopupBlockSize() {
576
+ const overlay = this.host.overlay()?.overlayElement;
577
+ if (!overlay) return;
578
+ const popup = overlay.querySelector(".raqm-navigation-menu-popup");
579
+ const content = overlay.querySelector(".raqm-navigation-menu-content--entering");
580
+ if (!popup || !content) return;
581
+ popup.style.setProperty("--raqm-navigation-menu-popup-block-size", `${content.offsetHeight}px`);
582
+ }
583
+ releaseResizeObserver() {
584
+ this.resizeObserver?.disconnect();
585
+ this.resizeObserver = void 0;
586
+ }
587
+ cancelPaneTransaction() {
588
+ this.paneTransactionGeneration++;
589
+ this.paneTransactionRef?.destroy();
590
+ this.paneTransactionRef = void 0;
591
+ this.cancelPaneSizeFrame();
592
+ }
593
+ cancelPaneSizeFrame() {
594
+ if (this.paneSizeFrame !== void 0 && typeof cancelAnimationFrame === "function") cancelAnimationFrame(this.paneSizeFrame);
595
+ this.paneSizeFrame = void 0;
596
+ this.releasePanePin();
597
+ }
598
+ releasePanePin() {
599
+ const popup = this.panePinnedPopup;
600
+ if (!popup) return;
601
+ popup.style.removeProperty("block-size");
602
+ popup.style.removeProperty("transition");
603
+ this.panePinnedPopup = void 0;
604
+ }
605
+ };
606
+ var RaqmNavigationMenuPosition = class {
607
+ overlay;
608
+ state;
609
+ host;
610
+ sideSubscription;
611
+ constructor(overlay, state, host) {
612
+ this.overlay = overlay;
613
+ this.state = state;
614
+ this.host = host;
615
+ }
616
+ buildStrategy(origin) {
617
+ const strategy = this.overlay.position().flexibleConnectedTo(origin);
618
+ strategy.withPositions(this.buildPositions()).withFlexibleDimensions(false).withGrowAfterOpen(false).withPush(true).withViewportMargin(5);
619
+ return strategy;
620
+ }
621
+ buildPositions() {
622
+ const align = this.host.align() === "end" ? "end" : "start";
623
+ return [{
624
+ originX: align,
625
+ originY: "bottom",
626
+ overlayX: align,
627
+ overlayY: "top",
628
+ offsetY: 8
629
+ }, {
630
+ originX: align,
631
+ originY: "top",
632
+ overlayX: align,
633
+ overlayY: "bottom",
634
+ offsetY: -8
635
+ }];
636
+ }
637
+ watchSide(strategy) {
638
+ this.sideSubscription = strategy.positionChanges.subscribe((change) => {
639
+ this.state.side.set(change.connectionPair.originY === "top" ? "top" : "bottom");
640
+ this.armPaneGlide(this.host.pane() ?? null);
641
+ });
642
+ }
643
+ releaseSideWatch() {
644
+ this.sideSubscription?.unsubscribe();
645
+ this.sideSubscription = void 0;
646
+ }
647
+ armPaneGlide(pane) {
648
+ pane?.classList.add(PANE_GLIDE_CLASS);
649
+ }
650
+ armPaneGlideAxes(pane) {
651
+ if (!pane) return;
652
+ const usesRight = this.host.direction() === "rtl" ? this.host.align() === "start" : this.host.align() === "end";
653
+ pane.classList.toggle(PANE_GLIDE_LEFT_CLASS, !usesRight);
654
+ pane.classList.toggle(PANE_GLIDE_RIGHT_CLASS, usesRight);
655
+ }
656
+ disarmPaneGlideAxes(pane) {
657
+ pane?.classList.remove(PANE_GLIDE_LEFT_CLASS, PANE_GLIDE_RIGHT_CLASS);
658
+ }
659
+ };
660
+ var RaqmNavigationMenuState = class {
661
+ panelId = signal(null, ...ngDevMode ? [{ debugName: "panelId" }] : /* istanbul ignore next */ []);
662
+ overlayDir = signal("ltr", ...ngDevMode ? [{ debugName: "overlayDir" }] : /* istanbul ignore next */ []);
663
+ currentTemplate = signal(null, ...ngDevMode ? [{ debugName: "currentTemplate" }] : /* istanbul ignore next */ []);
664
+ previousTemplate = signal(null, ...ngDevMode ? [{ debugName: "previousTemplate" }] : /* istanbul ignore next */ []);
665
+ activationDirection = signal(null, ...ngDevMode ? [{ debugName: "activationDirection" }] : /* istanbul ignore next */ []);
666
+ side = signal("bottom", ...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
667
+ closing = signal(false, ...ngDevMode ? [{ debugName: "closing" }] : /* istanbul ignore next */ []);
668
+ currentRef = null;
669
+ pendingFocus = null;
670
+ };
671
+ var RaqmNavigationMenuComponent = class RaqmNavigationMenuComponent {
672
+ host = inject(ElementRef);
673
+ overlay = inject(Overlay);
674
+ viewContainerRef = inject(ViewContainerRef);
675
+ injector = inject(Injector);
676
+ directionality = inject(Directionality, { optional: true });
677
+ panelTemplate = viewChild.required("panel", {
678
+ ...ngDevMode ? { debugName: "panelTemplate" } : /* istanbul ignore next */ {},
679
+ read: TemplateRef
680
+ });
681
+ value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
682
+ align = input("start", ...ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []);
683
+ dir = input(void 0, ...ngDevMode ? [{ debugName: "dir" }] : /* istanbul ignore next */ []);
684
+ state = new RaqmNavigationMenuState();
685
+ items = new RaqmNavigationMenuItems({ value: () => this.value() });
686
+ open = this.items.open;
687
+ activeValue = this.items.activeValue;
688
+ panelId = this.state.panelId;
689
+ overlayDir = this.state.overlayDir;
690
+ currentTemplate = this.state.currentTemplate;
691
+ previousTemplate = this.state.previousTemplate;
692
+ activationDirection = this.state.activationDirection;
693
+ side = this.state.side;
694
+ closing = this.state.closing;
695
+ position = new RaqmNavigationMenuPosition(this.overlay, this.state, {
696
+ align: () => this.align(),
697
+ direction: () => this.resolvedDir(),
698
+ pane: () => this.layer.element
699
+ });
700
+ pane = new RaqmNavigationMenuPane(this.injector, {
701
+ overlay: () => this.layer.ref,
702
+ side: () => this.state.side()
703
+ });
704
+ dismissal = new RaqmNavigationMenuDismissal({
705
+ root: this.host.nativeElement,
706
+ open: () => this.open(),
707
+ pane: () => this.layer.element,
708
+ openFromTrigger: (ref, focusContent) => this.openFromTrigger(ref, focusContent),
709
+ closeFromUser: () => this.closeFromUser(),
710
+ setUserValue: (value) => this.setUserValue(value)
711
+ });
712
+ keyboard = new RaqmNavigationMenuKeyboard(this.state, {
713
+ root: this.host.nativeElement,
714
+ open: () => this.open(),
715
+ activeEntry: () => this.items.activeEntry(),
716
+ topLevelItems: () => this.items.topLevelItems(),
717
+ pane: () => this.layer.element,
718
+ panelLinkElements: () => this.items.panelLinkElements(),
719
+ isInsideRootOrOverlay: (node) => this.dismissal.isInsideRootOrOverlay(node),
720
+ closeFromUser: () => this.closeFromUser()
721
+ });
722
+ layer = new RaqmNavigationMenuOverlay(this.overlay, this.viewContainerRef, this.state, this.items, this.position, this.pane, this.dismissal, this.keyboard, {
723
+ panelTemplate: () => this.panelTemplate(),
724
+ direction: () => this.resolvedDir(),
725
+ closeFromUser: () => this.closeFromUser()
726
+ });
727
+ resolvedDir = computed(() => {
728
+ const explicit = this.dir();
729
+ if (explicit === "ltr" || explicit === "rtl") return explicit;
730
+ if (getComputedStyle(this.host.nativeElement).direction === "rtl") return "rtl";
731
+ return this.directionality?.value ?? "ltr";
732
+ }, ...ngDevMode ? [{ debugName: "resolvedDir" }] : /* istanbul ignore next */ []);
733
+ constructor() {
734
+ connectNavigationMenuEffects({
735
+ activeEntry: () => this.items.activeEntry(),
736
+ resolvedDir: () => this.resolvedDir(),
737
+ align: () => this.align(),
738
+ syncOverlay: (next) => this.layer.syncOverlay(next),
739
+ setKeyManagerDirection: (direction) => this.keyboard.setDirection(direction),
740
+ realignOpenPanel: (align) => this.layer.realignOpenPanel(align)
741
+ });
742
+ }
743
+ ngOnInit() {
744
+ this.keyboard.init(this.items.topLevelItems, this.injector, this.resolvedDir());
745
+ }
746
+ ngOnDestroy() {
747
+ this.layer.destroy();
748
+ }
749
+ isActive(value) {
750
+ return this.activeValue() === value && this.open();
751
+ }
752
+ registerTopLevel(ref) {
753
+ this.items.registerTopLevel(ref);
754
+ }
755
+ unregisterTopLevel(ref) {
756
+ this.items.unregisterTopLevel(ref);
757
+ }
758
+ registerPanelLink(element) {
759
+ this.items.registerPanelLink(element);
760
+ }
761
+ unregisterPanelLink(element) {
762
+ this.items.unregisterPanelLink(element);
763
+ }
764
+ openFromTrigger(ref, focusContent) {
765
+ if (ref.disabled || ref.triggerValue === null) return;
766
+ this.dismissal.cancelHoverOpen();
767
+ this.dismissal.cancelHoverClose();
768
+ if (this.items.activeEntry() === ref) {
769
+ if (focusContent !== "none") this.keyboard.focusContent(focusContent);
770
+ return;
771
+ }
772
+ this.state.pendingFocus = focusContent === "none" ? null : focusContent;
773
+ this.setUserValue(ref.triggerValue);
774
+ }
775
+ toggleFromTrigger(ref) {
776
+ if (ref.disabled || ref.triggerValue === null) return;
777
+ if (this.items.activeEntry() === ref) {
778
+ this.closeFromUser();
779
+ return;
780
+ }
781
+ this.openFromTrigger(ref, "none");
782
+ }
783
+ closeFromUser() {
784
+ this.dismissal.cancelHoverOpen();
785
+ this.dismissal.cancelHoverClose();
786
+ this.setUserValue(null);
787
+ }
788
+ scheduleHoverOpen(ref) {
789
+ this.dismissal.scheduleHoverOpen(ref);
790
+ }
791
+ cancelHoverOpen() {
792
+ this.dismissal.cancelHoverOpen();
793
+ }
794
+ scheduleHoverClose() {
795
+ this.dismissal.scheduleHoverClose();
796
+ }
797
+ cancelHoverClose() {
798
+ this.dismissal.cancelHoverClose();
799
+ }
800
+ moveFocusAcrossTopLevel(event, ref) {
801
+ this.keyboard.moveFocusAcrossTopLevel(event, ref);
802
+ }
803
+ handleTopLevelTab(event, ref) {
804
+ this.keyboard.handleTopLevelTab(event, ref);
805
+ }
806
+ handlePanelTab(event, element) {
807
+ this.keyboard.handlePanelTab(event, element);
808
+ }
809
+ focusContent(focus) {
810
+ this.keyboard.focusContent(focus);
811
+ }
812
+ onFocusIn(event) {
813
+ this.keyboard.onFocusIn(event);
814
+ }
815
+ onFocusOut(event) {
816
+ this.dismissal.maybeCloseOnFocusOut(event);
817
+ }
818
+ onPanelFocusOut(event) {
819
+ this.dismissal.maybeCloseOnFocusOut(event);
820
+ }
821
+ onPanelPointerEnter() {
822
+ this.dismissal.onPanelPointerEnter();
823
+ }
824
+ onPanelPointerLeave(event) {
825
+ this.dismissal.onPanelPointerLeave(event);
826
+ }
827
+ isInsideDetachedOverlay(node) {
828
+ return this.dismissal.isInsideDetachedOverlay(node);
829
+ }
830
+ setUserValue(value) {
831
+ if (this.value() === value) return;
832
+ this.value.set(value);
833
+ }
834
+ static ɵfac = i0.ɵɵngDeclareFactory({
835
+ minVersion: "12.0.0",
836
+ version: "22.2.2",
837
+ ngImport: i0,
838
+ type: RaqmNavigationMenuComponent,
839
+ deps: [],
840
+ target: i0.ɵɵFactoryTarget.Component
841
+ });
842
+ static ɵcmp = i0.ɵɵngDeclareComponent({
843
+ minVersion: "17.0.0",
844
+ version: "22.2.2",
845
+ type: RaqmNavigationMenuComponent,
846
+ isStandalone: true,
847
+ selector: "nav[raqm-navigation-menu]",
848
+ inputs: {
849
+ value: {
850
+ classPropertyName: "value",
851
+ publicName: "value",
852
+ isSignal: true,
853
+ isRequired: false,
854
+ transformFunction: null
855
+ },
856
+ align: {
857
+ classPropertyName: "align",
858
+ publicName: "align",
859
+ isSignal: true,
860
+ isRequired: false,
861
+ transformFunction: null
862
+ },
863
+ dir: {
864
+ classPropertyName: "dir",
865
+ publicName: "dir",
866
+ isSignal: true,
867
+ isRequired: false,
868
+ transformFunction: null
869
+ }
870
+ },
871
+ outputs: { value: "valueChange" },
872
+ host: {
873
+ listeners: {
874
+ "focusout": "onFocusOut($event)",
875
+ "focusin": "onFocusIn($event)"
876
+ },
877
+ properties: { "attr.data-raqm-open": "open() ? \"\" : null" },
878
+ classAttribute: "raqm-navigation-menu"
879
+ },
880
+ providers: [{
881
+ provide: RAQM_NAVIGATION_MENU,
882
+ useExisting: RaqmNavigationMenuComponent
883
+ }],
884
+ viewQueries: [{
885
+ propertyName: "panelTemplate",
886
+ first: true,
887
+ predicate: ["panel"],
888
+ descendants: true,
889
+ read: TemplateRef,
890
+ isSignal: true
891
+ }],
892
+ ngImport: i0,
893
+ template: "<ng-content />\r\n\r\n<ng-template #panel>\r\n <div\r\n class=\"raqm-navigation-menu-popup\"\r\n [attr.dir]=\"overlayDir()\"\r\n [attr.data-raqm-side]=\"side()\"\r\n [attr.data-raqm-activation]=\"activationDirection()\"\r\n [class.raqm-navigation-menu-popup--closing]=\"closing()\"\r\n (focusout)=\"onPanelFocusOut($event)\"\r\n (pointerenter)=\"onPanelPointerEnter()\"\r\n (pointerleave)=\"onPanelPointerLeave($event)\"\r\n >\r\n <!-- Safe pointer path across the 8px gap. -->\r\n <span class=\"raqm-navigation-menu-bridge\" aria-hidden=\"true\"></span>\r\n\r\n <div class=\"raqm-navigation-menu-viewport\">\r\n @if (previousTemplate(); as previous) {\r\n <!-- Outgoing content, inert and hidden from assistive technology while it fades. -->\r\n <div\r\n class=\"raqm-navigation-menu-content raqm-navigation-menu-content--leaving\"\r\n [attr.dir]=\"overlayDir()\"\r\n aria-hidden=\"true\"\r\n inert\r\n >\r\n <ng-container [ngTemplateOutlet]=\"previous\" />\r\n </div>\r\n }\r\n @if (currentTemplate(); as current) {\r\n <div\r\n class=\"raqm-navigation-menu-content raqm-navigation-menu-content--entering\"\r\n [attr.dir]=\"overlayDir()\"\r\n [attr.id]=\"panelId()\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"current\" />\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n</ng-template>\r\n",
894
+ styles: [".raqm-navigation-menu-popup{position:relative;border-radius:var(--raqm-radius-lg);background-color:var(--raqm-popover);color:var(--raqm-popover-foreground);box-shadow:0 0 0 1px color-mix(in oklch,var(--raqm-foreground) 10%,transparent),var(--raqm-shadow-lg);outline:none;block-size:var(--raqm-navigation-menu-popup-block-size, auto);animation:raqm-navigation-menu-popup-in var(--raqm-duration-fast) var(--raqm-ease-emphasized);transition:opacity var(--raqm-duration-base) var(--raqm-ease-standard),transform var(--raqm-duration-base) var(--raqm-ease-standard),block-size .35s var(--raqm-ease-emphasized);transform-origin:center top}.raqm-navigation-menu-popup--measure{transition:none}.raqm-navigation-menu-popup--closing{opacity:0;transform:scale(.9);transition-duration:var(--raqm-duration-base)}@keyframes raqm-navigation-menu-popup-in{0%{opacity:0;transform:scale(.9)}to{opacity:1;transform:none}}.raqm-navigation-menu-bridge{position:absolute;inset-inline:0;block-size:10px;pointer-events:auto}.raqm-navigation-menu-popup[data-raqm-side=bottom] .raqm-navigation-menu-bridge{inset-block-start:-10px}.raqm-navigation-menu-popup[data-raqm-side=top] .raqm-navigation-menu-bridge{inset-block-end:-10px}.raqm-navigation-menu-viewport{position:relative;overflow:hidden;block-size:100%;border-radius:var(--raqm-radius-lg)}.raqm-navigation-menu-content{padding:var(--raqm-spacing);transition:opacity .35s var(--raqm-ease-emphasized),transform .35s var(--raqm-ease-emphasized),translate .35s var(--raqm-ease-emphasized);will-change:opacity,transform}.raqm-navigation-menu-content--leaving{position:absolute;inset-block-start:0;inset-inline:0;opacity:0}.raqm-navigation-menu-popup[data-raqm-activation=left] .raqm-navigation-menu-content--leaving{transform:translate(50%)}.raqm-navigation-menu-popup[data-raqm-activation=right] .raqm-navigation-menu-content--leaving,.raqm-navigation-menu-popup[dir=rtl][data-raqm-activation=left] .raqm-navigation-menu-content--leaving{transform:translate(-50%)}.raqm-navigation-menu-popup[dir=rtl][data-raqm-activation=right] .raqm-navigation-menu-content--leaving{transform:translate(50%)}.raqm-navigation-menu-content--entering{animation-duration:.35s;animation-timing-function:var(--raqm-ease-emphasized)}.raqm-navigation-menu-popup[data-raqm-activation=left] .raqm-navigation-menu-content--entering{animation-name:raqm-navigation-menu-content-from-start}.raqm-navigation-menu-popup[data-raqm-activation=right] .raqm-navigation-menu-content--entering,.raqm-navigation-menu-popup[dir=rtl][data-raqm-activation=left] .raqm-navigation-menu-content--entering{animation-name:raqm-navigation-menu-content-from-end}.raqm-navigation-menu-popup[dir=rtl][data-raqm-activation=right] .raqm-navigation-menu-content--entering{animation-name:raqm-navigation-menu-content-from-start}@keyframes raqm-navigation-menu-content-from-start{0%{opacity:0;transform:translate(-50%)}to{opacity:1;transform:none}}@keyframes raqm-navigation-menu-content-from-end{0%{opacity:0;transform:translate(50%)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.raqm-navigation-menu-popup,.raqm-navigation-menu-popup--closing,.raqm-navigation-menu-content,.raqm-navigation-menu-content--entering,.raqm-navigation-menu-content--leaving{animation:none;transition:none}}\n"],
895
+ dependencies: [{
896
+ kind: "directive",
897
+ type: NgTemplateOutlet,
898
+ selector: "[ngTemplateOutlet]",
899
+ inputs: [
900
+ "ngTemplateOutletContext",
901
+ "ngTemplateOutlet",
902
+ "ngTemplateOutletInjector"
903
+ ]
904
+ }],
905
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
906
+ });
907
+ };
908
+ i0.ɵɵngDeclareClassMetadata({
909
+ minVersion: "12.0.0",
910
+ version: "22.2.2",
911
+ ngImport: i0,
912
+ type: RaqmNavigationMenuComponent,
913
+ decorators: [{
914
+ type: Component,
915
+ args: [{
916
+ selector: "nav[raqm-navigation-menu]",
917
+ imports: [NgTemplateOutlet],
918
+ changeDetection: ChangeDetectionStrategy.OnPush,
919
+ host: {
920
+ class: "raqm-navigation-menu",
921
+ "[attr.data-raqm-open]": "open() ? \"\" : null",
922
+ "(focusout)": "onFocusOut($event)",
923
+ "(focusin)": "onFocusIn($event)"
924
+ },
925
+ providers: [{
926
+ provide: RAQM_NAVIGATION_MENU,
927
+ useExisting: RaqmNavigationMenuComponent
928
+ }],
929
+ template: "<ng-content />\r\n\r\n<ng-template #panel>\r\n <div\r\n class=\"raqm-navigation-menu-popup\"\r\n [attr.dir]=\"overlayDir()\"\r\n [attr.data-raqm-side]=\"side()\"\r\n [attr.data-raqm-activation]=\"activationDirection()\"\r\n [class.raqm-navigation-menu-popup--closing]=\"closing()\"\r\n (focusout)=\"onPanelFocusOut($event)\"\r\n (pointerenter)=\"onPanelPointerEnter()\"\r\n (pointerleave)=\"onPanelPointerLeave($event)\"\r\n >\r\n <!-- Safe pointer path across the 8px gap. -->\r\n <span class=\"raqm-navigation-menu-bridge\" aria-hidden=\"true\"></span>\r\n\r\n <div class=\"raqm-navigation-menu-viewport\">\r\n @if (previousTemplate(); as previous) {\r\n <!-- Outgoing content, inert and hidden from assistive technology while it fades. -->\r\n <div\r\n class=\"raqm-navigation-menu-content raqm-navigation-menu-content--leaving\"\r\n [attr.dir]=\"overlayDir()\"\r\n aria-hidden=\"true\"\r\n inert\r\n >\r\n <ng-container [ngTemplateOutlet]=\"previous\" />\r\n </div>\r\n }\r\n @if (currentTemplate(); as current) {\r\n <div\r\n class=\"raqm-navigation-menu-content raqm-navigation-menu-content--entering\"\r\n [attr.dir]=\"overlayDir()\"\r\n [attr.id]=\"panelId()\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"current\" />\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n</ng-template>\r\n",
930
+ styles: [".raqm-navigation-menu-popup{position:relative;border-radius:var(--raqm-radius-lg);background-color:var(--raqm-popover);color:var(--raqm-popover-foreground);box-shadow:0 0 0 1px color-mix(in oklch,var(--raqm-foreground) 10%,transparent),var(--raqm-shadow-lg);outline:none;block-size:var(--raqm-navigation-menu-popup-block-size, auto);animation:raqm-navigation-menu-popup-in var(--raqm-duration-fast) var(--raqm-ease-emphasized);transition:opacity var(--raqm-duration-base) var(--raqm-ease-standard),transform var(--raqm-duration-base) var(--raqm-ease-standard),block-size .35s var(--raqm-ease-emphasized);transform-origin:center top}.raqm-navigation-menu-popup--measure{transition:none}.raqm-navigation-menu-popup--closing{opacity:0;transform:scale(.9);transition-duration:var(--raqm-duration-base)}@keyframes raqm-navigation-menu-popup-in{0%{opacity:0;transform:scale(.9)}to{opacity:1;transform:none}}.raqm-navigation-menu-bridge{position:absolute;inset-inline:0;block-size:10px;pointer-events:auto}.raqm-navigation-menu-popup[data-raqm-side=bottom] .raqm-navigation-menu-bridge{inset-block-start:-10px}.raqm-navigation-menu-popup[data-raqm-side=top] .raqm-navigation-menu-bridge{inset-block-end:-10px}.raqm-navigation-menu-viewport{position:relative;overflow:hidden;block-size:100%;border-radius:var(--raqm-radius-lg)}.raqm-navigation-menu-content{padding:var(--raqm-spacing);transition:opacity .35s var(--raqm-ease-emphasized),transform .35s var(--raqm-ease-emphasized),translate .35s var(--raqm-ease-emphasized);will-change:opacity,transform}.raqm-navigation-menu-content--leaving{position:absolute;inset-block-start:0;inset-inline:0;opacity:0}.raqm-navigation-menu-popup[data-raqm-activation=left] .raqm-navigation-menu-content--leaving{transform:translate(50%)}.raqm-navigation-menu-popup[data-raqm-activation=right] .raqm-navigation-menu-content--leaving,.raqm-navigation-menu-popup[dir=rtl][data-raqm-activation=left] .raqm-navigation-menu-content--leaving{transform:translate(-50%)}.raqm-navigation-menu-popup[dir=rtl][data-raqm-activation=right] .raqm-navigation-menu-content--leaving{transform:translate(50%)}.raqm-navigation-menu-content--entering{animation-duration:.35s;animation-timing-function:var(--raqm-ease-emphasized)}.raqm-navigation-menu-popup[data-raqm-activation=left] .raqm-navigation-menu-content--entering{animation-name:raqm-navigation-menu-content-from-start}.raqm-navigation-menu-popup[data-raqm-activation=right] .raqm-navigation-menu-content--entering,.raqm-navigation-menu-popup[dir=rtl][data-raqm-activation=left] .raqm-navigation-menu-content--entering{animation-name:raqm-navigation-menu-content-from-end}.raqm-navigation-menu-popup[dir=rtl][data-raqm-activation=right] .raqm-navigation-menu-content--entering{animation-name:raqm-navigation-menu-content-from-start}@keyframes raqm-navigation-menu-content-from-start{0%{opacity:0;transform:translate(-50%)}to{opacity:1;transform:none}}@keyframes raqm-navigation-menu-content-from-end{0%{opacity:0;transform:translate(50%)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.raqm-navigation-menu-popup,.raqm-navigation-menu-popup--closing,.raqm-navigation-menu-content,.raqm-navigation-menu-content--entering,.raqm-navigation-menu-content--leaving{animation:none;transition:none}}\n"]
931
+ }]
932
+ }],
933
+ ctorParameters: () => [],
934
+ propDecorators: {
935
+ panelTemplate: [{
936
+ type: i0.ViewChild,
937
+ args: ["panel", {
938
+ read: TemplateRef,
939
+ isSignal: true
940
+ }]
941
+ }],
942
+ value: [{
943
+ type: i0.Input,
944
+ args: [{
945
+ isSignal: true,
946
+ alias: "value",
947
+ required: false
948
+ }]
949
+ }, {
950
+ type: i0.Output,
951
+ args: ["valueChange"]
952
+ }],
953
+ align: [{
954
+ type: i0.Input,
955
+ args: [{
956
+ isSignal: true,
957
+ alias: "align",
958
+ required: false
959
+ }]
960
+ }],
961
+ dir: [{
962
+ type: i0.Input,
963
+ args: [{
964
+ isSignal: true,
965
+ alias: "dir",
966
+ required: false
967
+ }]
968
+ }]
969
+ }
970
+ });
971
+ const NO_CONTENT = signal(null, ...ngDevMode ? [{ debugName: "NO_CONTENT" }] : /* istanbul ignore next */ []);
972
+ var RaqmNavigationMenuListDirective = class RaqmNavigationMenuListDirective {
973
+ static ɵfac = i0.ɵɵngDeclareFactory({
974
+ minVersion: "12.0.0",
975
+ version: "22.2.2",
976
+ ngImport: i0,
977
+ type: RaqmNavigationMenuListDirective,
978
+ deps: [],
979
+ target: i0.ɵɵFactoryTarget.Directive
980
+ });
981
+ static ɵdir = i0.ɵɵngDeclareDirective({
982
+ minVersion: "14.0.0",
983
+ version: "22.2.2",
984
+ type: RaqmNavigationMenuListDirective,
985
+ isStandalone: true,
986
+ selector: "ul[raqm-navigation-menu-list]",
987
+ host: { classAttribute: "raqm-navigation-menu-list" },
988
+ ngImport: i0
989
+ });
990
+ };
991
+ i0.ɵɵngDeclareClassMetadata({
992
+ minVersion: "12.0.0",
993
+ version: "22.2.2",
994
+ ngImport: i0,
995
+ type: RaqmNavigationMenuListDirective,
996
+ decorators: [{
997
+ type: Directive,
998
+ args: [{
999
+ selector: "ul[raqm-navigation-menu-list]",
1000
+ host: { class: "raqm-navigation-menu-list" }
1001
+ }]
1002
+ }]
1003
+ });
1004
+ var RaqmNavigationMenuTriggerDirective = class RaqmNavigationMenuTriggerDirective {
1005
+ host = inject(ElementRef);
1006
+ menu = inject(RAQM_NAVIGATION_MENU, { optional: true });
1007
+ destroyRef = inject(DestroyRef);
1008
+ value = input.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
1009
+ contentDirective = contentChild(RaqmNavigationMenuContentDirective, ...ngDevMode ? [{ debugName: "contentDirective" }] : /* istanbul ignore next */ []);
1010
+ contentTemplate = computed(() => this.contentDirective()?.content ?? null, ...ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []);
1011
+ disabled = input(false, {
1012
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
1013
+ transform: booleanAttribute
1014
+ });
1015
+ active = computed(() => this.menu?.isActive(this.value()) ?? false, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
1016
+ panelId = computed(() => this.menu?.panelId() ?? null, ...ngDevMode ? [{ debugName: "panelId" }] : /* istanbul ignore next */ []);
1017
+ ref = (() => {
1018
+ const self = this;
1019
+ return {
1020
+ get element() {
1021
+ return self.host.nativeElement;
1022
+ },
1023
+ get triggerValue() {
1024
+ return self.value();
1025
+ },
1026
+ get content() {
1027
+ return self.contentTemplate;
1028
+ },
1029
+ get disabled() {
1030
+ return self.disabled();
1031
+ },
1032
+ focus() {
1033
+ self.host.nativeElement.focus();
1034
+ }
1035
+ };
1036
+ })();
1037
+ constructor() {
1038
+ const element = this.host.nativeElement;
1039
+ if (!element.hasAttribute("type")) element.setAttribute("type", "button");
1040
+ if (isDevMode() && this.menu === null) console.error("[raqm-navigation-menu-trigger] No parent <nav raqm-navigation-menu> found; the trigger cannot open a panel.");
1041
+ this.destroyRef.onDestroy(() => this.menu?.unregisterTopLevel(this.ref));
1042
+ }
1043
+ ngOnInit() {
1044
+ this.menu?.registerTopLevel(this.ref);
1045
+ }
1046
+ onClick() {
1047
+ if (this.disabled()) return;
1048
+ this.menu?.toggleFromTrigger(this.ref);
1049
+ }
1050
+ onKeydown(event) {
1051
+ if (this.disabled()) return;
1052
+ switch (event.key) {
1053
+ case "ArrowDown":
1054
+ event.preventDefault();
1055
+ this.menu?.openFromTrigger(this.ref, "first");
1056
+ return;
1057
+ case "ArrowUp":
1058
+ event.preventDefault();
1059
+ this.menu?.openFromTrigger(this.ref, "last");
1060
+ return;
1061
+ case "Enter":
1062
+ case " ":
1063
+ event.preventDefault();
1064
+ this.menu?.openFromTrigger(this.ref, "first");
1065
+ return;
1066
+ case "Escape":
1067
+ if (this.menu?.open()) {
1068
+ event.preventDefault();
1069
+ this.menu.closeFromUser();
1070
+ }
1071
+ return;
1072
+ case "ArrowLeft":
1073
+ case "ArrowRight":
1074
+ this.menu?.moveFocusAcrossTopLevel(event, this.ref);
1075
+ return;
1076
+ case "Tab":
1077
+ this.menu?.handleTopLevelTab(event, this.ref);
1078
+ return;
1079
+ default: return;
1080
+ }
1081
+ }
1082
+ onPointerEnter(event) {
1083
+ if (event.pointerType === "touch" || this.disabled()) return;
1084
+ this.menu?.scheduleHoverOpen(this.ref);
1085
+ }
1086
+ onPointerLeave(event) {
1087
+ if (event.pointerType === "touch" || this.menu?.isInsideDetachedOverlay(event.relatedTarget)) return;
1088
+ this.menu?.scheduleHoverClose();
1089
+ }
1090
+ static ɵfac = i0.ɵɵngDeclareFactory({
1091
+ minVersion: "12.0.0",
1092
+ version: "22.2.2",
1093
+ ngImport: i0,
1094
+ type: RaqmNavigationMenuTriggerDirective,
1095
+ deps: [],
1096
+ target: i0.ɵɵFactoryTarget.Directive
1097
+ });
1098
+ static ɵdir = i0.ɵɵngDeclareDirective({
1099
+ minVersion: "17.2.0",
1100
+ version: "22.2.2",
1101
+ type: RaqmNavigationMenuTriggerDirective,
1102
+ isStandalone: true,
1103
+ selector: "button[raqm-navigation-menu-trigger]",
1104
+ inputs: {
1105
+ value: {
1106
+ classPropertyName: "value",
1107
+ publicName: "value",
1108
+ isSignal: true,
1109
+ isRequired: true,
1110
+ transformFunction: null
1111
+ },
1112
+ disabled: {
1113
+ classPropertyName: "disabled",
1114
+ publicName: "disabled",
1115
+ isSignal: true,
1116
+ isRequired: false,
1117
+ transformFunction: null
1118
+ }
1119
+ },
1120
+ host: {
1121
+ listeners: {
1122
+ "click": "onClick()",
1123
+ "keydown": "onKeydown($event)",
1124
+ "pointerenter": "onPointerEnter($event)",
1125
+ "pointerleave": "onPointerLeave($event)"
1126
+ },
1127
+ properties: {
1128
+ "attr.aria-expanded": "active() ? \"true\" : \"false\"",
1129
+ "attr.aria-controls": "active() ? panelId() : null",
1130
+ "attr.data-raqm-open": "active() ? \"\" : null",
1131
+ "attr.disabled": "disabled() ? \"\" : null"
1132
+ },
1133
+ classAttribute: "raqm-navigation-menu-trigger"
1134
+ },
1135
+ queries: [{
1136
+ propertyName: "contentDirective",
1137
+ first: true,
1138
+ predicate: RaqmNavigationMenuContentDirective,
1139
+ descendants: true,
1140
+ isSignal: true
1141
+ }],
1142
+ ngImport: i0
1143
+ });
1144
+ };
1145
+ i0.ɵɵngDeclareClassMetadata({
1146
+ minVersion: "12.0.0",
1147
+ version: "22.2.2",
1148
+ ngImport: i0,
1149
+ type: RaqmNavigationMenuTriggerDirective,
1150
+ decorators: [{
1151
+ type: Directive,
1152
+ args: [{
1153
+ selector: "button[raqm-navigation-menu-trigger]",
1154
+ host: {
1155
+ class: "raqm-navigation-menu-trigger",
1156
+ "[attr.aria-expanded]": "active() ? \"true\" : \"false\"",
1157
+ "[attr.aria-controls]": "active() ? panelId() : null",
1158
+ "[attr.data-raqm-open]": "active() ? \"\" : null",
1159
+ "[attr.disabled]": "disabled() ? \"\" : null",
1160
+ "(click)": "onClick()",
1161
+ "(keydown)": "onKeydown($event)",
1162
+ "(pointerenter)": "onPointerEnter($event)",
1163
+ "(pointerleave)": "onPointerLeave($event)"
1164
+ }
1165
+ }]
1166
+ }],
1167
+ ctorParameters: () => [],
1168
+ propDecorators: {
1169
+ value: [{
1170
+ type: i0.Input,
1171
+ args: [{
1172
+ isSignal: true,
1173
+ alias: "value",
1174
+ required: true
1175
+ }]
1176
+ }],
1177
+ contentDirective: [{
1178
+ type: i0.ContentChild,
1179
+ args: [i0.forwardRef(() => RaqmNavigationMenuContentDirective), { isSignal: true }]
1180
+ }],
1181
+ disabled: [{
1182
+ type: i0.Input,
1183
+ args: [{
1184
+ isSignal: true,
1185
+ alias: "disabled",
1186
+ required: false
1187
+ }]
1188
+ }]
1189
+ }
1190
+ });
1191
+ var RaqmNavigationMenuContentDirective = class RaqmNavigationMenuContentDirective {
1192
+ content = inject(TemplateRef);
1193
+ menu = inject(RAQM_NAVIGATION_MENU, { optional: true });
1194
+ constructor() {
1195
+ if (isDevMode() && this.menu === null) console.error("[raqm-navigation-menu-content] No parent <nav raqm-navigation-menu> found; the template is never rendered.");
1196
+ }
1197
+ static ɵfac = i0.ɵɵngDeclareFactory({
1198
+ minVersion: "12.0.0",
1199
+ version: "22.2.2",
1200
+ ngImport: i0,
1201
+ type: RaqmNavigationMenuContentDirective,
1202
+ deps: [],
1203
+ target: i0.ɵɵFactoryTarget.Directive
1204
+ });
1205
+ static ɵdir = i0.ɵɵngDeclareDirective({
1206
+ minVersion: "14.0.0",
1207
+ version: "22.2.2",
1208
+ type: RaqmNavigationMenuContentDirective,
1209
+ isStandalone: true,
1210
+ selector: "ng-template[raqm-navigation-menu-content]",
1211
+ exportAs: ["raqmNavigationMenuContent"],
1212
+ ngImport: i0
1213
+ });
1214
+ };
1215
+ i0.ɵɵngDeclareClassMetadata({
1216
+ minVersion: "12.0.0",
1217
+ version: "22.2.2",
1218
+ ngImport: i0,
1219
+ type: RaqmNavigationMenuContentDirective,
1220
+ decorators: [{
1221
+ type: Directive,
1222
+ args: [{
1223
+ selector: "ng-template[raqm-navigation-menu-content]",
1224
+ exportAs: "raqmNavigationMenuContent"
1225
+ }]
1226
+ }],
1227
+ ctorParameters: () => []
1228
+ });
1229
+ var RaqmNavigationMenuLinkDirective = class RaqmNavigationMenuLinkDirective {
1230
+ host = inject(ElementRef);
1231
+ menu = inject(RAQM_NAVIGATION_MENU, { optional: true });
1232
+ destroyRef = inject(DestroyRef);
1233
+ active = input(false, {
1234
+ ...ngDevMode ? { debugName: "active" } : /* istanbul ignore next */ {},
1235
+ transform: booleanAttribute
1236
+ });
1237
+ constructor() {
1238
+ this.destroyRef.onDestroy(() => this.menu?.unregisterPanelLink(this.host.nativeElement));
1239
+ }
1240
+ ngOnInit() {
1241
+ this.menu?.registerPanelLink(this.host.nativeElement);
1242
+ }
1243
+ onClick(event) {
1244
+ if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
1245
+ this.menu?.closeFromUser();
1246
+ }
1247
+ onKeydown(event) {
1248
+ if (event.key === "Tab") this.menu?.handlePanelTab(event, this.host.nativeElement);
1249
+ }
1250
+ static ɵfac = i0.ɵɵngDeclareFactory({
1251
+ minVersion: "12.0.0",
1252
+ version: "22.2.2",
1253
+ ngImport: i0,
1254
+ type: RaqmNavigationMenuLinkDirective,
1255
+ deps: [],
1256
+ target: i0.ɵɵFactoryTarget.Directive
1257
+ });
1258
+ static ɵdir = i0.ɵɵngDeclareDirective({
1259
+ minVersion: "17.1.0",
1260
+ version: "22.2.2",
1261
+ type: RaqmNavigationMenuLinkDirective,
1262
+ isStandalone: true,
1263
+ selector: "a[raqm-navigation-menu-link]",
1264
+ inputs: { active: {
1265
+ classPropertyName: "active",
1266
+ publicName: "active",
1267
+ isSignal: true,
1268
+ isRequired: false,
1269
+ transformFunction: null
1270
+ } },
1271
+ host: {
1272
+ listeners: {
1273
+ "click": "onClick($event)",
1274
+ "keydown": "onKeydown($event)"
1275
+ },
1276
+ properties: { "attr.aria-current": "active() ? \"page\" : null" },
1277
+ classAttribute: "raqm-navigation-menu-link"
1278
+ },
1279
+ ngImport: i0
1280
+ });
1281
+ };
1282
+ i0.ɵɵngDeclareClassMetadata({
1283
+ minVersion: "12.0.0",
1284
+ version: "22.2.2",
1285
+ ngImport: i0,
1286
+ type: RaqmNavigationMenuLinkDirective,
1287
+ decorators: [{
1288
+ type: Directive,
1289
+ args: [{
1290
+ selector: "a[raqm-navigation-menu-link]",
1291
+ host: {
1292
+ class: "raqm-navigation-menu-link",
1293
+ "[attr.aria-current]": "active() ? \"page\" : null",
1294
+ "(click)": "onClick($event)",
1295
+ "(keydown)": "onKeydown($event)"
1296
+ }
1297
+ }]
1298
+ }],
1299
+ ctorParameters: () => [],
1300
+ propDecorators: { active: [{
1301
+ type: i0.Input,
1302
+ args: [{
1303
+ isSignal: true,
1304
+ alias: "active",
1305
+ required: false
1306
+ }]
1307
+ }] }
1308
+ });
1309
+ var RaqmNavigationMenuTopLinkDirective = class RaqmNavigationMenuTopLinkDirective {
1310
+ host = inject(ElementRef);
1311
+ menu = inject(RAQM_NAVIGATION_MENU, { optional: true });
1312
+ destroyRef = inject(DestroyRef);
1313
+ ref = (() => {
1314
+ const self = this;
1315
+ return {
1316
+ get element() {
1317
+ return self.host.nativeElement;
1318
+ },
1319
+ get triggerValue() {
1320
+ return null;
1321
+ },
1322
+ get content() {
1323
+ return NO_CONTENT;
1324
+ },
1325
+ get disabled() {
1326
+ return false;
1327
+ },
1328
+ focus() {
1329
+ self.host.nativeElement.focus();
1330
+ }
1331
+ };
1332
+ })();
1333
+ constructor() {
1334
+ this.destroyRef.onDestroy(() => this.menu?.unregisterTopLevel(this.ref));
1335
+ }
1336
+ ngOnInit() {
1337
+ this.menu?.registerTopLevel(this.ref);
1338
+ }
1339
+ onKeydown(event) {
1340
+ switch (event.key) {
1341
+ case "ArrowLeft":
1342
+ case "ArrowRight":
1343
+ this.menu?.moveFocusAcrossTopLevel(event, this.ref);
1344
+ return;
1345
+ case "Tab":
1346
+ this.menu?.handleTopLevelTab(event, this.ref);
1347
+ return;
1348
+ default: return;
1349
+ }
1350
+ }
1351
+ static ɵfac = i0.ɵɵngDeclareFactory({
1352
+ minVersion: "12.0.0",
1353
+ version: "22.2.2",
1354
+ ngImport: i0,
1355
+ type: RaqmNavigationMenuTopLinkDirective,
1356
+ deps: [],
1357
+ target: i0.ɵɵFactoryTarget.Directive
1358
+ });
1359
+ static ɵdir = i0.ɵɵngDeclareDirective({
1360
+ minVersion: "14.0.0",
1361
+ version: "22.2.2",
1362
+ type: RaqmNavigationMenuTopLinkDirective,
1363
+ isStandalone: true,
1364
+ selector: "a[raqm-navigation-menu-top-link]",
1365
+ host: {
1366
+ listeners: { "keydown": "onKeydown($event)" },
1367
+ classAttribute: "raqm-navigation-menu-top-link"
1368
+ },
1369
+ ngImport: i0
1370
+ });
1371
+ };
1372
+ i0.ɵɵngDeclareClassMetadata({
1373
+ minVersion: "12.0.0",
1374
+ version: "22.2.2",
1375
+ ngImport: i0,
1376
+ type: RaqmNavigationMenuTopLinkDirective,
1377
+ decorators: [{
1378
+ type: Directive,
1379
+ args: [{
1380
+ selector: "a[raqm-navigation-menu-top-link]",
1381
+ host: {
1382
+ class: "raqm-navigation-menu-top-link",
1383
+ "(keydown)": "onKeydown($event)"
1384
+ }
1385
+ }]
1386
+ }],
1387
+ ctorParameters: () => []
1388
+ });
1389
+ const RaqmNavigationMenu = [
1390
+ RaqmNavigationMenuComponent,
1391
+ RaqmNavigationMenuListDirective,
1392
+ RaqmNavigationMenuTriggerDirective,
1393
+ RaqmNavigationMenuContentDirective,
1394
+ RaqmNavigationMenuLinkDirective,
1395
+ RaqmNavigationMenuTopLinkDirective
1396
+ ];
1397
+ export { RaqmNavigationMenu, RaqmNavigationMenuComponent, RaqmNavigationMenuContentDirective, RaqmNavigationMenuLinkDirective, RaqmNavigationMenuListDirective, RaqmNavigationMenuTopLinkDirective, RaqmNavigationMenuTriggerDirective };
1398
+
1399
+ //# sourceMappingURL=raqm-ui-navigation-menu.mjs.map