@cubone/react-file-manager 1.0.0 → 1.0.1

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.
Files changed (4) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +93 -102
  3. package/package.json +57 -57
  4. package/src/index.js +1 -1
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Saifullah Zubair
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Saifullah Zubair
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,102 +1,93 @@
1
- # File Manager Component
2
-
3
- ## Overview
4
-
5
- The File Manager Component is an open-source React.js package designed to help developers easily integrate a file manager into their applications. This component provides a user-friendly interface along with essential functionalities for managing files and folders, such as viewing, uploading and deleting within a specified directory structure. Ideal for anyone looking to build or enhance a file management system, this package offers both UI and backend integration capabilities.
6
-
7
- ## Features
8
-
9
- - **View Files and Folders**: Display the directory structure with folders and files.
10
- - **Upload Files**: Upload new files to a selected directory.
11
- - **Delete Files and Folders**: Remove unwanted files or folders.
12
- - **Breadcrumb Navigation**: Easily navigate through the directory structure.
13
- - **Responsive Design**: Works seamlessly on both desktop and mobile devices.
14
-
15
- ## Installation
16
-
17
- To get started with the File Manager Component, follow these steps:
18
-
19
- ### Prerequisites
20
-
21
- Ensure you have the following installed on your system:
22
-
23
- - Node.js (v14 or later)
24
- - npm (v6 or later)
25
-
26
- ### Clone the Repository
27
-
28
- ```bash
29
- git clone https://github.com/Saifullah-dev/react-file-manager.git
30
- cd react-file-manager
31
- ```
32
-
33
- ### Install Dependencies
34
-
35
- Using npm:
36
-
37
- ```bash
38
- npm i
39
- ```
40
-
41
- ### Start the Development Server
42
-
43
- To start the development server and see the File Manager in action:
44
-
45
- ```bash
46
- npm run dev
47
- ```
48
-
49
- The application should now be running on `http://localhost:5173`.
50
-
51
- ## Usage
52
-
53
- ### File Structure
54
-
55
- - **src/**: Contains all the source code.
56
- - **components/**: Reusable components like `Button`, `Context Menu`, `Modal`, etc.
57
- - **File Manager/**: The main directory for the File Manager component.
58
- - **hooks/**: Custom hooks for handling various interactions and UI state.
59
- - **Mock APIs/**: Simulated API functions for demonstration purposes.
60
- - **utils/**: Utility functions and helpers.
61
- - **App.js**: Main entry point of the application.
62
- - **index.js**: Application bootstrap and rendering.
63
-
64
- ## Available Scripts
65
-
66
- In the project directory, you can run:
67
-
68
- - `npm run dev`: Runs the app in development mode.
69
- - `npm run build`: Builds the app for production.
70
- - `npm test`: Launches the test runner.
71
-
72
- ## Deployment
73
-
74
- To deploy the app, first build the project:
75
-
76
- ```bash
77
- npm run build
78
- ```
79
-
80
- This will create a `build/` directory containing the production-ready code. You can then deploy the contents of this directory to your preferred hosting service.
81
-
82
- ## Contributing
83
-
84
- Contributions are welcome! To contribute:
85
-
86
- 1. Fork the repository.
87
- 2. Create a new branch (`git checkout -b feature/branch-name`).
88
- 3. Make your changes.
89
- 4. Commit your changes (`git commit -m 'Add some feature'`).
90
- 5. Push to the branch (`git push origin feature/branch-name`).
91
- 6. Open a Pull Request.
92
-
93
- ## License
94
-
95
- This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
96
-
97
- ## Contact
98
-
99
- For any questions, feel free to reach out:
100
-
101
- - **Email**: saifullah.contact@gmail.com
102
- - **GitHub**: [Saifullah-dev](https://github.com/Saifullah-dev)
1
+ # React File Manager
2
+
3
+ An open-source React.js package for easy integration of a file manager into applications. It provides a user-friendly interface for managing files and folders, including viewing, uploading, and deleting, with full UI and backend integration.
4
+
5
+ ## Features
6
+
7
+ - **View Files and Folders**: Display the directory structure with folders and files.
8
+ - **Upload Files**: Upload new files to a selected directory.
9
+ - **Delete Files and Folders**: Remove unwanted files or folders.
10
+ - **Toolbar**: Access common file operations such as upload, delete, and refresh with a convenient toolbar.
11
+ - **Breadcrumb Navigation**: Easily navigate through the directory structure.
12
+ - **Navigation Pane**: Easily switch between folders and directories with a sidebar navigation pane.
13
+ - **Context Menu**: Right-click to open a context menu with options for cutting, copying, pasting, renaming, and deleting files or folders.
14
+
15
+ ## Installation
16
+
17
+ To install `React File Manager`, use the following command:
18
+
19
+ ```bash
20
+ npm i @cubone/react-file-manager
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ Here’s a basic example of how to use the File Manager Component in your React application:
26
+
27
+ ```javascript
28
+ import { useState } from "react";
29
+ import { FileManager } from "@cubone/react-file-manager";
30
+ import "@cubone/react-file-manager/dist/style.css";
31
+
32
+ function App() {
33
+ const [files, setFiles] = useState([
34
+ {
35
+ name: "Documents",
36
+ isDirectory: true,
37
+ path: "", // Root directory
38
+ },
39
+ {
40
+ name: "Pictures",
41
+ isDirectory: true,
42
+ path: "", // Root directory
43
+ },
44
+ {
45
+ name: "Pic.png",
46
+ isDirectory: false,
47
+ path: "/Pictures", // Located inside the "Pictures" folder
48
+ },
49
+ ]);
50
+
51
+ return (
52
+ <>
53
+ <FileManager files={files} />
54
+ </>
55
+ );
56
+ }
57
+ ```
58
+ ## Props
59
+
60
+ | Name | Type | Description |
61
+ |-----------------|------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
62
+ | `files` | `Array<{ name: string, isDirectory: boolean, path: string }>` | An array of file and folder objects representing the current directory structure. Each object includes `name`, `isDirectory`, and `path` properties. |
63
+ | `isLoading` | `boolean` | A boolean indicating whether the application is currently performing an operation, such as creating, renaming, or deleting a file/folder. Displays a loading state if `true`. |
64
+ | `onCreateFolder`| `(files: { name: string, isDirectory: boolean, path: string }[], folderName: string, folderPath: string) => void` | A callback function triggered when a new folder is created. Update the `files` state to include the new folder in the specified path. |
65
+ | `onRename` | `(files: { name: string, isDirectory: boolean, path: string }[], selectedFile: { name: string, isDirectory: boolean, path: string }, newName: string) => void` | A callback function triggered when a file or folder is renamed. Update the `files` state to reflect the new name for the specified file or folder. |
66
+ | `onDelete` | `(files: { name: string, isDirectory: boolean, path: string }[], file: { name: string, isDirectory: boolean, path: string }) => void` | A callback function triggered when a file or folder is deleted. Update the `files` state to remove the specified file or folder from the structure. |
67
+ | `onPaste` | `(files: { name: string, isDirectory: boolean, path: string }[], pastePath: string, clipBoard: { isMoving: boolean, files: { name: string, isDirectory: boolean, path: string, children?: { name: string, isDirectory: boolean, path: string }[] }[] }) => void` | A callback function triggered when a file or folder is pasted (moved or copied). Update the files state to reflect the new location of the pasted items based on the clipBoard data. |
68
+ | `onRefresh` | `() => void` | A callback function triggered when the file manager is refreshed. Use this to reload or refresh the `files` state to reflect any changes or updates. |
69
+
70
+ ## Contributing
71
+
72
+ Contributions are welcome! To contribute:
73
+
74
+ 1. Fork the repository.
75
+ 2. Create a new branch (`git checkout -b feature/branch-name`).
76
+ 3. Make your changes.
77
+ 4. Commit your changes (`git commit -m 'Add some feature'`).
78
+ 5. Push to the branch (`git push origin feature/branch-name`).
79
+ 6. Open a Pull Request.
80
+
81
+ Get started by running following commands:
82
+
83
+ ```bash
84
+ git clone https://github.com/Saifullah-dev/react-file-manager.git
85
+ cd react-file-manager
86
+ npm i
87
+ npm run dev
88
+ ```
89
+ The application should now be running on `http://localhost:5173`, have fun!
90
+
91
+ ## License
92
+
93
+ React File Manager is [MIT Licensed](LICENSE).
package/package.json CHANGED
@@ -1,57 +1,57 @@
1
- {
2
- "name": "@cubone/react-file-manager",
3
- "private": false,
4
- "version": "1.0.0",
5
- "type": "module",
6
- "module": "dist/react-file-manager.es.js",
7
- "files": [
8
- "dist/",
9
- "README.md"
10
- ],
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
- "scripts": {
15
- "dev": "vite",
16
- "build": "vite build",
17
- "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
18
- "preview": "vite preview",
19
- "semantic-release": "semantic-release"
20
- },
21
- "dependencies": {
22
- "react": "^18.3.1",
23
- "react-collapsible": "^2.10.0",
24
- "react-dom": "^18.3.1",
25
- "react-icons": "^5.2.1",
26
- "react-loading": "^2.0.3"
27
- },
28
- "devDependencies": {
29
- "@types/react": "^18.3.3",
30
- "@types/react-dom": "^18.3.0",
31
- "@vitejs/plugin-react-swc": "^3.5.0",
32
- "eslint": "^8.57.0",
33
- "eslint-plugin-react": "^7.34.2",
34
- "eslint-plugin-react-hooks": "^4.6.2",
35
- "eslint-plugin-react-refresh": "^0.4.7",
36
- "sass": "^1.77.6",
37
- "semantic-release": "^24.1.0",
38
- "vite": "^5.3.1"
39
- },
40
- "description": "The File Manager Component is an open-source React.js package designed to help developers easily integrate a file manager into their applications. This component provides a user-friendly interface along with essential functionalities for managing files and folders, such as viewing, uploading and deleting within a specified directory structure. Ideal for anyone looking to build or enhance a file management system, this package offers both UI and backend integration capabilities.",
41
- "main": "src/index.js",
42
- "repository": {
43
- "type": "git",
44
- "url": "git+https://github.com/Saifullah-dev/react-file-manager.git"
45
- },
46
- "keywords": [
47
- "react",
48
- "file-manager",
49
- "component"
50
- ],
51
- "author": "Saifullah Zubair",
52
- "license": "MIT",
53
- "bugs": {
54
- "url": "https://github.com/Saifullah-dev/react-file-manager/issues"
55
- },
56
- "homepage": "https://github.com/Saifullah-dev/react-file-manager#readme"
57
- }
1
+ {
2
+ "name": "@cubone/react-file-manager",
3
+ "private": false,
4
+ "version": "1.0.1",
5
+ "type": "module",
6
+ "module": "dist/react-file-manager.es.js",
7
+ "files": [
8
+ "dist/",
9
+ "README.md"
10
+ ],
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "scripts": {
15
+ "dev": "vite",
16
+ "build": "vite build",
17
+ "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
18
+ "preview": "vite preview",
19
+ "semantic-release": "semantic-release"
20
+ },
21
+ "dependencies": {
22
+ "react": "^18.3.1",
23
+ "react-collapsible": "^2.10.0",
24
+ "react-dom": "^18.3.1",
25
+ "react-icons": "^5.2.1",
26
+ "react-loading": "^2.0.3"
27
+ },
28
+ "devDependencies": {
29
+ "@types/react": "^18.3.3",
30
+ "@types/react-dom": "^18.3.0",
31
+ "@vitejs/plugin-react-swc": "^3.5.0",
32
+ "eslint": "^8.57.0",
33
+ "eslint-plugin-react": "^7.34.2",
34
+ "eslint-plugin-react-hooks": "^4.6.2",
35
+ "eslint-plugin-react-refresh": "^0.4.7",
36
+ "sass": "^1.77.6",
37
+ "semantic-release": "^24.1.0",
38
+ "vite": "^5.3.1"
39
+ },
40
+ "description": "The File Manager Component is an open-source React.js package designed to help developers easily integrate a file manager into their applications. This component provides a user-friendly interface along with essential functionalities for managing files and folders, such as viewing, uploading and deleting within a specified directory structure. Ideal for anyone looking to build or enhance a file management system, this package offers both UI and backend integration capabilities.",
41
+ "main": "src/index.js",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/Saifullah-dev/react-file-manager.git"
45
+ },
46
+ "keywords": [
47
+ "react",
48
+ "file-manager",
49
+ "component"
50
+ ],
51
+ "author": "Saifullah Zubair",
52
+ "license": "MIT",
53
+ "bugs": {
54
+ "url": "https://github.com/Saifullah-dev/react-file-manager/issues"
55
+ },
56
+ "homepage": "https://github.com/Saifullah-dev/react-file-manager#readme"
57
+ }
package/src/index.js CHANGED
@@ -1 +1 @@
1
- export { default as FileManager } from "./File Manager/FileManager";
1
+ export { default as FileManager } from "./File Manager/FileManager";