obs-admin-dashboard 1.0.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 +146 -0
- package/dist/Logo.svg +9 -0
- package/dist/assets/AdminLogList-BfZ7mBhN.js +1 -0
- package/dist/assets/AuditLogList-BxAcvoWb.js +1 -0
- package/dist/assets/PrivacyPolicy-CNCYcFG4.js +1 -0
- package/dist/assets/RichTextEditor-CAtXb3v9.js +142 -0
- package/dist/assets/SmtpSettings-JxQfk9ji.js +1 -0
- package/dist/assets/TermsAndConditions-DLe9KIOS.js +1 -0
- package/dist/assets/badge-Cs6Fs9eg.js +1 -0
- package/dist/assets/dm-sans-latin-ext-wght-normal-BOFOeGcA.woff2 +0 -0
- package/dist/assets/dm-sans-latin-wght-normal-Xz1IZZA0.woff2 +0 -0
- package/dist/assets/index-CfBF1H5J.css +1 -0
- package/dist/assets/index-au6lwlT0.js +150 -0
- package/dist/assets/useSettings-DO84-Dur.js +1 -0
- package/dist/index.html +15 -0
- package/dist/logo.png +0 -0
- package/dist/vite.svg +1 -0
- package/package.json +99 -0
- package/src/index.css +99 -0
package/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# obs-admin-dashboard
|
|
2
|
+
|
|
3
|
+
A ready-to-use admin dashboard base package for React apps. It provides the core infrastructure — API layer, layouts, sidebar navigation, shared components, and a `DashboardProvider` — that you can drop into any React application as a starting point.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install obs-admin-dashboard
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
> `react` and `react-dom` are peer dependencies — make sure they're installed in your app.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
The package ships with two usage styles:
|
|
16
|
+
|
|
17
|
+
### 1. Use the `DashboardProvider` (all-in-one)
|
|
18
|
+
|
|
19
|
+
Wrap your app with `DashboardProvider` to get a configured QueryClient, theme, tooltips, and toasts:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { DashboardProvider, AppLayout } from "obs-admin-dashboard"
|
|
23
|
+
import "obs-admin-dashboard/styles.css"
|
|
24
|
+
|
|
25
|
+
function App() {
|
|
26
|
+
return (
|
|
27
|
+
<DashboardProvider
|
|
28
|
+
config={{
|
|
29
|
+
apiUrl: "https://your-api.example.com",
|
|
30
|
+
theme: "system",
|
|
31
|
+
toastPosition: "top-center",
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<AppLayout navItems={myNavItems} brandName="My Company" logoUrl="/logo.png">
|
|
35
|
+
{/* your routed content */}
|
|
36
|
+
</AppLayout>
|
|
37
|
+
</DashboardProvider>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Use individual exports
|
|
43
|
+
|
|
44
|
+
Import only what you need for tree-shaking:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { DataTable, DataPagination, SearchBar, ConfirmDialog } from "obs-admin-dashboard"
|
|
48
|
+
import { useGetItems } from "./my-feature/hooks" // your feature logic
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Exports
|
|
52
|
+
|
|
53
|
+
### Provider
|
|
54
|
+
|
|
55
|
+
| Export | Description |
|
|
56
|
+
|--------|-------------|
|
|
57
|
+
| `DashboardProvider` | Sets up QueryClient, ThemeProvider, TooltipProvider, and Toaster |
|
|
58
|
+
| `DashboardConfig` | Config type (`apiUrl`, `theme`, `toastPosition`, `navItems`) |
|
|
59
|
+
|
|
60
|
+
### API Layer
|
|
61
|
+
|
|
62
|
+
| Export | Description |
|
|
63
|
+
|--------|-------------|
|
|
64
|
+
| `apiClient` | Axios instance with Bearer token + refresh queue |
|
|
65
|
+
| `authClient` | Axios instance for unauthenticated requests (login/register) |
|
|
66
|
+
| `CrudService<T>` | Base class with typed `getAll`, `getById`, `create`, `update`, `delete` |
|
|
67
|
+
| `BASE_URL` | The configured API base URL |
|
|
68
|
+
| `ApiResponse<T>`, `PaginatedApiResponse<T>`, `PaginatedMeta` | API response types |
|
|
69
|
+
|
|
70
|
+
### Layout
|
|
71
|
+
|
|
72
|
+
| Export | Description |
|
|
73
|
+
|--------|-------------|
|
|
74
|
+
| `AppLayout` | Authenticated shell with sidebar + outlet (`navItems`, `brandName`, `logoUrl`, `sidebarFooter`, `redirectPath`) |
|
|
75
|
+
| `AuthLayout` | Centered card layout for login/OTP/password flows |
|
|
76
|
+
| `AppHeader` | Page header with title/total/action button or dropdown |
|
|
77
|
+
| `AppSidebar` | Collapsible sidebar with search, nav, and user footer |
|
|
78
|
+
|
|
79
|
+
### Sidebar
|
|
80
|
+
|
|
81
|
+
| Export | Description |
|
|
82
|
+
|--------|-------------|
|
|
83
|
+
| `SidebarNav` | Navigation menu (`items` prop overrides defaults) |
|
|
84
|
+
| `SidebarUserFooter` | User profile + logout footer |
|
|
85
|
+
| `NavItem`, `NavChild` | Nav item types |
|
|
86
|
+
|
|
87
|
+
### Shared Components
|
|
88
|
+
|
|
89
|
+
| Export | Description |
|
|
90
|
+
|--------|-------------|
|
|
91
|
+
| `DataTable` | TanStack Table v8 wrapper |
|
|
92
|
+
| `DataPagination` | Server-side pagination with page-size selector |
|
|
93
|
+
| `SearchBar` | Debounced search input synced to URL params |
|
|
94
|
+
| `ConfirmDialog` | Delete/confirm alert dialog |
|
|
95
|
+
| `ErrorBoundary` | React error boundary |
|
|
96
|
+
| `ThemeProvider`, `useTheme` | Theme context |
|
|
97
|
+
|
|
98
|
+
### UI Components (shadcn/ui)
|
|
99
|
+
|
|
100
|
+
Re-exported shadcn primitives: `Button`, `Input`, `Label`, `Dialog`, `AlertDialog`, `Card`, `Select`, `Table`, `Form`, `DropdownMenu`, `Sidebar` (+ `useSidebar`).
|
|
101
|
+
|
|
102
|
+
### Utilities & Hooks
|
|
103
|
+
|
|
104
|
+
- `cn` — `clsx` + `tailwind-merge` utility
|
|
105
|
+
- `useIsMobile` — responsive breakpoint hook
|
|
106
|
+
|
|
107
|
+
## Styles
|
|
108
|
+
|
|
109
|
+
Import the package styles in your app's CSS entry (requires Tailwind v4 with the `@tailwindcss/vite` plugin):
|
|
110
|
+
|
|
111
|
+
```css
|
|
112
|
+
@import "obs-admin-dashboard/styles.css";
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## API Configuration
|
|
116
|
+
|
|
117
|
+
Set the API base URL via an environment variable:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
VITE_API_URL=https://your-api.example.com
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`apiClient` automatically attaches `Bearer` tokens from `localStorage.accessToken` and handles token refresh on `401`.
|
|
124
|
+
|
|
125
|
+
## Feature Modules
|
|
126
|
+
|
|
127
|
+
Business logic lives in `src/feature/[name]/` — each feature is self-contained with `types.ts`, `services/`, `hooks/`, `components/`, `page/`, and `routes/routes.tsx`. See `src/feature/CLAUDE.md` for the two supported patterns (dialog-based and page-based).
|
|
128
|
+
|
|
129
|
+
## Commands
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npm run dev # Start dev server
|
|
133
|
+
npm run build # Type-check + Vite app build
|
|
134
|
+
npm run build:lib # Build ESM + UMD + type declarations for publishing
|
|
135
|
+
npm run typecheck # tsc --noEmit
|
|
136
|
+
npm run lint # ESLint
|
|
137
|
+
npm run format # Prettier
|
|
138
|
+
npm pack # Dry-run check of publishable files
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Publishing
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
npm run build:lib
|
|
145
|
+
npm publish
|
|
146
|
+
```
|