@xk2800/nextjs-template 0.7.1-beta.0 → 0.7.1-beta.2
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/file-upload.tsx +27 -6
- 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-BNSBWNjK.d.mts → schema-UuqxoOzS.d.mts} +1 -1
- package/dist/{schema-BNSBWNjK.d.ts → schema-UuqxoOzS.d.ts} +1 -1
- package/dist/settings/queries.d.mts +1 -1
- package/dist/settings/queries.d.ts +1 -1
- package/package.json +1 -1
|
@@ -23,6 +23,14 @@ type FileUploadProps = {
|
|
|
23
23
|
icon?: React.ReactNode
|
|
24
24
|
/** Drop zone text. Defaults to "Drag and drop files here" (or "a file" when `multiple` is false). */
|
|
25
25
|
label?: React.ReactNode
|
|
26
|
+
/** Smaller sub text under the drop zone label. */
|
|
27
|
+
description?: React.ReactNode
|
|
28
|
+
/** Extra classes for the dashed drop zone box. */
|
|
29
|
+
dropzoneClassName?: string
|
|
30
|
+
/** Extra classes for the label text. */
|
|
31
|
+
labelClassName?: string
|
|
32
|
+
/** Extra classes for the description text. */
|
|
33
|
+
descriptionClassName?: string
|
|
26
34
|
onFilesChange?: (files: File[]) => void
|
|
27
35
|
className?: string
|
|
28
36
|
}
|
|
@@ -48,6 +56,10 @@ function FileUpload({
|
|
|
48
56
|
disabled = false,
|
|
49
57
|
icon = <Upload className="size-6" />,
|
|
50
58
|
label,
|
|
59
|
+
description,
|
|
60
|
+
dropzoneClassName,
|
|
61
|
+
labelClassName,
|
|
62
|
+
descriptionClassName,
|
|
51
63
|
onFilesChange,
|
|
52
64
|
className,
|
|
53
65
|
}: FileUploadProps) {
|
|
@@ -57,11 +69,15 @@ function FileUpload({
|
|
|
57
69
|
const cameraRef = React.useRef<HTMLInputElement>(null)
|
|
58
70
|
const galleryRef = React.useRef<HTMLInputElement>(null)
|
|
59
71
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
)
|
|
64
|
-
|
|
72
|
+
// Created and revoked in the same effect: with useMemo, Strict Mode's
|
|
73
|
+
// simulated unmount revoked the URLs and the remount reused the dead ones.
|
|
74
|
+
const [previews, setPreviews] = React.useState<(string | null)[]>([])
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
const urls = files.map((f) => (f.type.startsWith("image/") ? URL.createObjectURL(f) : null))
|
|
77
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect -- object URLs must be created where they're revoked
|
|
78
|
+
setPreviews(urls)
|
|
79
|
+
return () => urls.forEach((url) => url && URL.revokeObjectURL(url))
|
|
80
|
+
}, [files])
|
|
65
81
|
|
|
66
82
|
const update = (next: File[]) => {
|
|
67
83
|
setFiles(next)
|
|
@@ -135,12 +151,17 @@ function FileUpload({
|
|
|
135
151
|
aria-disabled={disabled}
|
|
136
152
|
className={cn(
|
|
137
153
|
"flex flex-col items-center gap-3 rounded-lg border-2 border-dashed p-6 text-center text-sm text-muted-foreground transition-colors",
|
|
154
|
+
// Before the state classes so a custom border can't hide the drag highlight.
|
|
155
|
+
dropzoneClassName,
|
|
138
156
|
dragging && "border-primary bg-primary/5",
|
|
139
157
|
disabled && "opacity-50"
|
|
140
158
|
)}
|
|
141
159
|
>
|
|
142
160
|
{icon}
|
|
143
|
-
<
|
|
161
|
+
<div className="space-y-1">
|
|
162
|
+
<p className={labelClassName}>{label ?? `Drag and drop ${multiple ? "files" : "a file"} here`}</p>
|
|
163
|
+
{description && <p className={cn("text-xs", descriptionClassName)}>{description}</p>}
|
|
164
|
+
</div>
|
|
144
165
|
{buttons}
|
|
145
166
|
</div>
|
|
146
167
|
) : (
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -891,7 +891,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
|
|
|
891
891
|
$Infer: {
|
|
892
892
|
body: {
|
|
893
893
|
permissions: {
|
|
894
|
-
readonly user?: ("
|
|
894
|
+
readonly user?: ("delete" | "update" | "list" | "set-role" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
895
895
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
896
896
|
};
|
|
897
897
|
} & {
|
|
@@ -3175,7 +3175,7 @@ declare const auth: better_auth.Auth<{
|
|
|
3175
3175
|
$Infer: {
|
|
3176
3176
|
body: {
|
|
3177
3177
|
permissions: {
|
|
3178
|
-
readonly user?: ("
|
|
3178
|
+
readonly user?: ("delete" | "update" | "list" | "set-role" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
3179
3179
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
3180
3180
|
};
|
|
3181
3181
|
} & {
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -891,7 +891,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
|
|
|
891
891
|
$Infer: {
|
|
892
892
|
body: {
|
|
893
893
|
permissions: {
|
|
894
|
-
readonly user?: ("
|
|
894
|
+
readonly user?: ("delete" | "update" | "list" | "set-role" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
895
895
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
896
896
|
};
|
|
897
897
|
} & {
|
|
@@ -3175,7 +3175,7 @@ declare const auth: better_auth.Auth<{
|
|
|
3175
3175
|
$Infer: {
|
|
3176
3176
|
body: {
|
|
3177
3177
|
permissions: {
|
|
3178
|
-
readonly user?: ("
|
|
3178
|
+
readonly user?: ("delete" | "update" | "list" | "set-role" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
3179
3179
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
3180
3180
|
};
|
|
3181
3181
|
} & {
|
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 deviceFingerprints, f as errorRefs, p as passkeys, g 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 deviceFingerprints, f as errorRefs, p as passkeys, g as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-UuqxoOzS.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 deviceFingerprints, f as errorRefs, p as passkeys, g 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 deviceFingerprints, f as errorRefs, p as passkeys, g as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-UuqxoOzS.js';
|
|
@@ -1142,7 +1142,7 @@ declare const activityLogs: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1142
1142
|
tableName: "activity_log";
|
|
1143
1143
|
dataType: "string";
|
|
1144
1144
|
columnType: "PgEnumColumn";
|
|
1145
|
-
data: "
|
|
1145
|
+
data: "login" | "logout" | "login_failed" | "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";
|
|
1146
1146
|
driverParam: string;
|
|
1147
1147
|
notNull: true;
|
|
1148
1148
|
hasDefault: false;
|
|
@@ -1142,7 +1142,7 @@ declare const activityLogs: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1142
1142
|
tableName: "activity_log";
|
|
1143
1143
|
dataType: "string";
|
|
1144
1144
|
columnType: "PgEnumColumn";
|
|
1145
|
-
data: "
|
|
1145
|
+
data: "login" | "logout" | "login_failed" | "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";
|
|
1146
1146
|
driverParam: string;
|
|
1147
1147
|
notNull: true;
|
|
1148
1148
|
hasDefault: false;
|