@voyantjs/finance-ui 0.16.0 → 0.17.0

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/README.md CHANGED
@@ -11,3 +11,17 @@ pnpm add @voyantjs/finance-ui @voyantjs/finance-react @voyantjs/ui @tanstack/rea
11
11
  `@voyantjs/ui` provides the design-system primitives. `@voyantjs/finance-react` provides the data-layer hooks. Both are required peers.
12
12
 
13
13
  All components accept a `className` prop and merge it with `cn()`. Wrap or compose to extend; use the registry copy-paste path (`npx shadcn add @voyant/...`) for components you want to fork outright.
14
+
15
+ ## I18n
16
+
17
+ Components render English by default. To localize them, wrap your UI in
18
+ `FinanceUiMessagesProvider` and import only the locales your app supports.
19
+
20
+ ```tsx
21
+ import { FinanceUiMessagesProvider } from "@voyantjs/finance-ui"
22
+ import { financeUiEn } from "@voyantjs/finance-ui/i18n/en"
23
+ import { financeUiRo } from "@voyantjs/finance-ui/i18n/ro"
24
+ ```
25
+
26
+ English-only apps should import only `./i18n/en`. Bilingual apps can import
27
+ `./i18n/en` and `./i18n/ro`.
@@ -1 +1 @@
1
- {"version":3,"file":"invoice-dialog.d.ts","sourceRoot":"","sources":["../../src/components/invoice-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,yBAAyB,CAAA;AA4ChF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;CAC7C;AAkBD,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,kBAAkB,2CAoO3F"}
1
+ {"version":3,"file":"invoice-dialog.d.ts","sourceRoot":"","sources":["../../src/components/invoice-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,yBAAyB,CAAA;AAkDhF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;CAC7C;AASD,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,kBAAkB,2CAwP3F"}
@@ -8,28 +8,24 @@ import { Loader2 } from "lucide-react";
8
8
  import { useEffect } from "react";
9
9
  import { useForm } from "react-hook-form";
10
10
  import { z } from "zod/v4";
11
- const invoiceFormSchema = z.object({
12
- invoiceNumber: z.string().min(1, "Invoice number is required"),
13
- bookingId: z.string().min(1, "Booking ID is required"),
14
- personId: z.string().optional().nullable(),
15
- organizationId: z.string().optional().nullable(),
16
- status: z.enum(["draft", "sent", "partially_paid", "paid", "overdue", "void"]),
17
- currency: z.string().min(3).max(3, "Use 3-letter ISO code"),
18
- subtotalCents: z.coerce.number().int().min(0).default(0),
19
- taxCents: z.coerce.number().int().min(0).default(0),
20
- totalCents: z.coerce.number().int().min(0).default(0),
21
- issueDate: z.string().min(1, "Issue date is required"),
22
- dueDate: z.string().min(1, "Due date is required"),
23
- notes: z.string().optional().nullable(),
24
- });
25
- const INVOICE_STATUSES = [
26
- { value: "draft", label: "Draft" },
27
- { value: "sent", label: "Sent" },
28
- { value: "partially_paid", label: "Partially Paid" },
29
- { value: "paid", label: "Paid" },
30
- { value: "overdue", label: "Overdue" },
31
- { value: "void", label: "Void" },
32
- ];
11
+ import { useFinanceUiMessagesOrDefault } from "../i18n";
12
+ import { invoiceStatuses } from "../i18n/messages";
13
+ function createInvoiceFormSchema(messages) {
14
+ return z.object({
15
+ invoiceNumber: z.string().min(1, messages.invoiceDialog.validation.invoiceNumberRequired),
16
+ bookingId: z.string().min(1, messages.invoiceDialog.validation.bookingIdRequired),
17
+ personId: z.string().optional().nullable(),
18
+ organizationId: z.string().optional().nullable(),
19
+ status: z.enum(invoiceStatuses),
20
+ currency: z.string().min(3).max(3, messages.invoiceDialog.validation.currencyIsoCode),
21
+ subtotalCents: z.coerce.number().int().min(0).default(0),
22
+ taxCents: z.coerce.number().int().min(0).default(0),
23
+ totalCents: z.coerce.number().int().min(0).default(0),
24
+ issueDate: z.string().min(1, messages.invoiceDialog.validation.issueDateRequired),
25
+ dueDate: z.string().min(1, messages.invoiceDialog.validation.dueDateRequired),
26
+ notes: z.string().optional().nullable(),
27
+ });
28
+ }
33
29
  function generateInvoiceNumber() {
34
30
  const now = new Date();
35
31
  const y = now.getFullYear();
@@ -39,6 +35,8 @@ function generateInvoiceNumber() {
39
35
  export function InvoiceDialog({ open, onOpenChange, invoice, onSuccess }) {
40
36
  const isEditing = Boolean(invoice);
41
37
  const { create, update } = useInvoiceMutation();
38
+ const messages = useFinanceUiMessagesOrDefault();
39
+ const invoiceFormSchema = createInvoiceFormSchema(messages);
42
40
  const form = useForm({
43
41
  resolver: zodResolver(invoiceFormSchema),
44
42
  defaultValues: {
@@ -47,7 +45,7 @@ export function InvoiceDialog({ open, onOpenChange, invoice, onSuccess }) {
47
45
  personId: "",
48
46
  organizationId: "",
49
47
  status: "draft",
50
- currency: "EUR",
48
+ currency: "EUR", // i18n-literal-ok domain default currency
51
49
  subtotalCents: 0,
52
50
  taxCents: 0,
53
51
  totalCents: 0,
@@ -81,7 +79,7 @@ export function InvoiceDialog({ open, onOpenChange, invoice, onSuccess }) {
81
79
  personId: "",
82
80
  organizationId: "",
83
81
  status: "draft",
84
- currency: "EUR",
82
+ currency: "EUR", // i18n-literal-ok domain default currency
85
83
  subtotalCents: 0,
86
84
  taxCents: 0,
87
85
  totalCents: 0,
@@ -117,14 +115,17 @@ export function InvoiceDialog({ open, onOpenChange, invoice, onSuccess }) {
117
115
  onSuccess?.(saved);
118
116
  };
119
117
  const isSubmitting = create.isPending || update.isPending;
120
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { size: "lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing ? "Edit Invoice" : "New Invoice" }) }), _jsxs("form", { onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(DialogBody, { className: "grid gap-4", children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Invoice Number" }), _jsx(Input, { ...form.register("invoiceNumber"), placeholder: "INV-2025-1234" }), form.formState.errors.invoiceNumber ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.invoiceNumber.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Status" }), _jsxs(Select, { items: INVOICE_STATUSES, value: form.watch("status"), onValueChange: (value) => form.setValue("status", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: INVOICE_STATUSES.map((status) => (_jsx(SelectItem, { value: status.value, children: status.label }, status.value))) })] })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Booking ID" }), _jsx(Input, { ...form.register("bookingId"), placeholder: "book_..." }), form.formState.errors.bookingId ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.bookingId.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Currency" }), _jsx(CurrencyCombobox, { value: form.watch("currency") || null, onChange: (next) => form.setValue("currency", next ?? "EUR", {
118
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { size: "lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing ? messages.invoiceDialog.titles.edit : messages.invoiceDialog.titles.create }) }), _jsxs("form", { onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(DialogBody, { className: "grid gap-4", children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.invoiceDialog.fields.invoiceNumber }), _jsx(Input, { ...form.register("invoiceNumber"), placeholder: messages.invoiceDialog.placeholders.invoiceNumber }), form.formState.errors.invoiceNumber ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.invoiceNumber.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.invoiceDialog.fields.status }), _jsxs(Select, { items: invoiceStatuses.map((value) => ({
119
+ label: messages.common.invoiceStatusLabels[value],
120
+ value,
121
+ })), value: form.watch("status"), onValueChange: (value) => form.setValue("status", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: invoiceStatuses.map((status) => (_jsx(SelectItem, { value: status, children: messages.common.invoiceStatusLabels[status] }, status))) })] })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.invoiceDialog.fields.bookingId }), _jsx(Input, { ...form.register("bookingId"), placeholder: messages.invoiceDialog.placeholders.bookingId }), form.formState.errors.bookingId ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.bookingId.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.invoiceDialog.fields.currency }), _jsx(CurrencyCombobox, { value: form.watch("currency") || null, onChange: (next) => form.setValue("currency", next ?? "EUR" /* i18n-literal-ok domain default currency */, {
121
122
  shouldValidate: true,
122
123
  shouldDirty: true,
123
- }) })] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Subtotal (cents)" }), _jsx(Input, { ...form.register("subtotalCents"), type: "number", min: "0" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Tax (cents)" }), _jsx(Input, { ...form.register("taxCents"), type: "number", min: "0" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Total (cents)" }), _jsx(Input, { ...form.register("totalCents"), type: "number", min: "0" })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Issue Date" }), _jsx(DatePicker, { value: form.watch("issueDate") || null, onChange: (nextValue) => form.setValue("issueDate", nextValue ?? "", {
124
+ }) })] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.invoiceDialog.fields.subtotalCents }), _jsx(Input, { ...form.register("subtotalCents"), type: "number", min: "0" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.invoiceDialog.fields.taxCents }), _jsx(Input, { ...form.register("taxCents"), type: "number", min: "0" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.invoiceDialog.fields.totalCents }), _jsx(Input, { ...form.register("totalCents"), type: "number", min: "0" })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.invoiceDialog.fields.issueDate }), _jsx(DatePicker, { value: form.watch("issueDate") || null, onChange: (nextValue) => form.setValue("issueDate", nextValue ?? "", {
124
125
  shouldDirty: true,
125
126
  shouldValidate: true,
126
- }), placeholder: "Pick issue date", className: "w-full" }), form.formState.errors.issueDate ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.issueDate.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Due Date" }), _jsx(DatePicker, { value: form.watch("dueDate") || null, onChange: (nextValue) => form.setValue("dueDate", nextValue ?? "", {
127
+ }), placeholder: messages.invoiceDialog.placeholders.issueDate, className: "w-full" }), form.formState.errors.issueDate ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.issueDate.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.invoiceDialog.fields.dueDate }), _jsx(DatePicker, { value: form.watch("dueDate") || null, onChange: (nextValue) => form.setValue("dueDate", nextValue ?? "", {
127
128
  shouldDirty: true,
128
129
  shouldValidate: true,
129
- }), placeholder: "Pick due date", className: "w-full" }), form.formState.errors.dueDate ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.dueDate.message })) : null] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Notes" }), _jsx(Textarea, { ...form.register("notes"), placeholder: "Invoice notes..." })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }), _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, isEditing ? "Save Changes" : "Create Invoice"] })] })] })] }) }));
130
+ }), placeholder: messages.invoiceDialog.placeholders.dueDate, className: "w-full" }), form.formState.errors.dueDate ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.dueDate.message })) : null] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.invoiceDialog.fields.notes }), _jsx(Textarea, { ...form.register("notes"), placeholder: messages.invoiceDialog.placeholders.notes })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: messages.common.cancel }), _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, isEditing ? messages.common.saveChanges : messages.invoiceDialog.actions.create] })] })] })] }) }));
130
131
  }
@@ -1 +1 @@
1
- {"version":3,"file":"supplier-payment-dialog.d.ts","sourceRoot":"","sources":["../../src/components/supplier-payment-dialog.tsx"],"names":[],"mappings":"AAyCA,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAiBD,wBAAgB,qBAAqB,CAAC,EACpC,IAAI,EACJ,YAAY,EACZ,SAAS,GACV,EAAE,0BAA0B,2CA6L5B"}
1
+ {"version":3,"file":"supplier-payment-dialog.d.ts","sourceRoot":"","sources":["../../src/components/supplier-payment-dialog.tsx"],"names":[],"mappings":"AAoDA,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,IAAI,EACJ,YAAY,EACZ,SAAS,GACV,EAAE,0BAA0B,2CAqN5B"}
@@ -8,39 +8,35 @@ import { Loader2 } from "lucide-react";
8
8
  import { useEffect } from "react";
9
9
  import { useForm } from "react-hook-form";
10
10
  import { z } from "zod/v4";
11
- const supplierPaymentFormSchema = z.object({
12
- bookingId: z.string().min(1, "Booking ID is required"),
13
- supplierId: z.string().optional().nullable(),
14
- amountCents: z.coerce.number().int().min(1, "Amount must be at least 1"),
15
- currency: z.string().min(3).max(3),
16
- paymentMethod: z.enum(["bank_transfer", "credit_card", "cash", "cheque", "other"]),
17
- status: z.enum(["pending", "completed", "failed", "refunded"]),
18
- referenceNumber: z.string().optional().nullable(),
19
- paymentDate: z.string().min(1, "Payment date is required"),
20
- notes: z.string().optional().nullable(),
21
- });
22
- const PAYMENT_METHODS = [
23
- { value: "bank_transfer", label: "Bank Transfer" },
24
- { value: "credit_card", label: "Credit Card" },
25
- { value: "cash", label: "Cash" },
26
- { value: "cheque", label: "Cheque" },
27
- { value: "other", label: "Other" },
28
- ];
29
- const PAYMENT_STATUSES = [
30
- { value: "pending", label: "Pending" },
31
- { value: "completed", label: "Completed" },
32
- { value: "failed", label: "Failed" },
33
- { value: "refunded", label: "Refunded" },
34
- ];
11
+ import { useFinanceUiMessagesOrDefault } from "../i18n";
12
+ import { supplierPaymentMethods, supplierPaymentStatuses } from "../i18n/messages";
13
+ function createSupplierPaymentFormSchema(messages) {
14
+ return z.object({
15
+ bookingId: z.string().min(1, messages.supplierPaymentDialog.validation.bookingIdRequired),
16
+ supplierId: z.string().optional().nullable(),
17
+ amountCents: z.coerce
18
+ .number()
19
+ .int()
20
+ .min(1, messages.supplierPaymentDialog.validation.amountMinimum),
21
+ currency: z.string().min(3).max(3),
22
+ paymentMethod: z.enum(supplierPaymentMethods),
23
+ status: z.enum(supplierPaymentStatuses),
24
+ referenceNumber: z.string().optional().nullable(),
25
+ paymentDate: z.string().min(1, messages.supplierPaymentDialog.validation.paymentDateRequired),
26
+ notes: z.string().optional().nullable(),
27
+ });
28
+ }
35
29
  export function SupplierPaymentDialog({ open, onOpenChange, onSuccess, }) {
36
30
  const { create } = useSupplierPaymentMutation();
31
+ const messages = useFinanceUiMessagesOrDefault();
32
+ const supplierPaymentFormSchema = createSupplierPaymentFormSchema(messages);
37
33
  const form = useForm({
38
34
  resolver: zodResolver(supplierPaymentFormSchema),
39
35
  defaultValues: {
40
36
  bookingId: "",
41
37
  supplierId: "",
42
38
  amountCents: 0,
43
- currency: "EUR",
39
+ currency: "EUR", // i18n-literal-ok domain default currency
44
40
  paymentMethod: "bank_transfer",
45
41
  status: "completed",
46
42
  referenceNumber: "",
@@ -55,7 +51,7 @@ export function SupplierPaymentDialog({ open, onOpenChange, onSuccess, }) {
55
51
  bookingId: "",
56
52
  supplierId: "",
57
53
  amountCents: 0,
58
- currency: "EUR",
54
+ currency: "EUR", // i18n-literal-ok domain default currency
59
55
  paymentMethod: "bank_transfer",
60
56
  status: "completed",
61
57
  referenceNumber: "",
@@ -79,11 +75,17 @@ export function SupplierPaymentDialog({ open, onOpenChange, onSuccess, }) {
79
75
  onOpenChange(false);
80
76
  onSuccess?.();
81
77
  };
82
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { size: "lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Record Supplier Payment" }) }), _jsxs("form", { onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(DialogBody, { className: "grid gap-4", children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Booking ID" }), _jsx(Input, { ...form.register("bookingId"), placeholder: "book_..." }), form.formState.errors.bookingId ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.bookingId.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Supplier ID (optional)" }), _jsx(Input, { ...form.register("supplierId"), placeholder: "supp_..." })] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Amount (cents)" }), _jsx(Input, { ...form.register("amountCents"), type: "number", min: "1" }), form.formState.errors.amountCents ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.amountCents.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Currency" }), _jsx(CurrencyCombobox, { value: form.watch("currency") || null, onChange: (next) => form.setValue("currency", next ?? "EUR", {
78
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { size: "lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: messages.supplierPaymentDialog.title }) }), _jsxs("form", { onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(DialogBody, { className: "grid gap-4", children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.bookingId }), _jsx(Input, { ...form.register("bookingId"), placeholder: messages.supplierPaymentDialog.placeholders.bookingId }), form.formState.errors.bookingId ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.bookingId.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.supplierId }), _jsx(Input, { ...form.register("supplierId"), placeholder: messages.supplierPaymentDialog.placeholders.supplierId })] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.amountCents }), _jsx(Input, { ...form.register("amountCents"), type: "number", min: "1" }), form.formState.errors.amountCents ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.amountCents.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.currency }), _jsx(CurrencyCombobox, { value: form.watch("currency") || null, onChange: (next) => form.setValue("currency", next ?? "EUR" /* i18n-literal-ok domain default currency */, {
83
79
  shouldValidate: true,
84
80
  shouldDirty: true,
85
- }) })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Payment Date" }), _jsx(DatePicker, { value: form.watch("paymentDate") || null, onChange: (next) => form.setValue("paymentDate", next ?? "", {
81
+ }) })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.paymentDate }), _jsx(DatePicker, { value: form.watch("paymentDate") || null, onChange: (next) => form.setValue("paymentDate", next ?? "", {
86
82
  shouldValidate: true,
87
83
  shouldDirty: true,
88
- }), placeholder: "Select payment date", className: "w-full" }), form.formState.errors.paymentDate ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.paymentDate.message })) : null] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Payment Method" }), _jsxs(Select, { items: PAYMENT_METHODS, value: form.watch("paymentMethod"), onValueChange: (value) => form.setValue("paymentMethod", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: PAYMENT_METHODS.map((method) => (_jsx(SelectItem, { value: method.value, children: method.label }, method.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Status" }), _jsxs(Select, { items: PAYMENT_STATUSES, value: form.watch("status"), onValueChange: (value) => form.setValue("status", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: PAYMENT_STATUSES.map((status) => (_jsx(SelectItem, { value: status.value, children: status.label }, status.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Reference Number" }), _jsx(Input, { ...form.register("referenceNumber"), placeholder: "TXN-12345" })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Notes" }), _jsx(Textarea, { ...form.register("notes"), placeholder: "Payment notes..." })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }), _jsxs(Button, { type: "submit", disabled: create.isPending, children: [create.isPending ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, "Record Payment"] })] })] })] }) }));
84
+ }), placeholder: messages.supplierPaymentDialog.placeholders.paymentDate, className: "w-full" }), form.formState.errors.paymentDate ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.paymentDate.message })) : null] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.paymentMethod }), _jsxs(Select, { items: supplierPaymentMethods.map((value) => ({
85
+ label: messages.common.supplierPaymentMethodLabels[value],
86
+ value,
87
+ })), value: form.watch("paymentMethod"), onValueChange: (value) => form.setValue("paymentMethod", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: supplierPaymentMethods.map((method) => (_jsx(SelectItem, { value: method, children: messages.common.supplierPaymentMethodLabels[method] }, method))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.status }), _jsxs(Select, { items: supplierPaymentStatuses.map((value) => ({
88
+ label: messages.common.supplierPaymentStatusLabels[value],
89
+ value,
90
+ })), value: form.watch("status"), onValueChange: (value) => form.setValue("status", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: supplierPaymentStatuses.map((status) => (_jsx(SelectItem, { value: status, children: messages.common.supplierPaymentStatusLabels[status] }, status))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.referenceNumber }), _jsx(Input, { ...form.register("referenceNumber"), placeholder: messages.supplierPaymentDialog.placeholders.referenceNumber })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.supplierPaymentDialog.fields.notes }), _jsx(Textarea, { ...form.register("notes"), placeholder: messages.supplierPaymentDialog.placeholders.notes })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: messages.common.cancel }), _jsxs(Button, { type: "submit", disabled: create.isPending, children: [create.isPending ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, messages.supplierPaymentDialog.actions.create] })] })] })] }) }));
89
91
  }
@@ -0,0 +1,92 @@
1
+ export declare const financeUiEn: {
2
+ common: {
3
+ cancel: string;
4
+ saveChanges: string;
5
+ invoiceStatusLabels: {
6
+ draft: string;
7
+ sent: string;
8
+ partially_paid: string;
9
+ paid: string;
10
+ overdue: string;
11
+ void: string;
12
+ };
13
+ supplierPaymentMethodLabels: {
14
+ bank_transfer: string;
15
+ credit_card: string;
16
+ cash: string;
17
+ cheque: string;
18
+ other: string;
19
+ };
20
+ supplierPaymentStatusLabels: {
21
+ pending: string;
22
+ completed: string;
23
+ failed: string;
24
+ refunded: string;
25
+ };
26
+ };
27
+ invoiceDialog: {
28
+ titles: {
29
+ create: string;
30
+ edit: string;
31
+ };
32
+ fields: {
33
+ invoiceNumber: string;
34
+ status: string;
35
+ bookingId: string;
36
+ currency: string;
37
+ subtotalCents: string;
38
+ taxCents: string;
39
+ totalCents: string;
40
+ issueDate: string;
41
+ dueDate: string;
42
+ notes: string;
43
+ };
44
+ placeholders: {
45
+ invoiceNumber: string;
46
+ bookingId: string;
47
+ issueDate: string;
48
+ dueDate: string;
49
+ notes: string;
50
+ };
51
+ actions: {
52
+ create: string;
53
+ };
54
+ validation: {
55
+ invoiceNumberRequired: string;
56
+ bookingIdRequired: string;
57
+ currencyIsoCode: string;
58
+ issueDateRequired: string;
59
+ dueDateRequired: string;
60
+ };
61
+ };
62
+ supplierPaymentDialog: {
63
+ title: string;
64
+ fields: {
65
+ bookingId: string;
66
+ supplierId: string;
67
+ amountCents: string;
68
+ currency: string;
69
+ paymentDate: string;
70
+ paymentMethod: string;
71
+ status: string;
72
+ referenceNumber: string;
73
+ notes: string;
74
+ };
75
+ placeholders: {
76
+ bookingId: string;
77
+ supplierId: string;
78
+ paymentDate: string;
79
+ referenceNumber: string;
80
+ notes: string;
81
+ };
82
+ actions: {
83
+ create: string;
84
+ };
85
+ validation: {
86
+ bookingIdRequired: string;
87
+ amountMinimum: string;
88
+ paymentDateRequired: string;
89
+ };
90
+ };
91
+ };
92
+ //# sourceMappingURL=en.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0FK,CAAA"}
@@ -0,0 +1,91 @@
1
+ export const financeUiEn = {
2
+ common: {
3
+ cancel: "Cancel",
4
+ saveChanges: "Save Changes",
5
+ invoiceStatusLabels: {
6
+ draft: "Draft",
7
+ sent: "Sent",
8
+ partially_paid: "Partially Paid",
9
+ paid: "Paid",
10
+ overdue: "Overdue",
11
+ void: "Void",
12
+ },
13
+ supplierPaymentMethodLabels: {
14
+ bank_transfer: "Bank Transfer",
15
+ credit_card: "Credit Card",
16
+ cash: "Cash",
17
+ cheque: "Cheque",
18
+ other: "Other",
19
+ },
20
+ supplierPaymentStatusLabels: {
21
+ pending: "Pending",
22
+ completed: "Completed",
23
+ failed: "Failed",
24
+ refunded: "Refunded",
25
+ },
26
+ },
27
+ invoiceDialog: {
28
+ titles: {
29
+ create: "New Invoice",
30
+ edit: "Edit Invoice",
31
+ },
32
+ fields: {
33
+ invoiceNumber: "Invoice Number",
34
+ status: "Status",
35
+ bookingId: "Booking ID",
36
+ currency: "Currency",
37
+ subtotalCents: "Subtotal (cents)",
38
+ taxCents: "Tax (cents)",
39
+ totalCents: "Total (cents)",
40
+ issueDate: "Issue Date",
41
+ dueDate: "Due Date",
42
+ notes: "Notes",
43
+ },
44
+ placeholders: {
45
+ invoiceNumber: "INV-2025-1234",
46
+ bookingId: "book_...",
47
+ issueDate: "Pick issue date",
48
+ dueDate: "Pick due date",
49
+ notes: "Invoice notes...",
50
+ },
51
+ actions: {
52
+ create: "Create Invoice",
53
+ },
54
+ validation: {
55
+ invoiceNumberRequired: "Invoice number is required",
56
+ bookingIdRequired: "Booking ID is required",
57
+ currencyIsoCode: "Use 3-letter ISO code",
58
+ issueDateRequired: "Issue date is required",
59
+ dueDateRequired: "Due date is required",
60
+ },
61
+ },
62
+ supplierPaymentDialog: {
63
+ title: "Record Supplier Payment",
64
+ fields: {
65
+ bookingId: "Booking ID",
66
+ supplierId: "Supplier ID (optional)",
67
+ amountCents: "Amount (cents)",
68
+ currency: "Currency",
69
+ paymentDate: "Payment Date",
70
+ paymentMethod: "Payment Method",
71
+ status: "Status",
72
+ referenceNumber: "Reference Number",
73
+ notes: "Notes",
74
+ },
75
+ placeholders: {
76
+ bookingId: "book_...",
77
+ supplierId: "supp_...",
78
+ paymentDate: "Select payment date",
79
+ referenceNumber: "TXN-12345",
80
+ notes: "Payment notes...",
81
+ },
82
+ actions: {
83
+ create: "Record Payment",
84
+ },
85
+ validation: {
86
+ bookingIdRequired: "Booking ID is required",
87
+ amountMinimum: "Amount must be at least 1",
88
+ paymentDateRequired: "Payment date is required",
89
+ },
90
+ },
91
+ };
@@ -0,0 +1,5 @@
1
+ export { financeUiEn } from "./en";
2
+ export type { FinanceUiMessages, InvoiceStatus, SupplierPaymentMethod, SupplierPaymentStatus, } from "./messages";
3
+ export { type FinanceUiMessageOverrides, FinanceUiMessagesProvider, financeUiMessageDefinitions, getFinanceUiI18n, resolveFinanceUiMessages, useFinanceUiI18n, useFinanceUiI18nOrDefault, useFinanceUiMessages, useFinanceUiMessagesOrDefault, } from "./provider";
4
+ export { financeUiRo } from "./ro";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAClC,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,KAAK,yBAAyB,EAC9B,yBAAyB,EACzB,2BAA2B,EAC3B,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { financeUiEn } from "./en";
2
+ export { FinanceUiMessagesProvider, financeUiMessageDefinitions, getFinanceUiI18n, resolveFinanceUiMessages, useFinanceUiI18n, useFinanceUiI18nOrDefault, useFinanceUiMessages, useFinanceUiMessagesOrDefault, } from "./provider";
3
+ export { financeUiRo } from "./ro";
@@ -0,0 +1,81 @@
1
+ import type { InvoiceRecord, SupplierPaymentRecord } from "@voyantjs/finance-react";
2
+ export declare const invoiceStatuses: readonly ["draft", "sent", "partially_paid", "paid", "overdue", "void"];
3
+ export declare const supplierPaymentMethods: readonly ["bank_transfer", "credit_card", "cash", "cheque", "other"];
4
+ export declare const supplierPaymentStatuses: readonly ["pending", "completed", "failed", "refunded"];
5
+ export type InvoiceStatus = InvoiceRecord["status"];
6
+ export type SupplierPaymentMethod = (typeof supplierPaymentMethods)[number];
7
+ export type SupplierPaymentStatus = SupplierPaymentRecord["status"];
8
+ export type FinanceUiMessages = {
9
+ common: {
10
+ cancel: string;
11
+ saveChanges: string;
12
+ invoiceStatusLabels: Record<InvoiceStatus, string>;
13
+ supplierPaymentMethodLabels: Record<SupplierPaymentMethod, string>;
14
+ supplierPaymentStatusLabels: Record<SupplierPaymentStatus, string>;
15
+ };
16
+ invoiceDialog: {
17
+ titles: {
18
+ create: string;
19
+ edit: string;
20
+ };
21
+ fields: {
22
+ invoiceNumber: string;
23
+ status: string;
24
+ bookingId: string;
25
+ currency: string;
26
+ subtotalCents: string;
27
+ taxCents: string;
28
+ totalCents: string;
29
+ issueDate: string;
30
+ dueDate: string;
31
+ notes: string;
32
+ };
33
+ placeholders: {
34
+ invoiceNumber: string;
35
+ bookingId: string;
36
+ issueDate: string;
37
+ dueDate: string;
38
+ notes: string;
39
+ };
40
+ actions: {
41
+ create: string;
42
+ };
43
+ validation: {
44
+ invoiceNumberRequired: string;
45
+ bookingIdRequired: string;
46
+ currencyIsoCode: string;
47
+ issueDateRequired: string;
48
+ dueDateRequired: string;
49
+ };
50
+ };
51
+ supplierPaymentDialog: {
52
+ title: string;
53
+ fields: {
54
+ bookingId: string;
55
+ supplierId: string;
56
+ amountCents: string;
57
+ currency: string;
58
+ paymentDate: string;
59
+ paymentMethod: string;
60
+ status: string;
61
+ referenceNumber: string;
62
+ notes: string;
63
+ };
64
+ placeholders: {
65
+ bookingId: string;
66
+ supplierId: string;
67
+ paymentDate: string;
68
+ referenceNumber: string;
69
+ notes: string;
70
+ };
71
+ actions: {
72
+ create: string;
73
+ };
74
+ validation: {
75
+ bookingIdRequired: string;
76
+ amountMinimum: string;
77
+ paymentDateRequired: string;
78
+ };
79
+ };
80
+ };
81
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/i18n/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAEnF,eAAO,MAAM,eAAe,yEAOlB,CAAA;AAEV,eAAO,MAAM,sBAAsB,sEAMzB,CAAA;AAEV,eAAO,MAAM,uBAAuB,yDAA0D,CAAA;AAE9F,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;AACnD,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AAC3E,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAA;AAEnE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAA;QACd,WAAW,EAAE,MAAM,CAAA;QACnB,mBAAmB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;QAClD,2BAA2B,EAAE,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA;QAClE,2BAA2B,EAAE,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA;KACnE,CAAA;IACD,aAAa,EAAE;QACb,MAAM,EAAE;YACN,MAAM,EAAE,MAAM,CAAA;YACd,IAAI,EAAE,MAAM,CAAA;SACb,CAAA;QACD,MAAM,EAAE;YACN,aAAa,EAAE,MAAM,CAAA;YACrB,MAAM,EAAE,MAAM,CAAA;YACd,SAAS,EAAE,MAAM,CAAA;YACjB,QAAQ,EAAE,MAAM,CAAA;YAChB,aAAa,EAAE,MAAM,CAAA;YACrB,QAAQ,EAAE,MAAM,CAAA;YAChB,UAAU,EAAE,MAAM,CAAA;YAClB,SAAS,EAAE,MAAM,CAAA;YACjB,OAAO,EAAE,MAAM,CAAA;YACf,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,YAAY,EAAE;YACZ,aAAa,EAAE,MAAM,CAAA;YACrB,SAAS,EAAE,MAAM,CAAA;YACjB,SAAS,EAAE,MAAM,CAAA;YACjB,OAAO,EAAE,MAAM,CAAA;YACf,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,OAAO,EAAE;YACP,MAAM,EAAE,MAAM,CAAA;SACf,CAAA;QACD,UAAU,EAAE;YACV,qBAAqB,EAAE,MAAM,CAAA;YAC7B,iBAAiB,EAAE,MAAM,CAAA;YACzB,eAAe,EAAE,MAAM,CAAA;YACvB,iBAAiB,EAAE,MAAM,CAAA;YACzB,eAAe,EAAE,MAAM,CAAA;SACxB,CAAA;KACF,CAAA;IACD,qBAAqB,EAAE;QACrB,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,EAAE;YACN,SAAS,EAAE,MAAM,CAAA;YACjB,UAAU,EAAE,MAAM,CAAA;YAClB,WAAW,EAAE,MAAM,CAAA;YACnB,QAAQ,EAAE,MAAM,CAAA;YAChB,WAAW,EAAE,MAAM,CAAA;YACnB,aAAa,EAAE,MAAM,CAAA;YACrB,MAAM,EAAE,MAAM,CAAA;YACd,eAAe,EAAE,MAAM,CAAA;YACvB,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,YAAY,EAAE;YACZ,SAAS,EAAE,MAAM,CAAA;YACjB,UAAU,EAAE,MAAM,CAAA;YAClB,WAAW,EAAE,MAAM,CAAA;YACnB,eAAe,EAAE,MAAM,CAAA;YACvB,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,OAAO,EAAE;YACP,MAAM,EAAE,MAAM,CAAA;SACf,CAAA;QACD,UAAU,EAAE;YACV,iBAAiB,EAAE,MAAM,CAAA;YACzB,aAAa,EAAE,MAAM,CAAA;YACrB,mBAAmB,EAAE,MAAM,CAAA;SAC5B,CAAA;KACF,CAAA;CACF,CAAA"}
@@ -0,0 +1,16 @@
1
+ export const invoiceStatuses = [
2
+ "draft",
3
+ "sent",
4
+ "partially_paid",
5
+ "paid",
6
+ "overdue",
7
+ "void",
8
+ ];
9
+ export const supplierPaymentMethods = [
10
+ "bank_transfer",
11
+ "credit_card",
12
+ "cash",
13
+ "cheque",
14
+ "other",
15
+ ];
16
+ export const supplierPaymentStatuses = ["pending", "completed", "failed", "refunded"];
@@ -0,0 +1,206 @@
1
+ import { type LocaleMessageOverrides, type PackageI18nValue } from "@voyantjs/i18n";
2
+ import type { ReactNode } from "react";
3
+ import type { FinanceUiMessages } from "./messages";
4
+ export declare const financeUiMessageDefinitions: {
5
+ en: {
6
+ common: {
7
+ cancel: string;
8
+ saveChanges: string;
9
+ invoiceStatusLabels: {
10
+ draft: string;
11
+ sent: string;
12
+ partially_paid: string;
13
+ paid: string;
14
+ overdue: string;
15
+ void: string;
16
+ };
17
+ supplierPaymentMethodLabels: {
18
+ bank_transfer: string;
19
+ credit_card: string;
20
+ cash: string;
21
+ cheque: string;
22
+ other: string;
23
+ };
24
+ supplierPaymentStatusLabels: {
25
+ pending: string;
26
+ completed: string;
27
+ failed: string;
28
+ refunded: string;
29
+ };
30
+ };
31
+ invoiceDialog: {
32
+ titles: {
33
+ create: string;
34
+ edit: string;
35
+ };
36
+ fields: {
37
+ invoiceNumber: string;
38
+ status: string;
39
+ bookingId: string;
40
+ currency: string;
41
+ subtotalCents: string;
42
+ taxCents: string;
43
+ totalCents: string;
44
+ issueDate: string;
45
+ dueDate: string;
46
+ notes: string;
47
+ };
48
+ placeholders: {
49
+ invoiceNumber: string;
50
+ bookingId: string;
51
+ issueDate: string;
52
+ dueDate: string;
53
+ notes: string;
54
+ };
55
+ actions: {
56
+ create: string;
57
+ };
58
+ validation: {
59
+ invoiceNumberRequired: string;
60
+ bookingIdRequired: string;
61
+ currencyIsoCode: string;
62
+ issueDateRequired: string;
63
+ dueDateRequired: string;
64
+ };
65
+ };
66
+ supplierPaymentDialog: {
67
+ title: string;
68
+ fields: {
69
+ bookingId: string;
70
+ supplierId: string;
71
+ amountCents: string;
72
+ currency: string;
73
+ paymentDate: string;
74
+ paymentMethod: string;
75
+ status: string;
76
+ referenceNumber: string;
77
+ notes: string;
78
+ };
79
+ placeholders: {
80
+ bookingId: string;
81
+ supplierId: string;
82
+ paymentDate: string;
83
+ referenceNumber: string;
84
+ notes: string;
85
+ };
86
+ actions: {
87
+ create: string;
88
+ };
89
+ validation: {
90
+ bookingIdRequired: string;
91
+ amountMinimum: string;
92
+ paymentDateRequired: string;
93
+ };
94
+ };
95
+ };
96
+ ro: {
97
+ common: {
98
+ cancel: string;
99
+ saveChanges: string;
100
+ invoiceStatusLabels: {
101
+ draft: string;
102
+ sent: string;
103
+ partially_paid: string;
104
+ paid: string;
105
+ overdue: string;
106
+ void: string;
107
+ };
108
+ supplierPaymentMethodLabels: {
109
+ bank_transfer: string;
110
+ credit_card: string;
111
+ cash: string;
112
+ cheque: string;
113
+ other: string;
114
+ };
115
+ supplierPaymentStatusLabels: {
116
+ pending: string;
117
+ completed: string;
118
+ failed: string;
119
+ refunded: string;
120
+ };
121
+ };
122
+ invoiceDialog: {
123
+ titles: {
124
+ create: string;
125
+ edit: string;
126
+ };
127
+ fields: {
128
+ invoiceNumber: string;
129
+ status: string;
130
+ bookingId: string;
131
+ currency: string;
132
+ subtotalCents: string;
133
+ taxCents: string;
134
+ totalCents: string;
135
+ issueDate: string;
136
+ dueDate: string;
137
+ notes: string;
138
+ };
139
+ placeholders: {
140
+ invoiceNumber: string;
141
+ bookingId: string;
142
+ issueDate: string;
143
+ dueDate: string;
144
+ notes: string;
145
+ };
146
+ actions: {
147
+ create: string;
148
+ };
149
+ validation: {
150
+ invoiceNumberRequired: string;
151
+ bookingIdRequired: string;
152
+ currencyIsoCode: string;
153
+ issueDateRequired: string;
154
+ dueDateRequired: string;
155
+ };
156
+ };
157
+ supplierPaymentDialog: {
158
+ title: string;
159
+ fields: {
160
+ bookingId: string;
161
+ supplierId: string;
162
+ amountCents: string;
163
+ currency: string;
164
+ paymentDate: string;
165
+ paymentMethod: string;
166
+ status: string;
167
+ referenceNumber: string;
168
+ notes: string;
169
+ };
170
+ placeholders: {
171
+ bookingId: string;
172
+ supplierId: string;
173
+ paymentDate: string;
174
+ referenceNumber: string;
175
+ notes: string;
176
+ };
177
+ actions: {
178
+ create: string;
179
+ };
180
+ validation: {
181
+ bookingIdRequired: string;
182
+ amountMinimum: string;
183
+ paymentDateRequired: string;
184
+ };
185
+ };
186
+ };
187
+ };
188
+ export type FinanceUiMessageOverrides = LocaleMessageOverrides<FinanceUiMessages>;
189
+ export declare function resolveFinanceUiMessages({ locale, overrides, }: {
190
+ locale: string | null | undefined;
191
+ overrides?: FinanceUiMessageOverrides | null;
192
+ }): FinanceUiMessages;
193
+ export declare function getFinanceUiI18n({ locale, overrides, }: {
194
+ locale?: string | null | undefined;
195
+ overrides?: FinanceUiMessageOverrides | null;
196
+ }): PackageI18nValue<FinanceUiMessages>;
197
+ export declare function FinanceUiMessagesProvider({ children, locale, overrides, }: {
198
+ children: ReactNode;
199
+ locale: string | null | undefined;
200
+ overrides?: FinanceUiMessageOverrides | null;
201
+ }): import("react/jsx-runtime").JSX.Element;
202
+ export declare const useFinanceUiI18n: () => PackageI18nValue<FinanceUiMessages>;
203
+ export declare const useFinanceUiMessages: () => FinanceUiMessages;
204
+ export declare function useFinanceUiI18nOrDefault(): PackageI18nValue<FinanceUiMessages>;
205
+ export declare function useFinanceUiMessagesOrDefault(): FinanceUiMessages;
206
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/i18n/provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EAEtB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAKnD,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGe,CAAA;AAEvD,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,CAAC,iBAAiB,CAAC,CAAA;AASjF,wBAAgB,wBAAwB,CAAC,EACvC,MAAM,EACN,SAAS,GACV,EAAE;IACD,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACjC,SAAS,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAA;CAC7C,qBAOA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,SAAS,GACV,EAAE;IACD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAClC,SAAS,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAA;CAC7C,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CAStC;AAED,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,MAAM,EACN,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACjC,SAAS,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAA;CAC7C,2CAWA;AAED,eAAO,MAAM,gBAAgB,2CAA2B,CAAA;AACxD,eAAO,MAAM,oBAAoB,yBAA+B,CAAA;AAEhE,wBAAgB,yBAAyB,wCAExC;AAED,wBAAgB,6BAA6B,sBAE5C"}
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createLocaleFormatters, createPackageMessagesContext, resolvePackageMessages, } from "@voyantjs/i18n";
4
+ import { financeUiEn } from "./en";
5
+ import { financeUiRo } from "./ro";
6
+ const fallbackLocale = "en";
7
+ export const financeUiMessageDefinitions = {
8
+ en: financeUiEn,
9
+ ro: financeUiRo,
10
+ };
11
+ const financeUiContext = createPackageMessagesContext("FinanceUiMessages");
12
+ const defaultFinanceUiI18n = {
13
+ messages: financeUiEn,
14
+ ...createLocaleFormatters(fallbackLocale),
15
+ };
16
+ export function resolveFinanceUiMessages({ locale, overrides, }) {
17
+ return resolvePackageMessages({
18
+ definitions: financeUiMessageDefinitions,
19
+ fallbackLocale,
20
+ locale,
21
+ overrides,
22
+ });
23
+ }
24
+ export function getFinanceUiI18n({ locale, overrides, }) {
25
+ const resolvedLocale = locale ?? fallbackLocale;
26
+ return {
27
+ messages: resolveFinanceUiMessages({
28
+ locale: resolvedLocale,
29
+ overrides,
30
+ }),
31
+ ...createLocaleFormatters(resolvedLocale),
32
+ };
33
+ }
34
+ export function FinanceUiMessagesProvider({ children, locale, overrides, }) {
35
+ return (_jsx(financeUiContext.ResolvedMessagesProvider, { definitions: financeUiMessageDefinitions, fallbackLocale: fallbackLocale, locale: locale, overrides: overrides, children: children }));
36
+ }
37
+ export const useFinanceUiI18n = financeUiContext.useI18n;
38
+ export const useFinanceUiMessages = financeUiContext.useMessages;
39
+ export function useFinanceUiI18nOrDefault() {
40
+ return financeUiContext.useOptionalI18n() ?? defaultFinanceUiI18n;
41
+ }
42
+ export function useFinanceUiMessagesOrDefault() {
43
+ return useFinanceUiI18nOrDefault().messages;
44
+ }
@@ -0,0 +1,92 @@
1
+ export declare const financeUiRo: {
2
+ common: {
3
+ cancel: string;
4
+ saveChanges: string;
5
+ invoiceStatusLabels: {
6
+ draft: string;
7
+ sent: string;
8
+ partially_paid: string;
9
+ paid: string;
10
+ overdue: string;
11
+ void: string;
12
+ };
13
+ supplierPaymentMethodLabels: {
14
+ bank_transfer: string;
15
+ credit_card: string;
16
+ cash: string;
17
+ cheque: string;
18
+ other: string;
19
+ };
20
+ supplierPaymentStatusLabels: {
21
+ pending: string;
22
+ completed: string;
23
+ failed: string;
24
+ refunded: string;
25
+ };
26
+ };
27
+ invoiceDialog: {
28
+ titles: {
29
+ create: string;
30
+ edit: string;
31
+ };
32
+ fields: {
33
+ invoiceNumber: string;
34
+ status: string;
35
+ bookingId: string;
36
+ currency: string;
37
+ subtotalCents: string;
38
+ taxCents: string;
39
+ totalCents: string;
40
+ issueDate: string;
41
+ dueDate: string;
42
+ notes: string;
43
+ };
44
+ placeholders: {
45
+ invoiceNumber: string;
46
+ bookingId: string;
47
+ issueDate: string;
48
+ dueDate: string;
49
+ notes: string;
50
+ };
51
+ actions: {
52
+ create: string;
53
+ };
54
+ validation: {
55
+ invoiceNumberRequired: string;
56
+ bookingIdRequired: string;
57
+ currencyIsoCode: string;
58
+ issueDateRequired: string;
59
+ dueDateRequired: string;
60
+ };
61
+ };
62
+ supplierPaymentDialog: {
63
+ title: string;
64
+ fields: {
65
+ bookingId: string;
66
+ supplierId: string;
67
+ amountCents: string;
68
+ currency: string;
69
+ paymentDate: string;
70
+ paymentMethod: string;
71
+ status: string;
72
+ referenceNumber: string;
73
+ notes: string;
74
+ };
75
+ placeholders: {
76
+ bookingId: string;
77
+ supplierId: string;
78
+ paymentDate: string;
79
+ referenceNumber: string;
80
+ notes: string;
81
+ };
82
+ actions: {
83
+ create: string;
84
+ };
85
+ validation: {
86
+ bookingIdRequired: string;
87
+ amountMinimum: string;
88
+ paymentDateRequired: string;
89
+ };
90
+ };
91
+ };
92
+ //# sourceMappingURL=ro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ro.d.ts","sourceRoot":"","sources":["../../src/i18n/ro.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0FK,CAAA"}
@@ -0,0 +1,91 @@
1
+ export const financeUiRo = {
2
+ common: {
3
+ cancel: "Anuleaza",
4
+ saveChanges: "Salveaza Modificarile",
5
+ invoiceStatusLabels: {
6
+ draft: "Ciorna",
7
+ sent: "Trimisa",
8
+ partially_paid: "Platita Partial",
9
+ paid: "Platita",
10
+ overdue: "Scadenta Depasita",
11
+ void: "Anulata",
12
+ },
13
+ supplierPaymentMethodLabels: {
14
+ bank_transfer: "Transfer Bancar",
15
+ credit_card: "Card de Credit",
16
+ cash: "Numerar",
17
+ cheque: "Cec",
18
+ other: "Altul",
19
+ },
20
+ supplierPaymentStatusLabels: {
21
+ pending: "In asteptare",
22
+ completed: "Finalizata",
23
+ failed: "Esuata",
24
+ refunded: "Rambursata",
25
+ },
26
+ },
27
+ invoiceDialog: {
28
+ titles: {
29
+ create: "Factura Noua",
30
+ edit: "Editeaza Factura",
31
+ },
32
+ fields: {
33
+ invoiceNumber: "Numar Factura",
34
+ status: "Status",
35
+ bookingId: "ID Rezervare",
36
+ currency: "Moneda",
37
+ subtotalCents: "Subtotal (centi)",
38
+ taxCents: "Taxa (centi)",
39
+ totalCents: "Total (centi)",
40
+ issueDate: "Data Emiterii",
41
+ dueDate: "Data Scadentei",
42
+ notes: "Note",
43
+ },
44
+ placeholders: {
45
+ invoiceNumber: "INV-2025-1234",
46
+ bookingId: "book_...",
47
+ issueDate: "Alege data emiterii",
48
+ dueDate: "Alege data scadentei",
49
+ notes: "Note factura...",
50
+ },
51
+ actions: {
52
+ create: "Creeaza Factura",
53
+ },
54
+ validation: {
55
+ invoiceNumberRequired: "Numarul facturii este obligatoriu",
56
+ bookingIdRequired: "ID-ul rezervarii este obligatoriu",
57
+ currencyIsoCode: "Foloseste cod ISO din 3 litere",
58
+ issueDateRequired: "Data emiterii este obligatorie",
59
+ dueDateRequired: "Data scadentei este obligatorie",
60
+ },
61
+ },
62
+ supplierPaymentDialog: {
63
+ title: "Inregistreaza Plata Furnizorului",
64
+ fields: {
65
+ bookingId: "ID Rezervare",
66
+ supplierId: "ID Furnizor (optional)",
67
+ amountCents: "Suma (centi)",
68
+ currency: "Moneda",
69
+ paymentDate: "Data Platii",
70
+ paymentMethod: "Metoda de Plata",
71
+ status: "Status",
72
+ referenceNumber: "Numar Referinta",
73
+ notes: "Note",
74
+ },
75
+ placeholders: {
76
+ bookingId: "book_...",
77
+ supplierId: "supp_...",
78
+ paymentDate: "Selecteaza data platii",
79
+ referenceNumber: "TXN-12345",
80
+ notes: "Note plata...",
81
+ },
82
+ actions: {
83
+ create: "Inregistreaza Plata",
84
+ },
85
+ validation: {
86
+ bookingIdRequired: "ID-ul rezervarii este obligatoriu",
87
+ amountMinimum: "Suma trebuie sa fie cel putin 1",
88
+ paymentDateRequired: "Data platii este obligatorie",
89
+ },
90
+ },
91
+ };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { InvoiceDialog, type InvoiceDialogProps } from "./components/invoice-dialog";
2
2
  export { SupplierPaymentDialog, type SupplierPaymentDialogProps, } from "./components/supplier-payment-dialog";
3
+ export { type FinanceUiMessageOverrides, type FinanceUiMessages, FinanceUiMessagesProvider, financeUiEn, financeUiMessageDefinitions, financeUiRo, getFinanceUiI18n, resolveFinanceUiMessages, useFinanceUiI18n, useFinanceUiI18nOrDefault, useFinanceUiMessages, useFinanceUiMessagesOrDefault, } from "./i18n";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AACpF,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,sCAAsC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AACpF,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,yBAAyB,EACzB,WAAW,EACX,2BAA2B,EAC3B,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,QAAQ,CAAA"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { InvoiceDialog } from "./components/invoice-dialog";
2
2
  export { SupplierPaymentDialog, } from "./components/supplier-payment-dialog";
3
+ export { FinanceUiMessagesProvider, financeUiEn, financeUiMessageDefinitions, financeUiRo, getFinanceUiI18n, resolveFinanceUiMessages, useFinanceUiI18n, useFinanceUiI18nOrDefault, useFinanceUiMessages, useFinanceUiMessagesOrDefault, } from "./i18n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/finance-ui",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "license": "FSL-1.1-Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,6 +14,18 @@
14
14
  "types": "./dist/index.d.ts",
15
15
  "import": "./dist/index.js"
16
16
  },
17
+ "./i18n": {
18
+ "types": "./dist/i18n/index.d.ts",
19
+ "import": "./dist/i18n/index.js"
20
+ },
21
+ "./i18n/en": {
22
+ "types": "./dist/i18n/en.d.ts",
23
+ "import": "./dist/i18n/en.js"
24
+ },
25
+ "./i18n/ro": {
26
+ "types": "./dist/i18n/ro.d.ts",
27
+ "import": "./dist/i18n/ro.js"
28
+ },
17
29
  "./components/*": {
18
30
  "types": "./dist/components/*.d.ts",
19
31
  "import": "./dist/components/*.js"
@@ -24,9 +36,12 @@
24
36
  "react": "^19.0.0",
25
37
  "react-dom": "^19.0.0",
26
38
  "react-hook-form": "^7.60.0",
27
- "zod": "^3.25.76",
28
- "@voyantjs/finance-react": "0.16.0",
29
- "@voyantjs/ui": "0.16.0"
39
+ "zod": "^4.3.6",
40
+ "@voyantjs/finance-react": "0.17.0",
41
+ "@voyantjs/ui": "0.17.0"
42
+ },
43
+ "dependencies": {
44
+ "@voyantjs/i18n": "0.17.0"
30
45
  },
31
46
  "devDependencies": {
32
47
  "@tanstack/react-query": "^5.96.2",
@@ -38,10 +53,11 @@
38
53
  "react-hook-form": "^7.60.0",
39
54
  "typescript": "^6.0.2",
40
55
  "vitest": "^4.1.2",
41
- "zod": "^3.25.76",
42
- "@voyantjs/finance-react": "0.16.0",
56
+ "zod": "^4.3.6",
57
+ "@voyantjs/finance-react": "0.17.0",
58
+ "@voyantjs/i18n": "0.17.0",
43
59
  "@voyantjs/voyant-typescript-config": "0.1.0",
44
- "@voyantjs/ui": "0.16.0"
60
+ "@voyantjs/ui": "0.17.0"
45
61
  },
46
62
  "files": [
47
63
  "dist"