@orbitkit/components 0.2.0 → 0.3.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.
- package/dist/astro/accordion/Accordion.astro +34 -34
- package/dist/astro/accordion/AccordionItem.astro +19 -19
- package/dist/astro/accordion/AccordionTrigger.astro +33 -33
- package/dist/astro/accordion/AcordionContent.astro +23 -23
- package/dist/astro/accordion/accordion.ts +151 -151
- package/dist/astro/accordion/index.ts +6 -6
- package/dist/astro/collapsible/Collapsible.astro +34 -34
- package/dist/astro/collapsible/CollapsibleContent.astro +20 -20
- package/dist/astro/collapsible/collapsible.ts +81 -81
- package/dist/astro/collapsible/index.ts +4 -4
- package/dist/astro/drawer/DrawerContent.astro +74 -74
- package/dist/astro/drawer/drawer.ts +104 -104
- package/dist/astro/drawer/index.ts +17 -17
- package/dist/astro/dropdown/DropdownMenu.astro +19 -19
- package/dist/astro/dropdown/DropdownMenuContent.astro +42 -42
- package/dist/astro/dropdown/DropdownMenuGroup.astro +3 -3
- package/dist/astro/dropdown/DropdownMenuItem.astro +27 -27
- package/dist/astro/dropdown/DropdownMenuLabel.astro +3 -3
- package/dist/astro/dropdown/DropdownMenuSeparator.astro +6 -6
- package/dist/astro/dropdown/dropdown.ts +157 -157
- package/dist/astro/dropdown/dropdownVariants.ts +134 -134
- package/dist/astro/dropdown/index.ts +23 -23
- package/dist/astro/marquee/Marquee.astro +53 -0
- package/dist/astro/marquee/index.ts +3 -0
- package/dist/astro/modal/Modal.astro +19 -19
- package/dist/astro/modal/ModalContent.astro +71 -71
- package/dist/astro/modal/ModalDescription.astro +12 -12
- package/dist/astro/modal/ModalFooter.astro +15 -15
- package/dist/astro/modal/ModalHeader.astro +12 -12
- package/dist/astro/modal/ModalTitle.astro +18 -18
- package/dist/astro/modal/index.ts +15 -15
- package/dist/astro/modal/modal.ts +101 -101
- package/dist/astro/pagination/index.ts +15 -15
- package/dist/astro/popover/Popover.astro +17 -17
- package/dist/astro/popover/PopoverContent.astro +39 -39
- package/dist/astro/popover/index.ts +5 -5
- package/dist/astro/popover/popover.ts +113 -113
- package/dist/astro/popover/popoverVariants.ts +115 -115
- package/dist/astro/scroll-progress/ScrollProgress.astro +41 -0
- package/dist/astro/scroll-progress/ScrollProgressBar.astro +19 -0
- package/dist/astro/scroll-progress/index.ts +4 -0
- package/dist/astro/stat/Stat.astro +12 -12
- package/dist/astro/stat/StatDescription.astro +12 -12
- package/dist/astro/stat/StatTitle.astro +18 -18
- package/dist/astro/stat/StatValue.astro +12 -12
- package/dist/astro/stat/index.ts +6 -6
- package/dist/astro/tab/TabList.astro +19 -19
- package/dist/astro/toast/Toast.astro +36 -0
- package/dist/astro/toast/ToastDescription.astro +10 -0
- package/dist/astro/toast/ToastTitle.astro +18 -0
- package/dist/astro/toast/Toaster.astro +78 -0
- package/dist/astro/toast/assets.ts +6 -0
- package/dist/astro/toast/index.ts +30 -0
- package/dist/astro/toast/toast.ts +277 -0
- package/dist/astro/tooltip/Tooltip.astro +40 -40
- package/dist/astro/tooltip/TooltipContent.astro +39 -39
- package/dist/astro/tooltip/index.ts +5 -5
- package/dist/astro/tooltip/tooltip.ts +137 -137
- package/dist/astro/tooltip/tooltipVariants.ts +115 -115
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/package.json +54 -54
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { toastIcons } from "./assets";
|
|
2
|
+
|
|
3
|
+
export interface ToastDomElements {
|
|
4
|
+
title: HTMLElement | null;
|
|
5
|
+
description: HTMLElement | null;
|
|
6
|
+
dismissibleButton: HTMLElement | null;
|
|
7
|
+
iconContainer: HTMLElement | null;
|
|
8
|
+
closeButtons: NodeListOf<HTMLElement>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type ToastPosition =
|
|
12
|
+
| "top-right"
|
|
13
|
+
| "top-center"
|
|
14
|
+
| "top-left"
|
|
15
|
+
| "bottom-right"
|
|
16
|
+
| "bottom-center"
|
|
17
|
+
| "bottom-left";
|
|
18
|
+
|
|
19
|
+
export type ToastType = "default" | "success" | "error" | "warning" | "info";
|
|
20
|
+
|
|
21
|
+
export interface ToastOptions {
|
|
22
|
+
title: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
duration?: number;
|
|
25
|
+
dismissible?: boolean;
|
|
26
|
+
autoClose?: boolean;
|
|
27
|
+
type?: ToastType;
|
|
28
|
+
onClose?: () => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const DEFAULT_DURATION = 3000;
|
|
32
|
+
const DEFAULT_MAX_VISIBLE_TOASTS = 3;
|
|
33
|
+
const DEFAULT_OFFSET = 24;
|
|
34
|
+
const DEFAULT_GAP = 16;
|
|
35
|
+
const DEFAULT_POSITION: ToastPosition = "bottom-right";
|
|
36
|
+
const DEFAULT_TOAST_TYPE: ToastType = "default";
|
|
37
|
+
|
|
38
|
+
export class Toast {
|
|
39
|
+
private static instances: HTMLElement[] = [];
|
|
40
|
+
|
|
41
|
+
private opts: ToastOptions;
|
|
42
|
+
private toaster: HTMLElement | null;
|
|
43
|
+
private toast: HTMLElement | null;
|
|
44
|
+
private elements: ToastDomElements;
|
|
45
|
+
|
|
46
|
+
private duration: number;
|
|
47
|
+
private startTime: number = 0;
|
|
48
|
+
private remainingTime: number = 0;
|
|
49
|
+
private timeoutId: number | null = null;
|
|
50
|
+
private position: ToastPosition;
|
|
51
|
+
private dismissible: boolean;
|
|
52
|
+
private autoClose: boolean;
|
|
53
|
+
|
|
54
|
+
private maxVisibleToasts: number;
|
|
55
|
+
private offset: number;
|
|
56
|
+
private gap: number;
|
|
57
|
+
|
|
58
|
+
constructor(opts: ToastOptions) {
|
|
59
|
+
this.opts = opts;
|
|
60
|
+
|
|
61
|
+
this.toaster = document.querySelector("[data-toaster]");
|
|
62
|
+
if (!this.toaster) {
|
|
63
|
+
throw new Error(
|
|
64
|
+
"Toaster container with 'data-toaster' attribute not found in the document.",
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this.toast = this.getTemplate().querySelector(
|
|
69
|
+
"[data-toast]",
|
|
70
|
+
) as HTMLElement;
|
|
71
|
+
if (!this.toast) {
|
|
72
|
+
throw new Error("Toast element with 'data-toast' not found in template.");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this.elements = {
|
|
76
|
+
title: this.toast.querySelector("[data-toast-title]"),
|
|
77
|
+
description: this.toast.querySelector("[data-toast-description]"),
|
|
78
|
+
iconContainer: this.toast.querySelector("[data-toast-icon]"),
|
|
79
|
+
closeButtons: this.toast.querySelectorAll("[data-close]") ?? [],
|
|
80
|
+
dismissibleButton: this.toast.querySelector("[data-dismissible-button]"),
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
this.gap = parseInt(this.toaster.dataset.gap ?? `${DEFAULT_GAP}`, 10);
|
|
84
|
+
this.maxVisibleToasts = parseInt(
|
|
85
|
+
this.toaster.dataset.visibleToasts ?? `${DEFAULT_MAX_VISIBLE_TOASTS}`,
|
|
86
|
+
10,
|
|
87
|
+
);
|
|
88
|
+
this.offset = parseInt(
|
|
89
|
+
this.toaster.dataset.offset ?? `${DEFAULT_OFFSET}`,
|
|
90
|
+
10,
|
|
91
|
+
);
|
|
92
|
+
this.position =
|
|
93
|
+
(this.toaster?.dataset.position as typeof this.position) ??
|
|
94
|
+
DEFAULT_POSITION;
|
|
95
|
+
this.duration =
|
|
96
|
+
this.opts.duration ??
|
|
97
|
+
parseInt(this.toaster.dataset.duration ?? `${DEFAULT_DURATION}`);
|
|
98
|
+
this.dismissible =
|
|
99
|
+
this.opts.dismissible ?? this.toaster.dataset.dismissible === "true";
|
|
100
|
+
this.autoClose =
|
|
101
|
+
this.opts.autoClose ?? this.toaster.dataset.autoClose === "true";
|
|
102
|
+
|
|
103
|
+
this.init();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private init() {
|
|
107
|
+
this.initializeToastContent();
|
|
108
|
+
this.calculateInitialPosition();
|
|
109
|
+
this.setupAccessibility();
|
|
110
|
+
this.setupEventListeners();
|
|
111
|
+
this.showToast();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private setupAccessibility() {
|
|
115
|
+
if (this.toast) {
|
|
116
|
+
this.toast.setAttribute("role", "alert");
|
|
117
|
+
this.toast.setAttribute("aria-live", "assertive");
|
|
118
|
+
this.toast.setAttribute("aria-atomic", "true");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private initializeToastContent() {
|
|
123
|
+
this.toast!.setAttribute(
|
|
124
|
+
"data-toast-type",
|
|
125
|
+
this.opts.type ?? DEFAULT_TOAST_TYPE,
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
if (this.elements.iconContainer) {
|
|
129
|
+
const iconType = toastIcons[this.opts.type ?? DEFAULT_TOAST_TYPE];
|
|
130
|
+
if (iconType) {
|
|
131
|
+
this.elements.iconContainer.innerHTML = iconType;
|
|
132
|
+
} else {
|
|
133
|
+
this.elements.iconContainer.remove();
|
|
134
|
+
this.elements.iconContainer = null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (this.elements.title) {
|
|
139
|
+
this.elements.title.textContent = this.opts.title;
|
|
140
|
+
} else {
|
|
141
|
+
console.warn(
|
|
142
|
+
"Toast title element not found. Title might not be displayed.",
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (this.opts.description && this.elements.description) {
|
|
147
|
+
this.elements.description.textContent = this.opts.description;
|
|
148
|
+
} else if (this.elements.description) {
|
|
149
|
+
this.elements.description.remove();
|
|
150
|
+
this.elements.description = null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (!this.dismissible && this.elements.dismissibleButton) {
|
|
154
|
+
this.elements.dismissibleButton.remove();
|
|
155
|
+
this.elements.dismissibleButton = null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private setupEventListeners() {
|
|
160
|
+
this.elements.closeButtons.forEach((trigger) => {
|
|
161
|
+
trigger.addEventListener("click", () => this.removeToast());
|
|
162
|
+
});
|
|
163
|
+
this.toaster!.addEventListener("mouseenter", () => this.handleMouseEnter());
|
|
164
|
+
this.toaster!.addEventListener("mouseleave", () => this.handleMouseLeave());
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
private showToast() {
|
|
168
|
+
this.toaster?.insertAdjacentElement("afterbegin", this.toast!);
|
|
169
|
+
Toast.instances.unshift(this.toast!);
|
|
170
|
+
this.adjustToastPositions();
|
|
171
|
+
this.setState(this.toast!, "showing");
|
|
172
|
+
|
|
173
|
+
if (this.autoClose) {
|
|
174
|
+
this.startTime = Date.now();
|
|
175
|
+
this.remainingTime = this.duration;
|
|
176
|
+
this.timeoutId = window.setInterval(() => {
|
|
177
|
+
this.removeToast();
|
|
178
|
+
this.opts.onClose?.();
|
|
179
|
+
}, this.duration);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
private removeToast() {
|
|
184
|
+
this.setState(this.toast!, "hide");
|
|
185
|
+
const index = Toast.instances.indexOf(this.toast!);
|
|
186
|
+
if (index !== -1) {
|
|
187
|
+
Toast.instances.splice(index, 1);
|
|
188
|
+
}
|
|
189
|
+
this.adjustToastPositions();
|
|
190
|
+
|
|
191
|
+
setTimeout(() => {
|
|
192
|
+
this.toast?.remove();
|
|
193
|
+
this.opts.onClose?.();
|
|
194
|
+
}, 500);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
private adjustToastPositions() {
|
|
198
|
+
const isButtom = this.position.startsWith("bottom");
|
|
199
|
+
let accumulatedHeight = this.offset;
|
|
200
|
+
|
|
201
|
+
Toast.instances.forEach((currentToast, index) => {
|
|
202
|
+
accumulatedHeight += currentToast.offsetHeight;
|
|
203
|
+
const verticalOffset = accumulatedHeight + index * this.gap;
|
|
204
|
+
|
|
205
|
+
const sign = isButtom ? -1 : 1;
|
|
206
|
+
const translateYValue =
|
|
207
|
+
sign * (verticalOffset - currentToast.offsetHeight);
|
|
208
|
+
|
|
209
|
+
let translateXValue = "";
|
|
210
|
+
if (this.position.endsWith("center")) {
|
|
211
|
+
translateXValue = "translateX(-50%)";
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
currentToast.style.transform = `${translateXValue} translateY(${translateYValue}px)`;
|
|
215
|
+
|
|
216
|
+
this.setState(
|
|
217
|
+
currentToast,
|
|
218
|
+
index < this.maxVisibleToasts ? "showing" : "hide",
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
private handleMouseEnter() {
|
|
224
|
+
if (!this.autoClose) return;
|
|
225
|
+
if (this.timeoutId) {
|
|
226
|
+
clearTimeout(this.timeoutId);
|
|
227
|
+
const elapsedTime = Date.now() - this.startTime;
|
|
228
|
+
this.remainingTime = Math.max(0, this.remainingTime - elapsedTime);
|
|
229
|
+
this.timeoutId = null;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private handleMouseLeave() {
|
|
234
|
+
if (!this.autoClose) return;
|
|
235
|
+
if (this.remainingTime > 0) {
|
|
236
|
+
this.startTime = Date.now();
|
|
237
|
+
this.timeoutId = window.setTimeout(
|
|
238
|
+
() => this.removeToast(),
|
|
239
|
+
this.remainingTime,
|
|
240
|
+
);
|
|
241
|
+
} else {
|
|
242
|
+
this.removeToast();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
private calculateInitialPosition() {
|
|
247
|
+
const [y, x] = this.position.split("-");
|
|
248
|
+
|
|
249
|
+
if (y === "top") {
|
|
250
|
+
this.toast!.style.top = `0px`;
|
|
251
|
+
} else {
|
|
252
|
+
this.toast!.style.bottom = `0px`;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (x === "left") {
|
|
256
|
+
this.toast!.style.left = `${this.offset}px`;
|
|
257
|
+
} else if (x === "center") {
|
|
258
|
+
this.toast!.style.left = "50%";
|
|
259
|
+
this.toast!.style.transform = "translateX(-50%)";
|
|
260
|
+
} else {
|
|
261
|
+
this.toast!.style.right = `${this.offset}px`;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
private setState(toast: HTMLElement, state: "showing" | "hide") {
|
|
266
|
+
toast.setAttribute("data-state", state);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
private getTemplate() {
|
|
270
|
+
const toastTemplate =
|
|
271
|
+
this.toaster?.querySelector<HTMLTemplateElement>("#toast-template");
|
|
272
|
+
if (!toastTemplate) {
|
|
273
|
+
throw new Error("Toast template not found in the document.");
|
|
274
|
+
}
|
|
275
|
+
return toastTemplate.content.cloneNode(true) as DocumentFragment;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
---
|
|
2
|
-
interface Props {
|
|
3
|
-
disableHoverableContent?: boolean;
|
|
4
|
-
openDelay?: number;
|
|
5
|
-
closeDelay?: number;
|
|
6
|
-
duration?: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
openDelay = 150,
|
|
11
|
-
closeDelay = 150,
|
|
12
|
-
duration = 200,
|
|
13
|
-
disableHoverableContent = false,
|
|
14
|
-
} = Astro.props;
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
<div
|
|
18
|
-
class="relative inline-flex"
|
|
19
|
-
data-tooltip
|
|
20
|
-
data-open-delay={openDelay}
|
|
21
|
-
data-close-delay={closeDelay}
|
|
22
|
-
data-duration={duration}
|
|
23
|
-
data-disable-hoverable-content={disableHoverableContent}
|
|
24
|
-
>
|
|
25
|
-
<slot />
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<script>
|
|
29
|
-
import { Tooltip } from "./tooltip";
|
|
30
|
-
|
|
31
|
-
function init() {
|
|
32
|
-
const tooltips = document.querySelectorAll<HTMLElement>("[data-tooltip]");
|
|
33
|
-
tooltips.forEach((tooltip) => {
|
|
34
|
-
new Tooltip(tooltip);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
init();
|
|
39
|
-
document.addEventListener("astro:page-load", () => init());
|
|
40
|
-
</script>
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
disableHoverableContent?: boolean;
|
|
4
|
+
openDelay?: number;
|
|
5
|
+
closeDelay?: number;
|
|
6
|
+
duration?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
openDelay = 150,
|
|
11
|
+
closeDelay = 150,
|
|
12
|
+
duration = 200,
|
|
13
|
+
disableHoverableContent = false,
|
|
14
|
+
} = Astro.props;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<div
|
|
18
|
+
class="relative inline-flex"
|
|
19
|
+
data-tooltip
|
|
20
|
+
data-open-delay={openDelay}
|
|
21
|
+
data-close-delay={closeDelay}
|
|
22
|
+
data-duration={duration}
|
|
23
|
+
data-disable-hoverable-content={disableHoverableContent}
|
|
24
|
+
>
|
|
25
|
+
<slot />
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import { Tooltip } from "./tooltip";
|
|
30
|
+
|
|
31
|
+
function init() {
|
|
32
|
+
const tooltips = document.querySelectorAll<HTMLElement>("[data-tooltip]");
|
|
33
|
+
tooltips.forEach((tooltip) => {
|
|
34
|
+
new Tooltip(tooltip);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
init();
|
|
39
|
+
document.addEventListener("astro:page-load", () => init());
|
|
40
|
+
</script>
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
import type { VariantProps } from "class-variance-authority";
|
|
5
|
-
import { tooltipArrowVariants, tooltipVariants } from "./tooltipVariants";
|
|
6
|
-
|
|
7
|
-
interface Props
|
|
8
|
-
extends HTMLAttributes<"div">,
|
|
9
|
-
VariantProps<typeof tooltipVariants> {
|
|
10
|
-
sideOffset?: number;
|
|
11
|
-
arrow?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
class: className,
|
|
16
|
-
side,
|
|
17
|
-
alignment,
|
|
18
|
-
sideOffset = 2,
|
|
19
|
-
arrow = true,
|
|
20
|
-
...attrs
|
|
21
|
-
} = Astro.props;
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
<div
|
|
25
|
-
{...attrs}
|
|
26
|
-
role="tooltip"
|
|
27
|
-
data-tooltip-content
|
|
28
|
-
aria-hidden="false"
|
|
29
|
-
data-state="closed"
|
|
30
|
-
data-side={sideOffset}
|
|
31
|
-
data-alignment={alignment}
|
|
32
|
-
class={cn(tooltipVariants({ side, alignment, className }))}
|
|
33
|
-
style={{
|
|
34
|
-
"--tooltip-offset": `calc(var(--spacing) * ${sideOffset})`,
|
|
35
|
-
}}
|
|
36
|
-
>
|
|
37
|
-
<slot />
|
|
38
|
-
{arrow && <span class={cn(tooltipArrowVariants({ side, alignment }))} />}
|
|
39
|
-
</div>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
import type { VariantProps } from "class-variance-authority";
|
|
5
|
+
import { tooltipArrowVariants, tooltipVariants } from "./tooltipVariants";
|
|
6
|
+
|
|
7
|
+
interface Props
|
|
8
|
+
extends HTMLAttributes<"div">,
|
|
9
|
+
VariantProps<typeof tooltipVariants> {
|
|
10
|
+
sideOffset?: number;
|
|
11
|
+
arrow?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
class: className,
|
|
16
|
+
side,
|
|
17
|
+
alignment,
|
|
18
|
+
sideOffset = 2,
|
|
19
|
+
arrow = true,
|
|
20
|
+
...attrs
|
|
21
|
+
} = Astro.props;
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<div
|
|
25
|
+
{...attrs}
|
|
26
|
+
role="tooltip"
|
|
27
|
+
data-tooltip-content
|
|
28
|
+
aria-hidden="false"
|
|
29
|
+
data-state="closed"
|
|
30
|
+
data-side={sideOffset}
|
|
31
|
+
data-alignment={alignment}
|
|
32
|
+
class={cn(tooltipVariants({ side, alignment, className }))}
|
|
33
|
+
style={{
|
|
34
|
+
"--tooltip-offset": `calc(var(--spacing) * ${sideOffset})`,
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<slot />
|
|
38
|
+
{arrow && <span class={cn(tooltipArrowVariants({ side, alignment }))} />}
|
|
39
|
+
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Tooltip from "./Tooltip.astro";
|
|
2
|
-
import TooltipContent from "./TooltipContent.astro";
|
|
3
|
-
import { tooltipArrowVariants, tooltipVariants } from "./tooltipVariants";
|
|
4
|
-
|
|
5
|
-
export { Tooltip, tooltipArrowVariants, TooltipContent, tooltipVariants };
|
|
1
|
+
import Tooltip from "./Tooltip.astro";
|
|
2
|
+
import TooltipContent from "./TooltipContent.astro";
|
|
3
|
+
import { tooltipArrowVariants, tooltipVariants } from "./tooltipVariants";
|
|
4
|
+
|
|
5
|
+
export { Tooltip, tooltipArrowVariants, TooltipContent, tooltipVariants };
|