@baack-software/baack-ts-crm 0.0.0-stage → 0.0.2
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/LICENSE +201 -0
- package/README.md +74 -2
- package/dist/account.d.ts +36 -0
- package/dist/account.d.ts.map +1 -0
- package/dist/account.js +48 -0
- package/dist/account.js.map +1 -0
- package/dist/backend.d.ts +76 -0
- package/dist/backend.d.ts.map +1 -0
- package/dist/backend.js +233 -0
- package/dist/backend.js.map +1 -0
- package/dist/crm-client.d.ts +122 -0
- package/dist/crm-client.d.ts.map +1 -0
- package/dist/crm-client.js +168 -0
- package/dist/crm-client.js.map +1 -0
- package/dist/errors.d.ts +21 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +33 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/invoices.d.ts +46 -0
- package/dist/invoices.d.ts.map +1 -0
- package/dist/invoices.js +137 -0
- package/dist/invoices.js.map +1 -0
- package/dist/leads.d.ts +29 -0
- package/dist/leads.d.ts.map +1 -0
- package/dist/leads.js +56 -0
- package/dist/leads.js.map +1 -0
- package/dist/mock/index.d.ts +43 -0
- package/dist/mock/index.d.ts.map +1 -0
- package/dist/mock/index.js +303 -0
- package/dist/mock/index.js.map +1 -0
- package/dist/money.d.ts +29 -0
- package/dist/money.d.ts.map +1 -0
- package/dist/money.js +82 -0
- package/dist/money.js.map +1 -0
- package/dist/period.d.ts +17 -0
- package/dist/period.d.ts.map +1 -0
- package/dist/period.js +23 -0
- package/dist/period.js.map +1 -0
- package/dist/pipeline.d.ts +30 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +40 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/react/Charts.d.ts +19 -0
- package/dist/react/Charts.d.ts.map +1 -0
- package/dist/react/Charts.js +38 -0
- package/dist/react/Charts.js.map +1 -0
- package/dist/react/CompanyAccountView.d.ts +21 -0
- package/dist/react/CompanyAccountView.d.ts.map +1 -0
- package/dist/react/CompanyAccountView.js +27 -0
- package/dist/react/CompanyAccountView.js.map +1 -0
- package/dist/react/DashboardCards.d.ts +32 -0
- package/dist/react/DashboardCards.d.ts.map +1 -0
- package/dist/react/DashboardCards.js +38 -0
- package/dist/react/DashboardCards.js.map +1 -0
- package/dist/react/DealsBoard.d.ts +30 -0
- package/dist/react/DealsBoard.d.ts.map +1 -0
- package/dist/react/DealsBoard.js +33 -0
- package/dist/react/DealsBoard.js.map +1 -0
- package/dist/react/Details.d.ts +52 -0
- package/dist/react/Details.d.ts.map +1 -0
- package/dist/react/Details.js +111 -0
- package/dist/react/Details.js.map +1 -0
- package/dist/react/Forms.d.ts +59 -0
- package/dist/react/Forms.d.ts.map +1 -0
- package/dist/react/Forms.js +204 -0
- package/dist/react/Forms.js.map +1 -0
- package/dist/react/LeadsTable.d.ts +22 -0
- package/dist/react/LeadsTable.d.ts.map +1 -0
- package/dist/react/LeadsTable.js +79 -0
- package/dist/react/LeadsTable.js.map +1 -0
- package/dist/react/Sales.d.ts +49 -0
- package/dist/react/Sales.d.ts.map +1 -0
- package/dist/react/Sales.js +186 -0
- package/dist/react/Sales.js.map +1 -0
- package/dist/react/SidePanel.d.ts +21 -0
- package/dist/react/SidePanel.d.ts.map +1 -0
- package/dist/react/SidePanel.js +37 -0
- package/dist/react/SidePanel.js.map +1 -0
- package/dist/react/format.d.ts +28 -0
- package/dist/react/format.d.ts.map +1 -0
- package/dist/react/format.js +30 -0
- package/dist/react/format.js.map +1 -0
- package/dist/react/index.d.ts +14 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +14 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/parts.d.ts +45 -0
- package/dist/react/parts.d.ts.map +1 -0
- package/dist/react/parts.js +59 -0
- package/dist/react/parts.js.map +1 -0
- package/dist/react/text.d.ts +145 -0
- package/dist/react/text.d.ts.map +1 -0
- package/dist/react/text.js +142 -0
- package/dist/react/text.js.map +1 -0
- package/dist/react/ui/alert.d.ts +11 -0
- package/dist/react/ui/alert.d.ts.map +1 -0
- package/dist/react/ui/alert.js +29 -0
- package/dist/react/ui/alert.js.map +1 -0
- package/dist/react/ui/badge.d.ts +10 -0
- package/dist/react/ui/badge.d.ts.map +1 -0
- package/dist/react/ui/badge.js +26 -0
- package/dist/react/ui/badge.js.map +1 -0
- package/dist/react/ui/button.d.ts +11 -0
- package/dist/react/ui/button.d.ts.map +1 -0
- package/dist/react/ui/button.js +37 -0
- package/dist/react/ui/button.js.map +1 -0
- package/dist/react/ui/card.d.ts +12 -0
- package/dist/react/ui/card.d.ts.map +1 -0
- package/dist/react/ui/card.js +26 -0
- package/dist/react/ui/card.js.map +1 -0
- package/dist/react/ui/chart.d.ts +45 -0
- package/dist/react/ui/chart.d.ts.map +1 -0
- package/dist/react/ui/chart.js +116 -0
- package/dist/react/ui/chart.js.map +1 -0
- package/dist/react/ui/input.d.ts +4 -0
- package/dist/react/ui/input.d.ts.map +1 -0
- package/dist/react/ui/input.js +8 -0
- package/dist/react/ui/input.js.map +1 -0
- package/dist/react/ui/label.d.ts +5 -0
- package/dist/react/ui/label.d.ts.map +1 -0
- package/dist/react/ui/label.js +10 -0
- package/dist/react/ui/label.js.map +1 -0
- package/dist/react/ui/progress.d.ts +5 -0
- package/dist/react/ui/progress.d.ts.map +1 -0
- package/dist/react/ui/progress.js +10 -0
- package/dist/react/ui/progress.js.map +1 -0
- package/dist/react/ui/select.d.ts +16 -0
- package/dist/react/ui/select.d.ts.map +1 -0
- package/dist/react/ui/select.js +37 -0
- package/dist/react/ui/select.js.map +1 -0
- package/dist/react/ui/separator.d.ts +5 -0
- package/dist/react/ui/separator.d.ts.map +1 -0
- package/dist/react/ui/separator.js +10 -0
- package/dist/react/ui/separator.js.map +1 -0
- package/dist/react/ui/sheet.d.ts +15 -0
- package/dist/react/ui/sheet.d.ts.map +1 -0
- package/dist/react/ui/sheet.js +38 -0
- package/dist/react/ui/sheet.js.map +1 -0
- package/dist/react/ui/skeleton.d.ts +3 -0
- package/dist/react/ui/skeleton.d.ts.map +1 -0
- package/dist/react/ui/skeleton.js +7 -0
- package/dist/react/ui/skeleton.js.map +1 -0
- package/dist/react/ui/table.d.ts +11 -0
- package/dist/react/ui/table.d.ts.map +1 -0
- package/dist/react/ui/table.js +29 -0
- package/dist/react/ui/table.js.map +1 -0
- package/dist/react/ui/tabs.d.ts +12 -0
- package/dist/react/ui/tabs.d.ts.map +1 -0
- package/dist/react/ui/tabs.js +31 -0
- package/dist/react/ui/tabs.js.map +1 -0
- package/dist/react/views.d.ts +60 -0
- package/dist/react/views.d.ts.map +1 -0
- package/dist/react/views.js +172 -0
- package/dist/react/views.js.map +1 -0
- package/dist/sales.d.ts +57 -0
- package/dist/sales.d.ts.map +1 -0
- package/dist/sales.js +64 -0
- package/dist/sales.js.map +1 -0
- package/dist/store.d.ts +140 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +244 -0
- package/dist/store.js.map +1 -0
- package/dist/target.d.ts +21 -0
- package/dist/target.d.ts.map +1 -0
- package/dist/target.js +36 -0
- package/dist/target.js.map +1 -0
- package/dist/types.d.ts +180 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +100 -4
- package/src/account.ts +79 -0
- package/src/backend.ts +371 -0
- package/src/crm-client.ts +250 -0
- package/src/errors.ts +34 -0
- package/src/index.ts +12 -0
- package/src/invoices.ts +157 -0
- package/src/leads.ts +78 -0
- package/src/mock/index.ts +398 -0
- package/src/money.ts +104 -0
- package/src/period.ts +32 -0
- package/src/pipeline.ts +61 -0
- package/src/react/Charts.tsx +143 -0
- package/src/react/CompanyAccountView.tsx +198 -0
- package/src/react/DashboardCards.tsx +171 -0
- package/src/react/DealsBoard.tsx +177 -0
- package/src/react/Details.tsx +293 -0
- package/src/react/Forms.tsx +619 -0
- package/src/react/LeadsTable.tsx +234 -0
- package/src/react/Sales.tsx +539 -0
- package/src/react/SidePanel.tsx +95 -0
- package/src/react/format.ts +53 -0
- package/src/react/index.ts +13 -0
- package/src/react/parts.tsx +131 -0
- package/src/react/text.ts +144 -0
- package/src/react/ui/README.md +6 -0
- package/src/react/ui/alert.tsx +75 -0
- package/src/react/ui/badge.tsx +48 -0
- package/src/react/ui/button.tsx +66 -0
- package/src/react/ui/card.tsx +102 -0
- package/src/react/ui/chart.tsx +304 -0
- package/src/react/ui/input.tsx +18 -0
- package/src/react/ui/label.tsx +23 -0
- package/src/react/ui/progress.tsx +30 -0
- package/src/react/ui/select.tsx +189 -0
- package/src/react/ui/separator.tsx +27 -0
- package/src/react/ui/sheet.tsx +145 -0
- package/src/react/ui/skeleton.tsx +13 -0
- package/src/react/ui/table.tsx +113 -0
- package/src/react/ui/tabs.tsx +89 -0
- package/src/react/views.tsx +443 -0
- package/src/sales.ts +120 -0
- package/src/store.ts +419 -0
- package/src/target.ts +51 -0
- package/src/types.ts +202 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './text.ts';
|
|
2
|
+
export * from './format.ts';
|
|
3
|
+
export * from './parts.tsx';
|
|
4
|
+
export * from './DashboardCards.tsx';
|
|
5
|
+
export * from './Charts.tsx';
|
|
6
|
+
export * from './LeadsTable.tsx';
|
|
7
|
+
export * from './DealsBoard.tsx';
|
|
8
|
+
export * from './Details.tsx';
|
|
9
|
+
export * from './CompanyAccountView.tsx';
|
|
10
|
+
export * from './Sales.tsx';
|
|
11
|
+
export * from './Forms.tsx';
|
|
12
|
+
export * from './SidePanel.tsx';
|
|
13
|
+
export * from './views.tsx';
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { FlaskConical, TrendingDown, TrendingUp } from 'lucide-react';
|
|
2
|
+
import { cn } from 'cn';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { INVOICE_STATUS_LABELS } from '../invoices.ts';
|
|
5
|
+
import { LEAD_STATE_LABELS, leadState, type LeadState } from '../leads.ts';
|
|
6
|
+
import type { DealOutcome, InvoiceStatus, Lead } from '../types.ts';
|
|
7
|
+
import { formatChange } from './format.ts';
|
|
8
|
+
import { withText, type CrmText } from './text.ts';
|
|
9
|
+
import { Badge } from './ui/badge.tsx';
|
|
10
|
+
import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from './ui/card.tsx';
|
|
11
|
+
|
|
12
|
+
/** Marks a view or card whose records come from sample data, so nobody takes them for real ones. */
|
|
13
|
+
export function SampleDataBadge({ text }: { text?: Partial<CrmText> | undefined }) {
|
|
14
|
+
const words = withText(text);
|
|
15
|
+
return (
|
|
16
|
+
<Badge variant="outline" title={words.sampleDataHint} className="gap-1 border-dashed">
|
|
17
|
+
<FlaskConical aria-hidden="true" />
|
|
18
|
+
{words.sampleData}
|
|
19
|
+
</Badge>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Says once, above a view, which of its concepts come from sample data, rather than a badge on every card.
|
|
25
|
+
*/
|
|
26
|
+
export function SampleDataNotice({
|
|
27
|
+
concepts,
|
|
28
|
+
text,
|
|
29
|
+
}: {
|
|
30
|
+
concepts: readonly string[];
|
|
31
|
+
text?: Partial<CrmText> | undefined;
|
|
32
|
+
}) {
|
|
33
|
+
const words = withText(text);
|
|
34
|
+
if (concepts.length === 0) return null;
|
|
35
|
+
return (
|
|
36
|
+
<p
|
|
37
|
+
className={cn(
|
|
38
|
+
'bg-muted/50 text-muted-foreground flex flex-wrap items-center gap-2',
|
|
39
|
+
'rounded-lg border border-dashed px-3 py-2 text-sm',
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
42
|
+
<FlaskConical aria-hidden="true" className="size-4 shrink-0" />
|
|
43
|
+
<span>
|
|
44
|
+
<span className="text-foreground font-medium">{words.sampleData}:</span> {concepts.join(', ')}.{' '}
|
|
45
|
+
{words.sampleDataHint}
|
|
46
|
+
</span>
|
|
47
|
+
</p>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A titled card for the CRM views. `sample` adds the sample data badge; `action` sits at the top right.
|
|
53
|
+
*/
|
|
54
|
+
export function CrmCard({
|
|
55
|
+
title,
|
|
56
|
+
description,
|
|
57
|
+
sample,
|
|
58
|
+
action,
|
|
59
|
+
text,
|
|
60
|
+
className,
|
|
61
|
+
children,
|
|
62
|
+
}: {
|
|
63
|
+
title: string;
|
|
64
|
+
description?: string;
|
|
65
|
+
sample?: boolean | undefined;
|
|
66
|
+
action?: ReactNode;
|
|
67
|
+
text?: Partial<CrmText> | undefined;
|
|
68
|
+
className?: string;
|
|
69
|
+
children: ReactNode;
|
|
70
|
+
}) {
|
|
71
|
+
return (
|
|
72
|
+
<Card className={className}>
|
|
73
|
+
<CardHeader>
|
|
74
|
+
<CardTitle>
|
|
75
|
+
<h2 className="text-base font-semibold">{title}</h2>
|
|
76
|
+
</CardTitle>
|
|
77
|
+
{description && <CardDescription>{description}</CardDescription>}
|
|
78
|
+
{(sample || action) && (
|
|
79
|
+
<CardAction className="flex items-center gap-2">
|
|
80
|
+
{sample && <SampleDataBadge text={text} />}
|
|
81
|
+
{action}
|
|
82
|
+
</CardAction>
|
|
83
|
+
)}
|
|
84
|
+
</CardHeader>
|
|
85
|
+
<CardContent>{children}</CardContent>
|
|
86
|
+
</Card>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** A rise or fall against the previous period, in words and an icon, not colour alone. */
|
|
91
|
+
export function ChangeIndicator({ change, text }: { change: number | undefined; text?: Partial<CrmText> | undefined }) {
|
|
92
|
+
const words = withText(text);
|
|
93
|
+
if (change === undefined) return <span className="text-muted-foreground text-xs">{words.noChange}</span>;
|
|
94
|
+
const Icon = change < 0 ? TrendingDown : TrendingUp;
|
|
95
|
+
return (
|
|
96
|
+
<span className="text-muted-foreground inline-flex items-center gap-1 text-xs">
|
|
97
|
+
<Icon aria-hidden="true" className={cn('size-3.5', change < 0 ? 'text-destructive' : 'text-primary')} />
|
|
98
|
+
<span className="text-foreground font-medium">{formatChange(change)}</span> {words.vsPrevious}
|
|
99
|
+
</span>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const LEAD_VARIANT: Record<LeadState, 'default' | 'secondary' | 'outline' | 'destructive'> = {
|
|
104
|
+
NEW: 'default',
|
|
105
|
+
CONTACTED: 'secondary',
|
|
106
|
+
QUALIFIED: 'secondary',
|
|
107
|
+
CLOSED: 'outline',
|
|
108
|
+
CONVERTED: 'outline',
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** Where a lead stands: how it ended once closed (converted, unqualified), otherwise its status. */
|
|
112
|
+
export function LeadStatusBadge({ lead }: { lead: Lead }) {
|
|
113
|
+
const state = leadState(lead);
|
|
114
|
+
return <Badge variant={LEAD_VARIANT[state]}>{LEAD_STATE_LABELS[state]}</Badge>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** How a deal stands, in words. Lost is outlined rather than red, which lacks contrast on tinted board columns. */
|
|
118
|
+
export function OutcomeBadge({ outcome, label }: { outcome: DealOutcome; label: string }) {
|
|
119
|
+
return <Badge variant={outcome === 'WON' ? 'default' : outcome === 'LOST' ? 'outline' : 'secondary'}>{label}</Badge>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function InvoiceStatusBadge({ status, overdue }: { status: InvoiceStatus; overdue?: boolean }) {
|
|
123
|
+
if (overdue) return <Badge variant="destructive">Overdue</Badge>;
|
|
124
|
+
return (
|
|
125
|
+
<Badge
|
|
126
|
+
variant={status === 'PAID' ? 'default' : status === 'DRAFT' || status === 'VOIDED' ? 'outline' : 'secondary'}
|
|
127
|
+
>
|
|
128
|
+
{INVOICE_STATUS_LABELS[status]}
|
|
129
|
+
</Badge>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words the CRM components show, in en-GB. Each composition takes `text` to replace any of them, so a host can
|
|
3
|
+
* supply its own copy (later from Baack content).
|
|
4
|
+
*/
|
|
5
|
+
export const CRM_TEXT = {
|
|
6
|
+
sampleData: 'Sample data',
|
|
7
|
+
sampleDataHint: 'Not yet in the Baack API: shown from sample data so the view can be reviewed.',
|
|
8
|
+
unavailable: 'Not available yet',
|
|
9
|
+
loading: 'Loading',
|
|
10
|
+
noChange: 'No earlier figures',
|
|
11
|
+
vsPrevious: 'vs previous period',
|
|
12
|
+
customers: 'Customers',
|
|
13
|
+
customersHint: 'Companies with a won deal',
|
|
14
|
+
openDeals: 'Open deals',
|
|
15
|
+
revenue: 'Revenue',
|
|
16
|
+
revenueHint: 'Payments received less refunds',
|
|
17
|
+
revenueOverTime: 'Revenue over time',
|
|
18
|
+
newLeads: 'New leads',
|
|
19
|
+
target: 'Sales target',
|
|
20
|
+
targetSummary: 'Payments received on deals against the value of leads and deals',
|
|
21
|
+
targetReceived: 'received of',
|
|
22
|
+
leadsBySource: 'Leads by source',
|
|
23
|
+
pipeline: 'Sales pipeline',
|
|
24
|
+
stage: 'Stage',
|
|
25
|
+
deals: 'Deals',
|
|
26
|
+
value: 'Value',
|
|
27
|
+
weighted: 'Weighted',
|
|
28
|
+
share: 'Share',
|
|
29
|
+
leads: 'Leads',
|
|
30
|
+
lead: 'Lead',
|
|
31
|
+
company: 'Company',
|
|
32
|
+
contact: 'Contact',
|
|
33
|
+
source: 'Source',
|
|
34
|
+
status: 'Status',
|
|
35
|
+
date: 'Date',
|
|
36
|
+
assignee: 'Assignee',
|
|
37
|
+
filterLeads: 'Filter leads',
|
|
38
|
+
allStatuses: 'All statuses',
|
|
39
|
+
allSources: 'All sources',
|
|
40
|
+
export: 'Export CSV',
|
|
41
|
+
previous: 'Previous',
|
|
42
|
+
next: 'Next',
|
|
43
|
+
noLeads: 'No leads match.',
|
|
44
|
+
of: 'of',
|
|
45
|
+
open: 'Open',
|
|
46
|
+
close: 'Close',
|
|
47
|
+
moveTo: 'Move to stage',
|
|
48
|
+
expectedClose: 'Expected close',
|
|
49
|
+
closed: 'Closed',
|
|
50
|
+
lostReason: 'Lost reason',
|
|
51
|
+
outcome: 'Outcome',
|
|
52
|
+
outcomeOpen: 'Open',
|
|
53
|
+
outcomeWon: 'Won',
|
|
54
|
+
outcomeLost: 'Lost',
|
|
55
|
+
markLost: 'Mark as lost',
|
|
56
|
+
markUnqualified: 'Mark unqualified',
|
|
57
|
+
unqualifiedReason: 'Why it was unqualified',
|
|
58
|
+
reopen: 'Reopen',
|
|
59
|
+
cancel: 'Cancel',
|
|
60
|
+
probability: 'Probability',
|
|
61
|
+
convert: 'Convert to deal',
|
|
62
|
+
converting: 'Converting',
|
|
63
|
+
convertSummary: 'Qualify the lead: it becomes a deal at the first stage of the pipeline.',
|
|
64
|
+
companyName: 'Company name',
|
|
65
|
+
companyNameHint: 'Creates the client company. Leave it empty for a person buying for themselves.',
|
|
66
|
+
convertedTo: 'Converted to',
|
|
67
|
+
created: 'Created',
|
|
68
|
+
noDeals: 'No deals here.',
|
|
69
|
+
account: 'Account',
|
|
70
|
+
openValue: 'Open deals',
|
|
71
|
+
wonValue: 'Won',
|
|
72
|
+
outstanding: 'Outstanding',
|
|
73
|
+
overdue: 'Overdue',
|
|
74
|
+
received: 'Received',
|
|
75
|
+
invoices: 'Invoices',
|
|
76
|
+
invoice: 'Invoice',
|
|
77
|
+
total: 'Total',
|
|
78
|
+
due: 'Due',
|
|
79
|
+
paid: 'Paid',
|
|
80
|
+
payments: 'Payments',
|
|
81
|
+
method: 'Method',
|
|
82
|
+
reference: 'Reference',
|
|
83
|
+
amount: 'Amount',
|
|
84
|
+
noInvoices: 'No invoices.',
|
|
85
|
+
noPayments: 'No payments.',
|
|
86
|
+
openLeads: 'Open leads',
|
|
87
|
+
people: 'People',
|
|
88
|
+
sales: 'Sales',
|
|
89
|
+
invoiced: 'Invoiced',
|
|
90
|
+
invoicedHint: 'Invoices issued in the period',
|
|
91
|
+
salesTax: 'Sales tax',
|
|
92
|
+
salesTaxHint: 'On invoices issued in the period',
|
|
93
|
+
outstandingHint: 'Still to pay on invoices sent',
|
|
94
|
+
outstandingByAge: 'Outstanding by age',
|
|
95
|
+
paymentMethods: 'Payments by method',
|
|
96
|
+
customer: 'Customer',
|
|
97
|
+
issued: 'Issued',
|
|
98
|
+
filterInvoices: 'Filter invoices',
|
|
99
|
+
allInvoices: 'All invoices',
|
|
100
|
+
awaitingPayment: 'Awaiting payment',
|
|
101
|
+
noMatchingInvoices: 'No invoices match.',
|
|
102
|
+
recordPayment: 'Record payment',
|
|
103
|
+
recording: 'Recording',
|
|
104
|
+
paymentRecorded: 'Payment recorded.',
|
|
105
|
+
invalidAmount: 'Enter an amount above zero, such as 120.00.',
|
|
106
|
+
tasks: 'Tasks',
|
|
107
|
+
none: 'None',
|
|
108
|
+
unnamed: 'Unnamed',
|
|
109
|
+
newLead: 'New lead',
|
|
110
|
+
newDeal: 'New deal',
|
|
111
|
+
newInvoice: 'New invoice',
|
|
112
|
+
title: 'Title',
|
|
113
|
+
titleRequired: 'Enter a title.',
|
|
114
|
+
noCompany: 'No company',
|
|
115
|
+
newCompany: 'Or a new company',
|
|
116
|
+
newCompanyHint: 'Makes the company, owned by yours. Leave it empty to choose one above, or for a person.',
|
|
117
|
+
createLead: 'Create lead',
|
|
118
|
+
createDeal: 'Create deal',
|
|
119
|
+
createInvoice: 'Create invoice',
|
|
120
|
+
creating: 'Creating',
|
|
121
|
+
currency: 'Currency',
|
|
122
|
+
issuedOn: 'Issued on',
|
|
123
|
+
dueOn: 'Due on',
|
|
124
|
+
forDeal: 'For deal',
|
|
125
|
+
noDeal: 'No deal',
|
|
126
|
+
lines: 'Lines',
|
|
127
|
+
description: 'Description',
|
|
128
|
+
quantity: 'Quantity',
|
|
129
|
+
unitPrice: 'Unit price',
|
|
130
|
+
addLine: 'Add a line',
|
|
131
|
+
removeLine: 'Remove line',
|
|
132
|
+
taxRate: 'Tax rate (%)',
|
|
133
|
+
subTotal: 'Subtotal',
|
|
134
|
+
tax: 'Tax',
|
|
135
|
+
customerRequired: 'Choose the customer.',
|
|
136
|
+
linesRequired: 'Give each line a description, a quantity and a unit price above zero.',
|
|
137
|
+
invalidRate: 'Enter a tax rate from 0 to 100.',
|
|
138
|
+
invalidProbability: 'Enter a probability from 0 to 100.',
|
|
139
|
+
} as const;
|
|
140
|
+
|
|
141
|
+
export type CrmText = { readonly [K in keyof typeof CRM_TEXT]: string };
|
|
142
|
+
|
|
143
|
+
/** The default words with a host's replacements. */
|
|
144
|
+
export const withText = (text?: Partial<CrmText>): CrmText => (text ? { ...CRM_TEXT, ...text } : CRM_TEXT);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
shadcn/ui primitives, generated from the shadcn registry (`npx shadcn@4.21.0 add …`, style `radix-nova`, base colour
|
|
2
|
+
neutral, lucide icons) and kept as generated, apart from relative imports between them. Regenerate rather than edit,
|
|
3
|
+
and keep task-specific styling in the components one level up.
|
|
4
|
+
|
|
5
|
+
The colours come from the app's theme (the shadcn CSS variables: `--primary`, `--muted`, …), so the components follow
|
|
6
|
+
whatever theme the host app defines.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
import { cn } from "cn"
|
|
4
|
+
|
|
5
|
+
const alertVariants = cva(
|
|
6
|
+
"group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-card text-card-foreground",
|
|
11
|
+
destructive:
|
|
12
|
+
"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "default",
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
function Alert({
|
|
22
|
+
className,
|
|
23
|
+
variant,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
data-slot="alert"
|
|
29
|
+
role="alert"
|
|
30
|
+
className={cn(alertVariants({ variant }), className)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
data-slot="alert-title"
|
|
40
|
+
className={cn(
|
|
41
|
+
"font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function AlertDescription({
|
|
50
|
+
className,
|
|
51
|
+
...props
|
|
52
|
+
}: React.ComponentProps<"div">) {
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
data-slot="alert-description"
|
|
56
|
+
className={cn(
|
|
57
|
+
"text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",
|
|
58
|
+
className
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function AlertAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
66
|
+
return (
|
|
67
|
+
<div
|
|
68
|
+
data-slot="alert-action"
|
|
69
|
+
className={cn("absolute top-2 right-2", className)}
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { Alert, AlertTitle, AlertDescription, AlertAction }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
import { cn } from "cn"
|
|
4
|
+
import { Slot } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
const badgeVariants = cva(
|
|
7
|
+
"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
12
|
+
secondary:
|
|
13
|
+
"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
14
|
+
destructive:
|
|
15
|
+
"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
16
|
+
outline:
|
|
17
|
+
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
18
|
+
ghost:
|
|
19
|
+
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
20
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
variant: "default",
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
function Badge({
|
|
30
|
+
className,
|
|
31
|
+
variant = "default",
|
|
32
|
+
asChild = false,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<"span"> &
|
|
35
|
+
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
|
36
|
+
const Comp = asChild ? Slot.Root : "span"
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Comp
|
|
40
|
+
data-slot="badge"
|
|
41
|
+
data-variant={variant}
|
|
42
|
+
className={cn(badgeVariants({ variant }), className)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { Badge, badgeVariants }
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
import { cn } from "cn"
|
|
4
|
+
import { Slot } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
const buttonVariants = cva(
|
|
7
|
+
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
12
|
+
outline:
|
|
13
|
+
"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
14
|
+
secondary:
|
|
15
|
+
"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
16
|
+
ghost:
|
|
17
|
+
"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
18
|
+
destructive:
|
|
19
|
+
"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
20
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default:
|
|
24
|
+
"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
25
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
26
|
+
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
27
|
+
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
28
|
+
icon: "size-8",
|
|
29
|
+
"icon-xs":
|
|
30
|
+
"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
31
|
+
"icon-sm":
|
|
32
|
+
"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
|
33
|
+
"icon-lg": "size-9",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
variant: "default",
|
|
38
|
+
size: "default",
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
function Button({
|
|
44
|
+
className,
|
|
45
|
+
variant = "default",
|
|
46
|
+
size = "default",
|
|
47
|
+
asChild = false,
|
|
48
|
+
...props
|
|
49
|
+
}: React.ComponentProps<"button"> &
|
|
50
|
+
VariantProps<typeof buttonVariants> & {
|
|
51
|
+
asChild?: boolean
|
|
52
|
+
}) {
|
|
53
|
+
const Comp = asChild ? Slot.Root : "button"
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<Comp
|
|
57
|
+
data-slot="button"
|
|
58
|
+
data-variant={variant}
|
|
59
|
+
data-size={size}
|
|
60
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
function Card({
|
|
5
|
+
className,
|
|
6
|
+
size = "default",
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
data-slot="card"
|
|
12
|
+
data-size={size}
|
|
13
|
+
className={cn(
|
|
14
|
+
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
data-slot="card-header"
|
|
26
|
+
className={cn(
|
|
27
|
+
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
data-slot="card-title"
|
|
39
|
+
className={cn(
|
|
40
|
+
"text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
49
|
+
return (
|
|
50
|
+
<div
|
|
51
|
+
data-slot="card-description"
|
|
52
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
data-slot="card-action"
|
|
62
|
+
className={cn(
|
|
63
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
64
|
+
className
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
data-slot="card-content"
|
|
75
|
+
className={cn("px-(--card-spacing)", className)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
82
|
+
return (
|
|
83
|
+
<div
|
|
84
|
+
data-slot="card-footer"
|
|
85
|
+
className={cn(
|
|
86
|
+
"flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",
|
|
87
|
+
className
|
|
88
|
+
)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
Card,
|
|
96
|
+
CardHeader,
|
|
97
|
+
CardFooter,
|
|
98
|
+
CardTitle,
|
|
99
|
+
CardAction,
|
|
100
|
+
CardDescription,
|
|
101
|
+
CardContent,
|
|
102
|
+
}
|