@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
|
@@ -27,12 +27,7 @@ import { Switch } from '@ceed/ads';
|
|
|
27
27
|
function MyComponent() {
|
|
28
28
|
const [enabled, setEnabled] = useState(false);
|
|
29
29
|
|
|
30
|
-
return (
|
|
31
|
-
<Switch
|
|
32
|
-
checked={enabled}
|
|
33
|
-
onChange={(e) => setEnabled(e.target.checked)}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
30
|
+
return <Switch checked={enabled} onChange={(e) => setEnabled(e.target.checked)} />;
|
|
36
31
|
}
|
|
37
32
|
```
|
|
38
33
|
|
|
@@ -41,24 +36,38 @@ function MyComponent() {
|
|
|
41
36
|
Use `FormControl` with `FormLabel` and `FormHelperText` to provide a label and description alongside the switch. The `orientation="horizontal"` layout places the label on the left and the switch on the right.
|
|
42
37
|
|
|
43
38
|
```tsx
|
|
44
|
-
<FormControl
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
<FormControl
|
|
40
|
+
orientation="horizontal"
|
|
41
|
+
sx={{
|
|
42
|
+
width: 300,
|
|
43
|
+
justifyContent: "space-between"
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<div>
|
|
47
|
+
<FormLabel>Show captions</FormLabel>
|
|
48
|
+
<FormHelperText
|
|
49
|
+
sx={{
|
|
50
|
+
mt: 0
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
All languages available.
|
|
54
|
+
</FormHelperText>
|
|
55
|
+
</div>
|
|
56
|
+
<Switch
|
|
57
|
+
checked={checked}
|
|
58
|
+
onChange={(e) => setChecked(e.target.checked)}
|
|
59
|
+
color={checked ? "success" : "neutral"}
|
|
60
|
+
variant={checked ? "solid" : "outlined"}
|
|
61
|
+
endDecorator={checked ? "On" : "Off"}
|
|
62
|
+
slotProps={{
|
|
63
|
+
endDecorator: {
|
|
64
|
+
sx: {
|
|
65
|
+
minWidth: 24
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
</FormControl>
|
|
62
71
|
```
|
|
63
72
|
|
|
64
73
|
## Inline Labels
|
|
@@ -66,11 +75,18 @@ Use `FormControl` with `FormLabel` and `FormHelperText` to provide a label and d
|
|
|
66
75
|
For simpler cases, wrap the switch inside a `Typography` component rendered as a `<label>`. This connects the text and switch semantically without requiring a `FormControl`.
|
|
67
76
|
|
|
68
77
|
```tsx
|
|
69
|
-
<Typography
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
<Typography
|
|
79
|
+
component="label"
|
|
80
|
+
endDecorator={
|
|
81
|
+
<Switch
|
|
82
|
+
sx={{
|
|
83
|
+
ml: 1
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
}
|
|
87
|
+
>
|
|
88
|
+
Turn alarm on
|
|
89
|
+
</Typography>
|
|
74
90
|
```
|
|
75
91
|
|
|
76
92
|
## With Decorators
|
|
@@ -78,15 +94,30 @@ Turn alarm on
|
|
|
78
94
|
Use `startDecorator` and `endDecorator` to place icons or text around the switch. This is particularly useful for theme toggles or any context where visual cues reinforce the on/off meaning.
|
|
79
95
|
|
|
80
96
|
```tsx
|
|
81
|
-
<Switch
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
<Switch
|
|
98
|
+
color={dark ? "primary" : "danger"}
|
|
99
|
+
slotProps={{
|
|
100
|
+
input: {
|
|
101
|
+
"aria-label": "dark mode"
|
|
102
|
+
}
|
|
103
|
+
}}
|
|
104
|
+
startDecorator={
|
|
105
|
+
<LightModeIcon
|
|
106
|
+
sx={(theme) => ({
|
|
107
|
+
color: dark ? "currentColor" : "var(--ceed-palette-danger-solidBg)"
|
|
108
|
+
})}
|
|
109
|
+
/>
|
|
110
|
+
}
|
|
111
|
+
endDecorator={
|
|
112
|
+
<DarkModeIcon
|
|
113
|
+
sx={(theme) => ({
|
|
114
|
+
color: dark ? "var(--ceed-palette-primary-solidBg)" : "currentColor"
|
|
115
|
+
})}
|
|
116
|
+
/>
|
|
117
|
+
}
|
|
118
|
+
checked={dark}
|
|
119
|
+
onChange={(event) => setDark(event.target.checked)}
|
|
120
|
+
/>
|
|
90
121
|
```
|
|
91
122
|
|
|
92
123
|
## Track Children
|
|
@@ -95,42 +126,62 @@ Display text or symbols inside the switch track using `slotProps.track.children`
|
|
|
95
126
|
|
|
96
127
|
```tsx
|
|
97
128
|
<Stack direction="row" spacing={4}>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
<Switch
|
|
130
|
+
{...args}
|
|
131
|
+
slotProps={{
|
|
132
|
+
track: {
|
|
133
|
+
children: (
|
|
134
|
+
<React.Fragment>
|
|
135
|
+
<Typography
|
|
136
|
+
component="span"
|
|
137
|
+
level="inherit"
|
|
138
|
+
sx={{
|
|
139
|
+
ml: "10px"
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
On
|
|
143
|
+
</Typography>
|
|
144
|
+
<Typography
|
|
145
|
+
component="span"
|
|
146
|
+
level="inherit"
|
|
147
|
+
sx={{
|
|
148
|
+
mr: "8px"
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
Off
|
|
152
|
+
</Typography>
|
|
153
|
+
</React.Fragment>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
}}
|
|
157
|
+
sx={{
|
|
158
|
+
"--Switch-thumbSize": "27px",
|
|
159
|
+
"--Switch-trackWidth": "64px",
|
|
160
|
+
"--Switch-trackHeight": "31px"
|
|
161
|
+
}}
|
|
162
|
+
/>
|
|
163
|
+
<Switch
|
|
164
|
+
color="success"
|
|
165
|
+
slotProps={{
|
|
166
|
+
track: {
|
|
167
|
+
children: (
|
|
168
|
+
<React.Fragment>
|
|
169
|
+
<span>I</span>
|
|
170
|
+
<span>0</span>
|
|
171
|
+
</React.Fragment>
|
|
172
|
+
),
|
|
173
|
+
sx: {
|
|
174
|
+
justifyContent: "space-around"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}}
|
|
178
|
+
sx={{
|
|
179
|
+
"--Switch-thumbSize": "27px",
|
|
180
|
+
"--Switch-trackWidth": "52px",
|
|
181
|
+
"--Switch-trackHeight": "31px"
|
|
182
|
+
}}
|
|
183
|
+
/>
|
|
184
|
+
</Stack>
|
|
134
185
|
```
|
|
135
186
|
|
|
136
187
|
## Thumb Children
|
|
@@ -138,16 +189,20 @@ Display text or symbols inside the switch track using `slotProps.track.children`
|
|
|
138
189
|
Place an icon inside the switch thumb using `slotProps.thumb.children`. This is useful for adding a small visual indicator that moves with the toggle.
|
|
139
190
|
|
|
140
191
|
```tsx
|
|
141
|
-
<Switch
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}}
|
|
192
|
+
<Switch
|
|
193
|
+
size="lg"
|
|
194
|
+
slotProps={{
|
|
195
|
+
input: {
|
|
196
|
+
"aria-label": "Dark mode"
|
|
197
|
+
},
|
|
198
|
+
thumb: {
|
|
199
|
+
children: <DarkModeIcon fontSize="inherit" />
|
|
200
|
+
}
|
|
201
|
+
}}
|
|
202
|
+
sx={{
|
|
203
|
+
"--Switch-thumbSize": "16px"
|
|
204
|
+
}}
|
|
205
|
+
/>
|
|
151
206
|
```
|
|
152
207
|
|
|
153
208
|
## All Variants Overview
|
|
@@ -156,38 +211,54 @@ A comprehensive view of all color and decoration combinations.
|
|
|
156
211
|
|
|
157
212
|
```tsx
|
|
158
213
|
<Stack direction="row" spacing={4}>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
214
|
+
{([undefined, "primary", "warning", "success", "danger", "neutral"] as const).map((color) => (
|
|
215
|
+
<Stack key={color} spacing={2}>
|
|
216
|
+
<Switch color={color} />
|
|
217
|
+
<Switch color={color} checked />
|
|
218
|
+
<Switch color={color} startDecorator={<LightModeIcon />} endDecorator={<DarkModeIcon />} />
|
|
219
|
+
<Switch
|
|
220
|
+
color={color}
|
|
221
|
+
slotProps={{
|
|
222
|
+
input: {
|
|
223
|
+
"aria-label": "Dark mode"
|
|
224
|
+
},
|
|
225
|
+
thumb: {
|
|
226
|
+
children: <DarkModeIcon fontSize="inherit" />
|
|
227
|
+
},
|
|
228
|
+
track: {
|
|
229
|
+
children: (
|
|
230
|
+
<React.Fragment>
|
|
231
|
+
<span>I</span>
|
|
232
|
+
<span>0</span>
|
|
233
|
+
</React.Fragment>
|
|
234
|
+
),
|
|
235
|
+
sx: {
|
|
236
|
+
justifyContent: "space-around"
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}}
|
|
240
|
+
sx={{
|
|
241
|
+
"--Switch-thumbSize": "27px",
|
|
242
|
+
"--Switch-trackWidth": "52px",
|
|
243
|
+
"--Switch-trackHeight": "31px"
|
|
244
|
+
}}
|
|
245
|
+
/>
|
|
246
|
+
<Typography
|
|
247
|
+
component="label"
|
|
248
|
+
startDecorator={
|
|
249
|
+
<Switch
|
|
250
|
+
sx={{
|
|
251
|
+
ml: 1
|
|
252
|
+
}}
|
|
253
|
+
color={color}
|
|
254
|
+
/>
|
|
255
|
+
}
|
|
256
|
+
>
|
|
257
|
+
Label
|
|
258
|
+
</Typography>
|
|
259
|
+
</Stack>
|
|
260
|
+
))}
|
|
261
|
+
</Stack>
|
|
191
262
|
```
|
|
192
263
|
|
|
193
264
|
## Settings Panel
|
|
@@ -199,15 +270,10 @@ function SettingsPanel() {
|
|
|
199
270
|
|
|
200
271
|
return (
|
|
201
272
|
<Stack spacing={3}>
|
|
202
|
-
<FormControl
|
|
203
|
-
orientation="horizontal"
|
|
204
|
-
sx={{ width: 400, justifyContent: 'space-between' }}
|
|
205
|
-
>
|
|
273
|
+
<FormControl orientation="horizontal" sx={{ width: 400, justifyContent: 'space-between' }}>
|
|
206
274
|
<div>
|
|
207
275
|
<FormLabel>Notifications</FormLabel>
|
|
208
|
-
<FormHelperText sx={{ mt: 0 }}>
|
|
209
|
-
Receive alerts when new messages arrive.
|
|
210
|
-
</FormHelperText>
|
|
276
|
+
<FormHelperText sx={{ mt: 0 }}>Receive alerts when new messages arrive.</FormHelperText>
|
|
211
277
|
</div>
|
|
212
278
|
<Switch
|
|
213
279
|
checked={notifications}
|
|
@@ -216,20 +282,12 @@ function SettingsPanel() {
|
|
|
216
282
|
/>
|
|
217
283
|
</FormControl>
|
|
218
284
|
|
|
219
|
-
<FormControl
|
|
220
|
-
orientation="horizontal"
|
|
221
|
-
sx={{ width: 400, justifyContent: 'space-between' }}
|
|
222
|
-
>
|
|
285
|
+
<FormControl orientation="horizontal" sx={{ width: 400, justifyContent: 'space-between' }}>
|
|
223
286
|
<div>
|
|
224
287
|
<FormLabel>Auto Save</FormLabel>
|
|
225
|
-
<FormHelperText sx={{ mt: 0 }}>
|
|
226
|
-
Automatically save your work every 30 seconds.
|
|
227
|
-
</FormHelperText>
|
|
288
|
+
<FormHelperText sx={{ mt: 0 }}>Automatically save your work every 30 seconds.</FormHelperText>
|
|
228
289
|
</div>
|
|
229
|
-
<Switch
|
|
230
|
-
checked={autoSave}
|
|
231
|
-
onChange={(e) => setAutoSave(e.target.checked)}
|
|
232
|
-
/>
|
|
290
|
+
<Switch checked={autoSave} onChange={(e) => setAutoSave(e.target.checked)} />
|
|
233
291
|
</FormControl>
|
|
234
292
|
</Stack>
|
|
235
293
|
);
|
|
@@ -264,10 +322,7 @@ function FeatureToggle() {
|
|
|
264
322
|
const [betaEnabled, setBetaEnabled] = useState(false);
|
|
265
323
|
|
|
266
324
|
return (
|
|
267
|
-
<FormControl
|
|
268
|
-
orientation="horizontal"
|
|
269
|
-
sx={{ justifyContent: 'space-between' }}
|
|
270
|
-
>
|
|
325
|
+
<FormControl orientation="horizontal" sx={{ justifyContent: 'space-between' }}>
|
|
271
326
|
<FormLabel>Enable Beta Features</FormLabel>
|
|
272
327
|
<Switch
|
|
273
328
|
checked={betaEnabled}
|
|
@@ -339,7 +394,7 @@ function FeatureToggle() {
|
|
|
339
394
|
| `disabled` | `boolean` | `false` | Disables the switch |
|
|
340
395
|
| `readOnly` | `boolean` | `false` | Makes the switch read-only |
|
|
341
396
|
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme when checked |
|
|
342
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'
|
|
397
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'sm'` | Switch size |
|
|
343
398
|
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'solid'` | Visual style |
|
|
344
399
|
| `startDecorator` | `ReactNode` | - | Content rendered before the switch |
|
|
345
400
|
| `endDecorator` | `ReactNode` | - | Content rendered after the switch |
|
|
@@ -56,11 +56,11 @@ Textarea supports four visual variants: `solid`, `soft`, `outlined`, and `plain`
|
|
|
56
56
|
|
|
57
57
|
```tsx
|
|
58
58
|
<>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</>
|
|
59
|
+
<Textarea name="Solid" placeholder="Type in here…" variant="solid" />
|
|
60
|
+
<Textarea name="Soft" placeholder="Type in here…" variant="soft" />
|
|
61
|
+
<Textarea name="Outlined" placeholder="Type in here…" variant="outlined" />
|
|
62
|
+
<Textarea name="Plain" placeholder="Type in here…" variant="plain" />
|
|
63
|
+
</>
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
```tsx
|
|
@@ -72,14 +72,14 @@ Textarea supports four visual variants: `solid`, `soft`, `outlined`, and `plain`
|
|
|
72
72
|
|
|
73
73
|
## Sizes
|
|
74
74
|
|
|
75
|
-
Textarea comes in three sizes: `sm`, `md`, and `lg`. The default size is `
|
|
75
|
+
Textarea comes in three sizes: `sm`, `md`, and `lg`. The default size is `sm`.
|
|
76
76
|
|
|
77
77
|
```tsx
|
|
78
78
|
<>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</>
|
|
79
|
+
<Textarea size="sm" name="Size" placeholder="Small" />
|
|
80
|
+
<Textarea size="md" name="Size" placeholder="Medium" />
|
|
81
|
+
<Textarea size="lg" name="Size" placeholder="Large" />
|
|
82
|
+
</>
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
```tsx
|
|
@@ -94,11 +94,11 @@ Textarea supports semantic colors via the `color` prop: `primary`, `neutral`, `d
|
|
|
94
94
|
|
|
95
95
|
```tsx
|
|
96
96
|
<>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</>
|
|
97
|
+
<Textarea name="Primary" placeholder="Type in here…" variant="outlined" color="primary" />
|
|
98
|
+
<Textarea name="Neutral" placeholder="Type in here…" variant="outlined" color="neutral" />
|
|
99
|
+
<Textarea name="Danger" placeholder="Type in here…" variant="outlined" color="danger" />
|
|
100
|
+
<Textarea name="Warning" placeholder="Type in here…" variant="outlined" color="warning" />
|
|
101
|
+
</>
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
```tsx
|
|
@@ -123,12 +123,7 @@ Use the `required`, `label`, and `helperText` props together to build complete f
|
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
```tsx
|
|
126
|
-
<Textarea
|
|
127
|
-
label="Label"
|
|
128
|
-
helperText="I'm helper text"
|
|
129
|
-
placeholder="Type in here..."
|
|
130
|
-
required
|
|
131
|
-
/>
|
|
126
|
+
<Textarea label="Label" helperText="I'm helper text" placeholder="Type in here..." required />
|
|
132
127
|
```
|
|
133
128
|
|
|
134
129
|
## Feedback Form
|
|
@@ -274,7 +269,7 @@ function ReadOnlyNotes() {
|
|
|
274
269
|
| `placeholder` | `string` | - | Placeholder text when the textarea is empty |
|
|
275
270
|
| `disabled` | `boolean` | `false` | Disables the textarea |
|
|
276
271
|
| `required` | `boolean` | `false` | Marks the field as required |
|
|
277
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'
|
|
272
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'sm'` | Textarea size |
|
|
278
273
|
| `variant` | `'outlined' \| 'solid' \| 'soft' \| 'plain'` | `'outlined'` | Visual style variant |
|
|
279
274
|
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
280
275
|
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
@@ -75,15 +75,15 @@ Two sizes are available: `sm` and `md`. Use the smaller size for compact form la
|
|
|
75
75
|
|
|
76
76
|
```tsx
|
|
77
77
|
<Stack gap={4}>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
<Stack gap={2}>
|
|
79
|
+
<Typography level="title-sm">SM</Typography>
|
|
80
|
+
<Uploader {...args} size="sm" />
|
|
81
|
+
</Stack>
|
|
82
|
+
<Stack gap={2}>
|
|
83
|
+
<Typography level="title-sm">MD</Typography>
|
|
84
|
+
<Uploader {...args} size="md" />
|
|
85
|
+
</Stack>
|
|
81
86
|
</Stack>
|
|
82
|
-
<Stack gap={2}>
|
|
83
|
-
<Typography level="title-sm">MD</Typography>
|
|
84
|
-
<Uploader {...args} size="md" />
|
|
85
|
-
</Stack>
|
|
86
|
-
</Stack>
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
## File Type Restriction (Accepts)
|
|
@@ -103,16 +103,18 @@ The `minCount` prop sets a minimum number of required files. Validation triggers
|
|
|
103
103
|
|
|
104
104
|
```tsx
|
|
105
105
|
<>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
</
|
|
115
|
-
|
|
106
|
+
<form
|
|
107
|
+
onSubmit={(e) => {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
console.log("Submitted");
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
<Stack gap={2}>
|
|
113
|
+
<Uploader {...args} />
|
|
114
|
+
<Button type="submit">Submit</Button>
|
|
115
|
+
</Stack>
|
|
116
|
+
</form>
|
|
117
|
+
</>
|
|
116
118
|
```
|
|
117
119
|
|
|
118
120
|
## With Uploaded Files
|
|
@@ -184,15 +186,17 @@ Demonstrates automatic validation error messages for various rule violations (fi
|
|
|
184
186
|
|
|
185
187
|
```tsx
|
|
186
188
|
<Stack gap={4}>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
<Stack gap={2}>
|
|
190
|
+
<Typography level="title-sm">Try uploading files that violate validation rules:</Typography>
|
|
191
|
+
<Typography level="body-sm">
|
|
192
|
+
• Upload a file larger than 500KB (individual file size limit)
|
|
193
|
+
</Typography>
|
|
194
|
+
<Typography level="body-sm">• Upload multiple files exceeding 1MB total</Typography>
|
|
195
|
+
<Typography level="body-sm">• Upload more than 2 files</Typography>
|
|
196
|
+
<Typography level="body-sm">• Upload non-PNG/JPG files</Typography>
|
|
197
|
+
</Stack>
|
|
198
|
+
<Uploader {...args} />
|
|
193
199
|
</Stack>
|
|
194
|
-
<Uploader {...args} />
|
|
195
|
-
</Stack>
|
|
196
200
|
```
|
|
197
201
|
|
|
198
202
|
## Helper Text Variations
|
|
@@ -201,19 +205,40 @@ Comparison of auto-generated helper text, custom helper text, and error-state he
|
|
|
201
205
|
|
|
202
206
|
```tsx
|
|
203
207
|
<Stack gap={4}>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
<
|
|
208
|
+
<Stack gap={2}>
|
|
209
|
+
<Typography level="title-sm">Default Helper Text (Generated)</Typography>
|
|
210
|
+
<Uploader
|
|
211
|
+
{...args}
|
|
212
|
+
label="Default helper text"
|
|
213
|
+
accept=".png,.jpg,.pdf"
|
|
214
|
+
maxFileTotalSize={5 * 1024 * 1024}
|
|
215
|
+
maxCount={3}
|
|
216
|
+
/>
|
|
217
|
+
</Stack>
|
|
218
|
+
<Stack gap={2}>
|
|
219
|
+
<Typography level="title-sm">Custom Helper Text</Typography>
|
|
220
|
+
<Uploader
|
|
221
|
+
{...args}
|
|
222
|
+
label="Custom helper text"
|
|
223
|
+
accept=".png,.jpg,.pdf"
|
|
224
|
+
maxFileTotalSize={5 * 1024 * 1024}
|
|
225
|
+
maxCount={3}
|
|
226
|
+
helperText="Please upload your profile documents (PNG, JPG, or PDF only)"
|
|
227
|
+
/>
|
|
228
|
+
</Stack>
|
|
229
|
+
<Stack gap={2}>
|
|
230
|
+
<Typography level="title-sm">Error State with Custom Helper Text</Typography>
|
|
231
|
+
<Uploader
|
|
232
|
+
{...args}
|
|
233
|
+
label="Error state"
|
|
234
|
+
accept=".png,.jpg,.pdf"
|
|
235
|
+
maxFileTotalSize={5 * 1024 * 1024}
|
|
236
|
+
maxCount={3}
|
|
237
|
+
error={true}
|
|
238
|
+
helperText="There was an error processing your files. Please try again."
|
|
239
|
+
/>
|
|
240
|
+
</Stack>
|
|
215
241
|
</Stack>
|
|
216
|
-
</Stack>
|
|
217
242
|
```
|
|
218
243
|
|
|
219
244
|
## Disabled State
|
|
@@ -255,7 +280,11 @@ import { Uploader, Stack, Button } from '@ceed/ads';
|
|
|
255
280
|
|
|
256
281
|
function DocumentForm() {
|
|
257
282
|
return (
|
|
258
|
-
<form
|
|
283
|
+
<form
|
|
284
|
+
onSubmit={(e) => {
|
|
285
|
+
e.preventDefault();
|
|
286
|
+
}}
|
|
287
|
+
>
|
|
259
288
|
<Stack gap={3}>
|
|
260
289
|
<Uploader
|
|
261
290
|
label="Supporting Documents"
|
|
@@ -326,7 +355,7 @@ function GalleryUpload({ existingImages }) {
|
|
|
326
355
|
| `error` | `boolean` | `false` | Applies error styling |
|
|
327
356
|
| `disabled` | `boolean` | `false` | Disables the uploader |
|
|
328
357
|
| `name` | `string` | - | HTML name attribute for form submission |
|
|
329
|
-
| `size` | `'sm' \| 'md'` | `'
|
|
358
|
+
| `size` | `'sm' \| 'md'` | `'sm'` | Uploader size |
|
|
330
359
|
|
|
331
360
|
## Accessibility
|
|
332
361
|
|