@starwind-ui/core 1.12.0 → 1.12.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 (166) hide show
  1. package/package.json +1 -1
  2. package/dist/index.d.ts +0 -28
  3. package/dist/index.js +0 -81
  4. package/dist/index.js.map +0 -1
  5. package/dist/src/components/accordion/Accordion.astro +0 -247
  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 -273
  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 -51
  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 -53
  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 -127
  61. package/dist/src/components/checkbox/index.ts +0 -7
  62. package/dist/src/components/dialog/Dialog.astro +0 -263
  63. package/dist/src/components/dialog/DialogClose.astro +0 -35
  64. package/dist/src/components/dialog/DialogContent.astro +0 -67
  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 -20
  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 -375
  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 -233
  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/input/Input.astro +0 -24
  84. package/dist/src/components/input/index.ts +0 -7
  85. package/dist/src/components/item/Item.astro +0 -52
  86. package/dist/src/components/item/ItemActions.astro +0 -16
  87. package/dist/src/components/item/ItemContent.astro +0 -16
  88. package/dist/src/components/item/ItemDescription.astro +0 -19
  89. package/dist/src/components/item/ItemFooter.astro +0 -16
  90. package/dist/src/components/item/ItemGroup.astro +0 -16
  91. package/dist/src/components/item/ItemHeader.astro +0 -16
  92. package/dist/src/components/item/ItemMedia.astro +0 -40
  93. package/dist/src/components/item/ItemSeparator.astro +0 -21
  94. package/dist/src/components/item/ItemTitle.astro +0 -16
  95. package/dist/src/components/item/index.ts +0 -50
  96. package/dist/src/components/kbd/Kbd.astro +0 -21
  97. package/dist/src/components/kbd/KbdGroup.astro +0 -16
  98. package/dist/src/components/kbd/index.ts +0 -11
  99. package/dist/src/components/label/Label.astro +0 -22
  100. package/dist/src/components/label/index.ts +0 -7
  101. package/dist/src/components/pagination/Pagination.astro +0 -20
  102. package/dist/src/components/pagination/PaginationContent.astro +0 -16
  103. package/dist/src/components/pagination/PaginationEllipsis.astro +0 -35
  104. package/dist/src/components/pagination/PaginationItem.astro +0 -16
  105. package/dist/src/components/pagination/PaginationLink.astro +0 -24
  106. package/dist/src/components/pagination/PaginationNext.astro +0 -30
  107. package/dist/src/components/pagination/PaginationPrevious.astro +0 -30
  108. package/dist/src/components/pagination/index.ts +0 -38
  109. package/dist/src/components/progress/Progress.astro +0 -154
  110. package/dist/src/components/progress/index.ts +0 -10
  111. package/dist/src/components/radio-group/RadioGroup.astro +0 -157
  112. package/dist/src/components/radio-group/RadioGroupItem.astro +0 -129
  113. package/dist/src/components/radio-group/RadioGroupTypes.ts +0 -6
  114. package/dist/src/components/radio-group/index.ts +0 -23
  115. package/dist/src/components/select/Select.astro +0 -696
  116. package/dist/src/components/select/SelectContent.astro +0 -94
  117. package/dist/src/components/select/SelectGroup.astro +0 -9
  118. package/dist/src/components/select/SelectItem.astro +0 -51
  119. package/dist/src/components/select/SelectLabel.astro +0 -14
  120. package/dist/src/components/select/SelectSearch.astro +0 -49
  121. package/dist/src/components/select/SelectSeparator.astro +0 -12
  122. package/dist/src/components/select/SelectTrigger.astro +0 -58
  123. package/dist/src/components/select/SelectTypes.ts +0 -13
  124. package/dist/src/components/select/SelectValue.astro +0 -19
  125. package/dist/src/components/select/index.ts +0 -49
  126. package/dist/src/components/separator/Separator.astro +0 -36
  127. package/dist/src/components/separator/index.ts +0 -7
  128. package/dist/src/components/sheet/Sheet.astro +0 -13
  129. package/dist/src/components/sheet/SheetClose.astro +0 -13
  130. package/dist/src/components/sheet/SheetContent.astro +0 -92
  131. package/dist/src/components/sheet/SheetDescription.astro +0 -16
  132. package/dist/src/components/sheet/SheetFooter.astro +0 -16
  133. package/dist/src/components/sheet/SheetHeader.astro +0 -16
  134. package/dist/src/components/sheet/SheetTitle.astro +0 -16
  135. package/dist/src/components/sheet/SheetTrigger.astro +0 -13
  136. package/dist/src/components/sheet/index.ts +0 -41
  137. package/dist/src/components/skeleton/Skeleton.astro +0 -14
  138. package/dist/src/components/skeleton/index.ts +0 -9
  139. package/dist/src/components/spinner/Spinner.astro +0 -21
  140. package/dist/src/components/spinner/index.ts +0 -7
  141. package/dist/src/components/switch/Switch.astro +0 -191
  142. package/dist/src/components/switch/SwitchTypes.ts +0 -6
  143. package/dist/src/components/switch/index.ts +0 -12
  144. package/dist/src/components/table/Table.astro +0 -18
  145. package/dist/src/components/table/TableBody.astro +0 -16
  146. package/dist/src/components/table/TableCaption.astro +0 -16
  147. package/dist/src/components/table/TableCell.astro +0 -16
  148. package/dist/src/components/table/TableFoot.astro +0 -16
  149. package/dist/src/components/table/TableHead.astro +0 -16
  150. package/dist/src/components/table/TableHeader.astro +0 -16
  151. package/dist/src/components/table/TableRow.astro +0 -16
  152. package/dist/src/components/table/index.ts +0 -42
  153. package/dist/src/components/tabs/Tabs.astro +0 -269
  154. package/dist/src/components/tabs/TabsContent.astro +0 -28
  155. package/dist/src/components/tabs/TabsList.astro +0 -22
  156. package/dist/src/components/tabs/TabsTrigger.astro +0 -34
  157. package/dist/src/components/tabs/index.ts +0 -20
  158. package/dist/src/components/textarea/Textarea.astro +0 -28
  159. package/dist/src/components/textarea/index.ts +0 -9
  160. package/dist/src/components/toggle/Toggle.astro +0 -172
  161. package/dist/src/components/toggle/ToggleTypes.ts +0 -14
  162. package/dist/src/components/toggle/index.ts +0 -8
  163. package/dist/src/components/tooltip/Tooltip.astro +0 -237
  164. package/dist/src/components/tooltip/TooltipContent.astro +0 -114
  165. package/dist/src/components/tooltip/TooltipTrigger.astro +0 -10
  166. package/dist/src/components/tooltip/index.ts +0 -16
@@ -1,233 +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/50 data-[drag-active=true]:bg-muted/50 transition",
25
- "focus-visible:border-outline focus-visible:ring-outline/50 outline-none focus-visible:ring-3",
26
- ],
27
- });
28
- ---
29
-
30
- <label
31
- id={id}
32
- tabindex="0"
33
- class={dropzone({ class: className })}
34
- data-slot="dropzone"
35
- data-drag-active="false"
36
- data-has-files="false"
37
- data-is-uploading={String(isUploading)}
38
- >
39
- <slot>
40
- <DropzoneUploadIndicator />
41
- <DropzoneLoadingIndicator />
42
- <DropzoneFilesList />
43
- </slot>
44
-
45
- <input tabindex="-1" type="file" class="sr-only" {...rest} />
46
- </label>
47
-
48
- <script>
49
- 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>`;
50
- class FileInputHandler {
51
- private label: HTMLLabelElement;
52
- private input: HTMLInputElement;
53
- private uploadIndicator: HTMLElement | null;
54
- private loadingIndicator: HTMLElement | null;
55
- private filesList: HTMLElement | null;
56
- private files: File[] = [];
57
- private hasFiles: boolean = false;
58
- private isUploading: boolean = false;
59
- private observer: MutationObserver | null = null;
60
-
61
- constructor(label: HTMLLabelElement, idx: number) {
62
- this.label = label;
63
- const maybeInput = label.querySelector<HTMLInputElement>('input[type="file"]');
64
- if (!maybeInput) {
65
- throw new Error("No file input found inside starwind-dropzone");
66
- }
67
- this.input = maybeInput;
68
- this.uploadIndicator = label.querySelector(".starwind-upload-indicator");
69
- this.loadingIndicator = label.querySelector(".starwind-loading-indicator");
70
- this.filesList = label.querySelector(".starwind-files-list");
71
-
72
- // generate ID
73
- if (this.label.id) {
74
- const inputId = this.label.id + "-input";
75
- this.input.id = inputId;
76
- this.label.htmlFor = inputId;
77
- } else {
78
- const generatedId = `starwind-dropzone-${idx}`;
79
- this.input.id = generatedId;
80
- this.label.htmlFor = generatedId;
81
- }
82
-
83
- // Setup event handlers
84
- this.setupEvents();
85
- }
86
-
87
- private setActive(active: boolean) {
88
- this.label.dataset.dragActive = String(active);
89
- }
90
-
91
- // Set up mutation observer to watch for external attribute changes
92
- private observeAttributeChanges() {
93
- this.observer = new MutationObserver((mutations) => {
94
- mutations.forEach((mutation) => {
95
- if (mutation.type === "attributes" && mutation.attributeName === "data-is-uploading") {
96
- this.handleAttributeChange();
97
- }
98
- });
99
- });
100
-
101
- this.observer.observe(this.label, {
102
- attributes: true,
103
- attributeFilter: ["data-is-uploading"],
104
- });
105
- }
106
-
107
- // Handle attribute changes from external sources
108
- private handleAttributeChange() {
109
- const isUploading = this.label.dataset.isUploading === "true";
110
-
111
- // Only update internal state if it's different
112
- if (isUploading !== this.isUploading) {
113
- this.isUploading = isUploading;
114
-
115
- // Update UI
116
- if (this.uploadIndicator && this.loadingIndicator) {
117
- if (isUploading) {
118
- this.uploadIndicator.classList.add("hidden");
119
- this.loadingIndicator.classList.remove("hidden");
120
- } else {
121
- this.loadingIndicator.classList.add("hidden");
122
- this.uploadIndicator.classList.remove("hidden");
123
- }
124
- }
125
- }
126
- }
127
-
128
- private updateFilesList() {
129
- if (!this.filesList) return;
130
-
131
- const hasFiles = this.files.length > 0;
132
- this.label.dataset.hasFiles = String(hasFiles);
133
-
134
- if (hasFiles) {
135
- this.filesList.classList.remove("invisible");
136
-
137
- // Clear previous files
138
- this.filesList.innerHTML = "";
139
-
140
- // Create file list
141
- this.files.forEach((file) => {
142
- const fileItem = document.createElement("div");
143
-
144
- // Insert SVG directly
145
- fileItem.innerHTML = fileSvg;
146
-
147
- const fileText = document.createElement("span");
148
- fileText.textContent = file.name;
149
-
150
- // Append text after the SVG
151
- fileItem.appendChild(fileText);
152
-
153
- // Use non-null assertion since we already checked at the beginning of the method
154
- this.filesList!.appendChild(fileItem);
155
- });
156
- } else {
157
- this.filesList.classList.add("invisible");
158
- }
159
- }
160
-
161
- private handleFiles(files: FileList | null) {
162
- if (!files || files.length === 0) return;
163
-
164
- this.files = Array.from(files);
165
- this.updateFilesList();
166
- }
167
-
168
- private setupEvents() {
169
- this.label.addEventListener("dragover", (e) => {
170
- e.preventDefault();
171
- this.setActive(true);
172
- });
173
-
174
- this.label.addEventListener("dragleave", () => {
175
- this.setActive(false);
176
- });
177
-
178
- this.label.addEventListener("drop", (e) => {
179
- e.preventDefault();
180
- this.setActive(false);
181
-
182
- const { files } = e.dataTransfer || {};
183
- if (files && files.length) {
184
- const dt = new DataTransfer();
185
- Array.from(files).forEach((file) => dt.items.add(file));
186
- this.input.files = dt.files;
187
- this.input.dispatchEvent(new Event("change", { bubbles: true }));
188
-
189
- this.handleFiles(files);
190
- }
191
- });
192
-
193
- // Handle file selection from dialog
194
- this.input.addEventListener("change", () => {
195
- this.handleFiles(this.input.files);
196
- });
197
-
198
- // Add keyboard accessibility for Enter and Space keys
199
- this.label.addEventListener("keydown", (e) => {
200
- // Handle Enter (13) and Space (32) keys
201
- if (e.key === "Enter" || e.key === " ") {
202
- e.preventDefault();
203
- this.input.click(); // Trigger the native file dialog
204
- }
205
- });
206
-
207
- if (this.loadingIndicator) {
208
- // Watch for external changes to data-is-uploading attribute
209
- this.observeAttributeChanges();
210
- // Initialize based on current attribute values
211
- this.handleAttributeChange();
212
- }
213
- }
214
- }
215
-
216
- // Store instances in a WeakMap to avoid memory leaks
217
- const fileInputInstances = new WeakMap<HTMLElement, FileInputHandler>();
218
-
219
- const setupFileInputs = () => {
220
- document.querySelectorAll<HTMLLabelElement>(".starwind-dropzone").forEach((label, idx) => {
221
- if (!fileInputInstances.has(label)) {
222
- try {
223
- fileInputInstances.set(label, new FileInputHandler(label, idx));
224
- } catch {
225
- /* ignore labels without inputs */
226
- }
227
- }
228
- });
229
- };
230
-
231
- setupFileInputs();
232
- document.addEventListener("astro:after-swap", setupFileInputs);
233
- </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 { 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
- "peer placeholder:text-muted-foreground",
14
- ],
15
- variants: {
16
- size: { sm: "h-9 px-2 text-sm", md: "h-11 px-3 text-base", lg: "h-12 px-4 text-lg" },
17
- },
18
- defaultVariants: { size: "md" },
19
- });
20
-
21
- const { size, class: className, ...rest } = Astro.props;
22
- ---
23
-
24
- <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
- };
@@ -1,21 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"kbd">;
6
-
7
- export const kbd = tv({
8
- base: [
9
- "pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none",
10
- "bg-muted text-muted-foreground",
11
- "[&_svg:not([class*='size-'])]:size-3",
12
- "[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",
13
- ],
14
- });
15
-
16
- const { class: className, ...rest } = Astro.props;
17
- ---
18
-
19
- <kbd class={kbd({ class: className })} data-slot="kbd" {...rest}>
20
- <slot />
21
- </kbd>
@@ -1,16 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { tv } from "tailwind-variants";
4
-
5
- type Props = HTMLAttributes<"kbd">;
6
-
7
- export const kbdGroup = tv({
8
- base: "inline-flex items-center gap-1",
9
- });
10
-
11
- const { class: className, ...rest } = Astro.props;
12
- ---
13
-
14
- <kbd class={kbdGroup({ class: className })} data-slot="kbd-group" {...rest}>
15
- <slot />
16
- </kbd>