@app-studio/web 0.9.57 → 0.9.60

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 (37) hide show
  1. package/dist/components/Background/Background/Background.props.d.ts +15 -8
  2. package/dist/components/Background/Background/Background.style.d.ts +0 -2
  3. package/dist/components/Background/Background/Background.view.d.ts +2 -1
  4. package/dist/components/Background/Background.d.ts +1 -0
  5. package/dist/components/ChatInput/ChatInput/ChatInput.props.d.ts +18 -1
  6. package/dist/components/ColorPicker/ColorPicker/ColorPicker.props.d.ts +1 -1
  7. package/dist/components/DragAndDrop/DragAndDrop/DragAndDrop.props.d.ts +1 -1
  8. package/dist/components/EmojiPicker/EmojiPicker/EmojiPicker.props.d.ts +1 -1
  9. package/dist/components/Formik/Formik.Uploader.d.ts +1 -1
  10. package/dist/components/ProgressBar/ProgressBar/ProgressBar.props.d.ts +36 -2
  11. package/dist/components/ProgressBar/ProgressBar.d.ts +1 -0
  12. package/dist/components/Slider/Slider/Slider.props.d.ts +1 -1
  13. package/dist/components/Title/Title/SlideEffect.d.ts +1 -0
  14. package/dist/components/Title/Title/Title.props.d.ts +0 -5
  15. package/dist/pages/title.page.d.ts +0 -3
  16. package/dist/web.cjs.development.js +238 -223
  17. package/dist/web.cjs.development.js.map +1 -1
  18. package/dist/web.cjs.production.min.js +1 -1
  19. package/dist/web.cjs.production.min.js.map +1 -1
  20. package/dist/web.esm.js +238 -223
  21. package/dist/web.esm.js.map +1 -1
  22. package/dist/web.umd.development.js +242 -226
  23. package/dist/web.umd.development.js.map +1 -1
  24. package/dist/web.umd.production.min.js +1 -1
  25. package/dist/web.umd.production.min.js.map +1 -1
  26. package/docs/app-studio/Animation.md +241 -0
  27. package/docs/app-studio/Components.md +192 -0
  28. package/docs/app-studio/Design.md +121 -0
  29. package/docs/app-studio/Events.md +296 -0
  30. package/docs/app-studio/Hooks.md +469 -0
  31. package/docs/app-studio/Providers.md +186 -0
  32. package/docs/app-studio/README.md +781 -0
  33. package/docs/app-studio/Responsive.md +135 -0
  34. package/docs/app-studio/Theming.md +488 -0
  35. package/docs/components/Background.mdx +2 -2
  36. package/docs/components/ChatInput.mdx +133 -0
  37. package/package.json +3 -2
@@ -156,6 +156,139 @@ export const ControlledChatInput = () => {
156
156
  };
157
157
  ```
158
158
 
159
+ ### **onFileUpload**
160
+ Function to execute file upload. The parent component should provide this to handle the actual file upload logic.
161
+
162
+ - **Type:** `(file: File) => void`
163
+ - **Required:** `false`
164
+
165
+ ```tsx
166
+ import React, { useState } from 'react';
167
+ import { ChatInput } from '@app-studio/web';
168
+ import { UploadService } from 'src/services/api';
169
+
170
+ export const FileUploadChatInput = () => {
171
+ const [files, setFiles] = useState<File[]>([]);
172
+
173
+ const uploadFileRequest = UploadService.useUploadControllerFileService({
174
+ onProgress: (p) => console.log('Progress:', p),
175
+ onSuccess: (data) => console.log('Success:', data),
176
+ onError: (err) => console.error('Error:', err),
177
+ });
178
+
179
+ return (
180
+ <ChatInput
181
+ onFileUpload={(file) => uploadFileRequest.run({ file })}
182
+ onSubmit={(message) => console.log(message)}
183
+ getPendingFiles={() => files}
184
+ clearPendingFiles={() => setFiles([])}
185
+ />
186
+ );
187
+ };
188
+ ```
189
+
190
+ ### **onUploadProgress**
191
+ Callback when file upload progress changes.
192
+
193
+ - **Type:** `(progress: number) => void`
194
+ - **Required:** `false`
195
+
196
+ ```tsx
197
+ import React, { useState } from 'react';
198
+ import { ChatInput } from '@app-studio/web';
199
+ import { UploadService } from 'src/services/api';
200
+
201
+ export const UploadProgressChatInput = () => {
202
+ const [files, setFiles] = useState<File[]>([]);
203
+ const [progress, setProgress] = useState(0);
204
+
205
+ const uploadFileRequest = UploadService.useUploadControllerFileService({
206
+ onProgress: (p) => setProgress(p),
207
+ onSuccess: () => setProgress(0),
208
+ onError: () => setProgress(0),
209
+ });
210
+
211
+ return (
212
+ <>
213
+ {progress > 0 && <div>Upload Progress: {progress}%</div>}
214
+ <ChatInput
215
+ onFileUpload={(file) => uploadFileRequest.run({ file })}
216
+ onUploadProgress={(p) => console.log('Upload progress:', p)}
217
+ onSubmit={(message) => console.log(message)}
218
+ getPendingFiles={() => files}
219
+ clearPendingFiles={() => setFiles([])}
220
+ />
221
+ </>
222
+ );
223
+ };
224
+ ```
225
+
226
+ ### **onUploadSuccess**
227
+ Callback when file upload succeeds.
228
+
229
+ - **Type:** `(data: any) => void`
230
+ - **Required:** `false`
231
+
232
+ ```tsx
233
+ import React, { useState } from 'react';
234
+ import { ChatInput } from '@app-studio/web';
235
+ import { UploadService } from 'src/services/api';
236
+
237
+ export const UploadSuccessChatInput = () => {
238
+ const [files, setFiles] = useState<File[]>([]);
239
+
240
+ const uploadFileRequest = UploadService.useUploadControllerFileService({});
241
+
242
+ return (
243
+ <ChatInput
244
+ onFileUpload={(file) => uploadFileRequest.run({ file })}
245
+ onUploadSuccess={(data) => {
246
+ console.log('Upload successful:', data);
247
+ // Perform additional actions on success
248
+ }}
249
+ onSubmit={(message) => console.log(message)}
250
+ getPendingFiles={() => files}
251
+ clearPendingFiles={() => setFiles([])}
252
+ />
253
+ );
254
+ };
255
+ ```
256
+
257
+ ### **onUploadError**
258
+ Callback when file upload fails.
259
+
260
+ - **Type:** `(error: any) => void`
261
+ - **Required:** `false`
262
+
263
+ ```tsx
264
+ import React, { useState } from 'react';
265
+ import { ChatInput } from '@app-studio/web';
266
+ import { UploadService } from 'src/services/api';
267
+
268
+ export const UploadErrorChatInput = () => {
269
+ const [files, setFiles] = useState<File[]>([]);
270
+ const [error, setError] = useState<string>('');
271
+
272
+ const uploadFileRequest = UploadService.useUploadControllerFileService({});
273
+
274
+ return (
275
+ <>
276
+ {error && <div style={{ color: 'red' }}>{error}</div>}
277
+ <ChatInput
278
+ onFileUpload={(file) => uploadFileRequest.run({ file })}
279
+ onUploadError={(err) => {
280
+ console.error('Upload failed:', err);
281
+ setError('Failed to upload file. Please try again.');
282
+ }}
283
+ onSubmit={(message) => console.log(message)}
284
+ getPendingFiles={() => files}
285
+ clearPendingFiles={() => setFiles([])}
286
+ />
287
+ </>
288
+ );
289
+ };
290
+ ```
291
+
159
292
  ### **hideAttachments**
160
293
  Whether to hide the attachment button.
161
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-studio/web",
3
- "version": "0.9.57",
3
+ "version": "0.9.60",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/components/index.d.ts",
6
6
  "files": [
@@ -46,6 +46,7 @@
46
46
  "page-imports": "ts-node scripts/generate-page-imports.ts",
47
47
  "create-pages": "npm run create-indices && ts-node scripts/create-pages.ts && npm run page-imports",
48
48
  "validate-docs": "node scripts/validate-docs.js",
49
+ "docs:app-studio": "rm -rf docs/app-studio && mkdir -p docs/app-studio && cp -R node_modules/app-studio/docs/* docs/app-studio",
49
50
  "api:local": "react-api --useUnionTypes --input http://localhost:3000/docs/swagger.json --output ./src/services/api && prettier --write ./src/services/api"
50
51
  },
51
52
  "eslintConfig": {
@@ -111,7 +112,7 @@
111
112
  "@types/react-test-renderer": "^18.0.0",
112
113
  "@typescript-eslint/eslint-plugin": "^5.59.7",
113
114
  "@typescript-eslint/parser": "^5.59.7",
114
- "app-studio": "^0.6.47",
115
+ "app-studio": "^0.6.52",
115
116
  "async-mutex": "^0.5.0",
116
117
  "babel-jest": "^29.5.0",
117
118
  "babel-loader": "^9.1.2",