@ceed/ads 1.23.3 → 1.23.4

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.
Files changed (43) hide show
  1. package/dist/components/data-display/Badge.md +71 -39
  2. package/dist/components/data-display/InfoSign.md +74 -98
  3. package/dist/components/data-display/Typography.md +310 -61
  4. package/dist/components/feedback/CircularProgress.md +257 -0
  5. package/dist/components/feedback/Skeleton.md +280 -0
  6. package/dist/components/feedback/llms.txt +2 -0
  7. package/dist/components/inputs/ButtonGroup.md +115 -106
  8. package/dist/components/inputs/Calendar.md +98 -459
  9. package/dist/components/inputs/CurrencyInput.md +181 -8
  10. package/dist/components/inputs/DatePicker.md +108 -436
  11. package/dist/components/inputs/DateRangePicker.md +130 -496
  12. package/dist/components/inputs/FilterMenu.md +169 -19
  13. package/dist/components/inputs/FilterableCheckboxGroup.md +119 -24
  14. package/dist/components/inputs/FormControl.md +368 -0
  15. package/dist/components/inputs/IconButton.md +137 -88
  16. package/dist/components/inputs/MonthPicker.md +95 -427
  17. package/dist/components/inputs/MonthRangePicker.md +89 -471
  18. package/dist/components/inputs/PercentageInput.md +183 -19
  19. package/dist/components/inputs/RadioButton.md +163 -35
  20. package/dist/components/inputs/RadioList.md +241 -0
  21. package/dist/components/inputs/RadioTileGroup.md +146 -62
  22. package/dist/components/inputs/Select.md +219 -328
  23. package/dist/components/inputs/Slider.md +334 -0
  24. package/dist/components/inputs/Switch.md +136 -376
  25. package/dist/components/inputs/Textarea.md +209 -11
  26. package/dist/components/inputs/Uploader/Uploader.md +145 -66
  27. package/dist/components/inputs/llms.txt +3 -0
  28. package/dist/components/navigation/Breadcrumbs.md +80 -322
  29. package/dist/components/navigation/Dropdown.md +92 -221
  30. package/dist/components/navigation/IconMenuButton.md +40 -502
  31. package/dist/components/navigation/InsetDrawer.md +68 -738
  32. package/dist/components/navigation/Link.md +39 -298
  33. package/dist/components/navigation/Menu.md +92 -285
  34. package/dist/components/navigation/MenuButton.md +55 -448
  35. package/dist/components/navigation/Pagination.md +47 -338
  36. package/dist/components/navigation/ProfileMenu.md +45 -268
  37. package/dist/components/navigation/Stepper.md +160 -28
  38. package/dist/components/navigation/Tabs.md +57 -316
  39. package/dist/components/surfaces/Sheet.md +150 -333
  40. package/dist/guides/ThemeProvider.md +116 -0
  41. package/dist/guides/llms.txt +9 -0
  42. package/dist/llms.txt +8 -0
  43. package/package.json +1 -1
@@ -0,0 +1,368 @@
1
+ # FormControl
2
+
3
+ ## Introduction
4
+
5
+ FormControl is a wrapper component that provides context to form elements such as Input, Textarea, Select, and more. It manages shared states like `error`, `disabled`, `required`, and `size`, passing them down to its children automatically. Use it with FormLabel and FormHelperText to build accessible, consistent form fields.
6
+
7
+ ```tsx
8
+ <FormControl {...args}>
9
+ <FormLabel>Label</FormLabel>
10
+ <Input placeholder="Enter text…" />
11
+ <FormHelperText>This is helper text.</FormHelperText>
12
+ </FormControl>
13
+ ```
14
+
15
+ | Field | Description | Default |
16
+ | ----------- | ----------- | ------- |
17
+ | size | — | — |
18
+ | error | — | — |
19
+ | disabled | — | — |
20
+ | required | — | — |
21
+ | orientation | — | — |
22
+
23
+ ## Usage
24
+
25
+ ```tsx
26
+ import { FormControl, FormLabel, FormHelperText, Input } from '@ceed/ads';
27
+
28
+ function MyForm() {
29
+ return (
30
+ <FormControl>
31
+ <FormLabel>Username</FormLabel>
32
+ <Input placeholder="Enter username" />
33
+ <FormHelperText>Choose a unique username.</FormHelperText>
34
+ </FormControl>
35
+ );
36
+ }
37
+ ```
38
+
39
+ ## With Input
40
+
41
+ The most common pattern — wrapping an Input with a label and helper text.
42
+
43
+ ```tsx
44
+ <FormControl>
45
+ <FormLabel>Username</FormLabel>
46
+ <Input placeholder="Enter username" />
47
+ <FormHelperText>Choose a unique username.</FormHelperText>
48
+ </FormControl>
49
+ ```
50
+
51
+ ## With Textarea
52
+
53
+ FormControl works equally well with Textarea components.
54
+
55
+ ```tsx
56
+ <FormControl>
57
+ <FormLabel>Description</FormLabel>
58
+ <Textarea placeholder="Enter description…" minRows={3} />
59
+ <FormHelperText>Provide a detailed description.</FormHelperText>
60
+ </FormControl>
61
+ ```
62
+
63
+ ## With Select
64
+
65
+ Use FormControl with Select for dropdown fields.
66
+
67
+ ```tsx
68
+ <FormControl>
69
+ <FormLabel>Role</FormLabel>
70
+ <Select placeholder="Select a role">
71
+ <Option value="admin">Admin</Option>
72
+ <Option value="editor">Editor</Option>
73
+ <Option value="viewer">Viewer</Option>
74
+ </Select>
75
+ <FormHelperText>Select the user role.</FormHelperText>
76
+ </FormControl>
77
+ ```
78
+
79
+ ## Error State
80
+
81
+ Set `error` on FormControl to propagate the error state to all child components. FormHelperText automatically changes color to indicate the error.
82
+
83
+ ```tsx
84
+ <FormControl error>
85
+ <FormLabel>Email</FormLabel>
86
+ <Input placeholder="email@example.com" value="invalid-email" />
87
+ <FormHelperText>Please enter a valid email address.</FormHelperText>
88
+ </FormControl>
89
+ ```
90
+
91
+ ```tsx
92
+ <FormControl error>
93
+ <FormLabel>Email</FormLabel>
94
+ <Input placeholder="email@example.com" value="invalid-email" />
95
+ <FormHelperText>Please enter a valid email address.</FormHelperText>
96
+ </FormControl>
97
+ ```
98
+
99
+ ## Disabled State
100
+
101
+ Set `disabled` to disable all child form elements at once.
102
+
103
+ ```tsx
104
+ <FormControl disabled>
105
+ <FormLabel>Name</FormLabel>
106
+ <Input placeholder="Enter name" value="John Doe" />
107
+ <FormHelperText>This field is disabled.</FormHelperText>
108
+ </FormControl>
109
+ ```
110
+
111
+ ```tsx
112
+ <FormControl disabled>
113
+ <FormLabel>Name</FormLabel>
114
+ <Input placeholder="Enter name" value="John Doe" />
115
+ <FormHelperText>This field is disabled.</FormHelperText>
116
+ </FormControl>
117
+ ```
118
+
119
+ ## Required Field
120
+
121
+ Set `required` to add an asterisk (\*) to the label and mark the field as required.
122
+
123
+ ```tsx
124
+ <FormControl required>
125
+ <FormLabel>Full Name</FormLabel>
126
+ <Input placeholder="Enter your full name" />
127
+ <FormHelperText>This field is required.</FormHelperText>
128
+ </FormControl>
129
+ ```
130
+
131
+ ```tsx
132
+ <FormControl required>
133
+ <FormLabel>Full Name</FormLabel>
134
+ <Input placeholder="Enter your full name" />
135
+ </FormControl>
136
+ ```
137
+
138
+ ## Sizes
139
+
140
+ FormControl supports `sm`, `md`, and `lg` sizes. The size is inherited by child components.
141
+
142
+ ```tsx
143
+ <Stack gap={3}>
144
+ <FormControl size="sm">
145
+ <FormLabel>Small</FormLabel>
146
+ <Input placeholder="Small input" />
147
+ </FormControl>
148
+ <FormControl size="md">
149
+ <FormLabel>Medium</FormLabel>
150
+ <Input placeholder="Medium input" />
151
+ </FormControl>
152
+ <FormControl size="lg">
153
+ <FormLabel>Large</FormLabel>
154
+ <Input placeholder="Large input" />
155
+ </FormControl>
156
+ </Stack>
157
+ ```
158
+
159
+ ## Horizontal Layout
160
+
161
+ Use `orientation="horizontal"` for inline form controls, such as Switch or Checkbox toggles.
162
+
163
+ ```tsx
164
+ <FormControl orientation="horizontal" sx={{
165
+ gap: 2
166
+ }}>
167
+ <FormLabel>Subscribe</FormLabel>
168
+ <Switch />
169
+ </FormControl>
170
+ ```
171
+
172
+ ```tsx
173
+ <FormControl orientation="horizontal" sx={{ gap: 2 }}>
174
+ <FormLabel>Subscribe</FormLabel>
175
+ <Switch />
176
+ </FormControl>
177
+ ```
178
+
179
+ ## Form Example
180
+
181
+ A complete form demonstrating FormControl with multiple input types.
182
+
183
+ ```tsx
184
+ <Stack gap={2} sx={{
185
+ maxWidth: 400
186
+ }}>
187
+ <FormControl required>
188
+ <FormLabel>Name</FormLabel>
189
+ <Input placeholder="Enter your name" />
190
+ </FormControl>
191
+ <FormControl required>
192
+ <FormLabel>Email</FormLabel>
193
+ <Input type="email" placeholder="email@example.com" />
194
+ <FormHelperText>We will never share your email.</FormHelperText>
195
+ </FormControl>
196
+ <FormControl>
197
+ <FormLabel>Role</FormLabel>
198
+ <Select placeholder="Select a role">
199
+ <Option value="admin">Admin</Option>
200
+ <Option value="editor">Editor</Option>
201
+ <Option value="viewer">Viewer</Option>
202
+ </Select>
203
+ </FormControl>
204
+ <FormControl>
205
+ <FormLabel>Bio</FormLabel>
206
+ <Textarea placeholder="Tell us about yourself…" minRows={3} />
207
+ <FormHelperText>Maximum 500 characters.</FormHelperText>
208
+ </FormControl>
209
+ </Stack>
210
+ ```
211
+
212
+ ## FormLabel
213
+
214
+ FormLabel renders a `<label>` element associated with its sibling input. It automatically displays an asterisk when the parent FormControl has `required` set.
215
+
216
+ ```tsx
217
+ <FormControl required>
218
+ <FormLabel>Email</FormLabel>
219
+ <Input />
220
+ </FormControl>
221
+ ```
222
+
223
+ ## FormHelperText
224
+
225
+ FormHelperText provides supplementary guidance below the input. It automatically switches to the error color when the parent FormControl has `error` set.
226
+
227
+ ```tsx
228
+ <FormControl error>
229
+ <FormLabel>Password</FormLabel>
230
+ <Input type="password" />
231
+ <FormHelperText>Password must be at least 8 characters.</FormHelperText>
232
+ </FormControl>
233
+ ```
234
+
235
+ ## Common Use Cases
236
+
237
+ ### Registration Form
238
+
239
+ ```tsx
240
+ function RegistrationForm() {
241
+ const [errors, setErrors] = React.useState({});
242
+
243
+ return (
244
+ <Stack gap={2} component="form">
245
+ <FormControl required error={!!errors.name}>
246
+ <FormLabel>Name</FormLabel>
247
+ <Input placeholder="Enter your name" />
248
+ {errors.name && <FormHelperText>{errors.name}</FormHelperText>}
249
+ </FormControl>
250
+
251
+ <FormControl required error={!!errors.email}>
252
+ <FormLabel>Email</FormLabel>
253
+ <Input type="email" placeholder="email@example.com" />
254
+ {errors.email && <FormHelperText>{errors.email}</FormHelperText>}
255
+ </FormControl>
256
+
257
+ <FormControl required error={!!errors.password}>
258
+ <FormLabel>Password</FormLabel>
259
+ <Input type="password" placeholder="Enter password" />
260
+ <FormHelperText>
261
+ {errors.password || 'Must be at least 8 characters.'}
262
+ </FormHelperText>
263
+ </FormControl>
264
+
265
+ <FormControl orientation="horizontal">
266
+ <Checkbox label="I agree to the terms and conditions" />
267
+ </FormControl>
268
+ </Stack>
269
+ );
270
+ }
271
+ ```
272
+
273
+ ### Settings Form with Mixed Controls
274
+
275
+ ```tsx
276
+ function SettingsForm() {
277
+ return (
278
+ <Stack gap={2}>
279
+ <FormControl orientation="horizontal" sx={{ justifyContent: 'space-between' }}>
280
+ <FormLabel>Email notifications</FormLabel>
281
+ <Switch />
282
+ </FormControl>
283
+
284
+ <FormControl>
285
+ <FormLabel>Language</FormLabel>
286
+ <Select defaultValue="en">
287
+ <Option value="en">English</Option>
288
+ <Option value="ko">한국어</Option>
289
+ </Select>
290
+ </FormControl>
291
+
292
+ <FormControl>
293
+ <FormLabel>Notes</FormLabel>
294
+ <Textarea minRows={3} placeholder="Additional notes…" />
295
+ <FormHelperText>Optional</FormHelperText>
296
+ </FormControl>
297
+ </Stack>
298
+ );
299
+ }
300
+ ```
301
+
302
+ > **Tip: Use built-in form props instead**
303
+ >
304
+ > Input, Select, Textarea, DatePicker 등 Input 계열 컴포넌트는 `label`, `helperText` prop을 자체적으로 지원합니다.
305
+ > 간단한 form 필드에는 각 컴포넌트의 내장 prop을 사용하는 것이 더 간결합니다.
306
+ >
307
+ > ```tsx
308
+ > // ✅ Simpler: built-in props
309
+ > <Input label="Username" helperText="Choose a unique username." />
310
+ >
311
+ > // ⬆️ Equivalent to:
312
+ > <FormControl>
313
+ > <FormLabel>Username</FormLabel>
314
+ > <Input placeholder="Enter username" />
315
+ > <FormHelperText>Choose a unique username.</FormHelperText>
316
+ > </FormControl>
317
+ > ```
318
+ >
319
+ > FormControl is most useful when you need to compose multiple elements, share state across siblings, or use horizontal orientation.
320
+
321
+ ## Best Practices
322
+
323
+ 1. **Always pair with FormLabel**: Every form field should have a label for accessibility. Use FormLabel inside FormControl.
324
+
325
+ ```tsx
326
+ // ✅ Accessible — label is associated with input
327
+ <FormControl>
328
+ <FormLabel>Email</FormLabel>
329
+ <Input />
330
+ </FormControl>
331
+
332
+ // ❌ No label — screen readers cannot identify the input
333
+ <FormControl>
334
+ <Input placeholder="Email" />
335
+ </FormControl>
336
+ ```
337
+
338
+ 2. **Use `error` prop on FormControl, not children**: Set error state on FormControl so all children react consistently.
339
+
340
+ ```tsx
341
+ // ✅ Error propagated from FormControl
342
+ <FormControl error>
343
+ <FormLabel>Email</FormLabel>
344
+ <Input />
345
+ <FormHelperText>Invalid email</FormHelperText>
346
+ </FormControl>
347
+
348
+ // ❌ Inconsistent — only Input shows error
349
+ <FormControl>
350
+ <FormLabel>Email</FormLabel>
351
+ <Input error />
352
+ <FormHelperText>Invalid email</FormHelperText>
353
+ </FormControl>
354
+ ```
355
+
356
+ 3. **Use consistent sizing**: Set `size` on FormControl to ensure all children (label, input, helper text) are proportionally sized.
357
+
358
+ 4. **Mark required fields**: Use the `required` prop to automatically add visual indicators and `aria-required` attributes.
359
+
360
+ 5. **Provide helpful error messages**: When using the error state, always include a FormHelperText explaining what went wrong and how to fix it.
361
+
362
+ ## Accessibility
363
+
364
+ - FormControl automatically associates FormLabel with the input using `htmlFor` and `id`.
365
+ - The `required` prop adds `aria-required="true"` to the input and an asterisk to the label.
366
+ - The `error` prop adds `aria-invalid="true"` to the input.
367
+ - FormHelperText is linked to the input via `aria-describedby` so screen readers announce it.
368
+ - Use the `disabled` prop on FormControl to set `aria-disabled` on child elements.