@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,113 +1,113 @@
|
|
|
1
|
-
export class Popover {
|
|
2
|
-
// References to tooltip elements
|
|
3
|
-
private dropdownMenu: HTMLElement;
|
|
4
|
-
private trigger: HTMLElement | null;
|
|
5
|
-
private content: HTMLElement | null;
|
|
6
|
-
|
|
7
|
-
constructor(dropowndMenu: HTMLElement) {
|
|
8
|
-
this.dropdownMenu = dropowndMenu;
|
|
9
|
-
this.content = this.dropdownMenu.querySelector("[data-popover-content]");
|
|
10
|
-
this.trigger = this.dropdownMenu.querySelector("[data-trigger]");
|
|
11
|
-
|
|
12
|
-
if (!this.content || !this.trigger) {
|
|
13
|
-
console.error("Popover not initialized properly", {
|
|
14
|
-
content: this.content,
|
|
15
|
-
trigger: this.trigger,
|
|
16
|
-
});
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
this.init();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
private init() {
|
|
24
|
-
this.setupAccessibility();
|
|
25
|
-
this.setupEventListeners();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
private setupAccessibility() {
|
|
29
|
-
if (!this.trigger || !this.content) return;
|
|
30
|
-
|
|
31
|
-
const id =
|
|
32
|
-
this.content.id ||
|
|
33
|
-
`popover-id-${Math.random().toString(36).substring(2, 9)}`;
|
|
34
|
-
this.content.id = id;
|
|
35
|
-
this.trigger.setAttribute("aria-describedby", id);
|
|
36
|
-
this.setState("closed");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
private setupEventListeners() {
|
|
40
|
-
if (!this.trigger || !this.content) return;
|
|
41
|
-
|
|
42
|
-
this.trigger.addEventListener("click", () => this.popoverToggle());
|
|
43
|
-
|
|
44
|
-
this.content.addEventListener("click", (e) => {
|
|
45
|
-
const target = e.target as HTMLElement;
|
|
46
|
-
const item = target.closest('[role="menuitem"]') as HTMLElement;
|
|
47
|
-
|
|
48
|
-
if (item && item.dataset.disabled !== "true") {
|
|
49
|
-
this.closePopover();
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
document.addEventListener("click", (e) => {
|
|
54
|
-
const target = e.target as HTMLElement;
|
|
55
|
-
if (
|
|
56
|
-
this.content &&
|
|
57
|
-
!this.content.contains(target) &&
|
|
58
|
-
target !== this.trigger
|
|
59
|
-
) {
|
|
60
|
-
this.closePopover();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
this.trigger.addEventListener("keydown", (e) => {
|
|
65
|
-
const isOpen = this.content?.dataset.state === "open";
|
|
66
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
67
|
-
e.preventDefault();
|
|
68
|
-
this.popoverToggle();
|
|
69
|
-
} else if (e.key === "Escape" && isOpen) {
|
|
70
|
-
e.preventDefault();
|
|
71
|
-
this.closePopover();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
document.addEventListener("keydown", (e) => this.handleKeydown(e));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private popoverToggle() {
|
|
79
|
-
if (this.content?.dataset.state === "open") {
|
|
80
|
-
this.closePopover();
|
|
81
|
-
} else {
|
|
82
|
-
this.openPopover();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
private openPopover() {
|
|
87
|
-
this.content?.classList.remove("hidden");
|
|
88
|
-
|
|
89
|
-
window.setTimeout(() => {
|
|
90
|
-
this.setState("open");
|
|
91
|
-
}, 0);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
private closePopover() {
|
|
95
|
-
this.trigger?.focus();
|
|
96
|
-
this.setState("closed");
|
|
97
|
-
window.setTimeout(() => {
|
|
98
|
-
this.content?.classList.add("hidden");
|
|
99
|
-
}, 100);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
private setState(state: "open" | "closed") {
|
|
103
|
-
this.content?.setAttribute("aria-hidden", `${state === "closed"}`);
|
|
104
|
-
this.content?.setAttribute("data-state", state);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
private handleKeydown = (event: KeyboardEvent) => {
|
|
108
|
-
if (event.key === "Escape" && this.content!.dataset.state === "open") {
|
|
109
|
-
this.closePopover();
|
|
110
|
-
event.preventDefault();
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
1
|
+
export class Popover {
|
|
2
|
+
// References to tooltip elements
|
|
3
|
+
private dropdownMenu: HTMLElement;
|
|
4
|
+
private trigger: HTMLElement | null;
|
|
5
|
+
private content: HTMLElement | null;
|
|
6
|
+
|
|
7
|
+
constructor(dropowndMenu: HTMLElement) {
|
|
8
|
+
this.dropdownMenu = dropowndMenu;
|
|
9
|
+
this.content = this.dropdownMenu.querySelector("[data-popover-content]");
|
|
10
|
+
this.trigger = this.dropdownMenu.querySelector("[data-trigger]");
|
|
11
|
+
|
|
12
|
+
if (!this.content || !this.trigger) {
|
|
13
|
+
console.error("Popover not initialized properly", {
|
|
14
|
+
content: this.content,
|
|
15
|
+
trigger: this.trigger,
|
|
16
|
+
});
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
this.init();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private init() {
|
|
24
|
+
this.setupAccessibility();
|
|
25
|
+
this.setupEventListeners();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private setupAccessibility() {
|
|
29
|
+
if (!this.trigger || !this.content) return;
|
|
30
|
+
|
|
31
|
+
const id =
|
|
32
|
+
this.content.id ||
|
|
33
|
+
`popover-id-${Math.random().toString(36).substring(2, 9)}`;
|
|
34
|
+
this.content.id = id;
|
|
35
|
+
this.trigger.setAttribute("aria-describedby", id);
|
|
36
|
+
this.setState("closed");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private setupEventListeners() {
|
|
40
|
+
if (!this.trigger || !this.content) return;
|
|
41
|
+
|
|
42
|
+
this.trigger.addEventListener("click", () => this.popoverToggle());
|
|
43
|
+
|
|
44
|
+
this.content.addEventListener("click", (e) => {
|
|
45
|
+
const target = e.target as HTMLElement;
|
|
46
|
+
const item = target.closest('[role="menuitem"]') as HTMLElement;
|
|
47
|
+
|
|
48
|
+
if (item && item.dataset.disabled !== "true") {
|
|
49
|
+
this.closePopover();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
document.addEventListener("click", (e) => {
|
|
54
|
+
const target = e.target as HTMLElement;
|
|
55
|
+
if (
|
|
56
|
+
this.content &&
|
|
57
|
+
!this.content.contains(target) &&
|
|
58
|
+
target !== this.trigger
|
|
59
|
+
) {
|
|
60
|
+
this.closePopover();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
this.trigger.addEventListener("keydown", (e) => {
|
|
65
|
+
const isOpen = this.content?.dataset.state === "open";
|
|
66
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
this.popoverToggle();
|
|
69
|
+
} else if (e.key === "Escape" && isOpen) {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
this.closePopover();
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
document.addEventListener("keydown", (e) => this.handleKeydown(e));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private popoverToggle() {
|
|
79
|
+
if (this.content?.dataset.state === "open") {
|
|
80
|
+
this.closePopover();
|
|
81
|
+
} else {
|
|
82
|
+
this.openPopover();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private openPopover() {
|
|
87
|
+
this.content?.classList.remove("hidden");
|
|
88
|
+
|
|
89
|
+
window.setTimeout(() => {
|
|
90
|
+
this.setState("open");
|
|
91
|
+
}, 0);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private closePopover() {
|
|
95
|
+
this.trigger?.focus();
|
|
96
|
+
this.setState("closed");
|
|
97
|
+
window.setTimeout(() => {
|
|
98
|
+
this.content?.classList.add("hidden");
|
|
99
|
+
}, 100);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private setState(state: "open" | "closed") {
|
|
103
|
+
this.content?.setAttribute("aria-hidden", `${state === "closed"}`);
|
|
104
|
+
this.content?.setAttribute("data-state", state);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private handleKeydown = (event: KeyboardEvent) => {
|
|
108
|
+
if (event.key === "Escape" && this.content!.dataset.state === "open") {
|
|
109
|
+
this.closePopover();
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
import { cva } from "class-variance-authority";
|
|
2
|
-
|
|
3
|
-
const baseClass = [
|
|
4
|
-
"hidden absolute z-50 bg-surface border border-border p-4 rounded-md",
|
|
5
|
-
"transform duration-100 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 popoverVariants = 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: "bottom",
|
|
56
|
-
alignment: "center",
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const arrowClass =
|
|
61
|
-
"absolute w-0 h-0 transition-all transform ease-in size-2 bg-surface transform rotate-45 border-border";
|
|
62
|
-
|
|
63
|
-
const popoverArrowVariants = cva(arrowClass, {
|
|
64
|
-
variants: {
|
|
65
|
-
side: {
|
|
66
|
-
top: "top-full -mt-1 border-b border-r",
|
|
67
|
-
bottom: "bottom-full -mb-1 border-t border-l",
|
|
68
|
-
left: "left-full -ml-1 border-t border-r",
|
|
69
|
-
right: "right-full -mr-1 border-b border-l",
|
|
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: "bottom",
|
|
111
|
-
alignment: "center",
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
export { popoverArrowVariants, popoverVariants };
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
const baseClass = [
|
|
4
|
+
"hidden absolute z-50 bg-surface border border-border p-4 rounded-md",
|
|
5
|
+
"transform duration-100 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 popoverVariants = 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: "bottom",
|
|
56
|
+
alignment: "center",
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const arrowClass =
|
|
61
|
+
"absolute w-0 h-0 transition-all transform ease-in size-2 bg-surface transform rotate-45 border-border";
|
|
62
|
+
|
|
63
|
+
const popoverArrowVariants = cva(arrowClass, {
|
|
64
|
+
variants: {
|
|
65
|
+
side: {
|
|
66
|
+
top: "top-full -mt-1 border-b border-r",
|
|
67
|
+
bottom: "bottom-full -mb-1 border-t border-l",
|
|
68
|
+
left: "left-full -ml-1 border-t border-r",
|
|
69
|
+
right: "right-full -mr-1 border-b border-l",
|
|
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: "bottom",
|
|
111
|
+
alignment: "center",
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export { popoverArrowVariants, popoverVariants };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
import ScrollProgressBar from "./ScrollProgressBar.astro";
|
|
3
|
+
import { cn } from "@/utils/cn";
|
|
4
|
+
import type { HTMLAttributes } from "astro/types";
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAttributes<"div"> {}
|
|
7
|
+
|
|
8
|
+
const { class: className, ...attrs } = Astro.props;
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<div
|
|
12
|
+
class={cn("fixed top-0 left-0 w-full h-[2px] bg-muted z-[1000]", className)}
|
|
13
|
+
{...attrs}
|
|
14
|
+
>
|
|
15
|
+
<slot>
|
|
16
|
+
<ScrollProgressBar />
|
|
17
|
+
</slot>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
function initScrollProgress() {
|
|
22
|
+
const bar = document.querySelector<HTMLElement>(
|
|
23
|
+
"[data-scroll-progress-bar]",
|
|
24
|
+
);
|
|
25
|
+
if (!bar) return;
|
|
26
|
+
|
|
27
|
+
function updateBar() {
|
|
28
|
+
const total = document.documentElement.scrollHeight - window.innerHeight;
|
|
29
|
+
const progress = (window.scrollY / total) * 100;
|
|
30
|
+
bar!.style.width = `${progress}%`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
window.addEventListener("scroll", updateBar);
|
|
34
|
+
updateBar();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
initScrollProgress();
|
|
38
|
+
document.addEventListener("astro:after-swap", () => {
|
|
39
|
+
initScrollProgress();
|
|
40
|
+
});
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<div
|
|
11
|
+
data-scroll-progress-bar
|
|
12
|
+
class={cn(
|
|
13
|
+
"h-full bg-primary transition-all duration-100 ease-out",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
style="width: 0%;"
|
|
17
|
+
{...attrs}
|
|
18
|
+
>
|
|
19
|
+
</div>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"div"> {}
|
|
6
|
-
|
|
7
|
-
const { class: className, ...attrs } = Astro.props;
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
<div class={cn("inline-flex flex-col gap-0.5", className)} {...attrs}>
|
|
11
|
-
<slot />
|
|
12
|
-
</div>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<div class={cn("inline-flex flex-col gap-0.5", className)} {...attrs}>
|
|
11
|
+
<slot />
|
|
12
|
+
</div>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"div"> {}
|
|
6
|
-
|
|
7
|
-
const { class: className, ...attrs } = Astro.props;
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
<p class={cn("text-sm text-foreground/70", className)} {...attrs}>
|
|
11
|
-
<slot />
|
|
12
|
-
</p>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<p class={cn("text-sm text-foreground/70", className)} {...attrs}>
|
|
11
|
+
<slot />
|
|
12
|
+
</p>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"h3"> {}
|
|
6
|
-
|
|
7
|
-
const { class: className, ...attrs } = Astro.props;
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
<h3
|
|
11
|
-
class={cn(
|
|
12
|
-
"text-sm font-medium text-foreground/80 uppercase tracking-wide",
|
|
13
|
-
className,
|
|
14
|
-
)}
|
|
15
|
-
{...attrs}
|
|
16
|
-
>
|
|
17
|
-
<slot />
|
|
18
|
-
</h3>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"h3"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<h3
|
|
11
|
+
class={cn(
|
|
12
|
+
"text-sm font-medium text-foreground/80 uppercase tracking-wide",
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
{...attrs}
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</h3>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"div"> {}
|
|
6
|
-
|
|
7
|
-
const { class: className, ...attrs } = Astro.props;
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
<span class={cn("text-3xl font-bold text-foreground", className)} {...attrs}>
|
|
11
|
-
<slot />
|
|
12
|
-
</span>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<span class={cn("text-3xl font-bold text-foreground", className)} {...attrs}>
|
|
11
|
+
<slot />
|
|
12
|
+
</span>
|
package/dist/astro/stat/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Stat from "./Stat.astro";
|
|
2
|
-
import StatDescription from "./StatDescription.astro";
|
|
3
|
-
import StatTitle from "./StatTitle.astro";
|
|
4
|
-
import StatValue from "./StatValue.astro";
|
|
5
|
-
|
|
6
|
-
export { Stat, StatDescription, StatTitle, StatValue };
|
|
1
|
+
import Stat from "./Stat.astro";
|
|
2
|
+
import StatDescription from "./StatDescription.astro";
|
|
3
|
+
import StatTitle from "./StatTitle.astro";
|
|
4
|
+
import StatValue from "./StatValue.astro";
|
|
5
|
+
|
|
6
|
+
export { Stat, StatDescription, StatTitle, StatValue };
|