@xk2800/nextjs-template 0.7.2-beta.4 → 0.7.2-beta.6
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/components/ui/dialog.tsx +46 -13
- package/components/ui/drawer.tsx +88 -0
- package/dist/activity/queries.d.mts +1 -1
- package/dist/activity/queries.d.ts +1 -1
- package/dist/auth/index.d.mts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/db/index.d.mts +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/schema.d.mts +1 -1
- package/dist/db/schema.d.ts +1 -1
- package/dist/{schema-DzC5zdOq.d.mts → schema-BPvJz0PE.d.mts} +1 -1
- package/dist/{schema-DzC5zdOq.d.ts → schema-BPvJz0PE.d.ts} +1 -1
- package/dist/settings/queries.d.mts +1 -1
- package/dist/settings/queries.d.ts +1 -1
- package/package.json +2 -1
package/components/ui/dialog.tsx
CHANGED
|
@@ -3,39 +3,57 @@
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { Dialog as DialogPrimitive } from "radix-ui"
|
|
5
5
|
import { XIcon } from "lucide-react"
|
|
6
|
+
import { Drawer } from "vaul"
|
|
6
7
|
|
|
8
|
+
import { useIsMobile } from "../../hooks/use-mobile"
|
|
7
9
|
import { cn } from "../../lib/utils"
|
|
8
10
|
|
|
11
|
+
// Below 768px (useIsMobile) the dialog renders as a vaul drawer: bottom sheet with a
|
|
12
|
+
// grab handle and swipe-down-to-dismiss. vaul has its own Radix instance, so every
|
|
13
|
+
// part must come from the same primitive set; the root picks it and shares it via context.
|
|
14
|
+
const MobileContext = React.createContext(false)
|
|
15
|
+
const usePrimitive = () => (React.useContext(MobileContext) ? Drawer : DialogPrimitive)
|
|
16
|
+
|
|
9
17
|
function Dialog({
|
|
10
18
|
...props
|
|
11
19
|
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
12
|
-
|
|
20
|
+
const isMobile = useIsMobile()
|
|
21
|
+
const Root = isMobile ? Drawer.Root : DialogPrimitive.Root
|
|
22
|
+
return (
|
|
23
|
+
<MobileContext.Provider value={isMobile}>
|
|
24
|
+
<Root data-slot="dialog" {...props} />
|
|
25
|
+
</MobileContext.Provider>
|
|
26
|
+
)
|
|
13
27
|
}
|
|
14
28
|
|
|
15
29
|
function DialogTrigger({
|
|
16
30
|
...props
|
|
17
31
|
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
18
|
-
|
|
32
|
+
const P = usePrimitive()
|
|
33
|
+
return <P.Trigger data-slot="dialog-trigger" {...props} />
|
|
19
34
|
}
|
|
20
35
|
|
|
21
36
|
function DialogPortal({
|
|
22
37
|
...props
|
|
23
38
|
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
24
|
-
|
|
39
|
+
const P = usePrimitive()
|
|
40
|
+
return <P.Portal data-slot="dialog-portal" {...props} />
|
|
25
41
|
}
|
|
26
42
|
|
|
27
43
|
function DialogClose({
|
|
28
44
|
...props
|
|
29
45
|
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
30
|
-
|
|
46
|
+
const P = usePrimitive()
|
|
47
|
+
return <P.Close data-slot="dialog-close" {...props} />
|
|
31
48
|
}
|
|
32
49
|
|
|
33
50
|
function DialogOverlay({
|
|
34
51
|
className,
|
|
35
52
|
...props
|
|
36
53
|
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
54
|
+
const P = usePrimitive()
|
|
37
55
|
return (
|
|
38
|
-
<
|
|
56
|
+
<P.Overlay
|
|
39
57
|
data-slot="dialog-overlay"
|
|
40
58
|
className={cn(
|
|
41
59
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
@@ -54,28 +72,41 @@ function DialogContent({
|
|
|
54
72
|
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
55
73
|
showCloseButton?: boolean
|
|
56
74
|
}) {
|
|
75
|
+
const isMobile = React.useContext(MobileContext)
|
|
76
|
+
const P = usePrimitive()
|
|
57
77
|
return (
|
|
58
78
|
<DialogPortal data-slot="dialog-portal">
|
|
59
79
|
<DialogOverlay />
|
|
60
|
-
<
|
|
80
|
+
<P.Content
|
|
61
81
|
data-slot="dialog-content"
|
|
62
82
|
className={cn(
|
|
63
|
-
"bg-background
|
|
83
|
+
"bg-background fixed z-50 grid gap-4 border-(length:--surface-border-width) border-(--surface-border-color) p-6 shadow-(--dialog-shadow)",
|
|
84
|
+
isMobile
|
|
85
|
+
? "flex flex-col inset-x-0 bottom-0 max-h-[90dvh] rounded-t-xl pb-[max(1.5rem,env(safe-area-inset-bottom))]"
|
|
86
|
+
: "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 top-[50%] left-[50%] max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] overflow-y-auto translate-x-[-50%] translate-y-[-50%] rounded-lg duration-200 sm:max-w-lg",
|
|
64
87
|
className
|
|
65
88
|
)}
|
|
66
89
|
{...props}
|
|
67
90
|
>
|
|
68
|
-
{
|
|
91
|
+
{isMobile && (
|
|
92
|
+
<div aria-hidden className="bg-muted-foreground/30 mx-auto -mt-2 h-1.5 w-12 shrink-0 rounded-full" />
|
|
93
|
+
)}
|
|
94
|
+
{isMobile ? (
|
|
95
|
+
// Only this wrapper scrolls, and only when the content is taller than the drawer.
|
|
96
|
+
<div className="grid min-h-0 gap-4 overflow-y-auto overscroll-contain">{children}</div>
|
|
97
|
+
) : (
|
|
98
|
+
children
|
|
99
|
+
)}
|
|
69
100
|
{showCloseButton && (
|
|
70
|
-
<
|
|
101
|
+
<P.Close
|
|
71
102
|
data-slot="dialog-close"
|
|
72
103
|
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
73
104
|
>
|
|
74
105
|
<XIcon />
|
|
75
106
|
<span className="sr-only">Close</span>
|
|
76
|
-
</
|
|
107
|
+
</P.Close>
|
|
77
108
|
)}
|
|
78
|
-
</
|
|
109
|
+
</P.Content>
|
|
79
110
|
</DialogPortal>
|
|
80
111
|
)
|
|
81
112
|
}
|
|
@@ -107,8 +138,9 @@ function DialogTitle({
|
|
|
107
138
|
className,
|
|
108
139
|
...props
|
|
109
140
|
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
141
|
+
const P = usePrimitive()
|
|
110
142
|
return (
|
|
111
|
-
<
|
|
143
|
+
<P.Title
|
|
112
144
|
data-slot="dialog-title"
|
|
113
145
|
className={cn("text-lg leading-none font-semibold", className)}
|
|
114
146
|
{...props}
|
|
@@ -120,8 +152,9 @@ function DialogDescription({
|
|
|
120
152
|
className,
|
|
121
153
|
...props
|
|
122
154
|
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
155
|
+
const P = usePrimitive()
|
|
123
156
|
return (
|
|
124
|
-
<
|
|
157
|
+
<P.Description
|
|
125
158
|
data-slot="dialog-description"
|
|
126
159
|
className={cn("text-muted-foreground text-sm", className)}
|
|
127
160
|
{...props}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Drawer as DrawerPrimitive } from "vaul"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
|
|
8
|
+
function Drawer({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
9
|
+
return <DrawerPrimitive.Root data-slot="drawer" {...props} />
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function DrawerTrigger({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
13
|
+
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function DrawerPortal({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
17
|
+
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function DrawerClose({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
21
|
+
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function DrawerOverlay({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
|
|
25
|
+
return (
|
|
26
|
+
<DrawerPrimitive.Overlay
|
|
27
|
+
data-slot="drawer-overlay"
|
|
28
|
+
className={cn("fixed inset-0 z-50 bg-black/50", className)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Bottom sheet by default; pass direction="top|left|right" on <Drawer> for other edges.
|
|
35
|
+
function DrawerContent({ className, children, ...props }: React.ComponentProps<typeof DrawerPrimitive.Content>) {
|
|
36
|
+
return (
|
|
37
|
+
<DrawerPortal>
|
|
38
|
+
<DrawerOverlay />
|
|
39
|
+
<DrawerPrimitive.Content
|
|
40
|
+
data-slot="drawer-content"
|
|
41
|
+
className={cn(
|
|
42
|
+
"group/drawer-content bg-background fixed z-50 flex h-auto flex-col border-(length:--surface-border-width) border-(--surface-border-color)",
|
|
43
|
+
"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[90dvh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:pb-[env(safe-area-inset-bottom)]",
|
|
44
|
+
"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[90dvh] data-[vaul-drawer-direction=top]:rounded-b-xl",
|
|
45
|
+
"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
46
|
+
"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:sm:max-w-sm",
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
>
|
|
51
|
+
<div
|
|
52
|
+
aria-hidden
|
|
53
|
+
className="bg-muted-foreground/30 mx-auto mt-4 hidden h-1.5 w-12 shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"
|
|
54
|
+
/>
|
|
55
|
+
{children}
|
|
56
|
+
</DrawerPrimitive.Content>
|
|
57
|
+
</DrawerPortal>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
62
|
+
return <div data-slot="drawer-header" className={cn("flex flex-col gap-1.5 p-4", className)} {...props} />
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
66
|
+
return <div data-slot="drawer-footer" className={cn("mt-auto flex flex-col gap-2 p-4", className)} {...props} />
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function DrawerTitle({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
70
|
+
return <DrawerPrimitive.Title data-slot="drawer-title" className={cn("text-foreground font-semibold", className)} {...props} />
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function DrawerDescription({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
|
|
74
|
+
return <DrawerPrimitive.Description data-slot="drawer-description" className={cn("text-muted-foreground text-sm", className)} {...props} />
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
Drawer,
|
|
79
|
+
DrawerClose,
|
|
80
|
+
DrawerContent,
|
|
81
|
+
DrawerDescription,
|
|
82
|
+
DrawerFooter,
|
|
83
|
+
DrawerHeader,
|
|
84
|
+
DrawerOverlay,
|
|
85
|
+
DrawerPortal,
|
|
86
|
+
DrawerTitle,
|
|
87
|
+
DrawerTrigger,
|
|
88
|
+
}
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -970,7 +970,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
|
|
|
970
970
|
$Infer: {
|
|
971
971
|
body: {
|
|
972
972
|
permissions: {
|
|
973
|
-
readonly user?: ("
|
|
973
|
+
readonly user?: ("create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
974
974
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
975
975
|
};
|
|
976
976
|
} & {
|
|
@@ -3307,7 +3307,7 @@ declare const auth: better_auth.Auth<{
|
|
|
3307
3307
|
$Infer: {
|
|
3308
3308
|
body: {
|
|
3309
3309
|
permissions: {
|
|
3310
|
-
readonly user?: ("
|
|
3310
|
+
readonly user?: ("create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
3311
3311
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
3312
3312
|
};
|
|
3313
3313
|
} & {
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -970,7 +970,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
|
|
|
970
970
|
$Infer: {
|
|
971
971
|
body: {
|
|
972
972
|
permissions: {
|
|
973
|
-
readonly user?: ("
|
|
973
|
+
readonly user?: ("create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
974
974
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
975
975
|
};
|
|
976
976
|
} & {
|
|
@@ -3307,7 +3307,7 @@ declare const auth: better_auth.Auth<{
|
|
|
3307
3307
|
$Infer: {
|
|
3308
3308
|
body: {
|
|
3309
3309
|
permissions: {
|
|
3310
|
-
readonly user?: ("
|
|
3310
|
+
readonly user?: ("create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
3311
3311
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
3312
3312
|
};
|
|
3313
3313
|
} & {
|
package/dist/db/index.d.mts
CHANGED
package/dist/db/index.d.ts
CHANGED
package/dist/db/schema.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'drizzle-orm';
|
|
2
2
|
import 'drizzle-orm/pg-core';
|
|
3
|
-
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as pushSubscriptions, i as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-
|
|
3
|
+
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as pushSubscriptions, i as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-BPvJz0PE.mjs';
|
package/dist/db/schema.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'drizzle-orm';
|
|
2
2
|
import 'drizzle-orm/pg-core';
|
|
3
|
-
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as pushSubscriptions, i as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-
|
|
3
|
+
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as pushSubscriptions, i as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-BPvJz0PE.js';
|
|
@@ -1159,7 +1159,7 @@ declare const activityLogs: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1159
1159
|
tableName: "activity_log";
|
|
1160
1160
|
dataType: "string";
|
|
1161
1161
|
columnType: "PgEnumColumn";
|
|
1162
|
-
data: "
|
|
1162
|
+
data: "login_failed" | "login" | "logout" | "password_changed" | "email_changed" | "profile_updated" | "session_revoked" | "user_deleted" | "user_banned" | "user_unbanned" | "role_changed" | "impersonation_started" | "impersonation_stopped" | "settings_changed" | "passkey_added" | "passkey_removed";
|
|
1163
1163
|
driverParam: string;
|
|
1164
1164
|
notNull: true;
|
|
1165
1165
|
hasDefault: false;
|
|
@@ -1159,7 +1159,7 @@ declare const activityLogs: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1159
1159
|
tableName: "activity_log";
|
|
1160
1160
|
dataType: "string";
|
|
1161
1161
|
columnType: "PgEnumColumn";
|
|
1162
|
-
data: "
|
|
1162
|
+
data: "login_failed" | "login" | "logout" | "password_changed" | "email_changed" | "profile_updated" | "session_revoked" | "user_deleted" | "user_banned" | "user_unbanned" | "role_changed" | "impersonation_started" | "impersonation_stopped" | "settings_changed" | "passkey_added" | "passkey_removed";
|
|
1163
1163
|
driverParam: string;
|
|
1164
1164
|
notNull: true;
|
|
1165
1165
|
hasDefault: false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xk2800/nextjs-template",
|
|
3
|
-
"version": "0.7.2-beta.
|
|
3
|
+
"version": "0.7.2-beta.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -361,6 +361,7 @@
|
|
|
361
361
|
"resend": "^6.4.2",
|
|
362
362
|
"server-only": "^0.0.1",
|
|
363
363
|
"ua-parser-js": "2.0.10",
|
|
364
|
+
"vaul": "^1.1.2",
|
|
364
365
|
"web-push": "^3.6.7",
|
|
365
366
|
"zod": "^4.6.5"
|
|
366
367
|
},
|