@starwind-ui/core 1.15.1 → 1.15.2
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.
- package/dist/index.d.ts +28 -0
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -0
- package/dist/src/components/accordion/Accordion.astro +254 -0
- package/dist/src/components/accordion/AccordionContent.astro +33 -0
- package/dist/src/components/accordion/AccordionItem.astro +27 -0
- package/dist/src/components/accordion/AccordionTrigger.astro +32 -0
- package/dist/src/components/accordion/index.ts +15 -0
- package/dist/src/components/alert/Alert.astro +31 -0
- package/dist/src/components/alert/AlertDescription.astro +14 -0
- package/dist/src/components/alert/AlertTitle.astro +16 -0
- package/dist/src/components/alert/index.ts +13 -0
- package/dist/src/components/alert-dialog/AlertDialog.astro +275 -0
- package/dist/src/components/alert-dialog/AlertDialogAction.astro +44 -0
- package/dist/src/components/alert-dialog/AlertDialogCancel.astro +45 -0
- package/dist/src/components/alert-dialog/AlertDialogContent.astro +52 -0
- package/dist/src/components/alert-dialog/AlertDialogDescription.astro +18 -0
- package/dist/src/components/alert-dialog/AlertDialogFooter.astro +16 -0
- package/dist/src/components/alert-dialog/AlertDialogHeader.astro +14 -0
- package/dist/src/components/alert-dialog/AlertDialogTitle.astro +20 -0
- package/dist/src/components/alert-dialog/AlertDialogTrigger.astro +47 -0
- package/dist/src/components/alert-dialog/index.ts +46 -0
- package/dist/src/components/aspect-ratio/AspectRatio.astro +32 -0
- package/dist/src/components/aspect-ratio/index.ts +7 -0
- package/dist/src/components/avatar/Avatar.astro +29 -0
- package/dist/src/components/avatar/AvatarFallback.astro +18 -0
- package/dist/src/components/avatar/AvatarImage.astro +49 -0
- package/dist/src/components/avatar/index.ts +13 -0
- package/dist/src/components/badge/Badge.astro +55 -0
- package/dist/src/components/badge/index.ts +7 -0
- package/dist/src/components/breadcrumb/Breadcrumb.astro +11 -0
- package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +28 -0
- package/dist/src/components/breadcrumb/BreadcrumbItem.astro +14 -0
- package/dist/src/components/breadcrumb/BreadcrumbLink.astro +22 -0
- package/dist/src/components/breadcrumb/BreadcrumbList.astro +16 -0
- package/dist/src/components/breadcrumb/BreadcrumbPage.astro +21 -0
- package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +23 -0
- package/dist/src/components/breadcrumb/index.ts +37 -0
- package/dist/src/components/button/Button.astro +55 -0
- package/dist/src/components/button/index.ts +7 -0
- package/dist/src/components/button-group/ButtonGroup.astro +62 -0
- package/dist/src/components/button-group/ButtonGroupSeparator.astro +27 -0
- package/dist/src/components/button-group/ButtonGroupText.astro +19 -0
- package/dist/src/components/button-group/index.ts +17 -0
- package/dist/src/components/card/Card.astro +14 -0
- package/dist/src/components/card/CardContent.astro +14 -0
- package/dist/src/components/card/CardDescription.astro +14 -0
- package/dist/src/components/card/CardFooter.astro +14 -0
- package/dist/src/components/card/CardHeader.astro +14 -0
- package/dist/src/components/card/CardTitle.astro +14 -0
- package/dist/src/components/card/index.ts +26 -0
- package/dist/src/components/carousel/Carousel.astro +55 -0
- package/dist/src/components/carousel/CarouselContent.astro +26 -0
- package/dist/src/components/carousel/CarouselItem.astro +26 -0
- package/dist/src/components/carousel/CarouselNext.astro +37 -0
- package/dist/src/components/carousel/CarouselPrevious.astro +37 -0
- package/dist/src/components/carousel/carousel-script.ts +191 -0
- package/dist/src/components/carousel/index.ts +32 -0
- package/dist/src/components/checkbox/Checkbox.astro +128 -0
- package/dist/src/components/checkbox/index.ts +7 -0
- package/dist/src/components/collapsible/Collapsible.astro +161 -0
- package/dist/src/components/collapsible/CollapsibleContent.astro +22 -0
- package/dist/src/components/collapsible/CollapsibleTrigger.astro +44 -0
- package/dist/src/components/collapsible/index.ts +13 -0
- package/dist/src/components/dialog/Dialog.astro +389 -0
- package/dist/src/components/dialog/DialogClose.astro +35 -0
- package/dist/src/components/dialog/DialogContent.astro +78 -0
- package/dist/src/components/dialog/DialogDescription.astro +14 -0
- package/dist/src/components/dialog/DialogFooter.astro +14 -0
- package/dist/src/components/dialog/DialogHeader.astro +14 -0
- package/dist/src/components/dialog/DialogTitle.astro +22 -0
- package/dist/src/components/dialog/DialogTrigger.astro +47 -0
- package/dist/src/components/dialog/index.ts +45 -0
- package/dist/src/components/dropdown/Dropdown.astro +377 -0
- package/dist/src/components/dropdown/DropdownContent.astro +81 -0
- package/dist/src/components/dropdown/DropdownItem.astro +48 -0
- package/dist/src/components/dropdown/DropdownLabel.astro +29 -0
- package/dist/src/components/dropdown/DropdownSeparator.astro +21 -0
- package/dist/src/components/dropdown/DropdownTrigger.astro +52 -0
- package/dist/src/components/dropdown/index.ts +33 -0
- package/dist/src/components/dropzone/Dropzone.astro +236 -0
- package/dist/src/components/dropzone/DropzoneFilesList.astro +26 -0
- package/dist/src/components/dropzone/DropzoneLoadingIndicator.astro +10 -0
- package/dist/src/components/dropzone/DropzoneUploadIndicator.astro +10 -0
- package/dist/src/components/dropzone/index.ts +24 -0
- package/dist/src/components/image/Image.astro +24 -0
- package/dist/src/components/image/index.ts +9 -0
- package/dist/src/components/input/Input.astro +25 -0
- package/dist/src/components/input/index.ts +7 -0
- package/dist/src/components/input-otp/InputOtp.astro +352 -0
- package/dist/src/components/input-otp/InputOtpGroup.astro +16 -0
- package/dist/src/components/input-otp/InputOtpSeparator.astro +25 -0
- package/dist/src/components/input-otp/InputOtpSlot.astro +48 -0
- package/dist/src/components/input-otp/InputOtpTypes.ts +6 -0
- package/dist/src/components/input-otp/index.ts +33 -0
- package/dist/src/components/item/Item.astro +52 -0
- package/dist/src/components/item/ItemActions.astro +16 -0
- package/dist/src/components/item/ItemContent.astro +16 -0
- package/dist/src/components/item/ItemDescription.astro +19 -0
- package/dist/src/components/item/ItemFooter.astro +16 -0
- package/dist/src/components/item/ItemGroup.astro +16 -0
- package/dist/src/components/item/ItemHeader.astro +16 -0
- package/dist/src/components/item/ItemMedia.astro +40 -0
- package/dist/src/components/item/ItemSeparator.astro +21 -0
- package/dist/src/components/item/ItemTitle.astro +16 -0
- package/dist/src/components/item/index.ts +50 -0
- package/dist/src/components/kbd/Kbd.astro +21 -0
- package/dist/src/components/kbd/KbdGroup.astro +16 -0
- package/dist/src/components/kbd/index.ts +11 -0
- package/dist/src/components/label/Label.astro +22 -0
- package/dist/src/components/label/index.ts +7 -0
- package/dist/src/components/pagination/Pagination.astro +20 -0
- package/dist/src/components/pagination/PaginationContent.astro +16 -0
- package/dist/src/components/pagination/PaginationEllipsis.astro +35 -0
- package/dist/src/components/pagination/PaginationItem.astro +16 -0
- package/dist/src/components/pagination/PaginationLink.astro +24 -0
- package/dist/src/components/pagination/PaginationNext.astro +30 -0
- package/dist/src/components/pagination/PaginationPrevious.astro +30 -0
- package/dist/src/components/pagination/index.ts +38 -0
- package/dist/src/components/progress/Progress.astro +155 -0
- package/dist/src/components/progress/index.ts +10 -0
- package/dist/src/components/prose/Prose.astro +617 -0
- package/dist/src/components/prose/index.ts +9 -0
- package/dist/src/components/radio-group/RadioGroup.astro +162 -0
- package/dist/src/components/radio-group/RadioGroupItem.astro +129 -0
- package/dist/src/components/radio-group/RadioGroupTypes.ts +6 -0
- package/dist/src/components/radio-group/index.ts +23 -0
- package/dist/src/components/select/Select.astro +752 -0
- package/dist/src/components/select/SelectContent.astro +94 -0
- package/dist/src/components/select/SelectGroup.astro +9 -0
- package/dist/src/components/select/SelectItem.astro +51 -0
- package/dist/src/components/select/SelectLabel.astro +14 -0
- package/dist/src/components/select/SelectSearch.astro +49 -0
- package/dist/src/components/select/SelectSeparator.astro +12 -0
- package/dist/src/components/select/SelectTrigger.astro +54 -0
- package/dist/src/components/select/SelectTypes.ts +13 -0
- package/dist/src/components/select/SelectValue.astro +19 -0
- package/dist/src/components/select/index.ts +49 -0
- package/dist/src/components/separator/Separator.astro +36 -0
- package/dist/src/components/separator/index.ts +7 -0
- package/dist/src/components/sheet/Sheet.astro +13 -0
- package/dist/src/components/sheet/SheetClose.astro +13 -0
- package/dist/src/components/sheet/SheetContent.astro +92 -0
- package/dist/src/components/sheet/SheetDescription.astro +16 -0
- package/dist/src/components/sheet/SheetFooter.astro +16 -0
- package/dist/src/components/sheet/SheetHeader.astro +16 -0
- package/dist/src/components/sheet/SheetTitle.astro +16 -0
- package/dist/src/components/sheet/SheetTrigger.astro +13 -0
- package/dist/src/components/sheet/index.ts +41 -0
- package/dist/src/components/sidebar/Sidebar.astro +213 -0
- package/dist/src/components/sidebar/SidebarContent.astro +24 -0
- package/dist/src/components/sidebar/SidebarFooter.astro +21 -0
- package/dist/src/components/sidebar/SidebarGroup.astro +21 -0
- package/dist/src/components/sidebar/SidebarGroupContent.astro +21 -0
- package/dist/src/components/sidebar/SidebarGroupLabel.astro +52 -0
- package/dist/src/components/sidebar/SidebarHeader.astro +21 -0
- package/dist/src/components/sidebar/SidebarInput.astro +22 -0
- package/dist/src/components/sidebar/SidebarInset.astro +21 -0
- package/dist/src/components/sidebar/SidebarMenu.astro +21 -0
- package/dist/src/components/sidebar/SidebarMenuAction.astro +59 -0
- package/dist/src/components/sidebar/SidebarMenuBadge.astro +30 -0
- package/dist/src/components/sidebar/SidebarMenuButton.astro +129 -0
- package/dist/src/components/sidebar/SidebarMenuItem.astro +21 -0
- package/dist/src/components/sidebar/SidebarMenuSkeleton.astro +40 -0
- package/dist/src/components/sidebar/SidebarMenuSub.astro +24 -0
- package/dist/src/components/sidebar/SidebarMenuSubButton.astro +49 -0
- package/dist/src/components/sidebar/SidebarMenuSubItem.astro +16 -0
- package/dist/src/components/sidebar/SidebarProvider.astro +213 -0
- package/dist/src/components/sidebar/SidebarRail.astro +71 -0
- package/dist/src/components/sidebar/SidebarSeparator.astro +22 -0
- package/dist/src/components/sidebar/SidebarTrigger.astro +66 -0
- package/dist/src/components/sidebar/index.ts +103 -0
- package/dist/src/components/skeleton/Skeleton.astro +14 -0
- package/dist/src/components/skeleton/index.ts +9 -0
- package/dist/src/components/slider/Slider.astro +411 -0
- package/dist/src/components/slider/index.ts +9 -0
- package/dist/src/components/spinner/Spinner.astro +21 -0
- package/dist/src/components/spinner/index.ts +7 -0
- package/dist/src/components/switch/Switch.astro +192 -0
- package/dist/src/components/switch/SwitchTypes.ts +6 -0
- package/dist/src/components/switch/index.ts +12 -0
- package/dist/src/components/table/Table.astro +18 -0
- package/dist/src/components/table/TableBody.astro +16 -0
- package/dist/src/components/table/TableCaption.astro +16 -0
- package/dist/src/components/table/TableCell.astro +16 -0
- package/dist/src/components/table/TableFoot.astro +16 -0
- package/dist/src/components/table/TableHead.astro +16 -0
- package/dist/src/components/table/TableHeader.astro +16 -0
- package/dist/src/components/table/TableRow.astro +16 -0
- package/dist/src/components/table/index.ts +42 -0
- package/dist/src/components/tabs/Tabs.astro +271 -0
- package/dist/src/components/tabs/TabsContent.astro +28 -0
- package/dist/src/components/tabs/TabsList.astro +22 -0
- package/dist/src/components/tabs/TabsTrigger.astro +34 -0
- package/dist/src/components/tabs/index.ts +20 -0
- package/dist/src/components/textarea/Textarea.astro +29 -0
- package/dist/src/components/textarea/index.ts +9 -0
- package/dist/src/components/theme-toggle/ThemeToggle.astro +208 -0
- package/dist/src/components/theme-toggle/index.ts +7 -0
- package/dist/src/components/toast/ToastDescription.astro +21 -0
- package/dist/src/components/toast/ToastItem.astro +54 -0
- package/dist/src/components/toast/ToastTemplate.astro +25 -0
- package/dist/src/components/toast/ToastTitle.astro +57 -0
- package/dist/src/components/toast/Toaster.astro +982 -0
- package/dist/src/components/toast/index.ts +29 -0
- package/dist/src/components/toast/toast-manager.ts +216 -0
- package/dist/src/components/toggle/Toggle.astro +174 -0
- package/dist/src/components/toggle/ToggleTypes.ts +14 -0
- package/dist/src/components/toggle/index.ts +8 -0
- package/dist/src/components/tooltip/Tooltip.astro +282 -0
- package/dist/src/components/tooltip/TooltipContent.astro +89 -0
- package/dist/src/components/tooltip/TooltipTrigger.astro +10 -0
- package/dist/src/components/tooltip/index.ts +16 -0
- package/dist/src/components/video/Video.astro +120 -0
- package/dist/src/components/video/index.ts +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
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 tooltip
|
|
8
|
+
* @default bottom
|
|
9
|
+
*/
|
|
10
|
+
side?: "top" | "bottom";
|
|
11
|
+
/**
|
|
12
|
+
* Alignment of the dropdown
|
|
13
|
+
* @default start
|
|
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
|
+
* Size of the select content
|
|
28
|
+
* @default md
|
|
29
|
+
*/
|
|
30
|
+
size?: "sm" | "md" | "lg";
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const selectContent = tv({
|
|
34
|
+
base: [
|
|
35
|
+
"starwind-select-content",
|
|
36
|
+
"bg-popover text-popover-foreground absolute z-50 min-w-[8rem] rounded-md border shadow-md",
|
|
37
|
+
"data-[state=open]:animate-in fade-in zoom-in-95 overflow-hidden will-change-transform",
|
|
38
|
+
"data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards fade-out zoom-out-95",
|
|
39
|
+
],
|
|
40
|
+
variants: {
|
|
41
|
+
side: {
|
|
42
|
+
bottom: "slide-in-from-top-2 slide-out-to-top-2 top-full",
|
|
43
|
+
top: "slide-in-from-bottom-2 slide-out-to-bottom-2 bottom-full",
|
|
44
|
+
},
|
|
45
|
+
align: {
|
|
46
|
+
start: "slide-in-from-left-1 slide-out-to-left-1 left-0",
|
|
47
|
+
center: "left-1/2 -translate-x-1/2",
|
|
48
|
+
end: "slide-in-from-right-1 slide-out-to-right-1 right-0",
|
|
49
|
+
},
|
|
50
|
+
size: {
|
|
51
|
+
sm: "text-sm [&_[data-slot=select-label]]:text-xs",
|
|
52
|
+
md: "text-base [&_[data-slot=select-label]]:text-sm",
|
|
53
|
+
lg: "text-lg [&_[data-slot=select-label]]:text-base",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: { side: "bottom", align: "start", size: "md" },
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const selectContentInner = tv({
|
|
60
|
+
base: "max-h-96 w-full min-w-(--select-trigger-width) overflow-y-auto p-1",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const {
|
|
64
|
+
class: className,
|
|
65
|
+
side = "bottom",
|
|
66
|
+
align = "start",
|
|
67
|
+
size = "md",
|
|
68
|
+
sideOffset = 4,
|
|
69
|
+
animationDuration = 150,
|
|
70
|
+
...rest
|
|
71
|
+
} = Astro.props;
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
<div
|
|
75
|
+
class={selectContent({ side, align, size, class: className })}
|
|
76
|
+
role="listbox"
|
|
77
|
+
data-side={side}
|
|
78
|
+
data-align={align}
|
|
79
|
+
data-state="closed"
|
|
80
|
+
data-slot="select-content"
|
|
81
|
+
tabindex="-1"
|
|
82
|
+
style={{
|
|
83
|
+
// hide the content initially. Script will remove this
|
|
84
|
+
display: "none",
|
|
85
|
+
animationDuration: `${animationDuration}ms`,
|
|
86
|
+
marginTop: side === "bottom" ? `${sideOffset}px` : undefined,
|
|
87
|
+
marginBottom: side === "top" ? `${sideOffset}px` : undefined,
|
|
88
|
+
}}
|
|
89
|
+
{...rest}
|
|
90
|
+
>
|
|
91
|
+
<div class={selectContentInner()}>
|
|
92
|
+
<slot />
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Check from "@tabler/icons/outline/check.svg";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
import { tv } from "tailwind-variants";
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<"div"> & {
|
|
7
|
+
/**
|
|
8
|
+
* The value associated with this select item
|
|
9
|
+
*/
|
|
10
|
+
value: string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether this select item is disabled and cannot be selected
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const selectItem = tv({
|
|
18
|
+
base: [
|
|
19
|
+
"relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-8 pl-2 outline-none select-none",
|
|
20
|
+
"data-[active]:bg-accent data-[active]:text-accent-foreground",
|
|
21
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
22
|
+
"not-aria-selected:[&_svg]:hidden aria-selected:[&_svg]:flex",
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const selectItemIcon = tv({
|
|
27
|
+
base: "absolute right-2 flex size-4 items-center justify-center",
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const { class: className, value, disabled, ...rest } = Astro.props;
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<div
|
|
34
|
+
class={selectItem({ class: className })}
|
|
35
|
+
data-value={value}
|
|
36
|
+
data-disabled={disabled}
|
|
37
|
+
data-slot="select-item"
|
|
38
|
+
aria-selected="false"
|
|
39
|
+
role="option"
|
|
40
|
+
tabindex="0"
|
|
41
|
+
{...rest}
|
|
42
|
+
>
|
|
43
|
+
<span>
|
|
44
|
+
<slot />
|
|
45
|
+
</span>
|
|
46
|
+
<span class={selectItemIcon()}>
|
|
47
|
+
<slot name="icon">
|
|
48
|
+
<Check class="size-4" />
|
|
49
|
+
</slot>
|
|
50
|
+
</span>
|
|
51
|
+
</div>
|
|
@@ -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 selectLabel = tv({ base: "text-muted-foreground py-1.5 pr-8 pl-2" });
|
|
8
|
+
|
|
9
|
+
const { class: className, ...rest } = Astro.props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div class={selectLabel({ class: className })} data-slot="select-label" {...rest}>
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Search from "@tabler/icons/outline/search.svg";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
import { tv } from "tailwind-variants";
|
|
5
|
+
|
|
6
|
+
type Props = Omit<HTMLAttributes<"input">, "type" | "autocomplete"> & {
|
|
7
|
+
/**
|
|
8
|
+
* The text to display when no results are found
|
|
9
|
+
* @default "No results found."
|
|
10
|
+
*/
|
|
11
|
+
emptyText?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const selectSearch = tv({
|
|
15
|
+
base: [
|
|
16
|
+
"placeholder:text-muted-foreground flex w-full border-0 bg-transparent px-0 py-2.5",
|
|
17
|
+
"ring-0 outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
class: className,
|
|
23
|
+
placeholder = "Search...",
|
|
24
|
+
emptyText = "No results found.",
|
|
25
|
+
...rest
|
|
26
|
+
} = Astro.props;
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<div
|
|
30
|
+
data-slot="select-search-wrapper"
|
|
31
|
+
class="-mx-1 -mt-1 mb-1 flex items-center gap-2 border-b px-3"
|
|
32
|
+
>
|
|
33
|
+
<slot name="icon">
|
|
34
|
+
<Search class="text-muted-foreground size-4.5 shrink-0" />
|
|
35
|
+
</slot>
|
|
36
|
+
<input
|
|
37
|
+
type="text"
|
|
38
|
+
class={selectSearch({ class: className })}
|
|
39
|
+
data-slot="select-search"
|
|
40
|
+
placeholder={placeholder}
|
|
41
|
+
autocomplete="off"
|
|
42
|
+
aria-label={placeholder}
|
|
43
|
+
{...rest}
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div class="text-muted-foreground hidden py-6 text-center text-sm" data-slot="select-empty">
|
|
48
|
+
<slot name="empty">{emptyText}</slot>
|
|
49
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
|
+
|
|
5
|
+
type Props = HTMLAttributes<"div">;
|
|
6
|
+
|
|
7
|
+
export const selectSeparator = tv({ base: "bg-muted -mx-1 my-1 h-px" });
|
|
8
|
+
|
|
9
|
+
const { class: className, ...rest } = Astro.props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div class={selectSeparator({ class: className })} data-slot="select-separator" {...rest}></div>
|
|
@@ -0,0 +1,54 @@
|
|
|
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<"button">, "role" | "type"> &
|
|
7
|
+
VariantProps<typeof selectTrigger> & {
|
|
8
|
+
/**
|
|
9
|
+
* The content to be rendered inside the select trigger
|
|
10
|
+
*/
|
|
11
|
+
children: any;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const selectTrigger = tv({
|
|
15
|
+
base: [
|
|
16
|
+
"starwind-select-trigger",
|
|
17
|
+
"border-input dark:bg-input/30 text-foreground ring-offset-background flex items-center justify-between gap-2 rounded-md border bg-transparent shadow-xs",
|
|
18
|
+
"focus-visible:border-outline focus-visible:ring-outline/50 transition-[color,box-shadow] outline-none focus-visible:ring-3",
|
|
19
|
+
"disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
20
|
+
"aria-invalid:border-error aria-invalid:focus:ring-error/40 aria-invalid:focus:ring-3",
|
|
21
|
+
],
|
|
22
|
+
variants: {
|
|
23
|
+
size: {
|
|
24
|
+
sm: "h-9 px-2 text-sm",
|
|
25
|
+
md: "h-11 px-3 text-base",
|
|
26
|
+
lg: "h-12 px-4 text-lg",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
size: "md",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const { class: className, size, ...rest } = Astro.props;
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
<button
|
|
38
|
+
class={selectTrigger({ size, class: className })}
|
|
39
|
+
type="button"
|
|
40
|
+
role="combobox"
|
|
41
|
+
aria-label="Select field"
|
|
42
|
+
aria-controls=""
|
|
43
|
+
aria-expanded="false"
|
|
44
|
+
aria-haspopup="listbox"
|
|
45
|
+
aria-autocomplete="none"
|
|
46
|
+
data-state="closed"
|
|
47
|
+
data-slot="select-trigger"
|
|
48
|
+
{...rest}
|
|
49
|
+
>
|
|
50
|
+
<slot />
|
|
51
|
+
<slot name="icon">
|
|
52
|
+
<ChevronDown class="size-4 opacity-50" />
|
|
53
|
+
</slot>
|
|
54
|
+
</button>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SelectChangeEvent extends CustomEvent {
|
|
2
|
+
detail: {
|
|
3
|
+
value: string;
|
|
4
|
+
selectId: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface SelectEvent extends CustomEvent {
|
|
10
|
+
detail:
|
|
11
|
+
| { value: string; selectId: string; selectName?: string }
|
|
12
|
+
| { value: string; selectId?: string; selectName: string };
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
|
+
|
|
5
|
+
type Props = HTMLAttributes<"span"> & {
|
|
6
|
+
/**
|
|
7
|
+
* The text to display when no value is selected
|
|
8
|
+
*/
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const selectValue = tv({ base: "pointer-events-none" });
|
|
13
|
+
|
|
14
|
+
const { placeholder = "select", class: className, ...rest } = Astro.props;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<span class={selectValue({ class: className })} data-slot="select-value" {...rest}>
|
|
18
|
+
{placeholder}
|
|
19
|
+
</span>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import Select from "./Select.astro";
|
|
2
|
+
import SelectContent, { selectContent, selectContentInner } from "./SelectContent.astro";
|
|
3
|
+
import SelectGroup from "./SelectGroup.astro";
|
|
4
|
+
import SelectItem, { selectItem, selectItemIcon } from "./SelectItem.astro";
|
|
5
|
+
import SelectLabel, { selectLabel } from "./SelectLabel.astro";
|
|
6
|
+
import SelectSearch, { selectSearch } from "./SelectSearch.astro";
|
|
7
|
+
import SelectSeparator, { selectSeparator } from "./SelectSeparator.astro";
|
|
8
|
+
import SelectTrigger, { selectTrigger } from "./SelectTrigger.astro";
|
|
9
|
+
import type { SelectChangeEvent, SelectEvent } from "./SelectTypes";
|
|
10
|
+
import SelectValue, { selectValue } from "./SelectValue.astro";
|
|
11
|
+
|
|
12
|
+
const SelectVariants = {
|
|
13
|
+
selectContent,
|
|
14
|
+
selectContentInner,
|
|
15
|
+
selectItem,
|
|
16
|
+
selectItemIcon,
|
|
17
|
+
selectLabel,
|
|
18
|
+
selectSearch,
|
|
19
|
+
selectSeparator,
|
|
20
|
+
selectTrigger,
|
|
21
|
+
selectValue,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
Select,
|
|
26
|
+
type SelectChangeEvent,
|
|
27
|
+
SelectContent,
|
|
28
|
+
type SelectEvent,
|
|
29
|
+
SelectGroup,
|
|
30
|
+
SelectItem,
|
|
31
|
+
SelectLabel,
|
|
32
|
+
SelectSearch,
|
|
33
|
+
SelectSeparator,
|
|
34
|
+
SelectTrigger,
|
|
35
|
+
SelectValue,
|
|
36
|
+
SelectVariants,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
Root: Select,
|
|
41
|
+
Trigger: SelectTrigger,
|
|
42
|
+
Value: SelectValue,
|
|
43
|
+
Content: SelectContent,
|
|
44
|
+
Group: SelectGroup,
|
|
45
|
+
Label: SelectLabel,
|
|
46
|
+
Search: SelectSearch,
|
|
47
|
+
Item: SelectItem,
|
|
48
|
+
Separator: SelectSeparator,
|
|
49
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
|
+
|
|
5
|
+
type Props = Omit<HTMLAttributes<"div">, "role" | "aria-orientation"> & {
|
|
6
|
+
/**
|
|
7
|
+
* The orientation of the separator.
|
|
8
|
+
* @default "horizontal"
|
|
9
|
+
*/
|
|
10
|
+
orientation?: "horizontal" | "vertical";
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const separator = tv({
|
|
14
|
+
base: "bg-border shrink-0",
|
|
15
|
+
variants: {
|
|
16
|
+
orientation: {
|
|
17
|
+
horizontal: "h-[1px] w-full",
|
|
18
|
+
vertical: "h-full w-[1px]",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
orientation: "horizontal",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const { class: className, orientation = "horizontal", ...rest } = Astro.props;
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<div
|
|
30
|
+
role="separator"
|
|
31
|
+
aria-orientation={orientation}
|
|
32
|
+
class={separator({ orientation, class: className })}
|
|
33
|
+
data-slot="separator"
|
|
34
|
+
{...rest}
|
|
35
|
+
>
|
|
36
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ComponentProps } from "astro/types";
|
|
3
|
+
|
|
4
|
+
import { Dialog } from "@/components/starwind/dialog";
|
|
5
|
+
|
|
6
|
+
type Props = ComponentProps<typeof Dialog>;
|
|
7
|
+
|
|
8
|
+
const { class: className, ...rest } = Astro.props;
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<Dialog class:list={["starwind-sheet", className]} data-slot="sheet" {...rest}>
|
|
12
|
+
<slot />
|
|
13
|
+
</Dialog>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ComponentProps } from "astro/types";
|
|
3
|
+
|
|
4
|
+
import { DialogClose } from "@/components/starwind/dialog";
|
|
5
|
+
|
|
6
|
+
type Props = ComponentProps<typeof DialogClose>;
|
|
7
|
+
|
|
8
|
+
const { class: className, ...rest } = Astro.props;
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<DialogClose class:list={["starwind-sheet-close", className]} {...rest}>
|
|
12
|
+
<slot />
|
|
13
|
+
</DialogClose>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
import X from "@tabler/icons/outline/x.svg";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
import { tv } from "tailwind-variants";
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<"dialog"> & {
|
|
7
|
+
/**
|
|
8
|
+
* Side of the page the sheet opens from
|
|
9
|
+
*/
|
|
10
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const { side = "right", class: className, ...rest } = Astro.props;
|
|
14
|
+
|
|
15
|
+
export const dialogBackdrop = tv({
|
|
16
|
+
base: [
|
|
17
|
+
"starwind-dialog-backdrop fixed inset-0 top-0 left-0 z-50 hidden h-screen w-screen bg-black/80",
|
|
18
|
+
"data-[state=open]:animate-in fade-in",
|
|
19
|
+
"data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards fade-out",
|
|
20
|
+
"data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const sheetContent = tv({
|
|
25
|
+
base: [
|
|
26
|
+
"starwind-dialog-content",
|
|
27
|
+
"bg-background fixed z-50 flex-col gap-4 shadow-lg transition ease-in-out open:flex",
|
|
28
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards",
|
|
29
|
+
"data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
30
|
+
],
|
|
31
|
+
variants: {
|
|
32
|
+
side: {
|
|
33
|
+
right: [
|
|
34
|
+
"slide-out-to-right slide-in-from-right",
|
|
35
|
+
"inset-y-0 right-0 left-auto h-full max-h-[100dvh] w-3/4 border-l sm:max-w-sm",
|
|
36
|
+
],
|
|
37
|
+
left: [
|
|
38
|
+
"slide-out-to-left slide-in-from-left",
|
|
39
|
+
"inset-y-0 right-auto left-0 h-full max-h-[100dvh] w-3/4 border-r sm:max-w-sm",
|
|
40
|
+
],
|
|
41
|
+
top: [
|
|
42
|
+
"slide-out-to-top slide-in-from-top",
|
|
43
|
+
"inset-x-0 top-0 bottom-auto h-auto w-full max-w-screen border-b",
|
|
44
|
+
],
|
|
45
|
+
bottom: [
|
|
46
|
+
"slide-out-to-bottom slide-in-from-bottom",
|
|
47
|
+
"inset-x-0 top-auto bottom-0 h-auto w-full max-w-screen border-t",
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
side: "right",
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const sheetCloseButton = tv({
|
|
57
|
+
base: [
|
|
58
|
+
"starwind-dialog-close",
|
|
59
|
+
"absolute top-4 right-4 rounded-xs [&>svg]:opacity-70 hover:[&>svg]:opacity-100",
|
|
60
|
+
"focus-visible:ring-outline/50 transition-[color,box-shadow] outline-none focus-visible:ring-3",
|
|
61
|
+
],
|
|
62
|
+
});
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
<!-- dialog overlay -->
|
|
66
|
+
<slot name="backdrop">
|
|
67
|
+
<div class={dialogBackdrop()} data-state="closed" data-slot="dialog-backdrop"></div>
|
|
68
|
+
</slot>
|
|
69
|
+
|
|
70
|
+
<dialog
|
|
71
|
+
class={sheetContent({
|
|
72
|
+
side,
|
|
73
|
+
class: className,
|
|
74
|
+
})}
|
|
75
|
+
data-state="closed"
|
|
76
|
+
data-slot="sheet-content"
|
|
77
|
+
data-close-duration="300"
|
|
78
|
+
{...rest}
|
|
79
|
+
>
|
|
80
|
+
<slot />
|
|
81
|
+
<button
|
|
82
|
+
type="button"
|
|
83
|
+
class={sheetCloseButton()}
|
|
84
|
+
data-slot="sheet-close"
|
|
85
|
+
aria-label="Close dialog"
|
|
86
|
+
>
|
|
87
|
+
<slot name="icon">
|
|
88
|
+
<X class="size-5 transition-opacity" />
|
|
89
|
+
</slot>
|
|
90
|
+
<span class="sr-only">Close</span>
|
|
91
|
+
</button>
|
|
92
|
+
</dialog>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
|
+
|
|
5
|
+
type Props = HTMLAttributes<"p">;
|
|
6
|
+
|
|
7
|
+
const { class: className, ...rest } = Astro.props;
|
|
8
|
+
|
|
9
|
+
export const sheetDescription = tv({
|
|
10
|
+
base: ["text-muted-foreground text-sm"],
|
|
11
|
+
});
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<p class={sheetDescription({ class: className })} data-slot="sheet-description" {...rest}>
|
|
15
|
+
<slot />
|
|
16
|
+
</p>
|
|
@@ -0,0 +1,16 @@
|
|
|
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 sheetFooter = tv({
|
|
10
|
+
base: ["mt-auto flex flex-col gap-2 p-4"],
|
|
11
|
+
});
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<div class={sheetFooter({ class: className })} data-slot="sheet-footer" {...rest}>
|
|
15
|
+
<slot />
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
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 sheetHeader = tv({
|
|
10
|
+
base: ["flex flex-col gap-1.5 p-4"],
|
|
11
|
+
});
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<div class={sheetHeader({ class: className })} data-slot="sheet-header" {...rest}>
|
|
15
|
+
<slot />
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
|
+
|
|
5
|
+
type Props = HTMLAttributes<"h2">;
|
|
6
|
+
|
|
7
|
+
const { class: className, ...rest } = Astro.props;
|
|
8
|
+
|
|
9
|
+
export const sheetTitle = tv({
|
|
10
|
+
base: ["starwind-sheet-title", "text-foreground font-heading font-semibold"],
|
|
11
|
+
});
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<h2 class={sheetTitle({ class: className })} data-slot="sheet-title" {...rest}>
|
|
15
|
+
<slot />
|
|
16
|
+
</h2>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ComponentProps } from "astro/types";
|
|
3
|
+
|
|
4
|
+
import { DialogTrigger } from "@/components/starwind/dialog";
|
|
5
|
+
|
|
6
|
+
type Props = ComponentProps<typeof DialogTrigger>;
|
|
7
|
+
|
|
8
|
+
const { class: className, ...rest } = Astro.props;
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<DialogTrigger class:list={["starwind-sheet-trigger", className]} {...rest}>
|
|
12
|
+
<slot />
|
|
13
|
+
</DialogTrigger>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Sheet from "./Sheet.astro";
|
|
2
|
+
import SheetClose from "./SheetClose.astro";
|
|
3
|
+
import SheetContent, { dialogBackdrop, sheetCloseButton, sheetContent } from "./SheetContent.astro";
|
|
4
|
+
import SheetDescription, { sheetDescription } from "./SheetDescription.astro";
|
|
5
|
+
import SheetFooter, { sheetFooter } from "./SheetFooter.astro";
|
|
6
|
+
import SheetHeader, { sheetHeader } from "./SheetHeader.astro";
|
|
7
|
+
import SheetTitle, { sheetTitle } from "./SheetTitle.astro";
|
|
8
|
+
import SheetTrigger from "./SheetTrigger.astro";
|
|
9
|
+
|
|
10
|
+
const SheetVariants = {
|
|
11
|
+
sheetCloseButton,
|
|
12
|
+
sheetDescription,
|
|
13
|
+
sheetFooter,
|
|
14
|
+
sheetHeader,
|
|
15
|
+
sheetTitle,
|
|
16
|
+
dialogBackdrop,
|
|
17
|
+
sheetContent,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
Sheet,
|
|
22
|
+
SheetClose,
|
|
23
|
+
SheetContent,
|
|
24
|
+
SheetDescription,
|
|
25
|
+
SheetFooter,
|
|
26
|
+
SheetHeader,
|
|
27
|
+
SheetTitle,
|
|
28
|
+
SheetTrigger,
|
|
29
|
+
SheetVariants,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
Root: Sheet,
|
|
34
|
+
Trigger: SheetTrigger,
|
|
35
|
+
Content: SheetContent,
|
|
36
|
+
Header: SheetHeader,
|
|
37
|
+
Footer: SheetFooter,
|
|
38
|
+
Title: SheetTitle,
|
|
39
|
+
Description: SheetDescription,
|
|
40
|
+
Close: SheetClose,
|
|
41
|
+
};
|