@starwind-ui/core 1.6.2 → 1.7.1
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 +8 -4
- package/dist/index.js.map +1 -1
- package/dist/src/components/accordion/Accordion.astro +224 -224
- package/dist/src/components/accordion/AccordionContent.astro +13 -13
- package/dist/src/components/accordion/AccordionItem.astro +6 -6
- package/dist/src/components/accordion/AccordionTrigger.astro +13 -13
- package/dist/src/components/accordion/index.ts +4 -4
- package/dist/src/components/alert/Alert.astro +15 -15
- package/dist/src/components/alert/AlertDescription.astro +1 -1
- package/dist/src/components/alert/AlertTitle.astro +2 -2
- package/dist/src/components/alert/index.ts +3 -3
- package/dist/src/components/avatar/Avatar.astro +16 -16
- package/dist/src/components/avatar/AvatarFallback.astro +3 -3
- package/dist/src/components/avatar/AvatarImage.astro +12 -12
- package/dist/src/components/avatar/index.ts +4 -4
- package/dist/src/components/badge/Badge.astro +33 -33
- package/dist/src/components/breadcrumb/Breadcrumb.astro +1 -1
- package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +6 -6
- package/dist/src/components/breadcrumb/BreadcrumbItem.astro +1 -1
- package/dist/src/components/breadcrumb/BreadcrumbLink.astro +8 -8
- package/dist/src/components/breadcrumb/BreadcrumbList.astro +2 -2
- package/dist/src/components/breadcrumb/BreadcrumbPage.astro +6 -6
- package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +7 -7
- package/dist/src/components/breadcrumb/index.ts +14 -14
- package/dist/src/components/button/Button.astro +38 -38
- package/dist/src/components/card/Card.astro +1 -1
- package/dist/src/components/card/CardContent.astro +1 -1
- package/dist/src/components/card/CardDescription.astro +1 -1
- package/dist/src/components/card/CardFooter.astro +1 -1
- package/dist/src/components/card/CardHeader.astro +1 -1
- package/dist/src/components/card/CardTitle.astro +1 -1
- package/dist/src/components/card/index.ts +7 -7
- package/dist/src/components/checkbox/Checkbox.astro +89 -89
- package/dist/src/components/dialog/Dialog.astro +237 -178
- package/dist/src/components/dialog/DialogClose.astro +14 -14
- package/dist/src/components/dialog/DialogContent.astro +32 -32
- package/dist/src/components/dialog/DialogDescription.astro +1 -1
- package/dist/src/components/dialog/DialogFooter.astro +1 -1
- package/dist/src/components/dialog/DialogHeader.astro +1 -1
- package/dist/src/components/dialog/DialogTitle.astro +6 -6
- package/dist/src/components/dialog/DialogTrigger.astro +26 -20
- package/dist/src/components/dialog/index.ts +16 -16
- package/dist/src/components/dropdown/Dropdown.astro +359 -359
- package/dist/src/components/dropdown/DropdownContent.astro +63 -63
- package/dist/src/components/dropdown/DropdownItem.astro +31 -31
- package/dist/src/components/dropdown/DropdownLabel.astro +14 -14
- package/dist/src/components/dropdown/DropdownSeparator.astro +5 -5
- package/dist/src/components/dropdown/DropdownTrigger.astro +26 -26
- package/dist/src/components/dropdown/index.ts +12 -12
- package/dist/src/components/dropzone/Dropzone.astro +232 -0
- package/dist/src/components/dropzone/DropzoneFilesList.astro +25 -0
- package/dist/src/components/dropzone/DropzoneLoadingIndicator.astro +10 -0
- package/dist/src/components/dropzone/DropzoneUploadIndicator.astro +10 -0
- package/dist/src/components/dropzone/index.ts +13 -0
- package/dist/src/components/input/Input.astro +12 -12
- package/dist/src/components/label/Label.astro +8 -8
- package/dist/src/components/pagination/Pagination.astro +1 -1
- package/dist/src/components/pagination/PaginationContent.astro +3 -3
- package/dist/src/components/pagination/PaginationEllipsis.astro +2 -2
- package/dist/src/components/pagination/PaginationItem.astro +3 -3
- package/dist/src/components/pagination/PaginationLink.astro +27 -27
- package/dist/src/components/pagination/PaginationNext.astro +7 -6
- package/dist/src/components/pagination/PaginationPrevious.astro +7 -6
- package/dist/src/components/pagination/index.ts +14 -14
- package/dist/src/components/progress/Progress.astro +151 -0
- package/dist/src/components/progress/index.ts +5 -0
- package/dist/src/components/radio-group/RadioGroup.astro +156 -0
- package/dist/src/components/radio-group/RadioGroupItem.astro +125 -0
- package/dist/src/components/radio-group/RadioGroupTypes.ts +6 -0
- package/dist/src/components/radio-group/index.ts +10 -0
- package/dist/src/components/select/Select.astro +515 -475
- package/dist/src/components/select/SelectContent.astro +62 -62
- package/dist/src/components/select/SelectItem.astro +27 -27
- package/dist/src/components/select/SelectLabel.astro +1 -1
- package/dist/src/components/select/SelectTrigger.astro +28 -28
- package/dist/src/components/select/SelectTypes.ts +11 -5
- package/dist/src/components/select/SelectValue.astro +5 -5
- package/dist/src/components/select/index.ts +16 -16
- package/dist/src/components/skeleton/Skeleton.astro +14 -0
- package/dist/src/components/skeleton/index.ts +5 -0
- package/dist/src/components/switch/Switch.astro +150 -150
- package/dist/src/components/switch/SwitchTypes.ts +4 -4
- package/dist/src/components/table/Table.astro +5 -5
- package/dist/src/components/table/TableBody.astro +3 -3
- package/dist/src/components/table/TableCaption.astro +3 -3
- package/dist/src/components/table/TableCell.astro +3 -3
- package/dist/src/components/table/TableFoot.astro +3 -3
- package/dist/src/components/table/TableHead.astro +3 -3
- package/dist/src/components/table/TableHeader.astro +3 -3
- package/dist/src/components/table/TableRow.astro +3 -3
- package/dist/src/components/table/index.ts +8 -8
- package/dist/src/components/tabs/Tabs.astro +250 -250
- package/dist/src/components/tabs/TabsContent.astro +10 -10
- package/dist/src/components/tabs/TabsList.astro +2 -2
- package/dist/src/components/tabs/TabsTrigger.astro +15 -15
- package/dist/src/components/tabs/index.ts +4 -4
- package/dist/src/components/textarea/Textarea.astro +16 -16
- package/dist/src/components/tooltip/Tooltip.astro +217 -217
- package/dist/src/components/tooltip/TooltipContent.astro +81 -81
- package/dist/src/components/tooltip/index.ts +3 -3
- package/package.json +6 -6
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
3
|
|
|
4
4
|
type Props = HTMLAttributes<"button"> & {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* When true, the component will render its child element instead of a button
|
|
7
|
+
*/
|
|
8
|
+
asChild?: boolean;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const { class: className, asChild = false, ...rest } = Astro.props;
|
|
@@ -13,18 +13,18 @@ const { class: className, asChild = false, ...rest } = Astro.props;
|
|
|
13
13
|
// Get the first child element if asChild is true
|
|
14
14
|
let hasChildren = false;
|
|
15
15
|
if (Astro.slots.has("default")) {
|
|
16
|
-
|
|
16
|
+
hasChildren = true;
|
|
17
17
|
}
|
|
18
18
|
---
|
|
19
19
|
|
|
20
20
|
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
asChild && hasChildren ? (
|
|
22
|
+
<div class="starwind-dialog-close" data-as-child>
|
|
23
|
+
<slot />
|
|
24
|
+
</div>
|
|
25
|
+
) : (
|
|
26
|
+
<button type="button" class:list={["starwind-dialog-close", className]} {...rest}>
|
|
27
|
+
<slot>Demo close button</slot>
|
|
28
|
+
</button>
|
|
29
|
+
)
|
|
30
30
|
}
|
|
@@ -4,36 +4,36 @@ import type { HTMLAttributes } from "astro/types";
|
|
|
4
4
|
import { tv } from "tailwind-variants";
|
|
5
5
|
|
|
6
6
|
type Props = HTMLAttributes<"dialog"> & {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Open and close animation duration in milliseconds
|
|
9
|
+
*/
|
|
10
|
+
animationDuration?: number;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const dialogBackdrop = tv({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
base: [
|
|
15
|
+
"starwind-dialog-backdrop fixed inset-0 top-0 left-0 z-50 hidden h-screen w-screen bg-black/80",
|
|
16
|
+
"data-[state=open]:animate-in fade-in",
|
|
17
|
+
"data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards fade-out",
|
|
18
|
+
],
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
const dialogContent = tv({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
base: [
|
|
23
|
+
"fixed top-16 left-[50%] z-50 translate-x-[-50%] sm:top-[50%] sm:translate-y-[-50%]",
|
|
24
|
+
"bg-background w-full max-w-md border p-8 shadow-lg sm:rounded-lg",
|
|
25
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fill-mode-forwards",
|
|
26
|
+
"fade-in zoom-in-95 slide-in-from-bottom-2",
|
|
27
|
+
"fade-out zoom-out-95 slide-out-to-bottom-2",
|
|
28
|
+
],
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
const dialogCloseButton = tv({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
base: [
|
|
33
|
+
"starwind-dialog-close text-muted-foreground",
|
|
34
|
+
"absolute top-5.5 right-5.5 rounded-sm opacity-70 transition-opacity hover:opacity-100 disabled:pointer-events-none",
|
|
35
|
+
"focus-visible:outline-outline focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
36
|
+
],
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
const { class: className, animationDuration = 200, ...rest } = Astro.props;
|
|
@@ -41,20 +41,20 @@ const { class: className, animationDuration = 200, ...rest } = Astro.props;
|
|
|
41
41
|
|
|
42
42
|
<!-- dialog overlay -->
|
|
43
43
|
<div
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
class={dialogBackdrop()}
|
|
45
|
+
data-state="closed"
|
|
46
|
+
style={{ animationDuration: `${animationDuration}ms` }}
|
|
47
47
|
>
|
|
48
48
|
</div>
|
|
49
49
|
|
|
50
50
|
<dialog
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
class={dialogContent({ class: className })}
|
|
52
|
+
data-state="closed"
|
|
53
|
+
{...rest}
|
|
54
|
+
style={{ animationDuration: `${animationDuration}ms` }}
|
|
55
55
|
>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
<slot />
|
|
57
|
+
<button type="button" class={dialogCloseButton()} data-dialog-close aria-label="Close dialog">
|
|
58
|
+
<X class="size-5" />
|
|
59
|
+
</button>
|
|
60
60
|
</dialog>
|
|
@@ -3,11 +3,11 @@ import type { HTMLAttributes } from "astro/types";
|
|
|
3
3
|
import { tv } from "tailwind-variants";
|
|
4
4
|
|
|
5
5
|
type Props = Omit<HTMLAttributes<"h2">, "id"> & {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The content to be rendered inside the dialog title
|
|
8
|
+
*/
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
children: any;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const dialogTitle = tv({ base: "text-2xl leading-none font-semibold tracking-tight" });
|
|
@@ -16,5 +16,5 @@ const { class: className, ...rest } = Astro.props;
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
<h2 class={dialogTitle({ class: className })} {...rest}>
|
|
19
|
-
|
|
19
|
+
<slot />
|
|
20
20
|
</h2>
|
|
@@ -2,34 +2,40 @@
|
|
|
2
2
|
import type { HTMLAttributes } from "astro/types";
|
|
3
3
|
|
|
4
4
|
type Props = HTMLAttributes<"button"> & {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* When true, the component will render its child element with a simple wrapper instead of a button component
|
|
7
|
+
*/
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Optional ID of the dialog to trigger. If not provided and the trigger is inside a Dialog component,
|
|
11
|
+
* it will automatically target that dialog. Required when used outside a Dialog component.
|
|
12
|
+
*/
|
|
13
|
+
for?: string;
|
|
9
14
|
};
|
|
10
15
|
|
|
11
|
-
const { class: className, asChild = false, ...rest } = Astro.props;
|
|
16
|
+
const { class: className, asChild = false, for: dialogFor, ...rest } = Astro.props;
|
|
12
17
|
|
|
13
18
|
// Get the first child element if asChild is true
|
|
14
19
|
let hasChildren = false;
|
|
15
20
|
if (Astro.slots.has("default")) {
|
|
16
|
-
|
|
21
|
+
hasChildren = true;
|
|
17
22
|
}
|
|
18
23
|
---
|
|
19
24
|
|
|
20
25
|
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
asChild && hasChildren ? (
|
|
27
|
+
<div class="starwind-dialog-trigger" data-as-child data-dialog-for={dialogFor}>
|
|
28
|
+
<slot />
|
|
29
|
+
</div>
|
|
30
|
+
) : (
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
aria-haspopup="dialog"
|
|
34
|
+
class:list={["starwind-dialog-trigger", className]}
|
|
35
|
+
data-dialog-for={dialogFor}
|
|
36
|
+
{...rest}
|
|
37
|
+
>
|
|
38
|
+
<slot />
|
|
39
|
+
</button>
|
|
40
|
+
)
|
|
35
41
|
}
|
|
@@ -8,23 +8,23 @@ import DialogTitle from "./DialogTitle.astro";
|
|
|
8
8
|
import DialogTrigger from "./DialogTrigger.astro";
|
|
9
9
|
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
Dialog,
|
|
12
|
+
DialogClose,
|
|
13
|
+
DialogContent,
|
|
14
|
+
DialogDescription,
|
|
15
|
+
DialogFooter,
|
|
16
|
+
DialogHeader,
|
|
17
|
+
DialogTitle,
|
|
18
|
+
DialogTrigger,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export default {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
Root: Dialog,
|
|
23
|
+
Trigger: DialogTrigger,
|
|
24
|
+
Content: DialogContent,
|
|
25
|
+
Header: DialogHeader,
|
|
26
|
+
Footer: DialogFooter,
|
|
27
|
+
Title: DialogTitle,
|
|
28
|
+
Description: DialogDescription,
|
|
29
|
+
Close: DialogClose,
|
|
30
30
|
};
|