@starwind-ui/core 1.7.3 → 1.9.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.
- package/dist/index.js +41 -23
- package/dist/index.js.map +1 -1
- package/dist/src/components/accordion/Accordion.astro +8 -2
- package/dist/src/components/accordion/AccordionContent.astro +2 -1
- package/dist/src/components/accordion/AccordionItem.astro +8 -2
- package/dist/src/components/accordion/AccordionTrigger.astro +2 -1
- package/dist/src/components/accordion/index.ts +7 -5
- package/dist/src/components/alert/Alert.astro +5 -2
- package/dist/src/components/alert/AlertDescription.astro +4 -4
- package/dist/src/components/alert/AlertTitle.astro +3 -3
- package/dist/src/components/alert/index.ts +6 -4
- package/dist/src/components/alert-dialog/AlertDialog.astro +273 -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 +50 -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/avatar/Avatar.astro +2 -2
- package/dist/src/components/avatar/AvatarFallback.astro +2 -2
- package/dist/src/components/avatar/AvatarImage.astro +13 -2
- package/dist/src/components/avatar/index.ts +6 -4
- package/dist/src/components/badge/Badge.astro +2 -2
- package/dist/src/components/badge/index.ts +4 -2
- package/dist/src/components/breadcrumb/Breadcrumb.astro +1 -1
- package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +4 -1
- package/dist/src/components/breadcrumb/BreadcrumbItem.astro +2 -2
- package/dist/src/components/breadcrumb/BreadcrumbLink.astro +2 -2
- package/dist/src/components/breadcrumb/BreadcrumbList.astro +2 -2
- package/dist/src/components/breadcrumb/BreadcrumbPage.astro +2 -1
- package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +2 -1
- package/dist/src/components/breadcrumb/index.ts +16 -6
- package/dist/src/components/button/Button.astro +2 -2
- package/dist/src/components/button/index.ts +4 -2
- package/dist/src/components/card/Card.astro +2 -2
- package/dist/src/components/card/CardContent.astro +2 -2
- package/dist/src/components/card/CardDescription.astro +2 -2
- package/dist/src/components/card/CardFooter.astro +2 -2
- package/dist/src/components/card/CardHeader.astro +2 -2
- package/dist/src/components/card/CardTitle.astro +2 -2
- package/dist/src/components/card/index.ts +16 -7
- 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 +33 -0
- package/dist/src/components/carousel/CarouselPrevious.astro +33 -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 +10 -3
- package/dist/src/components/checkbox/index.ts +4 -2
- package/dist/src/components/dialog/Dialog.astro +24 -11
- package/dist/src/components/dialog/DialogClose.astro +7 -2
- package/dist/src/components/dialog/DialogContent.astro +6 -3
- package/dist/src/components/dialog/DialogDescription.astro +2 -2
- package/dist/src/components/dialog/DialogFooter.astro +2 -2
- package/dist/src/components/dialog/DialogHeader.astro +2 -2
- package/dist/src/components/dialog/DialogTitle.astro +2 -2
- package/dist/src/components/dialog/DialogTrigger.astro +7 -1
- package/dist/src/components/dialog/index.ts +20 -5
- package/dist/src/components/dropdown/Dropdown.astro +1 -0
- package/dist/src/components/dropdown/DropdownContent.astro +2 -1
- package/dist/src/components/dropdown/DropdownItem.astro +2 -1
- package/dist/src/components/dropdown/DropdownLabel.astro +2 -2
- package/dist/src/components/dropdown/DropdownSeparator.astro +2 -1
- package/dist/src/components/dropdown/DropdownTrigger.astro +7 -2
- package/dist/src/components/dropdown/index.ts +14 -5
- package/dist/src/components/dropzone/Dropzone.astro +3 -2
- package/dist/src/components/dropzone/DropzoneFilesList.astro +3 -2
- package/dist/src/components/dropzone/DropzoneLoadingIndicator.astro +1 -1
- package/dist/src/components/dropzone/DropzoneUploadIndicator.astro +1 -1
- package/dist/src/components/dropzone/index.ts +14 -3
- package/dist/src/components/input/Input.astro +2 -2
- package/dist/src/components/input/index.ts +4 -2
- package/dist/src/components/label/Label.astro +2 -2
- package/dist/src/components/label/index.ts +4 -2
- package/dist/src/components/pagination/Pagination.astro +8 -2
- package/dist/src/components/pagination/PaginationContent.astro +2 -2
- package/dist/src/components/pagination/PaginationEllipsis.astro +7 -2
- package/dist/src/components/pagination/PaginationItem.astro +2 -2
- package/dist/src/components/pagination/PaginationLink.astro +2 -1
- package/dist/src/components/pagination/PaginationNext.astro +2 -1
- package/dist/src/components/pagination/PaginationPrevious.astro +2 -1
- package/dist/src/components/pagination/index.ts +18 -7
- package/dist/src/components/progress/Progress.astro +5 -2
- package/dist/src/components/progress/index.ts +7 -2
- package/dist/src/components/radio-group/RadioGroup.astro +2 -1
- package/dist/src/components/radio-group/RadioGroupItem.astro +7 -6
- package/dist/src/components/radio-group/index.ts +16 -3
- package/dist/src/components/select/Select.astro +1 -0
- package/dist/src/components/select/SelectContent.astro +3 -2
- package/dist/src/components/select/SelectGroup.astro +1 -1
- package/dist/src/components/select/SelectItem.astro +3 -2
- package/dist/src/components/select/SelectLabel.astro +2 -2
- package/dist/src/components/select/SelectSeparator.astro +2 -2
- package/dist/src/components/select/SelectTrigger.astro +2 -1
- package/dist/src/components/select/SelectValue.astro +2 -2
- package/dist/src/components/select/index.ts +18 -6
- 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 +90 -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/skeleton/Skeleton.astro +2 -2
- package/dist/src/components/skeleton/index.ts +6 -2
- package/dist/src/components/switch/Switch.astro +6 -4
- package/dist/src/components/switch/index.ts +8 -2
- package/dist/src/components/table/Table.astro +3 -3
- package/dist/src/components/table/TableBody.astro +2 -2
- package/dist/src/components/table/TableCaption.astro +2 -2
- package/dist/src/components/table/TableCell.astro +2 -2
- package/dist/src/components/table/TableFoot.astro +2 -2
- package/dist/src/components/table/TableHead.astro +2 -2
- package/dist/src/components/table/TableHeader.astro +2 -2
- package/dist/src/components/table/TableRow.astro +2 -2
- package/dist/src/components/table/index.ts +30 -9
- package/dist/src/components/tabs/Tabs.astro +2 -1
- package/dist/src/components/tabs/TabsContent.astro +4 -1
- package/dist/src/components/tabs/TabsList.astro +8 -2
- package/dist/src/components/tabs/TabsTrigger.astro +2 -1
- package/dist/src/components/tabs/index.ts +12 -5
- package/dist/src/components/textarea/Textarea.astro +2 -2
- package/dist/src/components/textarea/index.ts +6 -2
- package/dist/src/components/tooltip/Tooltip.astro +2 -1
- package/dist/src/components/tooltip/TooltipContent.astro +2 -1
- package/dist/src/components/tooltip/TooltipTrigger.astro +1 -1
- package/dist/src/components/tooltip/index.ts +8 -3
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ type Props = HTMLAttributes<"div"> & {
|
|
|
25
25
|
animationDuration?: number;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const selectContent = tv({
|
|
28
|
+
export const selectContent = tv({
|
|
29
29
|
base: [
|
|
30
30
|
"starwind-select-content",
|
|
31
31
|
"bg-popover text-popover-foreground absolute z-50 min-w-[8rem] rounded-md border shadow-md",
|
|
@@ -46,7 +46,7 @@ const selectContent = tv({
|
|
|
46
46
|
defaultVariants: { side: "bottom", align: "start" },
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
const selectContentInner = tv({
|
|
49
|
+
export const selectContentInner = tv({
|
|
50
50
|
base: "max-h-96 w-full min-w-(--select-trigger-width) overflow-y-auto p-1",
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -66,6 +66,7 @@ const {
|
|
|
66
66
|
data-side={side}
|
|
67
67
|
data-align={align}
|
|
68
68
|
data-state="closed"
|
|
69
|
+
data-slot="select-content"
|
|
69
70
|
tabindex="-1"
|
|
70
71
|
style={{
|
|
71
72
|
// hide the content initially. Script will remove this
|
|
@@ -14,7 +14,7 @@ type Props = HTMLAttributes<"div"> & {
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const selectItem = tv({
|
|
17
|
+
export const selectItem = tv({
|
|
18
18
|
base: [
|
|
19
19
|
"relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 outline-none select-none",
|
|
20
20
|
"focus:bg-accent focus:text-accent-foreground",
|
|
@@ -23,7 +23,7 @@ const selectItem = tv({
|
|
|
23
23
|
],
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
const selectItemIcon = tv({ base: "absolute left-2 size-3.5 items-center justify-center" });
|
|
26
|
+
export const selectItemIcon = tv({ base: "absolute left-2 size-3.5 items-center justify-center" });
|
|
27
27
|
|
|
28
28
|
const { class: className, value, disabled, ...rest } = Astro.props;
|
|
29
29
|
---
|
|
@@ -32,6 +32,7 @@ const { class: className, value, disabled, ...rest } = Astro.props;
|
|
|
32
32
|
class={selectItem({ class: className })}
|
|
33
33
|
data-value={value}
|
|
34
34
|
data-disabled={disabled}
|
|
35
|
+
data-slot="select-item"
|
|
35
36
|
aria-selected="false"
|
|
36
37
|
role="option"
|
|
37
38
|
tabindex="0"
|
|
@@ -4,11 +4,11 @@ import { tv } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"div">;
|
|
6
6
|
|
|
7
|
-
const selectLabel = tv({ base: "py-1.5 pr-2 pl-8 font-semibold" });
|
|
7
|
+
export const selectLabel = tv({ base: "py-1.5 pr-2 pl-8 font-semibold" });
|
|
8
8
|
|
|
9
9
|
const { class: className, ...rest } = Astro.props;
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
<div class={selectLabel({ class: className })} {...rest}>
|
|
12
|
+
<div class={selectLabel({ class: className })} data-slot="select-label" {...rest}>
|
|
13
13
|
<slot />
|
|
14
14
|
</div>
|
|
@@ -4,9 +4,9 @@ import { tv } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"div">;
|
|
6
6
|
|
|
7
|
-
const selectSeparator = tv({ base: "bg-muted -mx-1 my-1 h-px" });
|
|
7
|
+
export const selectSeparator = tv({ base: "bg-muted -mx-1 my-1 h-px" });
|
|
8
8
|
|
|
9
9
|
const { class: className, ...rest } = Astro.props;
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
<div class={selectSeparator({ class: className })} {...rest}></div>
|
|
12
|
+
<div class={selectSeparator({ class: className })} data-slot="select-separator" {...rest}></div>
|
|
@@ -15,7 +15,7 @@ type Props = Omit<HTMLAttributes<"button">, "role" | "type"> & {
|
|
|
15
15
|
required?: boolean;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const selectTrigger = tv({
|
|
18
|
+
export const selectTrigger = tv({
|
|
19
19
|
base: [
|
|
20
20
|
"starwind-select-trigger",
|
|
21
21
|
"border-input bg-background text-foreground ring-offset-background flex h-11 items-center justify-between rounded-md border px-3 py-2",
|
|
@@ -38,6 +38,7 @@ const { class: className, required = false, ...rest } = Astro.props;
|
|
|
38
38
|
aria-autocomplete="none"
|
|
39
39
|
aria-required={required ? "true" : "false"}
|
|
40
40
|
data-state="closed"
|
|
41
|
+
data-slot="select-trigger"
|
|
41
42
|
{...rest}
|
|
42
43
|
>
|
|
43
44
|
<slot />
|
|
@@ -9,11 +9,11 @@ type Props = HTMLAttributes<"span"> & {
|
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const selectValue = tv({ base: "pointer-events-none" });
|
|
12
|
+
export const selectValue = tv({ base: "pointer-events-none" });
|
|
13
13
|
|
|
14
14
|
const { placeholder = "select", class: className, ...rest } = Astro.props;
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
<span class={selectValue({ class: className })} {...rest}>
|
|
17
|
+
<span class={selectValue({ class: className })} data-slot="select-value" {...rest}>
|
|
18
18
|
{placeholder}
|
|
19
19
|
</span>
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import Select from "./Select.astro";
|
|
2
|
-
import SelectContent from "./SelectContent.astro";
|
|
2
|
+
import SelectContent, { selectContent, selectContentInner } from "./SelectContent.astro";
|
|
3
3
|
import SelectGroup from "./SelectGroup.astro";
|
|
4
|
-
import SelectItem from "./SelectItem.astro";
|
|
5
|
-
import SelectLabel from "./SelectLabel.astro";
|
|
6
|
-
import SelectSeparator from "./SelectSeparator.astro";
|
|
7
|
-
import SelectTrigger from "./SelectTrigger.astro";
|
|
4
|
+
import SelectItem, { selectItem, selectItemIcon } from "./SelectItem.astro";
|
|
5
|
+
import SelectLabel, { selectLabel } from "./SelectLabel.astro";
|
|
6
|
+
import SelectSeparator, { selectSeparator } from "./SelectSeparator.astro";
|
|
7
|
+
import SelectTrigger, { selectTrigger } from "./SelectTrigger.astro";
|
|
8
8
|
import type { SelectChangeEvent, SelectEvent } from "./SelectTypes";
|
|
9
|
-
import SelectValue from "./SelectValue.astro";
|
|
9
|
+
import SelectValue, { selectValue } from "./SelectValue.astro";
|
|
10
|
+
|
|
11
|
+
const SelectVariants = {
|
|
12
|
+
selectContent,
|
|
13
|
+
selectContentInner,
|
|
14
|
+
selectItem,
|
|
15
|
+
selectItemIcon,
|
|
16
|
+
selectLabel,
|
|
17
|
+
selectSeparator,
|
|
18
|
+
selectTrigger,
|
|
19
|
+
selectValue,
|
|
20
|
+
};
|
|
10
21
|
|
|
11
22
|
export {
|
|
12
23
|
Select,
|
|
@@ -19,6 +30,7 @@ export {
|
|
|
19
30
|
SelectSeparator,
|
|
20
31
|
SelectTrigger,
|
|
21
32
|
SelectValue,
|
|
33
|
+
SelectVariants,
|
|
22
34
|
};
|
|
23
35
|
|
|
24
36
|
export default {
|
|
@@ -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,90 @@
|
|
|
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
|
+
"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary",
|
|
60
|
+
"absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100",
|
|
61
|
+
"focus-visible:outline-outline focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
62
|
+
"disabled:pointer-events-none",
|
|
63
|
+
],
|
|
64
|
+
});
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
<!-- dialog overlay -->
|
|
68
|
+
<div class={dialogBackdrop()} data-state="closed" data-slot="dialog-backdrop"></div>
|
|
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
|
+
<X class="size-5" />
|
|
88
|
+
<span class="sr-only">Close</span>
|
|
89
|
+
</button>
|
|
90
|
+
</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-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
|
+
};
|
|
@@ -6,9 +6,9 @@ type Props = HTMLAttributes<"div">;
|
|
|
6
6
|
|
|
7
7
|
const { class: className, ...rest } = Astro.props;
|
|
8
8
|
|
|
9
|
-
const skeleton = tv({
|
|
9
|
+
export const skeleton = tv({
|
|
10
10
|
base: "bg-accent animate-pulse rounded-md",
|
|
11
11
|
});
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<div class={skeleton({ class: className })} {...rest}></div>
|
|
14
|
+
<div class={skeleton({ class: className })} data-slot="skeleton" {...rest}></div>
|
|
@@ -59,7 +59,7 @@ if (rest["aria-label"]) {
|
|
|
59
59
|
ariaLabel = "switch";
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
const switchButton = tv({
|
|
62
|
+
export const switchButton = tv({
|
|
63
63
|
base: [
|
|
64
64
|
"starwind-transition-colors border-input bg-muted inline-flex h-(--height) w-(--width) items-center rounded-full border",
|
|
65
65
|
"group peer ring-offset-background focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
@@ -79,7 +79,7 @@ const switchButton = tv({
|
|
|
79
79
|
defaultVariants: { variant: "default" },
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
const switchToggle = tv({
|
|
82
|
+
export const switchToggle = tv({
|
|
83
83
|
base: [
|
|
84
84
|
"bg-foreground inline-block transform rounded-full transition-transform",
|
|
85
85
|
"group-aria-checked:translate-x-(--translation) group-aria-[checked=false]:translate-x-[calc(var(--padding)-var(--border-offset))]",
|
|
@@ -88,7 +88,7 @@ const switchToggle = tv({
|
|
|
88
88
|
defaultVariants: { size: "md" },
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
const switchLabel = tv({
|
|
91
|
+
export const switchLabel = tv({
|
|
92
92
|
base: "text-foreground ml-2 font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
93
93
|
variants: { size: { sm: "text-sm", md: "text-base", lg: "text-lg" } },
|
|
94
94
|
defaultVariants: { size: "md" },
|
|
@@ -109,17 +109,19 @@ const switchLabel = tv({
|
|
|
109
109
|
"--width": `calc((var(--spacing) * ${sizeMultiplier} * 2) + (var(--padding) * 3))`,
|
|
110
110
|
"--border-offset": "1px",
|
|
111
111
|
}}
|
|
112
|
+
data-slot="switch-button"
|
|
112
113
|
{...rest}
|
|
113
114
|
>
|
|
114
115
|
<span
|
|
115
116
|
class={switchToggle({ size })}
|
|
117
|
+
data-slot="switch-toggle"
|
|
116
118
|
style={{
|
|
117
119
|
"--translation": `calc((var(--spacing) * ${sizeMultiplier}) + (var(--padding) * 2) - var(--border-offset))`,
|
|
118
120
|
}}></span>
|
|
119
121
|
</button>
|
|
120
122
|
{
|
|
121
123
|
label && (
|
|
122
|
-
<label for={id} class={switchLabel({ size })}>
|
|
124
|
+
<label for={id} class={switchLabel({ size })} data-slot="switch-label">
|
|
123
125
|
{label}
|
|
124
126
|
</label>
|
|
125
127
|
)
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import Switch from "./Switch.astro";
|
|
1
|
+
import Switch, { switchButton, switchLabel, switchToggle } from "./Switch.astro";
|
|
2
2
|
import type { SwitchChangeEvent } from "./SwitchTypes";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const SwitchVariants = {
|
|
5
|
+
switchButton,
|
|
6
|
+
switchToggle,
|
|
7
|
+
switchLabel,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { Switch, type SwitchChangeEvent, SwitchVariants };
|
|
5
11
|
|
|
6
12
|
export default Switch;
|
|
@@ -4,15 +4,15 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"table"> & VariantProps<typeof table>;
|
|
6
6
|
|
|
7
|
-
const table = tv({
|
|
7
|
+
export const table = tv({
|
|
8
8
|
base: "w-full caption-bottom text-sm",
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const { class: className, ...rest } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<div data-table-container class="relative w-full overflow-x-auto">
|
|
15
|
-
<table data-table class={table({ class: className })} {...rest} role="table">
|
|
14
|
+
<div data-slot="table-container" class="relative w-full overflow-x-auto">
|
|
15
|
+
<table data-slot="table" class={table({ class: className })} {...rest} role="table">
|
|
16
16
|
<slot />
|
|
17
17
|
</table>
|
|
18
18
|
</div>
|
|
@@ -4,13 +4,13 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"tbody"> & VariantProps<typeof tableBody>;
|
|
6
6
|
|
|
7
|
-
const tableBody = tv({
|
|
7
|
+
export const tableBody = tv({
|
|
8
8
|
base: "[&_tr:last-child]:border-0",
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const { class: className, ...rest } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<tbody data-table-body class={tableBody({ class: className })} {...rest}>
|
|
14
|
+
<tbody data-slot="table-body" class={tableBody({ class: className })} {...rest}>
|
|
15
15
|
<slot />
|
|
16
16
|
</tbody>
|
|
@@ -4,13 +4,13 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"caption"> & VariantProps<typeof tableCaption>;
|
|
6
6
|
|
|
7
|
-
const tableCaption = tv({
|
|
7
|
+
export const tableCaption = tv({
|
|
8
8
|
base: "text-muted-foreground mt-4 text-sm",
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const { class: className, ...rest } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<caption data-table-caption class={tableCaption({ class: className })} {...rest}>
|
|
14
|
+
<caption data-slot="table-caption" class={tableCaption({ class: className })} {...rest}>
|
|
15
15
|
<slot />
|
|
16
16
|
</caption>
|
|
@@ -4,13 +4,13 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"td"> & VariantProps<typeof tableCell>;
|
|
6
6
|
|
|
7
|
-
const tableCell = tv({
|
|
7
|
+
export const tableCell = tv({
|
|
8
8
|
base: "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const { class: className, ...rest } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<td data-table-cell class={tableCell({ class: className })} {...rest}>
|
|
14
|
+
<td data-slot="table-cell" class={tableCell({ class: className })} {...rest}>
|
|
15
15
|
<slot />
|
|
16
16
|
</td>
|
|
@@ -4,13 +4,13 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"tfoot"> & VariantProps<typeof tableFoot>;
|
|
6
6
|
|
|
7
|
-
const tableFoot = tv({
|
|
7
|
+
export const tableFoot = tv({
|
|
8
8
|
base: "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const { class: className, ...rest } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<tfoot data-table-foot class={tableFoot({ class: className })} {...rest}>
|
|
14
|
+
<tfoot data-slot="table-foot" class={tableFoot({ class: className })} {...rest}>
|
|
15
15
|
<slot />
|
|
16
16
|
</tfoot>
|
|
@@ -4,13 +4,13 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"th"> & VariantProps<typeof tableHead>;
|
|
6
6
|
|
|
7
|
-
const tableHead = tv({
|
|
7
|
+
export const tableHead = tv({
|
|
8
8
|
base: "text-muted-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const { class: className, ...rest } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<th data-table-head class={tableHead({ class: className })} {...rest} role="columnheader">
|
|
14
|
+
<th data-slot="table-head" class={tableHead({ class: className })} {...rest} role="columnheader">
|
|
15
15
|
<slot />
|
|
16
16
|
</th>
|
|
@@ -4,13 +4,13 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"thead"> & VariantProps<typeof tableHeader>;
|
|
6
6
|
|
|
7
|
-
const tableHeader = tv({
|
|
7
|
+
export const tableHeader = tv({
|
|
8
8
|
base: "[&_tr]:border-b",
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const { class: className, ...rest } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<thead data-table-header class={tableHeader({ class: className })} {...rest}>
|
|
14
|
+
<thead data-slot="table-header" class={tableHeader({ class: className })} {...rest}>
|
|
15
15
|
<slot />
|
|
16
16
|
</thead>
|
|
@@ -4,13 +4,13 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"tr"> & VariantProps<typeof tableRow>;
|
|
6
6
|
|
|
7
|
-
const tableRow = tv({
|
|
7
|
+
export const tableRow = tv({
|
|
8
8
|
base: "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const { class: className, ...rest } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<tr data-table-row class={tableRow({ class: className })} {...rest} role="row">
|
|
14
|
+
<tr data-slot="table-row" class={tableRow({ class: className })} {...rest} role="row">
|
|
15
15
|
<slot />
|
|
16
16
|
</tr>
|