@orbitkit/components 0.1.0 → 0.2.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.
Files changed (133) hide show
  1. package/README.md +25 -25
  2. package/dist/astro/accordion/Accordion.astro +34 -0
  3. package/dist/astro/accordion/AccordionItem.astro +19 -0
  4. package/dist/astro/accordion/AccordionTrigger.astro +33 -0
  5. package/dist/astro/accordion/AcordionContent.astro +23 -0
  6. package/dist/astro/accordion/accordion.ts +151 -0
  7. package/dist/astro/accordion/index.ts +6 -0
  8. package/dist/astro/alert/Alert.astro +30 -30
  9. package/dist/astro/alert/AlertDescription.astro +10 -10
  10. package/dist/astro/alert/AlertTitle.astro +15 -15
  11. package/dist/astro/alert/alertVariants.ts +51 -51
  12. package/dist/astro/alert/index.ts +6 -6
  13. package/dist/astro/avatar/Avatar.astro +16 -16
  14. package/dist/astro/avatar/AvatarFallback.astro +18 -18
  15. package/dist/astro/avatar/AvatarImage.astro +14 -14
  16. package/dist/astro/avatar/avatarVariants.ts +23 -23
  17. package/dist/astro/avatar/index.ts +6 -6
  18. package/dist/astro/badge/Badge.astro +22 -22
  19. package/dist/astro/badge/badgeVariants.ts +37 -37
  20. package/dist/astro/badge/index.ts +4 -4
  21. package/dist/astro/breadcrumb/Breadcrumb.astro +12 -12
  22. package/dist/astro/breadcrumb/BreadcrumbEllipsis.astro +20 -20
  23. package/dist/astro/breadcrumb/BreadcrumbItem.astro +15 -15
  24. package/dist/astro/breadcrumb/BreadcrumbLink.astro +18 -18
  25. package/dist/astro/breadcrumb/BreadcrumbList.astro +18 -18
  26. package/dist/astro/breadcrumb/BreadcrumbPage.astro +18 -18
  27. package/dist/astro/breadcrumb/BreadcrumbSeparator.astro +17 -17
  28. package/dist/astro/breadcrumb/index.ts +17 -17
  29. package/dist/astro/button/Button.astro +29 -29
  30. package/dist/astro/button/buttonVariants.ts +61 -61
  31. package/dist/astro/button/index.ts +4 -4
  32. package/dist/astro/card/Card.astro +18 -18
  33. package/dist/astro/card/CardContent.astro +12 -12
  34. package/dist/astro/card/CardDescription.astro +12 -12
  35. package/dist/astro/card/CardFooter.astro +15 -15
  36. package/dist/astro/card/CardHeader.astro +12 -12
  37. package/dist/astro/card/CardTitle.astro +18 -18
  38. package/dist/astro/card/index.ts +15 -15
  39. package/dist/astro/checkbox/Checkbox.astro +38 -38
  40. package/dist/astro/checkbox/index.ts +3 -3
  41. package/dist/astro/collapsible/Collapsible.astro +34 -0
  42. package/dist/astro/collapsible/CollapsibleContent.astro +20 -0
  43. package/dist/astro/collapsible/collapsible.ts +81 -0
  44. package/dist/astro/collapsible/index.ts +4 -0
  45. package/dist/astro/divider/Divider.astro +22 -22
  46. package/dist/astro/divider/index.ts +3 -3
  47. package/dist/astro/drawer/Drawer.astro +19 -0
  48. package/dist/astro/drawer/DrawerContent.astro +74 -0
  49. package/dist/astro/drawer/DrawerDescription.astro +12 -0
  50. package/dist/astro/drawer/DrawerFooter.astro +15 -0
  51. package/dist/astro/drawer/DrawerHeader.astro +12 -0
  52. package/dist/astro/drawer/DrawerTitle.astro +18 -0
  53. package/dist/astro/drawer/drawer.ts +104 -0
  54. package/dist/astro/drawer/drawerVariants.ts +83 -0
  55. package/dist/astro/drawer/index.ts +17 -0
  56. package/dist/astro/dropdown/DropdownMenu.astro +19 -0
  57. package/dist/astro/dropdown/DropdownMenuContent.astro +42 -0
  58. package/dist/astro/dropdown/DropdownMenuGroup.astro +3 -0
  59. package/dist/astro/dropdown/DropdownMenuItem.astro +27 -0
  60. package/dist/astro/dropdown/DropdownMenuLabel.astro +3 -0
  61. package/dist/astro/dropdown/DropdownMenuSeparator.astro +6 -0
  62. package/dist/astro/dropdown/dropdown.ts +157 -0
  63. package/dist/astro/dropdown/dropdownVariants.ts +134 -0
  64. package/dist/astro/dropdown/index.ts +23 -0
  65. package/dist/astro/input/Input.astro +18 -18
  66. package/dist/astro/input/index.ts +4 -4
  67. package/dist/astro/input/inputVariants.ts +30 -30
  68. package/dist/astro/kbd/Kbd.astro +18 -0
  69. package/dist/astro/kbd/index.ts +3 -0
  70. package/dist/astro/label/Label.astro +14 -14
  71. package/dist/astro/label/index.ts +3 -3
  72. package/dist/astro/list/List.astro +25 -25
  73. package/dist/astro/list/ListItem.astro +39 -39
  74. package/dist/astro/list/ListVariants.ts +65 -65
  75. package/dist/astro/list/index.ts +5 -5
  76. package/dist/astro/modal/Modal.astro +19 -0
  77. package/dist/astro/modal/ModalContent.astro +71 -0
  78. package/dist/astro/modal/ModalDescription.astro +12 -0
  79. package/dist/astro/modal/ModalFooter.astro +15 -0
  80. package/dist/astro/modal/ModalHeader.astro +12 -0
  81. package/dist/astro/modal/ModalTitle.astro +18 -0
  82. package/dist/astro/modal/index.ts +15 -0
  83. package/dist/astro/modal/modal.ts +101 -0
  84. package/dist/astro/pagination/Pagination.astro +12 -0
  85. package/dist/astro/pagination/PaginationContent.astro +15 -0
  86. package/dist/astro/pagination/PaginationEllipsis.astro +33 -0
  87. package/dist/astro/pagination/PaginationItem.astro +12 -0
  88. package/dist/astro/pagination/PaginationLink.astro +21 -0
  89. package/dist/astro/pagination/PaginationNext.astro +29 -0
  90. package/dist/astro/pagination/PaginationPrevious.astro +34 -0
  91. package/dist/astro/pagination/index.ts +15 -0
  92. package/dist/astro/pagination/paginationVariants.ts +26 -0
  93. package/dist/astro/popover/Popover.astro +17 -0
  94. package/dist/astro/popover/PopoverContent.astro +39 -0
  95. package/dist/astro/popover/index.ts +5 -0
  96. package/dist/astro/popover/popover.ts +113 -0
  97. package/dist/astro/popover/popoverVariants.ts +115 -0
  98. package/dist/astro/progress/Progress.astro +23 -23
  99. package/dist/astro/progress/index.ts +4 -4
  100. package/dist/astro/progress/progressContainer.astro +17 -17
  101. package/dist/astro/radio/Radio.astro +26 -26
  102. package/dist/astro/radio/index.ts +3 -3
  103. package/dist/astro/select/Option.astro +11 -11
  104. package/dist/astro/select/Select.astro +39 -39
  105. package/dist/astro/select/index.ts +5 -5
  106. package/dist/astro/select/selectVariants.ts +30 -30
  107. package/dist/astro/skeleton/Skeleton.astro +12 -12
  108. package/dist/astro/skeleton/SkeletonItem.astro +18 -18
  109. package/dist/astro/skeleton/index.ts +4 -4
  110. package/dist/astro/stat/Stat.astro +12 -0
  111. package/dist/astro/stat/StatDescription.astro +12 -0
  112. package/dist/astro/stat/StatTitle.astro +18 -0
  113. package/dist/astro/stat/StatValue.astro +12 -0
  114. package/dist/astro/stat/index.ts +6 -0
  115. package/dist/astro/switch/Switch.astro +19 -19
  116. package/dist/astro/switch/index.ts +3 -3
  117. package/dist/astro/tab/Tab.astro +33 -0
  118. package/dist/astro/tab/TabContent.astro +19 -0
  119. package/dist/astro/tab/TabList.astro +19 -0
  120. package/dist/astro/tab/TabTrigger.astro +24 -0
  121. package/dist/astro/tab/index.ts +6 -0
  122. package/dist/astro/tab/tab.ts +142 -0
  123. package/dist/astro/textarea/Textarea.astro +19 -19
  124. package/dist/astro/textarea/TextareaVariants.ts +30 -30
  125. package/dist/astro/textarea/index.ts +4 -4
  126. package/dist/astro/tooltip/Tooltip.astro +40 -0
  127. package/dist/astro/tooltip/TooltipContent.astro +39 -0
  128. package/dist/astro/tooltip/index.ts +5 -0
  129. package/dist/astro/tooltip/tooltip.ts +137 -0
  130. package/dist/astro/tooltip/tooltipVariants.ts +115 -0
  131. package/dist/index.js +46 -1
  132. package/dist/index.js.map +1 -1
  133. package/package.json +2 -2
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,19 @@
1
+ ---
2
+ import { cn } from "@/utils/cn";
3
+ import type { HTMLAttributes } from "astro/types";
4
+
5
+ interface Props extends HTMLAttributes<"div"> {
6
+ isOpen?: boolean;
7
+ }
8
+
9
+ const { class: className, isOpen = false, ...attrs } = Astro.props;
10
+ ---
11
+
12
+ <div
13
+ {...attrs}
14
+ data-accordion-item
15
+ data-default-open={isOpen}
16
+ class={cn("border-b border-border last:border-b-0", className)}
17
+ >
18
+ <slot />
19
+ </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,23 @@
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
+ role="region"
13
+ data-accordion-content
14
+ data-state="closed"
15
+ class={cn(
16
+ "overflow-hidden transition-all duration-300 ease-in-out data-[state=closed]:max-h-0",
17
+ className,
18
+ )}
19
+ >
20
+ <div class="pb-4">
21
+ <slot />
22
+ </div>
23
+ </div>
@@ -0,0 +1,151 @@
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
+ const defaultOpenItems = [];
19
+
20
+ this.items?.forEach((item: AccordionItem) => {
21
+ const trigger = item.querySelector<HTMLElement>(
22
+ "[data-accordion-trigger]",
23
+ );
24
+ const content = item.querySelector<HTMLElement>(
25
+ "[data-accordion-content]",
26
+ );
27
+
28
+ if (trigger && content) {
29
+ item.trigger = trigger;
30
+ item.content = content;
31
+
32
+ this.setupAccessibility(item);
33
+ this.setupEventListeners(item);
34
+
35
+ if (item.dataset.defaultOpen === "true") {
36
+ if (
37
+ defaultOpenItems.length > 0 &&
38
+ this.wrapper.dataset.multiple !== "true"
39
+ ) {
40
+ console.warn(
41
+ "Warning! This accordion is not configured to open multiple items by default. " +
42
+ "Only the first item will be opened." +
43
+ "Consider adding the multiple prop to the accordion if you want to allow multiple items to be open by default.",
44
+ );
45
+ return;
46
+ }
47
+
48
+ this.setContentHeight(content);
49
+ this.setState(item, "open");
50
+ defaultOpenItems.push(item);
51
+ }
52
+ }
53
+ });
54
+ }
55
+
56
+ private setupAccessibility(item: AccordionItem) {
57
+ if (item.trigger && item.content) {
58
+ const triggerId =
59
+ item.trigger.id ||
60
+ `accordion-id-${Math.random().toString(36).substring(2, 9)}`;
61
+ const contentId =
62
+ item.content.id ||
63
+ `accordion-id-${Math.random().toString(36).substring(2, 9)}`;
64
+
65
+ item.trigger.id = triggerId;
66
+ item.trigger.setAttribute("aria-controls", contentId);
67
+
68
+ item.content.id = contentId;
69
+ item.content.setAttribute("aria-labelledby", triggerId);
70
+ item.content.setAttribute("role", "region");
71
+
72
+ this.setState(item, "closed");
73
+ }
74
+ }
75
+
76
+ private setupEventListeners(item: AccordionItem) {
77
+ if (!item.trigger && !item.content) return;
78
+
79
+ item.trigger?.addEventListener("click", () =>
80
+ this.toggleAccordionItem(item),
81
+ );
82
+ item.trigger?.addEventListener("keydown", (e) =>
83
+ this.handleKeydown(e, item),
84
+ );
85
+ }
86
+
87
+ private toggleAccordionItem(item: AccordionItem) {
88
+ if (item.trigger?.getAttribute("aria-expanded") === "true") {
89
+ this.closeAccordionItem(item);
90
+ } else {
91
+ if (this.wrapper.dataset.multiple !== "true") {
92
+ this.closeAllContents();
93
+ }
94
+ this.openAccordionItem(item);
95
+ }
96
+ }
97
+
98
+ private openAccordionItem(item: AccordionItem) {
99
+ this.setState(item, "open");
100
+ if (item.content) {
101
+ this.setContentHeight(item.content);
102
+ }
103
+ }
104
+
105
+ private closeAccordionItem(item: AccordionItem) {
106
+ this.setState(item, "closed");
107
+ item.content!.style.maxHeight = "0px";
108
+ }
109
+
110
+ private closeAllContents() {
111
+ this.items?.forEach((item) => {
112
+ this.closeAccordionItem(item);
113
+ });
114
+ }
115
+
116
+ private handleKeydown(event: KeyboardEvent, item: AccordionItem) {
117
+ const items = Array.from(this.items || []);
118
+ const currentItemIndex = items.indexOf(item);
119
+
120
+ const keyActions: Record<string, () => void> = {
121
+ ArrowDown: () => this.setFocusItem(items, currentItemIndex + 1),
122
+ ArrowUp: () => this.setFocusItem(items, currentItemIndex - 1),
123
+ Home: () => this.setFocusItem(items, 0),
124
+ End: () => this.setFocusItem(items, items.length - 1),
125
+ };
126
+
127
+ const action = keyActions[event.key];
128
+ if (action) {
129
+ event.preventDefault();
130
+ action();
131
+ }
132
+ }
133
+
134
+ private setFocusItem(items: AccordionItem[], index: number) {
135
+ const newIndex = (index + items.length) % items.length;
136
+ if (items[newIndex].trigger) {
137
+ items[newIndex].trigger.focus();
138
+ }
139
+ }
140
+
141
+ private setContentHeight(content: HTMLElement) {
142
+ const height = content.scrollHeight + "px";
143
+ content.style.maxHeight = height;
144
+ }
145
+
146
+ private setState(item: AccordionItem, state: "closed" | "open") {
147
+ item.trigger?.setAttribute("data-state", state);
148
+ item.trigger?.setAttribute("aria-expanded", `${state === "open"}`);
149
+ item.content?.setAttribute("data-state", state);
150
+ }
151
+ }
@@ -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
+ />