@orbitkit/components 0.1.0 → 0.2.0-beta.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/README.md +25 -25
- package/dist/astro/accordion/Accordion.astro +34 -0
- package/dist/astro/accordion/AccordionItem.astro +16 -0
- package/dist/astro/accordion/AccordionTrigger.astro +33 -0
- package/dist/astro/accordion/AcordionContent.astro +26 -0
- package/dist/astro/accordion/accordion.ts +125 -0
- package/dist/astro/accordion/index.ts +6 -0
- package/dist/astro/alert/Alert.astro +30 -30
- package/dist/astro/alert/AlertDescription.astro +10 -10
- package/dist/astro/alert/AlertTitle.astro +15 -15
- package/dist/astro/alert/alertVariants.ts +51 -51
- package/dist/astro/alert/index.ts +6 -6
- package/dist/astro/avatar/Avatar.astro +16 -16
- package/dist/astro/avatar/AvatarFallback.astro +18 -18
- package/dist/astro/avatar/AvatarImage.astro +14 -14
- package/dist/astro/avatar/avatarVariants.ts +23 -23
- package/dist/astro/avatar/index.ts +6 -6
- package/dist/astro/badge/Badge.astro +22 -22
- package/dist/astro/badge/badgeVariants.ts +37 -37
- package/dist/astro/badge/index.ts +4 -4
- package/dist/astro/breadcrumb/Breadcrumb.astro +12 -12
- package/dist/astro/breadcrumb/BreadcrumbEllipsis.astro +20 -20
- package/dist/astro/breadcrumb/BreadcrumbItem.astro +15 -15
- package/dist/astro/breadcrumb/BreadcrumbLink.astro +18 -18
- package/dist/astro/breadcrumb/BreadcrumbList.astro +18 -18
- package/dist/astro/breadcrumb/BreadcrumbPage.astro +18 -18
- package/dist/astro/breadcrumb/BreadcrumbSeparator.astro +17 -17
- package/dist/astro/breadcrumb/index.ts +17 -17
- package/dist/astro/button/Button.astro +29 -29
- package/dist/astro/button/buttonVariants.ts +61 -61
- package/dist/astro/button/index.ts +4 -4
- package/dist/astro/card/Card.astro +18 -18
- package/dist/astro/card/CardContent.astro +12 -12
- package/dist/astro/card/CardDescription.astro +12 -12
- package/dist/astro/card/CardFooter.astro +15 -15
- package/dist/astro/card/CardHeader.astro +12 -12
- package/dist/astro/card/CardTitle.astro +18 -18
- package/dist/astro/card/index.ts +15 -15
- package/dist/astro/checkbox/Checkbox.astro +38 -38
- package/dist/astro/checkbox/index.ts +3 -3
- package/dist/astro/collapsible/Collapsible.astro +34 -0
- package/dist/astro/collapsible/CollapsibleContent.astro +20 -0
- package/dist/astro/collapsible/collapsible.ts +81 -0
- package/dist/astro/collapsible/index.ts +4 -0
- package/dist/astro/divider/Divider.astro +22 -22
- package/dist/astro/divider/index.ts +3 -3
- package/dist/astro/drawer/Drawer.astro +19 -0
- package/dist/astro/drawer/DrawerContent.astro +74 -0
- package/dist/astro/drawer/DrawerDescription.astro +12 -0
- package/dist/astro/drawer/DrawerFooter.astro +15 -0
- package/dist/astro/drawer/DrawerHeader.astro +12 -0
- package/dist/astro/drawer/DrawerTitle.astro +18 -0
- package/dist/astro/drawer/drawer.ts +104 -0
- package/dist/astro/drawer/drawerVariants.ts +83 -0
- package/dist/astro/drawer/index.ts +15 -0
- package/dist/astro/dropdown/DropdownMenu.astro +19 -0
- package/dist/astro/dropdown/DropdownMenuContent.astro +42 -0
- package/dist/astro/dropdown/DropdownMenuGroup.astro +3 -0
- package/dist/astro/dropdown/DropdownMenuItem.astro +27 -0
- package/dist/astro/dropdown/DropdownMenuLabel.astro +3 -0
- package/dist/astro/dropdown/DropdownMenuSeparator.astro +6 -0
- package/dist/astro/dropdown/dropdown.ts +157 -0
- package/dist/astro/dropdown/dropdownVariants.ts +134 -0
- package/dist/astro/dropdown/index.ts +15 -0
- package/dist/astro/input/Input.astro +18 -18
- package/dist/astro/input/index.ts +4 -4
- package/dist/astro/input/inputVariants.ts +30 -30
- package/dist/astro/kbd/Kbd.astro +18 -0
- package/dist/astro/kbd/index.ts +3 -0
- package/dist/astro/label/Label.astro +14 -14
- package/dist/astro/label/index.ts +3 -3
- package/dist/astro/list/List.astro +25 -25
- package/dist/astro/list/ListItem.astro +39 -39
- package/dist/astro/list/ListVariants.ts +65 -65
- package/dist/astro/list/index.ts +5 -5
- package/dist/astro/modal/Modal.astro +19 -0
- package/dist/astro/modal/ModalContent.astro +71 -0
- package/dist/astro/modal/ModalDescription.astro +12 -0
- package/dist/astro/modal/ModalFooter.astro +15 -0
- package/dist/astro/modal/ModalHeader.astro +12 -0
- package/dist/astro/modal/ModalTitle.astro +18 -0
- package/dist/astro/modal/index.ts +15 -0
- package/dist/astro/modal/modal.ts +101 -0
- package/dist/astro/pagination/Pagination.astro +12 -0
- package/dist/astro/pagination/PaginationContent.astro +15 -0
- package/dist/astro/pagination/PaginationEllipsis.astro +33 -0
- package/dist/astro/pagination/PaginationItem.astro +12 -0
- package/dist/astro/pagination/PaginationLink.astro +21 -0
- package/dist/astro/pagination/PaginationNext.astro +29 -0
- package/dist/astro/pagination/PaginationPrevious.astro +34 -0
- package/dist/astro/pagination/index.ts +13 -0
- package/dist/astro/pagination/paginationVariants.ts +26 -0
- package/dist/astro/popover/Popover.astro +17 -0
- package/dist/astro/popover/PopoverContent.astro +39 -0
- package/dist/astro/popover/index.ts +4 -0
- package/dist/astro/popover/popover.ts +113 -0
- package/dist/astro/popover/popoverVariants.ts +115 -0
- package/dist/astro/progress/Progress.astro +23 -23
- package/dist/astro/progress/index.ts +4 -4
- package/dist/astro/progress/progressContainer.astro +17 -17
- package/dist/astro/radio/Radio.astro +26 -26
- package/dist/astro/radio/index.ts +3 -3
- package/dist/astro/select/Option.astro +11 -11
- package/dist/astro/select/Select.astro +39 -39
- package/dist/astro/select/index.ts +5 -5
- package/dist/astro/select/selectVariants.ts +30 -30
- package/dist/astro/skeleton/Skeleton.astro +12 -12
- package/dist/astro/skeleton/SkeletonItem.astro +18 -18
- package/dist/astro/skeleton/index.ts +4 -4
- package/dist/astro/stat/Stat.astro +12 -0
- package/dist/astro/stat/StatDescription.astro +12 -0
- package/dist/astro/stat/StatTitle.astro +18 -0
- package/dist/astro/stat/StatValue.astro +12 -0
- package/dist/astro/stat/index.ts +6 -0
- package/dist/astro/switch/Switch.astro +19 -19
- package/dist/astro/switch/index.ts +3 -3
- package/dist/astro/tab/Tab.astro +33 -0
- package/dist/astro/tab/TabContent.astro +19 -0
- package/dist/astro/tab/TabList.astro +19 -0
- package/dist/astro/tab/TabTrigger.astro +24 -0
- package/dist/astro/tab/index.ts +6 -0
- package/dist/astro/tab/tab.ts +142 -0
- package/dist/astro/textarea/Textarea.astro +19 -19
- package/dist/astro/textarea/TextareaVariants.ts +30 -30
- package/dist/astro/textarea/index.ts +4 -4
- package/dist/astro/tooltip/Tooltip.astro +40 -0
- package/dist/astro/tooltip/TooltipContent.astro +39 -0
- package/dist/astro/tooltip/index.ts +6 -0
- package/dist/astro/tooltip/tooltip.ts +137 -0
- package/dist/astro/tooltip/tooltipVariants.ts +115 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/package.json +54 -54
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { cva } from "class-variance-authority";
|
|
2
|
-
|
|
3
|
-
const baseClass =
|
|
4
|
-
"block w-full p-2.5 mb-2 text-sm rounded-lg outline-1 -outline-offset-1";
|
|
5
|
-
|
|
6
|
-
const inputVariants = cva(baseClass, {
|
|
7
|
-
variants: {
|
|
8
|
-
variant: {
|
|
9
|
-
default:
|
|
10
|
-
"text-foreground bg-input outline-input-border placeholder-input-placeholder",
|
|
11
|
-
},
|
|
12
|
-
disabled: {
|
|
13
|
-
false: null,
|
|
14
|
-
true: "bg-input/40 outline-input-border/40 text-muted-foreground cursor-not-allowed ",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
compoundVariants: [
|
|
18
|
-
{
|
|
19
|
-
variant: "default",
|
|
20
|
-
disabled: false,
|
|
21
|
-
class: "focus:outline-2 focus:-outline-offset-2 focus:outline-primary",
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
defaultVariants: {
|
|
25
|
-
variant: "default",
|
|
26
|
-
disabled: false,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export { inputVariants };
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
const baseClass =
|
|
4
|
+
"block w-full p-2.5 mb-2 text-sm rounded-lg outline-1 -outline-offset-1";
|
|
5
|
+
|
|
6
|
+
const inputVariants = cva(baseClass, {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default:
|
|
10
|
+
"text-foreground bg-input outline-input-border placeholder-input-placeholder",
|
|
11
|
+
},
|
|
12
|
+
disabled: {
|
|
13
|
+
false: null,
|
|
14
|
+
true: "bg-input/40 outline-input-border/40 text-muted-foreground cursor-not-allowed ",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
compoundVariants: [
|
|
18
|
+
{
|
|
19
|
+
variant: "default",
|
|
20
|
+
disabled: false,
|
|
21
|
+
class: "focus:outline-2 focus:-outline-offset-2 focus:outline-primary",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
variant: "default",
|
|
26
|
+
disabled: false,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export { inputVariants };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"kbd"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<kbd
|
|
11
|
+
class={cn(
|
|
12
|
+
"border border-b-2 border-muted-foreground p-1 text-xs font-semibold text-foreground bg-muted rounded-lg uppercase",
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
{...attrs}
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</kbd>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import { type HTMLAttributes } from "astro/types";
|
|
4
|
-
|
|
5
|
-
interface Props extends HTMLAttributes<"label"> {}
|
|
6
|
-
|
|
7
|
-
const { class: className, ...attrs } = Astro.props;
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
<label
|
|
11
|
-
{...attrs}
|
|
12
|
-
class={cn("block mb-2 text-sm font-medium text-foreground", className)}
|
|
13
|
-
><slot /></label
|
|
14
|
-
>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import { type HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"label"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<label
|
|
11
|
+
{...attrs}
|
|
12
|
+
class={cn("block mb-2 text-sm font-medium text-foreground", className)}
|
|
13
|
+
><slot /></label
|
|
14
|
+
>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Label from "./Label.astro";
|
|
2
|
-
|
|
3
|
-
export { Label };
|
|
1
|
+
import Label from "./Label.astro";
|
|
2
|
+
|
|
3
|
+
export { Label };
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
import type { VariantProps } from "class-variance-authority";
|
|
5
|
-
import { listVariants } from "./ListVariants";
|
|
6
|
-
|
|
7
|
-
interface Props
|
|
8
|
-
extends HTMLAttributes<"div">,
|
|
9
|
-
VariantProps<typeof listVariants> {}
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
class: className,
|
|
13
|
-
outerBorder,
|
|
14
|
-
innerBorders,
|
|
15
|
-
rounded,
|
|
16
|
-
...attrs
|
|
17
|
-
} = Astro.props;
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
<div
|
|
21
|
-
{...attrs}
|
|
22
|
-
class={cn(listVariants({ outerBorder, innerBorders, rounded, className }))}
|
|
23
|
-
>
|
|
24
|
-
<slot />
|
|
25
|
-
</div>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
import type { VariantProps } from "class-variance-authority";
|
|
5
|
+
import { listVariants } from "./ListVariants";
|
|
6
|
+
|
|
7
|
+
interface Props
|
|
8
|
+
extends HTMLAttributes<"div">,
|
|
9
|
+
VariantProps<typeof listVariants> {}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
class: className,
|
|
13
|
+
outerBorder,
|
|
14
|
+
innerBorders,
|
|
15
|
+
rounded,
|
|
16
|
+
...attrs
|
|
17
|
+
} = Astro.props;
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<div
|
|
21
|
+
{...attrs}
|
|
22
|
+
class={cn(listVariants({ outerBorder, innerBorders, rounded, className }))}
|
|
23
|
+
>
|
|
24
|
+
<slot />
|
|
25
|
+
</div>
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import type { HTMLAttributes } from "astro/types";
|
|
4
|
-
import type { VariantProps } from "class-variance-authority";
|
|
5
|
-
import { listItemVariants } from "./ListVariants";
|
|
6
|
-
|
|
7
|
-
export interface Props
|
|
8
|
-
extends HTMLAttributes<"div">,
|
|
9
|
-
Omit<HTMLAttributes<"a">, "type" | "disabled">,
|
|
10
|
-
Omit<HTMLAttributes<"button">, "type" | "disabled">,
|
|
11
|
-
VariantProps<typeof listItemVariants> {
|
|
12
|
-
as?: "a" | "button" | "div";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const {
|
|
16
|
-
class: className,
|
|
17
|
-
as,
|
|
18
|
-
disabled,
|
|
19
|
-
rounded,
|
|
20
|
-
active,
|
|
21
|
-
...attrs
|
|
22
|
-
} = Astro.props;
|
|
23
|
-
|
|
24
|
-
let Comp: typeof as = "div";
|
|
25
|
-
if (as === "a" || Astro.props.href) {
|
|
26
|
-
Comp = "a";
|
|
27
|
-
} else if (as === "button") {
|
|
28
|
-
Comp = "button";
|
|
29
|
-
}
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
<Comp
|
|
33
|
-
{...attrs}
|
|
34
|
-
disabled={disabled}
|
|
35
|
-
class={cn(listItemVariants({ active, disabled, rounded, className }))}
|
|
36
|
-
aria-label="list-item"
|
|
37
|
-
>
|
|
38
|
-
<slot />
|
|
39
|
-
</Comp>
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
import type { VariantProps } from "class-variance-authority";
|
|
5
|
+
import { listItemVariants } from "./ListVariants";
|
|
6
|
+
|
|
7
|
+
export interface Props
|
|
8
|
+
extends HTMLAttributes<"div">,
|
|
9
|
+
Omit<HTMLAttributes<"a">, "type" | "disabled">,
|
|
10
|
+
Omit<HTMLAttributes<"button">, "type" | "disabled">,
|
|
11
|
+
VariantProps<typeof listItemVariants> {
|
|
12
|
+
as?: "a" | "button" | "div";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
class: className,
|
|
17
|
+
as,
|
|
18
|
+
disabled,
|
|
19
|
+
rounded,
|
|
20
|
+
active,
|
|
21
|
+
...attrs
|
|
22
|
+
} = Astro.props;
|
|
23
|
+
|
|
24
|
+
let Comp: typeof as = "div";
|
|
25
|
+
if (as === "a" || Astro.props.href) {
|
|
26
|
+
Comp = "a";
|
|
27
|
+
} else if (as === "button") {
|
|
28
|
+
Comp = "button";
|
|
29
|
+
}
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
<Comp
|
|
33
|
+
{...attrs}
|
|
34
|
+
disabled={disabled}
|
|
35
|
+
class={cn(listItemVariants({ active, disabled, rounded, className }))}
|
|
36
|
+
aria-label="list-item"
|
|
37
|
+
>
|
|
38
|
+
<slot />
|
|
39
|
+
</Comp>
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { cva } from "class-variance-authority";
|
|
2
|
-
|
|
3
|
-
const baseClass = "flex flex-col bg-surface text-foreground overflow-hidden";
|
|
4
|
-
|
|
5
|
-
const listVariants = cva(baseClass, {
|
|
6
|
-
variants: {
|
|
7
|
-
outerBorder: {
|
|
8
|
-
true: "border border-border",
|
|
9
|
-
false: null,
|
|
10
|
-
},
|
|
11
|
-
innerBorders: {
|
|
12
|
-
true: "divide-y divide-border",
|
|
13
|
-
false: null,
|
|
14
|
-
},
|
|
15
|
-
rounded: {
|
|
16
|
-
none: "rounded-none",
|
|
17
|
-
xs: "rounded-xs",
|
|
18
|
-
sm: "rounded-sm",
|
|
19
|
-
md: "rounded-md",
|
|
20
|
-
lg: "rounded-lg",
|
|
21
|
-
xl: "rounded-xl",
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
defaultVariants: {
|
|
25
|
-
outerBorder: true,
|
|
26
|
-
innerBorders: true,
|
|
27
|
-
rounded: "lg",
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const listItemBaseClass =
|
|
32
|
-
"px-4 py-2 flex items-center justify-between text-base text-start";
|
|
33
|
-
|
|
34
|
-
const listItemVariants = cva(listItemBaseClass, {
|
|
35
|
-
variants: {
|
|
36
|
-
active: {
|
|
37
|
-
true: "bg-foreground/5",
|
|
38
|
-
false: null,
|
|
39
|
-
},
|
|
40
|
-
disabled: {
|
|
41
|
-
false: null,
|
|
42
|
-
true: "opacity-50 cursor-not-allowed",
|
|
43
|
-
},
|
|
44
|
-
rounded: {
|
|
45
|
-
none: "rounded-none",
|
|
46
|
-
xs: "rounded-xs",
|
|
47
|
-
sm: "rounded-sm",
|
|
48
|
-
md: "rounded-md",
|
|
49
|
-
lg: "rounded-lg",
|
|
50
|
-
xl: "rounded-xl",
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
compoundVariants: [
|
|
54
|
-
{
|
|
55
|
-
disabled: false,
|
|
56
|
-
class: "hover:bg-foreground/5 focus:outline-none",
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
defaultVariants: {
|
|
60
|
-
disabled: false,
|
|
61
|
-
rounded: "none",
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
export { listItemVariants, listVariants };
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
const baseClass = "flex flex-col bg-surface text-foreground overflow-hidden";
|
|
4
|
+
|
|
5
|
+
const listVariants = cva(baseClass, {
|
|
6
|
+
variants: {
|
|
7
|
+
outerBorder: {
|
|
8
|
+
true: "border border-border",
|
|
9
|
+
false: null,
|
|
10
|
+
},
|
|
11
|
+
innerBorders: {
|
|
12
|
+
true: "divide-y divide-border",
|
|
13
|
+
false: null,
|
|
14
|
+
},
|
|
15
|
+
rounded: {
|
|
16
|
+
none: "rounded-none",
|
|
17
|
+
xs: "rounded-xs",
|
|
18
|
+
sm: "rounded-sm",
|
|
19
|
+
md: "rounded-md",
|
|
20
|
+
lg: "rounded-lg",
|
|
21
|
+
xl: "rounded-xl",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
outerBorder: true,
|
|
26
|
+
innerBorders: true,
|
|
27
|
+
rounded: "lg",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const listItemBaseClass =
|
|
32
|
+
"px-4 py-2 flex items-center justify-between text-base text-start";
|
|
33
|
+
|
|
34
|
+
const listItemVariants = cva(listItemBaseClass, {
|
|
35
|
+
variants: {
|
|
36
|
+
active: {
|
|
37
|
+
true: "bg-foreground/5",
|
|
38
|
+
false: null,
|
|
39
|
+
},
|
|
40
|
+
disabled: {
|
|
41
|
+
false: null,
|
|
42
|
+
true: "opacity-50 cursor-not-allowed",
|
|
43
|
+
},
|
|
44
|
+
rounded: {
|
|
45
|
+
none: "rounded-none",
|
|
46
|
+
xs: "rounded-xs",
|
|
47
|
+
sm: "rounded-sm",
|
|
48
|
+
md: "rounded-md",
|
|
49
|
+
lg: "rounded-lg",
|
|
50
|
+
xl: "rounded-xl",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
compoundVariants: [
|
|
54
|
+
{
|
|
55
|
+
disabled: false,
|
|
56
|
+
class: "hover:bg-foreground/5 focus:outline-none",
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
disabled: false,
|
|
61
|
+
rounded: "none",
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export { listItemVariants, listVariants };
|
package/dist/astro/list/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import List from "./List.astro";
|
|
2
|
-
import ListItem from "./ListItem.astro";
|
|
3
|
-
import { listItemVariants, listVariants } from "./ListVariants";
|
|
4
|
-
|
|
5
|
-
export { List, ListItem, listItemVariants, listVariants };
|
|
1
|
+
import List from "./List.astro";
|
|
2
|
+
import ListItem from "./ListItem.astro";
|
|
3
|
+
import { listItemVariants, listVariants } from "./ListVariants";
|
|
4
|
+
|
|
5
|
+
export { List, ListItem, listItemVariants, listVariants };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<div data-modal-wrapper>
|
|
2
|
+
<slot />
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import { Modal } from "./modal";
|
|
7
|
+
|
|
8
|
+
function init() {
|
|
9
|
+
const modals = document.querySelectorAll<HTMLElement>(
|
|
10
|
+
"[data-modal-wrapper]",
|
|
11
|
+
);
|
|
12
|
+
modals.forEach((modal) => {
|
|
13
|
+
new Modal(modal);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
init();
|
|
18
|
+
document.addEventListener("astro:page-load", () => init());
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import type { HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
6
|
+
showCloseButton?: boolean;
|
|
7
|
+
backdrop?: boolean;
|
|
8
|
+
allowOutsideClick?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
class: className,
|
|
13
|
+
showCloseButton = true,
|
|
14
|
+
backdrop = true,
|
|
15
|
+
allowOutsideClick = true,
|
|
16
|
+
...attrs
|
|
17
|
+
} = Astro.props;
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
{
|
|
21
|
+
backdrop && (
|
|
22
|
+
<div
|
|
23
|
+
class="bg-background/10 fixed inset-0 left-0 top-0 z-50 hidden h-dvh w-full backdrop-blur-md transition-opacity duration-200"
|
|
24
|
+
aria-hidden="true"
|
|
25
|
+
data-state="closed"
|
|
26
|
+
data-backdrop
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
<div
|
|
32
|
+
data-modal
|
|
33
|
+
role="dialog"
|
|
34
|
+
aria-hidden="true"
|
|
35
|
+
data-state="closed"
|
|
36
|
+
data-show-close-button={showCloseButton}
|
|
37
|
+
data-allow-outside-click={allowOutsideClick}
|
|
38
|
+
class={cn(
|
|
39
|
+
"hidden fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 bg-surface text-foreground border-border border rounded-lg shadow-sm p-6 w-full max-w-[calc(100%-2rem)] sm:max-w-md transform transition-all ease-in data-[state=closed]:opacity-0 data-[state=closed]:scale-95 data[state=open]:opacity-100 data[state=open]:scale-100",
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
42
|
+
{...attrs}
|
|
43
|
+
>
|
|
44
|
+
{
|
|
45
|
+
showCloseButton && (
|
|
46
|
+
<button
|
|
47
|
+
class="text-foreground hover:bg-muted absolute right-3 top-3 cursor-pointer rounded-lg p-1 transition-colors duration-150"
|
|
48
|
+
aria-label="close modal"
|
|
49
|
+
data-close-modal
|
|
50
|
+
>
|
|
51
|
+
<svg
|
|
52
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
53
|
+
viewBox="0 0 24 24"
|
|
54
|
+
fill="none"
|
|
55
|
+
stroke="currentColor"
|
|
56
|
+
stroke-width="2"
|
|
57
|
+
stroke-linecap="round"
|
|
58
|
+
stroke-linejoin="round"
|
|
59
|
+
class="size-4"
|
|
60
|
+
>
|
|
61
|
+
<>
|
|
62
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
63
|
+
<path d="M18 6l-12 12" />
|
|
64
|
+
<path d="M6 6l12 12" />
|
|
65
|
+
</>
|
|
66
|
+
</svg>
|
|
67
|
+
</button>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
<slot />
|
|
71
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import { type HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"p"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<p {...attrs} class={cn("font-normal text-muted-foreground", className)}>
|
|
11
|
+
<slot />
|
|
12
|
+
</p>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import { type HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<div
|
|
11
|
+
{...attrs}
|
|
12
|
+
class={cn("pt-4 flex items-center justify-end gap-2", className)}
|
|
13
|
+
>
|
|
14
|
+
<slot />
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import { type HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"div"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<div {...attrs} class={cn("flex flex-col gap-1 pb-4", className)}>
|
|
11
|
+
<slot />
|
|
12
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { cn } from "@/utils/cn";
|
|
3
|
+
import { type HTMLAttributes } from "astro/types";
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAttributes<"h2"> {}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...attrs } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<h2
|
|
11
|
+
{...attrs}
|
|
12
|
+
class={cn(
|
|
13
|
+
"flex items-center justify-start gap-2 text-2xl font-semibold tracking-tight",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</h2>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Modal from "./Modal.astro";
|
|
2
|
+
import ModalContent from "./ModalContent.astro";
|
|
3
|
+
import ModalDescription from "./ModalDescription.astro";
|
|
4
|
+
import ModalFooter from "./ModalFooter.astro";
|
|
5
|
+
import ModalHeader from "./ModalHeader.astro";
|
|
6
|
+
import ModalTitle from "./ModalTitle.astro";
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
Modal,
|
|
10
|
+
ModalContent,
|
|
11
|
+
ModalDescription,
|
|
12
|
+
ModalFooter,
|
|
13
|
+
ModalHeader,
|
|
14
|
+
ModalTitle,
|
|
15
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export class Modal {
|
|
2
|
+
private wrapper: HTMLElement;
|
|
3
|
+
private modal: HTMLElement | null;
|
|
4
|
+
private trigger: HTMLElement | null;
|
|
5
|
+
private backdrop: HTMLElement | null;
|
|
6
|
+
private closeButtons: NodeListOf<HTMLElement> | null;
|
|
7
|
+
|
|
8
|
+
constructor(wrapper: HTMLElement) {
|
|
9
|
+
this.wrapper = wrapper;
|
|
10
|
+
this.modal = this.wrapper.querySelector("[data-modal]");
|
|
11
|
+
this.backdrop = this.wrapper.querySelector("[data-backdrop]");
|
|
12
|
+
this.trigger = this.wrapper.querySelector("[data-trigger]");
|
|
13
|
+
this.closeButtons = this.wrapper.querySelectorAll("[data-close]");
|
|
14
|
+
|
|
15
|
+
if (!this.modal || !this.trigger) {
|
|
16
|
+
console.error("Modal not initialized properly", {
|
|
17
|
+
modal: this.modal,
|
|
18
|
+
});
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
this.init();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private init() {
|
|
26
|
+
this.setupAccessibility();
|
|
27
|
+
this.setupEventListeners();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private setupAccessibility() {
|
|
31
|
+
const title = this.modal?.querySelector<HTMLElement>(
|
|
32
|
+
"h1, h2, h3, h4, h5, h6",
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (title) {
|
|
36
|
+
const id =
|
|
37
|
+
title.id || `modal-id-${Math.random().toString(36).substring(2, 9)}`;
|
|
38
|
+
title.id = id;
|
|
39
|
+
this.modal?.setAttribute("aria-describedby", id);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
this.setState("closed");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private setupEventListeners() {
|
|
46
|
+
this.trigger!.addEventListener("click", () => this.open());
|
|
47
|
+
|
|
48
|
+
if (this.modal?.dataset.allowOutsideClick === "true") {
|
|
49
|
+
this.backdrop?.addEventListener("click", () => this.closeModal());
|
|
50
|
+
document.addEventListener("click", (e) => {
|
|
51
|
+
const target = e.target as HTMLElement;
|
|
52
|
+
if (
|
|
53
|
+
this.modal &&
|
|
54
|
+
!this.modal.contains(target) &&
|
|
55
|
+
target !== this.trigger
|
|
56
|
+
) {
|
|
57
|
+
this.closeModal();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this.closeButtons?.forEach((trigger) => {
|
|
63
|
+
trigger.addEventListener("click", () => this.closeModal());
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
document.addEventListener("keydown", (e) => this.handleKeyDown(e));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private open() {
|
|
70
|
+
this.backdrop?.classList.remove("hidden");
|
|
71
|
+
this.modal?.classList.remove("hidden");
|
|
72
|
+
document.body.classList.add("overflow-hidden");
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
this.setState("open");
|
|
75
|
+
}, 0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private closeModal() {
|
|
79
|
+
this.setState("closed");
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
this.backdrop?.classList.add("hidden");
|
|
82
|
+
this.modal?.classList.add("hidden");
|
|
83
|
+
document.body.classList.remove("overflow-hidden");
|
|
84
|
+
}, 200);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private setState(state: "open" | "closed") {
|
|
88
|
+
this.trigger?.focus();
|
|
89
|
+
this.modal?.setAttribute("aria-hidden", `${state === "closed"}`);
|
|
90
|
+
this.modal?.setAttribute("data-state", state);
|
|
91
|
+
this.backdrop?.setAttribute("aria-hidden", `${state === "closed"}`);
|
|
92
|
+
this.backdrop?.setAttribute("data-state", state);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private handleKeyDown = (event: KeyboardEvent) => {
|
|
96
|
+
if (event.key === "Escape" && this.modal!.dataset.status === "open") {
|
|
97
|
+
this.closeModal();
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|