@app-studio/web 0.9.35 → 0.9.36

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.
@@ -1,206 +0,0 @@
1
- # ChatInput
2
-
3
- The ChatInput component is a customizable chat input field with support for file uploads and prompt examples.
4
-
5
- ## Import
6
-
7
- ```jsx
8
- import { ChatInput } from '@app-studio/web';
9
- ```
10
-
11
- ## Props
12
-
13
- | Prop | Type | Default | Description |
14
- | ---- | ---- | ------- | ----------- |
15
- | onSubmit | (message: string, options?: { model_name?: string; enable_thinking?: boolean }) => void | required | Callback function when the form is submitted |
16
- | placeholder | string | 'Say what you want and Kimmy will surprise you' | Placeholder text for the input |
17
- | loading | boolean | false | Whether the input is in a loading state |
18
- | disabled | boolean | false | Whether the input is disabled |
19
- | isAgentRunning | boolean | false | Whether an agent is currently running |
20
- | onStopAgent | () => void | undefined | Callback function to stop the agent |
21
- | autoFocus | boolean | true | Whether to auto focus the input |
22
- | value | string | undefined | Controlled value for the input |
23
- | onChange | (value: string) => void | undefined | Callback function when the input value changes |
24
- | onFileBrowse | () => void | undefined | Callback function when the file browser is opened |
25
- | sandboxId | string | undefined | ID of the sandbox |
26
- | hideAttachments | boolean | false | Whether to hide the attachment button |
27
- | title | string | undefined | Title for the chat input |
28
- | showGuideTip | boolean | false | Whether to show the guide tip |
29
- | guideVideoUrl | string | undefined | URL for the guide video |
30
- | onGuideClose | () => void | undefined | Callback function when the guide tip is closed |
31
- | promptExamples | PromptExample[] | [] | List of prompt examples |
32
- | onPromptExampleSelect | (example: PromptExample) => void | undefined | Callback function when a prompt example is selected |
33
- | size | 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' | 'md' | Size of the chat input |
34
- | shape | 'default' \| 'sharp' \| 'rounded' \| 'pillShaped' | 'rounded' | Shape of the chat input |
35
- | variant | 'default' \| 'outline' \| 'none' | 'default' | Visual variant of the chat input |
36
- | views | object | {} | Custom styling for different parts of the component |
37
-
38
- ## Interfaces
39
-
40
- ### PromptExample
41
-
42
- ```tsx
43
- interface PromptExample {
44
- id: string;
45
- text: string;
46
- }
47
- ```
48
-
49
- ### UploadedFile
50
-
51
- ```tsx
52
- interface UploadedFile {
53
- name: string;
54
- path: string;
55
- size: number;
56
- type: string;
57
- localUrl?: string;
58
- }
59
- ```
60
-
61
- ### ChatInputHandles
62
-
63
- ```tsx
64
- interface ChatInputHandles {
65
- getPendingFiles: () => File[];
66
- clearPendingFiles: () => void;
67
- }
68
- ```
69
-
70
- ## Examples
71
-
72
- ### Basic Usage
73
-
74
- ```jsx
75
- import React, { useState } from 'react';
76
- import { ChatInput } from '@app-studio/web';
77
- import { View } from 'app-studio';
78
-
79
- export const BasicChatInput = () => {
80
- const [inputValue, setInputValue] = useState('');
81
-
82
- const handleSubmit = (message) => {
83
- console.log('Message submitted:', message);
84
- setInputValue('');
85
- };
86
-
87
- return (
88
- <View width="100%">
89
- <ChatInput
90
- onSubmit={handleSubmit}
91
- value={inputValue}
92
- onChange={setInputValue}
93
- placeholder="Type your message here..."
94
- />
95
- </View>
96
- );
97
- };
98
- ```
99
-
100
- ### With Prompt Examples
101
-
102
- ```jsx
103
- import React, { useState } from 'react';
104
- import { ChatInput } from '@app-studio/web';
105
- import { View } from 'app-studio';
106
-
107
- export const ChatInputWithPromptExamples = () => {
108
- const [inputValue, setInputValue] = useState('');
109
-
110
- // Example prompt suggestions
111
- const promptExamples = [
112
- { id: '1', text: 'Tell me a joke' },
113
- { id: '2', text: 'What is the weather today?' },
114
- { id: '3', text: 'How do I create a React component?' },
115
- ];
116
-
117
- const handleSubmit = (message) => {
118
- console.log('Message submitted:', message);
119
- setInputValue('');
120
- };
121
-
122
- return (
123
- <View width="100%">
124
- <ChatInput
125
- onSubmit={handleSubmit}
126
- value={inputValue}
127
- onChange={setInputValue}
128
- promptExamples={promptExamples}
129
- />
130
- </View>
131
- );
132
- };
133
- ```
134
-
135
- ### With File Uploads
136
-
137
- ```jsx
138
- import React, { useRef } from 'react';
139
- import { ChatInput, ChatInputHandles } from '@app-studio/web';
140
- import { View } from 'app-studio';
141
-
142
- export const ChatInputWithFileUploads = () => {
143
- const chatInputRef = useRef<ChatInputHandles>(null);
144
-
145
- const handleSubmit = (message) => {
146
- // Get any pending files
147
- const pendingFiles = chatInputRef.current?.getPendingFiles() || [];
148
- console.log('Message submitted:', message);
149
- console.log('Pending files:', pendingFiles);
150
-
151
- // Clear pending files after submission
152
- chatInputRef.current?.clearPendingFiles();
153
- };
154
-
155
- return (
156
- <View width="100%">
157
- <ChatInput
158
- ref={chatInputRef}
159
- onSubmit={handleSubmit}
160
- hideAttachments={false}
161
- />
162
- </View>
163
- );
164
- };
165
- ```
166
-
167
- ## Customization
168
-
169
- The ChatInput component can be customized using the `views` prop:
170
-
171
- ```jsx
172
- <ChatInput
173
- // ...other props
174
- views={{
175
- container: { /* styles for the main container */ },
176
- content: { /* styles for the content wrapper */ },
177
- editableInput: { /* styles for the editable input */ },
178
- header: { /* styles for the header */ },
179
- title: { /* styles for the title */ },
180
- guideTip: { /* styles for the guide tip */ },
181
- promptExamples: { /* styles for the prompt examples container */ },
182
- promptExampleItem: { /* styles for each prompt example item */ },
183
- attachments: { /* styles for the attachments container */ },
184
- attachmentItem: { /* styles for each attachment item */ },
185
- submitButton: { /* styles for the submit button */ },
186
- fileButton: { /* styles for the file button */ },
187
- }}
188
- />
189
- ```
190
-
191
- ## Accessibility
192
-
193
- The ChatInput component implements the following accessibility features:
194
-
195
- - Keyboard navigation for submitting messages (Enter key)
196
- - ARIA attributes for interactive elements
197
- - Focus management for the input field
198
- - Proper contrast for text and buttons
199
-
200
- ## Best Practices
201
-
202
- - Provide clear placeholder text to guide users
203
- - Handle file uploads appropriately on the server side
204
- - Implement proper error handling for message submission
205
- - Use the `loading` state to indicate when a message is being processed
206
- - Provide feedback to users when messages are sent successfully
@@ -1,145 +0,0 @@
1
- # Button
2
-
3
- The Button component is used to trigger an action or event.
4
-
5
- ## Import
6
-
7
- ```jsx
8
- import { Button } from '@app-studio/web';
9
- ```
10
-
11
- ## Props
12
-
13
- | Prop | Type | Default | Description |
14
- | ---- | ---- | ------- | ----------- |
15
- | variant | 'filled' \| 'outline' \| 'ghost' \| 'link' | 'filled' | The visual style of the button |
16
- | size | 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' | 'md' | The size of the button |
17
- | shape | 'sharp' \| 'rounded' \| 'pillShaped' | 'rounded' | The shape of the button |
18
- | iconPosition | 'left' \| 'right' \| 'top' \| 'bottom' | 'left' | The position of the icon relative to the button text |
19
- | loaderPosition | 'left' \| 'right' | 'left' | The position of the loader relative to the button text |
20
- | backgroundColor | string | - | The background color of the button |
21
- | color | string | - | The color of the button text |
22
- | isAuto | boolean | false | Whether the button should automatically adjust its width |
23
- | isFilled | boolean | false | Whether the button should fill its container width |
24
- | isDisabled | boolean | false | Whether the button is disabled |
25
- | isLoading | boolean | false | Whether the button is in a loading state |
26
- | isIconRounded | boolean | false | Whether the icon should have rounded corners |
27
- | icon | React.ReactNode | - | The icon to display in the button |
28
- | children | React.ReactNode | - | The content of the button |
29
- | to | string | - | The URL to navigate to when the button is clicked (turns the button into a link) |
30
- | isExternal | boolean | false | Whether the link should open in a new tab |
31
- | shadow | Shadow | - | The shadow style of the button |
32
- | onClick | () => void | - | The function to call when the button is clicked |
33
- | views | ButtonStyles | {} | Custom styles for different parts of the button |
34
- | themeMode | 'light' \| 'dark' | - | Optional theme mode override |
35
-
36
- ## Examples
37
-
38
- ### Basic Button
39
-
40
- ```jsx
41
- <Button onClick={() => alert('Button clicked!')}>Click Me</Button>
42
- ```
43
-
44
- ### Button Variants
45
-
46
- ```jsx
47
- <>
48
- <Button variant="filled">Filled</Button>
49
- <Button variant="outline">Outline</Button>
50
- <Button variant="ghost">Ghost</Button>
51
- <Button variant="link">Link</Button>
52
- </>
53
- ```
54
-
55
- ### Button Sizes
56
-
57
- ```jsx
58
- <>
59
- <Button size="xs">Extra Small</Button>
60
- <Button size="sm">Small</Button>
61
- <Button size="md">Medium</Button>
62
- <Button size="lg">Large</Button>
63
- <Button size="xl">Extra Large</Button>
64
- </>
65
- ```
66
-
67
- ### Button with Icon
68
-
69
- ```jsx
70
- import { DustBinIcon } from '@app-studio/web';
71
-
72
- <Button icon={<DustBinIcon widthHeight={16} />}>Delete</Button>
73
- ```
74
-
75
- ### Button with Icon Position
76
-
77
- ```jsx
78
- import { DustBinIcon } from '@app-studio/web';
79
-
80
- <>
81
- <Button icon={<DustBinIcon widthHeight={16} />} iconPosition="left">Left Icon</Button>
82
- <Button icon={<DustBinIcon widthHeight={16} />} iconPosition="right">Right Icon</Button>
83
- <Button icon={<DustBinIcon widthHeight={16} />} iconPosition="top">Top Icon</Button>
84
- <Button icon={<DustBinIcon widthHeight={16} />} iconPosition="bottom">Bottom Icon</Button>
85
- </>
86
- ```
87
-
88
- ### Loading Button
89
-
90
- ```jsx
91
- <Button isLoading>Loading</Button>
92
- ```
93
-
94
- ### Disabled Button
95
-
96
- ```jsx
97
- <Button isDisabled>Disabled</Button>
98
- ```
99
-
100
- ### Link Button
101
-
102
- ```jsx
103
- <Button to="/dashboard" variant="link">Go to Dashboard</Button>
104
- ```
105
-
106
- ### External Link Button
107
-
108
- ```jsx
109
- <Button to="https://example.com" isExternal variant="link">External Link</Button>
110
- ```
111
-
112
- ### Custom Styled Button
113
-
114
- ```jsx
115
- <Button
116
- views={{
117
- container: {
118
- backgroundColor: '#6200ee',
119
- borderRadius: 8,
120
- boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
121
- },
122
- }}
123
- >
124
- Custom Styled Button
125
- </Button>
126
- ```
127
-
128
- ## Accessibility
129
-
130
- The Button component:
131
-
132
- - Uses the native `<button>` element for proper keyboard navigation and screen reader support
133
- - Supports the `aria-disabled` attribute when disabled
134
- - Maintains proper focus states for keyboard users
135
- - Uses appropriate color contrast for text and background
136
-
137
- ## Best Practices
138
-
139
- - Use clear, concise text that describes the action
140
- - Use the appropriate variant for the context (primary actions should use 'filled')
141
- - Include an icon only when it adds meaning or clarity
142
- - Avoid using too many buttons in close proximity
143
- - Use consistent button styles throughout your application
144
- - Consider the visual hierarchy of multiple buttons (primary, secondary actions)
145
- - Use the `isLoading` state for actions that take time to complete
@@ -1,301 +0,0 @@
1
- # Title
2
-
3
- The Title component is used for rendering animated and highlighted titles in hero sections and other prominent areas of the UI.
4
-
5
- ## Import
6
-
7
- ```jsx
8
- import { Title } from '@app-studio/web';
9
- ```
10
-
11
- ## Props
12
-
13
- | Prop | Type | Default | Description |
14
- | ---- | ---- | ------- | ----------- |
15
- | children | React.ReactNode | - | The main text content of the title |
16
- | highlightText | string \| string[] | - | Text to be highlighted within the title. If not provided, no highlighting will be applied |
17
- | highlightStyle | 'background' \| 'underline' \| 'gradient' \| 'outline' \| 'glow' | 'background' | The visual style of the highlighted text |
18
- | highlightColor | string | 'theme.primary' | The color of the highlighted text or background |
19
- | highlightSecondaryColor | string | - | The secondary color for gradient highlights |
20
- | size | 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| 'xl' \| 'xl' \| 'xl' \| 'xl' \| '6xl' | 'xl' | The size of the title |
21
- | centered | boolean | false | Whether to center the title |
22
- | animate | AnimationProps \| AnimationProps[] | - | Animation for the title. This should be an animation object with properties like from, to, duration, etc. |
23
- | highlightAnimate | AnimationProps \| AnimationProps[] | - | Animation specifically for the highlighted text |
24
- | alternateHighlightText | string[] | [] | Array of strings to cycle through, replacing the text specified in highlightText |
25
- | alternateAnimation | boolean | false | Whether to animate the alternating highlight text |
26
- | alternateDuration | number | 3000 | Duration in milliseconds for each alternating highlight text |
27
- | highlightTypewriter | boolean | false | Whether to apply a typewriter effect to the highlighted text |
28
- | highlightTypewriterDuration | number | 3000 | Duration in milliseconds for the typewriter effect |
29
- | views | TitleStyles | {} | Custom styles for different parts of the title |
30
- | themeMode | 'light' \| 'dark' | - | Optional theme mode override |
31
-
32
- ## Examples
33
-
34
- ### Basic Title
35
-
36
- ```jsx
37
- <Title>Simple Hero Title</Title>
38
- ```
39
-
40
- ### Title Sizes
41
-
42
- ```jsx
43
- <>
44
- <Title size="xs">Extra Small Title (xs)</Title>
45
- <Title size="sm">Small Title (sm)</Title>
46
- <Title size="md">Medium Title (md)</Title>
47
- <Title size="lg">Large Title (lg)</Title>
48
- <Title size="xl">Extra Large Title (xl - default)</Title>
49
- <Title size="xl">2XL Title</Title>
50
- <Title size="xl">3XL Title</Title>
51
- <Title size="xl">4XL Title</Title>
52
- <Title size="xl">5XL Title</Title>
53
- <Title size="6xl">6XL Title</Title>
54
- </>
55
- ```
56
-
57
- ### Highlighted Title
58
-
59
- ```jsx
60
- <Title
61
- highlightText="highlighted"
62
- highlightStyle="background"
63
- highlightColor="theme.primary"
64
- >
65
- Text with highlighted words
66
- </Title>
67
- ```
68
-
69
- ### Highlight Styles
70
-
71
- ```jsx
72
- <>
73
- <Title
74
- highlightText="background"
75
- highlightStyle="background"
76
- highlightColor="theme.primary"
77
- >
78
- Text with background highlight
79
- </Title>
80
-
81
- <Title
82
- highlightText="underlined"
83
- highlightStyle="underline"
84
- highlightColor="theme.secondary"
85
- >
86
- Text with underlined highlight
87
- </Title>
88
-
89
- <Title
90
- highlightText="gradient"
91
- highlightStyle="gradient"
92
- highlightColor="theme.primary"
93
- highlightSecondaryColor="theme.secondary"
94
- >
95
- Text with gradient highlight
96
- </Title>
97
-
98
- <Title
99
- highlightText="outline"
100
- highlightStyle="outline"
101
- highlightColor="theme.primary"
102
- >
103
- Text with outline highlight
104
- </Title>
105
-
106
- <Title
107
- highlightText="glow"
108
- highlightStyle="glow"
109
- highlightColor="theme.primary"
110
- >
111
- Text with glow highlight
112
- </Title>
113
- </>
114
- ```
115
-
116
- ### Multiple Highlights
117
-
118
- ```jsx
119
- <Title
120
- highlightText={['multiple', 'highlights']}
121
- highlightStyle="background"
122
- highlightColor="theme.primary"
123
- >
124
- Text with multiple highlights in the same sentence
125
- </Title>
126
- ```
127
-
128
- ### Animated Title
129
-
130
- ```jsx
131
- <Title
132
- animate={{
133
- from: { opacity: 0 },
134
- to: { opacity: 1 },
135
- duration: '1.5s',
136
- iterationCount: '1',
137
- }}
138
- >
139
- Fade In Animation
140
- </Title>
141
- ```
142
-
143
- ### Animated Highlight
144
-
145
- ```jsx
146
- <Title
147
- highlightText="animated highlight"
148
- highlightStyle="background"
149
- highlightColor="theme.primary"
150
- highlightAnimate={{
151
- from: { opacity: 0, transform: 'scale(0.9)' },
152
- to: { opacity: 1, transform: 'scale(1)' },
153
- duration: '0.5s',
154
- delay: '0.2s',
155
- }}
156
- >
157
- Text with animated highlight
158
- </Title>
159
- ```
160
-
161
- ### Alternating Highlight Text
162
-
163
- ```jsx
164
- <Title
165
- highlightText="changing"
166
- alternateHighlightText={[
167
- 'innovative',
168
- 'powerful',
169
- 'flexible',
170
- 'intuitive',
171
- ]}
172
- alternateAnimation={true}
173
- alternateDuration={2000}
174
- highlightStyle="background"
175
- highlightColor="theme.primary"
176
- >
177
- Our changing solution for your business
178
- </Title>
179
- ```
180
-
181
- ### Typewriter Effect
182
-
183
- ```jsx
184
- <Title
185
- highlightText="typewriter"
186
- highlightStyle="background"
187
- highlightColor="theme.primary"
188
- highlightTypewriter={true}
189
- highlightTypewriterDuration={1500}
190
- >
191
- This text has a typewriter effect on the highlighted word
192
- </Title>
193
- ```
194
-
195
- ### Responsive Title
196
-
197
- ```jsx
198
- <Title
199
- media={{
200
- mobile: {
201
- fontSize: 32,
202
- lineHeight: '40px',
203
- },
204
- tablet: {
205
- fontSize: 48,
206
- lineHeight: '56px',
207
- },
208
- desktop: {
209
- fontSize: 64,
210
- lineHeight: '72px',
211
- },
212
- }}
213
- highlightText="Responsive"
214
- highlightStyle="background"
215
- highlightColor="theme.primary"
216
- >
217
- Responsive Title Example
218
- </Title>
219
- ```
220
-
221
- ### Custom Styling
222
-
223
- ```jsx
224
- <Title
225
- views={{
226
- container: {
227
- fontFamily: 'Georgia, serif',
228
- letterSpacing: '0.05em',
229
- textTransform: 'uppercase',
230
- },
231
- highlight: {
232
- borderRadius: '8px',
233
- padding: '0 12px',
234
- },
235
- }}
236
- highlightText="Custom"
237
- highlightStyle="background"
238
- highlightColor="color.purple.500"
239
- >
240
- Title with Custom Styling
241
- </Title>
242
- ```
243
-
244
- ### Hero Section Example
245
-
246
- ```jsx
247
- <View
248
- backgroundColor="color.gray.50"
249
- padding={48}
250
- borderRadius={8}
251
- width="100%"
252
- >
253
- <Vertical gap={24} maxWidth={800} marginX="auto">
254
- <Title
255
- size="xl"
256
- animate={{
257
- from: { opacity: 0 },
258
- to: { opacity: 1 },
259
- duration: '1s',
260
- iterationCount: '1',
261
- }}
262
- highlightText="Platform"
263
- highlightStyle="gradient"
264
- highlightColor="theme.primary"
265
- highlightSecondaryColor="theme.secondary"
266
- centered
267
- >
268
- Welcome to Our Platform
269
- </Title>
270
-
271
- <Text
272
- textAlign="center"
273
- color="color.gray.600"
274
- fontSize={20}
275
- lineHeight={28}
276
- >
277
- Build beautiful, responsive, and interactive user interfaces with our
278
- powerful component library.
279
- </Text>
280
- </Vertical>
281
- </View>
282
- ```
283
-
284
- ## Accessibility
285
-
286
- The Title component:
287
-
288
- - Uses semantic heading elements (`<h1>`) for proper document structure
289
- - Maintains proper color contrast for highlighted text
290
- - Supports keyboard navigation and focus management
291
- - Works with screen readers by using appropriate ARIA attributes
292
-
293
- ## Best Practices
294
-
295
- - Use the Title component for main headings and important text that needs emphasis
296
- - Choose highlight styles that maintain good contrast with the background
297
- - Use animations sparingly to avoid distracting users
298
- - Consider using responsive sizing for different screen sizes
299
- - Limit the use of alternating text to avoid confusion
300
- - Ensure that any animations respect user preferences for reduced motion
301
- - Use semantic colors from the theme system rather than hardcoded values