@voyantjs/legal-ui 0.77.13 → 0.79.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 +23 -0
- package/dist/components/contract-dialog.d.ts +71 -0
- package/dist/components/contract-dialog.d.ts.map +1 -0
- package/dist/components/contract-dialog.js +569 -0
- package/dist/i18n/en.d.ts +66 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +66 -0
- package/dist/i18n/messages.d.ts +66 -0
- package/dist/i18n/messages.d.ts.map +1 -1
- package/dist/i18n/provider.d.ts +132 -0
- package/dist/i18n/provider.d.ts.map +1 -1
- package/dist/i18n/ro.d.ts +66 -0
- package/dist/i18n/ro.d.ts.map +1 -1
- package/dist/i18n/ro.js +66 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -19,6 +19,29 @@ keeping the default tab navigation. Use `detailsContent`, `partiesContent`,
|
|
|
19
19
|
`signaturesContent`, or `documentsContent` when an app needs custom inline
|
|
20
20
|
management controls instead of the shipped read-only table.
|
|
21
21
|
|
|
22
|
+
## Contract Dialog
|
|
23
|
+
|
|
24
|
+
`ContractDialog` provides the default create/edit form for `ContractsPage` and
|
|
25
|
+
`ContractDetailPage`. It owns contract setup, template and version selection,
|
|
26
|
+
number series, expiry, template variables, additional variables, metadata, and
|
|
27
|
+
submit wiring. Linked record pickers stay optional render props so apps can
|
|
28
|
+
wire CRM, supplier, or distribution selectors without `legal-ui` taking those
|
|
29
|
+
runtime dependencies.
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { ContractDialog, ContractsPage } from "@voyantjs/legal-ui"
|
|
33
|
+
|
|
34
|
+
<ContractsPage
|
|
35
|
+
renderContractDialog={(props) => (
|
|
36
|
+
<ContractDialog
|
|
37
|
+
{...props}
|
|
38
|
+
renderPersonPicker={(pickerProps) => <PersonPicker {...pickerProps} />}
|
|
39
|
+
renderOrganizationPicker={(pickerProps) => <OrganizationPicker {...pickerProps} />}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
42
|
+
/>
|
|
43
|
+
```
|
|
44
|
+
|
|
22
45
|
## I18n
|
|
23
46
|
|
|
24
47
|
Components render English by default. To localize them, wrap your UI in
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type LegalContractRecord } from "@voyantjs/legal-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { z } from "zod/v4";
|
|
4
|
+
import { type LegalContractScope } from "../i18n/messages.js";
|
|
5
|
+
declare const contractFormSchema: z.ZodObject<{
|
|
6
|
+
scope: z.ZodEnum<{
|
|
7
|
+
other: "other";
|
|
8
|
+
customer: "customer";
|
|
9
|
+
supplier: "supplier";
|
|
10
|
+
partner: "partner";
|
|
11
|
+
channel: "channel";
|
|
12
|
+
}>;
|
|
13
|
+
title: z.ZodString;
|
|
14
|
+
contractNumber: z.ZodOptional<z.ZodString>;
|
|
15
|
+
language: z.ZodOptional<z.ZodString>;
|
|
16
|
+
templateVersionId: z.ZodOptional<z.ZodString>;
|
|
17
|
+
seriesId: z.ZodOptional<z.ZodString>;
|
|
18
|
+
personId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
supplierId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
channelId: z.ZodOptional<z.ZodString>;
|
|
22
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
23
|
+
templateVariables: z.ZodArray<z.ZodObject<{
|
|
24
|
+
key: z.ZodString;
|
|
25
|
+
label: z.ZodString;
|
|
26
|
+
type: z.ZodString;
|
|
27
|
+
description: z.ZodOptional<z.ZodString>;
|
|
28
|
+
example: z.ZodOptional<z.ZodString>;
|
|
29
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
value: z.ZodOptional<z.ZodString>;
|
|
31
|
+
booleanValue: z.ZodDefault<z.ZodBoolean>;
|
|
32
|
+
includeBooleanValue: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
additionalVariables: z.ZodArray<z.ZodObject<{
|
|
35
|
+
key: z.ZodOptional<z.ZodString>;
|
|
36
|
+
value: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
metadataEntries: z.ZodArray<z.ZodObject<{
|
|
39
|
+
key: z.ZodOptional<z.ZodString>;
|
|
40
|
+
value: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
type FormValues = z.input<typeof contractFormSchema>;
|
|
44
|
+
type TemplateVariableRow = FormValues["templateVariables"][number];
|
|
45
|
+
export interface LinkedRecordPickerProps {
|
|
46
|
+
value: string | undefined;
|
|
47
|
+
onChange: (id: string | undefined) => void;
|
|
48
|
+
scope: LegalContractScope;
|
|
49
|
+
}
|
|
50
|
+
export interface ContractDialogProps {
|
|
51
|
+
open: boolean;
|
|
52
|
+
onOpenChange: (open: boolean) => void;
|
|
53
|
+
contract?: LegalContractRecord;
|
|
54
|
+
onSuccess: () => void;
|
|
55
|
+
renderPersonPicker?: (props: LinkedRecordPickerProps) => ReactNode;
|
|
56
|
+
renderOrganizationPicker?: (props: LinkedRecordPickerProps) => ReactNode;
|
|
57
|
+
renderSupplierPicker?: (props: LinkedRecordPickerProps) => ReactNode;
|
|
58
|
+
renderChannelPicker?: (props: LinkedRecordPickerProps) => ReactNode;
|
|
59
|
+
}
|
|
60
|
+
export declare function buildRecordFromPairs(entries: Array<{
|
|
61
|
+
key?: string;
|
|
62
|
+
value?: string;
|
|
63
|
+
}>): Record<string, unknown> | undefined;
|
|
64
|
+
export declare function buildVariablesPayload(rows: TemplateVariableRow[], additional: Array<{
|
|
65
|
+
key?: string;
|
|
66
|
+
value?: string;
|
|
67
|
+
}>): Record<string, unknown> | undefined;
|
|
68
|
+
export declare function clearedOptionalValue(value: string | undefined, isEditing: boolean): string | null | undefined;
|
|
69
|
+
export declare function ContractDialog({ open, onOpenChange, contract, onSuccess, renderPersonPicker, renderOrganizationPicker, renderSupplierPicker, renderChannelPicker, }: ContractDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=contract-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-dialog.d.ts","sourceRoot":"","sources":["../../src/components/contract-dialog.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,mBAAmB,EAUzB,MAAM,uBAAuB,CAAA;AAgC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAG1B,OAAO,EAAE,KAAK,kBAAkB,EAAuB,MAAM,qBAAqB,CAAA;AAIlF,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqCtB,CAAA;AAEF,KAAK,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEpD,KAAK,mBAAmB,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAA;AAElE,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAA;IAC1C,KAAK,EAAE,kBAAkB,CAAA;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,QAAQ,CAAC,EAAE,mBAAmB,CAAA;IAC9B,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,kBAAkB,CAAC,EAAE,CAA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