@tesouro/embedded-components-react 0.7.26 → 0.7.29

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.
Files changed (39) hide show
  1. package/dist/index.d.ts +1 -12
  2. package/dist/lib/CounterpartsWidget.d.ts +1 -12
  3. package/dist/lib/CounterpartsWidgetPublic.d.ts +1 -12
  4. package/dist/lib/CustomersWidget.d.ts +0 -2
  5. package/dist/lib/ReceivablesWidget.d.ts +0 -2
  6. package/dist/lib/monite-sdk.d.ts +224 -236
  7. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +59 -38
  8. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsPanel.js +137 -0
  9. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +86 -182
  10. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsActions.js +116 -0
  11. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +16 -16
  12. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +51 -108
  13. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useRebaseOnRefresh.js +33 -0
  14. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +40 -39
  15. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +2 -65
  17. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +37 -181
  18. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +193 -502
  19. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +520 -0
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +2 -0
  21. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index143.js +9 -10
  22. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index20.js +1 -2
  23. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index286.js +0 -1
  24. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index53.js +1 -4
  25. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index.js +3 -3
  26. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +31 -55
  27. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
  28. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +98 -163
  29. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +1 -3
  30. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/subEntityForms.js +37 -32
  31. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +86 -93
  32. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +2 -0
  33. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +42 -173
  34. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +3 -12
  35. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index5.js +16 -16
  36. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +42 -42
  37. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +117 -125
  38. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  39. package/package.json +1 -1
@@ -1,520 +1,211 @@
1
- import { Badge as e, Button as t, DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuTrigger as a, Separator as o, Sheet as s, SheetContent as c, SheetDescription as l, SheetHeader as u, SheetTitle as d, Skeleton as f, Spinner as ee, Typography as p, cn as te } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { COUNTERPART_DETAILS_SHEET_LABELS_EN as ne } from "./index2.js";
3
- import { CounterpartAddressForm as m } from "./index4.js";
4
- import { CounterpartEditForm as h } from "./index5.js";
5
- import { useEffect as re, useState as ie } from "react";
6
- import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
7
- import { EyeIcon as y, EyeOffIcon as b, MoreVerticalIcon as x, PencilIcon as S, PlusIcon as C, SearchXIcon as ae, Trash2Icon as w, XIcon as T } from "lucide-react";
1
+ import { Button as e, Checkbox as t, Field as n, FieldContent as r, FieldDescription as i, FieldError as a, FieldLabel as o, Input as s, LABEL_LABELS_EN as c, Label as l, RequiredFieldsLegend as u, Spinner as d, Typography as f, cn as p, mergeRequiredFieldsLegendLabels as m } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { CounterpartAddressFields as h } from "../../../shared/counterpart-management/ui/dist/index7.js";
3
+ import "../../../shared/counterpart-management/ui/dist/index.js";
4
+ import { addressFieldLabels as g } from "./index4.js";
5
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
8
6
  //#region ../../libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js
9
- var E = "-", D = {
10
- billNeutral: "ttw:border-border ttw:bg-muted ttw:text-foreground ttw:hover:bg-muted",
11
- billAccent: "ttw:border-violet-100 ttw:bg-violet-100 ttw:text-violet-700 ttw:hover:bg-violet-100",
12
- billInfo: "ttw:border-blue-100 ttw:bg-blue-100 ttw:text-blue-700 ttw:hover:bg-blue-100",
13
- billSuccess: "ttw:border-green-100 ttw:bg-green-100 ttw:text-green-700 ttw:hover:bg-green-100",
14
- billSettled: "ttw:border-border ttw:bg-background ttw:text-green-900 ttw:hover:bg-background",
15
- billDanger: "ttw:border-destructive/20 ttw:bg-destructive/20 ttw:text-destructive ttw:hover:bg-destructive/20",
16
- invoiceNeutral: "ttw:border-transparent ttw:bg-muted ttw:text-muted-foreground",
17
- invoiceCyan: "ttw:border-transparent ttw:bg-cyan-100 ttw:text-cyan-700",
18
- invoiceSuccess: "ttw:border-transparent ttw:bg-green-100 ttw:text-green-700",
19
- invoicePurple: "ttw:border-transparent ttw:bg-purple-100 ttw:text-purple-700",
20
- invoiceOrange: "ttw:border-transparent ttw:bg-orange-100 ttw:text-orange-700",
21
- invoiceDanger: "ttw:border-transparent ttw:bg-destructive/10 ttw:text-destructive"
22
- };
23
- function O({ label: t, tone: n }) {
24
- return /* @__PURE__ */ _(e, {
25
- variant: "outline",
26
- className: D[n],
27
- children: t
28
- });
29
- }
30
- function k({ className: e }) {
31
- return /* @__PURE__ */ _(f, { className: e ?? "ttw:h-5 ttw:w-24" });
32
- }
33
- function A({ label: e, children: t, isLast: n }) {
34
- return /* @__PURE__ */ v("div", {
35
- className: ["ttw:grid ttw:grid-cols-[180px_1fr] ttw:gap-4 ttw:py-3", n ? "" : "ttw:border-b ttw:border-border"].join(" "),
36
- children: [/* @__PURE__ */ _(p, {
37
- variant: "body2",
38
- className: "ttw:text-muted-foreground",
39
- children: e
40
- }), /* @__PURE__ */ _("div", {
41
- className: "ttw:min-w-0 ttw:text-sm",
42
- children: t
43
- })]
44
- });
45
- }
46
- function j({ mode: e, summary: t, labels: n }) {
47
- let r = e === "customer" ? n.summaryReceived : n.summaryPaid;
48
- return /* @__PURE__ */ v("div", {
49
- className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-md ttw:bg-muted ttw:p-5",
50
- children: [
51
- /* @__PURE__ */ _(p, {
52
- variant: "body2",
53
- className: "ttw:text-muted-foreground",
54
- children: e === "customer" ? n.summaryAmountDue : n.summaryBalanceDue
55
- }),
56
- t?.isPrimaryAmountLoading ? /* @__PURE__ */ _(k, { className: "ttw:h-9 ttw:w-36" }) : /* @__PURE__ */ _("p", {
57
- className: "ttw:text-[2rem] ttw:leading-tight ttw:font-semibold ttw:tracking-tight",
58
- children: t?.primaryAmountLabel ?? E
59
- }),
60
- /* @__PURE__ */ v("div", {
61
- className: "ttw:flex ttw:gap-8",
62
- children: [
63
- /* @__PURE__ */ v("div", {
64
- className: "ttw:flex ttw:flex-col ttw:gap-1",
65
- children: [/* @__PURE__ */ _(p, {
66
- variant: "caption",
67
- className: "ttw:text-muted-foreground",
68
- children: n.summaryBilled
69
- }), t?.isBilledAmountLoading ? /* @__PURE__ */ _(k, {}) : /* @__PURE__ */ _(p, {
70
- variant: "body1",
71
- className: "ttw:font-semibold",
72
- children: t?.billedAmountLabel ?? E
73
- })]
74
- }),
75
- /* @__PURE__ */ v("div", {
76
- className: "ttw:flex ttw:flex-col ttw:gap-1",
77
- children: [/* @__PURE__ */ _(p, {
78
- variant: "caption",
79
- className: "ttw:text-muted-foreground",
80
- children: r
81
- }), t?.isReceivedOrPaidAmountLoading ? /* @__PURE__ */ _(k, {}) : /* @__PURE__ */ _(p, {
82
- variant: "body1",
83
- className: "ttw:font-semibold ttw:text-green-600",
84
- children: t?.receivedOrPaidAmountLabel ?? E
85
- })]
86
- }),
87
- e === "vendor" && /* @__PURE__ */ v("div", {
88
- className: "ttw:flex ttw:flex-col ttw:gap-1",
89
- children: [/* @__PURE__ */ _(p, {
90
- variant: "caption",
91
- className: "ttw:text-muted-foreground",
92
- children: n.summaryRejected
93
- }), t?.isRejectedAmountLoading ? /* @__PURE__ */ _(k, {}) : /* @__PURE__ */ _(p, {
94
- variant: "body1",
95
- className: "ttw:font-semibold",
96
- children: t?.rejectedAmountLabel ?? E
97
- })]
98
- })
99
- ]
100
- })
101
- ]
102
- });
7
+ function y(e) {
8
+ return e ? [{ message: e }] : void 0;
103
9
  }
104
- function oe({ mode: e, documents: n, labels: r, onViewAll: i }) {
105
- if (!n || n.length === 0) return null;
106
- let a = e === "vendor";
107
- return /* @__PURE__ */ v("section", {
108
- className: "ttw:flex ttw:flex-col ttw:border-t ttw:border-border ttw:pt-6",
10
+ function b({ form: b, labels: x }) {
11
+ let { name: S, email: C, phone: w, taxId: T, reminders: E, address: D, inProgress: O } = b, k = {
12
+ ...x,
13
+ ...b.labels
14
+ }, A = {
15
+ ...c,
16
+ ...b.fieldMarkers
17
+ };
18
+ return /* @__PURE__ */ v("form", {
19
+ className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-[10px] ttw:border ttw:border-border ttw:bg-muted ttw:p-4",
20
+ onSubmit: (e) => {
21
+ e.preventDefault(), b.onSubmit();
22
+ },
109
23
  children: [/* @__PURE__ */ v("div", {
110
- className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4 ttw:pb-5",
111
- children: [/* @__PURE__ */ v("div", {
112
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
113
- children: [/* @__PURE__ */ _(p, {
114
- variant: "body1",
115
- className: "ttw:font-medium",
116
- children: e === "customer" ? r.recentCustomerDocumentsHeading : r.recentVendorDocumentsHeading
117
- }), /* @__PURE__ */ _(p, {
118
- variant: "body2",
119
- className: "ttw:text-muted-foreground",
120
- children: e === "customer" ? r.recentCustomerDocumentsDescription : r.recentVendorDocumentsDescription
121
- })]
122
- }), i && /* @__PURE__ */ _(t, {
123
- variant: "link",
124
- className: "ttw:h-auto ttw:p-0",
125
- onClick: i,
126
- children: r.viewAllDocumentsAction
127
- })]
128
- }), /* @__PURE__ */ _("div", {
129
- className: "ttw:flex ttw:flex-col ttw:gap-3 ttw:rounded-md ttw:border ttw:border-border ttw:p-4",
130
- children: n.map((e, t) => {
131
- let i = a && e.isOverdue;
132
- return /* @__PURE__ */ v("div", {
133
- className: "ttw:flex ttw:flex-col ttw:gap-3",
134
- children: [/* @__PURE__ */ v("div", {
135
- className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
136
- children: [/* @__PURE__ */ v("div", {
137
- className: "ttw:flex ttw:flex-col ttw:gap-1",
138
- children: [/* @__PURE__ */ _(p, {
139
- variant: "h6",
140
- className: "ttw:font-medium",
141
- children: e.amountLabel
142
- }), /* @__PURE__ */ _(p, {
143
- variant: "body2",
144
- className: i ? "ttw:text-destructive" : "ttw:text-muted-foreground",
145
- children: e.dateLabel
146
- })]
147
- }), /* @__PURE__ */ v("div", {
148
- className: "ttw:flex ttw:items-center ttw:gap-2",
149
- children: [i && /* @__PURE__ */ _(O, {
150
- label: r.overdueTag,
151
- tone: "billDanger"
152
- }), /* @__PURE__ */ _(O, {
153
- label: e.statusLabel,
154
- tone: e.statusTone
155
- })]
156
- })]
157
- }), t < n.length - 1 && /* @__PURE__ */ _(o, {})]
158
- }, e.id);
159
- })
160
- })]
161
- });
162
- }
163
- function M({ mode: e, addressLines: n, canEdit: r, onEditAddress: i, onAddAddress: a, labels: o, addressForm: s }) {
164
- let c = n.length > 0;
165
- return /* @__PURE__ */ v("section", {
166
- className: e === "customer" ? "ttw:flex ttw:flex-col ttw:gap-3" : "ttw:flex ttw:flex-col",
167
- children: [e === "customer" && !s && /* @__PURE__ */ v("div", {
168
- className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3",
24
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
169
25
  children: [
170
- /* @__PURE__ */ v(p, {
171
- variant: "body1",
172
- className: "ttw:font-medium",
173
- children: [
174
- o.customerAddressHeading,
175
- " ",
176
- /* @__PURE__ */ _("span", {
177
- className: "ttw:text-muted-foreground",
178
- children: o.optionalSuffix
179
- })
180
- ]
181
- }),
182
- r && c && /* @__PURE__ */ _(t, {
183
- type: "button",
184
- variant: "link",
185
- className: "ttw:h-auto ttw:p-0",
186
- "aria-label": o.editAddressAction,
187
- onClick: i,
188
- children: o.editButton
189
- }),
190
- r && !c && /* @__PURE__ */ v(t, {
191
- type: "button",
192
- variant: "link",
193
- className: "ttw:h-auto ttw:p-0",
194
- onClick: a,
195
- children: [/* @__PURE__ */ _(C, { className: "ttw:size-4" }), o.addAddressAction]
196
- })
197
- ]
198
- }), s ? /* @__PURE__ */ _(m, {
199
- form: s,
200
- labels: o
201
- }) : c ? /* @__PURE__ */ _("address", {
202
- className: "ttw:flex ttw:flex-col ttw:gap-1 ttw:not-italic ttw:text-sm",
203
- children: n.map((e) => /* @__PURE__ */ _("span", { children: e }, e))
204
- }) : /* @__PURE__ */ _(p, {
205
- variant: "body2",
206
- className: "ttw:text-muted-foreground",
207
- children: o.noAddress
208
- })]
209
- });
210
- }
211
- function se({ paymentMethod: n, canEdit: r, onAddBankAccount: i, onEditBankAccount: a, onDeleteBankAccount: o, labels: s }) {
212
- return /* @__PURE__ */ v("section", {
213
- className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:border-t ttw:border-border ttw:pt-6",
214
- children: [/* @__PURE__ */ v("div", {
215
- className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3",
216
- children: [/* @__PURE__ */ v("div", {
217
- className: "ttw:flex ttw:flex-col ttw:gap-1",
218
- children: [/* @__PURE__ */ _(p, {
219
- variant: "body1",
220
- className: "ttw:font-medium",
221
- children: s.paymentMethodsHeading
222
- }), /* @__PURE__ */ _(p, {
223
- variant: "body2",
224
- className: "ttw:text-muted-foreground",
225
- children: s.paymentMethodsDescription
226
- })]
227
- }), r && !n && /* @__PURE__ */ v(t, {
228
- type: "button",
229
- variant: "ghost",
230
- size: "sm",
231
- onClick: i,
232
- children: [/* @__PURE__ */ _(C, { className: "ttw:size-4" }), s.addPaymentMethodAction]
233
- })]
234
- }), n ? /* @__PURE__ */ v("div", {
235
- className: "ttw:flex ttw:flex-col ttw:gap-3 ttw:rounded-md ttw:border ttw:border-border ttw:p-4",
236
- children: [/* @__PURE__ */ v("div", {
237
- className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-3",
238
- children: [/* @__PURE__ */ v("div", {
239
- className: "ttw:flex ttw:flex-col ttw:gap-1",
240
- children: [/* @__PURE__ */ _(p, {
241
- variant: "body2",
26
+ /* @__PURE__ */ _("div", {
27
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:border-b ttw:border-border ttw:pt-6 ttw:pb-7",
28
+ children: /* @__PURE__ */ _(f, {
29
+ variant: "body1",
242
30
  className: "ttw:font-medium",
243
- children: n.title
244
- }), n.isIncomplete && /* @__PURE__ */ _(e, {
245
- variant: "outline",
246
- children: s.incompletePaymentMethod
247
- })]
248
- }), r && /* @__PURE__ */ v("div", {
249
- className: "ttw:flex ttw:gap-1",
250
- children: [/* @__PURE__ */ _(t, {
251
- type: "button",
252
- variant: "ghost",
253
- size: "icon-sm",
254
- "aria-label": s.editPaymentMethodAction,
255
- onClick: () => a?.(n.id),
256
- children: /* @__PURE__ */ _(S, { className: "ttw:size-4" })
257
- }), /* @__PURE__ */ _(t, {
258
- type: "button",
259
- variant: "ghost",
260
- size: "icon-sm",
261
- "aria-label": s.deletePaymentMethodAction,
262
- onClick: () => o?.(n.id),
263
- children: /* @__PURE__ */ _(w, { className: "ttw:size-4" })
264
- })]
265
- })]
266
- }), /* @__PURE__ */ v("div", {
267
- className: "ttw:grid ttw:grid-cols-3 ttw:gap-3 ttw:text-sm",
268
- children: [
269
- /* @__PURE__ */ v("div", {
270
- className: "ttw:flex ttw:flex-col ttw:gap-1",
271
- children: [/* @__PURE__ */ _("span", {
272
- className: "ttw:text-muted-foreground",
273
- children: s.accountHolderLabel
274
- }), /* @__PURE__ */ _("span", { children: n.accountHolderLabel || E })]
275
- }),
276
- /* @__PURE__ */ v("div", {
277
- className: "ttw:flex ttw:flex-col ttw:gap-1",
278
- children: [/* @__PURE__ */ _("span", {
279
- className: "ttw:text-muted-foreground",
280
- children: s.accountNumberLabel
281
- }), /* @__PURE__ */ _("span", { children: n.accountNumberLabel || E })]
282
- }),
283
- /* @__PURE__ */ v("div", {
284
- className: "ttw:flex ttw:flex-col ttw:gap-1",
285
- children: [/* @__PURE__ */ _("span", {
286
- className: "ttw:text-muted-foreground",
287
- children: s.routingNumberLabel
288
- }), /* @__PURE__ */ _("span", { children: n.routingNumberLabel || E })]
31
+ children: b.heading
289
32
  })
290
- ]
291
- })]
292
- }) : /* @__PURE__ */ _(p, {
293
- variant: "body2",
294
- className: "ttw:text-muted-foreground",
295
- children: s.noPaymentMethods
296
- })]
297
- });
298
- }
299
- function N({ open: e, onOpenChange: o, privacyResetKey: m, mode: S = "customer", counterpart: C, isLoading: D, isError: O, canEdit: k = !0, canDelete: N = !0, onEdit: P, onDelete: F, onClose: I, onEditAddress: L, onAddAddress: R, onAddBankAccount: z, onEditBankAccount: B, onDeleteBankAccount: V, onViewAllDocuments: H, onCreateDocument: U, editForm: W, addressForm: G, labels: ce }) {
300
- let K = {
301
- ...ne,
302
- ...ce
303
- }, [le, q] = ie(null), J = [
304
- m ?? C?.name ?? "",
305
- C?.taxId ?? "",
306
- C?.taxIdMasked ?? ""
307
- ].join(":"), Y = e && !!C?.taxId && le === J;
308
- re(() => {
309
- e || q(null);
310
- }, [e]);
311
- let X = S === "vendor", ue = Y ? C?.taxId ?? E : C?.taxIdMasked || C?.taxId || E, Z = C?.taxIdHelpText ?? (X ? K.vendorTaxIdHelp : K.customerTaxIdHelp), Q = (e) => {
312
- e || q(null), o(e);
313
- };
314
- if (O) return /* @__PURE__ */ _(s, {
315
- open: e,
316
- onOpenChange: Q,
317
- children: /* @__PURE__ */ _(c, {
318
- className: "ttw:w-160 ttw:sm:max-w-160 ttw:gap-0",
319
- children: /* @__PURE__ */ v("div", {
320
- className: "ttw:m-auto ttw:flex ttw:w-3/4 ttw:flex-col ttw:items-center ttw:gap-4 ttw:p-4",
321
- children: [/* @__PURE__ */ _(ae, { className: "ttw:size-8 ttw:text-destructive" }), /* @__PURE__ */ v("div", {
322
- className: "ttw:flex ttw:flex-col ttw:items-center ttw:gap-2",
323
- children: [/* @__PURE__ */ _(d, {
324
- className: "ttw:text-xl ttw:font-semibold ttw:tracking-tight",
325
- children: X ? K.notFoundVendorTitle : K.notFoundCustomerTitle
326
- }), /* @__PURE__ */ _(l, {
327
- className: "ttw:text-center ttw:text-base ttw:text-foreground",
328
- children: X ? K.notFoundVendorDescription : K.notFoundCustomerDescription
329
- })]
330
- })]
331
- })
332
- })
333
- });
334
- let $ = D || !C;
335
- return /* @__PURE__ */ _(s, {
336
- open: e,
337
- onOpenChange: Q,
338
- children: /* @__PURE__ */ v(c, {
339
- showCloseButton: !1,
340
- className: "ttw:w-160 ttw:sm:max-w-160 ttw:gap-0 ttw:overflow-y-auto",
341
- children: [/* @__PURE__ */ v(u, {
342
- className: "ttw:flex-row ttw:items-start ttw:justify-between ttw:gap-4 ttw:border-b ttw:border-border ttw:px-6 ttw:py-6",
343
- children: [/* @__PURE__ */ _("div", {
344
- className: "ttw:flex ttw:min-w-0 ttw:flex-col ttw:gap-1",
345
- children: $ ? /* @__PURE__ */ v(g, { children: [
346
- /* @__PURE__ */ _(d, {
347
- className: "ttw:sr-only",
348
- children: K.loadingTitle
33
+ }),
34
+ /* @__PURE__ */ _(u, { labels: m(A, b.requiredFieldsLegend) }),
35
+ b.formError && /* @__PURE__ */ _(f, {
36
+ variant: "body2",
37
+ color: "destructive",
38
+ role: "alert",
39
+ children: b.formError
40
+ }),
41
+ S.kind === "person" ? /* @__PURE__ */ v("div", {
42
+ className: "ttw:flex ttw:gap-4",
43
+ children: [/* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
44
+ /* @__PURE__ */ _(o, {
45
+ htmlFor: "counterpart-edit-first-name",
46
+ requirement: "required",
47
+ labels: A,
48
+ children: k.firstNameLabel
349
49
  }),
350
- /* @__PURE__ */ _(f, { className: "ttw:h-8 ttw:w-40" }),
351
- /* @__PURE__ */ _(l, {
352
- className: "ttw:sr-only",
353
- children: K.hiddenDescription
50
+ /* @__PURE__ */ _(s, {
51
+ id: "counterpart-edit-first-name",
52
+ "aria-required": !0,
53
+ className: "ttw:bg-background",
54
+ value: S.firstName.value,
55
+ disabled: O,
56
+ "aria-invalid": !!S.firstName.error || void 0,
57
+ onChange: (e) => b.onFieldChange("firstName", e.target.value)
354
58
  }),
355
- /* @__PURE__ */ _(f, { className: "ttw:h-5 ttw:w-60" })
356
- ] }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(d, {
357
- className: "ttw:truncate ttw:text-2xl",
358
- children: C.name
359
- }), /* @__PURE__ */ _(l, { children: C.subtitle ?? K.hiddenDescription })] })
360
- }), /* @__PURE__ */ v("div", {
361
- className: "ttw:flex ttw:gap-2",
362
- children: [N && C && /* @__PURE__ */ v(n, { children: [/* @__PURE__ */ _(a, {
363
- asChild: !0,
364
- children: /* @__PURE__ */ _(t, {
365
- type: "button",
366
- variant: "outline",
367
- size: "icon",
368
- "aria-label": K.openActionsMenu,
369
- children: /* @__PURE__ */ _(x, { className: "ttw:size-4" })
370
- })
371
- }), /* @__PURE__ */ _(r, {
372
- align: "end",
373
- children: /* @__PURE__ */ v(i, {
374
- variant: "destructive",
375
- onClick: F,
376
- children: [/* @__PURE__ */ _(w, { className: "ttw:size-4" }), X ? K.deleteVendorAction : K.deleteCustomerAction]
377
- })
378
- })] }), /* @__PURE__ */ _(t, {
379
- type: "button",
380
- variant: "outline",
381
- size: "icon",
382
- "aria-label": K.closeAction,
383
- onClick: () => {
384
- q(null), I();
385
- },
386
- children: /* @__PURE__ */ _(T, { className: "ttw:size-4" })
387
- })]
388
- })]
389
- }), $ ? /* @__PURE__ */ _("div", {
390
- className: "ttw:flex ttw:flex-1 ttw:items-center ttw:justify-center ttw:p-6",
391
- children: /* @__PURE__ */ _(ee, {})
392
- }) : /* @__PURE__ */ v("main", {
393
- className: "ttw:flex ttw:flex-col ttw:gap-6 ttw:p-6",
394
- children: [
395
- /* @__PURE__ */ v("div", {
396
- className: "ttw:flex ttw:flex-col ttw:gap-4",
397
- children: [/* @__PURE__ */ _(j, {
398
- mode: S,
399
- summary: C.summary,
400
- labels: K
401
- }), U && /* @__PURE__ */ _(t, {
402
- type: "button",
403
- className: "ttw:w-fit",
404
- onClick: U,
405
- children: X ? K.sendPaymentAction : K.issueInvoiceAction
406
- })]
59
+ /* @__PURE__ */ _(a, { errors: y(S.firstName.error) })
60
+ ] }) }), /* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
61
+ /* @__PURE__ */ _(o, {
62
+ htmlFor: "counterpart-edit-last-name",
63
+ requirement: "required",
64
+ labels: A,
65
+ children: k.lastNameLabel
66
+ }),
67
+ /* @__PURE__ */ _(s, {
68
+ id: "counterpart-edit-last-name",
69
+ "aria-required": !0,
70
+ className: "ttw:bg-background",
71
+ value: S.lastName.value,
72
+ disabled: O,
73
+ "aria-invalid": !!S.lastName.error || void 0,
74
+ onChange: (e) => b.onFieldChange("lastName", e.target.value)
75
+ }),
76
+ /* @__PURE__ */ _(a, { errors: y(S.lastName.error) })
77
+ ] }) })]
78
+ }) : /* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
79
+ /* @__PURE__ */ _(o, {
80
+ htmlFor: "counterpart-edit-business-name",
81
+ requirement: "required",
82
+ labels: A,
83
+ children: k.businessNameLabel
407
84
  }),
408
- /* @__PURE__ */ _(oe, {
409
- mode: S,
410
- documents: C.recentDocuments,
411
- labels: K,
412
- onViewAll: H
85
+ /* @__PURE__ */ _(s, {
86
+ id: "counterpart-edit-business-name",
87
+ "aria-required": !0,
88
+ className: "ttw:bg-background",
89
+ value: S.businessName.value,
90
+ disabled: O,
91
+ "aria-invalid": !!S.businessName.error || void 0,
92
+ onChange: (e) => b.onFieldChange("businessName", e.target.value)
413
93
  }),
414
- /* @__PURE__ */ v("section", {
415
- className: "ttw:flex ttw:flex-col",
416
- children: [/* @__PURE__ */ v("div", {
417
- className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:pb-5",
418
- children: [/* @__PURE__ */ _(p, {
419
- variant: "body1",
420
- className: "ttw:font-medium",
421
- children: X ? K.vendorDetailsHeading : K.customerDetailsHeading
422
- }), k && !W && /* @__PURE__ */ _(t, {
423
- type: "button",
424
- variant: "link",
425
- className: "ttw:h-auto ttw:p-0",
426
- onClick: P,
427
- children: K.editButton
94
+ /* @__PURE__ */ _(a, { errors: y(S.businessName.error) })
95
+ ] }) }),
96
+ /* @__PURE__ */ v("div", {
97
+ className: p("ttw:flex ttw:gap-4", b.contactLayout === "inline" ? "ttw:flex-row" : "ttw:flex-col"),
98
+ children: [
99
+ /* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
100
+ /* @__PURE__ */ _(o, {
101
+ htmlFor: "counterpart-edit-email",
102
+ requirement: "required",
103
+ labels: A,
104
+ children: k.rowEmail
105
+ }),
106
+ /* @__PURE__ */ _(s, {
107
+ id: "counterpart-edit-email",
108
+ "aria-required": !0,
109
+ type: "email",
110
+ className: "ttw:bg-background",
111
+ value: C.value,
112
+ disabled: O,
113
+ "aria-invalid": !!C.error || void 0,
114
+ onChange: (e) => b.onFieldChange("email", e.target.value)
115
+ }),
116
+ /* @__PURE__ */ _(a, { errors: y(C.error) })
117
+ ] }) }),
118
+ E && /* @__PURE__ */ v(l, {
119
+ htmlFor: "counterpart-edit-reminders",
120
+ className: "ttw:flex ttw:items-start ttw:gap-3 ttw:rounded-md ttw:border ttw:border-border ttw:bg-background ttw:p-3",
121
+ children: [/* @__PURE__ */ _(t, {
122
+ id: "counterpart-edit-reminders",
123
+ checked: E.checked,
124
+ disabled: O,
125
+ onCheckedChange: (e) => b.onRemindersChange(e === !0)
126
+ }), /* @__PURE__ */ v("span", {
127
+ className: "ttw:flex ttw:flex-col ttw:gap-0.5",
128
+ children: [/* @__PURE__ */ _("span", {
129
+ className: "ttw:text-sm ttw:font-medium",
130
+ children: k.remindersCheckboxLabel
131
+ }), /* @__PURE__ */ _("span", {
132
+ className: "ttw:text-sm ttw:text-muted-foreground",
133
+ children: k.remindersCheckboxDescription
134
+ })]
428
135
  })]
429
- }), W ? /* @__PURE__ */ _(h, {
430
- form: W,
431
- labels: K
432
- }) : /* @__PURE__ */ v("div", {
433
- className: te("ttw:border-t ttw:border-border", !X && "ttw:border-b"),
434
- children: [
435
- /* @__PURE__ */ _(A, {
436
- label: K.rowType,
437
- children: C.entityTypeLabel ?? E
438
- }),
439
- /* @__PURE__ */ _(A, {
440
- label: K.rowName,
441
- children: C.name
442
- }),
443
- /* @__PURE__ */ _(A, {
444
- label: K.rowEmail,
445
- children: C.email || E
446
- }),
447
- !X && /* @__PURE__ */ _(A, {
448
- label: K.rowPaymentReminders,
449
- children: C.remindersLabel ?? E
450
- }),
451
- /* @__PURE__ */ _(A, {
452
- label: K.rowPhone,
453
- children: C.phone || E
454
- }),
455
- /* @__PURE__ */ _(A, {
456
- label: C.entityType === "individual" ? K.rowTaxIdSsn : K.rowTaxIdEin,
457
- isLast: !X,
458
- children: /* @__PURE__ */ v("div", {
459
- className: "ttw:flex ttw:flex-col ttw:gap-2",
460
- children: [/* @__PURE__ */ v("div", {
461
- className: "ttw:flex ttw:items-center ttw:gap-2",
462
- children: [/* @__PURE__ */ _("span", {
463
- className: "ttw:font-medium",
464
- children: ue
465
- }), C.taxId && /* @__PURE__ */ v(t, {
466
- type: "button",
467
- variant: "outline",
468
- size: "sm",
469
- onClick: () => {
470
- q((e) => e === J ? null : J);
471
- },
472
- children: [_(Y ? b : y, { className: "ttw:size-4" }), Y ? K.hideTaxId : K.showTaxId]
473
- })]
474
- }), Z && /* @__PURE__ */ _(p, {
475
- variant: "body2",
476
- className: "ttw:text-muted-foreground",
477
- children: Z
478
- })]
479
- })
480
- }),
481
- X && /* @__PURE__ */ _(A, {
482
- label: K.addressHeading,
483
- isLast: !0,
484
- children: /* @__PURE__ */ _(M, {
485
- mode: S,
486
- addressLines: C.addressLines,
487
- canEdit: k,
488
- onEditAddress: L,
489
- onAddAddress: R,
490
- labels: K,
491
- addressForm: G
492
- })
493
- })
494
- ]
495
- })]
136
+ }),
137
+ /* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
138
+ /* @__PURE__ */ _(o, {
139
+ htmlFor: "counterpart-edit-phone",
140
+ requirement: "optional",
141
+ labels: A,
142
+ children: k.rowPhone
143
+ }),
144
+ /* @__PURE__ */ _(s, {
145
+ id: "counterpart-edit-phone",
146
+ type: "tel",
147
+ className: "ttw:bg-background",
148
+ value: w.value,
149
+ disabled: O,
150
+ "aria-invalid": !!w.error || void 0,
151
+ onChange: (e) => b.onFieldChange("phone", e.target.value)
152
+ }),
153
+ /* @__PURE__ */ _(a, { errors: y(w.error) })
154
+ ] }) })
155
+ ]
156
+ }),
157
+ /* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
158
+ /* @__PURE__ */ _(o, {
159
+ htmlFor: "counterpart-edit-tax-id",
160
+ requirement: "optional",
161
+ labels: A,
162
+ children: T.label
496
163
  }),
497
- !X && /* @__PURE__ */ _(M, {
498
- mode: S,
499
- addressLines: C.addressLines,
500
- canEdit: k,
501
- onEditAddress: L,
502
- onAddAddress: R,
503
- labels: K,
504
- addressForm: G
164
+ /* @__PURE__ */ _(s, {
165
+ id: "counterpart-edit-tax-id",
166
+ className: "ttw:bg-background",
167
+ placeholder: T.placeholder,
168
+ value: T.value,
169
+ disabled: O,
170
+ "aria-invalid": !!T.error || void 0,
171
+ onChange: (e) => b.onFieldChange("taxId", e.target.value)
505
172
  }),
506
- X && /* @__PURE__ */ _(se, {
507
- paymentMethod: C.paymentMethod,
508
- canEdit: k,
509
- onAddBankAccount: z,
510
- onEditBankAccount: B,
511
- onDeleteBankAccount: V,
512
- labels: K
173
+ /* @__PURE__ */ _(i, { children: T.description }),
174
+ /* @__PURE__ */ _(a, { errors: y(T.error) })
175
+ ] }) }),
176
+ D && /* @__PURE__ */ _("div", {
177
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
178
+ children: /* @__PURE__ */ _(h, {
179
+ idPrefix: "counterpart-edit-address",
180
+ values: D.values,
181
+ errors: D.errors,
182
+ stateOptions: b.stateOptions,
183
+ disabled: O,
184
+ onChange: b.onAddressChange,
185
+ labels: g(k, {
186
+ ...A,
187
+ ...b.addressFieldMarkers
188
+ })
513
189
  })
514
- ]
190
+ })
191
+ ]
192
+ }), /* @__PURE__ */ v("div", {
193
+ className: "ttw:flex ttw:justify-end ttw:gap-4 ttw:pt-6",
194
+ children: [/* @__PURE__ */ _(e, {
195
+ type: "button",
196
+ variant: "outline",
197
+ className: "ttw:w-fit ttw:border-border",
198
+ disabled: O,
199
+ onClick: b.onCancel,
200
+ children: k.cancelButton
201
+ }), /* @__PURE__ */ v(e, {
202
+ type: "submit",
203
+ className: "ttw:w-fit",
204
+ disabled: O || b.submitDisabled,
205
+ children: [O && /* @__PURE__ */ _(d, {}), k.saveButton]
515
206
  })]
516
- })
207
+ })]
517
208
  });
518
209
  }
519
210
  //#endregion
520
- export { N as CounterpartDetailsSheet, N as default };
211
+ export { b as CounterpartEditForm };