@zjlab-fe/data-hub-ui 0.8.0 → 0.9.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 (55) hide show
  1. package/.github/instructions/i.instructions.md +249 -0
  2. package/README.md +1 -1
  3. package/dist/types/components/apply-perm-modal/demo/index.d.ts +1 -0
  4. package/dist/types/components/apply-perm-modal/index.d.ts +15 -0
  5. package/dist/types/components/feature-card/demo/moha.d.ts +1 -0
  6. package/dist/types/components/feature-card/index.d.ts +7 -1
  7. package/dist/types/components/file-uploader/components/circle-progress.d.ts +6 -0
  8. package/dist/types/components/file-uploader/components/hooks/use-drop-zone.d.ts +17 -0
  9. package/dist/types/components/file-uploader/components/hooks/use-file-validation.d.ts +12 -0
  10. package/dist/types/components/file-uploader/components/icons.d.ts +5 -0
  11. package/dist/types/components/file-uploader/components/uploader-drop-zone.d.ts +49 -0
  12. package/dist/types/components/file-uploader/components/uploader-file-item.d.ts +40 -0
  13. package/dist/types/components/file-uploader/components/uploader-file-list.d.ts +29 -0
  14. package/dist/types/components/file-uploader/components/uploader.d.ts +64 -0
  15. package/dist/types/components/file-uploader/components/utils/directory-reader.d.ts +4 -0
  16. package/dist/types/components/file-uploader/constants.d.ts +27 -0
  17. package/dist/types/components/file-uploader/context/file-state-store.d.ts +64 -0
  18. package/dist/types/components/file-uploader/context/handler-registry.d.ts +96 -0
  19. package/dist/types/components/file-uploader/context/upload-context.d.ts +14 -0
  20. package/dist/types/components/file-uploader/context/upload-provider.d.ts +47 -0
  21. package/dist/types/components/file-uploader/context/upload-reducer.d.ts +6 -0
  22. package/dist/types/components/file-uploader/context/use-upload-engine.d.ts +22 -0
  23. package/dist/types/components/file-uploader/demo/index.d.ts +2 -0
  24. package/dist/types/components/file-uploader/engine/queue-callbacks.d.ts +21 -0
  25. package/dist/types/components/file-uploader/engine/queue-manager.d.ts +63 -0
  26. package/dist/types/components/file-uploader/engine/queue-types.d.ts +37 -0
  27. package/dist/types/components/file-uploader/engine/queue-uploader.d.ts +8 -0
  28. package/dist/types/components/file-uploader/hooks/use-upload-batch.d.ts +36 -0
  29. package/dist/types/components/file-uploader/hooks/use-upload-control.d.ts +37 -0
  30. package/dist/types/components/file-uploader/hooks/use-upload-files.d.ts +40 -0
  31. package/dist/types/components/file-uploader/hooks/use-upload-operations.d.ts +43 -0
  32. package/dist/types/components/file-uploader/hooks/use-upload.d.ts +74 -0
  33. package/dist/types/components/file-uploader/index.d.ts +16 -0
  34. package/dist/types/components/file-uploader/persistence/file-blob-store.d.ts +71 -0
  35. package/dist/types/components/file-uploader/persistence/file-handle-store.d.ts +116 -0
  36. package/dist/types/components/file-uploader/persistence/index.d.ts +42 -0
  37. package/dist/types/components/file-uploader/persistence/metadata-store.d.ts +63 -0
  38. package/dist/types/components/file-uploader/persistence/persistence-context.d.ts +20 -0
  39. package/dist/types/components/file-uploader/persistence/persistence-manager.d.ts +103 -0
  40. package/dist/types/components/file-uploader/persistence/persistence-provider.d.ts +49 -0
  41. package/dist/types/components/file-uploader/persistence/types.d.ts +266 -0
  42. package/dist/types/components/file-uploader/persistence/use-persistence.d.ts +78 -0
  43. package/dist/types/components/file-uploader/types.d.ts +138 -0
  44. package/dist/types/components/file-uploader/utils/chunk-handlers.d.ts +40 -0
  45. package/dist/types/components/file-uploader/utils/ensure-handlers.d.ts +7 -0
  46. package/dist/types/components/file-uploader/utils/error-handler.d.ts +59 -0
  47. package/dist/types/components/file-uploader/utils/upload-controllers.d.ts +72 -0
  48. package/dist/types/components/file-uploader/utils/upload-handler.d.ts +17 -0
  49. package/dist/types/components/file-uploader/utils/validate-handlers.d.ts +6 -0
  50. package/dist/types/components/section-heading/index.d.ts +1 -1
  51. package/dist/types/index.d.ts +1 -0
  52. package/es/index.js +1 -1
  53. package/lib/index.js +1 -1
  54. package/package.json +2 -2
  55. package/tailwind.config.js +4 -0
@@ -0,0 +1,249 @@
1
+ ---
2
+ applyTo: '**'
3
+ ---
4
+ Provide project context and coding guidelines that AI should follow when generating code, answering questions, or reviewing changes.
5
+
6
+ INITIALIZATION PHASE:
7
+ When user provides initial project instruction:
8
+ - STOP and analyze if the instruction is high-level or lacks detail
9
+ - ASK clarifying questions about:
10
+ * Specific features and functionality required
11
+ * Technology stack preferences
12
+ * UI/UX requirements and design preferences
13
+ * Data models and business logic
14
+ * Integration requirements (APIs, databases, third-party services)
15
+ * User workflows and interactions
16
+ * Performance requirements
17
+ * Security and authentication needs
18
+ - Continue asking questions until user explicitly says "enough" or "that's sufficient"
19
+ - NEVER start coding during this phase
20
+ - Focus ONLY on understanding requirements completely
21
+
22
+ AFTER REQUIREMENTS GATHERING:
23
+ Once user confirms requirements are sufficient:
24
+ - Check if a bundler/package manager is detected (package.json, vite.config, etc.)
25
+ - If bundler detected: Create ONLY feature_list.json
26
+ - If NO bundler detected: Create init.sh AND feature_list.json
27
+ - DO NOT write any code yet
28
+ - STOP after creating these files
29
+
30
+ FEATURE_LIST.JSON TEMPLATE:
31
+ ``` json
32
+ {
33
+ "features": [
34
+ {
35
+ "id": 1,
36
+ "category": "functional",
37
+ "description": "Clear one-line description of what user can do",
38
+ "steps": [
39
+ "Concrete step 1 to test",
40
+ "Concrete step 2 to test",
41
+ "Concrete step 3 to verify expected outcome"
42
+ ],
43
+ "passes": false,
44
+ "estimatedTime": "15-20 minutes",
45
+ "dependencies": []
46
+ }
47
+ ]
48
+ }
49
+ ```
50
+
51
+ Categories: "functional", "performance", "security", "ui/ux", "data", "integration"
52
+
53
+ CLAUDE-PROGRESS.TXT TEMPLATE:
54
+ ```
55
+ === Session [Date/Time] ===
56
+ Feature ID: [#]
57
+ Feature: [Feature description from feature_list.json]
58
+ Implementation Approach: [Brief description of how it was implemented]
59
+ Files Created/Modified:
60
+ - file1.js (85 lines) - [what was changed]
61
+ - file2.html (45 lines) - [what was changed]
62
+ - mock/testData.js (150 lines - mock data)
63
+ Status: Completed / Partially Complete / Blocked
64
+ Changes Made:
65
+ - [Specific change 1]
66
+ - [Specific change 2]
67
+ Issues Encountered:
68
+ - [Any problems or limitations]
69
+ Solutions Applied:
70
+ - [How issues were resolved]
71
+ File Size Check: All files under 120 lines ✓ / Required refactoring ✗
72
+ Tests Performed:
73
+ - [What tests were run]
74
+ Next Feature Suggested: [Feature ID and description]
75
+ App State: Working / Needs Testing / Broken
76
+ ---
77
+ ```
78
+
79
+ INIT.SH TEMPLATE (Only if no bundler detected):
80
+ ```
81
+ #!/bin/bash
82
+ # Purpose: Start development environment
83
+ # Should include:
84
+ # - Dependency installation (if needed)
85
+ # - Database startup (if applicable)
86
+ # - Development server startup
87
+ # - Any required environment variables
88
+ # Must be runnable multiple times safely
89
+ ```
90
+
91
+ FEATURE SIZE REQUIREMENTS:
92
+ - Each feature must be completable in ONE conversation session
93
+ - Break down complex features into multiple small features
94
+ - Each feature should take 15-30 minutes maximum
95
+ - Features must be independently testable
96
+ - Features must be focused on ONE specific capability
97
+ - Example: Instead of "User authentication system", break into:
98
+ * "User can register with email and password"
99
+ * "User can login with credentials"
100
+ * "User can logout"
101
+ * "User can reset password via email"
102
+
103
+ EVERY SESSION START (Working on ONE feature):
104
+ - Run pwd to confirm working directory
105
+ - Read claude-progress.txt to understand what was last completed
106
+ - Read git log (last 5-10 commits) for recent changes
107
+ - Look at feature_list.json to see current feature status
108
+ - User will tell you which feature to work on OR work on next incomplete feature
109
+ - If init.sh exists, run it to start development environment
110
+ - If no init.sh (bundler detected), start dev server using package manager (npm run dev, yarn dev, etc.)
111
+ - Run basic smoke test to verify app works
112
+
113
+ IMPLEMENTATION PLANNING PHASE (BEFORE ANY CODING):
114
+ After understanding the current feature, MUST do this:
115
+ - Explain your implementation approach in detail:
116
+ * Which files will be created/modified
117
+ * What code structure you'll use
118
+ * How you'll keep files under 120 lines
119
+ * Where mock data will be stored (separate file)
120
+ * What libraries or dependencies needed
121
+ * How you'll implement the logic
122
+ * How you'll test the feature
123
+ * Any potential challenges or trade-offs
124
+ - Present your plan clearly and wait for user feedback
125
+ - DISCUSS with user - they may have preferences on:
126
+ * Architecture decisions
127
+ * Code organization
128
+ * Technology choices
129
+ * Implementation approach
130
+ - Adjust plan based on user input
131
+ - ONLY start coding after user explicitly approves (says "go ahead", "looks good", "start", etc.)
132
+ - If user suggests changes, revise plan and confirm again
133
+
134
+ IMPLEMENTATION PLAN FORMAT:
135
+ ## Implementation Plan for: [Feature Name]
136
+
137
+ **Files to Create/Modify:**
138
+ - file1.js (~70 lines) - [what changes]
139
+ - file2.html (~40 lines) - [what changes]
140
+ - utils/helpers.js (~30 lines) - [extracted utilities]
141
+ - mock/featureData.js (~80 lines) - [mock data for this feature]
142
+
143
+ **File Organization Strategy:**
144
+ [Explain how you'll keep files under 120 lines]
145
+
146
+ **Mock Data Location:**
147
+ [Specify which mock data file(s) and what data they contain]
148
+
149
+ **Approach:**
150
+ [Detailed explanation of implementation strategy]
151
+
152
+ **Dependencies/Libraries:**
153
+ [Any new packages or tools needed]
154
+
155
+ **Testing Strategy:**
156
+ [How you'll verify it works]
157
+
158
+ **Trade-offs/Considerations:**
159
+ [Any architectural decisions or potential issues]
160
+
161
+ **Estimated Time:** [X minutes]
162
+
163
+ Does this approach work for you? Any preferences or changes?
164
+
165
+ FILE SIZE AND ORGANIZATION RULES:
166
+ - EVERY file must be 120 lines or below (HARD LIMIT)
167
+ - If a file approaches 120 lines, MUST split into multiple files
168
+ - Use modular architecture to keep files small:
169
+ * Separate concerns into different files
170
+ * Extract utilities into separate files
171
+ * Split large components into smaller sub-components
172
+ * Create separate files for constants, types, interfaces
173
+ - Mock data MUST ALWAYS be in separate files:
174
+ * Create mock/ or data/ directory for all mock data
175
+ * File naming: mockUsers.js, mockProducts.json, testData.js, etc.
176
+ * NEVER inline large mock data arrays/objects in implementation files
177
+ * Even small mock data (3+ items) should be in separate file
178
+ - When a file reaches ~100 lines, proactively refactor before adding more
179
+ - Prefer many small focused files over few large files
180
+
181
+ DURING SESSION - SINGLE FEATURE FOCUS:
182
+ - Work ONLY on the current feature being discussed
183
+ - Do NOT look ahead to other features
184
+ - Do NOT implement anything beyond the current feature scope
185
+ - Stay laser-focused on completing this ONE feature
186
+ - If you notice the feature is too large, STOP and suggest breaking it into smaller features
187
+ - If you need to deviate from approved plan, STOP and discuss changes with user first
188
+ - If any file exceeds 120 lines during implementation, STOP and refactor before continuing
189
+
190
+ TESTING FOR CURRENT FEATURE:
191
+ - Test ONLY the current feature end-to-end
192
+ - Use browser automation for web features
193
+ - Verify the specific acceptance criteria in feature_list.json
194
+ - Do NOT test unrelated features unless they break
195
+
196
+ SESSION END (After completing ONE feature):
197
+ FOLLOW THIS EXACT ORDER:
198
+ 1. Verify ALL files are under 120 lines (except mock data files)
199
+ 2. Ensure code is in clean state
200
+ 3. Update claude-progress.txt with complete session information
201
+ 4. Update feature_list.json: change ONLY current feature's "passes" to true
202
+ 5. WAIT for user to say "commit" or give commit instruction
203
+ 6. When user says "commit": Write git commit with descriptive message
204
+ 7. STOP - user will start new conversation for next feature
205
+
206
+ COMMIT RULES:
207
+ - NEVER commit automatically
208
+ - ONLY commit when user explicitly says "commit", "git commit", "save this", or similar
209
+ - Wait for user instruction before committing
210
+ - Commit message should be descriptive of the feature completed
211
+ - Commit includes: code changes + claude-progress.txt + feature_list.json
212
+
213
+ SINGLE FEATURE CONVERSATION FLOW:
214
+ 1. Read context (progress file, git log, feature list)
215
+ 2. Confirm which feature to work on
216
+ 3. Start dev environment (init.sh or bundler command)
217
+ 4. Verify app still works (smoke test)
218
+ 5. Present implementation plan and WAIT for approval
219
+ 6. Discuss and adjust plan based on user feedback
220
+ 7. Get explicit approval before coding
221
+ 8. Implement ONLY that feature (following approved plan)
222
+ 9. Monitor file sizes - refactor immediately if approaching 120 lines
223
+ 10. Ensure mock data is in separate files
224
+ 11. Test ONLY that feature
225
+ 12. Verify all files under 120 lines
226
+ 13. Update claude-progress.txt (document everything)
227
+ 14. Update feature_list.json (mark feature as passes: true)
228
+ 15. WAIT for user to say "commit"
229
+ 16. When user says commit: Write git commit with descriptive message
230
+ 17. STOP - end conversation
231
+
232
+ BETWEEN CONVERSATIONS:
233
+ - User starts fresh conversation for each new feature
234
+ - Each conversation = ONE feature from feature_list.json
235
+ - Context resets between features (this is intentional)
236
+ - Progress tracking via git commits + claude-progress.txt + feature_list.json
237
+
238
+ FORBIDDEN BEHAVIORS:
239
+ - Never start coding during requirements gathering
240
+ - Never create more than necessary files during initialization (only feature_list.json if bundler detected, or init.sh + feature_list.json if no bundler)
241
+ - Never work on multiple features in one conversation
242
+ - Never look ahead or prepare for future features
243
+ - Never create large features that span multiple conversations
244
+ - NEVER start coding before presenting and discussing implementation plan
245
+ - NEVER start coding without explicit user approval
246
+ - NEVER create files over 120 lines (except mock data files)
247
+ - NEVER put mock data inline in implementation files
248
+ - NEVER continue coding if a file exceeds 120 lines without refactoring first
249
+ - NEVER commit without user explicitly instructing to commit
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  ### 组件文档站点
8
8
 
9
- https://shelwinjue.github.io/fe-assets/data-hub-ui/doc
9
+ https://fe.shelwin.xyz/data-hub-ui/doc
10
10
 
11
11
 
12
12
 
@@ -0,0 +1 @@
1
+ export default function Demo(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export interface IProps {
3
+ open?: boolean;
4
+ onCancel?: (e: React.MouseEvent<HTMLButtonElement>) => void;
5
+ }
6
+ /**
7
+ * 申请权限弹窗
8
+ * @param props
9
+ * @returns
10
+ */
11
+ declare function ApplyPermModal(props: IProps): import("react/jsx-runtime").JSX.Element;
12
+ declare namespace ApplyPermModal {
13
+ var confirm: (props?: IProps) => void;
14
+ }
15
+ export default ApplyPermModal;
@@ -0,0 +1 @@
1
+ export default function Moha(): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,7 @@
1
- import React from 'react';
1
+ import React, { type JSX } from 'react';
2
2
  import './index.css';
3
+ type Align = 'left' | 'center' | 'right';
4
+ type Size = 'sm' | 'md' | 'lg';
3
5
  export interface FeatureCardClassNames {
4
6
  root?: string;
5
7
  icon?: string;
@@ -14,6 +16,10 @@ export interface FeatureCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
14
16
  cardTitle?: React.ReactNode;
15
17
  description?: React.ReactNode;
16
18
  titleAs?: keyof JSX.IntrinsicElements;
19
+ /** Alignment: left (default), center, right */
20
+ align?: Align;
21
+ /** Size: sm, md (default), lg */
22
+ size?: Size;
17
23
  /** Custom classNames for each element */
18
24
  classNames?: FeatureCardClassNames;
19
25
  }
@@ -0,0 +1,6 @@
1
+ import './circle-progress.css';
2
+ export declare function CircleProgress({ percent, isFailed, isCompleted, }: {
3
+ percent: number;
4
+ isFailed: boolean;
5
+ isCompleted: boolean;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { type DragEvent } from 'react';
2
+ import type { DropZoneError } from '../uploader-drop-zone';
3
+ interface UseDropZoneProps {
4
+ disabled: boolean;
5
+ directory: boolean;
6
+ accept: string;
7
+ onFilesReady: (files: File[]) => void;
8
+ onError?: (error: DropZoneError) => void;
9
+ }
10
+ export declare function useDropZone({ disabled, directory, accept, onFilesReady, onError }: UseDropZoneProps): {
11
+ isDragging: boolean;
12
+ handleDragEnter: (e: DragEvent<HTMLElement>) => void;
13
+ handleDragOver: (e: DragEvent<HTMLElement>) => void;
14
+ handleDragLeave: (e: DragEvent<HTMLElement>) => void;
15
+ handleDrop: (e: DragEvent<HTMLElement>) => Promise<void>;
16
+ };
17
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { DropZoneError } from '../uploader-drop-zone';
2
+ interface UseFileValidationProps {
3
+ maxSize?: number;
4
+ maxFiles?: number;
5
+ fileValidation?: (file: File) => boolean | Promise<boolean>;
6
+ onDrop: (files: File[]) => void;
7
+ onError?: (error: DropZoneError) => void;
8
+ }
9
+ export declare function useFileValidation({ maxSize, maxFiles, fileValidation, onDrop, onError, }: UseFileValidationProps): {
10
+ processFiles: (files: File[]) => Promise<void>;
11
+ };
12
+ export {};
@@ -0,0 +1,5 @@
1
+ export default function UploadIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function FileIcon(): import("react/jsx-runtime").JSX.Element;
3
+ export declare function CloseIcon(): import("react/jsx-runtime").JSX.Element;
4
+ export declare function PauseIcon(): import("react/jsx-runtime").JSX.Element;
5
+ export declare function ResumeIcon(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,49 @@
1
+ import { type ReactNode } from 'react';
2
+ import './theme.css';
3
+ import './uploader-drop-zone.css';
4
+ export interface UploadDropZoneClassNames {
5
+ /** Container wrapper class */
6
+ container?: string;
7
+ /** Drag area class */
8
+ dragArea?: string;
9
+ /** Additional class when dragging is active */
10
+ dragging?: string;
11
+ /** Additional class when disabled */
12
+ disabled?: string;
13
+ /** Icon wrapper class */
14
+ icon?: string;
15
+ /** Description text class */
16
+ description?: string;
17
+ /** File input class */
18
+ input?: string;
19
+ }
20
+ export interface UploadDropZoneProps {
21
+ /** File type filter (e.g., "image/*,video/*" or ".pdf,.doc") */
22
+ accept?: string;
23
+ /** Maximum file size in bytes */
24
+ maxSize?: number;
25
+ /** Maximum number of files allowed */
26
+ maxFiles?: number;
27
+ /** Support folder/directory drop (recursive) */
28
+ directory?: boolean;
29
+ /** Disable the drop zone */
30
+ disabled?: boolean;
31
+ /** Description text for drag area */
32
+ dragAreaDescription?: ReactNode;
33
+ /** Custom icon - can be a React component or image/svg path */
34
+ icon?: ReactNode | string;
35
+ /** Custom class names for different elements */
36
+ classNames?: UploadDropZoneClassNames;
37
+ /** Callback when files are dropped or selected */
38
+ onDrop: (files: File[]) => void;
39
+ /** custom file validation callback */
40
+ fileValidation?: (file: File) => boolean | Promise<boolean>;
41
+ /** Called when validation fails */
42
+ onError?: (error: DropZoneError) => void;
43
+ }
44
+ export interface DropZoneError {
45
+ type: 'FILE_TOO_LARGE' | 'TOO_MANY_FILES' | 'INVALID_TYPE' | 'DROP_FAILED';
46
+ message: string;
47
+ rejectedFiles?: File[];
48
+ }
49
+ export declare function UploadDropZone({ accept, maxSize, maxFiles, directory, disabled, dragAreaDescription, icon, classNames, onDrop, fileValidation, onError, }: UploadDropZoneProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,40 @@
1
+ import type { UploadFile } from '../types';
2
+ import './theme.css';
3
+ import './uploader-file-item.css';
4
+ export interface UploaderFileItemClassNames {
5
+ /** Root container class */
6
+ container?: string;
7
+ /** File info section wrapper */
8
+ info?: string;
9
+ /** File icon wrapper */
10
+ icon?: string;
11
+ /** File name text */
12
+ name?: string;
13
+ /** Status section wrapper */
14
+ status?: string;
15
+ /** Status text */
16
+ statusText?: string;
17
+ /** Progress component wrapper */
18
+ progress?: string;
19
+ /** Pause button */
20
+ pauseBtn?: string;
21
+ /** Resume button */
22
+ resumeBtn?: string;
23
+ /** Close/Cancel button */
24
+ closeBtn?: string;
25
+ }
26
+ interface FileItemProps {
27
+ file: UploadFile;
28
+ /** Custom class names for different elements */
29
+ classNames?: UploaderFileItemClassNames;
30
+ /** Cancel function passed from parent that has upload handlers */
31
+ onCancel?: (id: string) => void;
32
+ /** Remove function passed from parent that has upload handlers */
33
+ onRemove?: (id: string) => void;
34
+ /** Pause function passed from parent that has upload handlers */
35
+ onPause?: (id: string) => void;
36
+ /** Resume function passed from parent that has upload handlers */
37
+ onResume?: (id: string) => void;
38
+ }
39
+ export declare function UploaderFileItem({ file, classNames, onCancel, onRemove, onPause, onResume }: FileItemProps): import("react/jsx-runtime").JSX.Element;
40
+ export {};
@@ -0,0 +1,29 @@
1
+ import './theme.css';
2
+ import './uploader-file-list.css';
3
+ export interface FileListClassNames {
4
+ /** File list container */
5
+ container?: string;
6
+ /** Empty state wrapper */
7
+ empty?: string;
8
+ }
9
+ interface FileListProps {
10
+ /** Custom class names for different elements */
11
+ classNames?: FileListClassNames;
12
+ /** Empty state text or component */
13
+ emptyText?: string;
14
+ /** Children components (e.g., file items) */
15
+ children: React.ReactNode;
16
+ }
17
+ /**
18
+ * Simple file list component that displays all uploaded files.
19
+ * Uses the useUploadFiles hook to access file state.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * <FileList
24
+ * emptyText="No files uploaded yet"
25
+ * />
26
+ * ```
27
+ */
28
+ export declare function UploaderFileListLayout({ classNames, emptyText, children }: FileListProps): import("react/jsx-runtime").JSX.Element;
29
+ export {};
@@ -0,0 +1,64 @@
1
+ import './theme.css';
2
+ import './uploader.css';
3
+ import { type ReactNode } from 'react';
4
+ import { type DropZoneError, type UploadDropZoneClassNames } from './uploader-drop-zone';
5
+ import type { UploadHandlers } from '../types';
6
+ import { type FileListClassNames } from './uploader-file-list';
7
+ import { type UploaderFileItemClassNames } from './uploader-file-item';
8
+ interface UploaderProps {
9
+ /** Provide handlers per file (decided at selection time) */
10
+ handlers: UploadHandlers;
11
+ /** Arbitrary runtime context to rebuild handlers after reload */
12
+ runtime?: unknown;
13
+ /** Optional description text for drag area */
14
+ dragAreaDescription?: ReactNode;
15
+ /** Accept file types */
16
+ accept?: string;
17
+ /** Enable directory/folder upload */
18
+ directory?: boolean;
19
+ /** Maximum number of files */
20
+ maxFiles?: number;
21
+ /** Maximum file size in bytes (per-usage option) */
22
+ maxSize?: number;
23
+ /** Additional class name for the uploader container */
24
+ classNames?: {
25
+ container?: string;
26
+ dragZone?: UploadDropZoneClassNames;
27
+ fileList?: UploaderFileItemClassNames;
28
+ fileItem?: FileListClassNames;
29
+ };
30
+ /** Error callback for upload errors */
31
+ onDropZoneError?: (error: DropZoneError) => void;
32
+ /** custom file validation callback */
33
+ fileValidation?: (file: File) => boolean | Promise<boolean>;
34
+ }
35
+ /**
36
+ * Styled File Uploader - Matches FileUploader capabilities with custom styling
37
+ *
38
+ * Note: This component must be used within an UploadProvider.
39
+ * The UploadProvider should be placed at the app level for shared state and global config.
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * // App level - with global config
44
+ * <UploadProvider config={{ concurrentFiles: 3 }}>
45
+ * <App />
46
+ * </UploadProvider>
47
+ *
48
+ * // Component level - provide handlers with local context
49
+ * <StyledUploader
50
+ * maxFileSize={10 * 1024 * 1024 * 1024} // 10GB for this dataset
51
+ * getHandlers={(file) => ({
52
+ * onGetUploadUrls: (fileName, partCount) =>
53
+ * api.getUrls(datasetId, fileName, partCount, resolveFolderFromUI()),
54
+ * onPartComplete: (fileName, uploadId, partNum) =>
55
+ * api.markPartComplete(datasetId, uploadId, partNum),
56
+ * onFileComplete: (fileName, uploadId) =>
57
+ * api.complete(datasetId, uploadId),
58
+ * })}
59
+ * />
60
+ * ```
61
+ */
62
+ export declare function Uploader({ handlers, runtime, dragAreaDescription, accept, directory, maxFiles, maxSize, // 10GB default
63
+ classNames, onDropZoneError, fileValidation, }: UploaderProps): import("react/jsx-runtime").JSX.Element;
64
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Recursively reads files from a FileSystemEntry (file or directory)
3
+ */
4
+ export declare function readEntry(entry: FileSystemEntry, acceptFilter: string): Promise<File[]>;
@@ -0,0 +1,27 @@
1
+ export declare const KB = 1024;
2
+ export declare const MB: number;
3
+ export declare const GB: number;
4
+ export declare const DEFAULT_CHUNK_SIZE: number;
5
+ export declare const DEFAULT_MAX_CHUNK_SIZE: number;
6
+ export declare const DEFAULT_MIN_CHUNK_SIZE: number;
7
+ export declare const DEFAULT_CONCURRENT_CHUNKS = 2;
8
+ export declare const DEFAULT_CONCURRENT_FILES = 1;
9
+ export declare const DEFAULT_MAX_FILE_SIZE: number;
10
+ export declare const UploadStatus: {
11
+ readonly PENDING: "pending";
12
+ readonly PREPARING: "preparing";
13
+ readonly UPLOADING: "uploading";
14
+ readonly PAUSED: "paused";
15
+ readonly MERGING: "merging";
16
+ readonly COMPLETED: "completed";
17
+ readonly FAILED: "failed";
18
+ readonly CANCELLED: "cancelled";
19
+ };
20
+ export type UploadStatusType = (typeof UploadStatus)[keyof typeof UploadStatus];
21
+ export declare const ChunkStatus: {
22
+ readonly PENDING: "pending";
23
+ readonly UPLOADING: "uploading";
24
+ readonly COMPLETED: "completed";
25
+ readonly FAILED: "failed";
26
+ };
27
+ export type ChunkStatusType = (typeof ChunkStatus)[keyof typeof ChunkStatus];
@@ -0,0 +1,64 @@
1
+ import type { UploadFile } from '../types';
2
+ /**
3
+ * Global file state store for background uploads.
4
+ *
5
+ * This store maintains a copy of file state that can be accessed
6
+ * even when the originating React component is unmounted.
7
+ *
8
+ * The store is updated whenever React state changes, ensuring
9
+ * QueueManager callbacks always have access to fresh file data.
10
+ *
11
+ * Flow:
12
+ * 1. UploadProvider updates state via reducer
13
+ * 2. Provider syncs state to this store via useEffect
14
+ * 3. QueueManager callbacks access files via getFile()
15
+ * 4. Even if user navigates away, store still has current data
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * // In UploadProvider - sync state to store
20
+ * useEffect(() => {
21
+ * fileStateStore.syncFiles(state.files);
22
+ * }, [state.files]);
23
+ *
24
+ * // In queue callbacks - get fresh file data
25
+ * const file = fileStateStore.getFile(fileId);
26
+ * ```
27
+ */
28
+ declare class FileStateStore {
29
+ /** Current files indexed by ID for O(1) lookup */
30
+ private filesMap;
31
+ /**
32
+ * Sync files from React state to the global store.
33
+ * Called by UploadProvider whenever state.files changes.
34
+ */
35
+ syncFiles(files: UploadFile[]): void;
36
+ /**
37
+ * Get a file by ID.
38
+ * Returns undefined if file not found.
39
+ */
40
+ getFile(fileId: string): UploadFile | undefined;
41
+ /**
42
+ * Check if a file exists in the store.
43
+ */
44
+ hasFile(fileId: string): boolean;
45
+ /**
46
+ * Get all files (for debugging).
47
+ */
48
+ getAllFiles(): UploadFile[];
49
+ /**
50
+ * Clear all files from the store.
51
+ * Called when UploadProvider unmounts.
52
+ */
53
+ clear(): void;
54
+ /**
55
+ * Get the number of files in the store.
56
+ */
57
+ get size(): number;
58
+ }
59
+ /**
60
+ * Singleton instance of the file state store.
61
+ * Shared across all upload components and QueueManager.
62
+ */
63
+ export declare const fileStateStore: FileStateStore;
64
+ export {};