@pattern-stack/frontend-patterns 0.0.3 → 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 +1918 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1917 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -5
- package/src/App.css +42 -0
- package/src/App.tsx +64 -0
- package/src/__tests__/README.md +221 -0
- package/src/__tests__/atoms/hooks/simple-hooks.test.ts +44 -0
- package/src/__tests__/atoms/ui/button.test.tsx +68 -0
- package/src/__tests__/atoms/utils/simple.test.ts +18 -0
- package/src/__tests__/atoms/utils/utils.test.ts +77 -0
- package/src/__tests__/features/auth/simple-auth.test.tsx +40 -0
- package/src/__tests__/molecules/layout/simple-layout.test.tsx +81 -0
- package/src/__tests__/organisms/showcase/simple-showcase.test.tsx +167 -0
- package/src/__tests__/setup.ts +51 -0
- package/src/__tests__/utils.tsx +123 -0
- package/src/atoms/composed/Accordion/Accordion.tsx +271 -0
- package/{dist/atoms/composed/Accordion/index.d.ts → src/atoms/composed/Accordion/index.ts} +1 -2
- package/src/atoms/composed/Alert/Alert.tsx +132 -0
- package/src/atoms/composed/Alert/index.ts +1 -0
- package/src/atoms/composed/Breadcrumb/Breadcrumb.tsx +83 -0
- package/src/atoms/composed/Breadcrumb/index.ts +1 -0
- package/src/atoms/composed/Chart/Chart.tsx +425 -0
- package/{dist/atoms/composed/Chart/index.d.ts → src/atoms/composed/Chart/index.ts} +1 -2
- package/src/atoms/composed/ColorSwatch/ColorSwatch.tsx +72 -0
- package/{dist/atoms/composed/ColorSwatch/index.d.ts → src/atoms/composed/ColorSwatch/index.ts} +1 -2
- package/src/atoms/composed/DarkModeToggle.tsx +66 -0
- package/src/atoms/composed/DataBadge/DataBadge.tsx +81 -0
- package/src/atoms/composed/DataBadge/index.ts +1 -0
- package/src/atoms/composed/DataTable/DataTable.tsx +394 -0
- package/src/atoms/composed/DataTable/TableCellWithTooltip.tsx +41 -0
- package/src/atoms/composed/DataTable/index.ts +2 -0
- package/src/atoms/composed/DateTimePicker/DateTimePicker.tsx +611 -0
- package/src/atoms/composed/DateTimePicker/index.ts +2 -0
- package/src/atoms/composed/DetailedCard/DetailedCard.tsx +181 -0
- package/src/atoms/composed/DetailedCard/index.ts +2 -0
- package/src/atoms/composed/EmptyState/EmptyState.tsx +90 -0
- package/src/atoms/composed/EmptyState/index.ts +1 -0
- package/src/atoms/composed/FileUpload/FileUpload.tsx +477 -0
- package/{dist/atoms/composed/FileUpload/index.d.ts → src/atoms/composed/FileUpload/index.ts} +1 -2
- package/src/atoms/composed/FormField/FormField.tsx +92 -0
- package/src/atoms/composed/FormField/index.ts +1 -0
- package/src/atoms/composed/GlobalSearch/GlobalSearch.tsx +37 -0
- package/src/atoms/composed/GlobalSearch/index.ts +1 -0
- package/src/atoms/composed/IconBadge/IconBadge.tsx +95 -0
- package/src/atoms/composed/IconBadge/index.ts +2 -0
- package/src/atoms/composed/Modal/Modal.tsx +223 -0
- package/src/atoms/composed/Modal/index.ts +2 -0
- package/src/atoms/composed/PaletteSwitcher.tsx +386 -0
- package/src/atoms/composed/ProgressBar/ProgressBar.tsx +116 -0
- package/{dist/atoms/composed/ProgressBar/index.d.ts → src/atoms/composed/ProgressBar/index.ts} +1 -2
- 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/StatCard/StatCard.tsx +219 -0
- package/src/atoms/composed/StatCard/index.ts +1 -0
- package/src/atoms/composed/StyleGuide.tsx +717 -0
- package/src/atoms/composed/Toast/Toast.tsx +219 -0
- package/{dist/atoms/composed/Toast/index.d.ts → src/atoms/composed/Toast/index.ts} +1 -2
- package/src/atoms/composed/Tooltip/Tooltip.tsx +213 -0
- package/src/atoms/composed/Tooltip/index.ts +1 -0
- package/src/atoms/composed/UserAvatar/UserAvatar.tsx +139 -0
- package/src/atoms/composed/UserAvatar/index.ts +1 -0
- package/src/atoms/composed/UserMenu/UserMenu.tsx +16 -0
- package/src/atoms/composed/UserMenu/index.ts +1 -0
- package/{dist/atoms/composed/index.d.ts → src/atoms/composed/index.ts} +7 -2
- package/src/atoms/hooks/useApi.ts +80 -0
- package/src/atoms/hooks/useHealth.ts +17 -0
- package/{dist/atoms/index.d.ts → src/atoms/index.ts} +6 -2
- package/src/atoms/services/api/client.ts +134 -0
- package/src/atoms/services/auth-service.ts +248 -0
- package/src/atoms/services/health.ts +15 -0
- package/{dist/atoms/services/index.d.ts → src/atoms/services/index.ts} +1 -2
- package/src/atoms/shared/config/constants.ts +17 -0
- package/src/atoms/shared/config/dashboard-sizes.ts +111 -0
- package/src/atoms/shared/config/environment.ts +10 -0
- package/src/atoms/shared/index.ts +4 -0
- package/src/atoms/shared/styles/color-palettes.css +566 -0
- package/src/atoms/types/auth.ts +62 -0
- package/src/atoms/types/entity-config.ts +127 -0
- package/{dist/atoms/types/generated.d.ts → src/atoms/types/generated.ts} +1 -1
- package/{dist/atoms/types/index.d.ts → src/atoms/types/index.ts} +2 -1
- package/{dist/atoms/types/loading.d.ts → src/atoms/types/loading.ts} +10 -8
- package/src/atoms/ui/Badge.tsx +30 -0
- package/src/atoms/ui/ErrorBoundary.tsx +59 -0
- package/src/atoms/ui/Select.tsx +53 -0
- package/src/atoms/ui/Switch.tsx +42 -0
- package/src/atoms/ui/Tabs.tsx +118 -0
- package/src/atoms/ui/avatar.tsx +48 -0
- package/src/atoms/ui/button.tsx +70 -0
- package/src/atoms/ui/card.tsx +76 -0
- package/src/atoms/ui/dropdown-menu.tsx +199 -0
- package/{dist/atoms/ui/index.d.ts → src/atoms/ui/index.ts} +27 -3
- package/src/atoms/ui/input.tsx +23 -0
- package/src/atoms/ui/label.tsx +23 -0
- package/src/atoms/ui/skeleton.tsx +13 -0
- package/src/atoms/ui/spinner.tsx +49 -0
- package/src/atoms/ui/table.tsx +116 -0
- package/src/atoms/utils/animations.ts +135 -0
- package/src/atoms/utils/metric-engine.ts +236 -0
- package/src/atoms/utils/tooltip-helpers.ts +140 -0
- package/src/atoms/utils/utils.ts +10 -0
- package/src/features/auth/components/LoginForm.tsx +168 -0
- package/src/features/auth/components/LogoutButton.tsx +19 -0
- package/src/features/auth/components/ProtectedRoute.tsx +60 -0
- package/{dist/features/auth/components/index.d.ts → src/features/auth/components/index.ts} +1 -1
- package/src/features/auth/hooks/index.ts +2 -0
- package/src/features/auth/hooks/useAuth.tsx +205 -0
- package/src/features/auth/hooks/usePermissions.ts +35 -0
- package/src/features/auth/index.ts +2 -0
- package/src/features/index.ts +2 -0
- package/src/index.css +704 -0
- package/{dist/index.d.ts → src/index.ts} +5 -2
- package/src/main.tsx +48 -0
- package/src/molecules/.gitkeep +0 -0
- package/src/molecules/forms/FormGroup.tsx +75 -0
- package/src/molecules/forms/SearchInput.tsx +259 -0
- package/src/molecules/forms/index.ts +4 -0
- package/src/molecules/index.ts +4 -0
- package/src/molecules/layout/AppHeader/AppHeader.tsx +42 -0
- package/src/molecules/layout/AppHeader/index.ts +1 -0
- package/src/molecules/layout/AppLayout.tsx +29 -0
- package/src/molecules/layout/DashboardWithSidePanel/DashboardWithSidePanel.tsx +42 -0
- package/src/molecules/layout/DashboardWithSidePanel/index.ts +1 -0
- package/src/molecules/layout/PageTemplate.tsx +87 -0
- package/src/molecules/layout/SectionHeader/SectionHeader.tsx +87 -0
- package/{dist/molecules/layout/SectionHeader/index.d.ts → src/molecules/layout/SectionHeader/index.ts} +1 -2
- package/src/molecules/layout/ShowcaseSection.tsx +57 -0
- package/src/molecules/layout/Sidebar.tsx +152 -0
- package/src/molecules/layout/SidebarButton/SidebarButton.tsx +99 -0
- package/src/molecules/layout/SidebarButton/index.ts +1 -0
- package/src/molecules/layout/SidebarContext.tsx +31 -0
- package/{dist/molecules/layout/index.d.ts → src/molecules/layout/index.ts} +2 -2
- package/src/molecules/navigation/NavMenu.tsx +188 -0
- package/src/molecules/navigation/Pagination.tsx +172 -0
- package/src/molecules/navigation/index.ts +4 -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 +8 -0
- package/src/organisms/showcase/ComponentShowcasePage.tsx +2496 -0
- package/src/organisms/showcase/index.ts +1 -0
- package/src/pages/AdminShowcase/AdminCRUDShowcase.tsx +242 -0
- package/src/pages/AdminShowcase/AdminDashboardShowcase.tsx +173 -0
- package/src/pages/AdminShowcase/AdminDetailShowcase.tsx +385 -0
- package/src/pages/AdminShowcase/SalesPerformanceDashboard.tsx +158 -0
- package/src/pages/AdminShowcase/index.tsx +4 -0
- package/src/pages/ComponentShowcase/BadgesShowcase.tsx +188 -0
- package/src/pages/ComponentShowcase/CardsShowcase.tsx +392 -0
- package/src/pages/ComponentShowcase/PalettesShowcase.tsx +207 -0
- package/src/pages/ComponentShowcase/StatesShowcase.tsx +485 -0
- package/src/pages/ComponentShowcase/TablesShowcase.tsx +134 -0
- package/src/pages/ComponentShowcase/TypographyShowcase.tsx +255 -0
- package/src/pages/ComponentShowcase/index.tsx +188 -0
- 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 +3 -0
- package/src/templates/AuthTemplate.tsx +216 -0
- package/src/templates/ComponentShowcaseTemplate.tsx +173 -0
- package/src/templates/DashboardTemplate.tsx +232 -0
- package/src/templates/DataTemplate.tsx +319 -0
- package/src/templates/admin/AdminCRUDTemplate.tsx +630 -0
- package/src/templates/admin/AdminDashboardTemplate.tsx +351 -0
- package/src/templates/admin/AdminDetailTemplate.tsx +563 -0
- package/src/templates/admin/index.ts +29 -0
- 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/factory.tsx +169 -0
- package/src/templates/financial/FinancialDashboardTemplate.tsx +326 -0
- package/src/templates/index.ts +40 -0
- package/src/vite-env.d.ts +1 -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.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.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.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.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.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.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.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.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.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.map +0 -1
- package/dist/atoms/types/index.d.ts.map +0 -1
- 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.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.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.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.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.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
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { EntityTemplateConfig, EntityData } from '../../../atoms/types';
|
|
2
|
+
import { DollarSign, Target, TrendingUp, Wallet } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
export interface FinancialTransaction extends EntityData {
|
|
5
|
+
id: string;
|
|
6
|
+
amount: number;
|
|
7
|
+
category: string;
|
|
8
|
+
account: string;
|
|
9
|
+
date: string;
|
|
10
|
+
description: string;
|
|
11
|
+
type: 'income' | 'expense' | 'transfer';
|
|
12
|
+
status: 'completed' | 'pending' | 'failed';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const financialConfig: EntityTemplateConfig<FinancialTransaction> = {
|
|
16
|
+
entityType: 'transactional',
|
|
17
|
+
display: {
|
|
18
|
+
title: 'Financial Dashboard',
|
|
19
|
+
description: 'Personal finance overview and transaction management',
|
|
20
|
+
category: 2 // Green theme for financial success
|
|
21
|
+
},
|
|
22
|
+
metrics: [
|
|
23
|
+
{
|
|
24
|
+
key: 'totalBalance',
|
|
25
|
+
label: 'Total Balance',
|
|
26
|
+
type: 'currency',
|
|
27
|
+
trend: true,
|
|
28
|
+
icon: DollarSign,
|
|
29
|
+
aggregation: 'sum'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: 'monthlyIncome',
|
|
33
|
+
label: 'Monthly Income',
|
|
34
|
+
type: 'currency',
|
|
35
|
+
trend: true,
|
|
36
|
+
icon: TrendingUp,
|
|
37
|
+
aggregation: 'sum'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key: 'monthlyExpenses',
|
|
41
|
+
label: 'Monthly Expenses',
|
|
42
|
+
type: 'currency',
|
|
43
|
+
trend: true,
|
|
44
|
+
icon: Wallet,
|
|
45
|
+
aggregation: 'sum'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
key: 'savingsRate',
|
|
49
|
+
label: 'Savings Rate',
|
|
50
|
+
type: 'percentage',
|
|
51
|
+
target: 20,
|
|
52
|
+
icon: Target
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
temporal: {
|
|
56
|
+
cycles: ['monthly', 'quarterly', 'yearly'],
|
|
57
|
+
defaultCycle: 'monthly',
|
|
58
|
+
enableComparisons: true,
|
|
59
|
+
forecasting: {
|
|
60
|
+
enabled: true,
|
|
61
|
+
periods: 3,
|
|
62
|
+
algorithm: 'seasonal'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
categories: {
|
|
66
|
+
hierarchy: ['account', 'category', 'type'],
|
|
67
|
+
defaultGroupBy: 'category',
|
|
68
|
+
enableDrillDown: true,
|
|
69
|
+
colorCoding: true
|
|
70
|
+
},
|
|
71
|
+
actions: [
|
|
72
|
+
{
|
|
73
|
+
label: 'Add Transaction',
|
|
74
|
+
type: 'primary',
|
|
75
|
+
onClick: ({ data, config }) => {
|
|
76
|
+
console.log('Adding new transaction', { data, config });
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: 'Generate Report',
|
|
81
|
+
type: 'secondary',
|
|
82
|
+
onClick: ({ selectedItems, data, config }) => {
|
|
83
|
+
console.log('Generating report', { selectedItems, data, config });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Sample financial data for testing
|
|
90
|
+
export const sampleFinancialData: FinancialTransaction[] = [
|
|
91
|
+
{
|
|
92
|
+
id: '1',
|
|
93
|
+
amount: 5000,
|
|
94
|
+
category: 'Salary',
|
|
95
|
+
account: 'Checking',
|
|
96
|
+
date: '2024-01-15',
|
|
97
|
+
description: 'Monthly salary',
|
|
98
|
+
type: 'income',
|
|
99
|
+
status: 'completed'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: '2',
|
|
103
|
+
amount: -1200,
|
|
104
|
+
category: 'Rent',
|
|
105
|
+
account: 'Checking',
|
|
106
|
+
date: '2024-01-01',
|
|
107
|
+
description: 'Monthly rent payment',
|
|
108
|
+
type: 'expense',
|
|
109
|
+
status: 'completed'
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: '3',
|
|
113
|
+
amount: -300,
|
|
114
|
+
category: 'Groceries',
|
|
115
|
+
account: 'Checking',
|
|
116
|
+
date: '2024-01-10',
|
|
117
|
+
description: 'Weekly groceries',
|
|
118
|
+
type: 'expense',
|
|
119
|
+
status: 'completed'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: '4',
|
|
123
|
+
amount: -80,
|
|
124
|
+
category: 'Utilities',
|
|
125
|
+
account: 'Checking',
|
|
126
|
+
date: '2024-01-05',
|
|
127
|
+
description: 'Electric bill',
|
|
128
|
+
type: 'expense',
|
|
129
|
+
status: 'completed'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: '5',
|
|
133
|
+
amount: -45,
|
|
134
|
+
category: 'Entertainment',
|
|
135
|
+
account: 'Checking',
|
|
136
|
+
date: '2024-01-12',
|
|
137
|
+
description: 'Movie tickets',
|
|
138
|
+
type: 'expense',
|
|
139
|
+
status: 'completed'
|
|
140
|
+
}
|
|
141
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './financial-config';
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
5
|
+
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
|
|
6
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom'
|
|
7
|
+
import { AuthProvider } from '../features/auth'
|
|
8
|
+
import { SidebarProvider } from '../molecules/layout'
|
|
9
|
+
import { AppLayout } from '../molecules/layout'
|
|
10
|
+
import { DashboardTemplate } from './DashboardTemplate'
|
|
11
|
+
import type { AuthConfig } from '../atoms/types'
|
|
12
|
+
|
|
13
|
+
// App configuration interface
|
|
14
|
+
export interface AppConfig {
|
|
15
|
+
title: string
|
|
16
|
+
description?: string
|
|
17
|
+
version?: string
|
|
18
|
+
enableAuth?: boolean
|
|
19
|
+
enableQuery?: boolean
|
|
20
|
+
enableTheming?: boolean
|
|
21
|
+
enableRouting?: boolean
|
|
22
|
+
apiUrl?: string
|
|
23
|
+
apiTimeout?: number
|
|
24
|
+
theme?: string
|
|
25
|
+
darkMode?: boolean
|
|
26
|
+
auth?: AuthConfig
|
|
27
|
+
customProviders?: React.ComponentType<{ children: ReactNode }>[]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// App instance interface
|
|
31
|
+
export interface AppInstance {
|
|
32
|
+
render: () => ReactNode
|
|
33
|
+
addRoutes: (path: string, component: ReactNode) => void
|
|
34
|
+
mount: (elementId?: string) => void
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Main app factory function
|
|
38
|
+
export function createReactApp(config: AppConfig | string): AppInstance {
|
|
39
|
+
// Handle simple string config
|
|
40
|
+
const appConfig: AppConfig = typeof config === 'string'
|
|
41
|
+
? { title: config }
|
|
42
|
+
: config
|
|
43
|
+
|
|
44
|
+
// Set defaults
|
|
45
|
+
const {
|
|
46
|
+
title,
|
|
47
|
+
description = `${title} Application`,
|
|
48
|
+
version = '1.0.0',
|
|
49
|
+
enableAuth = true,
|
|
50
|
+
enableQuery = true,
|
|
51
|
+
enableRouting = true,
|
|
52
|
+
auth,
|
|
53
|
+
customProviders = []
|
|
54
|
+
} = appConfig
|
|
55
|
+
|
|
56
|
+
// Initialize query client
|
|
57
|
+
const queryClient = new QueryClient({
|
|
58
|
+
defaultOptions: {
|
|
59
|
+
queries: {
|
|
60
|
+
retry: 1,
|
|
61
|
+
refetchOnWindowFocus: false,
|
|
62
|
+
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
// Store routes
|
|
68
|
+
const routes: Array<{ path: string; component: ReactNode }> = []
|
|
69
|
+
|
|
70
|
+
// Default home page
|
|
71
|
+
const DefaultHome = () => (
|
|
72
|
+
<DashboardTemplate title={title} description={description}>
|
|
73
|
+
<div className="flex flex-col items-center justify-center min-h-[400px] text-center">
|
|
74
|
+
<h1 className="text-4xl font-bold text-gray-900 mb-4">🌿 {title}</h1>
|
|
75
|
+
<p className="text-lg text-gray-600 mb-6">{description}</p>
|
|
76
|
+
<div className="space-y-2 text-sm text-gray-500">
|
|
77
|
+
<p>✅ Template integration successful</p>
|
|
78
|
+
<p>🔧 Version: {version}</p>
|
|
79
|
+
<p>🚀 Ready for development</p>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</DashboardTemplate>
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
// Build provider tree
|
|
86
|
+
const createProviderTree = (children: ReactNode): ReactNode => {
|
|
87
|
+
let tree = children
|
|
88
|
+
|
|
89
|
+
// Wrap with custom providers (in reverse order)
|
|
90
|
+
customProviders.reverse().forEach((Provider) => {
|
|
91
|
+
tree = <Provider key={Provider.name}>{tree}</Provider>
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
// Wrap with layout providers
|
|
95
|
+
if (enableRouting) {
|
|
96
|
+
tree = (
|
|
97
|
+
<SidebarProvider>
|
|
98
|
+
{tree}
|
|
99
|
+
</SidebarProvider>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Wrap with auth provider
|
|
104
|
+
if (enableAuth) {
|
|
105
|
+
tree = <AuthProvider config={auth}>{tree}</AuthProvider>
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Wrap with query provider
|
|
109
|
+
if (enableQuery) {
|
|
110
|
+
tree = (
|
|
111
|
+
<QueryClientProvider client={queryClient}>
|
|
112
|
+
{tree}
|
|
113
|
+
{import.meta.env.DEV && <ReactQueryDevtools initialIsOpen={false} />}
|
|
114
|
+
</QueryClientProvider>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Wrap with router
|
|
119
|
+
if (enableRouting) {
|
|
120
|
+
tree = <BrowserRouter>{tree}</BrowserRouter>
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return tree
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Create app instance
|
|
127
|
+
const appInstance: AppInstance = {
|
|
128
|
+
addRoutes(path: string, component: ReactNode) {
|
|
129
|
+
routes.push({ path, component })
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
render() {
|
|
133
|
+
const AppContent = () => (
|
|
134
|
+
<Routes>
|
|
135
|
+
<Route path="/" element={<AppLayout />}>
|
|
136
|
+
<Route index element={<DefaultHome />} />
|
|
137
|
+
{routes.map(({ path, component }, index) => (
|
|
138
|
+
<Route key={index} path={path} element={component} />
|
|
139
|
+
))}
|
|
140
|
+
</Route>
|
|
141
|
+
</Routes>
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
return createProviderTree(<AppContent />)
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
mount(elementId = 'root') {
|
|
148
|
+
const element = document.getElementById(elementId)
|
|
149
|
+
if (!element) {
|
|
150
|
+
throw new Error(`Element with id "${elementId}" not found`)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const root = createRoot(element)
|
|
154
|
+
root.render(
|
|
155
|
+
<React.StrictMode>
|
|
156
|
+
{this.render()}
|
|
157
|
+
</React.StrictMode>
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return appInstance
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Convenience function for simple apps
|
|
166
|
+
export function createSimpleApp(title: string): AppInstance {
|
|
167
|
+
return createReactApp({ title })
|
|
168
|
+
}
|
|
169
|
+
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { cn } from '../../atoms/utils/utils';
|
|
3
|
+
import { SectionHeader } from '../../molecules/layout/SectionHeader';
|
|
4
|
+
import { Card } from '../../atoms/ui/card';
|
|
5
|
+
import { StatCard } from '../../atoms/composed/StatCard';
|
|
6
|
+
import { DashboardGrid } from '../DashboardTemplate';
|
|
7
|
+
import { DataBadge } from '../../atoms/composed/DataBadge';
|
|
8
|
+
import { TrendingUp, TrendingDown, DollarSign, PiggyBank, Target, AlertTriangle } from 'lucide-react';
|
|
9
|
+
|
|
10
|
+
export interface FinancialOverviewProps {
|
|
11
|
+
/** Total account balance */
|
|
12
|
+
totalBalance: number;
|
|
13
|
+
/** Monthly income */
|
|
14
|
+
monthlyIncome?: number;
|
|
15
|
+
/** Monthly expenses */
|
|
16
|
+
monthlyExpenses?: number;
|
|
17
|
+
/** Net worth change */
|
|
18
|
+
netWorthChange?: {
|
|
19
|
+
amount: number;
|
|
20
|
+
percentage: number;
|
|
21
|
+
period: string;
|
|
22
|
+
};
|
|
23
|
+
/** Savings rate */
|
|
24
|
+
savingsRate?: number;
|
|
25
|
+
/** Budget utilization */
|
|
26
|
+
budgetUtilization?: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface AccountSummary {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
type: 'checking' | 'savings' | 'credit' | 'investment' | 'loan';
|
|
33
|
+
balance: number;
|
|
34
|
+
change?: {
|
|
35
|
+
amount: number;
|
|
36
|
+
percentage: number;
|
|
37
|
+
};
|
|
38
|
+
status?: 'healthy' | 'warning' | 'critical';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface BudgetAlert {
|
|
42
|
+
id: string;
|
|
43
|
+
category: string;
|
|
44
|
+
spent: number;
|
|
45
|
+
budget: number;
|
|
46
|
+
severity: 'warning' | 'critical';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface FinancialGoal {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
target: number;
|
|
53
|
+
current: number;
|
|
54
|
+
deadline?: string;
|
|
55
|
+
status: 'on-track' | 'behind' | 'achieved';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface FinancialDashboardTemplateProps {
|
|
59
|
+
/** Page title */
|
|
60
|
+
title?: string;
|
|
61
|
+
/** Page description */
|
|
62
|
+
description?: string;
|
|
63
|
+
/** Financial overview metrics */
|
|
64
|
+
overview: FinancialOverviewProps;
|
|
65
|
+
/** Account summaries */
|
|
66
|
+
accounts?: AccountSummary[];
|
|
67
|
+
/** Budget alerts */
|
|
68
|
+
budgetAlerts?: BudgetAlert[];
|
|
69
|
+
/** Financial goals */
|
|
70
|
+
goals?: FinancialGoal[];
|
|
71
|
+
/** Recent transactions preview */
|
|
72
|
+
recentTransactions?: Array<{
|
|
73
|
+
id: string;
|
|
74
|
+
description: string;
|
|
75
|
+
amount: number;
|
|
76
|
+
category: string;
|
|
77
|
+
date: string;
|
|
78
|
+
}>;
|
|
79
|
+
/** Header actions */
|
|
80
|
+
actions?: React.ReactNode;
|
|
81
|
+
/** Additional content */
|
|
82
|
+
children?: React.ReactNode;
|
|
83
|
+
/** Additional CSS classes */
|
|
84
|
+
className?: string;
|
|
85
|
+
/** Category-based styling */
|
|
86
|
+
category?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
87
|
+
/** Loading state */
|
|
88
|
+
isLoading?: boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const FinancialDashboardTemplate: React.FC<FinancialDashboardTemplateProps> = ({
|
|
92
|
+
title = "Financial Dashboard",
|
|
93
|
+
description = "Your complete financial overview",
|
|
94
|
+
overview,
|
|
95
|
+
accounts = [],
|
|
96
|
+
budgetAlerts = [],
|
|
97
|
+
goals = [],
|
|
98
|
+
recentTransactions = [],
|
|
99
|
+
actions,
|
|
100
|
+
children,
|
|
101
|
+
className,
|
|
102
|
+
category = 2, // Green theme for financial
|
|
103
|
+
isLoading = false
|
|
104
|
+
}) => {
|
|
105
|
+
const formatCurrency = (amount: number) => {
|
|
106
|
+
return new Intl.NumberFormat('en-US', {
|
|
107
|
+
style: 'currency',
|
|
108
|
+
currency: 'USD'
|
|
109
|
+
}).format(amount);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const getAccountIcon = (type: AccountSummary['type']) => {
|
|
113
|
+
switch (type) {
|
|
114
|
+
case 'savings': return <PiggyBank className="w-4 h-4" />;
|
|
115
|
+
case 'investment': return <TrendingUp className="w-4 h-4" />;
|
|
116
|
+
case 'credit': return <AlertTriangle className="w-4 h-4" />;
|
|
117
|
+
default: return <DollarSign className="w-4 h-4" />;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const getAccountStatus = (account: AccountSummary) => {
|
|
122
|
+
if (account.type === 'credit' && account.balance > 0) return 'warning';
|
|
123
|
+
if (account.type === 'loan' && account.balance > 0) return 'error';
|
|
124
|
+
return account.status || 'success';
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<div className={cn('flex flex-col min-h-0 flex-1', className)}>
|
|
129
|
+
{/* Header Section */}
|
|
130
|
+
<div className="flex-shrink-0 border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
|
|
131
|
+
<div className="container mx-auto px-6 py-6">
|
|
132
|
+
<div className="flex items-start justify-between">
|
|
133
|
+
<div className="flex-1 min-w-0">
|
|
134
|
+
<SectionHeader
|
|
135
|
+
title={title}
|
|
136
|
+
description={description}
|
|
137
|
+
size="lg"
|
|
138
|
+
className="text-left"
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
{actions && (
|
|
143
|
+
<div className="ml-6 flex-shrink-0">
|
|
144
|
+
{actions}
|
|
145
|
+
</div>
|
|
146
|
+
)}
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
{/* Main Content */}
|
|
152
|
+
<div className="flex-1 min-h-0 overflow-auto">
|
|
153
|
+
<div className="container mx-auto px-6 py-6 space-y-6">
|
|
154
|
+
{/* Financial Overview */}
|
|
155
|
+
<div>
|
|
156
|
+
<h2 className="text-lg font-semibold mb-4">Financial Overview</h2>
|
|
157
|
+
<DashboardGrid columns={4} gap="md">
|
|
158
|
+
<StatCard
|
|
159
|
+
title="Total Balance"
|
|
160
|
+
value={formatCurrency(overview.totalBalance)}
|
|
161
|
+
icon={<DollarSign className="w-5 h-5" />}
|
|
162
|
+
category={category}
|
|
163
|
+
isLoading={isLoading}
|
|
164
|
+
/>
|
|
165
|
+
|
|
166
|
+
{overview.monthlyIncome && (
|
|
167
|
+
<StatCard
|
|
168
|
+
title="Monthly Income"
|
|
169
|
+
value={formatCurrency(overview.monthlyIncome)}
|
|
170
|
+
icon={<TrendingUp className="w-5 h-5" />}
|
|
171
|
+
category={category}
|
|
172
|
+
isLoading={isLoading}
|
|
173
|
+
/>
|
|
174
|
+
)}
|
|
175
|
+
|
|
176
|
+
{overview.monthlyExpenses && (
|
|
177
|
+
<StatCard
|
|
178
|
+
title="Monthly Expenses"
|
|
179
|
+
value={formatCurrency(overview.monthlyExpenses)}
|
|
180
|
+
icon={<TrendingDown className="w-5 h-5" />}
|
|
181
|
+
category={category}
|
|
182
|
+
isLoading={isLoading}
|
|
183
|
+
/>
|
|
184
|
+
)}
|
|
185
|
+
|
|
186
|
+
{overview.savingsRate && (
|
|
187
|
+
<StatCard
|
|
188
|
+
title="Savings Rate"
|
|
189
|
+
value={`${overview.savingsRate}%`}
|
|
190
|
+
icon={<Target className="w-5 h-5" />}
|
|
191
|
+
category={category}
|
|
192
|
+
isLoading={isLoading}
|
|
193
|
+
/>
|
|
194
|
+
)}
|
|
195
|
+
</DashboardGrid>
|
|
196
|
+
</div>
|
|
197
|
+
|
|
198
|
+
{/* Accounts Overview */}
|
|
199
|
+
{accounts.length > 0 && (
|
|
200
|
+
<div>
|
|
201
|
+
<h2 className="text-lg font-semibold mb-4">Accounts</h2>
|
|
202
|
+
<DashboardGrid columns={2} gap="md">
|
|
203
|
+
{accounts.map((account) => (
|
|
204
|
+
<Card key={account.id} category={category} className="p-4">
|
|
205
|
+
<div className="flex items-start justify-between">
|
|
206
|
+
<div className="flex items-center gap-3">
|
|
207
|
+
{getAccountIcon(account.type)}
|
|
208
|
+
<div>
|
|
209
|
+
<h3 className="font-medium">{account.name}</h3>
|
|
210
|
+
<p className="text-sm text-muted-foreground capitalize">{account.type}</p>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
<div className="text-right">
|
|
214
|
+
<p className="font-semibold">{formatCurrency(account.balance)}</p>
|
|
215
|
+
{account.change && (
|
|
216
|
+
<div className="flex items-center gap-1 text-sm">
|
|
217
|
+
{account.change.amount > 0 ? (
|
|
218
|
+
<TrendingUp className="w-3 h-3 text-green-500" />
|
|
219
|
+
) : (
|
|
220
|
+
<TrendingDown className="w-3 h-3 text-red-500" />
|
|
221
|
+
)}
|
|
222
|
+
<span className={account.change.amount > 0 ? 'text-green-500' : 'text-red-500'}>
|
|
223
|
+
{Math.abs(account.change.percentage)}%
|
|
224
|
+
</span>
|
|
225
|
+
</div>
|
|
226
|
+
)}
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
<div className="mt-3">
|
|
230
|
+
<DataBadge
|
|
231
|
+
variant="status"
|
|
232
|
+
status={getAccountStatus(account)}
|
|
233
|
+
>
|
|
234
|
+
{account.status || 'healthy'}
|
|
235
|
+
</DataBadge>
|
|
236
|
+
</div>
|
|
237
|
+
</Card>
|
|
238
|
+
))}
|
|
239
|
+
</DashboardGrid>
|
|
240
|
+
</div>
|
|
241
|
+
)}
|
|
242
|
+
|
|
243
|
+
{/* Budget Alerts */}
|
|
244
|
+
{budgetAlerts.length > 0 && (
|
|
245
|
+
<div>
|
|
246
|
+
<h2 className="text-lg font-semibold mb-4">Budget Alerts</h2>
|
|
247
|
+
<div className="space-y-3">
|
|
248
|
+
{budgetAlerts.map((alert) => (
|
|
249
|
+
<Card key={alert.id} className="p-4">
|
|
250
|
+
<div className="flex items-center justify-between">
|
|
251
|
+
<div className="flex items-center gap-3">
|
|
252
|
+
<AlertTriangle className={cn(
|
|
253
|
+
"w-5 h-5",
|
|
254
|
+
alert.severity === 'critical' ? 'text-red-500' : 'text-yellow-500'
|
|
255
|
+
)} />
|
|
256
|
+
<div>
|
|
257
|
+
<h3 className="font-medium">{alert.category}</h3>
|
|
258
|
+
<p className="text-sm text-muted-foreground">
|
|
259
|
+
{formatCurrency(alert.spent)} of {formatCurrency(alert.budget)} spent
|
|
260
|
+
</p>
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
<div className="text-right">
|
|
264
|
+
<DataBadge
|
|
265
|
+
variant="status"
|
|
266
|
+
status={alert.severity === 'critical' ? 'error' : 'warning'}
|
|
267
|
+
>
|
|
268
|
+
{Math.round((alert.spent / alert.budget) * 100)}% used
|
|
269
|
+
</DataBadge>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
</Card>
|
|
273
|
+
))}
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
)}
|
|
277
|
+
|
|
278
|
+
{/* Financial Goals */}
|
|
279
|
+
{goals.length > 0 && (
|
|
280
|
+
<div>
|
|
281
|
+
<h2 className="text-lg font-semibold mb-4">Financial Goals</h2>
|
|
282
|
+
<DashboardGrid columns={1} gap="md">
|
|
283
|
+
{goals.map((goal) => {
|
|
284
|
+
const progress = (goal.current / goal.target) * 100;
|
|
285
|
+
return (
|
|
286
|
+
<Card key={goal.id} category={category} className="p-4">
|
|
287
|
+
<div className="flex items-start justify-between mb-3">
|
|
288
|
+
<div>
|
|
289
|
+
<h3 className="font-medium">{goal.name}</h3>
|
|
290
|
+
<p className="text-sm text-muted-foreground">
|
|
291
|
+
{formatCurrency(goal.current)} of {formatCurrency(goal.target)}
|
|
292
|
+
</p>
|
|
293
|
+
</div>
|
|
294
|
+
<DataBadge
|
|
295
|
+
variant="status"
|
|
296
|
+
status={goal.status === 'achieved' ? 'success' : goal.status === 'behind' ? 'warning' : 'info'}
|
|
297
|
+
>
|
|
298
|
+
{goal.status}
|
|
299
|
+
</DataBadge>
|
|
300
|
+
</div>
|
|
301
|
+
<div className="w-full bg-muted rounded-full h-2">
|
|
302
|
+
<div
|
|
303
|
+
className={cn(
|
|
304
|
+
'h-2 rounded-full transition-all',
|
|
305
|
+
`bg-category-${category}`
|
|
306
|
+
)}
|
|
307
|
+
style={{ width: `${Math.min(progress, 100)}%` }}
|
|
308
|
+
/>
|
|
309
|
+
</div>
|
|
310
|
+
<p className="text-sm text-muted-foreground mt-2">
|
|
311
|
+
{Math.round(progress)}% complete
|
|
312
|
+
</p>
|
|
313
|
+
</Card>
|
|
314
|
+
);
|
|
315
|
+
})}
|
|
316
|
+
</DashboardGrid>
|
|
317
|
+
</div>
|
|
318
|
+
)}
|
|
319
|
+
|
|
320
|
+
{/* Additional Content */}
|
|
321
|
+
{children}
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
</div>
|
|
325
|
+
);
|
|
326
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Page templates for common layout patterns
|
|
2
|
+
export { ComponentShowcaseTemplate } from './ComponentShowcaseTemplate';
|
|
3
|
+
export {
|
|
4
|
+
DashboardTemplate,
|
|
5
|
+
DashboardGrid,
|
|
6
|
+
DashboardCard,
|
|
7
|
+
type DashboardTemplateProps,
|
|
8
|
+
type DashboardGridProps,
|
|
9
|
+
type DashboardCardProps
|
|
10
|
+
} from './DashboardTemplate';
|
|
11
|
+
export {
|
|
12
|
+
AuthTemplate,
|
|
13
|
+
AuthFormField,
|
|
14
|
+
AuthLink,
|
|
15
|
+
AuthDivider,
|
|
16
|
+
type AuthTemplateProps,
|
|
17
|
+
type AuthFormFieldProps,
|
|
18
|
+
type AuthLinkProps,
|
|
19
|
+
type AuthDividerProps
|
|
20
|
+
} from './AuthTemplate';
|
|
21
|
+
export {
|
|
22
|
+
DataTemplate,
|
|
23
|
+
DataDetailTemplate,
|
|
24
|
+
type DataTemplateProps,
|
|
25
|
+
type DataDetailTemplateProps
|
|
26
|
+
} from './DataTemplate';
|
|
27
|
+
|
|
28
|
+
// Admin templates for administrative interfaces
|
|
29
|
+
export * from './admin';
|
|
30
|
+
|
|
31
|
+
// Entity templates for cross-domain configurable layouts
|
|
32
|
+
export * from './entity';
|
|
33
|
+
|
|
34
|
+
// React App Factory
|
|
35
|
+
export {
|
|
36
|
+
createReactApp,
|
|
37
|
+
createSimpleApp,
|
|
38
|
+
type AppConfig,
|
|
39
|
+
type AppInstance
|
|
40
|
+
} from './factory';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|