@ceed/cds 1.24.1-next.3 → 1.26.0
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/chunks/rehype-accent-FZRUD7VI.js +39 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/dist/components/CurrencyInput/hooks/use-currency-setting.d.ts +2 -2
- package/dist/components/DataTable/components.d.ts +2 -1
- package/dist/components/DataTable/hooks.d.ts +1 -1
- package/dist/components/DataTable/styled.d.ts +3 -1
- package/dist/components/DataTable/types.d.ts +11 -0
- package/dist/components/DataTable/utils.d.ts +2 -2
- package/dist/components/RadioTileGroup/RadioTileGroup.d.ts +56 -0
- package/dist/components/RadioTileGroup/index.d.ts +3 -0
- package/dist/components/data-display/DataTable.md +177 -1
- package/dist/components/data-display/InfoSign.md +74 -91
- package/dist/components/data-display/Typography.md +411 -94
- package/dist/components/feedback/CircularProgress.md +257 -0
- package/dist/components/feedback/Dialog.md +76 -62
- package/dist/components/feedback/Modal.md +430 -138
- package/dist/components/feedback/Skeleton.md +280 -0
- package/dist/components/feedback/llms.txt +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/inputs/Autocomplete.md +356 -107
- package/dist/components/inputs/ButtonGroup.md +115 -104
- package/dist/components/inputs/CurrencyInput.md +183 -5
- package/dist/components/inputs/DatePicker.md +108 -431
- package/dist/components/inputs/DateRangePicker.md +131 -492
- package/dist/components/inputs/FilterableCheckboxGroup.md +145 -19
- package/dist/components/inputs/FormControl.md +361 -0
- package/dist/components/inputs/IconButton.md +137 -88
- package/dist/components/inputs/Input.md +204 -73
- package/dist/components/inputs/MonthPicker.md +95 -422
- package/dist/components/inputs/MonthRangePicker.md +89 -466
- package/dist/components/inputs/PercentageInput.md +185 -16
- package/dist/components/inputs/RadioButton.md +163 -35
- package/dist/components/inputs/RadioList.md +241 -0
- package/dist/components/inputs/RadioTileGroup.md +507 -0
- package/dist/components/inputs/Select.md +222 -326
- package/dist/components/inputs/Slider.md +334 -0
- package/dist/components/inputs/Switch.md +143 -376
- package/dist/components/inputs/Textarea.md +213 -10
- package/dist/components/inputs/Uploader/Uploader.md +145 -66
- package/dist/components/inputs/llms.txt +4 -0
- package/dist/components/navigation/Breadcrumbs.md +57 -308
- package/dist/components/navigation/Drawer.md +180 -0
- package/dist/components/navigation/Dropdown.md +98 -215
- package/dist/components/navigation/IconMenuButton.md +40 -502
- package/dist/components/navigation/InsetDrawer.md +281 -650
- package/dist/components/navigation/Link.md +31 -348
- package/dist/components/navigation/Menu.md +92 -285
- package/dist/components/navigation/MenuButton.md +55 -448
- package/dist/components/navigation/Pagination.md +47 -338
- package/dist/components/navigation/Stepper.md +160 -28
- package/dist/components/navigation/Tabs.md +57 -316
- package/dist/components/surfaces/Accordions.md +49 -804
- package/dist/components/surfaces/Card.md +97 -157
- package/dist/components/surfaces/Divider.md +83 -234
- package/dist/components/surfaces/Sheet.md +153 -328
- package/dist/guides/ThemeProvider.md +89 -0
- package/dist/guides/llms.txt +9 -0
- package/dist/index.browser.js +224 -0
- package/dist/index.browser.js.map +7 -0
- package/dist/index.cjs +726 -425
- package/dist/index.d.ts +1 -1
- package/dist/index.js +641 -396
- package/dist/llms.txt +9 -0
- package/framer/index.js +1 -163
- package/package.json +22 -17
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# RadioList
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
RadioList is a convenience component that renders a group of radio buttons from a data array. It wraps RadioGroup and Radio internally, providing a simpler API for the common pattern of rendering a list of options. Pass an array of `{ label, value }` items and the component handles the rest.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<RadioList
|
|
9
|
+
items={defaultItems}
|
|
10
|
+
defaultValue="option1"
|
|
11
|
+
/>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Field | Description | Default |
|
|
15
|
+
| ----------- | ----------- | ------- |
|
|
16
|
+
| size | — | — |
|
|
17
|
+
| color | — | — |
|
|
18
|
+
| orientation | — | — |
|
|
19
|
+
| disabled | — | — |
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { RadioList } from '@ceed/cds';
|
|
25
|
+
|
|
26
|
+
function MyComponent() {
|
|
27
|
+
return (
|
|
28
|
+
<RadioList
|
|
29
|
+
items={[
|
|
30
|
+
{ label: 'Small', value: 'sm' },
|
|
31
|
+
{ label: 'Medium', value: 'md' },
|
|
32
|
+
{ label: 'Large', value: 'lg' },
|
|
33
|
+
]}
|
|
34
|
+
defaultValue="md"
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Basic List
|
|
41
|
+
|
|
42
|
+
A simple radio list with three options and a default selection.
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<RadioList items={[{
|
|
46
|
+
label: 'Small',
|
|
47
|
+
value: 'sm'
|
|
48
|
+
}, {
|
|
49
|
+
label: 'Medium',
|
|
50
|
+
value: 'md'
|
|
51
|
+
}, {
|
|
52
|
+
label: 'Large',
|
|
53
|
+
value: 'lg'
|
|
54
|
+
}]} defaultValue="md" />
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Controlled
|
|
58
|
+
|
|
59
|
+
Use `value` and `onChange` for controlled state management.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<Stack gap={2}>
|
|
63
|
+
<Typography level="body-sm">Selected: {value}</Typography>
|
|
64
|
+
<RadioList items={defaultItems} value={value} onChange={e => setValue((e.target as HTMLInputElement).value)} />
|
|
65
|
+
</Stack>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
function ControlledExample() {
|
|
70
|
+
const [value, setValue] = React.useState('option1');
|
|
71
|
+
return (
|
|
72
|
+
<RadioList
|
|
73
|
+
items={items}
|
|
74
|
+
value={value}
|
|
75
|
+
onChange={(e) => setValue((e.target as HTMLInputElement).value)}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## With Default Value
|
|
82
|
+
|
|
83
|
+
Use `defaultValue` for uncontrolled usage with an initial selection.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<RadioList items={defaultItems} defaultValue="option2" />
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Disabled
|
|
90
|
+
|
|
91
|
+
Set `disabled` to prevent all radio buttons from being interacted with.
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<RadioList items={defaultItems} defaultValue="option1" disabled />
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Horizontal Layout
|
|
98
|
+
|
|
99
|
+
Set `orientation="horizontal"` to display options in a row.
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<RadioList items={defaultItems} defaultValue="option1" orientation="horizontal" />
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
<RadioList
|
|
107
|
+
items={items}
|
|
108
|
+
defaultValue="option1"
|
|
109
|
+
orientation="horizontal"
|
|
110
|
+
/>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Sizes
|
|
114
|
+
|
|
115
|
+
RadioList supports `sm`, `md` (default), and `lg` sizes. The size is applied to all radio buttons in the group.
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
<Stack gap={3}>
|
|
119
|
+
<Box>
|
|
120
|
+
<Typography level="body-sm" sx={{
|
|
121
|
+
mb: 1
|
|
122
|
+
}}>Small</Typography>
|
|
123
|
+
<RadioList items={defaultItems} defaultValue="option1" size="sm" />
|
|
124
|
+
</Box>
|
|
125
|
+
<Box>
|
|
126
|
+
<Typography level="body-sm" sx={{
|
|
127
|
+
mb: 1
|
|
128
|
+
}}>Medium</Typography>
|
|
129
|
+
<RadioList items={defaultItems} defaultValue="option1" size="md" />
|
|
130
|
+
</Box>
|
|
131
|
+
<Box>
|
|
132
|
+
<Typography level="body-sm" sx={{
|
|
133
|
+
mb: 1
|
|
134
|
+
}}>Large</Typography>
|
|
135
|
+
<RadioList items={defaultItems} defaultValue="option1" size="lg" />
|
|
136
|
+
</Box>
|
|
137
|
+
</Stack>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Colors
|
|
141
|
+
|
|
142
|
+
Five semantic colors are available via the `color` prop.
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
<Stack gap={3}>
|
|
146
|
+
<RadioList items={defaultItems} defaultValue="option1" color="primary" />
|
|
147
|
+
<RadioList items={defaultItems} defaultValue="option1" color="neutral" />
|
|
148
|
+
<RadioList items={defaultItems} defaultValue="option1" color="danger" />
|
|
149
|
+
<RadioList items={defaultItems} defaultValue="option1" color="success" />
|
|
150
|
+
<RadioList items={defaultItems} defaultValue="option1" color="warning" />
|
|
151
|
+
</Stack>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Common Use Cases
|
|
155
|
+
|
|
156
|
+
### Settings Selection
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
function LanguageSetting() {
|
|
160
|
+
const [language, setLanguage] = React.useState('en');
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<FormControl>
|
|
164
|
+
<FormLabel>Language</FormLabel>
|
|
165
|
+
<RadioList
|
|
166
|
+
items={[
|
|
167
|
+
{ label: 'English', value: 'en' },
|
|
168
|
+
{ label: '한국어', value: 'ko' },
|
|
169
|
+
{ label: '日本語', value: 'ja' },
|
|
170
|
+
]}
|
|
171
|
+
value={language}
|
|
172
|
+
onChange={(e) => setLanguage((e.target as HTMLInputElement).value)}
|
|
173
|
+
/>
|
|
174
|
+
</FormControl>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Survey Options
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
function SatisfactionSurvey() {
|
|
183
|
+
return (
|
|
184
|
+
<FormControl>
|
|
185
|
+
<FormLabel>How satisfied are you?</FormLabel>
|
|
186
|
+
<RadioList
|
|
187
|
+
orientation="horizontal"
|
|
188
|
+
items={[
|
|
189
|
+
{ label: 'Very Unsatisfied', value: '1' },
|
|
190
|
+
{ label: 'Unsatisfied', value: '2' },
|
|
191
|
+
{ label: 'Neutral', value: '3' },
|
|
192
|
+
{ label: 'Satisfied', value: '4' },
|
|
193
|
+
{ label: 'Very Satisfied', value: '5' },
|
|
194
|
+
]}
|
|
195
|
+
/>
|
|
196
|
+
</FormControl>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Dynamic Options from API
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
function RoleSelector({ roles }: { roles: { id: string; name: string }[] }) {
|
|
205
|
+
return (
|
|
206
|
+
<RadioList
|
|
207
|
+
items={roles.map((role) => ({
|
|
208
|
+
label: role.name,
|
|
209
|
+
value: role.id,
|
|
210
|
+
}))}
|
|
211
|
+
/>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Best Practices
|
|
217
|
+
|
|
218
|
+
1. **Use for mutually exclusive choices**: RadioList is for selecting exactly one option from a set. For multiple selections, use Checkbox or FilterableCheckboxGroup.
|
|
219
|
+
|
|
220
|
+
```tsx
|
|
221
|
+
// ✅ Mutually exclusive — only one role allowed
|
|
222
|
+
<RadioList items={roles} />
|
|
223
|
+
|
|
224
|
+
// ❌ Multiple selections needed — use Checkbox instead
|
|
225
|
+
<RadioList items={permissions} />
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
2. **Provide a default value**: Pre-select the most common or recommended option to reduce user effort.
|
|
229
|
+
|
|
230
|
+
3. **Keep labels concise**: Radio button labels should be short and scannable. Use descriptions elsewhere if more context is needed.
|
|
231
|
+
|
|
232
|
+
4. **Limit visible options**: For more than 7 options, consider using a Select dropdown instead to save space.
|
|
233
|
+
|
|
234
|
+
5. **Use horizontal layout sparingly**: Horizontal orientation works well for 2–4 short options. For longer lists, vertical is more readable.
|
|
235
|
+
|
|
236
|
+
## Accessibility
|
|
237
|
+
|
|
238
|
+
- RadioList renders a `<RadioGroup>` with `role="radiogroup"`, and each option is a `<Radio>` with `role="radio"`.
|
|
239
|
+
- Keyboard navigation: Arrow keys move between options, Space selects the focused option.
|
|
240
|
+
- Wrap in a FormControl with FormLabel to provide an accessible group label.
|
|
241
|
+
- The `disabled` prop sets `aria-disabled` on all radio buttons in the group.
|