@unciatech/file-manager 0.0.32 → 0.0.33

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.
@@ -172,7 +172,20 @@ interface FileManagerPageProps {
172
172
  viewMode: ViewMode;
173
173
  initialFolderId?: FolderId;
174
174
  provider: IFileManagerProvider;
175
- basePath?: string;
175
+ basePath: string;
176
+ /**
177
+ * Optional navigation callback. When provided, the library delegates all
178
+ * URL navigation to this function instead of calling history.pushState
179
+ * directly. Use this to plug in your own router:
180
+ * - React Router: onNavigate={(url, opts) => navigate(url, { replace: opts?.replace })}
181
+ * - Next.js: onNavigate={(url, opts) => opts?.replace ? router.replace(url) : router.push(url)}
182
+ * - TanStack Router: onNavigate={(url, opts) => router.navigate({ href: url, replace: opts?.replace })}
183
+ * If omitted, falls back to history.pushState (works in any bare React app).
184
+ */
185
+ onNavigate?: (url: string, options?: {
186
+ replace?: boolean;
187
+ scroll?: boolean;
188
+ }) => void;
176
189
  }
177
190
  interface FileManagerModalProps {
178
191
  open: boolean;
@@ -184,7 +197,12 @@ interface FileManagerModalProps {
184
197
  viewMode?: ViewMode;
185
198
  initialFolderId?: FolderId;
186
199
  provider: IFileManagerProvider;
187
- basePath?: string;
200
+ basePath: string;
201
+ /** @see FileManagerPageProps.onNavigate */
202
+ onNavigate?: (url: string, options?: {
203
+ replace?: boolean;
204
+ scroll?: boolean;
205
+ }) => void;
188
206
  }
189
207
  interface FileManagerRootProps {
190
208
  mode: Mode;
@@ -194,11 +212,16 @@ interface FileManagerRootProps {
194
212
  initialFolderId?: FolderId;
195
213
  acceptedFileTypesForModal?: FileType[];
196
214
  provider: IFileManagerProvider;
197
- basePath?: string;
215
+ basePath: string;
198
216
  onFilesSelected?: (files: FileMetaData[]) => void;
199
217
  onClose?: () => void;
200
218
  maxUploadFiles?: number;
201
219
  maxUploadSize?: number;
220
+ /** @see FileManagerPageProps.onNavigate */
221
+ onNavigate?: (url: string, options?: {
222
+ replace?: boolean;
223
+ scroll?: boolean;
224
+ }) => void;
202
225
  }
203
226
  interface FileStateOptions {
204
227
  mode: Mode;
@@ -207,9 +230,14 @@ interface FileStateOptions {
207
230
  acceptedFileTypesForModal?: FileType[];
208
231
  allowedFileTypes?: FileType[];
209
232
  provider: IFileManagerProvider;
210
- basePath?: string;
233
+ basePath: string;
211
234
  onFilesSelected?: (files: FileMetaData[]) => void;
212
235
  onClose?: () => void;
236
+ /** @see FileManagerPageProps.onNavigate */
237
+ onNavigate?: (url: string, options?: {
238
+ replace?: boolean;
239
+ scroll?: boolean;
240
+ }) => void;
213
241
  }
214
242
 
215
243
  declare class MockProvider implements IFileManagerProvider {
@@ -172,7 +172,20 @@ interface FileManagerPageProps {
172
172
  viewMode: ViewMode;
173
173
  initialFolderId?: FolderId;
174
174
  provider: IFileManagerProvider;
175
- basePath?: string;
175
+ basePath: string;
176
+ /**
177
+ * Optional navigation callback. When provided, the library delegates all
178
+ * URL navigation to this function instead of calling history.pushState
179
+ * directly. Use this to plug in your own router:
180
+ * - React Router: onNavigate={(url, opts) => navigate(url, { replace: opts?.replace })}
181
+ * - Next.js: onNavigate={(url, opts) => opts?.replace ? router.replace(url) : router.push(url)}
182
+ * - TanStack Router: onNavigate={(url, opts) => router.navigate({ href: url, replace: opts?.replace })}
183
+ * If omitted, falls back to history.pushState (works in any bare React app).
184
+ */
185
+ onNavigate?: (url: string, options?: {
186
+ replace?: boolean;
187
+ scroll?: boolean;
188
+ }) => void;
176
189
  }
177
190
  interface FileManagerModalProps {
178
191
  open: boolean;
@@ -184,7 +197,12 @@ interface FileManagerModalProps {
184
197
  viewMode?: ViewMode;
185
198
  initialFolderId?: FolderId;
186
199
  provider: IFileManagerProvider;
187
- basePath?: string;
200
+ basePath: string;
201
+ /** @see FileManagerPageProps.onNavigate */
202
+ onNavigate?: (url: string, options?: {
203
+ replace?: boolean;
204
+ scroll?: boolean;
205
+ }) => void;
188
206
  }
189
207
  interface FileManagerRootProps {
190
208
  mode: Mode;
@@ -194,11 +212,16 @@ interface FileManagerRootProps {
194
212
  initialFolderId?: FolderId;
195
213
  acceptedFileTypesForModal?: FileType[];
196
214
  provider: IFileManagerProvider;
197
- basePath?: string;
215
+ basePath: string;
198
216
  onFilesSelected?: (files: FileMetaData[]) => void;
199
217
  onClose?: () => void;
200
218
  maxUploadFiles?: number;
201
219
  maxUploadSize?: number;
220
+ /** @see FileManagerPageProps.onNavigate */
221
+ onNavigate?: (url: string, options?: {
222
+ replace?: boolean;
223
+ scroll?: boolean;
224
+ }) => void;
202
225
  }
203
226
  interface FileStateOptions {
204
227
  mode: Mode;
@@ -207,9 +230,14 @@ interface FileStateOptions {
207
230
  acceptedFileTypesForModal?: FileType[];
208
231
  allowedFileTypes?: FileType[];
209
232
  provider: IFileManagerProvider;
210
- basePath?: string;
233
+ basePath: string;
211
234
  onFilesSelected?: (files: FileMetaData[]) => void;
212
235
  onClose?: () => void;
236
+ /** @see FileManagerPageProps.onNavigate */
237
+ onNavigate?: (url: string, options?: {
238
+ replace?: boolean;
239
+ scroll?: boolean;
240
+ }) => void;
213
241
  }
214
242
 
215
243
  declare class MockProvider implements IFileManagerProvider {
package/dist/mock.d.cts CHANGED
@@ -1 +1 @@
1
- export { o as MockProvider } from './mock-provider-nCBvw7nl.cjs';
1
+ export { o as MockProvider } from './mock-provider-DrtiUc3h.cjs';
package/dist/mock.d.ts CHANGED
@@ -1 +1 @@
1
- export { o as MockProvider } from './mock-provider-nCBvw7nl.js';
1
+ export { o as MockProvider } from './mock-provider-DrtiUc3h.js';
package/dist/styles.css CHANGED
@@ -1,62 +1,81 @@
1
- /* @unciatech/file-manager — base styles
2
- * Import this in your root layout to provide the CSS variables the
3
- * file manager components depend on.
1
+ /* @unciatech/file-manager — Tailwind v4 Theme
2
+ * Import this in your root CSS to automatically inject all required colors.
4
3
  *
5
- * Usage: import '@unciatech/file-manager/styles';
6
- *
7
- * How it works with Tailwind v4:
8
- * Tailwind utility classes (e.g. bg-primary) resolve to var(--color-primary).
9
- * This file defines those --color-* variables directly so they work in any
10
- * consumer app without needing a @theme block or additional Tailwind config.
4
+ * Usage in your globals.css or index.css:
5
+ * @import "tailwindcss";
6
+ * @import "@unciatech/file-manager/styles";
7
+ * @source "../node_modules/@unciatech/file-manager";
11
8
  */
12
9
 
13
- /* ── Light mode ───────────────────────────────────────────────── */
14
- :root {
15
- --color-background: #ffffff;
16
- --color-foreground: #09090b; /* zinc-950 */
17
- --color-card: #ffffff;
18
- --color-card-foreground: #09090b;
19
- --color-popover: #ffffff;
20
- --color-popover-foreground:#09090b;
21
- --color-primary: #3b82f6; /* blue-500 */
22
- --color-primary-foreground:#ffffff;
23
- --color-secondary: #f4f4f5; /* zinc-100 */
24
- --color-secondary-foreground:#18181b;
25
- --color-muted: #f4f4f5;
26
- --color-muted-foreground: #71717a; /* zinc-500 */
27
- --color-accent: #f4f4f5;
28
- --color-accent-foreground: #18181b;
29
- --color-destructive: #dc2626; /* red-600 */
30
- --color-destructive-foreground:#ffffff;
31
- --color-border: oklch(94% 0.004 286.32);
32
- --color-input: #e4e4e7; /* zinc-200 */
33
- --color-ring: #a1a1aa; /* zinc-400 */
34
- --radius: 0.5rem;
35
- }
36
-
10
+ @custom-variant dark (&:is(.dark *));
37
11
 
38
-
39
- /* Manual .dark class (toggle button override) */
40
- .dark {
41
- --color-background: #09090b;
42
- --color-foreground: #fafafa;
43
- --color-card: #09090b;
44
- --color-card-foreground: #fafafa;
45
- --color-popover: #09090b;
46
- --color-popover-foreground:#fafafa;
47
- --color-primary: #2563eb;
48
- --color-primary-foreground:#ffffff;
49
- --color-secondary: #27272a;
50
- --color-secondary-foreground:#fafafa;
51
- --color-muted: #18181b;
52
- --color-muted-foreground: #71717a;
53
- --color-accent: #18181b;
54
- --color-accent-foreground: #fafafa;
55
- --color-destructive: #dc2626;
56
- --color-destructive-foreground:#ffffff;
57
- --color-border: #27272a;
58
- --color-input: #27272a;
59
- --color-ring: #52525b;
12
+ @theme {
13
+ --color-border: hsl(var(--border));
14
+ --color-input: hsl(var(--input));
15
+ --color-ring: hsl(var(--ring));
16
+ --color-background: hsl(var(--background));
17
+ --color-foreground: hsl(var(--foreground));
18
+ --color-primary: hsl(var(--primary));
19
+ --color-primary-foreground: hsl(var(--primary-foreground));
20
+ --color-secondary: hsl(var(--secondary));
21
+ --color-secondary-foreground: hsl(var(--secondary-foreground));
22
+ --color-destructive: hsl(var(--destructive));
23
+ --color-destructive-foreground: hsl(var(--destructive-foreground));
24
+ --color-muted: hsl(var(--muted));
25
+ --color-muted-foreground: hsl(var(--muted-foreground));
26
+ --color-accent: hsl(var(--accent));
27
+ --color-accent-foreground: hsl(var(--accent-foreground));
28
+ --color-popover: hsl(var(--popover));
29
+ --color-popover-foreground: hsl(var(--popover-foreground));
30
+ --color-card: hsl(var(--card));
31
+ --color-card-foreground: hsl(var(--card-foreground));
32
+ --radius-lg: var(--radius);
33
+ --radius-md: calc(var(--radius) - 2px);
34
+ --radius-sm: calc(var(--radius) - 4px);
60
35
  }
61
36
 
62
-
37
+ @layer base {
38
+ :root {
39
+ --background: 0 0% 100%;
40
+ --foreground: 222.2 84% 4.9%;
41
+ --card: 0 0% 100%;
42
+ --card-foreground: 222.2 84% 4.9%;
43
+ --popover: 0 0% 100%;
44
+ --popover-foreground: 222.2 84% 4.9%;
45
+ --primary: 221.2 83.2% 53.3%;
46
+ --primary-foreground: 210 40% 98%;
47
+ --secondary: 210 40% 96.1%;
48
+ --secondary-foreground: 222.2 47.4% 11.2%;
49
+ --muted: 210 40% 96.1%;
50
+ --muted-foreground: 215.4 16.3% 46.9%;
51
+ --accent: 210 40% 96.1%;
52
+ --accent-foreground: 222.2 47.4% 11.2%;
53
+ --destructive: 0 84.2% 60.2%;
54
+ --destructive-foreground: 210 40% 98%;
55
+ --border: 214.3 31.8% 91.4%;
56
+ --input: 214.3 31.8% 91.4%;
57
+ --ring: 221.2 83.2% 53.3%;
58
+ --radius: 0.5rem;
59
+ }
60
+ .dark {
61
+ --background: 222.2 84% 4.9%;
62
+ --foreground: 210 40% 98%;
63
+ --card: 222.2 84% 4.9%;
64
+ --card-foreground: 210 40% 98%;
65
+ --popover: 222.2 84% 4.9%;
66
+ --popover-foreground: 210 40% 98%;
67
+ --primary: 217.2 91.2% 59.8%;
68
+ --primary-foreground: 210 40% 98%;
69
+ --secondary: 217.2 32.6% 17.5%;
70
+ --secondary-foreground: 210 40% 98%;
71
+ --muted: 217.2 32.6% 17.5%;
72
+ --muted-foreground: 215 20.2% 65.1%;
73
+ --accent: 217.2 32.6% 17.5%;
74
+ --accent-foreground: 210 40% 98%;
75
+ --destructive: 0 62.8% 30.6%;
76
+ --destructive-foreground: 210 40% 98%;
77
+ --border: 217.2 32.6% 17.5%;
78
+ --input: 217.2 32.6% 17.5%;
79
+ --ring: 212.7 26.8% 83.9%;
80
+ }
81
+ }
@@ -0,0 +1 @@
1
+ declare const styles: any; export default styles;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unciatech/file-manager",
3
- "version": "0.0.32",
4
- "description": "Modern file manager component for React and Next.js",
3
+ "version": "0.0.33",
4
+ "description": "Modern file manager component for React applications",
5
5
  "author": "Avi",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/unciatech/file-manager",
@@ -35,7 +35,11 @@
35
35
  "import": "./dist/mock.js",
36
36
  "require": "./dist/mock.cjs"
37
37
  },
38
- "./styles": "./dist/styles.css"
38
+ "./styles": {
39
+ "types": "./dist/styles.d.ts",
40
+ "style": "./dist/styles.css",
41
+ "default": "./dist/styles.css"
42
+ }
39
43
  },
40
44
  "files": [
41
45
  "dist",
@@ -51,7 +55,7 @@
51
55
  "scripts": {
52
56
  "dev": "next dev",
53
57
  "build": "next build",
54
- "build:pkg": "tsup && cp styles.css dist/styles.css",
58
+ "build:pkg": "tsup && cp styles.css dist/styles.css && echo 'declare const styles: any; export default styles;' > dist/styles.d.ts",
55
59
  "clean": "rm -rf dist .next",
56
60
  "prepublish": "npm run build:pkg",
57
61
  "release": "npm run build:pkg && npm publish",
@@ -74,7 +78,6 @@
74
78
  "@radix-ui/react-context-menu": "^2",
75
79
  "@radix-ui/react-dialog": "^1",
76
80
  "@radix-ui/react-tooltip": "^1",
77
- "next": "^14 || ^15 || ^16",
78
81
  "react": "^18 || ^19",
79
82
  "react-dom": "^18 || ^19"
80
83
  },
package/styles.css CHANGED
@@ -1,62 +1,81 @@
1
- /* @unciatech/file-manager — base styles
2
- * Import this in your root layout to provide the CSS variables the
3
- * file manager components depend on.
1
+ /* @unciatech/file-manager — Tailwind v4 Theme
2
+ * Import this in your root CSS to automatically inject all required colors.
4
3
  *
5
- * Usage: import '@unciatech/file-manager/styles';
6
- *
7
- * How it works with Tailwind v4:
8
- * Tailwind utility classes (e.g. bg-primary) resolve to var(--color-primary).
9
- * This file defines those --color-* variables directly so they work in any
10
- * consumer app without needing a @theme block or additional Tailwind config.
4
+ * Usage in your globals.css or index.css:
5
+ * @import "tailwindcss";
6
+ * @import "@unciatech/file-manager/styles";
7
+ * @source "../node_modules/@unciatech/file-manager";
11
8
  */
12
9
 
13
- /* ── Light mode ───────────────────────────────────────────────── */
14
- :root {
15
- --color-background: #ffffff;
16
- --color-foreground: #09090b; /* zinc-950 */
17
- --color-card: #ffffff;
18
- --color-card-foreground: #09090b;
19
- --color-popover: #ffffff;
20
- --color-popover-foreground:#09090b;
21
- --color-primary: #3b82f6; /* blue-500 */
22
- --color-primary-foreground:#ffffff;
23
- --color-secondary: #f4f4f5; /* zinc-100 */
24
- --color-secondary-foreground:#18181b;
25
- --color-muted: #f4f4f5;
26
- --color-muted-foreground: #71717a; /* zinc-500 */
27
- --color-accent: #f4f4f5;
28
- --color-accent-foreground: #18181b;
29
- --color-destructive: #dc2626; /* red-600 */
30
- --color-destructive-foreground:#ffffff;
31
- --color-border: oklch(94% 0.004 286.32);
32
- --color-input: #e4e4e7; /* zinc-200 */
33
- --color-ring: #a1a1aa; /* zinc-400 */
34
- --radius: 0.5rem;
35
- }
36
-
10
+ @custom-variant dark (&:is(.dark *));
37
11
 
38
-
39
- /* Manual .dark class (toggle button override) */
40
- .dark {
41
- --color-background: #09090b;
42
- --color-foreground: #fafafa;
43
- --color-card: #09090b;
44
- --color-card-foreground: #fafafa;
45
- --color-popover: #09090b;
46
- --color-popover-foreground:#fafafa;
47
- --color-primary: #2563eb;
48
- --color-primary-foreground:#ffffff;
49
- --color-secondary: #27272a;
50
- --color-secondary-foreground:#fafafa;
51
- --color-muted: #18181b;
52
- --color-muted-foreground: #71717a;
53
- --color-accent: #18181b;
54
- --color-accent-foreground: #fafafa;
55
- --color-destructive: #dc2626;
56
- --color-destructive-foreground:#ffffff;
57
- --color-border: #27272a;
58
- --color-input: #27272a;
59
- --color-ring: #52525b;
12
+ @theme {
13
+ --color-border: hsl(var(--border));
14
+ --color-input: hsl(var(--input));
15
+ --color-ring: hsl(var(--ring));
16
+ --color-background: hsl(var(--background));
17
+ --color-foreground: hsl(var(--foreground));
18
+ --color-primary: hsl(var(--primary));
19
+ --color-primary-foreground: hsl(var(--primary-foreground));
20
+ --color-secondary: hsl(var(--secondary));
21
+ --color-secondary-foreground: hsl(var(--secondary-foreground));
22
+ --color-destructive: hsl(var(--destructive));
23
+ --color-destructive-foreground: hsl(var(--destructive-foreground));
24
+ --color-muted: hsl(var(--muted));
25
+ --color-muted-foreground: hsl(var(--muted-foreground));
26
+ --color-accent: hsl(var(--accent));
27
+ --color-accent-foreground: hsl(var(--accent-foreground));
28
+ --color-popover: hsl(var(--popover));
29
+ --color-popover-foreground: hsl(var(--popover-foreground));
30
+ --color-card: hsl(var(--card));
31
+ --color-card-foreground: hsl(var(--card-foreground));
32
+ --radius-lg: var(--radius);
33
+ --radius-md: calc(var(--radius) - 2px);
34
+ --radius-sm: calc(var(--radius) - 4px);
60
35
  }
61
36
 
62
-
37
+ @layer base {
38
+ :root {
39
+ --background: 0 0% 100%;
40
+ --foreground: 222.2 84% 4.9%;
41
+ --card: 0 0% 100%;
42
+ --card-foreground: 222.2 84% 4.9%;
43
+ --popover: 0 0% 100%;
44
+ --popover-foreground: 222.2 84% 4.9%;
45
+ --primary: 221.2 83.2% 53.3%;
46
+ --primary-foreground: 210 40% 98%;
47
+ --secondary: 210 40% 96.1%;
48
+ --secondary-foreground: 222.2 47.4% 11.2%;
49
+ --muted: 210 40% 96.1%;
50
+ --muted-foreground: 215.4 16.3% 46.9%;
51
+ --accent: 210 40% 96.1%;
52
+ --accent-foreground: 222.2 47.4% 11.2%;
53
+ --destructive: 0 84.2% 60.2%;
54
+ --destructive-foreground: 210 40% 98%;
55
+ --border: 214.3 31.8% 91.4%;
56
+ --input: 214.3 31.8% 91.4%;
57
+ --ring: 221.2 83.2% 53.3%;
58
+ --radius: 0.5rem;
59
+ }
60
+ .dark {
61
+ --background: 222.2 84% 4.9%;
62
+ --foreground: 210 40% 98%;
63
+ --card: 222.2 84% 4.9%;
64
+ --card-foreground: 210 40% 98%;
65
+ --popover: 222.2 84% 4.9%;
66
+ --popover-foreground: 210 40% 98%;
67
+ --primary: 217.2 91.2% 59.8%;
68
+ --primary-foreground: 210 40% 98%;
69
+ --secondary: 217.2 32.6% 17.5%;
70
+ --secondary-foreground: 210 40% 98%;
71
+ --muted: 217.2 32.6% 17.5%;
72
+ --muted-foreground: 215 20.2% 65.1%;
73
+ --accent: 217.2 32.6% 17.5%;
74
+ --accent-foreground: 210 40% 98%;
75
+ --destructive: 0 62.8% 30.6%;
76
+ --destructive-foreground: 210 40% 98%;
77
+ --border: 217.2 32.6% 17.5%;
78
+ --input: 217.2 32.6% 17.5%;
79
+ --ring: 212.7 26.8% 83.9%;
80
+ }
81
+ }