@open-mercato/core 0.6.7-develop.6785.1.1dd7cfac55 → 0.6.7-develop.6795.1.8a3f27921c
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/.turbo/turbo-build.log +1 -1
- package/dist/generated/entities.ids.generated.js +1 -0
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/modules/auth/backend/settings/page.js +14 -9
- package/dist/modules/auth/backend/settings/page.js.map +2 -2
- package/dist/modules/customers/cli.js +17 -7
- package/dist/modules/customers/cli.js.map +2 -2
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js +229 -216
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js.map +2 -2
- package/dist/modules/customers/search.js +50 -29
- package/dist/modules/customers/search.js.map +2 -2
- package/dist/modules/data_sync/api/mappings/[id]/route.js +22 -9
- package/dist/modules/data_sync/api/mappings/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/mappings/route.js +13 -4
- package/dist/modules/data_sync/api/mappings/route.js.map +2 -2
- package/dist/modules/data_sync/api/options.js +7 -2
- package/dist/modules/data_sync/api/options.js.map +2 -2
- package/dist/modules/data_sync/api/run.js +7 -2
- package/dist/modules/data_sync/api/run.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/cancel.js +8 -3
- package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/retry.js +7 -2
- package/dist/modules/data_sync/api/runs/[id]/retry.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/route.js +8 -3
- package/dist/modules/data_sync/api/runs/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/runs.js +7 -2
- package/dist/modules/data_sync/api/runs.js.map +2 -2
- package/dist/modules/data_sync/api/schedules/[id]/route.js +19 -6
- package/dist/modules/data_sync/api/schedules/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/schedules/route.js +13 -4
- package/dist/modules/data_sync/api/schedules/route.js.map +2 -2
- package/dist/modules/data_sync/api/validate.js +9 -4
- package/dist/modules/data_sync/api/validate.js.map +2 -2
- package/dist/modules/design_system/acl.js +9 -0
- package/dist/modules/design_system/acl.js.map +7 -0
- package/dist/modules/design_system/backend/design-system/page.js +11 -0
- package/dist/modules/design_system/backend/design-system/page.js.map +7 -0
- package/dist/modules/design_system/backend/design-system/page.meta.js +15 -0
- package/dist/modules/design_system/backend/design-system/page.meta.js.map +7 -0
- package/dist/modules/design_system/gallery/components/CodeSnippet.js +52 -0
- package/dist/modules/design_system/gallery/components/CodeSnippet.js.map +7 -0
- package/dist/modules/design_system/gallery/components/EntryCard.js +63 -0
- package/dist/modules/design_system/gallery/components/EntryCard.js.map +7 -0
- package/dist/modules/design_system/gallery/components/GalleryShell.js +163 -0
- package/dist/modules/design_system/gallery/components/GalleryShell.js.map +7 -0
- package/dist/modules/design_system/gallery/components/VariantPreview.js +9 -0
- package/dist/modules/design_system/gallery/components/VariantPreview.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/banners.js +186 -0
- package/dist/modules/design_system/gallery/entries/banners.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/buttons.js +361 -0
- package/dist/modules/design_system/gallery/entries/buttons.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/charts.js +457 -0
- package/dist/modules/design_system/gallery/entries/charts.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/dates.js +306 -0
- package/dist/modules/design_system/gallery/entries/dates.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/detail.js +358 -0
- package/dist/modules/design_system/gallery/entries/detail.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/display.js +785 -0
- package/dist/modules/design_system/gallery/entries/display.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/feedback.js +658 -0
- package/dist/modules/design_system/gallery/entries/feedback.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/filters.js +505 -0
- package/dist/modules/design_system/gallery/entries/filters.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/foundations.js +453 -0
- package/dist/modules/design_system/gallery/entries/foundations.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/icons.js +140 -0
- package/dist/modules/design_system/gallery/entries/icons.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/inputs.js +1217 -0
- package/dist/modules/design_system/gallery/entries/inputs.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/messages.js +334 -0
- package/dist/modules/design_system/gallery/entries/messages.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/navigation.js +475 -0
- package/dist/modules/design_system/gallery/entries/navigation.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/notifications.js +257 -0
- package/dist/modules/design_system/gallery/entries/notifications.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/overlays.js +576 -0
- package/dist/modules/design_system/gallery/entries/overlays.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/scaffolding.js +378 -0
- package/dist/modules/design_system/gallery/entries/scaffolding.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/schedule.js +297 -0
- package/dist/modules/design_system/gallery/entries/schedule.js.map +7 -0
- package/dist/modules/design_system/gallery/registry.js +139 -0
- package/dist/modules/design_system/gallery/registry.js.map +7 -0
- package/dist/modules/design_system/gallery/types.js +1 -0
- package/dist/modules/design_system/gallery/types.js.map +7 -0
- package/dist/modules/design_system/index.js +9 -0
- package/dist/modules/design_system/index.js.map +7 -0
- package/dist/modules/design_system/setup.js +14 -0
- package/dist/modules/design_system/setup.js.map +7 -0
- package/dist/modules/inbox_ops/search.js +15 -4
- package/dist/modules/inbox_ops/search.js.map +2 -2
- package/dist/modules/integrations/api/[id]/credentials/route.js +11 -5
- package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/health/route.js +6 -3
- package/dist/modules/integrations/api/[id]/health/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/route.js +6 -3
- package/dist/modules/integrations/api/[id]/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/state/route.js +6 -3
- package/dist/modules/integrations/api/[id]/state/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/version/route.js +6 -3
- package/dist/modules/integrations/api/[id]/version/route.js.map +2 -2
- package/dist/modules/integrations/api/logs/route.js +6 -3
- package/dist/modules/integrations/api/logs/route.js.map +2 -2
- package/dist/modules/integrations/api/route.js +6 -3
- package/dist/modules/integrations/api/route.js.map +2 -2
- package/dist/modules/integrations/api/umes-read.js +2 -2
- package/dist/modules/integrations/api/umes-read.js.map +2 -2
- package/dist/modules/integrations/lib/organization-scope.js +2 -9
- package/dist/modules/integrations/lib/organization-scope.js.map +2 -2
- package/dist/modules/messages/search.js +10 -5
- package/dist/modules/messages/search.js.map +2 -2
- package/dist/modules/query_index/data/entities.js +2 -1
- package/dist/modules/query_index/data/entities.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +32 -50
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js +17 -0
- package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js.map +7 -0
- package/generated/entities.ids.generated.ts +1 -0
- package/package.json +16 -16
- package/src/modules/auth/backend/settings/page.tsx +17 -8
- package/src/modules/customers/cli.ts +17 -7
- package/src/modules/customers/components/detail/ScheduleActivityDialog.tsx +24 -13
- package/src/modules/customers/i18n/de.json +17 -0
- package/src/modules/customers/i18n/en.json +17 -0
- package/src/modules/customers/i18n/es.json +17 -0
- package/src/modules/customers/i18n/pl.json +17 -0
- package/src/modules/customers/search.ts +59 -27
- package/src/modules/data_sync/AGENTS.md +1 -0
- package/src/modules/data_sync/api/mappings/[id]/route.ts +22 -9
- package/src/modules/data_sync/api/mappings/route.ts +13 -4
- package/src/modules/data_sync/api/options.ts +7 -2
- package/src/modules/data_sync/api/run.ts +7 -2
- package/src/modules/data_sync/api/runs/[id]/cancel.ts +8 -3
- package/src/modules/data_sync/api/runs/[id]/retry.ts +7 -2
- package/src/modules/data_sync/api/runs/[id]/route.ts +8 -3
- package/src/modules/data_sync/api/runs.ts +7 -2
- package/src/modules/data_sync/api/schedules/[id]/route.ts +19 -6
- package/src/modules/data_sync/api/schedules/route.ts +13 -4
- package/src/modules/data_sync/api/validate.ts +9 -4
- package/src/modules/design_system/AGENTS.md +34 -0
- package/src/modules/design_system/acl.ts +5 -0
- package/src/modules/design_system/backend/design-system/page.meta.ts +11 -0
- package/src/modules/design_system/backend/design-system/page.tsx +14 -0
- package/src/modules/design_system/gallery/components/CodeSnippet.tsx +55 -0
- package/src/modules/design_system/gallery/components/EntryCard.tsx +95 -0
- package/src/modules/design_system/gallery/components/GalleryShell.tsx +206 -0
- package/src/modules/design_system/gallery/components/VariantPreview.tsx +15 -0
- package/src/modules/design_system/gallery/entries/banners.tsx +226 -0
- package/src/modules/design_system/gallery/entries/buttons.tsx +422 -0
- package/src/modules/design_system/gallery/entries/charts.tsx +518 -0
- package/src/modules/design_system/gallery/entries/dates.tsx +325 -0
- package/src/modules/design_system/gallery/entries/detail.tsx +403 -0
- package/src/modules/design_system/gallery/entries/display.tsx +893 -0
- package/src/modules/design_system/gallery/entries/feedback.tsx +746 -0
- package/src/modules/design_system/gallery/entries/filters.tsx +570 -0
- package/src/modules/design_system/gallery/entries/foundations.tsx +529 -0
- package/src/modules/design_system/gallery/entries/icons.tsx +168 -0
- package/src/modules/design_system/gallery/entries/inputs.tsx +1516 -0
- package/src/modules/design_system/gallery/entries/messages.tsx +339 -0
- package/src/modules/design_system/gallery/entries/navigation.tsx +573 -0
- package/src/modules/design_system/gallery/entries/notifications.tsx +285 -0
- package/src/modules/design_system/gallery/entries/overlays.tsx +677 -0
- package/src/modules/design_system/gallery/entries/scaffolding.tsx +430 -0
- package/src/modules/design_system/gallery/entries/schedule.tsx +307 -0
- package/src/modules/design_system/gallery/registry.ts +152 -0
- package/src/modules/design_system/gallery/types.ts +32 -0
- package/src/modules/design_system/i18n/.hardcoded-allowlist.json +71 -0
- package/src/modules/design_system/i18n/de.json +46 -0
- package/src/modules/design_system/i18n/en.json +46 -0
- package/src/modules/design_system/i18n/es.json +46 -0
- package/src/modules/design_system/i18n/pl.json +46 -0
- package/src/modules/design_system/index.ts +7 -0
- package/src/modules/design_system/setup.ts +12 -0
- package/src/modules/inbox_ops/i18n/de.json +3 -0
- package/src/modules/inbox_ops/i18n/en.json +3 -0
- package/src/modules/inbox_ops/i18n/es.json +3 -0
- package/src/modules/inbox_ops/i18n/pl.json +3 -0
- package/src/modules/inbox_ops/search.ts +20 -4
- package/src/modules/integrations/api/[id]/credentials/route.ts +11 -5
- package/src/modules/integrations/api/[id]/health/route.ts +6 -3
- package/src/modules/integrations/api/[id]/route.ts +6 -3
- package/src/modules/integrations/api/[id]/state/route.ts +6 -3
- package/src/modules/integrations/api/[id]/version/route.ts +6 -3
- package/src/modules/integrations/api/logs/route.ts +6 -3
- package/src/modules/integrations/api/route.ts +6 -3
- package/src/modules/integrations/api/umes-read.ts +2 -2
- package/src/modules/integrations/lib/organization-scope.ts +5 -25
- package/src/modules/messages/i18n/de.json +2 -0
- package/src/modules/messages/i18n/en.json +2 -0
- package/src/modules/messages/i18n/es.json +2 -0
- package/src/modules/messages/i18n/pl.json +2 -0
- package/src/modules/messages/search.ts +11 -5
- package/src/modules/query_index/data/entities.ts +7 -0
- package/src/modules/query_index/lib/engine.ts +40 -63
- package/src/modules/query_index/migrations/.snapshot-open-mercato.json +12 -0
- package/src/modules/query_index/migrations/Migration20260731105052_query_index.ts +35 -0
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
BarChart,
|
|
4
|
+
DeltaBadge,
|
|
5
|
+
KpiCard,
|
|
6
|
+
LineChart,
|
|
7
|
+
PieChart,
|
|
8
|
+
Sparkline,
|
|
9
|
+
TopNTable,
|
|
10
|
+
type TopNTableColumn,
|
|
11
|
+
} from '@open-mercato/ui/backend/charts'
|
|
12
|
+
import type { GalleryEntry } from '../types'
|
|
13
|
+
|
|
14
|
+
// Component titles and variant names are proper nouns from the codebase and
|
|
15
|
+
// are deliberately not translated. `code` MUST contain the entry's importPath
|
|
16
|
+
// (enforced by the registry-integrity test) and is always reviewed alongside
|
|
17
|
+
// its sibling `render`.
|
|
18
|
+
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Inline mock datasets — realistic dashboard shapes, no API calls. All charts
|
|
21
|
+
// pick up the DS palette (`--chart-1`…`--chart-5`) natively; no color props.
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
const revenueByMonth = [
|
|
25
|
+
{ month: 'Jan', revenue: 48200 },
|
|
26
|
+
{ month: 'Feb', revenue: 51400 },
|
|
27
|
+
{ month: 'Mar', revenue: 47900 },
|
|
28
|
+
{ month: 'Apr', revenue: 61200 },
|
|
29
|
+
{ month: 'May', revenue: 58600 },
|
|
30
|
+
{ month: 'Jun', revenue: 67300 },
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
const revenueByChannel = [
|
|
34
|
+
{ channel: 'Online store', revenue: 182400 },
|
|
35
|
+
{ channel: 'Marketplace', revenue: 96800 },
|
|
36
|
+
{ channel: 'Retail', revenue: 64200 },
|
|
37
|
+
{ channel: 'Wholesale', revenue: 41500 },
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
const ordersByMonth = [
|
|
41
|
+
{ month: 'Jan', online: 320, retail: 180 },
|
|
42
|
+
{ month: 'Feb', online: 348, retail: 164 },
|
|
43
|
+
{ month: 'Mar', online: 331, retail: 196 },
|
|
44
|
+
{ month: 'Apr', online: 402, retail: 214 },
|
|
45
|
+
{ month: 'May', online: 389, retail: 205 },
|
|
46
|
+
{ month: 'Jun', online: 446, retail: 232 },
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
const ordersByStatus = [
|
|
50
|
+
{ name: 'Completed', value: 268 },
|
|
51
|
+
{ name: 'Processing', value: 84 },
|
|
52
|
+
{ name: 'Pending payment', value: 37 },
|
|
53
|
+
{ name: 'Cancelled', value: 22 },
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
const weeklyOrdersTrend = [12, 18, 14, 22, 19, 27, 24, 31, 28, 35, 33, 41]
|
|
57
|
+
|
|
58
|
+
type TopProductRow = {
|
|
59
|
+
product: string
|
|
60
|
+
orders: number
|
|
61
|
+
revenue: number
|
|
62
|
+
[key: string]: unknown
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const topProducts: TopProductRow[] = [
|
|
66
|
+
{ product: 'Aurora desk lamp', orders: 412, revenue: 28840 },
|
|
67
|
+
{ product: 'Birch side table', orders: 366, revenue: 47580 },
|
|
68
|
+
{ product: 'Linen throw pillow', orders: 341, revenue: 11935 },
|
|
69
|
+
{ product: 'Oak bookshelf', orders: 214, revenue: 53500 },
|
|
70
|
+
{ product: 'Ceramic vase set', orders: 198, revenue: 8910 },
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
const formatCurrency = (value: number) => `€${value.toLocaleString('en-US')}`
|
|
74
|
+
|
|
75
|
+
const topProductColumns: TopNTableColumn<TopProductRow>[] = [
|
|
76
|
+
{ key: 'product', header: 'Product' },
|
|
77
|
+
{ key: 'orders', header: 'Orders', align: 'right' },
|
|
78
|
+
{
|
|
79
|
+
key: 'revenue',
|
|
80
|
+
header: 'Revenue',
|
|
81
|
+
align: 'right',
|
|
82
|
+
formatter: (value) => formatCurrency(value as number),
|
|
83
|
+
},
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
const kpiCardEntry: GalleryEntry = {
|
|
87
|
+
id: 'kpi-card',
|
|
88
|
+
title: 'KpiCard',
|
|
89
|
+
importPath: '@open-mercato/ui/backend/charts',
|
|
90
|
+
variants: [
|
|
91
|
+
{
|
|
92
|
+
id: 'trend-directions',
|
|
93
|
+
title: 'Trend directions',
|
|
94
|
+
render: () => (
|
|
95
|
+
<div className="grid w-full max-w-3xl grid-cols-1 gap-4 sm:grid-cols-3">
|
|
96
|
+
<KpiCard
|
|
97
|
+
title="Revenue"
|
|
98
|
+
value={67300}
|
|
99
|
+
prefix="€"
|
|
100
|
+
trend={{ value: 14.8, direction: 'up' }}
|
|
101
|
+
comparisonLabel="vs. previous month"
|
|
102
|
+
/>
|
|
103
|
+
<KpiCard
|
|
104
|
+
title="Cancelled orders"
|
|
105
|
+
value={22}
|
|
106
|
+
trend={{ value: 6.1, direction: 'down' }}
|
|
107
|
+
comparisonLabel="vs. previous month"
|
|
108
|
+
/>
|
|
109
|
+
<KpiCard
|
|
110
|
+
title="Active customers"
|
|
111
|
+
value={1284}
|
|
112
|
+
trend={{ value: 0, direction: 'unchanged' }}
|
|
113
|
+
comparisonLabel="vs. previous month"
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
),
|
|
117
|
+
code: `import { KpiCard } from '@open-mercato/ui/backend/charts'
|
|
118
|
+
|
|
119
|
+
<KpiCard
|
|
120
|
+
title="Revenue"
|
|
121
|
+
value={67300}
|
|
122
|
+
prefix="€"
|
|
123
|
+
trend={{ value: 14.8, direction: 'up' }}
|
|
124
|
+
comparisonLabel="vs. previous month"
|
|
125
|
+
/>`,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: 'suffix-and-footer',
|
|
129
|
+
title: 'Suffix and footer slot',
|
|
130
|
+
render: () => (
|
|
131
|
+
<div className="w-full max-w-xs">
|
|
132
|
+
<KpiCard
|
|
133
|
+
title="Average order value"
|
|
134
|
+
value={86.4}
|
|
135
|
+
prefix="€"
|
|
136
|
+
suffix="net"
|
|
137
|
+
trend={{ value: 3.2, direction: 'up' }}
|
|
138
|
+
footer={
|
|
139
|
+
<span className="text-muted-foreground">
|
|
140
|
+
<Sparkline values={weeklyOrdersTrend} ariaLabel="Weekly orders trend" />
|
|
141
|
+
</span>
|
|
142
|
+
}
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
),
|
|
146
|
+
code: `import { KpiCard, Sparkline } from '@open-mercato/ui/backend/charts'
|
|
147
|
+
|
|
148
|
+
<KpiCard
|
|
149
|
+
title="Average order value"
|
|
150
|
+
value={86.4}
|
|
151
|
+
prefix="€"
|
|
152
|
+
suffix="net"
|
|
153
|
+
trend={{ value: 3.2, direction: 'up' }}
|
|
154
|
+
footer={<Sparkline values={weeklyTrend} ariaLabel="Weekly orders trend" />}
|
|
155
|
+
/>`,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: 'states',
|
|
159
|
+
title: 'Loading, error and empty states',
|
|
160
|
+
render: () => (
|
|
161
|
+
<div className="grid w-full max-w-3xl grid-cols-1 gap-4 sm:grid-cols-3">
|
|
162
|
+
<KpiCard title="Loading" value={null} loading />
|
|
163
|
+
<KpiCard title="Error" value={null} error="Failed to load metric" />
|
|
164
|
+
<KpiCard title="No data" value={null} />
|
|
165
|
+
</div>
|
|
166
|
+
),
|
|
167
|
+
code: `import { KpiCard } from '@open-mercato/ui/backend/charts'
|
|
168
|
+
|
|
169
|
+
<KpiCard title="Loading" value={null} loading />
|
|
170
|
+
<KpiCard title="Error" value={null} error="Failed to load metric" />
|
|
171
|
+
<KpiCard title="No data" value={null} />`,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: 'delta-badge',
|
|
175
|
+
title: 'DeltaBadge (standalone)',
|
|
176
|
+
render: () => (
|
|
177
|
+
<div className="flex items-center gap-3">
|
|
178
|
+
<DeltaBadge direction="up" value={12.4} />
|
|
179
|
+
<DeltaBadge direction="down" value={4.7} />
|
|
180
|
+
<DeltaBadge direction="unchanged" value={0} />
|
|
181
|
+
<DeltaBadge direction="up" value={38} unit=" pts" />
|
|
182
|
+
</div>
|
|
183
|
+
),
|
|
184
|
+
code: `import { DeltaBadge } from '@open-mercato/ui/backend/charts'
|
|
185
|
+
|
|
186
|
+
<DeltaBadge direction="up" value={12.4} />
|
|
187
|
+
<DeltaBadge direction="down" value={4.7} />
|
|
188
|
+
<DeltaBadge direction="unchanged" value={0} />
|
|
189
|
+
<DeltaBadge direction="up" value={38} unit=" pts" />`,
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const sparklineEntry: GalleryEntry = {
|
|
195
|
+
id: 'sparkline',
|
|
196
|
+
title: 'Sparkline',
|
|
197
|
+
importPath: '@open-mercato/ui/backend/charts',
|
|
198
|
+
variants: [
|
|
199
|
+
{
|
|
200
|
+
id: 'default',
|
|
201
|
+
title: 'default',
|
|
202
|
+
render: () => (
|
|
203
|
+
<span className="text-muted-foreground">
|
|
204
|
+
<Sparkline values={weeklyOrdersTrend} ariaLabel="Weekly orders trend" />
|
|
205
|
+
</span>
|
|
206
|
+
),
|
|
207
|
+
code: `import { Sparkline } from '@open-mercato/ui/backend/charts'
|
|
208
|
+
|
|
209
|
+
<Sparkline values={[12, 18, 14, 22, 19, 27, 24, 31]} ariaLabel="Weekly orders trend" />`,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
id: 'semantic-color',
|
|
213
|
+
title: 'Colored via currentColor',
|
|
214
|
+
render: () => (
|
|
215
|
+
<div className="flex items-center gap-6">
|
|
216
|
+
<span className="text-primary">
|
|
217
|
+
<Sparkline values={weeklyOrdersTrend} ariaLabel="Orders trending up" />
|
|
218
|
+
</span>
|
|
219
|
+
<span className="text-destructive">
|
|
220
|
+
<Sparkline
|
|
221
|
+
values={[...weeklyOrdersTrend].reverse()}
|
|
222
|
+
ariaLabel="Returns trending down"
|
|
223
|
+
/>
|
|
224
|
+
</span>
|
|
225
|
+
</div>
|
|
226
|
+
),
|
|
227
|
+
code: `import { Sparkline } from '@open-mercato/ui/backend/charts'
|
|
228
|
+
|
|
229
|
+
// Sparkline strokes with currentColor — set a semantic text token on the wrapper.
|
|
230
|
+
<span className="text-primary">
|
|
231
|
+
<Sparkline values={values} ariaLabel="Orders trending up" />
|
|
232
|
+
</span>`,
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: 'sizes',
|
|
236
|
+
title: 'Custom width and height',
|
|
237
|
+
render: () => (
|
|
238
|
+
<div className="flex items-end gap-6 text-muted-foreground">
|
|
239
|
+
<Sparkline values={weeklyOrdersTrend} ariaLabel="Small trend" width={64} height={20} />
|
|
240
|
+
<Sparkline values={weeklyOrdersTrend} ariaLabel="Default trend" />
|
|
241
|
+
<Sparkline values={weeklyOrdersTrend} ariaLabel="Large trend" width={160} height={40} />
|
|
242
|
+
</div>
|
|
243
|
+
),
|
|
244
|
+
code: `import { Sparkline } from '@open-mercato/ui/backend/charts'
|
|
245
|
+
|
|
246
|
+
<Sparkline values={values} ariaLabel="Small trend" width={64} height={20} />
|
|
247
|
+
<Sparkline values={values} ariaLabel="Default trend" />
|
|
248
|
+
<Sparkline values={values} ariaLabel="Large trend" width={160} height={40} />`,
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const barChartEntry: GalleryEntry = {
|
|
254
|
+
id: 'bar-chart',
|
|
255
|
+
title: 'BarChart',
|
|
256
|
+
importPath: '@open-mercato/ui/backend/charts',
|
|
257
|
+
variants: [
|
|
258
|
+
{
|
|
259
|
+
id: 'basic',
|
|
260
|
+
title: 'Basic (revenue by month)',
|
|
261
|
+
render: () => (
|
|
262
|
+
<div className="w-full max-w-xl">
|
|
263
|
+
<BarChart
|
|
264
|
+
title="Revenue by month"
|
|
265
|
+
data={revenueByMonth}
|
|
266
|
+
index="month"
|
|
267
|
+
categories={['revenue']}
|
|
268
|
+
showLegend={false}
|
|
269
|
+
/>
|
|
270
|
+
</div>
|
|
271
|
+
),
|
|
272
|
+
code: `import { BarChart } from '@open-mercato/ui/backend/charts'
|
|
273
|
+
|
|
274
|
+
<BarChart
|
|
275
|
+
title="Revenue by month"
|
|
276
|
+
data={revenueByMonth}
|
|
277
|
+
index="month"
|
|
278
|
+
categories={['revenue']}
|
|
279
|
+
showLegend={false}
|
|
280
|
+
/>`,
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
id: 'horizontal',
|
|
284
|
+
title: 'Horizontal layout',
|
|
285
|
+
render: () => (
|
|
286
|
+
<div className="w-full max-w-xl">
|
|
287
|
+
<BarChart
|
|
288
|
+
title="Revenue by channel"
|
|
289
|
+
data={revenueByChannel}
|
|
290
|
+
index="channel"
|
|
291
|
+
categories={['revenue']}
|
|
292
|
+
layout="horizontal"
|
|
293
|
+
showLegend={false}
|
|
294
|
+
/>
|
|
295
|
+
</div>
|
|
296
|
+
),
|
|
297
|
+
code: `import { BarChart } from '@open-mercato/ui/backend/charts'
|
|
298
|
+
|
|
299
|
+
<BarChart
|
|
300
|
+
title="Revenue by channel"
|
|
301
|
+
data={revenueByChannel}
|
|
302
|
+
index="channel"
|
|
303
|
+
categories={['revenue']}
|
|
304
|
+
layout="horizontal"
|
|
305
|
+
showLegend={false}
|
|
306
|
+
/>`,
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
id: 'multi-series',
|
|
310
|
+
title: 'Multiple series with legend',
|
|
311
|
+
render: () => (
|
|
312
|
+
<div className="w-full max-w-xl">
|
|
313
|
+
<BarChart
|
|
314
|
+
title="Orders by month"
|
|
315
|
+
data={ordersByMonth}
|
|
316
|
+
index="month"
|
|
317
|
+
categories={['online', 'retail']}
|
|
318
|
+
categoryLabels={{ online: 'Online', retail: 'Retail' }}
|
|
319
|
+
/>
|
|
320
|
+
</div>
|
|
321
|
+
),
|
|
322
|
+
code: `import { BarChart } from '@open-mercato/ui/backend/charts'
|
|
323
|
+
|
|
324
|
+
<BarChart
|
|
325
|
+
title="Orders by month"
|
|
326
|
+
data={ordersByMonth}
|
|
327
|
+
index="month"
|
|
328
|
+
categories={['online', 'retail']}
|
|
329
|
+
categoryLabels={{ online: 'Online', retail: 'Retail' }}
|
|
330
|
+
/>`,
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const lineChartEntry: GalleryEntry = {
|
|
336
|
+
id: 'line-chart',
|
|
337
|
+
title: 'LineChart',
|
|
338
|
+
importPath: '@open-mercato/ui/backend/charts',
|
|
339
|
+
variants: [
|
|
340
|
+
{
|
|
341
|
+
id: 'basic',
|
|
342
|
+
title: 'Basic (revenue by month)',
|
|
343
|
+
render: () => (
|
|
344
|
+
<div className="w-full max-w-xl">
|
|
345
|
+
<LineChart
|
|
346
|
+
title="Revenue by month"
|
|
347
|
+
data={revenueByMonth}
|
|
348
|
+
index="month"
|
|
349
|
+
categories={['revenue']}
|
|
350
|
+
showLegend={false}
|
|
351
|
+
/>
|
|
352
|
+
</div>
|
|
353
|
+
),
|
|
354
|
+
code: `import { LineChart } from '@open-mercato/ui/backend/charts'
|
|
355
|
+
|
|
356
|
+
<LineChart
|
|
357
|
+
title="Revenue by month"
|
|
358
|
+
data={revenueByMonth}
|
|
359
|
+
index="month"
|
|
360
|
+
categories={['revenue']}
|
|
361
|
+
showLegend={false}
|
|
362
|
+
/>`,
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
id: 'area',
|
|
366
|
+
title: 'Area fill',
|
|
367
|
+
render: () => (
|
|
368
|
+
<div className="w-full max-w-xl">
|
|
369
|
+
<LineChart
|
|
370
|
+
title="Revenue by month"
|
|
371
|
+
data={revenueByMonth}
|
|
372
|
+
index="month"
|
|
373
|
+
categories={['revenue']}
|
|
374
|
+
showArea
|
|
375
|
+
showLegend={false}
|
|
376
|
+
/>
|
|
377
|
+
</div>
|
|
378
|
+
),
|
|
379
|
+
code: `import { LineChart } from '@open-mercato/ui/backend/charts'
|
|
380
|
+
|
|
381
|
+
<LineChart
|
|
382
|
+
title="Revenue by month"
|
|
383
|
+
data={revenueByMonth}
|
|
384
|
+
index="month"
|
|
385
|
+
categories={['revenue']}
|
|
386
|
+
showArea
|
|
387
|
+
showLegend={false}
|
|
388
|
+
/>`,
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
id: 'multi-series',
|
|
392
|
+
title: 'Multiple series, monotone curve',
|
|
393
|
+
render: () => (
|
|
394
|
+
<div className="w-full max-w-xl">
|
|
395
|
+
<LineChart
|
|
396
|
+
title="Orders by month"
|
|
397
|
+
data={ordersByMonth}
|
|
398
|
+
index="month"
|
|
399
|
+
categories={['online', 'retail']}
|
|
400
|
+
categoryLabels={{ online: 'Online', retail: 'Retail' }}
|
|
401
|
+
curveType="monotone"
|
|
402
|
+
/>
|
|
403
|
+
</div>
|
|
404
|
+
),
|
|
405
|
+
code: `import { LineChart } from '@open-mercato/ui/backend/charts'
|
|
406
|
+
|
|
407
|
+
<LineChart
|
|
408
|
+
title="Orders by month"
|
|
409
|
+
data={ordersByMonth}
|
|
410
|
+
index="month"
|
|
411
|
+
categories={['online', 'retail']}
|
|
412
|
+
categoryLabels={{ online: 'Online', retail: 'Retail' }}
|
|
413
|
+
curveType="monotone"
|
|
414
|
+
/>`,
|
|
415
|
+
},
|
|
416
|
+
],
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const pieChartEntry: GalleryEntry = {
|
|
420
|
+
id: 'pie-chart',
|
|
421
|
+
title: 'PieChart',
|
|
422
|
+
importPath: '@open-mercato/ui/backend/charts',
|
|
423
|
+
variants: [
|
|
424
|
+
{
|
|
425
|
+
id: 'pie',
|
|
426
|
+
title: 'Pie (orders by status)',
|
|
427
|
+
render: () => (
|
|
428
|
+
<div className="w-full max-w-md">
|
|
429
|
+
<PieChart title="Orders by status" data={ordersByStatus} />
|
|
430
|
+
</div>
|
|
431
|
+
),
|
|
432
|
+
code: `import { PieChart } from '@open-mercato/ui/backend/charts'
|
|
433
|
+
|
|
434
|
+
<PieChart title="Orders by status" data={ordersByStatus} />`,
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
id: 'donut',
|
|
438
|
+
title: 'Donut',
|
|
439
|
+
render: () => (
|
|
440
|
+
<div className="w-full max-w-md">
|
|
441
|
+
<PieChart title="Orders by status" data={ordersByStatus} variant="donut" />
|
|
442
|
+
</div>
|
|
443
|
+
),
|
|
444
|
+
code: `import { PieChart } from '@open-mercato/ui/backend/charts'
|
|
445
|
+
|
|
446
|
+
<PieChart title="Orders by status" data={ordersByStatus} variant="donut" />`,
|
|
447
|
+
},
|
|
448
|
+
],
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
const topNTableEntry: GalleryEntry = {
|
|
452
|
+
id: 'top-n-table',
|
|
453
|
+
title: 'TopNTable',
|
|
454
|
+
importPath: '@open-mercato/ui/backend/charts',
|
|
455
|
+
variants: [
|
|
456
|
+
{
|
|
457
|
+
id: 'basic',
|
|
458
|
+
title: 'Top products by revenue',
|
|
459
|
+
render: () => (
|
|
460
|
+
<div className="w-full max-w-xl">
|
|
461
|
+
<TopNTable title="Top products" data={topProducts} columns={topProductColumns} />
|
|
462
|
+
</div>
|
|
463
|
+
),
|
|
464
|
+
code: `import { TopNTable, type TopNTableColumn } from '@open-mercato/ui/backend/charts'
|
|
465
|
+
|
|
466
|
+
const columns: TopNTableColumn<TopProductRow>[] = [
|
|
467
|
+
{ key: 'product', header: 'Product' },
|
|
468
|
+
{ key: 'orders', header: 'Orders', align: 'right' },
|
|
469
|
+
{ key: 'revenue', header: 'Revenue', align: 'right', formatter: (v) => formatCurrency(v as number) },
|
|
470
|
+
]
|
|
471
|
+
|
|
472
|
+
<TopNTable title="Top products" data={topProducts} columns={columns} />`,
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
id: 'max-rows',
|
|
476
|
+
title: 'Capped with maxRows',
|
|
477
|
+
render: () => (
|
|
478
|
+
<div className="w-full max-w-xl">
|
|
479
|
+
<TopNTable
|
|
480
|
+
title="Top 3 products"
|
|
481
|
+
data={topProducts}
|
|
482
|
+
columns={topProductColumns}
|
|
483
|
+
maxRows={3}
|
|
484
|
+
/>
|
|
485
|
+
</div>
|
|
486
|
+
),
|
|
487
|
+
code: `import { TopNTable } from '@open-mercato/ui/backend/charts'
|
|
488
|
+
|
|
489
|
+
<TopNTable title="Top 3 products" data={topProducts} columns={columns} maxRows={3} />`,
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
id: 'empty',
|
|
493
|
+
title: 'Empty state',
|
|
494
|
+
render: () => (
|
|
495
|
+
<div className="w-full max-w-xl">
|
|
496
|
+
<TopNTable
|
|
497
|
+
title="Top products"
|
|
498
|
+
data={[]}
|
|
499
|
+
columns={topProductColumns}
|
|
500
|
+
emptyMessage="No sales in this period"
|
|
501
|
+
/>
|
|
502
|
+
</div>
|
|
503
|
+
),
|
|
504
|
+
code: `import { TopNTable } from '@open-mercato/ui/backend/charts'
|
|
505
|
+
|
|
506
|
+
<TopNTable title="Top products" data={[]} columns={columns} emptyMessage="No sales in this period" />`,
|
|
507
|
+
},
|
|
508
|
+
],
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
export const entries: GalleryEntry[] = [
|
|
512
|
+
kpiCardEntry,
|
|
513
|
+
sparklineEntry,
|
|
514
|
+
barChartEntry,
|
|
515
|
+
lineChartEntry,
|
|
516
|
+
pieChartEntry,
|
|
517
|
+
topNTableEntry,
|
|
518
|
+
]
|