@fluxfiles/react 1.22.0 → 1.22.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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +156 -0
  3. package/package.json +1 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 thai-pc
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 ADDED
@@ -0,0 +1,156 @@
1
+ # FluxFiles for React
2
+
3
+ [![npm](https://img.shields.io/npm/v/@fluxfiles/react?color=61dafb)](https://www.npmjs.com/package/@fluxfiles/react)
4
+
5
+ React components and hooks for [FluxFiles](https://github.com/thai-pc/fluxfiles) — a standalone, embeddable file manager with multi-storage support (Local, AWS S3, Cloudflare R2).
6
+
7
+ ## Requirements
8
+
9
+ - React 18 or 19
10
+ - A running FluxFiles backend
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @fluxfiles/react
16
+ # or
17
+ yarn add @fluxfiles/react
18
+ ```
19
+
20
+ ## Components
21
+
22
+ ### FluxFilesModal
23
+
24
+ File picker as a modal overlay:
25
+
26
+ ```tsx
27
+ import { useState } from 'react';
28
+ import { FluxFilesModal } from '@fluxfiles/react';
29
+
30
+ function App() {
31
+ const [open, setOpen] = useState(false);
32
+
33
+ return (
34
+ <>
35
+ <button onClick={() => setOpen(true)}>Pick file</button>
36
+
37
+ <FluxFilesModal
38
+ open={open}
39
+ endpoint="https://your-fluxfiles-host"
40
+ token={token}
41
+ disk="local"
42
+ locale="en"
43
+ onSelect={(file) => {
44
+ console.log(file.url, file.path);
45
+ setOpen(false);
46
+ }}
47
+ onClose={() => setOpen(false)}
48
+ />
49
+ </>
50
+ );
51
+ }
52
+ ```
53
+
54
+ ### FluxFiles
55
+
56
+ Embedded file manager (inline, no modal):
57
+
58
+ ```tsx
59
+ import { useRef } from 'react';
60
+ import { FluxFiles, FluxFilesHandle } from '@fluxfiles/react';
61
+
62
+ function App() {
63
+ const ref = useRef<FluxFilesHandle>(null);
64
+
65
+ return (
66
+ <FluxFiles
67
+ ref={ref}
68
+ endpoint="https://your-fluxfiles-host"
69
+ token={token}
70
+ disk="local"
71
+ width="100%"
72
+ height="600px"
73
+ onSelect={(file) => console.log(file)}
74
+ />
75
+ );
76
+ }
77
+ ```
78
+
79
+ ## Hook
80
+
81
+ ### useFluxFiles
82
+
83
+ Full control over the iframe communication:
84
+
85
+ ```tsx
86
+ import { useFluxFiles } from '@fluxfiles/react';
87
+
88
+ function App() {
89
+ const { iframeRef, iframeSrc, navigate, setDisk, refresh, search, aiTag } =
90
+ useFluxFiles({
91
+ endpoint: 'https://your-fluxfiles-host',
92
+ token,
93
+ onSelect: (file) => console.log(file),
94
+ onEvent: (event) => console.log(event.action),
95
+ });
96
+
97
+ return (
98
+ <>
99
+ <button onClick={() => navigate('/photos')}>Photos</button>
100
+ <button onClick={() => setDisk('s3')}>Switch to S3</button>
101
+ <button onClick={() => refresh()}>Refresh</button>
102
+ <button onClick={() => search('invoice')}>Search</button>
103
+
104
+ <iframe ref={iframeRef} src={iframeSrc} style={{ width: '100%', height: '600px', border: 'none' }} />
105
+ </>
106
+ );
107
+ }
108
+ ```
109
+
110
+ ## Commands
111
+
112
+ All components and the hook expose these methods:
113
+
114
+ | Method | Description |
115
+ |--------|-------------|
116
+ | `navigate(path)` | Navigate to a directory |
117
+ | `setDisk(disk)` | Switch storage disk |
118
+ | `refresh()` | Reload current directory |
119
+ | `search(query)` | Full-text search |
120
+ | `crossCopy(disk, path?)` | Copy selection to another disk |
121
+ | `crossMove(disk, path?)` | Move selection to another disk |
122
+ | `aiTag()` | AI auto-tag selected image |
123
+
124
+ ## Props
125
+
126
+ | Prop | Type | Required | Description |
127
+ |------|------|----------|-------------|
128
+ | `endpoint` | `string` | Yes | FluxFiles server URL |
129
+ | `token` | `string` | Yes | JWT token |
130
+ | `disk` | `string` | No | Initial storage disk (`local`) |
131
+ | `mode` | `string` | No | `picker` or `browser` |
132
+ | `locale` | `string` | No | UI language code |
133
+ | `width` | `string` | No | Iframe width |
134
+ | `height` | `string` | No | Iframe height |
135
+ | `onSelect` | `(file) => void` | No | File selected callback |
136
+ | `onEvent` | `(event) => void` | No | Action event callback |
137
+ | `onClose` | `() => void` | No | Modal closed callback |
138
+ | `open` | `boolean` | No | Modal visibility (FluxFilesModal only) |
139
+
140
+ ## TypeScript
141
+
142
+ All types are exported:
143
+
144
+ ```ts
145
+ import type { FluxFile, FluxEvent, FluxFilesConfig, FluxFilesHandle } from '@fluxfiles/react';
146
+ ```
147
+
148
+ ## License
149
+
150
+ MIT — see [LICENSE](LICENSE) for details.
151
+
152
+ ## Links
153
+
154
+ - [FluxFiles](https://github.com/thai-pc/fluxfiles) — Main repository
155
+ - [Documentation](https://github.com/thai-pc/fluxfiles#react) — Full docs
156
+ - [Issues](https://github.com/thai-pc/fluxfiles/issues) — Bug reports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluxfiles/react",
3
- "version": "1.22.0",
3
+ "version": "1.22.1",
4
4
  "description": "React components and hooks for FluxFiles file manager",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",