@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
|
@@ -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 };
|
|
@@ -1,19 +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 } = Astro.props;
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
<div
|
|
11
|
-
role="tablist"
|
|
12
|
-
data-tab-list
|
|
13
|
-
class={cn(
|
|
14
|
-
"flex flex-row justify-between flex-wrap bg-surface border border-border p-1 rounded-lg w-fit",
|
|
15
|
-
className,
|
|
16
|
-
)}
|
|
17
|
-
>
|
|
18
|
-
<slot />
|
|
19
|
-
</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 } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<div
|
|
11
|
+
role="tablist"
|
|
12
|
+
data-tab-list
|
|
13
|
+
class={cn(
|
|
14
|
+
"flex flex-row justify-between flex-wrap bg-surface border border-border p-1 rounded-lg w-fit",
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
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-toast
|
|
12
|
+
class={cn(
|
|
13
|
+
"fixed z-[1000] p-4 bg-background text-foreground border border-border rounded-lg shadow-lg flex flex-row items-start gap-2 overflow-hidden opacity-0 duration-500 transition-all ease-in-out min-w-xs max-w-md data-[state=showing]:opacity-100 data-[state=hide]:pointer-events-none ",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
{...attrs}
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
@reference "@/styles/global.css";
|
|
23
|
+
|
|
24
|
+
[data-toast][data-toast-type="success"] {
|
|
25
|
+
@apply border-green-500 bg-green-50 text-green-800;
|
|
26
|
+
}
|
|
27
|
+
[data-toast][data-toast-type="error"] {
|
|
28
|
+
@apply border-red-500 bg-red-50 text-red-800;
|
|
29
|
+
}
|
|
30
|
+
[data-toast][data-toast-type="warning"] {
|
|
31
|
+
@apply border-orange-400 bg-orange-50 text-orange-800;
|
|
32
|
+
}
|
|
33
|
+
[data-toast][data-toast-type="info"] {
|
|
34
|
+
@apply border-blue-500 bg-blue-50 text-blue-800;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import { type HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"p"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<p data-toast-description class={cn("text-sm", className)} {...attrs}></p>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"h5"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<h5
|
|
11
|
+
data-toast-title
|
|
12
|
+
class={cn(
|
|
13
|
+
"font-medium flex items-center justify-start gap-2 text-sm",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
{...attrs}
|
|
17
|
+
>
|
|
18
|
+
</h5>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Toast from "./Toast.astro";
|
|
3
|
+
import ToastDescription from "./ToastDescription.astro";
|
|
4
|
+
import ToastTitle from "./ToastTitle.astro";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
offset?: number;
|
|
8
|
+
gap?: number;
|
|
9
|
+
position?:
|
|
10
|
+
| "top-right"
|
|
11
|
+
| "top-center"
|
|
12
|
+
| "top-left"
|
|
13
|
+
| "bottom-right"
|
|
14
|
+
| "bottom-center"
|
|
15
|
+
| "bottom-left";
|
|
16
|
+
visibleToasts?: number;
|
|
17
|
+
dismissible?: boolean;
|
|
18
|
+
autoClose?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
offset = 24,
|
|
23
|
+
gap = 16,
|
|
24
|
+
position = "bottom-right",
|
|
25
|
+
visibleToasts = 3,
|
|
26
|
+
dismissible = true,
|
|
27
|
+
autoClose = true,
|
|
28
|
+
} = Astro.props;
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<section
|
|
32
|
+
tabindex="-1"
|
|
33
|
+
data-toaster
|
|
34
|
+
data-position={position}
|
|
35
|
+
data-visible-toasts={visibleToasts}
|
|
36
|
+
data-offset={offset}
|
|
37
|
+
data-dismissible={dismissible}
|
|
38
|
+
data-position={position}
|
|
39
|
+
data-gap={gap}
|
|
40
|
+
data-auto-close={autoClose}
|
|
41
|
+
>
|
|
42
|
+
<template id="toast-template">
|
|
43
|
+
<slot>
|
|
44
|
+
<Toast>
|
|
45
|
+
<div data-toast-icon></div>
|
|
46
|
+
|
|
47
|
+
<div>
|
|
48
|
+
<ToastTitle />
|
|
49
|
+
<ToastDescription />
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<button
|
|
53
|
+
class="absolute right-1 top-1 cursor-pointer rounded-lg p-1 transition-colors duration-150"
|
|
54
|
+
aria-label="close toast"
|
|
55
|
+
data-close
|
|
56
|
+
data-dismissible-button
|
|
57
|
+
>
|
|
58
|
+
<svg
|
|
59
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
60
|
+
viewBox="0 0 24 24"
|
|
61
|
+
fill="none"
|
|
62
|
+
stroke="currentColor"
|
|
63
|
+
stroke-width="2"
|
|
64
|
+
stroke-linecap="round"
|
|
65
|
+
stroke-linejoin="round"
|
|
66
|
+
class="size-4"
|
|
67
|
+
>
|
|
68
|
+
<>
|
|
69
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
70
|
+
<path d="M18 6l-12 12"></path>
|
|
71
|
+
<path d="M6 6l12 12"></path>
|
|
72
|
+
</>
|
|
73
|
+
</svg>
|
|
74
|
+
</button>
|
|
75
|
+
</Toast>
|
|
76
|
+
</slot>
|
|
77
|
+
</template>
|
|
78
|
+
</section>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const toastIcons: Record<string, string> = {
|
|
2
|
+
success: `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z" /></svg>`,
|
|
3
|
+
error: `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="currentColor" class="icon icon-tabler icons-tabler-filled icon-tabler-alert-circle"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm.01 13l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z" /></svg>`,
|
|
4
|
+
warning: `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 1.67c.955 0 1.845 .467 2.39 1.247l.105 .16l8.114 13.548a2.914 2.914 0 0 1 -2.307 4.363l-.195 .008h-16.225a2.914 2.914 0 0 1 -2.582 -4.2l.099 -.185l8.11 -13.538a2.914 2.914 0 0 1 2.491 -1.403zm.01 13.33l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -7a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z" /></svg>`,
|
|
5
|
+
info: `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm0 9h-1l-.117 .007a1 1 0 0 0 0 1.986l.117 .007v3l.007 .117a1 1 0 0 0 .876 .876l.117 .007h1l.117 -.007a1 1 0 0 0 .876 -.876l.007 -.117l-.007 -.117a1 1 0 0 0 -.764 -.857l-.112 -.02l-.117 -.006v-3l-.007 -.117a1 1 0 0 0 -.876 -.876l-.117 -.007zm.01 -3l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z" /></svg>`,
|
|
6
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { toastIcons } from "./assets";
|
|
2
|
+
import type {
|
|
3
|
+
ToastDomElements,
|
|
4
|
+
ToastOptions,
|
|
5
|
+
ToastPosition,
|
|
6
|
+
ToastType,
|
|
7
|
+
} from "./toast";
|
|
8
|
+
import { Toast as ToastHandler } from "./toast";
|
|
9
|
+
import Toast from "./Toast.astro";
|
|
10
|
+
import ToastDescription from "./ToastDescription.astro";
|
|
11
|
+
import ToastTitle from "./ToastTitle.astro";
|
|
12
|
+
|
|
13
|
+
export { Toast, ToastDescription, ToastHandler, toastIcons, ToastTitle };
|
|
14
|
+
export type { ToastDomElements, ToastOptions, ToastPosition, ToastType };
|
|
15
|
+
|
|
16
|
+
export const toast = Object.assign(
|
|
17
|
+
(opts: ToastOptions) => new ToastHandler(opts),
|
|
18
|
+
{
|
|
19
|
+
success: (opts: Omit<ToastOptions, "type">) =>
|
|
20
|
+
new ToastHandler({ ...opts, type: "success" }),
|
|
21
|
+
error: (opts: Omit<ToastOptions, "type">) =>
|
|
22
|
+
new ToastHandler({ ...opts, type: "error" }),
|
|
23
|
+
warning: (opts: Omit<ToastOptions, "type">) =>
|
|
24
|
+
new ToastHandler({ ...opts, type: "warning" }),
|
|
25
|
+
info: (opts: Omit<ToastOptions, "type">) =>
|
|
26
|
+
new ToastHandler({ ...opts, type: "info" }),
|
|
27
|
+
default: (opts: Omit<ToastOptions, "type">) =>
|
|
28
|
+
new ToastHandler({ ...opts, type: "default" }),
|
|
29
|
+
},
|
|
30
|
+
);
|