@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,361 @@
|
|
|
1
|
+
# IconButton
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
IconButton 컴포넌트는 아이콘만으로 구성된 버튼입니다. 공간 효율적이며, 직관적인 액션을 제공하는 UI 요소로 주로 툴바, 헤더, 카드 등에서 사용됩니다. 텍스트 없이도 의미를 전달할 수 있는 명확한 아이콘과 함께 사용하세요.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<IconButton {...args} />
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| Field | Description | Default |
|
|
12
|
+
| -------- | ----------- | --------- |
|
|
13
|
+
| children | 아이콘 요소 | \<Add /> |
|
|
14
|
+
| color | 버튼 색상 | "primary" |
|
|
15
|
+
| variant | 버튼 스타일 변형 | "solid" |
|
|
16
|
+
| size | 버튼 크기 | "md" |
|
|
17
|
+
| disabled | 비활성화 상태 | — |
|
|
18
|
+
| loading | 로딩 상태 | — |
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { IconButton } from '@ceed/ads';
|
|
24
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
25
|
+
|
|
26
|
+
function MyComponent() {
|
|
27
|
+
return (
|
|
28
|
+
<div>
|
|
29
|
+
<IconButton onClick={() => console.log('clicked')}>
|
|
30
|
+
<AddIcon />
|
|
31
|
+
</IconButton>
|
|
32
|
+
|
|
33
|
+
<IconButton color="danger" onClick={() => console.log('delete')}>
|
|
34
|
+
<DeleteIcon />
|
|
35
|
+
</IconButton>
|
|
36
|
+
|
|
37
|
+
<IconButton disabled>
|
|
38
|
+
<EditIcon />
|
|
39
|
+
</IconButton>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
### Basic Usage
|
|
48
|
+
|
|
49
|
+
기본적인 IconButton 사용법입니다.
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
<div style={{
|
|
53
|
+
display: 'flex',
|
|
54
|
+
gap: '1rem',
|
|
55
|
+
alignItems: 'center'
|
|
56
|
+
}}>
|
|
57
|
+
<IconButton>
|
|
58
|
+
<Add />
|
|
59
|
+
</IconButton>
|
|
60
|
+
<IconButton>
|
|
61
|
+
<Edit />
|
|
62
|
+
</IconButton>
|
|
63
|
+
<IconButton>
|
|
64
|
+
<Delete />
|
|
65
|
+
</IconButton>
|
|
66
|
+
<IconButton>
|
|
67
|
+
<Settings />
|
|
68
|
+
</IconButton>
|
|
69
|
+
</div>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Colors
|
|
73
|
+
|
|
74
|
+
다양한 색상을 적용할 수 있습니다.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
<div style={{
|
|
78
|
+
display: 'flex',
|
|
79
|
+
gap: '1rem',
|
|
80
|
+
alignItems: 'center'
|
|
81
|
+
}}>
|
|
82
|
+
<IconButton color="primary">
|
|
83
|
+
<Add />
|
|
84
|
+
</IconButton>
|
|
85
|
+
<IconButton color="neutral">
|
|
86
|
+
<Edit />
|
|
87
|
+
</IconButton>
|
|
88
|
+
<IconButton color="danger">
|
|
89
|
+
<Delete />
|
|
90
|
+
</IconButton>
|
|
91
|
+
<IconButton color="success">
|
|
92
|
+
<FavoriteIcon />
|
|
93
|
+
</IconButton>
|
|
94
|
+
<IconButton color="warning">
|
|
95
|
+
<Settings />
|
|
96
|
+
</IconButton>
|
|
97
|
+
</div>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Variants
|
|
101
|
+
|
|
102
|
+
다양한 스타일 변형을 제공합니다.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
<div style={{
|
|
106
|
+
display: 'flex',
|
|
107
|
+
gap: '1rem',
|
|
108
|
+
alignItems: 'center'
|
|
109
|
+
}}>
|
|
110
|
+
<IconButton variant="solid">
|
|
111
|
+
<Add />
|
|
112
|
+
</IconButton>
|
|
113
|
+
<IconButton variant="soft">
|
|
114
|
+
<Add />
|
|
115
|
+
</IconButton>
|
|
116
|
+
<IconButton variant="outlined">
|
|
117
|
+
<Add />
|
|
118
|
+
</IconButton>
|
|
119
|
+
<IconButton variant="plain">
|
|
120
|
+
<Add />
|
|
121
|
+
</IconButton>
|
|
122
|
+
</div>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Sizes
|
|
126
|
+
|
|
127
|
+
크기를 조절할 수 있습니다.
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
<div style={{
|
|
131
|
+
display: 'flex',
|
|
132
|
+
gap: '1rem',
|
|
133
|
+
alignItems: 'center'
|
|
134
|
+
}}>
|
|
135
|
+
<IconButton size="sm">
|
|
136
|
+
<Add />
|
|
137
|
+
</IconButton>
|
|
138
|
+
<IconButton size="md">
|
|
139
|
+
<Add />
|
|
140
|
+
</IconButton>
|
|
141
|
+
<IconButton size="lg">
|
|
142
|
+
<Add />
|
|
143
|
+
</IconButton>
|
|
144
|
+
</div>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### States
|
|
148
|
+
|
|
149
|
+
다양한 상태를 표현할 수 있습니다.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
<div style={{
|
|
153
|
+
display: 'flex',
|
|
154
|
+
gap: '2rem',
|
|
155
|
+
alignItems: 'center'
|
|
156
|
+
}}>
|
|
157
|
+
<div>
|
|
158
|
+
<h4>Normal</h4>
|
|
159
|
+
<div style={{
|
|
160
|
+
display: 'flex',
|
|
161
|
+
gap: '1rem',
|
|
162
|
+
alignItems: 'center'
|
|
163
|
+
}}>
|
|
164
|
+
<IconButton>
|
|
165
|
+
<Add />
|
|
166
|
+
</IconButton>
|
|
167
|
+
<IconButton color="danger">
|
|
168
|
+
<Delete />
|
|
169
|
+
</IconButton>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
<div>
|
|
173
|
+
<h4>Disabled</h4>
|
|
174
|
+
<div style={{
|
|
175
|
+
display: 'flex',
|
|
176
|
+
gap: '1rem',
|
|
177
|
+
alignItems: 'center'
|
|
178
|
+
}}>
|
|
179
|
+
<IconButton disabled>
|
|
180
|
+
<Add />
|
|
181
|
+
</IconButton>
|
|
182
|
+
<IconButton disabled color="danger">
|
|
183
|
+
<Delete />
|
|
184
|
+
</IconButton>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
<div>
|
|
188
|
+
<h4>Loading</h4>
|
|
189
|
+
<div style={{
|
|
190
|
+
display: 'flex',
|
|
191
|
+
gap: '1rem',
|
|
192
|
+
alignItems: 'center'
|
|
193
|
+
}}>
|
|
194
|
+
<IconButton loading>
|
|
195
|
+
<Add />
|
|
196
|
+
</IconButton>
|
|
197
|
+
<IconButton loading color="danger">
|
|
198
|
+
<Delete />
|
|
199
|
+
</IconButton>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### With Badge
|
|
206
|
+
|
|
207
|
+
Badge와 함께 사용하여 알림 수나 상태를 표시할 수 있습니다.
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
<div style={{
|
|
211
|
+
display: 'flex',
|
|
212
|
+
gap: '1rem',
|
|
213
|
+
alignItems: 'center'
|
|
214
|
+
}}>
|
|
215
|
+
<Badge badgeContent={4} color="danger">
|
|
216
|
+
<IconButton>
|
|
217
|
+
<Settings />
|
|
218
|
+
</IconButton>
|
|
219
|
+
</Badge>
|
|
220
|
+
<Badge badgeContent="99+" color="warning">
|
|
221
|
+
<IconButton color="neutral">
|
|
222
|
+
<MoreVertIcon />
|
|
223
|
+
</IconButton>
|
|
224
|
+
</Badge>
|
|
225
|
+
<Badge variant="solid" color="success">
|
|
226
|
+
<IconButton color="primary">
|
|
227
|
+
<FavoriteIcon />
|
|
228
|
+
</IconButton>
|
|
229
|
+
</Badge>
|
|
230
|
+
</div>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### With Tooltip
|
|
234
|
+
|
|
235
|
+
Tooltip과 함께 사용하여 버튼의 기능을 설명할 수 있습니다.
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
<div style={{
|
|
239
|
+
display: 'flex',
|
|
240
|
+
gap: '1rem',
|
|
241
|
+
alignItems: 'center'
|
|
242
|
+
}}>
|
|
243
|
+
<Tooltip title="새 항목 추가">
|
|
244
|
+
<IconButton>
|
|
245
|
+
<Add />
|
|
246
|
+
</IconButton>
|
|
247
|
+
</Tooltip>
|
|
248
|
+
<Tooltip title="편집">
|
|
249
|
+
<IconButton color="neutral">
|
|
250
|
+
<Edit />
|
|
251
|
+
</IconButton>
|
|
252
|
+
</Tooltip>
|
|
253
|
+
<Tooltip title="삭제">
|
|
254
|
+
<IconButton color="danger">
|
|
255
|
+
<Delete />
|
|
256
|
+
</IconButton>
|
|
257
|
+
</Tooltip>
|
|
258
|
+
<Tooltip title="공유">
|
|
259
|
+
<IconButton color="success">
|
|
260
|
+
<ShareIcon />
|
|
261
|
+
</IconButton>
|
|
262
|
+
</Tooltip>
|
|
263
|
+
</div>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Action Buttons
|
|
267
|
+
|
|
268
|
+
실제 액션을 수행하는 버튼들의 예제입니다.
|
|
269
|
+
|
|
270
|
+
```tsx
|
|
271
|
+
<div style={{
|
|
272
|
+
display: 'flex',
|
|
273
|
+
gap: '1rem',
|
|
274
|
+
alignItems: 'center'
|
|
275
|
+
}}>
|
|
276
|
+
<IconButton onClick={() => alert('Add clicked!')} title="Add new item">
|
|
277
|
+
<Add />
|
|
278
|
+
</IconButton>
|
|
279
|
+
<IconButton onClick={() => alert('Edit clicked!')} color="neutral" title="Edit item">
|
|
280
|
+
<Edit />
|
|
281
|
+
</IconButton>
|
|
282
|
+
<IconButton onClick={() => alert('Delete clicked!')} color="danger" title="Delete item">
|
|
283
|
+
<Delete />
|
|
284
|
+
</IconButton>
|
|
285
|
+
<IconButton onClick={() => alert('Share clicked!')} color="success" title="Share item">
|
|
286
|
+
<ShareIcon />
|
|
287
|
+
</IconButton>
|
|
288
|
+
<IconButton onClick={() => alert('Settings clicked!')} color="neutral" variant="outlined" title="Settings">
|
|
289
|
+
<Settings />
|
|
290
|
+
</IconButton>
|
|
291
|
+
</div>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## Common Use Cases
|
|
295
|
+
|
|
296
|
+
### Toolbar Actions
|
|
297
|
+
|
|
298
|
+
```tsx
|
|
299
|
+
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
|
300
|
+
<IconButton onClick={handleAdd} title="Add item">
|
|
301
|
+
<AddIcon />
|
|
302
|
+
</IconButton>
|
|
303
|
+
<IconButton onClick={handleEdit} color="neutral" title="Edit">
|
|
304
|
+
<EditIcon />
|
|
305
|
+
</IconButton>
|
|
306
|
+
<IconButton onClick={handleDelete} color="danger" title="Delete">
|
|
307
|
+
<DeleteIcon />
|
|
308
|
+
</IconButton>
|
|
309
|
+
</div>
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Navigation
|
|
313
|
+
|
|
314
|
+
```tsx
|
|
315
|
+
<IconButton onClick={() => router.back()} variant="outlined">
|
|
316
|
+
<ArrowBackIcon />
|
|
317
|
+
</IconButton>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Settings & More Options
|
|
321
|
+
|
|
322
|
+
```tsx
|
|
323
|
+
<IconButton onClick={handleSettings} color="neutral">
|
|
324
|
+
<SettingsIcon />
|
|
325
|
+
</IconButton>
|
|
326
|
+
<IconButton onClick={handleMoreOptions}>
|
|
327
|
+
<MoreVertIcon />
|
|
328
|
+
</IconButton>
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Social Actions
|
|
332
|
+
|
|
333
|
+
```tsx
|
|
334
|
+
<IconButton onClick={handleLike} color="danger">
|
|
335
|
+
<FavoriteIcon />
|
|
336
|
+
</IconButton>
|
|
337
|
+
<IconButton onClick={handleShare} color="primary">
|
|
338
|
+
<ShareIcon />
|
|
339
|
+
</IconButton>
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Best Practices
|
|
343
|
+
|
|
344
|
+
1. **명확한 아이콘**: 사용자가 쉽게 이해할 수 있는 명확하고 직관적인 아이콘을 사용하세요.
|
|
345
|
+
|
|
346
|
+
2. **적절한 크기**: 터치 인터페이스를 고려하여 최소 44px 이상의 터치 영역을 확보하세요.
|
|
347
|
+
|
|
348
|
+
3. **접근성**:
|
|
349
|
+
- `title` 속성이나 `aria-label`을 제공하여 스크린 리더 사용자를 위한 설명을 추가하세요.
|
|
350
|
+
- Tooltip과 함께 사용하여 기능을 명확히 설명하세요.
|
|
351
|
+
|
|
352
|
+
4. **일관된 스타일**: 같은 맥락에서는 일관된 variant와 색상을 사용하세요.
|
|
353
|
+
|
|
354
|
+
5. **의미 있는 색상**:
|
|
355
|
+
- 빨간색(danger): 삭제, 취소 등의 위험한 액션
|
|
356
|
+
- 초록색(success): 저장, 승인 등의 긍정적인 액션
|
|
357
|
+
- 회색(neutral): 일반적인 액션
|
|
358
|
+
|
|
359
|
+
6. **피드백 제공**: 클릭 시 명확한 피드백을 제공하여 사용자가 액션이 실행되었음을 알 수 있도록 하세요.
|
|
360
|
+
|
|
361
|
+
7. **로딩 상태**: 비동기 작업 시 `loading` prop을 사용하여 사용자에게 진행 상황을 알려주세요.
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# Input
|
|
2
|
+
|
|
3
|
+
Input 컴포넌트는 사용자로부터 텍스트 입력을 받기 위한 기본 컴포넌트입니다. 다양한 스타일, 크기 및 기능을 지원합니다.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<Input />
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
| Field | Description | Default |
|
|
10
|
+
| --------------------------- | ----------- | ------- |
|
|
11
|
+
| color | — | — |
|
|
12
|
+
| size | — | — |
|
|
13
|
+
| variant | — | — |
|
|
14
|
+
| label | — | — |
|
|
15
|
+
| helperText | — | — |
|
|
16
|
+
| error | — | — |
|
|
17
|
+
| required | — | — |
|
|
18
|
+
| disabled | — | — |
|
|
19
|
+
| value | — | — |
|
|
20
|
+
| defaultValue | — | — |
|
|
21
|
+
| onChange | — | — |
|
|
22
|
+
| name | — | — |
|
|
23
|
+
| placeholder | — | — |
|
|
24
|
+
| type | — | — |
|
|
25
|
+
| startDecorator | — | — |
|
|
26
|
+
| endDecorator | — | — |
|
|
27
|
+
| enableClearable | — | — |
|
|
28
|
+
| disableTogglePasswordButton | — | — |
|
|
29
|
+
| sx | — | — |
|
|
30
|
+
| className | — | — |
|
|
31
|
+
|
|
32
|
+
## 기본형
|
|
33
|
+
|
|
34
|
+
Input의 기본 형태입니다. 사용자의 텍스트 입력을 받는 단일 라인 필드입니다.
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
<Input />
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 변형(Variants)
|
|
41
|
+
|
|
42
|
+
Input은 네 가지 변형을 지원합니다: `solid`, `soft`, `outlined`, `plain`
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<>
|
|
46
|
+
<Input placeholder="Type in here…" variant="solid" />
|
|
47
|
+
<Input placeholder="Type in here…" variant="soft" />
|
|
48
|
+
<Input placeholder="Type in here…" variant="outlined" />
|
|
49
|
+
<Input placeholder="Type in here…" variant="plain" />
|
|
50
|
+
</>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 크기(Sizes)
|
|
54
|
+
|
|
55
|
+
Input은 세 가지 크기를 지원합니다: `sm`, `md`, `lg`
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
<>
|
|
59
|
+
<Input {...args} size="lg" />
|
|
60
|
+
<Input {...args} size="md" />
|
|
61
|
+
<Input {...args} size="sm" />
|
|
62
|
+
</>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 레이블 및 도움말 텍스트
|
|
66
|
+
|
|
67
|
+
Input 컴포넌트에 `label`과 `helperText` 속성을 추가하여 사용자에게 추가 정보를 제공할 수 있습니다.
|
|
68
|
+
|
|
69
|
+
### 레이블(Label)
|
|
70
|
+
|
|
71
|
+
`label` 속성을 사용하여 Input 위에 레이블을 표시할 수 있습니다.
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
<>
|
|
75
|
+
<Input placeholder="Type in here…" label="Label" />
|
|
76
|
+
</>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 도움말 텍스트(Helper Text)
|
|
80
|
+
|
|
81
|
+
`helperText` 속성을 사용하여 Input 아래에 추가 정보를 제공할 수 있습니다.
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<>
|
|
85
|
+
<Input placeholder="Type in here…" helperText="I'm helper text" />
|
|
86
|
+
</>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 상태(States)
|
|
90
|
+
|
|
91
|
+
### 비활성화(Disabled)
|
|
92
|
+
|
|
93
|
+
`disabled` 속성을 사용하여 Input을 비활성화할 수 있습니다.
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<Input disabled />
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 오류 상태(Error)
|
|
100
|
+
|
|
101
|
+
`error` 속성을 사용하여 오류 상태를 표시할 수 있습니다.
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
<>
|
|
105
|
+
<Input placeholder="Invalid input" label="label" error />
|
|
106
|
+
</>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 필수 값(Required)
|
|
110
|
+
|
|
111
|
+
`required` 속성을 사용하여 필수 입력 필드임을 표시할 수 있습니다.
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
<Input
|
|
115
|
+
placeholder="Type in here..."
|
|
116
|
+
helperText="I'm helper text"
|
|
117
|
+
label="Label"
|
|
118
|
+
required
|
|
119
|
+
/>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 장식자(Decorators)
|
|
123
|
+
|
|
124
|
+
Input 컴포넌트는 `startDecorator`와 `endDecorator` 속성을 통해 입력 필드의 시작과 끝 부분에 아이콘, 버튼 또는 기타 요소를 추가할 수 있습니다.
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
<Stack spacing={3}>
|
|
128
|
+
<Input placeholder="Amount" startDecorator={{
|
|
129
|
+
dollar: '$',
|
|
130
|
+
baht: '฿',
|
|
131
|
+
yen: '¥'
|
|
132
|
+
}[currency]} endDecorator={<React.Fragment>
|
|
133
|
+
<Divider orientation="vertical" />
|
|
134
|
+
<Select variant="plain" value={currency} options={[{
|
|
135
|
+
value: 'dollar',
|
|
136
|
+
label: 'US dollar'
|
|
137
|
+
}, {
|
|
138
|
+
value: 'baht',
|
|
139
|
+
label: 'Thai baht'
|
|
140
|
+
}, {
|
|
141
|
+
value: 'yen',
|
|
142
|
+
label: 'Japanese yen'
|
|
143
|
+
}]} onChange={e => setCurrency(e.target.value!)} slotProps={{
|
|
144
|
+
listbox: {
|
|
145
|
+
variant: 'outlined'
|
|
146
|
+
}
|
|
147
|
+
}} sx={{
|
|
148
|
+
mr: -1.5,
|
|
149
|
+
'&:hover': {
|
|
150
|
+
bgcolor: 'transparent'
|
|
151
|
+
}
|
|
152
|
+
}} />
|
|
153
|
+
</React.Fragment>} sx={{
|
|
154
|
+
width: 300
|
|
155
|
+
}} />
|
|
156
|
+
<Input placeholder="Your location" startDecorator={<Button variant="soft" color="neutral" startDecorator={<LocationOn />}>
|
|
157
|
+
Locate
|
|
158
|
+
</Button>} sx={{
|
|
159
|
+
width: 300
|
|
160
|
+
}} />
|
|
161
|
+
</Stack>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`endDecorator`와 `enableClearable`을 함께 사용하면 다음과 같습니다:
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
<Input
|
|
168
|
+
placeholder="Type in here…"
|
|
169
|
+
label="Label"
|
|
170
|
+
enableClearable
|
|
171
|
+
endDecorator={<Chip color="primary">Hi</Chip>}
|
|
172
|
+
/>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## 지울 수 있는 입력(Clearable Input)
|
|
176
|
+
|
|
177
|
+
`enableClearable` 속성을 사용하여 Input에 내용을 지울 수 있는 버튼을 추가할 수 있습니다.
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
<>
|
|
181
|
+
<Input placeholder="Type in here…" label="Label" enableClearable />
|
|
182
|
+
</>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## 비밀번호 입력(Password Input)
|
|
186
|
+
|
|
187
|
+
`type="password"` 속성을 사용하면 비밀번호 입력 필드가 생성되며, 자동으로 비밀번호 표시/숨김 토글 버튼이 추가됩니다.
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
<Stack spacing={3}>
|
|
191
|
+
<Typography level="body-md">Default password input with toggle button:</Typography>
|
|
192
|
+
<Input {...args} placeholder="Enter password" type="password" label="Password" />
|
|
193
|
+
|
|
194
|
+
<Typography level="body-md">Disabled password input:</Typography>
|
|
195
|
+
<Input {...args} placeholder="Enter password" type="password" label="Disabled Password" disabled />
|
|
196
|
+
|
|
197
|
+
<Typography level="body-md">Password input with toggle button disabled:</Typography>
|
|
198
|
+
<Input {...args} placeholder="Enter password" type="password" label="No Toggle" disableTogglePasswordButton />
|
|
199
|
+
</Stack>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 비밀번호 토글 비활성화
|
|
203
|
+
|
|
204
|
+
비밀번호 입력 필드의 토글 버튼은 `disableTogglePasswordButton` 속성을 사용하여 비활성화할 수 있습니다.
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
<Stack spacing={3}>
|
|
208
|
+
<Typography level="body-md">Default password input with toggle button:</Typography>
|
|
209
|
+
<Input {...args} placeholder="Enter password" type="password" label="Password" />
|
|
210
|
+
|
|
211
|
+
<Typography level="body-md">Disabled password input:</Typography>
|
|
212
|
+
<Input {...args} placeholder="Enter password" type="password" label="Disabled Password" disabled />
|
|
213
|
+
|
|
214
|
+
<Typography level="body-md">Password input with toggle button disabled:</Typography>
|
|
215
|
+
<Input {...args} placeholder="Enter password" type="password" label="No Toggle" disableTogglePasswordButton />
|
|
216
|
+
</Stack>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### 비밀번호 입력의 제한 사항
|
|
220
|
+
|
|
221
|
+
비밀번호 입력 필드(`type="password"`)에서는 `endDecorator`를 사용할 수 없습니다. 이는 비밀번호 토글 버튼이 해당 위치를 차지하기 때문입니다.
|
|
222
|
+
|
|
223
|
+
```tsx
|
|
224
|
+
<Stack spacing={3}>
|
|
225
|
+
<Typography level="body-md">When type="password", the endDecorator is not supported:</Typography>
|
|
226
|
+
<Input {...args} placeholder="Enter password" type="password" label="Password with endDecorator (will show warning)" endDecorator={<Chip color="primary">Hi</Chip>} />
|
|
227
|
+
|
|
228
|
+
<Typography level="body-md">The password toggle button takes precedence:</Typography>
|
|
229
|
+
<Input {...args} placeholder="Enter password" type="password" label="Password" />
|
|
230
|
+
</Stack>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## 폼 컨트롤(Form Control)
|
|
234
|
+
|
|
235
|
+
Input 컴포넌트는 `label`, `helperText`, `error` 속성을 조합하여 완전한 폼 컨트롤을 구성할 수 있습니다.
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
<>
|
|
239
|
+
<Input placeholder="Type in here..." helperText="I'm helper text" label="Label" />
|
|
240
|
+
<Input placeholder="Invalid input" helperText="I'm helper text" label="Label" error />
|
|
241
|
+
</>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## 상태 관리
|
|
245
|
+
|
|
246
|
+
### 제어 컴포넌트(Controlled Component)
|
|
247
|
+
|
|
248
|
+
Input은 React의 제어 컴포넌트로 사용할 수 있습니다. `value`와 `onChange` 속성을 사용하여 상태를 관리합니다.
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
<>
|
|
252
|
+
<Input placeholder="Type in here…" label="Label" enableClearable value={value} onChange={handleChange} />
|
|
253
|
+
</>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### 비제어 컴포넌트(Uncontrolled Component)
|
|
257
|
+
|
|
258
|
+
`defaultValue` 속성을 사용하여 비제어 컴포넌트로도 사용 가능합니다.
|
|
259
|
+
|
|
260
|
+
## 접근성(Accessibility)
|
|
261
|
+
|
|
262
|
+
Input 컴포넌트는 웹 접근성 표준을 준수합니다:
|
|
263
|
+
|
|
264
|
+
- 적절한 레이블과 연결되어 있습니다.
|
|
265
|
+
- 키보드 탐색이 가능합니다.
|
|
266
|
+
- 오류 상태는 시각적으로 명확하게 표시됩니다.
|
|
267
|
+
|
|
268
|
+
## 테스팅(Testing)
|
|
269
|
+
|
|
270
|
+
### Testing Library 참고사항
|
|
271
|
+
|
|
272
|
+
- `type="password"` 속성을 가진 Input을 Testing Library로 찾을 때는 항상 `textbox` 역할(role)로 찾아야 합니다.
|
|
273
|
+
- 이는 ARIA 명세에 따라 `password` 입력이 특별한 role을 갖지 않고 기본적으로 `textbox` role을 사용하기 때문입니다.
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
// 비밀번호 입력 필드를 찾는 예시
|
|
277
|
+
const passwordInput = screen.getByRole('textbox', { name: /비밀번호/i });
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
**참고 이슈:**
|
|
281
|
+
|
|
282
|
+
- [W3C ARIA: Should there be a role=password?](https://github.com/w3c/aria/issues/935)
|
|
283
|
+
- [Testing Library: How to find password inputs](https://github.com/testing-library/dom-testing-library/issues/567)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# MonthPicker
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<MonthPicker />
|
|
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
|
+
<MonthPicker size="sm" />
|
|
31
|
+
<MonthPicker size="md" />
|
|
32
|
+
<MonthPicker size="lg" />
|
|
33
|
+
</Stack>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### WithLabel
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
<MonthPicker label="Date" />
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### WithHelperText
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<MonthPicker
|
|
46
|
+
label="Date"
|
|
47
|
+
helperText="Please select a date"
|
|
48
|
+
/>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Error
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
<MonthPicker
|
|
55
|
+
label="Date"
|
|
56
|
+
helperText="Please select a date"
|
|
57
|
+
error
|
|
58
|
+
/>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### WithFormats
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<Stack gap={2}>
|
|
65
|
+
<MonthPicker {...args} value={value['YYYY.MM.DD']} label="YYYY.MM.DD" name="YYYY.MM.DD" format="YYYY.MM.DD" onChange={handleChange} />
|
|
66
|
+
<MonthPicker {...args} value={value['YYYY/MM/DD']} label="YYYY/MM/DD" name="YYYY/MM/DD" format="YYYY/MM/DD" onChange={handleChange} />
|
|
67
|
+
<MonthPicker {...args} value={value['MM/DD/YYYY']} label="MM/DD/YYYY" name="MM/DD/YYYY" format="MM/DD/YYYY" onChange={handleChange} />
|
|
68
|
+
<MonthPicker {...args} value={value['YYYY-MM-DD']} label="YYYY-MM-DD" name="YYYY-MM-DD" format="YYYY-MM-DD" onChange={handleChange} />
|
|
69
|
+
<MonthPicker {...args} value={value['DD/MM/YYYY']} label="DD/MM/YYYY" name="DD/MM/YYYY" format="DD/MM/YYYY" onChange={handleChange} />
|
|
70
|
+
<MonthPicker {...args} value={value['DD.MM.YYYY']} label="DD.MM.YYYY" name="DD.MM.YYYY" format="DD.MM.YYYY" onChange={handleChange} />
|
|
71
|
+
</Stack>
|
|
72
|
+
```
|