@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.
- package/dist/bot/Bot.d.ts +15 -0
- package/dist/bot/Cache.d.ts +13 -0
- package/dist/bot/Config.d.ts +13 -0
- package/dist/bot/ContentFetcher.d.ts +9 -0
- package/dist/bot/DocuCode.d.ts +19 -0
- package/dist/bot/FileHandler.d.ts +39 -0
- package/dist/bot/ai/AnthropicConnector.d.ts +6 -0
- package/dist/bot/ai/GeminiConnector.d.ts +7 -0
- package/dist/bot/ai/GroqConnector.d.ts +7 -0
- package/dist/bot/ai/HuggingFaceConnector.d.ts +6 -0
- package/dist/bot/ai/OpenAIConnector.d.ts +11 -0
- package/dist/bot/ai/ReplicateConnector.d.ts +7 -0
- package/dist/bot/ai/SambaNovaConnector.d.ts +6 -0
- package/dist/bot/ai/ai.config.d.ts +12 -0
- package/dist/bot/ai/ai.service.d.ts +36 -0
- package/dist/bot/data.d.ts +19 -0
- package/dist/bot/extractors.d.ts +8 -0
- package/dist/bot/index.d.ts +1 -0
- package/dist/bot/prompt/1-project.d.ts +1 -0
- package/dist/bot/prompt/2-response.d.ts +1 -0
- package/dist/bot/prompt/3-comment.d.ts +1 -0
- package/docs/components/Accordion.mdx +74 -121
- package/docs/components/Alert.mdx +19 -70
- package/docs/components/AspectRatio.mdx +13 -11
- package/docs/components/AudioInput.mdx +43 -0
- package/docs/components/Avatar.mdx +18 -43
- package/docs/components/Background.mdx +100 -492
- package/docs/components/Badge.mdx +45 -130
- package/docs/components/Button.mdx +76 -128
- package/docs/components/Calendar.mdx +7 -7
- package/docs/components/Card.mdx +247 -290
- package/docs/components/Carousel.mdx +94 -321
- package/docs/components/Chart.mdx +171 -26
- package/docs/components/ChatInput.mdx +327 -275
- package/docs/components/Checkbox.mdx +3 -5
- package/docs/components/ColorInput.mdx +6 -6
- package/docs/components/ColorPicker.mdx +452 -0
- package/docs/components/ComboBox.mdx +13 -13
- package/docs/components/Command.mdx +140 -188
- package/docs/components/ContextMenu.mdx +47 -171
- package/docs/components/CookieConsent.mdx +53 -0
- package/docs/components/CountryPicker.mdx +8 -8
- package/docs/components/DatePicker.mdx +3 -3
- package/docs/components/DragAndDrop.mdx +279 -463
- package/docs/components/Drawer.mdx +392 -231
- package/docs/components/DropdownMenu.mdx +37 -155
- package/docs/components/EmojiPicker.mdx +84 -0
- package/docs/components/File.mdx +130 -4
- package/docs/components/Formik.mdx +39 -39
- package/docs/components/Gradient.mdx +359 -182
- package/docs/components/Horizontal.mdx +1 -2
- package/docs/components/HoverCard.mdx +57 -125
- package/docs/components/KanbanBoard.mdx +9 -9
- package/docs/components/Link.mdx +22 -30
- package/docs/components/Loader.mdx +230 -413
- package/docs/components/Menubar.mdx +73 -69
- package/docs/components/Message.mdx +210 -525
- package/docs/components/Modal.mdx +351 -475
- package/docs/components/NavigationMenu.mdx +8 -8
- package/docs/components/OTPInput.mdx +194 -0
- package/docs/components/Pagination.mdx +451 -107
- package/docs/components/Password.mdx +8 -8
- package/docs/components/ProgressBar.mdx +460 -0
- package/docs/components/Resizable.mdx +103 -102
- package/docs/components/Select.mdx +5 -5
- package/docs/components/Separator.mdx +11 -98
- package/docs/components/ShareButton.mdx +29 -0
- package/docs/components/Sidebar.mdx +70 -131
- package/docs/components/Slider.mdx +99 -185
- package/docs/components/StatusIndicator.mdx +373 -0
- package/docs/components/Switch.mdx +3 -3
- package/docs/components/Table.mdx +25 -105
- package/docs/components/Tabs.mdx +40 -143
- package/docs/components/TagInput.mdx +17 -17
- package/docs/components/Text.mdx +3 -3
- package/docs/components/TextArea.mdx +6 -6
- package/docs/components/TextField.mdx +12 -12
- package/docs/components/Title.mdx +267 -525
- package/docs/components/Toast.mdx +65 -142
- package/docs/components/Toggle.mdx +37 -49
- package/docs/components/ToggleGroup.mdx +36 -57
- package/docs/components/Tooltip.mdx +501 -138
- package/docs/components/Uploader.mdx +205 -351
- package/package.json +1 -1
- package/dist/components/AuthGuard/AuthGuard.d.ts +0 -35
- package/dist/components/AuthGuard/index.d.ts +0 -1
- package/docs/adk-components.md +0 -319
- package/docs/adk-quick-start.md +0 -268
|
@@ -1,527 +1,344 @@
|
|
|
1
1
|
# Loader
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A loading indicator component with multiple types, sizes, speeds, and text positioning options.
|
|
4
4
|
|
|
5
5
|
### **Import**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
```tsx
|
|
7
|
+
import { Loader } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
9
|
|
|
10
|
-
### **
|
|
10
|
+
### **Default**
|
|
11
11
|
```tsx
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { Loader } from '@app-studio/web';
|
|
14
14
|
|
|
15
|
-
export const
|
|
16
|
-
<Loader
|
|
15
|
+
export const DefaultLoader = () => (
|
|
16
|
+
<Loader />
|
|
17
17
|
);
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
### **
|
|
20
|
+
### **type**
|
|
21
|
+
Defines the type of the loader.
|
|
22
|
+
|
|
23
|
+
- **Type:** `LoaderType`
|
|
24
|
+
- **Default:** `'spinner'`
|
|
25
|
+
- **Possible Values:** `'spinner' | 'dotted' | 'quarter' | 'pulse' | 'bars'`
|
|
26
|
+
|
|
21
27
|
```tsx
|
|
22
28
|
import React from 'react';
|
|
23
29
|
import { Loader } from '@app-studio/web';
|
|
24
|
-
import {
|
|
30
|
+
import { Horizontal } from 'app-studio';
|
|
25
31
|
|
|
26
32
|
export const LoaderTypes = () => (
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</
|
|
33
|
+
<Horizontal gap={30}>
|
|
34
|
+
<Loader type="spinner" />
|
|
35
|
+
<Loader type="dotted" />
|
|
36
|
+
<Loader type="quarter" />
|
|
37
|
+
<Loader type="pulse" />
|
|
38
|
+
<Loader type="bars" />
|
|
39
|
+
</Horizontal>
|
|
34
40
|
);
|
|
35
41
|
```
|
|
36
42
|
|
|
37
|
-
### **
|
|
43
|
+
### **size**
|
|
44
|
+
Sets the size of the loader.
|
|
45
|
+
|
|
46
|
+
- **Type:** `number | Size`
|
|
47
|
+
- **Default:** `'md'`
|
|
48
|
+
- **Possible Values:** `'xs' | 'sm' | 'md' | 'lg' | 'xl'` or pixel number
|
|
49
|
+
|
|
38
50
|
```tsx
|
|
39
51
|
import React from 'react';
|
|
40
52
|
import { Loader } from '@app-studio/web';
|
|
41
|
-
import { Horizontal } from '
|
|
53
|
+
import { Horizontal } from 'app-studio';
|
|
42
54
|
|
|
43
55
|
export const LoaderSizes = () => (
|
|
44
|
-
<Horizontal gap={
|
|
45
|
-
<Loader size="xs"
|
|
46
|
-
<Loader size="sm"
|
|
47
|
-
<Loader size="md"
|
|
48
|
-
<Loader size="lg"
|
|
49
|
-
<Loader size="xl"
|
|
56
|
+
<Horizontal gap={20} alignItems="center">
|
|
57
|
+
<Loader size="xs" />
|
|
58
|
+
<Loader size="sm" />
|
|
59
|
+
<Loader size="md" />
|
|
60
|
+
<Loader size="lg" />
|
|
61
|
+
<Loader size="xl" />
|
|
50
62
|
</Horizontal>
|
|
51
63
|
);
|
|
52
64
|
```
|
|
53
65
|
|
|
54
|
-
### **Custom
|
|
66
|
+
### **Custom Size**
|
|
67
|
+
Using pixel values for custom sizes.
|
|
68
|
+
|
|
55
69
|
```tsx
|
|
56
70
|
import React from 'react';
|
|
57
71
|
import { Loader } from '@app-studio/web';
|
|
58
|
-
import { Horizontal } from '
|
|
59
|
-
|
|
60
|
-
export const
|
|
61
|
-
<Horizontal gap={
|
|
62
|
-
<Loader size={16}
|
|
63
|
-
<Loader size={32}
|
|
64
|
-
<Loader size={48}
|
|
65
|
-
<Loader size={64}
|
|
72
|
+
import { Horizontal } from 'app-studio';
|
|
73
|
+
|
|
74
|
+
export const CustomSizeLoaders = () => (
|
|
75
|
+
<Horizontal gap={20} alignItems="center">
|
|
76
|
+
<Loader size={16} />
|
|
77
|
+
<Loader size={32} />
|
|
78
|
+
<Loader size={48} />
|
|
79
|
+
<Loader size={64} />
|
|
66
80
|
</Horizontal>
|
|
67
81
|
);
|
|
68
82
|
```
|
|
69
83
|
|
|
70
|
-
### **
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
import { Vertical } from '@app-studio/web';
|
|
75
|
-
|
|
76
|
-
export const TextPositioning = () => (
|
|
77
|
-
<Vertical gap={32}>
|
|
78
|
-
<Loader textPosition="right">Loading (Right)</Loader>
|
|
79
|
-
<Loader textPosition="left">Loading (Left)</Loader>
|
|
80
|
-
<Loader textPosition="top">Loading (Top)</Loader>
|
|
81
|
-
<Loader textPosition="bottom">Loading (Bottom)</Loader>
|
|
82
|
-
</Vertical>
|
|
83
|
-
);
|
|
84
|
-
```
|
|
84
|
+
### **loaderColor**
|
|
85
|
+
Defines the color of the loader element.
|
|
86
|
+
|
|
87
|
+
- **Type:** `string`
|
|
85
88
|
|
|
86
|
-
### **Colors and Theming**
|
|
87
89
|
```tsx
|
|
88
90
|
import React from 'react';
|
|
89
91
|
import { Loader } from '@app-studio/web';
|
|
90
|
-
import {
|
|
92
|
+
import { Horizontal } from 'app-studio';
|
|
91
93
|
|
|
92
94
|
export const ColoredLoaders = () => (
|
|
93
|
-
<
|
|
94
|
-
<Loader
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
<Loader
|
|
102
|
-
loaderColor="color.green.500"
|
|
103
|
-
textColor="color.green.700"
|
|
104
|
-
>
|
|
105
|
-
Green Loader
|
|
106
|
-
</Loader>
|
|
107
|
-
|
|
108
|
-
<Loader
|
|
109
|
-
loaderColor="color.red.500"
|
|
110
|
-
textColor="color.red.700"
|
|
111
|
-
>
|
|
112
|
-
Red Loader
|
|
113
|
-
</Loader>
|
|
114
|
-
|
|
115
|
-
<Loader
|
|
116
|
-
loaderColor="theme.primary"
|
|
117
|
-
textColor="theme.primary"
|
|
118
|
-
>
|
|
119
|
-
Theme Primary
|
|
120
|
-
</Loader>
|
|
121
|
-
</Vertical>
|
|
95
|
+
<Horizontal gap={30}>
|
|
96
|
+
<Loader loaderColor="#3b82f6" />
|
|
97
|
+
<Loader loaderColor="#10b981" />
|
|
98
|
+
<Loader loaderColor="#ef4444" />
|
|
99
|
+
<Loader loaderColor="#f59e0b" />
|
|
100
|
+
<Loader loaderColor="#8b5cf6" />
|
|
101
|
+
</Horizontal>
|
|
122
102
|
);
|
|
123
103
|
```
|
|
124
104
|
|
|
125
|
-
### **
|
|
105
|
+
### **speed**
|
|
106
|
+
Controls the speed of the loader's animation.
|
|
107
|
+
|
|
108
|
+
- **Type:** `Speed`
|
|
109
|
+
- **Default:** `'normal'`
|
|
110
|
+
- **Possible Values:** `'slow' | 'normal' | 'fast'`
|
|
111
|
+
|
|
126
112
|
```tsx
|
|
127
113
|
import React from 'react';
|
|
128
114
|
import { Loader } from '@app-studio/web';
|
|
129
|
-
import { Horizontal } from '
|
|
115
|
+
import { Horizontal } from 'app-studio';
|
|
130
116
|
|
|
131
|
-
export const
|
|
132
|
-
<Horizontal gap={
|
|
133
|
-
<Loader speed="slow"
|
|
134
|
-
<Loader speed="normal"
|
|
135
|
-
<Loader speed="fast"
|
|
117
|
+
export const LoaderSpeeds = () => (
|
|
118
|
+
<Horizontal gap={30}>
|
|
119
|
+
<Loader speed="slow" />
|
|
120
|
+
<Loader speed="normal" />
|
|
121
|
+
<Loader speed="fast" />
|
|
136
122
|
</Horizontal>
|
|
137
123
|
);
|
|
138
124
|
```
|
|
139
125
|
|
|
140
|
-
### **
|
|
141
|
-
|
|
142
|
-
import React, { useState } from 'react';
|
|
143
|
-
import { Loader } from '@app-studio/web';
|
|
144
|
-
import { Button } from '@app-studio/web';
|
|
145
|
-
import { View, Text, Vertical } from '@app-studio/web';
|
|
126
|
+
### **children**
|
|
127
|
+
Text or content to display with the loader.
|
|
146
128
|
|
|
147
|
-
|
|
148
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
149
|
-
const [data, setData] = useState(null);
|
|
150
|
-
|
|
151
|
-
const handleLoad = async () => {
|
|
152
|
-
setIsLoading(true);
|
|
153
|
-
// Simulate API call
|
|
154
|
-
setTimeout(() => {
|
|
155
|
-
setData('Data loaded successfully!');
|
|
156
|
-
setIsLoading(false);
|
|
157
|
-
}, 2000);
|
|
158
|
-
};
|
|
129
|
+
- **Type:** `React.ReactNode`
|
|
159
130
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
Load Data
|
|
164
|
-
</Button>
|
|
131
|
+
```tsx
|
|
132
|
+
import React from 'react';
|
|
133
|
+
import { Loader } from '@app-studio/web';
|
|
165
134
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
border="1px solid"
|
|
170
|
-
borderColor="color.gray.200"
|
|
171
|
-
borderRadius={8}
|
|
172
|
-
display="flex"
|
|
173
|
-
alignItems="center"
|
|
174
|
-
justifyContent="center"
|
|
175
|
-
>
|
|
176
|
-
{isLoading ? (
|
|
177
|
-
<Loader loaderColor="theme.primary">
|
|
178
|
-
Loading data...
|
|
179
|
-
</Loader>
|
|
180
|
-
) : data ? (
|
|
181
|
-
<Text color="color.green.600">{data}</Text>
|
|
182
|
-
) : (
|
|
183
|
-
<Text color="color.gray.500">No data loaded</Text>
|
|
184
|
-
)}
|
|
185
|
-
</View>
|
|
186
|
-
</Vertical>
|
|
187
|
-
);
|
|
188
|
-
};
|
|
135
|
+
export const LoaderWithText = () => (
|
|
136
|
+
<Loader>Loading...</Loader>
|
|
137
|
+
);
|
|
189
138
|
```
|
|
190
139
|
|
|
191
|
-
### **
|
|
192
|
-
|
|
193
|
-
| Prop | Type | Default | Description |
|
|
194
|
-
| ---- | ---- | ------- | ----------- |
|
|
195
|
-
| children | React.ReactNode | undefined | Text to display alongside the loader |
|
|
196
|
-
| type | `'default' \| 'dotted' \| 'quarter'` | 'default' | Type of loading animation |
|
|
197
|
-
| size | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| number` | 'md' | Size of the loader |
|
|
198
|
-
| speed | `'slow' \| 'normal' \| 'fast'` | 'normal' | Animation speed |
|
|
199
|
-
| loaderColor | string | 'currentColor' | Color of the loader animation |
|
|
200
|
-
| textColor | string | 'currentColor' | Color of the text |
|
|
201
|
-
| textPosition | `'left' \| 'right' \| 'top' \| 'bottom'` | 'right' | Position of text relative to loader |
|
|
140
|
+
### **textPosition**
|
|
141
|
+
Determines the position of the text relative to the loader.
|
|
202
142
|
|
|
203
|
-
**
|
|
204
|
-
-
|
|
205
|
-
-
|
|
206
|
-
- Styling properties like `backgroundColor`, `borderRadius`
|
|
143
|
+
- **Type:** `TextPosition`
|
|
144
|
+
- **Default:** `'bottom'`
|
|
145
|
+
- **Possible Values:** `'top' | 'bottom' | 'left' | 'right'`
|
|
207
146
|
|
|
208
|
-
### **Full Page Loading**
|
|
209
147
|
```tsx
|
|
210
148
|
import React from 'react';
|
|
211
149
|
import { Loader } from '@app-studio/web';
|
|
212
|
-
import {
|
|
213
|
-
|
|
214
|
-
export const
|
|
215
|
-
<
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
left
|
|
219
|
-
right
|
|
220
|
-
|
|
221
|
-
backgroundColor="rgba(255, 255, 255, 0.9)"
|
|
222
|
-
zIndex={9999}
|
|
223
|
-
>
|
|
224
|
-
<Loader
|
|
225
|
-
size="lg"
|
|
226
|
-
loaderColor="theme.primary"
|
|
227
|
-
textColor="theme.primary"
|
|
228
|
-
>
|
|
229
|
-
Loading application...
|
|
230
|
-
</Loader>
|
|
231
|
-
</Center>
|
|
150
|
+
import { Vertical } from 'app-studio';
|
|
151
|
+
|
|
152
|
+
export const TextPositions = () => (
|
|
153
|
+
<Vertical gap={30}>
|
|
154
|
+
<Loader textPosition="top">Loading from top</Loader>
|
|
155
|
+
<Loader textPosition="bottom">Loading from bottom</Loader>
|
|
156
|
+
<Loader textPosition="left">Loading from left</Loader>
|
|
157
|
+
<Loader textPosition="right">Loading from right</Loader>
|
|
158
|
+
</Vertical>
|
|
232
159
|
);
|
|
233
160
|
```
|
|
234
161
|
|
|
235
|
-
### **
|
|
236
|
-
|
|
237
|
-
import React, { useState } from 'react';
|
|
238
|
-
import { Loader } from '@app-studio/web';
|
|
239
|
-
import { Button } from '@app-studio/web';
|
|
240
|
-
import { Horizontal, Text } from '@app-studio/web';
|
|
241
|
-
|
|
242
|
-
export const InlineLoader = () => {
|
|
243
|
-
const [saving, setSaving] = useState(false);
|
|
162
|
+
### **textColor**
|
|
163
|
+
Sets the color of the text displayed with the loader.
|
|
244
164
|
|
|
245
|
-
|
|
246
|
-
setSaving(true);
|
|
247
|
-
setTimeout(() => setSaving(false), 2000);
|
|
248
|
-
};
|
|
165
|
+
- **Type:** `string`
|
|
249
166
|
|
|
250
|
-
return (
|
|
251
|
-
<Horizontal gap={16} alignItems="center">
|
|
252
|
-
<Button onClick={handleSave} disabled={saving}>
|
|
253
|
-
Save Changes
|
|
254
|
-
</Button>
|
|
255
|
-
|
|
256
|
-
{saving && (
|
|
257
|
-
<Loader size="sm" loaderColor="color.blue.500">
|
|
258
|
-
Saving...
|
|
259
|
-
</Loader>
|
|
260
|
-
)}
|
|
261
|
-
|
|
262
|
-
{!saving && (
|
|
263
|
-
<Text color="color.green.600" fontSize={14}>
|
|
264
|
-
All changes saved
|
|
265
|
-
</Text>
|
|
266
|
-
)}
|
|
267
|
-
</Horizontal>
|
|
268
|
-
);
|
|
269
|
-
};
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
### **Card Loading State**
|
|
273
167
|
```tsx
|
|
274
|
-
import React
|
|
168
|
+
import React from 'react';
|
|
275
169
|
import { Loader } from '@app-studio/web';
|
|
276
|
-
import { View, Text, Vertical } from '@app-studio/web';
|
|
277
|
-
|
|
278
|
-
export const CardLoader = () => {
|
|
279
|
-
const [loading, setLoading] = useState(true);
|
|
280
|
-
const [content, setContent] = useState(null);
|
|
281
|
-
|
|
282
|
-
useEffect(() => {
|
|
283
|
-
// Simulate data loading
|
|
284
|
-
setTimeout(() => {
|
|
285
|
-
setContent({
|
|
286
|
-
title: 'Card Title',
|
|
287
|
-
description: 'This is the card content that was loaded.',
|
|
288
|
-
});
|
|
289
|
-
setLoading(false);
|
|
290
|
-
}, 3000);
|
|
291
|
-
}, []);
|
|
292
170
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
backgroundColor="color.white"
|
|
302
|
-
>
|
|
303
|
-
{loading ? (
|
|
304
|
-
<Center height="100%">
|
|
305
|
-
<Loader
|
|
306
|
-
type="dotted"
|
|
307
|
-
loaderColor="color.gray.400"
|
|
308
|
-
textColor="color.gray.600"
|
|
309
|
-
>
|
|
310
|
-
Loading content...
|
|
311
|
-
</Loader>
|
|
312
|
-
</Center>
|
|
313
|
-
) : (
|
|
314
|
-
<Vertical gap={12}>
|
|
315
|
-
<Text fontSize={18} fontWeight="bold">
|
|
316
|
-
{content.title}
|
|
317
|
-
</Text>
|
|
318
|
-
<Text color="color.gray.600">
|
|
319
|
-
{content.description}
|
|
320
|
-
</Text>
|
|
321
|
-
</Vertical>
|
|
322
|
-
)}
|
|
323
|
-
</View>
|
|
324
|
-
);
|
|
325
|
-
};
|
|
171
|
+
export const ColoredTextLoader = () => (
|
|
172
|
+
<Loader
|
|
173
|
+
loaderColor="#3b82f6"
|
|
174
|
+
textColor="#3b82f6"
|
|
175
|
+
>
|
|
176
|
+
Loading...
|
|
177
|
+
</Loader>
|
|
178
|
+
);
|
|
326
179
|
```
|
|
327
180
|
|
|
328
|
-
### **
|
|
181
|
+
### **Loading States**
|
|
182
|
+
Common loading state patterns.
|
|
183
|
+
|
|
329
184
|
```tsx
|
|
330
185
|
import React, { useState } from 'react';
|
|
331
186
|
import { Loader } from '@app-studio/web';
|
|
332
|
-
import { Button } from '
|
|
333
|
-
import { Horizontal } from '@app-studio/web';
|
|
334
|
-
|
|
335
|
-
export const ButtonLoaders = () => {
|
|
336
|
-
const [loading1, setLoading1] = useState(false);
|
|
337
|
-
const [loading2, setLoading2] = useState(false);
|
|
187
|
+
import { Button, Vertical } from 'app-studio';
|
|
338
188
|
|
|
189
|
+
export const LoadingStates = () => {
|
|
190
|
+
const [loading, setLoading] = useState(false);
|
|
191
|
+
|
|
339
192
|
return (
|
|
340
|
-
<
|
|
341
|
-
<Button
|
|
342
|
-
onClick={() => {
|
|
343
|
-
setLoading1(true);
|
|
344
|
-
setTimeout(() => setLoading1(false), 2000);
|
|
345
|
-
}}
|
|
346
|
-
disabled={loading1}
|
|
347
|
-
icon={loading1 ? <Loader size={16} loaderColor="currentColor" /> : undefined}
|
|
348
|
-
>
|
|
349
|
-
{loading1 ? 'Submitting...' : 'Submit'}
|
|
350
|
-
</Button>
|
|
351
|
-
|
|
352
|
-
<Button
|
|
353
|
-
variant="outline"
|
|
193
|
+
<Vertical gap={20}>
|
|
194
|
+
<Button
|
|
354
195
|
onClick={() => {
|
|
355
|
-
|
|
356
|
-
setTimeout(() =>
|
|
196
|
+
setLoading(true);
|
|
197
|
+
setTimeout(() => setLoading(false), 3000);
|
|
357
198
|
}}
|
|
358
|
-
disabled={loading2}
|
|
359
199
|
>
|
|
360
|
-
|
|
361
|
-
<Loader size={16} loaderColor="currentColor">
|
|
362
|
-
Processing
|
|
363
|
-
</Loader>
|
|
364
|
-
) : (
|
|
365
|
-
'Process'
|
|
366
|
-
)}
|
|
200
|
+
Start Loading
|
|
367
201
|
</Button>
|
|
368
|
-
|
|
202
|
+
|
|
203
|
+
{loading && (
|
|
204
|
+
<Loader>Please wait...</Loader>
|
|
205
|
+
)}
|
|
206
|
+
</Vertical>
|
|
369
207
|
);
|
|
370
208
|
};
|
|
371
209
|
```
|
|
372
210
|
|
|
373
|
-
### **
|
|
211
|
+
### **Inline Loader**
|
|
212
|
+
Small loader for inline use.
|
|
213
|
+
|
|
374
214
|
```tsx
|
|
375
215
|
import React from 'react';
|
|
376
216
|
import { Loader } from '@app-studio/web';
|
|
377
|
-
import {
|
|
217
|
+
import { Text, Horizontal } from 'app-studio';
|
|
378
218
|
|
|
379
|
-
export const
|
|
380
|
-
<
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
>
|
|
385
|
-
<Loader
|
|
386
|
-
type="quarter"
|
|
387
|
-
size={48}
|
|
388
|
-
loaderColor="color.white"
|
|
389
|
-
textColor="color.white"
|
|
390
|
-
textPosition="bottom"
|
|
391
|
-
views={{
|
|
392
|
-
container: {
|
|
393
|
-
gap: 16,
|
|
394
|
-
},
|
|
395
|
-
text: {
|
|
396
|
-
fontWeight: 'medium',
|
|
397
|
-
fontSize: 16,
|
|
398
|
-
},
|
|
399
|
-
}}
|
|
400
|
-
>
|
|
401
|
-
Loading...
|
|
402
|
-
</Loader>
|
|
403
|
-
</View>
|
|
219
|
+
export const InlineLoader = () => (
|
|
220
|
+
<Horizontal gap={10} alignItems="center">
|
|
221
|
+
<Text>Saving</Text>
|
|
222
|
+
<Loader size={16} />
|
|
223
|
+
</Horizontal>
|
|
404
224
|
);
|
|
405
225
|
```
|
|
406
226
|
|
|
407
|
-
### **
|
|
408
|
-
|
|
409
|
-
**When to Use:**
|
|
410
|
-
- During API calls and data fetching
|
|
411
|
-
- File uploads and downloads
|
|
412
|
-
- Form submissions
|
|
413
|
-
- Page transitions
|
|
414
|
-
- Long-running operations
|
|
415
|
-
|
|
416
|
-
**User Experience:**
|
|
417
|
-
- Show loaders for operations taking longer than 200ms
|
|
418
|
-
- Provide meaningful loading text when possible
|
|
419
|
-
- Use appropriate sizes for the context
|
|
420
|
-
- Consider skeleton screens for content loading
|
|
421
|
-
- Ensure loaders are accessible to screen readers
|
|
422
|
-
|
|
423
|
-
**Performance:**
|
|
424
|
-
- Use CSS animations instead of JavaScript when possible
|
|
425
|
-
- Avoid showing loaders for very quick operations
|
|
426
|
-
- Consider lazy loading for better perceived performance
|
|
427
|
-
- Use appropriate animation speeds (not too fast or slow)
|
|
428
|
-
|
|
429
|
-
**Accessibility:**
|
|
430
|
-
- Include descriptive text for screen readers
|
|
431
|
-
- Use `aria-live` regions for dynamic loading states
|
|
432
|
-
- Ensure sufficient color contrast
|
|
433
|
-
- Provide alternative feedback for users who can't see animations
|
|
434
|
-
|
|
435
|
-
### **Integration Examples**
|
|
436
|
-
|
|
437
|
-
**With Forms:**
|
|
438
|
-
```tsx
|
|
439
|
-
import { FormikForm, FormikTextField } from '@app-studio/web';
|
|
227
|
+
### **Full Page Loader**
|
|
228
|
+
Centered loader for full page loading.
|
|
440
229
|
|
|
441
|
-
|
|
442
|
-
|
|
230
|
+
```tsx
|
|
231
|
+
import React from 'react';
|
|
232
|
+
import { Loader } from '@app-studio/web';
|
|
233
|
+
import { Center } from 'app-studio';
|
|
443
234
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
disabled={submitting}
|
|
450
|
-
icon={submitting ? <Loader size={16} /> : undefined}
|
|
451
|
-
>
|
|
452
|
-
{submitting ? 'Submitting...' : 'Submit'}
|
|
453
|
-
</Button>
|
|
454
|
-
</FormikForm>
|
|
455
|
-
);
|
|
456
|
-
};
|
|
235
|
+
export const FullPageLoader = () => (
|
|
236
|
+
<Center width="100vw" height="100vh">
|
|
237
|
+
<Loader size="xl">Loading application...</Loader>
|
|
238
|
+
</Center>
|
|
239
|
+
);
|
|
457
240
|
```
|
|
458
241
|
|
|
459
|
-
**
|
|
242
|
+
### **Card Loading**
|
|
243
|
+
Loader inside a card component.
|
|
244
|
+
|
|
460
245
|
```tsx
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
246
|
+
import React from 'react';
|
|
247
|
+
import { Loader } from '@app-studio/web';
|
|
248
|
+
import { Card } from '@app-studio/web';
|
|
249
|
+
import { Center } from 'app-studio';
|
|
250
|
+
|
|
251
|
+
export const CardLoader = () => (
|
|
252
|
+
<Card width={300} height={200}>
|
|
253
|
+
<Center width="100%" height="100%">
|
|
254
|
+
<Loader>Loading content...</Loader>
|
|
255
|
+
</Center>
|
|
256
|
+
</Card>
|
|
471
257
|
);
|
|
472
258
|
```
|
|
473
259
|
|
|
474
|
-
**
|
|
260
|
+
### **Button Loading**
|
|
261
|
+
Loader integrated with button.
|
|
262
|
+
|
|
475
263
|
```tsx
|
|
476
|
-
|
|
477
|
-
|
|
264
|
+
import React, { useState } from 'react';
|
|
265
|
+
import { Loader } from '@app-studio/web';
|
|
266
|
+
import { Button, Horizontal } from 'app-studio';
|
|
478
267
|
|
|
268
|
+
export const ButtonLoader = () => {
|
|
269
|
+
const [loading, setLoading] = useState(false);
|
|
270
|
+
|
|
479
271
|
return (
|
|
480
|
-
<
|
|
481
|
-
{
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
)}
|
|
493
|
-
<img
|
|
494
|
-
src={src}
|
|
495
|
-
alt={alt}
|
|
496
|
-
onLoad={() => setLoading(false)}
|
|
497
|
-
style={{ opacity: loading ? 0 : 1 }}
|
|
498
|
-
/>
|
|
499
|
-
</View>
|
|
272
|
+
<Button
|
|
273
|
+
onClick={() => {
|
|
274
|
+
setLoading(true);
|
|
275
|
+
setTimeout(() => setLoading(false), 2000);
|
|
276
|
+
}}
|
|
277
|
+
isDisabled={loading}
|
|
278
|
+
>
|
|
279
|
+
<Horizontal gap={10} alignItems="center">
|
|
280
|
+
{loading && <Loader size={16} loaderColor="#ffffff" />}
|
|
281
|
+
{loading ? 'Submitting...' : 'Submit'}
|
|
282
|
+
</Horizontal>
|
|
283
|
+
</Button>
|
|
500
284
|
);
|
|
501
285
|
};
|
|
502
286
|
```
|
|
503
287
|
|
|
504
|
-
### **
|
|
288
|
+
### **Different Types Showcase**
|
|
289
|
+
Showcasing all loader types with customization.
|
|
505
290
|
|
|
506
|
-
**Progress Loader:**
|
|
507
291
|
```tsx
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
292
|
+
import React from 'react';
|
|
293
|
+
import { Loader } from '@app-studio/web';
|
|
294
|
+
import { Vertical, Horizontal, Text } from 'app-studio';
|
|
295
|
+
|
|
296
|
+
export const LoaderShowcase = () => (
|
|
297
|
+
<Vertical gap={30}>
|
|
298
|
+
<Vertical gap={15}>
|
|
299
|
+
<Text fontWeight="bold">Spinner Variants</Text>
|
|
300
|
+
<Horizontal gap={20}>
|
|
301
|
+
<Loader type="spinner" size="sm" loaderColor="#3b82f6" />
|
|
302
|
+
<Loader type="spinner" size="md" loaderColor="#10b981" />
|
|
303
|
+
<Loader type="spinner" size="lg" loaderColor="#ef4444" />
|
|
304
|
+
</Horizontal>
|
|
305
|
+
</Vertical>
|
|
306
|
+
|
|
307
|
+
<Vertical gap={15}>
|
|
308
|
+
<Text fontWeight="bold">Dotted Variants</Text>
|
|
309
|
+
<Horizontal gap={20}>
|
|
310
|
+
<Loader type="dotted" size="sm" loaderColor="#3b82f6" />
|
|
311
|
+
<Loader type="dotted" size="md" loaderColor="#10b981" />
|
|
312
|
+
<Loader type="dotted" size="lg" loaderColor="#ef4444" />
|
|
313
|
+
</Horizontal>
|
|
314
|
+
</Vertical>
|
|
315
|
+
|
|
316
|
+
<Vertical gap={15}>
|
|
317
|
+
<Text fontWeight="bold">With Text</Text>
|
|
318
|
+
<Horizontal gap={30}>
|
|
319
|
+
<Loader type="spinner" loaderColor="#3b82f6" textColor="#3b82f6">
|
|
320
|
+
Loading...
|
|
321
|
+
</Loader>
|
|
322
|
+
<Loader
|
|
323
|
+
type="dotted"
|
|
324
|
+
loaderColor="#10b981"
|
|
325
|
+
textColor="#10b981"
|
|
326
|
+
textPosition="right"
|
|
327
|
+
>
|
|
328
|
+
Processing
|
|
329
|
+
</Loader>
|
|
330
|
+
</Horizontal>
|
|
331
|
+
</Vertical>
|
|
332
|
+
|
|
333
|
+
<Vertical gap={15}>
|
|
334
|
+
<Text fontWeight="bold">Different Speeds</Text>
|
|
335
|
+
<Horizontal gap={30}>
|
|
336
|
+
<Loader speed="slow">Slow</Loader>
|
|
337
|
+
<Loader speed="normal">Normal</Loader>
|
|
338
|
+
<Loader speed="fast">Fast</Loader>
|
|
339
|
+
</Horizontal>
|
|
340
|
+
</Vertical>
|
|
514
341
|
</Vertical>
|
|
515
342
|
);
|
|
516
343
|
```
|
|
517
344
|
|
|
518
|
-
**Conditional Loader:**
|
|
519
|
-
```tsx
|
|
520
|
-
const ConditionalLoader = ({ condition, children }) => (
|
|
521
|
-
condition ? (
|
|
522
|
-
<Loader>Loading...</Loader>
|
|
523
|
-
) : (
|
|
524
|
-
children
|
|
525
|
-
)
|
|
526
|
-
);
|
|
527
|
-
```
|