@ceed/cds 1.34.0 → 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/SearchBar/SearchBar.d.ts +6 -5
- package/dist/components/SearchBar/index.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 +63 -4
- 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 +154 -55
- 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 +1079 -1052
- package/dist/index.d.ts +2 -1
- package/dist/index.js +725 -690
- package/framer/index.js +1 -1
- package/package.json +32 -35
|
@@ -256,11 +256,15 @@ function ToolbarActions({ selectedItems, onAction }) {
|
|
|
256
256
|
- **Use descriptive button text.** The button label should clearly indicate what kind of options the menu contains. Avoid vague labels like "More" or "Options" -- prefer specific labels like "Export Options" or "User Actions".
|
|
257
257
|
|
|
258
258
|
```tsx
|
|
259
|
-
{
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
259
|
+
{
|
|
260
|
+
/* ✅ Good: Clear purpose */
|
|
261
|
+
}
|
|
262
|
+
<MenuButton buttonText="Export Options" items={exportItems} />;
|
|
263
|
+
|
|
264
|
+
{
|
|
265
|
+
/* ❌ Avoid: Vague label */
|
|
266
|
+
}
|
|
267
|
+
<MenuButton buttonText="More" items={items} />;
|
|
264
268
|
```
|
|
265
269
|
|
|
266
270
|
- **Keep the items list short and focused.** Aim for 3-7 items that are logically related. If you need more items or mixed content, switch to the Dropdown + Menu composition pattern.
|
|
@@ -276,14 +280,18 @@ function ToolbarActions({ selectedItems, onAction }) {
|
|
|
276
280
|
- **Do not use MenuButton for form value selection.** MenuButton triggers actions -- it is not a Select replacement. For form inputs where the user picks a value, use the Select component.
|
|
277
281
|
|
|
278
282
|
```tsx
|
|
279
|
-
{
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
{
|
|
283
|
+
{
|
|
284
|
+
/* ❌ Bad: Form selection */
|
|
285
|
+
}
|
|
286
|
+
<MenuButton buttonText={selectedValue} items={options} />;
|
|
287
|
+
|
|
288
|
+
{
|
|
289
|
+
/* ✅ Good: Use Select for forms */
|
|
290
|
+
}
|
|
283
291
|
<Select value={selectedValue} onChange={handleChange}>
|
|
284
292
|
<Option value="a">Option A</Option>
|
|
285
293
|
<Option value="b">Option B</Option>
|
|
286
|
-
</Select
|
|
294
|
+
</Select>;
|
|
287
295
|
```
|
|
288
296
|
|
|
289
297
|
- **Use `placement` to prevent overflow.** When the trigger is near the right edge of the viewport, use `placement="bottom-end"` so the menu does not extend beyond the screen.
|
|
@@ -19,14 +19,16 @@ import { NavigationGroup, NavigationItem } from '@ceed/cds';
|
|
|
19
19
|
|
|
20
20
|
function Sidebar() {
|
|
21
21
|
return (
|
|
22
|
-
<NavigationGroup
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<NavigationItem id="permissions" level={1}>
|
|
22
|
+
<NavigationGroup title="User Management" startDecorator={<PeopleIcon />} defaultExpanded={true}>
|
|
23
|
+
<NavigationItem id="users" level={1}>
|
|
24
|
+
All Users
|
|
25
|
+
</NavigationItem>
|
|
26
|
+
<NavigationItem id="roles" level={1}>
|
|
27
|
+
Roles
|
|
28
|
+
</NavigationItem>
|
|
29
|
+
<NavigationItem id="permissions" level={1}>
|
|
30
|
+
Permissions
|
|
31
|
+
</NavigationItem>
|
|
30
32
|
</NavigationGroup>
|
|
31
33
|
);
|
|
32
34
|
}
|
|
@@ -100,11 +102,7 @@ Icons work at any nesting level.
|
|
|
100
102
|
function AdminNavigation() {
|
|
101
103
|
return (
|
|
102
104
|
<>
|
|
103
|
-
<NavigationGroup
|
|
104
|
-
title="User Management"
|
|
105
|
-
startDecorator={<PeopleIcon />}
|
|
106
|
-
defaultExpanded={true}
|
|
107
|
-
>
|
|
105
|
+
<NavigationGroup title="User Management" startDecorator={<PeopleIcon />} defaultExpanded={true}>
|
|
108
106
|
<NavigationItem id="users" level={1}>
|
|
109
107
|
All Users
|
|
110
108
|
</NavigationItem>
|
|
@@ -116,10 +114,7 @@ function AdminNavigation() {
|
|
|
116
114
|
</NavigationItem>
|
|
117
115
|
</NavigationGroup>
|
|
118
116
|
|
|
119
|
-
<NavigationGroup
|
|
120
|
-
title="Content"
|
|
121
|
-
startDecorator={<ArticleIcon />}
|
|
122
|
-
>
|
|
117
|
+
<NavigationGroup title="Content" startDecorator={<ArticleIcon />}>
|
|
123
118
|
<NavigationItem id="posts" level={1}>
|
|
124
119
|
Posts
|
|
125
120
|
</NavigationItem>
|
|
@@ -131,10 +126,7 @@ function AdminNavigation() {
|
|
|
131
126
|
</NavigationItem>
|
|
132
127
|
</NavigationGroup>
|
|
133
128
|
|
|
134
|
-
<NavigationGroup
|
|
135
|
-
title="Settings"
|
|
136
|
-
startDecorator={<SettingsIcon />}
|
|
137
|
-
>
|
|
129
|
+
<NavigationGroup title="Settings" startDecorator={<SettingsIcon />}>
|
|
138
130
|
<NavigationItem id="general" level={1}>
|
|
139
131
|
General
|
|
140
132
|
</NavigationItem>
|
|
@@ -155,20 +147,12 @@ function AdminNavigation() {
|
|
|
155
147
|
```tsx
|
|
156
148
|
function NestedNavigation() {
|
|
157
149
|
return (
|
|
158
|
-
<NavigationGroup
|
|
159
|
-
title="E-commerce"
|
|
160
|
-
startDecorator={<ShoppingCartIcon />}
|
|
161
|
-
defaultExpanded={true}
|
|
162
|
-
>
|
|
150
|
+
<NavigationGroup title="E-commerce" startDecorator={<ShoppingCartIcon />} defaultExpanded={true}>
|
|
163
151
|
<NavigationItem id="dashboard" level={1}>
|
|
164
152
|
Dashboard
|
|
165
153
|
</NavigationItem>
|
|
166
154
|
|
|
167
|
-
<NavigationGroup
|
|
168
|
-
title="Products"
|
|
169
|
-
level={1}
|
|
170
|
-
defaultExpanded={true}
|
|
171
|
-
>
|
|
155
|
+
<NavigationGroup title="Products" level={1} defaultExpanded={true}>
|
|
172
156
|
<NavigationItem id="all-products" level={2}>
|
|
173
157
|
All Products
|
|
174
158
|
</NavigationItem>
|
|
@@ -180,10 +164,7 @@ function NestedNavigation() {
|
|
|
180
164
|
</NavigationItem>
|
|
181
165
|
</NavigationGroup>
|
|
182
166
|
|
|
183
|
-
<NavigationGroup
|
|
184
|
-
title="Orders"
|
|
185
|
-
level={1}
|
|
186
|
-
>
|
|
167
|
+
<NavigationGroup title="Orders" level={1}>
|
|
187
168
|
<NavigationItem id="all-orders" level={2}>
|
|
188
169
|
All Orders
|
|
189
170
|
</NavigationItem>
|
|
@@ -247,11 +228,7 @@ function DocsSidebar({ sections, currentPath }) {
|
|
|
247
228
|
NavigationGroup extends Joy UI's Accordion, so you can use additional Accordion props:
|
|
248
229
|
|
|
249
230
|
```tsx
|
|
250
|
-
<NavigationGroup
|
|
251
|
-
title="Settings"
|
|
252
|
-
expanded={isExpanded}
|
|
253
|
-
onChange={(event, expanded) => setIsExpanded(expanded)}
|
|
254
|
-
>
|
|
231
|
+
<NavigationGroup title="Settings" expanded={isExpanded} onChange={(event, expanded) => setIsExpanded(expanded)}>
|
|
255
232
|
{/* Content */}
|
|
256
233
|
</NavigationGroup>
|
|
257
234
|
```
|
|
@@ -366,11 +343,7 @@ function LazyNavigationGroup({ title, loadContent }) {
|
|
|
366
343
|
};
|
|
367
344
|
|
|
368
345
|
return (
|
|
369
|
-
<NavigationGroup
|
|
370
|
-
title={title}
|
|
371
|
-
expanded={expanded}
|
|
372
|
-
onChange={handleChange}
|
|
373
|
-
>
|
|
346
|
+
<NavigationGroup title={title} expanded={expanded} onChange={handleChange}>
|
|
374
347
|
{content || <Skeleton />}
|
|
375
348
|
</NavigationGroup>
|
|
376
349
|
);
|
|
@@ -386,11 +359,7 @@ function SidebarNavigation() {
|
|
|
386
359
|
const [expandedGroups, setExpandedGroups] = useState(['products']);
|
|
387
360
|
|
|
388
361
|
const handleGroupChange = (groupId) => (event, isExpanded) => {
|
|
389
|
-
setExpandedGroups((prev) =>
|
|
390
|
-
isExpanded
|
|
391
|
-
? [...prev, groupId]
|
|
392
|
-
: prev.filter((id) => id !== groupId)
|
|
393
|
-
);
|
|
362
|
+
setExpandedGroups((prev) => (isExpanded ? [...prev, groupId] : prev.filter((id) => id !== groupId)));
|
|
394
363
|
};
|
|
395
364
|
|
|
396
365
|
return (
|
|
@@ -248,9 +248,7 @@ NavigationItem includes built-in accessibility features:
|
|
|
248
248
|
|
|
249
249
|
```tsx
|
|
250
250
|
// Selected state is announced
|
|
251
|
-
<NavigationItem selected={true}>
|
|
252
|
-
Dashboard {/* Announced as "Dashboard, current page" */}
|
|
253
|
-
</NavigationItem>
|
|
251
|
+
<NavigationItem selected={true}>Dashboard {/* Announced as "Dashboard, current page" */}</NavigationItem>
|
|
254
252
|
```
|
|
255
253
|
|
|
256
254
|
## Best Practices
|
|
@@ -309,7 +307,9 @@ const handleClick = useCallback((id) => {
|
|
|
309
307
|
}, []);
|
|
310
308
|
|
|
311
309
|
// Pass stable handler to all items
|
|
312
|
-
<NavigationItem id="item1" onClick={handleClick}>
|
|
310
|
+
<NavigationItem id="item1" onClick={handleClick}>
|
|
311
|
+
Item 1
|
|
312
|
+
</NavigationItem>;
|
|
313
313
|
```
|
|
314
314
|
|
|
315
315
|
### Avoid Inline Objects
|
|
@@ -318,11 +318,11 @@ Don't create new decorator elements on each render:
|
|
|
318
318
|
|
|
319
319
|
```tsx
|
|
320
320
|
// ❌ Bad: New element created each render
|
|
321
|
-
<NavigationItem startDecorator={<HomeIcon />}>Home</NavigationItem
|
|
321
|
+
<NavigationItem startDecorator={<HomeIcon />}>Home</NavigationItem>;
|
|
322
322
|
|
|
323
323
|
// ✅ Good: Memoized or static
|
|
324
324
|
const homeIcon = <HomeIcon />;
|
|
325
|
-
<NavigationItem startDecorator={homeIcon}>Home</NavigationItem
|
|
325
|
+
<NavigationItem startDecorator={homeIcon}>Home</NavigationItem>;
|
|
326
326
|
```
|
|
327
327
|
|
|
328
328
|
NavigationItem provides a foundational building block for sidebar navigation. Use it within Navigator for automatic item management, or combine it with NavigationGroup for custom hierarchical navigation structures.
|
|
@@ -161,12 +161,7 @@ function FileBrowser({ folders, onFolderSelect }) {
|
|
|
161
161
|
});
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
return (
|
|
165
|
-
<Navigator
|
|
166
|
-
items={buildNavigatorItems(folders)}
|
|
167
|
-
onSelect={onFolderSelect}
|
|
168
|
-
/>
|
|
169
|
-
);
|
|
164
|
+
return <Navigator items={buildNavigatorItems(folders)} onSelect={onFolderSelect} />;
|
|
170
165
|
}
|
|
171
166
|
```
|
|
172
167
|
|
|
@@ -225,11 +220,11 @@ Navigator uses a composition pattern with NavigationItem and NavigationGroup:
|
|
|
225
220
|
|
|
226
221
|
```tsx
|
|
227
222
|
interface NavigatorItem {
|
|
228
|
-
id: string;
|
|
229
|
-
type: 'item';
|
|
230
|
-
title: string | React.ReactNode;
|
|
231
|
-
startDecorator?: React.ReactNode;
|
|
232
|
-
selected?: boolean;
|
|
223
|
+
id: string; // Unique identifier
|
|
224
|
+
type: 'item'; // Indicates a navigation item
|
|
225
|
+
title: string | React.ReactNode; // Display text or element
|
|
226
|
+
startDecorator?: React.ReactNode; // Icon before title
|
|
227
|
+
selected?: boolean; // Selection state
|
|
233
228
|
}
|
|
234
229
|
```
|
|
235
230
|
|
|
@@ -237,11 +232,11 @@ interface NavigatorItem {
|
|
|
237
232
|
|
|
238
233
|
```tsx
|
|
239
234
|
interface NavigatorGroup {
|
|
240
|
-
type: 'group';
|
|
241
|
-
title: string | React.ReactNode;
|
|
242
|
-
startDecorator?: React.ReactNode;
|
|
243
|
-
expanded?: boolean;
|
|
244
|
-
content: React.ReactNode;
|
|
235
|
+
type: 'group'; // Indicates a group
|
|
236
|
+
title: string | React.ReactNode; // Group title
|
|
237
|
+
startDecorator?: React.ReactNode; // Icon before title
|
|
238
|
+
expanded?: boolean; // Default expanded state
|
|
239
|
+
content: React.ReactNode; // Content when expanded (usually nested Navigator)
|
|
245
240
|
}
|
|
246
241
|
```
|
|
247
242
|
|
|
@@ -314,7 +309,7 @@ const items = [
|
|
|
314
309
|
// ❌ Bad: Inconsistent icons
|
|
315
310
|
const items = [
|
|
316
311
|
{ id: 'home', type: 'item', title: 'Home', startDecorator: <HomeIcon /> },
|
|
317
|
-
{ id: 'settings', type: 'item', title: 'Settings' },
|
|
312
|
+
{ id: 'settings', type: 'item', title: 'Settings' }, // Missing icon
|
|
318
313
|
];
|
|
319
314
|
```
|
|
320
315
|
|
|
@@ -358,17 +353,20 @@ function Sidebar() {
|
|
|
358
353
|
When items are computed, memoize them to prevent unnecessary re-renders:
|
|
359
354
|
|
|
360
355
|
```tsx
|
|
361
|
-
const items = useMemo(
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
356
|
+
const items = useMemo(
|
|
357
|
+
() => [
|
|
358
|
+
{
|
|
359
|
+
id: 'home',
|
|
360
|
+
type: 'item',
|
|
361
|
+
title: 'Home',
|
|
362
|
+
selected: currentPath === '/home',
|
|
363
|
+
},
|
|
364
|
+
// ... more items
|
|
365
|
+
],
|
|
366
|
+
[currentPath],
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
<Navigator items={items} onSelect={handleSelect} />;
|
|
372
370
|
```
|
|
373
371
|
|
|
374
372
|
### Lazy Load Content
|
|
@@ -8,15 +8,15 @@ Pagination ships in two variants -- **standard** (clickable page numbers) and **
|
|
|
8
8
|
|
|
9
9
|
```tsx
|
|
10
10
|
<Stack spacing={4}>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
<Stack spacing={1}>
|
|
12
|
+
<div>Standard</div>
|
|
13
|
+
<Pagination {...args} variant="standard" />
|
|
14
|
+
</Stack>
|
|
15
|
+
<Stack spacing={1}>
|
|
16
|
+
<div>Compact</div>
|
|
17
|
+
<Pagination {...args} variant="compact" />
|
|
18
|
+
</Stack>
|
|
18
19
|
</Stack>
|
|
19
|
-
</Stack>
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
| Field | Description | Default |
|
|
@@ -36,11 +36,7 @@ function DataList() {
|
|
|
36
36
|
return (
|
|
37
37
|
<>
|
|
38
38
|
<ItemList items={items} page={page} pageSize={pageSize} />
|
|
39
|
-
<Pagination
|
|
40
|
-
rowCount={totalItems}
|
|
41
|
-
paginationModel={{ page, pageSize }}
|
|
42
|
-
onPageChange={setPage}
|
|
43
|
-
/>
|
|
39
|
+
<Pagination rowCount={totalItems} paginationModel={{ page, pageSize }} onPageChange={setPage} />
|
|
44
40
|
</>
|
|
45
41
|
);
|
|
46
42
|
}
|
|
@@ -54,19 +50,19 @@ Pagination is available in three sizes -- `sm`, `md`, and `lg` -- for both the s
|
|
|
54
50
|
|
|
55
51
|
```tsx
|
|
56
52
|
<Stack spacing={4}>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
<Stack spacing={2}>
|
|
54
|
+
<div>Standard</div>
|
|
55
|
+
<Pagination {...args} variant="standard" size="sm" />
|
|
56
|
+
<Pagination {...args} variant="standard" size="md" />
|
|
57
|
+
<Pagination {...args} variant="standard" size="lg" />
|
|
58
|
+
</Stack>
|
|
59
|
+
<Stack spacing={2}>
|
|
60
|
+
<div>Compact</div>
|
|
61
|
+
<Pagination {...args} variant="compact" size="sm" />
|
|
62
|
+
<Pagination {...args} variant="compact" size="md" />
|
|
63
|
+
<Pagination {...args} variant="compact" size="lg" />
|
|
64
|
+
</Stack>
|
|
68
65
|
</Stack>
|
|
69
|
-
</Stack>
|
|
70
66
|
```
|
|
71
67
|
|
|
72
68
|
### Page Positions
|
|
@@ -75,37 +71,61 @@ The component correctly handles the visual presentation when the user is at the
|
|
|
75
71
|
|
|
76
72
|
```tsx
|
|
77
73
|
<Stack spacing={4}>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
74
|
+
<Stack spacing={2}>
|
|
75
|
+
<div>Standard</div>
|
|
76
|
+
<Pagination
|
|
77
|
+
{...args}
|
|
78
|
+
variant="standard"
|
|
79
|
+
defaultPaginationModel={{
|
|
80
|
+
page: 1,
|
|
81
|
+
pageSize: 1
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
<Pagination
|
|
85
|
+
{...args}
|
|
86
|
+
variant="standard"
|
|
87
|
+
defaultPaginationModel={{
|
|
88
|
+
page: 10,
|
|
89
|
+
pageSize: 1
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
<Pagination
|
|
93
|
+
{...args}
|
|
94
|
+
variant="standard"
|
|
95
|
+
defaultPaginationModel={{
|
|
96
|
+
page: 20,
|
|
97
|
+
pageSize: 1
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
</Stack>
|
|
101
|
+
<Stack spacing={2}>
|
|
102
|
+
<div>Compact</div>
|
|
103
|
+
<Pagination
|
|
104
|
+
{...args}
|
|
105
|
+
variant="compact"
|
|
106
|
+
defaultPaginationModel={{
|
|
107
|
+
page: 1,
|
|
108
|
+
pageSize: 1
|
|
109
|
+
}}
|
|
110
|
+
/>
|
|
111
|
+
<Pagination
|
|
112
|
+
{...args}
|
|
113
|
+
variant="compact"
|
|
114
|
+
defaultPaginationModel={{
|
|
115
|
+
page: 10,
|
|
116
|
+
pageSize: 1
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
<Pagination
|
|
120
|
+
{...args}
|
|
121
|
+
variant="compact"
|
|
122
|
+
defaultPaginationModel={{
|
|
123
|
+
page: 20,
|
|
124
|
+
pageSize: 1
|
|
125
|
+
}}
|
|
126
|
+
/>
|
|
127
|
+
</Stack>
|
|
107
128
|
</Stack>
|
|
108
|
-
</Stack>
|
|
109
129
|
```
|
|
110
130
|
|
|
111
131
|
### Uncontrolled Mode
|
|
@@ -130,12 +150,12 @@ Pagination automatically adjusts when the total number of items changes. If the
|
|
|
130
150
|
|
|
131
151
|
```tsx
|
|
132
152
|
<Stack gap={2}>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
153
|
+
<Pagination {...args} rowCount={rowCount} />
|
|
154
|
+
<Stack direction="row" gap={2}>
|
|
155
|
+
<Button onClick={() => setRowCount(rowCount - 1)}>Decrease Row count</Button>
|
|
156
|
+
<Button onClick={() => setRowCount(rowCount + 1)}>Increase Row count</Button>
|
|
157
|
+
</Stack>
|
|
137
158
|
</Stack>
|
|
138
|
-
</Stack>
|
|
139
159
|
```
|
|
140
160
|
|
|
141
161
|
## Common Use Cases
|
|
@@ -153,14 +173,9 @@ function DataTable({ columns }) {
|
|
|
153
173
|
<Table columns={columns} data={data} loading={isLoading} />
|
|
154
174
|
<Stack direction="row" justifyContent="space-between" alignItems="center" mt={2}>
|
|
155
175
|
<Typography level="body-sm">
|
|
156
|
-
Showing {(page - 1) * pageSize + 1}--{Math.min(page * pageSize, totalCount)} of{
|
|
157
|
-
{totalCount}
|
|
176
|
+
Showing {(page - 1) * pageSize + 1}--{Math.min(page * pageSize, totalCount)} of {totalCount}
|
|
158
177
|
</Typography>
|
|
159
|
-
<Pagination
|
|
160
|
-
rowCount={totalCount}
|
|
161
|
-
paginationModel={{ page, pageSize }}
|
|
162
|
-
onPageChange={setPage}
|
|
163
|
-
/>
|
|
178
|
+
<Pagination rowCount={totalCount} paginationModel={{ page, pageSize }} onPageChange={setPage} />
|
|
164
179
|
</Stack>
|
|
165
180
|
</Box>
|
|
166
181
|
);
|
|
@@ -180,7 +195,9 @@ function SearchResults({ query }) {
|
|
|
180
195
|
|
|
181
196
|
return (
|
|
182
197
|
<Stack spacing={2}>
|
|
183
|
-
<Typography level="body-sm">
|
|
198
|
+
<Typography level="body-sm">
|
|
199
|
+
{totalCount} results for "{query}"
|
|
200
|
+
</Typography>
|
|
184
201
|
<ResultList results={results} />
|
|
185
202
|
<Pagination
|
|
186
203
|
rowCount={totalCount}
|
|
@@ -204,13 +221,7 @@ function URLPaginatedList() {
|
|
|
204
221
|
setSearchParams({ page: String(newPage) });
|
|
205
222
|
};
|
|
206
223
|
|
|
207
|
-
return
|
|
208
|
-
<Pagination
|
|
209
|
-
rowCount={totalCount}
|
|
210
|
-
paginationModel={{ page, pageSize: 25 }}
|
|
211
|
-
onPageChange={handlePageChange}
|
|
212
|
-
/>
|
|
213
|
-
);
|
|
224
|
+
return <Pagination rowCount={totalCount} paginationModel={{ page, pageSize: 25 }} onPageChange={handlePageChange} />;
|
|
214
225
|
}
|
|
215
226
|
```
|
|
216
227
|
|
|
@@ -146,10 +146,7 @@ function FormWizard() {
|
|
|
146
146
|
<Box sx={{ mt: 3 }}>
|
|
147
147
|
{/* Step content rendered here based on activeStep */}
|
|
148
148
|
<Stack direction="row" gap={1} sx={{ mt: 2 }}>
|
|
149
|
-
<Button
|
|
150
|
-
disabled={activeStep <= 1}
|
|
151
|
-
onClick={() => setActiveStep((prev) => prev - 1)}
|
|
152
|
-
>
|
|
149
|
+
<Button disabled={activeStep <= 1} onClick={() => setActiveStep((prev) => prev - 1)}>
|
|
153
150
|
Back
|
|
154
151
|
</Button>
|
|
155
152
|
<Button onClick={() => setActiveStep((prev) => prev + 1)}>
|
|
@@ -193,14 +190,7 @@ function CompactProgress({ currentStep, totalSteps }) {
|
|
|
193
190
|
indicatorContent: i + 1,
|
|
194
191
|
}));
|
|
195
192
|
|
|
196
|
-
return
|
|
197
|
-
<Stepper
|
|
198
|
-
steps={steps}
|
|
199
|
-
activeStep={currentStep}
|
|
200
|
-
orientation="horizontal"
|
|
201
|
-
stepOrientation="vertical"
|
|
202
|
-
/>
|
|
203
|
-
);
|
|
193
|
+
return <Stepper steps={steps} activeStep={currentStep} orientation="horizontal" stepOrientation="vertical" />;
|
|
204
194
|
}
|
|
205
195
|
```
|
|
206
196
|
|
|
@@ -43,21 +43,21 @@ Default horizontal tab navigation with tab panels.
|
|
|
43
43
|
|
|
44
44
|
```tsx
|
|
45
45
|
<Tabs {...args}>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</Tabs>
|
|
46
|
+
<TabList>
|
|
47
|
+
<Tab color={color} variant={variant}>
|
|
48
|
+
Tab1
|
|
49
|
+
</Tab>
|
|
50
|
+
<Tab color={color} variant={variant}>
|
|
51
|
+
Tab2
|
|
52
|
+
</Tab>
|
|
53
|
+
<Tab color={color} variant={variant}>
|
|
54
|
+
Tab3
|
|
55
|
+
</Tab>
|
|
56
|
+
</TabList>
|
|
57
|
+
<TabPanel value={0}>Tab list1</TabPanel>
|
|
58
|
+
<TabPanel value={1}>Tab list2</TabPanel>
|
|
59
|
+
<TabPanel value={2}>Tab list3</TabPanel>
|
|
60
|
+
</Tabs>
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
### Variants
|
|
@@ -90,21 +90,21 @@ Add icons or other elements before or after the tab label using `startDecorator`
|
|
|
90
90
|
|
|
91
91
|
```tsx
|
|
92
92
|
<Tabs {...args}>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
</Tabs>
|
|
93
|
+
<TabList>
|
|
94
|
+
<Tab startDecorator={<Call />} color={color} variant={variant}>
|
|
95
|
+
Tab1
|
|
96
|
+
</Tab>
|
|
97
|
+
<Tab endDecorator={<Sms />} color={color} variant={variant}>
|
|
98
|
+
Tab2
|
|
99
|
+
</Tab>
|
|
100
|
+
<Tab startDecorator={<Email />} endDecorator={<MoreVert />} color={color} variant={variant}>
|
|
101
|
+
Tab3
|
|
102
|
+
</Tab>
|
|
103
|
+
</TabList>
|
|
104
|
+
<TabPanel value={0}>Tab list1</TabPanel>
|
|
105
|
+
<TabPanel value={1}>Tab list2</TabPanel>
|
|
106
|
+
<TabPanel value={2}>Tab list3</TabPanel>
|
|
107
|
+
</Tabs>
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
### Vertical Orientation
|
|
@@ -144,9 +144,15 @@ function SettingsPage() {
|
|
|
144
144
|
<Tab startDecorator={<SecurityIcon />}>Security</Tab>
|
|
145
145
|
<Tab startDecorator={<NotificationsIcon />}>Notifications</Tab>
|
|
146
146
|
</TabList>
|
|
147
|
-
<TabPanel value={0}
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
<TabPanel value={0}>
|
|
148
|
+
<ProfileSettings />
|
|
149
|
+
</TabPanel>
|
|
150
|
+
<TabPanel value={1}>
|
|
151
|
+
<SecuritySettings />
|
|
152
|
+
</TabPanel>
|
|
153
|
+
<TabPanel value={2}>
|
|
154
|
+
<NotificationSettings />
|
|
155
|
+
</TabPanel>
|
|
150
156
|
</Tabs>
|
|
151
157
|
);
|
|
152
158
|
}
|
|
@@ -165,9 +171,15 @@ function DashboardTabs() {
|
|
|
165
171
|
<Tab value="week">This Week</Tab>
|
|
166
172
|
<Tab value="month">This Month</Tab>
|
|
167
173
|
</TabList>
|
|
168
|
-
<TabPanel value="day"
|
|
169
|
-
|
|
170
|
-
|
|
174
|
+
<TabPanel value="day">
|
|
175
|
+
<DailyStats />
|
|
176
|
+
</TabPanel>
|
|
177
|
+
<TabPanel value="week">
|
|
178
|
+
<WeeklyStats />
|
|
179
|
+
</TabPanel>
|
|
180
|
+
<TabPanel value="month">
|
|
181
|
+
<MonthlyStats />
|
|
182
|
+
</TabPanel>
|
|
171
183
|
</Tabs>
|
|
172
184
|
);
|
|
173
185
|
}
|