@starwind-ui/core 1.8.0 → 1.10.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 (151) hide show
  1. package/dist/index.js +50 -23
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/components/accordion/Accordion.astro +8 -2
  4. package/dist/src/components/accordion/AccordionContent.astro +2 -1
  5. package/dist/src/components/accordion/AccordionItem.astro +8 -2
  6. package/dist/src/components/accordion/AccordionTrigger.astro +4 -3
  7. package/dist/src/components/accordion/index.ts +7 -5
  8. package/dist/src/components/alert/Alert.astro +6 -3
  9. package/dist/src/components/alert/AlertDescription.astro +4 -4
  10. package/dist/src/components/alert/AlertTitle.astro +3 -3
  11. package/dist/src/components/alert/index.ts +6 -4
  12. package/dist/src/components/alert-dialog/AlertDialog.astro +273 -0
  13. package/dist/src/components/alert-dialog/AlertDialogAction.astro +44 -0
  14. package/dist/src/components/alert-dialog/AlertDialogCancel.astro +45 -0
  15. package/dist/src/components/alert-dialog/AlertDialogContent.astro +50 -0
  16. package/dist/src/components/alert-dialog/AlertDialogDescription.astro +18 -0
  17. package/dist/src/components/alert-dialog/AlertDialogFooter.astro +16 -0
  18. package/dist/src/components/alert-dialog/AlertDialogHeader.astro +14 -0
  19. package/dist/src/components/alert-dialog/AlertDialogTitle.astro +20 -0
  20. package/dist/src/components/alert-dialog/AlertDialogTrigger.astro +47 -0
  21. package/dist/src/components/alert-dialog/index.ts +46 -0
  22. package/dist/src/components/aspect-ratio/AspectRatio.astro +32 -0
  23. package/dist/src/components/aspect-ratio/index.ts +7 -0
  24. package/dist/src/components/avatar/Avatar.astro +2 -2
  25. package/dist/src/components/avatar/AvatarFallback.astro +2 -2
  26. package/dist/src/components/avatar/AvatarImage.astro +13 -2
  27. package/dist/src/components/avatar/index.ts +6 -4
  28. package/dist/src/components/badge/Badge.astro +15 -12
  29. package/dist/src/components/badge/index.ts +4 -2
  30. package/dist/src/components/breadcrumb/Breadcrumb.astro +1 -1
  31. package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +4 -1
  32. package/dist/src/components/breadcrumb/BreadcrumbItem.astro +2 -2
  33. package/dist/src/components/breadcrumb/BreadcrumbLink.astro +2 -2
  34. package/dist/src/components/breadcrumb/BreadcrumbList.astro +2 -2
  35. package/dist/src/components/breadcrumb/BreadcrumbPage.astro +2 -1
  36. package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +2 -1
  37. package/dist/src/components/breadcrumb/index.ts +16 -6
  38. package/dist/src/components/button/Button.astro +15 -15
  39. package/dist/src/components/button/index.ts +4 -2
  40. package/dist/src/components/card/Card.astro +2 -2
  41. package/dist/src/components/card/CardContent.astro +2 -2
  42. package/dist/src/components/card/CardDescription.astro +2 -2
  43. package/dist/src/components/card/CardFooter.astro +2 -2
  44. package/dist/src/components/card/CardHeader.astro +2 -2
  45. package/dist/src/components/card/CardTitle.astro +2 -2
  46. package/dist/src/components/card/index.ts +16 -7
  47. package/dist/src/components/carousel/Carousel.astro +55 -0
  48. package/dist/src/components/carousel/CarouselContent.astro +26 -0
  49. package/dist/src/components/carousel/CarouselItem.astro +26 -0
  50. package/dist/src/components/carousel/CarouselNext.astro +33 -0
  51. package/dist/src/components/carousel/CarouselPrevious.astro +33 -0
  52. package/dist/src/components/carousel/carousel-script.ts +191 -0
  53. package/dist/src/components/carousel/index.ts +32 -0
  54. package/dist/src/components/checkbox/Checkbox.astro +28 -12
  55. package/dist/src/components/checkbox/index.ts +4 -2
  56. package/dist/src/components/dialog/Dialog.astro +24 -11
  57. package/dist/src/components/dialog/DialogClose.astro +7 -2
  58. package/dist/src/components/dialog/DialogContent.astro +9 -6
  59. package/dist/src/components/dialog/DialogDescription.astro +2 -2
  60. package/dist/src/components/dialog/DialogFooter.astro +2 -2
  61. package/dist/src/components/dialog/DialogHeader.astro +2 -2
  62. package/dist/src/components/dialog/DialogTitle.astro +2 -2
  63. package/dist/src/components/dialog/DialogTrigger.astro +7 -1
  64. package/dist/src/components/dialog/index.ts +20 -5
  65. package/dist/src/components/dropdown/Dropdown.astro +1 -0
  66. package/dist/src/components/dropdown/DropdownContent.astro +2 -1
  67. package/dist/src/components/dropdown/DropdownItem.astro +2 -1
  68. package/dist/src/components/dropdown/DropdownLabel.astro +2 -2
  69. package/dist/src/components/dropdown/DropdownSeparator.astro +3 -2
  70. package/dist/src/components/dropdown/DropdownTrigger.astro +9 -3
  71. package/dist/src/components/dropdown/index.ts +14 -5
  72. package/dist/src/components/dropzone/Dropzone.astro +7 -6
  73. package/dist/src/components/dropzone/DropzoneFilesList.astro +3 -2
  74. package/dist/src/components/dropzone/DropzoneLoadingIndicator.astro +1 -1
  75. package/dist/src/components/dropzone/DropzoneUploadIndicator.astro +1 -1
  76. package/dist/src/components/dropzone/index.ts +14 -3
  77. package/dist/src/components/input/Input.astro +4 -4
  78. package/dist/src/components/input/index.ts +4 -2
  79. package/dist/src/components/item/Item.astro +52 -0
  80. package/dist/src/components/item/ItemActions.astro +16 -0
  81. package/dist/src/components/item/ItemContent.astro +16 -0
  82. package/dist/src/components/item/ItemDescription.astro +19 -0
  83. package/dist/src/components/item/ItemFooter.astro +16 -0
  84. package/dist/src/components/item/ItemGroup.astro +16 -0
  85. package/dist/src/components/item/ItemHeader.astro +16 -0
  86. package/dist/src/components/item/ItemMedia.astro +40 -0
  87. package/dist/src/components/item/ItemSeparator.astro +21 -0
  88. package/dist/src/components/item/ItemTitle.astro +16 -0
  89. package/dist/src/components/item/index.ts +50 -0
  90. package/dist/src/components/label/Label.astro +2 -2
  91. package/dist/src/components/label/index.ts +4 -2
  92. package/dist/src/components/pagination/Pagination.astro +8 -2
  93. package/dist/src/components/pagination/PaginationContent.astro +2 -2
  94. package/dist/src/components/pagination/PaginationEllipsis.astro +7 -2
  95. package/dist/src/components/pagination/PaginationItem.astro +2 -2
  96. package/dist/src/components/pagination/PaginationLink.astro +10 -29
  97. package/dist/src/components/pagination/PaginationNext.astro +2 -1
  98. package/dist/src/components/pagination/PaginationPrevious.astro +2 -1
  99. package/dist/src/components/pagination/index.ts +18 -7
  100. package/dist/src/components/progress/Progress.astro +6 -3
  101. package/dist/src/components/progress/index.ts +7 -2
  102. package/dist/src/components/radio-group/RadioGroup.astro +2 -1
  103. package/dist/src/components/radio-group/RadioGroupItem.astro +17 -15
  104. package/dist/src/components/radio-group/index.ts +16 -3
  105. package/dist/src/components/select/Select.astro +1 -0
  106. package/dist/src/components/select/SelectContent.astro +3 -2
  107. package/dist/src/components/select/SelectGroup.astro +1 -1
  108. package/dist/src/components/select/SelectItem.astro +3 -2
  109. package/dist/src/components/select/SelectLabel.astro +2 -2
  110. package/dist/src/components/select/SelectSeparator.astro +2 -2
  111. package/dist/src/components/select/SelectTrigger.astro +4 -3
  112. package/dist/src/components/select/SelectValue.astro +2 -2
  113. package/dist/src/components/select/index.ts +18 -6
  114. package/dist/src/components/separator/Separator.astro +36 -0
  115. package/dist/src/components/separator/index.ts +7 -0
  116. package/dist/src/components/sheet/Sheet.astro +13 -0
  117. package/dist/src/components/sheet/SheetClose.astro +13 -0
  118. package/dist/src/components/sheet/SheetContent.astro +88 -0
  119. package/dist/src/components/sheet/SheetDescription.astro +16 -0
  120. package/dist/src/components/sheet/SheetFooter.astro +16 -0
  121. package/dist/src/components/sheet/SheetHeader.astro +16 -0
  122. package/dist/src/components/sheet/SheetTitle.astro +16 -0
  123. package/dist/src/components/sheet/SheetTrigger.astro +13 -0
  124. package/dist/src/components/sheet/index.ts +41 -0
  125. package/dist/src/components/skeleton/Skeleton.astro +3 -3
  126. package/dist/src/components/skeleton/index.ts +6 -2
  127. package/dist/src/components/spinner/Spinner.astro +21 -0
  128. package/dist/src/components/spinner/index.ts +7 -0
  129. package/dist/src/components/switch/Switch.astro +16 -13
  130. package/dist/src/components/switch/index.ts +8 -2
  131. package/dist/src/components/table/Table.astro +3 -3
  132. package/dist/src/components/table/TableBody.astro +2 -2
  133. package/dist/src/components/table/TableCaption.astro +2 -2
  134. package/dist/src/components/table/TableCell.astro +2 -2
  135. package/dist/src/components/table/TableFoot.astro +2 -2
  136. package/dist/src/components/table/TableHead.astro +2 -2
  137. package/dist/src/components/table/TableHeader.astro +2 -2
  138. package/dist/src/components/table/TableRow.astro +2 -2
  139. package/dist/src/components/table/index.ts +30 -9
  140. package/dist/src/components/tabs/Tabs.astro +2 -1
  141. package/dist/src/components/tabs/TabsContent.astro +4 -1
  142. package/dist/src/components/tabs/TabsList.astro +9 -3
  143. package/dist/src/components/tabs/TabsTrigger.astro +6 -3
  144. package/dist/src/components/tabs/index.ts +12 -5
  145. package/dist/src/components/textarea/Textarea.astro +4 -4
  146. package/dist/src/components/textarea/index.ts +6 -2
  147. package/dist/src/components/tooltip/Tooltip.astro +2 -1
  148. package/dist/src/components/tooltip/TooltipContent.astro +21 -5
  149. package/dist/src/components/tooltip/TooltipTrigger.astro +1 -1
  150. package/dist/src/components/tooltip/index.ts +8 -3
  151. package/package.json +1 -1
@@ -0,0 +1,45 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ import { ButtonVariants } from "@/components/starwind/button";
6
+
7
+ type Props = HTMLAttributes<"button"> & {
8
+ /**
9
+ * When true, the component will render its child element instead of a button
10
+ */
11
+ asChild?: boolean;
12
+ };
13
+
14
+ const { class: className, asChild = false, ...rest } = Astro.props;
15
+
16
+ // Get the first child element if asChild is true
17
+ let hasChildren = false;
18
+ if (Astro.slots.has("default")) {
19
+ hasChildren = true;
20
+ }
21
+ ---
22
+
23
+ {
24
+ asChild && hasChildren ? (
25
+ <div
26
+ class:list={["starwind-alert-dialog-close", className]}
27
+ data-slot="alert-dialog-cancel"
28
+ data-as-child
29
+ >
30
+ <slot />
31
+ </div>
32
+ ) : (
33
+ <button
34
+ type="button"
35
+ class={ButtonVariants.button({
36
+ variant: "outline",
37
+ class: `starwind-alert-dialog-close ${className}`,
38
+ })}
39
+ data-slot="alert-dialog-cancel"
40
+ {...rest}
41
+ >
42
+ <slot />
43
+ </button>
44
+ )
45
+ }
@@ -0,0 +1,50 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = HTMLAttributes<"dialog"> & {
6
+ /**
7
+ * Open and close animation duration in milliseconds
8
+ */
9
+ animationDuration?: number;
10
+ };
11
+
12
+ export const alertDialogBackdrop = tv({
13
+ base: [
14
+ "starwind-alert-dialog-backdrop fixed inset-0 z-50 hidden bg-black/50",
15
+ "data-[state=open]:animate-in fade-in",
16
+ "data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards fade-out",
17
+ ],
18
+ });
19
+
20
+ export const alertDialogContent = tv({
21
+ base: [
22
+ "bg-background space-y-4 rounded-lg border p-6 shadow-lg sm:max-w-lg",
23
+ "fixed top-[50%] left-[50%] z-50 w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%]",
24
+ "data-[state=open]:animate-in fade-in zoom-in-95 will-change-transform",
25
+ "data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards fade-out zoom-out-95",
26
+ ],
27
+ });
28
+
29
+ const { class: className, animationDuration = 200, ...rest } = Astro.props;
30
+ ---
31
+
32
+ <!-- dialog overlay -->
33
+ <div
34
+ class={alertDialogBackdrop()}
35
+ data-state="closed"
36
+ data-slot="alert-dialog-backdrop"
37
+ style={{ animationDuration: `${animationDuration}ms` }}
38
+ >
39
+ </div>
40
+
41
+ <dialog
42
+ class={alertDialogContent({ class: className })}
43
+ data-state="closed"
44
+ data-slot="alert-dialog-content"
45
+ role="alertdialog"
46
+ {...rest}
47
+ style={{ animationDuration: `${animationDuration}ms` }}
48
+ >
49
+ <slot />
50
+ </dialog>
@@ -0,0 +1,18 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = HTMLAttributes<"p">;
6
+
7
+ export const alertDialogDescription = tv({ base: "text-muted-foreground" });
8
+
9
+ const { class: className, ...rest } = Astro.props;
10
+ ---
11
+
12
+ <p
13
+ class={alertDialogDescription({ class: className })}
14
+ data-slot="alert-dialog-description"
15
+ {...rest}
16
+ >
17
+ <slot />
18
+ </p>
@@ -0,0 +1,16 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = HTMLAttributes<"div">;
6
+
7
+ export const alertDialogFooter = tv({
8
+ base: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
9
+ });
10
+
11
+ const { class: className, ...rest } = Astro.props;
12
+ ---
13
+
14
+ <div class={alertDialogFooter({ class: className })} data-slot="alert-dialog-footer" {...rest}>
15
+ <slot />
16
+ </div>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = HTMLAttributes<"div">;
6
+
7
+ export const alertDialogHeader = tv({ base: "flex flex-col gap-2 text-center sm:text-left" });
8
+
9
+ const { class: className, ...rest } = Astro.props;
10
+ ---
11
+
12
+ <div class={alertDialogHeader({ class: className })} data-slot="alert-dialog-header" {...rest}>
13
+ <slot />
14
+ </div>
@@ -0,0 +1,20 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = Omit<HTMLAttributes<"h2">, "id"> & {
6
+ /**
7
+ * The content to be rendered inside the dialog title
8
+ */
9
+
10
+ children: any;
11
+ };
12
+
13
+ export const alertDialogTitle = tv({ base: "text-xl font-semibold" });
14
+
15
+ const { class: className, ...rest } = Astro.props;
16
+ ---
17
+
18
+ <h2 class={alertDialogTitle({ class: className })} data-slot="alert-dialog-title" {...rest}>
19
+ <slot />
20
+ </h2>
@@ -0,0 +1,47 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+
4
+ type Props = HTMLAttributes<"button"> & {
5
+ /**
6
+ * When true, the component will render its child element with a simple wrapper instead of a button component
7
+ */
8
+ asChild?: boolean;
9
+ /**
10
+ * Optional ID of the dialog to trigger. If not provided and the trigger is inside a Dialog component,
11
+ * it will automatically target that dialog. Required when used outside a Dialog component.
12
+ */
13
+ for?: string;
14
+ };
15
+
16
+ const { class: className, asChild = false, for: dialogFor, ...rest } = Astro.props;
17
+
18
+ // Get the first child element if asChild is true
19
+ let hasChildren = false;
20
+ if (Astro.slots.has("default")) {
21
+ hasChildren = true;
22
+ }
23
+ ---
24
+
25
+ {
26
+ asChild && hasChildren ? (
27
+ <div
28
+ class:list={["starwind-alert-dialog-trigger", className]}
29
+ data-slot="alert-dialog-trigger"
30
+ data-as-child
31
+ data-dialog-for={dialogFor}
32
+ >
33
+ <slot />
34
+ </div>
35
+ ) : (
36
+ <button
37
+ type="button"
38
+ aria-haspopup="dialog"
39
+ class:list={["starwind-alert-dialog-trigger", className]}
40
+ data-slot="alert-dialog-trigger"
41
+ data-dialog-for={dialogFor}
42
+ {...rest}
43
+ >
44
+ <slot />
45
+ </button>
46
+ )
47
+ }
@@ -0,0 +1,46 @@
1
+ import AlertDialog from "./AlertDialog.astro";
2
+ import AlertDialogAction from "./AlertDialogAction.astro";
3
+ import AlertDialogCancel from "./AlertDialogCancel.astro";
4
+ import AlertDialogContent, {
5
+ alertDialogBackdrop,
6
+ alertDialogContent,
7
+ } from "./AlertDialogContent.astro";
8
+ import AlertDialogDescription, { alertDialogDescription } from "./AlertDialogDescription.astro";
9
+ import AlertDialogFooter, { alertDialogFooter } from "./AlertDialogFooter.astro";
10
+ import AlertDialogHeader, { alertDialogHeader } from "./AlertDialogHeader.astro";
11
+ import AlertDialogTitle, { alertDialogTitle } from "./AlertDialogTitle.astro";
12
+ import AlertDialogTrigger from "./AlertDialogTrigger.astro";
13
+
14
+ const AlertDialogVariants = {
15
+ alertDialogBackdrop,
16
+ alertDialogContent,
17
+ alertDialogDescription,
18
+ alertDialogFooter,
19
+ alertDialogHeader,
20
+ alertDialogTitle,
21
+ };
22
+
23
+ export {
24
+ AlertDialog,
25
+ AlertDialogAction,
26
+ AlertDialogCancel,
27
+ AlertDialogContent,
28
+ AlertDialogDescription,
29
+ AlertDialogFooter,
30
+ AlertDialogHeader,
31
+ AlertDialogTitle,
32
+ AlertDialogTrigger,
33
+ AlertDialogVariants,
34
+ };
35
+
36
+ export default {
37
+ Root: AlertDialog,
38
+ Trigger: AlertDialogTrigger,
39
+ Content: AlertDialogContent,
40
+ Header: AlertDialogHeader,
41
+ Footer: AlertDialogFooter,
42
+ Title: AlertDialogTitle,
43
+ Description: AlertDialogDescription,
44
+ Action: AlertDialogAction,
45
+ Cancel: AlertDialogCancel,
46
+ };
@@ -0,0 +1,32 @@
1
+ ---
2
+ import type { HTMLTag, Polymorphic } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> & {
6
+ /**
7
+ * The aspect ratio of the container (e.g., 16/9, 4/3, 1)
8
+ * @default 1
9
+ */
10
+ ratio?: number;
11
+ };
12
+
13
+ export const aspectRatioWrapper = tv({
14
+ base: "relative w-full",
15
+ });
16
+
17
+ export const aspectRatio = tv({
18
+ base: "absolute inset-0",
19
+ });
20
+
21
+ const { ratio = 1, class: className, as: Tag = "div", ...rest } = Astro.props;
22
+ ---
23
+
24
+ <div
25
+ class={aspectRatioWrapper()}
26
+ style={`padding-bottom: ${100 / ratio}%`}
27
+ data-slot="aspect-ratio-wrapper"
28
+ >
29
+ <Tag class={aspectRatio({ class: className })} data-slot="aspect-ratio" {...rest}>
30
+ <slot />
31
+ </Tag>
32
+ </div>
@@ -0,0 +1,7 @@
1
+ import AspectRatio, { aspectRatio, aspectRatioWrapper } from "./AspectRatio.astro";
2
+
3
+ const AspectRatioVariants = { aspectRatio, aspectRatioWrapper };
4
+
5
+ export { AspectRatio, AspectRatioVariants };
6
+
7
+ export default AspectRatio;
@@ -4,7 +4,7 @@ import { tv, type VariantProps } from "tailwind-variants";
4
4
 
5
5
  interface Props extends HTMLAttributes<"div">, VariantProps<typeof avatar> {}
6
6
 
7
- const avatar = tv({
7
+ export const avatar = tv({
8
8
  base: "text-foreground bg-muted relative overflow-hidden rounded-full border-2",
9
9
  variants: {
10
10
  variant: {
@@ -24,6 +24,6 @@ const avatar = tv({
24
24
  const { variant, size, class: className, ...rest } = Astro.props;
25
25
  ---
26
26
 
27
- <figure class={avatar({ variant, size, class: className })} {...rest}>
27
+ <figure class={avatar({ variant, size, class: className })} data-slot="avatar" {...rest}>
28
28
  <slot />
29
29
  </figure>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import { tv } from "tailwind-variants";
3
3
 
4
- const avatarFallback = tv({
4
+ export const avatarFallback = tv({
5
5
  base: "absolute inset-0.5 flex items-center justify-center rounded-full font-medium",
6
6
  });
7
7
 
@@ -12,6 +12,6 @@ interface Props {
12
12
  const { class: className } = Astro.props;
13
13
  ---
14
14
 
15
- <div class={avatarFallback({ class: className })}>
15
+ <div class={avatarFallback({ class: className })} data-slot="avatar-fallback">
16
16
  <slot />
17
17
  </div>
@@ -2,7 +2,7 @@
2
2
  import { Image } from "astro:assets";
3
3
  import { tv } from "tailwind-variants";
4
4
 
5
- const avatarImage = tv({ base: "relative z-1 h-full w-full object-cover" });
5
+ export const avatarImage = tv({ base: "relative z-1 h-full w-full object-cover" });
6
6
 
7
7
  type BaseProps = { alt: string; class?: string };
8
8
 
@@ -29,7 +29,18 @@ if (!src && !image) {
29
29
  width={64}
30
30
  height={64}
31
31
  onerror="this.style.display='none'"
32
+ data-slot="avatar-image"
33
+ />
34
+ )
35
+ }
36
+ {
37
+ image && (
38
+ <Image
39
+ src={image}
40
+ alt={alt}
41
+ class={avatarImage({ class: className })}
42
+ width={64}
43
+ data-slot="avatar-image"
32
44
  />
33
45
  )
34
46
  }
35
- {image && <Image src={image} alt={alt} class={avatarImage({ class: className })} width={64} />}
@@ -1,8 +1,10 @@
1
- import Avatar from "./Avatar.astro";
2
- import AvatarFallback from "./AvatarFallback.astro";
3
- import AvatarImage from "./AvatarImage.astro";
1
+ import Avatar, { avatar } from "./Avatar.astro";
2
+ import AvatarFallback, { avatarFallback } from "./AvatarFallback.astro";
3
+ import AvatarImage, { avatarImage } from "./AvatarImage.astro";
4
4
 
5
- export { Avatar, AvatarFallback, AvatarImage };
5
+ const AvatarVariants = { avatar, avatarFallback, avatarImage };
6
+
7
+ export { Avatar, AvatarFallback, AvatarImage, AvatarVariants };
6
8
 
7
9
  export default {
8
10
  Root: Avatar,
@@ -7,19 +7,22 @@ interface Props
7
7
  Omit<HTMLAttributes<"a">, "type">,
8
8
  VariantProps<typeof badge> {}
9
9
 
10
- const badge = tv({
11
- base: "starwind-badge starwind-transition-colors inline-flex items-center rounded-full font-semibold focus-visible:outline-2 focus-visible:outline-offset-2",
10
+ export const badge = tv({
11
+ base: [
12
+ "starwind-badge inline-flex items-center rounded-full font-semibold",
13
+ "transition-all outline-none focus-visible:ring-3",
14
+ ],
12
15
  variants: {
13
16
  variant: {
14
- default: "bg-foreground text-background",
15
- primary: "bg-primary text-primary-foreground focus-visible:outline-primary",
16
- secondary: "bg-secondary text-secondary-foreground focus-visible:outline-secondary",
17
- outline: "border-border focus-visible:outline-outline border",
18
- ghost: "bg-foreground/10 text-foreground focus-visible:outline-outline",
19
- info: "bg-info text-info-foreground focus-visible:outline-info",
20
- success: "bg-success text-success-foreground focus-visible:outline-success",
21
- warning: "bg-warning text-warning-foreground focus-visible:outline-warning",
22
- error: "bg-error text-error-foreground focus-visible:outline-error",
17
+ default: "bg-foreground text-background focus-visible:ring-outline/50",
18
+ primary: "bg-primary text-primary-foreground focus-visible:ring-primary/50",
19
+ secondary: "bg-secondary text-secondary-foreground focus-visible:ring-secondary/50",
20
+ outline: "border-border focus-visible:border-outline focus-visible:ring-outline/50 border",
21
+ ghost: "bg-foreground/10 text-foreground focus-visible:ring-outline/50",
22
+ info: "bg-info text-info-foreground focus-visible:ring-info/50",
23
+ success: "bg-success text-success-foreground focus-visible:ring-success/50",
24
+ warning: "bg-warning text-warning-foreground focus-visible:ring-warning/50",
25
+ error: "bg-error text-error-foreground focus-visible:ring-error/50",
23
26
  },
24
27
  size: { sm: "px-2.5 py-0.5 text-xs", md: "px-3 py-0.5 text-sm", lg: "px-4 py-1 text-base" },
25
28
  isLink: { true: "cursor-pointer", false: "" },
@@ -43,6 +46,6 @@ const isLink = Astro.props.href ? true : false;
43
46
  const Tag = Astro.props.href ? "a" : "div";
44
47
  ---
45
48
 
46
- <Tag class={badge({ variant, size, isLink, class: className })} {...rest}>
49
+ <Tag class={badge({ variant, size, isLink, class: className })} data-slot="badge" {...rest}>
47
50
  <slot />
48
51
  </Tag>
@@ -1,5 +1,7 @@
1
- import Badge from "./Badge.astro";
1
+ import Badge, { badge } from "./Badge.astro";
2
2
 
3
- export { Badge };
3
+ const BadgeVariants = { badge };
4
+
5
+ export { Badge, BadgeVariants };
4
6
 
5
7
  export default Badge;
@@ -6,6 +6,6 @@ type Props = HTMLAttributes<"nav">;
6
6
  const { class: className, ...rest } = Astro.props;
7
7
  ---
8
8
 
9
- <nav aria-label="breadcrumb" class={className} {...rest}>
9
+ <nav aria-label="breadcrumb" class={className} data-slot="breadcrumb" {...rest}>
10
10
  <slot />
11
11
  </nav>
@@ -5,7 +5,9 @@ import { tv } from "tailwind-variants";
5
5
 
6
6
  type Props = HTMLAttributes<"span">;
7
7
 
8
- const breadcrumbEllipsis = tv({ base: "flex size-6 items-center justify-center [&>svg]:size-4" });
8
+ export const breadcrumbEllipsis = tv({
9
+ base: "flex size-6 items-center justify-center [&>svg]:size-4",
10
+ });
9
11
 
10
12
  const { class: className, ...rest } = Astro.props;
11
13
  ---
@@ -14,6 +16,7 @@ const { class: className, ...rest } = Astro.props;
14
16
  role="presentation"
15
17
  aria-hidden="true"
16
18
  class={breadcrumbEllipsis({ class: className })}
19
+ data-slot="breadcrumb-ellipsis"
17
20
  {...rest}
18
21
  >
19
22
  <Dots />
@@ -4,11 +4,11 @@ import { tv } from "tailwind-variants";
4
4
 
5
5
  type Props = HTMLAttributes<"li">;
6
6
 
7
- const breadcrumbItem = tv({ base: "inline-flex items-center gap-1.5" });
7
+ export const breadcrumbItem = tv({ base: "inline-flex items-center gap-1.5" });
8
8
 
9
9
  const { class: className, ...rest } = Astro.props;
10
10
  ---
11
11
 
12
- <li class={breadcrumbItem({ class: className })} {...rest}>
12
+ <li class={breadcrumbItem({ class: className })} data-slot="breadcrumb-item" {...rest}>
13
13
  <slot />
14
14
  </li>
@@ -6,7 +6,7 @@ type Props = HTMLAttributes<"a"> & {
6
6
  asChild?: boolean;
7
7
  };
8
8
 
9
- const breadcrumbLink = tv({ base: "hover:text-foreground transition-colors" });
9
+ export const breadcrumbLink = tv({ base: "hover:text-foreground transition-colors" });
10
10
 
11
11
  const { class: className, asChild = false, ...rest } = Astro.props;
12
12
  ---
@@ -15,7 +15,7 @@ const { class: className, asChild = false, ...rest } = Astro.props;
15
15
  asChild ? (
16
16
  <slot />
17
17
  ) : (
18
- <a class={breadcrumbLink({ class: className })} {...rest}>
18
+ <a class={breadcrumbLink({ class: className })} data-slot="breadcrumb-link" {...rest}>
19
19
  <slot />
20
20
  </a>
21
21
  )
@@ -4,13 +4,13 @@ import { tv } from "tailwind-variants";
4
4
 
5
5
  type Props = HTMLAttributes<"ol">;
6
6
 
7
- const breadcrumbList = tv({
7
+ export const breadcrumbList = tv({
8
8
  base: "text-muted-foreground flex flex-wrap items-center gap-1.5 break-words sm:gap-2",
9
9
  });
10
10
 
11
11
  const { class: className, ...rest } = Astro.props;
12
12
  ---
13
13
 
14
- <ol class={breadcrumbList({ class: className })} {...rest}>
14
+ <ol class={breadcrumbList({ class: className })} data-slot="breadcrumb-list" {...rest}>
15
15
  <slot />
16
16
  </ol>
@@ -4,7 +4,7 @@ import { tv } from "tailwind-variants";
4
4
 
5
5
  type Props = HTMLAttributes<"span">;
6
6
 
7
- const breadcrumbPage = tv({ base: "text-foreground font-normal" });
7
+ export const breadcrumbPage = tv({ base: "text-foreground font-normal" });
8
8
 
9
9
  const { class: className, ...rest } = Astro.props;
10
10
  ---
@@ -14,6 +14,7 @@ const { class: className, ...rest } = Astro.props;
14
14
  aria-disabled="true"
15
15
  aria-current="page"
16
16
  class={breadcrumbPage({ class: className })}
17
+ data-slot="breadcrumb-page"
17
18
  {...rest}
18
19
  >
19
20
  <slot />
@@ -5,7 +5,7 @@ import { tv } from "tailwind-variants";
5
5
 
6
6
  type Props = HTMLAttributes<"li">;
7
7
 
8
- const breadcrumbSeparator = tv({ base: "[&>svg]:size-4" });
8
+ export const breadcrumbSeparator = tv({ base: "[&>svg]:size-4" });
9
9
 
10
10
  const { class: className, ...rest } = Astro.props;
11
11
  ---
@@ -14,6 +14,7 @@ const { class: className, ...rest } = Astro.props;
14
14
  role="presentation"
15
15
  aria-hidden="true"
16
16
  class={breadcrumbSeparator({ class: className })}
17
+ data-slot="breadcrumb-separator"
17
18
  {...rest}
18
19
  >
19
20
  <slot>
@@ -1,10 +1,19 @@
1
1
  import Breadcrumb from "./Breadcrumb.astro";
2
- import BreadcrumbEllipsis from "./BreadcrumbEllipsis.astro";
3
- import BreadcrumbItem from "./BreadcrumbItem.astro";
4
- import BreadcrumbLink from "./BreadcrumbLink.astro";
5
- import BreadcrumbList from "./BreadcrumbList.astro";
6
- import BreadcrumbPage from "./BreadcrumbPage.astro";
7
- import BreadcrumbSeparator from "./BreadcrumbSeparator.astro";
2
+ import BreadcrumbEllipsis, { breadcrumbEllipsis } from "./BreadcrumbEllipsis.astro";
3
+ import BreadcrumbItem, { breadcrumbItem } from "./BreadcrumbItem.astro";
4
+ import BreadcrumbLink, { breadcrumbLink } from "./BreadcrumbLink.astro";
5
+ import BreadcrumbList, { breadcrumbList } from "./BreadcrumbList.astro";
6
+ import BreadcrumbPage, { breadcrumbPage } from "./BreadcrumbPage.astro";
7
+ import BreadcrumbSeparator, { breadcrumbSeparator } from "./BreadcrumbSeparator.astro";
8
+
9
+ const BreadcrumbVariants = {
10
+ breadcrumbEllipsis,
11
+ breadcrumbItem,
12
+ breadcrumbLink,
13
+ breadcrumbList,
14
+ breadcrumbPage,
15
+ breadcrumbSeparator,
16
+ };
8
17
 
9
18
  export {
10
19
  Breadcrumb,
@@ -14,6 +23,7 @@ export {
14
23
  BreadcrumbList,
15
24
  BreadcrumbPage,
16
25
  BreadcrumbSeparator,
26
+ BreadcrumbVariants,
17
27
  };
18
28
 
19
29
  export default {
@@ -9,37 +9,37 @@ interface Props
9
9
 
10
10
  const { variant, size, class: className, ...rest } = Astro.props;
11
11
 
12
- const button = tv({
12
+ export const button = tv({
13
13
  base: [
14
14
  "inline-flex items-center justify-center gap-1.5 rounded-md font-medium whitespace-nowrap",
15
15
  "[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
16
- "starwind-transition-colors",
17
- "focus-visible:outline-2 focus-visible:outline-offset-2",
16
+ "transition-all outline-none focus-visible:ring-3",
18
17
  "disabled:pointer-events-none disabled:opacity-50",
19
18
  ],
20
19
  variants: {
21
20
  variant: {
22
- default: "bg-foreground text-background hover:bg-foreground/90 focus-visible:outline-outline",
21
+ default: "bg-foreground text-background hover:bg-foreground/90 focus-visible:ring-outline/50",
23
22
  primary:
24
- "bg-primary text-primary-foreground hover:bg-primary/90 focus-visible:outline-primary",
23
+ "bg-primary text-primary-foreground hover:bg-primary/90 focus-visible:ring-primary/50",
25
24
  secondary:
26
- "bg-secondary text-secondary-foreground hover:bg-secondary/90 focus-visible:outline-secondary",
25
+ "bg-secondary text-secondary-foreground hover:bg-secondary/90 focus-visible:ring-secondary/50",
27
26
  outline:
28
- "border-border hover:bg-border hover:text-foreground focus-visible:outline-outline border",
29
- ghost:
30
- "hover:bg-foreground/10 hover:text-foreground focus-visible:outline-outline bg-transparent",
31
- info: "bg-info text-info-foreground hover:bg-info/90 focus-visible:outline-info",
27
+ "dark:border-input focus-visible:ring-outline/50 bg-background dark:bg-input/30 focus-visible:border-outline hover:bg-muted dark:hover:bg-input/50 hover:text-foreground border shadow-xs",
28
+ ghost: "hover:bg-muted hover:text-foreground focus-visible:ring-outline/50",
29
+ info: "bg-info text-info-foreground hover:bg-info/90 focus-visible:ring-info/50",
32
30
  success:
33
- "bg-success text-success-foreground hover:bg-success/90 focus-visible:outline-success",
31
+ "bg-success text-success-foreground hover:bg-success/90 focus-visible:ring-success/50",
34
32
  warning:
35
- "bg-warning text-warning-foreground hover:bg-warning/90 focus-visible:outline-warning",
36
- error: "bg-error text-error-foreground hover:bg-error/90 focus-visible:outline-error",
33
+ "bg-warning text-warning-foreground hover:bg-warning/90 focus-visible:ring-warning/50",
34
+ error: "bg-error text-error-foreground hover:bg-error/90 focus-visible:ring-error/50",
37
35
  },
38
36
  size: {
39
37
  sm: "h-9 px-3 py-2 text-sm",
40
38
  md: "h-11 px-4 py-2 text-base",
41
39
  lg: "h-12 px-8 py-2 text-lg",
42
- icon: "h-11 w-11",
40
+ icon: "size-11",
41
+ "icon-sm": "size-9",
42
+ "icon-lg": "size-12",
43
43
  },
44
44
  },
45
45
  defaultVariants: { variant: "default", size: "md" },
@@ -48,6 +48,6 @@ const button = tv({
48
48
  const Tag = Astro.props.href ? "a" : "button";
49
49
  ---
50
50
 
51
- <Tag class={button({ variant, size, class: className })} {...rest}>
51
+ <Tag class={button({ variant, size, class: className })} data-slot="button" {...rest}>
52
52
  <slot />
53
53
  </Tag>
@@ -1,5 +1,7 @@
1
- import Button from "./Button.astro";
1
+ import Button, { button } from "./Button.astro";
2
2
 
3
- export { Button };
3
+ const ButtonVariants = { button };
4
+
5
+ export { Button, ButtonVariants };
4
6
 
5
7
  export default Button;