@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,102 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = HTMLAttributes<"div"> & {
6
+ /**
7
+ * Side of the popover
8
+ * @default bottom
9
+ */
10
+ side?: "top" | "bottom" | "left" | "right";
11
+ /**
12
+ * Alignment of the popover
13
+ * @default center
14
+ */
15
+ align?: "start" | "center" | "end";
16
+ /**
17
+ * Offset distance in pixels
18
+ * @default 4
19
+ */
20
+ sideOffset?: number;
21
+ /**
22
+ * Open and close animation duration in milliseconds
23
+ * @default 150
24
+ */
25
+ animationDuration?: number;
26
+ /**
27
+ * Accessible name for the dialog when a PopoverTitle is not present.
28
+ * If neither aria-label nor aria-labelledby is provided, a fallback label is applied.
29
+ */
30
+ "aria-label"?: string;
31
+ };
32
+
33
+ export const popoverContent = tv({
34
+ base: [
35
+ "starwind-popover-content",
36
+ "bg-popover text-popover-foreground z-50 flex w-72 flex-col gap-2.5 overflow-x-hidden overflow-y-auto rounded-lg border p-2.5 shadow-md",
37
+ "data-[state=open]:animate-in fade-in zoom-in-95",
38
+ "data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards fade-out zoom-out-95",
39
+ "fixed isolate will-change-transform",
40
+ ],
41
+ variants: {
42
+ side: {
43
+ bottom: "slide-in-from-top-2 slide-out-to-top-2",
44
+ top: "slide-in-from-bottom-2 slide-out-to-bottom-2",
45
+ right: "slide-in-from-left-2 slide-out-to-left-2",
46
+ left: "slide-in-from-right-2 slide-out-to-right-2",
47
+ },
48
+ align: {
49
+ start: "",
50
+ center: "",
51
+ end: "",
52
+ },
53
+ },
54
+ compoundVariants: [
55
+ {
56
+ side: ["top", "bottom"],
57
+ align: "start",
58
+ class: "slide-in-from-left-1 slide-out-to-left-1",
59
+ },
60
+ {
61
+ side: ["top", "bottom"],
62
+ align: "end",
63
+ class: "slide-in-from-right-1 slide-out-to-right-1",
64
+ },
65
+ ],
66
+ defaultVariants: {
67
+ side: "bottom",
68
+ align: "center",
69
+ },
70
+ });
71
+
72
+ const {
73
+ class: className,
74
+ side = "bottom",
75
+ align = "center",
76
+ sideOffset = 4,
77
+ animationDuration = 150,
78
+ "aria-label": ariaLabel,
79
+ "aria-labelledby": ariaLabelledBy,
80
+ ...rest
81
+ } = Astro.props;
82
+ ---
83
+
84
+ <div
85
+ class={popoverContent({ side, align, class: className })}
86
+ data-side={side}
87
+ data-align={align}
88
+ data-side-offset={sideOffset}
89
+ data-state="closed"
90
+ role="dialog"
91
+ aria-label={ariaLabel ?? (ariaLabelledBy ? undefined : "Popover dialog")}
92
+ aria-labelledby={ariaLabelledBy}
93
+ tabindex="-1"
94
+ style={{
95
+ display: "none",
96
+ animationDuration: `${animationDuration}ms`,
97
+ }}
98
+ {...rest}
99
+ data-slot="popover-content"
100
+ >
101
+ <slot />
102
+ </div>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = HTMLAttributes<"p">;
6
+
7
+ export const popoverDescription = tv({ base: "text-muted-foreground" });
8
+
9
+ const { class: className, ...rest } = Astro.props;
10
+ ---
11
+
12
+ <p class={popoverDescription({ class: className })} {...rest} data-slot="popover-description">
13
+ <slot />
14
+ </p>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = HTMLAttributes<"div">;
6
+
7
+ export const popoverHeader = tv({ base: "flex flex-col gap-1" });
8
+
9
+ const { class: className, ...rest } = Astro.props;
10
+ ---
11
+
12
+ <div class={popoverHeader({ class: className })} {...rest} data-slot="popover-header">
13
+ <slot />
14
+ </div>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = HTMLAttributes<"h3">;
6
+
7
+ export const popoverTitle = tv({ base: "font-medium" });
8
+
9
+ const { class: className, ...rest } = Astro.props;
10
+ ---
11
+
12
+ <h3 class={popoverTitle({ class: className })} {...rest} data-slot="popover-title">
13
+ <slot />
14
+ </h3>
@@ -0,0 +1,51 @@
1
+ ---
2
+ import type { HTMLAttributes } from "astro/types";
3
+ import { tv } from "tailwind-variants";
4
+
5
+ type Props = Omit<HTMLAttributes<"button">, "role" | "type"> & {
6
+ /**
7
+ * When true, the component will render its child element with a simple wrapper instead of a button component
8
+ */
9
+ asChild?: boolean;
10
+ };
11
+
12
+ export const popoverTrigger = tv({
13
+ base: [
14
+ "starwind-popover-trigger",
15
+ "inline-flex items-center justify-center",
16
+ "focus-visible:ring-outline/50 transition-[color,box-shadow] outline-none focus-visible:ring-3",
17
+ "disabled:pointer-events-none",
18
+ ],
19
+ });
20
+
21
+ const { class: className, asChild = false, ...rest } = Astro.props;
22
+
23
+ let hasChildren = false;
24
+ if (Astro.slots.has("default")) {
25
+ hasChildren = true;
26
+ }
27
+ ---
28
+
29
+ {
30
+ asChild && hasChildren ? (
31
+ <div
32
+ class:list={["starwind-popover-trigger", className]}
33
+ data-slot="popover-trigger"
34
+ data-as-child
35
+ >
36
+ <slot />
37
+ </div>
38
+ ) : (
39
+ <button
40
+ class={popoverTrigger({ class: className })}
41
+ type="button"
42
+ aria-haspopup="dialog"
43
+ aria-expanded="false"
44
+ data-state="closed"
45
+ {...rest}
46
+ data-slot="popover-trigger"
47
+ >
48
+ <slot />
49
+ </button>
50
+ )
51
+ }
@@ -0,0 +1,34 @@
1
+ import Popover, { popover } from "./Popover.astro";
2
+ import PopoverContent, { popoverContent } from "./PopoverContent.astro";
3
+ import PopoverDescription, { popoverDescription } from "./PopoverDescription.astro";
4
+ import PopoverHeader, { popoverHeader } from "./PopoverHeader.astro";
5
+ import PopoverTitle, { popoverTitle } from "./PopoverTitle.astro";
6
+ import PopoverTrigger, { popoverTrigger } from "./PopoverTrigger.astro";
7
+
8
+ const PopoverVariants = {
9
+ popover,
10
+ popoverContent,
11
+ popoverDescription,
12
+ popoverHeader,
13
+ popoverTitle,
14
+ popoverTrigger,
15
+ };
16
+
17
+ export {
18
+ Popover,
19
+ PopoverContent,
20
+ PopoverDescription,
21
+ PopoverHeader,
22
+ PopoverTitle,
23
+ PopoverTrigger,
24
+ PopoverVariants,
25
+ };
26
+
27
+ export default {
28
+ Root: Popover,
29
+ Trigger: PopoverTrigger,
30
+ Content: PopoverContent,
31
+ Header: PopoverHeader,
32
+ Title: PopoverTitle,
33
+ Description: PopoverDescription,
34
+ };
@@ -80,8 +80,8 @@ const indicatorStyle = isIndeterminate
80
80
  data-value={value}
81
81
  data-max={max}
82
82
  data-indeterminate={isIndeterminate}
83
- data-slot="progress"
84
83
  {...rest}
84
+ data-slot="progress"
85
85
  >
86
86
  <div class:list={[indicatorClasses]} style={indicatorStyle}></div>
87
87
  </div>
@@ -11,7 +11,7 @@ type Props = HTMLAttributes<"div">;
11
11
  const { class: className, ...rest } = Astro.props;
12
12
  ---
13
13
 
14
- <div class:list={[prose({ class: className })]} data-slot="prose" {...rest}><slot /></div>
14
+ <div class:list={[prose({ class: className })]} {...rest} data-slot="prose"><slot /></div>
15
15
 
16
16
  <style is:global>
17
17
  /* ==========================================================================
@@ -53,8 +53,8 @@ const {
53
53
  class:list={[radioGroup({ orientation, class: className })]}
54
54
  data-value={value || defaultValue}
55
55
  disabled={disabled}
56
- data-slot="radio-group"
57
56
  {...rest}
57
+ data-slot="radio-group"
58
58
  >
59
59
  {legend && <legend class="sr-only">{legend}</legend>}
60
60
  <slot />
@@ -118,8 +118,8 @@ const {
118
118
  value={value}
119
119
  checked={checked}
120
120
  disabled={disabled}
121
- data-slot="radio-group-item"
122
121
  {...rest}
122
+ data-slot="radio-group-item"
123
123
  />
124
124
  <span class={radioControl({ variant, class: className })} data-slot="radio-group-item-control">
125
125
  <slot name="icon">
@@ -26,8 +26,8 @@ const { class: className, name, defaultValue, required, ...rest } = Astro.props;
26
26
  data-name={name}
27
27
  data-value={defaultValue}
28
28
  data-required={required}
29
- data-slot="select"
30
29
  {...rest}
30
+ data-slot="select"
31
31
  >
32
32
  <slot />
33
33
  </div>
@@ -77,7 +77,6 @@ const {
77
77
  data-side={side}
78
78
  data-align={align}
79
79
  data-state="closed"
80
- data-slot="select-content"
81
80
  tabindex="-1"
82
81
  style={{
83
82
  // hide the content initially. Script will remove this
@@ -87,6 +86,7 @@ const {
87
86
  marginBottom: side === "top" ? `${sideOffset}px` : undefined,
88
87
  }}
89
88
  {...rest}
89
+ data-slot="select-content"
90
90
  >
91
91
  <div class={selectContentInner()}>
92
92
  <slot />
@@ -34,11 +34,11 @@ const { class: className, value, disabled, ...rest } = Astro.props;
34
34
  class={selectItem({ class: className })}
35
35
  data-value={value}
36
36
  data-disabled={disabled}
37
- data-slot="select-item"
38
37
  aria-selected="false"
39
38
  role="option"
40
39
  tabindex="0"
41
40
  {...rest}
41
+ data-slot="select-item"
42
42
  >
43
43
  <span>
44
44
  <slot />
@@ -9,6 +9,6 @@ export const selectLabel = tv({ base: "text-muted-foreground py-1.5 pr-8 pl-2" }
9
9
  const { class: className, ...rest } = Astro.props;
10
10
  ---
11
11
 
12
- <div class={selectLabel({ class: className })} data-slot="select-label" {...rest}>
12
+ <div class={selectLabel({ class: className })} {...rest} data-slot="select-label">
13
13
  <slot />
14
14
  </div>
@@ -36,11 +36,11 @@ const {
36
36
  <input
37
37
  type="text"
38
38
  class={selectSearch({ class: className })}
39
- data-slot="select-search"
40
39
  placeholder={placeholder}
41
40
  autocomplete="off"
42
41
  aria-label={placeholder}
43
42
  {...rest}
43
+ data-slot="select-search"
44
44
  />
45
45
  </div>
46
46
 
@@ -9,4 +9,4 @@ export const selectSeparator = tv({ base: "bg-muted -mx-1 my-1 h-px" });
9
9
  const { class: className, ...rest } = Astro.props;
10
10
  ---
11
11
 
12
- <div class={selectSeparator({ class: className })} data-slot="select-separator" {...rest}></div>
12
+ <div class={selectSeparator({ class: className })} {...rest} data-slot="select-separator"></div>
@@ -44,8 +44,8 @@ const { class: className, size, ...rest } = Astro.props;
44
44
  aria-haspopup="listbox"
45
45
  aria-autocomplete="none"
46
46
  data-state="closed"
47
- data-slot="select-trigger"
48
47
  {...rest}
48
+ data-slot="select-trigger"
49
49
  >
50
50
  <slot />
51
51
  <slot name="icon">
@@ -14,6 +14,6 @@ export const selectValue = tv({ base: "pointer-events-none" });
14
14
  const { placeholder = "select", class: className, ...rest } = Astro.props;
15
15
  ---
16
16
 
17
- <span class={selectValue({ class: className })} data-slot="select-value" {...rest}>
17
+ <span class={selectValue({ class: className })} {...rest} data-slot="select-value">
18
18
  {placeholder}
19
19
  </span>
@@ -30,7 +30,7 @@ const { class: className, orientation = "horizontal", ...rest } = Astro.props;
30
30
  role="separator"
31
31
  aria-orientation={orientation}
32
32
  class={separator({ orientation, class: className })}
33
- data-slot="separator"
34
33
  {...rest}
34
+ data-slot="separator"
35
35
  >
36
36
  </div>
@@ -8,6 +8,6 @@ type Props = ComponentProps<typeof Dialog>;
8
8
  const { class: className, ...rest } = Astro.props;
9
9
  ---
10
10
 
11
- <Dialog class:list={["starwind-sheet", className]} data-slot="sheet" {...rest}>
11
+ <Dialog class:list={["starwind-sheet", className]} {...rest} data-slot="sheet">
12
12
  <slot />
13
13
  </Dialog>
@@ -73,9 +73,9 @@ export const sheetCloseButton = tv({
73
73
  class: className,
74
74
  })}
75
75
  data-state="closed"
76
- data-slot="sheet-content"
77
76
  data-close-duration="300"
78
77
  {...rest}
78
+ data-slot="sheet-content"
79
79
  >
80
80
  <slot />
81
81
  <button
@@ -11,6 +11,6 @@ export const sheetDescription = tv({
11
11
  });
12
12
  ---
13
13
 
14
- <p class={sheetDescription({ class: className })} data-slot="sheet-description" {...rest}>
14
+ <p class={sheetDescription({ class: className })} {...rest} data-slot="sheet-description">
15
15
  <slot />
16
16
  </p>
@@ -11,6 +11,6 @@ export const sheetFooter = tv({
11
11
  });
12
12
  ---
13
13
 
14
- <div class={sheetFooter({ class: className })} data-slot="sheet-footer" {...rest}>
14
+ <div class={sheetFooter({ class: className })} {...rest} data-slot="sheet-footer">
15
15
  <slot />
16
16
  </div>
@@ -11,6 +11,6 @@ export const sheetHeader = tv({
11
11
  });
12
12
  ---
13
13
 
14
- <div class={sheetHeader({ class: className })} data-slot="sheet-header" {...rest}>
14
+ <div class={sheetHeader({ class: className })} {...rest} data-slot="sheet-header">
15
15
  <slot />
16
16
  </div>
@@ -11,6 +11,6 @@ export const sheetTitle = tv({
11
11
  });
12
12
  ---
13
13
 
14
- <h2 class={sheetTitle({ class: className })} data-slot="sheet-title" {...rest}>
14
+ <h2 class={sheetTitle({ class: className })} {...rest} data-slot="sheet-title">
15
15
  <slot />
16
16
  </h2>
@@ -111,8 +111,8 @@ const SIDEBAR_WIDTH_MOBILE = "18rem";
111
111
  "bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
112
112
  className,
113
113
  ]}
114
- data-slot="sidebar"
115
114
  {...rest}
115
+ data-slot="sidebar"
116
116
  >
117
117
  <slot />
118
118
  </div>
@@ -132,7 +132,7 @@ const SIDEBAR_WIDTH_MOBILE = "18rem";
132
132
  <div data-slot="sidebar-gap" class={sidebarGap({ variant })} />
133
133
 
134
134
  {/* Fixed sidebar container */}
135
- <div data-slot="sidebar-container" class={sidebarContainer({ side, variant })} {...rest}>
135
+ <div class={sidebarContainer({ side, variant })} {...rest} data-slot="sidebar-container">
136
136
  <div data-slot="sidebar-inner" class={sidebarInner({ variant })}>
137
137
  <slot />
138
138
  </div>
@@ -182,6 +182,7 @@ const SIDEBAR_WIDTH_MOBILE = "18rem";
182
182
  private init() {
183
183
  this.updateState();
184
184
  this.provider.addEventListener("sidebar:change", this.boundUpdateState);
185
+ this.provider.addEventListener("sidebar:mobile-change", this.boundUpdateState);
185
186
  }
186
187
 
187
188
  private updateState() {
@@ -193,6 +194,22 @@ const SIDEBAR_WIDTH_MOBILE = "18rem";
193
194
  } else {
194
195
  this.sidebar.setAttribute("data-collapsible", "");
195
196
  }
197
+
198
+ this.syncSidebarMenuTooltips();
199
+ }
200
+
201
+ private syncSidebarMenuTooltips() {
202
+ const hasEnabledSidebar = Array.from(
203
+ document.querySelectorAll<HTMLElement>(
204
+ '[data-slot="sidebar"][data-collapsible-mode="icon"][data-state="collapsed"]',
205
+ ),
206
+ ).some((sidebar) => getComputedStyle(sidebar).display !== "none");
207
+
208
+ if (hasEnabledSidebar) {
209
+ document.documentElement.setAttribute("data-starwind-sidebar-tooltips", "enabled");
210
+ } else {
211
+ document.documentElement.removeAttribute("data-starwind-sidebar-tooltips");
212
+ }
196
213
  }
197
214
  }
198
215
 
@@ -16,9 +16,9 @@ const { class: className, ...rest } = Astro.props;
16
16
 
17
17
  <div
18
18
  class={sidebarContent({ class: className })}
19
- data-slot="sidebar-content"
20
19
  data-sidebar="content"
21
20
  {...rest}
21
+ data-slot="sidebar-content"
22
22
  >
23
23
  <slot />
24
24
  </div>
@@ -13,9 +13,9 @@ const { class: className, ...rest } = Astro.props;
13
13
 
14
14
  <div
15
15
  class={sidebarFooter({ class: className })}
16
- data-slot="sidebar-footer"
17
16
  data-sidebar="footer"
18
17
  {...rest}
18
+ data-slot="sidebar-footer"
19
19
  >
20
20
  <slot />
21
21
  </div>
@@ -13,9 +13,9 @@ const { class: className, ...rest } = Astro.props;
13
13
 
14
14
  <div
15
15
  class={sidebarGroup({ class: className })}
16
- data-slot="sidebar-group"
17
16
  data-sidebar="group"
18
17
  {...rest}
18
+ data-slot="sidebar-group"
19
19
  >
20
20
  <slot />
21
21
  </div>
@@ -13,9 +13,9 @@ const { class: className, ...rest } = Astro.props;
13
13
 
14
14
  <div
15
15
  class={sidebarGroupContent({ class: className })}
16
- data-slot="sidebar-group-content"
17
16
  data-sidebar="group-content"
18
17
  {...rest}
18
+ data-slot="sidebar-group-content"
19
19
  >
20
20
  <slot />
21
21
  </div>
@@ -32,19 +32,19 @@ if (Astro.slots.has("default")) {
32
32
  asChild && hasChildren ? (
33
33
  <div
34
34
  class={sidebarGroupLabel({ class: className })}
35
- data-slot="sidebar-group-label"
36
35
  data-sidebar="group-label"
37
36
  data-as-child
38
37
  {...rest}
38
+ data-slot="sidebar-group-label"
39
39
  >
40
40
  <slot />
41
41
  </div>
42
42
  ) : (
43
43
  <div
44
44
  class={sidebarGroupLabel({ class: className })}
45
- data-slot="sidebar-group-label"
46
45
  data-sidebar="group-label"
47
46
  {...rest}
47
+ data-slot="sidebar-group-label"
48
48
  >
49
49
  <slot />
50
50
  </div>
@@ -13,9 +13,9 @@ const { class: className, ...rest } = Astro.props;
13
13
 
14
14
  <div
15
15
  class={sidebarHeader({ class: className })}
16
- data-slot="sidebar-header"
17
16
  data-sidebar="header"
18
17
  {...rest}
18
+ data-slot="sidebar-header"
19
19
  >
20
20
  <slot />
21
21
  </div>
@@ -16,7 +16,7 @@ const { size = "md", class: className, ...rest } = Astro.props;
16
16
  <Input
17
17
  size={size}
18
18
  class={sidebarInput({ class: className })}
19
- data-slot="sidebar-input"
20
19
  data-sidebar="input"
21
20
  {...rest}
21
+ data-slot="sidebar-input"
22
22
  />
@@ -16,6 +16,6 @@ export const sidebarInset = tv({
16
16
  const { class: className, ...rest } = Astro.props;
17
17
  ---
18
18
 
19
- <main class={sidebarInset({ class: className })} data-slot="sidebar-inset" {...rest}>
19
+ <main class={sidebarInset({ class: className })} {...rest} data-slot="sidebar-inset">
20
20
  <slot />
21
21
  </main>
@@ -13,9 +13,9 @@ const { class: className, ...rest } = Astro.props;
13
13
 
14
14
  <ul
15
15
  class={sidebarMenu({ class: className })}
16
- data-slot="sidebar-menu"
17
16
  data-sidebar="menu"
18
17
  {...rest}
18
+ data-slot="sidebar-menu"
19
19
  >
20
20
  <slot />
21
21
  </ul>
@@ -51,9 +51,9 @@ const {
51
51
  variant={variant}
52
52
  size={size}
53
53
  class={sidebarMenuAction({ showOnHover, class: className })}
54
- data-slot="sidebar-menu-action"
55
54
  data-sidebar="menu-action"
56
55
  {...rest}
56
+ data-slot="sidebar-menu-action"
57
57
  >
58
58
  <slot />
59
59
  </Button>
@@ -22,9 +22,9 @@ const { class: className, ...rest } = Astro.props;
22
22
 
23
23
  <div
24
24
  class={sidebarMenuBadge({ class: className })}
25
- data-slot="sidebar-menu-badge"
26
25
  data-sidebar="menu-badge"
27
26
  {...rest}
27
+ data-slot="sidebar-menu-badge"
28
28
  >
29
29
  <slot />
30
30
  </div>
@@ -79,7 +79,7 @@ const buttonDataAttrs = {
79
79
 
80
80
  {
81
81
  tooltip ? (
82
- <Tooltip openDelay={0} closeDelay={0} class="w-full">
82
+ <Tooltip openDelay={0} closeDelay={0} class="starwind-sidebar-menu-button-tooltip w-full">
83
83
  <TooltipTrigger>
84
84
  {asChild ? (
85
85
  <div class={buttonClasses} {...buttonDataAttrs} data-as-child>
@@ -111,19 +111,7 @@ const buttonDataAttrs = {
111
111
  }
112
112
 
113
113
  <style is:global>
114
- /* Hide tooltip when sidebar is expanded */
115
- [data-slot="sidebar"][data-state="expanded"] .starwind-sidebar-tooltip-content,
116
- [data-slot="sidebar"]:not([data-collapsible="icon"]) .starwind-sidebar-tooltip-content {
114
+ :root:not([data-starwind-sidebar-tooltips="enabled"]) .starwind-sidebar-tooltip-content {
117
115
  display: none !important;
118
116
  }
119
-
120
- /* Hide tooltips in mobile sheet */
121
- .starwind-sheet .starwind-sidebar-tooltip-content {
122
- display: none !important;
123
- }
124
-
125
- /* Only show tooltip trigger wrapper styles when collapsed */
126
- .starwind-sidebar-menu-button-tooltip-trigger {
127
- display: contents;
128
- }
129
117
  </style>