@orbitkit/components 0.2.0-beta.1 → 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 -16
- package/dist/astro/accordion/AccordionTrigger.astro +33 -33
- package/dist/astro/accordion/AcordionContent.astro +23 -26
- package/dist/astro/accordion/accordion.ts +151 -125
- 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 +2 -0
- 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 -15
- 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 +2 -2
- 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 +2 -0
- package/dist/astro/popover/Popover.astro +17 -17
- package/dist/astro/popover/PopoverContent.astro +39 -39
- package/dist/astro/popover/index.ts +5 -4
- 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 -6
- package/dist/astro/tooltip/tooltip.ts +137 -137
- package/dist/astro/tooltip/tooltipVariants.ts +115 -115
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
export class Tooltip {
|
|
2
|
-
// References to tooltip elements
|
|
3
|
-
private tooltip: HTMLElement;
|
|
4
|
-
private trigger: HTMLElement | null;
|
|
5
|
-
private content: HTMLElement | null;
|
|
6
|
-
|
|
7
|
-
// Tooltip configuration options
|
|
8
|
-
private duration: number;
|
|
9
|
-
private openDelay: number;
|
|
10
|
-
private closeDelay: number;
|
|
11
|
-
|
|
12
|
-
// Timers for managing tooltip open/close/hide delays
|
|
13
|
-
private openTimerId: number | null = null;
|
|
14
|
-
private closeTimerId: number | null = null;
|
|
15
|
-
private hideTimerId: number | null = null;
|
|
16
|
-
|
|
17
|
-
constructor(tooltip: HTMLElement) {
|
|
18
|
-
this.tooltip = tooltip;
|
|
19
|
-
this.content = this.tooltip.querySelector("[data-tooltip-content]");
|
|
20
|
-
this.trigger = this.tooltip.querySelector("[data-trigger]");
|
|
21
|
-
|
|
22
|
-
this.duration = parseFloat(tooltip.dataset.duration || "200");
|
|
23
|
-
this.openDelay = parseFloat(tooltip.dataset.openDelay || "0");
|
|
24
|
-
this.closeDelay = parseFloat(tooltip.dataset.closeDelay || "0");
|
|
25
|
-
|
|
26
|
-
if (!this.tooltip || !this.content || !this.trigger) {
|
|
27
|
-
console.error("Tooltip not initialized properly", {
|
|
28
|
-
container: this.tooltip,
|
|
29
|
-
trigger: this.trigger,
|
|
30
|
-
content: this.content,
|
|
31
|
-
});
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// If you want to use animations instead of transitions
|
|
36
|
-
// set animation duration instead of transition duration.
|
|
37
|
-
this.content.style.transitionDuration = `${this.duration}ms`;
|
|
38
|
-
|
|
39
|
-
this.init();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private init() {
|
|
43
|
-
this.setupAccessibility();
|
|
44
|
-
this.setupEventListeners();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
private setupAccessibility() {
|
|
48
|
-
if (!this.trigger || !this.content) return;
|
|
49
|
-
|
|
50
|
-
const id =
|
|
51
|
-
this.content.id ||
|
|
52
|
-
`tooltip-id-${Math.random().toString(36).substring(2, 9)}`;
|
|
53
|
-
this.content.id = id;
|
|
54
|
-
this.trigger.setAttribute("aria-describedby", id);
|
|
55
|
-
this.setState("closed");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
private setupEventListeners() {
|
|
59
|
-
if (!this.trigger || !this.content) return;
|
|
60
|
-
|
|
61
|
-
this.trigger!.addEventListener("mouseenter", () => this.showTooltip());
|
|
62
|
-
this.trigger!.addEventListener("mouseleave", () => this.hideTooltip());
|
|
63
|
-
this.trigger.addEventListener("focus", () => this.showTooltip(true));
|
|
64
|
-
this.trigger.addEventListener("blur", () => this.hideTooltip(true));
|
|
65
|
-
|
|
66
|
-
if (this.tooltip.dataset.disableHoverableContent === "false") {
|
|
67
|
-
this.content.addEventListener("mouseenter", () => this.showTooltip());
|
|
68
|
-
this.content.addEventListener("mouseleave", () => this.hideTooltip());
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
document.addEventListener("keydown", (e) => this.handleKeyDown(e));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
private showTooltip(instant: boolean = false) {
|
|
75
|
-
this.clearCloseTimer();
|
|
76
|
-
this.content?.classList.remove("hidden");
|
|
77
|
-
|
|
78
|
-
if (instant) {
|
|
79
|
-
this.setState("open");
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
this.openTimerId = window.setTimeout(() => {
|
|
84
|
-
this.setState("open");
|
|
85
|
-
this.openTimerId = null;
|
|
86
|
-
}, this.openDelay);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
private hideTooltip(instant: boolean = false) {
|
|
90
|
-
this.clearOpenTimer();
|
|
91
|
-
|
|
92
|
-
if (instant) {
|
|
93
|
-
this.setState("closed");
|
|
94
|
-
this.content?.classList.add("hidden");
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
this.closeTimerId = window.setTimeout(() => {
|
|
99
|
-
this.setState("closed");
|
|
100
|
-
this.hideTimerId = window.setTimeout(() => {
|
|
101
|
-
this.content?.classList.add("hidden");
|
|
102
|
-
this.closeTimerId = null;
|
|
103
|
-
this.hideTimerId = null;
|
|
104
|
-
}, this.duration);
|
|
105
|
-
}, this.closeDelay);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
private setState(state: "open" | "closed") {
|
|
109
|
-
this.content?.setAttribute("aria-hidden", `${state === "closed"}`);
|
|
110
|
-
this.content?.setAttribute("data-state", state);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
private clearOpenTimer() {
|
|
114
|
-
if (this.openTimerId) {
|
|
115
|
-
window.clearTimeout(this.openTimerId);
|
|
116
|
-
this.openTimerId = null;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
private clearCloseTimer() {
|
|
121
|
-
if (this.closeTimerId) {
|
|
122
|
-
window.clearTimeout(this.closeTimerId);
|
|
123
|
-
this.closeTimerId = null;
|
|
124
|
-
}
|
|
125
|
-
if (this.hideTimerId) {
|
|
126
|
-
window.clearTimeout(this.hideTimerId);
|
|
127
|
-
this.hideTimerId = null;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
private handleKeyDown = (event: KeyboardEvent) => {
|
|
132
|
-
if (event.key === "Escape" && this.content!.dataset.status === "open") {
|
|
133
|
-
this.hideTooltip(true);
|
|
134
|
-
event.preventDefault();
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
1
|
+
export class Tooltip {
|
|
2
|
+
// References to tooltip elements
|
|
3
|
+
private tooltip: HTMLElement;
|
|
4
|
+
private trigger: HTMLElement | null;
|
|
5
|
+
private content: HTMLElement | null;
|
|
6
|
+
|
|
7
|
+
// Tooltip configuration options
|
|
8
|
+
private duration: number;
|
|
9
|
+
private openDelay: number;
|
|
10
|
+
private closeDelay: number;
|
|
11
|
+
|
|
12
|
+
// Timers for managing tooltip open/close/hide delays
|
|
13
|
+
private openTimerId: number | null = null;
|
|
14
|
+
private closeTimerId: number | null = null;
|
|
15
|
+
private hideTimerId: number | null = null;
|
|
16
|
+
|
|
17
|
+
constructor(tooltip: HTMLElement) {
|
|
18
|
+
this.tooltip = tooltip;
|
|
19
|
+
this.content = this.tooltip.querySelector("[data-tooltip-content]");
|
|
20
|
+
this.trigger = this.tooltip.querySelector("[data-trigger]");
|
|
21
|
+
|
|
22
|
+
this.duration = parseFloat(tooltip.dataset.duration || "200");
|
|
23
|
+
this.openDelay = parseFloat(tooltip.dataset.openDelay || "0");
|
|
24
|
+
this.closeDelay = parseFloat(tooltip.dataset.closeDelay || "0");
|
|
25
|
+
|
|
26
|
+
if (!this.tooltip || !this.content || !this.trigger) {
|
|
27
|
+
console.error("Tooltip not initialized properly", {
|
|
28
|
+
container: this.tooltip,
|
|
29
|
+
trigger: this.trigger,
|
|
30
|
+
content: this.content,
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// If you want to use animations instead of transitions
|
|
36
|
+
// set animation duration instead of transition duration.
|
|
37
|
+
this.content.style.transitionDuration = `${this.duration}ms`;
|
|
38
|
+
|
|
39
|
+
this.init();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private init() {
|
|
43
|
+
this.setupAccessibility();
|
|
44
|
+
this.setupEventListeners();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private setupAccessibility() {
|
|
48
|
+
if (!this.trigger || !this.content) return;
|
|
49
|
+
|
|
50
|
+
const id =
|
|
51
|
+
this.content.id ||
|
|
52
|
+
`tooltip-id-${Math.random().toString(36).substring(2, 9)}`;
|
|
53
|
+
this.content.id = id;
|
|
54
|
+
this.trigger.setAttribute("aria-describedby", id);
|
|
55
|
+
this.setState("closed");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private setupEventListeners() {
|
|
59
|
+
if (!this.trigger || !this.content) return;
|
|
60
|
+
|
|
61
|
+
this.trigger!.addEventListener("mouseenter", () => this.showTooltip());
|
|
62
|
+
this.trigger!.addEventListener("mouseleave", () => this.hideTooltip());
|
|
63
|
+
this.trigger.addEventListener("focus", () => this.showTooltip(true));
|
|
64
|
+
this.trigger.addEventListener("blur", () => this.hideTooltip(true));
|
|
65
|
+
|
|
66
|
+
if (this.tooltip.dataset.disableHoverableContent === "false") {
|
|
67
|
+
this.content.addEventListener("mouseenter", () => this.showTooltip());
|
|
68
|
+
this.content.addEventListener("mouseleave", () => this.hideTooltip());
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
document.addEventListener("keydown", (e) => this.handleKeyDown(e));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private showTooltip(instant: boolean = false) {
|
|
75
|
+
this.clearCloseTimer();
|
|
76
|
+
this.content?.classList.remove("hidden");
|
|
77
|
+
|
|
78
|
+
if (instant) {
|
|
79
|
+
this.setState("open");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
this.openTimerId = window.setTimeout(() => {
|
|
84
|
+
this.setState("open");
|
|
85
|
+
this.openTimerId = null;
|
|
86
|
+
}, this.openDelay);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private hideTooltip(instant: boolean = false) {
|
|
90
|
+
this.clearOpenTimer();
|
|
91
|
+
|
|
92
|
+
if (instant) {
|
|
93
|
+
this.setState("closed");
|
|
94
|
+
this.content?.classList.add("hidden");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
this.closeTimerId = window.setTimeout(() => {
|
|
99
|
+
this.setState("closed");
|
|
100
|
+
this.hideTimerId = window.setTimeout(() => {
|
|
101
|
+
this.content?.classList.add("hidden");
|
|
102
|
+
this.closeTimerId = null;
|
|
103
|
+
this.hideTimerId = null;
|
|
104
|
+
}, this.duration);
|
|
105
|
+
}, this.closeDelay);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private setState(state: "open" | "closed") {
|
|
109
|
+
this.content?.setAttribute("aria-hidden", `${state === "closed"}`);
|
|
110
|
+
this.content?.setAttribute("data-state", state);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private clearOpenTimer() {
|
|
114
|
+
if (this.openTimerId) {
|
|
115
|
+
window.clearTimeout(this.openTimerId);
|
|
116
|
+
this.openTimerId = null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private clearCloseTimer() {
|
|
121
|
+
if (this.closeTimerId) {
|
|
122
|
+
window.clearTimeout(this.closeTimerId);
|
|
123
|
+
this.closeTimerId = null;
|
|
124
|
+
}
|
|
125
|
+
if (this.hideTimerId) {
|
|
126
|
+
window.clearTimeout(this.hideTimerId);
|
|
127
|
+
this.hideTimerId = null;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private handleKeyDown = (event: KeyboardEvent) => {
|
|
132
|
+
if (event.key === "Escape" && this.content!.dataset.status === "open") {
|
|
133
|
+
this.hideTooltip(true);
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
import { cva } from "class-variance-authority";
|
|
2
|
-
|
|
3
|
-
const baseClass = [
|
|
4
|
-
"hidden absolute z-50 px-3 py-1.5 whitespace-nowrap bg-foreground text-background rounded-md text-sm backdrop-blur-sm max-w-xs",
|
|
5
|
-
"transform transition-all ease-in data-[state=closed]:opacity-0 data-[state=closed]:scale-95 data[state=open]:opacity-100 data[state=open]:scale-100",
|
|
6
|
-
];
|
|
7
|
-
|
|
8
|
-
const tooltipVariants = cva(baseClass, {
|
|
9
|
-
variants: {
|
|
10
|
-
side: {
|
|
11
|
-
top: "bottom-full mb-(--tooltip-offset)",
|
|
12
|
-
bottom: "top-full mt-(--tooltip-offset)",
|
|
13
|
-
left: "right-full mr-(--tooltip-offset)",
|
|
14
|
-
right: "left-full ml-(--tooltip-offset)",
|
|
15
|
-
},
|
|
16
|
-
alignment: {
|
|
17
|
-
start: "",
|
|
18
|
-
center: "",
|
|
19
|
-
end: "",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
compoundVariants: [
|
|
23
|
-
{
|
|
24
|
-
side: ["top", "bottom"],
|
|
25
|
-
alignment: "start",
|
|
26
|
-
class: "left-0",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
side: ["top", "bottom"],
|
|
30
|
-
alignment: "end",
|
|
31
|
-
class: "left-full -translate-x-full",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
side: ["top", "bottom"],
|
|
35
|
-
alignment: "center",
|
|
36
|
-
class: "left-1/2 -translate-x-1/2",
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
side: ["left", "right"],
|
|
40
|
-
alignment: "start",
|
|
41
|
-
class: "top-0 -translate-y-0",
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
side: ["left", "right"],
|
|
45
|
-
alignment: "center",
|
|
46
|
-
class: "top-1/2 -translate-y-1/2",
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
side: ["left", "right"],
|
|
50
|
-
alignment: "end",
|
|
51
|
-
class: "top-full -translate-y-full",
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
defaultVariants: {
|
|
55
|
-
side: "top",
|
|
56
|
-
alignment: "center",
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const arrowClass =
|
|
61
|
-
"absolute w-0 h-0 transition-all transform ease-in size-2 bg-foreground transform rotate-45";
|
|
62
|
-
|
|
63
|
-
const tooltipArrowVariants = cva(arrowClass, {
|
|
64
|
-
variants: {
|
|
65
|
-
side: {
|
|
66
|
-
top: "top-full -mt-1 ",
|
|
67
|
-
bottom: "bottom-full -mb-1",
|
|
68
|
-
left: "left-full -ml-1",
|
|
69
|
-
right: "right-full -mr-1",
|
|
70
|
-
},
|
|
71
|
-
alignment: {
|
|
72
|
-
start: "",
|
|
73
|
-
center: "",
|
|
74
|
-
end: "",
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
compoundVariants: [
|
|
78
|
-
{
|
|
79
|
-
side: ["top", "bottom"],
|
|
80
|
-
alignment: "start",
|
|
81
|
-
class: "left-0 ml-3 ",
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
side: ["top", "bottom"],
|
|
85
|
-
alignment: "end",
|
|
86
|
-
class: "right-0 mr-3",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
side: ["top", "bottom"],
|
|
90
|
-
alignment: "center",
|
|
91
|
-
class: "left-1/2 -translate-x-1/2",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
side: ["left", "right"],
|
|
95
|
-
alignment: "start",
|
|
96
|
-
class: "top-0 mt-3",
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
side: ["left", "right"],
|
|
100
|
-
alignment: "center",
|
|
101
|
-
class: "top-1/2 -translate-y-1/2",
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
side: ["left", "right"],
|
|
105
|
-
alignment: "end",
|
|
106
|
-
class: "bottom-0 mb-3",
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
defaultVariants: {
|
|
110
|
-
side: "top",
|
|
111
|
-
alignment: "center",
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
export { tooltipArrowVariants, tooltipVariants };
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
const baseClass = [
|
|
4
|
+
"hidden absolute z-50 px-3 py-1.5 whitespace-nowrap bg-foreground text-background rounded-md text-sm backdrop-blur-sm max-w-xs",
|
|
5
|
+
"transform transition-all ease-in data-[state=closed]:opacity-0 data-[state=closed]:scale-95 data[state=open]:opacity-100 data[state=open]:scale-100",
|
|
6
|
+
];
|
|
7
|
+
|
|
8
|
+
const tooltipVariants = cva(baseClass, {
|
|
9
|
+
variants: {
|
|
10
|
+
side: {
|
|
11
|
+
top: "bottom-full mb-(--tooltip-offset)",
|
|
12
|
+
bottom: "top-full mt-(--tooltip-offset)",
|
|
13
|
+
left: "right-full mr-(--tooltip-offset)",
|
|
14
|
+
right: "left-full ml-(--tooltip-offset)",
|
|
15
|
+
},
|
|
16
|
+
alignment: {
|
|
17
|
+
start: "",
|
|
18
|
+
center: "",
|
|
19
|
+
end: "",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
compoundVariants: [
|
|
23
|
+
{
|
|
24
|
+
side: ["top", "bottom"],
|
|
25
|
+
alignment: "start",
|
|
26
|
+
class: "left-0",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
side: ["top", "bottom"],
|
|
30
|
+
alignment: "end",
|
|
31
|
+
class: "left-full -translate-x-full",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
side: ["top", "bottom"],
|
|
35
|
+
alignment: "center",
|
|
36
|
+
class: "left-1/2 -translate-x-1/2",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
side: ["left", "right"],
|
|
40
|
+
alignment: "start",
|
|
41
|
+
class: "top-0 -translate-y-0",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
side: ["left", "right"],
|
|
45
|
+
alignment: "center",
|
|
46
|
+
class: "top-1/2 -translate-y-1/2",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
side: ["left", "right"],
|
|
50
|
+
alignment: "end",
|
|
51
|
+
class: "top-full -translate-y-full",
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
defaultVariants: {
|
|
55
|
+
side: "top",
|
|
56
|
+
alignment: "center",
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const arrowClass =
|
|
61
|
+
"absolute w-0 h-0 transition-all transform ease-in size-2 bg-foreground transform rotate-45";
|
|
62
|
+
|
|
63
|
+
const tooltipArrowVariants = cva(arrowClass, {
|
|
64
|
+
variants: {
|
|
65
|
+
side: {
|
|
66
|
+
top: "top-full -mt-1 ",
|
|
67
|
+
bottom: "bottom-full -mb-1",
|
|
68
|
+
left: "left-full -ml-1",
|
|
69
|
+
right: "right-full -mr-1",
|
|
70
|
+
},
|
|
71
|
+
alignment: {
|
|
72
|
+
start: "",
|
|
73
|
+
center: "",
|
|
74
|
+
end: "",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
compoundVariants: [
|
|
78
|
+
{
|
|
79
|
+
side: ["top", "bottom"],
|
|
80
|
+
alignment: "start",
|
|
81
|
+
class: "left-0 ml-3 ",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
side: ["top", "bottom"],
|
|
85
|
+
alignment: "end",
|
|
86
|
+
class: "right-0 mr-3",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
side: ["top", "bottom"],
|
|
90
|
+
alignment: "center",
|
|
91
|
+
class: "left-1/2 -translate-x-1/2",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
side: ["left", "right"],
|
|
95
|
+
alignment: "start",
|
|
96
|
+
class: "top-0 mt-3",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
side: ["left", "right"],
|
|
100
|
+
alignment: "center",
|
|
101
|
+
class: "top-1/2 -translate-y-1/2",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
side: ["left", "right"],
|
|
105
|
+
alignment: "end",
|
|
106
|
+
class: "bottom-0 mb-3",
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
defaultVariants: {
|
|
110
|
+
side: "top",
|
|
111
|
+
alignment: "center",
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export { tooltipArrowVariants, tooltipVariants };
|
package/dist/index.js
CHANGED
|
@@ -71,15 +71,15 @@ var registry_default = {
|
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
name: "accordion",
|
|
74
|
-
version: "0.0.
|
|
74
|
+
version: "0.0.2"
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
name: "modal",
|
|
78
|
-
version: "0.0.
|
|
78
|
+
version: "0.0.2"
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
name: "tooltip",
|
|
82
|
-
version: "0.0.
|
|
82
|
+
version: "0.0.2"
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
name: "collapsible",
|
|
@@ -87,7 +87,7 @@ var registry_default = {
|
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
name: "drawer",
|
|
90
|
-
version: "0.0.
|
|
90
|
+
version: "0.0.2"
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
name: "dropdown",
|
|
@@ -112,6 +112,18 @@ var registry_default = {
|
|
|
112
112
|
{
|
|
113
113
|
name: "tab",
|
|
114
114
|
version: "0.0.1"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "toast",
|
|
118
|
+
version: "0.0.1"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "scroll-progress",
|
|
122
|
+
version: "0.0.1"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "marquee",
|
|
126
|
+
version: "0.0.1"
|
|
115
127
|
}
|
|
116
128
|
]
|
|
117
129
|
};
|
|
@@ -121,7 +133,8 @@ import { fileURLToPath } from "node:url";
|
|
|
121
133
|
import path from "node:path";
|
|
122
134
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
123
135
|
function getAllComponents() {
|
|
124
|
-
|
|
136
|
+
const availableComponents = registry_default.components;
|
|
137
|
+
return availableComponents.sort((a, b) => a.name.localeCompare(b.name));
|
|
125
138
|
}
|
|
126
139
|
function getComponentPath(componentName) {
|
|
127
140
|
return path.join(__dirname, "astro", componentName);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/registry.json","../src/index.ts"],"sourcesContent":["{\n \"components\": [\n {\n \"name\": \"button\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"alert\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"badge\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"avatar\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"card\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"input\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"label\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"breadcrumb\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"progress\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"textarea\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"select\",\n \"version\": \"0.0.2\"\n },\n {\n \"name\": \"switch\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"checkbox\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"radio\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"list\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"divider\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"skeleton\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"accordion\",\n \"version\": \"0.0.
|
|
1
|
+
{"version":3,"sources":["../src/registry.json","../src/index.ts"],"sourcesContent":["{\n \"components\": [\n {\n \"name\": \"button\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"alert\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"badge\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"avatar\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"card\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"input\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"label\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"breadcrumb\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"progress\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"textarea\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"select\",\n \"version\": \"0.0.2\"\n },\n {\n \"name\": \"switch\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"checkbox\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"radio\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"list\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"divider\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"skeleton\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"accordion\",\n \"version\": \"0.0.2\"\n },\n {\n \"name\": \"modal\",\n \"version\": \"0.0.2\"\n },\n {\n \"name\": \"tooltip\",\n \"version\": \"0.0.2\"\n },\n {\n \"name\": \"collapsible\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"drawer\",\n \"version\": \"0.0.2\"\n },\n {\n \"name\": \"dropdown\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"kbd\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"pagination\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"popover\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"stat\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"tab\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"toast\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"scroll-progress\",\n \"version\": \"0.0.1\"\n },\n {\n \"name\": \"marquee\",\n \"version\": \"0.0.1\"\n }\n ]\n}\n","import registry from \"@/registry.json\";\r\nimport { fileURLToPath } from \"node:url\";\r\n\r\nimport path from \"node:path\";\r\nimport { ComponentRegistryEntry } from \"./types/registry\";\r\n\r\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\r\n\r\nexport function getAllComponents() {\r\n const availableComponents = registry.components as ComponentRegistryEntry[];\r\n return availableComponents.sort((a, b) => a.name.localeCompare(b.name));\r\n}\r\n\r\nexport function getComponentPath(componentName: string) {\r\n return path.join(__dirname, \"astro\", componentName);\r\n}\r\n\r\nexport async function checkComponentsInRegistry(components: string[]) {\r\n const valid: ComponentRegistryEntry[] = [];\r\n const invalid: string[] = [];\r\n const allComponents = getAllComponents();\r\n\r\n for (const component of components) {\r\n const found = allComponents.find(\r\n (c) => c.name.toLowerCase() === component.toLowerCase(),\r\n );\r\n if (found) {\r\n valid.push(found);\r\n } else {\r\n invalid.push(component);\r\n }\r\n }\r\n\r\n return { valid, invalid };\r\n}\r\n\r\nexport { type ComponentRegistryEntry } from \"@/types/registry\";\r\n"],"mappings":";AAAA;AAAA,EACE,YAAc;AAAA,IACZ;AAAA,MACE,MAAQ;AAAA,MACR,S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