@app-studio/web 0.9.56 → 0.9.59

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 (33) 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 +17 -0
  6. package/dist/components/Formik/Formik.Uploader.d.ts +1 -1
  7. package/dist/components/ProgressBar/ProgressBar/ProgressBar.props.d.ts +36 -2
  8. package/dist/components/ProgressBar/ProgressBar.d.ts +1 -0
  9. package/dist/components/Title/Title/Title.props.d.ts +0 -5
  10. package/dist/web.cjs.development.js +153 -108
  11. package/dist/web.cjs.development.js.map +1 -1
  12. package/dist/web.cjs.production.min.js +1 -1
  13. package/dist/web.cjs.production.min.js.map +1 -1
  14. package/dist/web.esm.js +153 -108
  15. package/dist/web.esm.js.map +1 -1
  16. package/dist/web.umd.development.js +157 -111
  17. package/dist/web.umd.development.js.map +1 -1
  18. package/dist/web.umd.production.min.js +1 -1
  19. package/dist/web.umd.production.min.js.map +1 -1
  20. package/docs/app-studio/Animation.md +241 -0
  21. package/docs/app-studio/Components.md +192 -0
  22. package/docs/app-studio/Design.md +121 -0
  23. package/docs/app-studio/Events.md +296 -0
  24. package/docs/app-studio/Hooks.md +469 -0
  25. package/docs/app-studio/Providers.md +186 -0
  26. package/docs/app-studio/README.md +781 -0
  27. package/docs/app-studio/Responsive.md +135 -0
  28. package/docs/app-studio/Theming.md +488 -0
  29. package/docs/components/Background.mdx +2 -2
  30. package/docs/components/Center.mdx +2 -2
  31. package/docs/components/ChatInput.mdx +133 -0
  32. package/docs/components/Vertical.mdx +1 -1
  33. 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
 
@@ -291,7 +291,7 @@ export const CardLayout = () => (
291
291
  <Text fontSize={20} fontWeight="bold">
292
292
  Article Title {item}
293
293
  </Text>
294
- <Text color="color.gray.600" lineHeight={1.6}>
294
+ <Text color="color.gray.600" >
295
295
  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
296
296
  Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
297
297
  </Text>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-studio/web",
3
- "version": "0.9.56",
3
+ "version": "0.9.59",
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.49",
115
116
  "async-mutex": "^0.5.0",
116
117
  "babel-jest": "^29.5.0",
117
118
  "babel-loader": "^9.1.2",