@ttoss/components 2.5.1 → 2.6.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 +64 -0
- package/dist/JsonEditor/index.d.ts +0 -1
- package/dist/NavList/index.d.ts +54 -0
- package/dist/esm/Menu/index.js +2188 -16
- package/dist/esm/NavList/index.js +235 -0
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -177,6 +177,70 @@ import { Menu } from '@ttoss/components/Menu';
|
|
|
177
177
|
</Menu>;
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
+
### NavList
|
|
181
|
+
|
|
182
|
+
Navigation lists for sidebars, menus, and dropdowns with icons, grouping, and routing integration. [📖 Docs](https://storybook.ttoss.dev/?path=/docs/components-navlist--docs)
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
import { NavList } from '@ttoss/components/NavList';
|
|
186
|
+
|
|
187
|
+
// Simple navigation
|
|
188
|
+
<NavList
|
|
189
|
+
items={[
|
|
190
|
+
{ id: '1', label: 'Home', href: '/', icon: 'mdi:home' },
|
|
191
|
+
{ id: '2', label: 'Profile', href: '/profile', icon: 'mdi:account' },
|
|
192
|
+
{ id: '3', label: 'Settings', href: '/settings', icon: 'mdi:cog' },
|
|
193
|
+
]}
|
|
194
|
+
variant="sidebar"
|
|
195
|
+
/>
|
|
196
|
+
|
|
197
|
+
// With groups
|
|
198
|
+
<NavList
|
|
199
|
+
groups={[
|
|
200
|
+
{
|
|
201
|
+
id: 'main',
|
|
202
|
+
label: 'Main Menu',
|
|
203
|
+
items: [
|
|
204
|
+
{ id: '1', label: 'Dashboard', href: '/dashboard', icon: 'mdi:view-dashboard' },
|
|
205
|
+
{ id: '2', label: 'Analytics', href: '/analytics', icon: 'mdi:chart-line' },
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: 'settings',
|
|
210
|
+
label: 'Settings',
|
|
211
|
+
items: [
|
|
212
|
+
{ id: '3', label: 'Account', href: '/account', icon: 'mdi:account-cog' },
|
|
213
|
+
],
|
|
214
|
+
divider: true, // Divider after group
|
|
215
|
+
},
|
|
216
|
+
]}
|
|
217
|
+
/>
|
|
218
|
+
|
|
219
|
+
// With Next.js routing
|
|
220
|
+
import NextLink from 'next/link';
|
|
221
|
+
|
|
222
|
+
<NavList
|
|
223
|
+
items={items}
|
|
224
|
+
LinkComponent={NextLink}
|
|
225
|
+
onItemClick={(item) => console.log('Clicked:', item)}
|
|
226
|
+
/>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Variants:**
|
|
230
|
+
|
|
231
|
+
- `sidebar` - Sidebar navigation with larger icons (20px) and generous spacing
|
|
232
|
+
- `menu` - Card-based menu with hover animations (18px icons)
|
|
233
|
+
- `dropdown` - Compact dropdown with subtle borders (16px icons)
|
|
234
|
+
|
|
235
|
+
**Features:**
|
|
236
|
+
|
|
237
|
+
- **Auto-grouping** - Items automatically group by `group` property
|
|
238
|
+
- **Active states** - Highlight active items with `active` prop
|
|
239
|
+
- **Disabled items** - Prevent interaction with `disabled` prop
|
|
240
|
+
- **Dividers** - Visual separators with `divider` prop on items or groups
|
|
241
|
+
- **Icon support** - 200k+ icons via `@ttoss/react-icons`
|
|
242
|
+
- **Custom routing** - Compatible with Next.js, React Router via `LinkComponent`
|
|
243
|
+
|
|
180
244
|
### Modal
|
|
181
245
|
|
|
182
246
|
Theme-aware modals with accessibility features. [📖 Docs](https://storybook.ttoss.dev/?path=/docs/components-modal--docs)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
type NavListItem = {
|
|
5
|
+
id?: string;
|
|
6
|
+
label: string;
|
|
7
|
+
href: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
active?: boolean;
|
|
11
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
12
|
+
group?: string;
|
|
13
|
+
divider?: boolean;
|
|
14
|
+
};
|
|
15
|
+
type NavListGroup = {
|
|
16
|
+
id?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
items: NavListItem[];
|
|
19
|
+
divider?: boolean;
|
|
20
|
+
};
|
|
21
|
+
type NavListProps = {
|
|
22
|
+
items?: NavListItem[];
|
|
23
|
+
groups?: NavListGroup[];
|
|
24
|
+
variant?: 'sidebar' | 'menu' | 'dropdown';
|
|
25
|
+
onItemClick?: (item: NavListItem) => void;
|
|
26
|
+
sx?: Record<string, unknown>;
|
|
27
|
+
iconSize?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Custom Link component to use for rendering links.
|
|
30
|
+
* Useful for integrating with Next.js Link, React Router Link, etc.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Next.js
|
|
34
|
+
* import NextLink from 'next/link';
|
|
35
|
+
* <NavList LinkComponent={NextLink} ... />
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // React Router
|
|
39
|
+
* import { Link as RouterLink } from 'react-router-dom';
|
|
40
|
+
* <NavList LinkComponent={RouterLink} ... />
|
|
41
|
+
*/
|
|
42
|
+
LinkComponent?: React.ComponentType<{
|
|
43
|
+
href: string;
|
|
44
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
49
|
+
declare const NavList: {
|
|
50
|
+
({ items, groups, variant, onItemClick, sx, iconSize, LinkComponent, }: NavListProps): react_jsx_runtime.JSX.Element;
|
|
51
|
+
displayName: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { NavList, type NavListGroup, type NavListItem, type NavListProps };
|