@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.
@@ -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
- const previews = React.useMemo(
61
- () => files.map((f) => (f.type.startsWith("image/") ? URL.createObjectURL(f) : null)),
62
- [files]
63
- )
64
- React.useEffect(() => () => previews.forEach((url) => url && URL.revokeObjectURL(url)), [previews])
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
- <p>{label ?? `Drag and drop ${multiple ? "files" : "a file"} here`}</p>
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
  ) : (
@@ -1,4 +1,4 @@
1
- import { A as ActivityActionEnum } from '../schema-BNSBWNjK.mjs';
1
+ import { A as ActivityActionEnum } from '../schema-UuqxoOzS.mjs';
2
2
  import 'drizzle-orm';
3
3
  import 'drizzle-orm/pg-core';
4
4
 
@@ -1,4 +1,4 @@
1
- import { A as ActivityActionEnum } from '../schema-BNSBWNjK.js';
1
+ import { A as ActivityActionEnum } from '../schema-UuqxoOzS.js';
2
2
  import 'drizzle-orm';
3
3
  import 'drizzle-orm/pg-core';
4
4
 
@@ -891,7 +891,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
891
891
  $Infer: {
892
892
  body: {
893
893
  permissions: {
894
- readonly user?: ("set-role" | "delete" | "update" | "list" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
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?: ("set-role" | "delete" | "update" | "list" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
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
  } & {
@@ -891,7 +891,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
891
891
  $Infer: {
892
892
  body: {
893
893
  permissions: {
894
- readonly user?: ("set-role" | "delete" | "update" | "list" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
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?: ("set-role" | "delete" | "update" | "list" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
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
  } & {
@@ -1,4 +1,4 @@
1
- import { a as schema } from '../schema-BNSBWNjK.mjs';
1
+ import { a as schema } from '../schema-UuqxoOzS.mjs';
2
2
  import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
3
3
  import { NeonHttpDatabase } from 'drizzle-orm/neon-http';
4
4
  import 'drizzle-orm';
@@ -1,4 +1,4 @@
1
- import { a as schema } from '../schema-BNSBWNjK.js';
1
+ import { a as schema } from '../schema-UuqxoOzS.js';
2
2
  import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
3
3
  import { NeonHttpDatabase } from 'drizzle-orm/neon-http';
4
4
  import 'drizzle-orm';
@@ -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-BNSBWNjK.mjs';
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';
@@ -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-BNSBWNjK.js';
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: "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";
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: "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";
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;
@@ -1,4 +1,4 @@
1
- import { s as systemSettings } from '../schema-BNSBWNjK.mjs';
1
+ import { s as systemSettings } from '../schema-UuqxoOzS.mjs';
2
2
  import 'drizzle-orm';
3
3
  import 'drizzle-orm/pg-core';
4
4
 
@@ -1,4 +1,4 @@
1
- import { s as systemSettings } from '../schema-BNSBWNjK.js';
1
+ import { s as systemSettings } from '../schema-UuqxoOzS.js';
2
2
  import 'drizzle-orm';
3
3
  import 'drizzle-orm/pg-core';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xk2800/nextjs-template",
3
- "version": "0.7.1-beta.0",
3
+ "version": "0.7.1-beta.2",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",