@tesouro/embedded-components-react 0.7.17 → 0.7.19

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