@pattern-stack/frontend-patterns 0.0.6 → 0.1.1
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/atoms/composed/index.d.ts +0 -1
- package/dist/atoms/composed/index.d.ts.map +1 -1
- package/dist/atoms/types/index.d.ts +0 -2
- package/dist/atoms/types/index.d.ts.map +1 -1
- package/dist/atoms/ui/ErrorBoundary.d.ts +1 -1
- package/dist/atoms/ui/button.d.ts +1 -1
- package/dist/atoms/utils/utils.d.ts +0 -2
- package/dist/atoms/utils/utils.d.ts.map +1 -1
- package/dist/features/auth/components/ProtectedRoute.d.ts +1 -1
- package/dist/frontend-patterns.css +1 -1
- package/dist/index.es.js +15 -403
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +14 -403
- package/dist/index.js.map +1 -1
- package/dist/molecules/layout/Sidebar.d.ts.map +1 -1
- package/dist/molecules/layout/SidebarButton/SidebarButton.d.ts +0 -2
- package/dist/molecules/layout/SidebarButton/SidebarButton.d.ts.map +1 -1
- package/dist/molecules/layout/index.d.ts +0 -3
- package/dist/molecules/layout/index.d.ts.map +1 -1
- package/dist/templates/factory.d.ts +1 -2
- package/dist/templates/factory.d.ts.map +1 -1
- package/dist/templates/index.d.ts.map +1 -1
- package/package.json +3 -7
- package/src/App.tsx +1 -11
- package/src/atoms/composed/index.ts +0 -1
- package/src/atoms/types/index.ts +1 -3
- package/src/atoms/utils/utils.ts +2 -4
- package/src/molecules/layout/Sidebar.tsx +23 -10
- package/src/molecules/layout/SidebarButton/SidebarButton.tsx +10 -32
- package/src/molecules/layout/index.ts +1 -4
- package/src/organisms/index.ts +1 -5
- package/src/pages/AdminShowcase/AdminDashboardShowcase.tsx +75 -77
- package/src/pages/AdminShowcase/index.tsx +1 -2
- package/src/pages/index.ts +1 -2
- package/src/templates/factory.tsx +7 -14
- package/src/templates/index.ts +0 -4
- package/dist/atoms/composed/SalesPanel/SalesPanel.d.ts +0 -19
- package/dist/atoms/composed/SalesPanel/SalesPanel.d.ts.map +0 -1
- package/dist/atoms/composed/SalesPanel/index.d.ts +0 -2
- package/dist/atoms/composed/SalesPanel/index.d.ts.map +0 -1
- package/dist/atoms/composed/SalesPanel/mockSalesData.d.ts +0 -63
- package/dist/atoms/composed/SalesPanel/mockSalesData.d.ts.map +0 -1
- package/dist/atoms/types/entity-config.d.ts +0 -117
- package/dist/atoms/types/entity-config.d.ts.map +0 -1
- package/dist/atoms/types/navigation.d.ts +0 -30
- package/dist/atoms/types/navigation.d.ts.map +0 -1
- package/dist/atoms/utils/icon-resolver.d.ts +0 -72
- package/dist/atoms/utils/icon-resolver.d.ts.map +0 -1
- package/dist/atoms/utils/metric-engine.d.ts +0 -30
- package/dist/atoms/utils/metric-engine.d.ts.map +0 -1
- package/dist/molecules/layout/DashboardWithSidePanel/DashboardWithSidePanel.d.ts +0 -16
- package/dist/molecules/layout/DashboardWithSidePanel/DashboardWithSidePanel.d.ts.map +0 -1
- package/dist/molecules/layout/DashboardWithSidePanel/index.d.ts +0 -2
- package/dist/molecules/layout/DashboardWithSidePanel/index.d.ts.map +0 -1
- package/dist/molecules/layout/NavigationContext.d.ts +0 -15
- package/dist/molecules/layout/NavigationContext.d.ts.map +0 -1
- package/src/__tests__/atoms/composed/databadge.test.tsx +0 -106
- package/src/__tests__/atoms/composed/statcard.test.tsx +0 -133
- package/src/__tests__/atoms/utils/icon-resolver.test.tsx +0 -140
- package/src/atoms/composed/SalesPanel/SalesPanel.tsx +0 -116
- package/src/atoms/composed/SalesPanel/index.ts +0 -1
- package/src/atoms/composed/SalesPanel/mockSalesData.ts +0 -151
- package/src/atoms/types/entity-config.ts +0 -127
- package/src/atoms/types/navigation.ts +0 -43
- package/src/atoms/utils/icon-resolver.tsx +0 -54
- package/src/atoms/utils/metric-engine.ts +0 -236
- package/src/molecules/layout/DashboardWithSidePanel/DashboardWithSidePanel.tsx +0 -42
- package/src/molecules/layout/DashboardWithSidePanel/index.ts +0 -1
- package/src/molecules/layout/NavigationContext.tsx +0 -63
- package/src/organisms/entity/CategoryBreakdownPanel.tsx +0 -427
- package/src/organisms/entity/EntityListPanel.tsx +0 -339
- package/src/organisms/entity/MetricsOverviewPanel.tsx +0 -236
- package/src/organisms/entity/TrendAnalysisPanel.tsx +0 -337
- package/src/organisms/entity/index.ts +0 -4
- package/src/pages/AdminShowcase/SalesPerformanceDashboard.tsx +0 -158
- package/src/pages/EntityShowcase/EntityManagementShowcase.tsx +0 -137
- package/src/pages/EntityShowcase/EntityPerformanceShowcase.tsx +0 -117
- package/src/pages/EntityShowcase/index.ts +0 -2
- package/src/pages/EntityTemplateExample.tsx +0 -229
- package/src/pages/TestEntityTemplate.tsx +0 -40
- package/src/templates/entity/EntityManagementTemplate.tsx +0 -430
- package/src/templates/entity/EntityPerformanceDashboardTemplate.tsx +0 -277
- package/src/templates/entity/configs/financial-config.ts +0 -141
- package/src/templates/entity/configs/index.ts +0 -1
- package/src/templates/entity/index.ts +0 -3
- package/src/templates/financial/FinancialDashboardTemplate.tsx +0 -326
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../src/molecules/layout/Sidebar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../src/molecules/layout/Sidebar.tsx"],"names":[],"mappings":"AAqBA,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,OAAO,GAAI,eAAe,YAAY,4CAsHlD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarButton.d.ts","sourceRoot":"","sources":["../../../../src/molecules/layout/SidebarButton/SidebarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,kBAAkB;IAC1B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"SidebarButton.d.ts","sourceRoot":"","sources":["../../../../src/molecules/layout/SidebarButton/SidebarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,kBAAkB;IAC1B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoFtD,CAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export { PageTemplate, type PageTemplateProps } from './PageTemplate';
|
|
2
2
|
export { ShowcaseSection } from './ShowcaseSection';
|
|
3
3
|
export { AppLayout } from './AppLayout';
|
|
4
|
-
export { DashboardWithSidePanel } from './DashboardWithSidePanel';
|
|
5
4
|
export { SectionHeader } from './SectionHeader';
|
|
6
5
|
export { SidebarButton } from './SidebarButton';
|
|
7
6
|
export { AppHeader } from './AppHeader';
|
|
8
7
|
export { SidebarProvider, useSidebar } from './SidebarContext';
|
|
9
|
-
export { NavigationProvider, useNavigation, getNavigationItems } from './NavigationContext';
|
|
10
|
-
export { Sidebar } from './Sidebar';
|
|
11
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecules/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecules/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
import type { AuthConfig
|
|
3
|
+
import type { AuthConfig } from '../atoms/types';
|
|
4
4
|
export interface AppConfig {
|
|
5
5
|
title: string;
|
|
6
6
|
description?: string;
|
|
@@ -14,7 +14,6 @@ export interface AppConfig {
|
|
|
14
14
|
theme?: string;
|
|
15
15
|
darkMode?: boolean;
|
|
16
16
|
auth?: AuthConfig;
|
|
17
|
-
navigation?: NavigationConfig;
|
|
18
17
|
customProviders?: React.ComponentType<{
|
|
19
18
|
children: ReactNode;
|
|
20
19
|
}>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/templates/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/templates/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAStC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,eAAe,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,EAAE,CAAA;CACjE;AAGD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,SAAS,CAAA;IACvB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,KAAK,IAAI,CAAA;IACvD,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CACpC;AAGD,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,WAAW,CA6HtE;AAGD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAE1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,gBAAgB,CAAC;AAGxB,cAAc,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,gBAAgB,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,cAAc,EACd,eAAe,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@pattern-stack/frontend-patterns",
|
|
3
3
|
"description": "Production-ready React frontend template with atomic architecture patterns. Build ultra-lean applications by importing shared UI foundation patterns.",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.1.1",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
8
8
|
"typescript",
|
|
@@ -44,8 +44,7 @@
|
|
|
44
44
|
"scripts": {
|
|
45
45
|
"dev": "vite",
|
|
46
46
|
"build": "tsc -b && vite build",
|
|
47
|
-
"build:lib": "npm run clean && vite build --mode library &&
|
|
48
|
-
"build:types": "tsc --project tsconfig.lib.json",
|
|
47
|
+
"build:lib": "npm run clean && vite build --mode library && tsc -p tsconfig.lib.json",
|
|
49
48
|
"clean": "rm -rf dist",
|
|
50
49
|
"lint": "eslint .",
|
|
51
50
|
"lint:fix": "eslint . --fix",
|
|
@@ -103,12 +102,9 @@
|
|
|
103
102
|
"@vitejs/plugin-react": "^4.4.1",
|
|
104
103
|
"@vitest/coverage-v8": "^3.2.1",
|
|
105
104
|
"autoprefixer": "^10.4.21",
|
|
106
|
-
"concurrently": "^9.1.2",
|
|
107
|
-
"cors": "^2.8.5",
|
|
108
105
|
"eslint": "^9.25.0",
|
|
109
106
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
110
107
|
"eslint-plugin-react-refresh": "^0.4.19",
|
|
111
|
-
"express": "^5.1.0",
|
|
112
108
|
"globals": "^16.0.0",
|
|
113
109
|
"jsdom": "^26.1.0",
|
|
114
110
|
"postcss": "^8.5.3",
|
|
@@ -119,4 +115,4 @@
|
|
|
119
115
|
"vite": "^6.3.5",
|
|
120
116
|
"vitest": "^3.2.1"
|
|
121
117
|
}
|
|
122
|
-
}
|
|
118
|
+
}
|
package/src/App.tsx
CHANGED
|
@@ -15,12 +15,8 @@ import {
|
|
|
15
15
|
ComponentShowcase,
|
|
16
16
|
AdminDashboardShowcase,
|
|
17
17
|
AdminCRUDShowcase,
|
|
18
|
-
AdminDetailShowcase
|
|
19
|
-
SalesPerformanceDashboard,
|
|
20
|
-
EntityPerformanceShowcase,
|
|
21
|
-
EntityManagementShowcase
|
|
18
|
+
AdminDetailShowcase
|
|
22
19
|
} from './pages';
|
|
23
|
-
import { EntityTemplateExample } from './pages/EntityTemplateExample';
|
|
24
20
|
|
|
25
21
|
function App() {
|
|
26
22
|
return (
|
|
@@ -45,12 +41,6 @@ function App() {
|
|
|
45
41
|
<Route path="admin/dashboard" element={<ErrorBoundary><AdminDashboardShowcase /></ErrorBoundary>} />
|
|
46
42
|
<Route path="admin/users" element={<ErrorBoundary><AdminCRUDShowcase /></ErrorBoundary>} />
|
|
47
43
|
<Route path="admin/user/:id" element={<ErrorBoundary><AdminDetailShowcase /></ErrorBoundary>} />
|
|
48
|
-
<Route path="admin/sales" element={<ErrorBoundary><SalesPerformanceDashboard /></ErrorBoundary>} />
|
|
49
|
-
|
|
50
|
-
{/* Entity Template Showcases */}
|
|
51
|
-
<Route path="entity/performance" element={<ErrorBoundary><EntityPerformanceShowcase /></ErrorBoundary>} />
|
|
52
|
-
<Route path="entity/management" element={<ErrorBoundary><EntityManagementShowcase /></ErrorBoundary>} />
|
|
53
|
-
<Route path="entity/template-example" element={<ErrorBoundary><EntityTemplateExample /></ErrorBoundary>} />
|
|
54
44
|
|
|
55
45
|
{/* Fallback */}
|
|
56
46
|
<Route path="*" element={<ErrorBoundary><ComponentShowcasePage /></ErrorBoundary>} />
|
package/src/atoms/types/index.ts
CHANGED
package/src/atoms/utils/utils.ts
CHANGED
|
@@ -5,7 +5,5 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
5
5
|
return twMerge(clsx(inputs))
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
// Re-export
|
|
9
|
-
export * from './tooltip-helpers';
|
|
10
|
-
export * from './metric-engine';
|
|
11
|
-
export { Icon, getIcon, isValidIcon } from './icon-resolver';
|
|
8
|
+
// Re-export tooltip helpers
|
|
9
|
+
export * from './tooltip-helpers';
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
|
|
2
|
-
import { cn
|
|
3
|
+
import { cn } from '../../atoms/utils/utils';
|
|
3
4
|
import { useSidebar } from './SidebarContext';
|
|
4
|
-
import { useNavigation, getNavigationItems } from './NavigationContext';
|
|
5
5
|
import { SidebarButton } from './SidebarButton';
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
Palette,
|
|
8
|
+
Menu,
|
|
9
|
+
X,
|
|
10
|
+
Shield,
|
|
11
|
+
Users
|
|
12
|
+
} from 'lucide-react';
|
|
13
|
+
|
|
14
|
+
interface SidebarItem {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
icon: React.ReactNode;
|
|
18
|
+
path: string;
|
|
19
|
+
category?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
20
|
+
}
|
|
8
21
|
|
|
9
22
|
interface SidebarProps {
|
|
10
23
|
className?: string;
|
|
@@ -12,13 +25,15 @@ interface SidebarProps {
|
|
|
12
25
|
|
|
13
26
|
export const Sidebar = ({ className }: SidebarProps) => {
|
|
14
27
|
const { isExpanded, toggleSidebar } = useSidebar();
|
|
15
|
-
const { navigation } = useNavigation();
|
|
16
28
|
const location = useLocation();
|
|
17
29
|
const navigate = useNavigate();
|
|
18
30
|
const [searchParams] = useSearchParams();
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
const items: SidebarItem[] = [
|
|
33
|
+
{ value: 'showcase', label: 'Showcase', icon: <Palette className="w-5 h-5" />, path: '/showcase', category: 5 },
|
|
34
|
+
{ value: 'admin-dashboard', label: 'Admin Dashboard', icon: <Shield className="w-5 h-5" />, path: '/admin/dashboard', category: 2 },
|
|
35
|
+
{ value: 'admin-users', label: 'User Management', icon: <Users className="w-5 h-5" />, path: '/admin/users', category: 3 }
|
|
36
|
+
];
|
|
22
37
|
|
|
23
38
|
const handleNavigation = (path: string) => {
|
|
24
39
|
if (path.includes('?')) {
|
|
@@ -85,14 +100,12 @@ export const Sidebar = ({ className }: SidebarProps) => {
|
|
|
85
100
|
return (
|
|
86
101
|
<SidebarButton
|
|
87
102
|
key={item.value}
|
|
88
|
-
icon={
|
|
103
|
+
icon={item.icon}
|
|
89
104
|
label={item.label}
|
|
90
105
|
active={isActive}
|
|
91
106
|
category={item.category}
|
|
92
107
|
expanded={isExpanded}
|
|
93
108
|
onClick={() => handleNavigation(item.path)}
|
|
94
|
-
badge={item.badge}
|
|
95
|
-
disabled={item.disabled}
|
|
96
109
|
/>
|
|
97
110
|
);
|
|
98
111
|
})}
|
|
@@ -10,8 +10,6 @@ interface SidebarButtonProps {
|
|
|
10
10
|
expanded?: boolean;
|
|
11
11
|
onClick?: () => void;
|
|
12
12
|
className?: string;
|
|
13
|
-
badge?: string | number;
|
|
14
|
-
disabled?: boolean;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
export const SidebarButton: React.FC<SidebarButtonProps> = ({
|
|
@@ -21,15 +19,12 @@ export const SidebarButton: React.FC<SidebarButtonProps> = ({
|
|
|
21
19
|
category = 1,
|
|
22
20
|
expanded = false,
|
|
23
21
|
onClick,
|
|
24
|
-
className
|
|
25
|
-
badge,
|
|
26
|
-
disabled = false
|
|
22
|
+
className
|
|
27
23
|
}) => {
|
|
28
24
|
return (
|
|
29
25
|
<Button
|
|
30
26
|
variant={active ? "secondary" : "ghost"}
|
|
31
27
|
onClick={onClick}
|
|
32
|
-
disabled={disabled}
|
|
33
28
|
tooltip={!expanded ? label : undefined}
|
|
34
29
|
className={cn(
|
|
35
30
|
"relative w-full justify-start gap-3 h-12",
|
|
@@ -79,15 +74,8 @@ export const SidebarButton: React.FC<SidebarButtonProps> = ({
|
|
|
79
74
|
{label}
|
|
80
75
|
</span>
|
|
81
76
|
|
|
82
|
-
{/*
|
|
83
|
-
{
|
|
84
|
-
<span className={cn(
|
|
85
|
-
"px-2 py-0.5 text-xs font-medium rounded-full flex-shrink-0",
|
|
86
|
-
"bg-primary/10 text-primary"
|
|
87
|
-
)}>
|
|
88
|
-
{badge}
|
|
89
|
-
</span>
|
|
90
|
-
) : active && (
|
|
77
|
+
{/* Active indicator dot */}
|
|
78
|
+
{active && (
|
|
91
79
|
<div className={cn(
|
|
92
80
|
"w-2 h-2 rounded-full flex-shrink-0",
|
|
93
81
|
`bg-category-${category}`
|
|
@@ -96,24 +84,14 @@ export const SidebarButton: React.FC<SidebarButtonProps> = ({
|
|
|
96
84
|
</>
|
|
97
85
|
)}
|
|
98
86
|
|
|
99
|
-
{/* Collapsed
|
|
100
|
-
{!expanded &&
|
|
87
|
+
{/* Collapsed active indicator */}
|
|
88
|
+
{!expanded && active && (
|
|
101
89
|
<div className="absolute -top-1 -right-1">
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
)}>
|
|
108
|
-
{badge}
|
|
109
|
-
</span>
|
|
110
|
-
) : active && (
|
|
111
|
-
<div className={cn(
|
|
112
|
-
"w-2.5 h-2.5 rounded-full",
|
|
113
|
-
`bg-category-${category}`,
|
|
114
|
-
"ring-2 ring-background"
|
|
115
|
-
)} />
|
|
116
|
-
)}
|
|
90
|
+
<div className={cn(
|
|
91
|
+
"w-2.5 h-2.5 rounded-full",
|
|
92
|
+
`bg-category-${category}`,
|
|
93
|
+
"ring-2 ring-background"
|
|
94
|
+
)} />
|
|
117
95
|
</div>
|
|
118
96
|
)}
|
|
119
97
|
</Button>
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
export { PageTemplate, type PageTemplateProps } from './PageTemplate';
|
|
2
2
|
export { ShowcaseSection } from './ShowcaseSection';
|
|
3
3
|
export { AppLayout } from './AppLayout';
|
|
4
|
-
export { DashboardWithSidePanel } from './DashboardWithSidePanel';
|
|
5
4
|
export { SectionHeader } from './SectionHeader';
|
|
6
5
|
export { SidebarButton } from './SidebarButton';
|
|
7
6
|
export { AppHeader } from './AppHeader';
|
|
8
|
-
export { SidebarProvider, useSidebar } from './SidebarContext';
|
|
9
|
-
export { NavigationProvider, useNavigation, getNavigationItems } from './NavigationContext';
|
|
10
|
-
export { Sidebar } from './Sidebar';
|
|
7
|
+
export { SidebarProvider, useSidebar } from './SidebarContext';
|
package/src/organisms/index.ts
CHANGED
|
@@ -2,8 +2,4 @@
|
|
|
2
2
|
// These are complete, reusable component interfaces that compose molecules and atoms
|
|
3
3
|
|
|
4
4
|
// Showcase components
|
|
5
|
-
export { ComponentShowcasePage } from './showcase/ComponentShowcasePage';
|
|
6
|
-
|
|
7
|
-
// Entity components - Cross-domain configurable panels
|
|
8
|
-
// TODO: Fix TypeScript errors in entity components before uncommenting
|
|
9
|
-
// export * from './entity';
|
|
5
|
+
export { ComponentShowcasePage } from './showcase/ComponentShowcasePage';
|
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AdminDashboardTemplate } from '../../templates/admin';
|
|
3
3
|
import type { MetricCard, ChartConfig, ActivityItem, AlertItem } from '../../templates/admin';
|
|
4
|
-
import { Users, DollarSign, TrendingUp
|
|
4
|
+
import { Users, DollarSign, TrendingUp } from 'lucide-react';
|
|
5
5
|
|
|
6
6
|
// Mock data for demonstration
|
|
7
7
|
const mockMetrics: MetricCard[] = [
|
|
8
8
|
{
|
|
9
|
-
title: 'Total
|
|
10
|
-
value: '
|
|
11
|
-
change: 15.3,
|
|
12
|
-
changePeriod: 'from last month',
|
|
13
|
-
icon: <DollarSign className="w-5 h-5" />,
|
|
14
|
-
category: 2,
|
|
15
|
-
onClick: () => console.log('Navigate to revenue')
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
title: 'Active Users',
|
|
19
|
-
value: '8,429',
|
|
9
|
+
title: 'Total Users',
|
|
10
|
+
value: '12,486',
|
|
20
11
|
change: 12.5,
|
|
21
|
-
changePeriod: 'from last
|
|
12
|
+
changePeriod: 'from last month',
|
|
22
13
|
icon: <Users className="w-5 h-5" />,
|
|
23
14
|
category: 1,
|
|
24
15
|
onClick: () => console.log('Navigate to users')
|
|
25
16
|
},
|
|
26
17
|
{
|
|
27
|
-
title: '
|
|
28
|
-
value: '
|
|
29
|
-
change: 8.
|
|
30
|
-
changePeriod: 'from
|
|
31
|
-
icon: <
|
|
32
|
-
category:
|
|
33
|
-
onClick: () => console.log('Navigate to
|
|
18
|
+
title: 'Revenue',
|
|
19
|
+
value: '$89,432',
|
|
20
|
+
change: 8.2,
|
|
21
|
+
changePeriod: 'from last month',
|
|
22
|
+
icon: <DollarSign className="w-5 h-5" />,
|
|
23
|
+
category: 2,
|
|
24
|
+
onClick: () => console.log('Navigate to revenue')
|
|
34
25
|
},
|
|
35
26
|
{
|
|
36
|
-
title: '
|
|
37
|
-
value: '
|
|
38
|
-
change: -1
|
|
39
|
-
changePeriod: 'from last
|
|
27
|
+
title: 'Growth Rate',
|
|
28
|
+
value: '23.8%',
|
|
29
|
+
change: -2.1,
|
|
30
|
+
changePeriod: 'from last quarter',
|
|
40
31
|
icon: <TrendingUp className="w-5 h-5" />,
|
|
41
|
-
category:
|
|
32
|
+
category: 3,
|
|
42
33
|
onClick: () => console.log('Navigate to analytics')
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: 'Active Sessions',
|
|
37
|
+
value: '1,247',
|
|
38
|
+
change: 5.7,
|
|
39
|
+
changePeriod: 'from yesterday',
|
|
40
|
+
icon: <Users className="w-5 h-5" />,
|
|
41
|
+
category: 4,
|
|
42
|
+
onClick: () => console.log('Navigate to sessions')
|
|
43
43
|
}
|
|
44
44
|
];
|
|
45
45
|
|
|
46
46
|
const mockCharts: ChartConfig[] = [
|
|
47
47
|
{
|
|
48
|
-
title: '
|
|
48
|
+
title: 'User Growth',
|
|
49
49
|
type: 'line',
|
|
50
50
|
data: [
|
|
51
|
-
{ label: 'Jan', value:
|
|
52
|
-
{ label: 'Feb', value:
|
|
53
|
-
{ label: 'Mar', value:
|
|
54
|
-
{ label: 'Apr', value:
|
|
55
|
-
{ label: 'May', value:
|
|
56
|
-
{ label: 'Jun', value:
|
|
51
|
+
{ label: 'Jan', value: 1200 },
|
|
52
|
+
{ label: 'Feb', value: 1400 },
|
|
53
|
+
{ label: 'Mar', value: 1800 },
|
|
54
|
+
{ label: 'Apr', value: 2200 },
|
|
55
|
+
{ label: 'May', value: 2800 },
|
|
56
|
+
{ label: 'Jun', value: 3200 }
|
|
57
57
|
],
|
|
58
|
-
category:
|
|
58
|
+
category: 1
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
|
-
title: '
|
|
61
|
+
title: 'Revenue Distribution',
|
|
62
62
|
type: 'pie',
|
|
63
63
|
data: [
|
|
64
|
-
{ label: '
|
|
65
|
-
{ label: '
|
|
66
|
-
{ label: '
|
|
64
|
+
{ label: 'Subscriptions', value: 45000, category: 2 },
|
|
65
|
+
{ label: 'One-time', value: 28000, category: 3 },
|
|
66
|
+
{ label: 'Enterprise', value: 16000, category: 1 }
|
|
67
67
|
],
|
|
68
|
-
category:
|
|
68
|
+
category: 2
|
|
69
69
|
}
|
|
70
70
|
];
|
|
71
71
|
|
|
@@ -73,44 +73,44 @@ const mockActivities: ActivityItem[] = [
|
|
|
73
73
|
{
|
|
74
74
|
id: '1',
|
|
75
75
|
type: 'user',
|
|
76
|
-
message: 'New
|
|
77
|
-
timestamp: new Date(Date.now() -
|
|
78
|
-
user: '
|
|
76
|
+
message: 'New user registered: john.doe@example.com',
|
|
77
|
+
timestamp: new Date(Date.now() - 5 * 60 * 1000),
|
|
78
|
+
user: 'System'
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
id: '2',
|
|
82
|
-
type: '
|
|
83
|
-
message: '
|
|
84
|
-
timestamp: new Date(Date.now() -
|
|
85
|
-
user: '
|
|
82
|
+
type: 'security',
|
|
83
|
+
message: 'Failed login attempt detected',
|
|
84
|
+
timestamp: new Date(Date.now() - 15 * 60 * 1000),
|
|
85
|
+
user: 'Security Monitor'
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
id: '3',
|
|
89
|
-
type: '
|
|
90
|
-
message: '
|
|
91
|
-
timestamp: new Date(Date.now() -
|
|
92
|
-
user: '
|
|
89
|
+
type: 'content',
|
|
90
|
+
message: 'Blog post published: "Getting Started Guide"',
|
|
91
|
+
timestamp: new Date(Date.now() - 30 * 60 * 1000),
|
|
92
|
+
user: 'content.manager'
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
id: '4',
|
|
96
96
|
type: 'system',
|
|
97
|
-
message: '
|
|
98
|
-
timestamp: new Date(Date.now() -
|
|
99
|
-
user: '
|
|
97
|
+
message: 'Database backup completed successfully',
|
|
98
|
+
timestamp: new Date(Date.now() - 60 * 60 * 1000),
|
|
99
|
+
user: 'System'
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
id: '5',
|
|
103
103
|
type: 'user',
|
|
104
|
-
message: '
|
|
105
|
-
timestamp: new Date(Date.now() -
|
|
106
|
-
user: '
|
|
104
|
+
message: 'User updated profile: sarah.wilson@example.com',
|
|
105
|
+
timestamp: new Date(Date.now() - 90 * 60 * 1000),
|
|
106
|
+
user: 'sarah.wilson'
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
id: '6',
|
|
110
|
-
type: '
|
|
111
|
-
message: '
|
|
112
|
-
timestamp: new Date(Date.now() -
|
|
113
|
-
user: '
|
|
110
|
+
type: 'error',
|
|
111
|
+
message: 'Payment processing error for order #12847',
|
|
112
|
+
timestamp: new Date(Date.now() - 120 * 60 * 1000),
|
|
113
|
+
user: 'Payment System'
|
|
114
114
|
}
|
|
115
115
|
];
|
|
116
116
|
|
|
@@ -118,26 +118,26 @@ const mockAlerts: AlertItem[] = [
|
|
|
118
118
|
{
|
|
119
119
|
id: '1',
|
|
120
120
|
severity: 'critical',
|
|
121
|
-
title: '
|
|
122
|
-
description: '
|
|
123
|
-
timestamp: new Date(Date.now() -
|
|
124
|
-
onResolve: () => console.log('Resolving
|
|
121
|
+
title: 'High CPU Usage',
|
|
122
|
+
description: 'Server CPU usage has exceeded 90% for the last 5 minutes',
|
|
123
|
+
timestamp: new Date(Date.now() - 10 * 60 * 1000),
|
|
124
|
+
onResolve: () => console.log('Resolving CPU alert')
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
id: '2',
|
|
128
128
|
severity: 'medium',
|
|
129
|
-
title: '
|
|
130
|
-
description: '
|
|
131
|
-
timestamp: new Date(Date.now() -
|
|
132
|
-
onResolve: () => console.log('Resolving
|
|
129
|
+
title: 'Low Disk Space',
|
|
130
|
+
description: 'Database server disk usage is at 85%',
|
|
131
|
+
timestamp: new Date(Date.now() - 30 * 60 * 1000),
|
|
132
|
+
onResolve: () => console.log('Resolving disk space alert')
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
id: '3',
|
|
136
136
|
severity: 'low',
|
|
137
|
-
title: '
|
|
138
|
-
description: '
|
|
139
|
-
timestamp: new Date(Date.now() -
|
|
140
|
-
onResolve: () => console.log('Resolving
|
|
137
|
+
title: 'SSL Certificate Expiring',
|
|
138
|
+
description: 'SSL certificate will expire in 30 days',
|
|
139
|
+
timestamp: new Date(Date.now() - 60 * 60 * 1000),
|
|
140
|
+
onResolve: () => console.log('Resolving SSL alert')
|
|
141
141
|
}
|
|
142
142
|
];
|
|
143
143
|
|
|
@@ -148,8 +148,8 @@ export const AdminDashboardShowcase: React.FC = () => {
|
|
|
148
148
|
|
|
149
149
|
return (
|
|
150
150
|
<AdminDashboardTemplate
|
|
151
|
-
title="
|
|
152
|
-
description="Monitor
|
|
151
|
+
title="System Overview"
|
|
152
|
+
description="Monitor key metrics, system health, and recent activity"
|
|
153
153
|
metrics={mockMetrics}
|
|
154
154
|
charts={mockCharts}
|
|
155
155
|
activities={mockActivities}
|
|
@@ -159,12 +159,10 @@ export const AdminDashboardShowcase: React.FC = () => {
|
|
|
159
159
|
actions={
|
|
160
160
|
<div className="flex gap-2">
|
|
161
161
|
<button className="px-3 py-2 text-sm border border-input rounded-md hover:bg-muted">
|
|
162
|
-
<Calendar className="w-4 h-4 mr-2 inline" />
|
|
163
162
|
Export Report
|
|
164
163
|
</button>
|
|
165
|
-
<button className="px-3 py-2 text-sm bg-category-
|
|
166
|
-
|
|
167
|
-
View Transactions
|
|
164
|
+
<button className="px-3 py-2 text-sm bg-category-1 text-white rounded-md hover:bg-category-1/90">
|
|
165
|
+
View Analytics
|
|
168
166
|
</button>
|
|
169
167
|
</div>
|
|
170
168
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { AdminDashboardShowcase } from './AdminDashboardShowcase';
|
|
2
2
|
export { AdminCRUDShowcase } from './AdminCRUDShowcase';
|
|
3
|
-
export { AdminDetailShowcase } from './AdminDetailShowcase';
|
|
4
|
-
export { SalesPerformanceDashboard } from './SalesPerformanceDashboard';
|
|
3
|
+
export { AdminDetailShowcase } from './AdminDetailShowcase';
|
package/src/pages/index.ts
CHANGED
|
@@ -2,12 +2,13 @@ import React from 'react'
|
|
|
2
2
|
import type { ReactNode } from 'react'
|
|
3
3
|
import { createRoot } from 'react-dom/client'
|
|
4
4
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
5
|
+
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
|
|
5
6
|
import { BrowserRouter, Routes, Route } from 'react-router-dom'
|
|
6
7
|
import { AuthProvider } from '../features/auth'
|
|
7
|
-
import { SidebarProvider
|
|
8
|
+
import { SidebarProvider } from '../molecules/layout'
|
|
8
9
|
import { AppLayout } from '../molecules/layout'
|
|
9
10
|
import { DashboardTemplate } from './DashboardTemplate'
|
|
10
|
-
import type { AuthConfig
|
|
11
|
+
import type { AuthConfig } from '../atoms/types'
|
|
11
12
|
|
|
12
13
|
// App configuration interface
|
|
13
14
|
export interface AppConfig {
|
|
@@ -23,7 +24,6 @@ export interface AppConfig {
|
|
|
23
24
|
theme?: string
|
|
24
25
|
darkMode?: boolean
|
|
25
26
|
auth?: AuthConfig
|
|
26
|
-
navigation?: NavigationConfig
|
|
27
27
|
customProviders?: React.ComponentType<{ children: ReactNode }>[]
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -50,7 +50,6 @@ export function createReactApp(config: AppConfig | string): AppInstance {
|
|
|
50
50
|
enableQuery = true,
|
|
51
51
|
enableRouting = true,
|
|
52
52
|
auth,
|
|
53
|
-
navigation,
|
|
54
53
|
customProviders = []
|
|
55
54
|
} = appConfig
|
|
56
55
|
|
|
@@ -95,11 +94,9 @@ export function createReactApp(config: AppConfig | string): AppInstance {
|
|
|
95
94
|
// Wrap with layout providers
|
|
96
95
|
if (enableRouting) {
|
|
97
96
|
tree = (
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</SidebarProvider>
|
|
102
|
-
</NavigationProvider>
|
|
97
|
+
<SidebarProvider>
|
|
98
|
+
{tree}
|
|
99
|
+
</SidebarProvider>
|
|
103
100
|
)
|
|
104
101
|
}
|
|
105
102
|
|
|
@@ -113,11 +110,7 @@ export function createReactApp(config: AppConfig | string): AppInstance {
|
|
|
113
110
|
tree = (
|
|
114
111
|
<QueryClientProvider client={queryClient}>
|
|
115
112
|
{tree}
|
|
116
|
-
{import.meta.env.DEV &&
|
|
117
|
-
import('@tanstack/react-query-devtools').then(({ ReactQueryDevtools }) => (
|
|
118
|
-
<ReactQueryDevtools initialIsOpen={false} />
|
|
119
|
-
))
|
|
120
|
-
)}
|
|
113
|
+
{import.meta.env.DEV && <ReactQueryDevtools initialIsOpen={false} />}
|
|
121
114
|
</QueryClientProvider>
|
|
122
115
|
)
|
|
123
116
|
}
|