@starwind-ui/core 1.14.0 → 1.15.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.
Files changed (179) hide show
  1. package/package.json +1 -1
  2. package/dist/index.d.ts +0 -28
  3. package/dist/index.js +0 -85
  4. package/dist/index.js.map +0 -1
  5. package/dist/src/components/accordion/Accordion.astro +0 -254
  6. package/dist/src/components/accordion/AccordionContent.astro +0 -33
  7. package/dist/src/components/accordion/AccordionItem.astro +0 -27
  8. package/dist/src/components/accordion/AccordionTrigger.astro +0 -32
  9. package/dist/src/components/accordion/index.ts +0 -15
  10. package/dist/src/components/alert/Alert.astro +0 -31
  11. package/dist/src/components/alert/AlertDescription.astro +0 -14
  12. package/dist/src/components/alert/AlertTitle.astro +0 -16
  13. package/dist/src/components/alert/index.ts +0 -13
  14. package/dist/src/components/alert-dialog/AlertDialog.astro +0 -275
  15. package/dist/src/components/alert-dialog/AlertDialogAction.astro +0 -44
  16. package/dist/src/components/alert-dialog/AlertDialogCancel.astro +0 -45
  17. package/dist/src/components/alert-dialog/AlertDialogContent.astro +0 -52
  18. package/dist/src/components/alert-dialog/AlertDialogDescription.astro +0 -18
  19. package/dist/src/components/alert-dialog/AlertDialogFooter.astro +0 -16
  20. package/dist/src/components/alert-dialog/AlertDialogHeader.astro +0 -14
  21. package/dist/src/components/alert-dialog/AlertDialogTitle.astro +0 -20
  22. package/dist/src/components/alert-dialog/AlertDialogTrigger.astro +0 -47
  23. package/dist/src/components/alert-dialog/index.ts +0 -46
  24. package/dist/src/components/aspect-ratio/AspectRatio.astro +0 -32
  25. package/dist/src/components/aspect-ratio/index.ts +0 -7
  26. package/dist/src/components/avatar/Avatar.astro +0 -29
  27. package/dist/src/components/avatar/AvatarFallback.astro +0 -18
  28. package/dist/src/components/avatar/AvatarImage.astro +0 -49
  29. package/dist/src/components/avatar/index.ts +0 -13
  30. package/dist/src/components/badge/Badge.astro +0 -49
  31. package/dist/src/components/badge/index.ts +0 -7
  32. package/dist/src/components/breadcrumb/Breadcrumb.astro +0 -11
  33. package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +0 -28
  34. package/dist/src/components/breadcrumb/BreadcrumbItem.astro +0 -14
  35. package/dist/src/components/breadcrumb/BreadcrumbLink.astro +0 -22
  36. package/dist/src/components/breadcrumb/BreadcrumbList.astro +0 -16
  37. package/dist/src/components/breadcrumb/BreadcrumbPage.astro +0 -21
  38. package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +0 -23
  39. package/dist/src/components/breadcrumb/index.ts +0 -37
  40. package/dist/src/components/button/Button.astro +0 -54
  41. package/dist/src/components/button/index.ts +0 -7
  42. package/dist/src/components/button-group/ButtonGroup.astro +0 -62
  43. package/dist/src/components/button-group/ButtonGroupSeparator.astro +0 -27
  44. package/dist/src/components/button-group/ButtonGroupText.astro +0 -19
  45. package/dist/src/components/button-group/index.ts +0 -17
  46. package/dist/src/components/card/Card.astro +0 -14
  47. package/dist/src/components/card/CardContent.astro +0 -14
  48. package/dist/src/components/card/CardDescription.astro +0 -14
  49. package/dist/src/components/card/CardFooter.astro +0 -14
  50. package/dist/src/components/card/CardHeader.astro +0 -14
  51. package/dist/src/components/card/CardTitle.astro +0 -14
  52. package/dist/src/components/card/index.ts +0 -26
  53. package/dist/src/components/carousel/Carousel.astro +0 -55
  54. package/dist/src/components/carousel/CarouselContent.astro +0 -26
  55. package/dist/src/components/carousel/CarouselItem.astro +0 -26
  56. package/dist/src/components/carousel/CarouselNext.astro +0 -37
  57. package/dist/src/components/carousel/CarouselPrevious.astro +0 -37
  58. package/dist/src/components/carousel/carousel-script.ts +0 -191
  59. package/dist/src/components/carousel/index.ts +0 -32
  60. package/dist/src/components/checkbox/Checkbox.astro +0 -128
  61. package/dist/src/components/checkbox/index.ts +0 -7
  62. package/dist/src/components/dialog/Dialog.astro +0 -355
  63. package/dist/src/components/dialog/DialogClose.astro +0 -35
  64. package/dist/src/components/dialog/DialogContent.astro +0 -78
  65. package/dist/src/components/dialog/DialogDescription.astro +0 -14
  66. package/dist/src/components/dialog/DialogFooter.astro +0 -14
  67. package/dist/src/components/dialog/DialogHeader.astro +0 -14
  68. package/dist/src/components/dialog/DialogTitle.astro +0 -22
  69. package/dist/src/components/dialog/DialogTrigger.astro +0 -47
  70. package/dist/src/components/dialog/index.ts +0 -45
  71. package/dist/src/components/dropdown/Dropdown.astro +0 -377
  72. package/dist/src/components/dropdown/DropdownContent.astro +0 -81
  73. package/dist/src/components/dropdown/DropdownItem.astro +0 -48
  74. package/dist/src/components/dropdown/DropdownLabel.astro +0 -29
  75. package/dist/src/components/dropdown/DropdownSeparator.astro +0 -21
  76. package/dist/src/components/dropdown/DropdownTrigger.astro +0 -52
  77. package/dist/src/components/dropdown/index.ts +0 -33
  78. package/dist/src/components/dropzone/Dropzone.astro +0 -236
  79. package/dist/src/components/dropzone/DropzoneFilesList.astro +0 -26
  80. package/dist/src/components/dropzone/DropzoneLoadingIndicator.astro +0 -10
  81. package/dist/src/components/dropzone/DropzoneUploadIndicator.astro +0 -10
  82. package/dist/src/components/dropzone/index.ts +0 -24
  83. package/dist/src/components/image/Image.astro +0 -24
  84. package/dist/src/components/image/index.ts +0 -9
  85. package/dist/src/components/input/Input.astro +0 -25
  86. package/dist/src/components/input/index.ts +0 -7
  87. package/dist/src/components/item/Item.astro +0 -52
  88. package/dist/src/components/item/ItemActions.astro +0 -16
  89. package/dist/src/components/item/ItemContent.astro +0 -16
  90. package/dist/src/components/item/ItemDescription.astro +0 -19
  91. package/dist/src/components/item/ItemFooter.astro +0 -16
  92. package/dist/src/components/item/ItemGroup.astro +0 -16
  93. package/dist/src/components/item/ItemHeader.astro +0 -16
  94. package/dist/src/components/item/ItemMedia.astro +0 -40
  95. package/dist/src/components/item/ItemSeparator.astro +0 -21
  96. package/dist/src/components/item/ItemTitle.astro +0 -16
  97. package/dist/src/components/item/index.ts +0 -50
  98. package/dist/src/components/kbd/Kbd.astro +0 -21
  99. package/dist/src/components/kbd/KbdGroup.astro +0 -16
  100. package/dist/src/components/kbd/index.ts +0 -11
  101. package/dist/src/components/label/Label.astro +0 -22
  102. package/dist/src/components/label/index.ts +0 -7
  103. package/dist/src/components/pagination/Pagination.astro +0 -20
  104. package/dist/src/components/pagination/PaginationContent.astro +0 -16
  105. package/dist/src/components/pagination/PaginationEllipsis.astro +0 -35
  106. package/dist/src/components/pagination/PaginationItem.astro +0 -16
  107. package/dist/src/components/pagination/PaginationLink.astro +0 -24
  108. package/dist/src/components/pagination/PaginationNext.astro +0 -30
  109. package/dist/src/components/pagination/PaginationPrevious.astro +0 -30
  110. package/dist/src/components/pagination/index.ts +0 -38
  111. package/dist/src/components/progress/Progress.astro +0 -155
  112. package/dist/src/components/progress/index.ts +0 -10
  113. package/dist/src/components/radio-group/RadioGroup.astro +0 -162
  114. package/dist/src/components/radio-group/RadioGroupItem.astro +0 -129
  115. package/dist/src/components/radio-group/RadioGroupTypes.ts +0 -6
  116. package/dist/src/components/radio-group/index.ts +0 -23
  117. package/dist/src/components/select/Select.astro +0 -751
  118. package/dist/src/components/select/SelectContent.astro +0 -94
  119. package/dist/src/components/select/SelectGroup.astro +0 -9
  120. package/dist/src/components/select/SelectItem.astro +0 -51
  121. package/dist/src/components/select/SelectLabel.astro +0 -14
  122. package/dist/src/components/select/SelectSearch.astro +0 -49
  123. package/dist/src/components/select/SelectSeparator.astro +0 -12
  124. package/dist/src/components/select/SelectTrigger.astro +0 -54
  125. package/dist/src/components/select/SelectTypes.ts +0 -13
  126. package/dist/src/components/select/SelectValue.astro +0 -19
  127. package/dist/src/components/select/index.ts +0 -49
  128. package/dist/src/components/separator/Separator.astro +0 -36
  129. package/dist/src/components/separator/index.ts +0 -7
  130. package/dist/src/components/sheet/Sheet.astro +0 -13
  131. package/dist/src/components/sheet/SheetClose.astro +0 -13
  132. package/dist/src/components/sheet/SheetContent.astro +0 -92
  133. package/dist/src/components/sheet/SheetDescription.astro +0 -16
  134. package/dist/src/components/sheet/SheetFooter.astro +0 -16
  135. package/dist/src/components/sheet/SheetHeader.astro +0 -16
  136. package/dist/src/components/sheet/SheetTitle.astro +0 -16
  137. package/dist/src/components/sheet/SheetTrigger.astro +0 -13
  138. package/dist/src/components/sheet/index.ts +0 -41
  139. package/dist/src/components/skeleton/Skeleton.astro +0 -14
  140. package/dist/src/components/skeleton/index.ts +0 -9
  141. package/dist/src/components/slider/Slider.astro +0 -411
  142. package/dist/src/components/slider/index.ts +0 -9
  143. package/dist/src/components/spinner/Spinner.astro +0 -21
  144. package/dist/src/components/spinner/index.ts +0 -7
  145. package/dist/src/components/switch/Switch.astro +0 -192
  146. package/dist/src/components/switch/SwitchTypes.ts +0 -6
  147. package/dist/src/components/switch/index.ts +0 -12
  148. package/dist/src/components/table/Table.astro +0 -18
  149. package/dist/src/components/table/TableBody.astro +0 -16
  150. package/dist/src/components/table/TableCaption.astro +0 -16
  151. package/dist/src/components/table/TableCell.astro +0 -16
  152. package/dist/src/components/table/TableFoot.astro +0 -16
  153. package/dist/src/components/table/TableHead.astro +0 -16
  154. package/dist/src/components/table/TableHeader.astro +0 -16
  155. package/dist/src/components/table/TableRow.astro +0 -16
  156. package/dist/src/components/table/index.ts +0 -42
  157. package/dist/src/components/tabs/Tabs.astro +0 -271
  158. package/dist/src/components/tabs/TabsContent.astro +0 -28
  159. package/dist/src/components/tabs/TabsList.astro +0 -22
  160. package/dist/src/components/tabs/TabsTrigger.astro +0 -34
  161. package/dist/src/components/tabs/index.ts +0 -20
  162. package/dist/src/components/textarea/Textarea.astro +0 -29
  163. package/dist/src/components/textarea/index.ts +0 -9
  164. package/dist/src/components/toast/ToastDescription.astro +0 -21
  165. package/dist/src/components/toast/ToastItem.astro +0 -54
  166. package/dist/src/components/toast/ToastTemplate.astro +0 -25
  167. package/dist/src/components/toast/ToastTitle.astro +0 -57
  168. package/dist/src/components/toast/Toaster.astro +0 -982
  169. package/dist/src/components/toast/index.ts +0 -29
  170. package/dist/src/components/toast/toast-manager.ts +0 -216
  171. package/dist/src/components/toggle/Toggle.astro +0 -174
  172. package/dist/src/components/toggle/ToggleTypes.ts +0 -14
  173. package/dist/src/components/toggle/index.ts +0 -8
  174. package/dist/src/components/tooltip/Tooltip.astro +0 -239
  175. package/dist/src/components/tooltip/TooltipContent.astro +0 -114
  176. package/dist/src/components/tooltip/TooltipTrigger.astro +0 -10
  177. package/dist/src/components/tooltip/index.ts +0 -16
  178. package/dist/src/components/video/Video.astro +0 -120
  179. package/dist/src/components/video/index.ts +0 -9
@@ -1,55 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { type EmblaOptionsType } from "embla-carousel";
4
- import { tv } from "tailwind-variants";
5
-
6
- const carousel = tv({
7
- base: "starwind-carousel group/carousel relative",
8
- });
9
-
10
- export interface Props extends HTMLAttributes<"div"> {
11
- orientation?: "horizontal" | "vertical";
12
- opts?: EmblaOptionsType;
13
- autoInit?: boolean;
14
- }
15
-
16
- const {
17
- class: className,
18
- orientation = "horizontal",
19
- opts = {},
20
- autoInit = true,
21
- ...rest
22
- } = Astro.props;
23
- ---
24
-
25
- <div
26
- class={carousel({ class: className })}
27
- role="region"
28
- aria-roledescription="carousel"
29
- data-slot="carousel"
30
- data-axis={orientation === "horizontal" ? "x" : "y"}
31
- data-opts={JSON.stringify(opts)}
32
- data-auto-init={autoInit}
33
- {...rest}
34
- >
35
- <slot />
36
- </div>
37
-
38
- <script>
39
- import { initCarousel } from "./index";
40
-
41
- const setupCarousels = () => {
42
- const carousels = document.querySelectorAll(".starwind-carousel") as NodeListOf<HTMLElement>;
43
- carousels.forEach((carousel) => {
44
- if (carousel.dataset.autoInit === "false") {
45
- return;
46
- }
47
- initCarousel(carousel);
48
- });
49
- };
50
-
51
- document.addEventListener("DOMContentLoaded", setupCarousels);
52
-
53
- // Re-initialize after Astro page transitions
54
- document.addEventListener("astro:after-swap", setupCarousels);
55
- </script>
@@ -1,26 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- const carouselContent = tv({
6
- base: "overflow-hidden",
7
- });
8
-
9
- const carouselContainer = tv({
10
- base: [
11
- "flex group-data-[axis=y]/carousel:flex-col",
12
- "group-data-[axis=x]/carousel:-ml-4",
13
- "group-data-[axis=y]/carousel:-mt-4",
14
- ],
15
- });
16
-
17
- type Props = HTMLAttributes<"div">;
18
-
19
- const { class: className = "", ...rest } = Astro.props;
20
- ---
21
-
22
- <div class={carouselContent()} data-slot="carousel-content" {...rest}>
23
- <div class={carouselContainer({ class: className })} data-slot="carousel-container">
24
- <slot />
25
- </div>
26
- </div>
@@ -1,26 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- const carouselItem = tv({
6
- base: [
7
- "min-w-0 shrink-0 grow-0 basis-full",
8
- "group-data-[axis=x]/carousel:pl-4",
9
- "group-data-[axis=y]/carousel:pt-4",
10
- ],
11
- });
12
-
13
- type Props = HTMLAttributes<"div">;
14
-
15
- const { class: className = "", ...rest } = Astro.props;
16
- ---
17
-
18
- <div
19
- role="group"
20
- aria-roledescription="slide"
21
- data-slot="carousel-item"
22
- class={carouselItem({ class: className })}
23
- {...rest}
24
- >
25
- <slot />
26
- </div>
@@ -1,37 +0,0 @@
1
- ---
2
- import ArrowRight from "@tabler/icons/outline/arrow-right.svg";
3
- import type { ComponentProps } from "astro/types";
4
- import { tv } from "tailwind-variants";
5
-
6
- import { Button } from "@/components/starwind/button";
7
-
8
- export const carouselNext = tv({
9
- base: [
10
- "starwind-carousel-next absolute size-8 rounded-full",
11
- // Horizontal positioning
12
- "group-data-[axis=x]/carousel:top-1/2 group-data-[axis=x]/carousel:-right-12 group-data-[axis=x]/carousel:-translate-y-1/2",
13
- // Vertical positioning
14
- "group-data-[axis=y]/carousel:-bottom-12 group-data-[axis=y]/carousel:left-1/2 group-data-[axis=y]/carousel:-translate-x-1/2 group-data-[axis=y]/carousel:rotate-90",
15
- ],
16
- });
17
-
18
- type Props = ComponentProps<typeof Button>;
19
-
20
- const { class: className = "", variant = "outline", size = "icon", ...rest } = Astro.props;
21
- ---
22
-
23
- <Button
24
- data-slot="carousel-next"
25
- variant={variant}
26
- size={size}
27
- class={carouselNext({ class: className })}
28
- aria-label="Next slide"
29
- {...rest}
30
- >
31
- <slot name="icon">
32
- <ArrowRight />
33
- </slot>
34
- <slot>
35
- <span class="sr-only">Next slide</span>
36
- </slot>
37
- </Button>
@@ -1,37 +0,0 @@
1
- ---
2
- import ArrowLeft from "@tabler/icons/outline/arrow-left.svg";
3
- import type { ComponentProps } from "astro/types";
4
- import { tv } from "tailwind-variants";
5
-
6
- import { Button } from "@/components/starwind/button";
7
-
8
- export const carouselPrevious = tv({
9
- base: [
10
- "starwind-carousel-previous absolute size-8 rounded-full",
11
- // Horizontal positioning
12
- "group-data-[axis=x]/carousel:top-1/2 group-data-[axis=x]/carousel:-left-12 group-data-[axis=x]/carousel:-translate-y-1/2",
13
- // Vertical positioning
14
- "group-data-[axis=y]/carousel:-top-12 group-data-[axis=y]/carousel:left-1/2 group-data-[axis=y]/carousel:-translate-x-1/2 group-data-[axis=y]/carousel:rotate-90",
15
- ],
16
- });
17
-
18
- type Props = ComponentProps<typeof Button>;
19
-
20
- const { class: className = "", variant = "outline", size = "icon", ...rest } = Astro.props;
21
- ---
22
-
23
- <Button
24
- data-slot="carousel-previous"
25
- variant={variant}
26
- size={size}
27
- class={carouselPrevious({ class: className })}
28
- aria-label="Previous slide"
29
- {...rest}
30
- >
31
- <slot name="icon">
32
- <ArrowLeft />
33
- </slot>
34
- <slot>
35
- <span class="sr-only">Previous slide</span>
36
- </slot>
37
- </Button>
@@ -1,191 +0,0 @@
1
- import EmblaCarousel, {
2
- type EmblaCarouselType,
3
- type EmblaEventType,
4
- type EmblaOptionsType,
5
- type EmblaPluginType,
6
- } from "embla-carousel";
7
-
8
- export type CarouselApi = EmblaCarouselType;
9
-
10
- export interface CarouselOptions {
11
- opts?: EmblaOptionsType;
12
- plugins?: EmblaPluginType[];
13
- setApi?: (api: CarouselApi) => void;
14
- }
15
-
16
- export interface CarouselManager {
17
- api: CarouselApi;
18
- scrollPrev: () => void;
19
- scrollNext: () => void;
20
- canScrollPrev: () => boolean;
21
- canScrollNext: () => boolean;
22
- destroy: () => void;
23
- }
24
-
25
- export function initCarousel(
26
- carouselElement: HTMLElement,
27
- options: CarouselOptions = {},
28
- ): CarouselManager | null {
29
- // don't re-initialize if already initialized
30
- if (carouselElement.dataset.initialized === "true") return null;
31
- carouselElement.dataset.initialized = "true";
32
-
33
- if (!carouselElement) {
34
- console.warn("Carousel element not found");
35
- return null;
36
- }
37
-
38
- // Find content element - Embla expects the viewport element, not the container
39
- const viewportElement = carouselElement.querySelector(
40
- '[data-slot="carousel-content"]',
41
- ) as HTMLElement;
42
- if (!viewportElement) {
43
- console.warn("Carousel content element not found");
44
- return null;
45
- }
46
-
47
- // Get configuration from data attributes
48
- const axisData = carouselElement.dataset.axis;
49
- const axis: EmblaOptionsType["axis"] = axisData === "y" ? "y" : "x";
50
-
51
- // Safely parse data options
52
- let dataOpts = {};
53
- try {
54
- const optsString = carouselElement.dataset.opts;
55
- if (optsString && optsString !== "undefined" && optsString !== "null") {
56
- dataOpts = JSON.parse(optsString);
57
- }
58
- } catch (e) {
59
- console.warn("Failed to parse carousel opts:", e);
60
- dataOpts = {};
61
- }
62
-
63
- // Ensure dataOpts is a valid object
64
- if (!dataOpts || typeof dataOpts !== "object") {
65
- dataOpts = {};
66
- }
67
-
68
- // Merge options - ensure we always have a valid object
69
- const emblaOptions: EmblaOptionsType = {
70
- axis,
71
- ...dataOpts,
72
- ...(options.opts || {}),
73
- };
74
-
75
- // Handle plugins - EmblaCarousel expects undefined when no plugins, not empty array
76
- const plugins = options.plugins && options.plugins.length > 0 ? options.plugins : undefined;
77
-
78
- // console.log("ID:", carouselElement.id);
79
- // console.log("Plugins:", plugins);
80
- // console.log("Options:", emblaOptions);
81
-
82
- // Find navigation buttons
83
- const prevButton = carouselElement.querySelector(
84
- '[data-slot="carousel-previous"]',
85
- ) as HTMLButtonElement;
86
- const nextButton = carouselElement.querySelector(
87
- '[data-slot="carousel-next"]',
88
- ) as HTMLButtonElement;
89
-
90
- // Initialize Embla
91
- let emblaApi: EmblaCarouselType;
92
- if (plugins) {
93
- emblaApi = EmblaCarousel(viewportElement, emblaOptions, plugins);
94
- } else {
95
- emblaApi = EmblaCarousel(viewportElement, emblaOptions);
96
- }
97
-
98
- // Update button states
99
- const updateButtons = () => {
100
- const canScrollPrev = emblaApi.canScrollPrev();
101
- const canScrollNext = emblaApi.canScrollNext();
102
-
103
- if (prevButton) {
104
- prevButton.disabled = !canScrollPrev;
105
- prevButton.setAttribute("aria-disabled", (!canScrollPrev).toString());
106
- }
107
-
108
- if (nextButton) {
109
- nextButton.disabled = !canScrollNext;
110
- nextButton.setAttribute("aria-disabled", (!canScrollNext).toString());
111
- }
112
- };
113
-
114
- // Event handlers for cleanup
115
- const prevClickHandler = () => emblaApi.scrollPrev();
116
- const nextClickHandler = () => emblaApi.scrollNext();
117
- const keydownHandler = (event: KeyboardEvent) => {
118
- if (axis === "y") {
119
- // Vertical axis: ArrowUp = previous, ArrowDown = next
120
- if (event.key === "ArrowUp") {
121
- event.preventDefault();
122
- emblaApi.scrollPrev();
123
- } else if (event.key === "ArrowDown") {
124
- event.preventDefault();
125
- emblaApi.scrollNext();
126
- }
127
- } else {
128
- // Horizontal axis (default): ArrowLeft = previous, ArrowRight = next
129
- if (event.key === "ArrowLeft") {
130
- event.preventDefault();
131
- emblaApi.scrollPrev();
132
- } else if (event.key === "ArrowRight") {
133
- event.preventDefault();
134
- emblaApi.scrollNext();
135
- }
136
- }
137
- };
138
-
139
- // Setup event listeners
140
- const setupEventListeners = () => {
141
- // Navigation button listeners
142
- prevButton?.addEventListener("click", prevClickHandler);
143
- nextButton?.addEventListener("click", nextClickHandler);
144
-
145
- // Keyboard navigation
146
- carouselElement.addEventListener("keydown", keydownHandler);
147
- };
148
-
149
- // Setup user API callback
150
- const setupUserCallbacks = () => {
151
- if (options.setApi) {
152
- options.setApi(emblaApi);
153
- }
154
- };
155
-
156
- // Initialize everything
157
- updateButtons();
158
- setupEventListeners();
159
- setupUserCallbacks();
160
-
161
- // Setup internal event listeners
162
- emblaApi.on("select", updateButtons);
163
- emblaApi.on("init", () => {
164
- updateButtons();
165
- });
166
- emblaApi.on("reInit", () => {
167
- updateButtons();
168
- });
169
-
170
- // Return manager interface
171
- return {
172
- api: emblaApi,
173
- scrollPrev: () => emblaApi.scrollPrev(),
174
- scrollNext: () => emblaApi.scrollNext(),
175
- canScrollPrev: () => emblaApi.canScrollPrev(),
176
- canScrollNext: () => emblaApi.canScrollNext(),
177
- destroy: () => {
178
- // Remove event listeners to prevent memory leaks
179
- if (prevButton) {
180
- prevButton.removeEventListener("click", prevClickHandler);
181
- }
182
- if (nextButton) {
183
- nextButton.removeEventListener("click", nextClickHandler);
184
- }
185
- carouselElement.removeEventListener("keydown", keydownHandler);
186
-
187
- // Destroy the Embla instance
188
- emblaApi.destroy();
189
- },
190
- };
191
- }
@@ -1,32 +0,0 @@
1
- import Carousel from "./Carousel.astro";
2
- import {
3
- type CarouselApi,
4
- type CarouselManager,
5
- type CarouselOptions,
6
- initCarousel,
7
- } from "./carousel-script";
8
- import CarouselContent from "./CarouselContent.astro";
9
- import CarouselItem from "./CarouselItem.astro";
10
- import CarouselNext from "./CarouselNext.astro";
11
- import CarouselPrevious from "./CarouselPrevious.astro";
12
-
13
- export {
14
- Carousel,
15
- type CarouselApi,
16
- CarouselContent,
17
- CarouselItem,
18
- type CarouselManager,
19
- CarouselNext,
20
- type CarouselOptions,
21
- CarouselPrevious,
22
- initCarousel,
23
- };
24
-
25
- export default {
26
- Root: Carousel,
27
- Content: CarouselContent,
28
- Item: CarouselItem,
29
- Next: CarouselNext,
30
- Previous: CarouselPrevious,
31
- init: initCarousel,
32
- };
@@ -1,128 +0,0 @@
1
- ---
2
- import Check from "@tabler/icons/outline/check.svg";
3
- import type { HTMLAttributes } from "astro/types";
4
- import { tv, type VariantProps } from "tailwind-variants";
5
-
6
- type Props = Omit<HTMLAttributes<"input">, "type"> &
7
- VariantProps<typeof checkbox> & {
8
- /**
9
- * Optional label text to display next to the checkbox
10
- */
11
- label?: string;
12
- };
13
-
14
- export const checkbox = tv({
15
- slots: {
16
- base: "starwind-checkbox relative flex items-center space-x-2",
17
- input: [
18
- "peer border-input bg-background dark:bg-input/30 shrink-0 transform-gpu rounded-sm border",
19
- "transition-all focus-visible:ring-3",
20
- "outline-0 focus:ring-0 focus:ring-offset-0",
21
- "not-disabled:cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
22
- "aria-invalid:border-error aria-invalid:focus-visible:ring-error/40",
23
- ],
24
- icon: [
25
- "pointer-events-none absolute stroke-3 p-0.5 opacity-0 transition-opacity peer-checked:opacity-100",
26
- "starwind-check-icon",
27
- ],
28
- label:
29
- "font-medium peer-not-disabled:cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
30
- },
31
- variants: {
32
- size: {
33
- sm: { input: "size-4", icon: "size-4", label: "text-sm" },
34
- md: { input: "size-5", icon: "size-5", label: "text-base" },
35
- lg: { input: "size-6", icon: "size-6", label: "text-lg" },
36
- },
37
- variant: {
38
- default: {
39
- input: "checked:bg-foreground focus-visible:ring-outline/50 focus-visible:border-outline",
40
- icon: "text-background",
41
- },
42
- primary: {
43
- input:
44
- "checked:bg-primary checked:border-primary focus-visible:ring-primary/50 focus-visible:border-primary",
45
- icon: "text-primary-foreground",
46
- },
47
- secondary: {
48
- input:
49
- "checked:bg-secondary checked:border-secondary focus-visible:ring-secondary/50 focus-visible:border-secondary",
50
- icon: "text-secondary-foreground",
51
- },
52
- info: {
53
- input:
54
- "checked:bg-info checked:border-info focus-visible:ring-info/50 focus-visible:border-info",
55
- icon: "text-info-foreground",
56
- },
57
- success: {
58
- input:
59
- "checked:bg-success checked:border-success focus-visible:ring-success/50 focus-visible:border-success",
60
- icon: "text-success-foreground",
61
- },
62
- warning: {
63
- input:
64
- "checked:bg-warning checked:border-warning focus-visible:ring-warning/50 focus-visible:border-warning",
65
- icon: "text-warning-foreground",
66
- },
67
- error: {
68
- input:
69
- "checked:bg-error checked:border-error focus-visible:ring-error/50 focus-visible:border-error",
70
- icon: "text-error-foreground",
71
- },
72
- },
73
- },
74
- defaultVariants: { size: "md", variant: "default" },
75
- });
76
-
77
- const { id, label, checked, size, variant, class: className, ...rest } = Astro.props;
78
-
79
- const { base, input, icon, label: labelClass } = checkbox({ size, variant });
80
- ---
81
-
82
- <div class={base()}>
83
- <input
84
- type="checkbox"
85
- id={id}
86
- class={input({ class: className })}
87
- data-slot="checkbox-input"
88
- {checked}
89
- {...rest}
90
- />
91
- <Check class={icon()} />
92
- {
93
- label && (
94
- <label for={id} class={labelClass()} data-slot="checkbox-label">
95
- {label}
96
- </label>
97
- )
98
- }
99
- </div>
100
-
101
- <style>
102
- .starwind-checkbox input[type="checkbox"]:checked {
103
- background-image: none;
104
- }
105
-
106
- /* Check drawing animation */
107
- .starwind-check-icon {
108
- stroke-dasharray: 65;
109
- stroke-dashoffset: 65;
110
- opacity: 0;
111
- }
112
-
113
- .starwind-checkbox input[type="checkbox"]:checked + .starwind-check-icon {
114
- animation: draw-check 0.3s ease forwards;
115
- animation-delay: 0.15s;
116
- }
117
-
118
- @keyframes draw-check {
119
- 0% {
120
- stroke-dashoffset: 65;
121
- opacity: 1;
122
- }
123
- 100% {
124
- stroke-dashoffset: 0;
125
- opacity: 1;
126
- }
127
- }
128
- </style>
@@ -1,7 +0,0 @@
1
- import Checkbox, { checkbox } from "./Checkbox.astro";
2
-
3
- const CheckboxVariants = { checkbox };
4
-
5
- export { Checkbox, CheckboxVariants };
6
-
7
- export default Checkbox;