@ceed/ads 1.35.0 → 1.36.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/README.md +85 -95
- 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/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/Dropdown/Dropdown.d.ts +28 -1
- package/dist/components/FilterMenu/components/MonthRange.d.ts +11 -0
- package/dist/components/FilterMenu/types.d.ts +5 -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/ProfileMenu/ProfileMenu.d.ts +2 -2
- 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/ThemeProvider/ThemeProvider.d.ts +4 -2
- 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 +101 -104
- 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 -265
- package/dist/components/feedback/Skeleton.md +125 -89
- package/dist/components/index.d.ts +61 -3
- 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/FilterMenu.md +138 -8
- 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 +182 -116
- package/dist/components/navigation/Dropdown.md +732 -391
- package/dist/components/navigation/IconMenuButton.md +14 -6
- package/dist/components/navigation/InsetDrawer.md +550 -378
- package/dist/components/navigation/Link.md +104 -94
- 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/ProfileMenu.md +65 -43
- package/dist/components/navigation/Stepper.md +2 -12
- package/dist/components/navigation/Tabs.md +209 -183
- 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 +65 -40
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +1653 -1560
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1316 -1215
- package/framer/index.js +1 -1
- package/package.json +32 -35
|
@@ -252,11 +252,15 @@ function ToolbarActions({ selectedItems, onAction }) {
|
|
|
252
252
|
- **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".
|
|
253
253
|
|
|
254
254
|
```tsx
|
|
255
|
-
{
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
255
|
+
{
|
|
256
|
+
/* ✅ Good: Clear purpose */
|
|
257
|
+
}
|
|
258
|
+
<MenuButton buttonText="Export Options" items={exportItems} />;
|
|
259
|
+
|
|
260
|
+
{
|
|
261
|
+
/* ❌ Avoid: Vague label */
|
|
262
|
+
}
|
|
263
|
+
<MenuButton buttonText="More" items={items} />;
|
|
260
264
|
```
|
|
261
265
|
|
|
262
266
|
- **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.
|
|
@@ -272,14 +276,18 @@ function ToolbarActions({ selectedItems, onAction }) {
|
|
|
272
276
|
- **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.
|
|
273
277
|
|
|
274
278
|
```tsx
|
|
275
|
-
{
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
{
|
|
279
|
+
{
|
|
280
|
+
/* ❌ Bad: Form selection */
|
|
281
|
+
}
|
|
282
|
+
<MenuButton buttonText={selectedValue} items={options} />;
|
|
283
|
+
|
|
284
|
+
{
|
|
285
|
+
/* ✅ Good: Use Select for forms */
|
|
286
|
+
}
|
|
279
287
|
<Select value={selectedValue} onChange={handleChange}>
|
|
280
288
|
<Option value="a">Option A</Option>
|
|
281
289
|
<Option value="b">Option B</Option>
|
|
282
|
-
</Select
|
|
290
|
+
</Select>;
|
|
283
291
|
```
|
|
284
292
|
|
|
285
293
|
- **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/ads';
|
|
|
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
|
}
|
|
@@ -96,11 +98,7 @@ Icons work at any nesting level.
|
|
|
96
98
|
function AdminNavigation() {
|
|
97
99
|
return (
|
|
98
100
|
<>
|
|
99
|
-
<NavigationGroup
|
|
100
|
-
title="User Management"
|
|
101
|
-
startDecorator={<PeopleIcon />}
|
|
102
|
-
defaultExpanded={true}
|
|
103
|
-
>
|
|
101
|
+
<NavigationGroup title="User Management" startDecorator={<PeopleIcon />} defaultExpanded={true}>
|
|
104
102
|
<NavigationItem id="users" level={1}>
|
|
105
103
|
All Users
|
|
106
104
|
</NavigationItem>
|
|
@@ -112,10 +110,7 @@ function AdminNavigation() {
|
|
|
112
110
|
</NavigationItem>
|
|
113
111
|
</NavigationGroup>
|
|
114
112
|
|
|
115
|
-
<NavigationGroup
|
|
116
|
-
title="Content"
|
|
117
|
-
startDecorator={<ArticleIcon />}
|
|
118
|
-
>
|
|
113
|
+
<NavigationGroup title="Content" startDecorator={<ArticleIcon />}>
|
|
119
114
|
<NavigationItem id="posts" level={1}>
|
|
120
115
|
Posts
|
|
121
116
|
</NavigationItem>
|
|
@@ -127,10 +122,7 @@ function AdminNavigation() {
|
|
|
127
122
|
</NavigationItem>
|
|
128
123
|
</NavigationGroup>
|
|
129
124
|
|
|
130
|
-
<NavigationGroup
|
|
131
|
-
title="Settings"
|
|
132
|
-
startDecorator={<SettingsIcon />}
|
|
133
|
-
>
|
|
125
|
+
<NavigationGroup title="Settings" startDecorator={<SettingsIcon />}>
|
|
134
126
|
<NavigationItem id="general" level={1}>
|
|
135
127
|
General
|
|
136
128
|
</NavigationItem>
|
|
@@ -151,20 +143,12 @@ function AdminNavigation() {
|
|
|
151
143
|
```tsx
|
|
152
144
|
function NestedNavigation() {
|
|
153
145
|
return (
|
|
154
|
-
<NavigationGroup
|
|
155
|
-
title="E-commerce"
|
|
156
|
-
startDecorator={<ShoppingCartIcon />}
|
|
157
|
-
defaultExpanded={true}
|
|
158
|
-
>
|
|
146
|
+
<NavigationGroup title="E-commerce" startDecorator={<ShoppingCartIcon />} defaultExpanded={true}>
|
|
159
147
|
<NavigationItem id="dashboard" level={1}>
|
|
160
148
|
Dashboard
|
|
161
149
|
</NavigationItem>
|
|
162
150
|
|
|
163
|
-
<NavigationGroup
|
|
164
|
-
title="Products"
|
|
165
|
-
level={1}
|
|
166
|
-
defaultExpanded={true}
|
|
167
|
-
>
|
|
151
|
+
<NavigationGroup title="Products" level={1} defaultExpanded={true}>
|
|
168
152
|
<NavigationItem id="all-products" level={2}>
|
|
169
153
|
All Products
|
|
170
154
|
</NavigationItem>
|
|
@@ -176,10 +160,7 @@ function NestedNavigation() {
|
|
|
176
160
|
</NavigationItem>
|
|
177
161
|
</NavigationGroup>
|
|
178
162
|
|
|
179
|
-
<NavigationGroup
|
|
180
|
-
title="Orders"
|
|
181
|
-
level={1}
|
|
182
|
-
>
|
|
163
|
+
<NavigationGroup title="Orders" level={1}>
|
|
183
164
|
<NavigationItem id="all-orders" level={2}>
|
|
184
165
|
All Orders
|
|
185
166
|
</NavigationItem>
|
|
@@ -243,11 +224,7 @@ function DocsSidebar({ sections, currentPath }) {
|
|
|
243
224
|
NavigationGroup extends Joy UI's Accordion, so you can use additional Accordion props:
|
|
244
225
|
|
|
245
226
|
```tsx
|
|
246
|
-
<NavigationGroup
|
|
247
|
-
title="Settings"
|
|
248
|
-
expanded={isExpanded}
|
|
249
|
-
onChange={(event, expanded) => setIsExpanded(expanded)}
|
|
250
|
-
>
|
|
227
|
+
<NavigationGroup title="Settings" expanded={isExpanded} onChange={(event, expanded) => setIsExpanded(expanded)}>
|
|
251
228
|
{/* Content */}
|
|
252
229
|
</NavigationGroup>
|
|
253
230
|
```
|
|
@@ -362,11 +339,7 @@ function LazyNavigationGroup({ title, loadContent }) {
|
|
|
362
339
|
};
|
|
363
340
|
|
|
364
341
|
return (
|
|
365
|
-
<NavigationGroup
|
|
366
|
-
title={title}
|
|
367
|
-
expanded={expanded}
|
|
368
|
-
onChange={handleChange}
|
|
369
|
-
>
|
|
342
|
+
<NavigationGroup title={title} expanded={expanded} onChange={handleChange}>
|
|
370
343
|
{content || <Skeleton />}
|
|
371
344
|
</NavigationGroup>
|
|
372
345
|
);
|
|
@@ -382,11 +355,7 @@ function SidebarNavigation() {
|
|
|
382
355
|
const [expandedGroups, setExpandedGroups] = useState(['products']);
|
|
383
356
|
|
|
384
357
|
const handleGroupChange = (groupId) => (event, isExpanded) => {
|
|
385
|
-
setExpandedGroups((prev) =>
|
|
386
|
-
isExpanded
|
|
387
|
-
? [...prev, groupId]
|
|
388
|
-
: prev.filter((id) => id !== groupId)
|
|
389
|
-
);
|
|
358
|
+
setExpandedGroups((prev) => (isExpanded ? [...prev, groupId] : prev.filter((id) => id !== groupId)));
|
|
390
359
|
};
|
|
391
360
|
|
|
392
361
|
return (
|
|
@@ -244,9 +244,7 @@ NavigationItem includes built-in accessibility features:
|
|
|
244
244
|
|
|
245
245
|
```tsx
|
|
246
246
|
// Selected state is announced
|
|
247
|
-
<NavigationItem selected={true}>
|
|
248
|
-
Dashboard {/* Announced as "Dashboard, current page" */}
|
|
249
|
-
</NavigationItem>
|
|
247
|
+
<NavigationItem selected={true}>Dashboard {/* Announced as "Dashboard, current page" */}</NavigationItem>
|
|
250
248
|
```
|
|
251
249
|
|
|
252
250
|
## Best Practices
|
|
@@ -305,7 +303,9 @@ const handleClick = useCallback((id) => {
|
|
|
305
303
|
}, []);
|
|
306
304
|
|
|
307
305
|
// Pass stable handler to all items
|
|
308
|
-
<NavigationItem id="item1" onClick={handleClick}>
|
|
306
|
+
<NavigationItem id="item1" onClick={handleClick}>
|
|
307
|
+
Item 1
|
|
308
|
+
</NavigationItem>;
|
|
309
309
|
```
|
|
310
310
|
|
|
311
311
|
### Avoid Inline Objects
|
|
@@ -314,11 +314,11 @@ Don't create new decorator elements on each render:
|
|
|
314
314
|
|
|
315
315
|
```tsx
|
|
316
316
|
// ❌ Bad: New element created each render
|
|
317
|
-
<NavigationItem startDecorator={<HomeIcon />}>Home</NavigationItem
|
|
317
|
+
<NavigationItem startDecorator={<HomeIcon />}>Home</NavigationItem>;
|
|
318
318
|
|
|
319
319
|
// ✅ Good: Memoized or static
|
|
320
320
|
const homeIcon = <HomeIcon />;
|
|
321
|
-
<NavigationItem startDecorator={homeIcon}>Home</NavigationItem
|
|
321
|
+
<NavigationItem startDecorator={homeIcon}>Home</NavigationItem>;
|
|
322
322
|
```
|
|
323
323
|
|
|
324
324
|
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.
|
|
@@ -157,12 +157,7 @@ function FileBrowser({ folders, onFolderSelect }) {
|
|
|
157
157
|
});
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
-
return (
|
|
161
|
-
<Navigator
|
|
162
|
-
items={buildNavigatorItems(folders)}
|
|
163
|
-
onSelect={onFolderSelect}
|
|
164
|
-
/>
|
|
165
|
-
);
|
|
160
|
+
return <Navigator items={buildNavigatorItems(folders)} onSelect={onFolderSelect} />;
|
|
166
161
|
}
|
|
167
162
|
```
|
|
168
163
|
|
|
@@ -221,11 +216,11 @@ Navigator uses a composition pattern with NavigationItem and NavigationGroup:
|
|
|
221
216
|
|
|
222
217
|
```tsx
|
|
223
218
|
interface NavigatorItem {
|
|
224
|
-
id: string;
|
|
225
|
-
type: 'item';
|
|
226
|
-
title: string | React.ReactNode;
|
|
227
|
-
startDecorator?: React.ReactNode;
|
|
228
|
-
selected?: boolean;
|
|
219
|
+
id: string; // Unique identifier
|
|
220
|
+
type: 'item'; // Indicates a navigation item
|
|
221
|
+
title: string | React.ReactNode; // Display text or element
|
|
222
|
+
startDecorator?: React.ReactNode; // Icon before title
|
|
223
|
+
selected?: boolean; // Selection state
|
|
229
224
|
}
|
|
230
225
|
```
|
|
231
226
|
|
|
@@ -233,11 +228,11 @@ interface NavigatorItem {
|
|
|
233
228
|
|
|
234
229
|
```tsx
|
|
235
230
|
interface NavigatorGroup {
|
|
236
|
-
type: 'group';
|
|
237
|
-
title: string | React.ReactNode;
|
|
238
|
-
startDecorator?: React.ReactNode;
|
|
239
|
-
expanded?: boolean;
|
|
240
|
-
content: React.ReactNode;
|
|
231
|
+
type: 'group'; // Indicates a group
|
|
232
|
+
title: string | React.ReactNode; // Group title
|
|
233
|
+
startDecorator?: React.ReactNode; // Icon before title
|
|
234
|
+
expanded?: boolean; // Default expanded state
|
|
235
|
+
content: React.ReactNode; // Content when expanded (usually nested Navigator)
|
|
241
236
|
}
|
|
242
237
|
```
|
|
243
238
|
|
|
@@ -310,7 +305,7 @@ const items = [
|
|
|
310
305
|
// ❌ Bad: Inconsistent icons
|
|
311
306
|
const items = [
|
|
312
307
|
{ id: 'home', type: 'item', title: 'Home', startDecorator: <HomeIcon /> },
|
|
313
|
-
{ id: 'settings', type: 'item', title: 'Settings' },
|
|
308
|
+
{ id: 'settings', type: 'item', title: 'Settings' }, // Missing icon
|
|
314
309
|
];
|
|
315
310
|
```
|
|
316
311
|
|
|
@@ -354,17 +349,20 @@ function Sidebar() {
|
|
|
354
349
|
When items are computed, memoize them to prevent unnecessary re-renders:
|
|
355
350
|
|
|
356
351
|
```tsx
|
|
357
|
-
const items = useMemo(
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
352
|
+
const items = useMemo(
|
|
353
|
+
() => [
|
|
354
|
+
{
|
|
355
|
+
id: 'home',
|
|
356
|
+
type: 'item',
|
|
357
|
+
title: 'Home',
|
|
358
|
+
selected: currentPath === '/home',
|
|
359
|
+
},
|
|
360
|
+
// ... more items
|
|
361
|
+
],
|
|
362
|
+
[currentPath],
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
<Navigator items={items} onSelect={handleSelect} />;
|
|
368
366
|
```
|
|
369
367
|
|
|
370
368
|
### 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
|
}
|
|
@@ -52,19 +48,19 @@ Pagination is available in three sizes -- `sm`, `md`, and `lg` -- for both the s
|
|
|
52
48
|
|
|
53
49
|
```tsx
|
|
54
50
|
<Stack spacing={4}>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
<Stack spacing={2}>
|
|
52
|
+
<div>Standard</div>
|
|
53
|
+
<Pagination {...args} variant="standard" size="sm" />
|
|
54
|
+
<Pagination {...args} variant="standard" size="md" />
|
|
55
|
+
<Pagination {...args} variant="standard" size="lg" />
|
|
56
|
+
</Stack>
|
|
57
|
+
<Stack spacing={2}>
|
|
58
|
+
<div>Compact</div>
|
|
59
|
+
<Pagination {...args} variant="compact" size="sm" />
|
|
60
|
+
<Pagination {...args} variant="compact" size="md" />
|
|
61
|
+
<Pagination {...args} variant="compact" size="lg" />
|
|
62
|
+
</Stack>
|
|
66
63
|
</Stack>
|
|
67
|
-
</Stack>
|
|
68
64
|
```
|
|
69
65
|
|
|
70
66
|
## Pagination Page Positions
|
|
@@ -73,37 +69,61 @@ The component correctly handles the visual presentation when the user is at the
|
|
|
73
69
|
|
|
74
70
|
```tsx
|
|
75
71
|
<Stack spacing={4}>
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
72
|
+
<Stack spacing={2}>
|
|
73
|
+
<div>Standard</div>
|
|
74
|
+
<Pagination
|
|
75
|
+
{...args}
|
|
76
|
+
variant="standard"
|
|
77
|
+
defaultPaginationModel={{
|
|
78
|
+
page: 1,
|
|
79
|
+
pageSize: 1
|
|
80
|
+
}}
|
|
81
|
+
/>
|
|
82
|
+
<Pagination
|
|
83
|
+
{...args}
|
|
84
|
+
variant="standard"
|
|
85
|
+
defaultPaginationModel={{
|
|
86
|
+
page: 10,
|
|
87
|
+
pageSize: 1
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
<Pagination
|
|
91
|
+
{...args}
|
|
92
|
+
variant="standard"
|
|
93
|
+
defaultPaginationModel={{
|
|
94
|
+
page: 20,
|
|
95
|
+
pageSize: 1
|
|
96
|
+
}}
|
|
97
|
+
/>
|
|
98
|
+
</Stack>
|
|
99
|
+
<Stack spacing={2}>
|
|
100
|
+
<div>Compact</div>
|
|
101
|
+
<Pagination
|
|
102
|
+
{...args}
|
|
103
|
+
variant="compact"
|
|
104
|
+
defaultPaginationModel={{
|
|
105
|
+
page: 1,
|
|
106
|
+
pageSize: 1
|
|
107
|
+
}}
|
|
108
|
+
/>
|
|
109
|
+
<Pagination
|
|
110
|
+
{...args}
|
|
111
|
+
variant="compact"
|
|
112
|
+
defaultPaginationModel={{
|
|
113
|
+
page: 10,
|
|
114
|
+
pageSize: 1
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
<Pagination
|
|
118
|
+
{...args}
|
|
119
|
+
variant="compact"
|
|
120
|
+
defaultPaginationModel={{
|
|
121
|
+
page: 20,
|
|
122
|
+
pageSize: 1
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
</Stack>
|
|
105
126
|
</Stack>
|
|
106
|
-
</Stack>
|
|
107
127
|
```
|
|
108
128
|
|
|
109
129
|
## Uncontrolled Pagination
|
|
@@ -128,12 +148,12 @@ Pagination automatically adjusts when the total number of items changes. If the
|
|
|
128
148
|
|
|
129
149
|
```tsx
|
|
130
150
|
<Stack gap={2}>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
151
|
+
<Pagination {...args} rowCount={rowCount} />
|
|
152
|
+
<Stack direction="row" gap={2}>
|
|
153
|
+
<Button onClick={() => setRowCount(rowCount - 1)}>Decrease Row count</Button>
|
|
154
|
+
<Button onClick={() => setRowCount(rowCount + 1)}>Increase Row count</Button>
|
|
155
|
+
</Stack>
|
|
135
156
|
</Stack>
|
|
136
|
-
</Stack>
|
|
137
157
|
```
|
|
138
158
|
|
|
139
159
|
## Pagination for Data Table
|
|
@@ -149,14 +169,9 @@ function DataTable({ columns }) {
|
|
|
149
169
|
<Table columns={columns} data={data} loading={isLoading} />
|
|
150
170
|
<Stack direction="row" justifyContent="space-between" alignItems="center" mt={2}>
|
|
151
171
|
<Typography level="body-sm">
|
|
152
|
-
Showing {(page - 1) * pageSize + 1}--{Math.min(page * pageSize, totalCount)} of{
|
|
153
|
-
{totalCount}
|
|
172
|
+
Showing {(page - 1) * pageSize + 1}--{Math.min(page * pageSize, totalCount)} of {totalCount}
|
|
154
173
|
</Typography>
|
|
155
|
-
<Pagination
|
|
156
|
-
rowCount={totalCount}
|
|
157
|
-
paginationModel={{ page, pageSize }}
|
|
158
|
-
onPageChange={setPage}
|
|
159
|
-
/>
|
|
174
|
+
<Pagination rowCount={totalCount} paginationModel={{ page, pageSize }} onPageChange={setPage} />
|
|
160
175
|
</Stack>
|
|
161
176
|
</Box>
|
|
162
177
|
);
|
|
@@ -176,7 +191,9 @@ function SearchResults({ query }) {
|
|
|
176
191
|
|
|
177
192
|
return (
|
|
178
193
|
<Stack spacing={2}>
|
|
179
|
-
<Typography level="body-sm">
|
|
194
|
+
<Typography level="body-sm">
|
|
195
|
+
{totalCount} results for "{query}"
|
|
196
|
+
</Typography>
|
|
180
197
|
<ResultList results={results} />
|
|
181
198
|
<Pagination
|
|
182
199
|
rowCount={totalCount}
|
|
@@ -200,13 +217,7 @@ function URLPaginatedList() {
|
|
|
200
217
|
setSearchParams({ page: String(newPage) });
|
|
201
218
|
};
|
|
202
219
|
|
|
203
|
-
return
|
|
204
|
-
<Pagination
|
|
205
|
-
rowCount={totalCount}
|
|
206
|
-
paginationModel={{ page, pageSize: 25 }}
|
|
207
|
-
onPageChange={handlePageChange}
|
|
208
|
-
/>
|
|
209
|
-
);
|
|
220
|
+
return <Pagination rowCount={totalCount} paginationModel={{ page, pageSize: 25 }} onPageChange={handlePageChange} />;
|
|
210
221
|
}
|
|
211
222
|
```
|
|
212
223
|
|
|
@@ -174,35 +174,53 @@ ProfileMenu supports `md` (default) and `sm` size variants for use in different
|
|
|
174
174
|
|
|
175
175
|
```tsx
|
|
176
176
|
<Stack direction="row" gap="150px">
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
177
|
+
<ProfileMenu
|
|
178
|
+
{...args}
|
|
179
|
+
size="md"
|
|
180
|
+
profile={{
|
|
181
|
+
name: "John Gordon",
|
|
182
|
+
chip: "PDT",
|
|
183
|
+
caption: "j.gordon@haulla.com"
|
|
184
|
+
}}
|
|
185
|
+
menuItems={[
|
|
186
|
+
{
|
|
187
|
+
label: "Menu Item1",
|
|
188
|
+
onClick: fn()
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
label: "Menu Item2",
|
|
192
|
+
onClick: fn()
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
label: "Menu Item3",
|
|
196
|
+
onClick: fn()
|
|
197
|
+
}
|
|
198
|
+
]}
|
|
199
|
+
/>
|
|
200
|
+
<ProfileMenu
|
|
201
|
+
{...args}
|
|
202
|
+
size="sm"
|
|
203
|
+
profile={{
|
|
204
|
+
name: "John Gordon",
|
|
205
|
+
chip: "PDT",
|
|
206
|
+
caption: "j.gordon@haulla.com"
|
|
207
|
+
}}
|
|
208
|
+
menuItems={[
|
|
209
|
+
{
|
|
210
|
+
label: "Menu Item1",
|
|
211
|
+
onClick: fn()
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
label: "Menu Item2",
|
|
215
|
+
onClick: fn()
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
label: "Menu Item3",
|
|
219
|
+
onClick: fn()
|
|
220
|
+
}
|
|
221
|
+
]}
|
|
222
|
+
/>
|
|
223
|
+
</Stack>
|
|
206
224
|
```
|
|
207
225
|
|
|
208
226
|
## Avatar
|
|
@@ -241,17 +259,23 @@ ProfileMenu automatically generates initials from various name formats, includin
|
|
|
241
259
|
|
|
242
260
|
```tsx
|
|
243
261
|
<>
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
262
|
+
<ProfileMenu
|
|
263
|
+
{...args}
|
|
264
|
+
profile={{
|
|
265
|
+
name: "홍길동",
|
|
266
|
+
chip: "PDT",
|
|
267
|
+
caption: "j.gordon@haulla.com"
|
|
268
|
+
}}
|
|
269
|
+
/>
|
|
270
|
+
<ProfileMenu
|
|
271
|
+
{...args}
|
|
272
|
+
profile={{
|
|
273
|
+
name: "제갈공명",
|
|
274
|
+
chip: "PDT",
|
|
275
|
+
caption: "j.gordon@haulla.com"
|
|
276
|
+
}}
|
|
277
|
+
/>
|
|
278
|
+
</>
|
|
255
279
|
```
|
|
256
280
|
|
|
257
281
|
## Controlled vs Uncontrolled
|
|
@@ -404,9 +428,7 @@ function OrgProfileMenu({ user, organization }) {
|
|
|
404
428
|
|
|
405
429
|
```tsx
|
|
406
430
|
// ✅ Good: Clear user context
|
|
407
|
-
<ProfileMenu
|
|
408
|
-
profile={{ name: 'Jane Smith', caption: 'jane@company.com', chip: 'Admin' }}
|
|
409
|
-
/>
|
|
431
|
+
<ProfileMenu profile={{ name: 'Jane Smith', caption: 'jane@company.com', chip: 'Admin' }} />
|
|
410
432
|
```
|
|
411
433
|
|
|
412
434
|
3. **Keep menu items concise**: Limit the number of menu items to 5-7 maximum. Move less common actions to a dedicated settings page.
|