@ceed/ads 1.29.1 → 1.30.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/dist/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/dist/components/CurrencyInput/hooks/use-currency-setting.d.ts +2 -2
- package/dist/components/ProfileMenu/ProfileMenu.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +21 -0
- package/dist/components/SearchBar/index.d.ts +3 -0
- package/dist/components/data-display/Badge.md +39 -71
- package/dist/components/data-display/DataTable.md +1 -1
- package/dist/components/data-display/InfoSign.md +98 -74
- package/dist/components/data-display/Typography.md +97 -363
- package/dist/components/feedback/Dialog.md +62 -76
- package/dist/components/feedback/Modal.md +44 -259
- package/dist/components/feedback/llms.txt +0 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/inputs/Autocomplete.md +107 -356
- package/dist/components/inputs/ButtonGroup.md +106 -115
- package/dist/components/inputs/Calendar.md +459 -98
- package/dist/components/inputs/CurrencyInput.md +5 -183
- package/dist/components/inputs/DatePicker.md +431 -108
- package/dist/components/inputs/DateRangePicker.md +492 -131
- package/dist/components/inputs/FilterMenu.md +19 -169
- package/dist/components/inputs/FilterableCheckboxGroup.md +23 -123
- package/dist/components/inputs/IconButton.md +88 -137
- package/dist/components/inputs/Input.md +0 -5
- package/dist/components/inputs/MonthPicker.md +422 -95
- package/dist/components/inputs/MonthRangePicker.md +466 -89
- package/dist/components/inputs/PercentageInput.md +16 -185
- package/dist/components/inputs/RadioButton.md +35 -163
- package/dist/components/inputs/RadioTileGroup.md +61 -150
- package/dist/components/inputs/SearchBar.md +44 -0
- package/dist/components/inputs/Select.md +326 -222
- package/dist/components/inputs/Switch.md +376 -136
- package/dist/components/inputs/Textarea.md +10 -213
- package/dist/components/inputs/Uploader/Uploader.md +66 -145
- package/dist/components/inputs/llms.txt +1 -3
- package/dist/components/navigation/Breadcrumbs.md +322 -80
- package/dist/components/navigation/Dropdown.md +221 -92
- package/dist/components/navigation/IconMenuButton.md +502 -40
- package/dist/components/navigation/InsetDrawer.md +738 -68
- package/dist/components/navigation/Link.md +298 -39
- package/dist/components/navigation/Menu.md +285 -92
- package/dist/components/navigation/MenuButton.md +448 -55
- package/dist/components/navigation/Pagination.md +338 -47
- package/dist/components/navigation/ProfileMenu.md +268 -45
- package/dist/components/navigation/Stepper.md +28 -160
- package/dist/components/navigation/Tabs.md +316 -57
- package/dist/components/surfaces/Sheet.md +334 -151
- package/dist/index.browser.js +15 -13
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +289 -288
- package/dist/index.d.ts +1 -1
- package/dist/index.js +426 -369
- package/dist/llms.txt +1 -8
- package/framer/index.js +1 -1
- package/package.json +16 -15
- package/dist/chunks/rehype-accent-FZRUD7VI.js +0 -39
- package/dist/components/feedback/CircularProgress.md +0 -257
- package/dist/components/feedback/Skeleton.md +0 -280
- package/dist/components/inputs/FormControl.md +0 -361
- package/dist/components/inputs/RadioList.md +0 -241
- package/dist/components/inputs/Slider.md +0 -334
- package/dist/guides/ThemeProvider.md +0 -116
- package/dist/guides/llms.txt +0 -9
|
@@ -2,19 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
The Textarea component provides a multi-line text input field for collecting longer-form user input such as comments, descriptions, and notes. It is built on top of Joy UI's Textarea and automatically adjusts its height between `minRows` (default 2) and `maxRows` (default 4) as the user types.
|
|
6
|
-
|
|
7
|
-
Textarea integrates with the form system by wrapping itself in a FormControl, supporting built-in `label`, `helperText`, and `error` props. It also supports decorators, multiple visual variants, sizes, and color themes to fit a wide range of admin UI use cases.
|
|
8
|
-
|
|
9
|
-
> **Use built-in form props**
|
|
10
|
-
>
|
|
11
|
-
> This component natively supports form elements such as `label` and `helperText` props.
|
|
12
|
-
> When building forms, use these built-in props instead of manually composing labels and helper text with Typography.
|
|
13
|
-
|
|
14
|
-
## Playground
|
|
15
|
-
|
|
16
|
-
Interact with the Textarea component using the controls below.
|
|
17
|
-
|
|
18
5
|
```tsx
|
|
19
6
|
<Textarea name="Textarea" />
|
|
20
7
|
```
|
|
@@ -33,26 +20,7 @@ Interact with the Textarea component using the controls below.
|
|
|
33
20
|
| error | — | — |
|
|
34
21
|
| onChange | — | — |
|
|
35
22
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```tsx
|
|
39
|
-
import { Textarea } from '@ceed/ads';
|
|
40
|
-
|
|
41
|
-
function MyComponent() {
|
|
42
|
-
return (
|
|
43
|
-
<Textarea
|
|
44
|
-
name="description"
|
|
45
|
-
label="Description"
|
|
46
|
-
placeholder="Enter a description..."
|
|
47
|
-
helperText="Provide a brief summary."
|
|
48
|
-
/>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Variants
|
|
54
|
-
|
|
55
|
-
Textarea supports four visual variants: `solid`, `soft`, `outlined`, and `plain`. The default variant is `outlined`.
|
|
23
|
+
### Variants
|
|
56
24
|
|
|
57
25
|
```tsx
|
|
58
26
|
<>
|
|
@@ -63,16 +31,7 @@ Textarea supports four visual variants: `solid`, `soft`, `outlined`, and `plain`
|
|
|
63
31
|
</>
|
|
64
32
|
```
|
|
65
33
|
|
|
66
|
-
|
|
67
|
-
<Textarea variant="solid" placeholder="Solid" />
|
|
68
|
-
<Textarea variant="soft" placeholder="Soft" />
|
|
69
|
-
<Textarea variant="outlined" placeholder="Outlined" />
|
|
70
|
-
<Textarea variant="plain" placeholder="Plain" />
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Sizes
|
|
74
|
-
|
|
75
|
-
Textarea comes in three sizes: `sm`, `md`, and `lg`. The default size is `md`.
|
|
34
|
+
### Sizes
|
|
76
35
|
|
|
77
36
|
```tsx
|
|
78
37
|
<>
|
|
@@ -82,15 +41,7 @@ Textarea comes in three sizes: `sm`, `md`, and `lg`. The default size is `md`.
|
|
|
82
41
|
</>
|
|
83
42
|
```
|
|
84
43
|
|
|
85
|
-
|
|
86
|
-
<Textarea size="sm" placeholder="Small" />
|
|
87
|
-
<Textarea size="md" placeholder="Medium" />
|
|
88
|
-
<Textarea size="lg" placeholder="Large" />
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## Colors
|
|
92
|
-
|
|
93
|
-
Textarea supports semantic colors via the `color` prop: `primary`, `neutral`, `danger`, and `warning`.
|
|
44
|
+
### Colors
|
|
94
45
|
|
|
95
46
|
```tsx
|
|
96
47
|
<>
|
|
@@ -101,167 +52,13 @@ Textarea supports semantic colors via the `color` prop: `primary`, `neutral`, `d
|
|
|
101
52
|
</>
|
|
102
53
|
```
|
|
103
54
|
|
|
104
|
-
|
|
105
|
-
<Textarea color="primary" placeholder="Primary" />
|
|
106
|
-
<Textarea color="neutral" placeholder="Neutral" />
|
|
107
|
-
<Textarea color="danger" placeholder="Danger" />
|
|
108
|
-
<Textarea color="warning" placeholder="Warning" />
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Required with Label and Helper Text
|
|
112
|
-
|
|
113
|
-
Use the `required`, `label`, and `helperText` props together to build complete form fields. The `required` prop adds an asterisk indicator to the label.
|
|
114
|
-
|
|
115
|
-
```tsx
|
|
116
|
-
<Textarea
|
|
117
|
-
name="Textarea"
|
|
118
|
-
placeholder="Type in here..."
|
|
119
|
-
helperText="I'm helper text"
|
|
120
|
-
label="Label"
|
|
121
|
-
required
|
|
122
|
-
/>
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
```tsx
|
|
126
|
-
<Textarea
|
|
127
|
-
label="Label"
|
|
128
|
-
helperText="I'm helper text"
|
|
129
|
-
placeholder="Type in here..."
|
|
130
|
-
required
|
|
131
|
-
/>
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Common Use Cases
|
|
135
|
-
|
|
136
|
-
### Feedback Form
|
|
137
|
-
|
|
138
|
-
```tsx
|
|
139
|
-
import { Textarea, Button, Stack } from '@ceed/ads';
|
|
140
|
-
|
|
141
|
-
function FeedbackForm() {
|
|
142
|
-
const [value, setValue] = React.useState('');
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<Stack spacing={2}>
|
|
146
|
-
<Textarea
|
|
147
|
-
name="feedback"
|
|
148
|
-
label="Feedback"
|
|
149
|
-
placeholder="Tell us what you think..."
|
|
150
|
-
helperText="Your feedback helps us improve the service."
|
|
151
|
-
minRows={3}
|
|
152
|
-
maxRows={6}
|
|
153
|
-
value={value}
|
|
154
|
-
onChange={(e) => setValue(e.target.value)}
|
|
155
|
-
required
|
|
156
|
-
/>
|
|
157
|
-
<Button disabled={!value.trim()}>Submit</Button>
|
|
158
|
-
</Stack>
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### Error State with Validation
|
|
164
|
-
|
|
165
|
-
```tsx
|
|
166
|
-
import { Textarea } from '@ceed/ads';
|
|
167
|
-
|
|
168
|
-
function ValidatedTextarea() {
|
|
169
|
-
const [value, setValue] = React.useState('');
|
|
170
|
-
const isError = value.length > 0 && value.length < 10;
|
|
171
|
-
|
|
172
|
-
return (
|
|
173
|
-
<Textarea
|
|
174
|
-
name="notes"
|
|
175
|
-
label="Notes"
|
|
176
|
-
placeholder="Write at least 10 characters..."
|
|
177
|
-
helperText={isError ? 'Must be at least 10 characters.' : 'Optional notes for this record.'}
|
|
178
|
-
error={isError}
|
|
179
|
-
value={value}
|
|
180
|
-
onChange={(e) => setValue(e.target.value)}
|
|
181
|
-
/>
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Disabled Read-Only Display
|
|
187
|
-
|
|
188
|
-
```tsx
|
|
189
|
-
import { Textarea } from '@ceed/ads';
|
|
190
|
-
|
|
191
|
-
function ReadOnlyNotes() {
|
|
192
|
-
return (
|
|
193
|
-
<Textarea
|
|
194
|
-
name="archived-notes"
|
|
195
|
-
label="Archived Notes"
|
|
196
|
-
value="This record has been archived and cannot be edited."
|
|
197
|
-
disabled
|
|
198
|
-
/>
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
## Best Practices
|
|
204
|
-
|
|
205
|
-
1. **Use built-in form props instead of manual composition.**
|
|
206
|
-
|
|
207
|
-
```tsx
|
|
208
|
-
// ✅ Recommended
|
|
209
|
-
<Textarea label="Description" helperText="Keep it brief." />
|
|
210
|
-
|
|
211
|
-
// ❌ Avoid
|
|
212
|
-
<FormControl>
|
|
213
|
-
<Typography level="title-sm" component="label">Description</Typography>
|
|
214
|
-
<Textarea />
|
|
215
|
-
<Typography level="body-xs" color="neutral">Keep it brief.</Typography>
|
|
216
|
-
</FormControl>
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
2. **Set appropriate `minRows` and `maxRows` for the expected content length.**
|
|
220
|
-
|
|
221
|
-
```tsx
|
|
222
|
-
// ✅ Short comment field
|
|
223
|
-
<Textarea minRows={2} maxRows={4} placeholder="Add a comment..." />
|
|
224
|
-
|
|
225
|
-
// ✅ Long description field
|
|
226
|
-
<Textarea minRows={4} maxRows={10} placeholder="Write a detailed description..." />
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
3. **Always provide a `name` prop for form submission.**
|
|
55
|
+
### Variants
|
|
230
56
|
|
|
231
57
|
```tsx
|
|
232
|
-
|
|
233
|
-
<Textarea name="
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
<Textarea
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
4. **Use `error` and `helperText` together for validation feedback.**
|
|
240
|
-
|
|
241
|
-
```tsx
|
|
242
|
-
// ✅ Clear error feedback
|
|
243
|
-
<Textarea
|
|
244
|
-
error={hasError}
|
|
245
|
-
helperText={hasError ? 'This field is required.' : 'Optional description.'}
|
|
246
|
-
/>
|
|
247
|
-
|
|
248
|
-
// ❌ Error state without explanation
|
|
249
|
-
<Textarea error />
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
5. **Use a descriptive `placeholder` to guide user input.**
|
|
253
|
-
|
|
254
|
-
```tsx
|
|
255
|
-
// ✅ Descriptive placeholder
|
|
256
|
-
<Textarea placeholder="Describe the issue in detail..." />
|
|
257
|
-
|
|
258
|
-
// ❌ Vague placeholder
|
|
259
|
-
<Textarea placeholder="Type here" />
|
|
58
|
+
<>
|
|
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
|
+
</>
|
|
260
64
|
```
|
|
261
|
-
|
|
262
|
-
## Accessibility
|
|
263
|
-
|
|
264
|
-
- The component automatically associates the `label` with the textarea element through FormControl, ensuring screen readers announce the label when the field receives focus.
|
|
265
|
-
- When `required` is set, the field is marked with `aria-required` and a visual asterisk indicator is added to the label.
|
|
266
|
-
- When `error` is set, the `helperText` is associated with the textarea via `aria-describedby`, allowing screen readers to announce the error message.
|
|
267
|
-
- Use a clear and descriptive `label` for every Textarea in a form. Avoid relying solely on `placeholder` text, as it disappears once the user starts typing and is not reliably announced by all screen readers.
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# Uploader
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Uploader is a file upload component that provides a drag-and-drop zone along with a file browser for selecting files. It handles file type validation, individual and total file size limits, minimum and maximum file count constraints, and displays uploaded file previews with delete capabilities. The component automatically generates helper text based on its configuration and surfaces clear error messages when validation rules are violated.
|
|
6
|
-
|
|
7
|
-
Uploader is designed for forms where users need to attach documents, images, or other files. It supports both controlled error states via the `error` prop and internal validation that triggers automatically when files are added. A [Figma design guide](https://www.figma.com/design/NoAOnaPiP2H2lzvRhkBnGZ/CDS-v1.1?node-id=2600-3701\&t=WLh4JrGHlzDGMeV4-0) is available for reference.
|
|
3
|
+
Uploader 컴포넌트는 파일 업로드를 위한 컴포넌트입니다. [관련 가이드](https://www.figma.com/design/NoAOnaPiP2H2lzvRhkBnGZ/CDS-v1.1?node-id=2600-3701\&t=WLh4JrGHlzDGMeV4-0)는 figma에서도 확인할 수 있습니다.
|
|
8
4
|
|
|
9
5
|
```tsx
|
|
10
6
|
<Uploader
|
|
@@ -27,28 +23,10 @@ Uploader is designed for forms where users need to attach documents, images, or
|
|
|
27
23
|
| onChange | — | — |
|
|
28
24
|
| onDelete | — | — |
|
|
29
25
|
|
|
30
|
-
##
|
|
26
|
+
## 기본형
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function MyForm() {
|
|
36
|
-
return (
|
|
37
|
-
<Uploader
|
|
38
|
-
accept=".png,.jpg,.pdf"
|
|
39
|
-
maxFileTotalSize={10 * 1024 * 1024}
|
|
40
|
-
maxCount={5}
|
|
41
|
-
label="Attachments"
|
|
42
|
-
onChange={(files) => console.log('Files added:', files)}
|
|
43
|
-
onDelete={(fileId) => console.log('File removed:', fileId)}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Default
|
|
50
|
-
|
|
51
|
-
The most basic Uploader requires `accept` and `maxFileTotalSize` props. Helper text is automatically generated from these values.
|
|
28
|
+
필수 속성 값으로 `accept`, `maxFileTotalSize`를 받고, 해당 속성 값들을 바탕으로 기본 `helperText`가 설정됩니다.\
|
|
29
|
+
생성된 `helperText`는 File dropzone 하단에 노출됩니다.
|
|
52
30
|
|
|
53
31
|
```tsx
|
|
54
32
|
<Uploader
|
|
@@ -57,9 +35,7 @@ The most basic Uploader requires `accept` and `maxFileTotalSize` props. Helper t
|
|
|
57
35
|
/>
|
|
58
36
|
```
|
|
59
37
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Adding a `label` prop displays a title above the dropzone.
|
|
38
|
+
`label`과 함께 쓰이면 아래와 같은 모습입니다.
|
|
63
39
|
|
|
64
40
|
```tsx
|
|
65
41
|
<Uploader
|
|
@@ -69,9 +45,9 @@ Adding a `label` prop displays a title above the dropzone.
|
|
|
69
45
|
/>
|
|
70
46
|
```
|
|
71
47
|
|
|
72
|
-
##
|
|
48
|
+
## Size
|
|
73
49
|
|
|
74
|
-
|
|
50
|
+
Size는 `sm`, `md` 두 사이즈를 지원합니다.
|
|
75
51
|
|
|
76
52
|
```tsx
|
|
77
53
|
<Stack gap={4}>
|
|
@@ -86,20 +62,11 @@ Two sizes are available: `sm` and `md`. Use the smaller size for compact form la
|
|
|
86
62
|
</Stack>
|
|
87
63
|
```
|
|
88
64
|
|
|
89
|
-
##
|
|
90
|
-
|
|
91
|
-
The `accept` prop controls which file types are allowed. You can specify individual extensions (`.png,.jpg`) or use wildcards (`image/*`, `video/*`, `audio/*`) that map to predefined extension sets.
|
|
92
|
-
|
|
93
|
-
```tsx
|
|
94
|
-
<Uploader
|
|
95
|
-
accept="image/png, image/jpeg, .pdf,.word,.txt,.doc,.docx"
|
|
96
|
-
maxFileTotalSize={31457280}
|
|
97
|
-
/>
|
|
98
|
-
```
|
|
65
|
+
## Internal validation
|
|
99
66
|
|
|
100
|
-
|
|
67
|
+
### Min Count
|
|
101
68
|
|
|
102
|
-
|
|
69
|
+
`minCount` 값과 현재 업로드된 상태에 따라서 내부적으로 에러를 발생시킵니다.
|
|
103
70
|
|
|
104
71
|
```tsx
|
|
105
72
|
<>
|
|
@@ -115,9 +82,10 @@ The `minCount` prop sets a minimum number of required files. Validation triggers
|
|
|
115
82
|
</>
|
|
116
83
|
```
|
|
117
84
|
|
|
118
|
-
|
|
85
|
+
### Max Count
|
|
119
86
|
|
|
120
|
-
|
|
87
|
+
`maxCount` 값과 현재 업로드된 상태에 따라서 내부적으로 에러를 발생시킵니다.\
|
|
88
|
+
아래의 상황에서 두 개 이상의 파일을 업로드 해보세요.
|
|
121
89
|
|
|
122
90
|
```tsx
|
|
123
91
|
<Uploader
|
|
@@ -137,9 +105,30 @@ Display pre-existing uploaded files and enforce `maxCount` limits. Try uploading
|
|
|
137
105
|
/>
|
|
138
106
|
```
|
|
139
107
|
|
|
140
|
-
|
|
108
|
+
### Accepts
|
|
109
|
+
|
|
110
|
+
`accept` 속성을 이용해 특정 파일 형식만 업로드할 수 있도록 제한할 수 있습니다.\
|
|
111
|
+
파일 확장자 제한을 위한 `accept`값은 필수적으로 받고 있으며, 확장자를 특정해서 사용하거나(`.png,.jpeg,.txt`) `image/*`, `video/*`, `audio/*`와 같은 값을 사용할 수 있습니다.
|
|
112
|
+
|
|
113
|
+
일부 디바이스에선 MIME type을 사용해서 받을 파일을 제한하는 것이 의도와 다른 동작을 일으킬 수 있기 때문에 `image/*`, `video/*`, `audio/*`를 사용하면 내부적으로 특정 확장자 집합과 맵핑됩니다.
|
|
141
114
|
|
|
142
|
-
|
|
115
|
+
`image/*` = `.jpeg,.jpg,.png,.gif,.bmp,.tiff,.svg,.webp,.heic,.ico`\
|
|
116
|
+
`video/*` = `.mp4,.avi,.mkv,.mov,.wmv,.flv,.webm,.mpeg,.3gp,.m4v`\
|
|
117
|
+
`audio/*` = `.mp3,.wav,.flac,.aac,.ogg,.m4a,.wma,.aiff,.alac,.midi,.mp4`
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
<Uploader
|
|
121
|
+
accept="image/png, image/jpeg, .pdf,.word,.txt,.doc,.docx"
|
|
122
|
+
maxFileTotalSize={31457280}
|
|
123
|
+
/>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### File Size
|
|
127
|
+
|
|
128
|
+
#### Total File Size
|
|
129
|
+
|
|
130
|
+
`maxFileTotalSize`값으로 업로드 가능한 파일의 총 크기를 제한할 수 있습니다. `maxFileTotalSize`는 필수 속성 값입니다.\
|
|
131
|
+
아래의 상황에서 1MB 이상으로 파일을 업로드 해보세요.
|
|
143
132
|
|
|
144
133
|
```tsx
|
|
145
134
|
<Uploader
|
|
@@ -150,9 +139,10 @@ The `maxFileTotalSize` prop limits the combined size of all uploaded files.
|
|
|
150
139
|
/>
|
|
151
140
|
```
|
|
152
141
|
|
|
153
|
-
|
|
142
|
+
#### Indivisual File Size
|
|
154
143
|
|
|
155
|
-
|
|
144
|
+
`maxFileSize`값으로 파일 하나의 최대 크기를 제한할 수 있습니다.\
|
|
145
|
+
아래의 상황에서 Total 1MB 이상의 파일도 업로드 해보고, 1MB가 넘는 단일 파일도 업로드 해보세요.
|
|
156
146
|
|
|
157
147
|
```tsx
|
|
158
148
|
<Uploader
|
|
@@ -166,7 +156,9 @@ The `maxFileSize` prop limits the size of each individual file, independent of t
|
|
|
166
156
|
|
|
167
157
|
## Error State
|
|
168
158
|
|
|
169
|
-
|
|
159
|
+
### External Error
|
|
160
|
+
|
|
161
|
+
`error` prop을 통해 외부에서 에러 상태를 제어할 수 있습니다. 에러 상태일 때 Uploader의 드롭존 테두리가 빨간색으로 변경됩니다.
|
|
170
162
|
|
|
171
163
|
```tsx
|
|
172
164
|
<Uploader
|
|
@@ -178,9 +170,9 @@ Use the `error` prop to externally control the error state, and `helperText` to
|
|
|
178
170
|
/>
|
|
179
171
|
```
|
|
180
172
|
|
|
181
|
-
|
|
173
|
+
### Validation Errors
|
|
182
174
|
|
|
183
|
-
|
|
175
|
+
다양한 검증 규칙을 위반했을 때 자동으로 발생하는 에러들을 확인해보세요:
|
|
184
176
|
|
|
185
177
|
```tsx
|
|
186
178
|
<Stack gap={4}>
|
|
@@ -195,9 +187,12 @@ Demonstrates automatic validation error messages for various rule violations (fi
|
|
|
195
187
|
</Stack>
|
|
196
188
|
```
|
|
197
189
|
|
|
198
|
-
## Helper Text
|
|
190
|
+
## Helper Text
|
|
199
191
|
|
|
200
|
-
|
|
192
|
+
### Custom Helper Text
|
|
193
|
+
|
|
194
|
+
`helperText` prop을 사용하면 기본 안내 메시지 대신 사용자 정의 메시지를 표시할 수 있습니다.\
|
|
195
|
+
`helperText`가 제공되면 모든 기본 안내 메시지와 에러 메시지보다 우선적으로 표시됩니다.
|
|
201
196
|
|
|
202
197
|
```tsx
|
|
203
198
|
<Stack gap={4}>
|
|
@@ -216,102 +211,28 @@ Comparison of auto-generated helper text, custom helper text, and error-state he
|
|
|
216
211
|
</Stack>
|
|
217
212
|
```
|
|
218
213
|
|
|
219
|
-
##
|
|
220
|
-
|
|
221
|
-
The Uploader can be disabled to prevent file selection and drag-and-drop interactions.
|
|
222
|
-
|
|
223
|
-
```tsx
|
|
224
|
-
<Uploader
|
|
225
|
-
accept=".png"
|
|
226
|
-
maxFileTotalSize={31457280}
|
|
227
|
-
label="Click to Upload or drag file"
|
|
228
|
-
disabled
|
|
229
|
-
/>
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
## Common Use Cases
|
|
233
|
-
|
|
234
|
-
### Profile Photo Upload
|
|
235
|
-
|
|
236
|
-
```tsx
|
|
237
|
-
import { Uploader } from '@ceed/ads';
|
|
238
|
-
|
|
239
|
-
function ProfilePhotoUpload() {
|
|
240
|
-
return (
|
|
241
|
-
<Uploader
|
|
242
|
-
label="Profile Photo"
|
|
243
|
-
accept="image/*"
|
|
244
|
-
maxFileTotalSize={5 * 1024 * 1024}
|
|
245
|
-
maxCount={1}
|
|
246
|
-
maxFileSize={5 * 1024 * 1024}
|
|
247
|
-
helperText="Upload a profile photo (JPG, PNG, max 5MB)"
|
|
248
|
-
/>
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
### Document Attachment in a Form
|
|
254
|
-
|
|
255
|
-
```tsx
|
|
256
|
-
import { Uploader, Stack, Button } from '@ceed/ads';
|
|
257
|
-
|
|
258
|
-
function DocumentForm() {
|
|
259
|
-
return (
|
|
260
|
-
<form onSubmit={(e) => { e.preventDefault(); }}>
|
|
261
|
-
<Stack gap={3}>
|
|
262
|
-
<Uploader
|
|
263
|
-
label="Supporting Documents"
|
|
264
|
-
accept=".pdf,.doc,.docx"
|
|
265
|
-
maxFileTotalSize={30 * 1024 * 1024}
|
|
266
|
-
maxCount={10}
|
|
267
|
-
minCount={1}
|
|
268
|
-
maxFileSize={10 * 1024 * 1024}
|
|
269
|
-
/>
|
|
270
|
-
<Button type="submit">Submit</Button>
|
|
271
|
-
</Stack>
|
|
272
|
-
</form>
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
### Multi-Image Gallery Upload
|
|
278
|
-
|
|
279
|
-
```tsx
|
|
280
|
-
import { Uploader } from '@ceed/ads';
|
|
281
|
-
|
|
282
|
-
function GalleryUpload({ existingImages }) {
|
|
283
|
-
return (
|
|
284
|
-
<Uploader
|
|
285
|
-
label="Gallery Images"
|
|
286
|
-
accept="image/*"
|
|
287
|
-
maxFileTotalSize={50 * 1024 * 1024}
|
|
288
|
-
maxCount={20}
|
|
289
|
-
maxFileSize={10 * 1024 * 1024}
|
|
290
|
-
uploaded={existingImages}
|
|
291
|
-
onChange={(files) => console.log('New files:', files)}
|
|
292
|
-
onDelete={(id) => console.log('Removed:', id)}
|
|
293
|
-
/>
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
```
|
|
214
|
+
## Validation
|
|
297
215
|
|
|
298
|
-
|
|
216
|
+
Uploader 컴포넌트는 다양한 내부 검증 기능을 제공하며, 검증 실패 시 자동으로 에러 메시지를 표시합니다.
|
|
299
217
|
|
|
300
|
-
|
|
218
|
+
### Error Messages
|
|
301
219
|
|
|
302
|
-
|
|
303
|
-
- ✔ `accept=".png,.jpg,.pdf"` -- clear and predictable
|
|
304
|
-
- ✘ `accept="*"` -- allows any file type with no validation
|
|
220
|
+
내부 검증에서 발생하는 에러 메시지들:
|
|
305
221
|
|
|
306
|
-
-
|
|
222
|
+
- **파일 타입 오류**: "Please upload the correct file type."
|
|
223
|
+
- **파일 크기 초과**: "One or more files exceeded the maximum file size. Each file size must be \[크기] or less."
|
|
224
|
+
- **총 파일 크기 초과**: "The total file size exceeds the maximum limit."
|
|
225
|
+
- **파일 개수 초과**: "Exceeded the maximum number of files."
|
|
226
|
+
- **최소 파일 개수 미달**: "Please choose \[개수] files to upload." (form validation 시)
|
|
307
227
|
|
|
308
|
-
|
|
228
|
+
### Helper Text Generation
|
|
309
229
|
|
|
310
|
-
|
|
230
|
+
`helperText` prop이 제공되지 않으면 다음 정보를 기반으로 자동 생성됩니다:
|
|
311
231
|
|
|
312
|
-
|
|
232
|
+
1. **허용 파일 타입**: `accept` prop 기반
|
|
233
|
+
- `image/*`, `video/*`, `audio/*` → "Any image file", "Any video file", "Any audio file"
|
|
234
|
+
- 특정 확장자 → 대문자 확장자명 나열
|
|
235
|
+
2. **최대 파일 크기**: `maxFileTotalSize` prop 기반
|
|
236
|
+
3. **파일 개수 제한**: `maxCount` prop 기반 (있는 경우)
|
|
313
237
|
|
|
314
|
-
|
|
315
|
-
- Error messages and helper text are associated with the dropzone via ARIA attributes, ensuring screen readers announce validation feedback.
|
|
316
|
-
- Uploaded file items include accessible delete buttons with descriptive labels.
|
|
317
|
-
- The `label` prop renders as a visible label associated with the upload control for screen reader identification.
|
|
238
|
+
**예시**: "PNG, Maximum 30MB, Up to 3 files"
|
|
@@ -12,17 +12,15 @@
|
|
|
12
12
|
- [DateRangePicker](./DateRangePicker.md)
|
|
13
13
|
- [FilterableCheckboxGroup](./FilterableCheckboxGroup.md)
|
|
14
14
|
- [FilterMenu](./FilterMenu.md)
|
|
15
|
-
- [FormControl](./FormControl.md)
|
|
16
15
|
- [IconButton](./IconButton.md)
|
|
17
16
|
- [Input](./Input.md)
|
|
18
17
|
- [MonthPicker](./MonthPicker.md)
|
|
19
18
|
- [MonthRangePicker](./MonthRangePicker.md)
|
|
20
19
|
- [PercentageInput](./PercentageInput.md)
|
|
21
20
|
- [Radio](./RadioButton.md)
|
|
22
|
-
- [RadioList](./RadioList.md)
|
|
23
21
|
- [RadioTileGroup](./RadioTileGroup.md)
|
|
22
|
+
- [SearchBar](./SearchBar.md)
|
|
24
23
|
- [Select](./Select.md)
|
|
25
|
-
- [Slider](./Slider.md)
|
|
26
24
|
- [Switch](./Switch.md)
|
|
27
25
|
- [Textarea](./Textarea.md)
|
|
28
26
|
|