@starwind-ui/core 1.8.0 → 1.10.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 +50 -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 +4 -3
- package/dist/src/components/accordion/index.ts +7 -5
- package/dist/src/components/alert/Alert.astro +6 -3
- 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/aspect-ratio/AspectRatio.astro +32 -0
- package/dist/src/components/aspect-ratio/index.ts +7 -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 +15 -12
- 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 +15 -15
- 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 +28 -12
- 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 +9 -6
- 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 +3 -2
- package/dist/src/components/dropdown/DropdownTrigger.astro +9 -3
- package/dist/src/components/dropdown/index.ts +14 -5
- package/dist/src/components/dropzone/Dropzone.astro +7 -6
- 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 +4 -4
- package/dist/src/components/input/index.ts +4 -2
- 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/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 +10 -29
- 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 +6 -3
- 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 +17 -15
- 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 +4 -3
- package/dist/src/components/select/SelectValue.astro +2 -2
- package/dist/src/components/select/index.ts +18 -6
- 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 +88 -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 +3 -3
- package/dist/src/components/skeleton/index.ts +6 -2
- 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 +16 -13
- 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 +9 -3
- package/dist/src/components/tabs/TabsTrigger.astro +6 -3
- package/dist/src/components/tabs/index.ts +12 -5
- package/dist/src/components/textarea/Textarea.astro +4 -4
- 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 +21 -5
- package/dist/src/components/tooltip/TooltipTrigger.astro +1 -1
- package/dist/src/components/tooltip/index.ts +8 -3
- package/package.json +1 -1
|
@@ -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
|
|
7
|
+
export const selectLabel = tv({ base: "text-muted-foreground py-1.5 pr-2 pl-8 text-sm" });
|
|
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,11 +15,11 @@ 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
|
-
"border-input bg-
|
|
22
|
-
"focus:
|
|
21
|
+
"border-input dark:bg-input/30 text-foreground ring-offset-background flex h-11 items-center justify-between rounded-md border bg-transparent px-3 py-2 shadow-xs",
|
|
22
|
+
"focus-visible:border-outline focus-visible:ring-outline/50 transition-[color,box-shadow] outline-none focus-visible:ring-3",
|
|
23
23
|
"disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
24
24
|
],
|
|
25
25
|
});
|
|
@@ -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,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,88 @@
|
|
|
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
|
+
<div class={dialogBackdrop()} data-state="closed" data-slot="dialog-backdrop"></div>
|
|
67
|
+
|
|
68
|
+
<dialog
|
|
69
|
+
class={sheetContent({
|
|
70
|
+
side,
|
|
71
|
+
class: className,
|
|
72
|
+
})}
|
|
73
|
+
data-state="closed"
|
|
74
|
+
data-slot="sheet-content"
|
|
75
|
+
data-close-duration="300"
|
|
76
|
+
{...rest}
|
|
77
|
+
>
|
|
78
|
+
<slot />
|
|
79
|
+
<button
|
|
80
|
+
type="button"
|
|
81
|
+
class={sheetCloseButton()}
|
|
82
|
+
data-slot="sheet-close"
|
|
83
|
+
aria-label="Close dialog"
|
|
84
|
+
>
|
|
85
|
+
<X class="size-5 transition-opacity" />
|
|
86
|
+
<span class="sr-only">Close</span>
|
|
87
|
+
</button>
|
|
88
|
+
</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({
|
|
10
|
-
base: "bg-
|
|
9
|
+
export const skeleton = tv({
|
|
10
|
+
base: "bg-muted 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>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Loader2 from "@tabler/icons/outline/loader-2.svg";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
import { tv } from "tailwind-variants";
|
|
5
|
+
|
|
6
|
+
type Props = Omit<HTMLAttributes<"svg">, "role" | "aria-label">;
|
|
7
|
+
|
|
8
|
+
export const spinner = tv({
|
|
9
|
+
base: "size-4 animate-spin",
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const { class: className, ...rest } = Astro.props;
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<Loader2
|
|
16
|
+
role="status"
|
|
17
|
+
aria-label="Loading"
|
|
18
|
+
class={spinner({ class: className })}
|
|
19
|
+
data-slot="spinner"
|
|
20
|
+
{...rest}
|
|
21
|
+
/>
|
|
@@ -59,27 +59,28 @@ 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
|
-
"
|
|
65
|
-
"group peer ring-offset-background
|
|
64
|
+
"border-input bg-muted inline-flex h-(--height) w-(--width) items-center rounded-full border",
|
|
65
|
+
"group peer ring-offset-background transition outline-none focus-visible:ring-3",
|
|
66
66
|
"not-disabled:cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
|
|
67
67
|
],
|
|
68
68
|
variants: {
|
|
69
69
|
variant: {
|
|
70
|
-
primary: "aria-checked:border-primary focus:
|
|
71
|
-
secondary:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
primary: "aria-checked:border-primary focus-visible:border-primary/70 focus:ring-primary/50",
|
|
71
|
+
secondary:
|
|
72
|
+
"aria-checked:border-secondary focus-visible:border-secondary/70 focus:ring-secondary/50",
|
|
73
|
+
default: "aria-checked:border-foreground focus-visible:border-outline focus:ring-outline/50",
|
|
74
|
+
info: "aria-checked:border-info focus-visible:border-info/70 focus:ring-info/50",
|
|
75
|
+
success: "aria-checked:border-success focus-visible:border-success/70 focus:ring-success/50",
|
|
76
|
+
warning: "aria-checked:border-warning focus-visible:border-warning/70 focus:ring-warning/50",
|
|
77
|
+
error: "aria-checked:border-error focus-visible:border-error/70 focus:ring-error/50",
|
|
77
78
|
},
|
|
78
79
|
},
|
|
79
80
|
defaultVariants: { variant: "default" },
|
|
80
81
|
});
|
|
81
82
|
|
|
82
|
-
const switchToggle = tv({
|
|
83
|
+
export const switchToggle = tv({
|
|
83
84
|
base: [
|
|
84
85
|
"bg-foreground inline-block transform rounded-full transition-transform",
|
|
85
86
|
"group-aria-checked:translate-x-(--translation) group-aria-[checked=false]:translate-x-[calc(var(--padding)-var(--border-offset))]",
|
|
@@ -88,7 +89,7 @@ const switchToggle = tv({
|
|
|
88
89
|
defaultVariants: { size: "md" },
|
|
89
90
|
});
|
|
90
91
|
|
|
91
|
-
const switchLabel = tv({
|
|
92
|
+
export const switchLabel = tv({
|
|
92
93
|
base: "text-foreground ml-2 font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
93
94
|
variants: { size: { sm: "text-sm", md: "text-base", lg: "text-lg" } },
|
|
94
95
|
defaultVariants: { size: "md" },
|
|
@@ -109,17 +110,19 @@ const switchLabel = tv({
|
|
|
109
110
|
"--width": `calc((var(--spacing) * ${sizeMultiplier} * 2) + (var(--padding) * 3))`,
|
|
110
111
|
"--border-offset": "1px",
|
|
111
112
|
}}
|
|
113
|
+
data-slot="switch-button"
|
|
112
114
|
{...rest}
|
|
113
115
|
>
|
|
114
116
|
<span
|
|
115
117
|
class={switchToggle({ size })}
|
|
118
|
+
data-slot="switch-toggle"
|
|
116
119
|
style={{
|
|
117
120
|
"--translation": `calc((var(--spacing) * ${sizeMultiplier}) + (var(--padding) * 2) - var(--border-offset))`,
|
|
118
121
|
}}></span>
|
|
119
122
|
</button>
|
|
120
123
|
{
|
|
121
124
|
label && (
|
|
122
|
-
<label for={id} class={switchLabel({ size })}>
|
|
125
|
+
<label for={id} class={switchLabel({ size })} data-slot="switch-label">
|
|
123
126
|
{label}
|
|
124
127
|
</label>
|
|
125
128
|
)
|
|
@@ -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>
|