@voyantjs/identity-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
@@ -12,6 +12,20 @@ pnpm add @voyantjs/identity-ui @voyantjs/identity-react @voyantjs/ui @tanstack/r
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
14
 
15
+ ## I18n
16
+
17
+ Components render English by default. To localize them, wrap your UI in
18
+ `IdentityUiMessagesProvider` and import only the locales your app supports.
19
+
20
+ ```tsx
21
+ import { IdentityUiMessagesProvider } from "@voyantjs/identity-ui"
22
+ import { identityUiEn } from "@voyantjs/identity-ui/i18n/en"
23
+ import { identityUiRo } from "@voyantjs/identity-ui/i18n/ro"
24
+ ```
25
+
26
+ English-only apps should import only `./i18n/en`. Bilingual apps can import
27
+ `./i18n/en` and `./i18n/ro`.
28
+
15
29
  ## Not included (registry-only)
16
30
 
17
31
  Some components couple to TanStack Router or template-local helpers and remain available only via the shadcn registry: `identity-page`. Import via `npx shadcn add @voyant/<component>` and customize per-project.
@@ -1 +1 @@
1
- {"version":3,"file":"address-dialog.d.ts","sourceRoot":"","sources":["../../src/components/address-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,0BAA0B,CAAA;AA2DjC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;CAC7C;AAED,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE,kBAAkB,2CAuMpB"}
1
+ {"version":3,"file":"address-dialog.d.ts","sourceRoot":"","sources":["../../src/components/address-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,0BAA0B,CAAA;AAgEjC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;CAC7C;AAED,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE,kBAAkB,2CAiNpB"}
@@ -8,6 +8,7 @@ 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
+ import { useIdentityUiMessagesOrDefault } from "../i18n";
11
12
  const ADDRESS_LABELS = [
12
13
  "primary",
13
14
  "billing",
@@ -19,24 +20,28 @@ const ADDRESS_LABELS = [
19
20
  "other",
20
21
  ];
21
22
  const numOrEmpty = z.coerce.number().optional().or(z.literal("")).nullable();
22
- const formSchema = z.object({
23
- label: z.enum(ADDRESS_LABELS),
24
- fullText: z.string().optional().nullable(),
25
- line1: z.string().optional().nullable(),
26
- line2: z.string().optional().nullable(),
27
- city: z.string().optional().nullable(),
28
- region: z.string().optional().nullable(),
29
- postalCode: z.string().optional().nullable(),
30
- country: z.string().optional().nullable(),
31
- latitude: numOrEmpty,
32
- longitude: numOrEmpty,
33
- timezone: z.string().optional().nullable(),
34
- isPrimary: z.boolean(),
35
- notes: z.string().optional().nullable(),
36
- });
23
+ function createFormSchema() {
24
+ return z.object({
25
+ label: z.enum(ADDRESS_LABELS),
26
+ fullText: z.string().optional().nullable(),
27
+ line1: z.string().optional().nullable(),
28
+ line2: z.string().optional().nullable(),
29
+ city: z.string().optional().nullable(),
30
+ region: z.string().optional().nullable(),
31
+ postalCode: z.string().optional().nullable(),
32
+ country: z.string().optional().nullable(),
33
+ latitude: numOrEmpty,
34
+ longitude: numOrEmpty,
35
+ timezone: z.string().optional().nullable(),
36
+ isPrimary: z.boolean(),
37
+ notes: z.string().optional().nullable(),
38
+ });
39
+ }
37
40
  export function AddressDialog({ open, onOpenChange, entityType, entityId, address, onSuccess, }) {
38
41
  const isEditing = Boolean(address);
39
42
  const { create, update } = useAddressMutation();
43
+ const messages = useIdentityUiMessagesOrDefault();
44
+ const formSchema = createFormSchema();
40
45
  const form = useForm({
41
46
  resolver: zodResolver(formSchema),
42
47
  defaultValues: {
@@ -118,5 +123,8 @@ export function AddressDialog({ open, onOpenChange, entityType, entityId, addres
118
123
  onSuccess?.(saved);
119
124
  };
120
125
  const isSubmitting = form.formState.isSubmitting || create.isPending || update.isPending;
121
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { size: "lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing ? "Edit Address" : "Add Address" }) }), _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: "Label" }), _jsxs(Select, { items: ADDRESS_LABELS.map((x) => ({ label: x.replace(/_/g, " "), value: x })), value: form.watch("label"), onValueChange: (value) => form.setValue("label", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: ADDRESS_LABELS.map((label) => (_jsx(SelectItem, { value: label, className: "capitalize", children: label }, label))) })] })] }), _jsxs("div", { className: "flex items-center gap-2 self-end pb-1", children: [_jsx(Switch, { checked: form.watch("isPrimary"), onCheckedChange: (value) => form.setValue("isPrimary", value) }), _jsx(Label, { children: "Primary" })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Line 1" }), _jsx(Input, { ...form.register("line1") })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Line 2" }), _jsx(Input, { ...form.register("line2") })] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-3", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "City" }), _jsx(Input, { ...form.register("city") })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Region" }), _jsx(Input, { ...form.register("region") })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Postal code" }), _jsx(Input, { ...form.register("postalCode") })] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-3", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Country" }), _jsx(CountryCombobox, { value: form.watch("country") ?? null, onChange: (code) => form.setValue("country", code) })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Timezone" }), _jsx(Input, { ...form.register("timezone"), placeholder: "Europe/Istanbul" })] }), _jsx("div", {})] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Latitude" }), _jsx(Input, { ...form.register("latitude"), type: "number", step: "any" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Longitude" }), _jsx(Input, { ...form.register("longitude"), type: "number", step: "any" })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Notes" }), _jsx(Textarea, { ...form.register("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" : "Add Address"] })] })] })] }) }));
126
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { size: "lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing ? messages.addressDialog.titles.edit : messages.addressDialog.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.addressDialog.fields.label }), _jsxs(Select, { items: ADDRESS_LABELS.map((x) => ({
127
+ label: messages.common.addressLabelLabels[x],
128
+ value: x,
129
+ })), value: form.watch("label"), onValueChange: (value) => form.setValue("label", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: ADDRESS_LABELS.map((label) => (_jsx(SelectItem, { value: label, children: messages.common.addressLabelLabels[label] }, label))) })] })] }), _jsxs("div", { className: "flex items-center gap-2 self-end pb-1", children: [_jsx(Switch, { checked: form.watch("isPrimary"), onCheckedChange: (value) => form.setValue("isPrimary", value) }), _jsx(Label, { children: messages.common.primary })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.addressDialog.fields.line1 }), _jsx(Input, { ...form.register("line1") })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.addressDialog.fields.line2 }), _jsx(Input, { ...form.register("line2") })] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-3", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.addressDialog.fields.city }), _jsx(Input, { ...form.register("city") })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.addressDialog.fields.region }), _jsx(Input, { ...form.register("region") })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.addressDialog.fields.postalCode }), _jsx(Input, { ...form.register("postalCode") })] })] }), _jsxs("div", { className: "grid grid-cols-3 gap-3", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.addressDialog.fields.country }), _jsx(CountryCombobox, { value: form.watch("country") ?? null, onChange: (code) => form.setValue("country", code) })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.addressDialog.fields.timezone }), _jsx(Input, { ...form.register("timezone"), placeholder: messages.addressDialog.placeholders.timezone })] }), _jsx("div", {})] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.addressDialog.fields.latitude }), _jsx(Input, { ...form.register("latitude"), type: "number", step: "any" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.addressDialog.fields.longitude }), _jsx(Input, { ...form.register("longitude"), type: "number", step: "any" })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.addressDialog.fields.notes }), _jsx(Textarea, { ...form.register("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.addressDialog.actions.create] })] })] })] }) }));
122
130
  }
@@ -1 +1 @@
1
- {"version":3,"file":"contact-point-dialog.d.ts","sourceRoot":"","sources":["../../src/components/contact-point-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,0BAA0B,CAAA;AAkDjC,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,SAAS,CAAC,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,IAAI,CAAA;CACvD;AAED,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,SAAS,GACV,EAAE,uBAAuB,2CAoHzB"}
1
+ {"version":3,"file":"contact-point-dialog.d.ts","sourceRoot":"","sources":["../../src/components/contact-point-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,0BAA0B,CAAA;AAuDjC,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,SAAS,CAAC,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,IAAI,CAAA;CACvD;AAED,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,SAAS,GACV,EAAE,uBAAuB,2CAgIzB"}
@@ -7,6 +7,7 @@ import { Loader2 } from "lucide-react";
7
7
  import { useEffect } from "react";
8
8
  import { useForm } from "react-hook-form";
9
9
  import { z } from "zod/v4";
10
+ import { useIdentityUiMessagesOrDefault } from "../i18n";
10
11
  const CONTACT_POINT_KINDS = [
11
12
  "email",
12
13
  "phone",
@@ -18,16 +19,20 @@ const CONTACT_POINT_KINDS = [
18
19
  "social",
19
20
  "other",
20
21
  ];
21
- const formSchema = z.object({
22
- kind: z.enum(CONTACT_POINT_KINDS),
23
- label: z.string().optional().nullable(),
24
- value: z.string().min(1, "Value is required").max(500),
25
- isPrimary: z.boolean(),
26
- notes: z.string().optional().nullable(),
27
- });
22
+ function createFormSchema(messages) {
23
+ return z.object({
24
+ kind: z.enum(CONTACT_POINT_KINDS),
25
+ label: z.string().optional().nullable(),
26
+ value: z.string().min(1, messages.contactPointDialog.validation.valueRequired).max(500),
27
+ isPrimary: z.boolean(),
28
+ notes: z.string().optional().nullable(),
29
+ });
30
+ }
28
31
  export function ContactPointDialog({ open, onOpenChange, entityType, entityId, contactPoint, onSuccess, }) {
29
32
  const isEditing = Boolean(contactPoint);
30
33
  const { create, update } = useContactPointMutation();
34
+ const messages = useIdentityUiMessagesOrDefault();
35
+ const formSchema = createFormSchema(messages);
31
36
  const form = useForm({
32
37
  resolver: zodResolver(formSchema),
33
38
  defaultValues: { kind: "email", label: "", value: "", isPrimary: false, notes: "" },
@@ -64,8 +69,10 @@ export function ContactPointDialog({ open, onOpenChange, entityType, entityId, c
64
69
  onSuccess?.(saved);
65
70
  };
66
71
  const isSubmitting = form.formState.isSubmitting || create.isPending || update.isPending;
67
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing ? "Edit Contact Point" : "Add Contact Point" }) }), _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: "Kind" }), _jsxs(Select, { items: CONTACT_POINT_KINDS.map((x) => ({
68
- label: x.replace(/_/g, " "),
72
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing
73
+ ? messages.contactPointDialog.titles.edit
74
+ : messages.contactPointDialog.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.contactPointDialog.fields.kind }), _jsxs(Select, { items: CONTACT_POINT_KINDS.map((x) => ({
75
+ label: messages.common.contactPointKindLabels[x],
69
76
  value: x,
70
- })), value: form.watch("kind"), onValueChange: (value) => form.setValue("kind", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: CONTACT_POINT_KINDS.map((kind) => (_jsx(SelectItem, { value: kind, className: "capitalize", children: kind }, kind))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Label" }), _jsx(Input, { ...form.register("label"), placeholder: "work, personal..." })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Value" }), _jsx(Input, { ...form.register("value"), placeholder: "name@example.com" }), form.formState.errors.value ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.value.message })) : null] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Switch, { checked: form.watch("isPrimary"), onCheckedChange: (value) => form.setValue("isPrimary", value) }), _jsx(Label, { children: "Primary" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Notes" }), _jsx(Textarea, { ...form.register("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" : "Add Contact Point"] })] })] })] }) }));
77
+ })), value: form.watch("kind"), onValueChange: (value) => form.setValue("kind", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: CONTACT_POINT_KINDS.map((kind) => (_jsx(SelectItem, { value: kind, children: messages.common.contactPointKindLabels[kind] }, kind))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.contactPointDialog.fields.label }), _jsx(Input, { ...form.register("label"), placeholder: messages.contactPointDialog.placeholders.label })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.contactPointDialog.fields.value }), _jsx(Input, { ...form.register("value"), placeholder: messages.contactPointDialog.placeholders.value }), form.formState.errors.value ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.value.message })) : null] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Switch, { checked: form.watch("isPrimary"), onCheckedChange: (value) => form.setValue("isPrimary", value) }), _jsx(Label, { children: messages.common.primary })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.contactPointDialog.fields.notes }), _jsx(Textarea, { ...form.register("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.contactPointDialog.actions.create] })] })] })] }) }));
71
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"named-contact-dialog.d.ts","sourceRoot":"","sources":["../../src/components/named-contact-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,kBAAkB,EAGxB,MAAM,0BAA0B,CAAA;AAqDjC,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,SAAS,CAAC,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,IAAI,CAAA;CACvD;AAED,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,SAAS,GACV,EAAE,uBAAuB,2CAoJzB"}
1
+ {"version":3,"file":"named-contact-dialog.d.ts","sourceRoot":"","sources":["../../src/components/named-contact-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,kBAAkB,EAGxB,MAAM,0BAA0B,CAAA;AA0DjC,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,SAAS,CAAC,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,IAAI,CAAA;CACvD;AAED,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,SAAS,GACV,EAAE,uBAAuB,2CAmKzB"}
@@ -7,6 +7,7 @@ import { Loader2 } from "lucide-react";
7
7
  import { useEffect } from "react";
8
8
  import { useForm } from "react-hook-form";
9
9
  import { z } from "zod/v4";
10
+ import { useIdentityUiMessagesOrDefault } from "../i18n";
10
11
  const NAMED_CONTACT_ROLES = [
11
12
  "general",
12
13
  "primary",
@@ -19,18 +20,22 @@ const NAMED_CONTACT_ROLES = [
19
20
  "legal",
20
21
  "other",
21
22
  ];
22
- const formSchema = z.object({
23
- role: z.enum(NAMED_CONTACT_ROLES),
24
- name: z.string().min(1, "Name is required").max(255),
25
- title: z.string().optional().nullable(),
26
- email: z.string().optional().nullable(),
27
- phone: z.string().optional().nullable(),
28
- isPrimary: z.boolean(),
29
- notes: z.string().optional().nullable(),
30
- });
23
+ function createFormSchema(messages) {
24
+ return z.object({
25
+ role: z.enum(NAMED_CONTACT_ROLES),
26
+ name: z.string().min(1, messages.namedContactDialog.validation.nameRequired).max(255),
27
+ title: z.string().optional().nullable(),
28
+ email: z.string().optional().nullable(),
29
+ phone: z.string().optional().nullable(),
30
+ isPrimary: z.boolean(),
31
+ notes: z.string().optional().nullable(),
32
+ });
33
+ }
31
34
  export function NamedContactDialog({ open, onOpenChange, entityType, entityId, namedContact, onSuccess, }) {
32
35
  const isEditing = Boolean(namedContact);
33
36
  const { create, update } = useNamedContactMutation();
37
+ const messages = useIdentityUiMessagesOrDefault();
38
+ const formSchema = createFormSchema(messages);
34
39
  const form = useForm({
35
40
  resolver: zodResolver(formSchema),
36
41
  defaultValues: {
@@ -87,8 +92,10 @@ export function NamedContactDialog({ open, onOpenChange, entityType, entityId, n
87
92
  onSuccess?.(saved);
88
93
  };
89
94
  const isSubmitting = form.formState.isSubmitting || create.isPending || update.isPending;
90
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing ? "Edit Named Contact" : "Add Named Contact" }) }), _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: "Role" }), _jsxs(Select, { items: NAMED_CONTACT_ROLES.map((x) => ({
91
- label: x.replace(/_/g, " "),
95
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing
96
+ ? messages.namedContactDialog.titles.edit
97
+ : messages.namedContactDialog.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.namedContactDialog.fields.role }), _jsxs(Select, { items: NAMED_CONTACT_ROLES.map((x) => ({
98
+ label: messages.common.namedContactRoleLabels[x],
92
99
  value: x,
93
- })), value: form.watch("role"), onValueChange: (value) => form.setValue("role", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: NAMED_CONTACT_ROLES.map((role) => (_jsx(SelectItem, { value: role, className: "capitalize", children: role.replace(/_/g, " ") }, role))) })] })] }), _jsxs("div", { className: "flex items-center gap-2 self-end pb-1", children: [_jsx(Switch, { checked: form.watch("isPrimary"), onCheckedChange: (value) => form.setValue("isPrimary", value) }), _jsx(Label, { children: "Primary" })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Name" }), _jsx(Input, { ...form.register("name"), placeholder: "Jane Doe" }), form.formState.errors.name ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.name.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Title" }), _jsx(Input, { ...form.register("title"), placeholder: "Director of Sales" })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Email" }), _jsx(Input, { ...form.register("email"), placeholder: "jane@example.com" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Phone" }), _jsx(Input, { ...form.register("phone") })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: "Notes" }), _jsx(Textarea, { ...form.register("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" : "Add Named Contact"] })] })] })] }) }));
100
+ })), value: form.watch("role"), onValueChange: (value) => form.setValue("role", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: NAMED_CONTACT_ROLES.map((role) => (_jsx(SelectItem, { value: role, children: messages.common.namedContactRoleLabels[role] }, role))) })] })] }), _jsxs("div", { className: "flex items-center gap-2 self-end pb-1", children: [_jsx(Switch, { checked: form.watch("isPrimary"), onCheckedChange: (value) => form.setValue("isPrimary", value) }), _jsx(Label, { children: messages.common.primary })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.namedContactDialog.fields.name }), _jsx(Input, { ...form.register("name"), placeholder: messages.namedContactDialog.placeholders.name }), form.formState.errors.name ? (_jsx("p", { className: "text-xs text-destructive", children: form.formState.errors.name.message })) : null] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.namedContactDialog.fields.title }), _jsx(Input, { ...form.register("title"), placeholder: messages.namedContactDialog.placeholders.title })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.namedContactDialog.fields.email }), _jsx(Input, { ...form.register("email"), placeholder: messages.namedContactDialog.placeholders.email })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.namedContactDialog.fields.phone }), _jsx(Input, { ...form.register("phone") })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: messages.namedContactDialog.fields.notes }), _jsx(Textarea, { ...form.register("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.namedContactDialog.actions.create] })] })] })] }) }));
94
101
  }
@@ -0,0 +1,113 @@
1
+ export declare const identityUiEn: {
2
+ common: {
3
+ cancel: string;
4
+ saveChanges: string;
5
+ primary: string;
6
+ addressLabelLabels: {
7
+ primary: string;
8
+ billing: string;
9
+ shipping: string;
10
+ mailing: string;
11
+ meeting: string;
12
+ service: string;
13
+ legal: string;
14
+ other: string;
15
+ };
16
+ contactPointKindLabels: {
17
+ email: string;
18
+ phone: string;
19
+ mobile: string;
20
+ whatsapp: string;
21
+ website: string;
22
+ sms: string;
23
+ fax: string;
24
+ social: string;
25
+ other: string;
26
+ };
27
+ namedContactRoleLabels: {
28
+ general: string;
29
+ primary: string;
30
+ reservations: string;
31
+ operations: string;
32
+ front_desk: string;
33
+ sales: string;
34
+ emergency: string;
35
+ accounting: string;
36
+ legal: string;
37
+ other: string;
38
+ };
39
+ };
40
+ addressDialog: {
41
+ titles: {
42
+ create: string;
43
+ edit: string;
44
+ };
45
+ fields: {
46
+ label: string;
47
+ line1: string;
48
+ line2: string;
49
+ city: string;
50
+ region: string;
51
+ postalCode: string;
52
+ country: string;
53
+ timezone: string;
54
+ latitude: string;
55
+ longitude: string;
56
+ notes: string;
57
+ };
58
+ placeholders: {
59
+ timezone: string;
60
+ };
61
+ actions: {
62
+ create: string;
63
+ };
64
+ };
65
+ contactPointDialog: {
66
+ titles: {
67
+ create: string;
68
+ edit: string;
69
+ };
70
+ fields: {
71
+ kind: string;
72
+ label: string;
73
+ value: string;
74
+ notes: string;
75
+ };
76
+ placeholders: {
77
+ label: string;
78
+ value: string;
79
+ };
80
+ actions: {
81
+ create: string;
82
+ };
83
+ validation: {
84
+ valueRequired: string;
85
+ };
86
+ };
87
+ namedContactDialog: {
88
+ titles: {
89
+ create: string;
90
+ edit: string;
91
+ };
92
+ fields: {
93
+ role: string;
94
+ name: string;
95
+ title: string;
96
+ email: string;
97
+ phone: string;
98
+ notes: string;
99
+ };
100
+ placeholders: {
101
+ name: string;
102
+ title: string;
103
+ email: string;
104
+ };
105
+ actions: {
106
+ create: string;
107
+ };
108
+ validation: {
109
+ nameRequired: string;
110
+ };
111
+ };
112
+ };
113
+ //# 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,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GK,CAAA"}
@@ -0,0 +1,112 @@
1
+ export const identityUiEn = {
2
+ common: {
3
+ cancel: "Cancel",
4
+ saveChanges: "Save Changes",
5
+ primary: "Primary",
6
+ addressLabelLabels: {
7
+ primary: "Primary",
8
+ billing: "Billing",
9
+ shipping: "Shipping",
10
+ mailing: "Mailing",
11
+ meeting: "Meeting",
12
+ service: "Service",
13
+ legal: "Legal",
14
+ other: "Other",
15
+ },
16
+ contactPointKindLabels: {
17
+ email: "Email",
18
+ phone: "Phone",
19
+ mobile: "Mobile",
20
+ whatsapp: "WhatsApp",
21
+ website: "Website",
22
+ sms: "SMS",
23
+ fax: "Fax",
24
+ social: "Social",
25
+ other: "Other",
26
+ },
27
+ namedContactRoleLabels: {
28
+ general: "General",
29
+ primary: "Primary",
30
+ reservations: "Reservations",
31
+ operations: "Operations",
32
+ front_desk: "Front desk",
33
+ sales: "Sales",
34
+ emergency: "Emergency",
35
+ accounting: "Accounting",
36
+ legal: "Legal",
37
+ other: "Other",
38
+ },
39
+ },
40
+ addressDialog: {
41
+ titles: {
42
+ create: "Add Address",
43
+ edit: "Edit Address",
44
+ },
45
+ fields: {
46
+ label: "Label",
47
+ line1: "Line 1",
48
+ line2: "Line 2",
49
+ city: "City",
50
+ region: "Region",
51
+ postalCode: "Postal code",
52
+ country: "Country",
53
+ timezone: "Timezone",
54
+ latitude: "Latitude",
55
+ longitude: "Longitude",
56
+ notes: "Notes",
57
+ },
58
+ placeholders: {
59
+ timezone: "Europe/Istanbul",
60
+ },
61
+ actions: {
62
+ create: "Add Address",
63
+ },
64
+ },
65
+ contactPointDialog: {
66
+ titles: {
67
+ create: "Add Contact Point",
68
+ edit: "Edit Contact Point",
69
+ },
70
+ fields: {
71
+ kind: "Kind",
72
+ label: "Label",
73
+ value: "Value",
74
+ notes: "Notes",
75
+ },
76
+ placeholders: {
77
+ label: "work, personal...",
78
+ value: "name@example.com",
79
+ },
80
+ actions: {
81
+ create: "Add Contact Point",
82
+ },
83
+ validation: {
84
+ valueRequired: "Value is required",
85
+ },
86
+ },
87
+ namedContactDialog: {
88
+ titles: {
89
+ create: "Add Named Contact",
90
+ edit: "Edit Named Contact",
91
+ },
92
+ fields: {
93
+ role: "Role",
94
+ name: "Name",
95
+ title: "Title",
96
+ email: "Email",
97
+ phone: "Phone",
98
+ notes: "Notes",
99
+ },
100
+ placeholders: {
101
+ name: "Jane Doe",
102
+ title: "Director of Sales",
103
+ email: "jane@example.com",
104
+ },
105
+ actions: {
106
+ create: "Add Named Contact",
107
+ },
108
+ validation: {
109
+ nameRequired: "Name is required",
110
+ },
111
+ },
112
+ };
@@ -0,0 +1,5 @@
1
+ export { identityUiEn } from "./en";
2
+ export type { AddressLabel, ContactPointKind, IdentityUiMessages, NamedContactRole, } from "./messages";
3
+ export { getIdentityUiI18n, type IdentityUiMessageOverrides, IdentityUiMessagesProvider, identityUiMessageDefinitions, resolveIdentityUiMessages, useIdentityUiI18n, useIdentityUiI18nOrDefault, useIdentityUiMessages, useIdentityUiMessagesOrDefault, } from "./provider";
4
+ export { identityUiRo } 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,YAAY,EAAE,MAAM,MAAM,CAAA;AACnC,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,iBAAiB,EACjB,KAAK,0BAA0B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { identityUiEn } from "./en";
2
+ export { getIdentityUiI18n, IdentityUiMessagesProvider, identityUiMessageDefinitions, resolveIdentityUiMessages, useIdentityUiI18n, useIdentityUiI18nOrDefault, useIdentityUiMessages, useIdentityUiMessagesOrDefault, } from "./provider";
3
+ export { identityUiRo } from "./ro";
@@ -0,0 +1,87 @@
1
+ import type { AddressRecord, ContactPointRecord, NamedContactRecord } from "@voyantjs/identity-react";
2
+ export type AddressLabel = AddressRecord["label"];
3
+ export type ContactPointKind = ContactPointRecord["kind"];
4
+ export type NamedContactRole = NamedContactRecord["role"];
5
+ export type IdentityUiMessages = {
6
+ common: {
7
+ cancel: string;
8
+ saveChanges: string;
9
+ primary: string;
10
+ addressLabelLabels: Record<AddressLabel, string>;
11
+ contactPointKindLabels: Record<ContactPointKind, string>;
12
+ namedContactRoleLabels: Record<NamedContactRole, string>;
13
+ };
14
+ addressDialog: {
15
+ titles: {
16
+ create: string;
17
+ edit: string;
18
+ };
19
+ fields: {
20
+ label: string;
21
+ line1: string;
22
+ line2: string;
23
+ city: string;
24
+ region: string;
25
+ postalCode: string;
26
+ country: string;
27
+ timezone: string;
28
+ latitude: string;
29
+ longitude: string;
30
+ notes: string;
31
+ };
32
+ placeholders: {
33
+ timezone: string;
34
+ };
35
+ actions: {
36
+ create: string;
37
+ };
38
+ };
39
+ contactPointDialog: {
40
+ titles: {
41
+ create: string;
42
+ edit: string;
43
+ };
44
+ fields: {
45
+ kind: string;
46
+ label: string;
47
+ value: string;
48
+ notes: string;
49
+ };
50
+ placeholders: {
51
+ label: string;
52
+ value: string;
53
+ };
54
+ actions: {
55
+ create: string;
56
+ };
57
+ validation: {
58
+ valueRequired: string;
59
+ };
60
+ };
61
+ namedContactDialog: {
62
+ titles: {
63
+ create: string;
64
+ edit: string;
65
+ };
66
+ fields: {
67
+ role: string;
68
+ name: string;
69
+ title: string;
70
+ email: string;
71
+ phone: string;
72
+ notes: string;
73
+ };
74
+ placeholders: {
75
+ name: string;
76
+ title: string;
77
+ email: string;
78
+ };
79
+ actions: {
80
+ create: string;
81
+ };
82
+ validation: {
83
+ nameRequired: string;
84
+ };
85
+ };
86
+ };
87
+ //# 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,EACV,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,0BAA0B,CAAA;AAEjC,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;AACjD,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;AACzD,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;AAEzD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAA;QACd,WAAW,EAAE,MAAM,CAAA;QACnB,OAAO,EAAE,MAAM,CAAA;QACf,kBAAkB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;QAChD,sBAAsB,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;QACxD,sBAAsB,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;KACzD,CAAA;IACD,aAAa,EAAE;QACb,MAAM,EAAE;YACN,MAAM,EAAE,MAAM,CAAA;YACd,IAAI,EAAE,MAAM,CAAA;SACb,CAAA;QACD,MAAM,EAAE;YACN,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;YACb,IAAI,EAAE,MAAM,CAAA;YACZ,MAAM,EAAE,MAAM,CAAA;YACd,UAAU,EAAE,MAAM,CAAA;YAClB,OAAO,EAAE,MAAM,CAAA;YACf,QAAQ,EAAE,MAAM,CAAA;YAChB,QAAQ,EAAE,MAAM,CAAA;YAChB,SAAS,EAAE,MAAM,CAAA;YACjB,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,YAAY,EAAE;YACZ,QAAQ,EAAE,MAAM,CAAA;SACjB,CAAA;QACD,OAAO,EAAE;YACP,MAAM,EAAE,MAAM,CAAA;SACf,CAAA;KACF,CAAA;IACD,kBAAkB,EAAE;QAClB,MAAM,EAAE;YACN,MAAM,EAAE,MAAM,CAAA;YACd,IAAI,EAAE,MAAM,CAAA;SACb,CAAA;QACD,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAA;YACZ,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,OAAO,EAAE;YACP,MAAM,EAAE,MAAM,CAAA;SACf,CAAA;QACD,UAAU,EAAE;YACV,aAAa,EAAE,MAAM,CAAA;SACtB,CAAA;KACF,CAAA;IACD,kBAAkB,EAAE;QAClB,MAAM,EAAE;YACN,MAAM,EAAE,MAAM,CAAA;YACd,IAAI,EAAE,MAAM,CAAA;SACb,CAAA;QACD,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAA;YACZ,IAAI,EAAE,MAAM,CAAA;YACZ,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,MAAM,CAAA;YACZ,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,OAAO,EAAE;YACP,MAAM,EAAE,MAAM,CAAA;SACf,CAAA;QACD,UAAU,EAAE;YACV,YAAY,EAAE,MAAM,CAAA;SACrB,CAAA;KACF,CAAA;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,248 @@
1
+ import { type LocaleMessageOverrides, type PackageI18nValue } from "@voyantjs/i18n";
2
+ import type { ReactNode } from "react";
3
+ import type { IdentityUiMessages } from "./messages";
4
+ export declare const identityUiMessageDefinitions: {
5
+ en: {
6
+ common: {
7
+ cancel: string;
8
+ saveChanges: string;
9
+ primary: string;
10
+ addressLabelLabels: {
11
+ primary: string;
12
+ billing: string;
13
+ shipping: string;
14
+ mailing: string;
15
+ meeting: string;
16
+ service: string;
17
+ legal: string;
18
+ other: string;
19
+ };
20
+ contactPointKindLabels: {
21
+ email: string;
22
+ phone: string;
23
+ mobile: string;
24
+ whatsapp: string;
25
+ website: string;
26
+ sms: string;
27
+ fax: string;
28
+ social: string;
29
+ other: string;
30
+ };
31
+ namedContactRoleLabels: {
32
+ general: string;
33
+ primary: string;
34
+ reservations: string;
35
+ operations: string;
36
+ front_desk: string;
37
+ sales: string;
38
+ emergency: string;
39
+ accounting: string;
40
+ legal: string;
41
+ other: string;
42
+ };
43
+ };
44
+ addressDialog: {
45
+ titles: {
46
+ create: string;
47
+ edit: string;
48
+ };
49
+ fields: {
50
+ label: string;
51
+ line1: string;
52
+ line2: string;
53
+ city: string;
54
+ region: string;
55
+ postalCode: string;
56
+ country: string;
57
+ timezone: string;
58
+ latitude: string;
59
+ longitude: string;
60
+ notes: string;
61
+ };
62
+ placeholders: {
63
+ timezone: string;
64
+ };
65
+ actions: {
66
+ create: string;
67
+ };
68
+ };
69
+ contactPointDialog: {
70
+ titles: {
71
+ create: string;
72
+ edit: string;
73
+ };
74
+ fields: {
75
+ kind: string;
76
+ label: string;
77
+ value: string;
78
+ notes: string;
79
+ };
80
+ placeholders: {
81
+ label: string;
82
+ value: string;
83
+ };
84
+ actions: {
85
+ create: string;
86
+ };
87
+ validation: {
88
+ valueRequired: string;
89
+ };
90
+ };
91
+ namedContactDialog: {
92
+ titles: {
93
+ create: string;
94
+ edit: string;
95
+ };
96
+ fields: {
97
+ role: string;
98
+ name: string;
99
+ title: string;
100
+ email: string;
101
+ phone: string;
102
+ notes: string;
103
+ };
104
+ placeholders: {
105
+ name: string;
106
+ title: string;
107
+ email: string;
108
+ };
109
+ actions: {
110
+ create: string;
111
+ };
112
+ validation: {
113
+ nameRequired: string;
114
+ };
115
+ };
116
+ };
117
+ ro: {
118
+ common: {
119
+ cancel: string;
120
+ saveChanges: string;
121
+ primary: string;
122
+ addressLabelLabels: {
123
+ primary: string;
124
+ billing: string;
125
+ shipping: string;
126
+ mailing: string;
127
+ meeting: string;
128
+ service: string;
129
+ legal: string;
130
+ other: string;
131
+ };
132
+ contactPointKindLabels: {
133
+ email: string;
134
+ phone: string;
135
+ mobile: string;
136
+ whatsapp: string;
137
+ website: string;
138
+ sms: string;
139
+ fax: string;
140
+ social: string;
141
+ other: string;
142
+ };
143
+ namedContactRoleLabels: {
144
+ general: string;
145
+ primary: string;
146
+ reservations: string;
147
+ operations: string;
148
+ front_desk: string;
149
+ sales: string;
150
+ emergency: string;
151
+ accounting: string;
152
+ legal: string;
153
+ other: string;
154
+ };
155
+ };
156
+ addressDialog: {
157
+ titles: {
158
+ create: string;
159
+ edit: string;
160
+ };
161
+ fields: {
162
+ label: string;
163
+ line1: string;
164
+ line2: string;
165
+ city: string;
166
+ region: string;
167
+ postalCode: string;
168
+ country: string;
169
+ timezone: string;
170
+ latitude: string;
171
+ longitude: string;
172
+ notes: string;
173
+ };
174
+ placeholders: {
175
+ timezone: string;
176
+ };
177
+ actions: {
178
+ create: string;
179
+ };
180
+ };
181
+ contactPointDialog: {
182
+ titles: {
183
+ create: string;
184
+ edit: string;
185
+ };
186
+ fields: {
187
+ kind: string;
188
+ label: string;
189
+ value: string;
190
+ notes: string;
191
+ };
192
+ placeholders: {
193
+ label: string;
194
+ value: string;
195
+ };
196
+ actions: {
197
+ create: string;
198
+ };
199
+ validation: {
200
+ valueRequired: string;
201
+ };
202
+ };
203
+ namedContactDialog: {
204
+ titles: {
205
+ create: string;
206
+ edit: string;
207
+ };
208
+ fields: {
209
+ role: string;
210
+ name: string;
211
+ title: string;
212
+ email: string;
213
+ phone: string;
214
+ notes: string;
215
+ };
216
+ placeholders: {
217
+ name: string;
218
+ title: string;
219
+ email: string;
220
+ };
221
+ actions: {
222
+ create: string;
223
+ };
224
+ validation: {
225
+ nameRequired: string;
226
+ };
227
+ };
228
+ };
229
+ };
230
+ export type IdentityUiMessageOverrides = LocaleMessageOverrides<IdentityUiMessages>;
231
+ export declare function resolveIdentityUiMessages({ locale, overrides, }: {
232
+ locale: string | null | undefined;
233
+ overrides?: IdentityUiMessageOverrides | null;
234
+ }): IdentityUiMessages;
235
+ export declare function getIdentityUiI18n({ locale, overrides, }: {
236
+ locale?: string | null | undefined;
237
+ overrides?: IdentityUiMessageOverrides | null;
238
+ }): PackageI18nValue<IdentityUiMessages>;
239
+ export declare function IdentityUiMessagesProvider({ children, locale, overrides, }: {
240
+ children: ReactNode;
241
+ locale: string | null | undefined;
242
+ overrides?: IdentityUiMessageOverrides | null;
243
+ }): import("react/jsx-runtime").JSX.Element;
244
+ export declare const useIdentityUiI18n: () => PackageI18nValue<IdentityUiMessages>;
245
+ export declare const useIdentityUiMessages: () => IdentityUiMessages;
246
+ export declare function useIdentityUiI18nOrDefault(): PackageI18nValue<IdentityUiMessages>;
247
+ export declare function useIdentityUiMessagesOrDefault(): IdentityUiMessages;
248
+ //# 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,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAKpD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGe,CAAA;AAExD,MAAM,MAAM,0BAA0B,GAAG,sBAAsB,CAAC,kBAAkB,CAAC,CAAA;AASnF,wBAAgB,yBAAyB,CAAC,EACxC,MAAM,EACN,SAAS,GACV,EAAE;IACD,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACjC,SAAS,CAAC,EAAE,0BAA0B,GAAG,IAAI,CAAA;CAC9C,sBAOA;AAED,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,SAAS,GACV,EAAE;IACD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAClC,SAAS,CAAC,EAAE,0BAA0B,GAAG,IAAI,CAAA;CAC9C,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CASvC;AAED,wBAAgB,0BAA0B,CAAC,EACzC,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,0BAA0B,GAAG,IAAI,CAAA;CAC9C,2CAWA;AAED,eAAO,MAAM,iBAAiB,4CAA4B,CAAA;AAC1D,eAAO,MAAM,qBAAqB,0BAAgC,CAAA;AAElE,wBAAgB,0BAA0B,yCAEzC;AAED,wBAAgB,8BAA8B,uBAE7C"}
@@ -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 { identityUiEn } from "./en";
5
+ import { identityUiRo } from "./ro";
6
+ const fallbackLocale = "en";
7
+ export const identityUiMessageDefinitions = {
8
+ en: identityUiEn,
9
+ ro: identityUiRo,
10
+ };
11
+ const identityUiContext = createPackageMessagesContext("IdentityUiMessages");
12
+ const defaultIdentityUiI18n = {
13
+ messages: identityUiEn,
14
+ ...createLocaleFormatters(fallbackLocale),
15
+ };
16
+ export function resolveIdentityUiMessages({ locale, overrides, }) {
17
+ return resolvePackageMessages({
18
+ definitions: identityUiMessageDefinitions,
19
+ fallbackLocale,
20
+ locale,
21
+ overrides,
22
+ });
23
+ }
24
+ export function getIdentityUiI18n({ locale, overrides, }) {
25
+ const resolvedLocale = locale ?? fallbackLocale;
26
+ return {
27
+ messages: resolveIdentityUiMessages({
28
+ locale: resolvedLocale,
29
+ overrides,
30
+ }),
31
+ ...createLocaleFormatters(resolvedLocale),
32
+ };
33
+ }
34
+ export function IdentityUiMessagesProvider({ children, locale, overrides, }) {
35
+ return (_jsx(identityUiContext.ResolvedMessagesProvider, { definitions: identityUiMessageDefinitions, fallbackLocale: fallbackLocale, locale: locale, overrides: overrides, children: children }));
36
+ }
37
+ export const useIdentityUiI18n = identityUiContext.useI18n;
38
+ export const useIdentityUiMessages = identityUiContext.useMessages;
39
+ export function useIdentityUiI18nOrDefault() {
40
+ return identityUiContext.useOptionalI18n() ?? defaultIdentityUiI18n;
41
+ }
42
+ export function useIdentityUiMessagesOrDefault() {
43
+ return useIdentityUiI18nOrDefault().messages;
44
+ }
@@ -0,0 +1,113 @@
1
+ export declare const identityUiRo: {
2
+ common: {
3
+ cancel: string;
4
+ saveChanges: string;
5
+ primary: string;
6
+ addressLabelLabels: {
7
+ primary: string;
8
+ billing: string;
9
+ shipping: string;
10
+ mailing: string;
11
+ meeting: string;
12
+ service: string;
13
+ legal: string;
14
+ other: string;
15
+ };
16
+ contactPointKindLabels: {
17
+ email: string;
18
+ phone: string;
19
+ mobile: string;
20
+ whatsapp: string;
21
+ website: string;
22
+ sms: string;
23
+ fax: string;
24
+ social: string;
25
+ other: string;
26
+ };
27
+ namedContactRoleLabels: {
28
+ general: string;
29
+ primary: string;
30
+ reservations: string;
31
+ operations: string;
32
+ front_desk: string;
33
+ sales: string;
34
+ emergency: string;
35
+ accounting: string;
36
+ legal: string;
37
+ other: string;
38
+ };
39
+ };
40
+ addressDialog: {
41
+ titles: {
42
+ create: string;
43
+ edit: string;
44
+ };
45
+ fields: {
46
+ label: string;
47
+ line1: string;
48
+ line2: string;
49
+ city: string;
50
+ region: string;
51
+ postalCode: string;
52
+ country: string;
53
+ timezone: string;
54
+ latitude: string;
55
+ longitude: string;
56
+ notes: string;
57
+ };
58
+ placeholders: {
59
+ timezone: string;
60
+ };
61
+ actions: {
62
+ create: string;
63
+ };
64
+ };
65
+ contactPointDialog: {
66
+ titles: {
67
+ create: string;
68
+ edit: string;
69
+ };
70
+ fields: {
71
+ kind: string;
72
+ label: string;
73
+ value: string;
74
+ notes: string;
75
+ };
76
+ placeholders: {
77
+ label: string;
78
+ value: string;
79
+ };
80
+ actions: {
81
+ create: string;
82
+ };
83
+ validation: {
84
+ valueRequired: string;
85
+ };
86
+ };
87
+ namedContactDialog: {
88
+ titles: {
89
+ create: string;
90
+ edit: string;
91
+ };
92
+ fields: {
93
+ role: string;
94
+ name: string;
95
+ title: string;
96
+ email: string;
97
+ phone: string;
98
+ notes: string;
99
+ };
100
+ placeholders: {
101
+ name: string;
102
+ title: string;
103
+ email: string;
104
+ };
105
+ actions: {
106
+ create: string;
107
+ };
108
+ validation: {
109
+ nameRequired: string;
110
+ };
111
+ };
112
+ };
113
+ //# 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,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GK,CAAA"}
@@ -0,0 +1,112 @@
1
+ export const identityUiRo = {
2
+ common: {
3
+ cancel: "Anuleaza",
4
+ saveChanges: "Salveaza Modificarile",
5
+ primary: "Principal",
6
+ addressLabelLabels: {
7
+ primary: "Principal",
8
+ billing: "Facturare",
9
+ shipping: "Livrare",
10
+ mailing: "Corespondenta",
11
+ meeting: "Intalnire",
12
+ service: "Serviciu",
13
+ legal: "Juridic",
14
+ other: "Altul",
15
+ },
16
+ contactPointKindLabels: {
17
+ email: "Email",
18
+ phone: "Telefon",
19
+ mobile: "Mobil",
20
+ whatsapp: "WhatsApp",
21
+ website: "Website",
22
+ sms: "SMS",
23
+ fax: "Fax",
24
+ social: "Social",
25
+ other: "Altul",
26
+ },
27
+ namedContactRoleLabels: {
28
+ general: "General",
29
+ primary: "Principal",
30
+ reservations: "Rezervari",
31
+ operations: "Operatiuni",
32
+ front_desk: "Receptie",
33
+ sales: "Vanzari",
34
+ emergency: "Urgenta",
35
+ accounting: "Contabilitate",
36
+ legal: "Juridic",
37
+ other: "Altul",
38
+ },
39
+ },
40
+ addressDialog: {
41
+ titles: {
42
+ create: "Adauga Adresa",
43
+ edit: "Editeaza Adresa",
44
+ },
45
+ fields: {
46
+ label: "Eticheta",
47
+ line1: "Linia 1",
48
+ line2: "Linia 2",
49
+ city: "Oras",
50
+ region: "Regiune",
51
+ postalCode: "Cod postal",
52
+ country: "Tara",
53
+ timezone: "Fus orar",
54
+ latitude: "Latitudine",
55
+ longitude: "Longitudine",
56
+ notes: "Note",
57
+ },
58
+ placeholders: {
59
+ timezone: "Europe/Istanbul",
60
+ },
61
+ actions: {
62
+ create: "Adauga Adresa",
63
+ },
64
+ },
65
+ contactPointDialog: {
66
+ titles: {
67
+ create: "Adauga Punct de Contact",
68
+ edit: "Editeaza Punctul de Contact",
69
+ },
70
+ fields: {
71
+ kind: "Tip",
72
+ label: "Eticheta",
73
+ value: "Valoare",
74
+ notes: "Note",
75
+ },
76
+ placeholders: {
77
+ label: "serviciu, personal...",
78
+ value: "nume@example.com",
79
+ },
80
+ actions: {
81
+ create: "Adauga Punct de Contact",
82
+ },
83
+ validation: {
84
+ valueRequired: "Valoarea este obligatorie",
85
+ },
86
+ },
87
+ namedContactDialog: {
88
+ titles: {
89
+ create: "Adauga Contact Nominal",
90
+ edit: "Editeaza Contactul Nominal",
91
+ },
92
+ fields: {
93
+ role: "Rol",
94
+ name: "Nume",
95
+ title: "Titlu",
96
+ email: "Email",
97
+ phone: "Telefon",
98
+ notes: "Note",
99
+ },
100
+ placeholders: {
101
+ name: "Jane Doe",
102
+ title: "Director de Vanzari",
103
+ email: "jane@example.com",
104
+ },
105
+ actions: {
106
+ create: "Adauga Contact Nominal",
107
+ },
108
+ validation: {
109
+ nameRequired: "Numele este obligatoriu",
110
+ },
111
+ },
112
+ };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { AddressDialog, type AddressDialogProps } from "./components/address-dialog";
2
2
  export { ContactPointDialog, type ContactPointDialogProps } from "./components/contact-point-dialog";
3
3
  export { NamedContactDialog, type NamedContactDialogProps } from "./components/named-contact-dialog";
4
+ export { getIdentityUiI18n, type IdentityUiMessageOverrides, type IdentityUiMessages, IdentityUiMessagesProvider, identityUiEn, identityUiMessageDefinitions, identityUiRo, resolveIdentityUiMessages, useIdentityUiI18n, useIdentityUiI18nOrDefault, useIdentityUiMessages, useIdentityUiMessagesOrDefault, } from "./i18n";
4
5
  //# 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,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AACpG,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,mCAAmC,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,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AACpG,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AACpG,OAAO,EACL,iBAAiB,EACjB,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,4BAA4B,EAC5B,YAAY,EACZ,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,QAAQ,CAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { AddressDialog } from "./components/address-dialog";
2
2
  export { ContactPointDialog } from "./components/contact-point-dialog";
3
3
  export { NamedContactDialog } from "./components/named-contact-dialog";
4
+ export { getIdentityUiI18n, IdentityUiMessagesProvider, identityUiEn, identityUiMessageDefinitions, identityUiRo, resolveIdentityUiMessages, useIdentityUiI18n, useIdentityUiI18nOrDefault, useIdentityUiMessages, useIdentityUiMessagesOrDefault, } from "./i18n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/identity-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"
@@ -25,9 +37,12 @@
25
37
  "react": "^19.0.0",
26
38
  "react-dom": "^19.0.0",
27
39
  "react-hook-form": "^7.60.0",
28
- "zod": "^3.25.76",
29
- "@voyantjs/identity-react": "0.16.0",
30
- "@voyantjs/ui": "0.16.0"
40
+ "zod": "^4.3.6",
41
+ "@voyantjs/identity-react": "0.17.0",
42
+ "@voyantjs/ui": "0.17.0"
43
+ },
44
+ "dependencies": {
45
+ "@voyantjs/i18n": "0.17.0"
31
46
  },
32
47
  "devDependencies": {
33
48
  "@tanstack/react-query": "^5.96.2",
@@ -40,10 +55,11 @@
40
55
  "react-hook-form": "^7.60.0",
41
56
  "typescript": "^6.0.2",
42
57
  "vitest": "^4.1.2",
43
- "zod": "^3.25.76",
44
- "@voyantjs/identity-react": "0.16.0",
58
+ "zod": "^4.3.6",
59
+ "@voyantjs/i18n": "0.17.0",
60
+ "@voyantjs/identity-react": "0.17.0",
45
61
  "@voyantjs/voyant-typescript-config": "0.1.0",
46
- "@voyantjs/ui": "0.16.0"
62
+ "@voyantjs/ui": "0.17.0"
47
63
  },
48
64
  "files": [
49
65
  "dist"