@starwind-ui/core 1.11.2 → 1.12.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/package.json +1 -1
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -74
- package/dist/index.js.map +0 -1
- package/dist/src/components/accordion/Accordion.astro +0 -247
- package/dist/src/components/accordion/AccordionContent.astro +0 -33
- package/dist/src/components/accordion/AccordionItem.astro +0 -27
- package/dist/src/components/accordion/AccordionTrigger.astro +0 -32
- package/dist/src/components/accordion/index.ts +0 -15
- package/dist/src/components/alert/Alert.astro +0 -31
- package/dist/src/components/alert/AlertDescription.astro +0 -14
- package/dist/src/components/alert/AlertTitle.astro +0 -16
- package/dist/src/components/alert/index.ts +0 -13
- package/dist/src/components/alert-dialog/AlertDialog.astro +0 -273
- package/dist/src/components/alert-dialog/AlertDialogAction.astro +0 -44
- package/dist/src/components/alert-dialog/AlertDialogCancel.astro +0 -45
- package/dist/src/components/alert-dialog/AlertDialogContent.astro +0 -52
- package/dist/src/components/alert-dialog/AlertDialogDescription.astro +0 -18
- package/dist/src/components/alert-dialog/AlertDialogFooter.astro +0 -16
- package/dist/src/components/alert-dialog/AlertDialogHeader.astro +0 -14
- package/dist/src/components/alert-dialog/AlertDialogTitle.astro +0 -20
- package/dist/src/components/alert-dialog/AlertDialogTrigger.astro +0 -47
- package/dist/src/components/alert-dialog/index.ts +0 -46
- package/dist/src/components/aspect-ratio/AspectRatio.astro +0 -32
- package/dist/src/components/aspect-ratio/index.ts +0 -7
- package/dist/src/components/avatar/Avatar.astro +0 -29
- package/dist/src/components/avatar/AvatarFallback.astro +0 -18
- package/dist/src/components/avatar/AvatarImage.astro +0 -49
- package/dist/src/components/avatar/index.ts +0 -13
- package/dist/src/components/badge/Badge.astro +0 -51
- package/dist/src/components/badge/index.ts +0 -7
- package/dist/src/components/breadcrumb/Breadcrumb.astro +0 -11
- package/dist/src/components/breadcrumb/BreadcrumbEllipsis.astro +0 -28
- package/dist/src/components/breadcrumb/BreadcrumbItem.astro +0 -14
- package/dist/src/components/breadcrumb/BreadcrumbLink.astro +0 -22
- package/dist/src/components/breadcrumb/BreadcrumbList.astro +0 -16
- package/dist/src/components/breadcrumb/BreadcrumbPage.astro +0 -21
- package/dist/src/components/breadcrumb/BreadcrumbSeparator.astro +0 -23
- package/dist/src/components/breadcrumb/index.ts +0 -37
- package/dist/src/components/button/Button.astro +0 -53
- package/dist/src/components/button/index.ts +0 -7
- package/dist/src/components/card/Card.astro +0 -14
- package/dist/src/components/card/CardContent.astro +0 -14
- package/dist/src/components/card/CardDescription.astro +0 -14
- package/dist/src/components/card/CardFooter.astro +0 -14
- package/dist/src/components/card/CardHeader.astro +0 -14
- package/dist/src/components/card/CardTitle.astro +0 -14
- package/dist/src/components/card/index.ts +0 -26
- package/dist/src/components/carousel/Carousel.astro +0 -55
- package/dist/src/components/carousel/CarouselContent.astro +0 -26
- package/dist/src/components/carousel/CarouselItem.astro +0 -26
- package/dist/src/components/carousel/CarouselNext.astro +0 -37
- package/dist/src/components/carousel/CarouselPrevious.astro +0 -37
- package/dist/src/components/carousel/carousel-script.ts +0 -191
- package/dist/src/components/carousel/index.ts +0 -32
- package/dist/src/components/checkbox/Checkbox.astro +0 -127
- package/dist/src/components/checkbox/index.ts +0 -7
- package/dist/src/components/dialog/Dialog.astro +0 -263
- package/dist/src/components/dialog/DialogClose.astro +0 -35
- package/dist/src/components/dialog/DialogContent.astro +0 -67
- package/dist/src/components/dialog/DialogDescription.astro +0 -14
- package/dist/src/components/dialog/DialogFooter.astro +0 -14
- package/dist/src/components/dialog/DialogHeader.astro +0 -14
- package/dist/src/components/dialog/DialogTitle.astro +0 -20
- package/dist/src/components/dialog/DialogTrigger.astro +0 -47
- package/dist/src/components/dialog/index.ts +0 -45
- package/dist/src/components/dropdown/Dropdown.astro +0 -375
- package/dist/src/components/dropdown/DropdownContent.astro +0 -81
- package/dist/src/components/dropdown/DropdownItem.astro +0 -48
- package/dist/src/components/dropdown/DropdownLabel.astro +0 -29
- package/dist/src/components/dropdown/DropdownSeparator.astro +0 -21
- package/dist/src/components/dropdown/DropdownTrigger.astro +0 -52
- package/dist/src/components/dropdown/index.ts +0 -33
- package/dist/src/components/dropzone/Dropzone.astro +0 -233
- package/dist/src/components/dropzone/DropzoneFilesList.astro +0 -26
- package/dist/src/components/dropzone/DropzoneLoadingIndicator.astro +0 -10
- package/dist/src/components/dropzone/DropzoneUploadIndicator.astro +0 -10
- package/dist/src/components/dropzone/index.ts +0 -24
- package/dist/src/components/input/Input.astro +0 -24
- package/dist/src/components/input/index.ts +0 -7
- package/dist/src/components/item/Item.astro +0 -52
- package/dist/src/components/item/ItemActions.astro +0 -16
- package/dist/src/components/item/ItemContent.astro +0 -16
- package/dist/src/components/item/ItemDescription.astro +0 -19
- package/dist/src/components/item/ItemFooter.astro +0 -16
- package/dist/src/components/item/ItemGroup.astro +0 -16
- package/dist/src/components/item/ItemHeader.astro +0 -16
- package/dist/src/components/item/ItemMedia.astro +0 -40
- package/dist/src/components/item/ItemSeparator.astro +0 -21
- package/dist/src/components/item/ItemTitle.astro +0 -16
- package/dist/src/components/item/index.ts +0 -50
- package/dist/src/components/kbd/Kbd.astro +0 -21
- package/dist/src/components/kbd/KbdGroup.astro +0 -16
- package/dist/src/components/kbd/index.ts +0 -11
- package/dist/src/components/label/Label.astro +0 -22
- package/dist/src/components/label/index.ts +0 -7
- package/dist/src/components/pagination/Pagination.astro +0 -20
- package/dist/src/components/pagination/PaginationContent.astro +0 -16
- package/dist/src/components/pagination/PaginationEllipsis.astro +0 -25
- package/dist/src/components/pagination/PaginationItem.astro +0 -16
- package/dist/src/components/pagination/PaginationLink.astro +0 -24
- package/dist/src/components/pagination/PaginationNext.astro +0 -26
- package/dist/src/components/pagination/PaginationPrevious.astro +0 -26
- package/dist/src/components/pagination/index.ts +0 -38
- package/dist/src/components/progress/Progress.astro +0 -154
- package/dist/src/components/progress/index.ts +0 -10
- package/dist/src/components/radio-group/RadioGroup.astro +0 -157
- package/dist/src/components/radio-group/RadioGroupItem.astro +0 -129
- package/dist/src/components/radio-group/RadioGroupTypes.ts +0 -6
- package/dist/src/components/radio-group/index.ts +0 -23
- package/dist/src/components/select/Select.astro +0 -534
- package/dist/src/components/select/SelectContent.astro +0 -83
- package/dist/src/components/select/SelectGroup.astro +0 -9
- package/dist/src/components/select/SelectItem.astro +0 -49
- package/dist/src/components/select/SelectLabel.astro +0 -14
- package/dist/src/components/select/SelectSeparator.astro +0 -12
- package/dist/src/components/select/SelectTrigger.astro +0 -48
- package/dist/src/components/select/SelectTypes.ts +0 -13
- package/dist/src/components/select/SelectValue.astro +0 -19
- package/dist/src/components/select/index.ts +0 -45
- package/dist/src/components/separator/Separator.astro +0 -36
- package/dist/src/components/separator/index.ts +0 -7
- package/dist/src/components/sheet/Sheet.astro +0 -13
- package/dist/src/components/sheet/SheetClose.astro +0 -13
- package/dist/src/components/sheet/SheetContent.astro +0 -92
- package/dist/src/components/sheet/SheetDescription.astro +0 -16
- package/dist/src/components/sheet/SheetFooter.astro +0 -16
- package/dist/src/components/sheet/SheetHeader.astro +0 -16
- package/dist/src/components/sheet/SheetTitle.astro +0 -16
- package/dist/src/components/sheet/SheetTrigger.astro +0 -13
- package/dist/src/components/sheet/index.ts +0 -41
- package/dist/src/components/skeleton/Skeleton.astro +0 -14
- package/dist/src/components/skeleton/index.ts +0 -9
- package/dist/src/components/spinner/Spinner.astro +0 -21
- package/dist/src/components/spinner/index.ts +0 -7
- package/dist/src/components/switch/Switch.astro +0 -191
- package/dist/src/components/switch/SwitchTypes.ts +0 -6
- package/dist/src/components/switch/index.ts +0 -12
- package/dist/src/components/table/Table.astro +0 -18
- package/dist/src/components/table/TableBody.astro +0 -16
- package/dist/src/components/table/TableCaption.astro +0 -16
- package/dist/src/components/table/TableCell.astro +0 -16
- package/dist/src/components/table/TableFoot.astro +0 -16
- package/dist/src/components/table/TableHead.astro +0 -16
- package/dist/src/components/table/TableHeader.astro +0 -16
- package/dist/src/components/table/TableRow.astro +0 -16
- package/dist/src/components/table/index.ts +0 -42
- package/dist/src/components/tabs/Tabs.astro +0 -269
- package/dist/src/components/tabs/TabsContent.astro +0 -28
- package/dist/src/components/tabs/TabsList.astro +0 -22
- package/dist/src/components/tabs/TabsTrigger.astro +0 -34
- package/dist/src/components/tabs/index.ts +0 -20
- package/dist/src/components/textarea/Textarea.astro +0 -28
- package/dist/src/components/textarea/index.ts +0 -9
- package/dist/src/components/tooltip/Tooltip.astro +0 -237
- package/dist/src/components/tooltip/TooltipContent.astro +0 -114
- package/dist/src/components/tooltip/TooltipTrigger.astro +0 -10
- package/dist/src/components/tooltip/index.ts +0 -16
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import ChevronDown from "@tabler/icons/outline/chevron-down.svg";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
import { tv } from "tailwind-variants";
|
|
5
|
-
|
|
6
|
-
type Props = Omit<HTMLAttributes<"button">, "role" | "type"> & {
|
|
7
|
-
/**
|
|
8
|
-
* The content to be rendered inside the select trigger
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
children: any;
|
|
12
|
-
/**
|
|
13
|
-
* Whether the select field is required in a form context
|
|
14
|
-
*/
|
|
15
|
-
required?: boolean;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const selectTrigger = tv({
|
|
19
|
-
base: [
|
|
20
|
-
"starwind-select-trigger",
|
|
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
|
-
"disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
24
|
-
],
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const { class: className, required = false, ...rest } = Astro.props;
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
<button
|
|
31
|
-
class={selectTrigger({ class: className })}
|
|
32
|
-
type="button"
|
|
33
|
-
role="combobox"
|
|
34
|
-
aria-label="Select field"
|
|
35
|
-
aria-controls=""
|
|
36
|
-
aria-expanded="false"
|
|
37
|
-
aria-haspopup="listbox"
|
|
38
|
-
aria-autocomplete="none"
|
|
39
|
-
aria-required={required ? "true" : "false"}
|
|
40
|
-
data-state="closed"
|
|
41
|
-
data-slot="select-trigger"
|
|
42
|
-
{...rest}
|
|
43
|
-
>
|
|
44
|
-
<slot />
|
|
45
|
-
<slot name="icon">
|
|
46
|
-
<ChevronDown class="size-4 opacity-50" />
|
|
47
|
-
</slot>
|
|
48
|
-
</button>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface SelectChangeEvent extends CustomEvent {
|
|
2
|
-
detail: {
|
|
3
|
-
value: string;
|
|
4
|
-
selectId: string;
|
|
5
|
-
label: string;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface SelectEvent extends CustomEvent {
|
|
10
|
-
detail:
|
|
11
|
-
| { value: string; selectId: string; selectName?: string }
|
|
12
|
-
| { value: string; selectId?: string; selectName: string };
|
|
13
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { tv } from "tailwind-variants";
|
|
4
|
-
|
|
5
|
-
type Props = HTMLAttributes<"span"> & {
|
|
6
|
-
/**
|
|
7
|
-
* The text to display when no value is selected
|
|
8
|
-
*/
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const selectValue = tv({ base: "pointer-events-none" });
|
|
13
|
-
|
|
14
|
-
const { placeholder = "select", class: className, ...rest } = Astro.props;
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
<span class={selectValue({ class: className })} data-slot="select-value" {...rest}>
|
|
18
|
-
{placeholder}
|
|
19
|
-
</span>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import Select from "./Select.astro";
|
|
2
|
-
import SelectContent, { selectContent, selectContentInner } from "./SelectContent.astro";
|
|
3
|
-
import SelectGroup from "./SelectGroup.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
|
-
import type { SelectChangeEvent, SelectEvent } from "./SelectTypes";
|
|
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
|
-
};
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
Select,
|
|
24
|
-
type SelectChangeEvent,
|
|
25
|
-
SelectContent,
|
|
26
|
-
type SelectEvent,
|
|
27
|
-
SelectGroup,
|
|
28
|
-
SelectItem,
|
|
29
|
-
SelectLabel,
|
|
30
|
-
SelectSeparator,
|
|
31
|
-
SelectTrigger,
|
|
32
|
-
SelectValue,
|
|
33
|
-
SelectVariants,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default {
|
|
37
|
-
Root: Select,
|
|
38
|
-
Trigger: SelectTrigger,
|
|
39
|
-
Value: SelectValue,
|
|
40
|
-
Content: SelectContent,
|
|
41
|
-
Group: SelectGroup,
|
|
42
|
-
Label: SelectLabel,
|
|
43
|
-
Item: SelectItem,
|
|
44
|
-
Separator: SelectSeparator,
|
|
45
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
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>
|
|
@@ -1,13 +0,0 @@
|
|
|
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>
|
|
@@ -1,13 +0,0 @@
|
|
|
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>
|
|
@@ -1,92 +0,0 @@
|
|
|
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
|
-
<slot name="backdrop">
|
|
67
|
-
<div class={dialogBackdrop()} data-state="closed" data-slot="dialog-backdrop"></div>
|
|
68
|
-
</slot>
|
|
69
|
-
|
|
70
|
-
<dialog
|
|
71
|
-
class={sheetContent({
|
|
72
|
-
side,
|
|
73
|
-
class: className,
|
|
74
|
-
})}
|
|
75
|
-
data-state="closed"
|
|
76
|
-
data-slot="sheet-content"
|
|
77
|
-
data-close-duration="300"
|
|
78
|
-
{...rest}
|
|
79
|
-
>
|
|
80
|
-
<slot />
|
|
81
|
-
<button
|
|
82
|
-
type="button"
|
|
83
|
-
class={sheetCloseButton()}
|
|
84
|
-
data-slot="sheet-close"
|
|
85
|
-
aria-label="Close dialog"
|
|
86
|
-
>
|
|
87
|
-
<slot name="icon">
|
|
88
|
-
<X class="size-5 transition-opacity" />
|
|
89
|
-
</slot>
|
|
90
|
-
<span class="sr-only">Close</span>
|
|
91
|
-
</button>
|
|
92
|
-
</dialog>
|
|
@@ -1,16 +0,0 @@
|
|
|
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>
|
|
@@ -1,16 +0,0 @@
|
|
|
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>
|
|
@@ -1,16 +0,0 @@
|
|
|
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>
|
|
@@ -1,16 +0,0 @@
|
|
|
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>
|
|
@@ -1,13 +0,0 @@
|
|
|
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>
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
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 skeleton = tv({
|
|
10
|
-
base: "bg-muted animate-pulse rounded-md",
|
|
11
|
-
});
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<div class={skeleton({ class: className })} data-slot="skeleton" {...rest}></div>
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
/>
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import { tv } from "tailwind-variants";
|
|
4
|
-
|
|
5
|
-
type Props = Omit<HTMLAttributes<"button">, "role" | "type" | "aria-checked"> & {
|
|
6
|
-
/**
|
|
7
|
-
* Unique identifier for the switch component.
|
|
8
|
-
*/
|
|
9
|
-
id: string;
|
|
10
|
-
/**
|
|
11
|
-
* Optional text label to display alongside the switch.
|
|
12
|
-
*/
|
|
13
|
-
label?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Controls the checked state of the switch.
|
|
16
|
-
*/
|
|
17
|
-
checked?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Custom padding in pixels to apply around the switch.
|
|
20
|
-
*/
|
|
21
|
-
padding?: number;
|
|
22
|
-
/**
|
|
23
|
-
* Size variant of the switch component.
|
|
24
|
-
*/
|
|
25
|
-
size?: "sm" | "md" | "lg";
|
|
26
|
-
/**
|
|
27
|
-
* Visual style variant of the switch.
|
|
28
|
-
* @default "default"
|
|
29
|
-
*/
|
|
30
|
-
variant?: "default" | "primary" | "secondary" | "info" | "success" | "warning" | "error";
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const {
|
|
34
|
-
id,
|
|
35
|
-
label,
|
|
36
|
-
checked = false,
|
|
37
|
-
padding,
|
|
38
|
-
size = "md",
|
|
39
|
-
variant = "default",
|
|
40
|
-
class: className,
|
|
41
|
-
...rest
|
|
42
|
-
} = Astro.props;
|
|
43
|
-
|
|
44
|
-
// if no specific padding is set, base it off of size
|
|
45
|
-
let newPadding = padding;
|
|
46
|
-
if (!padding) {
|
|
47
|
-
newPadding = size === "sm" ? 2.5 : size === "lg" ? 4 : 3;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const sizeMultiplier = size === "sm" ? 4 : size === "lg" ? 6 : 5;
|
|
51
|
-
|
|
52
|
-
let ariaLabel;
|
|
53
|
-
if (rest["aria-label"]) {
|
|
54
|
-
ariaLabel = rest["aria-label"];
|
|
55
|
-
delete rest["aria-label"];
|
|
56
|
-
} else if (label) {
|
|
57
|
-
ariaLabel = label;
|
|
58
|
-
} else {
|
|
59
|
-
ariaLabel = "switch";
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const switchButton = tv({
|
|
63
|
-
base: [
|
|
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
|
-
"not-disabled:cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
|
|
67
|
-
],
|
|
68
|
-
variants: {
|
|
69
|
-
variant: {
|
|
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",
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
defaultVariants: { variant: "default" },
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
export const switchToggle = tv({
|
|
84
|
-
base: [
|
|
85
|
-
"bg-foreground inline-block transform rounded-full transition-transform",
|
|
86
|
-
"group-aria-checked:translate-x-(--translation) group-aria-[checked=false]:translate-x-[calc(var(--padding)-var(--border-offset))]",
|
|
87
|
-
],
|
|
88
|
-
variants: { size: { sm: "size-4", md: "size-5", lg: "size-6" } },
|
|
89
|
-
defaultVariants: { size: "md" },
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
export const switchLabel = tv({
|
|
93
|
-
base: "text-foreground ml-2 font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
94
|
-
variants: { size: { sm: "text-sm", md: "text-base", lg: "text-lg" } },
|
|
95
|
-
defaultVariants: { size: "md" },
|
|
96
|
-
});
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
<div class="starwind-switch flex items-center">
|
|
100
|
-
<button
|
|
101
|
-
type="button"
|
|
102
|
-
id={id}
|
|
103
|
-
role="switch"
|
|
104
|
-
aria-checked={checked ? "true" : "false"}
|
|
105
|
-
aria-label={ariaLabel}
|
|
106
|
-
class={switchButton({ variant, class: className })}
|
|
107
|
-
style={{
|
|
108
|
-
"--padding": `${newPadding}px`,
|
|
109
|
-
"--height": `calc((var(--spacing) * ${sizeMultiplier}) + (var(--padding) * 2))`,
|
|
110
|
-
"--width": `calc((var(--spacing) * ${sizeMultiplier} * 2) + (var(--padding) * 3))`,
|
|
111
|
-
"--border-offset": "1px",
|
|
112
|
-
}}
|
|
113
|
-
data-slot="switch-button"
|
|
114
|
-
{...rest}
|
|
115
|
-
>
|
|
116
|
-
<span
|
|
117
|
-
class={switchToggle({ size })}
|
|
118
|
-
data-slot="switch-toggle"
|
|
119
|
-
style={{
|
|
120
|
-
"--translation": `calc((var(--spacing) * ${sizeMultiplier}) + (var(--padding) * 2) - var(--border-offset))`,
|
|
121
|
-
}}></span>
|
|
122
|
-
</button>
|
|
123
|
-
{
|
|
124
|
-
label && (
|
|
125
|
-
<label for={id} class={switchLabel({ size })} data-slot="switch-label">
|
|
126
|
-
{label}
|
|
127
|
-
</label>
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
</div>
|
|
131
|
-
|
|
132
|
-
<script>
|
|
133
|
-
import type { SwitchChangeEvent } from "./SwitchTypes";
|
|
134
|
-
|
|
135
|
-
class SwitchHandler {
|
|
136
|
-
private switchButton: HTMLButtonElement;
|
|
137
|
-
|
|
138
|
-
constructor(switchButton: HTMLButtonElement) {
|
|
139
|
-
this.switchButton = switchButton;
|
|
140
|
-
this.setupEventListeners();
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
private setupEventListeners(): void {
|
|
144
|
-
this.switchButton.addEventListener("click", () => this.handleStateChange());
|
|
145
|
-
this.switchButton.addEventListener("keydown", (event) => this.handleKeyDown(event));
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
private handleStateChange(): void {
|
|
149
|
-
if (this.switchButton.disabled) return;
|
|
150
|
-
|
|
151
|
-
const isChecked = this.switchButton.getAttribute("aria-checked") === "true";
|
|
152
|
-
const newState = !isChecked;
|
|
153
|
-
|
|
154
|
-
this.switchButton.setAttribute("aria-checked", newState.toString());
|
|
155
|
-
|
|
156
|
-
// Dispatch custom event with the new state
|
|
157
|
-
const event = new CustomEvent<SwitchChangeEvent["detail"]>("starwind-switch:change", {
|
|
158
|
-
detail: { checked: newState, switchId: this.switchButton.id },
|
|
159
|
-
bubbles: true,
|
|
160
|
-
cancelable: true,
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
this.switchButton.dispatchEvent(event);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
private handleKeyDown(event: KeyboardEvent): void {
|
|
167
|
-
if (this.switchButton.disabled) return;
|
|
168
|
-
|
|
169
|
-
if (event.key === " " || event.key === "Enter") {
|
|
170
|
-
event.preventDefault();
|
|
171
|
-
this.handleStateChange();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Store instances in a WeakMap to avoid memory leaks
|
|
177
|
-
const switchInstances = new WeakMap<HTMLButtonElement, SwitchHandler>();
|
|
178
|
-
|
|
179
|
-
const setupSwitches = () => {
|
|
180
|
-
document
|
|
181
|
-
.querySelectorAll<HTMLButtonElement>('.starwind-switch button[role="switch"]')
|
|
182
|
-
.forEach((switchButton) => {
|
|
183
|
-
if (!switchInstances.has(switchButton)) {
|
|
184
|
-
switchInstances.set(switchButton, new SwitchHandler(switchButton));
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
setupSwitches();
|
|
190
|
-
document.addEventListener("astro:after-swap", setupSwitches);
|
|
191
|
-
</script>
|