@yimingliao/cms 0.0.85 → 0.0.87
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/button-DsjdULEG.d.ts +15 -0
- package/dist/chunk-MYQZGULX.js +344 -0
- package/dist/client/index.d.ts +4 -15
- package/dist/client/index.js +6 -259
- package/dist/client/shadcn/index.d.ts +36 -0
- package/dist/client/shadcn/index.js +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
declare const buttonVariants: (props?: ({
|
|
7
|
+
variant?: "link" | "default" | "success" | "destructive" | "outline" | "secondary" | "ghost" | "warning" | null | undefined;
|
|
8
|
+
size?: "lg" | "sm" | "default" | "icon" | "icon-sm" | "icon-lg" | "xs" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
type ButtonProps = React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare function Button({ className, variant, size, asChild, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { type ButtonProps as B, Button as a };
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { UAParser } from 'ua-parser-js';
|
|
5
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
6
|
+
import { cva } from 'class-variance-authority';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
import { Loader2Icon } from 'lucide-react';
|
|
9
|
+
|
|
10
|
+
// src/client/applications/ui/utils.ts
|
|
11
|
+
var cn = (...inputs) => {
|
|
12
|
+
return twMerge(clsx(inputs));
|
|
13
|
+
};
|
|
14
|
+
function useDeviceInfo() {
|
|
15
|
+
const [deviceInfo, setDeviceInfo] = useState(null);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const parser = new UAParser(navigator.userAgent);
|
|
18
|
+
const result = parser.getResult();
|
|
19
|
+
setDeviceInfo({
|
|
20
|
+
deviceType: result.device.type || "desktop",
|
|
21
|
+
platform: result.os.name || "Unknown",
|
|
22
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
23
|
+
language: navigator.language,
|
|
24
|
+
screenResolution: {
|
|
25
|
+
width: window.screen.width,
|
|
26
|
+
height: window.screen.height
|
|
27
|
+
},
|
|
28
|
+
browser: result.browser.name || "Unknown",
|
|
29
|
+
browserVersion: result.browser.version || "",
|
|
30
|
+
userAgent: navigator.userAgent
|
|
31
|
+
});
|
|
32
|
+
}, []);
|
|
33
|
+
return deviceInfo;
|
|
34
|
+
}
|
|
35
|
+
var buttonVariants = cva(
|
|
36
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
37
|
+
{
|
|
38
|
+
variants: {
|
|
39
|
+
variant: {
|
|
40
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
41
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
42
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
43
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
44
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
45
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
46
|
+
success: "bg-success text-white hover:bg-success/90 focus-visible:ring-success/20 dark:focus-visible:ring-success/40 dark:bg-success/60",
|
|
47
|
+
warning: "bg-warning text-white hover:bg-warning/90 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40 dark:bg-warning/60"
|
|
48
|
+
},
|
|
49
|
+
size: {
|
|
50
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
51
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
52
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
53
|
+
icon: "size-9",
|
|
54
|
+
"icon-sm": "size-8",
|
|
55
|
+
"icon-lg": "size-10",
|
|
56
|
+
xs: "h-7 rounded-md px-2 text-xs has-[>svg]:px-2 gap-1"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
variant: "default",
|
|
61
|
+
size: "default"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
function Button({
|
|
66
|
+
className,
|
|
67
|
+
variant,
|
|
68
|
+
size,
|
|
69
|
+
asChild = false,
|
|
70
|
+
...props
|
|
71
|
+
}) {
|
|
72
|
+
const Comp = asChild ? Slot : "button";
|
|
73
|
+
return /* @__PURE__ */ jsx(
|
|
74
|
+
Comp,
|
|
75
|
+
{
|
|
76
|
+
"data-slot": "button",
|
|
77
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
78
|
+
...props
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
function Card({ className, ...props }) {
|
|
83
|
+
return /* @__PURE__ */ jsx(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
"data-slot": "card",
|
|
87
|
+
className: cn(
|
|
88
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
89
|
+
className
|
|
90
|
+
),
|
|
91
|
+
...props
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function CardHeader({ className, ...props }) {
|
|
96
|
+
return /* @__PURE__ */ jsx(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
"data-slot": "card-header",
|
|
100
|
+
className: cn(
|
|
101
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
102
|
+
className
|
|
103
|
+
),
|
|
104
|
+
...props
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
function CardTitle({ className, ...props }) {
|
|
109
|
+
return /* @__PURE__ */ jsx(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
"data-slot": "card-title",
|
|
113
|
+
className: cn("leading-none font-semibold", className),
|
|
114
|
+
...props
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function CardDescription({ className, ...props }) {
|
|
119
|
+
return /* @__PURE__ */ jsx(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
"data-slot": "card-description",
|
|
123
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
124
|
+
...props
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function CardAction({ className, ...props }) {
|
|
129
|
+
return /* @__PURE__ */ jsx(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
"data-slot": "card-action",
|
|
133
|
+
className: cn(
|
|
134
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
135
|
+
className
|
|
136
|
+
),
|
|
137
|
+
...props
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
function CardContent({ className, ...props }) {
|
|
142
|
+
return /* @__PURE__ */ jsx(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
"data-slot": "card-content",
|
|
146
|
+
className: cn("px-6", className),
|
|
147
|
+
...props
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
function CardFooter({ className, ...props }) {
|
|
152
|
+
return /* @__PURE__ */ jsx(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
"data-slot": "card-footer",
|
|
156
|
+
className: cn("flex items-center px-6 [.border-t]:pt-6", className),
|
|
157
|
+
...props
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function Input({ className, type, ...props }) {
|
|
162
|
+
return /* @__PURE__ */ jsx(
|
|
163
|
+
"input",
|
|
164
|
+
{
|
|
165
|
+
type,
|
|
166
|
+
"data-slot": "input",
|
|
167
|
+
className: cn(
|
|
168
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
169
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
170
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
171
|
+
className
|
|
172
|
+
),
|
|
173
|
+
...props
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
function Textarea({ className, ...props }) {
|
|
178
|
+
return /* @__PURE__ */ jsx(
|
|
179
|
+
"textarea",
|
|
180
|
+
{
|
|
181
|
+
"data-slot": "textarea",
|
|
182
|
+
className: cn(
|
|
183
|
+
// "min-h-16",
|
|
184
|
+
// "field-sizing-content",
|
|
185
|
+
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
186
|
+
className
|
|
187
|
+
),
|
|
188
|
+
...props
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
function InputGroup({ className, ...props }) {
|
|
193
|
+
return /* @__PURE__ */ jsx(
|
|
194
|
+
"div",
|
|
195
|
+
{
|
|
196
|
+
"data-slot": "input-group",
|
|
197
|
+
role: "group",
|
|
198
|
+
className: cn(
|
|
199
|
+
"group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none",
|
|
200
|
+
"h-9 min-w-0 has-[>textarea]:h-auto",
|
|
201
|
+
// Variants based on alignment.
|
|
202
|
+
"has-[>[data-align=inline-start]]:[&>input]:pl-2",
|
|
203
|
+
"has-[>[data-align=inline-end]]:[&>input]:pr-2",
|
|
204
|
+
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
|
|
205
|
+
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
|
|
206
|
+
// Focus state.
|
|
207
|
+
"has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]",
|
|
208
|
+
// Error state.
|
|
209
|
+
"has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
|
|
210
|
+
className
|
|
211
|
+
),
|
|
212
|
+
...props
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
var inputGroupAddonVariants = cva(
|
|
217
|
+
"text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",
|
|
218
|
+
{
|
|
219
|
+
variants: {
|
|
220
|
+
align: {
|
|
221
|
+
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
222
|
+
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
223
|
+
"block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
|
|
224
|
+
"block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
defaultVariants: {
|
|
228
|
+
align: "inline-start"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
function InputGroupAddon({
|
|
233
|
+
className,
|
|
234
|
+
align = "inline-start",
|
|
235
|
+
...props
|
|
236
|
+
}) {
|
|
237
|
+
return /* @__PURE__ */ jsx(
|
|
238
|
+
"div",
|
|
239
|
+
{
|
|
240
|
+
role: "group",
|
|
241
|
+
"data-slot": "input-group-addon",
|
|
242
|
+
"data-align": align,
|
|
243
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
244
|
+
onClick: (e) => {
|
|
245
|
+
if (e.target.closest("button")) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
249
|
+
},
|
|
250
|
+
...props
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
var inputGroupButtonVariants = cva(
|
|
255
|
+
"text-sm shadow-none flex gap-2 items-center",
|
|
256
|
+
{
|
|
257
|
+
variants: {
|
|
258
|
+
size: {
|
|
259
|
+
xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
|
|
260
|
+
sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
|
|
261
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
262
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
defaultVariants: {
|
|
266
|
+
size: "xs"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
function InputGroupButton({
|
|
271
|
+
className,
|
|
272
|
+
type = "button",
|
|
273
|
+
variant = "ghost",
|
|
274
|
+
size = "xs",
|
|
275
|
+
...props
|
|
276
|
+
}) {
|
|
277
|
+
return /* @__PURE__ */ jsx(
|
|
278
|
+
Button,
|
|
279
|
+
{
|
|
280
|
+
type,
|
|
281
|
+
"data-size": size,
|
|
282
|
+
variant,
|
|
283
|
+
className: cn(inputGroupButtonVariants({ size }), className),
|
|
284
|
+
...props
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
function InputGroupText({ className, ...props }) {
|
|
289
|
+
return /* @__PURE__ */ jsx(
|
|
290
|
+
"span",
|
|
291
|
+
{
|
|
292
|
+
className: cn(
|
|
293
|
+
"text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
294
|
+
className
|
|
295
|
+
),
|
|
296
|
+
...props
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
function InputGroupInput({
|
|
301
|
+
className,
|
|
302
|
+
...props
|
|
303
|
+
}) {
|
|
304
|
+
return /* @__PURE__ */ jsx(
|
|
305
|
+
Input,
|
|
306
|
+
{
|
|
307
|
+
"data-slot": "input-group-control",
|
|
308
|
+
className: cn(
|
|
309
|
+
"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
310
|
+
className
|
|
311
|
+
),
|
|
312
|
+
...props
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
function InputGroupTextarea({
|
|
317
|
+
className,
|
|
318
|
+
...props
|
|
319
|
+
}) {
|
|
320
|
+
return /* @__PURE__ */ jsx(
|
|
321
|
+
Textarea,
|
|
322
|
+
{
|
|
323
|
+
"data-slot": "input-group-control",
|
|
324
|
+
className: cn(
|
|
325
|
+
"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
326
|
+
className
|
|
327
|
+
),
|
|
328
|
+
...props
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
function Spinner({ className, ...props }) {
|
|
333
|
+
return /* @__PURE__ */ jsx(
|
|
334
|
+
Loader2Icon,
|
|
335
|
+
{
|
|
336
|
+
role: "status",
|
|
337
|
+
"aria-label": "Loading",
|
|
338
|
+
className: cn("size-4 animate-spin", className),
|
|
339
|
+
...props
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export { Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Spinner, Textarea, cn, useDeviceInfo };
|
package/dist/client/index.d.ts
CHANGED
|
@@ -8,8 +8,7 @@ import { c as createVerifyAction } from '../create-verify-action-DBwWOXPO.js';
|
|
|
8
8
|
import * as React$1 from 'react';
|
|
9
9
|
import { ComponentProps } from 'react';
|
|
10
10
|
import { LucideIcon } from 'lucide-react';
|
|
11
|
-
import
|
|
12
|
-
import { VariantProps } from 'class-variance-authority';
|
|
11
|
+
import { B as ButtonProps$1 } from '../button-DsjdULEG.js';
|
|
13
12
|
import { ClassValue } from 'clsx';
|
|
14
13
|
import '../types-J25u1G6t.js';
|
|
15
14
|
import '../types-0oS1A2K5.js';
|
|
@@ -22,6 +21,8 @@ import 'nodemailer';
|
|
|
22
21
|
import 'intor';
|
|
23
22
|
import 'keyv';
|
|
24
23
|
import 'zod/v4/core';
|
|
24
|
+
import 'class-variance-authority/types';
|
|
25
|
+
import 'class-variance-authority';
|
|
25
26
|
|
|
26
27
|
interface UIStates {
|
|
27
28
|
isLoading?: boolean;
|
|
@@ -349,14 +350,6 @@ declare function createAdminInitializer({ useAdmin, useQuery, verifyAction, }: {
|
|
|
349
350
|
|
|
350
351
|
declare function Form({ onSubmit, className, ...props }: ComponentProps<"form">): react_jsx_runtime.JSX.Element;
|
|
351
352
|
|
|
352
|
-
declare const buttonVariants: (props?: ({
|
|
353
|
-
variant?: "link" | "default" | "success" | "destructive" | "outline" | "secondary" | "ghost" | "warning" | null | undefined;
|
|
354
|
-
size?: "lg" | "sm" | "default" | "icon" | "icon-sm" | "icon-lg" | "xs" | null | undefined;
|
|
355
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
356
|
-
type ButtonProps$1 = React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
357
|
-
asChild?: boolean;
|
|
358
|
-
};
|
|
359
|
-
|
|
360
353
|
interface ButtonProps extends ButtonProps$1, UIStates {
|
|
361
354
|
icon?: LucideIcon;
|
|
362
355
|
href?: string;
|
|
@@ -368,12 +361,8 @@ interface InputProps<T = Record<string, unknown>> extends ComponentProps<"input"
|
|
|
368
361
|
}
|
|
369
362
|
declare function Input<T>({ fieldName, setFormData, isLoading, isDisabled, isError, children, ...props }: InputProps<T>): react_jsx_runtime.JSX.Element;
|
|
370
363
|
|
|
371
|
-
declare function AuthForm({ title, children, className, ...props }: ComponentProps<"form"> & {
|
|
372
|
-
title: string;
|
|
373
|
-
}): react_jsx_runtime.JSX.Element;
|
|
374
|
-
|
|
375
364
|
declare const cn: (...inputs: ClassValue[]) => string;
|
|
376
365
|
|
|
377
366
|
declare function useDeviceInfo(): DeviceInfo | null;
|
|
378
367
|
|
|
379
|
-
export { AdminProvider,
|
|
368
|
+
export { AdminProvider, Button, type ButtonProps, Form, Input, type InputProps, type ShowToastOption, cn, createAdminInitializer, createRequestInterceptor, createResponseInterceptor, createSmartFetch, createUseCommand, createUseQuery, handleToast, useAdmin, useDeviceInfo };
|
package/dist/client/index.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
+
import { cn, Button, Spinner, InputGroup, InputGroupAddon, InputGroupInput } from '../chunk-MYQZGULX.js';
|
|
2
|
+
export { cn, useDeviceInfo } from '../chunk-MYQZGULX.js';
|
|
1
3
|
import { ensureArray } from '../chunk-OAENV763.js';
|
|
2
4
|
import { toast } from 'sonner';
|
|
3
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
6
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
5
|
-
import * as
|
|
7
|
+
import * as React from 'react';
|
|
6
8
|
import { createContext, useState, useContext, useEffect } from 'react';
|
|
7
|
-
import { clsx } from 'clsx';
|
|
8
|
-
import { twMerge } from 'tailwind-merge';
|
|
9
|
-
import { UAParser } from 'ua-parser-js';
|
|
10
9
|
import { useRouter } from 'next/navigation';
|
|
11
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
12
|
-
import { cva } from 'class-variance-authority';
|
|
13
|
-
import { Loader2Icon } from 'lucide-react';
|
|
14
10
|
|
|
15
11
|
// src/client/infrastructure/fetch/smart-fetch.ts
|
|
16
12
|
function createSmartFetch({
|
|
@@ -242,30 +238,6 @@ function createAdminInitializer({
|
|
|
242
238
|
return null;
|
|
243
239
|
};
|
|
244
240
|
}
|
|
245
|
-
var cn = (...inputs) => {
|
|
246
|
-
return twMerge(clsx(inputs));
|
|
247
|
-
};
|
|
248
|
-
function useDeviceInfo() {
|
|
249
|
-
const [deviceInfo, setDeviceInfo] = useState(null);
|
|
250
|
-
useEffect(() => {
|
|
251
|
-
const parser = new UAParser(navigator.userAgent);
|
|
252
|
-
const result = parser.getResult();
|
|
253
|
-
setDeviceInfo({
|
|
254
|
-
deviceType: result.device.type || "desktop",
|
|
255
|
-
platform: result.os.name || "Unknown",
|
|
256
|
-
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
257
|
-
language: navigator.language,
|
|
258
|
-
screenResolution: {
|
|
259
|
-
width: window.screen.width,
|
|
260
|
-
height: window.screen.height
|
|
261
|
-
},
|
|
262
|
-
browser: result.browser.name || "Unknown",
|
|
263
|
-
browserVersion: result.browser.version || "",
|
|
264
|
-
userAgent: navigator.userAgent
|
|
265
|
-
});
|
|
266
|
-
}, []);
|
|
267
|
-
return deviceInfo;
|
|
268
|
-
}
|
|
269
241
|
function Form({
|
|
270
242
|
onSubmit,
|
|
271
243
|
className,
|
|
@@ -278,64 +250,6 @@ function Form({
|
|
|
278
250
|
};
|
|
279
251
|
return /* @__PURE__ */ jsx("form", { className: cn(className), onSubmit: handleSubmit, ...props });
|
|
280
252
|
}
|
|
281
|
-
var buttonVariants = cva(
|
|
282
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
283
|
-
{
|
|
284
|
-
variants: {
|
|
285
|
-
variant: {
|
|
286
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
287
|
-
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
288
|
-
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
289
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
290
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
291
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
292
|
-
success: "bg-success text-white hover:bg-success/90 focus-visible:ring-success/20 dark:focus-visible:ring-success/40 dark:bg-success/60",
|
|
293
|
-
warning: "bg-warning text-white hover:bg-warning/90 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40 dark:bg-warning/60"
|
|
294
|
-
},
|
|
295
|
-
size: {
|
|
296
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
297
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
298
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
299
|
-
icon: "size-9",
|
|
300
|
-
"icon-sm": "size-8",
|
|
301
|
-
"icon-lg": "size-10",
|
|
302
|
-
xs: "h-7 rounded-md px-2 text-xs has-[>svg]:px-2 gap-1"
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
defaultVariants: {
|
|
306
|
-
variant: "default",
|
|
307
|
-
size: "default"
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
);
|
|
311
|
-
function Button({
|
|
312
|
-
className,
|
|
313
|
-
variant,
|
|
314
|
-
size,
|
|
315
|
-
asChild = false,
|
|
316
|
-
...props
|
|
317
|
-
}) {
|
|
318
|
-
const Comp = asChild ? Slot : "button";
|
|
319
|
-
return /* @__PURE__ */ jsx(
|
|
320
|
-
Comp,
|
|
321
|
-
{
|
|
322
|
-
"data-slot": "button",
|
|
323
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
324
|
-
...props
|
|
325
|
-
}
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
function Spinner({ className, ...props }) {
|
|
329
|
-
return /* @__PURE__ */ jsx(
|
|
330
|
-
Loader2Icon,
|
|
331
|
-
{
|
|
332
|
-
role: "status",
|
|
333
|
-
"aria-label": "Loading",
|
|
334
|
-
className: cn("size-4 animate-spin", className),
|
|
335
|
-
...props
|
|
336
|
-
}
|
|
337
|
-
);
|
|
338
|
-
}
|
|
339
253
|
function Button2({
|
|
340
254
|
icon,
|
|
341
255
|
href,
|
|
@@ -364,123 +278,13 @@ function Button2({
|
|
|
364
278
|
onClick: props.onClick ?? handleClick,
|
|
365
279
|
...props,
|
|
366
280
|
children: isLoading ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
367
|
-
icon &&
|
|
281
|
+
icon && React.createElement(icon),
|
|
368
282
|
children
|
|
369
283
|
] })
|
|
370
284
|
}
|
|
371
285
|
);
|
|
372
286
|
}
|
|
373
|
-
function Input({
|
|
374
|
-
return /* @__PURE__ */ jsx(
|
|
375
|
-
"input",
|
|
376
|
-
{
|
|
377
|
-
type,
|
|
378
|
-
"data-slot": "input",
|
|
379
|
-
className: cn(
|
|
380
|
-
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
381
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
382
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
383
|
-
className
|
|
384
|
-
),
|
|
385
|
-
...props
|
|
386
|
-
}
|
|
387
|
-
);
|
|
388
|
-
}
|
|
389
|
-
function InputGroup({ className, ...props }) {
|
|
390
|
-
return /* @__PURE__ */ jsx(
|
|
391
|
-
"div",
|
|
392
|
-
{
|
|
393
|
-
"data-slot": "input-group",
|
|
394
|
-
role: "group",
|
|
395
|
-
className: cn(
|
|
396
|
-
"group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none",
|
|
397
|
-
"h-9 min-w-0 has-[>textarea]:h-auto",
|
|
398
|
-
// Variants based on alignment.
|
|
399
|
-
"has-[>[data-align=inline-start]]:[&>input]:pl-2",
|
|
400
|
-
"has-[>[data-align=inline-end]]:[&>input]:pr-2",
|
|
401
|
-
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
|
|
402
|
-
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
|
|
403
|
-
// Focus state.
|
|
404
|
-
"has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]",
|
|
405
|
-
// Error state.
|
|
406
|
-
"has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
|
|
407
|
-
className
|
|
408
|
-
),
|
|
409
|
-
...props
|
|
410
|
-
}
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
|
-
var inputGroupAddonVariants = cva(
|
|
414
|
-
"text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",
|
|
415
|
-
{
|
|
416
|
-
variants: {
|
|
417
|
-
align: {
|
|
418
|
-
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
419
|
-
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
420
|
-
"block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
|
|
421
|
-
"block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
defaultVariants: {
|
|
425
|
-
align: "inline-start"
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
);
|
|
429
|
-
function InputGroupAddon({
|
|
430
|
-
className,
|
|
431
|
-
align = "inline-start",
|
|
432
|
-
...props
|
|
433
|
-
}) {
|
|
434
|
-
return /* @__PURE__ */ jsx(
|
|
435
|
-
"div",
|
|
436
|
-
{
|
|
437
|
-
role: "group",
|
|
438
|
-
"data-slot": "input-group-addon",
|
|
439
|
-
"data-align": align,
|
|
440
|
-
className: cn(inputGroupAddonVariants({ align }), className),
|
|
441
|
-
onClick: (e) => {
|
|
442
|
-
if (e.target.closest("button")) {
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
446
|
-
},
|
|
447
|
-
...props
|
|
448
|
-
}
|
|
449
|
-
);
|
|
450
|
-
}
|
|
451
|
-
cva(
|
|
452
|
-
"text-sm shadow-none flex gap-2 items-center",
|
|
453
|
-
{
|
|
454
|
-
variants: {
|
|
455
|
-
size: {
|
|
456
|
-
xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
|
|
457
|
-
sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
|
|
458
|
-
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
459
|
-
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
460
|
-
}
|
|
461
|
-
},
|
|
462
|
-
defaultVariants: {
|
|
463
|
-
size: "xs"
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
);
|
|
467
|
-
function InputGroupInput({
|
|
468
|
-
className,
|
|
469
|
-
...props
|
|
470
|
-
}) {
|
|
471
|
-
return /* @__PURE__ */ jsx(
|
|
472
|
-
Input,
|
|
473
|
-
{
|
|
474
|
-
"data-slot": "input-group-control",
|
|
475
|
-
className: cn(
|
|
476
|
-
"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
477
|
-
className
|
|
478
|
-
),
|
|
479
|
-
...props
|
|
480
|
-
}
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
|
-
function Input2({
|
|
287
|
+
function Input({
|
|
484
288
|
// form context
|
|
485
289
|
fieldName,
|
|
486
290
|
setFormData,
|
|
@@ -508,62 +312,5 @@ function Input2({
|
|
|
508
312
|
children
|
|
509
313
|
] });
|
|
510
314
|
}
|
|
511
|
-
function Card({ className, ...props }) {
|
|
512
|
-
return /* @__PURE__ */ jsx(
|
|
513
|
-
"div",
|
|
514
|
-
{
|
|
515
|
-
"data-slot": "card",
|
|
516
|
-
className: cn(
|
|
517
|
-
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
518
|
-
className
|
|
519
|
-
),
|
|
520
|
-
...props
|
|
521
|
-
}
|
|
522
|
-
);
|
|
523
|
-
}
|
|
524
|
-
function CardHeader({ className, ...props }) {
|
|
525
|
-
return /* @__PURE__ */ jsx(
|
|
526
|
-
"div",
|
|
527
|
-
{
|
|
528
|
-
"data-slot": "card-header",
|
|
529
|
-
className: cn(
|
|
530
|
-
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
531
|
-
className
|
|
532
|
-
),
|
|
533
|
-
...props
|
|
534
|
-
}
|
|
535
|
-
);
|
|
536
|
-
}
|
|
537
|
-
function CardTitle({ className, ...props }) {
|
|
538
|
-
return /* @__PURE__ */ jsx(
|
|
539
|
-
"div",
|
|
540
|
-
{
|
|
541
|
-
"data-slot": "card-title",
|
|
542
|
-
className: cn("leading-none font-semibold", className),
|
|
543
|
-
...props
|
|
544
|
-
}
|
|
545
|
-
);
|
|
546
|
-
}
|
|
547
|
-
function CardContent({ className, ...props }) {
|
|
548
|
-
return /* @__PURE__ */ jsx(
|
|
549
|
-
"div",
|
|
550
|
-
{
|
|
551
|
-
"data-slot": "card-content",
|
|
552
|
-
className: cn("px-6", className),
|
|
553
|
-
...props
|
|
554
|
-
}
|
|
555
|
-
);
|
|
556
|
-
}
|
|
557
|
-
function AuthForm({
|
|
558
|
-
title,
|
|
559
|
-
children,
|
|
560
|
-
className,
|
|
561
|
-
...props
|
|
562
|
-
}) {
|
|
563
|
-
return /* @__PURE__ */ jsx(Form, { className: cn("mx-auto mt-20 w-96", className), ...props, children: /* @__PURE__ */ jsxs(Card, { children: [
|
|
564
|
-
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "mx-auto", children: title }) }),
|
|
565
|
-
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "relative flex flex-col gap-6", children }) })
|
|
566
|
-
] }) });
|
|
567
|
-
}
|
|
568
315
|
|
|
569
|
-
export { AdminProvider,
|
|
316
|
+
export { AdminProvider, Button2 as Button, Form, Input, createAdminInitializer, createRequestInterceptor, createResponseInterceptor, createSmartFetch, createUseCommand, createUseQuery, handleToast, useAdmin };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { a as Button } from '../../button-DsjdULEG.js';
|
|
2
|
+
export { B as ButtonProps } from '../../button-DsjdULEG.js';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ComponentProps } from 'react';
|
|
6
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
|
+
import { VariantProps } from 'class-variance-authority';
|
|
8
|
+
|
|
9
|
+
declare function Card({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
10
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
11
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
12
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
13
|
+
declare function CardAction({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
14
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
15
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
16
|
+
|
|
17
|
+
declare function Input({ className, type, ...props }: React.ComponentProps<"input">): react_jsx_runtime.JSX.Element;
|
|
18
|
+
|
|
19
|
+
declare function InputGroup({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
20
|
+
declare const inputGroupAddonVariants: (props?: ({
|
|
21
|
+
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
22
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
23
|
+
declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare const inputGroupButtonVariants: (props?: ({
|
|
25
|
+
size?: "sm" | "icon-sm" | "xs" | "icon-xs" | null | undefined;
|
|
26
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
27
|
+
declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React.ComponentProps<typeof Button>, "size"> & VariantProps<typeof inputGroupButtonVariants>): react_jsx_runtime.JSX.Element;
|
|
28
|
+
declare function InputGroupText({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
|
|
29
|
+
declare function InputGroupInput({ className, ...props }: React.ComponentProps<"input">): react_jsx_runtime.JSX.Element;
|
|
30
|
+
declare function InputGroupTextarea({ className, ...props }: React.ComponentProps<"textarea">): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
declare function Spinner({ className, ...props }: ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
|
|
33
|
+
|
|
34
|
+
declare function Textarea({ className, ...props }: React.ComponentProps<"textarea">): react_jsx_runtime.JSX.Element;
|
|
35
|
+
|
|
36
|
+
export { Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Spinner, Textarea };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Spinner, Textarea } from '../../chunk-MYQZGULX.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yimingliao/cms",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.87",
|
|
4
4
|
"author": "Yiming Liao",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"import": "./dist/client/index.js",
|
|
16
16
|
"require": "./dist/client/index.js"
|
|
17
17
|
},
|
|
18
|
+
"./client/shadcn": {
|
|
19
|
+
"types": "./dist/client/shadcn/index.d.ts",
|
|
20
|
+
"import": "./dist/client/shadcn/index.js",
|
|
21
|
+
"require": "./dist/client/shadcn/index.js"
|
|
22
|
+
},
|
|
18
23
|
"./server": {
|
|
19
24
|
"types": "./dist/server/index.d.ts",
|
|
20
25
|
"import": "./dist/server/index.js",
|