@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,236 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- import DropzoneFilesList from "./DropzoneFilesList.astro";
6
- import DropzoneLoadingIndicator from "./DropzoneLoadingIndicator.astro";
7
- import DropzoneUploadIndicator from "./DropzoneUploadIndicator.astro";
8
-
9
- type Props = HTMLAttributes<"input"> & {
10
- /**
11
- * Whether to show the loading indicator initially
12
- */
13
- isUploading?: boolean;
14
- };
15
-
16
- // extract id separately so it can be used in the label. The input will get the same id with "-input" suffix.
17
- const { class: className, id, isUploading = false, ...rest } = Astro.props as Props;
18
-
19
- export const dropzone = tv({
20
- base: [
21
- "starwind-dropzone",
22
- "relative flex w-full flex-col items-center justify-center gap-1 rounded-lg px-6 py-12 shadow-xs",
23
- "bg-background dark:bg-input/30 text-muted-foreground border-input cursor-pointer border border-dashed text-center text-sm",
24
- "data-[is-uploading=false]:hover:bg-muted data-[drag-active=true]:bg-muted transition",
25
- "focus-visible:border-outline focus-visible:ring-outline/50 outline-none focus-visible:ring-3",
26
- "aria-invalid:border-error aria-invalid:focus-visible:ring-error/40",
27
- ],
28
- });
29
- ---
30
-
31
- <label
32
- id={id}
33
- tabindex="0"
34
- class={dropzone({ class: className })}
35
- data-slot="dropzone"
36
- data-drag-active="false"
37
- data-has-files="false"
38
- data-is-uploading={String(isUploading)}
39
- >
40
- <slot>
41
- <DropzoneUploadIndicator />
42
- <DropzoneLoadingIndicator />
43
- <DropzoneFilesList />
44
- </slot>
45
-
46
- <input tabindex="-1" type="file" class="sr-only" {...rest} />
47
- </label>
48
-
49
- <script>
50
- const fileSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14 3v4a1 1 0 0 0 1 1h4" /><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /></svg>`;
51
- class FileInputHandler {
52
- private label: HTMLLabelElement;
53
- private input: HTMLInputElement;
54
- private uploadIndicator: HTMLElement | null;
55
- private loadingIndicator: HTMLElement | null;
56
- private filesList: HTMLElement | null;
57
- private files: File[] = [];
58
- private hasFiles: boolean = false;
59
- private isUploading: boolean = false;
60
- private observer: MutationObserver | null = null;
61
-
62
- constructor(label: HTMLLabelElement, idx: number) {
63
- this.label = label;
64
- const maybeInput = label.querySelector<HTMLInputElement>('input[type="file"]');
65
- if (!maybeInput) {
66
- throw new Error("No file input found inside starwind-dropzone");
67
- }
68
- this.input = maybeInput;
69
- this.uploadIndicator = label.querySelector(".starwind-upload-indicator");
70
- this.loadingIndicator = label.querySelector(".starwind-loading-indicator");
71
- this.filesList = label.querySelector(".starwind-files-list");
72
-
73
- // generate ID
74
- if (this.label.id) {
75
- const inputId = this.label.id + "-input";
76
- this.input.id = inputId;
77
- this.label.htmlFor = inputId;
78
- } else {
79
- const generatedId = `starwind-dropzone-${idx}`;
80
- this.input.id = generatedId;
81
- this.label.htmlFor = generatedId;
82
- }
83
-
84
- // Setup event handlers
85
- this.setupEvents();
86
- }
87
-
88
- private setActive(active: boolean) {
89
- this.label.dataset.dragActive = String(active);
90
- }
91
-
92
- // Set up mutation observer to watch for external attribute changes
93
- private observeAttributeChanges() {
94
- this.observer = new MutationObserver((mutations) => {
95
- mutations.forEach((mutation) => {
96
- if (mutation.type === "attributes" && mutation.attributeName === "data-is-uploading") {
97
- this.handleAttributeChange();
98
- }
99
- });
100
- });
101
-
102
- this.observer.observe(this.label, {
103
- attributes: true,
104
- attributeFilter: ["data-is-uploading"],
105
- });
106
- }
107
-
108
- // Handle attribute changes from external sources
109
- private handleAttributeChange() {
110
- const isUploading = this.label.dataset.isUploading === "true";
111
-
112
- // Only update internal state if it's different
113
- if (isUploading !== this.isUploading) {
114
- this.isUploading = isUploading;
115
-
116
- // Update UI
117
- if (this.uploadIndicator && this.loadingIndicator) {
118
- if (isUploading) {
119
- this.uploadIndicator.classList.add("hidden");
120
- this.loadingIndicator.classList.remove("hidden");
121
- } else {
122
- this.loadingIndicator.classList.add("hidden");
123
- this.uploadIndicator.classList.remove("hidden");
124
- }
125
- }
126
- }
127
- }
128
-
129
- private updateFilesList() {
130
- if (!this.filesList) return;
131
-
132
- const hasFiles = this.files.length > 0;
133
- this.label.dataset.hasFiles = String(hasFiles);
134
-
135
- if (hasFiles) {
136
- this.filesList.classList.remove("invisible");
137
-
138
- // Clear previous files
139
- this.filesList.innerHTML = "";
140
-
141
- // Create file list
142
- this.files.forEach((file) => {
143
- const fileItem = document.createElement("div");
144
-
145
- // Insert SVG directly
146
- fileItem.innerHTML = fileSvg;
147
-
148
- const fileText = document.createElement("span");
149
- fileText.textContent = file.name;
150
-
151
- // Append text after the SVG
152
- fileItem.appendChild(fileText);
153
-
154
- // Use non-null assertion since we already checked at the beginning of the method
155
- this.filesList!.appendChild(fileItem);
156
- });
157
- } else {
158
- this.filesList.classList.add("invisible");
159
- }
160
- }
161
-
162
- private handleFiles(files: FileList | null) {
163
- if (!files || files.length === 0) return;
164
-
165
- this.files = Array.from(files);
166
- this.updateFilesList();
167
- }
168
-
169
- private setupEvents() {
170
- this.label.addEventListener("dragover", (e) => {
171
- e.preventDefault();
172
- this.setActive(true);
173
- });
174
-
175
- this.label.addEventListener("dragleave", () => {
176
- this.setActive(false);
177
- });
178
-
179
- this.label.addEventListener("drop", (e) => {
180
- e.preventDefault();
181
- this.setActive(false);
182
-
183
- const { files } = e.dataTransfer || {};
184
- if (files && files.length) {
185
- const dt = new DataTransfer();
186
- Array.from(files).forEach((file) => dt.items.add(file));
187
- this.input.files = dt.files;
188
- this.input.dispatchEvent(new Event("change", { bubbles: true }));
189
-
190
- this.handleFiles(files);
191
- }
192
- });
193
-
194
- // Handle file selection from dialog
195
- this.input.addEventListener("change", () => {
196
- this.handleFiles(this.input.files);
197
- });
198
-
199
- // Add keyboard accessibility for Enter and Space keys
200
- this.label.addEventListener("keydown", (e) => {
201
- // Handle Enter (13) and Space (32) keys
202
- if (e.key === "Enter" || e.key === " ") {
203
- e.preventDefault();
204
- this.input.click(); // Trigger the native file dialog
205
- }
206
- });
207
-
208
- if (this.loadingIndicator) {
209
- // Watch for external changes to data-is-uploading attribute
210
- this.observeAttributeChanges();
211
- // Initialize based on current attribute values
212
- this.handleAttributeChange();
213
- }
214
- }
215
- }
216
-
217
- // Store instances in a WeakMap to avoid memory leaks
218
- const fileInputInstances = new WeakMap<HTMLElement, FileInputHandler>();
219
- let dropzoneCounter = 0;
220
-
221
- const setupFileInputs = () => {
222
- document.querySelectorAll<HTMLLabelElement>(".starwind-dropzone").forEach((label) => {
223
- if (!fileInputInstances.has(label)) {
224
- try {
225
- fileInputInstances.set(label, new FileInputHandler(label, dropzoneCounter++));
226
- } catch {
227
- /* ignore labels without inputs */
228
- }
229
- }
230
- });
231
- };
232
-
233
- setupFileInputs();
234
- document.addEventListener("astro:after-swap", setupFileInputs);
235
- document.addEventListener("starwind:init", setupFileInputs);
236
- </script>
@@ -1,26 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"div">;
6
-
7
- const { class: className, ...rest } = Astro.props;
8
-
9
- export const dropzoneFilesList = tv({
10
- base: [
11
- "starwind-files-list",
12
- "mt-1 -mb-8 min-h-8",
13
- "bg-muted invisible flex flex-col items-center justify-center gap-1 rounded-md px-2 py-1 text-sm",
14
- "[&_div]:flex [&_div]:items-center [&_div]:gap-1 [&_svg]:size-3.5",
15
- ],
16
- });
17
- ---
18
-
19
- <div
20
- class={dropzoneFilesList({ class: className })}
21
- aria-live="polite"
22
- aria-label="Uploaded files"
23
- data-slot="dropzone-files-list"
24
- {...rest}
25
- >
26
- </div>
@@ -1,10 +0,0 @@
1
- ---
2
- import LoaderIcon from "@tabler/icons/outline/loader-2.svg";
3
- ---
4
-
5
- <div class="starwind-loading-indicator hidden" data-slot="dropzone-loading-indicator">
6
- <slot>
7
- <LoaderIcon class="mx-auto size-10 animate-spin" aria-hidden="true" />
8
- <p class="mt-1 text-sm">Uploading file(s)...</p>
9
- </slot>
10
- </div>
@@ -1,10 +0,0 @@
1
- ---
2
- import CloudUploadIcon from "@tabler/icons/outline/cloud-upload.svg";
3
- ---
4
-
5
- <div class="starwind-upload-indicator" data-slot="dropzone-upload-indicator">
6
- <slot>
7
- <CloudUploadIcon class="mx-auto size-10" aria-hidden="true" />
8
- <p class="mt-1 text-sm">Click to upload or drag and drop</p>
9
- </slot>
10
- </div>
@@ -1,24 +0,0 @@
1
- import Dropzone, { dropzone } from "./Dropzone.astro";
2
- import DropzoneFilesList, { dropzoneFilesList } from "./DropzoneFilesList.astro";
3
- import DropzoneLoadingIndicator from "./DropzoneLoadingIndicator.astro";
4
- import DropzoneUploadIndicator from "./DropzoneUploadIndicator.astro";
5
-
6
- const DropzoneVariants = {
7
- dropzone,
8
- dropzoneFilesList,
9
- };
10
-
11
- export {
12
- Dropzone,
13
- DropzoneFilesList,
14
- DropzoneLoadingIndicator,
15
- DropzoneUploadIndicator,
16
- DropzoneVariants,
17
- };
18
-
19
- export default {
20
- Root: Dropzone,
21
- FilesList: DropzoneFilesList,
22
- UploadIndicator: DropzoneUploadIndicator,
23
- LoadingIndicator: DropzoneLoadingIndicator,
24
- };
@@ -1,24 +0,0 @@
1
- ---
2
- import type { ComponentProps } from "astro/types";
3
- import { Image as AstroImage } from "astro:assets";
4
- import { tv } from "tailwind-variants";
5
-
6
- export const image = tv({ base: "starwind-image h-auto w-full" });
7
-
8
- type Props = Partial<ComponentProps<typeof AstroImage>> & { inferSize?: boolean };
9
-
10
- const { class: className, src, alt = "", inferSize = true, ...rest } = Astro.props;
11
- ---
12
-
13
- {
14
- src && (
15
- <AstroImage
16
- class={image({ class: className })}
17
- src={src}
18
- alt={alt}
19
- inferSize={inferSize}
20
- data-slot="image"
21
- {...(rest as any)}
22
- />
23
- )
24
- }
@@ -1,9 +0,0 @@
1
- import Image, { image } from "./Image.astro";
2
-
3
- const ImageVariants = {
4
- image,
5
- };
6
-
7
- export { Image, ImageVariants };
8
-
9
- export default Image;
@@ -1,25 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv, type VariantProps } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"input"> & VariantProps<typeof input>;
6
-
7
- export const input = tv({
8
- base: [
9
- "border-input dark:bg-input/30 text-foreground w-full rounded-md border bg-transparent shadow-xs",
10
- "focus-visible:border-outline focus-visible:ring-outline/50 transition-[color,box-shadow] focus-visible:ring-3",
11
- "file:text-foreground file:my-auto file:mr-4 file:h-full file:border-0 file:bg-transparent file:text-sm file:font-medium",
12
- "disabled:cursor-not-allowed disabled:opacity-50",
13
- "aria-invalid:border-error aria-invalid:focus-visible:ring-error/40",
14
- "peer placeholder:text-muted-foreground",
15
- ],
16
- variants: {
17
- size: { sm: "h-9 px-2 text-sm", md: "h-11 px-3 text-base", lg: "h-12 px-4 text-lg" },
18
- },
19
- defaultVariants: { size: "md" },
20
- });
21
-
22
- const { size, class: className, ...rest } = Astro.props;
23
- ---
24
-
25
- <input class={input({ size, class: className })} data-slot="input" {...rest} />
@@ -1,7 +0,0 @@
1
- import Input, { input } from "./Input.astro";
2
-
3
- const InputVariants = { input };
4
-
5
- export { Input, InputVariants };
6
-
7
- export default Input;
@@ -1,52 +0,0 @@
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
- * Variant of the item
8
- * @default "default"
9
- */
10
- variant?: "default" | "outline" | "muted";
11
- /**
12
- * Size of the item
13
- * @default "default"
14
- */
15
- size?: "default" | "sm";
16
- };
17
-
18
- export const item = tv({
19
- base: [
20
- "group/item flex flex-wrap items-center rounded-md border border-transparent text-sm transition-colors",
21
- "[a]:hover:bg-accent/50 [a]:transition-colors",
22
- "focus-visible:border-ring focus-visible:ring-outline/50 outline-none focus-visible:ring-[3px]",
23
- ],
24
- variants: {
25
- variant: {
26
- default: "bg-transparent",
27
- outline: "border-border",
28
- muted: "bg-muted/50",
29
- },
30
- size: {
31
- default: "gap-4 p-4",
32
- sm: "gap-2.5 px-4 py-3",
33
- },
34
- },
35
- defaultVariants: {
36
- variant: "default",
37
- size: "default",
38
- },
39
- });
40
-
41
- const {
42
- variant = "default",
43
- size = "default",
44
- class: className,
45
- as: Tag = "div",
46
- ...rest
47
- } = Astro.props;
48
- ---
49
-
50
- <Tag class={item({ variant, size, class: className })} data-slot="item" {...rest}>
51
- <slot />
52
- </Tag>
@@ -1,16 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"div">;
6
-
7
- export const itemActions = tv({
8
- base: "flex items-center gap-2",
9
- });
10
-
11
- const { class: className, ...rest } = Astro.props;
12
- ---
13
-
14
- <div class={itemActions({ class: className })} data-slot="item-actions" {...rest}>
15
- <slot />
16
- </div>
@@ -1,16 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"div">;
6
-
7
- export const itemContent = tv({
8
- base: "flex flex-1 flex-col gap-1.5 [&+[data-slot=item-content]]:flex-none",
9
- });
10
-
11
- const { class: className, ...rest } = Astro.props;
12
- ---
13
-
14
- <div class={itemContent({ class: className })} data-slot="item-content" {...rest}>
15
- <slot />
16
- </div>
@@ -1,19 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"p">;
6
-
7
- export const itemDescription = tv({
8
- base: [
9
- "text-muted-foreground line-clamp-2 leading-snug font-normal text-balance",
10
- "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
11
- ],
12
- });
13
-
14
- const { class: className, ...rest } = Astro.props;
15
- ---
16
-
17
- <p class={itemDescription({ class: className })} data-slot="item-description" {...rest}>
18
- <slot />
19
- </p>
@@ -1,16 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"div">;
6
-
7
- export const itemFooter = tv({
8
- base: "flex basis-full items-center justify-between gap-2",
9
- });
10
-
11
- const { class: className, ...rest } = Astro.props;
12
- ---
13
-
14
- <div class={itemFooter({ class: className })} data-slot="item-footer" {...rest}>
15
- <slot />
16
- </div>
@@ -1,16 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"div">;
6
-
7
- export const itemGroup = tv({
8
- base: "group/item-group flex flex-col",
9
- });
10
-
11
- const { class: className, ...rest } = Astro.props;
12
- ---
13
-
14
- <div role="list" class={itemGroup({ class: className })} data-slot="item-group" {...rest}>
15
- <slot />
16
- </div>
@@ -1,16 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"div">;
6
-
7
- export const itemHeader = tv({
8
- base: "flex basis-full items-center justify-between gap-2",
9
- });
10
-
11
- const { class: className, ...rest } = Astro.props;
12
- ---
13
-
14
- <div class={itemHeader({ class: className })} data-slot="item-header" {...rest}>
15
- <slot />
16
- </div>
@@ -1,40 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"div"> & {
6
- /**
7
- * Variant of the item media
8
- * @default "default"
9
- */
10
- variant?: "default" | "icon" | "image";
11
- };
12
-
13
- export const itemMedia = tv({
14
- base: [
15
- "flex shrink-0 items-center justify-center gap-2 [&_svg]:pointer-events-none",
16
- "group-has-[[data-slot=item-description]]/item:translate-y-0.5 group-has-[[data-slot=item-description]]/item:self-start",
17
- ],
18
- variants: {
19
- variant: {
20
- default: "bg-transparent",
21
- icon: "bg-muted size-8 rounded-sm border [&_svg:not([class*='size-'])]:size-4",
22
- image: "size-10 overflow-hidden rounded-sm [&_img]:size-full [&_img]:object-cover",
23
- },
24
- },
25
- defaultVariants: {
26
- variant: "default",
27
- },
28
- });
29
-
30
- const { variant = "default", class: className, ...rest } = Astro.props;
31
- ---
32
-
33
- <div
34
- class={itemMedia({ variant, class: className })}
35
- data-slot="item-media"
36
- data-variant={variant}
37
- {...rest}
38
- >
39
- <slot />
40
- </div>
@@ -1,21 +0,0 @@
1
- ---
2
- import type { ComponentProps } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- import { Separator } from "@/components/starwind/separator";
6
-
7
- type Props = ComponentProps<typeof Separator>;
8
-
9
- export const itemSeparator = tv({
10
- base: "my-0",
11
- });
12
-
13
- const { class: className, orientation = "horizontal", ...rest } = Astro.props;
14
- ---
15
-
16
- <Separator
17
- orientation={orientation}
18
- class={itemSeparator({ class: className })}
19
- data-slot="item-separator"
20
- {...rest}
21
- />
@@ -1,16 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"div">;
6
-
7
- export const itemTitle = tv({
8
- base: "flex w-fit items-center gap-2 leading-snug font-medium",
9
- });
10
-
11
- const { class: className, ...rest } = Astro.props;
12
- ---
13
-
14
- <div class={itemTitle({ class: className })} data-slot="item-title" {...rest}>
15
- <slot />
16
- </div>
@@ -1,50 +0,0 @@
1
- import Item, { item } from "./Item.astro";
2
- import ItemActions, { itemActions } from "./ItemActions.astro";
3
- import ItemContent, { itemContent } from "./ItemContent.astro";
4
- import ItemDescription, { itemDescription } from "./ItemDescription.astro";
5
- import ItemFooter, { itemFooter } from "./ItemFooter.astro";
6
- import ItemGroup, { itemGroup } from "./ItemGroup.astro";
7
- import ItemHeader, { itemHeader } from "./ItemHeader.astro";
8
- import ItemMedia, { itemMedia } from "./ItemMedia.astro";
9
- import ItemSeparator, { itemSeparator } from "./ItemSeparator.astro";
10
- import ItemTitle, { itemTitle } from "./ItemTitle.astro";
11
-
12
- const ItemVariants = {
13
- item,
14
- itemActions,
15
- itemContent,
16
- itemDescription,
17
- itemFooter,
18
- itemGroup,
19
- itemHeader,
20
- itemMedia,
21
- itemSeparator,
22
- itemTitle,
23
- };
24
-
25
- export {
26
- Item,
27
- ItemActions,
28
- ItemContent,
29
- ItemDescription,
30
- ItemFooter,
31
- ItemGroup,
32
- ItemHeader,
33
- ItemMedia,
34
- ItemSeparator,
35
- ItemTitle,
36
- ItemVariants,
37
- };
38
-
39
- export default {
40
- Root: Item,
41
- Actions: ItemActions,
42
- Content: ItemContent,
43
- Description: ItemDescription,
44
- Footer: ItemFooter,
45
- Group: ItemGroup,
46
- Header: ItemHeader,
47
- Media: ItemMedia,
48
- Separator: ItemSeparator,
49
- Title: ItemTitle,
50
- };