@raqm/ui 0.0.0-stage → 0.1.1
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.
- package/CHANGELOG.md +22 -0
- package/LICENSE +21 -0
- package/NOTICE.md +28 -0
- package/README.md +126 -3
- package/combobox/README.md +17 -0
- package/fesm2022/raqm-ui-accordion.mjs +414 -0
- package/fesm2022/raqm-ui-accordion.mjs.map +1 -0
- package/fesm2022/raqm-ui-alert-dialog.mjs +457 -0
- package/fesm2022/raqm-ui-alert-dialog.mjs.map +1 -0
- package/fesm2022/raqm-ui-alert.mjs +195 -0
- package/fesm2022/raqm-ui-alert.mjs.map +1 -0
- package/fesm2022/raqm-ui-aspect-ratio.mjs +66 -0
- package/fesm2022/raqm-ui-aspect-ratio.mjs.map +1 -0
- package/fesm2022/raqm-ui-attachment.mjs +435 -0
- package/fesm2022/raqm-ui-attachment.mjs.map +1 -0
- package/fesm2022/raqm-ui-avatar.mjs +337 -0
- package/fesm2022/raqm-ui-avatar.mjs.map +1 -0
- package/fesm2022/raqm-ui-badge.mjs +68 -0
- package/fesm2022/raqm-ui-badge.mjs.map +1 -0
- package/fesm2022/raqm-ui-breadcrumb.mjs +309 -0
- package/fesm2022/raqm-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/raqm-ui-button-group.mjs +138 -0
- package/fesm2022/raqm-ui-button-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-button.mjs +295 -0
- package/fesm2022/raqm-ui-button.mjs.map +1 -0
- package/fesm2022/raqm-ui-calendar.mjs +1394 -0
- package/fesm2022/raqm-ui-calendar.mjs.map +1 -0
- package/fesm2022/raqm-ui-card.mjs +331 -0
- package/fesm2022/raqm-ui-card.mjs.map +1 -0
- package/fesm2022/raqm-ui-carousel.mjs +410 -0
- package/fesm2022/raqm-ui-carousel.mjs.map +1 -0
- package/fesm2022/raqm-ui-checkbox.mjs +86 -0
- package/fesm2022/raqm-ui-checkbox.mjs.map +1 -0
- package/fesm2022/raqm-ui-collapsible.mjs +266 -0
- package/fesm2022/raqm-ui-collapsible.mjs.map +1 -0
- package/fesm2022/raqm-ui-combobox.mjs +1584 -0
- package/fesm2022/raqm-ui-combobox.mjs.map +1 -0
- package/fesm2022/raqm-ui-command.mjs +1210 -0
- package/fesm2022/raqm-ui-command.mjs.map +1 -0
- package/fesm2022/raqm-ui-context-menu.mjs +723 -0
- package/fesm2022/raqm-ui-context-menu.mjs.map +1 -0
- package/fesm2022/raqm-ui-dialog.mjs +1214 -0
- package/fesm2022/raqm-ui-dialog.mjs.map +1 -0
- package/fesm2022/raqm-ui-drawer.mjs +687 -0
- package/fesm2022/raqm-ui-drawer.mjs.map +1 -0
- package/fesm2022/raqm-ui-dropdown-menu.mjs +1168 -0
- package/fesm2022/raqm-ui-dropdown-menu.mjs.map +1 -0
- package/fesm2022/raqm-ui-empty.mjs +272 -0
- package/fesm2022/raqm-ui-empty.mjs.map +1 -0
- package/fesm2022/raqm-ui-field.mjs +517 -0
- package/fesm2022/raqm-ui-field.mjs.map +1 -0
- package/fesm2022/raqm-ui-hover-card.mjs +828 -0
- package/fesm2022/raqm-ui-hover-card.mjs.map +1 -0
- package/fesm2022/raqm-ui-input-group.mjs +270 -0
- package/fesm2022/raqm-ui-input-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-input-otp.mjs +788 -0
- package/fesm2022/raqm-ui-input-otp.mjs.map +1 -0
- package/fesm2022/raqm-ui-input.mjs +73 -0
- package/fesm2022/raqm-ui-input.mjs.map +1 -0
- package/fesm2022/raqm-ui-item.mjs +495 -0
- package/fesm2022/raqm-ui-item.mjs.map +1 -0
- package/fesm2022/raqm-ui-kbd.mjs +80 -0
- package/fesm2022/raqm-ui-kbd.mjs.map +1 -0
- package/fesm2022/raqm-ui-label.mjs +44 -0
- package/fesm2022/raqm-ui-label.mjs.map +1 -0
- package/fesm2022/raqm-ui-menubar.mjs +536 -0
- package/fesm2022/raqm-ui-menubar.mjs.map +1 -0
- package/fesm2022/raqm-ui-native-select.mjs +131 -0
- package/fesm2022/raqm-ui-native-select.mjs.map +1 -0
- package/fesm2022/raqm-ui-navigation-menu.mjs +1399 -0
- package/fesm2022/raqm-ui-navigation-menu.mjs.map +1 -0
- package/fesm2022/raqm-ui-overlay-internal.mjs +185 -0
- package/fesm2022/raqm-ui-overlay-internal.mjs.map +1 -0
- package/fesm2022/raqm-ui-pagination.mjs +440 -0
- package/fesm2022/raqm-ui-pagination.mjs.map +1 -0
- package/fesm2022/raqm-ui-popover.mjs +1495 -0
- package/fesm2022/raqm-ui-popover.mjs.map +1 -0
- package/fesm2022/raqm-ui-progress.mjs +369 -0
- package/fesm2022/raqm-ui-progress.mjs.map +1 -0
- package/fesm2022/raqm-ui-questionnaire.mjs +1005 -0
- package/fesm2022/raqm-ui-questionnaire.mjs.map +1 -0
- package/fesm2022/raqm-ui-radio-group.mjs +151 -0
- package/fesm2022/raqm-ui-radio-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-resizable.mjs +439 -0
- package/fesm2022/raqm-ui-resizable.mjs.map +1 -0
- package/fesm2022/raqm-ui-scroll-area.mjs +510 -0
- package/fesm2022/raqm-ui-scroll-area.mjs.map +1 -0
- package/fesm2022/raqm-ui-select.mjs +1073 -0
- package/fesm2022/raqm-ui-select.mjs.map +1 -0
- package/fesm2022/raqm-ui-separator.mjs +103 -0
- package/fesm2022/raqm-ui-separator.mjs.map +1 -0
- package/fesm2022/raqm-ui-sheet.mjs +411 -0
- package/fesm2022/raqm-ui-sheet.mjs.map +1 -0
- package/fesm2022/raqm-ui-sidebar.mjs +1784 -0
- package/fesm2022/raqm-ui-sidebar.mjs.map +1 -0
- package/fesm2022/raqm-ui-skeleton.mjs +50 -0
- package/fesm2022/raqm-ui-skeleton.mjs.map +1 -0
- package/fesm2022/raqm-ui-slider.mjs +609 -0
- package/fesm2022/raqm-ui-slider.mjs.map +1 -0
- package/fesm2022/raqm-ui-spinner.mjs +137 -0
- package/fesm2022/raqm-ui-spinner.mjs.map +1 -0
- package/fesm2022/raqm-ui-switch.mjs +109 -0
- package/fesm2022/raqm-ui-switch.mjs.map +1 -0
- package/fesm2022/raqm-ui-table.mjs +271 -0
- package/fesm2022/raqm-ui-table.mjs.map +1 -0
- package/fesm2022/raqm-ui-tabs.mjs +536 -0
- package/fesm2022/raqm-ui-tabs.mjs.map +1 -0
- package/fesm2022/raqm-ui-textarea.mjs +37 -0
- package/fesm2022/raqm-ui-textarea.mjs.map +1 -0
- package/fesm2022/raqm-ui-toast.mjs +918 -0
- package/fesm2022/raqm-ui-toast.mjs.map +1 -0
- package/fesm2022/raqm-ui-toggle-group.mjs +462 -0
- package/fesm2022/raqm-ui-toggle-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-toggle.mjs +158 -0
- package/fesm2022/raqm-ui-toggle.mjs.map +1 -0
- package/fesm2022/raqm-ui-tooltip.mjs +1226 -0
- package/fesm2022/raqm-ui-tooltip.mjs.map +1 -0
- package/fesm2022/raqm-ui.mjs +50 -0
- package/input-otp/README.md +12 -0
- package/package.json +275 -3
- package/styles/theme.css +4324 -0
- package/types/raqm-ui-accordion.d.ts +124 -0
- package/types/raqm-ui-alert-dialog.d.ts +81 -0
- package/types/raqm-ui-alert.d.ts +29 -0
- package/types/raqm-ui-aspect-ratio.d.ts +13 -0
- package/types/raqm-ui-attachment.d.ts +72 -0
- package/types/raqm-ui-avatar.d.ts +67 -0
- package/types/raqm-ui-badge.d.ts +20 -0
- package/types/raqm-ui-breadcrumb.d.ts +35 -0
- package/types/raqm-ui-button-group.d.ts +27 -0
- package/types/raqm-ui-button.d.ts +80 -0
- package/types/raqm-ui-calendar.d.ts +359 -0
- package/types/raqm-ui-card.d.ts +34 -0
- package/types/raqm-ui-carousel.d.ts +81 -0
- package/types/raqm-ui-checkbox.d.ts +24 -0
- package/types/raqm-ui-collapsible.d.ts +72 -0
- package/types/raqm-ui-combobox.d.ts +405 -0
- package/types/raqm-ui-command.d.ts +256 -0
- package/types/raqm-ui-context-menu.d.ts +196 -0
- package/types/raqm-ui-dialog.d.ts +232 -0
- package/types/raqm-ui-drawer.d.ts +121 -0
- package/types/raqm-ui-dropdown-menu.d.ts +319 -0
- package/types/raqm-ui-empty.d.ts +35 -0
- package/types/raqm-ui-field.d.ts +88 -0
- package/types/raqm-ui-hover-card.d.ts +139 -0
- package/types/raqm-ui-input-group.d.ts +45 -0
- package/types/raqm-ui-input-otp.d.ts +197 -0
- package/types/raqm-ui-input.d.ts +16 -0
- package/types/raqm-ui-item.d.ts +71 -0
- package/types/raqm-ui-kbd.d.ts +12 -0
- package/types/raqm-ui-label.d.ts +6 -0
- package/types/raqm-ui-menubar.d.ts +159 -0
- package/types/raqm-ui-native-select.d.ts +23 -0
- package/types/raqm-ui-navigation-menu.d.ts +230 -0
- package/types/raqm-ui-overlay-internal.d.ts +5 -0
- package/types/raqm-ui-pagination.d.ts +84 -0
- package/types/raqm-ui-popover.d.ts +235 -0
- package/types/raqm-ui-progress.d.ts +79 -0
- package/types/raqm-ui-questionnaire.d.ts +217 -0
- package/types/raqm-ui-radio-group.d.ts +48 -0
- package/types/raqm-ui-resizable.d.ts +98 -0
- package/types/raqm-ui-scroll-area.d.ts +132 -0
- package/types/raqm-ui-select.d.ts +205 -0
- package/types/raqm-ui-separator.d.ts +21 -0
- package/types/raqm-ui-sheet.d.ts +79 -0
- package/types/raqm-ui-sidebar.d.ts +285 -0
- package/types/raqm-ui-skeleton.d.ts +6 -0
- package/types/raqm-ui-slider.d.ts +129 -0
- package/types/raqm-ui-spinner.d.ts +32 -0
- package/types/raqm-ui-switch.d.ts +32 -0
- package/types/raqm-ui-table.d.ts +36 -0
- package/types/raqm-ui-tabs.d.ts +154 -0
- package/types/raqm-ui-textarea.d.ts +6 -0
- package/types/raqm-ui-toast.d.ts +190 -0
- package/types/raqm-ui-toggle-group.d.ts +167 -0
- package/types/raqm-ui-toggle.d.ts +42 -0
- package/types/raqm-ui-tooltip.d.ts +207 -0
- package/types/raqm-ui.d.ts +50 -0
|
@@ -0,0 +1,828 @@
|
|
|
1
|
+
import { DOCUMENT, NgTemplateOutlet } from "@angular/common";
|
|
2
|
+
import { InteractivityChecker } from "@angular/cdk/a11y";
|
|
3
|
+
import { Overlay } from "@angular/cdk/overlay";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, Injector, TemplateRef, ViewContainerRef, afterNextRender, booleanAttribute, computed, effect, inject, input, model, numberAttribute, signal, untracked, viewChild } from "@angular/core";
|
|
6
|
+
import { TemplatePortal } from "@angular/cdk/portal";
|
|
7
|
+
import { registerOverlayOwnership } from "@raqm/ui/overlay-internal";
|
|
8
|
+
import { Subscription } from "rxjs";
|
|
9
|
+
function connectHoverCardEffects(host) {
|
|
10
|
+
effect(() => {
|
|
11
|
+
const ready = host.open() && host.trigger() !== null && host.content() !== null && host.panel() !== void 0;
|
|
12
|
+
host.side();
|
|
13
|
+
host.align();
|
|
14
|
+
host.sideOffset();
|
|
15
|
+
host.alignOffset();
|
|
16
|
+
untracked(() => {
|
|
17
|
+
if (ready) {
|
|
18
|
+
host.attach();
|
|
19
|
+
host.positionPane();
|
|
20
|
+
} else host.detach();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const DEFAULT_SIDE = "bottom";
|
|
25
|
+
const DEFAULT_ALIGN = "center";
|
|
26
|
+
const TABBABLE_SELECTOR = "a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"]";
|
|
27
|
+
var RaqmHoverCardIntent = class {
|
|
28
|
+
host;
|
|
29
|
+
openTimer;
|
|
30
|
+
closeTimer;
|
|
31
|
+
transit;
|
|
32
|
+
focusOwned = false;
|
|
33
|
+
constructor(host) {
|
|
34
|
+
this.host = host;
|
|
35
|
+
}
|
|
36
|
+
requestOpen(fromFocus = false) {
|
|
37
|
+
if (fromFocus) this.focusOwned = true;
|
|
38
|
+
this.cancelClose();
|
|
39
|
+
this.clearTransit();
|
|
40
|
+
const trigger = this.host.trigger();
|
|
41
|
+
if (!trigger || trigger.element.matches(":disabled") || this.host.open() || this.openTimer !== void 0) return;
|
|
42
|
+
this.listenEscape();
|
|
43
|
+
this.openTimer = setTimeout(() => {
|
|
44
|
+
this.openTimer = void 0;
|
|
45
|
+
if (!this.host.destroyed() && !trigger.element.matches(":disabled")) this.host.setOpen(true);
|
|
46
|
+
}, trigger.delay());
|
|
47
|
+
}
|
|
48
|
+
close() {
|
|
49
|
+
this.focusOwned = false;
|
|
50
|
+
this.cancelOpen();
|
|
51
|
+
this.cancelClose();
|
|
52
|
+
this.clearTransit();
|
|
53
|
+
this.unlistenEscape();
|
|
54
|
+
this.host.setOpen(false);
|
|
55
|
+
this.host.detach();
|
|
56
|
+
}
|
|
57
|
+
focusOut(event) {
|
|
58
|
+
const next = event.relatedTarget;
|
|
59
|
+
if (next && (this.host.trigger()?.element.contains(next) || this.host.overlay().element?.contains(next))) return;
|
|
60
|
+
this.close();
|
|
61
|
+
}
|
|
62
|
+
pointerEnter(event) {
|
|
63
|
+
if (event.pointerType === "mouse") {
|
|
64
|
+
this.cancelClose();
|
|
65
|
+
this.clearTransit();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
contentFocus() {
|
|
69
|
+
this.cancelClose();
|
|
70
|
+
this.clearTransit();
|
|
71
|
+
}
|
|
72
|
+
pointerLeave(event) {
|
|
73
|
+
if (event.pointerType !== "mouse") return;
|
|
74
|
+
if (this.focusOwned || this.host.overlay().element?.contains(this.host.document.activeElement)) return;
|
|
75
|
+
this.cancelOpen();
|
|
76
|
+
this.clearTransit();
|
|
77
|
+
const trigger = this.host.trigger()?.element;
|
|
78
|
+
const surface = this.host.overlay().surface();
|
|
79
|
+
if (!trigger || !surface) {
|
|
80
|
+
this.unlistenEscape();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const fromContent = surface.contains(event.target);
|
|
84
|
+
const destination = fromContent ? trigger : surface;
|
|
85
|
+
if (event.relatedTarget instanceof Node && destination.contains(event.relatedTarget)) return;
|
|
86
|
+
const start = {
|
|
87
|
+
x: event.clientX,
|
|
88
|
+
y: event.clientY
|
|
89
|
+
};
|
|
90
|
+
this.scheduleClose();
|
|
91
|
+
this.transit = (move) => {
|
|
92
|
+
const a = trigger.getBoundingClientRect();
|
|
93
|
+
const b = surface.getBoundingClientRect();
|
|
94
|
+
const inside = (r) => move.clientX >= r.left && move.clientX <= r.right && move.clientY >= r.top && move.clientY <= r.bottom;
|
|
95
|
+
if (inside(a) || inside(b)) {
|
|
96
|
+
this.cancelClose();
|
|
97
|
+
this.clearTransit();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const target = destination.getBoundingClientRect();
|
|
101
|
+
const side = this.host.side();
|
|
102
|
+
const vertical = side === "top" || side === "bottom";
|
|
103
|
+
const edge = vertical ? fromContent ? side === "bottom" ? target.bottom : target.top : side === "bottom" ? target.top : target.bottom : fromContent ? side === "right" ? target.right : target.left : side === "right" ? target.left : target.right;
|
|
104
|
+
const p = vertical ? {
|
|
105
|
+
x: target.left - 1,
|
|
106
|
+
y: edge
|
|
107
|
+
} : {
|
|
108
|
+
x: edge,
|
|
109
|
+
y: target.top - 1
|
|
110
|
+
};
|
|
111
|
+
const q = vertical ? {
|
|
112
|
+
x: target.right + 1,
|
|
113
|
+
y: edge
|
|
114
|
+
} : {
|
|
115
|
+
x: edge,
|
|
116
|
+
y: target.bottom + 1
|
|
117
|
+
};
|
|
118
|
+
const cross = (u, v, w) => (u.x - w.x) * (v.y - w.y) - (v.x - w.x) * (u.y - w.y);
|
|
119
|
+
const point = {
|
|
120
|
+
x: move.clientX,
|
|
121
|
+
y: move.clientY
|
|
122
|
+
};
|
|
123
|
+
const signs = [
|
|
124
|
+
cross(point, start, p),
|
|
125
|
+
cross(point, p, q),
|
|
126
|
+
cross(point, q, start)
|
|
127
|
+
];
|
|
128
|
+
const inTriangle = !(signs.some((n) => n < -1) && signs.some((n) => n > 1));
|
|
129
|
+
const inTrough = vertical ? move.clientX >= Math.max(a.left, b.left) && move.clientX <= Math.min(a.right, b.right) && move.clientY >= Math.min(a.bottom, b.bottom) && move.clientY <= Math.max(a.top, b.top) : move.clientY >= Math.max(a.top, b.top) && move.clientY <= Math.min(a.bottom, b.bottom) && move.clientX >= Math.min(a.right, b.right) && move.clientX <= Math.max(a.left, b.left);
|
|
130
|
+
if (inTriangle || inTrough) this.cancelClose();
|
|
131
|
+
else {
|
|
132
|
+
this.scheduleClose();
|
|
133
|
+
this.clearTransit();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
this.host.document.addEventListener("pointermove", this.transit);
|
|
137
|
+
}
|
|
138
|
+
listenEscape() {
|
|
139
|
+
this.host.document.addEventListener("keydown", this.escape);
|
|
140
|
+
}
|
|
141
|
+
unlistenEscape() {
|
|
142
|
+
this.host.document.removeEventListener("keydown", this.escape);
|
|
143
|
+
}
|
|
144
|
+
release() {
|
|
145
|
+
this.cancelOpen();
|
|
146
|
+
this.cancelClose();
|
|
147
|
+
this.clearTransit();
|
|
148
|
+
this.unlistenEscape();
|
|
149
|
+
}
|
|
150
|
+
scheduleClose() {
|
|
151
|
+
if (this.closeTimer !== void 0) return;
|
|
152
|
+
this.closeTimer = setTimeout(() => {
|
|
153
|
+
this.closeTimer = void 0;
|
|
154
|
+
this.close();
|
|
155
|
+
}, this.host.trigger()?.closeDelay() ?? 300);
|
|
156
|
+
}
|
|
157
|
+
cancelOpen() {
|
|
158
|
+
clearTimeout(this.openTimer);
|
|
159
|
+
this.openTimer = void 0;
|
|
160
|
+
}
|
|
161
|
+
cancelClose() {
|
|
162
|
+
clearTimeout(this.closeTimer);
|
|
163
|
+
this.closeTimer = void 0;
|
|
164
|
+
}
|
|
165
|
+
clearTransit() {
|
|
166
|
+
if (this.transit) this.host.document.removeEventListener("pointermove", this.transit);
|
|
167
|
+
this.transit = void 0;
|
|
168
|
+
}
|
|
169
|
+
escape = (event) => {
|
|
170
|
+
if (event.key === "Escape") {
|
|
171
|
+
if (this.host.overlay().ref) {
|
|
172
|
+
event.preventDefault();
|
|
173
|
+
event.stopPropagation();
|
|
174
|
+
}
|
|
175
|
+
this.close();
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
var RaqmHoverCardKeyboard = class {
|
|
180
|
+
checker;
|
|
181
|
+
host;
|
|
182
|
+
constructor(checker, host) {
|
|
183
|
+
this.checker = checker;
|
|
184
|
+
this.host = host;
|
|
185
|
+
}
|
|
186
|
+
onTriggerKeydown(event) {
|
|
187
|
+
const ref = this.host.overlayRef();
|
|
188
|
+
if (event.key !== "Tab" || event.shiftKey || !ref) return;
|
|
189
|
+
const first = this.tabbables(ref.overlayElement)[0];
|
|
190
|
+
if (first) {
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
first.focus();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
onPanelKeydown(event) {
|
|
196
|
+
const ref = this.host.overlayRef();
|
|
197
|
+
if (event.key !== "Tab" || !ref) return;
|
|
198
|
+
const items = this.tabbables(ref.overlayElement);
|
|
199
|
+
const active = this.host.document.activeElement;
|
|
200
|
+
if (event.shiftKey && active === items[0]) {
|
|
201
|
+
event.preventDefault();
|
|
202
|
+
this.host.trigger()?.element.focus();
|
|
203
|
+
} else if (!event.shiftKey && active === items.at(-1)) {
|
|
204
|
+
const trigger = this.host.trigger()?.element;
|
|
205
|
+
const all = this.tabbables(this.host.document.body).filter((item) => !ref.overlayElement.contains(item));
|
|
206
|
+
const next = trigger ? all[all.indexOf(trigger) + 1] : void 0;
|
|
207
|
+
if (next) {
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
next.focus();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
tabbables(root) {
|
|
214
|
+
return Array.from(root.querySelectorAll(TABBABLE_SELECTOR)).filter((item) => this.checker.isTabbable(item));
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
var RaqmHoverCardOverlay = class {
|
|
218
|
+
overlay;
|
|
219
|
+
state;
|
|
220
|
+
position;
|
|
221
|
+
host;
|
|
222
|
+
overlayRef;
|
|
223
|
+
strategy;
|
|
224
|
+
subscriptions = new Subscription();
|
|
225
|
+
render;
|
|
226
|
+
observer;
|
|
227
|
+
exitTimer;
|
|
228
|
+
exiting;
|
|
229
|
+
constructor(overlay, state, position, host) {
|
|
230
|
+
this.overlay = overlay;
|
|
231
|
+
this.state = state;
|
|
232
|
+
this.position = position;
|
|
233
|
+
this.host = host;
|
|
234
|
+
}
|
|
235
|
+
get element() {
|
|
236
|
+
return this.overlayRef?.overlayElement;
|
|
237
|
+
}
|
|
238
|
+
get ref() {
|
|
239
|
+
return this.overlayRef;
|
|
240
|
+
}
|
|
241
|
+
attach() {
|
|
242
|
+
if (this.overlayRef || this.state.destroyed) return;
|
|
243
|
+
const trigger = this.host.trigger();
|
|
244
|
+
const panel = this.host.panel();
|
|
245
|
+
if (!trigger || !panel) return;
|
|
246
|
+
clearTimeout(this.exitTimer);
|
|
247
|
+
this.exiting?.dispose();
|
|
248
|
+
this.exiting = void 0;
|
|
249
|
+
this.state.direction.set(this.computedDirection());
|
|
250
|
+
this.strategy = this.overlay.position().flexibleConnectedTo(trigger.element).withFlexibleDimensions(false).withPush(true).withViewportMargin(5).withTransformOriginOn(".raqm-hover-card-content").withPositions(this.position.positions());
|
|
251
|
+
const ref = this.overlay.create({
|
|
252
|
+
positionStrategy: this.strategy,
|
|
253
|
+
hasBackdrop: false,
|
|
254
|
+
direction: this.state.direction(),
|
|
255
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
256
|
+
disposeOnNavigation: true
|
|
257
|
+
});
|
|
258
|
+
registerOverlayOwnership(trigger.element, ref);
|
|
259
|
+
this.overlayRef = ref;
|
|
260
|
+
this.subscriptions = new Subscription();
|
|
261
|
+
this.subscriptions.add(this.strategy.positionChanges.subscribe((change) => {
|
|
262
|
+
const side = this.position.sideFor(change.connectionPair);
|
|
263
|
+
this.state.resolvedSide.set(side);
|
|
264
|
+
}));
|
|
265
|
+
this.subscriptions.add(ref.outsidePointerEvents().subscribe((event) => {
|
|
266
|
+
if (!trigger.element.contains(event.target)) this.host.close();
|
|
267
|
+
}));
|
|
268
|
+
this.subscriptions.add(ref.detachments().subscribe(() => this.host.close()));
|
|
269
|
+
this.host.listenEscape();
|
|
270
|
+
ref.attach(new TemplatePortal(panel, this.host.container));
|
|
271
|
+
ref.overlayElement.style.visibility = "hidden";
|
|
272
|
+
this.render = afterNextRender(() => {
|
|
273
|
+
this.render = void 0;
|
|
274
|
+
if (this.overlayRef !== ref) return;
|
|
275
|
+
this.positionPane();
|
|
276
|
+
ref.overlayElement.style.visibility = "";
|
|
277
|
+
this.surface()?.classList.add("raqm-hover-card-content--entering");
|
|
278
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
279
|
+
this.observer = new ResizeObserver(() => this.positionPane());
|
|
280
|
+
this.observer.observe(trigger.element);
|
|
281
|
+
const surface = this.surface();
|
|
282
|
+
if (surface) this.observer.observe(surface);
|
|
283
|
+
}
|
|
284
|
+
}, { injector: this.host.injector });
|
|
285
|
+
}
|
|
286
|
+
positionPane() {
|
|
287
|
+
const direction = this.computedDirection();
|
|
288
|
+
this.state.direction.set(direction);
|
|
289
|
+
this.overlayRef?.setDirection(direction);
|
|
290
|
+
this.strategy?.withPositions(this.position.positions());
|
|
291
|
+
this.overlayRef?.updatePosition();
|
|
292
|
+
}
|
|
293
|
+
surface() {
|
|
294
|
+
return this.overlayRef?.overlayElement.querySelector(".raqm-hover-card-content") ?? null;
|
|
295
|
+
}
|
|
296
|
+
detach() {
|
|
297
|
+
this.host.releaseIntent();
|
|
298
|
+
this.render?.destroy();
|
|
299
|
+
this.render = void 0;
|
|
300
|
+
this.observer?.disconnect();
|
|
301
|
+
this.observer = void 0;
|
|
302
|
+
this.subscriptions.unsubscribe();
|
|
303
|
+
const ref = this.overlayRef;
|
|
304
|
+
this.overlayRef = void 0;
|
|
305
|
+
this.strategy = void 0;
|
|
306
|
+
if (!ref) return;
|
|
307
|
+
ref.overlayElement.setAttribute("inert", "");
|
|
308
|
+
ref.overlayElement.setAttribute("aria-hidden", "true");
|
|
309
|
+
const surface = ref.overlayElement.querySelector(".raqm-hover-card-content");
|
|
310
|
+
surface?.classList.remove("raqm-hover-card-content--entering");
|
|
311
|
+
surface?.classList.add("raqm-hover-card-content--closing");
|
|
312
|
+
if (this.state.destroyed || this.host.document.defaultView?.matchMedia("(prefers-reduced-motion: reduce)").matches) ref.dispose();
|
|
313
|
+
else {
|
|
314
|
+
this.exiting = ref;
|
|
315
|
+
this.exitTimer = setTimeout(() => {
|
|
316
|
+
ref.dispose();
|
|
317
|
+
this.exiting = void 0;
|
|
318
|
+
this.exitTimer = void 0;
|
|
319
|
+
}, 100);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
destroy() {
|
|
323
|
+
this.state.destroyed = true;
|
|
324
|
+
this.detach();
|
|
325
|
+
clearTimeout(this.exitTimer);
|
|
326
|
+
this.exiting?.dispose();
|
|
327
|
+
this.exiting = void 0;
|
|
328
|
+
}
|
|
329
|
+
computedDirection() {
|
|
330
|
+
return getComputedStyle(this.host.root).direction === "rtl" ? "rtl" : "ltr";
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
var RaqmHoverCardPosition = class {
|
|
334
|
+
host;
|
|
335
|
+
positionSides = [];
|
|
336
|
+
currentPositions = [];
|
|
337
|
+
constructor(host) {
|
|
338
|
+
this.host = host;
|
|
339
|
+
}
|
|
340
|
+
sideFor(pair) {
|
|
341
|
+
return this.positionSides[this.currentPositions.indexOf(pair)] ?? "bottom";
|
|
342
|
+
}
|
|
343
|
+
positions() {
|
|
344
|
+
const rtl = this.host.direction() === "rtl";
|
|
345
|
+
const requested = this.host.side();
|
|
346
|
+
const side = requested === "inline-start" ? rtl ? "right" : "left" : requested === "inline-end" ? rtl ? "left" : "right" : requested;
|
|
347
|
+
const opposite = {
|
|
348
|
+
top: "bottom",
|
|
349
|
+
bottom: "top",
|
|
350
|
+
left: "right",
|
|
351
|
+
right: "left"
|
|
352
|
+
};
|
|
353
|
+
this.positionSides = [side, opposite[side]];
|
|
354
|
+
this.currentPositions = this.positionSides.map((value) => {
|
|
355
|
+
const align = this.host.align();
|
|
356
|
+
const rawMain = this.host.sideOffset();
|
|
357
|
+
const rawCross = this.host.alignOffset();
|
|
358
|
+
const main = Number.isFinite(rawMain) ? rawMain : 4;
|
|
359
|
+
const cross = (Number.isFinite(rawCross) ? rawCross : 4) * (align === "end" ? -1 : 1);
|
|
360
|
+
if (value === "top" || value === "bottom") return {
|
|
361
|
+
originX: align,
|
|
362
|
+
overlayX: align,
|
|
363
|
+
originY: value,
|
|
364
|
+
overlayY: value === "top" ? "bottom" : "top",
|
|
365
|
+
offsetY: value === "top" ? -main : main,
|
|
366
|
+
offsetX: cross * (rtl ? -1 : 1)
|
|
367
|
+
};
|
|
368
|
+
const y = align === "start" ? "top" : align === "end" ? "bottom" : "center";
|
|
369
|
+
const end = value === "right";
|
|
370
|
+
return {
|
|
371
|
+
originX: end !== rtl ? "end" : "start",
|
|
372
|
+
overlayX: end !== rtl ? "start" : "end",
|
|
373
|
+
originY: y,
|
|
374
|
+
overlayY: y,
|
|
375
|
+
offsetX: end ? main : -main,
|
|
376
|
+
offsetY: cross
|
|
377
|
+
};
|
|
378
|
+
});
|
|
379
|
+
return this.currentPositions;
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
var RaqmHoverCardState = class {
|
|
383
|
+
direction = signal("ltr", ...ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []);
|
|
384
|
+
resolvedSide = signal("bottom", ...ngDevMode ? [{ debugName: "resolvedSide" }] : /* istanbul ignore next */ []);
|
|
385
|
+
destroyed = false;
|
|
386
|
+
};
|
|
387
|
+
var RaqmHoverCardComponent = class RaqmHoverCardComponent {
|
|
388
|
+
overlay = inject(Overlay);
|
|
389
|
+
document = inject(DOCUMENT);
|
|
390
|
+
host = inject(ElementRef);
|
|
391
|
+
container = inject(ViewContainerRef);
|
|
392
|
+
injector = inject(Injector);
|
|
393
|
+
checker = inject(InteractivityChecker);
|
|
394
|
+
panel = viewChild("panel", ...ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []);
|
|
395
|
+
openValue = model(void 0, {
|
|
396
|
+
...ngDevMode ? { debugName: "openValue" } : /* istanbul ignore next */ {},
|
|
397
|
+
alias: "open"
|
|
398
|
+
});
|
|
399
|
+
defaultOpen = input(false, {
|
|
400
|
+
...ngDevMode ? { debugName: "defaultOpen" } : /* istanbul ignore next */ {},
|
|
401
|
+
transform: booleanAttribute
|
|
402
|
+
});
|
|
403
|
+
side = input(DEFAULT_SIDE, ...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
|
|
404
|
+
align = input(DEFAULT_ALIGN, ...ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []);
|
|
405
|
+
sideOffset = input(4, {
|
|
406
|
+
...ngDevMode ? { debugName: "sideOffset" } : /* istanbul ignore next */ {},
|
|
407
|
+
transform: numberAttribute
|
|
408
|
+
});
|
|
409
|
+
alignOffset = input(4, {
|
|
410
|
+
...ngDevMode ? { debugName: "alignOffset" } : /* istanbul ignore next */ {},
|
|
411
|
+
transform: numberAttribute
|
|
412
|
+
});
|
|
413
|
+
open = computed(() => this.openValue() ?? this.defaultOpen(), ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
414
|
+
trigger = signal(null, ...ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []);
|
|
415
|
+
content = signal(null, ...ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []);
|
|
416
|
+
state = new RaqmHoverCardState();
|
|
417
|
+
direction = this.state.direction;
|
|
418
|
+
resolvedSide = this.state.resolvedSide;
|
|
419
|
+
positionController = new RaqmHoverCardPosition({
|
|
420
|
+
side: () => this.side(),
|
|
421
|
+
align: () => this.align(),
|
|
422
|
+
sideOffset: () => this.sideOffset(),
|
|
423
|
+
alignOffset: () => this.alignOffset(),
|
|
424
|
+
direction: () => this.state.direction()
|
|
425
|
+
});
|
|
426
|
+
layer = new RaqmHoverCardOverlay(this.overlay, this.state, this.positionController, {
|
|
427
|
+
root: this.host.nativeElement,
|
|
428
|
+
document: this.document,
|
|
429
|
+
container: this.container,
|
|
430
|
+
injector: this.injector,
|
|
431
|
+
trigger: () => this.trigger(),
|
|
432
|
+
panel: () => this.panel(),
|
|
433
|
+
close: () => this.close(),
|
|
434
|
+
listenEscape: () => this.intent.listenEscape(),
|
|
435
|
+
releaseIntent: () => this.intent.release()
|
|
436
|
+
});
|
|
437
|
+
keyboard = new RaqmHoverCardKeyboard(this.checker, {
|
|
438
|
+
document: this.document,
|
|
439
|
+
trigger: () => this.trigger(),
|
|
440
|
+
overlayRef: () => this.layer.ref
|
|
441
|
+
});
|
|
442
|
+
intent = new RaqmHoverCardIntent({
|
|
443
|
+
document: this.document,
|
|
444
|
+
open: () => this.open(),
|
|
445
|
+
setOpen: (value) => this.openValue.set(value),
|
|
446
|
+
destroyed: () => this.state.destroyed,
|
|
447
|
+
trigger: () => this.trigger(),
|
|
448
|
+
overlay: () => this.layer,
|
|
449
|
+
side: () => this.state.resolvedSide(),
|
|
450
|
+
detach: () => this.layer.detach()
|
|
451
|
+
});
|
|
452
|
+
constructor() {
|
|
453
|
+
connectHoverCardEffects({
|
|
454
|
+
open: () => this.open(),
|
|
455
|
+
trigger: () => this.trigger(),
|
|
456
|
+
content: () => this.content(),
|
|
457
|
+
panel: () => this.panel(),
|
|
458
|
+
side: () => this.side(),
|
|
459
|
+
align: () => this.align(),
|
|
460
|
+
sideOffset: () => this.sideOffset(),
|
|
461
|
+
alignOffset: () => this.alignOffset(),
|
|
462
|
+
attach: () => this.layer.attach(),
|
|
463
|
+
positionPane: () => this.layer.positionPane(),
|
|
464
|
+
detach: () => this.layer.detach()
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
registerTrigger(trigger) {
|
|
468
|
+
if (this.trigger()) throw new Error("Only one Hover Card trigger is supported per root.");
|
|
469
|
+
this.trigger.set(trigger);
|
|
470
|
+
}
|
|
471
|
+
unregisterTrigger(trigger) {
|
|
472
|
+
if (this.trigger() === trigger) {
|
|
473
|
+
this.close();
|
|
474
|
+
this.trigger.set(null);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
registerContent(content) {
|
|
478
|
+
if (this.content()) throw new Error("Only one Hover Card content template is supported per root.");
|
|
479
|
+
this.content.set(content);
|
|
480
|
+
}
|
|
481
|
+
unregisterContent(content) {
|
|
482
|
+
if (this.content() === content) {
|
|
483
|
+
this.close();
|
|
484
|
+
this.content.set(null);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
requestOpen(fromFocus = false) {
|
|
488
|
+
this.intent.requestOpen(fromFocus);
|
|
489
|
+
}
|
|
490
|
+
close() {
|
|
491
|
+
this.intent.close();
|
|
492
|
+
}
|
|
493
|
+
focusOut(event) {
|
|
494
|
+
this.intent.focusOut(event);
|
|
495
|
+
}
|
|
496
|
+
triggerKeydown(event) {
|
|
497
|
+
this.keyboard.onTriggerKeydown(event);
|
|
498
|
+
}
|
|
499
|
+
panelKeydown(event) {
|
|
500
|
+
this.keyboard.onPanelKeydown(event);
|
|
501
|
+
}
|
|
502
|
+
pointerEnter(event) {
|
|
503
|
+
this.intent.pointerEnter(event);
|
|
504
|
+
}
|
|
505
|
+
contentFocus() {
|
|
506
|
+
this.intent.contentFocus();
|
|
507
|
+
}
|
|
508
|
+
pointerLeave(event) {
|
|
509
|
+
this.intent.pointerLeave(event);
|
|
510
|
+
}
|
|
511
|
+
ngOnDestroy() {
|
|
512
|
+
this.layer.destroy();
|
|
513
|
+
}
|
|
514
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
515
|
+
minVersion: "12.0.0",
|
|
516
|
+
version: "22.2.2",
|
|
517
|
+
ngImport: i0,
|
|
518
|
+
type: RaqmHoverCardComponent,
|
|
519
|
+
deps: [],
|
|
520
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
521
|
+
});
|
|
522
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
523
|
+
minVersion: "17.2.0",
|
|
524
|
+
version: "22.2.2",
|
|
525
|
+
type: RaqmHoverCardComponent,
|
|
526
|
+
isStandalone: true,
|
|
527
|
+
selector: "raqm-hover-card",
|
|
528
|
+
inputs: {
|
|
529
|
+
openValue: {
|
|
530
|
+
classPropertyName: "openValue",
|
|
531
|
+
publicName: "open",
|
|
532
|
+
isSignal: true,
|
|
533
|
+
isRequired: false,
|
|
534
|
+
transformFunction: null
|
|
535
|
+
},
|
|
536
|
+
defaultOpen: {
|
|
537
|
+
classPropertyName: "defaultOpen",
|
|
538
|
+
publicName: "defaultOpen",
|
|
539
|
+
isSignal: true,
|
|
540
|
+
isRequired: false,
|
|
541
|
+
transformFunction: null
|
|
542
|
+
},
|
|
543
|
+
side: {
|
|
544
|
+
classPropertyName: "side",
|
|
545
|
+
publicName: "side",
|
|
546
|
+
isSignal: true,
|
|
547
|
+
isRequired: false,
|
|
548
|
+
transformFunction: null
|
|
549
|
+
},
|
|
550
|
+
align: {
|
|
551
|
+
classPropertyName: "align",
|
|
552
|
+
publicName: "align",
|
|
553
|
+
isSignal: true,
|
|
554
|
+
isRequired: false,
|
|
555
|
+
transformFunction: null
|
|
556
|
+
},
|
|
557
|
+
sideOffset: {
|
|
558
|
+
classPropertyName: "sideOffset",
|
|
559
|
+
publicName: "sideOffset",
|
|
560
|
+
isSignal: true,
|
|
561
|
+
isRequired: false,
|
|
562
|
+
transformFunction: null
|
|
563
|
+
},
|
|
564
|
+
alignOffset: {
|
|
565
|
+
classPropertyName: "alignOffset",
|
|
566
|
+
publicName: "alignOffset",
|
|
567
|
+
isSignal: true,
|
|
568
|
+
isRequired: false,
|
|
569
|
+
transformFunction: null
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
outputs: { openValue: "openChange" },
|
|
573
|
+
viewQueries: [{
|
|
574
|
+
propertyName: "panel",
|
|
575
|
+
first: true,
|
|
576
|
+
predicate: ["panel"],
|
|
577
|
+
descendants: true,
|
|
578
|
+
isSignal: true
|
|
579
|
+
}],
|
|
580
|
+
ngImport: i0,
|
|
581
|
+
template: "<ng-content />\r\n<ng-template #panel>\r\n <div\r\n class=\"raqm-hover-card-content\"\r\n tabindex=\"-1\"\r\n [dir]=\"direction()\"\r\n [attr.data-raqm-side]=\"resolvedSide()\"\r\n (pointerenter)=\"pointerEnter($event)\"\r\n (pointerleave)=\"pointerLeave($event)\"\r\n (focusout)=\"focusOut($event)\"\r\n (focusin)=\"contentFocus()\"\r\n (keydown)=\"panelKeydown($event)\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"content()?.template ?? null\" />\r\n </div>\r\n</ng-template>\r\n",
|
|
582
|
+
styles: [":host{display:contents}.raqm-hover-card-content{box-sizing:border-box;inline-size:calc(var(--raqm-spacing) * 64);max-inline-size:calc(100vw - 10px);max-block-size:calc(100dvh - 10px);overflow:auto;padding:calc(var(--raqm-spacing) * 2.5);border-radius:var(--raqm-radius-lg);background:var(--raqm-popover);color:var(--raqm-popover-foreground);font-size:var(--raqm-font-size-sm);line-height:1.25rem;outline:none;box-shadow:0 0 0 1px color-mix(in oklch,var(--raqm-foreground) 10%,transparent),var(--raqm-shadow-md)}.raqm-hover-card-content[data-raqm-side=bottom]{--raqm-hover-card-slide: translateY(-.5rem)}.raqm-hover-card-content[data-raqm-side=top]{--raqm-hover-card-slide: translateY(.5rem)}.raqm-hover-card-content[data-raqm-side=left]{--raqm-hover-card-slide: translateX(.5rem)}.raqm-hover-card-content[data-raqm-side=right]{--raqm-hover-card-slide: translateX(-.5rem)}.raqm-hover-card-content--entering{animation:raqm-hover-card-in var(--raqm-duration-fast) var(--raqm-ease-out)}.raqm-hover-card-content--closing{opacity:0;transform:scale(.95);transition:opacity var(--raqm-duration-fast),transform var(--raqm-duration-fast)}@keyframes raqm-hover-card-in{0%{opacity:0;transform:var(--raqm-hover-card-slide, none) scale(.95)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.raqm-hover-card-content{animation:none;transition:none}}@media(forced-colors:active){.raqm-hover-card-content{border:1px solid CanvasText}}\n"],
|
|
583
|
+
dependencies: [{
|
|
584
|
+
kind: "directive",
|
|
585
|
+
type: NgTemplateOutlet,
|
|
586
|
+
selector: "[ngTemplateOutlet]",
|
|
587
|
+
inputs: [
|
|
588
|
+
"ngTemplateOutletContext",
|
|
589
|
+
"ngTemplateOutlet",
|
|
590
|
+
"ngTemplateOutletInjector"
|
|
591
|
+
]
|
|
592
|
+
}],
|
|
593
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
594
|
+
});
|
|
595
|
+
};
|
|
596
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
597
|
+
minVersion: "12.0.0",
|
|
598
|
+
version: "22.2.2",
|
|
599
|
+
ngImport: i0,
|
|
600
|
+
type: RaqmHoverCardComponent,
|
|
601
|
+
decorators: [{
|
|
602
|
+
type: Component,
|
|
603
|
+
args: [{
|
|
604
|
+
selector: "raqm-hover-card",
|
|
605
|
+
imports: [NgTemplateOutlet],
|
|
606
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
607
|
+
template: "<ng-content />\r\n<ng-template #panel>\r\n <div\r\n class=\"raqm-hover-card-content\"\r\n tabindex=\"-1\"\r\n [dir]=\"direction()\"\r\n [attr.data-raqm-side]=\"resolvedSide()\"\r\n (pointerenter)=\"pointerEnter($event)\"\r\n (pointerleave)=\"pointerLeave($event)\"\r\n (focusout)=\"focusOut($event)\"\r\n (focusin)=\"contentFocus()\"\r\n (keydown)=\"panelKeydown($event)\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"content()?.template ?? null\" />\r\n </div>\r\n</ng-template>\r\n",
|
|
608
|
+
styles: [":host{display:contents}.raqm-hover-card-content{box-sizing:border-box;inline-size:calc(var(--raqm-spacing) * 64);max-inline-size:calc(100vw - 10px);max-block-size:calc(100dvh - 10px);overflow:auto;padding:calc(var(--raqm-spacing) * 2.5);border-radius:var(--raqm-radius-lg);background:var(--raqm-popover);color:var(--raqm-popover-foreground);font-size:var(--raqm-font-size-sm);line-height:1.25rem;outline:none;box-shadow:0 0 0 1px color-mix(in oklch,var(--raqm-foreground) 10%,transparent),var(--raqm-shadow-md)}.raqm-hover-card-content[data-raqm-side=bottom]{--raqm-hover-card-slide: translateY(-.5rem)}.raqm-hover-card-content[data-raqm-side=top]{--raqm-hover-card-slide: translateY(.5rem)}.raqm-hover-card-content[data-raqm-side=left]{--raqm-hover-card-slide: translateX(.5rem)}.raqm-hover-card-content[data-raqm-side=right]{--raqm-hover-card-slide: translateX(-.5rem)}.raqm-hover-card-content--entering{animation:raqm-hover-card-in var(--raqm-duration-fast) var(--raqm-ease-out)}.raqm-hover-card-content--closing{opacity:0;transform:scale(.95);transition:opacity var(--raqm-duration-fast),transform var(--raqm-duration-fast)}@keyframes raqm-hover-card-in{0%{opacity:0;transform:var(--raqm-hover-card-slide, none) scale(.95)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.raqm-hover-card-content{animation:none;transition:none}}@media(forced-colors:active){.raqm-hover-card-content{border:1px solid CanvasText}}\n"]
|
|
609
|
+
}]
|
|
610
|
+
}],
|
|
611
|
+
ctorParameters: () => [],
|
|
612
|
+
propDecorators: {
|
|
613
|
+
panel: [{
|
|
614
|
+
type: i0.ViewChild,
|
|
615
|
+
args: ["panel", { isSignal: true }]
|
|
616
|
+
}],
|
|
617
|
+
openValue: [{
|
|
618
|
+
type: i0.Input,
|
|
619
|
+
args: [{
|
|
620
|
+
isSignal: true,
|
|
621
|
+
alias: "open",
|
|
622
|
+
required: false
|
|
623
|
+
}]
|
|
624
|
+
}, {
|
|
625
|
+
type: i0.Output,
|
|
626
|
+
args: ["openChange"]
|
|
627
|
+
}],
|
|
628
|
+
defaultOpen: [{
|
|
629
|
+
type: i0.Input,
|
|
630
|
+
args: [{
|
|
631
|
+
isSignal: true,
|
|
632
|
+
alias: "defaultOpen",
|
|
633
|
+
required: false
|
|
634
|
+
}]
|
|
635
|
+
}],
|
|
636
|
+
side: [{
|
|
637
|
+
type: i0.Input,
|
|
638
|
+
args: [{
|
|
639
|
+
isSignal: true,
|
|
640
|
+
alias: "side",
|
|
641
|
+
required: false
|
|
642
|
+
}]
|
|
643
|
+
}],
|
|
644
|
+
align: [{
|
|
645
|
+
type: i0.Input,
|
|
646
|
+
args: [{
|
|
647
|
+
isSignal: true,
|
|
648
|
+
alias: "align",
|
|
649
|
+
required: false
|
|
650
|
+
}]
|
|
651
|
+
}],
|
|
652
|
+
sideOffset: [{
|
|
653
|
+
type: i0.Input,
|
|
654
|
+
args: [{
|
|
655
|
+
isSignal: true,
|
|
656
|
+
alias: "sideOffset",
|
|
657
|
+
required: false
|
|
658
|
+
}]
|
|
659
|
+
}],
|
|
660
|
+
alignOffset: [{
|
|
661
|
+
type: i0.Input,
|
|
662
|
+
args: [{
|
|
663
|
+
isSignal: true,
|
|
664
|
+
alias: "alignOffset",
|
|
665
|
+
required: false
|
|
666
|
+
}]
|
|
667
|
+
}]
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
function delay(fallback) {
|
|
671
|
+
return (value) => {
|
|
672
|
+
const parsed = numberAttribute(value, fallback);
|
|
673
|
+
return Number.isFinite(parsed) ? Math.max(0, parsed) : fallback;
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
var RaqmHoverCardTriggerDirective = class RaqmHoverCardTriggerDirective {
|
|
677
|
+
element = inject(ElementRef).nativeElement;
|
|
678
|
+
card = inject(RaqmHoverCardComponent);
|
|
679
|
+
delay = input(600, {
|
|
680
|
+
...ngDevMode ? { debugName: "delay" } : /* istanbul ignore next */ {},
|
|
681
|
+
transform: delay(600)
|
|
682
|
+
});
|
|
683
|
+
closeDelay = input(300, {
|
|
684
|
+
...ngDevMode ? { debugName: "closeDelay" } : /* istanbul ignore next */ {},
|
|
685
|
+
transform: delay(300)
|
|
686
|
+
});
|
|
687
|
+
constructor() {
|
|
688
|
+
if (this.element instanceof HTMLButtonElement && !this.element.hasAttribute("type")) this.element.setAttribute("type", "button");
|
|
689
|
+
this.card.registerTrigger(this);
|
|
690
|
+
inject(DestroyRef).onDestroy(() => this.card.unregisterTrigger(this));
|
|
691
|
+
}
|
|
692
|
+
enter(event) {
|
|
693
|
+
if (event.pointerType === "mouse") this.card.requestOpen();
|
|
694
|
+
}
|
|
695
|
+
leave(event) {
|
|
696
|
+
const pointer = event;
|
|
697
|
+
if (pointer.pointerType === "mouse") this.card.pointerLeave(pointer);
|
|
698
|
+
}
|
|
699
|
+
blur(event) {
|
|
700
|
+
this.card.focusOut(event);
|
|
701
|
+
}
|
|
702
|
+
keydown(event) {
|
|
703
|
+
this.card.triggerKeydown(event);
|
|
704
|
+
}
|
|
705
|
+
focus() {
|
|
706
|
+
if (this.element.matches(":focus-visible")) this.card.requestOpen(true);
|
|
707
|
+
}
|
|
708
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
709
|
+
minVersion: "12.0.0",
|
|
710
|
+
version: "22.2.2",
|
|
711
|
+
ngImport: i0,
|
|
712
|
+
type: RaqmHoverCardTriggerDirective,
|
|
713
|
+
deps: [],
|
|
714
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
715
|
+
});
|
|
716
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
717
|
+
minVersion: "17.1.0",
|
|
718
|
+
version: "22.2.2",
|
|
719
|
+
type: RaqmHoverCardTriggerDirective,
|
|
720
|
+
isStandalone: true,
|
|
721
|
+
selector: "a[raqm-hover-card-trigger], button[raqm-hover-card-trigger]",
|
|
722
|
+
inputs: {
|
|
723
|
+
delay: {
|
|
724
|
+
classPropertyName: "delay",
|
|
725
|
+
publicName: "delay",
|
|
726
|
+
isSignal: true,
|
|
727
|
+
isRequired: false,
|
|
728
|
+
transformFunction: null
|
|
729
|
+
},
|
|
730
|
+
closeDelay: {
|
|
731
|
+
classPropertyName: "closeDelay",
|
|
732
|
+
publicName: "closeDelay",
|
|
733
|
+
isSignal: true,
|
|
734
|
+
isRequired: false,
|
|
735
|
+
transformFunction: null
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
host: { listeners: {
|
|
739
|
+
"pointerenter": "enter($event)",
|
|
740
|
+
"pointerleave": "leave($event)",
|
|
741
|
+
"focus": "focus()",
|
|
742
|
+
"blur": "blur($event)",
|
|
743
|
+
"keydown": "keydown($event)"
|
|
744
|
+
} },
|
|
745
|
+
ngImport: i0
|
|
746
|
+
});
|
|
747
|
+
};
|
|
748
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
749
|
+
minVersion: "12.0.0",
|
|
750
|
+
version: "22.2.2",
|
|
751
|
+
ngImport: i0,
|
|
752
|
+
type: RaqmHoverCardTriggerDirective,
|
|
753
|
+
decorators: [{
|
|
754
|
+
type: Directive,
|
|
755
|
+
args: [{
|
|
756
|
+
selector: "a[raqm-hover-card-trigger], button[raqm-hover-card-trigger]",
|
|
757
|
+
host: {
|
|
758
|
+
"(pointerenter)": "enter($event)",
|
|
759
|
+
"(pointerleave)": "leave($event)",
|
|
760
|
+
"(focus)": "focus()",
|
|
761
|
+
"(blur)": "blur($event)",
|
|
762
|
+
"(keydown)": "keydown($event)"
|
|
763
|
+
}
|
|
764
|
+
}]
|
|
765
|
+
}],
|
|
766
|
+
ctorParameters: () => [],
|
|
767
|
+
propDecorators: {
|
|
768
|
+
delay: [{
|
|
769
|
+
type: i0.Input,
|
|
770
|
+
args: [{
|
|
771
|
+
isSignal: true,
|
|
772
|
+
alias: "delay",
|
|
773
|
+
required: false
|
|
774
|
+
}]
|
|
775
|
+
}],
|
|
776
|
+
closeDelay: [{
|
|
777
|
+
type: i0.Input,
|
|
778
|
+
args: [{
|
|
779
|
+
isSignal: true,
|
|
780
|
+
alias: "closeDelay",
|
|
781
|
+
required: false
|
|
782
|
+
}]
|
|
783
|
+
}]
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
var RaqmHoverCardContentDirective = class RaqmHoverCardContentDirective {
|
|
787
|
+
template = inject(TemplateRef);
|
|
788
|
+
card = inject(RaqmHoverCardComponent);
|
|
789
|
+
constructor() {
|
|
790
|
+
this.card.registerContent(this);
|
|
791
|
+
inject(DestroyRef).onDestroy(() => this.card.unregisterContent(this));
|
|
792
|
+
}
|
|
793
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
794
|
+
minVersion: "12.0.0",
|
|
795
|
+
version: "22.2.2",
|
|
796
|
+
ngImport: i0,
|
|
797
|
+
type: RaqmHoverCardContentDirective,
|
|
798
|
+
deps: [],
|
|
799
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
800
|
+
});
|
|
801
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
802
|
+
minVersion: "14.0.0",
|
|
803
|
+
version: "22.2.2",
|
|
804
|
+
type: RaqmHoverCardContentDirective,
|
|
805
|
+
isStandalone: true,
|
|
806
|
+
selector: "ng-template[raqm-hover-card-content]",
|
|
807
|
+
ngImport: i0
|
|
808
|
+
});
|
|
809
|
+
};
|
|
810
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
811
|
+
minVersion: "12.0.0",
|
|
812
|
+
version: "22.2.2",
|
|
813
|
+
ngImport: i0,
|
|
814
|
+
type: RaqmHoverCardContentDirective,
|
|
815
|
+
decorators: [{
|
|
816
|
+
type: Directive,
|
|
817
|
+
args: [{ selector: "ng-template[raqm-hover-card-content]" }]
|
|
818
|
+
}],
|
|
819
|
+
ctorParameters: () => []
|
|
820
|
+
});
|
|
821
|
+
const RaqmHoverCard = [
|
|
822
|
+
RaqmHoverCardComponent,
|
|
823
|
+
RaqmHoverCardTriggerDirective,
|
|
824
|
+
RaqmHoverCardContentDirective
|
|
825
|
+
];
|
|
826
|
+
export { RaqmHoverCard, RaqmHoverCardComponent, RaqmHoverCardContentDirective, RaqmHoverCardTriggerDirective };
|
|
827
|
+
|
|
828
|
+
//# sourceMappingURL=raqm-ui-hover-card.mjs.map
|