@ceed/ads 1.35.1 → 1.37.0-next.1
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/README.md +85 -95
- package/dist/components/Accordions/Accordions.d.ts +1 -0
- package/dist/components/Alert/Alert.d.ts +5 -5
- package/dist/components/Autocomplete/Autocomplete.d.ts +2 -2
- package/dist/components/Avatar/Avatar.d.ts +7 -17
- package/dist/components/Box/Box.d.ts +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +6 -5
- package/dist/components/Button/Button.d.ts +3 -2
- package/dist/components/Calendar/Calendar.d.ts +1 -0
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/Chip/Chip.d.ts +1 -0
- package/dist/components/Container/Container.d.ts +6 -1
- package/dist/components/DialogActions/DialogActions.d.ts +1 -0
- package/dist/components/DialogContent/DialogContent.d.ts +1 -0
- package/dist/components/DialogFrame/DialogFrame.d.ts +1 -1
- package/dist/components/DialogTitle/DialogTitle.d.ts +1 -0
- package/dist/components/Divider/Divider.d.ts +1 -0
- package/dist/components/Dropdown/Dropdown.d.ts +28 -1
- package/dist/components/FilterMenu/components/MonthRange.d.ts +11 -0
- package/dist/components/FilterMenu/types.d.ts +5 -1
- package/dist/components/FilterableCheckboxGroup/FilterableCheckboxGroup.d.ts +1 -1
- package/dist/components/FormControl/FormControl.d.ts +1 -0
- package/dist/components/FormHelperText/FormHelperText.d.ts +1 -0
- package/dist/components/FormLabel/FormLabel.d.ts +1 -0
- package/dist/components/Grid/Grid.d.ts +1 -0
- package/dist/components/IconButton/IconButton.d.ts +3 -2
- package/dist/components/IconMenuButton/IconMenuButton.d.ts +7 -6
- package/dist/components/InfoSign/InfoSign.d.ts +3 -2
- package/dist/components/Input/Input.d.ts +8 -22
- package/dist/components/InsetDrawer/InsetDrawer.d.ts +1 -0
- package/dist/components/Markdown/Markdown.d.ts +9 -24
- package/dist/components/Menu/Menu.d.ts +2 -1
- package/dist/components/MenuButton/MenuButton.d.ts +10 -8
- package/dist/components/Modal/Modal.d.ts +4 -2
- package/dist/components/NavigationGroup/NavigationGroup.d.ts +3 -2
- package/dist/components/NavigationItem/NavigationItem.d.ts +3 -2
- package/dist/components/Navigator/Navigator.d.ts +5 -4
- package/dist/components/Pagination/Pagination.d.ts +2 -2
- package/dist/components/ProfileMenu/ProfileMenu.d.ts +3 -3
- package/dist/components/Radio/Radio.d.ts +1 -0
- package/dist/components/RadioList/RadioList.d.ts +3 -2
- package/dist/components/Select/Select.d.ts +12 -10
- package/dist/components/Sheet/Sheet.d.ts +1 -0
- package/dist/components/Stack/Stack.d.ts +1 -0
- package/dist/components/Stepper/Stepper.d.ts +2 -1
- package/dist/components/Switch/Switch.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +7 -5
- package/dist/components/Tabs/Tabs.d.ts +1 -0
- package/dist/components/Textarea/Textarea.d.ts +8 -20
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +24 -2
- package/dist/components/Tooltip/Tooltip.d.ts +1 -0
- package/dist/components/Typography/Typography.d.ts +1 -0
- package/dist/components/Uploader/Uploader.d.ts +18 -17
- package/dist/components/data-display/Avatar.md +61 -73
- package/dist/components/data-display/Badge.md +198 -182
- package/dist/components/data-display/Chip.md +165 -143
- package/dist/components/data-display/DataTable.md +843 -338
- package/dist/components/data-display/InfoSign.md +1 -3
- package/dist/components/data-display/Markdown.md +93 -125
- package/dist/components/data-display/Table.md +1454 -1008
- package/dist/components/data-display/Tooltip.md +1 -1
- package/dist/components/data-display/Typography.md +101 -104
- package/dist/components/feedback/Alert.md +81 -87
- package/dist/components/feedback/CircularProgress.md +34 -38
- package/dist/components/feedback/Dialog.md +25 -17
- package/dist/components/feedback/Modal.md +297 -266
- package/dist/components/feedback/Skeleton.md +125 -89
- package/dist/components/index.d.ts +60 -1
- package/dist/components/inputs/Autocomplete.md +192 -96
- package/dist/components/inputs/Button.md +85 -85
- package/dist/components/inputs/ButtonGroup.md +197 -187
- package/dist/components/inputs/Calendar.md +25 -28
- package/dist/components/inputs/Checkbox.md +13 -31
- package/dist/components/inputs/CurrencyInput.md +6 -6
- package/dist/components/inputs/DatePicker.md +229 -110
- package/dist/components/inputs/DateRangePicker.md +248 -137
- package/dist/components/inputs/FilterMenu.md +138 -8
- package/dist/components/inputs/FilterableCheckboxGroup.md +116 -56
- package/dist/components/inputs/FormControl.md +76 -70
- package/dist/components/inputs/IconButton.md +231 -207
- package/dist/components/inputs/Input.md +133 -100
- package/dist/components/inputs/MonthPicker.md +186 -84
- package/dist/components/inputs/MonthRangePicker.md +73 -49
- package/dist/components/inputs/PercentageInput.md +17 -33
- package/dist/components/inputs/RadioButton.md +322 -258
- package/dist/components/inputs/RadioList.md +68 -52
- package/dist/components/inputs/RadioTileGroup.md +287 -170
- package/dist/components/inputs/SearchBar.md +82 -60
- package/dist/components/inputs/Select.md +108 -97
- package/dist/components/inputs/Slider.md +155 -104
- package/dist/components/inputs/Switch.md +194 -139
- package/dist/components/inputs/Textarea.md +17 -22
- package/dist/components/inputs/Uploader/Uploader.md +69 -40
- package/dist/components/layout/Box.md +841 -662
- package/dist/components/layout/Container.md +3 -11
- package/dist/components/layout/Grid.md +480 -394
- package/dist/components/layout/Stack.md +739 -566
- package/dist/components/navigation/Breadcrumbs.md +182 -116
- package/dist/components/navigation/Dropdown.md +732 -391
- package/dist/components/navigation/IconMenuButton.md +15 -7
- package/dist/components/navigation/InsetDrawer.md +550 -378
- package/dist/components/navigation/Link.md +104 -94
- package/dist/components/navigation/Menu.md +624 -503
- package/dist/components/navigation/MenuButton.md +19 -11
- package/dist/components/navigation/NavigationGroup.md +19 -50
- package/dist/components/navigation/NavigationItem.md +6 -6
- package/dist/components/navigation/Navigator.md +26 -28
- package/dist/components/navigation/Pagination.md +87 -76
- package/dist/components/navigation/ProfileMenu.md +67 -45
- package/dist/components/navigation/Stepper.md +2 -12
- package/dist/components/navigation/Tabs.md +210 -184
- package/dist/components/surfaces/Accordions.md +90 -173
- package/dist/components/surfaces/Card.md +1096 -711
- package/dist/components/surfaces/Divider.md +562 -412
- package/dist/components/surfaces/Sheet.md +700 -518
- package/dist/guides/ThemeProvider.md +65 -40
- package/dist/index.browser.js +5 -5
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +1906 -1690
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1404 -1180
- package/framer/index.js +1 -1
- package/package.json +34 -36
|
@@ -6,23 +6,23 @@ The Modal component is a dialog overlay that appears on top of the main content,
|
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</>
|
|
9
|
+
<Button onClick={() => setOpen(true)}>Open Modal</Button>
|
|
10
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
11
|
+
<ModalDialog>
|
|
12
|
+
<ModalClose />
|
|
13
|
+
<DialogTitle>Modal Title</DialogTitle>
|
|
14
|
+
<DialogContent>This is the modal content. You can place any content here.</DialogContent>
|
|
15
|
+
<DialogActions>
|
|
16
|
+
<Button variant="solid" onClick={() => setOpen(false)}>
|
|
17
|
+
Confirm
|
|
18
|
+
</Button>
|
|
19
|
+
<Button variant="plain" color="neutral" onClick={() => setOpen(false)}>
|
|
20
|
+
Cancel
|
|
21
|
+
</Button>
|
|
22
|
+
</DialogActions>
|
|
23
|
+
</ModalDialog>
|
|
24
|
+
</Modal>
|
|
25
|
+
</>
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
| Field | Description | Default |
|
|
@@ -92,31 +92,50 @@ The basic modal with a simple Sheet for custom layouts.
|
|
|
92
92
|
|
|
93
93
|
```tsx
|
|
94
94
|
<>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
95
|
+
<Button onClick={() => setOpen(true)}>Open Basic Modal</Button>
|
|
96
|
+
<Modal
|
|
97
|
+
aria-labelledby="modal-title"
|
|
98
|
+
aria-describedby="modal-desc"
|
|
99
|
+
open={open}
|
|
100
|
+
onClose={() => setOpen(false)}
|
|
101
|
+
sx={{
|
|
102
|
+
display: "flex",
|
|
103
|
+
justifyContent: "center",
|
|
104
|
+
alignItems: "center"
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
<Sheet
|
|
108
|
+
variant="outlined"
|
|
109
|
+
sx={{
|
|
110
|
+
maxWidth: 500,
|
|
111
|
+
borderRadius: "md",
|
|
112
|
+
p: 3,
|
|
113
|
+
boxShadow: "lg"
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
<ModalClose
|
|
117
|
+
variant="plain"
|
|
118
|
+
sx={{
|
|
119
|
+
m: 1
|
|
120
|
+
}}
|
|
121
|
+
/>
|
|
122
|
+
<Typography
|
|
123
|
+
component="h2"
|
|
124
|
+
id="modal-title"
|
|
125
|
+
level="h4"
|
|
126
|
+
textColor="inherit"
|
|
127
|
+
fontWeight="lg"
|
|
128
|
+
mb={2}
|
|
129
|
+
>
|
|
130
|
+
This is the modal title
|
|
131
|
+
</Typography>
|
|
132
|
+
<Typography id="modal-desc" textColor="text.tertiary">
|
|
133
|
+
Make sure to use <code>aria-labelledby</code> on the modal dialog with an optional{" "}
|
|
134
|
+
<code>aria-describedby</code> attribute.
|
|
135
|
+
</Typography>
|
|
136
|
+
</Sheet>
|
|
137
|
+
</Modal>
|
|
138
|
+
</>
|
|
120
139
|
```
|
|
121
140
|
|
|
122
141
|
## Modal Dialog
|
|
@@ -125,33 +144,35 @@ Use ModalDialog for structured dialogs with title, content, and actions.
|
|
|
125
144
|
|
|
126
145
|
```tsx
|
|
127
146
|
<>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
</
|
|
154
|
-
|
|
147
|
+
<Button onClick={() => setOpen(true)}>Open Form Modal</Button>
|
|
148
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
149
|
+
<ModalDialog>
|
|
150
|
+
<ModalClose />
|
|
151
|
+
<DialogTitle>Create new project</DialogTitle>
|
|
152
|
+
<DialogContent>
|
|
153
|
+
Fill in the information of the project.
|
|
154
|
+
<form
|
|
155
|
+
onSubmit={(event: React.FormEvent<HTMLFormElement>) => {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
setOpen(false);
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<Stack spacing={4}>
|
|
161
|
+
<FormControl>
|
|
162
|
+
<FormLabel>Name</FormLabel>
|
|
163
|
+
<Input required />
|
|
164
|
+
</FormControl>
|
|
165
|
+
<FormControl>
|
|
166
|
+
<FormLabel>Description</FormLabel>
|
|
167
|
+
<Input required />
|
|
168
|
+
</FormControl>
|
|
169
|
+
<Button type="submit">Submit</Button>
|
|
170
|
+
</Stack>
|
|
171
|
+
</form>
|
|
172
|
+
</DialogContent>
|
|
173
|
+
</ModalDialog>
|
|
174
|
+
</Modal>
|
|
175
|
+
</>
|
|
155
176
|
```
|
|
156
177
|
|
|
157
178
|
## Modal Dialog Variants
|
|
@@ -162,60 +183,60 @@ Modal dialogs support different visual variants.
|
|
|
162
183
|
|
|
163
184
|
```tsx
|
|
164
185
|
<>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
</>
|
|
186
|
+
<Button onClick={() => setOpen(true)}>Plain Variant</Button>
|
|
187
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
188
|
+
<ModalDialog variant="plain">
|
|
189
|
+
<ModalClose />
|
|
190
|
+
<DialogTitle>Modal Dialog</DialogTitle>
|
|
191
|
+
<DialogContent>This is a `plain` modal dialog.</DialogContent>
|
|
192
|
+
</ModalDialog>
|
|
193
|
+
</Modal>
|
|
194
|
+
</>
|
|
174
195
|
```
|
|
175
196
|
|
|
176
197
|
#### Outlined Variant
|
|
177
198
|
|
|
178
199
|
```tsx
|
|
179
200
|
<>
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
</>
|
|
201
|
+
<Button onClick={() => setOpen(true)}>Outlined Variant</Button>
|
|
202
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
203
|
+
<ModalDialog variant="outlined">
|
|
204
|
+
<ModalClose />
|
|
205
|
+
<DialogTitle>Modal Dialog</DialogTitle>
|
|
206
|
+
<DialogContent>This is an `outlined` modal dialog.</DialogContent>
|
|
207
|
+
</ModalDialog>
|
|
208
|
+
</Modal>
|
|
209
|
+
</>
|
|
189
210
|
```
|
|
190
211
|
|
|
191
212
|
#### Soft Variant
|
|
192
213
|
|
|
193
214
|
```tsx
|
|
194
215
|
<>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
</>
|
|
216
|
+
<Button onClick={() => setOpen(true)}>Soft Variant</Button>
|
|
217
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
218
|
+
<ModalDialog variant="soft">
|
|
219
|
+
<ModalClose />
|
|
220
|
+
<DialogTitle>Modal Dialog</DialogTitle>
|
|
221
|
+
<DialogContent>This is a `soft` modal dialog.</DialogContent>
|
|
222
|
+
</ModalDialog>
|
|
223
|
+
</Modal>
|
|
224
|
+
</>
|
|
204
225
|
```
|
|
205
226
|
|
|
206
227
|
#### Solid Variant
|
|
207
228
|
|
|
208
229
|
```tsx
|
|
209
230
|
<>
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
</>
|
|
231
|
+
<Button onClick={() => setOpen(true)}>Solid Variant</Button>
|
|
232
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
233
|
+
<ModalDialog variant="solid">
|
|
234
|
+
<ModalClose />
|
|
235
|
+
<DialogTitle>Modal Dialog</DialogTitle>
|
|
236
|
+
<DialogContent>This is a `solid` modal dialog.</DialogContent>
|
|
237
|
+
</ModalDialog>
|
|
238
|
+
</Modal>
|
|
239
|
+
</>
|
|
219
240
|
```
|
|
220
241
|
|
|
221
242
|
## Alert Dialog
|
|
@@ -224,28 +245,28 @@ For critical confirmations that require explicit user decision.
|
|
|
224
245
|
|
|
225
246
|
```tsx
|
|
226
247
|
<>
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
</>
|
|
248
|
+
<Button color="danger" onClick={() => setOpen(true)}>
|
|
249
|
+
Delete Item
|
|
250
|
+
</Button>
|
|
251
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
252
|
+
<ModalDialog variant="outlined" role="alertdialog">
|
|
253
|
+
<DialogTitle>
|
|
254
|
+
<WarningRoundedIcon />
|
|
255
|
+
Confirmation
|
|
256
|
+
</DialogTitle>
|
|
257
|
+
<Divider />
|
|
258
|
+
<DialogContent>Are you sure you want to discard all of your notes?</DialogContent>
|
|
259
|
+
<DialogActions>
|
|
260
|
+
<Button variant="solid" color="danger" onClick={() => setOpen(false)}>
|
|
261
|
+
Discard notes
|
|
262
|
+
</Button>
|
|
263
|
+
<Button variant="plain" color="neutral" onClick={() => setOpen(false)}>
|
|
264
|
+
Cancel
|
|
265
|
+
</Button>
|
|
266
|
+
</DialogActions>
|
|
267
|
+
</ModalDialog>
|
|
268
|
+
</Modal>
|
|
269
|
+
</>
|
|
249
270
|
```
|
|
250
271
|
|
|
251
272
|
## Modal Layouts
|
|
@@ -256,20 +277,20 @@ For complex content that requires maximum screen space.
|
|
|
256
277
|
|
|
257
278
|
```tsx
|
|
258
279
|
<>
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
</>
|
|
280
|
+
<Button onClick={() => setOpen(true)}>Open Fullscreen Modal</Button>
|
|
281
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
282
|
+
<ModalDialog layout="fullscreen">
|
|
283
|
+
<ModalClose />
|
|
284
|
+
<DialogTitle>Fullscreen Modal</DialogTitle>
|
|
285
|
+
<DialogContent>This modal takes up the entire screen.</DialogContent>
|
|
286
|
+
<DialogActions>
|
|
287
|
+
<Button variant="solid" onClick={() => setOpen(false)}>
|
|
288
|
+
Save
|
|
289
|
+
</Button>
|
|
290
|
+
</DialogActions>
|
|
291
|
+
</ModalDialog>
|
|
292
|
+
</Modal>
|
|
293
|
+
</>
|
|
273
294
|
```
|
|
274
295
|
|
|
275
296
|
## Nested Modals
|
|
@@ -278,28 +299,30 @@ Modals can be stacked on top of each other when necessary.
|
|
|
278
299
|
|
|
279
300
|
```tsx
|
|
280
301
|
<>
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
<
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
<
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
302
|
+
<Button onClick={() => setFirstOpen(true)}>Open First Modal</Button>
|
|
303
|
+
<Modal open={firstOpen} onClose={() => setFirstOpen(false)}>
|
|
304
|
+
<ModalDialog>
|
|
305
|
+
<ModalClose />
|
|
306
|
+
<DialogTitle>First Modal</DialogTitle>
|
|
307
|
+
<DialogContent>
|
|
308
|
+
This is the first modal. Click the button below to open a nested modal.
|
|
309
|
+
</DialogContent>
|
|
310
|
+
<DialogActions>
|
|
311
|
+
<Button onClick={() => setSecondOpen(true)}>Open Nested Modal</Button>
|
|
312
|
+
</DialogActions>
|
|
313
|
+
</ModalDialog>
|
|
314
|
+
</Modal>
|
|
315
|
+
<Modal open={secondOpen} onClose={() => setSecondOpen(false)}>
|
|
316
|
+
<ModalDialog>
|
|
317
|
+
<ModalClose />
|
|
318
|
+
<DialogTitle>Nested Modal</DialogTitle>
|
|
319
|
+
<DialogContent>This is a nested modal on top of the first one.</DialogContent>
|
|
320
|
+
<DialogActions>
|
|
321
|
+
<Button onClick={() => setSecondOpen(false)}>Close</Button>
|
|
322
|
+
</DialogActions>
|
|
323
|
+
</ModalDialog>
|
|
324
|
+
</Modal>
|
|
325
|
+
</>
|
|
303
326
|
```
|
|
304
327
|
|
|
305
328
|
## ModalFrame Examples
|
|
@@ -310,16 +333,16 @@ ModalFrame is a convenience component that automatically provides a title, close
|
|
|
310
333
|
|
|
311
334
|
```tsx
|
|
312
335
|
<>
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
</>
|
|
336
|
+
<Button onClick={() => setOpen(true)}>Open ModalFrame</Button>
|
|
337
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
338
|
+
<ModalFrame title="ModalFrame Title" onClose={() => setOpen(false)}>
|
|
339
|
+
<Typography>
|
|
340
|
+
ModalFrame automatically composes ModalDialog, ModalClose, DialogTitle, and DialogContent.
|
|
341
|
+
You only need to provide a title, onClose handler, and children.
|
|
342
|
+
</Typography>
|
|
343
|
+
</ModalFrame>
|
|
344
|
+
</Modal>
|
|
345
|
+
</>
|
|
323
346
|
```
|
|
324
347
|
|
|
325
348
|
#### titleStartDecorator
|
|
@@ -328,15 +351,20 @@ Display an icon or decorative element before the title.
|
|
|
328
351
|
|
|
329
352
|
```tsx
|
|
330
353
|
<>
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
354
|
+
<Button onClick={() => setOpen(true)}>With Decorator</Button>
|
|
355
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
356
|
+
<ModalFrame
|
|
357
|
+
title="Details"
|
|
358
|
+
titleStartDecorator={<InfoOutlinedIcon />}
|
|
359
|
+
onClose={() => setOpen(false)}
|
|
360
|
+
>
|
|
361
|
+
<Typography>
|
|
362
|
+
Use the <code>titleStartDecorator</code> prop to display an icon or element before the
|
|
363
|
+
title.
|
|
364
|
+
</Typography>
|
|
365
|
+
</ModalFrame>
|
|
366
|
+
</Modal>
|
|
367
|
+
</>
|
|
340
368
|
```
|
|
341
369
|
|
|
342
370
|
#### Form Content
|
|
@@ -345,28 +373,30 @@ An inline form pattern where the submit button lives inside the content area.
|
|
|
345
373
|
|
|
346
374
|
```tsx
|
|
347
375
|
<>
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
<
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
</
|
|
369
|
-
|
|
376
|
+
<Button onClick={() => setOpen(true)}>Form in ModalFrame</Button>
|
|
377
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
378
|
+
<ModalFrame title="Create Project" onClose={() => setOpen(false)}>
|
|
379
|
+
<form
|
|
380
|
+
onSubmit={(event: React.FormEvent<HTMLFormElement>) => {
|
|
381
|
+
event.preventDefault();
|
|
382
|
+
setOpen(false);
|
|
383
|
+
}}
|
|
384
|
+
>
|
|
385
|
+
<Stack spacing={2}>
|
|
386
|
+
<FormControl>
|
|
387
|
+
<FormLabel>Name</FormLabel>
|
|
388
|
+
<Input required />
|
|
389
|
+
</FormControl>
|
|
390
|
+
<FormControl>
|
|
391
|
+
<FormLabel>Description</FormLabel>
|
|
392
|
+
<Input required />
|
|
393
|
+
</FormControl>
|
|
394
|
+
<Button type="submit">Submit</Button>
|
|
395
|
+
</Stack>
|
|
396
|
+
</form>
|
|
397
|
+
</ModalFrame>
|
|
398
|
+
</Modal>
|
|
399
|
+
</>
|
|
370
400
|
```
|
|
371
401
|
|
|
372
402
|
#### Sizes
|
|
@@ -375,31 +405,31 @@ Compare sm / md / lg sizes side by side.
|
|
|
375
405
|
|
|
376
406
|
```tsx
|
|
377
407
|
<Stack direction="row" spacing={2}>
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
</Stack>
|
|
408
|
+
<Button size="sm" onClick={() => setOpenSm(true)}>
|
|
409
|
+
Small
|
|
410
|
+
</Button>
|
|
411
|
+
<Button size="md" onClick={() => setOpenMd(true)}>
|
|
412
|
+
Medium
|
|
413
|
+
</Button>
|
|
414
|
+
<Button size="lg" onClick={() => setOpenLg(true)}>
|
|
415
|
+
Large
|
|
416
|
+
</Button>
|
|
417
|
+
<Modal open={openSm} onClose={() => setOpenSm(false)}>
|
|
418
|
+
<ModalFrame title="Small ModalFrame" size="sm" onClose={() => setOpenSm(false)}>
|
|
419
|
+
<Typography>This is a small ModalFrame.</Typography>
|
|
420
|
+
</ModalFrame>
|
|
421
|
+
</Modal>
|
|
422
|
+
<Modal open={openMd} onClose={() => setOpenMd(false)}>
|
|
423
|
+
<ModalFrame title="Medium ModalFrame" size="md" onClose={() => setOpenMd(false)}>
|
|
424
|
+
<Typography>This is a medium ModalFrame.</Typography>
|
|
425
|
+
</ModalFrame>
|
|
426
|
+
</Modal>
|
|
427
|
+
<Modal open={openLg} onClose={() => setOpenLg(false)}>
|
|
428
|
+
<ModalFrame title="Large ModalFrame" size="lg" onClose={() => setOpenLg(false)}>
|
|
429
|
+
<Typography>This is a large ModalFrame.</Typography>
|
|
430
|
+
</ModalFrame>
|
|
431
|
+
</Modal>
|
|
432
|
+
</Stack>
|
|
403
433
|
```
|
|
404
434
|
|
|
405
435
|
#### Custom Content
|
|
@@ -408,30 +438,30 @@ A layout example suited for displaying detailed information.
|
|
|
408
438
|
|
|
409
439
|
```tsx
|
|
410
440
|
<>
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
</>
|
|
441
|
+
<Button onClick={() => setOpen(true)}>Custom Content</Button>
|
|
442
|
+
<Modal open={open} onClose={() => setOpen(false)}>
|
|
443
|
+
<ModalFrame title="Order Details" onClose={() => setOpen(false)}>
|
|
444
|
+
<Stack spacing={2}>
|
|
445
|
+
<Box>
|
|
446
|
+
<Typography level="title-sm">Order ID</Typography>
|
|
447
|
+
<Typography level="body-sm">ORD-2024-00123</Typography>
|
|
448
|
+
</Box>
|
|
449
|
+
<Divider />
|
|
450
|
+
<Box>
|
|
451
|
+
<Typography level="title-sm">Customer</Typography>
|
|
452
|
+
<Typography level="body-sm">John Doe</Typography>
|
|
453
|
+
</Box>
|
|
454
|
+
<Divider />
|
|
455
|
+
<Box>
|
|
456
|
+
<Typography level="title-sm">Status</Typography>
|
|
457
|
+
<Typography level="body-sm" color="success">
|
|
458
|
+
Completed
|
|
459
|
+
</Typography>
|
|
460
|
+
</Box>
|
|
461
|
+
</Stack>
|
|
462
|
+
</ModalFrame>
|
|
463
|
+
</Modal>
|
|
464
|
+
</>
|
|
435
465
|
```
|
|
436
466
|
|
|
437
467
|
#### Standalone
|
|
@@ -448,18 +478,19 @@ ModalFrame can be used without a Modal wrapper for embedding dialog-style layout
|
|
|
448
478
|
> ModalFrame inherits its dimensions from `ModalDialog`, which normally receives sizing from the Modal overlay. Without these constraints, the component will not render with correct dimensions.
|
|
449
479
|
|
|
450
480
|
```tsx
|
|
451
|
-
<Box
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
ModalFrame
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
</
|
|
462
|
-
</
|
|
481
|
+
<Box
|
|
482
|
+
sx={{
|
|
483
|
+
position: "relative",
|
|
484
|
+
width: 480,
|
|
485
|
+
height: 300
|
|
486
|
+
}}
|
|
487
|
+
>
|
|
488
|
+
<ModalFrame title="Standalone ModalFrame" onClose={() => console.log("close")}>
|
|
489
|
+
<Typography>
|
|
490
|
+
ModalFrame used without Modal. The parent container must provide explicit width and height.
|
|
491
|
+
</Typography>
|
|
492
|
+
</ModalFrame>
|
|
493
|
+
</Box>
|
|
463
494
|
```
|
|
464
495
|
|
|
465
496
|
## When to Use
|
|
@@ -711,7 +742,7 @@ Modal uses a composition pattern with multiple sub-components:
|
|
|
711
742
|
| --------- | -------------------------------------------------------------- | ------------ | ------------ |
|
|
712
743
|
| `variant` | `'plain' \| 'outlined' \| 'soft' \| 'solid'` | `'outlined'` | Visual style |
|
|
713
744
|
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
714
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'
|
|
745
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'sm'` | Dialog size |
|
|
715
746
|
| `layout` | `'center' \| 'fullscreen'` | `'center'` | Layout mode |
|
|
716
747
|
|
|
717
748
|
### ModalFrame Props
|