@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,533 +1,409 @@
|
|
|
1
|
-
|
|
1
|
+
# Modal
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { Modal } from 'app-studio';
|
|
5
|
-
```
|
|
6
|
-
|
|
7
|
-
### **Default**
|
|
8
|
-
|
|
9
|
-
It uses the isOpen and onClose properties to display the modal.
|
|
3
|
+
A custom content overlay that appears on top of the main screen, with support for headers, bodies, footers, and flexible positioning.
|
|
10
4
|
|
|
5
|
+
### **Import**
|
|
11
6
|
```tsx
|
|
12
|
-
import {
|
|
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
|
-
</>;
|
|
7
|
+
import { Modal, useModalStore } from '@app-studio/web';
|
|
35
8
|
```
|
|
36
9
|
|
|
37
|
-
|
|
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**
|
|
54
|
-
|
|
55
|
-
| Prop | Type | Description | Default |
|
|
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.
|
|
68
|
-
|
|
10
|
+
### **Default**
|
|
69
11
|
```tsx
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<Modal
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
+
};
|
|
93
41
|
```
|
|
94
42
|
|
|
95
|
-
### **
|
|
96
|
-
|
|
97
|
-
“**_position_**” places the modal in the specified direction. It has a default positioning of “center”.
|
|
43
|
+
### **Modal.Layout**
|
|
44
|
+
Centralized modal management system for handling multiple modals.
|
|
98
45
|
|
|
99
46
|
```tsx
|
|
100
|
-
import
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<Modal.
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
</>;
|
|
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
|
+
);
|
|
195
85
|
```
|
|
196
86
|
|
|
197
|
-
### **
|
|
87
|
+
### **isOpen**
|
|
88
|
+
Controls the visibility of the modal.
|
|
198
89
|
|
|
199
|
-
|
|
90
|
+
- **Type:** `boolean`
|
|
91
|
+
- **Required:** `true`
|
|
200
92
|
|
|
201
93
|
```tsx
|
|
202
|
-
import { useState } from 'react';
|
|
203
|
-
import {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
<
|
|
212
|
-
<Modal
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
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
|
+
};
|
|
223
116
|
```
|
|
224
117
|
|
|
225
|
-
### **
|
|
118
|
+
### **onClose**
|
|
119
|
+
Callback function executed when the modal closes.
|
|
226
120
|
|
|
227
|
-
|
|
121
|
+
- **Type:** `() => void`
|
|
122
|
+
- **Required:** `true`
|
|
228
123
|
|
|
229
124
|
```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
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
### **Shapes**
|
|
260
|
-
|
|
261
|
-
“**_shape_**” gives a sharp or rounded edges to the modal container.
|
|
262
|
-
|
|
263
|
-
```tsx
|
|
264
|
-
import { useState } from 'react';
|
|
265
|
-
import { Button } from '../Button/Button';
|
|
266
|
-
import { Text } from 'app-studio';
|
|
267
|
-
import { Horizontal } from '../Layout/Horizontal/Horizontal';
|
|
268
|
-
|
|
269
|
-
const [showSharp, setShowSharp] = useState(false);
|
|
270
|
-
const [showRounded, setShowRounded] = useState(false);
|
|
271
|
-
|
|
272
|
-
<>
|
|
273
|
-
<Horizontal gap={10}>
|
|
274
|
-
<Button onClick={() => setShowSharp(true)}>Sharp</Button>
|
|
275
|
-
<Button onClick={() => setShowRounded(true)}>Rounded</Button>
|
|
276
|
-
</Horizontal>
|
|
277
|
-
|
|
278
|
-
{showSharp && (
|
|
279
|
-
<Modal.Overlay isOpen={showSharp} onClose={() => setShowSharp(false)}>
|
|
280
|
-
<Modal.Container variant="sharp">
|
|
281
|
-
<Modal.Body>
|
|
282
|
-
<Text maxLines={2}>
|
|
283
|
-
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget
|
|
284
|
-
quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel
|
|
285
|
-
scelerisque nisl consectetur et.
|
|
286
|
-
</Text>
|
|
287
|
-
</Modal.Body>
|
|
288
|
-
</Modal.Container>
|
|
289
|
-
</Modal.Overlay>
|
|
290
|
-
)}
|
|
291
|
-
{showRounded && (
|
|
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 'app-studio';
|
|
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
|
-
|
|
193
|
+
### **position**
|
|
194
|
+
Positioning of the modal container.
|
|
338
195
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
### **Close Button Alignment**
|
|
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
|
-
|
|
235
|
+
### **blur**
|
|
236
|
+
The degree of blurriness applied to the overlay.
|
|
403
237
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
### **LargeContent**
|
|
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 'app-studio';
|
|
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';
|
|
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
|
-
|
|
515
|
-
|
|
516
|
-
```tsx
|
|
517
|
-
const ContainerShapes: Record<Shape, CSSProperties> = {
|
|
518
|
-
sharp: { borderRadius: 0 },
|
|
519
|
-
rounded: { borderRadius: 4 },
|
|
520
|
-
};
|
|
521
|
-
```
|
|
378
|
+
### **shadow**
|
|
379
|
+
Applies a shadow effect to the modal.
|
|
522
380
|
|
|
523
|
-
|
|
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
|
+
|