@app-studio/web 0.9.41 → 0.9.43

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 (88) hide show
  1. package/dist/bot/Bot.d.ts +15 -0
  2. package/dist/bot/Cache.d.ts +13 -0
  3. package/dist/bot/Config.d.ts +13 -0
  4. package/dist/bot/ContentFetcher.d.ts +9 -0
  5. package/dist/bot/DocuCode.d.ts +19 -0
  6. package/dist/bot/FileHandler.d.ts +39 -0
  7. package/dist/bot/ai/AnthropicConnector.d.ts +6 -0
  8. package/dist/bot/ai/GeminiConnector.d.ts +7 -0
  9. package/dist/bot/ai/GroqConnector.d.ts +7 -0
  10. package/dist/bot/ai/HuggingFaceConnector.d.ts +6 -0
  11. package/dist/bot/ai/OpenAIConnector.d.ts +11 -0
  12. package/dist/bot/ai/ReplicateConnector.d.ts +7 -0
  13. package/dist/bot/ai/SambaNovaConnector.d.ts +6 -0
  14. package/dist/bot/ai/ai.config.d.ts +12 -0
  15. package/dist/bot/ai/ai.service.d.ts +36 -0
  16. package/dist/bot/data.d.ts +19 -0
  17. package/dist/bot/extractors.d.ts +8 -0
  18. package/dist/bot/index.d.ts +1 -0
  19. package/dist/bot/prompt/1-project.d.ts +1 -0
  20. package/dist/bot/prompt/2-response.d.ts +1 -0
  21. package/dist/bot/prompt/3-comment.d.ts +1 -0
  22. package/docs/components/Accordion.mdx +74 -121
  23. package/docs/components/Alert.mdx +19 -70
  24. package/docs/components/AspectRatio.mdx +13 -11
  25. package/docs/components/AudioInput.mdx +43 -0
  26. package/docs/components/Avatar.mdx +18 -43
  27. package/docs/components/Background.mdx +100 -492
  28. package/docs/components/Badge.mdx +45 -130
  29. package/docs/components/Button.mdx +76 -128
  30. package/docs/components/Calendar.mdx +7 -7
  31. package/docs/components/Card.mdx +247 -290
  32. package/docs/components/Carousel.mdx +94 -321
  33. package/docs/components/Chart.mdx +171 -26
  34. package/docs/components/ChatInput.mdx +327 -275
  35. package/docs/components/Checkbox.mdx +3 -5
  36. package/docs/components/ColorInput.mdx +6 -6
  37. package/docs/components/ColorPicker.mdx +452 -0
  38. package/docs/components/ComboBox.mdx +13 -13
  39. package/docs/components/Command.mdx +140 -188
  40. package/docs/components/ContextMenu.mdx +47 -171
  41. package/docs/components/CookieConsent.mdx +53 -0
  42. package/docs/components/CountryPicker.mdx +8 -8
  43. package/docs/components/DatePicker.mdx +3 -3
  44. package/docs/components/DragAndDrop.mdx +279 -463
  45. package/docs/components/Drawer.mdx +392 -231
  46. package/docs/components/DropdownMenu.mdx +37 -155
  47. package/docs/components/EmojiPicker.mdx +84 -0
  48. package/docs/components/File.mdx +130 -4
  49. package/docs/components/Formik.mdx +39 -39
  50. package/docs/components/Gradient.mdx +359 -182
  51. package/docs/components/Horizontal.mdx +1 -2
  52. package/docs/components/HoverCard.mdx +57 -125
  53. package/docs/components/KanbanBoard.mdx +9 -9
  54. package/docs/components/Link.mdx +22 -30
  55. package/docs/components/Loader.mdx +230 -413
  56. package/docs/components/Menubar.mdx +73 -69
  57. package/docs/components/Message.mdx +210 -525
  58. package/docs/components/Modal.mdx +351 -475
  59. package/docs/components/NavigationMenu.mdx +8 -8
  60. package/docs/components/OTPInput.mdx +194 -0
  61. package/docs/components/Pagination.mdx +451 -107
  62. package/docs/components/Password.mdx +8 -8
  63. package/docs/components/ProgressBar.mdx +460 -0
  64. package/docs/components/Resizable.mdx +103 -102
  65. package/docs/components/Select.mdx +5 -5
  66. package/docs/components/Separator.mdx +11 -98
  67. package/docs/components/ShareButton.mdx +29 -0
  68. package/docs/components/Sidebar.mdx +70 -131
  69. package/docs/components/Slider.mdx +99 -185
  70. package/docs/components/StatusIndicator.mdx +373 -0
  71. package/docs/components/Switch.mdx +3 -3
  72. package/docs/components/Table.mdx +25 -105
  73. package/docs/components/Tabs.mdx +40 -143
  74. package/docs/components/TagInput.mdx +17 -17
  75. package/docs/components/Text.mdx +3 -3
  76. package/docs/components/TextArea.mdx +6 -6
  77. package/docs/components/TextField.mdx +12 -12
  78. package/docs/components/Title.mdx +267 -525
  79. package/docs/components/Toast.mdx +65 -142
  80. package/docs/components/Toggle.mdx +37 -49
  81. package/docs/components/ToggleGroup.mdx +36 -57
  82. package/docs/components/Tooltip.mdx +501 -138
  83. package/docs/components/Uploader.mdx +205 -351
  84. package/package.json +1 -1
  85. package/dist/components/AuthGuard/AuthGuard.d.ts +0 -35
  86. package/dist/components/AuthGuard/index.d.ts +0 -1
  87. package/docs/adk-components.md +0 -319
  88. package/docs/adk-quick-start.md +0 -268
@@ -1,426 +1,280 @@
1
1
  # Uploader
2
2
 
3
- A versatile file upload component with support for single and multiple file uploads, drag & drop functionality, file validation, preview capabilities, and progress tracking. Perfect for handling images, videos, documents, and any file type with built-in error handling and customizable UI.
3
+ A versatile file upload component with support for images, videos, and files, featuring drag-and-drop, preview, progress tracking, and validation.
4
4
 
5
5
  ### **Import**
6
- ```tsx
7
- import { Uploader } from '@app-studio/web';
8
- ```
9
-
10
- ### **Basic Usage**
11
6
  ```tsx
12
- import React from 'react';
13
7
  import { Uploader } from '@app-studio/web';
14
- import { UploadIcon } from '@app-studio/web';
15
-
16
- export const BasicUploader = () => {
17
- const handleFileSelect = (file: File) => {
18
- console.log('Selected file:', file);
19
- // Handle the uploaded file
20
- };
21
-
22
- return (
23
- <Uploader
24
- icon={<UploadIcon widthHeight={32} />}
25
- text="Click to upload a file"
26
- onFileSelect={handleFileSelect}
27
- maxSize={10 * 1024 * 1024} // 10MB limit
28
- />
29
- );
30
- };
31
8
  ```
32
9
 
33
- ### **Multiple File Upload**
10
+ ### **Default**
34
11
  ```tsx
35
- import React, { useState } from 'react';
12
+ import React from 'react';
36
13
  import { Uploader } from '@app-studio/web';
37
- import { UploadIcon } from '@app-studio/web';
38
14
 
39
- export const MultipleFileUploader = () => {
40
- const [selectedFiles, setSelectedFiles] = useState<File[]>([]);
15
+ export const DefaultUploader = () => (
16
+ <Uploader
17
+ onFileSelect={(file) => console.log('Selected:', file)}
18
+ />
19
+ );
20
+ ```
41
21
 
42
- const handleMultipleFileSelect = (files: File[]) => {
43
- console.log('Selected files:', files);
44
- setSelectedFiles(files);
45
- };
22
+ ### **accept**
23
+ Specifies which file types are accepted for upload.
46
24
 
47
- return (
48
- <Uploader
49
- icon={<UploadIcon widthHeight={32} />}
50
- text="Click to upload multiple files"
51
- multiple={true}
52
- onMultipleFileSelect={handleMultipleFileSelect}
53
- maxSize={50 * 1024 * 1024} // 50MB limit per file
54
- accept="image/*,video/*,.pdf,.doc,.docx"
55
- />
56
- );
57
- };
58
- ```
25
+ - **Type:** `string`
26
+ - **Default:** `'*/*'`
59
27
 
60
- ### **Image Upload with Preview**
61
28
  ```tsx
62
- import React, { useState } from 'react';
29
+ import React from 'react';
63
30
  import { Uploader } from '@app-studio/web';
64
- import { ImageIcon } from '@app-studio/web';
65
-
66
- export const ImageUploader = () => {
67
- const [isLoading, setIsLoading] = useState(false);
68
- const [progress, setProgress] = useState(0);
69
-
70
- const handleImageSelect = (file: File) => {
71
- console.log('Selected image:', file);
72
-
73
- // Simulate upload progress
74
- setIsLoading(true);
75
- setProgress(0);
76
-
77
- const interval = setInterval(() => {
78
- setProgress((prev) => {
79
- if (prev >= 100) {
80
- clearInterval(interval);
81
- setIsLoading(false);
82
- return 100;
83
- }
84
- return prev + 10;
85
- });
86
- }, 200);
87
- };
88
-
89
- return (
90
- <Uploader
91
- accept="image/*"
92
- icon={<ImageIcon widthHeight={32} />}
93
- text="Upload Image"
94
- onFileSelect={handleImageSelect}
95
- isLoading={isLoading}
96
- progress={progress}
97
- fileType="image"
98
- maxSize={5 * 1024 * 1024} // 5MB limit
99
- containerProps={{
100
- height: progress === 100 ? '200px' : 'auto',
101
- minHeight: '120px'
102
- }}
31
+ import { Vertical } from 'app-studio';
32
+
33
+ export const FileTypeUploader = () => (
34
+ <Vertical gap={15}>
35
+ <Uploader
36
+ accept="image/*"
37
+ onFileSelect={(file) => console.log(file)}
38
+ text="Upload Images"
103
39
  />
104
- );
105
- };
40
+ <Uploader
41
+ accept="video/*"
42
+ onFileSelect={(file) => console.log(file)}
43
+ text="Upload Videos"
44
+ />
45
+ <Uploader
46
+ accept=".pdf,.doc,.docx"
47
+ onFileSelect={(file) => console.log(file)}
48
+ text="Upload Documents"
49
+ />
50
+ </Vertical>
51
+ );
106
52
  ```
107
53
 
108
- ### **Video Upload with Thumbnail**
54
+ ### **multiple**
55
+ Allow multiple file selection.
56
+
57
+ - **Type:** `boolean`
58
+ - **Default:** `false`
59
+
109
60
  ```tsx
110
- import React, { useState } from 'react';
61
+ import React from 'react';
111
62
  import { Uploader } from '@app-studio/web';
112
- import { VideoIcon } from '@app-studio/web';
113
63
 
114
- export const VideoUploader = () => {
115
- const [isLoading, setIsLoading] = useState(false);
116
- const [progress, setProgress] = useState(0);
64
+ export const MultipleUploader = () => (
65
+ <Uploader
66
+ multiple
67
+ onMultipleFileSelect={(files) => {
68
+ console.log(`Selected ${files.length} files`);
69
+ }}
70
+ text="Upload Multiple Files"
71
+ />
72
+ );
73
+ ```
117
74
 
118
- const handleVideoSelect = (file: File) => {
119
- console.log('Selected video:', file);
120
-
121
- // Simulate upload progress
122
- setIsLoading(true);
123
- setProgress(0);
124
-
125
- const interval = setInterval(() => {
126
- setProgress((prev) => {
127
- if (prev >= 100) {
128
- clearInterval(interval);
129
- setIsLoading(false);
130
- return 100;
131
- }
132
- return prev + 5;
133
- });
134
- }, 300);
135
- };
75
+ ### **maxSize**
76
+ Maximum file size in bytes.
136
77
 
137
- return (
138
- <Uploader
139
- accept="video/*"
140
- icon={<VideoIcon widthHeight={32} />}
141
- text="Upload Video"
142
- onFileSelect={handleVideoSelect}
143
- isLoading={isLoading}
144
- progress={progress}
145
- fileType="video"
146
- maxSize={100 * 1024 * 1024} // 100MB limit
147
- containerProps={{
148
- height: progress === 100 ? '200px' : 'auto',
149
- minHeight: '120px'
150
- }}
151
- />
152
- );
153
- };
154
- ```
78
+ - **Type:** `number`
155
79
 
156
- ### **File Validation**
157
80
  ```tsx
158
81
  import React from 'react';
159
82
  import { Uploader } from '@app-studio/web';
160
- import { UploadIcon } from '@app-studio/web';
161
83
 
162
- export const ValidatedUploader = () => {
163
- const validateFile = (file: File): string | null => {
164
- // Custom validation logic
165
- if (file.size > 10 * 1024 * 1024) {
166
- return 'File size must be less than 10MB';
167
- }
84
+ export const SizeLimitUploader = () => (
85
+ <Uploader
86
+ maxSize={5 * 1024 * 1024} // 5MB
87
+ onFileSelect={(file) => console.log(file)}
88
+ text="Max 5MB"
89
+ />
90
+ );
91
+ ```
168
92
 
169
- if (!file.type.startsWith('image/')) {
170
- return 'Only image files are allowed';
171
- }
93
+ ### **validateFile**
94
+ Custom validation function for uploaded files.
172
95
 
173
- if (file.name.length > 50) {
174
- return 'File name must be less than 50 characters';
175
- }
96
+ - **Type:** `(file: File) => string | null`
176
97
 
177
- return null; // No validation errors
178
- };
98
+ ```tsx
99
+ import React from 'react';
100
+ import { Uploader } from '@app-studio/web';
179
101
 
180
- const handleFileSelect = (file: File) => {
181
- console.log('Valid file selected:', file);
182
- };
102
+ export const ValidatedUploader = () => (
103
+ <Uploader
104
+ validateFile={(file) => {
105
+ if (file.size > 10 * 1024 * 1024) {
106
+ return 'File must be less than 10MB';
107
+ }
108
+ if (!file.type.startsWith('image/')) {
109
+ return 'Only images are allowed';
110
+ }
111
+ return null;
112
+ }}
113
+ onFileSelect={(file) => console.log(file)}
114
+ />
115
+ );
116
+ ```
183
117
 
184
- const handleError = (error: string) => {
185
- console.error('Upload error:', error);
186
- // Show error message to user
187
- };
118
+ ### **isLoading**
119
+ Show loading state during upload.
188
120
 
189
- return (
190
- <Uploader
191
- icon={<UploadIcon widthHeight={32} />}
192
- text="Upload Image (Max 10MB)"
193
- accept="image/*"
194
- onFileSelect={handleFileSelect}
195
- validateFile={validateFile}
196
- onError={handleError}
197
- maxSize={10 * 1024 * 1024}
198
- />
199
- );
200
- };
201
- ```
121
+ - **Type:** `boolean`
122
+ - **Default:** `false`
202
123
 
203
- ### **Custom Rendering**
204
124
  ```tsx
205
- import React from 'react';
125
+ import React, { useState } from 'react';
206
126
  import { Uploader } from '@app-studio/web';
207
- import { View, Text } from '@app-studio/web';
208
- import { CheckIcon, ErrorIcon } from '@app-studio/web';
209
-
210
- export const CustomUploader = () => {
211
- const handleFileSelect = (file: File) => {
212
- console.log('File selected:', file);
213
- };
214
-
215
- const customErrorRenderer = ({ errorMessage }: any) => (
216
- <View
217
- padding={8}
218
- backgroundColor="color.red.50"
219
- borderRadius={4}
220
- marginTop={8}
221
- >
222
- <Text color="color.red.600" fontSize={12}>
223
- <ErrorIcon widthHeight={16} /> {errorMessage}
224
- </Text>
225
- </View>
226
- );
227
-
228
- const customFileRenderer = ({ selectedFile }: any) => (
229
- <View
230
- padding={12}
231
- backgroundColor="color.green.50"
232
- borderRadius={4}
233
- marginTop={8}
234
- >
235
- <Text color="color.green.700" fontSize={14}>
236
- <CheckIcon widthHeight={16} /> {selectedFile.name}
237
- </Text>
238
- <Text color="color.green.600" fontSize={12}>
239
- Size: {Math.round(selectedFile.size / 1024)} KB
240
- </Text>
241
- </View>
242
- );
243
127
 
128
+ export const LoadingUploader = () => {
129
+ const [loading, setLoading] = useState(false);
130
+
244
131
  return (
245
- <Uploader
246
- text="Drop your file here or click to browse"
247
- onFileSelect={handleFileSelect}
248
- renderError={customErrorRenderer}
249
- renderFile={customFileRenderer}
250
- views={{
251
- container: {
252
- border: '2px dashed',
253
- borderColor: 'color.blue.300',
254
- backgroundColor: 'color.blue.50',
255
- borderRadius: 12,
256
- padding: 24,
257
- },
258
- text: {
259
- color: 'color.blue.700',
260
- fontWeight: 'medium',
261
- },
132
+ <Uploader
133
+ isLoading={loading}
134
+ onFileSelect={(file) => {
135
+ setLoading(true);
136
+ // Simulate upload
137
+ setTimeout(() => setLoading(false), 2000);
262
138
  }}
263
139
  />
264
140
  );
265
141
  };
266
142
  ```
267
143
 
268
- ### **Integration with ChatInput**
269
- The Uploader component is seamlessly integrated into the ChatInput component for file attachments:
144
+ ### **progress**
145
+ Upload progress percentage (0-100).
146
+
147
+ - **Type:** `number`
148
+ - **Default:** `0`
270
149
 
271
150
  ```tsx
272
151
  import React, { useState } from 'react';
273
- import { ChatInput } from '@app-studio/web';
274
- import { View } from '@app-studio/web';
275
-
276
- export const ChatWithFileUpload = () => {
277
- const [inputValue, setInputValue] = useState('');
278
-
279
- const handleSubmit = (message: string, options?: any) => {
280
- console.log('Message with files:', message);
281
- console.log('Upload options:', options);
282
- setInputValue('');
283
- };
152
+ import { Uploader } from '@app-studio/web';
284
153
 
154
+ export const ProgressUploader = () => {
155
+ const [progress, setProgress] = useState(0);
156
+
285
157
  return (
286
- <View width="100%">
287
- <ChatInput
288
- onSubmit={handleSubmit}
289
- value={inputValue}
290
- onChange={setInputValue}
291
- placeholder="Type a message or upload files..."
292
- hideAttachments={false} // Enable file upload button
293
- />
294
- </View>
158
+ <Uploader
159
+ isLoading={progress > 0 && progress < 100}
160
+ progress={progress}
161
+ onFileSelect={(file) => {
162
+ // Simulate upload progress
163
+ let current = 0;
164
+ const interval = setInterval(() => {
165
+ current += 10;
166
+ setProgress(current);
167
+ if (current >= 100) clearInterval(interval);
168
+ }, 200);
169
+ }}
170
+ />
295
171
  );
296
172
  };
297
173
  ```
298
174
 
299
- ### **Props**
300
-
301
- | Prop | Type | Default | Description |
302
- | ---- | ---- | ------- | ----------- |
303
- | accept | string | '*/*' | File types to accept (MIME types) |
304
- | icon | React.ReactNode | undefined | Icon to display in the upload area |
305
- | text | string | undefined | Text to display in the upload area |
306
- | maxSize | number | 100MB | Maximum file size in bytes |
307
- | onFileSelect | `(file: File) => void` | undefined | Callback when a single file is selected |
308
- | onMultipleFileSelect | `(files: File[]) => void` | undefined | Callback when multiple files are selected |
309
- | validateFile | `(file: File) => string \| null` | undefined | Custom validation function |
310
- | isLoading | boolean | false | Whether the uploader is in loading state |
311
- | progress | number | 0 | Upload progress (0-100) |
312
- | fileType | `'video' \| 'image' \| 'file'` | undefined | Type of file for preview rendering |
313
- | multiple | boolean | false | Allow multiple file selection |
314
- | onError | `(error: string) => void` | undefined | Error callback function |
315
- | thumbnail | string | undefined | Thumbnail URL for preview |
316
-
317
- ### **Custom Rendering Props**
318
-
319
- | Prop | Type | Description |
320
- | ---- | ---- | ----------- |
321
- | renderVideo | `(props: any) => React.ReactNode` | Custom video preview renderer |
322
- | renderText | `(props: any) => React.ReactNode` | Custom text renderer |
323
- | renderImage | `(props: any) => React.ReactNode` | Custom image preview renderer |
324
- | renderError | `(props: any) => React.ReactNode` | Custom error message renderer |
325
- | renderFile | `(props: any) => React.ReactNode` | Custom file info renderer |
326
- | renderProgress | `(props: any) => React.ReactNode` | Custom progress indicator renderer |
327
-
328
- ### **View Customization**
329
-
330
- The `views` prop allows you to customize different parts of the component:
175
+ ### **fileType**
176
+ Explicitly set the file type for rendering.
177
+
178
+ - **Type:** `'image' | 'video' | 'file'`
331
179
 
332
180
  ```tsx
333
- <Uploader
334
- // ...other props
335
- views={{
336
- container: { /* styles for the main container */ },
337
- view: { /* styles for the content wrapper */ },
338
- image: { /* styles for image preview */ },
339
- horizontal: { /* styles for horizontal layout */ },
340
- text: { /* styles for text elements */ },
341
- }}
342
- />
181
+ import React from 'react';
182
+ import { Uploader } from '@app-studio/web';
183
+ import { Horizontal } from 'app-studio';
184
+
185
+ export const TypedUploaders = () => (
186
+ <Horizontal gap={15}>
187
+ <Uploader fileType="image" text="Image" />
188
+ <Uploader fileType="video" text="Video" />
189
+ <Uploader fileType="file" text="File" />
190
+ </Horizontal>
191
+ );
343
192
  ```
344
193
 
345
- ### **File Type Detection**
346
-
347
- The Uploader automatically detects file types and renders appropriate previews:
348
-
349
- - **Images**: Shows image preview with proper scaling
350
- - **Videos**: Generates thumbnail and shows video preview
351
- - **Files**: Displays file name and size information
352
-
353
- ### **Error Handling**
354
-
355
- The component provides comprehensive error handling:
356
-
357
- - **File size validation**: Automatic validation against `maxSize` prop
358
- - **Custom validation**: Use `validateFile` prop for custom rules
359
- - **Error callbacks**: Handle errors with `onError` callback
360
- - **Visual feedback**: Error messages displayed in the UI
194
+ ### **icon**
195
+ Custom icon to display in the uploader.
361
196
 
362
- ### **Best Practices**
197
+ - **Type:** `React.ReactNode`
363
198
 
364
- **File Size Limits:**
365
- - Set appropriate `maxSize` limits based on your use case
366
- - Consider server-side validation as well
367
- - Provide clear feedback about size limits to users
199
+ ```tsx
200
+ import React from 'react';
201
+ import { Uploader } from '@app-studio/web';
202
+ import { UploadIcon } from '@app-studio/web';
368
203
 
369
- **File Type Restrictions:**
370
- - Use the `accept` prop to limit file types
371
- - Implement additional validation in `validateFile` if needed
372
- - Consider security implications of allowed file types
204
+ export const CustomIconUploader = () => (
205
+ <Uploader
206
+ icon={<UploadIcon widthHeight={32} />}
207
+ text="Click to upload"
208
+ onFileSelect={(file) => console.log(file)}
209
+ />
210
+ );
211
+ ```
373
212
 
374
- **User Experience:**
375
- - Provide clear instructions with the `text` prop
376
- - Use appropriate icons to indicate file types
377
- - Show progress feedback for large uploads
378
- - Handle errors gracefully with user-friendly messages
213
+ ### **text**
214
+ Text to display in the uploader.
379
215
 
380
- **Performance:**
381
- - Consider lazy loading for large file previews
382
- - Implement proper cleanup for object URLs
383
- - Use appropriate file size limits to prevent memory issues
216
+ - **Type:** `string`
384
217
 
385
- ### **Accessibility**
218
+ ```tsx
219
+ import React from 'react';
220
+ import { Uploader } from '@app-studio/web';
386
221
 
387
- The Uploader component includes built-in accessibility features:
222
+ export const CustomTextUploader = () => (
223
+ <Uploader
224
+ text="Drag & drop your files here"
225
+ onFileSelect={(file) => console.log(file)}
226
+ />
227
+ );
228
+ ```
388
229
 
389
- - Keyboard navigation support
390
- - ARIA attributes for screen readers
391
- - Focus management
392
- - Proper contrast for visual elements
230
+ ### **views**
231
+ Custom styles for different parts of the uploader.
393
232
 
394
- ### **Integration Examples**
233
+ - **Type:** `{ container?: ViewProps; view?: ViewProps; image?: ImageProps; horizontal?: ViewProps; text?: ViewProps }`
395
234
 
396
- **With Form Libraries:**
397
235
  ```tsx
398
- // Integration with Formik
399
- import { useFormikContext } from 'formik';
400
-
401
- const FormikUploader = ({ name, ...props }) => {
402
- const { setFieldValue } = useFormikContext();
236
+ import React from 'react';
237
+ import { Uploader } from '@app-studio/web';
403
238
 
404
- return (
405
- <Uploader
406
- onFileSelect={(file) => setFieldValue(name, file)}
407
- {...props}
408
- />
409
- );
410
- };
239
+ export const StyledUploader = () => (
240
+ <Uploader
241
+ onFileSelect={(file) => console.log(file)}
242
+ views={{
243
+ container: {
244
+ borderRadius: 12,
245
+ borderColor: '#3b82f6',
246
+ borderWidth: 2,
247
+ },
248
+ text: {
249
+ color: '#3b82f6',
250
+ fontSize: 16,
251
+ }
252
+ }}
253
+ />
254
+ );
411
255
  ```
412
256
 
413
- **With State Management:**
414
- ```tsx
415
- // Integration with Redux or other state management
416
- const ConnectedUploader = () => {
417
- const dispatch = useDispatch();
257
+ ### **Custom Render Functions**
258
+ Override default rendering for different file types.
418
259
 
419
- return (
420
- <Uploader
421
- onFileSelect={(file) => dispatch(uploadFile(file))}
422
- onMultipleFileSelect={(files) => dispatch(uploadMultipleFiles(files))}
423
- />
424
- );
425
- };
260
+ ```tsx
261
+ import React from 'react';
262
+ import { Uploader } from '@app-studio/web';
263
+ import { Text, View } from 'app-studio';
264
+
265
+ export const CustomRenderUploader = () => (
266
+ <Uploader
267
+ onFileSelect={(file) => console.log(file)}
268
+ renderImage={(props) => (
269
+ <View>
270
+ <Text>Custom Image Preview</Text>
271
+ {/* Custom image rendering */}
272
+ </View>
273
+ )}
274
+ renderError={(props) => (
275
+ <Text color="error">{props.errorMessage}</Text>
276
+ )}
277
+ />
278
+ );
426
279
  ```
280
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-studio/web",
3
- "version": "0.9.41",
3
+ "version": "0.9.43",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/components/index.d.ts",
6
6
  "files": [
@@ -1,35 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- /**
3
- * Authentication guard props
4
- */
5
- interface AuthGuardProps {
6
- children: ReactNode;
7
- fallback?: ReactNode;
8
- requireAuth?: boolean;
9
- autoLogin?: boolean;
10
- }
11
- /**
12
- * Authentication guard component
13
- *
14
- * Protects routes by checking authentication status and auto-logging in for ADK pages
15
- */
16
- export declare const AuthGuard: React.FC<AuthGuardProps>;
17
- /**
18
- * HOC for protecting components with authentication
19
- */
20
- export declare const withAuthGuard: <P extends object>(Component: React.ComponentType<P>, options?: {
21
- requireAuth?: boolean | undefined;
22
- fallback?: ReactNode;
23
- } | undefined) => React.FC<P>;
24
- /**
25
- * Route-based authentication guard
26
- * Automatically determines if auth is required based on the current path
27
- */
28
- export declare const RouteAuthGuard: React.FC<{
29
- children: ReactNode;
30
- }>;
31
- /**
32
- * Authentication status indicator component
33
- */
34
- export declare const AuthStatus: React.FC;
35
- export {};
@@ -1 +0,0 @@
1
- export { AuthGuard, withAuthGuard, RouteAuthGuard, AuthStatus, } from './AuthGuard';