@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.
Files changed (86) hide show
  1. package/dist/atoms/composed/index.d.ts +0 -1
  2. package/dist/atoms/composed/index.d.ts.map +1 -1
  3. package/dist/atoms/types/index.d.ts +0 -2
  4. package/dist/atoms/types/index.d.ts.map +1 -1
  5. package/dist/atoms/ui/ErrorBoundary.d.ts +1 -1
  6. package/dist/atoms/ui/button.d.ts +1 -1
  7. package/dist/atoms/utils/utils.d.ts +0 -2
  8. package/dist/atoms/utils/utils.d.ts.map +1 -1
  9. package/dist/features/auth/components/ProtectedRoute.d.ts +1 -1
  10. package/dist/frontend-patterns.css +1 -1
  11. package/dist/index.es.js +15 -403
  12. package/dist/index.es.js.map +1 -1
  13. package/dist/index.js +14 -403
  14. package/dist/index.js.map +1 -1
  15. package/dist/molecules/layout/Sidebar.d.ts.map +1 -1
  16. package/dist/molecules/layout/SidebarButton/SidebarButton.d.ts +0 -2
  17. package/dist/molecules/layout/SidebarButton/SidebarButton.d.ts.map +1 -1
  18. package/dist/molecules/layout/index.d.ts +0 -3
  19. package/dist/molecules/layout/index.d.ts.map +1 -1
  20. package/dist/templates/factory.d.ts +1 -2
  21. package/dist/templates/factory.d.ts.map +1 -1
  22. package/dist/templates/index.d.ts.map +1 -1
  23. package/package.json +3 -7
  24. package/src/App.tsx +1 -11
  25. package/src/atoms/composed/index.ts +0 -1
  26. package/src/atoms/types/index.ts +1 -3
  27. package/src/atoms/utils/utils.ts +2 -4
  28. package/src/molecules/layout/Sidebar.tsx +23 -10
  29. package/src/molecules/layout/SidebarButton/SidebarButton.tsx +10 -32
  30. package/src/molecules/layout/index.ts +1 -4
  31. package/src/organisms/index.ts +1 -5
  32. package/src/pages/AdminShowcase/AdminDashboardShowcase.tsx +75 -77
  33. package/src/pages/AdminShowcase/index.tsx +1 -2
  34. package/src/pages/index.ts +1 -2
  35. package/src/templates/factory.tsx +7 -14
  36. package/src/templates/index.ts +0 -4
  37. package/dist/atoms/composed/SalesPanel/SalesPanel.d.ts +0 -19
  38. package/dist/atoms/composed/SalesPanel/SalesPanel.d.ts.map +0 -1
  39. package/dist/atoms/composed/SalesPanel/index.d.ts +0 -2
  40. package/dist/atoms/composed/SalesPanel/index.d.ts.map +0 -1
  41. package/dist/atoms/composed/SalesPanel/mockSalesData.d.ts +0 -63
  42. package/dist/atoms/composed/SalesPanel/mockSalesData.d.ts.map +0 -1
  43. package/dist/atoms/types/entity-config.d.ts +0 -117
  44. package/dist/atoms/types/entity-config.d.ts.map +0 -1
  45. package/dist/atoms/types/navigation.d.ts +0 -30
  46. package/dist/atoms/types/navigation.d.ts.map +0 -1
  47. package/dist/atoms/utils/icon-resolver.d.ts +0 -72
  48. package/dist/atoms/utils/icon-resolver.d.ts.map +0 -1
  49. package/dist/atoms/utils/metric-engine.d.ts +0 -30
  50. package/dist/atoms/utils/metric-engine.d.ts.map +0 -1
  51. package/dist/molecules/layout/DashboardWithSidePanel/DashboardWithSidePanel.d.ts +0 -16
  52. package/dist/molecules/layout/DashboardWithSidePanel/DashboardWithSidePanel.d.ts.map +0 -1
  53. package/dist/molecules/layout/DashboardWithSidePanel/index.d.ts +0 -2
  54. package/dist/molecules/layout/DashboardWithSidePanel/index.d.ts.map +0 -1
  55. package/dist/molecules/layout/NavigationContext.d.ts +0 -15
  56. package/dist/molecules/layout/NavigationContext.d.ts.map +0 -1
  57. package/src/__tests__/atoms/composed/databadge.test.tsx +0 -106
  58. package/src/__tests__/atoms/composed/statcard.test.tsx +0 -133
  59. package/src/__tests__/atoms/utils/icon-resolver.test.tsx +0 -140
  60. package/src/atoms/composed/SalesPanel/SalesPanel.tsx +0 -116
  61. package/src/atoms/composed/SalesPanel/index.ts +0 -1
  62. package/src/atoms/composed/SalesPanel/mockSalesData.ts +0 -151
  63. package/src/atoms/types/entity-config.ts +0 -127
  64. package/src/atoms/types/navigation.ts +0 -43
  65. package/src/atoms/utils/icon-resolver.tsx +0 -54
  66. package/src/atoms/utils/metric-engine.ts +0 -236
  67. package/src/molecules/layout/DashboardWithSidePanel/DashboardWithSidePanel.tsx +0 -42
  68. package/src/molecules/layout/DashboardWithSidePanel/index.ts +0 -1
  69. package/src/molecules/layout/NavigationContext.tsx +0 -63
  70. package/src/organisms/entity/CategoryBreakdownPanel.tsx +0 -427
  71. package/src/organisms/entity/EntityListPanel.tsx +0 -339
  72. package/src/organisms/entity/MetricsOverviewPanel.tsx +0 -236
  73. package/src/organisms/entity/TrendAnalysisPanel.tsx +0 -337
  74. package/src/organisms/entity/index.ts +0 -4
  75. package/src/pages/AdminShowcase/SalesPerformanceDashboard.tsx +0 -158
  76. package/src/pages/EntityShowcase/EntityManagementShowcase.tsx +0 -137
  77. package/src/pages/EntityShowcase/EntityPerformanceShowcase.tsx +0 -117
  78. package/src/pages/EntityShowcase/index.ts +0 -2
  79. package/src/pages/EntityTemplateExample.tsx +0 -229
  80. package/src/pages/TestEntityTemplate.tsx +0 -40
  81. package/src/templates/entity/EntityManagementTemplate.tsx +0 -430
  82. package/src/templates/entity/EntityPerformanceDashboardTemplate.tsx +0 -277
  83. package/src/templates/entity/configs/financial-config.ts +0 -141
  84. package/src/templates/entity/configs/index.ts +0 -1
  85. package/src/templates/entity/index.ts +0 -3
  86. package/src/templates/financial/FinancialDashboardTemplate.tsx +0 -326
@@ -1,117 +0,0 @@
1
- import React, { useState } from 'react';
2
- import {
3
- MetricsOverviewWithInsightsPanel,
4
- TrendAnalysisPanel,
5
- CategoryBreakdownPanel
6
- } from '../../organisms/entity';
7
- import { financialConfig, sampleFinancialData } from '../../templates/entity/configs/financial-config';
8
- import { ShowcaseSection } from '../../molecules/layout/ShowcaseSection';
9
- import { IconBadge } from '../../atoms/composed/IconBadge';
10
- import { Switch } from '../../atoms/ui/Switch';
11
- import { BarChart3, TrendingUp, PieChart, Layers } from 'lucide-react';
12
-
13
- export const EntityPerformanceShowcase: React.FC = () => {
14
- const [showInsights, setShowInsights] = useState(true);
15
- const [showTrends, setShowTrends] = useState(true);
16
- const [showCategories, setShowCategories] = useState(true);
17
-
18
- return (
19
- <div className="min-h-screen bg-background">
20
- <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-12">
21
- <div className="flex items-center justify-between mb-12">
22
- <div className="flex items-center space-x-4">
23
- <IconBadge
24
- variant="category"
25
- category={6}
26
- size="lg"
27
- icon={<BarChart3 className="w-6 h-6" />}
28
- />
29
- <div>
30
- <h1 className="text-4xl font-bold text-foreground">Performance Dashboard</h1>
31
- <p className="text-lg text-muted-foreground mt-2">
32
- Cross-domain entity template showcasing configurable performance metrics and analytics
33
- </p>
34
- </div>
35
- </div>
36
-
37
- <div className="flex items-center space-x-3">
38
- <div className="flex items-center gap-3 bg-card/80 backdrop-blur-sm border border-border/50 rounded px-3 py-2">
39
- <Layers className="w-4 h-4 text-muted-foreground" />
40
- <span className="text-sm font-medium text-foreground">Live Data</span>
41
- <Switch checked={true} disabled />
42
- </div>
43
- </div>
44
- </div>
45
-
46
- <div className="space-y-12">
47
- {showInsights && (
48
- <ShowcaseSection
49
- title="Metrics Overview with Insights"
50
- description="Configurable KPI displays with automated insights and trend indicators"
51
- badge={{
52
- text: "Interactive",
53
- variant: "category",
54
- category: 2
55
- }}
56
- >
57
- <MetricsOverviewWithInsightsPanel
58
- metrics={financialConfig.metrics}
59
- data={sampleFinancialData}
60
- isLoading={false}
61
- showInsights={true}
62
- onMetricClick={(metric, value) => {
63
- console.log('Metric clicked:', metric.label, value);
64
- }}
65
- />
66
- </ShowcaseSection>
67
- )}
68
-
69
- {showTrends && (
70
- <ShowcaseSection
71
- title="Trend Analysis"
72
- description="Time-series visualizations with forecasting and period comparison"
73
- badge={{
74
- text: "Dynamic",
75
- variant: "category",
76
- category: 4
77
- }}
78
- >
79
- <TrendAnalysisPanel
80
- metrics={financialConfig.metrics}
81
- data={sampleFinancialData}
82
- isLoading={false}
83
- onTrendPeriodChange={(period) => {
84
- console.log('Trend period changed:', period);
85
- }}
86
- />
87
- </ShowcaseSection>
88
- )}
89
-
90
- {showCategories && (
91
- <ShowcaseSection
92
- title="Category Breakdown"
93
- description="Hierarchical data visualization with drill-down capabilities"
94
- badge={{
95
- text: "Explorable",
96
- variant: "category",
97
- category: 7
98
- }}
99
- >
100
- <CategoryBreakdownPanel
101
- categoryConfig={financialConfig.categories}
102
- valueField="amount"
103
- data={sampleFinancialData}
104
- isLoading={false}
105
- onCategoryClick={(category) => {
106
- console.log('Category clicked:', category);
107
- }}
108
- />
109
- </ShowcaseSection>
110
- )}
111
- </div>
112
- </div>
113
- </div>
114
- );
115
- };
116
-
117
- export default EntityPerformanceShowcase;
@@ -1,2 +0,0 @@
1
- export { EntityPerformanceShowcase } from './EntityPerformanceShowcase';
2
- export { EntityManagementShowcase } from './EntityManagementShowcase';
@@ -1,229 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { EntityPerformanceDashboardTemplate } from '../templates/entity';
3
- import { DashboardWithSidePanel } from '../molecules/layout';
4
- import { financialConfig, sampleFinancialData } from '../templates/entity/configs/financial-config';
5
- import { DataTable } from '../atoms/composed/DataTable';
6
- import { DataBadge } from '../atoms/composed/DataBadge';
7
- import { Card } from '../atoms/ui/card';
8
- import { Button } from '../atoms/ui/button';
9
- import { DollarSign, TrendingUp, TrendingDown, Eye, Filter } from 'lucide-react';
10
-
11
- // Enhanced transaction data for side panel
12
- const recentTransactions = [
13
- {
14
- id: 'TXN-001',
15
- description: 'Product Sale - Premium Package',
16
- amount: 2499.99,
17
- type: 'income',
18
- category: 'Sales',
19
- date: '2024-06-08',
20
- status: 'completed',
21
- customer: 'Acme Corp'
22
- },
23
- {
24
- id: 'TXN-002',
25
- description: 'Subscription Revenue',
26
- amount: 149.99,
27
- type: 'income',
28
- category: 'Recurring',
29
- date: '2024-06-08',
30
- status: 'completed',
31
- customer: 'TechStart Inc'
32
- },
33
- {
34
- id: 'TXN-003',
35
- description: 'Refund - Service Cancellation',
36
- amount: -299.99,
37
- type: 'expense',
38
- category: 'Refunds',
39
- date: '2024-06-07',
40
- status: 'processed',
41
- customer: 'Beta Solutions'
42
- },
43
- {
44
- id: 'TXN-004',
45
- description: 'Consulting Services',
46
- amount: 1200.00,
47
- type: 'income',
48
- category: 'Services',
49
- date: '2024-06-07',
50
- status: 'completed',
51
- customer: 'Global Enterprises'
52
- },
53
- {
54
- id: 'TXN-005',
55
- description: 'Platform License',
56
- amount: 599.99,
57
- type: 'income',
58
- category: 'Licenses',
59
- date: '2024-06-06',
60
- status: 'pending',
61
- customer: 'StartupXYZ'
62
- }
63
- ];
64
-
65
- const transactionColumns = [
66
- {
67
- key: 'id',
68
- header: 'Transaction ID',
69
- render: (value: string) => (
70
- <code className="text-xs bg-muted px-2 py-1 rounded">{value}</code>
71
- )
72
- },
73
- {
74
- key: 'description',
75
- header: 'Description',
76
- render: (value: string) => (
77
- <div className="max-w-[200px] truncate" title={value}>
78
- {value}
79
- </div>
80
- )
81
- },
82
- {
83
- key: 'amount',
84
- header: 'Amount',
85
- render: (value: number) => (
86
- <div className={`font-medium ${value >= 0 ? 'text-green-600' : 'text-red-600'}`}>
87
- {value >= 0 ? '+' : ''}${Math.abs(value).toLocaleString()}
88
- </div>
89
- )
90
- },
91
- {
92
- key: 'category',
93
- header: 'Category',
94
- render: (value: string) => (
95
- <DataBadge variant="category" category={1}>
96
- {value}
97
- </DataBadge>
98
- )
99
- },
100
- {
101
- key: 'status',
102
- header: 'Status',
103
- render: (value: string) => (
104
- <DataBadge variant="status" status={value === 'completed' ? 'success' : value === 'pending' ? 'warning' : 'info'}>
105
- {value}
106
- </DataBadge>
107
- )
108
- }
109
- ];
110
-
111
- export const EntityTemplateExample: React.FC = () => {
112
- const [showSidePanel, setShowSidePanel] = useState(true);
113
-
114
- const handleTransactionClick = (transaction: any) => {
115
- console.log('Transaction selected:', transaction);
116
- };
117
-
118
- return (
119
- <DashboardWithSidePanel
120
- showSidePanel={showSidePanel}
121
- sidePanelWidth={80}
122
- sidePanel={
123
- <div className="fixed right-0 top-16 h-[calc(100vh-4rem)] w-80 bg-background border-l border-border shadow-lg flex flex-col z-30">
124
- {/* Side Panel Header */}
125
- <div className="p-4 border-b border-border bg-muted/30">
126
- <div className="flex items-center justify-between">
127
- <h3 className="font-semibold">Recent Transactions</h3>
128
- <Button
129
- variant="ghost"
130
- size="sm"
131
- onClick={() => setShowSidePanel(false)}
132
- >
133
- ×
134
- </Button>
135
- </div>
136
- <p className="text-sm text-muted-foreground mt-1">
137
- Latest financial activity
138
- </p>
139
- </div>
140
-
141
- {/* Transaction Summary Cards */}
142
- <div className="p-4 space-y-3 border-b border-border">
143
- <Card className="p-3">
144
- <div className="flex items-center justify-between">
145
- <div className="flex items-center gap-2">
146
- <TrendingUp className="w-4 h-4 text-green-600" />
147
- <span className="text-sm font-medium">Today's Income</span>
148
- </div>
149
- <span className="text-green-600 font-semibold">+$2,649.98</span>
150
- </div>
151
- </Card>
152
-
153
- <Card className="p-3">
154
- <div className="flex items-center justify-between">
155
- <div className="flex items-center gap-2">
156
- <TrendingDown className="w-4 h-4 text-red-600" />
157
- <span className="text-sm font-medium">Today's Expenses</span>
158
- </div>
159
- <span className="text-red-600 font-semibold">-$299.99</span>
160
- </div>
161
- </Card>
162
- </div>
163
-
164
- {/* Transaction List */}
165
- <div className="flex-1 overflow-auto p-4">
166
- <DataTable
167
- data={recentTransactions}
168
- columns={transactionColumns}
169
- showSearch={true}
170
- searchPlaceholder="Search transactions..."
171
- showPagination={false}
172
- onRowClick={handleTransactionClick}
173
- className="text-xs"
174
- compact={true}
175
- />
176
- </div>
177
-
178
- {/* Side Panel Footer */}
179
- <div className="p-4 border-t border-border bg-muted/30">
180
- <Button variant="outline" size="sm" className="w-full">
181
- <DollarSign className="w-4 h-4 mr-2" />
182
- View All Transactions
183
- </Button>
184
- </div>
185
- </div>
186
- }
187
- >
188
- <EntityPerformanceDashboardTemplate
189
- config={financialConfig}
190
- data={sampleFinancialData}
191
- isLoading={false}
192
- layout="standard"
193
- showInsights={true}
194
- showTrends={true}
195
- showCategories={true}
196
- onMetricClick={(metric, value) => {
197
- console.log('Metric clicked:', metric.label, value);
198
- }}
199
- onCategoryClick={(category) => {
200
- console.log('Category clicked:', category);
201
- }}
202
- onTrendPeriodChange={(period) => {
203
- console.log('Trend period changed:', period);
204
- }}
205
- onExport={(type, data) => {
206
- console.log('Export requested:', type, data);
207
- }}
208
- headerSlot={
209
- <div className="flex gap-2">
210
- <Button
211
- variant="outline"
212
- size="sm"
213
- onClick={() => setShowSidePanel(!showSidePanel)}
214
- >
215
- <Eye className="w-4 h-4 mr-2" />
216
- {showSidePanel ? 'Hide' : 'Show'} Transactions
217
- </Button>
218
- <Button variant="outline" size="sm">
219
- <Filter className="w-4 h-4 mr-2" />
220
- Filter Data
221
- </Button>
222
- </div>
223
- }
224
- />
225
- </DashboardWithSidePanel>
226
- );
227
- };
228
-
229
- export default EntityTemplateExample;
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
-
3
- // Simple test component to verify the entity templates work
4
- export const TestEntityTemplate: React.FC = () => {
5
- const testData = [
6
- {
7
- id: '1',
8
- amount: 1000,
9
- category: 'Test',
10
- date: '2024-01-01'
11
- }
12
- ];
13
-
14
- const testConfig = {
15
- entityType: 'transactional' as const,
16
- display: {
17
- title: 'Test Dashboard',
18
- category: 1 as const
19
- },
20
- metrics: [
21
- {
22
- key: 'amount',
23
- label: 'Total Amount',
24
- type: 'currency' as const
25
- }
26
- ]
27
- };
28
-
29
- return (
30
- <div className="p-8">
31
- <h1 className="text-2xl font-bold mb-4">Entity Template Test</h1>
32
- <div className="bg-muted p-4 rounded-lg">
33
- <p>Config: {JSON.stringify(testConfig, null, 2)}</p>
34
- <p>Data: {JSON.stringify(testData, null, 2)}</p>
35
- </div>
36
- </div>
37
- );
38
- };
39
-
40
- export default TestEntityTemplate;