@yimingliao/cms 0.0.86 → 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.
@@ -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 };
@@ -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 * as class_variance_authority_types from 'class-variance-authority/types';
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,40 +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
- declare function Button$1({ className, variant, size, asChild, ...props }: ButtonProps$1): react_jsx_runtime.JSX.Element;
360
-
361
- declare function Card({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
362
- declare function CardHeader({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
363
- declare function CardTitle({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
364
- declare function CardDescription({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
365
- declare function CardAction({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
366
- declare function CardContent({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
367
- declare function CardFooter({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
368
-
369
- declare function InputGroup({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
370
- declare const inputGroupAddonVariants: (props?: ({
371
- align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
372
- } & class_variance_authority_types.ClassProp) | undefined) => string;
373
- declare function InputGroupAddon({ className, align, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): react_jsx_runtime.JSX.Element;
374
- declare const inputGroupButtonVariants: (props?: ({
375
- size?: "sm" | "icon-sm" | "xs" | "icon-xs" | null | undefined;
376
- } & class_variance_authority_types.ClassProp) | undefined) => string;
377
- declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React$1.ComponentProps<typeof Button$1>, "size"> & VariantProps<typeof inputGroupButtonVariants>): react_jsx_runtime.JSX.Element;
378
- declare function InputGroupText({ className, ...props }: React$1.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
379
- declare function InputGroupInput({ className, ...props }: React$1.ComponentProps<"input">): react_jsx_runtime.JSX.Element;
380
- declare function InputGroupTextarea({ className, ...props }: React$1.ComponentProps<"textarea">): react_jsx_runtime.JSX.Element;
381
-
382
- declare function Spinner({ className, ...props }: ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
383
-
384
- declare function Textarea({ className, ...props }: React$1.ComponentProps<"textarea">): react_jsx_runtime.JSX.Element;
385
-
386
353
  interface ButtonProps extends ButtonProps$1, UIStates {
387
354
  icon?: LucideIcon;
388
355
  href?: string;
@@ -398,4 +365,4 @@ declare const cn: (...inputs: ClassValue[]) => string;
398
365
 
399
366
  declare function useDeviceInfo(): DeviceInfo | null;
400
367
 
401
- export { AdminProvider, Button, type ButtonProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Form, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputProps, type ShowToastOption, Spinner, Textarea, cn, createAdminInitializer, createRequestInterceptor, createResponseInterceptor, createSmartFetch, createUseCommand, createUseQuery, handleToast, useAdmin, useDeviceInfo };
368
+ export { AdminProvider, Button, type ButtonProps, Form, Input, type InputProps, type ShowToastOption, cn, createAdminInitializer, createRequestInterceptor, createResponseInterceptor, createSmartFetch, createUseCommand, createUseQuery, handleToast, useAdmin, useDeviceInfo };
@@ -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 React6 from 'react';
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,314 +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 Card({ className, ...props }) {
329
- return /* @__PURE__ */ jsx(
330
- "div",
331
- {
332
- "data-slot": "card",
333
- className: cn(
334
- "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
335
- className
336
- ),
337
- ...props
338
- }
339
- );
340
- }
341
- function CardHeader({ className, ...props }) {
342
- return /* @__PURE__ */ jsx(
343
- "div",
344
- {
345
- "data-slot": "card-header",
346
- className: cn(
347
- "@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",
348
- className
349
- ),
350
- ...props
351
- }
352
- );
353
- }
354
- function CardTitle({ className, ...props }) {
355
- return /* @__PURE__ */ jsx(
356
- "div",
357
- {
358
- "data-slot": "card-title",
359
- className: cn("leading-none font-semibold", className),
360
- ...props
361
- }
362
- );
363
- }
364
- function CardDescription({ className, ...props }) {
365
- return /* @__PURE__ */ jsx(
366
- "div",
367
- {
368
- "data-slot": "card-description",
369
- className: cn("text-muted-foreground text-sm", className),
370
- ...props
371
- }
372
- );
373
- }
374
- function CardAction({ className, ...props }) {
375
- return /* @__PURE__ */ jsx(
376
- "div",
377
- {
378
- "data-slot": "card-action",
379
- className: cn(
380
- "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
381
- className
382
- ),
383
- ...props
384
- }
385
- );
386
- }
387
- function CardContent({ className, ...props }) {
388
- return /* @__PURE__ */ jsx(
389
- "div",
390
- {
391
- "data-slot": "card-content",
392
- className: cn("px-6", className),
393
- ...props
394
- }
395
- );
396
- }
397
- function CardFooter({ className, ...props }) {
398
- return /* @__PURE__ */ jsx(
399
- "div",
400
- {
401
- "data-slot": "card-footer",
402
- className: cn("flex items-center px-6 [.border-t]:pt-6", className),
403
- ...props
404
- }
405
- );
406
- }
407
- function Input({ className, type, ...props }) {
408
- return /* @__PURE__ */ jsx(
409
- "input",
410
- {
411
- type,
412
- "data-slot": "input",
413
- className: cn(
414
- "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",
415
- "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
416
- "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
417
- className
418
- ),
419
- ...props
420
- }
421
- );
422
- }
423
- function Textarea({ className, ...props }) {
424
- return /* @__PURE__ */ jsx(
425
- "textarea",
426
- {
427
- "data-slot": "textarea",
428
- className: cn(
429
- // "min-h-16",
430
- // "field-sizing-content",
431
- "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",
432
- className
433
- ),
434
- ...props
435
- }
436
- );
437
- }
438
- function InputGroup({ className, ...props }) {
439
- return /* @__PURE__ */ jsx(
440
- "div",
441
- {
442
- "data-slot": "input-group",
443
- role: "group",
444
- className: cn(
445
- "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",
446
- "h-9 min-w-0 has-[>textarea]:h-auto",
447
- // Variants based on alignment.
448
- "has-[>[data-align=inline-start]]:[&>input]:pl-2",
449
- "has-[>[data-align=inline-end]]:[&>input]:pr-2",
450
- "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
451
- "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
452
- // Focus state.
453
- "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]",
454
- // Error state.
455
- "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",
456
- className
457
- ),
458
- ...props
459
- }
460
- );
461
- }
462
- var inputGroupAddonVariants = cva(
463
- "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",
464
- {
465
- variants: {
466
- align: {
467
- "inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
468
- "inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
469
- "block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
470
- "block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"
471
- }
472
- },
473
- defaultVariants: {
474
- align: "inline-start"
475
- }
476
- }
477
- );
478
- function InputGroupAddon({
479
- className,
480
- align = "inline-start",
481
- ...props
482
- }) {
483
- return /* @__PURE__ */ jsx(
484
- "div",
485
- {
486
- role: "group",
487
- "data-slot": "input-group-addon",
488
- "data-align": align,
489
- className: cn(inputGroupAddonVariants({ align }), className),
490
- onClick: (e) => {
491
- if (e.target.closest("button")) {
492
- return;
493
- }
494
- e.currentTarget.parentElement?.querySelector("input")?.focus();
495
- },
496
- ...props
497
- }
498
- );
499
- }
500
- var inputGroupButtonVariants = cva(
501
- "text-sm shadow-none flex gap-2 items-center",
502
- {
503
- variants: {
504
- size: {
505
- xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
506
- sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
507
- "icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
508
- "icon-sm": "size-8 p-0 has-[>svg]:p-0"
509
- }
510
- },
511
- defaultVariants: {
512
- size: "xs"
513
- }
514
- }
515
- );
516
- function InputGroupButton({
517
- className,
518
- type = "button",
519
- variant = "ghost",
520
- size = "xs",
521
- ...props
522
- }) {
523
- return /* @__PURE__ */ jsx(
524
- Button,
525
- {
526
- type,
527
- "data-size": size,
528
- variant,
529
- className: cn(inputGroupButtonVariants({ size }), className),
530
- ...props
531
- }
532
- );
533
- }
534
- function InputGroupText({ className, ...props }) {
535
- return /* @__PURE__ */ jsx(
536
- "span",
537
- {
538
- className: cn(
539
- "text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
540
- className
541
- ),
542
- ...props
543
- }
544
- );
545
- }
546
- function InputGroupInput({
547
- className,
548
- ...props
549
- }) {
550
- return /* @__PURE__ */ jsx(
551
- Input,
552
- {
553
- "data-slot": "input-group-control",
554
- className: cn(
555
- "flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
556
- className
557
- ),
558
- ...props
559
- }
560
- );
561
- }
562
- function InputGroupTextarea({
563
- className,
564
- ...props
565
- }) {
566
- return /* @__PURE__ */ jsx(
567
- Textarea,
568
- {
569
- "data-slot": "input-group-control",
570
- className: cn(
571
- "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
572
- className
573
- ),
574
- ...props
575
- }
576
- );
577
- }
578
- function Spinner({ className, ...props }) {
579
- return /* @__PURE__ */ jsx(
580
- Loader2Icon,
581
- {
582
- role: "status",
583
- "aria-label": "Loading",
584
- className: cn("size-4 animate-spin", className),
585
- ...props
586
- }
587
- );
588
- }
589
253
  function Button2({
590
254
  icon,
591
255
  href,
@@ -614,13 +278,13 @@ function Button2({
614
278
  onClick: props.onClick ?? handleClick,
615
279
  ...props,
616
280
  children: isLoading ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
617
- icon && React6.createElement(icon),
281
+ icon && React.createElement(icon),
618
282
  children
619
283
  ] })
620
284
  }
621
285
  );
622
286
  }
623
- function Input2({
287
+ function Input({
624
288
  // form context
625
289
  fieldName,
626
290
  setFormData,
@@ -649,4 +313,4 @@ function Input2({
649
313
  ] });
650
314
  }
651
315
 
652
- export { AdminProvider, Button2 as Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Form, Input2 as Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Spinner, Textarea, cn, createAdminInitializer, createRequestInterceptor, createResponseInterceptor, createSmartFetch, createUseCommand, createUseQuery, handleToast, useAdmin, useDeviceInfo };
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.86",
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",