@manago/admin 0.1.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 +164 -0
- package/dist/index.d.mts +79 -0
- package/dist/index.mjs +1465 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles/globals.css +3937 -0
- package/dist/styles/globals.css.map +1 -0
- package/dist/styles/globals.d.mts +2 -0
- package/package.json +111 -0
package/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# @manago/admin
|
|
2
|
+
|
|
3
|
+
A beautiful, fully-featured admin dashboard component library for Next.js built with shadcn/ui, TanStack Router, and Tailwind CSS.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 Beautiful UI components built with shadcn/ui
|
|
8
|
+
- 🚀 Built for Next.js 15+ with React 19
|
|
9
|
+
- 📱 Fully responsive with mobile support
|
|
10
|
+
- 🎯 Type-safe with TypeScript
|
|
11
|
+
- 🔐 Built-in authentication with Zustand
|
|
12
|
+
- 🎭 Collapsible sidebar with icon mode
|
|
13
|
+
- 🌐 Client-side routing with TanStack Router
|
|
14
|
+
- ⚡ Fast and optimized with tsup
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @manago/admin
|
|
20
|
+
# or
|
|
21
|
+
pnpm add @manago/admin
|
|
22
|
+
# or
|
|
23
|
+
yarn add @manago/admin
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Peer Dependencies
|
|
27
|
+
|
|
28
|
+
Make sure you have these installed:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install next@^15.0.0 react@^19.0.0 react-dom@^19.0.0
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
### Basic Setup
|
|
37
|
+
|
|
38
|
+
1. Import the styles in your root layout:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
// app/layout.tsx
|
|
42
|
+
import "@manago/admin/styles";
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
2. Create an admin page with catch-all routes:
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
// app/admin/[[...slug]]/page.tsx
|
|
49
|
+
'use client'
|
|
50
|
+
|
|
51
|
+
import { ManagoProvider, ManagoAdmin } from '@manago/admin'
|
|
52
|
+
|
|
53
|
+
export default function AdminPage() {
|
|
54
|
+
return (
|
|
55
|
+
<ManagoProvider
|
|
56
|
+
apiKey={process.env.NEXT_PUBLIC_MANAGO_API_KEY!}
|
|
57
|
+
config={{
|
|
58
|
+
appName: 'My Admin Dashboard',
|
|
59
|
+
menu: {
|
|
60
|
+
users: false, // Hide specific menu items
|
|
61
|
+
},
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<ManagoAdmin />
|
|
65
|
+
</ManagoProvider>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Configuration
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<ManagoProvider
|
|
74
|
+
apiKey="your-api-key"
|
|
75
|
+
config={{
|
|
76
|
+
appName: 'My Store Admin',
|
|
77
|
+
logo: '/logo.png', // or React component
|
|
78
|
+
menu: {
|
|
79
|
+
dashboard: true,
|
|
80
|
+
products: true,
|
|
81
|
+
orders: true,
|
|
82
|
+
customers: true,
|
|
83
|
+
payments: true,
|
|
84
|
+
users: false,
|
|
85
|
+
settings: true,
|
|
86
|
+
},
|
|
87
|
+
customMenuItems: [
|
|
88
|
+
{
|
|
89
|
+
href: '/analytics',
|
|
90
|
+
label: 'Analytics',
|
|
91
|
+
icon: '📊',
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<ManagoAdmin />
|
|
97
|
+
</ManagoProvider>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Features
|
|
101
|
+
|
|
102
|
+
### Dashboard
|
|
103
|
+
- Real-time statistics
|
|
104
|
+
- Recent orders and products
|
|
105
|
+
- Beautiful cards and charts
|
|
106
|
+
|
|
107
|
+
### Sidebar Navigation
|
|
108
|
+
- Collapsible to icon mode
|
|
109
|
+
- Active state highlighting
|
|
110
|
+
- Custom menu items support
|
|
111
|
+
- Mobile-responsive
|
|
112
|
+
|
|
113
|
+
### Authentication
|
|
114
|
+
- Built-in login page
|
|
115
|
+
- Persistent authentication with Zustand
|
|
116
|
+
- Protected routes
|
|
117
|
+
|
|
118
|
+
## Styling
|
|
119
|
+
|
|
120
|
+
The package uses Tailwind CSS v4. Make sure your project has Tailwind CSS configured.
|
|
121
|
+
|
|
122
|
+
The styles are automatically imported when you import `@manago/admin/styles`.
|
|
123
|
+
|
|
124
|
+
## API
|
|
125
|
+
|
|
126
|
+
### Components
|
|
127
|
+
|
|
128
|
+
- `ManagoProvider` - Main provider component
|
|
129
|
+
- `ManagoAdmin` - Admin dashboard component
|
|
130
|
+
|
|
131
|
+
### Configuration Options
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
interface AdminConfig {
|
|
135
|
+
appName?: string
|
|
136
|
+
logo?: string | React.ReactNode
|
|
137
|
+
menu?: {
|
|
138
|
+
dashboard?: boolean
|
|
139
|
+
products?: boolean
|
|
140
|
+
orders?: boolean
|
|
141
|
+
customers?: boolean
|
|
142
|
+
payments?: boolean
|
|
143
|
+
users?: boolean
|
|
144
|
+
settings?: boolean
|
|
145
|
+
}
|
|
146
|
+
customMenuItems?: Array<{
|
|
147
|
+
href: string
|
|
148
|
+
label: string
|
|
149
|
+
icon: string
|
|
150
|
+
}>
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
MIT
|
|
157
|
+
|
|
158
|
+
## Author
|
|
159
|
+
|
|
160
|
+
Your Name
|
|
161
|
+
|
|
162
|
+
## Contributing
|
|
163
|
+
|
|
164
|
+
Contributions are welcome! Please open an issue or submit a pull request.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { createRouter } from '@tanstack/react-router';
|
|
4
|
+
|
|
5
|
+
type APIConfig = {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
baseURL?: string;
|
|
8
|
+
};
|
|
9
|
+
declare class ManagoAPIClient {
|
|
10
|
+
private apiKey;
|
|
11
|
+
private baseURL;
|
|
12
|
+
constructor(config: APIConfig);
|
|
13
|
+
request(endpoint: string, options?: RequestInit): Promise<any>;
|
|
14
|
+
login(email: string, password: string): Promise<any>;
|
|
15
|
+
getProducts(params?: {
|
|
16
|
+
page?: number;
|
|
17
|
+
limit?: number;
|
|
18
|
+
}): Promise<any>;
|
|
19
|
+
getProduct(id: string): Promise<any>;
|
|
20
|
+
createProduct(data: any): Promise<any>;
|
|
21
|
+
updateProduct(id: string, data: any): Promise<any>;
|
|
22
|
+
deleteProduct(id: string): Promise<any>;
|
|
23
|
+
getOrders(params?: {
|
|
24
|
+
page?: number;
|
|
25
|
+
limit?: number;
|
|
26
|
+
}): Promise<any>;
|
|
27
|
+
getCustomers(params?: {
|
|
28
|
+
page?: number;
|
|
29
|
+
limit?: number;
|
|
30
|
+
}): Promise<any>;
|
|
31
|
+
getSettings(): Promise<any>;
|
|
32
|
+
updateSettings(data: any): Promise<any>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type AdminMenuItem = {
|
|
36
|
+
href: string;
|
|
37
|
+
label: string;
|
|
38
|
+
icon: string;
|
|
39
|
+
enabled?: boolean;
|
|
40
|
+
};
|
|
41
|
+
type AdminConfig = {
|
|
42
|
+
appName?: string;
|
|
43
|
+
logo?: string | React.ReactNode;
|
|
44
|
+
menu?: {
|
|
45
|
+
dashboard?: boolean;
|
|
46
|
+
products?: boolean;
|
|
47
|
+
orders?: boolean;
|
|
48
|
+
customers?: boolean;
|
|
49
|
+
payments?: boolean;
|
|
50
|
+
users?: boolean;
|
|
51
|
+
settings?: boolean;
|
|
52
|
+
};
|
|
53
|
+
customMenuItems?: AdminMenuItem[];
|
|
54
|
+
features?: {
|
|
55
|
+
multiUser?: boolean;
|
|
56
|
+
analytics?: boolean;
|
|
57
|
+
exports?: boolean;
|
|
58
|
+
};
|
|
59
|
+
theme?: {
|
|
60
|
+
primaryColor?: string;
|
|
61
|
+
sidebarBg?: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
declare function ManagoProvider({ apiKey, config, children, }: {
|
|
66
|
+
apiKey: string;
|
|
67
|
+
config?: Partial<AdminConfig>;
|
|
68
|
+
children: ReactNode;
|
|
69
|
+
}): react_jsx_runtime.JSX.Element;
|
|
70
|
+
declare function useManagoAPI(): ManagoAPIClient;
|
|
71
|
+
|
|
72
|
+
declare module '@tanstack/react-router' {
|
|
73
|
+
interface Register {
|
|
74
|
+
router: ReturnType<typeof createRouter>;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
declare function ManagoAdmin(): react_jsx_runtime.JSX.Element | null;
|
|
78
|
+
|
|
79
|
+
export { type AdminConfig, ManagoAdmin, ManagoProvider, useManagoAPI };
|