@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,373 +1,425 @@
1
1
  # ChatInput
2
2
 
3
+ A customizable chat input component with file upload support, mentions, suggestions, audio recording, and model selection.
3
4
 
4
5
  ### **Import**
5
- ```tsx
6
- import { ChatInput } from '@app-studio/web';
7
- ```
6
+ ```tsx
7
+ import { ChatInput } from '@app-studio/web';
8
+ ```
8
9
 
9
- ### **Basic Usage**
10
+ ### **Default**
10
11
  ```tsx
11
12
  import React, { useState } from 'react';
12
13
  import { ChatInput } from '@app-studio/web';
13
- import { View } from '@app-studio/web';
14
14
 
15
- export const BasicChatInput = () => {
16
- const [inputValue, setInputValue] = useState('');
15
+ export const DefaultChatInput = () => {
16
+ const [files, setFiles] = useState<File[]>([]);
17
+
18
+ return (
19
+ <ChatInput
20
+ onSubmit={(message) => console.log('Message:', message)}
21
+ getPendingFiles={() => files}
22
+ clearPendingFiles={() => setFiles([])}
23
+ />
24
+ );
25
+ };
26
+ ```
27
+
28
+ ### **onSubmit**
29
+ Callback function when the form is submitted.
17
30
 
18
- const handleSubmit = (message) => {
19
- console.log('Message submitted:', message);
20
- setInputValue('');
21
- };
31
+ - **Type:** `(message: string, options?: { model_name?: string; enable_thinking?: boolean }) => void`
32
+ - **Required:** `true`
22
33
 
34
+ ```tsx
35
+ import React, { useState } from 'react';
36
+ import { ChatInput } from '@app-studio/web';
37
+
38
+ export const SubmitChatInput = () => {
39
+ const [files, setFiles] = useState<File[]>([]);
40
+
23
41
  return (
24
- <View width="100%">
25
- <ChatInput
26
- onSubmit={handleSubmit}
27
- value={inputValue}
28
- onChange={setInputValue}
29
- placeholder="Type your message here..."
30
- />
31
- </View>
42
+ <ChatInput
43
+ onSubmit={(message, options) => {
44
+ console.log('Message:', message);
45
+ console.log('Model:', options?.model_name);
46
+ console.log('Thinking:', options?.enable_thinking);
47
+ }}
48
+ getPendingFiles={() => files}
49
+ clearPendingFiles={() => setFiles([])}
50
+ />
32
51
  );
33
52
  };
34
53
  ```
35
54
 
36
- ### **File Upload & Attachments**
55
+ ### **placeholder**
56
+ Placeholder text for the input.
37
57
 
38
- The ChatInput component uses the integrated Uploader component for seamless file handling:
58
+ - **Type:** `string`
59
+ - **Default:** `'Type a message...'`
39
60
 
40
61
  ```tsx
41
62
  import React, { useState } from 'react';
42
63
  import { ChatInput } from '@app-studio/web';
43
- import { View } from '@app-studio/web';
44
64
 
45
- export const ChatInputWithFileUploads = () => {
46
- const [inputValue, setInputValue] = useState('');
65
+ export const PlaceholderChatInput = () => {
66
+ const [files, setFiles] = useState<File[]>([]);
67
+
68
+ return (
69
+ <ChatInput
70
+ placeholder="Ask me anything..."
71
+ onSubmit={(message) => console.log(message)}
72
+ getPendingFiles={() => files}
73
+ clearPendingFiles={() => setFiles([])}
74
+ />
75
+ );
76
+ };
77
+ ```
78
+
79
+ ### **loading**
80
+ Whether the input is in a loading state.
81
+
82
+ - **Type:** `boolean`
83
+ - **Default:** `false`
47
84
 
48
- const handleSubmit = (message, options) => {
49
- console.log('Message submitted:', message);
50
- console.log('Options:', options);
51
- // Message will include file information automatically
52
- };
85
+ ```tsx
86
+ import React, { useState } from 'react';
87
+ import { ChatInput } from '@app-studio/web';
53
88
 
89
+ export const LoadingChatInput = () => {
90
+ const [files, setFiles] = useState<File[]>([]);
91
+ const [loading, setLoading] = useState(false);
92
+
54
93
  return (
55
- <View width="100%">
56
- <ChatInput
57
- onSubmit={handleSubmit}
58
- value={inputValue}
59
- onChange={setInputValue}
60
- placeholder="Upload files and send a message..."
61
- hideAttachments={false} // Show attachment button
62
- />
63
- </View>
94
+ <ChatInput
95
+ loading={loading}
96
+ onSubmit={(message) => {
97
+ setLoading(true);
98
+ setTimeout(() => setLoading(false), 2000);
99
+ }}
100
+ getPendingFiles={() => files}
101
+ clearPendingFiles={() => setFiles([])}
102
+ />
64
103
  );
65
104
  };
66
105
  ```
67
106
 
68
- **File Upload Features:**
69
- - **Multiple File Selection**: Select multiple files at once using Ctrl/Cmd + click
70
- - **Drag & Drop Support**: Drop files directly into the chat input area
71
- - **File Size Validation**: 50MB maximum file size with automatic validation
72
- - **File Type Support**: All file types supported (images, documents, videos, etc.)
73
- - **Preview & Management**: View uploaded files and remove them before sending
74
- ### **With Prompt Examples**
107
+ ### **disabled**
108
+ Whether the input is disabled.
109
+
110
+ - **Type:** `boolean`
111
+ - **Default:** `false`
112
+
75
113
  ```tsx
76
114
  import React, { useState } from 'react';
77
115
  import { ChatInput } from '@app-studio/web';
78
- import { View } from '@app-studio/web';
79
- import { PromptExample } from '@app-studio/web';
80
-
81
- export const ChatInputWithPromptExamples = () => {
82
- const [inputValue, setInputValue] = useState('');
83
-
84
- // Example prompt suggestions
85
- const promptExamples: PromptExample[] = [
86
- { id: '1', text: 'Tell me a joke' },
87
- { id: '2', text: 'What is the weather today?' },
88
- { id: '3', text: 'How do I create a React component?' },
89
- { id: '4', text: 'Write a poem about coding' },
90
- ];
91
116
 
92
- const handleSubmit = (message) => {
93
- console.log('Message submitted:', message);
94
- setInputValue('');
95
- };
117
+ export const DisabledChatInput = () => {
118
+ const [files, setFiles] = useState<File[]>([]);
119
+
120
+ return (
121
+ <ChatInput
122
+ disabled
123
+ onSubmit={(message) => console.log(message)}
124
+ getPendingFiles={() => files}
125
+ clearPendingFiles={() => setFiles([])}
126
+ />
127
+ );
128
+ };
129
+ ```
130
+
131
+ ### **value & onChange**
132
+ Controlled input value.
96
133
 
97
- const handlePromptSelect = (example) => {
98
- console.log('Prompt selected:', example);
99
- };
134
+ - **Type:** `string` & `(value: string) => void`
100
135
 
136
+ ```tsx
137
+ import React, { useState } from 'react';
138
+ import { ChatInput } from '@app-studio/web';
139
+
140
+ export const ControlledChatInput = () => {
141
+ const [value, setValue] = useState('');
142
+ const [files, setFiles] = useState<File[]>([]);
143
+
101
144
  return (
102
- <View width="100%">
103
- <ChatInput
104
- onSubmit={handleSubmit}
105
- value={inputValue}
106
- onChange={setInputValue}
107
- promptExamples={promptExamples}
108
- onPromptExampleSelect={handlePromptSelect}
109
- />
110
- </View>
145
+ <ChatInput
146
+ value={value}
147
+ onChange={setValue}
148
+ onSubmit={(message) => {
149
+ console.log(message);
150
+ setValue('');
151
+ }}
152
+ getPendingFiles={() => files}
153
+ clearPendingFiles={() => setFiles([])}
154
+ />
111
155
  );
112
156
  };
113
157
  ```
114
158
 
115
- ### **Drag & Drop File Upload**
159
+ ### **hideAttachments**
160
+ Whether to hide the attachment button.
116
161
 
117
- The ChatInput supports drag & drop functionality for easy file uploads:
162
+ - **Type:** `boolean`
163
+ - **Default:** `false`
118
164
 
119
165
  ```tsx
120
166
  import React, { useState } from 'react';
121
167
  import { ChatInput } from '@app-studio/web';
122
- import { View } from '@app-studio/web';
123
168
 
124
- export const ChatInputWithDragDrop = () => {
125
- const [inputValue, setInputValue] = useState('');
169
+ export const NoAttachmentsChatInput = () => {
170
+ const [files, setFiles] = useState<File[]>([]);
171
+
172
+ return (
173
+ <ChatInput
174
+ hideAttachments
175
+ onSubmit={(message) => console.log(message)}
176
+ getPendingFiles={() => files}
177
+ clearPendingFiles={() => setFiles([])}
178
+ />
179
+ );
180
+ };
181
+ ```
182
+
183
+ ### **enableAudioRecording**
184
+ Enable audio recording button.
185
+
186
+ - **Type:** `boolean`
187
+ - **Default:** `false`
126
188
 
127
- const handleSubmit = (message, options) => {
128
- console.log('Message with files:', message);
129
- // Files are automatically processed and included
130
- };
189
+ ```tsx
190
+ import React, { useState } from 'react';
191
+ import { ChatInput } from '@app-studio/web';
131
192
 
193
+ export const AudioChatInput = () => {
194
+ const [files, setFiles] = useState<File[]>([]);
195
+
132
196
  return (
133
- <View width="100%">
134
- <ChatInput
135
- onSubmit={handleSubmit}
136
- value={inputValue}
137
- onChange={setInputValue}
138
- placeholder="Drag files here or click the attachment button..."
139
- />
140
- </View>
197
+ <ChatInput
198
+ enableAudioRecording
199
+ onAudioRecordingStart={() => console.log('Recording started')}
200
+ onAudioRecordingStop={(audio) => console.log('Audio blob:', audio)}
201
+ onSubmit={(message) => console.log(message)}
202
+ getPendingFiles={() => files}
203
+ clearPendingFiles={() => setFiles([])}
204
+ />
141
205
  );
142
206
  };
143
207
  ```
144
208
 
145
- **Drag & Drop Features:**
146
- - **Visual Feedback**: Input area highlights when files are dragged over
147
- - **Multiple Files**: Drop multiple files at once for batch upload
148
- - **File Validation**: Automatic size and type validation during drop
149
- - **Error Handling**: Clear feedback for invalid files or size limits
209
+ ### **suggestions**
210
+ List of suggestions for auto-completion.
211
+
212
+ - **Type:** `Suggestion[]`
150
213
 
151
- ### **Custom Styling**
152
214
  ```tsx
153
- import React from 'react';
215
+ import React, { useState } from 'react';
154
216
  import { ChatInput } from '@app-studio/web';
155
- import { View } from '@app-studio/web';
156
-
157
- export const StyledChatInput = () => {
158
- const handleSubmit = (message) => {
159
- console.log('Message submitted:', message);
160
- };
161
217
 
218
+ export const SuggestionsChatInput = () => {
219
+ const [files, setFiles] = useState<File[]>([]);
220
+
221
+ const suggestions = [
222
+ { text: 'How do I...', value: 'how-to' },
223
+ { text: 'What is...', value: 'what-is' },
224
+ { text: 'Can you help me...', value: 'help' },
225
+ ];
226
+
162
227
  return (
163
- <View width="100%">
164
- <ChatInput
165
- onSubmit={handleSubmit}
166
- placeholder="Type a message..."
167
- shape="pillShaped"
168
- variant="outline"
169
- views={{
170
- container: {
171
- backgroundColor: 'color.purple.50',
172
- },
173
- content: {
174
- borderColor: 'color.purple.200',
175
- },
176
- submitButton: {
177
- backgroundColor: 'color.purple.500',
178
- },
179
- }}
180
- />
181
- </View>
228
+ <ChatInput
229
+ suggestions={suggestions}
230
+ onSubmit={(message) => console.log(message)}
231
+ getPendingFiles={() => files}
232
+ clearPendingFiles={() => setFiles([])}
233
+ />
182
234
  );
183
235
  };
184
236
  ```
185
237
 
186
- ### **With Agent Controls**
238
+ ### **mentionData**
239
+ Data for mention auto-completion.
240
+
241
+ - **Type:** `Array<{ id: string; name: string; avatar?: string; description?: string }>`
242
+
187
243
  ```tsx
188
244
  import React, { useState } from 'react';
189
245
  import { ChatInput } from '@app-studio/web';
190
- import { View } from '@app-studio/web';
191
-
192
- export const ChatInputWithAgent = () => {
193
- const [isAgentRunning, setIsAgentRunning] = useState(false);
194
246
 
195
- const handleSubmit = (message, options) => {
196
- console.log('Message submitted:', message);
197
- console.log('Options:', options);
247
+ export const MentionsChatInput = () => {
248
+ const [files, setFiles] = useState<File[]>([]);
249
+
250
+ const mentionData = [
251
+ { id: '1', name: 'John Doe', avatar: '/avatars/john.jpg' },
252
+ { id: '2', name: 'Jane Smith', avatar: '/avatars/jane.jpg' },
253
+ { id: '3', name: 'Bob Johnson', description: 'Developer' },
254
+ ];
255
+
256
+ return (
257
+ <ChatInput
258
+ mentionData={mentionData}
259
+ mentionTrigger="@"
260
+ onMentionSelect={(mention) => console.log('Mentioned:', mention)}
261
+ onSubmit={(message) => console.log(message)}
262
+ getPendingFiles={() => files}
263
+ clearPendingFiles={() => setFiles([])}
264
+ />
265
+ );
266
+ };
267
+ ```
198
268
 
199
- // Start the agent
200
- setIsAgentRunning(true);
269
+ ### **promptExamples**
270
+ List of prompt examples to display.
201
271
 
202
- // Simulate agent running for 5 seconds
203
- setTimeout(() => {
204
- setIsAgentRunning(false);
205
- }, 5000);
206
- };
272
+ - **Type:** `PromptExample[]`
207
273
 
208
- const handleStopAgent = () => {
209
- console.log('Agent stopped');
210
- setIsAgentRunning(false);
211
- };
274
+ ```tsx
275
+ import React, { useState } from 'react';
276
+ import { ChatInput } from '@app-studio/web';
212
277
 
278
+ export const PromptExamplesChatInput = () => {
279
+ const [files, setFiles] = useState<File[]>([]);
280
+
281
+ const promptExamples = [
282
+ { title: 'Write a story', prompt: 'Write a short story about...' },
283
+ { title: 'Explain a concept', prompt: 'Explain quantum physics in simple terms' },
284
+ { title: 'Code help', prompt: 'Help me debug this code...' },
285
+ ];
286
+
213
287
  return (
214
- <View width="100%">
215
- <ChatInput
216
- onSubmit={handleSubmit}
217
- isAgentRunning={isAgentRunning}
218
- onStopAgent={handleStopAgent}
219
- />
220
- </View>
288
+ <ChatInput
289
+ promptExamples={promptExamples}
290
+ onPromptExampleSelect={(example) => console.log('Selected:', example)}
291
+ onSubmit={(message) => console.log(message)}
292
+ getPendingFiles={() => files}
293
+ clearPendingFiles={() => setFiles([])}
294
+ />
221
295
  );
222
296
  };
223
297
  ```
224
298
 
225
- ### **Props**
226
-
227
- | Prop | Type | Default | Description |
228
- | ---- | ---- | ------- | ----------- |
229
- | onSubmit | `(message: string, options?: { model_name?: string; enable_thinking?: boolean }) => void` | required | Callback function when the form is submitted |
230
- | placeholder | string | 'Say what you want and Kimmy will surprise you' | Placeholder text for the input |
231
- | loading | boolean | false | Whether the input is in a loading state |
232
- | disabled | boolean | false | Whether the input is disabled |
233
- | isAgentRunning | boolean | false | Whether an agent is currently running |
234
- | onStopAgent | `() => void` | undefined | Callback function to stop the agent |
235
- | autoFocus | boolean | true | Whether to auto focus the input |
236
- | value | string | undefined | Controlled value for the input |
237
- | onChange | `(value: string) => void` | undefined | Callback function when the input value changes |
238
- | onFileBrowse | `() => void` | undefined | Callback function when the file browser is opened |
239
- | sandboxId | string | undefined | ID of the sandbox |
240
- | hideAttachments | boolean | false | Whether to hide the attachment button |
241
- | title | string | undefined | Title for the chat input |
242
- | showGuideTip | boolean | false | Whether to show the guide tip |
243
- | guideVideoUrl | string | undefined | URL for the guide video |
244
- | onGuideClose | `() => void` | undefined | Callback function when the guide tip is closed |
245
- | promptExamples | `PromptExample[]` | [] | List of prompt examples |
246
- | onPromptExampleSelect | `(example: PromptExample) => void` | undefined | Callback function when a prompt example is selected |
247
- | size | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | 'md' | Size of the chat input |
248
- | shape | `'default' \| 'sharp' \| 'rounded' \| 'pillShaped'` | 'rounded' | Shape of the chat input |
249
- | variant | `'default' \| 'outline' \| 'none'` | 'default' | Visual variant of the chat input |
250
- | views | object | {} | Custom styling for different parts of the component |
251
-
252
- ### **File Upload Integration**
253
-
254
- The ChatInput component integrates seamlessly with the Uploader component:
255
-
256
- - **Automatic File Processing**: Files are automatically processed and added to the message
257
- - **File Size Validation**: 50MB maximum file size with clear error messages
258
- - **Multiple File Support**: Upload multiple files simultaneously
259
- - **Drag & Drop Integration**: Full drag and drop support with visual feedback
260
-
261
- ### **Customization**
262
-
263
- The ChatInput component can be customized using the `views` prop:
299
+ ### **isAgentRunning & onStopAgent**
300
+ Agent running state and stop callback.
301
+
302
+ - **Type:** `boolean` & `() => void`
264
303
 
265
304
  ```tsx
266
- <ChatInput
267
- // ...other props
268
- views={{
269
- container: { /* styles for the main container */ },
270
- content: { /* styles for the content wrapper */ },
271
- editableInput: { /* styles for the editable input */ },
272
- header: { /* styles for the header */ },
273
- title: { /* styles for the title */ },
274
- guideTip: { /* styles for the guide tip */ },
275
- promptExamples: { /* styles for the prompt examples container */ },
276
- promptExampleItem: { /* styles for each prompt example item */ },
277
- attachments: { /* styles for the attachments container */ },
278
- attachmentItem: { /* styles for each attachment item */ },
279
- attachmentName: { /* styles for attachment file names */ },
280
- attachmentSize: { /* styles for attachment file sizes */ },
281
- attachmentRemove: { /* styles for attachment remove buttons */ },
282
- submitButton: { /* styles for the submit button */ },
283
- fileButton: { /* styles for the file upload button */ },
284
- }}
285
- />
305
+ import React, { useState } from 'react';
306
+ import { ChatInput } from '@app-studio/web';
307
+
308
+ export const AgentChatInput = () => {
309
+ const [files, setFiles] = useState<File[]>([]);
310
+ const [isRunning, setIsRunning] = useState(false);
311
+
312
+ return (
313
+ <ChatInput
314
+ isAgentRunning={isRunning}
315
+ onStopAgent={() => {
316
+ console.log('Stopping agent');
317
+ setIsRunning(false);
318
+ }}
319
+ onSubmit={(message) => {
320
+ console.log(message);
321
+ setIsRunning(true);
322
+ }}
323
+ getPendingFiles={() => files}
324
+ clearPendingFiles={() => setFiles([])}
325
+ />
326
+ );
327
+ };
286
328
  ```
287
329
 
288
- ### **Accessibility**
330
+ ### **size**
331
+ Size of the input.
289
332
 
290
- The ChatInput component implements the following accessibility features:
333
+ - **Type:** `Size`
334
+ - **Default:** `'md'`
335
+ - **Possible Values:** `'xs' | 'sm' | 'md' | 'lg' | 'xl'`
291
336
 
292
- - Keyboard navigation for submitting messages (Enter key)
293
- - ARIA attributes for interactive elements
294
- - Focus management for the input field
295
- - Proper contrast for text and buttons
337
+ ```tsx
338
+ import React, { useState } from 'react';
339
+ import { ChatInput } from '@app-studio/web';
340
+ import { Vertical } from 'app-studio';
296
341
 
297
- ### **Best Practices**
342
+ export const SizedChatInputs = () => {
343
+ const [files, setFiles] = useState<File[]>([]);
344
+
345
+ return (
346
+ <Vertical gap={15}>
347
+ {['sm', 'md', 'lg'].map((size) => (
348
+ <ChatInput
349
+ key={size}
350
+ size={size as any}
351
+ onSubmit={(message) => console.log(message)}
352
+ getPendingFiles={() => files}
353
+ clearPendingFiles={() => setFiles([])}
354
+ />
355
+ ))}
356
+ </Vertical>
357
+ );
358
+ };
359
+ ```
298
360
 
299
- **General Usage:**
300
- - Provide clear placeholder text to guide users
301
- - Use the `loading` state to indicate when a message is being processed
302
- - Implement proper error handling for message submission
303
- - Provide feedback to users when messages are sent successfully
361
+ ### **variant**
362
+ Variant of the input.
304
363
 
305
- **File Upload Best Practices:**
306
- - Handle file uploads appropriately on the server side
307
- - Validate file types and sizes on both client and server
308
- - Provide clear feedback for file upload errors
309
- - Consider implementing file preview functionality
364
+ - **Type:** `Variant`
365
+ - **Possible Values:** `'default' | 'outlined' | 'filled'`
310
366
 
367
+ ```tsx
368
+ import React, { useState } from 'react';
369
+ import { ChatInput } from '@app-studio/web';
370
+ import { Vertical } from 'app-studio';
311
371
 
312
- **Accessibility Considerations:**
313
- - Ensure file upload buttons are keyboard accessible
314
- - Use proper ARIA labels for interactive elements
315
- - Test with screen readers for file upload functionality
372
+ export const VariantChatInputs = () => {
373
+ const [files, setFiles] = useState<File[]>([]);
374
+
375
+ return (
376
+ <Vertical gap={15}>
377
+ {['default', 'outlined', 'filled'].map((variant) => (
378
+ <ChatInput
379
+ key={variant}
380
+ variant={variant as any}
381
+ onSubmit={(message) => console.log(message)}
382
+ getPendingFiles={() => files}
383
+ clearPendingFiles={() => setFiles([])}
384
+ />
385
+ ))}
386
+ </Vertical>
387
+ );
388
+ };
389
+ ```
316
390
 
317
- ### **Demo & Testing**
391
+ ### **views**
392
+ Custom styles for different parts of the chat input.
318
393
 
319
- The ChatInput component includes a demo page with simulate upload functionality for testing:
394
+ - **Type:** `ChatInputStyles`
320
395
 
321
396
  ```tsx
322
- // Available in src/pages/chat.page.tsx
323
397
  import React, { useState } from 'react';
324
398
  import { ChatInput } from '@app-studio/web';
325
- import { Button } from '@app-studio/web';
326
-
327
- export const ChatInputDemo = () => {
328
- const [isSimulatingUpload, setIsSimulatingUpload] = useState(false);
329
- const [simulationProgress, setSimulationProgress] = useState(0);
330
-
331
- const simulateUpload = () => {
332
- // Creates mock files for testing
333
- const mockFiles = [
334
- new File(['content'], 'document.pdf', { type: 'application/pdf' }),
335
- new File(['content'], 'image.jpg', { type: 'image/jpeg' }),
336
- new File(['content'], 'spreadsheet.xlsx', { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }),
337
- ];
338
-
339
- setIsSimulatingUpload(true);
340
- setSimulationProgress(0);
341
-
342
- const interval = setInterval(() => {
343
- setSimulationProgress((prev) => {
344
- if (prev >= 100) {
345
- clearInterval(interval);
346
- setIsSimulatingUpload(false);
347
- console.log('Upload simulation completed!');
348
- return 100;
349
- }
350
- return prev + 10;
351
- });
352
- }, 300);
353
- };
354
399
 
400
+ export const StyledChatInput = () => {
401
+ const [files, setFiles] = useState<File[]>([]);
402
+
355
403
  return (
356
- <>
357
- <Button onClick={simulateUpload} disabled={isSimulatingUpload}>
358
- {isSimulatingUpload ? `Uploading... ${simulationProgress}%` : 'Simulate Upload'}
359
- </Button>
360
-
361
- <ChatInput
362
- onSubmit={(message) => console.log('Message:', message)}
363
- />
364
- </>
404
+ <ChatInput
405
+ onSubmit={(message) => console.log(message)}
406
+ getPendingFiles={() => files}
407
+ clearPendingFiles={() => setFiles([])}
408
+ views={{
409
+ container: {
410
+ borderRadius: 16,
411
+ borderColor: '#3b82f6',
412
+ },
413
+ input: {
414
+ fontSize: 16,
415
+ padding: 12,
416
+ },
417
+ button: {
418
+ backgroundColor: '#3b82f6',
419
+ }
420
+ }}
421
+ />
365
422
  );
366
423
  };
367
424
  ```
368
425
 
369
- **Demo Features:**
370
- - **Simulate Upload**: Test file upload functionality without real files
371
- - **Progress Tracking**: Visual progress indication during simulation
372
- - **Mock File Generation**: Creates realistic test files with proper MIME types
373
- - **Console Logging**: Detailed logging for debugging and testing