@ceed/cds 1.34.1 → 1.35.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/components/Accordions/Accordions.d.ts +1 -0
- package/dist/components/Alert/Alert.d.ts +5 -5
- package/dist/components/Autocomplete/Autocomplete.d.ts +2 -2
- package/dist/components/Avatar/Avatar.d.ts +7 -17
- package/dist/components/Box/Box.d.ts +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +6 -5
- package/dist/components/Button/Button.d.ts +3 -2
- package/dist/components/Calendar/Calendar.d.ts +1 -0
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/Chip/Chip.d.ts +1 -0
- package/dist/components/Container/Container.d.ts +6 -1
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/dist/components/DialogActions/DialogActions.d.ts +1 -0
- package/dist/components/DialogContent/DialogContent.d.ts +1 -0
- package/dist/components/DialogFrame/DialogFrame.d.ts +1 -1
- package/dist/components/DialogTitle/DialogTitle.d.ts +1 -0
- package/dist/components/Divider/Divider.d.ts +1 -0
- package/dist/components/Drawer/Drawer.d.ts +1 -0
- package/dist/components/Dropdown/Dropdown.d.ts +28 -1
- package/dist/components/FormControl/FormControl.d.ts +1 -0
- package/dist/components/FormHelperText/FormHelperText.d.ts +1 -0
- package/dist/components/FormLabel/FormLabel.d.ts +1 -0
- package/dist/components/Grid/Grid.d.ts +1 -0
- package/dist/components/IconButton/IconButton.d.ts +3 -2
- package/dist/components/IconMenuButton/IconMenuButton.d.ts +7 -6
- package/dist/components/InfoSign/InfoSign.d.ts +3 -2
- package/dist/components/Input/Input.d.ts +8 -22
- package/dist/components/InsetDrawer/InsetDrawer.d.ts +1 -0
- package/dist/components/Markdown/Markdown.d.ts +9 -24
- package/dist/components/Menu/Menu.d.ts +2 -1
- package/dist/components/MenuButton/MenuButton.d.ts +10 -8
- package/dist/components/Modal/Modal.d.ts +4 -2
- package/dist/components/NavigationGroup/NavigationGroup.d.ts +3 -2
- package/dist/components/NavigationItem/NavigationItem.d.ts +3 -2
- package/dist/components/Navigator/Navigator.d.ts +5 -4
- package/dist/components/Pagination/Pagination.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -0
- package/dist/components/RadioList/RadioList.d.ts +3 -2
- package/dist/components/Select/Select.d.ts +12 -10
- package/dist/components/Sheet/Sheet.d.ts +1 -0
- package/dist/components/Stack/Stack.d.ts +1 -0
- package/dist/components/Stepper/Stepper.d.ts +2 -1
- package/dist/components/Switch/Switch.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +7 -5
- package/dist/components/Tabs/Tabs.d.ts +1 -0
- package/dist/components/Textarea/Textarea.d.ts +8 -20
- package/dist/components/Tooltip/Tooltip.d.ts +1 -0
- package/dist/components/Typography/Typography.d.ts +1 -0
- package/dist/components/Uploader/Uploader.d.ts +18 -17
- package/dist/components/data-display/Avatar.md +60 -72
- package/dist/components/data-display/Badge.md +197 -181
- package/dist/components/data-display/Chip.md +164 -142
- package/dist/components/data-display/DataTable.md +843 -338
- package/dist/components/data-display/InfoSign.md +1 -3
- package/dist/components/data-display/Markdown.md +93 -125
- package/dist/components/data-display/Table.md +1453 -1007
- package/dist/components/data-display/Typography.md +113 -116
- package/dist/components/feedback/Alert.md +80 -86
- package/dist/components/feedback/CircularProgress.md +32 -36
- package/dist/components/feedback/Dialog.md +25 -17
- package/dist/components/feedback/Modal.md +296 -264
- package/dist/components/feedback/Skeleton.md +125 -89
- package/dist/components/index.d.ts +62 -2
- package/dist/components/inputs/Autocomplete.md +191 -95
- package/dist/components/inputs/Button.md +83 -83
- package/dist/components/inputs/ButtonGroup.md +195 -185
- package/dist/components/inputs/Calendar.md +25 -28
- package/dist/components/inputs/Checkbox.md +11 -29
- package/dist/components/inputs/CurrencyInput.md +4 -4
- package/dist/components/inputs/DatePicker.md +229 -110
- package/dist/components/inputs/DateRangePicker.md +248 -137
- package/dist/components/inputs/FilterableCheckboxGroup.md +115 -55
- package/dist/components/inputs/FormControl.md +75 -69
- package/dist/components/inputs/IconButton.md +229 -205
- package/dist/components/inputs/Input.md +131 -98
- package/dist/components/inputs/MonthPicker.md +186 -84
- package/dist/components/inputs/MonthRangePicker.md +73 -49
- package/dist/components/inputs/PercentageInput.md +15 -31
- package/dist/components/inputs/RadioButton.md +320 -256
- package/dist/components/inputs/RadioList.md +66 -50
- package/dist/components/inputs/RadioTileGroup.md +287 -170
- package/dist/components/inputs/SearchBar.md +82 -60
- package/dist/components/inputs/Select.md +106 -95
- package/dist/components/inputs/Slider.md +153 -102
- package/dist/components/inputs/Switch.md +193 -138
- package/dist/components/inputs/Textarea.md +15 -20
- package/dist/components/inputs/Uploader/Uploader.md +68 -39
- package/dist/components/layout/Box.md +841 -662
- package/dist/components/layout/Container.md +3 -11
- package/dist/components/layout/Grid.md +480 -394
- package/dist/components/layout/Stack.md +739 -566
- package/dist/components/navigation/Breadcrumbs.md +4 -4
- package/dist/components/navigation/Drawer.md +34 -25
- package/dist/components/navigation/Dropdown.md +745 -408
- package/dist/components/navigation/IconMenuButton.md +14 -6
- package/dist/components/navigation/InsetDrawer.md +8 -13
- package/dist/components/navigation/Link.md +1 -2
- package/dist/components/navigation/Menu.md +623 -502
- package/dist/components/navigation/MenuButton.md +18 -10
- package/dist/components/navigation/NavigationGroup.md +19 -50
- package/dist/components/navigation/NavigationItem.md +6 -6
- package/dist/components/navigation/Navigator.md +26 -28
- package/dist/components/navigation/Pagination.md +86 -75
- package/dist/components/navigation/Stepper.md +2 -12
- package/dist/components/navigation/Tabs.md +48 -36
- package/dist/components/surfaces/Accordions.md +89 -172
- package/dist/components/surfaces/Card.md +1094 -709
- package/dist/components/surfaces/Divider.md +562 -412
- package/dist/components/surfaces/Sheet.md +700 -518
- package/dist/guides/ThemeProvider.md +8 -8
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +1059 -1032
- package/dist/index.d.ts +2 -1
- package/dist/index.js +705 -670
- package/framer/index.js +1 -1
- package/package.json +32 -35
|
@@ -8,10 +8,10 @@ By applying shared props like `color`, `variant`, `size`, and `orientation` at t
|
|
|
8
8
|
|
|
9
9
|
```tsx
|
|
10
10
|
<ButtonGroup {...args}>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
</ButtonGroup>
|
|
11
|
+
<Button>첫번째</Button>
|
|
12
|
+
<Button>두번째</Button>
|
|
13
|
+
<Button>세번째</Button>
|
|
14
|
+
</ButtonGroup>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
| Field | Description | Default |
|
|
@@ -43,41 +43,43 @@ function MyComponent() {
|
|
|
43
43
|
Apply a unified color theme to all buttons in the group using the `color` prop. Available colors are `primary`, `neutral`, `danger`, `success`, and `warning`.
|
|
44
44
|
|
|
45
45
|
```tsx
|
|
46
|
-
<div
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</
|
|
46
|
+
<div
|
|
47
|
+
style={{
|
|
48
|
+
display: "flex",
|
|
49
|
+
gap: "1rem",
|
|
50
|
+
flexDirection: "column"
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<ButtonGroup color="primary">
|
|
54
|
+
<Button>Primary</Button>
|
|
55
|
+
<Button>Button</Button>
|
|
56
|
+
<Button>Group</Button>
|
|
57
|
+
</ButtonGroup>
|
|
56
58
|
|
|
57
|
-
<ButtonGroup color="neutral">
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
</ButtonGroup>
|
|
59
|
+
<ButtonGroup color="neutral">
|
|
60
|
+
<Button>Neutral</Button>
|
|
61
|
+
<Button>Button</Button>
|
|
62
|
+
<Button>Group</Button>
|
|
63
|
+
</ButtonGroup>
|
|
62
64
|
|
|
63
|
-
<ButtonGroup color="danger">
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</ButtonGroup>
|
|
65
|
+
<ButtonGroup color="danger">
|
|
66
|
+
<Button>Danger</Button>
|
|
67
|
+
<Button>Button</Button>
|
|
68
|
+
<Button>Group</Button>
|
|
69
|
+
</ButtonGroup>
|
|
68
70
|
|
|
69
|
-
<ButtonGroup color="success">
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
</ButtonGroup>
|
|
71
|
+
<ButtonGroup color="success">
|
|
72
|
+
<Button>Success</Button>
|
|
73
|
+
<Button>Button</Button>
|
|
74
|
+
<Button>Group</Button>
|
|
75
|
+
</ButtonGroup>
|
|
74
76
|
|
|
75
|
-
<ButtonGroup color="warning">
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
</ButtonGroup>
|
|
80
|
-
</div>
|
|
77
|
+
<ButtonGroup color="warning">
|
|
78
|
+
<Button>Warning</Button>
|
|
79
|
+
<Button>Button</Button>
|
|
80
|
+
<Button>Group</Button>
|
|
81
|
+
</ButtonGroup>
|
|
82
|
+
</div>
|
|
81
83
|
```
|
|
82
84
|
|
|
83
85
|
## Variants
|
|
@@ -85,35 +87,37 @@ Apply a unified color theme to all buttons in the group using the `color` prop.
|
|
|
85
87
|
ButtonGroup supports four visual variants: `solid`, `soft`, `outlined`, and `plain`. The variant prop propagates to all child buttons, ensuring a consistent look.
|
|
86
88
|
|
|
87
89
|
```tsx
|
|
88
|
-
<div
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
</
|
|
90
|
+
<div
|
|
91
|
+
style={{
|
|
92
|
+
display: "flex",
|
|
93
|
+
gap: "1rem",
|
|
94
|
+
flexDirection: "column"
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
<ButtonGroup variant="solid">
|
|
98
|
+
<Button>Solid</Button>
|
|
99
|
+
<Button>Button</Button>
|
|
100
|
+
<Button>Group</Button>
|
|
101
|
+
</ButtonGroup>
|
|
98
102
|
|
|
99
|
-
<ButtonGroup variant="soft">
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
</ButtonGroup>
|
|
103
|
+
<ButtonGroup variant="soft">
|
|
104
|
+
<Button>Soft</Button>
|
|
105
|
+
<Button>Button</Button>
|
|
106
|
+
<Button>Group</Button>
|
|
107
|
+
</ButtonGroup>
|
|
104
108
|
|
|
105
|
-
<ButtonGroup variant="outlined">
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</ButtonGroup>
|
|
109
|
+
<ButtonGroup variant="outlined">
|
|
110
|
+
<Button>Outlined</Button>
|
|
111
|
+
<Button>Button</Button>
|
|
112
|
+
<Button>Group</Button>
|
|
113
|
+
</ButtonGroup>
|
|
110
114
|
|
|
111
|
-
<ButtonGroup variant="plain">
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
</ButtonGroup>
|
|
116
|
-
</div>
|
|
115
|
+
<ButtonGroup variant="plain">
|
|
116
|
+
<Button>Plain</Button>
|
|
117
|
+
<Button>Button</Button>
|
|
118
|
+
<Button>Group</Button>
|
|
119
|
+
</ButtonGroup>
|
|
120
|
+
</div>
|
|
117
121
|
```
|
|
118
122
|
|
|
119
123
|
## Sizes
|
|
@@ -121,30 +125,32 @@ ButtonGroup supports four visual variants: `solid`, `soft`, `outlined`, and `pla
|
|
|
121
125
|
Control the size of all buttons in the group with the `size` prop. Available sizes are `sm`, `md` (default), and `lg`.
|
|
122
126
|
|
|
123
127
|
```tsx
|
|
124
|
-
<div
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
</
|
|
128
|
+
<div
|
|
129
|
+
style={{
|
|
130
|
+
display: "flex",
|
|
131
|
+
gap: "1rem",
|
|
132
|
+
flexDirection: "column",
|
|
133
|
+
alignItems: "flex-start"
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
<ButtonGroup size="sm">
|
|
137
|
+
<Button>Small</Button>
|
|
138
|
+
<Button>Button</Button>
|
|
139
|
+
<Button>Group</Button>
|
|
140
|
+
</ButtonGroup>
|
|
135
141
|
|
|
136
|
-
<ButtonGroup size="md">
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
</ButtonGroup>
|
|
142
|
+
<ButtonGroup size="md">
|
|
143
|
+
<Button>Medium</Button>
|
|
144
|
+
<Button>Button</Button>
|
|
145
|
+
<Button>Group</Button>
|
|
146
|
+
</ButtonGroup>
|
|
141
147
|
|
|
142
|
-
<ButtonGroup size="lg">
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
</ButtonGroup>
|
|
147
|
-
</div>
|
|
148
|
+
<ButtonGroup size="lg">
|
|
149
|
+
<Button>Large</Button>
|
|
150
|
+
<Button>Button</Button>
|
|
151
|
+
<Button>Group</Button>
|
|
152
|
+
</ButtonGroup>
|
|
153
|
+
</div>
|
|
148
154
|
```
|
|
149
155
|
|
|
150
156
|
## Orientations
|
|
@@ -152,29 +158,31 @@ Control the size of all buttons in the group with the `size` prop. Available siz
|
|
|
152
158
|
Buttons can be arranged horizontally (default) or vertically. Use `orientation="vertical"` for stacked layouts such as side panels or narrow containers.
|
|
153
159
|
|
|
154
160
|
```tsx
|
|
155
|
-
<div
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
</
|
|
161
|
+
<div
|
|
162
|
+
style={{
|
|
163
|
+
display: "flex",
|
|
164
|
+
gap: "2rem",
|
|
165
|
+
alignItems: "flex-start"
|
|
166
|
+
}}
|
|
167
|
+
>
|
|
168
|
+
<div>
|
|
169
|
+
<h4>Horizontal</h4>
|
|
170
|
+
<ButtonGroup orientation="horizontal">
|
|
171
|
+
<Button>첫번째</Button>
|
|
172
|
+
<Button>두번째</Button>
|
|
173
|
+
<Button>세번째</Button>
|
|
174
|
+
</ButtonGroup>
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
<div>
|
|
178
|
+
<h4>Vertical</h4>
|
|
179
|
+
<ButtonGroup orientation="vertical">
|
|
180
|
+
<Button>첫번째</Button>
|
|
181
|
+
<Button>두번째</Button>
|
|
182
|
+
<Button>세번째</Button>
|
|
183
|
+
</ButtonGroup>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
178
186
|
```
|
|
179
187
|
|
|
180
188
|
## With Icons
|
|
@@ -182,23 +190,25 @@ Buttons can be arranged horizontally (default) or vertically. Use `orientation="
|
|
|
182
190
|
Combine text labels with icons using the `startDecorator` prop on individual buttons for a richer, more descriptive interface.
|
|
183
191
|
|
|
184
192
|
```tsx
|
|
185
|
-
<div
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
<div
|
|
194
|
+
style={{
|
|
195
|
+
display: "flex",
|
|
196
|
+
gap: "2rem",
|
|
197
|
+
flexDirection: "column"
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
<ButtonGroup>
|
|
201
|
+
<Button startDecorator={<Add />}>추가</Button>
|
|
202
|
+
<Button startDecorator={<Edit />}>편집</Button>
|
|
203
|
+
<Button startDecorator={<Delete />}>삭제</Button>
|
|
204
|
+
</ButtonGroup>
|
|
195
205
|
|
|
196
|
-
<ButtonGroup variant="outlined">
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
</ButtonGroup>
|
|
201
|
-
</div>
|
|
206
|
+
<ButtonGroup variant="outlined">
|
|
207
|
+
<Button startDecorator={<Save />} />
|
|
208
|
+
<Button startDecorator={<Share />} />
|
|
209
|
+
<Button startDecorator={<Edit />} />
|
|
210
|
+
</ButtonGroup>
|
|
211
|
+
</div>
|
|
202
212
|
```
|
|
203
213
|
|
|
204
214
|
## States
|
|
@@ -206,38 +216,40 @@ Combine text labels with icons using the `startDecorator` prop on individual but
|
|
|
206
216
|
ButtonGroup supports disabled states at the group level (affecting all children) or on individual buttons for mixed-state scenarios.
|
|
207
217
|
|
|
208
218
|
```tsx
|
|
209
|
-
<div
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
</
|
|
219
|
+
<div
|
|
220
|
+
style={{
|
|
221
|
+
display: "flex",
|
|
222
|
+
gap: "2rem",
|
|
223
|
+
flexDirection: "column"
|
|
224
|
+
}}
|
|
225
|
+
>
|
|
226
|
+
<div>
|
|
227
|
+
<h4>Normal</h4>
|
|
228
|
+
<ButtonGroup>
|
|
229
|
+
<Button>첫번째</Button>
|
|
230
|
+
<Button>두번째</Button>
|
|
231
|
+
<Button>세번째</Button>
|
|
232
|
+
</ButtonGroup>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<div>
|
|
236
|
+
<h4>Disabled</h4>
|
|
237
|
+
<ButtonGroup disabled>
|
|
238
|
+
<Button>첫번째</Button>
|
|
239
|
+
<Button>두번째</Button>
|
|
240
|
+
<Button>세번째</Button>
|
|
241
|
+
</ButtonGroup>
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
<div>
|
|
245
|
+
<h4>Mixed States</h4>
|
|
246
|
+
<ButtonGroup>
|
|
247
|
+
<Button>활성</Button>
|
|
248
|
+
<Button disabled>비활성</Button>
|
|
249
|
+
<Button>활성</Button>
|
|
250
|
+
</ButtonGroup>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
241
253
|
```
|
|
242
254
|
|
|
243
255
|
## Toggle Group
|
|
@@ -246,20 +258,29 @@ By dynamically switching the `variant` prop on individual buttons based on selec
|
|
|
246
258
|
|
|
247
259
|
```tsx
|
|
248
260
|
<div>
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
</
|
|
261
|
+
<h4>Toggle Group (Alignment)</h4>
|
|
262
|
+
<ButtonGroup variant="outlined">
|
|
263
|
+
<Button
|
|
264
|
+
variant={selected === "left" ? "solid" : "outlined"}
|
|
265
|
+
onClick={() => setSelected("left")}
|
|
266
|
+
>
|
|
267
|
+
왼쪽 정렬
|
|
268
|
+
</Button>
|
|
269
|
+
<Button
|
|
270
|
+
variant={selected === "center" ? "solid" : "outlined"}
|
|
271
|
+
onClick={() => setSelected("center")}
|
|
272
|
+
>
|
|
273
|
+
가운데 정렬
|
|
274
|
+
</Button>
|
|
275
|
+
<Button
|
|
276
|
+
variant={selected === "right" ? "solid" : "outlined"}
|
|
277
|
+
onClick={() => setSelected("right")}
|
|
278
|
+
>
|
|
279
|
+
오른쪽 정렬
|
|
280
|
+
</Button>
|
|
281
|
+
</ButtonGroup>
|
|
282
|
+
<p>선택된 정렬: {selected}</p>
|
|
283
|
+
</div>
|
|
263
284
|
```
|
|
264
285
|
|
|
265
286
|
## Common Use Cases
|
|
@@ -276,7 +297,7 @@ import RedoIcon from '@mui/icons-material/Redo';
|
|
|
276
297
|
<Button startDecorator={<SaveIcon />}>Save</Button>
|
|
277
298
|
<Button startDecorator={<UndoIcon />}>Undo</Button>
|
|
278
299
|
<Button startDecorator={<RedoIcon />}>Redo</Button>
|
|
279
|
-
</ButtonGroup
|
|
300
|
+
</ButtonGroup>;
|
|
280
301
|
```
|
|
281
302
|
|
|
282
303
|
### View Switcher
|
|
@@ -285,25 +306,16 @@ import RedoIcon from '@mui/icons-material/Redo';
|
|
|
285
306
|
const [view, setView] = useState('list');
|
|
286
307
|
|
|
287
308
|
<ButtonGroup variant="outlined" color="neutral">
|
|
288
|
-
<Button
|
|
289
|
-
variant={view === 'list' ? 'solid' : 'outlined'}
|
|
290
|
-
onClick={() => setView('list')}
|
|
291
|
-
>
|
|
309
|
+
<Button variant={view === 'list' ? 'solid' : 'outlined'} onClick={() => setView('list')}>
|
|
292
310
|
List
|
|
293
311
|
</Button>
|
|
294
|
-
<Button
|
|
295
|
-
variant={view === 'grid' ? 'solid' : 'outlined'}
|
|
296
|
-
onClick={() => setView('grid')}
|
|
297
|
-
>
|
|
312
|
+
<Button variant={view === 'grid' ? 'solid' : 'outlined'} onClick={() => setView('grid')}>
|
|
298
313
|
Grid
|
|
299
314
|
</Button>
|
|
300
|
-
<Button
|
|
301
|
-
variant={view === 'card' ? 'solid' : 'outlined'}
|
|
302
|
-
onClick={() => setView('card')}
|
|
303
|
-
>
|
|
315
|
+
<Button variant={view === 'card' ? 'solid' : 'outlined'} onClick={() => setView('card')}>
|
|
304
316
|
Card
|
|
305
317
|
</Button>
|
|
306
|
-
</ButtonGroup
|
|
318
|
+
</ButtonGroup>;
|
|
307
319
|
```
|
|
308
320
|
|
|
309
321
|
### Pagination Controls
|
|
@@ -314,9 +326,7 @@ const [view, setView] = useState('list');
|
|
|
314
326
|
Previous
|
|
315
327
|
</Button>
|
|
316
328
|
<Button disabled>{page}</Button>
|
|
317
|
-
<Button onClick={() => setPage(page + 1)}>
|
|
318
|
-
Next
|
|
319
|
-
</Button>
|
|
329
|
+
<Button onClick={() => setPage(page + 1)}>Next</Button>
|
|
320
330
|
</ButtonGroup>
|
|
321
331
|
```
|
|
322
332
|
|
|
@@ -29,12 +29,7 @@ import { useState } from 'react';
|
|
|
29
29
|
function DateSelector() {
|
|
30
30
|
const [date, setDate] = useState<Date | null>(null);
|
|
31
31
|
|
|
32
|
-
return (
|
|
33
|
-
<Calendar
|
|
34
|
-
value={date ? [date, undefined] : undefined}
|
|
35
|
-
onChange={(dates) => setDate(dates[0] || null)}
|
|
36
|
-
/>
|
|
37
|
-
);
|
|
32
|
+
return <Calendar value={date ? [date, undefined] : undefined} onChange={(dates) => setDate(dates[0] || null)} />;
|
|
38
33
|
}
|
|
39
34
|
```
|
|
40
35
|
|
|
@@ -96,7 +91,11 @@ Show only the month grid for month-level navigation and selection.
|
|
|
96
91
|
Enable both month and day views with navigation between them, giving users the flexibility to zoom in and out of the calendar.
|
|
97
92
|
|
|
98
93
|
```tsx
|
|
99
|
-
<Calendar
|
|
94
|
+
<Calendar
|
|
95
|
+
views={["month", "day"]}
|
|
96
|
+
rangeSelection
|
|
97
|
+
defaultValue={[new Date(2024, 2, 1), new Date(2024, 2, 20)]}
|
|
98
|
+
/>
|
|
100
99
|
```
|
|
101
100
|
|
|
102
101
|
### Month Selection
|
|
@@ -154,7 +153,7 @@ Use the `shouldDisableDate` callback to implement arbitrary disabling logic, suc
|
|
|
154
153
|
Combine `shouldDisableDate` with `disablePast` to apply multiple restrictions simultaneously.
|
|
155
154
|
|
|
156
155
|
```tsx
|
|
157
|
-
<Calendar shouldDisableDate={date => [0, 6].includes(date.getDay())} disablePast />
|
|
156
|
+
<Calendar shouldDisableDate={(date) => [0, 6].includes(date.getDay())} disablePast />
|
|
158
157
|
```
|
|
159
158
|
|
|
160
159
|
### Complex Date Restrictions
|
|
@@ -162,7 +161,13 @@ Combine `shouldDisableDate` with `disablePast` to apply multiple restrictions si
|
|
|
162
161
|
Disable weekends, past dates, and limit selection to one week ahead by combining all restriction options.
|
|
163
162
|
|
|
164
163
|
```tsx
|
|
165
|
-
<Calendar
|
|
164
|
+
<Calendar
|
|
165
|
+
shouldDisableDate={(date) =>
|
|
166
|
+
[0, 6].includes(date.getDay()) ||
|
|
167
|
+
date.getTime() >= new Date().getTime() + 7 * 24 * 60 * 60 * 1000
|
|
168
|
+
}
|
|
169
|
+
disablePast
|
|
170
|
+
/>
|
|
166
171
|
```
|
|
167
172
|
|
|
168
173
|
## Common Use Cases
|
|
@@ -181,10 +186,7 @@ function CalendarWidget() {
|
|
|
181
186
|
<Typography level="title-md" sx={{ mb: 2 }}>
|
|
182
187
|
Select a Date
|
|
183
188
|
</Typography>
|
|
184
|
-
<Calendar
|
|
185
|
-
value={[selectedDate, undefined]}
|
|
186
|
-
onChange={(dates) => dates[0] && setSelectedDate(dates[0])}
|
|
187
|
-
/>
|
|
189
|
+
<Calendar value={[selectedDate, undefined]} onChange={(dates) => dates[0] && setSelectedDate(dates[0])} />
|
|
188
190
|
<Typography level="body-sm" sx={{ mt: 2 }}>
|
|
189
191
|
Selected: {selectedDate.toLocaleDateString()}
|
|
190
192
|
</Typography>
|
|
@@ -199,19 +201,14 @@ function CalendarWidget() {
|
|
|
199
201
|
function BookingCalendar({ blockedDates }) {
|
|
200
202
|
const [selectedDate, setSelectedDate] = useState<Date | null>(null);
|
|
201
203
|
|
|
202
|
-
const blockedSet = useMemo(
|
|
203
|
-
() => new Set(blockedDates.map((d) => d.toDateString())),
|
|
204
|
-
[blockedDates]
|
|
205
|
-
);
|
|
204
|
+
const blockedSet = useMemo(() => new Set(blockedDates.map((d) => d.toDateString())), [blockedDates]);
|
|
206
205
|
|
|
207
206
|
return (
|
|
208
207
|
<Calendar
|
|
209
208
|
value={selectedDate ? [selectedDate, undefined] : undefined}
|
|
210
209
|
onChange={(dates) => setSelectedDate(dates[0] || null)}
|
|
211
210
|
disablePast
|
|
212
|
-
shouldDisableDate={(date) =>
|
|
213
|
-
[0, 6].includes(date.getDay()) || blockedSet.has(date.toDateString())
|
|
214
|
-
}
|
|
211
|
+
shouldDisableDate={(date) => [0, 6].includes(date.getDay()) || blockedSet.has(date.toDateString())}
|
|
215
212
|
/>
|
|
216
213
|
);
|
|
217
214
|
}
|
|
@@ -221,10 +218,7 @@ function BookingCalendar({ blockedDates }) {
|
|
|
221
218
|
|
|
222
219
|
```tsx
|
|
223
220
|
function DateRangeSelector({ onRangeSelect }) {
|
|
224
|
-
const [range, setRange] = useState<[Date | undefined, Date | undefined]>([
|
|
225
|
-
undefined,
|
|
226
|
-
undefined,
|
|
227
|
-
]);
|
|
221
|
+
const [range, setRange] = useState<[Date | undefined, Date | undefined]>([undefined, undefined]);
|
|
228
222
|
|
|
229
223
|
const dayCount = useMemo(() => {
|
|
230
224
|
if (!range[0] || !range[1]) return 0;
|
|
@@ -284,12 +278,15 @@ function DateRangeSelector({ onRangeSelect }) {
|
|
|
284
278
|
|
|
285
279
|
```tsx
|
|
286
280
|
// ✅ Memoized disable function
|
|
287
|
-
const shouldDisableDate = useCallback(
|
|
288
|
-
|
|
289
|
-
|
|
281
|
+
const shouldDisableDate = useCallback(
|
|
282
|
+
(date: Date) => {
|
|
283
|
+
return [0, 6].includes(date.getDay()) || holidays.has(date.toDateString());
|
|
284
|
+
},
|
|
285
|
+
[holidays],
|
|
286
|
+
);
|
|
290
287
|
|
|
291
288
|
// ❌ Inline function recreated every render
|
|
292
|
-
<Calendar shouldDisableDate={(date) => expensiveCheck(date)}
|
|
289
|
+
<Calendar shouldDisableDate={(date) => expensiveCheck(date)} />;
|
|
293
290
|
```
|
|
294
291
|
|
|
295
292
|
4. **Always use Date objects, not strings.** Calendar expects native `Date` objects for `value`, `defaultValue`, `minDate`, and `maxDate`.
|
|
@@ -25,13 +25,7 @@ import { Checkbox } from '@ceed/cds';
|
|
|
25
25
|
function MyComponent() {
|
|
26
26
|
const [checked, setChecked] = useState(false);
|
|
27
27
|
|
|
28
|
-
return (
|
|
29
|
-
<Checkbox
|
|
30
|
-
label="I agree"
|
|
31
|
-
checked={checked}
|
|
32
|
-
onChange={(e) => setChecked(e.target.checked)}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
28
|
+
return <Checkbox label="I agree" checked={checked} onChange={(e) => setChecked(e.target.checked)} />;
|
|
35
29
|
}
|
|
36
30
|
```
|
|
37
31
|
|
|
@@ -91,11 +85,7 @@ Apply semantic colors to communicate meaning.
|
|
|
91
85
|
Represents a partially selected state, commonly used in "select all" patterns where some but not all children are selected.
|
|
92
86
|
|
|
93
87
|
```tsx
|
|
94
|
-
<Checkbox
|
|
95
|
-
label="Partially selected"
|
|
96
|
-
indeterminate
|
|
97
|
-
onChange={handleChange}
|
|
98
|
-
/>
|
|
88
|
+
<Checkbox label="Partially selected" indeterminate onChange={handleChange} />
|
|
99
89
|
```
|
|
100
90
|
|
|
101
91
|
### Disabled
|
|
@@ -136,10 +126,8 @@ function TermsForm() {
|
|
|
136
126
|
marketing: false,
|
|
137
127
|
});
|
|
138
128
|
|
|
139
|
-
const handleChange = (key: keyof typeof agreements) => (
|
|
140
|
-
|
|
141
|
-
) => {
|
|
142
|
-
setAgreements(prev => ({ ...prev, [key]: event.target.checked }));
|
|
129
|
+
const handleChange = (key: keyof typeof agreements) => (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
130
|
+
setAgreements((prev) => ({ ...prev, [key]: event.target.checked }));
|
|
143
131
|
};
|
|
144
132
|
|
|
145
133
|
return (
|
|
@@ -200,18 +188,16 @@ function SelectAllExample() {
|
|
|
200
188
|
{ id: 4, name: 'Item 4', selected: false },
|
|
201
189
|
]);
|
|
202
190
|
|
|
203
|
-
const selectedCount = items.filter(item => item.selected).length;
|
|
191
|
+
const selectedCount = items.filter((item) => item.selected).length;
|
|
204
192
|
const isAllSelected = selectedCount === items.length;
|
|
205
193
|
const isIndeterminate = selectedCount > 0 && selectedCount < items.length;
|
|
206
194
|
|
|
207
195
|
const handleSelectAll = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
208
|
-
setItems(prev => prev.map(item => ({ ...item, selected: event.target.checked })));
|
|
196
|
+
setItems((prev) => prev.map((item) => ({ ...item, selected: event.target.checked })));
|
|
209
197
|
};
|
|
210
198
|
|
|
211
199
|
const handleItemToggle = (id: number) => {
|
|
212
|
-
setItems(prev => prev.map(item =>
|
|
213
|
-
item.id === id ? { ...item, selected: !item.selected } : item
|
|
214
|
-
));
|
|
200
|
+
setItems((prev) => prev.map((item) => (item.id === id ? { ...item, selected: !item.selected } : item)));
|
|
215
201
|
};
|
|
216
202
|
|
|
217
203
|
return (
|
|
@@ -228,7 +214,7 @@ function SelectAllExample() {
|
|
|
228
214
|
<Divider />
|
|
229
215
|
|
|
230
216
|
<Stack spacing={1} sx={{ pl: 2 }}>
|
|
231
|
-
{items.map(item => (
|
|
217
|
+
{items.map((item) => (
|
|
232
218
|
<Checkbox
|
|
233
219
|
key={item.id}
|
|
234
220
|
label={item.name}
|
|
@@ -251,14 +237,10 @@ function ProductFilter() {
|
|
|
251
237
|
categories: [] as string[],
|
|
252
238
|
});
|
|
253
239
|
|
|
254
|
-
const handleCategoryChange = (category: string) => (
|
|
255
|
-
|
|
256
|
-
) => {
|
|
257
|
-
setFilters(prev => ({
|
|
240
|
+
const handleCategoryChange = (category: string) => (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
241
|
+
setFilters((prev) => ({
|
|
258
242
|
...prev,
|
|
259
|
-
categories: event.target.checked
|
|
260
|
-
? [...prev.categories, category]
|
|
261
|
-
: prev.categories.filter(c => c !== category)
|
|
243
|
+
categories: event.target.checked ? [...prev.categories, category] : prev.categories.filter((c) => c !== category),
|
|
262
244
|
}));
|
|
263
245
|
};
|
|
264
246
|
|