@harryy/react-file-browser 0.0.0 → 1.0.0
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/README.md +23 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# react-file-browser
|
|
1
|
+
# @harryy/react-file-browser
|
|
2
2
|
|
|
3
3
|
A standalone, storage-agnostic React file manager component. Ships UI and client logic only, with
|
|
4
4
|
zero server code. Storage access goes through a host-provided adapter, so the same component drives
|
|
5
5
|
S3, Cloudflare R2, Supabase Storage, an in-memory store, or any backend you implement.
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/react-file-browser)
|
|
8
|
-
[](https://www.npmjs.com/package/react-file-browser)
|
|
7
|
+
[](https://www.npmjs.com/package/@harryy/react-file-browser)
|
|
8
|
+
[](https://www.npmjs.com/package/@harryy/react-file-browser)
|
|
9
9
|
[](https://github.com/harryy2510/react-file-browser/actions/workflows/ci.yml)
|
|
10
|
-
[](https://bundlephobia.com/package/react-file-browser)
|
|
11
|
-
[](https://www.npmjs.com/package/react-file-browser)
|
|
12
|
-
[](LICENSE)
|
|
10
|
+
[](https://bundlephobia.com/package/@harryy/react-file-browser)
|
|
11
|
+
[](https://www.npmjs.com/package/@harryy/react-file-browser)
|
|
12
|
+
[](LICENSE)
|
|
13
13
|
|
|
14
14
|
**[Live demo →](https://harryy2510.github.io/react-file-browser/)**
|
|
15
15
|
|
|
@@ -34,8 +34,8 @@ S3, Cloudflare R2, Supabase Storage, an in-memory store, or any backend you impl
|
|
|
34
34
|
## Install
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
bun add react-file-browser
|
|
38
|
-
# or: npm install react-file-browser
|
|
37
|
+
bun add @harryy/react-file-browser
|
|
38
|
+
# or: npm install @harryy/react-file-browser
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
`react` and `react-dom` (>=18 <20) are peer dependencies. The AWS SDK and Supabase client are
|
|
@@ -44,8 +44,8 @@ optional peers, needed only for their respective adapters.
|
|
|
44
44
|
## Quick start
|
|
45
45
|
|
|
46
46
|
```tsx
|
|
47
|
-
import { FileBrowser, FileBrowserProvider } from "react-file-browser";
|
|
48
|
-
import { InMemoryFileBrowserAdapter } from "react-file-browser/adapters/in-memory";
|
|
47
|
+
import { FileBrowser, FileBrowserProvider } from "@harryy/react-file-browser";
|
|
48
|
+
import { InMemoryFileBrowserAdapter } from "@harryy/react-file-browser/adapters/in-memory";
|
|
49
49
|
|
|
50
50
|
const adapter = new InMemoryFileBrowserAdapter();
|
|
51
51
|
|
|
@@ -83,10 +83,10 @@ is accepted:
|
|
|
83
83
|
|
|
84
84
|
The core contract is the `FileBrowserAdapter` interface. Available built-in adapters:
|
|
85
85
|
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
86
|
+
- `@harryy/react-file-browser/adapters/in-memory`
|
|
87
|
+
- `@harryy/react-file-browser/adapters/s3`
|
|
88
|
+
- `@harryy/react-file-browser/adapters/r2`
|
|
89
|
+
- `@harryy/react-file-browser/adapters/supabase`
|
|
90
90
|
|
|
91
91
|
The in-memory adapter is usable for tests and demos. It can opt into multipart methods with
|
|
92
92
|
`capabilities: { multipart: true }` and `multipartPartSize` so resumable upload flows are testable
|
|
@@ -99,7 +99,7 @@ S3 and R2 use the S3-compatible SDK surface when you provide a client and bucket
|
|
|
99
99
|
|
|
100
100
|
```ts
|
|
101
101
|
import { S3Client } from "@aws-sdk/client-s3";
|
|
102
|
-
import { S3FileBrowserAdapter } from "react-file-browser/adapters/s3";
|
|
102
|
+
import { S3FileBrowserAdapter } from "@harryy/react-file-browser/adapters/s3";
|
|
103
103
|
|
|
104
104
|
const adapter = new S3FileBrowserAdapter({
|
|
105
105
|
bucket: "assets",
|
|
@@ -115,7 +115,7 @@ const adapter = new S3FileBrowserAdapter({
|
|
|
115
115
|
|
|
116
116
|
```ts
|
|
117
117
|
import { createClient } from "@supabase/supabase-js";
|
|
118
|
-
import { SupabaseFileBrowserAdapter } from "react-file-browser/adapters/supabase";
|
|
118
|
+
import { SupabaseFileBrowserAdapter } from "@harryy/react-file-browser/adapters/supabase";
|
|
119
119
|
|
|
120
120
|
const supabase = createClient(url, anonKey);
|
|
121
121
|
const adapter = new SupabaseFileBrowserAdapter({
|
|
@@ -131,7 +131,7 @@ Implement the `FileBrowserAdapter` interface directly, or pass a custom `impleme
|
|
|
131
131
|
adapter to delegate required and optional methods:
|
|
132
132
|
|
|
133
133
|
```ts
|
|
134
|
-
import { S3FileBrowserAdapter } from "react-file-browser/adapters/s3";
|
|
134
|
+
import { S3FileBrowserAdapter } from "@harryy/react-file-browser/adapters/s3";
|
|
135
135
|
|
|
136
136
|
const adapter = new S3FileBrowserAdapter({
|
|
137
137
|
implementation: hostBackedAdapter,
|
|
@@ -187,12 +187,12 @@ own UI. The `FileBrowser` component is a consumer of this hook.
|
|
|
187
187
|
|
|
188
188
|
| Import | Contents |
|
|
189
189
|
| --- | --- |
|
|
190
|
-
|
|
|
191
|
-
|
|
|
192
|
-
|
|
|
193
|
-
|
|
|
194
|
-
|
|
|
195
|
-
|
|
|
190
|
+
| `@harryy/react-file-browser` | `FileBrowser`, `FileBrowserProvider`, `useFileBrowser`, `TransferManager`, adapter types and errors, path utilities. |
|
|
191
|
+
| `@harryy/react-file-browser/adapters/in-memory` | `InMemoryFileBrowserAdapter`, `createInMemoryFileBrowserAdapter`. |
|
|
192
|
+
| `@harryy/react-file-browser/adapters/s3` | `S3FileBrowserAdapter`. |
|
|
193
|
+
| `@harryy/react-file-browser/adapters/r2` | `R2FileBrowserAdapter`. |
|
|
194
|
+
| `@harryy/react-file-browser/adapters/supabase` | `SupabaseFileBrowserAdapter`. |
|
|
195
|
+
| `@harryy/react-file-browser/theme` | `FILE_BROWSER_THEME_CONTRACT`, `getFileBrowserDensityAttributes`. |
|
|
196
196
|
|
|
197
197
|
## Styling
|
|
198
198
|
|