@arch-cadre/blog-module 1.0.7 → 1.0.9
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/actions/index.d.ts +38 -5
- package/dist/actions/index.js +149 -0
- package/dist/components/BlogStatsWidget.d.ts +1 -2
- package/dist/components/BlogStatsWidget.js +17 -0
- package/dist/components/RecentCommentsWidget.d.ts +1 -2
- package/dist/components/RecentCommentsWidget.js +24 -0
- package/dist/components/RecentPostsWidget.d.ts +1 -2
- package/dist/components/RecentPostsWidget.js +24 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.js +33 -0
- package/dist/components/ui/card.js +12 -0
- package/dist/components/ui/input.js +8 -0
- package/dist/components/ui/table.js +16 -0
- package/dist/components/ui/textarea.js +8 -0
- package/dist/index.js +98 -0
- package/dist/lib/{utils.mjs → utils.js} +1 -1
- package/dist/lib/validation.d.ts +2 -2
- package/dist/lib/validation.js +11 -0
- package/dist/navigation.js +21 -0
- package/dist/routes.js +55 -0
- package/dist/schema.js +60 -0
- package/dist/ui/views.d.ts +5 -6
- package/dist/ui/views.js +119 -0
- package/package.json +11 -17
- package/src/actions/index.d.ts +67 -0
- package/src/actions/index.js +149 -0
- package/src/actions/index.ts +157 -0
- package/src/components/BlogStatsWidget.d.ts +1 -0
- package/src/components/BlogStatsWidget.js +17 -0
- package/src/components/BlogStatsWidget.tsx +46 -0
- package/src/components/RecentCommentsWidget.d.ts +1 -0
- package/src/components/RecentCommentsWidget.js +24 -0
- package/src/components/RecentCommentsWidget.tsx +71 -0
- package/src/components/RecentPostsWidget.d.ts +1 -0
- package/src/components/RecentPostsWidget.js +24 -0
- package/src/components/RecentPostsWidget.tsx +68 -0
- package/src/components/ui/button.d.ts +11 -0
- package/src/components/ui/button.js +33 -0
- package/src/components/ui/button.tsx +56 -0
- package/src/components/ui/card.d.ts +6 -0
- package/src/components/ui/card.js +12 -0
- package/src/components/ui/card.tsx +51 -0
- package/src/components/ui/input.d.ts +5 -0
- package/src/components/ui/input.js +8 -0
- package/{dist/components/ui/input.mjs → src/components/ui/input.tsx} +17 -13
- package/src/components/ui/table.d.ts +8 -0
- package/src/components/ui/table.js +16 -0
- package/src/components/ui/table.tsx +83 -0
- package/src/components/ui/textarea.d.ts +5 -0
- package/src/components/ui/textarea.js +8 -0
- package/{dist/components/ui/textarea.mjs → src/components/ui/textarea.tsx} +16 -12
- package/src/index.d.ts +3 -0
- package/src/index.js +98 -0
- package/{dist/index.mjs → src/index.ts} +44 -18
- package/src/lib/utils.d.ts +2 -0
- package/src/lib/utils.js +5 -0
- package/src/lib/utils.ts +6 -0
- package/src/lib/validation.d.ts +24 -0
- package/src/lib/validation.js +11 -0
- package/{dist/lib/validation.mjs → src/lib/validation.ts} +5 -2
- package/src/navigation.d.ts +2 -0
- package/src/navigation.js +21 -0
- package/{dist/navigation.mjs → src/navigation.ts} +9 -7
- package/src/routes.d.ts +3 -0
- package/src/routes.js +55 -0
- package/{dist/routes.mjs → src/routes.tsx} +30 -24
- package/src/schema.d.ts +736 -0
- package/src/schema.js +60 -0
- package/src/schema.ts +67 -0
- package/src/styles/globals.css +123 -0
- package/src/ui/views.d.ts +15 -0
- package/src/ui/views.js +119 -0
- package/src/ui/views.tsx +538 -0
- package/dist/actions/index.cjs +0 -158
- package/dist/actions/index.mjs +0 -121
- package/dist/components/BlogStatsWidget.cjs +0 -45
- package/dist/components/BlogStatsWidget.mjs +0 -13
- package/dist/components/RecentCommentsWidget.cjs +0 -47
- package/dist/components/RecentCommentsWidget.mjs +0 -28
- package/dist/components/RecentPostsWidget.cjs +0 -47
- package/dist/components/RecentPostsWidget.mjs +0 -28
- package/dist/components/ui/button.cjs +0 -53
- package/dist/components/ui/button.mjs +0 -44
- package/dist/components/ui/card.cjs +0 -46
- package/dist/components/ui/card.mjs +0 -35
- package/dist/components/ui/input.cjs +0 -23
- package/dist/components/ui/table.cjs +0 -66
- package/dist/components/ui/table.mjs +0 -59
- package/dist/components/ui/textarea.cjs +0 -21
- package/dist/index.cjs +0 -100
- package/dist/lib/utils.cjs +0 -11
- package/dist/lib/validation.cjs +0 -16
- package/dist/navigation.cjs +0 -23
- package/dist/routes.cjs +0 -74
- package/dist/schema.cjs +0 -62
- package/dist/schema.mjs +0 -53
- package/dist/styles/globals.css +0 -1
- package/dist/ui/views.cjs +0 -448
- package/dist/ui/views.mjs +0 -232
- /package/{dist → src}/intl.d.ts +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { db, userTable } from "@arch-cadre/core/server";
|
|
3
|
+
import { getTranslation } from "@arch-cadre/intl/server";
|
|
4
|
+
import { Avatar, AvatarFallback, AvatarImage, Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@arch-cadre/ui";
|
|
5
|
+
import { desc, eq } from "drizzle-orm";
|
|
6
|
+
import { commentsTable } from "../schema.js";
|
|
7
|
+
export default async function RecentCommentsWidget() {
|
|
8
|
+
const { t } = await getTranslation();
|
|
9
|
+
const comments = await db
|
|
10
|
+
.select({
|
|
11
|
+
id: commentsTable.id,
|
|
12
|
+
content: commentsTable.content,
|
|
13
|
+
createdAt: commentsTable.createdAt,
|
|
14
|
+
author: {
|
|
15
|
+
name: userTable.name,
|
|
16
|
+
image: userTable.image,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
.from(commentsTable)
|
|
20
|
+
.leftJoin(userTable, eq(commentsTable.authorId, userTable.id))
|
|
21
|
+
.orderBy(desc(commentsTable.createdAt))
|
|
22
|
+
.limit(5);
|
|
23
|
+
return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: t("Recent Comments") }), _jsx(CardDescription, { children: t("What readers are saying about your posts.") })] }), _jsxs(CardContent, { className: "grid gap-8", children: [comments.map((comment) => (_jsxs("div", { className: "flex items-center gap-4", children: [_jsxs(Avatar, { className: "h-9 w-9", children: [_jsx(AvatarImage, { src: comment.author?.image || "", alt: "Avatar" }), _jsx(AvatarFallback, { children: comment.author?.name?.substring(0, 2).toUpperCase() || "CM" })] }), _jsxs("div", { className: "grid gap-1", children: [_jsx("p", { className: "text-sm font-medium leading-none line-clamp-1", children: comment.content }), _jsxs("p", { className: "text-sm text-muted-foreground", children: [comment.author?.name || t("Anonymous"), " \u2022", " ", new Date(comment.createdAt).toLocaleDateString()] })] })] }, comment.id))), comments.length === 0 && (_jsx("div", { className: "text-center py-4 text-muted-foreground", children: t("No comments yet.") }))] })] }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { db, userTable } from "@arch-cadre/core/server";
|
|
2
|
+
import { getTranslation } from "@arch-cadre/intl/server";
|
|
3
|
+
import {
|
|
4
|
+
Avatar,
|
|
5
|
+
AvatarFallback,
|
|
6
|
+
AvatarImage,
|
|
7
|
+
Card,
|
|
8
|
+
CardContent,
|
|
9
|
+
CardDescription,
|
|
10
|
+
CardHeader,
|
|
11
|
+
CardTitle,
|
|
12
|
+
} from "@arch-cadre/ui";
|
|
13
|
+
import { desc, eq } from "drizzle-orm";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import { commentsTable } from "../schema.js";
|
|
16
|
+
|
|
17
|
+
export default async function RecentCommentsWidget() {
|
|
18
|
+
const { t } = await getTranslation();
|
|
19
|
+
|
|
20
|
+
const comments = await db
|
|
21
|
+
.select({
|
|
22
|
+
id: commentsTable.id,
|
|
23
|
+
content: commentsTable.content,
|
|
24
|
+
createdAt: commentsTable.createdAt,
|
|
25
|
+
author: {
|
|
26
|
+
name: userTable.name,
|
|
27
|
+
image: userTable.image,
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
.from(commentsTable)
|
|
31
|
+
.leftJoin(userTable, eq(commentsTable.authorId, userTable.id))
|
|
32
|
+
.orderBy(desc(commentsTable.createdAt))
|
|
33
|
+
.limit(5);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Card>
|
|
37
|
+
<CardHeader>
|
|
38
|
+
<CardTitle>{t("Recent Comments")}</CardTitle>
|
|
39
|
+
<CardDescription>
|
|
40
|
+
{t("What readers are saying about your posts.")}
|
|
41
|
+
</CardDescription>
|
|
42
|
+
</CardHeader>
|
|
43
|
+
<CardContent className="grid gap-8">
|
|
44
|
+
{comments.map((comment) => (
|
|
45
|
+
<div key={comment.id} className="flex items-center gap-4">
|
|
46
|
+
<Avatar className="h-9 w-9">
|
|
47
|
+
<AvatarImage src={comment.author?.image || ""} alt="Avatar" />
|
|
48
|
+
<AvatarFallback>
|
|
49
|
+
{comment.author?.name?.substring(0, 2).toUpperCase() || "CM"}
|
|
50
|
+
</AvatarFallback>
|
|
51
|
+
</Avatar>
|
|
52
|
+
<div className="grid gap-1">
|
|
53
|
+
<p className="text-sm font-medium leading-none line-clamp-1">
|
|
54
|
+
{comment.content}
|
|
55
|
+
</p>
|
|
56
|
+
<p className="text-sm text-muted-foreground">
|
|
57
|
+
{comment.author?.name || t("Anonymous")} •{" "}
|
|
58
|
+
{new Date(comment.createdAt).toLocaleDateString()}
|
|
59
|
+
</p>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
))}
|
|
63
|
+
{comments.length === 0 && (
|
|
64
|
+
<div className="text-center py-4 text-muted-foreground">
|
|
65
|
+
{t("No comments yet.")}
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
68
|
+
</CardContent>
|
|
69
|
+
</Card>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RecentPostsWidget(): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { db, userTable } from "@arch-cadre/core/server";
|
|
3
|
+
import { getTranslation } from "@arch-cadre/intl/server";
|
|
4
|
+
import { Avatar, AvatarFallback, AvatarImage, Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@arch-cadre/ui";
|
|
5
|
+
import { desc, eq } from "drizzle-orm";
|
|
6
|
+
import { postsTable } from "../schema.js";
|
|
7
|
+
export default async function RecentPostsWidget() {
|
|
8
|
+
const { t } = await getTranslation();
|
|
9
|
+
const posts = await db
|
|
10
|
+
.select({
|
|
11
|
+
id: postsTable.id,
|
|
12
|
+
title: postsTable.title,
|
|
13
|
+
createdAt: postsTable.createdAt,
|
|
14
|
+
author: {
|
|
15
|
+
name: userTable.name,
|
|
16
|
+
image: userTable.image,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
.from(postsTable)
|
|
20
|
+
.leftJoin(userTable, eq(postsTable.authorId, userTable.id))
|
|
21
|
+
.orderBy(desc(postsTable.createdAt))
|
|
22
|
+
.limit(5);
|
|
23
|
+
return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: t("Recent Posts") }), _jsx(CardDescription, { children: t("The latest articles published on your blog.") })] }), _jsxs(CardContent, { className: "grid gap-8", children: [posts.map((post) => (_jsxs("div", { className: "flex items-center gap-4", children: [_jsxs(Avatar, { className: "h-9 w-9", children: [_jsx(AvatarImage, { src: post.author?.image || "", alt: "Avatar" }), _jsx(AvatarFallback, { children: post.author?.name?.substring(0, 2).toUpperCase() || "AU" })] }), _jsxs("div", { className: "grid gap-1", children: [_jsx("p", { className: "text-sm font-medium leading-none", children: post.title }), _jsx("p", { className: "text-sm text-muted-foreground", children: new Date(post.createdAt).toLocaleDateString() })] })] }, post.id))), posts.length === 0 && (_jsx("div", { className: "text-center py-4 text-muted-foreground", children: t("No posts found.") }))] })] }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { db, userTable } from "@arch-cadre/core/server";
|
|
2
|
+
import { getTranslation } from "@arch-cadre/intl/server";
|
|
3
|
+
import {
|
|
4
|
+
Avatar,
|
|
5
|
+
AvatarFallback,
|
|
6
|
+
AvatarImage,
|
|
7
|
+
Card,
|
|
8
|
+
CardContent,
|
|
9
|
+
CardDescription,
|
|
10
|
+
CardHeader,
|
|
11
|
+
CardTitle,
|
|
12
|
+
} from "@arch-cadre/ui";
|
|
13
|
+
import { desc, eq } from "drizzle-orm";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import { postsTable } from "../schema.js";
|
|
16
|
+
|
|
17
|
+
export default async function RecentPostsWidget() {
|
|
18
|
+
const { t } = await getTranslation();
|
|
19
|
+
|
|
20
|
+
const posts = await db
|
|
21
|
+
.select({
|
|
22
|
+
id: postsTable.id,
|
|
23
|
+
title: postsTable.title,
|
|
24
|
+
createdAt: postsTable.createdAt,
|
|
25
|
+
author: {
|
|
26
|
+
name: userTable.name,
|
|
27
|
+
image: userTable.image,
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
.from(postsTable)
|
|
31
|
+
.leftJoin(userTable, eq(postsTable.authorId, userTable.id))
|
|
32
|
+
.orderBy(desc(postsTable.createdAt))
|
|
33
|
+
.limit(5);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Card>
|
|
37
|
+
<CardHeader>
|
|
38
|
+
<CardTitle>{t("Recent Posts")}</CardTitle>
|
|
39
|
+
<CardDescription>
|
|
40
|
+
{t("The latest articles published on your blog.")}
|
|
41
|
+
</CardDescription>
|
|
42
|
+
</CardHeader>
|
|
43
|
+
<CardContent className="grid gap-8">
|
|
44
|
+
{posts.map((post) => (
|
|
45
|
+
<div key={post.id} className="flex items-center gap-4">
|
|
46
|
+
<Avatar className="h-9 w-9">
|
|
47
|
+
<AvatarImage src={post.author?.image || ""} alt="Avatar" />
|
|
48
|
+
<AvatarFallback>
|
|
49
|
+
{post.author?.name?.substring(0, 2).toUpperCase() || "AU"}
|
|
50
|
+
</AvatarFallback>
|
|
51
|
+
</Avatar>
|
|
52
|
+
<div className="grid gap-1">
|
|
53
|
+
<p className="text-sm font-medium leading-none">{post.title}</p>
|
|
54
|
+
<p className="text-sm text-muted-foreground">
|
|
55
|
+
{new Date(post.createdAt).toLocaleDateString()}
|
|
56
|
+
</p>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
))}
|
|
60
|
+
{posts.length === 0 && (
|
|
61
|
+
<div className="text-center py-4 text-muted-foreground">
|
|
62
|
+
{t("No posts found.")}
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
65
|
+
</CardContent>
|
|
66
|
+
</Card>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
const buttonVariants = cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
10
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
11
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
12
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
13
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
14
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
default: "h-9 px-4 py-2",
|
|
18
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
19
|
+
lg: "h-10 rounded-md px-8",
|
|
20
|
+
icon: "size-9",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
variant: "default",
|
|
25
|
+
size: "default",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
29
|
+
const Comp = asChild ? Slot : "button";
|
|
30
|
+
return (_jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
|
|
31
|
+
});
|
|
32
|
+
Button.displayName = "Button";
|
|
33
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
|
|
6
|
+
const buttonVariants = cva(
|
|
7
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default:
|
|
12
|
+
"bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
13
|
+
destructive:
|
|
14
|
+
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
15
|
+
outline:
|
|
16
|
+
"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
17
|
+
secondary:
|
|
18
|
+
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
19
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
20
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default: "h-9 px-4 py-2",
|
|
24
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
25
|
+
lg: "h-10 rounded-md px-8",
|
|
26
|
+
icon: "size-9",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
variant: "default",
|
|
31
|
+
size: "default",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export interface ButtonProps
|
|
37
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
38
|
+
VariantProps<typeof buttonVariants> {
|
|
39
|
+
asChild?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
43
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
44
|
+
const Comp = asChild ? Slot : "button";
|
|
45
|
+
return (
|
|
46
|
+
<Comp
|
|
47
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
48
|
+
ref={ref}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
Button.displayName = "Button";
|
|
55
|
+
|
|
56
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export { Card, CardHeader, CardTitle, CardContent };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const Card = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("rounded-xl border bg-card text-card-foreground shadow", className), ...props })));
|
|
5
|
+
Card.displayName = "Card";
|
|
6
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })));
|
|
7
|
+
CardHeader.displayName = "CardHeader";
|
|
8
|
+
const CardTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("font-semibold leading-none tracking-tight", className), ...props })));
|
|
9
|
+
CardTitle.displayName = "CardTitle";
|
|
10
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("p-6 pt-0", className), ...props })));
|
|
11
|
+
CardContent.displayName = "CardContent";
|
|
12
|
+
export { Card, CardHeader, CardTitle, CardContent };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
|
|
4
|
+
const Card = React.forwardRef<
|
|
5
|
+
HTMLDivElement,
|
|
6
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
7
|
+
>(({ className, ...props }, ref) => (
|
|
8
|
+
<div
|
|
9
|
+
ref={ref}
|
|
10
|
+
className={cn(
|
|
11
|
+
"rounded-xl border bg-card text-card-foreground shadow",
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
));
|
|
17
|
+
Card.displayName = "Card";
|
|
18
|
+
|
|
19
|
+
const CardHeader = React.forwardRef<
|
|
20
|
+
HTMLDivElement,
|
|
21
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
22
|
+
>(({ className, ...props }, ref) => (
|
|
23
|
+
<div
|
|
24
|
+
ref={ref}
|
|
25
|
+
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
));
|
|
29
|
+
CardHeader.displayName = "CardHeader";
|
|
30
|
+
|
|
31
|
+
const CardTitle = React.forwardRef<
|
|
32
|
+
HTMLDivElement,
|
|
33
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
34
|
+
>(({ className, ...props }, ref) => (
|
|
35
|
+
<div
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={cn("font-semibold leading-none tracking-tight", className)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
));
|
|
41
|
+
CardTitle.displayName = "CardTitle";
|
|
42
|
+
|
|
43
|
+
const CardContent = React.forwardRef<
|
|
44
|
+
HTMLDivElement,
|
|
45
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
46
|
+
>(({ className, ...props }, ref) => (
|
|
47
|
+
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
|
48
|
+
));
|
|
49
|
+
CardContent.displayName = "CardContent";
|
|
50
|
+
|
|
51
|
+
export { Card, CardHeader, CardTitle, CardContent };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const Input = React.forwardRef(({ className, type, ...props }, ref) => {
|
|
5
|
+
return (_jsx("input", { type: type, className: cn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", className), ref: ref, ...props }));
|
|
6
|
+
});
|
|
7
|
+
Input.displayName = "Input";
|
|
8
|
+
export { Input };
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { cn } from "../../lib/utils.
|
|
3
|
-
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
|
|
4
|
+
export interface InputProps
|
|
5
|
+
extends React.InputHTMLAttributes<HTMLInputElement> { }
|
|
6
|
+
|
|
7
|
+
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
4
8
|
({ className, type, ...props }, ref) => {
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
className: cn(
|
|
9
|
+
return (
|
|
10
|
+
<input
|
|
11
|
+
type={type}
|
|
12
|
+
className={cn(
|
|
10
13
|
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
11
|
-
className
|
|
12
|
-
)
|
|
13
|
-
ref
|
|
14
|
-
...props
|
|
15
|
-
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
ref={ref}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
16
19
|
);
|
|
17
|
-
}
|
|
20
|
+
},
|
|
18
21
|
);
|
|
19
22
|
Input.displayName = "Input";
|
|
23
|
+
|
|
20
24
|
export { Input };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
3
|
+
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
4
|
+
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
5
|
+
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
6
|
+
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
7
|
+
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
8
|
+
export { Table, TableHeader, TableBody, TableHead, TableRow, TableCell };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const Table = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { className: "relative w-full overflow-auto", children: _jsx("table", { ref: ref, className: cn("w-full caption-bottom text-sm", className), ...props }) })));
|
|
5
|
+
Table.displayName = "Table";
|
|
6
|
+
const TableHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("thead", { ref: ref, className: cn("[&_tr]:border-b", className), ...props })));
|
|
7
|
+
TableHeader.displayName = "TableHeader";
|
|
8
|
+
const TableBody = React.forwardRef(({ className, ...props }, ref) => (_jsx("tbody", { ref: ref, className: cn("[&_tr:last-child]:border-0", className), ...props })));
|
|
9
|
+
TableBody.displayName = "TableBody";
|
|
10
|
+
const TableRow = React.forwardRef(({ className, ...props }, ref) => (_jsx("tr", { ref: ref, className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className), ...props })));
|
|
11
|
+
TableRow.displayName = "TableRow";
|
|
12
|
+
const TableHead = React.forwardRef(({ className, ...props }, ref) => (_jsx("th", { ref: ref, className: cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props })));
|
|
13
|
+
TableHead.displayName = "TableHead";
|
|
14
|
+
const TableCell = React.forwardRef(({ className, ...props }, ref) => (_jsx("td", { ref: ref, className: cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props })));
|
|
15
|
+
TableCell.displayName = "TableCell";
|
|
16
|
+
export { Table, TableHeader, TableBody, TableHead, TableRow, TableCell };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
|
|
4
|
+
const Table = React.forwardRef<
|
|
5
|
+
HTMLTableElement,
|
|
6
|
+
React.HTMLAttributes<HTMLTableElement>
|
|
7
|
+
>(({ className, ...props }, ref) => (
|
|
8
|
+
<div className="relative w-full overflow-auto">
|
|
9
|
+
<table
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
));
|
|
16
|
+
Table.displayName = "Table";
|
|
17
|
+
|
|
18
|
+
const TableHeader = React.forwardRef<
|
|
19
|
+
HTMLTableSectionElement,
|
|
20
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
21
|
+
>(({ className, ...props }, ref) => (
|
|
22
|
+
<thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
|
|
23
|
+
));
|
|
24
|
+
TableHeader.displayName = "TableHeader";
|
|
25
|
+
|
|
26
|
+
const TableBody = React.forwardRef<
|
|
27
|
+
HTMLTableSectionElement,
|
|
28
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
29
|
+
>(({ className, ...props }, ref) => (
|
|
30
|
+
<tbody
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={cn("[&_tr:last-child]:border-0", className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
));
|
|
36
|
+
TableBody.displayName = "TableBody";
|
|
37
|
+
|
|
38
|
+
const TableRow = React.forwardRef<
|
|
39
|
+
HTMLTableRowElement,
|
|
40
|
+
React.HTMLAttributes<HTMLTableRowElement>
|
|
41
|
+
>(({ className, ...props }, ref) => (
|
|
42
|
+
<tr
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn(
|
|
45
|
+
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
));
|
|
51
|
+
TableRow.displayName = "TableRow";
|
|
52
|
+
|
|
53
|
+
const TableHead = React.forwardRef<
|
|
54
|
+
HTMLTableCellElement,
|
|
55
|
+
React.ThHTMLAttributes<HTMLTableCellElement>
|
|
56
|
+
>(({ className, ...props }, ref) => (
|
|
57
|
+
<th
|
|
58
|
+
ref={ref}
|
|
59
|
+
className={cn(
|
|
60
|
+
"h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
61
|
+
className,
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
));
|
|
66
|
+
TableHead.displayName = "TableHead";
|
|
67
|
+
|
|
68
|
+
const TableCell = React.forwardRef<
|
|
69
|
+
HTMLTableCellElement,
|
|
70
|
+
React.TdHTMLAttributes<HTMLTableCellElement>
|
|
71
|
+
>(({ className, ...props }, ref) => (
|
|
72
|
+
<td
|
|
73
|
+
ref={ref}
|
|
74
|
+
className={cn(
|
|
75
|
+
"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
76
|
+
className,
|
|
77
|
+
)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
));
|
|
81
|
+
TableCell.displayName = "TableCell";
|
|
82
|
+
|
|
83
|
+
export { Table, TableHeader, TableBody, TableHead, TableRow, TableCell };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const Textarea = React.forwardRef(({ className, ...props }, ref) => {
|
|
5
|
+
return (_jsx("textarea", { className: cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", className), ref: ref, ...props }));
|
|
6
|
+
});
|
|
7
|
+
Textarea.displayName = "Textarea";
|
|
8
|
+
export { Textarea };
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { cn } from "../../lib/utils.
|
|
3
|
-
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
|
|
4
|
+
export interface TextareaProps
|
|
5
|
+
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> { }
|
|
6
|
+
|
|
7
|
+
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
4
8
|
({ className, ...props }, ref) => {
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
className: cn(
|
|
9
|
+
return (
|
|
10
|
+
<textarea
|
|
11
|
+
className={cn(
|
|
9
12
|
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
10
|
-
className
|
|
11
|
-
)
|
|
12
|
-
ref
|
|
13
|
-
...props
|
|
14
|
-
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
ref={ref}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
15
18
|
);
|
|
16
|
-
}
|
|
19
|
+
},
|
|
17
20
|
);
|
|
18
21
|
Textarea.displayName = "Textarea";
|
|
22
|
+
|
|
19
23
|
export { Textarea };
|
package/src/index.d.ts
ADDED