@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
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Input
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
The Input component is a fundamental form element for capturing text input from users. It supports various visual styles, sizes, and states to accommodate different use cases across forms, search fields, and data entry interfaces.
|
|
6
|
+
|
|
7
|
+
Input comes with built-in form integration features such as labels, helper text, error states, and clearable functionality. It also provides specialized behavior for password fields with an automatic visibility toggle.
|
|
4
8
|
|
|
5
9
|
```tsx
|
|
6
10
|
<Input />
|
|
@@ -29,17 +33,52 @@ Input 컴포넌트는 사용자로부터 텍스트 입력을 받기 위한 기
|
|
|
29
33
|
| sx | — | — |
|
|
30
34
|
| className | — | — |
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
> **Use built-in form props**
|
|
37
|
+
>
|
|
38
|
+
> This component natively supports `label`, `helperText`, `error`, and `required` props.
|
|
39
|
+
> When building forms, use these built-in props instead of manually composing labels and helper text with Typography or FormControl.
|
|
40
|
+
>
|
|
41
|
+
> ```tsx
|
|
42
|
+
> // Recommended: use built-in props
|
|
43
|
+
> <Input label="Email" helperText="We'll never share your email." error={!isValid} />
|
|
44
|
+
>
|
|
45
|
+
> // Not recommended: manual composition with Typography
|
|
46
|
+
> <FormControl>
|
|
47
|
+
> <Typography component="label">Email</Typography>
|
|
48
|
+
> <Input />
|
|
49
|
+
> <Typography level="body-xs">We'll never share your email.</Typography>
|
|
50
|
+
> </FormControl>
|
|
51
|
+
> ```
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { Input } from '@ceed/cds';
|
|
57
|
+
|
|
58
|
+
function MyComponent() {
|
|
59
|
+
return (
|
|
60
|
+
<Input
|
|
61
|
+
label="Username"
|
|
62
|
+
placeholder="Enter your username"
|
|
63
|
+
helperText="Must be at least 3 characters"
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Examples
|
|
33
70
|
|
|
34
|
-
|
|
71
|
+
### Basic Input
|
|
72
|
+
|
|
73
|
+
The default Input renders a single-line text field. Without any additional props, it uses the `outlined` variant at `md` size.
|
|
35
74
|
|
|
36
75
|
```tsx
|
|
37
76
|
<Input />
|
|
38
77
|
```
|
|
39
78
|
|
|
40
|
-
|
|
79
|
+
### Variants
|
|
41
80
|
|
|
42
|
-
Input
|
|
81
|
+
Input supports four visual variants: `solid`, `soft`, `outlined`, and `plain`. Use `outlined` (default) for most form contexts, and `soft` or `plain` for inline or subtle placements.
|
|
43
82
|
|
|
44
83
|
```tsx
|
|
45
84
|
<>
|
|
@@ -50,9 +89,9 @@ Input은 네 가지 변형을 지원합니다: `solid`, `soft`, `outlined`, `pla
|
|
|
50
89
|
</>
|
|
51
90
|
```
|
|
52
91
|
|
|
53
|
-
|
|
92
|
+
### Sizes
|
|
54
93
|
|
|
55
|
-
Input
|
|
94
|
+
Input comes in three sizes: `sm`, `md`, and `lg`. Choose a size that fits the surrounding UI density.
|
|
56
95
|
|
|
57
96
|
```tsx
|
|
58
97
|
<>
|
|
@@ -62,13 +101,11 @@ Input은 세 가지 크기를 지원합니다: `sm`, `md`, `lg`
|
|
|
62
101
|
</>
|
|
63
102
|
```
|
|
64
103
|
|
|
65
|
-
##
|
|
66
|
-
|
|
67
|
-
Input 컴포넌트에 `label`과 `helperText` 속성을 추가하여 사용자에게 추가 정보를 제공할 수 있습니다.
|
|
104
|
+
## Label and Helper Text
|
|
68
105
|
|
|
69
|
-
###
|
|
106
|
+
### Label
|
|
70
107
|
|
|
71
|
-
`label`
|
|
108
|
+
Use the `label` prop to display a label above the Input. This is the recommended way to associate a label with the input field.
|
|
72
109
|
|
|
73
110
|
```tsx
|
|
74
111
|
<>
|
|
@@ -76,9 +113,9 @@ Input 컴포넌트에 `label`과 `helperText` 속성을 추가하여 사용자
|
|
|
76
113
|
</>
|
|
77
114
|
```
|
|
78
115
|
|
|
79
|
-
###
|
|
116
|
+
### Helper Text
|
|
80
117
|
|
|
81
|
-
`helperText`
|
|
118
|
+
Use the `helperText` prop to provide additional guidance below the Input.
|
|
82
119
|
|
|
83
120
|
```tsx
|
|
84
121
|
<>
|
|
@@ -86,19 +123,19 @@ Input 컴포넌트에 `label`과 `helperText` 속성을 추가하여 사용자
|
|
|
86
123
|
</>
|
|
87
124
|
```
|
|
88
125
|
|
|
89
|
-
##
|
|
126
|
+
## States
|
|
90
127
|
|
|
91
|
-
###
|
|
128
|
+
### Disabled
|
|
92
129
|
|
|
93
|
-
`disabled`
|
|
130
|
+
Set `disabled` to prevent user interaction. Disabled inputs are visually dimmed and do not receive focus.
|
|
94
131
|
|
|
95
132
|
```tsx
|
|
96
133
|
<Input disabled />
|
|
97
134
|
```
|
|
98
135
|
|
|
99
|
-
###
|
|
136
|
+
### Error
|
|
100
137
|
|
|
101
|
-
`error`
|
|
138
|
+
Set `error` to indicate a validation failure. Combine with `helperText` to explain the error.
|
|
102
139
|
|
|
103
140
|
```tsx
|
|
104
141
|
<>
|
|
@@ -106,9 +143,9 @@ Input 컴포넌트에 `label`과 `helperText` 속성을 추가하여 사용자
|
|
|
106
143
|
</>
|
|
107
144
|
```
|
|
108
145
|
|
|
109
|
-
###
|
|
146
|
+
### Required
|
|
110
147
|
|
|
111
|
-
`required`
|
|
148
|
+
Set `required` to mark the field as mandatory. This adds a visual indicator to the label.
|
|
112
149
|
|
|
113
150
|
```tsx
|
|
114
151
|
<Input
|
|
@@ -119,9 +156,20 @@ Input 컴포넌트에 `label`과 `helperText` 속성을 추가하여 사용자
|
|
|
119
156
|
/>
|
|
120
157
|
```
|
|
121
158
|
|
|
122
|
-
##
|
|
159
|
+
## Form Control
|
|
160
|
+
|
|
161
|
+
Combine `label`, `helperText`, and `error` props to build a complete form control. This is the recommended pattern for form fields.
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
<>
|
|
165
|
+
<Input placeholder="Type in here..." helperText="I'm helper text" label="Label" />
|
|
166
|
+
<Input placeholder="Invalid input" helperText="I'm helper text" label="Label" error />
|
|
167
|
+
</>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Decorators
|
|
123
171
|
|
|
124
|
-
|
|
172
|
+
Use `startDecorator` and `endDecorator` to place icons, buttons, or other elements at the start and end of the input field.
|
|
125
173
|
|
|
126
174
|
```tsx
|
|
127
175
|
<Stack spacing={3}>
|
|
@@ -161,7 +209,7 @@ width: 300
|
|
|
161
209
|
</Stack>
|
|
162
210
|
```
|
|
163
211
|
|
|
164
|
-
`endDecorator
|
|
212
|
+
When using `endDecorator` together with `enableClearable`, the clear button is placed before the end decorator:
|
|
165
213
|
|
|
166
214
|
```tsx
|
|
167
215
|
<Input
|
|
@@ -172,9 +220,9 @@ width: 300
|
|
|
172
220
|
/>
|
|
173
221
|
```
|
|
174
222
|
|
|
175
|
-
##
|
|
223
|
+
## Clearable Input
|
|
176
224
|
|
|
177
|
-
`enableClearable`
|
|
225
|
+
Set `enableClearable` to show a clear button when the input has a value. Clicking the button clears the input and returns focus to the field.
|
|
178
226
|
|
|
179
227
|
```tsx
|
|
180
228
|
<>
|
|
@@ -182,26 +230,9 @@ width: 300
|
|
|
182
230
|
</>
|
|
183
231
|
```
|
|
184
232
|
|
|
185
|
-
##
|
|
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
|
-
### 비밀번호 토글 비활성화
|
|
233
|
+
## Password Input
|
|
203
234
|
|
|
204
|
-
|
|
235
|
+
Setting `type="password"` automatically adds a visibility toggle button, allowing users to reveal or hide their password.
|
|
205
236
|
|
|
206
237
|
```tsx
|
|
207
238
|
<Stack spacing={3}>
|
|
@@ -216,9 +247,9 @@ width: 300
|
|
|
216
247
|
</Stack>
|
|
217
248
|
```
|
|
218
249
|
|
|
219
|
-
###
|
|
250
|
+
### Password Limitations
|
|
220
251
|
|
|
221
|
-
|
|
252
|
+
When `type="password"` is used, the `endDecorator` prop is not supported because the password toggle button occupies that position.
|
|
222
253
|
|
|
223
254
|
```tsx
|
|
224
255
|
<Stack spacing={3}>
|
|
@@ -230,54 +261,154 @@ width: 300
|
|
|
230
261
|
</Stack>
|
|
231
262
|
```
|
|
232
263
|
|
|
233
|
-
##
|
|
264
|
+
## State Management
|
|
234
265
|
|
|
235
|
-
|
|
266
|
+
### Controlled Component
|
|
267
|
+
|
|
268
|
+
Use `value` and `onChange` to manage the input state externally. This is useful when you need to synchronize the value with other components or perform validation on change.
|
|
236
269
|
|
|
237
270
|
```tsx
|
|
238
271
|
<>
|
|
239
|
-
<Input placeholder="Type in here
|
|
240
|
-
<Input placeholder="Invalid input" helperText="I'm helper text" label="Label" error />
|
|
272
|
+
<Input placeholder="Type in here…" label="Label" enableClearable value={value} onChange={handleChange} />
|
|
241
273
|
</>
|
|
242
274
|
```
|
|
243
275
|
|
|
244
|
-
|
|
276
|
+
### Uncontrolled Component
|
|
277
|
+
|
|
278
|
+
Use `defaultValue` for simpler cases where you do not need to track the value in state. The input manages its own value internally.
|
|
279
|
+
|
|
280
|
+
```tsx
|
|
281
|
+
<Input defaultValue="Initial text" placeholder="Type in here..." />
|
|
282
|
+
```
|
|
245
283
|
|
|
246
|
-
|
|
284
|
+
## Common Use Cases
|
|
247
285
|
|
|
248
|
-
|
|
286
|
+
### Login Form
|
|
249
287
|
|
|
250
288
|
```tsx
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
289
|
+
function LoginForm() {
|
|
290
|
+
const [email, setEmail] = useState('');
|
|
291
|
+
const [password, setPassword] = useState('');
|
|
292
|
+
|
|
293
|
+
return (
|
|
294
|
+
<Stack spacing={2}>
|
|
295
|
+
<Input
|
|
296
|
+
label="Email"
|
|
297
|
+
type="email"
|
|
298
|
+
placeholder="you@example.com"
|
|
299
|
+
required
|
|
300
|
+
value={email}
|
|
301
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
302
|
+
/>
|
|
303
|
+
<Input
|
|
304
|
+
label="Password"
|
|
305
|
+
type="password"
|
|
306
|
+
placeholder="Enter your password"
|
|
307
|
+
required
|
|
308
|
+
value={password}
|
|
309
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
310
|
+
/>
|
|
311
|
+
<Button type="submit">Sign In</Button>
|
|
312
|
+
</Stack>
|
|
313
|
+
);
|
|
314
|
+
}
|
|
254
315
|
```
|
|
255
316
|
|
|
256
|
-
###
|
|
317
|
+
### Search Field with Clear
|
|
257
318
|
|
|
258
|
-
|
|
319
|
+
```tsx
|
|
320
|
+
function SearchField({ onSearch }) {
|
|
321
|
+
const [query, setQuery] = useState('');
|
|
322
|
+
|
|
323
|
+
return (
|
|
324
|
+
<Input
|
|
325
|
+
placeholder="Search..."
|
|
326
|
+
startDecorator={<SearchIcon />}
|
|
327
|
+
enableClearable
|
|
328
|
+
value={query}
|
|
329
|
+
onChange={(e) => {
|
|
330
|
+
setQuery(e.target.value);
|
|
331
|
+
onSearch(e.target.value);
|
|
332
|
+
}}
|
|
333
|
+
/>
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
```
|
|
259
337
|
|
|
260
|
-
|
|
338
|
+
### Form with Validation
|
|
261
339
|
|
|
262
|
-
|
|
340
|
+
```tsx
|
|
341
|
+
function ProfileForm() {
|
|
342
|
+
const [name, setName] = useState('');
|
|
343
|
+
const [submitted, setSubmitted] = useState(false);
|
|
344
|
+
const hasError = submitted && name.trim().length === 0;
|
|
345
|
+
|
|
346
|
+
return (
|
|
347
|
+
<Stack spacing={2}>
|
|
348
|
+
<Input
|
|
349
|
+
label="Full Name"
|
|
350
|
+
required
|
|
351
|
+
placeholder="John Doe"
|
|
352
|
+
value={name}
|
|
353
|
+
onChange={(e) => setName(e.target.value)}
|
|
354
|
+
error={hasError}
|
|
355
|
+
helperText={hasError ? 'Name is required' : 'Enter your legal name'}
|
|
356
|
+
/>
|
|
357
|
+
<Button onClick={() => setSubmitted(true)}>Save</Button>
|
|
358
|
+
</Stack>
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
```
|
|
263
362
|
|
|
264
|
-
|
|
265
|
-
- 키보드 탐색이 가능합니다.
|
|
266
|
-
- 오류 상태는 시각적으로 명확하게 표시됩니다.
|
|
363
|
+
## Best Practices
|
|
267
364
|
|
|
268
|
-
|
|
365
|
+
1. **Always provide a label**: Every input should have a visible label so users understand what to enter.
|
|
269
366
|
|
|
270
|
-
|
|
367
|
+
```tsx
|
|
368
|
+
// ✅ Good: clear label
|
|
369
|
+
<Input label="Email address" placeholder="you@example.com" />
|
|
271
370
|
|
|
272
|
-
|
|
273
|
-
|
|
371
|
+
// ❌ Bad: placeholder only, no label
|
|
372
|
+
<Input placeholder="Email address" />
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
2. **Use helper text for guidance, error text for problems**: Provide contextual help via `helperText`, and switch to error messaging when validation fails.
|
|
274
376
|
|
|
275
377
|
```tsx
|
|
276
|
-
//
|
|
277
|
-
|
|
378
|
+
// ✅ Good: helpful context + error state
|
|
379
|
+
<Input
|
|
380
|
+
label="Password"
|
|
381
|
+
type="password"
|
|
382
|
+
helperText={hasError ? 'Must be at least 8 characters' : 'Choose a strong password'}
|
|
383
|
+
error={hasError}
|
|
384
|
+
/>
|
|
385
|
+
|
|
386
|
+
// ❌ Bad: no guidance at all
|
|
387
|
+
<Input label="Password" type="password" />
|
|
278
388
|
```
|
|
279
389
|
|
|
280
|
-
|
|
390
|
+
3. **Choose the right input type**: Use `type` to match the expected data (e.g., `email`, `tel`, `password`, `number`). This enables appropriate browser behavior and mobile keyboards.
|
|
391
|
+
|
|
392
|
+
```tsx
|
|
393
|
+
// ✅ Good: appropriate type for email
|
|
394
|
+
<Input label="Email" type="email" />
|
|
281
395
|
|
|
282
|
-
|
|
283
|
-
|
|
396
|
+
// ❌ Bad: generic text type for email
|
|
397
|
+
<Input label="Email" type="text" />
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
4. **Use `enableClearable` for search and filter inputs**: Allow users to quickly reset their input in search and filter contexts.
|
|
401
|
+
|
|
402
|
+
5. **Use built-in form props instead of manual composition**: Prefer `label`, `helperText`, `error`, and `required` props over wrapping with FormControl and Typography. This ensures consistent spacing, accessibility, and error handling.
|
|
403
|
+
|
|
404
|
+
## Accessibility
|
|
405
|
+
|
|
406
|
+
- **Label association**: The `label` prop automatically creates a properly associated `<label>` element. If you cannot use the `label` prop, provide an `aria-label` or `aria-labelledby` attribute.
|
|
407
|
+
- **Error announcement**: When `error` is set, the error state is conveyed to assistive technologies via `aria-invalid`. Combine with descriptive `helperText` so screen readers can announce the error message.
|
|
408
|
+
- **Keyboard interaction**: Input supports standard keyboard behavior. The clear button and password toggle are focusable and can be activated with Enter or Space.
|
|
409
|
+
- **Testing note**: When using Testing Library, find a `type="password"` input using the `textbox` role, as ARIA does not define a separate `password` role.
|
|
410
|
+
|
|
411
|
+
```tsx
|
|
412
|
+
// Finding a password input in tests
|
|
413
|
+
const passwordInput = screen.getByRole('textbox', { name: /password/i });
|
|
414
|
+
```
|