@app-studio/web 0.9.39 → 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 +18 -69
- package/docs/components/AspectRatio.mdx +11 -9
- package/docs/components/AudioInput.mdx +43 -0
- package/docs/components/Avatar.mdx +17 -42
- package/docs/components/Background.mdx +99 -491
- package/docs/components/Badge.mdx +37 -122
- package/docs/components/Button.mdx +71 -123
- package/docs/components/Calendar.mdx +7 -7
- package/docs/components/Card.mdx +238 -281
- package/docs/components/Carousel.mdx +88 -315
- package/docs/components/Center.mdx +22 -22
- 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 +10 -10
- package/docs/components/ColorPicker.mdx +452 -0
- package/docs/components/ComboBox.mdx +14 -14
- 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 +10 -10
- package/docs/components/DatePicker.mdx +4 -4
- package/docs/components/DragAndDrop.mdx +279 -463
- package/docs/components/Drawer.mdx +401 -100
- package/docs/components/DropdownMenu.mdx +37 -155
- package/docs/components/EmojiPicker.mdx +84 -0
- package/docs/components/File.mdx +130 -4
- package/docs/components/Flow.mdx +3 -3
- package/docs/components/Form.mdx +4 -4
- package/docs/components/Formik.mdx +41 -41
- package/docs/components/Gradient.mdx +355 -178
- package/docs/components/Horizontal.mdx +1 -2
- package/docs/components/HoverCard.mdx +57 -125
- package/docs/components/Icon.mdx +10 -10
- package/docs/components/KanbanBoard.mdx +12 -12
- package/docs/components/Label.mdx +8 -8
- package/docs/components/Link.mdx +19 -27
- package/docs/components/Loader.mdx +224 -407
- package/docs/components/Menubar.mdx +71 -67
- package/docs/components/Message.mdx +211 -526
- 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 +32 -32
- package/docs/components/Text.mdx +3 -3
- package/docs/components/TextArea.mdx +9 -9
- package/docs/components/TextField.mdx +17 -17
- package/docs/components/Title.mdx +267 -525
- package/docs/components/Toast.mdx +65 -142
- package/docs/components/Toggle.mdx +34 -46
- package/docs/components/ToggleGroup.mdx +29 -50
- package/docs/components/Tooltip.mdx +500 -137
- package/docs/components/Tree.mdx +4 -4
- package/docs/components/Uploader.mdx +205 -351
- package/docs/components/Vertical.mdx +22 -22
- 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,6 +1,6 @@
|
|
|
1
1
|
# Drawer
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A slide-out panel component that appears from the edge of the screen, with support for different placements, sizes, and content sections.
|
|
4
4
|
|
|
5
5
|
### **Import**
|
|
6
6
|
```tsx
|
|
@@ -10,155 +10,456 @@ import { Drawer } from '@app-studio/web';
|
|
|
10
10
|
### **Default**
|
|
11
11
|
```tsx
|
|
12
12
|
import React, { useState } from 'react';
|
|
13
|
-
import { Drawer } from '
|
|
14
|
-
import { Button } from '
|
|
15
|
-
import { Vertical } from 'app-studio';
|
|
13
|
+
import { Drawer } from '@app-studio/web';
|
|
14
|
+
import { Button, Text } from 'app-studio';
|
|
16
15
|
|
|
17
16
|
export const DefaultDrawer = () => {
|
|
18
17
|
const [isOpen, setIsOpen] = useState(false);
|
|
19
|
-
|
|
18
|
+
|
|
20
19
|
return (
|
|
21
20
|
<>
|
|
22
21
|
<Button onClick={() => setIsOpen(true)}>Open Drawer</Button>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<Drawer.
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
|
|
23
|
+
<Drawer>
|
|
24
|
+
<Drawer.Overlay isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
25
|
+
<Drawer.Container>
|
|
26
|
+
<Drawer.Header onClose={() => setIsOpen(false)}>
|
|
27
|
+
<Text>Drawer Title</Text>
|
|
28
|
+
</Drawer.Header>
|
|
29
|
+
<Drawer.Body>
|
|
30
|
+
<Text>Drawer content goes here</Text>
|
|
31
|
+
</Drawer.Body>
|
|
32
|
+
<Drawer.Footer>
|
|
33
|
+
<Button onClick={() => setIsOpen(false)}>Close</Button>
|
|
34
|
+
</Drawer.Footer>
|
|
35
|
+
</Drawer.Container>
|
|
36
|
+
</Drawer.Overlay>
|
|
31
37
|
</Drawer>
|
|
32
38
|
</>
|
|
33
39
|
);
|
|
34
40
|
};
|
|
35
41
|
```
|
|
36
42
|
|
|
37
|
-
### **
|
|
38
|
-
|
|
43
|
+
### **isOpen**
|
|
44
|
+
Controls the visibility of the drawer.
|
|
45
|
+
|
|
46
|
+
- **Type:** `boolean`
|
|
47
|
+
- **Required:** `true`
|
|
39
48
|
|
|
40
49
|
```tsx
|
|
41
50
|
import React, { useState } from 'react';
|
|
42
|
-
import { Drawer } from '
|
|
43
|
-
import { Button } from '
|
|
44
|
-
import { Horizontal } from 'app-studio';
|
|
51
|
+
import { Drawer } from '@app-studio/web';
|
|
52
|
+
import { Button, Text } from 'app-studio';
|
|
45
53
|
|
|
46
|
-
export const
|
|
47
|
-
const [placement, setPlacement] = useState('right');
|
|
54
|
+
export const ControlledDrawer = () => {
|
|
48
55
|
const [isOpen, setIsOpen] = useState(false);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<>
|
|
59
|
+
<Button onClick={() => setIsOpen(true)}>Open</Button>
|
|
60
|
+
<Drawer>
|
|
61
|
+
<Drawer.Overlay isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
62
|
+
<Drawer.Container>
|
|
63
|
+
<Drawer.Body>
|
|
64
|
+
<Text>Controlled Drawer</Text>
|
|
65
|
+
</Drawer.Body>
|
|
66
|
+
</Drawer.Container>
|
|
67
|
+
</Drawer.Overlay>
|
|
68
|
+
</Drawer>
|
|
69
|
+
</>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
```
|
|
49
73
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
74
|
+
### **onClose**
|
|
75
|
+
Callback function executed when the drawer closes.
|
|
76
|
+
|
|
77
|
+
- **Type:** `() => void`
|
|
78
|
+
- **Required:** `true`
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import React, { useState } from 'react';
|
|
82
|
+
import { Drawer } from '@app-studio/web';
|
|
83
|
+
import { Button, Text } from 'app-studio';
|
|
54
84
|
|
|
85
|
+
export const CloseCallbackDrawer = () => {
|
|
86
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
87
|
+
|
|
55
88
|
return (
|
|
56
|
-
|
|
57
|
-
<Button onClick={() =>
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
89
|
+
<>
|
|
90
|
+
<Button onClick={() => setIsOpen(true)}>Open</Button>
|
|
91
|
+
<Drawer>
|
|
92
|
+
<Drawer.Overlay
|
|
93
|
+
isOpen={isOpen}
|
|
94
|
+
onClose={() => {
|
|
95
|
+
console.log('Drawer closing');
|
|
96
|
+
setIsOpen(false);
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
<Drawer.Container>
|
|
100
|
+
<Drawer.Body>
|
|
101
|
+
<Text>Click outside to close</Text>
|
|
102
|
+
</Drawer.Body>
|
|
103
|
+
</Drawer.Container>
|
|
104
|
+
</Drawer.Overlay>
|
|
66
105
|
</Drawer>
|
|
67
|
-
|
|
106
|
+
</>
|
|
68
107
|
);
|
|
69
108
|
};
|
|
70
109
|
```
|
|
71
110
|
|
|
72
|
-
### **
|
|
73
|
-
The
|
|
111
|
+
### **placement**
|
|
112
|
+
The placement of the drawer.
|
|
113
|
+
|
|
114
|
+
- **Type:** `Placement`
|
|
115
|
+
- **Default:** `'right'`
|
|
116
|
+
- **Possible Values:** `'left' | 'right' | 'top' | 'bottom'`
|
|
74
117
|
|
|
75
118
|
```tsx
|
|
76
119
|
import React, { useState } from 'react';
|
|
77
|
-
import { Drawer } from '
|
|
78
|
-
import { Button } from '
|
|
79
|
-
import { Horizontal } from 'app-studio';
|
|
120
|
+
import { Drawer } from '@app-studio/web';
|
|
121
|
+
import { Button, Text, Horizontal } from 'app-studio';
|
|
80
122
|
|
|
81
|
-
export const
|
|
82
|
-
const [
|
|
83
|
-
|
|
123
|
+
export const PlacementDrawers = () => {
|
|
124
|
+
const [placement, setPlacement] = useState<string | null>(null);
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
<Horizontal gap={10}>
|
|
129
|
+
{['left', 'right', 'top', 'bottom'].map((pos) => (
|
|
130
|
+
<Button key={pos} onClick={() => setPlacement(pos)}>
|
|
131
|
+
{pos}
|
|
132
|
+
</Button>
|
|
133
|
+
))}
|
|
134
|
+
</Horizontal>
|
|
135
|
+
|
|
136
|
+
<Drawer>
|
|
137
|
+
<Drawer.Overlay
|
|
138
|
+
isOpen={!!placement}
|
|
139
|
+
onClose={() => setPlacement(null)}
|
|
140
|
+
>
|
|
141
|
+
<Drawer.Container placement={placement as any}>
|
|
142
|
+
<Drawer.Header onClose={() => setPlacement(null)}>
|
|
143
|
+
<Text>Drawer from {placement}</Text>
|
|
144
|
+
</Drawer.Header>
|
|
145
|
+
<Drawer.Body>
|
|
146
|
+
<Text>Content</Text>
|
|
147
|
+
</Drawer.Body>
|
|
148
|
+
</Drawer.Container>
|
|
149
|
+
</Drawer.Overlay>
|
|
150
|
+
</Drawer>
|
|
151
|
+
</>
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### **size**
|
|
157
|
+
The size of the drawer.
|
|
84
158
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
159
|
+
- **Type:** `Size`
|
|
160
|
+
- **Default:** `'md'`
|
|
161
|
+
- **Possible Values:** `'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full'`
|
|
89
162
|
|
|
163
|
+
```tsx
|
|
164
|
+
import React, { useState } from 'react';
|
|
165
|
+
import { Drawer } from '@app-studio/web';
|
|
166
|
+
import { Button, Text, Horizontal } from 'app-studio';
|
|
167
|
+
|
|
168
|
+
export const SizedDrawers = () => {
|
|
169
|
+
const [size, setSize] = useState<string | null>(null);
|
|
170
|
+
|
|
90
171
|
return (
|
|
91
|
-
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
172
|
+
<>
|
|
173
|
+
<Horizontal gap={10}>
|
|
174
|
+
{['sm', 'md', 'lg', 'xl', 'full'].map((s) => (
|
|
175
|
+
<Button key={s} onClick={() => setSize(s)}>
|
|
176
|
+
{s}
|
|
177
|
+
</Button>
|
|
178
|
+
))}
|
|
179
|
+
</Horizontal>
|
|
180
|
+
|
|
181
|
+
<Drawer>
|
|
182
|
+
<Drawer.Overlay isOpen={!!size} onClose={() => setSize(null)}>
|
|
183
|
+
<Drawer.Container size={size as any}>
|
|
184
|
+
<Drawer.Header onClose={() => setSize(null)}>
|
|
185
|
+
<Text>Size: {size}</Text>
|
|
186
|
+
</Drawer.Header>
|
|
187
|
+
<Drawer.Body>
|
|
188
|
+
<Text>Drawer content</Text>
|
|
189
|
+
</Drawer.Body>
|
|
190
|
+
</Drawer.Container>
|
|
191
|
+
</Drawer.Overlay>
|
|
102
192
|
</Drawer>
|
|
103
|
-
|
|
193
|
+
</>
|
|
104
194
|
);
|
|
105
195
|
};
|
|
106
196
|
```
|
|
107
197
|
|
|
108
|
-
### **
|
|
109
|
-
|
|
198
|
+
### **isClosePrevented**
|
|
199
|
+
Prevents the drawer from closing when clicking the overlay.
|
|
200
|
+
|
|
201
|
+
- **Type:** `boolean`
|
|
202
|
+
- **Default:** `false`
|
|
110
203
|
|
|
111
204
|
```tsx
|
|
112
205
|
import React, { useState } from 'react';
|
|
113
|
-
import { Drawer } from '
|
|
114
|
-
import { Button } from '
|
|
206
|
+
import { Drawer } from '@app-studio/web';
|
|
207
|
+
import { Button, Text } from 'app-studio';
|
|
115
208
|
|
|
116
209
|
export const PreventCloseDrawer = () => {
|
|
117
210
|
const [isOpen, setIsOpen] = useState(false);
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<>
|
|
214
|
+
<Button onClick={() => setIsOpen(true)}>Open</Button>
|
|
215
|
+
<Drawer>
|
|
216
|
+
<Drawer.Overlay
|
|
217
|
+
isOpen={isOpen}
|
|
218
|
+
onClose={() => setIsOpen(false)}
|
|
219
|
+
isClosePrevented
|
|
220
|
+
>
|
|
221
|
+
<Drawer.Container>
|
|
222
|
+
<Drawer.Header onClose={() => setIsOpen(false)}>
|
|
223
|
+
<Text>Must use close button</Text>
|
|
224
|
+
</Drawer.Header>
|
|
225
|
+
<Drawer.Body>
|
|
226
|
+
<Text>Click outside won't close this drawer</Text>
|
|
227
|
+
</Drawer.Body>
|
|
228
|
+
</Drawer.Container>
|
|
229
|
+
</Drawer.Overlay>
|
|
230
|
+
</Drawer>
|
|
231
|
+
</>
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### **blur**
|
|
237
|
+
The degree of blurriness applied to the overlay.
|
|
118
238
|
|
|
239
|
+
- **Type:** `number`
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
import React, { useState } from 'react';
|
|
243
|
+
import { Drawer } from '@app-studio/web';
|
|
244
|
+
import { Button, Text } from 'app-studio';
|
|
245
|
+
|
|
246
|
+
export const BlurredDrawer = () => {
|
|
247
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
248
|
+
|
|
119
249
|
return (
|
|
120
250
|
<>
|
|
121
|
-
<Button onClick={() => setIsOpen(true)}>Open Drawer</Button>
|
|
122
|
-
<Drawer
|
|
123
|
-
<Drawer.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<
|
|
129
|
-
|
|
251
|
+
<Button onClick={() => setIsOpen(true)}>Open Blurred Drawer</Button>
|
|
252
|
+
<Drawer>
|
|
253
|
+
<Drawer.Overlay
|
|
254
|
+
isOpen={isOpen}
|
|
255
|
+
onClose={() => setIsOpen(false)}
|
|
256
|
+
blur={10}
|
|
257
|
+
>
|
|
258
|
+
<Drawer.Container>
|
|
259
|
+
<Drawer.Body>
|
|
260
|
+
<Text>Background is blurred</Text>
|
|
261
|
+
</Drawer.Body>
|
|
262
|
+
</Drawer.Container>
|
|
263
|
+
</Drawer.Overlay>
|
|
130
264
|
</Drawer>
|
|
131
265
|
</>
|
|
132
266
|
);
|
|
133
267
|
};
|
|
134
268
|
```
|
|
135
269
|
|
|
136
|
-
### **
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
270
|
+
### **buttonPosition**
|
|
271
|
+
Position of the close button in the header.
|
|
272
|
+
|
|
273
|
+
- **Type:** `CloseButtonPosition`
|
|
274
|
+
- **Possible Values:** `'left' | 'right' | 'none'`
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
import React, { useState } from 'react';
|
|
278
|
+
import { Drawer } from '@app-studio/web';
|
|
279
|
+
import { Button, Text } from 'app-studio';
|
|
280
|
+
|
|
281
|
+
export const ButtonPositionDrawer = () => {
|
|
282
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
283
|
+
|
|
284
|
+
return (
|
|
285
|
+
<>
|
|
286
|
+
<Button onClick={() => setIsOpen(true)}>Open</Button>
|
|
287
|
+
<Drawer>
|
|
288
|
+
<Drawer.Overlay isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
289
|
+
<Drawer.Container>
|
|
290
|
+
<Drawer.Header
|
|
291
|
+
onClose={() => setIsOpen(false)}
|
|
292
|
+
buttonPosition="left"
|
|
293
|
+
>
|
|
294
|
+
<Text>Close button on left</Text>
|
|
295
|
+
</Drawer.Header>
|
|
296
|
+
<Drawer.Body>
|
|
297
|
+
<Text>Drawer content</Text>
|
|
298
|
+
</Drawer.Body>
|
|
299
|
+
</Drawer.Container>
|
|
300
|
+
</Drawer.Overlay>
|
|
301
|
+
</Drawer>
|
|
302
|
+
</>
|
|
303
|
+
);
|
|
304
|
+
};
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### **Navigation Drawer**
|
|
308
|
+
A common use case for navigation menus.
|
|
309
|
+
|
|
310
|
+
```tsx
|
|
311
|
+
import React, { useState } from 'react';
|
|
312
|
+
import { Drawer } from '@app-studio/web';
|
|
313
|
+
import { Button, Text, Vertical } from 'app-studio';
|
|
314
|
+
|
|
315
|
+
export const NavigationDrawer = () => {
|
|
316
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
317
|
+
|
|
318
|
+
const menuItems = [
|
|
319
|
+
'Dashboard',
|
|
320
|
+
'Profile',
|
|
321
|
+
'Settings',
|
|
322
|
+
'Analytics',
|
|
323
|
+
'Help',
|
|
324
|
+
];
|
|
325
|
+
|
|
326
|
+
return (
|
|
327
|
+
<>
|
|
328
|
+
<Button onClick={() => setIsOpen(true)}>☰ Menu</Button>
|
|
329
|
+
<Drawer>
|
|
330
|
+
<Drawer.Overlay isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
331
|
+
<Drawer.Container placement="left" size="sm">
|
|
332
|
+
<Drawer.Header onClose={() => setIsOpen(false)}>
|
|
333
|
+
<Text fontSize={20} fontWeight="bold">Menu</Text>
|
|
334
|
+
</Drawer.Header>
|
|
335
|
+
<Drawer.Body>
|
|
336
|
+
<Vertical gap={0}>
|
|
337
|
+
{menuItems.map((item) => (
|
|
338
|
+
<Button
|
|
339
|
+
key={item}
|
|
340
|
+
variant="ghost"
|
|
341
|
+
onClick={() => {
|
|
342
|
+
console.log('Navigate to:', item);
|
|
343
|
+
setIsOpen(false);
|
|
344
|
+
}}
|
|
345
|
+
>
|
|
346
|
+
{item}
|
|
347
|
+
</Button>
|
|
348
|
+
))}
|
|
349
|
+
</Vertical>
|
|
350
|
+
</Drawer.Body>
|
|
351
|
+
</Drawer.Container>
|
|
352
|
+
</Drawer.Overlay>
|
|
353
|
+
</Drawer>
|
|
354
|
+
</>
|
|
355
|
+
);
|
|
356
|
+
};
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### **Form Drawer**
|
|
360
|
+
Using drawer for forms and data entry.
|
|
361
|
+
|
|
362
|
+
```tsx
|
|
363
|
+
import React, { useState } from 'react';
|
|
364
|
+
import { Drawer } from '@app-studio/web';
|
|
365
|
+
import { Button, Text, Vertical } from 'app-studio';
|
|
366
|
+
import { TextField } from '@app-studio/web';
|
|
367
|
+
|
|
368
|
+
export const FormDrawer = () => {
|
|
369
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
370
|
+
|
|
371
|
+
return (
|
|
372
|
+
<>
|
|
373
|
+
<Button onClick={() => setIsOpen(true)}>Add User</Button>
|
|
374
|
+
<Drawer>
|
|
375
|
+
<Drawer.Overlay isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
376
|
+
<Drawer.Container placement="right" size="md">
|
|
377
|
+
<Drawer.Header onClose={() => setIsOpen(false)}>
|
|
378
|
+
<Text fontSize={18} fontWeight="bold">Add New User</Text>
|
|
379
|
+
</Drawer.Header>
|
|
380
|
+
<Drawer.Body>
|
|
381
|
+
<Vertical gap={15}>
|
|
382
|
+
<TextField label="Name" placeholder="Enter name" />
|
|
383
|
+
<TextField label="Email" placeholder="Enter email" />
|
|
384
|
+
<TextField label="Role" placeholder="Enter role" />
|
|
385
|
+
</Vertical>
|
|
386
|
+
</Drawer.Body>
|
|
387
|
+
<Drawer.Footer>
|
|
388
|
+
<Horizontal gap={10} justifyContent="flex-end">
|
|
389
|
+
<Button
|
|
390
|
+
variant="outline"
|
|
391
|
+
onClick={() => setIsOpen(false)}
|
|
392
|
+
>
|
|
393
|
+
Cancel
|
|
394
|
+
</Button>
|
|
395
|
+
<Button
|
|
396
|
+
variant="filled"
|
|
397
|
+
onClick={() => {
|
|
398
|
+
console.log('Save user');
|
|
399
|
+
setIsOpen(false);
|
|
400
|
+
}}
|
|
401
|
+
>
|
|
402
|
+
Save
|
|
403
|
+
</Button>
|
|
404
|
+
</Horizontal>
|
|
405
|
+
</Drawer.Footer>
|
|
406
|
+
</Drawer.Container>
|
|
407
|
+
</Drawer.Overlay>
|
|
408
|
+
</Drawer>
|
|
409
|
+
</>
|
|
410
|
+
);
|
|
411
|
+
};
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### **Details Drawer**
|
|
415
|
+
Showing detailed information in a drawer.
|
|
416
|
+
|
|
417
|
+
```tsx
|
|
418
|
+
import React, { useState } from 'react';
|
|
419
|
+
import { Drawer } from '@app-studio/web';
|
|
420
|
+
import { Button, Text, Vertical, Horizontal } from 'app-studio';
|
|
421
|
+
|
|
422
|
+
export const DetailsDrawer = () => {
|
|
423
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
424
|
+
|
|
425
|
+
return (
|
|
426
|
+
<>
|
|
427
|
+
<Button onClick={() => setIsOpen(true)}>View Details</Button>
|
|
428
|
+
<Drawer>
|
|
429
|
+
<Drawer.Overlay isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
430
|
+
<Drawer.Container placement="right" size="lg">
|
|
431
|
+
<Drawer.Header onClose={() => setIsOpen(false)}>
|
|
432
|
+
<Text fontSize={20} fontWeight="bold">Product Details</Text>
|
|
433
|
+
</Drawer.Header>
|
|
434
|
+
<Drawer.Body>
|
|
435
|
+
<Vertical gap={20}>
|
|
436
|
+
<div>
|
|
437
|
+
<Text fontSize={14} color="#6b7280">Name</Text>
|
|
438
|
+
<Text fontSize={16}>Premium Widget</Text>
|
|
439
|
+
</div>
|
|
440
|
+
<div>
|
|
441
|
+
<Text fontSize={14} color="#6b7280">Price</Text>
|
|
442
|
+
<Text fontSize={16}>$99.99</Text>
|
|
443
|
+
</div>
|
|
444
|
+
<div>
|
|
445
|
+
<Text fontSize={14} color="#6b7280">Description</Text>
|
|
446
|
+
<Text fontSize={16}>
|
|
447
|
+
A high-quality widget with advanced features
|
|
448
|
+
and premium materials.
|
|
449
|
+
</Text>
|
|
450
|
+
</div>
|
|
451
|
+
</Vertical>
|
|
452
|
+
</Drawer.Body>
|
|
453
|
+
<Drawer.Footer>
|
|
454
|
+
<Button onClick={() => setIsOpen(false)}>
|
|
455
|
+
Add to Cart
|
|
456
|
+
</Button>
|
|
457
|
+
</Drawer.Footer>
|
|
458
|
+
</Drawer.Container>
|
|
459
|
+
</Drawer.Overlay>
|
|
460
|
+
</Drawer>
|
|
461
|
+
</>
|
|
462
|
+
);
|
|
463
|
+
};
|
|
464
|
+
```
|
|
164
465
|
|