@starwind-ui/core 0.1.1 → 1.1.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 +16 -16
- package/dist/index.js.map +1 -1
- package/dist/src/components/accordion/Accordion.astro +6 -6
- package/dist/src/components/accordion/AccordionContent.astro +11 -7
- package/dist/src/components/accordion/AccordionItem.astro +6 -10
- package/dist/src/components/accordion/AccordionTrigger.astro +12 -9
- package/dist/src/components/alert/Alert.astro +20 -28
- package/dist/src/components/alert/AlertDescription.astro +6 -1
- package/dist/src/components/alert/AlertTitle.astro +6 -7
- package/dist/src/components/avatar/Avatar.astro +26 -23
- package/dist/src/components/avatar/AvatarFallback.astro +7 -6
- package/dist/src/components/avatar/AvatarImage.astro +9 -12
- package/dist/src/components/badge/Badge.astro +85 -33
- package/dist/src/components/button/Button.astro +40 -50
- package/dist/src/components/card/Card.astro +6 -4
- package/dist/src/components/card/CardContent.astro +6 -1
- package/dist/src/components/card/CardDescription.astro +6 -1
- package/dist/src/components/card/CardFooter.astro +6 -1
- package/dist/src/components/card/CardHeader.astro +6 -1
- package/dist/src/components/card/CardTitle.astro +6 -1
- package/dist/src/components/checkbox/Checkbox.astro +100 -54
- package/dist/src/components/dialog/DialogContent.astro +30 -18
- package/dist/src/components/dialog/DialogDescription.astro +6 -1
- package/dist/src/components/dialog/DialogFooter.astro +6 -1
- package/dist/src/components/dialog/DialogHeader.astro +6 -1
- package/dist/src/components/dialog/DialogTitle.astro +6 -1
- package/dist/src/components/input/Input.astro +19 -13
- package/dist/src/components/label/Label.astro +19 -13
- package/dist/src/components/pagination/Pagination.astro +6 -1
- package/dist/src/components/pagination/PaginationContent.astro +6 -1
- package/dist/src/components/pagination/PaginationEllipsis.astro +6 -1
- package/dist/src/components/pagination/PaginationItem.astro +6 -1
- package/dist/src/components/pagination/PaginationLink.astro +28 -32
- package/dist/src/components/pagination/PaginationNext.astro +7 -4
- package/dist/src/components/pagination/PaginationPrevious.astro +7 -4
- package/dist/src/components/select/Select.astro +1 -1
- package/dist/src/components/select/SelectContent.astro +26 -11
- package/dist/src/components/select/SelectItem.astro +16 -9
- package/dist/src/components/select/SelectLabel.astro +6 -1
- package/dist/src/components/select/SelectSeparator.astro +6 -1
- package/dist/src/components/select/SelectTrigger.astro +11 -8
- package/dist/src/components/select/SelectValue.astro +7 -2
- package/dist/src/components/switch/Switch.astro +57 -37
- package/dist/src/components/tabs/Tabs.astro +6 -1
- package/dist/src/components/tabs/TabsContent.astro +6 -1
- package/dist/src/components/tabs/TabsList.astro +6 -4
- package/dist/src/components/tabs/TabsTrigger.astro +11 -7
- package/dist/src/components/textarea/Textarea.astro +19 -12
- package/dist/src/components/tooltip/Tooltip.astro +6 -1
- package/dist/src/components/tooltip/TooltipContent.astro +75 -22
- package/package.json +1 -1
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
type Props = HTMLAttributes<"nav"> & {
|
|
5
6
|
children: any;
|
|
6
7
|
};
|
|
7
8
|
|
|
9
|
+
const pagination = tv({
|
|
10
|
+
base: "mx-auto flex w-full justify-center",
|
|
11
|
+
});
|
|
12
|
+
|
|
8
13
|
const { class: className, ...rest } = Astro.props;
|
|
9
14
|
---
|
|
10
15
|
|
|
11
16
|
<nav
|
|
12
17
|
role="navigation"
|
|
13
18
|
aria-label="pagination"
|
|
14
|
-
class
|
|
19
|
+
class={pagination({ class: className })}
|
|
15
20
|
{...rest}
|
|
16
21
|
>
|
|
17
22
|
<slot />
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
type Props = HTMLAttributes<"ul"> & {
|
|
5
6
|
children: any;
|
|
6
7
|
};
|
|
7
8
|
|
|
9
|
+
const paginationContent = tv({
|
|
10
|
+
base: "flex flex-row items-center gap-1",
|
|
11
|
+
});
|
|
12
|
+
|
|
8
13
|
const { class: className, ...rest } = Astro.props;
|
|
9
14
|
---
|
|
10
15
|
|
|
11
|
-
<ul class
|
|
16
|
+
<ul class={paginationContent({ class: className })} {...rest}>
|
|
12
17
|
<slot />
|
|
13
18
|
</ul>
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
3
|
import Dots from "@tabler/icons/outline/dots.svg";
|
|
4
|
+
import { tv } from "tailwind-variants";
|
|
4
5
|
|
|
5
6
|
type Props = HTMLAttributes<"span"> & {
|
|
6
7
|
children?: any;
|
|
7
8
|
};
|
|
8
9
|
|
|
10
|
+
const paginationEllipsis = tv({
|
|
11
|
+
base: "flex h-9 w-9 items-center justify-center",
|
|
12
|
+
});
|
|
13
|
+
|
|
9
14
|
const { class: className, ...rest } = Astro.props;
|
|
10
15
|
---
|
|
11
16
|
|
|
12
|
-
<span aria-hidden class
|
|
17
|
+
<span aria-hidden class={paginationEllipsis({ class: className })} {...rest}>
|
|
13
18
|
<Dots class="size-4" />
|
|
14
19
|
<span class="sr-only">More pages</span>
|
|
15
20
|
</span>
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
type Props = HTMLAttributes<"li"> & {
|
|
5
6
|
children: any;
|
|
6
7
|
};
|
|
7
8
|
|
|
9
|
+
const paginationItem = tv({
|
|
10
|
+
base: "",
|
|
11
|
+
});
|
|
12
|
+
|
|
8
13
|
const { class: className, ...rest } = Astro.props;
|
|
9
14
|
---
|
|
10
15
|
|
|
11
|
-
<li class
|
|
16
|
+
<li class={paginationItem({ class: className })} {...rest}>
|
|
12
17
|
<slot />
|
|
13
18
|
</li>
|
|
@@ -1,49 +1,45 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
interface Props extends HTMLAttributes<"a"> {
|
|
5
6
|
isActive?: boolean;
|
|
6
7
|
size?: "sm" | "md" | "lg" | "icon";
|
|
7
|
-
radius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<a
|
|
14
|
-
aria-current={isActive ? "page" : undefined}
|
|
15
|
-
class:list={[
|
|
16
|
-
// default starwind button styles
|
|
17
|
-
"inline-flex items-center justify-center gap-1.5 font-medium whitespace-nowrap",
|
|
10
|
+
const paginationLink = tv({
|
|
11
|
+
base: [
|
|
12
|
+
"inline-flex items-center justify-center gap-1.5 rounded-md font-medium whitespace-nowrap",
|
|
18
13
|
"[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
19
14
|
"starwind-transition-colors",
|
|
20
15
|
"focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
21
16
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
!isActive,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"h-9 px-3 py-2 text-sm": size === "sm",
|
|
32
|
-
"h-11 px-4 py-2 text-base": size === "md",
|
|
33
|
-
"h-12 px-8 py-2 text-lg": size === "lg",
|
|
34
|
-
"h-11 w-11": size === "icon",
|
|
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",
|
|
35
23
|
},
|
|
36
|
-
{
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"rounded-lg": radius === "lg",
|
|
42
|
-
"rounded-xl": radius === "xl",
|
|
43
|
-
"rounded-full": radius === "full",
|
|
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",
|
|
44
29
|
},
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
isActive: false,
|
|
33
|
+
size: "icon",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const { class: className, isActive, size = "icon", ...rest } = Astro.props;
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
<a
|
|
41
|
+
aria-current={isActive ? "page" : undefined}
|
|
42
|
+
class={paginationLink({ isActive, size, class: className })}
|
|
47
43
|
{...rest}
|
|
48
44
|
>
|
|
49
45
|
<slot />
|
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
3
|
import ChevronRight from "@tabler/icons/outline/chevron-right.svg";
|
|
4
4
|
import PaginationLink from "./PaginationLink.astro";
|
|
5
|
+
import { tv } from "tailwind-variants";
|
|
5
6
|
|
|
6
7
|
type Props = HTMLAttributes<"a"> & {
|
|
7
8
|
size?: "sm" | "md" | "lg" | "icon";
|
|
8
|
-
radius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const paginationNext = tv({
|
|
12
|
+
base: "group gap-1",
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const { class: className, size = "md", ...rest } = Astro.props;
|
|
12
16
|
---
|
|
13
17
|
|
|
14
18
|
<PaginationLink
|
|
15
19
|
aria-label="Go to next page"
|
|
16
20
|
size={size}
|
|
17
|
-
|
|
18
|
-
class:list={["group gap-1", className]}
|
|
21
|
+
class={paginationNext({ class: className })}
|
|
19
22
|
{...rest}
|
|
20
23
|
>
|
|
21
24
|
<slot />
|
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
3
|
import ChevronLeft from "@tabler/icons/outline/chevron-left.svg";
|
|
4
4
|
import PaginationLink from "./PaginationLink.astro";
|
|
5
|
+
import { tv } from "tailwind-variants";
|
|
5
6
|
|
|
6
7
|
type Props = HTMLAttributes<"a"> & {
|
|
7
8
|
size?: "sm" | "md" | "lg" | "icon";
|
|
8
|
-
radius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const paginationPrevious = tv({
|
|
12
|
+
base: "group gap-1",
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const { class: className, size = "md", ...rest } = Astro.props;
|
|
12
16
|
---
|
|
13
17
|
|
|
14
18
|
<PaginationLink
|
|
15
19
|
aria-label="Go to previous page"
|
|
16
20
|
size={size}
|
|
17
|
-
|
|
18
|
-
class:list={["group gap-1", className]}
|
|
21
|
+
class={paginationPrevious({ class: className })}
|
|
19
22
|
{...rest}
|
|
20
23
|
>
|
|
21
24
|
<ChevronLeft class="size-4 transition-transform group-hover:-translate-x-1" />
|
|
@@ -225,7 +225,7 @@ const { class: className, ...rest } = Astro.props;
|
|
|
225
225
|
const currentIndex = Array.from(items).indexOf(activeElement as HTMLElement);
|
|
226
226
|
if (e.key === "Home") {
|
|
227
227
|
const firstEnabledItem = Array.from(items).find(
|
|
228
|
-
(item) => item.getAttribute("data-disabled") !== "true"
|
|
228
|
+
(item) => item.getAttribute("data-disabled") !== "true",
|
|
229
229
|
) as HTMLElement;
|
|
230
230
|
if (firstEnabledItem) {
|
|
231
231
|
firstEnabledItem.focus();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
type Props = HTMLAttributes<"div"> & {
|
|
5
6
|
/**
|
|
@@ -19,6 +20,29 @@ type Props = HTMLAttributes<"div"> & {
|
|
|
19
20
|
animationDuration?: number;
|
|
20
21
|
};
|
|
21
22
|
|
|
23
|
+
const selectContent = tv({
|
|
24
|
+
base: [
|
|
25
|
+
"starwind-select-content",
|
|
26
|
+
"bg-popover text-popover-foreground absolute z-50 min-w-[8rem] rounded-md border shadow-md",
|
|
27
|
+
"fade-in-0 zoom-in-95 animate-in overflow-hidden will-change-transform",
|
|
28
|
+
"data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out",
|
|
29
|
+
"left-0",
|
|
30
|
+
],
|
|
31
|
+
variants: {
|
|
32
|
+
side: {
|
|
33
|
+
bottom: "data-[side=bottom]:slide-in-from-top-4 data-[side=bottom]:top-(--select-content-offset)",
|
|
34
|
+
top: "data-[side=top]:slide-in-from-bottom-4 data-[side=top]:bottom-(--select-content-offset)",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
side: "bottom",
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const selectContentInner = tv({
|
|
43
|
+
base: "max-h-96 w-full min-w-(--select-trigger-width) overflow-y-auto p-1",
|
|
44
|
+
});
|
|
45
|
+
|
|
22
46
|
const {
|
|
23
47
|
class: className,
|
|
24
48
|
side = "bottom",
|
|
@@ -29,16 +53,7 @@ const {
|
|
|
29
53
|
---
|
|
30
54
|
|
|
31
55
|
<div
|
|
32
|
-
class
|
|
33
|
-
"starwind-select-content",
|
|
34
|
-
"bg-popover text-popover-foreground absolute z-50 min-w-[8rem] rounded-md border shadow-md",
|
|
35
|
-
"fade-in-0 zoom-in-95 animate-in overflow-hidden will-change-transform",
|
|
36
|
-
"data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out",
|
|
37
|
-
"data-[side=bottom]:slide-in-from-top-4 data-[side=bottom]:top-(--select-content-offset)",
|
|
38
|
-
"data-[side=top]:slide-in-from-bottom-4 data-[side=top]:bottom-(--select-content-offset)",
|
|
39
|
-
"left-0",
|
|
40
|
-
className,
|
|
41
|
-
]}
|
|
56
|
+
class={selectContent({ side, class: className })}
|
|
42
57
|
role="listbox"
|
|
43
58
|
data-side={side}
|
|
44
59
|
data-state="closed"
|
|
@@ -51,7 +66,7 @@ const {
|
|
|
51
66
|
}}
|
|
52
67
|
{...rest}
|
|
53
68
|
>
|
|
54
|
-
<div class
|
|
69
|
+
<div class={selectContentInner()}>
|
|
55
70
|
<slot />
|
|
56
71
|
</div>
|
|
57
72
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import Check from "@tabler/icons/outline/check.svg";
|
|
3
|
-
|
|
4
3
|
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
import { tv } from "tailwind-variants";
|
|
5
5
|
|
|
6
6
|
type Props = HTMLAttributes<"div"> & {
|
|
7
7
|
/**
|
|
@@ -14,17 +14,24 @@ type Props = HTMLAttributes<"div"> & {
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<div
|
|
21
|
-
class:list={[
|
|
17
|
+
const selectItem = tv({
|
|
18
|
+
base: [
|
|
22
19
|
"relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 outline-none select-none",
|
|
23
20
|
"focus:bg-accent focus:text-accent-foreground",
|
|
24
21
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
25
22
|
"not-aria-selected:[&_svg]:hidden aria-selected:[&_svg]:flex",
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const selectItemIcon = tv({
|
|
27
|
+
base: "absolute left-2 size-3.5 items-center justify-center",
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const { class: className, value, disabled, ...rest } = Astro.props;
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<div
|
|
34
|
+
class={selectItem({ class: className })}
|
|
28
35
|
data-value={value}
|
|
29
36
|
data-disabled={disabled}
|
|
30
37
|
aria-selected="false"
|
|
@@ -32,7 +39,7 @@ const { class: className, value, disabled, ...rest } = Astro.props;
|
|
|
32
39
|
tabindex="0"
|
|
33
40
|
{...rest}
|
|
34
41
|
>
|
|
35
|
-
<span class=
|
|
42
|
+
<span class={selectItemIcon()}>
|
|
36
43
|
<Check class="size-4" />
|
|
37
44
|
</span>
|
|
38
45
|
<span>
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
type Props = HTMLAttributes<"div">;
|
|
5
6
|
|
|
7
|
+
const selectLabel = tv({
|
|
8
|
+
base: "py-1.5 pr-2 pl-8 font-semibold",
|
|
9
|
+
});
|
|
10
|
+
|
|
6
11
|
const { class: className, ...rest } = Astro.props;
|
|
7
12
|
---
|
|
8
13
|
|
|
9
|
-
<div class
|
|
14
|
+
<div class={selectLabel({ class: className })} {...rest}>
|
|
10
15
|
<slot />
|
|
11
16
|
</div>
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
type Props = HTMLAttributes<"div">;
|
|
5
6
|
|
|
7
|
+
const selectSeparator = tv({
|
|
8
|
+
base: "bg-muted -mx-1 my-1 h-px",
|
|
9
|
+
});
|
|
10
|
+
|
|
6
11
|
const { class: className, ...rest } = Astro.props;
|
|
7
12
|
---
|
|
8
13
|
|
|
9
|
-
<div class
|
|
14
|
+
<div class={selectSeparator({ class: className })} {...rest}></div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
4
|
import ChevronDown from "@tabler/icons/outline/chevron-down.svg";
|
|
5
5
|
|
|
6
6
|
type Props = Omit<HTMLAttributes<"button">, "role" | "type"> & {
|
|
@@ -14,17 +14,20 @@ type Props = Omit<HTMLAttributes<"button">, "role" | "type"> & {
|
|
|
14
14
|
required?: boolean;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<button
|
|
21
|
-
class:list={[
|
|
17
|
+
const selectTrigger = tv({
|
|
18
|
+
base: [
|
|
22
19
|
"starwind-select-trigger",
|
|
23
20
|
"border-input bg-background text-foreground ring-offset-background flex h-11 items-center justify-between rounded-md border px-3 py-2",
|
|
24
21
|
"focus:outline-outline focus:outline-2 focus:outline-offset-2",
|
|
25
22
|
"disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const { class: className, required = false, ...rest } = Astro.props;
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<button
|
|
30
|
+
class={selectTrigger({ class: className })}
|
|
28
31
|
type="button"
|
|
29
32
|
role="combobox"
|
|
30
33
|
aria-label="Select field"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
type Props = HTMLAttributes<"span"> & {
|
|
5
6
|
/**
|
|
@@ -8,9 +9,13 @@ type Props = HTMLAttributes<"span"> & {
|
|
|
8
9
|
placeholder?: string;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
+
const selectValue = tv({
|
|
13
|
+
base: "pointer-events-none",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const { placeholder = "select", class: className, ...rest } = Astro.props;
|
|
12
17
|
---
|
|
13
18
|
|
|
14
|
-
<span class=
|
|
19
|
+
<span class={selectValue({ class: className })} {...rest}>
|
|
15
20
|
{placeholder}
|
|
16
21
|
</span>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
type Props = Omit<HTMLAttributes<"button">, "role" | "type" | "aria-checked"> & {
|
|
5
6
|
/**
|
|
@@ -48,12 +49,6 @@ if (!padding) {
|
|
|
48
49
|
|
|
49
50
|
const sizeMultiplier = size === "sm" ? 4 : size === "lg" ? 6 : 5;
|
|
50
51
|
|
|
51
|
-
const toggleSizeClass = {
|
|
52
|
-
sm: "size-4",
|
|
53
|
-
md: "size-5",
|
|
54
|
-
lg: "size-6",
|
|
55
|
-
};
|
|
56
|
-
|
|
57
52
|
let ariaLabel;
|
|
58
53
|
if (rest["aria-label"]) {
|
|
59
54
|
ariaLabel = rest["aria-label"];
|
|
@@ -63,6 +58,59 @@ if (rest["aria-label"]) {
|
|
|
63
58
|
} else {
|
|
64
59
|
ariaLabel = "switch";
|
|
65
60
|
}
|
|
61
|
+
|
|
62
|
+
const switchButton = tv({
|
|
63
|
+
base: [
|
|
64
|
+
"starwind-transition-colors border-input bg-muted inline-flex h-(--height) w-(--width) items-center rounded-full border",
|
|
65
|
+
"group peer ring-offset-background focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
66
|
+
"not-disabled:cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
|
|
67
|
+
],
|
|
68
|
+
variants: {
|
|
69
|
+
variant: {
|
|
70
|
+
primary: "aria-checked:border-primary focus:outline-primary",
|
|
71
|
+
secondary: "aria-checked:border-secondary focus:outline-secondary",
|
|
72
|
+
default: "aria-checked:border-foreground focus:outline-outline",
|
|
73
|
+
info: "aria-checked:border-info focus:outline-info",
|
|
74
|
+
success: "aria-checked:border-success focus:outline-success",
|
|
75
|
+
warning: "aria-checked:border-warning focus:outline-warning",
|
|
76
|
+
error: "aria-checked:border-error focus:outline-error",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: {
|
|
80
|
+
variant: "default",
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const switchToggle = tv({
|
|
85
|
+
base: [
|
|
86
|
+
"bg-foreground inline-block transform rounded-full transition-transform",
|
|
87
|
+
"group-aria-checked:translate-x-(--translation) group-aria-[checked=false]:translate-x-[calc(var(--padding)-var(--border-offset))]",
|
|
88
|
+
],
|
|
89
|
+
variants: {
|
|
90
|
+
size: {
|
|
91
|
+
sm: "size-4",
|
|
92
|
+
md: "size-5",
|
|
93
|
+
lg: "size-6",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
defaultVariants: {
|
|
97
|
+
size: "md",
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const switchLabel = tv({
|
|
102
|
+
base: "text-foreground ml-2 font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
103
|
+
variants: {
|
|
104
|
+
size: {
|
|
105
|
+
sm: "text-sm",
|
|
106
|
+
md: "text-base",
|
|
107
|
+
lg: "text-lg",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
defaultVariants: {
|
|
111
|
+
size: "md",
|
|
112
|
+
},
|
|
113
|
+
});
|
|
66
114
|
---
|
|
67
115
|
|
|
68
116
|
<div class="starwind-switch flex items-center">
|
|
@@ -72,21 +120,7 @@ if (rest["aria-label"]) {
|
|
|
72
120
|
role="switch"
|
|
73
121
|
aria-checked={checked ? "true" : "false"}
|
|
74
122
|
aria-label={ariaLabel}
|
|
75
|
-
class
|
|
76
|
-
"starwind-transition-colors border-input bg-muted inline-flex h-(--height) w-(--width) items-center rounded-full border",
|
|
77
|
-
"group peer ring-offset-background focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
78
|
-
"not-disabled:cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
|
|
79
|
-
{
|
|
80
|
-
"aria-checked:border-primary focus:outline-primary": variant === "primary",
|
|
81
|
-
"aria-checked:border-secondary focus:outline-secondary": variant === "secondary",
|
|
82
|
-
"aria-checked:border-foreground focus:outline-outline": variant === "default",
|
|
83
|
-
"aria-checked:border-info focus:outline-info": variant === "info",
|
|
84
|
-
"aria-checked:border-success focus:outline-success": variant === "success",
|
|
85
|
-
"aria-checked:border-warning focus:outline-warning": variant === "warning",
|
|
86
|
-
"aria-checked:border-error focus:outline-error": variant === "error",
|
|
87
|
-
},
|
|
88
|
-
className,
|
|
89
|
-
]}
|
|
123
|
+
class={switchButton({ variant, class: className })}
|
|
90
124
|
style={{
|
|
91
125
|
"--padding": `${newPadding}px`,
|
|
92
126
|
"--height": `calc((var(--spacing) * ${sizeMultiplier}) + (var(--padding) * 2))`,
|
|
@@ -96,28 +130,14 @@ if (rest["aria-label"]) {
|
|
|
96
130
|
{...rest}
|
|
97
131
|
>
|
|
98
132
|
<span
|
|
99
|
-
class
|
|
100
|
-
"bg-foreground inline-block transform rounded-full transition-transform",
|
|
101
|
-
"group-aria-checked:translate-x-(--translation) group-aria-[checked=false]:translate-x-[calc(var(--padding)-var(--border-offset))]",
|
|
102
|
-
toggleSizeClass[size],
|
|
103
|
-
]}
|
|
133
|
+
class={switchToggle({ size })}
|
|
104
134
|
style={{
|
|
105
135
|
"--translation": `calc((var(--spacing) * ${sizeMultiplier}) + (var(--padding) * 2) - var(--border-offset))`,
|
|
106
136
|
}}></span>
|
|
107
137
|
</button>
|
|
108
138
|
{
|
|
109
139
|
label && (
|
|
110
|
-
<label
|
|
111
|
-
for={id}
|
|
112
|
-
class:list={[
|
|
113
|
-
"text-foreground ml-2 font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
114
|
-
{
|
|
115
|
-
"text-sm": size === "sm",
|
|
116
|
-
"text-base": size === "md",
|
|
117
|
-
"text-lg": size === "lg",
|
|
118
|
-
},
|
|
119
|
-
]}
|
|
120
|
-
>
|
|
140
|
+
<label for={id} class={switchLabel({ size })}>
|
|
121
141
|
{label}
|
|
122
142
|
</label>
|
|
123
143
|
)
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
interface Props extends HTMLAttributes<"div"> {
|
|
5
6
|
defaultValue?: string;
|
|
6
7
|
syncKey?: string;
|
|
7
8
|
}
|
|
8
9
|
|
|
10
|
+
const tabs = tv({
|
|
11
|
+
base: "starwind-tabs",
|
|
12
|
+
});
|
|
13
|
+
|
|
9
14
|
const { defaultValue, syncKey, class: className, ...rest } = Astro.props;
|
|
10
15
|
---
|
|
11
16
|
|
|
12
17
|
<div
|
|
13
|
-
class
|
|
18
|
+
class={tabs({ class: className })}
|
|
14
19
|
data-default-value={defaultValue}
|
|
15
20
|
data-sync-key={syncKey}
|
|
16
21
|
{...rest}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
interface Props extends Omit<HTMLAttributes<"div">, "id" | "role" | "tabindex" | "hidden"> {
|
|
5
6
|
value: string;
|
|
6
7
|
}
|
|
7
8
|
|
|
9
|
+
const tabsContent = tv({
|
|
10
|
+
base: "mt-2 focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
11
|
+
});
|
|
12
|
+
|
|
8
13
|
const { value, class: className, ...rest } = Astro.props;
|
|
9
14
|
---
|
|
10
15
|
|
|
11
16
|
<div
|
|
12
|
-
class
|
|
17
|
+
class={tabsContent({ class: className })}
|
|
13
18
|
data-tabs-content
|
|
14
19
|
data-value={value}
|
|
15
20
|
data-state="inactive"
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
3
4
|
|
|
4
5
|
type Props = Omit<HTMLAttributes<"div">, "role">;
|
|
5
6
|
|
|
7
|
+
const tabsList = tv({
|
|
8
|
+
base: "bg-muted text-muted-foreground inline-flex w-full items-center justify-center rounded-md p-1",
|
|
9
|
+
});
|
|
10
|
+
|
|
6
11
|
const { class: className, ...rest } = Astro.props;
|
|
7
12
|
---
|
|
8
13
|
|
|
9
14
|
<div
|
|
10
|
-
class
|
|
11
|
-
"bg-muted text-muted-foreground inline-flex w-full items-center justify-center rounded-md p-1",
|
|
12
|
-
className,
|
|
13
|
-
]}
|
|
15
|
+
class={tabsList({ class: className })}
|
|
14
16
|
data-tabs-list
|
|
15
17
|
role="tablist"
|
|
16
18
|
{...rest}
|