@ceed/ads 1.13.4 → 1.15.0-next.2
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/Overview.md +11 -0
- package/dist/components/Menu/Menu.d.ts +2 -5
- package/dist/components/Stepper/Stepper.d.ts +6 -0
- package/dist/components/data-display/Avatar.md +428 -0
- package/dist/components/data-display/Badge.md +315 -0
- package/dist/components/data-display/Chip.md +301 -0
- package/dist/components/data-display/DataTable.md +452 -0
- package/dist/components/data-display/InfoSign.md +160 -0
- package/dist/components/data-display/Markdown.md +17 -0
- package/dist/components/data-display/Table.md +1330 -0
- package/dist/components/data-display/Tooltip.md +444 -0
- package/dist/components/data-display/Typography.md +271 -0
- package/dist/components/data-display/llms.txt +17 -0
- package/dist/components/feedback/Alert.md +663 -0
- package/dist/components/feedback/Dialog.md +33 -0
- package/dist/components/feedback/Modal.md +39 -0
- package/dist/components/feedback/llms.txt +11 -0
- package/dist/components/inputs/Autocomplete.md +103 -0
- package/dist/components/inputs/Button.md +334 -0
- package/dist/components/inputs/ButtonGroup.md +382 -0
- package/dist/components/inputs/Calendar.md +19 -0
- package/dist/components/inputs/Checkbox.md +649 -0
- package/dist/components/inputs/CurrencyInput.md +91 -0
- package/dist/components/inputs/DatePicker.md +67 -0
- package/dist/components/inputs/DateRangePicker.md +55 -0
- package/dist/components/inputs/FilterMenu.md +210 -0
- package/dist/components/inputs/IconButton.md +361 -0
- package/dist/components/inputs/Input.md +283 -0
- package/dist/components/inputs/MonthPicker.md +72 -0
- package/dist/components/inputs/MonthRangePicker.md +70 -0
- package/dist/components/inputs/PercentageInput.md +116 -0
- package/dist/components/inputs/RadioButton.md +350 -0
- package/dist/components/inputs/RadioTileGroup.md +418 -0
- package/dist/components/inputs/Select.md +56 -0
- package/dist/components/inputs/Switch.md +577 -0
- package/dist/components/inputs/Textarea.md +64 -0
- package/dist/components/inputs/Uploader/Uploader.md +238 -0
- package/dist/components/inputs/Uploader/llms.txt +9 -0
- package/dist/components/inputs/llms.txt +31 -0
- package/dist/components/layout/Box.md +997 -0
- package/dist/components/layout/Container.md +23 -0
- package/dist/components/layout/Grid.md +728 -0
- package/dist/components/layout/Stack.md +937 -0
- package/dist/components/layout/llms.txt +12 -0
- package/dist/components/llms.txt +14 -0
- package/dist/components/navigation/Breadcrumbs.md +51 -0
- package/dist/components/navigation/Dropdown.md +768 -0
- package/dist/components/navigation/IconMenuButton.md +35 -0
- package/dist/components/navigation/InsetDrawer.md +133 -0
- package/dist/components/navigation/Link.md +24 -0
- package/dist/components/navigation/Menu.md +957 -0
- package/dist/components/navigation/MenuButton.md +39 -0
- package/dist/components/navigation/NavigationGroup.md +17 -0
- package/dist/components/navigation/NavigationItem.md +17 -0
- package/dist/components/navigation/Navigator.md +17 -0
- package/dist/components/navigation/Pagination.md +17 -0
- package/dist/components/navigation/ProfileMenu.md +34 -0
- package/dist/components/navigation/Stepper.md +108 -0
- package/dist/components/navigation/Tabs.md +34 -0
- package/dist/components/navigation/llms.txt +22 -0
- package/dist/components/surfaces/Accordions.md +96 -0
- package/dist/components/surfaces/Card.md +786 -0
- package/dist/components/surfaces/Divider.md +762 -0
- package/dist/components/surfaces/Sheet.md +900 -0
- package/dist/components/surfaces/llms.txt +12 -0
- package/dist/index.cjs +22 -10
- package/dist/index.js +22 -10
- package/dist/llms.txt +75 -0
- package/framer/index.js +36 -36
- package/package.json +8 -4
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# MonthRangePicker
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<MonthRangePicker />
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
| Field | Description | Default |
|
|
10
|
+
| ------------- | ----------- | ------- |
|
|
11
|
+
| value | — | — |
|
|
12
|
+
| defaultValue | — | — |
|
|
13
|
+
| name | — | — |
|
|
14
|
+
| disabled | — | — |
|
|
15
|
+
| required | — | — |
|
|
16
|
+
| label | — | — |
|
|
17
|
+
| error | — | — |
|
|
18
|
+
| helperText | — | — |
|
|
19
|
+
| minDate | — | — |
|
|
20
|
+
| maxDate | — | — |
|
|
21
|
+
| disableFuture | — | — |
|
|
22
|
+
| disablePast | — | — |
|
|
23
|
+
| format | — | — |
|
|
24
|
+
| onChange | — | — |
|
|
25
|
+
|
|
26
|
+
### Sizes
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
<Stack gap={2}>
|
|
30
|
+
<MonthRangePicker size="sm" />
|
|
31
|
+
<MonthRangePicker size="md" />
|
|
32
|
+
<MonthRangePicker size="lg" />
|
|
33
|
+
</Stack>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### WithLabel
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
<MonthRangePicker label="Month Range" />
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### WithHelperText
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<MonthRangePicker
|
|
46
|
+
label="Month"
|
|
47
|
+
helperText="Please select a month"
|
|
48
|
+
/>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Error
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
<MonthRangePicker
|
|
55
|
+
label="Month"
|
|
56
|
+
helperText="Please select a month"
|
|
57
|
+
error
|
|
58
|
+
/>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### WithFormats
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<Stack gap={2}>
|
|
65
|
+
<MonthRangePicker {...args} value={value['YYYY.MM']} label="YYYY.MM" name="YYYY.MM" format="YYYY.MM" onChange={handleChange} />
|
|
66
|
+
<MonthRangePicker {...args} value={value['YYYY/MM']} label="YYYY/MM" name="YYYY/MM" format="YYYY/MM" onChange={handleChange} />
|
|
67
|
+
<MonthRangePicker {...args} value={value['MM/YYYY']} label="MM/YYYY" name="MM/YYYY" format="MM/YYYY" onChange={handleChange} />
|
|
68
|
+
<MonthRangePicker {...args} value={value['YYYY-MM']} label="YYYY-MM" name="YYYY-MM" format="YYYY-MM" onChange={handleChange} />
|
|
69
|
+
</Stack>
|
|
70
|
+
```
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# PercentageInput
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<PercentageInput placeholder="Enter a percentage" />
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
| Field | Description | Default |
|
|
10
|
+
| --------------- | ----------- | ------- |
|
|
11
|
+
| value | — | — |
|
|
12
|
+
| defaultValue | — | — |
|
|
13
|
+
| onChange | — | — |
|
|
14
|
+
| name | — | — |
|
|
15
|
+
| label | — | — |
|
|
16
|
+
| disabled | — | — |
|
|
17
|
+
| required | — | — |
|
|
18
|
+
| error | — | — |
|
|
19
|
+
| helperText | — | — |
|
|
20
|
+
| useMinorUnit | — | — |
|
|
21
|
+
| maxDecimalScale | — | — |
|
|
22
|
+
| min | — | — |
|
|
23
|
+
| max | — | — |
|
|
24
|
+
|
|
25
|
+
### Sizes
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
<Stack gap={2}>
|
|
29
|
+
<PercentageInput size="sm" label="Small" />
|
|
30
|
+
<PercentageInput size="md" label="Medium" />
|
|
31
|
+
<PercentageInput size="lg" label="Large" />
|
|
32
|
+
</Stack>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Disabled
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<PercentageInput
|
|
39
|
+
placeholder="Enter a percentage"
|
|
40
|
+
disabled
|
|
41
|
+
/>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Error
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<PercentageInput
|
|
48
|
+
placeholder="Enter a percentage"
|
|
49
|
+
error
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### WithLabel
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
<PercentageInput
|
|
57
|
+
placeholder="Enter a percentage"
|
|
58
|
+
label="Percentage Input"
|
|
59
|
+
/>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### WithHelperText
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<PercentageInput
|
|
66
|
+
placeholder="Enter a percentage"
|
|
67
|
+
label="Percentage Input"
|
|
68
|
+
helperText="Please enter a percentage"
|
|
69
|
+
/>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### WithErrorText
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
<PercentageInput
|
|
76
|
+
placeholder="Enter a percentage"
|
|
77
|
+
label="Percentage Input"
|
|
78
|
+
helperText="Please enter a percentage"
|
|
79
|
+
error
|
|
80
|
+
/>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Required
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<PercentageInput
|
|
87
|
+
placeholder="Enter a percentage"
|
|
88
|
+
label="Percentage Input"
|
|
89
|
+
helperText="Please enter a percentage"
|
|
90
|
+
required
|
|
91
|
+
/>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Min
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
<PercentageInput
|
|
98
|
+
placeholder="Enter a percentage"
|
|
99
|
+
label="Percentage Input"
|
|
100
|
+
helperText="Please enter a percentage"
|
|
101
|
+
min={10}
|
|
102
|
+
defaultValue={5}
|
|
103
|
+
/>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Max
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
<PercentageInput
|
|
110
|
+
placeholder="Enter a percentage"
|
|
111
|
+
label="Percentage Input"
|
|
112
|
+
helperText="Please enter a percentage"
|
|
113
|
+
max={500}
|
|
114
|
+
defaultValue={5000}
|
|
115
|
+
/>
|
|
116
|
+
```
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# Radio
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
Radio 컴포넌트는 사용자가 여러 옵션 중 하나만 선택할 수 있는 단일 선택 인터페이스를 제공합니다. 라디오 버튼은 그룹으로 사용되어야 하며, 하나가 선택되면 다른 옵션들은 자동으로 해제됩니다.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Radio />
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| Field | Description | Default |
|
|
12
|
+
| ------------- | ----------- | ------- |
|
|
13
|
+
| checked | — | — |
|
|
14
|
+
| color | — | — |
|
|
15
|
+
| checkedIcon | — | — |
|
|
16
|
+
| disabled | — | — |
|
|
17
|
+
| disableIcon | — | — |
|
|
18
|
+
| label | — | — |
|
|
19
|
+
| name | — | — |
|
|
20
|
+
| onChange | — | — |
|
|
21
|
+
| overlay | — | — |
|
|
22
|
+
| readOnly | — | — |
|
|
23
|
+
| required | — | — |
|
|
24
|
+
| size | — | — |
|
|
25
|
+
| uncheckedIcon | — | — |
|
|
26
|
+
| variant | — | — |
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { Radio } from '@ceed/ads';
|
|
32
|
+
|
|
33
|
+
function MyComponent() {
|
|
34
|
+
const [selectedValue, setSelectedValue] = useState('option1');
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div>
|
|
38
|
+
<Radio
|
|
39
|
+
name="example"
|
|
40
|
+
value="option1"
|
|
41
|
+
checked={selectedValue === 'option1'}
|
|
42
|
+
onChange={(e) => setSelectedValue(e.target.value)}
|
|
43
|
+
label="옵션 1"
|
|
44
|
+
/>
|
|
45
|
+
<Radio
|
|
46
|
+
name="example"
|
|
47
|
+
value="option2"
|
|
48
|
+
checked={selectedValue === 'option2'}
|
|
49
|
+
onChange={(e) => setSelectedValue(e.target.value)}
|
|
50
|
+
label="옵션 2"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Examples
|
|
58
|
+
|
|
59
|
+
### Variants
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<FormControl>
|
|
63
|
+
<FormLabel>Variants</FormLabel>
|
|
64
|
+
<RadioGroup defaultValue="outlined" name="radio-buttons-group">
|
|
65
|
+
<Radio value="outlined" label="Outlined" variant="outlined" />
|
|
66
|
+
<Radio value="soft" label="Soft" variant="soft" />
|
|
67
|
+
<Radio value="solid" label="Solid" variant="solid" />
|
|
68
|
+
<Radio value="plain" label="Plain" variant="plain" />
|
|
69
|
+
</RadioGroup>
|
|
70
|
+
</FormControl>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Sizes
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<FormControl>
|
|
77
|
+
<FormLabel>Sizes</FormLabel>
|
|
78
|
+
<RadioGroup defaultValue="medium" name="radio-buttons-group">
|
|
79
|
+
<Radio value="small" label="Small" size="sm" />
|
|
80
|
+
<Radio value="medium" label="Medium" size="md" />
|
|
81
|
+
<Radio value="large" label="Large" size="lg" />
|
|
82
|
+
</RadioGroup>
|
|
83
|
+
</FormControl>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Colors
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<FormControl>
|
|
90
|
+
<FormLabel>Colors</FormLabel>
|
|
91
|
+
<RadioGroup defaultValue="medium" name="radio-buttons-group">
|
|
92
|
+
<Radio value="primary" label="Primary" color="primary" />
|
|
93
|
+
<Radio value="neutral" label="Neutral" color="neutral" />
|
|
94
|
+
<Radio value="danger" label="Danger" color="danger" />
|
|
95
|
+
<Radio value="success" label="Success" color="success" />
|
|
96
|
+
<Radio value="warning" label="Warning" color="warning" />
|
|
97
|
+
</RadioGroup>
|
|
98
|
+
</FormControl>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Custom Icons
|
|
102
|
+
|
|
103
|
+
아이콘을 커스터마이징하여 특별한 용도로 사용할 수 있습니다.
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
<RadioGroup aria-label="platform" defaultValue="Website" overlay name="platform" sx={{
|
|
107
|
+
flexDirection: 'row',
|
|
108
|
+
gap: 2,
|
|
109
|
+
[`& .${radioClasses.checked}`]: {
|
|
110
|
+
[`& .${radioClasses.action}`]: {
|
|
111
|
+
inset: -1,
|
|
112
|
+
border: '3px solid',
|
|
113
|
+
borderColor: 'primary.500'
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
[`& .${radioClasses.radio}`]: {
|
|
117
|
+
display: 'contents',
|
|
118
|
+
'& > svg': {
|
|
119
|
+
zIndex: 2,
|
|
120
|
+
position: 'absolute',
|
|
121
|
+
top: '-8px',
|
|
122
|
+
right: '-8px',
|
|
123
|
+
bgcolor: 'background.surface',
|
|
124
|
+
borderRadius: '50%'
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}}>
|
|
128
|
+
{['Website', 'Documents', 'Social Account'].map(value => <Sheet key={value} variant="outlined" sx={{
|
|
129
|
+
borderRadius: 'md',
|
|
130
|
+
boxShadow: 'sm',
|
|
131
|
+
display: 'flex',
|
|
132
|
+
flexDirection: 'column',
|
|
133
|
+
alignItems: 'center',
|
|
134
|
+
gap: 1.5,
|
|
135
|
+
p: 2,
|
|
136
|
+
minWidth: 120
|
|
137
|
+
}}>
|
|
138
|
+
<Radio id={value} value={value} checkedIcon={<CheckCircleRoundedIcon />} />
|
|
139
|
+
<Avatar variant="soft" size="sm" />
|
|
140
|
+
<FormLabel htmlFor={value}>{value}</FormLabel>
|
|
141
|
+
</Sheet>)}
|
|
142
|
+
</RadioGroup>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### No Icon
|
|
146
|
+
|
|
147
|
+
아이콘 없이 텍스트만으로 구성할 수 있습니다.
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<Box sx={{
|
|
151
|
+
width: 300
|
|
152
|
+
}}>
|
|
153
|
+
<FormLabel id="storage-label" sx={{
|
|
154
|
+
mb: 2,
|
|
155
|
+
fontWeight: 'xl',
|
|
156
|
+
fontSize: 'xs',
|
|
157
|
+
letterSpacing: '0.15rem'
|
|
158
|
+
}}>
|
|
159
|
+
Storage
|
|
160
|
+
</FormLabel>
|
|
161
|
+
<RadioGroup aria-labelledby="storage-label" defaultValue="512GB" size="lg" sx={{
|
|
162
|
+
gap: 1.5
|
|
163
|
+
}}>
|
|
164
|
+
{['512GB', '1TB', '2TB'].map(value => <Sheet key={value} sx={{
|
|
165
|
+
p: 2,
|
|
166
|
+
borderRadius: 'md',
|
|
167
|
+
boxShadow: 'sm'
|
|
168
|
+
}}>
|
|
169
|
+
<Radio label={`${value} SSD storage`} overlay disableIcon value={value} slotProps={{
|
|
170
|
+
label: ({
|
|
171
|
+
checked
|
|
172
|
+
}) => ({
|
|
173
|
+
sx: {
|
|
174
|
+
fontWeight: 'lg',
|
|
175
|
+
fontSize: 'md',
|
|
176
|
+
color: checked ? 'text.primary' : 'text.secondary'
|
|
177
|
+
}
|
|
178
|
+
}),
|
|
179
|
+
action: ({
|
|
180
|
+
checked
|
|
181
|
+
}) => ({
|
|
182
|
+
sx: theme => ({
|
|
183
|
+
...(checked && {
|
|
184
|
+
'--variant-borderWidth': '2px',
|
|
185
|
+
'&&': {
|
|
186
|
+
// && to increase the specificity to win the base :hover styles
|
|
187
|
+
borderColor: theme.vars.palette.primary[500]
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
})
|
|
191
|
+
})
|
|
192
|
+
}} />
|
|
193
|
+
</Sheet>)}
|
|
194
|
+
</RadioGroup>
|
|
195
|
+
</Box>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Segmented Controls
|
|
199
|
+
|
|
200
|
+
세그먼트 컨트롤 스타일로 사용할 수 있습니다.
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
<Box sx={{
|
|
204
|
+
display: 'flex',
|
|
205
|
+
alignItems: 'center',
|
|
206
|
+
gap: 2
|
|
207
|
+
}}>
|
|
208
|
+
<Typography id="segmented-controls-example" fontWeight="lg" fontSize="sm">
|
|
209
|
+
Justify:
|
|
210
|
+
</Typography>
|
|
211
|
+
<RadioGroup orientation="horizontal" aria-labelledby="segmented-controls-example" name="justify" value={justify} onChange={(event: React.ChangeEvent<HTMLInputElement>) => setJustify(event.target.value)} sx={{
|
|
212
|
+
minHeight: 48,
|
|
213
|
+
padding: '4px',
|
|
214
|
+
borderRadius: '12px',
|
|
215
|
+
bgcolor: 'neutral.softBg',
|
|
216
|
+
'--RadioGroup-gap': '4px',
|
|
217
|
+
'--Radio-actionRadius': '8px'
|
|
218
|
+
}}>
|
|
219
|
+
{['flex-start', 'center', 'flex-end'].map(item => <Radio key={item} color="neutral" value={item} disableIcon label={item} variant="plain" sx={{
|
|
220
|
+
px: 2,
|
|
221
|
+
alignItems: 'center'
|
|
222
|
+
}} slotProps={{
|
|
223
|
+
action: ({
|
|
224
|
+
checked
|
|
225
|
+
}) => ({
|
|
226
|
+
sx: {
|
|
227
|
+
...(checked && {
|
|
228
|
+
bgcolor: 'background.surface',
|
|
229
|
+
boxShadow: 'sm',
|
|
230
|
+
'&:hover': {
|
|
231
|
+
bgcolor: 'background.surface'
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
}} />)}
|
|
237
|
+
</RadioGroup>
|
|
238
|
+
</Box>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Product Attributes
|
|
242
|
+
|
|
243
|
+
제품 속성 선택 등의 용도로 활용할 수 있습니다.
|
|
244
|
+
|
|
245
|
+
```tsx
|
|
246
|
+
<Box sx={{
|
|
247
|
+
overflow: 'auto',
|
|
248
|
+
px: 2
|
|
249
|
+
}}>
|
|
250
|
+
<FormLabel id="product-color-attribute" sx={{
|
|
251
|
+
mb: 1.5,
|
|
252
|
+
fontWeight: 'xl',
|
|
253
|
+
textTransform: 'uppercase',
|
|
254
|
+
fontSize: 'xs',
|
|
255
|
+
letterSpacing: '0.1em'
|
|
256
|
+
}}>
|
|
257
|
+
Color
|
|
258
|
+
</FormLabel>
|
|
259
|
+
<RadioGroup aria-labelledby="product-color-attribute" defaultValue="warning" sx={{
|
|
260
|
+
gap: 2,
|
|
261
|
+
flexWrap: 'wrap',
|
|
262
|
+
flexDirection: 'row'
|
|
263
|
+
}}>
|
|
264
|
+
{(['primary', 'neutral', 'danger', 'success', 'warning'] as const).map(color => <Sheet key={color} sx={{
|
|
265
|
+
position: 'relative',
|
|
266
|
+
width: 40,
|
|
267
|
+
height: 40,
|
|
268
|
+
flexShrink: 0,
|
|
269
|
+
bgcolor: `${color}.solidBg`,
|
|
270
|
+
borderRadius: '50%',
|
|
271
|
+
display: 'flex',
|
|
272
|
+
alignItems: 'center',
|
|
273
|
+
justifyContent: 'center'
|
|
274
|
+
}}>
|
|
275
|
+
<Radio overlay variant="solid" color={color} checkedIcon={<Done fontSize="large" />} value={color} slotProps={{
|
|
276
|
+
input: {
|
|
277
|
+
'aria-label': color
|
|
278
|
+
},
|
|
279
|
+
radio: {
|
|
280
|
+
sx: {
|
|
281
|
+
display: 'contents',
|
|
282
|
+
'--variant-borderWidth': '2px'
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}} sx={{
|
|
286
|
+
'--joy-focus-outlineOffset': '4px',
|
|
287
|
+
'--joy-palette-focusVisible': theme => theme.vars.palette[color][500],
|
|
288
|
+
[`& .${radioClasses.action}.${radioClasses.focusVisible}`]: {
|
|
289
|
+
outlineWidth: '2px'
|
|
290
|
+
}
|
|
291
|
+
}} />
|
|
292
|
+
</Sheet>)}
|
|
293
|
+
</RadioGroup>
|
|
294
|
+
<br />
|
|
295
|
+
<FormLabel id="product-size-attribute" sx={{
|
|
296
|
+
mb: 1.5,
|
|
297
|
+
fontWeight: 'xl',
|
|
298
|
+
textTransform: 'uppercase',
|
|
299
|
+
fontSize: 'xs',
|
|
300
|
+
letterSpacing: '0.1em'
|
|
301
|
+
}}>
|
|
302
|
+
Size
|
|
303
|
+
</FormLabel>
|
|
304
|
+
<RadioGroup aria-labelledby="product-size-attribute" defaultValue="M" sx={{
|
|
305
|
+
gap: 2,
|
|
306
|
+
mb: 2,
|
|
307
|
+
flexWrap: 'wrap',
|
|
308
|
+
flexDirection: 'row'
|
|
309
|
+
}}>
|
|
310
|
+
{['XS', 'S', 'M', 'L', 'XL'].map(size => <Sheet key={size} sx={{
|
|
311
|
+
position: 'relative',
|
|
312
|
+
width: 40,
|
|
313
|
+
height: 40,
|
|
314
|
+
flexShrink: 0,
|
|
315
|
+
borderRadius: '50%',
|
|
316
|
+
display: 'flex',
|
|
317
|
+
alignItems: 'center',
|
|
318
|
+
justifyContent: 'center',
|
|
319
|
+
'--joy-focus-outlineOffset': '4px',
|
|
320
|
+
'--joy-palette-focusVisible': theme => theme.vars.palette.neutral.outlinedBorder,
|
|
321
|
+
[`& .${radioClasses.checked}`]: {
|
|
322
|
+
[`& .${radioClasses.label}`]: {
|
|
323
|
+
fontWeight: 'lg'
|
|
324
|
+
},
|
|
325
|
+
[`& .${radioClasses.action}`]: {
|
|
326
|
+
'--variant-borderWidth': '2px',
|
|
327
|
+
borderColor: 'text.secondary'
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
[`& .${radioClasses.action}.${radioClasses.focusVisible}`]: {
|
|
331
|
+
outlineWidth: '2px'
|
|
332
|
+
}
|
|
333
|
+
}}>
|
|
334
|
+
<Radio color="neutral" overlay disableIcon value={size} label={size} />
|
|
335
|
+
</Sheet>)}
|
|
336
|
+
</RadioGroup>
|
|
337
|
+
</Box>
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## Best Practices
|
|
341
|
+
|
|
342
|
+
1. **그룹 사용**: Radio 버튼들은 반드시 동일한 `name` 속성을 가진 그룹으로 사용해야 합니다.
|
|
343
|
+
|
|
344
|
+
2. **레이블 제공**: 접근성을 위해 항상 의미 있는 `label`을 제공하세요.
|
|
345
|
+
|
|
346
|
+
3. **초기값 설정**: 사용자 경험을 위해 적절한 초기값을 설정하는 것이 좋습니다.
|
|
347
|
+
|
|
348
|
+
4. **적절한 간격**: 여러 라디오 버튼 간에는 충분한 간격을 두어 선택하기 쉽게 만드세요.
|
|
349
|
+
|
|
350
|
+
5. **상태 관리**: 제어 컴포넌트로 사용하여 상태를 명확히 관리하세요.
|