@ceed/cds 1.28.1 → 1.29.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/Overview.md +5 -5
- package/dist/components/DatePicker/DatePicker.d.ts +10 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +10 -0
- package/dist/components/data-display/Avatar.md +110 -69
- package/dist/components/data-display/Badge.md +91 -39
- package/dist/components/data-display/Chip.md +49 -20
- package/dist/components/data-display/DataTable.md +93 -0
- package/dist/components/data-display/InfoSign.md +12 -0
- package/dist/components/data-display/Table.md +72 -55
- package/dist/components/data-display/Tooltip.md +40 -40
- package/dist/components/data-display/Typography.md +53 -70
- package/dist/components/feedback/Alert.md +88 -72
- package/dist/components/feedback/CircularProgress.md +17 -0
- package/dist/components/feedback/Skeleton.md +17 -0
- package/dist/components/inputs/Button.md +94 -68
- package/dist/components/inputs/ButtonGroup.md +17 -0
- package/dist/components/inputs/Calendar.md +118 -457
- package/dist/components/inputs/Checkbox.md +185 -430
- package/dist/components/inputs/CurrencyInput.md +22 -0
- package/dist/components/inputs/DatePicker.md +84 -0
- package/dist/components/inputs/DateRangePicker.md +88 -0
- package/dist/components/inputs/FilterableCheckboxGroup.md +20 -3
- package/dist/components/inputs/FormControl.md +32 -2
- package/dist/components/inputs/IconButton.md +18 -0
- package/dist/components/inputs/Input.md +198 -136
- package/dist/components/inputs/MonthPicker.md +25 -0
- package/dist/components/inputs/MonthRangePicker.md +23 -0
- package/dist/components/inputs/PercentageInput.md +25 -0
- package/dist/components/inputs/RadioButton.md +23 -0
- package/dist/components/inputs/RadioList.md +20 -1
- package/dist/components/inputs/RadioTileGroup.md +37 -3
- package/dist/components/inputs/Select.md +56 -0
- package/dist/components/inputs/Slider.md +23 -0
- package/dist/components/inputs/Switch.md +20 -0
- package/dist/components/inputs/Textarea.md +32 -8
- package/dist/components/inputs/Uploader/Uploader.md +21 -0
- package/dist/components/layout/Box.md +52 -41
- package/dist/components/layout/Grid.md +87 -81
- package/dist/components/layout/Stack.md +88 -68
- package/dist/components/navigation/Breadcrumbs.md +57 -46
- package/dist/components/navigation/Drawer.md +17 -0
- package/dist/components/navigation/Dropdown.md +13 -0
- package/dist/components/navigation/IconMenuButton.md +17 -0
- package/dist/components/navigation/InsetDrawer.md +130 -292
- package/dist/components/navigation/Link.md +78 -0
- package/dist/components/navigation/Menu.md +17 -0
- package/dist/components/navigation/MenuButton.md +18 -0
- package/dist/components/navigation/Pagination.md +13 -0
- package/dist/components/navigation/Stepper.md +15 -0
- package/dist/components/navigation/Tabs.md +27 -0
- package/dist/components/surfaces/Accordions.md +804 -49
- package/dist/components/surfaces/Card.md +173 -97
- package/dist/components/surfaces/Divider.md +246 -82
- package/dist/components/surfaces/Sheet.md +15 -0
- package/dist/index.browser.js +2 -2
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +173 -6
- package/dist/index.js +173 -6
- package/framer/index.js +1 -1
- package/package.json +1 -1
|
@@ -165,7 +165,7 @@ function LanguageSetting() {
|
|
|
165
165
|
<RadioList
|
|
166
166
|
items={[
|
|
167
167
|
{ label: 'English', value: 'en' },
|
|
168
|
-
{ label: '
|
|
168
|
+
{ label: 'Korean', value: 'ko' },
|
|
169
169
|
{ label: '日本語', value: 'ja' },
|
|
170
170
|
]}
|
|
171
171
|
value={language}
|
|
@@ -233,6 +233,25 @@ function RoleSelector({ roles }: { roles: { id: string; name: string }[] }) {
|
|
|
233
233
|
|
|
234
234
|
5. **Use horizontal layout sparingly**: Horizontal orientation works well for 2–4 short options. For longer lists, vertical is more readable.
|
|
235
235
|
|
|
236
|
+
## Props and Customization
|
|
237
|
+
|
|
238
|
+
### Key Props
|
|
239
|
+
|
|
240
|
+
| Prop | Type | Default | Description |
|
|
241
|
+
| -------------- | -------------------------------------------------------------- | ------------ | ------------------------------------------ |
|
|
242
|
+
| `items` | `{ label: ReactNode; value: string }[]` | (required) | Array of radio options |
|
|
243
|
+
| `value` | `string` | - | Selected value (controlled mode) |
|
|
244
|
+
| `defaultValue` | `string` | - | Initial selected value (uncontrolled mode) |
|
|
245
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Callback when selection changes |
|
|
246
|
+
| `name` | `string` | - | Groups radios together for form submission |
|
|
247
|
+
| `disabled` | `boolean` | `false` | Disables all radio buttons |
|
|
248
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'vertical'` | Layout orientation |
|
|
249
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Radio button size |
|
|
250
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'primary'` | Color scheme |
|
|
251
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
252
|
+
|
|
253
|
+
> **Note**: RadioList also accepts all Joy UI RadioGroup props.
|
|
254
|
+
|
|
236
255
|
## Accessibility
|
|
237
256
|
|
|
238
257
|
- RadioList renders a `<RadioGroup>` with `role="radiogroup"`, and each option is a `<Radio>` with `role="radio"`.
|
|
@@ -6,10 +6,10 @@ RadioTileGroup is a selection component that displays radio options as visually
|
|
|
6
6
|
|
|
7
7
|
The component supports flexible layouts (horizontal, grid, vertical), icons via `startDecorator`, three sizes, and built-in form integration with `label`, `helperText`, `error`, and `required` props. It works in both controlled and uncontrolled modes.
|
|
8
8
|
|
|
9
|
-
> **
|
|
9
|
+
> **Using built-in props is recommended when building forms**
|
|
10
10
|
>
|
|
11
|
-
>
|
|
12
|
-
>
|
|
11
|
+
> This component provides built-in form-related props such as `label` and `helperText`.
|
|
12
|
+
> When building a form, use the component's built-in props instead of creating separate labels or helper text with Typography.
|
|
13
13
|
|
|
14
14
|
```tsx
|
|
15
15
|
<RadioTileGroup
|
|
@@ -499,6 +499,40 @@ Use a vertical layout with `columns={1}` for plan or tier selection.
|
|
|
499
499
|
|
|
500
500
|
5. **Always provide an error message.** When `error` is true, update `helperText` to explain the validation issue so users know how to fix it.
|
|
501
501
|
|
|
502
|
+
## Props and Customization
|
|
503
|
+
|
|
504
|
+
### Key Props
|
|
505
|
+
|
|
506
|
+
| Prop | Type | Default | Description |
|
|
507
|
+
| -------------- | ------------------------------------------------ | ---------- | ------------------------------------------ |
|
|
508
|
+
| `options` | `RadioTileOption[]` | (required) | Array of radio tile options |
|
|
509
|
+
| `value` | `T` | - | Selected value (controlled mode) |
|
|
510
|
+
| `defaultValue` | `T` | - | Initial selected value (uncontrolled mode) |
|
|
511
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Callback when selection changes |
|
|
512
|
+
| `name` | `string` | - | Groups radios together for form submission |
|
|
513
|
+
| `label` | `ReactNode` | - | Group label displayed above the tiles |
|
|
514
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the tiles |
|
|
515
|
+
| `error` | `boolean` | `false` | Applies error styling |
|
|
516
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
517
|
+
| `disabled` | `boolean` | `false` | Disables all radio tiles |
|
|
518
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'sm'` | Tile size |
|
|
519
|
+
| `flex` | `boolean` | `false` | Tiles stretch to fill available width |
|
|
520
|
+
| `columns` | `number` | - | Fixed number of columns in grid layout |
|
|
521
|
+
| `textAlign` | `'start' \| 'center'` | `'center'` | Text alignment within tiles |
|
|
522
|
+
| `useIndicator` | `boolean` | `false` | Shows a radio indicator on each tile |
|
|
523
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
524
|
+
|
|
525
|
+
### RadioTileOption
|
|
526
|
+
|
|
527
|
+
```tsx
|
|
528
|
+
interface RadioTileOption<T = string> {
|
|
529
|
+
value: T;
|
|
530
|
+
label: ReactNode;
|
|
531
|
+
disabled?: boolean;
|
|
532
|
+
startDecorator?: ReactNode;
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
502
536
|
## Accessibility
|
|
503
537
|
|
|
504
538
|
- RadioTileGroup renders a `<fieldset>` with a `<legend>` derived from the `label` prop, providing proper grouping for screen readers.
|
|
@@ -544,6 +544,62 @@ function LocationSelect() {
|
|
|
544
544
|
</FormControl>
|
|
545
545
|
```
|
|
546
546
|
|
|
547
|
+
## Props and Customization
|
|
548
|
+
|
|
549
|
+
### Key Props
|
|
550
|
+
|
|
551
|
+
| Prop | Type | Default | Description |
|
|
552
|
+
| ---------------- | ---------------------------------------------------------------- | ----------------- | ---------------------------------------------------- |
|
|
553
|
+
| `options` | `OptionType[]` | `[]` | Array of options (objects or primitives) |
|
|
554
|
+
| `value` | `InferOptionValue<OptionType> \| InferOptionValue<OptionType>[]` | - | Selected value(s) for controlled mode |
|
|
555
|
+
| `defaultValue` | `InferOptionValue<OptionType> \| InferOptionValue<OptionType>[]` | - | Initial value for uncontrolled mode |
|
|
556
|
+
| `onChange` | `(event: { target: { name?, value } }, newValue) => void` | - | Callback when selection changes |
|
|
557
|
+
| `multiple` | `boolean` | `false` | Allow multiple selections (value becomes an array) |
|
|
558
|
+
| `label` | `string` | - | Form label displayed above the select |
|
|
559
|
+
| `helperText` | `string` | - | Helper text displayed below the select |
|
|
560
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
561
|
+
| `required` | `boolean` | `false` | Marks the field as required (adds asterisk to label) |
|
|
562
|
+
| `disabled` | `boolean` | `false` | Disables the select |
|
|
563
|
+
| `placeholder` | `string` | `'Choose one...'` | Placeholder text when no value is selected |
|
|
564
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Select size |
|
|
565
|
+
| `variant` | `'outlined' \| 'plain' \| 'solid' \| 'soft'` | `'outlined'` | Visual style variant |
|
|
566
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
567
|
+
| `startDecorator` | `ReactNode` | - | Content rendered before the select trigger text |
|
|
568
|
+
| `endDecorator` | `ReactNode` | - | Content rendered after the select trigger text |
|
|
569
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
570
|
+
|
|
571
|
+
### Option Type
|
|
572
|
+
|
|
573
|
+
Options can be objects or primitives:
|
|
574
|
+
|
|
575
|
+
```tsx
|
|
576
|
+
type OptionType =
|
|
577
|
+
| { label: string; value: string | number; disabled?: boolean; secondaryText?: string }
|
|
578
|
+
| string
|
|
579
|
+
| number;
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Generic Type Support
|
|
583
|
+
|
|
584
|
+
Select supports TypeScript generics for type-safe value handling:
|
|
585
|
+
|
|
586
|
+
```tsx
|
|
587
|
+
// Type-safe with object options
|
|
588
|
+
const options = [
|
|
589
|
+
{ value: 1, label: 'Option 1' },
|
|
590
|
+
{ value: 2, label: 'Option 2' },
|
|
591
|
+
] as const;
|
|
592
|
+
|
|
593
|
+
<Select<typeof options[number], false>
|
|
594
|
+
options={options}
|
|
595
|
+
onChange={(e, val) => {
|
|
596
|
+
// val is typed as number
|
|
597
|
+
}}
|
|
598
|
+
/>
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
> **Note**: Select also accepts all Joy UI Select props.
|
|
602
|
+
|
|
547
603
|
## Accessibility
|
|
548
604
|
|
|
549
605
|
- **Label association**: When you use the `label` prop, the component automatically connects the label to the select element via `aria-labelledby`. Always provide a label for screen reader users.
|
|
@@ -326,6 +326,29 @@ function TemperatureSetting() {
|
|
|
326
326
|
|
|
327
327
|
5. **Set a reasonable `step`**: For large ranges (0–1000), use a step > 1 to prevent overwhelming precision. For small ranges (0–1), use decimal steps.
|
|
328
328
|
|
|
329
|
+
## Props and Customization
|
|
330
|
+
|
|
331
|
+
### Key Props
|
|
332
|
+
|
|
333
|
+
| Prop | Type | Default | Description |
|
|
334
|
+
| ------------------- | -------------------------------------------------------------- | -------------- | --------------------------------------------------- |
|
|
335
|
+
| `value` | `number \| number[]` | - | Current value (controlled). Array for range sliders |
|
|
336
|
+
| `defaultValue` | `number \| number[]` | `0` | Initial value (uncontrolled) |
|
|
337
|
+
| `onChange` | `(event: Event, value: number \| number[]) => void` | - | Callback when the value changes |
|
|
338
|
+
| `min` | `number` | `0` | Minimum allowed value |
|
|
339
|
+
| `max` | `number` | `100` | Maximum allowed value |
|
|
340
|
+
| `step` | `number` | `1` | Step increment between values |
|
|
341
|
+
| `marks` | `boolean \| { value: number; label?: string }[]` | `false` | Show marks on the slider track |
|
|
342
|
+
| `valueLabelDisplay` | `'on' \| 'off' \| 'auto'` | `'auto'` | When to display the value label |
|
|
343
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Slider orientation |
|
|
344
|
+
| `disabled` | `boolean` | `false` | Disables the slider |
|
|
345
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Slider size |
|
|
346
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'primary'` | Color scheme |
|
|
347
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'solid'` | Visual style |
|
|
348
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
349
|
+
|
|
350
|
+
> **Note**: Slider also accepts all Joy UI Slider props.
|
|
351
|
+
|
|
329
352
|
## Accessibility
|
|
330
353
|
|
|
331
354
|
- Slider renders with `role="slider"` and appropriate `aria-valuemin`, `aria-valuemax`, and `aria-valuenow` attributes.
|
|
@@ -329,6 +329,26 @@ function FeatureToggle() {
|
|
|
329
329
|
|
|
330
330
|
5. **Group related switches logically**: Place related switches under a shared heading and use consistent spacing to create a scannable settings layout.
|
|
331
331
|
|
|
332
|
+
## Props and Customization
|
|
333
|
+
|
|
334
|
+
### Key Props
|
|
335
|
+
|
|
336
|
+
| Prop | Type | Default | Description |
|
|
337
|
+
| ---------------- | -------------------------------------------------------------- | ----------- | ------------------------------------- |
|
|
338
|
+
| `checked` | `boolean` | - | Whether the switch is on (controlled) |
|
|
339
|
+
| `defaultChecked` | `boolean` | `false` | Initial state (uncontrolled) |
|
|
340
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Callback when the state changes |
|
|
341
|
+
| `disabled` | `boolean` | `false` | Disables the switch |
|
|
342
|
+
| `readOnly` | `boolean` | `false` | Makes the switch read-only |
|
|
343
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme when checked |
|
|
344
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Switch size |
|
|
345
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'solid'` | Visual style |
|
|
346
|
+
| `startDecorator` | `ReactNode` | - | Content rendered before the switch |
|
|
347
|
+
| `endDecorator` | `ReactNode` | - | Content rendered after the switch |
|
|
348
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
349
|
+
|
|
350
|
+
> **Note**: Switch also accepts all Joy UI Switch props and Framer Motion props.
|
|
351
|
+
|
|
332
352
|
## Accessibility
|
|
333
353
|
|
|
334
354
|
- **Role and state**: The Switch renders an `<input type="checkbox" role="switch">` with `aria-checked` reflecting the current state. Screen readers announce it as a switch, not a checkbox.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
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
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
|
|
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
8
|
|
|
9
9
|
> **Use built-in form props**
|
|
10
10
|
>
|
|
@@ -133,28 +133,28 @@ Use the `required`, `label`, and `helperText` props together to build complete f
|
|
|
133
133
|
|
|
134
134
|
## Common Use Cases
|
|
135
135
|
|
|
136
|
-
###
|
|
136
|
+
### Feedback Form
|
|
137
137
|
|
|
138
138
|
```tsx
|
|
139
139
|
import { Textarea, Button, Stack } from '@ceed/cds';
|
|
140
140
|
|
|
141
|
-
function
|
|
141
|
+
function FeedbackForm() {
|
|
142
142
|
const [value, setValue] = React.useState('');
|
|
143
143
|
|
|
144
144
|
return (
|
|
145
145
|
<Stack spacing={2}>
|
|
146
146
|
<Textarea
|
|
147
|
-
name="
|
|
148
|
-
label="
|
|
149
|
-
placeholder="
|
|
150
|
-
helperText="
|
|
147
|
+
name="feedback"
|
|
148
|
+
label="Feedback"
|
|
149
|
+
placeholder="Tell us what you think..."
|
|
150
|
+
helperText="Your feedback helps us improve the service."
|
|
151
151
|
minRows={3}
|
|
152
152
|
maxRows={6}
|
|
153
153
|
value={value}
|
|
154
154
|
onChange={(e) => setValue(e.target.value)}
|
|
155
155
|
required
|
|
156
156
|
/>
|
|
157
|
-
<Button disabled={!value.trim()}>Submit
|
|
157
|
+
<Button disabled={!value.trim()}>Submit</Button>
|
|
158
158
|
</Stack>
|
|
159
159
|
);
|
|
160
160
|
}
|
|
@@ -259,6 +259,30 @@ function ReadOnlyNotes() {
|
|
|
259
259
|
<Textarea placeholder="Type here" />
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
+
## Props and Customization
|
|
263
|
+
|
|
264
|
+
### Key Props
|
|
265
|
+
|
|
266
|
+
| Prop | Type | Default | Description |
|
|
267
|
+
| -------------- | -------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
|
268
|
+
| `label` | `string` | - | Form label displayed above the textarea |
|
|
269
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the textarea |
|
|
270
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
271
|
+
| `minRows` | `number` | `2` | Minimum number of visible text rows |
|
|
272
|
+
| `maxRows` | `number` | `4` | Maximum number of rows before scrolling |
|
|
273
|
+
| `value` | `string` | - | Textarea value for controlled mode |
|
|
274
|
+
| `defaultValue` | `string` | - | Initial value for uncontrolled mode |
|
|
275
|
+
| `onChange` | `(event: ChangeEvent<HTMLTextAreaElement>) => void` | - | Callback when the value changes |
|
|
276
|
+
| `placeholder` | `string` | - | Placeholder text when the textarea is empty |
|
|
277
|
+
| `disabled` | `boolean` | `false` | Disables the textarea |
|
|
278
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
279
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Textarea size |
|
|
280
|
+
| `variant` | `'outlined' \| 'solid' \| 'soft' \| 'plain'` | `'outlined'` | Visual style variant |
|
|
281
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
282
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
283
|
+
|
|
284
|
+
> **Note**: Textarea also accepts all Joy UI Textarea props and Framer Motion props.
|
|
285
|
+
|
|
262
286
|
## Accessibility
|
|
263
287
|
|
|
264
288
|
- The component automatically associates the `label` with the textarea element through FormControl, ensuring screen readers announce the label when the field receives focus.
|
|
@@ -309,6 +309,27 @@ function GalleryUpload({ existingImages }) {
|
|
|
309
309
|
|
|
310
310
|
- **Use `minCount` with form validation.** The minimum count check triggers on form submission, not on file selection. Make sure the Uploader is inside a `<form>` element for this validation to work.
|
|
311
311
|
|
|
312
|
+
## Props and Customization
|
|
313
|
+
|
|
314
|
+
### Key Props
|
|
315
|
+
|
|
316
|
+
| Prop | Type | Default | Description |
|
|
317
|
+
| ------------------ | --------------------------------------------------------- | ---------- | ----------------------------------------------------------- |
|
|
318
|
+
| `accept` | `string` | (required) | Accepted file types (e.g., `'image/*'`, `'.pdf,.doc'`) |
|
|
319
|
+
| `maxFileTotalSize` | `number` | (required) | Maximum total size of all files in bytes |
|
|
320
|
+
| `onChange` | `(event: { target: { name?, value: File[] } }) => void` | - | Callback when files are added |
|
|
321
|
+
| `onDelete` | `(deletedFile: UserUpload) => void` | - | Callback when an uploaded file is removed |
|
|
322
|
+
| `uploaded` | `{ id: string \| number; name: string; size?: number }[]` | - | Pre-existing uploaded files to display |
|
|
323
|
+
| `maxFileSize` | `number` | - | Maximum size per individual file in bytes |
|
|
324
|
+
| `maxCount` | `number` | - | Maximum number of files allowed |
|
|
325
|
+
| `minCount` | `number` | - | Minimum number of files required (validated on form submit) |
|
|
326
|
+
| `label` | `string` | - | Label displayed above the uploader |
|
|
327
|
+
| `helperText` | `string` | - | Helper text displayed below the uploader |
|
|
328
|
+
| `error` | `boolean` | `false` | Applies error styling |
|
|
329
|
+
| `disabled` | `boolean` | `false` | Disables the uploader |
|
|
330
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
331
|
+
| `size` | `'sm' \| 'md'` | `'md'` | Uploader size |
|
|
332
|
+
|
|
312
333
|
## Accessibility
|
|
313
334
|
|
|
314
335
|
- The dropzone is keyboard-accessible and can be activated via **Enter** or **Space** to open the file browser.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
Box
|
|
5
|
+
Box is the most fundamental and essential layout component. It acts as a general-purpose container that wraps other components, and you can apply styles directly through CSS-in-JS. It also includes built-in Framer Motion support, making it easy to add animations. It is also a polymorphic component that can render as any HTML element.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<Box {...args} sx={{
|
|
@@ -48,7 +48,7 @@ function MyComponent() {
|
|
|
48
48
|
|
|
49
49
|
### Basic Usage
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
The most basic way to use Box.
|
|
52
52
|
|
|
53
53
|
```tsx
|
|
54
54
|
<div style={{
|
|
@@ -86,7 +86,7 @@ function MyComponent() {
|
|
|
86
86
|
|
|
87
87
|
### Colors
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
You can apply various background colors.
|
|
90
90
|
|
|
91
91
|
```tsx
|
|
92
92
|
<div style={{
|
|
@@ -138,7 +138,7 @@ function MyComponent() {
|
|
|
138
138
|
|
|
139
139
|
### Spacing
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
You can adjust padding and margin.
|
|
142
142
|
|
|
143
143
|
```tsx
|
|
144
144
|
<div style={{
|
|
@@ -215,7 +215,7 @@ function MyComponent() {
|
|
|
215
215
|
|
|
216
216
|
### Border Radius
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
You can configure different corner radius values.
|
|
219
219
|
|
|
220
220
|
```tsx
|
|
221
221
|
<div style={{
|
|
@@ -299,7 +299,7 @@ function MyComponent() {
|
|
|
299
299
|
|
|
300
300
|
### Shadows
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
You can add shadow effects.
|
|
303
303
|
|
|
304
304
|
```tsx
|
|
305
305
|
<div style={{
|
|
@@ -390,7 +390,7 @@ function MyComponent() {
|
|
|
390
390
|
|
|
391
391
|
### Flex Layouts
|
|
392
392
|
|
|
393
|
-
|
|
393
|
+
You can easily build layouts using Flexbox.
|
|
394
394
|
|
|
395
395
|
```tsx
|
|
396
396
|
<div style={{
|
|
@@ -499,7 +499,7 @@ Flexbox를 사용한 레이아웃을 쉽게 만들 수 있습니다.
|
|
|
499
499
|
|
|
500
500
|
### Responsive Layout
|
|
501
501
|
|
|
502
|
-
|
|
502
|
+
You can create responsive layouts.
|
|
503
503
|
|
|
504
504
|
```tsx
|
|
505
505
|
<div style={{
|
|
@@ -551,7 +551,7 @@ Flexbox를 사용한 레이아웃을 쉽게 만들 수 있습니다.
|
|
|
551
551
|
|
|
552
552
|
### Polymorphic Components
|
|
553
553
|
|
|
554
|
-
|
|
554
|
+
You can render it as different HTML elements using the `component` prop.
|
|
555
555
|
|
|
556
556
|
```tsx
|
|
557
557
|
<div style={{
|
|
@@ -603,7 +603,7 @@ component prop을 사용하여 다양한 HTML 요소로 렌더링할 수 있습
|
|
|
603
603
|
|
|
604
604
|
### Motion Animations
|
|
605
605
|
|
|
606
|
-
|
|
606
|
+
Animation effects using built-in Framer Motion.
|
|
607
607
|
|
|
608
608
|
```tsx
|
|
609
609
|
<div style={{
|
|
@@ -655,7 +655,7 @@ component prop을 사용하여 다양한 HTML 요소로 렌더링할 수 있습
|
|
|
655
655
|
|
|
656
656
|
### Complex Layouts
|
|
657
657
|
|
|
658
|
-
Box
|
|
658
|
+
You can combine Box components to build complex layouts.
|
|
659
659
|
|
|
660
660
|
```tsx
|
|
661
661
|
<div style={{
|
|
@@ -790,17 +790,16 @@ Box를 조합하여 복잡한 레이아웃을 만들 수 있습니다.
|
|
|
790
790
|
|
|
791
791
|
### SX Prop
|
|
792
792
|
|
|
793
|
-
Box
|
|
793
|
+
The most powerful feature of Box is the `sx` prop. It allows you to apply CSS styles directly as an object.
|
|
794
794
|
|
|
795
795
|
```tsx
|
|
796
796
|
<Box
|
|
797
797
|
sx={{
|
|
798
|
-
p: 2,
|
|
799
|
-
m: { xs: 1, md: 2 },
|
|
800
|
-
bgcolor: 'primary.50',
|
|
801
|
-
borderRadius: 'md',
|
|
802
|
-
'&:hover': {
|
|
803
|
-
// hover 상태
|
|
798
|
+
p: 2, // padding: 16px
|
|
799
|
+
m: { xs: 1, md: 2 }, // responsive margin
|
|
800
|
+
bgcolor: 'primary.50', // theme color
|
|
801
|
+
borderRadius: 'md', // theme border-radius
|
|
802
|
+
'&:hover': { // hover state
|
|
804
803
|
bgcolor: 'primary.100',
|
|
805
804
|
},
|
|
806
805
|
}}
|
|
@@ -811,7 +810,7 @@ Box의 가장 강력한 기능은 `sx` prop입니다. 이를 통해 CSS 스타
|
|
|
811
810
|
|
|
812
811
|
### Responsive Design
|
|
813
812
|
|
|
814
|
-
|
|
813
|
+
You can define styles per breakpoint using object syntax.
|
|
815
814
|
|
|
816
815
|
```tsx
|
|
817
816
|
<Box
|
|
@@ -827,7 +826,7 @@ Box의 가장 강력한 기능은 `sx` prop입니다. 이를 통해 CSS 스타
|
|
|
827
826
|
|
|
828
827
|
### Theme Integration
|
|
829
828
|
|
|
830
|
-
|
|
829
|
+
You can use design system tokens directly.
|
|
831
830
|
|
|
832
831
|
```tsx
|
|
833
832
|
<Box
|
|
@@ -844,7 +843,7 @@ Box의 가장 강력한 기능은 `sx` prop입니다. 이를 통해 CSS 스타
|
|
|
844
843
|
|
|
845
844
|
### Framer Motion
|
|
846
845
|
|
|
847
|
-
|
|
846
|
+
You can use animation props directly.
|
|
848
847
|
|
|
849
848
|
```tsx
|
|
850
849
|
<Box
|
|
@@ -908,7 +907,7 @@ Box의 가장 강력한 기능은 `sx` prop입니다. 이를 통해 CSS 스타
|
|
|
908
907
|
gap: 2,
|
|
909
908
|
}}
|
|
910
909
|
>
|
|
911
|
-
{items.map(
|
|
910
|
+
{items.map(item => (
|
|
912
911
|
<Box key={item.id} sx={{ p: 2, bgcolor: 'background.surface' }}>
|
|
913
912
|
{item.content}
|
|
914
913
|
</Box>
|
|
@@ -948,34 +947,46 @@ Box의 가장 강력한 기능은 `sx` prop입니다. 이를 통해 CSS 스타
|
|
|
948
947
|
</Box>
|
|
949
948
|
```
|
|
950
949
|
|
|
950
|
+
## Props and Customization
|
|
951
|
+
|
|
952
|
+
### Key Props
|
|
953
|
+
|
|
954
|
+
| Prop | Type | Default | Description |
|
|
955
|
+
| ----------- | ------------- | ------- | ---------------------------------- |
|
|
956
|
+
| `children` | `ReactNode` | - | Content inside the box |
|
|
957
|
+
| `component` | `ElementType` | `'div'` | Root element type |
|
|
958
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
959
|
+
|
|
960
|
+
Box is a general-purpose container that renders as a `<div>` by default. It accepts all standard HTML attributes and Joy UI's `sx` prop for responsive styling.
|
|
961
|
+
|
|
951
962
|
## Best Practices
|
|
952
963
|
|
|
953
|
-
1.
|
|
964
|
+
1. **Use meaningful HTML elements**: Use the `component` prop to choose semantically appropriate HTML elements.
|
|
954
965
|
|
|
955
|
-
2.
|
|
966
|
+
2. **Use theme tokens**: Use theme spacing, color, border-radius, and similar values instead of hardcoded values.
|
|
956
967
|
|
|
957
|
-
3.
|
|
968
|
+
3. **Design responsively**: Use responsive values so the component works well across different screen sizes.
|
|
958
969
|
|
|
959
|
-
4.
|
|
960
|
-
-
|
|
961
|
-
-
|
|
970
|
+
4. **Optimize performance**:
|
|
971
|
+
- Avoid creating inline objects repeatedly, and memoize them when possible
|
|
972
|
+
- Use complex animations only when necessary
|
|
962
973
|
|
|
963
|
-
5.
|
|
964
|
-
-
|
|
965
|
-
-
|
|
966
|
-
-
|
|
974
|
+
5. **Consider accessibility**:
|
|
975
|
+
- Choose appropriate semantic HTML elements
|
|
976
|
+
- Add ARIA attributes when needed
|
|
977
|
+
- Maintain sufficient color contrast
|
|
967
978
|
|
|
968
|
-
6.
|
|
969
|
-
-
|
|
970
|
-
-
|
|
979
|
+
6. **Promote reusability**:
|
|
980
|
+
- Extract frequently used style combinations into separate components
|
|
981
|
+
- Define shared styles in the theme
|
|
971
982
|
|
|
972
|
-
7.
|
|
973
|
-
-
|
|
974
|
-
-
|
|
983
|
+
7. **Maintain consistency**:
|
|
984
|
+
- Use consistent spacing and naming conventions across the team
|
|
985
|
+
- Follow the design system guidelines
|
|
975
986
|
|
|
976
987
|
## Spacing Scale
|
|
977
988
|
|
|
978
|
-
|
|
989
|
+
Spacing values available in Box:
|
|
979
990
|
|
|
980
991
|
- `0.5` = 4px
|
|
981
992
|
- `1` = 8px
|
|
@@ -988,11 +999,11 @@ Box에서 사용할 수 있는 spacing 값들:
|
|
|
988
999
|
|
|
989
1000
|
## Color Tokens
|
|
990
1001
|
|
|
991
|
-
|
|
1002
|
+
Primary color tokens:
|
|
992
1003
|
|
|
993
1004
|
- **Background**: `background.body`, `background.surface`, `background.level1`
|
|
994
1005
|
- **Primary**: `primary.50`, `primary.100`, `primary.500`, `primary.main`
|
|
995
1006
|
- **Neutral**: `neutral.50`, `neutral.100`, `neutral.500`, `neutral.main`
|
|
996
1007
|
- **Text**: `text.primary`, `text.secondary`, `text.tertiary`
|
|
997
1008
|
|
|
998
|
-
Box
|
|
1009
|
+
Box is the foundational component for all layout and styling in ADS. Its powerful `sx` prop and built-in animation support make it flexible enough to satisfy a wide range of UI requirements.
|