@starwind-ui/core 1.15.4 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +67 -43
  3. package/dist/index.js.map +1 -1
  4. package/dist/src/components/accordion/Accordion.astro +1 -1
  5. package/dist/src/components/accordion/AccordionContent.astro +1 -1
  6. package/dist/src/components/accordion/AccordionItem.astro +1 -1
  7. package/dist/src/components/accordion/AccordionTrigger.astro +1 -1
  8. package/dist/src/components/alert/Alert.astro +1 -1
  9. package/dist/src/components/alert/AlertDescription.astro +1 -1
  10. package/dist/src/components/alert/AlertTitle.astro +1 -1
  11. package/dist/src/components/alert-dialog/AlertDialog.astro +1 -1
  12. package/dist/src/components/alert-dialog/AlertDialogAction.astro +1 -1
  13. package/dist/src/components/alert-dialog/AlertDialogCancel.astro +1 -1
  14. package/dist/src/components/alert-dialog/AlertDialogContent.astro +3 -3
  15. package/dist/src/components/alert-dialog/AlertDialogDescription.astro +1 -1
  16. package/dist/src/components/alert-dialog/AlertDialogFooter.astro +1 -1
  17. package/dist/src/components/alert-dialog/AlertDialogHeader.astro +1 -1
  18. package/dist/src/components/alert-dialog/AlertDialogTitle.astro +1 -1
  19. package/dist/src/components/alert-dialog/AlertDialogTrigger.astro +2 -2
  20. package/dist/src/components/aspect-ratio/AspectRatio.astro +1 -1
  21. package/dist/src/components/avatar/Avatar.astro +1 -1
  22. package/dist/src/components/avatar/AvatarFallback.astro +1 -1
  23. package/dist/src/components/avatar/AvatarImage.astro +2 -2
  24. package/dist/src/components/badge/Badge.astro +1 -1
  25. package/dist/src/components/breadcrumb/Breadcrumb.astro +1 -1
  26. package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +1 -1
  27. package/dist/src/components/breadcrumb/BreadcrumbItem.astro +1 -1
  28. package/dist/src/components/breadcrumb/BreadcrumbLink.astro +1 -1
  29. package/dist/src/components/breadcrumb/BreadcrumbList.astro +2 -2
  30. package/dist/src/components/breadcrumb/BreadcrumbPage.astro +1 -1
  31. package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +1 -1
  32. package/dist/src/components/button/Button.astro +1 -1
  33. package/dist/src/components/button-group/ButtonGroup.astro +1 -1
  34. package/dist/src/components/button-group/ButtonGroupSeparator.astro +1 -1
  35. package/dist/src/components/button-group/ButtonGroupText.astro +1 -1
  36. package/dist/src/components/card/Card.astro +1 -1
  37. package/dist/src/components/card/CardAction.astro +1 -1
  38. package/dist/src/components/card/CardContent.astro +1 -1
  39. package/dist/src/components/card/CardDescription.astro +1 -1
  40. package/dist/src/components/card/CardFooter.astro +1 -1
  41. package/dist/src/components/card/CardHeader.astro +1 -1
  42. package/dist/src/components/card/CardTitle.astro +1 -1
  43. package/dist/src/components/carousel/Carousel.astro +1 -1
  44. package/dist/src/components/carousel/CarouselContent.astro +1 -1
  45. package/dist/src/components/carousel/CarouselItem.astro +1 -1
  46. package/dist/src/components/carousel/CarouselNext.astro +1 -1
  47. package/dist/src/components/carousel/CarouselPrevious.astro +1 -1
  48. package/dist/src/components/checkbox/Checkbox.astro +1 -1
  49. package/dist/src/components/collapsible/Collapsible.astro +1 -1
  50. package/dist/src/components/collapsible/CollapsibleContent.astro +1 -1
  51. package/dist/src/components/collapsible/CollapsibleTrigger.astro +1 -1
  52. package/dist/src/components/dialog/Dialog.astro +1 -1
  53. package/dist/src/components/dialog/DialogClose.astro +1 -1
  54. package/dist/src/components/dialog/DialogContent.astro +2 -2
  55. package/dist/src/components/dialog/DialogDescription.astro +1 -1
  56. package/dist/src/components/dialog/DialogFooter.astro +1 -1
  57. package/dist/src/components/dialog/DialogHeader.astro +1 -1
  58. package/dist/src/components/dialog/DialogTitle.astro +1 -1
  59. package/dist/src/components/dialog/DialogTrigger.astro +1 -1
  60. package/dist/src/components/dropdown/Dropdown.astro +261 -34
  61. package/dist/src/components/dropdown/DropdownContent.astro +41 -5
  62. package/dist/src/components/dropdown/DropdownItem.astro +2 -2
  63. package/dist/src/components/dropdown/DropdownLabel.astro +2 -2
  64. package/dist/src/components/dropdown/DropdownSeparator.astro +1 -1
  65. package/dist/src/components/dropdown/DropdownShortcut.astro +17 -0
  66. package/dist/src/components/dropdown/DropdownSub.astro +15 -0
  67. package/dist/src/components/dropdown/DropdownSubContent.astro +36 -0
  68. package/dist/src/components/dropdown/DropdownSubTrigger.astro +34 -0
  69. package/dist/src/components/dropdown/DropdownTrigger.astro +1 -1
  70. package/dist/src/components/dropdown/index.ts +12 -0
  71. package/dist/src/components/dropzone/DropzoneFilesList.astro +1 -1
  72. package/dist/src/components/image/Image.astro +1 -1
  73. package/dist/src/components/input/Input.astro +1 -1
  74. package/dist/src/components/input-group/InputGroup.astro +28 -0
  75. package/dist/src/components/input-group/InputGroupAddon.astro +79 -0
  76. package/dist/src/components/input-group/InputGroupButton.astro +34 -0
  77. package/dist/src/components/input-group/InputGroupInput.astro +16 -0
  78. package/dist/src/components/input-group/InputGroupText.astro +17 -0
  79. package/dist/src/components/input-group/InputGroupTextarea.astro +20 -0
  80. package/dist/src/components/input-group/index.ts +33 -0
  81. package/dist/src/components/input-otp/InputOtp.astro +1 -1
  82. package/dist/src/components/input-otp/InputOtpGroup.astro +1 -1
  83. package/dist/src/components/input-otp/InputOtpSeparator.astro +1 -1
  84. package/dist/src/components/input-otp/InputOtpSlot.astro +1 -1
  85. package/dist/src/components/item/Item.astro +1 -1
  86. package/dist/src/components/item/ItemActions.astro +1 -1
  87. package/dist/src/components/item/ItemContent.astro +1 -1
  88. package/dist/src/components/item/ItemDescription.astro +1 -1
  89. package/dist/src/components/item/ItemFooter.astro +1 -1
  90. package/dist/src/components/item/ItemGroup.astro +1 -1
  91. package/dist/src/components/item/ItemHeader.astro +1 -1
  92. package/dist/src/components/item/ItemMedia.astro +1 -1
  93. package/dist/src/components/item/ItemSeparator.astro +1 -1
  94. package/dist/src/components/item/ItemTitle.astro +1 -1
  95. package/dist/src/components/kbd/Kbd.astro +1 -1
  96. package/dist/src/components/kbd/KbdGroup.astro +1 -1
  97. package/dist/src/components/label/Label.astro +1 -1
  98. package/dist/src/components/native-select/NativeSelect.astro +64 -0
  99. package/dist/src/components/native-select/NativeSelectOptGroup.astro +15 -0
  100. package/dist/src/components/native-select/NativeSelectOption.astro +15 -0
  101. package/dist/src/components/native-select/index.ts +21 -0
  102. package/dist/src/components/pagination/Pagination.astro +1 -1
  103. package/dist/src/components/pagination/PaginationContent.astro +1 -1
  104. package/dist/src/components/pagination/PaginationEllipsis.astro +1 -1
  105. package/dist/src/components/pagination/PaginationItem.astro +1 -1
  106. package/dist/src/components/pagination/PaginationLink.astro +1 -1
  107. package/dist/src/components/pagination/PaginationNext.astro +1 -1
  108. package/dist/src/components/pagination/PaginationPrevious.astro +1 -1
  109. package/dist/src/components/popover/Popover.astro +717 -0
  110. package/dist/src/components/popover/PopoverContent.astro +102 -0
  111. package/dist/src/components/popover/PopoverDescription.astro +14 -0
  112. package/dist/src/components/popover/PopoverHeader.astro +14 -0
  113. package/dist/src/components/popover/PopoverTitle.astro +14 -0
  114. package/dist/src/components/popover/PopoverTrigger.astro +51 -0
  115. package/dist/src/components/popover/index.ts +34 -0
  116. package/dist/src/components/progress/Progress.astro +1 -1
  117. package/dist/src/components/prose/Prose.astro +1 -1
  118. package/dist/src/components/radio-group/RadioGroup.astro +1 -1
  119. package/dist/src/components/radio-group/RadioGroupItem.astro +1 -1
  120. package/dist/src/components/select/Select.astro +1 -1
  121. package/dist/src/components/select/SelectContent.astro +1 -1
  122. package/dist/src/components/select/SelectItem.astro +1 -1
  123. package/dist/src/components/select/SelectLabel.astro +1 -1
  124. package/dist/src/components/select/SelectSearch.astro +1 -1
  125. package/dist/src/components/select/SelectSeparator.astro +1 -1
  126. package/dist/src/components/select/SelectTrigger.astro +1 -1
  127. package/dist/src/components/select/SelectValue.astro +1 -1
  128. package/dist/src/components/separator/Separator.astro +1 -1
  129. package/dist/src/components/sheet/Sheet.astro +1 -1
  130. package/dist/src/components/sheet/SheetContent.astro +1 -1
  131. package/dist/src/components/sheet/SheetDescription.astro +1 -1
  132. package/dist/src/components/sheet/SheetFooter.astro +1 -1
  133. package/dist/src/components/sheet/SheetHeader.astro +1 -1
  134. package/dist/src/components/sheet/SheetTitle.astro +1 -1
  135. package/dist/src/components/sidebar/Sidebar.astro +19 -2
  136. package/dist/src/components/sidebar/SidebarContent.astro +1 -1
  137. package/dist/src/components/sidebar/SidebarFooter.astro +1 -1
  138. package/dist/src/components/sidebar/SidebarGroup.astro +1 -1
  139. package/dist/src/components/sidebar/SidebarGroupContent.astro +1 -1
  140. package/dist/src/components/sidebar/SidebarGroupLabel.astro +2 -2
  141. package/dist/src/components/sidebar/SidebarHeader.astro +1 -1
  142. package/dist/src/components/sidebar/SidebarInput.astro +1 -1
  143. package/dist/src/components/sidebar/SidebarInset.astro +1 -1
  144. package/dist/src/components/sidebar/SidebarMenu.astro +1 -1
  145. package/dist/src/components/sidebar/SidebarMenuAction.astro +1 -1
  146. package/dist/src/components/sidebar/SidebarMenuBadge.astro +1 -1
  147. package/dist/src/components/sidebar/SidebarMenuButton.astro +2 -14
  148. package/dist/src/components/sidebar/SidebarMenuItem.astro +1 -1
  149. package/dist/src/components/sidebar/SidebarMenuSkeleton.astro +1 -1
  150. package/dist/src/components/sidebar/SidebarMenuSub.astro +1 -1
  151. package/dist/src/components/sidebar/SidebarMenuSubButton.astro +1 -1
  152. package/dist/src/components/sidebar/SidebarMenuSubItem.astro +1 -1
  153. package/dist/src/components/sidebar/SidebarProvider.astro +1 -1
  154. package/dist/src/components/sidebar/SidebarRail.astro +2 -2
  155. package/dist/src/components/sidebar/SidebarSeparator.astro +1 -1
  156. package/dist/src/components/sidebar/SidebarTrigger.astro +1 -1
  157. package/dist/src/components/skeleton/Skeleton.astro +1 -1
  158. package/dist/src/components/slider/Slider.astro +1 -1
  159. package/dist/src/components/spinner/Spinner.astro +1 -1
  160. package/dist/src/components/switch/Switch.astro +1 -1
  161. package/dist/src/components/table/Table.astro +1 -1
  162. package/dist/src/components/table/TableBody.astro +1 -1
  163. package/dist/src/components/table/TableCaption.astro +1 -1
  164. package/dist/src/components/table/TableCell.astro +1 -1
  165. package/dist/src/components/table/TableFoot.astro +1 -1
  166. package/dist/src/components/table/TableHead.astro +1 -1
  167. package/dist/src/components/table/TableHeader.astro +1 -1
  168. package/dist/src/components/table/TableRow.astro +1 -1
  169. package/dist/src/components/tabs/Tabs.astro +1 -1
  170. package/dist/src/components/tabs/TabsContent.astro +1 -1
  171. package/dist/src/components/tabs/TabsList.astro +1 -1
  172. package/dist/src/components/tabs/TabsTrigger.astro +1 -1
  173. package/dist/src/components/textarea/Textarea.astro +1 -1
  174. package/dist/src/components/theme-toggle/ThemeToggle.astro +1 -1
  175. package/dist/src/components/toast/ToastDescription.astro +1 -1
  176. package/dist/src/components/toast/ToastItem.astro +1 -1
  177. package/dist/src/components/toast/Toaster.astro +1 -1
  178. package/dist/src/components/toggle/Toggle.astro +1 -1
  179. package/dist/src/components/tooltip/Tooltip.astro +260 -122
  180. package/dist/src/components/tooltip/TooltipContent.astro +13 -23
  181. package/dist/src/components/video/Video.astro +2 -2
  182. package/dist/src/lib/utils/starwind/positioning.ts +318 -0
  183. package/package.json +1 -1
@@ -0,0 +1,34 @@
1
+ ---
2
+ import ChevronRight from "@tabler/icons/outline/chevron-right.svg";
3
+ import type { HTMLAttributes } from "astro/types";
4
+
5
+ import { dropdownItem } from "./DropdownItem.astro";
6
+
7
+ type Props = HTMLAttributes<"div"> & {
8
+ /**
9
+ * Whether the item is inset (has left padding)
10
+ */
11
+ inset?: boolean;
12
+ /**
13
+ * Whether the item is disabled
14
+ */
15
+ disabled?: boolean;
16
+ };
17
+
18
+ const { class: className, inset = false, disabled = false, ...rest } = Astro.props;
19
+ ---
20
+
21
+ <div
22
+ class={dropdownItem({ inset, disabled, class: ["starwind-dropdown-sub-trigger", className] })}
23
+ role="menuitem"
24
+ aria-haspopup="true"
25
+ aria-expanded="false"
26
+ tabindex={disabled ? "-1" : "0"}
27
+ data-disabled={disabled ? "true" : undefined}
28
+ data-sub-trigger
29
+ {...rest}
30
+ data-slot="dropdown-item"
31
+ >
32
+ <slot />
33
+ <ChevronRight class="ml-auto size-4" />
34
+ </div>
@@ -43,8 +43,8 @@ if (Astro.slots.has("default")) {
43
43
  aria-haspopup="true"
44
44
  aria-expanded="false"
45
45
  data-state="closed"
46
- data-slot="dropdown-trigger"
47
46
  {...rest}
47
+ data-slot="dropdown-trigger"
48
48
  >
49
49
  <slot />
50
50
  </button>
@@ -3,6 +3,10 @@ import DropdownContent, { dropdownContent } from "./DropdownContent.astro";
3
3
  import DropdownItem, { dropdownItem } from "./DropdownItem.astro";
4
4
  import DropdownLabel, { dropdownLabel } from "./DropdownLabel.astro";
5
5
  import DropdownSeparator, { dropdownSeparator } from "./DropdownSeparator.astro";
6
+ import DropdownShortcut from "./DropdownShortcut.astro";
7
+ import DropdownSub from "./DropdownSub.astro";
8
+ import DropdownSubContent from "./DropdownSubContent.astro";
9
+ import DropdownSubTrigger from "./DropdownSubTrigger.astro";
6
10
  import DropdownTrigger, { dropdownTrigger } from "./DropdownTrigger.astro";
7
11
 
8
12
  const DropdownVariants = {
@@ -19,6 +23,10 @@ export {
19
23
  DropdownItem,
20
24
  DropdownLabel,
21
25
  DropdownSeparator,
26
+ DropdownShortcut,
27
+ DropdownSub,
28
+ DropdownSubContent,
29
+ DropdownSubTrigger,
22
30
  DropdownTrigger,
23
31
  DropdownVariants,
24
32
  };
@@ -30,4 +38,8 @@ export default {
30
38
  Item: DropdownItem,
31
39
  Label: DropdownLabel,
32
40
  Separator: DropdownSeparator,
41
+ Shortcut: DropdownShortcut,
42
+ Sub: DropdownSub,
43
+ SubTrigger: DropdownSubTrigger,
44
+ SubContent: DropdownSubContent,
33
45
  };
@@ -20,7 +20,7 @@ export const dropzoneFilesList = tv({
20
20
  class={dropzoneFilesList({ class: className })}
21
21
  aria-live="polite"
22
22
  aria-label="Uploaded files"
23
- data-slot="dropzone-files-list"
24
23
  {...rest}
24
+ data-slot="dropzone-files-list"
25
25
  >
26
26
  </div>
@@ -17,8 +17,8 @@ const { class: className, src, alt = "", inferSize = true, ...rest } = Astro.pro
17
17
  src={src}
18
18
  alt={alt}
19
19
  inferSize={inferSize}
20
- data-slot="image"
21
20
  {...(rest as any)}
21
+ data-slot="image"
22
22
  />
23
23
  )
24
24
  }
@@ -22,4 +22,4 @@ export const input = tv({
22
22
  const { size, class: className, ...rest } = Astro.props;
23
23
  ---
24
24
 
25
- <input class={input({ size, class: className })} data-slot="input" {...rest} />
25
+ <input class={input({ size, class: className })} {...rest} data-slot="input" />
@@ -0,0 +1,28 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = HTMLAttributes<"div">;
6
+
7
+ export const inputGroup = tv({
8
+ base: [
9
+ "border-input dark:bg-input/30 group/input-group relative flex h-11 w-full min-w-0 items-center rounded-lg border transition-colors outline-none",
10
+ "has-[[data-slot=input-group-control]:focus-visible]:border-outline has-[[data-slot=input-group-control]:focus-visible]:ring-outline/50 has-[[data-slot=input-group-control]:focus-visible]:ring-3",
11
+ "has-[[data-slot][aria-invalid=true]]:border-error has-[[data-slot][aria-invalid=true]]:ring-error/40 has-[[data-slot][aria-invalid=true]]:ring-3",
12
+ "has-disabled:bg-input/50 has-disabled:opacity-50",
13
+ "has-[>textarea]:h-auto",
14
+ "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col",
15
+ "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col",
16
+ "has-[>[data-align=block-end]]:[&>[data-slot=input-group-control]]:pt-3",
17
+ "has-[>[data-align=block-start]]:[&>[data-slot=input-group-control]]:pb-3",
18
+ "has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:pr-1.5",
19
+ "has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:pl-1.5",
20
+ ],
21
+ });
22
+
23
+ const { class: className, ...rest } = Astro.props;
24
+ ---
25
+
26
+ <div role="group" class={inputGroup({ class: className })} {...rest} data-slot="input-group">
27
+ <slot />
28
+ </div>
@@ -0,0 +1,79 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv, type VariantProps } from "tailwind-variants";
4
+
5
+ type Props = HTMLAttributes<"div"> & VariantProps<typeof inputGroupAddon>;
6
+
7
+ export const inputGroupAddon = tv({
8
+ base: [
9
+ "text-muted-foreground flex cursor-text items-center justify-center gap-2 text-sm font-medium select-none",
10
+ "group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-xs [&>svg:not([class*='size-'])]:size-4",
11
+ ],
12
+ variants: {
13
+ align: {
14
+ "inline-start": "order-first pl-2.5 has-[>button]:ml-[-0.3rem]",
15
+ "inline-end": "order-last pr-2.5 has-[>button]:mr-[-0.3rem]",
16
+ "block-start":
17
+ "order-first w-full justify-start px-3 pt-2 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-2.5",
18
+ "block-end":
19
+ "order-last w-full justify-start px-3 pb-2 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-2.5",
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ align: "inline-start",
24
+ },
25
+ });
26
+
27
+ const { align, class: className, ...rest } = Astro.props;
28
+ ---
29
+
30
+ <div
31
+ role="group"
32
+ data-align={align}
33
+ class={inputGroupAddon({ align, class: className })}
34
+ {...rest}
35
+ data-slot="input-group-addon"
36
+ >
37
+ <slot />
38
+ </div>
39
+
40
+ <script>
41
+ class InputGroupAddonHandler {
42
+ private addon: HTMLElement;
43
+
44
+ constructor(addon: HTMLElement) {
45
+ this.addon = addon;
46
+ this.setupEventListeners();
47
+ }
48
+
49
+ private setupEventListeners(): void {
50
+ this.addon.addEventListener("click", (e) => this.handleClick(e));
51
+ }
52
+
53
+ private handleClick(e: MouseEvent): void {
54
+ if ((e.target as HTMLElement).closest("button")) return;
55
+
56
+ const input = this.addon.parentElement?.querySelector("input, textarea") as
57
+ | HTMLInputElement
58
+ | HTMLTextAreaElement;
59
+
60
+ if (input) {
61
+ input.focus();
62
+ }
63
+ }
64
+ }
65
+
66
+ const addonInstances = new WeakMap<HTMLElement, InputGroupAddonHandler>();
67
+
68
+ const setupAddons = () => {
69
+ document.querySelectorAll<HTMLElement>('[data-slot="input-group-addon"]').forEach((addon) => {
70
+ if (!addonInstances.has(addon)) {
71
+ addonInstances.set(addon, new InputGroupAddonHandler(addon));
72
+ }
73
+ });
74
+ };
75
+
76
+ setupAddons();
77
+ document.addEventListener("astro:after-swap", setupAddons);
78
+ document.addEventListener("starwind:init", setupAddons);
79
+ </script>
@@ -0,0 +1,34 @@
1
+ ---
2
+ import type { ComponentProps } from "astro/types";
3
+ import { tv, type VariantProps } from "tailwind-variants";
4
+
5
+ import { Button } from "@/components/starwind/button";
6
+
7
+ type Props = Omit<ComponentProps<typeof Button>, "size"> & VariantProps<typeof inputGroupButton>;
8
+
9
+ export const inputGroupButton = tv({
10
+ base: "gap-2 rounded-sm shadow-none",
11
+ variants: {
12
+ size: {
13
+ sm: "h-8 px-2",
14
+ "icon-sm": "size-8 p-0 has-[>svg]:p-0",
15
+ },
16
+ },
17
+ defaultVariants: {
18
+ size: "sm",
19
+ },
20
+ });
21
+
22
+ const { type = "button", variant = "ghost", size, class: className, ...rest } = Astro.props;
23
+ ---
24
+
25
+ <Button
26
+ type={type}
27
+ data-size={size}
28
+ size={size}
29
+ variant={variant}
30
+ class={inputGroupButton({ size, class: className })}
31
+ {...rest}
32
+ >
33
+ <slot />
34
+ </Button>
@@ -0,0 +1,16 @@
1
+ ---
2
+ import type { ComponentProps } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ import { Input } from "@/components/starwind/input";
6
+
7
+ type Props = ComponentProps<typeof Input>;
8
+
9
+ export const inputGroupInput = tv({
10
+ base: "h-full flex-1 rounded-none border-0 shadow-none ring-0 outline-none focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",
11
+ });
12
+
13
+ const { class: className, ...rest } = Astro.props;
14
+ ---
15
+
16
+ <Input class={inputGroupInput({ class: className })} {...rest} data-slot="input-group-control" />
@@ -0,0 +1,17 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+
4
+ type Props = HTMLAttributes<"span">;
5
+
6
+ const { class: className, ...rest } = Astro.props;
7
+ ---
8
+
9
+ <span
10
+ class:list={[
11
+ "text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4.5",
12
+ className,
13
+ ]}
14
+ {...rest}
15
+ >
16
+ <slot />
17
+ </span>
@@ -0,0 +1,20 @@
1
+ ---
2
+ import type { ComponentProps } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ import { Textarea } from "@/components/starwind/textarea";
6
+
7
+ type Props = ComponentProps<typeof Textarea>;
8
+
9
+ export const inputGroupTextarea = tv({
10
+ base: "h-full flex-1 resize-none rounded-none border-0 shadow-none ring-0 outline-none focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",
11
+ });
12
+
13
+ const { class: className, ...rest } = Astro.props;
14
+ ---
15
+
16
+ <Textarea
17
+ class={inputGroupTextarea({ class: className })}
18
+ {...rest}
19
+ data-slot="input-group-control"
20
+ />
@@ -0,0 +1,33 @@
1
+ import InputGroup, { inputGroup } from "./InputGroup.astro";
2
+ import InputGroupAddon, { inputGroupAddon } from "./InputGroupAddon.astro";
3
+ import InputGroupButton, { inputGroupButton } from "./InputGroupButton.astro";
4
+ import InputGroupInput, { inputGroupInput } from "./InputGroupInput.astro";
5
+ import InputGroupText from "./InputGroupText.astro";
6
+ import InputGroupTextarea, { inputGroupTextarea } from "./InputGroupTextarea.astro";
7
+
8
+ const InputGroupVariants = {
9
+ inputGroup,
10
+ inputGroupAddon,
11
+ inputGroupButton,
12
+ inputGroupInput,
13
+ inputGroupTextarea,
14
+ };
15
+
16
+ export {
17
+ InputGroup,
18
+ InputGroupAddon,
19
+ InputGroupButton,
20
+ InputGroupInput,
21
+ InputGroupText,
22
+ InputGroupTextarea,
23
+ InputGroupVariants,
24
+ };
25
+
26
+ export default {
27
+ Root: InputGroup,
28
+ Addon: InputGroupAddon,
29
+ Button: InputGroupButton,
30
+ Input: InputGroupInput,
31
+ Text: InputGroupText,
32
+ Textarea: InputGroupTextarea,
33
+ };
@@ -51,9 +51,9 @@ const inputMode = isNumericOnly ? "numeric" : "text";
51
51
  data-value={value || defaultValue || ""}
52
52
  data-disabled={disabled}
53
53
  data-pattern={patternStr}
54
- data-slot="input-otp"
55
54
  tabindex={disabled ? "-1" : "0"}
56
55
  {...rest}
56
+ data-slot="input-otp"
57
57
  >
58
58
  <input
59
59
  autocomplete="one-time-code"
@@ -11,6 +11,6 @@ export const inputOtpGroup = tv({
11
11
  const { class: className, ...rest } = Astro.props;
12
12
  ---
13
13
 
14
- <div class={inputOtpGroup({ class: className })} data-slot="input-otp-group" {...rest}>
14
+ <div class={inputOtpGroup({ class: className })} {...rest} data-slot="input-otp-group">
15
15
  <slot />
16
16
  </div>
@@ -15,9 +15,9 @@ const { class: className, ...rest } = Astro.props;
15
15
  <div
16
16
  aria-hidden="true"
17
17
  class={inputOtpSeparator({ class: className })}
18
- data-slot="input-otp-separator"
19
18
  role="separator"
20
19
  {...rest}
20
+ data-slot="input-otp-separator"
21
21
  >
22
22
  <slot name="icon">
23
23
  <MinusIcon class="size-6" />
@@ -33,8 +33,8 @@ const { size, index, class: className, ...rest } = Astro.props;
33
33
  class={inputOtpSlot({ size, class: className })}
34
34
  data-otp-slot
35
35
  data-index={index}
36
- data-slot="input-otp-slot"
37
36
  {...rest}
37
+ data-slot="input-otp-slot"
38
38
  >
39
39
  <span data-otp-char></span>
40
40
  <div
@@ -47,6 +47,6 @@ const {
47
47
  } = Astro.props;
48
48
  ---
49
49
 
50
- <Tag class={item({ variant, size, class: className })} data-slot="item" {...rest}>
50
+ <Tag class={item({ variant, size, class: className })} {...rest} data-slot="item">
51
51
  <slot />
52
52
  </Tag>
@@ -11,6 +11,6 @@ export const itemActions = tv({
11
11
  const { class: className, ...rest } = Astro.props;
12
12
  ---
13
13
 
14
- <div class={itemActions({ class: className })} data-slot="item-actions" {...rest}>
14
+ <div class={itemActions({ class: className })} {...rest} data-slot="item-actions">
15
15
  <slot />
16
16
  </div>
@@ -11,6 +11,6 @@ export const itemContent = tv({
11
11
  const { class: className, ...rest } = Astro.props;
12
12
  ---
13
13
 
14
- <div class={itemContent({ class: className })} data-slot="item-content" {...rest}>
14
+ <div class={itemContent({ class: className })} {...rest} data-slot="item-content">
15
15
  <slot />
16
16
  </div>
@@ -14,6 +14,6 @@ export const itemDescription = tv({
14
14
  const { class: className, ...rest } = Astro.props;
15
15
  ---
16
16
 
17
- <p class={itemDescription({ class: className })} data-slot="item-description" {...rest}>
17
+ <p class={itemDescription({ class: className })} {...rest} data-slot="item-description">
18
18
  <slot />
19
19
  </p>
@@ -11,6 +11,6 @@ export const itemFooter = tv({
11
11
  const { class: className, ...rest } = Astro.props;
12
12
  ---
13
13
 
14
- <div class={itemFooter({ class: className })} data-slot="item-footer" {...rest}>
14
+ <div class={itemFooter({ class: className })} {...rest} data-slot="item-footer">
15
15
  <slot />
16
16
  </div>
@@ -11,6 +11,6 @@ export const itemGroup = tv({
11
11
  const { class: className, ...rest } = Astro.props;
12
12
  ---
13
13
 
14
- <div role="list" class={itemGroup({ class: className })} data-slot="item-group" {...rest}>
14
+ <div role="list" class={itemGroup({ class: className })} {...rest} data-slot="item-group">
15
15
  <slot />
16
16
  </div>
@@ -11,6 +11,6 @@ export const itemHeader = tv({
11
11
  const { class: className, ...rest } = Astro.props;
12
12
  ---
13
13
 
14
- <div class={itemHeader({ class: className })} data-slot="item-header" {...rest}>
14
+ <div class={itemHeader({ class: className })} {...rest} data-slot="item-header">
15
15
  <slot />
16
16
  </div>
@@ -32,9 +32,9 @@ const { variant = "default", class: className, ...rest } = Astro.props;
32
32
 
33
33
  <div
34
34
  class={itemMedia({ variant, class: className })}
35
- data-slot="item-media"
36
35
  data-variant={variant}
37
36
  {...rest}
37
+ data-slot="item-media"
38
38
  >
39
39
  <slot />
40
40
  </div>
@@ -16,6 +16,6 @@ const { class: className, orientation = "horizontal", ...rest } = Astro.props;
16
16
  <Separator
17
17
  orientation={orientation}
18
18
  class={itemSeparator({ class: className })}
19
- data-slot="item-separator"
20
19
  {...rest}
20
+ data-slot="item-separator"
21
21
  />
@@ -11,6 +11,6 @@ export const itemTitle = tv({
11
11
  const { class: className, ...rest } = Astro.props;
12
12
  ---
13
13
 
14
- <div class={itemTitle({ class: className })} data-slot="item-title" {...rest}>
14
+ <div class={itemTitle({ class: className })} {...rest} data-slot="item-title">
15
15
  <slot />
16
16
  </div>
@@ -16,6 +16,6 @@ export const kbd = tv({
16
16
  const { class: className, ...rest } = Astro.props;
17
17
  ---
18
18
 
19
- <kbd class={kbd({ class: className })} data-slot="kbd" {...rest}>
19
+ <kbd class={kbd({ class: className })} {...rest} data-slot="kbd">
20
20
  <slot />
21
21
  </kbd>
@@ -11,6 +11,6 @@ export const kbdGroup = tv({
11
11
  const { class: className, ...rest } = Astro.props;
12
12
  ---
13
13
 
14
- <kbd class={kbdGroup({ class: className })} data-slot="kbd-group" {...rest}>
14
+ <kbd class={kbdGroup({ class: className })} {...rest} data-slot="kbd-group">
15
15
  <slot />
16
16
  </kbd>
@@ -17,6 +17,6 @@ const { size, class: className, ...rest } = Astro.props;
17
17
  ---
18
18
 
19
19
  {/* eslint-disable-next-line astro/jsx-a11y/label-has-associated-control */}
20
- <label class={label({ size, class: className })} data-slot="label" {...rest}>
20
+ <label class={label({ size, class: className })} {...rest} data-slot="label">
21
21
  <slot />
22
22
  </label>
@@ -0,0 +1,64 @@
1
+ ---
2
+ import ChevronDown from "@tabler/icons/outline/chevron-down.svg";
3
+ import type { HTMLAttributes } from "astro/types";
4
+ import { tv, type VariantProps } from "tailwind-variants";
5
+
6
+ type Props = Omit<HTMLAttributes<"select">, "size"> & VariantProps<typeof nativeSelect>;
7
+
8
+ export const nativeSelectWrapper = tv({
9
+ base: [
10
+ "starwind-native-select-wrapper",
11
+ "group/native-select relative w-fit has-[select:disabled]:opacity-50",
12
+ ],
13
+ });
14
+
15
+ export const nativeSelect = tv({
16
+ base: [
17
+ "starwind-native-select",
18
+ "border-input dark:bg-input/30 text-foreground ring-offset-background w-full rounded-md border bg-transparent shadow-xs",
19
+ "placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground appearance-none bg-none select-none",
20
+ "focus-visible:border-outline focus-visible:ring-outline/50 transition-[color,box-shadow] outline-none focus-visible:ring-3",
21
+ "disabled:pointer-events-none disabled:cursor-not-allowed",
22
+ "aria-invalid:border-error aria-invalid:focus-visible:ring-error/40 aria-invalid:focus-visible:ring-3",
23
+ ],
24
+ variants: {
25
+ size: {
26
+ sm: "h-9 pr-8 pl-2 text-sm",
27
+ md: "h-11 pr-9 pl-3 text-base",
28
+ lg: "h-12 pr-10 pl-4 text-lg",
29
+ },
30
+ },
31
+ defaultVariants: {
32
+ size: "md",
33
+ },
34
+ });
35
+
36
+ export const nativeSelectIcon = tv({
37
+ base: ["text-foreground pointer-events-none absolute top-1/2 -translate-y-1/2 opacity-50"],
38
+ variants: {
39
+ size: {
40
+ sm: "right-2 size-3.5",
41
+ md: "right-3 size-4",
42
+ lg: "right-4 size-5",
43
+ },
44
+ },
45
+ defaultVariants: {
46
+ size: "md",
47
+ },
48
+ });
49
+
50
+ const { class: className, size, ...rest } = Astro.props;
51
+ ---
52
+
53
+ <div class={nativeSelectWrapper()} data-size={size} data-slot="native-select-wrapper">
54
+ <select class={nativeSelect({ size, class: className })} {...rest} data-slot="native-select">
55
+ <slot />
56
+ </select>
57
+ <slot name="icon">
58
+ <ChevronDown
59
+ class={nativeSelectIcon({ size })}
60
+ aria-hidden="true"
61
+ data-slot="native-select-icon"
62
+ />
63
+ </slot>
64
+ </div>
@@ -0,0 +1,15 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+
4
+ type Props = HTMLAttributes<"optgroup">;
5
+
6
+ const { class: className, ...rest } = Astro.props;
7
+ ---
8
+
9
+ <optgroup
10
+ class:list={["starwind-native-select-optgroup", className]}
11
+ {...rest}
12
+ data-slot="native-select-optgroup"
13
+ >
14
+ <slot />
15
+ </optgroup>
@@ -0,0 +1,15 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+
4
+ type Props = HTMLAttributes<"option">;
5
+
6
+ const { class: className, ...rest } = Astro.props;
7
+ ---
8
+
9
+ <option
10
+ class:list={["starwind-native-select-option", className]}
11
+ {...rest}
12
+ data-slot="native-select-option"
13
+ >
14
+ <slot />
15
+ </option>
@@ -0,0 +1,21 @@
1
+ import NativeSelect, {
2
+ nativeSelect,
3
+ nativeSelectIcon,
4
+ nativeSelectWrapper,
5
+ } from "./NativeSelect.astro";
6
+ import NativeSelectOptGroup from "./NativeSelectOptGroup.astro";
7
+ import NativeSelectOption from "./NativeSelectOption.astro";
8
+
9
+ const NativeSelectVariants = {
10
+ nativeSelect,
11
+ nativeSelectIcon,
12
+ nativeSelectWrapper,
13
+ };
14
+
15
+ export { NativeSelect, NativeSelectOptGroup, NativeSelectOption, NativeSelectVariants };
16
+
17
+ export default {
18
+ Root: NativeSelect,
19
+ Option: NativeSelectOption,
20
+ OptGroup: NativeSelectOptGroup,
21
+ };
@@ -13,8 +13,8 @@ const { class: className, ...rest } = Astro.props;
13
13
  role="navigation"
14
14
  aria-label="pagination"
15
15
  class={pagination({ class: className })}
16
- data-slot="pagination"
17
16
  {...rest}
17
+ data-slot="pagination"
18
18
  >
19
19
  <slot />
20
20
  </nav>
@@ -11,6 +11,6 @@ export const paginationContent = tv({ base: "flex flex-row items-center gap-1" }
11
11
  const { class: className, ...rest } = Astro.props;
12
12
  ---
13
13
 
14
- <ul class={paginationContent({ class: className })} data-slot="pagination-content" {...rest}>
14
+ <ul class={paginationContent({ class: className })} {...rest} data-slot="pagination-content">
15
15
  <slot />
16
16
  </ul>
@@ -23,8 +23,8 @@ const { class: className, size, ...rest } = Astro.props;
23
23
  <span
24
24
  aria-hidden
25
25
  class={paginationEllipsis({ size, class: className })}
26
- data-slot="pagination-ellipsis"
27
26
  {...rest}
27
+ data-slot="pagination-ellipsis"
28
28
  >
29
29
  <slot name="icon">
30
30
  <Dots class="size-4" />