@unciatech/file-manager 0.0.33 → 0.0.35

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/dist/cli.cjs CHANGED
@@ -1,44 +1,5 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
- // If the importer is in node compatibility mode or this is not an ESM
19
- // file that has been converted to a CommonJS file using a Babel-
20
- // compatible transform (i.e. "__esModule" has not been set), then set
21
- // "default" to the CommonJS "module.exports" for node compatibility.
22
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
- mod
24
- ));
25
-
26
- // cli.ts
27
- var import_fs = __toESM(require("fs"), 1);
28
- var import_path = __toESM(require("path"), 1);
29
- var import_child_process = require("child_process");
30
- var import_readline = __toESM(require("readline"), 1);
31
- var args = process.argv.slice(2);
32
- var command = args[0];
33
- var projectName = args[1];
34
- var rl = import_readline.default.createInterface({
35
- input: process.stdin,
36
- output: process.stdout
37
- });
38
- var askQuestion = (query) => {
39
- return new Promise((resolve) => rl.question(query, resolve));
40
- };
41
- var getTemplate = (basePath = "/media") => `"use client";
2
+ 'use strict';var t=require('fs'),i=require('path'),child_process=require('child_process'),g=require('readline');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var t__default=/*#__PURE__*/_interopDefault(t);var i__default=/*#__PURE__*/_interopDefault(i);var g__default=/*#__PURE__*/_interopDefault(g);var p=process.argv.slice(2),v=p[0],l=p[1],u=g__default.default.createInterface({input:process.stdin,output:process.stdout}),x=o=>new Promise(e=>u.question(o,e)),h=(o="/media")=>`"use client";
42
3
 
43
4
  import React, { Suspense } from "react";
44
5
  import { FileManager, MockProvider } from "@unciatech/file-manager";
@@ -53,117 +14,150 @@ export default function FileManagerDemo() {
53
14
  allowedFileTypes={["audios", "videos", "images", "files"]}
54
15
  viewMode="grid"
55
16
  provider={mockProvider}
56
- basePath="${basePath}"
17
+ basePath="${o}"
57
18
  />
58
19
  </Suspense>
59
20
  </div>
60
21
  );
61
22
  }
62
- `;
63
- async function main() {
64
- if (command !== "init") {
65
- console.log("Usage: npx @unciatech/file-manager init [project-name]");
66
- process.exit(0);
67
- }
68
- if (!projectName) {
69
- console.log("\u{1F680} Generating <FileManagerDemo /> component in the current project...");
70
- let targetDir2 = process.cwd();
71
- if (import_fs.default.existsSync(import_path.default.join(process.cwd(), "components"))) {
72
- targetDir2 = import_path.default.join(process.cwd(), "components");
73
- } else if (import_fs.default.existsSync(import_path.default.join(process.cwd(), "src", "components"))) {
74
- targetDir2 = import_path.default.join(process.cwd(), "src", "components");
75
- }
76
- const targetFile = import_path.default.join(targetDir2, "FileManagerDemo.tsx");
77
- if (import_fs.default.existsSync(targetFile)) {
78
- console.error(`\u274C Error: ${targetFile} already exists.`);
79
- process.exit(1);
80
- }
81
- import_fs.default.writeFileSync(targetFile, getTemplate("/"), "utf-8");
82
- console.log(`\u2705 Success! Created ${targetFile}`);
83
- console.log("");
84
- console.log("You can now import and render <FileManagerDemo /> anywhere in your application.");
85
- console.log("Don't forget to configure your Tailwind CSS content to scan the library for styles!");
86
- process.exit(0);
87
- }
88
- console.log(`
89
- \u{1F680} Initializing a new application: ${projectName}
90
- `);
91
- console.log("Which framework would you like to use?");
92
- console.log(" 1) Next.js (App Router, Tailwind v4)");
93
- console.log(" 2) Vite (React, Tailwind v4)");
94
- console.log(" 3) Cancel");
95
- const choice = await askQuestion("\nSelect an option (1-3): ");
96
- const targetDir = import_path.default.join(process.cwd(), projectName);
97
- if (import_fs.default.existsSync(targetDir)) {
98
- console.error(`
99
- \u274C Error: Directory "${projectName}" already exists in ${process.cwd()}.`);
100
- console.error(` Please choose a different project name or delete the existing directory first.`);
101
- rl.close();
102
- process.exit(1);
103
- }
104
- try {
105
- if (choice === "1") {
106
- await scaffoldNextjs(projectName, targetDir);
107
- } else if (choice === "2") {
108
- await scaffoldVite(projectName, targetDir);
109
- } else {
110
- console.log("Canceled.");
111
- process.exit(0);
112
- }
113
- } catch (error) {
114
- console.error("\n\u274C Scaffolding failed:", error);
115
- process.exit(1);
116
- }
117
- process.exit(0);
118
- }
119
- async function scaffoldNextjs(projectName2, targetDir) {
120
- console.log("\n\u{1F4E6} Creating Next.js application (this may take a minute)...");
121
- (0, import_child_process.execSync)(`npx create-next-app@latest ${projectName2} --ts --tailwind --eslint --app --src-dir --import-alias "@/*" --use-npm`, { stdio: "inherit" });
122
- console.log("\n\u{1F4E6} Installing dependencies (@unciatech/file-manager, tailwindcss-animate)...");
123
- (0, import_child_process.execSync)("npm install @unciatech/file-manager tailwindcss-animate", { cwd: targetDir, stdio: "inherit" });
124
- const componentsDir = import_path.default.join(targetDir, "src", "components");
125
- if (!import_fs.default.existsSync(componentsDir)) import_fs.default.mkdirSync(componentsDir, { recursive: true });
126
- import_fs.default.writeFileSync(import_path.default.join(componentsDir, "FileManagerDemo.tsx"), getTemplate("/media"), "utf-8");
127
- const pagePath = import_path.default.join(targetDir, "src", "app", "page.tsx");
128
- import_fs.default.writeFileSync(pagePath, `import FileManagerDemo from "@/components/FileManagerDemo";
23
+ `;async function w(){if(v!=="init"&&(console.log("Usage: npx @unciatech/file-manager init [project-name]"),process.exit(0)),!l){console.log("\u{1F680} Generating <FileManagerDemo /> component in the current project...");let s=process.cwd();t__default.default.existsSync(i__default.default.join(process.cwd(),"components"))?s=i__default.default.join(process.cwd(),"components"):t__default.default.existsSync(i__default.default.join(process.cwd(),"src","components"))&&(s=i__default.default.join(process.cwd(),"src","components"));let a=i__default.default.join(s,"FileManagerDemo.tsx");t__default.default.existsSync(a)&&(console.error(`\u274C Error: ${a} already exists.`),process.exit(1)),t__default.default.writeFileSync(a,h("/"),"utf-8"),console.log(`\u2705 Success! Created ${a}`),console.log(""),console.log("You can now import and render <FileManagerDemo /> anywhere in your application."),console.log("Don't forget to configure your Tailwind CSS content to scan the library for styles!"),process.exit(0);}console.log(`
24
+ \u{1F680} Initializing a new application: ${l}
25
+ `),console.log("Which framework would you like to use?"),console.log(" 1) Next.js (App Router, Tailwind v4)"),console.log(" 2) Vite (React, Tailwind v4)"),console.log(" 3) Cancel");let o=await x(`
26
+ Select an option (1-3): `),e=i__default.default.join(process.cwd(),l);t__default.default.existsSync(e)&&(console.error(`
27
+ \u274C Error: Directory "${l}" already exists in ${process.cwd()}.`),console.error(" Please choose a different project name or delete the existing directory first."),u.close(),process.exit(1));try{o==="1"?await b(l,e):o==="2"?await y(l,e):(console.log("Canceled."),process.exit(0));}catch(s){console.error(`
28
+ \u274C Scaffolding failed:`,s),process.exit(1);}process.exit(0);}async function b(o,e){console.log(`
29
+ \u{1F4E6} Creating Next.js application (this may take a minute)...`),child_process.execSync(`npx create-next-app@latest ${o} --ts --tailwind --eslint --app --src-dir --import-alias "@/*" --use-npm`,{stdio:"inherit"}),console.log(`
30
+ \u{1F4E6} Installing dependencies (@unciatech/file-manager, tailwindcss-animate)...`),child_process.execSync("npm install @unciatech/file-manager tailwindcss-animate",{cwd:e,stdio:"inherit"});let s=i__default.default.join(e,"src","app","page.tsx");t__default.default.writeFileSync(s,`"use client";
31
+
32
+ import { redirect } from "next/navigation";
129
33
 
130
34
  export default function Home() {
35
+ redirect("/media");
36
+ }
37
+ `);let a=i__default.default.join(e,"src","app","media","[[...path]]");t__default.default.mkdirSync(a,{recursive:true}),t__default.default.writeFileSync(i__default.default.join(a,"page.tsx"),`"use client";
38
+
39
+ import { Suspense, useState } from "react";
40
+ import { FileManager, MockProvider } from "@unciatech/file-manager";
41
+ import Link from "next/link";
42
+
43
+ function MediaPageContent() {
44
+ const [provider] = useState(() => new MockProvider());
45
+
131
46
  return (
132
- <main className="min-h-screen bg-neutral-50">
133
- <FileManagerDemo />
134
- </main>
47
+ <div className="h-screen w-full flex flex-col">
48
+ <div className="flex gap-4 p-4 border-b border-border items-center justify-between">
49
+ <h1 className="text-xl font-bold">Full Page View</h1>
50
+ <Link
51
+ href="/modal-demo"
52
+ className="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 cursor-pointer text-sm font-medium"
53
+ >
54
+ Go to Modal Demo
55
+ </Link>
56
+ </div>
57
+ <div className="flex-1 relative overflow-hidden">
58
+ <FileManager
59
+ allowedFileTypes={["audios", "videos", "images", "files"]}
60
+ viewMode="grid"
61
+ provider={provider}
62
+ basePath="/media"
63
+ />
64
+ </div>
65
+ </div>
135
66
  );
136
67
  }
137
- `);
138
- const mediaRouteDir = import_path.default.join(targetDir, "src", "app", "media", "[[...path]]");
139
- import_fs.default.mkdirSync(mediaRouteDir, { recursive: true });
140
- import_fs.default.writeFileSync(
141
- import_path.default.join(mediaRouteDir, "page.tsx"),
142
- `import FileManagerDemo from "@/components/FileManagerDemo";
143
68
 
144
69
  export default function MediaPage() {
145
70
  return (
146
- <main className="min-h-screen bg-neutral-50">
147
- <FileManagerDemo />
148
- </main>
71
+ <Suspense fallback={<div className="p-4">Loading Media Library...</div>}>
72
+ <MediaPageContent />
73
+ </Suspense>
149
74
  );
150
75
  }
151
- `
76
+ `);let d=i__default.default.join(e,"src","app","modal-demo");t__default.default.mkdirSync(d,{recursive:true}),t__default.default.writeFileSync(i__default.default.join(d,"page.tsx"),`"use client";
77
+
78
+ import { Suspense, useState } from "react";
79
+ import { FileManagerModal, MockProvider } from "@unciatech/file-manager";
80
+ import type { FileMetaData } from "@unciatech/file-manager";
81
+ import Link from "next/link";
82
+
83
+ function ModalDemoContent() {
84
+ const [provider] = useState(() => new MockProvider());
85
+ const [isOpen, setIsOpen] = useState(false);
86
+ const [selectedFiles, setSelectedFiles] = useState<FileMetaData[]>([]);
87
+
88
+ return (
89
+ <div className="p-10 flex flex-col items-start gap-6 min-h-screen w-full">
90
+ <div>
91
+ <h1 className="text-3xl font-bold mb-2">File Manager Demo</h1>
92
+ <p className="text-gray-500">Select files using the modal or browse the full page view.</p>
93
+ </div>
94
+
95
+ <div className="flex gap-4">
96
+ <button
97
+ onClick={() => setIsOpen(true)}
98
+ className="px-6 py-2.5 bg-blue-600 text-white rounded-md hover:bg-blue-700 cursor-pointer text-sm font-medium shadow-sm transition-colors"
99
+ >
100
+ Open File Picker Modal
101
+ </button>
102
+ <Link
103
+ href="/media"
104
+ className="px-6 py-2.5 bg-zinc-100 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 rounded-md hover:bg-zinc-200 dark:hover:bg-zinc-700 cursor-pointer text-sm font-medium transition-colors"
105
+ >
106
+ Go to Full Page View
107
+ </Link>
108
+ </div>
109
+
110
+ {selectedFiles.length > 0 && (
111
+ <div className="w-full mt-8">
112
+ <h2 className="text-xl font-semibold mb-4 border-b pb-2">
113
+ Selected Files ({selectedFiles.length})
114
+ </h2>
115
+ <div className="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4">
116
+ {selectedFiles.map((file, idx) => (
117
+ <div key={idx} className="border rounded-lg p-3 flex flex-col items-center gap-3 shadow-sm">
118
+ <div className="w-full aspect-square bg-gray-100 dark:bg-gray-800 rounded-md overflow-hidden flex items-center justify-center relative">
119
+ {file.url && file.mime?.startsWith("image/") ? (
120
+ <img src={file.url} alt={file.name} className="w-full h-full object-cover" />
121
+ ) : (
122
+ <span className="text-gray-400 font-mono text-xs p-2 overflow-hidden text-ellipsis">
123
+ {file.ext?.toUpperCase() || "FILE"}
124
+ </span>
125
+ )}
126
+ </div>
127
+ <div className="w-full text-center">
128
+ <p className="text-sm font-medium truncate w-full" title={file.name}>{file.name}</p>
129
+ <p className="text-xs text-gray-500 mt-0.5">{(file.size / 1024).toFixed(1)} KB</p>
130
+ </div>
131
+ </div>
132
+ ))}
133
+ </div>
134
+ </div>
135
+ )}
136
+
137
+ <FileManagerModal
138
+ open={isOpen}
139
+ onClose={() => setIsOpen(false)}
140
+ provider={provider}
141
+ allowedFileTypes={["images", "videos", "audios", "files"]}
142
+ onFilesSelected={(files: FileMetaData[]) => {
143
+ setSelectedFiles(files);
144
+ setIsOpen(false);
145
+ }}
146
+ basePath="/media"
147
+ />
148
+ </div>
152
149
  );
153
- const layoutPath = import_path.default.join(targetDir, "src", "app", "layout.tsx");
154
- if (import_fs.default.existsSync(layoutPath)) {
155
- let layoutContent = import_fs.default.readFileSync(layoutPath, "utf8");
156
- if (!layoutContent.includes("@unciatech/file-manager/styles")) {
157
- layoutContent = layoutContent.replace(
158
- /^(import type)/m,
159
- `import '@unciatech/file-manager/styles';
160
- $1`
161
- );
162
- import_fs.default.writeFileSync(layoutPath, layoutContent);
163
- }
164
- }
165
- const cssPath = import_path.default.join(targetDir, "src", "app", "globals.css");
166
- import_fs.default.writeFileSync(cssPath, `@import "tailwindcss";
150
+ }
151
+
152
+ export default function ModalDemoPage() {
153
+ return (
154
+ <Suspense fallback={<div className="p-10">Loading...</div>}>
155
+ <ModalDemoContent />
156
+ </Suspense>
157
+ );
158
+ }
159
+ `);let r=i__default.default.join(e,"src","app","layout.tsx");if(t__default.default.existsSync(r)){let n=t__default.default.readFileSync(r,"utf8");n.includes("@unciatech/file-manager/styles")||(n=n.replace(/^(import type)/m,`import '@unciatech/file-manager/styles';
160
+ $1`),t__default.default.writeFileSync(r,n));}let m=i__default.default.join(e,"src","app","globals.css");t__default.default.writeFileSync(m,`@import "tailwindcss";
167
161
  @import "@unciatech/file-manager/styles";
168
162
  @import "tw-animate-css";
169
163
 
@@ -173,17 +167,9 @@ $1`
173
167
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
174
168
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
175
169
  }
176
- `);
177
- printSuccess(projectName2);
178
- }
179
- async function scaffoldVite(projectName2, targetDir) {
180
- console.log("\n\u{1F4E6} Creating Vite React application...");
181
- (0, import_child_process.execSync)(`npm create vite@latest ${projectName2} -- --template react-ts`, { stdio: "inherit" });
182
- console.log("\n\u{1F4E6} Installing dependencies (Tailwind + File Manager)...");
183
- (0, import_child_process.execSync)("npm install", { cwd: targetDir, stdio: "inherit" });
184
- (0, import_child_process.execSync)("npm install tailwindcss @tailwindcss/vite @unciatech/file-manager", { cwd: targetDir, stdio: "inherit" });
185
- const viteConfigPath = import_path.default.join(targetDir, "vite.config.ts");
186
- const viteConfig = `import { defineConfig } from 'vite'
170
+ `),f(o);}async function y(o,e){console.log(`
171
+ \u{1F4E6} Creating Vite React application...`),child_process.execSync(`npm create vite@latest ${o} -- --template react-ts`,{stdio:"inherit"}),console.log(`
172
+ \u{1F4E6} Installing dependencies (Tailwind + File Manager + React Router)...`),child_process.execSync("npm install",{cwd:e,stdio:"inherit"}),child_process.execSync("npm install tailwindcss @tailwindcss/vite @unciatech/file-manager react-router-dom",{cwd:e,stdio:"inherit"});let s=i__default.default.join(e,"vite.config.ts");t__default.default.writeFileSync(s,`import { defineConfig } from 'vite'
187
173
  import react from '@vitejs/plugin-react'
188
174
  import tailwindcss from '@tailwindcss/vite'
189
175
 
@@ -193,38 +179,134 @@ export default defineConfig({
193
179
  tailwindcss(),
194
180
  ],
195
181
  })
196
- `;
197
- import_fs.default.writeFileSync(viteConfigPath, viteConfig);
198
- const cssPath = import_path.default.join(targetDir, "src", "index.css");
199
- import_fs.default.writeFileSync(cssPath, `@import "tailwindcss";
182
+ `);let d=i__default.default.join(e,"src","index.css");t__default.default.writeFileSync(d,`@import "tailwindcss";
200
183
  @import "@unciatech/file-manager/styles";
201
184
  @source "../node_modules/@unciatech/file-manager";
202
- `);
203
- const componentsDir = import_path.default.join(targetDir, "src", "components");
204
- if (!import_fs.default.existsSync(componentsDir)) import_fs.default.mkdirSync(componentsDir, { recursive: true });
205
- import_fs.default.writeFileSync(import_path.default.join(componentsDir, "FileManagerDemo.tsx"), getTemplate("/"), "utf-8");
206
- const appPath = import_path.default.join(targetDir, "src", "App.tsx");
207
- import_fs.default.writeFileSync(appPath, `import FileManagerDemo from "./components/FileManagerDemo";
185
+ `);let r=i__default.default.join(e,"src","main.tsx");t__default.default.writeFileSync(r,`import React from 'react'
186
+ import ReactDOM from 'react-dom/client'
187
+ import { BrowserRouter } from 'react-router-dom'
188
+ import App from './App.tsx'
189
+ import './index.css'
190
+
191
+ ReactDOM.createRoot(document.getElementById('root')!).render(
192
+ <React.StrictMode>
193
+ <BrowserRouter>
194
+ <App />
195
+ </BrowserRouter>
196
+ </React.StrictMode>,
197
+ )
198
+ `);let m=i__default.default.join(e,"src","App.tsx");t__default.default.writeFileSync(m,`import { useState } from 'react'
199
+ import { useNavigate, Routes, Route, Link } from 'react-router-dom'
200
+ import { FileManager, FileManagerModal, MockProvider } from '@unciatech/file-manager'
201
+ import type { FileMetaData } from '@unciatech/file-manager'
202
+
203
+ const provider = new MockProvider()
204
+
205
+ function FullPage() {
206
+ const navigate = useNavigate()
208
207
 
209
- function App() {
210
208
  return (
211
- <div className="min-h-screen bg-neutral-50">
212
- <FileManagerDemo />
209
+ <div className="h-screen w-full flex flex-col">
210
+ <div className="flex gap-4 p-4 border-b border-border items-center justify-between">
211
+ <h1 className="text-xl font-bold">Full Page View</h1>
212
+ <Link
213
+ to="/"
214
+ className="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 cursor-pointer text-sm font-medium"
215
+ >
216
+ Back to Modal Demo
217
+ </Link>
218
+ </div>
219
+
220
+ <div className="flex-1 relative overflow-hidden">
221
+ <FileManager
222
+ provider={provider}
223
+ basePath="full"
224
+ allowedFileTypes={["images", "videos", "audios", "files"]}
225
+ viewMode="grid"
226
+ onNavigate={(url, opts) => navigate(url, { replace: opts?.replace })}
227
+ />
228
+ </div>
213
229
  </div>
214
- );
230
+ )
215
231
  }
216
232
 
217
- export default App;
218
- `);
219
- printSuccess(projectName2, "npm run dev");
233
+ function ModalDemo() {
234
+ const navigate = useNavigate()
235
+ const [isModalOpen, setIsModalOpen] = useState(false)
236
+ const [selectedFiles, setSelectedFiles] = useState<FileMetaData[]>([])
237
+
238
+ return (
239
+ <div className="p-10 flex flex-col items-start gap-6 min-h-screen w-full bg-background text-foreground">
240
+ <div>
241
+ <h1 className="text-3xl font-bold mb-2">File Manager Demo</h1>
242
+ <p className="text-muted-foreground">Select files using the modal or browse the full page view.</p>
243
+ </div>
244
+
245
+ <div className="flex gap-4">
246
+ <button
247
+ onClick={() => setIsModalOpen(true)}
248
+ className="px-6 py-2.5 bg-blue-600 text-white rounded-md hover:bg-blue-700 cursor-pointer text-sm font-medium shadow-sm transition-colors"
249
+ >
250
+ Open File Picker Modal
251
+ </button>
252
+ <Link
253
+ to="/full"
254
+ className="px-6 py-2.5 bg-zinc-100 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 rounded-md hover:bg-zinc-200 dark:hover:bg-zinc-700 cursor-pointer text-sm font-medium transition-colors"
255
+ >
256
+ Go to Full Page View
257
+ </Link>
258
+ </div>
259
+
260
+ {selectedFiles.length > 0 && (
261
+ <div className="w-full mt-8">
262
+ <h2 className="text-xl font-semibold mb-4 border-b pb-2">Selected Files ({selectedFiles.length})</h2>
263
+ <div className="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4">
264
+ {selectedFiles.map((file, idx) => (
265
+ <div key={idx} className="border border-border rounded-lg p-3 flex flex-col items-center gap-3 bg-card shadow-sm">
266
+ <div className="w-full aspect-square bg-muted rounded-md overflow-hidden flex items-center justify-center relative">
267
+ {file.url && file.mime?.startsWith('image/') ? (
268
+ <img src={file.url} alt={file.name} className="w-full h-full object-cover" />
269
+ ) : (
270
+ <span className="text-muted-foreground font-mono text-xs p-2 overflow-hidden text-ellipsis">{file.ext?.toUpperCase() || 'FILE'}</span>
271
+ )}
272
+ </div>
273
+ <div className="w-full text-center">
274
+ <p className="text-sm font-medium truncate w-full" title={file.name}>{file.name}</p>
275
+ <p className="text-xs text-muted-foreground mt-0.5">{(file.size / 1024).toFixed(1)} KB</p>
276
+ </div>
277
+ </div>
278
+ ))}
279
+ </div>
280
+ </div>
281
+ )}
282
+
283
+ <FileManagerModal
284
+ open={isModalOpen}
285
+ onClose={() => setIsModalOpen(false)}
286
+ provider={provider}
287
+ basePath="/"
288
+ allowedFileTypes={["images", "videos", "audios", "files"]}
289
+ onFilesSelected={(files: FileMetaData[]) => {
290
+ setSelectedFiles(files)
291
+ }}
292
+ onNavigate={(url, opts) => navigate(url, { replace: opts?.replace })}
293
+ />
294
+ </div>
295
+ )
220
296
  }
221
- function printSuccess(projectName2, devCmd = "npm run dev") {
222
- console.log("\n=========================================");
223
- console.log("\u{1F389} Your Media Library application is ready!");
224
- console.log("=========================================");
225
- console.log("\nNext steps:");
226
- console.log(` cd ${projectName2}`);
227
- console.log(` ${devCmd}`);
228
- console.log("\nEnjoy building! \u{1F5C2}\uFE0F\n");
297
+
298
+ function App() {
299
+ return (
300
+ <Routes>
301
+ <Route path="/" element={<ModalDemo />} />
302
+ <Route path="/full/*" element={<FullPage />} />
303
+ </Routes>
304
+ )
229
305
  }
230
- main();
306
+
307
+ export default App
308
+ `);let n=i__default.default.join(e,"src","App.css");t__default.default.existsSync(n)&&t__default.default.unlinkSync(n),f(o,"npm run dev");}function f(o,e="npm run dev"){console.log(`
309
+ =========================================`),console.log("\u{1F389} Your Media Library application is ready!"),console.log("========================================="),console.log(`
310
+ Next steps:`),console.log(` cd ${o}`),console.log(` ${e}`),console.log(`
311
+ Enjoy building! \u{1F5C2}\uFE0F
312
+ `);}w();