@tesouro/embedded-components-react 0.5.51 → 0.5.53

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 (38) hide show
  1. package/dist/index.d.ts +42 -1
  2. package/dist/lib/CounterpartsWidget.d.ts +41 -0
  3. package/dist/lib/ReceivablesWidget.d.ts +40 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +6 -9
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +9 -12
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +1 -2
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +8 -8
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +18 -4
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +91 -88
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index104.js +18 -3
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index106.js +113 -102
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +5 -1
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +28 -20
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +148 -147
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +15 -3
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +39 -34
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +16 -4
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +203 -174
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +15 -3
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +52 -52
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +22 -3
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +2 -17
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +31 -31
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +97 -96
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +15 -3
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +57 -61
  27. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +189 -188
  28. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +1 -0
  29. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +1 -0
  30. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +54 -37
  31. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +23 -16
  32. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index3.js +1 -0
  33. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index5.js +54 -41
  34. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index6.js +88 -70
  35. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +333 -282
  36. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  37. package/dist/packages/shared-ui-shadcn/dist/index.js +3757 -3705
  38. package/package.json +1 -1
@@ -1,15 +1,15 @@
1
- import { Button as e, Checkbox as t, Input as n, Label as r, Separator as i, Typography as a } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { COUNTERPART_FORM_SHEET_LABELS_EN as o } from "./index2.js";
3
- import { FieldError as s } from "./index4.js";
4
- import { AchFieldGroup as c } from "./index5.js";
5
- import { AddressFieldGroup as l } from "./index6.js";
6
- import { CounterpartTypeChooser as u } from "./index7.js";
7
- import { FormSheet as d } from "./index8.js";
8
- import { useEffect as f, useId as p, useRef as m } from "react";
9
- import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
10
- import { Plus as v } from "lucide-react";
1
+ import { Button as e, Checkbox as t, FieldRequirement as n, Input as r, Label as i, RequiredFieldsLegend as a, Separator as o, Typography as s, mergeRequiredFieldsLegendLabels as c } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { COUNTERPART_FORM_SHEET_LABELS_EN as l } from "./index2.js";
3
+ import { FieldError as u } from "./index4.js";
4
+ import { AchFieldGroup as d } from "./index5.js";
5
+ import { AddressFieldGroup as f } from "./index6.js";
6
+ import { CounterpartTypeChooser as p } from "./index7.js";
7
+ import { FormSheet as m } from "./index8.js";
8
+ import { useEffect as h, useId as g, useRef as _ } from "react";
9
+ import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
10
+ import { Plus as x } from "lucide-react";
11
11
  //#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js
12
- var y = {
12
+ var S = {
13
13
  entityType: !0,
14
14
  title: !0,
15
15
  profileHeading: !0,
@@ -18,463 +18,514 @@ var y = {
18
18
  address: !0,
19
19
  bankAccount: !0
20
20
  };
21
- function b({ show: e, sectionsToExpand: t }) {
21
+ function C({ show: e, sectionsToExpand: t }) {
22
22
  return {
23
23
  isAddressShown: e.address === !0 || e.address === "collapsible",
24
24
  isAddressExpanded: e.address === !0 || t?.address === !0
25
25
  };
26
26
  }
27
- function x(e) {
28
- let t = m(null), n = m(e);
29
- return f(() => {
27
+ function w(e) {
28
+ let t = _(null), n = _(e);
29
+ return h(() => {
30
30
  e !== n.current && (n.current = e, (t.current?.querySelector("[aria-invalid=\"true\"]"))?.focus());
31
31
  }, [e]), t;
32
32
  }
33
- function S(e) {
33
+ function T(e) {
34
+ let t = {
35
+ ...l.fieldMarkers,
36
+ ...e?.fieldMarkers
37
+ };
34
38
  return {
35
- ...o,
39
+ ...l,
36
40
  ...e,
41
+ fieldMarkers: t,
37
42
  address: {
38
- ...o.address,
39
- ...e?.address
43
+ ...l.address,
44
+ ...e?.address,
45
+ fieldMarkers: {
46
+ ...t,
47
+ ...e?.address?.fieldMarkers
48
+ }
40
49
  },
50
+ requiredFieldsLegend: c(t, e?.requiredFieldsLegend),
41
51
  ach: {
42
- ...o.ach,
52
+ ...l.ach,
43
53
  ...e?.accountHolderNameLabel !== void 0 && { accountHolderName: e.accountHolderNameLabel },
44
54
  ...e?.routingNumberLabel !== void 0 && { routingNumber: e.routingNumberLabel },
45
55
  ...e?.accountNumberLabel !== void 0 && { accountNumber: e.accountNumberLabel },
46
- ...e?.ach
56
+ ...e?.ach,
57
+ fieldMarkers: {
58
+ ...t,
59
+ ...e?.ach?.fieldMarkers
60
+ }
47
61
  }
48
62
  };
49
63
  }
50
- function C({ open: o, onOpenChange: f, mode: m, counterpartMode: C = "customer", values: w, errors: T, stateOptions: E, inProgress: D, submitDisabled: O, onChange: k, onAddressChange: A, onBankAccountChange: j, onSubmit: M, onCancel: N, sections: P, sectionsToExpand: F, onAddressExpand: I, labels: L }) {
51
- let R = S(L), z = {
52
- ...y,
53
- ...P
54
- }, B = p(), V = w.entityType === "organization", H = C === "customer", U = C === "vendor", { isAddressShown: W, isAddressExpanded: G } = b({
55
- show: z,
56
- sectionsToExpand: F
57
- }), K = x(T), q = m === "edit" ? H ? R.editTitleCustomer : R.editTitleVendor : H ? R.createTitleCustomer : R.createTitleVendor, J = m === "create" ? H ? R.createDescriptionCustomer : R.createDescriptionVendor : void 0, Y = H ? R.customerTypeHeading : R.vendorTypeHeading, X = H ? R.customerTaxIdHelp : R.vendorTaxIdHelp;
58
- return /* @__PURE__ */ g(d, {
59
- open: o,
60
- onOpenChange: f,
61
- title: q,
62
- description: J,
63
- formError: T?.form,
64
- inProgress: D,
65
- submitDisabled: O,
66
- submitLabel: m === "edit" ? R.saveButton : R.createButton,
67
- cancelLabel: R.cancelButton,
68
- onSubmit: M,
69
- onCancel: N,
70
- children: /* @__PURE__ */ _("div", {
71
- ref: K,
64
+ function E({ open: c, onOpenChange: l, mode: h, counterpartMode: _ = "customer", values: E, errors: D, stateOptions: O, inProgress: k, submitDisabled: A, onChange: j, onAddressChange: M, onBankAccountChange: N, onSubmit: P, onCancel: F, sections: I, sectionsToExpand: L, onAddressExpand: R, labels: z }) {
65
+ let B = T(z), V = {
66
+ ...S,
67
+ ...I
68
+ }, H = g(), U = E.entityType === "organization", W = _ === "customer", G = _ === "vendor", { isAddressShown: K, isAddressExpanded: q } = C({
69
+ show: V,
70
+ sectionsToExpand: L
71
+ }), J = w(D), Y = h === "edit" ? W ? B.editTitleCustomer : B.editTitleVendor : W ? B.createTitleCustomer : B.createTitleVendor, X = h === "create" ? W ? B.createDescriptionCustomer : B.createDescriptionVendor : void 0, Z = W ? B.customerTypeHeading : B.vendorTypeHeading, Q = W ? B.customerTaxIdHelp : B.vendorTaxIdHelp;
72
+ return /* @__PURE__ */ y(m, {
73
+ open: c,
74
+ onOpenChange: l,
75
+ title: Y,
76
+ description: X,
77
+ formError: D?.form,
78
+ inProgress: k,
79
+ submitDisabled: A,
80
+ submitLabel: h === "edit" ? B.saveButton : B.createButton,
81
+ cancelLabel: B.cancelButton,
82
+ onSubmit: P,
83
+ onCancel: F,
84
+ children: /* @__PURE__ */ b("div", {
85
+ ref: J,
72
86
  style: { display: "contents" },
73
87
  children: [
74
- m === "create" && /* @__PURE__ */ g(u, {
75
- value: w.entityType,
76
- onChange: (e) => k({ entityType: e }),
88
+ /* @__PURE__ */ y(a, { labels: B.requiredFieldsLegend }),
89
+ h === "create" && /* @__PURE__ */ y(p, {
90
+ value: E.entityType,
91
+ onChange: (e) => j({ entityType: e }),
77
92
  variant: "pills",
78
93
  labels: {
79
- heading: Y,
80
- organization: R.businessTypeOption,
81
- organizationHint: R.businessTypeHint,
82
- individual: R.personTypeOption,
83
- individualHint: R.personTypeHint
94
+ heading: Z,
95
+ organization: B.businessTypeOption,
96
+ organizationHint: B.businessTypeHint,
97
+ individual: B.personTypeOption,
98
+ individualHint: B.personTypeHint
84
99
  }
85
100
  }),
86
- z.profileHeading && /* @__PURE__ */ g(a, {
101
+ V.profileHeading && /* @__PURE__ */ y(s, {
87
102
  variant: "body2",
88
103
  className: "ttw:font-semibold",
89
- children: R.profileHeading
104
+ children: B.profileHeading
90
105
  }),
91
- V ? /* @__PURE__ */ _("div", {
106
+ U ? /* @__PURE__ */ b("div", {
92
107
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
93
108
  children: [
94
- /* @__PURE__ */ g(r, {
95
- htmlFor: `${B}-legal-name`,
96
- children: R.businessNameLabel
109
+ /* @__PURE__ */ y(i, {
110
+ htmlFor: `${H}-legal-name`,
111
+ requirement: n.Required,
112
+ labels: B.fieldMarkers,
113
+ children: B.businessNameLabel
97
114
  }),
98
- /* @__PURE__ */ g(n, {
99
- id: `${B}-legal-name`,
115
+ /* @__PURE__ */ y(r, {
116
+ id: `${H}-legal-name`,
100
117
  autoFocus: !0,
101
- value: w.legalName,
102
- "aria-invalid": !!T?.legalName,
103
- onChange: (e) => k({ legalName: e.target.value })
118
+ value: E.legalName,
119
+ "aria-required": !0,
120
+ "aria-invalid": !!D?.legalName,
121
+ onChange: (e) => j({ legalName: e.target.value })
104
122
  }),
105
- /* @__PURE__ */ g(s, { message: T?.legalName })
123
+ /* @__PURE__ */ y(u, { message: D?.legalName })
106
124
  ]
107
- }) : /* @__PURE__ */ _("div", {
125
+ }) : /* @__PURE__ */ b("div", {
108
126
  className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
109
- children: [/* @__PURE__ */ _("div", {
127
+ children: [/* @__PURE__ */ b("div", {
110
128
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
111
129
  children: [
112
- /* @__PURE__ */ g(r, {
113
- htmlFor: `${B}-first-name`,
114
- children: R.firstNameLabel
130
+ /* @__PURE__ */ y(i, {
131
+ htmlFor: `${H}-first-name`,
132
+ requirement: n.Required,
133
+ labels: B.fieldMarkers,
134
+ children: B.firstNameLabel
115
135
  }),
116
- /* @__PURE__ */ g(n, {
117
- id: `${B}-first-name`,
136
+ /* @__PURE__ */ y(r, {
137
+ id: `${H}-first-name`,
118
138
  autoFocus: !0,
119
- value: w.firstName,
120
- "aria-invalid": !!T?.firstName,
121
- onChange: (e) => k({ firstName: e.target.value })
139
+ value: E.firstName,
140
+ "aria-required": !0,
141
+ "aria-invalid": !!D?.firstName,
142
+ onChange: (e) => j({ firstName: e.target.value })
122
143
  }),
123
- /* @__PURE__ */ g(s, { message: T?.firstName })
144
+ /* @__PURE__ */ y(u, { message: D?.firstName })
124
145
  ]
125
- }), /* @__PURE__ */ _("div", {
146
+ }), /* @__PURE__ */ b("div", {
126
147
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
127
148
  children: [
128
- /* @__PURE__ */ g(r, {
129
- htmlFor: `${B}-last-name`,
130
- children: R.lastNameLabel
149
+ /* @__PURE__ */ y(i, {
150
+ htmlFor: `${H}-last-name`,
151
+ requirement: n.Required,
152
+ labels: B.fieldMarkers,
153
+ children: B.lastNameLabel
131
154
  }),
132
- /* @__PURE__ */ g(n, {
133
- id: `${B}-last-name`,
134
- value: w.lastName,
135
- "aria-invalid": !!T?.lastName,
136
- onChange: (e) => k({ lastName: e.target.value })
155
+ /* @__PURE__ */ y(r, {
156
+ id: `${H}-last-name`,
157
+ value: E.lastName,
158
+ "aria-required": !0,
159
+ "aria-invalid": !!D?.lastName,
160
+ onChange: (e) => j({ lastName: e.target.value })
137
161
  }),
138
- /* @__PURE__ */ g(s, { message: T?.lastName })
162
+ /* @__PURE__ */ y(u, { message: D?.lastName })
139
163
  ]
140
164
  })]
141
165
  }),
142
- !V && z.title && /* @__PURE__ */ _("div", {
166
+ !U && V.title && /* @__PURE__ */ b("div", {
143
167
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
144
- children: [/* @__PURE__ */ g(r, {
145
- htmlFor: `${B}-title`,
146
- children: R.titleLabel
147
- }), /* @__PURE__ */ g(n, {
148
- id: `${B}-title`,
149
- value: w.title,
150
- onChange: (e) => k({ title: e.target.value })
168
+ children: [/* @__PURE__ */ y(i, {
169
+ htmlFor: `${H}-title`,
170
+ requirement: n.Optional,
171
+ labels: B.fieldMarkers,
172
+ children: B.titleLabel
173
+ }), /* @__PURE__ */ y(r, {
174
+ id: `${H}-title`,
175
+ value: E.title,
176
+ onChange: (e) => j({ title: e.target.value })
151
177
  })]
152
178
  }),
153
- /* @__PURE__ */ _("div", {
179
+ /* @__PURE__ */ b("div", {
154
180
  className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
155
- children: [/* @__PURE__ */ _("div", {
181
+ children: [/* @__PURE__ */ b("div", {
156
182
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
157
183
  children: [
158
- /* @__PURE__ */ g(r, {
159
- htmlFor: `${B}-email`,
160
- children: R.emailLabel
184
+ /* @__PURE__ */ y(i, {
185
+ htmlFor: `${H}-email`,
186
+ requirement: n.Required,
187
+ labels: B.fieldMarkers,
188
+ children: B.emailLabel
161
189
  }),
162
- /* @__PURE__ */ g(n, {
163
- id: `${B}-email`,
190
+ /* @__PURE__ */ y(r, {
191
+ id: `${H}-email`,
164
192
  type: "email",
165
- value: w.email,
166
- "aria-invalid": !!T?.email,
167
- onChange: (e) => k({ email: e.target.value })
193
+ value: E.email,
194
+ "aria-required": !0,
195
+ "aria-invalid": !!D?.email,
196
+ onChange: (e) => j({ email: e.target.value })
168
197
  }),
169
- /* @__PURE__ */ g(s, { message: T?.email })
198
+ /* @__PURE__ */ y(u, { message: D?.email })
170
199
  ]
171
- }), /* @__PURE__ */ _("div", {
200
+ }), /* @__PURE__ */ b("div", {
172
201
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
173
- children: [/* @__PURE__ */ g(r, {
174
- htmlFor: `${B}-phone`,
175
- children: R.phoneLabel
176
- }), /* @__PURE__ */ g(n, {
177
- id: `${B}-phone`,
178
- value: w.phone,
179
- onChange: (e) => k({ phone: e.target.value })
202
+ children: [/* @__PURE__ */ y(i, {
203
+ htmlFor: `${H}-phone`,
204
+ requirement: n.Optional,
205
+ labels: B.fieldMarkers,
206
+ children: B.phoneLabel
207
+ }), /* @__PURE__ */ y(r, {
208
+ id: `${H}-phone`,
209
+ value: E.phone,
210
+ onChange: (e) => j({ phone: e.target.value })
180
211
  })]
181
212
  })]
182
213
  }),
183
- z.taxId && /* @__PURE__ */ _("div", {
214
+ V.taxId && /* @__PURE__ */ b("div", {
184
215
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
185
216
  children: [
186
- /* @__PURE__ */ g(r, {
187
- htmlFor: `${B}-tax-id`,
188
- children: R.taxIdLabel
217
+ /* @__PURE__ */ y(i, {
218
+ htmlFor: `${H}-tax-id`,
219
+ requirement: n.Optional,
220
+ labels: B.fieldMarkers,
221
+ children: B.taxIdLabel
189
222
  }),
190
- /* @__PURE__ */ g(n, {
191
- id: `${B}-tax-id`,
192
- value: w.taxId,
193
- onChange: (e) => k({ taxId: e.target.value })
223
+ /* @__PURE__ */ y(r, {
224
+ id: `${H}-tax-id`,
225
+ value: E.taxId,
226
+ onChange: (e) => j({ taxId: e.target.value })
194
227
  }),
195
- /* @__PURE__ */ g(a, {
228
+ /* @__PURE__ */ y(s, {
196
229
  variant: "caption",
197
230
  className: "ttw:text-muted-foreground",
198
- children: X
231
+ children: Q
199
232
  })
200
233
  ]
201
234
  }),
202
- H && /* @__PURE__ */ _(r, {
203
- htmlFor: `${B}-reminders`,
235
+ W && /* @__PURE__ */ b(i, {
236
+ htmlFor: `${H}-reminders`,
204
237
  className: "ttw:flex ttw:items-start ttw:gap-3 ttw:rounded-md ttw:border ttw:p-3",
205
- children: [/* @__PURE__ */ g(t, {
206
- id: `${B}-reminders`,
207
- checked: w.remindersEnabled,
208
- onCheckedChange: (e) => k({ remindersEnabled: e === !0 })
209
- }), /* @__PURE__ */ _("span", {
238
+ children: [/* @__PURE__ */ y(t, {
239
+ id: `${H}-reminders`,
240
+ checked: E.remindersEnabled,
241
+ onCheckedChange: (e) => j({ remindersEnabled: e === !0 })
242
+ }), /* @__PURE__ */ b("span", {
210
243
  className: "ttw:flex ttw:flex-col ttw:gap-0.5",
211
- children: [/* @__PURE__ */ g("span", {
244
+ children: [/* @__PURE__ */ y("span", {
212
245
  className: "ttw:text-sm ttw:font-medium",
213
- children: R.paymentRemindersLabel
214
- }), /* @__PURE__ */ g("span", {
246
+ children: B.paymentRemindersLabel
247
+ }), /* @__PURE__ */ y("span", {
215
248
  className: "ttw:text-sm ttw:text-muted-foreground",
216
- children: R.paymentRemindersDescription
249
+ children: B.paymentRemindersDescription
217
250
  })]
218
251
  })]
219
252
  }),
220
- W && /* @__PURE__ */ _(h, { children: [z.addressHeading && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(i, { className: "ttw:my-1" }), /* @__PURE__ */ _("div", {
253
+ K && /* @__PURE__ */ b(v, { children: [V.addressHeading && /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(o, { className: "ttw:my-1" }), /* @__PURE__ */ b("div", {
221
254
  className: "ttw:flex ttw:flex-col ttw:gap-1",
222
- children: [/* @__PURE__ */ g(a, {
255
+ children: [/* @__PURE__ */ y(s, {
223
256
  variant: "body2",
224
257
  className: "ttw:font-semibold",
225
- children: R.addressHeading
226
- }), H && /* @__PURE__ */ g(a, {
258
+ children: B.addressHeading
259
+ }), W && /* @__PURE__ */ y(s, {
227
260
  variant: "body2",
228
261
  className: "ttw:text-muted-foreground",
229
- children: R.customerAddressDescription
262
+ children: B.customerAddressDescription
230
263
  })]
231
- })] }), G ? /* @__PURE__ */ g(l, {
232
- idPrefix: `${B}-address`,
233
- values: w.address,
234
- errors: T?.address,
235
- stateOptions: E,
236
- onChange: A,
237
- labels: R.address
238
- }) : /* @__PURE__ */ _(e, {
264
+ })] }), q ? /* @__PURE__ */ y(f, {
265
+ idPrefix: `${H}-address`,
266
+ values: E.address,
267
+ errors: D?.address,
268
+ stateOptions: O,
269
+ onChange: M,
270
+ labels: B.address
271
+ }) : /* @__PURE__ */ b(e, {
239
272
  type: "button",
240
273
  variant: "link",
241
274
  className: "ttw:w-fit ttw:px-0",
242
- onClick: I,
243
- children: [/* @__PURE__ */ g(v, { className: "ttw:size-4" }), R.addAddress]
275
+ onClick: R,
276
+ children: [/* @__PURE__ */ y(x, { className: "ttw:size-4" }), B.addAddress]
244
277
  })] }),
245
- U && z.bankAccount && /* @__PURE__ */ _(h, { children: [
246
- /* @__PURE__ */ g(i, { className: "ttw:my-1" }),
247
- /* @__PURE__ */ _("div", {
278
+ G && V.bankAccount && /* @__PURE__ */ b(v, { children: [
279
+ /* @__PURE__ */ y(o, { className: "ttw:my-1" }),
280
+ /* @__PURE__ */ b("div", {
248
281
  className: "ttw:flex ttw:flex-col ttw:gap-1",
249
- children: [/* @__PURE__ */ g(a, {
282
+ children: [/* @__PURE__ */ y(s, {
250
283
  variant: "body2",
251
284
  className: "ttw:font-semibold",
252
- children: R.paymentMethodsHeading
253
- }), /* @__PURE__ */ g(a, {
285
+ children: B.paymentMethodsHeading
286
+ }), /* @__PURE__ */ y(s, {
254
287
  variant: "body2",
255
288
  className: "ttw:text-muted-foreground",
256
- children: R.paymentMethodsDescription
289
+ children: B.paymentMethodsDescription
257
290
  })]
258
291
  }),
259
- /* @__PURE__ */ g(c, {
260
- idPrefix: `${B}-ach`,
261
- values: w.bankAccount,
262
- errors: T?.bankAccount,
263
- onChange: (e) => j?.(e),
264
- labels: R.ach
292
+ /* @__PURE__ */ y(d, {
293
+ idPrefix: `${H}-ach`,
294
+ values: E.bankAccount,
295
+ errors: D?.bankAccount,
296
+ onChange: (e) => N?.(e),
297
+ labels: B.ach
265
298
  })
266
299
  ] })
267
300
  ]
268
301
  })
269
302
  });
270
303
  }
271
- function w({ mode: o, counterpartMode: d = "customer", values: f, errors: m, stateOptions: C, onChange: w, onAddressChange: T, onBankAccountChange: E, sections: D, sectionsToExpand: O, onAddressExpand: k, labels: A }) {
272
- let j = S(A), M = {
273
- ...y,
274
- ...D
275
- }, N = p(), P = f.entityType === "organization", F = d === "customer", I = d === "vendor", { isAddressShown: L, isAddressExpanded: R } = b({
276
- show: M,
277
- sectionsToExpand: O
278
- }), z = x(m), B = F ? j.customerTypeHeading : j.vendorTypeHeading, V = F ? j.customerTaxIdHelp : j.vendorTaxIdHelp;
279
- return /* @__PURE__ */ _("div", {
280
- ref: z,
304
+ function D({ mode: a, counterpartMode: c = "customer", values: l, errors: m, stateOptions: h, onChange: _, onAddressChange: E, onBankAccountChange: D, sections: O, sectionsToExpand: k, onAddressExpand: A, labels: j }) {
305
+ let M = T(j), N = {
306
+ ...S,
307
+ ...O
308
+ }, P = g(), F = l.entityType === "organization", I = c === "customer", L = c === "vendor", { isAddressShown: R, isAddressExpanded: z } = C({
309
+ show: N,
310
+ sectionsToExpand: k
311
+ }), B = w(m), V = I ? M.customerTypeHeading : M.vendorTypeHeading, H = I ? M.customerTaxIdHelp : M.vendorTaxIdHelp;
312
+ return /* @__PURE__ */ b("div", {
313
+ ref: B,
281
314
  style: { display: "contents" },
282
315
  children: [
283
- o === "create" && M.entityType && /* @__PURE__ */ g(u, {
284
- value: f.entityType,
285
- onChange: (e) => w({ entityType: e }),
316
+ a === "create" && N.entityType && /* @__PURE__ */ y(p, {
317
+ value: l.entityType,
318
+ onChange: (e) => _({ entityType: e }),
286
319
  variant: "pills",
287
320
  labels: {
288
- heading: B,
289
- organization: j.businessTypeOption,
290
- organizationHint: j.businessTypeHint,
291
- individual: j.personTypeOption,
292
- individualHint: j.personTypeHint
321
+ heading: V,
322
+ organization: M.businessTypeOption,
323
+ organizationHint: M.businessTypeHint,
324
+ individual: M.personTypeOption,
325
+ individualHint: M.personTypeHint
293
326
  }
294
327
  }),
295
- M.profileHeading && /* @__PURE__ */ g(a, {
328
+ N.profileHeading && /* @__PURE__ */ y(s, {
296
329
  variant: "body2",
297
330
  className: "ttw:font-semibold",
298
- children: j.profileHeading
331
+ children: M.profileHeading
299
332
  }),
300
- P ? /* @__PURE__ */ _("div", {
333
+ F ? /* @__PURE__ */ b("div", {
301
334
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
302
335
  children: [
303
- /* @__PURE__ */ g(r, {
304
- htmlFor: `${N}-legal-name`,
305
- children: j.businessNameLabel
336
+ /* @__PURE__ */ y(i, {
337
+ htmlFor: `${P}-legal-name`,
338
+ requirement: n.Required,
339
+ labels: M.fieldMarkers,
340
+ children: M.businessNameLabel
306
341
  }),
307
- /* @__PURE__ */ g(n, {
308
- id: `${N}-legal-name`,
342
+ /* @__PURE__ */ y(r, {
343
+ id: `${P}-legal-name`,
309
344
  autoFocus: !0,
310
- value: f.legalName,
345
+ value: l.legalName,
346
+ "aria-required": !0,
311
347
  "aria-invalid": !!m?.legalName,
312
- onChange: (e) => w({ legalName: e.target.value })
348
+ onChange: (e) => _({ legalName: e.target.value })
313
349
  }),
314
- /* @__PURE__ */ g(s, { message: m?.legalName })
350
+ /* @__PURE__ */ y(u, { message: m?.legalName })
315
351
  ]
316
- }) : /* @__PURE__ */ _("div", {
352
+ }) : /* @__PURE__ */ b("div", {
317
353
  className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
318
- children: [/* @__PURE__ */ _("div", {
354
+ children: [/* @__PURE__ */ b("div", {
319
355
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
320
356
  children: [
321
- /* @__PURE__ */ g(r, {
322
- htmlFor: `${N}-first-name`,
323
- children: j.firstNameLabel
357
+ /* @__PURE__ */ y(i, {
358
+ htmlFor: `${P}-first-name`,
359
+ requirement: n.Required,
360
+ labels: M.fieldMarkers,
361
+ children: M.firstNameLabel
324
362
  }),
325
- /* @__PURE__ */ g(n, {
326
- id: `${N}-first-name`,
363
+ /* @__PURE__ */ y(r, {
364
+ id: `${P}-first-name`,
327
365
  autoFocus: !0,
328
- value: f.firstName,
366
+ value: l.firstName,
367
+ "aria-required": !0,
329
368
  "aria-invalid": !!m?.firstName,
330
- onChange: (e) => w({ firstName: e.target.value })
369
+ onChange: (e) => _({ firstName: e.target.value })
331
370
  }),
332
- /* @__PURE__ */ g(s, { message: m?.firstName })
371
+ /* @__PURE__ */ y(u, { message: m?.firstName })
333
372
  ]
334
- }), /* @__PURE__ */ _("div", {
373
+ }), /* @__PURE__ */ b("div", {
335
374
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
336
375
  children: [
337
- /* @__PURE__ */ g(r, {
338
- htmlFor: `${N}-last-name`,
339
- children: j.lastNameLabel
376
+ /* @__PURE__ */ y(i, {
377
+ htmlFor: `${P}-last-name`,
378
+ requirement: n.Required,
379
+ labels: M.fieldMarkers,
380
+ children: M.lastNameLabel
340
381
  }),
341
- /* @__PURE__ */ g(n, {
342
- id: `${N}-last-name`,
343
- value: f.lastName,
382
+ /* @__PURE__ */ y(r, {
383
+ id: `${P}-last-name`,
384
+ value: l.lastName,
385
+ "aria-required": !0,
344
386
  "aria-invalid": !!m?.lastName,
345
- onChange: (e) => w({ lastName: e.target.value })
387
+ onChange: (e) => _({ lastName: e.target.value })
346
388
  }),
347
- /* @__PURE__ */ g(s, { message: m?.lastName })
389
+ /* @__PURE__ */ y(u, { message: m?.lastName })
348
390
  ]
349
391
  })]
350
392
  }),
351
- !P && M.title && /* @__PURE__ */ _("div", {
393
+ !F && N.title && /* @__PURE__ */ b("div", {
352
394
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
353
- children: [/* @__PURE__ */ g(r, {
354
- htmlFor: `${N}-title`,
355
- children: j.titleLabel
356
- }), /* @__PURE__ */ g(n, {
357
- id: `${N}-title`,
358
- value: f.title,
359
- onChange: (e) => w({ title: e.target.value })
395
+ children: [/* @__PURE__ */ y(i, {
396
+ htmlFor: `${P}-title`,
397
+ requirement: n.Optional,
398
+ labels: M.fieldMarkers,
399
+ children: M.titleLabel
400
+ }), /* @__PURE__ */ y(r, {
401
+ id: `${P}-title`,
402
+ value: l.title,
403
+ onChange: (e) => _({ title: e.target.value })
360
404
  })]
361
405
  }),
362
- /* @__PURE__ */ _("div", {
406
+ /* @__PURE__ */ b("div", {
363
407
  className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
364
- children: [/* @__PURE__ */ _("div", {
408
+ children: [/* @__PURE__ */ b("div", {
365
409
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
366
410
  children: [
367
- /* @__PURE__ */ g(r, {
368
- htmlFor: `${N}-email`,
369
- children: j.emailLabel
411
+ /* @__PURE__ */ y(i, {
412
+ htmlFor: `${P}-email`,
413
+ requirement: n.Required,
414
+ labels: M.fieldMarkers,
415
+ children: M.emailLabel
370
416
  }),
371
- /* @__PURE__ */ g(n, {
372
- id: `${N}-email`,
417
+ /* @__PURE__ */ y(r, {
418
+ id: `${P}-email`,
373
419
  type: "email",
374
- value: f.email,
420
+ value: l.email,
421
+ "aria-required": !0,
375
422
  "aria-invalid": !!m?.email,
376
- onChange: (e) => w({ email: e.target.value })
423
+ onChange: (e) => _({ email: e.target.value })
377
424
  }),
378
- /* @__PURE__ */ g(s, { message: m?.email })
425
+ /* @__PURE__ */ y(u, { message: m?.email })
379
426
  ]
380
- }), /* @__PURE__ */ _("div", {
427
+ }), /* @__PURE__ */ b("div", {
381
428
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
382
- children: [/* @__PURE__ */ g(r, {
383
- htmlFor: `${N}-phone`,
384
- children: j.phoneLabel
385
- }), /* @__PURE__ */ g(n, {
386
- id: `${N}-phone`,
387
- value: f.phone,
388
- onChange: (e) => w({ phone: e.target.value })
429
+ children: [/* @__PURE__ */ y(i, {
430
+ htmlFor: `${P}-phone`,
431
+ requirement: n.Optional,
432
+ labels: M.fieldMarkers,
433
+ children: M.phoneLabel
434
+ }), /* @__PURE__ */ y(r, {
435
+ id: `${P}-phone`,
436
+ value: l.phone,
437
+ onChange: (e) => _({ phone: e.target.value })
389
438
  })]
390
439
  })]
391
440
  }),
392
- M.taxId && /* @__PURE__ */ _("div", {
441
+ N.taxId && /* @__PURE__ */ b("div", {
393
442
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
394
443
  children: [
395
- /* @__PURE__ */ g(r, {
396
- htmlFor: `${N}-tax-id`,
397
- children: j.taxIdLabel
444
+ /* @__PURE__ */ y(i, {
445
+ htmlFor: `${P}-tax-id`,
446
+ requirement: n.Optional,
447
+ labels: M.fieldMarkers,
448
+ children: M.taxIdLabel
398
449
  }),
399
- /* @__PURE__ */ g(n, {
400
- id: `${N}-tax-id`,
401
- value: f.taxId,
402
- onChange: (e) => w({ taxId: e.target.value })
450
+ /* @__PURE__ */ y(r, {
451
+ id: `${P}-tax-id`,
452
+ value: l.taxId,
453
+ onChange: (e) => _({ taxId: e.target.value })
403
454
  }),
404
- /* @__PURE__ */ g(a, {
455
+ /* @__PURE__ */ y(s, {
405
456
  variant: "caption",
406
457
  className: "ttw:text-muted-foreground",
407
- children: V
458
+ children: H
408
459
  })
409
460
  ]
410
461
  }),
411
- F && /* @__PURE__ */ _(r, {
412
- htmlFor: `${N}-reminders`,
462
+ I && /* @__PURE__ */ b(i, {
463
+ htmlFor: `${P}-reminders`,
413
464
  className: "ttw:flex ttw:items-start ttw:gap-3 ttw:rounded-md ttw:border ttw:p-3",
414
- children: [/* @__PURE__ */ g(t, {
415
- id: `${N}-reminders`,
416
- checked: f.remindersEnabled,
417
- onCheckedChange: (e) => w({ remindersEnabled: e === !0 })
418
- }), /* @__PURE__ */ _("span", {
465
+ children: [/* @__PURE__ */ y(t, {
466
+ id: `${P}-reminders`,
467
+ checked: l.remindersEnabled,
468
+ onCheckedChange: (e) => _({ remindersEnabled: e === !0 })
469
+ }), /* @__PURE__ */ b("span", {
419
470
  className: "ttw:flex ttw:flex-col ttw:gap-0.5",
420
- children: [/* @__PURE__ */ g("span", {
471
+ children: [/* @__PURE__ */ y("span", {
421
472
  className: "ttw:text-sm ttw:font-medium",
422
- children: j.paymentRemindersLabel
423
- }), /* @__PURE__ */ g("span", {
473
+ children: M.paymentRemindersLabel
474
+ }), /* @__PURE__ */ y("span", {
424
475
  className: "ttw:text-sm ttw:text-muted-foreground",
425
- children: j.paymentRemindersDescription
476
+ children: M.paymentRemindersDescription
426
477
  })]
427
478
  })]
428
479
  }),
429
- L && /* @__PURE__ */ _(h, { children: [M.addressHeading && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(i, { className: "ttw:my-1" }), /* @__PURE__ */ _("div", {
480
+ R && /* @__PURE__ */ b(v, { children: [N.addressHeading && /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(o, { className: "ttw:my-1" }), /* @__PURE__ */ b("div", {
430
481
  className: "ttw:flex ttw:flex-col ttw:gap-1",
431
- children: [/* @__PURE__ */ g(a, {
482
+ children: [/* @__PURE__ */ y(s, {
432
483
  variant: "body2",
433
484
  className: "ttw:font-semibold",
434
- children: j.addressHeading
435
- }), F && /* @__PURE__ */ g(a, {
485
+ children: M.addressHeading
486
+ }), I && /* @__PURE__ */ y(s, {
436
487
  variant: "body2",
437
488
  className: "ttw:text-muted-foreground",
438
- children: j.customerAddressDescription
489
+ children: M.customerAddressDescription
439
490
  })]
440
- })] }), R ? /* @__PURE__ */ g(l, {
441
- idPrefix: `${N}-address`,
442
- values: f.address,
491
+ })] }), z ? /* @__PURE__ */ y(f, {
492
+ idPrefix: `${P}-address`,
493
+ values: l.address,
443
494
  errors: m?.address,
444
- stateOptions: C,
445
- onChange: T,
446
- labels: j.address
447
- }) : /* @__PURE__ */ _(e, {
495
+ stateOptions: h,
496
+ onChange: E,
497
+ labels: M.address
498
+ }) : /* @__PURE__ */ b(e, {
448
499
  type: "button",
449
500
  variant: "link",
450
501
  className: "ttw:w-fit ttw:px-0",
451
- onClick: k,
452
- children: [/* @__PURE__ */ g(v, { className: "ttw:size-4" }), j.addAddress]
502
+ onClick: A,
503
+ children: [/* @__PURE__ */ y(x, { className: "ttw:size-4" }), M.addAddress]
453
504
  })] }),
454
- I && M.bankAccount && /* @__PURE__ */ _(h, { children: [
455
- /* @__PURE__ */ g(i, { className: "ttw:my-1" }),
456
- /* @__PURE__ */ _("div", {
505
+ L && N.bankAccount && /* @__PURE__ */ b(v, { children: [
506
+ /* @__PURE__ */ y(o, { className: "ttw:my-1" }),
507
+ /* @__PURE__ */ b("div", {
457
508
  className: "ttw:flex ttw:flex-col ttw:gap-1",
458
- children: [/* @__PURE__ */ g(a, {
509
+ children: [/* @__PURE__ */ y(s, {
459
510
  variant: "body2",
460
511
  className: "ttw:font-semibold",
461
- children: j.paymentMethodsHeading
462
- }), /* @__PURE__ */ g(a, {
512
+ children: M.paymentMethodsHeading
513
+ }), /* @__PURE__ */ y(s, {
463
514
  variant: "body2",
464
515
  className: "ttw:text-muted-foreground",
465
- children: j.paymentMethodsDescription
516
+ children: M.paymentMethodsDescription
466
517
  })]
467
518
  }),
468
- /* @__PURE__ */ g(c, {
469
- idPrefix: `${N}-ach`,
470
- values: f.bankAccount,
519
+ /* @__PURE__ */ y(d, {
520
+ idPrefix: `${P}-ach`,
521
+ values: l.bankAccount,
471
522
  errors: m?.bankAccount,
472
- onChange: (e) => E?.(e),
473
- labels: j.ach
523
+ onChange: (e) => D?.(e),
524
+ labels: M.ach
474
525
  })
475
526
  ] })
476
527
  ]
477
528
  });
478
529
  }
479
530
  //#endregion
480
- export { w as CounterpartFormFields, C as CounterpartFormSheet, C as default, x as useFocusFirstInvalidField };
531
+ export { D as CounterpartFormFields, E as CounterpartFormSheet, E as default, w as useFocusFirstInvalidField };