@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,533 +1,409 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
```tsx
|
|
4
|
-
import { Modal } from '@app-studio/web';
|
|
5
|
-
```
|
|
6
|
-
|
|
7
|
-
### **Default**
|
|
8
|
-
|
|
9
|
-
It uses the isOpen and onClose properties to display the modal.
|
|
10
|
-
|
|
11
|
-
```tsx
|
|
12
|
-
import { Button } from '../Button/Button';
|
|
13
|
-
import { useState } from 'react';
|
|
14
|
-
|
|
15
|
-
const [show, setShow] = useState(false);
|
|
16
|
-
|
|
17
|
-
<>
|
|
18
|
-
<Button onClick={() => setShow(true)} isAuto>
|
|
19
|
-
Open Modal
|
|
20
|
-
</Button>
|
|
21
|
-
<Modal.Overlay isOpen={show} onClose={() => setShow(false)}>
|
|
22
|
-
<Modal.Container>
|
|
23
|
-
<Modal.Header>Title</Modal.Header>
|
|
24
|
-
<Modal.Body>
|
|
25
|
-
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam.
|
|
26
|
-
Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque
|
|
27
|
-
nisl consectetur et.
|
|
28
|
-
</Modal.Body>
|
|
29
|
-
<Modal.Footer>
|
|
30
|
-
<Button onClick={() => setShow(false)}>Cancel</Button>
|
|
31
|
-
</Modal.Footer>
|
|
32
|
-
</Modal.Container>
|
|
33
|
-
</Modal.Overlay>
|
|
34
|
-
</>;
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## **Modal Overlay**
|
|
38
|
-
|
|
39
|
-
It represents the overlay or backdrop that appears behind the modal content when the modal is displayed.
|
|
40
|
-
|
|
41
|
-
### **Props**
|
|
42
|
-
|
|
43
|
-
| Prop | Type | Description | Default |
|
|
44
|
-
| ---------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------- |
|
|
45
|
-
| isOpen | boolean | Whether the modal overlay is open. | false |
|
|
46
|
-
| onClose | function | Callback function to close the modal. | |
|
|
47
|
-
| position | Position | Positions the modal overlay ('top', 'left', 'right', 'bottom', 'center'). | 'center' |
|
|
48
|
-
| blur | number | Adds a blur effect on the modal overlay. | |
|
|
49
|
-
| isClosePrevented | boolean | Prevents the user from closing the modal when clicking outside of it. | false |
|
|
50
|
-
| styles | CSSProperties | Optional custom styles for the ModalOverlay. | |
|
|
51
|
-
| className | string | Optional className for the ModalOverlay container. | |
|
|
52
|
-
|
|
53
|
-
### **Props**
|
|
1
|
+
# Modal
|
|
54
2
|
|
|
55
|
-
|
|
56
|
-
| ---------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------- |
|
|
57
|
-
| isOpen | boolean | Whether the modal overlay is open. | false |
|
|
58
|
-
| onClose | function | Callback function to close the modal. | |
|
|
59
|
-
| position | Position | Positions the modal overlay ('top', 'left', 'right', 'bottom', 'center'). | 'center' |
|
|
60
|
-
| blur | number | Adds a blur effect on the modal overlay. | |
|
|
61
|
-
| isClosePrevented | boolean | Prevents the user from closing the modal when clicking outside of it. | false |
|
|
62
|
-
| styles | CSSProperties | Optional custom styles for the ModalOverlay. | |
|
|
63
|
-
| className | string | Optional className for the ModalOverlay container. | |
|
|
64
|
-
|
|
65
|
-
### **FullScreen**
|
|
66
|
-
|
|
67
|
-
“**is*fullScreen***” property changes the width and height of the modal so that it fits the entire screen.
|
|
3
|
+
A custom content overlay that appears on top of the main screen, with support for headers, bodies, footers, and flexible positioning.
|
|
68
4
|
|
|
5
|
+
### **Import**
|
|
69
6
|
```tsx
|
|
70
|
-
import {
|
|
71
|
-
import { useState } from 'react';
|
|
72
|
-
|
|
73
|
-
const [show, setShow] = useState(false);
|
|
74
|
-
|
|
75
|
-
<>
|
|
76
|
-
<Button onClick={() => setShow(true)} isAuto>
|
|
77
|
-
Full Screen
|
|
78
|
-
</Button>
|
|
79
|
-
<Modal.Overlay isOpen={show} onClose={() => setShow(false)}>
|
|
80
|
-
<Modal.Container isFullScreen>
|
|
81
|
-
<Modal.Header>Title</Modal.Header>
|
|
82
|
-
<Modal.Body>
|
|
83
|
-
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam.
|
|
84
|
-
Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque
|
|
85
|
-
nisl consectetur et.
|
|
86
|
-
</Modal.Body>
|
|
87
|
-
<Modal.Footer>
|
|
88
|
-
<Button onClick={() => setShow(false)}>Cancel</Button>
|
|
89
|
-
</Modal.Footer>
|
|
90
|
-
</Modal.Container>
|
|
91
|
-
</Modal.Overlay>
|
|
92
|
-
</>;
|
|
7
|
+
import { Modal, useModalStore } from '@app-studio/web';
|
|
93
8
|
```
|
|
94
9
|
|
|
95
|
-
### **
|
|
96
|
-
|
|
97
|
-
“**_position_**” places the modal in the specified direction. It has a default positioning of “center”.
|
|
98
|
-
|
|
10
|
+
### **Default**
|
|
99
11
|
```tsx
|
|
100
|
-
import { useState } from 'react';
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
const [
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<Button onClick={() => setShowBottom(false)}>Cancel</Button>
|
|
130
|
-
</Modal.Footer>
|
|
131
|
-
</Modal.Container>
|
|
132
|
-
</Modal.Overlay>
|
|
133
|
-
)}
|
|
134
|
-
{showTop && (
|
|
135
|
-
<Modal.Overlay isOpen={showTop} onClose={() => setShowTop(false)} position="top">
|
|
136
|
-
<Modal.Container>
|
|
137
|
-
<Modal.Header>Title</Modal.Header>
|
|
138
|
-
<Modal.Body>
|
|
139
|
-
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam.
|
|
140
|
-
Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque
|
|
141
|
-
nisl consectetur et.
|
|
142
|
-
</Modal.Body>
|
|
143
|
-
<Modal.Footer>
|
|
144
|
-
<Button onClick={() => setShowTop(false)}>Cancel</Button>
|
|
145
|
-
</Modal.Footer>
|
|
146
|
-
</Modal.Container>
|
|
147
|
-
</Modal.Overlay>
|
|
148
|
-
)}
|
|
149
|
-
{showLeft && (
|
|
150
|
-
<Modal.Overlay isOpen={showLeft} onClose={() => setShowLeft(false)} position="left">
|
|
151
|
-
<Modal.Container>
|
|
152
|
-
<Modal.Header>Title</Modal.Header>
|
|
153
|
-
<Modal.Body>
|
|
154
|
-
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam.
|
|
155
|
-
Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque
|
|
156
|
-
nisl consectetur et.
|
|
157
|
-
</Modal.Body>
|
|
158
|
-
<Modal.Footer>
|
|
159
|
-
<Button onClick={() => setShowLeft(false)}>Cancel</Button>
|
|
160
|
-
</Modal.Footer>
|
|
161
|
-
</Modal.Container>
|
|
162
|
-
</Modal.Overlay>
|
|
163
|
-
)}
|
|
164
|
-
{showRight && (
|
|
165
|
-
<Modal.Overlay isOpen={showRight} onClose={() => setShowRight(false)} position="right">
|
|
166
|
-
<Modal.Container>
|
|
167
|
-
<Modal.Header>Title</Modal.Header>
|
|
168
|
-
<Modal.Body>
|
|
169
|
-
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam.
|
|
170
|
-
Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque
|
|
171
|
-
nisl consectetur et.
|
|
172
|
-
</Modal.Body>
|
|
173
|
-
<Modal.Footer>
|
|
174
|
-
<Button onClick={() => setShowRight(false)}>Cancel</Button>
|
|
175
|
-
</Modal.Footer>
|
|
176
|
-
</Modal.Container>
|
|
177
|
-
</Modal.Overlay>
|
|
178
|
-
)}
|
|
179
|
-
{showCenter && (
|
|
180
|
-
<Modal.Overlay isOpen={showCenter} onClose={() => setShowCenter(false)} position="center">
|
|
181
|
-
<Modal.Container>
|
|
182
|
-
<Modal.Header>Title</Modal.Header>
|
|
183
|
-
<Modal.Body>
|
|
184
|
-
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam.
|
|
185
|
-
Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque
|
|
186
|
-
nisl consectetur et.
|
|
187
|
-
</Modal.Body>
|
|
188
|
-
<Modal.Footer>
|
|
189
|
-
<Button onClick={() => setShowCenter(false)}>Cancel</Button>
|
|
190
|
-
</Modal.Footer>
|
|
191
|
-
</Modal.Container>
|
|
192
|
-
</Modal.Overlay>
|
|
193
|
-
)}
|
|
194
|
-
</>;
|
|
12
|
+
import React, { useState } from 'react';
|
|
13
|
+
import { Modal } from '@app-studio/web';
|
|
14
|
+
import { Button, Text } from 'app-studio';
|
|
15
|
+
|
|
16
|
+
export const DefaultModal = () => {
|
|
17
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<Button onClick={() => setIsOpen(true)}>Open Modal</Button>
|
|
22
|
+
|
|
23
|
+
<Modal>
|
|
24
|
+
<Modal.Overlay isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
25
|
+
<Modal.Container>
|
|
26
|
+
<Modal.Header onClose={() => setIsOpen(false)}>
|
|
27
|
+
<Text>Modal Title</Text>
|
|
28
|
+
</Modal.Header>
|
|
29
|
+
<Modal.Body>
|
|
30
|
+
<Text>Modal content goes here</Text>
|
|
31
|
+
</Modal.Body>
|
|
32
|
+
<Modal.Footer>
|
|
33
|
+
<Button onClick={() => setIsOpen(false)}>Close</Button>
|
|
34
|
+
</Modal.Footer>
|
|
35
|
+
</Modal.Container>
|
|
36
|
+
</Modal.Overlay>
|
|
37
|
+
</Modal>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
195
41
|
```
|
|
196
42
|
|
|
197
|
-
### **
|
|
198
|
-
|
|
199
|
-
“**_blur_**” adds a blur effect on the modal overlay.
|
|
43
|
+
### **Modal.Layout**
|
|
44
|
+
Centralized modal management system for handling multiple modals.
|
|
200
45
|
|
|
201
46
|
```tsx
|
|
202
|
-
import
|
|
203
|
-
import {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
<
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
47
|
+
import React from 'react';
|
|
48
|
+
import { Modal } from '@app-studio/web';
|
|
49
|
+
import { Text, Button } from 'app-studio';
|
|
50
|
+
|
|
51
|
+
const WelcomeModal = ({ onClose }) => (
|
|
52
|
+
<Modal.Container>
|
|
53
|
+
<Modal.Header onClose={onClose}>
|
|
54
|
+
<Text>Welcome</Text>
|
|
55
|
+
</Modal.Header>
|
|
56
|
+
<Modal.Body>
|
|
57
|
+
<Text>Welcome to our application!</Text>
|
|
58
|
+
</Modal.Body>
|
|
59
|
+
</Modal.Container>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const ConfirmModal = ({ onClose }) => (
|
|
63
|
+
<Modal.Container>
|
|
64
|
+
<Modal.Header onClose={onClose}>
|
|
65
|
+
<Text>Confirm</Text>
|
|
66
|
+
</Modal.Header>
|
|
67
|
+
<Modal.Body>
|
|
68
|
+
<Text>Are you sure?</Text>
|
|
69
|
+
</Modal.Body>
|
|
70
|
+
<Modal.Footer>
|
|
71
|
+
<Button onClick={onClose}>Cancel</Button>
|
|
72
|
+
<Button onClick={onClose}>Confirm</Button>
|
|
73
|
+
</Modal.Footer>
|
|
74
|
+
</Modal.Container>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
export const ModalLayoutExample = () => (
|
|
78
|
+
<Modal.Layout
|
|
79
|
+
modals={{
|
|
80
|
+
welcome: WelcomeModal,
|
|
81
|
+
confirm: ConfirmModal,
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
223
85
|
```
|
|
224
86
|
|
|
225
|
-
### **
|
|
87
|
+
### **isOpen**
|
|
88
|
+
Controls the visibility of the modal.
|
|
226
89
|
|
|
227
|
-
|
|
90
|
+
- **Type:** `boolean`
|
|
91
|
+
- **Required:** `true`
|
|
228
92
|
|
|
229
93
|
```tsx
|
|
230
|
-
import { useState } from 'react';
|
|
231
|
-
import {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
</>;
|
|
94
|
+
import React, { useState } from 'react';
|
|
95
|
+
import { Modal } from '@app-studio/web';
|
|
96
|
+
import { Button, Text } from 'app-studio';
|
|
97
|
+
|
|
98
|
+
export const ControlledModal = () => {
|
|
99
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<>
|
|
103
|
+
<Button onClick={() => setIsOpen(true)}>Open</Button>
|
|
104
|
+
<Modal>
|
|
105
|
+
<Modal.Overlay isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
106
|
+
<Modal.Container>
|
|
107
|
+
<Modal.Body>
|
|
108
|
+
<Text>Controlled Modal</Text>
|
|
109
|
+
</Modal.Body>
|
|
110
|
+
</Modal.Container>
|
|
111
|
+
</Modal.Overlay>
|
|
112
|
+
</Modal>
|
|
113
|
+
</>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
253
116
|
```
|
|
254
117
|
|
|
255
|
-
|
|
118
|
+
### **onClose**
|
|
119
|
+
Callback function executed when the modal closes.
|
|
256
120
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
### **Shapes**
|
|
260
|
-
|
|
261
|
-
“**_shape_**” gives a sharp or rounded edges to the modal container.
|
|
121
|
+
- **Type:** `() => void`
|
|
122
|
+
- **Required:** `true`
|
|
262
123
|
|
|
263
124
|
```tsx
|
|
264
|
-
import { useState } from 'react';
|
|
265
|
-
import {
|
|
266
|
-
import { Text } from '
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
const [
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
<>
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
<
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
</
|
|
287
|
-
</Modal.
|
|
288
|
-
</Modal
|
|
289
|
-
|
|
290
|
-
)
|
|
291
|
-
|
|
292
|
-
<Modal.Overlay isOpen={showRounded} onClose={() => setShowRounded(false)}>
|
|
293
|
-
<Modal.Container variant="rounded">
|
|
294
|
-
<Modal.Body>
|
|
295
|
-
<Text maxLines={2}>
|
|
296
|
-
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget
|
|
297
|
-
quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel
|
|
298
|
-
scelerisque nisl consectetur et.
|
|
299
|
-
</Text>
|
|
300
|
-
</Modal.Body>
|
|
301
|
-
</Modal.Container>
|
|
302
|
-
</Modal.Overlay>
|
|
303
|
-
)}
|
|
304
|
-
</>;
|
|
125
|
+
import React, { useState } from 'react';
|
|
126
|
+
import { Modal } from '@app-studio/web';
|
|
127
|
+
import { Button, Text } from 'app-studio';
|
|
128
|
+
|
|
129
|
+
export const CloseCallbackModal = () => {
|
|
130
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<>
|
|
134
|
+
<Button onClick={() => setIsOpen(true)}>Open</Button>
|
|
135
|
+
<Modal>
|
|
136
|
+
<Modal.Overlay
|
|
137
|
+
isOpen={isOpen}
|
|
138
|
+
onClose={() => {
|
|
139
|
+
console.log('Modal closing');
|
|
140
|
+
setIsOpen(false);
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
<Modal.Container>
|
|
144
|
+
<Modal.Body>
|
|
145
|
+
<Text>Click outside to close</Text>
|
|
146
|
+
</Modal.Body>
|
|
147
|
+
</Modal.Container>
|
|
148
|
+
</Modal.Overlay>
|
|
149
|
+
</Modal>
|
|
150
|
+
</>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
305
153
|
```
|
|
306
154
|
|
|
307
|
-
### **
|
|
155
|
+
### **isClosePrevented**
|
|
156
|
+
Prevents the modal from closing when clicking the overlay.
|
|
308
157
|
|
|
309
|
-
|
|
158
|
+
- **Type:** `boolean`
|
|
159
|
+
- **Default:** `false`
|
|
310
160
|
|
|
311
161
|
```tsx
|
|
312
|
-
import { useState } from 'react';
|
|
313
|
-
import {
|
|
314
|
-
import { Text } from '
|
|
315
|
-
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
162
|
+
import React, { useState } from 'react';
|
|
163
|
+
import { Modal } from '@app-studio/web';
|
|
164
|
+
import { Button, Text } from 'app-studio';
|
|
165
|
+
|
|
166
|
+
export const PreventCloseModal = () => {
|
|
167
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<>
|
|
171
|
+
<Button onClick={() => setIsOpen(true)}>Open</Button>
|
|
172
|
+
<Modal>
|
|
173
|
+
<Modal.Overlay
|
|
174
|
+
isOpen={isOpen}
|
|
175
|
+
onClose={() => setIsOpen(false)}
|
|
176
|
+
isClosePrevented
|
|
177
|
+
>
|
|
178
|
+
<Modal.Container>
|
|
179
|
+
<Modal.Header onClose={() => setIsOpen(false)}>
|
|
180
|
+
<Text>Must use close button</Text>
|
|
181
|
+
</Modal.Header>
|
|
182
|
+
<Modal.Body>
|
|
183
|
+
<Text>Click outside won't close this modal</Text>
|
|
184
|
+
</Modal.Body>
|
|
185
|
+
</Modal.Container>
|
|
186
|
+
</Modal.Overlay>
|
|
187
|
+
</Modal>
|
|
188
|
+
</>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
335
191
|
```
|
|
336
192
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
It represents the header section of a modal, which typically contains a title or heading and optionally other elements such as a close button or additional controls.
|
|
193
|
+
### **position**
|
|
194
|
+
Positioning of the modal container.
|
|
340
195
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
“**_buttonPosition_**” places the closing button found in the header modal in the specified direction. It has a default position of “**right**”.
|
|
196
|
+
- **Type:** `Position`
|
|
197
|
+
- **Possible Values:** `'center' | 'top' | 'bottom' | 'left' | 'right'`
|
|
344
198
|
|
|
345
199
|
```tsx
|
|
346
|
-
import { useState } from 'react';
|
|
347
|
-
import {
|
|
348
|
-
import { Horizontal } from '
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
const [
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
<>
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
<Modal.Container>
|
|
380
|
-
<Modal.Header buttonPosition="none"> Close Button</Modal.Header>
|
|
381
|
-
<Modal.Body>Cras mattis consectetur purus sit amet fermentum.</Modal.Body>
|
|
382
|
-
<Modal.Footer>
|
|
383
|
-
<Button onClick={() => setShowWithout(false)}>Cancel</Button>
|
|
384
|
-
</Modal.Footer>
|
|
385
|
-
</Modal.Container>
|
|
386
|
-
</Modal.Overlay>
|
|
387
|
-
)}
|
|
388
|
-
{showLeft && (
|
|
389
|
-
<Modal.Overlay isOpen={showLeft} onClose={() => setShowLeft(false)}>
|
|
390
|
-
<Modal.Container>
|
|
391
|
-
<Modal.Header buttonPosition="left">Close Button</Modal.Header>
|
|
392
|
-
<Modal.Body>Cras mattis consectetur purus sit amet fermentum.</Modal.Body>
|
|
393
|
-
<Modal.Footer>
|
|
394
|
-
<Button onClick={() => setShowLeft(false)}>Cancel</Button>
|
|
395
|
-
</Modal.Footer>
|
|
396
|
-
</Modal.Container>
|
|
397
|
-
</Modal.Overlay>
|
|
398
|
-
)}
|
|
399
|
-
</>;
|
|
200
|
+
import React, { useState } from 'react';
|
|
201
|
+
import { Modal } from '@app-studio/web';
|
|
202
|
+
import { Button, Text, Horizontal } from 'app-studio';
|
|
203
|
+
|
|
204
|
+
export const PositionedModals = () => {
|
|
205
|
+
const [position, setPosition] = useState<string | null>(null);
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<>
|
|
209
|
+
<Horizontal gap={10}>
|
|
210
|
+
{['center', 'top', 'bottom', 'left', 'right'].map((pos) => (
|
|
211
|
+
<Button key={pos} onClick={() => setPosition(pos)}>
|
|
212
|
+
{pos}
|
|
213
|
+
</Button>
|
|
214
|
+
))}
|
|
215
|
+
</Horizontal>
|
|
216
|
+
|
|
217
|
+
<Modal>
|
|
218
|
+
<Modal.Overlay
|
|
219
|
+
isOpen={!!position}
|
|
220
|
+
onClose={() => setPosition(null)}
|
|
221
|
+
position={position as any}
|
|
222
|
+
>
|
|
223
|
+
<Modal.Container>
|
|
224
|
+
<Modal.Body>
|
|
225
|
+
<Text>Positioned at {position}</Text>
|
|
226
|
+
</Modal.Body>
|
|
227
|
+
</Modal.Container>
|
|
228
|
+
</Modal.Overlay>
|
|
229
|
+
</Modal>
|
|
230
|
+
</>
|
|
231
|
+
);
|
|
232
|
+
};
|
|
400
233
|
```
|
|
401
234
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
It represents the main content area of a modal, where the primary information or user interaction elements are displayed.
|
|
235
|
+
### **blur**
|
|
236
|
+
The degree of blurriness applied to the overlay.
|
|
405
237
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
A vertical scroll is displayed, if the content height exceed the body height.
|
|
238
|
+
- **Type:** `number`
|
|
409
239
|
|
|
410
240
|
```tsx
|
|
411
|
-
import { useState } from 'react';
|
|
412
|
-
import {
|
|
413
|
-
import { Text } from '
|
|
414
|
-
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
<Modal
|
|
422
|
-
<Modal.
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
</Modal.Body>
|
|
438
|
-
<Modal.Footer>
|
|
439
|
-
<Button onClick={() => setShow(false)}>Cancel</Button>
|
|
440
|
-
</Modal.Footer>
|
|
441
|
-
</Modal.Container>
|
|
442
|
-
</Modal.Overlay>
|
|
443
|
-
)}
|
|
444
|
-
</>;
|
|
241
|
+
import React, { useState } from 'react';
|
|
242
|
+
import { Modal } from '@app-studio/web';
|
|
243
|
+
import { Button, Text } from 'app-studio';
|
|
244
|
+
|
|
245
|
+
export const BlurredModal = () => {
|
|
246
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
247
|
+
|
|
248
|
+
return (
|
|
249
|
+
<>
|
|
250
|
+
<Button onClick={() => setIsOpen(true)}>Open Blurred Modal</Button>
|
|
251
|
+
<Modal>
|
|
252
|
+
<Modal.Overlay
|
|
253
|
+
isOpen={isOpen}
|
|
254
|
+
onClose={() => setIsOpen(false)}
|
|
255
|
+
blur={10}
|
|
256
|
+
>
|
|
257
|
+
<Modal.Container>
|
|
258
|
+
<Modal.Body>
|
|
259
|
+
<Text>Background is blurred</Text>
|
|
260
|
+
</Modal.Body>
|
|
261
|
+
</Modal.Container>
|
|
262
|
+
</Modal.Overlay>
|
|
263
|
+
</Modal>
|
|
264
|
+
</>
|
|
265
|
+
);
|
|
266
|
+
};
|
|
445
267
|
```
|
|
446
268
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
It represents the footer section of a modal, which typically contains buttons or controls for actions related to the modal's content.
|
|
450
|
-
|
|
451
|
-
```tsx
|
|
452
|
-
import { useState } from 'react';
|
|
453
|
-
import { Button } from '../Button/Button';
|
|
454
|
-
import { Text } from '@app-studio/web';
|
|
455
|
-
|
|
456
|
-
const [show, setShow] = useState(false);
|
|
457
|
-
|
|
458
|
-
<>
|
|
459
|
-
<Button onClick={() => setShow(true)}>Footer</Button>
|
|
460
|
-
{show && (
|
|
461
|
-
<Modal.Overlay isOpen={show} onClose={() => setShow(false)}>
|
|
462
|
-
<Modal.Container>
|
|
463
|
-
<Modal.Header buttonPosition="none">
|
|
464
|
-
<Text size="lg" weight="semibold">
|
|
465
|
-
Title
|
|
466
|
-
</Text>
|
|
467
|
-
</Modal.Header>
|
|
468
|
-
<Modal.Body height="200px">
|
|
469
|
-
Cras mattis consectetur purus sit amet fermentum.Cras mattis consectetur purus sit amet fermentum.Cras mattis
|
|
470
|
-
consectetur purus sit amet fermentum.Cras mattis consectetur purus sit amet fermentum.Cras mattis consectetur
|
|
471
|
-
purus sit amet fermentum.
|
|
472
|
-
</Modal.Body>
|
|
473
|
-
<Modal.Footer>
|
|
474
|
-
<Button onClick={() => setShow(false)}>Cancel</Button>
|
|
475
|
-
</Modal.Footer>
|
|
476
|
-
</Modal.Container>
|
|
477
|
-
</Modal.Overlay>
|
|
478
|
-
)}
|
|
479
|
-
</>;
|
|
480
|
-
```
|
|
269
|
+
### **shape**
|
|
270
|
+
Determines whether the modal should have sharp or rounded edges.
|
|
481
271
|
|
|
482
|
-
|
|
272
|
+
- **Type:** `Shape`
|
|
273
|
+
- **Possible Values:** `'sharp' | 'rounded' | 'pillShaped'`
|
|
483
274
|
|
|
484
275
|
```tsx
|
|
485
|
-
|
|
276
|
+
import React, { useState } from 'react';
|
|
277
|
+
import { Modal } from '@app-studio/web';
|
|
278
|
+
import { Button, Text, Horizontal } from 'app-studio';
|
|
279
|
+
|
|
280
|
+
export const ShapedModals = () => {
|
|
281
|
+
const [shape, setShape] = useState<string | null>(null);
|
|
282
|
+
|
|
283
|
+
return (
|
|
284
|
+
<>
|
|
285
|
+
<Horizontal gap={10}>
|
|
286
|
+
{['sharp', 'rounded', 'pillShaped'].map((s) => (
|
|
287
|
+
<Button key={s} onClick={() => setShape(s)}>
|
|
288
|
+
{s}
|
|
289
|
+
</Button>
|
|
290
|
+
))}
|
|
291
|
+
</Horizontal>
|
|
292
|
+
|
|
293
|
+
<Modal>
|
|
294
|
+
<Modal.Overlay isOpen={!!shape} onClose={() => setShape(null)}>
|
|
295
|
+
<Modal.Container shape={shape as any}>
|
|
296
|
+
<Modal.Body>
|
|
297
|
+
<Text>Shape: {shape}</Text>
|
|
298
|
+
</Modal.Body>
|
|
299
|
+
</Modal.Container>
|
|
300
|
+
</Modal.Overlay>
|
|
301
|
+
</Modal>
|
|
302
|
+
</>
|
|
303
|
+
);
|
|
304
|
+
};
|
|
486
305
|
```
|
|
487
306
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
```
|
|
307
|
+
### **isFullScreen**
|
|
308
|
+
Makes the modal occupy the full width and height of the screen.
|
|
491
309
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
```
|
|
310
|
+
- **Type:** `boolean`
|
|
311
|
+
- **Default:** `false`
|
|
495
312
|
|
|
496
313
|
```tsx
|
|
497
|
-
|
|
314
|
+
import React, { useState } from 'react';
|
|
315
|
+
import { Modal } from '@app-studio/web';
|
|
316
|
+
import { Button, Text } from 'app-studio';
|
|
317
|
+
|
|
318
|
+
export const FullScreenModal = () => {
|
|
319
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
320
|
+
|
|
321
|
+
return (
|
|
322
|
+
<>
|
|
323
|
+
<Button onClick={() => setIsOpen(true)}>Open Fullscreen</Button>
|
|
324
|
+
<Modal>
|
|
325
|
+
<Modal.Overlay isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
326
|
+
<Modal.Container isFullScreen>
|
|
327
|
+
<Modal.Header onClose={() => setIsOpen(false)}>
|
|
328
|
+
<Text>Fullscreen Modal</Text>
|
|
329
|
+
</Modal.Header>
|
|
330
|
+
<Modal.Body>
|
|
331
|
+
<Text>This modal takes up the entire screen</Text>
|
|
332
|
+
</Modal.Body>
|
|
333
|
+
</Modal.Container>
|
|
334
|
+
</Modal.Overlay>
|
|
335
|
+
</Modal>
|
|
336
|
+
</>
|
|
337
|
+
);
|
|
338
|
+
};
|
|
498
339
|
```
|
|
499
340
|
|
|
500
|
-
|
|
341
|
+
### **buttonPosition**
|
|
342
|
+
Position of the close button in the header.
|
|
501
343
|
|
|
502
|
-
|
|
344
|
+
- **Type:** `CloseButtonPosition`
|
|
345
|
+
- **Possible Values:** `'left' | 'right' | 'none'`
|
|
503
346
|
|
|
504
347
|
```tsx
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
348
|
+
import React, { useState } from 'react';
|
|
349
|
+
import { Modal } from '@app-studio/web';
|
|
350
|
+
import { Button, Text } from 'app-studio';
|
|
351
|
+
|
|
352
|
+
export const ButtonPositionModal = () => {
|
|
353
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
354
|
+
|
|
355
|
+
return (
|
|
356
|
+
<>
|
|
357
|
+
<Button onClick={() => setIsOpen(true)}>Open</Button>
|
|
358
|
+
<Modal>
|
|
359
|
+
<Modal.Overlay isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
360
|
+
<Modal.Container>
|
|
361
|
+
<Modal.Header
|
|
362
|
+
onClose={() => setIsOpen(false)}
|
|
363
|
+
buttonPosition="left"
|
|
364
|
+
>
|
|
365
|
+
<Text>Close button on left</Text>
|
|
366
|
+
</Modal.Header>
|
|
367
|
+
<Modal.Body>
|
|
368
|
+
<Text>Modal content</Text>
|
|
369
|
+
</Modal.Body>
|
|
370
|
+
</Modal.Container>
|
|
371
|
+
</Modal.Overlay>
|
|
372
|
+
</Modal>
|
|
373
|
+
</>
|
|
374
|
+
);
|
|
511
375
|
};
|
|
512
376
|
```
|
|
513
377
|
|
|
514
|
-
|
|
378
|
+
### **shadow**
|
|
379
|
+
Applies a shadow effect to the modal.
|
|
515
380
|
|
|
516
|
-
|
|
517
|
-
const ContainerShapes: Record<Shape, CSSProperties> = {
|
|
518
|
-
sharp: { borderRadius: 0 },
|
|
519
|
-
rounded: { borderRadius: 4 },
|
|
520
|
-
};
|
|
521
|
-
```
|
|
522
|
-
|
|
523
|
-
#### **HeaderIconSizes**
|
|
381
|
+
- **Type:** `Shadow | Elevation | ViewProps`
|
|
524
382
|
|
|
525
383
|
```tsx
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
384
|
+
import React, { useState } from 'react';
|
|
385
|
+
import { Modal } from '@app-studio/web';
|
|
386
|
+
import { Button, Text } from 'app-studio';
|
|
387
|
+
|
|
388
|
+
export const ShadowModal = () => {
|
|
389
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
390
|
+
|
|
391
|
+
return (
|
|
392
|
+
<>
|
|
393
|
+
<Button onClick={() => setIsOpen(true)}>Open</Button>
|
|
394
|
+
<Modal>
|
|
395
|
+
<Modal.Overlay isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
396
|
+
<Modal.Container
|
|
397
|
+
shadow={{ boxShadow: '0 20px 60px rgba(0,0,0,0.3)' }}
|
|
398
|
+
>
|
|
399
|
+
<Modal.Body>
|
|
400
|
+
<Text>Modal with custom shadow</Text>
|
|
401
|
+
</Modal.Body>
|
|
402
|
+
</Modal.Container>
|
|
403
|
+
</Modal.Overlay>
|
|
404
|
+
</Modal>
|
|
405
|
+
</>
|
|
406
|
+
);
|
|
532
407
|
};
|
|
533
408
|
```
|
|
409
|
+
|