@pattern-stack/frontend-patterns 0.0.4 → 0.0.5
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/frontend-patterns.css +1 -1
- package/dist/index.es.js +1917 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1916 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
- package/src/App.tsx +11 -1
- package/src/atoms/composed/SalesPanel/SalesPanel.tsx +116 -0
- package/src/atoms/composed/SalesPanel/index.ts +1 -0
- package/src/atoms/composed/SalesPanel/mockSalesData.ts +151 -0
- package/src/atoms/composed/index.ts +1 -0
- package/src/atoms/types/entity-config.ts +127 -0
- package/src/atoms/types/index.ts +2 -1
- package/src/atoms/utils/metric-engine.ts +236 -0
- package/src/atoms/utils/utils.ts +2 -1
- package/src/molecules/layout/DashboardWithSidePanel/DashboardWithSidePanel.tsx +42 -0
- package/src/molecules/layout/DashboardWithSidePanel/index.ts +1 -0
- package/src/molecules/layout/Sidebar.tsx +10 -2
- package/src/molecules/layout/index.ts +1 -0
- package/src/organisms/entity/CategoryBreakdownPanel.tsx +427 -0
- package/src/organisms/entity/EntityListPanel.tsx +339 -0
- package/src/organisms/entity/MetricsOverviewPanel.tsx +236 -0
- package/src/organisms/entity/TrendAnalysisPanel.tsx +337 -0
- package/src/organisms/entity/index.ts +4 -0
- package/src/organisms/index.ts +4 -1
- package/src/pages/AdminShowcase/AdminDashboardShowcase.tsx +77 -75
- package/src/pages/AdminShowcase/SalesPerformanceDashboard.tsx +158 -0
- package/src/pages/AdminShowcase/index.tsx +2 -1
- package/src/pages/EntityShowcase/EntityManagementShowcase.tsx +137 -0
- package/src/pages/EntityShowcase/EntityPerformanceShowcase.tsx +117 -0
- package/src/pages/EntityShowcase/index.ts +2 -0
- package/src/pages/EntityTemplateExample.tsx +229 -0
- package/src/pages/TestEntityTemplate.tsx +40 -0
- package/src/pages/index.ts +2 -1
- package/src/templates/entity/EntityManagementTemplate.tsx +430 -0
- package/src/templates/entity/EntityPerformanceDashboardTemplate.tsx +277 -0
- package/src/templates/entity/configs/financial-config.ts +141 -0
- package/src/templates/entity/configs/index.ts +1 -0
- package/src/templates/entity/index.ts +3 -0
- package/src/templates/financial/FinancialDashboardTemplate.tsx +326 -0
- package/src/templates/index.ts +3 -0
- package/dist/atoms/composed/Accordion/Accordion.d.ts +0 -20
- package/dist/atoms/composed/Accordion/Accordion.d.ts.map +0 -1
- package/dist/atoms/composed/Accordion/index.d.ts +0 -2
- package/dist/atoms/composed/Accordion/index.d.ts.map +0 -1
- package/dist/atoms/composed/Alert/Alert.d.ts +0 -25
- package/dist/atoms/composed/Alert/Alert.d.ts.map +0 -1
- package/dist/atoms/composed/Alert/index.d.ts +0 -2
- package/dist/atoms/composed/Alert/index.d.ts.map +0 -1
- package/dist/atoms/composed/Breadcrumb/Breadcrumb.d.ts +0 -17
- package/dist/atoms/composed/Breadcrumb/Breadcrumb.d.ts.map +0 -1
- package/dist/atoms/composed/Breadcrumb/index.d.ts +0 -2
- package/dist/atoms/composed/Breadcrumb/index.d.ts.map +0 -1
- package/dist/atoms/composed/Chart/Chart.d.ts +0 -37
- package/dist/atoms/composed/Chart/Chart.d.ts.map +0 -1
- package/dist/atoms/composed/Chart/index.d.ts +0 -3
- package/dist/atoms/composed/Chart/index.d.ts.map +0 -1
- package/dist/atoms/composed/ColorSwatch/ColorSwatch.d.ts +0 -19
- package/dist/atoms/composed/ColorSwatch/ColorSwatch.d.ts.map +0 -1
- package/dist/atoms/composed/ColorSwatch/index.d.ts +0 -2
- package/dist/atoms/composed/ColorSwatch/index.d.ts.map +0 -1
- package/dist/atoms/composed/DarkModeToggle.d.ts +0 -4
- package/dist/atoms/composed/DarkModeToggle.d.ts.map +0 -1
- package/dist/atoms/composed/DataBadge/DataBadge.d.ts +0 -13
- package/dist/atoms/composed/DataBadge/DataBadge.d.ts.map +0 -1
- package/dist/atoms/composed/DataBadge/index.d.ts +0 -2
- package/dist/atoms/composed/DataBadge/index.d.ts.map +0 -1
- package/dist/atoms/composed/DataTable/DataTable.d.ts +0 -28
- package/dist/atoms/composed/DataTable/DataTable.d.ts.map +0 -1
- package/dist/atoms/composed/DataTable/TableCellWithTooltip.d.ts +0 -10
- package/dist/atoms/composed/DataTable/TableCellWithTooltip.d.ts.map +0 -1
- package/dist/atoms/composed/DataTable/index.d.ts +0 -3
- package/dist/atoms/composed/DataTable/index.d.ts.map +0 -1
- package/dist/atoms/composed/DateTimePicker/DateTimePicker.d.ts +0 -45
- package/dist/atoms/composed/DateTimePicker/DateTimePicker.d.ts.map +0 -1
- package/dist/atoms/composed/DateTimePicker/index.d.ts +0 -3
- package/dist/atoms/composed/DateTimePicker/index.d.ts.map +0 -1
- package/dist/atoms/composed/DetailedCard/DetailedCard.d.ts +0 -30
- package/dist/atoms/composed/DetailedCard/DetailedCard.d.ts.map +0 -1
- package/dist/atoms/composed/DetailedCard/index.d.ts +0 -3
- package/dist/atoms/composed/DetailedCard/index.d.ts.map +0 -1
- package/dist/atoms/composed/EmptyState/EmptyState.d.ts +0 -18
- package/dist/atoms/composed/EmptyState/EmptyState.d.ts.map +0 -1
- package/dist/atoms/composed/EmptyState/index.d.ts +0 -2
- package/dist/atoms/composed/EmptyState/index.d.ts.map +0 -1
- package/dist/atoms/composed/FileUpload/FileUpload.d.ts +0 -46
- package/dist/atoms/composed/FileUpload/FileUpload.d.ts.map +0 -1
- package/dist/atoms/composed/FileUpload/index.d.ts +0 -3
- package/dist/atoms/composed/FileUpload/index.d.ts.map +0 -1
- package/dist/atoms/composed/FormField/FormField.d.ts +0 -23
- package/dist/atoms/composed/FormField/FormField.d.ts.map +0 -1
- package/dist/atoms/composed/FormField/index.d.ts +0 -2
- package/dist/atoms/composed/FormField/index.d.ts.map +0 -1
- package/dist/atoms/composed/GlobalSearch/GlobalSearch.d.ts +0 -8
- package/dist/atoms/composed/GlobalSearch/GlobalSearch.d.ts.map +0 -1
- package/dist/atoms/composed/GlobalSearch/index.d.ts +0 -2
- package/dist/atoms/composed/GlobalSearch/index.d.ts.map +0 -1
- package/dist/atoms/composed/IconBadge/IconBadge.d.ts +0 -16
- package/dist/atoms/composed/IconBadge/IconBadge.d.ts.map +0 -1
- package/dist/atoms/composed/IconBadge/index.d.ts +0 -3
- package/dist/atoms/composed/IconBadge/index.d.ts.map +0 -1
- package/dist/atoms/composed/Modal/Modal.d.ts +0 -18
- package/dist/atoms/composed/Modal/Modal.d.ts.map +0 -1
- package/dist/atoms/composed/Modal/index.d.ts +0 -3
- package/dist/atoms/composed/Modal/index.d.ts.map +0 -1
- package/dist/atoms/composed/PaletteSwitcher.d.ts +0 -7
- package/dist/atoms/composed/PaletteSwitcher.d.ts.map +0 -1
- package/dist/atoms/composed/ProgressBar/ProgressBar.d.ts +0 -25
- package/dist/atoms/composed/ProgressBar/ProgressBar.d.ts.map +0 -1
- package/dist/atoms/composed/ProgressBar/index.d.ts +0 -2
- package/dist/atoms/composed/ProgressBar/index.d.ts.map +0 -1
- package/dist/atoms/composed/StatCard/StatCard.d.ts +0 -21
- package/dist/atoms/composed/StatCard/StatCard.d.ts.map +0 -1
- package/dist/atoms/composed/StatCard/index.d.ts +0 -2
- package/dist/atoms/composed/StatCard/index.d.ts.map +0 -1
- package/dist/atoms/composed/StyleGuide.d.ts +0 -3
- package/dist/atoms/composed/StyleGuide.d.ts.map +0 -1
- package/dist/atoms/composed/Toast/Toast.d.ts +0 -40
- package/dist/atoms/composed/Toast/Toast.d.ts.map +0 -1
- package/dist/atoms/composed/Toast/index.d.ts +0 -2
- package/dist/atoms/composed/Toast/index.d.ts.map +0 -1
- package/dist/atoms/composed/Tooltip/Tooltip.d.ts +0 -16
- package/dist/atoms/composed/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/atoms/composed/Tooltip/index.d.ts +0 -2
- package/dist/atoms/composed/Tooltip/index.d.ts.map +0 -1
- package/dist/atoms/composed/UserAvatar/UserAvatar.d.ts +0 -8
- package/dist/atoms/composed/UserAvatar/UserAvatar.d.ts.map +0 -1
- package/dist/atoms/composed/UserAvatar/index.d.ts +0 -2
- package/dist/atoms/composed/UserAvatar/index.d.ts.map +0 -1
- package/dist/atoms/composed/UserMenu/UserMenu.d.ts +0 -8
- package/dist/atoms/composed/UserMenu/UserMenu.d.ts.map +0 -1
- package/dist/atoms/composed/UserMenu/index.d.ts +0 -2
- package/dist/atoms/composed/UserMenu/index.d.ts.map +0 -1
- package/dist/atoms/composed/index.d.ts +0 -25
- package/dist/atoms/composed/index.d.ts.map +0 -1
- package/dist/atoms/hooks/useApi.d.ts +0 -25
- package/dist/atoms/hooks/useApi.d.ts.map +0 -1
- package/dist/atoms/hooks/useHealth.d.ts +0 -19
- package/dist/atoms/hooks/useHealth.d.ts.map +0 -1
- package/dist/atoms/index.d.ts +0 -9
- package/dist/atoms/index.d.ts.map +0 -1
- package/dist/atoms/services/api/client.d.ts +0 -20
- package/dist/atoms/services/api/client.d.ts.map +0 -1
- package/dist/atoms/services/auth-service.d.ts +0 -24
- package/dist/atoms/services/auth-service.d.ts.map +0 -1
- package/dist/atoms/services/health.d.ts +0 -7
- package/dist/atoms/services/health.d.ts.map +0 -1
- package/dist/atoms/services/index.d.ts +0 -4
- package/dist/atoms/services/index.d.ts.map +0 -1
- package/dist/atoms/shared/config/constants.d.ts +0 -15
- package/dist/atoms/shared/config/constants.d.ts.map +0 -1
- package/dist/atoms/shared/config/dashboard-sizes.d.ts +0 -83
- package/dist/atoms/shared/config/dashboard-sizes.d.ts.map +0 -1
- package/dist/atoms/shared/config/environment.d.ts +0 -10
- package/dist/atoms/shared/config/environment.d.ts.map +0 -1
- package/dist/atoms/shared/index.d.ts +0 -4
- package/dist/atoms/shared/index.d.ts.map +0 -1
- package/dist/atoms/types/auth.d.ts +0 -56
- package/dist/atoms/types/auth.d.ts.map +0 -1
- package/dist/atoms/types/generated.d.ts +0 -1469
- package/dist/atoms/types/generated.d.ts.map +0 -1
- package/dist/atoms/types/index.d.ts +0 -4
- package/dist/atoms/types/index.d.ts.map +0 -1
- package/dist/atoms/types/loading.d.ts +0 -26
- package/dist/atoms/types/loading.d.ts.map +0 -1
- package/dist/atoms/ui/Badge.d.ts +0 -10
- package/dist/atoms/ui/Badge.d.ts.map +0 -1
- package/dist/atoms/ui/ErrorBoundary.d.ts +0 -18
- package/dist/atoms/ui/ErrorBoundary.d.ts.map +0 -1
- package/dist/atoms/ui/Select.d.ts +0 -28
- package/dist/atoms/ui/Select.d.ts.map +0 -1
- package/dist/atoms/ui/Switch.d.ts +0 -9
- package/dist/atoms/ui/Switch.d.ts.map +0 -1
- package/dist/atoms/ui/Tabs.d.ts +0 -30
- package/dist/atoms/ui/Tabs.d.ts.map +0 -1
- package/dist/atoms/ui/avatar.d.ts +0 -7
- package/dist/atoms/ui/avatar.d.ts.map +0 -1
- package/dist/atoms/ui/button.d.ts +0 -14
- package/dist/atoms/ui/button.d.ts.map +0 -1
- package/dist/atoms/ui/card.d.ts +0 -12
- package/dist/atoms/ui/card.d.ts.map +0 -1
- package/dist/atoms/ui/dropdown-menu.d.ts +0 -28
- package/dist/atoms/ui/dropdown-menu.d.ts.map +0 -1
- package/dist/atoms/ui/index.d.ts +0 -15
- package/dist/atoms/ui/index.d.ts.map +0 -1
- package/dist/atoms/ui/input.d.ts +0 -5
- package/dist/atoms/ui/input.d.ts.map +0 -1
- package/dist/atoms/ui/label.d.ts +0 -6
- package/dist/atoms/ui/label.d.ts.map +0 -1
- package/dist/atoms/ui/skeleton.d.ts +0 -3
- package/dist/atoms/ui/skeleton.d.ts.map +0 -1
- package/dist/atoms/ui/spinner.d.ts +0 -14
- package/dist/atoms/ui/spinner.d.ts.map +0 -1
- package/dist/atoms/ui/table.d.ts +0 -11
- package/dist/atoms/ui/table.d.ts.map +0 -1
- package/dist/atoms/utils/animations.d.ts +0 -65
- package/dist/atoms/utils/animations.d.ts.map +0 -1
- package/dist/atoms/utils/tooltip-helpers.d.ts +0 -71
- package/dist/atoms/utils/tooltip-helpers.d.ts.map +0 -1
- package/dist/atoms/utils/utils.d.ts +0 -4
- package/dist/atoms/utils/utils.d.ts.map +0 -1
- package/dist/features/auth/components/LoginForm.d.ts +0 -2
- package/dist/features/auth/components/LoginForm.d.ts.map +0 -1
- package/dist/features/auth/components/LogoutButton.d.ts +0 -2
- package/dist/features/auth/components/LogoutButton.d.ts.map +0 -1
- package/dist/features/auth/components/ProtectedRoute.d.ts +0 -10
- package/dist/features/auth/components/ProtectedRoute.d.ts.map +0 -1
- package/dist/features/auth/components/index.d.ts +0 -4
- package/dist/features/auth/components/index.d.ts.map +0 -1
- package/dist/features/auth/hooks/index.d.ts +0 -3
- package/dist/features/auth/hooks/index.d.ts.map +0 -1
- package/dist/features/auth/hooks/useAuth.d.ts +0 -10
- package/dist/features/auth/hooks/useAuth.d.ts.map +0 -1
- package/dist/features/auth/hooks/usePermissions.d.ts +0 -13
- package/dist/features/auth/hooks/usePermissions.d.ts.map +0 -1
- package/dist/features/auth/index.d.ts +0 -3
- package/dist/features/auth/index.d.ts.map +0 -1
- package/dist/features/index.d.ts +0 -2
- package/dist/features/index.d.ts.map +0 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +0 -1
- package/dist/molecules/forms/FormGroup.d.ts +0 -17
- package/dist/molecules/forms/FormGroup.d.ts.map +0 -1
- package/dist/molecules/forms/SearchInput.d.ts +0 -36
- package/dist/molecules/forms/SearchInput.d.ts.map +0 -1
- package/dist/molecules/forms/index.d.ts +0 -3
- package/dist/molecules/forms/index.d.ts.map +0 -1
- package/dist/molecules/index.d.ts +0 -4
- package/dist/molecules/index.d.ts.map +0 -1
- package/dist/molecules/layout/AppHeader/AppHeader.d.ts +0 -7
- package/dist/molecules/layout/AppHeader/AppHeader.d.ts.map +0 -1
- package/dist/molecules/layout/AppHeader/index.d.ts +0 -2
- package/dist/molecules/layout/AppHeader/index.d.ts.map +0 -1
- package/dist/molecules/layout/AppLayout.d.ts +0 -2
- package/dist/molecules/layout/AppLayout.d.ts.map +0 -1
- package/dist/molecules/layout/PageTemplate.d.ts +0 -19
- package/dist/molecules/layout/PageTemplate.d.ts.map +0 -1
- package/dist/molecules/layout/SectionHeader/SectionHeader.d.ts +0 -24
- package/dist/molecules/layout/SectionHeader/SectionHeader.d.ts.map +0 -1
- package/dist/molecules/layout/SectionHeader/index.d.ts +0 -2
- package/dist/molecules/layout/SectionHeader/index.d.ts.map +0 -1
- package/dist/molecules/layout/ShowcaseSection.d.ts +0 -22
- package/dist/molecules/layout/ShowcaseSection.d.ts.map +0 -1
- package/dist/molecules/layout/Sidebar.d.ts +0 -6
- package/dist/molecules/layout/Sidebar.d.ts.map +0 -1
- package/dist/molecules/layout/SidebarButton/SidebarButton.d.ts +0 -13
- package/dist/molecules/layout/SidebarButton/SidebarButton.d.ts.map +0 -1
- package/dist/molecules/layout/SidebarButton/index.d.ts +0 -2
- package/dist/molecules/layout/SidebarButton/index.d.ts.map +0 -1
- package/dist/molecules/layout/SidebarContext.d.ts +0 -12
- package/dist/molecules/layout/SidebarContext.d.ts.map +0 -1
- package/dist/molecules/layout/index.d.ts +0 -8
- package/dist/molecules/layout/index.d.ts.map +0 -1
- package/dist/molecules/navigation/NavMenu.d.ts +0 -20
- package/dist/molecules/navigation/NavMenu.d.ts.map +0 -1
- package/dist/molecules/navigation/Pagination.d.ts +0 -14
- package/dist/molecules/navigation/Pagination.d.ts.map +0 -1
- package/dist/molecules/navigation/index.d.ts +0 -3
- package/dist/molecules/navigation/index.d.ts.map +0 -1
- package/dist/organisms/index.d.ts +0 -2
- package/dist/organisms/index.d.ts.map +0 -1
- package/dist/organisms/showcase/ComponentShowcasePage.d.ts +0 -3
- package/dist/organisms/showcase/ComponentShowcasePage.d.ts.map +0 -1
- package/dist/templates/AuthTemplate.d.ts +0 -68
- package/dist/templates/AuthTemplate.d.ts.map +0 -1
- package/dist/templates/ComponentShowcaseTemplate.d.ts +0 -53
- package/dist/templates/ComponentShowcaseTemplate.d.ts.map +0 -1
- package/dist/templates/DashboardTemplate.d.ts +0 -62
- package/dist/templates/DashboardTemplate.d.ts.map +0 -1
- package/dist/templates/DataTemplate.d.ts +0 -78
- package/dist/templates/DataTemplate.d.ts.map +0 -1
- package/dist/templates/admin/AdminCRUDTemplate.d.ts +0 -105
- package/dist/templates/admin/AdminCRUDTemplate.d.ts.map +0 -1
- package/dist/templates/admin/AdminDashboardTemplate.d.ts +0 -89
- package/dist/templates/admin/AdminDashboardTemplate.d.ts.map +0 -1
- package/dist/templates/admin/AdminDetailTemplate.d.ts +0 -132
- package/dist/templates/admin/AdminDetailTemplate.d.ts.map +0 -1
- package/dist/templates/admin/index.d.ts +0 -4
- package/dist/templates/admin/index.d.ts.map +0 -1
- package/dist/templates/factory.d.ts +0 -28
- package/dist/templates/factory.d.ts.map +0 -1
- package/dist/templates/index.d.ts +0 -7
- package/dist/templates/index.d.ts.map +0 -1
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.0.
|
|
5
|
+
"version": "0.0.5",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
8
8
|
"typescript",
|
|
@@ -44,7 +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
|
|
47
|
+
"build:lib": "npm run clean && vite build --mode library",
|
|
48
48
|
"clean": "rm -rf dist",
|
|
49
49
|
"lint": "eslint .",
|
|
50
50
|
"lint:fix": "eslint . --fix",
|
|
@@ -102,9 +102,12 @@
|
|
|
102
102
|
"@vitejs/plugin-react": "^4.4.1",
|
|
103
103
|
"@vitest/coverage-v8": "^3.2.1",
|
|
104
104
|
"autoprefixer": "^10.4.21",
|
|
105
|
+
"concurrently": "^9.1.2",
|
|
106
|
+
"cors": "^2.8.5",
|
|
105
107
|
"eslint": "^9.25.0",
|
|
106
108
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
107
109
|
"eslint-plugin-react-refresh": "^0.4.19",
|
|
110
|
+
"express": "^5.1.0",
|
|
108
111
|
"globals": "^16.0.0",
|
|
109
112
|
"jsdom": "^26.1.0",
|
|
110
113
|
"postcss": "^8.5.3",
|
|
@@ -115,4 +118,4 @@
|
|
|
115
118
|
"vite": "^6.3.5",
|
|
116
119
|
"vitest": "^3.2.1"
|
|
117
120
|
}
|
|
118
|
-
}
|
|
121
|
+
}
|
package/src/App.tsx
CHANGED
|
@@ -15,8 +15,12 @@ import {
|
|
|
15
15
|
ComponentShowcase,
|
|
16
16
|
AdminDashboardShowcase,
|
|
17
17
|
AdminCRUDShowcase,
|
|
18
|
-
AdminDetailShowcase
|
|
18
|
+
AdminDetailShowcase,
|
|
19
|
+
SalesPerformanceDashboard,
|
|
20
|
+
EntityPerformanceShowcase,
|
|
21
|
+
EntityManagementShowcase
|
|
19
22
|
} from './pages';
|
|
23
|
+
import { EntityTemplateExample } from './pages/EntityTemplateExample';
|
|
20
24
|
|
|
21
25
|
function App() {
|
|
22
26
|
return (
|
|
@@ -41,6 +45,12 @@ function App() {
|
|
|
41
45
|
<Route path="admin/dashboard" element={<ErrorBoundary><AdminDashboardShowcase /></ErrorBoundary>} />
|
|
42
46
|
<Route path="admin/users" element={<ErrorBoundary><AdminCRUDShowcase /></ErrorBoundary>} />
|
|
43
47
|
<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>} />
|
|
44
54
|
|
|
45
55
|
{/* Fallback */}
|
|
46
56
|
<Route path="*" element={<ErrorBoundary><ComponentShowcasePage /></ErrorBoundary>} />
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DataBadge } from '../DataBadge';
|
|
3
|
+
import { Button } from '../../ui/button';
|
|
4
|
+
import {
|
|
5
|
+
Target,
|
|
6
|
+
ExternalLink
|
|
7
|
+
} from 'lucide-react';
|
|
8
|
+
|
|
9
|
+
interface SalesPanelProps {
|
|
10
|
+
sales: Array<{
|
|
11
|
+
id: string;
|
|
12
|
+
customer: string;
|
|
13
|
+
product: string;
|
|
14
|
+
amount: number;
|
|
15
|
+
stage: string;
|
|
16
|
+
salesperson: string;
|
|
17
|
+
region: string;
|
|
18
|
+
closeDate: string;
|
|
19
|
+
dealSize: string;
|
|
20
|
+
}>;
|
|
21
|
+
onSaleClick?: (sale: any) => void;
|
|
22
|
+
onClose?: () => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const getStageStatus = (stage: string) => {
|
|
26
|
+
switch (stage) {
|
|
27
|
+
case 'Closed Won': return 'success';
|
|
28
|
+
case 'Negotiation': return 'warning';
|
|
29
|
+
case 'Proposal Sent': return 'info';
|
|
30
|
+
case 'Qualified': return 'info';
|
|
31
|
+
case 'Discovery': return 'neutral';
|
|
32
|
+
default: return 'neutral';
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const SalesPanel: React.FC<SalesPanelProps> = ({
|
|
37
|
+
sales,
|
|
38
|
+
onSaleClick,
|
|
39
|
+
onClose
|
|
40
|
+
}) => {
|
|
41
|
+
const topDeals = sales.slice(0, 5); // Show only top 5 recent deals
|
|
42
|
+
const totalValue = sales.reduce((sum, sale) => sum + sale.amount, 0);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className="fixed right-0 top-16 h-[calc(100vh-4rem)] w-72 bg-background border-l border-border shadow-lg flex flex-col z-30">
|
|
46
|
+
{/* Header */}
|
|
47
|
+
<div className="p-3 border-b border-border">
|
|
48
|
+
<div className="flex items-center justify-between">
|
|
49
|
+
<h3 className="font-medium flex items-center gap-2">
|
|
50
|
+
<Target className="w-4 h-4" />
|
|
51
|
+
Pipeline
|
|
52
|
+
</h3>
|
|
53
|
+
{onClose && (
|
|
54
|
+
<Button variant="ghost" size="sm" onClick={onClose}>
|
|
55
|
+
×
|
|
56
|
+
</Button>
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
{/* Quick Stats */}
|
|
62
|
+
<div className="p-3 border-b border-border">
|
|
63
|
+
<div className="space-y-2">
|
|
64
|
+
<div className="flex justify-between">
|
|
65
|
+
<span className="text-sm text-muted-foreground">Total Value</span>
|
|
66
|
+
<span className="font-semibold text-green-600">${totalValue.toLocaleString()}</span>
|
|
67
|
+
</div>
|
|
68
|
+
<div className="flex justify-between">
|
|
69
|
+
<span className="text-sm text-muted-foreground">Active Deals</span>
|
|
70
|
+
<span className="font-semibold">{sales.length}</span>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
{/* Recent Deals */}
|
|
76
|
+
<div className="flex-1 overflow-auto p-3">
|
|
77
|
+
<h4 className="text-sm font-medium mb-3">Recent Opportunities</h4>
|
|
78
|
+
<div className="space-y-2">
|
|
79
|
+
{topDeals.map((sale) => (
|
|
80
|
+
<div
|
|
81
|
+
key={sale.id}
|
|
82
|
+
className="p-2 border border-border rounded-md hover:bg-muted/50 cursor-pointer transition-colors"
|
|
83
|
+
onClick={() => onSaleClick?.(sale)}
|
|
84
|
+
>
|
|
85
|
+
<div className="flex justify-between items-start mb-1">
|
|
86
|
+
<div className="flex-1 min-w-0">
|
|
87
|
+
<p className="text-sm font-medium truncate">{sale.customer}</p>
|
|
88
|
+
<p className="text-xs text-muted-foreground truncate">{sale.product}</p>
|
|
89
|
+
</div>
|
|
90
|
+
<div className="text-right ml-2">
|
|
91
|
+
<p className="text-sm font-semibold text-green-600">
|
|
92
|
+
${sale.amount.toLocaleString()}
|
|
93
|
+
</p>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<div className="flex justify-between items-center">
|
|
97
|
+
<DataBadge variant="status" status={getStageStatus(sale.stage)}>
|
|
98
|
+
{sale.stage}
|
|
99
|
+
</DataBadge>
|
|
100
|
+
<span className="text-xs text-muted-foreground">{sale.salesperson}</span>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
))}
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
{/* Footer */}
|
|
108
|
+
<div className="p-3 border-t border-border">
|
|
109
|
+
<Button variant="outline" size="sm" className="w-full">
|
|
110
|
+
<ExternalLink className="w-4 h-4 mr-2" />
|
|
111
|
+
View All Deals
|
|
112
|
+
</Button>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SalesPanel } from './SalesPanel';
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// Mock sales data for demonstrations
|
|
2
|
+
export const mockSalesData = [
|
|
3
|
+
{
|
|
4
|
+
id: 'SALE-2024-001',
|
|
5
|
+
customer: 'TechCorp Industries',
|
|
6
|
+
product: 'Enterprise License',
|
|
7
|
+
amount: 45000,
|
|
8
|
+
stage: 'Closed Won',
|
|
9
|
+
salesperson: 'Sarah Chen',
|
|
10
|
+
region: 'North America',
|
|
11
|
+
closeDate: '2024-06-08',
|
|
12
|
+
dealSize: 'Large'
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'SALE-2024-002',
|
|
16
|
+
customer: 'StartupXYZ',
|
|
17
|
+
product: 'Professional Plan',
|
|
18
|
+
amount: 12000,
|
|
19
|
+
stage: 'Proposal Sent',
|
|
20
|
+
salesperson: 'Mike Johnson',
|
|
21
|
+
region: 'North America',
|
|
22
|
+
closeDate: '2024-06-15',
|
|
23
|
+
dealSize: 'Medium'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'SALE-2024-003',
|
|
27
|
+
customer: 'Global Enterprises Ltd',
|
|
28
|
+
product: 'Enterprise Suite',
|
|
29
|
+
amount: 78000,
|
|
30
|
+
stage: 'Negotiation',
|
|
31
|
+
salesperson: 'Lisa Wang',
|
|
32
|
+
region: 'Europe',
|
|
33
|
+
closeDate: '2024-06-20',
|
|
34
|
+
dealSize: 'Large'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'SALE-2024-004',
|
|
38
|
+
customer: 'Innovation Labs',
|
|
39
|
+
product: 'Starter Package',
|
|
40
|
+
amount: 5000,
|
|
41
|
+
stage: 'Qualified',
|
|
42
|
+
salesperson: 'David Kim',
|
|
43
|
+
region: 'Asia Pacific',
|
|
44
|
+
closeDate: '2024-06-25',
|
|
45
|
+
dealSize: 'Small'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'SALE-2024-005',
|
|
49
|
+
customer: 'FutureTech Solutions',
|
|
50
|
+
product: 'Custom Integration',
|
|
51
|
+
amount: 95000,
|
|
52
|
+
stage: 'Discovery',
|
|
53
|
+
salesperson: 'Sarah Chen',
|
|
54
|
+
region: 'North America',
|
|
55
|
+
closeDate: '2024-07-01',
|
|
56
|
+
dealSize: 'Large'
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
// Sales configuration for entity template
|
|
61
|
+
export const salesConfig = {
|
|
62
|
+
entityType: 'performance' as const,
|
|
63
|
+
display: {
|
|
64
|
+
title: 'Sales Performance',
|
|
65
|
+
subtitle: 'Monitor sales metrics, team performance, and revenue trends',
|
|
66
|
+
category: 3 as const
|
|
67
|
+
},
|
|
68
|
+
metrics: [
|
|
69
|
+
{
|
|
70
|
+
key: 'revenue',
|
|
71
|
+
label: 'Total Revenue',
|
|
72
|
+
type: 'currency' as const,
|
|
73
|
+
aggregate: 'sum',
|
|
74
|
+
showTrend: true,
|
|
75
|
+
category: 2
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: 'deals',
|
|
79
|
+
label: 'Deals Closed',
|
|
80
|
+
type: 'number' as const,
|
|
81
|
+
aggregate: 'count',
|
|
82
|
+
showTrend: true,
|
|
83
|
+
category: 3
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
key: 'conversion',
|
|
87
|
+
label: 'Conversion Rate',
|
|
88
|
+
type: 'percentage' as const,
|
|
89
|
+
aggregate: 'average',
|
|
90
|
+
showTrend: true,
|
|
91
|
+
category: 1
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: 'pipeline',
|
|
95
|
+
label: 'Pipeline Value',
|
|
96
|
+
type: 'currency' as const,
|
|
97
|
+
aggregate: 'sum',
|
|
98
|
+
showTrend: true,
|
|
99
|
+
category: 4
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
categories: [
|
|
103
|
+
{ key: 'region', label: 'By Region', type: 'categorical' },
|
|
104
|
+
{ key: 'product', label: 'By Product', type: 'categorical' },
|
|
105
|
+
{ key: 'stage', label: 'By Stage', type: 'categorical' }
|
|
106
|
+
],
|
|
107
|
+
trends: {
|
|
108
|
+
periods: ['7d', '30d', '90d', '1y'],
|
|
109
|
+
defaultPeriod: '30d'
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Sample sales performance data
|
|
114
|
+
export const salesPerformanceData = [
|
|
115
|
+
{
|
|
116
|
+
id: 'sale-1',
|
|
117
|
+
revenue: 45000,
|
|
118
|
+
deals: 12,
|
|
119
|
+
conversion: 0.24,
|
|
120
|
+
pipeline: 125000,
|
|
121
|
+
region: 'North America',
|
|
122
|
+
product: 'Enterprise',
|
|
123
|
+
stage: 'Closed Won',
|
|
124
|
+
date: '2024-06-01',
|
|
125
|
+
salesperson: 'Sarah Chen'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: 'sale-2',
|
|
129
|
+
revenue: 32000,
|
|
130
|
+
deals: 8,
|
|
131
|
+
conversion: 0.18,
|
|
132
|
+
pipeline: 89000,
|
|
133
|
+
region: 'Europe',
|
|
134
|
+
product: 'Professional',
|
|
135
|
+
stage: 'Negotiation',
|
|
136
|
+
date: '2024-06-02',
|
|
137
|
+
salesperson: 'Mike Johnson'
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: 'sale-3',
|
|
141
|
+
revenue: 67000,
|
|
142
|
+
deals: 15,
|
|
143
|
+
conversion: 0.31,
|
|
144
|
+
pipeline: 156000,
|
|
145
|
+
region: 'Asia Pacific',
|
|
146
|
+
product: 'Enterprise',
|
|
147
|
+
stage: 'Closed Won',
|
|
148
|
+
date: '2024-06-03',
|
|
149
|
+
salesperson: 'Lisa Wang'
|
|
150
|
+
}
|
|
151
|
+
];
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export type EntityType = 'transactional' | 'categorical' | 'temporal';
|
|
4
|
+
|
|
5
|
+
export type MetricType = 'currency' | 'percentage' | 'count' | 'duration' | 'ratio';
|
|
6
|
+
|
|
7
|
+
export type AggregationType = 'sum' | 'avg' | 'count' | 'min' | 'max';
|
|
8
|
+
|
|
9
|
+
export type TemporalCycle = 'daily' | 'weekly' | 'monthly' | 'quarterly' | 'yearly';
|
|
10
|
+
|
|
11
|
+
export type ForecastingAlgorithm = 'linear' | 'seasonal' | 'ml';
|
|
12
|
+
|
|
13
|
+
export type ActionType = 'primary' | 'secondary' | 'danger';
|
|
14
|
+
|
|
15
|
+
export interface FormatConfig {
|
|
16
|
+
decimals?: number;
|
|
17
|
+
prefix?: string;
|
|
18
|
+
suffix?: string;
|
|
19
|
+
thousands?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface MetricConfig {
|
|
23
|
+
key: string;
|
|
24
|
+
label: string;
|
|
25
|
+
type: MetricType;
|
|
26
|
+
format?: FormatConfig;
|
|
27
|
+
trend?: boolean;
|
|
28
|
+
target?: number | ((data: EntityData[]) => number);
|
|
29
|
+
aggregation?: AggregationType;
|
|
30
|
+
icon?: React.ComponentType;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface TemporalConfig {
|
|
34
|
+
cycles: TemporalCycle[];
|
|
35
|
+
defaultCycle: TemporalCycle;
|
|
36
|
+
enableComparisons: boolean;
|
|
37
|
+
forecasting?: {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
periods: number;
|
|
40
|
+
algorithm: ForecastingAlgorithm;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface CategoryConfig {
|
|
45
|
+
hierarchy: string[];
|
|
46
|
+
defaultGroupBy: string;
|
|
47
|
+
enableDrillDown: boolean;
|
|
48
|
+
colorCoding?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ActionConfig {
|
|
52
|
+
label: string;
|
|
53
|
+
type: ActionType;
|
|
54
|
+
onClick: (context: { selectedItems?: EntityData[]; data?: EntityData[]; config?: EntityTemplateConfig }) => void | Promise<void>;
|
|
55
|
+
icon?: React.ComponentType;
|
|
56
|
+
permissions?: string[];
|
|
57
|
+
validation?: (context: { selectedItems?: EntityData[]; data?: EntityData[]; config?: EntityTemplateConfig }) => boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface BusinessRulesConfig<T> {
|
|
61
|
+
validation?: (item: T) => string[];
|
|
62
|
+
constraints?: {
|
|
63
|
+
[key: string]: {
|
|
64
|
+
min?: number;
|
|
65
|
+
max?: number;
|
|
66
|
+
required?: boolean;
|
|
67
|
+
pattern?: RegExp;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
workflows?: {
|
|
71
|
+
[status: string]: string[];
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface EntityDisplayConfig {
|
|
76
|
+
title: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
category?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface EntityTemplateConfig<T = EntityData> {
|
|
82
|
+
entityType: EntityType;
|
|
83
|
+
display: EntityDisplayConfig;
|
|
84
|
+
metrics: MetricConfig[];
|
|
85
|
+
temporal?: TemporalConfig;
|
|
86
|
+
categories?: CategoryConfig;
|
|
87
|
+
businessRules?: BusinessRulesConfig<T>;
|
|
88
|
+
actions?: ActionConfig[];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface EntityData {
|
|
92
|
+
id: string | number;
|
|
93
|
+
[key: string]: unknown;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface MetricValue {
|
|
97
|
+
current: number;
|
|
98
|
+
previous?: number;
|
|
99
|
+
trend?: 'up' | 'down' | 'neutral';
|
|
100
|
+
target?: number;
|
|
101
|
+
formattedValue: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface CategoryBreakdown {
|
|
105
|
+
category: string;
|
|
106
|
+
value: number;
|
|
107
|
+
percentage: number;
|
|
108
|
+
color?: string;
|
|
109
|
+
subcategories?: CategoryBreakdown[];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface TrendDataPoint {
|
|
113
|
+
date: string;
|
|
114
|
+
value: number;
|
|
115
|
+
label?: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface EntityAnalyticsData {
|
|
119
|
+
metrics: Record<string, MetricValue>;
|
|
120
|
+
categories: CategoryBreakdown[];
|
|
121
|
+
trends: Record<string, TrendDataPoint[]>;
|
|
122
|
+
insights?: {
|
|
123
|
+
type: 'positive' | 'negative' | 'neutral';
|
|
124
|
+
message: string;
|
|
125
|
+
value?: number;
|
|
126
|
+
}[];
|
|
127
|
+
}
|
package/src/atoms/types/index.ts
CHANGED