@arch-cadre/blog-module 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.cjs +158 -0
- package/dist/actions/index.d.ts +34 -0
- package/dist/actions/index.mjs +121 -0
- package/dist/components/ui/button.cjs +53 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.mjs +44 -0
- package/dist/components/ui/card.cjs +46 -0
- package/dist/components/ui/card.d.ts +6 -0
- package/dist/components/ui/card.mjs +35 -0
- package/dist/components/ui/input.cjs +23 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/input.mjs +20 -0
- package/dist/components/ui/table.cjs +66 -0
- package/dist/components/ui/table.d.ts +8 -0
- package/dist/components/ui/table.mjs +59 -0
- package/dist/components/ui/textarea.cjs +21 -0
- package/dist/components/ui/textarea.d.ts +5 -0
- package/dist/components/ui/textarea.mjs +19 -0
- package/dist/index.cjs +37 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +30 -0
- package/dist/intl.d.ts +7 -0
- package/dist/lib/utils.cjs +11 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.mjs +5 -0
- package/dist/lib/validation.cjs +16 -0
- package/dist/lib/validation.d.ts +24 -0
- package/dist/lib/validation.mjs +10 -0
- package/dist/navigation.cjs +21 -0
- package/dist/navigation.d.ts +2 -0
- package/dist/navigation.mjs +19 -0
- package/dist/routes.cjs +70 -0
- package/dist/routes.d.ts +3 -0
- package/dist/routes.mjs +64 -0
- package/dist/schema.cjs +62 -0
- package/dist/schema.d.ts +0 -0
- package/dist/schema.mjs +53 -0
- package/dist/styles/globals.css +1 -0
- package/dist/ui/views.cjs +448 -0
- package/dist/ui/views.d.ts +16 -0
- package/dist/ui/views.mjs +232 -0
- package/locales/en/global.json +36 -0
- package/manifest.json +11 -0
- package/package.json +62 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use server";
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createComment = createComment;
|
|
8
|
+
exports.createPost = createPost;
|
|
9
|
+
exports.deletePost = deletePost;
|
|
10
|
+
exports.getComments = getComments;
|
|
11
|
+
exports.getPostById = getPostById;
|
|
12
|
+
exports.getPostBySlug = getPostBySlug;
|
|
13
|
+
exports.getPosts = getPosts;
|
|
14
|
+
exports.updatePost = updatePost;
|
|
15
|
+
var _server = require("@arch-cadre/core/server");
|
|
16
|
+
var _drizzleOrm = require("drizzle-orm");
|
|
17
|
+
var _cache = require("next/cache");
|
|
18
|
+
var _validation = require("../lib/validation.cjs");
|
|
19
|
+
var _schema = require("../schema.cjs");
|
|
20
|
+
async function createPost(data) {
|
|
21
|
+
try {
|
|
22
|
+
const {
|
|
23
|
+
user
|
|
24
|
+
} = await (0, _server.getCurrentSession)();
|
|
25
|
+
if (!user) throw new Error("Unauthorized");
|
|
26
|
+
const validated = _validation.postSchema.parse(data);
|
|
27
|
+
await _server.db.insert(_schema.postsTable).values({
|
|
28
|
+
...validated,
|
|
29
|
+
authorId: user.id
|
|
30
|
+
});
|
|
31
|
+
(0, _cache.revalidatePath)("/blog");
|
|
32
|
+
return {
|
|
33
|
+
success: true
|
|
34
|
+
};
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error("[BlogModule:Actions] createPost failed:", error);
|
|
37
|
+
return {
|
|
38
|
+
success: false,
|
|
39
|
+
error: error.message
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function getPosts() {
|
|
44
|
+
try {
|
|
45
|
+
return await _server.db.select({
|
|
46
|
+
id: _schema.postsTable.id,
|
|
47
|
+
title: _schema.postsTable.title,
|
|
48
|
+
slug: _schema.postsTable.slug,
|
|
49
|
+
content: _schema.postsTable.content,
|
|
50
|
+
createdAt: _schema.postsTable.createdAt,
|
|
51
|
+
author: {
|
|
52
|
+
name: _server.userTable.name
|
|
53
|
+
}
|
|
54
|
+
}).from(_schema.postsTable).innerJoin(_server.userTable, (0, _drizzleOrm.eq)(_schema.postsTable.authorId, _server.userTable.id)).orderBy((0, _drizzleOrm.desc)(_schema.postsTable.createdAt));
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error("[BlogModule:Actions] getPosts failed:", error);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function getPostBySlug(slug) {
|
|
61
|
+
try {
|
|
62
|
+
const [post] = await _server.db.select({
|
|
63
|
+
id: _schema.postsTable.id,
|
|
64
|
+
title: _schema.postsTable.title,
|
|
65
|
+
slug: _schema.postsTable.slug,
|
|
66
|
+
content: _schema.postsTable.content,
|
|
67
|
+
createdAt: _schema.postsTable.createdAt,
|
|
68
|
+
author: {
|
|
69
|
+
name: _server.userTable.name
|
|
70
|
+
}
|
|
71
|
+
}).from(_schema.postsTable).innerJoin(_server.userTable, (0, _drizzleOrm.eq)(_schema.postsTable.authorId, _server.userTable.id)).where((0, _drizzleOrm.eq)(_schema.postsTable.slug, slug));
|
|
72
|
+
return post || null;
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error("[BlogModule:Actions] getPostBySlug failed:", error);
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async function getPostById(id) {
|
|
79
|
+
try {
|
|
80
|
+
const [post] = await _server.db.select().from(_schema.postsTable).where((0, _drizzleOrm.eq)(_schema.postsTable.id, id));
|
|
81
|
+
return post || null;
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error("[BlogModule:Actions] getPostById failed:", error);
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async function getComments(postId) {
|
|
88
|
+
try {
|
|
89
|
+
return await _server.db.select({
|
|
90
|
+
id: _schema.commentsTable.id,
|
|
91
|
+
content: _schema.commentsTable.content,
|
|
92
|
+
createdAt: _schema.commentsTable.createdAt,
|
|
93
|
+
author: {
|
|
94
|
+
name: _server.userTable.name,
|
|
95
|
+
image: _server.userTable.image
|
|
96
|
+
}
|
|
97
|
+
}).from(_schema.commentsTable).innerJoin(_server.userTable, (0, _drizzleOrm.eq)(_schema.commentsTable.authorId, _server.userTable.id)).where((0, _drizzleOrm.eq)(_schema.commentsTable.postId, postId)).orderBy((0, _drizzleOrm.desc)(_schema.commentsTable.createdAt));
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.error("[BlogModule:Actions] getComments failed:", error);
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async function createComment(data) {
|
|
104
|
+
try {
|
|
105
|
+
const {
|
|
106
|
+
user
|
|
107
|
+
} = await (0, _server.getCurrentSession)();
|
|
108
|
+
if (!user) throw new Error("Must be logged in to comment");
|
|
109
|
+
const validated = _validation.commentSchema.parse(data);
|
|
110
|
+
await _server.db.insert(_schema.commentsTable).values({
|
|
111
|
+
content: validated.content,
|
|
112
|
+
postId: validated.postId,
|
|
113
|
+
authorId: user.id
|
|
114
|
+
});
|
|
115
|
+
(0, _cache.revalidatePath)(`/blog`);
|
|
116
|
+
return {
|
|
117
|
+
success: true
|
|
118
|
+
};
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.error("[BlogModule:Actions] createComment failed:", error);
|
|
121
|
+
return {
|
|
122
|
+
success: false,
|
|
123
|
+
error: error.message
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async function deletePost(id) {
|
|
128
|
+
try {
|
|
129
|
+
await _server.db.delete(_schema.postsTable).where((0, _drizzleOrm.eq)(_schema.postsTable.id, id));
|
|
130
|
+
(0, _cache.revalidatePath)("/blog");
|
|
131
|
+
return {
|
|
132
|
+
success: true
|
|
133
|
+
};
|
|
134
|
+
} catch (error) {
|
|
135
|
+
console.error("[BlogModule:Actions] deletePost failed:", error);
|
|
136
|
+
return {
|
|
137
|
+
success: false,
|
|
138
|
+
error: error.message
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async function updatePost(id, data) {
|
|
143
|
+
try {
|
|
144
|
+
const validated = _validation.postSchema.parse(data);
|
|
145
|
+
await _server.db.update(_schema.postsTable).set(validated).where((0, _drizzleOrm.eq)(_schema.postsTable.id, id));
|
|
146
|
+
(0, _cache.revalidatePath)("/blog");
|
|
147
|
+
(0, _cache.revalidatePath)(`/blog/${validated.slug}`);
|
|
148
|
+
return {
|
|
149
|
+
success: true
|
|
150
|
+
};
|
|
151
|
+
} catch (error) {
|
|
152
|
+
console.error("[BlogModule:Actions] updatePost failed:", error);
|
|
153
|
+
return {
|
|
154
|
+
success: false,
|
|
155
|
+
error: error.message
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import { commentSchema, postSchema } from "../lib/validation";
|
|
3
|
+
export declare function createPost(data: z.infer<typeof postSchema>): Promise<{
|
|
4
|
+
success: boolean;
|
|
5
|
+
error?: undefined;
|
|
6
|
+
} | {
|
|
7
|
+
success: boolean;
|
|
8
|
+
error: any;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function getPosts(): Promise<any>;
|
|
11
|
+
export declare function getPostBySlug(slug: string): Promise<any>;
|
|
12
|
+
export declare function getPostById(id: string): Promise<any>;
|
|
13
|
+
export declare function getComments(postId: string): Promise<any>;
|
|
14
|
+
export declare function createComment(data: z.infer<typeof commentSchema>): Promise<{
|
|
15
|
+
success: boolean;
|
|
16
|
+
error?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
success: boolean;
|
|
19
|
+
error: any;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function deletePost(id: string): Promise<{
|
|
22
|
+
success: boolean;
|
|
23
|
+
error?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
success: boolean;
|
|
26
|
+
error: any;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function updatePost(id: string, data: z.infer<typeof postSchema>): Promise<{
|
|
29
|
+
success: boolean;
|
|
30
|
+
error?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
success: boolean;
|
|
33
|
+
error: any;
|
|
34
|
+
}>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { db, getCurrentSession, userTable } from "@arch-cadre/core/server";
|
|
3
|
+
import { desc, eq } from "drizzle-orm";
|
|
4
|
+
import { revalidatePath } from "next/cache";
|
|
5
|
+
import { commentSchema, postSchema } from "../lib/validation.mjs";
|
|
6
|
+
import { commentsTable, postsTable } from "../schema.mjs";
|
|
7
|
+
export async function createPost(data) {
|
|
8
|
+
try {
|
|
9
|
+
const { user } = await getCurrentSession();
|
|
10
|
+
if (!user) throw new Error("Unauthorized");
|
|
11
|
+
const validated = postSchema.parse(data);
|
|
12
|
+
await db.insert(postsTable).values({
|
|
13
|
+
...validated,
|
|
14
|
+
authorId: user.id
|
|
15
|
+
});
|
|
16
|
+
revalidatePath("/blog");
|
|
17
|
+
return { success: true };
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.error("[BlogModule:Actions] createPost failed:", error);
|
|
20
|
+
return { success: false, error: error.message };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export async function getPosts() {
|
|
24
|
+
try {
|
|
25
|
+
return await db.select({
|
|
26
|
+
id: postsTable.id,
|
|
27
|
+
title: postsTable.title,
|
|
28
|
+
slug: postsTable.slug,
|
|
29
|
+
content: postsTable.content,
|
|
30
|
+
createdAt: postsTable.createdAt,
|
|
31
|
+
author: {
|
|
32
|
+
name: userTable.name
|
|
33
|
+
}
|
|
34
|
+
}).from(postsTable).innerJoin(userTable, eq(postsTable.authorId, userTable.id)).orderBy(desc(postsTable.createdAt));
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error("[BlogModule:Actions] getPosts failed:", error);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export async function getPostBySlug(slug) {
|
|
41
|
+
try {
|
|
42
|
+
const [post] = await db.select({
|
|
43
|
+
id: postsTable.id,
|
|
44
|
+
title: postsTable.title,
|
|
45
|
+
slug: postsTable.slug,
|
|
46
|
+
content: postsTable.content,
|
|
47
|
+
createdAt: postsTable.createdAt,
|
|
48
|
+
author: {
|
|
49
|
+
name: userTable.name
|
|
50
|
+
}
|
|
51
|
+
}).from(postsTable).innerJoin(userTable, eq(postsTable.authorId, userTable.id)).where(eq(postsTable.slug, slug));
|
|
52
|
+
return post || null;
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.error("[BlogModule:Actions] getPostBySlug failed:", error);
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export async function getPostById(id) {
|
|
59
|
+
try {
|
|
60
|
+
const [post] = await db.select().from(postsTable).where(eq(postsTable.id, id));
|
|
61
|
+
return post || null;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error("[BlogModule:Actions] getPostById failed:", error);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export async function getComments(postId) {
|
|
68
|
+
try {
|
|
69
|
+
return await db.select({
|
|
70
|
+
id: commentsTable.id,
|
|
71
|
+
content: commentsTable.content,
|
|
72
|
+
createdAt: commentsTable.createdAt,
|
|
73
|
+
author: {
|
|
74
|
+
name: userTable.name,
|
|
75
|
+
image: userTable.image
|
|
76
|
+
}
|
|
77
|
+
}).from(commentsTable).innerJoin(userTable, eq(commentsTable.authorId, userTable.id)).where(eq(commentsTable.postId, postId)).orderBy(desc(commentsTable.createdAt));
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.error("[BlogModule:Actions] getComments failed:", error);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export async function createComment(data) {
|
|
84
|
+
try {
|
|
85
|
+
const { user } = await getCurrentSession();
|
|
86
|
+
if (!user) throw new Error("Must be logged in to comment");
|
|
87
|
+
const validated = commentSchema.parse(data);
|
|
88
|
+
await db.insert(commentsTable).values({
|
|
89
|
+
content: validated.content,
|
|
90
|
+
postId: validated.postId,
|
|
91
|
+
authorId: user.id
|
|
92
|
+
});
|
|
93
|
+
revalidatePath(`/blog`);
|
|
94
|
+
return { success: true };
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error("[BlogModule:Actions] createComment failed:", error);
|
|
97
|
+
return { success: false, error: error.message };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export async function deletePost(id) {
|
|
101
|
+
try {
|
|
102
|
+
await db.delete(postsTable).where(eq(postsTable.id, id));
|
|
103
|
+
revalidatePath("/blog");
|
|
104
|
+
return { success: true };
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.error("[BlogModule:Actions] deletePost failed:", error);
|
|
107
|
+
return { success: false, error: error.message };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export async function updatePost(id, data) {
|
|
111
|
+
try {
|
|
112
|
+
const validated = postSchema.parse(data);
|
|
113
|
+
await db.update(postsTable).set(validated).where(eq(postsTable.id, id));
|
|
114
|
+
revalidatePath("/blog");
|
|
115
|
+
revalidatePath(`/blog/${validated.slug}`);
|
|
116
|
+
return { success: true };
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error("[BlogModule:Actions] updatePost failed:", error);
|
|
119
|
+
return { success: false, error: error.message };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buttonVariants = exports.Button = void 0;
|
|
7
|
+
var _reactSlot = require("@radix-ui/react-slot");
|
|
8
|
+
var _classVarianceAuthority = require("class-variance-authority");
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _utils = require("../../lib/utils.cjs");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
const buttonVariants = exports.buttonVariants = (0, _classVarianceAuthority.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", {
|
|
14
|
+
variants: {
|
|
15
|
+
variant: {
|
|
16
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
17
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
18
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
19
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
20
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
21
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
default: "h-9 px-4 py-2",
|
|
25
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
26
|
+
lg: "h-10 rounded-md px-8",
|
|
27
|
+
icon: "size-9"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
variant: "default",
|
|
32
|
+
size: "default"
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const Button = exports.Button = React.forwardRef(({
|
|
36
|
+
className,
|
|
37
|
+
variant,
|
|
38
|
+
size,
|
|
39
|
+
asChild = false,
|
|
40
|
+
...props
|
|
41
|
+
}, ref) => {
|
|
42
|
+
const Comp = asChild ? _reactSlot.Slot : "button";
|
|
43
|
+
return /* @__PURE__ */React.createElement(Comp, {
|
|
44
|
+
className: (0, _utils.cn)(buttonVariants({
|
|
45
|
+
variant,
|
|
46
|
+
size,
|
|
47
|
+
className
|
|
48
|
+
})),
|
|
49
|
+
ref,
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
Button.displayName = "Button";
|
|
@@ -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/dist/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,44 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../lib/utils.mjs";
|
|
5
|
+
const buttonVariants = cva(
|
|
6
|
+
"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
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
11
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
12
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
13
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
14
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
15
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
default: "h-9 px-4 py-2",
|
|
19
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
20
|
+
lg: "h-10 rounded-md px-8",
|
|
21
|
+
icon: "size-9"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
variant: "default",
|
|
26
|
+
size: "default"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
const Button = React.forwardRef(
|
|
31
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
32
|
+
const Comp = asChild ? Slot : "button";
|
|
33
|
+
return /* @__PURE__ */ React.createElement(
|
|
34
|
+
Comp,
|
|
35
|
+
{
|
|
36
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
37
|
+
ref,
|
|
38
|
+
...props
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
Button.displayName = "Button";
|
|
44
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CardTitle = exports.CardHeader = exports.CardContent = exports.Card = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _utils = require("../../lib/utils.cjs");
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
const Card = exports.Card = React.forwardRef(({
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}, ref) => /* @__PURE__ */React.createElement("div", {
|
|
15
|
+
ref,
|
|
16
|
+
className: (0, _utils.cn)("rounded-xl border bg-card text-card-foreground shadow", className),
|
|
17
|
+
...props
|
|
18
|
+
}));
|
|
19
|
+
Card.displayName = "Card";
|
|
20
|
+
const CardHeader = exports.CardHeader = React.forwardRef(({
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}, ref) => /* @__PURE__ */React.createElement("div", {
|
|
24
|
+
ref,
|
|
25
|
+
className: (0, _utils.cn)("flex flex-col space-y-1.5 p-6", className),
|
|
26
|
+
...props
|
|
27
|
+
}));
|
|
28
|
+
CardHeader.displayName = "CardHeader";
|
|
29
|
+
const CardTitle = exports.CardTitle = React.forwardRef(({
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}, ref) => /* @__PURE__ */React.createElement("div", {
|
|
33
|
+
ref,
|
|
34
|
+
className: (0, _utils.cn)("font-semibold leading-none tracking-tight", className),
|
|
35
|
+
...props
|
|
36
|
+
}));
|
|
37
|
+
CardTitle.displayName = "CardTitle";
|
|
38
|
+
const CardContent = exports.CardContent = React.forwardRef(({
|
|
39
|
+
className,
|
|
40
|
+
...props
|
|
41
|
+
}, ref) => /* @__PURE__ */React.createElement("div", {
|
|
42
|
+
ref,
|
|
43
|
+
className: (0, _utils.cn)("p-6 pt-0", className),
|
|
44
|
+
...props
|
|
45
|
+
}));
|
|
46
|
+
CardContent.displayName = "CardContent";
|
|
@@ -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,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.mjs";
|
|
3
|
+
const Card = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
4
|
+
"div",
|
|
5
|
+
{
|
|
6
|
+
ref,
|
|
7
|
+
className: cn(
|
|
8
|
+
"rounded-xl border bg-card text-card-foreground shadow",
|
|
9
|
+
className
|
|
10
|
+
),
|
|
11
|
+
...props
|
|
12
|
+
}
|
|
13
|
+
));
|
|
14
|
+
Card.displayName = "Card";
|
|
15
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
ref,
|
|
19
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
20
|
+
...props
|
|
21
|
+
}
|
|
22
|
+
));
|
|
23
|
+
CardHeader.displayName = "CardHeader";
|
|
24
|
+
const CardTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
ref,
|
|
28
|
+
className: cn("font-semibold leading-none tracking-tight", className),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
));
|
|
32
|
+
CardTitle.displayName = "CardTitle";
|
|
33
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement("div", { ref, className: cn("p-6 pt-0", className), ...props }));
|
|
34
|
+
CardContent.displayName = "CardContent";
|
|
35
|
+
export { Card, CardHeader, CardTitle, CardContent };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _utils = require("../../lib/utils.cjs");
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
const Input = exports.Input = React.forwardRef(({
|
|
12
|
+
className,
|
|
13
|
+
type,
|
|
14
|
+
...props
|
|
15
|
+
}, ref) => {
|
|
16
|
+
return /* @__PURE__ */React.createElement("input", {
|
|
17
|
+
type,
|
|
18
|
+
className: (0, _utils.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),
|
|
19
|
+
ref,
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
Input.displayName = "Input";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.mjs";
|
|
3
|
+
const Input = React.forwardRef(
|
|
4
|
+
({ className, type, ...props }, ref) => {
|
|
5
|
+
return /* @__PURE__ */ React.createElement(
|
|
6
|
+
"input",
|
|
7
|
+
{
|
|
8
|
+
type,
|
|
9
|
+
className: cn(
|
|
10
|
+
"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
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
Input.displayName = "Input";
|
|
20
|
+
export { Input };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TableRow = exports.TableHeader = exports.TableHead = exports.TableCell = exports.TableBody = exports.Table = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _utils = require("../../lib/utils.cjs");
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
const Table = exports.Table = React.forwardRef(({
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}, ref) => /* @__PURE__ */React.createElement("div", {
|
|
15
|
+
className: "relative w-full overflow-auto"
|
|
16
|
+
}, /* @__PURE__ */React.createElement("table", {
|
|
17
|
+
ref,
|
|
18
|
+
className: (0, _utils.cn)("w-full caption-bottom text-sm", className),
|
|
19
|
+
...props
|
|
20
|
+
})));
|
|
21
|
+
Table.displayName = "Table";
|
|
22
|
+
const TableHeader = exports.TableHeader = React.forwardRef(({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}, ref) => /* @__PURE__ */React.createElement("thead", {
|
|
26
|
+
ref,
|
|
27
|
+
className: (0, _utils.cn)("[&_tr]:border-b", className),
|
|
28
|
+
...props
|
|
29
|
+
}));
|
|
30
|
+
TableHeader.displayName = "TableHeader";
|
|
31
|
+
const TableBody = exports.TableBody = React.forwardRef(({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}, ref) => /* @__PURE__ */React.createElement("tbody", {
|
|
35
|
+
ref,
|
|
36
|
+
className: (0, _utils.cn)("[&_tr:last-child]:border-0", className),
|
|
37
|
+
...props
|
|
38
|
+
}));
|
|
39
|
+
TableBody.displayName = "TableBody";
|
|
40
|
+
const TableRow = exports.TableRow = React.forwardRef(({
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}, ref) => /* @__PURE__ */React.createElement("tr", {
|
|
44
|
+
ref,
|
|
45
|
+
className: (0, _utils.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
46
|
+
...props
|
|
47
|
+
}));
|
|
48
|
+
TableRow.displayName = "TableRow";
|
|
49
|
+
const TableHead = exports.TableHead = React.forwardRef(({
|
|
50
|
+
className,
|
|
51
|
+
...props
|
|
52
|
+
}, ref) => /* @__PURE__ */React.createElement("th", {
|
|
53
|
+
ref,
|
|
54
|
+
className: (0, _utils.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),
|
|
55
|
+
...props
|
|
56
|
+
}));
|
|
57
|
+
TableHead.displayName = "TableHead";
|
|
58
|
+
const TableCell = exports.TableCell = React.forwardRef(({
|
|
59
|
+
className,
|
|
60
|
+
...props
|
|
61
|
+
}, ref) => /* @__PURE__ */React.createElement("td", {
|
|
62
|
+
ref,
|
|
63
|
+
className: (0, _utils.cn)("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
64
|
+
...props
|
|
65
|
+
}));
|
|
66
|
+
TableCell.displayName = "TableCell";
|
|
@@ -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 };
|