@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,1495 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, InjectionToken, Injector, TemplateRef, ViewContainerRef, afterNextRender, booleanAttribute, computed, effect, inject, input, isDevMode, model, numberAttribute, signal, untracked, viewChild } from "@angular/core";
3
+ import { NgTemplateOutlet } from "@angular/common";
4
+ import { InteractivityChecker } from "@angular/cdk/a11y";
5
+ import { Directionality } from "@angular/cdk/bidi";
6
+ import { Overlay } from "@angular/cdk/overlay";
7
+ import { ScrollDispatcher, ViewportRuler } from "@angular/cdk/scrolling";
8
+ import { containsOwnedOverlay, registerOverlayOwnership } from "@raqm/ui/overlay-internal";
9
+ import { TemplatePortal } from "@angular/cdk/portal";
10
+ const RAQM_POPOVER = new InjectionToken("RaqmPopover");
11
+ var RaqmPopoverDismissal = class {
12
+ host;
13
+ constructor(host) {
14
+ this.host = host;
15
+ }
16
+ maybeCloseOnFocusOut(event) {
17
+ const next = event.relatedTarget;
18
+ if (this.isInsideRootOrOverlay(next)) return;
19
+ if (!this.host.open()) return;
20
+ const target = event.target;
21
+ const targetInPanel = !!target && this.host.pane()?.contains(target) === true;
22
+ const generation = this.host.generation();
23
+ const overlay = this.host.pane();
24
+ queueMicrotask(() => {
25
+ if (generation !== this.host.generation() || this.host.pane() !== overlay || !this.host.openValue() || this.host.disabled() || !this.host.canOpen()) return;
26
+ if (targetInPanel && target && !target.isConnected) return;
27
+ if (this.isInsideRootOrOverlay(document.activeElement)) return;
28
+ this.setClosed();
29
+ });
30
+ }
31
+ isInsideRootOrOverlay(node) {
32
+ if (!node) return false;
33
+ const overlay = this.host.pane();
34
+ return containsOwnedOverlay(this.host.root, node) || overlay !== void 0 && containsOwnedOverlay(overlay, node);
35
+ }
36
+ setClosed() {
37
+ if (this.host.openValue()) this.host.setOpen(false);
38
+ }
39
+ };
40
+ function connectPopoverEffects(host) {
41
+ effect(() => {
42
+ const next = host.openValue() && !host.disabled() && host.canOpen();
43
+ untracked(() => host.syncOpen(next));
44
+ });
45
+ effect(() => {
46
+ host.side();
47
+ host.align();
48
+ host.sideOffset();
49
+ host.alignOffset();
50
+ host.dir();
51
+ untracked(() => host.applyPositionInputs());
52
+ });
53
+ effect(() => {
54
+ host.label();
55
+ untracked(() => host.syncPanelAria());
56
+ });
57
+ effect(() => {
58
+ const panelClass = host.panelClass();
59
+ untracked(() => host.applyPanelClass(panelClass));
60
+ });
61
+ }
62
+ const SIDES = [
63
+ "top",
64
+ "bottom",
65
+ "left",
66
+ "right",
67
+ "inline-start",
68
+ "inline-end"
69
+ ];
70
+ const ALIGNS = [
71
+ "start",
72
+ "center",
73
+ "end"
74
+ ];
75
+ const DEFAULT_SIDE = "bottom";
76
+ const DEFAULT_ALIGN = "center";
77
+ const DEFAULT_WIDTH = "18rem";
78
+ const PANE_CLASS = "raqm-popover-overlay-pane";
79
+ const FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"]";
80
+ function sameBoxSize(a, b) {
81
+ return a !== void 0 && b !== void 0 && Math.abs(a.width - b.width) <= 1 && Math.abs(a.height - b.height) <= 1;
82
+ }
83
+ function prefersReducedMotion() {
84
+ return typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
85
+ }
86
+ function toSide(value) {
87
+ return SIDES.includes(value) ? value : DEFAULT_SIDE;
88
+ }
89
+ function toAlign(value) {
90
+ return ALIGNS.includes(value) ? value : DEFAULT_ALIGN;
91
+ }
92
+ function toDir(value) {
93
+ return value === "ltr" || value === "rtl" ? value : void 0;
94
+ }
95
+ function toOffset(fallback) {
96
+ return (value) => {
97
+ const parsed = numberAttribute(value, fallback);
98
+ return Number.isFinite(parsed) ? parsed : fallback;
99
+ };
100
+ }
101
+ function resolvePopoverDirection(dir, element, directionality) {
102
+ const explicit = dir;
103
+ if (explicit === "ltr" || explicit === "rtl") return explicit;
104
+ const computedStyle = getComputedStyle(element).direction;
105
+ if (computedStyle === "rtl") return "rtl";
106
+ if (computedStyle === "ltr") return "ltr";
107
+ return directionality?.value ?? "ltr";
108
+ }
109
+ var RaqmPopoverKeyboard = class {
110
+ checker;
111
+ host;
112
+ constructor(checker, host) {
113
+ this.checker = checker;
114
+ this.host = host;
115
+ }
116
+ focusFirstInPanel() {
117
+ const content = this.host.content();
118
+ if (!content) return;
119
+ (this.firstFocusable(content) ?? content).focus();
120
+ }
121
+ onTriggerTab(event) {
122
+ if (event.shiftKey || !this.host.open()) return;
123
+ event.preventDefault();
124
+ this.focusFirstInPanel();
125
+ }
126
+ onPanelKeydown(event) {
127
+ if (event.key === "Escape") {
128
+ if (this.host.open()) {
129
+ event.preventDefault();
130
+ event.stopPropagation();
131
+ this.host.closeFromUser();
132
+ this.host.trigger()?.focus();
133
+ }
134
+ return;
135
+ }
136
+ if (event.key === "Tab") this.handlePanelTab(event);
137
+ }
138
+ focusInitial(overlayRef, generation) {
139
+ if (this.host.overlayRef() !== overlayRef) return;
140
+ this.focusFirstInPanel();
141
+ if (!overlayRef.overlayElement.contains(document.activeElement)) queueMicrotask(() => {
142
+ if (generation !== this.host.generation() || this.host.overlayRef() !== overlayRef || !this.host.openValue() || this.host.disabled() || !this.host.canOpen()) return;
143
+ this.focusFirstInPanel();
144
+ });
145
+ }
146
+ firstFocusable(root) {
147
+ const candidates = root.querySelectorAll(FOCUSABLE_SELECTOR);
148
+ for (const candidate of Array.from(candidates)) if (this.checker.isFocusable(candidate)) return candidate;
149
+ return null;
150
+ }
151
+ panelTabbables() {
152
+ const content = this.host.content();
153
+ if (!content) return [];
154
+ return Array.from(content.querySelectorAll(FOCUSABLE_SELECTOR)).filter((element) => this.checker.isTabbable(element));
155
+ }
156
+ handlePanelTab(event) {
157
+ const content = this.host.content();
158
+ if (!content) return;
159
+ const tabbables = this.panelTabbables();
160
+ const active = document.activeElement;
161
+ if (event.shiftKey) {
162
+ const atStart = tabbables.length > 0 ? active === tabbables[0] : active === content;
163
+ const trigger = this.host.trigger();
164
+ if (atStart && trigger) {
165
+ event.preventDefault();
166
+ trigger.focus();
167
+ }
168
+ return;
169
+ }
170
+ if (!(tabbables.length > 0 ? active === tabbables[tabbables.length - 1] : active === content)) return;
171
+ const next = this.nextTabbableAfterRoot();
172
+ if (next) {
173
+ event.preventDefault();
174
+ next.focus();
175
+ }
176
+ }
177
+ nextTabbableAfterRoot() {
178
+ const root = this.host.root;
179
+ const overlay = this.host.pane();
180
+ const candidates = Array.from(document.querySelectorAll(FOCUSABLE_SELECTOR)).filter((element) => this.checker.isTabbable(element) && element.closest("[inert]") === null && (!overlay || !containsOwnedOverlay(overlay, element)));
181
+ for (const candidate of candidates) {
182
+ const position = root.compareDocumentPosition(candidate);
183
+ if (position & Node.DOCUMENT_POSITION_FOLLOWING && !(position & Node.DOCUMENT_POSITION_CONTAINED_BY)) return candidate;
184
+ }
185
+ return null;
186
+ }
187
+ };
188
+ var RaqmPopoverOverlay = class {
189
+ overlay;
190
+ scrollDispatcher;
191
+ viewportRuler;
192
+ viewContainerRef;
193
+ injector;
194
+ state;
195
+ position;
196
+ sizing;
197
+ host;
198
+ overlayRef;
199
+ outsideSubscription;
200
+ detachSubscription;
201
+ viewportSubscription;
202
+ scrollSubscription;
203
+ ownedFocusOut = (event) => {
204
+ const target = event.target;
205
+ const pane = this.overlayRef?.overlayElement;
206
+ if (pane && target && !pane.contains(target) && containsOwnedOverlay(pane, target)) this.host.maybeCloseOnFocusOut(event);
207
+ };
208
+ renderTransaction;
209
+ disposeTimer;
210
+ pendingDisposeOverlay;
211
+ appliedPanelClass;
212
+ constructor(overlay, scrollDispatcher, viewportRuler, viewContainerRef, injector, state, position, sizing, host) {
213
+ this.overlay = overlay;
214
+ this.scrollDispatcher = scrollDispatcher;
215
+ this.viewportRuler = viewportRuler;
216
+ this.viewContainerRef = viewContainerRef;
217
+ this.injector = injector;
218
+ this.state = state;
219
+ this.position = position;
220
+ this.sizing = sizing;
221
+ this.host = host;
222
+ }
223
+ get element() {
224
+ return this.overlayRef?.overlayElement;
225
+ }
226
+ get ref() {
227
+ return this.overlayRef;
228
+ }
229
+ contentElement() {
230
+ return this.overlayRef?.overlayElement.querySelector(".raqm-popover-content") ?? null;
231
+ }
232
+ updatePosition() {
233
+ this.overlayRef?.updatePosition();
234
+ }
235
+ setDirection(dir) {
236
+ this.overlayRef?.setDirection(dir);
237
+ }
238
+ syncOpen(next) {
239
+ if (next === this.state.currentOpen) return;
240
+ if (next) {
241
+ this.state.currentOpen = true;
242
+ this.beginOpen();
243
+ return;
244
+ }
245
+ this.state.currentOpen = false;
246
+ this.beginClose();
247
+ }
248
+ beginOpen() {
249
+ const trigger = this.host.trigger();
250
+ const template = this.host.contentTemplate();
251
+ const panelTemplate = this.host.panelTemplate();
252
+ if (!trigger || !template || !panelTemplate) {
253
+ this.state.currentOpen = false;
254
+ return;
255
+ }
256
+ this.flushPendingDispose();
257
+ this.cancelRenderTransaction();
258
+ const generation = ++this.state.openGeneration;
259
+ this.state.closing.set(false);
260
+ this.state.attached.set(false);
261
+ this.state.panelId.set(this.host.panelRootId);
262
+ this.sizing.naturalContentSize = void 0;
263
+ this.sizing.expectedContentSize = void 0;
264
+ const dir = this.host.direction();
265
+ this.state.currentDir = dir;
266
+ this.state.panelDir.set(dir);
267
+ const preferredSide = this.position.resolvePhysicalSide(this.host.side());
268
+ this.state.resolvedSide.set(preferredSide);
269
+ this.state.transformOrigin.set(this.position.computeTransformOrigin(preferredSide, this.host.align()));
270
+ const strategy = this.position.buildStrategy(trigger.element);
271
+ const config = {
272
+ positionStrategy: strategy,
273
+ hasBackdrop: false,
274
+ scrollStrategy: this.overlay.scrollStrategies.noop(),
275
+ panelClass: this.panelClasses(),
276
+ disposeOnNavigation: true,
277
+ direction: dir
278
+ };
279
+ const overlayRef = this.overlay.create(config);
280
+ registerOverlayOwnership(trigger.element, overlayRef);
281
+ this.overlayRef = overlayRef;
282
+ this.appliedPanelClass = this.host.panelClass();
283
+ this.position.watchSide(strategy);
284
+ this.outsideSubscription = overlayRef.outsidePointerEvents().subscribe((event) => {
285
+ const target = event.target;
286
+ if (this.host.isInsideRootOrOverlay(target)) return;
287
+ this.host.closeFromUser();
288
+ });
289
+ this.detachSubscription = overlayRef.detachments().subscribe(() => this.handleDetached());
290
+ this.host.root.ownerDocument.addEventListener("focusout", this.ownedFocusOut, true);
291
+ this.viewportSubscription = this.viewportRuler.change(0).subscribe(() => {
292
+ this.position.reposition();
293
+ });
294
+ this.scrollSubscription = this.scrollDispatcher.ancestorScrolled(trigger.element, 0).subscribe(() => this.position.reposition());
295
+ overlayRef.attach(new TemplatePortal(panelTemplate, this.viewContainerRef));
296
+ overlayRef.overlayElement.style.visibility = "hidden";
297
+ overlayRef.overlayElement.style.pointerEvents = "none";
298
+ this.state.attached.set(true);
299
+ this.sizing.attachResizeObserver(trigger.element);
300
+ this.startPlacementTransaction(overlayRef, generation);
301
+ }
302
+ startPlacementTransaction(overlayRef, generation) {
303
+ this.renderTransaction = afterNextRender(() => {
304
+ this.renderTransaction = void 0;
305
+ if (generation !== this.state.openGeneration || this.overlayRef !== overlayRef) return;
306
+ this.position.reposition();
307
+ this.revealAndFocus(overlayRef, generation);
308
+ }, { injector: this.injector });
309
+ }
310
+ revealAndFocus(overlayRef, generation) {
311
+ const pane = overlayRef.overlayElement;
312
+ const content = pane.querySelector(".raqm-popover-content");
313
+ if (!content || this.overlayRef !== overlayRef) return;
314
+ this.host.syncPanelAria();
315
+ content.classList.add("raqm-popover-content--entering");
316
+ pane.style.pointerEvents = "";
317
+ pane.style.visibility = "";
318
+ this.host.focusInitial(overlayRef, generation);
319
+ }
320
+ beginClose() {
321
+ this.host.root.ownerDocument.removeEventListener("focusout", this.ownedFocusOut, true);
322
+ this.state.panelId.set(null);
323
+ this.state.closing.set(false);
324
+ this.cancelRenderTransaction();
325
+ this.state.attached.set(false);
326
+ const overlayRef = this.overlayRef;
327
+ this.overlayRef = void 0;
328
+ this.position.clearStrategy();
329
+ this.position.releaseSideWatch();
330
+ this.outsideSubscription?.unsubscribe();
331
+ this.outsideSubscription = void 0;
332
+ this.detachSubscription?.unsubscribe();
333
+ this.detachSubscription = void 0;
334
+ this.viewportSubscription?.unsubscribe();
335
+ this.viewportSubscription = void 0;
336
+ this.scrollSubscription?.unsubscribe();
337
+ this.scrollSubscription = void 0;
338
+ this.sizing.releaseResizeObserver();
339
+ this.appliedPanelClass = void 0;
340
+ if (!overlayRef) return;
341
+ overlayRef.overlayElement.setAttribute("inert", "");
342
+ overlayRef.overlayElement.setAttribute("aria-hidden", "true");
343
+ if (prefersReducedMotion()) {
344
+ overlayRef.dispose();
345
+ return;
346
+ }
347
+ const content = overlayRef.overlayElement.querySelector(".raqm-popover-content");
348
+ content?.classList.remove("raqm-popover-content--entering");
349
+ content?.classList.add("raqm-popover-content--closing");
350
+ this.state.closing.set(true);
351
+ this.pendingDisposeOverlay = overlayRef;
352
+ this.disposeTimer = setTimeout(() => {
353
+ this.disposeTimer = void 0;
354
+ this.pendingDisposeOverlay = void 0;
355
+ this.state.closing.set(false);
356
+ overlayRef.dispose();
357
+ }, 100);
358
+ }
359
+ flushPendingDispose() {
360
+ if (this.disposeTimer !== void 0) {
361
+ clearTimeout(this.disposeTimer);
362
+ this.disposeTimer = void 0;
363
+ }
364
+ const overlayRef = this.pendingDisposeOverlay;
365
+ this.pendingDisposeOverlay = void 0;
366
+ this.state.closing.set(false);
367
+ overlayRef?.dispose();
368
+ }
369
+ cancelRenderTransaction() {
370
+ this.renderTransaction?.destroy();
371
+ this.renderTransaction = void 0;
372
+ }
373
+ handleDetached() {
374
+ this.host.root.ownerDocument.removeEventListener("focusout", this.ownedFocusOut, true);
375
+ this.position.releaseSideWatch();
376
+ this.outsideSubscription?.unsubscribe();
377
+ this.outsideSubscription = void 0;
378
+ this.detachSubscription?.unsubscribe();
379
+ this.detachSubscription = void 0;
380
+ this.viewportSubscription?.unsubscribe();
381
+ this.viewportSubscription = void 0;
382
+ this.scrollSubscription?.unsubscribe();
383
+ this.scrollSubscription = void 0;
384
+ this.sizing.releaseResizeObserver();
385
+ this.overlayRef = void 0;
386
+ this.position.clearStrategy();
387
+ this.state.panelId.set(null);
388
+ this.state.closing.set(false);
389
+ this.state.currentOpen = false;
390
+ this.appliedPanelClass = void 0;
391
+ this.cancelRenderTransaction();
392
+ this.state.attached.set(false);
393
+ this.host.setClosed();
394
+ }
395
+ destroy() {
396
+ this.host.root.ownerDocument.removeEventListener("focusout", this.ownedFocusOut, true);
397
+ this.state.openGeneration += 1;
398
+ this.position.releaseSideWatch();
399
+ this.outsideSubscription?.unsubscribe();
400
+ this.outsideSubscription = void 0;
401
+ this.detachSubscription?.unsubscribe();
402
+ this.detachSubscription = void 0;
403
+ this.viewportSubscription?.unsubscribe();
404
+ this.viewportSubscription = void 0;
405
+ this.scrollSubscription?.unsubscribe();
406
+ this.scrollSubscription = void 0;
407
+ this.sizing.releaseResizeObserver();
408
+ this.cancelRenderTransaction();
409
+ this.state.attached.set(false);
410
+ const overlayRef = this.overlayRef;
411
+ this.overlayRef = void 0;
412
+ this.position.clearStrategy();
413
+ this.appliedPanelClass = void 0;
414
+ overlayRef?.dispose();
415
+ this.flushPendingDispose();
416
+ }
417
+ panelClasses() {
418
+ const panelClass = this.host.panelClass();
419
+ return panelClass ? [PANE_CLASS, panelClass] : [PANE_CLASS];
420
+ }
421
+ applyPanelClass(panelClass) {
422
+ const pane = this.overlayRef?.overlayElement;
423
+ if (!pane) return;
424
+ if (this.appliedPanelClass && this.appliedPanelClass !== panelClass) pane.classList.remove(this.appliedPanelClass);
425
+ if (panelClass) pane.classList.add(panelClass);
426
+ this.appliedPanelClass = panelClass;
427
+ }
428
+ };
429
+ var RaqmPopoverPosition = class {
430
+ overlay;
431
+ viewportRuler;
432
+ state;
433
+ sizing;
434
+ host;
435
+ positionStrategy;
436
+ currentPositions = [];
437
+ currentPositionSides = [];
438
+ sideSubscription;
439
+ constructor(overlay, viewportRuler, state, sizing, host) {
440
+ this.overlay = overlay;
441
+ this.viewportRuler = viewportRuler;
442
+ this.state = state;
443
+ this.sizing = sizing;
444
+ this.host = host;
445
+ }
446
+ buildStrategy(origin) {
447
+ const strategy = this.overlay.position().flexibleConnectedTo(origin);
448
+ strategy.withFlexibleDimensions(false).withGrowAfterOpen(false).withPush(true).withViewportMargin(5);
449
+ const preferred = this.resolvePhysicalSide(this.host.side());
450
+ this.currentPositionSides = [preferred, this.oppositeSide(preferred)];
451
+ this.currentPositions = this.currentPositionSides.map((side) => this.buildPositionFor(side));
452
+ strategy.withPositions(this.currentPositions);
453
+ this.positionStrategy = strategy;
454
+ return strategy;
455
+ }
456
+ setPositions(sides) {
457
+ const strategy = this.positionStrategy;
458
+ if (!strategy) return;
459
+ const positions = sides.map((side) => this.buildPositionFor(side));
460
+ strategy.withPositions(positions);
461
+ this.currentPositions = positions;
462
+ this.currentPositionSides = [...sides];
463
+ }
464
+ buildPositionFor(side) {
465
+ const align = this.host.align();
466
+ const anchorRect = this.host.trigger()?.element?.getBoundingClientRect();
467
+ const viewport = this.viewportRuler.getViewportSize();
468
+ const x = align;
469
+ const y = this.toVerticalAlign(align);
470
+ const mainOffset = this.sizing.effectiveSideOffset(side);
471
+ const alignX = this.sizing.crossAxisGeometry("x", anchorRect, viewport.width).offset;
472
+ const alignY = this.sizing.crossAxisGeometry("y", anchorRect, viewport.height).offset;
473
+ switch (side) {
474
+ case "bottom": return {
475
+ originX: x,
476
+ originY: "bottom",
477
+ overlayX: x,
478
+ overlayY: "top",
479
+ offsetX: alignX,
480
+ offsetY: mainOffset
481
+ };
482
+ case "top": return {
483
+ originX: x,
484
+ originY: "top",
485
+ overlayX: x,
486
+ overlayY: "bottom",
487
+ offsetX: alignX,
488
+ offsetY: mainOffset
489
+ };
490
+ case "right": return this.horizontalPosition("right", y, mainOffset, alignY);
491
+ default: return this.horizontalPosition("left", y, mainOffset, alignY);
492
+ }
493
+ }
494
+ horizontalPosition(side, alignY, offsetX, alignYOffset) {
495
+ const rtl = this.state.currentDir === "rtl";
496
+ return {
497
+ originX: side === "right" ? rtl ? "start" : "end" : rtl ? "end" : "start",
498
+ originY: alignY,
499
+ overlayX: side === "right" ? rtl ? "end" : "start" : rtl ? "start" : "end",
500
+ overlayY: alignY,
501
+ offsetX,
502
+ offsetY: alignYOffset
503
+ };
504
+ }
505
+ oppositeSide(side) {
506
+ switch (side) {
507
+ case "top": return "bottom";
508
+ case "bottom": return "top";
509
+ case "left": return "right";
510
+ default: return "left";
511
+ }
512
+ }
513
+ watchSide(strategy) {
514
+ this.sideSubscription = strategy.positionChanges.subscribe((change) => {
515
+ const index = this.currentPositions.indexOf(change.connectionPair);
516
+ const applied = this.currentPositionSides[index] ?? this.currentPositionSides[0] ?? "bottom";
517
+ this.state.resolvedSide.set(applied);
518
+ this.state.transformOrigin.set(this.computeTransformOrigin(applied, this.host.align()));
519
+ });
520
+ }
521
+ resolvePhysicalSide(side) {
522
+ switch (side) {
523
+ case "inline-start": return this.state.currentDir === "rtl" ? "right" : "left";
524
+ case "inline-end": return this.state.currentDir === "rtl" ? "left" : "right";
525
+ default: return side;
526
+ }
527
+ }
528
+ computeTransformOrigin(side, align) {
529
+ const rtl = this.state.currentDir === "rtl";
530
+ return `${side === "left" ? "right" : side === "right" ? "left" : align === "start" ? rtl ? "right" : "left" : align === "end" ? rtl ? "left" : "right" : "center"} ${side === "top" ? "bottom" : side === "bottom" ? "top" : this.toVerticalAlign(align)}`;
531
+ }
532
+ toVerticalAlign(align) {
533
+ return align === "start" ? "top" : align === "end" ? "bottom" : "center";
534
+ }
535
+ reposition() {
536
+ const pane = this.host.pane();
537
+ const strategy = this.positionStrategy;
538
+ if (!pane || !strategy) return;
539
+ const dir = this.host.direction();
540
+ if (dir !== this.state.currentDir) {
541
+ this.state.currentDir = dir;
542
+ this.state.panelDir.set(dir);
543
+ this.host.setDirection(dir);
544
+ }
545
+ const preferred = this.resolvePhysicalSide(this.host.side());
546
+ this.setPositions([preferred, this.oppositeSide(preferred)]);
547
+ this.sizing.resetAvailableSize();
548
+ this.sizing.naturalContentSize = this.sizing.contentBoxSize();
549
+ this.host.updatePosition();
550
+ const applied = this.state.resolvedSide();
551
+ this.sizing.applyAvailableSize();
552
+ this.setPositions([applied]);
553
+ this.host.updatePosition();
554
+ this.sizing.expectedContentSize = this.sizing.contentBoxSize();
555
+ }
556
+ applyPositionInputs() {
557
+ this.reposition();
558
+ }
559
+ releaseSideWatch() {
560
+ this.sideSubscription?.unsubscribe();
561
+ this.sideSubscription = void 0;
562
+ }
563
+ clearStrategy() {
564
+ this.positionStrategy = void 0;
565
+ }
566
+ };
567
+ let nextPopoverId = 0;
568
+ var RaqmPopoverRegistration = class {
569
+ host;
570
+ triggerRef = signal(null, ...ngDevMode ? [{ debugName: "triggerRef" }] : /* istanbul ignore next */ []);
571
+ contentTemplate = signal(null, ...ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []);
572
+ titleElement = signal(null, ...ngDevMode ? [{ debugName: "titleElement" }] : /* istanbul ignore next */ []);
573
+ descriptionElement = signal(null, ...ngDevMode ? [{ debugName: "descriptionElement" }] : /* istanbul ignore next */ []);
574
+ rootId = ++nextPopoverId;
575
+ panelRootId = `raqm-popover-panel-${this.rootId}`;
576
+ titleRootId = `raqm-popover-title-${this.rootId}`;
577
+ descriptionRootId = `raqm-popover-description-${this.rootId}`;
578
+ constructor(host) {
579
+ this.host = host;
580
+ }
581
+ registerTrigger(ref) {
582
+ const current = this.triggerRef();
583
+ if (current !== null && current !== ref) {
584
+ if (isDevMode()) console.error("[raqm-popover] Only one `button[raqm-popover-trigger]` is supported per <raqm-popover>; the extra trigger is ignored.");
585
+ return;
586
+ }
587
+ this.triggerRef.set(ref);
588
+ }
589
+ unregisterTrigger(ref) {
590
+ if (this.triggerRef() === ref) this.triggerRef.set(null);
591
+ }
592
+ registerContent(template) {
593
+ const current = this.contentTemplate();
594
+ if (current !== null && current !== template) {
595
+ if (isDevMode()) console.error("[raqm-popover] Only one `ng-template[raqm-popover-content]` is supported per <raqm-popover>; the extra template is ignored.");
596
+ return;
597
+ }
598
+ this.contentTemplate.set(template);
599
+ }
600
+ unregisterContent(template) {
601
+ if (this.contentTemplate() === template) this.contentTemplate.set(null);
602
+ }
603
+ registerTitle(element) {
604
+ if (isDevMode() && this.titleElement() !== null && this.titleElement() !== element) console.error("[raqm-popover] Only one `[raqm-popover-title]` is expected per <raqm-popover>; the latest registration wins.");
605
+ if (!element.id) element.id = this.titleRootId;
606
+ this.titleElement.set(element);
607
+ this.syncPanelAria();
608
+ }
609
+ unregisterTitle(element) {
610
+ if (this.titleElement() === element) {
611
+ this.titleElement.set(null);
612
+ this.syncPanelAria();
613
+ }
614
+ }
615
+ registerDescription(element) {
616
+ if (isDevMode() && this.descriptionElement() !== null && this.descriptionElement() !== element) console.error("[raqm-popover] Only one `[raqm-popover-description]` is expected per <raqm-popover>; the latest registration wins.");
617
+ if (!element.id) element.id = this.descriptionRootId;
618
+ this.descriptionElement.set(element);
619
+ this.syncPanelAria();
620
+ }
621
+ unregisterDescription(element) {
622
+ if (this.descriptionElement() === element) {
623
+ this.descriptionElement.set(null);
624
+ this.syncPanelAria();
625
+ }
626
+ }
627
+ syncPanelAria() {
628
+ const content = this.host.content();
629
+ if (!content) return;
630
+ const title = this.titleElement();
631
+ const description = this.descriptionElement();
632
+ if (title) content.setAttribute("aria-labelledby", title.id);
633
+ else content.removeAttribute("aria-labelledby");
634
+ if (description) content.setAttribute("aria-describedby", description.id);
635
+ else content.removeAttribute("aria-describedby");
636
+ const label = this.host.label();
637
+ if (!title && label) content.setAttribute("aria-label", label);
638
+ else content.removeAttribute("aria-label");
639
+ }
640
+ };
641
+ var RaqmPopoverSizing = class {
642
+ viewportRuler;
643
+ state;
644
+ host;
645
+ naturalContentSize;
646
+ expectedContentSize;
647
+ resizeObserver;
648
+ constructor(viewportRuler, state, host) {
649
+ this.viewportRuler = viewportRuler;
650
+ this.state = state;
651
+ this.host = host;
652
+ }
653
+ viewportCap(viewportDimension) {
654
+ return Math.max(viewportDimension - 10, 0);
655
+ }
656
+ contentBoxSize() {
657
+ const content = this.host.content();
658
+ if (!content) return;
659
+ return {
660
+ width: content.offsetWidth,
661
+ height: content.offsetHeight
662
+ };
663
+ }
664
+ isSelfInducedContentSize(size) {
665
+ return sameBoxSize(size, this.naturalContentSize) || sameBoxSize(size, this.expectedContentSize);
666
+ }
667
+ resetAvailableSize() {
668
+ const pane = this.host.pane();
669
+ if (!pane) return;
670
+ pane.style.removeProperty("--raqm-popover-available-width");
671
+ pane.style.removeProperty("--raqm-popover-available-height");
672
+ }
673
+ attachResizeObserver(anchor) {
674
+ this.releaseResizeObserver();
675
+ if (typeof ResizeObserver === "undefined") return;
676
+ this.resizeObserver = new ResizeObserver((entries) => {
677
+ const content = this.host.content();
678
+ for (const entry of entries) {
679
+ if (entry.target !== content) {
680
+ this.host.reposition();
681
+ return;
682
+ }
683
+ const size = this.contentBoxSize();
684
+ if (size && !this.isSelfInducedContentSize(size)) {
685
+ this.host.reposition();
686
+ return;
687
+ }
688
+ }
689
+ });
690
+ this.resizeObserver.observe(anchor);
691
+ const content = this.host.content();
692
+ if (content) this.resizeObserver.observe(content);
693
+ }
694
+ releaseResizeObserver() {
695
+ this.resizeObserver?.disconnect();
696
+ this.resizeObserver = void 0;
697
+ }
698
+ applyAvailableSize() {
699
+ const pane = this.host.pane();
700
+ const anchor = this.host.trigger()?.element;
701
+ if (!pane || !anchor) return;
702
+ const anchorRect = anchor.getBoundingClientRect();
703
+ const viewport = this.viewportRuler.getViewportSize();
704
+ const sideOffset = this.host.sideOffset();
705
+ const side = this.state.resolvedSide();
706
+ const capacityWidth = this.viewportCap(viewport.width);
707
+ const capacityHeight = this.viewportCap(viewport.height);
708
+ const below = capacityHeight - anchorRect.bottom - sideOffset;
709
+ const above = anchorRect.top - sideOffset - 5;
710
+ const after = capacityWidth - anchorRect.right - sideOffset;
711
+ const before = anchorRect.left - sideOffset - 5;
712
+ const crossConservative = (side === "top" ? above : side === "left" ? before : side === "bottom" ? below : after) <= 0;
713
+ const crossWidth = this.crossAxisGeometry("x", anchorRect, viewport.width, crossConservative).room;
714
+ const crossHeight = this.crossAxisGeometry("y", anchorRect, viewport.height, crossConservative).room;
715
+ let width;
716
+ let height;
717
+ let widthIsCross = false;
718
+ let heightIsCross = false;
719
+ switch (side) {
720
+ case "top":
721
+ height = above;
722
+ width = crossWidth;
723
+ widthIsCross = true;
724
+ break;
725
+ case "left":
726
+ width = before;
727
+ height = crossHeight;
728
+ heightIsCross = true;
729
+ break;
730
+ case "right":
731
+ width = after;
732
+ height = crossHeight;
733
+ heightIsCross = true;
734
+ break;
735
+ default:
736
+ height = below;
737
+ width = crossWidth;
738
+ widthIsCross = true;
739
+ }
740
+ this.applyAvailableDimension(pane, "--raqm-popover-available-width", widthIsCross || width > 0 ? Math.min(width, capacityWidth) : capacityWidth);
741
+ this.applyAvailableDimension(pane, "--raqm-popover-available-height", heightIsCross || height > 0 ? Math.min(height, capacityHeight) : capacityHeight);
742
+ }
743
+ effectiveSideOffset(side) {
744
+ const authored = side === "bottom" || side === "right" ? this.host.sideOffset() : -this.host.sideOffset();
745
+ const anchor = this.host.trigger()?.element;
746
+ const pane = this.host.pane();
747
+ if (!anchor || !pane) return authored;
748
+ const horizontal = side === "left" || side === "right";
749
+ const viewport = this.viewportRuler.getViewportSize();
750
+ const client = horizontal ? viewport.width : viewport.height;
751
+ const size = horizontal ? pane.getBoundingClientRect().width : pane.getBoundingClientRect().height;
752
+ const capacity = this.viewportCap(client);
753
+ if (size <= 0 || size > capacity) return authored;
754
+ const anchorRect = anchor.getBoundingClientRect();
755
+ const base = horizontal ? side === "right" ? anchorRect.right : anchorRect.left - size : side === "bottom" ? anchorRect.bottom : anchorRect.top - size;
756
+ const overflowNear = Math.max(5 - base, 0);
757
+ const overflowFar = Math.max(base + size - capacity, 0);
758
+ const pushedBase = base + (overflowNear || -overflowFar);
759
+ return Math.min(Math.max(authored, 5 - pushedBase), client - 5 - pushedBase - size);
760
+ }
761
+ authoredCrossOffset(axis) {
762
+ const alignOffset = this.host.alignOffset();
763
+ return axis === "x" && this.state.currentDir === "rtl" ? -alignOffset : alignOffset;
764
+ }
765
+ crossAxisGeometry(axis, anchorRect, viewportDimension, conservative = false) {
766
+ const authored = this.authoredCrossOffset(axis);
767
+ const capacity = this.viewportCap(viewportDimension);
768
+ if (!authored || !anchorRect) return {
769
+ offset: authored,
770
+ room: capacity
771
+ };
772
+ const rtl = this.state.currentDir === "rtl";
773
+ const align = this.host.align();
774
+ const axisStart = axis === "x" ? anchorRect.left : anchorRect.top;
775
+ const axisSize = axis === "x" ? anchorRect.width : anchorRect.height;
776
+ const startEdge = axis === "x" && rtl ? axisStart + axisSize : axisStart;
777
+ const endEdge = axis === "x" && rtl ? axisStart : axisStart + axisSize;
778
+ const origin = align === "start" ? startEdge : align === "end" ? endEdge : axisStart + axisSize / 2;
779
+ const offset = Math.min(Math.max(authored, 5 - origin), capacity - origin);
780
+ const roomEdge = conservative ? origin : origin + offset;
781
+ const beforeRoom = Math.max(roomEdge - 5, 0);
782
+ const afterRoom = Math.max(capacity - roomEdge, 0);
783
+ if (align === "center") return {
784
+ offset,
785
+ room: Math.min((Math.min(beforeRoom, afterRoom) || Math.max(beforeRoom, afterRoom)) * 2, capacity)
786
+ };
787
+ const growsAfter = axis === "y" ? align === "start" : align === "start" ? !rtl : rtl;
788
+ return {
789
+ offset,
790
+ room: (growsAfter ? afterRoom : beforeRoom) || (growsAfter ? beforeRoom : afterRoom)
791
+ };
792
+ }
793
+ applyAvailableDimension(pane, property, value) {
794
+ const next = `${Math.max(Math.floor(value), 0)}px`;
795
+ if (pane.style.getPropertyValue(property) !== next) pane.style.setProperty(property, next);
796
+ }
797
+ };
798
+ var RaqmPopoverState = class {
799
+ attached = signal(false, ...ngDevMode ? [{ debugName: "attached" }] : /* istanbul ignore next */ []);
800
+ panelId = signal(null, ...ngDevMode ? [{ debugName: "panelId" }] : /* istanbul ignore next */ []);
801
+ resolvedSide = signal("bottom", ...ngDevMode ? [{ debugName: "resolvedSide" }] : /* istanbul ignore next */ []);
802
+ transformOrigin = signal("center top", ...ngDevMode ? [{ debugName: "transformOrigin" }] : /* istanbul ignore next */ []);
803
+ closing = signal(false, ...ngDevMode ? [{ debugName: "closing" }] : /* istanbul ignore next */ []);
804
+ panelDir = signal("ltr", ...ngDevMode ? [{ debugName: "panelDir" }] : /* istanbul ignore next */ []);
805
+ currentDir = "ltr";
806
+ currentOpen = false;
807
+ openGeneration = 0;
808
+ };
809
+ var RaqmPopoverComponent = class RaqmPopoverComponent {
810
+ host = inject(ElementRef);
811
+ overlay = inject(Overlay);
812
+ viewContainerRef = inject(ViewContainerRef);
813
+ injector = inject(Injector);
814
+ directionality = inject(Directionality, { optional: true });
815
+ viewportRuler = inject(ViewportRuler);
816
+ scrollDispatcher = inject(ScrollDispatcher);
817
+ checker = inject(InteractivityChecker);
818
+ panelTemplate = viewChild("panel", {
819
+ ...ngDevMode ? { debugName: "panelTemplate" } : /* istanbul ignore next */ {},
820
+ read: TemplateRef
821
+ });
822
+ openValue = model(false, {
823
+ ...ngDevMode ? { debugName: "openValue" } : /* istanbul ignore next */ {},
824
+ alias: "open"
825
+ });
826
+ disabled = input(false, {
827
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
828
+ transform: booleanAttribute
829
+ });
830
+ side = input(DEFAULT_SIDE, {
831
+ ...ngDevMode ? { debugName: "side" } : /* istanbul ignore next */ {},
832
+ transform: toSide
833
+ });
834
+ align = input(DEFAULT_ALIGN, {
835
+ ...ngDevMode ? { debugName: "align" } : /* istanbul ignore next */ {},
836
+ transform: toAlign
837
+ });
838
+ sideOffset = input(4, {
839
+ ...ngDevMode ? { debugName: "sideOffset" } : /* istanbul ignore next */ {},
840
+ transform: toOffset(4)
841
+ });
842
+ alignOffset = input(0, {
843
+ ...ngDevMode ? { debugName: "alignOffset" } : /* istanbul ignore next */ {},
844
+ transform: toOffset(0)
845
+ });
846
+ dir = input(void 0, {
847
+ ...ngDevMode ? { debugName: "dir" } : /* istanbul ignore next */ {},
848
+ transform: toDir
849
+ });
850
+ width = input(DEFAULT_WIDTH, ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
851
+ panelClass = input(void 0, ...ngDevMode ? [{ debugName: "panelClass" }] : /* istanbul ignore next */ []);
852
+ label = input(void 0, ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
853
+ state = new RaqmPopoverState();
854
+ registration = new RaqmPopoverRegistration({
855
+ content: () => this.layer.contentElement(),
856
+ label: () => this.label()
857
+ });
858
+ canOpen = computed(() => this.registration.triggerRef() !== null && this.registration.contentTemplate() !== null && this.panelTemplate() !== void 0, ...ngDevMode ? [{ debugName: "canOpen" }] : /* istanbul ignore next */ []);
859
+ open = computed(() => this.openValue() && !this.disabled() && this.state.attached(), ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
860
+ panelId = this.state.panelId;
861
+ resolvedSide = this.state.resolvedSide;
862
+ transformOrigin = this.state.transformOrigin;
863
+ closing = this.state.closing;
864
+ panelDir = this.state.panelDir;
865
+ contentTemplate = this.registration.contentTemplate;
866
+ sizing = new RaqmPopoverSizing(this.viewportRuler, this.state, {
867
+ align: () => this.align(),
868
+ alignOffset: () => this.alignOffset(),
869
+ sideOffset: () => this.sideOffset(),
870
+ trigger: () => this.registration.triggerRef(),
871
+ pane: () => this.layer.element,
872
+ content: () => this.layer.contentElement(),
873
+ reposition: () => this.position.reposition()
874
+ });
875
+ position = new RaqmPopoverPosition(this.overlay, this.viewportRuler, this.state, this.sizing, {
876
+ side: () => this.side(),
877
+ align: () => this.align(),
878
+ direction: () => resolvePopoverDirection(this.dir(), this.host.nativeElement, this.directionality),
879
+ trigger: () => this.registration.triggerRef(),
880
+ pane: () => this.layer.element,
881
+ updatePosition: () => this.layer.updatePosition(),
882
+ setDirection: (dir) => this.layer.setDirection(dir)
883
+ });
884
+ layer = new RaqmPopoverOverlay(this.overlay, this.scrollDispatcher, this.viewportRuler, this.viewContainerRef, this.injector, this.state, this.position, this.sizing, {
885
+ root: this.host.nativeElement,
886
+ panelRootId: this.registration.panelRootId,
887
+ trigger: () => this.registration.triggerRef(),
888
+ contentTemplate: () => this.registration.contentTemplate(),
889
+ panelTemplate: () => this.panelTemplate(),
890
+ side: () => this.side(),
891
+ align: () => this.align(),
892
+ panelClass: () => this.panelClass(),
893
+ direction: () => resolvePopoverDirection(this.dir(), this.host.nativeElement, this.directionality),
894
+ isInsideRootOrOverlay: (node) => this.dismissal.isInsideRootOrOverlay(node),
895
+ closeFromUser: () => this.closeFromUser(),
896
+ maybeCloseOnFocusOut: (event) => this.dismissal.maybeCloseOnFocusOut(event),
897
+ syncPanelAria: () => this.registration.syncPanelAria(),
898
+ focusInitial: (overlayRef, generation) => this.keyboard.focusInitial(overlayRef, generation),
899
+ setClosed: () => this.dismissal.setClosed()
900
+ });
901
+ keyboard = new RaqmPopoverKeyboard(this.checker, {
902
+ root: this.host.nativeElement,
903
+ open: () => this.open(),
904
+ openValue: () => this.openValue(),
905
+ disabled: () => this.disabled(),
906
+ canOpen: () => this.canOpen(),
907
+ trigger: () => this.registration.triggerRef(),
908
+ pane: () => this.layer.element,
909
+ content: () => this.layer.contentElement(),
910
+ overlayRef: () => this.layer.ref,
911
+ generation: () => this.state.openGeneration,
912
+ closeFromUser: () => this.closeFromUser()
913
+ });
914
+ dismissal = new RaqmPopoverDismissal({
915
+ root: this.host.nativeElement,
916
+ open: () => this.open(),
917
+ openValue: () => this.openValue(),
918
+ disabled: () => this.disabled(),
919
+ canOpen: () => this.canOpen(),
920
+ pane: () => this.layer.element,
921
+ generation: () => this.state.openGeneration,
922
+ setOpen: (value) => this.openValue.set(value)
923
+ });
924
+ constructor() {
925
+ connectPopoverEffects({
926
+ openValue: () => this.openValue(),
927
+ disabled: () => this.disabled(),
928
+ canOpen: () => this.canOpen(),
929
+ side: () => this.side(),
930
+ align: () => this.align(),
931
+ sideOffset: () => this.sideOffset(),
932
+ alignOffset: () => this.alignOffset(),
933
+ dir: () => this.dir(),
934
+ label: () => this.label(),
935
+ panelClass: () => this.panelClass(),
936
+ syncOpen: (next) => this.layer.syncOpen(next),
937
+ applyPositionInputs: () => this.position.applyPositionInputs(),
938
+ syncPanelAria: () => this.registration.syncPanelAria(),
939
+ applyPanelClass: (panelClass) => this.layer.applyPanelClass(panelClass)
940
+ });
941
+ }
942
+ ngOnDestroy() {
943
+ this.layer.destroy();
944
+ }
945
+ registerTrigger(ref) {
946
+ this.registration.registerTrigger(ref);
947
+ }
948
+ unregisterTrigger(ref) {
949
+ this.registration.unregisterTrigger(ref);
950
+ }
951
+ registerContent(template) {
952
+ this.registration.registerContent(template);
953
+ }
954
+ unregisterContent(template) {
955
+ this.registration.unregisterContent(template);
956
+ }
957
+ registerTitle(element) {
958
+ this.registration.registerTitle(element);
959
+ }
960
+ unregisterTitle(element) {
961
+ this.registration.unregisterTitle(element);
962
+ }
963
+ registerDescription(element) {
964
+ this.registration.registerDescription(element);
965
+ }
966
+ unregisterDescription(element) {
967
+ this.registration.unregisterDescription(element);
968
+ }
969
+ toggleFromTrigger(ref) {
970
+ if (ref !== this.registration.triggerRef() || this.disabled() || ref.disabled) return;
971
+ if (this.open()) {
972
+ this.closeFromUser();
973
+ return;
974
+ }
975
+ this.openValue.set(true);
976
+ }
977
+ closeFromUser() {
978
+ if (!this.open()) return;
979
+ this.dismissal.setClosed();
980
+ }
981
+ close() {
982
+ this.dismissal.setClosed();
983
+ }
984
+ focusFirstInPanel() {
985
+ this.keyboard.focusFirstInPanel();
986
+ }
987
+ onTriggerTab(event) {
988
+ this.keyboard.onTriggerTab(event);
989
+ }
990
+ onFocusOut(event) {
991
+ this.dismissal.maybeCloseOnFocusOut(event);
992
+ }
993
+ onPanelFocusOut(event) {
994
+ this.dismissal.maybeCloseOnFocusOut(event);
995
+ }
996
+ onPanelKeydown(event) {
997
+ this.keyboard.onPanelKeydown(event);
998
+ }
999
+ static ɵfac = i0.ɵɵngDeclareFactory({
1000
+ minVersion: "12.0.0",
1001
+ version: "22.2.2",
1002
+ ngImport: i0,
1003
+ type: RaqmPopoverComponent,
1004
+ deps: [],
1005
+ target: i0.ɵɵFactoryTarget.Component
1006
+ });
1007
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1008
+ minVersion: "17.2.0",
1009
+ version: "22.2.2",
1010
+ type: RaqmPopoverComponent,
1011
+ isStandalone: true,
1012
+ selector: "raqm-popover",
1013
+ inputs: {
1014
+ openValue: {
1015
+ classPropertyName: "openValue",
1016
+ publicName: "open",
1017
+ isSignal: true,
1018
+ isRequired: false,
1019
+ transformFunction: null
1020
+ },
1021
+ disabled: {
1022
+ classPropertyName: "disabled",
1023
+ publicName: "disabled",
1024
+ isSignal: true,
1025
+ isRequired: false,
1026
+ transformFunction: null
1027
+ },
1028
+ side: {
1029
+ classPropertyName: "side",
1030
+ publicName: "side",
1031
+ isSignal: true,
1032
+ isRequired: false,
1033
+ transformFunction: null
1034
+ },
1035
+ align: {
1036
+ classPropertyName: "align",
1037
+ publicName: "align",
1038
+ isSignal: true,
1039
+ isRequired: false,
1040
+ transformFunction: null
1041
+ },
1042
+ sideOffset: {
1043
+ classPropertyName: "sideOffset",
1044
+ publicName: "sideOffset",
1045
+ isSignal: true,
1046
+ isRequired: false,
1047
+ transformFunction: null
1048
+ },
1049
+ alignOffset: {
1050
+ classPropertyName: "alignOffset",
1051
+ publicName: "alignOffset",
1052
+ isSignal: true,
1053
+ isRequired: false,
1054
+ transformFunction: null
1055
+ },
1056
+ dir: {
1057
+ classPropertyName: "dir",
1058
+ publicName: "dir",
1059
+ isSignal: true,
1060
+ isRequired: false,
1061
+ transformFunction: null
1062
+ },
1063
+ width: {
1064
+ classPropertyName: "width",
1065
+ publicName: "width",
1066
+ isSignal: true,
1067
+ isRequired: false,
1068
+ transformFunction: null
1069
+ },
1070
+ panelClass: {
1071
+ classPropertyName: "panelClass",
1072
+ publicName: "panelClass",
1073
+ isSignal: true,
1074
+ isRequired: false,
1075
+ transformFunction: null
1076
+ },
1077
+ label: {
1078
+ classPropertyName: "label",
1079
+ publicName: "label",
1080
+ isSignal: true,
1081
+ isRequired: false,
1082
+ transformFunction: null
1083
+ }
1084
+ },
1085
+ outputs: { openValue: "openChange" },
1086
+ host: { listeners: { "focusout": "onFocusOut($event)" } },
1087
+ providers: [{
1088
+ provide: RAQM_POPOVER,
1089
+ useExisting: RaqmPopoverComponent
1090
+ }],
1091
+ viewQueries: [{
1092
+ propertyName: "panelTemplate",
1093
+ first: true,
1094
+ predicate: ["panel"],
1095
+ descendants: true,
1096
+ read: TemplateRef,
1097
+ isSignal: true
1098
+ }],
1099
+ exportAs: ["raqmPopover"],
1100
+ ngImport: i0,
1101
+ template: "<ng-content />\r\n\r\n<!-- The one panel template, instantiated into a CDK overlay when the popup opens.\r\n Its wrapper nodes are created by this component's view (so this component's\r\n own external stylesheet applies to them) while the projected template\r\n children stay application-owned and are styled by the shipped relationship\r\n partial. `NgTemplateOutlet` renders the registered content template. -->\r\n<ng-template #panel>\r\n <div\r\n class=\"raqm-popover-content\"\r\n tabindex=\"-1\"\r\n [attr.id]=\"panelId()\"\r\n [attr.dir]=\"panelDir()\"\r\n [attr.data-raqm-side]=\"resolvedSide()\"\r\n [class.raqm-popover-content--closing]=\"closing()\"\r\n [style.width]=\"width()\"\r\n [style.transform-origin]=\"transformOrigin()\"\r\n (focusout)=\"onPanelFocusOut($event)\"\r\n (keydown)=\"onPanelKeydown($event)\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"contentTemplate()\" />\r\n </div>\r\n</ng-template>\r\n",
1102
+ styles: [":host{display:contents}.raqm-popover-content{display:flex;flex-direction:column;gap:calc(var(--raqm-spacing) * 2.5);padding:calc(var(--raqm-spacing) * 2.5);border-radius:var(--raqm-radius-lg);background-color:var(--raqm-popover);color:var(--raqm-popover-foreground);font-size:var(--raqm-font-size-sm);line-height:1.25rem;box-shadow:0 0 0 1px color-mix(in oklch,var(--raqm-foreground) 10%,transparent),var(--raqm-shadow-md);outline:none;box-sizing:border-box;max-inline-size:var(--raqm-popover-available-width, none);max-block-size:var(--raqm-popover-available-height, none);overflow:auto;transform-origin:center top}.raqm-popover-content--entering{animation:raqm-popover-in var(--raqm-duration-fast) var(--raqm-ease-out)}.raqm-popover-content[data-raqm-side=bottom]{--raqm-popover-enter-translate: translateY(-8px)}.raqm-popover-content[data-raqm-side=top]{--raqm-popover-enter-translate: translateY(8px)}.raqm-popover-content[data-raqm-side=left]{--raqm-popover-enter-translate: translateX(8px)}.raqm-popover-content[data-raqm-side=right]{--raqm-popover-enter-translate: translateX(-8px)}@keyframes raqm-popover-in{0%{opacity:0;transform:var(--raqm-popover-enter-translate, none) scale(.95)}to{opacity:1;transform:none}}.raqm-popover-content--closing{opacity:0;transform:scale(.95);transition:opacity var(--raqm-duration-fast) var(--raqm-ease-out),transform var(--raqm-duration-fast) var(--raqm-ease-out)}@media(prefers-reduced-motion:reduce){.raqm-popover-content,.raqm-popover-content--closing{animation:none;transition:none}}@media(forced-colors:active){.raqm-popover-content{border:1px solid CanvasText}}\n"],
1103
+ dependencies: [{
1104
+ kind: "directive",
1105
+ type: NgTemplateOutlet,
1106
+ selector: "[ngTemplateOutlet]",
1107
+ inputs: [
1108
+ "ngTemplateOutletContext",
1109
+ "ngTemplateOutlet",
1110
+ "ngTemplateOutletInjector"
1111
+ ]
1112
+ }],
1113
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1114
+ });
1115
+ };
1116
+ i0.ɵɵngDeclareClassMetadata({
1117
+ minVersion: "12.0.0",
1118
+ version: "22.2.2",
1119
+ ngImport: i0,
1120
+ type: RaqmPopoverComponent,
1121
+ decorators: [{
1122
+ type: Component,
1123
+ args: [{
1124
+ selector: "raqm-popover",
1125
+ imports: [NgTemplateOutlet],
1126
+ changeDetection: ChangeDetectionStrategy.OnPush,
1127
+ exportAs: "raqmPopover",
1128
+ providers: [{
1129
+ provide: RAQM_POPOVER,
1130
+ useExisting: RaqmPopoverComponent
1131
+ }],
1132
+ host: { "(focusout)": "onFocusOut($event)" },
1133
+ template: "<ng-content />\r\n\r\n<!-- The one panel template, instantiated into a CDK overlay when the popup opens.\r\n Its wrapper nodes are created by this component's view (so this component's\r\n own external stylesheet applies to them) while the projected template\r\n children stay application-owned and are styled by the shipped relationship\r\n partial. `NgTemplateOutlet` renders the registered content template. -->\r\n<ng-template #panel>\r\n <div\r\n class=\"raqm-popover-content\"\r\n tabindex=\"-1\"\r\n [attr.id]=\"panelId()\"\r\n [attr.dir]=\"panelDir()\"\r\n [attr.data-raqm-side]=\"resolvedSide()\"\r\n [class.raqm-popover-content--closing]=\"closing()\"\r\n [style.width]=\"width()\"\r\n [style.transform-origin]=\"transformOrigin()\"\r\n (focusout)=\"onPanelFocusOut($event)\"\r\n (keydown)=\"onPanelKeydown($event)\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"contentTemplate()\" />\r\n </div>\r\n</ng-template>\r\n",
1134
+ styles: [":host{display:contents}.raqm-popover-content{display:flex;flex-direction:column;gap:calc(var(--raqm-spacing) * 2.5);padding:calc(var(--raqm-spacing) * 2.5);border-radius:var(--raqm-radius-lg);background-color:var(--raqm-popover);color:var(--raqm-popover-foreground);font-size:var(--raqm-font-size-sm);line-height:1.25rem;box-shadow:0 0 0 1px color-mix(in oklch,var(--raqm-foreground) 10%,transparent),var(--raqm-shadow-md);outline:none;box-sizing:border-box;max-inline-size:var(--raqm-popover-available-width, none);max-block-size:var(--raqm-popover-available-height, none);overflow:auto;transform-origin:center top}.raqm-popover-content--entering{animation:raqm-popover-in var(--raqm-duration-fast) var(--raqm-ease-out)}.raqm-popover-content[data-raqm-side=bottom]{--raqm-popover-enter-translate: translateY(-8px)}.raqm-popover-content[data-raqm-side=top]{--raqm-popover-enter-translate: translateY(8px)}.raqm-popover-content[data-raqm-side=left]{--raqm-popover-enter-translate: translateX(8px)}.raqm-popover-content[data-raqm-side=right]{--raqm-popover-enter-translate: translateX(-8px)}@keyframes raqm-popover-in{0%{opacity:0;transform:var(--raqm-popover-enter-translate, none) scale(.95)}to{opacity:1;transform:none}}.raqm-popover-content--closing{opacity:0;transform:scale(.95);transition:opacity var(--raqm-duration-fast) var(--raqm-ease-out),transform var(--raqm-duration-fast) var(--raqm-ease-out)}@media(prefers-reduced-motion:reduce){.raqm-popover-content,.raqm-popover-content--closing{animation:none;transition:none}}@media(forced-colors:active){.raqm-popover-content{border:1px solid CanvasText}}\n"]
1135
+ }]
1136
+ }],
1137
+ ctorParameters: () => [],
1138
+ propDecorators: {
1139
+ panelTemplate: [{
1140
+ type: i0.ViewChild,
1141
+ args: ["panel", {
1142
+ read: TemplateRef,
1143
+ isSignal: true
1144
+ }]
1145
+ }],
1146
+ openValue: [{
1147
+ type: i0.Input,
1148
+ args: [{
1149
+ isSignal: true,
1150
+ alias: "open",
1151
+ required: false
1152
+ }]
1153
+ }, {
1154
+ type: i0.Output,
1155
+ args: ["openChange"]
1156
+ }],
1157
+ disabled: [{
1158
+ type: i0.Input,
1159
+ args: [{
1160
+ isSignal: true,
1161
+ alias: "disabled",
1162
+ required: false
1163
+ }]
1164
+ }],
1165
+ side: [{
1166
+ type: i0.Input,
1167
+ args: [{
1168
+ isSignal: true,
1169
+ alias: "side",
1170
+ required: false
1171
+ }]
1172
+ }],
1173
+ align: [{
1174
+ type: i0.Input,
1175
+ args: [{
1176
+ isSignal: true,
1177
+ alias: "align",
1178
+ required: false
1179
+ }]
1180
+ }],
1181
+ sideOffset: [{
1182
+ type: i0.Input,
1183
+ args: [{
1184
+ isSignal: true,
1185
+ alias: "sideOffset",
1186
+ required: false
1187
+ }]
1188
+ }],
1189
+ alignOffset: [{
1190
+ type: i0.Input,
1191
+ args: [{
1192
+ isSignal: true,
1193
+ alias: "alignOffset",
1194
+ required: false
1195
+ }]
1196
+ }],
1197
+ dir: [{
1198
+ type: i0.Input,
1199
+ args: [{
1200
+ isSignal: true,
1201
+ alias: "dir",
1202
+ required: false
1203
+ }]
1204
+ }],
1205
+ width: [{
1206
+ type: i0.Input,
1207
+ args: [{
1208
+ isSignal: true,
1209
+ alias: "width",
1210
+ required: false
1211
+ }]
1212
+ }],
1213
+ panelClass: [{
1214
+ type: i0.Input,
1215
+ args: [{
1216
+ isSignal: true,
1217
+ alias: "panelClass",
1218
+ required: false
1219
+ }]
1220
+ }],
1221
+ label: [{
1222
+ type: i0.Input,
1223
+ args: [{
1224
+ isSignal: true,
1225
+ alias: "label",
1226
+ required: false
1227
+ }]
1228
+ }]
1229
+ }
1230
+ });
1231
+ var RaqmPopoverTriggerDirective = class RaqmPopoverTriggerDirective {
1232
+ host = inject(ElementRef);
1233
+ popover = inject(RAQM_POPOVER, { optional: true });
1234
+ destroyRef = inject(DestroyRef);
1235
+ open = computed(() => this.popover?.open() ?? false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
1236
+ panelId = computed(() => this.popover?.panelId() ?? null, ...ngDevMode ? [{ debugName: "panelId" }] : /* istanbul ignore next */ []);
1237
+ ref = (() => {
1238
+ const self = this;
1239
+ return {
1240
+ get element() {
1241
+ return self.host.nativeElement;
1242
+ },
1243
+ get disabled() {
1244
+ return self.host.nativeElement.disabled;
1245
+ },
1246
+ focus() {
1247
+ self.host.nativeElement.focus();
1248
+ }
1249
+ };
1250
+ })();
1251
+ constructor() {
1252
+ const element = this.host.nativeElement;
1253
+ if (!element.hasAttribute("type")) element.setAttribute("type", "button");
1254
+ if (isDevMode() && this.popover === null) console.error("[raqm-popover-trigger] No parent <raqm-popover> found; the trigger cannot open a popup.");
1255
+ this.destroyRef.onDestroy(() => this.popover?.unregisterTrigger(this.ref));
1256
+ }
1257
+ ngOnInit() {
1258
+ this.popover?.registerTrigger(this.ref);
1259
+ }
1260
+ onClick() {
1261
+ if (this.host.nativeElement.disabled) return;
1262
+ this.popover?.toggleFromTrigger(this.ref);
1263
+ }
1264
+ onKeydown(event) {
1265
+ if (this.host.nativeElement.disabled) return;
1266
+ if (event.key === "Escape") {
1267
+ if (this.popover?.open()) {
1268
+ event.preventDefault();
1269
+ event.stopPropagation();
1270
+ this.popover.closeFromUser();
1271
+ }
1272
+ return;
1273
+ }
1274
+ if (event.key === "Tab") this.popover?.onTriggerTab(event);
1275
+ }
1276
+ static ɵfac = i0.ɵɵngDeclareFactory({
1277
+ minVersion: "12.0.0",
1278
+ version: "22.2.2",
1279
+ ngImport: i0,
1280
+ type: RaqmPopoverTriggerDirective,
1281
+ deps: [],
1282
+ target: i0.ɵɵFactoryTarget.Directive
1283
+ });
1284
+ static ɵdir = i0.ɵɵngDeclareDirective({
1285
+ minVersion: "14.0.0",
1286
+ version: "22.2.2",
1287
+ type: RaqmPopoverTriggerDirective,
1288
+ isStandalone: true,
1289
+ selector: "button[raqm-popover-trigger]",
1290
+ host: {
1291
+ listeners: {
1292
+ "click": "onClick()",
1293
+ "keydown": "onKeydown($event)"
1294
+ },
1295
+ properties: {
1296
+ "attr.aria-expanded": "open() ? \"true\" : \"false\"",
1297
+ "attr.aria-controls": "open() ? panelId() : null"
1298
+ },
1299
+ classAttribute: "raqm-popover-trigger"
1300
+ },
1301
+ ngImport: i0
1302
+ });
1303
+ };
1304
+ i0.ɵɵngDeclareClassMetadata({
1305
+ minVersion: "12.0.0",
1306
+ version: "22.2.2",
1307
+ ngImport: i0,
1308
+ type: RaqmPopoverTriggerDirective,
1309
+ decorators: [{
1310
+ type: Directive,
1311
+ args: [{
1312
+ selector: "button[raqm-popover-trigger]",
1313
+ host: {
1314
+ class: "raqm-popover-trigger",
1315
+ "[attr.aria-expanded]": "open() ? \"true\" : \"false\"",
1316
+ "[attr.aria-controls]": "open() ? panelId() : null",
1317
+ "(click)": "onClick()",
1318
+ "(keydown)": "onKeydown($event)"
1319
+ }
1320
+ }]
1321
+ }],
1322
+ ctorParameters: () => []
1323
+ });
1324
+ var RaqmPopoverContentDirective = class RaqmPopoverContentDirective {
1325
+ template = inject(TemplateRef);
1326
+ popover = inject(RAQM_POPOVER, { optional: true });
1327
+ destroyRef = inject(DestroyRef);
1328
+ constructor() {
1329
+ if (isDevMode() && this.popover === null) console.error("[raqm-popover-content] No parent <raqm-popover> found; the template is never rendered.");
1330
+ this.destroyRef.onDestroy(() => this.popover?.unregisterContent(this.template));
1331
+ }
1332
+ ngOnInit() {
1333
+ this.popover?.registerContent(this.template);
1334
+ }
1335
+ static ɵfac = i0.ɵɵngDeclareFactory({
1336
+ minVersion: "12.0.0",
1337
+ version: "22.2.2",
1338
+ ngImport: i0,
1339
+ type: RaqmPopoverContentDirective,
1340
+ deps: [],
1341
+ target: i0.ɵɵFactoryTarget.Directive
1342
+ });
1343
+ static ɵdir = i0.ɵɵngDeclareDirective({
1344
+ minVersion: "14.0.0",
1345
+ version: "22.2.2",
1346
+ type: RaqmPopoverContentDirective,
1347
+ isStandalone: true,
1348
+ selector: "ng-template[raqm-popover-content]",
1349
+ exportAs: ["raqmPopoverContent"],
1350
+ ngImport: i0
1351
+ });
1352
+ };
1353
+ i0.ɵɵngDeclareClassMetadata({
1354
+ minVersion: "12.0.0",
1355
+ version: "22.2.2",
1356
+ ngImport: i0,
1357
+ type: RaqmPopoverContentDirective,
1358
+ decorators: [{
1359
+ type: Directive,
1360
+ args: [{
1361
+ selector: "ng-template[raqm-popover-content]",
1362
+ exportAs: "raqmPopoverContent"
1363
+ }]
1364
+ }],
1365
+ ctorParameters: () => []
1366
+ });
1367
+ var RaqmPopoverHeaderDirective = class RaqmPopoverHeaderDirective {
1368
+ static ɵfac = i0.ɵɵngDeclareFactory({
1369
+ minVersion: "12.0.0",
1370
+ version: "22.2.2",
1371
+ ngImport: i0,
1372
+ type: RaqmPopoverHeaderDirective,
1373
+ deps: [],
1374
+ target: i0.ɵɵFactoryTarget.Directive
1375
+ });
1376
+ static ɵdir = i0.ɵɵngDeclareDirective({
1377
+ minVersion: "14.0.0",
1378
+ version: "22.2.2",
1379
+ type: RaqmPopoverHeaderDirective,
1380
+ isStandalone: true,
1381
+ selector: "[raqm-popover-header]",
1382
+ host: { classAttribute: "raqm-popover-header" },
1383
+ ngImport: i0
1384
+ });
1385
+ };
1386
+ i0.ɵɵngDeclareClassMetadata({
1387
+ minVersion: "12.0.0",
1388
+ version: "22.2.2",
1389
+ ngImport: i0,
1390
+ type: RaqmPopoverHeaderDirective,
1391
+ decorators: [{
1392
+ type: Directive,
1393
+ args: [{
1394
+ selector: "[raqm-popover-header]",
1395
+ host: { class: "raqm-popover-header" }
1396
+ }]
1397
+ }]
1398
+ });
1399
+ var RaqmPopoverTitleDirective = class RaqmPopoverTitleDirective {
1400
+ host = inject(ElementRef);
1401
+ popover = inject(RAQM_POPOVER, { optional: true });
1402
+ destroyRef = inject(DestroyRef);
1403
+ constructor() {
1404
+ if (isDevMode() && this.popover === null) console.error("[raqm-popover-title] No parent <raqm-popover> found; the title cannot be associated with a popup.");
1405
+ this.destroyRef.onDestroy(() => this.popover?.unregisterTitle(this.host.nativeElement));
1406
+ }
1407
+ ngOnInit() {
1408
+ this.popover?.registerTitle(this.host.nativeElement);
1409
+ }
1410
+ static ɵfac = i0.ɵɵngDeclareFactory({
1411
+ minVersion: "12.0.0",
1412
+ version: "22.2.2",
1413
+ ngImport: i0,
1414
+ type: RaqmPopoverTitleDirective,
1415
+ deps: [],
1416
+ target: i0.ɵɵFactoryTarget.Directive
1417
+ });
1418
+ static ɵdir = i0.ɵɵngDeclareDirective({
1419
+ minVersion: "14.0.0",
1420
+ version: "22.2.2",
1421
+ type: RaqmPopoverTitleDirective,
1422
+ isStandalone: true,
1423
+ selector: "[raqm-popover-title]",
1424
+ host: { classAttribute: "raqm-popover-title" },
1425
+ ngImport: i0
1426
+ });
1427
+ };
1428
+ i0.ɵɵngDeclareClassMetadata({
1429
+ minVersion: "12.0.0",
1430
+ version: "22.2.2",
1431
+ ngImport: i0,
1432
+ type: RaqmPopoverTitleDirective,
1433
+ decorators: [{
1434
+ type: Directive,
1435
+ args: [{
1436
+ selector: "[raqm-popover-title]",
1437
+ host: { class: "raqm-popover-title" }
1438
+ }]
1439
+ }],
1440
+ ctorParameters: () => []
1441
+ });
1442
+ var RaqmPopoverDescriptionDirective = class RaqmPopoverDescriptionDirective {
1443
+ host = inject(ElementRef);
1444
+ popover = inject(RAQM_POPOVER, { optional: true });
1445
+ destroyRef = inject(DestroyRef);
1446
+ constructor() {
1447
+ if (isDevMode() && this.popover === null) console.error("[raqm-popover-description] No parent <raqm-popover> found; the description cannot be associated with a popup.");
1448
+ this.destroyRef.onDestroy(() => this.popover?.unregisterDescription(this.host.nativeElement));
1449
+ }
1450
+ ngOnInit() {
1451
+ this.popover?.registerDescription(this.host.nativeElement);
1452
+ }
1453
+ static ɵfac = i0.ɵɵngDeclareFactory({
1454
+ minVersion: "12.0.0",
1455
+ version: "22.2.2",
1456
+ ngImport: i0,
1457
+ type: RaqmPopoverDescriptionDirective,
1458
+ deps: [],
1459
+ target: i0.ɵɵFactoryTarget.Directive
1460
+ });
1461
+ static ɵdir = i0.ɵɵngDeclareDirective({
1462
+ minVersion: "14.0.0",
1463
+ version: "22.2.2",
1464
+ type: RaqmPopoverDescriptionDirective,
1465
+ isStandalone: true,
1466
+ selector: "[raqm-popover-description]",
1467
+ host: { classAttribute: "raqm-popover-description" },
1468
+ ngImport: i0
1469
+ });
1470
+ };
1471
+ i0.ɵɵngDeclareClassMetadata({
1472
+ minVersion: "12.0.0",
1473
+ version: "22.2.2",
1474
+ ngImport: i0,
1475
+ type: RaqmPopoverDescriptionDirective,
1476
+ decorators: [{
1477
+ type: Directive,
1478
+ args: [{
1479
+ selector: "[raqm-popover-description]",
1480
+ host: { class: "raqm-popover-description" }
1481
+ }]
1482
+ }],
1483
+ ctorParameters: () => []
1484
+ });
1485
+ const RaqmPopover = [
1486
+ RaqmPopoverComponent,
1487
+ RaqmPopoverTriggerDirective,
1488
+ RaqmPopoverContentDirective,
1489
+ RaqmPopoverHeaderDirective,
1490
+ RaqmPopoverTitleDirective,
1491
+ RaqmPopoverDescriptionDirective
1492
+ ];
1493
+ export { RaqmPopover, RaqmPopoverComponent, RaqmPopoverContentDirective, RaqmPopoverDescriptionDirective, RaqmPopoverHeaderDirective, RaqmPopoverTitleDirective, RaqmPopoverTriggerDirective };
1494
+
1495
+ //# sourceMappingURL=raqm-ui-popover.mjs.map