@orbitkit/components 0.1.0 → 0.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -25
- package/dist/astro/accordion/Accordion.astro +34 -0
- package/dist/astro/accordion/AccordionItem.astro +16 -0
- package/dist/astro/accordion/AccordionTrigger.astro +33 -0
- package/dist/astro/accordion/AcordionContent.astro +26 -0
- package/dist/astro/accordion/accordion.ts +125 -0
- package/dist/astro/accordion/index.ts +6 -0
- package/dist/astro/alert/Alert.astro +30 -30
- package/dist/astro/alert/AlertDescription.astro +10 -10
- package/dist/astro/alert/AlertTitle.astro +15 -15
- package/dist/astro/alert/alertVariants.ts +51 -51
- package/dist/astro/alert/index.ts +6 -6
- package/dist/astro/avatar/Avatar.astro +16 -16
- package/dist/astro/avatar/AvatarFallback.astro +18 -18
- package/dist/astro/avatar/AvatarImage.astro +14 -14
- package/dist/astro/avatar/avatarVariants.ts +23 -23
- package/dist/astro/avatar/index.ts +6 -6
- package/dist/astro/badge/Badge.astro +22 -22
- package/dist/astro/badge/badgeVariants.ts +37 -37
- package/dist/astro/badge/index.ts +4 -4
- package/dist/astro/breadcrumb/Breadcrumb.astro +12 -12
- package/dist/astro/breadcrumb/BreadcrumbEllipsis.astro +20 -20
- package/dist/astro/breadcrumb/BreadcrumbItem.astro +15 -15
- package/dist/astro/breadcrumb/BreadcrumbLink.astro +18 -18
- package/dist/astro/breadcrumb/BreadcrumbList.astro +18 -18
- package/dist/astro/breadcrumb/BreadcrumbPage.astro +18 -18
- package/dist/astro/breadcrumb/BreadcrumbSeparator.astro +17 -17
- package/dist/astro/breadcrumb/index.ts +17 -17
- package/dist/astro/button/Button.astro +29 -29
- package/dist/astro/button/buttonVariants.ts +61 -61
- package/dist/astro/button/index.ts +4 -4
- package/dist/astro/card/Card.astro +18 -18
- package/dist/astro/card/CardContent.astro +12 -12
- package/dist/astro/card/CardDescription.astro +12 -12
- package/dist/astro/card/CardFooter.astro +15 -15
- package/dist/astro/card/CardHeader.astro +12 -12
- package/dist/astro/card/CardTitle.astro +18 -18
- package/dist/astro/card/index.ts +15 -15
- package/dist/astro/checkbox/Checkbox.astro +38 -38
- package/dist/astro/checkbox/index.ts +3 -3
- package/dist/astro/collapsible/Collapsible.astro +34 -0
- package/dist/astro/collapsible/CollapsibleContent.astro +20 -0
- package/dist/astro/collapsible/collapsible.ts +81 -0
- package/dist/astro/collapsible/index.ts +4 -0
- package/dist/astro/divider/Divider.astro +22 -22
- package/dist/astro/divider/index.ts +3 -3
- package/dist/astro/drawer/Drawer.astro +19 -0
- package/dist/astro/drawer/DrawerContent.astro +74 -0
- package/dist/astro/drawer/DrawerDescription.astro +12 -0
- package/dist/astro/drawer/DrawerFooter.astro +15 -0
- package/dist/astro/drawer/DrawerHeader.astro +12 -0
- package/dist/astro/drawer/DrawerTitle.astro +18 -0
- package/dist/astro/drawer/drawer.ts +104 -0
- package/dist/astro/drawer/drawerVariants.ts +83 -0
- package/dist/astro/drawer/index.ts +15 -0
- package/dist/astro/dropdown/DropdownMenu.astro +19 -0
- package/dist/astro/dropdown/DropdownMenuContent.astro +42 -0
- package/dist/astro/dropdown/DropdownMenuGroup.astro +3 -0
- package/dist/astro/dropdown/DropdownMenuItem.astro +27 -0
- package/dist/astro/dropdown/DropdownMenuLabel.astro +3 -0
- package/dist/astro/dropdown/DropdownMenuSeparator.astro +6 -0
- package/dist/astro/dropdown/dropdown.ts +157 -0
- package/dist/astro/dropdown/dropdownVariants.ts +134 -0
- package/dist/astro/dropdown/index.ts +15 -0
- package/dist/astro/input/Input.astro +18 -18
- package/dist/astro/input/index.ts +4 -4
- package/dist/astro/input/inputVariants.ts +30 -30
- package/dist/astro/kbd/Kbd.astro +18 -0
- package/dist/astro/kbd/index.ts +3 -0
- package/dist/astro/label/Label.astro +14 -14
- package/dist/astro/label/index.ts +3 -3
- package/dist/astro/list/List.astro +25 -25
- package/dist/astro/list/ListItem.astro +39 -39
- package/dist/astro/list/ListVariants.ts +65 -65
- package/dist/astro/list/index.ts +5 -5
- package/dist/astro/modal/Modal.astro +19 -0
- package/dist/astro/modal/ModalContent.astro +71 -0
- package/dist/astro/modal/ModalDescription.astro +12 -0
- package/dist/astro/modal/ModalFooter.astro +15 -0
- package/dist/astro/modal/ModalHeader.astro +12 -0
- package/dist/astro/modal/ModalTitle.astro +18 -0
- package/dist/astro/modal/index.ts +15 -0
- package/dist/astro/modal/modal.ts +101 -0
- package/dist/astro/pagination/Pagination.astro +12 -0
- package/dist/astro/pagination/PaginationContent.astro +15 -0
- package/dist/astro/pagination/PaginationEllipsis.astro +33 -0
- package/dist/astro/pagination/PaginationItem.astro +12 -0
- package/dist/astro/pagination/PaginationLink.astro +21 -0
- package/dist/astro/pagination/PaginationNext.astro +29 -0
- package/dist/astro/pagination/PaginationPrevious.astro +34 -0
- package/dist/astro/pagination/index.ts +13 -0
- package/dist/astro/pagination/paginationVariants.ts +26 -0
- package/dist/astro/popover/Popover.astro +17 -0
- package/dist/astro/popover/PopoverContent.astro +39 -0
- package/dist/astro/popover/index.ts +4 -0
- package/dist/astro/popover/popover.ts +113 -0
- package/dist/astro/popover/popoverVariants.ts +115 -0
- package/dist/astro/progress/Progress.astro +23 -23
- package/dist/astro/progress/index.ts +4 -4
- package/dist/astro/progress/progressContainer.astro +17 -17
- package/dist/astro/radio/Radio.astro +26 -26
- package/dist/astro/radio/index.ts +3 -3
- package/dist/astro/select/Option.astro +11 -11
- package/dist/astro/select/Select.astro +39 -39
- package/dist/astro/select/index.ts +5 -5
- package/dist/astro/select/selectVariants.ts +30 -30
- package/dist/astro/skeleton/Skeleton.astro +12 -12
- package/dist/astro/skeleton/SkeletonItem.astro +18 -18
- package/dist/astro/skeleton/index.ts +4 -4
- package/dist/astro/stat/Stat.astro +12 -0
- package/dist/astro/stat/StatDescription.astro +12 -0
- package/dist/astro/stat/StatTitle.astro +18 -0
- package/dist/astro/stat/StatValue.astro +12 -0
- package/dist/astro/stat/index.ts +6 -0
- package/dist/astro/switch/Switch.astro +19 -19
- package/dist/astro/switch/index.ts +3 -3
- package/dist/astro/tab/Tab.astro +33 -0
- package/dist/astro/tab/TabContent.astro +19 -0
- package/dist/astro/tab/TabList.astro +19 -0
- package/dist/astro/tab/TabTrigger.astro +24 -0
- package/dist/astro/tab/index.ts +6 -0
- package/dist/astro/tab/tab.ts +142 -0
- package/dist/astro/textarea/Textarea.astro +19 -19
- package/dist/astro/textarea/TextareaVariants.ts +30 -30
- package/dist/astro/textarea/index.ts +4 -4
- package/dist/astro/tooltip/Tooltip.astro +40 -0
- package/dist/astro/tooltip/TooltipContent.astro +39 -0
- package/dist/astro/tooltip/index.ts +6 -0
- package/dist/astro/tooltip/tooltip.ts +137 -0
- package/dist/astro/tooltip/tooltipVariants.ts +115 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/package.json +54 -54
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# @orbitkit/components
|
|
2
|
-
|
|
3
|
-
_A collection of accessible, customizable, and lightweight UI components for Astro projects, powered by Tailwind CSS._
|
|
4
|
-
|
|
5
|
-
> **Warning:** Do not install or use this package directly in your projects. Use the Orbit CLI for integration and component management.
|
|
6
|
-
|
|
7
|
-
## 🛠️ Customization
|
|
8
|
-
|
|
9
|
-
All components are styled with Tailwind CSS utility classes. You can easily override or extend styles via your project's Tailwind configuration.
|
|
10
|
-
|
|
11
|
-
## 📖 Documentation
|
|
12
|
-
|
|
13
|
-
Full documentation is coming soon.
|
|
14
|
-
|
|
15
|
-
## 🤝 Contributing
|
|
16
|
-
|
|
17
|
-
Pull requests are welcome! For major changes, please open an issue first.
|
|
18
|
-
|
|
19
|
-
## 📜 License
|
|
20
|
-
|
|
21
|
-
This project is licensed under the MIT License - See [MIT License](https://github.com/NSMichelJ/orbitkit/blob/main/LICENSE) for details.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
<p align="center"><strong>Built with ❤️</strong></p>
|
|
1
|
+
# @orbitkit/components
|
|
2
|
+
|
|
3
|
+
_A collection of accessible, customizable, and lightweight UI components for Astro projects, powered by Tailwind CSS._
|
|
4
|
+
|
|
5
|
+
> **Warning:** Do not install or use this package directly in your projects. Use the Orbit CLI for integration and component management.
|
|
6
|
+
|
|
7
|
+
## 🛠️ Customization
|
|
8
|
+
|
|
9
|
+
All components are styled with Tailwind CSS utility classes. You can easily override or extend styles via your project's Tailwind configuration.
|
|
10
|
+
|
|
11
|
+
## 📖 Documentation
|
|
12
|
+
|
|
13
|
+
Full documentation is coming soon.
|
|
14
|
+
|
|
15
|
+
## 🤝 Contributing
|
|
16
|
+
|
|
17
|
+
Pull requests are welcome! For major changes, please open an issue first.
|
|
18
|
+
|
|
19
|
+
## 📜 License
|
|
20
|
+
|
|
21
|
+
This project is licensed under the MIT License - See [MIT License](https://github.com/NSMichelJ/orbitkit/blob/main/LICENSE) for details.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<p align="center"><strong>Built with ❤️</strong></p>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
+
multiple?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { class: className, multiple = false, ...attrs } = Astro.props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
{...attrs}
|
|
14
|
+
data-accordion
|
|
15
|
+
data-multiple={multiple}
|
|
16
|
+
class={cn("w-full", className)}
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import { Accordion } from "./accordion";
|
|
23
|
+
|
|
24
|
+
function init() {
|
|
25
|
+
const accordions =
|
|
26
|
+
document.querySelectorAll<HTMLElement>("[data-accordion]");
|
|
27
|
+
accordions.forEach((accordion) => {
|
|
28
|
+
new Accordion(accordion);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
init();
|
|
33
|
+
document.addEventListener("astro:page-load", () => init());
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
{...attrs}
|
|
12
|
+
data-accordion-item
|
|
13
|
+
class={cn("border-b border-border last:border-b-0", className)}
|
|
14
|
+
>
|
|
15
|
+
<slot />
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"button"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<h3>
|
|
11
|
+
<button
|
|
12
|
+
{...attrs}
|
|
13
|
+
aria-expanded="false"
|
|
14
|
+
data-accordion-trigger
|
|
15
|
+
class={cn(
|
|
16
|
+
"flex items-center justify-between py-4 border-b border-border last:border-b-0 w-full text-start text-base font-medium cursor-pointer [&[data-state=open]>svg]:rotate-180",
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
<svg
|
|
22
|
+
viewBox="0 0 24 24"
|
|
23
|
+
fill="none"
|
|
24
|
+
stroke="currentColor"
|
|
25
|
+
stroke-width="2"
|
|
26
|
+
stroke-linecap="round"
|
|
27
|
+
stroke-linejoin="round"
|
|
28
|
+
class="size-4 transform transition-transform duration-200"
|
|
29
|
+
><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path
|
|
30
|
+
d="M6 9l6 6l6 -6"></path></svg
|
|
31
|
+
>
|
|
32
|
+
</button>
|
|
33
|
+
</h3>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
+
open?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { class: className, open = false, ...attrs } = Astro.props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
{...attrs}
|
|
14
|
+
role="region"
|
|
15
|
+
data-accordion-content
|
|
16
|
+
data-open={open}
|
|
17
|
+
class={cn(
|
|
18
|
+
"overflow-hidden transition-all duration-300 ease-in-out",
|
|
19
|
+
{ "max-h-0": !open },
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
>
|
|
23
|
+
<div class="pb-4">
|
|
24
|
+
<slot />
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
interface AccordionItem extends HTMLElement {
|
|
2
|
+
trigger?: HTMLElement;
|
|
3
|
+
content?: HTMLElement;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export class Accordion {
|
|
7
|
+
private wrapper: HTMLElement;
|
|
8
|
+
private items: NodeListOf<HTMLElement> | null;
|
|
9
|
+
|
|
10
|
+
constructor(accordionWrapper: HTMLElement) {
|
|
11
|
+
this.wrapper = accordionWrapper;
|
|
12
|
+
this.items = this.wrapper.querySelectorAll("[data-accordion-item]");
|
|
13
|
+
|
|
14
|
+
this.init();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
private init() {
|
|
18
|
+
this.items?.forEach((item: AccordionItem) => {
|
|
19
|
+
const trigger = item.querySelector<HTMLElement>(
|
|
20
|
+
"[data-accordion-trigger]",
|
|
21
|
+
);
|
|
22
|
+
const content = item.querySelector<HTMLElement>(
|
|
23
|
+
"[data-accordion-content]",
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if (trigger && content) {
|
|
27
|
+
item.trigger = trigger;
|
|
28
|
+
item.content = content;
|
|
29
|
+
|
|
30
|
+
this.setupAccessibility(item);
|
|
31
|
+
this.setupEventListeners(item);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private setupAccessibility(item: AccordionItem) {
|
|
37
|
+
if (item.trigger && item.content) {
|
|
38
|
+
const triggerId =
|
|
39
|
+
item.trigger.id ||
|
|
40
|
+
`accordion-id-${Math.random().toString(36).substring(2, 9)}`;
|
|
41
|
+
const contentId =
|
|
42
|
+
item.content.id ||
|
|
43
|
+
`accordion-id-${Math.random().toString(36).substring(2, 9)}`;
|
|
44
|
+
|
|
45
|
+
item.trigger.id = triggerId;
|
|
46
|
+
item.trigger.setAttribute("aria-controls", contentId);
|
|
47
|
+
|
|
48
|
+
item.content.id = contentId;
|
|
49
|
+
item.content.setAttribute("aria-labelledby", triggerId);
|
|
50
|
+
item.content.setAttribute("role", "region");
|
|
51
|
+
|
|
52
|
+
this.setState(item, "closed");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private setupEventListeners(item: AccordionItem) {
|
|
57
|
+
if (!item.trigger && !item.content) return;
|
|
58
|
+
|
|
59
|
+
item.trigger?.addEventListener("click", () =>
|
|
60
|
+
this.toggleAccordionItem(item),
|
|
61
|
+
);
|
|
62
|
+
item.trigger?.addEventListener("keydown", (e) =>
|
|
63
|
+
this.handleKeydown(e, item),
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private toggleAccordionItem(item: AccordionItem) {
|
|
68
|
+
if (item.trigger?.getAttribute("aria-expanded") === "true") {
|
|
69
|
+
this.closeAccordionItem(item);
|
|
70
|
+
} else {
|
|
71
|
+
if (this.wrapper.dataset.multiple !== "true") {
|
|
72
|
+
this.closeAllContents();
|
|
73
|
+
}
|
|
74
|
+
this.openAccordionItem(item);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private openAccordionItem(item: AccordionItem) {
|
|
79
|
+
this.setState(item, "open");
|
|
80
|
+
const height = item.content?.scrollHeight + "px";
|
|
81
|
+
item.content!.style.maxHeight = height;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private closeAccordionItem(item: AccordionItem) {
|
|
85
|
+
this.setState(item, "closed");
|
|
86
|
+
item.content!.style.maxHeight = "0px";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private closeAllContents() {
|
|
90
|
+
this.items?.forEach((item) => {
|
|
91
|
+
this.closeAccordionItem(item);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private handleKeydown(event: KeyboardEvent, item: AccordionItem) {
|
|
96
|
+
const items = Array.from(this.items || []);
|
|
97
|
+
const currentItemIndex = items.indexOf(item);
|
|
98
|
+
|
|
99
|
+
const keyActions: Record<string, () => void> = {
|
|
100
|
+
ArrowDown: () => this.setFocusItem(items, currentItemIndex + 1),
|
|
101
|
+
ArrowUp: () => this.setFocusItem(items, currentItemIndex - 1),
|
|
102
|
+
Home: () => this.setFocusItem(items, 0),
|
|
103
|
+
End: () => this.setFocusItem(items, items.length - 1),
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const action = keyActions[event.key];
|
|
107
|
+
if (action) {
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
action();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private setFocusItem(items: AccordionItem[], index: number) {
|
|
114
|
+
const newIndex = (index + items.length) % items.length;
|
|
115
|
+
if (items[newIndex].trigger) {
|
|
116
|
+
items[newIndex].trigger.focus();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private setState(item: AccordionItem, state: "closed" | "open") {
|
|
121
|
+
item.trigger?.setAttribute("data-state", state);
|
|
122
|
+
item.trigger?.setAttribute("aria-expanded", `${state === "open"}`);
|
|
123
|
+
item.content?.setAttribute("data-state", state);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import Accordion from "./Accordion.astro";
|
|
2
|
+
import AccordionItem from "./AccordionItem.astro";
|
|
3
|
+
import AccordionTrigger from "./AccordionTrigger.astro";
|
|
4
|
+
import AccordionContent from "./AcordionContent.astro";
|
|
5
|
+
|
|
6
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import { type HTMLAttributes } from "astro/types";
|
|
4
|
-
import type { VariantProps } from "class-variance-authority";
|
|
5
|
-
import { alertVariants } from "./alertVariants";
|
|
6
|
-
|
|
7
|
-
interface Props
|
|
8
|
-
extends HTMLAttributes<"div">,
|
|
9
|
-
VariantProps<typeof alertVariants> {}
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
class: className,
|
|
13
|
-
variant,
|
|
14
|
-
rounded,
|
|
15
|
-
size,
|
|
16
|
-
direction,
|
|
17
|
-
border,
|
|
18
|
-
...attrs
|
|
19
|
-
} = Astro.props;
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
<div
|
|
23
|
-
{...attrs}
|
|
24
|
-
role="alert"
|
|
25
|
-
class={cn(
|
|
26
|
-
alertVariants({ variant, rounded, size, direction, border, className }),
|
|
27
|
-
)}
|
|
28
|
-
>
|
|
29
|
-
<slot />
|
|
30
|
-
</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 { alertVariants } from "./alertVariants";
|
|
6
|
+
|
|
7
|
+
interface Props
|
|
8
|
+
extends HTMLAttributes<"div">,
|
|
9
|
+
VariantProps<typeof alertVariants> {}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
class: className,
|
|
13
|
+
variant,
|
|
14
|
+
rounded,
|
|
15
|
+
size,
|
|
16
|
+
direction,
|
|
17
|
+
border,
|
|
18
|
+
...attrs
|
|
19
|
+
} = Astro.props;
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
<div
|
|
23
|
+
{...attrs}
|
|
24
|
+
role="alert"
|
|
25
|
+
class={cn(
|
|
26
|
+
alertVariants({ variant, rounded, size, direction, border, className }),
|
|
27
|
+
)}
|
|
28
|
+
>
|
|
29
|
+
<slot />
|
|
30
|
+
</div>
|
|
@@ -1,10 +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 {...attrs} class={cn(className)}><slot /></p>
|
|
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 {...attrs} class={cn(className)}><slot /></p>
|
|
@@ -1,15 +1,15 @@
|
|
|
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
|
|
11
|
-
{...attrs}
|
|
12
|
-
class={cn("font-medium flex items-center justify-start gap-2", className)}
|
|
13
|
-
>
|
|
14
|
-
<slot />
|
|
15
|
-
</p>
|
|
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
|
|
11
|
+
{...attrs}
|
|
12
|
+
class={cn("font-medium flex items-center justify-start gap-2", className)}
|
|
13
|
+
>
|
|
14
|
+
<slot />
|
|
15
|
+
</p>
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { cva } from "class-variance-authority";
|
|
2
|
-
|
|
3
|
-
const baseClass = "flex justify-start gap-y-1 gap-x-2 flex-wrap w-full";
|
|
4
|
-
|
|
5
|
-
const alertVariants = cva(baseClass, {
|
|
6
|
-
variants: {
|
|
7
|
-
variant: {
|
|
8
|
-
default: "bg-surface border-border text-foreground",
|
|
9
|
-
info: " text-blue-800 border-blue-300 bg-blue-50 dark:bg-gray-800 dark:text-blue-400 dark:border-blue-800",
|
|
10
|
-
danger:
|
|
11
|
-
"text-red-800 border-red-300 bg-red-50 dark:bg-gray-800 dark:text-red-400 dark:border-red-800",
|
|
12
|
-
success:
|
|
13
|
-
"text-green-800 border-green-300 bg-green-50 dark:bg-gray-800 dark:text-green-400 dark:border-green-800",
|
|
14
|
-
warning:
|
|
15
|
-
"text-yellow-800 border-yellow-300 bg-yellow-50 dark:bg-gray-800 dark:text-yellow-300 dark:border-yellow-800",
|
|
16
|
-
},
|
|
17
|
-
rounded: {
|
|
18
|
-
none: "rounded-none",
|
|
19
|
-
xs: "rounded-xs",
|
|
20
|
-
sm: "rounded-sm",
|
|
21
|
-
md: "rounded-md",
|
|
22
|
-
lg: "rounded-lg",
|
|
23
|
-
xl: "rounded-xl",
|
|
24
|
-
full: "rounded-full",
|
|
25
|
-
},
|
|
26
|
-
size: {
|
|
27
|
-
xs: "p-3 text-xs",
|
|
28
|
-
sm: "p-3 text-sm",
|
|
29
|
-
md: "p-4 text-sm",
|
|
30
|
-
lg: "p-5 text-base",
|
|
31
|
-
xl: "p-5 text-lg",
|
|
32
|
-
},
|
|
33
|
-
direction: {
|
|
34
|
-
row: "flex-row",
|
|
35
|
-
col: "flex-col",
|
|
36
|
-
},
|
|
37
|
-
border: {
|
|
38
|
-
false: null,
|
|
39
|
-
true: "border",
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
defaultVariants: {
|
|
43
|
-
variant: "default",
|
|
44
|
-
size: "sm",
|
|
45
|
-
rounded: "lg",
|
|
46
|
-
direction: "col",
|
|
47
|
-
border: true,
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export { alertVariants };
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
const baseClass = "flex justify-start gap-y-1 gap-x-2 flex-wrap w-full";
|
|
4
|
+
|
|
5
|
+
const alertVariants = cva(baseClass, {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "bg-surface border-border text-foreground",
|
|
9
|
+
info: " text-blue-800 border-blue-300 bg-blue-50 dark:bg-gray-800 dark:text-blue-400 dark:border-blue-800",
|
|
10
|
+
danger:
|
|
11
|
+
"text-red-800 border-red-300 bg-red-50 dark:bg-gray-800 dark:text-red-400 dark:border-red-800",
|
|
12
|
+
success:
|
|
13
|
+
"text-green-800 border-green-300 bg-green-50 dark:bg-gray-800 dark:text-green-400 dark:border-green-800",
|
|
14
|
+
warning:
|
|
15
|
+
"text-yellow-800 border-yellow-300 bg-yellow-50 dark:bg-gray-800 dark:text-yellow-300 dark:border-yellow-800",
|
|
16
|
+
},
|
|
17
|
+
rounded: {
|
|
18
|
+
none: "rounded-none",
|
|
19
|
+
xs: "rounded-xs",
|
|
20
|
+
sm: "rounded-sm",
|
|
21
|
+
md: "rounded-md",
|
|
22
|
+
lg: "rounded-lg",
|
|
23
|
+
xl: "rounded-xl",
|
|
24
|
+
full: "rounded-full",
|
|
25
|
+
},
|
|
26
|
+
size: {
|
|
27
|
+
xs: "p-3 text-xs",
|
|
28
|
+
sm: "p-3 text-sm",
|
|
29
|
+
md: "p-4 text-sm",
|
|
30
|
+
lg: "p-5 text-base",
|
|
31
|
+
xl: "p-5 text-lg",
|
|
32
|
+
},
|
|
33
|
+
direction: {
|
|
34
|
+
row: "flex-row",
|
|
35
|
+
col: "flex-col",
|
|
36
|
+
},
|
|
37
|
+
border: {
|
|
38
|
+
false: null,
|
|
39
|
+
true: "border",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
variant: "default",
|
|
44
|
+
size: "sm",
|
|
45
|
+
rounded: "lg",
|
|
46
|
+
direction: "col",
|
|
47
|
+
border: true,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export { alertVariants };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Alert from "./Alert.astro";
|
|
2
|
-
import AlertDescription from "./AlertDescription.astro";
|
|
3
|
-
import AlertTitle from "./AlertTitle.astro";
|
|
4
|
-
import { alertVariants } from "./alertVariants";
|
|
5
|
-
|
|
6
|
-
export { Alert, AlertDescription, AlertTitle, alertVariants };
|
|
1
|
+
import Alert from "./Alert.astro";
|
|
2
|
+
import AlertDescription from "./AlertDescription.astro";
|
|
3
|
+
import AlertTitle from "./AlertTitle.astro";
|
|
4
|
+
import { alertVariants } from "./alertVariants";
|
|
5
|
+
|
|
6
|
+
export { Alert, AlertDescription, AlertTitle, alertVariants };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import { type HTMLAttributes } from "astro/types";
|
|
4
|
-
import type { VariantProps } from "class-variance-authority";
|
|
5
|
-
import { avatarVariants } from "./avatarVariants";
|
|
6
|
-
|
|
7
|
-
interface Props
|
|
8
|
-
extends HTMLAttributes<"div">,
|
|
9
|
-
VariantProps<typeof avatarVariants> {}
|
|
10
|
-
|
|
11
|
-
const { class: className, variant, bordered, ...attrs } = Astro.props;
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<div {...attrs} class={cn(avatarVariants({ variant, bordered, className }))}>
|
|
15
|
-
<slot />
|
|
16
|
-
</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 { avatarVariants } from "./avatarVariants";
|
|
6
|
+
|
|
7
|
+
interface Props
|
|
8
|
+
extends HTMLAttributes<"div">,
|
|
9
|
+
VariantProps<typeof avatarVariants> {}
|
|
10
|
+
|
|
11
|
+
const { class: className, variant, bordered, ...attrs } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<div {...attrs} class={cn(avatarVariants({ variant, bordered, className }))}>
|
|
15
|
+
<slot />
|
|
16
|
+
</div>
|
|
@@ -1,18 +1,18 @@
|
|
|
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
|
-
{...attrs}
|
|
12
|
-
class={cn(
|
|
13
|
-
"absolute z-0 font-medium text-gray-600 dark:text-gray-300",
|
|
14
|
-
className,
|
|
15
|
-
)}
|
|
16
|
-
>
|
|
17
|
-
<slot />
|
|
18
|
-
</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
|
|
11
|
+
{...attrs}
|
|
12
|
+
class={cn(
|
|
13
|
+
"absolute z-0 font-medium text-gray-600 dark:text-gray-300",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import { type HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"img"> {}
|
|
6
|
-
|
|
7
|
-
const { class: className, ...attrs } = Astro.props;
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
<img
|
|
11
|
-
{...attrs}
|
|
12
|
-
class={cn("relative aspect-square object-cover z-10", className)}
|
|
13
|
-
onerror="this.style.display='none'"
|
|
14
|
-
/>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import { type HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"img"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<img
|
|
11
|
+
{...attrs}
|
|
12
|
+
class={cn("relative aspect-square object-cover z-10", className)}
|
|
13
|
+
onerror="this.style.display='none'"
|
|
14
|
+
/>
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { cva } from "class-variance-authority";
|
|
2
|
-
|
|
3
|
-
const avatarBaseClass =
|
|
4
|
-
"relative inline-flex items-center justify-center size-10 overflow-hidden bg-secondary text-secondary-foreground z-10";
|
|
5
|
-
|
|
6
|
-
const avatarVariants = cva(avatarBaseClass, {
|
|
7
|
-
variants: {
|
|
8
|
-
variant: {
|
|
9
|
-
circular: "rounded-full",
|
|
10
|
-
square: "rounded-sm",
|
|
11
|
-
},
|
|
12
|
-
bordered: {
|
|
13
|
-
false: null,
|
|
14
|
-
true: "ring-2 ring-border",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
defaultVariants: {
|
|
18
|
-
variant: "circular",
|
|
19
|
-
bordered: false,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export { avatarVariants };
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
const avatarBaseClass =
|
|
4
|
+
"relative inline-flex items-center justify-center size-10 overflow-hidden bg-secondary text-secondary-foreground z-10";
|
|
5
|
+
|
|
6
|
+
const avatarVariants = cva(avatarBaseClass, {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
circular: "rounded-full",
|
|
10
|
+
square: "rounded-sm",
|
|
11
|
+
},
|
|
12
|
+
bordered: {
|
|
13
|
+
false: null,
|
|
14
|
+
true: "ring-2 ring-border",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: "circular",
|
|
19
|
+
bordered: false,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { avatarVariants };
|