@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
|
@@ -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
|
+
export const itemContent = tv({
|
|
8
|
+
base: "flex flex-1 flex-col gap-1.5 [&+[data-slot=item-content]]:flex-none",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const { class: className, ...rest } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<div class={itemContent({ class: className })} data-slot="item-content" {...rest}>
|
|
15
|
+
<slot />
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
|
+
|
|
5
|
+
type Props = HTMLAttributes<"p">;
|
|
6
|
+
|
|
7
|
+
export const itemDescription = tv({
|
|
8
|
+
base: [
|
|
9
|
+
"text-muted-foreground line-clamp-2 leading-snug font-normal text-balance",
|
|
10
|
+
"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
|
|
11
|
+
],
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const { class: className, ...rest } = Astro.props;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<p class={itemDescription({ class: className })} data-slot="item-description" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</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
|
+
export const itemFooter = tv({
|
|
8
|
+
base: "flex basis-full items-center justify-between gap-2",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const { class: className, ...rest } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<div class={itemFooter({ class: className })} data-slot="item-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
|
+
export const itemGroup = tv({
|
|
8
|
+
base: "group/item-group flex flex-col",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const { class: className, ...rest } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<div role="list" class={itemGroup({ class: className })} data-slot="item-group" {...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
|
+
export const itemHeader = tv({
|
|
8
|
+
base: "flex basis-full items-center justify-between gap-2",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const { class: className, ...rest } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<div class={itemHeader({ class: className })} data-slot="item-header" {...rest}>
|
|
15
|
+
<slot />
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
|
+
|
|
5
|
+
type Props = HTMLAttributes<"div"> & {
|
|
6
|
+
/**
|
|
7
|
+
* Variant of the item media
|
|
8
|
+
* @default "default"
|
|
9
|
+
*/
|
|
10
|
+
variant?: "default" | "icon" | "image";
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const itemMedia = tv({
|
|
14
|
+
base: [
|
|
15
|
+
"flex shrink-0 items-center justify-center gap-2 [&_svg]:pointer-events-none",
|
|
16
|
+
"group-has-[[data-slot=item-description]]/item:translate-y-0.5 group-has-[[data-slot=item-description]]/item:self-start",
|
|
17
|
+
],
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
default: "bg-transparent",
|
|
21
|
+
icon: "bg-muted size-8 rounded-sm border [&_svg:not([class*='size-'])]:size-4",
|
|
22
|
+
image: "size-10 overflow-hidden rounded-sm [&_img]:size-full [&_img]:object-cover",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: "default",
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const { variant = "default", class: className, ...rest } = Astro.props;
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<div
|
|
34
|
+
class={itemMedia({ variant, class: className })}
|
|
35
|
+
data-slot="item-media"
|
|
36
|
+
data-variant={variant}
|
|
37
|
+
{...rest}
|
|
38
|
+
>
|
|
39
|
+
<slot />
|
|
40
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ComponentProps } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
|
+
|
|
5
|
+
import { Separator } from "@/components/starwind/separator";
|
|
6
|
+
|
|
7
|
+
type Props = ComponentProps<typeof Separator>;
|
|
8
|
+
|
|
9
|
+
export const itemSeparator = tv({
|
|
10
|
+
base: "my-0",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const { class: className, orientation = "horizontal", ...rest } = Astro.props;
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
<Separator
|
|
17
|
+
orientation={orientation}
|
|
18
|
+
class={itemSeparator({ class: className })}
|
|
19
|
+
data-slot="item-separator"
|
|
20
|
+
{...rest}
|
|
21
|
+
/>
|
|
@@ -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
|
+
export const itemTitle = tv({
|
|
8
|
+
base: "flex w-fit items-center gap-2 leading-snug font-medium",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const { class: className, ...rest } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<div class={itemTitle({ class: className })} data-slot="item-title" {...rest}>
|
|
15
|
+
<slot />
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import Item, { item } from "./Item.astro";
|
|
2
|
+
import ItemActions, { itemActions } from "./ItemActions.astro";
|
|
3
|
+
import ItemContent, { itemContent } from "./ItemContent.astro";
|
|
4
|
+
import ItemDescription, { itemDescription } from "./ItemDescription.astro";
|
|
5
|
+
import ItemFooter, { itemFooter } from "./ItemFooter.astro";
|
|
6
|
+
import ItemGroup, { itemGroup } from "./ItemGroup.astro";
|
|
7
|
+
import ItemHeader, { itemHeader } from "./ItemHeader.astro";
|
|
8
|
+
import ItemMedia, { itemMedia } from "./ItemMedia.astro";
|
|
9
|
+
import ItemSeparator, { itemSeparator } from "./ItemSeparator.astro";
|
|
10
|
+
import ItemTitle, { itemTitle } from "./ItemTitle.astro";
|
|
11
|
+
|
|
12
|
+
const ItemVariants = {
|
|
13
|
+
item,
|
|
14
|
+
itemActions,
|
|
15
|
+
itemContent,
|
|
16
|
+
itemDescription,
|
|
17
|
+
itemFooter,
|
|
18
|
+
itemGroup,
|
|
19
|
+
itemHeader,
|
|
20
|
+
itemMedia,
|
|
21
|
+
itemSeparator,
|
|
22
|
+
itemTitle,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
Item,
|
|
27
|
+
ItemActions,
|
|
28
|
+
ItemContent,
|
|
29
|
+
ItemDescription,
|
|
30
|
+
ItemFooter,
|
|
31
|
+
ItemGroup,
|
|
32
|
+
ItemHeader,
|
|
33
|
+
ItemMedia,
|
|
34
|
+
ItemSeparator,
|
|
35
|
+
ItemTitle,
|
|
36
|
+
ItemVariants,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
Root: Item,
|
|
41
|
+
Actions: ItemActions,
|
|
42
|
+
Content: ItemContent,
|
|
43
|
+
Description: ItemDescription,
|
|
44
|
+
Footer: ItemFooter,
|
|
45
|
+
Group: ItemGroup,
|
|
46
|
+
Header: ItemHeader,
|
|
47
|
+
Media: ItemMedia,
|
|
48
|
+
Separator: ItemSeparator,
|
|
49
|
+
Title: ItemTitle,
|
|
50
|
+
};
|
|
@@ -4,7 +4,7 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"label"> & VariantProps<typeof label>;
|
|
6
6
|
|
|
7
|
-
const label = tv({
|
|
7
|
+
export const label = tv({
|
|
8
8
|
base: [
|
|
9
9
|
"text-foreground leading-none font-medium",
|
|
10
10
|
"peer-disabled:cursor-not-allowed peer-disabled:opacity-70 has-[+:disabled]:cursor-not-allowed has-[+:disabled]:opacity-70",
|
|
@@ -17,6 +17,6 @@ const { size, class: className, ...rest } = Astro.props;
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
{/* eslint-disable-next-line astro/jsx-a11y/label-has-associated-control */}
|
|
20
|
-
<label class={label({ size, class: className })} {...rest}>
|
|
20
|
+
<label class={label({ size, class: className })} data-slot="label" {...rest}>
|
|
21
21
|
<slot />
|
|
22
22
|
</label>
|
|
@@ -4,11 +4,17 @@ import { tv } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
type Props = HTMLAttributes<"nav">;
|
|
6
6
|
|
|
7
|
-
const pagination = tv({ base: "mx-auto flex w-full justify-center" });
|
|
7
|
+
export const pagination = tv({ base: "mx-auto flex w-full justify-center" });
|
|
8
8
|
|
|
9
9
|
const { class: className, ...rest } = Astro.props;
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
<nav
|
|
12
|
+
<nav
|
|
13
|
+
role="navigation"
|
|
14
|
+
aria-label="pagination"
|
|
15
|
+
class={pagination({ class: className })}
|
|
16
|
+
data-slot="pagination"
|
|
17
|
+
{...rest}
|
|
18
|
+
>
|
|
13
19
|
<slot />
|
|
14
20
|
</nav>
|
|
@@ -6,11 +6,11 @@ type Props = HTMLAttributes<"ul"> & {
|
|
|
6
6
|
children: any;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const paginationContent = tv({ base: "flex flex-row items-center gap-1" });
|
|
9
|
+
export const paginationContent = tv({ base: "flex flex-row items-center gap-1" });
|
|
10
10
|
|
|
11
11
|
const { class: className, ...rest } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<ul class={paginationContent({ class: className })} {...rest}>
|
|
14
|
+
<ul class={paginationContent({ class: className })} data-slot="pagination-content" {...rest}>
|
|
15
15
|
<slot />
|
|
16
16
|
</ul>
|
|
@@ -5,12 +5,17 @@ import { tv } from "tailwind-variants";
|
|
|
5
5
|
|
|
6
6
|
type Props = HTMLAttributes<"span">;
|
|
7
7
|
|
|
8
|
-
const paginationEllipsis = tv({ base: "flex h-9 w-9 items-center justify-center" });
|
|
8
|
+
export const paginationEllipsis = tv({ base: "flex h-9 w-9 items-center justify-center" });
|
|
9
9
|
|
|
10
10
|
const { class: className, ...rest } = Astro.props;
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
<span
|
|
13
|
+
<span
|
|
14
|
+
aria-hidden
|
|
15
|
+
class={paginationEllipsis({ class: className })}
|
|
16
|
+
data-slot="pagination-ellipsis"
|
|
17
|
+
{...rest}
|
|
18
|
+
>
|
|
14
19
|
<Dots class="size-4" />
|
|
15
20
|
<span class="sr-only">More pages</span>
|
|
16
21
|
</span>
|
|
@@ -6,11 +6,11 @@ type Props = HTMLAttributes<"li"> & {
|
|
|
6
6
|
children: any;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const paginationItem = tv({ base: "" });
|
|
9
|
+
export const paginationItem = tv({ base: "" });
|
|
10
10
|
|
|
11
11
|
const { class: className, ...rest } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
<li class={paginationItem({ class: className })} {...rest}>
|
|
14
|
+
<li class={paginationItem({ class: className })} data-slot="pagination-item" {...rest}>
|
|
15
15
|
<slot />
|
|
16
16
|
</li>
|
|
@@ -1,42 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import {
|
|
3
|
+
import type { VariantProps } from "tailwind-variants";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
isActive?: boolean;
|
|
7
|
-
size?: "sm" | "md" | "lg" | "icon";
|
|
8
|
-
}
|
|
5
|
+
import { ButtonVariants } from "@/components/starwind/button";
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
17
|
-
],
|
|
18
|
-
variants: {
|
|
19
|
-
isActive: {
|
|
20
|
-
true: "border-border hover:bg-border hover:text-foreground focus-visible:outline-outline border",
|
|
21
|
-
false:
|
|
22
|
-
"hover:bg-foreground/10 hover:text-foreground focus-visible:outline-outline bg-transparent",
|
|
23
|
-
},
|
|
24
|
-
size: {
|
|
25
|
-
sm: "h-9 px-3 py-2 text-sm",
|
|
26
|
-
md: "h-11 px-4 py-2 text-base",
|
|
27
|
-
lg: "h-12 px-8 py-2 text-lg",
|
|
28
|
-
icon: "h-11 w-11",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
defaultVariants: { isActive: false, size: "icon" },
|
|
32
|
-
});
|
|
7
|
+
type Props = HTMLAttributes<"a"> &
|
|
8
|
+
Omit<VariantProps<typeof ButtonVariants.button>, "variant"> & {
|
|
9
|
+
isActive?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const paginationLink = ButtonVariants.button;
|
|
33
13
|
|
|
34
14
|
const { class: className, isActive, size = "icon", ...rest } = Astro.props;
|
|
35
15
|
---
|
|
36
16
|
|
|
37
17
|
<a
|
|
38
18
|
aria-current={isActive ? "page" : undefined}
|
|
39
|
-
class={
|
|
19
|
+
class={ButtonVariants.button({ variant: isActive ? "outline" : "ghost", size, class: className })}
|
|
20
|
+
data-slot="pagination-link"
|
|
40
21
|
{...rest}
|
|
41
22
|
>
|
|
42
23
|
<slot />
|
|
@@ -7,7 +7,7 @@ import PaginationLink from "./PaginationLink.astro";
|
|
|
7
7
|
|
|
8
8
|
type Props = HTMLAttributes<"a"> & { size?: "sm" | "md" | "lg" | "icon" };
|
|
9
9
|
|
|
10
|
-
const paginationNext = tv({ base: "group gap-1" });
|
|
10
|
+
export const paginationNext = tv({ base: "group gap-1" });
|
|
11
11
|
|
|
12
12
|
const { class: className, size = "md", ...rest } = Astro.props;
|
|
13
13
|
---
|
|
@@ -16,6 +16,7 @@ const { class: className, size = "md", ...rest } = Astro.props;
|
|
|
16
16
|
aria-label="Go to next page"
|
|
17
17
|
size={size}
|
|
18
18
|
class={paginationNext({ class: className })}
|
|
19
|
+
data-slot="pagination-next"
|
|
19
20
|
{...rest}
|
|
20
21
|
>
|
|
21
22
|
<slot />
|
|
@@ -7,7 +7,7 @@ import PaginationLink from "./PaginationLink.astro";
|
|
|
7
7
|
|
|
8
8
|
type Props = HTMLAttributes<"a"> & { size?: "sm" | "md" | "lg" | "icon" };
|
|
9
9
|
|
|
10
|
-
const paginationPrevious = tv({ base: "group gap-1" });
|
|
10
|
+
export const paginationPrevious = tv({ base: "group gap-1" });
|
|
11
11
|
|
|
12
12
|
const { class: className, size = "md", ...rest } = Astro.props;
|
|
13
13
|
---
|
|
@@ -16,6 +16,7 @@ const { class: className, size = "md", ...rest } = Astro.props;
|
|
|
16
16
|
aria-label="Go to previous page"
|
|
17
17
|
size={size}
|
|
18
18
|
class={paginationPrevious({ class: className })}
|
|
19
|
+
data-slot="pagination-previous"
|
|
19
20
|
{...rest}
|
|
20
21
|
>
|
|
21
22
|
<ChevronLeft class="size-4 transition-transform group-hover:-translate-x-1" />
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import Pagination from "./Pagination.astro";
|
|
2
|
-
import PaginationContent from "./PaginationContent.astro";
|
|
3
|
-
import PaginationEllipsis from "./PaginationEllipsis.astro";
|
|
4
|
-
import PaginationItem from "./PaginationItem.astro";
|
|
5
|
-
import PaginationLink from "./PaginationLink.astro";
|
|
6
|
-
import PaginationNext from "./PaginationNext.astro";
|
|
7
|
-
import PaginationPrevious from "./PaginationPrevious.astro";
|
|
1
|
+
import Pagination, { pagination } from "./Pagination.astro";
|
|
2
|
+
import PaginationContent, { paginationContent } from "./PaginationContent.astro";
|
|
3
|
+
import PaginationEllipsis, { paginationEllipsis } from "./PaginationEllipsis.astro";
|
|
4
|
+
import PaginationItem, { paginationItem } from "./PaginationItem.astro";
|
|
5
|
+
import PaginationLink, { paginationLink } from "./PaginationLink.astro";
|
|
6
|
+
import PaginationNext, { paginationNext } from "./PaginationNext.astro";
|
|
7
|
+
import PaginationPrevious, { paginationPrevious } from "./PaginationPrevious.astro";
|
|
8
|
+
|
|
9
|
+
const PaginationVariants = {
|
|
10
|
+
pagination,
|
|
11
|
+
paginationContent,
|
|
12
|
+
paginationEllipsis,
|
|
13
|
+
paginationItem,
|
|
14
|
+
paginationLink,
|
|
15
|
+
paginationNext,
|
|
16
|
+
paginationPrevious,
|
|
17
|
+
};
|
|
8
18
|
|
|
9
19
|
export {
|
|
10
20
|
Pagination,
|
|
@@ -14,6 +24,7 @@ export {
|
|
|
14
24
|
PaginationLink,
|
|
15
25
|
PaginationNext,
|
|
16
26
|
PaginationPrevious,
|
|
27
|
+
PaginationVariants,
|
|
17
28
|
};
|
|
18
29
|
|
|
19
30
|
export default {
|
|
@@ -23,8 +23,8 @@ const isIndeterminate = value == null;
|
|
|
23
23
|
const valuePercent = isIndeterminate ? undefined : Math.round((value / max) * 100);
|
|
24
24
|
const valueText = isIndeterminate ? undefined : `${valuePercent}%`;
|
|
25
25
|
|
|
26
|
-
const progress = tv({
|
|
27
|
-
base: ["starwind-progress-bar", "bg-
|
|
26
|
+
export const progress = tv({
|
|
27
|
+
base: ["starwind-progress-bar", "bg-muted h-2 w-full overflow-hidden rounded-full"],
|
|
28
28
|
variants: {
|
|
29
29
|
variant: {
|
|
30
30
|
indeterminate: "relative",
|
|
@@ -32,7 +32,7 @@ const progress = tv({
|
|
|
32
32
|
},
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
export const progressIndicator = tv({
|
|
36
36
|
base: ["starwind-progress-indicator", "h-full w-full flex-1 transition-transform"],
|
|
37
37
|
variants: {
|
|
38
38
|
variant: {
|
|
@@ -53,6 +53,8 @@ const indicator = tv({
|
|
|
53
53
|
},
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
const indicator = progressIndicator;
|
|
57
|
+
|
|
56
58
|
const progressClasses = progress({
|
|
57
59
|
variant: isIndeterminate ? "indeterminate" : undefined,
|
|
58
60
|
class: className,
|
|
@@ -78,6 +80,7 @@ const indicatorStyle = isIndeterminate
|
|
|
78
80
|
data-value={value}
|
|
79
81
|
data-max={max}
|
|
80
82
|
data-indeterminate={isIndeterminate}
|
|
83
|
+
data-slot="progress"
|
|
81
84
|
{...rest}
|
|
82
85
|
>
|
|
83
86
|
<div class:list={[indicatorClasses]} style={indicatorStyle}></div>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import Progress from "./Progress.astro";
|
|
1
|
+
import Progress, { progress, progressIndicator } from "./Progress.astro";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const ProgressVariants = {
|
|
4
|
+
progress,
|
|
5
|
+
progressIndicator,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { Progress, ProgressVariants };
|
|
4
9
|
|
|
5
10
|
export default Progress;
|
|
@@ -25,7 +25,7 @@ type Props = HTMLAttributes<"fieldset"> & {
|
|
|
25
25
|
orientation?: "horizontal" | "vertical";
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const radioGroup = tv({
|
|
28
|
+
export const radioGroup = tv({
|
|
29
29
|
base: "starwind-radio-group disabled:cursor-not-allowed disabled:opacity-70",
|
|
30
30
|
variants: {
|
|
31
31
|
orientation: {
|
|
@@ -53,6 +53,7 @@ const {
|
|
|
53
53
|
class:list={[radioGroup({ orientation, class: className })]}
|
|
54
54
|
data-value={value || defaultValue}
|
|
55
55
|
disabled={disabled}
|
|
56
|
+
data-slot="radio-group"
|
|
56
57
|
{...rest}
|
|
57
58
|
>
|
|
58
59
|
{legend && <legend class="sr-only">{legend}</legend>}
|
|
@@ -28,7 +28,7 @@ type Props = HTMLAttributes<"input"> &
|
|
|
28
28
|
checked?: boolean;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
const radioWrapper = tv({
|
|
31
|
+
export const radioWrapper = tv({
|
|
32
32
|
base: "relative isolate flex shrink-0",
|
|
33
33
|
variants: {
|
|
34
34
|
size: {
|
|
@@ -42,7 +42,7 @@ const radioWrapper = tv({
|
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
const radioItem = tv({
|
|
45
|
+
export const radioItem = tv({
|
|
46
46
|
base: [
|
|
47
47
|
"starwind-radio-item peer z-10 h-full w-full",
|
|
48
48
|
"absolute inset-0 cursor-pointer opacity-0 outline-none focus:outline-none focus-visible:outline-none",
|
|
@@ -50,30 +50,31 @@ const radioItem = tv({
|
|
|
50
50
|
],
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
const radioControl = tv({
|
|
53
|
+
export const radioControl = tv({
|
|
54
54
|
base: [
|
|
55
55
|
"starwind-radio-control",
|
|
56
|
-
"border-input bg-background",
|
|
56
|
+
"border-input bg-background dark:bg-input/30",
|
|
57
57
|
"peer-focus-visible:outline-2 peer-focus-visible:outline-offset-1 peer-focus-visible:transition-none",
|
|
58
|
+
"outline-none peer-focus-visible:ring-3",
|
|
58
59
|
"absolute inset-0 rounded-full border shadow-xs",
|
|
59
|
-
"
|
|
60
|
+
"transition-all peer-checked:[&>svg]:opacity-100",
|
|
60
61
|
"peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
61
62
|
"flex items-center justify-center",
|
|
62
63
|
],
|
|
63
64
|
variants: {
|
|
64
65
|
variant: {
|
|
65
66
|
default:
|
|
66
|
-
"peer-checked:border-foreground [&>svg]:fill-foreground peer-focus-visible:
|
|
67
|
+
"peer-checked:border-foreground [&>svg]:fill-foreground peer-focus-visible:ring-outline/50",
|
|
67
68
|
primary:
|
|
68
|
-
"peer-checked:border-primary [&>svg]:fill-primary peer-focus-visible:
|
|
69
|
+
"peer-checked:border-primary [&>svg]:fill-primary peer-focus-visible:ring-primary/50",
|
|
69
70
|
secondary:
|
|
70
|
-
"peer-checked:border-secondary [&>svg]:fill-secondary peer-focus-visible:
|
|
71
|
-
info: "peer-checked:border-info [&>svg]:fill-info peer-focus-visible:
|
|
71
|
+
"peer-checked:border-secondary [&>svg]:fill-secondary peer-focus-visible:ring-secondary/50",
|
|
72
|
+
info: "peer-checked:border-info [&>svg]:fill-info peer-focus-visible:ring-info/50",
|
|
72
73
|
success:
|
|
73
|
-
"peer-checked:border-success [&>svg]:fill-success peer-focus-visible:
|
|
74
|
+
"peer-checked:border-success [&>svg]:fill-success peer-focus-visible:ring-success/50",
|
|
74
75
|
warning:
|
|
75
|
-
"peer-checked:border-warning [&>svg]:fill-warning peer-focus-visible:
|
|
76
|
-
error: "peer-checked:border-error [&>svg]:fill-error peer-focus-visible:
|
|
76
|
+
"peer-checked:border-warning [&>svg]:fill-warning peer-focus-visible:ring-warning/50",
|
|
77
|
+
error: "peer-checked:border-error [&>svg]:fill-error peer-focus-visible:ring-error/50",
|
|
77
78
|
},
|
|
78
79
|
},
|
|
79
80
|
defaultVariants: {
|
|
@@ -81,7 +82,7 @@ const radioControl = tv({
|
|
|
81
82
|
},
|
|
82
83
|
});
|
|
83
84
|
|
|
84
|
-
const radioIndicator = tv({
|
|
85
|
+
export const radioIndicator = tv({
|
|
85
86
|
base: ["starwind-radio-indicator", "opacity-0 transition-opacity"],
|
|
86
87
|
variants: {
|
|
87
88
|
size: {
|
|
@@ -108,7 +109,7 @@ const {
|
|
|
108
109
|
} = Astro.props;
|
|
109
110
|
---
|
|
110
111
|
|
|
111
|
-
<div class={radioWrapper({ size })}>
|
|
112
|
+
<div class={radioWrapper({ size })} data-slot="radio-group-item-wrapper">
|
|
112
113
|
<input
|
|
113
114
|
type="radio"
|
|
114
115
|
class={radioItem()}
|
|
@@ -117,9 +118,10 @@ const {
|
|
|
117
118
|
value={value}
|
|
118
119
|
checked={checked}
|
|
119
120
|
disabled={disabled}
|
|
121
|
+
data-slot="radio-group-item"
|
|
120
122
|
{...rest}
|
|
121
123
|
/>
|
|
122
|
-
<span class={radioControl({ variant, class: className })}>
|
|
124
|
+
<span class={radioControl({ variant, class: className })} data-slot="radio-group-item-control">
|
|
123
125
|
<CircleFilled class={radioIndicator({ size })} />
|
|
124
126
|
</span>
|
|
125
127
|
</div>
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import RadioGroup from "./RadioGroup.astro";
|
|
2
|
-
import RadioGroupItem
|
|
1
|
+
import RadioGroup, { radioGroup } from "./RadioGroup.astro";
|
|
2
|
+
import RadioGroupItem, {
|
|
3
|
+
radioControl,
|
|
4
|
+
radioIndicator,
|
|
5
|
+
radioItem,
|
|
6
|
+
radioWrapper,
|
|
7
|
+
} from "./RadioGroupItem.astro";
|
|
3
8
|
import type { RadioGroupChangeEvent } from "./RadioGroupTypes";
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
const RadioGroupVariants = {
|
|
11
|
+
radioGroup,
|
|
12
|
+
radioWrapper,
|
|
13
|
+
radioItem,
|
|
14
|
+
radioControl,
|
|
15
|
+
radioIndicator,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { RadioGroup, type RadioGroupChangeEvent, RadioGroupItem, RadioGroupVariants };
|
|
6
19
|
|
|
7
20
|
export default {
|
|
8
21
|
Root: RadioGroup,
|
|
@@ -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
|