@pagamio/frontend-commons-lib 0.8.212 → 0.8.214
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/lib/api/TanstackQueryProvider.d.ts +146 -0
- package/lib/api/TanstackQueryProvider.js +140 -0
- package/lib/api/index.d.ts +2 -0
- package/lib/api/index.js +2 -0
- package/lib/api/tanstackQuery.d.ts +249 -0
- package/lib/api/tanstackQuery.js +299 -0
- package/lib/components/layout/Sidebar.js +50 -16
- package/lib/components/ui/Sheet.d.ts +1 -1
- package/lib/context/SidebarContext.d.ts +20 -0
- package/lib/dashboard-visuals-v2/DashboardWrapperV2.d.ts +81 -0
- package/lib/dashboard-visuals-v2/DashboardWrapperV2.js +217 -0
- package/lib/dashboard-visuals-v2/cards/CardGrid.d.ts +22 -0
- package/lib/dashboard-visuals-v2/cards/CardGrid.js +27 -0
- package/lib/dashboard-visuals-v2/cards/InfoCard.d.ts +7 -0
- package/lib/dashboard-visuals-v2/cards/InfoCard.js +26 -0
- package/lib/dashboard-visuals-v2/cards/MetricCard.d.ts +7 -0
- package/lib/dashboard-visuals-v2/cards/MetricCard.js +37 -0
- package/lib/dashboard-visuals-v2/cards/StatCard.d.ts +7 -0
- package/lib/dashboard-visuals-v2/cards/StatCard.js +92 -0
- package/lib/dashboard-visuals-v2/cards/TopItemsCard.d.ts +7 -0
- package/lib/dashboard-visuals-v2/cards/TopItemsCard.js +34 -0
- package/lib/dashboard-visuals-v2/cards/TransactionListCard.d.ts +7 -0
- package/lib/dashboard-visuals-v2/cards/TransactionListCard.js +24 -0
- package/lib/dashboard-visuals-v2/cards/index.d.ts +9 -0
- package/lib/dashboard-visuals-v2/cards/index.js +9 -0
- package/lib/dashboard-visuals-v2/charts/AreaChart.d.ts +7 -0
- package/lib/dashboard-visuals-v2/charts/AreaChart.js +124 -0
- package/lib/dashboard-visuals-v2/charts/BarChart.d.ts +7 -0
- package/lib/dashboard-visuals-v2/charts/BarChart.js +106 -0
- package/lib/dashboard-visuals-v2/charts/BaseChart.d.ts +61 -0
- package/lib/dashboard-visuals-v2/charts/BaseChart.js +173 -0
- package/lib/dashboard-visuals-v2/charts/DonutChart.d.ts +7 -0
- package/lib/dashboard-visuals-v2/charts/DonutChart.js +108 -0
- package/lib/dashboard-visuals-v2/charts/HeatmapChart.d.ts +7 -0
- package/lib/dashboard-visuals-v2/charts/HeatmapChart.js +101 -0
- package/lib/dashboard-visuals-v2/charts/LineChart.d.ts +7 -0
- package/lib/dashboard-visuals-v2/charts/LineChart.js +109 -0
- package/lib/dashboard-visuals-v2/charts/MixedChart.d.ts +7 -0
- package/lib/dashboard-visuals-v2/charts/MixedChart.js +106 -0
- package/lib/dashboard-visuals-v2/charts/PieChart.d.ts +7 -0
- package/lib/dashboard-visuals-v2/charts/PieChart.js +10 -0
- package/lib/dashboard-visuals-v2/charts/RadialChart.d.ts +7 -0
- package/lib/dashboard-visuals-v2/charts/RadialChart.js +72 -0
- package/lib/dashboard-visuals-v2/charts/index.d.ts +12 -0
- package/lib/dashboard-visuals-v2/charts/index.js +12 -0
- package/lib/dashboard-visuals-v2/components/DataFetchingVisual.d.ts +0 -0
- package/lib/dashboard-visuals-v2/components/DataFetchingVisual.js +1 -0
- package/lib/dashboard-visuals-v2/components/index.d.ts +0 -0
- package/lib/dashboard-visuals-v2/components/index.js +1 -0
- package/lib/dashboard-visuals-v2/hooks/index.d.ts +4 -0
- package/lib/dashboard-visuals-v2/hooks/index.js +4 -0
- package/lib/dashboard-visuals-v2/hooks/useChartData.d.ts +72 -0
- package/lib/dashboard-visuals-v2/hooks/useChartData.js +122 -0
- package/lib/dashboard-visuals-v2/index.d.ts +10 -0
- package/lib/dashboard-visuals-v2/index.js +16 -0
- package/lib/dashboard-visuals-v2/types/card.types.d.ts +237 -0
- package/lib/dashboard-visuals-v2/types/card.types.js +30 -0
- package/lib/dashboard-visuals-v2/types/chart.types.d.ts +308 -0
- package/lib/dashboard-visuals-v2/types/chart.types.js +25 -0
- package/lib/dashboard-visuals-v2/types/index.d.ts +6 -0
- package/lib/dashboard-visuals-v2/types/index.js +6 -0
- package/lib/dashboard-visuals-v2/utils/index.d.ts +0 -0
- package/lib/dashboard-visuals-v2/utils/index.js +1 -0
- package/lib/dashboard-visuals-v2/utils/propsTransformer.d.ts +0 -0
- package/lib/dashboard-visuals-v2/utils/propsTransformer.js +1 -0
- package/lib/dashboard-visuals-v2/visualRegistry.d.ts +59 -0
- package/lib/dashboard-visuals-v2/visualRegistry.js +110 -0
- package/lib/data-table-v2/DataTable.d.ts +7 -0
- package/lib/data-table-v2/DataTable.js +206 -0
- package/lib/data-table-v2/components/DataTableBody.d.ts +19 -0
- package/lib/data-table-v2/components/DataTableBody.js +20 -0
- package/lib/data-table-v2/components/DataTableEmpty.d.ts +17 -0
- package/lib/data-table-v2/components/DataTableEmpty.js +13 -0
- package/lib/data-table-v2/components/DataTableError.d.ts +16 -0
- package/lib/data-table-v2/components/DataTableError.js +14 -0
- package/lib/data-table-v2/components/DataTableHeader.d.ts +15 -0
- package/lib/data-table-v2/components/DataTableHeader.js +31 -0
- package/lib/data-table-v2/components/DataTableLoading.d.ts +14 -0
- package/lib/data-table-v2/components/DataTableLoading.js +19 -0
- package/lib/data-table-v2/components/DataTablePagination.d.ts +36 -0
- package/lib/data-table-v2/components/DataTablePagination.js +20 -0
- package/lib/data-table-v2/components/DataTableRowActions.d.ts +13 -0
- package/lib/data-table-v2/components/DataTableRowActions.js +57 -0
- package/lib/data-table-v2/components/DataTableSearch.d.ts +19 -0
- package/lib/data-table-v2/components/DataTableSearch.js +33 -0
- package/lib/data-table-v2/components/DataTableToolbar.d.ts +54 -0
- package/lib/data-table-v2/components/DataTableToolbar.js +28 -0
- package/lib/data-table-v2/components/index.d.ts +12 -0
- package/lib/data-table-v2/components/index.js +12 -0
- package/lib/data-table-v2/hooks/index.d.ts +4 -0
- package/lib/data-table-v2/hooks/index.js +4 -0
- package/lib/data-table-v2/hooks/useTableData.d.ts +118 -0
- package/lib/data-table-v2/hooks/useTableData.js +210 -0
- package/lib/data-table-v2/index.d.ts +9 -0
- package/lib/data-table-v2/index.js +12 -0
- package/lib/data-table-v2/types/index.d.ts +296 -0
- package/lib/data-table-v2/types/index.js +1 -0
- package/lib/data-table-v2/utils/export.d.ts +26 -0
- package/lib/data-table-v2/utils/export.js +92 -0
- package/lib/data-table-v2/utils/index.d.ts +4 -0
- package/lib/data-table-v2/utils/index.js +4 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +23 -0
- package/lib/styles.css +219 -0
- package/package.json +7 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Dashboard Visuals V2 - Main exports
|
|
3
|
+
* ApexCharts-based visualization components
|
|
4
|
+
*/
|
|
5
|
+
export * from './types';
|
|
6
|
+
export { BaseChart, BarChart, LineChart, AreaChart, DonutChart, PieChart, HeatmapChart, RadialChart, MixedChart, } from './charts';
|
|
7
|
+
export { StatCard, MetricCard, InfoCard, CardGrid, StatCardGrid, MetricCardGrid, TransactionListCard, TopItemsCard, } from './cards';
|
|
8
|
+
export { default as visualRegistryV2, VisualType, getVisualComponent, isRegisteredVisual, getRegisteredVisualTypes, registerVisual, } from './visualRegistry';
|
|
9
|
+
export { DashboardWrapperV2, type DashboardWrapperV2Props } from './DashboardWrapperV2';
|
|
10
|
+
export { useChartData, useChartQueryData } from './hooks';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Dashboard Visuals V2 - Main exports
|
|
3
|
+
* ApexCharts-based visualization components
|
|
4
|
+
*/
|
|
5
|
+
// Types
|
|
6
|
+
export * from './types';
|
|
7
|
+
// Charts
|
|
8
|
+
export { BaseChart, BarChart, LineChart, AreaChart, DonutChart, PieChart, HeatmapChart, RadialChart, MixedChart, } from './charts';
|
|
9
|
+
// Cards
|
|
10
|
+
export { StatCard, MetricCard, InfoCard, CardGrid, StatCardGrid, MetricCardGrid, TransactionListCard, TopItemsCard, } from './cards';
|
|
11
|
+
// Visual Registry
|
|
12
|
+
export { default as visualRegistryV2, VisualType, getVisualComponent, isRegisteredVisual, getRegisteredVisualTypes, registerVisual, } from './visualRegistry';
|
|
13
|
+
// Dashboard Wrapper
|
|
14
|
+
export { DashboardWrapperV2 } from './DashboardWrapperV2';
|
|
15
|
+
// Hooks
|
|
16
|
+
export { useChartData, useChartQueryData } from './hooks';
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Card type definitions for Dashboard Visuals V2
|
|
3
|
+
*/
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Trend direction for metric comparisons
|
|
7
|
+
*/
|
|
8
|
+
export type TrendDirection = 'up' | 'down' | 'neutral';
|
|
9
|
+
/**
|
|
10
|
+
* Card variant styles
|
|
11
|
+
*/
|
|
12
|
+
export type CardVariant = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'gradient' | 'primary-solid' | 'success-solid' | 'warning-solid' | 'danger-solid' | 'purple-solid' | 'orange-solid';
|
|
13
|
+
/**
|
|
14
|
+
* Card size
|
|
15
|
+
*/
|
|
16
|
+
export type CardSize = 'sm' | 'md' | 'lg';
|
|
17
|
+
/**
|
|
18
|
+
* Card color presets
|
|
19
|
+
*/
|
|
20
|
+
export type CardColor = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'orange' | 'teal' | 'blue' | 'purple';
|
|
21
|
+
/**
|
|
22
|
+
* Card action configuration
|
|
23
|
+
*/
|
|
24
|
+
export interface CardAction {
|
|
25
|
+
/** Action label */
|
|
26
|
+
label: string;
|
|
27
|
+
/** Click handler */
|
|
28
|
+
onClick?: () => void;
|
|
29
|
+
/** Link href (alternative to onClick) */
|
|
30
|
+
href?: string;
|
|
31
|
+
/** Icon element */
|
|
32
|
+
icon?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Base card props shared by all card types
|
|
36
|
+
*/
|
|
37
|
+
export interface BaseCardProps {
|
|
38
|
+
/** Card title/label */
|
|
39
|
+
title: string;
|
|
40
|
+
/** Custom class name */
|
|
41
|
+
className?: string;
|
|
42
|
+
/** Class names for sub-components */
|
|
43
|
+
classNames?: {
|
|
44
|
+
container?: string;
|
|
45
|
+
header?: string;
|
|
46
|
+
title?: string;
|
|
47
|
+
value?: string;
|
|
48
|
+
icon?: string;
|
|
49
|
+
trend?: string;
|
|
50
|
+
footer?: string;
|
|
51
|
+
list?: string;
|
|
52
|
+
item?: string;
|
|
53
|
+
};
|
|
54
|
+
/** Loading state */
|
|
55
|
+
loading?: boolean;
|
|
56
|
+
/** Error state */
|
|
57
|
+
error?: Error | string | null;
|
|
58
|
+
/** Icon element */
|
|
59
|
+
icon?: ReactNode;
|
|
60
|
+
/** Click handler for the entire card */
|
|
61
|
+
onClick?: () => void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Value format options
|
|
65
|
+
*/
|
|
66
|
+
export type ValueFormat = 'number' | 'currency' | 'percentage' | 'compact' | 'decimal';
|
|
67
|
+
/**
|
|
68
|
+
* Stat card props - Main metric display card
|
|
69
|
+
*/
|
|
70
|
+
export interface StatCardProps extends BaseCardProps {
|
|
71
|
+
/** Numeric value to display */
|
|
72
|
+
value: number | string;
|
|
73
|
+
/** Value format type */
|
|
74
|
+
format?: ValueFormat;
|
|
75
|
+
/** Currency code (for currency format) */
|
|
76
|
+
currency?: string;
|
|
77
|
+
/** Decimal places */
|
|
78
|
+
decimals?: number;
|
|
79
|
+
/** Custom value formatter */
|
|
80
|
+
valueFormatter?: (value: number | string) => string;
|
|
81
|
+
/** Trend direction */
|
|
82
|
+
trend?: TrendDirection;
|
|
83
|
+
/** Trend value (e.g., "+12%") */
|
|
84
|
+
trendValue?: string;
|
|
85
|
+
/** Trend label (e.g., "vs last month") */
|
|
86
|
+
trendLabel?: string;
|
|
87
|
+
/** Description text */
|
|
88
|
+
description?: string;
|
|
89
|
+
/** Card variant */
|
|
90
|
+
variant?: CardVariant;
|
|
91
|
+
/** Card size */
|
|
92
|
+
size?: CardSize;
|
|
93
|
+
/** Card color (for filled/gradient variants) */
|
|
94
|
+
color?: CardColor | string;
|
|
95
|
+
/** Subtitle text */
|
|
96
|
+
subtitle?: string;
|
|
97
|
+
/** Footer action */
|
|
98
|
+
action?: CardAction;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Metric card props - With comparison and detailed info
|
|
102
|
+
*/
|
|
103
|
+
export interface MetricCardProps extends BaseCardProps {
|
|
104
|
+
/** Primary value */
|
|
105
|
+
value: number | string;
|
|
106
|
+
/** Value format type */
|
|
107
|
+
format?: ValueFormat;
|
|
108
|
+
/** Currency code */
|
|
109
|
+
currency?: string;
|
|
110
|
+
/** Trend direction */
|
|
111
|
+
trend?: TrendDirection;
|
|
112
|
+
/** Trend value */
|
|
113
|
+
trendValue?: string;
|
|
114
|
+
/** Trend label */
|
|
115
|
+
trendLabel?: string;
|
|
116
|
+
/** Sparkline data */
|
|
117
|
+
sparklineData?: number[];
|
|
118
|
+
/** Sparkline color */
|
|
119
|
+
sparklineColor?: string;
|
|
120
|
+
/** Subtitle */
|
|
121
|
+
subtitle?: string;
|
|
122
|
+
/** Footer action */
|
|
123
|
+
action?: ReactNode;
|
|
124
|
+
/** Secondary metrics */
|
|
125
|
+
secondaryMetrics?: Array<{
|
|
126
|
+
label: string;
|
|
127
|
+
value: number | string;
|
|
128
|
+
format?: ValueFormat;
|
|
129
|
+
}>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Info card props - Simple icon + value display
|
|
133
|
+
*/
|
|
134
|
+
export interface InfoCardProps extends BaseCardProps {
|
|
135
|
+
/** Value to display */
|
|
136
|
+
value?: number | string;
|
|
137
|
+
/** Value format type */
|
|
138
|
+
format?: ValueFormat;
|
|
139
|
+
/** Description text */
|
|
140
|
+
description?: string;
|
|
141
|
+
/** Card color */
|
|
142
|
+
color?: CardColor | string;
|
|
143
|
+
/** Icon background style */
|
|
144
|
+
iconBackground?: 'filled' | 'light' | 'none';
|
|
145
|
+
/** Badge text */
|
|
146
|
+
badge?: string;
|
|
147
|
+
/** Badge variant */
|
|
148
|
+
badgeVariant?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
|
|
149
|
+
/** Footer content */
|
|
150
|
+
footer?: ReactNode;
|
|
151
|
+
/** Children content */
|
|
152
|
+
children?: ReactNode;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Card grid props - Layout helper for cards
|
|
156
|
+
*/
|
|
157
|
+
export interface CardGridProps {
|
|
158
|
+
/** Children cards */
|
|
159
|
+
children: ReactNode;
|
|
160
|
+
/** Number of columns (responsive) */
|
|
161
|
+
columns?: {
|
|
162
|
+
default?: number;
|
|
163
|
+
sm?: number;
|
|
164
|
+
md?: number;
|
|
165
|
+
lg?: number;
|
|
166
|
+
xl?: number;
|
|
167
|
+
};
|
|
168
|
+
/** Gap between cards */
|
|
169
|
+
gap?: 'sm' | 'md' | 'lg' | number;
|
|
170
|
+
/** Custom class name */
|
|
171
|
+
className?: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Transaction list item for TransactionCard
|
|
175
|
+
*/
|
|
176
|
+
export interface TransactionItem {
|
|
177
|
+
id: string | number;
|
|
178
|
+
date: string | Date;
|
|
179
|
+
customer: {
|
|
180
|
+
name: string;
|
|
181
|
+
id?: string;
|
|
182
|
+
avatar?: string;
|
|
183
|
+
};
|
|
184
|
+
status: 'completed' | 'pending' | 'draft' | 'failed' | string;
|
|
185
|
+
amount: number;
|
|
186
|
+
currency?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Transaction list card props
|
|
190
|
+
*/
|
|
191
|
+
export interface TransactionListCardProps<TItem = Record<string, unknown>> extends Omit<BaseCardProps, 'value'> {
|
|
192
|
+
/** Items to display */
|
|
193
|
+
items: TItem[];
|
|
194
|
+
/** Render function for each item */
|
|
195
|
+
renderItem: (item: TItem, index: number) => ReactNode;
|
|
196
|
+
/** Key extractor */
|
|
197
|
+
keyExtractor?: (item: TItem, index: number) => string;
|
|
198
|
+
/** Max items to show */
|
|
199
|
+
maxItems?: number;
|
|
200
|
+
/** Empty message */
|
|
201
|
+
emptyMessage?: string;
|
|
202
|
+
/** View all label */
|
|
203
|
+
viewAllLabel?: string;
|
|
204
|
+
/** View all action */
|
|
205
|
+
onViewAll?: () => void;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Top items card props (e.g., Top Customers, Top Products)
|
|
209
|
+
*/
|
|
210
|
+
export interface TopItemsCardProps<TItem = Record<string, unknown>> extends Omit<BaseCardProps, 'value'> {
|
|
211
|
+
/** Items to display */
|
|
212
|
+
items: TItem[];
|
|
213
|
+
/** Key for label field */
|
|
214
|
+
labelKey: keyof TItem;
|
|
215
|
+
/** Key for value field */
|
|
216
|
+
valueKey: keyof TItem;
|
|
217
|
+
/** Custom label renderer */
|
|
218
|
+
renderLabel?: (item: TItem, index: number) => ReactNode;
|
|
219
|
+
/** Custom value renderer */
|
|
220
|
+
renderValue?: (item: TItem, index: number) => ReactNode;
|
|
221
|
+
/** Show rank numbers */
|
|
222
|
+
showRank?: boolean;
|
|
223
|
+
/** Show progress bar */
|
|
224
|
+
showProgress?: boolean;
|
|
225
|
+
/** Progress bar color */
|
|
226
|
+
progressColor?: string;
|
|
227
|
+
/** Max items to show */
|
|
228
|
+
maxItems?: number;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Default card colors mapping
|
|
232
|
+
*/
|
|
233
|
+
export declare const CARD_COLOR_MAP: Record<CardColor, string>;
|
|
234
|
+
/**
|
|
235
|
+
* Default gradient colors for filled variant
|
|
236
|
+
*/
|
|
237
|
+
export declare const CARD_GRADIENT_MAP: Record<CardColor, string>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default card colors mapping
|
|
3
|
+
*/
|
|
4
|
+
export const CARD_COLOR_MAP = {
|
|
5
|
+
primary: '#3B82F6',
|
|
6
|
+
secondary: '#6B7280',
|
|
7
|
+
success: '#10B981',
|
|
8
|
+
warning: '#F59E0B',
|
|
9
|
+
danger: '#EF4444',
|
|
10
|
+
info: '#06B6D4',
|
|
11
|
+
orange: '#FF6B35',
|
|
12
|
+
teal: '#00C49A',
|
|
13
|
+
blue: '#1E88E5',
|
|
14
|
+
purple: '#8B5CF6',
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Default gradient colors for filled variant
|
|
18
|
+
*/
|
|
19
|
+
export const CARD_GRADIENT_MAP = {
|
|
20
|
+
primary: 'from-blue-500 to-blue-600',
|
|
21
|
+
secondary: 'from-gray-500 to-gray-600',
|
|
22
|
+
success: 'from-emerald-500 to-emerald-600',
|
|
23
|
+
warning: 'from-amber-500 to-amber-600',
|
|
24
|
+
danger: 'from-red-500 to-red-600',
|
|
25
|
+
info: 'from-cyan-500 to-cyan-600',
|
|
26
|
+
orange: 'from-orange-500 to-orange-600',
|
|
27
|
+
teal: 'from-teal-500 to-teal-600',
|
|
28
|
+
blue: 'from-blue-600 to-blue-700',
|
|
29
|
+
purple: 'from-purple-500 to-purple-600',
|
|
30
|
+
};
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Chart type definitions for Dashboard Visuals V2
|
|
3
|
+
*/
|
|
4
|
+
import type { ApexOptions } from 'apexcharts';
|
|
5
|
+
import type { ReactNode } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* Base data point structure for charts
|
|
8
|
+
*/
|
|
9
|
+
export interface ChartDataPoint {
|
|
10
|
+
[key: string]: string | number | boolean | null | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Series data for multi-series charts
|
|
14
|
+
*/
|
|
15
|
+
export interface ChartSeries {
|
|
16
|
+
name: string;
|
|
17
|
+
data: number[];
|
|
18
|
+
type?: 'bar' | 'line' | 'area' | 'scatter';
|
|
19
|
+
color?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Common chart styling options
|
|
23
|
+
*/
|
|
24
|
+
export interface ChartStyleOptions {
|
|
25
|
+
/** Chart height in pixels or percentage */
|
|
26
|
+
height?: number | string;
|
|
27
|
+
/** Chart width in pixels or percentage */
|
|
28
|
+
width?: number | string;
|
|
29
|
+
/** Color palette for the chart */
|
|
30
|
+
colors?: string[];
|
|
31
|
+
/** Show/hide chart toolbar */
|
|
32
|
+
showToolbar?: boolean;
|
|
33
|
+
/** Show/hide legend */
|
|
34
|
+
showLegend?: boolean;
|
|
35
|
+
/** Legend position */
|
|
36
|
+
legendPosition?: 'top' | 'right' | 'bottom' | 'left';
|
|
37
|
+
/** Show/hide data labels */
|
|
38
|
+
showDataLabels?: boolean;
|
|
39
|
+
/** Animation duration in ms */
|
|
40
|
+
animationDuration?: number;
|
|
41
|
+
/** Disable animations */
|
|
42
|
+
disableAnimations?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Chart tooltip configuration
|
|
46
|
+
*/
|
|
47
|
+
export interface ChartTooltipConfig {
|
|
48
|
+
/** Enable/disable tooltip */
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
/** Shared tooltip for multi-series */
|
|
51
|
+
shared?: boolean;
|
|
52
|
+
/** Tooltip title */
|
|
53
|
+
title?: string;
|
|
54
|
+
/** Value formatter function */
|
|
55
|
+
valueFormatter?: (value: number) => string;
|
|
56
|
+
/** Custom tooltip renderer */
|
|
57
|
+
customTooltip?: (options: {
|
|
58
|
+
series: number[];
|
|
59
|
+
dataPointIndex: number;
|
|
60
|
+
w: unknown;
|
|
61
|
+
}) => string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Chart axis configuration
|
|
65
|
+
*/
|
|
66
|
+
export interface ChartAxisConfig {
|
|
67
|
+
/** Axis title */
|
|
68
|
+
title?: string;
|
|
69
|
+
/** Show/hide axis */
|
|
70
|
+
show?: boolean;
|
|
71
|
+
/** Axis label formatter */
|
|
72
|
+
formatter?: (value: string | number) => string;
|
|
73
|
+
/** Minimum value */
|
|
74
|
+
min?: number;
|
|
75
|
+
/** Maximum value */
|
|
76
|
+
max?: number;
|
|
77
|
+
/** Tick amount */
|
|
78
|
+
tickAmount?: number;
|
|
79
|
+
/** Axis type */
|
|
80
|
+
type?: 'category' | 'datetime' | 'numeric';
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Base props for all chart components
|
|
84
|
+
*/
|
|
85
|
+
export interface BaseChartProps<TData = ChartDataPoint> {
|
|
86
|
+
/** Chart data array */
|
|
87
|
+
data?: TData[];
|
|
88
|
+
/** Series data for multi-series charts */
|
|
89
|
+
series?: ChartSeries[];
|
|
90
|
+
/** Categories/labels for x-axis */
|
|
91
|
+
categories?: string[];
|
|
92
|
+
/** Chart title */
|
|
93
|
+
title?: string;
|
|
94
|
+
/** Chart subtitle */
|
|
95
|
+
subtitle?: string;
|
|
96
|
+
/** Loading state */
|
|
97
|
+
loading?: boolean;
|
|
98
|
+
/** Error message */
|
|
99
|
+
error?: string | null;
|
|
100
|
+
/** Empty state message */
|
|
101
|
+
emptyMessage?: string;
|
|
102
|
+
/** Styling options */
|
|
103
|
+
style?: ChartStyleOptions;
|
|
104
|
+
/** Tooltip configuration */
|
|
105
|
+
tooltip?: ChartTooltipConfig;
|
|
106
|
+
/** X-axis configuration */
|
|
107
|
+
xAxis?: ChartAxisConfig;
|
|
108
|
+
/** Y-axis configuration */
|
|
109
|
+
yAxis?: ChartAxisConfig;
|
|
110
|
+
/** Custom ApexCharts options (for full control) */
|
|
111
|
+
apexOptions?: ApexOptions;
|
|
112
|
+
/** Custom class name */
|
|
113
|
+
className?: string;
|
|
114
|
+
/** Class names for sub-components */
|
|
115
|
+
classNames?: {
|
|
116
|
+
container?: string;
|
|
117
|
+
header?: string;
|
|
118
|
+
title?: string;
|
|
119
|
+
subtitle?: string;
|
|
120
|
+
chart?: string;
|
|
121
|
+
loading?: string;
|
|
122
|
+
error?: string;
|
|
123
|
+
empty?: string;
|
|
124
|
+
};
|
|
125
|
+
/** Header action element (e.g., dropdown, button) */
|
|
126
|
+
headerAction?: ReactNode;
|
|
127
|
+
/** Click handler for data points */
|
|
128
|
+
onDataPointClick?: (dataPointIndex: number, seriesIndex: number, data: TData | undefined) => void;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Bar chart specific props
|
|
132
|
+
*/
|
|
133
|
+
export interface BarChartProps<TData = ChartDataPoint> extends BaseChartProps<TData> {
|
|
134
|
+
/** Data key for x-axis values */
|
|
135
|
+
xKey?: keyof TData;
|
|
136
|
+
/** Data key for y-axis values (single series) */
|
|
137
|
+
yKey?: keyof TData;
|
|
138
|
+
/** Data keys for multiple series */
|
|
139
|
+
yKeys?: (keyof TData)[];
|
|
140
|
+
/** Series names for legend */
|
|
141
|
+
seriesNames?: string[];
|
|
142
|
+
/** Horizontal bar chart */
|
|
143
|
+
horizontal?: boolean;
|
|
144
|
+
/** Stacked bar chart */
|
|
145
|
+
stacked?: boolean;
|
|
146
|
+
/** Bar border radius */
|
|
147
|
+
borderRadius?: number;
|
|
148
|
+
/** Column width percentage */
|
|
149
|
+
columnWidth?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Line chart specific props
|
|
153
|
+
*/
|
|
154
|
+
export interface LineChartProps<TData = ChartDataPoint> extends BaseChartProps<TData> {
|
|
155
|
+
/** Data key for x-axis values */
|
|
156
|
+
xKey?: keyof TData;
|
|
157
|
+
/** Data key for y-axis values (single series) */
|
|
158
|
+
yKey?: keyof TData;
|
|
159
|
+
/** Data keys for multiple series */
|
|
160
|
+
yKeys?: (keyof TData)[];
|
|
161
|
+
/** Series names for legend */
|
|
162
|
+
seriesNames?: string[];
|
|
163
|
+
/** Curve type */
|
|
164
|
+
curve?: 'smooth' | 'straight' | 'stepline';
|
|
165
|
+
/** Line stroke width */
|
|
166
|
+
strokeWidth?: number;
|
|
167
|
+
/** Show markers on data points */
|
|
168
|
+
showMarkers?: boolean;
|
|
169
|
+
/** Marker size */
|
|
170
|
+
markerSize?: number;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Area chart specific props
|
|
174
|
+
*/
|
|
175
|
+
export interface AreaChartProps<TData = ChartDataPoint> extends LineChartProps<TData> {
|
|
176
|
+
/** Fill opacity */
|
|
177
|
+
fillOpacity?: number;
|
|
178
|
+
/** Gradient fill */
|
|
179
|
+
gradient?: boolean;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Donut/Pie chart specific props
|
|
183
|
+
*/
|
|
184
|
+
export interface DonutChartProps<TData = ChartDataPoint> extends BaseChartProps<TData> {
|
|
185
|
+
/** Data key for label */
|
|
186
|
+
labelKey?: keyof TData;
|
|
187
|
+
/** Data key for value */
|
|
188
|
+
valueKey?: keyof TData;
|
|
189
|
+
/** Labels array (alternative to labelKey) */
|
|
190
|
+
labels?: string[];
|
|
191
|
+
/** Values array (alternative to data + valueKey) */
|
|
192
|
+
values?: number[];
|
|
193
|
+
/** Donut hole size (0 for pie chart) */
|
|
194
|
+
donutSize?: string;
|
|
195
|
+
/** Show total in center (donut only) */
|
|
196
|
+
showTotal?: boolean;
|
|
197
|
+
/** Total label */
|
|
198
|
+
totalLabel?: string;
|
|
199
|
+
/** Total value formatter */
|
|
200
|
+
totalFormatter?: (total: number) => string;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Pie chart props (alias for DonutChartProps with donutSize: '0%')
|
|
204
|
+
*/
|
|
205
|
+
export type PieChartProps<TData = ChartDataPoint> = DonutChartProps<TData>;
|
|
206
|
+
/**
|
|
207
|
+
* Heatmap chart specific props
|
|
208
|
+
*/
|
|
209
|
+
export interface HeatmapChartProps<TData = ChartDataPoint> extends BaseChartProps<TData> {
|
|
210
|
+
/** Data key for x-axis */
|
|
211
|
+
xKey?: keyof TData;
|
|
212
|
+
/** Data key for y-axis */
|
|
213
|
+
yKey?: keyof TData;
|
|
214
|
+
/** Data key for value */
|
|
215
|
+
valueKey?: keyof TData;
|
|
216
|
+
/** Color scale range [min, max] */
|
|
217
|
+
colorScale?: {
|
|
218
|
+
ranges: Array<{
|
|
219
|
+
from: number;
|
|
220
|
+
to: number;
|
|
221
|
+
color: string;
|
|
222
|
+
name?: string;
|
|
223
|
+
}>;
|
|
224
|
+
};
|
|
225
|
+
/** Show value in cell */
|
|
226
|
+
showValue?: boolean;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Radial/Gauge chart specific props
|
|
230
|
+
*/
|
|
231
|
+
export interface RadialChartProps extends Omit<BaseChartProps, 'data' | 'series'> {
|
|
232
|
+
/** Values (0-100) */
|
|
233
|
+
values: number[];
|
|
234
|
+
/** Labels for each value */
|
|
235
|
+
labels: string[];
|
|
236
|
+
/** Show value inside */
|
|
237
|
+
showValue?: boolean;
|
|
238
|
+
/** Value formatter */
|
|
239
|
+
valueFormatter?: (value: number) => string;
|
|
240
|
+
/** Track background color */
|
|
241
|
+
trackBackground?: string;
|
|
242
|
+
/** Hollow size percentage */
|
|
243
|
+
hollowSize?: string;
|
|
244
|
+
/** Start angle */
|
|
245
|
+
startAngle?: number;
|
|
246
|
+
/** End angle */
|
|
247
|
+
endAngle?: number;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Mixed chart specific props
|
|
251
|
+
*/
|
|
252
|
+
export interface MixedChartProps<TData = ChartDataPoint> extends BaseChartProps<TData> {
|
|
253
|
+
/** Data key for x-axis values */
|
|
254
|
+
xKey?: keyof TData;
|
|
255
|
+
/** Series configuration with type for each */
|
|
256
|
+
seriesConfig: Array<{
|
|
257
|
+
name: string;
|
|
258
|
+
dataKey: keyof TData;
|
|
259
|
+
type: 'bar' | 'line' | 'area';
|
|
260
|
+
color?: string;
|
|
261
|
+
}>;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Chart query props for data fetching integration with TanStack Query
|
|
265
|
+
*/
|
|
266
|
+
export interface ChartQueryProps {
|
|
267
|
+
/** API endpoint URL */
|
|
268
|
+
url?: string;
|
|
269
|
+
/** HTTP method */
|
|
270
|
+
method?: 'GET' | 'POST';
|
|
271
|
+
/** Request body for POST */
|
|
272
|
+
body?: Record<string, unknown>;
|
|
273
|
+
/** Query parameters */
|
|
274
|
+
params?: Record<string, string>;
|
|
275
|
+
/** Transform response data */
|
|
276
|
+
transform?: (data: unknown) => unknown[];
|
|
277
|
+
/** Enable query */
|
|
278
|
+
enabled?: boolean;
|
|
279
|
+
/** Query key for TanStack Query cache management */
|
|
280
|
+
queryKey?: unknown[];
|
|
281
|
+
/** Stale time in ms (how long data is considered fresh) */
|
|
282
|
+
staleTime?: number;
|
|
283
|
+
/** Garbage collection time in ms */
|
|
284
|
+
gcTime?: number;
|
|
285
|
+
/** Refetch interval in ms (0 = disabled) */
|
|
286
|
+
refetchInterval?: number;
|
|
287
|
+
/** Refetch on window focus */
|
|
288
|
+
refetchOnWindowFocus?: boolean;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Chart with data fetching props
|
|
292
|
+
*/
|
|
293
|
+
export interface ChartWithQueryProps<TData = ChartDataPoint, TChartProps = BaseChartProps<TData>> extends ChartQueryProps {
|
|
294
|
+
/** Chart component props (excluding data) */
|
|
295
|
+
chartProps: Omit<TChartProps, 'data' | 'loading' | 'error'>;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Visual registry component type
|
|
299
|
+
*/
|
|
300
|
+
export type ChartComponentType = 'BarChart' | 'LineChart' | 'AreaChart' | 'DonutChart' | 'PieChart' | 'HeatmapChart' | 'RadialChart' | 'MixedChart';
|
|
301
|
+
/**
|
|
302
|
+
* Default chart colors palette
|
|
303
|
+
*/
|
|
304
|
+
export declare const DEFAULT_CHART_COLORS: string[];
|
|
305
|
+
/**
|
|
306
|
+
* Default chart style options
|
|
307
|
+
*/
|
|
308
|
+
export declare const DEFAULT_CHART_STYLE: ChartStyleOptions;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default chart colors palette
|
|
3
|
+
*/
|
|
4
|
+
export const DEFAULT_CHART_COLORS = [
|
|
5
|
+
'#FF6B35', // Orange
|
|
6
|
+
'#00C49A', // Teal
|
|
7
|
+
'#3B82F6', // Blue
|
|
8
|
+
'#F59E0B', // Amber
|
|
9
|
+
'#8B5CF6', // Purple
|
|
10
|
+
'#EC4899', // Pink
|
|
11
|
+
'#10B981', // Emerald
|
|
12
|
+
'#6366F1', // Indigo
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* Default chart style options
|
|
16
|
+
*/
|
|
17
|
+
export const DEFAULT_CHART_STYLE = {
|
|
18
|
+
height: 350,
|
|
19
|
+
showToolbar: false,
|
|
20
|
+
showLegend: true,
|
|
21
|
+
legendPosition: 'top',
|
|
22
|
+
showDataLabels: false,
|
|
23
|
+
animationDuration: 800,
|
|
24
|
+
disableAnimations: false,
|
|
25
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|